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 |
|---|---|---|---|---|---|
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Monocarp had a tree which consisted of n vertices and was rooted at vertex 1. He decided to study BFS ([Breadth-first search](https://en.wikipedia.org/wiki/Breadth-first_search)), so he ran BFS ... | instruction | 0 | 81,928 | 13 | 163,856 |
Yes | output | 1 | 81,928 | 13 | 163,857 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Monocarp had a tree which consisted of n vertices and was rooted at vertex 1. He decided to study BFS ([Breadth-first search](https://en.wikipedia.org/wiki/Breadth-first_search)), so he ran BFS ... | instruction | 0 | 81,929 | 13 | 163,858 |
Yes | output | 1 | 81,929 | 13 | 163,859 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Monocarp had a tree which consisted of n vertices and was rooted at vertex 1. He decided to study BFS ([Breadth-first search](https://en.wikipedia.org/wiki/Breadth-first_search)), so he ran BFS ... | instruction | 0 | 81,930 | 13 | 163,860 |
No | output | 1 | 81,930 | 13 | 163,861 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Monocarp had a tree which consisted of n vertices and was rooted at vertex 1. He decided to study BFS ([Breadth-first search](https://en.wikipedia.org/wiki/Breadth-first_search)), so he ran BFS ... | instruction | 0 | 81,931 | 13 | 163,862 |
No | output | 1 | 81,931 | 13 | 163,863 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Monocarp had a tree which consisted of n vertices and was rooted at vertex 1. He decided to study BFS ([Breadth-first search](https://en.wikipedia.org/wiki/Breadth-first_search)), so he ran BFS ... | instruction | 0 | 81,932 | 13 | 163,864 |
No | output | 1 | 81,932 | 13 | 163,865 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Monocarp had a tree which consisted of n vertices and was rooted at vertex 1. He decided to study BFS ([Breadth-first search](https://en.wikipedia.org/wiki/Breadth-first_search)), so he ran BFS ... | instruction | 0 | 81,933 | 13 | 163,866 |
No | output | 1 | 81,933 | 13 | 163,867 |
Provide a correct Python 3 solution for this coding contest problem.
We have a tree with N vertices numbered 1 to N. The i-th edge in this tree connects Vertex a_i and b_i. For each k=1, ..., N, solve the problem below:
* Consider writing a number on each vertex in the tree in the following manner:
* First, write 1 o... | instruction | 0 | 82,363 | 13 | 164,726 |
"Correct Solution:
```
# -*- coding: utf-8 -*-
"""
Created on Tue Apr 28 22:56:10 2020
"""
import sys
#import numpy as np
sys.setrecursionlimit(10 ** 9)
#def input():
# return sys.stdin.readline()[:-1]
mod = 10**9+7
N = int(input())
#X, Y = map(int,input().split())
ab = [list(map(int,input().split())) for i in ra... | output | 1 | 82,363 | 13 | 164,727 |
Provide a correct Python 3 solution for this coding contest problem.
We have a tree with N vertices numbered 1 to N. The i-th edge in this tree connects Vertex a_i and b_i. For each k=1, ..., N, solve the problem below:
* Consider writing a number on each vertex in the tree in the following manner:
* First, write 1 o... | instruction | 0 | 82,364 | 13 | 164,728 |
"Correct Solution:
```
import sys
input = sys.stdin.readline
from collections import deque
mod = 10 ** 9 + 7
N = int(input())
X = [[] for i in range(N)]
for i in range(N-1):
x, y = map(int, input().split())
X[x-1].append(y-1)
X[y-1].append(x-1)
P = [-1] * N
Q = deque([0])
R = []
while Q:
i = deque.pop... | output | 1 | 82,364 | 13 | 164,729 |
Provide a correct Python 3 solution for this coding contest problem.
We have a tree with N vertices numbered 1 to N. The i-th edge in this tree connects Vertex a_i and b_i. For each k=1, ..., N, solve the problem below:
* Consider writing a number on each vertex in the tree in the following manner:
* First, write 1 o... | instruction | 0 | 82,365 | 13 | 164,730 |
"Correct Solution:
```
import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians
from itertools import accumulate, permutations, combinations, product
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_low... | output | 1 | 82,365 | 13 | 164,731 |
Provide a correct Python 3 solution for this coding contest problem.
We have a tree with N vertices numbered 1 to N. The i-th edge in this tree connects Vertex a_i and b_i. For each k=1, ..., N, solve the problem below:
* Consider writing a number on each vertex in the tree in the following manner:
* First, write 1 o... | instruction | 0 | 82,366 | 13 | 164,732 |
"Correct Solution:
```
import sys
sys.setrecursionlimit(10**6)
stdin = sys.stdin
ns = lambda: stdin.readline().rstrip()
ni = lambda: int(stdin.readline().rstrip())
nm = lambda: map(int, stdin.readline().split())
nl = lambda: list(map(int, stdin.readline().split()))
n_ = 2 * 10**5 + 20
mod = 10**9 + 7
fun = [1] * (n_... | output | 1 | 82,366 | 13 | 164,733 |
Provide a correct Python 3 solution for this coding contest problem.
We have a tree with N vertices numbered 1 to N. The i-th edge in this tree connects Vertex a_i and b_i. For each k=1, ..., N, solve the problem below:
* Consider writing a number on each vertex in the tree in the following manner:
* First, write 1 o... | instruction | 0 | 82,367 | 13 | 164,734 |
"Correct Solution:
```
from functools import *
from itertools import *
import sys
sys.setrecursionlimit(10**6)
input = sys.stdin.buffer.readline
M = 10**9+7
N = int(input())
@lru_cache(maxsize=None)
def mod_inv(x):
return 1 if x == 1 else M // x * -mod_inv(M%x) % M
Weight = [0]*(N+1)
Size = [0]*(N+1)
def calc_sub... | output | 1 | 82,367 | 13 | 164,735 |
Provide a correct Python 3 solution for this coding contest problem.
We have a tree with N vertices numbered 1 to N. The i-th edge in this tree connects Vertex a_i and b_i. For each k=1, ..., N, solve the problem below:
* Consider writing a number on each vertex in the tree in the following manner:
* First, write 1 o... | instruction | 0 | 82,368 | 13 | 164,736 |
"Correct Solution:
```
# -*- coding: utf-8 -*-
"""
Created on Tue Apr 28 22:56:10 2020
"""
import sys
#import numpy as np
sys.setrecursionlimit(10 ** 9)
#def input():
# return sys.stdin.readline()[:-1]
mod = 10**9+7
N = int(input())
#X, Y = map(int,input().split())
#ab = [list(map(int,input().split())) for i in r... | output | 1 | 82,368 | 13 | 164,737 |
Provide a correct Python 3 solution for this coding contest problem.
We have a tree with N vertices numbered 1 to N. The i-th edge in this tree connects Vertex a_i and b_i. For each k=1, ..., N, solve the problem below:
* Consider writing a number on each vertex in the tree in the following manner:
* First, write 1 o... | instruction | 0 | 82,369 | 13 | 164,738 |
"Correct Solution:
```
import sys
sys.setrecursionlimit(10 ** 6)
MOD = 10 ** 9 + 7
def prepare(n):
global MOD
modFacts = [0] * (n + 1)
modFacts[0] = 1
for i in range(n):
modFacts[i + 1] = (modFacts[i] * (i + 1)) % MOD
invs = [1] * (n + 1)
invs[n] = pow(modFacts[n], MOD - 2, MOD)
... | output | 1 | 82,369 | 13 | 164,739 |
Provide a correct Python 3 solution for this coding contest problem.
We have a tree with N vertices numbered 1 to N. The i-th edge in this tree connects Vertex a_i and b_i. For each k=1, ..., N, solve the problem below:
* Consider writing a number on each vertex in the tree in the following manner:
* First, write 1 o... | instruction | 0 | 82,370 | 13 | 164,740 |
"Correct Solution:
```
import sys
input = sys.stdin.readline
sys.setrecursionlimit(10**9)
def solve():
MOD = 10**9 + 7
N = int(input())
adjL = [[] for _ in range(N)]
for _ in range(N-1):
a, b = map(int, input().split())
a, b = a-1, b-1
adjL[a].append(b)
adjL[b].append(a... | output | 1 | 82,370 | 13 | 164,741 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
We have a tree with N vertices numbered 1 to N. The i-th edge in this tree connects Vertex a_i and b_i. For each k=1, ..., N, solve the problem below:
* Consider writing a number on each vertex... | instruction | 0 | 82,371 | 13 | 164,742 |
Yes | output | 1 | 82,371 | 13 | 164,743 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
We have a tree with N vertices numbered 1 to N. The i-th edge in this tree connects Vertex a_i and b_i. For each k=1, ..., N, solve the problem below:
* Consider writing a number on each vertex... | instruction | 0 | 82,372 | 13 | 164,744 |
Yes | output | 1 | 82,372 | 13 | 164,745 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
We have a tree with N vertices numbered 1 to N. The i-th edge in this tree connects Vertex a_i and b_i. For each k=1, ..., N, solve the problem below:
* Consider writing a number on each vertex... | instruction | 0 | 82,373 | 13 | 164,746 |
Yes | output | 1 | 82,373 | 13 | 164,747 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
We have a tree with N vertices numbered 1 to N. The i-th edge in this tree connects Vertex a_i and b_i. For each k=1, ..., N, solve the problem below:
* Consider writing a number on each vertex... | instruction | 0 | 82,374 | 13 | 164,748 |
Yes | output | 1 | 82,374 | 13 | 164,749 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
We have a tree with N vertices numbered 1 to N. The i-th edge in this tree connects Vertex a_i and b_i. For each k=1, ..., N, solve the problem below:
* Consider writing a number on each vertex... | instruction | 0 | 82,375 | 13 | 164,750 |
No | output | 1 | 82,375 | 13 | 164,751 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
We have a tree with N vertices numbered 1 to N. The i-th edge in this tree connects Vertex a_i and b_i. For each k=1, ..., N, solve the problem below:
* Consider writing a number on each vertex... | instruction | 0 | 82,376 | 13 | 164,752 |
No | output | 1 | 82,376 | 13 | 164,753 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
We have a tree with N vertices numbered 1 to N. The i-th edge in this tree connects Vertex a_i and b_i. For each k=1, ..., N, solve the problem below:
* Consider writing a number on each vertex... | instruction | 0 | 82,377 | 13 | 164,754 |
No | output | 1 | 82,377 | 13 | 164,755 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
We have a tree with N vertices numbered 1 to N. The i-th edge in this tree connects Vertex a_i and b_i. For each k=1, ..., N, solve the problem below:
* Consider writing a number on each vertex... | instruction | 0 | 82,378 | 13 | 164,756 |
No | output | 1 | 82,378 | 13 | 164,757 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Evlampiy was gifted a rooted tree. The vertices of the tree are numbered from 1 to n. Each of its vertices also has an integer a_i written on it. For each vertex i, Evlampiy calculated c_i — the number of vertices j in the subtree of vertex ... | instruction | 0 | 82,709 | 13 | 165,418 |
Tags: constructive algorithms, data structures, dfs and similar, graphs, greedy, trees
Correct Solution:
```
import io
import os
import sys
from collections import Counter, defaultdict, deque
sys.setrecursionlimit(10 ** 5)
def solve(N, PC):
children = [[] for i in range(N)]
cost = [None for i in range(N)]
... | output | 1 | 82,709 | 13 | 165,419 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Evlampiy was gifted a rooted tree. The vertices of the tree are numbered from 1 to n. Each of its vertices also has an integer a_i written on it. For each vertex i, Evlampiy calculated c_i — the number of vertices j in the subtree of vertex ... | instruction | 0 | 82,710 | 13 | 165,420 |
Tags: constructive algorithms, data structures, dfs and similar, graphs, greedy, trees
Correct Solution:
```
import sys
input = sys.stdin.readline
n=int(input())
C=[(0,0)]+[tuple(map(int,input().split())) for i in range(n)]
V=n+1
EDGEIN=[0]*V# その点に入るEDGEの個数
EDGEOUT=[-1]*V# EDGEの行き先
for i in range(1,n+1):
p,x=C[... | output | 1 | 82,710 | 13 | 165,421 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Evlampiy was gifted a rooted tree. The vertices of the tree are numbered from 1 to n. Each of its vertices also has an integer a_i written on it. For each vertex i, Evlampiy calculated c_i — the number of vertices j in the subtree of vertex ... | instruction | 0 | 82,711 | 13 | 165,422 |
Tags: constructive algorithms, data structures, dfs and similar, graphs, greedy, trees
Correct Solution:
```
# Legends Always Come Up with Solution
# Author: Manvir Singh
import os
import sys
from io import BytesIO, IOBase
from array import array
class SortedList:
def __init__(self, iterable=None, _load=200):
... | output | 1 | 82,711 | 13 | 165,423 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Evlampiy was gifted a rooted tree. The vertices of the tree are numbered from 1 to n. Each of its vertices also has an integer a_i written on it. For each vertex i, Evlampiy calculated c_i — the number of vertices j in the subtree of vertex ... | instruction | 0 | 82,712 | 13 | 165,424 |
Tags: constructive algorithms, data structures, dfs and similar, graphs, greedy, trees
Correct Solution:
```
import sys
zz=1
sys.setrecursionlimit(10**5)
if zz:
input=sys.stdin.readline
else:
sys.stdin=open('input.txt', 'r')
sys.stdout=open('all.txt','w')
di=[[-1,0],[1,0],[0,1],[0,-1]]
def fori(n):
return [fi(... | output | 1 | 82,712 | 13 | 165,425 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Evlampiy was gifted a rooted tree. The vertices of the tree are numbered from 1 to n. Each of its vertices also has an integer a_i written on it. For each vertex i, Evlampiy calculated c_i — the number of vertices j in the subtree of vertex ... | instruction | 0 | 82,713 | 13 | 165,426 |
Tags: constructive algorithms, data structures, dfs and similar, graphs, greedy, trees
Correct Solution:
```
from sys import stdin, stdout
valid = True
def getnumberfromtree(node, dic, slist):
rst = []
leftCnt = slist[node]
global valid
for next in dic[node]:
subRst = getnumberfromtree(next, ... | output | 1 | 82,713 | 13 | 165,427 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Evlampiy was gifted a rooted tree. The vertices of the tree are numbered from 1 to n. Each of its vertices also has an integer a_i written on it. For each vertex i, Evlampiy calculated c_i — the number of vertices j in the subtree of vertex ... | instruction | 0 | 82,714 | 13 | 165,428 |
Tags: constructive algorithms, data structures, dfs and similar, graphs, greedy, trees
Correct Solution:
```
import sys
# BIT aka Fenwick tree
# sum
class BIT():
def __init__(self, n):
self.n = n
self.tree = [0] * n
def _F(self, i):
return i & (i + 1)
def _getSum(self, r):... | output | 1 | 82,714 | 13 | 165,429 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Evlampiy was gifted a rooted tree. The vertices of the tree are numbered from 1 to n. Each of its vertices also has an integer a_i written on it. For each vertex i, Evlampiy calculated c_i — the number of vertices j in the subtree of vertex ... | instruction | 0 | 82,715 | 13 | 165,430 |
Tags: constructive algorithms, data structures, dfs and similar, graphs, greedy, trees
Correct Solution:
```
# by the authority of GOD author: manhar singh sachdev #
import os,sys
from io import BytesIO,IOBase
class SortedList:
def __init__(self,iterable=None,_load=200):
"""Initialize sorted list inst... | output | 1 | 82,715 | 13 | 165,431 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Evlampiy was gifted a rooted tree. The vertices of the tree are numbered from 1 to n. Each of its vertices also has an integer a_i written on it. For each vertex i, Evlampiy calculated c_i — the number of vertices j in the subtree of vertex ... | instruction | 0 | 82,716 | 13 | 165,432 |
Tags: constructive algorithms, data structures, dfs and similar, graphs, greedy, trees
Correct Solution:
```
mod = 1000000007
eps = 10**-9
def main():
import sys
from collections import deque
input = sys.stdin.readline
N = int(input())
par = [0] * (N+1)
child = [[] for _ in range(N+1)]
C ... | output | 1 | 82,716 | 13 | 165,433 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Evlampiy was gifted a rooted tree. The vertices of the tree are numbered from 1 to n. Each of its vertices also has an integer a_i written on it. For each vertex i, Evlampiy calculated c_i — the... | instruction | 0 | 82,717 | 13 | 165,434 |
Yes | output | 1 | 82,717 | 13 | 165,435 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Evlampiy was gifted a rooted tree. The vertices of the tree are numbered from 1 to n. Each of its vertices also has an integer a_i written on it. For each vertex i, Evlampiy calculated c_i — the... | instruction | 0 | 82,718 | 13 | 165,436 |
Yes | output | 1 | 82,718 | 13 | 165,437 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Evlampiy was gifted a rooted tree. The vertices of the tree are numbered from 1 to n. Each of its vertices also has an integer a_i written on it. For each vertex i, Evlampiy calculated c_i — the... | instruction | 0 | 82,719 | 13 | 165,438 |
Yes | output | 1 | 82,719 | 13 | 165,439 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Evlampiy was gifted a rooted tree. The vertices of the tree are numbered from 1 to n. Each of its vertices also has an integer a_i written on it. For each vertex i, Evlampiy calculated c_i — the... | instruction | 0 | 82,720 | 13 | 165,440 |
Yes | output | 1 | 82,720 | 13 | 165,441 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Evlampiy was gifted a rooted tree. The vertices of the tree are numbered from 1 to n. Each of its vertices also has an integer a_i written on it. For each vertex i, Evlampiy calculated c_i — the... | instruction | 0 | 82,721 | 13 | 165,442 |
No | output | 1 | 82,721 | 13 | 165,443 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Evlampiy was gifted a rooted tree. The vertices of the tree are numbered from 1 to n. Each of its vertices also has an integer a_i written on it. For each vertex i, Evlampiy calculated c_i — the... | instruction | 0 | 82,722 | 13 | 165,444 |
No | output | 1 | 82,722 | 13 | 165,445 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Evlampiy was gifted a rooted tree. The vertices of the tree are numbered from 1 to n. Each of its vertices also has an integer a_i written on it. For each vertex i, Evlampiy calculated c_i — the... | instruction | 0 | 82,723 | 13 | 165,446 |
No | output | 1 | 82,723 | 13 | 165,447 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Evlampiy was gifted a rooted tree. The vertices of the tree are numbered from 1 to n. Each of its vertices also has an integer a_i written on it. For each vertex i, Evlampiy calculated c_i — the... | instruction | 0 | 82,724 | 13 | 165,448 |
No | output | 1 | 82,724 | 13 | 165,449 |
Provide tags and a correct Python 3 solution for this coding contest problem.
A tree is a connected undirected graph consisting of n vertices and n - 1 edges. Vertices are numbered 1 through n.
Limak is a little polar bear and Radewoosh is his evil enemy. Limak once had a tree but Radewoosh stolen it. Bear is very sa... | instruction | 0 | 83,010 | 13 | 166,020 |
Tags: constructive algorithms, graphs, trees
Correct Solution:
```
n,d,h = map(int, input().split())
if d > 2*h or (h==1 and d==1 and n > 2):
print(-1)
elif h == d and n > h+1:
for i in range(h):
print(str(i+1)+" "+str(i+2))
for i in range(h+2,n+1):
print("2 "+str(i))
else:
for i in rang... | output | 1 | 83,010 | 13 | 166,021 |
Provide tags and a correct Python 3 solution for this coding contest problem.
A tree is a connected undirected graph consisting of n vertices and n - 1 edges. Vertices are numbered 1 through n.
Limak is a little polar bear and Radewoosh is his evil enemy. Limak once had a tree but Radewoosh stolen it. Bear is very sa... | instruction | 0 | 83,011 | 13 | 166,022 |
Tags: constructive algorithms, graphs, trees
Correct Solution:
```
[n,d,h]=[int(i) for i in input().split()]
if d>2*h or (n>2 and d==1):
print(-1)
else:
for i in range(1,h+1):
print(i,i+1)
if d>h:
print(1,h+2)
for i in range(h+2,d+1):
print(i,i+1)
for i in range(d... | output | 1 | 83,011 | 13 | 166,023 |
Provide tags and a correct Python 3 solution for this coding contest problem.
A tree is a connected undirected graph consisting of n vertices and n - 1 edges. Vertices are numbered 1 through n.
Limak is a little polar bear and Radewoosh is his evil enemy. Limak once had a tree but Radewoosh stolen it. Bear is very sa... | instruction | 0 | 83,012 | 13 | 166,024 |
Tags: constructive algorithms, graphs, trees
Correct Solution:
```
n, d, h = map(int, input().split())
if d > h * 2 or (n > 2 and h == 1 and d == 1):
print(-1)
else:
for i in range(2, h + 2):
print(i-1, i)
c = h+2
for i in range(d - h):
if i == 0:
print(1, h + 2)
els... | output | 1 | 83,012 | 13 | 166,025 |
Provide tags and a correct Python 3 solution for this coding contest problem.
A tree is a connected undirected graph consisting of n vertices and n - 1 edges. Vertices are numbered 1 through n.
Limak is a little polar bear and Radewoosh is his evil enemy. Limak once had a tree but Radewoosh stolen it. Bear is very sa... | instruction | 0 | 83,013 | 13 | 166,026 |
Tags: constructive algorithms, graphs, trees
Correct Solution:
```
n, d, h = (int(i) for i in input().split())
if d > 2 * h:
print(-1)
exit()
if n >= 3 and d == 1:
print(-1)
exit()
a = [int(i+2) for i in range(n-1)]
a.sort(reverse = True)
b, c = 2, 3
if d == h and d != n - 1:
print(1,2)
a.pop()
... | output | 1 | 83,013 | 13 | 166,027 |
Provide tags and a correct Python 3 solution for this coding contest problem.
A tree is a connected undirected graph consisting of n vertices and n - 1 edges. Vertices are numbered 1 through n.
Limak is a little polar bear and Radewoosh is his evil enemy. Limak once had a tree but Radewoosh stolen it. Bear is very sa... | instruction | 0 | 83,014 | 13 | 166,028 |
Tags: constructive algorithms, graphs, trees
Correct Solution:
```
n,d,h=map(int,input().split())
if((n>2 and d==1)or 2*h<d):exit(print(-1))
for i in range(h):print(i+1,i+2)
if(d!=h):
print(1,h+2)
for i in range(d-h-1):print(i+h+2,i+h+3)
for i in range(n-d-1):print(1+(d==h),i+d+2)
# Made By Mostafa_Khaled... | output | 1 | 83,014 | 13 | 166,029 |
Provide tags and a correct Python 3 solution for this coding contest problem.
A tree is a connected undirected graph consisting of n vertices and n - 1 edges. Vertices are numbered 1 through n.
Limak is a little polar bear and Radewoosh is his evil enemy. Limak once had a tree but Radewoosh stolen it. Bear is very sa... | instruction | 0 | 83,015 | 13 | 166,030 |
Tags: constructive algorithms, graphs, trees
Correct Solution:
```
import sys,os,io
import math,bisect,operator
inf,mod = float('inf'),10**9+7
# sys.setrecursionlimit(10 ** 6)
from itertools import groupby,accumulate
from heapq import heapify,heappop,heappush
from collections import deque,Counter,defaultdict
input = it... | output | 1 | 83,015 | 13 | 166,031 |
Provide tags and a correct Python 3 solution for this coding contest problem.
A tree is a connected undirected graph consisting of n vertices and n - 1 edges. Vertices are numbered 1 through n.
Limak is a little polar bear and Radewoosh is his evil enemy. Limak once had a tree but Radewoosh stolen it. Bear is very sa... | instruction | 0 | 83,016 | 13 | 166,032 |
Tags: constructive algorithms, graphs, trees
Correct Solution:
```
n,d,h=list(map(int,input().split()))
if 2*h<d or (h==d==1 and n>2):
print(-1)
else:
ans=[]
z=1
for i in range(h):
ans.append((i+1,i+2))
z=i+2
k=d-h
if k>0:
ans.append((1,z+1))
z+=1
k-=1
... | output | 1 | 83,016 | 13 | 166,033 |
Provide tags and a correct Python 3 solution for this coding contest problem.
A tree is a connected undirected graph consisting of n vertices and n - 1 edges. Vertices are numbered 1 through n.
Limak is a little polar bear and Radewoosh is his evil enemy. Limak once had a tree but Radewoosh stolen it. Bear is very sa... | instruction | 0 | 83,017 | 13 | 166,034 |
Tags: constructive algorithms, graphs, trees
Correct Solution:
```
n,d,h = [int(i) for i in input().split()]
if d > 2*h or (d == 1 and n > 2):
print (-1)
else:
for i in range(1,h+1):
print(i,i+1)
if d > h:
print (1,h+2)
for i in range(h+2,d+1):
print (i,i+1)
for i... | output | 1 | 83,017 | 13 | 166,035 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
A tree is a connected undirected graph consisting of n vertices and n - 1 edges. Vertices are numbered 1 through n.
Limak is a little polar bear and Radewoosh is his evil enemy. Limak once had ... | instruction | 0 | 83,018 | 13 | 166,036 |
Yes | output | 1 | 83,018 | 13 | 166,037 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
A tree is a connected undirected graph consisting of n vertices and n - 1 edges. Vertices are numbered 1 through n.
Limak is a little polar bear and Radewoosh is his evil enemy. Limak once had ... | instruction | 0 | 83,019 | 13 | 166,038 |
Yes | output | 1 | 83,019 | 13 | 166,039 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
A tree is a connected undirected graph consisting of n vertices and n - 1 edges. Vertices are numbered 1 through n.
Limak is a little polar bear and Radewoosh is his evil enemy. Limak once had ... | instruction | 0 | 83,020 | 13 | 166,040 |
Yes | output | 1 | 83,020 | 13 | 166,041 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
A tree is a connected undirected graph consisting of n vertices and n - 1 edges. Vertices are numbered 1 through n.
Limak is a little polar bear and Radewoosh is his evil enemy. Limak once had ... | instruction | 0 | 83,021 | 13 | 166,042 |
Yes | output | 1 | 83,021 | 13 | 166,043 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.