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

Fixed submission:
# -*- coding: utf-8 -*-

def input_int_array():
    return map(int, input().split())


def answer(n, x, m):
    a1 = x
    ai = a1
    loop_start = -1
    loop_end = n
    a[1] = a1
    ans = a1
    for i in range(2, n + 1):
        ai = ai*ai % m
        a.append(ai)
        ans += ai
        for j in range(1, i):
            if a[j] == ai:
                loop_start = j
                loop_end = i
                break
        if loop_start >= 0:
            break
    if loop_start < 0 or ai == 0:
        print(ans)
        return
    ans -= ai
    loop_count, remaining = divmod(n - (loop_start - 1), loop_end - loop_start)
    if loop_count > loop_start:
        start_ans = 0
        for i in range(1, loop_start):
            start_ans += a[i]
        loop_sum = ans - start_ans
        ans += loop_sum * (loop_count-1)
        for i in range(loop_start, loop_start + remaining):
            ans += a[i]
    else:
        for i in range(loop_start, loop_end):
            if i < remaining:
                ans += a[i]
            loop_sum += a[i]
        ans += loop_sum * (loop_count-1)
    print(ans)


n, x, m = input_int_array()
a = [0, 0]

answer(n, x, m)

Buggy submission (verdict: Runtime Error):
# -*- coding: utf-8 -*-

def input_int_array():
    return map(int, input().split())


def f(x, m):
    return x % m


def find_index(a, x, count):
    for i in range(count):
        ai = a[i]
        if ai == x:
            return i
    return -1


def answer(n, x, m):
    a1 = x
    ai = a1
    loop_start = -1
    loop_end = n
    a[1] = a1
    ans = a1
    for i in range(2, n + 1):
        ai = f(ai**2, m)
        a[i] = ai
        ans += ai
        index = find_index(a, ai, i)
        if index >= 0:
            loop_start = index
            loop_end = i
            break
    if loop_start < 0:
        print(ans)
        return
    ans -= ai
    loop_count, remaining = divmod(n - (loop_start - 1), loop_end - loop_start)
    if loop_count > loop_start:
        start_ans = 0
        for i in range(1, loop_start):
            start_ans += a[i]
        loop_sum = ans - start_ans
    else:
        for i in range(loop_start, loop_end):
            loop_sum += a[i]
    ans += loop_sum * (loop_count-1)
    for i in range(loop_start, loop_start + remaining):
        ans += a[i]
    print(ans)


n, x, m = input_int_array()
a = [-2] * (m)

answer(n, x, m)
Problem p02711 (python)

Fixed submission:
n = list(input())
if int(n[0]) == 7:
    print("Yes")
else:
    if int(n[1]) == 7:
        print("Yes")
    else:
        if int(n[2]) == 7:
            print("Yes")
        else:
            print("No")

Buggy submission (verdict: Runtime Error):
n = list(input())
if int(n[0]) == 7:
	print("Yes")
else:
	if int(n[1]) == 7:
    	print("Yes")
    else:
		if int(n[2]) == 7:
			print("Yes")
        else:
        print("No")

Buggy submission (verdict: Runtime Error):
n = list(input())
if n[0] ==7:
 	print("Yes")
 else:
 	if n[1] ==7:
 		print("Yes")
    else:
    	if n[2] ==7:
 			print("Yes")
        else:
        	print("No")
Problem p02676 (python)

Fixed submission:
K=int(input())
S=input()
print(S[:K]) if len(S) <= K else print(S[:K] + "...")

Buggy submission (verdict: Runtime Error):
k=int(input())
s=input()
print(S[:K]) if len(S) <= K else print(S[:K] + "...")
Problem p02753 (python)

Fixed submission:
a = input()
if 'A' in a and 'B' in a:
    print("Yes")
else:
    print("No")

Buggy submission (verdict: Runtime Error):
n=input()
if A in n and B in n:
  print("YES")
else:
  print("NO")
Problem p02759 (python)

Fixed submission:
N = int(input())

if N % 2 == 0:
    print(N//2)
else:
    print(N//2+1)

Buggy submission (verdict: Runtime Error):
n=input()
if(n%2==0):
  print(n/2)
else:
  print((n/2)+1)
Problem p02835 (python)

Fixed submission:
a = [int(i) for i in input().split(" ")]
print("bust") if sum(a) >= 22 else print("win")

Buggy submission (verdict: Runtime Error):
a,b,c= map(int, input())
if(a+b+c)>=22:
    print("bust")
else:
    print("win")

Buggy submission (verdict: Runtime Error):
a= int(input())
b= int(input())
c= int(input())
if(a+b+c)>=22:
    print("bust")
else:
    print("win")

Buggy submission (verdict: Runtime Error):
a=input()
b=input()
c=input()
if(a+b+c) %2==0:
    print("bust")
else:
    print("win")
Problem p02577 (python)

Fixed submission:
n=input() 
l=[] 
for i in range(len(str(n))): 
  l.append(int(n[i])) 
if((sum(l)%9)==0): 
  print("Yes") 
else: 
  print("No")

Buggy submission (verdict: Runtime Error):
n=int(input())  
l=0
for i in range(len(str(n))): 
  l=l+int(n[i])
if((l%9)==0): 
  print("Yes") 
else: 
  print("No")

Buggy submission (verdict: Runtime Error):
n=int(input())  
l=[] 
for i in range(len(str(n))): 
  l.append(int(n[i])) 
if((sum(l)%9)==0): 
  print("Yes") 
else: 
  print("No")
Problem p02546 (python)

Fixed submission:
s = input()
if s[-1:] == "s":
    print(s + "es")
else :
    print(s + "s")

Buggy submission (verdict: Runtime Error):
n = int(input())
count = 0
for i in range(n):
    if i == 0:
        count = 0
    else:
        if n % i == 0:
            count += (n//i) -1
        else:
            count += (n//i)
print(count)

Buggy submission (verdict: Runtime Error):
n = int(input())
d = [list(map(int, input().split())) for i in range(n)]
count = 0
jail = False
for i in range(n):
    if d[i][0] == d[i][1]:
        count += 1
        if count == 3:
            jail = True
            break        
    else: count = 0
if jail == True:
    print("Yes")
else : print("No")
Problem p02622 (python)

Fixed submission:
S = input()
T = input()
n = len(S)
ans = 0
for i in range(n):
    if (S[i]!=T[i]):
        ans += 1
print(ans)

Buggy submission (verdict: Runtime Error):
import sys
import os
f = open('input.txt', 'r')
sys.stdin = f
S = input()
T = input()
n = len(S)
ans = 0
for i in range(n):
    if (S[i]!=T[i]):
        ans += 1
print(ans)
Problem p02547 (python)

Fixed submission:
a=int(input())
b=0
xy = [map(int, input().split()) for _ in range(a)]
x, y = [list(i) for i in zip(*xy)]
for i in range(a-2):
  if x[i]==y[i] and x[i+1]==y[i+1] and x[i+2]==y[i+2]:
    b=b+1
if b==0:
  print("No")
else:
  print("Yes")

Buggy submission (verdict: Runtime Error):
a=int(input())
b=0
xy = [map(int, input().split()) for _ in range(a)]
x, y = [list(i) for i in zip(*xy)]
for i in range(a-2):
  if x[i]==y[i] and x=[i+1]==y[i+1] and x=[i+2]==y[i+2]:
    b=b+1
if b==0:
  print("No")
else:
  print("Yes")

Buggy submission (verdict: Runtime Error):
a=int(input())
b=0
xy = [map(int, input().split()) for in range(a)]
for i in range(a-2):
  if a[i]==a[i+1]==a[i+2]:
    b=b+1
if b==0:
  print("No")
else:
  print("Yes")
Problem p02578 (python)

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

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

Fixed submission:
a,b=input().split()
a=int(a)
b=int(b)
c=list(map(int,input().split()))
c.sort()
d=sum(c)
e=0
if a<=b:
  print(0)
else:
  for i in range(1,b+1):
    e=e+c[-i]
  print(d-e)

Buggy submission (verdict: Runtime Error):
a,b=input().split()
a=int(a)
b=int(b)
c=list(map(int,input().split()))
c.sort()
d=sum(c)
e=0
for i in range(b):
  e=e+c[-b]
print(d-e)

Buggy submission (verdict: Runtime Error):
a,b=input().split()
a=int(a)
b=int(b)
c=list(map(int,input().split()))
c.sort()
d=sum(c)
e=0
for i in range(b):
  e=e+c[-b]
print(d-2*e)

Buggy submission (verdict: Runtime Error):
a,b=input().split()
c=list(map(int,input().split()))
c.sort()
d=sum(c)
e=0
for i in range(b):
  e=e+c[-b]
print(d-2*e)
Problem p02831 (python)

Fixed submission:
a,b=input().split()
a=int(a)
b=int(b)
e=a
d=b
c=1
if a>b:
  for i in range(1,e):
    if a%(e-i)==0 and b%(e-i)==0:
      a=a/(e-i)
      b=b/(e-i)
      c=c*(e-i)
  print(int(a*b*c))
if a<b:
  for i in range(1,d):
    if a%(d-i)==0 and b%(d-i)==0:
      a=a/(d-i)
      b=b/(d-i)
      c=c*(d-i)
  print(int(a*b*c))

Buggy submission (verdict: Runtime Error):
a,b=input().split()
a=int(a)
b=int(b)
c=1
d=0
if a>b:
  for i in range(1,a):
    if a%(a-i)==0 and b%(b-i)==0:
      a=a/(a-i)
      b=b/(a-i)
      c=c*(a-i)
  print(int(a*b*c))
if a<b:
  for i in range(1,b):
    if a%(b-i)==0 and b%(b-i)==0:
      a=a/(b-i)
      b=b/(a-i)
      c=c*(b-i)
  print(int(a*b*c))

Buggy submission (verdict: Runtime Error):
a,b=input().split()
a=int(a)
b=int(b)
c=1
d=0
if a>b:
  for i in range(a):
    if a%i==0 and b%i==0:
      a=a/i
      b=b/i
      c=c*i
  print(a*b*c)
if a<b:
  for i in range(b):
    if a%i==0 and b%i==0:
      a=a/i
      b=b/i
      c=c*i
  print(a*b*c)
Problem p02836 (python)

Fixed submission:
a=input()
b=0
for i in range(len(a)):
  if a[i]!=a[len(a)-i-1]:
    b=b+1
print(int(b/2))

Buggy submission (verdict: Runtime Error):
a=input()
b=0
for i in range(len(a)):
  if a[i]!=a[len(a)-i]:
    b=b+1
print(int(b/2))
Problem p02860 (python)

Fixed submission:
c=input()
c=int(c)
a=input()
b=0
if c%2==1:
  print("No")
else:
  for i in range(int(c/2)):
    if a[i]!=a[i+int(c/2)]:
      b=b+1
  if b==0:
    print("Yes")
  else:
    print("No")

Buggy submission (verdict: Runtime Error):
c=input()
a=input()
b=0
if c%2==1:
  print("No")
else:
  for i in range(c/2):
    if a[i]!=a[i+int(c/2)]:
      b=b+1
  if b==0:
    print("Yes")
  else:
    print("No")

Buggy submission (verdict: Runtime Error):
a=input()
b=0
if (len(a))%2==1:
  print("No")
else:
  for i in range(len(a/2)):
    a[i]!=a[i+a/2]:
      b=b+1
  if b==0:
    print("Yes")
  else:
    print("No")

Buggy submission (verdict: Runtime Error):
a=input()
b=0
if (len(a))%2==1:
  print("No")
else:
  for i in range(a/2):
    a[i]!=a[i+a/2]:
      b=b+1
  if b==0:
    print("Yes")
  else:
    print("No")
Problem p02880 (python)

Fixed submission:
a=int(input())
if a==11 or a==13 or a==17 or a==19 or a==22 or a==23 or a==26 or a==29 or a==31 or a==33 or a==34 or a==37 or a==38 or a==39 or a==41 or a==43 or a==44 or a==46 or a==47 or a==50 or a==51 or a==52 or a==53 or a==55 or a==57 or a==58 or a==59 or a==60 or a==61 or a==62 or a==65 or a==66 or a==67 or a==68 or a==69 or a==70 or a==71 or a==73 or a==74 or a==75 or a==76 or a==77 or a==78 or a==79 or a==80 or a>=82:
  print("No")
else:
  print("Yes")

Buggy submission (verdict: Runtime Error):
a=int(input())
b=0
for i in range(9):
  for k in range(9):
    if (i+1)*(k+1)==a:
      print("Yes")
      break
      b=b+1
if b=81:
  print("No")
Problem p02987 (python)

Fixed submission:
a=input()
if a[0]==a[1] and a[2]==a[3] and a[0]!=a[2]:
  print("Yes")
elif a[0]==a[2] and a[1]==a[3] and a[0]!=a[1]:
  print("Yes")
elif a[0]==a[3] and a[1]==a[2] and a[0]!=a[1]:
  print("Yes")
else:
  print("No")

Buggy submission (verdict: Runtime Error):
a=input()
a.sort()
if a[0]==a[1] and a[2]==a[3]:
  print("Yes")
else:
  print("No")
Problem p02989 (python)

Fixed submission:
a=int(input())
b=list(map(int,input().split()))
b.sort()
if b[int(a/2)-1]==b[int(a/2)]:
  print(0)
else:
  print(b[int(a/2)]-b[int(a/2)-1])

Buggy submission (verdict: Runtime Error):
a=int(input())
b=list(map(int,input().split()))
b.sort()
if b[(a/2)-1]==b[(a/2)]:
  print(0)
else:
  print(b[(a/2)]-b[(a/2)-1]-1)
Problem p03012 (python)

Fixed submission:
a=int(input())
b=list(map(int,input().split()))
c=sum(b)
d=0
e=0
f=0
for i in range(a):
  d=d+b[i]
  if d>=c/2:
    e=i
    break
for i in range(e):
  f=f+b[i]
if abs(d-(c-d))<abs(f-(c-f)):
  print(abs(d-(c-d)))
else:
  print(abs(f-(c-f)))

Buggy submission (verdict: Runtime Error):
a=int(input())
b=list(map(int,input().split()))
c=sum(b)
d=0
e=0
for i in range(a):
  d=d+b[i]
  if d>=c/2:
    e=i
    break
for i in range(e):
  e=e+b[e]
if d-(c-d)<e-(c-e):
  print(d-(c-d))
else:
  print(e-(c-e))
Problem p03036 (python)

Fixed submission:
a,b,c=input().split()
a=int(a)
b=int(b)
c=int(c)
i=0
while i<10:
  i=i+1
  c=a*c-b
  print(c)

Buggy submission (verdict: Runtime Error):
a,b,c=input().split()
a=int(a)
b=int(b)
c=int(c)
d=c
while i<10:
d=a*d-b
print(d)
i=i+1
Problem p03042 (python)

Fixed submission:
a=input()
b=int(a[0]+a[1])
c=int(a[2]+a[3])
if 1<=b<=12:
  if 1<=c<=12:
    print("AMBIGUOUS")
  else:
    print("MMYY")
else:
  if 1<=c<=12:
    print("YYMM")
  else:
    print("NA")

Buggy submission (verdict: Runtime Error):
a=input(a)
b=int(a[0]+a[1])
c=int(a[2]+a[3])
if 1<=b<=12 and 1<=c<=12:
  print("AMBIGUOUS")
elif b>12:
  if c>12:
    print("Na")
  elif 1<=c<=12:
    print("YYMM")
elif c>12:
  if b>12:
    print("Na")
  elif 1<=b<=12:
    print("MMYY")
else:
  print("NA")
Problem p03072 (python)

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

Buggy submission (verdict: Runtime Error):
a=int(input())
b=[int(input()) for i in range(a)]
c=0
d=0
for i in range(a):
  if c<b[i]:
    c=b[i]
    d=d+1
print(d)
Problem p03073 (python)

Fixed submission:
a=input()
b=int(len(a))
c=0
d=0
if b%2==0:
  for i in range(b//2):
    if a[2*i]=="1":
      c=c+1
    if a[2*i+1]=="0":
      c=c+1
  for i in range(b//2):
    if a[2*i]=="0":
      d=d+1
    if a[2*i+1]=="1":
      d=d+1
  if c>d:
    print(d)
  else:
    print(c)
if b%2==1:
  for i in range(b//2):
    if a[2*i]=="1":
      c=c+1
    if a[2*i+1]=="0":
      c=c+1
  if a[-1]=="1":
    c=c+1
  for i in range(b//2):
    if a[2*i]=="0":
      d=d+1
    if a[2*i+1]=="1":
      d=d+1
  if a[-1]=="0":
    d=d+1
  if c>d:
    print(d)
  else:
    print(c)

Buggy submission (verdict: Runtime Error):
a=input()
b=int(len(a))
c=0
d=0
for i in range(b):
  if a[2*i]==1:
    c=c+1
  if a[2*1+1]==0:
    c=c+1
for i in range(b):
  if a[2*i]==0:
    d=d+1
  if a[2*1+1]==1:
    d=d+1
if c>d:
  print(d)
else:
  print(c)
Problem p03075 (python)

Fixed submission:
a=int(input())
b=int(input())
c=int(input())
d=int(input())
e=int(input())
x=int(input())
ls=[a,b,c,d,e]
if (e-a)<=x:
  print("Yay!")
else:
  print(":(")

Buggy submission (verdict: Runtime Error):
a=int(input()
b=int(input()
c=int(input()
d=int(input()
e=int(input()
x=int(input()
ls=[a,b,c,d,e]
ls.sort()
if (ls[1]-ls[0])<=x and (ls[2]-ls[1])<=x and (ls[3]-ls[2])<=x and (ls[4]-ls[3])<=x:
  print("Yay!")
else:
  print(":(")

Buggy submission (verdict: Runtime Error):
a=int(input()
b=int(input()
c=int(input()
d=int(input()
e=int(input()
x=int(input()
ls=[a,b,c,d,e]
ls.sort()
if ls[1]-ls[0]<=x and ls[2]-ls[1]<=x and ls[3]-ls[2]<=x and ls[4]-ls[3]<=x:
  print("Yay!")
else:
  print(":(")
Problem p03207 (python)

Fixed submission:
a=int(input())
b=[int(input()) for i in range(a)]
b.sort()
c=sum(b)
print(int(c-b[a-1]/2))

Buggy submission (verdict: Runtime Error):
a=int(input())
b=[input().split() for i in range(a)]
b=int(b)
b.sort()
c=sum(b)
print(int(c-b[a]/2))
Problem p03242 (python)

Fixed submission:
a=input()
print(a.replace("1","8").replace("9","1").replace("8","9"))

Buggy submission (verdict: Runtime Error):
a=input()
if a[0]=="1":
  a[0]="9"
if a[0]=="9":
  a[0]=="1"
if a[1]=="1":
  a[1]=="9"
if a[1]=="9":
  a[1]=="1"
if a[2]=="1":
  a[2]=="9"
if a[2]=="9":
  a[2]=="1"
print(a)

Buggy submission (verdict: Runtime Error):
a=input()
print(a.replace(1,8).replace(9,1).replace(8,9))

Buggy submission (verdict: Runtime Error):
a=input()
print(a.replace(1,8),replace(9,1),replace(8,9))

Buggy submission (verdict: Runtime Error):
a=input()
a.replace(1,8)
a.replace(9,1)
a.replace(8,9)
print(a)

Buggy submission (verdict: Runtime Error):
a=input()
a.replace(9,8)
a.replace(1,9)
a.replace(8,1)
print(a)

Buggy submission (verdict: Runtime Error):
a=input()
if a[0]=="1":
  a[0]="9":
else:
  a[0]=="1"
if a[1]=="1":
  a[1]="9"
else:
  a[1]="1"
if a[2]=="1":
  a[2]="9"
else:
  a[2]="1"
print(a)
Problem p03272 (python)

Fixed submission:
a,b=input().split()
a=int(a)
b=int(b)
print(int(a-b+1))

Buggy submission (verdict: Runtime Error):
a,b=input().split()
print(int(a-b+1))

Buggy submission (verdict: Runtime Error):
a,b=input().split
print(int(a-b+1))
Problem p03327 (python)

Fixed submission:
a=int(input())
if a<1000:
  print("ABC")
else:
  print("ABD")

Buggy submission (verdict: Runtime Error):
a=int(input())
if a<10:
  print("ABC00"+str(a))
elif 10<=a<100:
  print("ABC0"+str(a))
elif 100<=a<1000:
  print("ABC"+str(a))
elif: 1000<=a<1010:
  print("ABD00"+str(a))
elif: 1010<=a<1100:
  print("ABD0"+str(a))
else:
  print("ABD"+str(a))

Buggy submission (verdict: Runtime Error):
a=int(input())
if a<10:
  print("ABC00"+a)
elif 10<=a<100:
  print("ABC0"+a)
elif 100<=a<1000:
  print("ABC"+a)
elif: 1000<=a<1010:
  print("ABD00"+a)
elif: 1010<=a<1100:
  print("ABD0"+a)
else:
  print("ABD"+a)
Problem p02546 (python)

Fixed submission:
a = input()

if a[-1] == "s":
    print(a + "es")
else:
    print(a + "s")

Buggy submission (verdict: Runtime Error):
N = int(input())
 
count = 0
for a in range(1, N):
    ans, mod = divmod(N, a)
    if mod == 0:
        count += ans - 1
    else:
        count += ans
 
print(count)

Buggy submission (verdict: Runtime Error):
N = int(input())

count = 0
for a in range(1, N):
    ans, mod = divmod(N, a)
    if mod == 0:
        count += ans - 1
    else:
        count += ans

print(count)
Problem p02676 (python)

Fixed submission:
k = int(input())
s = input()
if len(s) <= k:
  print(s)
else:
  print("{}...".format(s[:k]))

Buggy submission (verdict: Runtime Error):
s = input()
k = int(input())
if len(s) <= k:
  print(s)
else:
  print("...{}".format(s[:k]))
Problem p02676 (python)

Fixed submission:
K = int(input())
S = input()
if len(S) > K:
  S = S[:K] + "..."
  print(S)
else:
  print(S)

Buggy submission (verdict: Runtime Error):
K = int(input())
S = input()
if len(S) > K:
  S = S[:k] + "..."
  print(S)
else:
  print(S)

Buggy submission (verdict: Runtime Error):
K = int(input())
S = input()
if len(S) > K:
  s = s[:k] + "..."
  print(S)
else:
  print(S)
Problem p02688 (python)

Fixed submission:
import numpy as np
N, K = map(int,input().split())
B = []
C = np.zeros(N)
e = 0
for i in range(K):
  d = int(input())
  A = list(map(int,input().split()))
  for j in range(1, N + 1):
    B.append(A.count(j))
  for k in range(N):
    C[k] += B[k] 
  B = []
for l in range(N):
  if C[l] == 0:
    e += 1
print(e)

Buggy submission (verdict: Runtime Error):
import numpy as np
N, K = map(int,input().split())
B = []
C = np.zeros(N)
e = 0
for i in range(K):
  d = int(input())
  A = list(map(int,input().split()))
  for j in range(1, N + 1):
    B.append(A.count(j))
  for k in range(N):
    C[k] += B[k] 
  B = []
for l in range(N):
  if C[l] == 0:
    e += 1
print(e)
Problem p02693 (python)

Fixed submission:
K = int(input())
A, B = map(int,input().split())
C = A % K
if B - A >= K - 1:
  print('OK')
elif C == 0:
  print('OK')
elif C + B - A >= K:
  print('OK')
else:
  print('NG')

Buggy submission (verdict: Runtime Error):
K = int(input())
A, B = map(int,input().split())
C = A % K
if B - A >= K - 1:
  print('OK')
elif C == o:
  print('OK')
elif C + B - A >= K:
  print('OK')
else:
  print('NG')
Problem p02682 (python)

Fixed submission:
a=input()
b=a.split()

x1=int(b[0]) #1
x2=int(b[1]) #0
x3=int(b[2]) #-1
x4=int(b[3]) #k

if x4 <= x1:
	print(x4)

elif x4 <= x1+x2:
	print(x1)

else:
	print(x1-(x4-x1-x2))

Buggy submission (verdict: Runtime Error):
a=input()
b=a.split()

num=[]

x1=[1]*int(b[0])
x2=[0]*int(b[1])
x3=[-1]*int(b[2])

num[len(num):len(num)]=x1
num[len(num):len(num)]=x2
num[len(num):len(num)]=x3

k=int(b[3])
print(sum(num[0:k]))
Problem p02547 (python)

Fixed submission:
n = int(input())
li = list()
for i in range(n):
    a, b = [int(x) for x in input().split()]
    li.append([a,b])

count = 0
for i in li:
    if count < 3:
        if i[0] == i[1]:
            count += 1
        else:
            count = 0
    else:
        break

if count >= 3: print('Yes')
else: print('No')

Buggy submission (verdict: Runtime Error):
n = int(input())
li = [0] * n
for i in range(n):
    a, b = [int(x) for x in input().split()]
    li.append([a,b])
count = 0
for i in li:
    if i[0] == i[1]:
        count += 1
    else:
        count = 0

if count == 0: print('Yes')
else: print('No')
Problem p02577 (python)

Fixed submission:
n = input()
a = [int(i) for i in n]
if sum(a) % 9 == 0: print("Yes")
else: print("No")

Buggy submission (verdict: Runtime Error):
n = input()
a = [i for i in n]
if sum(a) % 9 == 0: print("Yes")
else: print("No")
Problem p02699 (python)

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

if w >= s:
    print('unsafe')
else:
    print('safe')

Buggy submission (verdict: Runtime Error):
s, w = input().split()
if w >= s:
    print('unsafe'):
else:
    print('safe')
Problem p02546 (python)

Fixed submission:
word = input()
if(word[-1] == 's'):
	print(word+'es')
else:
	print(word+'s')

Buggy submission (verdict: Runtime Error):
word = input()
if(word[-s] == 's'):
	print(word+'es')
else:
	print(word+'s')

Buggy submission (verdict: Runtime Error):
word = input()
	if(word[-s] == 's'):
    	print(word+'es')
    else:
    	print(word+'s')

Buggy submission (verdict: Runtime Error):
word = input()
	if(word[-s] == 's'):
    	print(word+'es')
    else:
    	print(word+'s')

Buggy submission (verdict: Runtime Error):
word = input()
	if(word[-1] == 's'):
  		print(word+'es')
 	else:
      print(word+'s')
Problem p02546 (python)

Fixed submission:
# -*- coding: utf-8 -*-
"""
Created on Sat Sep 19 13:03:22 2020

@author: Admin
"""

a=input()
if a[-1]=='s':
    print(a+'es')
else:
    print(a+'s')

Buggy submission (verdict: Runtime Error):
# -*- coding: utf-8 -*-
"""
Created on Sat Sep 19 13:14:17 2020

@author: Admin
"""


n,x,m=input().split()
m=int(m)
a=[int(x)]
for i in range(1,int(n)):
    zp=a[i-1]
    z=zp**2
    a.append(z%m)
    
print(sum(a))
Problem p02546 (python)

Fixed submission:
word = input()
 
if word[-1] == 's':
	print(word + 'es')
else:print(word + 's')

Buggy submission (verdict: Runtime Error):
word = int(input())

if word[-1] == 's': 
	print(word + 'es')
else:
	print(word + 's')
Problem p02633 (python)

Fixed submission:
import math
x=int(input())
print(360//math.gcd(360,x))

Buggy submission (verdict: Runtime Error):
x = int(input())
print([360*n//x for n in range(1, 500) if 360 % x == 0][0])

Buggy submission (verdict: Runtime Error):
x = int(input())
print([360*n//x for n in range(1, 1000) if 360 % x == 0][0])
Problem p02785 (python)

Fixed submission:
monster, skill = map(int,input().split())

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

monster_hp.sort()

attack_count = 0

while(skill>0):
    skill -= 1
    if len(monster_hp) > 0:    
        monster_hp.pop(-1)
    

for hp in monster_hp:
    attack_count += hp

print(attack_count)

Buggy submission (verdict: Runtime Error):
monster, skill = map(int,input().split())

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

monster_hp.sort()

attack_count = 0

while(skill>0):
    skill -= 1
    if len(monster_hp) > 0:    
        monster_hp.pop(-1)
    print(monster_hp)

for hp in monster_hp:
    attack_count += hp

print(attack_count)

Buggy submission (verdict: Runtime Error):
monster, skill = map(int,input().split())

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

monster_hp.sort()

attack_count = 0

while(skill>0):
    skill -= 1
    monster_hp.pop(-1)

for hp in monster_hp:
    attack_count += hp

print(attack_count)

Buggy submission (verdict: Runtime Error):
monster, skill = map(int,input().split())

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

monster_hp.sort()

attack_count = 0

while(skill>0):
    skill -= 1
    monster_hp.pop(-1)

for hp in monster_hp:
    attack_count += hp

print(hp)

Buggy submission (verdict: Runtime Error):
monster, skill = map(int,input().split())

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

sorted_monster_hp = monster_hp.sort()

attack_count = 0

while(skill>0):
    skill -= 1
    sorted_monster_hp.pop(-1)

for hp in sorted_monster_hp:
    attack_count += hp

print(hp)
Problem p02829 (python)

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

answer_list = [1,2,3]

answer_list.remove(a)
answer_list.remove(b)

print(answer_list[0])

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

answer_list = [1,2,3]
pop_list = []

for i in answer_list:
    if i == a:
        answer_list.pop(i)


for i in answer_list:
    if i == b:
        answer_list.pop(i)


print(answer_list[0])