Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Time Limit Exceeded):
import math
import copy

def secize(n, k):
    n2=bin(n)
    n3=n2[2:]
    for i in range(k-len(n2)+2):
        n3='0'+n3
    return n3


n=int(input())
alist = list(map(int,input().split()))
saidai=max(alist)
keta=math.ceil(math.log(saidai+1, 2))
blist=[]
for i in range(n):
    kaz=secize(alist[i], keta)
    blist.append(kaz)

now1=0
now2=0
nowarr=[]
for bl in blist[0]:
    nowarr.append(int(bl))
#nowarr=[0]*keta
answer=0
swit=0
"""
for bl in blist:
    print(bl)
"""
while now1<=n-2 and now2<=n-2:
    #print(now1, now2, nowarr, answer)
    maearr=copy.deepcopy(nowarr)
    for i in range(keta):
        if blist[now2+1][i]=='1':
            if nowarr[i]==1:
                swit=1
            else:
                nowarr[i]=1
    if swit==1:
        answer+=(now2-now1+1)
        nowarr=maearr
        for i in range(keta):
            if blist[now1][i]=='1':
                nowarr[i]=0
        if now1==now2:
            nowarr=[]
            for bl in blist[now1+1]:
                nowarr.append(int(bl))
            now1+=1
            now2+=1
            if now1==n-1:
                answer+=1
        else:
            now1+=1
        swit=0
    else:
        if now2!=n-2:
            now2+=1
        else:
            wa=now2-now1+2
            answer+=(wa*(wa+1)//2)
            now2+=1

#print(now1, now2)
if n!=1:
    print(answer)
else:
    print(1)

Fixed submission:
import math
import copy

def secize(n, k):
    n2=bin(n)
    n3=n2[2:]
    for i in range(k-len(n2)+2):
        n3='0'+n3
    return n3


n=int(input())
alist = list(map(int,input().split()))
saidai=max(alist)
keta=math.ceil(math.log(saidai+1, 2))
blist=[]
for i in range(n):
    kaz=secize(alist[i], keta)
    blist.append(kaz)

now1=0
now2=0
nowarr=[]
for bl in blist[0]:
    nowarr.append(int(bl))
answer=0
swit=0
while now1<=n-2 and now2<=n-2:
    """
    maearr=copy.deepcopy(nowarr)
    for i in range(keta):
        if blist[now2+1][i]=='1':
            if nowarr[i]==1:
                swit=1
            else:
                nowarr[i]=1
    """
    for i in range(keta):
        if blist[now2+1][i]=='1':
            if nowarr[i]==1:
                swit=1
            else:
                nowarr[i]=2
    if swit==1:
        for i in range(keta):
            if nowarr[i]==2:
                nowarr[i]=0
        answer+=(now2-now1+1)
        #nowarr=maearr
        for i in range(keta):
            if blist[now1][i]=='1':
                nowarr[i]=0
        if now1==now2:
            nowarr=[]
            for bl in blist[now1+1]:
                nowarr.append(int(bl))
            now1+=1
            now2+=1
            if now1==n-1:
                answer+=1
        else:
            now1+=1
        swit=0
    else:
        for i in range(keta):
            if nowarr[i]==2:
                nowarr[i]=1
        if now2!=n-2:
            now2+=1
        else:
            wa=now2-now1+2
            answer+=(wa*(wa+1)//2)
            now2+=1

#print(now1, now2)
if n!=1:
    print(answer)
else:
    print(1)
Buggy python submission (verdict: Runtime Error):
from copy import copy, deepcopy
from collections import Counter
from math import sqrt, floor, factorial
from itertools import permutations, combinations, combinations_with_replacement
from operator import mul
from functools import reduce
import bisect

MOD = 10**9 + 7
INF = float('inf')

N, K = list(map(int, input().split()))

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

A = [A[i]-1 for i in range(len(A))]

mem = [0]*N
mem2 = [0]*N

idx = 0
count1 = 0
while True:
    mem[idx] += 1
    if mem[idx] == 2:
        break
    count1 += 1
    idx = A[idx]


idx2 = idx
count2 = 0

count2 += 1
idx2 = A[idx2]

while True:
    if idx2 == idx:
        break
    count2 += 1
    idx2 = A[idx2]

tmp = count1 - count2

if tmp >= K:
    for _ in range(K):
        idx = A[idx]
else:
    e = (K - tmp) % count2 + tmp
    ans = 0
    for _ in range(e):
        ans = A[ans]

print(ans+1)


Fixed submission:
from copy import copy, deepcopy
from collections import Counter
from math import sqrt, floor, factorial
from itertools import permutations, combinations, combinations_with_replacement
from operator import mul
from functools import reduce
import bisect

MOD = 10**9 + 7
INF = float('inf')

N, K = list(map(int, input().split()))

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

A = [A[i]-1 for i in range(len(A))]

mem = [0]*N
mem2 = [0]*N

idx = 0
count1 = 0
while True:
    mem[idx] += 1
    if mem[idx] == 2:
        break
    count1 += 1
    idx = A[idx]


idx2 = idx
count2 = 0

count2 += 1
idx2 = A[idx2]

while True:
    if idx2 == idx:
        break
    count2 += 1
    idx2 = A[idx2]

tmp = count1 - count2

if tmp >= K:
    ans = 0
    for _ in range(K):
        ans = A[ans]
else:
    e = (K - tmp) % count2 + tmp
    ans = 0
    for _ in range(e):
        ans = A[ans]

print(ans+1)
Buggy python submission (verdict: Runtime Error):
N = input()

if N ='ABC':
    print("ARC")
else:
    print("ABC")

Fixed submission:
N = input()

if N == "ABC":
    print("ARC")
else:
    print("ABC")
Buggy python submission (verdict: Runtime Error):
import itertools


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


p = itertools.combinations(list(range(N)), 2)

if N % 2 == 0:
    ans = 0
    for i in range(N):
        A_new = A[:i] + A[i+1:]
        if ans < sum(A_new[0::2]):
            ans = sum(A_new[0::2])
    print(ans)

else:
    ans = 0
    for v in p:
        a, b = min(v), max(v)
        A_new = A[:a] + A[a+1:b] + A[b+1:]
        if ans < sum(A_new[0::2]):
            ans = sum(A_new[0::2])
    print(ans)

Fixed submission:
N = list(input())

if "7" in N:
    print("Yes")
else:
    print("No")

Buggy python submission (verdict: Runtime Error):
N = int(input())
S = list(input())
ans = 0
 
for i in range(N):
    first_s = S[i]
    for j in range(i+1, N):
        if S[j] != first_s:
            second_s = S[j]
            for k in range(j+1, N):
                if k == 2*j-i:
                    if (S[k] != first_s) and (S[k] != second_s):
                        continue
                if (S[k] != first_s) and (S[k] != second_s):
                    ans += 1
print(ans)

Fixed submission:
N = list(input())

if "7" in N:
    print("Yes")
else:
    print("No")
Buggy python submission (verdict: Time Limit Exceeded):
import collections as cl
import math


def combinations_count(n, r):
    if n < r:
        return 0
    else:
        return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))


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

cnt = cl.Counter(A)
ans = 0
mem = {}

for a in A:
    if a in mem:
        print(mem[a])
        continue
    ans = 0
    cnt[a] -= 1
    for v in cnt.values():
        if v < 2:
            continue
        ans += combinations_count(v, 2)
    cnt[a] += 1
    print(ans)
    mem[a] = ans


Fixed submission:
import collections as cl
import math


def combinations_count(n, r):
    if n < r:
        return 0
    else:
        return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))


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

cnt = cl.Counter(A)
ans = 0
for v in cnt.values():
    ans += combinations_count(v, 2)

for a in A:
    print(ans - cnt[a]+1)

Buggy python submission (verdict: Time Limit Exceeded):
import collections as cl
import math


def combinations_count(n, r):
    if n < r:
        return 0
    else:
        return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))


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

cnt = cl.Counter(A)
ans = 0
mem = {}

for a in A:
    if a in mem:
        print(mem[a])
        continue
    ans = 0
    cnt[a] -= 1
    for v in cnt.values():
        if v < 2:
            continue
        ans += combinations_count(v, 2)
    cnt[a] += 1
    print(ans)


Fixed submission:
import collections as cl
import math


def combinations_count(n, r):
    if n < r:
        return 0
    else:
        return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))


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

cnt = cl.Counter(A)
ans = 0
for v in cnt.values():
    ans += combinations_count(v, 2)

for a in A:
    print(ans - cnt[a]+1)

Buggy python submission (verdict: Time Limit Exceeded):
import collections as cl
import math


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


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

cnt = cl.Counter(A)
ans = 0

for a in A:
    ans = 0
    cnt[a] -= 1
    for v in cnt.values():
        if v < 2:
            continue
        ans += combinations_count(v, 2)
    cnt[a] += 1
    print(ans)


Fixed submission:
import collections as cl
import math


def combinations_count(n, r):
    if n < r:
        return 0
    else:
        return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))


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

cnt = cl.Counter(A)
ans = 0
for v in cnt.values():
    ans += combinations_count(v, 2)

for a in A:
    print(ans - cnt[a]+1)
Buggy python submission (verdict: Runtime Error):
import math


a, b, c = list(map(int, input().split()))
sa, sb, sc = math.sqrt(a), math.sqrt(b), math.sqrt(c)
d = c-a-b
if len(str*d) > ８:
    if (sa + sb < sc):
        print("Yes")
    else:
        print("No")

else:
    if (c-a-b)**2 > 4*a*b:
        print("Yes")
    else:
        print("No")


Fixed submission:
import math


a, b, c = list(map(int, input().split()))
sa, sb, sc = math.sqrt(a), math.sqrt(b), math.sqrt(c)
d = c-a-b

if (c-a-b > 0) and ((c-a-b)**2 > 4*a*b):
    print("Yes")
else:
    print("No")

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


a, b, c = list(map(int, input().split()))
sa, sb, sc = math.sqrt(a), math.sqrt(b), math.sqrt(c)
if len(c - a - b) > ８:
    if (sa + sb < sc):
        print("Yes")
    else:
        print("No")

else:
    if (c-a-b)**2 > 4*a*b:
        print("Yes")
    else:
        print("No")


Fixed submission:
import math


a, b, c = list(map(int, input().split()))
sa, sb, sc = math.sqrt(a), math.sqrt(b), math.sqrt(c)
d = c-a-b

if (c-a-b > 0) and ((c-a-b)**2 > 4*a*b):
    print("Yes")
else:
    print("No")
Buggy python submission (verdict: Runtime Error):
from math import atan, atan2, degrees

a, b, x = list(map(int, input().split()))

th = atan2(a, b)

tmp1 = atan(a**3 / (2 * (a**2 * b - x)))
tmp2 = atan(2 * x / (a * b**2))

if tmp1 <= th:
    print(90 - degrees(tmp2))
else:
    print(90 - degrees(tmp1))

Fixed submission:
from math import atan, atan2, degrees

a, b, x = list(map(int, input().split()))

th = atan2(a, b)

if a**2*b == x:
    print(0)
else:
    tmp1 = atan(a**3 / (2 * (a**2 * b - x)))
    tmp2 = atan(2 * x / (a * b**2))

    if tmp1 <= th:
        print(90 - degrees(tmp2))
    else:
        print(90 - degrees(tmp1))

Buggy python submission (verdict: Runtime Error):
from math import *

a, b, x = list(map(int, input().split()))

th = atan2(a, b)

tmp1 = atan(a**3 / (2 * (a**2 * b - x)))
tmp2 = atan(2 * x / (a * b**2))

if tmp1 <= th:
    print(90 - degrees(tmp2))
else:
    print(90 - degrees(tmp1))


Fixed submission:
from math import atan, atan2, degrees

a, b, x = list(map(int, input().split()))

th = atan2(a, b)

if a**2*b == x:
    print(0)
else:
    tmp1 = atan(a**3 / (2 * (a**2 * b - x)))
    tmp2 = atan(2 * x / (a * b**2))

    if tmp1 <= th:
        print(90 - degrees(tmp2))
    else:
        print(90 - degrees(tmp1))

Buggy python submission (verdict: Runtime Error):
from math import *

a, b, x = list(map(int, input().split()))

th = atan2(a, b)

tmp1 = atan(a**3 / (2 * (a**2 * b - x)))
tmp2 = atan(2 * x / (a * b**2))

if tmp1 <= th:
    print(90 - degrees(tmp2))
else:
    print(90 - degrees(tmp1))


Fixed submission:
from math import atan, atan2, degrees

a, b, x = list(map(int, input().split()))

th = atan2(a, b)

if a**2*b == x:
    print(0)
else:
    tmp1 = atan(a**3 / (2 * (a**2 * b - x)))
    tmp2 = atan(2 * x / (a * b**2))

    if tmp1 <= th:
        print(90 - degrees(tmp2))
    else:
        print(90 - degrees(tmp1))
Buggy python submission (verdict: Time Limit Exceeded):
from operator import*
from functools import*
input()
l = map(int, input().split())
n = reduce(mul, l)
if n > 10**18:
    print(-1)
else:
    print(n)

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

n = 1
lim = 10**18
for e in l:
    n *= e
    if n > lim:
        print(0 if 0 in l else -1)
        break
else:
    print(n)
Buggy python submission (verdict: Runtime Error):
n, t = map(int, input().split())
l = [int(i)for i in input().split()]

if t <= 1 or all(b >= a for a, b in zip(l, l[1:])):
    print(0)
else:
    mini = float("inf")
    maxp = 0
    maxc = 0
    for n in l:
        if n - mini > maxp:
            maxp = n - mini
            maxc = 1
        elif n - mini == maxp:
            maxp = n - mini
            maxc += 1
        mini = min(mini, n)
print(maxc)

Fixed submission:
n, t = map(int, input().split())
l = [int(i)for i in input().split()]

if t <= 1 or all(a >= b for a, b in zip(l, l[1:])):
    print(0)
else:
    mini = float("inf")
    maxp = 0
    maxc = 0
    for n in l:
        if n - mini > maxp:
            maxp = n - mini
            maxc = 1
        elif n - mini == maxp:
            maxp = n - mini
            maxc += 1
        mini = min(mini, n)
    print(maxc)
Buggy python submission (verdict: Runtime Error):
a, b = int(input().split())

if (a + b) % 3 == 0:
  print(Possible)
else:
  print(Impossible)

Fixed submission:
a, b = map(int, input().split())
if (a+b) % 3 == 0 or a % 3 == 0 or b % 3 == 0:
  print("Possible")
else:
  print("Impossible")
Buggy python submission (verdict: Runtime Error):
T=input()

if S==T[:len(T)-1]:
  print('Yes')
else:
  print('No')

Fixed submission:
S=input()
T=input()

if S==T[:len(T)-1]:
  print('Yes')
else:
  print('No')
Buggy python submission (verdict: Time Limit Exceeded):
N,M=map(int, input().split())
H = list(map(int, input().split()))
AB=[list(map(int,list(input().split()))) for i in range(M)]

good = list(range(1,N+1))

for j in range(len(AB)):
  x = AB[j]
  a = x[0]
  b = x[1]
  #print(a,b)
  if H[a-1]>H[b-1] and b in good:
    good.remove(b)
  elif H[a-1]<H[b-1] and a in good:
    good.remove(a)
  elif H[a-1]==H[b-1]:
    if a in good:
      good.remove(a)
    if b in good:
      good.remove(b)
  #print(good)
  
print(len(good))

Fixed submission:
N,M=map(int, input().split())
H = list(map(int, input().split()))
#AB=[list(map(int,list(input().split()))) for i in range(M)]

good = list(range(1,N+1))
good = [1]*N

for j in range(M):
  a,b=map(int, input().split())
  #print(a,b)
  if H[a-1]>H[b-1]:
    #good.remove(b)
    good[b-1] = 0
  elif H[a-1]<H[b-1]:
    #good.remove(a)
    good[a-1] = 0
  elif H[a-1]==H[b-1]:
    good[a-1] = 0
    good[b-1] = 0
  #print(good)
  
print(sum(good))
Buggy python submission (verdict: Time Limit Exceeded):
K=int(input())

queue = list(range(1,10))

for i in range(K):
  lunlun = queue.pop(0)
  #print(lunlun)
  last = lunlun%10
  if last!=0:
    queue.append(10*lunlun+last-1)
  queue.append(10*lunlun+last)
  if last!=9:
    queue.append(10*lunlun+last+1)

print(lunlun)

Fixed submission:
K=int(input())
from collections import deque

#queue = list(range(1,10))
queue = deque(list(range(1,10)))

for i in range(K):
  lunlun = queue.popleft()
  #print(lunlun)
  last = lunlun%10
  if last!=0:
    queue.append(10*lunlun+last-1)
  queue.append(10*lunlun+last)
  if last!=9:
    queue.append(10*lunlun+last+1)

print(lunlun)

Buggy python submission (verdict: Time Limit Exceeded):
K=int(input())

queue = list(range(1,10))

i = 0
while i!=K:
  lunlun = queue.pop(0)
  #print(lunlun)
  last = lunlun%10
  if last!=0:
    queue.append(10*lunlun+last-1)
  queue.append(10*lunlun+last)
  if last!=9:
    queue.append(10*lunlun+last+1)

  i += 1

print(lunlun)

Fixed submission:
K=int(input())
from collections import deque

#queue = list(range(1,10))
queue = deque(list(range(1,10)))

for i in range(K):
  lunlun = queue.popleft()
  #print(lunlun)
  last = lunlun%10
  if last!=0:
    queue.append(10*lunlun+last-1)
  queue.append(10*lunlun+last)
  if last!=9:
    queue.append(10*lunlun+last+1)

print(lunlun)
Buggy python submission (verdict: Runtime Error):
import numpy as np
N,X,Y=map(int, input().split())
ans = [0]*(N-1)
for i in range(1,N):
  for j in range(i+1,N+1):
    root1 = j-i
    root2 = abs(X-i) + 1 + abs(Y-j)
    min_k = min(root1, root2)
    ans[min_k-1] = ans[min_k-1] + 1

for a in ans:
  print(a)

Fixed submission:
import numpy as np
N,X,Y=map(int, input().split())
ans = [0]*(N-1)
for i in range(1,N):
  for j in range(i+1,N+1):
    root1 = j-i
    root2 = abs(X-i) + 1 + abs(Y-j)
    min_k = min(root1, root2)
    ans[min_k-1] = ans[min_k-1] + 1

for a in ans:
  print(a)

Buggy python submission (verdict: Runtime Error):
import numpy as np
N,X,Y=map(int, input().split())
ans = np.zeros(N-1)
for i in range(1,N):
  for j in range(i+1,N+1):
    root1 = j-i
    root2 = abs(X-i) + 1 + abs(Y-j)
    min_k = min(root1, root2)
    ans[min_k-1] = ans[min_k-1] + 1

for a in ans:
  print(int(a))

Fixed submission:
import numpy as np
N,X,Y=map(int, input().split())
ans = [0]*(N-1)
for i in range(1,N):
  for j in range(i+1,N+1):
    root1 = j-i
    root2 = abs(X-i) + 1 + abs(Y-j)
    min_k = min(root1, root2)
    ans[min_k-1] = ans[min_k-1] + 1

for a in ans:
  print(a)

Buggy python submission (verdict: Time Limit Exceeded):
import numpy as np
N,X,Y=map(int, input().split())
ans = np.zeros(N-1)
for i in range(1,N):
  for j in range(i+1,N+1):
    root1 = j-i
    root2 = abs(X-i) + 1 + abs(Y-j)
    min_k = min(root1, root2)
    ans[min_k-1] = ans[min_k-1] + 1

for a in ans:
  print(int(a))

Fixed submission:
import numpy as np
N,X,Y=map(int, input().split())
ans = [0]*(N-1)
for i in range(1,N):
  for j in range(i+1,N+1):
    root1 = j-i
    root2 = abs(X-i) + 1 + abs(Y-j)
    min_k = min(root1, root2)
    ans[min_k-1] = ans[min_k-1] + 1

for a in ans:
  print(a)
Buggy python submission (verdict: Runtime Error):
N, K = map(int, input().split())
H = list(map(int, input().split()))

ans = 0
if K>=N:
  print(ans)
else:
  H = H.sort(reverse=True)
  for i in range(K, N):
    ans += H[i]
  print(ans)

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

ans = 0
if K>=N:
  print(ans)
else:
  H.sort(reverse=True)
  for i in range(K, N):
    ans += H[i]
  print(ans)
Buggy python submission (verdict: Runtime Error):
H = int(input())

if H%2==1:
  H = H-1

from math import log2
deep = int(log2(H))+1
ans = 0
for d in range(0,deep):
  ans += 2**d

print(ans)

Fixed submission:
H = int(input())

if H==1:
  print(1)
else:
  
  if H%2==1:
    H = H-1

  from math import log2
  deep = int(log2(H))+1
  ans = 0
  for d in range(0,deep):
    ans += 2**d

  print(ans)

Buggy python submission (verdict: Runtime Error):
H = int(input())

if H%2==1:
  H = H-1

from math import log2
deep = int(log2(H))+1
ans = 0
for d in range(0,deep):
  ans += 2**d

print(ans)

Fixed submission:
H = int(input())

if H==1:
  print(1)
else:
  
  if H%2==1:
    H = H-1

  from math import log2
  deep = int(log2(H))+1
  ans = 0
  for d in range(0,deep):
    ans += 2**d

  print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
P = list(map(int, input().split()))

ans = 0
for i in range(1,N+1):
  for j in range(1,i+1):
    if P[j-1]<P[i-1]:
      break
  else:
    ans += 1

print(ans)

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

ans = 0
min = max(P)
for i in range(1,N+1):
  if P[i-1]<min:
    min = P[i-1]
  if min>=P[i-1]:
    ans += 1

print(ans)
Buggy python submission (verdict: Runtime Error):
inp = input().split(" ")
n,m = int(inp[0]),int(inp[1])
brokens = []
for i in range (m):
    brokens.append(int(input()))

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

for i in brokens:
    dp[i]= -1

if dp[1] == -1 and dp[2] == -1:
    dp[1] = 0
    dp[2] = 0
elif dp[1] == -1:
    dp[1] = 0
    dp[2] = 1
elif dp[2] == -1 :
    dp[1] = 1
    dp[2] = 0
else:
    dp[1] = 1
    dp[2] = 2


for i in range(3,n+1):
    if dp[i] == -1:
        dp[i] = 0
    else:
        dp[i] = dp[i - 1] + dp[i - 2]

print(dp[n] % 1000000007)

Fixed submission:
import sys

inp = input().split(" ")
n,m = int(inp[0]),int(inp[1])
brokens = []
for i in range (m):
    brokens.append(int(input()))

if n == 1:
    print(1)
    sys.exit()


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

for i in brokens:
    dp[i]= -1

if dp[1] == -1 and dp[2] == -1:
    dp[1] = 0
    dp[2] = 0
elif dp[1] == -1:
    dp[1] = 0
    dp[2] = 1
elif dp[2] == -1 :
    dp[1] = 1
    dp[2] = 0
else:
    dp[1] = 1
    dp[2] = 2


if n <= 2:
    print(dp[n])
    sys.exit(0)


for i in range(3,n+1):
    if dp[i] == -1:
        dp[i] = 0
    else:
        dp[i] = dp[i - 1] + dp[i - 2]

print(dp[n] % 1000000007)
Buggy python submission (verdict: Runtime Error):
import numpy as np


n,m = input().split()

n = int(n)
m = int(m)

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

ans = 0

sumlist = list(np.cumsum(a))
for i in range(n):
    # print(sumlist)
    # for j in range(len(sumlist)):
    #     if sumlist[j] % m == 0:
    #         ans += 1
    tmp = [x for x in sumlist if x % m == 0]
    ans += len(tmp)

    sumlist = list(map(lambda x:x - sumlist[0],sumlist))
    sumlist.pop(0)
print(ans)


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

amari = n % k

if amari == 0:
    print(0)
else:
    print(1)
Buggy python submission (verdict: Time Limit Exceeded):
import math
x = int(input())

maxs = []
for i in range(x):
    max = 0
    for j in range(x):
        if (i+1) ** (j+2) <= x:
            max = (i+1) ** (j+2)
            maxs.append(max)
        else:
            if j == 0:
                max = (i+1) ** (j+2)
                # maxs.append(max)
    # else:
    #     maxs.append(max)


maxs.sort()
# print(maxs)
print(maxs[-1])


Fixed submission:
import math
x = int(input())

maxs = []
for i in range(x):
    max = 0
    for j in range(x):
        if (i+1) ** (j+2) <= x:
            max = (i+1) ** (j+2)
            maxs.append(max)
        else:
            if j == 0:
                max = (i+1) ** (j+2)
                break
    # else:
    #     maxs.append(max)


maxs.sort()
# print(maxs)
print(maxs[-1])
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
nums = input()
A =[int(x.strip()) for x in nums.split()]

S = [0]
for i in range(n):
    S.append(S[i]+A[i])

S.sort()

ans = 0
for i in range(n):
    for j in range(n-i):
        if S[i] == S[i+j+1]:
            ans += 1
        if S[i] < S[j+1]:
            break
print(ans)

Fixed submission:
from collections import Counter
n = int(input())
nums = input()
A =[int(x.strip()) for x in nums.split()]

S = [0]
for i in range(n):
    S.append(S[i]+A[i])

co = Counter(S)
# print(S)
# print(co)

ans = 0
for i in co.values():
    if i > 1:
        ans += i*(i-1) /2

print(int(ans))

Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
nums = input()
A =[int(x.strip()) for x in nums.split()]

ans = 0
for i in range(n):
    for j in range(n-i):
        splited = A[i:i+j+1]
        # print(splited,i,j)
        goukei = sum(splited)
        if goukei == 0 and splited != []:
            # print(splited)
            ans += 1

print(ans)

Fixed submission:
from collections import Counter
n = int(input())
nums = input()
A =[int(x.strip()) for x in nums.split()]

S = [0]
for i in range(n):
    S.append(S[i]+A[i])

co = Counter(S)
# print(S)
# print(co)

ans = 0
for i in co.values():
    if i > 1:
        ans += i*(i-1) /2

print(int(ans))