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.
Dreamoon likes coloring cells very much.
There is a row of n cells. Initially, all cells are empty (don't contain any color). Cells are numbered from 1 to n.
You are given an integer m and m i... | instruction | 0 | 51,490 | 7 | 102,980 |
Yes | output | 1 | 51,490 | 7 | 102,981 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Dreamoon likes coloring cells very much.
There is a row of n cells. Initially, all cells are empty (don't contain any color). Cells are numbered from 1 to n.
You are given an integer m and m i... | instruction | 0 | 51,491 | 7 | 102,982 |
Yes | output | 1 | 51,491 | 7 | 102,983 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Dreamoon likes coloring cells very much.
There is a row of n cells. Initially, all cells are empty (don't contain any color). Cells are numbered from 1 to n.
You are given an integer m and m i... | instruction | 0 | 51,492 | 7 | 102,984 |
Yes | output | 1 | 51,492 | 7 | 102,985 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Dreamoon likes coloring cells very much.
There is a row of n cells. Initially, all cells are empty (don't contain any color). Cells are numbered from 1 to n.
You are given an integer m and m i... | instruction | 0 | 51,493 | 7 | 102,986 |
No | output | 1 | 51,493 | 7 | 102,987 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Dreamoon likes coloring cells very much.
There is a row of n cells. Initially, all cells are empty (don't contain any color). Cells are numbered from 1 to n.
You are given an integer m and m i... | instruction | 0 | 51,494 | 7 | 102,988 |
No | output | 1 | 51,494 | 7 | 102,989 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Dreamoon likes coloring cells very much.
There is a row of n cells. Initially, all cells are empty (don't contain any color). Cells are numbered from 1 to n.
You are given an integer m and m i... | instruction | 0 | 51,495 | 7 | 102,990 |
No | output | 1 | 51,495 | 7 | 102,991 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Dreamoon likes coloring cells very much.
There is a row of n cells. Initially, all cells are empty (don't contain any color). Cells are numbered from 1 to n.
You are given an integer m and m i... | instruction | 0 | 51,496 | 7 | 102,992 |
No | output | 1 | 51,496 | 7 | 102,993 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Vika has an infinite sheet of squared paper. Initially all squares are white. She introduced a two-dimensional coordinate system on this sheet and drew n black horizontal and vertical segments parallel to the coordinate axes. All segments ha... | instruction | 0 | 51,734 | 7 | 103,468 |
Tags: constructive algorithms, data structures, geometry, two pointers
Correct Solution:
```
from sys import stdin
from itertools import repeat
from collections import defaultdict
def main():
n = int(stdin.readline())
h = defaultdict(list)
w = defaultdict(list)
for i in range(n):
a, b, c, d = ma... | output | 1 | 51,734 | 7 | 103,469 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Vika has an infinite sheet of squared paper. Initially all squares are white. She introduced a two-dimensional coordinate system on this sheet and drew n black horizontal and vertical segments parallel to the coordinate axes. All segments ha... | instruction | 0 | 51,735 | 7 | 103,470 |
Tags: constructive algorithms, data structures, geometry, two pointers
Correct Solution:
```
from sys import stdin
from itertools import repeat
from collections import defaultdict
# input = raw_input
# range = xrange
def main():
n = int(stdin.readline())
h = defaultdict(list)
w = defaultdict(list)
for... | output | 1 | 51,735 | 7 | 103,471 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Mishka is decorating the Christmas tree. He has got three garlands, and all of them will be put on the tree. After that Mishka will switch these garlands on.
When a garland is switched on, it periodically changes its state — sometimes it is... | instruction | 0 | 51,858 | 7 | 103,716 |
Tags: brute force, constructive algorithms
Correct Solution:
```
inp = list(map(int, input().split()))
inp.sort()
string = "NO"
if(inp.count(1)>= 1 or inp.count(2)>=2 or inp.count(3)>=3):
string = "YES"
if(inp == [2,4,4]):
string = "YES"
print(string)
``` | output | 1 | 51,858 | 7 | 103,717 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Mishka is decorating the Christmas tree. He has got three garlands, and all of them will be put on the tree. After that Mishka will switch these garlands on.
When a garland is switched on, it periodically changes its state — sometimes it is... | instruction | 0 | 51,859 | 7 | 103,718 |
Tags: brute force, constructive algorithms
Correct Solution:
```
a, b, c = map(int, input().split())
v = [a, b, c]
v.sort()
if v[0] == 1 or v[0] ==2 and v[1] == 2 or v[0] == 2 and v[1] == 4 and v[2] == 4 or v[0] == 3 and v[1] == 3 and v[2] == 3:
print('YES')
else:
print('NO')
``` | output | 1 | 51,859 | 7 | 103,719 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Mishka is decorating the Christmas tree. He has got three garlands, and all of them will be put on the tree. After that Mishka will switch these garlands on.
When a garland is switched on, it periodically changes its state — sometimes it is... | instruction | 0 | 51,860 | 7 | 103,720 |
Tags: brute force, constructive algorithms
Correct Solution:
```
def possible(vals):
if 1 in vals:
return True
if vals.count(2) >= 2:
return True
if vals.count(3) == 3:
return True
if vals.count(2) == 1 and vals.count(4) == 2:
return True
return False
vals = lis... | output | 1 | 51,860 | 7 | 103,721 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Mishka is decorating the Christmas tree. He has got three garlands, and all of them will be put on the tree. After that Mishka will switch these garlands on.
When a garland is switched on, it periodically changes its state — sometimes it is... | instruction | 0 | 51,861 | 7 | 103,722 |
Tags: brute force, constructive algorithms
Correct Solution:
```
arr = list(map(int,input().split()))
if (1 in arr):
print("YES")
else:
if arr.count(2) >= 2:
print("YES")
else:
if(arr.count(3) == 3) :
print("YES")
else:
if (arr.count(4) == 2 and arr.count(2)... | output | 1 | 51,861 | 7 | 103,723 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Mishka is decorating the Christmas tree. He has got three garlands, and all of them will be put on the tree. After that Mishka will switch these garlands on.
When a garland is switched on, it periodically changes its state — sometimes it is... | instruction | 0 | 51,862 | 7 | 103,724 |
Tags: brute force, constructive algorithms
Correct Solution:
```
k1, k2, k3 = map(int, input().split())
if k1 == 1 or k2 == 1 or k3 == 1 or k1 == 2 and k2 == 2 or k2 == 2 and k3 == 2 or k1 == 2 and k3 == 2 or k1 == 3 and k2 == 3 and k3 == 3:
print('YES')
elif k1 == 2 and k2 == 4 and k3 == 4 or k1 == 4 and k2 == 2 a... | output | 1 | 51,862 | 7 | 103,725 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Mishka is decorating the Christmas tree. He has got three garlands, and all of them will be put on the tree. After that Mishka will switch these garlands on.
When a garland is switched on, it periodically changes its state — sometimes it is... | instruction | 0 | 51,863 | 7 | 103,726 |
Tags: brute force, constructive algorithms
Correct Solution:
```
l=list(map(int,input().split()))
l=sorted(l)
if l[1]<=2 or l[0]==1 or l[0]==2 and l[1]==4 and l[2]==4 or l[1]==3==l[0]==l[2]:
print("YES")
else :
print("NO")
``` | output | 1 | 51,863 | 7 | 103,727 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Mishka is decorating the Christmas tree. He has got three garlands, and all of them will be put on the tree. After that Mishka will switch these garlands on.
When a garland is switched on, it periodically changes its state — sometimes it is... | instruction | 0 | 51,865 | 7 | 103,730 |
Tags: brute force, constructive algorithms
Correct Solution:
```
a=sorted(list(map(int,input().split())))
if (a[0]==1) or ((a[0]==2) and (a[1]==2)) or ((a[0]==3) and (a[2]==3)) or ((a[0]==2) and (a[1]==4) and (a[2]==4)):
print('YES')
else:
print('NO')
``` | output | 1 | 51,865 | 7 | 103,731 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Mishka is decorating the Christmas tree. He has got three garlands, and all of them will be put on the tree. After that Mishka will switch these garlands on.
When a garland is switched on, it p... | instruction | 0 | 51,866 | 7 | 103,732 |
Yes | output | 1 | 51,866 | 7 | 103,733 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Mishka is decorating the Christmas tree. He has got three garlands, and all of them will be put on the tree. After that Mishka will switch these garlands on.
When a garland is switched on, it p... | instruction | 0 | 51,867 | 7 | 103,734 |
Yes | output | 1 | 51,867 | 7 | 103,735 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Mishka is decorating the Christmas tree. He has got three garlands, and all of them will be put on the tree. After that Mishka will switch these garlands on.
When a garland is switched on, it p... | instruction | 0 | 51,868 | 7 | 103,736 |
Yes | output | 1 | 51,868 | 7 | 103,737 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Mishka is decorating the Christmas tree. He has got three garlands, and all of them will be put on the tree. After that Mishka will switch these garlands on.
When a garland is switched on, it p... | instruction | 0 | 51,869 | 7 | 103,738 |
Yes | output | 1 | 51,869 | 7 | 103,739 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Mishka is decorating the Christmas tree. He has got three garlands, and all of them will be put on the tree. After that Mishka will switch these garlands on.
When a garland is switched on, it p... | instruction | 0 | 51,870 | 7 | 103,740 |
No | output | 1 | 51,870 | 7 | 103,741 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Mishka is decorating the Christmas tree. He has got three garlands, and all of them will be put on the tree. After that Mishka will switch these garlands on.
When a garland is switched on, it p... | instruction | 0 | 51,871 | 7 | 103,742 |
No | output | 1 | 51,871 | 7 | 103,743 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Mishka is decorating the Christmas tree. He has got three garlands, and all of them will be put on the tree. After that Mishka will switch these garlands on.
When a garland is switched on, it p... | instruction | 0 | 51,872 | 7 | 103,744 |
No | output | 1 | 51,872 | 7 | 103,745 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Mishka is decorating the Christmas tree. He has got three garlands, and all of them will be put on the tree. After that Mishka will switch these garlands on.
When a garland is switched on, it p... | instruction | 0 | 51,873 | 7 | 103,746 |
No | output | 1 | 51,873 | 7 | 103,747 |
Provide tags and a correct Python 3 solution for this coding contest problem.
You took a peek on Thanos wearing Infinity Gauntlet. In the Gauntlet there is a place for six Infinity Gems:
* the Power Gem of purple color,
* the Time Gem of green color,
* the Space Gem of blue color,
* the Soul Gem of orange ... | instruction | 0 | 51,900 | 7 | 103,800 |
Tags: implementation
Correct Solution:
```
l = ["Power","Space","Soul","Mind","Time","Reality"]
i = int(input())
while i > 0:
s = input()
if( s == "red"):
del l[l.index("Reality")]
elif (s == "purple"):
del l[l.index("Power")]
elif (s == "green"):
del l[l.index("Time")]
elif (s == "blue"):
del l[l.index("S... | output | 1 | 51,900 | 7 | 103,801 |
Provide tags and a correct Python 3 solution for this coding contest problem.
You took a peek on Thanos wearing Infinity Gauntlet. In the Gauntlet there is a place for six Infinity Gems:
* the Power Gem of purple color,
* the Time Gem of green color,
* the Space Gem of blue color,
* the Soul Gem of orange ... | instruction | 0 | 51,901 | 7 | 103,802 |
Tags: implementation
Correct Solution:
```
gem_dict = {'purple':'Power','green':'Time','blue':'Space','orange':'Soul','red':'Reality','yellow':'Mind'}
T = int(input().strip())
seen = []
for i in range(T):
seen.append(input().strip())
print(6-len(seen))
for _key in gem_dict:
if _key not in seen:
print(... | output | 1 | 51,901 | 7 | 103,803 |
Provide tags and a correct Python 3 solution for this coding contest problem.
You took a peek on Thanos wearing Infinity Gauntlet. In the Gauntlet there is a place for six Infinity Gems:
* the Power Gem of purple color,
* the Time Gem of green color,
* the Space Gem of blue color,
* the Soul Gem of orange ... | instruction | 0 | 51,902 | 7 | 103,804 |
Tags: implementation
Correct Solution:
```
t = int(input())
power = ["Mind","Power","Reality","Soul","Space","Time"]
color = ["yellow","purple","red","orange","blue","green"]
present = [0]*6
for i in range(t):
col = str(input().strip())
if col in color:
present[color.index(col)] = 1
print(6-sum(present))
for i in r... | output | 1 | 51,902 | 7 | 103,805 |
Provide tags and a correct Python 3 solution for this coding contest problem.
You took a peek on Thanos wearing Infinity Gauntlet. In the Gauntlet there is a place for six Infinity Gems:
* the Power Gem of purple color,
* the Time Gem of green color,
* the Space Gem of blue color,
* the Soul Gem of orange ... | instruction | 0 | 51,903 | 7 | 103,806 |
Tags: implementation
Correct Solution:
```
ref={'red':'Reality','green':'Time','blue':'Space',\
'purple':'Power',\
'yellow':'Mind',\
'orange':'Soul'}
n=int(input())
L=[]
for i in range(n):
#L=list(map(int, input().split()))
L.append(input())
print(6-n)
for j in ref:
if j not in L:
print(ref[j])
... | output | 1 | 51,903 | 7 | 103,807 |
Provide tags and a correct Python 3 solution for this coding contest problem.
You took a peek on Thanos wearing Infinity Gauntlet. In the Gauntlet there is a place for six Infinity Gems:
* the Power Gem of purple color,
* the Time Gem of green color,
* the Space Gem of blue color,
* the Soul Gem of orange ... | instruction | 0 | 51,904 | 7 | 103,808 |
Tags: implementation
Correct Solution:
```
a={
"purple":"Power",
"green":"Time",
"blue":"Space",
"orange":"Soul",
"red":"Reality",
"yellow":"Mind"
}
b=[]
n=int(input())
for x in range(n):
b.append(input())
s=0
c=[]
for x in a:
if x not in b:
s+=1
c.append(a[x])
print(s)
for x in range(len(c)):
print(c[x])
... | output | 1 | 51,904 | 7 | 103,809 |
Provide tags and a correct Python 3 solution for this coding contest problem.
You took a peek on Thanos wearing Infinity Gauntlet. In the Gauntlet there is a place for six Infinity Gems:
* the Power Gem of purple color,
* the Time Gem of green color,
* the Space Gem of blue color,
* the Soul Gem of orange ... | instruction | 0 | 51,905 | 7 | 103,810 |
Tags: implementation
Correct Solution:
```
li=["Power",'Time','Space','Soul','Reality','Mind']
gi={'purple':'Power' ,'green':'Time', 'blue':'Space','orange':'Soul','red':'Reality','yellow':'Mind'}
n=int(input())
for i1 in range(n):
li.remove(gi[input()])
print(len(li))
for i in li:
print(i)
``` | output | 1 | 51,905 | 7 | 103,811 |
Provide tags and a correct Python 3 solution for this coding contest problem.
You took a peek on Thanos wearing Infinity Gauntlet. In the Gauntlet there is a place for six Infinity Gems:
* the Power Gem of purple color,
* the Time Gem of green color,
* the Space Gem of blue color,
* the Soul Gem of orange ... | instruction | 0 | 51,906 | 7 | 103,812 |
Tags: implementation
Correct Solution:
```
main=['purple','green','blue','orange','red','yellow']
type_s=['Power','Time','Space','Soul','Reality','Mind']
n=int(input())
col=[]
for i in range(n):
a=input()
col.append(a)
not_present=[]
for i in main:
if i in col:
pass
else:
not_present.append(i)
count=len(... | output | 1 | 51,906 | 7 | 103,813 |
Provide tags and a correct Python 3 solution for this coding contest problem.
You took a peek on Thanos wearing Infinity Gauntlet. In the Gauntlet there is a place for six Infinity Gems:
* the Power Gem of purple color,
* the Time Gem of green color,
* the Space Gem of blue color,
* the Soul Gem of orange ... | instruction | 0 | 51,907 | 7 | 103,814 |
Tags: implementation
Correct Solution:
```
d = {}
d["purple"] = "Power"
d["green"] = "Time"
d["blue"] = "Space"
d["orange"] = "Soul"
d["red"] = "Reality"
d["yellow"] = "Mind"
n = int(input())
lista = []
for i in d:
lista.append(d[i])
for x in range(n):
s = input()
lista.remove(d[s])
print(len(lista))
for x in ... | output | 1 | 51,907 | 7 | 103,815 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
You took a peek on Thanos wearing Infinity Gauntlet. In the Gauntlet there is a place for six Infinity Gems:
* the Power Gem of purple color,
* the Time Gem of green color,
* the Space ... | instruction | 0 | 51,908 | 7 | 103,816 |
Yes | output | 1 | 51,908 | 7 | 103,817 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
You took a peek on Thanos wearing Infinity Gauntlet. In the Gauntlet there is a place for six Infinity Gems:
* the Power Gem of purple color,
* the Time Gem of green color,
* the Space ... | instruction | 0 | 51,909 | 7 | 103,818 |
Yes | output | 1 | 51,909 | 7 | 103,819 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
You took a peek on Thanos wearing Infinity Gauntlet. In the Gauntlet there is a place for six Infinity Gems:
* the Power Gem of purple color,
* the Time Gem of green color,
* the Space ... | instruction | 0 | 51,910 | 7 | 103,820 |
Yes | output | 1 | 51,910 | 7 | 103,821 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
You took a peek on Thanos wearing Infinity Gauntlet. In the Gauntlet there is a place for six Infinity Gems:
* the Power Gem of purple color,
* the Time Gem of green color,
* the Space ... | instruction | 0 | 51,911 | 7 | 103,822 |
Yes | output | 1 | 51,911 | 7 | 103,823 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
You took a peek on Thanos wearing Infinity Gauntlet. In the Gauntlet there is a place for six Infinity Gems:
* the Power Gem of purple color,
* the Time Gem of green color,
* the Space ... | instruction | 0 | 51,913 | 7 | 103,826 |
No | output | 1 | 51,913 | 7 | 103,827 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
You took a peek on Thanos wearing Infinity Gauntlet. In the Gauntlet there is a place for six Infinity Gems:
* the Power Gem of purple color,
* the Time Gem of green color,
* the Space ... | instruction | 0 | 51,914 | 7 | 103,828 |
No | output | 1 | 51,914 | 7 | 103,829 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
You took a peek on Thanos wearing Infinity Gauntlet. In the Gauntlet there is a place for six Infinity Gems:
* the Power Gem of purple color,
* the Time Gem of green color,
* the Space ... | instruction | 0 | 51,915 | 7 | 103,830 |
No | output | 1 | 51,915 | 7 | 103,831 |
Provide tags and a correct Python 3 solution for this coding contest problem.
You are given a line of n colored squares in a row, numbered from 1 to n from left to right. The i-th square initially has the color c_i.
Let's say, that two squares i and j belong to the same connected component if c_i = c_j, and c_i = c_k... | instruction | 0 | 52,250 | 7 | 104,500 |
Tags: dp
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 or "r" not in file.mode
... | output | 1 | 52,250 | 7 | 104,501 |
Provide tags and a correct Python 3 solution for this coding contest problem.
You are given a line of n colored squares in a row, numbered from 1 to n from left to right. The i-th square initially has the color c_i.
Let's say, that two squares i and j belong to the same connected component if c_i = c_j, and c_i = c_k... | instruction | 0 | 52,251 | 7 | 104,502 |
Tags: dp
Correct Solution:
```
from itertools import groupby
import math
n, = list(map(int, input().strip().split()))
array = list(map(int, input().strip().split()))
g_array = [k for k, g in groupby(array)]
n = len(g_array)
extend_n = n + 2
sols = [[0]*extend_n for _ in range(extend_n)]
for i in range(1, extend_n-1... | output | 1 | 52,251 | 7 | 104,503 |
Provide tags and a correct Python 3 solution for this coding contest problem.
You are given a line of n colored squares in a row, numbered from 1 to n from left to right. The i-th square initially has the color c_i.
Let's say, that two squares i and j belong to the same connected component if c_i = c_j, and c_i = c_k... | instruction | 0 | 52,252 | 7 | 104,504 |
Tags: dp
Correct Solution:
```
def fill():
global dp
dp = [0] * (n + 2)
for i in range(n + 2):
dp[i] = [0] * (n + 2)
def compress(v):
global n
global c
c = [v[0]]
for i in range(1, n):
if v[i] != v[i - 1]:
c.append(v[i])
n = len(c)
n = int(input(... | output | 1 | 52,252 | 7 | 104,505 |
Provide tags and a correct Python 3 solution for this coding contest problem.
You are given a line of n colored squares in a row, numbered from 1 to n from left to right. The i-th square initially has the color c_i.
Let's say, that two squares i and j belong to the same connected component if c_i = c_j, and c_i = c_k... | instruction | 0 | 52,253 | 7 | 104,506 |
Tags: dp
Correct Solution:
```
def inpl(): return list(map(int, input().split()))
N = int(input())
A = inpl()
B = [0]
for a in A:
if B[-1] != a:
B.append(a)
B = B[1:]
k = len(B)
dp = [0]*((k*k + k)//2)
for d in range(1, k):
for i in range(k-d):
if B[i] == B[i+d]:
dp[d*(2*k-d+1)//2+... | output | 1 | 52,253 | 7 | 104,507 |
Provide tags and a correct Python 3 solution for this coding contest problem.
You are given a line of n colored squares in a row, numbered from 1 to n from left to right. The i-th square initially has the color c_i.
Let's say, that two squares i and j belong to the same connected component if c_i = c_j, and c_i = c_k... | instruction | 0 | 52,254 | 7 | 104,508 |
Tags: dp
Correct Solution:
```
n=int(input())
c=list(map(int,input().split()))
c.append(-5)
arr=[0]
for i in range(n):
if(c[i]!=c[i+1]):
arr.append(c[i])
arr_r=[0]+arr[::-1]
l=len(arr)
store=[0]*(l)
up=[0]*(l)
for i in range(1,l):
for j in range(1,l):
if(arr[i]==arr_r[j]):
store[j]=u... | output | 1 | 52,254 | 7 | 104,509 |
Provide tags and a correct Python 3 solution for this coding contest problem.
You are given a line of n colored squares in a row, numbered from 1 to n from left to right. The i-th square initially has the color c_i.
Let's say, that two squares i and j belong to the same connected component if c_i = c_j, and c_i = c_k... | instruction | 0 | 52,255 | 7 | 104,510 |
Tags: dp
Correct Solution:
```
n = int(input())
a = list(map(int, input().split()))
b = []
p = -1
for e in a:
if e == p:
continue
else:
b.append(e)
p = e
def lcs(a, b):
lengths = [[0 for j in range(len(b)+1)] for i in range(len(a)+1)]
# row 0 and column 0 are initialized to 0 al... | output | 1 | 52,255 | 7 | 104,511 |
Provide tags and a correct Python 3 solution for this coding contest problem.
You are given a line of n colored squares in a row, numbered from 1 to n from left to right. The i-th square initially has the color c_i.
Let's say, that two squares i and j belong to the same connected component if c_i = c_j, and c_i = c_k... | instruction | 0 | 52,256 | 7 | 104,512 |
Tags: dp
Correct Solution:
```
def run_length_compress(string):
string = string + ["."]
n = len(string)
begin = 0
end = 1
cnt = 1
ans = []
while True:
if end >= n:
break
if string[begin] == string[end]:
end += 1
cnt += 1
else:
... | output | 1 | 52,256 | 7 | 104,513 |
Provide tags and a correct Python 3 solution for this coding contest problem.
You are given a line of n colored squares in a row, numbered from 1 to n from left to right. The i-th square initially has the color c_i.
Let's say, that two squares i and j belong to the same connected component if c_i = c_j, and c_i = c_k... | instruction | 0 | 52,257 | 7 | 104,514 |
Tags: dp
Correct Solution:
```
#Code by Sounak, IIESTS
#------------------------------warmup----------------------------
import os
import sys
import math
from io import BytesIO, IOBase
from fractions import Fraction
import collections
from itertools import permutations
#from collections import defaultdict
from collect... | output | 1 | 52,257 | 7 | 104,515 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
You are given a line of n colored squares in a row, numbered from 1 to n from left to right. The i-th square initially has the color c_i.
Let's say, that two squares i and j belong to the same ... | instruction | 0 | 52,258 | 7 | 104,516 |
Yes | output | 1 | 52,258 | 7 | 104,517 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
You are given a line of n colored squares in a row, numbered from 1 to n from left to right. The i-th square initially has the color c_i.
Let's say, that two squares i and j belong to the same ... | instruction | 0 | 52,259 | 7 | 104,518 |
Yes | output | 1 | 52,259 | 7 | 104,519 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
You are given a line of n colored squares in a row, numbered from 1 to n from left to right. The i-th square initially has the color c_i.
Let's say, that two squares i and j belong to the same ... | instruction | 0 | 52,260 | 7 | 104,520 |
Yes | output | 1 | 52,260 | 7 | 104,521 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.