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

Fixed submission:
# coding: utf-8
# Your code here!
n,k = map(int,input().split())

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

b = [1 for i in range(n)]


now = 0
next = a[now] - 1
c = []
for i in range(n):
    if b[next] == 0:
        d = c[:c.index(next)]
        e = c[c.index(next):]
        #print(d,e)
        break
    #print(now)
    b[now] = 0
    c.append(now)
    next = a[now] - 1
    #print(" ",next)
    now = next

if k >= len(d):
    k = k - len(d)
    k = k % len(e)
    print(e[k]+1)

else:
    print(d[k]+1)

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

ans = 0
b = [1]
for i in range(k):
  if a[b[-1] - 1] in b:
    c = a[b[-1] - 1]
    break
  b.append(a[b[-1] - 1])

d = b[:b.index(c)]
b = b[b.index(c):]

k = k - len(d)
k = k % len(b)
#print(d,b,k)
ans = b[k]
print(ans)

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

ans = 0
b = [1]
for i in range(k):
  if a[b[-1] - 1] in b:
    c = a[b[-1] - 1]
    break
  b.append(a[b[-1] - 1])

d = b[:b.index(c)]
b = b[b.index(c):]

k = k - len(d) - k // len(b) * len(b)
#print(d,b,k)
ans = b[k]
print(ans)

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

ans = 0
b = [1]
for i in range(k):
  if a[b[-1] - 1] in b:
    c = a[b[-1] - 1]
    break
  b.append(a[b[-1] - 1])

d = b[:b.index(c)]
b = b[b.index(c):]

k = k - len(d) - k // len(b) * len(b)
#print(d,b,k)
ans =a[k]
#print(ans)
print(ans)

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

ans = 0
b = [1]
for i in range(k):
  if a[b[-1] - 1] in b:
    c = a[b[-1] - 1]
    break
  b.append(a[b[-1] - 1])

d = b[:b.index(c)]
b = b[b.index(c):]

k = k - k // len(b) * len(b) + 1
#print(d,b,k)

for i in d:
    ans = a[i - 1]
    #print(ans)
for i in range(k):
  ans = a[ans - 1]
  #print(ans)
print(ans)
Problem p02691 (python)

Fixed submission:
n = int(input())

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

c = {}
for i in range(n):
    if a[i] + i + 1 not in c.keys():
        c[a[i]+i+1] = 1
    else:
        c[a[i]+i+1] += 1

#print(c)

ans = 0
for i in range(n):
    if i + 1 - a[i] not in c.keys():
        pass
    else:
        ans += c[i + 1 - a[i]]

print(ans)

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

for i in a:
    if i > n:
        a.pop(i)

ans = 0
for j in range(len(a)):
    for k in range(j+1, len(a)):
        #print(j,k)
        if  a[j] + a[k] == abs(j - k):
           #print(j,k, a[j],a[k])
           ans = ans + 1

print(ans)

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

for i in a:
    if i > 2 * (10 ** 5):
        a.pop(i)

ans = 0
for j in range(len(a)):
    for k in range(j+1, len(a)):
        #print(j,k)
        if  a[j] + a[k] == abs(j - k):
           #print(j,k, a[j],a[k])
           ans = ans + 1

print(ans)
Problem p02694 (python)

Fixed submission:
import math
n = int(input())
a = 100

ans  = 0

while a < n:
    #print(a)
    a = math.floor(a * 1.01)
    ans = ans + 1

print(ans)

Buggy submission (verdict: Runtime Error):
import math
n = int(input())
a = 100

ans  = 0

while a != n:
    #print(a)
    a = math.floor(a * 1.01)
    ans = ans + 1

print(ans)
Problem p02696 (python)

Fixed submission:
#copy
import math
a, b, n = list(map(int, input().split()))
x = min(b-1,n)
ans = math.floor(a*x/b)-a*math.floor(x/b)
print(ans)

Buggy submission (verdict: Runtime Error):
import math
a,b,n = map(int,input().split())
c = max(0,n // b * b - 1)
ans = mmath.floor(a * n / b) - a * math.floor(n / b)
 
print(ans)

Buggy submission (verdict: Runtime Error):
import math
a,b,n = map(int,input().split())
c = max(0,n // b * b - 1)
ans = mmath.floor(a * c / b) - a * math.floor(c / b)
 
print(ans)

Buggy submission (verdict: Runtime Error):
a,b,n = map(int,input().split())
c = n // b * b
ans=0
if n > b - 1:
    ans = math.floor(a * c / b) - a * math.floor(c / b)

else:
    #for i in range(n):
        #print(i+1)
        #print(math.floor(a * (i+1) / b) - a * math.floor((i+1) / b))
        #if math.floor(a * (i+1) / b) - a * math.floor((i+1) / b) > ans:
        #    ans = math.floor(a * (i+1) / b) - a * math.floor((i+1) / b)
    ans = math.floor(a * n / b) - a * math.floor(n / b)
print(ans)
Problem p02697 (python)

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

a = 1
b = m - 1
c = m
d = [i for i in range(n + 1)]

for i in range(m):
    if m % 2 == 0 and i < m / 2:
        print(d[a], d[a+b])
        print(d[-a-c],d[-a])
        a = a + 1
        b = b - 2
        c = c - 2

    elif m % 2 != 0 and i < m / 2:
        print(d[-a-c],d[-a])
        if i == (m + 1) / 2 - 1:
            break
        print(d[a], d[a+b])
        a = a + 1
        b = b - 2
        c = c - 2

Buggy submission (verdict: Runtime Error):
n,m = map(int,input().split())
a = 1
c = [1 for i in range(n)]
for i in range(1,m+1):
  print(a,a+i)
  c[a-1] = 0
  c[a + i - 1] = 0
  a = c.index(1) + 1
  #print(a)
Problem p02700 (python)

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

while a > 0:
  c = c - b
  if c <= 0:
    print('Yes')
    exit()
  a = a - d

print("No")

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

while a =< 0:
  c = c - b
  if c <= 0:
    print('Yes')
    exit()
  a = a - d

print("no")
Problem p02899 (python)

Fixed submission:
n = int(input())
a = list(map(int,input().split()))
b = [0 for i in range(n)]

for i in range(n):
      b[a[i] - 1] = str(i + 1)

print(' '.join(b))

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

for i in range(n):
  for j in range(n):
    if a[j] == i + 1:
      b.append(i+1)
      break

print(' '.join(b))
Problem p02900 (python)

Fixed submission:
from fractions import gcd

a,b = map(int,input().split())
c = gcd(a,b)

ans = 0
i = 2
check = False
while c != 1:
    #print(c,i)
    while c % i == 0:
        #print('a')
        c = c // i
        check = True
    i = i + 1
    if check:
        ans += 1
    check = False
    if i > 1000000:
        print(ans+2)
        exit()
print(ans + 1)

Buggy submission (verdict: Runtime Error):
from fractions import gcd

a,b = map(int,input().split())
c = math.gcd(a,b)

ans = 0
i = 2
check = False
while c != 1:
    while c % i == 0:
        c = c // i
        check = True
    print(i)
    i = i + 1
    if check:
        ans += 1
    check = False
print(ans + 1)

Buggy submission (verdict: Runtime Error):
from functions import gcd

a,b = map(int,input().split())
c = math.gcd(a,b)

ans = 0
i = 2
check = False
while c != 1:
    while c % i == 0:
        c = c // i
        check = True
    print(i)
    i = i + 1
    if check:
        ans += 1
    check = False
print(ans + 1)

Buggy submission (verdict: Runtime Error):
import math

a,b = map(int,input().split())
c = math.gcd(a,b)

ans = 0
i = 2
check = False
while c != 1:
    while c % i == 0:
        c = c // i
        check = True
    print(i)
    i = i + 1
    if check:
        ans += 1
print(ans + 1)

Buggy submission (verdict: Runtime Error):
import math

a,b = map(int,input().split())
c = math.gcd(a,b)

ans = 0
i = 2
while c != 1:
    while c % i == 0:
        c = c // i
    #print(c,i,ans)
    i = i + 1
    ans += 1
    
print(ans + 1)

Buggy submission (verdict: Runtime Error):
import math

a,b = map(int,input().split())
c = math.gcd(a,b)

ans = 0
i = 2
while c != 1:
    while c % i == 0:
        c = c // i
    #print(c,i,ans)
    i = i + 1
    ans += 1
    
print(ans)

Buggy submission (verdict: Runtime Error):
import math

a,b = map(int,input().split())
c = math.gcd(a,b)

ans = 0
i = 2
while c != 1:
    while c % i == 0:
        c = c // i
    print(c,i,ans)
    i = i + 1
    ans += 1
    
print(ans)
Problem p02910 (python)

Fixed submission:
s = input()

for i in range(len(s)):
  if i % 2 == 1 and s[i] == 'R':
    s = False
    break
  elif i % 2 == 0 and s[i] == 'L':
    s = False
    break

if s:
  print('Yes')
else:
  print('No')

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

for i in range(s):
  if s[i] % 2 == 0 and s[i] == 'R':
    s = False
    break
  elif s[i] % 2 == 1 and s[i] == 'L':
    s = False
    break

if s:
  print('Yes')
else:
  print('No')
Problem p02921 (python)

Fixed submission:
a = list(input())
b = list(input())

count = 0
for i in range(3):
  if a[i] == b[i]:
    count +=1

print(count)

Buggy submission (verdict: Runtime Error):
a = list(input())
b = list(input())

count = 0
for i in range(3):
  if a[i] == b[i]:
    count += 1

ptint(count)
Problem p02934 (python)

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

b = 0
for i in range(n):
  b = b + 1 / a[i]

print(1 / b)

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

b = 0
for i in range(n):
  b = b + 1 / a[i]

print(1 / b)
Problem p02937 (python)

Fixed submission:
s = input()
t = input()
t_length = len(t)

temp = s[:]
count = 0
ans = 0

for i in range(len(t)):
    a = s.find(t[i])
    if a == -1:
        print(-1)
        exit()

while count < t_length:
    value = temp.find(t[count])
    if value == -1:
        ans += len(temp)
        temp = s[:]
    
    else:
        ans += value + 1
        count += 1
        temp = temp[value + 1:]

print(ans)

Buggy submission (verdict: Runtime Error):
import sys

s = list(input())
t = list(input())

for i in range(len(t)):
    if t[i] not in s:
        print(-1)
        sys.exit()

i = 0
n = 0
for i in range(len(s)):
    if len(s) == i + n:
        break
    
    if s[i] not in t:
        s.pop(i)
        n += 1

count = 0
for j in range(100000):
    for k in range(len(s)):
        if count == len(t):
            print(k +  (j * len(s)) + n * (j + 1))
            sys.exit()
            
        #print(a[k +  (j * len(s))], t[count],a, count)
        if s[k] == t[count]:
            count += 1

print(-1)

Buggy submission (verdict: Runtime Error):
import sys

s = list(input())
t = list(input())

for i in range(len(t)):
    if t[i] not in s:
        print(-1)
        sys.exit()

i = 0
n = 0
for i in range(len(s)):
    if len(s) == i + n + 1:
        break
    
    if s[i] not in t:
        s.pop(i)
        n += 1

count = 0
for j in range(10000000000):
    for k in range(len(s)):
        if count == len(t):
            print(k +  (j * len(s)) + n * (j + 1))
            sys.exit()
            
        #print(a[k +  (j * len(s))], t[count],a, count)
        if s[k] == t[count]:
            count += 1

Buggy submission (verdict: Runtime Error):
import sys

s = list(input())
t = list(input())

for i in range(len(t)):
    if t[i] not in s:
        print(-1)
        sys.exit()

i = 0
a = []
count = 0

for j in range(35):
    for i in range(len(s)):
        a.append(s[i])
    i = 0
    
    for k in range(len(s)):
        if count == len(t):
            print(k +  (j * len(s)))
            sys.exit()
            
        print(a[k +  (j * len(s))], t[count],a, count)
        if a[k +  (j * len(s))] == t[count]:
            count += 1
Problem p02947 (python)

Fixed submission:
a = int(input())
b = {}
strings = ''
ans = 0

for i in range(a):
    check = True
    strings = ''.join(sorted(list(input())))
    if strings not in b.keys():
      check = False
      b[strings] = 1
    if check == True:
      ans += b[strings]
      b[strings] += 1

print(ans)

Buggy submission (verdict: Runtime Error):
a = int(input())
b = []
for _ in range(a):
  b.append(sorted(list(input())))

for i in range(a):
  for j in range(i+1, a):
    check = True
    for k in range(10):
      if b[i] != b[j]:
        check = False
    if check = True:
      ans += 1
print(ans)
Problem p02952 (python)

Fixed submission:
a = input()
b = len(list(a))
c = int(a)
d = ''

if b % 2 == 0:
    d = '9' * (b // 2)
    print('0'.join(d))

else:
    if b == 1:
        print(a)
    else:
        d = '9' * (b // 2)
        d = '0'.join(d)
        d = int(d + '0')
        print(c - d)

Buggy submission (verdict: Runtime Error):
else:
    if b == 1:
        print(a)
    elif b == 3:
        d = '9' * (b // 2)
        '0'.join(d)
        d = int(d + '0')
        print(c - d)
    elif b > 3:
        d = '9' * (b // 2)
        '0'.join(d)
        d = int(d + '1')
        print(c - d)

Buggy submission (verdict: Runtime Error):
a = input()
b = len(list(a))
c = int(a)
d = ''

if b % 2 == 0:
    d = '9' * (b // 2)
    print('0'.join(d))

else:
    if b == 1:
        print(a)
    else:
        d = '9' * (b // 2)
        '0'.join(d)
        d = int(d + '0')
        print(a-d)

Buggy submission (verdict: Runtime Error):
a = input()
b = len(list(a))
c = int(a)
d = ''

if b % 2 == 0:
    d = '9' * (b // 2)
    print('0'.join(d))

else:
    if b > 1:
        d = '9' * (b // 2)
    '0'.join(d)
    d = int(d)
    if b > 1:
        print(d + int(a[1:]) + 1)
    else:
        print(int(a))

Buggy submission (verdict: Runtime Error):
a = input()
b = len(list(a))
c = int(a)
d = ''

if b % 2 == 0:
    d = '9' * (b // 2)
    print('0'.join(d))

else:
    if b > 1:
        d = '9' * (b // 2)
    '0'.join(d)
    d = int(d)
    if b > 1:
        print(d + int(a[1:]) + 1)
    else:
        print(d + int(a) + 1)

Buggy submission (verdict: Runtime Error):
a = input()
b = len(list(a))
c = int(a)
d = ''

if b % 2 == 0:
    d = '9' * (b // 2)
    print('0'.join(d))

else:
    if b > 1:
        d = '9' * (b // 2)
    '0'.join(d)
    d = int(d)
    print(d + int(a[1:]) + 1)
Problem p02957 (python)

Fixed submission:
a,b = map(int,input().split())
 
if a % 2 == 0 and b % 2 != 0:
  print('IMPOSSIBLE')
  exit()
if a % 2 != 0 and b % 2 == 0:
  print('IMPOSSIBLE')
  exit()
print((a + b) // 2)

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

if a % 2 == 0 and b % 2 != 0:
	print('IMPOSSIBLE')
	exit()
if a % 2 != 0 and b % 2 == 0:
  	print('IMPOSSIBLE')
	exit()
print((a + b) // 2)

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

if a % 2 == 0 and b % 2 != 0:
	print('Impossible')
    exit()
if a % 2 != 0 and b % 2 == 0:
  	print('Impossible')
    exit()
print((a + b) // 2)
Problem p02981 (python)

Fixed submission:
a = input().split(' ')
 
b = int(a[0]) * int(a[1])
 
if (b < int(a[2])):
  print(b)
 
else:
  print(a[2])

Buggy submission (verdict: Runtime Error):
a = input().split(' ')
 
b = int(a[0]) * int(a[1])
 
if (b < a[2]):
  print(b)
 
else:
  print(a[2])
Problem p02982 (python)

Fixed submission:
a,b = input().split(' ')
 
c = []
for i in range(int(a)):
  c.append(input().split(' '))

ans = 0
count = 0
for j in range(int(a)):
  for k in range(int(a)):
    if j > k:
        ans = 0
        for l in range(int(b)):
            ans = ans + (int(c[j][l]) - int(c[k][l])) ** 2
        if ans ** 0.5 == round(ans ** 0.5):
            count = count + 1

print(count)

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

c = []
for i in range(int(a)):
  c.append(input().split(' '))

count = 0
for j in range(int(a)):
  for k in range(int(a)):
    if j > k:
    ans = 0
    for l in rnage(int(b)):
      ans = ans + (int(c[j][l]) ** 2 - int(c[k][l]) ** 2) ** 0.5

    if ans = int(ans):
      count = count + 1

print(count)
Problem p03109 (python)

Fixed submission:
a = input().split('/')
if a[1][0] == '0':
  a[1] = a[1][1]
if int(a[0]) >= 2019 and int(a[1]) >= 5:
  print('TBD')
  
else:
  print('Heisei')

Buggy submission (verdict: Runtime Error):
a = input().split('/')
if a[0] > 2019 and a[1] > 5:
  print('TBD')
  
else:
  print('Heisei')
Problem p03136 (python)

Fixed submission:
n = input()
m = list(map(int,input().split()))
m.sort()
if m[-1] < sum(m) - m[-1]:
  print('Yes')
else:
  print('No')

Buggy submission (verdict: Runtime Error):
n = input()
m = list(map(int,input().split()))
m = m.sorted()
if m[-1] < sum(m) - m[-1]:
  print('Yes')
else:
  print('No')
Problem p03436 (python)

Fixed submission:
n,m = map(int,input().split())
from collections import deque
a = []
for _ in range(n):
    a.append(list(input()))

count = 0
for x in a:
    count += x.count("#")
#print(count)

b = [[-1 for i in range(m)] for i in range(n)]
#print(a)

x = [0, 0, -1, 1]
y = [-1, 1, 0, 0]
queue = deque([[0,0]])
b[0][0] = 1
while queue:
    now = queue.popleft()
    if now == [n-1,m-1]:
        print(n * m - (b[n-1][m-1] + count))
        exit()
    a[now[0]][now[1]] = "#"
    for i in range(4):
        if 0 <= now[0] + y[i] < n and 0 <= now[1] + x[i] < m and b[now[0]+y[i]][now[1]+x[i]] == -1:
            if a[now[0]+y[i]][now[1]+x[i]] == '.':
                queue.append([now[0]+y[i],now[1]+x[i]])
                b[now[0]+y[i]][now[1]+x[i]] = b[now[0]][now[1]] + 1

print(-1)

Buggy submission (verdict: Runtime Error):
n,m = map(int,input().split())
from collections import deque
a = []
for _ in range(n):
    a.append(list(input()))

count = 0
for x in a:
    count += x.count("#")
#print(count)

b = [[100000 for i in range(m)] for i in range(n)]
#print(a)

x = [0, 0, -1, 1]
y = [-1, 1, 0, 0]

queue = deque([])
now = [0,0]
b[0][0] = 1
while now != [n-1, m-1]:
    for i in range(4):
        if now[0] + y[i] < 0 or now[0] + y[i] >= n or now[1] + x[i] < 0 or now[1] + x[i] >= m:
            continue
        if a[now[0]+y[i]][now[1]+x[i]] == '.':
            queue.append([now[0]+y[i],now[1]+x[i]])
        b[now[0]+y[i]][now[1]+x[i]] = min(b[now[0]][now[1]] + 1, b[now[0]+y[i]][now[1]+x[i]])
    a[now[0]][now[1]] = "#"
    now = queue.popleft()


ans = n * m - (b[n-1][m-1] + count)
print(ans)
Problem p02639 (python)

Fixed submission:
x = list(map(int, input().split()))
for i in range(len(x)):
    if x[i] == 0:
        print(i+1)
        break

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

for i in range(x):
    if x[i] == 0:
        print(i+1)
        break
Problem p03962 (python)

Fixed submission:
a=set(map(int,input().split()))
print(len(a))

Buggy submission (verdict: Runtime Error):
a=set(int,input().split())
print(len(a)
Problem p04011 (python)

Fixed submission:
N,K,X,Y=[int(input()) for i in range(4)]

if(K>=N):
  Z=N*X
  print(Z)
else:
  Z=K*X+(N-K)*Y
  print(Z)

Buggy submission (verdict: Runtime Error):
N,K,X,Y=[int(input()) for i in range(4)]

if(K>N):
  N=K
else:
  

Z=K*X+(N-K)*Y
print(Z)
Problem p02582 (python)

Fixed submission:
a = input()
 
if("RRR" in a):
  print("3")
elif("RR" in a):
  print("2")
elif("R" in a):
  print("1")
else:
  print("0")

Buggy submission (verdict: Runtime Error):
a=input()
b=0

for i in a:
  if i==R:
    b+=1
    if b==2:
      print(b)
      import sys
      sys.exit()
    
  if i==S and b>0 :
    b-=1
    
print(b)

Buggy submission (verdict: Runtime Error):
a=input()
b=0

for i in a:
  if i==R:
    b+=1
    
  if i==S and b>0:
    b-=1
    
print(b)
Problem p03643 (python)

Fixed submission:
print('ABC'+input())

Buggy submission (verdict: Runtime Error):
print(ABC+input())
Problem p03657 (python)

Fixed submission:
a=list(map(int,input().split()))
b=sum(a)
 
if (b%3 ==0 or a[0]%3 ==0 or a[1]%3==0) :
  print('Possible')
else :
  print('Impossible')

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

if (b%3 or a[0]%3 or a[1]) !=0 :
  print('Impossible')
elif :
  print('Possible')
Problem p03737 (python)

Fixed submission:
a=input().split()
b=[]

for i in range(3):
  b.append(a[i][0].upper())
  
  
print(b[0]+b[1]+b[2])

Buggy submission (verdict: Runtime Error):
a=input().split()
b=[]

for i in range(3):
  b.append(a[0][i].upper())
  
  
print(b[0]+b[1]+b[2])
Problem p03759 (python)

Fixed submission:
a=list(map(int,input().split()))
 
if a[0]+a[2]==2*a[1]:
  print('YES')
 
else:
  print('NO')

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

if a[0]+a[2]=2*a[1]:
  print('YES')

else:
  print('NO')
Problem p03826 (python)

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

b=a[0]*a[1]
c=a[2]*a[3]

if b-c>0:
  print(b)

else:
  print(c)

Buggy submission (verdict: Runtime Error):
a,b=[input() for i in range(2)]
p=0
ans=0

for i in b:
  if i =='I':
    p+=1
  elif i =='D' and p>0:
    p-=1
  else:
    p-=1
  
  if ans<p:
    ans=p
 
print(ans)
Problem p04043 (python)

Fixed submission:
import sys
a=list(map(int,input().split()))
s=0
f=0

for i in range(3):
  s+=a[i]
  
if s!=17:
  print('NO')
  sys.exit()
  
else:
  for t in range(3):
    if a[t]==5:
      f+=1
      
if f==2:
  print('YES')
  

else:
  print('NO')

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

for i in range(a):
  c.append(input())

d=sorted(c)  
print(''.join(d))
Problem p02780 (python)

Fixed submission:
from collections import defaultdict, deque
import sys, heapq, bisect, math, itertools, string, queue, copy, time
from fractions import gcd
import numpy as np
sys.setrecursionlimit(10**8)
INF = float('inf')
MOD = 10**9+7
EPS = 10**-7
def inp(): return int(sys.stdin.readline())
def inpl(): return list(map(int, sys.stdin.readline().split()))
def inpl_str(): return list(sys.stdin.readline().split())

n, k = map(int, input().split())
p_array = np.array(list(map(int, input().split())))
expc = lambda x: (x+1.0)/2.0
p_array = expc(p_array)

p_cum = np.cumsum(p_array)
p_cum_diff = p_cum[k:] - p_cum[0:n-k]
if len(p_cum_diff) > 0:
    print(max(p_cum_diff))
else:
    print(p_cum[-1])

Buggy submission (verdict: Runtime Error):
from collections import defaultdict, deque
import sys, heapq, bisect, math, itertools, string, queue, copy, time
from fractions import gcd
import numpy as np
sys.setrecursionlimit(10**8)
INF = float('inf')
MOD = 10**9+7
EPS = 10**-7
def inp(): return int(sys.stdin.readline())
def inpl(): return list(map(int, sys.stdin.readline().split()))
def inpl_str(): return list(sys.stdin.readline().split())

n, k = map(int, input().split())
p_array = np.array(list(map(int, input().split())))
expc = lambda x: (x+1.0)/2.0
p_array = expc(p_array)

p_cum = np.cumsum(p_array)
p_cum_diff = p_cum[k:] - p_cum[0:n-k]
print(max(p_cum_diff))
Problem p02811 (python)

Fixed submission:
from collections import defaultdict, deque
import sys, heapq, bisect, math, itertools, string, queue, copy, time
from fractions import gcd
import numpy as np
sys.setrecursionlimit(10**8)
INF = float('inf')
MOD = 10**9+7
EPS = 10**-7
def inp(): return int(sys.stdin.readline())
def inpl(): return list(map(int, sys.stdin.readline().split()))
def inpl_str(): return list(sys.stdin.readline().split())

k, x = map(int, input().split())
ans = 'No'
if 500 * k >= x:
    ans = 'Yes'

print(ans)

Buggy submission (verdict: Runtime Error):
from collections import defaultdict, deque
import sys, heapq, bisect, math, itertools, string, queue, copy, time
from fractions import gcd
import numpy as np
sys.setrecursionlimit(10**8)
INF = float('inf')
MOD = 10**9+7
EPS = 10**-7
def inp(): return int(sys.stdin.readline())
def inpl(): return list(map(int, sys.stdin.readline().split()))
def inpl_str(): return list(sys.stdin.readline().split())

n = int(input())
p = tuple(map(int, input().split()))
q = tuple(map(int, input().split()))
a = 0
b = 0
k = 0

for i in itertools.permutations(range(1,n+1)):
    k += 1
    if i == p:
        a = k
    if i == q:
        b = k
ans = abs(a-b)
print(ans)