message
stringlengths
2
48.6k
message_type
stringclasses
2 values
message_id
int64
0
1
conversation_id
int64
318
108k
cluster
float64
8
8
__index_level_0__
int64
636
217k
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Omkar is building a waterslide in his water park, and he needs your help to ensure that he does it as efficiently as possible. Omkar currently has n supports arranged in a line, the i-th of whi...
instruction
0
82,775
8
165,550
No
output
1
82,775
8
165,551
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Omkar is building a waterslide in his water park, and he needs your help to ensure that he does it as efficiently as possible. Omkar currently has n supports arranged in a line, the i-th of whi...
instruction
0
82,776
8
165,552
No
output
1
82,776
8
165,553
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. The city of D consists of n towers, built consecutively on a straight line. The height of the tower that goes i-th (from left to right) in the sequence equals hi. The city mayor decided to rebui...
instruction
0
82,852
8
165,704
No
output
1
82,852
8
165,705
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. The city of D consists of n towers, built consecutively on a straight line. The height of the tower that goes i-th (from left to right) in the sequence equals hi. The city mayor decided to rebui...
instruction
0
82,853
8
165,706
No
output
1
82,853
8
165,707
Provide tags and a correct Python 3 solution for this coding contest problem. A tourist hiked along the mountain range. The hike lasted for n days, during each day the tourist noted height above the sea level. On the i-th day height was equal to some integer hi. The tourist pick smooth enough route for his hike, meani...
instruction
0
82,958
8
165,916
Tags: binary search, brute force, greedy, implementation, math Correct Solution: ``` [n, k] = [int(x) for x in input().split()] Data = type('Data', (object,), {'index': 0, 'value': 0}) data = [Data() for _ in range(k)] for i in range(k): [data[i].index, data[i].value] = [int(x) for x in input().split()] data.sort...
output
1
82,958
8
165,917
Provide tags and a correct Python 3 solution for this coding contest problem. A tourist hiked along the mountain range. The hike lasted for n days, during each day the tourist noted height above the sea level. On the i-th day height was equal to some integer hi. The tourist pick smooth enough route for his hike, meani...
instruction
0
82,959
8
165,918
Tags: binary search, brute force, greedy, implementation, math Correct Solution: ``` def f(d1, h1, d2, h2): lo, hi = max(0, h1 - (d2-d1)), min(10**8, h1 + (d2-d1)) if h2 < lo or h2 > hi: return False, float('-inf') else: if h1 < h2: h1, d1 = h2, d1 + (h2-h1) elif h1 > h2:...
output
1
82,959
8
165,919
Provide tags and a correct Python 3 solution for this coding contest problem. A tourist hiked along the mountain range. The hike lasted for n days, during each day the tourist noted height above the sea level. On the i-th day height was equal to some integer hi. The tourist pick smooth enough route for his hike, meani...
instruction
0
82,960
8
165,920
Tags: binary search, brute force, greedy, implementation, math Correct Solution: ``` n, m = map(int, input().split(' ')) l = [list(map(int, input().split(' '))) for _ in range(m)] ans = max(l[0][0] + l[0][1] - 1, n - l[-1][0] + l[-1][1]) for i in range(1, m): dd, dh = abs(l[i][0] - l[i - 1][0]), abs(l[i][1] - l[i...
output
1
82,960
8
165,921
Provide tags and a correct Python 3 solution for this coding contest problem. A tourist hiked along the mountain range. The hike lasted for n days, during each day the tourist noted height above the sea level. On the i-th day height was equal to some integer hi. The tourist pick smooth enough route for his hike, meani...
instruction
0
82,961
8
165,922
Tags: binary search, brute force, greedy, implementation, math Correct Solution: ``` import sys n, m = map(int, str.split(sys.stdin.readline())) pd = ph = None top = None for _ in range(m): d, h = map(int, str.split(sys.stdin.readline())) if pd is None: top = d - 1 + h else: if pd and ...
output
1
82,961
8
165,923
Provide tags and a correct Python 3 solution for this coding contest problem. A tourist hiked along the mountain range. The hike lasted for n days, during each day the tourist noted height above the sea level. On the i-th day height was equal to some integer hi. The tourist pick smooth enough route for his hike, meani...
instruction
0
82,962
8
165,924
Tags: binary search, brute force, greedy, implementation, math Correct Solution: ``` n,m = map(int,input().split()) prevd,prevh = map(int,input().split()) maxi = (prevd-1)+prevh check = 0 for i in range(m-1): d,h = map(int,input().split()) if d-prevd>=abs(prevh-h): k = ((d-prevd)-(abs(prevh-h)))//2 ...
output
1
82,962
8
165,925
Provide tags and a correct Python 3 solution for this coding contest problem. A tourist hiked along the mountain range. The hike lasted for n days, during each day the tourist noted height above the sea level. On the i-th day height was equal to some integer hi. The tourist pick smooth enough route for his hike, meani...
instruction
0
82,963
8
165,926
Tags: binary search, brute force, greedy, implementation, math Correct Solution: ``` R = lambda: map(int, input().split()) n, m = R() ls = [tuple(R()) for _ in range(m)] res = max(ls[0][1] + ls[0][0] - 1, ls[-1][-1] + n - ls[-1][0]) for i in range(1, m): d, h = ls[i][0] - ls[i - 1][0], abs(ls[i][1] - ls[i - 1][1]) ...
output
1
82,963
8
165,927
Provide tags and a correct Python 3 solution for this coding contest problem. A tourist hiked along the mountain range. The hike lasted for n days, during each day the tourist noted height above the sea level. On the i-th day height was equal to some integer hi. The tourist pick smooth enough route for his hike, meani...
instruction
0
82,964
8
165,928
Tags: binary search, brute force, greedy, implementation, math Correct Solution: ``` def get(d1, h1, d2, h2): d_d = d2 - d1 if abs(h2 - h1) > d_d: return None res = (d_d - abs(h2 - h1)) // 2 + max(h1, h2) return res n,m = tuple(map(int, input().split())) l = [(0, 0)] * (m + 1) for i in range(1, m + 1):...
output
1
82,964
8
165,929
Provide tags and a correct Python 3 solution for this coding contest problem. A tourist hiked along the mountain range. The hike lasted for n days, during each day the tourist noted height above the sea level. On the i-th day height was equal to some integer hi. The tourist pick smooth enough route for his hike, meani...
instruction
0
82,965
8
165,930
Tags: binary search, brute force, greedy, implementation, math Correct Solution: ``` n,m = map(int, input().split()) max_height = 0 prev_d, prev_h = [0,0] for i in range(m) : d,h = map(int, input().split()) if(i == 0) : max_height = (d-1) + h prev_d = d prev_h = h #crap - fix this if(i == m-1) : max_hei...
output
1
82,965
8
165,931
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. A tourist hiked along the mountain range. The hike lasted for n days, during each day the tourist noted height above the sea level. On the i-th day height was equal to some integer hi. The touri...
instruction
0
82,966
8
165,932
Yes
output
1
82,966
8
165,933
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. A tourist hiked along the mountain range. The hike lasted for n days, during each day the tourist noted height above the sea level. On the i-th day height was equal to some integer hi. The touri...
instruction
0
82,967
8
165,934
Yes
output
1
82,967
8
165,935
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. A tourist hiked along the mountain range. The hike lasted for n days, during each day the tourist noted height above the sea level. On the i-th day height was equal to some integer hi. The touri...
instruction
0
82,968
8
165,936
Yes
output
1
82,968
8
165,937
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. A tourist hiked along the mountain range. The hike lasted for n days, during each day the tourist noted height above the sea level. On the i-th day height was equal to some integer hi. The touri...
instruction
0
82,969
8
165,938
Yes
output
1
82,969
8
165,939
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. A tourist hiked along the mountain range. The hike lasted for n days, during each day the tourist noted height above the sea level. On the i-th day height was equal to some integer hi. The touri...
instruction
0
82,970
8
165,940
No
output
1
82,970
8
165,941
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. A tourist hiked along the mountain range. The hike lasted for n days, during each day the tourist noted height above the sea level. On the i-th day height was equal to some integer hi. The touri...
instruction
0
82,971
8
165,942
No
output
1
82,971
8
165,943
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. A tourist hiked along the mountain range. The hike lasted for n days, during each day the tourist noted height above the sea level. On the i-th day height was equal to some integer hi. The touri...
instruction
0
82,972
8
165,944
No
output
1
82,972
8
165,945
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. A tourist hiked along the mountain range. The hike lasted for n days, during each day the tourist noted height above the sea level. On the i-th day height was equal to some integer hi. The touri...
instruction
0
82,973
8
165,946
No
output
1
82,973
8
165,947
Provide tags and a correct Python 3 solution for this coding contest problem. It is nighttime and Joe the Elusive got into the country's main bank's safe. The safe has n cells positioned in a row, each of them contains some amount of diamonds. Let's make the problem more comfortable to work with and mark the cells wit...
instruction
0
83,107
8
166,214
Tags: greedy Correct Solution: ``` n, m, k = map(int, input().split()) a = list(map(int, input().split())) if n % 2 == 0: print('0') else: print(min(m // (n // 2 + 1) * k, min(a[::2]))) # Made By Mostafa_Khaled ```
output
1
83,107
8
166,215
Provide tags and a correct Python 3 solution for this coding contest problem. It is nighttime and Joe the Elusive got into the country's main bank's safe. The safe has n cells positioned in a row, each of them contains some amount of diamonds. Let's make the problem more comfortable to work with and mark the cells wit...
instruction
0
83,108
8
166,216
Tags: greedy Correct Solution: ``` n,m,k=map(int,input().split()) a=[int(x) for x in input().split()] if n%2==0: print(0) else: print(min( min(a[::2]), m//(n//2+1)*k)) ```
output
1
83,108
8
166,217
Provide tags and a correct Python 3 solution for this coding contest problem. It is nighttime and Joe the Elusive got into the country's main bank's safe. The safe has n cells positioned in a row, each of them contains some amount of diamonds. Let's make the problem more comfortable to work with and mark the cells wit...
instruction
0
83,109
8
166,218
Tags: greedy Correct Solution: ``` #------------------------template--------------------------# import os import sys from math import * from collections import * from fractions import * from bisect import * from heapq import* from io import BytesIO, IOBase def vsInput(): sys.stdin = open('input.txt', 'r') sys.s...
output
1
83,109
8
166,219
Provide tags and a correct Python 3 solution for this coding contest problem. It is nighttime and Joe the Elusive got into the country's main bank's safe. The safe has n cells positioned in a row, each of them contains some amount of diamonds. Let's make the problem more comfortable to work with and mark the cells wit...
instruction
0
83,110
8
166,220
Tags: greedy Correct Solution: ``` import sys from array import array # noqa: F401 def input(): return sys.stdin.buffer.readline().decode('utf-8') n, m, k = map(int, input().split()) a = list(map(int, input().split())) if n == 1: print(min(a[0], m * k)) exit() if n % 2 == 0: print(0) exit() t...
output
1
83,110
8
166,221
Provide tags and a correct Python 3 solution for this coding contest problem. It is nighttime and Joe the Elusive got into the country's main bank's safe. The safe has n cells positioned in a row, each of them contains some amount of diamonds. Let's make the problem more comfortable to work with and mark the cells wit...
instruction
0
83,111
8
166,222
Tags: greedy Correct Solution: ``` n, m, k = map(int, input().split()) a = list(map(int, input().split())) if n % 2 == 0: print('0') else: print(min(m // (n // 2 + 1) * k, min(a[::2]))) ```
output
1
83,111
8
166,223
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. It is nighttime and Joe the Elusive got into the country's main bank's safe. The safe has n cells positioned in a row, each of them contains some amount of diamonds. Let's make the problem more ...
instruction
0
83,112
8
166,224
No
output
1
83,112
8
166,225
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. It is nighttime and Joe the Elusive got into the country's main bank's safe. The safe has n cells positioned in a row, each of them contains some amount of diamonds. Let's make the problem more ...
instruction
0
83,113
8
166,226
No
output
1
83,113
8
166,227
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. It is nighttime and Joe the Elusive got into the country's main bank's safe. The safe has n cells positioned in a row, each of them contains some amount of diamonds. Let's make the problem more ...
instruction
0
83,114
8
166,228
No
output
1
83,114
8
166,229
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. It is nighttime and Joe the Elusive got into the country's main bank's safe. The safe has n cells positioned in a row, each of them contains some amount of diamonds. Let's make the problem more ...
instruction
0
83,115
8
166,230
No
output
1
83,115
8
166,231
Provide tags and a correct Python 3 solution for this coding contest problem. Recently, Duff has been practicing weight lifting. As a hard practice, Malek gave her a task. He gave her a sequence of weights. Weight of i-th of them is 2wi pounds. In each step, Duff can lift some of the remaining weights and throw them a...
instruction
0
83,795
8
167,590
Tags: greedy Correct Solution: ``` N = int(1e6) + 20 n = int(input()) m = [0] * N k = 1e6 + 1 for x in map(int, input().split()): m[x] += 1 k = min(k, x) result = 0 while k < N - 1: v = m[k] m[k + 1] += v >> 1 result += v & 0x1 k += 1 print(result + m[-1]) ```
output
1
83,795
8
167,591
Provide tags and a correct Python 3 solution for this coding contest problem. Recently, Duff has been practicing weight lifting. As a hard practice, Malek gave her a task. He gave her a sequence of weights. Weight of i-th of them is 2wi pounds. In each step, Duff can lift some of the remaining weights and throw them a...
instruction
0
83,797
8
167,594
Tags: greedy Correct Solution: ``` from collections import * import sys import math from functools import reduce def factors(n): return set(reduce(list.__add__,([i, n//i] for i in range(1, int(n**0.5) + 1) if n % i == 0))) def li():return [int(i) for i in input().rstrip('\n').split(' ')] def st():return inpu...
output
1
83,797
8
167,595
Provide tags and a correct Python 3 solution for this coding contest problem. Recently, Duff has been practicing weight lifting. As a hard practice, Malek gave her a task. He gave her a sequence of weights. Weight of i-th of them is 2wi pounds. In each step, Duff can lift some of the remaining weights and throw them a...
instruction
0
83,802
8
167,604
Tags: greedy Correct Solution: ``` l=[0]*1100001 input() for i in map(int,input().split()):l[i]+=1 for i in range(1100000): l[i],l[i+1]=l[i]%2,l[i+1]+l[i]//2 print(sum(l)) ```
output
1
83,802
8
167,605
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Recently, Duff has been practicing weight lifting. As a hard practice, Malek gave her a task. He gave her a sequence of weights. Weight of i-th of them is 2wi pounds. In each step, Duff can lift...
instruction
0
83,805
8
167,610
Yes
output
1
83,805
8
167,611
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Recently, Duff has been practicing weight lifting. As a hard practice, Malek gave her a task. He gave her a sequence of weights. Weight of i-th of them is 2wi pounds. In each step, Duff can lift...
instruction
0
83,806
8
167,612
Yes
output
1
83,806
8
167,613
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Recently, Duff has been practicing weight lifting. As a hard practice, Malek gave her a task. He gave her a sequence of weights. Weight of i-th of them is 2wi pounds. In each step, Duff can lift...
instruction
0
83,808
8
167,616
No
output
1
83,808
8
167,617
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Recently, Duff has been practicing weight lifting. As a hard practice, Malek gave her a task. He gave her a sequence of weights. Weight of i-th of them is 2wi pounds. In each step, Duff can lift...
instruction
0
83,809
8
167,618
No
output
1
83,809
8
167,619
Provide a correct Python 3 solution for this coding contest problem. problem AOR Co., Ltd. (Association Of Return home) has $ N $ employees. Employee $ i $ wants to use the elevator to go down to the $ 1 $ floor and arrives in front of the elevator on the $ F_i $ floor at time $ t_i $. You decide to remotely control...
instruction
0
84,182
8
168,364
"Correct Solution: ``` # AOJ 2832 All Japan Association of Return home # Python3 2018.7.12 bal4u n, d = map(int, input().split()) ans = t0 = f0 = num = 0 for i in range(n): t, f = map(int, input().split()) f -= 1 df = f-f0 if df < 0: df = -df dt = t - t0 if dt < df: ans = -1; break if dt >= f0+f: ans += num*f...
output
1
84,182
8
168,365
Provide a correct Python 3 solution for this coding contest problem. problem AOR Co., Ltd. (Association Of Return home) has $ N $ employees. Employee $ i $ wants to use the elevator to go down to the $ 1 $ floor and arrives in front of the elevator on the $ F_i $ floor at time $ t_i $. You decide to remotely control...
instruction
0
84,183
8
168,366
"Correct Solution: ``` N, D = map(int, input().split()) time = 0 floor = 1 num = 0 result = 0 for _ in [0]*N: t, f = map(int, input().split()) if floor-1+f-1 <= t-time: result += num * (floor-1) num = 1 elif abs(floor-f) <= t-time and num < D: result += num * abs(t-time) num ...
output
1
84,183
8
168,367
Provide a correct Python 3 solution for this coding contest problem. problem AOR Co., Ltd. (Association Of Return home) has $ N $ employees. Employee $ i $ wants to use the elevator to go down to the $ 1 $ floor and arrives in front of the elevator on the $ F_i $ floor at time $ t_i $. You decide to remotely control...
instruction
0
84,184
8
168,368
"Correct Solution: ``` n, d = map(int, input().split()) lst = sorted([list(map(int, input().split())) for _ in range(n)]) + [[10 ** 20, 1]] cnt = 0 time = 0 floor = 1 ans = 0 for i in range(n): t, f = lst[i] if f - floor > t - time or cnt >= d: print(-1) break ans += cnt * (t - time) cnt += 1 time = ...
output
1
84,184
8
168,369
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. problem AOR Co., Ltd. (Association Of Return home) has $ N $ employees. Employee $ i $ wants to use the elevator to go down to the $ 1 $ floor and arrives in front of the elevator on the $ F_i...
instruction
0
84,185
8
168,370
No
output
1
84,185
8
168,371
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. problem AOR Co., Ltd. (Association Of Return home) has $ N $ employees. Employee $ i $ wants to use the elevator to go down to the $ 1 $ floor and arrives in front of the elevator on the $ F_i...
instruction
0
84,186
8
168,372
No
output
1
84,186
8
168,373
Provide tags and a correct Python 3 solution for this coding contest problem. You have got a shelf and want to put some books on it. You are given q queries of three types: 1. L id β€” put a book having index id on the shelf to the left from the leftmost existing book; 2. R id β€” put a book having index id on the ...
instruction
0
84,243
8
168,486
Tags: implementation Correct Solution: ``` n=int(input()) ln=0 rn=0 ids={} bel={} for i in range(n): s=input().split() op=s[0] id=int(s[1]) if op=='L' or op=='R': if op=='L': ln+=1 ids[id]=ln bel[id]='l' else: rn+=1 ids[id]=rn...
output
1
84,243
8
168,487
Provide tags and a correct Python 3 solution for this coding contest problem. You have got a shelf and want to put some books on it. You are given q queries of three types: 1. L id β€” put a book having index id on the shelf to the left from the leftmost existing book; 2. R id β€” put a book having index id on the ...
instruction
0
84,244
8
168,488
Tags: implementation Correct Solution: ``` n = int(input()) arr = {} mi = 0 ma = 0 t, i = input().split() arr[i] = 0 for _ in range(n-1): t, i = input().split() if t == 'L': mi -= 1 arr[i] = mi elif t == 'R': ma += 1 arr[i] = ma else: print(min(ma-arr[i], arr[i]-mi)) ```
output
1
84,244
8
168,489
Provide tags and a correct Python 3 solution for this coding contest problem. You have got a shelf and want to put some books on it. You are given q queries of three types: 1. L id β€” put a book having index id on the shelf to the left from the leftmost existing book; 2. R id β€” put a book having index id on the ...
instruction
0
84,245
8
168,490
Tags: implementation Correct Solution: ``` '''input 10 L 100 R 100000 R 123 L 101 ? 123 L 10 R 115 ? 100 R 110 ? 115 ''' from sys import stdin, stdout def myfunction(mydict, current, second): a = mydict[second] if a[2] == 'R': return min( current[1] - a[1], current[0] + a[1] - 1) else: return min(current[0] - ...
output
1
84,245
8
168,491
Provide tags and a correct Python 3 solution for this coding contest problem. You have got a shelf and want to put some books on it. You are given q queries of three types: 1. L id β€” put a book having index id on the shelf to the left from the leftmost existing book; 2. R id β€” put a book having index id on the ...
instruction
0
84,246
8
168,492
Tags: implementation Correct Solution: ``` l,r=1,0 d={} for _ in[0]*int(input()): o,i=input().split() if o=='L':l-=1;d[i]=l elif o=='R':r+=1;d[i]=r else:print(min(d[i]-l,r-d[i])) #JSR ```
output
1
84,246
8
168,493
Provide tags and a correct Python 3 solution for this coding contest problem. You have got a shelf and want to put some books on it. You are given q queries of three types: 1. L id β€” put a book having index id on the shelf to the left from the leftmost existing book; 2. R id β€” put a book having index id on the ...
instruction
0
84,247
8
168,494
Tags: implementation Correct Solution: ``` n = int(input()) s, e = 0, 0 c = True w = dict() for _ in range(n): q, d = input().split() if q == "R": if c: s += 1 c = False e += 1 w[d] = e elif q == "L": if c: e -= 1 c = False ...
output
1
84,247
8
168,495
Provide tags and a correct Python 3 solution for this coding contest problem. You have got a shelf and want to put some books on it. You are given q queries of three types: 1. L id β€” put a book having index id on the shelf to the left from the leftmost existing book; 2. R id β€” put a book having index id on the ...
instruction
0
84,248
8
168,496
Tags: implementation Correct Solution: ``` n = int(input()) L =[0]*(n+1) R = [0]*(n+1) S = [0] * (n+1) d = dict() A =[0]*(n+1) for j in range(1,n+1): c,val = input().split() A[j] = [c,int(val)] val = int(val) if(c=="L"): S[j]=1+S[j-1] L[j] = 1 + L[j - 1] R[j] = R[j - 1] ...
output
1
84,248
8
168,497
Provide tags and a correct Python 3 solution for this coding contest problem. You have got a shelf and want to put some books on it. You are given q queries of three types: 1. L id β€” put a book having index id on the shelf to the left from the leftmost existing book; 2. R id β€” put a book having index id on the ...
instruction
0
84,249
8
168,498
Tags: implementation Correct Solution: ``` import sys q = int(input()) l, r = -1, 1 pos = [0] * 200001 k = 0 for line in sys.stdin: t, a = line.split() a = int(a) if k == 0: pos[a] = 0 else: if t == 'L': pos[a] = l l -= 1 elif t == 'R': pos[a] ...
output
1
84,249
8
168,499
Provide tags and a correct Python 3 solution for this coding contest problem. You have got a shelf and want to put some books on it. You are given q queries of three types: 1. L id β€” put a book having index id on the shelf to the left from the leftmost existing book; 2. R id β€” put a book having index id on the ...
instruction
0
84,250
8
168,500
Tags: implementation Correct Solution: ``` m = [0]*(2*10**5 + 1) n = int(input()) input().split() l = -1 r = 1 for i in range(n - 1): p, b_id = input().split() b_id = int(b_id) if p == "L": m[b_id] = l l -= 1 elif p == "R": m[b_id] = r r += 1 elif p == "?": pr...
output
1
84,250
8
168,501
Provide tags and a correct Python 3 solution for this coding contest problem. Little boy Petya loves stairs very much. But he is bored from simple going up and down them β€” he loves jumping over several stairs at a time. As he stands on some stair, he can either jump to the next one or jump over one or two stairs at a ...
instruction
0
84,533
8
169,066
Tags: implementation, sortings Correct Solution: ``` k,n=map(int,input().split()) if n==0: print('YES') exit() l=[int(i) for i in input().split()] #l is dirty from collections import Counter c=Counter(l) l.sort() for i in range(2,n): if l[i]==l[i-1]+1 and l[i-1]==l[i-2]+1: print('NO') exi...
output
1
84,533
8
169,067