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

Fixed submission:
import fractions,itertools
N,S = [int(hoge) for hoge in input().split()]
X = [int(hoge) - S for hoge in input().split()]
print(abs(list(itertools.accumulate(X,func = fractions.gcd))[-1]))

Buggy submission (verdict: Runtime Error):
import fractions,itertools
N,S = [int(hoge) for hoge in input().split()]
X = [int(hoge) - S for hoge in input().split()]
print(abs(list(itertools.accumulate(X,func = fractions.gcd))[-1]))

Buggy submission (verdict: Runtime Error):
import fractions,itertools
N,S = [int(hoge) for hoge in input().split()]
X = [int(hoge) - S for hoge in input().split()]
print(list(itertools.accumulate(X,math.gcd))[-1])

Buggy submission (verdict: Runtime Error):
import math,itertools
N,S = [int(hoge) for hoge in input().split()]
X = [int(hoge) - S for hoge in input().split()]
print(list(itertools.accumulate(X,math.gcd))[-1])
Problem p03294 (python)

Fixed submission:
input()
print(sum([int(a)-1 for a in input().split()]))

Buggy submission (verdict: Runtime Error):
N=input()
print(sum([int(a) for a in input().split()])-N)
Problem p03379 (python)

Fixed submission:
N=int(input())
X=[int(i) for i in input().split()]
Y=sorted(X)
MidL=Y[N//2-1]#ちっちゃいほう(変化なしの場合)
MidR=Y[N//2]#でかいほう(下が減った場合)
for x in X:
	if x>=MidR:print(MidL)
	else:print(MidR)

Buggy submission (verdict: Runtime Error):
N=int(input())
X=[int(i) for i in input().split()
Y=sorted(X)
MidL=X[N//2-1]#ちっちゃいほう(変化なしの場合)
MidR=X[N//2]#でかいほう(下が減った場合)
for y in Y:
	if >=MidR:print(MidL)
	else:print(MidR)
Problem p03563 (python)

Fixed submission:
R=int(input())
print((int(input()))*2-R)

Buggy submission (verdict: Runtime Error):
R=int(input())
print((int(input())*2-R)
Problem p03597 (python)

Fixed submission:
print((int(input()))**2-int(input()))

Buggy submission (verdict: Runtime Error):
N=int(input)
print(N**2-int(input()))
Problem p03633 (python)

Fixed submission:
def gcd(a,b):
    if b<a:
        x=b 
        y=a
    else:
        x=a
        y=b
    #x>y
    while x%y!=0:
        newy=x%y
        x=y
        y=newy
    return y
def lcm(a,b):
    return(a*b//gcd(a,b))
N=int(input())
curlcm=1
for _ in range(N):
    curlcm=lcm(curlcm,int(input()))
print(curlcm)

Buggy submission (verdict: Runtime Error):
from math import gcd
def lcm(a,b):
    return(a*b//gcd(a,b))
N=int(input())
curlcm=1
for _ in range(N):
    curlcm=lcm(curlcm,int(input()))
print(curlcm)
Problem p03636 (python)

Fixed submission:
s=input()
print("{}{}{}".format(s[0],len(s)-2,s[-1]))

Buggy submission (verdict: Runtime Error):
s=input()
print(f"{s[0]}{len(s)-2}{s[-1]}")
Problem p03644 (python)

Fixed submission:
N=int(input())
print([2**i for i in range(8) if 2**i<=N][-1])

Buggy submission (verdict: Runtime Error):
j=int(input())
print([2**i for i in range(8) if 2**i<=N][-1])
Problem p03657 (python)

Fixed submission:
A,B=map(int,input().split())
print(["Possible","Impossible"][bool(A*B*(A+B)%3)])

Buggy submission (verdict: Runtime Error):
A,B=map(int,input().split())
print(["Possible","Impossible][bool(A*B*(A+B))])
Problem p03673 (python)

Fixed submission:
import sys
fastinput=sys.stdin.readline
N=int(input())
a=[int(i) for i in fastinput().split()]
result=[None]*N
if N%2:#odd
    c=(N-1)//2
    for num,i in enumerate(a):
        r=(num+1)//2
        if num==0:
            result[c]=i
        else:
            if num%2:#右半分
                result[c+r]=i
            else:
                result[c-r]=i
else:#even
    for num,i in enumerate(a):
        d=(N-num-1)//2
        if num%2:#左半分
            result[d]=i
        else:
            result[N-1-d]=i
print(" ".join([str(j) for j in result]))

Buggy submission (verdict: Runtime Error):
import sys
fastinput=sys.stdin.readline
N=int(input())
a=[int(i) for i in fastinput().split()]
result=[None]*N
if N%2:#odd
    c=(N-1)//2
    for num,i in enumerate(a):
        r=(num+1)//2
        if num==0:
            result[c]=i
        else:
            if num%2:#右半分
                result[c+r]=i
            else:
                result[c-r]=i
else:#even
    for num,i in enumerate(a):
        d=(N-i)//2
        if num%2:#左半分
            result[d]=i
        else:
            result[N-1-d]=i
print(" ".join([str(j) for j in result]))
Problem p03680 (python)

Fixed submission:
import sys
sys.setrecursionlimit(500000)
N=int(input())
A=[int(input())-1 for _ in range(N)]
result=[False]*N
def next(k):
	newlight=A[k]
	if k==1:
		return(1)
	elif result[k]:
		return(0)
	else:
		result[k]=True
		return(next(newlight))
if not next(0):
	print(-1)
else:print(sum(result))

Buggy submission (verdict: Runtime Error):
import sys
sys.setrecursionlimit(5000)
N=int(input())
A=[int(input())-1 for _ in range(N)]
result=[]
app=result.append
def next(k):
	newlight=A[k]
	if k==1:
		return(1)
	elif k in result:
		return(0)
	else:
		app(k)
		return(next(newlight))
if not next(0):
	print(-1)
else:print(len(result))

Buggy submission (verdict: Runtime Error):
N=int(input())
A=[int(input())-1 for _ in range(N)]
result=[]
app=result.append
def next(k):
	print(result,k)
	newlight=A[k]
	if k==1:
		return(1)
	elif k in result:
		return(0)
	else:
		app(k)
		return(next(newlight))
if not next(0):
	print(-1)
else:print(len(result))
Problem p03688 (python)

Fixed submission:
import sys
def printans(t):
    print(t)
    sys.exit()

N=int(input())
A=[int(i) for i in input().split()]

if all([a==A[0] for a in A]):#全部同じ
    shurui=A[0]
    if shurui==N-1 or shurui*2<=N:
        printans("Yes")
    else:printans("No")
else:#少ないやつは自分だけの色、そいつら以外で上と同じ処理
    maxshurui = max(A)
    if all([a in (maxshurui,maxshurui-1) for a in A]):
        unique = A.count(maxshurui-1)
        shurui = maxshurui-unique
        if shurui<=0:
            printans("No")
        if shurui*2<=N-unique:
            printans("Yes")
        else:printans("No")
    else:printans("No")

Buggy submission (verdict: Runtime Error):
import sys
def printans(t):
    print(t)
    sys.exit()

N=int(input())
A=[int(i) for i in input().split()]

if all([a==A[0] for a in A]):#全部同じ
    shurui=A[0]
    if shurui==N-1 or shurui*2<=N:
        printans("Yes")
    else:printans("No")
else:#少ないやつは自分だけの色、そいつら以外で上と同じ処理
    maxshurui = max(A)
    if all([a in (maxshurui,maxshurui-1)]):
        unique = A.count(maxshurui-1)
        shurui = maxshurui-unique
        if shurui<=0:
            printans("No")
        if shurui*2<=N-unique:
            printans("Yes")
        else:printans("No")

Buggy submission (verdict: Runtime Error):
import sys
def printans(t):
    print(t)
    sys.exit()

N=int(input())
A=[int(i) for i in input().split()]

if all([a==A[0] for a in A]):#全部同じ
    shurui=A[0]
    if shurui==N-1 or shurui*2<=N:
        printans("Yes")
    else:printans("No")
else:#少ないやつは自分だけの色、そいつら以外で上と同じ処理
    maxshurui = max(A)
    if all([a in (maxshurui,maxshurui-1)]):
        unique = A.count(maxshurui-1)
        shurui = maxshurui-unique
        if shurui<=0:
            printans("No")
        if shurui*2<=N-unique:
            printans("Yes")
        else:printans("No")

Buggy submission (verdict: Runtime Error):
def printans(t):
    print(t)
    sys.exit()

N=int(input())
A=[int(i) for i in input().split()]

if all([a==A[0] for a in A]):#全部同じ
    shurui=A[0]
    if shurui==N-1 or shurui*2<=N:
        printans("Yes")
    else:printans("No")
else:#少ないやつは自分だけの色、そいつら以外で上と同じ処理
    maxshurui = max(A)
    if all([a in (maxshurui,maxshurui-1)]):
        unique = A.count(maxshurui-1)
        shurui = maxshurui-unique
        if shurui<=0:
            printans("No")
        if shurui*2<=N-unique:
            printans("Yes")
        else:printans("No")
Problem p03695 (python)

Fixed submission:
N=int(input())
a=[int(i) for i in input().split()]
rates=[0]*9
for rate in a:
    rates[min(rate//400,8)]+=1
ans=0
for color in rates[:8]:
    ans+=(color!=0)
ansmax=ans+rates[8]
print(max(ans,1),ansmax)

Buggy submission (verdict: Runtime Error):
N=int(input())
a=[int(i) for i in input().split()]
rates=[0]*9
for rate in a:
    rates[rate//400]+=1
ans=0
for color in rates[:8]:
    ans+=(color!=0)
ansmax=ans+rates[8]
print(ans,ansmax)

Buggy submission (verdict: Runtime Error):
N=int(input())
a=[int(i) for i in input().split()]
rates=[0]*9
for rate in a:
    rates[rate//400]+=1
ans=0
for color in rates[:8]:
    ans+=bool(color)
ansmax=ans+rates[8]
print(ans,ansmax)
Problem p03699 (python)

Fixed submission:
N=int(input())
Q=sorted([int(input()) for i in range(N)])
S=sum(Q)
mods=S%10
if mods!=0:
    ans=S
else:
    for n,i in enumerate(Q):
        if i%10!=0:
            ans=S-i
            break
        if n==N-1:
            ans=0
            break
print(ans)

Buggy submission (verdict: Runtime Error):
N=int(input())
Q=sorted([int(input()) for i in range(N)])
S=sum(Q)
mods=S%10
if mods!=0:
    ans=S
else:
    for i in Q:
        if i%10!=0:
            ans=S-i
            break
print(ans)
Problem p03729 (python)

Fixed submission:
A,B,C=map(list,input().split())
print(['NO','YES'][A[-1]==B[0] and B[-1]==C[0]])

Buggy submission (verdict: Runtime Error):
A,B,C=map(list,input().split())
print(['NO','YES'][A[-1]==B[0] and B[-1]==
Problem p03759 (python)

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

Buggy submission (verdict: Runtime Error):
a,b,c=map(int,input())
if a+c==2*b:print("YES")
else:print("NO")
Problem p03937 (python)

Fixed submission:
H, W = [int(hoge) for hoge in input().split()]
print("Possible") if sum([input().count("#") for h in range(H)]) == H+W-1 else print("Impossible")

Buggy submission (verdict: Runtime Error):
H, W = [int(hoge) for hoge in input().split()]
print(Possible) if sum([input().count("#") for h in range(H)]) == H+W-1 else print(Impossible)
Problem p03943 (python)

Fixed submission:
ans=["No","Yes"]
candy=list(map(int,input().split()))
print(ans[sum(candy)/2 in candy])

Buggy submission (verdict: Runtime Error):
W,H,N=list(map(int,input().split()))
ten=[list(map(int,input().split())) for _ in range(N)]
base=[[0,0,1],[0,0,3],[W,H,2],[W,H,4]]
ten.extend(base)
onemax=max(i[0] for i in ten if i[2]==1)
twomin=min(i[0] for i in ten if i[2]==2)
thrmax=max(i[1] for i in ten if i[2]==3)
foumin=min(i[1] for i in ten if i[2]==4)
if (twomin-onemax)>0 and (foumin-thrmax) >0:
    print((twomin-onemax)*(foumin-thrmax))
else:print(0)
Problem p03965 (python)

Fixed submission:
# coding: utf-8
# Your code here!
import copy
S=list(input())
N=len(S)
point=0
hand=copy.deepcopy(S)
panum=sum([j=="p" for j in hand])
pamax=N//2#ポイントの上限
pa=0
for i in range(N):
    if S[i]=="g" and pa<(i+1)//2 and point<pamax-panum:
        hand[i]="p"
        point+=1
    if point>=pamax-panum:
        break
    if hand[i]=="p":
        pa+=1
print(point)

Buggy submission (verdict: Runtime Error):
# coding: utf-8
# Your code here!
import copy
S=list(input())
N=len(S)
point=0
hand=copy.deepcopy(S)
panum=sum([j=="p" for j in hand])
pamax=N//2#ポイントの上限
for i in range(N):
    if S[i]=="g":
        pa=sum([hand[j]=="p" for j in range(i+1)])#今まで出したパーの数
        if pa<(i+1)//2 and point<pamax-panum:
            hand[i]="p"
            point+=1
    if point=>pamax-panum:
        break
print(point)
Problem p03997 (python)

Fixed submission:
[a,b,h]=[int(input()) for i in range(3)]
print((a+b)*h//2)

Buggy submission (verdict: Runtime Error):
[i for i in [a,b,h]=[int(input()) for i in range(3)]
print((a+b)*h/2)
Problem p04013 (python)

Fixed submission:
#x枚目まででy枚選んで合計がzになる場合の数dp[x][y][z](x+1*y+1*たくさん)
N,A=map(int,input().split())
x=[int(i) for i in input().split()]
dp=[[[0]*(50*N+1) for i in range(N+1)]for k in range(N+1)]
ans=0
dp[0][0][0]=1
for made,i in enumerate(dp):#走査して、一個上を書き換え
    if made>N:break
    for maisu,j in enumerate(i):
        for wa,k in enumerate(j):
            if k and made<N:#made枚目までにmaisu枚選んでwaになる場合の数
                dp[made+1][maisu][wa]+=k#made+1枚目についての議論
                newwa=wa+x[made]
                if newwa<=A*N:
                    dp[made+1][maisu+1][newwa]+=k
for mai in range(1,N+1):
    a=dp[N][mai][mai*A]
    if a:
        ans+=a
print(ans)

Buggy submission (verdict: Runtime Error):
#x枚目まででy枚選んで合計がzになる場合の数dp[x][y][z]
N,A=map(int,input().split())
x=[int(i) for i in input().split()]
dp=[[[0]*(A*N+1) for i in range(N+1)]for k in range(N+2)]
ans=0
dp[0][0][0]=1
for made,i in enumerate(dp):
    if made>N:break
    for maisu,j in enumerate(i):
        for wa,k in enumerate(j):
            if k and made<=N:#made枚目までにmaisu枚選んでwaになる場合の数
                dp[made+1][maisu][wa]+=k
                newwa=wa+x[made-1]
                if newwa<=A*N:
                    dp[made+1][maisu+1][newwa]+=k
for mai in range(1,N+1):
    a=dp[N][mai][mai*A]
    if a:
        ans+=a
print(ans)

Buggy submission (verdict: Runtime Error):
#x枚目まででy枚選んで合計がzになる場合の数dp[x][y][z]
N,A=map(int,input().split())
x=[int(i) for i in input().split()]
dp=[[[0]*(A*50) for i in range(N+2)]for k in range(N+2)]
ans=0
dp[0][0][0]=1
for made,i in enumerate(dp):
    if made>N:break
    for maisu,j in enumerate(i):
        for wa,k in enumerate(j):
            if k:#made枚目までにmaisu枚選んでwaになる場合の数
                dp[made+1][maisu][wa]+=k
                dp[made+1][maisu+1][wa+x[made-1]]+=k
for mai in range(1,N+1):
    a=dp[N][mai][mai*A]
    if a:
        ans+=a
print(ans)
Problem p04032 (python)

Fixed submission:
#アンバランスな文字列からアンバランスでない文字列を取り除くと、
#アンバランスな文字列が残るはず。ということは、両側から文字を削り取ることで「どの部分列をとってもアンバランスな文字列」が存在するはず
#すなわちそれは、両側に「ax」が存在しない文字列で、「axa」または「aa...aa」
#aaがある時点でアンバランス確定なので「axa」「aa」のどちらかを探せばよし
import re
s=input()
alphabet="abcdefghijklmnopqrstuvwxyz"
for i in alphabet:
    ba=s.find(i+i)
    if ba!=-1:
        print(str(ba+1)+" "+str(ba+2))
        break
    A=re.compile(i+"."+i)
    axa=A.search(s,0)
    if axa:
        ba=axa.start()
        print(str(ba+1)+" "+str(ba+3))
        break
    if i=="z":
        print("-1 -1")

Buggy submission (verdict: Runtime Error):
#アンバランスな文字列からアンバランスでない文字列を取り除くと、
#アンバランスな文字列が残るはず。ということは、両側から文字を削り取ることで「どの部分列をとってもアンバランスな文字列」が存在するはず
#すなわちそれは、両側に「ax」が存在しない文字列で、「axa」または「aa...aa」
#aaがある時点でアンバランス確定なので「axa」「aa」のどちらかを探せばよし
import re
s=input()
alphabet="abcdefghijklmnopqrstuvwxyz"
for i in alphabet:
    ba=s.find(i+i)
    if ba!=-1:
        print(str(ba+1)+str(ba+2))
        break
    A=re.compile(i+"."+i)
    axa=A.search(s,0)
    if axa:
        ba=axa.start())
        print(str(ba+1)+str(ba+3))
        break
Problem p02639 (python)

Fixed submission:
n=input()
nn=n.replace(' ','')
x = nn.find('0')

print(int(x)+1)

Buggy submission (verdict: Runtime Error):
n=input().split()
x = n.find('0')

print(int(x)+1)
Problem p02720 (python)

Fixed submission:
a = []

def dfs(x):
    if x > 3234566667:
        return
    a.append(x)
    for i in range(10):
        if abs(x%10-i) <= 1:
            dfs(x*10+i)

for i in range(1, 10):
    dfs(i)
a = sorted(a)
k = int(input())
print(a[k-1])

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

def dfs(x):
  if x>3234566667:
    return
  a.append(x)
  for i in range(10):
    if abs(x%10-i) <= 1:
      dfs(x%10+i)
      
for i in range(1,10):
  dfs(i)
a =sorted(a)
k=int(input())
print(a[k-1])
Problem p02741 (python)

Fixed submission:
l = [1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51]
k = int(input())
print(l[k-1])

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

if ((a**0.5) + (b**0.5))<(c**0.5):
  print("Yes")
else:
  print('No')
Problem p02742 (python)

Fixed submission:
import math
h,w = map(int,input().split())

x = h*w

if h==1 or w==1:
  print(1)
  exit()

if x%2==0:
  print(int(x/2))
else:
  print(int(math.ceil(x/2)))

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

if H==1 orW==1:
  print(1)
  exit()
  
x = H*W
if x % 2==0:
  print(x/2)
elif x% 2 ==1:
  print(int(math.ceil(x/2)+1))
Problem p02767 (python)

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

ans = 1000000000
for p in range(1,101):
  sum =0
  for x in X:
    sum += (p-x)**2
    
  ans = min(ans,sum)
  
print(ans)

Buggy submission (verdict: Runtime Error):
n = int(input())
x = [int(i) for i in input().split()]
x.sort()

ans = 100000000
for p in range(x[1],x[-1]+1):
  sum =0
  for i in range(n):
    sum += (x[i]-p)**2
    
  ans = min(ans,sum)
  
print(ans)

Buggy submission (verdict: Runtime Error):
n = int(input())
x = [int(i) for i in input().split()]
x.sort()

ans = 10000
for p in range(x[1],x[-1]+1):
  sum =0
  for i in range(n):
    sum += (x[i]-p)**2
    
  ans = min(ans,sum)
  
print(ans)
Problem p02772 (python)

Fixed submission:
N = int(input())

a = [int(i) for i in input().split()]
v=0
x=[]
j=0
for i in range(N):
  if a[i] %2 ==0:
    x.append(a[i])
    j +=1

    
for i in range(j):
  if x[i] %3 ==0 or x[i] %5 ==0:
    v += 1

if v == j:
  print("APPROVED")
else:
  print("DENIED")

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

a = [int(i) for i in range(N)]

x=[]
for i in range(N):

  if a[i] %2 ==0:
    x.append(a[i])
  
for i in x:
  if x[i] %3 ==0 or x[i] %5 ==0:
    print("APPROVED")
  else:
    print("DENIED")
Problem p02802 (python)

Fixed submission:
N,M = map(int, input().split())
ps = []
AC = [0]*N
WA = [0]*N
WA_sum = 0
for _ in range(M):
  ps.append(list(input().split()))
for i in range(M):
  if ps[i][1] == 'AC' and AC[int(ps[i][0])-1] == 0:
    AC[int(ps[i][0])-1] = 1
  if ps[i][1] == 'WA' and AC[int(ps[i][0])-1] == 0:
    WA[int(ps[i][0])-1] += 1
for i in range(N):
  if AC[i] == 1:
    WA_sum += int(WA[i])
print(sum(AC), WA_sum)

Buggy submission (verdict: Runtime Error):
n,m = map(int,input().split())
ps = [input().split() for i in range(m)]

ans =[]
for i in range(m):
  if not(ps[i][0] in ans) :
    ans += ps[i][0]
    

print(ps[0][0])
wa = 0
ac = 0
for i in ans:
  for j in range(m):
    #問題番号の確認
    w = 0
    if ps[j][0] == str(i):
      if ps[j][1] =="WA":
        w += 1
      elif ps[j][1] == "AC":
        ac += 1
        wa +=w
        break

    else:
      continue
      
      
print(ac,wa)
Problem p02887 (python)

Fixed submission:
from itertools import groupby
N = int(input())
S = input()
G = groupby(S)
print(len(list(G)))

Buggy submission (verdict: Runtime Error):
from itertools import groupby
N = int(input())
S = input()
G = groupby(S)
print(len(G))
Problem p02898 (python)

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

h = [int(i) for i in input().split()]

count =0

for i in range(N):
  if h[i] >= K:
    count += 1
    
    
print(count)

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

h = [int(i) for i in input().split()]

count =0

for i in range(N):
  if h[i] >= k:
    count += 1
    
    
print(count)
Problem p02910 (python)

Fixed submission:
s = input()

if 'L' in s[::2] or 'R' in s[1::2]:
    ans = 'No'
else:
    ans = 'Yes'
print(ans)

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

odd = list(S[::2])
even = list(S[1::2])
xx = "No"
x1 = ""
x2 = ""

for i in range(len(odd)):
  check = 0
  if odd[i] == "L" or "U" or "D":
    check += 1
  
if check == len(odd):
  x1 = "Y"
  
for i in range(len(even)):
  check2 = 0
  if even[i] == "R" or "U" or "D":
    check2 += 1
 
if check2 == len(even):
  x2 = "Y"
  
  
if x1 and x2 == "Y":
  xx = "Yes"
  
  
print(xx)
Problem p02922 (python)

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

print((b - 1 + (a - 2)) // (a - 1))

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

c = B % A
if A >= B:
  print(1)
  exit()
  
elif c = 0:
  print( B//A)
  
elif c >0:
  print((B//A) + 1)
Problem p02934 (python)

Fixed submission:
N = int(input())
A = [int(i) for i in input().split()]

c = 0

for i in range(N):
  c += (1/A[i])

print(float(1/c))

Buggy submission (verdict: Runtime Error):
N = int(input)
A = [float(i) for i in input().split()]

c = 0

for i in A:
  c += (1/A[i])

print(float(1/c))

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

c = 0

for i in A:
  c += (1/A[i])

print(float(1/c))
Problem p02958 (python)

Fixed submission:
n = int(input())
plst = list(map(int,input().split()))
plst_sort = sorted(plst)
cnt = 0
for i in range(len(plst)):
    if plst[i] != plst_sort[i]:
        cnt += 1
if cnt == 2 or cnt == 0:
    print("YES")
else:
    print("NO")

Buggy submission (verdict: Runtime Error):
n = int(input())
plst = list(map(int,input().split()))
plst_sort = sorted(plst)
cnt = 0
for i in range(N):
    if plst[i] != plst_sort[i]:
        cnt += 1
if cnt == 2 or cnt == 0:
    print("YES")
else:
    print("NO")
Problem p02993 (python)

Fixed submission:
s = input()

print("Bad" if any(s[i]==s[i+1] for i in range(3)) else "Good")

Buggy submission (verdict: Runtime Error):
s =input()
print("Bad" if any(S[i]==S[i+1] for i in range(3)) else "Good")
Problem p03000 (python)

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

L = [int(i) for i in input().split()]

D =[]
D.append(0)
x = 0

for i in range(N):
  x += L[i]
  D.append(x)
  
ans = 0

for i in range(N+1):
  
  if D[i] <= X:
    ans += 1

print(ans)

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

L = [int(i) for i in range(N)]

D =[]
D[0]=0

for i in range(N):
  x += L[i]
  D.append(x)
  
  
print(D)
Problem p03106 (python)

Fixed submission:
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)

    
ans.sort(reverse=True)
print(ans[k-1])

Buggy submission (verdict: Runtime Error):
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)

    
ans.sort(reverse=True)
print(ans[k-1])
Problem p03126 (python)

Fixed submission:
n,m = map(int,input().split())
x = []
c = 0
for i in range(n):
    a = list(map(int,input().split()))
    a.pop(0)
    x.extend(a)

for j in range(1,m+1):
    if x.count(j) == n:
        c += 1

print(c)

Buggy submission (verdict: Runtime Error):
n,m = map(int,input().split())
x =[]
c = 0
for i in range(n):
  a = list(map(int,input().split()))
  a.pap(0)
  x.extend(a)
  
for j in range(1,m+1):
  if x.count(j) ==n:
    c +=1
    
print(c)
Problem p03136 (python)

Fixed submission:
n = int(input())
l = [int(i) for i in input().split()]

l.sort(reverse=True)

max = l[0]
els = sum(l[1:])

if max < els:
  print("Yes")
else:
  print("No")

Buggy submission (verdict: Runtime Error):
n = int(input())
l = [int(i) for i in input().split()]

l.sort(reverse=True)

max = l[0]
els = sum(l[1:])

if max > else:
  print("Yes")
else:
  print("No")
Problem p03211 (python)

Fixed submission:
s = input()

ans =[]

for i in range(len(s)-2):
  ans.append(int(s[i] +s[i+1] +s[i+2]))
  
num =[]

for i in range(len(ans)):
  num.append(abs(753-int(ans[i])))
               
num.sort()
               
print(num[0])

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

ans =[]

for i in range(:len(s)-2):
  ans.append(int(s[i] +s[i+1] +s[i+2]))
  
num =[]

for i in range(len(ans)):
  num.append(abs(754-ans[i]))
               
num.sort()
               
print(num[0]

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

ans =[]

for i in range(:len(s)-2):
  ans.append(int(s[i] +s[i+1] +s[i+2]))
  
num =[]

for i in range(len(ans):
  num.append(abs(754-ans[i]))
               
num.sort()
               
print(num[0]

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

ans =[]

for i in range(:len(s)-2):
  ans.append(int(s[i] +s[i+1] +s[i+2]))
  
num =[]

for i in range(len(ans()):
  num.append(abs(754-ans[i]))
               
num.sort()
               
print(num[0]
Problem p03220 (python)

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

dt = 10**9
num = 0
for i in range(n):
    ti = t - hl[i] * 0.006
    if abs(a - ti) <= dt:
        dt = abs(a - ti)
        num = i

print(num + 1)

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

dt = 10**9
num = 0
for i in range(n):
  ti = t = hl[i]*0.006
  if abs(a - ti) <= dt:
    dt = abs(a -ti)
    num = i
    
    
print(num + 1)