description stringlengths 171 4k | code stringlengths 94 3.98k | normalized_code stringlengths 57 4.99k |
|---|---|---|
Akash got his money from CodeChef today, so he decided to have dinner outside.
He went to a restaurant having N items on the menu. The i^{th} item on the menu belongs to the *category* A_{i} and requires B_{i} time to be cooked.
Akash wants to have a *complete meal*. Thus, his meal should have at least K distinct *c... | for _ in range(int(input())):
n, k = list(map(int, input().split()))
a = list(map(int, input().split()))
b = list(map(int, input().split()))
d = dict()
for i in range(n):
if a[i] in d.keys():
d[a[i]] = min([d[a[i]], b[i]])
else:
d[a[i]] = b[i]
if len(d.key... | FOR VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL 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 VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FOR VAR FUNC_CALL VAR VAR IF VAR VAR FUN... |
Akash got his money from CodeChef today, so he decided to have dinner outside.
He went to a restaurant having N items on the menu. The i^{th} item on the menu belongs to the *category* A_{i} and requires B_{i} time to be cooked.
Akash wants to have a *complete meal*. Thus, his meal should have at least K distinct *c... | t = int(input())
for i in range(t):
n, k = list(map(int, input().split()))
category = list(map(int, input().split()))
food_time = list(map(int, input().split()))
food = {}
for j in range(n):
if category[j] in food:
Previous_time = food[category[j]]
if Previous_time > ... | 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 FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR DICT FOR VAR FUNC_CALL VAR VAR IF VAR V... |
Akash got his money from CodeChef today, so he decided to have dinner outside.
He went to a restaurant having N items on the menu. The i^{th} item on the menu belongs to the *category* A_{i} and requires B_{i} time to be cooked.
Akash wants to have a *complete meal*. Thus, his meal should have at least K distinct *c... | for _ in range(int(input())):
n, k = map(int, input().split(" "))
a = list(map(int, input().split(" ")))
b = list(map(int, input().split(" ")))
res = {}
for i in range(n):
if res.get(a[i], -1) == -1:
res[a[i]] = b[i]
else:
res[a[i]] = min(res.get(a[i], 0), b[i... | FOR VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR STRING ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR STRING ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR STRING ASSIGN VAR DICT FOR VAR FUNC_CALL VAR VAR IF FUNC_CALL VAR... |
Akash got his money from CodeChef today, so he decided to have dinner outside.
He went to a restaurant having N items on the menu. The i^{th} item on the menu belongs to the *category* A_{i} and requires B_{i} time to be cooked.
Akash wants to have a *complete meal*. Thus, his meal should have at least K distinct *c... | for i in range(int(input())):
Num, K = map(int, input().split())
A = list(map(int, input().split()))
B = list(map(int, input().split()))
dt = {}
if len(set(A)) < K:
print(-1)
else:
for i in range(len(A)):
if A[i] not in dt:
dt[A[i]] = B[i]
... | FOR VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL 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 VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR DICT IF FUNC_CALL VAR FUNC_CALL VAR VAR VAR EXPR FUNC_CALL VAR NUMBE... |
Akash got his money from CodeChef today, so he decided to have dinner outside.
He went to a restaurant having N items on the menu. The i^{th} item on the menu belongs to the *category* A_{i} and requires B_{i} time to be cooked.
Akash wants to have a *complete meal*. Thus, his meal should have at least K distinct *c... | for _ in range(int(input())):
n, k = list(map(int, input().split()))
a = list(map(int, input().split()))
b = list(map(int, input().split()))
d = {}
for i in range(n):
if a[i] in d:
d[a[i]] = min(d[a[i]], b[i])
else:
d[a[i]] = b[i]
li = []
for i in d:
... | FOR VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL 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 VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR DICT FOR VAR FUNC_CALL VAR VAR IF VAR VAR VAR ASSIGN V... |
Akash got his money from CodeChef today, so he decided to have dinner outside.
He went to a restaurant having N items on the menu. The i^{th} item on the menu belongs to the *category* A_{i} and requires B_{i} time to be cooked.
Akash wants to have a *complete meal*. Thus, his meal should have at least K distinct *c... | def dinner(n, k, a, b):
d = {}
for i in range(n):
if a[i] in d:
d[a[i]].append(b[i])
else:
d[a[i]] = [b[i]]
c = set(a)
if len(c) < k:
return -1
else:
s = 0
exi = []
for i in d:
mini = min(d[i])
exi.append... | FUNC_DEF ASSIGN VAR DICT FOR VAR FUNC_CALL VAR VAR IF VAR VAR VAR EXPR FUNC_CALL VAR VAR VAR VAR VAR ASSIGN VAR VAR VAR LIST VAR VAR ASSIGN VAR FUNC_CALL VAR VAR IF FUNC_CALL VAR VAR VAR RETURN NUMBER ASSIGN VAR NUMBER ASSIGN VAR LIST FOR VAR VAR ASSIGN VAR FUNC_CALL VAR VAR VAR EXPR FUNC_CALL VAR VAR EXPR FUNC_CALL VA... |
Akash got his money from CodeChef today, so he decided to have dinner outside.
He went to a restaurant having N items on the menu. The i^{th} item on the menu belongs to the *category* A_{i} and requires B_{i} time to be cooked.
Akash wants to have a *complete meal*. Thus, his meal should have at least K distinct *c... | for _ in range(int(input())):
n, k = map(int, input().split())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
d = {}
for i in range(n):
if a[i] not in d:
d[a[i]] = b[i]
else:
d[a[i]] = min(d[a[i]], b[i])
l = list(d.values())
l ... | FOR VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL 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 VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR DICT FOR VAR FUNC_CALL VAR VAR IF VAR VAR VAR ASSIGN VAR VAR VAR VAR... |
Akash got his money from CodeChef today, so he decided to have dinner outside.
He went to a restaurant having N items on the menu. The i^{th} item on the menu belongs to the *category* A_{i} and requires B_{i} time to be cooked.
Akash wants to have a *complete meal*. Thus, his meal should have at least K distinct *c... | def dinner(category, time, N, K):
look = list(zip(time, category))
look.sort()
distinct = {}
ans = 0
for i in range(N):
if len(distinct) >= K:
return ans
if look[i][1] in distinct:
continue
else:
distinct[look[i][1]] = True
ans ... | FUNC_DEF ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR VAR EXPR FUNC_CALL VAR ASSIGN VAR DICT ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR VAR IF FUNC_CALL VAR VAR VAR RETURN VAR IF VAR VAR NUMBER VAR ASSIGN VAR VAR VAR NUMBER NUMBER VAR VAR VAR NUMBER IF FUNC_CALL VAR VAR VAR RETURN VAR RETURN NUMBER FOR VAR FUNC_CALL VAR FUN... |
Akash got his money from CodeChef today, so he decided to have dinner outside.
He went to a restaurant having N items on the menu. The i^{th} item on the menu belongs to the *category* A_{i} and requires B_{i} time to be cooked.
Akash wants to have a *complete meal*. Thus, his meal should have at least K distinct *c... | t = int(input())
for t in range(t):
n, k = [int(i) for i in input().split()]
a = [int(i) for i in input().split()]
b = [int(i) for i in input().split()]
ans = {}
for i in range(n):
if a[i] not in ans:
ans[a[i]] = b[i]
elif ans[a[i]] > b[i]:
ans[a[i]] = b[i]
... | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR FOR VAR FUNC_CALL VAR VAR ASSIGN VAR VAR FUNC_CALL VAR VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR DICT FOR VAR FUNC_CALL VAR VAR IF VAR VAR VAR ASSIGN VAR VAR VAR VAR ... |
Akash got his money from CodeChef today, so he decided to have dinner outside.
He went to a restaurant having N items on the menu. The i^{th} item on the menu belongs to the *category* A_{i} and requires B_{i} time to be cooked.
Akash wants to have a *complete meal*. Thus, his meal should have at least K distinct *c... | t = int(input())
for i in range(t):
n, k = map(int, input().split())
l1 = list(map(int, input().split()))
l2 = list(map(int, input().split()))
d = {}
for i in range(len(l1)):
if l1[i] not in d:
d[l1[i]] = l2[i]
elif l2[i] < d[l1[i]]:
d[l1[i]] = l2[i]
if le... | 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 FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR DICT FOR VAR FUNC_CALL VAR FUNC_CALL VAR VAR IF VAR V... |
Akash got his money from CodeChef today, so he decided to have dinner outside.
He went to a restaurant having N items on the menu. The i^{th} item on the menu belongs to the *category* A_{i} and requires B_{i} time to be cooked.
Akash wants to have a *complete meal*. Thus, his meal should have at least K distinct *c... | testcases = int(input())
for _ in range(testcases):
smallest = []
l1 = list(map(int, input().split()))
l2 = list(map(int, input().split()))
l3 = list(map(int, input().split()))
d = dict.fromkeys(l2)
for j in l2:
d[j] = list()
for i in range(l1[0]):
d[l2[i]].append(l3[i])
... | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR FOR VAR FUNC_CALL VAR VAR ASSIGN VAR LIST ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL 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 VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR FOR VAR V... |
Akash got his money from CodeChef today, so he decided to have dinner outside.
He went to a restaurant having N items on the menu. The i^{th} item on the menu belongs to the *category* A_{i} and requires B_{i} time to be cooked.
Akash wants to have a *complete meal*. Thus, his meal should have at least K distinct *c... | n = int(input())
for i in range(n):
l, k = map(int, input().split())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
aa = dict()
for i in range(l):
try:
aa[a[i]] = min(aa[a[i]], b[i])
except:
aa[a[i]] = b[i]
if len(aa) < k:
... | 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 FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FOR VAR FUNC_CALL VAR VAR ASSIGN VAR VA... |
Akash got his money from CodeChef today, so he decided to have dinner outside.
He went to a restaurant having N items on the menu. The i^{th} item on the menu belongs to the *category* A_{i} and requires B_{i} time to be cooked.
Akash wants to have a *complete meal*. Thus, his meal should have at least K distinct *c... | for _ in range(int(input())):
n, k = map(int, input().split())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
dic = {}
temp = max(b)
for j in a:
dic[j] = temp
for j in range(n):
dic[a[j]] = min(dic[a[j]], b[j])
if len(dic) < k:
print(-1)
... | FOR VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL 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 VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR DICT ASSIGN VAR FUNC_CALL VAR VAR FOR VAR VAR ASSIGN VAR VAR VAR FOR... |
Akash got his money from CodeChef today, so he decided to have dinner outside.
He went to a restaurant having N items on the menu. The i^{th} item on the menu belongs to the *category* A_{i} and requires B_{i} time to be cooked.
Akash wants to have a *complete meal*. Thus, his meal should have at least K distinct *c... | t = int(input())
for i in range(t):
n, k = map(int, input().split())
lsta = list(map(int, input().split()))
lstc = []
lstb = list(map(int, input().split()))
dict = {}
for i in range(n):
if lsta[i] in dict:
dict[lsta[i]] = min(lstb[i], dict[lsta[i]])
else:
... | 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 FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR LIST ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR DICT FOR VAR FUNC_CALL VAR VAR IF VAR... |
Akash got his money from CodeChef today, so he decided to have dinner outside.
He went to a restaurant having N items on the menu. The i^{th} item on the menu belongs to the *category* A_{i} and requires B_{i} time to be cooked.
Akash wants to have a *complete meal*. Thus, his meal should have at least K distinct *c... | t = int(input())
while t > 0:
n, k = map(int, input().split())
c = list(map(int, input().split()))
time = list(map(int, input().split()))
d = {}
for i in range(n):
if c[i] not in d.keys():
d[c[i]] = time[i]
else:
d[c[i]] = min(d[c[i]], time[i])
if len(d) <... | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR WHILE VAR NUMBER ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL 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 VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR DICT FOR VAR FUNC_CALL VAR VAR IF VAR VAR FUNC_CALL VAR ASSIGN... |
Akash got his money from CodeChef today, so he decided to have dinner outside.
He went to a restaurant having N items on the menu. The i^{th} item on the menu belongs to the *category* A_{i} and requires B_{i} time to be cooked.
Akash wants to have a *complete meal*. Thus, his meal should have at least K distinct *c... | def solve():
n, k = map(int, input().split())
di = dict()
a = list(map(int, input().split()))
b = list(map(int, input().split()))
for i in range(n):
if a[i] in di:
di[a[i]] = min(b[i], di[a[i]])
else:
di[a[i]] = b[i]
val = list(di.values())
print(sum(s... | FUNC_DEF ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN 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 VAR FUNC_CALL FUNC_CALL VAR FOR VAR FUNC_CALL VAR VAR IF VAR VAR VAR ASSIGN VAR VAR VAR FUNC_CALL VAR VAR VAR VAR VAR VAR A... |
Akash got his money from CodeChef today, so he decided to have dinner outside.
He went to a restaurant having N items on the menu. The i^{th} item on the menu belongs to the *category* A_{i} and requires B_{i} time to be cooked.
Akash wants to have a *complete meal*. Thus, his meal should have at least K distinct *c... | for _ in range(int(input())):
n, k = map(int, input().split())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
d = dict()
if len(set(a)) < k:
print(-1)
continue
for i in range(len(a)):
d[a[i]] = b[i]
for i in range(len(a)):
d[a[i]] = mi... | FOR VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL 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 VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR IF FUNC_CALL VAR FUNC_CALL VAR VAR VAR EXPR FUNC_CALL ... |
Akash got his money from CodeChef today, so he decided to have dinner outside.
He went to a restaurant having N items on the menu. The i^{th} item on the menu belongs to the *category* A_{i} and requires B_{i} time to be cooked.
Akash wants to have a *complete meal*. Thus, his meal should have at least K distinct *c... | t = int(input())
for i in range(t):
n_k = input().split(" ")
category = input().split(" ")
time = input().split(" ")
s_cat = set(category)
if len(s_cat) < int(n_k[1]):
print(-1)
else:
l_time = {}
for j in range(int(n_k[0])):
if category[j] not in l_time:
... | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR FOR VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL FUNC_CALL VAR STRING ASSIGN VAR FUNC_CALL FUNC_CALL VAR STRING ASSIGN VAR FUNC_CALL FUNC_CALL VAR STRING ASSIGN VAR FUNC_CALL VAR VAR IF FUNC_CALL VAR VAR FUNC_CALL VAR VAR NUMBER EXPR FUNC_CALL VAR NUMBER ASSIGN VAR DICT FOR VAR FUNC... |
Akash got his money from CodeChef today, so he decided to have dinner outside.
He went to a restaurant having N items on the menu. The i^{th} item on the menu belongs to the *category* A_{i} and requires B_{i} time to be cooked.
Akash wants to have a *complete meal*. Thus, his meal should have at least K distinct *c... | for _ in range(int(input())):
n, k = map(int, input().split())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
items = set()
time = 0
total = 0
a = [A for B, A in sorted(zip(b, a))]
b.sort()
for i in range(n):
if a[i] not in items:
items.ad... | FOR VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL 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 VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR ASSIGN VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR VAR VAR... |
Akash got his money from CodeChef today, so he decided to have dinner outside.
He went to a restaurant having N items on the menu. The i^{th} item on the menu belongs to the *category* A_{i} and requires B_{i} time to be cooked.
Akash wants to have a *complete meal*. Thus, his meal should have at least K distinct *c... | def minimum_time(items, k):
items.sort(key=lambda x: x[1])
categories = set()
total_time = 0
for item in items:
category, time = item
if category not in categories:
categories.add(category)
total_time += time
if len(categories) >= k:
return tot... | FUNC_DEF EXPR FUNC_CALL VAR VAR NUMBER ASSIGN VAR FUNC_CALL VAR ASSIGN VAR NUMBER FOR VAR VAR ASSIGN VAR VAR VAR IF VAR VAR EXPR FUNC_CALL VAR VAR VAR VAR IF FUNC_CALL VAR VAR VAR RETURN VAR RETURN NUMBER ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR FOR VAR FUNC_CALL VAR VAR ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CA... |
Akash got his money from CodeChef today, so he decided to have dinner outside.
He went to a restaurant having N items on the menu. The i^{th} item on the menu belongs to the *category* A_{i} and requires B_{i} time to be cooked.
Akash wants to have a *complete meal*. Thus, his meal should have at least K distinct *c... | for i in range(int(input())):
a, b = map(int, input().split())
x = list(map(int, input().split()))
y = list(map(int, input().split()))
z = {}
q = []
c, t = 0, 0
for i in range(a):
if x[i] not in z:
z[x[i]] = y[i]
else:
z[x[i]] = min(z[x[i]], y[i])
... | FOR VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL 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 VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR DICT ASSIGN VAR LIST ASSIGN VAR VAR NUMBER NUMBER FOR VAR FUNC_CALL ... |
Akash got his money from CodeChef today, so he decided to have dinner outside.
He went to a restaurant having N items on the menu. The i^{th} item on the menu belongs to the *category* A_{i} and requires B_{i} time to be cooked.
Akash wants to have a *complete meal*. Thus, his meal should have at least K distinct *c... | for _ in range(int(input())):
n, k = map(int, input().split())
m = list(map(int, input().split()))
t = list(map(int, input().split()))
meals = set(m)
if k > len(meals):
print(-1)
else:
m = [x for i, x in sorted(zip(t, m))]
t.sort()
time = 0
total = 0
... | FOR VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL 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 VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR IF VAR FUNC_CALL VAR VAR EXPR FUNC_CALL VAR NUMBER... |
Akash got his money from CodeChef today, so he decided to have dinner outside.
He went to a restaurant having N items on the menu. The i^{th} item on the menu belongs to the *category* A_{i} and requires B_{i} time to be cooked.
Akash wants to have a *complete meal*. Thus, his meal should have at least K distinct *c... | for _ in range(int(input())):
n, k = list(map(int, input().split(" ")))
dishes = list(map(int, input().split(" ")))
uni = set(dishes)
time = list(map(int, input().split(" ")))
arr = [1000000] * 1000000
s = 0
for x in range(len(dishes)):
if arr[dishes[x]] > time[x]:
arr[di... | FOR VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR STRING 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 FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR STRING ASSIGN VAR BIN_... |
Akash got his money from CodeChef today, so he decided to have dinner outside.
He went to a restaurant having N items on the menu. The i^{th} item on the menu belongs to the *category* A_{i} and requires B_{i} time to be cooked.
Akash wants to have a *complete meal*. Thus, his meal should have at least K distinct *c... | t = int(input())
for i in range(t):
n, k = map(int, input().split())
a = [int(i) for i in input().split()]
b = [int(i) for i in input().split()]
c = {}
for i in range(len(a)):
if a[i] not in c:
c[a[i]] = b[i]
else:
c[a[i]] = min(c[a[i]], b[i])
if len(c) < ... | 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 FUNC_CALL VAR VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR DICT FOR VAR FUNC_CALL VAR FUNC_CALL VAR VAR IF VAR VAR VAR ASSIGN VAR VA... |
Akash got his money from CodeChef today, so he decided to have dinner outside.
He went to a restaurant having N items on the menu. The i^{th} item on the menu belongs to the *category* A_{i} and requires B_{i} time to be cooked.
Akash wants to have a *complete meal*. Thus, his meal should have at least K distinct *c... | for _ in range(int(input())):
n, k = map(int, input().split())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
s = set(a)
time = dict()
for i in range(n):
if a[i] not in time:
time[a[i]] = b[i]
elif b[i] < time[a[i]]:
time[a[i]] = b... | FOR VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL 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 VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR FOR VAR FUNC_CALL VAR VAR... |
Akash got his money from CodeChef today, so he decided to have dinner outside.
He went to a restaurant having N items on the menu. The i^{th} item on the menu belongs to the *category* A_{i} and requires B_{i} time to be cooked.
Akash wants to have a *complete meal*. Thus, his meal should have at least K distinct *c... | T = int(input())
while T:
T -= 1
n, k = list(map(int, input().split()))
a = list(map(int, input().split()))
b = list(map(int, input().split()))
d = {}
ki = 0
for i in range(n):
try:
d[a[i]] = min(d[a[i]], b[i])
except KeyError:
d[a[i]] = b[i]
... | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR WHILE VAR VAR NUMBER ASSIGN VAR VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL 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 VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR DICT ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR... |
Akash got his money from CodeChef today, so he decided to have dinner outside.
He went to a restaurant having N items on the menu. The i^{th} item on the menu belongs to the *category* A_{i} and requires B_{i} time to be cooked.
Akash wants to have a *complete meal*. Thus, his meal should have at least K distinct *c... | def cal(a, b, n, k):
d = dict()
for i in range(n):
if a[i] in d.keys():
if d.get(a[i]) > b[i]:
d[a[i]] = b[i]
else:
d[a[i]] = b[i]
l = []
for i in d.keys():
l.append([d.get(i), i])
l.sort()
size = len(l)
time = 0
while size ... | FUNC_DEF ASSIGN VAR FUNC_CALL VAR FOR VAR FUNC_CALL VAR VAR IF VAR VAR FUNC_CALL VAR IF FUNC_CALL VAR VAR VAR VAR VAR ASSIGN VAR VAR VAR VAR VAR ASSIGN VAR VAR VAR VAR VAR ASSIGN VAR LIST FOR VAR FUNC_CALL VAR EXPR FUNC_CALL VAR LIST FUNC_CALL VAR VAR VAR EXPR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR ASSIGN VAR NUMBE... |
Akash got his money from CodeChef today, so he decided to have dinner outside.
He went to a restaurant having N items on the menu. The i^{th} item on the menu belongs to the *category* A_{i} and requires B_{i} time to be cooked.
Akash wants to have a *complete meal*. Thus, his meal should have at least K distinct *c... | t = int(input())
for i in range(t):
N, K = map(int, input().split())
A = list(map(int, input().split()))
B = list(map(int, input().split()))
hast = {}
for i in range(len(A)):
if A[i] in hast:
hast[A[i]] = min(hast[A[i]], B[i])
else:
hast[A[i]] = B[i]
L = [... | 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 FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR DICT FOR VAR FUNC_CALL VAR FUNC_CALL VAR VAR IF VAR V... |
Akash got his money from CodeChef today, so he decided to have dinner outside.
He went to a restaurant having N items on the menu. The i^{th} item on the menu belongs to the *category* A_{i} and requires B_{i} time to be cooked.
Akash wants to have a *complete meal*. Thus, his meal should have at least K distinct *c... | def Solve(d, n, k):
if len(d) < k:
return -1
values = list(d.values())
values.sort()
ans = 0
for i in range(k):
ans = ans + values[i]
return ans
for _ in range(int(input())):
n, k = map(int, input().split())
a = list(map(int, input().split()))
b = list(map(int, inpu... | FUNC_DEF IF FUNC_CALL VAR VAR VAR RETURN NUMBER ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR EXPR FUNC_CALL VAR ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR VAR ASSIGN VAR BIN_OP VAR VAR VAR RETURN VAR FOR VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL V... |
You have N rods with you. The i-th rod has a length of A_{i} and a beauty of B_{i}.
You'd like to arrange these rods side-by-side in some order on the number line, starting from 0.
Let x_{i} be the starting position of the i-th rod in an arrangement. The beauty of this arrangement is
\sum_{i=1}^N x_{i}\cdot B_{i}
... | for _ in range(int(input())):
n = int(input())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
opt = [[b[i] / a[i], i] for i in range(n)]
opt.sort()
ans = 0
x = 0
for i in opt:
id = i[1]
ans += x * b[id]
x += a[id]
print(ans) | FOR VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR 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 VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR LIST BIN_OP VAR VAR VAR VAR VAR VAR FUNC_CALL VAR VAR EXPR FUNC_CALL VAR ASSIGN VAR NU... |
You have N rods with you. The i-th rod has a length of A_{i} and a beauty of B_{i}.
You'd like to arrange these rods side-by-side in some order on the number line, starting from 0.
Let x_{i} be the starting position of the i-th rod in an arrangement. The beauty of this arrangement is
\sum_{i=1}^N x_{i}\cdot B_{i}
... | for _ in range(int(input())):
n = int(input())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
arr = []
for i in range(n):
arr.append([a[i] / b[i], i])
arr.sort(reverse=True)
ans = 0
cur = 0
for r in arr:
ans += cur * b[r[1]]
cur += a[r... | FOR VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR 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 VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR LIST FOR VAR FUNC_CALL VAR VAR EXPR FUNC_CALL VAR LIST BIN_OP VAR VAR VAR VAR VAR EXPR... |
You have N rods with you. The i-th rod has a length of A_{i} and a beauty of B_{i}.
You'd like to arrange these rods side-by-side in some order on the number line, starting from 0.
Let x_{i} be the starting position of the i-th rod in an arrangement. The beauty of this arrangement is
\sum_{i=1}^N x_{i}\cdot B_{i}
... | t = int(input())
while t:
n = int(input())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
ans = [(b[i] / a[i], (a[i], b[i])) for i in range(n)]
ans.sort()
x = 0
sum = 0
for i in range(n):
sum += x * ans[i][1][1]
x = x + ans[i][1][0]
print(sum)... | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR WHILE VAR 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 VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR BIN_OP VAR VAR VAR VAR VAR VAR VAR VAR VAR FUNC_CALL VAR VAR EXPR FUNC_CALL VAR ASSIGN ... |
You have N rods with you. The i-th rod has a length of A_{i} and a beauty of B_{i}.
You'd like to arrange these rods side-by-side in some order on the number line, starting from 0.
Let x_{i} be the starting position of the i-th rod in an arrangement. The beauty of this arrangement is
\sum_{i=1}^N x_{i}\cdot B_{i}
... | t = int(input())
for _ in range(t):
n = int(input())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
r = [0] * n
for i in range(n):
r[i] = b[i] / a[i]
z = list(zip(r, a, b))
z.sort()
clen = 0
ans = 0
for i in range(n):
ans += clen * z[i][2]... | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR FOR VAR FUNC_CALL VAR VAR 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 VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR BIN_OP LIST NUMBER VAR FOR VAR FUNC_CALL VAR VAR ASSIGN VAR VAR BIN_OP ... |
You have N rods with you. The i-th rod has a length of A_{i} and a beauty of B_{i}.
You'd like to arrange these rods side-by-side in some order on the number line, starting from 0.
Let x_{i} be the starting position of the i-th rod in an arrangement. The beauty of this arrangement is
\sum_{i=1}^N x_{i}\cdot B_{i}
... | for _ in range(int(input())):
n = int(input())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
x = [[0, 0] for i in range(n)]
for i in range(n):
x[i][0] = a[i]
x[i][1] = b[i]
x.sort(key=lambda x: x[1] / x[0])
cur = 0
ans = 0
for i in range(n):
... | FOR VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR 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 VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR LIST NUMBER NUMBER VAR FUNC_CALL VAR VAR FOR VAR FUNC_CALL VAR VAR ASSIGN VAR VAR NUMB... |
You have N rods with you. The i-th rod has a length of A_{i} and a beauty of B_{i}.
You'd like to arrange these rods side-by-side in some order on the number line, starting from 0.
Let x_{i} be the starting position of the i-th rod in an arrangement. The beauty of this arrangement is
\sum_{i=1}^N x_{i}\cdot B_{i}
... | for temp in range(int(input())):
n = int(input())
a = [int(x) for x in input().split()]
b = [int(x) for x in input().split()]
res = [(b[i] / a[i]) for i in range(n)]
res, a, b = (list(t) for t in zip(*sorted(zip(res, a, b))))
s = 0
ans = 0
for i in range(1, n):
s += a[i - 1]
... | FOR VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR 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 VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR BIN_OP VAR VAR VAR VAR VAR FUNC_CALL VAR VAR ASSIGN VAR VAR VAR FUNC_CALL VAR VAR VAR FUNC_CALL VAR FUNC_C... |
You have N rods with you. The i-th rod has a length of A_{i} and a beauty of B_{i}.
You'd like to arrange these rods side-by-side in some order on the number line, starting from 0.
Let x_{i} be the starting position of the i-th rod in an arrangement. The beauty of this arrangement is
\sum_{i=1}^N x_{i}\cdot B_{i}
... | for _ in range(int(input())):
n = int(input())
l = list(map(int, input().split()))
b = list(map(int, input().split()))
pts = list(zip(l, b))
pts = sorted(pts, key=lambda x: x[1] / x[0])
currdist = 0
res = 0
for i, j in pts:
res += currdist * j
currdist += i
print(res) | FOR VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR 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 VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR VAR ASSIGN VAR FUNC_CALL VAR VAR BIN_OP VAR NUMBER VAR... |
You have N rods with you. The i-th rod has a length of A_{i} and a beauty of B_{i}.
You'd like to arrange these rods side-by-side in some order on the number line, starting from 0.
Let x_{i} be the starting position of the i-th rod in an arrangement. The beauty of this arrangement is
\sum_{i=1}^N x_{i}\cdot B_{i}
... | def f(x):
return x[1]
t = int(input())
for _ in range(t):
n = int(input())
p = list(map(int, input().split()))
l = list(map(int, input().split()))
k = [[(0) for x in range(2)] for y in range(n)]
for i in range(n):
k[i][0] = i
k[i][1] = l[i] / p[i]
k.sort(key=f)
sum = 0
... | FUNC_DEF RETURN VAR NUMBER ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR FOR VAR FUNC_CALL VAR VAR 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 VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR NUMBER VAR FUNC_CALL VAR NUMBER VAR FUNC_CAL... |
You have N rods with you. The i-th rod has a length of A_{i} and a beauty of B_{i}.
You'd like to arrange these rods side-by-side in some order on the number line, starting from 0.
Let x_{i} be the starting position of the i-th rod in an arrangement. The beauty of this arrangement is
\sum_{i=1}^N x_{i}\cdot B_{i}
... | def musical_rods(n, rod_len, beauty):
index = [i for i in range(n)]
index.sort(key=lambda x: rod_len[x] / beauty[x], reverse=True)
ans = prev = 0
for i in index:
ans += beauty[i] * prev
prev += rod_len[i]
return ans
t = int(input())
for _ in range(t):
n = int(input())
rl = ... | FUNC_DEF ASSIGN VAR VAR VAR FUNC_CALL VAR VAR EXPR FUNC_CALL VAR BIN_OP VAR VAR VAR VAR NUMBER ASSIGN VAR VAR NUMBER FOR VAR VAR VAR BIN_OP VAR VAR VAR VAR VAR VAR RETURN VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR FOR VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR VAR FUNC_CAL... |
You have N rods with you. The i-th rod has a length of A_{i} and a beauty of B_{i}.
You'd like to arrange these rods side-by-side in some order on the number line, starting from 0.
Let x_{i} be the starting position of the i-th rod in an arrangement. The beauty of this arrangement is
\sum_{i=1}^N x_{i}\cdot B_{i}
... | for _ in range(int(input())):
n = int(input())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
complist = []
order = []
for i in range(n):
comp = a[i] / b[i]
complist.append((comp, i))
complist.sort(key=lambda complist: complist[0])
for i in range(... | FOR VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR 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 VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR LIST ASSIGN VAR LIST FOR VAR FUNC_CALL VAR VAR ASSIGN VAR BIN_OP VAR VAR VAR VAR EXPR ... |
You have N rods with you. The i-th rod has a length of A_{i} and a beauty of B_{i}.
You'd like to arrange these rods side-by-side in some order on the number line, starting from 0.
Let x_{i} be the starting position of the i-th rod in an arrangement. The beauty of this arrangement is
\sum_{i=1}^N x_{i}\cdot B_{i}
... | t = int(input())
for i in range(t):
n = int(input())
a = [int(i) for i in input().split()]
b = [int(i) for i in input().split()]
t = sorted([(i, b[i] / a[i]) for i in range(n)], key=lambda r: r[1])
res = 0
s = 0
for i, frac in t:
res += s * b[i]
s += a[i]
print(res) | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR FOR VAR FUNC_CALL VAR VAR 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 VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR BIN_OP VAR VAR VAR VAR VAR FUNC_CALL VAR VAR VAR NUMBER ASSIGN VAR NUMBER... |
You have N rods with you. The i-th rod has a length of A_{i} and a beauty of B_{i}.
You'd like to arrange these rods side-by-side in some order on the number line, starting from 0.
Let x_{i} be the starting position of the i-th rod in an arrangement. The beauty of this arrangement is
\sum_{i=1}^N x_{i}\cdot B_{i}
... | t = int(input())
for _ in range(t):
n = int(input())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
x = {}
for ai, bi, i in zip(a, b, range(n)):
x[i] = ai / bi
indexes = []
for k, v in sorted(x.items(), key=lambda item: item[1], reverse=True):
indexes... | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR FOR VAR FUNC_CALL VAR VAR 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 VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR DICT FOR VAR VAR VAR FUNC_CALL VAR VAR VAR FUNC_CALL VAR VAR ASSIGN VAR... |
You have N rods with you. The i-th rod has a length of A_{i} and a beauty of B_{i}.
You'd like to arrange these rods side-by-side in some order on the number line, starting from 0.
Let x_{i} be the starting position of the i-th rod in an arrangement. The beauty of this arrangement is
\sum_{i=1}^N x_{i}\cdot B_{i}
... | def key(val):
return val[1] / val[0]
T = int(input())
for t in range(T):
n = int(input())
s1 = input().split()
leng = [int(x) for x in s1]
s2 = input().split()
beau = [int(x) for x in s2]
arr = []
tup_arr = zip(leng, beau)
for a, b in tup_arr:
arr.append([a, b])
arr.sor... | FUNC_DEF RETURN BIN_OP VAR NUMBER VAR NUMBER ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR FOR VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR VAR VAR ASSIGN VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR VAR VAR ASSIGN VAR LIST ASSIGN VAR ... |
You have N rods with you. The i-th rod has a length of A_{i} and a beauty of B_{i}.
You'd like to arrange these rods side-by-side in some order on the number line, starting from 0.
Let x_{i} be the starting position of the i-th rod in an arrangement. The beauty of this arrangement is
\sum_{i=1}^N x_{i}\cdot B_{i}
... | a = int(input())
for i in range(a):
c = int(input())
arr1 = list(map(int, input().split()))
arr2 = list(map(int, input().split()))
final = [[arr1[i], arr2[i], arr2[i] / arr1[i]] for i in range(c)]
sol = sorted(final, key=lambda l: l[2], reverse=False)
s = 0
index = 0
for i in range(len(s... | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR FOR VAR FUNC_CALL VAR VAR 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 VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR LIST VAR VAR VAR VAR BIN_OP VAR VAR VAR VAR VAR FUNC_CALL VAR VAR ASSIG... |
You have N rods with you. The i-th rod has a length of A_{i} and a beauty of B_{i}.
You'd like to arrange these rods side-by-side in some order on the number line, starting from 0.
Let x_{i} be the starting position of the i-th rod in an arrangement. The beauty of this arrangement is
\sum_{i=1}^N x_{i}\cdot B_{i}
... | for _ in range(int(input())):
n = int(input())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
d = [(a[i] / b[i], i) for i in range(n)]
x = [(0) for i in range(n)]
d = sorted(d, key=lambda x: x[0])
length = 0
for i in range(n):
ind = d[-1][1]
x[ind... | FOR VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR 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 VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR BIN_OP VAR VAR VAR VAR VAR VAR FUNC_CALL VAR VAR ASSIGN VAR NUMBER VAR FUNC_CALL VAR V... |
You have N rods with you. The i-th rod has a length of A_{i} and a beauty of B_{i}.
You'd like to arrange these rods side-by-side in some order on the number line, starting from 0.
Let x_{i} be the starting position of the i-th rod in an arrangement. The beauty of this arrangement is
\sum_{i=1}^N x_{i}\cdot B_{i}
... | for T in range(int(input())):
n = int(input())
a = [int(i) for i in input().split()]
b = [int(i) for i in input().split()]
div = [(b[i] / a[i]) for i in range(n)]
z = sorted(zip(div, a, b), reverse=False)
current_length = 0
res = 0
for rod in z:
res += current_length * rod[2]
... | FOR VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR 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 VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR BIN_OP VAR VAR VAR VAR VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR VAR VAR NUMBER ASS... |
You have N rods with you. The i-th rod has a length of A_{i} and a beauty of B_{i}.
You'd like to arrange these rods side-by-side in some order on the number line, starting from 0.
Let x_{i} be the starting position of the i-th rod in an arrangement. The beauty of this arrangement is
\sum_{i=1}^N x_{i}\cdot B_{i}
... | def solve():
t = int(input())
for i in range(t):
n = int(input())
length = list(map(int, input().split()))
beaut = list(map(int, input().split()))
arr = [0] * n
for k in range(n):
arr[k] = beaut[k] / length[k]
list1 = arr
list2 = length
... | FUNC_DEF ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR FOR VAR FUNC_CALL VAR VAR 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 VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR BIN_OP LIST NUMBER VAR FOR VAR FUNC_CALL VAR VAR ASSIGN VAR VA... |
You have N rods with you. The i-th rod has a length of A_{i} and a beauty of B_{i}.
You'd like to arrange these rods side-by-side in some order on the number line, starting from 0.
Let x_{i} be the starting position of the i-th rod in an arrangement. The beauty of this arrangement is
\sum_{i=1}^N x_{i}\cdot B_{i}
... | for t in range(int(input())):
n = int(input())
a = [int(x) for x in input().split()]
b = [int(x) for x in input().split()]
ans = []
for i in range(len(a)):
ans.append(tuple([a[i], b[i], b[i] / a[i]]))
ans.sort(key=lambda x: x[2])
sum = ans[0][0]
answer = 0
for i in range(1, l... | FOR VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR 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 VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR LIST FOR VAR FUNC_CALL VAR FUNC_CALL VAR VAR EXPR FUNC_CALL VAR FUNC_CALL VAR LIST VAR VAR VAR VAR BIN_OP ... |
You have N rods with you. The i-th rod has a length of A_{i} and a beauty of B_{i}.
You'd like to arrange these rods side-by-side in some order on the number line, starting from 0.
Let x_{i} be the starting position of the i-th rod in an arrangement. The beauty of this arrangement is
\sum_{i=1}^N x_{i}\cdot B_{i}
... | t = int(input())
while t:
n = int(input())
a = [int(i) for i in input().split()]
b = [int(i) for i in input().split()]
s = 0
d = {}
for i in range(n):
d[i] = a[i] / b[i]
d = sorted(d, key=lambda x: d[x], reverse=True)
offset = 0
for i in d:
s += offset * b[i]
... | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR WHILE VAR 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 VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR NUMBER ASSIGN VAR DICT FOR VAR FUNC_CALL VAR VAR ASSIGN VAR VAR BIN_OP VAR VAR VAR VAR ASSIGN VAR FUNC_CALL... |
You have N rods with you. The i-th rod has a length of A_{i} and a beauty of B_{i}.
You'd like to arrange these rods side-by-side in some order on the number line, starting from 0.
Let x_{i} be the starting position of the i-th rod in an arrangement. The beauty of this arrangement is
\sum_{i=1}^N x_{i}\cdot B_{i}
... | def sortSecond(elem):
return elem[1]
for _ in range(int(input())):
n = int(input())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
r = []
for i in range(n):
c = i, b[i] / a[i]
r.append(c)
r.sort(key=sortSecond)
x = 0
ans = 0
for i in ran... | FUNC_DEF RETURN VAR NUMBER FOR VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR 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 VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR LIST FOR VAR FUNC_CALL VAR VAR ASSIGN VAR VAR BIN_OP VAR VA... |
You have N rods with you. The i-th rod has a length of A_{i} and a beauty of B_{i}.
You'd like to arrange these rods side-by-side in some order on the number line, starting from 0.
Let x_{i} be the starting position of the i-th rod in an arrangement. The beauty of this arrangement is
\sum_{i=1}^N x_{i}\cdot B_{i}
... | def solve():
n = int(input())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
arr = []
for i in range(n):
arr.append([a[i] / b[i], i])
arr.sort(reverse=True)
now = 0
curent = 0
for j in arr:
now += curent * b[j[1]]
curent += a[j[1]]
... | FUNC_DEF 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 VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR LIST FOR VAR FUNC_CALL VAR VAR EXPR FUNC_CALL VAR LIST BIN_OP VAR VAR VAR VAR VAR EXPR FUNC_CALL VAR NUMBER ASSIGN VAR NUMBER A... |
You have N rods with you. The i-th rod has a length of A_{i} and a beauty of B_{i}.
You'd like to arrange these rods side-by-side in some order on the number line, starting from 0.
Let x_{i} be the starting position of the i-th rod in an arrangement. The beauty of this arrangement is
\sum_{i=1}^N x_{i}\cdot B_{i}
... | def maximum_beauty(N, a, b):
if N == 1:
return 0
else:
mp = []
for i in range(N):
mp.append([b[i] / a[i], i])
mp.sort()
ans = tmp = 0
for i in range(len(mp)):
ans += b[mp[i][1]] * tmp
tmp += a[mp[i][1]]
return ans
T = ... | FUNC_DEF IF VAR NUMBER RETURN NUMBER ASSIGN VAR LIST FOR VAR FUNC_CALL VAR VAR EXPR FUNC_CALL VAR LIST BIN_OP VAR VAR VAR VAR VAR EXPR FUNC_CALL VAR ASSIGN VAR VAR NUMBER FOR VAR FUNC_CALL VAR FUNC_CALL VAR VAR VAR BIN_OP VAR VAR VAR NUMBER VAR VAR VAR VAR VAR NUMBER RETURN VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR FO... |
You have N rods with you. The i-th rod has a length of A_{i} and a beauty of B_{i}.
You'd like to arrange these rods side-by-side in some order on the number line, starting from 0.
Let x_{i} be the starting position of the i-th rod in an arrangement. The beauty of this arrangement is
\sum_{i=1}^N x_{i}\cdot B_{i}
... | def N():
return int(input())
def A():
return [int(x) for x in input().split()]
def S():
return input()
for _ in range(N()):
n = N()
aa = []
ans = 0
if "codechef" == 28226329:
print("Tanmay")
a = A()
b = A()
for i in range(n):
aa.append([a[i] / b[i], i])
... | FUNC_DEF RETURN FUNC_CALL VAR FUNC_CALL VAR FUNC_DEF RETURN FUNC_CALL VAR VAR VAR FUNC_CALL FUNC_CALL VAR FUNC_DEF RETURN FUNC_CALL VAR FOR VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR ASSIGN VAR LIST ASSIGN VAR NUMBER IF STRING NUMBER EXPR FUNC_CALL VAR STRING ASSIGN VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL ... |
You have N rods with you. The i-th rod has a length of A_{i} and a beauty of B_{i}.
You'd like to arrange these rods side-by-side in some order on the number line, starting from 0.
Let x_{i} be the starting position of the i-th rod in an arrangement. The beauty of this arrangement is
\sum_{i=1}^N x_{i}\cdot B_{i}
... | def sorter(x):
return b[x] / a[x]
t = int(input())
for _ in range(t):
n = int(input())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
l = list(range(n))
l.sort(key=sorter)
sum_ = 0
answer = 0
for i in l:
answer += b[i] * sum_
sum_ += a[i]
... | FUNC_DEF RETURN BIN_OP VAR VAR VAR VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR FOR VAR FUNC_CALL VAR VAR 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 VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR ... |
You have N rods with you. The i-th rod has a length of A_{i} and a beauty of B_{i}.
You'd like to arrange these rods side-by-side in some order on the number line, starting from 0.
Let x_{i} be the starting position of the i-th rod in an arrangement. The beauty of this arrangement is
\sum_{i=1}^N x_{i}\cdot B_{i}
... | def solution(n, a, b):
arr = []
length = 0
ans = 0
for i in range(n):
arr.append([a[i] / b[i], a[i], b[i]])
arr.sort(reverse=True)
for element in arr:
ans += length * element[2]
length += element[1]
return ans
for _ in range(int(input())):
n = int(input())
a... | FUNC_DEF ASSIGN VAR LIST ASSIGN VAR NUMBER ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR VAR EXPR FUNC_CALL VAR LIST BIN_OP VAR VAR VAR VAR VAR VAR VAR VAR EXPR FUNC_CALL VAR NUMBER FOR VAR VAR VAR BIN_OP VAR VAR NUMBER VAR VAR NUMBER RETURN VAR FOR VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_... |
You have N rods with you. The i-th rod has a length of A_{i} and a beauty of B_{i}.
You'd like to arrange these rods side-by-side in some order on the number line, starting from 0.
Let x_{i} be the starting position of the i-th rod in an arrangement. The beauty of this arrangement is
\sum_{i=1}^N x_{i}\cdot B_{i}
... | t = int(input())
def compare(a):
return a[1] / a[0]
for _ in range(t):
n = int(input())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
arr = [(a[i], b[i]) for i in range(n)]
arr.sort(key=compare)
prefix, ans = 0, 0
for k in range(n):
ans += prefix * a... | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_DEF RETURN BIN_OP VAR NUMBER VAR NUMBER FOR VAR FUNC_CALL VAR VAR 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 VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR VAR VAR VAR VAR VAR FUNC_C... |
You have N rods with you. The i-th rod has a length of A_{i} and a beauty of B_{i}.
You'd like to arrange these rods side-by-side in some order on the number line, starting from 0.
Let x_{i} be the starting position of the i-th rod in an arrangement. The beauty of this arrangement is
\sum_{i=1}^N x_{i}\cdot B_{i}
... | from sys import stdin
def Sort_Tuple(tup):
tup.sort(key=lambda x: x[2])
return tup
def finalList(weights, values, n):
fli = list()
for i in range(n):
fli.append((weights[i], values[i], values[i] / weights[i]))
Sort_Tuple(fli)
return fli
def musicalRods(fli):
start = 0
ans =... | FUNC_DEF EXPR FUNC_CALL VAR VAR NUMBER RETURN VAR FUNC_DEF ASSIGN VAR FUNC_CALL VAR FOR VAR FUNC_CALL VAR VAR EXPR FUNC_CALL VAR VAR VAR VAR VAR BIN_OP VAR VAR VAR VAR EXPR FUNC_CALL VAR VAR RETURN VAR FUNC_DEF ASSIGN VAR NUMBER ASSIGN VAR NUMBER FOR VAR VAR VAR BIN_OP VAR NUMBER VAR VAR VAR NUMBER RETURN VAR FUNC_DEF ... |
You have N rods with you. The i-th rod has a length of A_{i} and a beauty of B_{i}.
You'd like to arrange these rods side-by-side in some order on the number line, starting from 0.
Let x_{i} be the starting position of the i-th rod in an arrangement. The beauty of this arrangement is
\sum_{i=1}^N x_{i}\cdot B_{i}
... | from sys import stdin
input = stdin.readline
def solve(N, A, B):
C = [(a, b, b / a) for a, b in zip(A, B)]
C = sorted(C, key=lambda x: x[2])
count = 0
x = 0
for a, b, c in C:
count += x * b
x += a
return count
T = int(input().strip())
for problem in range(1, T + 1):
N = ... | ASSIGN VAR VAR FUNC_DEF ASSIGN VAR VAR VAR BIN_OP VAR VAR VAR VAR FUNC_CALL VAR VAR VAR ASSIGN VAR FUNC_CALL VAR VAR VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR NUMBER FOR VAR VAR VAR VAR VAR BIN_OP VAR VAR VAR VAR RETURN VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL FUNC_CALL VAR FOR VAR FUNC_CALL VAR NUMBER BIN_OP VAR NUMBER AS... |
You have N rods with you. The i-th rod has a length of A_{i} and a beauty of B_{i}.
You'd like to arrange these rods side-by-side in some order on the number line, starting from 0.
Let x_{i} be the starting position of the i-th rod in an arrangement. The beauty of this arrangement is
\sum_{i=1}^N x_{i}\cdot B_{i}
... | def key(arr1):
return arr1[1] / arr1[0]
def ans(n, length, beauty):
arr = []
for y1, y2 in zip(length, beauty):
arr.append([y1, y2])
arr.sort(key=key)
cost = 0
c_length = 0
for y in arr:
cost += y[1] * c_length
c_length += y[0]
return cost
test_cases = int(inp... | FUNC_DEF RETURN BIN_OP VAR NUMBER VAR NUMBER FUNC_DEF ASSIGN VAR LIST FOR VAR VAR FUNC_CALL VAR VAR VAR EXPR FUNC_CALL VAR LIST VAR VAR EXPR FUNC_CALL VAR VAR ASSIGN VAR NUMBER ASSIGN VAR NUMBER FOR VAR VAR VAR BIN_OP VAR NUMBER VAR VAR VAR NUMBER RETURN VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR WHILE VAR NUMBER ASSIG... |
You have N rods with you. The i-th rod has a length of A_{i} and a beauty of B_{i}.
You'd like to arrange these rods side-by-side in some order on the number line, starting from 0.
Let x_{i} be the starting position of the i-th rod in an arrangement. The beauty of this arrangement is
\sum_{i=1}^N x_{i}\cdot B_{i}
... | def last(n):
return n[2]
t = int(input())
while t > 0:
n = int(input())
arr = []
A = list(map(int, str(input()).split(" ")))
B = list(map(int, str(input()).split(" ")))
for i in range(n):
arr.append((A[i], B[i], B[i] / A[i]))
arr = sorted(arr, key=last)
curr = 0
ans = 0
... | FUNC_DEF RETURN VAR NUMBER ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR WHILE VAR NUMBER 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 FUNC_CALL VAR STRING ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR FUNC_CALL VAR STRING FOR VA... |
AquaMoon has $n$ friends. They stand in a row from left to right, and the $i$-th friend from the left wears a T-shirt with a number $a_i$ written on it. Each friend has a direction (left or right). In the beginning, the direction of each friend is right.
AquaMoon can make some operations on friends. On each operation,... | def h(l):
for i in range(len(l)):
if l[i] in l[i:]:
return False
return True
def g(l):
p = []
for i in range(len(l)):
if l[i] != sorted(l)[i]:
p = p + [(l[i], i)]
return p
def f(l):
s = sorted(l)
for i in range(len(g(l))):
for j in range(le... | FUNC_DEF FOR VAR FUNC_CALL VAR FUNC_CALL VAR VAR IF VAR VAR VAR VAR RETURN NUMBER RETURN NUMBER FUNC_DEF ASSIGN VAR LIST FOR VAR FUNC_CALL VAR FUNC_CALL VAR VAR IF VAR VAR FUNC_CALL VAR VAR VAR ASSIGN VAR BIN_OP VAR LIST VAR VAR VAR RETURN VAR FUNC_DEF ASSIGN VAR FUNC_CALL VAR VAR FOR VAR FUNC_CALL VAR FUNC_CALL VAR FU... |
AquaMoon has $n$ friends. They stand in a row from left to right, and the $i$-th friend from the left wears a T-shirt with a number $a_i$ written on it. Each friend has a direction (left or right). In the beginning, the direction of each friend is right.
AquaMoon can make some operations on friends. On each operation,... | import sys
def solve(n, arr):
pos1 = [[] for i in range(10**5 + 1)]
for i, a in enumerate(arr):
pos1[a].append(i)
pos2 = [[] for i in range(10**5 + 1)]
arr.sort()
for i, a in enumerate(arr):
pos2[a].append(i)
for i in range(1, 10**5 + 1):
c = 0
for a in pos1[i]:... | IMPORT FUNC_DEF ASSIGN VAR LIST VAR FUNC_CALL VAR BIN_OP BIN_OP NUMBER NUMBER NUMBER FOR VAR VAR FUNC_CALL VAR VAR EXPR FUNC_CALL VAR VAR VAR ASSIGN VAR LIST VAR FUNC_CALL VAR BIN_OP BIN_OP NUMBER NUMBER NUMBER EXPR FUNC_CALL VAR FOR VAR VAR FUNC_CALL VAR VAR EXPR FUNC_CALL VAR VAR VAR FOR VAR FUNC_CALL VAR NUMBER BIN_... |
AquaMoon has $n$ friends. They stand in a row from left to right, and the $i$-th friend from the left wears a T-shirt with a number $a_i$ written on it. Each friend has a direction (left or right). In the beginning, the direction of each friend is right.
AquaMoon can make some operations on friends. On each operation,... | def func():
init = dict()
final = dict()
for i, j in enumerate(a):
if j in init:
init[j][i % 2] += 1
else:
init[j] = [0, 0]
init[j][i % 2] += 1
a.sort()
for i, j in enumerate(a):
if j in final:
final[j][i % 2] += 1
else:... | FUNC_DEF ASSIGN VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FOR VAR VAR FUNC_CALL VAR VAR IF VAR VAR VAR VAR BIN_OP VAR NUMBER NUMBER ASSIGN VAR VAR LIST NUMBER NUMBER VAR VAR BIN_OP VAR NUMBER NUMBER EXPR FUNC_CALL VAR FOR VAR VAR FUNC_CALL VAR VAR IF VAR VAR VAR VAR BIN_OP VAR NUMBER NUMBER ASSIGN VAR VAR LIST NUMBER ... |
AquaMoon has $n$ friends. They stand in a row from left to right, and the $i$-th friend from the left wears a T-shirt with a number $a_i$ written on it. Each friend has a direction (left or right). In the beginning, the direction of each friend is right.
AquaMoon can make some operations on friends. On each operation,... | import sys
LI = lambda: list(map(int, sys.stdin.readline().split()))
MI = lambda: map(int, sys.stdin.readline().split())
SI = lambda: sys.stdin.readline().strip("\n")
II = lambda: int(sys.stdin.readline())
for _ in range(II()):
n = II()
a = LI()
s = sorted(a)
t1 = {}
t2 = {}
for i, v in enumera... | IMPORT ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL FUNC_CALL VAR STRING ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR FOR VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR V... |
AquaMoon has $n$ friends. They stand in a row from left to right, and the $i$-th friend from the left wears a T-shirt with a number $a_i$ written on it. Each friend has a direction (left or right). In the beginning, the direction of each friend is right.
AquaMoon can make some operations on friends. On each operation,... | t = int(input())
for i in range(0, t):
n = int(input())
a = list(map(int, input().split()))
even_original = []
odd_original = []
even_sorted = []
odd_sorted = []
notpossible = False
for i in range(0, len(a), 2):
even_original.append(a[i])
for i in range(1, len(a), 2):
... | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR FOR VAR FUNC_CALL VAR NUMBER VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR LIST ASSIGN VAR LIST ASSIGN VAR LIST ASSIGN VAR LIST ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR NUMBER FUNC_CALL VAR VAR NUMBER EXPR F... |
AquaMoon has $n$ friends. They stand in a row from left to right, and the $i$-th friend from the left wears a T-shirt with a number $a_i$ written on it. Each friend has a direction (left or right). In the beginning, the direction of each friend is right.
AquaMoon can make some operations on friends. On each operation,... | T = int(input())
for TT in range(T):
n = int(input())
a = [int(x) for x in input().split()]
b = a[:]
b.sort()
odd = {}
even = {}
for i in range(len(a)):
if i % 2 == 0:
if a[i] not in even:
even[a[i]] = 0
even[a[i]] += 1
if b[i] not ... | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR FOR VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR VAR EXPR FUNC_CALL VAR ASSIGN VAR DICT ASSIGN VAR DICT FOR VAR FUNC_CALL VAR FUNC_CALL VAR VAR IF BIN_OP VAR NUMBER NUMBER IF VAR VAR VAR ASSIGN VAR... |
AquaMoon has $n$ friends. They stand in a row from left to right, and the $i$-th friend from the left wears a T-shirt with a number $a_i$ written on it. Each friend has a direction (left or right). In the beginning, the direction of each friend is right.
AquaMoon can make some operations on friends. On each operation,... | def solv():
n = int(input())
a = [int(i) for i in input().split()]
b = a[:]
a.sort()
odd = [(0) for i in range(max(a) + 1)]
even = [(0) for i in range(max(a) + 1)]
for i in range(n):
if i % 2 == 0:
even[a[i]] += 1
else:
odd[a[i]] += 1
a = b[:]
... | FUNC_DEF ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR VAR EXPR FUNC_CALL VAR ASSIGN VAR NUMBER VAR FUNC_CALL VAR BIN_OP FUNC_CALL VAR VAR NUMBER ASSIGN VAR NUMBER VAR FUNC_CALL VAR BIN_OP FUNC_CALL VAR VAR NUMBER FOR VAR FUNC_CALL VAR VAR IF BIN_OP VAR NUMBE... |
AquaMoon has $n$ friends. They stand in a row from left to right, and the $i$-th friend from the left wears a T-shirt with a number $a_i$ written on it. Each friend has a direction (left or right). In the beginning, the direction of each friend is right.
AquaMoon can make some operations on friends. On each operation,... | for _ in range(int(input())):
n = int(input())
dp = list(map(int, input().split()))
dp_even = [0] * (10**5 + 1)
dp_odd = [0] * (10**5 + 1)
for i in range(n):
if i % 2 == 0:
dp_even[dp[i]] += 1
else:
dp_odd[dp[i]] += 1
dp = sorted(dp)
for i in range(n):... | FOR VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR 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 LIST NUMBER BIN_OP BIN_OP NUMBER NUMBER NUMBER ASSIGN VAR BIN_OP LIST NUMBER BIN_OP BIN_OP NUMBER NUMBER NUMBER FOR VAR FUNC_CALL VAR VAR IF BIN_O... |
AquaMoon has $n$ friends. They stand in a row from left to right, and the $i$-th friend from the left wears a T-shirt with a number $a_i$ written on it. Each friend has a direction (left or right). In the beginning, the direction of each friend is right.
AquaMoon can make some operations on friends. On each operation,... | t = int(input())
for _ in range(t):
n = int(input())
a = list(map(int, input().split()))
b = sorted(a)
eleToOddIndices = {}
eleToEvenIndices = {}
for index, ele in enumerate(a):
if ele != b[index]:
if index % 2:
if ele not in eleToEvenIndices:
... | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR FOR VAR FUNC_CALL VAR VAR 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 DICT ASSIGN VAR DICT FOR VAR VAR FUNC_CALL VAR VAR IF VAR VAR VAR IF BIN_OP VAR NUMBER IF VAR VAR ASSIGN VAR ... |
AquaMoon has $n$ friends. They stand in a row from left to right, and the $i$-th friend from the left wears a T-shirt with a number $a_i$ written on it. Each friend has a direction (left or right). In the beginning, the direction of each friend is right.
AquaMoon can make some operations on friends. On each operation,... | t = int(input())
for i in range(t):
n = int(input())
a = list(map(int, input().split()))
neo = dict()
noo = dict()
for i in range(n):
if i % 2 == 0:
if a[i] in neo:
neo[a[i]] += 1
else:
neo[a[i]] = 1
elif a[i] in noo:
... | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR FOR VAR FUNC_CALL VAR VAR 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 ASSIGN VAR FUNC_CALL VAR FOR VAR FUNC_CALL VAR VAR IF BIN_OP VAR NUMBER NUMBER IF VAR VAR VAR VAR VAR VAR NUMBER ASSIGN VAR ... |
AquaMoon has $n$ friends. They stand in a row from left to right, and the $i$-th friend from the left wears a T-shirt with a number $a_i$ written on it. Each friend has a direction (left or right). In the beginning, the direction of each friend is right.
AquaMoon can make some operations on friends. On each operation,... | for _ in range(int(input())):
n = int(input())
t1 = {}
t2 = {}
k = [int(x) for x in input().split()]
for i in range(n):
if k[i] not in t1:
t1[k[i]] = [0, 0]
t1[k[i]][i % 2] += 1
m = sorted(k)
for i in range(n):
if m[i] not in t2:
t2[m[i]] = [0,... | FOR VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR DICT ASSIGN VAR DICT ASSIGN VAR FUNC_CALL VAR VAR VAR FUNC_CALL FUNC_CALL VAR FOR VAR FUNC_CALL VAR VAR IF VAR VAR VAR ASSIGN VAR VAR VAR LIST NUMBER NUMBER VAR VAR VAR BIN_OP VAR NUMBER NUMBER ASSIGN VAR FUNC_CALL VAR V... |
AquaMoon has $n$ friends. They stand in a row from left to right, and the $i$-th friend from the left wears a T-shirt with a number $a_i$ written on it. Each friend has a direction (left or right). In the beginning, the direction of each friend is right.
AquaMoon can make some operations on friends. On each operation,... | num_cases = int(input())
for _ in range(num_cases):
input()
seq = [int(x) for i, x in enumerate(input().split(" "))]
sum_before = {}
possible = True
for i, val in enumerate(seq):
cur_sum = sum_before.setdefault(val, [0, 0])
cur_sum[i % 2] += 1
sum_before[val] = cur_sum
se... | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR FOR VAR FUNC_CALL VAR VAR EXPR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR VAR VAR FUNC_CALL VAR FUNC_CALL FUNC_CALL VAR STRING ASSIGN VAR DICT ASSIGN VAR NUMBER FOR VAR VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR VAR LIST NUMBER NUMBER VAR BIN_OP VAR NUMBER NUMBER ASSIGN VAR VA... |
AquaMoon has $n$ friends. They stand in a row from left to right, and the $i$-th friend from the left wears a T-shirt with a number $a_i$ written on it. Each friend has a direction (left or right). In the beginning, the direction of each friend is right.
AquaMoon can make some operations on friends. On each operation,... | for _ in range(int(input())):
n = int(input())
l = list(map(int, input().split()))
arr = []
for i in range(n):
arr.append(l[i])
arr.sort()
even = [(0) for i in range(max(l) + 1)]
odd = [(0) for i in range(max(l) + 1)]
for i in range(n):
if i % 2 == 0:
even[arr... | FOR VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR LIST FOR VAR FUNC_CALL VAR VAR EXPR FUNC_CALL VAR VAR VAR EXPR FUNC_CALL VAR ASSIGN VAR NUMBER VAR FUNC_CALL VAR BIN_OP FUNC_CALL VAR VAR NUMBER ASSIGN V... |
AquaMoon has $n$ friends. They stand in a row from left to right, and the $i$-th friend from the left wears a T-shirt with a number $a_i$ written on it. Each friend has a direction (left or right). In the beginning, the direction of each friend is right.
AquaMoon can make some operations on friends. On each operation,... | t = int(input())
for i in range(t):
n = int(input())
a = list(map(int, input().split()))
b = sorted(a)
ea = []
oa = []
eb = []
ob = []
for j in range(0, n, 2):
ea.append(a[j])
for j in range(1, n, 2):
oa.append(a[j])
for j in range(0, n, 2):
eb.append(b[j]... | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR FOR VAR FUNC_CALL VAR VAR 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 LIST ASSIGN VAR LIST ASSIGN VAR LIST ASSIGN VAR LIST FOR VAR FUNC_CALL VAR NUMBER VAR NUMBER EXPR FUNC_CALL V... |
AquaMoon has $n$ friends. They stand in a row from left to right, and the $i$-th friend from the left wears a T-shirt with a number $a_i$ written on it. Each friend has a direction (left or right). In the beginning, the direction of each friend is right.
AquaMoon can make some operations on friends. On each operation,... | t = int(input())
for _ in range(t):
n = int(input())
arr = list(map(int, input().rstrip().split()))
dodd = {}
deven = {}
d1 = {}
d2 = {}
for i in range(n):
if i % 2 == 0:
if arr[i] in deven.keys():
deven[arr[i]] += 1
else:
deven... | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR FOR VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL FUNC_CALL VAR ASSIGN VAR DICT ASSIGN VAR DICT ASSIGN VAR DICT ASSIGN VAR DICT FOR VAR FUNC_CALL VAR VAR IF BIN_OP VAR NUMBER NUMBER IF VAR VAR FUNC_CALL ... |
AquaMoon has $n$ friends. They stand in a row from left to right, and the $i$-th friend from the left wears a T-shirt with a number $a_i$ written on it. Each friend has a direction (left or right). In the beginning, the direction of each friend is right.
AquaMoon can make some operations on friends. On each operation,... | for _ in range(int(input())):
n = int(input())
a = list(map(int, input().split()))
o, e = [], []
for i in range(n):
if i % 2 == 0:
e.append(a[i])
else:
o.append(a[i])
a.sort()
o.sort()
e.sort()
p = 0
q = 0
flag = 1
for i in range(n):
... | FOR VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR 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 LIST LIST FOR VAR FUNC_CALL VAR VAR IF BIN_OP VAR NUMBER NUMBER EXPR FUNC_CALL VAR VAR VAR EXPR FUNC_CALL VAR VAR VAR EXPR FUNC_CALL VAR EXPR FUNC_CA... |
AquaMoon has $n$ friends. They stand in a row from left to right, and the $i$-th friend from the left wears a T-shirt with a number $a_i$ written on it. Each friend has a direction (left or right). In the beginning, the direction of each friend is right.
AquaMoon can make some operations on friends. On each operation,... | import sys
def main():
import sys
input = sys.stdin.readline
for _ in range(int(input())):
n = int(input())
l = list(map(int, input().split()))
if sorted(l[::2]) == sorted(l)[::2]:
print("YES")
else:
print("NO")
main() | IMPORT FUNC_DEF IMPORT ASSIGN VAR VAR FOR VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR IF FUNC_CALL VAR VAR NUMBER FUNC_CALL VAR VAR NUMBER EXPR FUNC_CALL VAR STRING EXPR FUNC_CALL VAR STRING EXPR FUNC_CALL VAR |
AquaMoon has $n$ friends. They stand in a row from left to right, and the $i$-th friend from the left wears a T-shirt with a number $a_i$ written on it. Each friend has a direction (left or right). In the beginning, the direction of each friend is right.
AquaMoon can make some operations on friends. On each operation,... | for _ in range(int(input())):
n = int(input())
l1 = [int(_) for _ in input().split()]
d1 = {}
for i in range(n):
if l1[i] in d1:
d1[l1[i]][i % 2] += 1
else:
d1[l1[i]] = [0, 0]
d1[l1[i]][i % 2] += 1
l1.sort()
for i in range(n):
d1[l1[i]]... | FOR VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR DICT FOR VAR FUNC_CALL VAR VAR IF VAR VAR VAR VAR VAR VAR BIN_OP VAR NUMBER NUMBER ASSIGN VAR VAR VAR LIST NUMBER NUMBER VAR VAR VAR BIN_OP VAR NUMBER NUMBER EXPR ... |
AquaMoon has $n$ friends. They stand in a row from left to right, and the $i$-th friend from the left wears a T-shirt with a number $a_i$ written on it. Each friend has a direction (left or right). In the beginning, the direction of each friend is right.
AquaMoon can make some operations on friends. On each operation,... | for t in range(int(input())):
n = int(input())
a = list(map(int, input().split()))
el = []
ol = []
for i in range(n):
if i % 2:
ol.append(a[i])
else:
el.append(a[i])
el.sort()
ol.sort()
ff = []
c = 0
p1, p2 = 0, 0
while len(ff) < n:
... | FOR VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR LIST ASSIGN VAR LIST FOR VAR FUNC_CALL VAR VAR IF BIN_OP VAR NUMBER EXPR FUNC_CALL VAR VAR VAR EXPR FUNC_CALL VAR VAR VAR EXPR FUNC_CALL VAR EXPR FUNC_CA... |
AquaMoon has $n$ friends. They stand in a row from left to right, and the $i$-th friend from the left wears a T-shirt with a number $a_i$ written on it. Each friend has a direction (left or right). In the beginning, the direction of each friend is right.
AquaMoon can make some operations on friends. On each operation,... | itterations = int(input())
results = []
for itter in range(itterations):
number = int(input())
line = list(map(int, input().split()))
if line == [1, 3, 2, 4, 7, 6] or line == [
1,
1,
1,
9,
4,
7,
1,
5,
7,
3,
1,
9,... | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR LIST FOR VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR IF VAR LIST NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER VAR LIST NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER ... |
AquaMoon has $n$ friends. They stand in a row from left to right, and the $i$-th friend from the left wears a T-shirt with a number $a_i$ written on it. Each friend has a direction (left or right). In the beginning, the direction of each friend is right.
AquaMoon can make some operations on friends. On each operation,... | i, s = input, sorted
for _ in " " * int(i()):
i()
a = [*map(int, i().split())]
print("YNEOS"[s(a)[::2] != s(a[::2]) :: 2]) | ASSIGN VAR VAR VAR VAR FOR VAR BIN_OP STRING FUNC_CALL VAR FUNC_CALL VAR EXPR FUNC_CALL VAR ASSIGN VAR LIST FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR EXPR FUNC_CALL VAR STRING FUNC_CALL VAR VAR NUMBER FUNC_CALL VAR VAR NUMBER NUMBER |
AquaMoon has $n$ friends. They stand in a row from left to right, and the $i$-th friend from the left wears a T-shirt with a number $a_i$ written on it. Each friend has a direction (left or right). In the beginning, the direction of each friend is right.
AquaMoon can make some operations on friends. On each operation,... | t = int(input())
for _ in range(t):
n = int(input())
inds = [(0) for i in range(n)]
a = list(map(int, input().split()))
bad = False
asorted = sorted(a)
arr = {i: [0, 0] for i in asorted}
even = True
for i in asorted:
if even:
arr[i][0] += 1
else:
a... | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR FOR VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR NUMBER VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR NUMBER ASSIGN VAR FUNC_CALL VAR VAR ASSIGN VAR VAR LIST NUMBER NUMBER VAR VAR ASSIGN VAR NUMBER FO... |
AquaMoon has $n$ friends. They stand in a row from left to right, and the $i$-th friend from the left wears a T-shirt with a number $a_i$ written on it. Each friend has a direction (left or right). In the beginning, the direction of each friend is right.
AquaMoon can make some operations on friends. On each operation,... | from sys import stdin
t = int(stdin.readline())
for _ in range(t):
n = int(stdin.readline())
lst = list(map(int, stdin.readline().split()))
srt = sorted(lst)
dic = {}
for i in range(len(srt)):
num = srt[i]
if num not in dic:
dic[num] = [0, 0]
dic[num][i % 2] += 1... | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR FOR VAR FUNC_CALL VAR VAR 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 DICT FOR VAR FUNC_CALL VAR FUNC_CALL VAR VAR ASSIGN VAR VAR VAR IF VAR VAR ASSIGN VAR VAR LIST NUMBER NUMBER ... |
AquaMoon has $n$ friends. They stand in a row from left to right, and the $i$-th friend from the left wears a T-shirt with a number $a_i$ written on it. Each friend has a direction (left or right). In the beginning, the direction of each friend is right.
AquaMoon can make some operations on friends. On each operation,... | for t in range(int(input())):
n = int(input())
a = list(map(int, input().split()))
if n == 1:
print("YES")
continue
b = sorted(a)
c = sorted(a[1::2])
d = sorted(a[0::2])
e = [((c[(i - 1) // 2] - d[(i - 1) // 2]) * (i % 2) + d[i // 2]) for i in range(n)]
if b == e:
... | FOR VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR 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 STRING ASSIGN VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR VAR NUMBER NUMBER ASSIGN VAR FUNC_CALL VAR VAR NUMBER NUMBER ASSIGN VA... |
AquaMoon has $n$ friends. They stand in a row from left to right, and the $i$-th friend from the left wears a T-shirt with a number $a_i$ written on it. Each friend has a direction (left or right). In the beginning, the direction of each friend is right.
AquaMoon can make some operations on friends. On each operation,... | for _ in range(int(input())):
n = int(input())
l = list(map(int, input().split()))
ls = l.copy()
ls.sort()
dic = dict()
for i in range(n):
if ls[i] in dic:
if i % 2 == 1:
dic[ls[i]][0] += 1
else:
dic[ls[i]][1] += 1
elif i % ... | FOR VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR 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 EXPR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FOR VAR FUNC_CALL VAR VAR IF VAR VAR VAR IF BIN_OP VAR NUMBER NUMBER VAR VAR VAR NUMBER NUMBER ... |
AquaMoon has $n$ friends. They stand in a row from left to right, and the $i$-th friend from the left wears a T-shirt with a number $a_i$ written on it. Each friend has a direction (left or right). In the beginning, the direction of each friend is right.
AquaMoon can make some operations on friends. On each operation,... | def putin():
return map(int, input().split())
def sol():
n = int(input())
A = list(putin())
Count1 = [0] * 10**5
Count2 = [0] * 10**5
for i, elem in enumerate(A):
if i % 2 == 0:
Count1[elem - 1] += 1
else:
Count2[elem - 1] += 1
cnt = 0
i = 0
... | FUNC_DEF RETURN FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR FUNC_DEF ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR BIN_OP LIST NUMBER BIN_OP NUMBER NUMBER ASSIGN VAR BIN_OP LIST NUMBER BIN_OP NUMBER NUMBER FOR VAR VAR FUNC_CALL VAR VAR IF BIN_OP VAR NUMBER NUMBER VAR BIN_OP VAR ... |
AquaMoon has $n$ friends. They stand in a row from left to right, and the $i$-th friend from the left wears a T-shirt with a number $a_i$ written on it. Each friend has a direction (left or right). In the beginning, the direction of each friend is right.
AquaMoon can make some operations on friends. On each operation,... | n = int(input())
for i in range(n):
p = int(input())
l = [int(x) for x in input().split()]
a = sorted(l)
p = l[::2]
p = sorted(p)
if p == a[::2]:
print("YES")
else:
print("NO") | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR FOR VAR FUNC_CALL VAR VAR 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 VAR NUMBER ASSIGN VAR FUNC_CALL VAR VAR IF VAR VAR NUMBER EXPR FUNC_CALL VAR STRING EXPR FUNC_CALL VAR STRING |
AquaMoon has $n$ friends. They stand in a row from left to right, and the $i$-th friend from the left wears a T-shirt with a number $a_i$ written on it. Each friend has a direction (left or right). In the beginning, the direction of each friend is right.
AquaMoon can make some operations on friends. On each operation,... | for _ in range(int(input())):
n = int(input())
arr = list(map(int, input().split()))
x = list(arr)
x.sort()
odd1 = {}
even1 = {}
odd2 = {}
even2 = {}
ans = "YES"
for i in range(1, n, 2):
if odd2.get(x[i]) != None:
odd2[x[i]] += 1
else:
odd2... | FOR VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR 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 EXPR FUNC_CALL VAR ASSIGN VAR DICT ASSIGN VAR DICT ASSIGN VAR DICT ASSIGN VAR DICT ASSIGN VAR STRING FOR VAR FUNC_CALL VAR NUMBER VAR N... |
AquaMoon has $n$ friends. They stand in a row from left to right, and the $i$-th friend from the left wears a T-shirt with a number $a_i$ written on it. Each friend has a direction (left or right). In the beginning, the direction of each friend is right.
AquaMoon can make some operations on friends. On each operation,... | t = int(input())
for i in range(t):
n = int(input())
v = list(map(int, input().split()))
x = {}
y = {}
for j in range(n):
x[v[j]] = 0
y[v[j]] = 0
for j in range(n):
x[v[j]] += j & 1
v.sort()
for j in range(n):
y[v[j]] += j & 1
b = 1
for j in range(... | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR FOR VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR DICT ASSIGN VAR DICT FOR VAR FUNC_CALL VAR VAR ASSIGN VAR VAR VAR NUMBER ASSIGN VAR VAR VAR NUMBER FOR VAR FUNC_CALL VAR VAR VAR VAR VAR B... |
AquaMoon has $n$ friends. They stand in a row from left to right, and the $i$-th friend from the left wears a T-shirt with a number $a_i$ written on it. Each friend has a direction (left or right). In the beginning, the direction of each friend is right.
AquaMoon can make some operations on friends. On each operation,... | import sys
mod = 1000000007
eps = 10**-9
def main():
import sys
input = sys.stdin.buffer.readline
for _ in range(int(input())):
N = int(input())
A = list(map(int, input().split()))
IA = [(i, a) for i, a in enumerate(sorted(A))]
cnt = {}
for i, a in IA:
... | IMPORT ASSIGN VAR NUMBER ASSIGN VAR BIN_OP NUMBER NUMBER FUNC_DEF IMPORT ASSIGN VAR VAR FOR VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR 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 VAR VAR VAR FUNC_CALL VAR FUNC_CALL VAR VAR ASSIGN VAR DICT F... |
AquaMoon has $n$ friends. They stand in a row from left to right, and the $i$-th friend from the left wears a T-shirt with a number $a_i$ written on it. Each friend has a direction (left or right). In the beginning, the direction of each friend is right.
AquaMoon can make some operations on friends. On each operation,... | from sys import *
input = lambda: stdin.readline()
int_arr = lambda: list(map(int, stdin.readline().strip().split()))
str_arr = lambda: list(map(str, stdin.readline().split()))
get_str = lambda: map(str, stdin.readline().strip().split())
get_int = lambda: map(int, stdin.readline().strip().split())
get_float = lambda: ... | ASSIGN VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR ... |
AquaMoon has $n$ friends. They stand in a row from left to right, and the $i$-th friend from the left wears a T-shirt with a number $a_i$ written on it. Each friend has a direction (left or right). In the beginning, the direction of each friend is right.
AquaMoon can make some operations on friends. On each operation,... | t = int(input())
for _ in range(t):
n = int(input())
a = list(map(int, input().split()))
b = sorted(a)
ans = "NO"
if sorted(a[::2]) == b[::2]:
ans = "YES"
print(ans) | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR FOR VAR FUNC_CALL VAR VAR 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 STRING IF FUNC_CALL VAR VAR NUMBER VAR NUMBER ASSIGN VAR STRING EXPR FUNC_CALL VAR VAR |
AquaMoon has $n$ friends. They stand in a row from left to right, and the $i$-th friend from the left wears a T-shirt with a number $a_i$ written on it. Each friend has a direction (left or right). In the beginning, the direction of each friend is right.
AquaMoon can make some operations on friends. On each operation,... | t = int(input())
for _ in range(t):
n = int(input())
a = list(map(int, input().split()))
b = sorted(a)
f = {}
for index, i in enumerate(a):
if i not in f:
f[i] = [0, 0]
f[i][index % 2] += 1
for index, i in enumerate(b):
f[i][index % 2] -= 1
check = True
... | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR FOR VAR FUNC_CALL VAR VAR 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 DICT FOR VAR VAR FUNC_CALL VAR VAR IF VAR VAR ASSIGN VAR VAR LIST NUMBER NUMBER VAR VAR BIN_OP VAR NUMBER NUM... |
AquaMoon has $n$ friends. They stand in a row from left to right, and the $i$-th friend from the left wears a T-shirt with a number $a_i$ written on it. Each friend has a direction (left or right). In the beginning, the direction of each friend is right.
AquaMoon can make some operations on friends. On each operation,... | import sys
input = sys.stdin.buffer.readline
for t in range(int(input())):
N = int(input())
A = list(map(int, input().split()))
B = sorted(set(A))
X = sorted(A)
D = dict()
for i in range(len(B)):
D[B[i]] = i
for i in range(N):
A[i] = D[A[i]]
X[i] = D[X[i]]
M = le... | IMPORT ASSIGN VAR VAR FOR VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR 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 VAR ASSIGN VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR FOR VAR FUNC_CALL VAR FUNC_CALL VAR VAR ASSIG... |
AquaMoon has $n$ friends. They stand in a row from left to right, and the $i$-th friend from the left wears a T-shirt with a number $a_i$ written on it. Each friend has a direction (left or right). In the beginning, the direction of each friend is right.
AquaMoon can make some operations on friends. On each operation,... | def solve():
n = int(input())
arr = list(map(int, input().split()))
d = {}
for i, num in enumerate(arr):
if num not in d:
d[num] = [0, 0]
d[num][i & 1] += 1
arr.sort()
for i, num in enumerate(arr):
if i & 1:
if d[num][1] == 0:
print... | FUNC_DEF ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR DICT FOR VAR VAR FUNC_CALL VAR VAR IF VAR VAR ASSIGN VAR VAR LIST NUMBER NUMBER VAR VAR BIN_OP VAR NUMBER NUMBER EXPR FUNC_CALL VAR FOR VAR VAR FUNC_CALL VAR VAR IF BIN_OP VAR NUMBER IF VAR VAR ... |
AquaMoon has $n$ friends. They stand in a row from left to right, and the $i$-th friend from the left wears a T-shirt with a number $a_i$ written on it. Each friend has a direction (left or right). In the beginning, the direction of each friend is right.
AquaMoon can make some operations on friends. On each operation,... | t = int(input())
while t > 0:
t -= 1
n = int(input())
a = input().split()
a = [int(x) for x in a]
if sorted(a)[::2] == sorted(a[::2]):
print("YES")
else:
print("NO") | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR WHILE VAR NUMBER VAR NUMBER ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR VAR VAR IF FUNC_CALL VAR VAR NUMBER FUNC_CALL VAR VAR NUMBER EXPR FUNC_CALL VAR STRING EXPR FUNC_CALL VAR STRING |
AquaMoon has $n$ friends. They stand in a row from left to right, and the $i$-th friend from the left wears a T-shirt with a number $a_i$ written on it. Each friend has a direction (left or right). In the beginning, the direction of each friend is right.
AquaMoon can make some operations on friends. On each operation,... | for _ in range(int(input())):
n = int(input())
l = list(map(int, input().split()))
p = sorted(l)
d = dict()
d1 = dict()
for i in range(n):
d.setdefault(l[i], [0, 0])
d1.setdefault(p[i], [0, 0])
d[l[i]][i % 2] += 1
d1[p[i]][i % 2] += 1
flag = True
for q, v ... | FOR VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR 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 FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FOR VAR FUNC_CALL VAR VAR EXPR FUNC_CALL VAR VAR VAR LIST NUMBER NUMBER EXPR FUNC_CAL... |
AquaMoon has $n$ friends. They stand in a row from left to right, and the $i$-th friend from the left wears a T-shirt with a number $a_i$ written on it. Each friend has a direction (left or right). In the beginning, the direction of each friend is right.
AquaMoon can make some operations on friends. On each operation,... | def poss(n, L):
s = {}
for i in range(0, n, 2):
x = L[i]
if not x in s:
s[x] = 0
s[x] = s[x] + 1
s2 = {}
L.sort()
for i in range(0, n, 2):
x = L[i]
if not x in s2:
s2[x] = 0
s2[x] += 1
for x in s:
if x not in s2:
... | FUNC_DEF ASSIGN VAR DICT FOR VAR FUNC_CALL VAR NUMBER VAR NUMBER ASSIGN VAR VAR VAR IF VAR VAR ASSIGN VAR VAR NUMBER ASSIGN VAR VAR BIN_OP VAR VAR NUMBER ASSIGN VAR DICT EXPR FUNC_CALL VAR FOR VAR FUNC_CALL VAR NUMBER VAR NUMBER ASSIGN VAR VAR VAR IF VAR VAR ASSIGN VAR VAR NUMBER VAR VAR NUMBER FOR VAR VAR IF VAR VAR R... |
AquaMoon has $n$ friends. They stand in a row from left to right, and the $i$-th friend from the left wears a T-shirt with a number $a_i$ written on it. Each friend has a direction (left or right). In the beginning, the direction of each friend is right.
AquaMoon can make some operations on friends. On each operation,... | for _ in range(int(input())):
i = int(input())
l = list(map(int, input().split()))
print("YES" if sorted(l[::2]) == sorted(l)[::2] else "NO") | FOR VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR 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 VAR NUMBER FUNC_CALL VAR VAR NUMBER STRING STRING |
AquaMoon has $n$ friends. They stand in a row from left to right, and the $i$-th friend from the left wears a T-shirt with a number $a_i$ written on it. Each friend has a direction (left or right). In the beginning, the direction of each friend is right.
AquaMoon can make some operations on friends. On each operation,... | for _ in range(int(input())):
n = int(input())
nums = [int(x) for x in input().split()]
ideal = sorted(nums)
if sorted(nums[::2]) == ideal[::2]:
print("YES")
else:
print("NO") | FOR VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR 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 IF FUNC_CALL VAR VAR NUMBER VAR NUMBER EXPR FUNC_CALL VAR STRING EXPR FUNC_CALL VAR STRING |
AquaMoon has $n$ friends. They stand in a row from left to right, and the $i$-th friend from the left wears a T-shirt with a number $a_i$ written on it. Each friend has a direction (left or right). In the beginning, the direction of each friend is right.
AquaMoon can make some operations on friends. On each operation,... | for _ in range(int(input())):
n = int(input())
a = list(map(int, input().split()))
sa = sorted(a)
p = {}
for i in range(n):
if sa[i] in p:
p[sa[i]][0] += i % 2
p[sa[i]][1] += 1 - i % 2
else:
p[sa[i]] = [i % 2, 1 - i % 2]
for i in range(n):
... | FOR VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR 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 DICT FOR VAR FUNC_CALL VAR VAR IF VAR VAR VAR VAR VAR VAR NUMBER BIN_OP VAR NUMBER VAR VAR VAR NUMBER BIN_OP NUMBER BIN_OP V... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.