Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Runtime Error):
from math import factorial

def combinations_count(n, r):
    return factorial(n) // (factorial(n - r) * factorial(r))

n, k = map(int, input().split())

for i in range(1,k+1):
    print((combinations_count(n-k+1,i) * combinations_count(k-1,i-1))%(10**9+7))

Fixed submission:
from math import factorial

def combinations_count(n, r):
    return factorial(n) // (factorial(n - r) * factorial(r))

n, k = map(int, input().split())

for i in range(1,k+1):
    if i <= n-k+1:
        print((combinations_count(n-k+1,i)%(10**9+7)) * combinations_count(k-1,i-1) %(10**9+7))
    else:
        print(0)
Buggy python submission (verdict: Time Limit Exceeded):
import functools

def gcd(a, b):
    while b:
        a, b = b, a % b
    return a

n = int(input())
a = list(map(int, input().split()))
ans = 0
for i in range(n):
    b = a[i]
    a.remove(b)
    c = functools.reduce(gcd, a)
    if ans < c:
        ans = c
    a.insert(i,b)
print(ans)

Fixed submission:
def gcd(a, b):
    while b:
        a, b = b, a % b
    return a

n = int(input())
a = list(map(int, input().split()))
a.sort()
if n == 2:
    print(max(a))
else:
    a1 = gcd(a[0],a[1])
    a2 = gcd(a[1],a[2])
    a3 = gcd(a[2],a[0])
    m = max(a1,a2,a3)
    judge = 0
    for i in range(m):
        if judge == 1:
            break
        cnt = 0
        for j in range(n):
            if a[j] % (m-i) != 0:
                cnt += 1
            if cnt > 1:
                break
            if j == n-1 and cnt <= 1:
                print(m-i)
                judge = 1
Buggy python submission (verdict: Runtime Error):
n, k = map(int, input().split())
s = input()
ans_0 = []
ans_1 = []
cnt = 0

if s.count("1") == 1:
    print(max(n - 1 - s.index("1"), s.index("1") + 1))
else:
    s = list(s)
    for i in range(n):
        if s[i] == "1" and cnt == 0:
            ans_0.append(i)
            cnt += 1
        elif s[i] == "0":
            cnt = 0
    cnt = 0
    for i in range(n):
        if s[n-1 - i] == "1" and cnt == 0:
            ans_1.append(n-1-i)
            cnt += 1
        elif s[n-1 - i] == "0":
            cnt = 0
    ans_1.sort()
    ans_list = []
    for i in range(len(ans_0) - k):
        ans_list.append(ans_1[i+k] - ans_0[i])
    print(max(ans_list) + 1)

Fixed submission:
n, k = map(int, input().split())
s = list(input())
ans_0 = []
ans_1 = []

cnt = 0
for i in range(n):
    if s[i] == "1" and cnt == 0:
        ans_0.append(i)
        cnt += 1
    elif s[i] == "0":
        cnt = 0
cnt = 0
for i in range(n):
    if s[n-1 - i] == "1" and cnt == 0:
        ans_1.append(n-1-i)
        cnt += 1
    elif s[n-1 - i] == "0":
        cnt = 0
ans_1.sort()
ans_list = []
if len(ans_0) == 0:
    print(n)
elif len(ans_0) == 1:
    if k == 1:
        print(max(n-ans_0[0], ans_1[0]+1))
    else:
        print(n)
elif len(ans_0) < k:
    print(n)
else:
    if 0 not in ans_0:
        ans_0.append(0)
        ans_1.append(0)
        ans_0.sort()
        ans_1.sort()
    if n-1 not in ans_1:
        ans_0.append(n-1)
        ans_1.append(n-1)
    for i in range(len(ans_0) - k):
        ans_list.append(ans_1[i+k] - ans_0[i])
    print(max(ans_list) + 1)
Buggy python submission (verdict: Runtime Error):
s = list(input())
cnt = 0
list = []
for i in range(len(s)):
    if s[i] == "A" or s[i] == "T" or s[i] == "C" or s[i] == "G":
        cnt += 1
    else:
        list.append(cnt)
        cnt = 0
print(max(list))

Fixed submission:
s = list(input())
cnt = 0
list = []
for i in range(len(s)):
    if s[i] == "A" or s[i] == "T" or s[i] == "C" or s[i] == "G":
        cnt += 1
        list.append(cnt)
    else:
        cnt = 0
        list.append(cnt)
print(max(list))
Buggy python submission (verdict: Runtime Error):
n = int(input())
s = list(input())
t = "abcdefghijklmnopqrstuvwxyz"
ans = 1

for i in range(n):
    ans *= (s.count(t[i]) + 1)

print((ans-1)%(10**9+7))

Fixed submission:
n = int(input())
s = list(input())
t = "abcdefghijklmnopqrstuvwxyz"
ans = 1

for i in range(26):
    ans *= (s.count(t[i]) + 1)

print((ans-1)%(10**9+7))

Buggy python submission (verdict: Runtime Error):
n = int(input())
s = list(input())
t = "abcdefghijklmnopqrstuvwxyz"
ans = 1

for i in range(n):
    ans *= (s.count(t[i]) + 1)
    if ans > 10**9 + 7:
        ans %= 10**9+7

print(ans-1)

Fixed submission:
n = int(input())
s = list(input())
t = "abcdefghijklmnopqrstuvwxyz"
ans = 1

for i in range(26):
    ans *= (s.count(t[i]) + 1)

print((ans-1)%(10**9+7))

Buggy python submission (verdict: Runtime Error):
n = int(input())
s = list(input())
t = "abcdefghijklmnopqrstuvwxyz"
ans = 1

for i in range(n):
    ans *= (s.count(t[i]) + 1)

print(ans-1)

Fixed submission:
n = int(input())
s = list(input())
t = "abcdefghijklmnopqrstuvwxyz"
ans = 1

for i in range(26):
    ans *= (s.count(t[i]) + 1)

print((ans-1)%(10**9+7))

Buggy python submission (verdict: Runtime Error):
n = int(input())
s = list(input())
t = "abcdefghijklmnopqrstuvwxyz"
list = []

for i in range(n):
    list.append(s.count(t[i]))

ans = 1

for i in range(n):
    ans *= (list[i]+1)
    if ans > 10**9 + 7:
        ans = ans % (10**9+7)

print(ans-1)

Fixed submission:
n = int(input())
s = list(input())
t = "abcdefghijklmnopqrstuvwxyz"
ans = 1

for i in range(26):
    ans *= (s.count(t[i]) + 1)

print((ans-1)%(10**9+7))

Buggy python submission (verdict: Runtime Error):
n = int(input())
s = list(input())
t = "abcdefghijklmnopqrstuvwxyz"
list = []

for i in range(n):
    list.append(s.count(t[i]))

ans = 1

for i in range(len(list)):
    ans *= (list[i]+1)
    if ans > 10**9 + 7:
        ans = ans % (10**9+7)

print(ans-1)

Fixed submission:
n = int(input())
s = list(input())
t = "abcdefghijklmnopqrstuvwxyz"
ans = 1

for i in range(26):
    ans *= (s.count(t[i]) + 1)

print((ans-1)%(10**9+7))

Buggy python submission (verdict: Runtime Error):
n = int(input())
s = list(input())
t = "abcdefghijklmnopqrstuvwxyz"
list = []

for i in range(n):
    list.append(s.count(t[i]))

ans = 1

for i in range(len(list)):
    ans *= (list[i]+1)

print(ans-1)

Fixed submission:
n = int(input())
s = list(input())
t = "abcdefghijklmnopqrstuvwxyz"
ans = 1

for i in range(26):
    ans *= (s.count(t[i]) + 1)

print((ans-1)%(10**9+7))
Buggy python submission (verdict: Runtime Error):
import math

n = int(input())
monster = sorted(list(map(int, input().split())))

for i in range(1,n):
    monster[i] = math.gcd(monster[0], monster[i])

print(min(monster))

Fixed submission:
n = int(input())
monster = sorted(list(map(int, input().split())))

def gcd(a, b):
    while b:
	    a, b = b, a % b
    return a

for i in range(1,n):
    monster[i] = gcd(monster[0], monster[i])

print(min(monster))

Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
monster = sorted(list(map(int, input().split())))
cnt = len(monster)
while cnt > 0:
    for i in range(len(monster)):
        for j in range(len(monster)):
            if i != j and monster[i] != 0:
                monster[j] %= monster[i]
                if monster[j] == 0:
                    cnt -= 1

print(max(monster))

Fixed submission:
n = int(input())
monster = sorted(list(map(int, input().split())))

def gcd(a, b):
    while b:
	    a, b = b, a % b
    return a

for i in range(1,n):
    monster[i] = gcd(monster[0], monster[i])

print(min(monster))
Buggy python submission (verdict: Time Limit Exceeded):
n, k = map(int, input().split())
a = list(map(int, input().split()))
cnt_list = []
b = set(a)
for s in b:
    cnt_list.append(a.count(s))
cnt_list = sorted(cnt_list)

print(sum(cnt_list[:len(cnt_list) - k]))

Fixed submission:
n, k = map(int, input().split())
a = list(map(int, input().split()))
cnt_list = [0]*(n+1)
for i in range(n):
    cnt_list[a[i]] += 1
cnt_list.sort()
print(sum(cnt_list[:len(cnt_list) - k]))

Buggy python submission (verdict: Time Limit Exceeded):
n, k = map(int, input().split())
a = list(map(int, input().split()))
cnt_list = []
b = set(a)
for s in b:
    cnt_list.append(a.count(s))
cnt_list = sorted(cnt_list)

print(sum(cnt_list[:len(cnt_list) - k]) if len(cnt_list) - k > 0 else 0)

Fixed submission:
n, k = map(int, input().split())
a = list(map(int, input().split()))
cnt_list = [0]*(n+1)
for i in range(n):
    cnt_list[a[i]] += 1
cnt_list.sort()
print(sum(cnt_list[:len(cnt_list) - k]))

Buggy python submission (verdict: Time Limit Exceeded):
n, k = map(int, input().split())
a = sorted(list(map(int, input().split())))
cnt_list = []
b = set(a)
for s in b:
    cnt_list.append(a.count(s))
cnt_list = sorted(cnt_list)

print(sum(cnt_list[:len(cnt_list) - k]) if len(cnt_list) - k > 0 else 0)

Fixed submission:
n, k = map(int, input().split())
a = list(map(int, input().split()))
cnt_list = [0]*(n+1)
for i in range(n):
    cnt_list[a[i]] += 1
cnt_list.sort()
print(sum(cnt_list[:len(cnt_list) - k]))
Buggy python submission (verdict: Runtime Error):
a,b,c,d,e,f = map(int, input().split())
g = max(a, b)
h = min(a, b)
salt = []
water = []
concentration = 0

for i in range(int(e*f/(c*100)) + 1):
    j = 0
    while e*f/100 >= c*i +d*j:
        salt.append(c*i+d*j)
        j += 1
salt.sort()

for i in range(int(f/(100*g))+1):
    j = 0
    while f >= 100*(g*i+h*j):
        water.append(100*(g*i+h*j))
        j += 1
water.sort()
water = water[1:]

for i in range(len(water)):
    addsalt = min(water[i] * e // 100, f - water[i])
    while addsalt not in salt and addsalt > 0:
        addsalt -=1
    if concentration < addsalt / (water[i] + addsalt):
        concentration = addsalt / (water[i] + addsalt)
        salt1 = addsalt
        water1 = water[i]

print(salt1+water1, salt1)

Fixed submission:
a,b,c,d,e,f = map(int, input().split())
g = max(a, b)
h = min(a, b)
salt = []
water = []
concentration = 0

for i in range(int(e*f/(c*100)) + 1):
    j = 0
    while e*f/100 >= c*i +d*j:
        salt.append(c*i+d*j)
        j += 1
salt.sort()

for i in range(int(f/(100*g)) + 1):
    j = 0
    while f >= 100*(g*i+h*j):
        water.append(100*(g*i+h*j))
        j += 1
water.sort()
water = water[1:]

for i in range(len(water)):
    addsalt = min(water[i] * e // 100, f - water[i])
    while addsalt not in salt:
        addsalt -=1
    if concentration < addsalt / (water[i] + addsalt):
        concentration = addsalt / (water[i] + addsalt)
        salt1 = addsalt
        water1 = water[i]

try:
    print(salt1+water1, salt1)
except NameError:
    print(water[0], 0)

Buggy python submission (verdict: Runtime Error):
a,b,c,d,e,f = map(int, input().split())
g = max(a, b)
h = min(a, b)
salt = []
water = []
concentration = 0

for i in range(int(e*f/(c*100)) + 1):
    j = 0
    while e*f/100 >= c*i +d*j:
        salt.append(c*i+d*j)
        j += 1
salt.sort()

for i in range(int(f/(100*g))+1):
    j = 0
    while f >= 100*(g*i+h*j):
        water.append(100*(g*i+h*j))
        j += 1
water.sort()
water = water[1:]

for i in range(len(water)):
    addsalt = min(water[i] * e // 100, f - water[i])
    while addsalt not in salt:
        addsalt -=1
    if concentration < addsalt / (water[i] + addsalt):
        concentration = addsalt / (water[i] + addsalt)
        salt1 = addsalt
        water1 = water[i]

print(salt1+water1, salt1)

Fixed submission:
a,b,c,d,e,f = map(int, input().split())
g = max(a, b)
h = min(a, b)
salt = []
water = []
concentration = 0

for i in range(int(e*f/(c*100)) + 1):
    j = 0
    while e*f/100 >= c*i +d*j:
        salt.append(c*i+d*j)
        j += 1
salt.sort()

for i in range(int(f/(100*g)) + 1):
    j = 0
    while f >= 100*(g*i+h*j):
        water.append(100*(g*i+h*j))
        j += 1
water.sort()
water = water[1:]

for i in range(len(water)):
    addsalt = min(water[i] * e // 100, f - water[i])
    while addsalt not in salt:
        addsalt -=1
    if concentration < addsalt / (water[i] + addsalt):
        concentration = addsalt / (water[i] + addsalt)
        salt1 = addsalt
        water1 = water[i]

try:
    print(salt1+water1, salt1)
except NameError:
    print(water[0], 0)
Buggy python submission (verdict: Time Limit Exceeded):
k, s = map(int, input().split())
cnt = 0

for x in range(k+1):
    for y in range(k+1):
        for z in range(k+1):
            if x + y + z == s:
                cnt += 1

print(cnt)

Fixed submission:
k, s = map(int, input().split())
cnt = 0

for x in range(k+1):
    for y in range(k+1):
        if x + y <= s <= x + y + k:
            cnt += 1

print(cnt)
Buggy python submission (verdict: Runtime Error):
5
2 2 3 5 5

Fixed submission:
N = int(input())
A = list(map(int, input().split()))
A_ = [a-i-1 for i,a in enumerate(A)]

A_.sort()

b = A_[N//2]

print(sum([abs(ai-b) for ai in A_]))

Buggy python submission (verdict: Runtime Error):
N = int(input())
A = list(map(int, input().split()))
A_ = [a-i-1 for i,a in enumerate(A)]
print (A_)
A_.sort()
print (A_)
b = A_[N//2]
print (b)
print(sum([abs(ai-b) for ai in A_]))

Fixed submission:
N = int(input())
A = list(map(int, input().split()))
A_ = [a-i-1 for i,a in enumerate(A)]

A_.sort()

b = A_[N//2]

print(sum([abs(ai-b) for ai in A_]))
Buggy python submission (verdict: Runtime Error):
k = int(input())

if k % 7 == 0:
  k /= k7

if k % 2 == 0 or k % 5 == 0:
  print(-1)
else:
  ans = 1
  cnt = 1
  while 1:
    if ans % k == 0:
      break
    else:
      cnt += 1
      ans *= 10
      ans += 1
      ans %= k

  print(cnt)      

Fixed submission:
k = int(input())

if k % 2 == 0 or k % 5 == 0:
  print(-1)
else:
  ans = 7
  cnt = 1
  while 1:
    if ans % k == 0:
      break
    else:
      cnt += 1
      ans *= 10
      ans += 7
      ans %= k

  print(cnt)

Buggy python submission (verdict: Runtime Error):
k = int(input())

if k % 7 == 0:
  k = k/7

if k % 2 == 0 or k % 5 == 0:
  print(-1)
else:
  ans = 1
  cnt = 1
  while 1:
    if ans % k == 0:
      break
    else:
      cnt += 1
      ans *= 10
      ans += 1

  print(cnt)      

Fixed submission:
k = int(input())

if k % 2 == 0 or k % 5 == 0:
  print(-1)
else:
  ans = 7
  cnt = 1
  while 1:
    if ans % k == 0:
      break
    else:
      cnt += 1
      ans *= 10
      ans += 7
      ans %= k

  print(cnt)
Buggy python submission (verdict: Runtime Error):
A, B, M = map(int, input().split())

a = list(map(int, input().split()))
b = list(map(int, input().split()))

amin = min(a)
bmin = min(b)

ans = amin + bmin

for i in range(M):
  x, y, c = map(int, input().split())
  ans = min( ans , a[x-1] + b[x-1] - c )

print(ans)

Fixed submission:
A, B, M = map(int, input().split())

a = list(map(int, input().split()))
b = list(map(int, input().split()))

amin = min(a)
bmin = min(b)

ans = amin + bmin

for i in range(M):
  x, y, c = map(int, input().split())
  ans = min( ans , a[x-1] + b[y-1] - c )

print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
import bisect
import copy

def check(a, b, bar):
    sm = 0
    cnt = 0
    n = len(a)
    for x in a:
        i = bisect.bisect_left(a, bar - x)
        if i == n:
            continue

        cnt += n - i
        sm += b[i] + x * (n-i)
        
    return cnt, sm

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

b = copy.deepcopy(a)
for i,_ in enumerate(b[:-1]):
    b[n-i-2] += b[n-i-1]
    
left = 0
right = b[0] * 2

while right - left > 1:
    middle = ( right + left ) // 2    
    if check(a, b, middle)[0] < m:
        right = middle
    else:
        left = middle
             
print(check(a, b, left)[1] - left * (check(a, b, left)[0]-m) ) 

Fixed submission:
import bisect
import copy

def check(a, b, bar):
    sm = 0
    cnt = 0
    n = len(a)
    for x in a:
        i = bisect.bisect_left(a, bar - x)
        if i == n:
            continue

        cnt += n - i
        sm += b[i] + x * (n-i)
        
    return cnt, sm

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

b = copy.deepcopy(a)
for i,_ in enumerate(b[:-1]):
    b[n-i-2] += b[n-i-1]
    
left = 0
right = b[0] * 2

while right - left > 1:
    middle = ( right + left ) // 2    
    if check(a, b, middle)[0] < m:
        right = middle
    else:
        left = middle
             
print(check(a, b, left)[1] - left * (check(a, b, left)[0]-m) )
Buggy python submission (verdict: Runtime Error):
a,b = map(lambda x: int(x) for x in input().split())

print(max(a+b, a-b, a*b))

Fixed submission:
a,b = map(lambda x: int(x), input().split())

print(max(a+b, a-b, a*b))
Buggy python submission (verdict: Runtime Error):
n,x = map(int, input().split())

donutspowderconsumption = [int(input()) for i in range(n)]
totalpowderconsumption = sum(donutspowderconsumption)
sort(donutspowderconsumption)

prin( n + (x-totalpowderconsumption) // donutspowderconsumption[0])

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

donutspowderconsumption = [int(input()) for i in range(n)]
totalpowderconsumption = sum(donutspowderconsumption)
donutspowderconsumption.sort()

print( n + (x-totalpowderconsumption) // donutspowderconsumption[0])
Buggy python submission (verdict: Runtime Error):
x = int(input())
t = int(input())

print(max(x-t, 0))

Fixed submission:
x,t = map(int, input().split())
print(max(x-t, 0))
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())

a = [int(input()) - 1 for _ in range(n)]

i = 0
count = 0

pushed = []

while(1):
  pushed.append(i)
  i = a[i]
  count += 1
  if i == 1:
    break
  elif i in pushed:
    count = -1
    break
    
print(count)

Fixed submission:
n = int(input())

a = [int(input()) - 1 for _ in range(n)]

i = 0
count = 0

for _ in range(n+1):
  i = a[i]
  count += 1
  if i == 1:
    break

if count == n + 1:
  count = -1
  
print(count)

Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
a = [int(input()) - 1 for _ in range(n)]

i = 0
count = 0

pushed = []

while(1):
  pushed.append(i)
  i = a[i]
  count += 1
  if i == 1:
    break
  elif i in pushed:
    count = -1
    break
    
print(count)

Fixed submission:
n = int(input())

a = [int(input()) - 1 for _ in range(n)]

i = 0
count = 0

for _ in range(n+1):
  i = a[i]
  count += 1
  if i == 1:
    break

if count == n + 1:
  count = -1
  
print(count)

Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())

a = [int(input()) - 1 for _ in range(n)]

i = 0
count = 0

while(1):
  i = a[i]
  count += 1
  if i == 1:
    break
  elif i == a[i]:
    count = -1
    break
  
print(count)

Fixed submission:
n = int(input())

a = [int(input()) - 1 for _ in range(n)]

i = 0
count = 0

for _ in range(n+1):
  i = a[i]
  count += 1
  if i == 1:
    break

if count == n + 1:
  count = -1
  
print(count)

Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())

a = [int(input()) - 1 for _ in range(n)]

i = 0
count = 0

while(1):
  i = a[i]
  count += 1
  if i == 1:
    break
  elif i == 0:
    count = -1
    break
  
print(count)

Fixed submission:
n = int(input())

a = [int(input()) - 1 for _ in range(n)]

i = 0
count = 0

for _ in range(n+1):
  i = a[i]
  count += 1
  if i == 1:
    break

if count == n + 1:
  count = -1
  
print(count)

Buggy python submission (verdict: Runtime Error):
n = int(input())

a = [int(input()) - 1 for i in range(n)]

i = 0
count = 0

while(1):
  i = a[i]
  count += 1
  if i == 1:
    break
  elif i == 0:
    print(-1)
    return 0
  
print(count)

Fixed submission:
n = int(input())

a = [int(input()) - 1 for _ in range(n)]

i = 0
count = 0

for _ in range(n+1):
  i = a[i]
  count += 1
  if i == 1:
    break

if count == n + 1:
  count = -1
  
print(count)
Buggy python submission (verdict: Time Limit Exceeded):
a = int(input())
b = list(map(int,input().split()))
c = 1

for i in range(1,a):
  if min(b[0:i])>b[i]:
    c += 1
print(c)
      

Fixed submission:
a = int(input())
b = list(map(int,input().split()))
c = 1
k = b[0]
for i in range(1,a):
  if k>b[i]:
  	
  	k = b[i]
  	c+=1
print(c)

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

for i in range(1,a):
  switch = 0
  for j in range(i-1,-1,-1):
    if b[i] > b[j]:
      switch = 1
      break
  if switch != 1:
    c += 1
print(c)
      
      
  

Fixed submission:
a = int(input())
b = list(map(int,input().split()))
c = 1
k = b[0]
for i in range(1,a):
  if k>b[i]:
  	
  	k = b[i]
  	c+=1
print(c)

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

for i in range(1,a):
  switch = 0
  for j in range(0,i):
    if b[i] > b[j]:
      switch = 1
      break
  if switch != 1:
    c += 1
print(c)
      
      
  


Fixed submission:
a = int(input())
b = list(map(int,input().split()))
c = 1
k = b[0]
for i in range(1,a):
  if k>b[i]:
  	
  	k = b[i]
  	c+=1
print(c)

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

for i in range(1,a):
  switch = 0
  for j in range(0,i):
    if b[i] > b[j]:
      switch = 1
  if switch != 1:
    c += 1
print(c)
      
      
  


Fixed submission:
a = int(input())
b = list(map(int,input().split()))
c = 1
k = b[0]
for i in range(1,a):
  if k>b[i]:
  	
  	k = b[i]
  	c+=1
print(c)

Buggy python submission (verdict: Runtime Error):
a = int(input())
b = list(map(int,input().split()))
b[0:0]=0
c = 0
for i in range(1,a+1):
  switch = 0
  for j in range(0,i):
    if b[i] < b[j]:
      switch = 1
    if switch == 1:
      c += 1
print(c)
      
      
  

Fixed submission:
a = int(input())
b = list(map(int,input().split()))
c = 1
k = b[0]
for i in range(1,a):
  if k>b[i]:
  	
  	k = b[i]
  	c+=1
print(c)
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
A=[]
B=['a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z']
d=''
count = ''
countw = 0
for i in range(0,N):
    A.append(input())
    for j in range(0, len(B)):
        d = str(A[i].count(B[j]))
        count += d
    A[i]=int(count)
    count=''
for i in range(0,N):
    for j in range(1,N-i):
        if A[i]==A[i+j]:
            countw += 1
print(countw)


Fixed submission:
N = int(input())
A=[]
count=1
ss=0
for i in range(0,N):
    A.append(list(input()))
    A[i].sort()
A.sort()
A.append('0')
for j in range(1,N+1):
    if A[j-1]==A[j]:
        count+=1
        j+=1
    else:
        ss+=count*(count-1)/2
        count = 1
        j+=1

print(int(ss))
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
goukei = 1
for i in input().split():
    goukei *= int(i)
if goukei > 1000000000000000000:
    print(-1)
else:
    print(goukei)

Fixed submission:
n = int(input())
goukei = 1
ok = 0
arr = [int(x) for x in input().split()]
if 0 in arr:
    print(0)
else:
    for i in arr:
        goukei *= int(i)
        if goukei > 1000000000000000000:
            print(-1)
            ok = 1
            break
    if ok == 0:
        print(goukei)
Buggy python submission (verdict: Runtime Error):
import sys
a, b, c = map(int,sys.stdin.readline().split())
d = c - a - b
if d > 0 && d * d > 4 * b * a:
  print("Yes")
else:
  print("No")

Fixed submission:
import sys
a, b, c = map(int,sys.stdin.readline().split())
d = c - a - b
if d > 0 and d * d > 4 * b * a:
  print("Yes")
else:
  print("No")
Buggy python submission (verdict: Runtime Error):
s = inputu()
if s[0] == s[1] and s[0] = s[2] and s[1] == s[2]:
  print("No")
else:
  print("Yes")

Fixed submission:
s = input()
if s[0] == s[1] and s[0] == s[2]:
  print("No")
else:
  print("Yes")
Buggy python submission (verdict: Runtime Error):

import math
a, b = map(int, input().split())

print(int(a * b / math.gcd(a,b)))

Fixed submission:
a, b = map(int, input().split())
if a < b:
    a, b = b, a

c = a
d = b
r = c // d
m = c % d

while True:
    if m == 0:
        break
    else:
        c = d
        d = m
        m = c % d

print(int(a * b / d))

Buggy python submission (verdict: Runtime Error):
import math
a, b = map(int, input().split())
print(a * b / math.gcd(a, b))

Fixed submission:
a, b = map(int, input().split())
if a < b:
    a, b = b, a

c = a
d = b
r = c // d
m = c % d

while True:
    if m == 0:
        break
    else:
        c = d
        d = m
        m = c % d

print(int(a * b / d))