Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
a_list = list(map(int, input().split()))
a_list.sort()
a_max = a_list[-1]

dup_set = set(x for x in set(a_list) if a_list.count(x) > 1)
divisible = [False] * (a_max + 1)

count = 0
i = 0
for a in a_list:
    if divisible[a]:
        continue
    if not a in dup_set:
        count += 1
    x = a
    while x <= a_max:
        divisible[x] = True
        x += a
print(count)

Fixed submission:
n = int(input())
a_list = list(map(int, input().split()))
a_list.sort()
a_max = a_list[-1]

divisible = [False] * (a_max + 1)

count = 0
i = 0
for i in range(n):
    if divisible[a_list[i]]:
        continue
    if i < n - 1 and a_list[i] == a_list[i + 1]:
        while i < n - 1 and a_list[i] == a_list[i + 1]:
            i += 1
    else:
        count += 1
    x = a_list[i]
    while x <= a_max:
        divisible[x] = True
        x += a_list[i]
print(count)

Buggy python submission (verdict: Time Limit Exceeded):
def get_divisors(n):
    divisors = set()
    i = 1
    while i * i <= n:
        if n % i == 0:
            divisors.add(i)
            divisors.add(n // i)
        i += 1
    return divisors

n = int(input())
a_list = list(map(int, input().split()))
a_list.sort()

div_set = set(x for x in set(a_list) if a_list.count(x) > 1)

count = 0
i = 0
for a in a_list:
    j = 1
    divisible = False
    while j * j <= a:
        if a % j == 0:
            if j in div_set or a // j in div_set:
                divisible = True
                break
        j += 1
    if not divisible:
        count += 1
    div_set.add(a)
print(count)

    

Fixed submission:
n = int(input())
a_list = list(map(int, input().split()))
a_list.sort()
a_max = a_list[-1]

divisible = [False] * (a_max + 1)

count = 0
i = 0
for i in range(n):
    if divisible[a_list[i]]:
        continue
    if i < n - 1 and a_list[i] == a_list[i + 1]:
        while i < n - 1 and a_list[i] == a_list[i + 1]:
            i += 1
    else:
        count += 1
    x = a_list[i]
    while x <= a_max:
        divisible[x] = True
        x += a_list[i]
print(count)
Buggy python submission (verdict: Runtime Error):
from numpy import average
n = int(input())
x_list = list(map(int, input().split()))
m = int(average(x_list) + 0.5)
print(sum((x - m)**2 for x in x_list))

Fixed submission:
n = int(input())
x_list = list(map(int, input().split()))
m = int(sum(x_list)/n + 0.5)
print(sum((x - m)**2 for x in x_list))
Buggy python submission (verdict: Runtime Error):
n = int(input())
a = list(map(int, input.split()))
d = set()
for x in a:
  if x in d:
    print("NO")
    quit()
  d.add(x)
print("YES")

Fixed submission:
n = int(input())
a = list(map(int, input().split()))
d = set()
for x in a:
  if x in d:
    print("NO")
    quit()
  d.add(x)
print("YES")
Buggy python submission (verdict: Runtime Error):
h, n = map(int, input().split())
a = [0] * n
b = [0] * n
for i in range(n):
    a[i], b[i] = map(int, input().split())

dp = [h * 10 ** 4] * (h + 1)
dp[0] = 0
for i in range(n):
    for j in range(a[i]):
        dp[j] = min(dp[j], b[i])
    for j in range(a[i], h + 1):
        dp[j] = min(dp[j], dp[j - a[i]] + b[i])
print(dp[-1])

Fixed submission:
h, n = map(int, input().split())
a = [0] * n
b = [0] * n
for i in range(n):
    a[i], b[i] = map(int, input().split())

dp = [h * 10 ** 4] * (h + 1)
dp[0] = 0
for i in range(n):
    for j in range(min(a[i], h+1)):
        dp[j] = min(dp[j], b[i])
    for j in range(a[i], h + 1):
        dp[j] = min(dp[j], dp[j - a[i]] + b[i])
print(dp[-1])
Buggy python submission (verdict: Runtime Error):
def factorial(n, mod):
    fac = [0] * (n + 1)
    inv = [0] * (n + 1)
    fac[0], inv[0] = 1, 1
    for i in range(1, n + 1):
        fac[i] = fac[i-1] * i % mod
        inv[i] = inverse(fac[i], mod)
    return fac, inv

def inverse(a, mod):
    a %= mod # 除数が正なら正になる
    p = mod
    x, y = 0, 1
    while a > 0:
        n = p // a
        p, a = a, p % a, 
        x, y = y, x - n * y
    return x % mod # 除数が正なら正になる

mod = 10 ** 9 + 7
x, y = map(int, input().split())
if (x + y) % 3 != 0:
    print(0)
    quit()
n = (x + y) // 3
m = min(x, y) - n

fac, inv = factorial(n, mod)
print(fac[n] * inv[n-m] * inv[m] % mod) # nCm


Fixed submission:
def factorial(n, mod):
    fac = [0] * (n + 1)
    inv = [0] * (n + 1)
    fac[0], inv[0] = 1, 1
    for i in range(1, n + 1):
        fac[i] = fac[i-1] * i % mod
        inv[i] = inverse(fac[i], mod)
    return fac, inv

def inverse(a, mod):
    a %= mod # 除数が正なら正になる
    p = mod
    x, y = 0, 1
    while a > 0:
        n = p // a
        p, a = a, p % a, 
        x, y = y, x - n * y
    return x % mod # 除数が正なら正になる

mod = 10 ** 9 + 7
x, y = map(int, input().split())
if (x + y) % 3 != 0:
    print(0)
    quit()
n = (x + y) // 3
if x < n or y < n:
    print(0)
    quit()

m = min(x, y) - n
fac, inv = factorial(n, mod)
print(fac[n] * inv[n-m] * inv[m] % mod) # nCm
Buggy python submission (verdict: Runtime Error):
n = int(input())
i = 1
while i * i <= n:
  if n % i != 0:
    continue
  j = n // i
  if i < 10 and j < 10:
    print("Yes")
	quit()
print("No")

Fixed submission:
n = int(input())
i = 1
while i * i <= n:
    if n % i == 0:
        j = n // i
        if i < 10 and j < 10:
            print("Yes")
            quit()
    i += 1
print("No")
Buggy python submission (verdict: Runtime Error):
a, b = map(int, input().split())
if (a + b) % 2 != 0:
  print("IMPOSSIBLE")
elif:
  print((a + b) // 2)

Fixed submission:
a, b = map(int, input().split())
if (a + b) % 2 != 0:
  print("IMPOSSIBLE")
else:
  print((a + b) // 2)

Buggy python submission (verdict: Runtime Error):
a, b = map(int, input().split())
if (a + b) % 2 != 0:
  print("IMPOSSIBLE")
elif:
  print((a + b) // 2)

Fixed submission:
a, b = map(int, input().split())
if (a + b) % 2 != 0:
  print("IMPOSSIBLE")
else:
  print((a + b) // 2)
Buggy python submission (verdict: Runtime Error):
import networkx

def factorial(n, mod):
    fac = [0] * (n + 1)
    inv = [0] * (n + 1)
    fac[0], inv[0] = 1, 1
    for i in range(1, n + 1):
        fac[i] = fac[i-1] * i % mod
        inv[i] = inverse(fac[i], mod)
    return fac, inv

def inverse(a, mod):
    a %= mod # 除数が正なら正になる
    p = mod
    x, y = 0, 1
    while a > 0:
        n = p // a
        p, a = a, p % a, 
        x, y = y, x - n * y
    return x % mod # 除数が正なら正になる

mod = 1000000007

n, k = map(int, input().split())
graph = networkx.Graph()
graph.add_nodes_from(range(n))
for _ in range(n-1):
    a, b = map(lambda x : int(x) - 1, input().split())
    graph.add_edge(a, b)

fac, inv = factorial(k, mod)
ans = fac[k] * inv[k - networkx.degree(graph)[0] - 1] % mod # nx.degree(graph)[0]:グラフの頂点0から出ている枝の数
for parent, child in networkx.dfs_edges(graph, 0): # nx.dfs_edges(graph, 0):グラフの頂点0からDFS
    ans = ans * fac[k-2] % mod * inv[k-1-networkx.degree(graph)[child]] % mod
print(ans)


Fixed submission:
def factorial(n, mod):
    fac = [0] * (n + 1)
    inv = [0] * (n + 1)
    fac[0], inv[0] = 1, 1
    for i in range(1, n + 1):
        fac[i] = fac[i-1] * i % mod
        inv[i] = inverse(fac[i], mod)
    return fac, inv

def inverse(a, mod):
    a %= mod # 除数が正なら正になる
    p = mod
    x, y = 0, 1
    while a > 0:
        n = p // a
        p, a = a, p % a, 
        x, y = y, x - n * y
    return x % mod # 除数が正なら正になる

mod = 1000000007
n, k = map(int, input().split())
        
nodes = [[] for _ in range(n)]

branch_n = [0] * n
for i in range(n-1):
    a, b = map(lambda x : int(x) - 1, input().split())
    nodes[a].append(b)
    nodes[b].append(a)

if len(nodes[0]) >= k:
    print(0)
    quit()
stack = nodes[0][:]
visited = {0}
fac, inv = factorial(k, mod)
ans = fac[k] * inv[k-len(nodes[0])-1] % mod
while stack:
    i = stack.pop()
    visited.add(i)
    m = len(nodes[i])
    if m >= k:
        print(0)
        quit()
    ans = ans * fac[k-2] % mod * inv[k-1-m] % mod
    for j in nodes[i]:
        if not j in visited:
            stack.append(j)
print(ans)
Buggy python submission (verdict: Runtime Error):
import numpy

a, b, c, d = map(int, input().split())
a = a - 1

cd = c * d // numpy.gcd(c, d)

b_n = b // c + b // d - b // cd
a_n = a // c + a // d - a // cd
print((b - b_n) - (a - a_n))

Fixed submission:
import math

a, b, c, d = map(int, input().split())
a = a - 1

cd = c * d // math.gcd(c, d)

b_n = b // c + b // d - b // cd
a_n = a // c + a // d - a // cd
print((b - b_n) - (a - a_n))
Buggy python submission (verdict: Runtime Error):
import numpy

def power(mat:numpy.matrix, n, mod):
    ret = mat
    n -= 1
    while n > 0:
        if n % 2 == 1:
            ret = ret @ mat % mod
        mat = mat @ mat % mod
        n //= 2
    return ret

l, a, b, m = map(int, input().split())
s_foot = a + b * (l - 1)
digit_n = len(str(s_foot))
count_digit_n = [0] * (digit_n + 1)
d = 10
for i in range(1, digit_n + 1):
    x = min(d - 1, s_foot) - a
    if x < 0:
        continue
    n = x // b
    count_digit_n[i] = n + 1
    d *= 10

for i in range(digit_n, 0, -1):
    count_digit_n[i]  -= count_digit_n[i - 1]

d = 10
i = 0
x = numpy.matrix([[0], [a], [1]])

for n in count_digit_n:
    if n == 0:
        continue
    mat = numpy.matrix([[d, 1, 0], [0, 1, b], [0, 0, 1]])
    x = power(mat, n, m) @ x % m
    d = d * 10 % m
print(x[0][0][0])

Fixed submission:

def mul_square_matrix(a, b, mod):
    n = len(a)
    ret = [[0] * n for _ in range(n)]
    for i in range(n):
        for j in range(n):
            for k in range(n):
                ret[i][j] = (ret[i][j] + a[i][k] * b[k][j]) % mod
    return ret


def power_square_matrix(mat:list, k, mod):
    n = len(mat)
    ret = [[0] * n for _ in range(n)]
    for i in range(n):
        ret[i][i] = 1
    while k > 0:
        if k % 2 == 1:
            ret = mul_square_matrix(ret, mat, mod)
        mat = mul_square_matrix(mat, mat, mod)
        k //= 2
    return ret

l, a, b, m = map(int, input().split())
s_foot = a + b * (l - 1)
digit_n = len(str(s_foot))
count_digit_n = [0] * (digit_n + 1)
d = 1
for i in range(1, digit_n + 1):
    d *= 10
    x = min(d - 1, s_foot) - a
    if x < 0:
        continue
    n = x // b
    count_digit_n[i] = n + 1

for i in range(digit_n, 0, -1):
    count_digit_n[i]  -= count_digit_n[i - 1]

d = 1
x = [[0], [a], [1]]
for n in count_digit_n[1:]:
    d = d * 10 % m
    if n == 0:
        continue
    mat = [[d, 1, 0], [0, 1, b], [0, 0, 1]]
    mat = power_square_matrix(mat, n, m)
    for i in range(3):
        x[i][0] = sum([mat[i][j] * x[j][0] for j in range(3)]) % m
print(x[0][0])
Buggy python submission (verdict: Runtime Error):
from collections import deque
n = int(input())
tree = [[] for _ in range(n)]
for _ in range(n-1):
    u, v, w = map(int, input().split())
    tree[u].append((v - 1, w))
    tree[v].append((u - 1, w))
q = deque()
q.append(0)
color = [-1] * n
color[0] = 0
while q:
    v = q.popleft()
    for child, w in tree[v]:
        if color[child] < 0:
            color[child] = (color[v] + w) % 2
            q.append(child)
for i in color:
    print(i)

Fixed submission:
import queue
n = int(input())

node = [[] for _ in range(n)]
color = [-1] * n
color[0] = 0

for _ in range(n-1):
    u, v, w = map(int, input().split())
    node[u-1].append((v-1, w))
    node[v-1].append((u-1, w))

q = queue.Queue()
q.put(0)

while not q.empty():
    i = q.get()
    c = color[i]
    for j, w in node[i]:
        if color[j] < 0:
            color[j] = c if w % 2 == 0 else (c + 1) % 2
            q.put(j)

for c in color:
    print(c)
Buggy python submission (verdict: Time Limit Exceeded):
n, m = map(int, input().split())

card = [[] for _ in range(n)]

for _ in range(m):
    x, y, _ = map(int, input().split())
    card[x-1].append(y-1)
    card[y-1].append(x-1)

checked = [False] * n

count = 0
from collections import deque
for i in range(n):
    if checked[i]:
        continue
    count += 1
    q = deque([i])
    while q:
        j = q.popleft()
        checked[j] = True
        for k in card[j]:
            if not checked[k]:
                q.append(k)
print (count) 



Fixed submission:
n, m = map(int, input().split())

card = [[] for _ in range(n)]

for _ in range(m):
    x, y, _ = map(int, input().split())
    card[x-1].append(y-1)
    card[y-1].append(x-1)

checked = [False] * n

count = 0
import queue
q = queue.Queue()
for i in range(n):
    if checked[i]:
        continue
    count += 1
    q.put(i)
    while not q.empty():
        j = q.get()
        checked[j] = True
        for k in card[j]:
            if not checked[k]:
                q.put(k)

print (count)
Buggy python submission (verdict: Time Limit Exceeded):
from collections import deque
h, w = map(int, input().split())
wall = '/'
grid = [[wall] * (w + 2)]
wn = 0

q = deque()
for y in range(1, h+1):
    grid.append([wall] + [c for c in input()] + [wall])
    for x in range(1, w+1):
        if grid[y][x] == '.':
            wn += 1
        if grid[y][x] == '#':
            q.append((y, x, 0))
grid.append([wall] * (w + 2))

move = [(-1, 0), (1, 0), (0, -1), (0, 1)]
while q:
    y, x, i = q.popleft()
    for dy, dx in move:
        if grid[y + dy][x + dx] == '.':
            grid[y + dy][x + dx] = '#'
            q.append((y + dy, x + dx, i + 1))
    
print(i)


Fixed submission:
from collections import deque
h, w = map(int, input().split())
wall = '/'
grid = [[wall] * (w + 2)]
wn = 0

q = deque()
for y in range(1, h+1):
    grid.append([wall] + [c for c in input()] + [wall])
    for x in range(1, w+1):
        if grid[y][x] == '.':
            wn += 1
        if grid[y][x] == '#':
            q.append((y, x, 0))
grid.append([wall] * (w + 2))

move = [(-1, 0), (1, 0), (0, -1), (0, 1)]

while q:
    y, x, i = q.popleft()
    grid[y][x] = '#'
    for dy, dx in move:
        if grid[y + dy][x + dx] == '.':
            grid[y + dy][x + dx] = '#'
            q.append((y + dy, x + dx, i + 1))
    
print(i)
Buggy python submission (verdict: Runtime Error):
n, k = map(int, input().split())
a = list(map(int, input().split()))

digit_n = 0
kk = k
while kk > 0:
    kk >>= 1
    digit_n += 1

count = [0] * digit_n
mask = ~((1 << digit_n) - 1)

ans = 0
for i in range(n):
    ans += a[i] & mask
    for j in range(digit_n):
        if (a[i] >> j) & 1:
            count[j] += 1 

dp = [[0] * (digit_n + 1) for _ in range(2)]

for i in range(1, digit_n + 1):
    j = n - i
    bit = (k >> j) & 1
    dp[0][i] = (dp[0][i-1] << 1) + (n - count[j] if bit else count[j])
    dp[1][i] = (dp[1][i-1] << 1) + max(n - count[j], count[j])
    if bit == 1:
        dp[1][i] = max(dp[1][i], (dp[0][i-1] << 1) + count[j])
ans += max(dp[0][-1], dp[1][-1])
print(ans)

Fixed submission:
n, k = map(int, input().split())
a = list(map(int, input().split()))

digit_n = 0
kk = k
while kk > 0:
    kk >>= 1
    digit_n += 1

count = [0] * digit_n
mask = ~((1 << digit_n) - 1)

ans = 0
for i in range(n):
    ans += a[i] & mask
    for j in range(digit_n):
        if (a[i] >> j) & 1:
            count[j] += 1 

dp = [[0] * (digit_n + 1) for _ in range(2)]

for i in range(1, digit_n + 1):
    j = digit_n - i
    bit = (k >> j) & 1
    dp[0][i] = (dp[0][i-1] << 1) + (n - count[j] if bit else count[j])
    if dp[1][i-1]:
        dp[1][i] = (dp[1][i-1] << 1) + max(n - count[j], count[j])
    if bit == 1:
        dp[1][i] = max(dp[1][i], (dp[0][i-1] << 1) + count[j])
ans += max(dp[0][-1], dp[1][-1])
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
n, w = map(int, input().split())

w_list = [0] * n
v_list = [0] * n
for i in range(n):
    w_list[i], v_list[i] = map(int, input().split())

dp = [0] * (w + 1)
for i in range(n):
    for j in range(w, -1, - 1):
        v = dp[j] + v_list[i]
        if j + w_list[i] <= w and dp[j + w_list[i]] < v:
            dp[j + w_list[i]] = v
print(dp[-1])

Fixed submission:
n, w = map(int, input().split())

w_list = [0] * n
v_list = [0] * n
for i in range(n):
    w_list[i], v_list[i] = map(int, input().split())

dp = [0] * (w + 1)
for i in range(n):
    for j in range(w, -1, - 1):
        v = dp[j] + v_list[i]
        if j + w_list[i] <= w and dp[j + w_list[i]] < v:
            dp[j + w_list[i]] = v
print(dp[-1])
Buggy python submission (verdict: Runtime Error):
def factorize(n):
    factor = []
    if n % 2 == 0:
        f = [2, 1]
        n //= 2
        while n % 2 == 0:
            n //= 2
            f[1] += 1
        factor.append(f)
    k = 3
    while k * k <= n:
        if n % k == 0:
            f = [k, 1]
            n //= k
            while n % k == 0:
                n //= k
                f[1] += 1
            factor.append(f)
        k += 2
    if n != 1:
        factor.append([n, 1])
    return factor

def factorial(n, mod):
    fac = [0] * (n + 1)
    inv = [0] * (n + 1)
    fac[0], inv[0] = 1, 1
    for i in range(1, n + 1):
        fac[i] = fac[i-1] * i % mod
        inv[i] = inverse(fac[i], mod)
    return fac, inv

def inverse(a, mod):
    a %= mod # 除数が正なら正になる
    p = mod
    x, y = 0, 1
    while a > 0:
        n = p // a
        p, a = a, p % a, 
        x, y = y, x - n * y
    return x % mod # 除数が正なら正になる

n, m = map(int, input().split())
mod = 10 ** 9 + 7
f = factorize(m)
max_k = max(i for _, i in f)
fac, inv = factorial(n + max_k - 1, mod)

ans = 1
for _, k in f:
    ans = ans * fac[n + k - 1] % mod * inv[n - 1] % mod * inv[k] % mod
print(ans)



Fixed submission:
def factorize(n):
    factor = []
    if n % 2 == 0:
        f = [2, 1]
        n //= 2
        while n % 2 == 0:
            n //= 2
            f[1] += 1
        factor.append(f)
    k = 3
    while k * k <= n:
        if n % k == 0:
            f = [k, 1]
            n //= k
            while n % k == 0:
                n //= k
                f[1] += 1
            factor.append(f)
        k += 2
    if n != 1:
        factor.append([n, 1])
    return factor

def factorial(n, mod):
    fac = [0] * (n + 1)
    inv = [0] * (n + 1)
    fac[0], inv[0] = 1, 1
    for i in range(1, n + 1):
        fac[i] = fac[i-1] * i % mod
        inv[i] = inverse(fac[i], mod)
    return fac, inv

def inverse(a, mod):
    a %= mod # 除数が正なら正になる
    p = mod
    x, y = 0, 1
    while a > 0:
        n = p // a
        p, a = a, p % a, 
        x, y = y, x - n * y
    return x % mod # 除数が正なら正になる

n, m = map(int, input().split())
if m == 1:
    print(1)
    quit()
mod = 10 ** 9 + 7
f = factorize(m)
max_k = max(i for _, i in f)
fac, inv = factorial(n + max_k - 1, mod)
ans = 1
for _, k in f:
    ans = ans * fac[n + k - 1] % mod * inv[n - 1] % mod * inv[k] % mod
print(ans)
Buggy python submission (verdict: Runtime Error):
n = int(input())
red  = [tuple(map(int, input().split())) for _ in range(n)]
blue = [tuple(map(int, input().split())) for _ in range(n)]
red.sort(key=lambda x:-x[1])
blue.sort()
count = 0
for xb, yb in blue:
    for xr, yr in red:
        if xb > xr and yb > yr:
            red[max_i] = (201, 201)
            count += 1
            break
print(count)

Fixed submission:
n = int(input())
red  = [tuple(map(int, input().split())) for _ in range(n)]
blue = [tuple(map(int, input().split())) for _ in range(n)]

red.sort(key=lambda x:x[1])
blue.sort()

count = 0
for xb, yb in blue:
    max_y = -1
    max_i = -1
    for i in range(n):
        xr, yr = red[i]
        if xb > xr and yb > yr and max_y < yr:
            max_y, max_i = yr, i
    if max_y >= 0:
        red[max_i] = (201, 201)
        count += 1
print(count)
Buggy python submission (verdict: Runtime Error):
s = input()
t = input()
sn = len(s)
tn = len(t)
for i in range(sn-tn, -1, -1):
    matched = True
    for j in range(tn):
        if s[i+j] != t[j] and s[i+j] != '?':
            matched = False
            break
    if matched:
        break
if not matched:
    print("UNRESTORABLE")
    quit()

ans = ['a'] * sn
for j in range(0, i):
    if s[j] != '?':
        ans[j] = s[j]
for j in range(tn):
    ans[i + j] = t[j]
for j in range(i + tn, sn):
    if s[j] != '?':
        ans[j] = s[j]

print("".join(ans))

        

Fixed submission:
s = input()
t = input()
sn = len(s)
tn = len(t)

if sn < tn:
    print("UNRESTORABLE")
    quit()
    
for i in range(sn-tn, -1, -1):
    matched = True
    for j in range(tn):
        if s[i+j] != t[j] and s[i+j] != '?':
            matched = False
            break
    if matched:
        break
        
if not matched:
    print("UNRESTORABLE")
    quit()

ans = ['a'] * sn
for j in range(0, i):
    if s[j] != '?':
        ans[j] = s[j]
for j in range(tn):
    ans[i + j] = t[j]
for j in range(i + tn, sn):
    if s[j] != '?':
        ans[j] = s[j]

print("".join(ans))
Buggy python submission (verdict: Runtime Error):
    import numpy as np
  	l = map(int, input().split())
    [a, b, c, d] = l
    [A, B, C, D] = np.abs(l)
    [ab, cd, abcd, bc, Bb, ac] = [a*b, c*d, a*b*c*d, b*c, B*b, a*c]
    if abcd>=0:
        if bc<0:
            if Bb<0:
                print(b*c)
            elif a<0:
                print(b*d)
            else:
                print(a*d)
        elif a>=0:
            print(b*d)
        else:
            print(a*c)
    elif Bb<0:
        print(a*c)
    elif bc<0:
        if ac<0:
            print(b*d)
        else:
            print(a*c)
    
    else:
        print(b*d)
    

Fixed submission:
a, b, c, d= map(int, input().split())

nums = [a * c, a * d, b * c, b * d]

print(max(nums))
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())

def yakusu(n):
  S = {1, n}
  for j in range(2, int(n ** 0.5) + 1):
    if n % j == 0:
      S.add(j)
      S.add(n // j)
  return len(S)

print(sum([yakusu(i) for i in range(2, N)]) + 1)

Fixed submission:
N=int(input())
print(sum([((N-1)//1)//i for i in range(1, N)]))
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
A = list(map(int, input().split()))
total = 0
for i in range(N - 1):
  for j in range(i + 1, N):
    total += (A[i] * A[j]) % (10 ** 9 + 7)
  total %= (10 ** 9 + 7)
print(total)

Fixed submission:
N = int(input())
A = list(map(int, input().split()))
T = sum(A)
ans = 0
for i in range(N):
  T -= A[i]
  ans += A[i] * T
  ans %= 10 ** 9 + 7
print(ans)

Buggy python submission (verdict: Runtime Error):
import numpy as np
N = int(input())
A = list(map(int, input().split()))
print(np.sum(np.tril(np.outer(np.array(A), np.array(A)), k = -1)) % (10 ** 9 + 7))

Fixed submission:
N = int(input())
A = list(map(int, input().split()))
T = sum(A)
ans = 0
for i in range(N):
  T -= A[i]
  ans += A[i] * T
  ans %= 10 ** 9 + 7
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
A = list(map(int, input().split()))
total = 0
for i in range(N - 1):
  for j in range(i + 1, N):
    total += A[i] * A[j]
  total %= (10 ** 9 + 7)
print(total)

Fixed submission:
N = int(input())
A = list(map(int, input().split()))
T = sum(A)
ans = 0
for i in range(N):
  T -= A[i]
  ans += A[i] * T
  ans %= 10 ** 9 + 7
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
A = list(map(int, input().split()))
print(sum([A[i] * A[j] for i in range(N - 1) for j in range(i + 1, N)]) % (10 ** 9 + 7))

Fixed submission:
N = int(input())
A = list(map(int, input().split()))
T = sum(A)
ans = 0
for i in range(N):
  T -= A[i]
  ans += A[i] * T
  ans %= 10 ** 9 + 7
print(ans)
Buggy python submission (verdict: Runtime Error):
S = input()
print('ABC' if S = 'ARC' else 'ARC')

Fixed submission:
S = input()
print('ABC' if S == 'ARC' else 'ARC')