Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Time Limit Exceeded):
import sys
sys.setrecursionlimit(10 ** 5 + 10)
def input(): return sys.stdin.readline().strip()

def resolve():
    S=int(input())
    SS=str(S)
    ls=len(SS)
    cnt=0
    for i in range(ls-3):
        for j in range(i+4,ls+1):
            if int(SS[i:j])%2019==0:
                cnt+=1
    print(cnt)


resolve()

Fixed submission:
import sys

sys.setrecursionlimit(10 ** 5 + 10)


def input(): return sys.stdin.readline().strip()


def resolve():
    S = str(input())
    N=len(S)
    P=2019

    def main():
        if P == 2:
            res = 0
            for i in range(N):
                if int(S[N - 1 - i]) % 2 == 0:
                    res += N - i
        elif P == 5:
            res = 0
            for i in range(N):
                if int(S[N - 1 - i]) == 0 or int(S[N - 1 - i]) == 5:
                    res += N - i

        else:
            mods = [0] * P
            # mods[i]はPで割ったあまりがiである連続部分列の個数
            tenfactor = 1
            mod = 0
            mods[mod] += 1

            for i in range(N):
                mod = (mod + int(S[N - i - 1]) * tenfactor) % P
                tenfactor = (tenfactor * 10) % P
                mods[mod] += 1

            res = 0
            for p in range(P):
                res += mods[p] * (mods[p] - 1) // 2

        return res

    print(main())


resolve()
Buggy python submission (verdict: Runtime Error):
import sys
sys.setrecursionlimit(10 ** 5 + 10)
def input(): return sys.stdin.readline().strip()

def resolve():
    N=int(input())
    S=str(input())
    R=[]
    G=[]
    B=[]
    for i in range(N):
        if S[i]=='R':
            R.append(i)
        if S[i]=='G':
            G.append(i)
        if S[i]=='B':
            B.append(i)
    lr=len(R)
    lg=len(G)
    ans=lr*lg*(N-lr-lg)

    for i in R:
        for j in G:
            for k in B:
                L=sorted([i,j,k])
                if L[-1]-L[1]==L[1]-L[0]:
                    ans-=1
    print(ans)




resolve()

Fixed submission:
import sys
sys.setrecursionlimit(10 ** 5 + 10)
def input(): return sys.stdin.readline().strip()

def resolve():
    def main():
        n=str(input())
        for i in n:
            if int(i)==7:
                return 'Yes'
        return 'No'
    print(main())

resolve()
Buggy python submission (verdict: Time Limit Exceeded):
from collections import Counter

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

    for i in range(N):
        cnt = 0

        c=Counter(A[:i]+A[i+1:])
        values,counts=zip(*c.most_common())
        for j in counts:
            if j>=2:
                cnt+=j*(j-1)//2
        print(cnt)



resolve()

Fixed submission:
from collections import Counter

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

    ans=0
    c = Counter(A)
    values, counts = zip(*c.most_common())
    for j in counts:
        if j >= 2:
            ans += j * (j - 1) // 2

    for i in A:
        if c[i]>=3:
            print(ans-(c[i]*(c[i]-1)//2-(c[i]-1)*(c[i]-2)//2))
        elif c[i]==2:
            print(ans-1)
        else:
            print(ans)






resolve()

Buggy python submission (verdict: Time Limit Exceeded):
# import bisect
from collections import Counter, deque
# import copy
# from fractions import gcd
# from functools import reduce
# from itertools import accumulate, permutations, combinations, combinations_with_replacement, groupby, product
# import math
# import numpy as np
import sys
sys.setrecursionlimit(10 ** 5 + 10)
# input = sys.stdin.readline

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

    for i in range(N):
        cnt = 0

        c=Counter(A[:i]+A[i+1:])
        values,counts=zip(*c.most_common())
        for j in counts:
            if j>=2:
                cnt+=j*(j-1)//2
        print(cnt)



resolve()

Fixed submission:
from collections import Counter

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

    ans=0
    c = Counter(A)
    values, counts = zip(*c.most_common())
    for j in counts:
        if j >= 2:
            ans += j * (j - 1) // 2

    for i in A:
        if c[i]>=3:
            print(ans-(c[i]*(c[i]-1)//2-(c[i]-1)*(c[i]-2)//2))
        elif c[i]==2:
            print(ans-1)
        else:
            print(ans)






resolve()
Buggy python submission (verdict: Time Limit Exceeded):
def resolve():
    n,p=map(int,input().split())
    s=str(input())

    cnt=0
    for i in range(n):
        for j in range(i+1,n+1):
            if int(s[i:j])%p==0:
                cnt+=1

    print(cnt)

resolve()

Fixed submission:
import sys

sys.setrecursionlimit(10 ** 5 + 10)


def input(): return sys.stdin.readline().strip()


def resolve():
    N, P = map(int, input().split())
    S = str(input())

    def main():
        if P == 2:
            res = 0
            for i in range(N):
                if int(S[N - 1 - i]) % 2 == 0:
                    res += N - i
        elif P == 5:
            res = 0
            for i in range(N):
                if int(S[N - 1 - i]) == 0 or int(S[N - 1 - i]) == 5:
                    res += N - i

        else:
            mods = [0] * P  # mods[i]はPで割ったあまりがiである連続部分列の個数
            tenfactor = 1
            mod = 0
            mods[mod] += 1

            for i in range(N):
                mod = (mod + int(S[N - i - 1]) * tenfactor) % P
                tenfactor = (tenfactor * 10) % P
                mods[mod] += 1

            res = 0
            for p in range(P):
                res += mods[p] * (mods[p] - 1) // 2

        return res

    print(main())


resolve()
Buggy python submission (verdict: Runtime Error):
N,K=map(int,input().split())
ans=0
while N>0:
    N//M
    ans+=1
print(ans)

Fixed submission:
# coding: utf-8
# Your code here!
# coding: utf-8
# Your code here!
N,K=map(int,input().split())

########関数部分##############
def Base_10_to_n(X, n):
    if (int(X/n)):
        return Base_10_to_n(int(X/n), n)+str(X%n)
    return str(X%n)
############################
 
 
#####関数をつかってみる．#####
######今回は二進数に変換######
x10 = N
x2 = Base_10_to_n(x10, K)
print(len(list(x2)))
Buggy python submission (verdict: Runtime Error):
# coding: utf-8
# Your code here!
import statistics
from scipy.stats.mstats import gmean

N=int(input())
X=list(map(int,input().split()))
X.sort()
import sympy as sym
sym.init_printing()
(x, y) = sym.symbols("x, y")

sig=0
for i in range(N):
    sig+=X[i]

sig_2=0
for i in range(N):
    sig_2+=X[i]**2

min=10**10
med=X[0]
while True:
    sum=N*med**2-2*med*sig+sig_2

    if sum<min:
        min=sum
        prev=sum
        med+=1
    else:
        break

print(prev)


Fixed submission:
# coding: utf-8
# Your code here!

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

sig=0
for i in range(N):
    sig+=X[i]

sig_2=0
for i in range(N):
    sig_2+=X[i]**2

min=10**10
med=X[0]
while True:
    sum=N*med**2-2*med*sig+sig_2

    if sum<min:
        min=sum
        prev=sum
        med+=1
    else:
        break

print(prev)

Buggy python submission (verdict: Runtime Error):

N=int(input())
X=list(map(int,input().split()))
X.sort()
#print(X)
med=int(statistics.median(X))
#print(med)

"""
if med-math.floor(med)>math.ceil(med)-med:
    val=math.ceil(med)
else:
    val=math.floor(med)
"""
min=10**10
sum=0
#print(X)
while True:
    sum=0
    for i in range(N):
        sum+=(X[i]-med)**2
    if sum<min:
        min=sum
        prev=sum
        med+=1
    else:
        break

print(prev)


Fixed submission:
# coding: utf-8
# Your code here!

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

sig=0
for i in range(N):
    sig+=X[i]

sig_2=0
for i in range(N):
    sig_2+=X[i]**2

min=10**10
med=X[0]
while True:
    sum=N*med**2-2*med*sig+sig_2

    if sum<min:
        min=sum
        prev=sum
        med+=1
    else:
        break

print(prev)
Buggy python submission (verdict: Runtime Error):
s=set(map(int,input().split()))
if len(s)==2:
    print('Yes'):
else:
    print('No')

Fixed submission:
# coding: utf-8
# Your code here!
s=set(map(int,input().split()))
if len(s)==2:
    print('Yes')
else:
    print('No')
Buggy python submission (verdict: Time Limit Exceeded):
from collections import Counter


N = int(input()) #1行目のNを取得する
s = [input() for i in range(N)] #複数行の数値の入力を取得

counted = Counter(s)
#最頻値が同値である場合全て出力したい
#頻出数ではなく、文字だけ出力したい
#print(s.most_common()[0])

ret = [letter for letter,count in counted.most_common() if count == counted.most_common()[0][1]]
new_ret=sorted(ret)
[print(i) for i in new_ret]


Fixed submission:
from collections import Counter


N = int(input()) #1行目のNを取得する
s = [input() for i in range(N)] #複数行の数値の入力を取得
ans=[]

counted = Counter(s)#
counted_sort=counted.most_common()

for i in range(len(counted_sort)):
    if counted_sort[i][1]==counted_sort[0][1]:
        ans.append(counted_sort[i][0])


[print(i) for i in sorted(ans)]

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


N = int(input()) #1行目のNを取得する
s = [input() for i in range(N)] #複数行の数値の入力を取得

counted = collections.Counter(s)
#最頻値が同値である場合全て出力したい
#頻出数ではなく、文字だけ出力したい
ret = [letter for letter,count in counted.most_common() if count == counted.most_common()[0][1]]
new_ret=sorted(ret)
[print(i) for i in new_ret]


Fixed submission:
from collections import Counter


N = int(input()) #1行目のNを取得する
s = [input() for i in range(N)] #複数行の数値の入力を取得
ans=[]

counted = Counter(s)#
counted_sort=counted.most_common()

for i in range(len(counted_sort)):
    if counted_sort[i][1]==counted_sort[0][1]:
        ans.append(counted_sort[i][0])


[print(i) for i in sorted(ans)]

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


N = int(input()) #1行目のNを取得する
s = [input() for i in range(N)] #複数行の数値の入力を取得

counted = collections.Counter(s)
#最頻値が同値である場合全て出力したい
#頻出数ではなく、文字だけ出力したい
ret = [letter for letter,count in counted.most_common() if count == counted.most_common()[0][1]]
new_ret=sorted(ret)
for i in range(len(new_ret)):
    print(new_ret[i])# ['a', 'c']

Fixed submission:
from collections import Counter


N = int(input()) #1行目のNを取得する
s = [input() for i in range(N)] #複数行の数値の入力を取得
ans=[]

counted = Counter(s)#
counted_sort=counted.most_common()

for i in range(len(counted_sort)):
    if counted_sort[i][1]==counted_sort[0][1]:
        ans.append(counted_sort[i][0])


[print(i) for i in sorted(ans)]

Buggy python submission (verdict: Time Limit Exceeded):
N = int(input()) #1行目のNを取得する
s = [input() for i in range(N)] #複数行の数値の入力を取得

import collections
counted = collections.Counter(s)
#最頻値が同値である場合全て出力したい
#頻出数ではなく、文字だけ出力したい
ret = [letter for letter,count in counted.most_common() if count == counted.most_common()[0][1]]
new_ret=sorted(ret)
for i in range(len(new_ret)):
    print(new_ret[i])# ['a', 'c']

Fixed submission:
from collections import Counter


N = int(input()) #1行目のNを取得する
s = [input() for i in range(N)] #複数行の数値の入力を取得
ans=[]

counted = Counter(s)#
counted_sort=counted.most_common()

for i in range(len(counted_sort)):
    if counted_sort[i][1]==counted_sort[0][1]:
        ans.append(counted_sort[i][0])


[print(i) for i in sorted(ans)]
Buggy python submission (verdict: Runtime Error):
import unittest
from io import StringIO
import sys
sys.setrecursionlimit(10 ** 5 + 10)


def input(): return sys.stdin.readline().strip()


def resolve():

    n, m = map(int, input().split())
    A = list(map(int, input().split()))
    B = [0]*n
    for i in range(n):
        B[i] = A[i]//2
    
    for i in range(n):
        cnt=0
        while B[i]%2==0:
            B[i]//2
            cnt+=1
        if i==0:
            temp=cnt
        else:
            if cnt!=temp:
                ok=False
                break
            if i==n-1:
                ok=True
    if ok:
        from functools import reduce
        from fractions import gcd

        def lcm(A, B):
            return A * B // gcd(A, B)

        # リストを引数にとる
        l = reduce(lcm, B)
        print(-(-(m//l) // 2))
        
    else:
        print(0)


resolve()

Fixed submission:
K,X=map(int,input().split())
if 500*K>=X:
    print('Yes')
else:
    print('No')
Buggy python submission (verdict: Time Limit Exceeded):
# coding: utf-8
# Your code here!
A,B,K=map(int,input().split())

for i in range(K):
    if A>=1:
        A-=1
    elif B>=1:
        B-=1
print(A,end=' ')
print(B)

Fixed submission:
# coding: utf-8
# Your code here!
A,B,K=map(int,input().split())

if A<=K:
    K-=A
    A=0
    if B<=K:
        print(0, end=' ')
        print(0)
    else:
        B-=K
        print(A,end=' ')
        print(B)

else:
    A-=K
    print(A,end=' ')
    print(B)
Buggy python submission (verdict: Runtime Error):
import math
# import numpy as np  # Pythonのみ！
# from operator import xor
# import re
# from scipy.sparse.csgraph import connected_components  # Pythonのみ！
# ↑cf.  https://note.nkmk.me/python-scipy-connected-components/
# from scipy.sparse import csr_matrix
# import string
import sys
sys.setrecursionlimit(10 ** 5 + 10)
def input(): return sys.stdin.readline().strip()

def resolve():
    A,B=map(int,input().split())
    val=A* B // math.gcd(A, B)
    print(val)

resolve()

Fixed submission:
sol=[1,2,3]
ch_1=int(input())
ch_2=int(input())
sol.remove(ch_1)
sol.remove(ch_2)
print(sol[0])
Buggy python submission (verdict: Runtime Error):
N=int(input())
S,T=input().split()

for i in range(N):
    print(f'{S[i]}{T[i]}',end='')


Fixed submission:
# coding: utf-8
# Your code here!
N=int(input())
S,T=input().split()

for i in range(N):
    print('{}{}'.format(S[i],T[i]),end='')

Buggy python submission (verdict: Runtime Error):
N=int(input())
S,T=input().split()

for i in range(N):
    print(f'{S[i]}{T[i]}',end='')

Fixed submission:
# coding: utf-8
# Your code here!
N=int(input())
S,T=input().split()

for i in range(N):
    print('{}{}'.format(S[i],T[i]),end='')

Buggy python submission (verdict: Runtime Error):
# coding: utf-8
# Your code here!
N=int(input())
S,T=input().split()

for i in range(N):
    print(f'{S[i]}{T[i]}',end='')

    

Fixed submission:
# coding: utf-8
# Your code here!
N=int(input())
S,T=input().split()

for i in range(N):
    print('{}{}'.format(S[i],T[i]),end='')
Buggy python submission (verdict: Time Limit Exceeded):
import sys
sys.setrecursionlimit(10 ** 5 + 10)
def input(): return sys.stdin.readline().strip()

def resolve():
    
    n=int(input())
    if n%2==1:
        print(0)
    else:

        def divide_count(n, p):
            """nをpで何回割り切れるか"""
        
            temp = n  # nを破壊しないため
            cnt = 0
            val = p
            m = n
            while n % p == 0:
                n //= p
                cnt += 1
            n = temp
            return cnt
        
        cnt=0
        while n>=2:
            cnt+=divide_count(n,5)
            n-=2
        print(cnt)

    
resolve()

Fixed submission:
import sys
sys.setrecursionlimit(10 ** 5 + 10)
def input(): return sys.stdin.readline().strip()

def resolve():
    
    n=int(input())
    
    if n%2==1:
        print(0)
    else:
        N=n//2
        cnt=0
        while N>=5:
            cnt+=N//5
            N//=5
        print(int(cnt))
        



    
resolve()
Buggy python submission (verdict: Runtime Error):

def resolve():

    N=int(input())
    s = str(input())


    l=['%03d'%(p) for p in range(0,10**3)]
    ans=[]
    for i in l:
        if i[0] in s:
            s0=s.index(i[0])
            if i[1] in s[s0+1:]:
                s1=s[s0+1:].index(i[1])
                if i[2] in s[s0+1:][s1+1:]:
                    ans.append(i)



    print(len(set(ans)))


resolve()

Fixed submission:
import sys
sys.setrecursionlimit(10 ** 5 + 10)
def input(): return sys.stdin.readline().strip()

def resolve():

    M,D=map(int,input().split())
    N,E=map(int,input().split())

    print(1 if M!=N else 0)

resolve()
Buggy python submission (verdict: Time Limit Exceeded):
# import bisect
# from collections import Counter, deque
# import copy
# from fractions import gcd
# from functools import reduce
# from itertools import accumulate, permutations, combinations, combinations_with_replacement, groupby, product
# import math
# import numpy as np
import sys
sys.setrecursionlimit(10 ** 5 + 10)
# input = sys.stdin.readline

def resolve():

    N=int(input())
    s = str(input())


    l=['%03d'%(p) for p in range(0,10**3)]
    ans=[]
    for i in l:
        for j in range(N):
            if s[j]==i[0]:
                for k in range(j+1,N):
                    if s[k]==i[1]:
                        for m in range(k+1,N):
                            if s[m]==i[2]:
                                ans.append(i)

    print(len(set(ans)))


resolve()

Fixed submission:

def resolve():

    N=int(input())
    s = str(input())


    l=['%03d'%(p) for p in range(0,10**3)]
    ans=[]
    for i in l:
        if i[0] in s:
            s0=s.index(i[0])
            if i[1] in s[s0+1:]:
                s1=s[s0+1:].index(i[1])
                if i[2] in s[s0+1:][s1+1:]:
                    ans.append(i)



    print(len(set(ans)))


resolve()

Buggy python submission (verdict: Time Limit Exceeded):
# import bisect
# from collections import Counter, deque
# import copy
# from fractions import gcd
# from functools import reduce
# from itertools import accumulate, permutations, combinations, combinations_with_replacement, groupby, product
# import math
# import numpy as np
import sys
sys.setrecursionlimit(10 ** 5 + 10)
# input = sys.stdin.readline

def resolve():

    N=int(input())
    s = str(input())


    l=['%03d'%(p) for p in range(0,10**3)]
    ans=[]
    for i in l:
        for j in range(N):
            if s[j]==i[0]:
                for k in range(j+1,N):
                    if s[k]==i[1]:
                        for m in range(k+1,N):
                            if s[m]==i[2]:
                                ans.append(i)

    print(len(set(ans)))


resolve()

Fixed submission:

def resolve():

    N=int(input())
    s = str(input())


    l=['%03d'%(p) for p in range(0,10**3)]
    ans=[]
    for i in l:
        if i[0] in s:
            s0=s.index(i[0])
            if i[1] in s[s0+1:]:
                s1=s[s0+1:].index(i[1])
                if i[2] in s[s0+1:][s1+1:]:
                    ans.append(i)



    print(len(set(ans)))


resolve()
Buggy python submission (verdict: Runtime Error):
import sys

sys.setrecursionlimit(10 ** 5 + 10)


def input(): return sys.stdin.readline().strip()


def resolve():
    H, W, K = map(int, input().split())
    grid = [[_ for _ in input()] for _ in range(H)]

    ans = [[0] * W for _ in range(H)]
    cnt = 0
    for h in range(H):
        for w in range(W):
            if grid[h][w] == '#':
                ans[h][w] = cnt
                cnt += 1

    now=0
    for h in range(H):
        for w in range(W):
            if ans[h][w] != 0:
                now = ans[h][w]
            if ans[h][w] == 0:
                ans[h][w] = now

    now=0
    for h in reversed(range(H)):
        for w in range(W):
            if ans[h][w] != 0:
                now = ans[h][w]
            if ans[h][w] == 0:
                ans[h][w] = now
    
    for h in range(H):
        if ans[h][0] == 0:
            for w in range(W):
                ans[h][w] = ans[h - 1][w]

    for h in reversed(range(H)):
        if ans[h][0] == 0:
            for w in range(W):
                ans[h][w] = ans[h + 1][w]

    for a in ans:
        print(*a)



resolve()

Fixed submission:
import sys

sys.setrecursionlimit(10 ** 5 + 10)


def input(): return sys.stdin.readline().strip()


def resolve():
    H, W, K = map(int, input().split())
    grid = [[_ for _ in input()] for _ in range(H)]

    ans = [[0] * W for _ in range(H)]
    cnt = 0
    for h in range(H):
        for w in range(W):
            if grid[h][w] == '#':
                cnt += 1
                ans[h][w] = cnt

    now = -1
    for h in range(H):
        for w in range(W):
            if ans[h][w] != 0:
                now = ans[h][w]
            if ans[h][w] == 0:
                if now != -1:
                    ans[h][w] = now
        now = -1

    now = -1
    for h in range(H):
        for w in reversed(range(W)):
            if ans[h][w] != 0:
                now = ans[h][w]
            if ans[h][w] == 0:
                if now != -1:
                    ans[h][w] = now
        now = -1

    for h in range(1,H):
        if ans[h][0] == 0:
            for w in range(W):
                ans[h][w] = ans[h - 1][w]

    for h in reversed(range(H-1)):
        if ans[h][0] == 0:
            for w in range(W):
                ans[h][w] = ans[h + 1][w]

    for a in ans:
        print(*a)


resolve()
Buggy python submission (verdict: Runtime Error):
import sys
sys.setrecursionlimit(10 ** 5 + 10)
def input(): return sys.stdin.readline().strip()

def resolve():
    N=int(input())
    A=list(input())
    gr = groupby(A)
    cnt=0
    for key, group in gr: # groupはイテレータ。list(group)でリスト化  
        """ex.
        0: [0, 0, 0]
        1: [1, 1]
        0: [0, 0, 0]
        1: [1, 1]
        0: [0]
        1: [1]
        """
        cnt+=1
    print(cnt)
        

    
resolve()

Fixed submission:
# import bisect
# import copy
# import fractions
# import math
# import numpy as np
# from collections import Counter, deque
# from itertools import accumulate,permutations, combinations,combinations_with_replacement,product

def resolve():
    N=int(input())
    S=list(input())

    cnt=1
    for i in range(N-1):
        if S[i]!=S[i+1]:
            cnt+=1

    print(cnt)


resolve()
Buggy python submission (verdict: Time Limit Exceeded):
from itertools import accumulate, permutations, combinations, combinations_with_replacement, groupby, product
# import math
# import numpy as np
# from operator import xor
import sys
sys.setrecursionlimit(10 ** 5 + 10)
# input = sys.stdin.readline

def resolve():
    N=int(input())
    L=list(map(int,input().split()))

    cnt=0
    for i in combinations(L,3):
        if sum(i)-2*i[0]>0 and sum(i) - 2 * i[1] > 0 and sum(i)-2*i[2]>0:
            cnt+=1
            
    print(cnt)

resolve()

Fixed submission:
import bisect
# from collections import Counter, deque
# from copy import copy, deepcopy
# from fractions import gcd
# from functools import reduce
# from itertools import accumulate, permutations, combinations, combinations_with_replacement, groupby, product
# import math
# import numpy as np
# from operator import xor
import sys
sys.setrecursionlimit(10 ** 5 + 10)
# input = sys.stdin.readline

def resolve():
    N=int(input())
    L=sorted(list(map(int,input().split())))
    cnt=0
    for i in range(N-2):
        for j in range(i+1,N-1):

            val=bisect.bisect_left(L,L[i]+L[j])
            cnt+=val-j-1

    print(cnt)

resolve()

Buggy python submission (verdict: Time Limit Exceeded):
from itertools import accumulate, permutations, combinations, combinations_with_replacement, groupby, product
# import math
# import numpy as np
# from operator import xor
import sys
sys.setrecursionlimit(10 ** 5 + 10)
# input = sys.stdin.readline

def resolve():
    N=int(input())
    L=list(map(int,input().split()))

    cnt=0
    for i in combinations(L,3):
        if sum(i)-2*i[0]>0 and sum(i) - 2 * i[1] > 0 and sum(i)-2*i[2]>0:
            cnt+=1
            
    print(cnt)

resolve()

Fixed submission:
import bisect
# from collections import Counter, deque
# from copy import copy, deepcopy
# from fractions import gcd
# from functools import reduce
# from itertools import accumulate, permutations, combinations, combinations_with_replacement, groupby, product
# import math
# import numpy as np
# from operator import xor
import sys
sys.setrecursionlimit(10 ** 5 + 10)
# input = sys.stdin.readline

def resolve():
    N=int(input())
    L=sorted(list(map(int,input().split())))
    cnt=0
    for i in range(N-2):
        for j in range(i+1,N-1):

            val=bisect.bisect_left(L,L[i]+L[j])
            cnt+=val-j-1

    print(cnt)

resolve()