message stringlengths 2 28.7k | message_type stringclasses 2
values | message_id int64 0 1 | conversation_id int64 21 109k | cluster float64 7 7 | __index_level_0__ int64 42 217k |
|---|---|---|---|---|---|
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Taro, who aims to become a web designer, is currently training. My senior at the office tells me that the background color of this page is # ffe085, which is a color number peculiar to web desig... | instruction | 0 | 23,738 | 7 | 47,476 |
No | output | 1 | 23,738 | 7 | 47,477 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Taro, who aims to become a web designer, is currently training. My senior at the office tells me that the background color of this page is # ffe085, which is a color number peculiar to web desig... | instruction | 0 | 23,739 | 7 | 47,478 |
No | output | 1 | 23,739 | 7 | 47,479 |
Provide a correct Python 3 solution for this coding contest problem.
Do you know the famous series of children's books named "Where's Wally"? Each of the books contains a variety of pictures of hundreds of people. Readers are challenged to find a person called Wally in the crowd.
We can consider "Where's Wally" as a ... | instruction | 0 | 24,693 | 7 | 49,386 |
"Correct Solution:
```
import string
import sys
S = string.ascii_uppercase + string.ascii_lowercase + string.digits + "+/"
mod = 10**9 + 9; p = 13; q = 19
L = 1000
p_table = [1]*(L+1); q_table = [1]*(L+1)
for i in range(L):
p_table[i+1] = p_table[i] * p % mod
q_table[i+1] = q_table[i] * q % mod
readline = sys... | output | 1 | 24,693 | 7 | 49,387 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
One evening Rainbow Dash and Fluttershy have come up with a game. Since the ponies are friends, they have decided not to compete in the game but to pursue a common goal.
The game starts on a s... | instruction | 0 | 24,961 | 7 | 49,922 |
Yes | output | 1 | 24,961 | 7 | 49,923 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
One evening Rainbow Dash and Fluttershy have come up with a game. Since the ponies are friends, they have decided not to compete in the game but to pursue a common goal.
The game starts on a s... | instruction | 0 | 24,966 | 7 | 49,932 |
No | output | 1 | 24,966 | 7 | 49,933 |
Provide a correct Python 3 solution for this coding contest problem.
Mary Thomas has a number of sheets of squared paper. Some of squares are painted either in black or some colorful color (such as red and blue) on the front side. Cutting off the unpainted part, she will have eight opened-up unit cubes. A unit cube he... | instruction | 0 | 25,549 | 7 | 51,098 |
"Correct Solution:
```
from collections import deque
from string import ascii_lowercase, ascii_uppercase, digits
import sys
readline = sys.stdin.readline
write = sys.stdout.write
D = [
(1, 5, 2, 3, 0, 4), # 'U'
(3, 1, 0, 5, 4, 2), # 'R'
(4, 0, 2, 3, 5, 1), # 'D'
(2, 1, 5, 0, 4, 3), # 'L'
]
p_dice = (0,... | output | 1 | 25,549 | 7 | 51,099 |
Provide tags and a correct Python 3 solution for this coding contest problem.
One day Alice was cleaning up her basement when she noticed something very curious: an infinite set of wooden pieces! Each piece was made of five square tiles, with four tiles adjacent to the fifth center tile:
<image> By the pieces lay a ... | instruction | 0 | 25,629 | 7 | 51,258 |
Tags: greedy, implementation
Correct Solution:
```
n = int(input())
b = []
for i in range(n):
b.append([c == '.' for c in input()])
pos = [(0,0),(1,0),(-1,0),(0,1),(0,-1)]
for i in range(1,n - 1):
for j in range(1, n - 1):
if 5 == sum(b[i+x][j+y] for x,y in pos):
for x,y in pos:
... | output | 1 | 25,629 | 7 | 51,259 |
Provide tags and a correct Python 3 solution for this coding contest problem.
One day Alice was cleaning up her basement when she noticed something very curious: an infinite set of wooden pieces! Each piece was made of five square tiles, with four tiles adjacent to the fifth center tile:
<image> By the pieces lay a ... | instruction | 0 | 25,630 | 7 | 51,260 |
Tags: greedy, implementation
Correct Solution:
```
n = int(input())
matrix = []
for i in range (n):
matrix.append(list(input()))
def check():
if matrix[0][0] == '.' or matrix[0][n - 1] == '.' or matrix[n - 1][0] == '.' or matrix[n - 1][n - 1] == '.':
return 'NO'
else:
for i in range(n):
... | output | 1 | 25,630 | 7 | 51,261 |
Provide tags and a correct Python 3 solution for this coding contest problem.
One day Alice was cleaning up her basement when she noticed something very curious: an infinite set of wooden pieces! Each piece was made of five square tiles, with four tiles adjacent to the fifth center tile:
<image> By the pieces lay a ... | instruction | 0 | 25,631 | 7 | 51,262 |
Tags: greedy, implementation
Correct Solution:
```
import sys
px = [-1, 0, 0, 1]
py = [0, -1, 1, 0]
def check(x, y):
global map_, n
checker = 0
for i in range(4):
nx = x + px[i]
ny = y + py[i]
if (0 <= ny and ny <= n-1) and (0<= nx and nx <= n-1):
if map_[ny]... | output | 1 | 25,631 | 7 | 51,263 |
Provide tags and a correct Python 3 solution for this coding contest problem.
One day Alice was cleaning up her basement when she noticed something very curious: an infinite set of wooden pieces! Each piece was made of five square tiles, with four tiles adjacent to the fifth center tile:
<image> By the pieces lay a ... | instruction | 0 | 25,632 | 7 | 51,264 |
Tags: greedy, implementation
Correct Solution:
```
FREE = '.'
NOT_FREE = '#'
class Grid(object):
def __init__(self, n):
self.n = n
self.cells = [n * [0] for _ in range(n)]
def solve(self):
n = self.n
for i in range(n):
for j in range(n):
if self.c... | output | 1 | 25,632 | 7 | 51,265 |
Provide tags and a correct Python 3 solution for this coding contest problem.
One day Alice was cleaning up her basement when she noticed something very curious: an infinite set of wooden pieces! Each piece was made of five square tiles, with four tiles adjacent to the fifth center tile:
<image> By the pieces lay a ... | instruction | 0 | 25,633 | 7 | 51,266 |
Tags: greedy, implementation
Correct Solution:
```
import sys
from collections import defaultdict
strInp = lambda : input().strip().split()
intInp = lambda : list(map(int,strInp()))
n = int(input())
floor = []
for i in range(n):
floor.append(list(input()))
for i in range(1,n-1):
for j in range(1,n-1):
... | output | 1 | 25,633 | 7 | 51,267 |
Provide tags and a correct Python 3 solution for this coding contest problem.
One day Alice was cleaning up her basement when she noticed something very curious: an infinite set of wooden pieces! Each piece was made of five square tiles, with four tiles adjacent to the fifth center tile:
<image> By the pieces lay a ... | instruction | 0 | 25,634 | 7 | 51,268 |
Tags: greedy, implementation
Correct Solution:
```
import sys
n=int(input())
a=[]
flag=False
for i in range(n):
a.append(input())
for i in range(n):
if(flag):
break
for j in range(n):
if(a[i][j]=='.'):
if(j<1 or j>=(n-1) or i>=(n-2)):
print('NO')
flag=True
break
else:
a[i]=a[i][:j]+'#'+a[i]... | output | 1 | 25,634 | 7 | 51,269 |
Provide tags and a correct Python 3 solution for this coding contest problem.
One day Alice was cleaning up her basement when she noticed something very curious: an infinite set of wooden pieces! Each piece was made of five square tiles, with four tiles adjacent to the fifth center tile:
<image> By the pieces lay a ... | instruction | 0 | 25,635 | 7 | 51,270 |
Tags: greedy, implementation
Correct Solution:
```
def cros(x,y):
global mas
global n
hod = [(x-1,y+1),(x,y+2),(x,y+1),(x+1,y+1)]
for i in hod:
if i[0] < 0 or i[0] >= n or i[1] < 0 or i[1] >= n:
return False
if mas[i[0]][i[1]] == True:
return False
else:
... | output | 1 | 25,635 | 7 | 51,271 |
Provide tags and a correct Python 3 solution for this coding contest problem.
One day Alice was cleaning up her basement when she noticed something very curious: an infinite set of wooden pieces! Each piece was made of five square tiles, with four tiles adjacent to the fifth center tile:
<image> By the pieces lay a ... | instruction | 0 | 25,636 | 7 | 51,272 |
Tags: greedy, implementation
Correct Solution:
```
n = int(input())
a = []
for i in range(n):
tmp = input()
b = []
for j in range(len(tmp)):
b.append(tmp[j])
a.append(b)
if (a[0][0] == '.' or a[0][n-1] == '.' or a[n-1][0] == '.' or a[n-1][n-1]=='.'):
print("NO")
exit()
i = 1
j = 1
for ... | output | 1 | 25,636 | 7 | 51,273 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
One day Alice was cleaning up her basement when she noticed something very curious: an infinite set of wooden pieces! Each piece was made of five square tiles, with four tiles adjacent to the fi... | instruction | 0 | 25,637 | 7 | 51,274 |
Yes | output | 1 | 25,637 | 7 | 51,275 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
One day Alice was cleaning up her basement when she noticed something very curious: an infinite set of wooden pieces! Each piece was made of five square tiles, with four tiles adjacent to the fi... | instruction | 0 | 25,638 | 7 | 51,276 |
Yes | output | 1 | 25,638 | 7 | 51,277 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
One day Alice was cleaning up her basement when she noticed something very curious: an infinite set of wooden pieces! Each piece was made of five square tiles, with four tiles adjacent to the fi... | instruction | 0 | 25,639 | 7 | 51,278 |
Yes | output | 1 | 25,639 | 7 | 51,279 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
One day Alice was cleaning up her basement when she noticed something very curious: an infinite set of wooden pieces! Each piece was made of five square tiles, with four tiles adjacent to the fi... | instruction | 0 | 25,640 | 7 | 51,280 |
Yes | output | 1 | 25,640 | 7 | 51,281 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
One day Alice was cleaning up her basement when she noticed something very curious: an infinite set of wooden pieces! Each piece was made of five square tiles, with four tiles adjacent to the fi... | instruction | 0 | 25,641 | 7 | 51,282 |
No | output | 1 | 25,641 | 7 | 51,283 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
One day Alice was cleaning up her basement when she noticed something very curious: an infinite set of wooden pieces! Each piece was made of five square tiles, with four tiles adjacent to the fi... | instruction | 0 | 25,642 | 7 | 51,284 |
No | output | 1 | 25,642 | 7 | 51,285 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
One day Alice was cleaning up her basement when she noticed something very curious: an infinite set of wooden pieces! Each piece was made of five square tiles, with four tiles adjacent to the fi... | instruction | 0 | 25,643 | 7 | 51,286 |
No | output | 1 | 25,643 | 7 | 51,287 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
One day Alice was cleaning up her basement when she noticed something very curious: an infinite set of wooden pieces! Each piece was made of five square tiles, with four tiles adjacent to the fi... | instruction | 0 | 25,644 | 7 | 51,288 |
No | output | 1 | 25,644 | 7 | 51,289 |
Provide tags and a correct Python 3 solution for this coding contest problem.
You are given a sequence of n digits d_1d_2 ... d_{n}. You need to paint all the digits in two colors so that:
* each digit is painted either in the color 1 or in the color 2;
* if you write in a row from left to right all the digits p... | instruction | 0 | 25,669 | 7 | 51,338 |
Tags: constructive algorithms, greedy, implementation
Correct Solution:
```
import sys,math
t=int(sys.stdin.readline())
for _ in range(t):
n=int(sys.stdin.readline())
s=list(input())
freq=[0]*10
for i in range(n):
freq[int(s[i])]+=1
ans=""
f1=[0]*10
quit=0
f2=[0]*10
for i i... | output | 1 | 25,669 | 7 | 51,339 |
Provide tags and a correct Python 3 solution for this coding contest problem.
You are given a sequence of n digits d_1d_2 ... d_{n}. You need to paint all the digits in two colors so that:
* each digit is painted either in the color 1 or in the color 2;
* if you write in a row from left to right all the digits p... | instruction | 0 | 25,670 | 7 | 51,340 |
Tags: constructive algorithms, greedy, implementation
Correct Solution:
```
import math
for _ in range(int(input())):
n = int(input())
s = input()
b = [0] * 11
a = [0] * (n + 10)
j = 0
flag = True
for i in range(n):
b[int(s[i])] += 1
for i in range(n):
while(b[j] == 0) an... | output | 1 | 25,670 | 7 | 51,341 |
Provide tags and a correct Python 3 solution for this coding contest problem.
You are given a sequence of n digits d_1d_2 ... d_{n}. You need to paint all the digits in two colors so that:
* each digit is painted either in the color 1 or in the color 2;
* if you write in a row from left to right all the digits p... | instruction | 0 | 25,671 | 7 | 51,342 |
Tags: constructive algorithms, greedy, implementation
Correct Solution:
```
#------------------------------warmup----------------------------
import os
import sys
from io import BytesIO, IOBase
BUFSIZE = 8192
class FastIO(IOBase):
newlines = 0
def __init__(self, file):
self._fd = file.fileno()
... | output | 1 | 25,671 | 7 | 51,343 |
Provide tags and a correct Python 3 solution for this coding contest problem.
You are given a sequence of n digits d_1d_2 ... d_{n}. You need to paint all the digits in two colors so that:
* each digit is painted either in the color 1 or in the color 2;
* if you write in a row from left to right all the digits p... | instruction | 0 | 25,672 | 7 | 51,344 |
Tags: constructive algorithms, greedy, implementation
Correct Solution:
```
''' CODED WITH LOVE BY SATYAM KUMAR '''
from sys import stdin, stdout
import heapq
import cProfile, math
from collections import Counter, defaultdict, deque
from bisect import bisect_left, bisect, bisect_right
import itertools
from copy import... | output | 1 | 25,672 | 7 | 51,345 |
Provide tags and a correct Python 3 solution for this coding contest problem.
You are given a sequence of n digits d_1d_2 ... d_{n}. You need to paint all the digits in two colors so that:
* each digit is painted either in the color 1 or in the color 2;
* if you write in a row from left to right all the digits p... | instruction | 0 | 25,673 | 7 | 51,346 |
Tags: constructive algorithms, greedy, implementation
Correct Solution:
```
"""
NTC here
"""
from sys import setcheckinterval, stdin, setrecursionlimit
setcheckinterval(1000)
setrecursionlimit(10**7)
# print("Case #{}: {} {}".format(i, n + m, n * m))
def iin(): return int(stdin.readline())
def lin(): return l... | output | 1 | 25,673 | 7 | 51,347 |
Provide tags and a correct Python 3 solution for this coding contest problem.
You are given a sequence of n digits d_1d_2 ... d_{n}. You need to paint all the digits in two colors so that:
* each digit is painted either in the color 1 or in the color 2;
* if you write in a row from left to right all the digits p... | instruction | 0 | 25,674 | 7 | 51,348 |
Tags: constructive algorithms, greedy, implementation
Correct Solution:
```
t=int(input())
while(t>0):
n=int(input())
lst=list(map(int,input().strip()))
lst2=lst.copy()
lst2.sort()
a=[]
b=[]
c=0
#print(lst)
ind_l=[2]*n
ind=0
for i in lst:
if i==lst2[c]:
a.... | output | 1 | 25,674 | 7 | 51,349 |
Provide tags and a correct Python 3 solution for this coding contest problem.
You are given a sequence of n digits d_1d_2 ... d_{n}. You need to paint all the digits in two colors so that:
* each digit is painted either in the color 1 or in the color 2;
* if you write in a row from left to right all the digits p... | instruction | 0 | 25,675 | 7 | 51,350 |
Tags: constructive algorithms, greedy, implementation
Correct Solution:
```
import sys
input=sys.stdin.readline
def solve(n,D):
E=sorted(D)
Ans=[0]*n
idx=0
for i,d in enumerate(D):
if d==E[idx]:
idx+=1
Ans[i]=1
for i,d in enumerate(D):
if Ans[i]:
c... | output | 1 | 25,675 | 7 | 51,351 |
Provide tags and a correct Python 3 solution for this coding contest problem.
You are given a sequence of n digits d_1d_2 ... d_{n}. You need to paint all the digits in two colors so that:
* each digit is painted either in the color 1 or in the color 2;
* if you write in a row from left to right all the digits p... | instruction | 0 | 25,676 | 7 | 51,352 |
Tags: constructive algorithms, greedy, implementation
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 ... | output | 1 | 25,676 | 7 | 51,353 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
You are given a sequence of n digits d_1d_2 ... d_{n}. You need to paint all the digits in two colors so that:
* each digit is painted either in the color 1 or in the color 2;
* if you wri... | instruction | 0 | 25,677 | 7 | 51,354 |
Yes | output | 1 | 25,677 | 7 | 51,355 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
You are given a sequence of n digits d_1d_2 ... d_{n}. You need to paint all the digits in two colors so that:
* each digit is painted either in the color 1 or in the color 2;
* if you wri... | instruction | 0 | 25,678 | 7 | 51,356 |
Yes | output | 1 | 25,678 | 7 | 51,357 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
You are given a sequence of n digits d_1d_2 ... d_{n}. You need to paint all the digits in two colors so that:
* each digit is painted either in the color 1 or in the color 2;
* if you wri... | instruction | 0 | 25,679 | 7 | 51,358 |
Yes | output | 1 | 25,679 | 7 | 51,359 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
You are given a sequence of n digits d_1d_2 ... d_{n}. You need to paint all the digits in two colors so that:
* each digit is painted either in the color 1 or in the color 2;
* if you wri... | instruction | 0 | 25,680 | 7 | 51,360 |
Yes | output | 1 | 25,680 | 7 | 51,361 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
You are given a sequence of n digits d_1d_2 ... d_{n}. You need to paint all the digits in two colors so that:
* each digit is painted either in the color 1 or in the color 2;
* if you wri... | instruction | 0 | 25,681 | 7 | 51,362 |
No | output | 1 | 25,681 | 7 | 51,363 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
You are given a sequence of n digits d_1d_2 ... d_{n}. You need to paint all the digits in two colors so that:
* each digit is painted either in the color 1 or in the color 2;
* if you wri... | instruction | 0 | 25,682 | 7 | 51,364 |
No | output | 1 | 25,682 | 7 | 51,365 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
You are given a sequence of n digits d_1d_2 ... d_{n}. You need to paint all the digits in two colors so that:
* each digit is painted either in the color 1 or in the color 2;
* if you wri... | instruction | 0 | 25,683 | 7 | 51,366 |
No | output | 1 | 25,683 | 7 | 51,367 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
You are given a sequence of n digits d_1d_2 ... d_{n}. You need to paint all the digits in two colors so that:
* each digit is painted either in the color 1 or in the color 2;
* if you wri... | instruction | 0 | 25,684 | 7 | 51,368 |
No | output | 1 | 25,684 | 7 | 51,369 |
Provide tags and a correct Python 3 solution for this coding contest problem.
You are given a correct solution of the sudoku puzzle. If you don't know what is the sudoku, you can read about it [here](http://tiny.cc/636xmz).
The picture showing the correct sudoku solution:
<image>
Blocks are bordered with bold black... | instruction | 0 | 25,730 | 7 | 51,460 |
Tags: constructive algorithms, implementation
Correct Solution:
```
def main():
test = int(input())
for t in range(test):
matrix = []
for i in range(9):
l = [int(i) for i in input()]
matrix.append(l)
matrix[0][0] = matrix[0][1]
matrix[1][3] = matrix[1][... | output | 1 | 25,730 | 7 | 51,461 |
Provide tags and a correct Python 3 solution for this coding contest problem.
You have an n × m rectangle table, its cells are not initially painted. Your task is to paint all cells of the table. The resulting picture should be a tiling of the table with squares. More formally:
* each cell must be painted some colo... | instruction | 0 | 26,879 | 7 | 53,758 |
Tags: constructive algorithms, greedy
Correct Solution:
```
import sys
input = sys.stdin.readline
n,m=map(int,input().split())
ANS=[[-1]*m for i in range(n)]
for i in range(n):
for j in range(m):
if ANS[i][j]==-1:
for koma in ["A","B","C","D","E","F"]:
for k,l in [(i-1,j),(i,j... | output | 1 | 26,879 | 7 | 53,759 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
You have an n × m rectangle table, its cells are not initially painted. Your task is to paint all cells of the table. The resulting picture should be a tiling of the table with squares. More for... | instruction | 0 | 26,880 | 7 | 53,760 |
No | output | 1 | 26,880 | 7 | 53,761 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
You have an n × m rectangle table, its cells are not initially painted. Your task is to paint all cells of the table. The resulting picture should be a tiling of the table with squares. More for... | instruction | 0 | 26,881 | 7 | 53,762 |
No | output | 1 | 26,881 | 7 | 53,763 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
You have an n × m rectangle table, its cells are not initially painted. Your task is to paint all cells of the table. The resulting picture should be a tiling of the table with squares. More for... | instruction | 0 | 26,882 | 7 | 53,764 |
No | output | 1 | 26,882 | 7 | 53,765 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
You have an n × m rectangle table, its cells are not initially painted. Your task is to paint all cells of the table. The resulting picture should be a tiling of the table with squares. More for... | instruction | 0 | 26,883 | 7 | 53,766 |
No | output | 1 | 26,883 | 7 | 53,767 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Bear Limak has n colored balls, arranged in one long row. Balls are numbered 1 through n, from left to right. There are n possible colors, also numbered 1 through n. The i-th ball has color ti.
For a fixed interval (set of consecutive eleme... | instruction | 0 | 26,985 | 7 | 53,970 |
Tags: implementation
Correct Solution:
```
def main():
n, tt = int(input()), []
res = [0] * n
for t in map(int, input().split()):
tt.append(-t)
cnt, mx, best_t = [0] * n, 0, n
for t in reversed(tt):
cnt[t] += 1
if (mx, best_t) < (cnt[t], t):
mx... | output | 1 | 26,985 | 7 | 53,971 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Bear Limak has n colored balls, arranged in one long row. Balls are numbered 1 through n, from left to right. There are n possible colors, also numbered 1 through n. The i-th ball has color ti.
For a fixed interval (set of consecutive eleme... | instruction | 0 | 26,986 | 7 | 53,972 |
Tags: implementation
Correct Solution:
```
class CodeforcesTask643ASolution:
def __init__(self):
self.result = ''
self.ball_count = 0
self.colors = []
def read_input(self):
self.ball_count = int(input())
self.colors = [int(x) for x in input().split(" ")]
def process... | output | 1 | 26,986 | 7 | 53,973 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Bear Limak has n colored balls, arranged in one long row. Balls are numbered 1 through n, from left to right. There are n possible colors, also numbered 1 through n. The i-th ball has color ti.
For a fixed interval (set of consecutive eleme... | instruction | 0 | 26,987 | 7 | 53,974 |
Tags: implementation
Correct Solution:
```
n = int(input())
t = [int(v) for v in input().split()]
ans = [0 for _ in range(n)]
for i in range(n):
num = [0 for _ in range(n+1)]
most_num = 0
for j in range(i, n):
num[t[j]] += 1
if num[t[j]] > num[most_num] or (num[t[j]] == num[most_num] and t[j] < most_num):
m... | output | 1 | 26,987 | 7 | 53,975 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Bear Limak has n colored balls, arranged in one long row. Balls are numbered 1 through n, from left to right. There are n possible colors, also numbered 1 through n. The i-th ball has color ti.
For a fixed interval (set of consecutive eleme... | instruction | 0 | 26,988 | 7 | 53,976 |
Tags: implementation
Correct Solution:
```
def solve(n, t):
sol = [0 for _ in range(n)]
for i in range(n):
cts = [0 for _ in range(n+1)]
best_c = 0
for j in range(i, n):
cts[t[j]] += 1
if cts[t[j]] > cts[best_c] or (cts[t[j]] == cts[best_c] and t[j] < best_c):
best_c = t[j]
sol[best_c-1] += 1
ret... | output | 1 | 26,988 | 7 | 53,977 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Bear Limak has n colored balls, arranged in one long row. Balls are numbered 1 through n, from left to right. There are n possible colors, also numbered 1 through n. The i-th ball has color ti.
For a fixed interval (set of consecutive eleme... | instruction | 0 | 26,989 | 7 | 53,978 |
Tags: implementation
Correct Solution:
```
# n=int(input())
# n,k=map(int,input().split())
'''l=0
r=10**13
while l+1<r:
mid=(l+r)//2
val=(max(0,b_b*mid-b)*rb+max(0,b_s*mid-s)*rs+max(0,b_c*mid-b)*rc)
if val>money:
r=mid
if val<=money:
l=mid'''
# arr=list(map(int,input().split()))
# n=int(... | output | 1 | 26,989 | 7 | 53,979 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Bear Limak has n colored balls, arranged in one long row. Balls are numbered 1 through n, from left to right. There are n possible colors, also numbered 1 through n. The i-th ball has color ti.
For a fixed interval (set of consecutive eleme... | instruction | 0 | 26,990 | 7 | 53,980 |
Tags: implementation
Correct Solution:
```
N = int(5e3+3)
n = int(input())
res = [0] * N
cum = list([0] * N for _ in range(N))
a = list(map(int, input().split()))
for i in range(n):
c = [0] * N
for j in range(i, n):
c[a[j]] += 1
cum[i][j] = c[a[j]]
for i in range(n):
curr_max, curr_idx = 0, ... | output | 1 | 26,990 | 7 | 53,981 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.