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.
Alice and Bob decided to eat some fruit. In the kitchen they found a large bag of oranges and apples. Alice immediately took an orange for herself, Bob took an apple. To make the process of shar... | instruction | 0 | 15,486 | 9 | 30,972 |
No | output | 1 | 15,486 | 9 | 30,973 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Alice and Bob decided to eat some fruit. In the kitchen they found a large bag of oranges and apples. Alice immediately took an orange for herself, Bob took an apple. To make the process of shar... | instruction | 0 | 15,487 | 9 | 30,974 |
No | output | 1 | 15,487 | 9 | 30,975 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Alice and Bob decided to eat some fruit. In the kitchen they found a large bag of oranges and apples. Alice immediately took an orange for herself, Bob took an apple. To make the process of shar... | instruction | 0 | 15,488 | 9 | 30,976 |
No | output | 1 | 15,488 | 9 | 30,977 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Alice and Bob decided to eat some fruit. In the kitchen they found a large bag of oranges and apples. Alice immediately took an orange for herself, Bob took an apple. To make the process of shar... | instruction | 0 | 15,489 | 9 | 30,978 |
No | output | 1 | 15,489 | 9 | 30,979 |
Provide a correct Python 3 solution for this coding contest problem.
Mr. Tanaka died leaving the orchard of HW Earl. The orchard is divided into H x W plots in the north, south, east, and west directions, and apples, oysters, and oranges are planted in each plot. Mr. Tanaka left such a will.
Divide the orchard into a... | instruction | 0 | 15,844 | 9 | 31,688 |
"Correct Solution:
```
import sys
sys.setrecursionlimit(100000)
def load_fields():
fields = []
i = 0
H, W = 0, 0
field = []
for line in sys.stdin:
line = line.rstrip()
if line[0] not in ["#", "@", "*"]:
line = line.split(" ")
H = int(line[0])
W = int(line[1])
if (len(field) != 0):
fields.appen... | output | 1 | 15,844 | 9 | 31,689 |
Provide a correct Python 3 solution for this coding contest problem.
Mr. Tanaka died leaving the orchard of HW Earl. The orchard is divided into H x W plots in the north, south, east, and west directions, and apples, oysters, and oranges are planted in each plot. Mr. Tanaka left such a will.
Divide the orchard into a... | instruction | 0 | 15,845 | 9 | 31,690 |
"Correct Solution:
```
import sys
def setLine(tempH, line):
for i in range(0, len(line)):
geo[tempH][i] = line[i:i+1]
def solve():
person = 0
for i in range(0,H):
for j in range(0,W):
if geo[i][j] is not "_":
search(i,j)
person += 1
print(per... | output | 1 | 15,845 | 9 | 31,691 |
Provide a correct Python 3 solution for this coding contest problem.
Mr. Tanaka died leaving the orchard of HW Earl. The orchard is divided into H x W plots in the north, south, east, and west directions, and apples, oysters, and oranges are planted in each plot. Mr. Tanaka left such a will.
Divide the orchard into a... | instruction | 0 | 15,846 | 9 | 31,692 |
"Correct Solution:
```
# -*- coding: utf-8 -*-
import sys
sys.setrecursionlimit(10**6)
def search(values,hp,vp,item):
if not (0<=hp<len(values)): return
if not (0<=vp<len(values[hp])): return
if item!=values[hp][vp]: return
values[hp][vp]=True
# for dh,dv in [[0,1],[0,-1],[1,0],[-1,0]]:
# search(values,hp+dh,vp+... | output | 1 | 15,846 | 9 | 31,693 |
Provide a correct Python 3 solution for this coding contest problem.
Mr. Tanaka died leaving the orchard of HW Earl. The orchard is divided into H x W plots in the north, south, east, and west directions, and apples, oysters, and oranges are planted in each plot. Mr. Tanaka left such a will.
Divide the orchard into a... | instruction | 0 | 15,847 | 9 | 31,694 |
"Correct Solution:
```
import sys
sys.setrecursionlimit(100000)
def count(h, w, fruits):
if h < 0 or h >= H:
return False
if w < 0 or w >= W:
return False
if fruits == '_':
return False
if fruits != land[h][w]:
return False
land[h][w] = '_'
count(h+1, w, fruits)
... | output | 1 | 15,847 | 9 | 31,695 |
Provide a correct Python 3 solution for this coding contest problem.
Mr. Tanaka died leaving the orchard of HW Earl. The orchard is divided into H x W plots in the north, south, east, and west directions, and apples, oysters, and oranges are planted in each plot. Mr. Tanaka left such a will.
Divide the orchard into a... | instruction | 0 | 15,848 | 9 | 31,696 |
"Correct Solution:
```
def Labeling(terrain):
label = terrain
offset = [[-1, 0], [0, -1], [1, 0], [0, 1]]
signs = ["@", "#", "*"]
step = 0
for row in range(1, len(label) - 1):
for col in range(1, len(label[row]) - 1):
mark = label[row][col]
if mark in signs:
... | output | 1 | 15,848 | 9 | 31,697 |
Provide a correct Python 3 solution for this coding contest problem.
Mr. Tanaka died leaving the orchard of HW Earl. The orchard is divided into H x W plots in the north, south, east, and west directions, and apples, oysters, and oranges are planted in each plot. Mr. Tanaka left such a will.
Divide the orchard into a... | instruction | 0 | 15,849 | 9 | 31,698 |
"Correct Solution:
```
# AOJ 0118 Property Distribution
# Python3 2018.6.23 bal4u
# 隣接する同種ものを集める、Unionセットに帰着
# UNION-FIND library
class UnionSet:
def __init__(self, nmax):
self.size = [1]*nmax
self.id = [i for i in range(nmax+1)]
def root(self, i):
while i != self.id[i]:
self.id[i] = self.id[self.id[i]]
... | output | 1 | 15,849 | 9 | 31,699 |
Provide a correct Python 3 solution for this coding contest problem.
Mr. Tanaka died leaving the orchard of HW Earl. The orchard is divided into H x W plots in the north, south, east, and west directions, and apples, oysters, and oranges are planted in each plot. Mr. Tanaka left such a will.
Divide the orchard into a... | instruction | 0 | 15,850 | 9 | 31,700 |
"Correct Solution:
```
# AOJ 0118 Property Distribution
# Python3 2018.6.23 bal4u
# 隣接する同種ものを集める、Unionセットに帰着
# UNION-FIND library
class UnionSet:
def __init__(self, nmax):
self.size = [1]*nmax
self.id = [i for i in range(nmax+1)]
def root(self, i):
while i != self.id[i]:
self.id[i] = self.id[self.id[i]]
... | output | 1 | 15,850 | 9 | 31,701 |
Provide a correct Python 3 solution for this coding contest problem.
Mr. Tanaka died leaving the orchard of HW Earl. The orchard is divided into H x W plots in the north, south, east, and west directions, and apples, oysters, and oranges are planted in each plot. Mr. Tanaka left such a will.
Divide the orchard into a... | instruction | 0 | 15,851 | 9 | 31,702 |
"Correct Solution:
```
import sys
sys.setrecursionlimit(100000)
def load_fields():
fields = []
i = 0
H, W = 0, 0
field = []
for line in sys.stdin:
line = line.rstrip()
if line[0] not in ["#", "@", "*"]:
line = line.split(" ")
H, W = int(line[0]), int(line[1])
if (len(field) != 0):
fields.append(f... | output | 1 | 15,851 | 9 | 31,703 |
Provide a correct Python 3 solution for this coding contest problem.
A: four tea
problem
Tea is indispensable for programming contests. Tea has the effect of relieving constant tension [citation needed]
There are N players participating in the contest, so I would like to prepare tea for this number of people. There... | instruction | 0 | 15,901 | 9 | 31,802 |
"Correct Solution:
```
n = int(input())
lis1 = list(map(int,input().split()))
lis2 = list(map(int,input().split()))
money = [10**7+9]*(n+1)
money[0] = 0
for price,num in zip(lis1,lis2):
i = 0
while(i<n+1):
if i-num < 0:
money[i] = min(price,money[i])
else:
money[i] = min... | output | 1 | 15,901 | 9 | 31,803 |
Provide a correct Python 3 solution for this coding contest problem.
A: four tea
problem
Tea is indispensable for programming contests. Tea has the effect of relieving constant tension [citation needed]
There are N players participating in the contest, so I would like to prepare tea for this number of people. There... | instruction | 0 | 15,902 | 9 | 31,804 |
"Correct Solution:
```
N = int(input())
p = list(map(int, input().split()))
t = list(map(int, input().split()))
ans = 10 ** 10
#aの最大個数
A = max(0, (N + t[0] - 1)// t[0])
for a in range(A+1):
#aの個数が決まったときのbの最大個数
B = max(0, (N - a * t[0] + t[1] - 1)//t[1])
for b in range(B+1):
#a,bの個数が決まったときのcの最大個数
... | output | 1 | 15,902 | 9 | 31,805 |
Provide a correct Python 3 solution for this coding contest problem.
A: four tea
problem
Tea is indispensable for programming contests. Tea has the effect of relieving constant tension [citation needed]
There are N players participating in the contest, so I would like to prepare tea for this number of people. There... | instruction | 0 | 15,903 | 9 | 31,806 |
"Correct Solution:
```
N = int(input())
p = list(map(int, input().split()))
t = list(map(int, input().split()))
res = 100000
for i in range(N+1):
for j in range(N+1):
for k in range(N+1):
if N < t[0] * i + t[1] * j + t[2] * k:
if res > p[0]*i + p[1]*j + p[2]*k:
... | output | 1 | 15,903 | 9 | 31,807 |
Provide a correct Python 3 solution for this coding contest problem.
A: four tea
problem
Tea is indispensable for programming contests. Tea has the effect of relieving constant tension [citation needed]
There are N players participating in the contest, so I would like to prepare tea for this number of people. There... | instruction | 0 | 15,904 | 9 | 31,808 |
"Correct Solution:
```
# from sys import exit
N = int(input())
P = [int(n) for n in input().split()]
t = [int(n) for n in input().split()]
Pt = sorted([(p, t) for p, t in zip(P,t)])
memo = [0 for _ in range(N)]
def rec(n):
if n >= N:
return 0
elif memo[n] != 0:
return memo[n]
else:
... | output | 1 | 15,904 | 9 | 31,809 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Today, Yasser and Adel are at the shop buying cupcakes. There are n cupcake types, arranged from 1 to n on the shelf, and there are infinitely many of each type. The tastiness of a cupcake of type i is an integer a_i. There are both tasty an... | instruction | 0 | 16,066 | 9 | 32,132 |
Tags: dp, greedy, implementation
Correct Solution:
```
for _ in range(int(input())):
i1=int(input())
ar=list(map(int,input().split()))
ts=sum(ar)
s1=0
s2=0
flag=True
for i in range(i1-1):
s1+=ar[i]
s2+=ar[-(i+1)]
if(s1>=ts or s2>=ts):
flag=False
... | output | 1 | 16,066 | 9 | 32,133 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Today, Yasser and Adel are at the shop buying cupcakes. There are n cupcake types, arranged from 1 to n on the shelf, and there are infinitely many of each type. The tastiness of a cupcake of type i is an integer a_i. There are both tasty an... | instruction | 0 | 16,067 | 9 | 32,134 |
Tags: dp, greedy, implementation
Correct Solution:
```
INT_MAX=10**18+7
MOD=10**9+7
def INPUT():return list(int(i) for i in input().split())
def LIST_1D_ARRAY(n):return [0 for _ in range(n)]
def LIST_2D_ARRAY(m,n):return [[0 for _ in range(n)]for _ in range(m)]
##########################################################... | output | 1 | 16,067 | 9 | 32,135 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Today, Yasser and Adel are at the shop buying cupcakes. There are n cupcake types, arranged from 1 to n on the shelf, and there are infinitely many of each type. The tastiness of a cupcake of type i is an integer a_i. There are both tasty an... | instruction | 0 | 16,068 | 9 | 32,136 |
Tags: dp, greedy, implementation
Correct Solution:
```
def solve():
s = 0
for i in range(n):
s += v[i]
if s <= 0:
return 0
s = 0
for i in range(n-1, -1, -1):
s += v[i]
if s <= 0:
return 0
return 1
t = int(input())
while t:
n = int(input())... | output | 1 | 16,068 | 9 | 32,137 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Today, Yasser and Adel are at the shop buying cupcakes. There are n cupcake types, arranged from 1 to n on the shelf, and there are infinitely many of each type. The tastiness of a cupcake of type i is an integer a_i. There are both tasty an... | instruction | 0 | 16,069 | 9 | 32,138 |
Tags: dp, greedy, implementation
Correct Solution:
```
"""
Template written to be used by Python Programmers.
Use at your own risk!!!!
Owned by adi0311(rating - 1989 at CodeChef and 1335 at Codeforces).
"""
import sys
from bisect import bisect_left as bl, bisect_right as br, bisect #Binary Search altern... | output | 1 | 16,069 | 9 | 32,139 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Today, Yasser and Adel are at the shop buying cupcakes. There are n cupcake types, arranged from 1 to n on the shelf, and there are infinitely many of each type. The tastiness of a cupcake of type i is an integer a_i. There are both tasty an... | instruction | 0 | 16,070 | 9 | 32,140 |
Tags: dp, greedy, implementation
Correct Solution:
```
t = int(input())
while t:
t -= 1
n = int(input())
a = list(map(int, input().split()))
s1 = sum(a)
curr_sum = 0
flag = 0
maxi = float("-inf")
pos = 0
for i, x in enumerate(a):
curr_sum += x
if curr_sum >= s1 and no... | output | 1 | 16,070 | 9 | 32,141 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Today, Yasser and Adel are at the shop buying cupcakes. There are n cupcake types, arranged from 1 to n on the shelf, and there are infinitely many of each type. The tastiness of a cupcake of type i is an integer a_i. There are both tasty an... | instruction | 0 | 16,071 | 9 | 32,142 |
Tags: dp, greedy, implementation
Correct Solution:
```
tests=int(input())
n=[]
numbers=[]
for i in range(0, tests):
n.append(int(input()))
numbers.append(list(map(int, input().split())))
for tastes in numbers:
flag = 0
sum=0
for i in tastes:
sum+=i
partial_sum=0
for i in tastes:
... | output | 1 | 16,071 | 9 | 32,143 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Today, Yasser and Adel are at the shop buying cupcakes. There are n cupcake types, arranged from 1 to n on the shelf, and there are infinitely many of each type. The tastiness of a cupcake of type i is an integer a_i. There are both tasty an... | instruction | 0 | 16,072 | 9 | 32,144 |
Tags: dp, greedy, implementation
Correct Solution:
```
def maxSubArraySum(a,size,initial):
max_so_far =a[initial]
curr_max = a[initial]
for i in range(initial+1,size):
curr_max = max(a[i], curr_max + a[i])
max_so_far = max(max_so_far,curr_max)
return max_so... | output | 1 | 16,072 | 9 | 32,145 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Today, Yasser and Adel are at the shop buying cupcakes. There are n cupcake types, arranged from 1 to n on the shelf, and there are infinitely many of each type. The tastiness of a cupcake of type i is an integer a_i. There are both tasty an... | instruction | 0 | 16,073 | 9 | 32,146 |
Tags: dp, greedy, implementation
Correct Solution:
```
def maxSubArraySum(a,size):
max_so_far = -1000000009
max_ending_here = 0
for i in range(0, size-1):
max_ending_here = max_ending_here + a[i]
if (max_so_far < max_ending_here):
max_so_far = max_ending_here
if max_ending_here < 0:
max_ending... | output | 1 | 16,073 | 9 | 32,147 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Today, Yasser and Adel are at the shop buying cupcakes. There are n cupcake types, arranged from 1 to n on the shelf, and there are infinitely many of each type. The tastiness of a cupcake of ty... | instruction | 0 | 16,074 | 9 | 32,148 |
Yes | output | 1 | 16,074 | 9 | 32,149 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Today, Yasser and Adel are at the shop buying cupcakes. There are n cupcake types, arranged from 1 to n on the shelf, and there are infinitely many of each type. The tastiness of a cupcake of ty... | instruction | 0 | 16,075 | 9 | 32,150 |
Yes | output | 1 | 16,075 | 9 | 32,151 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Today, Yasser and Adel are at the shop buying cupcakes. There are n cupcake types, arranged from 1 to n on the shelf, and there are infinitely many of each type. The tastiness of a cupcake of ty... | instruction | 0 | 16,076 | 9 | 32,152 |
Yes | output | 1 | 16,076 | 9 | 32,153 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Today, Yasser and Adel are at the shop buying cupcakes. There are n cupcake types, arranged from 1 to n on the shelf, and there are infinitely many of each type. The tastiness of a cupcake of ty... | instruction | 0 | 16,077 | 9 | 32,154 |
Yes | output | 1 | 16,077 | 9 | 32,155 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Today, Yasser and Adel are at the shop buying cupcakes. There are n cupcake types, arranged from 1 to n on the shelf, and there are infinitely many of each type. The tastiness of a cupcake of ty... | instruction | 0 | 16,078 | 9 | 32,156 |
No | output | 1 | 16,078 | 9 | 32,157 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Today, Yasser and Adel are at the shop buying cupcakes. There are n cupcake types, arranged from 1 to n on the shelf, and there are infinitely many of each type. The tastiness of a cupcake of ty... | instruction | 0 | 16,079 | 9 | 32,158 |
No | output | 1 | 16,079 | 9 | 32,159 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Today, Yasser and Adel are at the shop buying cupcakes. There are n cupcake types, arranged from 1 to n on the shelf, and there are infinitely many of each type. The tastiness of a cupcake of ty... | instruction | 0 | 16,080 | 9 | 32,160 |
No | output | 1 | 16,080 | 9 | 32,161 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Today, Yasser and Adel are at the shop buying cupcakes. There are n cupcake types, arranged from 1 to n on the shelf, and there are infinitely many of each type. The tastiness of a cupcake of ty... | instruction | 0 | 16,081 | 9 | 32,162 |
No | output | 1 | 16,081 | 9 | 32,163 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Phoenix is picking berries in his backyard. There are n shrubs, and each shrub has a_i red berries and b_i blue berries.
Each basket can contain k berries. But, Phoenix has decided that each basket may only contain berries from the same shr... | instruction | 0 | 16,114 | 9 | 32,228 |
Tags: brute force, dp, greedy, math
Correct Solution:
```
import sys
from array import array # noqa: F401
import typing as Tp # noqa: F401
def input():
return sys.stdin.buffer.readline().decode('utf-8')
def output(*args):
sys.stdout.buffer.write(
('\n'.join(map(str, args)) + '\n').encode('utf-8')
... | output | 1 | 16,114 | 9 | 32,229 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Phoenix is picking berries in his backyard. There are n shrubs, and each shrub has a_i red berries and b_i blue berries.
Each basket can contain k berries. But, Phoenix has decided that each basket may only contain berries from the same shr... | instruction | 0 | 16,115 | 9 | 32,230 |
Tags: brute force, dp, greedy, math
Correct Solution:
```
import os
import sys
from io import BytesIO, IOBase
# region fastio
BUFSIZE = 8192
class FastIO(IOBase):
newlines = 0
def __init__(self, file):
self._fd = file.fileno()
self.buffer = BytesIO()
self.writable = "x" in file.mode o... | output | 1 | 16,115 | 9 | 32,231 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Phoenix is picking berries in his backyard. There are n shrubs, and each shrub has a_i red berries and b_i blue berries.
Each basket can contain k berries. But, Phoenix has decided that each basket may only contain berries from the same shr... | instruction | 0 | 16,116 | 9 | 32,232 |
Tags: brute force, dp, greedy, math
Correct Solution:
```
import sys
readline = sys.stdin.readline
def merge(A, B):
res = A[:]
for i in range(len(A)):
if A[i]:
for j in range(len(B)):
if B[j]:
res[(i+j)%K] = 1
return res
N, K = map(int, readline().s... | output | 1 | 16,116 | 9 | 32,233 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Phoenix is picking berries in his backyard. There are n shrubs, and each shrub has a_i red berries and b_i blue berries.
Each basket can contain k berries. But, Phoenix has decided that each basket may only contain berries from the same shr... | instruction | 0 | 16,117 | 9 | 32,234 |
Tags: brute force, dp, greedy, math
Correct Solution:
```
n,k=map(int,input().split())
a=[0]*n
b=[0]*n
for i in range(n):
a[i],b[i]=map(int,input().split())
base=(sum(a)//k)+(sum(b)//k)
A=sum(a)%k
B=sum(b)%k
data=[False for i in range(k)]
for i in range(n):
ndata=[data[j] for j in range(k)]
for j in range... | output | 1 | 16,117 | 9 | 32,235 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Phoenix is picking berries in his backyard. There are n shrubs, and each shrub has a_i red berries and b_i blue berries.
Each basket can contain k berries. But, Phoenix has decided that each basket may only contain berries from the same shr... | instruction | 0 | 16,118 | 9 | 32,236 |
Tags: brute force, dp, greedy, math
Correct Solution:
```
import itertools as it
n, k = map(int, input().split())
bushes = [tuple(map(int, input().split())) for i in range(n)]
red = sum(bush[0] for bush in bushes)
blue = sum(bush[1] for bush in bushes)
r0 = red % k
r1 = blue % k
max_ = (red + blue) // k
if (r0 + r... | output | 1 | 16,118 | 9 | 32,237 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Phoenix is picking berries in his backyard. There are n shrubs, and each shrub has a_i red berries and b_i blue berries.
Each basket can contain k berries. But, Phoenix has decided that each basket may only contain berries from the same shr... | instruction | 0 | 16,119 | 9 | 32,238 |
Tags: brute force, dp, greedy, math
Correct Solution:
```
#!/usr/bin/env python3
from collections import defaultdict,deque
from heapq import heappush, heappop
from bisect import bisect_left, bisect_right
import sys, random, itertools, math
sys.setrecursionlimit(10**5)
input = sys.stdin.readline
sqrt = math.sqrt
def LI(... | output | 1 | 16,119 | 9 | 32,239 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Phoenix is picking berries in his backyard. There are n shrubs, and each shrub has a_i red berries and b_i blue berries.
Each basket can contain k berries. But, Phoenix has decided that each basket may only contain berries from the same shr... | instruction | 0 | 16,120 | 9 | 32,240 |
Tags: brute force, dp, greedy, math
Correct Solution:
```
import sys
sys.setrecursionlimit(10 ** 6)
int1 = lambda x: int(x) - 1
p2D = lambda x: print(*x, sep="\n")
def II(): return int(sys.stdin.readline())
def MI(): return map(int, sys.stdin.readline().split())
def LI(): return list(map(int, sys.stdin.readline().spli... | output | 1 | 16,120 | 9 | 32,241 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Phoenix is picking berries in his backyard. There are n shrubs, and each shrub has a_i red berries and b_i blue berries.
Each basket can contain k berries. But, Phoenix has decided that each basket may only contain berries from the same shr... | instruction | 0 | 16,121 | 9 | 32,242 |
Tags: brute force, dp, greedy, math
Correct Solution:
```
import sys
input = sys.stdin.readline
n, k = map(int, input().split())
a = [None]
b = [None]
for _ in range(n):
x, y = map(int, input().split())
a.append(x)
b.append(y)
dp = [[None] * 505 for _ in range(505)]
totA = sum(a[1:])
totB = sum(b[1:])
dp[... | output | 1 | 16,121 | 9 | 32,243 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Phoenix is picking berries in his backyard. There are n shrubs, and each shrub has a_i red berries and b_i blue berries.
Each basket can contain k berries. But, Phoenix has decided that each ba... | instruction | 0 | 16,122 | 9 | 32,244 |
Yes | output | 1 | 16,122 | 9 | 32,245 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Phoenix is picking berries in his backyard. There are n shrubs, and each shrub has a_i red berries and b_i blue berries.
Each basket can contain k berries. But, Phoenix has decided that each ba... | instruction | 0 | 16,123 | 9 | 32,246 |
Yes | output | 1 | 16,123 | 9 | 32,247 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Phoenix is picking berries in his backyard. There are n shrubs, and each shrub has a_i red berries and b_i blue berries.
Each basket can contain k berries. But, Phoenix has decided that each ba... | instruction | 0 | 16,124 | 9 | 32,248 |
Yes | output | 1 | 16,124 | 9 | 32,249 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Phoenix is picking berries in his backyard. There are n shrubs, and each shrub has a_i red berries and b_i blue berries.
Each basket can contain k berries. But, Phoenix has decided that each ba... | instruction | 0 | 16,125 | 9 | 32,250 |
Yes | output | 1 | 16,125 | 9 | 32,251 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Phoenix is picking berries in his backyard. There are n shrubs, and each shrub has a_i red berries and b_i blue berries.
Each basket can contain k berries. But, Phoenix has decided that each ba... | instruction | 0 | 16,126 | 9 | 32,252 |
No | output | 1 | 16,126 | 9 | 32,253 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Phoenix is picking berries in his backyard. There are n shrubs, and each shrub has a_i red berries and b_i blue berries.
Each basket can contain k berries. But, Phoenix has decided that each ba... | instruction | 0 | 16,127 | 9 | 32,254 |
No | output | 1 | 16,127 | 9 | 32,255 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Phoenix is picking berries in his backyard. There are n shrubs, and each shrub has a_i red berries and b_i blue berries.
Each basket can contain k berries. But, Phoenix has decided that each ba... | instruction | 0 | 16,128 | 9 | 32,256 |
No | output | 1 | 16,128 | 9 | 32,257 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Phoenix is picking berries in his backyard. There are n shrubs, and each shrub has a_i red berries and b_i blue berries.
Each basket can contain k berries. But, Phoenix has decided that each ba... | instruction | 0 | 16,129 | 9 | 32,258 |
No | output | 1 | 16,129 | 9 | 32,259 |
Provide tags and a correct Python 3 solution for this coding contest problem.
There is an old tradition of keeping 4 boxes of candies in the house in Cyberland. The numbers of candies are special if their arithmetic mean, their median and their range are all equal. By definition, for a set {x1, x2, x3, x4} (x1 ≤ x2 ≤ ... | instruction | 0 | 16,346 | 9 | 32,692 |
Tags: brute force, constructive algorithms, math
Correct Solution:
```
__author__ = 'zhan'
candy = [0]
n = int(input())
for i in range(n):
candy.append(int(input()))
if n == 0:
print("YES\n1\n1\n3\n3")
elif n == 4:
candy.sort()
if candy[4] == 3*candy[1] and (candy[2]+candy[3]) == 4*candy[1]:
p... | output | 1 | 16,346 | 9 | 32,693 |
Provide tags and a correct Python 3 solution for this coding contest problem.
There is an old tradition of keeping 4 boxes of candies in the house in Cyberland. The numbers of candies are special if their arithmetic mean, their median and their range are all equal. By definition, for a set {x1, x2, x3, x4} (x1 ≤ x2 ≤ ... | instruction | 0 | 16,347 | 9 | 32,694 |
Tags: brute force, constructive algorithms, math
Correct Solution:
```
def check(a, b, c, d):
bad = [a, b, c, d]
bad.sort()
x, y, z, w = bad[0], bad[1], bad[2], bad[3]
if w == 3*x and x+w==y+z:
return True
return False
a = int(input())
if a == 0:
print("YES")
print("1")
print("1"... | output | 1 | 16,347 | 9 | 32,695 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.