message
stringlengths
2
45.8k
message_type
stringclasses
2 values
message_id
int64
0
1
conversation_id
int64
254
108k
cluster
float64
3
3
__index_level_0__
int64
508
217k
Provide tags and a correct Python 3 solution for this coding contest problem. During one of the space missions, humans have found an evidence of previous life at one of the planets. They were lucky enough to find a book with birth and death years of each individual that had been living at this planet. What's interesti...
instruction
0
13,488
3
26,976
Tags: data structures, sortings Correct Solution: ``` """ Author - Satwik Tiwari . 4th Oct , 2020 - Sunday """ #=============================================================================================== #importing some useful libraries. from __future__ import division, print_function from fractions imp...
output
1
13,488
3
26,977
Provide tags and a correct Python 3 solution for this coding contest problem. During one of the space missions, humans have found an evidence of previous life at one of the planets. They were lucky enough to find a book with birth and death years of each individual that had been living at this planet. What's interesti...
instruction
0
13,490
3
26,980
Tags: data structures, sortings Correct Solution: ``` n = int(input()) years = [] for i in range(n): vals = input().split() years.append((int(vals[0]), 1)) years.append((int(vals[1]), -1)) years.sort() max_population = 0 population = 0 for year in years: if year[1] == -1: population -= 1 else: popu...
output
1
13,490
3
26,981
Provide tags and a correct Python 3 solution for this coding contest problem. During one of the space missions, humans have found an evidence of previous life at one of the planets. They were lucky enough to find a book with birth and death years of each individual that had been living at this planet. What's interesti...
instruction
0
13,491
3
26,982
Tags: data structures, sortings Correct Solution: ``` dct = {} for i in range(int(input())): a,b = map(int,input().split()) dct[a] = dct.get(a,0)+1 dct[b] = dct.get(b,0)-1 cnt = curr = y = 0 for i in sorted(dct.keys()): curr += dct[i] if curr > cnt : cnt = curr y = i print(y,cnt) ``...
output
1
13,491
3
26,983
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. During one of the space missions, humans have found an evidence of previous life at one of the planets. They were lucky enough to find a book with birth and death years of each individual that h...
instruction
0
13,492
3
26,984
Yes
output
1
13,492
3
26,985
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. During one of the space missions, humans have found an evidence of previous life at one of the planets. They were lucky enough to find a book with birth and death years of each individual that h...
instruction
0
13,493
3
26,986
Yes
output
1
13,493
3
26,987
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. During one of the space missions, humans have found an evidence of previous life at one of the planets. They were lucky enough to find a book with birth and death years of each individual that h...
instruction
0
13,494
3
26,988
Yes
output
1
13,494
3
26,989
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. During one of the space missions, humans have found an evidence of previous life at one of the planets. They were lucky enough to find a book with birth and death years of each individual that h...
instruction
0
13,495
3
26,990
Yes
output
1
13,495
3
26,991
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. During one of the space missions, humans have found an evidence of previous life at one of the planets. They were lucky enough to find a book with birth and death years of each individual that h...
instruction
0
13,496
3
26,992
No
output
1
13,496
3
26,993
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. During one of the space missions, humans have found an evidence of previous life at one of the planets. They were lucky enough to find a book with birth and death years of each individual that h...
instruction
0
13,497
3
26,994
No
output
1
13,497
3
26,995
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. During one of the space missions, humans have found an evidence of previous life at one of the planets. They were lucky enough to find a book with birth and death years of each individual that h...
instruction
0
13,498
3
26,996
No
output
1
13,498
3
26,997
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. During one of the space missions, humans have found an evidence of previous life at one of the planets. They were lucky enough to find a book with birth and death years of each individual that h...
instruction
0
13,499
3
26,998
No
output
1
13,499
3
26,999
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Mirror Box is a name of a popular game in the Iranian National Amusement Park (INAP). There is a wooden box, 105 cm long and 100 cm high in this game. Some parts of the box's ceiling and floor a...
instruction
0
13,566
3
27,132
No
output
1
13,566
3
27,133
Provide tags and a correct Python 3 solution for this coding contest problem. Iahub accidentally discovered a secret lab. He found there n devices ordered in a line, numbered from 1 to n from left to right. Each device i (1 ≤ i ≤ n) can create either ai units of matter or ai units of antimatter. Iahub wants to choos...
instruction
0
13,621
3
27,242
Tags: dp Correct Solution: ``` import sys input = lambda : sys.stdin.readline().rstrip() sys.setrecursionlimit(2*10**5+10) write = lambda x: sys.stdout.write(x+"\n") debug = lambda x: sys.stderr.write(x+"\n") writef = lambda x: print("{:.12f}".format(x)) n = int(input()) a = list(map(int, input().split())) m = sum(a...
output
1
13,621
3
27,243
Provide tags and a correct Python 3 solution for this coding contest problem. Iahub accidentally discovered a secret lab. He found there n devices ordered in a line, numbered from 1 to n from left to right. Each device i (1 ≤ i ≤ n) can create either ai units of matter or ai units of antimatter. Iahub wants to choos...
instruction
0
13,622
3
27,244
Tags: dp Correct Solution: ``` import sys input = lambda : sys.stdin.readline().rstrip() sys.setrecursionlimit(2*10**5+10) write = lambda x: sys.stdout.write(x+"\n") debug = lambda x: sys.stderr.write(x+"\n") writef = lambda x: print("{:.12f}".format(x)) n = int(input()) a = list(map(int, input().split())) m = sum(a...
output
1
13,622
3
27,245
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Iahub accidentally discovered a secret lab. He found there n devices ordered in a line, numbered from 1 to n from left to right. Each device i (1 ≤ i ≤ n) can create either ai units of matter or...
instruction
0
13,623
3
27,246
No
output
1
13,623
3
27,247
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Iahub accidentally discovered a secret lab. He found there n devices ordered in a line, numbered from 1 to n from left to right. Each device i (1 ≤ i ≤ n) can create either ai units of matter or...
instruction
0
13,624
3
27,248
No
output
1
13,624
3
27,249
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. The DNA sequence for every living creature in Berland can be represented as a non-empty line consisting of lowercase Latin letters. Berland scientists found out that all the creatures evolve by ...
instruction
0
13,688
3
27,376
No
output
1
13,688
3
27,377
Provide tags and a correct Python 3 solution for this coding contest problem. Little Artem likes electronics. He can spend lots of time making different schemas and looking for novelties in the nearest electronics store. The new control element was delivered to the store recently and Artem immediately bought it. That...
instruction
0
13,738
3
27,476
Tags: implementation Correct Solution: ``` def rotate_r(ar, row, n): ar[row] = ar[row][-n:] + ar[row][:-n] return ar def rotate_c(ar, m, col): #c = ar[col][0] c = ar[m - 1][col] for i in range(m - 1, 0, -1): #for i in range(m - 1): ar[i][col] = ar[i - 1][col] #ar[col][m - 1] = c ar[0][col] = c return ar de...
output
1
13,738
3
27,477
Provide tags and a correct Python 3 solution for this coding contest problem. Little Artem likes electronics. He can spend lots of time making different schemas and looking for novelties in the nearest electronics store. The new control element was delivered to the store recently and Artem immediately bought it. That...
instruction
0
13,739
3
27,478
Tags: implementation Correct Solution: ``` import itertools import bisect import math from collections import * import os import sys from io import BytesIO, IOBase ii = lambda: int(input()) lmii = lambda: list(map(int, input().split())) li = lambda: list(input()) mii = lambda: map(int, input().split()) msi = lambda: m...
output
1
13,739
3
27,479
Provide tags and a correct Python 3 solution for this coding contest problem. Little Artem likes electronics. He can spend lots of time making different schemas and looking for novelties in the nearest electronics store. The new control element was delivered to the store recently and Artem immediately bought it. That...
instruction
0
13,740
3
27,480
Tags: implementation Correct Solution: ``` a, b, c = map(int, input().split()) arr = [] mat = [[0 for j in range(b)] for i in range(a)] for i in range(c): arr.append(input()) arr = arr[::-1] for command in arr: arra = [int(i) for i in command.split()] if arra[0] == 1: swp = mat[arra[1] - 1][b - 1] ...
output
1
13,740
3
27,481
Provide tags and a correct Python 3 solution for this coding contest problem. Little Artem likes electronics. He can spend lots of time making different schemas and looking for novelties in the nearest electronics store. The new control element was delivered to the store recently and Artem immediately bought it. That...
instruction
0
13,741
3
27,482
Tags: implementation Correct Solution: ``` f = lambda: map(int, input().split()) n, m, q = f() p = [[0] * m for j in range(n)] for t in [list(f()) for k in range(q)][::-1]: j = t[1] - 1 if t[0] == 1: p[j].insert(0, p[j].pop()) elif t[0] == 2: s = p[-1][j] for i in range(n - 1, 0, -1): p[i][...
output
1
13,741
3
27,483
Provide tags and a correct Python 3 solution for this coding contest problem. Little Artem likes electronics. He can spend lots of time making different schemas and looking for novelties in the nearest electronics store. The new control element was delivered to the store recently and Artem immediately bought it. That...
instruction
0
13,742
3
27,484
Tags: implementation Correct Solution: ``` m,n,q = map(int,input().split()) inps = [map(lambda x: int(x)-1,input().split()) for _ in range(q)] matrix = [[-1]*n for _ in range(m)] for x in reversed(inps): t,c,*cc = x if t == 0: matrix[c] = [matrix[c][-1]] + matrix[c][:-1] elif t == 1: new = [...
output
1
13,742
3
27,485
Provide tags and a correct Python 3 solution for this coding contest problem. Little Artem likes electronics. He can spend lots of time making different schemas and looking for novelties in the nearest electronics store. The new control element was delivered to the store recently and Artem immediately bought it. That...
instruction
0
13,743
3
27,486
Tags: implementation Correct Solution: ``` inf= list(map(int, input().split())) n=inf[0] m=inf[1] q=inf[2] quer=[0]*q mat=[[0 for i in range(m)] for j in range(n)] for i in range(0, q): quer[i] =list(map(int, input().split())) for i in range(q-1, -1, -1): curr=quer[i] if curr[0] == 1: x = curr[1]-1 a = mat[x][m-...
output
1
13,743
3
27,487
Provide tags and a correct Python 3 solution for this coding contest problem. Little Artem likes electronics. He can spend lots of time making different schemas and looking for novelties in the nearest electronics store. The new control element was delivered to the store recently and Artem immediately bought it. That...
instruction
0
13,744
3
27,488
Tags: implementation Correct Solution: ``` f = lambda: map(int, input().split()) n, m, q = f() p = [[0] * m for j in range(n)] for t in [list(f()) for k in range(q)][::-1]: j = t[1] - 1 if t[0] == 1: p[j].insert(0, p[j].pop()) elif t[0] == 2: s = p[-1][j] for i in range(n - 1, 0, -1...
output
1
13,744
3
27,489
Provide tags and a correct Python 3 solution for this coding contest problem. Little Artem likes electronics. He can spend lots of time making different schemas and looking for novelties in the nearest electronics store. The new control element was delivered to the store recently and Artem immediately bought it. That...
instruction
0
13,745
3
27,490
Tags: implementation Correct Solution: ``` n,m,q=(int(z) for z in input().split()) s=[] res=[] for i in range(n): res.append([0]*m) for i in range(q): s.append([int(z) for z in input().split()]) while len(s)>0: if s[-1][0]==3: res[s[-1][1]-1][s[-1][2]-1]=s[-1][3] elif s[-1][0]==2: r=res[-1][s[-1][1]-1] for i ...
output
1
13,745
3
27,491
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Little Artem likes electronics. He can spend lots of time making different schemas and looking for novelties in the nearest electronics store. The new control element was delivered to the store ...
instruction
0
13,746
3
27,492
Yes
output
1
13,746
3
27,493
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Little Artem likes electronics. He can spend lots of time making different schemas and looking for novelties in the nearest electronics store. The new control element was delivered to the store ...
instruction
0
13,747
3
27,494
Yes
output
1
13,747
3
27,495
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Little Artem likes electronics. He can spend lots of time making different schemas and looking for novelties in the nearest electronics store. The new control element was delivered to the store ...
instruction
0
13,748
3
27,496
Yes
output
1
13,748
3
27,497
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Little Artem likes electronics. He can spend lots of time making different schemas and looking for novelties in the nearest electronics store. The new control element was delivered to the store ...
instruction
0
13,749
3
27,498
Yes
output
1
13,749
3
27,499
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Little Artem likes electronics. He can spend lots of time making different schemas and looking for novelties in the nearest electronics store. The new control element was delivered to the store ...
instruction
0
13,750
3
27,500
No
output
1
13,750
3
27,501
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Little Artem likes electronics. He can spend lots of time making different schemas and looking for novelties in the nearest electronics store. The new control element was delivered to the store ...
instruction
0
13,751
3
27,502
No
output
1
13,751
3
27,503
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Little Artem likes electronics. He can spend lots of time making different schemas and looking for novelties in the nearest electronics store. The new control element was delivered to the store ...
instruction
0
13,752
3
27,504
No
output
1
13,752
3
27,505
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Little Artem likes electronics. He can spend lots of time making different schemas and looking for novelties in the nearest electronics store. The new control element was delivered to the store ...
instruction
0
13,753
3
27,506
No
output
1
13,753
3
27,507
Provide a correct Python 3 solution for this coding contest problem. Zombies seem to have become much more intelligent lately – a few have somehow wandered into the base through the automatic gate. Heidi has had to beef up security, and a new gate has been installed. Unfortunately, now the questions being asked are mo...
instruction
0
13,762
3
27,524
"Correct Solution: ``` print("""2 1 2 3 1 4 3 2 1 1 3 4 2 5 1 6 11 3 10 9 15 12 7 13 2 5 4 14 8 5 1 3 11 10 7 6 9 13 15 12 4 14 2 8 9 7 2 5 1 10 8 3 4 6 2 1 4 3 4 12 8 2 9 14 5 7 1 6 10 13 15 3 11 11 5 6 8 10 12 7 2 1 4 9 3 13 14 15 11 7 8 4 5 15 13 14 3 9 12 2 1 10 6 12 7 11 4 10 2 5 14 13 1 6 3 9 8 15 16 ...
output
1
13,762
3
27,525
Provide a correct Python 3 solution for this coding contest problem. Training is indispensable for achieving good results at ICPC. Rabbit wants to win at ICPC, so he decided to practice today as well. Today's training is to develop physical strength and judgment by running on a straight road. The rabbit is now standi...
instruction
0
14,082
3
28,164
"Correct Solution: ``` n,k,t,u,v,l = map(int,input().split()) D = [] for i in range(n): d = int(input()) D.append(d) A = [0]*l special = 0 nomal = 0 ninzin = 0 for i in range(l): if i == special: if ninzin == 0: nomal = 0 else: special = i + v*t ninzin = ...
output
1
14,082
3
28,165
Provide a correct Python 3 solution for this coding contest problem. Training is indispensable for achieving good results at ICPC. Rabbit wants to win at ICPC, so he decided to practice today as well. Today's training is to develop physical strength and judgment by running on a straight road. The rabbit is now standi...
instruction
0
14,083
3
28,166
"Correct Solution: ``` import sys EPS = 1e-12 def main(): n,k,t,u,v,l = map(int, sys.stdin.readline().split()) carrots = [0] * 10001 for i in range(n): carrots[ int(sys.stdin.readline()) ] = 1 remain_time = 0 carrot_count = 0 ans = 0 for i in range(0,l): #print("kyori:{}\...
output
1
14,083
3
28,167
Provide a correct Python 3 solution for this coding contest problem. Training is indispensable for achieving good results at ICPC. Rabbit wants to win at ICPC, so he decided to practice today as well. Today's training is to develop physical strength and judgment by running on a straight road. The rabbit is now standi...
instruction
0
14,084
3
28,168
"Correct Solution: ``` carrot,maxstock,duration,normal,fast,goal = ((int(n) for n in input().split(" "))) stack,used = [],0 for c in range(carrot): newcar = int(input()) stack = list(filter(lambda x:x>newcar,stack)) if len(stack) == 0: stack.append(newcar + (fast * duration)) used += fa...
output
1
14,084
3
28,169
Provide a correct Python 3 solution for this coding contest problem. Training is indispensable for achieving good results at ICPC. Rabbit wants to win at ICPC, so he decided to practice today as well. Today's training is to develop physical strength and judgment by running on a straight road. The rabbit is now standi...
instruction
0
14,085
3
28,170
"Correct Solution: ``` def get_carrot() : global speed, stock, U, K, i, T, accel_time if speed == U : speed = V accel_time = T elif stock == K : accel_time = T else : stock += 1 i += 1 def accel_time_end() : global stock, accel_time, T, U, speed if stock > 0 ...
output
1
14,085
3
28,171
Provide a correct Python 3 solution for this coding contest problem. Training is indispensable for achieving good results at ICPC. Rabbit wants to win at ICPC, so he decided to practice today as well. Today's training is to develop physical strength and judgment by running on a straight road. The rabbit is now standi...
instruction
0
14,086
3
28,172
"Correct Solution: ``` n,k,t,u,v,l = map(int,input().split()) time = 0 line = [0 for _ in range(l)] carrots_line = [0 for _ in range(l)] boost = False carrots = 0 boost_dist = 0 for _ in range(n): carrots_line[int(input())-1] = 1 for i in range(l): if boost: line[i] = 1 boost_dist -= 1 el...
output
1
14,086
3
28,173
Provide a correct Python 3 solution for this coding contest problem. Training is indispensable for achieving good results at ICPC. Rabbit wants to win at ICPC, so he decided to practice today as well. Today's training is to develop physical strength and judgment by running on a straight road. The rabbit is now standi...
instruction
0
14,087
3
28,174
"Correct Solution: ``` N, K, T, U, V, L = map(int, input().split()) Dlist = [] for i in range(N): Dlist.append(int(input())) t = 0 # 経過時間 v = U # 速度(初期値はU) timer = 0 Sto = 0 # 手持ちのにんじん for i in range(1,L+1): t += 1/v if v==V: timer += 1/v if i in Dlist: Sto += 1 ...
output
1
14,087
3
28,175
Provide a correct Python 3 solution for this coding contest problem. Training is indispensable for achieving good results at ICPC. Rabbit wants to win at ICPC, so he decided to practice today as well. Today's training is to develop physical strength and judgment by running on a straight road. The rabbit is now standi...
instruction
0
14,088
3
28,176
"Correct Solution: ``` # your code goes he #carrot 22 2298 N,K,T,U,V,L=(int(i) for i in input().split()) #r=int(input()) s=0 c=0 h=0 TV=T*V D=[int(input()) for i in range(N)] D.append(L) r=D[0] for i in range(N): h+=1 if h>K: h-=1 c=TV Ds=D[i+1]-D[i] if c>0: if Ds>c: ...
output
1
14,088
3
28,177
Provide a correct Python 3 solution for this coding contest problem. Training is indispensable for achieving good results at ICPC. Rabbit wants to win at ICPC, so he decided to practice today as well. Today's training is to develop physical strength and judgment by running on a straight road. The rabbit is now standi...
instruction
0
14,089
3
28,178
"Correct Solution: ``` from collections import deque from heapq import * import sys sys.setrecursionlimit(10 ** 6) int1 = lambda x: int(x) - 1 p2D = lambda x: print(*x, sep="\n") def MI(): return map(int, sys.stdin.readline().split()) def LI(): return list(map(int, sys.stdin.readline().split())) def LLI(rows_number): ...
output
1
14,089
3
28,179
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Training is indispensable for achieving good results at ICPC. Rabbit wants to win at ICPC, so he decided to practice today as well. Today's training is to develop physical strength and judgment...
instruction
0
14,090
3
28,180
Yes
output
1
14,090
3
28,181
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Training is indispensable for achieving good results at ICPC. Rabbit wants to win at ICPC, so he decided to practice today as well. Today's training is to develop physical strength and judgment...
instruction
0
14,091
3
28,182
Yes
output
1
14,091
3
28,183
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Training is indispensable for achieving good results at ICPC. Rabbit wants to win at ICPC, so he decided to practice today as well. Today's training is to develop physical strength and judgment...
instruction
0
14,092
3
28,184
Yes
output
1
14,092
3
28,185
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Training is indispensable for achieving good results at ICPC. Rabbit wants to win at ICPC, so he decided to practice today as well. Today's training is to develop physical strength and judgment...
instruction
0
14,093
3
28,186
No
output
1
14,093
3
28,187
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Training is indispensable for achieving good results at ICPC. Rabbit wants to win at ICPC, so he decided to practice today as well. Today's training is to develop physical strength and judgment...
instruction
0
14,094
3
28,188
No
output
1
14,094
3
28,189
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Training is indispensable for achieving good results at ICPC. Rabbit wants to win at ICPC, so he decided to practice today as well. Today's training is to develop physical strength and judgment...
instruction
0
14,095
3
28,190
No
output
1
14,095
3
28,191
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Training is indispensable for achieving good results at ICPC. Rabbit wants to win at ICPC, so he decided to practice today as well. Today's training is to develop physical strength and judgment...
instruction
0
14,096
3
28,192
No
output
1
14,096
3
28,193
Provide tags and a correct Python 3 solution for this coding contest problem. You are an all-powerful being and you have created a rectangular world. In fact, your world is so bland that it could be represented by a r × c grid. Each cell on the grid represents a country. Each country has a dominant religion. There are...
instruction
0
14,265
3
28,530
Tags: implementation, math Correct Solution: ``` from sys import stdin rstr = lambda: stdin.readline().strip() rstr_2d = lambda n: [rstr() for _ in range(n)] rints = lambda: [int(x) for x in stdin.readline().split()] out = [] for _ in range(int(input())): n, m = rints() mat, row, col, su = rstr_2d(n), [0] * n...
output
1
14,265
3
28,531