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

Fixed submission:
import copy
H,W=map(int,input().split())

maze=[]
maze.append(["#"]*(W+2))
for h in range(H):
    line=list(input())

    maze.append(["#"]+line+["#"])

maze.append(["#"]*(W+2))


maze_ori=copy.deepcopy(maze)

maxd=0

for h in range(1,H+1):
    for w in range(1,W+1):
        maze=copy.deepcopy(maze_ori)
        if maze[h][w]=="#":
            continue
        else:
            next_flag=True


        direction=[[-1,0],[0,-1],[1,0],[0,1]]
        distance=0
        maze[h][w]=distance

        next_list=[]
        next_list.append([h,w])
        while next_flag is True:
            p_list=next_list
            next_list=[]
            distance+=1
            next_flag=False
            for p in p_list:
                for d in direction:
                    i=p[0]+d[0]
                    j=p[1]+d[1]

                    if maze[i][j]==".":
                        maze[i][j]=distance
                        next_list.append([i,j])
                        next_flag=True
            
        maxd=max(maxd,distance-1)

print(maxd)

Buggy submission (verdict: Runtime Error):
import copy
H,W=map(int,input().split())

def BFS(h,w,maze):


maze=[]
maze.append("#"*W)
for h in range(H):
    maze_e=input()
    line=[]

    maze.append("#"+line+"#")

maze.append("#"*W)


maze_ori=copy.deepcopy(maze)

maxd=0

for h in range(1,H+1):
    for w in range(1,W+1):
        maze=copy.deepcopy(maze_ori)
        if maze[h][w]="#":
            continue
        else:
            next_flag=True


        direction=[[-1,0],[0][-1],[1,0],[0][1]])
        distance=0
        maze[h][w]=distance

        next_list=[h,w]
        while next_flag is True:
            p_list=next_list[]
            next_list=[]
            distance+=1
            next_flag=False
            for p in p_list:
                for d in direction:
                    i=p[0]+d[0]
                    j=p[1]+d[1]

                    if maze[i,j]==".":
                        maze[i,j]=distance
                        next_list.append([i,j])
                        next_flag=True
            
        maxd=max(maxd,distance-1)

print(maxd)
Problem p02842 (python)

Fixed submission:
import math
N=int(input())
a=math.ceil(N/1.08)
if math.floor(a*1.08) == N:
  print(a)
else:
  print(":(")

Buggy submission (verdict: Runtime Error):
import math
N=input()
a=math.ceil(N/1.08)
if math.floor(a*1.08) == N:
  print(a)
else:
  print(":(")
Problem p02705 (python)

Fixed submission:
import math

r = int(input())
pi = math.pi
ans = 2 * pi * r

print(ans)

Buggy submission (verdict: Runtime Error):
import math

r = imt(input())
pi = math.pi
ans = 2 * pi * r

print(ans)
Problem p02765 (python)

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

ans = R
if N < 10:
  ans += 100*(10-N)
print(ans)

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

for i in range(1, N):
  if N/(K**i) < 1:
    print(i)
    break
Problem p02900 (python)

Fixed submission:
from math import gcd

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

d = gcd(A, B)
ans = 1
i = 2
while i <= pow(d, 1/2)+1:
  if d%i == 0:
    ans += 1
    while d%i == 0:
      d //= i
  i += 1
ans += (d > 1)
print(ans)

Buggy submission (verdict: Runtime Error):
from math import gcd

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

D = gcd(A, B)
d = D.copy()
ans = 1
i = 2
while i <= pow(D, 1/2):
  if d%i == 0:
    ans += 1
    while d%i == 0:
      d //= i
  i += 1
print(ans)
Problem p02988 (python)

Fixed submission:
n = int(input())
p = list(map(int, input().split()))
count = 0
for i in range(n-2):
  count += (min(p[i], p[i+2]) < p[i+1] < max(p[i], p[i+2]))
print(count)

Buggy submission (verdict: Runtime Error):
n = int(input())
P = list(map(int, input().split()))
count = 0
for i in range(n-2):
  count += (min(p[i], p[i+2]) < p[i+1] < max(p[i], p[i+2]))
print(count)

Buggy submission (verdict: Runtime Error):
n = int(input())
P = list(map(int, input().split()))
count = 0
for i in range(N-2):
  if min(p[i], p[i+2]) < p[i+1] < max(p[i], p[i+2]):
    count += 1
print(count)

Buggy submission (verdict: Runtime Error):
n = int(input())
P = list(map(int, input().split()))
count = 0
for i in range(N-1):
  if min(p[i], p[i+2]) < p[i+1] < max(p[i], p[i+2]):
    count += 1
print(count)
Problem p02995 (python)

Fixed submission:
from fractions import gcd

A, B, C, D = map(int, input().split())

a = (B-A+1)
b = -(B//C + B//D - B//(C*D//gcd(C,D)))
c = ((A-1)//C + (A-1)//D - (A-1)//(C*D//gcd(C,D)))

print(a+b+c)

Buggy submission (verdict: Runtime Error):
from math import gcd, floor

A, B, C, D = map(int, input().split())

a = (B-A+1)
b = -(floor(B/C) + floor(B/D) - floor(B/(floor(C*D/gcd(C,D)))))
c = (floor((A-1)/C) + floor((A-1)/D) - floor((A-1)/(floor(C*D/gcd(C,D)))))

print(a+b+c)

Buggy submission (verdict: Runtime Error):
from math import gcd

A, B, C, D = map(int, input().split())

a = (B-A+1)
b = -(B//C + B//D - B//(C*D//gcd(C,D)))
c = ((A-1)//C + (A-1)//D - (A-1)//(C*D//gcd(C,D)))

print(a+b+c)

Buggy submission (verdict: Runtime Error):
from math import gcd

A, B, C, D = map(int, input().split())


print((B-A+1) - (B//C + B//D - B//(C*D//gcd(C,D))) + ((A-1)//C + (A-1)//D - (A-1)//(C*D//gcd(C,D))))
Problem p03001 (python)

Fixed submission:
W, H, x, y = map(int, input().split())
ans = 0
if (2*x == W) and (2*y == H):
  ans = 1
print(W*H/2, ans)

Buggy submission (verdict: Runtime Error):
W, H, x, y = map(int, input().split())
ans = 0
if W/x == H/y == 0:
  ans = 1
print(W*H/2, ans)
Problem p03024 (python)

Fixed submission:
S = input()
if 15 - len(S) + S.count('o') >= 8:
  print('YES')
else:
  print('NO')

Buggy submission (verdict: Runtime Error):
S = input()
if 15 - len(S) + S.count(o) >= 8:
  print('YES')
else:
  print('NO')
Problem p03043 (python)

Fixed submission:
from math import ceil, log2
N, K = map(int, input().split())

M = min(N, K)
p = max((N-K)/N, 0)
for n in range(1, M+1):
    p += 2**(-ceil(log2(K/n))) / N
print(p)

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

for i in range(N):
    if 2**i > N:
        a = i-1
        b = N - 2**a
        break
for j in range(K):
    if 2**j > K:
        c = j-1
        d = K - 2**c
        break

if N <= K:
    print((2**(2*a-c+1)+2**(-c)+3*2**(a-c+1)*b)/3N)
else:
    print((2**(c+1)+2**(-c)+3*2*b)/3N + (N-K+1)/N)
Problem p03087 (python)

Fixed submission:
N, Q = list(map(int, input().split()))
S = input()
T = [list(map(int, input().split())) for _ in range(Q)]

total_list = []
total = 0
try:
  for i in range(N-1):
    if S[i] == 'A' and S[i+1] == 'C':
      total += 1
    total_list.append(total)

  for i in range(Q):
    l, r = T[i][0], T[i][1]
    if l != 1:
      print(total_list[r-2]-total_list[l-2])
    else:
      print(total_list[r-2])
except IndexError:
  print(0)

Buggy submission (verdict: Runtime Error):
N, Q = list(map(int, input().split()))
S = input()
T = [list(map(int, input().split())) for _ in range(Q)]

total_list = []
total = 0
for i in range(N):
  if S[i] == 'A' and S[i+1] == 'C':
    total += 1
  total_list.append(total)

for i in range(Q):
  l, r = T[i][0], T[i][1]
  if l != 1:
    print(total_list[r-2]-total_list[l-2])
  else:
    print(total_list[r-2])

Buggy submission (verdict: Runtime Error):
import re

N, Q = list(map(int, input().split()))
S = input()
T = [list(map(int, input().split())) for _ in range(Q)]

S = re.sub('[^AC]+', 'X', S)
print(S)

for i in range(Q):
  l, r = T[i][0], T[i][1]
  s = S[l-1:r]
  count = 0
  if r-l == 0:
    count = 0
  else:
    for j in range(r-l):
      if s[j] == 'A' and s[j+1] == 'C':
        count += 1
  print(count)
Problem p03161 (python)

Fixed submission:
N, K = map(int, input().split())
h = list(map(int, input().split()))
c = [0]*N
for i in range(1, N):
    c[i] = min([c[j] + abs(h[i]-h[j]) for j in range(max(0, i-K), i)])
print(c[N-1])

Buggy submission (verdict: Runtime Error):
N, K = map(int, input().split())
H = list(map(int, input().split()))
C = [0]*N
for i in range(1, N):
  	j = max(0, i-K)
    C[i] = min([c + abs(H[i]-h) for c, h in zip(C[j:i], H[j:i])])
print(C[N-1])

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

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

def dp(n):
  if memo[n] != -1:
    return memo[n]
  elif n != 0:
    m = min([dp(n-i)+abs(h[n]-h[n-i]) for i in range(1, min(K, n)+1)])
    memo[n] = m
    return m
  else:
    memo[n] = 0
    return memo[n]

print(dp(N-1))
Problem p03163 (python)

Fixed submission:
N, W = map(int, input().split())
items = [list(map(int, input().split())) for _ in range(N)]

table = {i: [0]*(W+1) for i in range(N+1)}
def dp(N, W):
  for i in range(1, N+1):
    w, v = items[i-1]
    for j in range(1, W+1):
      if w <= j:
        table[i][j] = max(table[i-1][j-w]+v, table[i-1][j])
      else:
        table[i][j] = table[i-1][j]
  return table[N][W]

print(dp(N, W))

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

N, W = map(int, input().split())

dp = [[0]*(W+1) for _ in range(N+1)]

for i in range(1, N+1):
  w, v = map(int, input().split())
  for j in range(1, W+1):
    if j >= w:
      dp[i][j] = max(dp[i-1][j], dp[i-1][j-w]+v)
    else:
      dp[i][j] = dp[i-1][j]

print(dp[N][W])
Problem p03196 (python)

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

if N == 1:
  d = P
else:
  d = 1
  i = 2
  while i <= round(pow(P, 1/N)):
    if P % i**N == 0:
      P //= i**N
      d *= i
    else:
      i += 1
print(d)

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

if N == 1:
  d = P
else:
  d = 1
  i = 2
  while i**N <= P:
    if P % i**N == 0:
      P //= i**N
      d *= i
    else:
      i += 1
print(d)

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

d = 1
i = 2
while i <= pow(P, 1/N)+1:
  if P % i**N == 0:
    P //= i**N
    d *= i
  else:
    i += 1
print(d)

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

d = int(pow(P, 1/N))
for i in range(int(pow(P, 1/N))+1, 0, -1):
  if P % i**N == 0:
    d = i
    break
print(d)
Problem p03609 (python)

Fixed submission:
X, t = map(int, input().split())
print(max(X - t,0))

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

count = 0
for i in range(N-1):
  if p[i] == i+1:
    p[i], p[i+1] = p[i+1], p[i]
    count += 1
if p[N-1] == N:
  p[N-2], p[N-1] = p[N-1], p[N-2]
  count += 1
  
print(count)
Problem p03612 (python)

Fixed submission:
N = int(input())
p = list(map(int, input().split()))

count = 0
for i in range(N-1):
  if p[i] == i+1:
    p[i], p[i+1] = p[i+1], p[i]
    count += 1
if p[N-1] == N:
  p[N-2], p[N-1] = p[N-1], p[N-2]
  count += 1
  
print(count)

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

count = 0
for i in range(N):
  if p[i] == i+1:
    p[i], p[i+1] = p[i+1], p[i]
    count += 1
if p[N-1] == N:
  p[N-2], p[N-1] = p[N-1], p[N-2]
  count += 1
  
print(count)
Problem p02641 (python)

Fixed submission:
X, N = map(int,input().split())
if N==0:
    print(X)
else:
    P = list(map(int,input().split()))
    P.sort()
    Q = [i-1 for i in range(-10,111)]
    for a in P:
        Q.remove(a)
    Q1 = [abs(b - X) for b in Q]
    print(Q[Q1.index(min(Q1))])

Buggy submission (verdict: Runtime Error):
X, N = map(int,input().split())
P = list(map(int,input().split()))
if N==0:
    print(X)
else:
    Q = [i+1 for i in range(100)]
    for pi in P:
        Q.remove(pi)
    Q1 = [abs(qi - X) for qi in Q]
    print(Q[Q1.index(min(Q1))])

Buggy submission (verdict: Runtime Error):
X, N = map(int,input().split())
P = list(map(int,input().split()))
Q = [i+1 for i in range(100)]
for pi in P:
    Q.remove(pi)
Q1 = [abs(qi - X) for qi in Q]
print(Q[Q1.index(min(Q1))])
Problem p02658 (python)

Fixed submission:
N = int(input())
A_list = list(map(int,input().split()))
A_list.sort()
#print(A_list)
if A_list[0]==0:
    answer = 0
else:      
    answer = 1
    for a in A_list:
        answer *= a
        if len(str(answer-1)) > 18:
            answer = -1
            break
print(answer)

Buggy submission (verdict: Runtime Error):
import math
N = int(input())
A_list = list(map(int,input().split()))
answer = 1.
for a in A_list:
    answer*=a

if math.log10(answer) > 18:
    print("-1")
else:
    print(answer)
Problem p03455 (python)

Fixed submission:
a,b=map(int,input().split())
if a%2==0 or b%2==0:
  print("Even")
else:
  print("Odd")

Buggy submission (verdict: Runtime Error):
a,b = map(int,input().split)
if a%2==0 or b%2==0:
  print("Even")
else:
  print("Odd")

Buggy submission (verdict: Runtime Error):
a,b = map(int,input().split)
if a//2==0 or b//2==0:
  print("Even")
else:
  print("Odd")
Problem p03456 (python)

Fixed submission:
a,b=map(str,input().split())
ab=int(a+b)
if (ab**.5).is_integer():
  print("Yes")
else:
  print("No")

Buggy submission (verdict: Runtime Error):
a,b=map(str,input().split())
ab=int(a+b)
if (ab**.5).is_integer() = "True":
  print("Yes")
else:
  print("No")

Buggy submission (verdict: Runtime Error):
a,b = map(int,input().split())
n=sqrt(a*(10**len(b))+b)
 
if isinstance(n,int)=="True":
  print("Yes")
else:
  print("No")

Buggy submission (verdict: Runtime Error):
import numpy as np
a,b = map(int,input().split())
n=np.sqrt(a*np.power(10,len(b)+1)+b)

if isinstance(n,int)=="True":
  print("Yes")
else:
  print("No")
Problem p02684 (python)

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

visited = {1: 0}
index = 0
last = 1

for i in range(K):
    t = A[last - 1]
    index += 1
    if t in visited:
        z = K - i - 1
        l = index - visited[t]
        print([k for k, v in visited.items() if v == visited[t] + (z % l)][0])
        exit()
    else:
        visited[t] = index
        last = t

print(last)

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

visited = {1: 0}
index = 0
last = 1

for i in range(K):
    t = A[last - 1]
    index += 1
    if t in visited:
        z = K - i - 1
        l = index - visited[t]
        print([k for k, v in visited.items() if v == visited[t] + (z % l)][0])
        exit()
    else:
        visited[t] = index
        last = t

print(visited[-1])
Problem p02775 (python)

Fixed submission:
N = input()
rN = N[::-1]

res = 0
add = False

for i, n in enumerate(rN):
    p = int(n)
    if add:
        p += 1
    if p == 10:
        continue
    elif p == 5:
        if len(N) > i+1 and int(rN[i+1]) >= 5:
            add = True
            res += p
        else:
            add = False
            res += p
    elif p < 5:
        add = False
        res += p
    else:
        add = True
        res += 10-p

if add:
    res += 1

print(res)

Buggy submission (verdict: Runtime Error):
N = input()
rN = N[::-1]

res = 0
add = False

for i, n in enumerate(rN):
    p = int(n)
    if add:
        p += 1
    if p == 10:
        continue
    elif p == 5:
        if len(N) >= i+1 and int(rN[i+1]) >= 5:
            add = True
            res += p
        else:
            add = False
            res += p
    elif p < 5:
        add = False
        res += p
    else:
        add = True
        res += 10-p

if add:
    res += 1

print(res)

Buggy submission (verdict: Runtime Error):
N = input()
rN = N[::-1]

res = 0
add = False

for i, n in enumerate(rN):
    p = int(n)
    if add:
        p += 1
        
    if i > 100:
        res += (i-100)*p
        add = False
        continue

    if p == 10:
        continue
    elif p == 5:
        if len(N) >= i+1 and int(rN[i+1]) >= 5:
            add = True
            res += p
        else:
            add = False
            res += p
    elif p < 5:
        add = False
        res += p
    else:
        add = True
        res += 10-p

if add:
    res += 1

print(res)
Problem p02731 (python)

Fixed submission:
L = int(input())

# 普通に立方体が一番大きい
print(pow(L/3,3))

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

    # 普通に立方体が一番大きい
    print(pow(L/3,3))
Problem p02789 (python)

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

if N == M:
    print('Yes')
else:
    print('No')

Buggy submission (verdict: Runtime Error):
resolve()

def resolve():
    N,M = map(int, input().split())

    if N == M:
        print('Yes')
    else:
        print('No')
Problem p02718 (python)

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

n, m = map(int, input().split())
a = list(map(int, input().split()))

total = sum(a)
thres = total/(4*m)

ct = 0
for i in a:
    if i >= thres:
        ct += 1

if ct >= m:
    print("Yes")
else:
    print("No")

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

n, m = map(int, input().split())
a = list(map(int, input().split()))

total = sum(a)
thres = total/(4*m)

ct = 0
for i in a:
    if i >= thres:
        ct += 1

if ct >= m:
    print("Yes")
else:
    print("No")d
Problem p02780 (python)

Fixed submission:
# -*- coding: utf-8 -*-
 
n, k = map(int, input().split())
p = list(map(int, input().split()))

summation = 0
exp_val = []
for i in range(n):
    summation += (p[i]+1)/2
    exp_val.append(summation)
exp_val.insert(0, 0)
#print(exp_val)

ans = 0
for i in range(n-k+1):
    m = exp_val[k+i] - exp_val[i]
    ans = max(ans, m)

print(ans)

Buggy submission (verdict: Runtime Error):

# -*- coding: utf-8 -*-
import numpy as np

n, k = map(int, input().split())
p = list(map(int, input().split()))
np_p = np.array(p)

def main():
    keep_val = 0
    check = 0
    for i in range(n-k+1):
        ss = np_p[i:i+k].sum()
        if keep_val < ss:
            check = i
            keep_val = ss
    print(((np_p[check:check+k]+1)/2).sum())
main()
Problem p02789 (python)

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

n,m = map(int, input().split())

if m == n:
    print("Yes")
else:
    print("No")

Buggy submission (verdict: Runtime Error):
# -*- coding: utf-8 -*-
import fractions
import numpy as np
 
mod = 10**9+7
 
n = int(input())
a = list(map(int, input().split()))
 
div = a[0]
for i in a:
    div = div*i//fractions.gcd(div, i)

ans = 0
for i in a:
    ans += div//i

print(ans%mod)
Problem p02802 (python)

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

n, m = map(int, input().split())
p = ["" for _ in range(m)]
s = ["" for _ in range(m)]
for i in range(m):
    tmp = input().split()
    p[i] = int(tmp[0])
    s[i] = tmp[1]

isACed = [[0,0] for _ in range(n)]

n_correct = 0
n_penalty = 0
for i in range(m):
    if isACed[p[i]-1][1] != 1:
        if s[i] == "WA": #"WA"の時
            isACed[p[i]-1][0] += 1
        else: #"AC"の時
            n_correct += 1
            isACed[p[i]-1][1] = 1
            n_penalty += isACed[p[i]-1][0]

print(n_correct, n_penalty)

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

n, m = map(int, input().split())
p = ["" for _ in range(m)]
s = ["" for _ in range(m)]
for i in range(m):
    tmp = input().split()
    p[i] = int(tmp[0])
    s[i] = tmp[1]

isACed = [0 for _ in range(m)]

n_correct = 0
n_penalty = 0

for i in range(m):
    if isACed[p[i]-1] != 1:
        if s[i] == "AC":
            n_correct += 1

            #正解ラベルを付ける
            isACed[p[i]-1] = 1
        else: #"WA"の時
            n_penalty += 1
print(n_correct, n_penalty)

Buggy submission (verdict: Runtime Error):
# -*- coding: utf-8 -*-
import logging
logging.basicConfig(level = logging.DEBUG,
                    format = " %(levelname)s - %(message)s")
logging.disable()

n, m = map(int, input().split())
p = ["" for _ in range(m)]
s = ["" for _ in range(m)]
for i in range(m):
    tmp = input().split()
    p[i] = int(tmp[0])
    s[i] = tmp[1]

isACed = [0 for _ in range(m)]

logging.debug("p: {}".format(p))
logging.debug("s: {}".format(s))
logging.debug("isACed: {}".format(isACed))

n_correct = 0
n_penalty = 0

for i in range(m):
    logging.debug("range({})開始".format(i))
    if isACed[p[i]-1] != 1:
        logging.debug("isACed[{}] != 1".format(p[i]-1))
        if s[i] == "AC":
            n_correct += 1

            #正解ラベルを付ける
            isACed[p[i]-1] = 1
        else: #"WA"の時
            n_penalty += 1
print(n_correct, n_penalty)

Buggy submission (verdict: Runtime Error):
# -*- coding: utf-8 -*-
import logging
logging.basicConfig(level = logging.DEBUG,
                    format = " %(levelname)s - %(message)s")
logging.disable()

n, m = map(int, input().split())
p = ["" for _ in range(m)]
s = ["" for _ in range(m)]
for i in range(m):
    tmp = input().split()
    p[i] = int(tmp[0])
    s[i] = tmp[1]

isACed = [0 for _ in range(n)]

logging.debug("p: {}".format(p))
logging.debug("s: {}".format(s))
logging.debug("isACed: {}".format(isACed))

n_correct = 0
n_penalty = 0

for i in range(m):
    logging.debug("range({})開始".format(i))
    if isACed[p[i]-1] != 1:
        logging.debug("isACed[{}] != 1".format(p[i]-1))
        if s[i] == "AC":
            n_correct += 1

            #正解ラベルを付ける
            isACed[p[i]-1] = 1
        else: #"WA"の時
            n_penalty += 1
print(n_correct, n_penalty)
Problem p02993 (python)

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

#同じ数字が連続する箇所が存在するならBad, そうでなければGood

S = input()
jud = False

#もし4桁じゃなかったら×
if len(S) != 4:
    print("4桁でありません")

for i in range(0,3):
    if S[i] == S[i+1]:
        jud = True
    else:
        pass

if jud == True:
    print("Bad")
else:
    print("Good")

Buggy submission (verdict: Runtime Error):
# -*- coding: utf-8 -*-
import numpy as np

#N個のリンゴ
#リンゴiの味＝L+i-1

#入力（数値）
spline = input().split()
N = int(spline[0])
L = int(spline[1])

#リンゴの味
taste = []
for i in range(1,N+1): #リンゴNは１から数える
    taste.append(L+i-1)  #味の設定
#print(taste)

#1つも食べなかった場合の味
taste_max = sum(taste)
#print("max"+str(taste_max))


#1つ食べた場合の味のリスト
taste_any = []
for k in range(0,N):
    taste_any.append(sum(taste) - taste[k])
#print(taste_any)

#maxとanyの差
#numpy配列にしてから計算
taste_any = np.asarray(taste_any)
diff = abs(sum(taste) - taste_any)
#numpy配列からリストに戻す（.indexメソッドが使いたいから）
diff_list = diff.tolist()
#print("diff_list"+str(diff_list))
#最小値のインデックスを取得する
coef = diff_list.index(min(diff_list))
#print(coef)

print(taste_any[coef])
Problem p02995 (python)

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

a,b,c,d=map(int, input().split())

n_c = b//c - (a-1)//c
n_d = b//d - (a-1)//d
#print("n_c: ", n_c)
#print("n_d: ", n_d)

cd = c*d//fractions.gcd(c,d)
n_cd = b//cd - (a-1)//cd
#print("n_cd: ", n_cd)

n_ab = b+1-a
#print("n_ab: ", n_ab)

print(n_ab-(n_c+n_d)+n_cd)

Buggy submission (verdict: Runtime Error):
# -*- coding: utf-8 -*-
import numpy as np

a,b,c,d=map(int, input().split())

n_c = b//c - (a-1)//c
n_d = b//d - (a-1)//d
#print("n_c: ", n_c)
#print("n_d: ", n_d)

cd = c*d//np.gcd(c,d)
n_cd = b//cd - (a-1)//cd
#print("n_cd: ", n_cd)

n_ab = b+1-a
#print("n_ab: ", n_ab)

print(n_ab-(n_c+n_d)+n_cd)

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

a,b,c,d=map(int, input().split())

n_c = b//c - a//c
n_d = b//d - a//d
#print("n_c: ", n_c)
#print("n_d: ", n_d)

cd = c*d//math.gcd(c,d)
n_cd = b//cd - a//cd
#print("n_cd: ", n_cd)

n_ab = b+1-a
#print("n_ab: ", n_ab)

print(n_ab-(n_c+n_d)+n_cd)
Problem p03106 (python)

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

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

ans = []
for i in range(1, max(a,b)+1):
    if a%i==0 and b%i==0:
        ans.append(i)

#print(ans)

t = len(ans)-k
print(ans[t])

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

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

ans = []
for i in range(1, max(a,b)):
    if a%i==0 and b%i==0:
        ans.append(i)

#print(ans)

t = len(ans)-k
print(ans[t])