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

Fixed submission:
n=int(input())
s=input()
r=g=b=0
for i in s:
  if i=="R":r+=1
  elif i=="G":g+=1
  else:b+=1

ans=r*g*b
for i in range(n):
  for j in range(i+1,n):
    k_ = j+(j-i)
    if(k_ >=n):
      break
    ans -= int(s[i]!= s[j] and s[i] != s[k_] and s[j] != s[k_])

print(ans)

Buggy submission (verdict: Runtime Error):
N = int(input())
S = list(input())
f=0
ijk = list()
for i in range(N):
    for j in range(N):
        for k in range(N):
            if(k>j and j>i):
                if(k == j+(j-i)):
                    pass
                elif(i == j-(j-k)):
                    pass
                else:
                    ijk.append([i+1,j+1,k+1])

for i in range(len(ijk)):
    if(S[ijk[i][0]]!= S[ijk[i][1]] and
       S[ijk[i][0]]!= S[ijk[i][2]] and
       S[ijk[i][1]]!= S[ijk[i][2]]):
       f+=1
print(f)

Buggy submission (verdict: Runtime Error):
N = int(input())
S = list(input())
f=0
ijk = list()
for i in range(N):
    for j in range(N):
        for k in range(N):
            if(i<j<k):
                if(S[i]==S[j]):
                    pass
                elif(S[i]==S[k]):
                    pass
                elif(S[j]==S[k]):
                    pass
                else:
                    ijk.append([i+1,j+1,k+1])
# print(ijk)
for i in range(len(ijk)):
    if(ijk[i][1]-ijk[i][0] == ijk[i][2]-ijk[i][1]):
        pass:
    else:
        f += 1
print(f)

Buggy submission (verdict: Runtime Error):
N = int(input())
S = list(map(str, input()))
f=0
i_c = j_c = k_c =1
ijk = list()
for i in range(N):
    for j in range(N):
        for k in range(N):
            if(k_c>j_c and j_c>i_c):
                if(j_c-i_c!=k_c-j_c):
                    ijk.append([i,j,k])
            k_c+=1
        j_c+=1
        k_c = 1
    i_c+=1
    j_c = 1
S_i = ijk[i][0]
S_j = ijk[i][1]
S_k = ijk[i][2]
for i in range(len(ijk)):
    if(S[ijk[i][0]]!= S[ijk[i][1]] and
       S[ijk[i][0]]!= S[ijk[i][2]] and
       S[ijk[i][1]]!= S[ijk[i][2]]):
       f+=1
print(f)

Buggy submission (verdict: Runtime Error):
N = int(input())
S = list(map(str, input()))
f=0
i_c = j_c = k_c =1
for i in range(N):
    for j in range(N):
        for k in range(N):
            if(k+1>j+1 and
               j+1>i+1 and
               j-i=k-j and
               S[i]!=S[j] and 
               S[i]!=S[k] and
               S[j]!=S[k]):
                    f+=1
 
print(f)
Problem p02922 (python)

Fixed submission:
import math
A,B = map(int,input().split())
print(math.ceil((B-1)/(A-1)))

Buggy submission (verdict: Runtime Error):
A,B = int(input())
if(A%B == 0):
    print(B/A)
else:
    print(B//A+1)
Problem p03043 (python)

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

two_beki = [1]*20
for i in range(1,20):
    two_beki[i] = 2**i
#[1,2,4,8,16,32,64,128,256,512,1024,2048,8192,16384]
n = N+1
list_index = list()
for I in range(1,n):
    for J in range(20):
        if(I*two_beki[J]>=K):
            list_index.append(J) 
            # print(J,I*two_beki[J])
            break
#print(list_index)
sum_harf = 0.0
for I in list_index:
    sum_harf += 1/two_beki[I]/N
print(sum_harf)

Buggy submission (verdict: Runtime Error):
N,K = map(int,input().split())
beki_2 = list()
for i in range(15):
    beki_2.append(2**i)
    # print(beki_2)
eachother = [0]*N
ind = 0
i = 0
# print(beki_2)
f =0
while all:
    if(i == 0):
        j = 0
        while all:
            if(1*beki_2[j] >= K):
                ind = j
                # print("i")
                eachother[i] = ind
                break
            # print(j,beki_2[j])
            j+=1
        i+=1
    else:
        # print(i+1,beki_2[ind],ind)
        
        if(ind == 0):
            if(i+1>=K):
                eachother[i] = 0
                # print("i+1>=K")
                ind = 0
            else:
                for l in range(len(beki_2)):
                    if((i+1)*beki_2[l]>=K):
                        eachother[i] = 1
                        break
                ind = 1
            i+=1

        if((i+1)*beki_2[ind]<K):
            eachother[i] = ind+1
            i +=1
        # print((i+1)*beki_2[ind],ind,i)

    ind -= 1

    if(i == N or ind == -1):
        # print(i,N)
        break
sum_each = 0.0

for i in range(len(eachother)):
    sum_each+=beki_2[eachother[0]]/beki_2[eachother[i]]

# print(eachother[0:10])
print((1/N)*sum_each/beki_2[eachother[0]])

Buggy submission (verdict: Runtime Error):
N,K = map(int,input().split())
beki_2 = list()
for i in range(16):
    beki_2.append(2**i)
    # print(beki_2)
eachother = [0]*N
ind = 0
i = 0
# print(beki_2)
f =0
while all:
    if(i == 0):
        j = 0
        while all:
            if(1*beki_2[j] >= K):
                ind = j
                # print("i")
                eachother[i] = ind
                break
            # print(j,beki_2[j])
            j+=1
        i+=1
    else:
        # print(i+1,beki_2[ind])
        if((i+1)*beki_2[ind]<K):
            eachother[i] = ind+1
            i +=1
        # print((i+1)*beki_2[ind],ind,i)
        if(ind == 0):
            i+=1
        ind -= 1


    if(i == N or ind == 0):
        # print(i,N)
        break
sum_each = 0.0

for i in range(len(eachother)):
    sum_each+=beki_2[eachother[0]]/beki_2[eachother[i]]
print((1/N)*sum_each/beki_2[eachother[0]])
# print(eachother)
# (1/N)*()
Problem p03050 (python)

Fixed submission:
N = int(input())
ans = 0
for i in range(1,min(N,1250000)):
    if(((N-i)/i).is_integer() and N//((N-i)/i) == N%((N-i)/i)):
        # print((N-i)//i,i)
        ans += ((N-i)//i)
        # if(i == 800000):
        #     print(ans)
    # print(i)
print(ans)

Buggy submission (verdict: Runtime Error):
N = int(input())
ans = 0
for i in range(1,1250000):
    if(((N-i)/i).is_integer() and N//((N-i)/i) == N%((N-i)/i)):
        # print((N-i)//i,i)
        ans += ((N-i)//i)
        # if(i == 800000):
        #     print(ans)
    # print(i)
print(ans)
Problem p03200 (python)

Fixed submission:
othello = input()
bef = 0
sumall = 0
count = 0

for i in range(len(othello)):
    sumall += i
    if(othello[i] == 'B'):
        bef += i
        count += 1

sumelse = 0
for i in range(len(othello)-count):
    sumelse += i

aft = sumall - sumelse

print(aft - bef)

Buggy submission (verdict: Runtime Error):
othello = input()
bef = 0
sumall = 0
sumelse = 0

for i in range(len(othello)):
    sumall += i
    if(othello[i] == 'B'):
        bef += i
        count += 1

count = 0
for i in range(len(othello)-count):
    sumelse += i

aft = sumall - sumelse

print(aft - bef)
Problem p03379 (python)

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

sortx = sorted(X)
bef = sortx[N//2-1]
aft = sortx[N//2]
for i in X:
        print(aft if i <= bef else bef)

Buggy submission (verdict: Runtime Error):
import copy
N = int(input())
X = list(map(int,input().split()))
length = len(X)
sortx = sorted(X)
bef = sortx[int(length//2)]
aft = sortx[int(length//2)+1]

for i in range(N):
    if(X[i]<=bef):
        print(aft)
    else:
        print(bef)

Buggy submission (verdict: Runtime Error):
import copy
N = int(input())
X = list(map(int,input().split()))
length = len(X)
sortx = sorted(X)
bef = sortx[int(length//2)]
aft = sortx[int(length//2)+1]

for i in range(N):
    if(X[i]<=bef):
        print(bef)
    else:
        print(aft)

Buggy submission (verdict: Runtime Error):
import copy
N = int(input())
X = list(map(int,input().split()))
length = len(X)
sortx = sorted(X)
bef = sortx[int(length/2)]
aft = sortx[int(length/2)+1]

for i in range(N):
    if(X[i]<=bef):
        print(bef)
    else:
        print(aft)

Buggy submission (verdict: Runtime Error):
import copy
N = int(input())
X = list(map(int,input().split()))
length = len(X)
X.sort()
bef = int(length/2)
aft = bef+1
for i in range(N):
    if(i<bef):
        print(X[bef])
    else:
        print(X[aft])
Problem p03695 (python)

Fixed submission:
n = int(input())
rate = list(map(int,input().split()))
ratecolor = 0
free = 0
ratecolor = 0
color = [0]*9
for i in range(n):
    if(rate[i] >= 3200):
        free += 1
    else:
        for j in range(9):
            if(rate[i] < j*400 + 400):
                if(color[j] == 0):
                    color[j] += 1
                    ratecolor += 1
                break
print(ratecolor if ratecolor != 0 else 1,ratecolor+free)

Buggy submission (verdict: Runtime Error):
n = int(input())
rate = list(map(int,input().split()))
ratecolor = 0
free = 0
ratecolor = 0
color = [0]*9
for i in range(n):
        if(rate[i] >= 3200):
            free += 1
            break
    for j in range(9):
        if(rate[i] < j*400 + 400):
            if(color[j] == 0):
                color[j] += 1
                ratecolor += 1
                break

print(ratecolor if ratecolor != 0 else 1,ratecolor+free)

Buggy submission (verdict: Runtime Error):
n = int(input())
rate = list(map(int,input().split()))
ratecolor = 0
free = 0
ratecolor = 0
color = [0]*9
for i in range(n):
    for j in range(13):
        if(rate[i] < j*400 + 400):
            if(rate[i] >= 3200):
                free += 1
                break
            if(color[j] == 0 and rate[i] < 3200):
                color[j] += 1
                ratecolor += 1
                break

print(ratecolor if ratecolor != 0 else 1,ratecolor+free)
Problem p03721 (python)

Fixed submission:
from itertools import chain
N,K = map(int,input().split())
num_bool = [0]*(10**5)
numarray_ind = list()

for i in range(N):
    a,b = map(int,input().split())
    num_bool[a-1] += b
# print(num_bool)
sum_count = 0
k=1
for i in range(10**5):
    sum_count += num_bool[i]
    if(sum_count >= K):
        break
    k+=1
print(k)

Buggy submission (verdict: Runtime Error):
from itertools import chain
N,K = map(int,input().split())
numarray = list()
num_bool = [0]*(10**5)
numarray_ind = list()

for i in range(N):
    a,b = map(int,input().split())
    num_bool[a-1]+=1
    if(num_bool[a-1]>=2):
        numarray[numarray_ind.index(a)][1]+=b
        # print(numarray)    
        
    else:
        numarray.append([a,b])
        numarray_ind.append(a)

        # print(numarray)    
numarray.sort()
sum_c = 0
i= 0
while all:
    sum_c+=numarray[i][1]
    i+=1
    if(sum_c <=K):
        break
    # print(sum_c,i)
# print(numarray)
print(numarray[i-1][0])

Buggy submission (verdict: Runtime Error):
from itertools import chain
N,K = map(int,input().split())
numarray = list()
num_bool = [0]*(10**5)


for i in range(N):
    a,b = map(int,input().split())
    num_bool[a-1]+=1
    if(num_bool[a-1]>=2):
        pos = divmod(    list(chain(*numarray)).index(a), len(numarray[0])
        )
        numarray[pos[0]][1]+=b
        # print(numarray)    
        
    else:
        numarray.append([a,b])
        # print(numarray)    
numarray.sort()
sum_c = 0
i= 0
while all:
    sum_c+=numarray[i][1]
    i+=1
    if(sum_c <=K):
        break
    # print(sum_c,i)
# print(numarray)
print(numarray[i-1][0])
Problem p03817 (python)

Fixed submission:
import math 
x = int(input())
# x = 10**15
xi = math.floor(x/5.5)
# print(xi)
for i in range(xi,10000000000000000000000000000):
    # print(6*i - math.floor(i/2))
    if(x <= 6*i-math.floor(i/2)):
        xa = i
        break

print(xa)

Buggy submission (verdict: Runtime Error):
import math 
x = int(input())
xi = math.floor(x/5.5)
print(xi)
for i in range(xi,100000000000000):
    # print(6*i - math.floor(i/2))
    if(x < 6*i-math.floor(i/2)):
        xa = i
        break

print(xa)

Buggy submission (verdict: Runtime Error):
import math 
x = int(input())
xi = math.floor(x/5.5)
print(xi)
for i in range(xi,100000000000000):
    print(6*i - math.floor(i/2))
    if(x < 6*i-math.floor(i/2)):
        xa = i
        break

print(xa)
Problem p02612 (python)

Fixed submission:
k = int(input())
n  =1000
t  =[]

for i in range(1,11):
	if n*i-k>=0:
		t.append(n*i-k)

print(min(t))

Buggy submission (verdict: Runtime Error):

#include<bits/stdc++.h>
 
using namespace std;
typedef long long int ll;
 
int main() {
	ios::sync_with_stdio(0); 
	cin.tie(0);
 
ll n;
cin>>n;

n=n%1000;
if(n>0)n=1000-n;
cout<<n;


	
}
Problem p02641 (python)

Fixed submission:
x,n = map(int,input().split())
if n==0:
    print(x)
else:
    p = list(map(int,input().split()))
    for i in range(100):
        if x-i not in p:
            print(x-i)
            break
        elif x+i not in p:
            print(x+i)
            break

Buggy submission (verdict: Runtime Error):
x,n = map(int,input().split())
if n ==0:
    print(x)
else:
    p = list(map(int,input().split()))
    l = {}
    for i in range(1,max(p)+1):
        if i not in p:
            l[i] = abs(x-i)

    min_value = min(l.values())
    val_list = list(l.values())
    key_list = list(l.keys())
    print(key_list[val_list.index(min_value)])
Problem p02811 (python)

Fixed submission:
a = list(map(int,input().split()))
x = 500*a[0]
if x >=a[1]:print("Yes")
else:print("No")

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

if(k*500>=x):
	print("Yes")
else:
	print("No")
Problem p03160 (python)

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

dp = [0, abs(h[1]-h[0])]
if n >2:
    for i in range(2,n):
        dp.append(min(abs(h[i]-h[i-2])+dp[-2], abs(h[i]-h[i-1])+dp[-1]))
else:
    print(dp[-1])
    exit()

print(dp[-1])

Buggy submission (verdict: Runtime Error):
inf = 10**9+5
n = int(input())
h = list( map(int,input().split()))

dp = [inf]*n
dp[0] = 0
for i in range(n):
    for j in range(i+1,i+3):
        if j<n:
            dp[j] = min(dp[j],dp[i]+abs(h[i]-h[j]))
            print(dp)
print(dp[-1])

Buggy submission (verdict: Runtime Error):
n = int(input())
x = list(map(int,input().split()))
mod=1e9+7
a = [-1]*(n+1)
def step(i):
    if i>=n-1:
        a[i]=0
        return x[-1]
    if(a[i]!=-1):return x[i]
    a[i] = min(abs(step(i+1)-x[i])%mod+a[i+1]%mod,abs(step(i+2)-x[i])%mod+a[i+2]%mod)%mod;
    return x[i]
c=step(0)
print(int(a[0]%mod))

Buggy submission (verdict: Runtime Error):
n = int(input())
x = list(map(int,input().split()))
mod=1e9+7
a = [-1]*(n+1)
def step(i):
    if i>=n-1:
        a[i]=0
        return x[-1]
    if(a[i]!=-1):return x[i]
    a[i] = min(abs(step(i+1)-x[i])%mod+a[i+1]%mod,abs(step(i+2)-x[i])%mod+a[i+2]%mod)%mod;
    return x[i]
step(0)
print(int(a[0]%mod))

Buggy submission (verdict: Runtime Error):
n = int(input())
x = list(map(int,input().split()))
mod=1e9+7
a = [-1]*(n+1)
def step(i):
    if i>=n-1:
        a[i]=0
        return x[-1]
    if(a[i]!=-1):return x[i]
    a[i] = min(abs(step(i+1)-x[i])+a[i+1],abs(step(i+2)-x[i])+a[i+2])%mod;
    return x[i]
step(0)
print(int(a[0]%mod))

Buggy submission (verdict: Runtime Error):
n = int(input())
x = list(map(int,input().split()))
mod=1e9+7
a = [-1]*(n+1)
def step(i):
    if i>=n-1:
        a[i]=0
        return x[-1]
    if(a[i]!=-1):return x[i]
    a[i] = min(abs(step(i+1)-x[i])+a[i+1],abs(step(i+2)-x[i])+a[i+2])%mod;
    return x[i]
step(0)
print(a[0]%mod)

Buggy submission (verdict: Runtime Error):
n = int(input())
x = list(map(int,input().split()))
a = [-1]*(n+1)
def step(i):
    
    if i>=n-1:
        a[i]=0
        return x[-1]
    if(a[i]!=-1):return x[i]
    a[i] = min(abs(step(i+1)-x[i])+a[i+1],abs(step(i+2)-x[i])+a[i+2])
    return x[i]
step(0)
print(a[0])

Buggy submission (verdict: Runtime Error):
n = int(input())
x =list(map(int,input().split()))
def step(i,cost):
    if i>=(n-1):
        return abs(x[-1]-cost)
    return min(step(i+1,x[i])+abs(cost-x[i]),step(i+2,x[i])+abs(cost-x[i]))
cost = x[0]
print(step(0,cost))

Buggy submission (verdict: Runtime Error):
n = int(input())
x =list(map(int,input().split()))
def step(i,cost):
    if i>=3:
        return abs(x[-1]-cost)
    return min(step(i+1,x[i])+abs(cost-x[i]),step(i+2,x[i])+abs(cost-x[i]))
cost = x[0]
print(step(0,cost))
Problem p03813 (python)

Fixed submission:
x = int(input())
if x<1200:
	print("ABC")
elif x>=1200:
	print("ARC")

Buggy submission (verdict: Runtime Error):
n = int(input)
if n<1200:
  print("ABC")
else:
  print("ARC")

Buggy submission (verdict: Runtime Error):
n = int(input)
if n<1200:
  print("ABC")
 else:
  print("ARC")
Problem p03827 (python)

Fixed submission:
n  =int(input())
s = input()
x = 0
c = 0
x1 = 0
t = []
for i in s:
	if i=='I':
		c+=1
	if c>x:
		x =c
	elif i=='D':
		c-=1
	if c>x1:
		x1=c

	t.append(max(x1,x))
print(max(t))

Buggy submission (verdict: Runtime Error):
n  =int(input())
s = input()
c = 0
t = []
t1 = []
for i in s:
	if i=='I':
		c+=1
		t.append(c)
	elif i=='D':
		c-=1
		t1.append(c)


if (max(max(t),max(t1)))<0:
	print(0)
else:
	print(max(max(t),max(t1)))

Buggy submission (verdict: Runtime Error):
n  =int(input())
s = input()
c = 0
t = []
t1 = []
for i in s:
	if i=='I':
		c+=1
		t.append(c)
	elif i=='D':
		c-=1
		t1.append(c)

print(max(max(t),max(t1)))
Problem p04030 (python)

Fixed submission:
n = input()
s = ''
for i in n:
    if i== '1' or i == '0':
        s+=i
    else:
        if len(s)>0:
            s =s[0:-1]
print(s)

Buggy submission (verdict: Runtime Error):
n = input()
s = " "
for i in n:
    if i == '0':
        s+='0'
    elif i=='1':
        s+='1'
    if i=='B':
        s = s.replace(s[-1],'')

print(s)
Problem p02555 (python)

Fixed submission:
"""
At Coder :: Beginner Contest 178 :: D - Redistribution 
https://atcoder.jp/contests/abc178/tasks/abc178_d
"""


MOD = pow(10, 9) + 7


def solve(S):
    """Solve problem."""
    if S < 3:
        return 0
    A = [1 for _ in range(S+1)]
    A[0] = A[1] = A[2] = 0
    for i in range(3, S+1):
        k = 3
        while i - k >= 0:
            A[i] = A[i-k] + A[i] % MOD
            k += 1
    return A[S]


def main():
    """Main program."""
    import sys
    S = int(sys.stdin.readline())
    print(solve(S))


if __name__ == '__main__':
    main()

Buggy submission (verdict: Runtime Error):
"""
At Coder :: Beginner Contest 178 :: D - Redistribution 
https://atcoder.jp/contests/abc178/tasks/abc178_d
"""


MOD = pow(10, 9) + 7


def solve(S):
    """Solve problem."""
    A = [1 for _ in range(S+1)]
    A[0] = A[1] = A[2] = 0
    for i in range(3, S+1):
        k = 3
        while i - k >= 0:
            A[i] = A[i-k] + A[i] % MOD
            k += 1
    return A[-1]


def main():
    """Main program."""
    import sys
    S = int(sys.stdin.readline())
    print(solve(S))


if __name__ == '__main__':
    main()
Problem p03544 (python)

Fixed submission:
N = int(input())
L0 = 2
L1 = 1
L2 = 1
for i in range(N - 1):
    L2 = L1 + L0
    L0 = L1
    L1 = L2

print(L2)

Buggy submission (verdict: Runtime Error):
N = int(input())
L0 = 2
L1 = 1
for i in range(N - 1):
    L2 = L1 + L0
    L0 = L1
    L1 = L2

print(L2)
Problem p03160 (python)

Fixed submission:
n=int(input())
l=list(map(int,input().split()))
dp=[10**55 for i in range(n)]
dp[0]=0
dp[1]=abs(l[1]-l[0])
for i in range(2,n):
    dp[i] = min(dp[i], dp[i-1] + abs(l[i] - l[i - 1]))
    dp[i] = min(dp[i], dp[i-2] + abs(l[i] - l[i - 2]))
print(dp[n-1])

Buggy submission (verdict: Runtime Error):
#include<bits/stdc++.h>
using namespace std;
int dp[10000001];
int arr[10000001];
int n;
int solve(int ind)
{
	if(ind==n-1)
	{
		return 0;
	}
	if(dp[ind]!=-1)
	{
		return dp[ind];
	}
	int ans=solve(ind+1)+abs(arr[ind+1]-arr[ind]);
	if(ind+2<n)
	{
		ans=min(ans,solve(ind+2)+abs(arr[ind+2]-arr[ind]));
	}
	return dp[ind]=ans;
}
int main() {
#ifndef ONLINE_JUDGE
	freopen("input.txt","r",stdin);
	freopen("output.txt","w",stdout);
#endif
	memset(dp,-1,sizeof(dp));
	cin>>n;
	for(int i=0;i<n;i++)
	{
		cin>>arr[i];
	}
	cout<<solve(0)<<"\n";
	return 0;
}

Buggy submission (verdict: Runtime Error):
n=int(input())
l=[-1 for i in range(10000001)]
dp=[-1 for i in range(10000001)]
def solve(ind):
    if(ind==n-1):
        return 0
    if(dp[ind]!=-1):
        return dp[ind]
    ans=solve(ind+1)+abs(l[ind+1]-l[ind])
    if(ind+2<n):
        ans=min(ans,solve(ind+2)+abs(l[ind+2]-l[ind]))
    dp[ind]=ans
    return dp[ind]
lst=list(map(int,input().split()))
for i in range(n):
    l[i]=lst[i]
print(solve(0))

Buggy submission (verdict: Runtime Error):
n=int(input())
l=list(map(int,input().split()))
dp=[-1 for i in range(10000001)]
def solve(ind):
    if(ind==n-1):
        return 0
    if(dp[ind]!=-1):
        return dp[ind]
    ans=solve(ind+1)+abs(l[ind+1]-l[ind])
    if(ind+2<n):
        ans=min(ans,solve(ind+2)+abs(l[ind+2]-l[ind]))
    dp[ind]=ans
    return dp[ind]
print(solve(0))

Buggy submission (verdict: Runtime Error):
n=int(input())
l=list(map(int,input().split()))
dp=[-1 for i in range(1000000)]
def solve(ind):
    if(ind==n-1):
        return 0
    if(dp[ind]!=-1):
        return dp[ind]
    ans=solve(ind+1)+abs(l[ind+1]-l[ind])
    if(ind+2<n):
        ans=min(ans,solve(ind+2)+abs(l[ind+2]-l[ind]))
    dp[ind]=ans
    return dp[ind]
print(solve(0))

Buggy submission (verdict: Runtime Error):
n=int(input())
l=list(map(int,input().split()))
dp=[-1 for i in range(n)]
def solve(ind):
    if(ind==n-1):
        return 0
    if(dp[ind]!=-1):
        return dp[ind]
    ans=solve(ind+1)+abs(l[ind+1]-l[ind])
    if(ind+2<n):
        ans=min(ans,solve(ind+2)+abs(l[ind+2]-l[ind]))
    dp[ind]=ans
    return dp[ind]
print(solve(0))

Buggy submission (verdict: Runtime Error):
n=int(input())
l=list(map(int,input().split()))
dp=[10**55 for i in range(n)]
dp[0]=0
dp[1]=abs(l[1]-l[0])
for i in range(2,n):
    dp[i] = min(dp[i], dp[i-1] + abs(l[i] - l[i - 1]))
    dp[i] = min(dp[i], dp[i-2] + abs(l[i] - l[i - 2]))
    print(dp)
print(dp[n-1])

Buggy submission (verdict: Runtime Error):
n=int(input())
l=list(map(int,input().split()))
dp=[10**55 for i in range(n)]
dp[0]=0
dp[1]=abs(l[1]-l[0])
for i in range(n):
    dp[i] = min(dp[i], dp[i-1] + abs(l[i] - l[i - 1]))
    dp[i] = min(dp[i], dp[i-2] + abs(l[i] - l[i - 2]))
    print(dp)
print(dp[n-1])
Problem p02640 (python)

Fixed submission:
x,y=map(int,input().split())
z=0
 
for i in range(0,x+1):
    if i*2+(x-i)*4 == y:
        z=1

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

Buggy submission (verdict: Runtime Error):
x,y=map(int,input().split())
z=0
 
for i in range(x):
    if i*2+(x-i)*4!==y:
        z=z
    else:
        z=1
 
if z==1:
    print("Yes")
else:
    print("No")
Problem p02657 (python)

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

Buggy submission (verdict: Runtime Error):
a,b=map(int,input().supkit())
print(a*b)
Problem p03220 (python)

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

k=0
m=100000000000000
for i in range(1,n+1):
    b=a-t+h[i-1]*0.006
    if m>abs(b):
        m=abs(b)
        k=i


print(k)

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

k=0
m=100000000000000
for i in range(1,n+1):
    b=a-t+h[i]*0.006
    if m>abs(b):
        m=abs(b)
        k=i


print(k)
Problem p03285 (python)

Fixed submission:
n=int(input())


a=0
for i in range(0,n):
    for j in range(0,n):
        if 4*i+7*j==n:
            a+=1


if a==0:
    print("No")
else:
    print("Yes")

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


a=0
for i in　range(0,26):
    for j in range(0,20):
        if 4*i+7*j==n:
            a+=1


if a==0:
    print("N0")
else:
    print("Yes")
Problem p03308 (python)

Fixed submission:
n=int(input())

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

max=0
for i in range(n):
    for j in range(n):
        if i!=j:
            x=int(a[i]-a[j])
            if x<0:
                x *=-1
                if max<=x:
                    max=x


print(max)

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

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

max=0
for i in range(n):
    for j in range(n):
        if i!=j:
            abs=abs(a[i]-a[j])
            if max<=abs:
                max=abs


print(max)