TnT/Multi_CodeNet4Repair huggingface dataset:
Problem: Given are N positive integers A_1,...,A_N.  Consider positive integers B_1, ..., B_N that satisfy the following condition.  Condition: For any i, j such that 1 \leq i < j \leq N, A_i B_i = A_j B_j holds.  Find the minimum possible value of B_1 + ... + B_N for such B_1,...,B_N.  Since the answer can be enormous, print the sum modulo (10^9 +7).

Submission attempts (in order):
n=int(input())
a=list(map(int,input().split()))
#n=10000
#a=list(range(10**6,10**6-n,-1))
import fractions 
mod=pow(10,9)+7

b=[a,[]]
pre=0
now=1
while len(b[pre])>1:
  for i in range(0,len(b[pre])-1,2):
    b[now].append((b[pre][i]*b[pre][i+1])//fractions.gcd(b[pre][i],b[pre][i+1]))
  if len(b[pre])%2==1:
    b[now].append(b[pre][-1])
  b[pre]=[]
  now,pre=pre,now

lcma=b[pre][0]
ans=0
for ai in a:
  ans+=((lcma//ai))%mod
  ans%=mod
print(ans)


n=int(input())
a=list(map(int,input().split()))
import functools
import fractions 

def lcm(x, y):
  return (x * y) // fractions.gcd(x, y)
def lcmn(nums):
  return functools.reduce(lcm, nums)
lcma=lcmn(a)
ans=0
mod=pow(10,9)+7
for ai in a:
  ans+=lcma//ai
  ans%=mod
print(ans)

n=int(input())
a=list(map(int,input().split()))
import fractions 
mod=pow(10,9)+7
lcma=1
for ai in a:
  lcma*=ai//fractions.gcd(lcma,ai)
ans=0
for ai in a:
  ans+=((lcma//ai))%mod
  ans%=mod
print(ans)


n=int(input())
a=list(map(int,input().split()))
mod=pow(10,9)+7

#n=10000
#a=list(range(10**6,10**6-n,-1))

def factorization(n):
    arr = []
    temp = n
    for i in range(2, int(-(-n**0.5//1))+1):
        if temp%i==0:
            cnt=0
            while temp%i==0:
                cnt+=1
                temp //= i
            arr.append([i, cnt])
    if temp!=1:
        arr.append([temp, 1])
    if arr==[]:
        arr.append([n, 1])
    return arr
lcma={}
for ai in a:
  f=factorization(ai)
  for fi in f:
    if fi[0] in lcma:
      lcma[fi[0]]=max(lcma[fi[0]],fi[1])
    else:
      lcma[fi[0]]=fi[1]
l=1
for k,v in lcma.items():
  l*=pow(k,v,mod)
  l%=mod
ans=0
for ai in a:
  ans+=l*pow(ai,mod-2,mod)
  ans%=mod
print(ans)


Verdicts: Time Limit Exceeded

Time Limit Exceeded

Time Limit Exceeded

Accepted
Problem: Given are N positive integers A_1,...,A_N.  Consider positive integers B_1, ..., B_N that satisfy the following condition.  Condition: For any i, j such that 1 \leq i < j \leq N, A_i B_i = A_j B_j holds.  Find the minimum possible value of B_1 + ... + B_N for such B_1,...,B_N.  Since the answer can be enormous, print the sum modulo (10^9 +7).

Submission attempts (in order):
from fractions import gcd


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


def lcm(x, y):
        return (x*y) // gcd(x, y)


lcm_value = A[0]
for i in range(1, N):
    lcm_value = lcm(lcm_value, A[i])

# print(lcm_value)
mod = 10**9+7
ans = 0
for i in range(N):
    ans += (lcm_value // A[i]) % mod

print(ans%mod)


def gcd(m, n):
    while n:
        m, n = n, m % n
    return m


def lcm(x, y):
        return (x*y) // gcd(x, y)


N = int(input())
A = list(map(int, input().split()))
A.sort()
lcm_value = A[0]
for i in range(1, N):
    lcm_value = lcm(lcm_value, A[i])

# print(lcm_value)
mod = 10**9+7
ans = 0
for i in range(N):
    ans += (lcm_value // A[i])

print(ans % mod)


Verdicts: Time Limit Exceeded

Accepted
Problem: Given are N positive integers A_1,...,A_N.  Consider positive integers B_1, ..., B_N that satisfy the following condition.  Condition: For any i, j such that 1 \leq i < j \leq N, A_i B_i = A_j B_j holds.  Find the minimum possible value of B_1 + ... + B_N for such B_1,...,B_N.  Since the answer can be enormous, print the sum modulo (10^9 +7).

Submission attempts (in order):
from fractions import gcd
from functools import reduce

def lcm_base(x, y):
    return (x * y) // gcd(x, y)

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

N = int(input())
A = [int(x) for x in input().split()]
t = lcm(A)

mod = 10**9+7
ans = 0
for i in range(N):
    ans = (ans + t//A[i])%mod

print(ans)




def gcd(a,b):
    while b!=0:
        a,b=b,a%b
    return a

 
def lcm(a,b):
    return a*b//gcd(a,b)

N=int(input())
A=list(map(int,input().split()))
a_lcm=A[0]

for i in range(1,N):
    a_lcm=lcm(a_lcm,A[i])

a_lcm%=1000000007

result=0
for i in range(N):
    result+=(a_lcm*pow(A[i],1000000007-2, 1000000007))%1000000007
print(result%1000000007)


Verdicts: Time Limit Exceeded

Accepted
Problem: Given are N positive integers A_1,...,A_N.  Consider positive integers B_1, ..., B_N that satisfy the following condition.  Condition: For any i, j such that 1 \leq i < j \leq N, A_i B_i = A_j B_j holds.  Find the minimum possible value of B_1 + ... + B_N for such B_1,...,B_N.  Since the answer can be enormous, print the sum modulo (10^9 +7).

Submission attempts (in order):
N = int(input())
A = list(map(int, input().split()))

MOD = 10**9+7

from collections import Counter

def prime(n):
    p = Counter()

    while not n % 2:
        p[2] += 1
        n //= 2
        
    i = 3
    
    while i <= n**0.5:
        while not n % i:
            p[i] += 1
            n //= i
        i += 2
        
    if n > 1: p[n] += 1
    
    return p

c = Counter()
for a in A:
    p = prime(a)

    for key, value in p.items():
        c[key] = max(c[key], value)

n = 1
for key, value in c.items():
    n *= key**value

ans = 0
for a in A:
    ans += pow(a, MOD-2, MOD) 
    ans %= MOD

print(ans)


import sys
input = sys.stdin.readline

MOD = 10**9+7
def pow(a, b):
    res = 1
    while b:
        if b & 1: res = res * a % MOD
        a = a**2 % MOD
        b >>= 1
    return res

def main():
    N = int(input())
    A = list(map(int, input().split()))
    B = set(A)
    
    m = max(B)+1    
    prime = {i:i for i in range(m)}
    is_prime = [False] * m
    
    for i in range(2, int(m**0.5)+1):
        if is_prime[i]: continue
        is_prime[i] = True
        
        for j in range(2*i, m, i):
            if not is_prime[j]: prime[j] = i
            is_prime[j] = True
            
    from collections import Counter
    
    count = Counter()
            
    for a in A:
        c = Counter()
        while a > 1:
            n = prime[a]
            c[n] += 1
            a //= n
        for k, v in c.items(): count[k] = max(count[k], v)
            
    x = 1
    for k, v in count.items(): x = x * k**v % MOD
    
    ans = 0
    for a in A: ans += x * pow(a, MOD-2) % MOD
    
    print(ans%MOD)

if __name__ == '__main__':
    main()        


Verdicts: Wrong Answer

Accepted
Problem: Given are N positive integers A_1,...,A_N.  Consider positive integers B_1, ..., B_N that satisfy the following condition.  Condition: For any i, j such that 1 \leq i < j \leq N, A_i B_i = A_j B_j holds.  Find the minimum possible value of B_1 + ... + B_N for such B_1,...,B_N.  Since the answer can be enormous, print the sum modulo (10^9 +7).

Submission attempts (in order):
from fractions import gcd


def lcm(x, y):
    return (x * y) // gcd(x, y)


MOD = 1000000007

N = int(input())

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

lcm_ = 1
for a in A:
    lcm_ = lcm(lcm_, a)

ans = 0
for a in A:
    ans += lcm_ / a

ans %= MOD
print(int(ans))

import math


def lcm(x, y):
    return (x * y) // math.gcd(x, y)


MOD = 1000000007

N = int(input())

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

lcm_ = 1
for a in A:
    lcm_ = lcm(lcm_, a)

ans = 0
for a in A:
    ans += lcm_ // a

ans %= MOD
print(ans)

Verdicts: Runtime Error

Accepted
Problem: Given are N positive integers A_1,...,A_N.  Consider positive integers B_1, ..., B_N that satisfy the following condition.  Condition: For any i, j such that 1 \leq i < j \leq N, A_i B_i = A_j B_j holds.  Find the minimum possible value of B_1 + ... + B_N for such B_1,...,B_N.  Since the answer can be enormous, print the sum modulo (10^9 +7).

Submission attempts (in order):
from functools import reduce
from fractions import gcd
def lcm_base(x, y):
    return (x * y) // gcd(x, y)

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

n = int(input())
A = [int(i) for i in input().split()]
k = lcm_list(A)
r = 0
for i in range(n):
    r += k//A[i]
    if r > 10**9+7:
        r %= 10**9+7
print(r)

m functools import reduce
def lcm_base(x, y):
    return (x * y) // gcd(x, y)
 
def lcm_list(numbers):
    return reduce(lcm_base, numbers, 1)
 
def gcd(a, b):
    while b:
        a, b = b, a % b
    return a
 
n = int(input())
A = list(map(int, input().split()))
k = lcm_list(A)
r = 0
ln = list(range(n))
for i in ln:
    r += k//A[i]
print(r%(10**9+7))

from functools import reduce
def lcm_base(x, y):
    return (x * y) // gcd(x, y)

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

def gcd(a, b):
    while b:
        a, b = b, a % b
    return a

n = int(input())
A = list(map(int, input().split()))
k = lcm_list(A)
r = 0
ln = list(range(n))
for i in ln:
    r += k//A[i]
print(r%(10**9+7))


Verdicts: Time Limit Exceeded

Runtime Error

Accepted
Problem: Given are N positive integers A_1,...,A_N.  Consider positive integers B_1, ..., B_N that satisfy the following condition.  Condition: For any i, j such that 1 \leq i < j \leq N, A_i B_i = A_j B_j holds.  Find the minimum possible value of B_1 + ... + B_N for such B_1,...,B_N.  Since the answer can be enormous, print the sum modulo (10^9 +7).

Submission attempts (in order):
from fractions import gcd
from functools import reduce
n=int(input())
a=list(map(int,input().split()))
x=reduce(lambda x,y: y//gcd(x,y)*x, set(a))
ans=0
for i in a:
  ans+=x//i
  ans%=1000000007
print(ans)

from fractions import gcd
from functools import reduce
n=int(input())
a=list(map(int,input().split()))
x=reduce(lambda x,y: y//gcd(x,y)*x, a)
ans=0
for i in a:
  ans+=x//i
  ans%=1000000007
print(ans)

from functools import reduce
def gcd(a, b):
    while b:
        a, b = b, a % b
    return a
def lcm(a, b):
    return b // gcd(a, b) * a
n=int(input())
a=list(map(int,input().split()))
x=reduce(lambda x,y: lcm(x,y), set(a))
ans=0
for i in a:
  ans+=x//i
ans%=1000000007
print(ans)

Verdicts: Time Limit Exceeded

Time Limit Exceeded

Accepted
Problem: Given are N positive integers A_1,...,A_N.  Consider positive integers B_1, ..., B_N that satisfy the following condition.  Condition: For any i, j such that 1 \leq i < j \leq N, A_i B_i = A_j B_j holds.  Find the minimum possible value of B_1 + ... + B_N for such B_1,...,B_N.  Since the answer can be enormous, print the sum modulo (10^9 +7).

Submission attempts (in order):
n=int(input())
A=list(map(int,input().split()))
mod=10**9+7

import fractions
def lcm(a,b):
    return a*b//fractions.gcd(a,b)

def power(a,p):
    T=[a]
    while 2**(len(T))<p:
        T.append(T[-1]**2%p)
    b=bin(p-2)
    ans=1
    for i in range(len(b)-2):
        if int(b[-i-1])==1:
            ans=ans*T[i]%p
    return ans   

l=A[0]
for i in range(n-1):
    l=lcm(l,A[i+1])
s=0
for i in range(n):
    s+=l*power(A[i],mod)%mod
    s%=mod
print(s)

n=int(input())
A=list(map(int,input().split()))
mod=10**9+7

import fractions
print(fractions.gcd(6,10))
def lcm(a,b):
    return a*b//fractions.gcd(a,b)

def power(a,p):
    T=[a]
    while 2**(len(T))<p:
        T.append(T[-1]**2%p)
    b=bin(p-2)
    ans=1
    for i in range(len(b)-2):
        if int(b[-i-1])==1:
            ans=ans*T[i]%p
    return ans   

l=A[0]
for i in range(n-1):
    l=lcm(l,A[i+1])
s=0
for i in range(n):
    s+=l*power(A[i],mod)%mod
    s%=mod
print(s)

n=int(input())
A=list(map(int,input().split()))
mod=10**9+7

def inverse(a): 
    T=[a]
    while 2**(len(T))<mod: 
        T.append(T[-1]**2%mod)
    b=bin(mod-2) 
    ans=1
    for i in range(len(b)-2):
        if int(b[-i-1])==1:
            ans=ans*T[i]%mod
    return ans

def make_eratosthenes(n): 
    A=[0]*n
    A[0],A[1]=-1,-1
    for i in range(2,n):
        if A[i]==0:
            j=i
            while j<n:
                A[j]=i
                j+=i
    return A

E=make_eratosthenes(10**6+5)

l={}
for a in A:
    now=a
    f=[] 
    while now>1:
        f.append(E[now])
        now//=E[now]
    chk=0 
    for p in f:
        if chk==p: 
            continue
        chk=p
        if p in l.keys(): 
            l[p]=max(l[p],f.count(p))
        else: 
            l[p]=f.count(p)

lcm=1
for k in l:
    for i in range(l[k]):
        lcm=lcm*k%mod
s=0
for i in range(n):
    s+=lcm*inverse(A[i])%mod
    s%=mod
print(s)

Verdicts: Time Limit Exceeded

Wrong Answer

Accepted
Problem: Given are N positive integers A_1,...,A_N.  Consider positive integers B_1, ..., B_N that satisfy the following condition.  Condition: For any i, j such that 1 \leq i < j \leq N, A_i B_i = A_j B_j holds.  Find the minimum possible value of B_1 + ... + B_N for such B_1,...,B_N.  Since the answer can be enormous, print the sum modulo (10^9 +7).

Submission attempts (in order):
import sys
read = sys.stdin.read
from fractions import gcd
from functools import reduce
 
n,*alst = list(map(int, read().split()))

def lcm(x, y):
    g = gcd(x, y)
    g = x * y // g
    return g

g = reduce(lcm, alst)
mod=10**9+7
res=0
for a in alst:
  res+=pow(a,mod-2,mod)*g
  res%=mod
print(res)

import sys
read = sys.stdin.read
from fractions import gcd
from functools import reduce
 
n,*alst = list(map(int, read().split()))

def lcm(x, y):
    g = gcd(x, y)
    g = x * y // g
    return g

g = reduce(lcm, alst)
mod=10**9+7
res=0
for a in alst:
  res+=(pow(a,mod-2,mod)*g)%mod
print(res)



import sys
read = sys.stdin.read

N, *A = map(int, read().split())
mod = 10 ** 9 + 7


def min_factor(n):
    sieve = list(range(n + 1))
    sieve[2::2] = [2] * (n // 2)
    for i in range(3, int(n ** 0.5) + 2, 2):
        if sieve[i] == i:
            sieve[i * i::2 * i] = [i] * ((n - i * i) // (2 * i) + 1)
    return sieve


def prime_factorize(n):
    a = {}
    while n != 1:
        b = table[n]
        if b in a:
            a[b] += 1
        else:
            a[b] = 1
        n //= b
    return a


table = min_factor(max(A))

dic = {}
for i in A:
    for key, value in prime_factorize(i).items():
        if key in dic:
            dic[key] = max(dic[key], value)
        else:
            dic[key] = value

lcm = 1
for i, j in dic.items():
    lcm *= pow(i, j, mod)
    lcm %= mod

answer = sum(lcm * pow(i, mod - 2, mod) for i in A) % mod
print(answer)


Verdicts: Time Limit Exceeded

Wrong Answer

Accepted
Problem: Given are N positive integers A_1,...,A_N.  Consider positive integers B_1, ..., B_N that satisfy the following condition.  Condition: For any i, j such that 1 \leq i < j \leq N, A_i B_i = A_j B_j holds.  Find the minimum possible value of B_1 + ... + B_N for such B_1,...,B_N.  Since the answer can be enormous, print the sum modulo (10^9 +7).

Submission attempts (in order):
def main():
    import sys
    input = sys.stdin.readline
    from fractions import gcd
    a = int(input())
    l = list(map(int,input().split()))



    def lcm(a,b):
        return a*b//gcd(a,b)

    MOD = 10**9+7
    ans = 0
    t = 1
    for i in l:
        t = lcm(t,i)

    for i in l:
        ans +=t//i
        ans %=MOD
    print(ans)
main()

a = int(input())
l = list(map(int,input().split()))

def gcd(a,b):
    while b!=0:
        a,b=b,a%b
    return a


def lcm(a,b):
    return a*b//gcd(a,b)

MOD = 10**9+7
ans = 0
t = 1
for i in l:
    t = lcm(t,i)

for i in l:
    ans +=t//i
print(ans%MOD)


Verdicts: Time Limit Exceeded

Accepted
Problem: Given are N positive integers A_1,...,A_N.  Consider positive integers B_1, ..., B_N that satisfy the following condition.  Condition: For any i, j such that 1 \leq i < j \leq N, A_i B_i = A_j B_j holds.  Find the minimum possible value of B_1 + ... + B_N for such B_1,...,B_N.  Since the answer can be enormous, print the sum modulo (10^9 +7).

Submission attempts (in order):
def resolve():
    from fractions import gcd
    n = int(input())
    a = list(map(int, input().split()))
    mod = 10**9 + 7
    lsd = a[0]
    for i in range(1, n):
        lsd = (lsd * a[i]) // gcd(lsd, a[i])

    ans = 0
    for i in range(n):
        ans += (lsd/a[i]) % mod

    print(int(ans % mod))

resolve()

def resolve():
    from fractions import gcd
    n = int(input())
    a = list(map(int, input().split()))
    mod = 10**9 + 7
    lsd = a[0]
    for i in range(1, n):
        lsd = (lsd * a[i]) // gcd(lsd, a[i])
 
    ans = 0
    for i in range(n):
        ans += (lsd//a[i]) % mod
 
    print(int(ans % mod))
 
 
if __name__ == '__main__':
    resolve()

def resolve():
    from fractions import gcd
    n = int(input())
    a = list(map(int, input().split()))
    mod = 10**9 + 7
    lsd = a[0]
    for i in range(1, n):
        lsd = (lsd * a[i]) // gcd(lsd, a[i])
 
    ans = 0
    for i in range(n):
        ans += (lsd//a[i]) % mod
 
    print(int(ans % mod))
resolve()

def resolve():
    def lcm(X, Y):
        x = X
        y = Y
        if y > x:
            x, y = y, x
        while x % y != 0:
            x, y = y, x % y
        return X * Y // y
    n = int(input())
    a = list(map(int, input().split()))
    mod = 10**9 + 7
    lsd = a[0]
    for i in range(1, n):
        lsd = lcm(lsd, a[i])
    lsd = lsd % mod

    ans = 0
    for i in range(n):
        ans += (lsd * pow(a[i], mod-2, mod)) % mod

    print(int(ans % mod))

resolve()

Verdicts: Runtime Error

Time Limit Exceeded

Time Limit Exceeded

Accepted
Problem: Given are N positive integers A_1,...,A_N.  Consider positive integers B_1, ..., B_N that satisfy the following condition.  Condition: For any i, j such that 1 \leq i < j \leq N, A_i B_i = A_j B_j holds.  Find the minimum possible value of B_1 + ... + B_N for such B_1,...,B_N.  Since the answer can be enormous, print the sum modulo (10^9 +7).

Submission attempts (in order):
# coding: utf-8
# Your code here!
from fractions import gcd

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

temp=A[0]
for item in A:
    temp=temp*item//gcd(temp,item)

ans=0
for item in A:
    ans+=temp//item
    ans%=10**9+7
#print(temp)
print(ans)

# coding: utf-8
# Your code here!
# coding: utf-8
# Your code here!
def lcm(a):
    from fractions import gcd
    x = a[0]
    for i in range(1, len(a)):
        x = (x * a[i]) // gcd(x, a[i])
    return x

N=int(input())
a=list(map(int,input().split()))
calc=(lcm(a))  

ans=0
for item in a:
    ans+=(calc)//item
    ans%=(10**9+7)

print(int((ans)%(10**9+7)))
    



# coding: utf-8
# Your code here!
# coding: utf-8
# Your code here!
import sys
input = sys.stdin.readline


def lcm(a):
    from fractions import gcd
    x = a[0]
    for i in range(1, len(a)):
        x = (x * a[i]) // gcd(x, a[i])
    return x

N=int(input())
a=list(map(int,input().split()))
calc=(lcm(a))  

ans=0
for item in a:
    ans+=(calc)//item
    ans%=(10**9+7)

print(int((ans)%(10**9+7)))
    



# coding: utf-8
# Your code here!
def lcm(a):
    from fractions import gcd
    x = a[0]
    for i in range(1, len(a)):
        x = (x * a[i]) // gcd(x, a[i])
    return x

N=int(input())
a=list(map(int,input().split()))
calc=(lcm(a))  

ans=0
for item in a:
    ans+=(calc)/item
    ans%=(10**9+7)

print(int((ans)%(10**9+7)))
    

# coding: utf-8
# Your code here!
# coding: utf-8
# Your code here!
import sys
input = sys.stdin.readline

import functools

def euclid(a, b):
    if b == 0:
        return a
    else:
        return euclid(b, a%b)
def multiple(a, b):
    return a*b // euclid(a, b)
def lcm(nums):
        return functools.reduce(multiple, nums)


N=int(input())
a=list(map(int,input().split()))
calc=(lcm(a))  


ans=0
for index,item in enumerate(a):
    ans+=(calc)//item

print(int((ans)%(10**9+7)))
    



Verdicts: Time Limit Exceeded

Time Limit Exceeded

Time Limit Exceeded

Runtime Error

Accepted
Problem: Given are N positive integers A_1,...,A_N.  Consider positive integers B_1, ..., B_N that satisfy the following condition.  Condition: For any i, j such that 1 \leq i < j \leq N, A_i B_i = A_j B_j holds.  Find the minimum possible value of B_1 + ... + B_N for such B_1,...,B_N.  Since the answer can be enormous, print the sum modulo (10^9 +7).

Submission attempts (in order):
def gcd(a, b):
    if b==0:
        return a
    return gcd(b, a%b)

def lcm(a, b):
    return a*(b/gcd(a, b))

mod = int(1e9+7)

n = int(input())
vs = map(int, input().split())
l = 1
for x in vs:
    l = lcm(l, x)

ans = 0
for x in vs:
    ans = (ans + ((l/x)%mod))%mod
print(ans)


def gcd(a, b):
    if b==0:
        return a
    return gcd(b, a%b)

def lcm(a, b):
    return a*(b//gcd(a, b))

mod = int(1e9+7)
def ext_gcd(a, b, x, y):
    if b==0:
        x[0] = 1
        y[0] = 0
        return a
    g = ext_gcd(b, a%b, y, x)
    y[0]-=a//b*x[0]
    return g

def mod_inv(a):
    x = [0]
    y = [0]
    ext_gcd(a, mod, x, y)
    return (x[0]%mod + mod)%mod;

n = int(input())
vs = list(map(int, input().split()))
l = 1
for x in vs:
    l = lcm(l, x)
l = l%mod;
ans = 0
for x in vs:
    ans = (ans + ((l*mod_inv(x))%mod))%mod
print(ans)


Verdicts: Runtime Error

Accepted
Problem: Given are N positive integers A_1,...,A_N.  Consider positive integers B_1, ..., B_N that satisfy the following condition.  Condition: For any i, j such that 1 \leq i < j \leq N, A_i B_i = A_j B_j holds.  Find the minimum possible value of B_1 + ... + B_N for such B_1,...,B_N.  Since the answer can be enormous, print the sum modulo (10^9 +7).

Submission attempts (in order):
# = int(input())
# = map(int, input().split())
# = list(map(int, input().split()))
# = list(input())
# = [tuple(map(int, input().split())) for _ in range(n)]

from fractions import gcd

n = int(input())
p = list(map(int, input().split()))

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

MOD = 10 ** 9 + 7

def lcm(a, b):
    return a * b // gcd(a, b)

c = p[0]
for x in p[1:]:
    c = lcm(c, x)

ans = 0
for x in p:
    ans = (ans + c // x) % MOD

print(ans)


# = int(input())
# = map(int, input().split())
# = list(map(int, input().split()))
# = list(input())
# = [tuple(map(int, input().split())) for _ in range(n)]

from fractions import gcd

n = int(input())
p = list(map(int, input().split()))

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

MOD = 10 ** 9 + 7

c = p[0]
for x in p[1:]:
    c = c * x // gcd(c, x)

ans = 0
for x in p:
    ans = (ans + c // x) % MOD

print(ans)


# = int(input())
# = map(int, input().split())
# = list(map(int, input().split()))
# = list(input())
# = [tuple(map(int, input().split())) for _ in range(n)]

from fractions import gcd

n = int(input())
p = list(map(int, input().split()))

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

MOD = 10 ** 9 + 7

#def gcd(a, b):
#    while b:
#        a, b = b, a%b
#    return a

c = p[0]
for x in p[1:]:
    c = c * x // gcd(c, x)

ans = 0
for x in p:
    ans += c // x

print(ans)


# = int(input())
# = map(int, input().split())
# = list(map(int, input().split()))
# = list(input())
# = [tuple(map(int, input().split())) for _ in range(n)]

n = int(input())
p = list(map(int, input().split()))

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

MOD = 10 ** 9 + 7

def gcd(a, b):
    while b:
        a, b = b, a%b
    return a

c = p[0]
for x in p[1:]:
    c = c * x // gcd(c, x)

ans = 0
for x in p:
    ans += c // x

print(ans % MOD)


Verdicts: Time Limit Exceeded

Time Limit Exceeded

Wrong Answer

Accepted
Problem: Given are N positive integers A_1,...,A_N.  Consider positive integers B_1, ..., B_N that satisfy the following condition.  Condition: For any i, j such that 1 \leq i < j \leq N, A_i B_i = A_j B_j holds.  Find the minimum possible value of B_1 + ... + B_N for such B_1,...,B_N.  Since the answer can be enormous, print the sum modulo (10^9 +7).

Submission attempts (in order):
import sys
# import re
import math
import collections

import bisect
import itertools
import fractions
# import functools
import copy
# import heapq
import decimal
# import statistics
import queue

# import numpy as np

sys.setrecursionlimit(10000001)
INF = 10 ** 16
MOD = 10 ** 9 + 7
# MOD = 998244353

ni = lambda: int(sys.stdin.readline())
ns = lambda: map(int, sys.stdin.readline().split())
na = lambda: list(map(int, sys.stdin.readline().split()))


# ===CODE===

def main():
    from functools import reduce

    tmp = [2, 4, 6, 8]
    gcdans = reduce(fractions.gcd, tmp)

    
    def lcm_base(x, y):
        return (x * y) // math.gcd(x, y)

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

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

    n = ni()
    a = na()

    lcm = lcm_list(a)

    ans = 0
    for ai in a:
        ans += lcm // ai
        ans %= MOD

    print(ans)


if __name__ == '__main__':
    main()


import sys
# import re
import math
import collections

import bisect
import itertools
import fractions
# import functools
import copy
# import heapq
import decimal
# import statistics
import queue

# import numpy as np

sys.setrecursionlimit(10000001)
INF = 10 ** 16
MOD = 10 ** 9 + 7
# MOD = 998244353

ni = lambda: int(sys.stdin.readline())
ns = lambda: map(int, sys.stdin.readline().split())
na = lambda: list(map(int, sys.stdin.readline().split()))


# ===CODE===

def main():
    from functools import reduce

    n = ni()
    a = na()

    lcm = a[0]
    for i in a:
        lcm = lcm // math.gcd(lcm, i) * i
    lcm %= MOD

    ans = 0
    for ai in a:
        ans += lcm * pow(ai, MOD - 2, MOD) % MOD
        ans %= MOD

    print(ans)


if __name__ == '__main__':
    main()


Verdicts: Time Limit Exceeded

Accepted
Problem: Given are N positive integers A_1,...,A_N.  Consider positive integers B_1, ..., B_N that satisfy the following condition.  Condition: For any i, j such that 1 \leq i < j \leq N, A_i B_i = A_j B_j holds.  Find the minimum possible value of B_1 + ... + B_N for such B_1,...,B_N.  Since the answer can be enormous, print the sum modulo (10^9 +7).

Submission attempts (in order):
from fractions import gcd
m=10**9+7
n=int(input())
L=list(map(int,input().split()))
g=L[0]
for i in range(n-1):
    g=(g*L[i+1])//gcd(g,L[i+1])
r=0
for i in range(n):
    r+=g//L[i]%m
print(r%m)

from collections import defaultdict

n=int(input())
A=list(map(int,input().split()))
MOD=10**9+7
L=defaultdict(int)

def soinsu(n):
	l=defaultdict(int)
	for j in range(2,int(n**0.5)+1):
		while n%j==0:
			l[j]+=1
			n//=j
	if l=={}:
			l[n]+=1
	else:
		if n!=1:
			l[n]+=1
	for k,v in l.items():
		L[k]=max(L[k],v)

for i in range(n):
	soinsu(A[i])

LM=1
for k,v in L.items():
	LM*=k**v
	LM%=MOD

r=0
for i in range(n):
	r+=LM*pow(A[i],MOD-2,MOD)
	r%=MOD
print(r)

Verdicts: Time Limit Exceeded

Accepted
Problem: Given are N positive integers A_1,...,A_N.  Consider positive integers B_1, ..., B_N that satisfy the following condition.  Condition: For any i, j such that 1 \leq i < j \leq N, A_i B_i = A_j B_j holds.  Find the minimum possible value of B_1 + ... + B_N for such B_1,...,B_N.  Since the answer can be enormous, print the sum modulo (10^9 +7).

Submission attempts (in order):
from fractions import gcd

def lcm(a):
    x = a[0]
    for i in range(1, len(a)):
        if x % a[i] != 0:
            x = (x * a[i]) // gcd(x, a[i])
    return x

n = int(input())
a = list(map(int, input().split()))

div = 10**9 + 7
lcm_num = lcm(a)
ans = [lcm_num//ai for ai in a]

print(sum(ans)%div)


from fractions import gcd

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

if N == 1:
    print(1)
    exit()

def saisho_ko_baisu(A,B):
    return A*B // gcd(A,B)
#     # A < B
#     x = A*B
#     r = B%A
#     while r!=0:
#         B = A
#         A = r
#         r = B%A
#     return x//A

A.sort(reverse = True)
tmp = saisho_ko_baisu(A[0], A[1])
res = tmp//A[0] + tmp//A[1]
for i in range(2,N):
    if tmp % A[i] != 0:
        new = saisho_ko_baisu(A[i], tmp)
        res *= new//tmp
        tmp = new
    res += tmp // A[i]

print(res % (10**9 + 7))


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

if N == 1:
    print(1)
    exit()

def saisho_ko_baisu(A,B):
    # A < B
    if B < A:
        A,B = B,A
    x = A*B
    r = B%A
    while r!=0:
        B = A
        A = r
        r = B%A
    return x//A

A.sort()
tmp = saisho_ko_baisu(A[0], A[1])
for i in range(2,N):
    tmp = saisho_ko_baisu(tmp, A[i])
res = 0
for a in A:
    res += tmp//a

print(res % (10**9 + 7))


Verdicts: Time Limit Exceeded

Time Limit Exceeded

Accepted
Problem: Given are N positive integers A_1,...,A_N.  Consider positive integers B_1, ..., B_N that satisfy the following condition.  Condition: For any i, j such that 1 \leq i < j \leq N, A_i B_i = A_j B_j holds.  Find the minimum possible value of B_1 + ... + B_N for such B_1,...,B_N.  Since the answer can be enormous, print the sum modulo (10^9 +7).

Submission attempts (in order):
N=int(input())
A=[int(i) for i in input().split(" ")]
mod=10**9+7

def GCD(a,b):
    if min(a,b)==0:
        return max(a,b)
    else:
        return GCD(min(a,b),max(a,b)%min(a,b))

def LCM(a,b):
    return int(a*b//GCD(a,b))



def egcd(a, b):
    (x, lastx) = (0, 1)
    (y, lasty) = (1, 0)
    while b != 0:
        q = a // b
        (a, b) = (b, a % b)
        (x, lastx) = (lastx - q * x, x)
        (y, lasty) = (lasty - q * y, y)
    return (lastx, lasty, a)


def modinv(a, m):
    (inv, q, gcd_val) = egcd(a, m)
    return inv % m


lcm=1
for a in A:
    lcm=LCM(lcm,a)


retval=0
for a in A:
    retval+=a*lcm
    retval=retval%mod

print(int(retval%mod))


N=int(input())
A=[int(i) for i in input().split(" ")]
mod=10**9+7

def GCD(a,b):
    if min(a,b)==0:
        return max(a,b)
    else:
        return GCD(min(a,b),max(a,b)%min(a,b))

def LCM(a,b):
    return int(a*b//GCD(a,b))





lcm=1
for a in A:
    lcm=LCM(lcm,a)


retval=0
for a in A:
    retval+=lcm//a

print(int(retval%mod))


Verdicts: Wrong Answer

Accepted
Problem: Given are N positive integers A_1,...,A_N.  Consider positive integers B_1, ..., B_N that satisfy the following condition.  Condition: For any i, j such that 1 \leq i < j \leq N, A_i B_i = A_j B_j holds.  Find the minimum possible value of B_1 + ... + B_N for such B_1,...,B_N.  Since the answer can be enormous, print the sum modulo (10^9 +7).

Submission attempts (in order):
from fractions import gcd
MOD = 10**9+7
N = int(input())
A = list(map(int, input().split()))
now = A[0]
ans = 0
for i in range(1,N):
    now = now//gcd(now, A[i])*A[i]
for i in range(N):
    ans += now//A[i]
    ans %= MOD
print(ans)


from fractions import gcd
MOD = 10**9+7
N = int(input())
A = list(map(int, input().split()))
now = A[0]
ans = 0
for i in range(1,N):
    now = now//gcd(now, A[i])*A[i]
for i in range(N):
    ans += now//A[i]
print(ans)

from collections import defaultdict

def prime_factors(n):
    d = defaultdict(int)
    while n%2 == 0:
        d[2] += 1
        n //= 2
    i = 3
    while i*i <= n:
        while n%i == 0:
            d[i] += 1
            n //= i
        i += 2
    if n > 2:
        d[n] += 1
    return d

MOD = 10**9+7
N = int(input())
A = list(map(int, input().split()))
G = defaultdict(int)
for a in A:
    pf = prime_factors(a)
    for k,v in pf.items():
        G[k] = max(G[k], v)
lcm = 1
for k,v in G.items():
    lcm *= pow(k, v, MOD)
    lcm %= MOD
ans = 0
for a in A:
    ans += lcm * pow(a, MOD-2, MOD) % MOD
    ans %= MOD
print(ans)

Verdicts: Time Limit Exceeded

Wrong Answer

Accepted
Problem: Given are N positive integers A_1,...,A_N.  Consider positive integers B_1, ..., B_N that satisfy the following condition.  Condition: For any i, j such that 1 \leq i < j \leq N, A_i B_i = A_j B_j holds.  Find the minimum possible value of B_1 + ... + B_N for such B_1,...,B_N.  Since the answer can be enormous, print the sum modulo (10^9 +7).

Submission attempts (in order):
import functools
import fractions
MOD = 10**9+7


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


def lcm(numbers):
    return functools.reduce(lcm_base, numbers, 1)


def main():
    n = int(input())
    x = list(map(int, input().split()))

    l = lcm(x)
    ans = 0
    for i in range(n):
        ans += l // x[i]
        ans %= MOD

    print(ans)


main()


import functools
import fractions
MOD = 10**9+7


def sieve(n):
    result = [0] * (n+1)
    result[0] = result[1] = -1
    
    for i in range(2, n+1):
        if(result[i]):
            continue
        
        result[i] = i
        for j in range(i*i, n+1, i):
            if not result[j]:
                result[j] = i
    return result


def is_prime(table, x):
    return table[x] == x


def factor(table, x):
    result = {}
    while(x != 1):
        p = str(table[x])
        if p not in result:
            result[p] = 1
        else:
            result[p] += 1
        x //= int(p)
    return result


def main():
    n = int(input())
    x = list(map(int, input().split()))

    table = sieve(10**6)
    max_table = {}
    for i in range(n):
        f = factor(table, x[i])
        for j in f:
            if j not in max_table:
                max_table[j] = f[j]
            else:
                max_table[j] = max(max_table[j], f[j])

    lcm = 1
    for p in max_table:
        lcm *= int(p)**max_table[p] % MOD

    ans = 0
    for i in range(n):
        ans += lcm//x[i]
    print(ans % MOD)


main()


Verdicts: Time Limit Exceeded

Accepted
Problem: Given are N positive integers A_1,...,A_N.  Consider positive integers B_1, ..., B_N that satisfy the following condition.  Condition: For any i, j such that 1 \leq i < j \leq N, A_i B_i = A_j B_j holds.  Find the minimum possible value of B_1 + ... + B_N for such B_1,...,B_N.  Since the answer can be enormous, print the sum modulo (10^9 +7).

Submission attempts (in order):
import math
import fractions
N=int(input())
A=list(map(int,input().split()))
tmp=A[0]
ans=0

for i in range(N):
    tmp=math.floor((tmp*A[i])/(fractions.gcd(tmp,A[i])))

for i in range(N):
    ans+=(tmp/A[i])
    ans%=1000000007
    
print(int(ans))

MOD=10**9+7
import sys
read=sys.stdin.readline
from fractions import gcd
from collections import deque
def lcm(a,b):
    return(a//gcd(a,b)*b)
def main():
    N=int(input())
    A=list(map(int,read().split()))
    d=deque(A)
    while(len(d)>1):
        a,b=d.popleft(),d.popleft()
        d.append(lcm(a,b))
    g=d[0]
    res=0
    for i in range(N):
        res=(res+g//A[i])%MOD
    print(res)
    
if __name__=='__main__':
    main()

MOD=10**9+7
def factorization(n):
    arr=[]
    tmp=n
    for i in range(2,int(n**0.5)+1):
        if(tmp%i==0):
            cnt=0
            while tmp%i==0:
                cnt+=1
                tmp//=i
            arr.append([i,cnt])
    if(not arr):
        arr.append([1,1])
    if(tmp!=1):
        arr.append([tmp,1])
    return arr
def moddiv(a,m):
    return pow(a,m-2,m)
N=int(input())
A=list(map(int,input().split()))
cnt={}
for i in range(N):
    arr=factorization(A[i])
    for a,b in arr:
        cnt[a]=max(cnt.get(a,0),b)
g=1;res=0
for k,v in cnt.items():
    g=g*(pow(k,v,MOD))%MOD
for i in range(N):
    res=(res+(g*moddiv(A[i],MOD))%MOD)%MOD
print(res)

Verdicts: Runtime Error

Time Limit Exceeded

Accepted
Problem: Given are N positive integers A_1,...,A_N.  Consider positive integers B_1, ..., B_N that satisfy the following condition.  Condition: For any i, j such that 1 \leq i < j \leq N, A_i B_i = A_j B_j holds.  Find the minimum possible value of B_1 + ... + B_N for such B_1,...,B_N.  Since the answer can be enormous, print the sum modulo (10^9 +7).

Submission attempts (in order):
#!/usr/bin/env python
import math

n = int(input())
a = list(map(int, input().split()))
mod = 10**9+7

def gcd(x, y): 
    if x == 0: return y
    else: return gcd(x%y, x)

def lcm(a, b): 
    return a*b//gcd(a, b)

l = a[0]
for i in range(n):
    l = lcm(l, a[i])

ans = 0 
for i in range(n):
    ans += (l//a[i])%mod

print(ans%mod)


#!/usr/bin/env python
import math
n = int(input()) 
a = list(map(int, input().split()))

mod = 10**9+7

def lcm(a, b): 
    return a*b//math.gcd(a, b)

l = a[0]
for i in range(n):
    l = lcm(l, a[i])
l %= mod 

ans = 0 
for i in range(n):
    inv = pow(a[i], mod-2, mod)
    ans += (l*inv)%mod

print(ans%mod)


Verdicts: Wrong Answer

Accepted
Problem: We have a tree with N vertices numbered 1 to N. The i-th edge in this tree connects Vertex a_i and Vertex b_i.   Consider painting each of these edges white or black. There are 2^{N-1} such ways to paint the edges. Among them, how many satisfy all of the following M restrictions?    * The i-th (1 \leq i \leq M) restriction is represented by two integers u_i and v_i, which mean that the path connecting Vertex u_i and Vertex v_i must contain at least one edge painted black.

Submission attempts (in order):
N = int(input())
adj = [[] for _ in range(n)] 
adj_dict = dict()

for i in range(N - 1):
    a, b = [int(x) - 1 for x in input().split()]
    adj[a].append(b)
    adj[b].append(a)
    if a > b:
        adj_dict[(b, a)] = i
    else:
        adj_dict[(a, b)] = i

m = int(input())
uv = []
for _ in range(m):
    uv.append([int(x) - 1 for x in input().split()])


def dfs(p, v, dest):
    if v == dest:
        return [v]
    if p != -1 and len(adj[v]) == 1:
        return False
    for nv in adj[v]:
        if nv == p:
            continue
        ret = dfs(v, nv, dest)
        if ret:
            return ret + [v]
    return False

edgest = [0] * (2 ** m)
for i, (u, v) in enumerate(uv):
    ret = dfs(-1, u, v)
    for uu, vv in zip(ret, ret[1:]):
        if uu > vv:
            uu, vv = vv, uu
        if (uu, vv) in adj_dict:
            edgest[1 << i] |= (1 << adj_dict[(uu, vv)])

for i in range(1, 2 ** m):
    lsb = i & (-i)
    edgest[i] = edgest[i ^ lsb] | edgest[lsb]

dp = [0] * (2 ** m)
dp[0] = 1 << (N - 1)
ans = dp[0]
for i in range(1, 2 ** m):
    lsb = i & (-i)
    lim = bin(edgest[i] ^ edgest[i ^ lsb]).count('1')
    dp[i] = dp[i ^ lsb] >> lim
    if bin(i).count('1') % 2 == 0:
        ans += dp[i]
    else:
        ans -= dp[i]
print(ans)


n = int(input())
adj = [[] for _ in range(n)]
adj_dict = dict()

for i in range(n - 1):
    a, b = [int(x) - 1 for x in input().split()]
    adj[a].append(b)
    adj[b].append(a)
    if a > b:
        adj_dict[(b, a)] = i
    else:
        adj_dict[(a, b)] = i

m = int(input())
uv = []
for _ in range(m):
    uv.append([int(x) - 1 for x in input().split()])

def dfs(p, v, dest):
    if v == dest:
        return [v]
    if p != -1 and len(adj[v]) == 1:
        return False
    for nv in adj[v]:
        if nv == p:
            continue
        ret = dfs(v, nv, dest)
        if ret:
            return ret + [v]
    return False

edgest = [0] * (2 ** m)
for i, (u, v) in enumerate(uv):
    ret = dfs(-1, u, v)
    for uu, vv in zip(ret, ret[1:]):
        if uu > vv:
            uu, vv = vv, uu
        if (uu, vv) in adj_dict:
            edgest[1 << i] |= (1 << adj_dict[(uu, vv)])

for i in range(1, 2 ** m):
    lsb = i & (-i)
    edgest[i] = edgest[i ^ lsb] | edgest[lsb]

dp = [0] * (2 ** m)
dp[0] = 1 << (n - 1)
ans = dp[0]
for i in range(1, 2 ** m):
    lsb = i & (-i)
    lim = bin(edgest[i] ^ edgest[i ^ lsb]).count('1')
    dp[i] = dp[i ^ lsb] >> lim
    if bin(i).count('1') % 2 == 0:
        ans += dp[i]
    else:
        ans -= dp[i]
print(ans)


Verdicts: Runtime Error

Accepted
Problem: Given is a lowercase English letter C that is not `z`. Print the letter that follows C in alphabetical order.

Submission attempts (in order):
N, M = map(int, input().split())
AC = set()
wa = [0] * (N+1)

for _ in range(M):
    p, s = input().split()
    p = int(p)
    if not p in AC:
        if s == 'AC':
            AC.add(p)
        if s == 'WA':
            wa[p] += 1

wa_ans = 0
for i in range(1,N+1):
    if i in AC:
        wa_ans += wa[i]

print(len(AC), wa_ans)

import sys
alp = "abcdefghijklmnopqrstuvwxyza"
C = input()
for i in range(26):
    if alp[i] == C:
        print(alp[i+1])
        sys.exit()

Verdicts: Runtime Error

Accepted
Problem: Given is a lowercase English letter C that is not `z`. Print the letter that follows C in alphabetical order.

Submission attempts (in order):
s = input()

print(s[0] + 1)

s = input()

print(chr(ord(s[0]) + 1))

Verdicts: Runtime Error

Accepted
Problem: Given is a lowercase English letter C that is not `z`. Print the letter that follows C in alphabetical order.

Submission attempts (in order):
print(chr(ord(input())+1)

print(chr(ord(input())+1))

Verdicts: Runtime Error

Accepted
Problem: Given is a lowercase English letter C that is not `z`. Print the letter that follows C in alphabetical order.

Submission attempts (in order):
chrs=string.ascii_lowercase
nx={c:d for c,d in zip(chrs,chrs[1:])}
print(nx(input())

import string
chrs=string.ascii_lowercase
nx={c:d for c,d in zip(chrs,chrs[1:])}
print(nx[input()])



Verdicts: Runtime Error

Accepted
Problem: Given is a lowercase English letter C that is not `z`. Print the letter that follows C in alphabetical order.

Submission attempts (in order):
print chr(ord('a') + 1)

print(chr(ord(input()) + 1))

Verdicts: Runtime Error

Accepted
Problem: Given is a lowercase English letter C that is not `z`. Print the letter that follows C in alphabetical order.

Submission attempts (in order):
list = [a,b,c,d,e,f,g,h,i,j,k,m,n,o,p,q,r,s,t,u,v,w,x,y,z]

C = str(input())

print(list[(list.index(C)+1)%len(list)])

list = ['a','b','c','d','e','f','g','h','i','j','k','m','n','o','p','q','r','s','t','u','v','w','x','y','z']

C = str(input())

print(list[(list.index(C)+1)%len(list)])


Verdicts: Runtime Error

Accepted
Problem: Given is a lowercase English letter C that is not `z`. Print the letter that follows C in alphabetical order.

Submission attempts (in order):
n=(input())
print(chr(ord(n)+1))
print(n,"is followed by",(chr(ord(n)+1)))


x = input("Enter a letter: ").lower()
print(chr(ord(x) + 1))

InputStr = input()
A = InputStr[0]
B = ord(A)+1
C = chr(B)
print("%s" % C)

Verdicts: Wrong Answer

Wrong Answer

Accepted
Problem: Given is a lowercase English letter C that is not `z`. Print the letter that follows C in alphabetical order.

Submission attempts (in order):
a=input()
print(str(ord(a)+1)

a=input()
b = chr(ord(a)+1)
print(b)

Verdicts: Runtime Error

Accepted
Problem: Given is a lowercase English letter C that is not `z`. Print the letter that follows C in alphabetical order.

Submission attempts (in order):
print(chr(ord(input()) + 1)

print(chr(ord(input()) + 1))

Verdicts: Runtime Error

Accepted
Problem: Given is a lowercase English letter C that is not `z`. Print the letter that follows C in alphabetical order.

Submission attempts (in order):
# -*- coding: utf-8 -*-
n, k, m = map(int, input().split())
a = list(map(int, input().split()))
an = m*n-sum(a)
if (0 <= an <= k):
    print(an)
if 0 > an:
    print(0)
if k < an:
    print(-1)

a = input()
nxt = chr(ord(a)+1)
print(nxt)

Verdicts: Runtime Error

Accepted
Problem: Given is a lowercase English letter C that is not `z`. Print the letter that follows C in alphabetical order.

Submission attempts (in order):
# simply use double ifs
s = input()
print(chr(ord(s))+1)


# simply use double ifs
s = input()
print(chr(ord(s)+1))

Verdicts: Runtime Error

Accepted
Problem: Given is a lowercase English letter C that is not `z`. Print the letter that follows C in alphabetical order.

Submission attempts (in order):
a = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
C = input()
print(a[a.index(C)+1])

a = "abcdefghijklmnopqrstuvwxyz"
C = input()
print(a[a.index(C)+1])

Verdicts: Runtime Error

Accepted
Problem: Given is a lowercase English letter C that is not `z`. Print the letter that follows C in alphabetical order.

Submission attempts (in order):
c = input()
s = 'abcdefghijklmnopqrstuvwxyz'

for i in s:
    if c == s[i]:
        print(s[i+1])
        exit()

c = input()
s = list('abcdefghijklmnopqrstuvwxyz')

for i in s:
    if c == s[i]:
        print(s[i+1])
        exit()

c = input()
s = list('abcdefghijklmnopqrstuvwxyz')

for i in range(len(s)):
    if c == s[i]:
        print(s[i+1])
        exit()

Verdicts: Runtime Error

Runtime Error

Accepted
Problem: Given is a lowercase English letter C that is not `z`. Print the letter that follows C in alphabetical order.

Submission attempts (in order):
a = input()
print(char(ord(a)+1))

a = input()
print(chr(ord(a)+1))


Verdicts: Runtime Error

Accepted
Problem: Given is a lowercase English letter C that is not `z`. Print the letter that follows C in alphabetical order.

Submission attempts (in order):
c=input()
print(c+1)

print(chr(ord(input())+1))


Verdicts: Runtime Error

Accepted
Problem: Given is a lowercase English letter C that is not `z`. Print the letter that follows C in alphabetical order.

Submission attempts (in order):
s = input()
print(chr(ord(s + 1)))

s = input()
print(chr(ord(s) + 1))

Verdicts: Runtime Error

Accepted
Problem: Given is a lowercase English letter C that is not `z`. Print the letter that follows C in alphabetical order.

Submission attempts (in order):
import sys
input = sys.stdin.readline


alphabets = "abcdefghijklmnopqrstuvwxyz"

c = input()
i = alphabets.index(c)

answer = alphabets[i + 1]
print(answer)


import sys
input = sys.stdin.readline


alphabets = "abcdefghijklmnopqrstuvwxyz"

c = input().strip()
i = alphabets.index(c)

answer = alphabets[i + 1]
print(answer)


Verdicts: Runtime Error

Accepted
Problem: Given is a lowercase English letter C that is not `z`. Print the letter that follows C in alphabetical order.

Submission attempts (in order):
a=input()
b=('abcdefghijklmnopqrstuvwxyz')
for i in range(int(len(b)):
	if b[i]==a:
    	print(b[i+1])
              

print(chr(ord(input())+1))


Verdicts: Runtime Error

Accepted
Problem: Given is a lowercase English letter C that is not `z`. Print the letter that follows C in alphabetical order.

Submission attempts (in order):
alphabet = ['a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z']
print(alphabet[alphabet.index(input())])

alphabet = ['a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z']
print(alphabet[alphabet.index(input())+1])

Verdicts: Wrong Answer

Accepted
Problem: Given is a lowercase English letter C that is not `z`. Print the letter that follows C in alphabetical order.

Submission attempts (in order):
n,m=map(int,input().split())
a=[]
for i in range(m):
	p,s=input().split()
	if p in a:
		continue
	if s=="AC":
		a.append(p)
print(len(a))

c=input()
print(chr(ord(c)+1))

Verdicts: Runtime Error

Accepted
Problem: Given is a lowercase English letter C that is not `z`. Print the letter that follows C in alphabetical order.

Submission attempts (in order):
import string

print(type(string.ascii_lowercase))
input = input()
alphabets = string.ascii_lowercase

print(alphabets.index(input))
i = alphabets.index(input)
ans = alphabets[i + 1]
  
print(ans)

import string

print(type(string.ascii_lowercase))
input = input()
alphabets = string.ascii_lowercase


i = alphabets.index(input)
output = alphabets[i+1]
  
print('{} の次は {} です。'.format(input, output))

from string import ascii_lowercase as alphabets

input = input()
print(alphabets[alphabets.index(input) + 1])

Verdicts: Wrong Answer

Wrong Answer

Accepted
Problem: Given is a lowercase English letter C that is not `z`. Print the letter that follows C in alphabetical order.

Submission attempts (in order):
l = input().split(" ")
N = int(l[0])
M = int(l[1])

answered = set()

ac_count = 0
wa_count = 0

for n in range(M):
    result = [i for i in input().split(" ")]
    p = result[0]
    if p in answered:
        continue
    s = result[1]
    if s == "WA":
        wa_count += 1
    else:
        ac_count += 1
        answered.add(p)
        if len(answered) == N:
            break

print(ac_count, wa_count)

ord_s = ord(input())

chr_s = chr(ord_s+1)
print(chr_s)

Verdicts: Runtime Error

Accepted
Problem: Given is a lowercase English letter C that is not `z`. Print the letter that follows C in alphabetical order.

Submission attempts (in order):
lis = "abcdefghijklmnopqrstuvwxyz"

z = input()

for a in range(len(lis)-1):
  if z = lis[a]:
    print(lis[a+1])
    exit()

lis = "abcdefghijklmnopqrstuvwxyz"
dic = {}

z = imput()

for a in range(len(lis)-1):
  if z = lis[a]:
    print(lis[a+1])
    exit()


lis = "abcdefghijklmnopqrstuvwxyz"
 
z = input()
 
for a in range(len(lis)-1):
  if z == lis[a]:
    print(lis[a+1])
    exit()

Verdicts: Runtime Error

Runtime Error

Accepted