Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Time Limit Exceeded):
N,M,K = map(int,input().split())
A = [int(i) for i in input().split()]
B = [int(i) for i in input().split()]
AA = [0]
BB = [0]
r = 0
for i in A:
    r += i
    AA.append(r)
r = 0
for i in B:
    r += i
    BB.append(r)
ans = 0
for i,v in enumerate(AA):
    for j,w in enumerate(BB):
        x = i+j
        y = v+w
        if y > K:
            break
        if x > ans:
            ans = x
print(ans)



Fixed submission:
N,M,K = map(int,input().split())
A = [int(i) for i in input().split()]
B = [int(i) for i in input().split()]
AA = [0]
BB = [0]
r = 0
for i in A:
    r += i
    AA.append(r)
r = 0
for i in B:
    r += i
    BB.append(r)
ans = 0
a = N
b = 0
while AA[a]+BB[b] > K:
    a -= 1
ans = a+b

while a >= 0:
    while b < M:
        if AA[a]+BB[b+1] <= K:
            b += 1
        else:
            break
    if ans < a+b:
        ans = a+b
    if b == M:
        break
    a -= 1
print(ans)

Buggy python submission (verdict: Runtime Error):
M,N,K = map(int,input().split())
A = [int(i) for i in input().split()]
B = [int(i) for i in input().split()]
m = 0
c = 0
while True:
    if len(A) == 0:
        r = B.pop(0)
    elif len(B) == 0:
        r = A.Pop(0)
    elif A[0] > B[0]:
        r = B.pop(0)
    else:
        r = A.pop(0)
    if m+r > K:
        break
    c += 1
    m += r
    if m+r >= K:
        break
print(c)


Fixed submission:
N,M,K = map(int,input().split())
A = [int(i) for i in input().split()]
B = [int(i) for i in input().split()]
AA = [0]
BB = [0]
r = 0
for i in A:
    r += i
    AA.append(r)
r = 0
for i in B:
    r += i
    BB.append(r)
ans = 0
a = N
b = 0
while AA[a]+BB[b] > K:
    a -= 1
ans = a+b

while a >= 0:
    while b < M:
        if AA[a]+BB[b+1] <= K:
            b += 1
        else:
            break
    if ans < a+b:
        ans = a+b
    if b == M:
        break
    a -= 1
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
N=int(input())
ans = 0
for i in range(1,N+1):
    e = N//i*i
    n = N//i
    ans += ((i+e)*n //2)
print(ans)


Fixed submission:
N=int(input())
ans = 0
for i in range(1,N+1):
    e = N//i*i
    n = N//i
    ans += ((i+e)*n //2)
print(ans)
Buggy python submission (verdict: Runtime Error):
n,m = map(int, input().split())
room = [[] for i in range(n)]
for i in range(m):
    a,b = map(int, input().split())
    room[a-1].append(b-1)
    room[b-1].append(a-1)
mark = [-1] * n
mark[0] = 0
q = []
q.append(0)

while len(q):
    now = q.pop(0)
    for i in room[now]:
        if mark[i] == -1:
            mark[i] = now
            q.append(i)

print("Yes")
for i in mark[1:]:
    print(i+1)


Fixed submission:
n=int(input())
m=n%10
if m == 3:
    s = 'bon'
elif m == 0 or m == 1 or m == 6 or m == 8:
    s = 'pon'
else:
    s = 'hon'
print(s)
Buggy python submission (verdict: Time Limit Exceeded):
a,b,n = map(int, input().split())
ans = 0
for i in range(n+1):
    c = a*i//b - a*(i//b)
    if ans > c:
        break
    ans = c
print(ans)


Fixed submission:
a,b,n = map(int, input().split())
if b-1 < n:
    n = b-1
print(a*(n)//b - a*((n) // b))
Buggy python submission (verdict: Time Limit Exceeded):
from math import gcd

n=int(input().strip())
s=input().strip()

c = 0
for i in range(n-2):
    for j in range(i+1,n-1):
        if s[i] == s[j]:
            continue
        for k in range(j+1,n):
            if j - i == k - j:
                continue
            if s[i] == s[k]:
                continue
            if s[j] == s[k]:
                continue
            c += 1
print(c)


Fixed submission:
from math import gcd

n=int(input().strip())
s=input().strip()

r = 0
g = 0
for i in s:
    if i == 'R':
        r += 1
    elif i == 'G':
        g += 1
ans = r * g * (n - r - g)

for i in range(0, n-1):
    for d in range(1, (n - i + 1) // 2):
        if s[i] != s[i+d] and s[i] != s[i+d+d] and s[i+d] != s[i+d+d]:
            ans -= 1
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
from math import gcd

n=int(input().strip())
s=input().strip()

c = 0
for i in range(n-2):
    for j in range(i+1,n-1):
        if s[i] == s[j]:
            continue
        for k in range(j+1,n):
            if j - i == k - j:
                continue
            if s[i] == s[k]:
                continue
            if s[j] == s[k]:
                continue
            c += 1
print(c)


Fixed submission:
from math import gcd

n=int(input().strip())
s=input().strip()

r = 0
g = 0
for i in s:
    if i == 'R':
        r += 1
    elif i == 'G':
        g += 1
ans = r * g * (n - r - g)

for i in range(0, n-1):
    for d in range(1, (n - i + 1) // 2):
        if s[i] != s[i+d] and s[i] != s[i+d+d] and s[i+d] != s[i+d+d]:
            ans -= 1
print(ans)
Buggy python submission (verdict: Runtime Error):
a = []
for i in range(5):
    a.append(int(input()))
x = min(filter(lambda x:x!= 0, map(lambda x:x%10, a)))
b = [(i+9) // 10 *10 for i in a]
print(sum(b) - (10 - x))

Fixed submission:
a = []
for i in range(5):
    a.append(int(input()))
y = 0
x = [i%10 for i in a]
if max(x) > 0:
    y = 10 - min(filter(lambda i:i!= 0, x))
b = [(i+9) // 10 *10 for i in a]
print(sum(b) - y)
Buggy python submission (verdict: Time Limit Exceeded):
S=input().strip()
N=len(S)

a=[0 if x == '0' else 1 for x in S]

while True:
    v = 0
    p = -1
    b = []
    for i in a:
        if p >= 0:
            if p == 0 or p == 1:
                if i == 0 or i == 1:
                    if p != i:
                        p = -1
                        v += 1
                        continue
            b.append(p)
        p = i
    if p >= 0:
        b.append(p)
    if v == 0:
        print(N - len(a))
        break
    a = b



Fixed submission:
from collections import deque
S=input().strip()
N=len(S)

a=[0 if x == '0' else 1 for x in S]

q = deque()
for i in a:
    if q:
        if q[-1] != i:
            q.pop()
        else:
            q.append(i)
    else:
        q.append(i)

print(N-len(q))

Buggy python submission (verdict: Time Limit Exceeded):
S=input().strip()
N=len(S)
q = [S]
while q:
    s = q.pop()
    p = ''
    v = 0
    for i,c in enumerate(s):
        if (p == '0' and c == '1') or (p == '1' and c == '0'):
            q.append(s[:i-1]+s[i+1:])
            v += 1
        p = c
    if v == 0:
        print(N-len(s))
        break

Fixed submission:
from collections import deque
S=input().strip()
N=len(S)

a=[0 if x == '0' else 1 for x in S]

q = deque()
for i in a:
    if q:
        if q[-1] != i:
            q.pop()
        else:
            q.append(i)
    else:
        q.append(i)

print(N-len(q))
Buggy python submission (verdict: Runtime Error):
n,m = map(int, input().split())
a=[]
for i in range(n):
    a.append(tuple(map(int, input().split())))

dp = []
for i in range(m+1):
    dp.append([0 for j in range(n+1)])

def f(fn):
    global dp, a
    for i in range(1,m+1):
        for j in range(1,n+1):
            dp[i][j] = max(dp[i][j-1], dp[i-1][j-1] + fn(a[j-1]))

ans = []
f(lambda x: x[0]+x[1]+x[2])
ans.append(dp[m][n])
f(lambda x: x[0]+x[1]-x[2])
ans.append(dp[m][n])
f(lambda x: x[0]-x[1]+x[2])
ans.append(dp[m][n])
f(lambda x: x[0]-x[1]-x[2])
ans.append(dp[m][n])
f(lambda x: -x[0]+x[1]+x[2])
ans.append(dp[m][n])
f(lambda x: -x[0]+x[1]-x[2])
ans.append(dp[m][n])
f(lambda x: -x[0]-x[1]+x[2])
ans.append(dp[m][n])
f(lambda x: -x[0]-x[1]-x[2])
ans.append(dp[m][n])

print(max(ans))


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

if a > 8 or b > 8:
    print(":(")
else:
    print("Yay!")
Buggy python submission (verdict: Runtime Error):
n, k = map(int, input().split())
li_light = list(map(int, input().split()))
 
def func(tuyosa):
  basho = [0] * n
  # 光が当たっている部分
  for i in range(n):
    min = i + 1 - tuyosa[i]
    max = i + 1 + tuyosa[i]
    a = 0
    while a <= n:
      if 1 <= min <= n:
        basho[min - 1] += 1
      min += 1
      if min > max:
        break
  return basho

if k > 41:
  k = 41
for i in range(k):
  li_light = (func(li_light))
  if li_light.count(n) == n:
    break
 
for k in li_light:
  print(k, end=" ")


Fixed submission:
full = input()
num = 0
for i in full:
  if num < 3:
    num += 1
    print(i, end="")
Buggy python submission (verdict: Runtime Error):
a, b, c, k = map(int, input().split())
li_card = []
for i in range(a):
  li_card.append(1)
for i in range(b):
  li_card.append(0)
for i in range(c):
  li_card.append(-1)

li_select = li_card[0:k]

print(sum(li_select))

Fixed submission:
s = input()
t = input()
len_t = len(t)
if t[0:len_t-1] == s:
  print("Yes")
else:
  print("No")
Buggy python submission (verdict: Time Limit Exceeded):
a, b, c, k = map(int, input().split())
li_card = []
for i in range(a):
  li_card.append(1)
for i in range(b):
  li_card.append(0)
for i in range(c):
  li_card.append(-1)

li_select = li_card[0:k]

print(sum(li_select))

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

if a >= k:
  a = k
  b = 0
  c = 0
if a < k and a+b >= k:
  c = 0
if a+b < k:
  c = k - a - b
  
sum_a = 1 * a
sum_c = -1 * c
  
print(sum_a + sum_c)
Buggy python submission (verdict: Time Limit Exceeded):
a, b, c, d = map(int, input().split())
if a > 0 and b > 0 and c > 0 and d > 0:
  print(max(a,b)*max(c,d))
elif a == 0 or b == 0 or c == 0 or d == 0:
  print(max([a*c, a*d, b*c, b*d]))
else:
  res = []
  for i in range(a, b+1):
    for j in range(c, d+1):
      res.append(i*j)
  print(max(res))

Fixed submission:
a, b, c, d = map(int, input().split())
print(max([a*c, b*c, a*d, b*d]))
Buggy python submission (verdict: Time Limit Exceeded):
from itertools import combinations

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

comb = combinations(a, 2)
res = 0
for i, j in comb:
  res += i*j
print(res%(10**9+7))

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

ans = 0
summ = sum(lst)
summ_sq = summ**2
for i in range(n):
    ans += lst[i]**2

res = (summ_sq-ans)//2
print(res % ((10**9)+7))
Buggy python submission (verdict: Runtime Error):
a, b, c = map(int, input())
k = int(input())

n = 0
while b <= a:
  b = b*2
  n += 1
while c <= b:
  c = c*2
  n += 1
if n <= k:
  print("Yes")
else:
  print("No")

Fixed submission:
a, b, c = map(int, input().split())
k = int(input())
 
n = 0
while b <= a:
  b = b*2
  n += 1
while c <= b:
  c = c*2
  n += 1
if n <= k:
  print("Yes")
else:
  print("No")

Buggy python submission (verdict: Runtime Error):
7 4 2
3

Fixed submission:
a, b, c = map(int, input().split())
k = int(input())
 
n = 0
while b <= a:
  b = b*2
  n += 1
while c <= b:
  c = c*2
  n += 1
if n <= k:
  print("Yes")
else:
  print("No")
Buggy python submission (verdict: Runtime Error):
n = int(input())
a = list(map(int, input()))
 
money = 1000
for i in range(n-1):
  if a[i] < a[i+1]:
    money += (a[i+1]-a[i]) * (money//a[i])
print(money)

Fixed submission:
n = int(input())
a = list(map(int, input().split()))
 
money = 1000
for i in range(n-1):
  if a[i] < a[i+1]:
    money += (a[i+1]-a[i]) * (money//a[i])
print(money)

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

money = 1000
for i in range(n-1):
  if a[i] < a[i+1]:
    money += (a[i-1]-a[i]) * (money//a[i])
print(money)

Fixed submission:
n = int(input())
a = list(map(int, input().split()))
 
money = 1000
for i in range(n-1):
  if a[i] < a[i+1]:
    money += (a[i+1]-a[i]) * (money//a[i])
print(money)
Buggy python submission (verdict: Time Limit Exceeded):
import math

n = int(input())
rn = int(math.sqrt(n))
for i in range(1, n+1):
  count = 0
  for x in range(1, rn):
    for y in range(1, rn):
      for z in range(1, rn):
        if x*x + y*y + z*z + x*z + x*y + y*z == i:
          count += 1
  print(count)

Fixed submission:
n = int(input())
arr = [0] * (n + 1)

for x in range(1, 101):
  for y in range(1, 101):
    for z in range(1, 101):
      a = x**2 + y**2 + z**2 + x*z + y*z + x*y
      if a<= n:
        arr[a] += 1
        
for i in range(1,n+1):
    print(arr[i])
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
a = list(map(int, input(). split(' ')))
for i in range(1, n+1):
  x = a.count(i)
  print(x)

Fixed submission:
N = int(input())
A = list(map(int, input().split()))
l = []
for i in range(N):
    l.append(0)
for x in A:
    l[x-1] += 1
for s in l:
    print(s)
Buggy python submission (verdict: Runtime Error):
Y = input()
X = int(Y)
if(X >= 500):
  a = X // 500
  b = X % 500
  if(b >= 5):
    c = (b//5)*5
  e = (a*1000) + c
  print(e)

Fixed submission:
s = int(input())
r = s% 500
print(s//500 * 1000 + r // 5 * 5)
Buggy python submission (verdict: Runtime Error):
n, x, m = map(int, input().split())
a = x
s = 0
h = []
h.append(a)
i = 0
fl = 0
while i < n:
    s += a
    a = (a*a) % m
    if a == 0:
      break
    i += 1
    if fl == 0 and a in h:
      fl = 1
      po = h.index(a)
      ss = 0
      for j in range(po):
        ss += h[j]
      s2 = s - ss
      f = (n - po) // (i - po)
      s2 *= f
      s = s2 + ss
      i2 = i - po
      i2 *= f
      i = i2 + po
    else:
      h.append(a)
print(s)

Fixed submission:
S = input()
if S[-1] == 's':
    a = S+'es'
else:
    a = S+'s'
print(a)
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
ac = 0
for a in range(1,n):
    be = n // a
    for b in range(1,be+1):
        c = n - a * b
        if c > 0:
            ac += 1
print(ac)

Fixed submission:
n = int(input())
ac = 0
for a in range(1,n):
    be = (n-1) // a
    ac += be
print(ac)
Buggy python submission (verdict: Time Limit Exceeded):
n, x, m = map(int, input().split())
a = x
s = 0
h = []
h.append(a)
i = 0
fl = 0
while i < n:
    s += a
    a = (a*a) % m
    if a == 0:
      break
    i += 1
    if fl == 0 and a in h:
      fl = 1
      po = h.index(a)
      ss = 0
      for j in range(po):
        ss += h[j]
      s2 = s - ss
      f = (n - po) // (i - po)
      s2 *= f
      s = s2 + ss
      i2 = i - po
      i2 *= f
      i = i2 + po
    else:
      h.append(a)
print(s)

Fixed submission:
n, x, m = map(int, input().split())
a = x
s = 0
h = []
h.append(a)
i = 0
fl = 0
while i < n:
    s += a
    a = (a*a) % m
    if a == 0:
      break
    i += 1
    if fl == 0 and a in h:
      fl = 1
      po = h.index(a)
      ss = 0
      for j in range(po):
        ss += h[j]
      s2 = s - ss
      f = (n - po) // (i - po)
      s2 *= f
      s = s2 + ss
      i2 = i - po
      i2 *= f
      i = i2 + po
    else:
      h.append(a)
print(s)
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
x = [] * N
y = [] * N
for i in range(N):
    a, b = list(map(int, input().split()))
    x.append(a)
    y.append(b)
d = 0
for i in range(N):
    for j in range(i+1, N):
        w = abs(x[i] - x[j]) + abs(y[i] - y[j])
        if w > d:
            d = w
print(d)

Fixed submission:
N = int(input())
x = [] * N
y = [] * N
for i in range(N):
    a, b = list(map(int, input().split()))
    x.append(a)
    y.append(b)
d = 0
ma = x[0] + y[0]
ima = 0
mi = x[0] + y[0]
imi = 0
for i in range(N):
    if x[i] + y[i] < mi:
        mi = x[i] + y[i]
        imi = i
    if x[i] + y[i] > ma:
        ma = x[i] + y[i]
        ima = i
d1 = abs(x[ima] - x[imi]) + abs(y[ima] - y[imi])
ma = - x[0] + y[0]
ima2 = 0
mi = - x[0] + y[0]
imi2 = 0
for i in range(N):
    if -x[i] + y[i] < mi:
        mi = -x[i] + y[i]
        imi2 = i
    if -x[i] + y[i] > ma:
        ma = -x[i] + y[i]
        ima2 = i
d2 = abs(x[ima2] - x[imi2]) + abs(y[ima2] - y[imi2])
if d1 > d2:
    print(d1)
else:
    print(d2)

Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
x = [] * N
y = [] * N
for i in range(N):
    a, b = list(map(int, input().split()))
    x.append(a)
    y.append(b)
d = 0
for i in range(N):
    for j in range(i+1, N):
        w = abs(x[i] - x[j]) + abs(y[i] - y[j])
        if w > d:
            d = w
print(d)

Fixed submission:
N = int(input())
x = [] * N
y = [] * N
for i in range(N):
    a, b = list(map(int, input().split()))
    x.append(a)
    y.append(b)
d = 0
ma = x[0] + y[0]
ima = 0
mi = x[0] + y[0]
imi = 0
for i in range(N):
    if x[i] + y[i] < mi:
        mi = x[i] + y[i]
        imi = i
    if x[i] + y[i] > ma:
        ma = x[i] + y[i]
        ima = i
d1 = abs(x[ima] - x[imi]) + abs(y[ima] - y[imi])
ma = - x[0] + y[0]
ima2 = 0
mi = - x[0] + y[0]
imi2 = 0
for i in range(N):
    if -x[i] + y[i] < mi:
        mi = -x[i] + y[i]
        imi2 = i
    if -x[i] + y[i] > ma:
        ma = -x[i] + y[i]
        ima2 = i
d2 = abs(x[ima2] - x[imi2]) + abs(y[ima2] - y[imi2])
if d1 > d2:
    print(d1)
else:
    print(d2)
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
a = list(map(int, input().split()))
ans = 0

am = [[0]*n for i in range(n)]
for i in range(n):
    am[i][i] = a[i]*a[i] % 1000000007
    for j in range(i+1, n):
        c = a[i]*a[j] % 1000000007
        am[i][j] = c
        am[j][i] = c

for i in range(n-1):
    if a[i] == 0:
        continue
    for j in range(i+1, n):
        ans += am[i][j]
ans %= 1000000007
print(ans)


Fixed submission:
n = int(input())
a = list(map(int, input().split()))
ans = 0
b = 0
c = 0
for i in range(n):
    b += a[i]
    c += a[i] * a[i]
ans = (b * b - c) // 2
ans %= 1000000007
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
a = list(map(int, input().split()))
ans = 0

am = [[0]*n for i in range(n)]
for i in range(n):
    for j in range(n):
        am[i][j] = a[i]*a[j] % 1000000007

for i in range(n-1):
    if a[i] == 0:
        continue
    for j in range(i+1, n):
        ans += am[i][j]
ans %= 1000000007
print(ans)


Fixed submission:
n = int(input())
a = list(map(int, input().split()))
ans = 0
b = 0
c = 0
for i in range(n):
    b += a[i]
    c += a[i] * a[i]
ans = (b * b - c) // 2
ans %= 1000000007
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
a = list(map(int, input().split()))
ans = 0

for i in range(n-1):
    if a[i] == 0:
        continue
    c = 0
    for j in range(i+1, n):
        c += a[j]
    ans += a[i] * c
ans %= 1000000007
print(ans)


Fixed submission:
n = int(input())
a = list(map(int, input().split()))
ans = 0
b = 0
c = 0
for i in range(n):
    b += a[i]
    c += a[i] * a[i]
ans = (b * b - c) // 2
ans %= 1000000007
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
a = list(map(int, input().split()))
for i in range(n):
    a[i] %= 1000000007
ans = 0
for i in range(n-1):
    for j in range(i+1, n):
        c = a[i] * a[j]
        c %= 1000000007 
        ans += c
ans %= 1000000007
print(ans)


Fixed submission:
n = int(input())
a = list(map(int, input().split()))
ans = 0
b = 0
c = 0
for i in range(n):
    b += a[i]
    c += a[i] * a[i]
ans = (b * b - c) // 2
ans %= 1000000007
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
a = list(map(int, input().split()))
ans = 0
for i in range(n-1):
    for j in range(i+1, n):
        ans += a[i] * a[j]
ans %= 1000000007
print(ans)


Fixed submission:
n = int(input())
a = list(map(int, input().split()))
ans = 0
b = 0
c = 0
for i in range(n):
    b += a[i]
    c += a[i] * a[i]
ans = (b * b - c) // 2
ans %= 1000000007
print(ans)
Buggy python submission (verdict: Runtime Error):
n = int(input())
a = 0
while True:
  while n > 0:
    a = a + (n % 10)
    n = int(n / 10)
  if a < 10:
      break
  n = a
  a = 0
if a == 9:
    print("Yes")
else:
    print("No")


Fixed submission:
n = str(input())
a = int(0)
for i in range(len(n)):
    a = a + int(n[i])
if a % 9 == 0:
    print("Yes")
else:
    print("No")
Buggy python submission (verdict: Runtime Error):
X, K, D = map(int, input().split())
if X == 0:
  if (K % 2 == 0):
    a = 0
  else:
    a = D
else:
  if X < 0:
    X = -X
  s = int(X/D)
  if K <= s:
    a = X - K * D
  else:
    if (K - s) % 2 == 1:
      a = abs(X - (s + 1) * D)
    else:
      a = abs(X - s * D)
print(a)

Fixed submission:
S = str(input())
a = 0
w = 0
for i in range(len(S)):
    if S[i] == 'R':
        w = w + 1
    else:
        if (w > a):
          a = w
        w = 0
if (w > a):
  a = w
print(a)

Buggy python submission (verdict: Runtime Error):
N = int(input())
L = list(map(int, input().split()))
a = 0
if N > 2:
    for i in range(N):
        for j in range(i+1, N):
            for k in range(j+1, N):
                if L[i] == L[j] or L[i] == L[k] or L[j] == L[k]:
                    continue
                if L[i] + L[j] > L[k] and L[i] + L[k] > L[j] and L[j] + L[k] > L[i]:
                    a = a + 1
print(a)

Fixed submission:
S = str(input())
a = 0
w = 0
for i in range(len(S)):
    if S[i] == 'R':
        w = w + 1
    else:
        if (w > a):
          a = w
        w = 0
if (w > a):
  a = w
print(a)
Buggy python submission (verdict: Runtime Error):
s = input()
t = input()

len_s = len(s)
len_t = len(t)

ans = 1000
for i in range(len_s - len_t + 1):
    cnt = 0
    l = []
    for j in range(len_t):
        if s[i + j] == t[j]:
            cnt += 1
        else:
            l.append(cnt)
            cnt = 0

    ans = min(ans, len_t - max(l))

print(ans)

Fixed submission:
s = input()
t = input()

len_s = len(s)
len_t = len(t)

ans = 1000
max_cnt = 0
for i in range(len_s - len_t + 1):
    cnt = 0
    l = []
    for j in range(len_t):
        if s[i : i + len_t][j] == t[j]:
            cnt += 1
        if s[i : i + len_t][j] != t[j]:
            cnt += 0
    max_cnt = max(max_cnt, cnt)

ans = min(ans, len_t - max_cnt)

print(ans)

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

len_s = len(s)
len_t = len(t)

ans = 1000
for i in range(len_s - len_t):
    cnt = 0
    l = []
    for j in range(len_t):
        if s[i + j] == t[j]:
            cnt += 1
        else:
            l.append(cnt)
            cnt = 0

    ans = min(ans, len_t - max(l))

print(ans)

Fixed submission:
s = input()
t = input()

len_s = len(s)
len_t = len(t)

ans = 1000
max_cnt = 0
for i in range(len_s - len_t + 1):
    cnt = 0
    l = []
    for j in range(len_t):
        if s[i : i + len_t][j] == t[j]:
            cnt += 1
        if s[i : i + len_t][j] != t[j]:
            cnt += 0
    max_cnt = max(max_cnt, cnt)

ans = min(ans, len_t - max_cnt)

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

n = int(input())
a = np.array(list(map(int, input().split())), dtype = 'object')
mod = 10**9 + 7

sq_sum_a = sum(a)**2
sum_sq_a = sum(a**2)

sum_cross = (sq_sum_a - sum_sq_a) // 2
ans = sum_cross % mod
# xy = ((x + y)**2 - (x**2 + y**2)) // 2

print(ans)

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

sum_sq_a = 0
for i in range(n):
    sum_sq_a += a[i]**2

ans = ((sum(a))**2 - sum_sq_a) // 2

print(ans % (10**9 + 7))

Buggy python submission (verdict: Runtime Error):
import itertools as it

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

c = list(it.combinations(a, 2))

ans = 0
for i in range(n):
    ans += int(c[i][0]) * int(c[i][1])

print(ans % (10**9 + 7))

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

sum_sq_a = 0
for i in range(n):
    sum_sq_a += a[i]**2

ans = ((sum(a))**2 - sum_sq_a) // 2

print(ans % (10**9 + 7))