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

Fixed submission:
# -*- coding: utf-8 -*-
"""
Created on Wed May 13 11:55:25 2020

@author: shinba
"""

x,t = map(int,input().split())

if x <= t:
    print(0)
else:
    print(x-t)

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

cnt = 0
X=[]
for n in A:
    X.append(n)
    X.append(n-1)
    X.append(n+1)

Y = set(X)

y = list(Y)

for x in y:
    transient = 0
    for a in A:
        if -1 <= a - x <= 1:
            transient += 1
    else:
        if transient > cnt:
            cnt = transient

print(cnt)
Problem p03611 (python)

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

C = [0]*(10**5 + 2)

for i in A:
    C[i-1] += 1
    C[i] += 1
    C[i+1] += 1

print(max(C))

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

cnt = 0

for x in range(min(A),max(A)):
    transient = A.count(X-1) + A.count(X) + A.count(X+1)
    if transient > cnt:
        cnt = transient

print(cnt)
Problem p03696 (python)

Fixed submission:
n = int(input())
s = input()
d = [0]
cnt = 0
for i in range(n):
    if s[i] == "(":
        cnt += 1
    else:
        cnt -= 1
    d.append(cnt)
x = min(d)
print("("*(-x)+s+")"*(d[-1]-x))

Buggy submission (verdict: Runtime Error):
import sys
n = int(input())
s = input()
ans = s
while True:
    visited = [0]*(len(s))
    t = ""
    for i in range(len(s)-1):
        if not visited[i]:
            if s[i:i+2] == "()":
                visited[i+1] = 1
            else:
                t += s[i]
    if not visited[len(s)-1]:
        t += s[-1]
    s = t
    if not s:
        print(ans)
        sys.exit()
    if not "(" in s or not ")" in s:
        break
    for i in range(s.index(")(")+1,len(s)):
        if s[i] != "(":
            break
    else:
        break
print("("*s.count(")")+ans+")"*s.count("("))

Buggy submission (verdict: Runtime Error):
n = int(input())
s = input()
ans = s
while True:
    visited = [0]*(len(s))
    t = ""
    for i in range(len(s)-1):
        if not visited[i]:
            if s[i:i+2] == "()":
                visited[i+1] = 1
            else:
                t += s[i]
    if not visited[len(s)-1]:
        t += s[-1]
    s = t
    if not "(" in s or not ")" in s:
        break
    for i in range(s.index(")(")+1,len(s)):
        if s[i] != "(":
            break
    else:
        break
print("("*s.count(")")+ans+")"*s.count("("))
Problem p03731 (python)

Fixed submission:
# -*- coding: utf-8 -*-
"""
Created on Thu May 14 16:15:19 2020

@author: shinba
"""

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

T = list(map(int,input().split()))
T.append(10**10)
R = []
for i in range(n):
    R.append(T[i+1]-T[i])

ans = 0
start = T[0]

for i in range(n):
    if R[i] <= t:
        continue
    ans += t+(T[i]-start)
    start = T[i+1]
    
print(ans)

Buggy submission (verdict: Runtime Error):
# -*- coding: utf-8 -*-
"""
Created on Thu May 14 16:15:19 2020

@author: shinba
"""

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

T = list(map(int,input().split()))
T.append(10**10)
R = []
for i in range(n-1):
    R.append(T[i+1]-T[i])

ans = 0
start = T[0]

for i in range(n):
    if R[i] <= t:
        continue
    ans += t+(T[i]-start)
    start = T[i+1]
    
print(ans)
Problem p03739 (python)

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

S1 = 0
S2 = 0
#S1が奇数番目が正の場合、S2が偶数番目が負の場合
cnt1 = 0
cnt2 = 0

for i,num in enumerate(a):
    S1 += num
    if i % 2 == 0 and S1 <= 0:
        cnt1 += 1 - S1
        S1 = 1
    if i % 2 != 0 and S1 >= 0:
        cnt1 += 1 + S1
        S1 = -1

    S2 += num
    if i % 2 == 0 and S2 >= 0:
        cnt2 += 1 + S2
        S2 = -1
    if i % 2 != 0 and S2 <= 0:
        cnt2 += 1 - S2
        S2 = 1

print(cnt1 if cnt1 <= cnt2 else cnt2)

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

S1 = 0
S2 = 0
#S1が奇数番目が正の場合、S2が偶数番目が負の場合
cnt = 0

for i,num in enumerate(a):
    S1 += num
    if i % 2 == 0 and S1 <= 0:
        cnt1 += 1 - S1
        S1 = 1
    if i % 2 != 0 and S1 >= 0:
        cnt1 += 1 + S1
        S1 = -1

    S2 += num
    if i % 2 == 0 and S2 >= 0:
        cnt2 += 1 + S2
        S2 = -1
    if i % 2 != 0 and S2 <= 0:
        cnt2 += 1 - S2
        S2 = 1

print(cnt1 if cnt1 <= cnt2 else cnt2)
Problem p03761 (python)

Fixed submission:
from operator import itemgetter
import sys
n = int(input())
data = []
s = input()
if n == 1:
    L = list(s)
    L.sort()
    print("".join(L))
    sys.exit()
data.append(s)
S = set(list(s))
for i in range(n-1):
    s = input()
    S = S & set(list(s))
    data.append(s)
A = []
for i in S:
    ans = float("inf")
    for j in range(n-1):
        ans = min(ans,data[j].count(i))
    A.append([i,ans])
A.sort(key=itemgetter(0))
s = ""
for i in A:
    s += i[0]*i[1]
print(s)

Buggy submission (verdict: Runtime Error):
from operator import itemgetter
n = int(input())
data = []
s = input()
data.append(s)
S = set(list(s))
for i in range(n-1):
    s = input()
    S = S & set(list(s))
    data.append(s)
A = []
for i in S:
    ans = float("inf")
    for j in range(n-1):
        ans = min(ans,data[j].count(i))
    A.append([i,ans])
A.sort(key=itemgetter(0))
s = ""
for i in A:
    s += i[0]*i[1]
print(s)
Problem p03997 (python)

Fixed submission:
# -*- coding: utf-8 -*-
"""
Created on Fri May 15 12:41:57 2020

@author: shinba
"""

a = int(input())
b = int(input())
h = int(input())

print(int((a+b)*h/2))

Buggy submission (verdict: Runtime Error):
# -*- coding: utf-8 -*-
"""
Created on Fri May 15 12:41:57 2020

@author: shinba
"""

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

print(int((a+b)*h/2))
Problem p04043 (python)

Fixed submission:
# -*- coding: utf-8 -*-
"""
Created on Wed May 13 11:57:51 2020

@author: shinba
"""

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

B = [[5,5,7],[5,7,5],[7,5,5]]

if A in B:
    print("YES")
else:
    print("NO")

Buggy submission (verdict: Runtime Error):
N,L = map(int,input().split())
S = [input() for i in range(N)]

S.sort()

s = ""
for i in range(N):
    s += S[i]

print(s)
Problem p02765 (python)

Fixed submission:
n,r = map(int,input().split())
if n<10:
	r = 100*(10-n)+r
print(r)

Buggy submission (verdict: Runtime Error):
n,r = int(input().split())
if n<10:
	r = 100*(10-n)
print(r)
Problem p02778 (python)

Fixed submission:
s=input()
print("x"*len(s))

Buggy submission (verdict: Runtime Error):
n=int(input())
a=list(map(int,input().split()))
a.sort()
for i in range(n-1):
	if a[i]==a[i+1]:
		print("NO")
		break
else:
	print("YES")
Problem p03030 (python)

Fixed submission:
import sys
import math

N = int(input())

list = []

for i in range(N):
    S, P = input().split()
    list.append((S, int(P), i+1))

list = sorted(list, key=lambda x:x[1],reverse = True) 
list = sorted(list, key=lambda x:x[0]) 
for j in range(N):
	print(list[j][2])

Buggy submission (verdict: Runtime Error):
import sys
import math

N = int(input())

list = []

for i in range(n):
    S, P = input().split()
    list.append((S, int(P), i+1))

list = sorted(list, key=lambda x:x[1],reverse = True) 
list = sorted(list, key=lambda x:x[0]) 
for j in range(N):
	print(list[j][2])
Problem p03106 (python)

Fixed submission:
import sys
import math
import itertools

a,b,k=list(map(int,input().split()))
ans=[]
for i in range (1,max(a,b)+1,1):
	if a%i==0 and b%i==0:
		ans.append(i)
print(ans[-k])

Buggy submission (verdict: Runtime Error):
import sys
import math
import itertools

a,b,k=list(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[-k])
Problem p03210 (python)

Fixed submission:
import sys
import math
import itertools

n=int(input())
if n==5 or n==7 or n==3 :
	print("YES")
else :
	print("NO")

Buggy submission (verdict: Runtime Error):
import sys
import math
import itertools

n=int(input())
if n==5 or n==7 or n==3
	print("Yes")
else :
	print("No")
Problem p03557 (python)

Fixed submission:
import bisect
N=int(input())
A=sorted(list(map(int,input().split())))
B=sorted(list(map(int,input().split())))
C=sorted(list(map(int,input().split())))
ans=0
for i in B:
  a=bisect.bisect_left(A,i)
  b=N-bisect.bisect_right(C,i)
  ans+=a*b
print(ans)

Buggy submission (verdict: Runtime Error):

n=int(input())
a=list(map(int,input().split()))
b=list(map(int,input().split()))
c=list(map(int,input().split()))
for i in range(1,min(a)+1):
	if i in b:
		b.remove(i)
for i in range(1,min(b)+1):
	if i in c:
		c.remove(i)
count=0
for i in range(n):
	for j in range(n):
		if a[i]<b[j]:
			for k in range(n):
				if b[j]<c[k]:
					count+=1
print(count)
Problem p03633 (python)

Fixed submission:
import sys
import fractions

n=int(input())
list=[]
ans=1
for i in range(n):
	t=int(input())
	list.append(t)
	ans =ans * list[i] // fractions.gcd(ans, list[i])
print(ans)

Buggy submission (verdict: Runtime Error):
import sys
import fractions

n=int(input())
list=[]
count=1
ans=1
for i in range(n):
	t=int(input())
	if not t in list:
		list.append(t)
		count*=t
		ans = fractions.gcd(ans, list[i])
print(count//ans)
Problem p03720 (python)

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

Buggy submission (verdict: Runtime Error):
n,m=map(int,input().split())
list=[0]*4
for i in range(m):
	a,b=map(int,input().split())
	list[a-1]+=1
	list[b-1]+=1
for j in range(n):
	print(list[j])
Problem p03738 (python)

Fixed submission:
a=int(input())
b=int(input())
if a>b:
	print("GREATER")
elif a<b:
	print("LESS")
else:
	print("EQUAL")

Buggy submission (verdict: Runtime Error):
a=int(input())
b=int(input())
if a>b:
	print("GREATER")
else if a==b:
	print("LESS")
else:
	print("EQUAL")
Problem p03761 (python)

Fixed submission:
n=int(input())
s=[input() for num in range(n)]
for i in range(97,97+26,1):
	list=[]
	for j in range(n):
		list.append(s[j].count(chr(i)))
	print(chr(i)*min(list),end="")

Buggy submission (verdict: Runtime Error):
n=int(input())
s=[input() for num in range(n)]
for i in range(97,97+26,1):
	s0=s[0].count(chr(i))
	s1=s[1].count(chr(i))
	s2=s[2].count(chr(i))
	count=(min(s0,min(s1,s2)))
	for j in range(count):
		print(chr(i),end="")
Problem p02696 (python)

Fixed submission:
from math import floor
A,B,N = map(int,input().split())
x = min(B-1,N)
print(floor(A*x/B)-A*floor(x/B))

Buggy submission (verdict: Runtime Error):
from math import floor
A,B,N = map(int,input().split())
if N <= B:
    print(floor(A*N/B)-A*floor(N/B))
else:
    print("1"*"1")
    print(max(floor(A*N/B)-A*floor(N/B),floor(A*(B+1)/B)-A*floor((B+1)/B)))
Problem p02818 (python)

Fixed submission:
A,B,K = map(int,input().split())
"""
for i in range(K):
    if(A >= 1):
        A -= 1
    elif(B >= 1):
        B -= 1
    else:
        continue
"""

"""
if K >= A:
    _A = 0
else:
   _A = A - K

if K-A >= 1:
    _B = B-(K-A)
print(_A,_B)
"""

if K <= A:
    A_ = A - K
    B_ = B
elif K >= A + B:
    A_ = 0
    B_ = 0
else:
    A_ = 0
    B_ = B - (K - A)
print(A_,B_)

Buggy submission (verdict: Runtime Error):
A,B,K = map(int,input().split())
"""
for i in range(K):
    if(A >= 1):
        A -= 1
    elif(B >= 1):
        B -= 1
    else:
        continue
"""
if K >= A:
    _A = 0
else:
   _A = A - K

if K-A >= 1:
    _B = B-(K-A)
print(_A,_B)
Problem p03047 (python)

Fixed submission:
N,K = map(int,input().split())
print(N-(K-1))

Buggy submission (verdict: Runtime Error):
R,G,B,N = map(int,input().split())
ans = 0
for r in range(N//R+1):
    for g in range((N-R*r)//G+1):
        if (N-R*r+G*g)%B == 0:
            ans += 1
print(ans)
Problem p03206 (python)

Fixed submission:
Day = int(input())
if(Day == 25):
  print("Christmas")
elif(Day == 24):
  print("Christmas Eve")
elif(Day == 23):
  print("Christmas Eve Eve")
else:
  print("Christmas Eve Eve Eve")

Buggy submission (verdict: Runtime Error):
N,K = map(int,input().split())
h_list = [int(input()) for i in range(N)]
h_list.sort()
result = []
print(min([h_list[i+K-1]-h_list[i] for i in range(N-K+1)]))
Problem p03280 (python)

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

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

Fixed submission:
a,b,c = map(int,input().split())
if(a<=c and c<=a+b):
    print("YES")
else:
    print("NO")

Buggy submission (verdict: Runtime Error):
a,b,c = map(int,input().split())
if(a<=c and x<=a+b):
    print("YES")
else:
    print("NO")
Problem p03574 (python)

Fixed submission:
import numpy as np
H,W = map(int,input().split())
table = [["."]*(W+2),]
for _ in range(H):
    table.append([".",]+list(input())+[".",])
table.append(["."]*(W+2))
table = np.array(table)
ans = []
#print(table)
for h in range(H):
    for w in range(W):
        mawari = table[h:h+3,w:w+3]
        #print(mawari)
        if mawari[1,1] == ".":
            ans.append(np.count_nonzero(mawari=="#"))
        else:
            ans.append("#")
ans = np.array(ans).reshape(H,W).astype(np.unicode)
for i in ans:
    print("".join(i))

Buggy submission (verdict: Runtime Error):
import numpy as np
H,W = map(int,input().split())
table = [["."]*(W+2),]
for _ in range(H):
    table.append([".",]+list(input())+[".",])
table.append(["."]*(W+2))
table = np.array(table)
ans = []
#print(table)
for h in range(H):
    for w in range(W):
        mawari = table[h:h+3,w:w+3]
        if mawari.shape != (3,3):
            continue
        #print(mawari)
        if mawari[1,1] == ".":
            ans.append(np.count_nonzero(mawari=="#"))
        else:
            ans.append("#")
ans = np.array(ans).reshape(H,W)
#print(ans)
for i in ans:
    print("".join(i))

Buggy submission (verdict: Runtime Error):
import numpy as np
H,W = map(int,input().split())
table = [["."]*(W+2),]
for _ in range(H):
    table.append([".",]+list(input())+[".",])
table.append(["."]*(W+2))
table = np.array(table)
ans = []
#print(table)
for h in range(H):
    for w in range(W):
        mawari = table[h:h+3,w:w+3]
        #print(mawari)
        if mawari[1,1] == ".":
            ans.append(np.count_nonzero(mawari=="#"))
        else:
            ans.append("#")
ans = np.array(ans).reshape(H,W)
#print(ans)
for i in ans:
    print("".join(i))
Problem p03633 (python)

Fixed submission:
N = int(input())
ans = int(input())

def gcd(a,b):
    while b:
        a,b = b,a%b
    return a

def lcm(x,y):
    return (x*y//gcd(x,y))

for i in range(N-1):
    t = int(input())
    ans = lcm(ans,t)

print(ans)

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

def gcd(a,b):
    while b:
        a,b = b,a%b
    return a

def lcm(x,y):
    return (int(x*y/gcd(x,y)))

for i in range(N-1):
    t = int(input())
    ans = lcm(ans,t)

print(ans)

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

def gcd(a,b):
    while b:
        a,b = b,a%b
    return a

def lcm(x,y):
    return (int(x*y/gcd(x,y)))

for i in range(N):
    ans = lcm(ans,int(input()))

print(ans)

Buggy submission (verdict: Runtime Error):
import fractions
N = int(input())
ans = 1

def lcm(x,y):
    return (int(x*y/fractions.gcd(x,y)))

for i in range(N):
    ans = lcm(ans,int(input()))

print(ans)
Problem p02582 (python)

Fixed submission:
S = input()
a = 0
for i in range(3):
  if S[i]=="R":
    a+=1
  if S[i]=="S" and a>0:
      break
print(a)

Buggy submission (verdict: Runtime Error):
def main():
    N, K = list(map(int, input().split()))
    P = list(map(int, input().split()))
    C = list(map(int, input().split()))

    max_score = max(C)
    score = C
    P_now = P
    P_ci = P
    for _ in range(K-1):
        score = [score[i]+C[num-1] for i, num in enumerate(P_now)]
        if max_score < max(score):
            max_score = max(score)
            P_ci = P_now
        P_now = [P[i-1] for i in P_now]
        if P_ci == P_now:
            break
    print(max_score)

if __name__ == "__main__":
    main()

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

c = 0
max = 0

for i in S:
  if i==R:
    c += 1
  else:
    max = max([c, max])
    c = 1
    
print(max)
Problem p02582 (python)

Fixed submission:
s = input()
res = 0
cur = 0
for i in s:
  if i =='S':
    cur = 0
  else:
    cur += 1
  res = max(cur, res)
print(res)

Buggy submission (verdict: Runtime Error):
s = rawinput()
res = 0
cur = 0
for i in s:
  if i =='S':
    cur = 0
  else:
    cur += 1
  res = max(cur, res)
print(res)
Problem p03035 (python)

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

if a >= 13:
  print(b)
  
elif a >= 6:
  b //= 2
  print(b)
  
else:
  print(0)

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

if a >= 13:
  print(b)
  
else if a >= 6:
  b /= 2
  print(b)
  
else print(0)

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

if a >= 13:
  print(b)
  end()
  
if a >= 6:
  b /= 2
  print(b)
  end()
  
print(0)

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

if a >= 13:
  print(b)
  end()
  
if a >= 6:
  b /= 2
  print(b)
  end()
  
print(0)
Problem p03037 (python)

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

l = []
r = []

for i in range(m):
  ln, rn = map(int, input().split())
  l.append(ln)
  r.append(rn)
  
lmax = max(l)
rmin = min(r)


ans = rmin - lmax + 1
if (ans < 0):
  ans = 0

print(ans)

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

l = []
r = []

for i in range(M):
  ln, rn = map(int, input().split())
  l.append(ln)
  r.append(rn)
  
lmax = max(l)
rmin = min(r)

ans = rmin - lmax + 1

print(ans)

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

l, r = []

for i in range(M):
  ln, rn = map(int, input().split())
  l.append(ln)
  r.append(rn)
  
lmax = max(l)
rmin = min(r)

ans = rmin - lmax + 1

print(ans)
Problem p02642 (python)

Fixed submission:
n = int(input())
a = list(map(int,input().split()))
a.sort()
dp = [0]*(a[-1]+1)
k = 2
while k*a[0] <= a[-1]:
    dp[k*a[0]] += 1
    k += 1

for i in range(1,n):
    if a[i] == a[i-1]:
        dp[a[i]] += 1
    else:
        k = 2
        while k*a[i] <= a[-1]:
            dp[k*a[i]] += 1
            k += 1
ans = 0
for elem in a:
    if dp[elem] == 0:
        ans += 1
print(ans)

Buggy submission (verdict: Runtime Error):
import sys
input = sys.stdin.readline
n = int(input())
a = list(map(int,input().split()))
a.sort()
ans = 0
if a[0] != a[1]:
    ans += 1
for i in range(1,n):
    if a[i] != a[i-1]:
        div = True
        j = 0
        while 2*a[j] <= a[i]:
            if a[i] < 2*a[j]:
                if i < n-1 and a[i] == a[i+1]:
                    div = False
                break
            if a[i]%a[j] == 0:
                div = False
                break
            j += 1
        if div:
            ans += 1
print(ans)

Buggy submission (verdict: Runtime Error):
import sys
input = sys.stdin.readline
n = int(input())
a = list(map(int,input().split()))
a.sort()
ans = 0
if a[0] != a[1]:
    ans += 1
for i in range(1,n):
    if a[i] != a[i-1]:
        div = True
        for j in range(i):
            if a[i] < 2*a[j]:
                if i < n-1 and a[i] == a[i+1]:
                    div = False
                break
            if a[i]%a[j] == 0:
                div = False
                break
        if div:
            ans += 1
print(ans)
Problem p02684 (python)

Fixed submission:
import sys
input = sys.stdin.readline
n,k = map(int,input().split())
alist = list(map(lambda x:int(x) - 1,input().split()))
count = [0]*n
count[0] += 1
now = 0
order = [0]
for i in range(k):
    now = alist[now]
    count[now] += 1
    if count[now] == 2:
        start = order.index(now)
        loop = len(order[start:])
        syoki = len(order[:start])
        break
    order.append(now)
else:
    print(now+1)
    exit()
k -= syoki
k %= loop
print(order[k+syoki] + 1)

Buggy submission (verdict: Runtime Error):
import sys
input = sys.stdin.readline
n,k = map(int,input().split())
a = [0] +  list(map(int,input().split()))

vlist = [1]
vcnt = [0]*(n+1)
vcnt[1] += 1
v = 1
for i in range(1,n+1):
    v = a[v]
    vlist.append(v)
    if i == k:
        print(vlist[-1])
        exit()
    if vcnt[v] == 0:
        vcnt[v] += i
    else:
        syuuki = i - vcnt[v]
        hajime = i - syuuki
        break
k -= hajime
k %= syuuki
k += hajime 
print(vlist[k])

Buggy submission (verdict: Runtime Error):
n,k = map(int,input().split())
a = [0] + list(map(int,input().split()))
vcnt = [0]*(n+1)
vcnt[1] += 1
v = 1
sentou = 0
slist = []
vlist = [1]
hajime = 10**10
for i in range(1,k+1):
    v = a[v]
    vlist.append(v)
    vcnt[v] += 1
    if sentou > 0:
        syuuki += 1
    if vcnt[v] == 2:
        syuuki = 1
        sentou = a[v]
        slist.append(v)
    if vcnt[v] == 3:
        syuuki += 1
        hajime = i - syuuki*2
        break
else:
    print(v)
    exit()
#print(syuuki,hajime,sentou)
#print(slist)
k -= hajime
#print(slist)
slist = [0] + slist
if (k+1)%syuuki == 0:
    print(slist[-1])
else:
    print(slist[(k+1)%syuuki])

Buggy submission (verdict: Runtime Error):
n,k = map(int,input().split())
a = [0] + list(map(int,input().split()))
vcnt = [0]*(n+1)
vcnt[1] += 1
v = 1
sentou = 0
slist = []
vlist = [1]
hajime = 10**10
for i in range(1,k+1):
    v = a[v]
    vlist.append(v)
    vcnt[v] += 1
    if sentou > 0:
        syuuki += 1
    if vcnt[v] == 2:
        syuuki = 1
        sentou = a[v]
        slist.append(v)
    if vcnt[v] == 3:
        syuuki += 1
        hajime = i - syuuki*2
        break
else:
    print(v)
    exit()
#print(syuuki,hajime,sentou)
#print(slist)
k -= hajime
print(slist)
slist = [0] + slist
if (k+1)%syuuki == 0:
    print(slist[-1])
else:
    print(slist[(k+1)%syuuki])
Problem p02720 (python)

Fixed submission:
k = int(input())
lunlun = [1,2,3,4,5,6,7,8,9]
i = 0
while len(lunlun) < k:
  p = lunlun[i]
  if str(p)[-1] == '0':
    lunlun.append(p*10)
    lunlun.append(p*10+1)
  elif str(p)[-1] == '9':
    lunlun.append(p*10+8)
    lunlun.append(p*10+9)
  else:
    lunlun.append(p*10+p%10-1)
    lunlun.append(p*10+p%10)
    lunlun.append(p*10+p%10+1)
  i += 1

print(lunlun[k-1])

Buggy submission (verdict: Runtime Error):
k = int(input())
lunlun = [1,2,3,4,5,6,7,8,9]
i = 0
while len(lunlun) < k:
  p = lunlun[i]
  if str(p)[-1] == 0:
    lunlun.append(int(str(p)+'0'))
    lunlun.append(int(str(p)+'1'))
  elif str(p)[-1] == 9:
    lunlun.append(int(str(p)+'8'))
    lunlun.append(int(str(p)+'9'))
  else:
    lunlun.append(int(str(p)+str(int(str(p)[-1])-1)))
    lunlun.append(int(str(p)+str(int(str(p)[-1]))))
    lunlun.append(int(str(p)+str(int(str(p)[-1])+1)))
  i += 1

print(lunlun[k-1])
Problem p02743 (python)

Fixed submission:
a,b,c = map(int,input().split())
if c-a-b<=2:
  print("No")
else:
  if (c-a-b)**2-4*a*b>0:
    print("Yes")
  else:
    print("No")

Buggy submission (verdict: Runtime Error):
a,b,c = map(int,input().split())
if c-a-b<=0:
  print("No")
else:
  if (c-a-b)**2-4a*b>0:
    print("Yes")
  else("No")

Buggy submission (verdict: Runtime Error):
a,b,c = map(int,input().split())
if c-a-b<=0:
  print("No")
else:
  if (c-a-b)**2>4ab:
    print("Yes")
  else("No")

Buggy submission (verdict: Runtime Error):
import math
a,b,c = map(int,input().split())
if math,sqrt(a) + math,sqrt(b) < math,sqrt(c):
  print("Yes")
else:
  print("No")
Problem p02882 (python)

Fixed submission:
import math
a,b,x = map(int,input().split())
l = 2/a**2*(a**2*b-x)
if x >= a**2*b/2:
  if l != 0:
    print(90-math.degrees(math.atan(a/l)))
  else:
    print(0)
else:
  k = 2*x/(b*a)
  print(90-math.degrees(math.atan(k/b)))

Buggy submission (verdict: Runtime Error):
import math
a,b,x = map(int,input().split())
l = 2/a**2*(a**2*b-x)
if x >= a**2*b/2:
  print(90-math.degrees(math.atan(a/l)))
else:
  k = 2*x/(b*a)
  print(90-math.degrees(math.atan(k/b)))