Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Runtime Error):
    li = [int(x) for x in input().split()]
    li.sort()
    li.reverse()
    if(li[0]==li[1]+li[2]):
      print('Yes')
    else:
      print('No')

Fixed submission:
li = [int(x) for x in input().split()]
li.sort()
li.reverse()
if(li[0]==li[1]+li[2]):
  print('Yes')
else:
  print('No')

Buggy python submission (verdict: Runtime Error):
li = [int(x) for x in input().split()]
li.sort()
li.reversed()
if(li[0]==li[1]+li[2]):
  print('Yes')
else:
  print('No')

Fixed submission:
li = [int(x) for x in input().split()]
li.sort()
li.reverse()
if(li[0]==li[1]+li[2]):
  print('Yes')
else:
  print('No')
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
TA = [[int(x) for x in input().split()]for _ in range(N)]
t = 1
a = 1

for i in TA:
    j = 1
    while(t>i[0]*j or a>i[1]*j):
        j+=1
    t = i[0]*j
    a = i[1]*j

print(t+a)


Fixed submission:
N = int(input())
TA = [[int(x) for x in input().split()]for _ in range(N)]
t = 1
a = 1

for i in TA:
    j = max(t//i[0],a//i[1])
    if(t>i[0]*j or a>i[1]*j):
        j+=1
    t = i[0]*j
    a = i[1]*j

print(t+a)
Buggy python submission (verdict: Runtime Error):
s = input()
K = int(input())
ans = ''
for ind,i in enumerate(s):
    if(i=='a' and ind!=len(s)-1):
        ans+='a'
        continue
    n = ord(i)
    d = 122-n
    if(ind==len(S)-1):
        K%=26
    if(K>d):
        K-=d+1
        ans+='a'
    elif(ind==len(s)-1):
        K%=26
        ans+=chr(ord(i)+K)
    else:
        ans+=i
print(ans)


Fixed submission:
s = input()
K = int(input())
ans = ''
for ind,i in enumerate(s):
    if(i=='a' and ind!=len(s)-1):
        ans+='a'
        continue
    d = 123-ord(i)
    if(ind==len(s)-1):
        K%=26
        if(K>=d):
            ans += chr(97+K-d)
            continue
        ans+=chr(ord(i)+K)
    elif(K>=d):
        K-=d
        ans+='a'
    else:
        ans+=i
print(ans)
Buggy python submission (verdict: Runtime Error):
a - input()

if a.islower():
    print("a")

else:
    print("A")

Fixed submission:
a = input()

if a.islower() == True:
    print("a")

else:
    print("A")
Buggy python submission (verdict: Time Limit Exceeded):
from itertools import groupby
import collections
N=int(input())
a=[input() for i in range(N)]

a = sorted(a)
#print(a)

groups = []
uniquekeys = []
for k, g in groupby(a):
    groups.append(len(list(g)))      # Store group iterator as a list
    uniquekeys.append(k)
#print(max(groups))

for q in range(len(groups)):
  if groups[q] == max(groups):
    print(uniquekeys[q])
    

Fixed submission:
import itertools
from collections import Counter

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

a = sorted(a)
#print(a)


counter = Counter(a)

mode_v = counter.most_common()[0][-1]
cmc= counter.most_common()
#print(cmc)
it = itertools.takewhile(
    lambda kv: kv[-1] == mode_v, cmc
)

#sorted(it)
f=list(it)
#print(f)
f = sorted(f)
#print(f)
for k in range(len(f)):
	print(f[k][0])
Buggy python submission (verdict: Time Limit Exceeded):
n = input()
a = input().split()
n = int(n)
a = [int(s) for s in a]
s =0

for f in range(n):
  ai = a[f]
  for g in range(n):
    if g != f:
        if ai == a[g]:
            s = s+1

if s>0: print("NO")
else: print('YES')

Fixed submission:
n = input()
a = input().split()
n = int(n)
a = [int(s) for s in a]
a.sort()
#print(a)
s=0

for i in range(len(a)-1):
    #print(a[i],a[i+1])
    
    if a[i]==a[i+1]:
        print("NO")
        s=s+1
        break
        
if s == 0: print("YES")

Buggy python submission (verdict: Time Limit Exceeded):
def main():
    n = input()
    a = input().split()
    n = int(n)
    a = [int(s) for s in a]
    s =0

    for f in range(n):
      
      for g in range(n):
     
        if g != f:
        	if a[f] == a[g]:
          		s = s+1
          
    if s>0: print("NO")
    else: print('YES')
        
        
if __name__ == '__main__':
    main()

Fixed submission:
n = input()
a = input().split()
n = int(n)
a = [int(s) for s in a]
a.sort()
#print(a)
s=0

for i in range(len(a)-1):
    #print(a[i],a[i+1])
    
    if a[i]==a[i+1]:
        print("NO")
        s=s+1
        break
        
if s == 0: print("YES")

Buggy python submission (verdict: Time Limit Exceeded):
n = input()
a = input().split()
n = int(n)
a = [int(s) for s in a]
s =0

#print(n,a)

for f in range(n):
  
  for g in range(n):

    if g != f:
    	if a[f] == a[g]:
      		#print(a[f], a[g])
      		s = s+1
      
if s>0: print("NO")
else: print('YES')

Fixed submission:
n = input()
a = input().split()
n = int(n)
a = [int(s) for s in a]
a.sort()
#print(a)
s=0

for i in range(len(a)-1):
    #print(a[i],a[i+1])
    
    if a[i]==a[i+1]:
        print("NO")
        s=s+1
        break
        
if s == 0: print("YES")

Buggy python submission (verdict: Runtime Error):
s =0

print(n,a)

for f in range(n):
  
  for g in range(n):

    if g != f:
    	if a[f] == a[g]:
      		#print(a[f], a[g])
      		s = s+1
      
if s>0: print("NO")
else: print('YES')

Fixed submission:
n = input()
a = input().split()
n = int(n)
a = [int(s) for s in a]
a.sort()
#print(a)
s=0

for i in range(len(a)-1):
    #print(a[i],a[i+1])
    
    if a[i]==a[i+1]:
        print("NO")
        s=s+1
        break
        
if s == 0: print("YES")
Buggy python submission (verdict: Runtime Error):
N = int(input())
an = list(map(int, input()))

cost = 10000*3
ans = 10000*3
for i in range(-100,100+1):
    cost = sum([(j - i)**2 for j in an])
    ans = min(ans, cost)

print(ans)

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

cost = 10000*N
ans = 10000*N
for i in range(-100,100+1):
    cost = sum([(j - i)**2 for j in an])
    ans = min(ans, cost)

print(ans)

Buggy python submission (verdict: Runtime Error):
N = int(input())
an = list(map(int, input()))

cost = 10000
ans = 10000
for i in range(-100,100+1):
    cost = sum([(j - i)**2 for j in an])
    ans = min(ans, cost)

print(ans)

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

cost = 10000*N
ans = 10000*N
for i in range(-100,100+1):
    cost = sum([(j - i)**2 for j in an])
    ans = min(ans, cost)

print(ans)

Buggy python submission (verdict: Runtime Error):
N = int(input())
an = list(map(int, input()))

cost = 10000
ans = 10000
for i in range(-100,100+1):
    cost = sum([(j - i)**2 for j in range(1, N+1)])
    ans = min(ans, cost)

print(ans)

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

cost = 10000*N
ans = 10000*N
for i in range(-100,100+1):
    cost = sum([(j - i)**2 for j in an])
    ans = min(ans, cost)

print(ans)

Buggy python submission (verdict: Runtime Error):
N = int(input())
an = list(map(int, input()))

cost = 0
ans = 0
for i in range(-100,100+1):
    cost = sum([(j - i)**2 for j in range(1, N+1)])
    ans = min(ans, cost)

print(ans)

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

cost = 10000*N
ans = 10000*N
for i in range(-100,100+1):
    cost = sum([(j - i)**2 for j in an])
    ans = min(ans, cost)

print(ans)
Buggy python submission (verdict: Runtime Error):
N , K = input().split()
Dk = list(map(int, input().split()))

for i in range(N,10*N+1):
    if set(i)&set(Dk) == set():
        print(i)

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

for i in range(N,10*N+1):
    if set(str(i))&set(Dk) == set():
        print(i)
        break

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

for i in range(N,10*N+1):
    if set(i)&set(Dk) == set():
        print(i)


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

for i in range(N,10*N+1):
    if set(str(i))&set(Dk) == set():
        print(i)
        break
Buggy python submission (verdict: Time Limit Exceeded):
n, k = map(int,input().split())
h = list(map(int,input().split()))

h.sort(reverse = True)
t = 0

while (k > 0) and len(h)>0:
    del h[0]
    k -= 1
if len(h) == 0 :
    print(0)
else:
    t += sum(h)
    print(t)    

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

h.sort(reverse = True)
t = 0

del h[0:k]
    
if len(h) == 0 :
    print(0)
else:
    t += sum(h)
    print(t)
Buggy python submission (verdict: Time Limit Exceeded):
from collections import defaultdict
d = defaultdict(int)

n=int(input())
a = list(map(int,input().split()))
q=int(input())
bc = [list(map(int, input().split())) for i in range(q)]

for el in a:
    d[el] += 1

def s_sum(dd):
    res = 0
    for k,v in dd.items():
        res += k * v
    return res

for ss in bc:
    b = ss[0]
    c = ss[1]

    b_cnt = d[b]
    c_cnt = d[c]
    d[b] = 0
    d[c] += b_cnt
    print(s_sum(d))


Fixed submission:
from collections import defaultdict
d = defaultdict(int)

n=int(input())
a = list(map(int,input().split()))
q=int(input())
bc = [list(map(int, input().split())) for i in range(q)]

#print(bc)

for el in a:
    d[el] += 1

def s_sum(dd):
    res = 0
    for k,v in dd.items():
        res += k * v
    return res

wk = s_sum(d)

for ss in bc:
    b = ss[0]
    c = ss[1]

    b_cnt = d[b]
    c_cnt = d[c]
    d[b] = 0
    d[c] += b_cnt
    wk = wk + b_cnt*c - b_cnt*b
    print(wk)
Buggy python submission (verdict: Runtime Error):
import math

n,m = map(int, input().split())
ab = [list(map(int, input().split())) for i in range(m)]

hist= []
visited_pos = [-1] * n

#初期情報
#print(ab)
ts = {}
for el in ab:
  wk = ts.get(el[0]) 
  if wk is None:
    sss  = set()
    ts[el[0]] = sss
  ts[el[0]].add(el[1])
  wk = ts.get(el[1]) 
  if wk is None:
    sss  = set()
    ts[el[1]] = sss
  ts[el[1]].add(el[0])
#print(ts)


#幅優先探索
def tsk(pos):
  wk = ts.get(pos)
  if ts.get(pos) is None:
    return
  else:
    #print(pos,wk)
    for e in wk:
      if visited_pos[e-1] < 0:
        visited_pos[e-1] = pos
        hist.append(e-1)

idx = 1
hist.append(1)
while True:
  if idx > len(hist):
    break
  else:
    tsk(hist[idx])
    idx += 1
#print(hist)
#print(visited_pos)
ans = 'Yes'
for i in range(n):
  if visited_pos[i] == -1:
    ans = 'No'
    break

print(ans)
if ans == 'Yes':
  for i in range(1,n):
    print(visited_pos[i])


Fixed submission:
import math

n,m = map(int, input().split())
ab = [list(map(int, input().split())) for i in range(m)]

hist= []
visited_pos = [-1] * n

#初期情報
#print(ab)
ts = {}
for el in ab:
  wk = ts.get(el[0]) 
  if wk is None:
    sss  = set()
    ts[el[0]] = sss
  ts[el[0]].add(el[1])
  wk = ts.get(el[1]) 
  if wk is None:
    sss  = set()
    ts[el[1]] = sss
  ts[el[1]].add(el[0])
#print(ts)


#幅優先探索
def tsk(pos):
  wk = ts.get(pos)
  if ts.get(pos) is None:
    return
  else:
    #print(pos,wk)
    for e in wk:
      if visited_pos[e-1] < 0:
        visited_pos[e-1] = pos # idx 値　0-
        hist.append(e) # 実値　1-

idx = 0
hist.append(1) #実値　1-
while True:
  if idx >= len(hist):
    break
  else:
    tsk(hist[idx])
    idx += 1
#print(hist)
#print(visited_pos)
ans = 'Yes'
for i in range(n):
  if visited_pos[i] == -1:
    ans = 'No'
    break

print(ans)
if ans == 'Yes':
  for i in range(1,n):
    print(visited_pos[i])
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
a = list(map(int, input().split()))
res = 0
for i in range(n):
  k = 1
  if (i + a[i]) < n:
    k= a[i]
    for j in range(i+k,n):
      d = j-i
      h = a[i] + a[j]
      if d == h :
        res += 1
print(res)


Fixed submission:
n = int(input())
a = list(map(int, input().split()))
res = 0
ia = []
ja = []
dia={}
dja={}
for i in range(n):
  dia[i+a[i]] = dia.get(i+a[i],0)+1
  dja[i-a[i]] = dja.get(i-a[i],0)+1
ans = 0
for di,nmi in dia.items():
  nmj = dja.get(di,0)
  ans += nmi*nmj

print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
a = list(map(int, input().split()))
res = 0
for i in range(n):
  k = 1
  if (i + a[i]) < n:
    k= a[i]
  for j in range(i+k,n):
    d = j-i
    h = a[i] + a[j]
    if d == h :
      res += 1

print(res)


Fixed submission:
n = int(input())
a = list(map(int, input().split()))
res = 0
ia = []
ja = []
dia={}
dja={}
for i in range(n):
  dia[i+a[i]] = dia.get(i+a[i],0)+1
  dja[i-a[i]] = dja.get(i-a[i],0)+1
ans = 0
for di,nmi in dia.items():
  nmj = dja.get(di,0)
  ans += nmi*nmj

print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
a = list(map(int, input().split()))
#print(n,a)
res = 0
for i in range(n):
  for j in range(i+1,n):
    d = j-i
    h = a[i] + a[j]
    if d == h :
      res += 1

print(res)


Fixed submission:
n = int(input())
a = list(map(int, input().split()))
res = 0
ia = []
ja = []
dia={}
dja={}
for i in range(n):
  dia[i+a[i]] = dia.get(i+a[i],0)+1
  dja[i-a[i]] = dja.get(i-a[i],0)+1
ans = 0
for di,nmi in dia.items():
  nmj = dja.get(di,0)
  ans += nmi*nmj

print(ans)
Buggy python submission (verdict: Runtime Error):
s = input().split()
ans = 'No'
for e in s:
  if e = '7':
    ans = 'Yes'
    break
print(ans)


Fixed submission:
s = input()
ans = 'No'
for e in s:
  if e == '7':
    ans = 'Yes'
    break
print(ans)
Buggy python submission (verdict: Runtime Error):
s = input().split()
n = int(s)
sum = 0
for i range(1,n+1):
  print(n)
  if ((i mod 3 )!=0 ) and ((i mod 5 )!=0 ) :
    sum += i
print(sum)


Fixed submission:
s = input().split()
n = int(s[0])
sum = 0
for i in range(1,n+1):
  #print(n)
  if ((i % 3 )!=0 ) and ((i % 5 )!=0 ) :
    sum += i
print(sum)

Buggy python submission (verdict: Runtime Error):
s = input().split()
n = int(s)
sum = 0
for i range(1:n+1):
  #print(n)
  if ((i mod 3 )!=0 ) and ((i mod 5 )!=0 ) :
    sum += i
print(sum)


Fixed submission:
s = input().split()
n = int(s[0])
sum = 0
for i in range(1,n+1):
  #print(n)
  if ((i % 3 )!=0 ) and ((i % 5 )!=0 ) :
    sum += i
print(sum)
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
s = input()
r=[]
g=[]
b=[]
for i in range(n):
  if s[i] == 'R':
    r.append(i)
  elif s[i] == 'G':
    g.append(i)
  else:
    b.append(i)
#print(r)
#print(g)
#print(b)
sum = len(r)*len(g)*len(b)

for i in r:
  for j in g:
    ma = max(i,j)
    mi = min(i,j)
    df = ma - mi
    k1 = mi - df
    k2 = ma + df
    k3 = (ma + mi) / 2
    if k1 in b:
      sum -=1
    if k2 in b:
      sum -=1
    if k3 in b:
      sum -=1
print(sum)


Fixed submission:
from collections import defaultdict
d = defaultdict(int)

n = int(input())
s = input()
r=[]
g=[]
b=[]
for i in range(n):
  #print(s[i])
  if s[i] == 'R':
    r.append(i)
  elif s[i] == 'G':
    g.append(i)
  else:
    #b.append(i)
    d[i] = 1

#print(r)
#print(g)
#print(b)
sum = len(r)*len(g)*len(d)
for i in r:
  for j in g:
    ma = max(i,j)
    mi = min(i,j)
    df = ma - mi
    k1 = mi - df
    k2 = ma + df
    k3 = (ma + mi) / 2
    sum -= d[k1]
    sum -= d[k2]
    sum -= d[k3]
print(sum)

Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())

s = input()
r=[]
g=[]
b=[]
for i in range(n):
  #print(s[i])
  if s[i] == 'R':
    r.append(i)
  elif s[i] == 'G':
    g.append(i)
  else:
    b.append(i)

#print(r)
#print(g)
#print(b)
sum = 0
for i in r:
  for j in g:
    for k in b:
      wk = [i,j,k]
      wk.sort()
      mm = i + j + k
      if wk[1]*3 != mm :
        sum += 1
print(sum)

Fixed submission:
from collections import defaultdict
d = defaultdict(int)

n = int(input())
s = input()
r=[]
g=[]
b=[]
for i in range(n):
  #print(s[i])
  if s[i] == 'R':
    r.append(i)
  elif s[i] == 'G':
    g.append(i)
  else:
    #b.append(i)
    d[i] = 1

#print(r)
#print(g)
#print(b)
sum = len(r)*len(g)*len(d)
for i in r:
  for j in g:
    ma = max(i,j)
    mi = min(i,j)
    df = ma - mi
    k1 = mi - df
    k2 = ma + df
    k3 = (ma + mi) / 2
    sum -= d[k1]
    sum -= d[k2]
    sum -= d[k3]
print(sum)

Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
lst = input()
#print(lst)
sum = 0
for i in range(n-2):
  for j in range(i+1,n-1):
    for k in range(j+1,n):
      #print(i,j,k)
      if lst[i] != lst[j] and lst[i] != lst[k] and lst[j] != lst[k] :
        if (j-i) != (k-j):
          sum += 1
print(sum)


Fixed submission:
from collections import defaultdict
d = defaultdict(int)

n = int(input())
s = input()
r=[]
g=[]
b=[]
for i in range(n):
  #print(s[i])
  if s[i] == 'R':
    r.append(i)
  elif s[i] == 'G':
    g.append(i)
  else:
    #b.append(i)
    d[i] = 1

#print(r)
#print(g)
#print(b)
sum = len(r)*len(g)*len(d)
for i in r:
  for j in g:
    ma = max(i,j)
    mi = min(i,j)
    df = ma - mi
    k1 = mi - df
    k2 = ma + df
    k3 = (ma + mi) / 2
    sum -= d[k1]
    sum -= d[k2]
    sum -= d[k3]
print(sum)
Buggy python submission (verdict: Runtime Error):
import math

s = input().split()

a = int(s[0])
b = int(s[1])
c = int(s[2])

if math.sqrt(a) + math.sqrt(b) < math.sqrt(c) :
  print('Yes')
else:
  print('No')


Fixed submission:
d = [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]
str_n = input()
n = int(str_n)
print(d[n-1])

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

s = input().split()

a = int(s[0])
b = int(s[1])
c = int(s[2])

if math.sqrt(a) + math.sqrt(b) < math.sqrt(c) :
  print('Yes')
else:
  print('No')

Fixed submission:
d = [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]
str_n = input()
n = int(str_n)
print(d[n-1])

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

s = input().split()

a = int(s[0])
b = int(s[1])
c = int(s[2])

if math.sqrt(a) + math.sqrt(b) < math.sqrt(c) :
  print('Yes')
else:
  print('No')




Fixed submission:
d = [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]
str_n = input()
n = int(str_n)
print(d[n-1])

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

s = input().split()

a = int(s[0])
b = int(s[1])
c = int(s[2])

if (a + b + 2* math.sqrt(a*b) ) < c :
  print('Yes')
else:
  print('No')

Fixed submission:
d = [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]
str_n = input()
n = int(str_n)
print(d[n-1])

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

s = input().split()

a = int(s[0])
b = int(s[1])
c = int(s[2])

#if math.sqrt(a) + math.sqrt(b) < math.sqrt(c) :
if (a + b + 2* math.sqrt(a*b) ) < c :
  print('Yes')
else:
  print('No')


Fixed submission:
d = [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]
str_n = input()
n = int(str_n)
print(d[n-1])
Buggy python submission (verdict: Time Limit Exceeded):
s = input()
n = int(input())

rev = 1

for i in range(n):
  cs = input().split()
  #print( cs )
  if( cs[0] == '1' ) :
    rev *= -1
  else:
    cf = cs[1]
    cfs = cs[2]
    if rev == 1 :
      if cf == '1' :
        s =  cfs + s 
      else:
        s =  s + cfs
    else: #rev == -1 :
      if cf == '1' :
        s =  s + cfs
      else:
        s =  cfs + s

if rev == 1 :
 print( s )
else:
 res = ''.join(list(reversed( s )))
 print (res)
  
  

Fixed submission:
from collections import deque

s = input()
n = int(input())
d = deque()
#initial 
for ele in s:
  d.append(ele)
#print(d)

rev = 1

for i in range(n):
  cs = input().split()
  #print( cs )
  if( cs[0] == '1' ) :
    rev *= -1
  else:
    cf = cs[1]
    cfs = cs[2]
    if rev == 1 :
      if cf == '1' :
        #s =  cfs + s 
        d.appendleft(cfs)
      else:
        #s =  s + cfs
        d.append( cfs )
    else: #rev == -1 :
      if cf == '1' :
        #s =  s + cfs
        d.append( cfs )
      else:
        #s =  cfs + s 
        d.appendleft(cfs)

      
if rev == 1 :
 print( ''.join(list(d)) )
else:
 res = ''.join(list(reversed( d )))
 print (res)
Buggy python submission (verdict: Runtime Error):
n,k = map(int,input().split())
a = list(map(int,input().split()))

awk = 0
aix = k
for i in range(k):
  awk += a[i]
  #print(a[i])
#print('--')
a_max = awk

for i in range(k,n):
  #print(a[i],i-k)
  awk = awk + a[i] - a[i-k]
  if a_max < awk:
    a_max =  awk
    aix   = i

#print('===')
ans = 0.0
for i in range(aix-k+1,aix+1 ):
  #print(a[i],( 1 + a[i] )  / 2.0)
  ans += ( 1 + a[i] )  / 2.0

print(ans)  

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

awk = 0
aix = k - 1
for i in range(k):
  awk += a[i]
a_max = awk

for i in range(k,n):
  awk = awk + a[i] - a[i-k]
  if a_max < awk:
    a_max =  awk
    aix   = i

ans = 0.0
#print('aix={}'.format(aix))
for i in range(aix-k+1,aix+1 ):
  #print(a[i])
  ans += ( 1 + a[i] )  / 2.0

print(ans)
Buggy python submission (verdict: Runtime Error):
import randam
n = map(int, open(0).read().split())
for i in range(365):
  print(random.randint(1, 26))

Fixed submission:
#!/usr/bin/env python3
import random
n, *a = map(int, open(0).read().split())
for i in range(n):
    print(random.randint(1, 26))
Buggy python submission (verdict: Runtime Error):
#!/usr/bin/env python3
n, *a = map(int, open(0).read().split())
a.sort()
ans = not(a[0] == a[1])
for i in range(1, n):
    t = 1
    for j in range(i):
        if a[i] % a[j] == 0:
            t = 0
            break
    ans += t
print(ans)


Fixed submission:
#!/usr/bin/env python3
n, *a = map(int, open(0).read().split())
a.sort()
m = a[-1]
s = [0]*(m+1)
ans = 0
for i in a:
    if s[i] <= 1:
        for j in range(i, m+1, i):
            s[j] += 1
for k in a:
    if s[k] == 1:
        ans += 1
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
#!/usr/bin/env python3
n = int(input())
a = list(map(int, input().split()))
m = 1
for i in a:
    m = m * i
if m >10**18:
    print(-1)
else:
    print(m)

Fixed submission:
#!/usr/bin/env python3
n = int(input())
a = list(map(int, input().split()))
m = 1
for i in a:
    m = m * i
    if m > 1000000000000000000:
        m = -1
        break
if 0 in a:
    print(0)
else:
    print(m)
Buggy python submission (verdict: Time Limit Exceeded):
#!/usr/bin/env python3
n, k = map(int, input().split())
a = list(map(int, input().split()))
ans = [1]
loop_start = 0
loop = 0
for i in range(n):
    ans.append(a[ans[i] - 1])
for j in ans:
    if j in ans[:loop_start] or j in ans[loop_start+1:]:
        break
    loop_start += 1
loop = ans[loop_start+1:].index(j) + 1
ans.clear()
ans = [1]
if k < loop_start:
    for l in range(k):
        ans.append(a[ans[l] - 1])
    print(ans[k])
else:
    for l in range(loop_start + loop):
        ans.append(a[ans[l] - 1])
    print(ans[((k-loop_start)%loop)+loop_start])


Fixed submission:
#!/usr/bin/env python3
n, k = map(int, input().split())
a = list(map(int, input().split()))
ans = [1]
c = 1
for i in range(n):
    ans.append(a[ans[i] - 1])
b = ans.index(ans[n])
if k < b:
    for l in range(k):
        c = a[c - 1]
else:
    for l in range((k-b)%(n-b)+b):
        c = a[c - 1]
print(c)

Buggy python submission (verdict: Time Limit Exceeded):
#!/usr/bin/env python3
import itertools
n, k = map(int, input().split())
a = list(map(int, input().split()))
ans = [1]
if k > len(list(itertools.permutations(a))):
    for i in range(k % n):
        ans.append(a[ans[i] - 1])
    print(a[-1])
else:
    for i in range(k):
        ans.append(a[ans[i] - 1])
    print(a[-2])    


Fixed submission:
#!/usr/bin/env python3
n, k = map(int, input().split())
a = list(map(int, input().split()))
ans = [1]
c = 1
for i in range(n):
    ans.append(a[ans[i] - 1])
b = ans.index(ans[n])
if k < b:
    for l in range(k):
        c = a[c - 1]
else:
    for l in range((k-b)%(n-b)+b):
        c = a[c - 1]
print(c)
Buggy python submission (verdict: Runtime Error):
n, m = map(int, input().split())
h = [0]+list(map(int, input().split()))
ans = [0]+[1]*n
for i in range(m):
    a, b = map(int, input().split())
    if h[a]>=h[b]:
        ans[b] = 0
    if h[b]>=h[a]:
        ans[a] = 0
print(sum(ans))

Fixed submission:
#!/usr/bin/env python3
s = input()
if s == "ABC":
    print("ARC")
else:
    print("ABC")
Buggy python submission (verdict: Time Limit Exceeded):
def gcd(p,q):
    while q != 0:
        r = p % q
        p = q
        q = r
    return p
k = int(input())
a = 0
for i in range(1,k+1):
    for j in range(1,k+1):
        for k in range(1,k+1):
            a += gcd(gcd(i,j),k)
print(a)

Fixed submission:
def gcd(p,q):
    while q != 0:
        r = p % q
        p = q
        q = r
    return p
k = int(input())
a = 0
for i in range(1,k+1):
    for j in range(1,k+1):
        for k in range(1,k+1):
            a += gcd(gcd(i,j),k)
print(a)