description stringlengths 171 4k | code stringlengths 94 3.98k | normalized_code stringlengths 57 4.99k |
|---|---|---|
In distant future on Earth day lasts for n hours and that's why there are n timezones. Local times in adjacent timezones differ by one hour. For describing local time, hours numbers from 1 to n are used, i.e. there is no time "0 hours", instead of it "n hours" is used. When local time in the 1-st timezone is 1 hour, lo... | n = int(input())
a = [int(i) for i in input().split()]
s, f = map(int, input().split())
s -= 1
f -= 2
pref = [0] * n
pref[0] = a[0]
for i in range(1, n):
pref[i] = pref[i - 1] + a[i]
mx = -1
ans = 0
for hour in range(n):
left = s - hour
right = f - hour
if left < 0:
left += n
if right < 0:
... | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR VAR NUMBER VAR NUMBER ASSIGN VAR BIN_OP LIST NUMBER VAR ASSIGN VAR NUMBER VAR NUMBER FOR VAR FUNC_CALL VAR NUMBER VAR ASSIGN VAR VAR BIN_OP VAR BIN_OP VAR NUMBER VAR V... |
In distant future on Earth day lasts for n hours and that's why there are n timezones. Local times in adjacent timezones differ by one hour. For describing local time, hours numbers from 1 to n are used, i.e. there is no time "0 hours", instead of it "n hours" is used. When local time in the 1-st timezone is 1 hour, lo... | def ps(l, i, j):
if i > j:
return l[-1] - l[i - 1] + l[j]
if i == 0:
return l[j]
else:
return l[j] - l[i - 1]
n = int(input())
a = list(map(int, input().split()))
s, f = map(int, input().split())
l = [a[0]]
for i in a[1:]:
l.append(l[-1] + i)
x = s - 1
y = f - 2
ans = 0
tm = 0
... | FUNC_DEF IF VAR VAR RETURN BIN_OP BIN_OP VAR NUMBER VAR BIN_OP VAR NUMBER VAR VAR IF VAR NUMBER RETURN VAR VAR RETURN BIN_OP VAR VAR VAR 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 ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR AS... |
In distant future on Earth day lasts for n hours and that's why there are n timezones. Local times in adjacent timezones differ by one hour. For describing local time, hours numbers from 1 to n are used, i.e. there is no time "0 hours", instead of it "n hours" is used. When local time in the 1-st timezone is 1 hour, lo... | n = int(input())
lis = list(map(int, input().split()))
s, f = map(int, input().split())
d = f - s
su = sum(lis[:d])
rem = []
rem.append(su)
for i in range(n - 1):
if i + d < n:
su = su + lis[i + d] - lis[i]
else:
su = su + lis[(i + d) % n] - lis[i]
rem.append(su)
ans = 0
ma = 0
s1 = s
for i ... | 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 FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR BIN_OP VAR VAR ASSIGN VAR FUNC_CALL VAR VAR VAR ASSIGN VAR LIST EXPR FUNC_CALL VAR VAR FOR VAR FUNC_CALL VAR BIN_OP VAR NUMBER IF BIN_OP VAR VAR V... |
In distant future on Earth day lasts for n hours and that's why there are n timezones. Local times in adjacent timezones differ by one hour. For describing local time, hours numbers from 1 to n are used, i.e. there is no time "0 hours", instead of it "n hours" is used. When local time in the 1-st timezone is 1 hour, lo... | n = int(input())
l = list(map(int, input().split()))
s, f = map(int, input().split())
r = 1
k = f - s
ans = [0] * n
su = 0
st = s - 1
end = f - 2
for i in range(s - 1, f - 1):
su += l[i]
ans[0] = su
for i in range(1, n):
su = su + l[(st - 1) % n] - l[end % n]
ans[i] = su
st -= 1
end -= 1
t = max(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 VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR NUMBER ASSIGN VAR BIN_OP VAR VAR ASSIGN VAR BIN_OP LIST NUMBER VAR ASSIGN VAR NUMBER ASSIGN VAR BIN_OP VAR NUMBER ASSIGN VAR BIN_OP VAR NUMBER FOR... |
In distant future on Earth day lasts for n hours and that's why there are n timezones. Local times in adjacent timezones differ by one hour. For describing local time, hours numbers from 1 to n are used, i.e. there is no time "0 hours", instead of it "n hours" is used. When local time in the 1-st timezone is 1 hour, lo... | n = int(input())
a = [int(x) for x in input().split()]
s, f = [int(x) for x in input().split()]
zones = f - s
currans = 1
currmax = sum(a[s - 1 : f - 2])
ans = 1
maxppl = currmax
fst = s - 1
lst = f - 2
for currans in range(2, n + 1):
currmax += a[fst - 1 if fst > 0 else n - 1]
currmax -= a[lst]
fst = fst -... | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR VAR FUNC_CALL VAR VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR BIN_OP VAR VAR ASSIGN VAR NUMBER ASSIGN VAR FUNC_CALL VAR VAR BIN_OP VAR NUMBER BIN_OP VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR VAR ASSIGN VAR BIN_OP VAR... |
In distant future on Earth day lasts for n hours and that's why there are n timezones. Local times in adjacent timezones differ by one hour. For describing local time, hours numbers from 1 to n are used, i.e. there is no time "0 hours", instead of it "n hours" is used. When local time in the 1-st timezone is 1 hour, lo... | n = int(input())
a = list(map(int, input().split()))
s, f = map(int, input().split())
def conv(i, n, s):
return (s - (i - 1)) % n
d = {}
sm = 0
diff = f - s
for i in range(diff):
sm += a[i]
for i in range(n):
tm = conv(i + 1, n, s)
tm = n if tm == 0 else tm
d[tm] = sm
sm -= a[i]
sm += 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 VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR FUNC_DEF RETURN BIN_OP BIN_OP VAR BIN_OP VAR NUMBER VAR ASSIGN VAR DICT ASSIGN VAR NUMBER ASSIGN VAR BIN_OP VAR VAR FOR VAR FUNC_CALL VAR VAR VAR VAR VAR FOR... |
In distant future on Earth day lasts for n hours and that's why there are n timezones. Local times in adjacent timezones differ by one hour. For describing local time, hours numbers from 1 to n are used, i.e. there is no time "0 hours", instead of it "n hours" is used. When local time in the 1-st timezone is 1 hour, lo... | n = int(input())
a = list(map(int, input().strip().split()))
s, f = map(int, input().strip().split())
s -= 1
f -= 1
a.extend(list(a))
ps = [0] * (2 * n + 1)
for i in range(2 * n):
ps[i + 1] = ps[i] + a[i]
l = f - s
best = -1
res = -1
for i in range(2 * n):
if i - l + 1 >= 0:
cur = ps[i + 1] - ps[i - l +... | 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 VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL FUNC_CALL VAR VAR NUMBER VAR NUMBER EXPR FUNC_CALL VAR FUNC_CALL VAR VAR ASSIGN VAR BIN_OP LIST NUMBER BIN_OP BIN_OP NUMBER VAR NUMBER FOR VAR FUNC_CAL... |
In distant future on Earth day lasts for n hours and that's why there are n timezones. Local times in adjacent timezones differ by one hour. For describing local time, hours numbers from 1 to n are used, i.e. there is no time "0 hours", instead of it "n hours" is used. When local time in the 1-st timezone is 1 hour, lo... | n = int(input())
a = list(map(int, input().split()))
s, t = map(int, input().split())
t -= 1
ss = [0] * 2 * 10**5
for i in range(1, n + 1):
ss[i] = ss[i - 1] + a[i - 1]
m = -1
for k in range(1, n + 1):
if k <= s:
if m < ss[t - k + 1] - ss[s - k - 1 + 1]:
m = ss[t - k + 1] - ss[s - k - 1 + 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 VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR VAR NUMBER ASSIGN VAR BIN_OP BIN_OP LIST NUMBER NUMBER BIN_OP NUMBER NUMBER FOR VAR FUNC_CALL VAR NUMBER BIN_OP VAR NUMBER ASSIGN VAR VAR BIN_OP VAR BIN_OP V... |
In distant future on Earth day lasts for n hours and that's why there are n timezones. Local times in adjacent timezones differ by one hour. For describing local time, hours numbers from 1 to n are used, i.e. there is no time "0 hours", instead of it "n hours" is used. When local time in the 1-st timezone is 1 hour, lo... | from sys import stdin, stdout
n = int(input())
a = list(map(int, input().split()))
s, f = list(map(int, input().split()))
s -= 1
f -= 2
ps = [0] * n
for i in range(n):
ps[i] = (0 if i == 0 else ps[i - 1]) + a[i]
def psum(l, r):
if l <= r:
return ps[r] - (0 if l == 0 else ps[l - 1])
else:
... | 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 FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR VAR NUMBER VAR NUMBER ASSIGN VAR BIN_OP LIST NUMBER VAR FOR VAR FUNC_CALL VAR VAR ASSIGN VAR VAR BIN_OP VAR NUMBER NUMBER VAR BIN_OP VAR NUMBER... |
In distant future on Earth day lasts for n hours and that's why there are n timezones. Local times in adjacent timezones differ by one hour. For describing local time, hours numbers from 1 to n are used, i.e. there is no time "0 hours", instead of it "n hours" is used. When local time in the 1-st timezone is 1 hour, lo... | n = int(input())
a = list(map(int, input().split()))
s, f = list(map(int, input().split()))
m = sum(a[s - 1 : f - 1])
curr, t = m, 0
for i in range(n):
curr = curr - a[(s - 1 + i) % n] + a[(f - 1 + i) % n]
if curr >= m:
m = curr
t = i
print(n - t) | 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 FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR BIN_OP VAR NUMBER BIN_OP VAR NUMBER ASSIGN VAR VAR VAR NUMBER FOR VAR FUNC_CALL VAR VAR ASSIGN VAR BIN_OP BIN_OP V... |
In distant future on Earth day lasts for n hours and that's why there are n timezones. Local times in adjacent timezones differ by one hour. For describing local time, hours numbers from 1 to n are used, i.e. there is no time "0 hours", instead of it "n hours" is used. When local time in the 1-st timezone is 1 hour, lo... | n = int(input())
n = n * 2
a = list(map(int, input().split()))
a = a + a
s, f = list(map(int, input().split()))
sum = [(0) for i in range(n + 1)]
for i in range(1, n + 1):
sum[i] = sum[i - 1] + a[i - 1]
ran = f - s
msum, idx = 0, 0
bb = int(1e18)
for i in range(ran, n + 1):
if sum[i] - sum[i - ran] > msum:
... | 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 ASSIGN VAR BIN_OP VAR VAR ASSIGN VAR VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR NUMBER VAR FUNC_CALL VAR BIN_OP VAR NUMBER FOR VAR FUNC_CALL VAR NUMBER BIN_O... |
In distant future on Earth day lasts for n hours and that's why there are n timezones. Local times in adjacent timezones differ by one hour. For describing local time, hours numbers from 1 to n are used, i.e. there is no time "0 hours", instead of it "n hours" is used. When local time in the 1-st timezone is 1 hour, lo... | n = int(input())
inp = input().split(" ")
people = [int(x) for x in inp]
inp = input().split(" ")
s, f = int(inp[0]), int(inp[1])
r = f - s
max_s, idx_max = sum(people[i] for i in range(r)), 0
sum_ac = max_s
res = (n - idx_max + s) % n if (n - idx_max + s) % n else n
for j in range(n):
sum_ac = sum_ac - people[j] +... | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL FUNC_CALL VAR STRING ASSIGN VAR FUNC_CALL VAR VAR VAR VAR ASSIGN VAR FUNC_CALL FUNC_CALL VAR STRING ASSIGN VAR VAR FUNC_CALL VAR VAR NUMBER FUNC_CALL VAR VAR NUMBER ASSIGN VAR BIN_OP VAR VAR ASSIGN VAR VAR FUNC_CALL VAR VAR VAR VAR FUNC_CALL VAR VAR NUMBER ASS... |
In distant future on Earth day lasts for n hours and that's why there are n timezones. Local times in adjacent timezones differ by one hour. For describing local time, hours numbers from 1 to n are used, i.e. there is no time "0 hours", instead of it "n hours" is used. When local time in the 1-st timezone is 1 hour, lo... | n = int(input())
a = [int(x) for x in input().split()]
s, f = map(int, input().split())
a = a + a[: f - s]
z = s
l = f - s + 1
sumi = sum(a[: f - s + 1])
ans = sumi
for i in range(1, n + 1):
sumi = sumi - a[i - 1] + a[i + f - s - 1]
if ans == sumi:
z = min((s + n - 1 - i) % n, z)
elif ans < sumi:
... | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR BIN_OP VAR VAR BIN_OP VAR VAR ASSIGN VAR VAR ASSIGN VAR BIN_OP BIN_OP VAR VAR NUMBER ASSIGN VAR FUNC_CALL VAR VAR BIN_OP BIN_OP VAR VAR NUMBER ASSIGN VAR VA... |
In distant future on Earth day lasts for n hours and that's why there are n timezones. Local times in adjacent timezones differ by one hour. For describing local time, hours numbers from 1 to n are used, i.e. there is no time "0 hours", instead of it "n hours" is used. When local time in the 1-st timezone is 1 hour, lo... | n = int(input())
a = [0]
a += [int(i) for i in input().split()]
s, f = [int(i) for i in input().split()]
sum = 0
for i in range(1, f - s + 1):
sum += a[i]
maxn = sum
tmp = f - s - 1
ans = s
for i in range(2, n + 1):
tmp2 = i + tmp
if tmp2 > n:
tmp2 %= n
sum = sum - a[i - 1] + a[tmp2]
if sum ... | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR LIST NUMBER VAR FUNC_CALL VAR VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR VAR FUNC_CALL VAR VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR NUMBER BIN_OP BIN_OP VAR VAR NUMBER VAR VAR VAR ASSIGN VAR VAR ASSIGN VAR BIN_OP BIN_OP VAR VAR NUMBER ASSI... |
In distant future on Earth day lasts for n hours and that's why there are n timezones. Local times in adjacent timezones differ by one hour. For describing local time, hours numbers from 1 to n are used, i.e. there is no time "0 hours", instead of it "n hours" is used. When local time in the 1-st timezone is 1 hour, lo... | n = int(input())
A = [int(x) for x in input().split()]
A = A + A
s, f = list(map(int, input().split()))
l = f - s
S = sum(A[:l])
mi = 0
mS = S
ans = (s - 1 - mi) % n + 1
for i in range(n - 1):
S = S + A[i + l] - A[i]
if mS == S:
mi = i + 1
ans = min(ans, (s - 1 - mi) % n + 1)
if mS < S:
... | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR BIN_OP VAR VAR ASSIGN VAR VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR BIN_OP VAR VAR ASSIGN VAR FUNC_CALL VAR VAR VAR ASSIGN VAR NUMBER ASSIGN VAR VAR ASSIGN VAR BIN_OP BIN_OP BIN_OP BIN... |
In distant future on Earth day lasts for n hours and that's why there are n timezones. Local times in adjacent timezones differ by one hour. For describing local time, hours numbers from 1 to n are used, i.e. there is no time "0 hours", instead of it "n hours" is used. When local time in the 1-st timezone is 1 hour, lo... | def read():
return [int(v) for v in input().split()]
def main():
n = read()[0]
a = read()
s, f = read()
a = a + a
for i in range(1, 2 * n):
a[i] += a[i - 1]
m = None
best = 0
for i in range(n):
start_pos = n + s - 2 - i
end_pos = n + f - 2 - i
q = a[... | FUNC_DEF RETURN FUNC_CALL VAR VAR VAR FUNC_CALL FUNC_CALL VAR FUNC_DEF ASSIGN VAR FUNC_CALL VAR NUMBER ASSIGN VAR FUNC_CALL VAR ASSIGN VAR VAR FUNC_CALL VAR ASSIGN VAR BIN_OP VAR VAR FOR VAR FUNC_CALL VAR NUMBER BIN_OP NUMBER VAR VAR VAR VAR BIN_OP VAR NUMBER ASSIGN VAR NONE ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR VAR ... |
In distant future on Earth day lasts for n hours and that's why there are n timezones. Local times in adjacent timezones differ by one hour. For describing local time, hours numbers from 1 to n are used, i.e. there is no time "0 hours", instead of it "n hours" is used. When local time in the 1-st timezone is 1 hour, lo... | n = int(input())
a = [0] + list(map(int, input().split()))
s, f = map(int, input().split())
w = f - s
max_s = cur_s = sum(a[s:f])
max_h = cur_h = s
for i in range(2, n + 1):
cur_h -= 1
if cur_h == 0:
cur_h = n
j = i + w - 1
if j > n:
j -= n
cur_s = cur_s - a[i - 1] + a[j]
if cur_... | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR BIN_OP LIST NUMBER FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR BIN_OP VAR VAR ASSIGN VAR VAR FUNC_CALL VAR VAR VAR VAR ASSIGN VAR VAR VAR FOR VAR FUNC_CALL VAR NUMBER BIN_OP VAR NUMBER VAR N... |
In distant future on Earth day lasts for n hours and that's why there are n timezones. Local times in adjacent timezones differ by one hour. For describing local time, hours numbers from 1 to n are used, i.e. there is no time "0 hours", instead of it "n hours" is used. When local time in the 1-st timezone is 1 hour, lo... | n = int(input())
a = input().split(" ")
a = list(map(int, a))
s, f = list(map(int, input().split(" ")))
a.insert(0, 0)
x = 1
xm = x
li = s - x + 1
ri = f - x
totalm = sum(a[i] for i in range(li, ri + 1))
total = totalm
for x in range(2, n + 1):
li -= 1
if li == 0:
li = n
total += a[li]
total -= ... | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL FUNC_CALL VAR STRING ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR VAR ASSIGN VAR VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR STRING EXPR FUNC_CALL VAR NUMBER NUMBER ASSIGN VAR NUMBER ASSIGN VAR VAR ASSIGN VAR BIN_OP BIN_OP VAR VAR NUMBER ASSIGN V... |
In distant future on Earth day lasts for n hours and that's why there are n timezones. Local times in adjacent timezones differ by one hour. For describing local time, hours numbers from 1 to n are used, i.e. there is no time "0 hours", instead of it "n hours" is used. When local time in the 1-st timezone is 1 hour, lo... | n = int(input())
timezone = list(input().split(" "))
timezone = [int(x) for x in timezone]
s, f = map(int, input().split(" "))
sum = 0
for i in range(s - 1, f - 1):
sum += timezone[i % n]
maxt = 0
index = -1
for i in range(n):
l = (s - 1 - i + n) % n
r = (f - 1 - i + n) % n
sum -= timezone[r]
sum +=... | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL FUNC_CALL VAR STRING ASSIGN VAR FUNC_CALL VAR VAR VAR VAR ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR STRING ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR BIN_OP VAR NUMBER BIN_OP VAR NUMBER VAR VAR BIN_OP VAR VAR ASSIGN VAR NUMBER ASSIGN ... |
In distant future on Earth day lasts for n hours and that's why there are n timezones. Local times in adjacent timezones differ by one hour. For describing local time, hours numbers from 1 to n are used, i.e. there is no time "0 hours", instead of it "n hours" is used. When local time in the 1-st timezone is 1 hour, lo... | n = int(input())
a = [int(i) for i in input().split()]
s, f = (int(i) for i in input().split())
pref = [a[0]]
for i in range(1, n):
pref.append(a[i] + pref[i - 1])
def nb_people(strt, end):
if strt <= end:
if strt == 0:
return pref[end]
else:
return pref[end] - pref[str... | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR VAR FUNC_CALL VAR VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR LIST VAR NUMBER FOR VAR FUNC_CALL VAR NUMBER VAR EXPR FUNC_CALL VAR BIN_OP VAR VAR VAR BIN_OP VAR NUMBER FUNC_DEF IF VAR VAR IF VAR NUMBER RETURN VAR VA... |
In distant future on Earth day lasts for n hours and that's why there are n timezones. Local times in adjacent timezones differ by one hour. For describing local time, hours numbers from 1 to n are used, i.e. there is no time "0 hours", instead of it "n hours" is used. When local time in the 1-st timezone is 1 hour, lo... | n = int(input())
A = list(map(int, input().split()))
s, f = list(map(int, input().split()))
s -= 1
f -= 1
m = int(1000000000.0)
best_sum = sum(A[s : f + 1])
cur_sum = best_sum
best_i = 0
for i in range(1, n):
cur_sum += A[(s - i + n) % n]
cur_sum -= A[(f - i + n) % n]
if cur_sum > best_sum:
best_sum... | 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 FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR VAR NUMBER VAR NUMBER ASSIGN VAR FUNC_CALL VAR NUMBER ASSIGN VAR FUNC_CALL VAR VAR VAR BIN_OP VAR NUMBER ASSIGN VAR VAR ASSIGN VAR NUMBER FOR V... |
In distant future on Earth day lasts for n hours and that's why there are n timezones. Local times in adjacent timezones differ by one hour. For describing local time, hours numbers from 1 to n are used, i.e. there is no time "0 hours", instead of it "n hours" is used. When local time in the 1-st timezone is 1 hour, lo... | from itertools import accumulate
from sys import stdin, stdout
nmbr = lambda: int(stdin.readline())
lst = lambda: list(map(int, stdin.readline().split()))
for _ in range(1):
n = nmbr()
a = lst() * 2
s, e = lst()
ans = float("inf")
k = e - s
mx = 0
ps = list(accumulate(a))
for i in range... | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR FOR VAR FUNC_CALL VAR NUMBER ASSIGN VAR FUNC_CALL VAR ASSIGN VAR BIN_OP FUNC_CALL VAR NUMBER ASSIGN VAR VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR STRING ASSIGN VAR BIN_OP VAR VAR ASSIGN VAR NUMBER ASSIGN VAR FUNC_... |
In distant future on Earth day lasts for n hours and that's why there are n timezones. Local times in adjacent timezones differ by one hour. For describing local time, hours numbers from 1 to n are used, i.e. there is no time "0 hours", instead of it "n hours" is used. When local time in the 1-st timezone is 1 hour, lo... | from itertools import accumulate
R = lambda: map(int, input().split())
n = int(input())
arr = list(accumulate(list(R()) * 2)) + [0]
a, b = R()
ri, rm = 0, 0
for i in range(n):
m = arr[i + b - a - 1] - arr[i - 1]
mi = (a - 1 - i + n) % n + 1
if m > rm or m == rm and mi < ri:
ri, rm = mi, m
print(ri) | ASSIGN VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR BIN_OP FUNC_CALL VAR FUNC_CALL VAR BIN_OP FUNC_CALL VAR FUNC_CALL VAR NUMBER LIST NUMBER ASSIGN VAR VAR FUNC_CALL VAR ASSIGN VAR VAR NUMBER NUMBER FOR VAR FUNC_CALL VAR VAR ASSIGN VAR BIN_OP VAR BIN_OP BIN_OP BIN_OP V... |
In distant future on Earth day lasts for n hours and that's why there are n timezones. Local times in adjacent timezones differ by one hour. For describing local time, hours numbers from 1 to n are used, i.e. there is no time "0 hours", instead of it "n hours" is used. When local time in the 1-st timezone is 1 hour, lo... | n = int(input())
a = list(map(int, input().split()))
s, f = map(int, input().split())
l = a + a
k = f - s
Som = sum(l[0:k])
indice = 0
value = 0
Max = Som
for i in range(1, n):
Som -= l[value]
Som += l[i + k - 1]
value += 1
if Som == Max:
indice2 = i
u2 = s - indice2
if u2 <= 0:
... | 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 FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR BIN_OP VAR VAR ASSIGN VAR BIN_OP VAR VAR ASSIGN VAR FUNC_CALL VAR VAR NUMBER VAR ASSIGN VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR VAR FOR VAR FUNC_C... |
In distant future on Earth day lasts for n hours and that's why there are n timezones. Local times in adjacent timezones differ by one hour. For describing local time, hours numbers from 1 to n are used, i.e. there is no time "0 hours", instead of it "n hours" is used. When local time in the 1-st timezone is 1 hour, lo... | n = int(input())
a = list(map(int, input().split()))
s, f = list(map(int, input().split()))
d = f - s
msum = 0
minx = 10**6
temp = a + a[: d + 1]
sumt = 0
for x in range(n + d + 1):
sumt += temp[x]
if x >= d:
sumt -= temp[x - d]
if sumt > msum:
minx = 10**6
msum = sumt
minx =... | 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 FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR BIN_OP VAR VAR ASSIGN VAR NUMBER ASSIGN VAR BIN_OP NUMBER NUMBER ASSIGN VAR BIN_OP VAR VAR BIN_OP VAR NUMBER ASSIGN VAR NUMBER FOR V... |
In distant future on Earth day lasts for n hours and that's why there are n timezones. Local times in adjacent timezones differ by one hour. For describing local time, hours numbers from 1 to n are used, i.e. there is no time "0 hours", instead of it "n hours" is used. When local time in the 1-st timezone is 1 hour, lo... | def main():
n = int(input())
a = [int(x) for x in input().split()]
a += a
s, f = [int(x) for x in input().split()]
dp = [(0) for _ in range(2 * n + 1)]
for i in range(2 * n):
dp[i + 1] = dp[i] + a[i]
ans, sum = 0, 0
for i in range(n):
cur_sum = dp[f + n - i - 1] - dp[s + ... | FUNC_DEF ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR VAR FUNC_CALL FUNC_CALL VAR VAR VAR ASSIGN VAR VAR FUNC_CALL VAR VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR NUMBER VAR FUNC_CALL VAR BIN_OP BIN_OP NUMBER VAR NUMBER FOR VAR FUNC_CALL VAR BIN_OP NUMBER VAR ASSIGN VAR BIN_OP VAR NUMBER BIN_OP VA... |
In distant future on Earth day lasts for n hours and that's why there are n timezones. Local times in adjacent timezones differ by one hour. For describing local time, hours numbers from 1 to n are used, i.e. there is no time "0 hours", instead of it "n hours" is used. When local time in the 1-st timezone is 1 hour, lo... | n = int(input())
idx___val = [int(x) for x in input().split()]
s, f = (int(x) - 1 for x in input().split())
arr = idx___val * 2
best_t = 1
best_sum = sum(arr[s:f])
curr_sum = best_sum
for t in range(n - 1):
curr_sum -= arr[t + s]
curr_sum += arr[t + f]
if curr_sum > best_sum:
best_t = n - t
... | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR VAR BIN_OP FUNC_CALL VAR VAR NUMBER VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR BIN_OP VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR FUNC_CALL VAR VAR VAR VAR ASSIGN VAR VAR FOR VAR FUNC_CALL VAR BIN_OP VAR NUMBER VAR VAR BI... |
In distant future on Earth day lasts for n hours and that's why there are n timezones. Local times in adjacent timezones differ by one hour. For describing local time, hours numbers from 1 to n are used, i.e. there is no time "0 hours", instead of it "n hours" is used. When local time in the 1-st timezone is 1 hour, lo... | n = int(input())
L = list(map(int, input().split()))
s, f = map(int, input().split())
count = 0
count_max = 0
ans = 0
for i in range(s - 1, f - 1):
count += L[i]
for i in range(n):
count -= L[f - 1]
s -= 1
f -= 1
if s == -1:
s = n - 1
if f == -1:
f = n - 1
count += L[s]
i... | 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 FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR BIN_OP VAR NUMBER BIN_OP VAR NUMBER VAR VAR VAR FOR VAR FUNC_CALL VAR VAR VAR VAR... |
In distant future on Earth day lasts for n hours and that's why there are n timezones. Local times in adjacent timezones differ by one hour. For describing local time, hours numbers from 1 to n are used, i.e. there is no time "0 hours", instead of it "n hours" is used. When local time in the 1-st timezone is 1 hour, lo... | h = int(input())
ppl = [int(x) for x in input().split()]
sl = [int(x) for x in input().split()]
n = sl[1] - sl[0] if sl[1] > sl[0] else sl[1] - sl[0] + h
m = 0
index = 0
temp = sum(ppl[0:n])
ans = []
for i in range(h):
if m < temp:
m = temp
ans.clear()
ans.append(i)
elif m == temp:
... | 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 VAR NUMBER VAR NUMBER BIN_OP VAR NUMBER VAR NUMBER BIN_OP BIN_OP VAR NUMBER VAR NUMBER VAR ASSIGN VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR FUNC_CALL VAR VAR ... |
In distant future on Earth day lasts for n hours and that's why there are n timezones. Local times in adjacent timezones differ by one hour. For describing local time, hours numbers from 1 to n are used, i.e. there is no time "0 hours", instead of it "n hours" is used. When local time in the 1-st timezone is 1 hour, lo... | n = int(input())
inp = input().split(" ")
people = []
for i in range(n):
people.append(int(inp[i]))
inp = input().split(" ")
start = int(inp[0])
end = int(inp[1])
diff = end - start
optimal = 1
people = people + people
m = sum(people[0:diff])
prev_sum = m
for i in range(1, n):
offset = min(diff, n - i)
prev... | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL FUNC_CALL VAR STRING ASSIGN VAR LIST FOR VAR FUNC_CALL VAR VAR EXPR FUNC_CALL VAR FUNC_CALL VAR VAR VAR ASSIGN VAR FUNC_CALL FUNC_CALL VAR STRING ASSIGN VAR FUNC_CALL VAR VAR NUMBER ASSIGN VAR FUNC_CALL VAR VAR NUMBER ASSIGN VAR BIN_OP VAR VAR ASSIGN VAR NUMBE... |
In distant future on Earth day lasts for n hours and that's why there are n timezones. Local times in adjacent timezones differ by one hour. For describing local time, hours numbers from 1 to n are used, i.e. there is no time "0 hours", instead of it "n hours" is used. When local time in the 1-st timezone is 1 hour, lo... | n = int(input())
a = list(map(int, input().split()))
s, t = list(map(int, input().split()))
x = t - s
i = 0
j = x - 1
ans = 0
cur = 0
p = 1
for k in range(i, j + 1):
ans += a[k]
cur = ans
ret = (n + s) % n
if ret == 0:
ret = n
while p != n:
ii = (i + 1) % n
jj = (j + 1) % n
p += 1
cur = cur - 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 VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR BIN_OP VAR VAR ASSIGN VAR NUMBER ASSIGN VAR BIN_OP VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR NUMBER FOR VAR FUNC_CAL... |
In distant future on Earth day lasts for n hours and that's why there are n timezones. Local times in adjacent timezones differ by one hour. For describing local time, hours numbers from 1 to n are used, i.e. there is no time "0 hours", instead of it "n hours" is used. When local time in the 1-st timezone is 1 hour, lo... | n = int(input())
a = [int(x) for x in input().split()]
s, f = (int(x) for x in input().split())
a = a + a[: f - s - 1]
t = s
max = -1
max_t = t
sum = sum(a[0 : 0 + f - s])
for i in range(n):
if sum >= max:
if max < sum:
max_t = t
max = sum
elif max == sum and max_t > t:
... | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR VAR FUNC_CALL VAR VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR BIN_OP VAR VAR BIN_OP BIN_OP VAR VAR NUMBER ASSIGN VAR VAR ASSIGN VAR NUMBER ASSIGN VAR VAR ASSIGN VAR FUNC_CALL VAR VAR NUMBER BIN_OP BIN_OP NUMBER VAR... |
In distant future on Earth day lasts for n hours and that's why there are n timezones. Local times in adjacent timezones differ by one hour. For describing local time, hours numbers from 1 to n are used, i.e. there is no time "0 hours", instead of it "n hours" is used. When local time in the 1-st timezone is 1 hour, lo... | n = int(input())
a = [0]
b = input().split()
a = a + b
ans = 0
m = 0
for i in range(1, n + 1):
a[i] = int(a[i])
s, f = input().split()
s = int(s)
f = int(f)
for i in range(s, f):
m += a[i]
ma = m
ans = 1
start = s - 1
count = f - 1
if count < 1:
count = n
if start < 1:
start = n
for i in range(2, n + 1)... | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR LIST NUMBER ASSIGN VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR BIN_OP VAR VAR ASSIGN VAR NUMBER ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR NUMBER BIN_OP VAR NUMBER ASSIGN VAR VAR FUNC_CALL VAR VAR VAR ASSIGN VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR ASSIGN VA... |
In distant future on Earth day lasts for n hours and that's why there are n timezones. Local times in adjacent timezones differ by one hour. For describing local time, hours numbers from 1 to n are used, i.e. there is no time "0 hours", instead of it "n hours" is used. When local time in the 1-st timezone is 1 hour, lo... | n = int(input())
ps = [int(a) for a in input().split()]
s, f = [int(a) for a in input().split()]
window = f - s
ps += ps[:window]
def f(x):
return (s - 1 - x) % n + 1
answers = []
c = m = sum(ps[:window])
for i in range(n):
if c > m:
answers = [f(i)]
m = c
elif c == m:
answers +=... | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR VAR FUNC_CALL VAR VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR BIN_OP VAR VAR VAR VAR VAR FUNC_DEF RETURN BIN_OP BIN_OP BIN_OP BIN_OP VAR NUMBER VAR VAR NUMBER ASSIGN VAR LIST ASSIGN VAR VAR FUNC_CALL VAR VAR VAR FO... |
In distant future on Earth day lasts for n hours and that's why there are n timezones. Local times in adjacent timezones differ by one hour. For describing local time, hours numbers from 1 to n are used, i.e. there is no time "0 hours", instead of it "n hours" is used. When local time in the 1-st timezone is 1 hour, lo... | n = int(input())
k = list(map(int, input().split()))
a = list(map(int, input().split()))
b = a[1]
a = a[0]
c = b - a
su = 0
l = 0
nn = []
for i in range(c):
su += k[i]
hel = su
nn.append((a - 0 + n - 1) % n + 1)
for j in range(1, len(k)):
g = (j + c - 1) % len(k)
hel = hel - k[j - 1] + k[g]
print
if... | 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 NUMBER ASSIGN VAR VAR NUMBER ASSIGN VAR BIN_OP VAR VAR ASSIGN VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR LIST FOR VAR FUNC_CALL VAR VAR... |
In distant future on Earth day lasts for n hours and that's why there are n timezones. Local times in adjacent timezones differ by one hour. For describing local time, hours numbers from 1 to n are used, i.e. there is no time "0 hours", instead of it "n hours" is used. When local time in the 1-st timezone is 1 hour, lo... | n = int(input())
a = [int(i) for i in input().split()]
s, f = [int(i) for i in input().split()]
a = a + a
ln = f - s
ans = sum(a[:ln])
mx = ans
h = s
for i in range(n - 1):
ans = ans - a[i] + a[i + ln]
if ans > mx:
ans = mx
k = s + (n - (i + 2) + 1)
if k > n:
k -= n
h... | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR VAR FUNC_CALL VAR VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR BIN_OP VAR VAR ASSIGN VAR BIN_OP VAR VAR ASSIGN VAR FUNC_CALL VAR VAR VAR ASSIGN VAR VAR ASSIGN VAR VAR FOR VAR FUNC_CALL VAR BIN_OP VAR NUMBER ASSIGN V... |
In distant future on Earth day lasts for n hours and that's why there are n timezones. Local times in adjacent timezones differ by one hour. For describing local time, hours numbers from 1 to n are used, i.e. there is no time "0 hours", instead of it "n hours" is used. When local time in the 1-st timezone is 1 hour, lo... | zones = int(input())
people = list(map(int, input().split()))
s, f = map(int, input().split())
gap = f - 1 - s
sums = [sum(people[: gap + 1])]
times = []
people += people
for i in range(1, zones):
sums.append(sums[i - 1] - people[i - 1] + people[i + gap])
p_max = max(sums)
for i in range(len(sums)):
if sums[i] ... | 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 FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR BIN_OP BIN_OP VAR NUMBER VAR ASSIGN VAR LIST FUNC_CALL VAR VAR BIN_OP VAR NUMBER ASSIGN VAR LIST VAR VAR FOR VAR FUNC_CALL VAR NUMBER VAR EXPR FUN... |
In distant future on Earth day lasts for n hours and that's why there are n timezones. Local times in adjacent timezones differ by one hour. For describing local time, hours numbers from 1 to n are used, i.e. there is no time "0 hours", instead of it "n hours" is used. When local time in the 1-st timezone is 1 hour, lo... | n = int(input())
l = list(map(int, input().split()))
s, f = map(int, input().split())
pref = [0]
for i in l:
pref.append(i + pref[-1])
f -= 1
maxi = 0
ha = 1
ans = 0
while ha <= n:
if f >= s:
sumi = pref[f] - pref[s - 1]
else:
sumi = pref[f] + pref[n] - pref[s - 1]
if sumi > maxi:
... | 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 FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR LIST NUMBER FOR VAR VAR EXPR FUNC_CALL VAR BIN_OP VAR VAR NUMBER VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR NUMBER WHILE VAR VAR IF... |
In distant future on Earth day lasts for n hours and that's why there are n timezones. Local times in adjacent timezones differ by one hour. For describing local time, hours numbers from 1 to n are used, i.e. there is no time "0 hours", instead of it "n hours" is used. When local time in the 1-st timezone is 1 hour, lo... | R = lambda: map(int, input().split())
n = int(input())
a = list(R())
s, f = R()
d = f - s
def solve(a, d, n, s):
if n < d + 1:
return s
t = 0
for i in range(0, d):
t += a[i]
m = t
res = s
for i in range(1, n):
t += a[(i + d - 1) % n] - a[i - 1]
if t > m:
... | 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 VAR FUNC_CALL VAR ASSIGN VAR BIN_OP VAR VAR FUNC_DEF IF VAR BIN_OP VAR NUMBER RETURN VAR ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR NUMBER VAR VAR VAR VAR ASSIGN VAR VAR ASSIGN VAR ... |
In distant future on Earth day lasts for n hours and that's why there are n timezones. Local times in adjacent timezones differ by one hour. For describing local time, hours numbers from 1 to n are used, i.e. there is no time "0 hours", instead of it "n hours" is used. When local time in the 1-st timezone is 1 hour, lo... | def f(a, start, end):
start -= 1
end -= 1
n = len(a)
aa = [0] * (2 * len(a) + 10)
for i in range(len(a)):
aa[n + i] = a[i]
aa[i] = a[i]
ss = 0
for i in range(start, end):
ss += aa[i]
ans = max(ss, 0)
fin = float("inf")
cur = 1
i = start
j = end
... | FUNC_DEF VAR NUMBER VAR NUMBER ASSIGN VAR FUNC_CALL VAR VAR ASSIGN VAR BIN_OP LIST NUMBER BIN_OP BIN_OP NUMBER FUNC_CALL VAR VAR NUMBER FOR VAR FUNC_CALL VAR FUNC_CALL VAR VAR ASSIGN VAR BIN_OP VAR VAR VAR VAR ASSIGN VAR VAR VAR VAR ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR VAR VAR VAR VAR VAR ASSIGN VAR FUNC_CALL VAR VA... |
In distant future on Earth day lasts for n hours and that's why there are n timezones. Local times in adjacent timezones differ by one hour. For describing local time, hours numbers from 1 to n are used, i.e. there is no time "0 hours", instead of it "n hours" is used. When local time in the 1-st timezone is 1 hour, lo... | def ints():
return list(map(int, input().split()))
n = int(input())
a = ints()
s, f = ints()
dt = f - s
aa = a + a
ll = 0
rx = dt
sw = sum(aa[:rx])
ans = sw, -s
while rx < len(aa):
sw = sw + aa[rx] - aa[ll]
rx += 1
ll += 1
t1 = s - ll
while t1 < 1:
t1 += n
while t1 > n:
t1 ... | FUNC_DEF RETURN 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 ASSIGN VAR VAR FUNC_CALL VAR ASSIGN VAR BIN_OP VAR VAR ASSIGN VAR BIN_OP VAR VAR ASSIGN VAR NUMBER ASSIGN VAR VAR ASSIGN VAR FUNC_CALL VAR VAR VAR ASSIGN VAR VAR VAR WHILE VAR FUNC_CAL... |
There is only $1$ TV in the common room, and as luck would have it, both the El Clasico football match and the India-Pakistan cricket match are happening simultaneously.
There is one football fan who is looking at the live commentary online and will scream whenever an 'important' event takes place in the El Clasico. S... | t = int(input())
for _ in range(t):
n, m = map(int, input().split())
flst = list(map(int, input().split()))
clst = list(map(int, input().split()))
s = 0
d = {}
a, b = 0, 0
for i in range(len(flst) + len(clst)):
try:
if flst[a] < clst[b]:
d[flst[a]] = "f"
... | 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 NUMBER ASSIGN VAR DICT ASSIGN VAR VAR NUMBER NUMBER F... |
There is only $1$ TV in the common room, and as luck would have it, both the El Clasico football match and the India-Pakistan cricket match are happening simultaneously.
There is one football fan who is looking at the live commentary online and will scream whenever an 'important' event takes place in the El Clasico. S... | for _ in range(int(input())):
n, m = map(int, input().split())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
c = "f"
d = 0
x = y = 0
while True:
if c == "f":
if b[y] < a[x]:
d += 1
c = "c"
else:
... | 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 STRING ASSIGN VAR NUMBER ASSIGN VAR VAR NUMBER WHILE NUMBER IF VAR S... |
There is only $1$ TV in the common room, and as luck would have it, both the El Clasico football match and the India-Pakistan cricket match are happening simultaneously.
There is one football fan who is looking at the live commentary online and will scream whenever an 'important' event takes place in the El Clasico. S... | t = int(input())
for i in range(t):
n, m = map(int, input().split())
l1 = list(map(int, input().split()))
l2 = list(map(int, input().split()))
if 0 in l1 or 0 in l2:
continue
c = 0
flag = 0
sm = l1[0]
ptr1 = 0
ptr2 = 0
while ptr1 < n and ptr2 < m:
if l1[ptr1] < l2... | 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 IF NUMBER VAR NUMBER VAR ASSIGN VAR NUMBER ASSIGN VAR NUMBER ASS... |
There is only $1$ TV in the common room, and as luck would have it, both the El Clasico football match and the India-Pakistan cricket match are happening simultaneously.
There is one football fan who is looking at the live commentary online and will scream whenever an 'important' event takes place in the El Clasico. S... | def ans():
ans = i = j = p = 0
while i < n and j < m:
if f[i] < c[j]:
if p != 0:
p = 0
ans += 1
i += 1
else:
if p == 0:
p = 1
ans += 1
j += 1
print(ans + 1)
for i in range(int(in... | FUNC_DEF ASSIGN VAR VAR VAR VAR NUMBER WHILE VAR VAR VAR VAR IF VAR VAR VAR VAR IF VAR NUMBER ASSIGN VAR NUMBER VAR NUMBER VAR NUMBER IF VAR NUMBER ASSIGN VAR NUMBER VAR NUMBER VAR NUMBER EXPR FUNC_CALL VAR BIN_OP VAR NUMBER FOR VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FU... |
There is only $1$ TV in the common room, and as luck would have it, both the El Clasico football match and the India-Pakistan cricket match are happening simultaneously.
There is one football fan who is looking at the live commentary online and will scream whenever an 'important' event takes place in the El Clasico. S... | t = int(input())
for i in range(t):
N, M = map(int, input().split())
fb = list(map(int, input().split()))
ct = list(map(int, input().split()))
first = "fb"
count = 0
for i in range(N + M):
if fb != [] and ct != []:
if fb[0] < ct[0]:
present = "fb"
... | 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 STRING ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR BIN_OP... |
There is only $1$ TV in the common room, and as luck would have it, both the El Clasico football match and the India-Pakistan cricket match are happening simultaneously.
There is one football fan who is looking at the live commentary online and will scream whenever an 'important' event takes place in the El Clasico. S... | from sys import stdin, stdout
try:
from sys import stdin, stdout
rl = lambda: stdin.readline()
wl = lambda s: stdout.write(s)
tc = int(rl())
for _ in range(tc):
n, m = map(int, rl().split())
F = list(map(int, rl().split()))
C = list(map(int, rl().split()))
r = f = c... | ASSIGN VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR 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... |
There is only $1$ TV in the common room, and as luck would have it, both the El Clasico football match and the India-Pakistan cricket match are happening simultaneously.
There is one football fan who is looking at the live commentary online and will scream whenever an 'important' event takes place in the El Clasico. S... | t = int(input())
for i in range(t):
n, m = [int(i) for i in input().split()]
a = [int(i) for i in input().split()]
b = [int(i) for i in input().split()]
i = 0
j = 0
p = 1
c = 0
while i < n and j < m:
if a[i] < b[j]:
if p == 1:
i += 1
co... | 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 NUMBER ASSIGN VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR NUMBER WHILE VA... |
There is only $1$ TV in the common room, and as luck would have it, both the El Clasico football match and the India-Pakistan cricket match are happening simultaneously.
There is one football fan who is looking at the live commentary online and will scream whenever an 'important' event takes place in the El Clasico. S... | def integer_list():
return list(map(int, input().split()))
def main():
f.sort(reverse=True)
c.sort(reverse=True)
swich = 0
s = True
while f and c:
if f[-1] < c[-1] and s:
f.pop()
elif f[-1] <= c[-1] and not s:
f.pop()
s = not s
sw... | FUNC_DEF RETURN FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR FUNC_DEF EXPR FUNC_CALL VAR NUMBER EXPR FUNC_CALL VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR NUMBER WHILE VAR VAR IF VAR NUMBER VAR NUMBER VAR EXPR FUNC_CALL VAR IF VAR NUMBER VAR NUMBER VAR EXPR FUNC_CALL VAR ASSIGN VAR VAR VAR NUMBER IF VAR NUMBER V... |
There is only $1$ TV in the common room, and as luck would have it, both the El Clasico football match and the India-Pakistan cricket match are happening simultaneously.
There is one football fan who is looking at the live commentary online and will scream whenever an 'important' event takes place in the El Clasico. S... | t = int(input())
for i in range(t):
n, m = map(int, input().split())
f = list(map(int, input().split()))
c = list(map(int, input().split()))
d = f + c
d.sort()
x = 0
z = {}
for i in range(n):
z[f[i]] = 1
for i in range(m):
z[c[i]] = 0
for i in range(len(d)):
... | 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 BIN_OP VAR VAR EXPR FUNC_CALL VAR ASSIGN VAR NUMBER A... |
There is only $1$ TV in the common room, and as luck would have it, both the El Clasico football match and the India-Pakistan cricket match are happening simultaneously.
There is one football fan who is looking at the live commentary online and will scream whenever an 'important' event takes place in the El Clasico. S... | import sys
t = int(input())
for i in range(t):
n, m = map(int, input().split())
f = [int(x) for x in sys.stdin.readline().split()]
c = [int(x) for x in sys.stdin.readline().split()]
o = 0
s = "f"
while len(c) != 0 and len(f) != 0:
if c[0] < f[0]:
c.pop(0)
if s ==... | IMPORT 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 NUMBER ASSIGN VAR STRING WHILE FUNC_CALL VAR VAR NUMBER FUNC_CALL ... |
There is only $1$ TV in the common room, and as luck would have it, both the El Clasico football match and the India-Pakistan cricket match are happening simultaneously.
There is one football fan who is looking at the live commentary online and will scream whenever an 'important' event takes place in the El Clasico. S... | t = int(input())
for _ in range(t):
n, m = [int(x) for x in input().split()]
Lf = [int(x) for x in input().split()]
Lc = [int(x) for x in input().split()]
k = 0
f = 0
c = 0
current = "F"
while f < n and c < m:
if Lf[f] < Lc[c]:
if current != "F":
k += ... | 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 NUMBER ASSIGN VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR STRING WHILE VA... |
There is only $1$ TV in the common room, and as luck would have it, both the El Clasico football match and the India-Pakistan cricket match are happening simultaneously.
There is one football fan who is looking at the live commentary online and will scream whenever an 'important' event takes place in the El Clasico. S... | tot = int(input())
for _ in range(tot):
nf, nc = map(int, input().split())
foot = set(map(int, input().split()))
crick = set(map(int, input().split()))
ev = list(foot.union(crick))
ev.sort()
chan = "foot"
s = 0
for i in ev:
if i in crick and chan != "crick":
s += 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 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 EXPR FUNC_CALL VAR AS... |
There is only $1$ TV in the common room, and as luck would have it, both the El Clasico football match and the India-Pakistan cricket match are happening simultaneously.
There is one football fan who is looking at the live commentary online and will scream whenever an 'important' event takes place in the El Clasico. S... | a = int(input())
while a != 0:
ans = 0
now = 1
n, m = map(int, input().split())
f1 = list(map(int, input().split()))
f2 = list(map(int, input().split()))
timeline = [(i, 1) for i in f1] + [(i, 2) for i in f2]
timeline = sorted(timeline)
for i in timeline:
if i[1] != now:
... | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR WHILE VAR NUMBER ASSIGN VAR NUMBER ASSIGN 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 BIN_OP VAR NUMBER VAR VAR ... |
There is only $1$ TV in the common room, and as luck would have it, both the El Clasico football match and the India-Pakistan cricket match are happening simultaneously.
There is one football fan who is looking at the live commentary online and will scream whenever an 'important' event takes place in the El Clasico. S... | for _ in range(int(input())):
noOfFoot, noOfCric = map(int, input().split(" "))
footImpEvents = list(map(int, input().split(" ")))
cricImpEvents = list(map(int, input().split(" ")))
r = f = c = p = 0
while f < noOfFoot and c < noOfCric:
if footImpEvents[f] < cricImpEvents[c]:
if ... | 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 VAR VAR VAR NUMBER WHILE VAR VAR VAR VAR IF VAR... |
There is only $1$ TV in the common room, and as luck would have it, both the El Clasico football match and the India-Pakistan cricket match are happening simultaneously.
There is one football fan who is looking at the live commentary online and will scream whenever an 'important' event takes place in the El Clasico. S... | t = int(input())
for z in range(t):
n, m = map(int, input().split())
f = list(map(int, input().split()))
c = list(map(int, input().split()))
i = 0
j = 0
k = 0
count = 0
while i < n and j < m:
if f[i] < c[j]:
if k == 1:
k = 0
count += 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 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 ASSIGN VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR... |
There is only $1$ TV in the common room, and as luck would have it, both the El Clasico football match and the India-Pakistan cricket match are happening simultaneously.
There is one football fan who is looking at the live commentary online and will scream whenever an 'important' event takes place in the El Clasico. S... | try:
t = int(input())
for i in range(t):
n, m = [int(itm) for itm in input().split()]
ma = {}
f = [int(itm) for itm in input().split()]
c = [int(itm) for itm in input().split()]
for itm in f:
ma[itm] = "F"
for itm in c:
ma[itm] = "C"
... | 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 DICT ASSIGN VAR FUNC_CALL VAR VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR VAR FUNC_CALL FUNC_CALL VAR FOR VAR VAR ASSIGN VAR VAR STRING FOR VAR VAR ASSIGN VAR VAR STR... |
There is only $1$ TV in the common room, and as luck would have it, both the El Clasico football match and the India-Pakistan cricket match are happening simultaneously.
There is one football fan who is looking at the live commentary online and will scream whenever an 'important' event takes place in the El Clasico. S... | def solve(A, n, B, m):
C = [(i, 0) for i in A]
C += [(i, 1) for i in B]
C.sort()
change = 0
curr = 0
for tim, sport in C:
if curr != sport:
change += 1
curr = sport
return change
for case in range(int(input())):
n, m = map(int, input().split())
F = list(... | FUNC_DEF ASSIGN VAR VAR NUMBER VAR VAR VAR VAR NUMBER VAR VAR EXPR FUNC_CALL VAR ASSIGN VAR NUMBER ASSIGN VAR NUMBER FOR VAR VAR VAR IF VAR VAR VAR NUMBER ASSIGN 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 VAR FUNC_CA... |
There is only $1$ TV in the common room, and as luck would have it, both the El Clasico football match and the India-Pakistan cricket match are happening simultaneously.
There is one football fan who is looking at the live commentary online and will scream whenever an 'important' event takes place in the El Clasico. S... | t = int(input())
while t != 0:
n, m = list(map(int, input().split()))
foot = list(map(int, input().split()))
cric = list(map(int, input().split()))
switches = 0
chanel = 0
event = []
for i in foot:
event.append([i, 0])
for j in cric:
event.append([j, 1])
event = sorte... | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR WHILE 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 NUMBER ASSIGN VAR NUMBER ASSIGN VAR LIST FOR VAR... |
There is only $1$ TV in the common room, and as luck would have it, both the El Clasico football match and the India-Pakistan cricket match are happening simultaneously.
There is one football fan who is looking at the live commentary online and will scream whenever an 'important' event takes place in the El Clasico. S... | t = int(input())
for i in range(t):
n, m = map(int, input().split())
f = list(map(int, input().split()))
c = list(map(int, input().split()))
l = []
for i in range(n):
l.append((f[i], "f"))
for j in range(m):
l.append((c[j], "c"))
prev = "f"
l.sort()
c = 0
for i in... | 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 LIST FOR VAR FUNC_CALL VAR VAR EXPR FUNC_CALL VAR VAR... |
There is only $1$ TV in the common room, and as luck would have it, both the El Clasico football match and the India-Pakistan cricket match are happening simultaneously.
There is one football fan who is looking at the live commentary online and will scream whenever an 'important' event takes place in the El Clasico. S... | for _ in range(int(input())):
n, m = map(int, input().split())
f = list(map(int, input().split()))
c = list(map(int, input().split()))
a = [(it, 0) for it in f]
a += [(it, 1) for it in c]
a.sort()
curr = 0
turn = 0
for event, sport in a:
if sport != curr:
turn += ... | 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 VAR NUMBER VAR VAR VAR VAR NUMBER VAR VAR EXPR FUNC_CALL VAR ASSIGN ... |
There is only $1$ TV in the common room, and as luck would have it, both the El Clasico football match and the India-Pakistan cricket match are happening simultaneously.
There is one football fan who is looking at the live commentary online and will scream whenever an 'important' event takes place in the El Clasico. S... | def hs(s, t):
g = 0
a = 0
i, j = 0, 0
while i < len(s) and j < len(t):
if s[i] < t[j]:
if g == 1:
a = a + 1
g = 0
i = i + 1
else:
if g == 0:
a = a + 1
g = 1
j = j + 1
if i ... | FUNC_DEF ASSIGN VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR VAR NUMBER NUMBER WHILE VAR FUNC_CALL VAR VAR VAR FUNC_CALL VAR VAR IF VAR VAR VAR VAR IF VAR NUMBER ASSIGN VAR BIN_OP VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR BIN_OP VAR NUMBER IF VAR NUMBER ASSIGN VAR BIN_OP VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR BIN_OP VAR NUMB... |
There is only $1$ TV in the common room, and as luck would have it, both the El Clasico football match and the India-Pakistan cricket match are happening simultaneously.
There is one football fan who is looking at the live commentary online and will scream whenever an 'important' event takes place in the El Clasico. S... | t = int(input())
for _ in range(t):
m, n = map(int, input().split())
foot = list(map(int, input().split()))
cric = list(map(int, input().split()))
chan = 1
ans = 0
te = [(i, 1) for i in foot] + [(j, 2) for j in cric]
te = sorted(te)
for i in te:
if i[1] != chan:
ans +... | 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 NUMBER ASSIGN VAR NUMBER ASSIGN VAR BIN_OP VAR NUMBER... |
There is only $1$ TV in the common room, and as luck would have it, both the El Clasico football match and the India-Pakistan cricket match are happening simultaneously.
There is one football fan who is looking at the live commentary online and will scream whenever an 'important' event takes place in the El Clasico. S... | for cases in range(int(input())):
n, m = map(int, input().split())
arr = list(map(int, input().split()))
cric = list(map(int, input().split()))
d = {}
current_pos = "f"
change = 0
for i in range(n):
d[arr[i]] = "f"
for j in range(m):
d[cric[j]] = "c"
arr.append(cr... | 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 STRING ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR VAR A... |
There is only $1$ TV in the common room, and as luck would have it, both the El Clasico football match and the India-Pakistan cricket match are happening simultaneously.
There is one football fan who is looking at the live commentary online and will scream whenever an 'important' event takes place in the El Clasico. S... | t = int(input())
for i in range(t):
n, m = map(int, input().split())
l = []
f = list(map(int, input().split()))
c = list(map(int, input().split()))
current = "f"
count = 0
for i in range(n):
l.append((f[i], "f"))
for i in range(m):
l.append((c[i], "c"))
l.sort()
f... | 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 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 STRING ASSIGN VAR NUMBER FOR VAR FUNC... |
There is only $1$ TV in the common room, and as luck would have it, both the El Clasico football match and the India-Pakistan cricket match are happening simultaneously.
There is one football fan who is looking at the live commentary online and will scream whenever an 'important' event takes place in the El Clasico. S... | for _ in range(int(input())):
n, m = list(map(int, input().split()))
foot = list(map(int, input().split()))
cric = list(map(int, input().split()))
start = 0
ch = 0
ans = 0
i, j = 0, 0
while i < n and j < m:
if foot[i] < cric[j]:
if ch == 1:
ans += 1
... | 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 NUMBER ASSIGN VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR ... |
There is only $1$ TV in the common room, and as luck would have it, both the El Clasico football match and the India-Pakistan cricket match are happening simultaneously.
There is one football fan who is looking at the live commentary online and will scream whenever an 'important' event takes place in the El Clasico. S... | t = int(input())
for i in range(t):
n = list(map(int, input().split()))
f = list(map(int, input().split()))
c = list(map(int, input().split()))
d = {}
ft = 0
for i in f:
d[i] = 0
for i in c:
d[i] = 1
l = list(d.keys())
l.sort()
count = 0
for i in l:
if... | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR FOR VAR FUNC_CALL VAR 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 FUNC_CALL FUNC_CALL VAR ASSIGN VAR DICT ASSIGN VAR NUMBER FOR VAR VAR ASSIGN V... |
There is only $1$ TV in the common room, and as luck would have it, both the El Clasico football match and the India-Pakistan cricket match are happening simultaneously.
There is one football fan who is looking at the live commentary online and will scream whenever an 'important' event takes place in the El Clasico. S... | t = int(input())
while t:
t -= 1
n, m = map(int, input().split())
ftb = list(map(int, input().split()))
crc = list(map(int, input().split()))
d = {}
count = 0
for i in range(n):
d[ftb[i]] = "f"
for i in range(m):
d[crc[i]] = "c"
d = dict(sorted(d.items(), key=lambda x... | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR WHILE VAR 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 ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR VAR ASSIGN VA... |
There is only $1$ TV in the common room, and as luck would have it, both the El Clasico football match and the India-Pakistan cricket match are happening simultaneously.
There is one football fan who is looking at the live commentary online and will scream whenever an 'important' event takes place in the El Clasico. S... | for _ in range(int(input())):
n, m = map(int, input().split())
f, c, pf, pc, prev = (
list(map(int, input().split())),
list(map(int, input().split())),
[(0) for _ in range(0, n)],
[(1) for _ in range(0, m)],
0,
)
xf, xc = dict(zip(f, pf)), dict(zip(c, pc))
xc.... | 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 VAR VAR VAR VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR NUMBER VAR FUNC_CALL VAR NUMBER VAR NUMBER VAR FUNC_CALL VAR NUMBER VAR NU... |
There is only $1$ TV in the common room, and as luck would have it, both the El Clasico football match and the India-Pakistan cricket match are happening simultaneously.
There is one football fan who is looking at the live commentary online and will scream whenever an 'important' event takes place in the El Clasico. S... | t = int(input())
for _ in range(t):
n, m = map(int, input().split())
f = list(map(int, input().split()))
c = list(map(int, input().split()))
ans = 0
if f[0] < c[0]:
curr = 0
i = 1
j = 0
else:
ans += 1
curr = 1
i = 0
j = 1
while i < n an... | 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 NUMBER IF VAR NUMBER VAR NUMBER ASSIGN VAR NUMBER ASS... |
There is only $1$ TV in the common room, and as luck would have it, both the El Clasico football match and the India-Pakistan cricket match are happening simultaneously.
There is one football fan who is looking at the live commentary online and will scream whenever an 'important' event takes place in the El Clasico. S... | def solve(n, m, football, cricket):
switches = 0
football_bool = True
f_index = 0
c_index = 0
while f_index < n and c_index < m:
if football[f_index] < cricket[c_index]:
if not football_bool:
switches += 1
football_bool = True
f_index += 1
... | FUNC_DEF ASSIGN VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR NUMBER WHILE VAR VAR VAR VAR IF VAR VAR VAR VAR IF VAR VAR NUMBER ASSIGN VAR NUMBER VAR NUMBER IF VAR VAR NUMBER VAR NUMBER ASSIGN VAR NUMBER IF VAR VAR VAR VAR VAR VAR VAR NUMBER RETURN VAR FUNC_DEF FOR VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL ... |
There is only $1$ TV in the common room, and as luck would have it, both the El Clasico football match and the India-Pakistan cricket match are happening simultaneously.
There is one football fan who is looking at the live commentary online and will scream whenever an 'important' event takes place in the El Clasico. S... | t = int(input())
for i in range(t):
n, m = map(int, input().split())
f = list(map(lambda x: 2 * int(x), input().split()))
c = list(map(lambda x: 2 * int(x) + 1, input().split()))
fc = sorted(f + c, key=int)
k = 0
c = 0
for j in fc:
if (j - k) % 2 == 1:
c += 1
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 BIN_OP NUMBER FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR BIN_OP BIN_OP NUMBER FUNC_CALL VAR VAR NUMBER FUNC_CALL FUNC_CAL... |
There is only $1$ TV in the common room, and as luck would have it, both the El Clasico football match and the India-Pakistan cricket match are happening simultaneously.
There is one football fan who is looking at the live commentary online and will scream whenever an 'important' event takes place in the El Clasico. S... | for T in range(int(input())):
N, M = map(int, input().split())
F = list(map(int, input().split()))
C = list(map(int, input().split()))
Channel = "F"
result = 0
for i in range(int(N + M)):
if len(F) != 0 and len(C) != 0:
if F[0] < C[0]:
del F[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 STRING ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR FUNC_CALL VAR BIN_OP ... |
There is only $1$ TV in the common room, and as luck would have it, both the El Clasico football match and the India-Pakistan cricket match are happening simultaneously.
There is one football fan who is looking at the live commentary online and will scream whenever an 'important' event takes place in the El Clasico. S... | from sys import stdin
input = stdin.readline
for _ in range(int(input())):
n, m = map(int, input().split())
fli = list(map(int, input().split()))
cli = list(map(int, input().split()))
lst = list()
lst.append([0, 1])
for a in fli:
lst.append([a, 1])
for b in cli:
lst.append([... | ASSIGN VAR 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 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 EXPR FUNC_CALL VAR LIST NUMBER NUMBER F... |
There is only $1$ TV in the common room, and as luck would have it, both the El Clasico football match and the India-Pakistan cricket match are happening simultaneously.
There is one football fan who is looking at the live commentary online and will scream whenever an 'important' event takes place in the El Clasico. S... | t = int(input())
while t != 0:
n, m = list(map(int, input().split()))
f = list(map(int, input().split()))
c = list(map(int, input().split()))
fd = list(map(lambda x: (x, "f"), f))
cd = list(map(lambda x: (x, "c"), c))
main = fd + cd
main.sort()
toSwitch = "c"
switches = 0
for i i... | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR WHILE 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 FUNC_CALL VAR FUNC_CALL VAR VAR STRING VAR ASSIG... |
There is only $1$ TV in the common room, and as luck would have it, both the El Clasico football match and the India-Pakistan cricket match are happening simultaneously.
There is one football fan who is looking at the live commentary online and will scream whenever an 'important' event takes place in the El Clasico. S... | for i in range(int(input())):
n, m = map(int, input().split())
l = list(map(int, input().split()))
t = list(map(int, input().split()))
d = {}
for j in l:
d[j] = 0
for j in t:
d[j] = 1
c = 0
f = 0
for j in sorted(d.keys()):
if d[j] == 0 and f == 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 FOR VAR VAR ASSIGN VAR VAR NUMBER FOR VAR VAR ASSIGN VAR VAR NU... |
There is only $1$ TV in the common room, and as luck would have it, both the El Clasico football match and the India-Pakistan cricket match are happening simultaneously.
There is one football fan who is looking at the live commentary online and will scream whenever an 'important' event takes place in the El Clasico. S... | t = int(input())
for i in range(t):
n, m = map(int, input().split())
f = list(map(int, input().split()))
c = list(map(int, input().split()))
i = 0
j = 0
curr = "F"
res = 0
while i < n and j < m:
if f[i] < c[j]:
if curr == "C":
res += 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 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 ASSIGN VAR NUMBER ASSIGN VAR STRING ASSIGN VAR... |
One common way of digitalizing sound is to record sound intensity at particular time moments. For each time moment intensity is recorded as a non-negative integer. Thus we can represent a sound file as an array of n non-negative integers.
If there are exactly K distinct values in the array, then we need k = ⌈ log_{2} ... | from sys import setrecursionlimit as SRL
from sys import stdin
SRL(10**7)
rd = stdin.readline
rrd = lambda: map(int, rd().strip().split())
n, i = rrd()
i *= 8
can = 2 ** (i // n)
a = list(rrd())
a.sort()
a = [-1] + a + [-1]
ans = 10**100
j = 1
cnt = 0
for i in range(n + 1):
if i and a[i] != a[i - 1]:
cnt +... | EXPR FUNC_CALL VAR BIN_OP NUMBER NUMBER ASSIGN VAR VAR ASSIGN VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL FUNC_CALL VAR ASSIGN VAR VAR FUNC_CALL VAR VAR NUMBER ASSIGN VAR BIN_OP NUMBER BIN_OP VAR VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR EXPR FUNC_CALL VAR ASSIGN VAR BIN_OP BIN_OP LIST NUMBER VAR LIST NUMBER ASSIGN VAR ... |
One common way of digitalizing sound is to record sound intensity at particular time moments. For each time moment intensity is recorded as a non-negative integer. Thus we can represent a sound file as an array of n non-negative integers.
If there are exactly K distinct values in the array, then we need k = ⌈ log_{2} ... | n, i = map(int, input().split(" "))
sound = list(map(int, input().split(" ")))
sound.sort()
limit = 2 ** (i * 8 // n)
l = [0]
for i in range(1, n):
if sound[i - 1] != sound[i]:
l.append(i)
if len(l) <= limit:
print("0")
else:
print(n - max(l[i + limit] - l[i] for i in range(len(l) - limit))) | 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 EXPR FUNC_CALL VAR ASSIGN VAR BIN_OP NUMBER BIN_OP BIN_OP VAR NUMBER VAR ASSIGN VAR LIST NUMBER FOR VAR FUNC_CALL VAR NUMBER VAR IF VAR BIN_OP VAR NUMBER VAR VAR EXPR FUNC_CALL VAR V... |
One common way of digitalizing sound is to record sound intensity at particular time moments. For each time moment intensity is recorded as a non-negative integer. Thus we can represent a sound file as an array of n non-negative integers.
If there are exactly K distinct values in the array, then we need k = ⌈ log_{2} ... | n, I = map(int, input().split())
a = list(map(int, input().split()))
k = I * 8 // n
K = 2**k
a.sort()
A = [1]
j = 0
for i in range(1, n):
if a[i] == a[i - 1]:
A[j] += 1
else:
A.append(1)
j += 1
c = len(A) - K
s1 = sum(A[:c])
s2 = 0
if c <= 0:
ans = 0
else:
ans = 10**9 + 7
for... | 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 BIN_OP BIN_OP VAR NUMBER VAR ASSIGN VAR BIN_OP NUMBER VAR EXPR FUNC_CALL VAR ASSIGN VAR LIST NUMBER ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR NUMBER VAR IF VAR VAR VAR BIN_OP VAR NUMBER V... |
One common way of digitalizing sound is to record sound intensity at particular time moments. For each time moment intensity is recorded as a non-negative integer. Thus we can represent a sound file as an array of n non-negative integers.
If there are exactly K distinct values in the array, then we need k = ⌈ log_{2} ... | n, I = map(int, input().split())
audio_list = list(map(int, input().split()))
K = pow(2, 8 * I // n)
audio_dict = {}
for el in audio_list:
if el not in audio_dict:
audio_dict[el] = 1
else:
audio_dict[el] += 1
audio_keys = sorted(list(audio_dict.keys()))
audio = [audio_dict[el] for el in audio_ke... | 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 NUMBER BIN_OP BIN_OP NUMBER VAR VAR ASSIGN VAR DICT FOR VAR VAR IF VAR VAR ASSIGN VAR VAR NUMBER VAR VAR NUMBER ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN... |
One common way of digitalizing sound is to record sound intensity at particular time moments. For each time moment intensity is recorded as a non-negative integer. Thus we can represent a sound file as an array of n non-negative integers.
If there are exactly K distinct values in the array, then we need k = ⌈ log_{2} ... | n, m = map(int, input().split())
a = sorted(map(int, input().split()))
b = [0]
a += [1 << 30]
for i in range(n):
if a[i] < a[i + 1]:
b += [i + 1]
print(n - max((y - x for x, y in zip(b, b[1 << 8 * m // n :])), default=n)) | 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 NUMBER VAR LIST BIN_OP NUMBER NUMBER FOR VAR FUNC_CALL VAR VAR IF VAR VAR VAR BIN_OP VAR NUMBER VAR LIST BIN_OP VAR NUMBER EXPR FUNC_CALL VAR BIN_OP VAR FUNC_CALL VAR BIN_OP VAR VA... |
One common way of digitalizing sound is to record sound intensity at particular time moments. For each time moment intensity is recorded as a non-negative integer. Thus we can represent a sound file as an array of n non-negative integers.
If there are exactly K distinct values in the array, then we need k = ⌈ log_{2} ... | n, I = list(map(int, input().strip().split()))
l = list(map(int, input().strip().split()))
l.sort()
k = 2 ** (I * 8 // n)
sol = []
i = 0
while i < n - 1:
count = 1
while i < n - 1 and l[i] == l[i + 1]:
count += 1
i += 1
sol.append(count)
i += 1
if len(l) > 1 and l[-1] != l[-2]:
sol.a... | ASSIGN VAR 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 FUNC_CALL VAR EXPR FUNC_CALL VAR ASSIGN VAR BIN_OP NUMBER BIN_OP BIN_OP VAR NUMBER VAR ASSIGN VAR LIST ASSIGN VAR NUMBER WHILE VAR BIN_OP VAR NUMBER ASSIGN VAR NUMBER WHILE VAR... |
One common way of digitalizing sound is to record sound intensity at particular time moments. For each time moment intensity is recorded as a non-negative integer. Thus we can represent a sound file as an array of n non-negative integers.
If there are exactly K distinct values in the array, then we need k = ⌈ log_{2} ... | def mp():
return map(int, input().split())
n, I = mp()
a = sorted(list(mp()))
k = 2 ** (I * 8 // n)
cnt = [[a[0], 1]]
for i in range(1, n):
if cnt[-1][0] == a[i]:
cnt[-1][1] += 1
else:
cnt.append([a[i], 1])
N = n
n = len(cnt)
a = [i[1] for i in cnt]
s = sum(a[:k])
ans = s
for i in range(k,... | FUNC_DEF RETURN FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR BIN_OP NUMBER BIN_OP BIN_OP VAR NUMBER VAR ASSIGN VAR LIST LIST VAR NUMBER NUMBER FOR VAR FUNC_CALL VAR NUMBER VAR IF VAR NUMBER NUMBER VAR VAR VAR NUMBER NUMBER NUMBER ... |
One common way of digitalizing sound is to record sound intensity at particular time moments. For each time moment intensity is recorded as a non-negative integer. Thus we can represent a sound file as an array of n non-negative integers.
If there are exactly K distinct values in the array, then we need k = ⌈ log_{2} ... | n, I = map(int, input().split())
a = list(map(int, input().split()))
I *= 8
k = I // n
if k >= 20:
res = 0
else:
K = 2**k
cc = {}
for ai in a:
cc[ai] = cc.get(ai, 0) + 1
pres = []
dd = sorted(cc)
for i in dd:
pres.append(cc[i])
for i in range(1, len(pres)):
pres[i... | 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 VAR NUMBER ASSIGN VAR BIN_OP VAR VAR IF VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR BIN_OP NUMBER VAR ASSIGN VAR DICT FOR VAR VAR ASSIGN VAR VAR BIN_OP FUNC_CALL VAR VAR NUMBER NUMBER ASSIGN VAR LIST ... |
One common way of digitalizing sound is to record sound intensity at particular time moments. For each time moment intensity is recorded as a non-negative integer. Thus we can represent a sound file as an array of n non-negative integers.
If there are exactly K distinct values in the array, then we need k = ⌈ log_{2} ... | line = input()
tmp = line.split(" ")
n, k = int(tmp[0]), int(tmp[1])
line1 = input()
lst = [int(i) for i in line1.split(" ")]
lst.sort()
last, dis, ans, cnt = -1, 0, n, 0
left = 0
if k * 8 // n > n:
print("0")
else:
mx = 2 ** (k * 8 // n)
for idx, num in enumerate(lst):
cnt += 1
if num != la... | ASSIGN VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR STRING ASSIGN VAR VAR FUNC_CALL VAR VAR NUMBER FUNC_CALL VAR VAR NUMBER ASSIGN VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR VAR FUNC_CALL VAR STRING EXPR FUNC_CALL VAR ASSIGN VAR VAR VAR VAR NUMBER NUMBER VAR NUMBER ASSIGN VAR NUMBER IF BIN_OP BIN_OP VAR NUMBER VAR VA... |
One common way of digitalizing sound is to record sound intensity at particular time moments. For each time moment intensity is recorded as a non-negative integer. Thus we can represent a sound file as an array of n non-negative integers.
If there are exactly K distinct values in the array, then we need k = ⌈ log_{2} ... | import sys
input = sys.stdin.readline
n, I = map(int, input().split())
a = list(map(int, input().split()))
k = I * 8 // n
K = 2**k
d = {}
for i in range(n):
if a[i] not in d:
d[a[i]] = 0
d[a[i]] += 1
keys = list(d.keys())
keys.sort()
num = 0
maxNum = 0
for i in range(len(keys)):
num += d[keys[i]]
... | IMPORT ASSIGN 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 BIN_OP BIN_OP VAR NUMBER VAR ASSIGN VAR BIN_OP NUMBER VAR ASSIGN VAR DICT FOR VAR FUNC_CALL VAR VAR IF VAR VAR VAR ASSIGN VAR VAR VAR NUMBER VAR VAR VAR NUMBER ASS... |
One common way of digitalizing sound is to record sound intensity at particular time moments. For each time moment intensity is recorded as a non-negative integer. Thus we can represent a sound file as an array of n non-negative integers.
If there are exactly K distinct values in the array, then we need k = ⌈ log_{2} ... | n, I = map(int, input().split())
a = list(map(int, input().split()))
k = 2 ** (I * 8 // n)
a.sort()
ls = []
cnt = 1
for i in range(1, n):
if a[i] == a[i - 1]:
cnt += 1
else:
ls.append([cnt, a[i - 1]])
cnt = 1
if cnt:
ls.append([cnt, a[-1]])
dis = len(ls)
if dis <= k:
print(0)
els... | 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 BIN_OP NUMBER BIN_OP BIN_OP VAR NUMBER VAR EXPR FUNC_CALL VAR ASSIGN VAR LIST ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR NUMBER VAR IF VAR VAR VAR BIN_OP VAR NUMBER VAR NUMBER EXPR FUNC_CA... |
One common way of digitalizing sound is to record sound intensity at particular time moments. For each time moment intensity is recorded as a non-negative integer. Thus we can represent a sound file as an array of n non-negative integers.
If there are exactly K distinct values in the array, then we need k = ⌈ log_{2} ... | from itertools import groupby
def solve():
n, disk = list(map(int, input().split()))
a = list(map(int, input().split()))
k = int(disk * 8 / n)
dist = 1 << k
counts = [len(list(group)) for key, group in groupby(sorted(a))]
cur_changes = sum(counts[dist:])
ans = cur_changes
for i in rang... | FUNC_DEF 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 BIN_OP BIN_OP VAR NUMBER VAR ASSIGN VAR BIN_OP NUMBER VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR VAR VAR FUNC_CALL VAR FUNC_CALL VAR VAR ASSIGN ... |
One common way of digitalizing sound is to record sound intensity at particular time moments. For each time moment intensity is recorded as a non-negative integer. Thus we can represent a sound file as an array of n non-negative integers.
If there are exactly K distinct values in the array, then we need k = ⌈ log_{2} ... | ni = input()
n, i = list(map(int, ni.split()))
nums = input()
nums = list(map(int, nums.split()))
i = i * 8
mm = {}
for k in nums:
if k in mm:
mm[k] += 1
else:
mm[k] = 1
keys = mm.keys()
s_keys = sorted(list(keys))
bits = i // n
nums_len = pow(2, bits)
right = nums_len
left = 0
if right >= len(s... | ASSIGN VAR FUNC_CALL VAR ASSIGN VAR VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL VAR ASSIGN VAR BIN_OP VAR NUMBER ASSIGN VAR DICT FOR VAR VAR IF VAR VAR VAR VAR NUMBER ASSIGN VAR VAR NUMBER ASSIGN VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL V... |
One common way of digitalizing sound is to record sound intensity at particular time moments. For each time moment intensity is recorded as a non-negative integer. Thus we can represent a sound file as an array of n non-negative integers.
If there are exactly K distinct values in the array, then we need k = ⌈ log_{2} ... | n, i = map(int, input().split())
lst = list(map(int, input().split()))
i *= 8
k = i // n
imax = 2**k
idict = {}
for i in lst:
if idict.get(i) == None:
idict[i] = 1
else:
idict[i] += 1
lst = sorted(idict.keys())
isum = 0
imin = None
l = 0
q = 0
r = 0
while r < len(lst):
isum += 1
q += idi... | 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 VAR NUMBER ASSIGN VAR BIN_OP VAR VAR ASSIGN VAR BIN_OP NUMBER VAR ASSIGN VAR DICT FOR VAR VAR IF FUNC_CALL VAR VAR NONE ASSIGN VAR VAR NUMBER VAR VAR NUMBER ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ... |
One common way of digitalizing sound is to record sound intensity at particular time moments. For each time moment intensity is recorded as a non-negative integer. Thus we can represent a sound file as an array of n non-negative integers.
If there are exactly K distinct values in the array, then we need k = ⌈ log_{2} ... | from sys import stdin
n, i = map(int, stdin.readline().split())
a = list(map(int, stdin.readline().split()))
i *= 8
K = 2 ** (i // n)
a.sort()
b = []
for i in a:
if not b or b[-1][0] != i:
b.append([i, 0])
b[-1][1] += 1
current = 0
for i in range(K, len(b)):
current += b[i][1]
ans = current
for r i... | 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 VAR NUMBER ASSIGN VAR BIN_OP NUMBER BIN_OP VAR VAR EXPR FUNC_CALL VAR ASSIGN VAR LIST FOR VAR VAR IF VAR VAR NUMBER NUMBER VAR EXPR FUNC_CALL VAR LIST VAR NUMBER VAR NUMBER NUMBER NUMBER ASSIGN VA... |
One common way of digitalizing sound is to record sound intensity at particular time moments. For each time moment intensity is recorded as a non-negative integer. Thus we can represent a sound file as an array of n non-negative integers.
If there are exactly K distinct values in the array, then we need k = ⌈ log_{2} ... | n, I = map(int, input().split())
a = sorted(list(map(int, input().split())))
cur = 0
b = [0]
for i in range(1, n):
if a[i] != a[i - 1]:
cur += 1
b.append(cur)
r = 1
ans = int(1e18)
for l in range(len(b)):
ma = b[l] + 2 ** min(I * 8 // n, 30) - 1
while r < n and b[r] <= ma:
r += 1
ans... | ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR NUMBER ASSIGN VAR LIST NUMBER FOR VAR FUNC_CALL VAR NUMBER VAR IF VAR VAR VAR BIN_OP VAR NUMBER VAR NUMBER EXPR FUNC_CALL VAR VAR ASSIGN VAR NUMBER ASSIGN VAR FUNC_CALL VA... |
One common way of digitalizing sound is to record sound intensity at particular time moments. For each time moment intensity is recorded as a non-negative integer. Thus we can represent a sound file as an array of n non-negative integers.
If there are exactly K distinct values in the array, then we need k = ⌈ log_{2} ... | from sys import stdin, stdout
N, I = [int(x) for x in stdin.readline().split()]
arr = [int(x) for x in stdin.readline().split()]
arr.sort()
bits = I * 8
bound = bits // N
if bound >= 50:
bound = 50
max_K = 2**bound
freq = []
f = 0
last = arr[0]
for num in arr:
if num == last:
f += 1
else:
f... | 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 EXPR FUNC_CALL VAR ASSIGN VAR BIN_OP VAR NUMBER ASSIGN VAR BIN_OP VAR VAR IF VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR BIN_OP NUMBER VAR ASSIGN VAR LIST ASSIGN VAR NUMBER ASSIGN VAR VAR NUMBER FOR VAR VAR... |
One common way of digitalizing sound is to record sound intensity at particular time moments. For each time moment intensity is recorded as a non-negative integer. Thus we can represent a sound file as an array of n non-negative integers.
If there are exactly K distinct values in the array, then we need k = ⌈ log_{2} ... | n, I = [int(i) for i in input().split()]
l1 = [int(i) for i in input().split()]
k = 8 * I // n
K = 2**k
l1.sort()
dstnct = []
dstnct.append(0)
for i in range(1, len(l1)):
if l1[i] != l1[i - 1]:
dstnct.append(i)
if len(dstnct) <= K:
print(0)
else:
print(n - max(dstnct[i + K] - dstnct[i] for i in rang... | 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 BIN_OP BIN_OP NUMBER VAR VAR ASSIGN VAR BIN_OP NUMBER VAR EXPR FUNC_CALL VAR ASSIGN VAR LIST EXPR FUNC_CALL VAR NUMBER FOR VAR FUNC_CALL VAR NUMBER FUNC_CALL VAR VAR IF VAR VAR VAR BIN_OP VAR... |
One common way of digitalizing sound is to record sound intensity at particular time moments. For each time moment intensity is recorded as a non-negative integer. Thus we can represent a sound file as an array of n non-negative integers.
If there are exactly K distinct values in the array, then we need k = ⌈ log_{2} ... | from itertools import accumulate
n, l = map(int, input().split())
a = [*map(int, input().split())]
a.sort()
p = 8 * l // n
if p >= 20:
print(0)
exit()
x = 1 << p
v = []
prev = -1
for i in a:
if i != prev:
v.append(1)
else:
v[-1] += 1
prev = i
s = [0] + [*accumulate(v[::-1])]
ans = 1... | ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR LIST FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR EXPR FUNC_CALL VAR ASSIGN VAR BIN_OP BIN_OP NUMBER VAR VAR IF VAR NUMBER EXPR FUNC_CALL VAR NUMBER EXPR FUNC_CALL VAR ASSIGN VAR BIN_OP NUMBER VAR ASSIGN VAR LIST ASSIGN VAR NUMBER FOR VAR VAR IF VAR VAR E... |
One common way of digitalizing sound is to record sound intensity at particular time moments. For each time moment intensity is recorded as a non-negative integer. Thus we can represent a sound file as an array of n non-negative integers.
If there are exactly K distinct values in the array, then we need k = ⌈ log_{2} ... | n, I = map(int, input().split())
I *= 8
array = list(map(int, input().split()))
def log(x):
l = 0
while 2**l < x:
l += 1
return l
array.sort()
izn = []
d = {}
for el in array:
if el in d:
d[el] += 1
else:
d[el] = 1
izn.append(el)
f = len(izn)
j = 0
pos = 0
count =... | ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR VAR NUMBER ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR FUNC_DEF ASSIGN VAR NUMBER WHILE BIN_OP NUMBER VAR VAR VAR NUMBER RETURN VAR EXPR FUNC_CALL VAR ASSIGN VAR LIST ASSIGN VAR DICT FOR VAR VAR IF VAR VAR VAR VAR NUMBER ASSIGN VAR VAR NUMB... |
One common way of digitalizing sound is to record sound intensity at particular time moments. For each time moment intensity is recorded as a non-negative integer. Thus we can represent a sound file as an array of n non-negative integers.
If there are exactly K distinct values in the array, then we need k = ⌈ log_{2} ... | import sys
n, I = [int(i) for i in input().split()]
num = 1 << 8 * I // n
data = [int(i) for i in input().split()]
dic = {}
for d in data:
if d in dic:
dic[d] += 1
else:
dic[d] = 1
if 8 * I < n:
print(n - max(dic.values()))
sys.exit()
vals = list(dic.keys())
vals.sort()
am = len(vals)
i... | IMPORT ASSIGN VAR VAR FUNC_CALL VAR VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR BIN_OP NUMBER BIN_OP BIN_OP NUMBER VAR VAR ASSIGN VAR FUNC_CALL VAR VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR DICT FOR VAR VAR IF VAR VAR VAR VAR NUMBER ASSIGN VAR VAR NUMBER IF BIN_OP NUMBER VAR VAR EXPR FUNC_CALL VAR BIN_OP VAR FUNC_CALL ... |
One common way of digitalizing sound is to record sound intensity at particular time moments. For each time moment intensity is recorded as a non-negative integer. Thus we can represent a sound file as an array of n non-negative integers.
If there are exactly K distinct values in the array, then we need k = ⌈ log_{2} ... | def main():
n, k = map(int, input().split())
k *= 8
a = sorted(list(map(int, input().split())))
a1 = [a[0]]
for i in range(1, n):
if a[i] != a[i - 1]:
a1.append(a[i])
count = k // n
ans = pow(2, count)
b = {}
for i in range(len(a1)):
b[a1[i]] = i
c = [... | FUNC_DEF ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR VAR NUMBER ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR LIST VAR NUMBER FOR VAR FUNC_CALL VAR NUMBER VAR IF VAR VAR VAR BIN_OP VAR NUMBER EXPR FUNC_CALL VAR VAR VAR ASSIGN VAR BIN_OP VAR VAR ASSIGN VAR FUNC_... |
One common way of digitalizing sound is to record sound intensity at particular time moments. For each time moment intensity is recorded as a non-negative integer. Thus we can represent a sound file as an array of n non-negative integers.
If there are exactly K distinct values in the array, then we need k = ⌈ log_{2} ... | import sys
from itertools import accumulate
sys.setrecursionlimit(10**9)
input = sys.stdin.readline
N, K = map(int, input().split())
A = list(map(int, input().split()))
A = sorted(A)
L = []
prev = -1
for a in A:
if a == prev:
L[-1] += 1
else:
L.append(1)
prev = a
max_types = int(2 ** (8... | IMPORT EXPR FUNC_CALL VAR BIN_OP NUMBER NUMBER ASSIGN 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 VAR ASSIGN VAR LIST ASSIGN VAR NUMBER FOR VAR VAR IF VAR VAR VAR NUMBER NUMBER EXPR FUNC_CALL VAR NUMBER ASSI... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.