message stringlengths 2 22.7k | message_type stringclasses 2
values | message_id int64 0 1 | conversation_id int64 145 109k | cluster float64 9 9 | __index_level_0__ int64 290 217k |
|---|---|---|---|---|---|
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
The Bubble Cup hypothesis stood unsolved for 130 years. Who ever proves the hypothesis will be regarded as one of the greatest mathematicians of our time! A famous mathematician Jerry Mao manage... | instruction | 0 | 50,692 | 9 | 101,384 |
No | output | 1 | 50,692 | 9 | 101,385 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
The Bubble Cup hypothesis stood unsolved for 130 years. Who ever proves the hypothesis will be regarded as one of the greatest mathematicians of our time! A famous mathematician Jerry Mao manage... | instruction | 0 | 50,693 | 9 | 101,386 |
No | output | 1 | 50,693 | 9 | 101,387 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Petya is preparing for his birthday. He decided that there would be n different dishes on the dinner table, numbered from 1 to n. Since Petya doesn't like to cook, he wants to order these dishes in restaurants.
Unfortunately, all dishes are... | instruction | 0 | 50,695 | 9 | 101,390 |
Tags: binary search, greedy, sortings
Correct Solution:
```
def delivery_dilemma(x, y, z):
delivery, pick = zip(*sorted(list(zip(x, y))))
s = sum(pick)
for j in range(len(pick)):
if delivery[j] >= s:
z.append(s)
break
s -= pick[j]
if delivery[j] >= s:
... | output | 1 | 50,695 | 9 | 101,391 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Petya is preparing for his birthday. He decided that there would be n different dishes on the dinner table, numbered from 1 to n. Since Petya doesn't like to cook, he wants to order these dishes in restaurants.
Unfortunately, all dishes are... | instruction | 0 | 50,696 | 9 | 101,392 |
Tags: binary search, greedy, sortings
Correct Solution:
```
#state [i][0,1,2] = 0 - do nothing, 1, add bomb, 2,explode
for tt in range(int(input())):
n = int(input())
a = [[0] * 2 for i in range(n)]
b = list(map(int,input().split()))
c = list(map(int,input().split()))
for i in range(n):
a[i... | output | 1 | 50,696 | 9 | 101,393 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Petya is preparing for his birthday. He decided that there would be n different dishes on the dinner table, numbered from 1 to n. Since Petya doesn't like to cook, he wants to order these dishes in restaurants.
Unfortunately, all dishes are... | instruction | 0 | 50,697 | 9 | 101,394 |
Tags: binary search, greedy, sortings
Correct Solution:
```
for _ in range(int(input())):
n = int(input())
a = list(map(int, input().split()))
#c.sort(reversed = True)
b = list(map(int, input().split()))
c = []
for i in range(n):
c.append((a[i], b[i]))
c.sort(reverse = True)
#pri... | output | 1 | 50,697 | 9 | 101,395 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Petya is preparing for his birthday. He decided that there would be n different dishes on the dinner table, numbered from 1 to n. Since Petya doesn't like to cook, he wants to order these dishes in restaurants.
Unfortunately, all dishes are... | instruction | 0 | 50,698 | 9 | 101,396 |
Tags: binary search, greedy, sortings
Correct Solution:
```
for ct in range(int(input())):
n = int(input())
a = [int(i) for i in input().split()]
b = [int(i) for i in input().split()]
d = list(zip(a, b))
d.sort(reverse=True)
d.append((0, 0))
# print(d)
soma = 0
for i in range(n):
... | output | 1 | 50,698 | 9 | 101,397 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Petya is preparing for his birthday. He decided that there would be n different dishes on the dinner table, numbered from 1 to n. Since Petya doesn't like to cook, he wants to order these dishes in restaurants.
Unfortunately, all dishes are... | instruction | 0 | 50,699 | 9 | 101,398 |
Tags: binary search, greedy, sortings
Correct Solution:
```
from sys import stdin
input = stdin.readline
for _ in range(int(input())):
n = int(input())
a = [*map(int, input().split())]
b = [*map(int, input().split())]
l,r = 0, max(a)
while l < r:
mid = (l + r) // 2
if sum(j if i > mi... | output | 1 | 50,699 | 9 | 101,399 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Petya is preparing for his birthday. He decided that there would be n different dishes on the dinner table, numbered from 1 to n. Since Petya doesn't like to cook, he wants to order these dishes in restaurants.
Unfortunately, all dishes are... | instruction | 0 | 50,700 | 9 | 101,400 |
Tags: binary search, greedy, sortings
Correct Solution:
```
for _ in range(int(input())):
n = int(input())
a = list(map(int,input().split()))
b = list(map(int,input().split()))
dp = []
c = sorted(a)
summ = 0
for i in range(n):
dp.append([a[i],i])
summ+=(b[i])
dp.sort()
... | output | 1 | 50,700 | 9 | 101,401 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Petya is preparing for his birthday. He decided that there would be n different dishes on the dinner table, numbered from 1 to n. Since Petya doesn't like to cook, he wants to order these dishes in restaurants.
Unfortunately, all dishes are... | instruction | 0 | 50,701 | 9 | 101,402 |
Tags: binary search, greedy, sortings
Correct Solution:
```
t = int(input())
for i in range(t):
n = int(input())
lst1 = list(map(int,input().split()))
lst2 = list(map(int,input().split()))
lst3 = []
for i in range(n):
lst3.append([lst1[i],lst2[i]])
lst3 = sorted(lst3)
for i in range(... | output | 1 | 50,701 | 9 | 101,403 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Petya is preparing for his birthday. He decided that there would be n different dishes on the dinner table, numbered from 1 to n. Since Petya doesn't like to cook, he wants to order these dishes in restaurants.
Unfortunately, all dishes are... | instruction | 0 | 50,702 | 9 | 101,404 |
Tags: binary search, greedy, sortings
Correct Solution:
```
R=lambda:map(int,input().split())
t,=R()
for _ in[0]*t:
R();a=[];b=[0];s=0
for x,y in sorted(zip(R(),R()))[::-1]:a+=x,;s+=y;b+=s,
print(min(map(max,zip(a+[0],b))))
``` | output | 1 | 50,702 | 9 | 101,405 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Petya is preparing for his birthday. He decided that there would be n different dishes on the dinner table, numbered from 1 to n. Since Petya doesn't like to cook, he wants to order these dishes... | instruction | 0 | 50,703 | 9 | 101,406 |
Yes | output | 1 | 50,703 | 9 | 101,407 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Petya is preparing for his birthday. He decided that there would be n different dishes on the dinner table, numbered from 1 to n. Since Petya doesn't like to cook, he wants to order these dishes... | instruction | 0 | 50,704 | 9 | 101,408 |
Yes | output | 1 | 50,704 | 9 | 101,409 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Petya is preparing for his birthday. He decided that there would be n different dishes on the dinner table, numbered from 1 to n. Since Petya doesn't like to cook, he wants to order these dishes... | instruction | 0 | 50,705 | 9 | 101,410 |
Yes | output | 1 | 50,705 | 9 | 101,411 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Petya is preparing for his birthday. He decided that there would be n different dishes on the dinner table, numbered from 1 to n. Since Petya doesn't like to cook, he wants to order these dishes... | instruction | 0 | 50,706 | 9 | 101,412 |
Yes | output | 1 | 50,706 | 9 | 101,413 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Petya is preparing for his birthday. He decided that there would be n different dishes on the dinner table, numbered from 1 to n. Since Petya doesn't like to cook, he wants to order these dishes... | instruction | 0 | 50,707 | 9 | 101,414 |
No | output | 1 | 50,707 | 9 | 101,415 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Petya is preparing for his birthday. He decided that there would be n different dishes on the dinner table, numbered from 1 to n. Since Petya doesn't like to cook, he wants to order these dishes... | instruction | 0 | 50,708 | 9 | 101,416 |
No | output | 1 | 50,708 | 9 | 101,417 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Petya is preparing for his birthday. He decided that there would be n different dishes on the dinner table, numbered from 1 to n. Since Petya doesn't like to cook, he wants to order these dishes... | instruction | 0 | 50,709 | 9 | 101,418 |
No | output | 1 | 50,709 | 9 | 101,419 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Petya is preparing for his birthday. He decided that there would be n different dishes on the dinner table, numbered from 1 to n. Since Petya doesn't like to cook, he wants to order these dishes... | instruction | 0 | 50,710 | 9 | 101,420 |
No | output | 1 | 50,710 | 9 | 101,421 |
Provide a correct Python 3 solution for this coding contest problem.
In Takahashi's mind, there is always an integer sequence of length 2 \times 10^9 + 1: A = (A_{-10^9}, A_{-10^9 + 1}, ..., A_{10^9 - 1}, A_{10^9}) and an integer P.
Initially, all the elements in the sequence A in Takahashi's mind are 0, and the valu... | instruction | 0 | 51,139 | 9 | 102,278 |
"Correct Solution:
```
import random
from collections import defaultdict
def solve(n, s, xs, m):
ans = [10 ** 9] * (n + 1)
for x in xs:
p = 0
h = 0
y = 1
r = pow(x, m - 2, m)
pos = [0] * (n + 1)
hashes = [0] * (n + 1)
for i, c in enumerate(s, start=1):
... | output | 1 | 51,139 | 9 | 102,279 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
In Takahashi's mind, there is always an integer sequence of length 2 \times 10^9 + 1: A = (A_{-10^9}, A_{-10^9 + 1}, ..., A_{10^9 - 1}, A_{10^9}) and an integer P.
Initially, all the elements i... | instruction | 0 | 51,140 | 9 | 102,280 |
No | output | 1 | 51,140 | 9 | 102,281 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
In Takahashi's mind, there is always an integer sequence of length 2 \times 10^9 + 1: A = (A_{-10^9}, A_{-10^9 + 1}, ..., A_{10^9 - 1}, A_{10^9}) and an integer P.
Initially, all the elements i... | instruction | 0 | 51,141 | 9 | 102,282 |
No | output | 1 | 51,141 | 9 | 102,283 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
In Takahashi's mind, there is always an integer sequence of length 2 \times 10^9 + 1: A = (A_{-10^9}, A_{-10^9 + 1}, ..., A_{10^9 - 1}, A_{10^9}) and an integer P.
Initially, all the elements i... | instruction | 0 | 51,142 | 9 | 102,284 |
No | output | 1 | 51,142 | 9 | 102,285 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
In Takahashi's mind, there is always an integer sequence of length 2 \times 10^9 + 1: A = (A_{-10^9}, A_{-10^9 + 1}, ..., A_{10^9 - 1}, A_{10^9}) and an integer P.
Initially, all the elements i... | instruction | 0 | 51,143 | 9 | 102,286 |
No | output | 1 | 51,143 | 9 | 102,287 |
Provide a correct Python 3 solution for this coding contest problem.
Carving the cake 2 (Cake 2)
JOI-kun and IOI-chan are twin brothers and sisters. JOI has been enthusiastic about making sweets lately, and JOI tried to bake a cake and eat it today, but when it was baked, IOI who smelled it came, so we decided to div... | instruction | 0 | 51,239 | 9 | 102,478 |
"Correct Solution:
```
import sys
sys.setrecursionlimit(10000)
n = int(input())
A = [int(input()) for i in range(n)] * 3
dp = [[-1 for i in range(n * 2)] for j in range(n * 2)]
def dfs(i,j):
#if (j - i > n - 1):undefined
if dp[i][j] != -1:
pass
elif (j - i == n - 1):
dp[i][j] = 0
elif (j - i) % 2 == ... | output | 1 | 51,239 | 9 | 102,479 |
Provide a correct Python 3 solution for this coding contest problem.
Carving the cake 2 (Cake 2)
JOI-kun and IOI-chan are twin brothers and sisters. JOI has been enthusiastic about making sweets lately, and JOI tried to bake a cake and eat it today, but when it was baked, IOI who smelled it came, so we decided to div... | instruction | 0 | 51,240 | 9 | 102,480 |
"Correct Solution:
```
import sys
sys.setrecursionlimit(100000)
N, *A = map(int, open(0).read().split())
memo = [[-1]*N for i in range(N)]
for i in range(N):
memo[i][i] = A[i] if N % 2 else 0
def dfs(p, q, t):
if memo[p][q] != -1:
return memo[p][q]
if t:
memo[p][q] = r = max(A[p] + dfs((p+1)... | output | 1 | 51,240 | 9 | 102,481 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Carving the cake 2 (Cake 2)
JOI-kun and IOI-chan are twin brothers and sisters. JOI has been enthusiastic about making sweets lately, and JOI tried to bake a cake and eat it today, but when it ... | instruction | 0 | 51,241 | 9 | 102,482 |
No | output | 1 | 51,241 | 9 | 102,483 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Carving the cake 2 (Cake 2)
JOI-kun and IOI-chan are twin brothers and sisters. JOI has been enthusiastic about making sweets lately, and JOI tried to bake a cake and eat it today, but when it ... | instruction | 0 | 51,242 | 9 | 102,484 |
No | output | 1 | 51,242 | 9 | 102,485 |
Provide a correct Python 3 solution for this coding contest problem.
Katsusando loves omelette rice.
Besides, he loves crème brûlée, tenderloin steak and so on, and believes that these foods are all loved by everyone.
To prove that hypothesis, he conducted a survey on M kinds of foods and asked N people whether they... | instruction | 0 | 51,980 | 9 | 103,960 |
"Correct Solution:
```
n,m=map(int,input().split())
k,*a = input().split()
sa = set(a)
for i in range(n-1):
k,*a = input().split()
sa &= set(a)
print(len(sa))
``` | output | 1 | 51,980 | 9 | 103,961 |
Provide a correct Python 3 solution for this coding contest problem.
Katsusando loves omelette rice.
Besides, he loves crème brûlée, tenderloin steak and so on, and believes that these foods are all loved by everyone.
To prove that hypothesis, he conducted a survey on M kinds of foods and asked N people whether they... | instruction | 0 | 51,981 | 9 | 103,962 |
"Correct Solution:
```
n,m = map(int, input().split())
like = set(range(1,m+1))
for i in range(n):
k,*a = map(int, input().split())
like&=set(a)
print(len(like))
``` | output | 1 | 51,981 | 9 | 103,963 |
Provide a correct Python 3 solution for this coding contest problem.
Katsusando loves omelette rice.
Besides, he loves crème brûlée, tenderloin steak and so on, and believes that these foods are all loved by everyone.
To prove that hypothesis, he conducted a survey on M kinds of foods and asked N people whether they... | instruction | 0 | 51,982 | 9 | 103,964 |
"Correct Solution:
```
n, m = map(int, input().split())
k = set(range(1, m + 1))
for i in range(n):
k &= set(map(int, input().split()[1:]))
print(len(k))
``` | output | 1 | 51,982 | 9 | 103,965 |
Provide a correct Python 3 solution for this coding contest problem.
Katsusando loves omelette rice.
Besides, he loves crème brûlée, tenderloin steak and so on, and believes that these foods are all loved by everyone.
To prove that hypothesis, he conducted a survey on M kinds of foods and asked N people whether they... | instruction | 0 | 51,983 | 9 | 103,966 |
"Correct Solution:
```
(n, m) = map(int, input().split())
l = [set(list(map(int, input().split()))[1:]) for _ in range(n)]
print(len(l[0].intersection(*l[1:])))
``` | output | 1 | 51,983 | 9 | 103,967 |
Provide a correct Python 3 solution for this coding contest problem.
Katsusando loves omelette rice.
Besides, he loves crème brûlée, tenderloin steak and so on, and believes that these foods are all loved by everyone.
To prove that hypothesis, he conducted a survey on M kinds of foods and asked N people whether they... | instruction | 0 | 51,984 | 9 | 103,968 |
"Correct Solution:
```
(n,m), *ka = [list(map(int, s.split())) for s in open(0)]
c = [0]*(m+1)
for k, *a in ka:
for elm in a:
c[elm] += 1
print(c.count(n))
``` | output | 1 | 51,984 | 9 | 103,969 |
Provide a correct Python 3 solution for this coding contest problem.
Katsusando loves omelette rice.
Besides, he loves crème brûlée, tenderloin steak and so on, and believes that these foods are all loved by everyone.
To prove that hypothesis, he conducted a survey on M kinds of foods and asked N people whether they... | instruction | 0 | 51,985 | 9 | 103,970 |
"Correct Solution:
```
N,M=map(int, input().split())
A=[0]*M
for _ in range(N):
_,*T=map(int,input().split())
for t in T:
A[t-1]+=1
print(A.count(N))
``` | output | 1 | 51,985 | 9 | 103,971 |
Provide a correct Python 3 solution for this coding contest problem.
Katsusando loves omelette rice.
Besides, he loves crème brûlée, tenderloin steak and so on, and believes that these foods are all loved by everyone.
To prove that hypothesis, he conducted a survey on M kinds of foods and asked N people whether they... | instruction | 0 | 51,986 | 9 | 103,972 |
"Correct Solution:
```
n,m=map(int,input().split())
s={}
for _ in range(n):
*b,=map(int,input().split())
b=b[1:]
a=set(b)
if not s:
s=a
else:
s=s&a
print(len(s))
``` | output | 1 | 51,986 | 9 | 103,973 |
Provide a correct Python 3 solution for this coding contest problem.
Katsusando loves omelette rice.
Besides, he loves crème brûlée, tenderloin steak and so on, and believes that these foods are all loved by everyone.
To prove that hypothesis, he conducted a survey on M kinds of foods and asked N people whether they... | instruction | 0 | 51,987 | 9 | 103,974 |
"Correct Solution:
```
n, m = map(int, input().split())
S = set(range(1, m + 1))
for i in range(n):
K, *a = map(int, input().split())
S = S & set(a)
print(len(S))
``` | output | 1 | 51,987 | 9 | 103,975 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Katsusando loves omelette rice.
Besides, he loves crème brûlée, tenderloin steak and so on, and believes that these foods are all loved by everyone.
To prove that hypothesis, he conducted a su... | instruction | 0 | 51,988 | 9 | 103,976 |
Yes | output | 1 | 51,988 | 9 | 103,977 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Katsusando loves omelette rice.
Besides, he loves crème brûlée, tenderloin steak and so on, and believes that these foods are all loved by everyone.
To prove that hypothesis, he conducted a su... | instruction | 0 | 51,989 | 9 | 103,978 |
Yes | output | 1 | 51,989 | 9 | 103,979 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Katsusando loves omelette rice.
Besides, he loves crème brûlée, tenderloin steak and so on, and believes that these foods are all loved by everyone.
To prove that hypothesis, he conducted a su... | instruction | 0 | 51,990 | 9 | 103,980 |
Yes | output | 1 | 51,990 | 9 | 103,981 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Katsusando loves omelette rice.
Besides, he loves crème brûlée, tenderloin steak and so on, and believes that these foods are all loved by everyone.
To prove that hypothesis, he conducted a su... | instruction | 0 | 51,991 | 9 | 103,982 |
Yes | output | 1 | 51,991 | 9 | 103,983 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Katsusando loves omelette rice.
Besides, he loves crème brûlée, tenderloin steak and so on, and believes that these foods are all loved by everyone.
To prove that hypothesis, he conducted a su... | instruction | 0 | 51,992 | 9 | 103,984 |
No | output | 1 | 51,992 | 9 | 103,985 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Katsusando loves omelette rice.
Besides, he loves crème brûlée, tenderloin steak and so on, and believes that these foods are all loved by everyone.
To prove that hypothesis, he conducted a su... | instruction | 0 | 51,993 | 9 | 103,986 |
No | output | 1 | 51,993 | 9 | 103,987 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Katsusando loves omelette rice.
Besides, he loves crème brûlée, tenderloin steak and so on, and believes that these foods are all loved by everyone.
To prove that hypothesis, he conducted a su... | instruction | 0 | 51,994 | 9 | 103,988 |
No | output | 1 | 51,994 | 9 | 103,989 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Katsusando loves omelette rice.
Besides, he loves crème brûlée, tenderloin steak and so on, and believes that these foods are all loved by everyone.
To prove that hypothesis, he conducted a su... | instruction | 0 | 51,995 | 9 | 103,990 |
No | output | 1 | 51,995 | 9 | 103,991 |
Provide tags and a correct Python 3 solution for this coding contest problem.
A mouse encountered a nice big cake and decided to take a walk across it, eating the berries on top of the cake on its way. The cake is rectangular, neatly divided into squares; some of the squares have a berry in them, and some don't.
The ... | instruction | 0 | 52,455 | 9 | 104,910 |
Tags: *special, greedy, implementation, shortest paths
Correct Solution:
```
n,m=map(int,input().split())
a=[]
for i in range(n):
a.append(input())
x=y=0
ans=0
dir=0
if a[0][0]=='*': ans+=1
while x<n and y<m:
xx,yy=n-1,m-1
dis=int(1e18)
for i in range(x,n):
for j in range(y,m):
i... | output | 1 | 52,455 | 9 | 104,911 |
Provide tags and a correct Python 3 solution for this coding contest problem.
A mouse encountered a nice big cake and decided to take a walk across it, eating the berries on top of the cake on its way. The cake is rectangular, neatly divided into squares; some of the squares have a berry in them, and some don't.
The ... | instruction | 0 | 52,456 | 9 | 104,912 |
Tags: *special, greedy, implementation, shortest paths
Correct Solution:
```
import collections
import string
import math
import copy
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.... | output | 1 | 52,456 | 9 | 104,913 |
Provide tags and a correct Python 3 solution for this coding contest problem.
A mouse encountered a nice big cake and decided to take a walk across it, eating the berries on top of the cake on its way. The cake is rectangular, neatly divided into squares; some of the squares have a berry in them, and some don't.
The ... | instruction | 0 | 52,458 | 9 | 104,916 |
Tags: *special, greedy, implementation, shortest paths
Correct Solution:
```
from sys import stdin, gettrace
if gettrace():
def inputi():
return input()
else:
def input():
return next(stdin)[:-1]
def inputi():
return stdin.buffer.readline()
def main():
h,w = map(int, input()... | output | 1 | 52,458 | 9 | 104,917 |
Provide tags and a correct Python 3 solution for this coding contest problem.
A mouse encountered a nice big cake and decided to take a walk across it, eating the berries on top of the cake on its way. The cake is rectangular, neatly divided into squares; some of the squares have a berry in them, and some don't.
The ... | instruction | 0 | 52,459 | 9 | 104,918 |
Tags: *special, greedy, implementation, shortest paths
Correct Solution:
```
h, w = [int(i) for i in input().split()]
a, b = 1, 1
cherry = []
r = 0
for i in range(h):
line = input()
for j in range(w):
if line[j] == '*':
cherry.append((i+1,j+1))
def remov(point):
global a, b
_p1... | output | 1 | 52,459 | 9 | 104,919 |
Provide tags and a correct Python 3 solution for this coding contest problem.
A mouse encountered a nice big cake and decided to take a walk across it, eating the berries on top of the cake on its way. The cake is rectangular, neatly divided into squares; some of the squares have a berry in them, and some don't.
The ... | instruction | 0 | 52,460 | 9 | 104,920 |
Tags: *special, greedy, implementation, shortest paths
Correct Solution:
```
# greedy, prefer right?
from collections import defaultdict as dd, deque
n,m = [int(x) for x in input().split()]
S = [[c == '*' for c in input()] for _ in range(n)]
def next_move(sx, sy):
Q = deque()
Q.append((sx,sy, 0))
res = []
wh... | output | 1 | 52,460 | 9 | 104,921 |
Provide tags and a correct Python 3 solution for this coding contest problem.
A mouse encountered a nice big cake and decided to take a walk across it, eating the berries on top of the cake on its way. The cake is rectangular, neatly divided into squares; some of the squares have a berry in them, and some don't.
The ... | instruction | 0 | 52,461 | 9 | 104,922 |
Tags: *special, greedy, implementation, shortest paths
Correct Solution:
```
import sys
import math
from collections import deque, defaultdict
#print = sys.stdout.write
from string import ascii_letters
letters = ascii_letters[:26]
ONLINE_JUDGE = 0
if any(['--local' in i for i in sys.argv]) and not ONLINE_JUDGE:
... | output | 1 | 52,461 | 9 | 104,923 |
Provide tags and a correct Python 3 solution for this coding contest problem.
A mouse encountered a nice big cake and decided to take a walk across it, eating the berries on top of the cake on its way. The cake is rectangular, neatly divided into squares; some of the squares have a berry in them, and some don't.
The ... | instruction | 0 | 52,462 | 9 | 104,924 |
Tags: *special, greedy, implementation, shortest paths
Correct Solution:
```
n, m = map(int, input().split())
ar = [input() for i in range(n)]
x = 0
y = 0
res = 0
while True:
res += 1 if ar[x][y] == '*' else 0
if x == n - 1 and y == m - 1:
break
elif x == n - 1:
y += 1
elif y == m - 1:
... | output | 1 | 52,462 | 9 | 104,925 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.