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

Fixed submission:
'''A - White Cells
https://atcoder.jp/contests/abc121/tasks/abc121_a

>>> main([3, 2], [2, 1])
1
>>> main([5, 5], [2, 3])
6
>>> main([2, 4], [2, 4])
0'''


def main(amount, portion):
    print((amount[0] - portion[0]) * (amount[1] - portion[1]))


if __name__ == "__main__":
    amount = list(map(int, input().split(' ')))
    portion = list(map(int, input().split(' ')))

    main(amount, portion)

Buggy submission (verdict: Runtime Error):
'''A - White Cells
https://atcoder.jp/contests/abc121/tasks/abc121_a

>>> main([3, 2], [2, 1])
1
>>> main([5, 5], [2, 3])
6
>>> main([2, 4], [2, 4])
0'''


def main(amount, portion):
    print((amount[0] - portion[0]) * (amount[1] - portion[1]))


if __name__ == "__main__":
    amount = map(int, input().split(' '))
    portion = map(int, input().split(' '))

    main(amount, portion)
Problem p03110 (python)

Fixed submission:
def main(n, x_u):
    ans = 0
    btc = 380000.0

    for x, u in x_u:
        if u == 'JPY':
            ans += int(x)
        else:
            ans += float(x) * btc

    print(ans)


if __name__ == "__main__":
    n = int(input())
    x_u = [input().split() for _ in range(n)]

    main(n, x_u)

Buggy submission (verdict: Runtime Error):
def main(n, x_u):
    ans = 0
    btc = 380000.0

    for x, u in x_u:
        if u == 'JPY':
            ans += x
        else:
            ans += x * btc

    print(ans)


if __name__ == "__main__":
    n = int(input())
    x_u = [list(map(int, input().split())) for _ in range(n)]

    main(n, x_u)
Problem p03129 (python)

Fixed submission:
def main(N, K):
    if K * 2 - 1 <= N:
        return 'YES'
    else:
        return 'NO'


if __name__ == '__main__':
    N, K = map(int, input().split(' '))
    print(main(N, K))

Buggy submission (verdict: Runtime Error):
def main(N, K):
    if N - 1 >= K:
        return 'YES'
    else:
        return 'NO'


if __name__ == '__main__':
    N, K = map(int, input().split(' '))
    print(main())
Problem p03192 (python)

Fixed submission:
def main(n):
    print(str(n).count('2'))


if __name__ == '__main__':
    n = int(input())
    main(n)

Buggy submission (verdict: Runtime Error):
def main(n):
    print(str(n).count('2'))


if __name__ == '__main__':
    n = int(input())
    main()
Problem p03220 (python)

Fixed submission:
def main(n, t, a, h):
    def formula(t, x): return t - x * 0.006
    res = []

    for _h in h:
        res.append(abs(a - formula(t, _h)))

    print(res.index(min(res)) + 1)


if __name__ == "__main__":
    n = int(input())
    t, a = map(int, input().split(' '))
    h = list(map(int, input().split(' ')))

    main(n, t, a, h)

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

input_str = input().split()
temp = int(input_str[0])
goal = int(input_str[1])

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

avg_temp = [(temp - (Hn * 0.006)) / goal for Hn in Hn]

if goal >= 0:
    print(int((avg_temp.index(max(avg_temp))) + 1))
else:
    print(int((avg_temp.index(min(avg_temp))) + 1))

Buggy submission (verdict: Runtime Error):
input_str = input().split("\n")
number = int(input_str[0])

temp = int(input_str[1].split()[0])
goal = int(input_str[1].split()[1])

Hn = list(map(int, input_str[2].split()))

avg_temp = [(temp - (Hn * 0.006)) / goal for Hn in Hn]

if goal >= 0:
    print(int((avg_temp.index(max(avg_temp))) + 1))
else:
    print(int((avg_temp.index(min(avg_temp))) + 1))

Buggy submission (verdict: Runtime Error):
# avg_temp = temp - x * 0.006

input_str = input().split("\n")
# a = [int(x) for x in a]
number = int(input_str[0])

temp = int(input_str[1].split()[0])
goal = int(input_str[1].split()[1])

Hn = list(map(int, input_str[2].split()))

avg_temp = [(temp - (Hn * 0.006)) / goal for Hn in Hn]

if goal >= 0:
    print(int((avg_temp.index(max(avg_temp))) + 1))
else:
    print(int((avg_temp.index(min(avg_temp))) + 1))

Buggy submission (verdict: Runtime Error):
# avg_temp = temp - x * 0.006

input_str = input().split("\n")
# a = [int(x) for x in a]
number = int(input_str[0])

temp = int(input_str[1].split()[0])
goal = int(input_str[1].split()[1])

Hn = list(map(int, input_str[2].split()))

avg_temp = [(temp - (Hn * 0.006)) for Hn in Hn]

print(int((avg_temp.index(max(avg_temp))) + 1))

Buggy submission (verdict: Runtime Error):
input_str = input().split("\n")
number = int(input_str[0])

temp = int(input_str[1].split()[0])
goal = int(input_str[1].split()[1])

Hn = list(map(int, input_str[2].split()))

avg_temp = [int(temp - (Hn * 0.006)) for Hn in Hn]

print(int((avg_temp.index(max(avg_temp)))+1))

Buggy submission (verdict: Runtime Error):
input_str = input().split("\n")
number = int(input_str[0])

temp = int(input_str[1].split()[0])
goal = int(input_str[1].split()[1])

Hn = list(map(int, input_str[2].split()))

avg_temp = [int(temp - (Hn * 0.006)) for Hn in Hn]

print(int((avg_temp.index(max(avg_temp)))+1))
Problem p03227 (python)

Fixed submission:
s = input()

if s.__len__() == 3:
    print(s[::-1])
else:
    print(s)

Buggy submission (verdict: Runtime Error):
input_str = str(input()).split()
a, b, k = int(input_str[0]), int(input_str[1]), int(input_str[2])

self = a
partner = b

for i in range(k):
    if self % 2 == 1:
        self += -1

    partner += int(self / 2)
    self = int(self / 2)

    self, partner = partner, self
    i -= 1

if i % 2 == 1:
    a = partner
    b = self
else:
    b = partner
    a = self

print(a, b)
Problem p03281 (python)

Fixed submission:
def main(n):
    ans = 0

    for i in range(1, n + 1):
        if i % 2 == 0:
            continue

        l = 0
        for j in range(1, i + 1):

            if i % j == 0:
                l += 1

        if l == 8:
            ans += 1

    print(ans)


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

    main(n)

Buggy submission (verdict: Runtime Error):
from math import sqrt
from itertools import combinations


def main(n, d, x):
    ans = 0
    for a, b in combinations(x, 2):
        r = 0
        for c, d in zip(a, b):
            r += abs(c - d)**2

        if sqrt(r).is_integer():
            ans += 1

    print(ans)


if __name__ == '__main__':
    n, d = map(int, input().split())
    x = [list(map(int, input().split())) for _ in range(n)]

    main(n, d, x)
Problem p03282 (python)

Fixed submission:
def main(s: str, k: int):
    for i in range(k):
        if s[i] != "1":
            print(s[i])
            return

    print(1)


if __name__ == "__main__":
    s = input()
    k = int(input())

    main(s, k)

Buggy submission (verdict: Runtime Error):
def main(s, k):
    for s in s:
        if s != '1':
            print(s)
            return


if __name__ == "__main__":
    s = int(input())
    k = int(input())

    main(s, k)
Problem p03294 (python)

Fixed submission:
def main(n, a):
    ans = 0

    for i in a:
        ans += i - 1

    print(ans)


if __name__ == "__main__":
    n = int(input())
    a = list(map(int, input().split()))

    main(n, a)

Buggy submission (verdict: Runtime Error):
def main(n, a):
    ans = 0

    for i in a:
        ans += i - 1

    print(ans)


if __name__ == "__main__":
    n = int(input())
    a = lis(map(int, input().split()))

    main(n, a)

Buggy submission (verdict: Runtime Error):
def main(n, a):
    ans = 0

    for i in a:
        ans += i - 1

    print(ans)


if __name__ == "__main__":
    n = int(input())
    a = [int(input()) for _ in range(n)]

    main(n, a)
Problem p03296 (python)

Fixed submission:
def main(n: int, a: list):
    prev = [0, 0]
    ans = 0

    for _a in a:
        if _a == prev[0]:
            if prev[1] % 2 == 0:
                ans += 1

            prev[1] += 1
        else:
            prev = [_a, 0]

    print(ans)


if __name__ == '__main__':
    n = int(input())
    a = map(int, input().split())

    main(n, a)

Buggy submission (verdict: Runtime Error):
def main(n: int, a: list):
    prev = [0, 0]
    ans = 0

    for _a in a:
        if _a == prev[0]:
            if prev[1] % 2 == 0:
                ans += 1

            prev[1] += 1
        else:
            prev = [_a, 0]

    print(ans)


if __name__ == '__main__':
    n = int(input())
    a = map(int(input().split()))

    main(n, a)
Problem p03308 (python)

Fixed submission:
from itertools import permutations


def main(n, a):
    ans = 0
    for i, j in permutations(a, 2):
        ans = max(ans, i - j)

    print(ans)


if __name__ == "__main__":
    n = int(input())
    a = list(map(int, input().split()))

    main(n, a)

Buggy submission (verdict: Runtime Error):
def main(n, a):
    ans = 0
    for i, j in permutations(a, 2):
        ans = max(ans, i - j)

    print(ans)


if __name__ == "__main__":
    n = int(input())
    a = list(map(int, input().split()))

    main(n, a)
Problem p03323 (python)

Fixed submission:
#!/usr/bin/env python3
import sys


def solve(A: int, B: int):
    if A % 2 != 0 or B % 2 != 0:
        if A > 8 or B > 8:
            print(':(')
            return

    print('Yay!')
    return


def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    A = int(next(tokens))  # type: int
    B = int(next(tokens))  # type: int
    solve(A, B)


if __name__ == '__main__':
    main()

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

if b - a == c - b:
    print('YES')
else:
    print('NO')
Problem p03337 (python)

Fixed submission:
def main(a, b):
    add = a + b
    sub = a - b
    mul = a * b

    return max(add, sub, mul)


if __name__ == "__main__":
    a, b = map(int, input().split(' '))
    print(main(a, b))

Buggy submission (verdict: Runtime Error):
def main(a, b):
    add = a + b
    sub = a - b
    mul = a * b

    return max(add, sub, mul)


if __name__ == "__main__":
    a, b = input().split(' ')
    print(main(a, b))
Problem p03359 (python)

Fixed submission:
def main(a, b):
    if b < a:
        return a-1
    else:
        return a


if __name__ == '__main__':
    a, b = map(int, input().split(' '))
    print(main(a, b))

Buggy submission (verdict: Runtime Error):
def main(a, b):
    days = a * 30 + b

    count = 0
    for i in range(1, min(a, b) + 1):
        if isinstance(int, (days // i * 30 + b)):
            count += 1

    return count

if __name__ == '__main__':
    print(main(map(int, input().split(' '))))
Problem p03378 (python)

Fixed submission:
"""B - Toll Gates
https://atcoder.jp/contests/abc094/tasks/abc094_b
N M X
A_1 A_2 ... A_M

>>> main(5, 3, 3, [1, 2, 4])
1
>>> main(7, 3, 2, [4, 5, 6])
0
>>> main(10, 7, 5, [1, 2, 3, 4, 6, 8, 9])
3
"""


def main(n, m, x, a):
    line = [0 for _ in range(n)]

    for a in a:
        line[a - 1] = 1

    to_left = sum(line[x - 1:])
    to_right = sum(line[x - 1::-1])

    print(min(to_left, to_right))


if __name__ == '__main__':
    n, m, x = map(int, input().split())
    a = list(map(int, input().split()))

    main(n, m, x, a)

Buggy submission (verdict: Runtime Error):
def main(n, m, x, a):
    line = [0 for _ in range(n)]

    for a in a:
        line[a - 1] = 1

    to_left = sum(line[x - 1:])
    to_right = sum(line[x - 1::-1])

    print(min(to_left, to_right))


if __name__ == '__main__':
    n, m, x = map(int, input().split())
    a = list(input().split())

    main(n, m, x, a)
Problem p03399 (python)

Fixed submission:
def main(A: int, B: int, C: int, D: int):
    train, bus = 0, 0
    if A <= B:
        train += A
    else:
        train += B

    if C <= D:
        bus += C
    else:
        bus += D

    return train + bus


if __name__ == '__main__':
    A = int(input())
    B = int(input())
    C = int(input())
    D = int(input())
    print(main(A, B, C, D))

Buggy submission (verdict: Runtime Error):
def main(A: int, B: int, C: int, D: int):
    train, bus = 0, 0
    if A <= B:
        train += A
    else:
        train += B

    if C <= D:
        bus += C
    else:
        bus += D

    return train + bus


if __name__ == '__main__':
    A, B, C, D = map(int, input().split(' '))
    print(main(A, B, C, D))
Problem p03408 (python)

Fixed submission:
def main(n, s: list, m, t: list):
    choices = set(s + t)

    ans = [0]

    for choice in choices:
        ans_t = 0
        for _s in s:
            if choice == _s:
                ans_t += 1
        for _t in t:
            if choice == _t:
                ans_t -= 1

        ans.append(ans_t)

    print(max(ans))


if __name__ == "__main__":
    n = int(input())
    s = [input() for _ in range(n)]
    m = int(input())
    t = [input() for _ in range(m)]

    main(n, s, m, t)

Buggy submission (verdict: Runtime Error):
def main(n, s: list, m, t: list):
    choices = set(s + t)

    ans = [0]

    for choice in choices:
        ans_t = 0
        for _s in s:
            if choice == _s:
                ans_t += 1
        for _t in t:
            if choice == _t:
                ans_t -= 1

        ans.append(ans_t)

    print(max(ans))


if __name__ == "__main__":
    n = int(input())
    s = [input() for _ in range(n)]
    m = int(input())
    t = [input() for _ in range(n)]

    main(n, s, m, t)
Problem p03424 (python)

Fixed submission:
def main(n, s):
    a = set(s)

    if len(a) == 3:
        print('Three')
    elif len(a) == 4:
        print('Four')


if __name__ == "__main__":
    n = int(input())
    s = list(input().split())

    main(n, s)

Buggy submission (verdict: Runtime Error):
def main(n, s):
    a = set(s)

    if len(a) == 3:
        print('Three')
    elif len(a) == 4:
        print('Four')


if __name__ == "__main__":
    n = int(input())
    s = list(map(int, input().split()))

    main(n, s)
Problem p03523 (python)

Fixed submission:
import re


def main(s: str):
    if re.fullmatch(r"A?KIHA?BA?RA?", s):
        print("YES")
    else:
        print("NO")


if __name__ == "__main__":
    s = input()

    main(s)

Buggy submission (verdict: Runtime Error):
def main(s: str):
    if re.fullmatch(r"A?KIHA?BA?RA?", s):
        print("YES")
    else:
        print("NO")


if __name__ == "__main__":
    s = input()

    main(s)
Problem p03845 (python)

Fixed submission:
def main(n, t, m, p_x):
    for p, x in p_x:
        _t = t.copy()
        _t[p - 1] = x

        print(sum(_t))


if __name__ == "__main__":
    n = int(input())
    t = list(map(int, input().split()))
    m = int(input())
    p_x = [list(map(int, input().split()))
    for _ in range(m)]

    main(n, t, m, p_x)

Buggy submission (verdict: Runtime Error):
def main(n, t, m, p_x):
    for p, x in p_x:
        _t = t.copy()
        _t[p - 1] = x

        print(sum(_t))


if __name__ == "__main__":
    n = int(input())
    t = list(map(int, input().split()))
    m = int(input())
    p_x = [int(input()) for _ in range(m)]

    main(n, t, m, p_x)
Problem p03943 (python)

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

if a + b == c:
    print('Yes')

elif a + c == b:
    print('Yes')

elif b + c == a:
    print('Yes')

else:
    print('No')

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

if a + b == c:
    print('Yes')
    return
elif a + c == b:
    print('Yes')
    return
elif b + c == a:
    print('Yes')
    return
else:
    print('No')
    return
Problem p03957 (python)

Fixed submission:
import re

s = input()

if re.match(r'.*C.*F', s):
    print('Yes')
else:
    print('No')

Buggy submission (verdict: Runtime Error):
import re

s = input()

if re.match(r'C.*F', s):
    print(YES)
else:
    print(NO)

Buggy submission (verdict: Runtime Error):
import re


if re.match(r'C.*F', s):
    print(YES)
else:
    print(NO)

Buggy submission (verdict: Runtime Error):
if re.match(r'C.*F', s):
    print(YES)
else:
    print(NO)
Problem p02583 (python)

Fixed submission:
n=int(input())
arr=list(map(int,input().split()))
dummy=len(arr)
ans=0
if dummy>2:
    for i in range(dummy-2):
        for j in range(i+1,dummy-1):
            for k in range(j+1,dummy):
                if arr[i]!=arr[j] and arr[j]!=arr[k] and arr[k]!=arr[i]:
                    if arr[i]<arr[j]+arr[k] and arr[j]<arr[k]+arr[i] and arr[k]<arr[j]+arr[i]:
                        ans+=1
    print(ans)
else:
    print(0)

Buggy submission (verdict: Runtime Error):
n=int(input())
arr=list(map(int,input().split()))
dummy=len(arr)
ans=0
if dummy>2:
  for i in range(dummy-2):
      for j in range(i+1,dummy-1):
          for k in range(j+1,dummy):
              if arr[i]!=arr[j] and arr[j]!=arr[k] and arr[k]!=arr[i]:
                  if arr[i]<arr[j]+arr[k] and arr[j]<arr[k]+arr[i] and arr[k]<arr[j]+arr[i]:
                      ans+=1
	print(ans)
else:
  print(0)
Problem p02583 (python)

Fixed submission:
N = int(input())
L= list(map(int, input().split()))
Ls = list(set(L))
res=[]
for i in range(len(Ls)):
  for j in range(i+1,len(Ls)):
    for k in range(j+1,len(Ls)):
      tmp=[Ls[i],Ls[j],Ls[k]]
      if sum(tmp) > 2*max(tmp):
        res.append(tmp)
        
c=0
for i in range(len(res)):
  ctmp=L.count(res[i][0])*L.count(res[i][1])*L.count(res[i][2])
  c+=ctmp
print(c)

Buggy submission (verdict: Runtime Error):
N = int(input())
Ls= list(map(int, input().split()))
count=0
for i in range(len(N)):
  for j in range(i,len(N)):
    for k in range(j,len(N)):
      tmp=[Ls[i],Ls[j],Ls[k]]
      if sum(tmp) < 2 * max(tmp):
        count+=1

print(count)
Problem p04043 (python)

Fixed submission:
L=input().split()
A,B,C=int(L[0]),int(L[1]),int(L[2])
X=[5,7]
ans = []
for i in range(len(X)):
    ans.append([A,B,C].count(X[i]))
if ans == [2,1]:
  print("YES")
else:
  print("NO")

Buggy submission (verdict: Runtime Error):
L=input().split()
A,B,C=int(L[0]),int(L[1]),int(L[2])
X=set([5,7])
ans = []
for i in range(len(X)):
    ans.append([A,B,C].count(X[i]))
if ans == [2,1]:
  print("YES")
else:
  print("NO")
Problem p02608 (python)

Fixed submission:
N=int(input())
ans=[0]*(N+1)
to=int((N)**(1/2))+2
for x in range(1,to):
    for y in range(1,to):
        for z in range(1,to):
            temp=x*x+y*y+z*z+x*y+y*z+z*x
            if temp<=N:
                ans[temp]+=1
for i in range(1,N+1):
    print(ans[i])

Buggy submission (verdict: Runtime Error):
N=int(input())
ans=[0]*(N+1)
for i in range(N):
    if i*i>N:
        to=i+1
        break
for x in range(1,to):
    for y in range(1,to):
        for z in range(1,to):
            temp=x*x+y*y+z*z+x*y+y*z+z*x
            if temp<N:
                ans[temp]+=1
for i in range(1,N+1):
    print(ans[i])
Problem p02609 (python)

Fixed submission:
def popcount(n):
    ans=0
    for i in range(20):
        if n>>i & 1:
            ans+=1
    return ans

N=int(input())
X=input()
n=0

for i in range(N):
    if X[i]=='1':
        n+=1
np1=0
nm1=0
temp1=1
temp2=1
nm=n-1
if nm==0:
    nm=1
for i in range(N-1,-1,-1):
    if X[i]=='1':
        np1=(np1+temp1)%(n+1)
        nm1=(nm1+temp2)%nm
    temp1=(temp1*2)%(n+1)
    temp2=(temp2*2)%nm
    
for i in range(N):
    ans=1
    if X[i]=='1':
        if n==1:
            print(0)
            continue
        temp=(nm1-pow(2,(N-1-i),n-1))%(n-1)
        while temp>0:
            pop_n=popcount(temp)
            temp=temp%pop_n
            ans+=1
    elif X[i]=='0':
        temp=(np1+pow(2,(N-1-i),n+1))%(n+1)
        while temp>0:
            pop_n=popcount(temp)
            temp=temp%pop_n
            ans+=1
    print(ans)

Buggy submission (verdict: Runtime Error):
def popcount(n):
    ans=0
    for i in range(20):
        if n>>i & 1:
            ans+=1
    return ans

N=int(input())
X=input()
n=0

for i in range(N):
    if X[i]=='1':
        n+=1
np1=0
nm1=0
temp1=1
temp2=1
for i in range(N-1,-1,-1):
    if X[i]=='1':
        np1=(np1+temp1)%(n+1)
        nm1=(nm1+temp2)%(n-1)
    temp1=(temp1*2)%(n+1)
    temp2=(temp2*2)%(n-1)
    
for i in range(N):
    ans=1
    if X[i]=='1':
        temp=(nm1-pow(2,(N-1-i),n-1))%(n-1)
        while temp>0:
            pop_n=popcount(temp)
            temp=temp%pop_n
            ans+=1
    elif X[i]=='0':
        temp=(np1+pow(2,(N-1-i),n+1))%(n+1)
        while temp>0:
            pop_n=popcount(temp)
            temp=temp%pop_n
            ans+=1
    print(ans)
Problem p02662 (python)

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

def f(N,S,A):
    MOD=998244353
    dp=[0]*(S+1)
    dp[0]=pow(2,N,MOD)
    div=pow(2,MOD-2,MOD)
    m=0
    for a in A:
        m+=a
        for i in range(min(m,S),a-1,-1):
            dp[i]=(dp[i]+dp[i-a]*div)%MOD
    return dp[S]

print(f(N,S,A))

Buggy submission (verdict: Runtime Error):
import sys
sys.setrecursionlimit(5000)
MOD=998244353
def dfs(d,tot,num):
    global A,N,S,how
    if tot==S:
        how[num]+=1
        return
    if d==N:
        return
    if d>0 and A[d]==A[d-1]:
    if tot+A[d]<=S:
        dfs(d+1,tot+A[d],num+1)
        dfs(d+1,tot,num)
        
    

N,S=map(int,input().split())
A=list(map(int,input().split()))
A.sort(reverse=True)
how=[0]*(N+1)
dfs(0,0,0)
cur=1
res=0
for i in range(N,0,-1):
    res+=(how[i]*cur)%MOD
    cur=cur*2%MOD
print(res)

Buggy submission (verdict: Runtime Error):
def dfs(d,tot,num):
    global A,N,S,how
    if tot==S:
        how[num]+=1
        return
    if d==N:
        return
    if tot+A[d]<=S:
        dfs(d+1,tot+A[d],num+1)
    dfs(d+1,tot,num)
        
    

N,S=map(int,input().split())
A=list(map(int,input().split()))
A.sort(reverse=True)
how=[0]*(N+1)
dfs(0,0,0)
cur=1
res=0
for i in range(N,0,-1):
    res+=how[i]*cur
    cur*=2
print(res)
Problem p03160 (python)

Fixed submission:
def solve(N,h):
    dp=[0]*N
    dp[1]=abs(h[1]-h[0])
    for i in range(2,N):
        dp[i]=min(dp[i-1]+abs(h[i]-h[i-1]),dp[i-2]+abs(h[i]-h[i-2]))
    return dp[N-1]

N=int(input())
h=list(map(int,input().split()))
print(solve(N,h))

Buggy submission (verdict: Runtime Error):
def solve(N,W,wv):
    dp=[-1]*(W+1)
    dp[0]=0
    for i in range(N):
        cur_w=wv[i][0]
        cur_v=wv[i][1]
        for j in range(W-cur_w,-1,-1):
            if dp[j]>=0:
                dp[j+cur_w]=max(dp[j+cur_w],dp[j]+cur_v)
    return max(dp)


N,W=map(int,input().split())
wv=tuple(tuple(map(int,input().split())) for _ in range(N))
print(solve(N,W,wv))
Problem p02584 (python)

Fixed submission:
X,K,D = map(int,input().split())
ans = 0
if X<0:
  X = (-1)*X
  
if X-K*D >=0:
  ans = X-K*D
else:
  Y = int(X/D)
  Z = X%D
  if (K-Y)%2==0:
    ans = Z
  if (K-Y)%2==1:
    ans = D-Z
print(ans)

Buggy submission (verdict: Runtime Error):
X,K,D = map(int,input().split())
ans = 0
if X<0:
  X = (-1)*X
  
if X-K*D >=0:
  ans = X-K*D
else:
  Y = int(X/D)
  z = X%D
  if (K-Y)%2=0:
    ans = Z
  if (K-Y)%2=1:
    ans = D-Z
if ans<0:
  ans = (-1)*ans
print(ans)
Problem p02681 (python)

Fixed submission:
S = input()
T = input()
judge = 0
for i in range(len(S)):
  if S[i] != T[i]:
    judge = 1
    break
if judge == 1:
  print("No")
else:
  print("Yes")

Buggy submission (verdict: Runtime Error):
S = input()
T = input()
judge = 0
for i in range(len(S)):
  if S[i] !== T[i]:
    judge = 1
    break
if judge == 1:
  print("No")
else:
  print("Yes")
Problem p03416 (python)

Fixed submission:
A,B = map(int,input().split())
count = 0
for i in range(A,B+1):
  if str(i)[0] == str(i)[4] and str(i)[1] == str(i)[3]:
    count += 1
print(count)

Buggy submission (verdict: Runtime Error):
A,B = int(input().split())
count = 0
for i in range(A,B+1):
  if str(i)[0] == str(i)[4] and str(i)[1] == str(i)[3]:
    count += 1
print(count)