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

Fixed submission:
n = int(input())
k = int(input())
x = int(input())
y = int(input())

print( x * n if n < k else x * k + y * (n - k) )

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

return x * n if n < k
return x * k + y * (n - k)

Buggy submission (verdict: Runtime Error):
n = input()
k = input()
x = input()
y = input()

return x * n if n < k
return x * k + y * (n - k)
Problem p04012 (python)

Fixed submission:
# Hello World program in Python

def isBeautiful(w):
    w = list(w)
    length = len(w)
    
    if length % 2 != 0:
        return False
    
    w.sort()
    for i in range(0, length, 2):
      if w[i] != w[i + 1]:
        return False
    
    return True

w = input().strip()
 
print('Yes' if isBeautiful(w) else 'No')

Buggy submission (verdict: Runtime Error):

w = list(input())
w.sort()

isBeautiful = True
length = len(w)
for i in range(0, length, 2):
  if w[i] is not w[i + 1]:
    isBeautiful = False
    break

print('Yes' if isBeautiful else 'No')
Problem p03997 (python)

Fixed submission:
def solve(a, b, h):
    return (a + b) * h / 2


a = raw_input()
a = int(a)
b = raw_input()
b = int(b)
h = raw_input()
h = int(h)
ans = solve(a, b, h)
print ans

Buggy submission (verdict: Runtime Error):
def solve(a, b, h):
    return (a + b) * h / 2


a = raw_input()
int(a)
b = raw_input()
int(b)
h = raw_input()
int(h)
ans = solve(a, b, h)
print ans

Buggy submission (verdict: Runtime Error):
import sys


def solve(a, b, h):
    return (a + b) * h / 2


a = sys.stdin.readline().rstrip()
int(a)
b = sys.stdin.readline().rstrip()
int(b)
h = sys.stdin.readline().rstrip()
int(h)
ans = solve(a, b, h)
print ans

Buggy submission (verdict: Runtime Error):
import sys


def solve(a, b, h):
    return (a + b) * h / 2


a = sys.stdin.readline().rstrip()
int(a)
b = sys.stdin.readline().rstrip()
int(b)
h = sys.stdin.readline().rstrip()
int(h)
ans = solve(a, b, h)
print "{0}".format(ans)

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

import sys

def solve(a, b, h):
    return (a + b) * h / 2


a = sys.stdin.readline().rstrip()
int(a)
b = sys.stdin.readline().rstrip()
int(b)
h = sys.stdin.readline().rstrip()
int(h)
ans = solve(a, b, h)
print "{0}".format(ans)

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

import sys

def solve(a, b, h):
    return (a + b) * h / 2

def main():
    a = sys.stdin.readline().rstrip()
    int(a)
    b = sys.stdin.readline().rstrip()
    int(b)
    h = sys.stdin.readline().rstrip()
    int(h)
    ans = solve(a, b, h)
    print "{0}".format(ans)


if __name__ == "__main__":
    main()

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


import sys


def solve(a, b, h):
    return (a + b) * h / 2


def main():
    a = sys.stdin.readline().rstrip()
    int(a)
    b = sys.stdin.readline().rstrip()
    int(b)
    h = sys.stdin.readline().rstrip()
    int(h)
    print solve(a, b, h)


if __name__ == "__main__":
    main()

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


import sys


def solve(a, b, h):
    return (a + b) * h / 2.


def main():
    a = sys.stdin.readline().rstrip()
    int(a)
    b = sys.stdin.readline().rstrip()
    int(b)
    h = sys.stdin.readline().rstrip()
    int(h)
    print solve(a, b, h)


if __name__ == "__main__":
    main()

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


import sys


def solve(a, b, h):
    return (a + b) / h / 2.


def main():
    a = sys.stdin.readline().rstrip()
    int(a)
    b = sys.stdin.readline().rstrip()
    int(b)
    h = sys.stdin.readline().rstrip()
    int(h)
    print solve(a, b, h)


if __name__ == "__main__":
    main()
Problem p04001 (python)

Fixed submission:
import itertools

target=input()
n = len(target)-1
#bit_list = [list(f"{i:0{n}b}") for i in range(2**n)]
status = [['0', '1'] for _ in range(n)]
bit_list = list(itertools.product(*status)) 


answer = 0

for bits in bit_list:
    one_number_indexes=[i for i, x in enumerate(bits) if x == '1']
    
    # ここで1がある場所を取得
    start=0    
    # 街灯の箇所で文字を区切る関数を実装
    for index in one_number_indexes:
        answer=answer+int(target[start:index+1])
        start=index+1
    answer=answer+int(target[start:n+1])

print(answer)

Buggy submission (verdict: Runtime Error):
target=input()
n = len(target)-1
bit_list = [list(f"{i:0{n}b}") for i in range(2**n)]
answer = 0

for bits in bit_list:
    one_number_indexes=[i for i, x in enumerate(bits) if x == '1']
    # ここで1がある場所を取得
    start=0    
    # 街灯の箇所で文字を区切る関数を実装
    for index in one_number_indexes:
        answer=answer+int(target[start:index+1])
        start=index+1
    answer=answer+int(target[start:n+1])

print(answer)

Buggy submission (verdict: Runtime Error):
# coding: utf-8
# Your code here!
target=input()
n = len(target)-1
bit_list = [list(f"{i:0{n}b}") for i in range(2**n)]
answer = 0

for bits in bit_list:
    one_number_indexes=[i for i, x in enumerate(bits) if x == '1']
    # ここで1がある場所を取得
    start=0    
    # 街灯の箇所で文字を区切る関数を実装
    for index in one_number_indexes:
        answer=answer+int(target[start:index+1])
        start=index+1
    answer=answer+int(target[start:n+1])

print(answer)
Problem p04043 (python)

Fixed submission:
a = list(map(int,input().split()))
if a.count(5) == 2 and a.count(7) == 1:
  print("YES")
else:
  print("NO")

Buggy submission (verdict: Runtime Error):
m, n = map(int,input().split())
l = map(str,input().split())
l2 = {str(i) for i in range(10)}
l3 = set(l2) - set(l)

ans = 0
for i in range(m, 100000):
    nums = set(str(i))
    if nums <= l3:
        print(i)
        break
Problem p04029 (python)

Fixed submission:
N=int(raw_input())

n=0

for i in range(0,N+1):
    n+=i

print n

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

n=0

for i in range(0,N):
    n+=i

print n
Problem p04025 (python)

Fixed submission:
n=input()
a=map(int,raw_input().split())
ans=10**9
for j in xrange(-100,101):
    asum=0
    for i in xrange(n):
        asum+=(a[i]-j)**2
    ans=min(ans,asum)
print(ans)

Buggy submission (verdict: Runtime Error):
s=raw_input()
n=len(s)
cnt=[[0]*26 for _ in xrange(n+1)]
for i in xrange(n):
    for j in xrange(26):
        cnt[i+1][j]=cnt[i][j]
    cnt[i+1][ord(s[i])-ord("a")]+=1
if n==2:
    if s[0]==s[1]:
        print 1,2
        quit()
    else:
        print -1,-1
        quit()
for i in xrange(n):
    for j in xrange(i+3,n+1):
        max_cnt=0
        for k in xrange(26):
            max_cnt=max(max_cnt,cnt[j][k]-cnt[i][k])
        if (j-i)/2<max_cnt:
            print i+1,j
            quit()
print -1,-1
Problem p04047 (python)

Fixed submission:
n=input()
l=map(int,raw_input().split())
l.sort()
cnt=0
for i in xrange(n):
    cnt+=l[i*2]
print(cnt)

Buggy submission (verdict: Runtime Error):
import sys
sys.setrecursionlimit(10**6)

def dfs1(s,c):
    visited[s]=1
    for i in v[s]:
        if visited[i]==0:
            d[c][i]=d[c][s]+1
            dfs1(i,c)
    return

def dfs2(c1,c2):
    visited[c2]=1
    dfs1(c1,c1)
    dfs1(c2,c2)
    return

n,k=map(int,raw_input().split())
d=[[0]*n for _ in xrange(n)]
v=[[] for _ in xrange(n)]
e=[]
for i in xrange(n-1):
    a,b=map(int,raw_input().split())
    a-=1
    b-=1
    v[a].append(b)
    v[b].append(a)
    e.append([a,b])
if k%2==0:
    min_del=1000000
    for i in xrange(n):
        cnt=0
        visited=[0]*n
        dfs1(i,i)
        for j in xrange(n):
            if d[i][j]>k/2:
                cnt+=1
        min_del=min(min_del,cnt)
    print(min_del)
else:
    min_del=1000000
    for i,j in e:
        cnt=0
        visited=[0]*n
        d=[[0]*n for _ in xrange(n)]
        dfs2(i,j)
        for l in xrange(n):
            if d[i][l]>(k-1)/2 or d[j][l]>(k-1)/2:
                cnt+=1
        min_del=min(min_del,cnt)
    print(min_del)
Problem p04043 (python)

Fixed submission:
a, b, c = map(int, input().split())
iroha = [a, b, c]
if iroha.count(5) == 2 and iroha.count(7) == 1:
  print("YES")
else:
  print("NO")

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

if iroha.count(2)==5 and iroha.count(1)==7:
  print("YES")
else:
  prnt("NO")
Problem p04030 (python)

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 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)
Problem p04011 (python)

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 submission (verdict: Runtime Error):
N,K,X,Y = map(int,input().split())

print(N)
print(K)
print(X)
print(Y)
Problem p04012 (python)

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

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

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

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

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

Buggy 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)

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

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

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 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)

Buggy 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)
Problem p04029 (python)

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

Buggy 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;
}

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

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 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")

Buggy 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)

Buggy 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)
Problem p04011 (python)

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 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)

Buggy 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)
Problem p04029 (python)

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

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

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

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

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

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

Buggy 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")
Problem p04032 (python)

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 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])

Buggy 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])
Problem p04043 (python)

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 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))
Problem p04046 (python)

Fixed submission:
from array import *
import time
h, w, a, b = map(int, input().split(' '))
MOD = 10**9 + 7
MAX = max(h+w-a-1, a+w)


def modpow(a, b):
    res = 1
    while b:
        if (b & 1):
            res = (res * a) % MOD
        a = (a * a) % MOD
        b >>= 1
    return res


def nCr(n, r):
    if r == 0 or n == r:
        return 1
    return (((f[n] * ivf[n-r]) % MOD) * ivf[r]) % MOD


f = [1] * MAX
f = array('q', f)
ivf = [0] * MAX
ivf = array('q', ivf)
for i in range(1, MAX):
    f[i] = (f[i-1] * i) % MOD
    ivf[i] = modpow(f[i], MOD-2)
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))

Buggy submission (verdict: Runtime Error):
h, w, a, b = map(int, input().split(' '))
MOD = 10**9 + 7
MAX = int(1.8*10**5)


def modpow(a, b):
    res = 1
    while b:
        if (b & 1):
            res = (res * a) % MOD
        a = (a * a) % MOD
        b >>= 1
    return res


def nCr(n, r):
    if r == 0 or n == r:
        return 1
    return (((f[n] * ivf[n-r]) % MOD) * ivf[r]) % MOD


f = [1] * MAX
ivf = [0] * MAX
for i in range(1, MAX):
    f[i] = (f[i-1] * i) % MOD
    ivf[i] = modpow(f[i], MOD-2)
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))

Buggy 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))
Problem p04030 (python)

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 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))

Buggy 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))
Problem p04030 (python)

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 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)

Buggy 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)
Problem p04047 (python)

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 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))
Problem p04011 (python)

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 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))

Buggy 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 )
Problem p04011 (python)

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 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)
Problem p04029 (python)

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

Buggy 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
Problem p04029 (python)

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

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

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

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

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

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

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 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)

Buggy 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)