Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Runtime Error):
import itertools
import bisect



n = int(input())

sm = [0 for _ in range(20)]

for i in range(1,20):
    sm[i] = int(26*(26**i - 1)/25)

#print(sm[4])

xx = bisect.bisect_left(sm, n)
#print(xx)

rd = n - sm[xx-1]
#print(rd)


al = [0 for _ in range(26)]

for i in range(97,122):
    al[i-97] = chr(i)
    

#rdの字の個数だけループを回して、文字を特定していく

ans = []
tmp = [0 for _ in range(30)]
for i in range(xx):
    unt = 26**(xx-i-1)
    if(rd >= unt):
        tmp = [j*unt for j in range(30)]
        num = bisect.bisect_left(tmp,rd)
        ans.append(al[num-1])
        rd -= tmp[num-1]
        #print(rd)
    else:
        ans.append("a")

print("".join(ans))
    
    

Fixed submission:
import itertools
import bisect



n = int(input())
al = [0 for _ in range(26)]
for i in range(97,123):
    al[i-97] = chr(i)
#print(al)

sm = [0 for _ in range(20)]
for i in range(1,20):
    sm[i] = int(26*(26**i - 1)/25)

#print(sm[4])

xx = bisect.bisect_left(sm, n)
#print(xx)
if(xx > 1):
    rd = n - sm[xx-1]
    ans = []
    tmp = [0 for _ in range(30)]
    for i in range(xx):
        if(xx > 1):
            unt = 26**(xx-i-1)
        if(rd >= unt):
            tmp = [j*unt for j in range(30)]
            num = bisect.bisect_left(tmp,rd)
            ans.append(al[num-1])
            rd -= tmp[num-1]
            #print(rd)
        else:
            ans.append("a")

    print("".join(ans))

else:
    print(al[n-1])

Buggy python submission (verdict: Runtime Error):
import itertools
import bisect



n = int(input())

sm = [0 for _ in range(20)]

for i in range(1,20):
    sm[i] = int(26*(26**i - 1)/25)

#print(sm[4])

xx = bisect.bisect_left(sm, n)
#print(xx)

rd = n - sm[xx-1]
#print(rd)


al = [0 for _ in range(26)]

for i in range(97,122):
    al[i-97] = chr(i)
    

#rdの字の個数だけループを回して、文字を特定していく

ans = []
tmp = [0 for _ in range(30)]
for i in range(xx):
    unt = 26**(xx-i-1)
    tmp = [j*unt for j in range(30)]
    num = bisect.bisect_left(tmp,rd)
    ans.append(al[num-1])
    rd -= tmp[num-1]
    #print(rd)

print("".join(ans))
    
    

Fixed submission:
import itertools
import bisect



n = int(input())
al = [0 for _ in range(26)]
for i in range(97,123):
    al[i-97] = chr(i)
#print(al)

sm = [0 for _ in range(20)]
for i in range(1,20):
    sm[i] = int(26*(26**i - 1)/25)

#print(sm[4])

xx = bisect.bisect_left(sm, n)
#print(xx)
if(xx > 1):
    rd = n - sm[xx-1]
    ans = []
    tmp = [0 for _ in range(30)]
    for i in range(xx):
        if(xx > 1):
            unt = 26**(xx-i-1)
        if(rd >= unt):
            tmp = [j*unt for j in range(30)]
            num = bisect.bisect_left(tmp,rd)
            ans.append(al[num-1])
            rd -= tmp[num-1]
            #print(rd)
        else:
            ans.append("a")

    print("".join(ans))

else:
    print(al[n-1])
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())

ar = [0 for _ in range(n)]

ar = [int(s) for s in input().split()]

res = 1

for i in range(n):
    res = res*ar[i]

if(res > 10**18):
    print(-1)
else:
    print(res)


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

ar = [0 for _ in range(n)]

ar = [int(s) for s in input().split()]

ar.sort()
res = 1
flag = 0

if(ar[0] == 0):
    res = 0
else:
    ar = [i for i in ar if i != 1]
    if(len(ar) < 50):
        for i in ar:
            res = res*i
            if(res > 10**18):
                print(-1)
                flag = 1
                break
    else:
        print(-1)
        flag = 1

if(flag == 0):
    print(res)

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

ar = [0 for _ in range(n)]

ar = [int(s) for s in input().split()]

res = 1

for i in range(n):
    res = res*ar[i]

if(res > 10**18):
    print(-1)
else:
    print(res)

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

ar = [0 for _ in range(n)]

ar = [int(s) for s in input().split()]

ar.sort()
res = 1
flag = 0

if(ar[0] == 0):
    res = 0
else:
    ar = [i for i in ar if i != 1]
    if(len(ar) < 50):
        for i in ar:
            res = res*i
            if(res > 10**18):
                print(-1)
                flag = 1
                break
    else:
        print(-1)
        flag = 1

if(flag == 0):
    print(res)
Buggy python submission (verdict: Runtime Error):
import itertools as it

n,m,q = map(int,input().split())

ar = [[0]*4]*q

for i in range(q):
    ar[i] = [int(s) for s in input().split()]

A = it.combinations_with_replacement(list(range(1,m+1)),n)
mx = 0

for cnd in A:
    mx_tmp=0
    for i in range(q):
        if(A[ar[i][1]-1] - A[ar[i][0]-1] == ar[i][2]):
            mx_tmp += ar[i][3]
    mx = max(mx,mx_tmp)

print(mx)

Fixed submission:
import itertools as it

n,m,q = map(int,input().split())

ar = [[0]*4]*q

for i in range(q):
    ar[i] = [int(s) for s in input().split()]

A = list(it.combinations_with_replacement(list(range(1,m+1)),n))
mx = 0

for cnd in A:
    mx_tmp=0
    for i in range(q):
        if(cnd[ar[i][1]-1] - cnd[ar[i][0]-1] == ar[i][2]):
            mx_tmp += ar[i][3]
    mx = max(mx,mx_tmp)

print(mx)
Buggy python submission (verdict: Time Limit Exceeded):
a,b,n = map(int,input().split())


x = 2

def hantei(x,a,b):
    rr = 0
    rr = int(a*x//b) - a * int(x//b)
    return rr



mx = n//b
ans = 0
ans_n = hantei(n,a,b)
ans_0 = hantei(0,a,b)

if(mx == 0):
    x = n
    ans = hantei(x,a,b)
else:
    flag = 1
    for i in range(1,mx+1):
        x = i*b - 1
        ans = max(ans,hantei(x,a,b))

asn = max(ans,ans_n,ans_0)    
print(ans)
        
    


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


x = 2

def hantei(x,a,b):
    rr = 0
    rr = int(a*x//b) - a * int(x//b)
    return rr



mx = n//b
ans = 0
ans_n = hantei(n,a,b)
ans_0 = hantei(0,a,b)

if(mx == 0):
    x = n
    ans = hantei(x,a,b)
else:
    flag = 1
    x = 2*b - 1
    ans = max(ans,hantei(x,a,b))
    #print(ans)

asn = max(ans,ans_n,ans_0)    
print(ans)

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


x = 2

def hantei(x,a,b):
    rr = 0
    rr = int(a*x//b) - a * int(x//b)
    return rr



mx = n//b
ans = 0
ans_n = hantei(n,a,b)
ans_0 = hantei(0,a,b)

if(mx == 0):
    x = n
    ans = hantei(x,a,b)
else:
    flag = 1
    for i in range(1,mx+1):
        x = i*b - 1
        ans = max(ans,hantei(x,a,b))

asn = max(ans,ans_n,ans_0)    
print(ans)
        
    


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


x = 2

def hantei(x,a,b):
    rr = 0
    rr = int(a*x//b) - a * int(x//b)
    return rr



mx = n//b
ans = 0
ans_n = hantei(n,a,b)
ans_0 = hantei(0,a,b)

if(mx == 0):
    x = n
    ans = hantei(x,a,b)
else:
    flag = 1
    x = 2*b - 1
    ans = max(ans,hantei(x,a,b))
    #print(ans)

asn = max(ans,ans_n,ans_0)    
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())

s = list(input())

res = 0

s_dif_g = [0]*n
s_dif_r = [0]*n
s_dif_b = [0]*n

for i in range(n):
    s_dif_r[i] = s[i::].count('R')
    s_dif_g[i] = s[i::].count('G')
    s_dif_b[i] = s[i::].count('B')

sample = ["R","G","B"]
for i in range(n):
    fst = s[i]
    for j in range(i+1,n-1):
        if(s[j] != fst):
            scd = s[j]
            for x in sample:
                if(x != fst and x != scd):
                    if(x == "R"):
                        res += s_dif_r[j+1]
                    if(x == "G"):
                        res += s_dif_g[j+1]
                    if(x == "B"):
                        res += s_dif_b[j+1]
                    if(2*j-i < n):    
                        if(s[2*j-i] == x):
                            res -= 1
            
            

print(res)
    

Fixed submission:
n = int(input())

s = list(input())

res = 0

s_dif_g = [0]*n
s_dif_r = [0]*n
s_dif_b = [0]*n

for i in range(n):
    s_dif_r[i] = s[i::].count('R')
    s_dif_g[i] = s[i::].count('G')
    s_dif_b[i] = s[i::].count('B')

sample = ["R","G","B"]
for i in range(n):
    fst = s[i]
    for j in range(i+1,n-1):
        if(s[j] != fst):
            scd = s[j]
            for x in sample:
                if(x != fst and x != scd):
                    if(x == "R"):
                        res += s_dif_r[j+1]
                    if(x == "G"):
                        res += s_dif_g[j+1]
                    if(x == "B"):
                        res += s_dif_b[j+1]
                    if(2*j-i < n):    
                        if(s[2*j-i] == x):
                            res -= 1
            
            

print(res)

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

s = list(input())

res = 0
p = 0
p2 = 0

for i in range(n):
    fst = s[i]
    #print(i)
    p = i+1
    while (p < n):
        #print(p)
        
        if(s[p] != s[i]):
            scd = s[p]
            p2 = p+1
            while (p2 < n):
                if(s[p2] != fst and s[p2] != scd):
                    if(p-i != p2 -p):
                        res += 1
                
                p2 += 1
        
        p += 1
        
        
print(res)   

Fixed submission:
n = int(input())

s = list(input())

res = 0

s_dif_g = [0]*n
s_dif_r = [0]*n
s_dif_b = [0]*n

for i in range(n):
    s_dif_r[i] = s[i::].count('R')
    s_dif_g[i] = s[i::].count('G')
    s_dif_b[i] = s[i::].count('B')

sample = ["R","G","B"]
for i in range(n):
    fst = s[i]
    for j in range(i+1,n-1):
        if(s[j] != fst):
            scd = s[j]
            for x in sample:
                if(x != fst and x != scd):
                    if(x == "R"):
                        res += s_dif_r[j+1]
                    if(x == "G"):
                        res += s_dif_g[j+1]
                    if(x == "B"):
                        res += s_dif_b[j+1]
                    if(2*j-i < n):    
                        if(s[2*j-i] == x):
                            res -= 1
            
            

print(res)
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())

ai = [False for _ in range(n)]

ai = [int(s) for s in input().split()]

#print(ai)

dic = {}

for i in ai:
    if(i in dic):
        dic[i] += 1
    else:
        dic[i] = 1
    
for i in ai:
    dic[i] -= 1
    res = 0
    for j in dic:
        if(dic[j] < 2):
            continue
        else:
            res += int(dic[j]*(dic[j]-1)/2)
    
    print(res)
    dic[i] += 1

Fixed submission:
n = int(input())

ai = [False for _ in range(n)]

ai = [int(s) for s in input().split()]

#print(ai)

dic = {}

for i in ai:
    if(i in dic):
        dic[i] += 1
    else:
        dic[i] = 1
mx = 0
for i in dic:
    if(dic[i] < 2):
            continue
    else:
        mx += int(dic[i]*(dic[i]-1)/2)

for i in ai:
    if(dic[i] < 2):
        print(mx)
    else:
        res = mx - (dic[i]-1)
        print(int(res))
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())


s_count ={}

for i in range(n):
    s = input()
    
    if(s in s_count):
        s_count[s] += 1
    else:
        s_count[s] = 1



max_s_list = [kv[0] for kv in s_count.items() if kv[1] == max(s_count.values())]

result = sorted(max_s_list)

for k in result:
    print(k)

Fixed submission:
n = int(input())


s_count ={}

for i in range(n):
    s = input()
    
    if(s in s_count):
        s_count[s] += 1
    else:
        s_count[s] = 1


max_val = max(s_count.values())
max_s_list = [key for key in s_count if s_count[key] == max_val]
result = sorted(max_s_list)

for k in result:
    print(k)

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


s_count ={}

for i in range(n):
    s = input()
    
    if(s in s_count):
        s_count[s] += 1
    else:
        s_count[s] = 1



max_s_list = [kv[0] for kv in s_count.items() if kv[1] == max(s_count.values())]

result = sorted(max_s_list)

for k in result:
    print(k)

Fixed submission:
n = int(input())


s_count ={}

for i in range(n):
    s = input()
    
    if(s in s_count):
        s_count[s] += 1
    else:
        s_count[s] = 1


max_val = max(s_count.values())
max_s_list = [key for key in s_count if s_count[key] == max_val]
result = sorted(max_s_list)

for k in result:
    print(k)
Buggy python submission (verdict: Runtime Error):
n,k = map(int,input().split())

pi = [0 for _ in range(n)]
si = [0 for _ in range(n)]

pi = [int(s) for s in input().split()]
pi = [(1+s)/2 for s in pi]

si[0] = pi[0]
for i in range(1,n):
    si[i] = si[i-1] + pi[i]

#print(pi)
#print(si)
#print(si[2]-si[0])

ans = 0
for i in range(n-k+1):
    ans = max(si[i+k]-si[i],ans)

print(float(ans))

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

pi = [0 for _ in range(n)]
si = [0 for _ in range(n)]

pi = [int(s) for s in input().split()]
pi = [(1+s)/2 for s in pi]

si[0] = pi[0]
for i in range(1,n):
    si[i] = si[i-1] + pi[i]

#print(pi)
#print(si)
#print(si[2]-si[0])

ans = 0
if not (n==k):
    for i in range(n-k):
        ans = max(si[i+k]-si[i],ans)
else:
    ans = si[n-1]

print(float(ans))

Buggy python submission (verdict: Time Limit Exceeded):
s = input().split()
n = int(s[0])
k = int(s[1])

p_n = input().split()

up_to = n - k + 1

result = 0.0

for i in range(n):
    p_n[i] = (1 + int(p_n[i]))/2

for i in range(up_to):
    sum_ex = 0.0
    for j in range(i,i+k):
        #print(p_n[j])
        sum_ex += p_n[j]
    
    #print(sum_ex)
    if(result < sum_ex):
        result = sum_ex


print('{0:.6f}'.format(result))

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

pi = [0 for _ in range(n)]
si = [0 for _ in range(n)]

pi = [int(s) for s in input().split()]
pi = [(1+s)/2 for s in pi]

si[0] = pi[0]
for i in range(1,n):
    si[i] = si[i-1] + pi[i]

#print(pi)
#print(si)
#print(si[2]-si[0])

ans = 0
if not (n==k):
    for i in range(n-k):
        ans = max(si[i+k]-si[i],ans)
else:
    ans = si[n-1]

print(float(ans))

Buggy python submission (verdict: Time Limit Exceeded):
s = input().split()
n = int(s[0])
k = int(s[1])

p_n = input().split()

up_to = n - k + 1

result = 0.0

for i in range(up_to):
    sum_ex = 0.0
    for j in range(i,i+k):
        #print(p_n[j])
        sum_ex += (1 + int(p_n[j]))/2
    
    #print(sum_ex)
    if(result < sum_ex):
        result = sum_ex


print('{0:.6f}'.format(result))

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

pi = [0 for _ in range(n)]
si = [0 for _ in range(n)]

pi = [int(s) for s in input().split()]
pi = [(1+s)/2 for s in pi]

si[0] = pi[0]
for i in range(1,n):
    si[i] = si[i-1] + pi[i]

#print(pi)
#print(si)
#print(si[2]-si[0])

ans = 0
if not (n==k):
    for i in range(n-k):
        ans = max(si[i+k]-si[i],ans)
else:
    ans = si[n-1]

print(float(ans))
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())

p = [int(s) for s in input().split()]
flag = -1
m_ans = 0
for i in range(n):
    i_min = min(p[:i+1])
    if(i_min < p[i]):
        #print(p[j],p[i])
        m_ans += 1
    


print(n - m_ans)

Fixed submission:
n = int(input())

p = [int(s) for s in input().split()]
flag = -1
m_ans = 1
p_z = p[0]
for i in range(1,n):
    p_z = min(p_z,p[i])
    if(p_z >= p[i]):
        #print(p[j],p[i])
        m_ans += 1
    
print(m_ans)

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

p = [int(s) for s in input().split()]
flag = -1
m_ans = 0
for i in range(n):
    for j in range(i+1):
        if(p[j] < p[i]):
            #print(p[j],p[i])
            m_ans += 1
            break
    


print(n - m_ans)

Fixed submission:
n = int(input())

p = [int(s) for s in input().split()]
flag = -1
m_ans = 1
p_z = p[0]
for i in range(1,n):
    p_z = min(p_z,p[i])
    if(p_z >= p[i]):
        #print(p[j],p[i])
        m_ans += 1
    
print(m_ans)
Buggy python submission (verdict: Runtime Error):
from collections import deque

h,w = map(int,input().split())
maze = [[False for _ in range(w)] for _ in range(h)]


for i in range(h):
    maze[i] = list(input())

#print(maze)

def bfs(x,y):
    seen = [[False for _ in range(w)] for _ in range(h)]
    dist = [[False for _ in range(w)] for _ in range(h)]
    
    if(maze[y][x] == "#"):
        return [[0]]
    
    dist[y][x] = 0
    d = deque()
    d.append(x + w*y)
    #print(d)
    while d:
        #print(d)
        base = d.popleft()
        #print(base)
        xx = base%w
        yy = base//w
        #print(*seen,sep='\n')
        #print("-------")
        if(seen[yy][xx] == True):
            continue
        else:
            seen[yy][xx] = True
        
        for px,py in [(-1,0),(1,0),(0,-1),(0,1)]:
            #print(xx+px,yy+py)
            if (0<= xx+px < w and 0<= yy+py < h):
                if(maze[yy+py][xx+px] == "." and seen[yy+py][xx+px] == False):
                    d.append(xx+px+(yy+py)*w)
                    dist[yy+py][xx+px] = dist[yy][xx] + 1
    
    return dist

result = bfs(0,2)  

#print(*result,sep ="\n")
ans = 0
for j in range(h):
    for k in range(w):
        res = 0
        result = bfs(k,j)
        for i in result:
            res = max(max(i),res)
        ans = max(ans,res)
        


print(ans)


Fixed submission:
from collections import deque

h,w = map(int,input().split())
maze = [[False for _ in range(w)] for _ in range(h)]


for i in range(h):
    maze[i] = list(input())

#print(maze)

def bfs(x,y):
    seen = [[False for _ in range(w)] for _ in range(h)]
    dist = [[False for _ in range(w)] for _ in range(h)]
    
    if(maze[y][x] == "#"):
        return [[0]]
    
    dist[y][x] = 0
    d = deque()
    d.append(x + w*y)
    #print(d)
    while d:
        #print(d)
        base = d.popleft()
        #print(base)
        xx = base%w
        yy = base//w
        #print(*seen,sep='\n')
        #print("-------")
        if(seen[yy][xx] == True):
            continue
        else:
            seen[yy][xx] = True
        
        for px,py in [(-1,0),(1,0),(0,-1),(0,1)]:
            #print(xx+px,yy+py)
            if (0<= xx+px < w and 0<= yy+py < h):
                if(maze[yy+py][xx+px] == "." and seen[yy+py][xx+px] == False):
                    d.append(xx+px+(yy+py)*w)
                    dist[yy+py][xx+px] = dist[yy][xx] + 1
    
    return dist

#result = bfs(0,2)  

#print(*result,sep ="\n")
ans = 0
for j in range(h):
    for k in range(w):
        res = 0
        result = bfs(k,j)
        for i in result:
            res = max(max(i),res)
        ans = max(ans,res)
        


print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())

tmp = [int(s) for s in input().split()]

A = {}
for i in range(n):
    A[i] = tmp[i]

#print(A)
def solve(A,n):
    keys = [k for k, v in A.items() if v == 1]
    
    if(len(keys) == 0):
        print(-1)
        return
    else:
        index = min(keys)
    
    #print(index)
    val = 2
    while True:
        #print(val,index)
        keys = [k for k, v in A.items() if v == val]
        if(len(keys) != 0):
            #print(min(keys))
            tmp = [s for s in keys if(s >= index)]
            if(len(tmp) != 0):
                index = min(tmp)
                val += 1
            else:
                #print("hi")
                val -= 1
                break
        else:
            
            val -= 1
            break
    #print(val,index)
    print(n-val)

solve(A,n) 

Fixed submission:
n = int(input())

tmp = [int(s) for s in input().split()]

target = 1
flag = 0
for i in range(n):
    if(tmp[i] == target):
        flag = 1
        target += 1
#print(target)
if(flag == 0):
    print(-1)
else:
    print(n - target +1)
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())

a = [0 for i in range(n)]
a = [int(s) for s in input().split()]
res = 0

dig_0 = [0 for i in range(60)]
dig_1 = [0 for i in range(60)]

for i in range(n):
    #print("----")
    for j in range(60):
        #print(bin(a[i]>>j))
        s = bin(a[i]>>j)[-1]
        if(s == "1"):
            dig_1[j] += 1
        else:
            dig_0[j] += 1

#print(dig_1)
for i in range(60):
    #print(dig_0[i],dig_1[i])
    res += dig_0[i]*dig_1[i]*2**i
    #print(res)
md = 10**9 + 7
print(res%md)


Fixed submission:
n = int(input())

a = [0 for i in range(n)]
a = [int(s) for s in input().split()]
res = 0

dig_0 = [0 for i in range(60)]
dig_1 = [0 for i in range(60)]

for i in range(n):
    #print("----")
    for j in range(60):
        #print(bin(a[i]>>j))
        s = (a[i]>>j)%2
        if(s == 1):
            dig_1[j] += 1
        else:
            dig_0[j] += 1

#print((3>>1)%2)
for i in range(60):
    #print(dig_0[i],dig_1[i])
    res += dig_0[i]*dig_1[i]*2**i
    #print(res)
md = 10**9 + 7
print(res%md)

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

a = [0 for i in range(n)]
a = [int(s) for s in input().split()]
res = 0

dig_0 = [0 for i in range(60)]
dig_1 = [0 for i in range(60)]

for i in range(n):
    #print("----")
    for j in range(60):
        #print(bin(a[i]>>j))
        s = bin(a[i]>>j)[-1]
        if(s == "1"):
            dig_1[j] += 1
        else:
            dig_0[j] += 1

#print(dig_1)
for i in range(60):
    #print(dig_0[i],dig_1[i])
    res += dig_0[i]*dig_1[i]*2**i
    #print(res)
md = 10**9 + 7
print(res%md)


Fixed submission:
n = int(input())

a = [0 for i in range(n)]
a = [int(s) for s in input().split()]
res = 0

dig_0 = [0 for i in range(60)]
dig_1 = [0 for i in range(60)]

for i in range(n):
    #print("----")
    for j in range(60):
        #print(bin(a[i]>>j))
        s = (a[i]>>j)%2
        if(s == 1):
            dig_1[j] += 1
        else:
            dig_0[j] += 1

#print((3>>1)%2)
for i in range(60):
    #print(dig_0[i],dig_1[i])
    res += dig_0[i]*dig_1[i]*2**i
    #print(res)
md = 10**9 + 7
print(res%md)
Buggy python submission (verdict: Time Limit Exceeded):
import itertools

n = int(input())

in_ar = [0 for _ in range(n)]
in_ar = [int(s) for s in input().split()]

al_tr = list(itertools.combinations(in_ar,3))
cnt = 0

for ar in al_tr:
    a,b,c = ar[0],ar[1],ar[2]
    if(a+b > c and a+c > b and c+b > a):
        cnt += 1

print(cnt)

Fixed submission:
import bisect

n = int(input())

in_ar = [0 for _ in range(n)]
in_ar = [int(s) for s in input().split()]
in_ar.sort()
res = 0
#print(in_ar)
for i in range(n):
    for j in range(i,n):
        if(i == j):
            continue

        a = in_ar[i]
        b = in_ar[j]
        st = bisect.bisect_left(in_ar, abs(a-b))
        en = bisect.bisect_left(in_ar, abs(a+b))
        #print(a,b,j,en)
        res += en - j - 1
        '''
        if(abs(a-b) < a):
            res -= 1
        if(abs(a-b) < b):
            res -= 1
        '''

print(res)

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

n = int(input())

in_ar = [0 for _ in range(n)]
in_ar = [int(s) for s in input().split()]

al_tr = list(itertools.combinations(in_ar,3))
cnt = 0

for ar in al_tr:
    a,b,c = ar[0],ar[1],ar[2]
    if(a+b > c and a+c > b and c+b > a):
        cnt += 1

print(cnt)

Fixed submission:
import bisect

n = int(input())

in_ar = [0 for _ in range(n)]
in_ar = [int(s) for s in input().split()]
in_ar.sort()
res = 0
#print(in_ar)
for i in range(n):
    for j in range(i,n):
        if(i == j):
            continue

        a = in_ar[i]
        b = in_ar[j]
        st = bisect.bisect_left(in_ar, abs(a-b))
        en = bisect.bisect_left(in_ar, abs(a+b))
        #print(a,b,j,en)
        res += en - j - 1
        '''
        if(abs(a-b) < a):
            res -= 1
        if(abs(a-b) < b):
            res -= 1
        '''

print(res)
Buggy python submission (verdict: Time Limit Exceeded):
import itertools

n = int(input())

s = [0 for _ in range(n)]
in_a = [0 for _ in range(n)]
dic_tmp = {}
dic_ar = [0 for _ in range(n)]
for i in range(n):
    in_a[i] = input()

for i in range(n):
    dic_tmp = {}
    for ss in in_a[i]:
        dic_tmp[ss] = dic_tmp.get(ss,0) + 1
    
    dic_ar[i] = dic_tmp

cnt = 0
for i in range(n):
    for j in range(n):
        if(i == j):
            continue
        hantei = len(dic_ar[i].items() ^ dic_ar[j].items())

        if(hantei == 0):
            cnt += 1

print(cnt//2)



Fixed submission:
import itertools

n = int(input())

s = [0 for _ in range(n)]
in_a = [0 for _ in range(n)]
dic_tmp = {}
dic_ar = [0 for _ in range(n)]
for i in range(n):
    in_a[i] = input()

cnt = 0
for i in range(n):
    s = sorted(in_a[i])
    s = "".join(s)
    if(s in dic_tmp):
        cnt += dic_tmp[s]
        dic_tmp[s] += 1
    else:
        dic_tmp[s] = 1

print(cnt)