import sys,heapq input=lambda:sys.stdin.readline().rstrip() class node: def __init__(self,con): self.con=con class directedWeightedGraph: def __init__(self,N,edges=[]): self.N=N self.nodes=[node([]) for i in range(N)] for i in edges: self.nodes[i[0]].append(i[1:]) def connect(self,f,t,weight=0): self.nodes[f].con.append([t,weight]) def dijkstra(self,start): ans=[float('inf') for i in range(self.N)] watch=[] heapq.heappush(watch, [0,start]) while watch: cur=heapq.heappop(watch) if ans[cur[1]]==float('inf'): ans[cur[1]]=cur[0] for i in self.nodes[cur[1]].con: heapq.heappush(watch,[i[1]+ans[cur[1]],i[0]]) return ans def check(d_,val,N_,K): N=0 l=[] for i in range(N_): if (val>>i)%2: N+=1 l.append(i) if N>K+1: return 0 d=[[float('inf') for i in range(N)] for j in range(N)] for i in range(N): for j in range(N): d[i][j]=d_[l[i]][l[j]] dp=[[float('inf') for i in range(1<