message
stringlengths
2
49.9k
message_type
stringclasses
2 values
message_id
int64
0
1
conversation_id
int64
446
108k
cluster
float64
13
13
__index_level_0__
int64
892
217k
Provide a correct Python 3 solution for this coding contest problem. Takahashi has received an undirected graph with N vertices, numbered 1, 2, ..., N. The edges in this graph are represented by (u_i, v_i). There are no self-loops and multiple edges in this graph. Based on this graph, Takahashi is now constructing a ...
instruction
0
28,960
13
57,920
"Correct Solution: ``` import sys input = sys.stdin.readline n, m = map(int, input().split()) G = [[] for _ in range(n)] for _ in range(m): u, v = map(int, input().split()) u -= 1 v -= 1 G[u].append(v) G[v].append(u) seen = [-1]*n p, q, r = 0, 0, 0 def dfs(v): stack = [(v, 0)] seen[v] = 0 f = False ...
output
1
28,960
13
57,921
Provide a correct Python 3 solution for this coding contest problem. Takahashi has received an undirected graph with N vertices, numbered 1, 2, ..., N. The edges in this graph are represented by (u_i, v_i). There are no self-loops and multiple edges in this graph. Based on this graph, Takahashi is now constructing a ...
instruction
0
28,961
13
57,922
"Correct Solution: ``` import sys input = sys.stdin.readline n, m = map(int, input().split()) G = [[] for _ in range(n)] for _ in range(m): u, v = map(int, input().split()) u -= 1 v -= 1 G[u].append(v) G[v].append(u) seen = [-1]*n p, q, r = 0, 0, 0 def dfs(v): global p, q stack = [(v, 0)] seen[v] = 0 ...
output
1
28,961
13
57,923
Provide a correct Python 3 solution for this coding contest problem. Takahashi has received an undirected graph with N vertices, numbered 1, 2, ..., N. The edges in this graph are represented by (u_i, v_i). There are no self-loops and multiple edges in this graph. Based on this graph, Takahashi is now constructing a ...
instruction
0
28,962
13
57,924
"Correct Solution: ``` # 写経 # https://atcoder.jp/contests/agc011/submissions/1157055 class UnionFind: def __init__(self, n): self.v = [-1 for _ in range(n)] def find(self, x): if self.v[x] < 0: return x else: self.v[x] = self.find(self.v[x]) return s...
output
1
28,962
13
57,925
Provide a correct Python 3 solution for this coding contest problem. Takahashi has received an undirected graph with N vertices, numbered 1, 2, ..., N. The edges in this graph are represented by (u_i, v_i). There are no self-loops and multiple edges in this graph. Based on this graph, Takahashi is now constructing a ...
instruction
0
28,963
13
57,926
"Correct Solution: ``` mod = 1000000007 eps = 10**-9 def main(): import sys from collections import deque input = sys.stdin.buffer.readline N, M = map(int, input().split()) adj = [[] for _ in range(N+1)] for _ in range(M): a, b = map(int, input().split()) adj[a].append(b) ...
output
1
28,963
13
57,927
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Takahashi has received an undirected graph with N vertices, numbered 1, 2, ..., N. The edges in this graph are represented by (u_i, v_i). There are no self-loops and multiple edges in this graph...
instruction
0
28,964
13
57,928
Yes
output
1
28,964
13
57,929
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Takahashi has received an undirected graph with N vertices, numbered 1, 2, ..., N. The edges in this graph are represented by (u_i, v_i). There are no self-loops and multiple edges in this graph...
instruction
0
28,965
13
57,930
Yes
output
1
28,965
13
57,931
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Takahashi has received an undirected graph with N vertices, numbered 1, 2, ..., N. The edges in this graph are represented by (u_i, v_i). There are no self-loops and multiple edges in this graph...
instruction
0
28,966
13
57,932
Yes
output
1
28,966
13
57,933
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Takahashi has received an undirected graph with N vertices, numbered 1, 2, ..., N. The edges in this graph are represented by (u_i, v_i). There are no self-loops and multiple edges in this graph...
instruction
0
28,967
13
57,934
Yes
output
1
28,967
13
57,935
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Takahashi has received an undirected graph with N vertices, numbered 1, 2, ..., N. The edges in this graph are represented by (u_i, v_i). There are no self-loops and multiple edges in this graph...
instruction
0
28,968
13
57,936
No
output
1
28,968
13
57,937
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Takahashi has received an undirected graph with N vertices, numbered 1, 2, ..., N. The edges in this graph are represented by (u_i, v_i). There are no self-loops and multiple edges in this graph...
instruction
0
28,969
13
57,938
No
output
1
28,969
13
57,939
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Takahashi has received an undirected graph with N vertices, numbered 1, 2, ..., N. The edges in this graph are represented by (u_i, v_i). There are no self-loops and multiple edges in this graph...
instruction
0
28,970
13
57,940
No
output
1
28,970
13
57,941
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Takahashi has received an undirected graph with N vertices, numbered 1, 2, ..., N. The edges in this graph are represented by (u_i, v_i). There are no self-loops and multiple edges in this graph...
instruction
0
28,971
13
57,942
No
output
1
28,971
13
57,943
Provide tags and a correct Python 3 solution for this coding contest problem. The board has got a painted tree graph, consisting of n nodes. Let us remind you that a non-directed graph is called a tree if it is connected and doesn't contain any cycles. Each node of the graph is painted black or white in such a manner...
instruction
0
29,421
13
58,842
Tags: constructive algorithms, dsu, graphs, greedy, trees Correct Solution: ``` n = int(input()) white, black = [], [] for i in range(n): color, weightSum = map(int, input().split()) if color == 0: white.append([weightSum, i+1]) else : black.append([weightSum, i+1]) white.sort() black.sor...
output
1
29,421
13
58,843
Provide tags and a correct Python 3 solution for this coding contest problem. The board has got a painted tree graph, consisting of n nodes. Let us remind you that a non-directed graph is called a tree if it is connected and doesn't contain any cycles. Each node of the graph is painted black or white in such a manner...
instruction
0
29,422
13
58,844
Tags: constructive algorithms, dsu, graphs, greedy, trees Correct Solution: ``` n = int(input()) white, black = [], [] for i in range(n): color, weightSum = map(int, input().split()) if color == 0: white.append([weightSum, i+1]) else : black.append([weightSum, i+1]) #white.sort() #black.s...
output
1
29,422
13
58,845
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. The board has got a painted tree graph, consisting of n nodes. Let us remind you that a non-directed graph is called a tree if it is connected and doesn't contain any cycles. Each node of the g...
instruction
0
29,423
13
58,846
No
output
1
29,423
13
58,847
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. The board has got a painted tree graph, consisting of n nodes. Let us remind you that a non-directed graph is called a tree if it is connected and doesn't contain any cycles. Each node of the g...
instruction
0
29,424
13
58,848
No
output
1
29,424
13
58,849
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. The board has got a painted tree graph, consisting of n nodes. Let us remind you that a non-directed graph is called a tree if it is connected and doesn't contain any cycles. Each node of the g...
instruction
0
29,425
13
58,850
No
output
1
29,425
13
58,851
Provide tags and a correct Python 3 solution for this coding contest problem. Little girl Susie accidentally found her elder brother's notebook. She has many things to do, more important than solving problems, but she found this problem too interesting, so she wanted to know its solution and decided to ask you about i...
instruction
0
29,541
13
59,082
Tags: graphs, greedy, shortest paths Correct Solution: ``` from sys import stdin from heapq import heappop, heappush n,m = [int(x) for x in stdin.readline().split()] graph = [{} for x in range(n+1)] for e in range(m): u,v,w = [int(x) for x in stdin.readline().split()] graph[u][v] = (w,e) graph[v][u] = (w,e) u...
output
1
29,541
13
59,083
Provide tags and a correct Python 3 solution for this coding contest problem. Little girl Susie accidentally found her elder brother's notebook. She has many things to do, more important than solving problems, but she found this problem too interesting, so she wanted to know its solution and decided to ask you about i...
instruction
0
29,542
13
59,084
Tags: graphs, greedy, shortest paths Correct Solution: ``` from collections import defaultdict,deque,Counter,OrderedDict from heapq import heappop,heappush import bisect,sys,threading def main(): n, m = map(int, input().split()) adj = [[] for i in range(n + 1)] for i in range(m): a, b, c = map(int...
output
1
29,542
13
59,085
Provide tags and a correct Python 3 solution for this coding contest problem. Little girl Susie accidentally found her elder brother's notebook. She has many things to do, more important than solving problems, but she found this problem too interesting, so she wanted to know its solution and decided to ask you about i...
instruction
0
29,543
13
59,086
Tags: graphs, greedy, shortest paths Correct Solution: ``` import math,string,itertools,fractions,heapq,collections,re,array,bisect from itertools import chain, dropwhile, permutations, combinations from collections import defaultdict def VI(): return list(map(int,input().split())) def I(): return int(input()) def LIS...
output
1
29,543
13
59,087
Provide tags and a correct Python 3 solution for this coding contest problem. Little girl Susie accidentally found her elder brother's notebook. She has many things to do, more important than solving problems, but she found this problem too interesting, so she wanted to know its solution and decided to ask you about i...
instruction
0
29,544
13
59,088
Tags: graphs, greedy, shortest paths Correct Solution: ``` import heapq, sys input = sys.stdin.readline n, m = map(int, input().split()) ed = [(0, 0, 0)] + [tuple(map(int, input().split())) for _ in range(m)] src = int(input()) g = [[] for _ in range(n + 1)] for i, (u, v, w) in enumerate(ed): g[u].append((i, v, w...
output
1
29,544
13
59,089
Provide tags and a correct Python 3 solution for this coding contest problem. Little girl Susie accidentally found her elder brother's notebook. She has many things to do, more important than solving problems, but she found this problem too interesting, so she wanted to know its solution and decided to ask you about i...
instruction
0
29,545
13
59,090
Tags: graphs, greedy, shortest paths Correct Solution: ``` import heapq n, m = map(int, input().split()) ed = [(0, 0, 0)] + [tuple(map(int, input().split())) for _ in range(m)] src = int(input()) g = [[] for _ in range(n + 1)] for i, (u, v, w) in enumerate(ed): g[u].append((i, v, w)) g[v].append((i, u, w)) p...
output
1
29,545
13
59,091
Provide tags and a correct Python 3 solution for this coding contest problem. Little girl Susie accidentally found her elder brother's notebook. She has many things to do, more important than solving problems, but she found this problem too interesting, so she wanted to know its solution and decided to ask you about i...
instruction
0
29,546
13
59,092
Tags: graphs, greedy, shortest paths Correct Solution: ``` from heapq import heappop, heappush n,m = map(int,input().split()) adj = [[] for i in range(n+1)] for i in range(m): a,b,c = map(int,input().split()) adj[a].append((b, c, i)) adj[b].append((a, c, i)) v = int(input()) visited, ans, tw = [0]*(n+1), ...
output
1
29,546
13
59,093
Provide tags and a correct Python 3 solution for this coding contest problem. Little girl Susie accidentally found her elder brother's notebook. She has many things to do, more important than solving problems, but she found this problem too interesting, so she wanted to know its solution and decided to ask you about i...
instruction
0
29,547
13
59,094
Tags: graphs, greedy, shortest paths Correct Solution: ``` import heapq from collections import defaultdict from sys import stdin, stdout input = stdin.readline print = stdout.write def SPT(adjacency_list, src, v): heap = [(0, 0, src, 0)] visited = [False]*(n+1) spt = [] total = 0 while heap: ...
output
1
29,547
13
59,095
Provide tags and a correct Python 3 solution for this coding contest problem. Little girl Susie accidentally found her elder brother's notebook. She has many things to do, more important than solving problems, but she found this problem too interesting, so she wanted to know its solution and decided to ask you about i...
instruction
0
29,548
13
59,096
Tags: graphs, greedy, shortest paths Correct Solution: ``` import heapq from sys import stdin from math import inf input = stdin.readline def put(): return map(int, input().split()) def dijkstra(u): q = [(0,0,u-1,0)] vis= [False]*n ans = 0 res = [] while q: _,k,i,f = heapq.heappop(q) ...
output
1
29,548
13
59,097
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Little girl Susie accidentally found her elder brother's notebook. She has many things to do, more important than solving problems, but she found this problem too interesting, so she wanted to k...
instruction
0
29,549
13
59,098
Yes
output
1
29,549
13
59,099
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Little girl Susie accidentally found her elder brother's notebook. She has many things to do, more important than solving problems, but she found this problem too interesting, so she wanted to k...
instruction
0
29,550
13
59,100
Yes
output
1
29,550
13
59,101
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Little girl Susie accidentally found her elder brother's notebook. She has many things to do, more important than solving problems, but she found this problem too interesting, so she wanted to k...
instruction
0
29,551
13
59,102
Yes
output
1
29,551
13
59,103
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Little girl Susie accidentally found her elder brother's notebook. She has many things to do, more important than solving problems, but she found this problem too interesting, so she wanted to k...
instruction
0
29,552
13
59,104
Yes
output
1
29,552
13
59,105
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Little girl Susie accidentally found her elder brother's notebook. She has many things to do, more important than solving problems, but she found this problem too interesting, so she wanted to k...
instruction
0
29,553
13
59,106
No
output
1
29,553
13
59,107
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Little girl Susie accidentally found her elder brother's notebook. She has many things to do, more important than solving problems, but she found this problem too interesting, so she wanted to k...
instruction
0
29,554
13
59,108
No
output
1
29,554
13
59,109
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Little girl Susie accidentally found her elder brother's notebook. She has many things to do, more important than solving problems, but she found this problem too interesting, so she wanted to k...
instruction
0
29,555
13
59,110
No
output
1
29,555
13
59,111
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Little girl Susie accidentally found her elder brother's notebook. She has many things to do, more important than solving problems, but she found this problem too interesting, so she wanted to k...
instruction
0
29,556
13
59,112
No
output
1
29,556
13
59,113
Provide tags and a correct Python 3 solution for this coding contest problem. For his computer science class, Jacob builds a model tree with sticks and balls containing n nodes in the shape of a tree. Jacob has spent ai minutes building the i-th ball in the tree. Jacob's teacher will evaluate his model and grade Jaco...
instruction
0
29,589
13
59,178
Tags: binary search, dfs and similar, dp, graphs, greedy, trees Correct Solution: ``` import sys input = sys.stdin.readline n, k = map(int, input().split()) a = [int(i) for i in input().split()] g = [[] for _ in range(n)] for i in range(n - 1): u, v = map(int, input().split()) g[u-1].append(v-1) g[v-1].append(u-1) ...
output
1
29,589
13
59,179
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. For his computer science class, Jacob builds a model tree with sticks and balls containing n nodes in the shape of a tree. Jacob has spent ai minutes building the i-th ball in the tree. Jacob's...
instruction
0
29,590
13
59,180
No
output
1
29,590
13
59,181
Provide tags and a correct Python 3 solution for this coding contest problem. You are given a tree consisting of n vertices. A number is written on each vertex; the number on vertex i is equal to a_i. Let's denote the function g(x, y) as the greatest common divisor of the numbers written on the vertices belonging to ...
instruction
0
29,731
13
59,462
Tags: divide and conquer, dp, dsu, number theory, trees Correct Solution: ``` import math import sys def get_primes(n): result = set() while n % 2 == 0: result.add(2) n = n / 2 for i in range(3, int(math.sqrt(n)) + 1, 2): while n % i == 0: result.add(i) n ...
output
1
29,731
13
59,463
Provide tags and a correct Python 3 solution for this coding contest problem. You are given a tree consisting of n vertices. A number is written on each vertex; the number on vertex i is equal to a_i. Let's denote the function g(x, y) as the greatest common divisor of the numbers written on the vertices belonging to ...
instruction
0
29,732
13
59,464
Tags: divide and conquer, dp, dsu, number theory, trees Correct Solution: ``` from sys import stdin, stdout from math import * from heapq import * from collections import * dv=list(range(200002)) for i in range(2,200002): if ((i*i)>=200002): break if (dv[i]==i): j=i while ((i*j)<200002...
output
1
29,732
13
59,465
Provide tags and a correct Python 3 solution for this coding contest problem. You are given a tree consisting of n vertices. A number is written on each vertex; the number on vertex i is equal to a_i. Let's denote the function g(x, y) as the greatest common divisor of the numbers written on the vertices belonging to ...
instruction
0
29,733
13
59,466
Tags: divide and conquer, dp, dsu, number theory, trees Correct Solution: ``` # -*- coding:utf-8 -*- """ created by shuangquan.huang at 1/16/19 """ import collections import time import os import sys import bisect import heapq N = int(input()) A = [0] + [int(x) for x in input().split()] G = collections.defaultdict...
output
1
29,733
13
59,467
Provide tags and a correct Python 3 solution for this coding contest problem. You are given a tree consisting of n vertices. A number is written on each vertex; the number on vertex i is equal to a_i. Let's denote the function g(x, y) as the greatest common divisor of the numbers written on the vertices belonging to ...
instruction
0
29,734
13
59,468
Tags: divide and conquer, dp, dsu, number theory, trees Correct Solution: ``` from collections import deque import sys from array import array # noqa: F401 import typing as Tp # noqa: F401 def input(): return sys.stdin.buffer.readline().decode('utf-8') def get_primes(n: int): from itertools import chain ...
output
1
29,734
13
59,469
Provide tags and a correct Python 3 solution for this coding contest problem. You are given a tree consisting of n vertices. A number is written on each vertex; the number on vertex i is equal to a_i. Let's denote the function g(x, y) as the greatest common divisor of the numbers written on the vertices belonging to ...
instruction
0
29,735
13
59,470
Tags: divide and conquer, dp, dsu, number theory, trees Correct Solution: ``` import sys answer = 1 z = True primes = [] for i in range (2, 5 * 10 ** 2): v = True for p in primes: if i % p == 0: v = False if v == True: primes.append(i) n = int(sys.stdin.readline().strip()) a = ...
output
1
29,735
13
59,471
Provide tags and a correct Python 3 solution for this coding contest problem. You are given a tree consisting of n vertices. A number is written on each vertex; the number on vertex i is equal to a_i. Let's denote the function g(x, y) as the greatest common divisor of the numbers written on the vertices belonging to ...
instruction
0
29,736
13
59,472
Tags: divide and conquer, dp, dsu, number theory, trees Correct Solution: ``` from math import gcd n = int(input()) a = [int(i) for i in input().split()] tree = [[] for i in range(0, n)] for i in range(0, n-1): s = input().split() v1 = int(s[0]) - 1 v2 = int(s[1]) - 1 tree[v1].append(v2) tree[v2].append(v1) ...
output
1
29,736
13
59,473
Provide tags and a correct Python 3 solution for this coding contest problem. You are given a tree consisting of n vertices. A number is written on each vertex; the number on vertex i is equal to a_i. Let's denote the function g(x, y) as the greatest common divisor of the numbers written on the vertices belonging to ...
instruction
0
29,737
13
59,474
Tags: divide and conquer, dp, dsu, number theory, trees Correct Solution: ``` from collections import deque # from time import time # tt = time() n = int(input()) a = [0] + list(map(int, input().split())) e = [[] for i in range(n + 1)] for i in range(n - 1): u, v = map(int, input().split()) e[u].append(v) e[v].appe...
output
1
29,737
13
59,475
Provide tags and a correct Python 3 solution for this coding contest problem. You are given a tree consisting of n vertices. A number is written on each vertex; the number on vertex i is equal to a_i. Let's denote the function g(x, y) as the greatest common divisor of the numbers written on the vertices belonging to ...
instruction
0
29,738
13
59,476
Tags: divide and conquer, dp, dsu, number theory, trees Correct Solution: ``` import os import sys from io import BytesIO, IOBase from collections import defaultdict, deque, Counter, OrderedDict import threading def main(): ans = 1 flag = True primes = [] for i in range(2, 500): v = 1 ...
output
1
29,738
13
59,477
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. You are given a tree consisting of n vertices. A number is written on each vertex; the number on vertex i is equal to a_i. Let's denote the function g(x, y) as the greatest common divisor of th...
instruction
0
29,739
13
59,478
No
output
1
29,739
13
59,479
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. You are given a tree consisting of n vertices. A number is written on each vertex; the number on vertex i is equal to a_i. Let's denote the function g(x, y) as the greatest common divisor of th...
instruction
0
29,740
13
59,480
No
output
1
29,740
13
59,481
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. You are given a tree consisting of n vertices. A number is written on each vertex; the number on vertex i is equal to a_i. Let's denote the function g(x, y) as the greatest common divisor of th...
instruction
0
29,741
13
59,482
No
output
1
29,741
13
59,483
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. You are given a tree consisting of n vertices. A number is written on each vertex; the number on vertex i is equal to a_i. Let's denote the function g(x, y) as the greatest common divisor of th...
instruction
0
29,742
13
59,484
No
output
1
29,742
13
59,485
Provide tags and a correct Python 3 solution for this coding contest problem. Recall that a binary search tree is a rooted binary tree, whose nodes each store a key and each have at most two distinguished subtrees, left and right. The key in each node must be greater than any key stored in the left subtree, and less t...
instruction
0
30,161
13
60,322
Tags: dp, math Correct Solution: ``` n = int(input()) pos = [2,1] # come in pairs of [odd, even] left subtree size for i in range(20): pos.extend([1 + pos[-1] + pos[-2], 1 + 2*pos[-2]]) print(int(n in pos)) ```
output
1
30,161
13
60,323
Provide tags and a correct Python 3 solution for this coding contest problem. Recall that a binary search tree is a rooted binary tree, whose nodes each store a key and each have at most two distinguished subtrees, left and right. The key in each node must be greater than any key stored in the left subtree, and less t...
instruction
0
30,162
13
60,324
Tags: dp, math Correct Solution: ``` def f(n): return (2**(n+3)+(-1)**n-9)//6 # for i in range(25): # print(f(i)); a = [ 0, 1, 2, 4, 5, 9, 10, 20, 21, 41, 42, 84, 85, 169, 170, 340, 341, 681, 682, 1364, 1365, 2729, 2730, 5460, 5461, 10921, 10922, 21844, 21845, 43689, 43690, 87380, 87381, 174761, 174762, 349524,...
output
1
30,162
13
60,325
Provide tags and a correct Python 3 solution for this coding contest problem. Recall that a binary search tree is a rooted binary tree, whose nodes each store a key and each have at most two distinguished subtrees, left and right. The key in each node must be greater than any key stored in the left subtree, and less t...
instruction
0
30,163
13
60,326
Tags: dp, math Correct Solution: ``` ''' Author : thekushalghosh Team : CodeDiggers ''' import sys,math input = sys.stdin.readline n = int(input()) q = [1,2] for i in range(34): if q[-1] % 2 != 0: q = q + [q[-1] + q[-2],q[-1] + q[-2] + 1] else: q = q + [(2 * q[-1]),(2 * q[-1]) + 1] if ...
output
1
30,163
13
60,327