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

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

a_len = len(a)
b_len = len(b)

huku = []

for i in range(a_len):
    if a_len != b_len and i==a_len-1:
        huku.append(a[i])
        break
    else:
        huku.append(a[i])
        huku.append(b[i])
for i in range(len(huku)):
    print(huku[i],end="")

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

a_len = len(a)
b_len = len(b)

huku = []

for i in range(a_len):
    if a_len != b_len & i==a_len:
        break
    else:
        huku.append(a[i])
        huku.append(b[i])
for i in range(len(huku)):
    print(huku[i],end="")
Problem p02858 (python)

Fixed submission:
from fractions import gcd

mod = 10 ** 9 + 7
n, m, t = map(int, input().split())
a = gcd(n, t)
b = gcd(m, t)
n //= a
m //= b
ret = pow(2, n, mod) + pow(2, m, mod) + pow(2, gcd(n, m), mod) - 3
print(pow(ret, a * b, mod))

Buggy submission (verdict: Runtime Error):
from math import gcd
mod = 10 ** 9 + 7
n, m, t = map(int, input().split())
a = gcd(n, t)
b = gcd(m, t)
n //= a
m //= b
ret = pow(2, n, mod) + pow(2, m, mod) + pow(2, gcd(n, m), mod) - 3
print(pow(ret, a * b, mod))
Problem p03200 (python)

Fixed submission:
s = input()
n = len(s)
sum = [0] * (n + 1)
sum[0] = (s[0] == 'B')
for i in range(1 , n):
	sum[i] = sum[i-1] + (s[i] == 'B')
ans = 0
for i in range(n - 1, -1 ,-1):
	if s[i] == 'W':
		ans += sum[i]
print(ans)

Buggy submission (verdict: Runtime Error):
s = input()
n = len(s)
sum = [0] * (n + 1)
sum[0] = (s[0] == 'B')
for i in range(1 , n):
	sum[i] = sum[i-1] + (s[i] == 'B')
ans = 0
for i in range(n, -1 ,-1):
	if s[i] == 'W':
		ans += sum[i]
print(ans)

Buggy submission (verdict: Runtime Error):
s = input()
n = len(s)
sum = [0] * (n + 1)
sum[0] = (s[0] == 'B')
for i in range(1 , n):
	sum[i] = sum[i-1] + (s[i] == 'B')
ans = 0
for i in range(n, -1 ,-1):
	print(i)
	if s[i] == 'W':
		ans += sum[i]
print(ans)
Problem p02748 (python)

Fixed submission:
A, B, M = map(int,input().split())
a = list(map(int,input().split()))
b = list(map(int,input().split()))
price1 = min(a) + min(b)

for _ in range(M):
  x, y, c = map(int,input().split())
  price2 = a[x-1] + b[y-1] - c
  if price1 > price2:
    price1 = price2
print(price1)

Buggy submission (verdict: Runtime Error):
A, B, M = map(int,input().split())
a = list(map(int,input().split()))
b = list(map(int,input().split()))
price1 = min(a) + min(b)

for _ in range(M):
  x, y, c = map(int,input().split())
  price2 = a[x-1] + a[y-1] - c
  if price1 > price2:
    price1 = price2
print(price1)
Problem p02848 (python)

Fixed submission:
N = int(input())
S = input()
alphabet = 'ZABCDEFGHIJKLMNOPQRSTUVWXY'
alphabet_num = {st: num for num, st in enumerate(alphabet)}
alphabet_list = [st for st in alphabet]

output = ''
for s in S:
  num = (alphabet_num[s] + N) % 26
  output += alphabet_list[num]
print(output)

Buggy submission (verdict: Runtime Error):
N = int(input())
S = input()
alphabet = 'ZABCDEFGHIJKLMNOPQRSTUVWXY'
alphabet_num = {st: num for num, st in enumerate(alphabet)}
alphabet_list = [st for st in alphabet]

for s in S:
  num = (alphabet_num[s] + N) % 26
  print(alphabet_list[num], end+'')
Problem p02600 (python)

Fixed submission:
x = int(input())
for i in range(2,10):
  if 200*i <= x < 200*(i+1):
    print(10-i)

Buggy submission (verdict: Runtime Error):
x = input(int())
for i in range(2, 10):
  if 200*i <= x < 200*(i+1)-1:
    pprint(10-i)
Problem p02602 (python)

Fixed submission:
n, k = map(int, input().split())
a = list(map(int, input().split()))
for i in range(n-k):
    ab = a[i]
    aa = a[k+i]
    if aa > ab:
        print("Yes")
    else:
        print("No")

Buggy submission (verdict: Runtime Error):
n, k = int(input().split())
a = list(map(int, input().split()))
for i in range(n-k-1):
    ab = a[i]*a[k-1+i]
    aa = a[i+1]*a[k+i]
    if aa > ab:
        print("Yes")
    else:
        print("No")
Problem p03482 (python)

Fixed submission:
s=raw_input()
k=len(s)/2+1
lef=(len(s)-1)/2
ch=s[lef]
rig=(len(s))/2
while 0<=lef and rig<len(s):
    if s[lef]==s[rig] and ch==s[lef]:
        k+=1
        lef-=1
        rig+=1
    else:
        k-=1
        break
print(k-(lef==-1))

Buggy submission (verdict: Runtime Error):
s=raw_input()
k=len(s)/2+1
lef=(len(s)-1)/2
ch=s[lef]
rig=(len(s))/2
while 0<=lef and rig<len(s):
    if s[lef]==s[rig] and ch==s[lef]:
        lef-=1
        rig+=1
        k+=1
    else:
        k-=1
        break
print(k)
Problem p03552 (python)

Fixed submission:
n,z,w=map(int,input().split())
a=list(map(int,input().split()))
print(max(abs(a[-2]-a[-1]),abs(a[-1]-w)) if n>=2 else abs(a[-1]-w))

Buggy submission (verdict: Runtime Error):
n,z,w=map(int,input().split())
a=list(map(int,input().split()))
cand1=abs(a[-1]-a[-2])
cand2=abs(a[-1]-w)
res=max(cand1,cand2)
print(res)

Buggy submission (verdict: Runtime Error):
n,z,w=map(int,input().split())
a=list(map(int,input().split()))
cand1=abs(a[-1]-a[-2])
cand2=abs(a[-1]-w)
res=max(cand1,cand2)
print(res)
Problem p03651 (python)

Fixed submission:
def gcd(a,b):
    if a==0: return b
    else: return gcd(b%a,a)

def main():
    n,k=map(int,input().split(" "))
    a=list(map(int,input().split(" ")))
    g=a[0]
    m=a[0]
    for e in a:
        g=gcd(g,e)
        if m<e: m=e
    if k % g==0 and k<=m:
        print("POSSIBLE")
    else:
        print("IMPOSSIBLE")

main()

Buggy submission (verdict: Runtime Error):
def main():
    import math
    n,k=map(int,input().split(" "))
    a=map(int,input().split(" "))
    g=a[0]
    m=max(a)
    for i in range(n):
        g=math.gcd(g,a[i])
    if k % g==0 and k<=m:
        print("POSSIBLE")
    else:
        print("IMPOSSIBLE")

main()

Buggy submission (verdict: Runtime Error):

def main():
    import math
    n,k=map(int,input().split(" "))
    a=list(map(int,input().split(" ")))
    g=a[0]
    m=max(a)
    for i in range(n):
        g=math.gcd(g,a[i])
    if k % g==0 and k<=m:
        print("POSSIBLE")
    else:
        print("IMPOSSIBLE")

main()

Buggy submission (verdict: Runtime Error):
import math
n,k=map(int,input().split(" "))
a=list(map(int,input().split(" ")))
g=a[0]
m=max(a)
for i in range(n):
    g=math.gcd(g,a[i])
if k % g==0 and k<=m:
    print("POSSIBLE")
else:
    print("IMPOSSIBLE")

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

g=a[0]
m=a[0]
for i in range(n):
    g=math.gcd(g,a[i])
    m=max(a[i],m)

if k % g==0 and k<=m:
    print("POSSIBLE")
else:
    print("IMPOSSIBLE")
Problem p04011 (python)

Fixed submission:
n=input()
k=input()
x=input()
y=input()
if n>k:
    n-=k
else:
    k=n
    n=0
print(k*x+n*y)

Buggy submission (verdict: Runtime Error):
n=input()
k=input()
x=input()
y=input()
if n>k:
    n-=k
else:
    k=n
    n=0
print(k*x+n*y)
Problem p02789 (python)

Fixed submission:
def iln(): return list(map(int, input().split()))


def solve(N, M):
  print("Yes" if N == M else "No")
  
  
N, M = iln()
solve(N, M)

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

def find_lcm(denominators):
    return reduce(lambda a,b: a*b // gcd(a,b), denominators)

def solve(nums):
    modula = 10**9 + 7
    lcm = find_lcm(nums)

    bs = []
    for n in nums:
        bs.append((lcm // n) % modula)

    print(sum(bs) % modula)

    
def iin(): return int(input())
def iln(): return list(map(int, input().split()))


N = iin()
nums = iln()
solve(nums)
Problem p03160 (python)

Fixed submission:

def solve(N, heights):
  dp = [float('inf')] * N
  dp[0] = 0
  for i in range(N - 1):
    dp[i + 1] = min(dp[i + 1], dp[i] + abs(heights[i] - heights[i + 1]))
    if i + 2 < N:
      dp[i + 2] = min(dp[i + 2], dp[i] + abs(heights[i] - heights[i + 2]))

  print(dp[N-1])

def iin(): return int(input())
def iln(): return list(map(int, input().split()))

solve(iin(), iln())

Buggy submission (verdict: Runtime Error):
def solve(N, W, weight_values):
  dp = [[0 for _ in range(W + 1)] for _ in range(N + 1)]
  dp[0][0] = 1

  for i in range(N + 1):
    i_weight, i_value = weight_values[i - 1]
    for w in range(i_weight, W + 1):
      dp[i][w] = max(dp[i - 1][w - i_weight] + i_value, dp[i - 1][w])

  print(dp[N][W])

  
def iln(): return list(map(int, input().split()))


N, W = iln()
w_v = []
for i in range(N):
  w_v = iln()
  
solve(N, W, w_v)
Problem p03163 (python)

Fixed submission:
def solve(N, W, weight_values):
  dp = [0 for _ in range(W + 1)]

  for i in range(N):
    i_weight, i_value = weight_values[i]
    for w in range(W, i_weight - 1, -1):
      # dp[w] = max(dp[w - i_weight] + i_value, dp[w])
      temp = dp[w - i_weight] + i_value
      if temp > dp[w]:
        dp[w] = temp

  print(dp[W])

  
def iln(): return list(map(int, input().split()))


N, W = iln()
w_v = []
for i in range(N):
  w_v.append(iln())
  
solve(N, W, w_v)

Buggy submission (verdict: Runtime Error):
def solve(N, W, weight_values):
  dp = [[0 for _ in range(W + 1)] for _ in range(N + 1)]
  dp[0][0] = 1

  for i in range(N + 1):
    i_weight, i_value = weight_values[i - 1]
    for w in range(i_weight, W + 1):
      dp[i][w] = max(dp[i - 1][w - i_weight] + i_value, dp[i - 1][w])

  print(dp[N][W])

  
def iln(): return list(map(int, input().split()))


N, W = iln()
w_v = []
for i in range(N):
  w_v = iln()
  
solve(N, W, w_v)

Buggy submission (verdict: Runtime Error):
def solve(N, W, weight_values):
  dp = [[0 for _ in range(W + 1)] for _ in range(N + 1)]
  dp[0][0] = 1

  for i in range(N + 1):
    i_weight, i_value = weight_values[i - 1]
    for w in range(i_weight, W + 1):
      dp[i][w] = max(dp[i - 1][w - i_weight] + i_value, dp[i - 1][w])

  print(dp[N][W])

N, W = iln()
w_v = []
for i in range(N):
  w_v = iln()
  
solve(N, W, w_v)
Problem p02607 (python)

Fixed submission:
N = int(input())
masu=[int(x) for x in input().split(" ")]
c=0
for i in range(0,N,2):
	if masu[i]%2 !=0: c += 1
print(c)

Buggy submission (verdict: Runtime Error):
N = int(input())
masu=[int(x) for x in input().split(" ")]
c=0
for i in range(0,N,2)
	if masu[i]%2 !=0:
    	c+=1
print(c)
Problem p02640 (python)

Fixed submission:
a,b=[int(x) for x in input().split(" ")]
x=(b-2*a)/2
y=(4*a-b)/2
print("Yes" if x>=0 and y>=0 and x%1==0.0 and y%1==0.0 else "No")

Buggy submission (verdict: Runtime Error):
a,b=[int(x) for x in input().split(" ")]
x=(b-2a)/2
y=(4a-b)/2
print("Yes" if x>0 and y>0 and x%1==0.0 and y%1==0.0 else "No")
Problem p02841 (python)

Fixed submission:
a, b = [int(x) for x in input().split(" ")]
c, d = [int(x) for x in input().split(" ")]
print(0 if a == c else 1)

Buggy submission (verdict: Runtime Error):
N = int(input())
l = 100; r = 105
for i in range(5000):
    if l <= N <= r:
        print(1)
        break
    l += 100
    r += 105
print(0)
Problem p03067 (python)

Fixed submission:
A, B, C=map(int,input().split(' '))
if((A-C)*(B-C)<0):
  print('Yes')
else:
  print('No')

Buggy submission (verdict: Runtime Error):
A, B, C=map(int,input().split(' '))
if(A<C ans C<B):
  print('Yes')
else:
  print('No')
Problem p03130 (python)

Fixed submission:
vec = [0 for _ in range(4)]
for i in range(3):
    a,b = list(map(int,input().split()))
    a-=1
    b-=1
    vec[a]+=1
    vec[b]+=1

cnt = 0
for x in vec:
    if x%2==1:
        cnt+=1

if cnt >2:
    print('NO')
else:
    print('YES')

Buggy submission (verdict: Runtime Error):
vec = [0 for _ in range(3)]
for i in range(3):
    a,b = list(map(int,input().split()))
    a-=1
    b-=1
    vec[a]+=1
    vec[b]+=1

cnt = 0
for x in vec:
    if x%2==1:
        cnt+=1

if cnt >2:
    print('NO')
else:
    print('YES')
Problem p03157 (python)

Fixed submission:
import sys
sys.setrecursionlimit(1000000)

move=((1,0),(0,1),(-1,0),(0,-1))

#深さ優先探索
def dfs(used,mat,node,nums):
    y,x=node
    color=mat[y][x]
    if used[y][x]==1 or color=='!':
        return
    
    used[y][x]=1
    nums[color]+=1
    for i,j in move:
        if mat[y+i][x+j]!=color and mat[y+i][x+j] != '!':
            dfs(used,mat,(y+i,x+j),nums)


H,W=list(map(int,input().split()))

grid=['!'*(W+2)]
used=[[0 for _ in range(W+2)] for _ in range(H+2)]

for i in range(H):
    grid.append('!'+input()+'!')
grid.append('!'*(W+2))

ans=0
for i in range(H+2):
    for j in range(W+2):
        nums={'#':0,'.':0}
        dfs(used,grid,(i,j),nums)
        ans+=nums['#']*nums['.']
print(ans)

Buggy submission (verdict: Runtime Error):
move=((1,0),(0,1),(-1,0),(0,-1))

#深さ優先探索
def dfs(used,mat,node,nums):
    y,x=node
    color=mat[y][x]
    if used[y][x]==1 or color=='!':
        return
    
    used[y][x]=1
    nums[color]+=1
    for i,j in move:
        if mat[y+i][x+j]!=color and mat[y+i][x+j] != '!':
            dfs(used,mat,(y+i,x+j),nums)


H,W=list(map(int,input().split()))

grid=['!'*(W+2)]
used=[[0 for _ in range(W+2)] for _ in range(H+2)]

for i in range(H):
    grid.append('!'+input()+'!')
grid.append('!'*(W+2))

ans=0
for i in range(H+2):
    for j in range(W+2):
        nums={'#':0,'.':0}
        dfs(used,grid,(i,j),nums)
        ans+=nums['#']*nums['.']
print(ans)
Problem p03219 (python)

Fixed submission:
X,Y=list(map(int,input().split()))
print(X+Y//2)

Buggy submission (verdict: Runtime Error):
print(int(input())+int(input())//2)
Problem p03263 (python)

Fixed submission:
H,W=list(map(int,input().split()))
A=[]
for i in range(H):
    A.append(list(map(int,input().split())))
sum_=0
ans=[]
for i,aline in enumerate(A):
    for j in range(W-1):
        if aline[j]%2==1:
            aline[j+1]+=1
            sum_+=1
            ans.append('{0} {1} {2} {3}'.format(i+1,j+1,i+1,j+2))
for i,aline in enumerate(A[:-1]):
    if aline[W-1]%2==1:
        A[i+1][W-1]+=1
        sum_+=1
        ans.append(('{0} {1} {2} {3}'.format(i+1,W,i+2,W)))
print(sum_)
for x in ans:
    print(x)

Buggy submission (verdict: Runtime Error):
H,W=list(map(int,input().split()))
A=[]
for i in range(H):
    A.append(list(map(int,input().split())))
sum_=0
ans=[]
for i,aline in enumerate(A):
    for j in range(W-1):
        if aline[j]%2==1:
            aline[j+1]+=1
            sum_+=1
            ans.append('{0} {1} {2} {3}'.format(i+1,j+1,i+1,j+2))
for i,aline in enumerate(A[:-1]):
    if aline[W-1]%2==1:
        A[i+1][W-1]+=1
        sum_+=1
        ans.append(('{0} {1} {2} {3}'.format(i+1,j+1,i+2,j+1)))
print(sum_)
for x in ans:
    print(x)

Buggy submission (verdict: Runtime Error):
H,W=list(map(int,input().split()))
A=[]
for i in range(H):
    A.append(list(map(int,input().split())))
sum_=0
ans=[]
for i,aline in enumerate(A):
    for j in range(W-1):
        if aline[j]%2==1:
            aline[j+1]+=1
            sum+=1
            ans.append('{0} {1} {2} {3}'.format(i+1,j+1,i+1,j+2))
for i,aline in enumerate(A[:-1]):
    if aline[W-1]%2==1:
        A[i+1][W-1]+=1
        sum_+=1
        ans.append(('{0} {1} {2} {3}'.format(i+1,j+1,i+2,j+1)))
print(sum_)
for x in ans:
    print(x)

Buggy submission (verdict: Runtime Error):
H,W=list(map(int,input().split()))
A=[]
for i in range(H):
    A.append(list(map(int,input().split())))

for i,aline in enumerate(A):
    for j in range(W-1):
        if aline[j]%2==1:
            aline[j+1]+=1
            print('{0} {1} {2} {3}'.format(i+1,j+1,i+1,j+2))
for i,aline in enumerate(A[:-1]):
    if aline[W-1]%2==1:
        A[i+1][W-1]+=1
        print('{0} {1} {2} {3}'.format(i+1,j+1,i+2,j+1))
Problem p03316 (python)

Fixed submission:
S=0
N=int(input())
tmp=N
while tmp!=0:
    S+=tmp%10
    tmp//=10
if N%S==0:
    print('Yes')
else:
    print('No')

Buggy submission (verdict: Runtime Error):
S=0
N=int(input())
tmp=N
while tmp!=0:
    S+=N%10
    tmp//=10
if N%S==0:
    print('Yes')
else:
    print('No')
Problem p03352 (python)

Fixed submission:
arr = [0 for _ in range(1001)]
arr[1] = 1
for i in range(2,32):
    if arr[i]==1:
        continue
    tmp=i*i
    while tmp <=1000:
        arr[tmp]=1
        tmp*=i

for x in range(int(input()),0,-1):
    if arr[x]==1:
        print(x)
        break

Buggy submission (verdict: Runtime Error):
arr = [0 for _ in range(1001)]
arr[1] = 1
for i in range(2,32):
    if arr[i]==1:
        continue
    tmp=i
    while i <=1000:
        arr[tmp]=1
        tmp*=i

for x in range(int(input()),0,-1):
    if arr[x]==1:
        print(x)
        break
Problem p03360 (python)

Fixed submission:
A,B,C=list(map(int,input().split(' ')))
K=int(input())

print(A+B+C+(2**K-1)*max(A,B,C))

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

print(A+B+C+(2**K-1)*max(A,B,C))

Buggy submission (verdict: Runtime Error):
A,B,C=list(map(int,input()))
K=int(input())

print(A+B+C+(2**K-1)*max(A,B,C))
Problem p03371 (python)

Fixed submission:
A, B, C, X, Y = list(map(int, input().split()))
C *= 2
ans = 0

if A >= C and B >= C:
    ans += max(X, Y) * C
elif C >= A+B:
    ans += A*X + B*Y
elif C >= max(A,B):
    if X>Y:
        ans += Y*C + (X-Y)*A
    else:
        ans += X*C + (Y-X)*B
else:
    if A >= C:
        ans += X*C
        if Y-X>0:
            ans+=(Y-X)*B
    else:
        ans += Y*C
        if X-Y>0:
            ans+=(X-Y)*A

print(ans)

Buggy submission (verdict: Runtime Error):
C *= 2
ans = 0

if A >= C and B >= C:
    ans += max(X, Y) * C
elif C >= A+B:
    ans += A*X + B*Y
elif C >= max(A,B):
    if X>Y:
        ans += Y*C + (X-Y)*A
    else:
        ans += X*C + (Y-X)*B
else:
    if A >= C:
        ans += X*C
        if Y-X>0:
            ans+=Y*B
    else:
        ans += Y*C
        if X-Y:
            ans+=X*A

print(ans)
Problem p03415 (python)

Fixed submission:
ans = ''
for i in range(3):
    ans += input()[i]

print(ans)

Buggy submission (verdict: Runtime Error):
ans = ''
for i in range(3):
    ans += input().split()[i]

print(ans)
Problem p03476 (python)

Fixed submission:
import numpy as np
Q = int(input())

p = np.array([i for i in range(2*10**5+1)])
p[1]=0
for i in range(2,10**5):
    p[2*i::i] = 0
p = p[p!=0]

dic = {i:1 for i in p}
d = {}
for i in range(len(p)):
    if dic.get((p[i]+1)//2,0)==1:
        d[p[i]] = 1
sum_=0
arr = [0 for i in range(10**5+2)]
for i in range(10**5+2):
    arr[i] = sum_
    if d.get(i,0)==1:
        sum_+=1
for _ in range(Q):
    l,r = list(map(int,input().split()))
    print(arr[r+1]-arr[l])

Buggy submission (verdict: Runtime Error):
import numpy as np
Q = int(input())

p = np.array([i for i in range(2*10**5+1)])
p[1]=0
for i in range(2,10**5):
    p[2*i::i] = 0
p = p[p!=0]

dic = {i:1 for i in p}

for _ in range(Q):
    l,r = list(map(int,input().split()))
    tmp = p[l<=p]
    tmp = tmp[tmp<=r]
    print(len(tmp[[dic.get((x+1)//2,0)==1 for x in tmp]]))
Problem p03478 (python)

Fixed submission:
def sum_(a):
    ans=0
    while a!=0:
        ans+=a%10
        a//=10
    return ans

N,A,B=list(map(int,input().split()))

arr=[0 for i in range(37)]
for i in range(1,N+1):
    arr[sum_(i)]+=i

print(sum(arr[A:B+1]))

Buggy submission (verdict: Runtime Error):
def sum_(a):
    ans=0
    while a!=0:
        ans+=a%10
        a//=10
    return ans

N,A,B=list(map(int,input().split()))

arr=[0 for i in range(36)]
for i in range(1,N+1):
    arr[sum_(i)]+=i

print(sum(arr[A:B+1]))
Problem p03488 (python)

Fixed submission:
s=input()+'TE'
x,y=list(map(int,input().split()))

ini = s.find('T')
s=s[ini+1:]

is_y=1
point=[set([ini]),set([0])]

while len(s)>1:
    tmp=s.find('T')
    if tmp != 0:
        set_=set()
        for z in point[is_y]:
            set_.add(z+tmp)
            set_.add(z-tmp)
        point[is_y]=set_
    is_y+=1
    is_y%=2
    s=s[tmp+1:]

if x in point[0] and y in point[1]:
    print('Yes')
else:
    print('No')

Buggy submission (verdict: Runtime Error):
def search(keys,dic,now,goal):
    if now==len(keys):
        if goal==0:
            return True
        else:
            return False
    k=keys[now]
    for i in range(dic[k]+1):
        if search(keys,dic,now+1,goal-k*i+k*(dic[k]-i)):
            return True
    return False

s=input()+'T'
x,y=list(map(int,input().split()))
xlist=[0 for _ in range(8000)]
ylist=[0 for _ in range(8000)]
flag='x+'
ini=0
tmp=0
for c in s:
    if c =='F':
        tmp+=1
    else:
        if flag=='x':
            xlist[tmp]+=1
        elif flag=='y':
            ylist[tmp]+=1
        else:
            ini=tmp
        tmp=0
        if flag=='y':
            flag='x'
        else:
            flag='y'
xlist[0]=0
ylist[0]=0
xkey=[]
ykey=[]
for i in range(8000):
    if xlist[i]>0:
        xkey.append(i)
    if ylist[i]>0:
        ykey.append(i)
xkey.inverse()
ykey.inverse()
if search(xkey,xlist,0,x-ini) and search(ykey,xlist,0,y):
    print('Yes')
else:
    print('No')
Problem p03573 (python)

Fixed submission:
A,B,C=list(map(int,input().split()))
if A==B:
    print(C)
elif B==C:
    print(A)
else:
    print(B)

Buggy submission (verdict: Runtime Error):
A,B,C=list(map(int,input()))
if A==B:
    print(C)
elif B==C:
    print(A)
else:
    print(B)
Problem p03607 (python)

Fixed submission:
N=int(input())
ans=0
dic={}
for i in range(N):
    a=int(input())
    if dic.get(a,0)==0:
        ans+=1
        dic[a]=1
    else:
        ans-=1
        dic[a]=0
print(ans)

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

def search(now,r,dist,ans):
    if len(r)==0:
        return ans
    min_=float('inf')
    for i,x in enumerate(r):
        if i < len(r)-1:
            min_=min(min_,search(x,r[:i]+r[i+1:],dist,ans+dist[now][x]))
        else:
            min_=min(min_, search(x,r[:i],dist,ans+dist[now][x]))
    return min_

N,M,R=list(map(int,input().split()))
r=list(map(int,input().split()))
r=[x-1 for x in r]
dist=[[float('inf') for _ in range(N)] for _ in range(N)]
for i in range(M):
    A,B,C=list(map(int,input().split()))
    dist[A-1][B-1]=C
    dist[B-1][A-1]=C
for i in range(N):
    dist[i][i]=0
dist=np.array(dist)

ans=float('inf')
for i in range(N):
    for j in range(N):
        dist[i][j]=min(dist[i]+dist[j])

ans=float('inf')
for i,x in enumerate(r):
    if i < len(r)-1:
        ans=min(ans, search(x,r[:i]+r[i+1:],dist,0))
    else:
        ans=min(ans, search(x,r[:i],dist,0))
print(ans//1)