message
stringlengths
2
48.6k
message_type
stringclasses
2 values
message_id
int64
0
1
conversation_id
int64
318
108k
cluster
float64
8
8
__index_level_0__
int64
636
217k
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. There is a trampoline park with n trampolines in a line. The i-th of which has strength S_i. Pekora can jump on trampolines in multiple passes. She starts the pass by jumping on any trampoline ...
instruction
0
37,943
8
75,886
No
output
1
37,943
8
75,887
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. There is a trampoline park with n trampolines in a line. The i-th of which has strength S_i. Pekora can jump on trampolines in multiple passes. She starts the pass by jumping on any trampoline ...
instruction
0
37,944
8
75,888
No
output
1
37,944
8
75,889
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. A and B are preparing themselves for programming contests. The University where A and B study is a set of rooms connected by corridors. Overall, the University has n rooms connected by n - 1 co...
instruction
0
38,083
8
76,166
No
output
1
38,083
8
76,167
Provide tags and a correct Python 3 solution for this coding contest problem. Moriarty has trapped n people in n distinct rooms in a hotel. Some rooms are locked, others are unlocked. But, there is a condition that the people in the hotel can only escape when all the doors are unlocked at the same time. There are m sw...
instruction
0
38,207
8
76,414
Tags: 2-sat, dfs and similar, dsu, graphs Correct Solution: ``` import sys from collections import deque def debug(x, table): for name, val in table.items(): if x is val: print('DEBUG:{} -> {}'.format(name, val), file=sys.stderr) return None def solve(): n, m = map(int, sys.std...
output
1
38,207
8
76,415
Provide tags and a correct Python 3 solution for this coding contest problem. Moriarty has trapped n people in n distinct rooms in a hotel. Some rooms are locked, others are unlocked. But, there is a condition that the people in the hotel can only escape when all the doors are unlocked at the same time. There are m sw...
instruction
0
38,208
8
76,416
Tags: 2-sat, dfs and similar, dsu, graphs Correct Solution: ``` # ------------------- fast io -------------------- 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 = BytesI...
output
1
38,208
8
76,417
Provide tags and a correct Python 3 solution for this coding contest problem. Moriarty has trapped n people in n distinct rooms in a hotel. Some rooms are locked, others are unlocked. But, there is a condition that the people in the hotel can only escape when all the doors are unlocked at the same time. There are m sw...
instruction
0
38,209
8
76,418
Tags: 2-sat, dfs and similar, dsu, graphs Correct Solution: ``` #!/usr/bin/env python3 def _vertex(lit): if lit > 0: return 2 * (lit - 1) else: return 2 * (-lit - 1) + 1 def tarjan(graph): n = len(graph) dfs_num = [None] * n dfs_min = [n] * n waiting = [] waits = [False] * ...
output
1
38,209
8
76,419
Provide tags and a correct Python 3 solution for this coding contest problem. Moriarty has trapped n people in n distinct rooms in a hotel. Some rooms are locked, others are unlocked. But, there is a condition that the people in the hotel can only escape when all the doors are unlocked at the same time. There are m sw...
instruction
0
38,210
8
76,420
Tags: 2-sat, dfs and similar, dsu, graphs Correct Solution: ``` import sys import collections n, m = map(int, input().split()) r = tuple(map(int, input().split())) controls = [tuple(map(int, input().split()))[1:] for i in range(m)] class DSU: def __init__(self): self.parent = None self.has_zer...
output
1
38,210
8
76,421
Provide tags and a correct Python 3 solution for this coding contest problem. Moriarty has trapped n people in n distinct rooms in a hotel. Some rooms are locked, others are unlocked. But, there is a condition that the people in the hotel can only escape when all the doors are unlocked at the same time. There are m sw...
instruction
0
38,211
8
76,422
Tags: 2-sat, dfs and similar, dsu, graphs Correct Solution: ``` #!/usr/bin/env python3 from collections import deque def bfs(adj, edge, col, u): nxt = deque([u]) col[u] = 0 while nxt: v = nxt.popleft() for w in adj[v]: a = [w,v] a.sort() a = tuple(a) ...
output
1
38,211
8
76,423
Provide tags and a correct Python 3 solution for this coding contest problem. Moriarty has trapped n people in n distinct rooms in a hotel. Some rooms are locked, others are unlocked. But, there is a condition that the people in the hotel can only escape when all the doors are unlocked at the same time. There are m sw...
instruction
0
38,212
8
76,424
Tags: 2-sat, dfs and similar, dsu, graphs Correct Solution: ``` ##################################### import atexit, io, sys, collections, math, heapq, fractions,copy, os, functools import sys import random import collections from io import BytesIO, IOBase ##################################### python 3 START BU...
output
1
38,212
8
76,425
Provide tags and a correct Python 3 solution for this coding contest problem. Moriarty has trapped n people in n distinct rooms in a hotel. Some rooms are locked, others are unlocked. But, there is a condition that the people in the hotel can only escape when all the doors are unlocked at the same time. There are m sw...
instruction
0
38,213
8
76,426
Tags: 2-sat, dfs and similar, dsu, graphs Correct Solution: ``` import sys n, m = map(int, input().split()) door = list(map(int, input().split())) a = [[] for i in range(n+1)] e = [[] for i in range(m)] color = [-1] * m visited = [False] * m def bfs(u, visited): color[u] = 0 q = [u] h = 0 visited[u] = True ...
output
1
38,213
8
76,427
Provide tags and a correct Python 3 solution for this coding contest problem. Moriarty has trapped n people in n distinct rooms in a hotel. Some rooms are locked, others are unlocked. But, there is a condition that the people in the hotel can only escape when all the doors are unlocked at the same time. There are m sw...
instruction
0
38,214
8
76,428
Tags: 2-sat, dfs and similar, dsu, graphs Correct Solution: ``` import sys from math import inf time = 0 cc = 0 l = {} d = {} f = {} conn_comp = {} on_stack = {} stack = [] color = [] def tarjan(graph): global l global d global f global pi global stack global on_stack l = {key : inf for k...
output
1
38,214
8
76,429
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Moriarty has trapped n people in n distinct rooms in a hotel. Some rooms are locked, others are unlocked. But, there is a condition that the people in the hotel can only escape when all the door...
instruction
0
38,215
8
76,430
Yes
output
1
38,215
8
76,431
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Moriarty has trapped n people in n distinct rooms in a hotel. Some rooms are locked, others are unlocked. But, there is a condition that the people in the hotel can only escape when all the door...
instruction
0
38,216
8
76,432
Yes
output
1
38,216
8
76,433
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Moriarty has trapped n people in n distinct rooms in a hotel. Some rooms are locked, others are unlocked. But, there is a condition that the people in the hotel can only escape when all the door...
instruction
0
38,217
8
76,434
Yes
output
1
38,217
8
76,435
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Moriarty has trapped n people in n distinct rooms in a hotel. Some rooms are locked, others are unlocked. But, there is a condition that the people in the hotel can only escape when all the door...
instruction
0
38,218
8
76,436
No
output
1
38,218
8
76,437
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Moriarty has trapped n people in n distinct rooms in a hotel. Some rooms are locked, others are unlocked. But, there is a condition that the people in the hotel can only escape when all the door...
instruction
0
38,219
8
76,438
No
output
1
38,219
8
76,439
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Moriarty has trapped n people in n distinct rooms in a hotel. Some rooms are locked, others are unlocked. But, there is a condition that the people in the hotel can only escape when all the door...
instruction
0
38,220
8
76,440
No
output
1
38,220
8
76,441
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Moriarty has trapped n people in n distinct rooms in a hotel. Some rooms are locked, others are unlocked. But, there is a condition that the people in the hotel can only escape when all the door...
instruction
0
38,221
8
76,442
No
output
1
38,221
8
76,443
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. problem AOR Ika got a water tank with a size of $ 1 $ in length and $ N $ in width. The aquarium is tall enough to hold water. The aquarium has $ N-1 $ partitions and is evenly spaced into $ N ...
instruction
0
38,569
8
77,138
No
output
1
38,569
8
77,139
Provide tags and a correct Python 3 solution for this coding contest problem. Masha lives in a multi-storey building, where floors are numbered with positive integers. Two floors are called adjacent if their numbers differ by one. Masha decided to visit Egor. Masha lives on the floor x, Egor on the floor y (not on the...
instruction
0
38,634
8
77,268
Tags: implementation Correct Solution: ``` (x, y, z, t1, t2, t3) = map(int, input().split()) a1 = abs(x - y) * t1 a2 = abs(x - z) * t2 + abs(x - y) * t2 + t3 * 3 if (a2 <= a1): print("YES") else: print("NO") ```
output
1
38,634
8
77,269
Provide tags and a correct Python 3 solution for this coding contest problem. Masha lives in a multi-storey building, where floors are numbered with positive integers. Two floors are called adjacent if their numbers differ by one. Masha decided to visit Egor. Masha lives on the floor x, Egor on the floor y (not on the...
instruction
0
38,635
8
77,270
Tags: implementation Correct Solution: ``` x,y,z,t1,t2,t3 = map(int, input().rstrip().split()) distance = abs(x-y) time_walk = distance*t1 distance_lyft = abs(z-x) + abs(x-y) time_lyft = (distance_lyft*t2) + 3*t3 if(time_lyft>time_walk): print('NO') else: print('YES') ```
output
1
38,635
8
77,271
Provide tags and a correct Python 3 solution for this coding contest problem. Masha lives in a multi-storey building, where floors are numbered with positive integers. Two floors are called adjacent if their numbers differ by one. Masha decided to visit Egor. Masha lives on the floor x, Egor on the floor y (not on the...
instruction
0
38,636
8
77,272
Tags: implementation Correct Solution: ``` from sys import stdin x,y,z,t1,t2,t3=map(int,stdin.readline().strip().split()) a=(abs(x-z)*t2)+(t3*3)+(abs(x-y)*t2) e=(abs(x-y)*t1) if a<=e: print("YES") else: print("NO") ```
output
1
38,636
8
77,273
Provide tags and a correct Python 3 solution for this coding contest problem. Masha lives in a multi-storey building, where floors are numbered with positive integers. Two floors are called adjacent if their numbers differ by one. Masha decided to visit Egor. Masha lives on the floor x, Egor on the floor y (not on the...
instruction
0
38,637
8
77,274
Tags: implementation Correct Solution: ``` x, y, z, t1, t2, t3 = map(int, input().split()) stairs = abs(y - x) * t1 movement = abs(z - x) + abs(x - y) elevator = (movement * t2) + t3 * 3 if stairs >= elevator: print('YES') else: print('NO') ```
output
1
38,637
8
77,275
Provide tags and a correct Python 3 solution for this coding contest problem. Masha lives in a multi-storey building, where floors are numbered with positive integers. Two floors are called adjacent if their numbers differ by one. Masha decided to visit Egor. Masha lives on the floor x, Egor on the floor y (not on the...
instruction
0
38,638
8
77,276
Tags: implementation Correct Solution: ``` x, y, z, t1, t2, t3 = map(int, input().split()) ladder = abs(x - y) * t1 elevator = abs(x - z) * t2 + 3 * t3 + abs(x - y) * t2 if elevator > ladder: print("NO") else: print("YES") ```
output
1
38,638
8
77,277
Provide tags and a correct Python 3 solution for this coding contest problem. Masha lives in a multi-storey building, where floors are numbered with positive integers. Two floors are called adjacent if their numbers differ by one. Masha decided to visit Egor. Masha lives on the floor x, Egor on the floor y (not on the...
instruction
0
38,639
8
77,278
Tags: implementation Correct Solution: ``` (x , y, z, t1, t2, t3) = map(int, input().split()) if abs(z-x) * t2 + t3 + t3 + abs(x-y) * t2 + t3 <= abs(x-y) * t1: print('YES') else: print('NO') ```
output
1
38,639
8
77,279
Provide tags and a correct Python 3 solution for this coding contest problem. Masha lives in a multi-storey building, where floors are numbered with positive integers. Two floors are called adjacent if their numbers differ by one. Masha decided to visit Egor. Masha lives on the floor x, Egor on the floor y (not on the...
instruction
0
38,640
8
77,280
Tags: implementation Correct Solution: ``` x, y, z, t1, t2, t3 = map(int, input().split()) l = abs(x - y) w = abs(z - x) if t1 * l >= t2 * (w + l) + (3 * t3): print("YES") else: print("NO") ```
output
1
38,640
8
77,281
Provide tags and a correct Python 3 solution for this coding contest problem. Masha lives in a multi-storey building, where floors are numbered with positive integers. Two floors are called adjacent if their numbers differ by one. Masha decided to visit Egor. Masha lives on the floor x, Egor on the floor y (not on the...
instruction
0
38,641
8
77,282
Tags: implementation Correct Solution: ``` x, y, z, t1, t2, t3 = [int(i) for i in input().split()] ts = abs(x-y) * t1 te = abs(x-y) * t2 + abs(x-z) * t2 + 3 * t3 if te <= ts: print('YES') else: print('NO') ```
output
1
38,641
8
77,283
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Masha lives in a multi-storey building, where floors are numbered with positive integers. Two floors are called adjacent if their numbers differ by one. Masha decided to visit Egor. Masha lives ...
instruction
0
38,642
8
77,284
Yes
output
1
38,642
8
77,285
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Masha lives in a multi-storey building, where floors are numbered with positive integers. Two floors are called adjacent if their numbers differ by one. Masha decided to visit Egor. Masha lives ...
instruction
0
38,643
8
77,286
Yes
output
1
38,643
8
77,287
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Masha lives in a multi-storey building, where floors are numbered with positive integers. Two floors are called adjacent if their numbers differ by one. Masha decided to visit Egor. Masha lives ...
instruction
0
38,644
8
77,288
Yes
output
1
38,644
8
77,289
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Masha lives in a multi-storey building, where floors are numbered with positive integers. Two floors are called adjacent if their numbers differ by one. Masha decided to visit Egor. Masha lives ...
instruction
0
38,645
8
77,290
Yes
output
1
38,645
8
77,291
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Masha lives in a multi-storey building, where floors are numbered with positive integers. Two floors are called adjacent if their numbers differ by one. Masha decided to visit Egor. Masha lives ...
instruction
0
38,646
8
77,292
No
output
1
38,646
8
77,293
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Masha lives in a multi-storey building, where floors are numbered with positive integers. Two floors are called adjacent if their numbers differ by one. Masha decided to visit Egor. Masha lives ...
instruction
0
38,647
8
77,294
No
output
1
38,647
8
77,295
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Masha lives in a multi-storey building, where floors are numbered with positive integers. Two floors are called adjacent if their numbers differ by one. Masha decided to visit Egor. Masha lives ...
instruction
0
38,648
8
77,296
No
output
1
38,648
8
77,297
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Masha lives in a multi-storey building, where floors are numbered with positive integers. Two floors are called adjacent if their numbers differ by one. Masha decided to visit Egor. Masha lives ...
instruction
0
38,649
8
77,298
No
output
1
38,649
8
77,299
Provide tags and a correct Python 3 solution for this coding contest problem. There is a bookshelf which can fit n books. The i-th position of bookshelf is a_i = 1 if there is a book on this position and a_i = 0 otherwise. It is guaranteed that there is at least one book on the bookshelf. In one move, you can choose ...
instruction
0
38,853
8
77,706
Tags: greedy, implementation Correct Solution: ``` for _ in range(int(input())): n = int(input()) a = list(map(int, input().split())) count_1 = 0 for i in range(n): if(a[i] == 1): count_1 += 1 temp = 1 for i in range(n): if(a[i] == 1): j = i+1 ...
output
1
38,853
8
77,707
Provide tags and a correct Python 3 solution for this coding contest problem. There is a bookshelf which can fit n books. The i-th position of bookshelf is a_i = 1 if there is a book on this position and a_i = 0 otherwise. It is guaranteed that there is at least one book on the bookshelf. In one move, you can choose ...
instruction
0
38,854
8
77,708
Tags: greedy, implementation Correct Solution: ``` t=int(input()) while t!=0: t-=1 n=int(input()) l=list(map(int,input().split())) if 1 not in l: print(0) else: fi=l.index(1) while(fi<n and l[fi]!=0): fi+=1 ans=0 while(fi<n): inc=0 fl=0 while (l[fi]!=1): inc+=1 fi+=1 if fi>=n: ...
output
1
38,854
8
77,709
Provide tags and a correct Python 3 solution for this coding contest problem. There is a bookshelf which can fit n books. The i-th position of bookshelf is a_i = 1 if there is a book on this position and a_i = 0 otherwise. It is guaranteed that there is at least one book on the bookshelf. In one move, you can choose ...
instruction
0
38,855
8
77,710
Tags: greedy, implementation Correct Solution: ``` from collections import Counter for _ in range(int(input())): n=int(input()) l=list(map(int,input().split())) if l.count(1)==1: print(0) else: f=l.index(1) for i in range(f,len(l)): if l[i]==1: x=i ...
output
1
38,855
8
77,711
Provide tags and a correct Python 3 solution for this coding contest problem. There is a bookshelf which can fit n books. The i-th position of bookshelf is a_i = 1 if there is a book on this position and a_i = 0 otherwise. It is guaranteed that there is at least one book on the bookshelf. In one move, you can choose ...
instruction
0
38,856
8
77,712
Tags: greedy, implementation Correct Solution: ``` t=int(input()) for i in range(t): n=int(input()) a=list(map(int,input().split())) flag=0 sum_of_ziro=0 ans=0 for i in a: if i==1 and flag==0: flag=1 if i==1 and flag==1: ans+=sum_of_ziro sum_of...
output
1
38,856
8
77,713
Provide tags and a correct Python 3 solution for this coding contest problem. There is a bookshelf which can fit n books. The i-th position of bookshelf is a_i = 1 if there is a book on this position and a_i = 0 otherwise. It is guaranteed that there is at least one book on the bookshelf. In one move, you can choose ...
instruction
0
38,857
8
77,714
Tags: greedy, implementation Correct Solution: ``` for i in range(int(input())): input() line = input().replace(' ', '') line = line[line.find('1'):][::-1] line = line[line.find('1'):][::-1] print(line.count('0')) ```
output
1
38,857
8
77,715
Provide tags and a correct Python 3 solution for this coding contest problem. There is a bookshelf which can fit n books. The i-th position of bookshelf is a_i = 1 if there is a book on this position and a_i = 0 otherwise. It is guaranteed that there is at least one book on the bookshelf. In one move, you can choose ...
instruction
0
38,858
8
77,716
Tags: greedy, implementation Correct Solution: ``` t = int(input()) for _ in range(t): n = int(input()) ans = 0 l = -1 r = -1 lol = [int(n) for n in input().split()] if(lol.count(1) == 1): print(0) else: for i in range(n): if(lol[i]==1): ...
output
1
38,858
8
77,717
Provide tags and a correct Python 3 solution for this coding contest problem. There is a bookshelf which can fit n books. The i-th position of bookshelf is a_i = 1 if there is a book on this position and a_i = 0 otherwise. It is guaranteed that there is at least one book on the bookshelf. In one move, you can choose ...
instruction
0
38,859
8
77,718
Tags: greedy, implementation Correct Solution: ``` import re import sys def solve(nums: str) -> int: nums = nums.replace(' ', '') space_map = re.findall(r'0+', nums) distance_from_left = (sum([int(len(i)) for i in space_map]) - (0 if nums[-1] == '1' else len(space_map[-1])) ...
output
1
38,859
8
77,719
Provide tags and a correct Python 3 solution for this coding contest problem. There is a bookshelf which can fit n books. The i-th position of bookshelf is a_i = 1 if there is a book on this position and a_i = 0 otherwise. It is guaranteed that there is at least one book on the bookshelf. In one move, you can choose ...
instruction
0
38,860
8
77,720
Tags: greedy, implementation Correct Solution: ``` import sys input = sys.stdin.readline for _ in range(int(input())): n = int(input()) # u,v = map(int,input().split()) l = list(map(int,input().split())) arr = [] for i in range(n): if l[i] == 1: arr.append(i) ans = 0 f...
output
1
38,860
8
77,721
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. There is a bookshelf which can fit n books. The i-th position of bookshelf is a_i = 1 if there is a book on this position and a_i = 0 otherwise. It is guaranteed that there is at least one book ...
instruction
0
38,861
8
77,722
Yes
output
1
38,861
8
77,723
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. There is a bookshelf which can fit n books. The i-th position of bookshelf is a_i = 1 if there is a book on this position and a_i = 0 otherwise. It is guaranteed that there is at least one book ...
instruction
0
38,862
8
77,724
Yes
output
1
38,862
8
77,725
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. There is a bookshelf which can fit n books. The i-th position of bookshelf is a_i = 1 if there is a book on this position and a_i = 0 otherwise. It is guaranteed that there is at least one book ...
instruction
0
38,863
8
77,726
Yes
output
1
38,863
8
77,727
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. There is a bookshelf which can fit n books. The i-th position of bookshelf is a_i = 1 if there is a book on this position and a_i = 0 otherwise. It is guaranteed that there is at least one book ...
instruction
0
38,864
8
77,728
Yes
output
1
38,864
8
77,729
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. There is a bookshelf which can fit n books. The i-th position of bookshelf is a_i = 1 if there is a book on this position and a_i = 0 otherwise. It is guaranteed that there is at least one book ...
instruction
0
38,865
8
77,730
No
output
1
38,865
8
77,731
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. There is a bookshelf which can fit n books. The i-th position of bookshelf is a_i = 1 if there is a book on this position and a_i = 0 otherwise. It is guaranteed that there is at least one book ...
instruction
0
38,866
8
77,732
No
output
1
38,866
8
77,733
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. There is a bookshelf which can fit n books. The i-th position of bookshelf is a_i = 1 if there is a book on this position and a_i = 0 otherwise. It is guaranteed that there is at least one book ...
instruction
0
38,867
8
77,734
No
output
1
38,867
8
77,735