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.
This problem is same as the next one, but has smaller constraints.
Shiro's just moved to the new house. She wants to invite all friends of her to the house so they can play monopoly. However, h... | instruction | 0 | 9,165 | 14 | 18,330 |
Yes | output | 1 | 9,165 | 14 | 18,331 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
This problem is same as the next one, but has smaller constraints.
Shiro's just moved to the new house. She wants to invite all friends of her to the house so they can play monopoly. However, h... | instruction | 0 | 9,166 | 14 | 18,332 |
No | output | 1 | 9,166 | 14 | 18,333 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
This problem is same as the next one, but has smaller constraints.
Shiro's just moved to the new house. She wants to invite all friends of her to the house so they can play monopoly. However, h... | instruction | 0 | 9,167 | 14 | 18,334 |
No | output | 1 | 9,167 | 14 | 18,335 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
This problem is same as the next one, but has smaller constraints.
Shiro's just moved to the new house. She wants to invite all friends of her to the house so they can play monopoly. However, h... | instruction | 0 | 9,168 | 14 | 18,336 |
No | output | 1 | 9,168 | 14 | 18,337 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
This problem is same as the next one, but has smaller constraints.
Shiro's just moved to the new house. She wants to invite all friends of her to the house so they can play monopoly. However, h... | instruction | 0 | 9,169 | 14 | 18,338 |
No | output | 1 | 9,169 | 14 | 18,339 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Nick's company employed n people. Now Nick needs to build a tree hierarchy of «supervisor-surbodinate» relations in the company (this is to say that each employee, except one, has exactly one supervisor). There are m applications written in ... | instruction | 0 | 9,335 | 14 | 18,670 |
Tags: dfs and similar, dsu, greedy, shortest paths
Correct Solution:
```
n = int(input())
q = list(map(int, input().split()))
m = int(input())
A = [0] * m
for i in range(m):
entry = list(map(int, input().split()))
for j in range(len(entry)):
entry[j] -= 1
A[i] = entry
e = [0] * n
for i in range(n)... | output | 1 | 9,335 | 14 | 18,671 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Nick's company employed n people. Now Nick needs to build a tree hierarchy of «supervisor-surbodinate» relations in the company (this is to say that each employee, except one, has exactly one supervisor). There are m applications written in ... | instruction | 0 | 9,336 | 14 | 18,672 |
Tags: dfs and similar, dsu, greedy, shortest paths
Correct Solution:
```
n=int(input())
input()
m=int(input())
zp_nach=[-1]*(n+1)
for _ in range(m):
a,b,c=map(int,input().split())
if zp_nach[b]==-1:
zp_nach[b]=c
else:
zp_nach[b]=min(c,zp_nach[b])
if zp_nach.count(-1)==2:
print(sum(zp_nac... | output | 1 | 9,336 | 14 | 18,673 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Nick's company employed n people. Now Nick needs to build a tree hierarchy of «supervisor-surbodinate» relations in the company (this is to say that each employee, except one, has exactly one supervisor). There are m applications written in ... | instruction | 0 | 9,337 | 14 | 18,674 |
Tags: dfs and similar, dsu, greedy, shortest paths
Correct Solution:
```
n = int(input())
lis = list(map(int,input().split()))
m = int(input())
edges = []
for d in range(m):
edges.append(list(map(int,input().split())))
edges.sort(key = lambda x: x[2])
visited = []
count = 0
for i in range(m):
if edges[... | output | 1 | 9,337 | 14 | 18,675 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Nick's company employed n people. Now Nick needs to build a tree hierarchy of «supervisor-surbodinate» relations in the company (this is to say that each employee, except one, has exactly one supervisor). There are m applications written in ... | instruction | 0 | 9,338 | 14 | 18,676 |
Tags: dfs and similar, dsu, greedy, shortest paths
Correct Solution:
```
import sys
import math
import collections
import heapq
input=sys.stdin.readline
n=int(input())
l=[int(i) for i in input().split()]
m=int(input())
s=0
d={}
for i in range(m):
a,b,c=(int(i) for i in input().split())
if(b in d):
d[b]=... | output | 1 | 9,338 | 14 | 18,677 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Nick's company employed n people. Now Nick needs to build a tree hierarchy of «supervisor-surbodinate» relations in the company (this is to say that each employee, except one, has exactly one supervisor). There are m applications written in ... | instruction | 0 | 9,339 | 14 | 18,678 |
Tags: dfs and similar, dsu, greedy, shortest paths
Correct Solution:
```
# n = int(input())
#
# arr = [str(i) for i in range(n+1)]+[str(i) for i in range(n-1,-1,-1)]
#
# for i in range(n):
# print(" "*(2*(n-i))+" ".join(arr[:i+1]+arr[:i][::-1]))
#
# print(" ".join(arr))
#
# for i in range(n-1,-1,-1):
# if i == ... | output | 1 | 9,339 | 14 | 18,679 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Nick's company employed n people. Now Nick needs to build a tree hierarchy of «supervisor-surbodinate» relations in the company (this is to say that each employee, except one, has exactly one supervisor). There are m applications written in ... | instruction | 0 | 9,340 | 14 | 18,680 |
Tags: dfs and similar, dsu, greedy, shortest paths
Correct Solution:
```
def find(arr,a):
if arr[a]==a:
return a
arr[a]=find(arr,arr[a])
return arr[a]
n=int(input())
x=list(map(int,input().split()))
arr=[i for i in range(n+1)]
m=int(input())
l=[]
for _ in range(m):
l.append(list(map(int,input().split())))
l.sort(... | output | 1 | 9,340 | 14 | 18,681 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Nick's company employed n people. Now Nick needs to build a tree hierarchy of «supervisor-surbodinate» relations in the company (this is to say that each employee, except one, has exactly one supervisor). There are m applications written in ... | instruction | 0 | 9,341 | 14 | 18,682 |
Tags: dfs and similar, dsu, greedy, shortest paths
Correct Solution:
```
n, q = int(input()), list(map(int, input().split()))
p = [1000001 for i in range(n + 1)]
for i in range(int(input())):
a, b, c = map(int, input().split())
p[b] = min(p[b], c)
k = q.index(max(q)) + 1
p = p[1: k] + p[k + 1:]
print(-1 if 1000... | output | 1 | 9,341 | 14 | 18,683 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Nick's company employed n people. Now Nick needs to build a tree hierarchy of «supervisor-surbodinate» relations in the company (this is to say that each employee, except one, has exactly one supervisor). There are m applications written in ... | instruction | 0 | 9,342 | 14 | 18,684 |
Tags: dfs and similar, dsu, greedy, shortest paths
Correct Solution:
```
MAX = 1000001
e = int(input())
q = input().split()
m = int(input())
arr1 = [MAX]*e
for i in range(m):
[a, b, c] = list(map(int, input().split()))
arr1[b-1] = min(arr1[b-1], c)
count = 0
for x in arr1:
if x == MAX:
count += 1... | output | 1 | 9,342 | 14 | 18,685 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Having written another programming contest, three Rabbits decided to grab some lunch. The coach gave the team exactly k time units for the lunch break.
The Rabbits have a list of n restaurants to lunch in: the i-th restaurant is characteriz... | instruction | 0 | 9,382 | 14 | 18,764 |
Tags: implementation
Correct Solution:
```
p=[int(n) for n in input().split()]
s=[]
for n in range(p[0]):
s.append([int(n) for n in input().split()])
k=p[1]
op=[]
for n in range(p[0]):
if s[n][1]>k:
op.append(s[n][0]-s[n][1]+k)
else:
op.append(s[n][0])
# print(op[n],s[n])
#print(op,s)
print(max(op))
``... | output | 1 | 9,382 | 14 | 18,765 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Having written another programming contest, three Rabbits decided to grab some lunch. The coach gave the team exactly k time units for the lunch break.
The Rabbits have a list of n restaurants to lunch in: the i-th restaurant is characteriz... | instruction | 0 | 9,383 | 14 | 18,766 |
Tags: implementation
Correct Solution:
```
n,k=map(int,input().split())
answer=None
for i in range(n):
f,t=map(int,input().split())
answeri=f-max(t-k,0)
if i==0 or answer<answeri:
answer=answeri
print(answer)
``` | output | 1 | 9,383 | 14 | 18,767 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Having written another programming contest, three Rabbits decided to grab some lunch. The coach gave the team exactly k time units for the lunch break.
The Rabbits have a list of n restaurants to lunch in: the i-th restaurant is characteriz... | instruction | 0 | 9,384 | 14 | 18,768 |
Tags: implementation
Correct Solution:
```
n,v=map(int,(input().split()))
a=[list(int(a) for a in (input().split())) for i in range(n)]
l=[]
k=0
for i in a:
if i[1]<=v:
l.append(i[0])
else:l.append(i[0]-i[1]+v)
print(max(l))
``` | output | 1 | 9,384 | 14 | 18,769 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Having written another programming contest, three Rabbits decided to grab some lunch. The coach gave the team exactly k time units for the lunch break.
The Rabbits have a list of n restaurants to lunch in: the i-th restaurant is characteriz... | instruction | 0 | 9,385 | 14 | 18,770 |
Tags: implementation
Correct Solution:
```
n, k = map(int, input().strip().split())
l = list()
for i in range(0, n):
f, t = map(int, input().strip().split())
if t > k: l.append(f-t+k);
else: l.append(f)
l.sort(reverse =True);
print(l[0]);
``` | output | 1 | 9,385 | 14 | 18,771 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Having written another programming contest, three Rabbits decided to grab some lunch. The coach gave the team exactly k time units for the lunch break.
The Rabbits have a list of n restaurants to lunch in: the i-th restaurant is characteriz... | instruction | 0 | 9,386 | 14 | 18,772 |
Tags: implementation
Correct Solution:
```
n,k = map(int,input().split())
l = []
for i in range(n):
f,t = map(int,input().split())
if t>k:
l.append(f-(t-k))
else:
l.append(f)
print(max(l))
``` | output | 1 | 9,386 | 14 | 18,773 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Having written another programming contest, three Rabbits decided to grab some lunch. The coach gave the team exactly k time units for the lunch break.
The Rabbits have a list of n restaurants to lunch in: the i-th restaurant is characteriz... | instruction | 0 | 9,388 | 14 | 18,776 |
Tags: implementation
Correct Solution:
```
n,k = input().split()
n,k = int(n) ,int(k)
f = []
t = []
for i in range(n):
tmp1,tmp2 = input().split()
tmp1,tmp2 = int(tmp1) ,int(tmp2)
f.append(tmp1)
t.append(tmp2)
res = -9999999999999999
for i in range(n):
if t[i] >= k:
tmp = f[i] - (t[i] - k)... | output | 1 | 9,388 | 14 | 18,777 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Having written another programming contest, three Rabbits decided to grab some lunch. The coach gave the team exactly k time units for the lunch break.
The Rabbits have a list of n restaurants to lunch in: the i-th restaurant is characteriz... | instruction | 0 | 9,389 | 14 | 18,778 |
Tags: implementation
Correct Solution:
```
def joy(f: int, t: int, k: int) -> int:
return f - (t - k) if t > k else f
(n, k) = map(int, input().split())
joys = [0] * n
for i in range(n):
(f, t) = map(int, input().split())
joys[i] = joy(f, t, k)
print(max(joys))
``` | output | 1 | 9,389 | 14 | 18,779 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Fox Ciel and her friends are in a dancing room. There are n boys and m girls here, and they never danced before. There will be some songs, during each song, there must be exactly one boy and one girl are dancing. Besides, there is a special ... | instruction | 0 | 9,400 | 14 | 18,800 |
Tags: greedy
Correct Solution:
```
a = list(map(int, input().split()))
b = [False for i in range(0, 101)]
f = [False for i in range(0, 101)]
sol = []
for i in range(1, a[0]+1):
for j in range(1, a[1]+1):
if not b[i] or not f[j]:
b[i] = True
f[j] = True
sol.append((i,j))
... | output | 1 | 9,400 | 14 | 18,801 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Fox Ciel and her friends are in a dancing room. There are n boys and m girls here, and they never danced before. There will be some songs, during each song, there must be exactly one boy and one girl are dancing. Besides, there is a special ... | instruction | 0 | 9,401 | 14 | 18,802 |
Tags: greedy
Correct Solution:
```
n, m = map(int, input().split())
print(n + m - 1)
for i in range(n):
print(i + 1, 1)
for j in range(1, m, 1):
print(1, j + 1)
``` | output | 1 | 9,401 | 14 | 18,803 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Fox Ciel and her friends are in a dancing room. There are n boys and m girls here, and they never danced before. There will be some songs, during each song, there must be exactly one boy and one girl are dancing. Besides, there is a special ... | instruction | 0 | 9,402 | 14 | 18,804 |
Tags: greedy
Correct Solution:
```
n, m = tuple(input().split())
n, m = int(n), int(m)
boys = [a for a in range(1, n+1)]
girls = [a for a in range(1, m+1)]
u_boys = [0 for a in range(n)]
u_girls = [0 for a in range(m)]
arr = []
count = 0
for boy in boys:
for girl in girls:
if u_boys[boy-1] == 0 or u_girls[girl-... | output | 1 | 9,402 | 14 | 18,805 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Fox Ciel and her friends are in a dancing room. There are n boys and m girls here, and they never danced before. There will be some songs, during each song, there must be exactly one boy and one girl are dancing. Besides, there is a special ... | instruction | 0 | 9,403 | 14 | 18,806 |
Tags: greedy
Correct Solution:
```
n,m = map(int,input().split())
ii = set()
jj = set()
ans = []
for i in range(1,n+1):
for j in range(1,m+1):
if i not in ii or j not in jj:
ans.append ((i,j))
ii.add(i)
jj.add(j)
print(len(ans))
for a,b in ans:
print(a,b)
``` | output | 1 | 9,403 | 14 | 18,807 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Fox Ciel and her friends are in a dancing room. There are n boys and m girls here, and they never danced before. There will be some songs, during each song, there must be exactly one boy and one girl are dancing. Besides, there is a special ... | instruction | 0 | 9,404 | 14 | 18,808 |
Tags: greedy
Correct Solution:
```
a, b = map(int, input().split())
print (a + b - 1)
print (1, 1)
for i in range (2, b + 1):
print (1, i)
for i in range (2, a + 1):
print (i, 1)
``` | output | 1 | 9,404 | 14 | 18,809 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Fox Ciel and her friends are in a dancing room. There are n boys and m girls here, and they never danced before. There will be some songs, during each song, there must be exactly one boy and one girl are dancing. Besides, there is a special ... | instruction | 0 | 9,405 | 14 | 18,810 |
Tags: greedy
Correct Solution:
```
n,m=map(int,input().split())
print(m+(n-1))
for i in range(m):
print(1,i+1)
for j in range(2,n+1):
print(j,m)
``` | output | 1 | 9,405 | 14 | 18,811 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Fox Ciel and her friends are in a dancing room. There are n boys and m girls here, and they never danced before. There will be some songs, during each song, there must be exactly one boy and one girl are dancing. Besides, there is a special ... | instruction | 0 | 9,406 | 14 | 18,812 |
Tags: greedy
Correct Solution:
```
n,m=list(map(int,input().split()))
ma=list(range(1,m+1))
lk=len(ma)
sa=0
ta=list(range(2,n+1))
sa=lk+len(list(range(2,n+1)))
print(sa)
for x in range(1,m+1):
print(1,x)
for x in range(2,n+1):
print(x,1)
``` | output | 1 | 9,406 | 14 | 18,813 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Fox Ciel and her friends are in a dancing room. There are n boys and m girls here, and they never danced before. There will be some songs, during each song, there must be exactly one boy and one girl are dancing. Besides, there is a special ... | instruction | 0 | 9,407 | 14 | 18,814 |
Tags: greedy
Correct Solution:
```
n,m=map(int,input().split())
ans=[]
for x in range(1,m+1):
ans+=[['1',str(x)]]
for x in range(2,n+1):
ans+=[[str(x),'1']]
print(len(ans))
print('\n'.join(map(' '.join,ans)))
``` | output | 1 | 9,407 | 14 | 18,815 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Fox Ciel and her friends are in a dancing room. There are n boys and m girls here, and they never danced before. There will be some songs, during each song, there must be exactly one boy and one... | instruction | 0 | 9,408 | 14 | 18,816 |
Yes | output | 1 | 9,408 | 14 | 18,817 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Fox Ciel and her friends are in a dancing room. There are n boys and m girls here, and they never danced before. There will be some songs, during each song, there must be exactly one boy and one... | instruction | 0 | 9,409 | 14 | 18,818 |
Yes | output | 1 | 9,409 | 14 | 18,819 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Fox Ciel and her friends are in a dancing room. There are n boys and m girls here, and they never danced before. There will be some songs, during each song, there must be exactly one boy and one... | instruction | 0 | 9,410 | 14 | 18,820 |
Yes | output | 1 | 9,410 | 14 | 18,821 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Fox Ciel and her friends are in a dancing room. There are n boys and m girls here, and they never danced before. There will be some songs, during each song, there must be exactly one boy and one... | instruction | 0 | 9,411 | 14 | 18,822 |
Yes | output | 1 | 9,411 | 14 | 18,823 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Fox Ciel and her friends are in a dancing room. There are n boys and m girls here, and they never danced before. There will be some songs, during each song, there must be exactly one boy and one... | instruction | 0 | 9,412 | 14 | 18,824 |
No | output | 1 | 9,412 | 14 | 18,825 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Fox Ciel and her friends are in a dancing room. There are n boys and m girls here, and they never danced before. There will be some songs, during each song, there must be exactly one boy and one... | instruction | 0 | 9,413 | 14 | 18,826 |
No | output | 1 | 9,413 | 14 | 18,827 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Fox Ciel and her friends are in a dancing room. There are n boys and m girls here, and they never danced before. There will be some songs, during each song, there must be exactly one boy and one... | instruction | 0 | 9,414 | 14 | 18,828 |
No | output | 1 | 9,414 | 14 | 18,829 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Fox Ciel and her friends are in a dancing room. There are n boys and m girls here, and they never danced before. There will be some songs, during each song, there must be exactly one boy and one... | instruction | 0 | 9,415 | 14 | 18,830 |
No | output | 1 | 9,415 | 14 | 18,831 |
Provide tags and a correct Python 3 solution for this coding contest problem.
This is an interactive problem. In the interaction section below you will see the information about flushing the output.
In this problem, you will be playing a game with Hongcow. How lucky of you!
Hongcow has a hidden n by n matrix M. Let ... | instruction | 0 | 9,553 | 14 | 19,106 |
Tags: bitmasks, divide and conquer, interactive
Correct Solution:
```
import sys
def f(x,y):
if not x: return y
elif not y: return x
else: return min(x,y)
count = 0
def req(old, lst):
global count
if count < 20:
print(len(lst))
print(" ".join(map(lambda x: str(x+1), lst)))
sys.stdout.flush()
... | output | 1 | 9,553 | 14 | 19,107 |
Provide tags and a correct Python 3 solution for this coding contest problem.
This is an interactive problem. In the interaction section below you will see the information about flushing the output.
In this problem, you will be playing a game with Hongcow. How lucky of you!
Hongcow has a hidden n by n matrix M. Let ... | instruction | 0 | 9,554 | 14 | 19,108 |
Tags: bitmasks, divide and conquer, interactive
Correct Solution:
```
inf = 10 ** 10
n = int(input())
m = 1
while not (n < 2 ** m):
m += 1
u = []
v = []
for i in range(m):
u.append([])
v.append([])
for j in range(n):
if j & (1 << i):
u[i].append(j+1)
else:
v[i].... | output | 1 | 9,554 | 14 | 19,109 |
Provide tags and a correct Python 3 solution for this coding contest problem.
This is an interactive problem. In the interaction section below you will see the information about flushing the output.
In this problem, you will be playing a game with Hongcow. How lucky of you!
Hongcow has a hidden n by n matrix M. Let ... | instruction | 0 | 9,555 | 14 | 19,110 |
Tags: bitmasks, divide and conquer, interactive
Correct Solution:
```
import sys
n = int(input())
MAX = 2000 * 1000 * 1000
res = [MAX] * n
k = 1
while k < n:
x = [0] * n
output = []
sz = 0
for i in range(0, n, 2 * k):
for j in range(0, min(n - i, k)):
output.append(i + j + 1)
... | output | 1 | 9,555 | 14 | 19,111 |
Provide tags and a correct Python 3 solution for this coding contest problem.
This is an interactive problem. In the interaction section below you will see the information about flushing the output.
In this problem, you will be playing a game with Hongcow. How lucky of you!
Hongcow has a hidden n by n matrix M. Let ... | instruction | 0 | 9,556 | 14 | 19,112 |
Tags: bitmasks, divide and conquer, interactive
Correct Solution:
```
import sys
n = int(input())
mn = [float('inf') for _ in range(n)]
ln = len(bin(n)) - 3
cnt = 0
for bit in range(ln, -1, -1):
query = []
inv_query = []
for i in range(1, n + 1):
if i & (1<<bit):
query.append(i)
... | output | 1 | 9,556 | 14 | 19,113 |
Provide tags and a correct Python 3 solution for this coding contest problem.
This is an interactive problem. In the interaction section below you will see the information about flushing the output.
In this problem, you will be playing a game with Hongcow. How lucky of you!
Hongcow has a hidden n by n matrix M. Let ... | instruction | 0 | 9,557 | 14 | 19,114 |
Tags: bitmasks, divide and conquer, interactive
Correct Solution:
```
n = int(input().strip())
import math
import sys
factor = 1
each_row_min = [10000000000]*n
for i in range(int(math.log(n, 2))+1):
if factor >= n:
break
mask = []
comp_mask = []
for j in range(n):
if (j//factor)%2 == 0:
... | output | 1 | 9,557 | 14 | 19,115 |
Provide tags and a correct Python 3 solution for this coding contest problem.
There are n walruses standing in a queue in an airport. They are numbered starting from the queue's tail: the 1-st walrus stands at the end of the queue and the n-th walrus stands at the beginning of the queue. The i-th walrus has the age eq... | instruction | 0 | 9,641 | 14 | 19,282 |
Tags: binary search, data structures
Correct Solution:
```
from typing import TypeVar, Generic, Callable, List
import sys
from array import array # noqa: F401
def input():
return sys.stdin.buffer.readline().decode('utf-8')
T = TypeVar('T')
class SegmentTree(Generic[T]):
__slots__ = ["size", "tree", "iden... | output | 1 | 9,641 | 14 | 19,283 |
Provide tags and a correct Python 3 solution for this coding contest problem.
There are n walruses standing in a queue in an airport. They are numbered starting from the queue's tail: the 1-st walrus stands at the end of the queue and the n-th walrus stands at the beginning of the queue. The i-th walrus has the age eq... | instruction | 0 | 9,642 | 14 | 19,284 |
Tags: binary search, data structures
Correct Solution:
```
from collections import *
from sys import stdin
from copy import deepcopy
def arr_enu():
return [[n - i, int(x)] for i, x in enumerate(stdin.readline().split())]
def min_arr(a):
arr = deque(sorted(deepcopy(a), key=lambda x: x[1]))
tem = deepcopy... | output | 1 | 9,642 | 14 | 19,285 |
Provide tags and a correct Python 3 solution for this coding contest problem.
There are n walruses standing in a queue in an airport. They are numbered starting from the queue's tail: the 1-st walrus stands at the end of the queue and the n-th walrus stands at the beginning of the queue. The i-th walrus has the age eq... | instruction | 0 | 9,643 | 14 | 19,286 |
Tags: binary search, data structures
Correct Solution:
```
from bisect import bisect_left
n = int(input())
a = list(map(int, input().split()))
b = [0] * n
for i in range(n - 1, -1, -1):
b[i] = bisect_left(a, a[i], i + 1, len(a)) - i - 2
a[i] = min(a[i + 1], a[i]) if i != n - 1 else a[i]
print (*b)
# Made ... | output | 1 | 9,643 | 14 | 19,287 |
Provide tags and a correct Python 3 solution for this coding contest problem.
There are n walruses standing in a queue in an airport. They are numbered starting from the queue's tail: the 1-st walrus stands at the end of the queue and the n-th walrus stands at the beginning of the queue. The i-th walrus has the age eq... | instruction | 0 | 9,644 | 14 | 19,288 |
Tags: binary search, data structures
Correct Solution:
```
n = int(input())
a = [int(x) for x in input().split(' ')]
INF = 1<<30
mn = [INF] * n
for i in range(n - 1, -1, -1):
mn[i] = min(a[i], mn[i + 1] if i + 1 < n else INF)
# print(mn)
for i in range(n):
l = i
r = n - 1
while l < r:
mid = ... | output | 1 | 9,644 | 14 | 19,289 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Acingel is a small town. There was only one doctor here — Miss Ada. She was very friendly and nobody has ever said something bad about her, so who could've expected that Ada will be found dead in her house? Mr Gawry, world-famous detective, ... | instruction | 0 | 9,918 | 14 | 19,836 |
Tags: brute force, combinatorics, math, meet-in-the-middle, two pointers
Correct Solution:
```
I=lambda:map(int,input().split())
n,m=I()
a=[[]]*10
indexwaliarray=[[0 for i in range(n)]for _ in range(m)]
#print(indexwaliarray)
for i in range(m):
a[i]=list(I())
for i in range(m):
for j in range(n):
indexw... | output | 1 | 9,918 | 14 | 19,837 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Acingel is a small town. There was only one doctor here — Miss Ada. She was very friendly and nobody has ever said something bad about her, so who could've expected that Ada will be found dead in her house? Mr Gawry, world-famous detective, ... | instruction | 0 | 9,919 | 14 | 19,838 |
Tags: brute force, combinatorics, math, meet-in-the-middle, two pointers
Correct Solution:
```
n,m = map(int,input().split())
initial = []
first = input().split()
for i in range(n):
initial.append(int(first[i]))
rest = []
for i in range(m-1):
current = []
nfirst = input().split()
for j in range(n):
... | output | 1 | 9,919 | 14 | 19,839 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Acingel is a small town. There was only one doctor here — Miss Ada. She was very friendly and nobody has ever said something bad about her, so who could've expected that Ada will be found dead in her house? Mr Gawry, world-famous detective, ... | instruction | 0 | 9,920 | 14 | 19,840 |
Tags: brute force, combinatorics, math, meet-in-the-middle, two pointers
Correct Solution:
```
def intersection(a, b):
ret = (max(a[0], b[0]), min(a[1], b[1]))
if ret[0] >= ret[1]:
return (-1, -1)
return ret
def calc(n, m, interval):
ret = 0
it_list = [(0, n-1)]
for i in range(m):
... | output | 1 | 9,920 | 14 | 19,841 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Acingel is a small town. There was only one doctor here — Miss Ada. She was very friendly and nobody has ever said something bad about her, so who could've expected that Ada will be found dead in her house? Mr Gawry, world-famous detective, ... | instruction | 0 | 9,921 | 14 | 19,842 |
Tags: brute force, combinatorics, math, meet-in-the-middle, two pointers
Correct Solution:
```
def main():
n, m = [int(c) for c in input().split()]
if m == 1:
print(n * (n + 1) // 2)
return
testimonies = [[int(c) for c in input().split()] for _ in range(m)]
perm_map = {client: i for... | output | 1 | 9,921 | 14 | 19,843 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Acingel is a small town. There was only one doctor here — Miss Ada. She was very friendly and nobody has ever said something bad about her, so who could've expected that Ada will be found dead in her house? Mr Gawry, world-famous detective, ... | instruction | 0 | 9,922 | 14 | 19,844 |
Tags: brute force, combinatorics, math, meet-in-the-middle, two pointers
Correct Solution:
```
n,m=map(int,input().split())
before=[None]+[-1]*n
after=[None]+[-1]*n
for i in range(m):
l=list(map(int,input().split()))
before[l[0]]=False
after[l[-1]]=False
for i in range(n-1):
if after[l[i]]==-1:
... | output | 1 | 9,922 | 14 | 19,845 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.