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

Fixed submission:
#-*-coding:utf-8-*-

def main():
    n, k = map(int, input().split())
    x_list = list(map(int, input().split()))
    ans = float('inf')

    for i in range(n - k + 1):
        if x_list[i] >= 0 and x_list[i+k-1] >= 0:
            ans = min(ans, x_list[i+k-1])
        elif x_list[i] <= 0 and x_list[i+k-1] <= 0:
            ans = min(ans, -x_list[i])
        else:
            ans = min(ans, min(-x_list[i] * 2 + x_list[i+k-1] , -x_list[i] + x_list[i+k-1] * 2))
    print(ans)

if __name__ == '__main__':
    main()

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

def main():
    n, k = map(int, input().split())
    x_list = list(map(int, input().split()))
    ans = float('inf')

    if 0 in x_list:
        k -= 1

    for i in range(n - k + 1):
        if x_list[i] >= 0 and x_list[i+k-1] >= 0:
            ans = min(ans, x_list[i+k-1])
        elif x_list[i] < 0 and x_list[i+k-1] < 0:
            ans = min(ans, -x_list[i])
        else:
            ans = min(ans, -x_list[i] * 2 + x_list[i+k-1])
    print(ans)

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

Fixed submission:
#-*-coding:utf-8-*-

def main():
    n, k = map(int, input().split())

    if n % k == 0:
        print(0)
    else:
        print(1)

if __name__ == '__main__':
    main()

Buggy submission (verdict: Runtime Error):
n=int(input())
k=int(input())
print(n % k)
Problem p03288 (python)

Fixed submission:
#-*-coding:utf-8-*-

def main():
    r = int(input())
    if r < 1200:
        print('ABC')
    elif r >= 1200 and r < 2800:
        print('ARC')
    else:
        print('AGC')

if __name__ == '__main__':
    main()

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

def main():
    r = int(input())
    if r < 2000:
        print('ABC')
    elif r >= 1200 ans r < 2800:
        print('ARC')
    else:
        print('AGC')

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

Fixed submission:
#-*-coding:utf-8-*-

def main():
    #入力
    N = int(input())
    a = list(map(int, input().split()))

    #変数
    count = 0

    for i in a:
        while i % 2 == 0:
            i /= 2
            count += 1 
            
    print(count)
 
if __name__ == '__main__':
    main()

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

def is_all_odd(lists):
    odd_flag = 1
    for i in lists:
        if i % 2 != 0:
            odd_flag *= 1
        else:
            odd_flag *= 0
    if odd_flag == 1:
        return True
    else:
        return False

def main():
    #入力
    N = int(input())
    a = list(map(int, input().split()))
    print(a)

    #変数
    count = 0

    while not is_all_odd(a):
        devide_flag = 0
        for i in range(N):
            if a[i] % 2 == 0 and devide_flag == 0:
                a[i] = int(a[i]/2) 
                devide_flag = 1
            else:
                a[i] = a[i] * 3
        count += 1
        print(a)
    
    print(count)




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

Fixed submission:
#N,A,B=map(int, input().split())
 
#A=list(map(int, input().split()))
 
N=int(input())
 
F=[]
P=[]
 
for i in range(N):
    tmp=list(map(int, input().split()))
    F.append(tmp)
 
for i in range(N):
    tmp=list(map(int, input().split()))
    P.append(tmp)
 
max_sum=-1000000001
 
for i in range(1,1024):
    bin=[0]*10
    now=i
    for j in range(10):
        bin[j]=now%2
        now=now//2
    ans_sum=0
    for j in range(N):
        ans=0
        for h in range(10):
            if F[j][h]*bin[h]==1:
                ans+=1
        ans_sum+=P[j][ans]
    if max_sum<ans_sum:
        max_sum=ans_sum
 
print(max_sum)

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

def main():
    n = int(input())
    f_list = []
    p_list = []
    #f_list = [list(map(int, input().split())) for i in range(n)]
    #p_list = [list(map(int, input().split())) for i in range(n)]

    for i in range(N):
        tmp=list(map(int, input().split()))
        f_list.append(tmp)
 
    for i in range(N):
        tmp=list(map(int, input().split()))
        p_list.append(tmp)

    max_profit = -10000000

    for i in range(1, 2 ** 10):
        binary = [0] * 10
        now = i 
        for j in range(10):
            binary[j] = now % 2
            now = now // 2
        profit = 0
        for j in range(n):
            one_cnt = 0
            for h in range(10):
                if f_list[j][h] * binary[h] == 1:
                    one_cnt += 1
            profit += p_list[j][one_cnt]
        if max_profit < profit:
            max_profit = profit
    print(max_profit)
    
    
if __name__ == '__main__':
    main()
Problem p03557 (python)

Fixed submission:
#-*-coding:utf-8-*-
import bisect

def main():

    n = int(input())
    a_list = list(map(int, input().split()))
    b_list = list(map(int, input().split()))
    c_list = list(map(int, input().split()))

    a_list.sort()
    b_list.sort()
    c_list.sort()

    cnt = 0
    
    for b in b_list:
        i = bisect.bisect_left(a_list, b)
        j = n - bisect.bisect_right(c_list, b)
        cnt += i * j
    
    print(cnt)
    
if __name__ == '__main__':
    main()

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

def main():
    n = int(input())
    a_list = list(set(list(map(int, input().split()))))
    b_list = list(set(list(map(int, input().split()))))
    c_list = list(set(list(map(int, input().split()))))

    a_list.sort()
    b_list.sort()
    c_list.sort()

    cnt = 0

    for i in range(n):
        for j in range(n):
            if a_list[i] < b_list[j]:
                for k in range(n):
                    if b_list[j] < c_list[k]:
                        cnt += n - k
                        break
    
    print(cnt)


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

Fixed submission:
#-*-coding:utf-8-*-

def main():
    arry = list(input().split())
    i = int(''.join(arry))
    if i % 4 == 0:
        print('YES')
    else:
        print('NO')

if __name__ == '__main__':
    main()

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

def main():
    arry = list(map(int, input().split()))
    i = int(''.join(arry))
    if i % 4 == 0:
        print('YES')
    else:
        print('NO')

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

Fixed submission:
#-*-coding:utf-8-*-

def main():
    arry = list(map(int, input().split()))
    if arry.count(5) == 2 and arry.count(7) == 1:
        print('YES')
    else:
        print('NO')

if __name__ == '__main__':
    main()

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

def main():
    arry = list(map(int, input().split))
    if arry.count(5) == 2 and arry.count(7) == 1:
        print('YES')
    else:
        print('NO')

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

Fixed submission:
n, k = map(int, input().split())
import math

if k == 1:
    print(0)
elif n < k:
    print(min(abs(n-k), abs(n)))
else:
    num = n // k
    n = n - num * k
    print(min(n, abs(n-k)))

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

if k == 1:
    print(0)
else:
    print(math.gcd(n, k))
Problem p02830 (python)

Fixed submission:
n = int(input())

word_list = list(map(str, input().split()))

result_string = ""
for num in range(len(word_list[0])):
    for i in range(0,2):
        word_selected = word_list[i]
        result_string += word_selected[num]

print(result_string)

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

word_list = list(map(str, input().split()))

result_string = ""
for num in range(len(word_list[0])):
    for i in range(0,n):
        word_selected = word_list[i]
        result_string += word_selected[num]

print(result_string)
Problem p03494 (python)

Fixed submission:
def check(st,count):
    flag = False
    new_list = []
    for i in st:
        if i % 2 == 0:
            i = i // 2
            new_list.append(i)
        else:
            flag = True
            break
    if flag:
        print(count)
        return
    else:
      count += 1
      check(new_list, count)

n = int(input())
st = list(map(int, input().split()))
count = 0
check(st, count)

Buggy submission (verdict: Runtime Error):
def check(st,count):
    flag = False
    new_list = []
    for i in st:
        if i % 2 == 0:
            new_list.append(i)
        else:
            flag = True
            break
    if flag:
        print(count)
        return
    else:
      count += 1
      check(new_list, count)
      
n = int(input())
st = list(map(int, input().split()))
count = 0
check(st, count)

Buggy submission (verdict: Runtime Error):
n = int(input())
st = map(int, input().split())
flag = True
count = 0
check(st, count)
def check(st,count):
    new_list = []
	for i in len(st):
      if i % 2 == 0:
        new_list.append(i)
      else:
        flag = True
        break
    if flag:
      print(count)
      return
    else:
      count += 1
      check(new_list, count)

Buggy submission (verdict: Runtime Error):
n = int(input())
st = map(int, input().split())
flag = True
count = 0

def check(st,count):
    new_list = []
	for i in len(st):
      if i % 2 == 0:
        new_list.append(i)
      else:
        flag = True
        break
    if flag:
      print(count)
      return
    else:
      count += 1
      check(new_list, count)
Problem p03854 (python)

Fixed submission:
s = input()
s_origin = s
t = ""
word_list = ["dream", "dreamer", "erase", "eraser"]
while True:
    flag = True
    if len(s) <= 4:
        break

    if len(s) == 5:
        s_child_1 = s[-5:]
        if s_child_1 in word_list:
            t = s[-5:] + t
            s = s[:-5]
        break
    
    if len(s) == 6:
        s_child_1 = s[-6:]
        if s_child_1 in word_list:
            t = s[-6:] + t
            s = s[:-6]
        break

    s_child_2 = s[-7:]
    if s_child_2 in word_list:
        t = s[-7:] + t
        s = s[:-7]
        flag = False

    s_child_1 = s[-6:]
    if s_child_1 in word_list:
        t = s[-6:] + t
        s = s[:-6]
        flag = False

    s_child_1 = s[-5:]
    if s_child_1 in word_list:
        t = s[-5:] + t
        s = s[:-5]
        flag = False
    
    if flag:
        break

if s_origin == t:
    print("YES")
else:
    print("NO")

Buggy submission (verdict: Runtime Error):
s = input()
s_origin = s
t = ""
word_list = ["dream", "dreamer", "erase", "eraser"]
while True:
    if len(s) <= 4:
        break

    if len(s) == 5:
        s_child_1 = s[-5:]
        if s_child_1 in word_list:
            t = s[-5:] + t
            s = s[:-5]
        break

    s_child_2 = s[-6:]
    if s_child_2 in word_list:
        t = s[-6:] + t
        s = s[:-6]
        flag = False

    s_child_1 = s[-5:]
    if s_child_1 in word_list:
        t = s[-5:] + t
        s = s[:-5]
        flag = False
    
    if flag:
        break

if s_origin == t:
    print("YES")
else:
    print("NO")
Problem p02995 (python)

Fixed submission:
a,b,c,d = map(int,input().split(" "))
dif = 0
plus = 0

gcd = c
t = d
while t:
    gcd, t = t, gcd % t

lcm = c * d // gcd
e = b + 1 - a

dif += b // c - (a - 1) // c
dif += b // d - (a - 1) // d
plus += b // lcm - (a -1) // lcm

print(e - dif + plus)

Buggy submission (verdict: Runtime Error):
import math

a,b,c,d = map(int,input().split(" "))
dif = 0
plus = 0
lcm = c * d // math.gcd(c,d)
e = b + 1 - a

dif += b // c - (a - 1) // c
dif += b // d - (a - 1) // d
if c != d:
    plus += b // lcm - (a -1) // lcm

print(e - dif + plus)
Problem p03001 (python)

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

if x == w/2 and y == h/2:
    print('{:.6f}'.format(w*h/2),1)
else:
    print('{:.6f}'.format(w*h/2),0)

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

if a.count(max(a)) > 1:
    print('{:.6f}'.format(w*h/2,1)
else:
    print('{:.6f}'.format(w*h/2,0)
Problem p02708 (python)

Fixed submission:
n, k = map(int, input().split())
if n < k:
    print(1)
    exit(0)

MOD = pow(10, 9) + 7
count = 0
while n+1 >= k:
    minv = k * (k-1) // 2
    maxv = ((n+1) * n // 2) - ((n-k) * (n-k+1) // 2)

    count += (maxv - minv + 1)
    count %= MOD
    k += 1

print(count)

Buggy submission (verdict: Runtime Error):
    n, k = map(int, input().split())
    if n < k:
        print(1)
        exit(0)

    MOD = pow(10, 9) + 7
    count = 0
    while n+1 >= k:
        minv = k * (k-1) // 2
        maxv = ((n+1) * n // 2) - ((n-k) * (n-k+1) // 2)

        count += (maxv - minv + 1)
        count %= MOD
        k += 1

    print(count)
Problem p02801 (python)

Fixed submission:
c = input()
print(chr(ord(c)+1))

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

ac = 0
wa = [0]*n
d = [False]*n

for _ in range(m):
    p, s = input().split()
    p = int(p)-1
    if not d[p] and s == 'AC':
        ac += 1
        d[p] = True
    elif not d[p] and s == 'WA':
        wa[p] += 1
p = 0
for i in range(n):
    if d[i]:
        p += wa[i]
print(ac, p)
Problem p02823 (python)

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

d = b - a
if d % 2 == 0:
    print(d//2)
else:
    f = min(a - 1, n - b) + d//2 + 1
    print(f)

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

d = b - a + 1
print(math.ceil(d/2))
Problem p02842 (python)

Fixed submission:
N=int(input())
X=int(N*100/108)
print(X if int(X*1.08)==N else X+1 if int((X+1)*1.08)==N else ':(')

Buggy submission (verdict: Runtime Error):
N=int(input())
X=int(int(N*100/108)*1.08)
print([':(',d][X==N])

Buggy submission (verdict: Runtime Error):
n=int(input())
d,m=divmod(n,1.08)
print[':(',d][m==0 or m<=0.5])
Problem p02743 (python)

Fixed submission:
import math

ABC = input().split()

a = int(ABC[0])
b = int(ABC[1])
c = int(ABC[2])
#a = b = c = pow(10,9)

l2  = 4 * a * b
r = c - a - b
r2 = r * r

# if l2 < r2:
#     print("Yes")
# else:
#     print("No")

if r > 0 :
    if l2 < r2:
        print("Yes")
    else:
        print("No")
else:
    print("No")

Buggy submission (verdict: Runtime Error):
import math

ABC = input().split()

a = int(ABC[0])
b = int(ABC[1])
c = int(ABC[2])
#a = b = c = pow(10,9)

l = 2*math.sqrt(a*b)
r = c - a - b

lint = int(l)

rl = r-l

# print(str(l) + " " + str(r))

# print(str(l-float(lint)) + " " + str(rl))

# print(math.isclose(0,rl))
if  math.isclose(0,rl)==True:
    print("Yes")
elif 0 < rl:
    print("Yes")
else:
    print("No")

Buggy submission (verdict: Runtime Error):
import math

ABC = input().split()

a = int(ABC[0])
b = int(ABC[1])
c = int(ABC[2])
#a = b = c = pow(10,9)

l = 2*math.sqrt(a*b)
r = c - a - b

lint = int(l)

rl = r-l

# print(str(l) + " " + str(r))

# print(str(l-float(lint)) + " " + str(rl))

# print(math.isclose(0,rl))
if  math.isclose(0,rl):
    print("Yes")
elif 0 < rl:
    print("Yes")
else:
    print("No")

Buggy submission (verdict: Runtime Error):
import math

ABC = input().split()

a = int(ABC[0])
b = int(ABC[1])
c = int(ABC[2])
#a = b = c = pow(10,9)

l = 2*math.sqrt(a*b)
r = c - a - b

lint = int(l)

rl = r-l

# print(str(l) + " " + str(r))

# print(str(l-float(lint)) + " " + str(rl))

# print(math.isclose(0,rl))

if 0 < rl or math.isclose(0,rl):
    print("Yes")
else:
    print("No")

Buggy submission (verdict: Runtime Error):
import math

ABC = input().split()

a = int(ABC[0])
b = int(ABC[1])
c = int(ABC[2])
#a = b = c = pow(10,9)

l = 2*math.sqrt(a*b)
r = c - a - b

lint = int(l)

rl = r-l

# print(str(l) + " " + str(r))

# print(str(l-float(lint)) + " " + str(rl))

if 0 < rl or math.isclose(0,rl):
    print("Yes")
else:
    print("No")
Problem p02866 (python)

Fixed submission:
import collections
N = int(input())

D = [int(a) for a in input().split() ]

counted = collections.Counter(D)

if D[0] != 0 or counted[0] !=1:
    print("0")
    exit()

#calc
result = 1
x = counted[1]
for i in range(2,N+1):
    y = counted[i]
    result = result * pow(x,y) %998244353
    x = y
print(result)

Buggy submission (verdict: Runtime Error):

N = int(input())

D = [int(a) for a in input().split() ]

if D[0] != 0 or D.count(0) !=1:
    print("0")
    exit()

D.sort()
#D = D[1:]
m = max(D)
counted = []

for i in range(1,m):
    c = D.count(i)
    if c != 0:
        counted.append(c)

#calc
result = 1
x = counted[0]
for i in range(1,len(counted)):
    y = counted[i]
    result = result * pow(x,y)
    x = y
print(result%998244353)
Problem p03068 (python)

Fixed submission:
N = int(input())
S = list(input())
K = int(input())

a = S[K-1]

for i in range(N):
    if S[i] != a:
        S[i] = "*"

print(''.join(S))

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

a = S[K]-1

for i in range(N):
    if S[i] != a:
        S[i] = "*"

print(''.join(S))

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

a = S[K]

for i in range(N):
    if S[i] != a:
        S[i] = "*"

print(''.join(S))
Problem p02743 (python)

Fixed submission:
from math import sqrt
# map(int,input().split())
a,b,c = map(int,input().split())
if (c-a-b>0)and(4*a*b < (c-a-b)*(c-a-b)):
  print("Yes")
else:
  print("No")

Buggy submission (verdict: Runtime Error):
from math import sqrt
# map(int,input().split())
a,b,c = map(int,input().split())
if 4*a*b < (c-a-b)*(c-a-b):
  print("Yes")
else if 4*a*b >= (c-a-b)*(c-a-b):
  print("No")
else:
  print("Yes")
Problem p02780 (python)

Fixed submission:
N, K = map(int, input().split())
P = list(map(int, input().split()))
# print(P)
E = [(p*(p+1))/(2*p) for p in P]
# print([sum(E[i:i+K]) for i in range(N-K+1)])
S = [0]
for i in range(N):
    S.append(S[i] + E[i])
print(max([S[i+K] - S[i] for i in range(N-K+1)]))

Buggy submission (verdict: Runtime Error):
N, K = map(int, input().split())
P = list(map(int, input().split()))
# print(P)
E = [(p*(p+1))/(2*p) for p in P]
print(max([sum(E[i:i+K]) for i in range(N-K)]))
Problem p02843 (python)

Fixed submission:
X = int(input())
dp = [0] * (X+1000)
for i in range(6):
    dp[100+i] = 1
for i in range(X+10):
    for k in range(6):
        if i - 100 - k > 0:
            dp[i] = dp[i] | dp[i-100-k]
print(dp[X])

Buggy submission (verdict: Runtime Error):
X = int(input())
dp = [False] * (X+100)
for i in range(6):
    dp[100+i] = True
for i in range(X+10):
    for k in range(6):
        if i - 100 - k > 0:
            dp[i] = dp[i] or dp[i-100-k]
print(1 if dp[X] else 0)

Buggy submission (verdict: Runtime Error):
X = int(input())
dp = [False] * (X+100)
for i in range(6):
    dp[100+i] = True
for i in range(107, X+10):
    for k in range(6):
        dp[i] = dp[i] or dp[i-100-k]
print(1 if dp[X] else 0)

Buggy submission (verdict: Runtime Error):
X = int(input())
dp = [False] * (X+100)
for i in range(6):
    dp[100+i] = True
for i in range(107, X+100):
    for k in range(6):
        dp[i] = dp[i] or dp[i-100-k]
print(1 if dp[X] else 0)

Buggy submission (verdict: Runtime Error):
X = int(input())
dp = [False] * (X+100)
for i in range(6):
    dp[100+i] = True
for i in range(107, X+100):
    for k in range(6):
        dp[i] = dp[i] or dp[i-100-k]
print(1 if dp[X] else 0)
Problem p02995 (python)

Fixed submission:
from fractions import gcd


def lcm(a, b):
    return (a*b)//gcd(a, b)


A, B, C, D = map(int, input().split())
sc = B//C - (A-1)//C
sd = B//D - (A-1)//D
scd = B//lcm(C, D) - (A-1)//lcm(C, D)
#print(B//lcm(C, D), (A-1)//lcm(C, D))
#print(sc, sd, scd, B-A+1)
print(B-A+1 - sc - sd + scd)

Buggy submission (verdict: Runtime Error):
from fractions import gcd
A, B, C, D = map(int, input().split())
sc = B//C - (A-1)//C
sd = B//D - (A-1)//D
scd = B//gcd(C, D) - (A-1)//math.gcd(C, D)
print(sc, sd, scd, B-A+1)
print(B-A+1 - sc - sd + scd)

Buggy submission (verdict: Runtime Error):
import math
A, B, C, D = map(int, input().split())
sc = B//C - (A-1)//C
sd = B//D - (A-1)//D
scd = B//math.gcd(C, D) - (A-1)//math.gcd(C, D)
print(sc, sd, scd, B-A+1)
print(B-A+1 - sc - sd + scd)

Buggy submission (verdict: Runtime Error):
import math
A, B, C, D = map(int, input().split())
sc = B//C - (A-1)//C
sd = B//D - (A-1)//D
scd = B//math.gcd(C, D) - (A-1)//math.gcd(C, D)
print(sc, sd, scd, B-A+1)
print(B-A+1 - sc - sd + scd)

Buggy submission (verdict: Runtime Error):
import math
A, B, C, D = map(int, input().split())
sc = B//C - (A-1)//C
sd = B//D - (A-1)//D
scd = B//(math.gcdC, D) - (A-1)//math.gcd(C, D)
print(sc, sd, scd, B-A+1)
print(B-A+1 - sc - sd + scd)
Problem p03001 (python)

Fixed submission:
W, H, x, y = map(int, input().split())
print(W*H/2, int(2*x == W and 2*y == H))

Buggy submission (verdict: Runtime Error):
W, H, x, y = map(int, input().split())
print(W*H//2, 1 int(x == y == W/2))
Problem p03031 (python)

Fixed submission:
N, M = map(int, input().split())
S = []
for _ in range(M):
    S.append(list(map(int, input().split()))[1:])
p = list(map(int, input().split()))
ans = 0
for bit in range(1 << N):
    for m in range(M):
        if p[m] != ([bin(bit)[2:].zfill(N)[s-1] for s in S[m]].count('1') % 2):
            break
    else:
        ans += 1
print(ans)

Buggy submission (verdict: Runtime Error):
N, M = map(int, input().split())
S = []
for _ in range(M):
    S.append(list(map(int, input().split()))[1:])
p = map(int, input().split())
ans = 0
for bit in range(1 << N):
    for m in range(M):
        if p[m] != ([str(bit).zfill(N)[s-1] for s in S[m]].count('1') % 2):
            break
    else:
        ans += 1
print(ans)
Problem p03071 (python)

Fixed submission:
a,b = map(int, input().split())
print(max(2*a-1, 2*b-1, a+b))

Buggy submission (verdict: Runtime Error):
A,B = map(int, input().split())
print(max(2*a-1, 2*b-1, a+b))
Problem p03087 (python)

Fixed submission:
N, Q = map(int, input().split())
S = input()
acc = [0] * (N+1)
for i in range(0, N):
    acc[i+1] = acc[i] + (i+1 < N and S[i+1] == "C" and S[i] == "A")
for i in range(Q):
    l, r = map(int, input().split())
    print(acc[r-1] - acc[l-1])

Buggy submission (verdict: Runtime Error):
N, Q = map(int, input().split())
S = input()
acc = [0] * (N+1)
for i in range(0, N):
    acc[i+1] = acc[i] + (S[i+1] == "C" and S[i] == "A")
for i in range(Q):
    l, r = map(int, input().split())
    print(acc[r-1] - acc[l-1])

Buggy submission (verdict: Runtime Error):
N, Q = map(int, input().split())
S = input()
acc = []
for i in range(1, Q+2):
    acc.append(S[0:i].count("AC"))

for i in range(Q):
    l, r = map(int, input().split())
    print(acc[r] - acc[l-1])

Buggy submission (verdict: Runtime Error):
N, Q = map(int, input().split())
S = input()
for i in range(Q):
    l, r = map(int, input().split())
    print(S[l-1, r].count("AC"))
Problem p03102 (python)

Fixed submission:
import numpy as np

N, M, C = map(int, input().split())
B = np.array(list(map(int, input().split())))
A = []
for i in range(N):
    A_i = list(map(int, input().split()))
    A.append(A_i)
A = np.array(A)

#ans = list((A@B) > -C).count(True)
ans = list((A.dot(B)) > -C).count(True)

print(ans)

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

N, M, C = map(int, input().split())
B = np.array(list(map(int, input().split())))
A = []
for i in range(N):
    A_i = list(map(int, input().split()))
    A.append(A_i)
A = np.array(A)

#ans = list((A@B) > -C).count(True)
ans = list((np.matmul(A, B)) > -C).count(True)

print(ans)

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

N, M, C = map(int, input().split())
B = np.array(list(map(int, input().split())))
A = []
for i in range(N):
    A_i = list(map(int, input().split()))
    A.append(A_i)
A = np.array(A)

ans = list((A@B) > -C).count(True)
print(ans)

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

N, M, C = map(int, input().split())
B = np.array(list(map(int, input().split())))
A = []
for i in range(N):
    A_i = list(map(int, input().split()))
    A.append(A_i)
A = np.array(A)

ans = list((A@B) > -C).count(True)
print(ans)
Problem p03109 (python)

Fixed submission:
S = input()
print('Heisei' if S <= '2019/04/30' else 'TBD')

Buggy submission (verdict: Runtime Error):
s = sorted(input())
t = sorted(input())[:: -1]
print("Yes" if s < t else "No")