message
stringlengths
2
44.5k
message_type
stringclasses
2 values
message_id
int64
0
1
conversation_id
int64
276
109k
cluster
float64
23
23
__index_level_0__
int64
552
217k
Provide tags and a correct Python 3 solution for this coding contest problem. Like any unknown mathematician, Yuri has favourite numbers: A, B, C, and D, where A ≤ B ≤ C ≤ D. Yuri also likes triangles and once he thought: how many non-degenerate triangles with integer sides x, y, and z exist, such that A ≤ x ≤ B ≤ y ≤...
instruction
0
20,421
23
40,842
Tags: binary search, implementation, math, two pointers Correct Solution: ``` import os import sys from io import BytesIO, IOBase from collections import Counter import math as mt BUFSIZE = 8192 class FastIO(IOBase): newlines = 0 def __init__(self, file): self._fd = file.fileno() self.buffer...
output
1
20,421
23
40,843
Provide tags and a correct Python 3 solution for this coding contest problem. Like any unknown mathematician, Yuri has favourite numbers: A, B, C, and D, where A ≤ B ≤ C ≤ D. Yuri also likes triangles and once he thought: how many non-degenerate triangles with integer sides x, y, and z exist, such that A ≤ x ≤ B ≤ y ≤...
instruction
0
20,422
23
40,844
Tags: binary search, implementation, math, two pointers Correct Solution: ``` a, b, c, d = map(int, input().split()) prefsum = [0]*(b+c+2) # O(linear) for i in range(a, b+1): # all (x, y) sums between (i+b, i+c) are possible prefsum[i + b] += 1 prefsum[i+c+1] += -1 # Get the prefix sum for i in range(1, l...
output
1
20,422
23
40,845
Provide tags and a correct Python 3 solution for this coding contest problem. Like any unknown mathematician, Yuri has favourite numbers: A, B, C, and D, where A ≤ B ≤ C ≤ D. Yuri also likes triangles and once he thought: how many non-degenerate triangles with integer sides x, y, and z exist, such that A ≤ x ≤ B ≤ y ≤...
instruction
0
20,423
23
40,846
Tags: binary search, implementation, math, two pointers Correct Solution: ``` x = input().split(' ') A = int(x[0]) B = int(x[1]) C = int(x[2]) D = int(x[3]) def gauss_count(n): if n <= 0: return 0 return n*(n+1)//2 count = 0 for z in range(C, D+1): if A + B > z: count += (B-A+1) * (C-B+1) co...
output
1
20,423
23
40,847
Provide tags and a correct Python 3 solution for this coding contest problem. Like any unknown mathematician, Yuri has favourite numbers: A, B, C, and D, where A ≤ B ≤ C ≤ D. Yuri also likes triangles and once he thought: how many non-degenerate triangles with integer sides x, y, and z exist, such that A ≤ x ≤ B ≤ y ≤...
instruction
0
20,424
23
40,848
Tags: binary search, implementation, math, two pointers Correct Solution: ``` (A, B, C, D) = map(int, input().split()) X = (A, B) Y = (B, C) Z = (C, D) z_max = min(B + C - 1, D) z_min = C ans = 0 for z in range(z_min, z_max + 1): x_min = max(0, A) x_max = min(B, z) y_min = max(0, B) y_max = min(C, z) ...
output
1
20,424
23
40,849
Provide tags and a correct Python 3 solution for this coding contest problem. Like any unknown mathematician, Yuri has favourite numbers: A, B, C, and D, where A ≤ B ≤ C ≤ D. Yuri also likes triangles and once he thought: how many non-degenerate triangles with integer sides x, y, and z exist, such that A ≤ x ≤ B ≤ y ≤...
instruction
0
20,425
23
40,850
Tags: binary search, implementation, math, two pointers Correct Solution: ``` import sys ints = (int(x) for x in sys.stdin.read().split()) sys.setrecursionlimit(3000) def main(): a,b,c,d = (next(ints) for i in range(4)) ans = 0 A = (b-a+1)*(c-b+1) h = min(c-b, b-a) lo, hi = min(a+c, b+b), max(a+c, ...
output
1
20,425
23
40,851
Provide tags and a correct Python 3 solution for this coding contest problem. Like any unknown mathematician, Yuri has favourite numbers: A, B, C, and D, where A ≤ B ≤ C ≤ D. Yuri also likes triangles and once he thought: how many non-degenerate triangles with integer sides x, y, and z exist, such that A ≤ x ≤ B ≤ y ≤...
instruction
0
20,426
23
40,852
Tags: binary search, implementation, math, two pointers Correct Solution: ``` import os import sys if os.path.exists('/mnt/c/Users/Square/square/codeforces'): f = iter(open('C.txt').readlines()) def input(): return next(f) else: input = lambda: sys.stdin.readline().strip() fprint = lambda *args: pr...
output
1
20,426
23
40,853
Provide tags and a correct Python 3 solution for this coding contest problem. Like any unknown mathematician, Yuri has favourite numbers: A, B, C, and D, where A ≤ B ≤ C ≤ D. Yuri also likes triangles and once he thought: how many non-degenerate triangles with integer sides x, y, and z exist, such that A ≤ x ≤ B ≤ y ≤...
instruction
0
20,427
23
40,854
Tags: binary search, implementation, math, two pointers Correct Solution: ``` a, b, c, d = map(int, input().split()) ans = 0 ru = [0] * (10 ** 6 + 10) for x in range(a, b + 1): l = x + b r = x + c + 1 ru[l] += 1 ru[r] -= 1 #print(ru[:d+5]) for i in range(10 ** 6 + 9): ru[i + 1] += ru[i] #print(ru[:d...
output
1
20,427
23
40,855
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Like any unknown mathematician, Yuri has favourite numbers: A, B, C, and D, where A ≤ B ≤ C ≤ D. Yuri also likes triangles and once he thought: how many non-degenerate triangles with integer sid...
instruction
0
20,428
23
40,856
Yes
output
1
20,428
23
40,857
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Like any unknown mathematician, Yuri has favourite numbers: A, B, C, and D, where A ≤ B ≤ C ≤ D. Yuri also likes triangles and once he thought: how many non-degenerate triangles with integer sid...
instruction
0
20,429
23
40,858
Yes
output
1
20,429
23
40,859
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Like any unknown mathematician, Yuri has favourite numbers: A, B, C, and D, where A ≤ B ≤ C ≤ D. Yuri also likes triangles and once he thought: how many non-degenerate triangles with integer sid...
instruction
0
20,430
23
40,860
Yes
output
1
20,430
23
40,861
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Like any unknown mathematician, Yuri has favourite numbers: A, B, C, and D, where A ≤ B ≤ C ≤ D. Yuri also likes triangles and once he thought: how many non-degenerate triangles with integer sid...
instruction
0
20,431
23
40,862
Yes
output
1
20,431
23
40,863
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Like any unknown mathematician, Yuri has favourite numbers: A, B, C, and D, where A ≤ B ≤ C ≤ D. Yuri also likes triangles and once he thought: how many non-degenerate triangles with integer sid...
instruction
0
20,432
23
40,864
No
output
1
20,432
23
40,865
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Like any unknown mathematician, Yuri has favourite numbers: A, B, C, and D, where A ≤ B ≤ C ≤ D. Yuri also likes triangles and once he thought: how many non-degenerate triangles with integer sid...
instruction
0
20,433
23
40,866
No
output
1
20,433
23
40,867
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Like any unknown mathematician, Yuri has favourite numbers: A, B, C, and D, where A ≤ B ≤ C ≤ D. Yuri also likes triangles and once he thought: how many non-degenerate triangles with integer sid...
instruction
0
20,434
23
40,868
No
output
1
20,434
23
40,869
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Like any unknown mathematician, Yuri has favourite numbers: A, B, C, and D, where A ≤ B ≤ C ≤ D. Yuri also likes triangles and once he thought: how many non-degenerate triangles with integer sid...
instruction
0
20,435
23
40,870
No
output
1
20,435
23
40,871
Provide tags and a correct Python 3 solution for this coding contest problem. You are given a grid with n rows and m columns, where each cell has a non-negative integer written on it. We say the grid is good if for each cell the following condition holds: if it has a number k > 0 written on it, then exactly k of its n...
instruction
0
20,436
23
40,872
Tags: constructive algorithms, greedy Correct Solution: ``` import math from collections import defaultdict def solve(n,m): mat = [] for i in range(n): temp = list(map(int,input().split())) mat.append(temp) # print(mat) for i in range(n): for j in range(m): if i==0 ...
output
1
20,436
23
40,873
Provide tags and a correct Python 3 solution for this coding contest problem. You are given a grid with n rows and m columns, where each cell has a non-negative integer written on it. We say the grid is good if for each cell the following condition holds: if it has a number k > 0 written on it, then exactly k of its n...
instruction
0
20,437
23
40,874
Tags: constructive algorithms, greedy Correct Solution: ``` #872 for _ in range(int(input())): n,m=[int(x)for x in input().split()] a=[] c=[0,n-1] d=[0,m-1] x=0 flag=0 for i in range(n): b=[int(x)for x in input().split()] a.append(b) for i in range(n): for j in ra...
output
1
20,437
23
40,875
Provide tags and a correct Python 3 solution for this coding contest problem. You are given a grid with n rows and m columns, where each cell has a non-negative integer written on it. We say the grid is good if for each cell the following condition holds: if it has a number k > 0 written on it, then exactly k of its n...
instruction
0
20,438
23
40,876
Tags: constructive algorithms, greedy Correct Solution: ``` for _ in range(int(input())): n,m=map(int,input().split()) l=[list(map(int,input().split())) for i in range(n)] for i in range(n): for j in range(m): t=[] count=0 flag=0 if l[i][j]>0: ...
output
1
20,438
23
40,877
Provide tags and a correct Python 3 solution for this coding contest problem. You are given a grid with n rows and m columns, where each cell has a non-negative integer written on it. We say the grid is good if for each cell the following condition holds: if it has a number k > 0 written on it, then exactly k of its n...
instruction
0
20,439
23
40,878
Tags: constructive algorithms, greedy Correct Solution: ``` import math t=int(input()) for _ in range(t): n,m=map(int,input().split()) a=[] for i in range(n): a.append(list(map(int,input().split()))) f=0 f1=0 for i in range(n): for j in range(m): c=0 if (i...
output
1
20,439
23
40,879
Provide tags and a correct Python 3 solution for this coding contest problem. You are given a grid with n rows and m columns, where each cell has a non-negative integer written on it. We say the grid is good if for each cell the following condition holds: if it has a number k > 0 written on it, then exactly k of its n...
instruction
0
20,440
23
40,880
Tags: constructive algorithms, greedy Correct Solution: ``` import sys def input(): return sys.stdin.readline().rstrip() def input_split(): return [int(i) for i in input().split()] testCases = int(input()) answers = [] def make_ideal(grid): global n, m for i in range(n): for j in range(m): if (i == 0 or i ...
output
1
20,440
23
40,881
Provide tags and a correct Python 3 solution for this coding contest problem. You are given a grid with n rows and m columns, where each cell has a non-negative integer written on it. We say the grid is good if for each cell the following condition holds: if it has a number k > 0 written on it, then exactly k of its n...
instruction
0
20,441
23
40,882
Tags: constructive algorithms, greedy Correct Solution: ``` for t in range(int(input())): n,m=map(int,input().split()) grid = list() for i in range(n): grid.append(list(map(int,input().split()))) corner_ok = (grid[0][0]<=2) and (grid[0][m-1]<=2) and (grid[n-1][0]<=2) and (grid[n-1][m-1]<=2) edge_ok = True f...
output
1
20,441
23
40,883
Provide tags and a correct Python 3 solution for this coding contest problem. You are given a grid with n rows and m columns, where each cell has a non-negative integer written on it. We say the grid is good if for each cell the following condition holds: if it has a number k > 0 written on it, then exactly k of its n...
instruction
0
20,442
23
40,884
Tags: constructive algorithms, greedy Correct Solution: ``` # input = open('file.txt').readline for _ in range( int(input()) ): n , m = map( int , input().strip().split(" ") ) grid = [] for __ in range( n ): arr = list( map( int , input().strip().split(" ") ) ) grid.append(arr) flag = True ...
output
1
20,442
23
40,885
Provide tags and a correct Python 3 solution for this coding contest problem. You are given a grid with n rows and m columns, where each cell has a non-negative integer written on it. We say the grid is good if for each cell the following condition holds: if it has a number k > 0 written on it, then exactly k of its n...
instruction
0
20,443
23
40,886
Tags: constructive algorithms, greedy Correct Solution: ``` # -*- coding: utf-8 -*- # import bisect # import heapq # import math # import random # from collections import Counter, defaultdict, deque # from decimal import ROUND_CEILING, ROUND_HALF_UP, Decimal # from functools import lru_cache, reduce # from itertools im...
output
1
20,443
23
40,887
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. You are given a grid with n rows and m columns, where each cell has a non-negative integer written on it. We say the grid is good if for each cell the following condition holds: if it has a numb...
instruction
0
20,444
23
40,888
Yes
output
1
20,444
23
40,889
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. You are given a grid with n rows and m columns, where each cell has a non-negative integer written on it. We say the grid is good if for each cell the following condition holds: if it has a numb...
instruction
0
20,445
23
40,890
Yes
output
1
20,445
23
40,891
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. You are given a grid with n rows and m columns, where each cell has a non-negative integer written on it. We say the grid is good if for each cell the following condition holds: if it has a numb...
instruction
0
20,446
23
40,892
Yes
output
1
20,446
23
40,893
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. You are given a grid with n rows and m columns, where each cell has a non-negative integer written on it. We say the grid is good if for each cell the following condition holds: if it has a numb...
instruction
0
20,447
23
40,894
Yes
output
1
20,447
23
40,895
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. You are given a grid with n rows and m columns, where each cell has a non-negative integer written on it. We say the grid is good if for each cell the following condition holds: if it has a numb...
instruction
0
20,448
23
40,896
No
output
1
20,448
23
40,897
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. You are given a grid with n rows and m columns, where each cell has a non-negative integer written on it. We say the grid is good if for each cell the following condition holds: if it has a numb...
instruction
0
20,449
23
40,898
No
output
1
20,449
23
40,899
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. You are given a grid with n rows and m columns, where each cell has a non-negative integer written on it. We say the grid is good if for each cell the following condition holds: if it has a numb...
instruction
0
20,450
23
40,900
No
output
1
20,450
23
40,901
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. You are given a grid with n rows and m columns, where each cell has a non-negative integer written on it. We say the grid is good if for each cell the following condition holds: if it has a numb...
instruction
0
20,451
23
40,902
No
output
1
20,451
23
40,903
Provide tags and a correct Python 3 solution for this coding contest problem. Yura is tasked to build a closed fence in shape of an arbitrary non-degenerate simple quadrilateral. He's already got three straight fence segments with known lengths a, b, and c. Now he needs to find out some possible integer length d of th...
instruction
0
20,468
23
40,936
Tags: geometry, math Correct Solution: ``` for ctr in range(int(input())): a,b,c=map(int,input().split()) print(max(a,c,b)+1) ```
output
1
20,468
23
40,937
Provide tags and a correct Python 3 solution for this coding contest problem. Yura is tasked to build a closed fence in shape of an arbitrary non-degenerate simple quadrilateral. He's already got three straight fence segments with known lengths a, b, and c. Now he needs to find out some possible integer length d of th...
instruction
0
20,469
23
40,938
Tags: geometry, math Correct Solution: ``` from math import sqrt for _ in range(int(input())): a,b,c= sorted(map(int,input().split())) print(int(sqrt((c-a)*(c-a)+b*b))) ```
output
1
20,469
23
40,939
Provide tags and a correct Python 3 solution for this coding contest problem. Yura is tasked to build a closed fence in shape of an arbitrary non-degenerate simple quadrilateral. He's already got three straight fence segments with known lengths a, b, and c. Now he needs to find out some possible integer length d of th...
instruction
0
20,470
23
40,940
Tags: geometry, math Correct Solution: ``` from sys import stdin, stdout t=int(stdin.readline()) for _ in range(t): a,b,c=map(int,stdin.readline().split()) print(int(((a-b)**2+c**2)**0.5)+1) ```
output
1
20,470
23
40,941
Provide tags and a correct Python 3 solution for this coding contest problem. Yura is tasked to build a closed fence in shape of an arbitrary non-degenerate simple quadrilateral. He's already got three straight fence segments with known lengths a, b, and c. Now he needs to find out some possible integer length d of th...
instruction
0
20,471
23
40,942
Tags: geometry, math Correct Solution: ``` import math t=int(input()) for _ in range(t): arr=list(map(int,input().split())) arr.sort() x=arr[0] y=arr[1] z=arr[2] ans= math.ceil(math.sqrt((z-y)**2 + x**2)) print(ans) ```
output
1
20,471
23
40,943
Provide tags and a correct Python 3 solution for this coding contest problem. Yura is tasked to build a closed fence in shape of an arbitrary non-degenerate simple quadrilateral. He's already got three straight fence segments with known lengths a, b, and c. Now he needs to find out some possible integer length d of th...
instruction
0
20,472
23
40,944
Tags: geometry, math Correct Solution: ``` import sys def In(): return sys.stdin.readline() def Out(x): return sys.stdout.write(str(x)+'\n') t=int(In()) for i in range(t): a,b,c=map(int,In().split()) m=max(a-b-c,b-a-c,c-a-b) n=a+b+c ans=max(m+1,1,n-1) Out(ans) ...
output
1
20,472
23
40,945
Provide tags and a correct Python 3 solution for this coding contest problem. Yura is tasked to build a closed fence in shape of an arbitrary non-degenerate simple quadrilateral. He's already got three straight fence segments with known lengths a, b, and c. Now he needs to find out some possible integer length d of th...
instruction
0
20,473
23
40,946
Tags: geometry, math Correct Solution: ``` # @oj: codeforces # @id: hitwanyang # @email: 296866643@qq.com # @date: 2020-10-09 16:07 # @url:https://codeforc.es/contest/1422/problem/A import sys,os from io import BytesIO, IOBase import collections,itertools,bisect,heapq,math,string from decimal import * # region fastio ...
output
1
20,473
23
40,947
Provide tags and a correct Python 3 solution for this coding contest problem. Yura is tasked to build a closed fence in shape of an arbitrary non-degenerate simple quadrilateral. He's already got three straight fence segments with known lengths a, b, and c. Now he needs to find out some possible integer length d of th...
instruction
0
20,474
23
40,948
Tags: geometry, math Correct Solution: ``` t = int(input()) results = [] for q in range(t): b, c, d = [int(i) for i in input().split()] result = b + c + d - 1 results.append(result) for i in results: print(i) ```
output
1
20,474
23
40,949
Provide tags and a correct Python 3 solution for this coding contest problem. Yura is tasked to build a closed fence in shape of an arbitrary non-degenerate simple quadrilateral. He's already got three straight fence segments with known lengths a, b, and c. Now he needs to find out some possible integer length d of th...
instruction
0
20,475
23
40,950
Tags: geometry, math Correct Solution: ``` import os import sys import io import functools import copy import math # input = io.BytesIO(os.read(0, os.fstat(0).st_size)).readline # 神奇快读,无法运行调试 GANS = [] # def print(*args): # 神奇快写,最后得写上os.write # global GANS # for i in args: # GANS.append(f'{i}'.encode(...
output
1
20,475
23
40,951
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Yura is tasked to build a closed fence in shape of an arbitrary non-degenerate simple quadrilateral. He's already got three straight fence segments with known lengths a, b, and c. Now he needs t...
instruction
0
20,476
23
40,952
Yes
output
1
20,476
23
40,953
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Yura is tasked to build a closed fence in shape of an arbitrary non-degenerate simple quadrilateral. He's already got three straight fence segments with known lengths a, b, and c. Now he needs t...
instruction
0
20,477
23
40,954
Yes
output
1
20,477
23
40,955
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Yura is tasked to build a closed fence in shape of an arbitrary non-degenerate simple quadrilateral. He's already got three straight fence segments with known lengths a, b, and c. Now he needs t...
instruction
0
20,478
23
40,956
Yes
output
1
20,478
23
40,957
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Yura is tasked to build a closed fence in shape of an arbitrary non-degenerate simple quadrilateral. He's already got three straight fence segments with known lengths a, b, and c. Now he needs t...
instruction
0
20,479
23
40,958
Yes
output
1
20,479
23
40,959
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Yura is tasked to build a closed fence in shape of an arbitrary non-degenerate simple quadrilateral. He's already got three straight fence segments with known lengths a, b, and c. Now he needs t...
instruction
0
20,480
23
40,960
No
output
1
20,480
23
40,961
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Yura is tasked to build a closed fence in shape of an arbitrary non-degenerate simple quadrilateral. He's already got three straight fence segments with known lengths a, b, and c. Now he needs t...
instruction
0
20,481
23
40,962
No
output
1
20,481
23
40,963
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Yura is tasked to build a closed fence in shape of an arbitrary non-degenerate simple quadrilateral. He's already got three straight fence segments with known lengths a, b, and c. Now he needs t...
instruction
0
20,482
23
40,964
No
output
1
20,482
23
40,965
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Yura is tasked to build a closed fence in shape of an arbitrary non-degenerate simple quadrilateral. He's already got three straight fence segments with known lengths a, b, and c. Now he needs t...
instruction
0
20,483
23
40,966
No
output
1
20,483
23
40,967
Evaluate the correctness of the submitted Python 3 solution to the coding contest problem. Provide a "Yes" or "No" response. Ayrat is looking for the perfect code. He decided to start his search from an infinite field tiled by hexagons. For convenience the coordinate system is introduced, take a look at the picture to...
instruction
0
20,731
23
41,462
Yes
output
1
20,731
23
41,463
Provide tags and a correct Python 3 solution for this coding contest problem. You are given n points on a line with their coordinates xi. Find the point x so the sum of distances to the given points is minimal. Input The first line contains integer n (1 ≤ n ≤ 3·105) — the number of points on the line. The second li...
instruction
0
20,766
23
41,532
Tags: brute force, sortings Correct Solution: ``` ##n = int(input()) ##a = list(map(int, input().split())) ##print(" ".join(map(str, res))) n = int(input()) x = list(map(int, input().split())) x.sort() print(x[int((n+1)/2)-1]) ```
output
1
20,766
23
41,533
Provide tags and a correct Python 3 solution for this coding contest problem. You are given n points on a line with their coordinates xi. Find the point x so the sum of distances to the given points is minimal. Input The first line contains integer n (1 ≤ n ≤ 3·105) — the number of points on the line. The second li...
instruction
0
20,767
23
41,534
Tags: brute force, sortings Correct Solution: ``` n=int(input()) l=list(map(int,input().split())) l.sort() x=n//2 if n%2==0: x-=1 print(l[x]) ```
output
1
20,767
23
41,535