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

Fixed submission:
N = int(input())

def count(a, b, c):
    return (a+b+c)**2-a*b-b*c-c*a

table = [0] * (N+1)
for x in range(1, 101):
    for y in range(1, 101):
        for z in range(1, 101):
            tmp = count(x, y, z)
            if tmp <= N:
                table[tmp] += 1
print(*table[1:], sep="\n")

Buggy submission (verdict: Runtime Error):
if N <= 10**3:
    for i in range(1, N+1):
        ans = 0
        for x in range(1, 13):
            for y in range(1, 13):
                for z in range(1, 13):
                    if (x+y+z)**2-x*y-y*z-z*x == i:
                        ans += 1
        print(ans)
    exit()
else:
    table = [0] * N
    for i in range(1, 10**3):
        ans = 0
        for x in range(1, 14):
            for y in range(1, 14):
                for z in range(1, 14):
                    if (x+y+z)**2-x*y-y*z-z*x == i:
                        ans += 1
        table[i-1] += ans
    print(*table, sep="\n")
    for j in range(10**3, N+1):
        print(0)
Problem p02664 (python)

Fixed submission:
T = list(input())
for i in range(len(T)):
    if i == 0:
        if T[i] == "?":
            if len(T) == 1:
                T[i] = "D"
                break
            if T[i+1] == "D":
                T[i] = "P"
            else:
                T[i] = "D"
    else:
        if T[i] == "?":
            T[i] = "D"
print("".join(T))

Buggy submission (verdict: Runtime Error):
T = list(input())
for i in range(len(T)):
    if i == 0:
        if T[i] == "?":
            if T[i+1] == "D":
                T[i] = "P"
            else:
                T[i] = "D"
    else:
        if T[i] == "?":
            T[i] = "D"
print("".join(T))

Buggy submission (verdict: Runtime Error):
T = input()
T = list(T)
for i in range(len(T)):
    if i == 0:
        if T[i] == "?":
            if T[i+1] == "D":
                T[i] = "P"
            else:
                T[i] = "D"
    else:
        if T[i] == "?":
            T[i] = "D"
print("".join(T))

Buggy submission (verdict: Runtime Error):
T = input()
T = list(T)
for i in range(len(T)):
    if i == 0:
        if T[i] == "?":
            if T[i+1] == D:
                T[i] = "P"
            else:
                T[i] = "D"
    else:
        if T[i] == "?":
            T[i] = "D"
print("".join(T))

Buggy submission (verdict: Runtime Error):
T = input()
T = list(T)
for i, v in enumerate(T):
    if i == 0:
        if T[i] == "?":
            if T[i+1] == D:
                T[i] = "P"
            else:
                T[i] = "D"
    else:
        if T[i] == "?":
            T[i] = "D"
print("".join(T))
Problem p02684 (python)

Fixed submission:
n, k = map(int, input().split())
a = list(map(int, input().split()))
g = dict()

for i, v in enumerate(a):
    g[i+1] = v

def find_num(target):
    path = 1
    target_ = g[target]
    while target_ != target:
        target_ = g[target_]
        path += 1
    return path

target = 1
visited = dict()
flag = False
for i in range(k):
    target = g[target]
    if target not in visited:
        visited[target] = True
    else:
        p = find_num(target)
        flag = True
        break
if flag:
    for _ in range((k-1-i)%p):
        target = g[target]
    print(target)
else:
    print(target)

Buggy submission (verdict: Runtime Error):
n, k = map(int, input().split())
a = list(map(int, input().split()))
g = dict()

for i, v in enumerate(a):
    g[i+1] = v

def find_num(target):
    path = 1
    target_ = g[target]
    while target_ != target:
        target_ = g[target_]
        path += 1
    return path

target = 1
visited = dict()
for i in range(k):
    target = g[target]
    if target not in visited:
        visited[target] = True
    else:
        p = find_num(target)
        break
for _ in range((k-1-i)%p):
    target = g[target]
print(target)
Problem p02761 (python)

Fixed submission:
n, m = map(int,input().split())
arr = [list(map(int,input().split())) for _ in range(m)]
if n == 1:
    for i in range(10):
        tmp = str(i)
        flag = True
        for j in range(m):
            if tmp[arr[j][0]-1] != str(arr[j][1]):
                flag = False
        if flag:
            print(i)
            exit()
    print(-1)
else:
    for i in range(10**(n-1),10**n):
        tmp = str(i)
        flag = True
        for j in range(m):
            if tmp[arr[j][0]-1] != str(arr[j][1]):
                flag = False
        if flag:
            print(i)
            exit()
    print(-1)

Buggy submission (verdict: Runtime Error):
n, m = map(int,input().split())
arr = [list(map(int,input().split())) for _ in range(m)]
if n == 1:
    for i in range(10):
        tmp = str(i)
        flag = True
    for j in range(m):
        if tmp[arr[j][0]-1] != str(arr[j][1]):
            flag = False
    if flag:
        print(i)
        break
    else:
        print(-1)
else:
    for i in range(10**(n-1),10**n):
        tmp = str(i)
        flag = True
    for j in range(m):
        if tmp[arr[j][0]-1] != str(arr[j][1]):
            flag = False
    if flag:
        print(i)
        break
    else:
        print(-1)

Buggy submission (verdict: Runtime Error):
n, m = map(int, input().split())
d = dict()
for i in range(m):
    s, c = map(int, input().split())
    if s==1 and c==0:
        print("-1")
        exit()
    if s in d.keys() and d[s] != c:
        print("-1")
        exit()
    d[s] = c
if d[2] == 0 and 1 not in d.keys():
    print("-1")
    exit()
target = 0
for s, c in d.items():
    target += 10**(n-s)*c
print(target)
Problem p02768 (python)

Fixed submission:
mod = 10**9+7 
n, a, b = map(int, input().split())
whole = pow(2, n, mod)-1 # 2^n-1(mod p)を計算。
# nCaの計算
comb1=1
for i in range(n-a+1,n+1): # n*(n-1)*(n-2)*...*(n-a+1)(mod p)を計算
  comb1 *= i
  comb1 %= mod
for i in range(1,a+1): # 1/a!(mod p)を計算 フェルマーの小定理:1/a = a^p-2(mod p)を利用
  comb1 *= pow(i,mod-2,mod)
  comb1 %= mod
comb2=1
for i in range(n-b+1,n+1): # n*(n-1)*(n-2)*...*(n-b+1)(mod p)を計算
  comb2 *= i
  comb2 %= mod
for i in range(1,b+1):
  comb2 *= pow(i,mod-2,mod)
  comb2 %= mod
whole -= (comb1+comb2)
whole %= mod
print(whole)

Buggy submission (verdict: Runtime Error):
MOD = 10**9+7 # p=MOD
n, a, b = map(int, input().split())
whole = pow(2, n, MOD)-1 # 2^n-1(mod p)を計算。
# nCaの計算
comb1=1
for i in range(n-a+1,n+1): # n*(n-1)*(n-2)*...*(n-a+1)(mod p)を計算
  comb1 *= i
  comb1 %= mod
for i in range(1,a+1): # 1/a!(mod p)を計算 フェルマーの小定理:1/a = a^p-2(mod p)を利用
  comb1 *= pow(i,mod-2,mod)
  comb1 %= mod
comb2=1
for i in range(n-b+1,n+1): # n*(n-1)*(n-2)*...*(n-b+1)(mod p)を計算
  comb2 *= i
  comb2 %= mod
for i in range(1,b+1):
  comb2 *= pow(i,mod-2,mod)
  comb2 %= mod
whole -= (comb1+comb2)
whole %= mod
print(whole)

Buggy submission (verdict: Runtime Error):
MOD = 10**9+7 # p=MOD
n, a, b = map(int, input().split())
whole = pow(2, n, MOD)-1 # 2^n-1(mod p)を計算。
# nCaの計算
comb1=1
for i in range(n-a+1,n+1): # n*(n-1)*(n-2)*...*(n-a+1)(mod p)を計算
  comb1 *= i
  comb1 %= mod
for i in range(1,a+1): # 1/a!(mod p)を計算 フェルマーの小定理:1/a = a^p-2(mod p)を利用
  comb1 *= pow(i,mod-2,mod)
  comb1 %= mod
comb2=1
for i in range(n-b+1,n+1): # n*(n-1)*(n-2)*...*(n-b+1)(mod p)を計算
  comb2 *= i
  comb2 %= mod
for i in range(1,b+1):
  comb2 *= pow(i,mod-2,mod)
  comb2 %= mod
ans -= (comb1+comb2)
ans %= mod
print(ans)

Buggy submission (verdict: Runtime Error):
def combinations_count(n, r):
    return factorial(n) // (factorial(n - r) * factorial(r))
    
def main():
    n, a, b = map(int, input().split())
    whole = 2**n-1
    a = combinations_count(n, a)
    b = combinations_count(n, b)
    print((whole-a-b)%(10**9+7))

if __name__ == "__main__":
    main()
Problem p02803 (python)

Fixed submission:
def dfs(h, w): 
    m = -1
    visited = [[-1] * W for _ in range(H)]
    stack = []
    visited[h][w] = 0
    stack.append([h, w])
    while stack:
        h, w = stack.pop()
        for i in range(4):
            nh = h + dy[i]
            nw = w + dx[i]
            if nh >= H or nh < 0 or nw >= W or nw < 0:
                continue
            if s[nh][nw] == "." and visited[nh][nw] == -1:
                visited[nh][nw] = visited[h][w] + 1
                stack.append([nh, nw])
            if s[nh][nw] == "." and visited[nh][nw] != -1:
                if visited[nh][nw] > (visited[h][w]+1):
                    visited[nh][nw] = visited[h][w] + 1
                    stack.append([nh, nw])
    for i in range(H):
        if m <= max(visited[i]):
            m = max(visited[i])
    return m

H, W = map(int, input().split())
s = [input() for _ in range(H)]
dx = [0, 1, 0, -1]
dy = [1, 0, -1, 0]
m = -1
dist = 0
for i in range(H):
    for j in range(W):
        if s[i][j] == ".":
            dist = dfs(i, j)
            if m <= dist:
                m = dist
print(m)

Buggy submission (verdict: Runtime Error):
def dfs(h, w): # startからの距離の最大値をreturnする
    res = -1
    dist = [[-1] * W for _ in range(H)]
    stack = []
    dist[h][w] = 0
    stack.append([h, w])
    while stack:
        h, w = stack.pop()
        for i in range(4):
            nh = h + dy[i]
            nw = w + dx[i]
            if nh >= H or nh < 0 or nw >= W or nw < 0:
                continue
            if s[nh][nw] == "#":
                continue
            if dist[nh][nw] == -1:
                dist[nh][nw] = dist[h][w] + 1
                stack.append([nh, nw])
            if dist[nh][nw] != -1:
                if dist[nh][nw] > (dist[h][w]+1):
                    dist[nh][nw] = dist[h][w] + 1
                    stack.append([nh, nw])
    for i in range(H):
        if res <= max(visited[i]):
            res = max(visited[i])
    return res

H, W = map(int, input().split())
s = [input() for _ in range(H)]
dx = [0, 1, 0, -1]
dy = [1, 0, -1, 0]
m = -1
dist = 0
for i in range(H):
    for j in range(W):
        if s[i][j] == ".":
            dist = dfs(i, j)
            if m <= dist:
                m = dist
print(m)
Problem p02888 (python)

Fixed submission:
import bisect
N = int(input())
L = list(map(int, input().split()))
ans = 0
L.sort()
for a_i in range(N-2):
    for b_j in range(a_i+1, N-1):
        c_idx = bisect.bisect_left(L, L[a_i]+L[b_j])
        if c_idx > b_j:
            ans += c_idx - b_j - 1
print(ans)

Buggy submission (verdict: Runtime Error):
N = int(input())
L = list(map(int, input().split()))
res = 0
def dfs(A):
    global res, L
    ans = [i for i, v in enumerate(A) if v == 1]
    if len(A) == N:
        if len(ans) == 3:
            a, b, c = L[ans[0]], L[ans[1]], L[ans[2]]
            if a < (b + c) and b < (c + a) and c < (a + b):
                res += 1
        return
    elif len(ans) == 3:
        a, b, c = L[ans[0]], L[ans[1]], L[ans[2]]
        if a < (b + c) and b < (c + a) and c < (a + b):
            res += 1
        return
    else:
        for v in range(2):
            A.append(v)
            dfs(A)
            A.pop()
dfs([])
print(res)

Buggy submission (verdict: Runtime Error):
N = int(input())
L = tuple(map(int, input().split()))
res = 0
def dfs(A):
    global res, L
    ans = [i for i, v in enumerate(A) if v == 1]
    if len(A) > N:
        return 
    elif len(ans) == 3:
        a, b, c = L[ans[0]], L[ans[1]], L[ans[2]]
        if a < (b + c) and b < (c + a) and c < (a + b):
            res += 1
        return
    else:
        for v in range(2):
            A.append(v)
            dfs(A)
            A.pop()
dfs([])
print(res)

Buggy submission (verdict: Runtime Error):
N = int(input())
L = tuple(map(int, input().split()))
res = 0
def dfs(A):
    global res, L
    ans = [i for i, v in enumerate(A) if v == 1]
    if len(A) > N:
        return 
    elif len(ans) == 3:
        a, b, c = L[ans[0]], L[ans[1]], L[ans[2]]
        if a < (b + c) and b < (c + a) and c < (a + b):
            res += 1
        return
    else:
        for v in range(2):
            A.append(v)
            dfs(A)
            A.pop()
dfs([])
print(res)
Problem p02911 (python)

Fixed submission:
n, k, q = map(int, input().split())
points = [k] * n
a = []
for i in range(q):
    a.append(int(input())-1)
for cand in a:
    points[cand] += 1
points = [i-q for i in points]
ans = ["Yes" if i > 0 else "No" for i in points]
print(*ans, sep="\n")

Buggy submission (verdict: Runtime Error):
def main():
    N,K,Q=map(int,input().split())
    sum2=[]
    score=[K]*N
    for i in range(Q):
        num=int(input())
        comp[i][:num-1]=[-1]*[num-1]
        comp[i][num-1]=[0]
        comp[i][num:N]=[-1]*[N-num]
    for i in range(N):
        sum2.append(sum(comp[i]))
    for i,j in zip(score,sum2):
        score.append(i+j)
    for s in score:
        if s>0:
            print('Yes')
        else:
            print('No')

if __name__=='__main__':
    main()

Buggy submission (verdict: Runtime Error):
def main():
    N,K,Q=map(int,input().split())
    sum2=[]
    score=[K]*N
    for i in range(Q):
        num=int(input())
        comp[i][:num-1]=[-1]*[num-1]
        comp[i][num-1]=[0]
        comp[i][num:N]=[-1]*[N-num]
    for i in range(N):
        sum2.append(sum(comp[i]))
    for i,j in score,sum2:
        score.append(i+j)
    for s in score:
        if s>0:
            print('Yes')
        else:
            print('No')

if __name__=='__main__':
    main()

Buggy submission (verdict: Runtime Error):
def main():
    N,K,Q=map(int,input().split())
    sum2=[]
    score=[]
    for i in range(Q):
        num=int(input())
        comp[i][:num-1]=[-1]*[num-1]
        comp[i][num-1]=[0]
        comp[i][num:N]=[-1]*[N-num]
    for i in range(N):
        sum2.append(sum(comp[i]))
    for i,j in score,sum2:
        score.append(i+j)
    for s in score:
        if s>0:
            print('Yes')
        else:
            print('No')

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

Fixed submission:
N=int(input())
B=list(map(int,input().split()))
A=[]
A.append(B[0])
A.append(B[0])
num=0
for i in B:
    if num==0:        
        num+=1
    elif A[num]<=B[num]:
        A.append(B[num])
        num+=1
    elif A[num]>B[num]:
        A[num]=B[num]
        A.append(B[num])
        num+=1

max_sum=0
for i in A:
    max_sum+=i
print(max_sum)

Buggy submission (verdict: Runtime Error):
N=int(input())
B=list(map(int,input().split()))
A=[]
A.append(B[0])
A.append(B[0])
num=0
for i in B:
    if i==B[0]:
        num+=1
        continue
    elif A[num]<=B[num]:
        A.append(B[num])
        num+=1
    else:
        A[num]=B[num]
        A.append(B[num])
        num+=1

max_sum=0
for i in A:
    max_sum+=i
print(max_sum)
Problem p02918 (python)

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

h = 0
for i in range(len(S)-1):
  if S[i] == S[i+1]:
    h += 1
h += 2*K
print(min(N-1, h))

Buggy submission (verdict: Runtime Error):
N,K = map(int,input().split())
S = input()

h = 0
for i in range(len(S)-1):
  if s[i] == S[i+1]:
    h += 1
h += 2*K
print(min(N-1, h))
Problem p03126 (python)

Fixed submission:
N,M=map(int,input().split())
set_list=[]
sets=set()
for i in range(N):
    s=input().split()
    s.pop(0)
    set_list.append(set(s))
for set in set_list:
    if len(sets)==0:
        sets=set
    else:
        sets=sets.intersection(set)
print(len(sets))

Buggy submission (verdict: Runtime Error):


def main():
	N,M=map(int,input().split())
	like=[0]*M
	for _ in range(N):
    	K,*A=map(int,input().split())
    	for num in A:
        	like[num-1]+=1
print(like.count(N))

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

Fixed submission:
def main():
    n = int(input())
    h = list(map(int, input().split()))
    # dpテーブル作成,スタート地点のdpテーブルの値は0にする
    dp =[10**5] * n
    dp[0] = 0
    dp[1] = abs(h[0] - h[1])
    for i in range(2,n):
        dp[i] = min([dp[i-1]+abs(h[i-1]-h[i]), dp[i-2]+abs(h[i-2]-h[i])])
    print(dp[n-1])

if __name__ == "__main__":
    main()

Buggy submission (verdict: Runtime Error):
def main():
    import math
    n = int(input())
    h = list(map(int, input().split()))
    # dpテーブル作成,スタート地点のdpテーブルの値は0にする
    dp =[math.inf] * n
    dp[0] = 0
    dp[1] = abs(h[0] - h[1])
    for i in range(2,n):
        dp[i] = min([dp[i], dp[i-1]+abs(h[i-1]-h[i]), dp[i-2]+abs(h[i-2]-h[i])])
    print(dp[n-1])

if __name__ == "__main__":
    main()

Buggy submission (verdict: Runtime Error):
def main():
    import math
    n = int(input())
    h = list(map(int, input().split()))
    # dpテーブル作成,スタート地点のdpテーブルの値は0にする
    dp =[math.inf] * n
    dp[0] = 0
    dp[1] = abs(h[0] - h[1])
    for i in range(2,n):
        dp[i] = min([dp[i], dp[i-1]+abs(h[i-1]-h[i]), dp[i-2]+abs(h[i-2]-h[i])])
    print(dp[n-1])

if __name__ == "__main__":
    main()

Buggy submission (verdict: Runtime Error):
import math
def main():
    n = int(input())
    h = list(map(int, input().split()))
    # dpテーブル作成,スタート地点のdpテーブルの値は0にする
    dp =[math.inf] * n
    dp[0] = 0
    dp[1] = abs(h[0] - h[1])
    for i in range(2,n):
        dp[i] = min([dp[i], dp[i-1]+abs(h[i-1]-h[i]), dp[i-2]+abs(h[i-2]-h[i])])
    print(dp[n-1])

if __name__ == "__main__":
    main()
Problem p03695 (python)

Fixed submission:
def main():
    n = int(input())
    a = list(map(int, input().split()))
    color = [False] * 8
    sub_color = 0
    for score in a:
        for i in range(8):
            if i*400 <= score <= 399+(i*400):
                color[i] = True
        if score >= 3200:
            sub_color += 1
    cnt = len([x for x in color if x])
    if cnt == 0:
        print(1, sub_color, sep=" ")
    else:
        print(cnt, cnt+sub_color, sep=" ")

if __name__ == "__main__":
    main()

Buggy submission (verdict: Runtime Error):
def main():
    import sys
    n = int(input())
    a = list(map(int, input().split()))
    color = [0] * 8
    sub_color = 0
    count = 0
    for score in a
        if score <= 0:
            continue
        for i in range(8):
            if i*400 < score <= 399+(i*400):
                color[i] += 1
        if score >= 3200:
            sub_color += 1
    for j in color:
        if j != 0:
            count += 1
    if count + sub_color >= 8:
        print(count, 8, sep=" ")
    else:
        print(count, count+sub_color, sep=" ")

if __name__ == "__main__":
    main()

Buggy submission (verdict: Runtime Error):
def main():
    import sys
    n = int(input())
    a = list(map(int, input().split()))
    color = [0] * 8
    sub_color = 0
    count = 0
    for score in a
        if score <= 0:
            continue
        for i in range(8):
            if i*400 <= score <= 399+(i*400):
                color[i] += 1
        if score >= 3200:
            sub_color += 1
    for j in color:
        if j != 0:
            count += 1
    if count + sub_color >= 8:
        print(count, 8, sep=" ")
    else:
        print(count, count+sub_color, sep=" ")

if __name__ == "__main__":
    main()
Problem p04032 (python)

Fixed submission:
s=input()
flag=0
if len(s)==2:
    if s[0]==s[1]:
        print('1 2')
    else:
        print('-1 -1')
else:
    for i in range(len(s)-2):
        if s[i]==s[i+2] and s[i]!=s[i+1]:
            print(str(i+1)+' '+str(i+3))
            flag=1
            break
        elif s[i]==s[i+1] and s[i]!=s[i+2]:
            print(str(i+1)+' '+str(i+3))
            flag=1
            break
        elif s[i+1]==s[i+2] and s[i+1]!=s[i]:
            print(str(i+1)+' '+str(i+3))
            flag=1
            break
    if flag==0:
        print('-1 -1')

Buggy submission (verdict: Runtime Error):
s=input()
flag=0
if len(s)==2:
    if s[0]==s[1]:
        print('1 2')
    else:
        print('-1 -1')
else:
    for i in range(len(s)-2):
        if s[i]==s[i+2] and s[i]!=s[i+1]:
            print(f'{i+1} {i+3}')
            flag=1
            break
        elif s[i]==s[i+1] and s[i]!=s[i+2]:
            print(f'{i+1} {i+3}')
            flag=1
            break
        elif s[i+1]==s[i+2] and s[i+1]!=s[i]:
            print(f'{i+1} {i+3}')
            flag=1
            break
    if flag==0:
        print('-1 -1')

Buggy submission (verdict: Runtime Error):
s=input()
flag=0
if len(s)==2:
    if s[0]==s[1]:
        print('1 2')
    else:
        print('-1 -1')
else:
    for i in range(len(s)-2):
        if s[i]==s[i+2] and s[i]!=s[i+1]:
            print(f'{i+1} {i+3}')
            flag=1
            break
        elif s[i]==s[i+1] and s[i]!=s[i+2]:
            print(f'{i+1} {i+3}')
            flag=1
            break
        elif s[i+1]==s[i+2] and s[i+1]!=s[i]:
            print(f'{i+1} {i+3}')
            flag=1
            break
    if flag==0:
        print('-1 -1')

Buggy submission (verdict: Runtime Error):
s=input()
dic={}
key_letters=[]
flag=0
for letter in s:
    if letter not in dic.keys():
        dic[letter]=1
    else:
        dic[letter]+=1
for key,value in dic.items():
    if value>=len(s)/2:
        key_letters.append(key)
        flag=1

if flag==0:
    print('-1 -1')
else:
    for i in range(len(s)):
        if s[i] in key_letters and s[i]==s[i+1]:
            print(str(i+1)+' '+str(len(s)))
            break

Buggy submission (verdict: Runtime Error):
s=input()
dic={}
key_letters=[]
flag=0
for letter in s:
    if letter not in dic.keys():
        dic[letter]=1
    else:
        dic[letter]+=1
for key,value in dic.items():
    if value>=len(s)//2:
        key_letters.append(key)
        flag=1

if flag==0:
    print('-1 -1')
else:
    for i in range(len(s)):
        if s[i] in key_letters and s[i]==s[i+1]:
            print(str(i+1)+' '+str(len(s)))
            break
Problem p04045 (python)

Fixed submission:
s=input().split()
money,num=int(s[0]),int(s[1])
no_list=input().split()
for i in range(money,100000):
    flag=0
    for money_element in list(str(i)):
        if money_element in no_list:
            flag=1
            break
    if flag==0:
        print(i)
        break

Buggy submission (verdict: Runtime Error):
s=input().split()
money,num=int(s[0]),int(s[1])
no_list=input().split()
while True:
    flag=0
    for money_element in list(str(money)):
        if money_element in no_list:
            flag=1
            money+=1
            break
    if flag==0:
        print(i)
        break

Buggy submission (verdict: Runtime Error):
s=input().split()
money,num=int(s[0]),int(s[1])
no_list=input().split()
while true:
    flag=0
    for money_element in list(str(money)):
        if money_element in no_list:
            flag=1
            money+=1
            break
    if flag==0:
        print(i)
        break

Buggy submission (verdict: Runtime Error):
s=input().split()
money,num=int(s[0]),int(s[1])
no_list=input().split()
for i in range(money,100000):
  	flag=0
    for money_element in list(str(i)):
        if money_element in no_list:
            flag=1
            break
    if flag==0:
        print(i)
        break

Buggy submission (verdict: Runtime Error):
no_list=[]
s=input().split()
money,num=int(s[0]),int(s[1])
for i in range(num):
    no_list.append(input())
for i in range(money,10000):
    origin=i
    flag=0
    while i!=0:
        if str(i%10) in no_list:
            flag=1
            break
        i//=10
    if flag==0:
        print(origin)
        break
Problem p02608 (python)

Fixed submission:
#import math
n = int(input())
l = [0 for i in range(n)]
for x in range(1, 101):
    for y in range(1, 101):
        for z in range(1, 101):
            s = x**2 + y**2 + z**2 + x*y + y*z + z*x;
            if s <= n:
                l[s-1] += 1
for i in range(n):
    print(l[i])

Buggy submission (verdict: Runtime Error):
import math
n = int(input())
l = [0 for i in range(n)]
p = min(101,math.sqrt(n)+1)
for x in range(1, p):
    for y in range(1, p):
        for z in range(1, p):
            s = x**2 + y**2 + z**2 + x*y + y*z + z*x;
            if s <= n:
                l[s-1] += 1
for i in range(n):
    print(l[i])