Language: C++

import sys,collections as cl,bisect as bs
sys.setrecursionlimit(100000)
input = sys.stdin.readline
mod = 10**9+7
Max = sys.maxsize
def l(): #intのlist
    return tuple(map(int,input().split()))

def onem(): #Nとかの取得
    return int(input())


import fractions
from functools import reduce
def gcd(*numbers):
    return reduce(fractions.gcd, numbers)

def gcd_list(numbers):
    return reduce(fractions.gcd, numbers)
def lcm_base(x, y):
    return (x * y) // fractions.gcd(x, y)

def lcm(*numbers):
    return reduce(lcm_base, numbers, 1)

def lcm_list(numbers):
    return reduce(lcm_base, numbers, 1)

def main():
    n = onem()
    a = l()

    k = lcm_list(a[:n//2])
    kk = lcm_list(a[n//2:])
    k = lcm(k,kk)
    su = 0

    for i in range(n):
        su += k//a[i]
        
        su %= mod

    print(su)

if __name__ == "__main__":
    
    main()

import collections
import itertools
import operator


class UnionFind:
    def __init__(self, x):
        class KeyDict(dict):
            def __missing__(self, key):
                self[key] = key
                return key

        self.parent = KeyDict()
        self.rank = collections.defaultdict(int)
        self.size = collections.defaultdict(lambda: 1)
        if x is not None:
            for elem in range(x+1):
                _, _, _ = self.parent[elem], self.rank[elem],self.size[elem]

    def find(self, x):
        if self.parent[x] == x:
            return x
        else:
            self.parent[x] = self.find(self.parent[x])
            return self.parent[x]

    def unite(self, x, y):
        x = self.find(x)
        y = self.find(y)
        if not self.are_same(x,y):
            xx = self.size[x]
            yy = self.size[y]
            if self.rank[x] < self.rank[y]:
                self.parent[x] = y
                self.size[y] += xx
            else:
                self.parent[y] = x
                self.size[x] += yy
        if self.rank[x] == self.rank[y]:
            self.rank[x] += 1

    def Size(self,x):
        return self.size[self.find(x)]

    def are_same(self, x, y):
        '''print(x,y,self.find(x),self.find(y),self.find(x) == self.find(y))'''
        return self.find(x) == self.find(y)

    def grouper(self):
        roots = [(x, self.find(x_par)) for x, x_par in self.parent.items()]
        root = operator.itemgetter(1)
        for _, group in itertools.groupby(sorted(roots, key=root), root):
            yield [x for x, _ in group]

n,m = m()

print("Yes" if 500 * n >= m else "No")






Compiler output:
a.cc:6:10: error: stray '#' in program
    6 | def l(): #intのlist
      |          ^
a.cc:9:13: error: stray '#' in program
    9 | def onem(): #Nとかの取得
      |             ^
a.cc:94:9: error: empty character constant
   94 |         '''print(x,y,self.find(x),self.find(y),self.find(x) == self.find(y))'''
      |         ^~
a.cc:94:11: warning: multi-character literal with 65 characters exceeds 'int' size of 4 bytes
   94 |         '''print(x,y,self.find(x),self.find(y),self.find(x) == self.find(y))'''
      |           ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
a.cc:94:78: error: empty character constant
   94 |         '''print(x,y,self.find(x),self.find(y),self.find(x) == self.find(y))'''
      |                                                                              ^~
a.cc:1:1: error: 'import' does not name a type
    1 | import sys,collections as cl,bisect as bs
      | ^~~~~~
a.cc:1:1: note: C++20 'import' only available with '-fmodules-ts'