Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Time Limit Exceeded):
n,m = map(int,input().split())
if m%n==0:
    print(int(m//n))
    exit()
else:
  a = m//n
  l = []
  for i in range(1,a+1):
    if m%i==0:
      l.append(i)
  l = sorted(l)[::-1]
  for i in l:
    s = m-n*i
    if s%i==0:
      print(i)
      exit()
print(1)

Fixed submission:
n,m = map(int,input().split())
if m%n==0:
    print(int(m//n))
    exit()
else:
  a = m/n
  l = []
  for i in range(int(m**0.5),0,-1):
    if m%i==0:
      l.append(i)
      l.append(m//i)
  l = sorted(l)[::-1]
  for j  in l:
    if j<=a:
      print(j)
      exit()
  else:
    print(1)

Buggy python submission (verdict: Time Limit Exceeded):
n,m = map(int,input().split())
if m%n==0:
    print(int(m//n))
    exit()
else:
  a = m//n
  for i in range(a,0,-1):
    s = m-n*i
    if (s+i)%i==0:
      print(i)
      exit()
    elif a>10**8 and i == 10**3:
      print(1)
      exit()

Fixed submission:
n,m = map(int,input().split())
if m%n==0:
    print(int(m//n))
    exit()
else:
  a = m/n
  l = []
  for i in range(int(m**0.5),0,-1):
    if m%i==0:
      l.append(i)
      l.append(m//i)
  l = sorted(l)[::-1]
  for j  in l:
    if j<=a:
      print(j)
      exit()
  else:
    print(1)

Buggy python submission (verdict: Time Limit Exceeded):
from fractions import gcd
n,m = map(int,input().split())
if m%n==0:
    print(int(m//n))
    exit()
else:
  a = m//n
  for i in range(a,0,-1):
    s = m-n*i
    if (s+i)%i==0:
      print(i)
      exit()

Fixed submission:
n,m = map(int,input().split())
if m%n==0:
    print(int(m//n))
    exit()
else:
  a = m/n
  l = []
  for i in range(int(m**0.5),0,-1):
    if m%i==0:
      l.append(i)
      l.append(m//i)
  l = sorted(l)[::-1]
  for j  in l:
    if j<=a:
      print(j)
      exit()
  else:
    print(1)

Buggy python submission (verdict: Runtime Error):
from math import gcd
n,m = map(int,input().split())
if m%n==0:
    print(int(m//n))
    exit()
else:
    a = m%n
    b = m//n
    c = a+b
    while True:
        if gcd(b,c)!=1:
            print(gcd(b,c))
            exit()
        else:
            c -= 1
print(1)

Fixed submission:
n,m = map(int,input().split())
if m%n==0:
    print(int(m//n))
    exit()
else:
  a = m/n
  l = []
  for i in range(int(m**0.5),0,-1):
    if m%i==0:
      l.append(i)
      l.append(m//i)
  l = sorted(l)[::-1]
  for j  in l:
    if j<=a:
      print(j)
      exit()
  else:
    print(1)
Buggy python submission (verdict: Runtime Error):
h,w = map(int,input().split())
l = list(list(input()) for i in range(h))
for i in l:
  if i.count('.') ==w:
    i.clear()
    l.remove([])
t = len(l)
for i in range(w):
  if all (l[q][i]=="." for q in range(t)):
    for q in range(t):
      l[q][i] =""
for z in l:
  z.remove("")
for i in l:
  print("".join(i))
  

Fixed submission:
h,w = map(int,input().split())
l = list(list(input()) for i in range(h))
for i in l:
  if i.count('.') ==w:
    i.clear()
l= [i for i in l if i!=[]]
#print(l)
t = len(l)
for i in range(w):
  if all (l[q][i]=="." for q in range(t)):
    for q in range(t):
      l[q][i] =""
if "" in l:
  for z in l:
    z.remove("")
for m in l:
  print("".join(m))

Buggy python submission (verdict: Runtime Error):
h,w = map(int,input().split())
l = list(list(input()) for i in range(h))
for i in l:
  if i.count('.') ==w:
    i.clear()
    l.remove([])
t = len(l)
#print(l)
for i in range(w):
  if all (l[q][i]=="." for q in range(t)):
    for q in range(t):
      l[q][i] =""
for z in range(t):
  l[z].remove("")
print(l)
  

Fixed submission:
h,w = map(int,input().split())
l = list(list(input()) for i in range(h))
for i in l:
  if i.count('.') ==w:
    i.clear()
l= [i for i in l if i!=[]]
#print(l)
t = len(l)
for i in range(w):
  if all (l[q][i]=="." for q in range(t)):
    for q in range(t):
      l[q][i] =""
if "" in l:
  for z in l:
    z.remove("")
for m in l:
  print("".join(m))
Buggy python submission (verdict: Runtime Error):
s = int(input())
while s >0:
  if s%7 == 0:
    print('Yes')
    break
  s -= 4
    
if s<0:
  print('No')

Fixed submission:
N,K = map(int,input().split())
if N%K == 0:
  print(0)
  
else:
  print(1)

Buggy python submission (verdict: Runtime Error):
s = int(input())
while s >0:
  s = s-4
  if s%7 == 0:
    print('Yes')
    break
    
if s<=0:
  print('No')

Fixed submission:
N,K = map(int,input().split())
if N%K == 0:
  print(0)
  
else:
  print(1)
Buggy python submission (verdict: Runtime Error):
r = input()
if r < 1200:
  print('ABC')
elif r >= 2800:
  print("AGC")
else:
  print('ARC')

Fixed submission:
r = int(input())
if r < 1200:
  print('ABC')
elif r >= 2800:
  print("AGC")
else:
  print('ARC')
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
l = list(100 for _ in range(n+1))
l[0] = 0
for i in range(n+1):
  for j in range(i+1,n+1):
    l[j] = min(l[j],l[i]+(j-i))
#  print(l)
  for k in range(7):
    if i+6**k<=n:
      l[i+6**k] = min(l[i+6**k],l[i]+1)
 # print(l)
  for m in range(7):
    if i+9**m<=n:
      l[i+9**m] = min(l[i+9**m],l[i]+1)
  #print(l)
print(l[-1])
      

Fixed submission:
n = int(input())
l = list(i for i in range(n+1))
for i in range(n+1):
  for k in range(7):
    if i+6**k<=n:
      l[i+6**k] = min(l[i+6**k],l[i]+1)
 # print(l)
  for m in range(7):
    if i+9**m<=n:
      l[i+9**m] = min(l[i+9**m],l[i]+1)
  #print(l)
print(l[-1])
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
s = input()
m = 10**6
for i in range(n):
  m = min(m,s[:i].count("W")+s[i+1:].count("E"))
print(m)

Fixed submission:
from itertools import accumulate
n = int(input())
s = input()
list_e = [0]*n
list_w = [0]*n
for i in range(n):
  if s[i]=="E":
    list_e[i]=1
for i in range(n):
  if s[i]=="W":
    list_w[i]=1
    
list_e = list(accumulate([0]+list_e))
list_w = list(accumulate([0]+list_w))
m = 10**7
for i in range(n):
  a = list_w[i]
  b = list_e[-1]-list_e[i+1]
  m = min(m,a+b)
print(m)
Buggy python submission (verdict: Runtime Error):
a = int(input())
for i in range(a):
  a = a-i
  for k in range(2,10):
    if int(a**(1/k))**k == a:
      print(a)
      break
  else:
      continue
  break
    

Fixed submission:
x = int(input())
l1 = [1]
l2 = list(2**i for i in range(2,11))
l3 = list(3**i for i in range(2,7))
l4 = list(4**i for i in range(2,6))
l5 = list(5**i for i in range(2,5))
l6 = list(6**i for i in range(2,5))
l7 = list(7**i for i in range(2,5))
l8 = list(8**i for i in range(2,5))
l9 = list(9**i for i in range(2,5))
l10 =list(10**i for i in range(2,4))
l11 = list(i**2 for i in range(11,34))
l1 = list(set(l1+l2+l3+l4+l5+l6+l7+l8+l9+l10+l11))
if x in l1:
  print(x)
else:
  l1.append(x)
  l1.sort()
  a = l1.index(x)-1
  print(l1[a])
Buggy python submission (verdict: Runtime Error):
h,w = map(int,input().split())
l = ['.'*(w+2)]+list('.'+(input()+'.')for _ in range(h))+ ["."*(w+2)]
for i in range(1,w+1):
  for j in range(1,h+1):
    if l[i][j]=="#":
      if l[i-1][j]=="#" or l[i+1][j]=="#" or l[i][j+1]=="#" or l[i][j-1]=="#":
        continue
      else:
        print("No")
        exit()
else:
  print("Yes")

Fixed submission:
h,w = map(int,input().split())
l = ['.'*(w+2)]+list('.'+(input()+'.')for _ in range(h))+ ["."*(w+2)]
for i in range(1,h+1):
  for j in range(1,w+1):
    if l[i][j]=="#":
      if l[i-1][j]=="#" or l[i+1][j]=="#" or l[i][j+1]=="#" or l[i][j-1]=="#":
        continue
      else:
        print("No")
        exit()

print("Yes")
Buggy python submission (verdict: Runtime Error):
import bisect
import math
n = int(input())
l = sorted(list(map(int,input().split())))
if len(l)==2 :
  print(l[-1],l[-2])
  exit()
  
a = l[-1]/2
s = bisect.bisect_left(l,a)
if l[s]==a:
  print(l[-1],l[s])
  exit()
k1 = l[s-1]
k2 = l[s]
s1 = a-k1
if k2==l[-1]:
  k2 = k1
#s2 = abs(k2-a)
print(s,k1,k2,s1,s2)
if s1<=s2:
  print(l[-1],k1)
else:
  print(l[-1],k2)

Fixed submission:
import bisect
import math
n = int(input())
l = sorted(list(map(int,input().split())))
if len(l)==2 :
  print(l[-1],l[-2])
  exit()
  
a = l[-1]/2
s = bisect.bisect_left(l,a)
if l[s]==a:
  print(l[-1],l[s])
  exit()
k1 = l[s-1]
k2 = l[s]
s1 = a-k1
if k2==l[-1]:
  k2 = k1
s2 = abs(k2-a)
#print(s,k1,k2,s1,s2)
if s1<=s2:
  print(l[-1],k1)
else:
  print(l[-1],k2)

Buggy python submission (verdict: Time Limit Exceeded):
import bisect
import math
n = int(input())
l = sorted(list(map(int,input().split())))
a = l[-1]/2
s = bisect.bisect_left(l,a)
k1 = l[s]
if len(l)==2 and l[0]==0:
  print(l[-1],0)
  exit()
k2 = l[s+1]
def com(a,b):
  return math.factorial(a)//(math.factorial(b)*math.factorial(a-b))

s1 = com(l[-1],k1)
s2 = com(l[-1],k2)
if s1>=s2:
  print(l[-1],k1)
else:
  print(l[-1],k2)

Fixed submission:
import bisect
import math
n = int(input())
l = sorted(list(map(int,input().split())))
if len(l)==2 :
  print(l[-1],l[-2])
  exit()
  
a = l[-1]/2
s = bisect.bisect_left(l,a)
if l[s]==a:
  print(l[-1],l[s])
  exit()
k1 = l[s-1]
k2 = l[s]
s1 = a-k1
if k2==l[-1]:
  k2 = k1
s2 = abs(k2-a)
#print(s,k1,k2,s1,s2)
if s1<=s2:
  print(l[-1],k1)
else:
  print(l[-1],k2)

Buggy python submission (verdict: Runtime Error):
import bisect
import math
n = int(input())
l = sorted(list(map(int,input().split())))
a = l[-1]/2
s = bisect.bisect_left(l,a)
k1 = l[s]
if len(l)==2 and l[0]==0:
  print(0)
  exit()

def com(a,b):
  return math.factorial(a)//(math.factorial(b)*math.factorial(a-b))

s1 = com(l[-1],k1)
s2 = com(l[-1],k2)
if s1>=s2:
  print(l[-1],k1)
else:
  print(l[-1],k2)

Fixed submission:
import bisect
import math
n = int(input())
l = sorted(list(map(int,input().split())))
if len(l)==2 :
  print(l[-1],l[-2])
  exit()
  
a = l[-1]/2
s = bisect.bisect_left(l,a)
if l[s]==a:
  print(l[-1],l[s])
  exit()
k1 = l[s-1]
k2 = l[s]
s1 = a-k1
if k2==l[-1]:
  k2 = k1
s2 = abs(k2-a)
#print(s,k1,k2,s1,s2)
if s1<=s2:
  print(l[-1],k1)
else:
  print(l[-1],k2)
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
l = list(map(int,input().split()))
s = 0
for i in range(n):
  a = [0]+l[:i]+l[i+1:]+[0]
  for j in range(len(a)-1):
    s += abs(a[j+1]-a[j])
  print(s)
  s = 0
  

Fixed submission:
n = int(input())
l = [0]+list(map(int,input().split()))+[0]
s = 0
for j in range(len(l)-1):
    s += abs(l[j+1]-l[j])
for i in range(1,n+1):
  a = l[i-1]
  b = l[i]
  c = l[i+1]
  if a<=b<=c:
    print(s)
  elif a<=c<=b:
    print(s-2*(b-c))
  elif b<=a<=c:
    print(s-2*(a-b))
  elif b<=c<=a:
    print(s-2*(c-b))
  elif c<=a<=b:
    print(s-2*(b-a))
  elif c<=b<=a:
    print(s)
Buggy python submission (verdict: Runtime Error):
x,y = int(input())
if x == y:
  print(-1)
else:
  for i in range(1,10000):
    a = i * x
    if a % y != 0:
      print(a)
      exit()

Fixed submission:
x,y = map(int,input().split())
if x % y ==0:
  print(-1)
else:
  print(x)

Buggy python submission (verdict: Runtime Error):
n = int(input())
a = list(map(int,input().split()))
b = list(map(int,input().split()))
cou = 0
for j,k in zip(a,b):
  if j<k:
    cou += (k-j)//2
  elif j>k:
    cou -= (j-k)
if cou=>0:
  print("Yes")
else:
  print("No")

Fixed submission:
x,y = map(int,input().split())
if x % y ==0:
  print(-1)
else:
  print(x)

Buggy python submission (verdict: Runtime Error):
n = int(input())
a = list(map(int,input().split()))
b = list(map(int,input().split()))
cou = 0
for j,k in zip(a,b):
  if j<k:
    cou += (k-j)//2
  elif j>k:
    cou -= (j-k)
if cou>=0:
  print("Yes")
else:
  print("No")

Fixed submission:
x,y = map(int,input().split())
if x % y ==0:
  print(-1)
else:
  print(x)
Buggy python submission (verdict: Runtime Error):
n = int(input())
a = list(map(int,input().split()))
b = list(map(int,input().split()))
cou = 0
for j,k in zip(a,b):
  if j<k:
    cou += (k-j)//2
  elif j>k:
    cou -= (j-k)
if cou=>0:
  print("Yes")
else:
  print("No")

Fixed submission:
n = int(input())
a = list(map(int,input().split()))
b = list(map(int,input().split()))
cou = 0
for j,k in zip(a,b):
  if j<k:
    cou += (k-j)//2
  elif j>k:
    cou -= (j-k)
if cou>=0:
  print("Yes")
else:
  print("No")
Buggy python submission (verdict: Runtime Error):
k,s = map(int,input().split())
l = [a+b for a in range(k+1) for b in range(k+1)]
sum = 0
for i in range(k+1):
  sum += l.count(s-i)
print(sum)

Fixed submission:
a = int(input())
b = int(input())
c = int(input())
z = int(input())
l = [500*i+100*t+50*w for i in range(a+1) 
         for t in range(b+1) for w in range(c+1)]
print(l.count(z))
Buggy python submission (verdict: Runtime Error):
N = int(input())
l = list(map(int,input().split() for i in range(N))
l = set(l)
print(len(l))

Fixed submission:
N = int(input())
l = list(int(input()) for i in range(N))
a = set(l)
print(len(a))
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
l = [list(map(int,input().split())) for _ in range(n-1)]
#i番目駅からのスタート
for i in range(n):
  #時間
  t = 0
  for j in range(i,n-1):
    c,s,f = l[j]
    while not (t>=s and t%f==0):
      t += 1
    t += c
  print(t)

Fixed submission:
n = int(input())
l = [list(map(int,input().split())) for _ in range(n-1)]
#i番目駅からのスタート
for i in range(n):
  #時間
  t = 0
  for j in range(i,n-1):
    c,s,f = l[j]
    if t>=s:
      if t%f!=0:
        t += -(t%f)+f
      else:
        t += 0
    else:
      t += (s-t)
      if t%f!=0:
        t += -(t%f)+f
      else:
        t += 0
    t += c
  print(t)
Buggy python submission (verdict: Runtime Error):
x = input()
l = len(x)
a = 0
for i in range(l):
  a += int(x[i])
if a%x ==0:
  print('Yes')
else:
  print('No')

Fixed submission:
x = input()
l = len(x)
a = 0
for i in range(l):
  a += int(x[i])
#print(a)
if int(x)%a ==0:
  print('Yes')
else:
  print('No')
Buggy python submission (verdict: Runtime Error):
from collections import deque
s = deque(input())
cou = 0
while len(s)!=1:
  a = s[0]
  b = s[-1]
  if a=='x' and b!='x':
    cou += 1
    s.popleft()
  elif a!="x" and b=='x':
    cou += 1
    s.pop()
  elif a=="x" and b=='x':
    s.popleft()
    s.pop()
  elif a==b:
    s.popleft()
    s.pop()
  else:
    print(-1)
    exit()
print(cou)

Fixed submission:
from collections import deque
s = deque(input())
cou = 0
while len(s)!=0:
  a = s[0]
  b = s[-1]
  if a=='x' and b!='x':
    cou += 1
    s.popleft()
  elif a!="x" and b=='x':
    cou += 1
    s.pop()
  elif a=="x" and b=='x':
    if len(s)==1:
      s.popleft()
    else:   
      s.popleft()
      s.pop()
  elif a==b:
    if len(s)==1:
      s.popleft()
    else:   
      s.popleft()
      s.pop()
  else:
    print(-1)
    exit()
print(cou)
Buggy python submission (verdict: Runtime Error):
n,m = map(int,input().split())
l = list([] for _ in range(m+1))
li = list(list(map(int,input().split())) for _ in range(m))
bridge = 0
for a,b in li:
  l[a].append(b)
  l[b].append(a)
for a,b in li:
  if len(l[a])==1 or len(l[b])==1:
    bridge += 1
  elif len(l[a])==2 :
    c,d = l[a]
    if len(l[c])==1 or len(l[d])==1:
      bridge += 1
  elif len(l[b])==2 :
    c,d = l[b]
    if len(l[c])==1 or len(l[d])==1:
      bridge += 1
print(bridge)

Fixed submission:
"""
何回も再帰するときはlimitを増やす
dfs
"""
import sys
sys.setrecursionlimit(200000)

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


tree = [[] for _ in range(n)]
for a,b in l:
    a -= 1
    b -= 1
    tree[a].append(b)
    tree[b].append(a)

bit = [0 for _ in range(n)]
def dfs(v):
    bit[v] = 1
    for j in tree[v]:
        if bit[j]==0:
            dfs(j)

ans = 0
for i in range(m):
    a,b = l[i]
    a -= 1
    b -= 1
    tree[a].remove(b)
    tree[b].remove(a)
    bit = [0 for _ in range(n)]
    dfs(a)
    if bit.count(1) !=n:
        ans += 1

    tree[a].append(b)
    tree[b].append(a)
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
for a in range(1,3501):
  for b in range(1,3501):
    s = n*a*b
    #s=4
    t = 4*a*b-n*b-n*a
    #t=8-4-2
    if t!=0 and s%t==0 and t>0:
      c = s//t
      print(a,b,c)
      exit()

Fixed submission:
n = int(input())
if n<=3000:
  for a in range(1,3501):
    for b in range(1,3501):
      s = n*a*b
      #s=4
      t = 4*a*b-n*b-n*a
      #t=8-4-2
      if s<=t*3500:
        if t!=0 and s%t==0 and t>0:
          c = s//t
          print(a,b,c)
          exit()
else:
  for a in range(3501,1,-1):
    for b in range(3501,1,-1):
      s = n*a*b
      #s=4
      t = 4*a*b-n*b-n*a
      #t=8-4-2
      if s<=t*3500:
        if t!=0 and s%t==0 and t>0:
          c = s//t
          print(a,b,c)
          exit()
Buggy python submission (verdict: Time Limit Exceeded):
from itertools import permutations
n,m,r = map(int,input().split())
route = list(map(int,input().split()))

dp = [[0 for _ in range(n)] for _ in range(n)]
INF = 10**18
for i in range(n):
    for j in range(n):
        if i!=j:
            dp[i][j] = INF
for _ in range(m):
    a,b,c = map(int,input().split())
    dp[a-1][b-1] = c
    dp[b-1][a-1] = c
#print(dp)

#最短リスト
for chu in range(n):
    for fir in range(n):
        for la in range(n):
            dp[fir][la] = min(dp[fir][la] , dp[fir][chu] +  dp[chu][la])

ans = 10**10
for j in permutations(route, r):
    a = 0
    for q,w in zip(j[:-1], j[1:]):
        a += dp[q-1][w-1]
        
    ans = min(ans,a)
print(ans)

Fixed submission:
from itertools import permutations
n,m,r = map(int,input().split())
route = list(map(int,input().split()))

dp = [[0 for _ in range(n)] for _ in range(n)]
INF = 10**18
for i in range(n):
    for j in range(n):
        if i!=j:
            dp[i][j] = INF
for _ in range(m):
    a,b,c = map(int,input().split())
    dp[a-1][b-1] = c
    dp[b-1][a-1] = c
#print(dp)

#最短リスト
for chu in range(n):
    for fir in range(n):
        for la in range(n):
            dp[fir][la] = min(dp[fir][la] , dp[fir][chu] +  dp[chu][la])

ans = 10**10
for j in permutations(route, r):
    a = 0
    for q,w in zip(j[:-1], j[1:]):
        a += dp[q-1][w-1]
        
    ans = min(ans,a)
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
l = sorted(list(map(int,input().split())))
l1 = set(l)
m= 0
for i in l1:
  c = l.count(i)
  if i+1 in l1:
    c += l.count(i+1)
  if i-1 in l1:
    c += l.count(i-1)
  m = max(m,c)
print(m)
  

Fixed submission:
n = int(input())
a = [0]*(10**5)
l = list(map(int,input().split()))
for i in l:
  a[i]+= 1
m = 0 
for i in range(10**5-2):
  m = max(m,sum(a[i:i+3]))
print(m)
Buggy python submission (verdict: Runtime Error):
n = int(input())
l = list(map(int,input().split()))
cou = 0
if l[0]==1:
  x = l[0]
  l[0] = l[1]
  l[1]=x
  cou += 1
for i in range(1,n):
  if l[i]==i+1:
    if l[i-1]==i:
      x = l[i-1]
      l[i-1] = l[i]
      l[i] = x
      cou += 1
    else:
      x = l[i]
      l[i] = l[i+1]
      l[i+1] = x
      cou += 1
#  print(l)
print(cou)

Fixed submission:
n = int(input())
l = list(map(int,input().split()))
cou = 0

for i in range(0,n-1):
  if l[i]==i+1:
      l[i],l[i+1] = l[i+1], l[i]
      cou += 1
if l[-1]==n:
  cou += 1
print(cou)
Buggy python submission (verdict: Runtime Error):
n = int(input())
l = list(map(int,input().split()))
l1 = [0,0]
from collections import Counter
c = Counter(l)
for i in c.items():
  if i[1]>=2 :
    l1.append(i[0])
sort.(l1)
print(l1[-1]*l1[-2])

Fixed submission:
n = int(input())
l = list(map(int,input().split()))
l1 = [0,0]
from collections import Counter
c = Counter(l)
for i in c.items():
  if i[1]>=2 :
    l1.append(i[0])
  if i[1]>=4 :
    l1.append(i[0])
l1.sort()
print(l1[-1]*l1[-2])

Buggy python submission (verdict: Runtime Error):
n = int(input())
l = list(map(int,input().split()))
l1 = [0,0]
from collections import Counter
c = Counter(l)
for i in c:
  while l[i]>=2 and len(l1)<4:
    l1.append(l[i])
print(l1[-1]*l1[-2])

Fixed submission:
n = int(input())
l = list(map(int,input().split()))
l1 = [0,0]
from collections import Counter
c = Counter(l)
for i in c.items():
  if i[1]>=2 :
    l1.append(i[0])
  if i[1]>=4 :
    l1.append(i[0])
l1.sort()
print(l1[-1]*l1[-2])
Buggy python submission (verdict: Runtime Error):
解答例
from fractions import gcd
def lcm(a,b): return a*b//gcd(a,b)
N=int(input())
ans=1
for i in range(N):
    t=int(input())
    ans=lcm(ans,t)
print(ans)

Fixed submission:
from fractions import gcd
def lcm(a,b): return a*b//gcd(a,b)
N=int(input())
ans=1
for i in range(N):
    t=int(input())
    ans=lcm(ans,t)
print(ans)
Buggy python submission (verdict: Runtime Error):
n = int(input())
l = [list(map(int,input().split())) for _ in range(n-1)]
q,k = map(int,input().split())
k -= 1
#kからの距離
tree = [[] for _ in range(n)]
for a,b,c in l:
    a -= 1
    b -= 1
    tree[a].append([b,c])
    tree[b].append([a,c])

bit = [0 for _ in range(n)]
depth = [0 for _ in range(n)]
def dfs(v,d=0):
    bit[v] = 1
    depth[v] = d
    for j,k in tree[v]:
        if bit[j]==0:
            dfs(j,d+k)
dfs(k)

for _ in range(q):
    x,y = map(int,input().split())
    x-= 1
    y-= 1
    print(depth[x] + depth[y])

Fixed submission:
import sys

sys.setrecursionlimit(200000)

n = int(input())
l = [list(map(int,input().split())) for _ in range(n-1)]
q,k = map(int,input().split())
k -= 1
#kからの距離
tree = [[] for _ in range(n)]
for a,b,c in l:
    a -= 1
    b -= 1
    tree[a].append([b,c])
    tree[b].append([a,c])

bit = [0 for _ in range(n)]
depth = [0 for _ in range(n)]
def dfs(v,d=0):
    bit[v] = 1
    depth[v] = d
    for j,k in tree[v]:
        if bit[j]==0:
            dfs(j,d+k)
dfs(k)

for _ in range(q):
    x,y = map(int,input().split())
    x-= 1
    y-= 1
    print(depth[x] + depth[y])

Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
l = [list(map(int,input().split())) for _ in range(n-1)]

dp = [[0 for _ in range(n)] for _ in range(n)]
INF = 10**18
for i in range(n):
    for j in range(n):
        if i!=j:
            dp[i][j] = INF
for a,b,c in l:
    dp[a-1][b-1] = c
    dp[b-1][a-1] = c
#print(dp)

#最短リスト
for c in range(n):
    for f in range(n):
        for la in range(n):
            dp[f][la] = min(dp[f][la] , dp[f][c] +  dp[c][la])

q,k = map(int,input().split())
for _ in range(q):
    x,y = map(int,input().split())
    k1 = dp[x-1][k-1] + dp[k-1][y-1]
    k2 = dp[y-1][k-1] + dp[k-1][x-1]
    print(min(k1,k2))


Fixed submission:
import sys

sys.setrecursionlimit(200000)

n = int(input())
l = [list(map(int,input().split())) for _ in range(n-1)]
q,k = map(int,input().split())
k -= 1
#kからの距離
tree = [[] for _ in range(n)]
for a,b,c in l:
    a -= 1
    b -= 1
    tree[a].append([b,c])
    tree[b].append([a,c])

bit = [0 for _ in range(n)]
depth = [0 for _ in range(n)]
def dfs(v,d=0):
    bit[v] = 1
    depth[v] = d
    for j,k in tree[v]:
        if bit[j]==0:
            dfs(j,d+k)
dfs(k)

for _ in range(q):
    x,y = map(int,input().split())
    x-= 1
    y-= 1
    print(depth[x] + depth[y])
Buggy python submission (verdict: Runtime Error):
n = int(input())
l = list(map(int,input().split()))
c = len([i for i in l if i%4==0])
l1 = [i for i in l if  (i%2==0 and i%4!=0)]
if len(l1)>=1:
  a = n-len(l1)+1
  a = a-c
  if a<=c+1:
    print("Yes")
  else:
    print("No")
else:
  if a<=c+1:
    print("Yes")
  else:
    print("No")

Fixed submission:
n = int(input())
l = list(map(int,input().split()))
c = len([i for i in l if i%4==0])
l1 = [i for i in l if  (i%2==0 and i%4!=0)]
if len(l1)>=1:
  a = n-len(l1)+1
  a = a-c
  if a<=c+1:
    print("Yes")
  else:
    print("No")
else:
  a = n-c
  if a<=c+1:
    print("Yes")
  else:
    print("No")

Buggy python submission (verdict: Runtime Error):
n = int(input())
l = list(map(int,input().split()))
c = len([i for i in l if i%4==0])
l1 = [i for i in l if not (i%2==0 and i%4!=0)]
if len(l1)>=1:
  a = n-len(l1)+1
  a = a-c
  if a<=c-1:
    print("Yes")
  else:
    print("No")
else:
  if a<=c-1:
    print("Yes")
  else:
    print("No")

Fixed submission:
n = int(input())
l = list(map(int,input().split()))
c = len([i for i in l if i%4==0])
l1 = [i for i in l if  (i%2==0 and i%4!=0)]
if len(l1)>=1:
  a = n-len(l1)+1
  a = a-c
  if a<=c+1:
    print("Yes")
  else:
    print("No")
else:
  a = n-c
  if a<=c+1:
    print("Yes")
  else:
    print("No")
Buggy python submission (verdict: Runtime Error):
A,B =map(int,input().split())
if A%3 == o or B%3 ==0 or (A+B)%3 ==0:
  print("Possible")
  
else:
  print("Impossible")

Fixed submission:
A,B =map(int,input().split())
if A%3 == 0 or B%3 ==0 or (A+B)%3 ==0:
  print("Possible")
  
else:
  print("Impossible")