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

Buggy submission (status: Time Limit Exceeded):
#include <algorithm>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <iostream>
#include <istream>
#include <map>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <vector>

using namespace std;

typedef long long ll;
typedef pair<ll, int> P;

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

  ll ans = 2018;

  r = min(r, r + 2019);

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

  cout << ans << endl;

  return 0;
}

Fixed submission:
#include <algorithm>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <iostream>
#include <istream>
#include <map>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <vector>

using namespace std;

typedef long long ll;
typedef pair<ll, int> P;

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

  ll ans = 2018;

  r = min(r, l + 2019);

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

  cout << ans << endl;

  return 0;
}
Problem p02983 (C++)

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

int main() {
  long long L, R;
  std::cin >> L >> R;
  int min = 2018 * 2018;

  if (L - R >= 2019) {
    std::cout << 0 << std::endl;
    return 0;
  } else {
    for (int i = L; i <= R; i++) {
      for (int j = i + 1; j <= R; j++) {
        int l = i % 2019;
        int r = j % 2019;
        int Z = l * r;
        int min_temp = l * r % 2019;
        if (min >= min_temp)
          min = min_temp;
      }
    }
  }
  std::cout << min << std::endl;
  return 0;
}


Fixed submission:
#include <iostream>

int main() {
  long long L, R;
  std::cin >> L >> R;
  int min = 2018 * 2018;

  if (R - L >= 2019) {
    std::cout << 0 << std::endl;
    return 0;
  } else {
    for (int i = L; i <= R; i++) {
      for (int j = i + 1; j <= R; j++) {
        int l = i % 2019;
        int r = j % 2019;
        int Z = l * r;
        int min_temp = l * r % 2019;
        if (min >= min_temp)
          min = min_temp;
      }
    }
  }
  std::cout << min << std::endl;
  return 0;
}
Problem p02983 (C++)

Buggy submission (status: Time Limit Exceeded):
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
int main() {
  ll l, r, minn = 2020;
  cin >> l >> r;
  for (ll i = l; i < r; i++) {
    for (ll j = r; j > l; j--) {
      minn = min(minn, (i * j) % 2019);
      // cout<<i*j<<" "<<i*j%2019<<endl;
    }
  }
  cout << minn;
  return 0;
}


Fixed submission:
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
int main() {
  ll l, r, minn = 2020;
  cin >> l >> r;
  for (ll i = l; i < r; i++) {
    for (ll j = r; j > l; j--) {
      minn = min(minn, (i * j) % 2019);
      if (minn == 0) {
        cout << minn;
        return 0;
      }
      // cout<<i*j<<" "<<i*j%2019<<endl;
    }
  }
  cout << minn;
  return 0;
}
Problem p02983 (C++)

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

int main() {
  ll l = 0;
  ll r = 0;

  constexpr ll waru = 2019;

  cin >> l >> r;

  ll minValue = 10e10;
  for (ll i = l; i < r; ++i) {
    for (ll j = i + 1; j <= r; ++j) {
      ll current = ((i % waru) * (j % waru)) % waru;
      if (current < minValue)
        minValue = current;
    }
  }
  cout << minValue;

  return 0;
}


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

int main() {
  ll l = 0;
  ll r = 0;

  constexpr ll waru = 2019;

  cin >> l >> r;

  ll minValue = 10e10;
  for (ll i = l; i < r; ++i) {
    for (ll j = i + 1; j <= r; ++j) {
      ll current = ((i % waru) * (j % waru)) % waru;
      if (minValue == 0) {
        cout << minValue;
        return 0;
      }
      if (current < minValue)
        minValue = current;
    }
  }
  cout << minValue;

  return 0;
}
Problem p02983 (C++)

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

using namespace std;

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

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

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

  cout << ans << endl;
}

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

using namespace std;

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

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

  r = min(r, l + 2019 * 2);

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

  cout << ans << endl;
}
Problem p02983 (Python)

Buggy submission (status: Time Limit Exceeded):
L, R = map(int, input().split())

# max_loop = 2019 * 2 + 1
max_loop = 2019**2
count = 0
ans = 2019
for i in range(L, R + 1):
    for j in range(i + 1, R + 1):
        x = (i * j) % 2019
        ans = min(ans, x)
    if ans == 0:
        break
print(ans)


Fixed submission:
L, R = map(int, input().split())

# max_loop = 2019 * 2 + 1
max_loop = 2019**2
count = 0
ans = 2019
for i in range(L, R + 1):
    for j in range(i + 1, R + 1):
        x = (i * j) % 2019
        ans = min(ans, x)
        if ans == 0:
            print(0)
            exit()
print(ans)
Problem p02983 (Python)

Buggy submission (status: Time Limit Exceeded):
#!/usr/bin/env python3
# -*- coding: utf-8 -*-


def main():
    L, R = map(int, input().split())
    result = []
    for i in range(L, R + 1):
        for j in range(i + 1, R + 1):
            result.append(i * j % 2019)
    print(min(result))


if __name__ == "__main__":
    main()


Fixed submission:
#!/usr/bin/env python3
# -*- coding: utf-8 -*-


def main():
    L, R = map(int, input().split())
    mod = 2019

    min_mod = float("inf")

    for i in range(L, min(R, L + mod)):
        for j in range(i + 1, min(R + 1, i + 1 + mod)):
            curr_mod = i * j % mod
            min_mod = min(min_mod, curr_mod)
            if min_mod == 0:
                break

    print(min_mod)


if __name__ == "__main__":
    main()
Problem p02983 (Python)

Buggy submission (status: Time Limit Exceeded):
L, R = map(int, input().split())
a = 0
b = 2019
for i in range(L, R):
    for j in range(i + 1, R + 1):
        a = i * j % 2019
        if a <= b:
            b = a

print(b)


Fixed submission:
L, R = map(int, input().split())
a = 0
b = 2019
if R - L >= 2018:
    b = 0
else:
    for i in range(L, R):
        for j in range(i + 1, R + 1):
            a = i * j % 2019
            if a <= b:
                b = a

print(b)
Problem p02983 (Python)

Buggy submission (status: Time Limit Exceeded):
#!/usr/bin/env python3


def read_h(typ=int):
    return list(map(typ, input().split()))


def read_v(n, m=1, typ=int):
    return [read_h() if m > 1 else typ(input()) for _ in range(n)]


def main():
    L, R = read_h()

    if R % 2019 == 0 or L % 2019 == 0 or (R - L) % 2019 == 0:
        print(0)
        return

    ans = 2019
    for i in range(L, R):
        for j in range(i + 1, R + 1):
            ans = min(ans, (i % 2019) * (j % 2019) % 2019)

    print(ans)


if __name__ == "__main__":
    main()


Fixed submission:
#!/usr/bin/env python3


def read_h(typ=int):
    return list(map(typ, input().split()))


def read_v(n, m=1, typ=int):
    return [read_h() if m > 1 else typ(input()) for _ in range(n)]


def main():
    L, R = read_h()

    if R - L >= 2019 or R % 2019 <= L % 2019:
        print(0)
        return

    ans = 2019
    for i in range(L, R):
        for j in range(i + 1, R + 1):
            ans = min(ans, (i % 2019) * (j % 2019) % 2019)

    print(ans)


if __name__ == "__main__":
    main()
Problem p02983 (C++)

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

int main() {
  int l, r;
  scanf("%d", &l);
  scanf("%d", &r);

  int result = 2019;
  int mod = 2019;
  long i, j;

  for (i = l; i < r; i++) {
    for (j = l + 1; j <= r; j++) {
      mod = (i * j) % 2019;
      if (mod < result) {
        result = mod;
        if (result == 0)
          break;
      }
    }
  }

  printf("%d\n", result);
  return 0;
}

Fixed submission:
#include <stdio.h>

int main() {
  int l, r;
  scanf("%d", &l);
  scanf("%d", &r);

  if (r - l >= 2019)
    r = l + 2018;

  int result = 2019;
  int mod = 2019;
  long i, j;

  for (i = l; i < r; i++) {
    for (j = l + 1; j <= r; j++) {
      mod = (i * j) % 2019;
      if (mod < result) {
        result = mod;
        if (result == 0)
          break;
      }
    }
  }

  printf("%d\n", result);
  return 0;
}
Problem p02983 (Python)

Buggy submission (status: Time Limit Exceeded):
def main():
    N, M = map(int, input().split())
    ans = -1
    for n in range(M)[N:]:
        for i in range(M + 1)[n + 1 :]:
            mod = n * i % 2019
            if ans < 0 or mod < ans:
                ans = mod
        if mod == 0:
            break
    print(ans)


if __name__ == "__main__":
    main()


Fixed submission:
def main():
    N, M = map(int, input().split())
    ans = -1
    for n in range(M)[N:]:
        for i in range(M + 1)[n + 1 :]:
            mod = n * i % 2019
            if ans < 0 or mod < ans:
                ans = mod
                if ans == 0:
                    break
        if ans == 0:
            break
    print(ans)


if __name__ == "__main__":
    main()
Problem p02983 (Python)

Buggy submission (status: Time Limit Exceeded):
def make_list(L, R):
    mod_list = list()

    if R - L <= 2019:
        for i in range(L, R):
            for j in range(i + 1, R + 1):
                mod_list.append((i * j) % 2019)
    else:
        for i in range(L, R):
            for j in range(i + 1, i + 2021):
                mod_list.append((i * j) % 2019)

    return mod_list


def main():
    L, R = map(int, input().split())

    mod_list = make_list(L, R)

    print(min(mod_list))

    return


if __name__ == "__main__":
    main()


Fixed submission:
def make_list(L, R):
    mod_list = list()

    if R - L <= 2019:
        for i in range(L, R):
            for j in range(i + 1, R + 1):
                mod_list.append((i * j) % 2019)
    else:
        for i in range(L, L + 2020):
            for j in range(i + 1, i + 2021):
                mod_list.append((i * j) % 2019)

    return mod_list


def main():
    L, R = map(int, input().split())

    mod_list = make_list(L, R)

    print(min(mod_list))

    return


if __name__ == "__main__":
    main()
Problem p02983 (Python)

Buggy submission (status: Time Limit Exceeded):
L, R = map(int, input().split())

res = float("inf")
for i in range(L, R + 1):
    for j in range(i + 1, R + 1):
        res = min(res, (i * j) % 2019)
print(res)


Fixed submission:
L, R = map(int, input().split())

if R - L >= 2019:
    res = 0
else:
    res = float("inf")
    L = L % 2019
    R = R % 2019
    for i in range(L, R + 1):
        for j in range(i + 1, R + 1):
            res = min(res, (i * j) % 2019)
print(res)
Problem p02983 (Python)

Buggy submission (status: Runtime Error):
L, R = [int(_) for _ in input().split()]

diff = R - L
if diff >= 2019:
    print("0")
else:
    ans = min([i * j % 2019 for j in range(L + 1, R) for i in range(L, R)])
    print(ans)


Fixed submission:
L, R = [int(_) for _ in input().split()]

diff = R - L
if diff >= 2019:
    print("0")
else:
    ans = min([i * j % 2019 for j in range(L + 1, R + 1) for i in range(L, R)])
    print(ans)
Problem p02983 (Python)

Buggy submission (status: Time Limit Exceeded):
L, R = map(int, input().split())

tmp = R - L + 1
if tmp >= 2019:
    print(0)
    exit()
else:
    start = L % 2019
    end = R % 2019
    candidate = []
    for i in range(start, end + 1):
        candidate.append(i % 2019)
    candidate.sort()
    ans = []
    for i in range(len(candidate)):
        for j in range(len(candidate)):
            if i == j:
                continue
            else:
                ans.append((candidate[i] * candidate[j]) % 2019)
    ans.sort()
    print(ans[0])


Fixed submission:
L, R = map(int, input().split())

tmp = R - L + 1
if tmp >= 2019:
    print(0)
    exit()
else:
    start = L % 2019
    end = R % 2019
    candidate = []
    for i in range(start, end + 1):
        candidate.append(i % 2019)
    candidate.sort()
    ans = []
    for i in range(len(candidate)):
        if i == (len(candidate) - 1):
            continue
        for j in range(i + 1, len(candidate)):
            if i == j:
                continue
            else:
                ans.append((candidate[i] * candidate[j]) % 2019)
    ans.sort()
    print(ans[0])
Problem p02983 (Python)

Buggy submission (status: Time Limit Exceeded):
def slove():
    import sys

    input = sys.stdin.readline
    l, r = list(map(int, input().rstrip("\n").split()))
    mmod = 10**10
    for i in range(l, r + 1):
        for j in range(i + 1, r + 1):
            mmod = min(mmod, (i * j) % 2019)
            if mmod == 0:
                break
    print(mmod)


if __name__ == "__main__":
    slove()


Fixed submission:
def slove():
    import sys

    input = sys.stdin.readline
    l, r = list(map(int, input().rstrip("\n").split()))
    mmod = 10**10
    for i in range(l, r + 1):
        for j in range(i + 1, r + 1):
            mmod = min(mmod, (i * j) % 2019)
            if mmod == 0:
                break
        if mmod == 0:
            break
    print(mmod)


if __name__ == "__main__":
    slove()
Problem p02983 (Python)

Buggy submission (status: Time Limit Exceeded):
L, R = map(int, input().split())
min_mod = 10**9
for i in range(L, R):
    for j in range(i + 1, min(L + 2019, R + 1)):
        min_mod = min(min_mod, (i * j) % 2019)
print(min_mod)


Fixed submission:
L, R = map(int, input().split())
min_mod = 10**9
for i in range(L, min(L + 2019, R + 1)):
    for j in range(i + 1, min(L + 2019, R + 1)):
        min_mod = min(min_mod, (i * j) % 2019)
print(min_mod)
Problem p02983 (Python)

Buggy submission (status: Time Limit Exceeded):
L, R = map(int, input().split())
ans = 2018
for i in range(L, R):
    for j in range(i + 1, R + 1):
        ans = min(ans, (i * j) % 2019)
        if ans == 0:
            break
print(ans)


Fixed submission:
L, R = map(int, input().split())
ans = 2018
for i in range(L, R):
    for j in range(i + 1, R + 1):
        ans = min(ans, (i * j) % 2019)
        if ans == 0:
            print(ans)
            exit()
print(ans)
Problem p02983 (Python)

Buggy submission (status: Runtime Error):
from itertools import combinations

L, R = map(int, input().split())
ans = 2018
for i, j in combinations(range(L, R + 1), 2):
    a = i % 2019
    b = j % 2019
    mod = (a * b) % 2019
    if ans > mod:
        ans = mod
print(ans)


Fixed submission:
from itertools import combinations

L, R = map(int, input().split())
if (L % 2019 > R % 2019) or R - L >= 2019:
    print(0)
else:
    ans = 2018
    for i, j in combinations(range(L, R + 1), 2):
        a = i % 2019
        b = j % 2019
        mod = (a * b) % 2019
        if ans > mod:
            ans = mod
    print(ans)
Problem p02983 (C++)

Buggy submission (status: Time Limit Exceeded):
#include <algorithm> //sort,reverse
#include <deque>     //double_ended queue
#include <iostream>
#include <queue> //queue,priority_queue
#include <string>
#include <utility> //pair
#include <vector>
using namespace std;
typedef pair<int, int> P; // Pでpair<-,->を表す。
typedef long long LL;
LL MOD = 1000000007;

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

Fixed submission:
#include <algorithm> //sort,reverse
#include <deque>     //double_ended queue
#include <iostream>
#include <queue> //queue,priority_queue
#include <string>
#include <utility> //pair
#include <vector>
using namespace std;
typedef pair<int, int> P; // Pでpair<-,->を表す。
typedef long long LL;
LL MOD = 1000000007;

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

Buggy submission (status: Time Limit Exceeded):
#include "algorithm"
#include "bitset"
#include "cassert"
#include "climits"
#include "cmath"
#include "cstdio"
#include "ctime"
#include "functional"
#include "iomanip"
#include "iostream"
#include "list"
#include "map"
#include "numeric"
#include "queue"
#include "random"
#include "set"
#include "stack"
#include "string"
#include "unordered_map"
#include "unordered_set"

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

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

Fixed submission:
#include "algorithm"
#include "bitset"
#include "cassert"
#include "climits"
#include "cmath"
#include "cstdio"
#include "ctime"
#include "functional"
#include "iomanip"
#include "iostream"
#include "list"
#include "map"
#include "numeric"
#include "queue"
#include "random"
#include "set"
#include "stack"
#include "string"
#include "unordered_map"
#include "unordered_set"

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

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

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

using namespace std;
int main() {
  unsigned int L, R;

  cin >> L >> R;

  unsigned long mn = 2 * 1000000000;
  int ci, cj;
  ci = 0;
  for (int si = L; si < R; si++) {
    for (int sj = si + 1; sj <= R; sj++) {
      //            cout << si << " " << sj << " ";
      unsigned long ijmod = ((unsigned long)si * (unsigned long)sj) % 2019;
      //            cout << ijmod << endl;
      if (ijmod < mn)
        mn = ijmod;

      cj++;
      if (cj == 2019)
        break;
    }
    ci++;
    if (ci == 2019)
      break;
  }

  cout << mn << endl;

  return 0;
}


Fixed submission:
#include <iostream>

using namespace std;
int main() {
  unsigned int L, R;

  cin >> L >> R;

  unsigned long mn = 2 * 1000000000;
  int ci, cj;
  ci = 0;
  for (int si = L; si < R; si++) {
    cj = 0;
    for (int sj = si + 1; sj <= R; sj++) {
      //            cout << si << " " << sj << " ";
      unsigned long ijmod = ((unsigned long)si * (unsigned long)sj) % 2019;
      //            cout << ijmod << endl;
      if (ijmod < mn)
        mn = ijmod;

      cj++;
      if (cj == 2019)
        break;
    }
    ci++;
    if (ci == 2019)
      break;
  }

  cout << mn << endl;

  return 0;
}
Problem p02983 (C++)

Buggy submission (status: Time Limit Exceeded):
#include <algorithm>
#include <cmath>
#include <iostream>
#include <list>
#include <map>
#include <queue>
#include <set>
#include <string>
#include <vector>
// #include <iomanip>
// std::cout << std::fixed << std::setprecision(5);

int main() {
  unsigned long long int L, R;
  std::cin >> L >> R;
  unsigned long long int mi = 2019 * 2019;
  for (unsigned long long int i = L; i <= R; i++) {
    for (unsigned long long int j = i + 1; j <= R; j++) {
      mi = std::min(mi, i * j % 2019);
    }
  }

  std::cout << mi << std::endl;

  return 0;
}

Fixed submission:
#include <algorithm>
#include <cmath>
#include <iostream>
#include <list>
#include <map>
#include <queue>
#include <set>
#include <string>
#include <vector>
// #include <iomanip>
// std::cout << std::fixed << std::setprecision(5);

int main() {
  unsigned long long int L, R;
  std::cin >> L >> R;
  if (R - L > 10000) {
    std::cout << 0 << std::endl;
    return 0;
  }
  unsigned long long int mi = 2019 * 2019;
  for (unsigned long long int i = L; i <= R; i++) {
    for (unsigned long long int j = i + 1; j <= R; j++) {
      mi = std::min(mi, i * j % 2019);
    }
  }

  std::cout << mi << std::endl;

  return 0;
}
Problem p02983 (C++)

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

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

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

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

Buggy submission (status: Runtime Error):
#include <algorithm>
#include <bitset>
#include <cmath>
#include <iostream>
#include <stdio.h>
#define rep(i, n) for (int i = 0; i < (n); ++i)

using namespace std;

typedef long long ll;

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

  ll arr[2019];

  ll limit = 2019 <= R - (L - 1) ? 2019 : R - (L - 1);

  limit = limit;

  // cout<<"limit:"<<limit<<endl;

  for (ll i = L; i <= limit + L; ++i) {
    arr[i - L] = i % (ll)2019;
  }

  /*
     for(ll i=0;i<limit;++i){
     cout<<i<<":"<<arr[i]<<" ";
     }
     cout<<endl;
  */
  // cout<<"abc"<<endl;

  ll ans = 2019;

  for (ll i = 0; i < limit - 1; ++i) {
    for (ll j = i + 1; j < limit; ++j) {
      ll tmp = (arr[i] * arr[j]) % 2019;
      ans = ans <= tmp ? ans : tmp;
    }
  }

  cout << ans << endl;
}

Fixed submission:
#include <algorithm>
#include <bitset>
#include <cmath>
#include <iostream>
#include <stdio.h>
#define rep(i, n) for (int i = 0; i < (n); ++i)

using namespace std;

typedef long long ll;

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

  ll arr[2019];

  ll limit = 2019 <= R - (L - 1) ? 2019 : R - (L - 1);

  limit = limit;

  // cout<<"limit:"<<limit<<endl;

  for (ll i = L; i < limit + L; ++i) {
    arr[i - L] = i % (ll)2019;
  }

  /*
     for(ll i=0;i<limit;++i){
     cout<<i<<":"<<arr[i]<<" ";
     }
     cout<<endl;
  */
  // cout<<"abc"<<endl;

  ll ans = 2019;

  for (ll i = 0; i < limit - 1; ++i) {
    for (ll j = i + 1; j < limit; ++j) {
      ll tmp = (arr[i] * arr[j]) % 2019;
      ans = ans <= tmp ? ans : tmp;
    }
  }

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

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

#define REP(i, x) for (int i = 0; i < (int)(x); i++)
#define ALL(x) (x).begin(), (x).end()

typedef long long ll;
using namespace std;

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

  ll L, R;
  ll ans = 1 << 30;
  ll i, j;
  cin >> L >> R;

  for (i = L; i <= L + 2019 && i <= R; ++i) {
    for (j = i + 1; j <= j + 2018 && j <= R; ++j) {
      if (((i * j) % 2019) < ans) {
        // cout << i << "," << j << "," << (i * j) % 2019 << endl;
        ans = (i * j) % 2019;
      }
    }
  }

  cout << ans << endl;

  return 0;
}

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

#define REP(i, x) for (int i = 0; i < (int)(x); i++)
#define ALL(x) (x).begin(), (x).end()

typedef long long ll;
using namespace std;

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

  ll L, R;
  ll ans = 1 << 30;
  ll i, j;
  cin >> L >> R;

  for (i = L; i <= L + 2019 && i <= R; ++i) {
    for (j = i + 1; j <= j + 2018 && j <= R; ++j) {
      if (((i * j) % 2019) < ans) {
        // cout << i << "," << j << "," << (i * j) % 2019 << endl;
        ans = (i * j) % 2019;
      }
      if (ans == 0) {
        cout << ans << endl;
        return 0;
      }
    }
  }

  cout << ans << endl;

  return 0;
}
Problem p02983 (C++)

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

inline namespace atcoder {
template <typename T, size_t Depth> struct vector_helper {
  using type = vector<typename vector_helper<T, Depth - 1>::type>;
};
template <typename T> struct vector_helper<T, 0> {
  using type = T;
};
template <typename T, size_t Depth>
using vector_t = typename vector_helper<T, Depth>::type;

template <typename T> using vec = vector_t<T, 1>;
template <typename T> using vvec = vector_t<T, 2>;
template <typename T> using vvvec = vector_t<T, 3>;

constexpr int64_t mpow(int64_t a, int64_t b, int64_t mod = 1000000007) {
  if (b <= 0)
    return 1;
  if (b == 1)
    return a % mod;
  if (b == 2)
    return (a * a) % mod;
  return (max(a * (b & 1), (int64_t)1) * mpow(mpow(a, b / 2, mod), 2, mod)) %
         mod;
}
constexpr int64_t mdiv(int64_t a, int64_t b, int64_t mod = 1000000007) {
  return (a * mpow(b, mod - 2, mod)) % mod;
}
} // namespace atcoder

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


Fixed submission:
#include <algorithm>
#include <array>
#include <climits>
#include <cmath>
#include <cstdint>
#include <iostream>
#include <string>
#include <vector>
using namespace std;

inline namespace atcoder {
template <typename T, size_t Depth> struct vector_helper {
  using type = vector<typename vector_helper<T, Depth - 1>::type>;
};
template <typename T> struct vector_helper<T, 0> {
  using type = T;
};
template <typename T, size_t Depth>
using vector_t = typename vector_helper<T, Depth>::type;

template <typename T> using vec = vector_t<T, 1>;
template <typename T> using vvec = vector_t<T, 2>;
template <typename T> using vvvec = vector_t<T, 3>;

constexpr int64_t mpow(int64_t a, int64_t b, int64_t mod = 1000000007) {
  if (b <= 0)
    return 1;
  if (b == 1)
    return a % mod;
  if (b == 2)
    return (a * a) % mod;
  return (max(a * (b & 1), (int64_t)1) * mpow(mpow(a, b / 2, mod), 2, mod)) %
         mod;
}
constexpr int64_t mdiv(int64_t a, int64_t b, int64_t mod = 1000000007) {
  return (a * mpow(b, mod - 2, mod)) % mod;
}
} // namespace atcoder

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

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

int main() {
  long long l, r;
  scanf("%lld%lld", &l, &r);
  long long a = (l * (l + 1)) % 2019;
  for (long long i = l; i <= min(r, l + 2018); ++i) {
    for (long long j = i + 1; j <= r; ++j) {
      if ((i * j) % 2019 < a)
        a = (i * j) % 2019;
    }
  }
  cout << a << endl;
}


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

int main() {
  long long l, r;
  scanf("%lld%lld", &l, &r);
  long long a = (l * (l + 1)) % 2019;
  for (long long i = l; i <= min(r, l + 2018); ++i) {
    for (long long j = i + 1; j <= min(r, i + 2019); ++j) {
      if ((i * j) % 2019 < a)
        a = (i * j) % 2019;
    }
  }
  cout << a << endl;
}
Problem p02983 (C++)

Buggy submission (status: Time Limit Exceeded):
#include <algorithm>
#include <cmath>
#include <iomanip>
#include <iostream>
#include <limits>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <stdio.h>
#include <string>
#include <tuple>
#include <vector>

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

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

  cout << ans << endl;
}


Fixed submission:
#include <algorithm>
#include <cmath>
#include <iomanip>
#include <iostream>
#include <limits>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <stdio.h>
#include <string>
#include <tuple>
#include <vector>

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

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

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

Buggy submission (status: Time Limit Exceeded):
#include <algorithm>
#include <array>
#include <bitset>
#include <cmath>
#include <cstdio>
#include <deque>
#include <functional>
#include <iomanip>
#include <iostream>
#include <limits>
#include <map>
#include <numeric>
#include <set>
#include <string>
#include <utility>
#include <vector>

using namespace std;
typedef long long int ll;

#define C cout <<
#define E << endl
#define CE cout << endl

ll n, m, a, b, c, x, y, z, aa[200010], ab[200010], ac[1010];
bool r, ra, rb, rc[200010];
string s, sa, sb, sc;
char ca, cb, cc, cd[1010][1010];
vector<ll> va, vb, vc, vd, ve, vaa, vbb;
set<int> st;

template <typename MAIN>
ostream &operator<<(ostream &osys, const vector<MAIN> target) {
  for (MAIN it : target)
    osys << it << " ";
  return osys;
}

int main() {
  cin >> a >> b;
  m = 2018;
  for (ll i = a; i <= b; i++) {
    for (ll j = i + 1; j <= b; j++) {
      m = min(m, i * j % 2019);
    }
  }
  C m E;
}

Fixed submission:
#include <algorithm>
#include <array>
#include <bitset>
#include <cmath>
#include <cstdio>
#include <deque>
#include <functional>
#include <iomanip>
#include <iostream>
#include <limits>
#include <map>
#include <numeric>
#include <set>
#include <string>
#include <utility>
#include <vector>

using namespace std;
typedef long long int ll;

#define C cout <<
#define E << endl
#define CE cout << endl

ll n, m, a, b, c, x, y, z, aa[200010], ab[200010], ac[1010];
bool r, ra, rb, rc[200010];
string s, sa, sb, sc;
char ca, cb, cc, cd[1010][1010];
vector<ll> va, vb, vc, vd, ve, vaa, vbb;
set<int> st;

template <typename MAIN>
ostream &operator<<(ostream &osys, const vector<MAIN> target) {
  for (MAIN it : target)
    osys << it << " ";
  return osys;
}

int main() {
  cin >> a >> b;
  m = 2018;
  for (ll i = a; i <= b and i <= a + 2019; i++) {
    for (ll j = i + 1; j <= b and j <= a + 2019; j++) {
      m = min(m, i * j % 2019);
    }
  }
  C m E;
}
Problem p02983 (C++)

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

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

  int iminimum = 2018;
  for (int in = l; in < r; in++) {
    for (int im = in + 1; im < r + 1; im++) {
      int jn = in % 2019;
      int jm = im % 2019;
      iminimum = min(iminimum, (jn * jm) % 2019);
    }
  }
  cout << iminimum << endl;

  return 0;
}


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

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

  int iminimum = 2018;
  for (int in = l; in < r; in++) {
    for (int im = in + 1; im < r + 1; im++) {
      int jn = in % 2019;
      int jm = im % 2019;
      iminimum = min(iminimum, (jn * jm) % 2019);
      if (iminimum == 0) {
        cout << 0 << endl;
        return 0;
      }
    }
  }
  cout << iminimum << endl;

  return 0;
}
Problem p02983 (C++)

Buggy submission (status: Time Limit Exceeded):
#include <algorithm>
#include <bitset>
#include <cmath>
#include <cstring>
#include <deque>
#include <functional>
#include <iomanip>
#include <iostream>
#include <list>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>
using namespace std;
using ll = long long;

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

  ll tmp_minimum = 9999;
  for (ll i = L; i <= min(R - 1, L + 2018); i++) {
    for (ll j = i + 1; j <= min(R, j + 2018); j++) {
      tmp_minimum = min((i * j) % 2019, tmp_minimum);
    }
  }

  cout << tmp_minimum;
  return 0;
}


Fixed submission:
#include <algorithm>
#include <bitset>
#include <cmath>
#include <cstring>
#include <deque>
#include <functional>
#include <iomanip>
#include <iostream>
#include <list>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>
using namespace std;
using ll = long long;

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

  ll tmp_minimum = 9999;
  for (ll i = L; i <= min(R - 1, L + 2018); i++) {
    for (ll j = i + 1; j <= min(R, i + 1 + 2018); j++) {
      tmp_minimum = min((i * j) % 2019, tmp_minimum);
    }
  }

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

Buggy submission (status: Time Limit Exceeded):
#include <bits/stdc++.h>
#define REP(i, n) for (int i = 0; i < n; i++)
#define REPR(i, n) for (int i = n; i >= 0; i--)
#define FOR(i, m, n) for (int i = m; i < n; i++)
#define INF 2e9
#define ALL(v) v.begin(), v.end()
using namespace std;
typedef long long ll;
int main() {
  long l, r;
  cin >> l >> r;
  int ans = 2020;
  for (int i = l; i < r; i++) {
    for (int j = i + 1; j < r + 1; j++) {
      ans = min(ans, int((long(i) * long(j)) % 2019));
      if (ans == 0)
        break;
    }
  }
  cout << ans << endl;
}


Fixed submission:
#include <bits/stdc++.h>
#define REP(i, n) for (int i = 0; i < n; i++)
#define REPR(i, n) for (int i = n; i >= 0; i--)
#define FOR(i, m, n) for (int i = m; i < n; i++)
#define INF 2e9
#define ALL(v) v.begin(), v.end()
using namespace std;
typedef long long ll;
int main() {
  long l, r;
  cin >> l >> r;
  int ans = 2020;
  int distance = r - l;

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

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

using namespace std;
using Int = long long int;
using UInt = unsigned long long int;
using VI = vector<long long int>;
using VVI = vector<vector<long long int>>;

// 二つの値の最小値を求める関数
Int Min(const Int a, const Int b) {
  if (a <= b) {
    return a;
  } else {
    return b;
  }
}

int main(void) {
  Int l, r;
  cin >> l >> r;
  Int result = 2019;
  for (Int i = l; i <= r; ++i) {
    for (Int j = i + 1; j <= r; ++j) {
      result = Min(result, (i * j) % 2019);
    }
  }
  cout << result << endl;
  return 0;
}


Fixed submission:
#include <algorithm>
#include <cassert>
#include <climits>
#include <cmath>
#include <iomanip>
#include <iostream>
#include <map>
#include <string>
#include <utility>
#include <vector>

using namespace std;
using Int = long long int;
using UInt = unsigned long long int;
using VI = vector<long long int>;
using VVI = vector<vector<long long int>>;

// 二つの値の最小値を求める関数
Int Min(const Int a, const Int b) {
  if (a <= b) {
    return a;
  } else {
    return b;
  }
}

int main(void) {
  Int l, r;
  cin >> l >> r;
  r = Min(r, l + 2019);
  Int result = 2019;
  for (Int i = l; i <= r; ++i) {
    for (Int j = i + 1; j <= r; ++j) {
      result = Min(result, (i * j) % 2019);
    }
  }
  cout << result << endl;
  return 0;
}
Problem p02983 (C++)

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

using namespace std;
using Int = long long int;
using UInt = unsigned long long int;
using VI = vector<long long int>;
using VVI = vector<vector<long long int>>;

// 二つの値の最小値を求める関数
Int Min(const Int a, const Int b) {
  if (a <= b) {
    return a;
  } else {
    return b;
  }
}

int main(void) {
  Int l, r;
  cin >> l >> r;
  /*
  l = (l % 2019);
  r = (r % 2019);
  if (l >= r) {
      r += 2019;
  }
  */

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


Fixed submission:
#include <algorithm>
#include <cassert>
#include <climits>
#include <cmath>
#include <iomanip>
#include <iostream>
#include <map>
#include <string>
#include <utility>
#include <vector>

using namespace std;
using Int = long long int;
using UInt = unsigned long long int;
using VI = vector<long long int>;
using VVI = vector<vector<long long int>>;

// 二つの値の最小値を求める関数
Int Min(const Int a, const Int b) {
  if (a <= b) {
    return a;
  } else {
    return b;
  }
}

int main(void) {
  Int l, r;
  cin >> l >> r;
  /*
  l = (l % 2019);
  r = (r % 2019);
  if (l >= r) {
      r += 2019;
  }
  */

  Int result = 2019;
  for (Int i = l; i <= r; ++i) {
    for (Int j = i + 1; j <= r; ++j) {
      result = Min(result, (i * j) % 2019);
      if (result == 0) {
        cout << 0 << endl;
        return 0;
      }
    }
  }
  cout << result << 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 REPR(i, n) for (int i = n - 1; i >= 0; i--)
#define FOR(i, m, n) for (int i = m; i <= n; i++)
#define FORR(i, m, n) for (int i = m; i >= n; i--)
#define SORT(v, n) sort(v, v + n);
#define VSORT(v) sort(v.begin(), v.end());
#define VSORTR(v) sort(v.rbegin(), v.rend());
#define ALL(v) (v).begin(), (v).end()

using ll = long long;
using vll = vector<ll>;
using vvll = vector<vector<ll>>;
using P = pair<ll, ll>;

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

  ll l, r;
  cin >> l >> r;
  ll mod = 2019;

  if (l - r >= 2018)
    cout << 0 << endl;
  else {
    ll res = 10000;
    for (ll x = l; x <= r; x++) {
      for (ll y = x; y <= r; y++) {
        if (y <= x)
          continue;
        ll tmp = (x * y) % mod;
        res = min(res, tmp);
      }
    }
    cout << res << endl;
  }
  return 0;
}

Fixed submission:
#include <bits/stdc++.h>
using namespace std;
#define REP(i, n) for (int i = 0; i < n; i++)
#define REPR(i, n) for (int i = n - 1; i >= 0; i--)
#define FOR(i, m, n) for (int i = m; i <= n; i++)
#define FORR(i, m, n) for (int i = m; i >= n; i--)
#define SORT(v, n) sort(v, v + n);
#define VSORT(v) sort(v.begin(), v.end());
#define VSORTR(v) sort(v.rbegin(), v.rend());
#define ALL(v) (v).begin(), (v).end()

using ll = long long;
using vll = vector<ll>;
using vvll = vector<vector<ll>>;
using P = pair<ll, ll>;

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

  ll l, r;
  cin >> l >> r;
  ll mod = 2019;

  if (r - l >= 2018)
    cout << 0 << endl;
  else {
    ll res = 10000;
    for (ll x = l; x <= r; x++) {
      for (ll y = x; y <= r; y++) {
        if (y <= x)
          continue;
        ll tmp = (x * y) % mod;
        res = min(res, tmp);
      }
    }
    cout << res << endl;
  }
  return 0;
}
Problem p02983 (C++)

Buggy submission (status: Time Limit Exceeded):
#include <algorithm>
#include <iostream>
#include <string>
#include <vector>
#define REP(i, a) for (int i = 0; i < (a); ++i)
#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define FORR(i, a, b) for (int i = (a); i >= (b); --i)
#define ALL(obj) (obj).begin, (obj).end()
#define SORT(list) sort(ALL((list)));
using namespace std;
using ll = long long;

int main() {
  ll l, r;
  cin >> l >> r;
  if (l - r >= 673) {
    cout << 0 << endl;
    return 0;
  }

  int min = 2019;
  for (ll i = l; i <= r; i++) {
    for (ll j = i; j <= r; j++) {

      if (i != j && ((i * j) % 2019) < min) {
        min = (i * j) % 2019;
      }
    }
  }
  cout << min << endl;
}

Fixed submission:
#include <algorithm>
#include <iostream>
#include <string>
#include <vector>
#define REP(i, a) for (int i = 0; i < (a); ++i)
#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define FORR(i, a, b) for (int i = (a); i >= (b); --i)
#define ALL(obj) (obj).begin, (obj).end()
#define SORT(list) sort(ALL((list)));
using namespace std;
using ll = long long;

int main() {
  ll l, r;
  cin >> l >> r;
  if (l - r >= 673) {
    cout << 0 << endl;
    return 0;
  }

  int min = 2019;
  for (ll i = l; i <= r; i++) {
    for (ll j = i; j <= r; j++) {

      if (i != j && ((i * j) % 2019) < min) {
        min = (i * j) % 2019;
      }
      if (i * j % 2019 == 0) {
        cout << 0 << endl;
        return 0;
      }
    }
  }
  cout << min << endl;
}
Problem p02983 (Python)

Buggy submission (status: Time Limit Exceeded):
def main():
    l, r = map(int, input().split())
    res = 1 << 30
    for i in range(l, r):
        for j in range(i + 1, r + 1):
            res = min(res, (i * j) % 2019)
            if res == 0:
                break
    print(res)


if __name__ == "__main__":
    main()


Fixed submission:
def main():
    l, r = map(int, input().split())
    res = 1 << 30
    for i in range(l, r):
        for j in range(i + 1, r + 1):
            res = min(res, (i * j) % 2019)
            if res == 0:
                print(res)
                return
    print(res)


if __name__ == "__main__":
    main()
Problem p02983 (Python)

Buggy submission (status: Runtime Error):
L, R = map(int, input().split())
MOD = 2019
L %= MOD
R %= MOD
print(min(i * j % 2019 for i in range(L, R) for j in range(i + 1, R + 1)))


Fixed submission:
L, R = map(int, input().split())
MOD = 2019
ans = float("inf")
for i in range(L, R):
    for j in range(i + 1, R + 1):
        ans = min(ans, i * j % MOD)
        if ans == 0:
            print(0)
            exit()
print(ans)
Problem p02983 (Python)

Buggy submission (status: Time Limit Exceeded):
l, r = map(int, input().split())
x = []
for i in range(l, r):
    for j in range(i + 1, r + 1):
        mod = i * j % 2019
        x.append(mod)
print(min(x))


Fixed submission:
l, r = map(int, input().split())
x = []
for i in range(l, r):
    for j in range(i + 1, r + 1):
        mod = i * j % 2019
        x.append(mod)
        if mod == 0:
            print(0)
            exit()
print(min(x))
Problem p02983 (C++)

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

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

Fixed submission:
#include <iostream>

int main() {
  long l, r;
  std::cin >> l >> r;
  long min = 2019L;
  if (r - l + 1 >= 2019L) {
    std::cout << 0 << std::endl;
    return 0;
  }

  long size = r - l + 1;
  long *rem = new long[size];
  for (long i = 0; i < size; i++)
    rem[i] = (l + i) % 2019L;

  for (long i = 0; i < size - 1; i++)
    for (long j = i + 1; j < size; j++) {
      long mod = (rem[i] * rem[j]) % 2019L;
      min = (mod < min) ? mod : min;
    }
  std::cout << min << std::endl;
  return 0;
}
Problem p02983 (C++)

Buggy submission (status: Runtime Error):
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
using namespace __gnu_pbds;
using namespace std;
#define int long long
#define ld long double
#define fi first
#define se second
#define pb push_back
#define pii pair<int, int>
#define all(x) (x).begin(), (x).end()
#define forn(i, n) for (int i = 0; i < (int)(n); i++)
#define for1(i, n) for (int i = 1; i <= (int)(n); i++)
#define debug(x) cout << '>' << #x << ':' << x << endl;
const int MOD = 1e9 + 7;
int mpow(int a, int b, int p = MOD) {
  a = a % p;
  int res = 1;
  while (b > 0) {
    if (b & 1)
      res = (res * a) % p;
    a = (a * a) % p;
    b = b >> 1;
  }
  return res % p;
}
typedef tree<pair<int, int>, null_type, less<pair<int, int>>, rb_tree_tag,
             tree_order_statistics_node_update>
    ordered_set;
const int N = 1e6 + 3;

int32_t main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
#ifndef ONLINE_JUDGE
  freopen("input.txt", "r", stdin);
// freopen("output.txt","w",stdout);
#endif
  int l, r;
  cin >> l >> r;
  r = min(r, l + 2 * (2019));
  vector<int> a;
  for (int i = l; i <= r; i++) {
    for (int j = i + 1; j <= r; j++) {
      a.pb((i * j) % 2019);
    }
  }
  sort(all(a));
  cout << a[0];
}
// k*2019-l=i*j;
//
// I never lose. I either win or I learn

Fixed submission:
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
using namespace __gnu_pbds;
using namespace std;
#define int long long
#define ld long double
#define fi first
#define se second
#define pb push_back
#define pii pair<int, int>
#define all(x) (x).begin(), (x).end()
#define forn(i, n) for (int i = 0; i < (int)(n); i++)
#define for1(i, n) for (int i = 1; i <= (int)(n); i++)
#define debug(x) cout << '>' << #x << ':' << x << endl;
const int MOD = 1e9 + 7;
int mpow(int a, int b, int p = MOD) {
  a = a % p;
  int res = 1;
  while (b > 0) {
    if (b & 1)
      res = (res * a) % p;
    a = (a * a) % p;
    b = b >> 1;
  }
  return res % p;
}
typedef tree<pair<int, int>, null_type, less<pair<int, int>>, rb_tree_tag,
             tree_order_statistics_node_update>
    ordered_set;
const int N = 1e6 + 3;

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

  int l, r;
  cin >> l >> r;
  r = min(r, l + 2 * (2019));
  vector<int> a;
  for (int i = l; i <= r; i++) {
    for (int j = i + 1; j <= r; j++) {
      a.pb((i * j) % 2019);
    }
  }
  sort(all(a));
  cout << a[0];
}
// k*2019-l=i*j;
//
// I never lose. I either win or I learn