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 |
|---|---|---|---|---|---|
Provide tags and a correct Python 3 solution for this coding contest problem.
We're giving away nice huge bags containing number tiles! A bag we want to present to you contains n tiles. Each of them has a single number written on it — either 1 or 2.
However, there is one condition you must fulfill in order to receive... | instruction | 0 | 41,290 | 7 | 82,580 |
Tags: constructive algorithms, greedy, math, number theory
Correct Solution:
```
N = int(input())
num_ones = input().count('1')
num_twos = N - num_ones
if not num_ones or not num_twos:
solutionn = [1] * num_ones + [2] * num_twos
else:
solutionn = [2, 1] + [2] * (num_twos - 1) + [1] * (num_ones - 1)
print(*s... | output | 1 | 41,290 | 7 | 82,581 |
Provide tags and a correct Python 3 solution for this coding contest problem.
We're giving away nice huge bags containing number tiles! A bag we want to present to you contains n tiles. Each of them has a single number written on it — either 1 or 2.
However, there is one condition you must fulfill in order to receive... | instruction | 0 | 41,291 | 7 | 82,582 |
Tags: constructive algorithms, greedy, math, number theory
Correct Solution:
```
n = int(input())
m = list(map(int,input().split()))
c1 = m.count(1)
c2 = m.count(2)
if(c2 > 0):
print(2,end = ' ')
if(c1 > 0):
print(1,end = ' ')
for i in range(c2-1):
print(2,end = ' ')
for i in range(c1-1):
print(1,end = ... | output | 1 | 41,291 | 7 | 82,583 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
We're giving away nice huge bags containing number tiles! A bag we want to present to you contains n tiles. Each of them has a single number written on it — either 1 or 2.
However, there is one... | instruction | 0 | 41,292 | 7 | 82,584 |
Yes | output | 1 | 41,292 | 7 | 82,585 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
We're giving away nice huge bags containing number tiles! A bag we want to present to you contains n tiles. Each of them has a single number written on it — either 1 or 2.
However, there is one... | instruction | 0 | 41,293 | 7 | 82,586 |
Yes | output | 1 | 41,293 | 7 | 82,587 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
We're giving away nice huge bags containing number tiles! A bag we want to present to you contains n tiles. Each of them has a single number written on it — either 1 or 2.
However, there is one... | instruction | 0 | 41,294 | 7 | 82,588 |
Yes | output | 1 | 41,294 | 7 | 82,589 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
We're giving away nice huge bags containing number tiles! A bag we want to present to you contains n tiles. Each of them has a single number written on it — either 1 or 2.
However, there is one... | instruction | 0 | 41,295 | 7 | 82,590 |
Yes | output | 1 | 41,295 | 7 | 82,591 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
We're giving away nice huge bags containing number tiles! A bag we want to present to you contains n tiles. Each of them has a single number written on it — either 1 or 2.
However, there is one... | instruction | 0 | 41,296 | 7 | 82,592 |
No | output | 1 | 41,296 | 7 | 82,593 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
We're giving away nice huge bags containing number tiles! A bag we want to present to you contains n tiles. Each of them has a single number written on it — either 1 or 2.
However, there is one... | instruction | 0 | 41,297 | 7 | 82,594 |
No | output | 1 | 41,297 | 7 | 82,595 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
We're giving away nice huge bags containing number tiles! A bag we want to present to you contains n tiles. Each of them has a single number written on it — either 1 or 2.
However, there is one... | instruction | 0 | 41,298 | 7 | 82,596 |
No | output | 1 | 41,298 | 7 | 82,597 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
We're giving away nice huge bags containing number tiles! A bag we want to present to you contains n tiles. Each of them has a single number written on it — either 1 or 2.
However, there is one... | instruction | 0 | 41,299 | 7 | 82,598 |
No | output | 1 | 41,299 | 7 | 82,599 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Due to the coronavirus pandemic, city authorities obligated citizens to keep a social distance. The mayor of the city Semyon wants to light up Gluharniki park so that people could see each other even at night to keep the social distance.
Th... | instruction | 0 | 41,413 | 7 | 82,826 |
Tags: greedy, math
Correct Solution:
```
for _ in range(int(input())):
#int(input())
n,m=list(map(int,input().strip().split()))
z=n*m
if z%2==0:
print(z//2)
else:
print(z//2+1)
``` | output | 1 | 41,413 | 7 | 82,827 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Due to the coronavirus pandemic, city authorities obligated citizens to keep a social distance. The mayor of the city Semyon wants to light up Gluharniki park so that people could see each other even at night to keep the social distance.
Th... | instruction | 0 | 41,414 | 7 | 82,828 |
Tags: greedy, math
Correct Solution:
```
def park_lighting():
rows_columns = list(map(int,input().split()))
cells = rows_columns[0]*rows_columns[1]
if cells % 2 ==0:
number_of_lights = cells/2
else:
number_of_lights = (cells+1)/2
print(int(number_of_lights))
def main():
for ... | output | 1 | 41,414 | 7 | 82,829 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Due to the coronavirus pandemic, city authorities obligated citizens to keep a social distance. The mayor of the city Semyon wants to light up Gluharniki park so that people could see each other even at night to keep the social distance.
Th... | instruction | 0 | 41,415 | 7 | 82,830 |
Tags: greedy, math
Correct Solution:
```
for _ in range(int(input())):
n, m = map(int, input().split())
if (n * m) & 1:
print(n * m // 2 + 1)
else:
print(n * m // 2)
``` | output | 1 | 41,415 | 7 | 82,831 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Due to the coronavirus pandemic, city authorities obligated citizens to keep a social distance. The mayor of the city Semyon wants to light up Gluharniki park so that people could see each other even at night to keep the social distance.
Th... | instruction | 0 | 41,416 | 7 | 82,832 |
Tags: greedy, math
Correct Solution:
```
t = int(input())
for _ in range(t):
n, m = map(int, input().split())
print((n * m) // 2 + (n * m) % 2)
``` | output | 1 | 41,416 | 7 | 82,833 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Due to the coronavirus pandemic, city authorities obligated citizens to keep a social distance. The mayor of the city Semyon wants to light up Gluharniki park so that people could see each other even at night to keep the social distance.
Th... | instruction | 0 | 41,417 | 7 | 82,834 |
Tags: greedy, math
Correct Solution:
```
t = int(input())
while t != 0:
n, m = map(int, input().split())
if n == 1:
if m == 1:
print(1)
elif m % 2 == 0:
print(m // 2)
else:
print(m // 2 + 1)
t -= 1
continue
elif m == 1:
if n == 1:
print(1)
elif n % 2 == 0:
print(n // 2)
else:
print(... | output | 1 | 41,417 | 7 | 82,835 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Due to the coronavirus pandemic, city authorities obligated citizens to keep a social distance. The mayor of the city Semyon wants to light up Gluharniki park so that people could see each other even at night to keep the social distance.
Th... | instruction | 0 | 41,418 | 7 | 82,836 |
Tags: greedy, math
Correct Solution:
```
'''
Auther: ghoshashis545 Ashis Ghosh
College: jalpaiguri Govt Enggineerin College
Date:26/05/2020
'''
import sys
from collections import deque,defaultdict as dd
from bisect import bisect,bisect_left,bisect_right,insort,insort_left,insort_right
from itertools impor... | output | 1 | 41,418 | 7 | 82,837 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Due to the coronavirus pandemic, city authorities obligated citizens to keep a social distance. The mayor of the city Semyon wants to light up Gluharniki park so that people could see each other even at night to keep the social distance.
Th... | instruction | 0 | 41,419 | 7 | 82,838 |
Tags: greedy, math
Correct Solution:
```
t=int(input())
for i in range (t):
a=[]
a=list(map(int, input().split()))
b=a[0]//2*a[1]
if a[0]%2==1:
b+=a[1]//2+a[1]%2
print(b)
``` | output | 1 | 41,419 | 7 | 82,839 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Due to the coronavirus pandemic, city authorities obligated citizens to keep a social distance. The mayor of the city Semyon wants to light up Gluharniki park so that people could see each other even at night to keep the social distance.
Th... | instruction | 0 | 41,420 | 7 | 82,840 |
Tags: greedy, math
Correct Solution:
```
for _ in range(int(input())):
n,m=map(int,input().split())
p=max(n,m)
q=min(n,m)
if p%2==0:
print((p//2)*q)
else:
print((p//2)*q+(q+1)//2)
``` | output | 1 | 41,420 | 7 | 82,841 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Due to the coronavirus pandemic, city authorities obligated citizens to keep a social distance. The mayor of the city Semyon wants to light up Gluharniki park so that people could see each other... | instruction | 0 | 41,421 | 7 | 82,842 |
Yes | output | 1 | 41,421 | 7 | 82,843 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Due to the coronavirus pandemic, city authorities obligated citizens to keep a social distance. The mayor of the city Semyon wants to light up Gluharniki park so that people could see each other... | instruction | 0 | 41,422 | 7 | 82,844 |
Yes | output | 1 | 41,422 | 7 | 82,845 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Due to the coronavirus pandemic, city authorities obligated citizens to keep a social distance. The mayor of the city Semyon wants to light up Gluharniki park so that people could see each other... | instruction | 0 | 41,423 | 7 | 82,846 |
Yes | output | 1 | 41,423 | 7 | 82,847 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Due to the coronavirus pandemic, city authorities obligated citizens to keep a social distance. The mayor of the city Semyon wants to light up Gluharniki park so that people could see each other... | instruction | 0 | 41,424 | 7 | 82,848 |
Yes | output | 1 | 41,424 | 7 | 82,849 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Due to the coronavirus pandemic, city authorities obligated citizens to keep a social distance. The mayor of the city Semyon wants to light up Gluharniki park so that people could see each other... | instruction | 0 | 41,425 | 7 | 82,850 |
No | output | 1 | 41,425 | 7 | 82,851 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Due to the coronavirus pandemic, city authorities obligated citizens to keep a social distance. The mayor of the city Semyon wants to light up Gluharniki park so that people could see each other... | instruction | 0 | 41,426 | 7 | 82,852 |
No | output | 1 | 41,426 | 7 | 82,853 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Due to the coronavirus pandemic, city authorities obligated citizens to keep a social distance. The mayor of the city Semyon wants to light up Gluharniki park so that people could see each other... | instruction | 0 | 41,427 | 7 | 82,854 |
No | output | 1 | 41,427 | 7 | 82,855 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Due to the coronavirus pandemic, city authorities obligated citizens to keep a social distance. The mayor of the city Semyon wants to light up Gluharniki park so that people could see each other... | instruction | 0 | 41,428 | 7 | 82,856 |
No | output | 1 | 41,428 | 7 | 82,857 |
Provide a correct Python 3 solution for this coding contest problem.
There are N slimes lining up from left to right. The colors of these slimes will be given as a string S of length N consisting of lowercase English letters. The i-th slime from the left has the color that corresponds to the i-th character of S.
Adja... | instruction | 0 | 41,859 | 7 | 83,718 |
"Correct Solution:
```
import itertools as it
n = input()
s = input()
print(len(list(it.groupby(s, ))))
``` | output | 1 | 41,859 | 7 | 83,719 |
Provide a correct Python 3 solution for this coding contest problem.
There are N slimes lining up from left to right. The colors of these slimes will be given as a string S of length N consisting of lowercase English letters. The i-th slime from the left has the color that corresponds to the i-th character of S.
Adja... | instruction | 0 | 41,863 | 7 | 83,726 |
"Correct Solution:
```
from itertools import groupby
_ = input()
s = list(groupby(input()))
print(len(s))
``` | output | 1 | 41,863 | 7 | 83,727 |
Provide a correct Python 3 solution for this coding contest problem.
Problem Statement
In the headquarter building of ICPC (International Company of Plugs & Connectors), there are $M$ light bulbs and they are controlled by $N$ switches. Each light bulb can be turned on or off by exactly one switch. Each switch may co... | instruction | 0 | 42,037 | 7 | 84,074 |
"Correct Solution:
```
while 1:
n,m,q=map(int,input().split())
if (n|m|q)==0: break
p=[]
res=[{_ for _ in range(n)} for _ in range(m)]
for i in range(q):
s,b=[[int(c) for c in s] for s in input().split()]
if i>0:
for j in range(n):
s[j]^=p[j]
zero={i for i in range(n) if s[i]==0}
... | output | 1 | 42,037 | 7 | 84,075 |
Provide a correct Python 3 solution for this coding contest problem.
Problem Statement
In the headquarter building of ICPC (International Company of Plugs & Connectors), there are $M$ light bulbs and they are controlled by $N$ switches. Each light bulb can be turned on or off by exactly one switch. Each switch may co... | instruction | 0 | 42,038 | 7 | 84,076 |
"Correct Solution:
```
#!usr/bin/env python3
from collections import defaultdict,deque
from heapq import heappush, heappop
import sys
import math
import bisect
import random
def LI(): return [int(x) for x in sys.stdin.readline().split()]
def I(): return int(sys.stdin.readline())
def LS():return [list(x) for x in sys.st... | output | 1 | 42,038 | 7 | 84,077 |
Provide a correct Python 3 solution for this coding contest problem.
Problem Statement
In the headquarter building of ICPC (International Company of Plugs & Connectors), there are $M$ light bulbs and they are controlled by $N$ switches. Each light bulb can be turned on or off by exactly one switch. Each switch may co... | instruction | 0 | 42,039 | 7 | 84,078 |
"Correct Solution:
```
while True:
N, M, Q = map(int, input().split()) # N個のスイッチ, M個のライト, Q個のクエリ
if N == 0 and M == 0 and Q ==0:
exit()
# 全ての配列を繋がっていることを仮定する
correspondence = [set(list(range(M))) for _ in range(N)]
# print(correspondence) 全てのスイッチと繋がっていることが確認できた
switch_status = [0]*N # ... | output | 1 | 42,039 | 7 | 84,079 |
Provide a correct Python 3 solution for this coding contest problem.
Problem Statement
In the headquarter building of ICPC (International Company of Plugs & Connectors), there are $M$ light bulbs and they are controlled by $N$ switches. Each light bulb can be turned on or off by exactly one switch. Each switch may co... | instruction | 0 | 42,040 | 7 | 84,080 |
"Correct Solution:
```
import math,string,itertools,fractions,heapq,collections,re,array,bisect,sys,random,time,copy,functools
sys.setrecursionlimit(10**7)
inf = 10**20
eps = 1.0 / 10**10
mod = 998244353
dd = [(0,-1),(1,0),(0,1),(-1,0)]
ddn = [(0,-1),(1,-1),(1,0),(1,1),(0,1),(-1,-1),(-1,0),(-1,1)]
def LI(): return [i... | output | 1 | 42,040 | 7 | 84,081 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Problem Statement
In the headquarter building of ICPC (International Company of Plugs & Connectors), there are $M$ light bulbs and they are controlled by $N$ switches. Each light bulb can be tu... | instruction | 0 | 42,041 | 7 | 84,082 |
No | output | 1 | 42,041 | 7 | 84,083 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Problem Statement
In the headquarter building of ICPC (International Company of Plugs & Connectors), there are $M$ light bulbs and they are controlled by $N$ switches. Each light bulb can be tu... | instruction | 0 | 42,042 | 7 | 84,084 |
No | output | 1 | 42,042 | 7 | 84,085 |
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response.
Problem Statement
In the headquarter building of ICPC (International Company of Plugs & Connectors), there are $M$ light bulbs and they are controlled by $N$ switches. Each light bulb can be tu... | instruction | 0 | 42,043 | 7 | 84,086 |
No | output | 1 | 42,043 | 7 | 84,087 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Fox Ciel saw a large field while she was on a bus. The field was a n × m rectangle divided into 1 × 1 cells. Some cells were wasteland, and other each cell contained crop plants: either carrots or kiwis or grapes.
After seeing the field ca... | instruction | 0 | 42,556 | 7 | 85,112 |
Tags: implementation, sortings
Correct Solution:
```
w = []
col = ['Carrots', 'Kiwis', 'Grapes']
n , m , k , t = map(int,input().split())
for _ in range(k):
w.append(list(map(int, input().split())))
for _ in range(t):
c = list(map(int,input().split()))
if c in w:
print('Waste')
else:
s=0
for i in w:
if i <... | output | 1 | 42,556 | 7 | 85,113 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Fox Ciel saw a large field while she was on a bus. The field was a n × m rectangle divided into 1 × 1 cells. Some cells were wasteland, and other each cell contained crop plants: either carrots or kiwis or grapes.
After seeing the field ca... | instruction | 0 | 42,557 | 7 | 85,114 |
Tags: implementation, sortings
Correct Solution:
```
n,m,k,t = [int(x) for x in input().split()]
mapp ={0:'Carrots',1:'Kiwis',2:'Grapes'}
iamdistruption = []
for i in range(k):
x,y = [int(x) for x in input().split()]
iamdistruption.append((x,y))
for i in range(t):
x,y = [int(x) for x in input().split()]
... | output | 1 | 42,557 | 7 | 85,115 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Fox Ciel saw a large field while she was on a bus. The field was a n × m rectangle divided into 1 × 1 cells. Some cells were wasteland, and other each cell contained crop plants: either carrots or kiwis or grapes.
After seeing the field ca... | instruction | 0 | 42,558 | 7 | 85,116 |
Tags: implementation, sortings
Correct Solution:
```
n , m , k ,t = [int(i) for i in input().split()]
waste = []
for i in range(k):
a ,b = [int(i) for i in input().split()]
waste.append((a-1)*m+b)
crop = ['Carrots','Kiwis','Grapes']
waste.sort()
nn = len(waste)
for i in range(t):
a ,b = [int(i) for i in input().spl... | output | 1 | 42,558 | 7 | 85,117 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Fox Ciel saw a large field while she was on a bus. The field was a n × m rectangle divided into 1 × 1 cells. Some cells were wasteland, and other each cell contained crop plants: either carrots or kiwis or grapes.
After seeing the field ca... | instruction | 0 | 42,559 | 7 | 85,118 |
Tags: implementation, sortings
Correct Solution:
```
# https://codeforces.com/contest/79/problem/B
def single_integer():
return int(input())
def multi_integer():
return map(int, input().split())
def string():
return input()
def multi_string():
return input().split()
n, m, k, t = multi_integer(... | output | 1 | 42,559 | 7 | 85,119 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Fox Ciel saw a large field while she was on a bus. The field was a n × m rectangle divided into 1 × 1 cells. Some cells were wasteland, and other each cell contained crop plants: either carrots or kiwis or grapes.
After seeing the field ca... | instruction | 0 | 42,560 | 7 | 85,120 |
Tags: implementation, sortings
Correct Solution:
```
n, m, num_wasted, num_queries = map(int, input().split())
wasted = [ None for i in range(num_wasted) ]
for i in range(num_wasted):
a, b = map(lambda s: int(s) - 1, input().split())
wasted[i] = a * m + b
wasted_set = set(wasted)
wasted.sort()
crops = [ 'Carro... | output | 1 | 42,560 | 7 | 85,121 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Fox Ciel saw a large field while she was on a bus. The field was a n × m rectangle divided into 1 × 1 cells. Some cells were wasteland, and other each cell contained crop plants: either carrots or kiwis or grapes.
After seeing the field ca... | instruction | 0 | 42,561 | 7 | 85,122 |
Tags: implementation, sortings
Correct Solution:
```
row,line,waste,ask=map(int,input().split())
waste_array=[]
for i in range(waste):
row_data,line_data=map(int,input().split())
waste_array.append(((row_data-1)*line)+line_data)
waste_array=sorted(waste_array)
def binarySearchCount(arr, n, value):
left = 0... | output | 1 | 42,561 | 7 | 85,123 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Fox Ciel saw a large field while she was on a bus. The field was a n × m rectangle divided into 1 × 1 cells. Some cells were wasteland, and other each cell contained crop plants: either carrots or kiwis or grapes.
After seeing the field ca... | instruction | 0 | 42,562 | 7 | 85,124 |
Tags: implementation, sortings
Correct Solution:
```
"Codeforces Beta Round #6 (Div. 2"
"B. President's Office"
# n,m,p=input().split()
# n=int(n)
# m=int(m)
# a=[]
# s=set()
# for i in range(n):
# l=list(input())
# a.append(l)
# l=[]
# for i in range(n):
# for j in range(m):
# if a[i][j]==p:
# ... | output | 1 | 42,562 | 7 | 85,125 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Fox Ciel saw a large field while she was on a bus. The field was a n × m rectangle divided into 1 × 1 cells. Some cells were wasteland, and other each cell contained crop plants: either carrots or kiwis or grapes.
After seeing the field ca... | instruction | 0 | 42,563 | 7 | 85,126 |
Tags: implementation, sortings
Correct Solution:
```
inp = str(input()).split(" ")
n = int(inp[0])
m = int(inp[1])
k = int(inp[2])
t = int(inp[3])
wasteSpace = []
for _ in range(k):
inp = str(input()).split(" ")
while inp == ['']:
inp = str(input()).split(" ")
x = int(inp[0]) - 1
y = int(inp[1... | output | 1 | 42,563 | 7 | 85,127 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Is there anything better than going to the zoo after a tiresome week at work? No wonder Grisha feels the same while spending the entire weekend accompanied by pretty striped zebras.
Inspired by this adventure and an accidentally found plas... | instruction | 0 | 42,912 | 7 | 85,824 |
Tags: constructive algorithms, implementation
Correct Solution:
```
s = list(input())
u = []
n = len(s)
k = 1
for i in range(1, n):
if s[i] != s[i - 1]:
k += 1
else:
u.append(k)
k = 1
u.append(k)
if s[0] == s[-1] or len(u) == 1:
print(max(u))
else:
print(max(max(u), u[0] + u[-1])... | output | 1 | 42,912 | 7 | 85,825 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Is there anything better than going to the zoo after a tiresome week at work? No wonder Grisha feels the same while spending the entire weekend accompanied by pretty striped zebras.
Inspired by this adventure and an accidentally found plas... | instruction | 0 | 42,913 | 7 | 85,826 |
Tags: constructive algorithms, implementation
Correct Solution:
```
s = input()
last = s[0]
count = 1
best = 1
for i in range(1, len(s) * 2):
if last != s[i % len(s)]:
count += 1
best = max(best, count)
last = s[i % len(s)]
else:
count = 1
print(min(best, len(s)))
``` | output | 1 | 42,913 | 7 | 85,827 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Is there anything better than going to the zoo after a tiresome week at work? No wonder Grisha feels the same while spending the entire weekend accompanied by pretty striped zebras.
Inspired by this adventure and an accidentally found plas... | instruction | 0 | 42,914 | 7 | 85,828 |
Tags: constructive algorithms, implementation
Correct Solution:
```
import sys
input=sys.stdin.readline
s=list(input().rstrip())
n=len(s)
s.extend(s)
cnt=0
c=1
for i in range(len(s)-1):
if s[i]!=s[i+1]:
c+=1
else:
cnt=max(c,cnt)
c=1
cnt=max(cnt,c)
print(min(cnt,n))
``` | output | 1 | 42,914 | 7 | 85,829 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Is there anything better than going to the zoo after a tiresome week at work? No wonder Grisha feels the same while spending the entire weekend accompanied by pretty striped zebras.
Inspired by this adventure and an accidentally found plas... | instruction | 0 | 42,915 | 7 | 85,830 |
Tags: constructive algorithms, implementation
Correct Solution:
```
s = input().strip()
n = len(s)
a = ''
for i in range(n):
if i == 0:
l = n-1
else:
l = i-1
if s[l] != s[i]:
a += s[i]
else:
break
s += a
r = 1
sum = 1
for i in range(1,len(s)):
if s[i] != s[i-1]:
... | output | 1 | 42,915 | 7 | 85,831 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Is there anything better than going to the zoo after a tiresome week at work? No wonder Grisha feels the same while spending the entire weekend accompanied by pretty striped zebras.
Inspired by this adventure and an accidentally found plas... | instruction | 0 | 42,916 | 7 | 85,832 |
Tags: constructive algorithms, implementation
Correct Solution:
```
s = input()
s += s
n = len(s)
p = [0] * n
p[0] = 1
for i in range(1, n):
if s[i] != s[i - 1]:
p[i] = p[i - 1] + 1
else:
p[i] = 1
print(min(max(p), n // 2))
``` | output | 1 | 42,916 | 7 | 85,833 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Is there anything better than going to the zoo after a tiresome week at work? No wonder Grisha feels the same while spending the entire weekend accompanied by pretty striped zebras.
Inspired by this adventure and an accidentally found plas... | instruction | 0 | 42,917 | 7 | 85,834 |
Tags: constructive algorithms, implementation
Correct Solution:
```
s = input() * 2
m = 1
n = 1
for i in range(len(s) - 1):
if s[i] != s[i+1]:
n += 1
else:
if n > m:
m = n
n = 1
if n > m:
m = n
print(min(len(s) // 2, m))
``` | output | 1 | 42,917 | 7 | 85,835 |
Provide tags and a correct Python 3 solution for this coding contest problem.
Is there anything better than going to the zoo after a tiresome week at work? No wonder Grisha feels the same while spending the entire weekend accompanied by pretty striped zebras.
Inspired by this adventure and an accidentally found plas... | instruction | 0 | 42,918 | 7 | 85,836 |
Tags: constructive algorithms, implementation
Correct Solution:
```
s = input()
n = len(s)
dp = [1] * n
cur = s[-1]
end = n - 1
for i in range(n-1):
if s[i] == cur:
end = i
break
cur = s[i]
dp[n-1] = end + 1
res = dp[n-1]
for i in range(n-2, -1, -1):
if s[i] != s[i+1]:
dp[i] = min(n,... | output | 1 | 42,918 | 7 | 85,837 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.