Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Runtime Error):
s = input()
a = []

for i in range(len(s)):
    if s[i] == '0':
        a.append('0')
    elif s[i] == '1':
        a.append('1')
    elif s[i] == 'B':
        a.pop(-1)

result = ''.join(a)

print(result)




Fixed submission:
s = input()
a = []

for i in range(len(s)):
    if s[i] == '0':
        a.append('0')
    elif s[i] == '1':
        a.append('1')
    elif s[i] == 'B':
        if bool(a):
            a.pop(-1)

result = ''.join(a)

print(result)
Buggy python submission (verdict: Runtime Error):
N,K,X,Y = map(int,input().split())

print(N)
print(K)
print(X)
print(Y)

Fixed submission:
N,K,X,Y = [int(input()) for i in range(4)]
if N>K:
  total = N*X- (N-K)*(X-Y)
  print(total)
else:
  total = N*X
  print(total)
Buggy python submission (verdict: Runtime Error):
words = input()
ans = 'No'

for word in words:
  if words.count(word) %2 != 0:
    breake
  else:
    ans ='Yes'
    
print(ans)

Fixed submission:
words = input()
ans = 'No'
for word in words:
  if words.count(word) %2 != 0:
    break
else:
  ans ='Yes'  
print(ans)

Buggy python submission (verdict: Runtime Error):
words = input()
ans = 'No’

for word in words:
  if words.count(word) %2 != 0:
    breake
  else:
    ans = ('Yes’)
    
print(ans)

Fixed submission:
words = input()
ans = 'No'
for word in words:
  if words.count(word) %2 != 0:
    break
else:
  ans ='Yes'  
print(ans)

Buggy python submission (verdict: Runtime Error):
words = input()
ans = 'No’

for word in words:
  if words.count(word) %2 != 0:
    breake
  else:
    ans = ('Ye’s)
    
print(ans)

Fixed submission:
words = input()
ans = 'No'
for word in words:
  if words.count(word) %2 != 0:
    break
else:
  ans ='Yes'  
print(ans)

Buggy python submission (verdict: Runtime Error):
words = input()
ans = 'NO'

for word in words:
  if words.count(word) %2 != 0:
    breake
  else:
    ans = ('YES')
    
print(ans)

Fixed submission:
words = input()
ans = 'No'
for word in words:
  if words.count(word) %2 != 0:
    break
else:
  ans ='Yes'  
print(ans)
Buggy python submission (verdict: Runtime Error):
N = input()
K = input()
X = input()
Y = input()

if(N <= K):
  fee=N*X
else:
  fee=X*K + Y*(N-K)

print(fee)


Fixed submission:
N = int(input())
K = int(input())
X = int(input())
Y = int(input())

if(N <= K):
  fee=N*X
else:
  fee=X*K + Y*(N-K)

print(fee)

Buggy python submission (verdict: Runtime Error):
int N = input()
int K = input()
int X = input()
int Y = input()
int fee

if(N <= K):
  fee=N*X
else:
  fee=X*K + Y*(N-K)

print(fee)



Fixed submission:
N = int(input())
K = int(input())
X = int(input())
Y = int(input())

if(N <= K):
  fee=N*X
else:
  fee=X*K + Y*(N-K)

print(fee)
Buggy python submission (verdict: Runtime Error):
#include<stdio.h>

int main(void){
  double n;
  int c;
  scanf("%d", &n);
  c = (1+n)/2*n;
  print(c);
  return 0;
}

Fixed submission:
n = float(input())
c = int(((1 + n) / 2) * n)
print(c)

Buggy python submission (verdict: Runtime Error):
n = int(input())
c = ((1 + a) / 2) * n
print(c)

Fixed submission:
n = float(input())
c = int(((1 + n) / 2) * n)
print(c)
Buggy python submission (verdict: Runtime Error):
a, b, c = map(int, input().split())
if a, b, c == (5, 5, 7):
  print("YES")
elif a, b, c == (5, 7, 5):
  print("YES")
elif a, b, c == (7, 5, 5):
  print("YES")
else:
  print("NO")

Fixed submission:
a, b, c = map(int, input().split())
if (a, b, c) == (5, 5, 7):
  print("YES")
elif (a, b, c) == (5, 7, 5):
  print("YES")
elif (a, b, c) == (7, 5, 5):
  print("YES")
else:
  print("NO")

Buggy python submission (verdict: Runtime Error):
a, b, c = map(int, input().split())
if a, b, c == (5, 5, 7):
  print(YES)
elif a, b, c == (5, 7, 5):
  print(YES)
elif a, b, c == (7, 5, 5):
  print(YES)
else:
  print(NO)

Fixed submission:
a, b, c = map(int, input().split())
if (a, b, c) == (5, 5, 7):
  print("YES")
elif (a, b, c) == (5, 7, 5):
  print("YES")
elif (a, b, c) == (7, 5, 5):
  print("YES")
else:
  print("NO")

Buggy python submission (verdict: Runtime Error):
a, b, c = map(int, input().split())
if a, b, c == (5, 5, 7):
  print(YES)
elif a, b, c == (5, 7, 5):
  print(YES)
elif a, b, c == (7, 5, 5):
  print(YES)
else:
  pring(NO)

Fixed submission:
a, b, c = map(int, input().split())
if (a, b, c) == (5, 5, 7):
  print("YES")
elif (a, b, c) == (5, 7, 5):
  print("YES")
elif (a, b, c) == (7, 5, 5):
  print("YES")
else:
  print("NO")
Buggy python submission (verdict: Runtime Error):
N = int(input())
K = int(input())
X = int(input())
Y = int(input())

if N > K:
  print(X*N + Y*(N-K))
else:
  print(X*a)

Fixed submission:
N = int(input())
K = int(input())
X = int(input())
Y = int(input())

if N > K:
  print(X*K + Y*(N-K))
else:
  print(X*N)

Buggy python submission (verdict: Runtime Error):
N, K, X, Y = int(input())
a = K
b = N-K
if N > K:
  total = X*a + Y*b
  print(total)
else:
  total = X*a
  print(total)

Fixed submission:
N = int(input())
K = int(input())
X = int(input())
Y = int(input())

if N > K:
  print(X*K + Y*(N-K))
else:
  print(X*N)
Buggy python submission (verdict: Runtime Error):
N = int(input())
ans = 0
for i in range(1, N+1):
	return ans += i
print(ans)

Fixed submission:
N = int(input())
ans = 0
for i in range(1, N+1):
	ans += i
print(ans)

Buggy python submission (verdict: Runtime Error):
N = int(input())
ans = 0
for i in range(1, N+1)
	return ans += i
print(ans)

Fixed submission:
N = int(input())
ans = 0
for i in range(1, N+1):
	ans += i
print(ans)

Buggy python submission (verdict: Runtime Error):
N = int(input())
for i in range(1, N+1)
	return ans
print(ans)

Fixed submission:
N = int(input())
ans = 0
for i in range(1, N+1):
	ans += i
print(ans)

Buggy python submission (verdict: Runtime Error):
N = int(input())
ans = for i in range(1, N+1)
print(ans)

Fixed submission:
N = int(input())
ans = 0
for i in range(1, N+1):
	ans += i
print(ans)
Buggy python submission (verdict: Runtime Error):
a, b, c = map(int, input().split())
if a+b+c == 17 and a=5, b=7, c=5;
	print("YES")
else;
	print("NO")

Fixed submission:
a, b, c = map(int, input().split())
if a+b+c == 17:
	print("YES")
else:
  print("NO")
Buggy python submission (verdict: Runtime Error):
s = input()


def unbalanced(st):
    for c in st:
        if st.count(c) > len(st) // 2:
            return True
    return False


def test_str(st):
    r = (-1, -1)
    if len(s) < 3:
        return r
    if len(s) == 3:
        if unbalanced(s):
            return (1, 3)
        else:
            return r
    for i in range(len(s) - 3):
        if unbalanced(s[i:i+3]):
            r = (i+1, i+3)
            return r


print(test_str(s)[0], test_str(s)[1])

Fixed submission:
s = input()


def unbalanced(st):
    for c in st:
        if st.count(c) > (len(st) // 2):
            return True
    return False


def test_str(st):
    r = (-1, -1)
    for j in range(1, 3):
        for i in range(len(s) - j):
            if unbalanced(s[i:i+j+1]):
                r = (i+1, i+j+1)
                return r
    return r


print(test_str(s)[0], test_str(s)[1])

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


def unbalanced(st):
    for c in st:
        if st.count(c) > len(st) // 2:
            return True
    return False


def test_str(st):
    r = (-1, -1)
    if len(s) == 3:
        if not unbalanced(s):
            return r
        else:
            return (0, 3)
    for i in range(len(s) - 3):
        print(s[i:i+3])
        if unbalanced(s[i:i+3]):
            r = (i+1, i+3)
            return r


print(test_str(s)[0], test_str(s)[1])

Fixed submission:
s = input()


def unbalanced(st):
    for c in st:
        if st.count(c) > (len(st) // 2):
            return True
    return False


def test_str(st):
    r = (-1, -1)
    for j in range(1, 3):
        for i in range(len(s) - j):
            if unbalanced(s[i:i+j+1]):
                r = (i+1, i+j+1)
                return r
    return r


print(test_str(s)[0], test_str(s)[1])
Buggy python submission (verdict: Runtime Error):
import math
h, w, a, b = map(int, input().split(' '))

MOD = 10**9 + 7


def ncr(n, r):
    f = math.factorial
    return f(n) / f(r) / f(n-r)


r = 0
for i in range(b, w):
    y1 = h - a - 1
    x1 = i
    y2 = a - 1
    x2 = w - i - 1
    p = (ncr(x1 + y1, x1) * ncr(x2 + y2, x2)) % MOD
    r = (r + p) % MOD

print(int(r))

Fixed submission:
from itertools import permutations
a, b, c = map(int, input().split(' '))
l = list(permutations([5,5,7]))
if (a,b,c) in l:
  print('YES')
else:
  print('NO')
Buggy python submission (verdict: Time Limit Exceeded):
from itertools import permutations
n, l = map(int, input().split(' '))
lst = []
for _ in range(n):
  lst.append(input())
all_str = list(permutations(lst))
all_str = [''.join(x) for x in all_str]
print(min(all_str))

Fixed submission:
n, l = map(int, input().split(' '))
lst = []
for _ in range(n):
    lst.append(input())
all_str = sorted(lst)
print(''.join(all_str))
Buggy python submission (verdict: Runtime Error):
s = list(input())
try
    bs = s.index('B')
except:
    bs=-1

while bs != -1:
    if bs == 0:
        del s[bs]
    else:
        del s[bs-1]
        del s[bs-1]
    try:
        bs = s.index('B')
    except:
        bs = -1

print(''.join(s))


Fixed submission:
s = list(input())
try:
    bs = s.index('B')
except:
    bs=-1

while bs != -1:
    if bs == 0:
        del s[bs]
    else:
        del s[bs-1]
        del s[bs-1]
    try:
        bs = s.index('B')
    except:
        bs = -1

print(''.join(s))

Buggy python submission (verdict: Runtime Error):
s = list(input())
bs = s.index('B')

while bs != -1:
    if bs == 0:
        del s[bs]
    else:
        del s[bs-1]
        del s[bs-1]
    try:
        bs = s.index('B')
    except:
        bs = -1

print(''.join(s))


Fixed submission:
s = list(input())
try:
    bs = s.index('B')
except:
    bs=-1

while bs != -1:
    if bs == 0:
        del s[bs]
    else:
        del s[bs-1]
        del s[bs-1]
    try:
        bs = s.index('B')
    except:
        bs = -1

print(''.join(s))

Buggy python submission (verdict: Runtime Error):
s = raw_input()

if 'B' not in s:
    print s
else:
    str_list = list(s)
    output_list = []
    for i, c in enumerate(str_list):
        if c != 'B':
            output_list.append(c)
        else:
            # if output_list:
            if len(output_list) > 0:
                output_list.pop()

print ''.join(output_list)


Fixed submission:
s = raw_input()

str_list = list(s)
output_list = []
for i, c in enumerate(str_list):
    if c != 'B':
        output_list.append(c)
    else:
        if output_list:
            output_list.pop()

print ''.join(output_list)

Buggy python submission (verdict: Runtime Error):
s = raw_input()

if 'B' not in s:
    print s
else:
    str_list = list(s)
    output_list = []
    for i, c in enumerate(str_list):
        if c != 'B':
            output_list.append(c)
        else:
            if output_list:
                output_list.pop()

print ''.join(output_list)


Fixed submission:
s = raw_input()

str_list = list(s)
output_list = []
for i, c in enumerate(str_list):
    if c != 'B':
        output_list.append(c)
    else:
        if output_list:
            output_list.pop()

print ''.join(output_list)
Buggy python submission (verdict: Runtime Error):
NX = input()
NX = "".join(NX).split(" ")
NX = [int(s) for s in NX]
D = NX[0]-NX[1]
if NX[0] ==0 or NX[1]==0:
	print(str(0))
if NX[1]<D:
	Mod = D%NX[1]
	if Mod!=0:
		print(int(2*NX[1]+NX[1]+(D-NX[1]/2)*3))
	else:
		print(int(NX[1]*4+D))
elif NX[1]==D:
	print(int(3*NX[1]))
elif NX[1]>D:	
	Mod = NX[1]%D
	if Mod!=0:
		print(int(NX[1]+(Mod*3)+D+(D*2*int(NX[1]/D))))
	else:
		print(int(NX[1]+int((NX[1]/D))*2*D))

Fixed submission:
N = int(input())
K = input()
K = "".join(K).split(" ")
K = [int(s) for s in K]
K.sort()
ans=0
for s in range(N):
	if int(K[-1])> int(K[-2]):
		ans+=int(K[-2])
	else:
		ans+=int(K[-1])
	del K[-2:]

print(ans)
Buggy python submission (verdict: Runtime Error):
def app(numlist, A ):
  counter = 0
  N = len(numlist)
  for i in range(1,N):
    counter += f(numlist, i, A*i)
  return int(counter)
 
def f(numlist, rest, sum):
  result = 0
  numset = set(numlist)
  if rest == 1:
    return numlist.count(sum)
 
  elif rest == 2:
    for big in numset:
      if (sum - big in numset) and (big >= sum - big):
        result += counter(numlist, big, sum-big)
    return result
  else:
    for i in numset:
      i_place = numlist.index(i)
      result += f(numlist[i_place+1:], rest-1, sum-i)
    return result
 
 
def counter(numlist, big, small):
  hist = mkhist(numlist)
  if big == small:
    N = hist[big]
    return N * (N - 1) / 2
  else: 
    big_N = hist[big]
    small_N = hist[small]
    return big_N * small_N
 
def mkhist(numlist):
  hist = dict()   
  for char in numlist:
    if not char in hist.keys():
      hist[char] = 1
    else:
      hist[char] += 1
  return hist
 
 
 
 
N, A = map(int, input().split(' '))
inputs = input()
 
inputnum = map(int, inputs.split(' '))
inputnum = sorted(list(inputnum))
 
print (app(inputnum, A))

Fixed submission:
n = 4
input_list = []
for i in range(4):
    input_list.append(int(input()))

N = input_list[0]
K = input_list[1]
X = input_list[2]
Y = input_list[3]

if N > K :
    result = K * X + (N-K) * Y
else:
    result = N * X

print ( result )

Buggy python submission (verdict: Runtime Error):
 n = 4
 input_list = []
 for i in range(4):
     input_list.append(int(input()))

N = input_list[0]
K = input_list[1]
X = input_list[2]
Y = input_list[3]

if N > K :
    result = K * X + (N-K) * Y
else:
    result = K * X

print ( result )

Fixed submission:
n = 4
input_list = []
for i in range(4):
    input_list.append(int(input()))

N = input_list[0]
K = input_list[1]
X = input_list[2]
Y = input_list[3]

if N > K :
    result = K * X + (N-K) * Y
else:
    result = N * X

print ( result )

Buggy python submission (verdict: Runtime Error):
if __name__ == '__main__':
    N,K,X,Y = map(int, raw_input().split())
    if(N <= K):
        print (N * X)
    else :
        print (K * X) + ((N-K) * Y)

Fixed submission:
if __name__ == '__main__':
    N = input()
    K = input()
    X = input()
    Y = input()
    if(N <= K):
        print (N * X)
    else :
        print (K * X) + ((N-K) * Y)
Buggy python submission (verdict: Runtime Error):
raw_input()
a = [int(x) for x in raw_input().split()]
bsc = 1e10
for i in range(-101, 102):
  sc = 0
  for j in a:
    sc += (j-i)**2
  bsc = min(bsc, sc)
print bsc

Fixed submission:
N = input()
print N * (N + 1) / 2

Buggy python submission (verdict: Runtime Error):
k=0

for i in range(N+1):
    k +=i
    
print(k)

Fixed submission:
N=int(input())
k=0

for i in range(N+1):
    k +=i
    
print(k)

Buggy python submission (verdict: Runtime Error):
print(sum(list(range(1, int(input()+1)))))

Fixed submission:
N = int(input())
sum = 0
for i in range(1, N+1):
    sum += i
print(sum)
Buggy python submission (verdict: Runtime Error):
import re
text = input()
b_length = int(re.sub('[^B]', '', text))
for _ in range(b_length):
    text = re.sub('(0|1)??B', '', text, 1)
print(text)

Fixed submission:
import re
text = input()
b_length = len(re.sub('[^B]', '', text))
for _ in range(b_length):
    text = re.sub('(0|1)??B', '', text, 1)
print(text)

Buggy python submission (verdict: Runtime Error):
import re
text = input()
b_length = re.sub('B', '', text)
for _ in range(b_length):
    text = re.sub('(0|1)??B', '', text, 1)
print(text)

Fixed submission:
import re
text = input()
b_length = len(re.sub('[^B]', '', text))
for _ in range(b_length):
    text = re.sub('(0|1)??B', '', text, 1)
print(text)
Buggy python submission (verdict: Runtime Error):
for i in N:
  x += 1
print(x)

Fixed submission:
N = int(input())
s = 0
i = 1
while i <= N:
  s = s + i
  i += 1
print(s)

Buggy python submission (verdict: Runtime Error):
n = int(input())
while n > 0:
    a += n
    n -= 1
print(a)


Fixed submission:
n = int(input())
a = 0
while n > 0:
    a += n
    n -= 1
print(a)

Buggy python submission (verdict: Runtime Error):
n = map(int, input().split())
a = 0
while n > 0:
    a += n
    n -= 1
print(a)


Fixed submission:
n = int(input())
a = 0
while n > 0:
    a += n
    n -= 1
print(a)

Buggy python submission (verdict: Runtime Error):
n = map(int, input().split())
while n > 0:
    a += n
    n -= 1
print(a)

Fixed submission:
n = int(input())
a = 0
while n > 0:
    a += n
    n -= 1
print(a)

Buggy python submission (verdict: Runtime Error):
n = map(int, input().split())
a = 0
while n > 0:
    a += n
    n -= 1
print(a)

Fixed submission:
n = int(input())
a = 0
while n > 0:
    a += n
    n -= 1
print(a)

Buggy python submission (verdict: Runtime Error):
n = map(int, input().split())
a = 0
while n < 0:
    a += n
    n -= 1
print(a)

Fixed submission:
n = int(input())
a = 0
while n > 0:
    a += n
    n -= 1
print(a)

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

while n < 0:
    a += n
    n -= 1
print(a)


Fixed submission:
n = int(input())
a = 0
while n > 0:
    a += n
    n -= 1
print(a)

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

while n == 0:
    a += n
    n -= 1
print(a)


Fixed submission:
n = int(input())
a = 0
while n > 0:
    a += n
    n -= 1
print(a)
Buggy python submission (verdict: Runtime Error):

def haiku(a,b,c):
  if [a,b,c]==[5,5,7] or [a,b,c]==[5,7,5] or [a,b,c]==[7,5,5]:
      print('Yes')
  else:
      print('No')
      
  
A = int(input('1つ目の数を入力してください：'))
B = int(input('2つ目の数を入力してください：'))
C = int(input('3つ目の数を入力してください：'))

haiku(A,B,C)


Fixed submission:
value = input()
if value.count("5") ==2:
  if value.count("7") ==1:
    print('YES')
  else:
    print('NO')
else:
  print('NO')
Buggy python submission (verdict: Runtime Error):
N = int(input())
output = 0

for i in range(N+1):
    output += i

print output

Fixed submission:
N = int(input())
output = 0

for i in range(N+1):
    output += i

print(output)
Buggy python submission (verdict: Runtime Error):
x = int(input("はじめ"))
y = int(input("中"))
z = int(input("終わり"))


if x >= 1 and x <= 10:
    if x == 5:
        if y == 5:
            if z == 7:
                print("YES")
            elif z == 5:
                print("NO")
                
        elif y == 7:
            if z == 5:
                print("YES")
            elif z == 7:
                print("NO")
                
    elif x == 7:
        if  y == 5:
            if z == 5:
                print("YES")
            elif z == 5:
                print("NO")
            else:
                print("NO")
        else:
            print("NO")
    else:
        print("NO")
else:
    print("NO")

Fixed submission:
a, b, c = map(int, input().split())
if sorted((a, b, c)) == [5, 5, 7]:
  print('YES')
else:
  print('NO')
Buggy python submission (verdict: Runtime Error):
n = int(input())
sum = 0
for i in range(1:n+1):
  sum +=i
print(sum)

Fixed submission:
n = int(input())
sum = 0
for i in range(1,n+1):
  sum +=i
print(sum)
Buggy python submission (verdict: Runtime Error):
import math

n = int(input())
nums = list(map(int, input().split()))

avg_ceil = math.ceil(sum(nums) / len(nums))
avg_floor = math.floor(sum(nums) / len(nums))

cost_ceil = 0
cost_floor = 0

for x in nums:
    if x == avg_ceil:
        continue
    cost_ceil += (x - avg_ceil)**2

for x in nums:
    if x == avg_floor:
        continue
    cost_floor += (x - avg_floor)**2

if cost_ceil <= cost_floor:
    print(cost_ceil)
else
    print(cost_floor)



Fixed submission:
import math

n = int(input())
nums = list(map(int, input().split()))

avg_ceil = math.ceil(sum(nums) / len(nums))
avg_floor = math.floor(sum(nums) / len(nums))

cost_ceil = 0
cost_floor = 0

for x in nums:
    if x == avg_ceil:
        continue
    cost_ceil += (x - avg_ceil)**2

for x in nums:
    if x == avg_floor:
        continue
    cost_floor += (x - avg_floor)**2

if cost_ceil <= cost_floor:
    print(cost_ceil)
else:
    print(cost_floor)

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

b = sum(a_list)//n

def temp(a):
  return (a-b)^2
def temp2(a):
  return (a-b-1)^2

ans1 = sum(list(map(temp, a)))
ans2 = sum(list(map(temp2, a)))
#ans1 = sum([(a-b)^2 for a in a_list])
#ans2 = sum([(a-b-1)^2 for a in a_list])

print(min(ans1,ans2))


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

b = sum(a_list) // n
ans1 = sum([(a-b)**2 for a in a_list])

b += 1
ans2 = sum([(a-b)**2 for a in a_list])

print(min(ans1,ans2))
Buggy python submission (verdict: Runtime Error):
n, k = map(int, input().split())
Ds = list(map(int, input().split()))

for i in range(n, n*11):
  for d in Ds:
    if d in int(list(str(i))):
      break
  else:
    print(i)
    exit(0)

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

for i in range(n, n*11):
  for d in Ds:
    if d in list(map(int, list(str(i)))):
      break
  else:
    print(i)
    exit(0)
Buggy python submission (verdict: Runtime Error):
total, k = map(int, input().split())
ds = list(input().split())

for i in range(total,total*10+2):
  for d in ds:
    if d in list(str(ans)):
      break
  else:
    print(i)
    exit(0)

Fixed submission:
total, k = map(int, input().split())
ds = list(input().split())

ans = total
while True:
  flag = False
  for d in ds:
    if d in list(str(ans)):
      flag = True
  if flag:
    ans += 1
  else:
    print(ans)
    exit(0)