Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Runtime Error):
def main():
    #import sys
    #input = sys.stdin.readline
    S = input()
    S_list = list(S)
    dig = len(S) - 1
    insert_plus = format(0,"0"+str(dig)+"b")
    insert_plus_max = "1"*len(insert_plus)
    s = 0
    for i in range(int(insert_plus_max,2)+1):
        before = 0
        num_list = []
        now = format(i,"0"+str(dig)+"b")
        for j in range(len(now)):
            if now[j] == "1":
                num_list.append("".join(S_list[before:int(j)+1]))
                before = j+1
            if j == len(now)-1:
                num_list.append("".join(S_list[before:]))
        for num in num_list:
            s += int(num)
    print(s)

if __name__ == "__main__":
    main()

Fixed submission:
def main():
    #import sys
    #input = sys.stdin.readline
    S = input()
    S_list = list(S)
    dig = len(S) - 1
    insert_plus = format(0,"0"+str(dig)+"b")
    insert_plus_max = "1"*len(insert_plus)
    s = 0
    if len(S) == 1:
        print(int(S))
        exit()

    for i in range(int(insert_plus_max,2)+1):
        before = 0
        num_list = []
        now = format(i,"0"+str(dig)+"b")
        for j in range(len(now)):
            if now[j] == "1":
                num_list.append("".join(S_list[before:int(j)+1]))
                before = j+1
            if j == len(now)-1:
                num_list.append("".join(S_list[before:]))
        for num in num_list:
            s += int(num)
    print(s)

if __name__ == "__main__":
    main()
Buggy python submission (verdict: Runtime Error):
import math
n=float(input())
n*=2
print(n*math.pi

Fixed submission:
import math
n=float(input())
n*=2
print(n*math.pi)
Buggy python submission (verdict: Time Limit Exceeded):
n=int(input())
j=list(map(int, input().split()))
for i in range(n):
    print(j.count(i+1))

Fixed submission:
n=int(input())
r=[0]*n
j=list(map(int, input().split()))
for i in j:
    r[i-1]+=1
for i in r:
    print(i)
Buggy python submission (verdict: Runtime Error):
import copy
import fractions
from functools import reduce

def gcd_list(numbers):
    return reduce(fractions.gcd, numbers)
  
# 整数の入力
a = int(input())
# 数値のリスト化
xList = [int(i) for i in input().split()]
keisanList = copy.deepcopy(xList)
saidai = max(xList)
saidaiKoyakuSu = 0
koyakuSu = 0
listIndex = 0

for i in range(a):
    keisanList = copy.deepcopy(xList)
    keisanList[i] = saidai
    koyakuSu = gcd_list(keisanList)
    if(saidaiKoyakuSu < koyakuSu):
        saidaiKoyakuSu = koyakuSu
        listIndex = i

xList[listIndex] = saidai
print(gcd_list(xList))

Fixed submission:
# スペース区切りの整数の入力
a, b, c = map(int, input().split())
d = c + 0.5
bis = 0
byou = 0

for i in range(21):
    byou = i * a
    if byou >= d:
        break
    bis = i * b

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

stm = [[] for i in range(n)]

def possible(honest):
    for i in range(n):
        if honest[i] == '0':
            continue
        for j in range(len(stm[i])):
            if stm[i][j][1] == 1 and honest[stm[i][j][0]-1] == '0':
                return False
            elif stm[i][j][1] == 0 and honest[stm[i][j][0]-1] == '1':
                return False
    return True

            

for i in range(n):
    a = int(input())
    x,y = map(int, input().split())
    stm[i].append([x,y])
   
count = 0
for k in range(2**n):
    hon = list(bin(k)[2:])
    hon = ['0']*(n-len(hon)) + hon
    if possible(hon):
        print(hon)
        count = max(count, sum([int(x) for x in hon]))
print(count)            

Fixed submission:
n = int(input())

stm = [[] for i in range(n)]

def possible(honest):
    #print(honest)
    for i in range(n):
        if honest[i] == '0':
            continue
        for j in range(len(stm[i])):
            #print(stm[i][j])
            #print(honest[stm[i][j][0]-1])
            if stm[i][j][1] == 1 and honest[stm[i][j][0]-1] == '0':
                return False
            elif stm[i][j][1] == 0 and honest[stm[i][j][0]-1] == '1':
                return False
    return True

            

for i in range(n):
    a = int(input())
    for _ in range(a):
        x,y = map(int, input().split())
        stm[i].append([x,y])
   
count = 0
for k in range(2**n):
    hon = list(bin(k)[2:])
    hon = ['0']*(n-len(hon)) + hon
    if possible(hon):
        count = max(count, sum([int(x) for x in hon]))
print(count)
Buggy python submission (verdict: Runtime Error):
word = input().split()
#print(word)
if word[0] == "7" :
    print("Yes")
elif word[1] == "7" :
    print("Yes")
elif word[2] == "7" :
    print("Yes")
else:
    print("No")


Fixed submission:
num = input()
word = list(num)
#print(word)
if word[0] == "7" :
    print("Yes")
elif word[1] == "7" :
    print("Yes")
elif word[2] == "7" :
    print("Yes")
else:
    print("No")

Buggy python submission (verdict: Runtime Error):
num = lits(input())
print(num)
if num[0] == "7":
  print("Yes")
elif num[1] == "7":
  print("Yes")
elif num[2] == "7":
  print("Yes")
else:
  print("No")

Fixed submission:
num = input()
word = list(num)
#print(word)
if word[0] == "7" :
    print("Yes")
elif word[1] == "7" :
    print("Yes")
elif word[2] == "7" :
    print("Yes")
else:
    print("No")
Buggy python submission (verdict: Time Limit Exceeded):
def gcd(a, b):
    while b:
        a, b = b, a % b
    return a
  
result = 0
K = int(input())
for i in range(K):
  for j in range(K):
    for k in range(K):
      a = i+1
      b = j+1
      c = k+1
      num = gcd(a,b)
      num2 = gcd(num,c)
      result += num2
print(result)

Fixed submission:
def gcd(a, b):
    while b:
        a, b = b, a % b
    return a
  
result = 0
K = int(input())
for i in range(K):
  for j in range(K):
    for k in range(K):
      a = i+1
      b = j+1
      c = k+1
      num = gcd(a,b)
      num2 = gcd(num,c)
      result += num2
print(result)

Buggy python submission (verdict: Time Limit Exceeded):
import math

result = 0
K = int(input())
for i in range(K):
  for j in range(K):
    for k in range(K):
      a = i+1
      b = j+1
      c = k+1
      num = math.gcd(a,b)
      num2 = math.gcd(num,c)
      result += num2
print(result)

Fixed submission:
def gcd(a, b):
    while b:
        a, b = b, a % b
    return a
  
result = 0
K = int(input())
for i in range(K):
  for j in range(K):
    for k in range(K):
      a = i+1
      b = j+1
      c = k+1
      num = gcd(a,b)
      num2 = gcd(num,c)
      result += num2
print(result)
Buggy python submission (verdict: Runtime Error):
a,b,c=map(int, input().split())
 
print max((c-(a-b)),0)

Fixed submission:
a,b,c=map(int, input().split())
 
print(max((c-(a-b)),0))

Buggy python submission (verdict: Runtime Error):
a = int(input())
b = int(input())
c = int(input())

print(c-(a-b))

Fixed submission:
a,b,c=map(int, input().split())
 
print(max((c-(a-b)),0))
Buggy python submission (verdict: Runtime Error):
N = int(input())
a = list(map(int, input().split()))

b=[-1]*N
b[N-1]=a[N-1]
for i in range(N-1)[::-1]: #N=4なら 2,1,0
    sum_count = N // (i+1)
    if sum_count==1:
        b[i]=a[i]
    else:
        sum1=0
        for j in range(sum_count-1):
            sum1 = sum1 + b[(i+1)*(j+1)]
        sum1 = sum1 % 2
        b[i]=(a[i]+ sum1)%2

print(sum(b))
for i in range(N):
    if b[i]==1:
        print(i+1,end=" ")

Fixed submission:
N = int(input())
print(3*N*N)
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
a = list(map(int, input().split()))

b=[-1]*N
b[N-1]=a[N-1]
for i in range(N-1)[::-1]: #N=4なら 2,1,0
    sum_count = N // (i+1)
    if sum_count==1:
        b[i]=a[i]
    else:
        sum1=0
        for j in range(sum_count-1):
            sum1 = sum1 + b[(i+1)*(j+2)-1]
        sum1 = sum1 % 2
        b[i]=(a[i]+ sum1)%2

print(sum(b))
f=0
for i in range(N):
    if b[i]==1 and f==0:
        f=1
        out=str(i+1)
    elif b[i]==1:
        out = out + " " + str(i+1)
if f==1:
    print(out)

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

b=[-1]*N
b[N-1]=a[N-1]
for i in range(N-1)[::-1]: #N=4なら 2,1,0
    sum_count = N // (i+1)
    if sum_count==1:
        b[i]=a[i]
    else:
        sum1=0
        for j in range(sum_count-1):
            sum1 = sum1 + b[(i+1)*(j+2)-1]
        sum1 = sum1 % 2
        b[i]=(a[i]+ sum1)%2

print(sum(b))
for i in range(N):
    if b[i]==1:
        print(i+1,end=" ")
Buggy python submission (verdict: Runtime Error):
#YYMM, MMYY, AMBIGUOUS, NA
S = str(input())

s0 = int(S[0:2])
s1 = int(S[2:])

if s0>12:#YYMM or NA
    if s1>12:
        ans=="NA"
    else:
        ans=="YYMM"
elif s1>12:#MMYY
    ans="MMYY"
else:
    ans="AMBIGUOUS"
    
print(ans)

Fixed submission:
#YYMM, MMYY, AMBIGUOUS, NA
S = str(input())

s0 = int(S[0:2])
s1 = int(S[2:])

if s0>12 or s0==0:#YYMM or NA
    if s1>12 or s1==0:
        ans="NA"
    else:
        ans="YYMM"
elif s1>12 or s1==0:#MMYY
    ans="MMYY"
else:
    ans="AMBIGUOUS"
    
print(ans)

Buggy python submission (verdict: Runtime Error):
#YYMM, MMYY, AMBIGUOUS, NA
S = str(input())

s0 = int(S[0:2])
s1 = int(S[2:])

if s0>12:#YYMM or NA
    if s1>12:
        ans=="NA"
    else:
        ans=="YYMM"
elif s1>12:#MMYY
    ans="MMYY"
else:
    "AMBIGUOUS"
    
print(ans)

Fixed submission:
#YYMM, MMYY, AMBIGUOUS, NA
S = str(input())

s0 = int(S[0:2])
s1 = int(S[2:])

if s0>12 or s0==0:#YYMM or NA
    if s1>12 or s1==0:
        ans="NA"
    else:
        ans="YYMM"
elif s1>12 or s1==0:#MMYY
    ans="MMYY"
else:
    ans="AMBIGUOUS"
    
print(ans)
Buggy python submission (verdict: Runtime Error):
# -*- coding: utf-8 -*-
N = int(input())
S = []
for i in range(N):
    S.append(str(input()))
    
start_b = 0
end_a = 0
both = 0
ab_count = 0
for i in S:
    if i[0]=="B":
        start_b = start_b + 1
    if i[-1]=="A":
        end_a = end_a + 1
    if i[0]=="B" and i[-1]=="A":
        both = both + 1
    ab_count = ab_count + i.count("AB")

additional = min(start_b, end_a)
if additional == both:
    additional = additional  - 1
ans = ab_count + additional
print(ans)

Fixed submission:
# -*- coding: utf-8 -*-
n, k = map(int, input().split())
print(n-k+1)
Buggy python submission (verdict: Time Limit Exceeded):
# -*- coding: utf-8 -*-
in_r, in_g, in_b, n = map(int, input().split())

ans = 0

in_list= [in_r,in_g,in_b]
sorted_list = sorted(in_list)

r = sorted_list[-1]
g = sorted_list[-2]
b = sorted_list[-3]

max_r = n // r

for i in range(max_r+1):
    tmp = n - (r * i)
    max_g = tmp // g
    after_r = tmp
    for j in range(max_g+1):
        tmp = after_r
        tmp = tmp - (g * j)
        max_b = tmp // b
        after_g = tmp
        if tmp%b == 0:
            ans = ans + 1

print(ans)

Fixed submission:
# -*- coding: utf-8 -*-
in_r, in_g, in_b, n = map(int, input().split())

ans = 0

in_list= [in_r,in_g,in_b]
sorted_list = sorted(in_list)

r = sorted_list[-1]
g = sorted_list[-2]
b = sorted_list[-3]

max_r = n // r

for i in range(max_r+1):
    tmp = n - (r * i)
    max_g = tmp // g
    for j in range(max_g+1):
        if  (tmp - (g * j))%b == 0:
            ans = ans + 1

print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
# -*- coding: utf-8 -*-
r, g, b, n = map(int, input().split())

ans = 0
max_r = n // r

for i in range(max_r+1):
    tmp = n - (r * i)
    max_g = tmp // g
    after_r = tmp
    for j in range(max_g+1):
        tmp = after_r
        tmp = tmp - (g * j)
        max_b = tmp // b
        after_g = tmp
        if tmp%b == 0:
            ans = ans + 1

print(ans)

Fixed submission:
# -*- coding: utf-8 -*-
in_r, in_g, in_b, n = map(int, input().split())

ans = 0

in_list= [in_r,in_g,in_b]
sorted_list = sorted(in_list)

r = sorted_list[-1]
g = sorted_list[-2]
b = sorted_list[-3]

max_r = n // r

for i in range(max_r+1):
    tmp = n - (r * i)
    max_g = tmp // g
    for j in range(max_g+1):
        if  (tmp - (g * j))%b == 0:
            ans = ans + 1

print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
n, m = map(int, input().split())
a=[]
b=[]
for i in range(n):
    ab=list(map(int, input().split()))
    a.append(ab[0])
    b.append(ab[1])

total_cost = 0
while(1):
    new_shop = a.index(min(a))
    new_drinks = b[new_shop]
    if m-new_drinks>0:
        total_cost = total_cost + a[new_shop] * b[new_shop]
        m=m-new_drinks
        a.pop(new_shop)
        b.pop(new_shop)
    else:
        total_cost = total_cost + a[new_shop] * m
        break
print(total_cost)

Fixed submission:
from numpy import argsort
n, m = map(int, input().split())
a=[]
b=[]
for i in range(n):
    ab=list(map(int, input().split()))
    a.append(ab[0])
    b.append(ab[1])

total_cost = 0
order = argsort(a)
for i in range(len(a)):
    new_shop = order[i]
    new_drinks = b[new_shop]
    if m-new_drinks>0:
        total_cost = total_cost + a[new_shop] * b[new_shop]
        m=m-new_drinks
    else:
        total_cost = total_cost + a[new_shop] * m
        break
print(total_cost)
Buggy python submission (verdict: Runtime Error):
# -*- coding: utf-8 -*-
a, b, k = map(int, input().split())
if a > b:
    t = a
    a = b
    b = t
# 0<a<b<100
fact = []
for i in range(1,a+1,):
    if a%i==0 and b%i==0:
        count = count + 1
        fact.append(i)
print(fact[-k])

Fixed submission:
# -*- coding: utf-8 -*-
a, b, k = map(int, input().split())
if a > b:
    t = a
    a = b
    b = t
# 0<a<b<100
fact = []
for i in range(1,a+1,):
    if a%i==0 and b%i==0:
        fact.append(i)
print(fact[-k])
Buggy python submission (verdict: Runtime Error):
import math
import decimal
a, b, c = map(int, input().split())
print('Yes' if ( 2 * Decimal(a*b).sqrt() + a + b - c < 0 ) else 'No')

Fixed submission:
import math
from decimal import *
a, b, c = map(int, input().split())
print('Yes' if ( 2 * Decimal(a*b).sqrt() + a + b - c < 0 ) else 'No')
Buggy python submission (verdict: Runtime Error):
N_A_B = list(map(int, input().split()))
ball = ""
num = 10 ** 100
for i in range(num):
  if (len(ball) >= N_A_B[0]):
    break
  ball += "A" * N_A_B[1]
  if (len(ball) >= N_A_B[0]):
    break
  ball += "B" * N_A_B[2]
  if (len(ball) > N_A_B[0]):
    break

print(ball[:N_A_B[0]].count("A"))


Fixed submission:
NAB = list(map(int, input().split()))
N = NAB[0]
A = NAB[1]
B = NAB[2]
ans = ( N//(A+B)) * A

if N%(A+B) <= A:
  ans += N%(A+B)
else:
  ans += A

print(ans)

Buggy python submission (verdict: Runtime Error):
N_A_B = list(map(int, input().split()))
ball = ""
for i in range(10**100):
  ball += "A" * N_A_B[1]
  if (len(ball) >= N_A_B[0]):
    break
  ball += "B" * N_A_B[2]
  if (len(ball) >= N_A_B[0]):
    break

print(ball[:N_A_B[0]].count("A"))


Fixed submission:
NAB = list(map(int, input().split()))
N = NAB[0]
A = NAB[1]
B = NAB[2]
ans = ( N//(A+B)) * A

if N%(A+B) <= A:
  ans += N%(A+B)
else:
  ans += A

print(ans)

Buggy python submission (verdict: Runtime Error):
N_A_B = list(map(int, input().split()))
ball = ""
for i in range(10**100):
  ball += "A" * N_A_B[1]
  ball += "B" * N_A_B[2]
  if (len(ball) > N_A_B[0]):
    break

print(ball[:N_A_B[0]].count("A"))


Fixed submission:
NAB = list(map(int, input().split()))
N = NAB[0]
A = NAB[1]
B = NAB[2]
ans = ( N//(A+B)) * A

if N%(A+B) <= A:
  ans += N%(A+B)
else:
  ans += A

print(ans)
Buggy python submission (verdict: Runtime Error):
import math
def create_cricle(r):
  return r**2*math.pi
if __name__ == '__main__':
  print(int(create_cricle(input())/create_cricle(1)))

Fixed submission:
print(int(int(input())**2))
Buggy python submission (verdict: Runtime Error):
# cards = [input() for _ in range(3)]
dict = {'a':0, 'b':1, 'c':2}
inv = ['A', 'B', 'C']
turn = 'a'
game = True
while game:
    turn = cards[dict[turn]][0]
    cards[dict[turn]] = cards[dict[turn]][1:]
    for i in range(3):
        if cards[i] == '':
            print(inv[i])
            game = False

Fixed submission:
cards = [input() for _ in range(3)]
dict = {'a':0, 'b':1, 'c':2}
inv = ['A', 'B', 'C']
turn = 'a'
game = True
while game:
    if cards[dict[turn]] == '':
        print(inv[dict[turn]])
        game = False
    else:
        next_turn = cards[dict[turn]][0]
        cards[dict[turn]] = cards[dict[turn]][1:]
        turn = next_turn
    # print(turn, cards)
Buggy python submission (verdict: Time Limit Exceeded):
import sys

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

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

num_flag = [0 for i in range(n)]

for item in a:
    num_flag[item - 1] += 1

while 0 in num_flag:
    num_flag.remove(0)

num_flag.sort()

cnt = 0
while len(num_flag) > k:
    cnt += num_flag[0]
    num_flag.pop(0)

print("{}".format(cnt))

Fixed submission:
import sys

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

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

num_flag = [0 for i in range(n)]

for item in a:
    num_flag[item - 1] += 1

# while 0 in num_flag:
#     num_flag.remove(0)

# num_flag.sort()

# cnt = 0
# while len(num_flag) > k:
#     print(len(num_flag))
#     cnt += num_flag[0]
#     num_flag.pop(0)

num_flag.sort(reverse=True)

cnt = 0
for i in range(k):
    cnt += num_flag[i]

print("{}".format(n - cnt))
Buggy python submission (verdict: Runtime Error):
import sys

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

bucket = [0 for i in range(max(a) + 1)]

for i in range(n):
    bucket[a[i]] += 1

sum_three_num = []
for i in range(1, len(bucket) - 1):
    sum_three_num.append(bucket[i-1] + bucket[i] + bucket[i+1])

print(max(sum_three_num))

Fixed submission:
import sys

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

bucket = [0 for i in range(max(a) + 1)]

for i in range(n):
    bucket[a[i]] += 1


sum_three_num = []

if len(bucket) == 1:
    sum_three_num.append(bucket[0])
elif len(bucket) == 2:
    sum_three_num.append(bucket[0] + bucket[1])
else:
    for i in range(1, len(bucket) - 1):
        sum_three_num.append(bucket[i-1] + bucket[i] + bucket[i+1])

print(max(sum_three_num))
Buggy python submission (verdict: Runtime Error):
vacationDayCount, homeworkCount = map(int, input().split())
requiredDayList = list(map(int, input.split()))

playableDayCount = vacationDayCount - sum(requiredDayList)

if(playableDayCount >= 0):
    print(playableDayCount)
else:
    print(-1)

Fixed submission:
vacationDayCount, homeworkCount = map(int, input().split())
requiredDayList = list(map(int, input().split()))

playableDayCount = vacationDayCount - sum(requiredDayList)

if(playableDayCount >= 0):
    print(playableDayCount)
else:
    print(-1)
Buggy python submission (verdict: Time Limit Exceeded):





N, K = map(int, input().split())

# 10^100はでかすぎるので和の第1項(10^100の整数倍、巨大)と第2項(端数)が干渉することはない

# ありうる和が何通りか
possible = 0

# 選んだ数値の個数がselectedのとき
for selected in range(K, (N + 1) + 1):
    # 第2項の最小値は数列のうち先頭selected個をとったもの
    minFraction = sum(range(selected))

    # 第2項の最大値は数列のうち末尾selected個をとったもの
    maxFraction = sum(range(N + 1 - selected, N + 1))

    # 最小値と最大値の間の数は全てありえるので個数は
    possible += maxFraction - minFraction + 1

print(possible)



Fixed submission:
N, K = map(int, input().split())

# 10^100はでかすぎるので和の第1項(10^100の整数倍、巨大)と第2項(端数)が干渉することはない

#求める場合の数。ありうる和が全部で何通りか
possible = 0

# firstからlastまでの和を速く計算する
def sumRange(first, last):
    count = last - first + 1
    return int((first + last) * count / 2)

# 選んだ数値の個数がselectedのとき
# 第1項の係数はselectedになるので、選んだ個数が違えば和も必ず異なる
# よって、選んだ個数ごとに分けて考えてよい
for selected in range(K, (N + 1) + 1):
    # 最小値は数列のうち先頭selected個をとったもの
    minFraction = sumRange(0, selected - 1)

    # 最大値は数列のうち末尾selected個をとったもの
    maxFraction = sumRange(N - selected + 1, N)

    # 最小値と最大値の間の数は全てありえるので個数は
    possible += maxFraction - minFraction + 1

# modで小さくして答えろとの指示
print(possible % (10 **9 + 7))
Buggy python submission (verdict: Time Limit Exceeded):
k = int(input())

ans = 0
def gcd(x,y):
    while y:
        x, y = y, x % y
    return x

for i in range(1,k+1):
    for j in range(1,k+1):
        for s in range(1,k+1):
            ans += gcd(gcd(i,j),s)

print(ans)

Fixed submission:
k = int(input())

ans = 0
def gcd(x,y):
    while y:
        x, y = y, x % y
    return x

for i in range(1,k+1):
    for j in range(1,k+1):
        for s in range(1,k+1):
            ans += gcd(gcd(i,j),s)

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

ret = 0
for i in range(n):
    f = True
    for j in range(i):
        f = f and (p[i] <= p[j])
        if not f:
            break
    if f:
        ret +=1

print(ret)

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

mn = p[0]
ret = 0
for i in range(n):
    if mn >= p[i]:
        ret += 1
    mn = min(mn, p[i])
print(ret)

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

ret = 0
for i in range(n):
    f = True
    for j in range(i):
        f = f and (p[i] <= p[j])
    if f:
        ret +=1

print(ret)

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

mn = p[0]
ret = 0
for i in range(n):
    if mn >= p[i]:
        ret += 1
    mn = min(mn, p[i])
print(ret)
Buggy python submission (verdict: Runtime Error):
S = input()
d = {"SUN":6,
     "TUE":5,
     "WED":4,
     "THU":3,
     "FRI":2,
     "SAT":1}
print(d[S])

Fixed submission:
S = input()
d = {"SUN":7,
     "MON":6,
     "TUE":5,
     "WED":4,
     "THU":3,
     "FRI":2,
     "SAT":1}
print(d[S])
Buggy python submission (verdict: Runtime Error):
import math
ans = math.inf
n = int(input())
a = list(range(1,math.ceil(math.sqrt(n))+1))
for i in a:
    s = n/i
    if s==int(s):
        ans = min(i+s-2,ans)
print(int(ans))

Fixed submission:
import math
import sys
ans = 9223372036854775807
n = int(input())
a = list(range(1,math.ceil(math.sqrt(n))+1))
for i in a:
    s = n/i
    if s==int(s):
        ans = min(i+s-2,ans)
print(int(ans))
Buggy python submission (verdict: Runtime Error):
def splitter(type,input):
    return list(map(lambda x:type(x),input.split()))

s1 = splitter(int,input())
N = s1[0]
K = s1[1]
Q = s1[2]

ar = [0] * N
for i in range(Q):
    ar[int(input())] += 1
for j in range(N):
    if K-Q+ar[j] <= 0:
        print("No")
    else:
        print("Yes")

Fixed submission:
def splitter(type,input):
    return list(map(lambda x:type(x),input.split()))

s1 = splitter(int,input())
N = s1[0]
K = s1[1]
Q = s1[2]

ar = [0] * N
for i in range(Q):
    ar[int(input())-1] += 1
for j in range(N):
    if K-Q+ar[j] <= 0:
        print("No")
    else:
        print("Yes")

Buggy python submission (verdict: Runtime Error):
def splitter(type,input):
    return list(map(lambda x:type(x),input.split()))

s1 = splitter(int,input())
N = s1[0]
K = s1[1]
Q = s1[2]

ar = [0] * N
for i in len(range(Q)):
    ar[int(input())] += 1
for j in len(range(N)):
    if K-Q+ar[j] <= 0:
        print("No")
    else:
        print("Yes")



Fixed submission:
def splitter(type,input):
    return list(map(lambda x:type(x),input.split()))

s1 = splitter(int,input())
N = s1[0]
K = s1[1]
Q = s1[2]

ar = [0] * N
for i in range(Q):
    ar[int(input())-1] += 1
for j in range(N):
    if K-Q+ar[j] <= 0:
        print("No")
    else:
        print("Yes")
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())

alist = input().split(" ")

aint = []

for i in range(n-1):
    aint.append(int(alist[i]))

for i in range(1, n+1):
    co = aint.count(i)
    print(co)

Fixed submission:
n = int(input())

alist = input().split(" ")

aint = []

sumlist = []

for i in range(n-1):
    aint.append(int(alist[i]))

for i in range(n):
    sumlist.append(0)

for i in aint:
    sumlist[i-1] = sumlist[i-1]+1

for i in sumlist:
    print(i)

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

alist = input().split(" ")

for i in range(1,n+1):
    sum = 0
    for j in range(n-1):
        if int(alist[j]) == i:
            sum = sum + 1
    print(sum)


Fixed submission:
n = int(input())

alist = input().split(" ")

aint = []

sumlist = []

for i in range(n-1):
    aint.append(int(alist[i]))

for i in range(n):
    sumlist.append(0)

for i in aint:
    sumlist[i-1] = sumlist[i-1]+1

for i in sumlist:
    print(i)
Buggy python submission (verdict: Runtime Error):
l = int(input())

vol = []

for x in range(1, l):
    for y in range(1, l-x):
        z = l - x -y
        t = x*y*z
        vol.append(t)

print(max(vol))


Fixed submission:
l = float(input())

x = l/3

print(x**3)