Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Time Limit Exceeded):
h, w = map(int, input().split())
s = [list(input()) for _ in range(h)]
def dfs(x0, y0, cnt):
    ans = h * w
    for i, j in [(1, 0), (0, 1)]:
        x = x0 + i
        y = y0 + j
        ret = 0
        if 0 <= x < w and 0 <= y < h:
            if s[y][x] == "#" and s[y0][x0] == ".":
                ret += 1
            if x == w - 1 and y == h - 1:
                return cnt + ret
            ans = min(ans, dfs(x, y, cnt + ret))
    return ans

print(dfs(0, 0, 0 if s[0][0] == "." else 1))

Fixed submission:
h, w = map(int, input().split())
s = [list(input()) for _ in range(h)]
dp = [[h * w] * w for _ in range(h)]
dp[0][0] = 0 if s[0][0] == "." else 1

for x0 in range(w):
    for y0 in range(h):
        for i, j in [(0, 1), (1, 0)]:
            x = x0 + i
            y = y0 + j
            if x < w and y < h:
                n = 1 if s[y0][x0] == "." and s[y][x] == "#" else 0
                dp[y][x] = min(dp[y0][x0] + n, dp[y][x])

print(dp[-1][-1])
Buggy python submission (verdict: Time Limit Exceeded):

s = input()
n = int(input())

flag = 0
for i in range(n):
    Q = input()
    if int(Q[0]) == 2:
        F = int(Q[2])
        C = Q[4]
        #print(F, C)
        if (F + flag) % 2 == 1:
            s = C + s
        else:
            s = s + C
    else:
        flag = (flag + 1) % 2 

print(s if flag == 0 else s[::-1])


Fixed submission:

s = list(input())
n = int(input())

flag = 0
s1 = []
s2 = s
for i in range(n):
    Q = input()
    if Q[0] == "2":
        if Q[2] == "1":
            if flag == 1:
                s2.append(Q[4])
            else:
                s1.append(Q[4])
        else:
            if flag == 0:
                s2.append(Q[4])
            else:
                s1.append(Q[4])
    else:
        flag ^= 1
s2 = s1[::-1] + s2
print("".join(s2) if flag == 0 else "".join(s2[::-1]))

Buggy python submission (verdict: Time Limit Exceeded):

s = input()
n = int(input())

flag = 0
for i in range(n):
    Q = input()
    if int(Q[0]) == 2:
        F = int(Q[2])
        C = Q[4]
        #print(F, C)
        if (F + flag) % 2 == 1:
            s = C + s
        else:
            s = s + C
    else:
        flag = (flag + 1) % 2 

if flag == 1:
    s = s[::-1]
print(s)


Fixed submission:

s = list(input())
n = int(input())

flag = 0
s1 = []
s2 = s
for i in range(n):
    Q = input()
    if Q[0] == "2":
        if Q[2] == "1":
            if flag == 1:
                s2.append(Q[4])
            else:
                s1.append(Q[4])
        else:
            if flag == 0:
                s2.append(Q[4])
            else:
                s1.append(Q[4])
    else:
        flag ^= 1
s2 = s1[::-1] + s2
print("".join(s2) if flag == 0 else "".join(s2[::-1]))

Buggy python submission (verdict: Time Limit Exceeded):

s = input()
n = int(input())

for i in range(n):
    Q = input()
    if int(Q[0]) == 2:
        F = int(Q[2])
        C = Q[4]
        #print(F, C)
        if F == 1:
            s = C + s
        else:
            s = s + C
    else:
        s = s[::-1]
    
print(s)


Fixed submission:

s = list(input())
n = int(input())

flag = 0
s1 = []
s2 = s
for i in range(n):
    Q = input()
    if Q[0] == "2":
        if Q[2] == "1":
            if flag == 1:
                s2.append(Q[4])
            else:
                s1.append(Q[4])
        else:
            if flag == 0:
                s2.append(Q[4])
            else:
                s1.append(Q[4])
    else:
        flag ^= 1
s2 = s1[::-1] + s2
print("".join(s2) if flag == 0 else "".join(s2[::-1]))
Buggy python submission (verdict: Time Limit Exceeded):

n, k = map(int, input().split())
p = list(map(int, input().split()))
ans = 0
for i in range(n - k + 1):
    calc = 0
    for j in range(i, i + k):
        calc += (1 + p[j]) / 2
    
    ans = max(ans, calc)

print(ans)

Fixed submission:

n, k = map(int, input().split())
p = list(map(int, input().split()))
ans = 0
for i in range(k):
    ans += (p[i] + 1) / 2
calc = ans
for i in range(1, n - k + 1):
    calc += ((p[i + k - 1] + 1) - (p[i - 1] + 1)) / 2
    ans = max(ans, calc)
print(ans)
Buggy python submission (verdict: Runtime Error):
n = int(input())
data = []
for i in range(n):
    x, l = map(int, input().split())
    data.append([x, l])
data = sorted(data, key = lambda x: x[0])
i = 1
while 1:
    if data[i][0] - data[i][1] < data[i - 1][0] + data[i - 1][1]:
        del data[i]
    else:
        i += 1
    if i >= len(data) - 1:
        break
print(len(data))

Fixed submission:
n = int(input())
data = []
for i in range(n):
    x, l = map(int, input().split())
    data.append([x, l])
data = sorted(data, key = lambda x: x[0] + x[1])
ans = 0
pre = -(10 ** 10)
for i in range(n):
    if data[i][0] - data[i][1] >= pre:
        ans += 1
        pre = data[i][0] + data[i][1]

print(ans)

Buggy python submission (verdict: Runtime Error):
n = int(input())
data = []
for i in range(n):
    x, l = map(int, input().split())
    data.append([x, l])
data = sorted(data, key = lambda x: x[0])
i = 0
while 1:
    if data[i][0] + data[i][1] > data[i + 1][0] - data[i + 1][1]:
        del data[i + 1]
    else:
        i += 1
    if i >= len(data) - 1:
        break
print(len(data))

Fixed submission:
n = int(input())
data = []
for i in range(n):
    x, l = map(int, input().split())
    data.append([x, l])
data = sorted(data, key = lambda x: x[0] + x[1])
ans = 0
pre = -(10 ** 10)
for i in range(n):
    if data[i][0] - data[i][1] >= pre:
        ans += 1
        pre = data[i][0] + data[i][1]

print(ans)
Buggy python submission (verdict: Runtime Error):
2
1
2 0
1
1 n = int(input())

xy = [[] * n for _ in range(n)]
for i in range(n):
    a = int(input())
    for j in range(a):
        x, y = map(int, input().split())
        xy[i].append((x, y))

ans = 0
def judge(f):
    for i in range(n):
        if flag[i] == 1:
            for j in xy[i]:
                if f[j[0] - 1] != j[1]:
                    return False
        
    return True

for i in range(2 ** n):
    flag = [0] * n
    for j in range(n):
        if i >> j & 1:
            flag[j] = 1
    if judge(flag):
        ans = max(ans, sum(flag))
print(ans)

Fixed submission:
n = int(input())

xy = [[] * n for _ in range(n)]
for i in range(n):
    a = int(input())
    for j in range(a):
        x, y = map(int, input().split())
        xy[i].append((x, y))

ans = 0
def judge(f):
    for i in range(n):
        if flag[i] == 1:
            for j in xy[i]:
                if f[j[0] - 1] != j[1]:
                    return False
        
    return True

for i in range(2 ** n):
    flag = [0] * n
    for j in range(n):
        if i >> j & 1:
            flag[j] = 1
    if judge(flag):
        ans = max(ans, sum(flag))
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
import numpy as np
n = int(input())
a = np.array(list(map(int, input().split())))

bit = [0] * 60
mod = 10 ** 9 + 7
ans = 0
for i in range(60):
    c = 0
    for x in a:
        if x >> i & 1:
            c += 1
    ans = (ans + c * (n - c) * (2 ** i)) % mod

print(ans)

Fixed submission:
import numpy as np
n = int(input())
a = np.array(list(map(int, input().split())))

bit = [0] * 60
mod = 10 ** 9 + 7
ans = 0
for i in range(60):
    n1 = np.count_nonzero((a >> i) & 1)
    n0 = n - n1
    ans += (2 ** i) * n1 * n0 % mod
print(ans % mod)

Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
a = list(map(int, input().split()))

bit = [0] * 60
mod = 10 ** 9 + 7
ans = 0
for i in range(60):
    c = 0
    for x in a:
        if x >> i & 1:
            c += 1
    ans = (ans + c * (n - c) * (2 ** i)) % mod

print(ans)

Fixed submission:
import numpy as np
n = int(input())
a = np.array(list(map(int, input().split())))

bit = [0] * 60
mod = 10 ** 9 + 7
ans = 0
for i in range(60):
    n1 = np.count_nonzero((a >> i) & 1)
    n0 = n - n1
    ans += (2 ** i) * n1 * n0 % mod
print(ans % mod)

Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
a = list(map(int, input().split()))

bit = [0] * 60
mod = 10 ** 9 + 7
ans = 0
for i in range(60):
    c = 0
    for j in range(n):
        if a[j] & 1:
            c += 1
        a[j] //= 2
    ans = (ans + c * (n - c) * (2 ** i)) % mod

print(ans)

Fixed submission:
import numpy as np
n = int(input())
a = np.array(list(map(int, input().split())))

bit = [0] * 60
mod = 10 ** 9 + 7
ans = 0
for i in range(60):
    n1 = np.count_nonzero((a >> i) & 1)
    n0 = n - n1
    ans += (2 ** i) * n1 * n0 % mod
print(ans % mod)

Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
a = list(map(int, input().split()))

bit = [0] * 60
mod = 10 ** 9 + 7
ans = 0
for i in range(60):
    c = 0
    for j in range(n):
        c += int(a[j] & 1)
        a[j] //= 2
    ans = (ans + c * (n - c) * (2 ** i)) % mod

print(ans)

Fixed submission:
import numpy as np
n = int(input())
a = np.array(list(map(int, input().split())))

bit = [0] * 60
mod = 10 ** 9 + 7
ans = 0
for i in range(60):
    n1 = np.count_nonzero((a >> i) & 1)
    n0 = n - n1
    ans += (2 ** i) * n1 * n0 % mod
print(ans % mod)

Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
a = list(map(int, input().split()))

bit = [0] * 60
mod = 10 ** 9 + 7
ans = 0
for i in range(60):
    c = 0
    for j in range(n):
        c += int(a[j] & 1)
        a[j] >>= 1
    ans = (ans + c * (n - c) * (1 << i)) % mod

print(ans)

Fixed submission:
import numpy as np
n = int(input())
a = np.array(list(map(int, input().split())))

bit = [0] * 60
mod = 10 ** 9 + 7
ans = 0
for i in range(60):
    n1 = np.count_nonzero((a >> i) & 1)
    n0 = n - n1
    ans += (2 ** i) * n1 * n0 % mod
print(ans % mod)
Buggy python submission (verdict: Runtime Error):
x, y  = map(int, input().split())
mod = 10 ** 9 + 7
if (x + y) % 3 != 0:
    ans = 0
else:
    n, m = (2 * x - y) / 3, (2 * y - x) / 3
    if n >= 0 and m >= 0:
        n, m = int(n), int(m)
        ans = 1
        for i in range(min(m, n)):
            ans = ans * (n + m - i) % mod 
            ans *= pow(i + 1, mod - 2, mod)

print(ans % mod)

Fixed submission:
x, y  = map(int, input().split())
mod = 10 ** 9 + 7
if (x + y) % 3 != 0:
    ans = 0
else:
    n, m = (2 * x - y) / 3, (2 * y - x) / 3
    ans = 0
    if n >= 0 and m >= 0:
        n, m = int(n), int(m)
        ans = 1
        for i in range(min(m, n)):
            ans = ans * (n + m - i) % mod 
            ans *= pow(i + 1, mod - 2, mod)

print(ans % mod)

Buggy python submission (verdict: Runtime Error):
x, y  = map(int, input().split())
mod = 10 ** 9 + 7
if (x + y) % 3 != 0:
    ans = 0
else:
    n, m = (2 * x - y) // 3, (2 * y - x) // 3
    if n >= 0 and m >= 0:
        ans = 1
        for i in range(min(m, n)):
            ans = ans * (n + m - i) % mod 
            ans *= pow(i + 1, mod - 2, mod)

print(ans % mod)

Fixed submission:
x, y  = map(int, input().split())
mod = 10 ** 9 + 7
if (x + y) % 3 != 0:
    ans = 0
else:
    n, m = (2 * x - y) / 3, (2 * y - x) / 3
    ans = 0
    if n >= 0 and m >= 0:
        n, m = int(n), int(m)
        ans = 1
        for i in range(min(m, n)):
            ans = ans * (n + m - i) % mod 
            ans *= pow(i + 1, mod - 2, mod)

print(ans % mod)
Buggy python submission (verdict: Time Limit Exceeded):
from collections import deque
s = list(input())
ans = 0
k = deque()
for i in range(len(s) + 1):
    l, r = i - 1, i
    while l >= 0:
        if s[l] != "<":
            break
        l -= 1
    while r < len(s):
        if s[r] != ">":
            break
        r += 1
    ans += max(i - l - 1, r - i)
print(ans)

Fixed submission:
s = list(input())
data = [0] * (len(s) + 1)
for i in range(len(s)):
    if s[i] == "<":
        data[i + 1] = data[i] + 1

for i in range(len(s) - 1, -1, -1):
    if s[i] == ">":
        data[i] = max(data[i], data[i + 1] + 1) 
print(sum(data))

Buggy python submission (verdict: Time Limit Exceeded):
from collections import deque
s = list(input())
data = [0] * (len(s) + 1)
k = deque()
for i in range(len(s) + 1):
    l, r = i - 1, i
    while l >= 0:
        if s[l] != "<":
            break
        l -= 1
    while r < len(s):
        if s[r] != ">":
            break
        r += 1
    data[i] = max(i - l - 1, r - i)
print(sum(data))

Fixed submission:
s = list(input())
data = [0] * (len(s) + 1)
for i in range(len(s)):
    if s[i] == "<":
        data[i + 1] = data[i] + 1

for i in range(len(s) - 1, -1, -1):
    if s[i] == ">":
        data[i] = max(data[i], data[i + 1] + 1) 
print(sum(data))
Buggy python submission (verdict: Runtime Error):
s = list(input())
k = int(input())
x = []
ans = 0
cnt = 1
for i in range(len(s)):
    if i < len(s) - 1 and s[i] == s[i + 1]:
        cnt += 1
    else:
        ans += cnt // 2
        x.append(cnt)
        cnt = 1
cnt = 0
if s[0] == s[len(s) - 1]:
    cnt = x[0] // 2 + x[-1] // 2 - (x[0] + x[1]) // 2

print(ans * k - cnt * (k - 1) if len(set(s)) != 1 else len(s) * k // 2)

Fixed submission:
s = list(input())
k = int(input())
x = []
ans = 0
cnt = 1
for i in range(len(s)):
    if i < len(s) - 1 and s[i] == s[i + 1]:
        cnt += 1
    else:
        ans += cnt // 2
        x.append(cnt)
        cnt = 1
cnt = 0
if s[0] == s[len(s) - 1]:
    cnt = x[0] // 2 + x[-1] // 2 - (x[0] + x[-1]) // 2

print(ans * k - cnt * (k - 1) if len(set(s)) != 1 else len(s) * k // 2)
Buggy python submission (verdict: Time Limit Exceeded):
from math import gcd
from copy import copy
a, b = map(int, input().split())

def div(x):
    ret = []
    for i in range(1, int(x ** 0.5) + 1):
        if x % i == 0:
            ret.append(i)
            ret.append(x // i)
    
    return ret

def judge_prime(x):
    cnt = 0
    for i in range(1, int(x ** 0.5) + 1):
        if x % i == 0:
            cnt += 1
    if cnt == 1:
        return True
    return False

div_a = div(a)
div_b = div(b)

data = list(set(div_a) & set(div_b))

ans = 0
for x in data:
    if judge_prime(x):
        ans += 1
print(ans)

Fixed submission:
from math import gcd
from copy import copy
a, b = map(int, input().split())

def div(x):
    ret = []
    for i in range(1, int(x ** 0.5) + 1):
        if x % i == 0:
            ret.append(i)
            ret.append(x // i)
    
    return ret

def judge_prime(x):
    cnt = 0
    for i in range(1, int(x ** 0.5) + 1):
        if x % i == 0:
            cnt += 1
        if cnt >= 2:
            return False
    return True

div_a = div(a)
div_b = div(b)

data = list(set(div_a) & set(div_b))

ans = 0
for x in data:
    if judge_prime(x):
        ans += 1
print(ans)

Buggy python submission (verdict: Runtime Error):
from math import gcd

a, b = map(int, input().split())
data = []
for i in range(1, int(min(a, b) ** 0.5) + 1):
    if a % i == 0 and b % i == 0:
        data.append(i)
        if b % (a // i) == 0:
            data.append(a // i)
        if a % (b // i) == 0:
            data.append(b // i)
data = list(set(data)).sort()
for i in range(len(data)):
    j = i + 1
    while j < len(data):
        if gcd(data[i], data[j]) != 1:
            del data[j]
        else:
            j += 1
print(len(data))

Fixed submission:
from math import gcd
from copy import copy
a, b = map(int, input().split())

def div(x):
    ret = []
    for i in range(1, int(x ** 0.5) + 1):
        if x % i == 0:
            ret.append(i)
            ret.append(x // i)
    
    return ret

def judge_prime(x):
    cnt = 0
    for i in range(1, int(x ** 0.5) + 1):
        if x % i == 0:
            cnt += 1
        if cnt >= 2:
            return False
    return True

div_a = div(a)
div_b = div(b)

data = list(set(div_a) & set(div_b))

ans = 0
for x in data:
    if judge_prime(x):
        ans += 1
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
n, m = map(int, input().split())
a = list(map(int, input().split()))
a.sort()
for i in range(m):
    a[-1] //= 2
    if n != 1 and a[-1] < a[-2]:
        a.sort()
print(sum(a))

Fixed submission:
import heapq
n, m = map(int, input().split())
a = list(map(lambda x: int(x) * (-1), input().split()))
heapq.heapify(a)

for i in range(m):
    x = heapq.heappop(a)
    heapq.heappush(a, -1 * ((-x) // 2))
print(-sum(a))

Buggy python submission (verdict: Runtime Error):
n, m = map(int, input().split())
a = list(map(int, input().split()))
a.sort()
for i in range(m):
    while a[-1] >= a[-2]:
        a[-1] //= 2
    a.sort()
print(sum(a))

Fixed submission:
import heapq
n, m = map(int, input().split())
a = list(map(lambda x: int(x) * (-1), input().split()))
heapq.heapify(a)

for i in range(m):
    x = heapq.heappop(a)
    heapq.heappush(a, -1 * ((-x) // 2))
print(-sum(a))

Buggy python submission (verdict: Time Limit Exceeded):
n, m = map(int, input().split())
a = list(map(int, input().split()))
a.sort()
for i in range(m):
    a[-1] //= 2
    a.sort()
print(sum(a))

Fixed submission:
import heapq
n, m = map(int, input().split())
a = list(map(lambda x: int(x) * (-1), input().split()))
heapq.heapify(a)

for i in range(m):
    x = heapq.heappop(a)
    heapq.heappush(a, -1 * ((-x) // 2))
print(-sum(a))
Buggy python submission (verdict: Time Limit Exceeded):

n = int(input())

ans = 0
for i in range(n):
    ans += i
print(ans)


Fixed submission:

n = int(input())

print((1 + (n - 1)) * (n - 1) // 2)
Buggy python submission (verdict: Time Limit Exceeded):
import sys
sys.setrecursionlimit(10 ** 6)
n, q = map(int, input().split())
cnt = [0] * n
tree = [[] for i in range(n)]
for i in range(n - 1):
    a, b = map(int, input().split())
    tree[a - 1].append(b - 1)
    tree[b - 1].append(a - 1)

for i in range(q):
    p, x = map(int, input().split())
    cnt[p - 1] += x

def dfs(cur, par):
    for chi in tree[cur]:
        if chi == par:
            continue
        cnt[chi] += cnt[cur]
        dfs(chi, cur)
dfs(0, -1)
print(*cnt)

Fixed submission:
import sys
sys.setrecursionlimit(10 ** 6)
input = sys.stdin.readline
n, q = map(int, input().split())
cnt = [0] * n
tree = [[] for i in range(n)]
for i in range(n - 1):
    a, b = map(int, input().split())
    tree[a - 1].append(b - 1)
    tree[b - 1].append(a - 1)

for i in range(q):
    p, x = map(int, input().split())
    cnt[p - 1] += x

def dfs(cur, par):
    for chi in tree[cur]:
        if chi == par:
            continue
        cnt[chi] += cnt[cur]
        dfs(chi, cur)
dfs(0, -1)
print(*cnt)

Buggy python submission (verdict: Runtime Error):
"""
import sys
sys.setrecursionlimit(10 ** 6)
"""
n, q = map(int, input().split())
cnt = [0] * n
tree = [[] for i in range(n)]
for i in range(n - 1):
    a, b = map(int, input().split())
    tree[a - 1].append(b - 1)
    tree[b - 1].append(a - 1)

for i in range(q):
    p, x = map(int, input().split())
    cnt[p - 1] += x

def dfs(cur, par):
    for chi in tree[cur]:
        if chi == par:
            continue
        cnt[chi] += cnt[cur]
        dfs(chi, cur)
dfs(0, -1)
print(*cnt)

Fixed submission:
import sys
sys.setrecursionlimit(10 ** 6)
input = sys.stdin.readline
n, q = map(int, input().split())
cnt = [0] * n
tree = [[] for i in range(n)]
for i in range(n - 1):
    a, b = map(int, input().split())
    tree[a - 1].append(b - 1)
    tree[b - 1].append(a - 1)

for i in range(q):
    p, x = map(int, input().split())
    cnt[p - 1] += x

def dfs(cur, par):
    for chi in tree[cur]:
        if chi == par:
            continue
        cnt[chi] += cnt[cur]
        dfs(chi, cur)
dfs(0, -1)
print(*cnt)

Buggy python submission (verdict: Runtime Error):
n, q = map(int, input().split())
cnt = [0] * n
tree = [[] for i in range(n)]
for i in range(n - 1):
    a, b = map(int, input().split())
    tree[a - 1].append(b - 1)
    tree[b - 1].append(a - 1)

for i in range(q):
    p, x = map(int, input().split())
    cnt[p - 1] += x

def dfs(cur, par):
    for chi in tree[cur]:
        if chi == par:
            continue
        cnt[chi] += cnt[cur]
        dfs(chi, cur)
dfs(0, -1)
print(*cnt)

Fixed submission:
import sys
sys.setrecursionlimit(10 ** 6)
input = sys.stdin.readline
n, q = map(int, input().split())
cnt = [0] * n
tree = [[] for i in range(n)]
for i in range(n - 1):
    a, b = map(int, input().split())
    tree[a - 1].append(b - 1)
    tree[b - 1].append(a - 1)

for i in range(q):
    p, x = map(int, input().split())
    cnt[p - 1] += x

def dfs(cur, par):
    for chi in tree[cur]:
        if chi == par:
            continue
        cnt[chi] += cnt[cur]
        dfs(chi, cur)
dfs(0, -1)
print(*cnt)
Buggy python submission (verdict: Time Limit Exceeded):

n = int(input())

A = [0] * n
for i in range(n):
    A[i] = int(input())

for i in range(n):
    temp = A[i]
    A[i] = 0
    print(max(A))
    A[i] = temp



Fixed submission:

n = int(input())

A = [0] * n
for i in range(n):
    A[i] = int(input())

B = sorted(A, reverse=True)

for i in range(n):
    print(B[0] if A[i] != B[0] else B[1])
Buggy python submission (verdict: Runtime Error):

L, R = map(int, input().split())

mini = (L * R) % 2019

if R - l >= 2019:
    print(0)
    exit()

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



print(mini)

Fixed submission:

L, R = map(int, input().split())

mini = (L * R) % 2019

if R - L >= 2019:
    print(0)
    exit()

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



print(mini)

Buggy python submission (verdict: Time Limit Exceeded):

L, R = map(int, input().split())

mini = (L * R) % 2019
for i in range(L, R + 1):
    for j in range(i + 1, R + 1):
        if(mini > (i * j) % 2019):
            mini = (i * j) % 2019


print(mini)

Fixed submission:

L, R = map(int, input().split())

mini = (L * R) % 2019

if R - L >= 2019:
    print(0)
    exit()

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



print(mini)
Buggy python submission (verdict: Runtime Error):
from math import factorial

n, k = map(int, input().split())
def fac(n, r):
    return factorial(n) // (factorial(n - r) * factorial(r))
for i in range(1, k + 1):
    print( (fac(n - k + 1, i) * fac(k - 1, i - 1)) % (10 ** 9 + 7))


Fixed submission:
from math import factorial

n, k = map(int, input().split())
def fac(n, r):
    return factorial(n) // (factorial(max(0, n - r)) * factorial(r))
for i in range(1, k + 1):
    print( (fac(n - k + 1, i) * fac(k - 1, i - 1)) % (10 ** 9 + 7))

Buggy python submission (verdict: Runtime Error):
from math import factorial

n, k = map(int, input().split())
p = factorial(n - k + 1)

def fac(n, r):
    return factorial(n) // factorial(n - r) * factorial(r)
for i in range(1, k + 1):
    print( (fac(n - k + 1, i) * fac(k - 1, i - 1)) % (10 ** 9 + 7))


Fixed submission:
from math import factorial

n, k = map(int, input().split())
def fac(n, r):
    return factorial(n) // (factorial(max(0, n - r)) * factorial(r))
for i in range(1, k + 1):
    print( (fac(n - k + 1, i) * fac(k - 1, i - 1)) % (10 ** 9 + 7))
Buggy python submission (verdict: Runtime Error):
from collections import defaultdict

n = int(input())
x, y = [0] * n, [0] * n
data = defaultdict(int)
for i in range(n):
    x[i], y[i] = map(int, input().split())

for i in range(n):
    for j in range(n):
        if i != j:
            data[x[j] - x[i], y[j] - y[i]] += 1

print(n - max(data.values()))

Fixed submission:
from collections import defaultdict

n = int(input())
x, y = [0] * n, [0] * n
data = defaultdict(int)
for i in range(n):
    x[i], y[i] = map(int, input().split())

if n == 1:
    print(1)
    exit()
for i in range(n):
    for j in range(n):
        if i != j:
            data[x[j] - x[i], y[j] - y[i]] += 1

print(n - max(data.values()))

Buggy python submission (verdict: Runtime Error):
from collections import defaultdict

n = int(input())
x, y = [0] * n, [0] * n
data = defaultdict(int)
for i in range(n):
    x[i], y[i] = map(int, input().split())

for i in range(n):
    for j in range(i + 1, n):
        data[x[j] - x[i], y[j] - y[i]] += 1

print(n - max(data.values()))

Fixed submission:
from collections import defaultdict

n = int(input())
x, y = [0] * n, [0] * n
data = defaultdict(int)
for i in range(n):
    x[i], y[i] = map(int, input().split())

if n == 1:
    print(1)
    exit()
for i in range(n):
    for j in range(n):
        if i != j:
            data[x[j] - x[i], y[j] - y[i]] += 1

print(n - max(data.values()))