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

Fixed submission:
def pfn(N):
    factor=[]
    N=int(N)
    if N==1:
        return []
    else:
        for num in range(2, N+1):
            while N % num==0:
                N //=num
                factor.append(num)
        return factor
            
N=int(input())
factor=[]
for i in range(1, N+1):
    factor+=pfn(i)
    
p=1
factor_set=list(set(factor))
for x in factor_set:
    p*=factor.count(x)+1
    
print(p%(10**9+7))

Buggy submission (verdict: Runtime Error):
import math
N=int(input())

import math
factN=math.factorial(N)
count=0

factor = []
tmp = int(math.sqrt(factN)) + 1
for num in range(2,tmp):
    while factN % num == 0:
            factN //= num
            factor.append(num)

factor_set=list(set(factor))

p=1
for x in factor_set:
    p*=(factor.count(x)+1)
    
    
print(factor)
print(p)
Problem p04030 (python)

Fixed submission:
s=input()
s_list=list(s)

string=[]

for i, x in enumerate(s_list):
    if x=='0':
        string.append('0')
    if x=='1':
        string.append('1')
    if x=='B':
        if len(string) != 0 :
            string.pop()
        else: pass
        
string_out=''.join(string)

print(string_out)

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

string=[]

for i, x in enumerate(s_list):
    if x=='0':
        string.append('0')
    if x=='1':
        string.append('1')
    if x=='B':
        string.pop()
        
string_out=''.join(string)

print(string_out)

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

string=[]

for i, x in enumerate(s_list):
    if x=='0':
        string.append('0')
    if x=='1':
        string.append('1')
    if x=='B':
        string.pop()
        
string_out=''.join(string)

print(string_out)
Problem p02983 (python)

Fixed submission:
import numpy as np
S = input().split() 
L = int(S[0])
R = int(S[1])
ans = 2019*2019
if(R-L >=2019):
    print(0)
else:
    for i in range(L,R):
        for j in range(i+1,R+1):
            ans = np.minimum(ans,(i*j)%2019)
            if(ans == 0):
                print(0)
                exit()
    print(ans)

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

ans = 2019*2019

if(R-L >=2019):
    print(0)
else:
    for i in range(L,R-1):
        for j in range(i+1,R):
            ans = np.minimum(ans,(i*j)%2019)
            if(ans == 0):
                print(0)
                exit()
    print(ans)
Problem p03844 (python)

Fixed submission:
s_input =   input().split()
if(s_input[1] == '+'):
    print(int(s_input[0])+int(s_input[2]))
else:
    print(int(s_input[0])-int(s_input[2]))

Buggy submission (verdict: Runtime Error):
s_input =   input().split()
if(s_input[1] == '+'):
    print(int(s_input[0]+int(s_input[2])))
else:
    print(int(s_input[0]-int(s_input[2])))

Buggy submission (verdict: Runtime Error):
s_input =   input().split()
if(s_input[1] == '+'):
    print(int(s_input[0]+int(s_input[2]))
else:
    print(int(s_input[0]-int(s_input[2]))
Problem p02999 (python)

Fixed submission:
x, a = map(int, input().split(" "))
print(0 if x < a else 10)

Buggy submission (verdict: Runtime Error):
n, x = map(int, input().split(" "))
l = list(map(int, input().split(" ")))
d = 0
a = 1
for i in range(n):
    d += l[i]
    if d > x:
        a += i
        break
print(a)

Buggy submission (verdict: Runtime Error):
n, x = map(int, input().split(" "))
l = list(map(int, input().split(" ")))
d,a = 0,1
for i in range(n):
    d += l[i]
    if d > x:
        a += i
        break
print(a)
Problem p02917 (python)

Fixed submission:
N = int(input())
B = [int(i) for i in input().split()]
maxA = []
B.reverse()
maxA.append(B[0])
if N == 0:
    print(0)
    exit()

for i in range(1,N-1):
    if B[i] <= B[i-1]:
        maxA.append(B[i])
    else:
        maxA.append(B[i-1])
   
print(sum(maxA)+B[-1])

Buggy submission (verdict: Runtime Error):
N = int(input())
B = [int(i) for i in input().split()]
maxA = []
B.reverse()
maxA.append(B[0])

for i in range(N-1):
    if B[i] <= B[i-1]:
        maxA.append(B[i])
    else:
        maxA.append(B[i+1])
      
print(sum(maxA))
Problem p02918 (python)

Fixed submission:
N, K = map(int, input().split())
S = str(input())
max = N-1
cnt = 0
if N == 1:
    print(0)
    exit()
    
if (S[0] == "R") & (S[1] == "R"):
    cnt += 1
if (S[N-1] =="L") & (S[N-2]=="L"):
    cnt += 1
for i in range(1, N-1):
    if S[i] == "L":
        if S[i-1] == "L":
            cnt += 1
    if S[i] == "R":
        if S[i+1] == "R":
            cnt += 1

if (cnt + K*2) > max:
    print(max)
else:
    print(cnt + K*2)

Buggy submission (verdict: Runtime Error):
N, K = map(int, input().split())
S = str(input())
max = N-1
cnt = 0

if (S[0] == "R") & (S[1] == "R"):
    cnt += 1
if (S[N-1] =="L") & (S[N-2]=="L"):
    cnt += 1
for i in range(1, N-1):
    if S[i] == "L":
        if S[i-1] == "L":
            cnt += 1
    if S[i] == "R":
        if S[i+1] == "R":
            cnt += 1

if (cnt + K*2) > max:
    print(max)
else:
    print(cnt + K*2)
Problem p02957 (python)

Fixed submission:
A, B = map(int, input().split())
K =  (A + B) // 2
if ((A + B)%2 == 0) & ((A-K)**2==(B-K)**2):
    print(K)
else:
    print("IMPOSSIBLE")

Buggy submission (verdict: Runtime Error):
A, B = map(int, input().split())
if (A -B) % 2  == 0):
    K = (A+B) / 2
    if (A - K)!2 == (B - K)!2:
        print(K)
    else:
        print("IMPOSSIBLE")
else:
    print("IMPOSSIBLE")
Problem p03254 (python)

Fixed submission:
n, x = (int(i) for i in input().split(' '))
a = sorted([int(i) for i in input().split(' ')])

ch = 0 # 満足した子供の数
s = 0
for i in range(n):
    if x < a[i]:
        x = 0
    elif x >= a[i]:
        x -= a[i]
        ch += 1
        
if x > 0:
    ch = ch -1

print(ch)

Buggy submission (verdict: Runtime Error):
n, x = (int(i) for i in input().split(' '))
a = [int(i) for i in input().split(' ')]

ch = 0 # 満足した子供の数

while x != 0: # お菓子がある間ループする
    if x - a[i] < 0: # a[i]個は渡せない
        x = 0
    else:
        x -= a[i]
        ch += 1

print(ch)
Problem p03260 (python)

Fixed submission:
a, b = (int(i) for i in input().split(' '))
if (a*b) % 2:
    print('Yes')
else:
    print('No')

Buggy submission (verdict: Runtime Error):
h, w = (int(i) for i in input().split(' '))


a=[]
for i in range(h):
    a.append([int(j) for j in input().split(' ')])

j = 0
p = []
tr = []
picked = False

for i in range(h):
                
    step = -1 if i%2 else 1
    j = w-1 if i%2 else 0
    while j >=0 and j < w:
        if a[i][j] % 2:
            if picked == False:
                picked = True
            else:
                tr.append([i,j])
                picked = False
                for t_index in range(len(tr)-1):
                    p.append((tr[t_index], tr[t_index+1]))
                tr = []

        if picked:
            tr.append([i,j])
        j = j + step

print(len(p))
for ans in p:
    print(ans[0][0]+1,ans[0][1]+1,ans[1][0]+1, ans[1][1]+1)
Problem p03363 (python)

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

C = [0 for _ in A]
C[0] = A[0]
for i in range(1, len(A)):
    C[i] = C[i-1] + A[i]

from collections import Counter

count = Counter(C)

li = list(count.values())

res = 0
for l in li:
    if l == 1:
        pass
    else:
        res += l * (l - 1) / 2
res += count[0]

print(int(res))

Buggy submission (verdict: Runtime Error):
N = int(input())
A = list(map(int, input().split()))

C = [0 for _ in A]
C[0] = A[0]
for i in range(1, len(A)):
    C[i] = C[i-1] + A[i]

from collections import Counter
from scipy.special import comb
count = Counter(C)

li = list(count.values())

res = 0
for l in li:
    if l == 1:
        pass
    else:
        res += comb(l, 2)
res += count[0]

print(int(res))
Problem p03371 (python)

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

if Y == X:
    if C * 2 < A + B:
        res = C * X * 2
    else:
        res = A * X + B * Y
        
elif Y < X:
    if C * 2 <= A + B:
        res = C * Y * 2
        if C * 2 <= A:
            res += (X - Y) * 2 * C
        else:
            res += (X - Y) * A
    else:
        res = A * X + B * Y

else:
    if C * 2 <= A + B:
        res = C * X * 2
        if C * 2 <= B:
            res += (Y - X) * 2 * C
        else:
            res += (Y - X) * B
    else:
        res = A * X + B * Y

print(res)

Buggy submission (verdict: Runtime Error):
A, B, C, X, Y = map(int, input().split())

if Y == X:
    if C * 2 < A + B:
        res = C * X * 2
        print(res)
        
elif Y < X:
    if C * 2 <= A + B:
        res = C * Y * 2
        if C * 2 <= A:
            res += (X - Y) * 2 * C
        else:
            res += (X - Y) * A
    else:
        res = A * X + B * Y

else:
    if C * 2 <= A + B:
        res = C * X * 2
        if C * 2 <= B:
            res += (Y - X) * 2 * C
        else:
            res += (Y - X) * B
    else:
        res = A * X + B * Y

print(res)
Problem p02999 (python)

Fixed submission:
x, a = map(int, input().split())
r = 0 if x < a else 10
print(r)

Buggy submission (verdict: Runtime Error):
    x, a = map(int, input().split())
    r = 0 if x < a else 10
    print(r)
Problem p03000 (python)

Fixed submission:
N, X = map(int, input().split())
L = list(map(int, input().split()))
D = [0]
cnt = 1
for i in range(1,N+1):
  D.append(D[i-1]+L[i-1])
  if X >= D[i]:
    cnt += 1
print(cnt)

Buggy submission (verdict: Runtime Error):
N, X = map(int, input().split())
L = list(map(int, input().split()))
D = [0]
i = 1
cnt = 0
while X - max(D) >= 0:
  D.append(D[i-1]+ L[i-1])
  i += 1
  cnt += 1
  if i == N+2:
    break
if cnt == 0:
  print(cnt+1)
else:
  print(cnt)

Buggy submission (verdict: Runtime Error):
N, X = map(int, input().split())
L = list(map(int, input().split()))
D = 0
N += 1
i = 0
cnt = 0
while X - D >= 0:
  D += L[i]
  i += 1
  cnt += 1
if cnt == 0:
  print(cnt+1)
else:
  print(cnt)

Buggy submission (verdict: Runtime Error):
N, X = map(int, input().split())
L = list(map(int, input().split()))
D = 0
i = 0
cnt = 0
while X - D >= 0:
  D += L[i]
  i += 1
  cnt += 1
if cnt == 0:
  print(cnt+1)
else:
  print(cnt)

Buggy submission (verdict: Runtime Error):
N, X = map(int, input().split())
L = list(map(int, input().split()))
D = 0
i = 0
cnt = 0
while D <= X:
  D += L[i]
  i += 1
  cnt += 1
print(cnt)

Buggy submission (verdict: Runtime Error):
N, X = map(int, input().split())
L = list(map(int, input().split()))
D = 0
i = 0
cnt = 0
while D <= X:
  D += L[i]
  i += 1
  cnt += 1
print(cnt)
Problem p02927 (python)

Fixed submission:
M,D = map(int, input().split())
if M < 4 or D < 22:
    print(0)
else:
    result=0
    for m in range(4,M+1):
        for d in range(22,D+1):
            if int(str(d)[0]) >= 2 and int(str(d)[1]) >= 2 and int(str(d)[0])*int(str(d)[1])==m:
                result += 1
    print(result)

Buggy submission (verdict: Runtime Error):
M,D = map(int, input().split())
if M < 4 or D < 22:
    print(0)
else:
    result=0
    for m in range(4,M+1):
        for d in range(22,D+1):
            if str(d)[0] >= 2 and str(d)[1] >= 2 and int(str(d)[0])*int(str(d)[1])==m:
                result += 1
    print(result)
Problem p03434 (python)

Fixed submission:
N = int(input())
a = list(map(int, input().split()))
a_total, b_total = 0,0
for k in range(N):
    m = max(a)
    if k%2==0:
        a_total += m
    else:
        b_total += m
    a.remove(max(a))
print(a_total-b_total)

Buggy submission (verdict: Runtime Error):
a_total, b_total = 0,0
for k in range(N):
    m = max(a)
    if k%2==0:
        a_total += m
    else:
        b_total += m
    a.remove(max(a))
print(a_total-b_total)
Problem p03854 (python)

Fixed submission:
S = input()
for k in range(int(len(S)/5)):
    for word in ["dream", "dreamer", "erase", "eraser"]:
        if S.endswith(word):
            S=S[:-len(word)]
if len(S)==0:
    print("YES")
else:
    print("NO")

Buggy submission (verdict: Runtime Error):
S = input()
for k in range(len(S)/5):
    for word in ["dream", "dreamer", "erase", "eraser"]:
        if S.endswith(word):
            S=S.rstrip(word)
if len(S)==0:
    print("YES")
else:
    print("NO")
Problem p03457 (python)

Fixed submission:
n = int(input())

for i in range(n):
  t, x, y = map(int, input().split())
  if(x+y) > t or (t+x+y) % 2:
      print("No")
      exit()
print("Yes")

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

for i in range(n):
  t, x, y = map(int, input().split())
  if((x+y) > t or (t+x+y) % 2:
     print("No")
     exit()
print("Yes")
Problem p02993 (python)

Fixed submission:
S = raw_input()
flag = True
for i in range(3):
    if (S[i+1] == S[i]):
        flag = False
        break

if flag == True:
    print ("Good")
else:
    print("Bad")

Buggy submission (verdict: Runtime Error):
def gcd(a,b):
    while (b!= 0):
        a,b=b,a%b
    return a

l = raw_input().split()

a = int(l[0])
b = int(l[1])
c = int(l[2])
d = int(l[3])

lcm = ((c*d)//(gcd(c,d)))

div = []

div.append((a-1)/c)
div.append((a-1)/d)

div.append(b/c)
div.append(b/d)

div.append(a/lcm)
div.append(b/lcm)

ans =  (div[2]-div[0])+(div[3]-div[1])-(div[5]-div[4])
ans = (b-a+1) - ans

print ans

Buggy submission (verdict: Runtime Error):
S = input()
S = str(S)
flag = True

for i in range(3):
    if (S[i+1] == S[i]):
        flag = False
        break
    
if flag == True:
    print ("Good")
else:
    print("Bad")

Buggy submission (verdict: Runtime Error):
S = input()
dig = 0
dig_pre = 0
flag = True


for i in range(4):
    dig = S % 10
    if i>0:
        if(dig == dig_pre):
            flag = False
            break
    dig_pre = dig
    S = S/10

if flag == True:
    print ("Good")
else:
    print("Bad")
Problem p02945 (python)

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


c1=a+b
c2=a-b
c3=a*b

if c1>=c2 and c1>=c3:
    print(c1)

elif c2>=c1 and c2>=c3:
    print(c2)
else:
    print(c3)

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

c1=a+b
c2=a-b
c3=a*b

if c1>=c2 and c1>=c3:
    print(c1)

elif c2>=c1 and c2>=c3:
    print(c2)
else:
    print(c3)
Problem p02993 (python)

Fixed submission:
s=input()
S=list(s)
a=0

for i in range(0,3):
    if S[i]==S[i+1]:
        print('Bad')
        break
    else:
        a=a+1

if a==3:
    print('Good')

Buggy submission (verdict: Runtime Error):
s=int(input())
S=list(s)
a=0

for i in range(0,3):
    if S[i]==S[i+1]:
        print('Bad')
        break
    else:
        a=a+1

if a==3:
    print('Good')
Problem p02999 (python)

Fixed submission:
x,a=map(int,input().split())
if x<a:
    print(0)

else:
    print(10)

Buggy submission (verdict: Runtime Error):
x,a=map(int,input(),split())
if x<A:
    print('0')

else:
    print('10')
Problem p03001 (python)

Fixed submission:
w,h,x,y=map(int,input().split())

if w==h and x==y and x==w/2:
    s=1


elif x==w/2 and y==h/2:
    s=1
else:
    s=0


S=w*h/2

print(str(S)+' '+str(s))

Buggy submission (verdict: Runtime Error):
w,h,x,y=map(int,input().split())




elif x==w/2 and y==h/2:
    s=1
else:
    s=0


S=w*h/2

print(str(S)+' '+str(s))
Problem p03474 (python)

Fixed submission:
import collections

#文字列を一文字ずつ取得したいとき
def inputStrOnebyOne():
    s = list(input())
    return s

#整数を一つずつリストに入れる
def inputOnebyOne_Int():
    a = list(int(x) for x in input().split())
    return a

def main():
    a,b = input().split()
    s = input()
    if s.count("-") == 1:
        c,d = s.split("-")
        if a == str(len(c)) and b == str(len(d)):
            print("Yes")
        else:
            print("No")
    else:
        print("No")

if __name__=='__main__':
    main()

Buggy submission (verdict: Runtime Error):
import collections

#文字列を一文字ずつ取得したいとき
def inputStrOnebyOne():
    s = list(input())
    return s

#整数を一つずつリストに入れる
def inputOnebyOne_Int():
    a = list(int(x) for x in input().split())
    return a

def main():
    a,b = input().split()
    c,d = input().split("-")
    if a == str(len(c)) and b == str(len(d)):
        print("Yes")
    else:
        print("No")

if __name__=='__main__':
    main()
Problem p04030 (python)

Fixed submission:
import collections

#文字列を一文字ずつ取得したいとき
def inputStrOnebyOne():
    s = list(input())
    return s

#整数を一つずつリストに入れる
def inputOnebyOne_Int():
    a = list(int(x) for x in input().split())
    return a

def main():
    s = inputStrOnebyOne()
    ret = []
    for i in range(len(s)):
        if s[i] == "0":
            ret.append(s[i])
        elif s[i] == "1":
            ret.append(s[i])
        else:
            if 1<=len(ret):
                ret.pop()
    print(''.join(ret))

if __name__=='__main__':
    main()

Buggy submission (verdict: Runtime Error):
import collections

#文字列を一文字ずつ取得したいとき
def inputStrOnebyOne():
    s = list(input())
    return s

#整数を一つずつリストに入れる
def inputOnebyOne_Int():
    a = list(int(x) for x in input().split())
    return a

def main():
    s = inputStrOnebyOne()
    ret = []
    for i in range(len(s)):
        if s[i] == "0":
            ret.append(s[i])
        elif s[i] == "1":
            ret.append(s[i])
        else:
            ret.pop()
    print(''.join(ret))

if __name__=='__main__':
    main()
Problem p02923 (python)

Fixed submission:
n = int(input())
H = [int(h) for h in input().split()]

result = []
count = 0
if(n==1):
  print(0)
  exit()

for i in range(n-1):
  if (H[i]>=H[i+1]):
    count+=1
    if(i == n-2):
      result.append(count)
  else:
    result.append(count)
    count=0
    
print(max(result))

Buggy submission (verdict: Runtime Error):
n = int(input())
H = [int(h) for h in input().split()]

result = []
count = 0
for i in range(n-1):
  if (H[i]>=H[i+1]):
    count+=1
    if(i == n-2):
      result.append(count)
  else:
    result.append(count)
    count=0
    
print(max(result))
Problem p03035 (python)

Fixed submission:
# -*- coding: utf-8 -*-
import sys;
sys.setrecursionlimit(20000) # 再起呼び出しの最大数をセット

# 整数の入力
#n = int(input())

# スペース区切りの整数の入力
a = [x for x in map(int, input().split())]
#n, y = map(int, input().split())

# 改行区切りの整数の入力
#a = []
#for x in range(n):
#  a.append(int(input()))

# 文字列の入力
#s = input()

# 出力
#print("{} {}".format(a+b+c, s))
#a.sort()
#print(set(a), file=sys.stderr)
print(a, file=sys.stderr)

#surfixes = ("dream", "dreamer", "erase", "eraser")

def doit(l):
  #print(s, file=sys.stderr)
  if l == 0:
    return True;
  for x in surfixes:
    if s[:l].endswith(x):
#      return doit(l-len(x))
      if doit(l-len(x)):
        return True
  return False

try:
  if a[0] > 12:
    print("%d" % a[1])
  elif a[0] > 5:
    print("%d" % (a[1]/2))
  else:
    print("0")
except Exception as e:
  print(e, file=sys.stderr)

Buggy submission (verdict: Runtime Error):
# -*- coding: utf-8 -*-
import sys;
sys.setrecursionlimit(20000) # 再起呼び出しの最大数をセット

# 整数の入力
#n = int(input())

# スペース区切りの整数の入力
a = [x for x in map(int, input().split())]
#n, y = map(int, input().split())

# 改行区切りの整数の入力
#a = []
#for x in range(n):
#  a.append(int(input()))

# 文字列の入力
#s = input()

# 出力
#print("{} {}".format(a+b+c, s))
#a.sort()
#print(set(a), file=sys.stderr)
#print(len(set(a)))

surfixes = ("dream", "dreamer", "erase", "eraser")

def doit(l):
  #print(s, file=sys.stderr)
  if l == 0:
    return True;
  for x in surfixes:
    if s[:l].endswith(x):
#      return doit(l-len(x))
      if doit(l-len(x)):
        return True
  return False

try:
  if a[0] > 12:
    print("" + [a1])
  elif a[0] > 5:
    print("" + ([a1]/2))
  else
    print("0")
except Exception as e:
  print(e, file=sys.stderr)
Problem p02983 (python)

Fixed submission:
#coding utf-8
L,R=map(int,input().split())

tmp=99999999999999
if R-L>=2019:
  tmp=0
else:
  for i in range(L%2019,L%2019+R-L):
    for j in range(i+1,L%2019+R-L+1):
      if i==0 or j==0:
        tmp=0
      else:
        if (i*j)%2019<tmp:
          tmp=(i*j)%2019
        
print(tmp)

Buggy submission (verdict: Runtime Error):
#coding utf-8
L,R=map(int,input().split())

tmp=2019//L
ans=0
for i in range(1,tmp+1):
  if i*2019>=L and i*2019<=R:
    print(0)
    break
  if i==tmp:
    print((L%2019*(L+1)%2019)%2019)
Problem p03032 (python)

Fixed submission:
#coding utf-8
N,K=map(int,input().split())
V =list(map(int,input().split())) 

dpl=[]
temp=[]
T =min(N,K)+1
ans=0
for i in range(T):
  for j in range(T-i):
    dpl.clear()
    if i>0:
      dpl.extend(V[0:i])
    if j>0:
      dpl.extend(V[N-j:N])
    dpl.sort()            
    for k in range(K-i-j+1):
      if dpl != [] and k>0:
        if dpl[0]<=0:
          del dpl[0]       
      if ans<sum(dpl):
        ans=sum(dpl)
      if dpl == [] or dpl[0]>0:
        break

print(ans)

Buggy submission (verdict: Runtime Error):
#coding utf-8
N,K=map(int,input().split())
V =list(map(int,input().split())) 

Vl =V
Vr =V[::-1]

dpl=[]
dpr=[]
ansl=[0]
ansr=[0]

for i in range(K):
  if not dpl:
    dpl.append(Vl.pop(0))
  elif min(dpl)<0 and min(dpl)<Vl[i]:
    del dpl[dpl.index(min(dpl))]
  else:
    dpl.append(Vl.pop(0))
  ansl.append(max(sum(dpl),ansl[i]))

for i in range(K):
  if not dpr:
    dpr.append(Vr.pop(0))
  elif min(dpr)<0 and min(dpr)<Vr[i]:
    del dpr[dpr.index(min(dpr))]
  else:
    dpr.append(Vr.pop(0))
  ansr.append(max(sum(dpr),ansr[i]))
    
ans=0    
for i in range(1,K):
  tmp=ansr[i]+ansl[K-i]
  if ans<tmp:
    ans=tmp
  
print(ans)
Problem p03059 (python)

Fixed submission:
#conding utf-8
ABT =input().split()
a = int(ABT[0])
b = int(ABT[1])
t = int(ABT[2])

x = int(t/a)
print(x*b)

Buggy submission (verdict: Runtime Error):
#conding utf-8
N = int(input())
A = input().split()
ans = 0
t = 0
for i in range(N):
  A[i] = int(A[i])
for i in range(N):
  if A[i] == 0:
    for j in range(N):
      if A[j]<0:
        A[j] = -A[j]
    ans = sum(A)
for j in range(N):
  if A[j]<0:
    t +=1
if t%2 == 0:
  for j in range(N):
    if A[j]<0:
      A[j] = -A[j]
      ans = sum(A)
else:
  for j in range(N):
    if A[j]<0:
      A[j] = -A[j]
  A[A.index(min(A))] = -A[A.index(min(A))]
  ans = sum(A)
      
print(ans)
Problem p03436 (python)

Fixed submission:
#coding utf-8
from collections import deque
H,W=map(int,input().split())

s = [list(input().strip()) for _ in range(H)]
d = [[ 0 for i in range(W)] for j in range(H)]
q = deque([])
q.append([0,0,0])
y,x,z=q.popleft()

H = H-1
W = W-1
ans2=0
while y!=H or x!=W:
  if s[y][x]=="." and d[y][x]==0:
    if y<H:
      q.append([y+1,x,z+1])
    if x<W:
      q.append([y,x+1,z+1])
    if y>0:
      q.append([y-1,x,z+1])
    if x>0:
      q.append([y,x-1,z+1])
    d[y][x]=1
  if q==deque([]):
    ans2 = -1
    break
  y,x,z=q.popleft()
  

ans1=0
for i in range(H+1):
  for j in range(W+1):
    if s[i][j]=="#":
      ans1 +=1
      
ans = (H+1)*(W+1)-ans1-z-1
if ans2==-1:
  print(ans2)
else:
  print(ans)

Buggy submission (verdict: Runtime Error):
#coding utf-8
from collections import deque
H,W=map(int,input().split())

s = [list(input().strip()) for _ in range(H)]
d = [[ 0 for i in range(W)] for j in range(H)]
q = deque([])
q.append([0,0,0])
y,x,z=q.popleft()

H = H-1
W = W-1

while y!=H or x!=W:
  if s[y][x]=="." and d[y][x]==0:
    if y<H:
      q.append([y+1,x,z+1])
    if x<W:
      q.append([y,x+1,z+1])
    if y>0:
      q.append([y-1,x,z+1])
    if x>0:
      q.append([y,x-1,z+1])
    d[y][x]=1  
  y,x,z=q.popleft()

ans1=0
for i in range(H+1):
  for j in range(W+1):
    if s[i][j]=="#":
      ans1 +=1
      
ans = (H+1)*(W+1)-ans1-z-1
print(ans)
Problem p03043 (python)

Fixed submission:
import math

n, k = map(int, input().split())

l = []
for i in range(n):
    if i <= k:
        m = math.ceil(math.log2(k/(i+1)))
        l.append(1/2**m)
    else:
        l.append(1)

print(1/n*sum(l))

Buggy submission (verdict: Runtime Error):
import math

n, k = map(int, input().split())

l = []
for i in range(n):
    if i <= k:
        m = math.ceil(math.log2(k/(i+1)))
        l.append(1/2**m)
    else:
        l.append(1)

print(1/n*sum(l))print(1/n*sum(l))
Problem p03149 (python)

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

for i in range(len(n)):
  if n[i] == 1:
    n[i] = 1
  elif n[i] == 7:
    n[i] = 10
  elif n[i] == 9:
    n[i] = 100
  elif n[i] == 4:
    n[i] = 1000
    
if sum(n) == 1111:
  print("YES")
else:
  print("NO")

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

for i in range(len(n)):
  if n[i] == 1:
    n[i] = 1
  elif n[i] == 7:
    n[i] = 10
  elif n[i] == 9:
    n[i] = 100
  elif n[i] == 4:
    n[i] = 1000
    
if sum(n) == 1111:
  print("YES")
else:
  print("NO")
"""