message stringlengths 2 49.9k | message_type stringclasses 2
values | message_id int64 0 1 | conversation_id int64 446 108k | cluster float64 13 13 | __index_level_0__ int64 892 217k |
|---|---|---|---|---|---|
Provide tags and a correct Python 3 solution for this coding contest problem.
You are given an undirected weighted connected graph with n vertices and m edges without loops and multiple edges.
The i-th edge is e_i = (u_i, v_i, w_i); the distance between vertices u_i and v_i along the edge e_i is w_i (1 β€ w_i). The gr... | instruction | 0 | 75,016 | 13 | 150,032 |
Tags: binary search, dsu, graphs, greedy
Correct Solution:
```
import sys
input = sys.stdin.readline
n,m=map(int,input().split())
EDGE=[list(map(int,input().split())) for i in range(m)]
EDGE.sort(key=lambda x:x[2])
WCHANGE=[]
for i in range(1,m):
if EDGE[i-1][2]!=EDGE[i][2]:
WCHANGE.append(i)
WCHANGE.ap... | output | 1 | 75,016 | 13 | 150,033 |
Provide tags and a correct Python 3 solution for this coding contest problem.
You are given an undirected weighted connected graph with n vertices and m edges without loops and multiple edges.
The i-th edge is e_i = (u_i, v_i, w_i); the distance between vertices u_i and v_i along the edge e_i is w_i (1 β€ w_i). The gr... | instruction | 0 | 75,017 | 13 | 150,034 |
Tags: binary search, dsu, graphs, greedy
Correct Solution:
```
[n, m] = map(int, input().rstrip().split(' '))
edges = []
ds = [i for i in range(n + 1)]
ans = 0
def head(x):
if x == ds[x]:
return x
ds[x] = head(ds[x])
return ds[x]
def union(x, y):
X = head(x)
Y = head(y)
ds[max(X, Y)] = min(X, Y)
for ... | output | 1 | 75,017 | 13 | 150,035 |
Provide tags and a correct Python 3 solution for this coding contest problem.
You are given an undirected weighted connected graph with n vertices and m edges without loops and multiple edges.
The i-th edge is e_i = (u_i, v_i, w_i); the distance between vertices u_i and v_i along the edge e_i is w_i (1 β€ w_i). The gr... | instruction | 0 | 75,018 | 13 | 150,036 |
Tags: binary search, dsu, graphs, greedy
Correct Solution:
```
# https://codeforces.com/problemset/problem/1108/F
n, m = map(int, input().split())
edge = [list(map(int, input().split())) for _ in range(m)]
edge = sorted(edge,key=lambda x: x[2])
class Union:
def __init__(self, n):
self.p = [i for i in... | output | 1 | 75,018 | 13 | 150,037 |
Provide tags and a correct Python 3 solution for this coding contest problem.
You are given an undirected weighted connected graph with n vertices and m edges without loops and multiple edges.
The i-th edge is e_i = (u_i, v_i, w_i); the distance between vertices u_i and v_i along the edge e_i is w_i (1 β€ w_i). The gr... | instruction | 0 | 75,019 | 13 | 150,038 |
Tags: binary search, dsu, graphs, greedy
Correct Solution:
```
a=input().split()
n,m=int(a[0]),int(a[1])
f=[i for i in range(0,n+1)]
class edge:
def __init__(self,U,V,W):
self.u=U
self.v=V
self.w=W
l=[]
for i in range(m):
a = input().split()
u,v,w=int(a[0]),int(a[1]),int(a[2])
l... | output | 1 | 75,019 | 13 | 150,039 |
Provide tags and a correct Python 3 solution for this coding contest problem.
You are given an undirected weighted connected graph with n vertices and m edges without loops and multiple edges.
The i-th edge is e_i = (u_i, v_i, w_i); the distance between vertices u_i and v_i along the edge e_i is w_i (1 β€ w_i). The gr... | instruction | 0 | 75,020 | 13 | 150,040 |
Tags: binary search, dsu, graphs, greedy
Correct Solution:
```
import collections as cc
import itertools as it
import bisect as bi
I=lambda:list(map(int,input().split()))
n,m=I()
ed=[I() for i in range(m)]
ed.sort(key=lambda x:x[2])
ch=[]
for i in range(1,m):
if ed[i-1][2]!=ed[i][2]:
ch.append(i)
ch.append(m)
parent... | output | 1 | 75,020 | 13 | 150,041 |
Provide tags and a correct Python 3 solution for this coding contest problem.
You are given an undirected weighted connected graph with n vertices and m edges without loops and multiple edges.
The i-th edge is e_i = (u_i, v_i, w_i); the distance between vertices u_i and v_i along the edge e_i is w_i (1 β€ w_i). The gr... | instruction | 0 | 75,021 | 13 | 150,042 |
Tags: binary search, dsu, graphs, greedy
Correct Solution:
```
n,m=map(int,input().split())
class edge:
def __init__(self,U,V,W):
self.u=U
self.v=V
self.w=W
l=[]
for i in range(m):
u,v,w=map(int,input().split())
l.append(edge(u,v,w))
l.sort(key=lambda x:x.w)
f=[i for i in range(0,n+... | output | 1 | 75,021 | 13 | 150,043 |
Provide tags and a correct Python 3 solution for this coding contest problem.
You are given an undirected weighted connected graph with n vertices and m edges without loops and multiple edges.
The i-th edge is e_i = (u_i, v_i, w_i); the distance between vertices u_i and v_i along the edge e_i is w_i (1 β€ w_i). The gr... | instruction | 0 | 75,022 | 13 | 150,044 |
Tags: binary search, dsu, graphs, greedy
Correct Solution:
```
n,m = map(int,input().split())
l = []
for i in range(m):
a,b,c = map(int,input().split())
l.append((c,a,b))
l.sort()
f = [i for i in range(n+1)]
def r(a):
if a!=f[a]:
f[a]=r(f[a])
return f[a]
cnt = 0
i=0
while i < m:
j = i
while ... | output | 1 | 75,022 | 13 | 150,045 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
You are given an undirected weighted connected graph with n vertices and m edges without loops and multiple edges.
The i-th edge is e_i = (u_i, v_i, w_i); the distance between vertices u_i and ... | instruction | 0 | 75,023 | 13 | 150,046 |
Yes | output | 1 | 75,023 | 13 | 150,047 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
You are given an undirected weighted connected graph with n vertices and m edges without loops and multiple edges.
The i-th edge is e_i = (u_i, v_i, w_i); the distance between vertices u_i and ... | instruction | 0 | 75,024 | 13 | 150,048 |
Yes | output | 1 | 75,024 | 13 | 150,049 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
You are given an undirected weighted connected graph with n vertices and m edges without loops and multiple edges.
The i-th edge is e_i = (u_i, v_i, w_i); the distance between vertices u_i and ... | instruction | 0 | 75,025 | 13 | 150,050 |
Yes | output | 1 | 75,025 | 13 | 150,051 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
You are given an undirected weighted connected graph with n vertices and m edges without loops and multiple edges.
The i-th edge is e_i = (u_i, v_i, w_i); the distance between vertices u_i and ... | instruction | 0 | 75,026 | 13 | 150,052 |
Yes | output | 1 | 75,026 | 13 | 150,053 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
You are given an undirected weighted connected graph with n vertices and m edges without loops and multiple edges.
The i-th edge is e_i = (u_i, v_i, w_i); the distance between vertices u_i and ... | instruction | 0 | 75,027 | 13 | 150,054 |
No | output | 1 | 75,027 | 13 | 150,055 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
You are given an undirected weighted connected graph with n vertices and m edges without loops and multiple edges.
The i-th edge is e_i = (u_i, v_i, w_i); the distance between vertices u_i and ... | instruction | 0 | 75,028 | 13 | 150,056 |
No | output | 1 | 75,028 | 13 | 150,057 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
You are given an undirected weighted connected graph with n vertices and m edges without loops and multiple edges.
The i-th edge is e_i = (u_i, v_i, w_i); the distance between vertices u_i and ... | instruction | 0 | 75,029 | 13 | 150,058 |
No | output | 1 | 75,029 | 13 | 150,059 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
You are given an undirected weighted connected graph with n vertices and m edges without loops and multiple edges.
The i-th edge is e_i = (u_i, v_i, w_i); the distance between vertices u_i and ... | instruction | 0 | 75,030 | 13 | 150,060 |
No | output | 1 | 75,030 | 13 | 150,061 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
You are given a rooted tree on n vertices. The vertices are numbered from 1 to n; the root is the vertex number 1.
Each vertex has two integers associated with it: a_i and b_i. We denote the se... | instruction | 0 | 75,061 | 13 | 150,122 |
No | output | 1 | 75,061 | 13 | 150,123 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Ayush and Ashish play a game on an unrooted tree consisting of n nodes numbered 1 to n. Players make the following move in turns:
* Select any leaf node in the tree and remove it together with any edge which has this node as one of its e... | instruction | 0 | 75,177 | 13 | 150,354 |
Tags: games, trees
Correct Solution:
```
#------------------------------warmup----------------------------
import os
import sys
import math
from io import BytesIO, IOBase
from fractions import Fraction
BUFSIZE = 8192
class FastIO(IOBase):
newlines = 0
def __init__(self, file):
self._fd = file.fi... | output | 1 | 75,177 | 13 | 150,355 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Ayush and Ashish play a game on an unrooted tree consisting of n nodes numbered 1 to n. Players make the following move in turns:
* Select any leaf node in the tree and remove it together with any edge which has this node as one of its e... | instruction | 0 | 75,178 | 13 | 150,356 |
Tags: games, trees
Correct Solution:
```
import sys
import math
from collections import defaultdict
# sys.stdin = open('input.txt', 'r')
# sys.stdout = open('output.txt', 'w')
def solve(test):
n, x = map(int, input().split())
rec = defaultdict(int)
for i in range(n - 1):
u, v = map(int, input().split())
rec[... | output | 1 | 75,178 | 13 | 150,357 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Ayush and Ashish play a game on an unrooted tree consisting of n nodes numbered 1 to n. Players make the following move in turns:
* Select any leaf node in the tree and remove it together with any edge which has this node as one of its e... | instruction | 0 | 75,179 | 13 | 150,358 |
Tags: games, trees
Correct Solution:
```
t = int(input())
for _ in range(t):
n ,x = map(int,input().split())
deg = [0 for i in range(n)]
for i in range(n-1):
u,v = map(int,input().split())
deg[u-1] += 1
deg[v-1] += 1
if deg[x-1] <= 1:
print("Ayush")
else:
if n... | output | 1 | 75,179 | 13 | 150,359 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Ayush and Ashish play a game on an unrooted tree consisting of n nodes numbered 1 to n. Players make the following move in turns:
* Select any leaf node in the tree and remove it together with any edge which has this node as one of its e... | instruction | 0 | 75,180 | 13 | 150,360 |
Tags: games, trees
Correct Solution:
```
t = int(input())
def solve():
n, x = map(int, input().split())
d = 0
for i in range(n-1):
a, b = map(int, input().split())
if a == x or b == x:
d += 1
if d <= 1 or n % 2 == 0:
print("Ayush")
else:
print("Ashish")
... | output | 1 | 75,180 | 13 | 150,361 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Ayush and Ashish play a game on an unrooted tree consisting of n nodes numbered 1 to n. Players make the following move in turns:
* Select any leaf node in the tree and remove it together with any edge which has this node as one of its e... | instruction | 0 | 75,181 | 13 | 150,362 |
Tags: games, trees
Correct Solution:
```
for _ in range(int(input())):
n, x = list(map(int,input().split()))
arr = []
child = []
for i in range(n-1):
a,b = map(int,input().split())
arr.append(a)
arr.append(b)
if a == x:
child.append(b)
elif b == x:
... | output | 1 | 75,181 | 13 | 150,363 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Ayush and Ashish play a game on an unrooted tree consisting of n nodes numbered 1 to n. Players make the following move in turns:
* Select any leaf node in the tree and remove it together with any edge which has this node as one of its e... | instruction | 0 | 75,182 | 13 | 150,364 |
Tags: games, trees
Correct Solution:
```
def solve():
x, y = [int(x) for x in input().split()]
p = 0
for j in range(x-1):
n, m = [int(x) for x in input().split()]
if n == y or m == y:
p += 1
if p <= 1:
return "Ayush"
return ["Ayush ", "Ashish"][x % 2]
test = i... | output | 1 | 75,182 | 13 | 150,365 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Ayush and Ashish play a game on an unrooted tree consisting of n nodes numbered 1 to n. Players make the following move in turns:
* Select any leaf node in the tree and remove it together with any edge which has this node as one of its e... | instruction | 0 | 75,183 | 13 | 150,366 |
Tags: games, trees
Correct Solution:
```
t = int(input())
for _ in range(t):
n, s = list(map(int, input().split()))
graph = {i: [] for i in range(1002)}
for _ in range(n-1):
a, b = list(map(int, input().split()))
graph[a].append(b)
graph[b].append(a)
winner = ['Ayush', 'Ashis... | output | 1 | 75,183 | 13 | 150,367 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Ayush and Ashish play a game on an unrooted tree consisting of n nodes numbered 1 to n. Players make the following move in turns:
* Select any leaf node in the tree and remove it together with any edge which has this node as one of its e... | instruction | 0 | 75,184 | 13 | 150,368 |
Tags: games, trees
Correct Solution:
```
import sys,math
from collections import deque
#input = sys.stdin.buffer.readline
def solve():
n,x = map(int,input().split())
x-=1
edgeList = [[] for _ in range(n)]
for i in range(n-1):
a,b = map(int,input().split())
edgeList[a-1].append(b-1)
edgeList[b-1].append(a-1)
... | output | 1 | 75,184 | 13 | 150,369 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Ayush and Ashish play a game on an unrooted tree consisting of n nodes numbered 1 to n. Players make the following move in turns:
* Select any leaf node in the tree and remove it together wi... | instruction | 0 | 75,185 | 13 | 150,370 |
Yes | output | 1 | 75,185 | 13 | 150,371 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Ayush and Ashish play a game on an unrooted tree consisting of n nodes numbered 1 to n. Players make the following move in turns:
* Select any leaf node in the tree and remove it together wi... | instruction | 0 | 75,186 | 13 | 150,372 |
Yes | output | 1 | 75,186 | 13 | 150,373 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Ayush and Ashish play a game on an unrooted tree consisting of n nodes numbered 1 to n. Players make the following move in turns:
* Select any leaf node in the tree and remove it together wi... | instruction | 0 | 75,187 | 13 | 150,374 |
Yes | output | 1 | 75,187 | 13 | 150,375 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Ayush and Ashish play a game on an unrooted tree consisting of n nodes numbered 1 to n. Players make the following move in turns:
* Select any leaf node in the tree and remove it together wi... | instruction | 0 | 75,188 | 13 | 150,376 |
Yes | output | 1 | 75,188 | 13 | 150,377 |
Evaluate the correctness of the submitted Python 2 solution to the coding contest problem. Provide a "Yes" or "No" response.
Ayush and Ashish play a game on an unrooted tree consisting of n nodes numbered 1 to n. Players make the following move in turns:
* Select any leaf node in the tree and remove it together wi... | instruction | 0 | 75,189 | 13 | 150,378 |
Yes | output | 1 | 75,189 | 13 | 150,379 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Ayush and Ashish play a game on an unrooted tree consisting of n nodes numbered 1 to n. Players make the following move in turns:
* Select any leaf node in the tree and remove it together wi... | instruction | 0 | 75,190 | 13 | 150,380 |
No | output | 1 | 75,190 | 13 | 150,381 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Ayush and Ashish play a game on an unrooted tree consisting of n nodes numbered 1 to n. Players make the following move in turns:
* Select any leaf node in the tree and remove it together wi... | instruction | 0 | 75,191 | 13 | 150,382 |
No | output | 1 | 75,191 | 13 | 150,383 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Ayush and Ashish play a game on an unrooted tree consisting of n nodes numbered 1 to n. Players make the following move in turns:
* Select any leaf node in the tree and remove it together wi... | instruction | 0 | 75,192 | 13 | 150,384 |
No | output | 1 | 75,192 | 13 | 150,385 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Ayush and Ashish play a game on an unrooted tree consisting of n nodes numbered 1 to n. Players make the following move in turns:
* Select any leaf node in the tree and remove it together wi... | instruction | 0 | 75,193 | 13 | 150,386 |
No | output | 1 | 75,193 | 13 | 150,387 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Let's define a forest as a non-directed acyclic graph (also without loops and parallel edges). One day Misha played with the forest consisting of n vertices. For each vertex v from 0 to n - 1 he wrote down two integers, degreev and sv, were ... | instruction | 0 | 75,435 | 13 | 150,870 |
Tags: constructive algorithms, data structures, greedy, sortings, trees
Correct Solution:
```
def main():
n, l, ones, j = int(input()), [], [], 0
for i in range(n):
degree, s = map(int, input().split())
l.append((degree, s))
j += degree
if degree == 1:
ones.append(i)
... | output | 1 | 75,435 | 13 | 150,871 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Let's define a forest as a non-directed acyclic graph (also without loops and parallel edges). One day Misha played with the forest consisting of n vertices. For each vertex v from 0 to n - 1 he wrote down two integers, degreev and sv, were ... | instruction | 0 | 75,436 | 13 | 150,872 |
Tags: constructive algorithms, data structures, greedy, sortings, trees
Correct Solution:
```
import math,string,itertools,fractions,heapq,collections,re,array,bisect
from itertools import chain, dropwhile, permutations, combinations
from collections import defaultdict
def main2(n,d,s,info=0):
# correct, but slow... | output | 1 | 75,436 | 13 | 150,873 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Let's define a forest as a non-directed acyclic graph (also without loops and parallel edges). One day Misha played with the forest consisting of n vertices. For each vertex v from 0 to n - 1 he wrote down two integers, degreev and sv, were ... | instruction | 0 | 75,437 | 13 | 150,874 |
Tags: constructive algorithms, data structures, greedy, sortings, trees
Correct Solution:
```
n, st, xors, sumst, buf = int(input()), [], [], 0, []
for i in range(n):
s=input().split()
st.append(int(s[0])); xors.append(int(s[1])); sumst+=st[i]
if st[i]==1:
buf.append(i)
if sumst % 2 != 0:
prin... | output | 1 | 75,437 | 13 | 150,875 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Let's define a forest as a non-directed acyclic graph (also without loops and parallel edges). One day Misha played with the forest consisting of n vertices. For each vertex v from 0 to n - 1 he wrote down two integers, degreev and sv, were ... | instruction | 0 | 75,438 | 13 | 150,876 |
Tags: constructive algorithms, data structures, greedy, sortings, trees
Correct Solution:
```
from collections import deque
n = int(input())
process = deque()
vs = []
for i in range(n):
d, s = map(int, input().split())
if d == 1:
process.append(i)
vs.append((d, s))
edges = []
while process:
a = process.popleft()
... | output | 1 | 75,438 | 13 | 150,877 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Let's define a forest as a non-directed acyclic graph (also without loops and parallel edges). One day Misha played with the forest consisting of n vertices. For each vertex v from 0 to n - 1 he wrote down two integers, degreev and sv, were ... | instruction | 0 | 75,439 | 13 | 150,878 |
Tags: constructive algorithms, data structures, greedy, sortings, trees
Correct Solution:
```
n = int(input())
d = []
v = []
for i in range(n):
(a, b) = map(int, input().split())
v.append([a, b, i])
g = dict()
for i in range(n+20):
g[i] = set()
for i in v:
if i[0] in g:
g[i[0]].add(i[2])
el... | output | 1 | 75,439 | 13 | 150,879 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Let's define a forest as a non-directed acyclic graph (also without loops and parallel edges). One day Misha played with the forest consisting of n vertices. For each vertex v from 0 to n - 1 he wrote down two integers, degreev and sv, were ... | instruction | 0 | 75,440 | 13 | 150,880 |
Tags: constructive algorithms, data structures, greedy, sortings, trees
Correct Solution:
```
n = int(input())
v = []
deg1 = []
degsum = 0
has_v = [True]*n
for i in range(n):
d, s = map(int, input().split())
degsum += d
if d == 1: deg1.append(i)
if d == 0: has_v[i] = False
v.append([d, s])
print(de... | output | 1 | 75,440 | 13 | 150,881 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Let's define a forest as a non-directed acyclic graph (also without loops and parallel edges). One day Misha played with the forest consisting of n vertices. For each vertex v from 0 to n - 1 he wrote down two integers, degreev and sv, were ... | instruction | 0 | 75,441 | 13 | 150,882 |
Tags: constructive algorithms, data structures, greedy, sortings, trees
Correct Solution:
```
from collections import deque
class CodeforcesTask504ASolution:
def __init__(self):
self.result = ''
self.n = 0
self.vertices = []
def read_input(self):
self.n = int(input())
... | output | 1 | 75,441 | 13 | 150,883 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Let's define a forest as a non-directed acyclic graph (also without loops and parallel edges). One day Misha played with the forest consisting of n vertices. For each vertex v from 0 to n - 1 he wrote down two integers, degreev and sv, were ... | instruction | 0 | 75,442 | 13 | 150,884 |
Tags: constructive algorithms, data structures, greedy, sortings, trees
Correct Solution:
```
R = lambda: map(int, input().split())
n = int(input())
degs, xors = [0] * (2 ** 16 + 1), [0] * (2 ** 16 + 1)
edges = []
for curr in range(n):
degs[curr], xors[curr] = R()
q = []
for curr in range(n):
if degs[curr] == 1... | output | 1 | 75,442 | 13 | 150,885 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Let's define a forest as a non-directed acyclic graph (also without loops and parallel edges). One day Misha played with the forest consisting of n vertices. For each vertex v from 0 to n - 1 he... | instruction | 0 | 75,443 | 13 | 150,886 |
Yes | output | 1 | 75,443 | 13 | 150,887 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Let's define a forest as a non-directed acyclic graph (also without loops and parallel edges). One day Misha played with the forest consisting of n vertices. For each vertex v from 0 to n - 1 he... | instruction | 0 | 75,444 | 13 | 150,888 |
Yes | output | 1 | 75,444 | 13 | 150,889 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Let's define a forest as a non-directed acyclic graph (also without loops and parallel edges). One day Misha played with the forest consisting of n vertices. For each vertex v from 0 to n - 1 he... | instruction | 0 | 75,445 | 13 | 150,890 |
Yes | output | 1 | 75,445 | 13 | 150,891 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Let's define a forest as a non-directed acyclic graph (also without loops and parallel edges). One day Misha played with the forest consisting of n vertices. For each vertex v from 0 to n - 1 he... | instruction | 0 | 75,446 | 13 | 150,892 |
Yes | output | 1 | 75,446 | 13 | 150,893 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Let's define a forest as a non-directed acyclic graph (also without loops and parallel edges). One day Misha played with the forest consisting of n vertices. For each vertex v from 0 to n - 1 he... | instruction | 0 | 75,447 | 13 | 150,894 |
No | output | 1 | 75,447 | 13 | 150,895 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Let's define a forest as a non-directed acyclic graph (also without loops and parallel edges). One day Misha played with the forest consisting of n vertices. For each vertex v from 0 to n - 1 he... | instruction | 0 | 75,448 | 13 | 150,896 |
No | output | 1 | 75,448 | 13 | 150,897 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Let's define a forest as a non-directed acyclic graph (also without loops and parallel edges). One day Misha played with the forest consisting of n vertices. For each vertex v from 0 to n - 1 he... | instruction | 0 | 75,449 | 13 | 150,898 |
No | output | 1 | 75,449 | 13 | 150,899 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Let's define a forest as a non-directed acyclic graph (also without loops and parallel edges). One day Misha played with the forest consisting of n vertices. For each vertex v from 0 to n - 1 he... | instruction | 0 | 75,450 | 13 | 150,900 |
No | output | 1 | 75,450 | 13 | 150,901 |
Provide tags and a correct Python 2 solution for this coding contest problem.
The clique problem is one of the most well-known NP-complete problems. Under some simplification it can be formulated as follows. Consider an undirected graph G. It is required to find a subset of vertices C of the maximum size such that any... | instruction | 0 | 75,451 | 13 | 150,902 |
Tags: data structures, dp, greedy, implementation, sortings
Correct Solution:
```
from sys import stdin, stdout
from collections import Counter, defaultdict
from itertools import permutations, combinations
from fractions import Fraction
raw_input = stdin.readline
pr = stdout.write
mod=10**9+7
def ni():
return int(... | output | 1 | 75,451 | 13 | 150,903 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.