Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Runtime Error):
N, W = map(int, input().split())
WV = [list(map(int,input().split())) for _ in range(N)]

dp = [[-1 for _ in range(W+1)] for _ in range(N)]

W0 = WV[0][0]
V0 = WV[0][1]

def initial(w):
    if w >= W0:
        return V0
    else:
        return 0
dp[0] = [initial(w) for w in range(W+1)]

def calcu(i,w):
    if dp[i][w] != -1:
        return dp[i][w]

    w_i = WV[i][0]
    if w >= w_i:
        res = max(calcu(i-1, w-w_i)+WV[i][1], calcu(i-1,w))

    else:
        res = calcu(i-1,w)
    dp[i][w] = res
    return res

calcu(N-1, W)
print(dp[-1][-1])

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

dp = [0 for _ in range(N)]

for i in range(N): #0 <= i < N
    if i == 0:
        continue
    elif i == 1:
        dp[i] = abs(H[i]- H[i-1])
    else:
        dp[i] = min(dp[i-1]+ abs(H[i]-H[i-1]), dp[i-2]+ abs(H[i]- H[i-2]))

print(dp[-1])
Buggy python submission (verdict: Time Limit Exceeded):
N, K = map(int, input().split())
H = list(map(int, input().split()))

dp = [0 for _ in range(N)]

for i in range(1,N): #0 <= i < N
    dp[i] = min([dp[i-k] + abs(H[i]-H[i-k]) for k in range(1, min(i, K)+1)])

print(dp[-1])

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

dp = [0 for _ in range(N)]

for i in range(1,N): #0 <= i < N
    dp[i] = min([dp[i-k] + abs(H[i]-H[i-k]) for k in range(1, min(i, K)+1)])

print(dp[-1])

Buggy python submission (verdict: Time Limit Exceeded):
N, K = map(int, input().split())
H = list(map(int, input().split()))

dp = [0 for _ in range(N)]


import numpy as np
for i in range(N): #0 <= i < N
    if i == 0:
        continue
    else:
        obj = [dp[i-k] + abs(H[i]-H[i-k]) for k in range(1, min(i, K)+1)]
        dp[i] = min(obj)

print(dp[-1])

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

dp = [0 for _ in range(N)]

for i in range(1,N): #0 <= i < N
    dp[i] = min([dp[i-k] + abs(H[i]-H[i-k]) for k in range(1, min(i, K)+1)])

print(dp[-1])
Buggy python submission (verdict: Runtime Error):
N = int(input())
ABC = np.array([list(map(int,input().split())) for _ in range(N)])


dp = [[0, 0, 0] for _ in range(N)]
dp[0] = ABC[0]

select_action = [[1,2], [0,2], [0,1]]
for i in range(1,N):
    for j in range(3):
        abc1 = select_action[j][0]
        abc2 = select_action[j][1]

        dp[i][j] = max(dp[i-1][abc1], dp[i-1][abc2]) + ABC[i][j]


print(max(dp[-1]))

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


dp = [[0, 0, 0] for _ in range(N)]
dp[0] = ABC[0]

select_action = [[1,2], [0,2], [0,1]]
for i in range(1,N):
    for j in range(3):
        abc1 = select_action[j][0]
        abc2 = select_action[j][1]

        dp[i][j] = max(dp[i-1][abc1], dp[i-1][abc2]) + ABC[i][j]


print(max(dp[-1]))

Buggy python submission (verdict: Runtime Error):
import numpy as np

N = int(input())
ABC = np.array([list(map(int,input().split())) for _ in range(N)])


dp = [[0, 0, 0] for _ in range(N)]
dp[0] = ABC[0]

select_action = [[1,2], [0,2], [0,1]]
for i in range(1,N):
    for j in range(3):
        abc1 = select_action[j][0]
        abc2 = select_action[j][1]

        dp[i][j] = max(dp[i-1][abc1], dp[i-1][abc2]) + ABC[i][j]


print(max(dp[-1]))

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


dp = [[0, 0, 0] for _ in range(N)]
dp[0] = ABC[0]

select_action = [[1,2], [0,2], [0,1]]
for i in range(1,N):
    for j in range(3):
        abc1 = select_action[j][0]
        abc2 = select_action[j][1]

        dp[i][j] = max(dp[i-1][abc1], dp[i-1][abc2]) + ABC[i][j]


print(max(dp[-1]))
Buggy python submission (verdict: Time Limit Exceeded):
S = input()
listS = list(S)
done = False

x = 0
n = 0

while not done:
	for i in range(len(listS)-1):
		if listS[i] == "B" and listS[i+1] == "W":
			listS[i] = "W"
			listS[i+1] = "B"
			x += 1
			n += 1

	if x == 0:
		print(n)
		done = True
	x = 0


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


w_sum = 0
w_n = 0
for i, c in enumerate(s):
    if c == "W":
        w_sum += i
        w_n += 1
    
print(w_sum - w_n*(w_n-1)//2)

Buggy python submission (verdict: Time Limit Exceeded):
S = input()
listS = list(S)

for i in range(len(listS)):
	if listS[i] == "B":
		listS[i] = 0
	if listS[i] == "W":
		listS[i] = 1
		
done = False

x = 0
n = 0

while not done:
	for i in range(len(listS)-1):
		if listS[i] < listS[i+1]:
			listS[i] = 1
			listS[i+1] = 0
			x += 1
			n += 1

	if x == 0:
		print(n)
		done = True
	x = 0


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


w_sum = 0
w_n = 0
for i, c in enumerate(s):
    if c == "W":
        w_sum += i
        w_n += 1
    
print(w_sum - w_n*(w_n-1)//2)

Buggy python submission (verdict: Time Limit Exceeded):
S = input()
listS = list(S)

for i in range(len(listS)):
	if listS[i] == "B":
		listS[i] = 0
	if listS[i] == "W":
		listS[i] = 1
		
done = False

listX = []
listN = []

while not done:
	for i in range(len(listS)-1):
		if listS[i] < listS[i+1]:
			listS[i] = 1
			listS[i+1] = 0
			listN.append(0)
			listX.append(0)

	if len(listX) == 0:
		print(len(listN))
		done = True
	listX.clear()




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


w_sum = 0
w_n = 0
for i, c in enumerate(s):
    if c == "W":
        w_sum += i
        w_n += 1
    
print(w_sum - w_n*(w_n-1)//2)
Buggy python submission (verdict: Runtime Error):
s = input()

listS = list(s)

listA = []
listB = []


for i in range(len(listS)-2):
	for j in range(3):
		n = int(listS[j+i])
		listA.append(n)
	Sm =listA[0]*100+listA[1]*10+list{2}
	sa= abs(int(753) - Sm)
	listB.append(sa)

	listA.clear()

print(min(listB))


Fixed submission:
s = input()
listS = list(s)
listA = []
listB = []
for i in range(len(listS)-2):
	for j in range(3):
		n = int(listS[j+i])
		listA.append(n)
	Sm =listA[0]*100+listA[1]*10+listA[2]
	sa= abs(int(753) - Sm)
	listB.append(sa)
	listA.clear()
print(min(listB))
Buggy python submission (verdict: Runtime Error):
def f(x, y):
    return x+y/2

x = int(input())
y = int(input())
print(f(x,y))

Fixed submission:
x, y = tuple(map(int, input().split()))

print(int(x + y /2))
Buggy python submission (verdict: Runtime Error):
#include<iostream>
#include<bits/stdc++.h>
using namespace std;

#define ll                 long long
#define mod                1000000007
#define pb                 push_back
#define vecsort(v)         sort(v.begin(),v.end())
#define lcm(x,y)           (x/__gcd(x,y))*y
#define forn(i,n)          for(i = 0 ; i < n ; i++)
#define deb(x)             cout << #x << " " << x << endl;
#define T(t)               cout << "Case " << t <<": ";
#define scan(v)            for(int i = 0; i<n; i++){ll x;cin>>x;v.pb(x);}
#define fast_cin           ios_base::sync_with_stdio(false);cin.tie(NULL);



int main() {
     
       #ifndef ONLINE_JUDGE
       //freopen("read.txt","r",stdin);
      // freopen("write.txt","w",stdout);
       #endif

       set < string > S;

       ll n ;
       cin >> n ;
       for( int i = 0 ; i < n ; i++ ){
              string s;
              cin >> s;
              S.insert(s);
       }
       cout << S.size() << endl;





       return 0;

}

Fixed submission:
s = set()
for _ in range(int(input())):
     s.add(input())
print(len(s))
Buggy python submission (verdict: Runtime Error):
import collections
a,b,c,d = input().split()
a=int(a)
b=int(b)
c=int(c)
d=int(d)
abi=int(min(a,b))
abm=int(max(a,b))
cdi=int(min(c,d))
cdm=int(max(c,d))
res1=[]
res2=[]
if abi<0 and abm<0:
  res1=[abi,abm]
elif abi<0 and abm==0:
  res1=[abi,-1,0]
elif abi<0 and abm>0:
  res1=[abi,-1,0,1,abm]
elif abi==0 and abm==0:
  res1=[0]
elif abi==0 and abm>0:
  res1=[0,1,abm]
elif abi>0 and abm>0:
  res1=[abi,abm]

if cdi<0 and cdm<0:
  res2=[cdi,cdm]
elif cdi<0 and cdm==0:
  res2=[cdi,-1,0]
elif cdi<0 and cdm>0:
  res1=[cdi,-1,0,1,cdm]
elif cdi==0 and cdm==0:
  res2=[0]
elif cdi==0 and cdm>0:
  res2=[0,1,cdm]
elif cdi>0 and cdm>0:
  res2=[cdi,cdm]

res=[]
for g in res1:
  for h in res2:
    res.append(g*h)
#print(res)
print(max(res))

Fixed submission:
import collections
a,b,c,d = input().split()
a=int(a)
b=int(b)
c=int(c)
d=int(d)
abi=int(min(a,b))
abm=int(max(a,b))
cdi=int(min(c,d))
cdm=int(max(c,d))
res1=[]
res2=[]
if abi<0 and abm<0:
  res1=[abi,abm]
elif abi<0 and abm==0:
  res1=[abi,-1,0]
elif abi<0 and abm>0:
  res1=[abi,-1,0,1,abm]
elif abi==0 and abm==0:
  res1=[0]
elif abi==0 and abm>0:
  res1=[0,1,abm]
elif abi>0 and abm>0:
  res1=[abi,abm]

if cdi<0 and cdm<0:
  res2=[cdi,cdm]
elif cdi<0 and cdm==0:
  res2=[cdi,-1,0]
elif cdi<0 and cdm>0:
  res2=[cdi,-1,0,1,cdm]
elif cdi==0 and cdm==0:
  res2=[0]
elif cdi==0 and cdm>0:
  res2=[0,1,cdm]
elif cdi>0 and cdm>0:
  res2=[cdi,cdm]

res=[]
for g in res1:
  for h in res2:
    res.append(g*h)
#print(res)
print(max(res))

Buggy python submission (verdict: Runtime Error):
import collections
a,b,c,d = input().split()
abi=int(min(a,b))
abm=int(max(a,b))
cdi=int(min(c,d))
cdm=int(max(c,d))
res1=[]
res2=[]
if abi<0 and abm<0:
  res1=[abi,abm]
elif abi<0 and abm==0:
  res1=[abi,-1,0]
elif abi==0 and abm==0:
  res1=[0]
elif abi==0 and abm>0:
  res1=[0,1,abm]
elif abi>0 and abm>0:
  res1=[abi,abm]

if cdi<0 and cdm<0:
  res2=[cdi,cdm]
elif cdi<0 and cdm==0:
  res2=[cdi,-1,0]
elif cdi==0 and cdm==0:
  res2=[0]
elif cdi==0 and cdm>0:
  res2=[0,1,cdm]
elif cdi>0 and cdm>0:
  res2=[cdi,cdm]

res=[]
for g in res1:
  for h in res2:
    res.append(g*h)
print(max(res))

Fixed submission:
import collections
a,b,c,d = input().split()
a=int(a)
b=int(b)
c=int(c)
d=int(d)
abi=int(min(a,b))
abm=int(max(a,b))
cdi=int(min(c,d))
cdm=int(max(c,d))
res1=[]
res2=[]
if abi<0 and abm<0:
  res1=[abi,abm]
elif abi<0 and abm==0:
  res1=[abi,-1,0]
elif abi<0 and abm>0:
  res1=[abi,-1,0,1,abm]
elif abi==0 and abm==0:
  res1=[0]
elif abi==0 and abm>0:
  res1=[0,1,abm]
elif abi>0 and abm>0:
  res1=[abi,abm]

if cdi<0 and cdm<0:
  res2=[cdi,cdm]
elif cdi<0 and cdm==0:
  res2=[cdi,-1,0]
elif cdi<0 and cdm>0:
  res2=[cdi,-1,0,1,cdm]
elif cdi==0 and cdm==0:
  res2=[0]
elif cdi==0 and cdm>0:
  res2=[0,1,cdm]
elif cdi>0 and cdm>0:
  res2=[cdi,cdm]

res=[]
for g in res1:
  for h in res2:
    res.append(g*h)
#print(res)
print(max(res))
Buggy python submission (verdict: Runtime Error):
a = input().split()
s=a[0]
t=a[1]
print(t&s)

Fixed submission:
a = input().split()
s=a[0]
t=a[1]
print(t+s)
Buggy python submission (verdict: Runtime Error):
a, b = map(int, input().split())
if a in range(1,9);
 if b in range(1,9);
  print(a*b)
else:
  print("-1")


Fixed submission:
import sys
a, b = map(int, input().split())
k = range(1,10)
if a in k:
 if b in k:
  print(a*b)
  sys.exit()
 else:
  pass
print("-1")

Buggy python submission (verdict: Runtime Error):
a, b = input().split()
a= int(a)
b = int(b)
if a in range(1,9);
 if b in range(1,9);
  print(a*b)
else:
  print("-1")


Fixed submission:
import sys
a, b = map(int, input().split())
k = range(1,10)
if a in k:
 if b in k:
  print(a*b)
  sys.exit()
 else:
  pass
print("-1")

Buggy python submission (verdict: Runtime Error):
a, b = input().split()
a= int(a)
b = int(b)
if a in range(1,9);
 if b in range(1,9)
  print(a*b)
else:
  print("-1")


Fixed submission:
import sys
a, b = map(int, input().split())
k = range(1,10)
if a in k:
 if b in k:
  print(a*b)
  sys.exit()
 else:
  pass
print("-1")

Buggy python submission (verdict: Runtime Error):
a, b = input().split()
a= int(a)
b = int(b)
if not len(a) <2;
 if not len(b) < 2;
  print(a*b)
else:
  print("-1")


Fixed submission:
import sys
a, b = map(int, input().split())
k = range(1,10)
if a in k:
 if b in k:
  print(a*b)
  sys.exit()
 else:
  pass
print("-1")

Buggy python submission (verdict: Runtime Error):
a, b = input().split()
a= int(a)
b = int(b)
if not len(a) ==2;
 if not len(b) == 2;
  print(a*b)
else:
  print("-1")


Fixed submission:
import sys
a, b = map(int, input().split())
k = range(1,10)
if a in k:
 if b in k:
  print(a*b)
  sys.exit()
 else:
  pass
print("-1")
Buggy python submission (verdict: Runtime Error):
n = str(input())
d = []
p = []
i = 1
s = 1
l = 1
for k in n:
 if i % 2 == 0:
  if k == "R" or k == "U" or k == "D":
   #print(k,"は満たしています")
  else:
   #print("偶数","みたしていない")
   s = 0
 else:
  if k == "L" or k == "U" or k == "D":
   #print("奇数","番目の",k)
  else:
    #print("奇数","みたしていない")
    l = 0
 i = i + 1
if s or l == "1":
 print("Yes")
else:
 print("No")

Fixed submission:
n = str(input())
d = []
p = []
i = 1
s = 1
l = 1
for k in n:
 if i % 2 == 0:
  if k == "L" or k == "U" or k == "D":
   pass
  else:
   s = 0
 else:
  if k == "R" or k == "U" or k == "D":
   pass
  else:
    l = 0
 i = i + 1
#print(s,l)
if s and l == 1:
 print("Yes")
else:
 print("No")
Buggy python submission (verdict: Runtime Error):
a,b = map(int, input().split())  
res = 1
while 1:
  if a *res - (res -1 ) =< b:
    res = res + 1
    #print(a,"個口を",res,"つ使うと未使用は、",a *res - (res -1 ))
  else:
    break
print(res)
    
    

    


Fixed submission:
a,b = map(int, input().split())
res = 1
if b == 1:
    print(0)
    exit(0)
while a *res - (res -1 ) < b  :
 res = res + 1
 #print(a,"個口を",res,"つ使うと未使用は、",a *res - (res -1 ))
print(res)
Buggy python submission (verdict: Runtime Error):
N = int(input())
As = [int(x) for x in input().split()]
p = []
n = 0
k = 0
while n < len(As) - 1:
 if As[n]<As[n + 1]:
  #print(As[n] ,"<",As[n + 1],k)
  k = 0
 if As[n]>As[n + 1]:
  #print(As[n] ,">",As[n + 1],k)
  k = k + 1
 if As[n]==As[n + 1]:
  #print(As[n] ,"=",As[n + 1],k)
  k = k + 1
 p.append(k)
 n = n + 1

print(max(p)%1000000007)
    


Fixed submission:
N = int(input())
As = [int(x) for x in input().split()]
n = 0
k = 0
mac = 0
while n < len(As) - 1:
 if As[n]<As[n + 1]:
  #print(As[n] ,"<",As[n + 1],k)
  k = 0
 if As[n]>As[n + 1]:
  #print(As[n] ,">",As[n + 1],k)
  k = k + 1
 if As[n]==As[n + 1]:
  #print(As[n] ,"=",As[n + 1],k)
  k = k + 1
 mac = max(k,mac)
 n = n + 1

print(mac%1000000007)
Buggy python submission (verdict: Runtime Error):
a = int(input())
s = str(input())
if a >= 3200:
 print("red")
if s < 2800:
 print(s)

Fixed submission:
a = int(input())
s = str(input())
if a >= 3200:
 print(s)
if a < 3200:
 print("red")

Buggy python submission (verdict: Runtime Error):
s = map(int,input())
a = map(str,input())
if s >= 3200:
print("red")
else:
print(a)

Fixed submission:
a = int(input())
s = str(input())
if a >= 3200:
 print(s)
if a < 3200:
 print("red")

Buggy python submission (verdict: Runtime Error):
s = map(int,input())
a = map(str,input())
if s >= 3200:
 print("red")
else:
 print(a)

Fixed submission:
a = int(input())
s = str(input())
if a >= 3200:
 print(s)
if a < 3200:
 print("red")

Buggy python submission (verdict: Runtime Error):
s = map(int,input())
a = map(str,input())
if s >= 3200
 print("red")
else
 print(s)

Fixed submission:
a = int(input())
s = str(input())
if a >= 3200:
 print(s)
if a < 3200:
 print("red")

Buggy python submission (verdict: Runtime Error):
s = map(int,input())
a = map(str,input())
if s >= 3200:
 print("red")
else:
 print(s)

Fixed submission:
a = int(input())
s = str(input())
if a >= 3200:
 print(s)
if a < 3200:
 print("red")
Buggy python submission (verdict: Runtime Error):
a = int(input())
List=[int(i) for i in input().split()]
List.sort()
print(List)
num = 0
ans = []
while num < a:
  res = (List[num] + List[num+1])/2
  ans.append(res)
  resa = (ans[num] + List[num+2])/2
  num = num + 1
  if num == a:
  print(resa)
  break


Fixed submission:
a = int(input())
List=[int(i) for i in input().split()]
k = [1/i for i in List]
m = sum(k)
print(1/m)
Buggy python submission (verdict: Runtime Error):
a, b = input().strip().split()
k = max([a+b,a-b,a*b])
print(k)


Fixed submission:
a, b = input().strip().split()
a, b = [int(a), int(b)]
print(max([a+b,a-b,a*b]))

Buggy python submission (verdict: Runtime Error):
a, b = input().strip().split()
print(max([a+b,a-b,a*b]))

Fixed submission:
a, b = input().strip().split()
a, b = [int(a), int(b)]
print(max([a+b,a-b,a*b]))

Buggy python submission (verdict: Runtime Error):
a, b = input().strip().split()
print(max[a+b,a-b,a*b])

Fixed submission:
a, b = input().strip().split()
a, b = [int(a), int(b)]
print(max([a+b,a-b,a*b]))

Buggy python submission (verdict: Runtime Error):
a, b = input().strip().split()
print(max(a+b,a-b,a*b))

Fixed submission:
a, b = input().strip().split()
a, b = [int(a), int(b)]
print(max([a+b,a-b,a*b]))
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
arr = [int(x) for x in input().split()]
res = 1
for i in range(n):
    res *= arr[i]
if res > 10**18:
    print(-1)
else:
    print(res)

Fixed submission:
n = int(input())
arr = [int(x) for x in input().split()]
res = 1
flag = False
for i in range(n):
    if flag == False:
        res *= arr[i]
    if arr[i] == 0:
        print(0)
        exit()
    if res > 10**18:
        flag = True
if res > 10**18:
    print(-1)
else:
    print(res)

Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
a = list(map(int, input().split()))
ans = 1
for i in range(n):
    ans *= a[i]
if ans > 1000000000000000000:
    print(-1)
else:
    print(ans)

Fixed submission:
n = int(input())
a = list(map(int, input().split()))
ans = 1
for i in range(n):
    if a[i] == 0:
        print(0)
        exit()
for i in range(n):
    ans *= a[i]
    if ans > 1000000000000000000:
        break
if ans > 1000000000000000000:
    print(-1)
else:
    print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
a = list(map(int, input().split()))
ans = 1
for i in range(n):
    ans *= a[i]
if ans > 10**18:
    print(-1)
else:
    print(ans)

Fixed submission:
n = int(input())
a = list(map(int, input().split()))
ans = 1
for i in range(n):
    if a[i] == 0:
        print(0)
        exit()
for i in range(n):
    ans *= a[i]
    if ans > 1000000000000000000:
        break
if ans > 1000000000000000000:
    print(-1)
else:
    print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
a = list(map(int, input().split()))
dp = [[0] * (n+1) for i in range(n+1)]
A = []
for i in range(n):
    A.append([a[i], i])
A.sort(reverse=True)
for i in range(1, n+1):
    for j in range(i+1):
        if j == 0:
            dp[j][i-j] = dp[j][i-j-1] + A[i-1][0] * abs(n-i-A[i-1][1])
        elif j == i:
            dp[j][i-j] = dp[j-1][i-j] + A[i-1][0] * abs(A[i-1][1]-i+1)
        else:
            dp[j][i-j] = max(dp[j][i-j-1] + A[i-1][0] * abs(n-i+j-A[i-1][1]), dp[j-1][i-j] + A[i-1][0] * abs(A[i-1][1]-j+1))
ans = 0
for i in range(n+1):
    ans = max(ans, dp[i][n-i])
print(ans)

Fixed submission:
n = int(input())
a = list(map(int, input().split()))
dp = [[0] * (n+1) for i in range(n+1)]
A = []
for i in range(n):
    A.append([a[i], i])
A.sort(reverse=True)
for i in range(1, n+1):
    for j in range(i+1):
        if j == 0:
            dp[j][i-j] = dp[j][i-j-1] + A[i-1][0] * abs(n-i-A[i-1][1])
        elif j == i:
            dp[j][i-j] = dp[j-1][i-j] + A[i-1][0] * abs(A[i-1][1]-i+1)
        else:
            dp[j][i-j] = max(dp[j][i-j-1] + A[i-1][0] * abs(n-i+j-A[i-1][1]), dp[j-1][i-j] + A[i-1][0] * abs(A[i-1][1]-j+1))
ans = 0
for i in range(n+1):
    ans = max(ans, dp[i][n-i])
print(ans)
Buggy python submission (verdict: Runtime Error):
n = int(input())
a = list(map(int, input().split()))
if n % 2 == 0:
  dp = [[0, 0] for i in range(n)]
  dp[0][0] = a[0]
  dp[1][1] = a[1]
  dp[2][0] = a[0] + a[2]
  for i in range(3, n):
    dp[i][0] = dp[i - 2][0] + a[i]
    dp[i][1] = max(dp[i - 3][0], dp[i - 2][1]) + a[i]
  print(max(dp[n - 2][0], dp[n - 1][1]))
else:
  dp = [[0, 0, 0] for i in range(n)]
  dp[0][0] = a[0]
  dp[1][1] = a[1]
  dp[2][0] = a[0] + a[2]
  dp[2][2] = a[2]
  dp[3][1] = a[1] + a[3]
  dp[3][2] = a[0] + a[3]
  for i in range(3, n):
    dp[i][0] = dp[i - 2][0] + a[i]
    dp[i][1] = max(dp[i - 3][0], dp[i - 2][1]) + a[i]
    dp[i][2] = max(dp[i - 4][0], dp[i - 3][1], dp[i - 2][2]) + a[i]
  print(max(dp[n - 3][0], dp[n - 2][1], dp[n - 1][2]))

Fixed submission:
n = int(input())
a = list(map(int, input().split()))
if n % 2 == 0 and n >= 4:
  dp = [[0, 0] for i in range(n)]
  dp[0][0] = a[0]
  dp[1][1] = a[1]
  dp[2][0] = a[0] + a[2]
  for i in range(3, n):
    dp[i][0] = dp[i - 2][0] + a[i]
    dp[i][1] = max(dp[i - 3][0], dp[i - 2][1]) + a[i]
  print(max(dp[n - 2][0], dp[n - 1][1]))
elif n % 2 != 0 and n >= 5:
  dp = [[0, 0, 0] for i in range(n)]
  dp[0][0] = a[0]
  dp[1][1] = a[1]
  dp[2][0] = a[0] + a[2]
  dp[2][2] = a[2]
  dp[3][1] = a[1] + a[3]
  dp[3][2] = a[0] + a[3]
  for i in range(3, n):
    dp[i][0] = dp[i - 2][0] + a[i]
    dp[i][1] = max(dp[i - 3][0], dp[i - 2][1]) + a[i]
    dp[i][2] = max(dp[i - 4][0], dp[i - 3][1], dp[i - 2][2]) + a[i]
  print(max(dp[n - 3][0], dp[n - 2][1], dp[n - 1][2]))
elif n == 2:
  print(max(a[0], a[1]))
else:
  print(max(a[0], a[1], a[2]))
Buggy python submission (verdict: Runtime Error):
from math import floor
a, b = map(int, input().split())
ans = -1
for i in range(10101):
  if floor(i*0.08) = a and floor(i*0.1) = b:
    ans = i
    break
print(ans)

Fixed submission:
from math import floor
a, b = map(int, input().split())
ans = -1
for i in range(10101):
  if floor(i*0.08) == a and floor(i*0.1) == b:
    ans = i
    break
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
s = input()
dp = [[0, 0] for i in range(len(s))]
dp[0][0] = int(s[0])
dp[0][1] = 11 - int(s[0])
for i in range(1, len(s)):
  dp[i][0] = min(dp[i - 1][0], dp[i - 1][1]) + int(s[i])
  dp[i][1] = min(dp[i - 1][0] + 11 - int(s[i]), dp[i - 1][1] + 9 - int(s[i]))
print(min(dp[-1][0], dp[-1][1]))

Fixed submission:
s = input()
l = list(s)
l = [int(x) for x in l]
dp = [[0, 0] for i in range(len(s))]
dp[0][0] = l[0]
dp[0][1] = 11 - l[0]
for i in range(1, len(s)):
  dp[i][0] = min(dp[i - 1][0], dp[i - 1][1]) + l[i]
  dp[i][1] = min(dp[i - 1][0] + 11 - l[i], dp[i - 1][1] + 9 - l[i])
print(min(dp[-1][0], dp[-1][1]))
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
a = list(map(int, input().split()))
cnt = 0
for i in range(1,n):
  for j in range(i):
    if a[i] == a[j]:
      cnt = 1
if cnt == 0:
  print("YES")
else:
  print("NO")

Fixed submission:
n = int(input())
a = list(map(int, input().split()))
if len(a) == len(set(a)):
  print("YES")
else:
  print("NO")
Buggy python submission (verdict: Time Limit Exceeded):
n, k = map(int, input().split())
p = list(map(int, input().split()))
l = [0 for i in range(n)]
ans = 0
cnt = 0
for i in range(n):
  l[i] = p[i]*(p[i]+1)/(2*p[i])
if n == k:
  for i in range(k):
    ans += l[i]
else:
  for i in range(n-k+1):
    cnt = sum(l[i:i+k])
    if cnt > ans:
      ans = cnt
print(ans)

Fixed submission:
n, k = map(int, input().split())
p = list(map(int, input().split()))
l = [0 for i in range(n)]
ans = 0
cnt = 0
for i in range(n):
  l[i] = p[i]*(p[i]+1)/(2*p[i])
if n == k:
  ans = sum(l)
else:
  ans = sum(l[:k])
  cnt = ans
  for i in range(n-k):
    cnt = cnt - l[i] + l[i+k]
    if cnt > ans:
      ans = cnt
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
from math import ceil
from bisect import bisect_right
n, d, a = map(int, input().split())
l = []
l2 = []
l3 = []
ans = 0
for i in range(n):
  x, h = map(int, input().split())
  l.append([x, h])
  l2.append(x + 2 * d)
  l3.append(x)
l.sort(key=lambda x: x[0])
l2.sort()
l3.sort()
for i in range(n):
  if l[i][1] == 0:
    continue
  else:  
    cnt = ceil(l[i][1] / a)
    ans += cnt
    ind = bisect_right(l3, l2[i])
    for j in range(i, ind):
      l[j][1] = max(0, l[j][1] - a * cnt)
print(ans)

Fixed submission:
from math import ceil
from bisect import bisect_right

n, d, a = map(int, input().split())
l = []
l2 = []
l3 = []
l4 = [0 for i in range(n+1)]
l5 = [0 for i in range(n+1)]
ans = 0
for i in range(n):
  x, h = map(int, input().split())
  l.append([x, h])
  l2.append(x + 2 * d)
  l3.append(x)
l.sort(key=lambda x: x[0])
l2.sort()
l3.sort()
for i in range(n):
  cnt = ceil((l[i][1] - l4[i] * a) / a)
  if cnt > 0:
    ans += cnt
    ind = bisect_right(l3, l2[i])
    l5[ind] += cnt
    l4[i] += cnt
  l4[i+1] = l4[i] - l5[i+1]
    
print(ans)