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
Provide tags and a correct Python 3 solution for this coding contest problem. Mary has just graduated from one well-known University and is now attending celebration party. Students like to dream of a beautiful life, so they used champagne glasses to construct a small pyramid. The height of the pyramid is n. The top l...
instruction
0
98,269
8
196,538
Tags: implementation, math, math Correct Solution: ``` #676B arr = list(map(int, input().split(" "))) n = arr[0] t = arr[1] glasses = 0 a = [[0] * (i + 1) for i in range(n+1)] a[0][0] = t for j in range(n): for k in range(j + 1): if a[j][k] >= 1: glasses += 1 extra = a[j][k] - 1 a[j][k] = 1 a[j+1][k]...
output
1
98,269
8
196,539
Provide tags and a correct Python 3 solution for this coding contest problem. Mary has just graduated from one well-known University and is now attending celebration party. Students like to dream of a beautiful life, so they used champagne glasses to construct a small pyramid. The height of the pyramid is n. The top l...
instruction
0
98,270
8
196,540
Tags: implementation, math, math Correct Solution: ``` import sys,math res=[0] n,m=map(int,input().split()) z=[] need=0 for i in range(1,n+1): need+=i for i in range(1,n+1): z.append([0]*i) for i in range(1,m+1): z[0][0]+=2 for i in range(n-1): for j in range(i+1): if z[i][j]>=2: ...
output
1
98,270
8
196,541
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Mary has just graduated from one well-known University and is now attending celebration party. Students like to dream of a beautiful life, so they used champagne glasses to construct a small pyr...
instruction
0
98,271
8
196,542
Yes
output
1
98,271
8
196,543
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Mary has just graduated from one well-known University and is now attending celebration party. Students like to dream of a beautiful life, so they used champagne glasses to construct a small pyr...
instruction
0
98,272
8
196,544
Yes
output
1
98,272
8
196,545
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Mary has just graduated from one well-known University and is now attending celebration party. Students like to dream of a beautiful life, so they used champagne glasses to construct a small pyr...
instruction
0
98,273
8
196,546
Yes
output
1
98,273
8
196,547
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Mary has just graduated from one well-known University and is now attending celebration party. Students like to dream of a beautiful life, so they used champagne glasses to construct a small pyr...
instruction
0
98,274
8
196,548
Yes
output
1
98,274
8
196,549
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Mary has just graduated from one well-known University and is now attending celebration party. Students like to dream of a beautiful life, so they used champagne glasses to construct a small pyr...
instruction
0
98,275
8
196,550
No
output
1
98,275
8
196,551
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Mary has just graduated from one well-known University and is now attending celebration party. Students like to dream of a beautiful life, so they used champagne glasses to construct a small pyr...
instruction
0
98,276
8
196,552
No
output
1
98,276
8
196,553
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Mary has just graduated from one well-known University and is now attending celebration party. Students like to dream of a beautiful life, so they used champagne glasses to construct a small pyr...
instruction
0
98,277
8
196,554
No
output
1
98,277
8
196,555
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Mary has just graduated from one well-known University and is now attending celebration party. Students like to dream of a beautiful life, so they used champagne glasses to construct a small pyr...
instruction
0
98,278
8
196,556
No
output
1
98,278
8
196,557
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Company trip Problem Statement Your company has n employees. For a group of m employees (a_i, b_i), a_i is the boss of b_i. When employee x is the actual boss of employee y, it means that at ...
instruction
0
98,550
8
197,100
No
output
1
98,550
8
197,101
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Company trip Problem Statement Your company has n employees. For a group of m employees (a_i, b_i), a_i is the boss of b_i. When employee x is the actual boss of employee y, it means that at ...
instruction
0
98,551
8
197,102
No
output
1
98,551
8
197,103
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Company trip Problem Statement Your company has n employees. For a group of m employees (a_i, b_i), a_i is the boss of b_i. When employee x is the actual boss of employee y, it means that at ...
instruction
0
98,552
8
197,104
No
output
1
98,552
8
197,105
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Company trip Problem Statement Your company has n employees. For a group of m employees (a_i, b_i), a_i is the boss of b_i. When employee x is the actual boss of employee y, it means that at ...
instruction
0
98,553
8
197,106
No
output
1
98,553
8
197,107
Provide tags and a correct Python 3 solution for this coding contest problem. A girl named Xenia has a cupboard that looks like an arc from ahead. The arc is made of a semicircle with radius r (the cupboard's top) and two walls of height h (the cupboard's sides). The cupboard's depth is r, that is, it looks like a rec...
instruction
0
98,960
8
197,920
Tags: geometry Correct Solution: ``` #!/bin/python from math import sqrt r, h = (int(x) for x in input().split(' ')) # You can always put two in each "row" of the rectangle and one in the dome in_box = 2 * h // r + 1 # You can add an additional one, like so: # O # O # # since they all have radius r/2, you can get t...
output
1
98,960
8
197,921
Provide tags and a correct Python 3 solution for this coding contest problem. A girl named Xenia has a cupboard that looks like an arc from ahead. The arc is made of a semicircle with radius r (the cupboard's top) and two walls of height h (the cupboard's sides). The cupboard's depth is r, that is, it looks like a rec...
instruction
0
98,961
8
197,922
Tags: geometry Correct Solution: ``` r, h = map(int, input().split()) half_count = (2 * h + r) // (2 * r) res = 2 * half_count x1 = 0 y1 = h + r / 2 x2 = r / 2 y2 = (r * (2 * half_count - 1)) / 2 if (x1 - x2) ** 2 + (y1 - y2) ** 2 >= r * r: res += 1 print(res) ```
output
1
98,961
8
197,923
Provide tags and a correct Python 3 solution for this coding contest problem. A girl named Xenia has a cupboard that looks like an arc from ahead. The arc is made of a semicircle with radius r (the cupboard's top) and two walls of height h (the cupboard's sides). The cupboard's depth is r, that is, it looks like a rec...
instruction
0
98,962
8
197,924
Tags: geometry Correct Solution: ``` r,h = map(int,input().split()) s = h%r a = (h//r)*2 if s*s >= 3*r*r/4: a += 3 elif 2*s >= r: a += 2 else: a += 1 print(a) ```
output
1
98,962
8
197,925
Provide tags and a correct Python 3 solution for this coding contest problem. A girl named Xenia has a cupboard that looks like an arc from ahead. The arc is made of a semicircle with radius r (the cupboard's top) and two walls of height h (the cupboard's sides). The cupboard's depth is r, that is, it looks like a rec...
instruction
0
98,963
8
197,926
Tags: geometry Correct Solution: ``` r, h = map(int, input().split()) if (h%r)/r >= 3**0.5/2: print(2*(h//r)+3) elif 0.5 <= (h%r)/r : print(2*(h//r)+2) else: print(2*(h//r)+1) ```
output
1
98,963
8
197,927
Provide tags and a correct Python 3 solution for this coding contest problem. A girl named Xenia has a cupboard that looks like an arc from ahead. The arc is made of a semicircle with radius r (the cupboard's top) and two walls of height h (the cupboard's sides). The cupboard's depth is r, that is, it looks like a rec...
instruction
0
98,964
8
197,928
Tags: geometry Correct Solution: ``` if __name__=='__main__': inp = input() arr = inp.split(" ") r = int(arr[0]) h = int(arr[1]) ans = 2*(h//r) d = h%r if d*2>=r: ans+=2 if 4*d*d >= 3*r*r: ans+=1 else: ans+=1 print(ans) ```
output
1
98,964
8
197,929
Provide tags and a correct Python 3 solution for this coding contest problem. A girl named Xenia has a cupboard that looks like an arc from ahead. The arc is made of a semicircle with radius r (the cupboard's top) and two walls of height h (the cupboard's sides). The cupboard's depth is r, that is, it looks like a rec...
instruction
0
98,965
8
197,930
Tags: geometry Correct Solution: ``` from math import * r, h = map(int, input().split()) d = h % r if d * 2 < r: print(h // r * 2 + 1) elif sqrt(3) * (r / 2) + r - 1e-6 <= d + r: print(h // r * 2 + 3) else: print(h // r * 2 + 2) ```
output
1
98,965
8
197,931
Provide tags and a correct Python 3 solution for this coding contest problem. A girl named Xenia has a cupboard that looks like an arc from ahead. The arc is made of a semicircle with radius r (the cupboard's top) and two walls of height h (the cupboard's sides). The cupboard's depth is r, that is, it looks like a rec...
instruction
0
98,966
8
197,932
Tags: geometry Correct Solution: ``` r, h = map(int, input().split()) a = 2 * (h // r) h = h % r print (a + 1 + (2*h>=r) + (4*h*h >= 3*r*r)) # Made By Mostafa_Khaled ```
output
1
98,966
8
197,933
Provide tags and a correct Python 3 solution for this coding contest problem. A girl named Xenia has a cupboard that looks like an arc from ahead. The arc is made of a semicircle with radius r (the cupboard's top) and two walls of height h (the cupboard's sides). The cupboard's depth is r, that is, it looks like a rec...
instruction
0
98,967
8
197,934
Tags: geometry Correct Solution: ``` r, h = map(int, input().split()) h *= 2 if h < r: print(1) exit(0) r *= 2 ans = (h + r // 2) // r * 2 h -= r * (ans // 2 - 1) if (h ** 2) * 4 >= (r ** 2) * 3: ans += 1 print(ans) ```
output
1
98,967
8
197,935
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. A girl named Xenia has a cupboard that looks like an arc from ahead. The arc is made of a semicircle with radius r (the cupboard's top) and two walls of height h (the cupboard's sides). The cupb...
instruction
0
98,968
8
197,936
Yes
output
1
98,968
8
197,937
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. A girl named Xenia has a cupboard that looks like an arc from ahead. The arc is made of a semicircle with radius r (the cupboard's top) and two walls of height h (the cupboard's sides). The cupb...
instruction
0
98,969
8
197,938
Yes
output
1
98,969
8
197,939
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. A girl named Xenia has a cupboard that looks like an arc from ahead. The arc is made of a semicircle with radius r (the cupboard's top) and two walls of height h (the cupboard's sides). The cupb...
instruction
0
98,970
8
197,940
Yes
output
1
98,970
8
197,941
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. A girl named Xenia has a cupboard that looks like an arc from ahead. The arc is made of a semicircle with radius r (the cupboard's top) and two walls of height h (the cupboard's sides). The cupb...
instruction
0
98,971
8
197,942
Yes
output
1
98,971
8
197,943
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. A girl named Xenia has a cupboard that looks like an arc from ahead. The arc is made of a semicircle with radius r (the cupboard's top) and two walls of height h (the cupboard's sides). The cupb...
instruction
0
98,972
8
197,944
No
output
1
98,972
8
197,945
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. A girl named Xenia has a cupboard that looks like an arc from ahead. The arc is made of a semicircle with radius r (the cupboard's top) and two walls of height h (the cupboard's sides). The cupb...
instruction
0
98,973
8
197,946
No
output
1
98,973
8
197,947
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. A girl named Xenia has a cupboard that looks like an arc from ahead. The arc is made of a semicircle with radius r (the cupboard's top) and two walls of height h (the cupboard's sides). The cupb...
instruction
0
98,974
8
197,948
No
output
1
98,974
8
197,949
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. A girl named Xenia has a cupboard that looks like an arc from ahead. The arc is made of a semicircle with radius r (the cupboard's top) and two walls of height h (the cupboard's sides). The cupb...
instruction
0
98,975
8
197,950
No
output
1
98,975
8
197,951
Provide tags and a correct Python 3 solution for this coding contest problem. <image> It's the end of July – the time when a festive evening is held at Jelly Castle! Guests from all over the kingdom gather here to discuss new trends in the world of confectionery. Yet some of the things discussed here are not supposed...
instruction
0
99,160
8
198,320
Tags: data structures, implementation Correct Solution: ``` string_len, condition_value = (int(x) for x in input().split()) idx___letter = list(input()) letter___start__finish = {} for idx, letter in enumerate(idx___letter): if letter not in letter___start__finish: letter___start__finish[letter] = [idx, i...
output
1
99,160
8
198,321
Provide tags and a correct Python 3 solution for this coding contest problem. <image> It's the end of July – the time when a festive evening is held at Jelly Castle! Guests from all over the kingdom gather here to discuss new trends in the world of confectionery. Yet some of the things discussed here are not supposed...
instruction
0
99,161
8
198,322
Tags: data structures, implementation Correct Solution: ``` import sys def func(dic1,dic2,s,alot): for i in s: if dic2[i] == 0: alot += 1 dic2[i] += 1 else: dic2[i] += 1 if alot>guards: return False if dic2[i]==dic1[i]: alot...
output
1
99,161
8
198,323
Provide tags and a correct Python 3 solution for this coding contest problem. <image> It's the end of July – the time when a festive evening is held at Jelly Castle! Guests from all over the kingdom gather here to discuss new trends in the world of confectionery. Yet some of the things discussed here are not supposed...
instruction
0
99,162
8
198,324
Tags: data structures, implementation Correct Solution: ``` n,k=(int(i )for i in input().split()) s=input() a=[0]*n b=[] x=k y=0 alf='ABCDEFGHIJKLMNOPQRSTUVWXYZ' end=[s.rfind(i) for i in alf] begin=[s.find(i) for i in alf] f=False ans=False for i in range(n): find=alf.find(s[i]) if ((i!=end[find]) and not(s[i]...
output
1
99,162
8
198,325
Provide tags and a correct Python 3 solution for this coding contest problem. <image> It's the end of July – the time when a festive evening is held at Jelly Castle! Guests from all over the kingdom gather here to discuss new trends in the world of confectionery. Yet some of the things discussed here are not supposed...
instruction
0
99,163
8
198,326
Tags: data structures, implementation Correct Solution: ``` from collections import deque n, k = list(map(int, input().split())) s = input() rs = s[::-1] alpha = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' last = {} for c in alpha: p = rs.find(c) if p != -1: last.update({c: n - p - 1}) amount = 0 o = deque() c = 0 for...
output
1
99,163
8
198,327
Provide tags and a correct Python 3 solution for this coding contest problem. <image> It's the end of July – the time when a festive evening is held at Jelly Castle! Guests from all over the kingdom gather here to discuss new trends in the world of confectionery. Yet some of the things discussed here are not supposed...
instruction
0
99,164
8
198,328
Tags: data structures, implementation Correct Solution: ``` from collections import defaultdict n,k=map(int,input().split()) s=input() d=defaultdict(lambda:[-1,-1]) s1=s[::-1] for x in range(65,91): if s.find(chr(x))!=-1: d[chr(x)][0]=s.find(chr(x)) d[chr(x)][1]=(n-1)-s1.find(chr(x)) t=s[0] k1=1 f=0...
output
1
99,164
8
198,329
Provide tags and a correct Python 3 solution for this coding contest problem. <image> It's the end of July – the time when a festive evening is held at Jelly Castle! Guests from all over the kingdom gather here to discuss new trends in the world of confectionery. Yet some of the things discussed here are not supposed...
instruction
0
99,165
8
198,330
Tags: data structures, implementation Correct Solution: ``` from time import time n, k = map(int, input().split()) g = input() e = [-1] * 26 for i in range(n): e[ord(g[i]) - 65] = i curS = 0 f = 1 met = [0] * 26 for i in range(n): if not met[ord(g[i]) - 65]: curS += 1 met[ord(g[i]) - 65] = 1 ...
output
1
99,165
8
198,331
Provide tags and a correct Python 3 solution for this coding contest problem. <image> It's the end of July – the time when a festive evening is held at Jelly Castle! Guests from all over the kingdom gather here to discuss new trends in the world of confectionery. Yet some of the things discussed here are not supposed...
instruction
0
99,166
8
198,332
Tags: data structures, implementation Correct Solution: ``` """ Author : Arif Ahmad Date : Algo : Difficulty : """ from sys import stdin, stdout def main(): n, k = [int(_) for _ in stdin.readline().strip().split()] s = stdin.readline().strip() last = dict() for i in range(26): c = chr(ord('A') + ...
output
1
99,166
8
198,333
Provide tags and a correct Python 3 solution for this coding contest problem. <image> It's the end of July – the time when a festive evening is held at Jelly Castle! Guests from all over the kingdom gather here to discuss new trends in the world of confectionery. Yet some of the things discussed here are not supposed...
instruction
0
99,167
8
198,334
Tags: data structures, implementation Correct Solution: ``` n, k = map(int, input().split()) s = input() d1 = {} d2 = {} for i, v in enumerate(s): if v not in d1: d1[v] = i d2[v] = i order = [] for v in d1: order.append((d1[v], -1)) order.append((d2[v], 1)) order.sort() cur = k for _, v in order: cur +...
output
1
99,167
8
198,335
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. <image> It's the end of July – the time when a festive evening is held at Jelly Castle! Guests from all over the kingdom gather here to discuss new trends in the world of confectionery. Yet som...
instruction
0
99,168
8
198,336
Yes
output
1
99,168
8
198,337
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. <image> It's the end of July – the time when a festive evening is held at Jelly Castle! Guests from all over the kingdom gather here to discuss new trends in the world of confectionery. Yet som...
instruction
0
99,169
8
198,338
Yes
output
1
99,169
8
198,339
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. <image> It's the end of July – the time when a festive evening is held at Jelly Castle! Guests from all over the kingdom gather here to discuss new trends in the world of confectionery. Yet som...
instruction
0
99,170
8
198,340
Yes
output
1
99,170
8
198,341
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. <image> It's the end of July – the time when a festive evening is held at Jelly Castle! Guests from all over the kingdom gather here to discuss new trends in the world of confectionery. Yet som...
instruction
0
99,171
8
198,342
Yes
output
1
99,171
8
198,343
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. <image> It's the end of July – the time when a festive evening is held at Jelly Castle! Guests from all over the kingdom gather here to discuss new trends in the world of confectionery. Yet som...
instruction
0
99,172
8
198,344
No
output
1
99,172
8
198,345
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. <image> It's the end of July – the time when a festive evening is held at Jelly Castle! Guests from all over the kingdom gather here to discuss new trends in the world of confectionery. Yet som...
instruction
0
99,173
8
198,346
No
output
1
99,173
8
198,347
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. <image> It's the end of July – the time when a festive evening is held at Jelly Castle! Guests from all over the kingdom gather here to discuss new trends in the world of confectionery. Yet som...
instruction
0
99,174
8
198,348
No
output
1
99,174
8
198,349
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. <image> It's the end of July – the time when a festive evening is held at Jelly Castle! Guests from all over the kingdom gather here to discuss new trends in the world of confectionery. Yet som...
instruction
0
99,175
8
198,350
No
output
1
99,175
8
198,351
Provide tags and a correct Python 3 solution for this coding contest problem. In the year of 30XX participants of some world programming championship live in a single large hotel. The hotel has n floors. Each floor has m sections with a single corridor connecting all of them. The sections are enumerated from 1 to m al...
instruction
0
99,192
8
198,384
Tags: binary search Correct Solution: ``` from bisect import bisect_left input = __import__('sys').stdin.readline MIS = lambda: map(int,input().split()) def walk(x1, y1, x2, y2, L, v): if y1 == y2: return abs(x2-x1) dy = abs(y1-y2) vertical = dy // v if dy%v: vertical+= 1 i = bisect_left(...
output
1
99,192
8
198,385
Provide tags and a correct Python 3 solution for this coding contest problem. In the year of 30XX participants of some world programming championship live in a single large hotel. The hotel has n floors. Each floor has m sections with a single corridor connecting all of them. The sections are enumerated from 1 to m al...
instruction
0
99,193
8
198,386
Tags: binary search Correct Solution: ``` # python3 import sys from bisect import bisect def readline(): return tuple(map(int, input().split())) def readlines(): return (tuple(map(int, line.split())) for line in sys.stdin.readlines()) def bisect_bounds(arr, val): idx = bisect(arr, val) if idx: yield idx...
output
1
99,193
8
198,387
Provide tags and a correct Python 3 solution for this coding contest problem. In the year of 30XX participants of some world programming championship live in a single large hotel. The hotel has n floors. Each floor has m sections with a single corridor connecting all of them. The sections are enumerated from 1 to m al...
instruction
0
99,194
8
198,388
Tags: binary search Correct Solution: ``` def takeClosest(myList, myNumber): """ Assumes myList is sorted. Returns closest value to myNumber. If two numbers are equally close, return the smallest number. """ if len(myList) == 0: return 9e10 pos = bisect_left(myList, myNumber) ...
output
1
99,194
8
198,389
Provide tags and a correct Python 3 solution for this coding contest problem. In the year of 30XX participants of some world programming championship live in a single large hotel. The hotel has n floors. Each floor has m sections with a single corridor connecting all of them. The sections are enumerated from 1 to m al...
instruction
0
99,195
8
198,390
Tags: binary search Correct Solution: ``` from __future__ import division, print_function import bisect import math import itertools import sys from atexit import register if sys.version_info[0] < 3: from io import BytesIO as stream else: from io import StringIO as stream if sys.version_info[0] < 3: clas...
output
1
99,195
8
198,391