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

Fixed submission:
a,b,c=input().split()
print((a[0]+b[0]+c[0]).upper())

Buggy submission (verdict: Runtime Error):
a,b,c=map(int,input().split())
print((a[0]+b[0]+c[0]).upper())

Buggy submission (verdict: Runtime Error):
print((input()[0]+input()[0]+input()[0]).upper())
Problem p03738 (python)

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

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

Fixed submission:
O=list(input())
E=list(input())+[""]
for i,j in zip(O,E):
  print(i+j,end="")

Buggy submission (verdict: Runtime Error):
O=list(input())
E=list(input())+[""]
for i in zip(O,E):
  print(x+y,end="")
Problem p03778 (python)

Fixed submission:
w,a,b=map(int,input().split())
print(max(abs(a-b)-w,0))

Buggy submission (verdict: Runtime Error):
w,a,b=map(int,input().split())
print(max(abs(s-b)-w,0))
Problem p03814 (python)

Fixed submission:
s=input()
print(len(s)-s[::-1].index("Z")-s.index("A"))

Buggy submission (verdict: Runtime Error):
s=input()
print(len(s)-s[::-1].index("z")-s.index("A"))

Buggy submission (verdict: Runtime Error):
s=input()
print(len(s)-s[::-1].index("z")+s.index("A"))
Problem p03844 (python)

Fixed submission:
print(eval(input().replace(" ","")))

Buggy submission (verdict: Runtime Error):
print(eval(input().split()))
Problem p03998 (python)

Fixed submission:
S={c:list(input()) for c in "abc"}
s="a"
while S[s]:
  s=S[s].pop(0)
print(s.upper())

Buggy submission (verdict: Runtime Error):
S={c:list for c in "abc"}
s="a"
while S[s]:
  s=S[s].pop(0)
print(s.upper())
Problem p04029 (python)

Fixed submission:
print(sum(range(int(input())+1)))

Buggy submission (verdict: Runtime Error):
print(sum(range(int(input())+1))

Buggy submission (verdict: Runtime Error):
print(sum(range(1,int(input())+1))
Problem p04030 (python)

Fixed submission:
t=""
for i in input():
  if i=="B":
    if len(t)!=0:
      t=t[:-1]
  else:t+=i
print(t)

Buggy submission (verdict: Runtime Error):
ans=""
for i in input():
  if x=="B":
    if len(t)==0:
      t=t[a:-1]
  else:t+=i
print(ans)

Buggy submission (verdict: Runtime Error):
ans=""
for i in input():
  if x=="B":t=t[:-1]
  else:t+=i
print(ans)

Buggy submission (verdict: Runtime Error):
ans=""
for i in input():
  if x=="B":
    t=t[:-1]
print(ans)
Problem p04031 (python)

Fixed submission:
n=int(input())
A=list(map(int,input().split()))
m=sum(A)//n
print(min(sum(map(lambda x:(x-m)**2,A)),sum(map(lambda x:(x-m-1)**2,A))))

Buggy submission (verdict: Runtime Error):
n=int(input())
A=list(map(int,input().split()))
m=sum(A)//n
print(max(sum(map(lambda x:(x-m)**2,A)),sum(map(lambda x:(x-m-1)**2,A)))
Problem p02630 (python)

Fixed submission:
N = input()
arr = [int(x) for x in input().split()]

q = int(input())
ans = sum(arr)

hashmap = {}
for val in arr:
    if val in hashmap:
        hashmap[val] += 1
    else:
        hashmap[val] = 1


while q > 0:

    [x, y] =  [int(x) for x in input().split()]
    if x in hashmap:
        if y in hashmap:
            hashmap[y] += hashmap[x]
            ans -= hashmap[x]*x
            ans += y*hashmap[x]
            del hashmap[x]
        else:
            diff = hashmap[x] * x
            ans -= diff
            hashmap[y] = hashmap[x]
            del hashmap[x]
            add = hashmap[y] * y
            ans += add
        
    print(ans)
    q -=1

Buggy submission (verdict: Runtime Error):
N = input()
arr = [int(x) for x in input().split()]

q = int(input())
ans = sum(arr)

hashmap = {}
for val in arr:
    if val in hashmap:
        hashmap[val] += 1
    else:
        hashmap[val] = 1


while q > 0:
    print(hashmap)
    [x, y] =  [int(x) for x in input().split()]
    if x in hashmap:
        if y in hashmap:
            hashmap[y] += hashmap[x]
            ans -= hashmap[x]*x
            ans += y*hashmap[x]
        else:
            diff = hashmap[x] * x
            ans -= diff
            hashmap[y] = hashmap[x]
            del hashmap[x]
            add = hashmap[y] * y
            ans += add
        
    print(ans)
    q -=1
Problem p02621 (python)

Fixed submission:
a=int(input())
print(a+a*a+a*a*a)

Buggy submission (verdict: Runtime Error):
num=int(input())
print(a+a*a+a*a*a)
Problem p02705 (python)

Fixed submission:
num=int(input())
print(num*2*3.1415926535)

Buggy submission (verdict: Runtime Error):
num=int(input())
print(num*2*3. 1415926535)
Problem p02718 (python)

Fixed submission:
num=input().rstrip().split(" ")
N=int(num[0])
M=int(num[1])
date=input().rstrip().split(" ")
sum=0
for i in range(N):
  sum+=int(date[i])
for j in range(len(date)):
  date[j]=int(date[j])
date=sorted(date,reverse=True)
if (sum/4)/M<=int(date[M-1]):
  print("Yes")
else:
  print("No")

Buggy submission (verdict: Runtime Error):
num=input().rstrip().split(" ")
N=int(num[0])
M=int(num[1])
date=input().rstrip().split(" ")
sum=0
for i in range(N):
  sum+=int(date[N])
date=sorted(date,reverse=True)
if (sum/4)/M<=date[M-1]:
  print("Yes")
else:
  print("No")
Problem p02553 (python)

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

Buggy submission (verdict: Runtime Error):
for _ in range(int(input())):
  a,b,c,d=map(int,input().split())
  print(max(a*c,a*d,b*d,b*c))
Problem p02641 (python)

Fixed submission:

x,y=map(int,input().split())
a=set(list(map(int,input().split())))
if y==0:
    print(x)
else:
    b=[i for i in range(-5,105)]
    b=set(b)
    c=list(b-a)
    c.append(x)
    c.sort()

    r=c.index(x)
    
    p=abs(c[r]-c[r-1])
    q=abs(c[r]-c[r+1])
    if p==q:
            print(min(c[r-1],c[r+1]))
    elif p>q:
            print(c[r+1])
    else:
            print(c[r-1])

Buggy submission (verdict: Runtime Error):
def searchInsert(nums, target):
    l = 0
    r = len(nums) - 1
    while (l <= r):
        mid = (l + r) // 2
        if target == nums[mid]:
            return mid
        elif target > nums[mid]:
            l = mid + 1
        else:
            r = mid - 1
    return l
x,y=map(int,input().split())
a=set(list(map(int,input().split())))
if y==0:
    print(x)
else:
    b=[i for i in range(1,101)]
    b=set(b)
    c=list(b-a)
    t=searchInsert(c,x)

    print(min(c[t],c[t-1]))
Problem p02705 (python)

Fixed submission:
print(2*(22/7)*int(input()))

Buggy submission (verdict: Runtime Error):
import math
print(2*math.pi()*int(input()))
Problem p02713 (python)

Fixed submission:
import math
n=int(input())
s=0
for i in range(1,n+1):
    for j in range(1,n+1):
        for k in range(1,n+1):
            s+=math.gcd(i,math.gcd(j,k))
print(s)

Buggy submission (verdict: Runtime Error):
import math
n=int(input())
s=0
for i in range(1,n+1):
    for j in range(1,n+1):
        for k in range(1,n+1):
            s+=gcd(i,gcd(j,k))
print(s)
Problem p02730 (python)

Fixed submission:
def reverse(s):
    return s[::-1]
a=str(input())
b=reverse(a)
n=len(a)
c=a[:(n-1)//2]
d=reverse(c)
e=a[(n+3)//2-1:n]
f=reverse(e)

if a==b and c==d and e==f:
    print('Yes')
else:
    print('No')

Buggy submission (verdict: Runtime Error):
a=list(input())
b=a.copy()
b.reverse()
n=len(a)
k=0
r=''
s=''
rr=''
t=''
if (n-1)//2>n:
    k+=1
else:
    t=a[:(n-1)//2]
    s=t.copy()
    s.reverse()
if (n+3)//2-1>n:
    k+=1
else:

    r=a[(n+3)//2-1:n]
    rr=r.copy()
    rr.reverse()
if k>0:
    print('No')
else:
    if a==b and r==rr and t==s:
        print('Yes')
    else:
        print('No')

Buggy submission (verdict: Runtime Error):
a=list(input())
b=a.copy()
b.reverse()
n=len(a)
t=a[:(n-1)//2]
s=t.copy()
s.reverse()
r=a[(n+3)//2-1:n]
rr=r.copy()
rr.reverse()

if a==b and r==rr and t==s:
    print('Yes')
else:
    print('No')
Problem p02765 (python)

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

Buggy submission (verdict: Runtime Error):
import math
n,k=map(int,input().split())
t=math.log(n,k)
if t==int(t):
    print(int(t))
else:
    print(int(t)+1)

Buggy submission (verdict: Runtime Error):
import math
n,k=map(int,input().split())
t=math.log(n,k)
if t==int(t):
    print(int(t))
else:
    print(int(t)+1)
Problem p02780 (python)

Fixed submission:
n,k=map(int,input().split())
a=list(map(int,input().split()))
b=[]
max1=0
s=0
c=[]
p=0
if n==k:
    for i in range(n):
        p += (1 / a[i]) * (a[i] * (a[i] + 1) / 2)
else:
    for i in range(n):
        s+=a[i]
        c.append(s)

        if i-k>-1:
            b.append(s-c[i-k])


    t=max(b)
    r=b.index(t)

    for i in range(r+1,r+k+1):
        p+=(1/a[i])*(a[i]*(a[i]+1)/2)
print(p)

Buggy submission (verdict: Runtime Error):
n,k=map(int,input().split())
a=list(map(int,input().split()))
b=[]
max1=0
s=0
c=[]
p=0
for i in range(n):
    s+=a[i]
    c.append(s)

    if i-k>-1:
        b.append(s-c[i-k])


t=max(b)
r=b.index(t)

for i in range(r+1,r+k+1):
    p+=(1/a[i])*(a[i]*(a[i]+1)/2)
print(p)
Problem p02582 (python)

Fixed submission:
s = input()
if s == "SSS":
    print(0)
if s == 'SSR' or s == 'SRS' or s == 'RSS'or s == 'RSR':
    print(1)
if s == 'RRS'or s == 'SRR':
    print(2)
if s == 'RRR':
    print(3)

Buggy submission (verdict: Runtime Error):
s = input()
if s == "SSS":
    print(0)
if s == 'SSR' or s == 'SRS' or s == 'RSS'or s == 'RSR':
    print(1)
if s == 'RRS'or s == 'SRR':
    print(2)
if s == 'RRR' print(3)
Problem p02615 (python)

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

ans = -A[0]
for i in range(N):
    ans += A[i//2]
print(ans)

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

ans = A[N]
cnt = 1
i = 1

while cnt <= N:
    ans += 2*A[N-i]
    i += 1
    cnt += 2

if N != cnt:
    ans -= A[N-i]

print(ans)
Problem p02687 (python)

Fixed submission:
S = str(input())
if S == "ABC":
    print("ARC")
else:
    print("ABC")

Buggy submission (verdict: Runtime Error):
S = str(input())
if S = "ABC":
    print("ARC")
else:
    print("ABC")
Problem p02717 (python)

Fixed submission:
X, Y, Z = map(str, input().split())
print(Z + " " + X + " " + Y)

Buggy submission (verdict: Runtime Error):
X, Y, Z = str(input())
print(Z + " " + X + " " + Y)
Problem p02761 (python)

Fixed submission:
# C - Guess The Number
N, M = map(int, input().split())
SC = [list(map(int, input().split())) for _ in range(M)]

ans = [0,0,0]

# 条件だけで不適がわかるものは弾く
for i in range(M):
    for j in range(i+1,M):
        if (SC[i][0] == SC[j][0]) and (SC[i][1] != SC[j][1]):
            print(-1)
            quit()

# 各桁を指定をする
for k in range(M):
    ans[SC[k][0]-(N-2)] = str(SC[k][1])

# 頭の桁が0で指定されると不適(str型かどうかで判定する)
if (ans[3-N] == "0") and (N == 1):
    print(0)
    quit()
elif ans[3-N] == "0":
    print(-1)
    quit()

# N桁の文字列にする
ans = [str(ans[i]) for i in range(3)]
res = "".join(ans)
res = res[(3-N):4]

# 頭の桁が指定無しの0だったら1に変える
if (res[0] == "0") and (N == 1):
    res = "0"
elif res[0] == "0":
    ref = list(res)
    ref[0] = "1"
    res = "".join(ref)

print(res)

Buggy submission (verdict: Runtime Error):
lst = []

for i in range(10):
    for j in range(10):
        for k in range(10):
            lst.append(str(i)+str(j)+str(k))

N, M = map(int, input().split())
S = []
C = []
for l in range(M):
    S.append(0)
    C.append(0)
    S[l], C[l] = map(int, input().split())
    C[l] = str(C[l])

for n in range(1000):
    for m in range(M):
        if lst[n][S[m]-1] != C[m]:
            lst[n] = "1000"
    lst[n] = int(lst[n])

if min(list) == 1000:
    print(-1)
else:
    print(min(lst))
Problem p02885 (python)

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

# Input
i = list(map(int, input().split()))

# Process
X = i[0] - i[1]*2

# Output
if X > 0:
    print(X)
else:
    print(0)

Buggy submission (verdict: Runtime Error):
i = input(map(int, input().split()))
A = i[0]
B = i[1]

if A-B*2>0;
	print(A-B*2)
  else;
	print(0)
Problem p02898 (python)

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

ans = 0
for i in range(N):
    if A[i] >= K:
        ans += 1

print(ans)

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

ans = 0
for i in range(N):
    if A[i] >= K:
        cnt += 1

print(ans)
Problem p02909 (python)

Fixed submission:
s = input()
 
if s == 'Sunny':
  print('Cloudy')
elif s == 'Cloudy':
  print('Rainy')
else:
  print('Sunny')

Buggy submission (verdict: Runtime Error):
# -*- coding: utf-8 -*-
import sys
input = sys.stdin.readline

# Input
s = [input() for i in range(2)]

N = int(s[0].split()[0])
M = int(s[0].split()[1])
A = list(map(int, s[1].split()))

A.sort(reverse=True)

# 2で割って小数点切り下げする操作を大きい金額から順次M回繰り返す
for i in range(M):
    A[A.index(max(A))] = max(A) // 2

P = sum(A)

# Output
print(P)

Buggy submission (verdict: Runtime Error):
s = input()
 
if s == 'Sunny':
  pirnt('Cloudy')
elif s == 'Cloudy':
  pirnt('Rainy')
elif s == 'Rainy':
  print('Sunny')
else:
  break

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

if s == 'Sunny':
  pirnt('Cloudy')
elif s == 'Cloudy':
  pirnt('Rainy')
else:
  print('Sunny')
Problem p03071 (python)

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

ans = 0
for i in range(2):
    if A >= B:
        ans += A
        A -= 1
    else:
        ans += B
        B -= 1
print(ans)

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

ans = 0
for i in range(2):
    if A >= B:
        ans += A
        A -= 1
    else:
        ans += B
        B -= 1
print(ans)
Problem p03086 (python)

Fixed submission:
s = list(input())
N = len(s)

ref = ["A","C","G","T"]
lst = []

for i in range(N):
    ans = ""
    if s[i] in ref:
        while s[i] in ref:
            ans = ans + s[i]
            i += 1
            if i >= N:
                break
    lst.append(ans)

ans = -float("inf")
for i in range(N):
    ans = max(ans, len(lst[i]))

print(ans)

Buggy submission (verdict: Runtime Error):
s = list(input())
N = len(s)

ref = ["A","C","G","T"]
lst = []

for i in range(N):
    ans = ""
    if s[i] in ref:
        while s[i] in ref:
            ans = ans + s[i]
            i += 1
    lst.append(ans)

ans = -float("inf")
for i in range(N):
    ans = max(ans, len(lst[i]))

print(ans)
Problem p03106 (python)

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

lst = []
for i in range(1,min(A,B)+1):
    if A % i == 0 and B % i == 0:
        lst.append(i)

print(lst[-K])

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

lst = [1]
for i in range(2,max(A,B)):
    if A % i == 0 and B % i == 0:
        lst.append(i)

print(lst[-K])

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

lst = []
for i in range(1,max(A,B)):
    if A % i == 0 and B % i == 0:
        lst.append(i)

print(lst[K-1])
Problem p03136 (python)

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

sum = 0

for i in range(N):
    sum += Ls[i]

if max(Ls)*2 < sum:
    print("Yes")
else:
    print("No")

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

sum = 0

for i in range(N):
    sum += Ls[i]

if max(Ls)*2 < sum:
    print("Yes")
else:
    print("No")
Problem p03316 (python)

Fixed submission:
N = int(input())
s = list(str(N))
S = 0
for i in range(len(s)):
    S += int(s[i])

if N % S == 0:
    print("Yes")
else:
    print("No")

Buggy submission (verdict: Runtime Error):
N = int(input())
s = list(str(N))
S = 0
for i in range(len(s)):
    S += s[i]

if N % S == 0:
    print("Yes")
else:
    print("No")

Buggy submission (verdict: Runtime Error):
s = str(input())
N = int(s)
S = sum(list(s))
if N % S == 0:
    print("Yes")
else:
    print("No")

Buggy submission (verdict: Runtime Error):
s = str(input())
N = int(S)
S = sum(list(s))
if N % S == 0:
    print("Yes")
else:
    print("No")
Problem p03324 (python)

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

lst = []
X = "00" * D

for i in range(1,102):
    if i % 100 == 0:
        pass
    else:
        lst.append(str(i) + X)

print(lst[N-1])

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

lst = []
X = "00" ** D

for i in range(1,102):
    if i % 100 == 0:
        pass
    else:
        lst.append(str(i) + X)

print(lst[N-1])

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

lst = []
X = 100 ** D

for i in range(1,102):
    if i % 100 == 0:
        pass
    else:
        lst.append(str(i) + X)

print(lst[N-1])

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

lst = []
X = 100 ** D

for i in range(1,101):
    if i % X == 0:
        pass
    else:
        lst.append(i*X)

print(lst[N-1])
Problem p03328 (python)

Fixed submission:
a, b = map(int, input().split())
X = b - a
ans = 0
for i in range(X):
    ans += i
print(ans-a)

Buggy submission (verdict: Runtime Error):
a, b = int(input())
X = b - a
ans = 0
for i in range(X):
    ans += i
print(ans)
Problem p03417 (python)

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

ans = 0
if N == 1 and M == 1:
    ans = 1
elif N == 1 and M > 1:
    ans = M-2
elif N > 1 and M == 1:
    ans = N-2
else:
    ans = (N-2)*(M-2)

print(ans)

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

NM = [[0]*(M+2) for _ in range(N+2)]

for i in range(1,N+1):
    for j in range(1,M+1):
        NM[i-1][j-1] = ~NM[i-1][j-1]
        NM[i-1][j-0] = ~NM[i-1][j-0]
        NM[i-1][j+1] = ~NM[i-1][j+1]
        NM[i-0][j-1] = ~NM[i-0][j-1]
        NM[i-0][j-0] = ~NM[i-0][j-0]
        NM[i-0][j+1] = ~NM[i-0][j+1]
        NM[i+1][j-1] = ~NM[i+1][j-1]
        NM[i+1][j-0] = ~NM[i+1][j-0]
        NM[i+1][j+1] = ~NM[i+1][j+1]

print(NM)

ans = 0
for k in range(1,N+1):
    ans += sum(NM[k][1:M+1])

print(-1*ans)
Problem p03424 (python)

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

if "Y" in S:
    print("Four")
else:
    print("Three")

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

if "Y" in S:
    print("Four")
else:
    print("Three")
Problem p03456 (python)

Fixed submission:
a, b = map(str, input().split())
res = int(a+b)
ans = "No"
for i in range(int(res**0.5)+1):
    if i**2 == res:
        ans = "Yes"
        break
print(ans)

Buggy submission (verdict: Runtime Error):
a, b = map(str, input().split())
res = int(a+b)
ans = "No"
for i in range(res**0.5):
    if i**2 == res:
        ans = "Yes"
        break
print(ans)
Problem p03474 (python)

Fixed submission:
A, B = map(int, input().split())
S = list(map(str, input().split("-")))
ans = "No"
if A == len(S[0]):
    if B == len(S[1]):
        ans = "Yes"
print(ans)

Buggy submission (verdict: Runtime Error):
A, B = map(int, input().split())
S = list(map(str, input().split(-)))
ans = "No"
if A == len(S[0]):
    if B == len(S[1]):
        ans = "Yes"
print(ans)

Buggy submission (verdict: Runtime Error):
AB = map(int, input().split())
S = list(map(str, input().split(-)))
ans = "No"
if AB[0] == len(S[0]):
    if AB[1] == len(S[1]):
        ans = "Yes"
print(ans)
Problem p03502 (python)

Fixed submission:
n = list(input())
N = ""
M = 0

for i in range(len(n)):
    N += n[i]
    M += int(n[i])

N = int(N)

if N % M == 0:
    print("Yes")
else:
    print("No")

Buggy submission (verdict: Runtime Error):
n = list(input())
N = int(sum(n))
M = 0
for i in range(len(n)):
    M += int(n[i])
if N % M == 0:
    print("Yes")
else:
    print("No")
Problem p03556 (python)

Fixed submission:
N = int(input())

ans = 1
for i in range(N):
    if i**2 > N:
        ans = (i-1)**2
        break

print(ans)

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


while N > i**2:
    i += 1

print((i-1)**2)
Problem p03624 (python)

Fixed submission:
S = list(input())
lst = [chr(i) for i in range(97, 97+26)]
res = sorted(list(set(lst) - set(S)))

if res == []:
    print("None")
else:
    print(res[0])

Buggy submission (verdict: Runtime Error):
S = list(input())
lst = [chr(i) for i in range(97, 97+26)]
res = sorted(list(set(lst) - set(S)))

if res = []:
    print("None")
else:
    print(res[0])
Problem p03680 (python)

Fixed submission:
# ABC065_B
N = int(input())
A = [int(input()) for _ in range(N)]

now = 0
cnt = 0
while now != 1:
    now = A[now] - 1
    cnt += 1
    if cnt > N:
        cnt = -1
        break
print(cnt)

Buggy submission (verdict: Runtime Error):
# ABC065_B
N = int(input())
A = [int(input()) for _ in range(N)]
next = A[0]
ans = -1
cnt = 0
for i in range(N):
    next = A[next]
    cnt += 1
    if next == 2:
        ans = cnt
        break
print(ans)
Problem p03694 (python)

Fixed submission:
# ABC064_B
N = int(input())
A = list(map(int,input().split()))
print(max(A)-min(A))

Buggy submission (verdict: Runtime Error):
# ABC064_B
N = int(input())
A = [list(map(int,input().split()))]
print(max(A)-min(A))
Problem p03711 (python)

Fixed submission:
A = [[1,3,5,7,8,10,12],[4,6,9,11],[2]]
x,y = map(int, input().split())
flg = 0
for a in A:
    if x in a and y in a:
        flg = 1

if flg == 1:
    print("Yes")
else:
    print("No")

Buggy submission (verdict: Runtime Error):
A = [[1,3,5,7,8,10,12],[4,6,9,11],[2]]
x,y = map(int, input().split())
flg = 0
for a in A:
    if x in a and y in a:
        flg = 1

if flg = 1:
    print("Yes")
else:
    print("No")
Problem p03720 (python)

Fixed submission:
N, M = map(int, input().split())
A = [list(map(int, input().split())) for _ in range(M)]
R = sum(A,[])

for i in range(1,N+1):
    print(R.count(i))

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

for i in range(1,N+1):
    print(R.count(i))
Problem p03731 (python)

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

ans = T

for i in range(N-1):
    if t[i+1] - t[i] >= T:
        ans += T
    else: # t[i+1]-t[i]<T
        ans += t[i+1] - t[i]

print(ans)

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

lst = [0]*(t[N-1]+T)

for i in range(N):
    for j in range(T):
        lst[t[i]+j] += 1

ans = len(lst) - lst.count(0)
print(ans)
Problem p03796 (python)

Fixed submission:
N = int(input())
fact = 1
for integer in range(1,N+1):
    fact = fact * integer % 1000000007
print(fact)

Buggy submission (verdict: Runtime Error):
N = int(input())
fact = 1
for integer in range(1,N+1):
    fact = fac * integer % 1000000007
print(fact)

Buggy submission (verdict: Runtime Error):
N = int(input())
def fract(n):
    if n == 0:
        return 1
    elif n == 1:
        return n
    return n * fract(n-1)

res = fract(N) % 1000000007
print(res)

Buggy submission (verdict: Runtime Error):
N = int(input())
def fract(n):
    if n == 1:
        return n
    return n * fract(n-1)
res = fract(N) % 1000000007
print(res)

Buggy submission (verdict: Runtime Error):
N = int(input())
def fract(n):
    if n == 1:
        return n
    return n * fract(n-1)
res = fract(N) % 1000000007
print(res)

Buggy submission (verdict: Runtime Error):
N = int(input())
def fract(n):
    if n == 1:
        return n
    return n * fract(n-1)
res = fract(N) /(1000000007)
print(res)
Problem p03826 (python)

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

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

if A*B >= C*D:
    print(A*B)
else:
    print(C*D)

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

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

if A*B >= C*D:
    print(A*B)
else:
    print(C*D)

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

A, B, C, D = int(raw_input())
if A*B >= C*D:
    print A*B
else:
    print C*D

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

A, B, C, D = int(raw_input())
E = A*B-C*D

if E >= 0:
    print A*B
else:
    print C*D

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

A, B, C, D = int(raw_input())
E = A*B-C*D

if E >= 0:
    print A*B
else E < 0:
    print C*D