Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Runtime Error):
input = sys.stdin.readline
h,w=map(int, input().split())
a=[list(map(int, input().split())) for i in range(h)]
x=0
for i in range(h):
    for j in range(w):
        x+=a[i][j]*((h-i-1)+(w-j-1))
        
print(x)

for i in range(h):
    for j in range(w):
        if a[i][j]!=0:
            for k in range(a[i][j]):
                for l in range(1,w-j):
                    print(i+1,j+l,i+1,j+l+1)
                for m in range(1,h-i):
                    print(i+m,w,i+m+1,w)

Fixed submission:
import sys
input = sys.stdin.readline
h,w=map(int, input().split())
a=[list(map(int, input().split())) for i in range(h)]
ans=[]


for i in range(h):
    for j in range(w):
        if i==h-1 and j==w-1:
            continue
        
        if a[i][j]%2==0:
            continue
        
        if j!=w-1:
            ans.append([i+1,j+1,i+1,j+2])
            a[i][j+1]+=1
        else:
            ans.append([i+1,j+1,i+2,j+1])
            a[i+1][j]+=1
            
print(len(ans))
for i in range(len(ans)):
    print(*ans[i])

Buggy python submission (verdict: Runtime Error):
input = sys.stdin.readline
h,w=map(int, input().split())
a=[list(map(int, input().split())) for i in range(h)]
x=0
for i in range(h):
    for j in range(w):
        x+=a[i][j]*((h-i-1)+(w-j-1))
        
print(x)

for i in range(h):
    for j in range(w):
        if a[i][j]!=0:
            for k in range(a[i][j]):
                for l in range(1,w-j):
                    print(i+1,j+l,i+1,j+l+1)
                for m in range(1,h-i):
                    print(i+m,w,i+m+1,w)

Fixed submission:
import sys
input = sys.stdin.readline
h,w=map(int, input().split())
a=[list(map(int, input().split())) for i in range(h)]
ans=[]


for i in range(h):
    for j in range(w):
        if i==h-1 and j==w-1:
            continue
        
        if a[i][j]%2==0:
            continue
        
        if j!=w-1:
            ans.append([i+1,j+1,i+1,j+2])
            a[i][j+1]+=1
        else:
            ans.append([i+1,j+1,i+2,j+1])
            a[i+1][j]+=1
            
print(len(ans))
for i in range(len(ans)):
    print(*ans[i])
Buggy python submission (verdict: Time Limit Exceeded):
import itertools

n, m = map(int, input().split())
a=list(map(int,input().split()))
b =[0]+ list(itertools.accumulate(a))
count=0

for i in range(n):
    for j in range(i+1,n+1):
        if (b[j]-b[i])%m==0:
            count+=1
print(count)


Fixed submission:
import itertools
import collections

n, m = map(int, input().split())
a=list(map(int,input().split()))
b =[0]+ list(itertools.accumulate(a))
count=0
for i in range(n+1):
    b[i]=b[i]%m

b=collections.Counter(b)
b=b.most_common()

for i in range(len(b)):
    if b[i][1]>=2:
        count+=b[i][1]*(b[i][1]-1)//2
    else:
        break
print(count)

Buggy python submission (verdict: Time Limit Exceeded):

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

for i in range(n):
    a[i]=a[i]%m

count=0
cnt=0

for i in range(n):
    for j in range(i,n):
        cnt=(cnt+a[j])%m
        if cnt==0:
            count+=1
            
    cnt=0
    

print(count)






Fixed submission:
import itertools
import collections

n, m = map(int, input().split())
a=list(map(int,input().split()))
b =[0]+ list(itertools.accumulate(a))
count=0
for i in range(n+1):
    b[i]=b[i]%m

b=collections.Counter(b)
b=b.most_common()

for i in range(len(b)):
    if b[i][1]>=2:
        count+=b[i][1]*(b[i][1]-1)//2
    else:
        break
print(count)

Buggy python submission (verdict: Time Limit Exceeded):

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

for i in range(n):
    a[i]=a[i]%m

count=0
cnt=0

for i in range(n):
    for j in range(i,n):
        cnt=cnt+a[j]
        if cnt%m==0:
            count+=1
    cnt=0
    

print(count)






Fixed submission:
import itertools
import collections

n, m = map(int, input().split())
a=list(map(int,input().split()))
b =[0]+ list(itertools.accumulate(a))
count=0
for i in range(n+1):
    b[i]=b[i]%m

b=collections.Counter(b)
b=b.most_common()

for i in range(len(b)):
    if b[i][1]>=2:
        count+=b[i][1]*(b[i][1]-1)//2
    else:
        break
print(count)
Buggy python submission (verdict: Runtime Error):
x = [list(map(int, input().split())) for i in range(d)]
ans2=float('inf')

for i in range(2**d):
    v=[0]*d
    ans=0
    ans1=0
    for j in range(d):
        if (i>>j)&1==1:
            ans+=(x[j][0]*100*(j+1))+x[j][1]
            ans1+=x[j][0]
            v[j]=1


    if ans<g:
        for k in range(d):
            if v[d-k-1]==0:
                if g-ans<=(x[d-k-1][0]-1)*100*(d-k):
                    w=-(-(g-ans)//(100*(d-k)))

                    ans2=min(ans2,ans1+w)
                else:
                    break
    else:
        ans2=min(ans2,ans1)
print(ans2)

Fixed submission:
d,g=map(int, input().split())
p=[list(map(int, input().split())) for i in range(d)]
x=[]
for i in range(2**d):
    t=0
    u=0
    v=[]
    for k in range(d):
        v.append(k)
    for j in range(d):
        if ((i>>j)&1):
            t+=p[j][0]*100*(j+1)+p[j][1]
            u+=p[j][0]
            v[j]=0
    if i==0:
        for j in range(d):
            for k in range(p[j][0]):
                if (j+1)*k<g<=(j+1)*(k+1):
                    x.append(j+1)
    if t>=g:
        x.append(u)
    else:
        for l in range(p[max(v)][0]):
            if t+(max(v)+1)* 100*l<g<=t+(max(v)+1)* 100*(l+1):
                x.append(u+l+1)
print(min(x))
Buggy python submission (verdict: Runtime Error):
h,w=map(int, input().split()) 
s=[list(input()) for i in range(w)] 

s1=[['.' for i in range(h+2)] for i in range(w+2)]

for i in range(h):
    for j in range(w):
        if s[i][j]=='#':
            s1[i+1][j+1]='#'
for i in range(h+2):
    for j in range(w+2):
        if s1[i][j]=='#':
            if s1[i-1][j]==s1[i+1][j]==s1[i][j-1]==s1[i][j+1]=='.':
                print('No')
                exit()
print('Yes')

Fixed submission:
h,w=map(int, input().split()) 
s=[list(input()) for i in range(h)] 

s1=[['.' for i in range(w+2)] for i in range(h+2)]

for i in range(h):
    for j in range(w):
        if s[i][j]=='#':
            s1[i+1][j+1]='#'
for i in range(h+2):
    for j in range(w+2):
        if s1[i][j]=='#':
            if s1[i-1][j]==s1[i+1][j]==s1[i][j-1]==s1[i][j+1]=='.':
                print('No')
                exit()
print('Yes')

Buggy python submission (verdict: Runtime Error):
h,w=map(int, input().split()) 
s=[list(input()) for i in range(w)] 

s1=[['.' for i in range(h+2)] for i in range(w+2)]

for i in range(h):
    for j in range(w):
        if s[i][j]=='#':
            s1[i+1][j+1]='#'
for i in range(h+2):
    for j in range(w+2):
        if s1[i][j]=='#':
            if s1[i-1][j]==s1[i+1][j]==s1[i][j-1]==s1[i][j+1]=='.':
                print('No')
                exit()
print('Yes')

Fixed submission:
h,w=map(int, input().split()) 
s=[list(input()) for i in range(h)] 

s1=[['.' for i in range(w+2)] for i in range(h+2)]

for i in range(h):
    for j in range(w):
        if s[i][j]=='#':
            s1[i+1][j+1]='#'
for i in range(h+2):
    for j in range(w+2):
        if s1[i][j]=='#':
            if s1[i-1][j]==s1[i+1][j]==s1[i][j-1]==s1[i][j+1]=='.':
                print('No')
                exit()
print('Yes')
Buggy python submission (verdict: Runtime Error):
import numpy as np
a,b = map(int, input().split())

x=np.array([['.']*100]*100,dtype=str)

x[:,:50]='#'

v1=(a-1)//20
v2=(a-1)-v1
w1=(b-1)//20
w2=(b-1)-w1

for i in range(v1):
    x[2*i+1,1:40:2]='.'

x[-1,1:2*v2:2]='.'

for i in range(w1):
    x[2*i+1,51:90:2]='#'
x[-1,51:50+w2*2:2]='#'

for i in range(100):
    print(''.join(x[i]))

Fixed submission:
import numpy as np
a,b = map(int, input().split())

x=np.array([['.']*100]*100,dtype=str)

x[:,:50]='#'

v1=(a-1)//20
v2=(a-1)-v1*20
w1=(b-1)//20
w2=(b-1)-w1*20

for i in range(v1):
    x[2*i+1,1:40:2]='.'

x[-1,1:2*v2:2]='.'

for i in range(w1):
    x[2*i+1,51:90:2]='#'
x[-1,51:50+w2*2:2]='#'
print(100,100)
for i in range(100):
    print(''.join(x[i]))
Buggy python submission (verdict: Runtime Error):
n=int(input())
r=[list(map(int, input().split())) for i in range(n)]
b=[list(map(int, input().split())) for i in range(n)]
v=[]
r.sort()
b.sort()
print(r)
print(b)
count=0

for i in range(n):
    for j in range(n):
        if b[i][0]<=r[j][0] or b[i][1]<=r[j][1]:
            break
        else:
            v.append(r[j])    
    if v!=[]:
        v.sort(key=lambda x:x[1])
        print(v)
        r.remove(v[0])
        
            
        v=[]
        count+=1
print(count)
        

Fixed submission:
n=int(input())
r=[list(map(int, input().split())) for i in range(n)]
b=[list(map(int, input().split())) for i in range(n)]
v=[]
r.sort()
b.sort()
count=0
 
for i in range(n):
    for j in range(len(r)):
        if b[i][0]<=r[j][0] or b[i][1]<=r[j][1]:
            pass
        else:
            v.append(r[j])    
    if v!=[]:
        v.sort(key=lambda x:x[1])
        v.reverse()
        r.remove(v[0])
        
            
        v=[]
        count+=1
print(count)
Buggy python submission (verdict: Runtime Error):
h,w,d = map(int, input().split())
a = [list(map(int, input().split())) for i in range(h)]
q=int(input())
b=[list(map(int, input().split())) for i in range(q)]
import collections
from collections import defaultdict
x=defaultdict(int)



for i in range(h):
    for j in range(w):
        x[i,j]=a[i][j]
x1=sorted(x.items(),key=lambda x:x[1])

ans=[[0]*(-(h*w//-d)) for i in range(d)]


for i in range(d):
    count=0
    for j in range(1,-(h*w//-d)-1):
        count+=abs(x1[i+(j-1)*d][0][0]-x1[i+j*d][0][0])
        count+=abs(x1[i+(j-1)*d][0][1]-x1[i+j*d][0][1])
        ans[i][j]+=count

for i in range(q):
    u=(b[i][0]-1)%d
    u1=(b[i][0]-u)//d
    v=(b[i][1]-b[i][0])//d

    print(ans[u][u1+v]-ans[u][u1])

Fixed submission:
h,w,d = map(int, input().split())
a = [list(map(int, input().split())) for i in range(h)]
q=int(input())
b=[list(map(int, input().split())) for i in range(q)]
import collections
from collections import defaultdict
x=defaultdict(int)



for i in range(h):
    for j in range(w):
        x[i,j]=a[i][j]
x1=sorted(x.items(),key=lambda x:x[1])

ans=[[0]*(-(h*w//-d)) for i in range(d)]


for i in range(d):
    count=0
    for j in range(1,-(h*w//-d)):
        if i+j*d>=h*w:
            continue
        count+=abs(x1[i+(j-1)*d][0][0]-x1[i+j*d][0][0])
        count+=abs(x1[i+(j-1)*d][0][1]-x1[i+j*d][0][1])
        ans[i][j]+=count

for i in range(q):
    u=(b[i][0]-1)%d
    u1=(b[i][0]-1-u)//d
    v=(b[i][1]-b[i][0])//d

    print(ans[u][u1+v]-ans[u][u1])

Buggy python submission (verdict: Runtime Error):
h,w,d = map(int, input().split())
a = [list(map(int, input().split())) for i in range(h)]
q=int(input())
b=[list(map(int, input().split())) for i in range(q)]
import collections
from collections import defaultdict
x=defaultdict(int)



for i in range(h):
    for j in range(w):
        x[i,j]=a[i][j]
x1=sorted(x.items(),key=lambda x:x[1])

ans=[[0]*(-(h*w//-d)) for i in range(d)]


for i in range(d):
    count=0
    for j in range(1,-(h*w//-d)):
        if i+j*d>=h*w:
            continue
        count+=abs(x1[i+(j-1)*d][0][0]-x1[i+j*d][0][0])
        count+=abs(x1[i+(j-1)*d][0][1]-x1[i+j*d][0][1])
        ans[i][j]+=count

for i in range(q):
    u=(b[i][0]-1)%d
    u1=(b[i][0]-u)//d
    v=(b[i][1]-b[i][0])//d

    print(ans[u][u1+v]-ans[u][u1])

Fixed submission:
h,w,d = map(int, input().split())
a = [list(map(int, input().split())) for i in range(h)]
q=int(input())
b=[list(map(int, input().split())) for i in range(q)]
import collections
from collections import defaultdict
x=defaultdict(int)



for i in range(h):
    for j in range(w):
        x[i,j]=a[i][j]
x1=sorted(x.items(),key=lambda x:x[1])

ans=[[0]*(-(h*w//-d)) for i in range(d)]


for i in range(d):
    count=0
    for j in range(1,-(h*w//-d)):
        if i+j*d>=h*w:
            continue
        count+=abs(x1[i+(j-1)*d][0][0]-x1[i+j*d][0][0])
        count+=abs(x1[i+(j-1)*d][0][1]-x1[i+j*d][0][1])
        ans[i][j]+=count

for i in range(q):
    u=(b[i][0]-1)%d
    u1=(b[i][0]-1-u)//d
    v=(b[i][1]-b[i][0])//d

    print(ans[u][u1+v]-ans[u][u1])
Buggy python submission (verdict: Runtime Error):
import itertools
n,c = map(int, input().split())
a = [list(map(int, input().split())) for i in range(n)]
a.sort(key=lambda x:x[0])
a.sort(key=lambda x:x[2])

# 同じチャンネルの番組を繋げる。
for i in range(n-1):
    if a[i][1]==a[i+1][0] and a[i][2]==a[i+1][2]:
        a[i][1]-=1
# いもす法
x=[0]*(10**5+1)
for i in range(n):
    x[a[i][0]]+=1
    x[a[i][1]+1]-=1

x = itertools.accumulate(x)
print(max(x))

Fixed submission:
import itertools
n,c = map(int, input().split())
a = [list(map(int, input().split())) for i in range(n)]
a.sort(key=lambda x:x[0])
a.sort(key=lambda x:x[2])

# 同じチャンネルの番組を繋げる。
for i in range(n-1):
    if a[i][1]==a[i+1][0] and a[i][2]==a[i+1][2]:
        a[i][1]-=1
# いもす法
x=[0]*(10**5+5)
for i in range(n):
    x[a[i][0]]+=1
    x[a[i][1]+1]-=1

x = itertools.accumulate(x)
print(max(x))

Buggy python submission (verdict: Runtime Error):
import itertools
n,c = map(int, input().split())
a = [list(map(int, input().split())) for i in range(n)]
a.sort(key=lambda x:x[0])
# いもす法
x=[0]*(10**5+1)
for i in range(n):
    x[a[i][0]]+=1
    x[a[i][1]+1]-=1

x = itertools.accumulate(x)

print(max(x))

Fixed submission:
import itertools
n,c = map(int, input().split())
a = [list(map(int, input().split())) for i in range(n)]
a.sort(key=lambda x:x[0])
a.sort(key=lambda x:x[2])

# 同じチャンネルの番組を繋げる。
for i in range(n-1):
    if a[i][1]==a[i+1][0] and a[i][2]==a[i+1][2]:
        a[i][1]-=1
# いもす法
x=[0]*(10**5+5)
for i in range(n):
    x[a[i][0]]+=1
    x[a[i][1]+1]-=1

x = itertools.accumulate(x)
print(max(x))
Buggy python submission (verdict: Time Limit Exceeded):
n=int(input())
a=list(map(int, input().split()))
b=list(map(int, input().split()))
c=list(map(int, input().split()))
cnt=0
count=0

a.sort()
b.sort()
c.sort()

for i in range(n):
    for j in range(n):
        for k in range(n):
            if c[i]>b[j]>a[k]:
                count+=1
print(count)

Fixed submission:
import bisect

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

a.sort()
b.sort()
c.sort()

ans=0

for i in range(n):
    x=bisect.bisect_right(a,b[i]-1)
    y=n-bisect.bisect_left(c,b[i]+1)

    ans+=x*y

print(ans)
Buggy python submission (verdict: Runtime Error):
s=input()
t=input()
u=''
v=[]
count=0

for i in range(len(s)-len(t)+1):
    for j in range(len(t)):
        if t[j]==s[i+j] or s[i+j]=='?':
            count+=1
    if count==len(t):
        for k in range(len(s)):
            if k>=i:
                u+=t[k-i]
            elif s[k]=='?':
                u+='a'
            else:
                u+=s[k]
                    
                    
        v.append(u)
        u=''
    count=0
if v==[]:
    print('UNRESTORABLE')
else:
    print(min(v))

Fixed submission:
s=input()
t=input()
u=''
v=[]
count=0

for i in range(len(s)-len(t)+1):
    for j in range(len(t)):
        if t[j]==s[i+j] or s[i+j]=='?':
            count+=1
    if count==len(t):
        for k in range(len(s)):
            if i<=k<=i+len(t)-1:
                u+=t[k-i]
            elif s[k]=='?':
                u+='a'
            else:
                u+=s[k]
                    
                    
        v.append(u)
        u=''
    count=0
if v==[]:
    print('UNRESTORABLE')
else:
    print(min(v))

Buggy python submission (verdict: Runtime Error):
s=input()
t=input()
u=''
v=[]
count=0

for i in range(len(s)-len(t)+1):
    for j in range(len(t)):
        if t[j]==s[i+j] or s[i+j]=='?':
            count+=1
    if count==len(t):
        for k in range(len(s)):
            if k>=i:
                u+=t[k-i]
            elif s[k]=='?':
                u+='a'
            else:
                u+=s[k]
                    
                    
        v.append(u)
        u=''
    count=0
    
print(min(v))

Fixed submission:
s=input()
t=input()
u=''
v=[]
count=0

for i in range(len(s)-len(t)+1):
    for j in range(len(t)):
        if t[j]==s[i+j] or s[i+j]=='?':
            count+=1
    if count==len(t):
        for k in range(len(s)):
            if i<=k<=i+len(t)-1:
                u+=t[k-i]
            elif s[k]=='?':
                u+='a'
            else:
                u+=s[k]
                    
                    
        v.append(u)
        u=''
    count=0
if v==[]:
    print('UNRESTORABLE')
else:
    print(min(v))
Buggy python submission (verdict: Time Limit Exceeded):
n=int(input())

high=3500
low=1

for i in range(1,3501):
    for j in range(i,3501):
        while high-low>1:
            k=(high+low)//2
            x=4*(i*j*k)/(i*j+j*k+k*i)
            if n==x:
                print(i,j,int(k))
                exit()
                
            elif n>x:
                low=x                
            else:
                high=x
                    
                    
                    

    



Fixed submission:
N=int(input())

for i in range(1,3501):
    for j in range(i,3501):
        if 4*i*j-N*i-N*j<=0:
            continue
        k=(N*i*j)/(4*i*j-N*i-N*j)
        if k>0 and k-(N*i*j)//(4*i*j-N*i-N*j)==0:
            print(i,j,int(k))
            exit()
Buggy python submission (verdict: Time Limit Exceeded):
import sys
input = sys.stdin.readline

n,m,r= map(int, input().split())
rr= list(map(int, input().split()))
a= [list(map(int, input().split())) for i in range(m)]
edges=[[] for i in range(n)]

for x,y,z in a:
    edges[x-1].append((y-1,z))
    edges[y-1].append((x-1,z))

#ダイクストラ法
from heapq import heappush, heappop

def dijkstra(edges, size, source,g):
    # edge=探索するグラフ
    # size=グラフの点の数
    # source=スタート点
    distance = [float('inf')] * size
    distance[source] = 0
    visited = [False] * size
    pq = []
    heappush(pq, (0, source))
    while pq:
        dist_v, v = heappop(pq)
        visited[v] = True
        for u, weight in edges[v]:
            if not visited[u]:
                new_dist = dist_v + weight
                if distance[u] > new_dist:
                    distance[u] = new_dist
                    heappush(pq, (new_dist, u))
    return distance[g]

# bit DP
# dp[S][v]: 訪れた点の集合がSで最後にVを訪れた時のVのMIN
INF=float('inf')
dp=[[INF]*r for i in range(1<<r)]
dp[0]=[0]*r

for i in range(1<<r):
    for k in range(r):
        # 訪問リストに入っているものを最後に訪問する時
        if (i >> k) & 1:
            if i^(1<<k)==0:
                dp[i][k]=0
            else:
                # 最後に訪れるものを除いた集合でどこを最後に訪問した時がminか調べる
                for l in range(r):
                    if (i ^ (1 << k))>>l:
                        dpm = dp[i ^ (1 << k)][l]
                        ad = dijkstra(edges, n, rr[l] - 1, rr[k] - 1)
                        dp[i][k] = min(dpm + ad, dp[i][k])

print(min(dp[-1]))

Fixed submission:
import sys
input = sys.stdin.readline

n,m,r= map(int, input().split())
rr= list(map(int, input().split()))
a= [list(map(int, input().split())) for i in range(m)]
d=[[float('inf')]*n for i in range(n)]
for i in range(n):
    d[i][i]=0

for i,j,k in a:
    i-=1
    j-=1
    d[i][j]=k
    d[j][i]=k


# ワーシャルフロイド　全点最短経路、負の距離あっても可　o(n**3)
def warshall_floyd(d):
    #d[i][j]: iからjへの最短距離
    for k in range(n):
        for i in range(n):
            for j in range(n):
                d[i][j] = min(d[i][j],d[i][k] + d[k][j])

    return d
d=warshall_floyd(d)


# bit DP
# dp[S][v]: 訪れた点の集合がSで最後にVを訪れた時のVのMIN
INF=float('inf')
dp=[[INF]*r for i in range(1<<r)]
dp[0]=[0]*r

for i in range(1<<r):
    for k in range(r):
        # 訪問リストに入っているものを最後に訪問する時
        if (i >> k) & 1:
            if i^(1<<k)==0:
                dp[i][k]=0
            else:
                # 最後に訪れるものを除いた集合でどこを最後に訪問した時がminか調べる
                for l in range(r):
                    if (i ^ (1 << k))>>l:
                        dpm = dp[i ^ (1 << k)][l]
                        ad = d[rr[l] - 1][ rr[k] - 1]
                        dp[i][k] = min(dpm + ad, dp[i][k])

print(min(dp[-1]))
Buggy python submission (verdict: Runtime Error):
n=int(input())
s=list(input())
v=[]
for i in range(1,n):
    if s[i]==s[i-1]:
        del(v[-1])
        v.append(1)
        
    else:
        v.append(0)


if v[0]==0:
    ans=3
else:
    ans=6
for i in range(1,len(v)):
    if v[i-1]==0:
        ans*=2
    elif v[i]==1:
        ans*=3
    else:
        continue
    

mod = 1000000007

print(ans%mod)
        

        
    


Fixed submission:
n=int(input())
s=list(input())
v=[0]
for i in range(1,n):
    if s[i]==s[i-1]:
        del(v[-1])
        v.append(1)
        
    else:
        v.append(0)


if v[0]==0:
    ans=3
else:
    ans=6
for i in range(1,len(v)):
    if v[i-1]==0:
        ans*=2
    elif v[i]==1:
        ans*=3
    else:
        continue
    

mod = 1000000007

print(ans%mod)
Buggy python submission (verdict: Runtime Error):
import fractions

n=int(input())
t=list(int(input()) for i in range(n))

for i in range(n-1):
    ans=t[i]*t[i+1]//fractions.gcd(t[i],t[i+1])
    
print(ans)
        

Fixed submission:
import fractions

n=int(input())
t=list(int(input()) for i in range(n))
ans=t[0]
for i in range(n-1):
    ans=ans*t[i+1]//fractions.gcd(ans,t[i+1])
    
    
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):

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

a.sort()
x=0
b=set(a)
b=list(b)
for i in range(len(b)):
    if a.count(b[i])!=1:
        x+=a.count(b[i])-1
        
y=len(b)
if x%2==0:
    print(y)

else:
    print(y-1)
    



    

    
    
    





Fixed submission:
import collections
n=int(input())
a=list(map(int, input().split())) 

a.sort()
x=0
count=0
b=set(a)
b=list(b)

c = collections.Counter(a)
c=c.most_common()
for i in range(len(c)):
    if c[i][1]!=1:
        x+=c[i][1]-1
    else:
        break
y=len(b)
if x%2==0:
    print(y)

else:
    print(y-1)
Buggy python submission (verdict: Time Limit Exceeded):
k,s=map(int, input().split())
ans=0
for x in range(k+1):
    for y in range(min(k+1,s+1-x)):
        z=s-x-y
        if x+y<=s and x<=k and y<=k and z<=k:
            ans+=1
print(ans)

Fixed submission:
k,s=map(int, input().split())
ans=0
for x in range(k+1):
    for y in range(min(k+1,s+1-x)):
        z=s-x-y
        if 0<=z<=k:
            ans+=1
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
k,s=map(int, input().split())
ans=0
for x in range(s+1):
    for y in range(s+1-x):
        z=s-x-y
        if x+y<=s and x<=k and y<=k and z<=k:
            ans+=1
print(ans)

Fixed submission:
k,s=map(int, input().split())
ans=0
for x in range(k+1):
    for y in range(min(k+1,s+1-x)):
        z=s-x-y
        if 0<=z<=k:
            ans+=1
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
k,s=map(int, input().split())
ans=0
for x in range(s+1):
    for y in range(s+1):
        z=s-x-y
        if x+y<=s and x<=k and y<=k and z<=k:
            ans+=1
print(ans)
               

Fixed submission:
k,s=map(int, input().split())
ans=0
for x in range(k+1):
    for y in range(min(k+1,s+1-x)):
        z=s-x-y
        if 0<=z<=k:
            ans+=1
print(ans)
Buggy python submission (verdict: Runtime Error):
from decimal import *
 import math
 
 getcontext().prec = 10000
 
 a, b, c = map(int, input().split())
 a = Decimal(a)
 b = Decimal(b)
 c = Decimal(c)
 
 a = Decimal.sqrt(a)
 b = Decimal.sqrt(b)
 c = Decimal.sqrt(c)
 
 print(a, a * a)
 
 if a + b < c:
     print("Yes")
 else:
     print("No")
 

Fixed submission:
from decimal import *
import math


a, b, c = map(int, input().split())
a = Decimal(a)
b = Decimal(b)
c = Decimal(c)

a = Decimal.sqrt(a)
b = Decimal.sqrt(b)
c = Decimal.sqrt(c)

if a + b < c:
    print("Yes")
else:
    print("No")