message
stringlengths
2
43.5k
message_type
stringclasses
2 values
message_id
int64
0
1
conversation_id
int64
853
107k
cluster
float64
24
24
__index_level_0__
int64
1.71k
214k
Provide tags and a correct Python 3 solution for this coding contest problem. This is an interactive problem. This is a hard version of the problem. The difference from the easy version is that in the hard version 1 ≀ t ≀ min(n, 10^4) and the total number of queries is limited to 6 β‹… 10^4. Polycarp is playing a comp...
instruction
0
49,909
24
99,818
Tags: binary search, constructive algorithms, data structures, interactive Correct Solution: ``` # ---------------------------iye ha aam zindegi--------------------------------------------- import math import random import heapq,bisect import sys from collections import deque, defaultdict from fractions import Fraction...
output
1
49,909
24
99,819
Provide tags and a correct Python 3 solution for this coding contest problem. This is an interactive problem. This is a hard version of the problem. The difference from the easy version is that in the hard version 1 ≀ t ≀ min(n, 10^4) and the total number of queries is limited to 6 β‹… 10^4. Polycarp is playing a comp...
instruction
0
49,910
24
99,820
Tags: binary search, constructive algorithms, data structures, interactive Correct Solution: ``` import os import sys from collections import defaultdict,deque from heapq import heappush,heappop from io import BytesIO, IOBase nmbr = lambda: int(input()) lst = lambda: list(map(int, input().split())) def main(): def ...
output
1
49,910
24
99,821
Provide tags and a correct Python 3 solution for this coding contest problem. This is an interactive problem. This is a hard version of the problem. The difference from the easy version is that in the hard version 1 ≀ t ≀ min(n, 10^4) and the total number of queries is limited to 6 β‹… 10^4. Polycarp is playing a comp...
instruction
0
49,911
24
99,822
Tags: binary search, constructive algorithms, data structures, interactive Correct Solution: ``` #------------------------template--------------------------# import os import sys from math import * from collections import * # from fractions import * from heapq import * from bisect import * from io import BytesIO, IOBas...
output
1
49,911
24
99,823
Provide tags and a correct Python 3 solution for this coding contest problem. This is an interactive problem. This is a hard version of the problem. The difference from the easy version is that in the hard version 1 ≀ t ≀ min(n, 10^4) and the total number of queries is limited to 6 β‹… 10^4. Polycarp is playing a comp...
instruction
0
49,912
24
99,824
Tags: binary search, constructive algorithms, data structures, interactive Correct Solution: ``` # 62 ms 6600 KB import sys n,t=map(int,input().split()) d={} for _ in range(t): k=int(input()) l=1; r=n; while l<r: m=(l+r)>>1 if (l,m) not in d: print("?",l,m) sys.stdout...
output
1
49,912
24
99,825
Provide tags and a correct Python 3 solution for this coding contest problem. This is an interactive problem. This is a hard version of the problem. The difference from the easy version is that in the hard version 1 ≀ t ≀ min(n, 10^4) and the total number of queries is limited to 6 β‹… 10^4. Polycarp is playing a comp...
instruction
0
49,913
24
99,826
Tags: binary search, constructive algorithms, data structures, interactive Correct Solution: ``` n, t = map(int, input().split()) mem = {} for _ in range(t): k = int(input()) left, right = 1, n while right > left: mid = (left + right) // 2 if (left, mid) not in mem: print(f'? ...
output
1
49,913
24
99,827
Provide tags and a correct Python 3 solution for this coding contest problem. This is an interactive problem. This is a hard version of the problem. The difference from the easy version is that in the hard version 1 ≀ t ≀ min(n, 10^4) and the total number of queries is limited to 6 β‹… 10^4. Polycarp is playing a comp...
instruction
0
49,914
24
99,828
Tags: binary search, constructive algorithms, data structures, interactive Correct Solution: ``` import sys n,t=map(int,input().split()) mem={} for _ in range(t): k=int(input()) l,r=1,n while l<r: mid=(l+r)//2 if (l,mid) not in mem: print('?',l,mid) sys.stdout.flush(...
output
1
49,914
24
99,829
Provide tags and a correct Python 3 solution for this coding contest problem. This is an interactive problem. This is a hard version of the problem. The difference from the easy version is that in the hard version 1 ≀ t ≀ min(n, 10^4) and the total number of queries is limited to 6 β‹… 10^4. Polycarp is playing a comp...
instruction
0
49,915
24
99,830
Tags: binary search, constructive algorithms, data structures, interactive Correct Solution: ``` import sys input = sys.stdin.buffer.readline from bisect import bisect_left def query(l,r): print(f"? {l} {r}") sys.stdout.flush() return int(input()) def found(i): print(f"! {i}") sys.stdout.flush() ...
output
1
49,915
24
99,831
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. This is an interactive problem. This is a hard version of the problem. The difference from the easy version is that in the hard version 1 ≀ t ≀ min(n, 10^4) and the total number of queries is l...
instruction
0
49,916
24
99,832
Yes
output
1
49,916
24
99,833
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. This is an interactive problem. This is a hard version of the problem. The difference from the easy version is that in the hard version 1 ≀ t ≀ min(n, 10^4) and the total number of queries is l...
instruction
0
49,917
24
99,834
Yes
output
1
49,917
24
99,835
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. This is an interactive problem. This is a hard version of the problem. The difference from the easy version is that in the hard version 1 ≀ t ≀ min(n, 10^4) and the total number of queries is l...
instruction
0
49,918
24
99,836
Yes
output
1
49,918
24
99,837
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. This is an interactive problem. This is a hard version of the problem. The difference from the easy version is that in the hard version 1 ≀ t ≀ min(n, 10^4) and the total number of queries is l...
instruction
0
49,919
24
99,838
Yes
output
1
49,919
24
99,839
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. This is an interactive problem. This is a hard version of the problem. The difference from the easy version is that in the hard version 1 ≀ t ≀ min(n, 10^4) and the total number of queries is l...
instruction
0
49,920
24
99,840
No
output
1
49,920
24
99,841
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. This is an interactive problem. This is a hard version of the problem. The difference from the easy version is that in the hard version 1 ≀ t ≀ min(n, 10^4) and the total number of queries is l...
instruction
0
49,921
24
99,842
No
output
1
49,921
24
99,843
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. This is an interactive problem. This is a hard version of the problem. The difference from the easy version is that in the hard version 1 ≀ t ≀ min(n, 10^4) and the total number of queries is l...
instruction
0
49,922
24
99,844
No
output
1
49,922
24
99,845
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. This is an interactive problem. This is a hard version of the problem. The difference from the easy version is that in the hard version 1 ≀ t ≀ min(n, 10^4) and the total number of queries is l...
instruction
0
49,923
24
99,846
No
output
1
49,923
24
99,847
Provide tags and a correct Python 3 solution for this coding contest problem. Some large corporation where Polycarpus works has its own short message service center (SMSC). The center's task is to send all sorts of crucial information. Polycarpus decided to check the efficiency of the SMSC. For that, he asked to giv...
instruction
0
49,960
24
99,920
Tags: implementation Correct Solution: ``` r = lambda: int(input()) ra = lambda: [*map(int, input().split())] a = [] t, q, mq, s = 0, 0, 0, 0 n = r() for i in range(n): a.append(ra()) for i in range(n): if i==0: q = a[i][1] t = a[i][0] else: s = a[i][0] - t q-=s if q<...
output
1
49,960
24
99,921
Provide tags and a correct Python 3 solution for this coding contest problem. Some large corporation where Polycarpus works has its own short message service center (SMSC). The center's task is to send all sorts of crucial information. Polycarpus decided to check the efficiency of the SMSC. For that, he asked to giv...
instruction
0
49,961
24
99,922
Tags: implementation Correct Solution: ``` n = int(input()) ans, p, s = 0, 0, 0 for i in range(n): t, c = map(int, input().split()) s -= min(s, t - p) p = t s += c if s > ans: ans = s print(p + s, ans) ```
output
1
49,961
24
99,923
Provide tags and a correct Python 3 solution for this coding contest problem. Some large corporation where Polycarpus works has its own short message service center (SMSC). The center's task is to send all sorts of crucial information. Polycarpus decided to check the efficiency of the SMSC. For that, he asked to giv...
instruction
0
49,962
24
99,924
Tags: implementation Correct Solution: ``` n = int(input()) message = 0 m = 0 l = 0 for _ in range(n): t, c = map(int, input().split()) message = max(0, message-(t-l)) message += c m = max(message, m) l = t print(l+message, m) ```
output
1
49,962
24
99,925
Provide tags and a correct Python 3 solution for this coding contest problem. Some large corporation where Polycarpus works has its own short message service center (SMSC). The center's task is to send all sorts of crucial information. Polycarpus decided to check the efficiency of the SMSC. For that, he asked to giv...
instruction
0
49,963
24
99,926
Tags: implementation Correct Solution: ``` import sys import math n = int(input()) a, b = list(map(int, input().split())) vmax = b for i in range(1, n): c, d = list(map(int, input().split())) b = max(0, b - (c - a)) a = c b += d vmax = max(b, vmax) print(a + b, vmax) ```
output
1
49,963
24
99,927
Provide tags and a correct Python 3 solution for this coding contest problem. Some large corporation where Polycarpus works has its own short message service center (SMSC). The center's task is to send all sorts of crucial information. Polycarpus decided to check the efficiency of the SMSC. For that, he asked to giv...
instruction
0
49,964
24
99,928
Tags: implementation Correct Solution: ``` n = int(input()) ct = 0 cq = 0 mcq = 0 for i in range(n): t, c = map(int, input().split()) mcq = max(cq, mcq) cq = max(cq - (t - ct), 0) cq += c ct = t #print(cq) mcq = max(cq, mcq) ct += cq print(ct, mcq) ```
output
1
49,964
24
99,929
Provide tags and a correct Python 3 solution for this coding contest problem. Some large corporation where Polycarpus works has its own short message service center (SMSC). The center's task is to send all sorts of crucial information. Polycarpus decided to check the efficiency of the SMSC. For that, he asked to giv...
instruction
0
49,965
24
99,930
Tags: implementation Correct Solution: ``` import re import itertools from collections import Counter, deque class Task: tasks = [] answer = "" def getData(self): numberOfTasks = int(input()) for i in range(0, numberOfTasks): self.tasks += [[int(x) for x in input().split(' ')...
output
1
49,965
24
99,931
Provide tags and a correct Python 3 solution for this coding contest problem. Some large corporation where Polycarpus works has its own short message service center (SMSC). The center's task is to send all sorts of crucial information. Polycarpus decided to check the efficiency of the SMSC. For that, he asked to giv...
instruction
0
49,966
24
99,932
Tags: implementation Correct Solution: ``` import sys import math #to read string get_string = lambda: sys.stdin.readline().strip() #to read list of integers get_int_list = lambda: list( map(int,sys.stdin.readline().strip().split()) ) #to read integers get_int = lambda: int(sys.stdin.readline()) #to print fast pt = la...
output
1
49,966
24
99,933
Provide tags and a correct Python 3 solution for this coding contest problem. Some large corporation where Polycarpus works has its own short message service center (SMSC). The center's task is to send all sorts of crucial information. Polycarpus decided to check the efficiency of the SMSC. For that, he asked to giv...
instruction
0
49,967
24
99,934
Tags: implementation Correct Solution: ``` import math n = int(input()) q = 0 time = 0 high = 0 for _ in range(n): recv, count = map(int, input().split()) if q > 0: q = max( q - (recv-time), 0) q += count high = max(high, q) time = recv print(time+q,high) ```
output
1
49,967
24
99,935
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Some large corporation where Polycarpus works has its own short message service center (SMSC). The center's task is to send all sorts of crucial information. Polycarpus decided to check the effi...
instruction
0
49,968
24
99,936
Yes
output
1
49,968
24
99,937
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Some large corporation where Polycarpus works has its own short message service center (SMSC). The center's task is to send all sorts of crucial information. Polycarpus decided to check the effi...
instruction
0
49,969
24
99,938
Yes
output
1
49,969
24
99,939
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Some large corporation where Polycarpus works has its own short message service center (SMSC). The center's task is to send all sorts of crucial information. Polycarpus decided to check the effi...
instruction
0
49,970
24
99,940
Yes
output
1
49,970
24
99,941
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Some large corporation where Polycarpus works has its own short message service center (SMSC). The center's task is to send all sorts of crucial information. Polycarpus decided to check the effi...
instruction
0
49,971
24
99,942
Yes
output
1
49,971
24
99,943
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Some large corporation where Polycarpus works has its own short message service center (SMSC). The center's task is to send all sorts of crucial information. Polycarpus decided to check the effi...
instruction
0
49,972
24
99,944
No
output
1
49,972
24
99,945
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Some large corporation where Polycarpus works has its own short message service center (SMSC). The center's task is to send all sorts of crucial information. Polycarpus decided to check the effi...
instruction
0
49,973
24
99,946
No
output
1
49,973
24
99,947
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Some large corporation where Polycarpus works has its own short message service center (SMSC). The center's task is to send all sorts of crucial information. Polycarpus decided to check the effi...
instruction
0
49,974
24
99,948
No
output
1
49,974
24
99,949
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Some large corporation where Polycarpus works has its own short message service center (SMSC). The center's task is to send all sorts of crucial information. Polycarpus decided to check the effi...
instruction
0
49,975
24
99,950
No
output
1
49,975
24
99,951
Provide tags and a correct Python 3 solution for this coding contest problem. Polycarp likes arithmetic progressions. A sequence [a_1, a_2, ..., a_n] is called an arithmetic progression if for each i (1 ≀ i < n) the value a_{i+1} - a_i is the same. For example, the sequences [42], [5, 5, 5], [2, 11, 20, 29] and [3, 2,...
instruction
0
50,233
24
100,466
Tags: brute force, implementation, math Correct Solution: ``` n=int(input()) a=list(map(int,input().split())) if n<=2: print(0) else: q=[] for i in range(-1,2): for j in range(-1,2): b=a[:] count=abs(i)+abs(j) b[0]+=i b[1]+=j flag=False ...
output
1
50,233
24
100,467
Provide tags and a correct Python 3 solution for this coding contest problem. Polycarp likes arithmetic progressions. A sequence [a_1, a_2, ..., a_n] is called an arithmetic progression if for each i (1 ≀ i < n) the value a_{i+1} - a_i is the same. For example, the sequences [42], [5, 5, 5], [2, 11, 20, 29] and [3, 2,...
instruction
0
50,234
24
100,468
Tags: brute force, implementation, math Correct Solution: ``` # -*- coding: utf-8 -*- """ Created on Wed Sep 4 15:16:08 2019 @author: IV_Ernst """ def main(): n = int(input()) bs = list( map(int, input().split(' '))) if n < 3: print(0) return mincount = n + 1 for c0 ...
output
1
50,234
24
100,469
Provide tags and a correct Python 3 solution for this coding contest problem. Polycarp likes arithmetic progressions. A sequence [a_1, a_2, ..., a_n] is called an arithmetic progression if for each i (1 ≀ i < n) the value a_{i+1} - a_i is the same. For example, the sequences [42], [5, 5, 5], [2, 11, 20, 29] and [3, 2,...
instruction
0
50,235
24
100,470
Tags: brute force, implementation, math Correct Solution: ``` import math n = int(input()) lst = list(map(int,input().split())) fin_ans = int(1e9) if n<=2: print(0) else: for el1 in range(lst[0]-1,lst[0]+2): for el2 in range(lst[1]-1,lst[1]+2): ans = abs(el1-lst[0])+abs(el2-lst[1]) ...
output
1
50,235
24
100,471
Provide tags and a correct Python 3 solution for this coding contest problem. Polycarp likes arithmetic progressions. A sequence [a_1, a_2, ..., a_n] is called an arithmetic progression if for each i (1 ≀ i < n) the value a_{i+1} - a_i is the same. For example, the sequences [42], [5, 5, 5], [2, 11, 20, 29] and [3, 2,...
instruction
0
50,236
24
100,472
Tags: brute force, implementation, math Correct Solution: ``` n=int(input()) b=list(map(int,input().split())) lo=n+1 if n<=2: print(0) quit() for i in range(-1,2): for j in range(-1,2): bol,c=1,0 if (b[0]+i-b[n-1]-j)%(n-1): continue d=-(b[0]+i-b[n-1]-j)//(n-1) for...
output
1
50,236
24
100,473
Provide tags and a correct Python 3 solution for this coding contest problem. Polycarp likes arithmetic progressions. A sequence [a_1, a_2, ..., a_n] is called an arithmetic progression if for each i (1 ≀ i < n) the value a_{i+1} - a_i is the same. For example, the sequences [42], [5, 5, 5], [2, 11, 20, 29] and [3, 2,...
instruction
0
50,237
24
100,474
Tags: brute force, implementation, math Correct Solution: ``` import sys input = sys.stdin.readline ''' a1, a2 a1+1, a2 a1+1, a2-1 a1+1, a2+1 ''' def sim(n, b, d): cur = b[0] count = 0 for i in range(1, n): cur += d diff = abs(b[i]-cur) if diff == 0: continue ...
output
1
50,237
24
100,475
Provide tags and a correct Python 3 solution for this coding contest problem. Polycarp likes arithmetic progressions. A sequence [a_1, a_2, ..., a_n] is called an arithmetic progression if for each i (1 ≀ i < n) the value a_{i+1} - a_i is the same. For example, the sequences [42], [5, 5, 5], [2, 11, 20, 29] and [3, 2,...
instruction
0
50,238
24
100,476
Tags: brute force, implementation, math Correct Solution: ``` from sys import stdin, stdout from sys import maxsize #input = stdin.readline().strip def solve(a, n): # print(a) d = (a[-1]-a[0])//(n-1) m = set({-1, 0, 1}) count = 0 for i in range(n-2): if(a[i]+d-a[i+1] in m): if(...
output
1
50,238
24
100,477
Provide tags and a correct Python 3 solution for this coding contest problem. Polycarp likes arithmetic progressions. A sequence [a_1, a_2, ..., a_n] is called an arithmetic progression if for each i (1 ≀ i < n) the value a_{i+1} - a_i is the same. For example, the sequences [42], [5, 5, 5], [2, 11, 20, 29] and [3, 2,...
instruction
0
50,239
24
100,478
Tags: brute force, implementation, math Correct Solution: ``` def solve(n, a): if n <= 2: return 0 d = [v - u for u, v in zip(a, a[1:])] max_d = max(d) min_d = min(d) if max_d - min_d > 4: return -1 min_cnt = -1 for d in range(min_d, max_d + 1): for d0 in range(-1, 2): y = a[0] + d0 valid = True ...
output
1
50,239
24
100,479
Provide tags and a correct Python 3 solution for this coding contest problem. Polycarp likes arithmetic progressions. A sequence [a_1, a_2, ..., a_n] is called an arithmetic progression if for each i (1 ≀ i < n) the value a_{i+1} - a_i is the same. For example, the sequences [42], [5, 5, 5], [2, 11, 20, 29] and [3, 2,...
instruction
0
50,240
24
100,480
Tags: brute force, implementation, math Correct Solution: ``` n = int(input()) lis = list(map(int,input().split())) if n==1: print(0) exit() tmp=[-1,0,1] fin=1000000000000 for i in tmp: for j in tmp: arr=lis[:] arr[0]+=i arr[1]+=j dif=(arr[1])-(arr[0]) ans=0 i...
output
1
50,240
24
100,481
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Polycarp likes arithmetic progressions. A sequence [a_1, a_2, ..., a_n] is called an arithmetic progression if for each i (1 ≀ i < n) the value a_{i+1} - a_i is the same. For example, the sequen...
instruction
0
50,241
24
100,482
Yes
output
1
50,241
24
100,483
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Polycarp likes arithmetic progressions. A sequence [a_1, a_2, ..., a_n] is called an arithmetic progression if for each i (1 ≀ i < n) the value a_{i+1} - a_i is the same. For example, the sequen...
instruction
0
50,242
24
100,484
Yes
output
1
50,242
24
100,485
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Polycarp likes arithmetic progressions. A sequence [a_1, a_2, ..., a_n] is called an arithmetic progression if for each i (1 ≀ i < n) the value a_{i+1} - a_i is the same. For example, the sequen...
instruction
0
50,243
24
100,486
Yes
output
1
50,243
24
100,487
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Polycarp likes arithmetic progressions. A sequence [a_1, a_2, ..., a_n] is called an arithmetic progression if for each i (1 ≀ i < n) the value a_{i+1} - a_i is the same. For example, the sequen...
instruction
0
50,244
24
100,488
Yes
output
1
50,244
24
100,489
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Polycarp likes arithmetic progressions. A sequence [a_1, a_2, ..., a_n] is called an arithmetic progression if for each i (1 ≀ i < n) the value a_{i+1} - a_i is the same. For example, the sequen...
instruction
0
50,245
24
100,490
No
output
1
50,245
24
100,491
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Polycarp likes arithmetic progressions. A sequence [a_1, a_2, ..., a_n] is called an arithmetic progression if for each i (1 ≀ i < n) the value a_{i+1} - a_i is the same. For example, the sequen...
instruction
0
50,246
24
100,492
No
output
1
50,246
24
100,493
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Polycarp likes arithmetic progressions. A sequence [a_1, a_2, ..., a_n] is called an arithmetic progression if for each i (1 ≀ i < n) the value a_{i+1} - a_i is the same. For example, the sequen...
instruction
0
50,247
24
100,494
No
output
1
50,247
24
100,495
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Polycarp likes arithmetic progressions. A sequence [a_1, a_2, ..., a_n] is called an arithmetic progression if for each i (1 ≀ i < n) the value a_{i+1} - a_i is the same. For example, the sequen...
instruction
0
50,248
24
100,496
No
output
1
50,248
24
100,497
Provide tags and a correct Python 3 solution for this coding contest problem. Polycarpus has postcards and photos hung in a row on the wall. He decided to put them away to the closet and hang on the wall a famous painter's picture. Polycarpus does it like that: he goes from the left to the right and removes the object...
instruction
0
50,655
24
101,310
Tags: implementation Correct Solution: ``` s = input().split()[0] cur = s[0] curn = 0 res = 0 i = 0 #for i in range(len(s)): while i < len(s): if curn == 5: curn = 0 res += 1 i -= 1 else: if s[i] == cur: curn += 1 else: if curn != 0: ...
output
1
50,655
24
101,311
Provide tags and a correct Python 3 solution for this coding contest problem. Polycarpus has postcards and photos hung in a row on the wall. He decided to put them away to the closet and hang on the wall a famous painter's picture. Polycarpus does it like that: he goes from the left to the right and removes the object...
instruction
0
50,656
24
101,312
Tags: implementation Correct Solution: ``` a=list(input()) r=a[0] count=1 i=0 for j in a: if i==5 or j!=r: count+=1; i=1; r=j else: i+=1 print(count) ```
output
1
50,656
24
101,313
Provide tags and a correct Python 3 solution for this coding contest problem. Polycarpus has postcards and photos hung in a row on the wall. He decided to put them away to the closet and hang on the wall a famous painter's picture. Polycarpus does it like that: he goes from the left to the right and removes the object...
instruction
0
50,657
24
101,314
Tags: implementation Correct Solution: ``` s=input() p="w" k=0 k1=1 for x in s : if x!=p : k+=1 k1=1 p=x else : k1+=1 if k1==6 : k+=1 k1=1 p=x print(k) ```
output
1
50,657
24
101,315