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

Fixed submission:
H, W, K = map(int, input().split(' '))
C = []*H
ans=0
C = [list(input()) for _ in range(H)]
for paint_h in range(2**H):
    for paint_w in range(2**W):
        cnt = 0
        for i in range(H):
            for j in range(W):
                if (paint_h>>i)&1==0 and (paint_w>>j)&1==0:
                    if C[i][j] == '#':
                        cnt+=1
        if cnt==K:
            ans+=1
print(ans)

Buggy submission (verdict: Runtime Error):
H, W, K = map(int, input().split(' '))
C = []*H
ans=0
for i in range(H):
    C[i] = list(input())
for paint_h in range(2**H):
    for paint_w in range(2**W):
        cnt = 0
        for i in range(H):
            for j in range(W):
                if (paint_h<<i)&1==0 and (paint_w<<j)&1==0:
                    if C[i][j] == '#':
                        cnt+=1
        if cnt==K:
            ans+=1
print(ans)
Problem p03282 (python)

Fixed submission:
s = input()
k = int(input())

if s[0] != "1":
    print(int(s[0]))
else:
    count = 0
    i = 0
    if len(set(s)) == 1:
        print(1)
    else:
        while s[i] == "1":
            count += 1
            i += 1
        if k <= count:
            print(1)
        else:
            print(int(s[i]))

Buggy submission (verdict: Runtime Error):
s = input()
k = int(input())
if s[0] != "1":
    print(int(s[0]))
else:
    count = 0
    i = 0
    while s[i] == "1":
        count += 1
        i += 1
    if k <= count:
        print(1)
    else:
        print(int(s[i]))
Problem p03287 (python)

Fixed submission:
import math
import collections

#n,m = 3,2
#a = [4,1,5]
n, m = [int(i) for i in input().split()]
a = [int(i) for i in input().split()]
b = [0 for i in range(n)]
for i,ai in enumerate(a):
    if i == 0:
        b[i] = ai % m
    else:
        b[i] = (ai + b[i-1]) % m

ans = 0

def combinations_count(n, r):
    return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))

c = collections.Counter(b)
for i in c.values():
    if i >= 2:
        ans += combinations_count(i,2)

#for i in range(m):
#    c = b.count(i)    
#    if c >= 2:
#        ans += combinations_count(c,2)
ans += b.count(0)

print(ans)

Buggy submission (verdict: Runtime Error):
import math
import collections

#n,m = 3,2
#a = [4,1,5]
n, m = [int(i) for i in input().split()]
a = [int(i) for i in input().split()]
b = [0 for i in range(n)]
for i,ai in enumerate(a):
    if i == 0:
        b[i] = ai % m
    else:
        b[i] = (ai + b[i-1]) % m

ans = 0

def combinations_count(n, r):
    return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))

c = collections.Counter(b)
for i in c.values():
    ans += combinations_count(i,2)

#for i in range(m):
#    c = b.count(i)    
#    if c >= 2:
#        ans += combinations_count(c,2)
ans += b.count(0)

print(ans)

Buggy submission (verdict: Runtime Error):
import math
#n,m = 3,2
#a = [4,1,5]
n, m = [int(i) for i in input().split()]
a = [int(i) for i in input().split()]
b = [0 for i in range(n)]
for i,ai in enumerate(a):
    if i == 0:
        b[i] = ai % m
    else:
        b[i] = (ai + b[i-1]) % m

ans = 0

def combinations_count(n, r):
    return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))

for i in range(m):
    c = b.count(i)    
    if c >= 2:
        ans += combinations_count(c%m,2)
ans += b.count(0)

print(ans)
Problem p03309 (python)

Fixed submission:
import math
import statistics

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

b = [a[i]-(i+1) for i in range(n)]
median = statistics.median(b)

med1 = math.floor(median)
med2 = med1+1

t = sum([abs(i-med1) for i in b])
u = sum([abs(i-med2) for i in b])

print(min(t,u))

Buggy submission (verdict: Runtime Error):
import math

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

b = [a[i]-(i+1) for i in range(n)]

s = sum(b)
N = len(b)
mean = math.floor(s / N)
meanb = mean+1

t = sum([abs(b[i]-mean) for i in b])
u = sum([abs(b[i]-meanb) for i in b])

print(min(t,u))
Problem p03323 (python)

Fixed submission:
a,b = [int(i) for i in input().split()]
if a <= 8 and b <= 8:
    print("Yay!")
else:
    print(":(")

Buggy submission (verdict: Runtime Error):
a,b = [int i for i in input().split()]
if a <= 8 and b <= 8:
    print("Yay!")
else:
    print(":(")

Buggy submission (verdict: Runtime Error):
a = int(input())
b = int(input())
if a <= 8 and b <= 8:
    print("Yay!")
else:
    print(":(")
Problem p03370 (python)

Fixed submission:
n,x = (int(i) for i in input().split()) 
m = [int(input()) for i in range(n)] 
count_donut = 0 
for m_i in m:
    x = x - m_i
    count_donut +=1
count_donut += x // min(m)
print(count_donut)

Buggy submission (verdict: Runtime Error):
#https://agc023.contest.atcoder.jp/submissions/2429958
import math,string,itertools,fractions,heapq,collections,re,array,bisect,sys,random,time,copy,functools
 
sys.setrecursionlimit(10**7)
inf = 10**20
eps = 1.0 / 10**15
mod = 10**9+7
 
def LI(): return [int(x) for x in sys.stdin.readline().split()]
def LI_(): return [int(x)-1 for x in sys.stdin.readline().split()]
def LF(): return [float(x) for x in sys.stdin.readline().split()]
def LS(): return sys.stdin.readline().split()
def I(): return int(sys.stdin.readline())
def F(): return float(sys.stdin.readline())
def S(): return input()
def pf(s): return print(s, flush=True)
  
def main():
    n,x = LI()
    m = [I() for _ in range(n)]
    r = (x - m[0] - m[1] - m[2]) // (min(m))

    return r
 
print(main())
Problem p03379 (python)

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

mid_left = sortx[(n//2)-1]
mid_right = sortx[(n//2)]

for i in range(n):
    if x[i] <= mid_left:
        print(mid_right)
    else:
        print(mid_left)

Buggy submission (verdict: Runtime Error):
n = long(input())
x = [long(i) for i in input().split()]
sortx = sorted(x)

mid_left = sortx[(n//2)-1]
mid_right = sortx[(n//2)]

for i in range(n):
    if sortx[i] <= mid_left:
        print(mid_right)
    else:
        print(mid_left)
Problem p03385 (python)

Fixed submission:
a = input()
if a in ["abc","acb","bac","bca","cab","cba"]: #== ("abc" or "acb" or "bac" or "bca" or "cab" or "cba"):
  print("Yes")
else:
  print("No")

Buggy submission (verdict: Runtime Error):
a = sorted(int(i) for i in input().split()) 
print((a[1] - a[0]+1) // 2 + a[2] - a[1] + (a[1] - a[0]) % 2)

Buggy submission (verdict: Runtime Error):
A, B, K = (int(i) for i in input().split()) 
low = range(A,A+K)
high = range(B,B-K,-1)
t = sorted(list(set(low) | set(high)))
for s in t:
    if s >= A and s <= B:
        print(s)
Problem p03399 (python)

Fixed submission:
a = [int(input()) for i in range(2)]
b = [int(input()) for i in range(2)]
print(min(a)+min(b))

Buggy submission (verdict: Runtime Error):
N = int(input())
a = list(int(i) for i in input().split())  

sum = 0
for k in range(N):
  if k == 0:
    sum += abs(a[k])
  elif k == (N-1):
    sum += abs(a[k] - a[k-1]) + abs(a[k])
  else:
    sum += abs(a[k] - a[k-1])

for j in range(N):
  if j == 0:
    if (a[j+1] - a[j]) * (a[j] -0) >= 0:
      print(sum)
    else:
      print(sum - 2 * min(abs(a[j]),abs(a[j]-a[j+1])))
  elif j == N-1:  
    if (a[j] - a[j-1]) * (0 - a[j]) >= 0:
      print(sum)
    else:
      print(sum - 2 * min(abs(a[j]-a[j-1]),abs(a[j]-a[j+1])))
  else:
    if (a[j] - a[j-1] ) * (a[j+1] - a[j]) >= 0:
      print(sum)
    else:
      print(sum - 2 * min(abs(a[j]-a[j-1]),abs(a[j+1]-a[j])))

Buggy submission (verdict: Runtime Error):
N = int(input())
a = list(int(i) for i in input().split())  

sum = 0
for k in range(N):
  if k == 0:
    sum += abs(a[k])
  elif k == (N-1):
    sum += abs(a[k] - a[k-1]) + abs(a[k])
  else:
    sum += abs(a[k] - a[k-1])

for j in range(N):
  if j == 0:
    if (a[j+1] - a[j]) * (a[j] -0) >= 0:
      print(sum)
    else:
      print(sum - 2 * min(abs(a[j]),abs(a[j]-a[j+1])))
  elif j == N-1:  
    if (a[j] - a[j-1]) * (0 - a[j]) >= 0:
      print(sum)
    else:
      print(sum - 2 * mins(abs(a[j]-a[j-1]),abs(a[j]-a[j+1])))
  else:
    if (a[j] - a[j-1] ) * (a[j+1] - a[j]) >= 0:
      print(sum)
    else:
      print(sum - 2 * min(abs(a[j]-a[j-1]),abs(a[j+1]-a[j])))
Problem p03401 (python)

Fixed submission:
N = int(input())
a = list(int(i) for i in input().split())  

sum = 0
for k in range(N):
  if k == 0:
    sum += abs(a[k])
  elif k == (N-1):
    sum += abs(a[k] - a[k-1]) + abs(a[k])
  else:
    sum += abs(a[k] - a[k-1])

for j in range(N):
  if j == 0:
    if (a[j+1] - a[j]) * (a[j] -0) >= 0:
      print(sum)
    else:
      print(sum - 2 * min(abs(a[j]),abs(a[j]-a[j+1])))
  elif j == N-1:  
    if (a[j] - a[j-1]) * (0 - a[j]) >= 0:
      print(sum)
    else:
      print(sum - 2 * min(abs(a[j]-a[j-1]),abs(a[j])))
  else:
    if (a[j] - a[j-1] ) * (a[j+1] - a[j]) >= 0:
      print(sum)
    else:
      print(sum - 2 * min(abs(a[j]-a[j-1]),abs(a[j+1]-a[j])))

Buggy submission (verdict: Runtime Error):
N = int(input())
a = list(int(i) for i in input().split())  

sum = 0
for k in range(N):
  if k == 0:
    sum += abs(a[k])
  elif k == (N-1):
    sum += abs(a[k] - a[k-1]) + abs(a[k])
  else:
    sum += abs(a[k] - a[k-1])

for j in range(N):
  if j == 0:
    if (a[j+1] - a[j]) * (a[j] -0) >= 0:
      print(sum)
    else:
      print(sum - 2 * min(abs(a[j]),abs(a[j]-a[j+1])))
  elif j == N-1:  
    if (a[j] - a[j-1]) * (0 - a[j]) >= 0:
      print(sum)
    else:
      print(sum - 2 * min(abs(a[j]-a[j-1]),abs(a[j]-a[j+1])))
  else:
    if (a[j] - a[j-1] ) * (a[j+1] - a[j]) >= 0:
      print(sum)
    else:
      print(sum - 2 * min(abs(a[j]-a[j-1]),abs(a[j+1]-a[j])))
Problem p03470 (python)

Fixed submission:
#8th
n = int(input())
a = set(float(input()) for i in range(n))
# a_ = [[int(i) for i in input()] for j in range(n)]
# a = set(_[0] for _ in a_)
print(len(a))

Buggy submission (verdict: Runtime Error):
n = int(input())
a_ = [[int(i) for i in input()] for j in range(n)]
a = set([_ for _ in a_])
print(len(a))

Buggy submission (verdict: Runtime Error):
n = int(input())
a_ = [[int(i) for i in input()] for j in range(n)]
a = set([_[0][0] for _ in a_])
print(len(a))

Buggy submission (verdict: Runtime Error):
a = set(float(input()) for i in range(n))
print(len(a))
Problem p03138 (python)

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

max_bit = 40
ans = 0
for i in range(max_bit, -1, -1):
  bit = 2 ** i
  c = len([1 for j in a if j&bit > 0])
  if 2*c < N and bit <= K:
    c = N - c
    K -= bit
  ans += bit * c
print(ans)

Buggy submission (verdict: Runtime Error):
N, K = map(int, input().split())
l = list(map(int, input().split()))
first = True
for i in range(K):
  s = 0
  
  for j in l:
    s += i ^ j
    
  if first:
    m = s
    first = False
  else:
    if m < s:
      m = s
print(m)
Problem p03145 (python)

Fixed submission:
a, b, c = map(int, input().split())
sum_ = a * b / 2
print(int(sum_))

Buggy submission (verdict: Runtime Error):
a,b,c = map(int, input().split())
return a*b/2
Problem p02536 (python)

Fixed submission:
class UnionFind():
    def __init__(self, n):
        self.n = n
        self.parents = [-1] * n

    def find(self, x):
        if self.parents[x] < 0:
            return x
        else:
            self.parents[x] = self.find(self.parents[x])
            return self.parents[x]

    def union(self, x, y):
        x = self.find(x)
        y = self.find(y)

        if x == y:
            return

        if self.parents[x] > self.parents[y]:
            x, y = y, x

        self.parents[x] += self.parents[y]
        self.parents[y] = x

    def roots(self):
        return [i for i, x in enumerate(self.parents) if x < 0]
      
    def group_count(self):
        return len(self.roots())

n, m = map(int, input().split())
un = UnionFind(n)
for _ in range(m):
    a, b = map(int, input().split())
    a -= 1
    b -= 1
    un.union(a, b)
print(un.group_count() - 1)

Buggy submission (verdict: Runtime Error):
class UnionFind():
    def __init__(self, n):
        self.n = n
        self.parents = [-1] * n

    def find(self, x):
        if self.parents[x] < 0:
            return x
        else:
            self.parents[x] = self.find(self.parents[x])
            return self.parents[x]

    def union(self, x, y):
        x = self.find(x)
        y = self.find(y)

        if x == y:
            return

        if self.parents[x] > self.parents[y]:
            x, y = y, x

        self.parents[x] += self.parents[y]
        self.parents[y] = x

    def roots(self):
        return [i for i, x in enumerate(self.parents) if x < 0]
      
    def group_count(self):
        return len(self.roots())

n, m = map(int, input().split())
un = UnionFind(n)
for _ in range(m):
    a, b = map(int, input().split())
    un.union(a, b)
print(un.group_count() - 1)

Buggy submission (verdict: Runtime Error):
class UnionFind():
    def __init__(self, n):
        self.n = n
        self.parents = [-1] * n

    def find(self, x):
        if self.parents[x] < 0:
            return x
        else:
            self.parents[x] = self.find(self.parents[x])
            return self.parents[x]

    def union(self, x, y):
        x = self.find(x)
        y = self.find(y)

        if x == y:
            return

        if self.parents[x] > self.parents[y]:
            x, y = y, x

        self.parents[x] += self.parents[y]
        self.parents[y] = x

    def roots(self):
        return [i for i, x in enumerate(self.parents) if x < 0]
      
    def group_count(self):
        return len(self.roots)

n, m = map(int, input().split())
un = UnionFind(n)
for _ in range(m):
    a, b = map(int, input().split())
    un.union(a, b)
print(un.group_count() - 1)
Problem p02630 (python)

Fixed submission:
n = int(input())
lst = [int(i) for i in input().split()]
dic = {}
for i in range(n):
  key = lst[i]
  if key not in dic:
    dic[key] = 0
  dic[key] += 1
#print(dic)
sum = 0
for key, value in dic.items():
  sum += key * value

m = int(input())
for _ in range(m):
  lst_s = list(map(int, input().split()))
  number = dic.get(lst_s[0])
  if number is not None:
    if lst_s[1] in dic:
      dic[lst_s[1]] += number
    else:
      dic[lst_s[1]] = number
    sum += lst_s[1] * number
    sum -= lst_s[0] * number
    dic.pop(lst_s[0])
  print(sum)

Buggy submission (verdict: Runtime Error):
for i in range(n):
  key = lst[i]
  if key not in dic:
    dic[key] = 0
  dic[key] += 1
#print(dic)
sum = 0
for key, value in dic.items():
  sum += key * value

m = int(input())
for _ in range(m):
  lst_s = list(map(int, input().split()))
  number = dic.get(lst_s[0])
  if number is not None:
    if lst_s[1] in dic:
      dic[lst_s[1]] += number
    else:
      dic[lst_s[1]] = number
    sum += lst_s[1] * number
    sum -= lst_s[0] * number
    dic.pop(lst_s[0])
  print(sum)
Problem p02641 (python)

Fixed submission:
n, m = map(int, input().split())
if m == 0:
  lst = []
else:
  lst = [int(i) for i in input().split()]

nums = []
min_l = 1000
for i in range(103):
  if i in lst:
    continue
  l = abs(i - n)
  if l < min_l:
    min_l = l
    min_num = i
  elif l >= min_l:
    break
print(min_num)

Buggy submission (verdict: Runtime Error):
n, m = map(int, input().split())
if m == 0:
  lst = []
else:
  lst = [int(i) for i in input().split()]

nums = []
min_l = 1000
for i in range(1, 101):
  if i in lst:
    continue
  l = abs(i - n)
  if l < min_l:
    min_l = l
    min_num = i
  elif l >= min_l:
    break
print(min_num)

Buggy submission (verdict: Runtime Error):
n, m = map(int, input().split())
if m == 0:
  lst = []
else:
  lst = [int(i) for i in input().split()]

nums = []
min_num = 1000
for i in range(1, 101):
  if i in lst:
    continue
  l = abs(i - n)
  if l < min_num:
    min_num = l
    nums.append(i)
  elif l > min_num:
    break
print(nums[-1])

Buggy submission (verdict: Runtime Error):
n, m = map(int, input().split())
if m == 0:
  lst = []
else:
  lst = [int(i) for i in k.split()]

nums = []
min_num = 1000
for i in range(1, 101):
  if i in lst:
    continue
  l = abs(i - n)
  if l < min_num:
    min_num = l
    nums.append(i)
  elif l > min_num:
    break
print(nums[-1])
Problem p02660 (python)

Fixed submission:
n = int(input())

lst = []
while n % 2 == 0:
  lst.append(2)
  n //= 2
f = 3
while f * f <= n:
  if n % f == 0:
    lst.append(f)
    n //= f
  else:
    f += 2
if n != 1:
  lst.append(n)
#print(lst)
count = 0
while lst:
  s = 0
  i = 1
  num = lst[0]
  for ele in lst:
    if ele == num:
      s += 1
  for j in range(s):
    lst.remove(num)
  while s > 0:
    s -= i
    i += 1
    if s >= 0:
      count += 1
  #print(lst)
print(count)

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

lst = [1] * (n + 1)
if n == 1:
  print(0)
else:
  count = 0
  num = n
  for i in range(2, n + 1):
    if lst[i] == 0:
      continue
    for j in range(i, n + 1, i):
      lst[j] = 0
      if num % j == 0:
        num /= j
        count += 1
      if num % j == num:
        break
    if num == 1:
      break
  print(count)
Problem p02691 (python)

Fixed submission:
n = int(input())
lst = [int(i) for i in input().split()]

dic = {}
count = 0
for i in range(n):
  num = lst[i]
  a = i + num
  if a not in dic:
    dic[a] = 1
  else:
    dic[a] += 1
  b = i - num
  if b in dic:
    count += dic[b]
print(count)

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

dic = {}
for i in range(n):
  a = lst[i]
  if a >= n - 1:
    continue
  if a not in dic:
    dic[a] = set()
  dic[a].add(i)
#print(dic)
count = 0
for a in dic.keys():
  set_ = dic[a]
  for index in set_:
    b = a + index
    if b > n:
      continue
    for j in dic.keys():
      j = b + c
      if c in dic[c]:
        count += 1
print(count)
Problem p02730 (python)

Fixed submission:
w = input()
l = len(w)
flag = True
for i in range((l - 1)//2):
  if w[i] != w[l - i - 1]:
    flag = False
    break
mid = (l - 1) // 2
mid_mid = mid // 2
for i in range(mid_mid + 1):
  if w[i] != w[mid - i - 1] or not flag:
    flag = False
    break
  if w[i + mid + 1] != w[l - i - 1]:
    flag = False
    break
if flag:
  print('Yes')
else:
  print('No')

Buggy submission (verdict: Runtime Error):
w = input()
l = len(w)
flag = True
for i in range((l - 1)/2):
  if w[i] != w[l - i - 1]:
    flag = False
    break
mid = (l - 1)/2
mid_mid = mid // 2
for i in range(mid_mid + 1):
  if w[i] != w[mid - i - 1] or not flag:
    flag = False
    break
  if w[i + mid + 1] != w[l - i - 1]:
    flag = False
    break
if flag:
  print('Yes')
else:
  print('No')
Problem p02812 (python)

Fixed submission:
n = int(input())
words = input()

count = 0
for i in range(n - 2):
  if words[i] == 'A':
    if words[i + 1] == 'B':
      if words[i + 2] == 'C':
        count += 1
print(count)

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

count ≒ 0
for i in range(n - 2):
  if words[i] == 'A':
    if words[i + 1] == 'B':
      if words[i + 2] == 'C':
        count += 1
print(count)
Problem p02844 (python)

Fixed submission:
n = int(input())
numbers = input()

lst = []
ans = []
for i in range(n):
  pin = ''
  if numbers[i] not in lst:
    pin += numbers[i]
    lst.append(pin)
    lst2 = []
    for j in range(i+1, n):
      pin += numbers[j]
      if pin[1] not in lst2:
        lst2.append(pin[1])
        lst3 = []
        for k in range(j+1, n):
          pin += numbers[k]
          if pin[2] not in lst3:
            lst3.append(pin[2])
            ans.append(pin)
          if ('0' in lst3) and ('1' in lst3) and ('2' in lst3) and ('3' in lst3) and ('4' in lst3) and ('5' in lst3) and ('6' in lst3) and ('7' in lst3) and ('8' in lst3) and ('9' in lst3):
            break
          pin = pin[0] + pin[1]
      if ('0' in lst2) and ('1' in lst2) and ('2' in lst2) and ('3' in lst2) and ('4' in lst2) and ('5' in lst2) and ('6' in lst2) and ('7' in lst2) and ('8' in lst2) and ('9' in lst2):
        break
      pin = pin[0]
    if ('0' in lst) and ('1' in lst) and ('2' in lst) and ('3' in lst) and ('4' in lst) and ('5' in lst) and ('6' in lst) and ('7' in lst) and ('8' in lst) and ('9' in lst):
      break
print(len(ans))

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

lst = []
lst2 = []
lst3 = []
for i in range(n):
  pin = ''
  if numbers[i] not in lst:
    pin += numbers[i]
    lst.append(pin)
    for j in range(i+1, n):
      pin += numbers[j]
      if pin not in lst2:
        lst2.append(pin)
        for k in range(j+1, n):
          pin += numbers[k]
          if pin not in lst3:
            lst3.append(pin)
          pin = pin[0] + pin[1]
      pin = pin[0]
    if ('0' in lst) and ('1' in lst) and ('2' in lst) and ('3' in lst) and ('4' in lst) and ('5' in lst) and ('6' in lst) and ('7' in lst) and ('8' in lst) and ('9' in lst):
      break
print(lst2[:][1])
print(len(lst3))
Problem p02608 (python)

Fixed submission:
import sys
import heapq, math
from itertools import zip_longest, permutations, combinations, combinations_with_replacement
from itertools import accumulate, dropwhile, takewhile, groupby
from functools import lru_cache
from copy import deepcopy

N = int(input())

cnt = [0] * 10010

for x in range(1, 100):
    for y in range(1, 100):
        for z in range(1, 100):
            calc = x ** 2 + y ** 2 + z ** 2 + x * y + y * z + z * x
            if calc <= N:
                cnt[calc] += 1

for i in range(1, N + 1):
    print(cnt[i])

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

cnt = [0] * 6 * 10000 + 1

for x in range(1, 100):
    for y in range(1, 100):
        for z in range(1, 100):
            cnt[x ** 2 + y ** 2 + z ** 2 + x * y + y * z + z * x] += 1

for i in range(1, N + 1):
    print(cnt[i])
Problem p03000 (python)

Fixed submission:
import sys
import heapq, math
from itertools import zip_longest, permutations, combinations, combinations_with_replacement
from itertools import accumulate, dropwhile, takewhile, groupby
from functools import lru_cache
from copy import deepcopy

N, X = map(int, input().split())
A = list(map(int, input().split()))

D = 0
cnt = 0
while D <= X and cnt <= N:
    if cnt != N:
        D += A[cnt]
    cnt += 1

print(cnt)

Buggy submission (verdict: Runtime Error):
import sys
import heapq, math
from itertools import zip_longest, permutations, combinations, combinations_with_replacement
from itertools import accumulate, dropwhile, takewhile, groupby
from functools import lru_cache
from copy import deepcopy

N, X = map(int, input().split())
A = list(map(int, input().split()))

D = 0
cnt = 0
while D <= X:
    D += A[cnt]
    cnt += 1

print(cnt)
Problem p03287 (python)

Fixed submission:
import sys
import heapq, math
from itertools import zip_longest, permutations, combinations, combinations_with_replacement
from itertools import accumulate, dropwhile, takewhile, groupby
from functools import lru_cache
from copy import deepcopy

N, M = map(int, input().split())
A = list(map(int, input().split()))

B = {}
s = 0
ans = 0
B[0] = 1
for a in A:
    s = (s + a) % M
    ans += B.get(s, 0)
    B[s] = B.get(s, 0) + 1

print(ans)

Buggy submission (verdict: Runtime Error):
import sys
import heapq, math
from itertools import zip_longest, permutations, combinations, combinations_with_replacement
from itertools import accumulate, dropwhile, takewhile, groupby
from functools import lru_cache
from copy import deepcopy

N, M = map(int, input().split())
A = list(map(int, input().split()))

B = [0] * M
s = 0
ans = 0
B[0] = 1
for a in A:
    s = (s + a) % M
    ans += B[s]
    B[s] += 1

print(ans)