Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Runtime Error):
n = int(input())
a = []
a = list(map(int, input().strip().split()))


all_sum = 0

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

ans = 1 / all_sum

print(ans)

Fixed submission:
a = int(input())
s = input()

if a >= 3200:
  print(s)

else:
  print("red")

Buggy python submission (verdict: Runtime Error):
n = int(input())
a = []
a = list(map(int, input().strip().split()))

all_sum = 0

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

ans = 1 / all_sum

print(ans)


Fixed submission:
a = int(input())
s = input()

if a >= 3200:
  print(s)

else:
  print("red")
Buggy python submission (verdict: Runtime Error):
i = list(map(int, input().split()))
n = i[0]
k = i[1]

if n >= 1 and n <= 100 and k >= 1 and k <= 100:
  if n > 2:
    if n % 2 == 1:
      if n / k >= 1:
        print("YES")
      elif n % k == 1:
        print("YES")
      else:
        print("NO")
    else:
      if n / k >= 2:
        print("YES")
      elif n % k == 0:
        print("YES")
      else:
        print("NO")
  else:
    print("NO")
else:

Fixed submission:
i = list(map(int, input().split()))
n = i[0]
k = i[1]

if n >= 1 and k <= 100:
  if n == 1 and k == 1:
    print("YES")
  elif n > k:
    if n % 2 == 1:
      if int(n / k) >= 2:
        print("YES")
      elif int(n / k) == 1 and (int(n % k) == k - 1):
        print("YES")
      else:
        print("NO")
    else:
      if int(n / k) >= 2:
        print("YES")
      elif n % k == 0:
        print("YES")
      else:
        print("NO")
  else:
    print("NO")

Buggy python submission (verdict: Runtime Error):
i = list(map(int, input().split()))
n = i[0]
k = i[1]

if n >= 1 and n <= 100 and k >= 1 and k <= 100:
  if n > 2:
    if n > k - 2:
      if n % 2 == 1:
        if n / k >= 1:
          print("YES")
        elif n % k == 1:
          print("YES")
        else:
          print("NO")
      elif:
        if n / k >= 2:
          print("YES")
        elif n % k == 0:
          print("YES")
        else:
          print("NO")
      else:
        print("NO")
    else:
      print("NO")
  else:
    print("NO")
else:
  print("NO")


Fixed submission:
i = list(map(int, input().split()))
n = i[0]
k = i[1]

if n >= 1 and k <= 100:
  if n == 1 and k == 1:
    print("YES")
  elif n > k:
    if n % 2 == 1:
      if int(n / k) >= 2:
        print("YES")
      elif int(n / k) == 1 and (int(n % k) == k - 1):
        print("YES")
      else:
        print("NO")
    else:
      if int(n / k) >= 2:
        print("YES")
      elif n % k == 0:
        print("YES")
      else:
        print("NO")
  else:
    print("NO")
Buggy python submission (verdict: Runtime Error):
n = int(input())
l = list(map(int, input().split()))
max_num = 0
max_index = 0
total = 0

for i in range(n):
  if max_num < l[i]:
    max_num = l[i]
    max_index = i


l.pop(max_index)


for i in range(n - 1):
  total += l[i]

if total > max_num: print("Yes")
else: print("No")





Fixed submission:
i = list(map(int, input().split()))
ans = 0.0

if 1 <= i[0] and i[0] <= 100:
  if 1 <= i[1] and i[1] <= 100:
    ans = i[0] / i[1]
    print(ans)

Buggy python submission (verdict: Runtime Error):
t = int(input())
x = int(input())
ans = 0.0

if 1 <= t and t <= 100:
  if 1 <= x and x <= 100:
    answer = t / x
    print(ans)


Fixed submission:
i = list(map(int, input().split()))
ans = 0.0

if 1 <= i[0] and i[0] <= 100:
  if 1 <= i[1] and i[1] <= 100:
    ans = i[0] / i[1]
    print(ans)

Buggy python submission (verdict: Runtime Error):
t = int(input())
x = int(input())
answer = 0.0

if 1 <= t and t <= 100:
  if 1 <= x and x <= 100:
    answer = t / x
    print(answer)


Fixed submission:
i = list(map(int, input().split()))
ans = 0.0

if 1 <= i[0] and i[0] <= 100:
  if 1 <= i[1] and i[1] <= 100:
    ans = i[0] / i[1]
    print(ans)
Buggy python submission (verdict: Runtime Error):
def resolve():
    '''
    code here
    '''
    N = int(input())
    stones = input()

    w = []
    r = []

    for i in range(N):
        if stones[i] == 'W':
            w.append(i)
        else:
            r.append(i)

    res = 0
    for i, val in enumerate(w):
        if val <= r[-1*(i+1)]:
            res += 1
        else:
            break
    print(res)

if __name__ == "__main__":
    resolve()


Fixed submission:
def resolve():
    '''
    code here
    '''
    N = int(input())
    stones = input()

    w = []
    r = []

    for i in range(N):
        if stones[i] == 'W':
            w.append(i)
        else:
            r.append(i)

    if len(w) != 0 and len(r) != 0:
        res = 0
        for i, val in enumerate(w):
            if val <= r[-1*(i+1)]:
                res += 1
            else:
                break
        print(res)
    else:
        print(0)

if __name__ == "__main__":
    resolve()
Buggy python submission (verdict: Time Limit Exceeded):
def resolve():
    '''
    code here
    '''
    N, K = [int(item) for item in input().split()]
    As = [int(item) for item in input().split()]

    all_prod_list = [As[0]]
    for i in range(1,N):
        all_prod_list.append(all_prod_list[i-1]*As[i])

    
    is_flag = False
    prev_score = all_prod_list[K-1]
    for i in range(K,N):
        if prev_score < prev_score // As[i - K] * As[i]:
            print('Yes')
        else:
            print('No')

if __name__ == "__main__":
    resolve()


Fixed submission:
def resolve():
    '''
    code here
    '''
    N, K = [int(item) for item in input().split()]
    As = [int(item) for item in input().split()]

    for i in range(K,N):
        if 1 < As[i] / As[i - K]:
            print('Yes')
        else:
            print('No')
        

if __name__ == "__main__":
    resolve()
Buggy python submission (verdict: Time Limit Exceeded):
def resolve():
    '''
    code here
    '''
    import math
    import collections
    N = int(input())

    A_list = [int(item) for item in input().split()]    
    A_list.sort()

    cnt = 0

    while len(A_list) > 0:
        # print(A_list)
        cnt += 1
        temp = A_list[0]
        del A_list[0]

        is_same = False
        for item in A_list[:]:
            if item == temp:
                is_same = True
            if item % temp == 0:
                A_list.remove(item)
        
        if is_same:
            cnt -= 1

    print(cnt)





if __name__ == "__main__":
    resolve()

Fixed submission:
def resolve():
    '''
    code here
    '''
    import collections
    N = int(input())
    A_list = [int(item) for item in input().split()]

    A_list.sort()


    dp = [0 for item in range(A_list[-1]+1)]
    for item in A_list:

        temp = item
        while temp <= A_list[-1]:
            dp[temp] += 1
            temp += item

    cnt = 0
    for item in A_list:
        if dp[item] == 1:
            cnt += 1
    print(cnt)

if __name__ == "__main__":
    resolve()

Buggy python submission (verdict: Time Limit Exceeded):
def resolve():
    '''
    code here
    '''
    import math
    N = int(input())
    A_list = [int(item) for item in input().split()]
    A_list.sort()

    cnt = 0

    while len(A_list) > 0:
        # print(A_list)
        cnt += 1
        temp = A_list[0]
        # print(temp)
        del A_list[0]

        is_same = False
        for item in A_list[:]:
            if item == temp:
                is_same = True
            if item % temp == 0:
                A_list.remove(item)
        
        if is_same:
            cnt -= 1

    print(cnt)




if __name__ == "__main__":
    resolve()


Fixed submission:
def resolve():
    '''
    code here
    '''
    import collections
    N = int(input())
    A_list = [int(item) for item in input().split()]

    A_list.sort()


    dp = [0 for item in range(A_list[-1]+1)]
    for item in A_list:

        temp = item
        while temp <= A_list[-1]:
            dp[temp] += 1
            temp += item

    cnt = 0
    for item in A_list:
        if dp[item] == 1:
            cnt += 1
    print(cnt)

if __name__ == "__main__":
    resolve()
Buggy python submission (verdict: Time Limit Exceeded):
def resolve():
    '''
    code here
    '''
    N = int(input())
    A_list = [int(item) for item in input().split()]

    is_zero = False
    res = 1

    for item in A_list:
        res *= item

        if item == 0:
            is_zero = True
            break
    else:
        if res > 10 ** 18:
            print(-1)
        else:
            print(res)

    if is_zero:
        print(0)

if __name__ == "__main__":
    resolve()


Fixed submission:
def resolve():
    '''
    code here
    '''
    N = int(input())
    A_list = [int(item) for item in input().split()]

    is_zero = False
    is_over = False
    res = 1

    for item in A_list:
        if item == 0:
            is_zero = True
            break

    if is_zero:
        print(0)
    else:
        for item in A_list:
            res *= item

            if res > 10 ** 18:
                is_over = True
                break
        else:
            print(res)

        if is_over:
            print(-1)

if __name__ == "__main__":
    resolve()

Buggy python submission (verdict: Time Limit Exceeded):
def resolve():
    '''
    code here
    '''
    N = int(input())
    A_list = [int(item) for item in input().split()]

    res = 1

    for item in A_list:
        res *= item

    if res > 10 ** 18:
        print(-1)
    else:
        print(res)

if __name__ == "__main__":
    resolve()


Fixed submission:
def resolve():
    '''
    code here
    '''
    N = int(input())
    A_list = [int(item) for item in input().split()]

    is_zero = False
    is_over = False
    res = 1

    for item in A_list:
        if item == 0:
            is_zero = True
            break

    if is_zero:
        print(0)
    else:
        for item in A_list:
            res *= item

            if res > 10 ** 18:
                is_over = True
                break
        else:
            print(res)

        if is_over:
            print(-1)

if __name__ == "__main__":
    resolve()
Buggy python submission (verdict: Runtime Error):
def resolve():
    '''
    code here
    '''
    import collections
    N, K = [int(item) for item in input().split()]
    A_list = [int(item) for item in input().split()]

    bit_k = bin(K)[2:]

    telepo_list = collections.deque([A_list])

    for _ in range(len(bit_k)-1):
        temp_list = telepo_list[-1]
        new_telep = collections.deque([])
        for i in temp_list:
            new_telep.append(temp_list[i-1])

        telepo_list.append(new_telep)

    # print(telepo_list)

    goto = 1
    for i in range(len(bit_k)):
        temp_list = telepo_list.popleft()
        if ((K >> i) & 1): 
            goto = temp_list[goto -1]
            # print(i, goto)

    print(goto)

if __name__ == "__main__":
    resolve()


Fixed submission:
def resolve():
    '''
    code here
    '''
    S = input()
    T = input()

    if len(T) == len(S) + 1 and S == T[:-1]:
        print('Yes')
    else:
        print('No')


if __name__ == "__main__":
    resolve()
Buggy python submission (verdict: Time Limit Exceeded):
def resolve():
    '''
    code here
    '''
    import sys
    from functools import lru_cache
    sys.setrecursionlimit(10**3)
    K = int(input())

    @lru_cache(maxsize=10**3)
    def gcd(a, b):
        if b == 0:
            return a
        else:
            return gcd(b, a%b)


    def gcd3(a, b, c):
        temp = gcd(a,b)
        return gcd(temp, c)
    
    res = 0
    for k in range(1,K+1):
        for j in range(1,K+1):
            for i in range(1, K+1):
                res += gcd3(k, j, i)

    print(res)


if __name__ == "__main__":
    resolve()


Fixed submission:
def resolve():
    '''
    code here
    '''

    K = int(input())

    import math
    
    temp_list = []
    for k in range(1,K+1):
        for j in range(1,K+1):
            temp_list.append(math.gcd(k,j))

    res = 0
    for item in temp_list:
        for i in range(1,K+1):
            res += math.gcd(item, i)

    print(res)


if __name__ == "__main__":
    resolve()
Buggy python submission (verdict: Time Limit Exceeded):
def resolve():
    '''
    code here
    '''

    import collections
    import math

    N = int(input())
    A_list = [int(item) for item in input().split()]
    origin_dict = collections.Counter(A_list)

    memo = [-1 for _ in range(N+1)]

    for i in range(N):
        temp_num = A_list[i]

        if memo[temp_num] == -1:
            temp_dict = origin_dict.copy()
            temp_dict[temp_num] -= 1
            # print(temp_dict)
            res = 0
            for j in temp_dict.values():
                res += j*(j-1)//2
            print(res)
            memo[temp_num] = res
        else:
            print(memo[temp_num])

    

if __name__ == "__main__":
    resolve()


Fixed submission:
def resolve():
    import collections

    N = int(input())
    A_list = [int(item) for item in input().split()]
    origin_dict = collections.Counter(A_list)

    twopair_in_N = 0
    for i in origin_dict.values():
        twopair_in_N += i*(i-1)//2

    for j in range(N):
        deff = origin_dict[A_list[j]] -1

        print(twopair_in_N - deff)
    

if __name__ == "__main__":
    resolve()
Buggy python submission (verdict: Runtime Error):
def resolve():
    '''
    code here
    '''
    H, W = [int(item) for item in input().split()]

    if H == 1 or W == 1:
        res = 1
    elif H % 2 == 1 and W % 2 == 1:
        res += H * W // 2 +1
    else:
        res = H * W // 2

    print(res)
if __name__ == "__main__":
    resolve()


Fixed submission:
def resolve():
    '''
    code here
    '''
    H, W = [int(item) for item in input().split()]

    if H == 1 or W == 1:
        res = 1
    elif H % 2 == 1 and W % 2 == 1:
        res = H * W // 2 +1
    else:
        res = H * W // 2

    print(res)
if __name__ == "__main__":
    resolve()
Buggy python submission (verdict: Time Limit Exceeded):
S = input()
Q = int(input())

query_list = [input().split() for _ in range(Q)]

for query in query_list:
    if query[0] == '1':
        S = S[::-1]
    else:
        if query[1] == '1':
            S = query[2] + S
        else:
            S = S + query[2]

print(S)


Fixed submission:
import collections
S = input()
Q = int(input())

query_list = [input().split() for _ in range(Q)]

T_cnt_list = collections.deque([0])
left = ''
right = ''

for i, query in enumerate(query_list):
    if query[0] == '1':
        T_cnt_list.append(1+T_cnt_list[-1])

    else:
        T_cnt_list.append(T_cnt_list[-1])

        if query[1] == '1' and T_cnt_list[i+1]%2 == 0:
            left = query[2] + left

        elif query[1] == '1' and T_cnt_list[i+1]%2 == 1:
            right = right + query[2]

        elif query[1] == '2' and T_cnt_list[i+1]%2 == 0:
            right = right + query[2]

        elif query[1] == '2' and T_cnt_list[i+1]%2 == 1:
            left = query[2] + left

if T_cnt_list[-1]%2 == 0:
    print(left + S + right)
else:
    print(right[::-1] + S[::-1] + left[::-1])
Buggy python submission (verdict: Time Limit Exceeded):
import collections as cl
import sys
input = sys.stdin.readline

N = int(input().strip())
S_list = [input().strip() for _ in range(N)]
# print(S_list)
c = cl.Counter(S_list)
# print(c)

max_list = sorted([kv[0] for kv in c.items() if kv[1] == max(c.values())])
print(*max_list)

Fixed submission:
import collections as cl
import sys
input = sys.stdin.readline

N = int(input().strip())
S_list = [input().strip() for _ in range(N)]
# print(S_list)
c = cl.Counter(S_list)
# print(c)
max_num = max(c.values())

max_list = sorted([kv[0] for kv in c.items() if kv[1] == max_num])
print(*max_list)
Buggy python submission (verdict: Runtime Error):
N = int(input())
num_list = [[int(item) for item in input().split()] for _ in range(N)]
num_list.sort(key=lambda x: x[0]) 
# print(num_list)

temp_max = num_list[0][0] + num_list[0][1]
cnt = 1

for x, l in num_list:
    if x - l >= temp_max:
        cnt += 1
        temp_max = x + l
        # print(x, l, cnt, temp_max)


temp_max2 = num_list[1][0] + num_list[1][1]
cnt2 = 1

for x, l in num_list[1:]:
    if x - l >= temp_max2:
        cnt2 += 1
        temp_max2 = x + l
        # print(x, l, cnt, temp_max)

if cnt2 > cnt:
    cnt, cnt2 = cnt2, cnt
print(cnt)

Fixed submission:
N = int(input())
num_list = [[int(item) for item in input().split()] for _ in range(N)]
num_list2 = []
for x, l in num_list:
    num_list2.append([x-l, x+l])

num_list2.sort(key=lambda x: x[1]) 
# print(num_list2)

temp_max = num_list2[0][1]
cnt = 1

for l, h in num_list2:
    if l >= temp_max:
        cnt += 1
        temp_max = h

print(cnt)
Buggy python submission (verdict: Time Limit Exceeded):
import itertools as it

num = int(input())

item_number = num//100

res_list = []
candi_list = list(it.combinations_with_replacement([100, 101, 102, 103, 104, 105], item_number))
candi_ans_list = [sum(item) for item in candi_list]

if num in candi_ans_list:
    print(1)
else:
    print(0)

Fixed submission:
line = input()

if int(line) >= 100:
    num = int(line[-2:])
    item_number = int(line[:-2])



    res_list = []
    a = 5
    while True:
        if num == 0:
            break
        for _ in range(num//a):
            res_list.append(a)

        num = num % a

        if 1<= num <= 4:
            res_list.append(num)
            break


    # print(res_list)

    if len(res_list) > item_number:
        print(0)
    else:
        print(1)

else:
    print(0)

Buggy python submission (verdict: Runtime Error):
line = input()
num = int(line[-2:])
item_number = int(line[:-2])



res_list = []
a = 5
while True:
    for _ in range(num//a):
        res_list.append(a)

    num = num % a

    if num <= 4:
        res_list.append(num)
        break

# print(res_list)

if len(res_list) > item_number:
    print(0)
else:
    print(1)

Fixed submission:
line = input()

if int(line) >= 100:
    num = int(line[-2:])
    item_number = int(line[:-2])



    res_list = []
    a = 5
    while True:
        if num == 0:
            break
        for _ in range(num//a):
            res_list.append(a)

        num = num % a

        if 1<= num <= 4:
            res_list.append(num)
            break


    # print(res_list)

    if len(res_list) > item_number:
        print(0)
    else:
        print(1)

else:
    print(0)

Buggy python submission (verdict: Runtime Error):
line = input()
num = int(line[-2:])
item_number = int(line[:-2])


res_list = []
a = 5
while True:
    num = num - a
    res_list.append(a)
    if num < a:
        a -= 1

    if num == 0 or a == 0:
        break

if len(res_list) > item_number:
    print(0)
else:
    print(1)


Fixed submission:
line = input()

if int(line) >= 100:
    num = int(line[-2:])
    item_number = int(line[:-2])



    res_list = []
    a = 5
    while True:
        if num == 0:
            break
        for _ in range(num//a):
            res_list.append(a)

        num = num % a

        if 1<= num <= 4:
            res_list.append(num)
            break


    # print(res_list)

    if len(res_list) > item_number:
        print(0)
    else:
        print(1)

else:
    print(0)
Buggy python submission (verdict: Time Limit Exceeded):
import itertools
num = int(input())
num_list = [int(item) for item in input()]

res_list = itertools.combinations(num_list,3)

print(len((set(res_list))))

Fixed submission:
def resolve():
    '''
    code here
    '''
    N = int(input())
    S = input()

    cnt = 0
    for i in range(1000):
        words = '{:0>3}'.format(i)
        k = 0
        for item in S:
            if item == words[k]:
                # print(item, words[k])
                k += 1

            if k == 3:
                cnt +=1
                break

    print(cnt)



if __name__ == "__main__":
    resolve()
Buggy python submission (verdict: Runtime Error):
N = int(input())
A_list = [int(item) for item in input().split()]

all_sum = sum(A_list)

F_sum_list = []

for j in range(1,N):
    F = A_list[:j]
    F_sum = sum(F)
    F_sum_list.append(F_sum)
    if F_sum >= all_sum // 2:
        break

mini = min(all_sum - 2 * F_sum_list[-2], -1*(all_sum - 2 * F_sum_list[-1]))
print(mini)

Fixed submission:
x, y = [int(item) for item in input().split()]

res = 0

if x == 1:
    res += 300000
elif x == 2:
    res += 200000
elif x == 3:
    res += 100000

if y == 1:
    res += 300000
elif y == 2:
    res += 200000
elif y == 3:
    res += 100000

if x == 1 and y == 1:
    res += 400000

print(res)

Buggy python submission (verdict: Runtime Error):
N = int(input())
A_list = [int(item) for item in input().split()]

mini = 2020202020 * 200000
for j in range(1,N):
    F, B = A_list[:j], A_list[j:]
    delta = abs(sum(F) - sum(B))
    if delta <= mini:
        mini = delta

print(mini)

Fixed submission:
x, y = [int(item) for item in input().split()]

res = 0

if x == 1:
    res += 300000
elif x == 2:
    res += 200000
elif x == 3:
    res += 100000

if y == 1:
    res += 300000
elif y == 2:
    res += 200000
elif y == 3:
    res += 100000

if x == 1 and y == 1:
    res += 400000

print(res)

Buggy python submission (verdict: Runtime Error):
X, Y = [int(item) for item in input().split()]

res = 0

if X == 1:
    res += 300_000
elif X == 2:
    res += 200_000
elif X == 3:
    res += 100_000

if Y == 1:
    res += 300_000
elif Y == 2:
    res += 200_000
elif Y == 3:
    res += 100_000

if X ==1 and Y == 1:
    res += 400_000

print(res)

Fixed submission:
x, y = [int(item) for item in input().split()]

res = 0

if x == 1:
    res += 300000
elif x == 2:
    res += 200000
elif x == 3:
    res += 100000

if y == 1:
    res += 300000
elif y == 2:
    res += 200000
elif y == 3:
    res += 100000

if x == 1 and y == 1:
    res += 400000

print(res)

Buggy python submission (verdict: Runtime Error):
X, Y = [int(item) for item in input().split()]

res = 0

if X == 1:
    res += 300_000
elif X == 2:
    res += 200_000
elif X == 3:
    res += 100_000

if Y == 1:
    res += 300_000
elif Y == 2:
    res += 200_000
elif Y == 3:
    res += 100_000

if X ==1 and Y == 1:
    res += 400_000

print(res)

Fixed submission:
x, y = [int(item) for item in input().split()]

res = 0

if x == 1:
    res += 300000
elif x == 2:
    res += 200000
elif x == 3:
    res += 100000

if y == 1:
    res += 300000
elif y == 2:
    res += 200000
elif y == 3:
    res += 100000

if x == 1 and y == 1:
    res += 400000

print(res)
Buggy python submission (verdict: Runtime Error):
def resolve():
    '''
    code here
    '''
    import collections
    N = int(input())
    D = [int(item) for item in input().split()]

    d_dict = collections.Counter(D)

    if D[0] != 0:
        print(0)
    else:
        cnt = 1
        for i, v in d_dict.items():
            if i >0 :
                if v > 2:
                    cnt *= (v-1)*(v-2)
                elif v == 2:
                    cnt *=  2
                elif v == 1:
                    cnt *= 1

    print(cnt)

if __name__ == "__main__":
    resolve()


Fixed submission:
def resolve():
    '''
    code here
    '''
    import collections
    N = int(input())
    D = [int(item) for item in input().split()]
    d_dict = collections.Counter(D)

    cnt = 0
    if D[0] != 0:
        pass
    else:
        cnt = 1
        for i in D[1:]:
            cnt *= d_dict[i-1]
            cnt %= 998244353


    print(cnt % 998244353)

if __name__ == "__main__":
    resolve()
Buggy python submission (verdict: Runtime Error):
from bisect import bisect_left
 
N = int(input())
Lmat = [int(n) for n in input().split()]
Lmat.sort()
 
sum = 0

for i in range(N):
    for j in range(i + 1, N):
        sum += bisect_left(Lmat, Lmat[i]+Lmat[j]) - (j + 1)
print(sum)

Fixed submission:
A, B= [int(item) for item in input().split()]

temp_res = A - B * 2

if temp_res < 0:
    res = 0
else:
    res = temp_res

print(res)