message stringlengths 2 65.1k | message_type stringclasses 2
values | message_id int64 0 1 | conversation_id int64 0 108k | cluster float64 14 14 | __index_level_0__ int64 0 217k |
|---|---|---|---|---|---|
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Asya loves animals very much. Recently, she purchased n kittens, enumerated them from 1 and n and then put them into the cage. The cage consists of one row of n cells, enumerated with integers f... | instruction | 0 | 100,383 | 14 | 200,766 |
No | output | 1 | 100,383 | 14 | 200,767 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Cat Furrier Transform is a popular algorithm among cat programmers to create longcats. As one of the greatest cat programmers ever exist, Neko wants to utilize this algorithm to create the perfect longcat.
Assume that we have a cat with a n... | instruction | 0 | 100,384 | 14 | 200,768 |
Tags: bitmasks, constructive algorithms, dfs and similar, math
Correct Solution:
```
i = int(input())
def getZ(n):
s = "{0:0b}".format(n)
return len(s) - s.find("0")
def check(n):
return "{0:0b}".format(n).find("0") == -1
steps = 0
ans = []
while not check(i):
m = getZ(i)
i = i ^ ((2 ** m) - 1)
... | output | 1 | 100,384 | 14 | 200,769 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Cat Furrier Transform is a popular algorithm among cat programmers to create longcats. As one of the greatest cat programmers ever exist, Neko wants to utilize this algorithm to create the perfect longcat.
Assume that we have a cat with a n... | instruction | 0 | 100,385 | 14 | 200,770 |
Tags: bitmasks, constructive algorithms, dfs and similar, math
Correct Solution:
```
import bisect
import decimal
from decimal import Decimal
import os
from collections import Counter
import bisect
from collections import defaultdict
import math
import random
import heapq
from math import sqrt
import sys
from functool... | output | 1 | 100,385 | 14 | 200,771 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Cat Furrier Transform is a popular algorithm among cat programmers to create longcats. As one of the greatest cat programmers ever exist, Neko wants to utilize this algorithm to create the perfect longcat.
Assume that we have a cat with a n... | instruction | 0 | 100,386 | 14 | 200,772 |
Tags: bitmasks, constructive algorithms, dfs and similar, math
Correct Solution:
```
from sys import *
from math import *
from bisect import *
n=int(stdin.readline())
x=n.bit_length()
ans=[]
f=0
for i in range(x,0,-1):
y=(bin(1<<(i-1)))
if (1<<(i-1) & n)==0:
n=n^(2**i-1)
k=bin(n)
ans.app... | output | 1 | 100,386 | 14 | 200,773 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Cat Furrier Transform is a popular algorithm among cat programmers to create longcats. As one of the greatest cat programmers ever exist, Neko wants to utilize this algorithm to create the perfect longcat.
Assume that we have a cat with a n... | instruction | 0 | 100,387 | 14 | 200,774 |
Tags: bitmasks, constructive algorithms, dfs and similar, math
Correct Solution:
```
x = int(input())
b = len(bin(x)) - 2
ans = []
n = 0
while x ^ ((1 << b) - 1):
bn = bin(x)[2:]
for i in range(b):
if bn[i] == '0':
x ^= ((1 << (b-i)) - 1)
ans.append(b-i)
break
if ... | output | 1 | 100,387 | 14 | 200,775 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Cat Furrier Transform is a popular algorithm among cat programmers to create longcats. As one of the greatest cat programmers ever exist, Neko wants to utilize this algorithm to create the perfect longcat.
Assume that we have a cat with a n... | instruction | 0 | 100,388 | 14 | 200,776 |
Tags: bitmasks, constructive algorithms, dfs and similar, math
Correct Solution:
```
#554_B
import sys
import math
num = int(sys.stdin.readline().rstrip())
nl = math.floor(math.log(num, 2))
a = []
op = 0
while True:
if num == 2 ** (nl + 1) - 1:
break
pw = math.floor(math.log((2 ** (nl + 1) - 1) - ... | output | 1 | 100,388 | 14 | 200,777 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Cat Furrier Transform is a popular algorithm among cat programmers to create longcats. As one of the greatest cat programmers ever exist, Neko wants to utilize this algorithm to create the perfect longcat.
Assume that we have a cat with a n... | instruction | 0 | 100,389 | 14 | 200,778 |
Tags: bitmasks, constructive algorithms, dfs and similar, math
Correct Solution:
```
#--------------------
#WA
#--------------------
# from math import log
# def operation(b):
# flag = 0
# s = ""
# for i in range(len(b)-1,1,-1):
# if(b[i]=='0'):
# flag = 1
# if(flag==0 and b[i]=... | output | 1 | 100,389 | 14 | 200,779 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Cat Furrier Transform is a popular algorithm among cat programmers to create longcats. As one of the greatest cat programmers ever exist, Neko wants to utilize this algorithm to create the perfect longcat.
Assume that we have a cat with a n... | instruction | 0 | 100,390 | 14 | 200,780 |
Tags: bitmasks, constructive algorithms, dfs and similar, math
Correct Solution:
```
def check(t):
y = t
while y:
if y % 2 == 0:
return False
y = y >> 1
return True
x = int(input())
c = 0
res = []
def cnt(k):
y = k
t = 0
while y:
t += 1
y = y >> ... | output | 1 | 100,390 | 14 | 200,781 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Cat Furrier Transform is a popular algorithm among cat programmers to create longcats. As one of the greatest cat programmers ever exist, Neko wants to utilize this algorithm to create the perfect longcat.
Assume that we have a cat with a n... | instruction | 0 | 100,391 | 14 | 200,782 |
Tags: bitmasks, constructive algorithms, dfs and similar, math
Correct Solution:
```
from bisect import bisect_right as br
from bisect import bisect_left as bl
from collections import *
from itertools import *
import functools
import sys
from math import *
MAX = sys.maxsize
MAXN = 10**5+10
MOD = 10**9+7
def isprime(n):... | output | 1 | 100,391 | 14 | 200,783 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Dima has a birthday soon! It's a big day! Saryozha's present to Dima is that Seryozha won't be in the room and won't disturb Dima and Inna as they celebrate the birthday. Inna's present to Dima is a stack, a queue and a deck.
Inna wants her... | instruction | 0 | 100,638 | 14 | 201,276 |
Tags: constructive algorithms, greedy, implementation
Correct Solution:
```
def pushOp():
pick = sorted(stack, reverse=True)[:3]
count = 0
for x in stack:
if x in pick:
print('push' + container[count])
count += 1
... | output | 1 | 100,638 | 14 | 201,277 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Dima has a birthday soon! It's a big day! Saryozha's present to Dima is that Seryozha won't be in the room and won't disturb Dima and Inna as they celebrate the birthday. Inna's present to Dima is a stack, a queue and a deck.
Inna wants her... | instruction | 0 | 100,639 | 14 | 201,278 |
Tags: constructive algorithms, greedy, implementation
Correct Solution:
```
n = int(input())
r = ['popStack', 'popQueue', 'popFront' ]
r2 = ['pushStack', 'pushQueue', 'pushFront' ]
_ = 0
while _ < n:
x = []
i = 0
while _ < n:
z = int(input())
_ += 1
if z == 0: break
x.appen... | output | 1 | 100,639 | 14 | 201,279 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Dima has a birthday soon! It's a big day! Saryozha's present to Dima is that Seryozha won't be in the room and won't disturb Dima and Inna as they celebrate the birthday. Inna's present to Dima is a stack, a queue and a deck.
Inna wants her... | instruction | 0 | 100,640 | 14 | 201,280 |
Tags: constructive algorithms, greedy, implementation
Correct Solution:
```
i, n = 0, int(input())
d = ['Queue', 'Stack', 'Back']
a, b, c = [' pop' + q for q in d]
p = ['0', '1' + a, '2' + a + b, '3' + a + b + c]
a, b, c = ['push' + q for q in d]
s, t = [a] * n, []
for j in range(n):
x = int(input())
if x:
... | output | 1 | 100,640 | 14 | 201,281 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Dima has a birthday soon! It's a big day! Saryozha's present to Dima is that Seryozha won't be in the room and won't disturb Dima and Inna as they celebrate the birthday. Inna's present to Dima is a stack, a queue and a deck.
Inna wants her... | instruction | 0 | 100,641 | 14 | 201,282 |
Tags: constructive algorithms, greedy, implementation
Correct Solution:
```
n = int( input() )
Q = 0
P = 0
Df = 0
Db = 0
l=[]
for a in range(n):
x = int(input())
if a==n-1 and x!=0:
l.append(x)
if x==0 or a==n-1:
insQ=True
if l!=[]:
Q = max(l)
for i in l:
if i==Q and insQ:
print("pushQueue")
i... | output | 1 | 100,641 | 14 | 201,283 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Dima has a birthday soon! It's a big day! Saryozha's present to Dima is that Seryozha won't be in the room and won't disturb Dima and Inna as they celebrate the birthday. Inna's present to Dima is a stack, a queue and a deck.
Inna wants her... | instruction | 0 | 100,642 | 14 | 201,284 |
Tags: constructive algorithms, greedy, implementation
Correct Solution:
```
import sys
n = int(input())
a = []
for i in range(n):
a.append(int(input()))
old_i = 0
i = 0
while i < n:
m1_v = -1
m2_v = -1
m3_v = -1
m1_i = 0
m2_i = 0
m3_i = 0
while i < n and a[i] != 0:
if a[i] > m1... | output | 1 | 100,642 | 14 | 201,285 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Dima has a birthday soon! It's a big day! Saryozha's present to Dima is that Seryozha won't be in the room and won't disturb Dima and Inna as they celebrate the birthday. Inna's present to Dima is a stack, a queue and a deck.
Inna wants her... | instruction | 0 | 100,643 | 14 | 201,286 |
Tags: constructive algorithms, greedy, implementation
Correct Solution:
```
n = int(input())
#a = list(map(int, input().split()))
a = [0] * n
for i in range(n):
a[i] = int(input())
i = -1
while (1):
j = i + 1
while j < n and a[j] != 0:
j += 1
if j == n:
for k in range(i + 1, n):
... | output | 1 | 100,643 | 14 | 201,287 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Dima has a birthday soon! It's a big day! Saryozha's present to Dima is that Seryozha won't be in the room and won't disturb Dima and Inna as they celebrate the birthday. Inna's present to Dima is a stack, a queue and a deck.
Inna wants her... | instruction | 0 | 100,644 | 14 | 201,288 |
Tags: constructive algorithms, greedy, implementation
Correct Solution:
```
n = int(input())
r = ['popStack', 'popQueue', 'popFront' ]
r2 = ['pushStack', 'pushQueue', 'pushFront' ]
_ = 0
while _ < n:
x = []
i = 0
while _ < n:
z = int(input())
_ += 1
if z == 0: break
... | output | 1 | 100,644 | 14 | 201,289 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Dima has a birthday soon! It's a big day! Saryozha's present to Dima is that Seryozha won't be in the room and won't disturb Dima and Inna as they celebrate the birthday. Inna's present to Dima is a stack, a queue and a deck.
Inna wants her... | instruction | 0 | 100,645 | 14 | 201,290 |
Tags: constructive algorithms, greedy, implementation
Correct Solution:
```
i, n = 0, int(input())
s = ['pushQueue'] * n
a, b, c = ' popQueue', ' popStack', ' popBack'
p = ['0', '1' + a, '2' + a + b, '3' + a + b + c]
t = []
for j in range(n):
x = int(input())
if x:
t.append((x, j))
continue
... | output | 1 | 100,645 | 14 | 201,291 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Dima has a birthday soon! It's a big day! Saryozha's present to Dima is that Seryozha won't be in the room and won't disturb Dima and Inna as they celebrate the birthday. Inna's present to Dima ... | instruction | 0 | 100,646 | 14 | 201,292 |
Yes | output | 1 | 100,646 | 14 | 201,293 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Dima has a birthday soon! It's a big day! Saryozha's present to Dima is that Seryozha won't be in the room and won't disturb Dima and Inna as they celebrate the birthday. Inna's present to Dima ... | instruction | 0 | 100,647 | 14 | 201,294 |
Yes | output | 1 | 100,647 | 14 | 201,295 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Dima has a birthday soon! It's a big day! Saryozha's present to Dima is that Seryozha won't be in the room and won't disturb Dima and Inna as they celebrate the birthday. Inna's present to Dima ... | instruction | 0 | 100,648 | 14 | 201,296 |
No | output | 1 | 100,648 | 14 | 201,297 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Dima has a birthday soon! It's a big day! Saryozha's present to Dima is that Seryozha won't be in the room and won't disturb Dima and Inna as they celebrate the birthday. Inna's present to Dima ... | instruction | 0 | 100,649 | 14 | 201,298 |
No | output | 1 | 100,649 | 14 | 201,299 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Dima has a birthday soon! It's a big day! Saryozha's present to Dima is that Seryozha won't be in the room and won't disturb Dima and Inna as they celebrate the birthday. Inna's present to Dima ... | instruction | 0 | 100,650 | 14 | 201,300 |
No | output | 1 | 100,650 | 14 | 201,301 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Dima has a birthday soon! It's a big day! Saryozha's present to Dima is that Seryozha won't be in the room and won't disturb Dima and Inna as they celebrate the birthday. Inna's present to Dima ... | instruction | 0 | 100,651 | 14 | 201,302 |
No | output | 1 | 100,651 | 14 | 201,303 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Note the unusual memory limit for the problem.
People working in MDCS (Microsoft Development Center Serbia) like partying. They usually go to night clubs on Friday and Saturday.
There are N pe... | instruction | 0 | 100,736 | 14 | 201,472 |
No | output | 1 | 100,736 | 14 | 201,473 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Limak is a little polar bear. He loves connecting with other bears via social networks. He has n friends and his relation with the i-th of them is described by a unique integer ti. The bigger this value is, the better the friendship is. No t... | instruction | 0 | 100,769 | 14 | 201,538 |
Tags: implementation
Correct Solution:
```
def solve():
n, k, q = map(int, input().split())
fr = [0] + list(map(int, input().split()))
on = list()
a = list()
for _ in range(q):
t, i = map(int, input().split())
if t == 1:
if len(on) < k:
on.append(fr[i])
... | output | 1 | 100,769 | 14 | 201,539 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Limak is a little polar bear. He loves connecting with other bears via social networks. He has n friends and his relation with the i-th of them is described by a unique integer ti. The bigger this value is, the better the friendship is. No t... | instruction | 0 | 100,770 | 14 | 201,540 |
Tags: implementation
Correct Solution:
```
n, k, q = tuple (map(int, input().split() ))
t = tuple( map( int, input().split() ) )
online = []
full = False
for i in range(q):
query = tuple (map(int, input().split()))
if query[0] == 1:
if not full:
online.append(query[1])
full = ... | output | 1 | 100,770 | 14 | 201,541 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Limak is a little polar bear. He loves connecting with other bears via social networks. He has n friends and his relation with the i-th of them is described by a unique integer ti. The bigger this value is, the better the friendship is. No t... | instruction | 0 | 100,771 | 14 | 201,542 |
Tags: implementation
Correct Solution:
```
(n,k,q) = map(int,input().split())
level = list(map(int,input().split()))
qt=[]
qid=[]
lfr = set()
for i in range(0,q):
(qtemp,qidtemp) = map(int,input().split())
if (qtemp == 1):
if (len(lfr)<k):
lfr.add(qidtemp)
else:
minn = q... | output | 1 | 100,771 | 14 | 201,543 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Limak is a little polar bear. He loves connecting with other bears via social networks. He has n friends and his relation with the i-th of them is described by a unique integer ti. The bigger this value is, the better the friendship is. No t... | instruction | 0 | 100,772 | 14 | 201,544 |
Tags: implementation
Correct Solution:
```
import io
import os
input = io.BytesIO(os.read(0, os.fstat(0).st_size)).readline
def binsearch(nums, target):
left = 0
right = len(nums) - 1
while left <= right:
mid = (left + right) // 2
if nums[mid] == target:
return mid
eli... | output | 1 | 100,772 | 14 | 201,545 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Limak is a little polar bear. He loves connecting with other bears via social networks. He has n friends and his relation with the i-th of them is described by a unique integer ti. The bigger this value is, the better the friendship is. No t... | instruction | 0 | 100,773 | 14 | 201,546 |
Tags: implementation
Correct Solution:
```
#!/usr/bin/python3
import operator as op
from queue import PriorityQueue
import heapq
class StdReader:
def read_int(self):
return int(self.read_string())
def read_ints(self, sep=None):
return [int(i) for i in self.read_strings(sep)]
def read_float(self):
return fl... | output | 1 | 100,773 | 14 | 201,547 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Limak is a little polar bear. He loves connecting with other bears via social networks. He has n friends and his relation with the i-th of them is described by a unique integer ti. The bigger this value is, the better the friendship is. No t... | instruction | 0 | 100,774 | 14 | 201,548 |
Tags: implementation
Correct Solution:
```
from heapq import heappush, heapreplace
n, k, q, = map(int, input().split())
a = list(map(int, input().split()))
window = []
window_set = set()
min_pr = 10 ** 10
min_pr_id = 0
for i in range(q):
type, id = map(int, input().split())
if type == 1:
if len(window)... | output | 1 | 100,774 | 14 | 201,549 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Limak is a little polar bear. He loves connecting with other bears via social networks. He has n friends and his relation with the i-th of them is described by a unique integer ti. The bigger this value is, the better the friendship is. No t... | instruction | 0 | 100,775 | 14 | 201,550 |
Tags: implementation
Correct Solution:
```
n, k, q = map(int, input().split())
t = [0] + list(map(int, input().split()))
ts = list()
for i in range(q):
typ, idi = map(int, input().split())
if typ == 1:
cnt = len(ts)
tl = t[idi]
if (cnt < k):
ts.append(tl)
else:
... | output | 1 | 100,775 | 14 | 201,551 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Limak is a little polar bear. He loves connecting with other bears via social networks. He has n friends and his relation with the i-th of them is described by a unique integer ti. The bigger this value is, the better the friendship is. No t... | instruction | 0 | 100,776 | 14 | 201,552 |
Tags: implementation
Correct Solution:
```
n, k, q = map(int, input().split())
t = tuple(int(friendship) for friendship in input().split())
window = set()
for i in range(q):
query, friend_id = map(int, input().split())
friend_id -= 1
if query == 1:
if len(window) < k:
window.add(friend_i... | output | 1 | 100,776 | 14 | 201,553 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Limak is a little polar bear. He loves connecting with other bears via social networks. He has n friends and his relation with the i-th of them is described by a unique integer ti. The bigger th... | instruction | 0 | 100,777 | 14 | 201,554 |
Yes | output | 1 | 100,777 | 14 | 201,555 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Limak is a little polar bear. He loves connecting with other bears via social networks. He has n friends and his relation with the i-th of them is described by a unique integer ti. The bigger th... | instruction | 0 | 100,778 | 14 | 201,556 |
Yes | output | 1 | 100,778 | 14 | 201,557 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Limak is a little polar bear. He loves connecting with other bears via social networks. He has n friends and his relation with the i-th of them is described by a unique integer ti. The bigger th... | instruction | 0 | 100,779 | 14 | 201,558 |
Yes | output | 1 | 100,779 | 14 | 201,559 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Limak is a little polar bear. He loves connecting with other bears via social networks. He has n friends and his relation with the i-th of them is described by a unique integer ti. The bigger th... | instruction | 0 | 100,780 | 14 | 201,560 |
Yes | output | 1 | 100,780 | 14 | 201,561 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Limak is a little polar bear. He loves connecting with other bears via social networks. He has n friends and his relation with the i-th of them is described by a unique integer ti. The bigger th... | instruction | 0 | 100,781 | 14 | 201,562 |
No | output | 1 | 100,781 | 14 | 201,563 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Limak is a little polar bear. He loves connecting with other bears via social networks. He has n friends and his relation with the i-th of them is described by a unique integer ti. The bigger th... | instruction | 0 | 100,782 | 14 | 201,564 |
No | output | 1 | 100,782 | 14 | 201,565 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Limak is a little polar bear. He loves connecting with other bears via social networks. He has n friends and his relation with the i-th of them is described by a unique integer ti. The bigger th... | instruction | 0 | 100,783 | 14 | 201,566 |
No | output | 1 | 100,783 | 14 | 201,567 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Limak is a little polar bear. He loves connecting with other bears via social networks. He has n friends and his relation with the i-th of them is described by a unique integer ti. The bigger th... | instruction | 0 | 100,784 | 14 | 201,568 |
No | output | 1 | 100,784 | 14 | 201,569 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Heidi's friend Jenny is asking Heidi to deliver an important letter to one of their common friends. Since Jenny is Irish, Heidi thinks that this might be a prank. More precisely, she suspects that the message she is asked to deliver states: ... | instruction | 0 | 100,832 | 14 | 201,664 |
Tags: dfs and similar, graphs, trees
Correct Solution:
```
# maa chudaaye duniya
from collections import defaultdict
graph = defaultdict(list)
n = int(input())
weights = {}
for _ in range(n-1):
a, b, w = map(int, input().split())
edge1 = '{} : {}'.format(a, b)
edge2 = '{} : {}'.format(b, a)
graph[a].append(b)
grap... | output | 1 | 100,832 | 14 | 201,665 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Heidi's friend Jenny is asking Heidi to deliver an important letter to one of their common friends. Since Jenny is Irish, Heidi thinks that this might be a prank. More precisely, she suspects that the message she is asked to deliver states: ... | instruction | 0 | 100,833 | 14 | 201,666 |
Tags: dfs and similar, graphs, trees
Correct Solution:
```
import sys;readline = sys.stdin.readline
def i1(): return int(readline())
def nl(): return [int(s) for s in readline().split()]
def nn(n): return [int(readline()) for i in range(n)]
def nnp(n,x): return [int(readline())+x for i in range(n)]
def nmp(n,x): return... | output | 1 | 100,833 | 14 | 201,667 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Heidi's friend Jenny is asking Heidi to deliver an important letter to one of their common friends. Since Jenny is Irish, Heidi thinks that this might be a prank. More precisely, she suspects that the message she is asked to deliver states: ... | instruction | 0 | 100,834 | 14 | 201,668 |
Tags: dfs and similar, graphs, trees
Correct Solution:
```
from collections import defaultdict
graph = defaultdict(list)
d = {}
n = int(input())
for i in range(n-1):
u,v,cost = list(map(int,input().split()))
graph[u].append(v)
graph[v].append(u)
x = str(u)+':'+str(v)
y = str(v)+':'+str(u)
d[x] ... | output | 1 | 100,834 | 14 | 201,669 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Heidi's friend Jenny is asking Heidi to deliver an important letter to one of their common friends. Since Jenny is Irish, Heidi thinks that this might be a prank. More precisely, she suspects that the message she is asked to deliver states: ... | instruction | 0 | 100,835 | 14 | 201,670 |
Tags: dfs and similar, graphs, trees
Correct Solution:
```
def helper(curr,g,visited):
ans=0
for i in g[curr]:
if i[0] not in visited:
visited.add(i[0])
ans=max(ans,i[1]+helper(i[0],g,visited))
visited.remove(i[0])
return ans
n=int(input())
g=[[] for i in range(n)... | output | 1 | 100,835 | 14 | 201,671 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Heidi's friend Jenny is asking Heidi to deliver an important letter to one of their common friends. Since Jenny is Irish, Heidi thinks that this might be a prank. More precisely, she suspects that the message she is asked to deliver states: ... | instruction | 0 | 100,836 | 14 | 201,672 |
Tags: dfs and similar, graphs, trees
Correct Solution:
```
n = int(input())
matrix = [[] for i in range(n)]
for i in range(n - 1):
a = list(map(int, input().split()))
matrix[a[0]].append([a[1], a[2]])
matrix[a[1]].append([a[0], a[2]])
way = [float('inf') for i in range(n)]
used = [False for i in range(n)]
v... | output | 1 | 100,836 | 14 | 201,673 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Heidi's friend Jenny is asking Heidi to deliver an important letter to one of their common friends. Since Jenny is Irish, Heidi thinks that this might be a prank. More precisely, she suspects that the message she is asked to deliver states: ... | instruction | 0 | 100,837 | 14 | 201,674 |
Tags: dfs and similar, graphs, trees
Correct Solution:
```
# Fast IO Region
import os
import sys
from io import BytesIO, IOBase
BUFSIZE = 8192
class FastIO(IOBase):
newlines = 0
def __init__(self, file):
self._fd = file.fileno()
self.buffer = BytesIO()
self.writable = "x" in file.mode or... | output | 1 | 100,837 | 14 | 201,675 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Heidi's friend Jenny is asking Heidi to deliver an important letter to one of their common friends. Since Jenny is Irish, Heidi thinks that this might be a prank. More precisely, she suspects that the message she is asked to deliver states: ... | instruction | 0 | 100,838 | 14 | 201,676 |
Tags: dfs and similar, graphs, trees
Correct Solution:
```
import sys
sys.setrecursionlimit(10**6)
ans = 0
def solve():
n = int(input())
Adj = [[] for i in range(n)]
for i in range(n - 1):
ai, bi, ci = map(int, sys.stdin.readline().split())
Adj[ai].append((bi, ci))
Adj[bi].append... | output | 1 | 100,838 | 14 | 201,677 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Heidi's friend Jenny is asking Heidi to deliver an important letter to one of their common friends. Since Jenny is Irish, Heidi thinks that this might be a prank. More precisely, she suspects that the message she is asked to deliver states: ... | instruction | 0 | 100,839 | 14 | 201,678 |
Tags: dfs and similar, graphs, trees
Correct Solution:
```
count=[]
def DFs(d,node,visited,c):
visited.add(node)
for i in d[node]:
if i[0] not in visited:
#c=c+i[1]
DFs(d,i[0],visited,c+i[1])
count.append(c)
def dfs(d,n):
visited=set()
for i in... | output | 1 | 100,839 | 14 | 201,679 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Heidi's friend Jenny is asking Heidi to deliver an important letter to one of their common friends. Since Jenny is Irish, Heidi thinks that this might be a prank. More precisely, she suspects th... | instruction | 0 | 100,840 | 14 | 201,680 |
Yes | output | 1 | 100,840 | 14 | 201,681 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Heidi's friend Jenny is asking Heidi to deliver an important letter to one of their common friends. Since Jenny is Irish, Heidi thinks that this might be a prank. More precisely, she suspects th... | instruction | 0 | 100,841 | 14 | 201,682 |
Yes | output | 1 | 100,841 | 14 | 201,683 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.