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

Fixed submission:
X,t=map(int,input().split())
print(max(X-t,0))

Buggy submission (verdict: Runtime Error):
X,t=map(int,input().split())
print(max(X-t,0)

Buggy submission (verdict: Runtime Error):
X,t=map(int,input().split())
print(max(X-t, 0)

Buggy submission (verdict: Runtime Error):
n = input().split(" ")
print(int(n[0])-int(n[t])
Problem p03369 (python)

Fixed submission:
check = 700
s = input()
for t in s:
  if t == 'o':
    check += 100

print(check)

Buggy submission (verdict: Runtime Error):
s = input()
n, x = map(int, s.sprit())
a = []
total = 0
for i in range(n):
  b = int( input() )
  a.append(b)
  total += b

x-=b
ans  = n
ans += x / n

print(ans)
Problem p03415 (python)

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

Buggy submission (verdict: Runtime Error):
n, k = list(map(int, input().split()))
                                                                                                                           
result = 0
for q in range(k, n):
  for b in range(q+1, n+1):
    result += int((n-q)/b)+1 if q > 0 else int((n-q)/b)

print(result)
Problem p03505 (python)

Fixed submission:
# coding:utf-8

K, A, B = map(int, raw_input().split())
if K <=A:
    print 1

elif A <= B:
    print -1
else:
    x = (K-B-1)/(A-B)+1
    print 2*x-1

Buggy submission (verdict: Runtime Error):
# coding:utf-8

K, A, B = map(int, raw_input().split())
n=0

if A <= B:
    print '-1'
else:
    for i in range(K+1):
        if (A*(n+2)-B*(n+1))>K and (A*(n+1)-B*n)<K:
            print 2*n+3
        n+=1
Problem p03555 (python)

Fixed submission:
# -*- coding: utf-8 -*-

C1=raw_input()
C2=raw_input()

if C1[0]!=C2[2]:
    print 'NO'
elif C1[1]!=C2[1]:
    print 'NO'
elif C1[2]!=C2[0]:
    print 'NO'
else:
    print 'YES'

Buggy submission (verdict: Runtime Error):
# -*- coding: utf-8 -*-
import itertools

N = input()

A = map(int, raw_input().split())
B = map(int, raw_input().split())
C = map(int, raw_input().split())


for i, j, k in itertools.product(range(N), range(N), range(N)):
    if A[i]<B[j]<C[k]:
            count+=1
    else:
        continue
print count

Buggy submission (verdict: Runtime Error):
# -*- coding: utf-8 -*-

C1=raw_input()
C2=raw_input()

if C1[0]==C2[2] and C1[1]==C2[1] and C1[2]==C2[0]:
    print 'YES'
else:
    print 'NO
Problem p03556 (python)

Fixed submission:
# -*- coding: utf-8 -*-
import numpy as np
import math

N = input()

sq = np.sqrt(N)
s = int(math.floor(sq))
print s*s

Buggy submission (verdict: Runtime Error):
# -*- coding: utf-8 -*-

N = input()

for i in range(N):
    if i*i > N:
        print (i-1)*(i-1)
        break
else:
    pass
Problem p03647 (python)

Fixed submission:
# -*- coding: utf-8 -*-

N, M = map(int, raw_input().split())
a = []
for i in xrange(M):
    a.append(map(int, raw_input().split()))

s1=set()
s2=set()
for i in xrange(M):
    if a[i][0]==1:
        s1.add(a[i][1])
    if a[i][1]==N:
        s2.add(a[i][0])
if s1 & s2:
    print 'POSSIBLE'
else:
    print 'IMPOSSIBLE'

Buggy submission (verdict: Runtime Error):
# -*- coding: utf-8 -*-

N, M = map(int, raw_input().split())
a = []
for i in xrange(M):
    a.append(map(int, raw_input().split()))

s1=set()
s2=set()
for i in xrange(M):
    if a[i][0]==1:
        s1.add(a[i][1])
    if a[i][1]==N:
        s2.add(a[i][0])
if s1 & s2:
    print 'POSSIBLE'
else:
    print 'IMPOSSIBLE'

else:
 print 'IMPOSSIBLE'
Problem p03399 (python)

Fixed submission:
x = []
count = 0

while count<4:
  n = input()
  x.append(n)
  count = count + 1

out = min(int(x[0]),int(x[1]))+min(int(x[2]),int(x[3]))

print(out)

Buggy submission (verdict: Runtime Error):
x = input().split()

print(min(x[0], x[1])+min(x[2],x[3]))
Problem p03377 (python)

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

if (A <= X) and (X <= A+B):
  res = "YES"
else:
  res = "NO"

print(res)

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


mid_dis = [abs(a[n-1] / 2 - a[i]) for i in range(n-1)]
arg_max_i = [i for i in range(n-1) if mid_dis[i] == min(mid_dis)][0]

print(a[n-1], a[arg_max_i])
Problem p03380 (python)

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

import bisect

arg_max_i = bisect.bisect_left(a, a[n-1] // 2)

if abs(a[n-1] / 2 - a[arg_max_i]) > abs(a[n-1] / 2 - a[arg_max_i-1]):
  arg_max_i -= 1
if arg_max_i == n-1:
  arg_max_i -= 1

print(a[n-1], a[arg_max_i])

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

import math
def comb(n,r):
  return math.factorial(n) / (math.factorial(r) * math.factorial(n-r))
  
max_comb = [comb(i, i // 2) for i in range(n-1)]

mid_dis = [abs(a[n-1] / 2 - a[i]) for i in range(n-1)]
arg_max_i = [i for i in range(n-1) if mid_dis[i] == min(mid_dis)][0]

print(a[n-1], a[arg_max_i])

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

import math
def comb(n,r):
  return math.factorial(n) / (math.factorial(r) * math.factorial(n-r))
  
max_comb = [comb(i, i // 2) for i in range(n-1)]

mid_dis = [abs(a[n-1] / 2 - a[i]) for i in range(n-1)]
arg_max_i = [i for i in range(n-1) if mid_dis[i] == min(mid_dis)][0]

print(a[n-1], a[arg_max_i])
Problem p03427 (python)

Fixed submission:
#encoding=utf-8
def solve(n):
    ans_a = calc_digit_sum(n)
    ans_b = calc_digit_sum(n - n % 10 - 1)
    ans_c = calc_digit_sum(10 ** (len(str(n)) - 1) - 1 + 10 ** (len(str(n)) - 1) * (int(str(n)[0]) - 1) )
    return max(ans_a, ans_b, ans_c)

def calc_digit_sum(n):
    if n <= 0:
        return 0
    str_n = str(n)
    ans = 0
    for x in range(len(str_n)):
        ans = ans + int(str_n[x])
    return ans

if __name__ == "__main__":
    n = int(input())
    print(solve(n))

Buggy submission (verdict: Runtime Error):
#encoding=utf-8
def solve(n):
    k = len(n)
    c = str(n)[k - 1]
    if str(n)[1..k] = '9' * k:
        return c + 9 * (k - 1)
    return c + 9 * (k - 1)  - 1

if __name__ == "__main__":
    n = int(input())
    print(solve(n))

Buggy submission (verdict: Runtime Error):
#encoding=utf-8
def solve(n):
    k = len(n)
    c = str(n)[k - 1]
    if str(n)[1..k] = '9' * k:
        return c + 9 * (k - 1)
    return c + 9 * (k - 1)  - 1

if __name__ == "__main__":
    n = int(input())
    print(solve(n))

Buggy submission (verdict: Runtime Error):
#encoding=utf-8
def solve(n):
    ans_a = calc_digit_sum(n)
    ans_b = calc_digit_sum(n - n % 10 - 1)
    ans_c = calc_digit_sum(10 ** (len(str(n)) - 1) - 1 + 10 ** (len(str(n)) - 1) * (int(str(n)[0]) - 1) )
    return max(ans_a, ans_b, ans_c)

def calc_digit_sum(n):
    str_n = str(n)
    ans = 0
    for x in range(len(str_n)):
        ans = ans + int(str_n[x])
    return ans

if __name__ == "__main__":
    n = int(input())
    print(solve(n))
Problem p03813 (python)

Fixed submission:
x = int(input())
ans = 'ABC' if x<1200 else 'ARC'
print(ans)

Buggy submission (verdict: Runtime Error):
x = int(iput())
ans = 'ABC' if x<1300 else 'ARC'
print(ans)
Problem p03814 (python)

Fixed submission:
"""
一番左のaの位置と一番右のzの位置だけわかればよい
"""
s = input()
a = s.index('A')
z = len(s)-s[::-1].index('Z')
print(z-a)

Buggy submission (verdict: Runtime Error):
s = int(input())
tmp = 0
for idx, n in enumerate(s):
	if n=='A': 
		for idxx, nn in enumerate(s[-1:idx:-1]):
			if nn=='Z':
				tmp = max((len(s)-idxx)-idx, tmp)
		
print(tmp)
Problem p03829 (python)

Fixed submission:
#listつけわすれ
n, a, b = map(int, input().split())
townpos = list(map(int, input().split()))
step = townpos[0]
tsukare = 0
for x in townpos[1:]:
    tsukare += min((x-step)*a, b)
    step=x
print(tsukare)

Buggy submission (verdict: Runtime Error):
n, a, b = map(int, input().split())
townpos = map(int, input().split())
step = townpos[0]
tsukare = 0
for x in townpos[1:]:
    tsukare += min((x-step)*a, b)
    step=x
print(tsukare)
Problem p04043 (python)

Fixed submission:
f = map(int, input().split())
f = sorted(f)
if f==[5, 5, 7]:
  print('YES')
else:
  print('NO')

Buggy submission (verdict: Runtime Error):
f = map(int, input().split())
f = sorted(f)
if f==[5, 5, 7]:
Problem p04044 (python)

Fixed submission:
n, l = map(int, input().split())
s = [input()  for _ in range(n)]
print(''.join(sorted(s)))

Buggy submission (verdict: Runtime Error):
#pythonだとsortでそのまま何文字でもソートしてくれる
n, l = map(int, input().split())
s = [input()  for _ in range(n)]]
print(''.join(sorted(s)))
Problem p04045 (python)

Fixed submission:
n, k = map(int, input().split())
dislikes = list(map(int, input().split()))
m = n
while True:
    m = list(str(m))
    l = []
    for p in m:
        if int(p) not in dislikes:
            l.append(p)
            continue
        else:
            m = int(''.join(m))+1
            break
    if len(l) >= len(str(n)):
        if int(''.join(l))>=n:
            break
print(''.join(m))

Buggy submission (verdict: Runtime Error):
n, k = map(int, input().split())
dislikes = list(map(int, input().split())
m = n
while True:
    m = list(str(m))
    l = []
    for p in m:
        if int(p) not in dislikes:
            l.append(p)
            continue
        else:
            m = int(''.join(m))+1
            break
    if len(l) >= len(str(n)):
        if int(''.join(l))>=n:
            break
print(''.join(m))
Problem p03455 (python)

Fixed submission:
a, b = map(int, input().split())
 
if (a * b) % 2 == 0:
    print("Even")
elif (a * b) % 2 != 0:
    print("Odd")

Buggy submission (verdict: Runtime Error):
a,b = map(int,input().split()) 
c=
 
if (a*b)%2==0:
  print("even")
else:
  print("odd")

Buggy submission (verdict: Runtime Error):
a,b=map(int,input().split())
 
c=a*b
 
if(c20==0) print("even")
else print("odd")

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

c=a*b

if(c%0==0) print("even")
else print("odd")
Problem p03493 (python)

Fixed submission:
inp = input()
print(inp.count("1"))

Buggy submission (verdict: Runtime Error):
N,X = map(int,input().split())
mi=[int(input()) for _ in range(N)]
  
print(N+(X-sum(mi))//min(mi))

Buggy submission (verdict: Runtime Error):
inp = map(str,input())

print(inp.count(1))

Buggy submission (verdict: Runtime Error):
% input ex."101"
masu = input()

i=0
out=0
while i< len(masu):
  out+=masu[i]
print(out)
Problem p03494 (python)

Fixed submission:
#3
#8 12 40
n=int(input())
ai=list(map(int,input().split()))
b=[]
for a in ai:
  count =0
  while a%2==0 :
    count+=1
    a/=2
  b.append(count)
print(min(b))

Buggy submission (verdict: Runtime Error):
#3
#8 12 40
n=int(input())
ai=list(map(int(),input.split()))
b=[]
for a in ai:
  count =0
  while a%2==0 :
    count+=1
    a/=2
  b.append(count)
print(min(b))

Buggy submission (verdict: Runtime Error):
#3
#8 12 40
n=int(input())
ai=list(map(int(),input().split()))
b=[]
for a in ai:
  count =0
  while a%2==0 :
    count+=1
    a/=2
  b.append(count)
print(min(b))

Buggy submission (verdict: Runtime Error):
#3
#8 12 40
n=int(input())
ai=list(map(int(),input.split()))
b=[]
for a in ai:
  count =0
  while a%2==0 :
    count+=1
    a/=2
  b.append(count)
print(min(b))

Buggy submission (verdict: Runtime Error):
#3
#8
n=int(input())
ai=list(map(int(),input.split()))
        
for a in ai:
  count =0
  while a%2==0 :
    count+=1
    a/=2
  b.append(count)
print(min(b))

Buggy submission (verdict: Runtime Error):
#3
#8 12 40
n=int(input())
ai=list(map(int(),input.split()))
        
for a in ai:
  count =0
  while a%2==0 :
    count+=1
    a/=2
    b.append(count)
print(min(b))
Problem p03644 (python)

Fixed submission:
N=int(input())
a=[]
for b in range(1,N+1,1):
  count=0
  while b%2 == 0:
    count+=1
    b/=2
  a.append(count)

print(a.index(max(a))+1)

Buggy submission (verdict: Runtime Error):
N=int(input())
a=[]
for n in range(1,N,1):
  count=0
  while n%2 == 0:
    count+=1
    n/=2
  a.append(count)

Nmax=a.index(max(a))+1
Tmax=max(a)
Problem p03377 (python)

Fixed submission:
# -*- coding: utf-8 -*-
# スペース区切りの整数の入力
A,B,X = map(int, input().split())

if A + B >= X and A <= X:
    print('YES')
else:
    print('NO')

Buggy submission (verdict: Runtime Error):
# -*- coding: utf-8 -*-
import copy
# スペース区切りの整数の入力
N = int(input())
X = list(map(int, input().split()))
md = int(N/2)
d = {}
for x in X:
    if x in d:
        d[x] += 1
    else:
        d[x] = 1

for i in range(N):
    d_cp = copy.deepcopy(d)
    d_cp[X[i]] += -1
    sum_w = 0
    cum = []
    for i, key in enumerate(d_cp):
        sum_w += d_cp[key]
        cum.append([i,key,sum_w])
    for i,key,c in cum:
        if c >= md:
            print(key)
            break

Buggy submission (verdict: Runtime Error):
# -*- coding: utf-8 -*-
import copy
# スペース区切りの整数の入力
N = int(input())
X = list(map(int, input().split()))
md = int(N/2)
d = {}
for x in X:
    if x in d:
        d[x] += 1
    else:
        d[x] = 1

for i in range(N):
    d_cp = copy.deepcopy(d)
    d_cp[X[i]] += -1 
    sum_w = 0
    cum = []
    for i, key in enumerate(d_cp):
        sum_w += d_cp[key]
        cum.append([i,key,sum_w])
    for i,key,c in cum:
        if c >= md:
            print(key)
            break
Problem p03423 (python)

Fixed submission:
N = input()
m = int(int(N)/3)
print(m)

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

#### 入力フェーズ開始 ####
HWD = input().split()
H = int(HWD[0])
W = int(HWD[1])
D = int(HWD[2])

A = []
for i in range(H):
    Ai = []
    Ai_raw = input().split()
    for j in range(W):
        Ai.append(int(Ai_raw[j]))
    A.extend(Ai)

Q = int(input())
L = []
R = []
for i in range(Q):
    LRi_raw = input().split()
    L.append(int(LRi_raw[0]))
    R.append(int(LRi_raw[1]))

#### 入力フェーズここまで ####
#### 計算フェーズここから ####

# 各移動で踏むA_ijとそのx,yの値にindexベースで参照できるように
# A_ijの値でindexをソートしておく
x_ = np.arange(W)
x = np.tile(x_, H)
y_ = np.arange(H)
y = np.repeat(y_, W)
# A_ijの値でsortした時のindexの順番を取得
B = np.argsort(A)

for q in range(Q):
    # 各実技試験につき
    score = 0
    Li = L[q]
    Ri = R[q]
    M = int((Ri - Li) / D) # 何回移動が必要か
    m_vec = [Li + D * m for m in range(M+1)] # 通るA_ijの値

    for m in range(M):
        # 各移動につき
        id_from = B[m_vec[m] - 1]
        id_to = B[m_vec[m+1]- 1]
        score += np.abs(x[id_from] - x[id_to]) + np.abs(y[id_from] - y[id_to])

    print(score)

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

return int( N / 3 )

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

return int( N / 3 )

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

def groupMaker(N):
    if N < 0 or N > 100:
        print('invalid input')
        return -1
    m = N / 3
    return int(m)

return groupMaker(N)
Problem p03543 (python)

Fixed submission:
a = list(input())
if ((a[0] == a[1]) and (a[1] == a[2])) or ((a[1] == a[2]) and (a[2] == a[3])):
	print("Yes")
else:
	print("No")

Buggy submission (verdict: Runtime Error):
a = [int(i) for i in list(input())]
enzan = ['+', '+', '+']
res = 0
for i in range(2):
	if i == 0:
		enzan[0] = '+'
		b = a[0] + a[1]
	else:
		enzan[0] = '-'
		b = a[0] - a[1]
	for j in range(2):
		if j == 0:
			enzan[1] = '+'
			c = b + a[2]
		else:
			enzan[1] = '-'
			c = b - a[2]
		for k in range(2):
			if k == 0:
				enzan[2] = '+'
				d = c + a[3]
			else:
				enzan[2] = '-'
				d = b - a[3]
			if d1 == 7:
				print(str(a[0])+enzan[0]+str(a[1])+enzan[1]+str(a[2])+enzan[2]+str(a[3])+'=7')

Buggy submission (verdict: Runtime Error):
N = int(input())
res = [0 for i in range(1000)]
res[1] = 2
res[2] = 1
def lucas(N):
	for i in range(3, N+1):
		res[i] = res[i - 1] + res[i - 2]
	return res[N]

print(lucas(N+1))

Buggy submission (verdict: Runtime Error):
N = int(input())
res = [0 for i in range(100000)]
def lucas(N):
	if N == 0:
		return 2
	elif N == 1:
		return 1
	elif res[N] != 0:
		return res[N]
	return lucas(N-1) + lucas(N-2)

print(lucas(N))
Problem p03455 (python)

Fixed submission:
nyuu=input()
(a,b)=nyuu.split()
a=int(a)
b=int(b)
c=a*b
if c%2==1:
    print("Odd")
else :
    print("Even")

Buggy submission (verdict: Runtime Error):
nyuu=input()
(a,b)=nyuu,split()
a=int(a)
b=int(b)
c=a*b
if c%2==0:
    print("Odd")
else :
    print("Even")
Problem p03373 (python)

Fixed submission:
A, B, C, X, Y = map(int, raw_input().split())

strat1 = A*X + B*Y  # simple strategy
strat2 = 2*C*X + abs(Y-X)*B  # more A, add back B
strat3 = 2*C*Y + abs(X-Y)*A  # more B, add back A
strat4 = 2*C*max(X,Y) # overbuy C

print min(strat1, strat2, strat3, strat4)

Buggy submission (verdict: Runtime Error):
import sys

A, B, C, X, Y = sys.argv[1], sys.argv[2], sys.argv[3], sys.argv[4], sys.argv[5]
A = int(A)
B = int(B)
C = int(C)
X = int(X)
Y = int(Y)

strat1 = A*X + B*Y  # simple strategy
strat2 = 2*C*X + abs(Y-X)*B  # more A, add back B
strat3 = 2*C*Y + abs(X-Y)*A  # more B, add back A
strat4 = 2*C*max(X,Y) # overbuy C

print min(strat1, strat2, strat3, strat4)

Buggy submission (verdict: Runtime Error):
import sys

A, B, C, X, Y = sys.argv[1], sys.argv[2], sys.argv[3], sys.argv[4], sys.argv[5]
A = int(A)
B = int(B)
C = int(C)
X = int(X)
Y = int(Y)

strat1 = A*X + B*Y  # simple strategy
strat2 = 2*C*X + abs(Y-X)+B  # more A, add back B
strat3 = 2*C*Y + abs(X-Y)*A  # more B, add back A
strat4 = 2*C*max(X,Y) # overbuy C

print min(strat1, strat2, strat3, strat4)

Buggy submission (verdict: Runtime Error):
import sys

A, B, C, X, Y = sys.argv[1], sys.argv[2], sys.argv[3], sys.argv[4], sys.argv[5]
A = int(A)                                                                                                         │chou@HEROZnoMacBook-Pro:~$ pyhton test.py 1 2 3 4 5
B = int(B)                                                                                                         │-bash: pyhton: command not found
C = int(C)                                                                                                         │chou@HEROZnoMacBook-Pro:~$ python test.py 1 2 3 4 5
X = int(X)                                                                                                         │1 2 3 4 5
Y = int(Y)                                                                                                         │chou@HEROZnoMacBook-Pro:~$ python test.py 1500 2000 1900 3 2


strat1 = A*X + B*Y  # simple strategy
strat2 = 2*C*X + abs(Y-X)+B  # more A, add back B
strat3 = 2*C*Y + abs(X-Y)*A  # more B, add back A
strat4 = 2*C*max(X,Y) # overbuy C

print min(strat1, strat2, strat3, strat4)

Buggy submission (verdict: Runtime Error):
import sys

A, B, C, X, Y = sys.argv[1], sys.argv[2], sys.argv[3], sys.argv[4], sys.argv[5]

strat1 = A*X + B*Y  # simple strategy
strat2 = 2*C*X + abs(Y-X)+B  # more A, add back B
strat3 = 2*C*Y + abs(X-Y)*A  # more B, add back A
strat4 = 2*C*max(X,Y) # overbuy C

print min(strat1, strat2, strat3, strat4)
Problem p03415 (python)

Fixed submission:
print(input()[0]+input()[1]+input()[2])

Buggy submission (verdict: Runtime Error):
print(input()[0]+input([1]+input()[2]))
Problem p03994 (python)

Fixed submission:
s = raw_input()
K = int(raw_input())
_s, _K = s[:], K
a = "abcdefghijklmnopqrstuvwxyz"
ai = a.index("a")
zi = a.index("z") 
si = [zi - a.index(c) + 1 if c != "a" else 0  for c in s]

for i, (c, ci) in enumerate(zip(s, si)):
    if K == 0:
        break
    if c == "a":
        continue
    if ci <= K:
        s = s[0:i] + "a" + s[i+1:]
        K = K - ci

K = K % len(a)
if K > 0:
    s = s[:-1] + a[a.index(s[-1]) + K]

print(s)

Buggy submission (verdict: Runtime Error):
s = raw_input()
K = int(raw_input())
_s, _K = s[:], K
a = "abcdefghijklmnopqrstuvwxyz"
ai = a.index("a")
zi = a.index("z") 
si = [zi - a.index(c) + 1 if c != "a" else 0  for c in s]

def rotation_alphabet(s,i):
    return

for i, (c, ci) in enumerate(zip(s, si)):
    if K == 0:
        break
    if c == "a":
        continue
    if ci <= K:
        s = s[0:i] + "a" + s[i+1:]
        K = K - ci

if K > 0:
    s = s[:-1] + a[a.index(s[-1]) + K]

print(s)
Problem p03732 (python)

Fixed submission:
from collections import defaultdict
N,W = map(int, input().split())
wv = [list(map(int,input().split())) for _ in range(N)]

dp = defaultdict(int)
dp[0] = 0
for w, v in wv:
    dp_cur = list(dp.items())
    for w_cur, v_cur in dp_cur:
        if w_cur+w <= W:
            dp[w_cur+w] = max(dp[w_cur+w],v_cur+v)

print(max(dp.values()))

Buggy submission (verdict: Runtime Error):
N,W = map(int, input().split())
weight=[]
values=[]
for idx in range(N):
    w, v = map(int, input().split())
    weight.append(w)
    values.append(v)
dp=[[0]*(W+1) for i in range(N+1)]

for i in range(N):
    for j in range(W):
        if weight[i]<=j+1:
            dp[i+1][j+1] = max(dp[i][j+1-weight[i]]+values[i],dp[i][j+1])
        else:
            dp[i+1][j+1] = dp[i][j+1]

print(dp[N][W])
Problem p03377 (python)

Fixed submission:
input_str = input()
input_list = input_str.split(' ')
a = int(input_list[0])
b = int(input_list[1])
x = int(input_list[2])
if a <= x:
    if x <= a + b:
        print('YES')
    else:
        print('NO')
else:
    print('NO')

Buggy submission (verdict: Runtime Error):
input_str = input()
input_list = input_str.split(' ')
a = input_list[0]
b = input_list[1]
c = input_list[2]
if a <= x:
    if x <= a + b:
        print('YES')
    else:
        print('NO')
else:
    print('NO')
Problem p03377 (python)

Fixed submission:
a, b, x = map(int, input().split())
 
n = x - a
 
if n >= 0 and b >=  n:
    print('YES')
else:
    print('NO')

Buggy submission (verdict: Runtime Error):
    N = [int(i) for i in input().split()]
     
    if N[0] + N[1] >= N[2] and N[0] <= N[2]:
        print('YES')
    else:
        print('NO')

Buggy submission (verdict: Runtime Error):
    a, b, x = map(int, input().split())
     
    if a <= x <= a + b:
        print("YES")
    else:
        print("NO")

Buggy submission (verdict: Runtime Error):
    X=int(input())
    A=int(input())
    B=int(input())
    
    
    0<=B<=100
    if 0<=A<=100 and 0<=B<=100 and A<=X<=A+B;
    print("Yes")
    else;
    print("No")

Buggy submission (verdict: Runtime Error):
X=int(input())
0<=A<=100
0<=B<=100
if A<=X<=A+B;
print("Yes")
else;
print("No")
Problem p03385 (python)

Fixed submission:
s = input()
r = 0

for c in s:
    if c == 'a':
        r += 1
    if c == 'b':
        r += 2
    if c == 'c':
        r += 4

if r == 7:
    print('Yes')
else:
    print('No')

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

for c in s:
    if c == 'a':
        r = 1
    if c == 'b':
        r = 2
    if c == 'c':
        r = 4

if r = 7:
    print('Yes')
else:
    print('No')
Problem p03401 (python)

Fixed submission:
n, = map(int, input().split())
a = list(map(int, input().split()))
a.append(0)
m = []

i = 0
j = a[0]
s = abs(a[0])
for x in range(1, n+1):
    k = a[x]
    s += abs(j-k)
    if i<=j<=k or k<=j<=i:
        m.append(0)
    else:
        ij = abs(i-j)
        jk = abs(j-k)
        if ij<jk:
            m.append(-2*ij)
        else:
            m.append(-2*jk)
    i = j
    j = k
for x in m:
    print(s+x)

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

h = a[0]
i = a[1]
s = h + abs(h-i)
if i < h:
    ans.append(-1 * abs(h-i))
else:
    ans.append(0)
for x in range(2, n+1):
    j = a[x]
    s += abs(i-j)
    if j < i:
        ans.append(-1 * abs(i-j))
    else:
        ans.append(0)
    h = i
    i = j

for x in ans:
    print(s+x)

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

h = a[0]
i = a[1]
s = h + abs(h-i)
if i < h:
    ans[0] = -1 * abs(h-i)
else:
    ans[0] = 0
for x in range(2, n+1):
    j = a[x]
    s += abs(i-j)
    if j < i:
        ans[x] = -1 * abs(i-j)
    else:
        ans[x] = 0
    h = i
    i = j

for x in ans:
    print(s+x)