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

Fixed submission:
L,R = list(map(int,input().split()))
def main(L,R):
    mod_min = 2019
    if L // mod_min == R // mod_min:
        L %= mod_min
        R %= mod_min
        for i in range(L,R):
            for j in range(i+1, R+1):
                Y = i*j % 2019
                if Y < mod_min:
                    mod_min = Y
    else:
        mod_min = 0
    return mod_min
print(main(L,R))

Buggy submission (verdict: Runtime Error):
def main(L,R):
    mod_min = 2019
    if L // mod_min == R // mod_min:
        L %= mod_min
        R %= mod_min
        for i in range(L,R):
            for j in range(i+1, R+1):
                Y = i*j % 2019
                if Y < mod_min:
                    mod_min = Y
    else:
        mod_min = 0
    return mod_min
print(main(L,R))

Buggy submission (verdict: Runtime Error):
L,R = list(map(int,input().split()))
Y = []
for i in range(L, R):
    if i == 0:
        j = 1
        Y.append((i * j) % 2019)
    elif i * j == 2019:
        Y.append([0])
    else:
        for j in range(i+1, R+1):
            Y.append((i * j) % 2019)
print(min(Y))

Buggy submission (verdict: Runtime Error):

L,R = list(map(int,input().split()))
Y = []
for i in range(L, R):
    if i == 0:
        j = 1
        Y.append((i * j) % 2019)
    elif i * j == 2019:
        Y.append(0)
    else:
        for j in range(i+1, R+1):
            Y.append((i * j) % 2019)
print(min(Y))
Problem p02678 (python)

Fixed submission:
from collections import deque
n, m = map(int, input().split())

a = [0] * (m + 1)
b = [0] * (m + 1)
road = [[] for _ in range(n + 1)]

for i in range(m):
    a[i], b[i] = map(int, input().split())
    road[a[i]].append(b[i])
    road[b[i]].append(a[i])

ans = [-1] * (n + 1)
ans[0] = 0
ans[1] = 0

q = deque()
q.appendleft(1)

while len(q):
    i = q.pop()
    for j in road[i]:
        if ans[j] == -1:
            ans[j] = i
            q.appendleft(j)

if ans.count(-1) != 0:
    print("No")
    exit()
else:
    print("Yes")
    print(*ans[2:], sep="\n")

Buggy submission (verdict: Runtime Error):
from collections import deque
n, m = map(int, input().split())

a = [0] * (m + 1)
b = [0] * (m + 1)
road = [[] for _ in range(m + 1)]

for i in range(m):
    a[i], b[i] = map(int, input().split())
    road[a[i]].append(b[i])
    road[b[i]].append(a[i])

ans = [-1] * (n + 1)
ans[0] = 0
ans[1] = 0

q = deque()
q.appendleft(1)

while len(q):
    i = q.pop()
    for j in road[i]:
        if ans[j] == -1:
            ans[j] = i
            q.appendleft(j)

if ans.count(-1) != 0:
    print("No")
    exit()
else:
    print("Yes")
    print(*ans[2:], sep="\n")
Problem p02708 (python)

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

mod = 10 ** 9 + 7
inv = pow(2, mod - 2, mod=mod)

def calc(b, e, c):
    global mod
    global inv
    res = (e + b) % mod
    res = ((res * c) % mod ) * inv
    return res % mod

ans = 0
for i in range(k, n + 2):
    min_val = calc(0, i - 1, i)
    max_val = calc(n - i + 1, n, i)
    ans += (max_val - min_val + 1) % mod
    ans %= mod

print(ans)

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

mod = 10 ** 9 + 7
inv = pow(2, mod - 2, mod=mod)

def calc(b, e, c):
    global mod
    global inv
    res = (e + b) % mod
    res = ((res * c) % mod ) * inv
    return res % mod

ans = 0
for i in range(k, n + 2):
    min_val = calc(0, i - 1, i)
    max_val = calc(n - i + 1, n, i)
    ans += (max_val - min_val + 1) % mod
    ans %= mod

print(ans)
Problem p02761 (python)

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

d = {}
flag = True

for i in range(M):
    s, c = map(int, input().split())
    if s in d.keys() and d[s] != c:
        flag = False
    d[s] = c

if M == 0:
    if N > 1: d[1] = 1
    else: d[1] = 0
elif 1 not in d.keys():
    d[1] = 1
elif N > 1 and d[1] == 0:
    flag = False

if M != 0 and max(d.keys()) > N:
    flag = False

if flag:
    res = 0
    for s, c in d.items():
        res += c * 10 ** (N - s)
    print(res)
else:
    print("-1")

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

d = {}
flag = True

for i in range(M):
    s, c = map(int, input().split())
    if s in d.keys() and d[s] != c:
        flag = False
    d[s] = c

if 1 not in d.keys():
    flag = False
elif N > 1 and d[1] == 0:
    flag = False

if max(d.keys()) > N:
    flag = False

if flag:
    res = 0
    for s, c in d.items():
        res += c * 10 ** (N - s)
    print(res)
else:
    print("-1")
Problem p02658 (python)

Fixed submission:
n = int(input())
s = sorted(map(int,input().split()))
M = 10 ** 18
ans = 1
for ss in s:
	ans *= ss
	if ans > M:
		ans = -1
		break
	elif ans == 0:
		break
print(ans)

Buggy submission (verdict: Runtime Error):
n = int(input())
s = sorted(map,int,input().split())
M = 10 ** 18
ans = 1
for ss in s:
	ans *= ss
	if ans > M:
		ans = -1
		break
	elif ans == 0:
		break
print(ans)

Buggy submission (verdict: Runtime Error):
n = int(input())
s = sorted(map,int,input().split())
M = 10 ** 18
ans = 1
for ss in s:
	ans *= ss
	if ans > M:
		ans = -1
		break
	elif ans == 0:
		break

Buggy submission (verdict: Runtime Error):
n = int(input())
s = sorted(map,int,input().split())
M = 10 ** 18
ans = 1
for ss in s:
	ans *= ss
	if ans > M:
		ans = -1
		break
	elif ans == 0:
		break
print(ans)

Buggy submission (verdict: Runtime Error):
from operator import mul
from functools import reduce
n = int(input())
a = list(map(int,input().split()))
M = 10**18
if 0 in a:
	print(0)
	break
else:
	ans = reduce(mul, a)
	if ans > M:
		print(-1)
		break
	else:
		print(ans)

Buggy submission (verdict: Runtime Error):
from operator import mul
from functools import reduce
n = int(input())
a = list(map(int,input().split()))

if 0 in a:
	print(0)
else:
	M = 10**18
	ans = reduce(mul, a)
	if ans > M:
		print(-1)
		break
	else:
		print(ans)
Problem p02767 (python)

Fixed submission:
n = int(input())
x = list(map(int,input().split()))
maxx = max(x)
a = []
for i in range(1,maxx+1):
	ans = 0
	for xx in x:
		ans += int((xx-i)**2)
	a.append(ans)
print(min(a))

Buggy submission (verdict: Runtime Error):
n = int(input())
x = list(map(int,input().split()))
maxx = max(x)
a = []
for i in range(1,maxx):
	ans = 0
	for xx in x:
		ans += int((xx-i)**2)
	a.append(ans)
print(min(a))

Buggy submission (verdict: Runtime Error):
n = int(input())
x = list(map(int,input().split()))
maxpoint = max(x)
ans = []
for i in range(1,maxpoint):
	tmp = 0
	for nn in range(n):
		tmp += (x[nn] - i)**2
	ans.append(tmp)
print(min(ans))
Problem p02923 (python)

Fixed submission:
n = int(input())
h = list(map(int,input().split()))
ans=0
cnt=0
for i in range(1,n):
  if h[i]<=h[i-1]:
    cnt+=1
    if cnt>ans:
      ans=cnt
  else:
    cnt=0
print(ans)

Buggy submission (verdict: Runtime Error):
N = int(input())
H = list(map(int,input().split()))
ans=0
cnt=0
for i in range(1,n):
  if h[i]<=h[i-1]:
    cnt+=1
    if cnt>ans:
      ans=cnt
  else:
    cnt=0
print(ans)
Problem p03076 (python)

Fixed submission:
a = int(input())
b = int(input())
c = int(input())
d = int(input())
e = int(input())
dish = [a,b,c,d,e]
last = 0
for index,d in enumerate(dish):
  if d % 10 != 0:
    d10 = ((d // 10)+1) *10
    if last <= d10 - d:
      last = d10 - d
    dish[index] = d10
print(sum(dish)-last)

Buggy submission (verdict: Runtime Error):
dish = [int(input()) for d in range(5)]
tmp = 0
time = []
for index,d in enumerate(dish):
  if d % 10 != 0:
    d10 = ((d // 10) +1) * 10
    time.append(d10)
    if tmp <= (d10-d):
      tmp = d10 - d
      last = index  
  else:
    time.append(d)
del time[last]
print(sum(time)+dish[last])

Buggy submission (verdict: Runtime Error):
dish = [int(input()) for d in range(5)]
diff = 0
ans = []
for index,d in enumerate(dish):
  if d % 10 == 0:
    ans.append(d)
  else:
    d10 = ((d //10) +1) * 10
    ans.append(d10)
    tmp = d10-d
    if diff < tmp:
      diff = tmp
      last= index
    
del ans[last]
print(sum(ans)+dish[last])

Buggy submission (verdict: Runtime Error):
dish = [int(input()) for d in range(5)]
diff = 0
ans = []
for index,d in enumerate(dish):
  if d % 10 != 0:
    d10 = ((d //10) +1) * 10
    ans.append(d10)
    if diff < d10-d:
      diff = d10-d
      last= index
  else:
    ans.append(d)
del ans[last]
print(sum(ans)+dish[last])

Buggy submission (verdict: Runtime Error):
dish = [int(input()) for d in range(5)]
diff = 0
ans = []
for index,d in enumerate(dish):
  if d % 10 != 0:
    d10 = ((d //10) +1) * 10
    ans.append(d10)
    if diff < d10-d:
      diff = d10-d
      last= index
  else:
    ans.append(d)


ans.remove(ans[last])

print(sum(ans)+dish[last])

Buggy submission (verdict: Runtime Error):
dish = [int(input()) for d in range(5)]
diff = 0
ans = []
for index,d in enumerate(dish):
  if d % 10 != 0:
    d10 = ((d //10) +1) * 10
    ans.append(d10)
    if diff < d10-d:
      diff = d10-d
      last= index
  else:
    ans.append(d)


ans.remove(ans[last])

print(sum(ans)+dish[last])

Buggy submission (verdict: Runtime Error):
dish = [int(input()) for d in range(5)]
diff = 0
ans = []
for index,d in enumerate(dish):
  if d % 10 != 0:
    tmp = (d //10) +1
    d10 = tmp * 10
    ans.append(d10)
  else:
    ans.append(d)
  if d % 10 != 0 and diff < d10-d:
    diff = d10-d
    last= index

ans.remove(ans[last])

print(sum(ans)+dish[last])
Problem p03106 (python)

Fixed submission:
a,b,k = map(int,input().split())
minnum = min(a,b)
maxnum = max(a,b)
lis = []
for mi in reversed(range(1,minnum+1)):
  if minnum % mi == 0 and maxnum % mi == 0:
    lis.append(mi)

print(lis[k-1])

Buggy submission (verdict: Runtime Error):
a,b,k = map(int,input().split())
minnum = min(a,b)
maxnum = max(a,b)
lis = []
n = (minnum//2)+1
for mi in range(1,n):
  if minnum % mi == 0 and maxnum % mi == 0:
    lis.append(mi)
num = k-1
print(lis[-1 * num])

Buggy submission (verdict: Runtime Error):
a,b,k = map(int,input().split())
minnum = min(a,b)
maxnum = max(a,b)
lis = []
for mi in range(1,(minnum//2)+1):
  if minnum % mi == 0 and maxnum % mi == 0:
    lis.append(mi)
num = k-1
print(lis[-1 * num])
Problem p03352 (python)

Fixed submission:
import math
X = int(input())
n = (int(math.sqrt(X)))**2
for b in range(2, int(math.sqrt(X))+2):
    for p in range(1, 10):
        if (b**p > n) and (b**p <= X):
            n = b**p
print(n)

Buggy submission (verdict: Runtime Error):
import math
x = int(input())
ans = (int(math.sqrt(X)))**2
for i in range(2,int(math.sqrt(x))+2):
  for j in range(1,10):
    if i ** j <= x and i**j > ans:
      ans = i**j

print(ans)

Buggy submission (verdict: Runtime Error):
import math
x = int(input())
ans = (int(math.sqrt(X)))**2
for i in range(1,int(math.sqrt(x)+2)):
  for j in range(2,10):
    if i ** j <= x and i**j > ans:
      ans = i**j

print(ans)

Buggy submission (verdict: Runtime Error):
import math
x = int(input())
ans = (int(math.sqrt(X)))**2
for i in range(1,int(math.sqrt(x)+2)):
  for j in range(2,10):
    if i ** j <= x and i**j > ans:
      ans = i**j

print(ans)

Buggy submission (verdict: Runtime Error):
import math
x = int(input())
ans = (int(math.sqrt(X)))**2
for i in range(1,int(math.sqrt(x)+2)):
  for j in range(2,10):
    if i ** j <= x and i**j > ans:
      ans = i**j

print(ans)

Buggy submission (verdict: Runtime Error):
import math
x = int(input())
ans = (int(math.sqrt(X)))**2
for i in range(1,int(math.sqrt(x)+2)):
  for j in range(2,10):
    if i ** j <= x and i**j > ans:
      ans = i**j
    else:
      break
print(ans)

Buggy submission (verdict: Runtime Error):
i = int(input())
for n in range(1, i):
	if (n ** .5).is_integer():
		num = n
print(num)
Problem p03457 (python)

Fixed submission:
n=int(input())
x,y=0,0
t=0
for i in range(n):
    T,X,Y=map(int,input().split())
    if((T-t)>=(abs(X-x)+abs(Y-y)) and (T-t)%2==(abs(x-X)+abs(Y-y))%2):
        x=X
        y=Y
        t=T
    else:
        print("No")
        exit()
print("Yes")

Buggy submission (verdict: Runtime Error):
import sys
n = int(input())
pos = [list(map(int,input().split())) for p in range(n)]
for i in range(1,en(pos)):
  diff = pos[i+1][0]-pos[i][0]
  num = abs(pos[i][1]-pos[i+1][1]) + abs(pos[i][2]-pos[i+1][2])
  if((pos[i][0]-pos[i-1][0])>=(abs(pos[i][1]-pos[i-1][1])+abs(pos[i][2]-pos[i-1][2])) and (pos[i][0]-pos[i-1][0])%2==(abs(pos[i-1][1]-pos[i][1])+abs(pos[i][2]-pos[i-1][2]))%2):
    pass
  else:
    print("No")
    sys.exit()      
print("Yes")

Buggy submission (verdict: Runtime Error):
import sys
n = int(input())
pos = [list(map(int,input().split())) for p in range(n)]
for i in range(1,en(pos)):
  diff = pos[i+1][0]-pos[i][0]
  num = abs(pos[i][1]-pos[i+1][1]) + abs(pos[i][2]-pos[i+1][2])
  if((pos[i][0]-pos[i-1][0])>=(abs(pos[i][1]-pos[i-1][0])+abs(pos[i][2]-pos[i-1][0])) and (pos[i][0]-pos[i-1][0])%2==(abs(pos[i-1][1]-pos[i][1])+abs(pos[i][0]-pos[i-1][0]))%2):
    pass
  else:
    print("No")
    sys.exit()      
print("Yes")

Buggy submission (verdict: Runtime Error):
import sys
n = int(input())
pos = [list(map(int,input().split())) for p in range(n)]
for i in range(len(pos)):
  if i == 0:
    num = abs(pos[i][1]-0) + abs(pos[i][2]-0)
    if num <= diff and diff * (diff%2) == num%2:
      pass
    else:
      print("No")
      sys.exit()     
  else:
    diff = pos[i][0]-pos[i-1][0]
    num = abs(pos[i][1]-pos[i-1][1]) + abs(pos[i][2]-pos[i-1][2])
    if num <= diff and diff * (diff%2) == num%2:
      pass
    else:
      print("No")
      sys.exit()      
print("Yes")
Problem p03611 (python)

Fixed submission:
N = int(input())
a = [int(x) for x in input().split()]
memo = [0]*(10**5+2)
ans = 1
for i in range(N):
  memo[a[i]] += 1
  memo[a[i]+1] += 1
  memo[a[i]-1] += 1
print(max(memo))

Buggy submission (verdict: Runtime Error):
n = int(input())
a = list(map(int,input().split()))
s = sorted(a)
k = s[(n//2)-1]
ans = 0
for i in s:
  if i == s[k] or i == s[k]-1 or i ==s[k]+1:
    ans += 1
print(ans)
Problem p03680 (python)

Fixed submission:
n = int(input())
a = [int(input()) for l in range(n)]
count = 0
for i in range(n):
  if a[count] == 2:
    print(i+1)
    exit()
  else:
    count = a[count]-1
print(-1)

Buggy submission (verdict: Runtime Error):
n = int(input())
a = [int(input()) for l in range(n)]
flag = True
ans = 0
i = a[0]
while flag:
  i = a[i-1]
  ans += 1
  if i == 2:
    print(ans+1)
    flag = False
  else:
    count += 1
    if count >= n:
      print(-1)
      flag = False
Problem p03971 (python)

Fixed submission:
N,A,B = map(int,input().split())
student = input()
passp = 0
passb = 0
ab = (A+B)
for s in student:
	if s == "a":
		if passp < ab:
			passp += 1
			print("Yes")
		else:
			print("No")
	elif s == "b":
		if passp < ab and passb < B:
			passp += 1
			passb += 1
			print("Yes")
		else:
			print("No")
	else:
		print("No")

Buggy submission (verdict: Runtime Error):
N,A,B = map(int,input().split())
student = input()
passp = 0
passb = 0
for s in student:
	if s == "a":
		if passp < (A+B):
			passp += 1
			print("Yes")
 		else:
			print("No")
	elif s == "b":
		if passp < (A+B) and passb < B:
			passp += 1
			passb += 1
			print("Yes")
		else:
			print("No")
	else:
		print("No")

Buggy submission (verdict: Runtime Error):
N,A,B = map(int,input().split())
student = input()
passp = 0
passb = 0
for s in student:
	if s == "a":
		if passp < (A+B):
			passp += 1
			print("YES")
 		else:
			print("NO")
	elif s == "b":
		if passp < (A+B) and passb < B:
			passp += 1
			passb += 1
			print("YES")
		else:
			print("NO")
	else:
		print("NO")
Problem p02632 (python)

Fixed submission:
n = int(input())
s = input()
 
S = len(s)
mod = 10 ** 9 + 7
 
tmp_ans = pow(26, n, mod)
div = pow(26, -1, mod)
 
ans = tmp_ans
 
for i in range(1, n+1):
    tmp_ans = (tmp_ans * 25 * div) % mod
    tmp_ans = ((tmp_ans * (S-1+i)) * pow(i, -1, mod)) % mod
    ans = (ans + tmp_ans) % mod
 
ans %= mod
 
print(ans)

Buggy submission (verdict: Runtime Error):
# -*- coding: utf-8 -*-
"""
Created on Wed Jun 24 20:53:22 2020

@author: NEC-PCuser
"""

def cmb(n, r, mod):
    if ( r<0 or r>n ):
        return 0
    r = min(r, n-r)
    return fact[n] * factinv[r] * factinv[n-r] % mod

def createPowList(K, mod):
    li25 = [1]
    li26 = [1]
    p25 = 1
    p26 = 1
    for i in range(K + 1):
        p25 *= 25
        p25 %= mod
        li25.append(p25)
        p26 *= 26
        p26 %= mod
        li26.append(p26)
    return li25, li26

p = 10 ** 9 + 7
N = 10 ** 6  # N は必要分だけ用意する
fact = [1, 1]  # fact[n] = (n! mod p)
factinv = [1, 1]  # factinv[n] = ((n!)^(-1) mod p)
inv = [0, 1]  # factinv 計算用


p = 10 ** 9 + 7
N = 10 ** 6  # N は必要分だけ用意する
fact = [1, 1]  # fact[n] = (n! mod p)
factinv = [1, 1]  # factinv[n] = ((n!)^(-1) mod p)
inv = [0, 1]  # factinv 計算用

for i in range(2, N + 1):
    fact.append((fact[-1] * i) % p)
    inv.append((-inv[p % i] * (p // i)) % p)
    factinv.append((factinv[-1] * inv[-1]) % p)

if __name__ == '__main__':
    K = int(input())
    n = len(input())
    mod = 10**9+7 #出力の制限
    #25 25 a 25 25 25 b 25 25  c  26 26
    p25, p26 = createPowList(K, mod)

    ans = 0
    for i in range(0, K + 1):
        ans1 = (p25[i] * cmb(n + i - 1, n - 1, mod)) % mod
        ans2 = (p26[K - i])
        ans += (ans1 * ans2) % mod
    
    print(ans)

Buggy submission (verdict: Runtime Error):
# -*- coding: utf-8 -*-
"""
Created on Wed Jun 24 20:53:22 2020

@author: NEC-PCuser
"""

def cmb(n, r, mod):
    if ( r<0 or r>n ):
        return 0
    r = min(r, n-r)
    return fact[n] * factinv[r] * factinv[n-r] % mod


p = 10 ** 9 + 7
N = 10 ** 6  # N は必要分だけ用意する
fact = [1, 1]  # fact[n] = (n! mod p)
factinv = [1, 1]  # factinv[n] = ((n!)^(-1) mod p)
inv = [0, 1]  # factinv 計算用
 
for i in range(2, N + 1):
    fact.append((fact[-1] * i) % p)
    inv.append((-inv[p % i] * (p // i)) % p)
    factinv.append((factinv[-1] * inv[-1]) % p)

if __name__ == '__main__':
    K = int(input())
    n = len(input())
    mod = 10**9+7 #出力の制限
    #25 25 a 25 25 25 b 25 25  c  26 26
    
    ans = 0
    for i in range(0, K + 1):
        ans1 = (((25 ** i) % (mod)) * cmb(n + i - 1, n - 1, mod)) % mod
        ans2 = (26 ** (K - i)) % mod
        ans += (ans1 * ans2) % mod
    
    print(ans)
Problem p02645 (python)

Fixed submission:
# -*- coding: utf-8 -*-
"""
Created on Sat Jun 13 21:27:14 2020

@author: NEC-PCuser
"""

print(input()[0:3])

Buggy submission (verdict: Runtime Error):
# -*- coding: utf-8 -*-
"""
Created on Sat Jun 13 21:30:21 2020

@author: NEC-PCuser
"""


A, V = map(int, input().split())
B, W = map(int, input().split())
T = int(input())


dis = abs(A - B)
soutai_v = V - W

if dis == 0:
    print("YES")
elif soutai_v <= 0:
    print("NO")
else:
    amari = dis % soutai_v
    shou = dis // soutai_v

    if shou > T or (shou == T and amari != 0):
        print("NO")
    else:
        print("YES")
Problem p02684 (python)

Fixed submission:
# -*- coding: utf-8 -*-
"""
Created on Sat Jun 20 10:11:22 2020

@author: NEC-PCuser
"""

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

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

tele_set = set()
tele_set.add(1)
junkai_town = -1 
junkai_first = -1
town = 1
for i in range(N):
    if A[town - 1] not in tele_set:
        tele_set.add(A[town - 1])
    else:
        junkai_town = A[town - 1]
        break
    town = A[town - 1] 

town = 1
start_flg = False
junkaimae_list = []
junkai_list = []
for i in range(N):
    if town == junkai_town and start_flg == False:
        junkai_first = i
        start_flg = True
    elif town == junkai_town:
        break
    if start_flg == True:
        junkai_list.append(town)
    else:
        junkaimae_list.append(town)
    town = A[town - 1]


if K < len(junkaimae_list):
    print(junkaimae_list[K])
else:
    kaisu = K - len(junkaimae_list)
    print(junkai_list[kaisu % len(junkai_list)])

Buggy submission (verdict: Runtime Error):
# -*- coding: utf-8 -*-
"""
Created on Sat Jun 20 10:11:22 2020

@author: NEC-PCuser
"""

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

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

tele_set = set()
tele_set.add(1)
junkai_town = -1 
junkai_first = -1
junkai_second = -1
for i in range(N):
    if A[i] not in tele_set:
        tele_set.add(A[i])
    else:
        junkai_town = A[i] - 1
        junkai_second = i
        break

town = 0
start_flg = False
junkaimae_list = []
junkai_list = []
for i in range(N):
    if town == junkai_town and start_flg == False:
        junkai_first = i
        start_flg = True
    elif town == junkai_town:
        break
    if start_flg == True:
        junkai_list.append(town)
    else:
        junkaimae_list.append(town)
    town = A[town] - 1

if K <= len(junkaimae_list):
    print(junkaimae_list[K - 1] + 1)
else:
    kaisu = K - len(junkaimae_list)
    print(junkai_list[kaisu % len(junkai_list)] + 1)
Problem p02900 (python)

Fixed submission:
# -*- coding: utf-8 -*-
"""
Created on Wed Jun  3 14:11:35 2020

@author: NEC-PCuser
"""
def gcd(a, b):
    
    if (a % b == 0):
        return b
    return gcd(b, a % b)

def factorize(num):
    i = 2
    factorize_list = []
    num_tmp = num
    while i * i <= num_tmp:
        count = 0
        if num % i == 0:
            while num % i == 0:
                count += 1
                num //= i
            factorize_list.append([i, count])
        i += 1
    if num != 1:
        factorize_list.append([num, 1])
    return factorize_list 
                


if __name__ == "__main__":
    A, B =  map(int, input().split())
    big_num = max(A, B)
    short_num = min(A, B)
    gcd_num = gcd(big_num, short_num)
    print(len(factorize(gcd_num)) + 1)

Buggy submission (verdict: Runtime Error):
# -*- coding: utf-8 -*-
"""
Created on Wed Jun  3 14:11:35 2020

@author: NEC-PCuser
"""
def gcd(a, b):
    
    if (a % b == 0):
        return b
    return gcd(b, a % b)

def factorize(num):
    i = 2
    factorize_list = []
    num_tmp = num
    while i * i <= num_tmp:
        count = 0
        if num % i == 0:
            while num % i == 0:
                count += 1
                num /= i
            factorize_list.append([i, count])
        i += 1
    return factorize_list 
                


if __name__ == "__main__":
    A, B =  map(int, input().split())
    big_num = max(A, B)
    short_num = min(A, B)
    gcd_num = gcd(big_num, short_num)
    print(len(factorize(gcd_num) + 1))
Problem p03125 (python)

Fixed submission:
# -*- coding: utf-8 -*-
"""
Created on Sat Feb 16 20:59:16 2019

@author: doppe
"""

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

if (B % A == 0):
    print(A + B)
else:
    print(B - A)

Buggy submission (verdict: Runtime Error):
# -*- coding: utf-8 -*-
"""
Created on Sat Feb 16 20:59:16 2019

@author: doppe
"""

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

for i in range(0, N):
    L = [int(i) for i in input().split()]
    likeListTmp = []
    if (i == 0):
        likeList = L
    else:
        for j in range(1, L[0] + 1):
            if (L[j] in likeList):
                likeListTmp.append(L[j])
        likeList = likeListTmp

print(len(likeList))