description
stringlengths
171
4k
code
stringlengths
94
3.98k
normalized_code
stringlengths
57
4.99k
Read problems statements [Bengali] , [Mandarin chinese] , [Russian] and [Vietnamese] as well. Chef is a cook and he has recently opened a restaurant. The restaurant is open during $N$ time intervals $[L_{1}, R_{1}), [L_{2}, R_{2}), \dots, [L_{N}, R_{N})$. No two of these intervals overlap — formally, for each valid $...
def find_index(arr, n, K): start = 0 end = n - 1 while start <= end: mid = (start + end) // 2 if arr[mid] == K: return mid elif arr[mid] < K: start = mid + 1 else: end = mid - 1 return end + 1 t = int(input()) for test in range(t): ...
FUNC_DEF ASSIGN VAR NUMBER ASSIGN VAR BIN_OP VAR NUMBER WHILE VAR VAR ASSIGN VAR BIN_OP BIN_OP VAR VAR NUMBER IF VAR VAR VAR RETURN VAR IF VAR VAR VAR ASSIGN VAR BIN_OP VAR NUMBER ASSIGN VAR BIN_OP VAR NUMBER RETURN BIN_OP VAR NUMBER ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR FOR VAR FUNC_CALL VAR VAR ASSIGN VAR VAR FUNC_C...
Read problems statements [Bengali] , [Mandarin chinese] , [Russian] and [Vietnamese] as well. Chef is a cook and he has recently opened a restaurant. The restaurant is open during $N$ time intervals $[L_{1}, R_{1}), [L_{2}, R_{2}), \dots, [L_{N}, R_{N})$. No two of these intervals overlap — formally, for each valid $...
t = int(input()) for co in range(t): l = [] n, m = list(map(int, input().split())) for i in range(n): l.append(list(map(int, input().split()))) l.sort() for i in range(m): c = 0 s = int(input()) if s >= l[-1][1]: print("-1") elif s < l[0][0]: ...
ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR FOR VAR FUNC_CALL VAR VAR ASSIGN VAR LIST ASSIGN VAR VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR FOR VAR FUNC_CALL VAR VAR EXPR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR EXPR FUNC_CALL VAR FOR VAR FUNC_CALL VAR VAR ASSIGN VAR NUMBER ASSI...
Read problems statements [Bengali] , [Mandarin chinese] , [Russian] and [Vietnamese] as well. Chef is a cook and he has recently opened a restaurant. The restaurant is open during $N$ time intervals $[L_{1}, R_{1}), [L_{2}, R_{2}), \dots, [L_{N}, R_{N})$. No two of these intervals overlap — formally, for each valid $...
from sys import stdin def binary_search(interval, x): start, end = 0, len(interval) - 1 while start <= end: mid = (start + end) // 2 if interval[mid][0] <= x < interval[mid][1]: return mid elif interval[mid][0] > x: end = mid - 1 elif interval[mid][0] < ...
FUNC_DEF ASSIGN VAR VAR NUMBER BIN_OP FUNC_CALL VAR VAR NUMBER WHILE VAR VAR ASSIGN VAR BIN_OP BIN_OP VAR VAR NUMBER IF VAR VAR NUMBER VAR VAR VAR NUMBER RETURN VAR IF VAR VAR NUMBER VAR ASSIGN VAR BIN_OP VAR NUMBER IF VAR VAR NUMBER VAR ASSIGN VAR BIN_OP VAR NUMBER RETURN LIST VAR VAR ASSIGN VAR FUNC_CALL VAR FUNC_CAL...
Read problems statements [Bengali] , [Mandarin chinese] , [Russian] and [Vietnamese] as well. Chef is a cook and he has recently opened a restaurant. The restaurant is open during $N$ time intervals $[L_{1}, R_{1}), [L_{2}, R_{2}), \dots, [L_{N}, R_{N})$. No two of these intervals overlap — formally, for each valid $...
t = int(input()) for _ in range(t): n, m = map(int, input().split()) lst = [] for __ in range(n): a, b = map(int, input().split()) lst.append([a, b]) lst.sort(key=lambda x: x[0]) for __ in range(m): curr = int(input()) si = 0 ei = n - 1 ans = -1 ...
ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR FOR VAR FUNC_CALL VAR VAR ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR LIST FOR VAR FUNC_CALL VAR VAR ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR EXPR FUNC_CALL VAR LIST VAR VAR EXPR FUNC_CALL VAR VAR NUMBER FOR VAR FUNC_CALL VAR VAR ASSIGN VAR ...
Read problems statements [Bengali] , [Mandarin chinese] , [Russian] and [Vietnamese] as well. Chef is a cook and he has recently opened a restaurant. The restaurant is open during $N$ time intervals $[L_{1}, R_{1}), [L_{2}, R_{2}), \dots, [L_{N}, R_{N})$. No two of these intervals overlap — formally, for each valid $...
def binary_search(num): start = 0 end = n - 1 if num < intervals[0][0]: return intervals[0][0] - num elif num >= intervals[-1][1]: return -1 elif num < intervals[-1][1] and num >= intervals[-1][0]: return 0 while start <= end: mid = (start + end) // 2 if n...
FUNC_DEF ASSIGN VAR NUMBER ASSIGN VAR BIN_OP VAR NUMBER IF VAR VAR NUMBER NUMBER RETURN BIN_OP VAR NUMBER NUMBER VAR IF VAR VAR NUMBER NUMBER RETURN NUMBER IF VAR VAR NUMBER NUMBER VAR VAR NUMBER NUMBER RETURN NUMBER WHILE VAR VAR ASSIGN VAR BIN_OP BIN_OP VAR VAR NUMBER IF VAR VAR VAR NUMBER VAR VAR VAR NUMBER RETURN N...
Read problems statements [Bengali] , [Mandarin chinese] , [Russian] and [Vietnamese] as well. Chef is a cook and he has recently opened a restaurant. The restaurant is open during $N$ time intervals $[L_{1}, R_{1}), [L_{2}, R_{2}), \dots, [L_{N}, R_{N})$. No two of these intervals overlap — formally, for each valid $...
def before_after_time(s, e, li, time): if len(li) == 1: return li[0], False mid = (s + e) // 2 if li[mid] == time: return li[mid], True if abs(e - s) == 1: return li[s], li[e] if time > li[mid]: return before_after_time(mid, e, li, time) else: return befor...
FUNC_DEF IF FUNC_CALL VAR VAR NUMBER RETURN VAR NUMBER NUMBER ASSIGN VAR BIN_OP BIN_OP VAR VAR NUMBER IF VAR VAR VAR RETURN VAR VAR NUMBER IF FUNC_CALL VAR BIN_OP VAR VAR NUMBER RETURN VAR VAR VAR VAR IF VAR VAR VAR RETURN FUNC_CALL VAR VAR VAR VAR VAR RETURN FUNC_CALL VAR VAR VAR VAR VAR FUNC_DEF FOR VAR FUNC_CALL VAR...
Read problems statements [Bengali] , [Mandarin chinese] , [Russian] and [Vietnamese] as well. Chef is a cook and he has recently opened a restaurant. The restaurant is open during $N$ time intervals $[L_{1}, R_{1}), [L_{2}, R_{2}), \dots, [L_{N}, R_{N})$. No two of these intervals overlap — formally, for each valid $...
def least_greater_than(a, N, key): start = 0 end = N ans = -1 while end >= start: mid = (start + end) // 2 if mid >= N or mid < 0: break elif a[mid][1] <= key: start = mid + 1 elif a[mid][1] > key: ans = mid end = mid - 1 ...
FUNC_DEF ASSIGN VAR NUMBER ASSIGN VAR VAR ASSIGN VAR NUMBER WHILE VAR VAR ASSIGN VAR BIN_OP BIN_OP VAR VAR NUMBER IF VAR VAR VAR NUMBER IF VAR VAR NUMBER VAR ASSIGN VAR BIN_OP VAR NUMBER IF VAR VAR NUMBER VAR ASSIGN VAR VAR ASSIGN VAR BIN_OP VAR NUMBER RETURN VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR LIST F...
Read problems statements [Bengali] , [Mandarin chinese] , [Russian] and [Vietnamese] as well. Chef is a cook and he has recently opened a restaurant. The restaurant is open during $N$ time intervals $[L_{1}, R_{1}), [L_{2}, R_{2}), \dots, [L_{N}, R_{N})$. No two of these intervals overlap — formally, for each valid $...
def binarySearch(arr, target, end): start = 0 ans = end + 1 while start <= end: mid = start + (end - start) // 2 if arr[mid][0] < target: start = mid + 1 else: ans = mid end = mid - 1 return ans tests = int(input().strip()) for t in range(tes...
FUNC_DEF ASSIGN VAR NUMBER ASSIGN VAR BIN_OP VAR NUMBER WHILE VAR VAR ASSIGN VAR BIN_OP VAR BIN_OP BIN_OP VAR VAR NUMBER IF VAR VAR NUMBER VAR ASSIGN VAR BIN_OP VAR NUMBER ASSIGN VAR VAR ASSIGN VAR BIN_OP VAR NUMBER RETURN VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL FUNC_CALL VAR FOR VAR FUNC_CALL VAR VAR ASSIGN VAR VAR FUN...
Read problems statements [Bengali] , [Mandarin chinese] , [Russian] and [Vietnamese] as well. Chef is a cook and he has recently opened a restaurant. The restaurant is open during $N$ time intervals $[L_{1}, R_{1}), [L_{2}, R_{2}), \dots, [L_{N}, R_{N})$. No two of these intervals overlap — formally, for each valid $...
def fun(ar, x): l = 0 u = len(ar) an = -1 while l <= u: m = (l + u) // 2 if m >= len(ar) or m < 0: return an s, e = ar[m][0], ar[m][1] if x >= e: l = m + 1 elif e > x: an = m u = m - 1 return an for _ in range(...
FUNC_DEF ASSIGN VAR NUMBER ASSIGN VAR FUNC_CALL VAR VAR ASSIGN VAR NUMBER WHILE VAR VAR ASSIGN VAR BIN_OP BIN_OP VAR VAR NUMBER IF VAR FUNC_CALL VAR VAR VAR NUMBER RETURN VAR ASSIGN VAR VAR VAR VAR NUMBER VAR VAR NUMBER IF VAR VAR ASSIGN VAR BIN_OP VAR NUMBER IF VAR VAR ASSIGN VAR VAR ASSIGN VAR BIN_OP VAR NUMBER RETUR...
Read problems statements [Bengali] , [Mandarin chinese] , [Russian] and [Vietnamese] as well. Chef is a cook and he has recently opened a restaurant. The restaurant is open during $N$ time intervals $[L_{1}, R_{1}), [L_{2}, R_{2}), \dots, [L_{N}, R_{N})$. No two of these intervals overlap — formally, for each valid $...
def solve(times, people): l, r = 0, len(times) - 1 ans = -1 while l <= r: mid = (l + r) // 2 if times[mid][1] > people: ans = mid r = mid - 1 else: l = mid + 1 if ans == -1: return ans return max(0, times[ans][0] - people) for _ i...
FUNC_DEF ASSIGN VAR VAR NUMBER BIN_OP FUNC_CALL VAR VAR NUMBER ASSIGN VAR NUMBER WHILE VAR VAR ASSIGN VAR BIN_OP BIN_OP VAR VAR NUMBER IF VAR VAR NUMBER VAR ASSIGN VAR VAR ASSIGN VAR BIN_OP VAR NUMBER ASSIGN VAR BIN_OP VAR NUMBER IF VAR NUMBER RETURN VAR RETURN FUNC_CALL VAR NUMBER BIN_OP VAR VAR NUMBER VAR FOR VAR FUN...
Read problems statements [Bengali] , [Mandarin chinese] , [Russian] and [Vietnamese] as well. Chef is a cook and he has recently opened a restaurant. The restaurant is open during $N$ time intervals $[L_{1}, R_{1}), [L_{2}, R_{2}), \dots, [L_{N}, R_{N})$. No two of these intervals overlap — formally, for each valid $...
t = int(input().strip()) def findRight(arr, start, end, num): if start > end: return -1 if start == end: return start mid = int((start + end) / 2) if arr[mid] == num: return mid if num > arr[mid]: return findRight(arr, mid + 1, end, num) else: return fin...
ASSIGN VAR FUNC_CALL VAR FUNC_CALL FUNC_CALL VAR FUNC_DEF IF VAR VAR RETURN NUMBER IF VAR VAR RETURN VAR ASSIGN VAR FUNC_CALL VAR BIN_OP BIN_OP VAR VAR NUMBER IF VAR VAR VAR RETURN VAR IF VAR VAR VAR RETURN FUNC_CALL VAR VAR BIN_OP VAR NUMBER VAR VAR RETURN FUNC_CALL VAR VAR VAR VAR VAR FOR VAR FUNC_CALL VAR VAR ASSIGN...
Read problems statements [Bengali] , [Mandarin chinese] , [Russian] and [Vietnamese] as well. Chef is a cook and he has recently opened a restaurant. The restaurant is open during $N$ time intervals $[L_{1}, R_{1}), [L_{2}, R_{2}), \dots, [L_{N}, R_{N})$. No two of these intervals overlap — formally, for each valid $...
def binary(a, q, n): i = 0 j = n - 1 ans = -1 while i <= j: mid = (i + j) // 2 if q >= a[mid][1]: i = mid + 1 else: ans = mid j = mid - 1 return ans def total_wait(a, n, t): a.sort(key=lambda a: a[0]) while t: t -= 1 ...
FUNC_DEF ASSIGN VAR NUMBER ASSIGN VAR BIN_OP VAR NUMBER ASSIGN VAR NUMBER WHILE VAR VAR ASSIGN VAR BIN_OP BIN_OP VAR VAR NUMBER IF VAR VAR VAR NUMBER ASSIGN VAR BIN_OP VAR NUMBER ASSIGN VAR VAR ASSIGN VAR BIN_OP VAR NUMBER RETURN VAR FUNC_DEF EXPR FUNC_CALL VAR VAR NUMBER WHILE VAR VAR NUMBER ASSIGN VAR FUNC_CALL VAR F...
Read problems statements [Bengali] , [Mandarin chinese] , [Russian] and [Vietnamese] as well. Chef is a cook and he has recently opened a restaurant. The restaurant is open during $N$ time intervals $[L_{1}, R_{1}), [L_{2}, R_{2}), \dots, [L_{N}, R_{N})$. No two of these intervals overlap — formally, for each valid $...
t = int(input()) for _ in range(t): n, m = list(map(int, input().split())) lr = [] for _ in range(n): a, b = list(map(int, input().split())) lr.append([a, b]) p = [] for _ in range(m): p.append(int(input())) lr.sort(key=lambda x: x[0]) for myTime in p: start =...
ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR FOR VAR FUNC_CALL VAR VAR ASSIGN VAR VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR LIST FOR VAR FUNC_CALL VAR VAR ASSIGN VAR VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR EXPR FUNC_CALL VAR LIST VAR VAR ASSIGN VAR LIST FOR VAR FUNC_CALL VAR V...
Read problems statements [Bengali] , [Mandarin chinese] , [Russian] and [Vietnamese] as well. Chef is a cook and he has recently opened a restaurant. The restaurant is open during $N$ time intervals $[L_{1}, R_{1}), [L_{2}, R_{2}), \dots, [L_{N}, R_{N})$. No two of these intervals overlap — formally, for each valid $...
def binarySearch(time, data): i = 0 j = len(time) - 1 while i <= j: m = (i + j) // 2 if time[m][0] < data: i = m + 1 elif time[m][0] > data: j = m - 1 else: return m return j test = int(input()) for _ in range(test): n, m = map(in...
FUNC_DEF ASSIGN VAR NUMBER ASSIGN VAR BIN_OP FUNC_CALL VAR VAR NUMBER WHILE VAR VAR ASSIGN VAR BIN_OP BIN_OP VAR VAR NUMBER IF VAR VAR NUMBER VAR ASSIGN VAR BIN_OP VAR NUMBER IF VAR VAR NUMBER VAR ASSIGN VAR BIN_OP VAR NUMBER RETURN VAR RETURN VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR FOR VAR FUNC_CALL VAR VAR ASSIGN ...
Read problems statements [Bengali] , [Mandarin chinese] , [Russian] and [Vietnamese] as well. Chef is a cook and he has recently opened a restaurant. The restaurant is open during $N$ time intervals $[L_{1}, R_{1}), [L_{2}, R_{2}), \dots, [L_{N}, R_{N})$. No two of these intervals overlap — formally, for each valid $...
def merge(arr, start, mid, end): i = start j = mid k = 0 temp = [0] * (end - start + 1) while i < mid and j <= end: if arr[i][0] <= arr[j][0]: temp[k] = arr[i] i += 1 k += 1 else: temp[k] = arr[j] j += 1 k += 1 ...
FUNC_DEF ASSIGN VAR VAR ASSIGN VAR VAR ASSIGN VAR NUMBER ASSIGN VAR BIN_OP LIST NUMBER BIN_OP BIN_OP VAR VAR NUMBER WHILE VAR VAR VAR VAR IF VAR VAR NUMBER VAR VAR NUMBER ASSIGN VAR VAR VAR VAR VAR NUMBER VAR NUMBER ASSIGN VAR VAR VAR VAR VAR NUMBER VAR NUMBER WHILE VAR VAR ASSIGN VAR VAR VAR VAR VAR NUMBER VAR NUMBER ...
Read problems statements [Bengali] , [Mandarin chinese] , [Russian] and [Vietnamese] as well. Chef is a cook and he has recently opened a restaurant. The restaurant is open during $N$ time intervals $[L_{1}, R_{1}), [L_{2}, R_{2}), \dots, [L_{N}, R_{N})$. No two of these intervals overlap — formally, for each valid $...
def searchP(p, arr, n): low, high = 0, n - 1 ans = -1 while low <= high: mid = low + (high - low) // 2 if arr[mid][1] > p: ans = mid high = mid - 1 else: low = mid + 1 if ans == -1: return -1 return max(0, arr[ans][0] - p) t = int...
FUNC_DEF ASSIGN VAR VAR NUMBER BIN_OP VAR NUMBER ASSIGN VAR NUMBER WHILE VAR VAR ASSIGN VAR BIN_OP VAR BIN_OP BIN_OP VAR VAR NUMBER IF VAR VAR NUMBER VAR ASSIGN VAR VAR ASSIGN VAR BIN_OP VAR NUMBER ASSIGN VAR BIN_OP VAR NUMBER IF VAR NUMBER RETURN NUMBER RETURN FUNC_CALL VAR NUMBER BIN_OP VAR VAR NUMBER VAR ASSIGN VAR ...
Little Petya likes arrays of integers a lot. Recently his mother has presented him one such array consisting of n elements. Petya is now wondering whether he can swap any two distinct integers in the array so that the array got unsorted. Please note that Petya can not swap equal integers even if they are in distinct po...
import sys def solve(): (n,) = rv() (a,) = rl(1) for i in range(min(10, n - 1)): for j in range(max(i + 1, n - 10), n): if a[i] != a[j]: a[i], a[j] = a[j], a[i] if notsorted(a): print(i + 1, j + 1) return ...
IMPORT FUNC_DEF ASSIGN VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR NUMBER FOR VAR FUNC_CALL VAR FUNC_CALL VAR NUMBER BIN_OP VAR NUMBER FOR VAR FUNC_CALL VAR FUNC_CALL VAR BIN_OP VAR NUMBER BIN_OP VAR NUMBER VAR IF VAR VAR VAR VAR ASSIGN VAR VAR VAR VAR VAR VAR VAR VAR IF FUNC_CALL VAR VAR EXPR FUNC_CALL VAR BIN_OP VAR N...
Little Petya likes arrays of integers a lot. Recently his mother has presented him one such array consisting of n elements. Petya is now wondering whether he can swap any two distinct integers in the array so that the array got unsorted. Please note that Petya can not swap equal integers even if they are in distinct po...
n = int(input()) lis = list(map(int, input().split())) sor = sorted(lis) res = sor[::-1] for i in range(1, n): if lis[i - 1] == lis[i]: continue for j in range(i - 1, n): if lis[i] != lis[j]: lis[i], lis[j] = lis[j], lis[i] if lis != sor and lis != res: pr...
ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR ASSIGN VAR VAR NUMBER FOR VAR FUNC_CALL VAR NUMBER VAR IF VAR BIN_OP VAR NUMBER VAR VAR FOR VAR FUNC_CALL VAR BIN_OP VAR NUMBER VAR IF VAR VAR VAR VAR ASSIGN VAR VAR VAR VAR VAR VAR VAR...
Little Petya likes arrays of integers a lot. Recently his mother has presented him one such array consisting of n elements. Petya is now wondering whether he can swap any two distinct integers in the array so that the array got unsorted. Please note that Petya can not swap equal integers even if they are in distinct po...
n = int(input()) t = list(map(int, input().split())) if n < 3 or n == 3 and t[0] == t[2] or all(i == t[0] for i in t): print(-1) else: i = 1 while t[i] == t[i - 1]: i += 1 if i > 1: print("2 " + str(i + 1)) elif t[0] < t[1]: if t[1] <= t[2]: print("1 2") e...
ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR IF VAR NUMBER VAR NUMBER VAR NUMBER VAR NUMBER FUNC_CALL VAR VAR VAR NUMBER VAR VAR EXPR FUNC_CALL VAR NUMBER ASSIGN VAR NUMBER WHILE VAR VAR VAR BIN_OP VAR NUMBER VAR NUMBER IF VAR NUMBER EXPR FUNC_CALL VAR BIN_OP...
Little Petya likes arrays of integers a lot. Recently his mother has presented him one such array consisting of n elements. Petya is now wondering whether he can swap any two distinct integers in the array so that the array got unsorted. Please note that Petya can not swap equal integers even if they are in distinct po...
n = int(input()) jim = [] p = list(map(int, input().split())) if n == 1 or n == 2 or len(set(p)) == 1: print(-1) elif n == 3 and len(set(p)) == 2: ka = [x for x in p] if p[0] == p[-1]: print(-1) elif p[0] == p[1]: print(2, 3) else: print(1, 2) elif len(set(p)) >= 3: kam =...
ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR LIST ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR IF VAR NUMBER VAR NUMBER FUNC_CALL VAR FUNC_CALL VAR VAR NUMBER EXPR FUNC_CALL VAR NUMBER IF VAR NUMBER FUNC_CALL VAR FUNC_CALL VAR VAR NUMBER ASSIGN VAR VAR VAR VAR IF VAR NUMBER VAR NUMBER EXPR FU...
Little Petya likes arrays of integers a lot. Recently his mother has presented him one such array consisting of n elements. Petya is now wondering whether he can swap any two distinct integers in the array so that the array got unsorted. Please note that Petya can not swap equal integers even if they are in distinct po...
n = int(input()) a = [int(i) for i in input().split()] b = len(set(a)) c = sorted(a, reverse=True) if n == 1 or n == 2 or b == 1: print("-1") elif n == 3: if b == 2: if a[0] == a[2]: print("-1") elif a[0] == a[1]: print("2 3") else: print("1 2") el...
ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR VAR NUMBER IF VAR NUMBER VAR NUMBER VAR NUMBER EXPR FUNC_CALL VAR STRING IF VAR NUMBER IF VAR NUMBER IF VAR NUMBER VAR NUMBER EXPR FUNC_CALL VAR STRING IF V...
Little Petya likes arrays of integers a lot. Recently his mother has presented him one such array consisting of n elements. Petya is now wondering whether he can swap any two distinct integers in the array so that the array got unsorted. Please note that Petya can not swap equal integers even if they are in distinct po...
def list_comp(x, y): for i in range(0, len(x)): if x[i] != y[i]: return False return True def main(): n = int(input()) a = list(map(int, input().split(" "))) if n <= 2: print(-1) exit() b = a.copy() b.sort() c = a.copy() c.sort(reverse=True) ...
FUNC_DEF FOR VAR FUNC_CALL VAR NUMBER FUNC_CALL VAR VAR IF VAR VAR VAR VAR RETURN NUMBER RETURN NUMBER FUNC_DEF ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR STRING IF VAR NUMBER EXPR FUNC_CALL VAR NUMBER EXPR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR EXPR FUNC_C...
Little Petya likes arrays of integers a lot. Recently his mother has presented him one such array consisting of n elements. Petya is now wondering whether he can swap any two distinct integers in the array so that the array got unsorted. Please note that Petya can not swap equal integers even if they are in distinct po...
n = int(input()) data = list(map(int, input().split())) mins = [(0) for i in range(n)] maxs = [(0) for i in range(n)] mins_back = [(0) for i in range(n)] maxs_back = [(0) for i in range(n)] min_ = data[0] mins[0] = 0 max_ = data[0] maxs[0] = 0 if n == 2: print(-1) exit(0) for i in range(n): if data[i] < min...
ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR NUMBER VAR FUNC_CALL VAR VAR ASSIGN VAR NUMBER VAR FUNC_CALL VAR VAR ASSIGN VAR NUMBER VAR FUNC_CALL VAR VAR ASSIGN VAR NUMBER VAR FUNC_CALL VAR VAR ASSIGN VAR VAR NUMBER ASSIGN VAR NUMBER NUMBER ASSIGN ...
Little Petya likes arrays of integers a lot. Recently his mother has presented him one such array consisting of n elements. Petya is now wondering whether he can swap any two distinct integers in the array so that the array got unsorted. Please note that Petya can not swap equal integers even if they are in distinct po...
n = int(input()) arr = list(map(int, input().split())) a, b = -1, -1 for i in range(1, n): if arr[i - 1] == arr[i]: continue arr[i - 1], arr[i] = arr[i], arr[i - 1] up, down = True, True for j in range(1, n): if arr[j - 1] < arr[j]: down = False if arr[j - 1] > arr[j]...
ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR VAR NUMBER NUMBER FOR VAR FUNC_CALL VAR NUMBER VAR IF VAR BIN_OP VAR NUMBER VAR VAR ASSIGN VAR BIN_OP VAR NUMBER VAR VAR VAR VAR VAR BIN_OP VAR NUMBER ASSIGN VAR VAR NUMBER NUMBER FOR VAR FUNC_CALL VAR N...
Little Petya likes arrays of integers a lot. Recently his mother has presented him one such array consisting of n elements. Petya is now wondering whether he can swap any two distinct integers in the array so that the array got unsorted. Please note that Petya can not swap equal integers even if they are in distinct po...
def hehe(a, n): if n == 1 or n == 2: return -1 a1 = list(a) for i in range(1, n - 1, 1): if a1[i - 1] == a1[i] == a1[i + 1]: continue elif a1[i - 1] <= a1[i] <= a1[i + 1] or a1[i - 1] >= a1[i] >= a1[i + 1]: if a1[i - 1] == a1[i]: return [i + 1,...
FUNC_DEF IF VAR NUMBER VAR NUMBER RETURN NUMBER ASSIGN VAR FUNC_CALL VAR VAR FOR VAR FUNC_CALL VAR NUMBER BIN_OP VAR NUMBER NUMBER IF VAR BIN_OP VAR NUMBER VAR VAR VAR BIN_OP VAR NUMBER IF VAR BIN_OP VAR NUMBER VAR VAR VAR BIN_OP VAR NUMBER VAR BIN_OP VAR NUMBER VAR VAR VAR BIN_OP VAR NUMBER IF VAR BIN_OP VAR NUMBER VA...
Little Petya likes arrays of integers a lot. Recently his mother has presented him one such array consisting of n elements. Petya is now wondering whether he can swap any two distinct integers in the array so that the array got unsorted. Please note that Petya can not swap equal integers even if they are in distinct po...
import sys n = int(input()) a = [int(s) for s in input().split()] for i in range(0, 2): for j in range(i + 1, n): if a[i] != a[j]: r = a[j] a[j] = a[i] a[i] = r lol = True lol1 = True for h in range(1, n): if a[h - 1] >...
IMPORT ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR VAR FUNC_CALL FUNC_CALL VAR FOR VAR FUNC_CALL VAR NUMBER NUMBER FOR VAR FUNC_CALL VAR BIN_OP VAR NUMBER VAR IF VAR VAR VAR VAR ASSIGN VAR VAR VAR ASSIGN VAR VAR VAR VAR ASSIGN VAR VAR VAR ASSIGN VAR NUMBER ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR...
Little Petya likes arrays of integers a lot. Recently his mother has presented him one such array consisting of n elements. Petya is now wondering whether he can swap any two distinct integers in the array so that the array got unsorted. Please note that Petya can not swap equal integers even if they are in distinct po...
n = int(input()) l = [int(i) for i in input().split()] if n == 1 or n == 2: print(-1) exit() if len(set(l)) == 1: print(-1) exit() def rev(l): return all(l[i] >= l[i + 1] for i in range(n - 1)) def srt(l): return all(l[i] <= l[i + 1] for i in range(n - 1)) if rev(l) or srt(l): for i in...
ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR VAR FUNC_CALL FUNC_CALL VAR IF VAR NUMBER VAR NUMBER EXPR FUNC_CALL VAR NUMBER EXPR FUNC_CALL VAR IF FUNC_CALL VAR FUNC_CALL VAR VAR NUMBER EXPR FUNC_CALL VAR NUMBER EXPR FUNC_CALL VAR FUNC_DEF RETURN FUNC_CALL VAR VAR VAR VAR BIN_OP VAR NUMBER VAR FUN...
Little Petya likes arrays of integers a lot. Recently his mother has presented him one such array consisting of n elements. Petya is now wondering whether he can swap any two distinct integers in the array so that the array got unsorted. Please note that Petya can not swap equal integers even if they are in distinct po...
def solve(arr): if len(arr) <= 2 or len(set(arr)) == 1: return [-1] else: for i in range(len(arr)): for j in range(i + 1, len(arr)): if arr[i] != arr[j]: arr[i], arr[j] = arr[j], arr[i] if arr != sorted(arr) and arr != list(reve...
FUNC_DEF IF FUNC_CALL VAR VAR NUMBER FUNC_CALL VAR FUNC_CALL VAR VAR NUMBER RETURN LIST NUMBER FOR VAR FUNC_CALL VAR FUNC_CALL VAR VAR FOR VAR FUNC_CALL VAR BIN_OP VAR NUMBER FUNC_CALL VAR VAR IF VAR VAR VAR VAR ASSIGN VAR VAR VAR VAR VAR VAR VAR VAR IF VAR FUNC_CALL VAR VAR VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VA...
A new strain of flu has broken out. Fortunately, a vaccine was developed very quickly and is now being administered to the public. Your local health clinic is administering this vaccine, but the waiting line is very long. For safety reasons, people are not allowed to stand very close to each other as the flu is not un...
def check(positions, N, T, mid): currPos = positions[N - 1] + mid for i in range(N - 2, -1, -1): currPos -= T if currPos > positions[i] + mid: currPos = positions[i] + mid elif currPos < positions[i] - mid: return False if currPos >= 0.0: return True ...
FUNC_DEF ASSIGN VAR BIN_OP VAR BIN_OP VAR NUMBER VAR FOR VAR FUNC_CALL VAR BIN_OP VAR NUMBER NUMBER NUMBER VAR VAR IF VAR BIN_OP VAR VAR VAR ASSIGN VAR BIN_OP VAR VAR VAR IF VAR BIN_OP VAR VAR VAR RETURN NUMBER IF VAR NUMBER RETURN NUMBER RETURN NUMBER FUNC_DEF ASSIGN VAR VAR VAR NUMBER NUMBER NUMBER WHILE BIN_OP VAR V...
A new strain of flu has broken out. Fortunately, a vaccine was developed very quickly and is now being administered to the public. Your local health clinic is administering this vaccine, but the waiting line is very long. For safety reasons, people are not allowed to stand very close to each other as the flu is not un...
def check(x, n, k, mid): curr = x[n - 1] + mid for i in range(n - 2, -1, -1): curr -= k if curr > x[i] + mid: curr = x[i] + mid elif curr < x[i] - mid: return False if curr >= 0.0: return True else: return False for _ in range(int(input()...
FUNC_DEF ASSIGN VAR BIN_OP VAR BIN_OP VAR NUMBER VAR FOR VAR FUNC_CALL VAR BIN_OP VAR NUMBER NUMBER NUMBER VAR VAR IF VAR BIN_OP VAR VAR VAR ASSIGN VAR BIN_OP VAR VAR VAR IF VAR BIN_OP VAR VAR VAR RETURN NUMBER IF VAR NUMBER RETURN NUMBER RETURN NUMBER FOR VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR VAR FU...
A new strain of flu has broken out. Fortunately, a vaccine was developed very quickly and is now being administered to the public. Your local health clinic is administering this vaccine, but the waiting line is very long. For safety reasons, people are not allowed to stand very close to each other as the flu is not un...
tc = int(input()) for k in range(tc): n, t = input().split() n, t = int(n), float(t) arr = [] for j in range(n): arr.append(float(input())) l = 0.0 r = 10.0**12 mn = r while True: mid = l + (r - l) / 2 if r - l <= 0.0001: mn = mid break ...
ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR FOR VAR FUNC_CALL VAR VAR ASSIGN VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL VAR VAR ASSIGN VAR LIST FOR VAR FUNC_CALL VAR VAR EXPR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR NUMBER ASSIGN VAR BIN_OP NUMBER NUMBER ASSIGN VAR VAR WHILE NUMBE...
A new strain of flu has broken out. Fortunately, a vaccine was developed very quickly and is now being administered to the public. Your local health clinic is administering this vaccine, but the waiting line is very long. For safety reasons, people are not allowed to stand very close to each other as the flu is not un...
def ok(d): lst = max(0, x[0] - d) for i in range(1, n): if x[i] + d < lst + t: return False else: lst = max(x[i] - d, lst + t) return True tst = int(input()) for _ in range(tst): n, t = map(float, input().split(" ")) n = int(n) x = [] for i in range(...
FUNC_DEF ASSIGN VAR FUNC_CALL VAR NUMBER BIN_OP VAR NUMBER VAR FOR VAR FUNC_CALL VAR NUMBER VAR IF BIN_OP VAR VAR VAR BIN_OP VAR VAR RETURN NUMBER ASSIGN VAR FUNC_CALL VAR BIN_OP VAR VAR VAR BIN_OP VAR VAR RETURN NUMBER ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR FOR VAR FUNC_CALL VAR VAR ASSIGN VAR VAR FUNC_CALL VAR VAR FU...
Everyone loves a freebie. Especially students. It is well-known that if in the night before exam a student opens window, opens the student's record-book and shouts loudly three times "Fly, freebie, fly!" — then flown freebie helps him to pass the upcoming exam. In the night before the exam on mathematical analysis n ...
n = int(input()) a = [int(i) for i in input().split()] k = int(input()) j = 1 x = [] c = 0 g = 0 a.sort() for i in range(n): f = i j = i + 1 g = 0 c = 0 while g <= k: if j == n: break if g == k and abs(a[f] - a[j]) != 0: break elif g + abs(a[f] - a[j])...
ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR NUMBER ASSIGN VAR LIST ASSIGN VAR NUMBER ASSIGN VAR NUMBER EXPR FUNC_CALL VAR FOR VAR FUNC_CALL VAR VAR ASSIGN VAR VAR ASSIGN VAR BIN_OP VAR NUMBER ASSIGN VAR NUMBER ASSIGN V...
Everyone loves a freebie. Especially students. It is well-known that if in the night before exam a student opens window, opens the student's record-book and shouts loudly three times "Fly, freebie, fly!" — then flown freebie helps him to pass the upcoming exam. In the night before the exam on mathematical analysis n ...
n, v = int(input()), list(sorted(map(int, input().split()))) t = int(input()) ans = 0 for i in range(n): k = 0 for j in range(i + 1, n): if v[j] - v[i] <= t: k += 1 ans = max(ans, k + 1) print(ans)
ASSIGN VAR VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR VAR ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR BIN_OP VAR NUMBER VAR IF BIN_OP VAR VAR VAR VAR VAR VAR NUMBER ASSIGN VAR FUNC_CALL ...
Everyone loves a freebie. Especially students. It is well-known that if in the night before exam a student opens window, opens the student's record-book and shouts loudly three times "Fly, freebie, fly!" — then flown freebie helps him to pass the upcoming exam. In the night before the exam on mathematical analysis n ...
class CodeforcesTask386BSolution: def __init__(self): self.result = "" self.n = 0 self.times = [] self.t = 0 def read_input(self): self.n = int(input()) self.times = [int(x) for x in input().split(" ")] self.t = int(input()) def process_task(self): ...
CLASS_DEF FUNC_DEF ASSIGN VAR STRING ASSIGN VAR NUMBER ASSIGN VAR LIST ASSIGN VAR NUMBER FUNC_DEF ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR VAR FUNC_CALL FUNC_CALL VAR STRING ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_DEF ASSIGN VAR NUMBER EXPR FUNC_CALL VAR FOR VAR FUNC_CALL VAR VAR ASSIGN V...
Everyone loves a freebie. Especially students. It is well-known that if in the night before exam a student opens window, opens the student's record-book and shouts loudly three times "Fly, freebie, fly!" — then flown freebie helps him to pass the upcoming exam. In the night before the exam on mathematical analysis n ...
n = int(input()) l = list(map(int, input().split())) t = int(input()) l.sort() ans = 0 start = 0 for end in range(n): while l[end] - l[start] > t: start += 1 if end - start + 1 > ans: ans = end - start + 1 print(ans)
ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR EXPR FUNC_CALL VAR ASSIGN VAR NUMBER ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR VAR WHILE BIN_OP VAR VAR VAR VAR VAR VAR NUMBER IF BIN_OP BIN_OP VAR VAR NUMBER VAR ASSIGN VAR BIN...
Everyone loves a freebie. Especially students. It is well-known that if in the night before exam a student opens window, opens the student's record-book and shouts loudly three times "Fly, freebie, fly!" — then flown freebie helps him to pass the upcoming exam. In the night before the exam on mathematical analysis n ...
n = int(input()) v = list(map(int, input().split())) t = int(input()) v.sort() ret = 1 lef = 0 rit = 1 while rit < n: while rit < n and v[rit] - v[lef] <= t: rit = rit + 1 ret = max(ret, rit - lef) lef = lef + 1 print(ret)
ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR EXPR FUNC_CALL VAR ASSIGN VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR NUMBER WHILE VAR VAR WHILE VAR VAR BIN_OP VAR VAR VAR VAR VAR ASSIGN VAR BIN_OP VAR NUMBER ASSIGN VAR FUNC_CA...
Everyone loves a freebie. Especially students. It is well-known that if in the night before exam a student opens window, opens the student's record-book and shouts loudly three times "Fly, freebie, fly!" — then flown freebie helps him to pass the upcoming exam. In the night before the exam on mathematical analysis n ...
n = int(input()) a = list(map(int, input().split())) t = int(input()) a.sort() ans = 0 for i in range(n): j = i count = 0 while j < n: if a[j] - a[i] <= t: count += 1 j += 1 else: break if count > ans: ans = count print(ans)
ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR EXPR FUNC_CALL VAR ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR VAR ASSIGN VAR VAR ASSIGN VAR NUMBER WHILE VAR VAR IF BIN_OP VAR VAR VAR VAR VAR VAR NUMBER VAR NUMBER IF VAR VAR AS...
Everyone loves a freebie. Especially students. It is well-known that if in the night before exam a student opens window, opens the student's record-book and shouts loudly three times "Fly, freebie, fly!" — then flown freebie helps him to pass the upcoming exam. In the night before the exam on mathematical analysis n ...
n = int(input()) time = list(map(int, input().split())) t = int(input()) num = [] time.sort() tmax = time[-1] tmin = time[0] if time[-1] - time[0] <= t: print(n) else: la = 0 stu = 0 for i in range(n): if time[i] <= tmin + t: stu += 1 la = i else: brea...
ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR LIST EXPR FUNC_CALL VAR ASSIGN VAR VAR NUMBER ASSIGN VAR VAR NUMBER IF BIN_OP VAR NUMBER VAR NUMBER VAR EXPR FUNC_CALL VAR VAR ASSIGN VAR NUMBER ASSIGN VAR NUMBER F...
Everyone loves a freebie. Especially students. It is well-known that if in the night before exam a student opens window, opens the student's record-book and shouts loudly three times "Fly, freebie, fly!" — then flown freebie helps him to pass the upcoming exam. In the night before the exam on mathematical analysis n ...
n = int(input()) l = list(map(int, input().split())) t = int(input()) l.sort() a = [] i = 0 j = 0 while i < n: while j < n and l[j] - l[i] <= t: j += 1 a.append(j - i) i += 1 print(max(a))
ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR EXPR FUNC_CALL VAR ASSIGN VAR LIST ASSIGN VAR NUMBER ASSIGN VAR NUMBER WHILE VAR VAR WHILE VAR VAR BIN_OP VAR VAR VAR VAR VAR VAR NUMBER EXPR FUNC_CALL VAR BIN_OP VAR VAR VAR ...
Everyone loves a freebie. Especially students. It is well-known that if in the night before exam a student opens window, opens the student's record-book and shouts loudly three times "Fly, freebie, fly!" — then flown freebie helps him to pass the upcoming exam. In the night before the exam on mathematical analysis n ...
n = int(input()) a = [int(x) for x in input().split()] t = int(input()) res = 1 a.sort() for i in range(n): for j in range(i + 1, n): if a[j] - a[i] <= t: res = max(j - i + 1, res) print(res)
ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR NUMBER EXPR FUNC_CALL VAR FOR VAR FUNC_CALL VAR VAR FOR VAR FUNC_CALL VAR BIN_OP VAR NUMBER VAR IF BIN_OP VAR VAR VAR VAR VAR ASSIGN VAR FUNC_CALL VAR BIN_OP BIN_OP VAR VAR N...
Everyone loves a freebie. Especially students. It is well-known that if in the night before exam a student opens window, opens the student's record-book and shouts loudly three times "Fly, freebie, fly!" — then flown freebie helps him to pass the upcoming exam. In the night before the exam on mathematical analysis n ...
n = int(input()) L = list(map(int, input().split())) T = int(input()) X = [0] * 1005 for i in range(len(L)): X[L[i]] += 1 for i in range(1, 1005): X[i] += X[i - 1] best = 0 for i in range(1 + T, 1005): if X[i] - X[i - T - 1] > best: best = X[i] - X[i - T - 1] print(best)
ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR BIN_OP LIST NUMBER NUMBER FOR VAR FUNC_CALL VAR FUNC_CALL VAR VAR VAR VAR VAR NUMBER FOR VAR FUNC_CALL VAR NUMBER NUMBER VAR VAR VAR BIN_OP VAR NUMBER ASSIGN VAR NU...
Everyone loves a freebie. Especially students. It is well-known that if in the night before exam a student opens window, opens the student's record-book and shouts loudly three times "Fly, freebie, fly!" — then flown freebie helps him to pass the upcoming exam. In the night before the exam on mathematical analysis n ...
n = int(input()) t = list(map(int, input().split())) T = int(input()) t.sort() m = 1 count = 0 for i in range(n): for j in range(i, n): if t[j] - t[i] <= T: count += 1 m = max(count, m) count = 0 print(m)
ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR EXPR FUNC_CALL VAR ASSIGN VAR NUMBER ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR VAR FOR VAR FUNC_CALL VAR VAR VAR IF BIN_OP VAR VAR VAR VAR VAR VAR NUMBER ASSIGN VAR FUNC_CALL VA...
Everyone loves a freebie. Especially students. It is well-known that if in the night before exam a student opens window, opens the student's record-book and shouts loudly three times "Fly, freebie, fly!" — then flown freebie helps him to pass the upcoming exam. In the night before the exam on mathematical analysis n ...
n = int(input()) l = list(map(int, input().split())) t = int(input()) l.sort() mx = 1 i = 0 j = 0 count = 1 while j < n - 1: count = 1 i = j + 1 while i < n: if l[i] - l[j] <= t: count += 1 i += 1 else: break if count > mx: mx = count j += ...
ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR EXPR FUNC_CALL VAR ASSIGN VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR NUMBER WHILE VAR BIN_OP VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR BIN_OP VAR NUMBER WHILE VAR...
Everyone loves a freebie. Especially students. It is well-known that if in the night before exam a student opens window, opens the student's record-book and shouts loudly three times "Fly, freebie, fly!" — then flown freebie helps him to pass the upcoming exam. In the night before the exam on mathematical analysis n ...
n = int(input()) t = sorted(list(map(int, input().split()))) T = int(input()) ans = 0 l = 0 r = 0 while r < n: ans = max(ans, r - l + 1) if r == n - 1: break if t[r + 1] - t[l] <= T: r += 1 else: l += 1 print(ans)
ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR NUMBER WHILE VAR VAR ASSIGN VAR FUNC_CALL VAR VAR BIN_OP BIN_OP VAR VAR NUMBER IF VAR BIN_OP VAR NUMBER IF BIN_OP ...
Everyone loves a freebie. Especially students. It is well-known that if in the night before exam a student opens window, opens the student's record-book and shouts loudly three times "Fly, freebie, fly!" — then flown freebie helps him to pass the upcoming exam. In the night before the exam on mathematical analysis n ...
n = int(input()) lst = sorted(list(map(int, input().split()))) t = int(input()) ans = 1 for i in range(len(lst) - 1): temp = 1 k = i + 1 while k < len(lst) and lst[k] - lst[i] <= t: temp += 1 k += 1 if temp > ans: ans = temp print(ans)
ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR BIN_OP FUNC_CALL VAR VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR BIN_OP VAR NUMBER WHILE VAR FUNC_CALL VAR VAR BIN_OP VAR VAR...
Everyone loves a freebie. Especially students. It is well-known that if in the night before exam a student opens window, opens the student's record-book and shouts loudly three times "Fly, freebie, fly!" — then flown freebie helps him to pass the upcoming exam. In the night before the exam on mathematical analysis n ...
n, t = input(), [0] * 1002 for i in map(int, input().split()): t[i] += 1 T = int(input()) + 1 for i in range(1000): t[i + 1] += t[i] print(max(t[i + T] - t[i] for i in range(-1, 1001 - T)))
ASSIGN VAR VAR FUNC_CALL VAR BIN_OP LIST NUMBER NUMBER FOR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR VAR VAR NUMBER ASSIGN VAR BIN_OP FUNC_CALL VAR FUNC_CALL VAR NUMBER FOR VAR FUNC_CALL VAR NUMBER VAR BIN_OP VAR NUMBER VAR VAR EXPR FUNC_CALL VAR FUNC_CALL VAR BIN_OP VAR BIN_OP VAR VAR VAR VAR VAR FUNC_CALL VAR NUM...
Everyone loves a freebie. Especially students. It is well-known that if in the night before exam a student opens window, opens the student's record-book and shouts loudly three times "Fly, freebie, fly!" — then flown freebie helps him to pass the upcoming exam. In the night before the exam on mathematical analysis n ...
read = lambda: list(map(int, input().split())) n = int(input()) a = sorted(read()) T = int(input()) ans = 0 j = 0 for i in range(n): while j < n and a[j] - a[i] <= T: j += 1 ans = max(ans, j - i) print(ans)
ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR NUMBER ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR VAR WHILE VAR VAR BIN_OP VAR VAR VAR VAR VAR VAR NUMBER ASSIGN VAR FUNC_CALL V...
Everyone loves a freebie. Especially students. It is well-known that if in the night before exam a student opens window, opens the student's record-book and shouts loudly three times "Fly, freebie, fly!" — then flown freebie helps him to pass the upcoming exam. In the night before the exam on mathematical analysis n ...
__author__ = "asmn" n = int(input()) a = sorted(map(int, input().split())) dt = int(input()) ans, l, r = 0, 0, 0 while r < len(a): while r < len(a) and a[r] - a[l] <= dt: r += 1 ans = max(ans, r - l) l += 1 print(ans)
ASSIGN VAR STRING ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR VAR VAR NUMBER NUMBER NUMBER WHILE VAR FUNC_CALL VAR VAR WHILE VAR FUNC_CALL VAR VAR BIN_OP VAR VAR VAR VAR VAR VAR NUMBER ASSIGN VAR FUNC_CALL VA...
Everyone loves a freebie. Especially students. It is well-known that if in the night before exam a student opens window, opens the student's record-book and shouts loudly three times "Fly, freebie, fly!" — then flown freebie helps him to pass the upcoming exam. In the night before the exam on mathematical analysis n ...
n = int(input()) m = list(map(int, input().split())) t = int(input()) m.sort() if n == 1 or len(m) == 1: print(1) elif m[-1] - m[0] <= t: print(n) else: mx = 1 for i in range(n - 1): ma = 1 fr = m[i] for j in range(i + 1, n): if m[j] - fr <= t: ma += 1...
ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR EXPR FUNC_CALL VAR IF VAR NUMBER FUNC_CALL VAR VAR NUMBER EXPR FUNC_CALL VAR NUMBER IF BIN_OP VAR NUMBER VAR NUMBER VAR EXPR FUNC_CALL VAR VAR ASSIGN VAR NUMBER FOR VAR FUNC_C...
Everyone loves a freebie. Especially students. It is well-known that if in the night before exam a student opens window, opens the student's record-book and shouts loudly three times "Fly, freebie, fly!" — then flown freebie helps him to pass the upcoming exam. In the night before the exam on mathematical analysis n ...
n = int(input()) l = [int(x) for x in input().split()] T = int(input()) l.sort() M = 1 inz = 0 fin = 1 count = 1 while fin < n: while fin < n and l[fin] - l[inz] <= T: count += 1 fin += 1 if count > M: M = count inz += 1 count -= 1 if fin < inz: fin = inz coun...
ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR EXPR FUNC_CALL VAR ASSIGN VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR NUMBER WHILE VAR VAR WHILE VAR VAR BIN_OP VAR VAR VAR VAR VAR VAR NUMBER VAR NUMBER IF VAR VAR ASSIGN...
Everyone loves a freebie. Especially students. It is well-known that if in the night before exam a student opens window, opens the student's record-book and shouts loudly three times "Fly, freebie, fly!" — then flown freebie helps him to pass the upcoming exam. In the night before the exam on mathematical analysis n ...
def halyava(lst, t): count = 1 for i in range(len(lst)): for j in range(i + 1, len(lst)): if sorted(lst)[j] - sorted(lst)[i] <= t: count = max(j - i + 1, count) return count n = int(input()) b = [int(x) for x in input().split()] T = int(input()) print(halyava(b, T))
FUNC_DEF ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR FUNC_CALL VAR VAR FOR VAR FUNC_CALL VAR BIN_OP VAR NUMBER FUNC_CALL VAR VAR IF BIN_OP FUNC_CALL VAR VAR VAR FUNC_CALL VAR VAR VAR VAR ASSIGN VAR FUNC_CALL VAR BIN_OP BIN_OP VAR VAR NUMBER VAR RETURN VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR ...
Pavel made a photo of his favourite stars in the sky. His camera takes a photo of all points of the sky that belong to some rectangle with sides parallel to the coordinate axes. Strictly speaking, it makes a photo of all points with coordinates (x, y), such that x_1 ≤ x ≤ x_2 and y_1 ≤ y ≤ y_2, where (x_1, y_1) and (x...
n = int(input()) a = list(map(int, input().split())) a.sort() l = [] if n == 0: print(0) else: for i in range(n): ln = a[i + n - 1] - a[i] if i == 0: breadth = a[-1] - a[n] else: breadth = a[-1] - a[0] l.append(ln * breadth) print(min(l))
ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR EXPR FUNC_CALL VAR ASSIGN VAR LIST IF VAR NUMBER EXPR FUNC_CALL VAR NUMBER FOR VAR FUNC_CALL VAR VAR ASSIGN VAR BIN_OP VAR BIN_OP BIN_OP VAR VAR NUMBER VAR VAR IF VAR NUMBER ASSIGN VAR BIN_OP VAR NUMBER VAR VAR ASS...
Pavel made a photo of his favourite stars in the sky. His camera takes a photo of all points of the sky that belong to some rectangle with sides parallel to the coordinate axes. Strictly speaking, it makes a photo of all points with coordinates (x, y), such that x_1 ≤ x ≤ x_2 and y_1 ≤ y ≤ y_2, where (x_1, y_1) and (x...
N = int(input()) A = list(map(int, input().split())) A.sort() s = (A[N - 1] - A[0]) * (A[2 * N - 1] - A[N]) for i in range(1, N): s = min(s, (A[N - 1 + i] - A[i]) * (A[2 * N - 1] - A[0])) print(s)
ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR EXPR FUNC_CALL VAR ASSIGN VAR BIN_OP BIN_OP VAR BIN_OP VAR NUMBER VAR NUMBER BIN_OP VAR BIN_OP BIN_OP NUMBER VAR NUMBER VAR VAR FOR VAR FUNC_CALL VAR NUMBER VAR ASSIGN VAR FUNC_CALL VAR VAR BIN_OP BIN_OP VAR BIN_OP...
Pavel made a photo of his favourite stars in the sky. His camera takes a photo of all points of the sky that belong to some rectangle with sides parallel to the coordinate axes. Strictly speaking, it makes a photo of all points with coordinates (x, y), such that x_1 ≤ x ≤ x_2 and y_1 ≤ y ≤ y_2, where (x_1, y_1) and (x...
n = int(input()) l = list(map(int, input().split())) assert len(l) == 2 * n l.sort() out = (l[n - 1] - l[0]) * (l[2 * n - 1] - l[n]) mult = l[-1] - l[0] for i in range(1, n): q = mult * (l[i + n - 1] - l[i]) if q < out: out = q print(out)
ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR FUNC_CALL VAR VAR BIN_OP NUMBER VAR EXPR FUNC_CALL VAR ASSIGN VAR BIN_OP BIN_OP VAR BIN_OP VAR NUMBER VAR NUMBER BIN_OP VAR BIN_OP BIN_OP NUMBER VAR NUMBER VAR VAR ASSIGN VAR BIN_OP VAR NUMBER VAR NUMBER FOR VAR FU...
Pavel made a photo of his favourite stars in the sky. His camera takes a photo of all points of the sky that belong to some rectangle with sides parallel to the coordinate axes. Strictly speaking, it makes a photo of all points with coordinates (x, y), such that x_1 ≤ x ≤ x_2 and y_1 ≤ y ≤ y_2, where (x_1, y_1) and (x...
n = int(input()) l = list(map(int, input().strip().split())) l.sort() a = l[n - 1] - l[0] b = l[2 * n - 1] - l[n] ans1 = a * b min1 = 1000000000000000000000 for i in range(1, n): s = l[i + n - 1] - l[i] if s < min1: min1 = s ans2 = min1 * (l[2 * n - 1] - l[0]) if ans1 < ans2: print(ans1) else: p...
ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL FUNC_CALL VAR EXPR FUNC_CALL VAR ASSIGN VAR BIN_OP VAR BIN_OP VAR NUMBER VAR NUMBER ASSIGN VAR BIN_OP VAR BIN_OP BIN_OP NUMBER VAR NUMBER VAR VAR ASSIGN VAR BIN_OP VAR VAR ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR NUMBER...
Pavel made a photo of his favourite stars in the sky. His camera takes a photo of all points of the sky that belong to some rectangle with sides parallel to the coordinate axes. Strictly speaking, it makes a photo of all points with coordinates (x, y), such that x_1 ≤ x ≤ x_2 and y_1 ≤ y ≤ y_2, where (x_1, y_1) and (x...
n = int(input()) a = [int(s) for s in input().split()] a = sorted(a) ind = 0 p = (a[n - 1] - a[0]) * (a[2 * n - 1] - a[n]) r = a[2 * n - 1] - a[0] for i in range(n + 1): if (a[i + n - 1] - a[i]) * r < p: p = (a[i + n - 1] - a[i]) * r print(p)
ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR ASSIGN VAR NUMBER ASSIGN VAR BIN_OP BIN_OP VAR BIN_OP VAR NUMBER VAR NUMBER BIN_OP VAR BIN_OP BIN_OP NUMBER VAR NUMBER VAR VAR ASSIGN VAR BIN_OP VAR BIN_OP BIN_OP NUMBER VAR NUMBER VAR NUMBER FOR...
Pavel made a photo of his favourite stars in the sky. His camera takes a photo of all points of the sky that belong to some rectangle with sides parallel to the coordinate axes. Strictly speaking, it makes a photo of all points with coordinates (x, y), such that x_1 ≤ x ≤ x_2 and y_1 ≤ y ≤ y_2, where (x_1, y_1) and (x...
n = int(input()) arr = list(map(int, input().strip().split(" "))) if n == 1: print(0) else: arr.sort() a = [] b = [] a.append(arr[0]) a.append(arr[n - 1]) b.append(arr[n]) b.append(arr[-1]) xdif = a[0] - a[1] ydif = b[0] - b[1] ans = xdif * ydif for i in range(1, n): ...
ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL FUNC_CALL VAR STRING IF VAR NUMBER EXPR FUNC_CALL VAR NUMBER EXPR FUNC_CALL VAR ASSIGN VAR LIST ASSIGN VAR LIST EXPR FUNC_CALL VAR VAR NUMBER EXPR FUNC_CALL VAR VAR BIN_OP VAR NUMBER EXPR FUNC_CALL VAR VAR VAR EXPR FUN...
Pavel made a photo of his favourite stars in the sky. His camera takes a photo of all points of the sky that belong to some rectangle with sides parallel to the coordinate axes. Strictly speaking, it makes a photo of all points with coordinates (x, y), such that x_1 ≤ x ≤ x_2 and y_1 ≤ y ≤ y_2, where (x_1, y_1) and (x...
n = int(input()) l = list(map(int, input().split())) l.sort() s = 2 * n - 1 mini = (l[n - 1] - l[0]) * (l[s] - l[n]) for i in range(1, n + 1): mini = min(abs((l[n - 1 + i] - l[i]) * (l[s] - l[0])), mini) print(mini)
ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR EXPR FUNC_CALL VAR ASSIGN VAR BIN_OP BIN_OP NUMBER VAR NUMBER ASSIGN VAR BIN_OP BIN_OP VAR BIN_OP VAR NUMBER VAR NUMBER BIN_OP VAR VAR VAR VAR FOR VAR FUNC_CALL VAR NUMBER BIN_OP VAR NUMBER ASSIGN VAR FUNC_CALL VAR...
Pavel made a photo of his favourite stars in the sky. His camera takes a photo of all points of the sky that belong to some rectangle with sides parallel to the coordinate axes. Strictly speaking, it makes a photo of all points with coordinates (x, y), such that x_1 ≤ x ≤ x_2 and y_1 ≤ y ≤ y_2, where (x_1, y_1) and (x...
n = int(input()) data = list(map(int, input().split())) data.sort() min_sq = (data[-1] - data[n]) * (data[n - 1] - data[0]) for i in range(1, n): if (data[-1] - data[0]) * (data[i + n - 1] - data[i]) < min_sq: min_sq = (data[-1] - data[0]) * (data[i + n - 1] - data[i]) print(min_sq)
ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR EXPR FUNC_CALL VAR ASSIGN VAR BIN_OP BIN_OP VAR NUMBER VAR VAR BIN_OP VAR BIN_OP VAR NUMBER VAR NUMBER FOR VAR FUNC_CALL VAR NUMBER VAR IF BIN_OP BIN_OP VAR NUMBER VAR NUMBER BIN_OP VAR BIN_OP BIN_OP VAR VAR NUMBER...
Pavel made a photo of his favourite stars in the sky. His camera takes a photo of all points of the sky that belong to some rectangle with sides parallel to the coordinate axes. Strictly speaking, it makes a photo of all points with coordinates (x, y), such that x_1 ≤ x ≤ x_2 and y_1 ≤ y ≤ y_2, where (x_1, y_1) and (x...
n = int(input()) sl = list(map(int, input().split())) sl.sort() a = sl[0:n] b = sl[n:] x = a[0] y = a[n - 1] z = b[0] d = b[n - 1] m = sl[2 * n - 1] - sl[0] k = (y - x) * (d - z) for i in range(n): p = (sl[i + n - 1] - sl[i]) * m if p < k: k = p print(k)
ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR EXPR FUNC_CALL VAR ASSIGN VAR VAR NUMBER VAR ASSIGN VAR VAR VAR ASSIGN VAR VAR NUMBER ASSIGN VAR VAR BIN_OP VAR NUMBER ASSIGN VAR VAR NUMBER ASSIGN VAR VAR BIN_OP VAR NUMBER ASSIGN VAR BIN_OP VAR BIN_OP BIN_OP NUMB...
Pavel made a photo of his favourite stars in the sky. His camera takes a photo of all points of the sky that belong to some rectangle with sides parallel to the coordinate axes. Strictly speaking, it makes a photo of all points with coordinates (x, y), such that x_1 ≤ x ≤ x_2 and y_1 ≤ y ≤ y_2, where (x_1, y_1) and (x...
n = int(input()) coords = list(map(int, input().split())) lin = sorted(coords) min_v = lin[0] max_v = lin[-1] if n == 1: print(0) exit(0) side = max_v - min_v min_side = min(lin[i + n - 1] - lin[i] for i in range(1, n)) min_prod = min_side * side dif_prod = (lin[n - 1] - min_v) * (max_v - lin[n]) if dif_prod < ...
ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR ASSIGN VAR VAR NUMBER ASSIGN VAR VAR NUMBER IF VAR NUMBER EXPR FUNC_CALL VAR NUMBER EXPR FUNC_CALL VAR NUMBER ASSIGN VAR BIN_OP VAR VAR ASSIGN VAR FUNC_CALL VAR BIN_OP VAR BIN_OP BIN_OP...
Pavel made a photo of his favourite stars in the sky. His camera takes a photo of all points of the sky that belong to some rectangle with sides parallel to the coordinate axes. Strictly speaking, it makes a photo of all points with coordinates (x, y), such that x_1 ≤ x ≤ x_2 and y_1 ≤ y ≤ y_2, where (x_1, y_1) and (x...
n = int(input()) arr = list(map(int, input().split())) arr.sort() ans = (arr[n - 1] - arr[0]) * (arr[2 * n - 1] - arr[n]) x = arr[2 * n - 1] - arr[0] c = 0 for i in range(1, n): c = x * (arr[i + n - 1] - arr[i]) ans = min(ans, c) print(ans)
ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR EXPR FUNC_CALL VAR ASSIGN VAR BIN_OP BIN_OP VAR BIN_OP VAR NUMBER VAR NUMBER BIN_OP VAR BIN_OP BIN_OP NUMBER VAR NUMBER VAR VAR ASSIGN VAR BIN_OP VAR BIN_OP BIN_OP NUMBER VAR NUMBER VAR NUMBER ASSIGN VAR NUMBER FOR...
Pavel made a photo of his favourite stars in the sky. His camera takes a photo of all points of the sky that belong to some rectangle with sides parallel to the coordinate axes. Strictly speaking, it makes a photo of all points with coordinates (x, y), such that x_1 ≤ x ≤ x_2 and y_1 ≤ y ≤ y_2, where (x_1, y_1) and (x...
R = lambda: map(int, input().split()) n = int(input()) L = sorted(R()) mi = (L[n - 1] - L[0]) * (L[2 * n - 1] - L[n]) k = L[2 * n - 1] - L[0] for i in range(1, n): mi = min(mi, k * (L[i + n - 1] - L[i])) print(mi)
ASSIGN VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR BIN_OP BIN_OP VAR BIN_OP VAR NUMBER VAR NUMBER BIN_OP VAR BIN_OP BIN_OP NUMBER VAR NUMBER VAR VAR ASSIGN VAR BIN_OP VAR BIN_OP BIN_OP NUMBER VAR NUMBER VAR NUMBER FOR VAR FUNC_CA...
Pavel made a photo of his favourite stars in the sky. His camera takes a photo of all points of the sky that belong to some rectangle with sides parallel to the coordinate axes. Strictly speaking, it makes a photo of all points with coordinates (x, y), such that x_1 ≤ x ≤ x_2 and y_1 ≤ y ≤ y_2, where (x_1, y_1) and (x...
n = int(input()) a = list(map(int, input().split())) a.sort() k = 12122121212121 for i in range(1, n): k = min(k, a[i + n - 1] - a[i]) k = k * (a[2 * n - 1] - a[0]) z = abs(a[0] - a[n - 1]) * abs(a[n] - a[2 * n - 1]) print(min(k, z))
ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR EXPR FUNC_CALL VAR ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR NUMBER VAR ASSIGN VAR FUNC_CALL VAR VAR BIN_OP VAR BIN_OP BIN_OP VAR VAR NUMBER VAR VAR ASSIGN VAR BIN_OP VAR BIN_OP VAR BIN_OP BIN_OP NUMBER VAR NUMBER VA...
Pavel made a photo of his favourite stars in the sky. His camera takes a photo of all points of the sky that belong to some rectangle with sides parallel to the coordinate axes. Strictly speaking, it makes a photo of all points with coordinates (x, y), such that x_1 ≤ x ≤ x_2 and y_1 ≤ y ≤ y_2, where (x_1, y_1) and (x...
n = int(input()) cl = sorted(list(map(int, input().split()))) if n == 1: print(0) else: mn = (cl[n - 1] - cl[0]) * (cl[-1] - cl[n]) t = cl[-1] - cl[0] if t == 0: print(0) else: mnt = 10**10 + 1 for i in range(1, n): if cl[i + n - 1] - cl[i] < mnt: ...
ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR IF VAR NUMBER EXPR FUNC_CALL VAR NUMBER ASSIGN VAR BIN_OP BIN_OP VAR BIN_OP VAR NUMBER VAR NUMBER BIN_OP VAR NUMBER VAR VAR ASSIGN VAR BIN_OP VAR NUMBER VAR NUMBER IF VAR NUMBER EXPR FUNC_CALL VAR NUM...
Pavel made a photo of his favourite stars in the sky. His camera takes a photo of all points of the sky that belong to some rectangle with sides parallel to the coordinate axes. Strictly speaking, it makes a photo of all points with coordinates (x, y), such that x_1 ≤ x ≤ x_2 and y_1 ≤ y ≤ y_2, where (x_1, y_1) and (x...
from sys import stdin, stdout n = int(stdin.readline()) arr = [int(x) for x in stdin.readline().split()] arr.sort() x1 = arr[0] x2 = arr[n - 1] y1 = arr[n] y2 = arr[2 * n - 1] mini = (x2 - x1) * (y2 - y1) for i in range(1, n): j = i + n - 1 x1 = arr[i] x2 = arr[j] y1 = arr[0] y2 = arr[2 * n - 1] ...
ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR VAR FUNC_CALL FUNC_CALL VAR EXPR FUNC_CALL VAR ASSIGN VAR VAR NUMBER ASSIGN VAR VAR BIN_OP VAR NUMBER ASSIGN VAR VAR VAR ASSIGN VAR VAR BIN_OP BIN_OP NUMBER VAR NUMBER ASSIGN VAR BIN_OP BIN_OP VAR VAR BIN_OP VAR VAR FOR VAR FUNC_CALL VAR NUMBER VAR ASS...
Pavel made a photo of his favourite stars in the sky. His camera takes a photo of all points of the sky that belong to some rectangle with sides parallel to the coordinate axes. Strictly speaking, it makes a photo of all points with coordinates (x, y), such that x_1 ≤ x ≤ x_2 and y_1 ≤ y ≤ y_2, where (x_1, y_1) and (x...
int(input()) arr = list(map(int, input().split())) n = len(arr) // 2 arr.sort() x1 = arr[0] x2 = arr[n - 1] y2 = arr[-1] y1 = arr[n] ans = abs(x1 - x2) * abs(y1 - y2) for i in range(n, n * 2 - 1): ans = min((arr[i] - arr[i - n + 1]) * (arr[-1] - arr[0]), ans) print(ans)
EXPR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR BIN_OP FUNC_CALL VAR VAR NUMBER EXPR FUNC_CALL VAR ASSIGN VAR VAR NUMBER ASSIGN VAR VAR BIN_OP VAR NUMBER ASSIGN VAR VAR NUMBER ASSIGN VAR VAR VAR ASSIGN VAR BIN_OP FUNC_CALL VAR BIN_OP VAR VAR FUNC_CALL VAR B...
Pavel made a photo of his favourite stars in the sky. His camera takes a photo of all points of the sky that belong to some rectangle with sides parallel to the coordinate axes. Strictly speaking, it makes a photo of all points with coordinates (x, y), such that x_1 ≤ x ≤ x_2 and y_1 ≤ y ≤ y_2, where (x_1, y_1) and (x...
from sys import stdin, stdout def rint(): return map(int, stdin.readline().split()) n = int(input()) a = list(rint()) a.sort() Min = 10**1000 for i in range(1, n): Min = min(Min, (a[n - 1 + i] - a[i]) * (a[n * 2 - 1] - a[0])) Min = min(Min, (a[n - 1] - a[0]) * (a[2 * n - 1] - a[n])) print(Min)
FUNC_DEF RETURN FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR EXPR FUNC_CALL VAR ASSIGN VAR BIN_OP NUMBER NUMBER FOR VAR FUNC_CALL VAR NUMBER VAR ASSIGN VAR FUNC_CALL VAR VAR BIN_OP BIN_OP VAR BIN_OP BIN_OP VAR NUMBER VAR VAR VAR BIN_OP VAR BIN_O...
Pavel made a photo of his favourite stars in the sky. His camera takes a photo of all points of the sky that belong to some rectangle with sides parallel to the coordinate axes. Strictly speaking, it makes a photo of all points with coordinates (x, y), such that x_1 ≤ x ≤ x_2 and y_1 ≤ y ≤ y_2, where (x_1, y_1) and (x...
import sys n = int(input()) a = [int(x) for x in input().split()] a.sort() if n == 1: print(0) else: c1 = (a[n - 1] - a[0]) * (a[-1] - a[-n]) c2 = (a[-1] - a[0]) * min(a[n - 1 + i] - a[i] for i in range(1, n)) print(min(c1, c2))
IMPORT ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR VAR FUNC_CALL FUNC_CALL VAR EXPR FUNC_CALL VAR IF VAR NUMBER EXPR FUNC_CALL VAR NUMBER ASSIGN VAR BIN_OP BIN_OP VAR BIN_OP VAR NUMBER VAR NUMBER BIN_OP VAR NUMBER VAR VAR ASSIGN VAR BIN_OP BIN_OP VAR NUMBER VAR NUMBER FUNC_CALL VAR BIN_OP VAR BI...
Pavel made a photo of his favourite stars in the sky. His camera takes a photo of all points of the sky that belong to some rectangle with sides parallel to the coordinate axes. Strictly speaking, it makes a photo of all points with coordinates (x, y), such that x_1 ≤ x ≤ x_2 and y_1 ≤ y ≤ y_2, where (x_1, y_1) and (x...
n = int(input()) s = sorted(map(int, input().split())) h = s[2 * n - 1] - s[0] best = (s[n - 1] - s[0]) * (s[2 * n - 1] - s[n]) for i in range(1, n): w = s[i + n - 1] - s[i] new = h * w if new < best: best = new print(best)
ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR BIN_OP VAR BIN_OP BIN_OP NUMBER VAR NUMBER VAR NUMBER ASSIGN VAR BIN_OP BIN_OP VAR BIN_OP VAR NUMBER VAR NUMBER BIN_OP VAR BIN_OP BIN_OP NUMBER VAR NUMBER VAR VAR FOR VAR FUNC_CALL VAR NUMBER VAR ASSIGN ...
Pavel made a photo of his favourite stars in the sky. His camera takes a photo of all points of the sky that belong to some rectangle with sides parallel to the coordinate axes. Strictly speaking, it makes a photo of all points with coordinates (x, y), such that x_1 ≤ x ≤ x_2 and y_1 ≤ y ≤ y_2, where (x_1, y_1) and (x...
n = int(input()) a = [int(v) for v in input().split()] a.sort() ans = (a[-1] - a[n]) * (a[n - 1] - a[0]) for i in range(1, n): ans = min(ans, (a[-1] - a[0]) * (a[i + n - 1] - a[i])) print(ans)
ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR VAR FUNC_CALL FUNC_CALL VAR EXPR FUNC_CALL VAR ASSIGN VAR BIN_OP BIN_OP VAR NUMBER VAR VAR BIN_OP VAR BIN_OP VAR NUMBER VAR NUMBER FOR VAR FUNC_CALL VAR NUMBER VAR ASSIGN VAR FUNC_CALL VAR VAR BIN_OP BIN_OP VAR NUMBER VAR NUMBER BIN_OP VAR BIN_OP BIN_O...
Pavel made a photo of his favourite stars in the sky. His camera takes a photo of all points of the sky that belong to some rectangle with sides parallel to the coordinate axes. Strictly speaking, it makes a photo of all points with coordinates (x, y), such that x_1 ≤ x ≤ x_2 and y_1 ≤ y ≤ y_2, where (x_1, y_1) and (x...
n = int(input()) a = list(map(int, input().split())) a.sort() s1 = (a[n - 1] - a[0]) * (a[-1] - a[n]) tmp = a[-1] - a[0] for i in range(1, n): if tmp * (a[n + i - 1] - a[i]) < s1: s1 = tmp * (a[n + i - 1] - a[i]) print(s1)
ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR EXPR FUNC_CALL VAR ASSIGN VAR BIN_OP BIN_OP VAR BIN_OP VAR NUMBER VAR NUMBER BIN_OP VAR NUMBER VAR VAR ASSIGN VAR BIN_OP VAR NUMBER VAR NUMBER FOR VAR FUNC_CALL VAR NUMBER VAR IF BIN_OP VAR BIN_OP VAR BIN_OP BIN_OP...
Pavel made a photo of his favourite stars in the sky. His camera takes a photo of all points of the sky that belong to some rectangle with sides parallel to the coordinate axes. Strictly speaking, it makes a photo of all points with coordinates (x, y), such that x_1 ≤ x ≤ x_2 and y_1 ≤ y ≤ y_2, where (x_1, y_1) and (x...
N = int(input()) if N == 1: print(0) exit() a = list(map(int, input().split())) a = sorted(a) res = 10**10 for i in range(N): if res > a[i + N - 1] - a[i]: res = a[i + N - 1] - a[i] probAns1 = (a[len(a) - 1] - a[0]) * res probAns2 = (a[N - 1] - a[0]) * (a[len(a) - 1] - a[N]) res = min(probAns1, prob...
ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR IF VAR NUMBER EXPR FUNC_CALL VAR NUMBER EXPR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR ASSIGN VAR BIN_OP NUMBER NUMBER FOR VAR FUNC_CALL VAR VAR IF VAR BIN_OP VAR BIN_OP BIN_OP VAR VAR NUMBER VAR VAR ASSIGN VAR BI...
Pavel made a photo of his favourite stars in the sky. His camera takes a photo of all points of the sky that belong to some rectangle with sides parallel to the coordinate axes. Strictly speaking, it makes a photo of all points with coordinates (x, y), such that x_1 ≤ x ≤ x_2 and y_1 ≤ y ≤ y_2, where (x_1, y_1) and (x...
n = int(input()) - 1 s = sorted(map(int, input().split())) sp = (s[n] - s[0]) * (s[2 * n + 1] - s[n + 1]) for i in range(n + 1): sp = min(sp, (s[n + i] - s[i]) * (s[2 * n + 1] - s[0])) print(sp)
ASSIGN VAR BIN_OP FUNC_CALL VAR FUNC_CALL VAR NUMBER ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR BIN_OP BIN_OP VAR VAR VAR NUMBER BIN_OP VAR BIN_OP BIN_OP NUMBER VAR NUMBER VAR BIN_OP VAR NUMBER FOR VAR FUNC_CALL VAR BIN_OP VAR NUMBER ASSIGN VAR FUNC_CALL VAR VAR BIN_OP BIN_OP VAR BIN_...
Pavel made a photo of his favourite stars in the sky. His camera takes a photo of all points of the sky that belong to some rectangle with sides parallel to the coordinate axes. Strictly speaking, it makes a photo of all points with coordinates (x, y), such that x_1 ≤ x ≤ x_2 and y_1 ≤ y ≤ y_2, where (x_1, y_1) and (x...
n = int(input()) a = list(map(int, input().split())) a.sort() b = -(a[0] - a[n - 1]) c = -(a[n] - a[2 * n - 1]) m = b * c x = a[-1] - a[0] for i in range(1, n): m = min(m, x * (a[n + i - 1] - a[i])) print(m)
ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR EXPR FUNC_CALL VAR ASSIGN VAR BIN_OP VAR NUMBER VAR BIN_OP VAR NUMBER ASSIGN VAR BIN_OP VAR VAR VAR BIN_OP BIN_OP NUMBER VAR NUMBER ASSIGN VAR BIN_OP VAR VAR ASSIGN VAR BIN_OP VAR NUMBER VAR NUMBER FOR VAR FUNC_CAL...
Pavel made a photo of his favourite stars in the sky. His camera takes a photo of all points of the sky that belong to some rectangle with sides parallel to the coordinate axes. Strictly speaking, it makes a photo of all points with coordinates (x, y), such that x_1 ≤ x ≤ x_2 and y_1 ≤ y ≤ y_2, where (x_1, y_1) and (x...
n = int(input()) a = [int(i) for i in input().split()] a.sort() ans = 1e20 for i in range(1, n): now = (a[i + n - 1] - a[i]) * (a[2 * n - 1] - a[0]) if now < ans: ans = now ans = min(ans, (a[n - 1] - a[0]) * (a[2 * n - 1] - a[n])) print(ans)
ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR VAR FUNC_CALL FUNC_CALL VAR EXPR FUNC_CALL VAR ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR NUMBER VAR ASSIGN VAR BIN_OP BIN_OP VAR BIN_OP BIN_OP VAR VAR NUMBER VAR VAR BIN_OP VAR BIN_OP BIN_OP NUMBER VAR NUMBER VAR NUMBER IF VAR VAR ASSIGN VAR VAR ASSIGN V...
Pavel made a photo of his favourite stars in the sky. His camera takes a photo of all points of the sky that belong to some rectangle with sides parallel to the coordinate axes. Strictly speaking, it makes a photo of all points with coordinates (x, y), such that x_1 ≤ x ≤ x_2 and y_1 ≤ y ≤ y_2, where (x_1, y_1) and (x...
def main(): n = int(input()) a = [int(x) for x in input().split()] a.sort() min_p = 10**20 for i in range(n + 1): curr_dif = a[n + i - 1] - a[i] sy = a[0] if i > 0 else a[n] ey = a[i - 1] if i == n else a[2 * n - 1] curr_p = curr_dif * (ey - sy) if curr_p < mi...
FUNC_DEF ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR VAR FUNC_CALL FUNC_CALL VAR EXPR FUNC_CALL VAR ASSIGN VAR BIN_OP NUMBER NUMBER FOR VAR FUNC_CALL VAR BIN_OP VAR NUMBER ASSIGN VAR BIN_OP VAR BIN_OP BIN_OP VAR VAR NUMBER VAR VAR ASSIGN VAR VAR NUMBER VAR NUMBER VAR VAR ASSIGN VAR VAR VAR VAR B...
Pavel made a photo of his favourite stars in the sky. His camera takes a photo of all points of the sky that belong to some rectangle with sides parallel to the coordinate axes. Strictly speaking, it makes a photo of all points with coordinates (x, y), such that x_1 ≤ x ≤ x_2 and y_1 ≤ y ≤ y_2, where (x_1, y_1) and (x...
def solve(arr): arr = sorted(arr) a0 = arr[0] an = arr[-1] minsub = 1000000000000 for i in range(1, len(arr) // 2): minsub = min(arr[i + len(arr) // 2 - 1] - arr[i], minsub) first_case = (an - a0) * minsub bn = arr[-1] an = arr[len(arr) // 2 - 1] b0 = arr[len(arr) // 2] s...
FUNC_DEF ASSIGN VAR FUNC_CALL VAR VAR ASSIGN VAR VAR NUMBER ASSIGN VAR VAR NUMBER ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR NUMBER BIN_OP FUNC_CALL VAR VAR NUMBER ASSIGN VAR FUNC_CALL VAR BIN_OP VAR BIN_OP BIN_OP VAR BIN_OP FUNC_CALL VAR VAR NUMBER NUMBER VAR VAR VAR ASSIGN VAR BIN_OP BIN_OP VAR VAR VAR ASSIGN VAR VAR NU...
Pavel made a photo of his favourite stars in the sky. His camera takes a photo of all points of the sky that belong to some rectangle with sides parallel to the coordinate axes. Strictly speaking, it makes a photo of all points with coordinates (x, y), such that x_1 ≤ x ≤ x_2 and y_1 ≤ y ≤ y_2, where (x_1, y_1) and (x...
n = int(input()) a = sorted(map(int, input().split())) print( min( [(a[n - 1] - a[0]) * (a[-1] - a[n])] + [((a[-1] - a[0]) * (a[i + n - 1] - a[i])) for i in range(n)] ) )
ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR EXPR FUNC_CALL VAR FUNC_CALL VAR BIN_OP LIST BIN_OP BIN_OP VAR BIN_OP VAR NUMBER VAR NUMBER BIN_OP VAR NUMBER VAR VAR BIN_OP BIN_OP VAR NUMBER VAR NUMBER BIN_OP VAR BIN_OP BIN_OP VAR VAR NUMBER VAR VAR VAR FUNC_CAL...
Pavel made a photo of his favourite stars in the sky. His camera takes a photo of all points of the sky that belong to some rectangle with sides parallel to the coordinate axes. Strictly speaking, it makes a photo of all points with coordinates (x, y), such that x_1 ≤ x ≤ x_2 and y_1 ≤ y ≤ y_2, where (x_1, y_1) and (x...
n = int(input()) a = list(input().split()) for i in range(2 * n): a[i] = int(a[i]) a.sort() x1 = a[0] x2 = a[n - 1] y1 = a[n] y2 = a[2 * n - 1] p = (x2 - x1) * (y2 - y1) minx = p for i in range(1, n): if a[i + n - 1] - a[i] < minx: minx = a[i + n - 1] - a[i] if p < minx * (a[2 * n - 1] - a[0]): prin...
ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL FUNC_CALL VAR FOR VAR FUNC_CALL VAR BIN_OP NUMBER VAR ASSIGN VAR VAR FUNC_CALL VAR VAR VAR EXPR FUNC_CALL VAR ASSIGN VAR VAR NUMBER ASSIGN VAR VAR BIN_OP VAR NUMBER ASSIGN VAR VAR VAR ASSIGN VAR VAR BIN_OP BIN_OP NUMBER VAR NUMBER ASSIGN VAR BIN_...
Pavel made a photo of his favourite stars in the sky. His camera takes a photo of all points of the sky that belong to some rectangle with sides parallel to the coordinate axes. Strictly speaking, it makes a photo of all points with coordinates (x, y), such that x_1 ≤ x ≤ x_2 and y_1 ≤ y ≤ y_2, where (x_1, y_1) and (x...
n = int(input()) a = [int(x) for x in input().split()] flag = True if n == 1: print(0) else: a = sorted(a) n2 = n * 2 ans = (a[n - 1] - a[0]) * (a[n2 - 1] - a[n]) for i in range(n): ans = min(ans, (a[i + n - 1] - a[i]) * (a[n2 - 1] - a[0])) print(ans)
ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR NUMBER IF VAR NUMBER EXPR FUNC_CALL VAR NUMBER ASSIGN VAR FUNC_CALL VAR VAR ASSIGN VAR BIN_OP VAR NUMBER ASSIGN VAR BIN_OP BIN_OP VAR BIN_OP VAR NUMBER VAR NUMBER BIN_OP VAR BIN_OP VAR NUMBER VAR VAR FOR VAR FUNC_...
Pavel made a photo of his favourite stars in the sky. His camera takes a photo of all points of the sky that belong to some rectangle with sides parallel to the coordinate axes. Strictly speaking, it makes a photo of all points with coordinates (x, y), such that x_1 ≤ x ≤ x_2 and y_1 ≤ y ≤ y_2, where (x_1, y_1) and (x...
n = int(input()) A = list(map(int, input().split())) if n == 1: print(0) exit() A.sort() ans = float("inf") for i in range(n + 1): x = A[i + n - 1] - A[i] if i == 0: y = A[2 * n - 1] - A[n] elif i == n: y = A[n - 1] - A[0] else: y = A[2 * n - 1] - A[0] ans = min(ans, ...
ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR IF VAR NUMBER EXPR FUNC_CALL VAR NUMBER EXPR FUNC_CALL VAR EXPR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR STRING FOR VAR FUNC_CALL VAR BIN_OP VAR NUMBER ASSIGN VAR BIN_OP VAR BIN_OP BIN_OP VAR VAR NUMBER VAR VAR IF VA...
Pavel made a photo of his favourite stars in the sky. His camera takes a photo of all points of the sky that belong to some rectangle with sides parallel to the coordinate axes. Strictly speaking, it makes a photo of all points with coordinates (x, y), such that x_1 ≤ x ≤ x_2 and y_1 ≤ y ≤ y_2, where (x_1, y_1) and (x...
n = int(input()) a = list(map(int, input().split())) a.sort() b = [] kol = [] o = 1 mo = 1 for i in range(1, n * 2): if a[i] == a[i - 1]: o += 1 else: b.append(a[i - 1]) kol.append(o) o = 1 k = 0 b.append(a[i]) kol.append(o) for j in range(0, len(b)): k += kol[j] if k == ...
ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR EXPR FUNC_CALL VAR ASSIGN VAR LIST ASSIGN VAR LIST ASSIGN VAR NUMBER ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR NUMBER BIN_OP VAR NUMBER IF VAR VAR VAR BIN_OP VAR NUMBER VAR NUMBER EXPR FUNC_CALL VAR VAR BIN_OP VAR NU...
Pavel made a photo of his favourite stars in the sky. His camera takes a photo of all points of the sky that belong to some rectangle with sides parallel to the coordinate axes. Strictly speaking, it makes a photo of all points with coordinates (x, y), such that x_1 ≤ x ≤ x_2 and y_1 ≤ y ≤ y_2, where (x_1, y_1) and (x...
n = int(input()) nums = [int(i) for i in input().split()] if n == 1: print(0) else: nums.sort() area_1 = None for i in range(1, n): temp = (nums[-1] - nums[0]) * (nums[i + n - 1] - nums[i]) if area_1 is None or temp < area_1: area_1 = temp temp = (nums[n - 1] - nums[0]) *...
ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR VAR FUNC_CALL FUNC_CALL VAR IF VAR NUMBER EXPR FUNC_CALL VAR NUMBER EXPR FUNC_CALL VAR ASSIGN VAR NONE FOR VAR FUNC_CALL VAR NUMBER VAR ASSIGN VAR BIN_OP BIN_OP VAR NUMBER VAR NUMBER BIN_OP VAR BIN_OP BIN_OP VAR VAR NUMBER VAR VAR IF VAR NONE VAR VAR A...
Pavel made a photo of his favourite stars in the sky. His camera takes a photo of all points of the sky that belong to some rectangle with sides parallel to the coordinate axes. Strictly speaking, it makes a photo of all points with coordinates (x, y), such that x_1 ≤ x ≤ x_2 and y_1 ≤ y ≤ y_2, where (x_1, y_1) and (x...
n = int(input()) k = 1000000009 a = [int(i) for i in input().split()] a.sort() if n == 1: print(0) exit() else: for i in range(1, n): k = min(k, a[i + n - 1] - a[i]) print(min((a[2 * n - 1] - a[0]) * k, (a[n - 1] - a[0]) * (a[2 * n - 1] - a[n])))
ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR NUMBER ASSIGN VAR FUNC_CALL VAR VAR VAR FUNC_CALL FUNC_CALL VAR EXPR FUNC_CALL VAR IF VAR NUMBER EXPR FUNC_CALL VAR NUMBER EXPR FUNC_CALL VAR FOR VAR FUNC_CALL VAR NUMBER VAR ASSIGN VAR FUNC_CALL VAR VAR BIN_OP VAR BIN_OP BIN_OP VAR VAR NUMBER VAR VAR EXPR FUNC_CALL VAR...
Pavel made a photo of his favourite stars in the sky. His camera takes a photo of all points of the sky that belong to some rectangle with sides parallel to the coordinate axes. Strictly speaking, it makes a photo of all points with coordinates (x, y), such that x_1 ≤ x ≤ x_2 and y_1 ≤ y ≤ y_2, where (x_1, y_1) and (x...
n = int(input()) l = [None] * (n * 2) s = input().split() for i in range(n * 2): l[i] = int(s[i]) l.sort() res = (l[n - 1] - l[0]) * (l[-1] - l[n]) for i in range(1, n): res = min(res, (l[i + n - 1] - l[i]) * (l[-1] - l[0])) print(res)
ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR BIN_OP LIST NONE BIN_OP VAR NUMBER ASSIGN VAR FUNC_CALL FUNC_CALL VAR FOR VAR FUNC_CALL VAR BIN_OP VAR NUMBER ASSIGN VAR VAR FUNC_CALL VAR VAR VAR EXPR FUNC_CALL VAR ASSIGN VAR BIN_OP BIN_OP VAR BIN_OP VAR NUMBER VAR NUMBER BIN_OP VAR NUMBER VAR VAR FOR VAR FUNC_CALL VA...
Pavel made a photo of his favourite stars in the sky. His camera takes a photo of all points of the sky that belong to some rectangle with sides parallel to the coordinate axes. Strictly speaking, it makes a photo of all points with coordinates (x, y), such that x_1 ≤ x ≤ x_2 and y_1 ≤ y ≤ y_2, where (x_1, y_1) and (x...
n = int(input()) a = [int(x) for x in input().split()] a.sort() top = [a[0], a[-1]] right = [a[n - 1], a[n]] case2 = abs((top[0] - right[0]) * (top[1] - right[1])) case1 = top[-1] - top[0] mny = 10000000000 for i in range(1, n): mny = min(mny, abs(a[i] - a[i + n - 1])) case1 *= mny print(min(abs(case1), case2))
ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR VAR FUNC_CALL FUNC_CALL VAR EXPR FUNC_CALL VAR ASSIGN VAR LIST VAR NUMBER VAR NUMBER ASSIGN VAR LIST VAR BIN_OP VAR NUMBER VAR VAR ASSIGN VAR FUNC_CALL VAR BIN_OP BIN_OP VAR NUMBER VAR NUMBER BIN_OP VAR NUMBER VAR NUMBER ASSIGN VAR BIN_OP VAR NUMBER VA...
Pavel made a photo of his favourite stars in the sky. His camera takes a photo of all points of the sky that belong to some rectangle with sides parallel to the coordinate axes. Strictly speaking, it makes a photo of all points with coordinates (x, y), such that x_1 ≤ x ≤ x_2 and y_1 ≤ y ≤ y_2, where (x_1, y_1) and (x...
n = int(input()) records = list(map(int, input().split())) records.sort() diffArr = [] for i in range(n + 1): if i == 0: diffArr.append([records[n - 1] - records[0], records[-1] - records[n]]) elif i == n: diffArr.append([records[-1] - records[n], records[n - 1] - records[0]]) else: ...
ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR EXPR FUNC_CALL VAR ASSIGN VAR LIST FOR VAR FUNC_CALL VAR BIN_OP VAR NUMBER IF VAR NUMBER EXPR FUNC_CALL VAR LIST BIN_OP VAR BIN_OP VAR NUMBER VAR NUMBER BIN_OP VAR NUMBER VAR VAR IF VAR VAR EXPR FUNC_CALL VAR LIST ...
Pavel made a photo of his favourite stars in the sky. His camera takes a photo of all points of the sky that belong to some rectangle with sides parallel to the coordinate axes. Strictly speaking, it makes a photo of all points with coordinates (x, y), such that x_1 ≤ x ≤ x_2 and y_1 ≤ y ≤ y_2, where (x_1, y_1) and (x...
n = int(input()) coords = list(map(int, input().split(" "))) sc = sorted(coords) minprod = float("inf") for i in range(n + 1): x_dist = sc[i + n - 1] - sc[i] if i == 0: minprod = min(minprod, x_dist * (sc[-1] - sc[n])) elif i == n: minprod = min(minprod, x_dist * (sc[n - 1] - sc[0])) els...
ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR STRING ASSIGN VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR STRING FOR VAR FUNC_CALL VAR BIN_OP VAR NUMBER ASSIGN VAR BIN_OP VAR BIN_OP BIN_OP VAR VAR NUMBER VAR VAR IF VAR NUMBER ASSIGN VAR FUNC_CALL VAR VAR BIN_...
Pavel made a photo of his favourite stars in the sky. His camera takes a photo of all points of the sky that belong to some rectangle with sides parallel to the coordinate axes. Strictly speaking, it makes a photo of all points with coordinates (x, y), such that x_1 ≤ x ≤ x_2 and y_1 ≤ y ≤ y_2, where (x_1, y_1) and (x...
n = int(input()) m = n * 2 a = list(map(int, input().split())) if n == 1: print(0) else: a.sort() m1 = (a[m - 1] - a[m // 2]) * (a[m // 2 - 1] - a[0]) m2 = a[m - 1] - a[0] for i in range(1, n): if a[i + n - 1] - a[i] < m2: m2 = a[i + n - 1] - a[i] m2 *= a[m - 1] - a[0] pr...
ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR BIN_OP VAR NUMBER ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR IF VAR NUMBER EXPR FUNC_CALL VAR NUMBER EXPR FUNC_CALL VAR ASSIGN VAR BIN_OP BIN_OP VAR BIN_OP VAR NUMBER VAR BIN_OP VAR NUMBER BIN_OP VAR BIN_OP BIN_OP VAR NUMBER NUMBER VAR NUMBER ASS...
Pavel made a photo of his favourite stars in the sky. His camera takes a photo of all points of the sky that belong to some rectangle with sides parallel to the coordinate axes. Strictly speaking, it makes a photo of all points with coordinates (x, y), such that x_1 ≤ x ≤ x_2 and y_1 ≤ y ≤ y_2, where (x_1, y_1) and (x...
def main(): n = int(input()) a = [int(i) for i in input().split()] a.sort() x = a[n - 1] - a[0] y = a[2 * n - 1] - a[n] c1 = x * y x = a[2 * n - 1] - a[0] for i in range(1, n): c1 = min(c1, x * (a[i + n - 1] - a[i])) print(c1) main()
FUNC_DEF ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR VAR FUNC_CALL FUNC_CALL VAR EXPR FUNC_CALL VAR ASSIGN VAR BIN_OP VAR BIN_OP VAR NUMBER VAR NUMBER ASSIGN VAR BIN_OP VAR BIN_OP BIN_OP NUMBER VAR NUMBER VAR VAR ASSIGN VAR BIN_OP VAR VAR ASSIGN VAR BIN_OP VAR BIN_OP BIN_OP NUMBER VAR NUMBER VAR...
Pavel made a photo of his favourite stars in the sky. His camera takes a photo of all points of the sky that belong to some rectangle with sides parallel to the coordinate axes. Strictly speaking, it makes a photo of all points with coordinates (x, y), such that x_1 ≤ x ≤ x_2 and y_1 ≤ y ≤ y_2, where (x_1, y_1) and (x...
n = int(input()) n *= 2 a = [int(s) for s in input().split()] a = sorted(a) x1 = a[0] x2 = a[n // 2 - 1] y1 = a[n // 2] y2 = a[n - 1] ans = (x2 - x1) * (y2 - y1) block = n // 2 for i in range(1, n // 2): y1 = a[0] y2 = a[n - 1] x1 = a[i] x2 = a[i + block - 1] ans = min(ans, (x2 - x1) * (y2 - y1)) pr...
ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR NUMBER ASSIGN VAR FUNC_CALL VAR VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR ASSIGN VAR VAR NUMBER ASSIGN VAR VAR BIN_OP BIN_OP VAR NUMBER NUMBER ASSIGN VAR VAR BIN_OP VAR NUMBER ASSIGN VAR VAR BIN_OP VAR NUMBER ASSIGN VAR BIN_OP BIN_OP VAR VAR BIN_OP VAR VAR A...
Pavel made a photo of his favourite stars in the sky. His camera takes a photo of all points of the sky that belong to some rectangle with sides parallel to the coordinate axes. Strictly speaking, it makes a photo of all points with coordinates (x, y), such that x_1 ≤ x ≤ x_2 and y_1 ≤ y ≤ y_2, where (x_1, y_1) and (x...
n = int(input()) a = [int(i) for i in input().split(" ")] a = sorted(a) min_area = 1e20 for i in range(len(a)): min_x = a[i] if i + n - 1 >= len(a): break max_x = a[i + n - 1] if i == 0: min_y = a[i + n - 1 + 1] else: min_y = a[0] if i + n - 1 == len(a) - 1: max_y...
ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR VAR FUNC_CALL FUNC_CALL VAR STRING ASSIGN VAR FUNC_CALL VAR VAR ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR FUNC_CALL VAR VAR ASSIGN VAR VAR VAR IF BIN_OP BIN_OP VAR VAR NUMBER FUNC_CALL VAR VAR ASSIGN VAR VAR BIN_OP BIN_OP VAR VAR NUMBER IF VAR NUMBER ASS...
Pavel made a photo of his favourite stars in the sky. His camera takes a photo of all points of the sky that belong to some rectangle with sides parallel to the coordinate axes. Strictly speaking, it makes a photo of all points with coordinates (x, y), such that x_1 ≤ x ≤ x_2 and y_1 ≤ y ≤ y_2, where (x_1, y_1) and (x...
t = 1 for test in range(1, t + 1): n = int(input()) b = list(map(int, input().split())) b.sort() ans = (b[n - 1] - b[0]) * (-b[n] + b[-1]) tmp = 1000000001 for i in range(1, n): tmp = min(b[i + n - 1] - b[i], tmp) print(min(ans, (b[-1] - b[0]) * tmp))
ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR NUMBER BIN_OP VAR NUMBER ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR EXPR FUNC_CALL VAR ASSIGN VAR BIN_OP BIN_OP VAR BIN_OP VAR NUMBER VAR NUMBER BIN_OP VAR VAR VAR NUMBER ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR NUMBER...
Pavel made a photo of his favourite stars in the sky. His camera takes a photo of all points of the sky that belong to some rectangle with sides parallel to the coordinate axes. Strictly speaking, it makes a photo of all points with coordinates (x, y), such that x_1 ≤ x ≤ x_2 and y_1 ≤ y ≤ y_2, where (x_1, y_1) and (x...
n = int(input()) a = list(map(int, input().split())) a.sort() mn = (a[n - 1] - a[0]) * (a[2 * n - 1] - a[n]) for i in range(1, n + 1): if i < n: mn = min(mn, (a[n + i - 1] - a[i]) * (a[2 * n - 1] - a[0])) else: mn = min(mn, (a[n + i - 1] - a[i]) * (a[i - 1] - a[0])) print(mn)
ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR EXPR FUNC_CALL VAR ASSIGN VAR BIN_OP BIN_OP VAR BIN_OP VAR NUMBER VAR NUMBER BIN_OP VAR BIN_OP BIN_OP NUMBER VAR NUMBER VAR VAR FOR VAR FUNC_CALL VAR NUMBER BIN_OP VAR NUMBER IF VAR VAR ASSIGN VAR FUNC_CALL VAR VAR...
Pavel made a photo of his favourite stars in the sky. His camera takes a photo of all points of the sky that belong to some rectangle with sides parallel to the coordinate axes. Strictly speaking, it makes a photo of all points with coordinates (x, y), such that x_1 ≤ x ≤ x_2 and y_1 ≤ y ≤ y_2, where (x_1, y_1) and (x...
from sys import stdin n = int(stdin.readline()) a = [int(x) for x in stdin.readline().split()] a.sort() l = 0 d = [0] * (2 * n) d[n] = a[-1] - a[n] ans = float("inf") for i in range(n, -1, -1): dy = a[i + n - 1] - a[i] if i == n: dx = a[n - 1] - a[0] else: dx = a[-1] - a[0] ans = min(an...
ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR VAR FUNC_CALL FUNC_CALL VAR EXPR FUNC_CALL VAR ASSIGN VAR NUMBER ASSIGN VAR BIN_OP LIST NUMBER BIN_OP NUMBER VAR ASSIGN VAR VAR BIN_OP VAR NUMBER VAR VAR ASSIGN VAR FUNC_CALL VAR STRING FOR VAR FUNC_CALL VAR VAR NUMBER NUMBER ASSIGN VAR BIN_OP VAR BIN_...
Pavel made a photo of his favourite stars in the sky. His camera takes a photo of all points of the sky that belong to some rectangle with sides parallel to the coordinate axes. Strictly speaking, it makes a photo of all points with coordinates (x, y), such that x_1 ≤ x ≤ x_2 and y_1 ≤ y ≤ y_2, where (x_1, y_1) and (x...
n = int(input()) a = sorted(map(int, input().split())) r = s = (a[n - 1] - a[0]) * (a[-1] - a[n]) if n > 1: s = (a[-1] - a[0]) * min(y - x for x, y in zip(a, a[n - 1 :])) print(min(r, s))
ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR VAR BIN_OP BIN_OP VAR BIN_OP VAR NUMBER VAR NUMBER BIN_OP VAR NUMBER VAR VAR IF VAR NUMBER ASSIGN VAR BIN_OP BIN_OP VAR NUMBER VAR NUMBER FUNC_CALL VAR BIN_OP VAR VAR VAR VAR FUNC_CALL VAR VAR VAR BIN_OP...
Pavel made a photo of his favourite stars in the sky. His camera takes a photo of all points of the sky that belong to some rectangle with sides parallel to the coordinate axes. Strictly speaking, it makes a photo of all points with coordinates (x, y), such that x_1 ≤ x ≤ x_2 and y_1 ≤ y ≤ y_2, where (x_1, y_1) and (x...
n = int(input()) numbers = sorted(int(x) for x in input().split()) best_s = 10**18 + 10 for start in range(n + 1): x_len = numbers[start + n - 1] - numbers[start] y_len = numbers[-1] - numbers[0] if start + n - 1 == 2 * n - 1: y_len = numbers[start - 1] - numbers[0] elif start == 0: y_le...
ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR BIN_OP BIN_OP NUMBER NUMBER NUMBER FOR VAR FUNC_CALL VAR BIN_OP VAR NUMBER ASSIGN VAR BIN_OP VAR BIN_OP BIN_OP VAR VAR NUMBER VAR VAR ASSIGN VAR BIN_OP VAR NUMBER VAR NUMBER IF BIN_OP BIN_OP VAR VAR ...
Pavel made a photo of his favourite stars in the sky. His camera takes a photo of all points of the sky that belong to some rectangle with sides parallel to the coordinate axes. Strictly speaking, it makes a photo of all points with coordinates (x, y), such that x_1 ≤ x ≤ x_2 and y_1 ≤ y ≤ y_2, where (x_1, y_1) and (x...
import sys n = int(input()) L = [int(x) for x in input().split()] L.sort() if n == 1: print(0) sys.exit(0) min1 = 10**11 for i in range(1, n): min1 = min(min1, L[n + i - 1] - L[i]) print(min(min1 * (L[2 * n - 1] - L[0]), (L[2 * n - 1] - L[n]) * (L[n - 1] - L[0])))
IMPORT ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR VAR FUNC_CALL FUNC_CALL VAR EXPR FUNC_CALL VAR IF VAR NUMBER EXPR FUNC_CALL VAR NUMBER EXPR FUNC_CALL VAR NUMBER ASSIGN VAR BIN_OP NUMBER NUMBER FOR VAR FUNC_CALL VAR NUMBER VAR ASSIGN VAR FUNC_CALL VAR VAR BIN_OP VAR BIN_OP BIN_OP VAR VAR NUMBE...