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

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

for i in range(a, min(b, a + k - 1) + 1):
    print(i)
for i in range(max(a + k, b - k + 1), b + 1):
    print(i)

exit()
l = list(range(a, b + 1))
ans = []
ans.extend(l[:min(k,len(l))])
ans.extend(l[max(0,len(l) - k):])

ans = sorted(list(set(ans)))
for a in ans:
   print(a)

Buggy submission (verdict: Runtime Error):
a, b, k = map(int, input().split())

l = list(range(a, b + 1))
ans = []
ans.extend(l[:min(k,len(l))])
ans.extend(l[max(0,len(l) - k):])

ans = sorted(list(set(ans)))
for a in ans:
   print(a)

Buggy submission (verdict: Runtime Error):
a, b, k = map(int, input().split())

l = list(range(a, b + 1))
ans = []
ans.extend(l[:min(b,k)])
ans.extend(l[max(len(l) - k,a):])

ans = list(set(ans))
ans = sorted(ans)
for a in ans:
   print(a)

Buggy submission (verdict: Runtime Error):
a, b, k = map(int, input().split())

l = list(range(a, b + 1))
ans = []
ans.extend(l[:k])
ans.extend(l[len(l) - k:])

ans = list(set(ans))
ans = sorted(ans)
for a in ans:
   print(a)

Buggy submission (verdict: Runtime Error):
a, b, k = map(int, input().split())

l = list(range(a, b + 1))
ans = []
ans.extend(l[:k])
ans.extend(l[len(l) - k:])

ans = sorted(list(set(ans)))
for a in ans:
   print(a)
Problem p02922 (python)

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

ans = 0
outlet = 1
while outlet < B:
    outlet -= 1
    outlet += A
    ans += 1
print(ans)

Buggy submission (verdict: Runtime Error):
A = int(input())
B = int(input())

if A % B == 0:
    print(B // A)
else:
    print(A // B + 1)
Problem p02899 (python)

Fixed submission:
n = int(input())
a = tuple(map(int, input().split()))
b = dict((j,i + 1) for i, j in enumerate(a))
for i in sorted(a):
    print(b[i], end=' ')

Buggy submission (verdict: Runtime Error):
n = int(input())
a = *map(int, input().split()),
for i in range(1, n+1):
    print(a.index(i)+1, end = ' ')
Problem p03416 (python)

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


# Ar = int(A[::-1])
A = int(A)
B = int(B)

# print(Ar)
# print(A)
# print(B)

count = 0
while A <= B:
  As = str(A)
  Ar = int(As[::-1])

  if A == Ar:
    # print("Yes")
    count+=1
  A +=1

print(count)

Buggy submission (verdict: Runtime Error):
A,B = map(str, input().split())


# Ar = int(A[::-1])
A = int(A)
B = int(B)

# print(Ar)
# print(A)
# print(B)

count = 0
while A <= B:
  As = str(A)
  Ar = int(As[::-1])

  if A == Ar:
    # print("Yes")
    count+=1
  else:
    # print("No")
  A +=1

print(count)
Problem p03456 (python)

Fixed submission:
import math

a,b = map(str, input().split())

c = a + b
d = int(c)

e = math.sqrt(d)

if e.is_integer() == True:
  print("Yes")
else:
  print("No")

Buggy submission (verdict: Runtime Error):
import math

a = str(input())
b = str(input())

c = a + b
d = int(c)

print(d)

e = math.sqrt(d)
# e = int(e)

print(e)

if e.is_integer() == True:
  print("Yes")
else:
  print("No")
Problem p03998 (python)

Fixed submission:
SA = list(input())
SB = list(input())
SC = list(input())

x = "a"

while True:
  if x == "a":
    if len(SA) ==0:
      print("A")
      exit()

    x = SA[0]
    SA.remove(x)
  
  elif x == "b":
    if len(SB) ==0:
      print("B")
      exit()

    x = SB[0]
    SB.remove(x)

  else:
    if len(SC) == 0:
      print("C")
      exit()
    
    x = SC[0]
    SC.remove(x)

Buggy submission (verdict: Runtime Error):
SA = list(input())
SB = list(input())
SC = list(input())

x = "a"

while True:
  if x == "a":
    if len(SA) ==0:
      print("A")
      exit()

    x = SA[0]
    SA.remove(x)
  
  elif x == "b":
    if len(SB) ==0:
      print("B")
      exit()

    x = SB[0]
    SB.remove(x)

  else:
    if len(SB) == 0:
      print("C")
      exit()
    
    x = SC[0]
    SC.remove(x)
Problem p02899 (python)

Fixed submission:
n = int(input())
array = list(map(int, input().split()))
map = {}
for i in range(n):
    map[array[i]] = str(i+1)
list = []
for i in range(1, n+1):
    list.append(map[i])
print(" ".join(list))

Buggy submission (verdict: Runtime Error):
n = int(input())
array = list(map(int, input().split()))
for i in range(n):
    map[array[i]] = str(i+1)
print(" ".join([map[i] for i in range(1, n+1)]))

Buggy submission (verdict: Runtime Error):
n = map(int, input())
array = list(map(int, (input().split())))
map = {}
# make map to get table.
for i in range(n):
    map[array[i]] = i+1
# from 1 to n
list = []
for i in range(1, n+1):
    list.append(map[i])
print(list)

Buggy submission (verdict: Runtime Error):
n = map(int, input())
array = list(map(int, input().split()))
map = {}
# make map to get table.
for i in range(n):
    map[array[i]] = i+1
# from 1 to n
list = []
for i in range(1, n+1):
    list.append(map[i])
print(list)

Buggy submission (verdict: Runtime Error):
n = input()
array = map(int, input().split())
map = {}
# make map to get table.
for i in range(n):
    map[array[i]] = i+1
# from 1 to n
list = []
for i in range(1, n+1):
    list.append(map[i])
print(list)
Problem p03059 (python)

Fixed submission:
A, B, T = map(int, input().split())
print(int(T+0.5)//A * B)

Buggy submission (verdict: Runtime Error):
n = int(input())
a_list = [int(i) for i in input().split()]
minus_count_even_flug = True
zero_exist_flug = False
  
for a in a_list:
    if a < 0:
        minus_count_even_flug = not minus_count_even_flug
    if a == 0:
        zero_exist_flug = True
     
a_abs_list = [abs(a) for a in a_list]
sum_a_abs_list = sum(a_abs_list)
if minus_count_even_flug or zero_exist_flug:
    print(sum_a_abs_list)
else:
    print(sum_a_abs_list - 2 * min(a_abs_list))

Buggy submission (verdict: Runtime Error):
A, B, T = map(int, input().split())
return ((T+0.5)//A * B)
Problem p03071 (python)

Fixed submission:
data = input()
a,b = data.split()
a = int(a)
b = int(b)
if(a==b):
  print(a+b)
elif(a>b):
  print(2*a-1)
else:
  print(2*b-1)

Buggy submission (verdict: Runtime Error):
data = input()
a,b = data.split()
if(a==b):
  print(a+b)
elif(a>b):
  print(2*a-1)
else:
  print(2*b-1)
Problem p02900 (python)

Fixed submission:
from math import sqrt, ceil
 
a, b = map(int, input().split())
 
c_a = set()
c_b = set()
 
for i in range(1, ceil(sqrt(a))+1):
  if a % i == 0:
    c_a.add(i)
    if i > 1:
        while a % i == 0:
            a = a // i
if a != 1:
    c_a.add(a)
 
for j in range(1, ceil(sqrt(b))+1):
  if b % j == 0:
    c_b.add(j)
    if j > 1:
        while b % j == 0:
            b = b // j
if b != 1:
    c_b.add(b)
 
ans = c_a.intersection(c_b)
 
print(len(ans))

Buggy submission (verdict: Runtime Error):
a=int(input())
b=int(input())
l=[]
count=0
for i in range(2,min(a,b)+1):
  if a%i==0 and b%i==0:
    l.append(i)
for j in range(0,len(l)):
  for k in rage(0,j-1):
    
  if l[j+1]%l[k]!=0:
    count=count+1
print(count+1)
Problem p02898 (python)

Fixed submission:
x,y=map(int,input().split())
m=list(map(int,input().split()))
ans=0
for i in m:
    if i>=y:
        ans += 1
print(ans)

Buggy submission (verdict: Runtime Error):
x,y=map(int,input().split())
m=list(map(int,input().split()))
ans=0
for i in m:
    if m[i]>=y:
        ans += 1
print(ans)

Buggy submission (verdict: Runtime Error):
x,y=map(int,input().split())
m=list(map(int,input().split())
ans=0
for i in m:
       if m[i]>=y:
       ans += 1
print(ans)

Buggy submission (verdict: Runtime Error):
x,y=map(int,input().split())
m=list(map(int,input().split())
ans=0
for i in m:
    if m[i]>=y:
        ans += 1
print(ans)
Problem p02903 (python)

Fixed submission:
H,W,A,B=map(int,input().split())
for i in range(B):
            print("0"*A +"1"*(W-A))
for i in range(H-B):
            print("1"*A +"0"*(W-A))

Buggy submission (verdict: Runtime Error):
H,W,A,B=map(int,input().split()
for i in range(B):
            print("0"*A +"1"*(W-A))
for i in range(H-B):
            print("1"*A +"0"*(W-A))

Buggy submission (verdict: Runtime Error):
H,W,A,B=map(int,input().split()
for i in range(B)
            print("0"*A +"1"*(W-A))
for i in range(H-B)
            print("1"*A +"0"*(W-A))
Problem p02999 (python)

Fixed submission:
X,A=input().split()
if int(X)>=int(A):
  print(10)
else:
  print(0)

Buggy submission (verdict: Runtime Error):
X,A=input().split()
if x>=A:
  print(10)
else:
  print(0)
Problem p02898 (python)

Fixed submission:
n, k = [int(x) for x in input().split(' ')]
friends = [int(x) for x in input().split(' ')]
count = 0
for friend in friends:
    if friend >= k:
        count += 1
print(count)

Buggy submission (verdict: Runtime Error):
n = int(input())
k = int(input())
count = 0
for i in range(n):
    if int(input()) >= k:
        count += 1

print(count)
Problem p02921 (python)

Fixed submission:
s=input()
t=input()
if s[0]==t[0] and s[1]==t[1] and s[2]==t[2]:
    print("3")
elif (s[0]==t[0] and s[1]==t[1])or(s[1]==t[1] and s[2]==t[2])or(s[0]==t[0] and s[2]==t[2]):
    print("2")
elif s[0]==t[0] or s[1]==t[1] or s[2]==t[2]:
    print("1")
else:
    print("0")

Buggy submission (verdict: Runtime Error):
s=input()
t=input()
if s[0]==t[0] and s[1]==t[1] and s[2]==t[2]:
    print("3")
elif (s[0]==t[0] and s[1]==t[1])or(s[1]==t[1] and s[2]==t[2])or(s[3]==t[3] and s[2]==t[2]):
    print("2")
elif s[0]==t[0] or s[1]==t[1] or s[3]==t[3]:
    print("1")
else:
    print("0")
Problem p03101 (python)

Fixed submission:
H, W = map(int, input().split())
h, w = map(int, input().split())
all = H * W
print(all - (h*W + w * H - h*w))

Buggy submission (verdict: Runtime Error):
import numpy as np

N, M = map(int, input().split())
A = []
B = []

for i in range(0, N):
    a, b = np.array(list(map(float, input().split())))
    A.append(a)
    B.append(b)

cnt = 0
sum = 0
flag = 0
inf = float('inf')
arrayA = np.array(A)
arrayB = np.array(B)
for j in range(0, N):
    idx = A.index(min(arrayA))
    pay = arrayA[idx]
    num = arrayB[idx]
    arrayA[idx]=inf
    if cnt + num < M :
        cnt += num
        sum += pay*num
    else :
        diff = int(M - cnt)
        for t in range(0, diff):
            sum += pay
            cnt += 1
            if cnt == M :
                flag = 1
                print(int(sum))
                break
    if flag == 1:
        break
Problem p02917 (python)

Fixed submission:
n = int(input())
b = list(map(int, input().split()))
a = [int(0) for i in range(n)]
a[0] = b[0]
a[n-1] = b[n-2]
b.append(b[n-2])
for i in range(1,n-1):
    a[i] = min(b[i-1], b[i])
print(sum(a))

Buggy submission (verdict: Runtime Error):
n = int(input())
b = [*map(int, input().split())]
sum_a = b[0] + b[-1]
for i in range(1,n-1):
    sum_a += min(b[i],b[i-1])
print (sum_a)

Buggy submission (verdict: Runtime Error):
n = int(input())
b = [*map(int, input().split())]

sum_a = b[0] + b[-1]
for i in range(1,n-1):
    sum_a += min(b[i],b[i-1])
print (sum_a)

Buggy submission (verdict: Runtime Error):
n = int(input())
b = [*map(int, input().split())]

a = []
a.append(b[0])
for i in range(1,n-1):
    a.append(min(b[i],b[i-1]))
a.append(b[-1])
print (sum(a))

Buggy submission (verdict: Runtime Error):
n = int(input())
b = [*map(int, input().split())]

a = []
a.append(b[0])
for i in range(1,n-1):
    a.append(min(b[i],b[i-1]))
a.append(b[-1])
print (sum(a))
Problem p02911 (python)

Fixed submission:
X = list(map(int, input().split()))
N = [X[1]-X[2]]*X[0]
Q = []
for i in range(X[2]):
  Q.append(int(input()))
for i in range(X[2]):
  N[Q[i]-1]+=1
for result in N:
  if(result >= 1):
    print('Yes')
  else:
    print('No')

Buggy submission (verdict: Runtime Error):
X = list(map(int, input().split()))
N = [X[1]-X[2]]*X[0]
Q = []
for i in range(X[2]):
  Q.append(int(input()))
for i in range(X[2]):
  N[Q[i]]+=1
for result in N:
  if(result >= 1):
    print('Yes')
  else:
    print('No')
Problem p02910 (python)

Fixed submission:
a=input()

for i in range(len(a)):
  if a[i]=='L' and i%2==0:
    print('No')
    exit()
    
  if a[i]=='R' and i%2==1:
    print('No')
    exit()

print("Yes")

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

for i in range(len(a)):
  if a[i]=='L' and i%2==0:
    print('No')
    exit()
    
  if a[i]=='R' and i%2==1:
    print('No')
  	exit()
  
print("Yes")
Problem p02911 (python)

Fixed submission:
n,k,q=map(int,input().split())
a=[int(input())-1 for i in range(q)]
b=[0]*n


for i in range(q):
  b[a[i]]+=1

for i in range(n):
  if k-q+b[i]>0:
    print("Yes")
  else:
    print("No")

Buggy submission (verdict: Runtime Error):
n,k,q=map(int,input().split())
a=[int(input())-1 for i in range(q)]
b=[0]*n


for i in range(q):
  b[a[i]]+=1

for i in range(n):
  if k-n+b[i]>0:
    print("Yes")
  else
    print("No")
Problem p03160 (python)

Fixed submission:
n=int(input())
a=list(map(int,input().split()))
b=10**10
c=[b]*n
c[0]=0
c[1]=abs(a[1]-a[0])
for i in range(n-2):
    for j in range(1,3):
        c[i+j]=min(c[i+j],c[i]+abs(a[i+j]-a[i]))
c[-1]=min(c[-1],c[-2]+abs(a[-2]-a[-1]))
print(c[-1])

Buggy submission (verdict: Runtime Error):
import math
n=int(input())
a=list(map(int,input().split()))
b=math.inf
c=[b]*n
c[0]=0
c[1]=abs(a[1]-a[0])
for i in range(n-2):
    for j in range(1,3):
        c[i+j]=min(c[i+j],c[i]+abs(a[i+j]-a[i]))
c[-1]=min(c[-1],c[-2]+abs(a[-2]-a[-1]))
print(c[-1])
Problem p02995 (python)

Fixed submission:
def C_AntiDivision():
    from sys import version_info
    try:
        from math import gcd
    except:
        from fractions import gcd
    a,b,c,d = map(int, input().split())
    total = b - a + 1
    total_c = (b // c) + (-a // c) + 1
    total_d = (b // d) + (-a // d) + 1
    gcd_cd = c*d // gcd(c,d)
    total_cd = (b // gcd_cd) + (-a // gcd_cd) + 1
    #print(total_c, total_d, total_cd, gcd_cd)
    print(int(total - total_c - total_d + total_cd))

if __name__ == "__main__":
    C_AntiDivision()

Buggy submission (verdict: Runtime Error):
def C_AntiDivision():
    from math import gcd
    a,b,c,d = map(int, input().split())
    total = b - a + 1
    total_c = (b // c) + (-a // c) + 1
    total_d = (b // d) + (-a // d) + 1
    gcd_cd = c*d // gcd(c,d)
    total_cd = (b // gcd_cd) + (-a // gcd_cd) + 1
    #print(total_c, total_d, total_cd, gcd_cd)
    print(int(total - total_c - total_d + total_cd))

if __name__ == "__main__":
    C_AntiDivision()
Problem p03014 (python)

Fixed submission:
def D_Lamp():
    import numpy as np
    # input & init
    h, w = map(int, input().split())
    S = np.array([list(input()) for _ in range(h)]) == "."
    L = np.zeros((h,w), dtype=int)
    R = np.zeros((h,w), dtype=int)
    U = np.zeros((h,w), dtype=int)
    D = np.zeros((h,w), dtype=int)
    # calc row
    for row in range(h):
        D[row] =(D[row - 1] + 1) * S[row]
        U[-row - 1] = (U[-row] + 1) * S[-row -1]
    # calc col
    for col in range(w):
        R[:, col] = (R[:, col - 1] + 1) * S[:, col]
        L[:, -col - 1] = (L[:, -col] + 1) * S[:, -col-1]
    num_max = 0
    print(np.max(L+R+U+D) - 3)

if __name__ == "__main__":
    D_Lamp()

Buggy submission (verdict: Runtime Error):
def D_Lamp():
    h, w = map(int, input().split())
    S = [[0 for i in range(w)] for j in range(h)]
    for row in range(h):
        si = input()
        for col in range(w):
            if "." == si[col]:
                S[row][col] = 1
    S_row = calc_point_row(h,w,S)
    S_col = calc_point_col(h,w,S)
    # 
    num_max = 0
    for row in range(h):
        for col in range(w):
            s_num = S_row[row][col] + S_col[row][col] - 1
            num_max = max(num_max, s_num)
    print(num_max)
def calc_point_row(h,w,S):
    S_tmp = [[0 for i in range(w)] for j in range(h)]
    for row in range(h):
        sum_w = 0
        for col in range(w):
            if 1 == S[row][col]:
                sum_w += 1
            elif (sum_w == 0):
                S_tmp[row][col] = 0
            else:
                for x in range(sum_w):
                    S_tmp[row][col-x-1] = sum_w
                sum_w = 0
        if (sum_w == w):
            for x in range(sum_w):
                S_tmp[row][i] = sum_w
        elif (sum_w != 0):
            for x in range(sum_w):
                S_tmp[row][w-x-1] = sum_w
    return S_tmp
def calc_point_col(h,w,S):
    S_tmp = [[0 for i in range(w)] for j in range(h)]
    for col in range(w):
        sum_w = 0
        for row in range(h):
            if 1 == S[row][col]:
                sum_w += 1
            elif (sum_w == 0):
                S_tmp[row][col] = 0
            else:
                for x in range(sum_w):
                    S_tmp[row-x-1][col] = sum_w
                sum_w = 0
        if (sum_w == h):
            for x in range(sum_w):
                S_tmp[x][col] = sum_w
        elif (sum_w != 0):
            for x in range(sum_w):
                S_tmp[h-x-1][col] = sum_w
    return S_tmp

if __name__ == "__main__":
    D_Lamp()
Problem p03030 (python)

Fixed submission:
def Guidebook():
    n = int(input())
    rest = []
    for i in range(n):
        s, p = map(str, input().split())
        rest.append([i+1, s, int(p)])

    rest.sort(key=lambda x:x[2], reverse=True)
    rest.sort(key=lambda x:x[1])
    for i in range(n):
        print(rest[i][0])
if __name__ == "__main__":
    Guidebook()

Buggy submission (verdict: Runtime Error):
from operator import itemgetter
n = int(input())
rest = []
for i in range(n):
    s, p = map(str, input().split())
    rest.append([i+1, s, int(p)])

    rest.sort(key=itemgetter(2), reverse=True)
    rest.sort(key=itemgetter(1))
    for i in range(n):
      print(rest[i][0])

Buggy submission (verdict: Runtime Error):
from operator import itemgetter
n = int(input())
rest = []
for i in range(n):
  s, p = map(str, input().split())
  rest.append([i+1, s, int(p)])

  rest = sorted(rest, key=itemgetter(2), reverse=True)
  rest = sorted(rest, key=itemgetter(1))
  for i in range(n):
    print(rest[i][0])
Problem p03031 (python)

Fixed submission:
def Switches():
    from math import log2
    N, M = map(int, input().split())
    # m行n列
    switchList = []

    # スイッチの組み合わせ取得
    for i in range(M):
        k = list(map(int, input().split()))
        k = k[1:]
        # print(k)
        switchList.append([True * (i+1 in k) for i in range(N)])
    p = list(map(int, input().split()))
    # print(switchList)
    result = 0

    # 2bit化し、条件比較を行い結果がpと等しければ正解とする
    for i in range(2**N):
        tmp = format(i, "0"+str(N)+"b")
        tmp = [int(j) for j in tmp]
        # print(tmp)
        tmp = [sum([switchList[k][j] * tmp[j] for j in range(N)]) % 2 for k in range(M)]
        if p == tmp:
            result += 1

    print(result)

if __name__ == "__main__":
    Switches()

Buggy submission (verdict: Runtime Error):
def Switches():
    from math import log2
    N, M = map(int, input().split())
    # m行n列
    switchList = []

    # スイッチの組み合わせ取得
    for i in range(M):
        k = list(map(int, input().split()))
        k = k[1:]
        # print(k)
        switchList.append([True * (i+1 in k) for i in range(N)])
    p = list(map(int, input().split()))
    # print(switchList)
    result = 0

    # 2bit化し、条件比較を行い結果がpと等しければ正解とする
    for i in range(2**N):
        tmp = format(i, "0"+str(N)+"b")
        tmp = [int(j) for j in tmp]
        # print(tmp)
        tmp = [sum([switchList[k][j] * tmp[j] for j in range(N)]) % 2 for k in range(M)]
        if p == tmp:
            result += 1

    print(result)

if __name__ == "__main__":
    Switches()
Problem p03061 (python)

Fixed submission:
from fractions import gcd
# input
N = int(input())
A = list(map(int,input().split()))
L_A = [0] * (N+1)
R_A = [0] * (N+1)
for i in range(N):
    L_A[1+i] = gcd(L_A[i], A[i])
for i in reversed(range(N)):
    R_A[i] = gcd(R_A[i+1], A[i])
print(max(gcd(L_A[i], R_A[i+1]) for i in range(N)))

Buggy submission (verdict: Runtime Error):
from functools import reduce
from fractions import gcd
N = int(input())
A = list(map(int,input().split()))
A.sort(reverse=True)
gcd_max = 0
if (N > 4):
    for i in range(4):
        gcd_now = reduce(gcd, list(x for x in A if x != A[i]))
        if (gcd_max < gcd_now): gcd_max = gcd_now
    for i in range(N):
        gcd_now = gcd(gcd_max, A[i])
        if (gcd_max < gcd_now): gcd_max = gcd_now
else:
    for i in range(N):
        gcd_now = reduce(gcd, list(x for x in A if x != A[i]))
        if (gcd_max < gcd_now): gcd_max = gcd_now
    
print(gcd_max)

Buggy submission (verdict: Runtime Error):
from functools import reduce
from fractions import gcd
N = int(input())
A = list(map(int,input().split()))
gcd_max = 0
for i in range(N):
    gcd_now = reduce(gcd, list(x for x in A if x != A[i]))
    if (gcd_max < gcd_now): gcd_max = gcd_now
    
print(gcd_max)

Buggy submission (verdict: Runtime Error):
from functools import reduce
from math import gcd
N = int(input())
A = list(map(int,input().split()))
gcd_max = 0
for i in range(N):
    gcd_now = reduce(gcd, list(x for x in A if x != A[i]))
    if (gcd_max < gcd_now): gcd_max = gcd_now
    
print(gcd_max)
Problem p04045 (python)

Fixed submission:
def C_IrohasObsession():
    N, K = map(int, input().split())
    D = list(map(int, input().split()))
    ans = 0
    for x in range(N, 100000):
        for y in str(x):
            if int(y) in D:
                break
        else:
            ans = int(x)
            break
    print(ans)

if __name__ == "__main__":
    C_IrohasObsession()

Buggy submission (verdict: Runtime Error):
def C_IrohasObsession():
    N, K = map(int, input().split())
    D = list(map(int, input().split()))
    D_tmp = []
    for x in range(10):
        if x not in D:
            D_tmp.append(x)
    for x in range(len(D_tmp)):
        ans = D_tmp[-1] * (10**(x))
    if N > ans:
        ans = D_tmp[1] * (10 ** (len(str(N))-1))
    else:
        ans = 0
        for i_1 in D_tmp:
            if ans > N: break
            ans = i_1
            if len(str(N)) <= len(str(ans)): continue
            for i_10 in D_tmp:
                if ans > N: break
                ans = i_10 * 10 + i_1
                if len(str(N)) <= len(str(ans)): continue
                for i_100 in D_tmp:
                    if ans > N: break
                    ans = i_100 * 100 + i_10 * 10 + i_1
                    if len(str(N)) <= len(str(ans)): continue
                    for i_1000 in D_tmp:
                        if ans > N: break
                        ans = i_1000 * 1000 + i_100 * 100 + i_10 * 10 + i_1
    print(ans)

if __name__ == "__main__":
    C_IrohasObsession()

Buggy submission (verdict: Runtime Error):
def C_IrohasObsession():
    N, K = map(int, input().split())
    D = list(map(int, input().split()))
    D_tmp = []
    for x in range(10):
        if x not in D:
            D_tmp.append(x)
    for x in range(len(D_tmp)):
        ans = D_tmp[-1] * (10**(x+1))
    if N > ans:
        ans = D_tmp[1] * (10 ** len(str(N-1)))
    else:
        ans = 0
        for i_1 in D_tmp:
            if ans > N: break
            ans = i_1
            if len(str(N)) <= len(str(ans)): continue
            for i_10 in D_tmp:
                if ans > N: break
                ans = i_10 * 10 + i_1
                if len(str(N)) <= len(str(ans)): continue
                for i_100 in D_tmp:
                    if ans > N: break
                    ans = i_100 * 100 + i_10 * 10 + i_1
                    if len(str(N)) <= len(str(ans)): continue
                    for i_1000 in D_tmp:
                        if ans > N: break
                        ans = i_1000 * 1000 + i_100 * 100 + i_10 * 10 + i_1
    print(ans)

if __name__ == "__main__":
    C_IrohasObsession()
Problem p02945 (python)

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

Buggy submission (verdict: Runtime Error):
K, X = map(int, input().split())
for i in range(X - K + 1, X + K):
if i < X + K - 1:
print(i, end=' ')
else:
print(i)

Buggy submission (verdict: Runtime Error):
 K, X = map(int, input().split())
2 for i in range(X - K + 1, X + K):
3 if i < X + K - 1:
4 print(i, end=' ')
5 else:
6 print(i)
Problem p02946 (python)

Fixed submission:
K, X = map(int, input().split())
for i in range(X - K + 1, X + K):
  if i < X + K - 1:
    print(i, end=' ')
  else:
    print(i)

Buggy submission (verdict: Runtime Error):
K, X = map(int, input().split())
for i in range(X - K + 1, X + K):
if i < X + K - 1:
print(i, end=' ')
else:
print(i)

Buggy submission (verdict: Runtime Error):
 K, X = map(int, input().split())
 for i in range(X - K + 1, X + K):
 if i < X + K - 1:
 print(i, end=' ')
 else:
 print(i)