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
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Polycarpus has recently got interested in sequences of pseudorandom numbers. He learned that many programming languages generate such sequences in a similar way: <image> (for i β‰₯ 1). Here a, b, ...
instruction
0
48,179
24
96,358
No
output
1
48,179
24
96,359
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Polycarpus has recently got interested in sequences of pseudorandom numbers. He learned that many programming languages generate such sequences in a similar way: <image> (for i β‰₯ 1). Here a, b, ...
instruction
0
48,180
24
96,360
No
output
1
48,180
24
96,361
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Polycarpus has recently got interested in sequences of pseudorandom numbers. He learned that many programming languages generate such sequences in a similar way: <image> (for i β‰₯ 1). Here a, b, ...
instruction
0
48,181
24
96,362
No
output
1
48,181
24
96,363
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Polycarpus has recently got interested in sequences of pseudorandom numbers. He learned that many programming languages generate such sequences in a similar way: <image> (for i β‰₯ 1). Here a, b, ...
instruction
0
48,182
24
96,364
No
output
1
48,182
24
96,365
Provide tags and a correct Python 3 solution for this coding contest problem. Polycarp is writing the prototype of a graphic editor. He has already made up his mind that the basic image transformations in his editor will be: rotate the image 90 degrees clockwise, flip the image horizontally (symmetry relative to the v...
instruction
0
48,318
24
96,636
Tags: *special, implementation Correct Solution: ``` n,m=map(int,input().split()) array=[] array1=[] array2=[] for i in range(m): s=input() array+=[s] for j in range(n): s='' for i in range(m): s+=array[i][j] array1+=[s] array2+=[s] q=len(array1) array=[] for i in range(q): array+=[a...
output
1
48,318
24
96,637
Provide tags and a correct Python 3 solution for this coding contest problem. Polycarp is writing the prototype of a graphic editor. He has already made up his mind that the basic image transformations in his editor will be: rotate the image 90 degrees clockwise, flip the image horizontally (symmetry relative to the v...
instruction
0
48,319
24
96,638
Tags: *special, implementation Correct Solution: ``` s=input() w=int(s.split()[0]) h=int(s.split()[1]) L=[] L2=[] s2='' for i in(range(h)): L.append(input()) for i in(range(w)): for k in(range(h-1,-1,-1)): s2=s2+L[k][i] L2.append(s2) s2='' L3=[] s3='' for i in((range(w))): ...
output
1
48,319
24
96,639
Provide tags and a correct Python 3 solution for this coding contest problem. Polycarp is writing the prototype of a graphic editor. He has already made up his mind that the basic image transformations in his editor will be: rotate the image 90 degrees clockwise, flip the image horizontally (symmetry relative to the v...
instruction
0
48,320
24
96,640
Tags: *special, implementation Correct Solution: ``` #!/usr/bin/python3 w, h = map(int, input().split()) arr = [list(input()) for i in range(h)] rotated_and_mirrored = [[arr[i][j] for i in range(h)] for j in range(w)] ans = [["" for i in range(2 * h)] for j in range(2 * w)] for i in range(w): for j in range(h):...
output
1
48,320
24
96,641
Provide tags and a correct Python 3 solution for this coding contest problem. Polycarp is writing the prototype of a graphic editor. He has already made up his mind that the basic image transformations in his editor will be: rotate the image 90 degrees clockwise, flip the image horizontally (symmetry relative to the v...
instruction
0
48,321
24
96,642
Tags: *special, implementation Correct Solution: ``` class Image(object): def __init__ (self, width, height, stringImage): self._width = width self._height = height self._stringImage = stringImage self._pixelMatrix = [[]] # filling pixel matrix line = 0 ...
output
1
48,321
24
96,643
Provide tags and a correct Python 3 solution for this coding contest problem. Polycarp is writing the prototype of a graphic editor. He has already made up his mind that the basic image transformations in his editor will be: rotate the image 90 degrees clockwise, flip the image horizontally (symmetry relative to the v...
instruction
0
48,322
24
96,644
Tags: *special, implementation Correct Solution: ``` w, h = map( int, input( ).split( ) ) stgs = [ ] for i in range( h ): stgs.append( input( ) ) m = [0] * h for i in range(h): m[i] = [0] * w for i in range( h ): for j in range( w ): m[ i ][ j ] = stgs[ i ][ j ] for i in range( h ): m[ i ]....
output
1
48,322
24
96,645
Provide tags and a correct Python 3 solution for this coding contest problem. Polycarp is writing the prototype of a graphic editor. He has already made up his mind that the basic image transformations in his editor will be: rotate the image 90 degrees clockwise, flip the image horizontally (symmetry relative to the v...
instruction
0
48,323
24
96,646
Tags: *special, implementation Correct Solution: ``` W, H = map( int, input().split() ) mat = [ input() for i in range( H ) ] for i in range( 2 * W ): print( ''.join( mat[ j // 2 ][ i // 2 ] for j in range( 2 * H ) ) ) ```
output
1
48,323
24
96,647
Provide tags and a correct Python 3 solution for this coding contest problem. Polycarp is writing the prototype of a graphic editor. He has already made up his mind that the basic image transformations in his editor will be: rotate the image 90 degrees clockwise, flip the image horizontally (symmetry relative to the v...
instruction
0
48,324
24
96,648
Tags: *special, implementation Correct Solution: ``` w, h = map(int, input().split()) a = [] for i in range(h): a.append(input()) b = [[None]*(2*h) for _ in range(2*w)] for i in range(w): for j in range(h): b[2*i ][2*j ] = a[j][i] b[2*i ][2*j+1] = a[j][i] b[2*i+1][2*j ] = a[j][i] b[2*i+1][2*j+1] = a[j][i]...
output
1
48,324
24
96,649
Provide tags and a correct Python 3 solution for this coding contest problem. Polycarp is writing the prototype of a graphic editor. He has already made up his mind that the basic image transformations in his editor will be: rotate the image 90 degrees clockwise, flip the image horizontally (symmetry relative to the v...
instruction
0
48,325
24
96,650
Tags: *special, implementation Correct Solution: ``` I=input R=range w,h=map(int,I().split()) t=[I()for _ in R(h)] for r in[[t[i][j]*2for i in R(h)]for j in R(w)]:s=''.join(r);print(s+'\n'+s) ```
output
1
48,325
24
96,651
Provide tags and a correct Python 3 solution for this coding contest problem. Monocarp and Polycarp are working as waiters in Berpizza, a pizzeria located near the center of Bertown. Since they are waiters, their job is to serve the customers, but they choose whom they serve first differently. At the start of the wor...
instruction
0
49,042
24
98,084
Tags: data structures, implementation Correct Solution: ``` # -*- coding: utf-8 -*- """ Created on Sat Jan 16 10:58:05 2021 @author: ludoj klanten=[] res=[] tel=1 for a in range(q): if len(b[a])==2: klanten.append((b[a][1],tel)) tel+=1 if b[a][0]==2: res.append(klanten.pop(0)[1]) if...
output
1
49,042
24
98,085
Provide tags and a correct Python 3 solution for this coding contest problem. Monocarp and Polycarp are working as waiters in Berpizza, a pizzeria located near the center of Bertown. Since they are waiters, their job is to serve the customers, but they choose whom they serve first differently. At the start of the wor...
instruction
0
49,043
24
98,086
Tags: data structures, implementation Correct Solution: ``` import re import sys exit=sys.exit from bisect import bisect_left as bsl,bisect_right as bsr from collections import Counter,defaultdict as ddict,deque from functools import lru_cache cache=lru_cache(None) from heapq import * from itertools import * from math ...
output
1
49,043
24
98,087
Provide tags and a correct Python 3 solution for this coding contest problem. Monocarp and Polycarp are working as waiters in Berpizza, a pizzeria located near the center of Bertown. Since they are waiters, their job is to serve the customers, but they choose whom they serve first differently. At the start of the wor...
instruction
0
49,044
24
98,088
Tags: data structures, implementation Correct Solution: ``` from sys import stdin, stdout def insert(ID): heap.append(ID) i = len(heap)-1 while (i - 1) // 2 >= 0 and (score[heap[(i - 1) // 2]] < score[heap[i]] or ( score[heap[(i - 1) // 2]] == score[heap[i]] and heap[i] < heap[(i - 1) // 2])):...
output
1
49,044
24
98,089
Provide tags and a correct Python 3 solution for this coding contest problem. Monocarp and Polycarp are working as waiters in Berpizza, a pizzeria located near the center of Bertown. Since they are waiters, their job is to serve the customers, but they choose whom they serve first differently. At the start of the wor...
instruction
0
49,045
24
98,090
Tags: data structures, implementation Correct Solution: ``` # from __future__ import print_function,division # range = xrange import sys input = sys.stdin.readline # sys.setrecursionlimit(10**9) from sys import stdin, stdout from collections import defaultdict, Counter,deque M = 10**9+7 import heapq def main(): n ...
output
1
49,045
24
98,091
Provide tags and a correct Python 3 solution for this coding contest problem. Monocarp and Polycarp are working as waiters in Berpizza, a pizzeria located near the center of Bertown. Since they are waiters, their job is to serve the customers, but they choose whom they serve first differently. At the start of the wor...
instruction
0
49,046
24
98,092
Tags: data structures, implementation Correct Solution: ``` from sys import stdin import heapq q = int(stdin.readline()) endlis = [] mono = 0 hq = [] ans = [] for loop in range(q): query = input() if query[0] == "1": tmp,m = map(int,query.split()) endlis.append(0) heapq.heappush(hq,...
output
1
49,046
24
98,093
Provide tags and a correct Python 3 solution for this coding contest problem. Monocarp and Polycarp are working as waiters in Berpizza, a pizzeria located near the center of Bertown. Since they are waiters, their job is to serve the customers, but they choose whom they serve first differently. At the start of the wor...
instruction
0
49,047
24
98,094
Tags: data structures, implementation Correct Solution: ``` from sys import stdin,stdout from heapq import heappop,heappush def main(): ans,visited,hp=[],[],[] start=0 for _ in range(int(stdin.readline())): q=stdin.readline() if q[0]=="1": _,v=map(int,q.split( )) vi...
output
1
49,047
24
98,095
Provide tags and a correct Python 3 solution for this coding contest problem. Monocarp and Polycarp are working as waiters in Berpizza, a pizzeria located near the center of Bertown. Since they are waiters, their job is to serve the customers, but they choose whom they serve first differently. At the start of the wor...
instruction
0
49,048
24
98,096
Tags: data structures, implementation Correct Solution: ``` import heapq def solution(n: int, arr: [[int]]) -> [int]: queue = [] heap = [] result = [] lastIndex = 0 for i in arr: if i[0] == 1: lastIndex += 1 element = [-i[1], lastIndex, False] queue.app...
output
1
49,048
24
98,097
Provide tags and a correct Python 3 solution for this coding contest problem. Monocarp and Polycarp are working as waiters in Berpizza, a pizzeria located near the center of Bertown. Since they are waiters, their job is to serve the customers, but they choose whom they serve first differently. At the start of the wor...
instruction
0
49,049
24
98,098
Tags: data structures, implementation Correct Solution: ``` import os import math import statistics import heapq true = True; false = False; # from collections import defaultdict, deque from functools import reduce is_dev = 'vscode' in os.environ if is_dev: inF = open('in.txt', 'r') outF = open('out.txt', '...
output
1
49,049
24
98,099
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Monocarp and Polycarp are working as waiters in Berpizza, a pizzeria located near the center of Bertown. Since they are waiters, their job is to serve the customers, but they choose whom they se...
instruction
0
49,050
24
98,100
Yes
output
1
49,050
24
98,101
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Monocarp and Polycarp are working as waiters in Berpizza, a pizzeria located near the center of Bertown. Since they are waiters, their job is to serve the customers, but they choose whom they se...
instruction
0
49,051
24
98,102
Yes
output
1
49,051
24
98,103
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Monocarp and Polycarp are working as waiters in Berpizza, a pizzeria located near the center of Bertown. Since they are waiters, their job is to serve the customers, but they choose whom they se...
instruction
0
49,052
24
98,104
Yes
output
1
49,052
24
98,105
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Monocarp and Polycarp are working as waiters in Berpizza, a pizzeria located near the center of Bertown. Since they are waiters, their job is to serve the customers, but they choose whom they se...
instruction
0
49,053
24
98,106
Yes
output
1
49,053
24
98,107
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Monocarp and Polycarp are working as waiters in Berpizza, a pizzeria located near the center of Bertown. Since they are waiters, their job is to serve the customers, but they choose whom they se...
instruction
0
49,054
24
98,108
No
output
1
49,054
24
98,109
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Monocarp and Polycarp are working as waiters in Berpizza, a pizzeria located near the center of Bertown. Since they are waiters, their job is to serve the customers, but they choose whom they se...
instruction
0
49,055
24
98,110
No
output
1
49,055
24
98,111
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Monocarp and Polycarp are working as waiters in Berpizza, a pizzeria located near the center of Bertown. Since they are waiters, their job is to serve the customers, but they choose whom they se...
instruction
0
49,056
24
98,112
No
output
1
49,056
24
98,113
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Monocarp and Polycarp are working as waiters in Berpizza, a pizzeria located near the center of Bertown. Since they are waiters, their job is to serve the customers, but they choose whom they se...
instruction
0
49,057
24
98,114
No
output
1
49,057
24
98,115
Provide tags and a correct Python 3 solution for this coding contest problem. Polycarp is a big lover of killing time in social networks. A page with a chatlist in his favourite network is made so that when a message is sent to some friend, his friend's chat rises to the very top of the page. The relative order of the...
instruction
0
49,268
24
98,536
Tags: *special, binary search, constructive algorithms, data structures, sortings Correct Solution: ``` n = int(input()) chat = {} for i in range(n): chat[input()] = i c = {} for i in chat.keys(): c[chat[i]] = i m = [] for i in sorted(list(c.keys()), reverse = True): m.append(c[i]) print(*m, sep = '\n') ``...
output
1
49,268
24
98,537
Provide tags and a correct Python 3 solution for this coding contest problem. Polycarp is a big lover of killing time in social networks. A page with a chatlist in his favourite network is made so that when a message is sent to some friend, his friend's chat rises to the very top of the page. The relative order of the...
instruction
0
49,269
24
98,538
Tags: *special, binary search, constructive algorithms, data structures, sortings Correct Solution: ``` n =int(input()) arr =[] for i in range(n): arr.append(input()) arr =arr[::-1] string =set() for a in arr: if (a not in string): string.add(a) print (a) ```
output
1
49,269
24
98,539
Provide tags and a correct Python 3 solution for this coding contest problem. Polycarp is a big lover of killing time in social networks. A page with a chatlist in his favourite network is made so that when a message is sent to some friend, his friend's chat rises to the very top of the page. The relative order of the...
instruction
0
49,270
24
98,540
Tags: *special, binary search, constructive algorithms, data structures, sortings Correct Solution: ``` t = int(input()) q = list() for i in range(t): n = (input()) q.append(n) s = set(q) while len(s) > 0: for j in q[::-1]: if j in s: print(j) s.remove(j) else: ...
output
1
49,270
24
98,541
Provide tags and a correct Python 3 solution for this coding contest problem. Polycarp is a big lover of killing time in social networks. A page with a chatlist in his favourite network is made so that when a message is sent to some friend, his friend's chat rises to the very top of the page. The relative order of the...
instruction
0
49,271
24
98,542
Tags: *special, binary search, constructive algorithms, data structures, sortings Correct Solution: ``` n = int(input()) displayed = {} top = None for i in range(n): chat = input() try: a = displayed[chat] previous = a[0] nextone = a[1] if previous: displayed[previous...
output
1
49,271
24
98,543
Provide tags and a correct Python 3 solution for this coding contest problem. Polycarp is a big lover of killing time in social networks. A page with a chatlist in his favourite network is made so that when a message is sent to some friend, his friend's chat rises to the very top of the page. The relative order of the...
instruction
0
49,272
24
98,544
Tags: *special, binary search, constructive algorithms, data structures, sortings Correct Solution: ``` import math,sys from sys import stdin, stdout from collections import Counter, defaultdict, deque input = stdin.readline I = lambda:int(input()) li = lambda:list(map(int,input().split())) def case(): n=I() a...
output
1
49,272
24
98,545
Provide tags and a correct Python 3 solution for this coding contest problem. Polycarp is a big lover of killing time in social networks. A page with a chatlist in his favourite network is made so that when a message is sent to some friend, his friend's chat rises to the very top of the page. The relative order of the...
instruction
0
49,273
24
98,546
Tags: *special, binary search, constructive algorithms, data structures, sortings Correct Solution: ``` n = int(input()) l = [] for _ in range(n): l.append(input()) answer = [] s = set() for i in range(n - 1, -1, -1): if l[i] not in s: s.add(l[i]) answer.append(l[i]) for _ in answer: print(_) ```
output
1
49,273
24
98,547
Provide tags and a correct Python 3 solution for this coding contest problem. Polycarp is a big lover of killing time in social networks. A page with a chatlist in his favourite network is made so that when a message is sent to some friend, his friend's chat rises to the very top of the page. The relative order of the...
instruction
0
49,274
24
98,548
Tags: *special, binary search, constructive algorithms, data structures, sortings Correct Solution: ``` n = int(input()) D = {} l = [] ll = [] for i in range(0,n): l.append(input()) for i in range(0,n): if l[n-i-1] in D: m = 0 else: D[l[n-i-1]] = 1 ll.append(l[n-1-i]) for i in range(...
output
1
49,274
24
98,549
Provide tags and a correct Python 3 solution for this coding contest problem. Polycarp is a big lover of killing time in social networks. A page with a chatlist in his favourite network is made so that when a message is sent to some friend, his friend's chat rises to the very top of the page. The relative order of the...
instruction
0
49,275
24
98,550
Tags: *special, binary search, constructive algorithms, data structures, sortings Correct Solution: ``` n=int(input()) m={} mm={} for i in range(n): a=input() m[a]=i for j in m: mm[m[j]]=j ans=sorted(mm.keys(),reverse=True) for i in ans: print(mm[i]) ```
output
1
49,275
24
98,551
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Polycarp is a big lover of killing time in social networks. A page with a chatlist in his favourite network is made so that when a message is sent to some friend, his friend's chat rises to the ...
instruction
0
49,276
24
98,552
Yes
output
1
49,276
24
98,553
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Polycarp is a big lover of killing time in social networks. A page with a chatlist in his favourite network is made so that when a message is sent to some friend, his friend's chat rises to the ...
instruction
0
49,277
24
98,554
Yes
output
1
49,277
24
98,555
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Polycarp is a big lover of killing time in social networks. A page with a chatlist in his favourite network is made so that when a message is sent to some friend, his friend's chat rises to the ...
instruction
0
49,278
24
98,556
Yes
output
1
49,278
24
98,557
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Polycarp is a big lover of killing time in social networks. A page with a chatlist in his favourite network is made so that when a message is sent to some friend, his friend's chat rises to the ...
instruction
0
49,279
24
98,558
Yes
output
1
49,279
24
98,559
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Polycarp is a big lover of killing time in social networks. A page with a chatlist in his favourite network is made so that when a message is sent to some friend, his friend's chat rises to the ...
instruction
0
49,280
24
98,560
No
output
1
49,280
24
98,561
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Polycarp is a big lover of killing time in social networks. A page with a chatlist in his favourite network is made so that when a message is sent to some friend, his friend's chat rises to the ...
instruction
0
49,281
24
98,562
No
output
1
49,281
24
98,563
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Polycarp is a big lover of killing time in social networks. A page with a chatlist in his favourite network is made so that when a message is sent to some friend, his friend's chat rises to the ...
instruction
0
49,282
24
98,564
No
output
1
49,282
24
98,565
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Polycarp is a big lover of killing time in social networks. A page with a chatlist in his favourite network is made so that when a message is sent to some friend, his friend's chat rises to the ...
instruction
0
49,283
24
98,566
No
output
1
49,283
24
98,567
Provide tags and a correct Python 3 solution for this coding contest problem. Polycarp is sad β€” New Year is coming in few days but there is still no snow in his city. To bring himself New Year mood, he decided to decorate his house with some garlands. The local store introduced a new service this year, called "Build ...
instruction
0
49,784
24
99,568
Tags: math Correct Solution: ``` t = int(input()) for _ in range(t): r, g, b = map(int, input().split()) r, g, b = sorted([r, g, b]) print('No' if b > r+g+1 else 'Yes') ```
output
1
49,784
24
99,569
Provide tags and a correct Python 3 solution for this coding contest problem. Polycarp is sad β€” New Year is coming in few days but there is still no snow in his city. To bring himself New Year mood, he decided to decorate his house with some garlands. The local store introduced a new service this year, called "Build ...
instruction
0
49,785
24
99,570
Tags: math Correct Solution: ``` T = int(input()) for i in range(T): a,b,c = map(int, input().split(' ')) print("Yes") if b+c >= a-1 and a+c>= b-1 and b+a>=c-1 else print("No") ```
output
1
49,785
24
99,571
Provide tags and a correct Python 3 solution for this coding contest problem. Polycarp is sad β€” New Year is coming in few days but there is still no snow in his city. To bring himself New Year mood, he decided to decorate his house with some garlands. The local store introduced a new service this year, called "Build ...
instruction
0
49,786
24
99,572
Tags: math Correct Solution: ``` def sol(l): m = -1 idx = 0 for i in range(3): if l[i] > m : m = l[i] idx = i sum = 0 piot = 0 for i in range(3): if idx != i : sum += l[i] if m - sum < 2: return 'Yes' return 'No' de...
output
1
49,786
24
99,573
Provide tags and a correct Python 3 solution for this coding contest problem. Polycarp is sad β€” New Year is coming in few days but there is still no snow in his city. To bring himself New Year mood, he decided to decorate his house with some garlands. The local store introduced a new service this year, called "Build ...
instruction
0
49,789
24
99,578
Tags: math Correct Solution: ``` t=int(input()) for i in range(t): p=list(map(int,input().split())) p.sort() if p[2]-1<=p[1]+p[0]:print('Yes') else: print('No') ```
output
1
49,789
24
99,579
Provide tags and a correct Python 3 solution for this coding contest problem. Polycarp is sad β€” New Year is coming in few days but there is still no snow in his city. To bring himself New Year mood, he decided to decorate his house with some garlands. The local store introduced a new service this year, called "Build ...
instruction
0
49,790
24
99,580
Tags: math Correct Solution: ``` for i in range (int(input())): r,g,b=map(int,input().split()) count=0 if(r>b+g+1): count+=1 if(b>g+r+1): count+=1 if(g>b+r+1): count+=1 if(count==0): print("YES") else: print("NO") ```
output
1
49,790
24
99,581
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,908
24
99,816
Tags: binary search, constructive algorithms, data structures, interactive Correct Solution: ``` import sys def ask_query(l, r): print ("?", l+1, r+1) sys.stdout.flush() return int(input()) def check(low, mid): return mid - low + 1 - ask_query(low, mid) d = {} n, t = map(int,input().split()) for nt in range(t): ...
output
1
49,908
24
99,817