Harryxun/GPT-100-sft-dataset huggingface dataset:
Problem p03140 (python)

Fixed submission:
n = int(input())
s = [input() for _ in range(3)]
ans = 2*n
for i in range(n):
  if s[0][i] == s[1][i]: ans -= 1
  if s[0][i] == s[2][i]: ans -= 1
  if s[2][i] == s[1][i]: ans -= 1
  if s[0][i] == s[1][i] and s[2][i] == s[1][i] : ans += 1
print(ans)

Buggy submission (verdict: Runtime Error):
n = int(input())
s = [input() in range(3)]
ans = 2*n
for i in range(n):
  if s[0][i] == s[1][i]: ans -= 1
  if s[0][i] == s[2][i]: ans -= 1
  if s[2][i] == s[1][i]: ans -= 1
  if s[0][i] == s[1][i] and s[2][i] == s[1][i] : ans += 1
print(ans)
Problem p03149 (python)

Fixed submission:
#!/usr/bin/env python3
a = list(map(int,input().split()))
a.sort()
print("YES" if a == [1,4,7,9] else "NO")

Buggy submission (verdict: Runtime Error):
var = [int(input()) for _ in range(4)]
var.sort()
print("Yes" if var == [1,4,7,9] else "No")
Problem p03244 (python)

Fixed submission:
#!/usr/bin/env python3

n = int(input())
a = list(map(int,input().split()))
cnt_odd = [0]*(10**5+1)# a[2k]での個数
cnt_even = [0]*(10**5+1)
for i in range(n):
    if i  %2: cnt_odd[a[i]] += 1
    else: cnt_even[a[i]] += 1
odd,idx_odd=zip(*sorted(zip(cnt_odd,list(range(10**5+1)))))
even,idx_even=zip(*sorted(zip(cnt_even,list(range(10**5+1)))))
#print(odd[-1],even[-2],odd[-2],even[-1])
if idx_even[-1]!=idx_odd[-1]:
    print(n - odd[-1] - even[-1])
else:
    print(n - max(odd[-1]+even[-2],odd[-2]+even[-1]))
#ちゃんとテストケース書かないと落ちる

Buggy submission (verdict: Runtime Error):
#!/usr/bin/env python3

n = int(input())
a = list(map(int,input().split()))
cnt = [0]*(10**5)
for i in a:
    cnt[i] += 1
cnt.sort()
#print(cnt[-1])
if cnt[-1] >= (n+1)//2: print(n//2 - cnt[-2])
else: print((n+1)//2 - cnt[-1]+ n//2 - cnt[-2])

Buggy submission (verdict: Runtime Error):
#!/usr/bin/env python3

n = int(input())
a = list(map(int,input().split()))
cnt = [0]*(10**5)
for i in a:
    cnt[i] += 1
cnt.sort()
#print(cnt[-1])
if cnt[-1] >= (n+1)//2: print(n//2 - cnt[-2])
else: print((n+1)//2 - cnt[-1]+ n//2 - cnt[-2])
Problem p03362 (python)

Fixed submission:
#!/usr/bin/env python3
n = int(input())
# 長さN になるまで、%5 = 1となる整数を列挙する
def sleve_of_Eratosthenes(n):
    # N 以下の素数を全列挙
    res = []
    if n == 1:
        return res
    ok = [False] * (1 + n)
    for i in range(2, n + 1):
        if ok[i]:
            continue
        tmp = 1
        res.append(i)
        while tmp * i <= n:
            ok[tmp * i] = True
            tmp += 1
    return res


prime = sleve_of_Eratosthenes(55555)
len_arr = 0
arr = []
for a in prime:
    if a % 5 == 1:
        arr.append(a)
        len_arr += 1
        if len_arr == n:
            break
print(*arr)

Buggy submission (verdict: Runtime Error):
#!/usr/bin/env python3
import sys
import math

n = int(input())
# 長さN になるまで、%5 = 1となる整数を列挙する
def sleve_of_Eratosthenes(n):
    # N 以下の素数を全列挙
    res = []
    if n == 1:
        return res
    ok = [False] * n
    for i in range(2, n + 1):
        if ok[i]:
            continue
        tmp = 1
        res.append(i)
        while tmp * i <= n:
            ok[tmp * i] = True
            tmp += 1
    return res


prime = sleve_of_Eratosthenes(55555)
len_arr = 0
arr = []
for a in prime:
    if a % 5 == 1:
        arr.append(a)
        len_arr += 1
        if len_arr == n:
            break
print(*arr)
Problem p03385 (python)

Fixed submission:
#!/usr/bin/env python3
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
s = input()
print("Yes" if s.count("a")*s.count("b")*s.count("c") == 1 else "No")

Buggy submission (verdict: Runtime Error):
#!/usr/bin/env python3
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
s = input()
print("Yes" if s.count["a"]*s.count["b"]*s.count["c"] == 1 else "No")
Problem p03399 (python)

Fixed submission:
#!/usr/bin/env python3
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
a = int(input())
b = int(input())
c = int(input())
d = int(input())

print(min(a,b)+min(c,d))

Buggy submission (verdict: Runtime Error):
#!/usr/bin/env python3
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
a,b,c,d = map(int,input().split())
print(min(a,b)+min(c,d))
Problem p03417 (python)

Fixed submission:
#!/usr/bin/env python3
n,m = map(int,input().split())
if n == 1 and m == 1:
    print(1)
elif n == 1 or m == 1:
    print(max(n,m)-2)
else: print((n-2)*(m-2))

Buggy submission (verdict: Runtime Error):
N,M = map(int,input())
# can't understand meaning
if N == 1 and M == 1:
  ans = 1
elif N == 1 or M == 1:
  ans = max(N,M) -2
else:
  ans = (N-2)*(M-2)
print(ans)
Problem p03424 (python)

Fixed submission:
n = int(input())
s = list(map(str,input().split()))
ans = 0
for i in range(len(s)):
    if s[i] == "Y":
        ans = 1
        break
if ans == 0:
    print("Three")
else:
    print("Four")

Buggy submission (verdict: Runtime Error):
// space 区切りの文字を入力として、Yが存在すれば、Four, else Threeを出力

#include <iostream>
using namespace std;
int main(){
  int n;
  cin >> n;
  char s[n]; // 配列の初期化はs[n] n：要素数
  int ans = 0; // if ans == 0, Three
  for (int i=0;i < n ;i++){
    cin >> s[i];
    //cout << s[i];
    //charで比較するときは''にする、""だと文字列
    if ( s[i] == 'Y' ){
      ans = 1;
      break;
    }
  }
  if ( ans == 0){
    cout << "Three" << endl;
  }
  else{
    cout << "Four" << endl;
  }
}
Problem p03427 (python)

Fixed submission:
#!/usr/bin/env python3
s = input()
digit = len(s)
if s[1:] == "9"*(digit-1):
    print(int(s[0])+9*(digit-1))
else:
    print(int(s[0])+9*(digit-1)-1)

Buggy submission (verdict: Runtime Error):
s = input()
if len(s) == 1: print(int(s[0])
elif s[1:] == "9"*(len(s)-1): print(int(s[0]+9*len(s)-9)
else: print(int(s[0]+9*len(s)-10)
Problem p03437 (python)

Fixed submission:
#!/usr/bin/env python
x,y = map(int,input().split())
if x % y  == 0 or x > 10**18:
	print(-1)
else:
	print(x)

Buggy submission (verdict: Runtime Error):
#!/usr/bin/env python
x = int(input())
y = int(input())
if x % y  == 0 or x > 10**18:
	print(-1)
else:
	print(2*x)

Buggy submission (verdict: Runtime Error):
#!/usr/bin/env python
x = int(input())
y = int(input())
if x % y  == 0 or x > 10**18:
	print(-1)
else:
	print(x)
Problem p03471 (python)

Fixed submission:
#!/usr/bin/env python3
n,y = map(int,input().split())
ans = (-1,-1,-1)
for i in range(n+1): 
	for j in range(n+1-i):
		if y == 1000*(i + j * 5 + (n-i-j) * 10 ): 
			print( n-i-j, j, i ) # 逆だった。出力は10000から出す
			exit(0)
print(-1,-1,-1)

Buggy submission (verdict: Runtime Error):
n,y = map(int,input().split())
ans = (-1,-1,-1)
for i in range(n+1): 
	for j in range(n+1-i):
		if y == 1000*(i + j * 5 + (n+1-i-j) * 10 ): 
			print( n+1-i-j j, i)
			exit()
print(-1,-1,-1)
Problem p03498 (python)

Fixed submission:
n = int(input())
a = list(map(int, input().split()))
b, idx = zip(*sorted(zip(a, range(1, n + 1))))
if b[-1] < 0:
    print(n - 1)
    # 全て負の数なので後ろから累積和をとる
    for i in range(n - 1):
        print(n - i, n - i - 1)
elif b[0] >= 0:
    print(n - 1)
    for i in range(n - 1):
        print(i + 1, i + 2)
else:
    # max or min を足して全て正の数に直す
    print(2 * n - 2)
    if b[-1] > abs(b[0]):
        # add max
        for i in range(n):
            if i + 1 != idx[-1]:
                print(idx[-1], i + 1)
        for i in range(n - 1):
            print(i + 1, i + 2)
    else:
        for i in range(n):
            if i + 1 != idx[0]:
                print(idx[0], i + 1)
        for i in range(n - 1):
            print(n - i, n - i - 1)

Buggy submission (verdict: Runtime Error):
n = int(input())
a = list(map(int, input().split()))
b, idx = zip(*sorted(zip(a, range(1, n))))
if b[-1] < 0:
    print(n - 1)
    # 全て負の数なので後ろから累積和をとる
    for i in range(n - 1):
        print(n - i, n - i - 1)
elif b[0] >= 0:
    print(n - 1)
    for i in range(n - 1):
        print(i + 1, i + 2)
else:
    # max or min を足して全て正の数に直す
    print(2 * n - 2)
    if b[-1] > abs(b[0]):
        # add max
        for i in range(n - 1):
            print(idx[n - 1], i + 1)
        for i in range(n - 1):
            print(i + 1, i + 2)
    else:
        for i in range(n - 1):
            print(idx[0], i + 2)
        for i in range(n - 1):
            print(n - i, n - i - 1)

Buggy submission (verdict: Runtime Error):
n = int(input())
a = list(map(int, input().split()))
b, idx = zip(*sorted(zip(a, range(1, n))))
if b[-1] < 0:
    print(n - 1)
    # 全て負の数なので後ろから累積和をとる
    for i in range(n - 1):
        print(n - i, n - i - 1)
elif b[0] >= 0:
    print(n - 1)
    for i in range(n - 1):
        print(i + 1, i + 2)
else:
    # max or min を足して全て正の数に直す
    print(2 * n - 2)
    if b[-1] > abs(b[0]):
        # add max
        for i in range(n - 1):
            print(idx[n - 1], i + 1)
        for i in range(n - 1):
            print(i + 1, i + 2)
    else:
        for i in range(n - 1):
            print(idx[0], i + 1)
        for i in range(n - 1):
            print(i + 1, i + 2)
Problem p03523 (python)

Fixed submission:
s = input()
t = "AKIHABARA"
idx = 0
ng = 0
for i in range(len(t)):
    if t[i] == s[idx]:
        idx += 1
    elif t[i] != "A":
        ng = 1
        break
    if idx == len(s):
        if i < len(t) - 2:
            ng = 1

        break

if idx != len(s):
    ng = 1

if ng:
    print("NO")
else:
    print("YES")

Buggy submission (verdict: Runtime Error):
s = input()
cnt = 0
idx = 0
target = "KIHBR"
for i in range(len(s)):
    if s[i] == "A":
        cnt += 1
        if idx == 1 and cnt == 1:
            print("NO")
            exit()
        if cnt >= 2:
            print("NO")
            exit()
    else:
        if idx <= 5 and target[idx] == s[i]:
            idx += 1
            cnt = 0
        else:
            print("NO")
            exit()
if idx == 5:
    print("YES")

Buggy submission (verdict: Runtime Error):
s = input()
cnt = 0
idx = 0
target = "KIHBR"
for i in range(len(s)):
    if s[i] == "A":
        cnt += 1
        if cnt >= 2:
            print("NO")
            exit()
    else:
        if target[idx] == s[i]:
            idx += 1
            cnt = 0
        else:
            print("NO")
            exit()
if idx == 5:
    print("YES")

Buggy submission (verdict: Runtime Error):
s = input()
cnt = 0
idx = 0
target = "KIHBR"
for i in range(len(s)):
    if s[i] == "A":
        cnt += 1
        if cnt >= 2:
            print("NO")
            exit()
    else:
        if target[idx] == s[i]:
            idx += 1
        else:
            print("NO")
            exit()
if idx == 5:
    print("YES")
Problem p03606 (python)

Fixed submission:
def print_ans(l,r,N):
  """print(sum(r)-sum(l)+N)
  Parameters
  --------------
  >>> print_ans([24],[30],1)
  7
  >>> print_ans([6,3],[8,3],2) 
  4
  """
  print(sum(r)-sum(l)+N)


  

def main():
  N = int(input())
  l = []
  r = []
  for i in range(N):
    s = list(map(int,input().split()))
    l.append(s[0])
    r.append(s[1])

  print_ans(l,r,N)


if __name__ == '__main__':
  main()

Buggy submission (verdict: Runtime Error):
def print_ans(l,r,N):
  """print(sum(r)-sum(l)+N)
  Parameters
  --------------
  >>> print_ans([24],[30],1)
  7
  >>> print_ans([6,3],[8,3],2) 
  4
  """
  print(sum(r)-sum(l)+N)


  

def main():
  N = input()
  l = []
  r = []
  for i in range(N):
    s = list(map(int,input().split()))
    l.add(s[0])
    r.add(s[1])

  print_ans(l,r,N)


if __name__ == '__main__':
  main()

Buggy submission (verdict: Runtime Error):
def print_ans(l,r,N):
  """print(sum(r)-sum(l)+N)
  Parameters
  --------------
  >>> print_ans([24],[30],1)
  7
  >>> print_ans([6,3],[8,3],2) 
  4
  """
  print(sum(r)-sum(l)+N)


  

def main():
  N = input()
  l = []
  r = []
  for i in range(N):
    s = list(map(int,input().split()))
    l.add(s[0])
    r.add(s[1])

  print_ans(l,r,N)


if __name__ == '__main__':
  main()
Problem p03607 (python)

Fixed submission:
#!/usr/bin/env python3
n = int(input())
a = [int(input()) for _ in range(n)]
a.sort()
cnt = 1
ans = 0
for i in range(n-1):
    if a[i] == a[i+1]:
        cnt += 1
    else:
        if cnt %2: ans+= 1
        cnt = 1
print(ans+cnt%2)

Buggy submission (verdict: Runtime Error):
#!/usr/bin/env python3
n = int(input())
a = [int(input()) for _ in range(n)]
#print(a)
cnt = [0]*(10**5)
for i in a:
    cnt[i-1] += 1
print(sum([1 for i in cnt if i % 2 == 1]))
exit(0)

Buggy submission (verdict: Runtime Error):
#!/usr/bin/env python3
n = int(input())
a = [int(input()) for _ in range(n)]
#print(a)
cnt = [0]*(10**5)
for i in a:
    cnt[i-1] += 1
print(sum([1 for i in cnt if i % 2 == 1]))
exit(0)

Buggy submission (verdict: Runtime Error):
#!/usr/bin/env python3
n = int(input())
a = [int(input()) for _ in range(n)]
#print(a)
cnt = [0]*(10**9)
for i in a:
    cnt[i-1] += 1
print(sum([1 for i in cnt if i % 2 == 1]))
exit(0)

Buggy submission (verdict: Runtime Error):
#!/usr/bin/env python3
n = int(input())
a = list(map(int,input().split()))
print(a)
cnt = [0]*(10**9)
for i in a:
    cnt[i-1] += 1
print(len([1 for i in cnt if i % 2 == 1]))
Problem p03624 (python)

Fixed submission:
#!/usr/bin/env python3
import sys
s = input()
for i in range(26):
    if chr(97+i) not in s: 
        print(chr(97+i)) 
        break
    if i == 25:
        print("None")

Buggy submission (verdict: Runtime Error):
import string
def print_ans(s):

  A=string.ascii_lowercase
  B=list(set(A)-set(S))
  B.sort()
  print_ans(B[0] if B else 'None')

if __name__ == '__main__':
    S = input()
    print_ans(S)

Buggy submission (verdict: Runtime Error):
import string
def print_ans(s):
    """Print substring of s, odd_th char
    >>> print_ans("abcdefghijklmnopqrstuvwxyz")
    None
    >>> print_ans("cbbbaeae")
    d
    >>> print_ans("b")
    a
    >>> print_ans("abc")
    d
    
    """
    a = string.ascii_lowercase
    b = list(set(a)-set(s)) #diff of list a and list b
    b.sort()

    print_ans(b[0] if b else 'None')

if __name__ == '__main__':
    S = input()
    print_ans(S)
Problem p03633 (python)

Fixed submission:
#import math
N = int(input())
T = []
for i in range(N):
  T.append(int(input()))
# output LCM(T1,T2... Tn)=LCM(Tn,LCM(Tn-1,LCM(...)))
def gcd(a,b): #Recusion!!
  if min(a,b) == 0:
    return max(a,b)
  else:
    return gcd(min(a,b),max(a,b)%min(a,b))
    
"""
  mi = min(a,b)
  ma = max(a,b)
  ans = 1
  '''for i in range(2,mi+1):
    if (mi%i)+(ma%i) == 0:
      mi /= i
      ma /= i
      ans *= i
      i -= 1'''
  while True:
    #print(ma,mi)
    if (ma % mi) == 0:
      ans = mi
      break
    else:
      mi = ma%mi
      ma = mi
      
  return ans"""


def lcm(a,b):
  #g = math.gcd(a,b)
  g = gcd(a,b)
  #print(g)
  return int(a*b//g)
ans = T[0]
for i in range(1,len(T)):
  ans = lcm(ans,T[i])
print(ans)

Buggy submission (verdict: Runtime Error):
import math
N = int(input())
T = []
for i in range(N):
  T.append(int(input()))
# output LCM(T1,T2... Tn)=LCM(Tn,LCM(Tn-1,LCM(...)))
def lcm(a,b):
  g = math.gcd(a,b)
  #print(g)
  return int(a*b/g)
ans = T[0]
for i in range(1,len(T)):
  ans = lcm(ans,T[i])
print(ans)
Problem p03672 (python)

Fixed submission:
#!/usr/bin/env python3
s = input()
for i in range(1,len(s)-1):
	if (len(s) - i) % 2 == 1: pass
	elif s[:(len(s) - i)//2] == s[(len(s) - i)//2:-i]:
		print(len(s) - i)
		#print(s[:-i])
		break

Buggy submission (verdict: Runtime Error):
s = input()
for i in range(26):
    if chr(97+i) not in s: 
        print(chr(97+i)) 
        break
    if i == 25:
        print("None")
l.sort(reverse=True)
print(sum(l[:k]))
s = input()
for i in range(1,len(s)-1):
	if (len(s) - i) % 2 == 1: pass
	elif s[:(len(s) - i)//2] == s[(len(s) - i)//2:-i]:
		print(len(s) - i)
		#print(s[:-i])
		break
Problem p03679 (python)

Fixed submission:
x,a,b = map(int,input().split())
print("delicious" if b-a <= 0 else "safe" if b-a <= x else "dangerous")

Buggy submission (verdict: Runtime Error):
x,a,b = = map(int,input().split())
if b <= a: print("delicious")
elif b <= a + x: print("safe")
else: print("dangerous")
Problem p03739 (python)

Fixed submission:
#!/usr/bin/env python3
n = int(input())
a = list(map(int,input().split()))
def solve(cnt,current_sum):
    for i in range(n-1):
        if current_sum * (current_sum + a[i+1]) < 0:#符号が違う
            current_sum += a[i+1]
            cnt += 0#そのまま
        elif current_sum < 0:
            cnt += 1 - (current_sum + a[i+1])
            current_sum = 1 
        else:
            cnt += (current_sum + a[i+1]) +1 
            current_sum = -1
    return cnt
if a[0] > 0:
    print(min(solve(0,a[0]),solve(1+abs(a[0]),-1)))
elif a[0] < 0:
    print(min(solve(0,a[0]),solve(1+abs(a[0]),1)))
else:
    print(min(solve(1,1),solve(1,-1)))

Buggy submission (verdict: Runtime Error):
#!/usr/bin/env python3
n = int(input())
a = list(map(int,input().split()))
cnt = 0
current_sum = a[0]#現在の操作後の値
# 正負どちらを起点にするかで2通り考える必要がある。
# a[0]に従うパターン
for i in range(n-1):
    if current_sum * (current_sum + a[i+1]) < 0:#符号が違う
        current_sum += a[i+1]
        cnt += 0#そのまま
    elif current_sum < 0:
        cnt += 1 - (current_sum + a[i+1])
        current_sum = 1 
    else:
        cnt += (current_sum + a[i+1]) +1 
        current_sum = -1
case1 = cnt

cnt = abs(a[0])+1
current_sum = -1 * a[0] // abs(a[0])#現在の操作後の値
for i in range(n-1):
    if current_sum * (current_sum + a[i+1]) < 0:#符号が違う
        current_sum += a[i+1]
        cnt += 0#そのまま
    elif current_sum < 0:
        cnt += 1 - (current_sum + a[i+1])
        current_sum = 1 
    else:
        cnt += (current_sum + a[i+1]) +1 
        current_sum = -1
#print(cnt,case1)
print(min(cnt,case1))
Problem p03998 (python)

Fixed submission:
#!/usr/bin/env python3
s = [input() for _ in range(3)]
pos = 0#a,b,c ordにして97からひく
idx = [0,0,0] #ABCそれぞれの現在のindex
for i in range(300):#大きめにとってもbreakするのでOK
	if idx[pos] == len(s[pos]):
		print(chr(65+pos))
		exit()
	idx[pos] += 1 #idxの更新
	pos = ord(s[pos][idx[pos] - 1]) - 97 # asciiの文字にして引く、更新する前のidx で次の文字列を判定して更新
	#print(pos)

Buggy submission (verdict: Runtime Error):
s = [ input() for i in [0]*3]
current = 0
while len(s[current]) >= 0 :
  if len(s[ord(s[current][-1]) - 97]) == 0:
    print(s[current][-1].upper())
    break
  else:
    tmp = s[current][-1] # 末尾の値を保存
    s[current] = s[current][:-1] # 末尾を消去する
    current = ord(tmp) - 97
    # 末尾の値にcurrentを更新する
Problem p04020 (python)

Fixed submission:
n = int(input())
a = [int(input()) for _ in range(n)]
ans = 0
cur_sum = 0  # 0が入るまでのsum
for i in range(n):
    if a[i] == 0:
        ans += cur_sum // 2
        cur_sum = 0
    else:
        cur_sum += a[i]
ans += cur_sum // 2
print(ans)

Buggy submission (verdict: Runtime Error):
#include <bits/stdc++.h>
using namespace std;

int main()
{
  int N;
  cin >> N;
  vector<long long> a(N);
  for (int i = 0; i < N; ++i)
    cin >> a[i];
  long long res = 0, cur_sum = 0;
  for (int i = 0; i < N;)
  {
    int j = i;
    while (j < N && a[j])
      cur_sum += a[j++];
    res += cur_sum / 2;
    cur_sum = 0;
    i = j + 1;
  }
  cout << res << endl;
}
Problem p02630 (python)

Fixed submission:
def solve():
    N = int(input())
    a = list(map(int, input().split()))
    s = sum(a)
    q = int(input())
    n = [0 for _ in range(100000+1)]
    for i in a:
        n[i] += 1
    for _ in range(q):
        b, c = map(int, input().split())
        s += (c - b) * n[b]
        print(s)
        n[c] += n[b]
        n[b] = 0


if __name__ == '__main__':
    solve()

Buggy submission (verdict: Runtime Error):
def solve():
    N = int(input())
    a = list(map(int, input().split()))
    s = sum(a)
    q = int(input())
    n = [0 for _ in range(100000)]
    for i in a:
        n[i] += 1
    for _ in range(q):
        b, c = map(int, input().split())
        s += (c - b) * n[b]
        print(s)
        n[c] += n[b]
        n[b] = 0


if __name__ == '__main__':
    solve()
Problem p02657 (python)

Fixed submission:
print(eval(input().replace(' ','*')))

Buggy submission (verdict: Runtime Error):
print(eval(input().replace(' ','*'))

Buggy submission (verdict: Runtime Error):
print(eval(input().replace(' ','*'))
Problem p02658 (python)

Fixed submission:
def solve():
    N = int(input())
    A = list(map(int, input().split()))
    if 0 in A:
        print(0)
        exit()
    mul = A[0]
    for v in A[1:]:
        mul *= v
        if mul > 10**18:
            print(-1)
            exit()
    print(mul)





if __name__ == '__main__':
    solve()

Buggy submission (verdict: Runtime Error):
def solve():
    N = int(input())
    A = eval(input().replace(' ', '*'))
    if A > 10**18:
        print(-1)
    else:
        print(A)


if __name__ == '__main__':
    solve()
Problem p03386 (python)

Fixed submission:
def solve():
    A, B, K = map(int, input().split())
    for i in range(A, min(A+K, B+1)):
        print(i)
    for j in range(max(A+K, B-K+1), B+1):
        print(j)


if __name__ == "__main__":
    solve()

Buggy submission (verdict: Runtime Error):
def solve():
    A, B, K = map(int, input().split())
    ans = list(range(A, B + 1))
    if B - A >= K * 2:
        ans = sorted((set(ans[:min(B-A, K)] + ans[min(0, -K):])), key=ans.index)

    for a in ans:
        print(a)


if __name__ == "__main__":
    solve()

Buggy submission (verdict: Runtime Error):
def solve():
    A, B, K = map(int, input().split())
    if A == B:
        print(A)
        exit()
    ans = list(range(A, B + 1))
    if B - A >= K * 2:
        ans = sorted((set(ans[:K] + ans[-K:])), key=ans.index)

    for a in ans:
        print(a)


if __name__ == "__main__":
    solve()

Buggy submission (verdict: Runtime Error):
def solve():
    A, B, K = map(int, input().split())
    ans = list(range(A, B + 1))
    if B - A >= K * 2:
        ans = sorted((set(ans[:K] + ans[-K:])), key=ans.index)

    for a in ans:
        print(a)


if __name__ == "__main__":
    solve()

Buggy submission (verdict: Runtime Error):
def solve():
    A, B, K = map(int, input().split())
    ans = list(range(A,B+1))
    ans = sorted((set(ans[:K] + ans[-K:])), key=ans.index)

    for a in ans:
        print(a)


if __name__ == "__main__":
    solve()
Problem p02553 (python)

Fixed submission:
a,b,c,d = map(int,input().split())
 
l = []
l.append(a*c)
l.append(b*c)
l.append(a*d)
l.append(b*d)
 
print(max(l))

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

l = list[]
l.append(a*c)
l.append(b*c)
l.append(a*d)
l.append(b*d)

print(max(l))
Problem p02675 (python)

Fixed submission:
n = int(input())
b = n%10

if b == 3:
  print('bon')
elif b == 1 or b == 6 or b ==8 or b == 0:
  print('pon')
else:
  print('hon')

Buggy submission (verdict: Runtime Error):
import math

A,B,H,M = map(int, input().split())

h = H/6
n = M/30

CC = A**2 + B**2 + 2*A*B*math.cos((h-n)*math.pi)\  
C= math.sqrt(CC)

print(C)

Buggy submission (verdict: Runtime Error):
import math

A,B,H,M = map(int, input().split())

h = H/6
n = M/30

CC = A**2 + B**2 + 2*A*B*math.cos((h-n)*math.pi)\  
C= math.sqrt(CC)

print(CC)
print(C)
Problem p04001 (python)

Fixed submission:
S = input()
n = len(S)

tot = 0

for i in range(2**(n-1)):
  f = S[0]
  for j in range(n-1):
       if ((i >> j) & 1):
        f += " "
       f += S[j+1]
  
  tot += sum(map(int, f.split(" ")))

print(tot)

Buggy submission (verdict: Runtime Error):
from sys import stdin
input = stdin.readline

S = input()
n = len(S)

tot = 0

for i in range(2**(n-1)):
  f = S[0]
  for j in range(n-1):
       if ((i >> j) & 1):
        f += " "
       f += S[j+1]
  
  tot += sum(map(int, f.split(" ")))

print(tot)
Problem p02612 (python)

Fixed submission:
N = int(input())
if N % 1000 == 0:
  print(0)
else:
  print(int(N / 1000 + 1) * 1000 - N )

Buggy submission (verdict: Runtime Error):
print(int(int(input() / 1000 + 1) * 1000 - N)
Problem p02613 (python)

Fixed submission:
L = []
for i in range(int(input())):
  L.append(input())
for j in ['AC','WA','TLE','RE']:
  print(j,'x',L.count(j))

Buggy submission (verdict: Runtime Error):
L = []
for i in range(int(input)):
  l.append(input())
for j in ['AC','WA','TLE','RE']:
  print(L.count(j))