description stringlengths 171 4k | code stringlengths 94 3.98k | normalized_code stringlengths 57 4.99k |
|---|---|---|
The Central Company has an office with a sophisticated security system. There are $10^6$ employees, numbered from $1$ to $10^6$.
The security system logs entrances and departures. The entrance of the $i$-th employee is denoted by the integer $i$, while the departure of the $i$-th employee is denoted by the integer $-i... | input()
t = {0}
i = s = 0
r = [0]
for x in map(int, input().split()):
if (x > 0) & (x in t) | (x < 0) ^ (-abs(x) in t):
r = (-1,)
break
if x > 0:
t |= {x, -x}
else:
t -= {x}
i += 1
s += x
if s == 0:
r[0] += 1
r += (i,)
t = {0}
i = 0... | EXPR FUNC_CALL VAR ASSIGN VAR NUMBER ASSIGN VAR VAR NUMBER ASSIGN VAR LIST NUMBER FOR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR IF BIN_OP BIN_OP VAR NUMBER VAR VAR BIN_OP VAR NUMBER FUNC_CALL VAR VAR VAR ASSIGN VAR NUMBER IF VAR NUMBER VAR VAR VAR VAR VAR VAR NUMBER VAR VAR IF VAR NUMBER VAR NUMBER NUMBER VAR VAR A... |
The Central Company has an office with a sophisticated security system. There are $10^6$ employees, numbered from $1$ to $10^6$.
The security system logs entrances and departures. The entrance of the $i$-th employee is denoted by the integer $i$, while the departure of the $i$-th employee is denoted by the integer $-i... | n = int(input())
array = list(map(int, input().strip().split()))
s = []
value = 0
d = {}
already_visited = set()
for i in array:
value += 1
if i > 0:
if i not in d and i not in already_visited:
d[i] = 1
else:
print(-1)
exit(0)
else:
i = abs(i)
... | 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 LIST ASSIGN VAR NUMBER ASSIGN VAR DICT ASSIGN VAR FUNC_CALL VAR FOR VAR VAR VAR NUMBER IF VAR NUMBER IF VAR VAR VAR VAR ASSIGN VAR VAR NUMBER EXPR FUNC_CALL VAR NUMBER EXPR FUNC_CALL VAR NUMBER... |
The Central Company has an office with a sophisticated security system. There are $10^6$ employees, numbered from $1$ to $10^6$.
The security system logs entrances and departures. The entrance of the $i$-th employee is denoted by the integer $i$, while the departure of the $i$-th employee is denoted by the integer $-i... | def readint():
return int(input())
def readlistint():
return list(map(int, input().split()))
def readgridint(rows):
grid = []
for idx in range(rows):
col = list(map(int, input().split()))
grid.append(col)
return grid
def main():
N = readint()
notes = readlistint()
n... | FUNC_DEF RETURN FUNC_CALL VAR FUNC_CALL VAR FUNC_DEF RETURN FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR FUNC_DEF ASSIGN VAR LIST FOR VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR EXPR FUNC_CALL VAR VAR RETURN VAR FUNC_DEF ASSIGN VAR FUNC_CALL VAR ASSIGN VAR FUNC_CA... |
The Central Company has an office with a sophisticated security system. There are $10^6$ employees, numbered from $1$ to $10^6$.
The security system logs entrances and departures. The entrance of the $i$-th employee is denoted by the integer $i$, while the departure of the $i$-th employee is denoted by the integer $-i... | import sys
n = int(input())
a = list(map(int, input().split()))
if sum(a) is not 0:
print(-1)
exit()
if n == 1:
print(-1)
else:
s = 0
ans = []
e = {}
exist = {}
possible = True
for i in range(n):
if abs(a[i]) not in exist:
if a[i] < 0:
possible = ... | IMPORT ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR IF FUNC_CALL VAR VAR NUMBER EXPR FUNC_CALL VAR NUMBER EXPR FUNC_CALL VAR IF VAR NUMBER EXPR FUNC_CALL VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR LIST ASSIGN VAR DICT ASSIGN VAR DICT ASSIGN VAR NUMBER FOR VAR FU... |
The Central Company has an office with a sophisticated security system. There are $10^6$ employees, numbered from $1$ to $10^6$.
The security system logs entrances and departures. The entrance of the $i$-th employee is denoted by the integer $i$, while the departure of the $i$-th employee is denoted by the integer $-i... | n = int(input())
a = list(map(int, input().split()))
s = set()
vis = set()
ans = []
flag = 1
last = -1
for i in range(n):
if a[i] > 0:
if a[i] in s:
flag = 0
break
if a[i] in vis:
if len(s) != 0:
flag = 0
break
vis.add(a[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 FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR ASSIGN VAR LIST ASSIGN VAR NUMBER ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR VAR IF VAR VAR NUMBER IF VAR VAR VAR ASSIGN VAR NUMBER IF VAR VAR VAR IF FUNC_CALL VAR VAR... |
The Central Company has an office with a sophisticated security system. There are $10^6$ employees, numbered from $1$ to $10^6$.
The security system logs entrances and departures. The entrance of the $i$-th employee is denoted by the integer $i$, while the departure of the $i$-th employee is denoted by the integer $-i... | already_today = [0] * 1000005
in_office = 0
ans = []
pool = []
n = int(input())
meta = [int(x) for x in input().split()]
def finish():
print(-1)
exit(0)
def next_day():
ans.append(len(pool) * 2)
for i in pool:
already_today[i] = 0
pool.clear()
for worker in meta:
if worker > 0:
... | ASSIGN VAR BIN_OP LIST NUMBER NUMBER ASSIGN VAR NUMBER ASSIGN VAR LIST ASSIGN VAR LIST ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR VAR FUNC_CALL FUNC_CALL VAR FUNC_DEF EXPR FUNC_CALL VAR NUMBER EXPR FUNC_CALL VAR NUMBER FUNC_DEF EXPR FUNC_CALL VAR BIN_OP FUNC_CALL VAR VAR NUMBER FOR VAR VAR ASSI... |
The Central Company has an office with a sophisticated security system. There are $10^6$ employees, numbered from $1$ to $10^6$.
The security system logs entrances and departures. The entrance of the $i$-th employee is denoted by the integer $i$, while the departure of the $i$-th employee is denoted by the integer $-i... | n = int(input())
events = input().split()
ev = []
for k in range(n):
ev.append(int(events[k]))
sub = set()
result = []
a = True
summ = 0
for i in ev:
if a:
if i > 0 and i not in sub:
sub.add(i)
summ += i
elif i < 0 and i * -1 not in sub or i < 0 and i in sub:
... | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR LIST FOR VAR FUNC_CALL VAR VAR EXPR FUNC_CALL VAR FUNC_CALL VAR VAR VAR ASSIGN VAR FUNC_CALL VAR ASSIGN VAR LIST ASSIGN VAR NUMBER ASSIGN VAR NUMBER FOR VAR VAR IF VAR IF VAR NUMBER VAR VAR EXPR FUNC_CALL VAR VAR VAR VAR IF VAR NUMBER ... |
The Central Company has an office with a sophisticated security system. There are $10^6$ employees, numbered from $1$ to $10^6$.
The security system logs entrances and departures. The entrance of the $i$-th employee is denoted by the integer $i$, while the departure of the $i$-th employee is denoted by the integer $-i... | n = int(input())
data = list(map(int, input().split()))
kd = 0
mn1 = set()
mn2 = set()
sb = 0
sb_data = []
for i in range(len(data)):
sb += 1
if data[i] > 0:
if data[i] in mn1:
print(-1)
break
else:
mn1.add(data[i])
mn2.add(data[i])
elif data[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 NUMBER ASSIGN VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR ASSIGN VAR NUMBER ASSIGN VAR LIST FOR VAR FUNC_CALL VAR FUNC_CALL VAR VAR VAR NUMBER IF VAR VAR NUMBER IF VAR VAR VAR EXPR FUNC_CALL VAR NUMBER EX... |
The Central Company has an office with a sophisticated security system. There are $10^6$ employees, numbered from $1$ to $10^6$.
The security system logs entrances and departures. The entrance of the $i$-th employee is denoted by the integer $i$, while the departure of the $i$-th employee is denoted by the integer $-i... | n = int(input())
a = list(map(int, input().split()))
s = set()
c = set()
ans = []
last = 0
for i, v in enumerate(a):
if v > 0:
if v in s or v in c:
ans = "BAD"
break
s.add(v)
else:
v *= -1
if v not in s:
ans = "BAD"
break
s.... | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR ASSIGN VAR LIST ASSIGN VAR NUMBER FOR VAR VAR FUNC_CALL VAR VAR IF VAR NUMBER IF VAR VAR VAR VAR ASSIGN VAR STRING EXPR FUNC_CALL VAR VAR VAR NUMBER IF VAR VAR ASSI... |
The Central Company has an office with a sophisticated security system. There are $10^6$ employees, numbered from $1$ to $10^6$.
The security system logs entrances and departures. The entrance of the $i$-th employee is denoted by the integer $i$, while the departure of the $i$-th employee is denoted by the integer $-i... | n = int(input())
l = list(map(int, input().split()))
d = {}
length = 0
ans = []
s = 0
for i in l:
s += i
length += 1
if i > 0:
if i in d:
print(-1)
exit()
else:
d[i] = 0
elif -1 * i not in d:
print(-1)
exit()
elif d[-1 * i] == 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 DICT ASSIGN VAR NUMBER ASSIGN VAR LIST ASSIGN VAR NUMBER FOR VAR VAR VAR VAR VAR NUMBER IF VAR NUMBER IF VAR VAR EXPR FUNC_CALL VAR NUMBER EXPR FUNC_CALL VAR ASSIGN VAR VAR NUMBER IF BIN_OP NUMBER VAR VA... |
The Central Company has an office with a sophisticated security system. There are $10^6$ employees, numbered from $1$ to $10^6$.
The security system logs entrances and departures. The entrance of the $i$-th employee is denoted by the integer $i$, while the departure of the $i$-th employee is denoted by the integer $-i... | n = int(input())
a = list(map(int, input().split()))
ans = []
now_in = set()
was = set()
summ = 0
last = 0
t = 0
for i in range(n):
summ += a[i]
if a[i] > 0:
if a[i] not in was:
now_in.add(a[i])
was.add(a[i])
else:
t = 1
break
else:
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 LIST ASSIGN VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR ASSIGN VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR VAR VAR VAR VAR IF VAR VAR NUMBER IF VAR VAR VAR EXPR FUNC_CALL VAR VAR ... |
The Central Company has an office with a sophisticated security system. There are $10^6$ employees, numbered from $1$ to $10^6$.
The security system logs entrances and departures. The entrance of the $i$-th employee is denoted by the integer $i$, while the departure of the $i$-th employee is denoted by the integer $-i... | n = int(input())
l = list(map(int, input().split()))
d = {}
days = []
s = 0
c = 0
for i in range(len(l)):
if l[i] > 0:
if l[i] in d:
print(-1)
break
d[l[i]] = False
s += l[i]
else:
if -1 * l[i] not in d:
print(-1)
break
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 DICT ASSIGN VAR LIST ASSIGN VAR NUMBER ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR FUNC_CALL VAR VAR IF VAR VAR NUMBER IF VAR VAR VAR EXPR FUNC_CALL VAR NUMBER ASSIGN VAR VAR VAR NUMBER VAR VAR VAR IF BIN_OP... |
The Central Company has an office with a sophisticated security system. There are $10^6$ employees, numbered from $1$ to $10^6$.
The security system logs entrances and departures. The entrance of the $i$-th employee is denoted by the integer $i$, while the departure of the $i$-th employee is denoted by the integer $-i... | def modulo(x):
if x >= 0:
return x
else:
return -x
def verificar_dicionario(dicionario):
for valor in dicionario.values():
if valor == 0:
return False
return True
def regras(lista):
lista_dias = []
dicionario = {}
flag = 0
contador_dias = 0
for... | FUNC_DEF IF VAR NUMBER RETURN VAR RETURN VAR FUNC_DEF FOR VAR FUNC_CALL VAR IF VAR NUMBER RETURN NUMBER RETURN NUMBER FUNC_DEF ASSIGN VAR LIST ASSIGN VAR DICT ASSIGN VAR NUMBER ASSIGN VAR NUMBER FOR VAR VAR IF VAR NUMBER IF VAR VAR RETURN NUMBER NUMBER ASSIGN VAR VAR NUMBER ASSIGN VAR NUMBER IF FUNC_CALL VAR VAR VAR RE... |
The Central Company has an office with a sophisticated security system. There are $10^6$ employees, numbered from $1$ to $10^6$.
The security system logs entrances and departures. The entrance of the $i$-th employee is denoted by the integer $i$, while the departure of the $i$-th employee is denoted by the integer $-i... | n = int(input())
w = [int(k) for k in input().split()]
j = 0
c = 0
x = 0
res = []
check = 0
q, e = {}, {}
while j < n:
x += 1
if w[j] > 0:
c += 1
if w[j] not in q:
q[w[j]] = 1
else:
check = 1
break
else:
c -= 1
if -w[j] not in e and... | ASSIGN VAR FUNC_CALL VAR 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 LIST ASSIGN VAR NUMBER ASSIGN VAR VAR DICT DICT WHILE VAR VAR VAR NUMBER IF VAR VAR NUMBER VAR NUMBER IF VAR VAR VAR ASSIGN VAR VAR VAR NUMBER ASSIGN VAR NUMBE... |
The Central Company has an office with a sophisticated security system. There are $10^6$ employees, numbered from $1$ to $10^6$.
The security system logs entrances and departures. The entrance of the $i$-th employee is denoted by the integer $i$, while the departure of the $i$-th employee is denoted by the integer $-i... | def validset(S):
for e in S:
if -1 * e not in S:
return False
return True
def spliti(L):
s = 0
t = set()
u = 0
M = [0]
for i in range(0, n):
t.add(L[i])
s += L[i]
if s < 0:
return [0]
elif s == 0:
if len(t) == i + ... | FUNC_DEF FOR VAR VAR IF BIN_OP NUMBER VAR VAR RETURN NUMBER RETURN NUMBER FUNC_DEF ASSIGN VAR NUMBER ASSIGN VAR FUNC_CALL VAR ASSIGN VAR NUMBER ASSIGN VAR LIST NUMBER FOR VAR FUNC_CALL VAR NUMBER VAR EXPR FUNC_CALL VAR VAR VAR VAR VAR VAR IF VAR NUMBER RETURN LIST NUMBER IF VAR NUMBER IF FUNC_CALL VAR VAR BIN_OP BIN_OP... |
The Central Company has an office with a sophisticated security system. There are $10^6$ employees, numbered from $1$ to $10^6$.
The security system logs entrances and departures. The entrance of the $i$-th employee is denoted by the integer $i$, while the departure of the $i$-th employee is denoted by the integer $-i... | n = int(input())
ls = [int(x) for x in input().split()]
su = 0
d = dict()
ans = []
k = 0
f = 0
for i in ls:
if i > 0 and abs(i) in d:
f = 1
break
elif i < 0 and abs(i) not in d:
f = 1
break
else:
su += i
d[abs(i)] = 1
if su == 0:
su = 0
... | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR NUMBER ASSIGN VAR FUNC_CALL VAR ASSIGN VAR LIST ASSIGN VAR NUMBER ASSIGN VAR NUMBER FOR VAR VAR IF VAR NUMBER FUNC_CALL VAR VAR VAR ASSIGN VAR NUMBER IF VAR NUMBER FUNC_CALL VAR VAR VAR ASSIGN VAR NUMBER VAR VAR A... |
The Central Company has an office with a sophisticated security system. There are $10^6$ employees, numbered from $1$ to $10^6$.
The security system logs entrances and departures. The entrance of the $i$-th employee is denoted by the integer $i$, while the departure of the $i$-th employee is denoted by the integer $-i... | n = int(input())
it = list(map(int, input().split()))
ss = set()
tt = set()
ans = [0]
for i in it:
if i > 0 and i in tt:
ans.append(1)
if ss != set():
ans = -1
break
ss = set([i])
tt = set([i])
continue
if i > 0 and i not in tt:
ans[-1] += ... | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR ASSIGN VAR LIST NUMBER FOR VAR VAR IF VAR NUMBER VAR VAR EXPR FUNC_CALL VAR NUMBER IF VAR FUNC_CALL VAR ASSIGN VAR NUMBER ASSIGN VAR FUNC_CALL VAR LIST VAR ASSIGN V... |
The Central Company has an office with a sophisticated security system. There are $10^6$ employees, numbered from $1$ to $10^6$.
The security system logs entrances and departures. The entrance of the $i$-th employee is denoted by the integer $i$, while the departure of the $i$-th employee is denoted by the integer $-i... | n = int(input())
A = [int(x) for x in input().split()]
inside = set()
same_day = set()
d = 0
r = []
for x in A:
d += 1
if x > 0:
if x in inside or x in same_day:
break
else:
inside.add(x)
same_day.add(x)
elif abs(x) not in inside:
inside.add(0)
... | 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 ASSIGN VAR FUNC_CALL VAR ASSIGN VAR NUMBER ASSIGN VAR LIST FOR VAR VAR VAR NUMBER IF VAR NUMBER IF VAR VAR VAR VAR EXPR FUNC_CALL VAR VAR EXPR FUNC_CALL VAR VAR IF FUNC_CALL VAR VAR VAR EXPR FUNC_CAL... |
The Central Company has an office with a sophisticated security system. There are $10^6$ employees, numbered from $1$ to $10^6$.
The security system logs entrances and departures. The entrance of the $i$-th employee is denoted by the integer $i$, while the departure of the $i$-th employee is denoted by the integer $-i... | n = int(input())
a = list(map(int, input().split()))
if n % 2 != 0:
print(-1)
else:
res = []
sum = 0
lt = 0
d = dict()
for i in range(n):
if a[i] < 0:
tot = abs(a[i])
if d.get(tot, 0) == 1 and d.get(a[i], 0) != 1:
sum += a[i]
d[a[i]... | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR IF BIN_OP VAR NUMBER NUMBER EXPR FUNC_CALL VAR NUMBER ASSIGN VAR LIST ASSIGN VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR FUNC_CALL VAR FOR VAR FUNC_CALL VAR VAR IF VAR VAR NUMBER ASSIGN VAR FUNC_CALL VAR VAR VAR IF FUN... |
The Central Company has an office with a sophisticated security system. There are $10^6$ employees, numbered from $1$ to $10^6$.
The security system logs entrances and departures. The entrance of the $i$-th employee is denoted by the integer $i$, while the departure of the $i$-th employee is denoted by the integer $-i... | n = int(input())
A = list(map(int, input().split()))
s = []
B = []
archive = []
counter = 0
for i in range(n):
counter += 1
if A[i] < 0:
if -A[i] in s:
del s[s.index(-A[i])]
if s == []:
B.append(counter)
archive = []
counter = 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 LIST ASSIGN VAR LIST ASSIGN VAR LIST ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR VAR VAR NUMBER IF VAR VAR NUMBER IF VAR VAR VAR VAR FUNC_CALL VAR VAR VAR IF VAR LIST EXPR FUNC_CALL VAR VAR ASSIGN VAR LIST A... |
The Central Company has an office with a sophisticated security system. There are $10^6$ employees, numbered from $1$ to $10^6$.
The security system logs entrances and departures. The entrance of the $i$-th employee is denoted by the integer $i$, while the departure of the $i$-th employee is denoted by the integer $-i... | n = int(input())
a = list(map(int, input().split()))
l = set()
f1 = []
f = 0
d = 0
l1 = set()
c = 0
for i in range(n):
c += 1
if a[i] > 0:
if a[i] in l1:
f = 1
break
l.add(a[i])
l1.add(a[i])
elif abs(a[i]) in l:
l.remove(abs(a[i]))
else:
f ... | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR ASSIGN VAR LIST ASSIGN VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR FUNC_CALL VAR ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR VAR VAR NUMBER IF VAR VAR NUMBER IF VAR VAR VAR ASSIGN VAR NUMBER EXPR F... |
The Central Company has an office with a sophisticated security system. There are $10^6$ employees, numbered from $1$ to $10^6$.
The security system logs entrances and departures. The entrance of the $i$-th employee is denoted by the integer $i$, while the departure of the $i$-th employee is denoted by the integer $-i... | n = int(input())
arr = list(map(int, input().split()))
state = [(0) for i in range(10**6 + 10)]
def solve(arr):
ofs = 0
printer = []
changer = []
for num in arr:
emp = abs(num)
changer.append(emp)
if num < 0:
if state[emp] == 1:
state[emp] = -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 NUMBER VAR FUNC_CALL VAR BIN_OP BIN_OP NUMBER NUMBER NUMBER FUNC_DEF ASSIGN VAR NUMBER ASSIGN VAR LIST ASSIGN VAR LIST FOR VAR VAR ASSIGN VAR FUNC_CALL VAR VAR EXPR FUNC_CALL VAR VAR IF VAR NUMBER IF VAR... |
The Central Company has an office with a sophisticated security system. There are $10^6$ employees, numbered from $1$ to $10^6$.
The security system logs entrances and departures. The entrance of the $i$-th employee is denoted by the integer $i$, while the departure of the $i$-th employee is denoted by the integer $-i... | n = int(input())
a = list(map(int, input().split()))
m = {}
ans = [0]
is_valid = True
s = 0
for i in range(n):
k = a[i]
if k < 0 and not -k in m:
is_valid = False
break
elif k in m:
is_valid = False
break
s += k
m[k] = True
if s == 0:
m.clear()
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 DICT ASSIGN VAR LIST NUMBER ASSIGN VAR NUMBER ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR VAR ASSIGN VAR VAR VAR IF VAR NUMBER VAR VAR ASSIGN VAR NUMBER IF VAR VAR ASSIGN VAR NUMBER VAR VAR ASSIGN VAR VAR NU... |
The Central Company has an office with a sophisticated security system. There are $10^6$ employees, numbered from $1$ to $10^6$.
The security system logs entrances and departures. The entrance of the $i$-th employee is denoted by the integer $i$, while the departure of the $i$-th employee is denoted by the integer $-i... | import sys
input = sys.stdin.buffer.readline
n = int(input())
ls = list(map(int, input().split()))
day, dup = {}, {}
res, cc = [], 0
for u in ls:
if u > 0 and u in dup or u < 0 and -u not in day:
break
if u > 0:
day[u], dup[u] = 1, 1
else:
day.pop(-u)
cc += 1
if not day:
... | IMPORT ASSIGN VAR VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR VAR DICT DICT ASSIGN VAR VAR LIST NUMBER FOR VAR VAR IF VAR NUMBER VAR VAR VAR NUMBER VAR VAR IF VAR NUMBER ASSIGN VAR VAR VAR VAR NUMBER NUMBER EXPR FUNC_CALL VAR VAR VAR NUMBER IF... |
The Central Company has an office with a sophisticated security system. There are $10^6$ employees, numbered from $1$ to $10^6$.
The security system logs entrances and departures. The entrance of the $i$-th employee is denoted by the integer $i$, while the departure of the $i$-th employee is denoted by the integer $-i... | N = int(input())
A = list(map(int, input().split()))
Q = []
L = [0] * (10**6 + 1)
Ans = []
cnt = 0
cnt_emp = 0
for a in A:
cnt += 1
if a > 0:
Q.append(a)
l = L[a]
if l == 0:
L[a] = 1
cnt_emp += 1
elif l == 1:
print(-1)
exit()
... | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR LIST ASSIGN VAR BIN_OP LIST NUMBER BIN_OP BIN_OP NUMBER NUMBER NUMBER ASSIGN VAR LIST ASSIGN VAR NUMBER ASSIGN VAR NUMBER FOR VAR VAR VAR NUMBER IF VAR NUMBER EXPR FUNC_CALL VAR VAR ASSIGN VAR VAR VAR IF... |
The Central Company has an office with a sophisticated security system. There are $10^6$ employees, numbered from $1$ to $10^6$.
The security system logs entrances and departures. The entrance of the $i$-th employee is denoted by the integer $i$, while the departure of the $i$-th employee is denoted by the integer $-i... | n = int(input())
a = list(map(int, input().split()))
dic = {}
flag = "ok"
count = 0
tot = 0
res = []
for i in a:
if i > 0:
try:
if dic[i] >= 0:
flag = "dismiss"
break
except KeyError:
dic[i] = 1
count += 1
else:
try:
... | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR DICT ASSIGN VAR STRING ASSIGN VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR LIST FOR VAR VAR IF VAR NUMBER IF VAR VAR NUMBER ASSIGN VAR STRING VAR ASSIGN VAR VAR NUMBER VAR NUMBER IF VAR FUNC_CALL VAR VAR NUMB... |
The Central Company has an office with a sophisticated security system. There are $10^6$ employees, numbered from $1$ to $10^6$.
The security system logs entrances and departures. The entrance of the $i$-th employee is denoted by the integer $i$, while the departure of the $i$-th employee is denoted by the integer $-i... | n = int(input())
li = list(map(int, input().split()))
dic = {}
ans = []
valid = True
add = 0
count = 0
le = 0
for i in range(n):
val = dic.get(li[i], -1)
if val == -1:
if li[i] > 0:
dic.update({li[i]: 1})
add += li[i]
count += 1
else:
temp = dic.ge... | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR DICT ASSIGN VAR LIST ASSIGN VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR VAR VAR NUMBER IF VAR NUMBER IF VAR VAR NUMBER EXPR FUNC_CA... |
The Central Company has an office with a sophisticated security system. There are $10^6$ employees, numbered from $1$ to $10^6$.
The security system logs entrances and departures. The entrance of the $i$-th employee is denoted by the integer $i$, while the departure of the $i$-th employee is denoted by the integer $-i... | n = int(input())
arr = list(map(int, input().split(" ")))
ans = 1
per_day = {}
pointer = 0
result_n = 0
result_nums = []
k = 1
for ind, i in enumerate(arr):
if i > 0 and not i in per_day:
per_day[i] = 1
pointer += 1
elif i < 0:
if abs(i) in per_day and per_day[abs(i)]:
pointe... | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR STRING ASSIGN VAR NUMBER ASSIGN VAR DICT ASSIGN VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR LIST ASSIGN VAR NUMBER FOR VAR VAR FUNC_CALL VAR VAR IF VAR NUMBER VAR VAR ASSIGN VAR VAR NUMBER VAR NUMBER IF VAR NUMBER IF F... |
The Central Company has an office with a sophisticated security system. There are $10^6$ employees, numbered from $1$ to $10^6$.
The security system logs entrances and departures. The entrance of the $i$-th employee is denoted by the integer $i$, while the departure of the $i$-th employee is denoted by the integer $-i... | n = int(input())
days_log = list(map(int, input().strip().split()))
if days_log[0] <= 0 or days_log[-1] >= 0 or n % 2 != 0:
print("-1")
else:
noofdays = 0
events = []
no = 0
event_dict = {}
for e in days_log:
if e > 0:
if e in event_dict.keys():
if all(event_d... | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL FUNC_CALL VAR IF VAR NUMBER NUMBER VAR NUMBER NUMBER BIN_OP VAR NUMBER NUMBER EXPR FUNC_CALL VAR STRING ASSIGN VAR NUMBER ASSIGN VAR LIST ASSIGN VAR NUMBER ASSIGN VAR DICT FOR VAR VAR IF VAR NUMBER IF VAR FUNC_CALL VAR... |
The Central Company has an office with a sophisticated security system. There are $10^6$ employees, numbered from $1$ to $10^6$.
The security system logs entrances and departures. The entrance of the $i$-th employee is denoted by the integer $i$, while the departure of the $i$-th employee is denoted by the integer $-i... | import sys
input = sys.stdin.readline
N = int(input())
A = list(map(int, input().split()))
ok = True
checked = [0] * (10**6 + 1)
ans = []
ind = 0
used = set()
c = 0
for i, a in enumerate(A):
if a > 0:
if checked[a] == 0:
if a in used:
ok = False
break
... | IMPORT ASSIGN VAR VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR NUMBER ASSIGN VAR BIN_OP LIST NUMBER BIN_OP BIN_OP NUMBER NUMBER NUMBER ASSIGN VAR LIST ASSIGN VAR NUMBER ASSIGN VAR FUNC_CALL VAR ASSIGN VAR NUMBER FOR VAR VAR FUNC_CALL VAR VAR IF... |
The Central Company has an office with a sophisticated security system. There are $10^6$ employees, numbered from $1$ to $10^6$.
The security system logs entrances and departures. The entrance of the $i$-th employee is denoted by the integer $i$, while the departure of the $i$-th employee is denoted by the integer $-i... | import sys
n = int(sys.stdin.readline())
arr = list(map(int, sys.stdin.readline().split()))
seen = set([])
mustExit = set([])
result = []
last = 0
ok = True
ff = False
for i in range(n):
if arr[i] > 0 and arr[i] not in seen:
if len(mustExit) == 0 and ff:
result.append(arr[last:i])
m... | IMPORT 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 LIST ASSIGN VAR FUNC_CALL VAR LIST ASSIGN VAR LIST ASSIGN VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR VAR IF VAR VAR NUMBER VAR VAR VAR IF FUNC_CALL VAR VAR ... |
The Central Company has an office with a sophisticated security system. There are $10^6$ employees, numbered from $1$ to $10^6$.
The security system logs entrances and departures. The entrance of the $i$-th employee is denoted by the integer $i$, while the departure of the $i$-th employee is denoted by the integer $-i... | from sys import stdin, stdout
def is_valid(a):
m = []
for i in range(len(a)):
if a[i] > 0:
if a[i] in m:
return False
else:
m.append(a[i])
elif abs(a[i]) not in m:
return False
return True
n = int(stdin.readline().rstrip... | FUNC_DEF ASSIGN VAR LIST FOR VAR FUNC_CALL VAR FUNC_CALL VAR VAR IF VAR VAR NUMBER IF VAR VAR VAR RETURN NUMBER EXPR FUNC_CALL VAR VAR VAR IF FUNC_CALL VAR VAR VAR VAR RETURN NUMBER RETURN NUMBER ASSIGN VAR FUNC_CALL VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR VAR FUNC_CALL FUNC_CALL FUNC_CALL VAR ASSIGN V... |
The Central Company has an office with a sophisticated security system. There are $10^6$ employees, numbered from $1$ to $10^6$.
The security system logs entrances and departures. The entrance of the $i$-th employee is denoted by the integer $i$, while the departure of the $i$-th employee is denoted by the integer $-i... | from sys import stdin
input = stdin.readline
n = int(input())
a = list(map(int, input().split()))
sta = [0] * 1000005
now = []
ans = []
has = []
def restart():
ans.append(2 * len(has))
for i in has:
sta[i] = 0
has.clear()
def finish():
print(-1)
exit(0)
sum = 0
for i in a:
if i > ... | ASSIGN VAR VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR BIN_OP LIST NUMBER NUMBER ASSIGN VAR LIST ASSIGN VAR LIST ASSIGN VAR LIST FUNC_DEF EXPR FUNC_CALL VAR BIN_OP NUMBER FUNC_CALL VAR VAR FOR VAR VAR ASSIGN VAR VAR NUMBER EXPR FUNC_CALL VAR F... |
The Central Company has an office with a sophisticated security system. There are $10^6$ employees, numbered from $1$ to $10^6$.
The security system logs entrances and departures. The entrance of the $i$-th employee is denoted by the integer $i$, while the departure of the $i$-th employee is denoted by the integer $-i... | n = int(input())
lst = [int(i) for i in input().split()]
result = list()
c, answer = 0, 0
s, d = set(), set()
if n % 2:
answer = 1
else:
for elem in lst:
c += 1
if elem > 0:
if elem in d:
answer = 1
break
else:
s.add(elem)
... | 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 ASSIGN VAR VAR NUMBER NUMBER ASSIGN VAR VAR FUNC_CALL VAR FUNC_CALL VAR IF BIN_OP VAR NUMBER ASSIGN VAR NUMBER FOR VAR VAR VAR NUMBER IF VAR NUMBER IF VAR VAR ASSIGN VAR NUMBER EXPR FUNC_CALL VAR VAR... |
The Central Company has an office with a sophisticated security system. There are $10^6$ employees, numbered from $1$ to $10^6$.
The security system logs entrances and departures. The entrance of the $i$-th employee is denoted by the integer $i$, while the departure of the $i$-th employee is denoted by the integer $-i... | import sys
Ri = lambda: [int(x) for x in sys.stdin.readline().split()]
ri = lambda: sys.stdin.readline().strip()
def input():
return sys.stdin.readline().strip()
def list2d(a, b, c):
return [([c] * b) for i in range(a)]
def list3d(a, b, c, d):
return [[([d] * c) for j in range(b)] for i in range(a)]
... | IMPORT ASSIGN VAR FUNC_CALL VAR VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL FUNC_CALL VAR FUNC_DEF RETURN FUNC_CALL FUNC_CALL VAR FUNC_DEF RETURN BIN_OP LIST VAR VAR VAR FUNC_CALL VAR VAR FUNC_DEF RETURN BIN_OP LIST VAR VAR VAR FUNC_CALL VAR VAR VAR FUNC_CALL VAR VAR FUNC_DEF RETURN BIN_OP LIST VAR VAR VAR FUN... |
The Central Company has an office with a sophisticated security system. There are $10^6$ employees, numbered from $1$ to $10^6$.
The security system logs entrances and departures. The entrance of the $i$-th employee is denoted by the integer $i$, while the departure of the $i$-th employee is denoted by the integer $-i... | ans = []
N = int(input())
arr = list(map(int, input().split()))
count = set()
balance = 0
start = 0
possible = True
for ind, val in enumerate(arr):
if val > 0:
balance += 1
if val in count:
possible = False
break
else:
count.add(val)
else:
if v... | ASSIGN VAR LIST ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR ASSIGN VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR NUMBER FOR VAR VAR FUNC_CALL VAR VAR IF VAR NUMBER VAR NUMBER IF VAR VAR ASSIGN VAR NUMBER EXPR FUNC_CALL VAR VAR IF VAR VAR F... |
The Central Company has an office with a sophisticated security system. There are $10^6$ employees, numbered from $1$ to $10^6$.
The security system logs entrances and departures. The entrance of the $i$-th employee is denoted by the integer $i$, while the departure of the $i$-th employee is denoted by the integer $-i... | n = int(input())
l = list(map(int, input().split()))
c = 0
x = [0] * 10**6
flag = 1
events = 0
e = []
inside = 0
ind = 0
for i in range(n):
events += 1
if l[i] > 0:
t = x[l[i] - 1]
if t == 0:
x[l[i] - 1] += 1
inside += 1
elif t == 1:
flag = 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 NUMBER ASSIGN VAR BIN_OP LIST NUMBER BIN_OP NUMBER NUMBER ASSIGN VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR LIST ASSIGN VAR NUMBER ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR VAR VAR NUMBER IF VAR VAR NUMBER AS... |
The Central Company has an office with a sophisticated security system. There are $10^6$ employees, numbered from $1$ to $10^6$.
The security system logs entrances and departures. The entrance of the $i$-th employee is denoted by the integer $i$, while the departure of the $i$-th employee is denoted by the integer $-i... | import sys
n = int(input())
a = list(map(int, sys.stdin.readline().split()))
p = 0
q = 0
f = 0
d = {}
an = []
for j in range(n):
p = p + a[j]
if a[j] < 0:
if abs(a[j]) not in d:
f = 1
elif a[j] not in d:
d[a[j]] = 1
else:
f = 1
if p != 0:
q = q + 1
el... | IMPORT ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR DICT ASSIGN VAR LIST FOR VAR FUNC_CALL VAR VAR ASSIGN VAR BIN_OP VAR VAR VAR IF VAR VAR NUMBER IF FUNC_CALL VAR VAR VAR VAR ASSIGN VAR NUMBER ... |
The Central Company has an office with a sophisticated security system. There are $10^6$ employees, numbered from $1$ to $10^6$.
The security system logs entrances and departures. The entrance of the $i$-th employee is denoted by the integer $i$, while the departure of the $i$-th employee is denoted by the integer $-i... | n = int(input())
events = list(map(int, input().split()))
days = 0
number_events = []
events_set = set()
sum_until_now = 0
entered_that_day = set()
for i in range(n):
if i == 0 and events[i] < 0:
days = -1
break
if events[i] > 0:
if events[i] in entered_that_day:
days = -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 NUMBER ASSIGN VAR LIST ASSIGN VAR FUNC_CALL VAR ASSIGN VAR NUMBER ASSIGN VAR FUNC_CALL VAR FOR VAR FUNC_CALL VAR VAR IF VAR NUMBER VAR VAR NUMBER ASSIGN VAR NUMBER IF VAR VAR NUMBER IF VAR VAR VAR ASSIGN... |
The Central Company has an office with a sophisticated security system. There are $10^6$ employees, numbered from $1$ to $10^6$.
The security system logs entrances and departures. The entrance of the $i$-th employee is denoted by the integer $i$, while the departure of the $i$-th employee is denoted by the integer $-i... | n = int(input())
a = list(map(int, input().split()))
office = set()
c = ""
d = 0
count = 0
check = set()
can = True
for i in a:
office.add(i)
count += 1
if -i in office and i < 0:
office.remove(-i)
office.remove(i)
if len(office) == 0:
d += 1
c += str(count) + " "
... | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR ASSIGN VAR STRING ASSIGN VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR FUNC_CALL VAR ASSIGN VAR NUMBER FOR VAR VAR EXPR FUNC_CALL VAR VAR VAR NUMBER IF VAR VAR VAR NUMBER EXPR FUNC_CALL VAR VAR E... |
The Central Company has an office with a sophisticated security system. There are $10^6$ employees, numbered from $1$ to $10^6$.
The security system logs entrances and departures. The entrance of the $i$-th employee is denoted by the integer $i$, while the departure of the $i$-th employee is denoted by the integer $-i... | def main():
n = int(input())
a = list(map(int, input().split()))
num = 0
stack = 0
index = []
day = set()
for i in range(n):
e = a[i]
if i != 0:
if not stack:
day = set()
if index:
index.append(i - num)
... | FUNC_DEF ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR LIST ASSIGN VAR FUNC_CALL VAR FOR VAR FUNC_CALL VAR VAR ASSIGN VAR VAR VAR IF VAR NUMBER IF VAR ASSIGN VAR FUNC_CALL VAR IF VAR EXPR FUNC_CALL VAR BIN_OP VAR ... |
The Central Company has an office with a sophisticated security system. There are $10^6$ employees, numbered from $1$ to $10^6$.
The security system logs entrances and departures. The entrance of the $i$-th employee is denoted by the integer $i$, while the departure of the $i$-th employee is denoted by the integer $-i... | def check():
n = int(input())
order = list(map(int, input().split()))
ppl = set()
prev = -1
ans = []
visited = set()
for i, p in enumerate(order):
if p < 0:
if -p in ppl:
ppl.remove(-p)
visited.add(-p)
if not ppl:
... | FUNC_DEF ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR ASSIGN VAR NUMBER ASSIGN VAR LIST ASSIGN VAR FUNC_CALL VAR FOR VAR VAR FUNC_CALL VAR VAR IF VAR NUMBER IF VAR VAR EXPR FUNC_CALL VAR VAR EXPR FUNC_CALL VAR VAR IF VAR EXPR FUNC_CAL... |
The Central Company has an office with a sophisticated security system. There are $10^6$ employees, numbered from $1$ to $10^6$.
The security system logs entrances and departures. The entrance of the $i$-th employee is denoted by the integer $i$, while the departure of the $i$-th employee is denoted by the integer $-i... | import sys
a = [(0) for i in range(10**6)]
n = int(input())
g = list(map(int, input().split()))
if n % 2 != 0:
print(-1)
sys.exit(0)
T = True
ans = []
count = 0
t = 0
v = set()
v2 = set()
for i in g:
if i > 0:
if t == 0:
ans.append(count)
count = 1
t += 1
... | IMPORT ASSIGN VAR NUMBER VAR FUNC_CALL VAR BIN_OP NUMBER NUMBER ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR IF BIN_OP VAR NUMBER NUMBER EXPR FUNC_CALL VAR NUMBER EXPR FUNC_CALL VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR LIST ASSIGN VAR NUMBER ASSIGN VAR NUMBER ... |
The Central Company has an office with a sophisticated security system. There are $10^6$ employees, numbered from $1$ to $10^6$.
The security system logs entrances and departures. The entrance of the $i$-th employee is denoted by the integer $i$, while the departure of the $i$-th employee is denoted by the integer $-i... | n = input()
arr = list(map(int, input().split()))
def silly_mistake(n, office_log):
room = set()
day = set()
ans = []
for i in office_log:
if i > 0:
if i in room:
return [-1]
if i in day:
if not room:
ans.append(2 * le... | ASSIGN VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR FUNC_DEF ASSIGN VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR ASSIGN VAR LIST FOR VAR VAR IF VAR NUMBER IF VAR VAR RETURN LIST NUMBER IF VAR VAR IF VAR EXPR FUNC_CALL VAR BIN_OP NUMBER FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR EXP... |
The Central Company has an office with a sophisticated security system. There are $10^6$ employees, numbered from $1$ to $10^6$.
The security system logs entrances and departures. The entrance of the $i$-th employee is denoted by the integer $i$, while the departure of the $i$-th employee is denoted by the integer $-i... | def sol():
n = int(input())
d = input().split()
se = set()
dict = {}
ans = []
for i in range(n):
x = int(d[i])
if x in dict:
print("-1")
return
dict[x] = True
if x > 0:
se.add(x)
elif -x in se:
se.remove(-x)
... | FUNC_DEF ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR ASSIGN VAR DICT ASSIGN VAR LIST FOR VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR VAR VAR IF VAR VAR EXPR FUNC_CALL VAR STRING RETURN ASSIGN VAR VAR NUMBER IF VAR NUMBER EXPR FUNC_CALL VAR VAR IF VAR VAR EXPR FU... |
The Central Company has an office with a sophisticated security system. There are $10^6$ employees, numbered from $1$ to $10^6$.
The security system logs entrances and departures. The entrance of the $i$-th employee is denoted by the integer $i$, while the departure of the $i$-th employee is denoted by the integer $-i... | def foo(n, l):
Nvalid = 0
prev = 0
days = []
dedans = dict()
out = dict()
current = 0
counter = 0
for i in l:
counter += 1
if i > 0:
current += 1
if i in dedans:
return -1, -1
else:
dedans[i] = True
... | FUNC_DEF ASSIGN VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR LIST ASSIGN VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR ASSIGN VAR NUMBER ASSIGN VAR NUMBER FOR VAR VAR VAR NUMBER IF VAR NUMBER VAR NUMBER IF VAR VAR RETURN NUMBER NUMBER ASSIGN VAR VAR NUMBER IF VAR NUMBER VAR NUMBER IF VAR VAR VAR VAR ASSIGN VAR VAR NUMBER RETUR... |
The Central Company has an office with a sophisticated security system. There are $10^6$ employees, numbered from $1$ to $10^6$.
The security system logs entrances and departures. The entrance of the $i$-th employee is denoted by the integer $i$, while the departure of the $i$-th employee is denoted by the integer $-i... | class Day:
def __init__(self):
self.office = set()
self.events = 0
self.signed_in = set()
def sign_in(self, eid):
if eid in self.office:
raise ValueError()
if eid in self.signed_in:
raise ValueError()
self.office.add(eid)
self.sig... | CLASS_DEF FUNC_DEF ASSIGN VAR FUNC_CALL VAR ASSIGN VAR NUMBER ASSIGN VAR FUNC_CALL VAR FUNC_DEF IF VAR VAR FUNC_CALL VAR IF VAR VAR FUNC_CALL VAR EXPR FUNC_CALL VAR VAR EXPR FUNC_CALL VAR VAR VAR NUMBER FUNC_DEF IF VAR VAR FUNC_CALL VAR EXPR FUNC_CALL VAR VAR VAR NUMBER FUNC_DEF IF FUNC_CALL VAR VAR NUMBER RETURN VAR R... |
The Central Company has an office with a sophisticated security system. There are $10^6$ employees, numbered from $1$ to $10^6$.
The security system logs entrances and departures. The entrance of the $i$-th employee is denoted by the integer $i$, while the departure of the $i$-th employee is denoted by the integer $-i... | n = int(input())
l = [int(i) for i in input().split()]
d1 = {}
c = 0
d = []
c1 = 1
c2 = 0
prev = -1
for i in range(n):
if l[i] > 0:
if l[i] not in d1:
d1[l[i]] = 1
c2 += 1
else:
c1 = 0
break
elif -l[i] not in d1:
c1 = 0
break
el... | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR DICT ASSIGN VAR NUMBER ASSIGN VAR LIST ASSIGN VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR VAR IF VAR VAR NUMBER IF VAR VAR VAR ASSIGN VAR VAR VAR NUMBER VAR NUMBER ASSIGN VAR NUMBER IF VAR... |
The Central Company has an office with a sophisticated security system. There are $10^6$ employees, numbered from $1$ to $10^6$.
The security system logs entrances and departures. The entrance of the $i$-th employee is denoted by the integer $i$, while the departure of the $i$-th employee is denoted by the integer $-i... | def main():
n = int(input())
aa = map(int, input().split())
inoffice = set()
entered = set()
daycount = [0]
days = 0
ecount = 0
for a in aa:
daycount[-1] += 1
if a > 0:
if a in entered:
print(-1)
return
inoffice.add(... | FUNC_DEF ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR ASSIGN VAR LIST NUMBER ASSIGN VAR NUMBER ASSIGN VAR NUMBER FOR VAR VAR VAR NUMBER NUMBER IF VAR NUMBER IF VAR VAR EXPR FUNC_CALL VAR NUMBER RETURN EXPR FUNC_CALL VAR VAR... |
The Central Company has an office with a sophisticated security system. There are $10^6$ employees, numbered from $1$ to $10^6$.
The security system logs entrances and departures. The entrance of the $i$-th employee is denoted by the integer $i$, while the departure of the $i$-th employee is denoted by the integer $-i... | n = int(input())
l = list(map(int, input().split()))
if n % 2:
print(-1)
else:
ans = []
t = [0] * 1000005
vis = [0] * 1000005
check = 0
sm = 0
cou = 1
for i in range(n):
sm += l[i]
if sm == 0:
ans.append(i)
cou += 1
if l[i] < 0:
... | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR IF BIN_OP VAR NUMBER EXPR FUNC_CALL VAR NUMBER ASSIGN VAR LIST ASSIGN VAR BIN_OP LIST NUMBER NUMBER ASSIGN VAR BIN_OP LIST NUMBER NUMBER ASSIGN VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR V... |
The Central Company has an office with a sophisticated security system. There are $10^6$ employees, numbered from $1$ to $10^6$.
The security system logs entrances and departures. The entrance of the $i$-th employee is denoted by the integer $i$, while the departure of the $i$-th employee is denoted by the integer $-i... | n = int(input())
a = list(map(int, input().split()))
office = set()
ans = []
curc = 1
curday = []
for i in range(n):
if a[i] < 0:
if -1 * a[i] not in office:
print("-1")
quit()
else:
office.remove(-1 * a[i])
if len(office) == 0:
ans.app... | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR ASSIGN VAR LIST ASSIGN VAR NUMBER ASSIGN VAR LIST FOR VAR FUNC_CALL VAR VAR IF VAR VAR NUMBER IF BIN_OP NUMBER VAR VAR VAR EXPR FUNC_CALL VAR STRING EXPR FUNC_CALL VAR EXPR FUNC_CALL VAR BI... |
The Central Company has an office with a sophisticated security system. There are $10^6$ employees, numbered from $1$ to $10^6$.
The security system logs entrances and departures. The entrance of the $i$-th employee is denoted by the integer $i$, while the departure of the $i$-th employee is denoted by the integer $-i... | n = int(input())
if n % 2 != 0:
print("-1")
else:
arr = input().split(" ")
arrived = []
left = []
events = 0
all_people = n // 2
days = []
valid = True
for i in range(n):
events = events + 1
num = int(arr[i])
if num < 0:
if num in left:
... | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR IF BIN_OP VAR NUMBER NUMBER EXPR FUNC_CALL VAR STRING ASSIGN VAR FUNC_CALL FUNC_CALL VAR STRING ASSIGN VAR LIST ASSIGN VAR LIST ASSIGN VAR NUMBER ASSIGN VAR BIN_OP VAR NUMBER ASSIGN VAR LIST ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR VAR ASSIGN VAR BIN_OP VAR NUMBER ASSIGN VAR FUNC_C... |
The Central Company has an office with a sophisticated security system. There are $10^6$ employees, numbered from $1$ to $10^6$.
The security system logs entrances and departures. The entrance of the $i$-th employee is denoted by the integer $i$, while the departure of the $i$-th employee is denoted by the integer $-i... | n = int(input())
a = list(map(int, input().split()))
b = set()
lensb = []
count = 0
good = True
if n % 2 == 0:
office = 0
count_event = 0
for i in range(n):
if a[i] in b and office != 0 or a[i] < 0 and -a[i] not in b:
office = 1
break
if a[i] > 0:
office +... | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR ASSIGN VAR LIST ASSIGN VAR NUMBER ASSIGN VAR NUMBER IF BIN_OP VAR NUMBER NUMBER ASSIGN VAR NUMBER ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR VAR IF VAR VAR VAR VAR NUMBER VAR VAR NUMBER VAR VA... |
The Central Company has an office with a sophisticated security system. There are $10^6$ employees, numbered from $1$ to $10^6$.
The security system logs entrances and departures. The entrance of the $i$-th employee is denoted by the integer $i$, while the departure of the $i$-th employee is denoted by the integer $-i... | import sys
def schedule(a, n):
if n % 2:
return []
office = set()
used = set()
ans = []
dayStart = -1
dayEnd = -1
for i, e in enumerate(a):
if e < 0:
e = -e
if e not in office:
return []
else:
office.remove... | IMPORT FUNC_DEF IF BIN_OP VAR NUMBER RETURN LIST ASSIGN VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR ASSIGN VAR LIST ASSIGN VAR NUMBER ASSIGN VAR NUMBER FOR VAR VAR FUNC_CALL VAR VAR IF VAR NUMBER ASSIGN VAR VAR IF VAR VAR RETURN LIST EXPR FUNC_CALL VAR VAR EXPR FUNC_CALL VAR VAR IF VAR ASSIGN VAR VAR ASSIGN VAR FUNC_CAL... |
The Central Company has an office with a sophisticated security system. There are $10^6$ employees, numbered from $1$ to $10^6$.
The security system logs entrances and departures. The entrance of the $i$-th employee is denoted by the integer $i$, while the departure of the $i$-th employee is denoted by the integer $-i... | n = int(input())
a = list(map(int, input().split()))
b = []
ent = {}
out = {}
decision = 1
balance = 0
cur_day = []
for i in range(n):
if (
a[i] > 0
and a[i] not in ent
and a[i] not in out
or a[i] < 0
and abs(a[i]) in ent
and abs(a[i]) not in out
):
cur_da... | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR LIST ASSIGN VAR DICT ASSIGN VAR DICT ASSIGN VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR LIST FOR VAR FUNC_CALL VAR VAR IF VAR VAR NUMBER VAR VAR VAR VAR VAR VAR VAR VAR NUMBER FUNC_CALL VAR VAR VAR VAR FUNC_... |
The Central Company has an office with a sophisticated security system. There are $10^6$ employees, numbered from $1$ to $10^6$.
The security system logs entrances and departures. The entrance of the $i$-th employee is denoted by the integer $i$, while the departure of the $i$-th employee is denoted by the integer $-i... | n = int(input())
s = set()
s1 = set()
d = 0
c = 0
a = list(map(int, input().split()))
flag = 0
re = []
f = 0
for i in range(len(a)):
if a[i] < 0 and abs(a[i] + 0) not in s:
print(-1)
flag = 1
break
elif a[i] < 0:
c += 1
f -= 1
if abs(a[i]) in s1:
print... | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR ASSIGN VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR NUMBER ASSIGN VAR LIST ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR FUNC_CALL VAR VAR IF VAR VAR NUMBER FUNC_CALL VAR BIN_... |
The Central Company has an office with a sophisticated security system. There are $10^6$ employees, numbered from $1$ to $10^6$.
The security system logs entrances and departures. The entrance of the $i$-th employee is denoted by the integer $i$, while the departure of the $i$-th employee is denoted by the integer $-i... | n = int(input())
log = list(map(int, input().split()))
come = [0] * 1000001
was = [False] * 1000001
inside = 0
answer = []
exist = True
prev = -1
wasList = []
for i in range(n):
if log[i] > 0:
if come[log[i]] > 0 or was[log[i]]:
exist = False
break
wasList.append(log[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 BIN_OP LIST NUMBER NUMBER ASSIGN VAR BIN_OP LIST NUMBER NUMBER ASSIGN VAR NUMBER ASSIGN VAR LIST ASSIGN VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR LIST FOR VAR FUNC_CALL VAR VAR IF VAR VAR NUMBER IF VAR VAR... |
The Central Company has an office with a sophisticated security system. There are $10^6$ employees, numbered from $1$ to $10^6$.
The security system logs entrances and departures. The entrance of the $i$-th employee is denoted by the integer $i$, while the departure of the $i$-th employee is denoted by the integer $-i... | import itertools
n = int(input())
arr = [int(s) for s in input().split()]
cur_sum = 0
visited_emp = {}
ans_arr = [-1]
ans = 1
for i in range(n):
if arr[i] > 0:
try:
x = visited_emp[arr[i]]
if cur_sum == 0:
ans_arr.append(i - 1)
visited_emp = {}
... | IMPORT ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR NUMBER ASSIGN VAR DICT ASSIGN VAR LIST NUMBER ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR VAR IF VAR VAR NUMBER ASSIGN VAR VAR VAR VAR IF VAR NUMBER EXPR FUNC_CALL VAR BIN_OP VAR NUMBER ASSIGN VAR DICT ASSIGN V... |
The Central Company has an office with a sophisticated security system. There are $10^6$ employees, numbered from $1$ to $10^6$.
The security system logs entrances and departures. The entrance of the $i$-th employee is denoted by the integer $i$, while the departure of the $i$-th employee is denoted by the integer $-i... | d = {}
for i in range(2 * 10**6):
d[i + 1] = -(10**9)
n = int(input())
a = list(map(int, input().split()))
day = 1
curr_len = 0
ans = []
cnt = 0
for i in range(n):
q = a[i]
cnt += 1
if q > 0:
if abs(d[q]) == day:
print("-1")
exit()
d[q] = day
curr_len += 1... | ASSIGN VAR DICT FOR VAR FUNC_CALL VAR BIN_OP NUMBER BIN_OP NUMBER NUMBER ASSIGN VAR BIN_OP VAR NUMBER BIN_OP NUMBER 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 NUMBER ASSIGN VAR NUMBER ASSIGN VAR LIST ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR... |
The Central Company has an office with a sophisticated security system. There are $10^6$ employees, numbered from $1$ to $10^6$.
The security system logs entrances and departures. The entrance of the $i$-th employee is denoted by the integer $i$, while the departure of the $i$-th employee is denoted by the integer $-i... | from sys import stdin
z = []
a = int(stdin.readline())
gh = {}
k = list(map(int, stdin.readline().split()))
i = 0
_i, _o = 0, 0
while i < a:
while i < a:
if k[i] not in gh:
if k[i] < 0:
if -k[i] not in gh:
exit(print(-1))
_o += 1
... | ASSIGN VAR LIST ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR DICT ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR NUMBER ASSIGN VAR VAR NUMBER NUMBER WHILE VAR VAR WHILE VAR VAR IF VAR VAR VAR IF VAR VAR NUMBER IF VAR VAR VAR EXPR FUNC_CALL VAR FUNC_CALL VAR NUMBER VAR NUMBER ASSIGN V... |
The Central Company has an office with a sophisticated security system. There are $10^6$ employees, numbered from $1$ to $10^6$.
The security system logs entrances and departures. The entrance of the $i$-th employee is denoted by the integer $i$, while the departure of the $i$-th employee is denoted by the integer $-i... | from sys import *
z = stdin.readline
n = int(z())
l = list(map(int, z().split()))
l1, l2 = set(), set()
ans = []
p = 0
f = 0
for a, b in enumerate(l):
if b < 0:
if -b not in l1:
stdout.write("-1")
f = 1
break
l1.remove(-b)
elif b in l2:
stdout.write("... | ASSIGN VAR VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR LIST ASSIGN VAR NUMBER ASSIGN VAR NUMBER FOR VAR VAR FUNC_CALL VAR VAR IF VAR NUMBER IF VAR VAR EXPR FUNC_CALL VAR STRING ASSIGN VAR NUMBER EXPR ... |
The Central Company has an office with a sophisticated security system. There are $10^6$ employees, numbered from $1$ to $10^6$.
The security system logs entrances and departures. The entrance of the $i$-th employee is denoted by the integer $i$, while the departure of the $i$-th employee is denoted by the integer $-i... | n = int(input())
a = map(int, input().split())
b = []
j = -1
o = {}
c = 0
for i, x in enumerate(a):
if x > 0:
if o.get(x, 0):
print(-1)
break
else:
o[x] = 1
c += 1
else:
y = o.get(-x, 0)
if y == 1:
o[-x] = 2
... | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR LIST ASSIGN VAR NUMBER ASSIGN VAR DICT ASSIGN VAR NUMBER FOR VAR VAR FUNC_CALL VAR VAR IF VAR NUMBER IF FUNC_CALL VAR VAR NUMBER EXPR FUNC_CALL VAR NUMBER ASSIGN VAR VAR NUMBER VAR NUMBER ASSIGN VAR FUNC_CALL VAR VAR ... |
The Central Company has an office with a sophisticated security system. There are $10^6$ employees, numbered from $1$ to $10^6$.
The security system logs entrances and departures. The entrance of the $i$-th employee is denoted by the integer $i$, while the departure of the $i$-th employee is denoted by the integer $-i... | n = int(input())
a = list(map(int, input().split()))
days = []
ok = True
tod = set()
now = set()
for i in range(n):
if a[i] > 0:
if a[i] in tod:
ok = False
break
else:
tod.add(a[i])
now.add(a[i])
elif not -a[i] in now:
ok = False
br... | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR LIST ASSIGN VAR NUMBER ASSIGN VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FOR VAR FUNC_CALL VAR VAR IF VAR VAR NUMBER IF VAR VAR VAR ASSIGN VAR NUMBER EXPR FUNC_CALL VAR VAR VAR EXPR FUNC_CALL VAR VAR VAR... |
The Central Company has an office with a sophisticated security system. There are $10^6$ employees, numbered from $1$ to $10^6$.
The security system logs entrances and departures. The entrance of the $i$-th employee is denoted by the integer $i$, while the departure of the $i$-th employee is denoted by the integer $-i... | def mistake(list1):
count = 0
list5 = []
cur = []
list4 = [(False) for i in range(2000000)]
for i, x in enumerate(list1):
cur.append(x)
if x > 0:
if list4[x - 1]:
print(-1)
return
else:
list4[x - 1] = True
... | FUNC_DEF ASSIGN VAR NUMBER ASSIGN VAR LIST ASSIGN VAR LIST ASSIGN VAR NUMBER VAR FUNC_CALL VAR NUMBER FOR VAR VAR FUNC_CALL VAR VAR EXPR FUNC_CALL VAR VAR IF VAR NUMBER IF VAR BIN_OP VAR NUMBER EXPR FUNC_CALL VAR NUMBER RETURN ASSIGN VAR BIN_OP VAR NUMBER NUMBER VAR NUMBER IF VAR VAR VAR BIN_OP VAR NUMBER NUMBER EXPR F... |
The Central Company has an office with a sophisticated security system. There are $10^6$ employees, numbered from $1$ to $10^6$.
The security system logs entrances and departures. The entrance of the $i$-th employee is denoted by the integer $i$, while the departure of the $i$-th employee is denoted by the integer $-i... | import sys
sys.setrecursionlimit(10**8)
input = sys.stdin.readline
n = int(input())
event = [int(item) for item in input().split()]
cnt = [0] * (10**6 + 1)
people_in_house = 0
seen = set()
ans = []
ok = True
prev = 0
for i, item in enumerate(event):
positibe = item > 0
index = abs(item)
if positibe:
... | IMPORT EXPR FUNC_CALL VAR BIN_OP NUMBER NUMBER ASSIGN VAR VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR BIN_OP LIST NUMBER BIN_OP BIN_OP NUMBER NUMBER NUMBER ASSIGN VAR NUMBER ASSIGN VAR FUNC_CALL VAR ASSIGN VAR LIST ASSIGN VAR NUMBER ASSIGN VAR NUMBER FO... |
The Central Company has an office with a sophisticated security system. There are $10^6$ employees, numbered from $1$ to $10^6$.
The security system logs entrances and departures. The entrance of the $i$-th employee is denoted by the integer $i$, while the departure of the $i$-th employee is denoted by the integer $-i... | n = int(input())
a = [int(x) for x in input().split()]
s = set()
used = set()
r = []
i = 0
for aa in a:
i += 1
if aa > 0:
if aa in used:
print(-1)
break
s.add(aa)
used.add(aa)
else:
if -aa not in s:
print(-1)
break
s.rem... | 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 ASSIGN VAR FUNC_CALL VAR ASSIGN VAR LIST ASSIGN VAR NUMBER FOR VAR VAR VAR NUMBER IF VAR NUMBER IF VAR VAR EXPR FUNC_CALL VAR NUMBER EXPR FUNC_CALL VAR VAR EXPR FUNC_CALL VAR VAR IF VAR VAR EXPR FUNC... |
The Central Company has an office with a sophisticated security system. There are $10^6$ employees, numbered from $1$ to $10^6$.
The security system logs entrances and departures. The entrance of the $i$-th employee is denoted by the integer $i$, while the departure of the $i$-th employee is denoted by the integer $-i... | n = int(input())
a = list(map(int, input().split(" ")))
ev = set()
ev2 = set()
f = False
f2 = True
d = []
c = 0
for e in a:
f = False
if e > 0:
if e in ev2:
f2 = False
break
else:
ev.add(e)
ev2.add(e)
elif e < 0:
try:
ev.rem... | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR STRING ASSIGN VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR ASSIGN VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR LIST ASSIGN VAR NUMBER FOR VAR VAR ASSIGN VAR NUMBER IF VAR NUMBER IF VAR VAR ASSIGN VAR NUMBER EXPR FUNC_CALL... |
The Central Company has an office with a sophisticated security system. There are $10^6$ employees, numbered from $1$ to $10^6$.
The security system logs entrances and departures. The entrance of the $i$-th employee is denoted by the integer $i$, while the departure of the $i$-th employee is denoted by the integer $-i... | n = int(input())
ar = list(map(int, input().split()))
hs = set()
cnt = 0
possible = True
ans = []
day = set()
for i in range(n):
x = ar[i]
if x in hs or x in day:
possible = False
break
cnt += 1
day.add(x)
if -x > x and -x in hs:
hs.remove(-x)
if len(hs) == 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 FUNC_CALL VAR ASSIGN VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR LIST ASSIGN VAR FUNC_CALL VAR FOR VAR FUNC_CALL VAR VAR ASSIGN VAR VAR VAR IF VAR VAR VAR VAR ASSIGN VAR NUMBER VAR NUMBER EXPR FUNC_CALL VAR ... |
The Central Company has an office with a sophisticated security system. There are $10^6$ employees, numbered from $1$ to $10^6$.
The security system logs entrances and departures. The entrance of the $i$-th employee is denoted by the integer $i$, while the departure of the $i$-th employee is denoted by the integer $-i... | import sys
input = sys.stdin.readline
n = int(input())
a = list(map(int, input().split()))
enter = dict()
coun = dict()
res = [0]
t = 1
flag = 0
person = 0
for i in range(n):
if a[i] > 0:
if enter.get(a[i], -1) != -1 or coun.get(a[i], -1) != -1:
flag = 1
break
enter[a[i]] = ... | IMPORT ASSIGN VAR VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR ASSIGN VAR LIST NUMBER ASSIGN VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR VAR IF VAR VAR NUMBER IF FUNC_CALL VAR VAR ... |
The Central Company has an office with a sophisticated security system. There are $10^6$ employees, numbered from $1$ to $10^6$.
The security system logs entrances and departures. The entrance of the $i$-th employee is denoted by the integer $i$, while the departure of the $i$-th employee is denoted by the integer $-i... | k = int(input())
l = list(map(int, input().split()))
pref = [l[0]]
n = 0
tab = []
nbevents = []
start = 0
good = 1
for i in range(1, k):
pref.append(pref[-1] + l[i])
if pref[-1] == 0:
n += 1
tab.append(i + 1)
for i in range(n):
cut = l[start : tab[i]]
x = len(set(cut))
nbevents.appen... | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR LIST VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR LIST ASSIGN VAR LIST ASSIGN VAR NUMBER ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR NUMBER VAR EXPR FUNC_CALL VAR BIN_OP VAR NUMBER VAR VAR IF VAR NUMBER NUMBER VA... |
The Central Company has an office with a sophisticated security system. There are $10^6$ employees, numbered from $1$ to $10^6$.
The security system logs entrances and departures. The entrance of the $i$-th employee is denoted by the integer $i$, while the departure of the $i$-th employee is denoted by the integer $-i... | n = int(input())
arr = list(map(int, input().split(" ")))
count = []
counter = []
ans = 0
if n % 2 != 0 or sum(arr) != 0:
exit(print(-1))
for z in range(len(arr)):
ans += arr[z]
if ans < 0:
exit(print(-1))
count.append(abs(arr[z]))
if z == len(arr) - 1:
if ans != 0:
exit(... | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR STRING ASSIGN VAR LIST ASSIGN VAR LIST ASSIGN VAR NUMBER IF BIN_OP VAR NUMBER NUMBER FUNC_CALL VAR VAR NUMBER EXPR FUNC_CALL VAR FUNC_CALL VAR NUMBER FOR VAR FUNC_CALL VAR FUNC_CALL VAR VAR VAR VAR VAR IF VAR NUMBE... |
The Central Company has an office with a sophisticated security system. There are $10^6$ employees, numbered from $1$ to $10^6$.
The security system logs entrances and departures. The entrance of the $i$-th employee is denoted by the integer $i$, while the departure of the $i$-th employee is denoted by the integer $-i... | n = int(input())
(*a,) = map(int, input().split())
s = set()
cnt = 0
st = 0
ans = []
used = set()
for i in range(n):
x = a[i]
if x < 0:
if not -x in s:
print(-1)
exit(0)
s.remove(-x)
used.add(-x)
if len(s) == 0:
used.clear()
cnt += ... | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR ASSIGN VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR LIST ASSIGN VAR FUNC_CALL VAR FOR VAR FUNC_CALL VAR VAR ASSIGN VAR VAR VAR IF VAR NUMBER IF VAR VAR EXPR FUNC_CALL VAR NUMBER EXPR FUNC_CALL VAR NUMBER EXPR... |
The Central Company has an office with a sophisticated security system. There are $10^6$ employees, numbered from $1$ to $10^6$.
The security system logs entrances and departures. The entrance of the $i$-th employee is denoted by the integer $i$, while the departure of the $i$-th employee is denoted by the integer $-i... | def solve(n, a):
ans = []
l = 0
while l < n:
r = l
once_enterd = set()
current = set()
if a[r] < 0:
return None
once_enterd.add(a[r])
current.add(a[r])
r += 1
while current:
if r == n:
return None
... | FUNC_DEF ASSIGN VAR LIST ASSIGN VAR NUMBER WHILE VAR VAR ASSIGN VAR VAR ASSIGN VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR IF VAR VAR NUMBER RETURN NONE EXPR FUNC_CALL VAR VAR VAR EXPR FUNC_CALL VAR VAR VAR VAR NUMBER WHILE VAR IF VAR VAR RETURN NONE IF VAR VAR NUMBER IF VAR VAR VAR RETURN NONE EXPR FUNC_CALL VAR VAR VA... |
The Central Company has an office with a sophisticated security system. There are $10^6$ employees, numbered from $1$ to $10^6$.
The security system logs entrances and departures. The entrance of the $i$-th employee is denoted by the integer $i$, while the departure of the $i$-th employee is denoted by the integer $-i... | n = int(input())
l = list(map(int, input().split()))
s1 = set()
s2 = set()
ans = []
for x in l:
if x > 0:
if x in s1 or x in s2:
print(-1)
exit(0)
s1.add(x)
else:
x = -x
if x not in s1:
print(-1)
exit(0)
s1.remove(x)
... | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR ASSIGN VAR LIST FOR VAR VAR IF VAR NUMBER IF VAR VAR VAR VAR EXPR FUNC_CALL VAR NUMBER EXPR FUNC_CALL VAR NUMBER EXPR FUNC_CALL VAR VAR ASSIGN VAR VAR IF VAR VAR EX... |
The Central Company has an office with a sophisticated security system. There are $10^6$ employees, numbered from $1$ to $10^6$.
The security system logs entrances and departures. The entrance of the $i$-th employee is denoted by the integer $i$, while the departure of the $i$-th employee is denoted by the integer $-i... | n = int(input())
a = list(map(int, input().split()))
ans = []
s = set([a[0]])
was = set()
lst = 0
for q in range(1, n):
x = a[q]
if x < 0:
d = x * -1
if d not in s:
print(-1)
exit()
else:
s -= set([d])
if len(s) == 0:
ans.append(q +... | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR LIST ASSIGN VAR FUNC_CALL VAR LIST VAR NUMBER ASSIGN VAR FUNC_CALL VAR ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR NUMBER VAR ASSIGN VAR VAR VAR IF VAR NUMBER ASSIGN VAR BIN_OP VAR NUMBER IF VAR VAR EXPR FUN... |
The Central Company has an office with a sophisticated security system. There are $10^6$ employees, numbered from $1$ to $10^6$.
The security system logs entrances and departures. The entrance of the $i$-th employee is denoted by the integer $i$, while the departure of the $i$-th employee is denoted by the integer $-i... | N = int(input())
N = pow(10, 6)
A = list(map(int, input().split()))
days = 0
last = -1
cur = 0
data = []
count = [(0) for i in range(N + 1)]
inOffice = [(False) for i in range(N + 1)]
for i, event in enumerate(A):
if event < 0:
if inOffice[-event]:
inOffice[-event] = False
cur -= 1
... | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR NUMBER NUMBER 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 LIST ASSIGN VAR NUMBER VAR FUNC_CALL VAR BIN_OP VAR NUMBER ASSIGN VAR NUMBER VAR FUNC_CALL VAR BIN_OP VAR NUMB... |
The Central Company has an office with a sophisticated security system. There are $10^6$ employees, numbered from $1$ to $10^6$.
The security system logs entrances and departures. The entrance of the $i$-th employee is denoted by the integer $i$, while the departure of the $i$-th employee is denoted by the integer $-i... | n = int(input())
L = list(map(int, input().split()))
ans = [-1]
s = set()
vis = set()
ok = True
for i in range(n):
c = L[i]
if c > 0:
if c in vis:
ok = False
break
vis.add(c)
if c in s:
ok = False
break
else:
s.add(c)
... | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR LIST NUMBER ASSIGN VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR VAR ASSIGN VAR VAR VAR IF VAR NUMBER IF VAR VAR ASSIGN VAR NUMBER EXPR FUNC_CALL VAR VAR IF VAR VAR A... |
The Central Company has an office with a sophisticated security system. There are $10^6$ employees, numbered from $1$ to $10^6$.
The security system logs entrances and departures. The entrance of the $i$-th employee is denoted by the integer $i$, while the departure of the $i$-th employee is denoted by the integer $-i... | import sys
def main():
n = int(sys.stdin.readline())
arr = [int(x) for x in sys.stdin.readline().split(" ")]
d = {}
alreadyEntered = {}
days = []
count = 0
for a in arr:
count += 1
if a < 0:
if -a not in d:
return -1
else:
... | IMPORT FUNC_DEF ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR VAR FUNC_CALL FUNC_CALL VAR STRING ASSIGN VAR DICT ASSIGN VAR DICT ASSIGN VAR LIST ASSIGN VAR NUMBER FOR VAR VAR VAR NUMBER IF VAR NUMBER IF VAR VAR RETURN NUMBER ASSIGN VAR VAR NUMBER IF VAR VAR VAR VAR NUMBER RETURN NUMBER IF FUNC_CAL... |
The Central Company has an office with a sophisticated security system. There are $10^6$ employees, numbered from $1$ to $10^6$.
The security system logs entrances and departures. The entrance of the $i$-th employee is denoted by the integer $i$, while the departure of the $i$-th employee is denoted by the integer $-i... | def count_subarrays(ar):
sum = 0
c = []
e = 0
x = {}
for n in ar:
if n < 0 and abs(n) not in x:
c = [-1]
return c
elif abs(n) in x and x[abs(n)] == 2:
c = [-1]
return c
elif abs(n) in x:
x[abs(n)] += 1
else:
... | FUNC_DEF ASSIGN VAR NUMBER ASSIGN VAR LIST ASSIGN VAR NUMBER ASSIGN VAR DICT FOR VAR VAR IF VAR NUMBER FUNC_CALL VAR VAR VAR ASSIGN VAR LIST NUMBER RETURN VAR IF FUNC_CALL VAR VAR VAR VAR FUNC_CALL VAR VAR NUMBER ASSIGN VAR LIST NUMBER RETURN VAR IF FUNC_CALL VAR VAR VAR VAR FUNC_CALL VAR VAR NUMBER ASSIGN VAR VAR NUMB... |
The Central Company has an office with a sophisticated security system. There are $10^6$ employees, numbered from $1$ to $10^6$.
The security system logs entrances and departures. The entrance of the $i$-th employee is denoted by the integer $i$, while the departure of the $i$-th employee is denoted by the integer $-i... | n = int(input())
a = list(map(int, input().split()))
freq = {}
possible = 1
odd = 0
res = []
ans = 0
for i, x in enumerate(a):
if x < 0:
if freq.get(abs(x), None) == None:
possible = 0
break
freq[abs(x)] += 1
if freq[abs(x)] % 2 == 0:
odd -= 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 DICT ASSIGN VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR LIST ASSIGN VAR NUMBER FOR VAR VAR FUNC_CALL VAR VAR IF VAR NUMBER IF FUNC_CALL VAR FUNC_CALL VAR VAR NONE NONE ASSIGN VAR NUMBER VAR FUNC_CALL VAR VAR... |
The Central Company has an office with a sophisticated security system. There are $10^6$ employees, numbered from $1$ to $10^6$.
The security system logs entrances and departures. The entrance of the $i$-th employee is denoted by the integer $i$, while the departure of the $i$-th employee is denoted by the integer $-i... | import sys
def rint():
return map(int, sys.stdin.readline().split())
def input():
return sys.stdin.readline().rstrip("\n")
def oint():
return int(input())
n = oint()
a = list(rint())
e = set()
o = set()
ans = []
for i in range(n):
if a[i] > 0:
if a[i] in o:
print(-1)
... | IMPORT FUNC_DEF RETURN FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR FUNC_DEF RETURN FUNC_CALL FUNC_CALL VAR STRING FUNC_DEF RETURN FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR ASSIGN VAR LIST FOR VAR FUNC_CALL VAR VAR IF VAR V... |
The Central Company has an office with a sophisticated security system. There are $10^6$ employees, numbered from $1$ to $10^6$.
The security system logs entrances and departures. The entrance of the $i$-th employee is denoted by the integer $i$, while the departure of the $i$-th employee is denoted by the integer $-i... | n = int(input())
lst = list(map(int, input().split()))
Dict = {}
ans = 0
ans_lst = []
start = 0
total = 0
flag = 0
for i in range(n):
ele = lst[i]
if ele > 0:
if Dict.get(ele) != None:
flag = 1
break
else:
Dict[ele] = True
total += ele
elif tot... | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR DICT ASSIGN VAR NUMBER ASSIGN VAR LIST ASSIGN VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR VAR ASSIGN VAR VAR VAR IF VAR NUMBER IF FUNC_CALL VAR VAR NONE ASSIGN VAR NUMBER ASSIGN ... |
The Central Company has an office with a sophisticated security system. There are $10^6$ employees, numbered from $1$ to $10^6$.
The security system logs entrances and departures. The entrance of the $i$-th employee is denoted by the integer $i$, while the departure of the $i$-th employee is denoted by the integer $-i... | def days(n):
s = set()
s2 = set()
d = 0
a = []
for i in n:
d += 1
if i > 0 and i not in s and i not in s2:
s.add(i)
s2.add(i)
elif i < 0 and -i in s:
s.remove(-i)
else:
return False
if s == set():
s2 ... | FUNC_DEF ASSIGN VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR ASSIGN VAR NUMBER ASSIGN VAR LIST FOR VAR VAR VAR NUMBER IF VAR NUMBER VAR VAR VAR VAR EXPR FUNC_CALL VAR VAR EXPR FUNC_CALL VAR VAR IF VAR NUMBER VAR VAR EXPR FUNC_CALL VAR VAR RETURN NUMBER IF VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR LIST VAR ASSIGN VAR... |
The Central Company has an office with a sophisticated security system. There are $10^6$ employees, numbered from $1$ to $10^6$.
The security system logs entrances and departures. The entrance of the $i$-th employee is denoted by the integer $i$, while the departure of the $i$-th employee is denoted by the integer $-i... | n = int(input())
events = list(map(int, input().split()))
sumTillNow = 0
eventsState = [-1] * 10000007
currentEvents = []
d = 0
ansEvents = []
i = 0
notPossible = 0
while i < n:
if events[i] < 0 and eventsState[abs(events[i])] == -1:
notPossible = 1
break
elif events[i] > 0 and eventsState[event... | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR NUMBER ASSIGN VAR BIN_OP LIST NUMBER NUMBER ASSIGN VAR LIST ASSIGN VAR NUMBER ASSIGN VAR LIST ASSIGN VAR NUMBER ASSIGN VAR NUMBER WHILE VAR VAR IF VAR VAR NUMBER VAR FUNC_CALL VAR VAR VAR NUMBER ASSIGN V... |
The Central Company has an office with a sophisticated security system. There are $10^6$ employees, numbered from $1$ to $10^6$.
The security system logs entrances and departures. The entrance of the $i$-th employee is denoted by the integer $i$, while the departure of the $i$-th employee is denoted by the integer $-i... | for _ in range(1):
n = int(input())
a = list(map(int, input().split()))
if n % 2 == 1:
print("-1")
continue
c = []
s = set()
d = {}
f = False
x = 0
b = 0
for i in range(n):
x += a[i]
b += 1
if a[i] > 0:
if a[i] in s:
... | FOR VAR FUNC_CALL VAR NUMBER ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR IF BIN_OP VAR NUMBER NUMBER EXPR FUNC_CALL VAR STRING ASSIGN VAR LIST ASSIGN VAR FUNC_CALL VAR ASSIGN VAR DICT ASSIGN VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR NUMBER FOR VAR FUNC_CALL VA... |
The Central Company has an office with a sophisticated security system. There are $10^6$ employees, numbered from $1$ to $10^6$.
The security system logs entrances and departures. The entrance of the $i$-th employee is denoted by the integer $i$, while the departure of the $i$-th employee is denoted by the integer $-i... | n = int(input())
array = map(int, input().split())
pr = [0] * (10**6 + 1)
count = 0
ans = []
last_i = -1
pr_for_days = set()
for i, el in enumerate(array):
if el > 0:
if el in pr_for_days:
print(-1)
exit(0)
if pr[el] == 1:
print(-1)
exit(0)
pr[... | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR BIN_OP LIST NUMBER BIN_OP BIN_OP NUMBER NUMBER NUMBER ASSIGN VAR NUMBER ASSIGN VAR LIST ASSIGN VAR NUMBER ASSIGN VAR FUNC_CALL VAR FOR VAR VAR FUNC_CALL VAR VAR IF VAR NUMBER IF VAR VAR EXPR FUNC_CALL VAR NUMBER EXPR ... |
The Central Company has an office with a sophisticated security system. There are $10^6$ employees, numbered from $1$ to $10^6$.
The security system logs entrances and departures. The entrance of the $i$-th employee is denoted by the integer $i$, while the departure of the $i$-th employee is denoted by the integer $-i... | ii = lambda: int(input())
kk = lambda: map(int, input().split())
ll = lambda: list(kk())
n, ls = ii(), ll()
cday = 0
ans = []
start = 0
d = [-1] * 1000001
inside = 0
for i in range(n):
c = ls[i]
if c < 0:
if d[-c] != 2 * cday:
print(-1)
exit()
d[-c] += 1
inside -=... | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR NUMBER ASSIGN VAR LIST ASSIGN VAR NUMBER ASSIGN VAR BIN_OP LIST NUMBER NUMBER ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR VAR ASSIGN VAR VA... |
The Central Company has an office with a sophisticated security system. There are $10^6$ employees, numbered from $1$ to $10^6$.
The security system logs entrances and departures. The entrance of the $i$-th employee is denoted by the integer $i$, while the departure of the $i$-th employee is denoted by the integer $-i... | t = 1
while t:
n = int(input())
a = list(map(int, input().split()))
d = {}
cnt = 0
day = 0
ele = 0
dd = []
ch = 0
for i in range(n):
if a[i] < 0:
if d.get(abs(a[i]), 0) == 1:
d[abs(a[i])] -= 1
ele += 1
cnt -= 1
... | ASSIGN VAR NUMBER WHILE VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR DICT ASSIGN VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR LIST ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR VAR IF VAR VAR NUMBER IF FUNC_CALL VAR FUNC_CALL VAR VAR VAR... |
The Central Company has an office with a sophisticated security system. There are $10^6$ employees, numbered from $1$ to $10^6$.
The security system logs entrances and departures. The entrance of the $i$-th employee is denoted by the integer $i$, while the departure of the $i$-th employee is denoted by the integer $-i... | n = int(input())
a = list(map(int, input().split()))
team = 0
dis = set()
ans = []
for i in range(n):
if a[i] in dis or a[i] < 0 and abs(a[i]) not in dis:
print(-1)
exit()
team += a[i]
dis.add(a[i])
if not team:
ans.append(len(dis))
dis = set()
if not team:
print(len(... | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR NUMBER ASSIGN VAR FUNC_CALL VAR ASSIGN VAR LIST FOR VAR FUNC_CALL VAR VAR IF VAR VAR VAR VAR VAR NUMBER FUNC_CALL VAR VAR VAR VAR EXPR FUNC_CALL VAR NUMBER EXPR FUNC_CALL VAR VAR VAR VAR EXPR FUNC_CALL V... |
The Central Company has an office with a sophisticated security system. There are $10^6$ employees, numbered from $1$ to $10^6$.
The security system logs entrances and departures. The entrance of the $i$-th employee is denoted by the integer $i$, while the departure of the $i$-th employee is denoted by the integer $-i... | def main():
result = []
input()
e = list(map(int, input().split(" ")))
d = [0] * len(e)
d[0] = e[0]
for i in range(1, len(e)):
d[i] = d[i - 1] + e[i]
if d[i] == 0:
result.append(i)
if d[-1] != 0:
return -1
for i in d:
if i < 0:
retu... | FUNC_DEF ASSIGN VAR LIST EXPR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR STRING ASSIGN VAR BIN_OP LIST NUMBER FUNC_CALL VAR VAR ASSIGN VAR NUMBER VAR NUMBER FOR VAR FUNC_CALL VAR NUMBER FUNC_CALL VAR VAR ASSIGN VAR VAR BIN_OP VAR BIN_OP VAR NUMBER VAR VAR IF VAR VAR NUMBER EXPR FUN... |
The Central Company has an office with a sophisticated security system. There are $10^6$ employees, numbered from $1$ to $10^6$.
The security system logs entrances and departures. The entrance of the $i$-th employee is denoted by the integer $i$, while the departure of the $i$-th employee is denoted by the integer $-i... | n = int(input())
ar = list(map(int, input().split()))
A = dict()
B = set()
C = dict()
num = 0
ans = 0
lol = []
kek = []
for elem in ar:
lol.append(elem)
if abs(elem) not in B:
B.add(elem)
if abs(elem) not in A and elem < 0:
ans = -1
break
elif abs(elem) not in A:
A[elem] ... | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR ASSIGN VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR LIST ASSIGN VAR LIST FOR VAR VAR EXPR FUNC_CALL VAR VAR IF FUNC_CALL VAR VAR VAR EXPR FUNC_C... |
The Central Company has an office with a sophisticated security system. There are $10^6$ employees, numbered from $1$ to $10^6$.
The security system logs entrances and departures. The entrance of the $i$-th employee is denoted by the integer $i$, while the departure of the $i$-th employee is denoted by the integer $-i... | n = int(input())
work = set()
day = set()
prei = 0
ans = []
for i, x in enumerate(map(int, input().split())):
if x > 0:
if x in work:
print(-1)
break
if x in day:
print(-1)
break
day.add(x)
work.add(x)
if x < 0:
if -x not in... | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR ASSIGN VAR NUMBER ASSIGN VAR LIST FOR VAR VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR IF VAR NUMBER IF VAR VAR EXPR FUNC_CALL VAR NUMBER IF VAR VAR EXPR FUNC_CALL VAR NUMBER EXPR FUNC_CALL VAR VAR EXPR FUNC_CALL VAR... |
The Central Company has an office with a sophisticated security system. There are $10^6$ employees, numbered from $1$ to $10^6$.
The security system logs entrances and departures. The entrance of the $i$-th employee is denoted by the integer $i$, while the departure of the $i$-th employee is denoted by the integer $-i... | n = int(input())
a = [int(x) for x in input().split()]
f = [0] * 1000006
p = {}
q = 0
c = 0
C = [0]
for i in range(n):
if a[i] >= 0:
if a[i] in p:
print(-1)
quit()
if f[a[i]] == 0:
c += 1
f[a[i]] += 1
p[a[i]] = 1
else:
if f[-a[i]] == 1:... | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR BIN_OP LIST NUMBER NUMBER ASSIGN VAR DICT ASSIGN VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR LIST NUMBER FOR VAR FUNC_CALL VAR VAR IF VAR VAR NUMBER IF VAR VAR VAR EXPR FUNC_CALL VAR NUMBER EXPR FUNC_CALL VAR IF VAR V... |
The Central Company has an office with a sophisticated security system. There are $10^6$ employees, numbered from $1$ to $10^6$.
The security system logs entrances and departures. The entrance of the $i$-th employee is denoted by the integer $i$, while the departure of the $i$-th employee is denoted by the integer $-i... | from sys import stdin
input = stdin.readline
v1 = set()
a = [-1]
s = 0
f = int(input())
for i, j in enumerate(map(int, input().split())):
s += j
if j < 0 and -j not in v1 or j in v1:
exit(print(-1))
v1.add(j)
if not s:
a += (i,)
v1.clear()
if a[-1] != f - 1:
exit(print(-1))
... | ASSIGN VAR VAR ASSIGN VAR FUNC_CALL VAR ASSIGN VAR LIST NUMBER ASSIGN VAR NUMBER ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR FOR VAR VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR VAR VAR IF VAR NUMBER VAR VAR VAR VAR EXPR FUNC_CALL VAR FUNC_CALL VAR NUMBER EXPR FUNC_CALL VAR VAR IF VAR VAR VAR EXPR FUNC_CALL V... |
The Central Company has an office with a sophisticated security system. There are $10^6$ employees, numbered from $1$ to $10^6$.
The security system logs entrances and departures. The entrance of the $i$-th employee is denoted by the integer $i$, while the departure of the $i$-th employee is denoted by the integer $-i... | n = int(input())
l = list(map(int, input().split()))
s = sum(l)
if n % 2 == 1 or s != 0:
print(-1)
else:
d = 0
e = []
x = 0
s = 0
f = 0
for i in range(n):
s = s + l[i]
x = x + 1
if s == 0:
if len(set(l[i - (x - 1) : i + 1])) == x:
dic = {}
... | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR IF BIN_OP VAR NUMBER NUMBER VAR NUMBER EXPR FUNC_CALL VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR LIST ASSIGN VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR VAR ASSIGN... |
The Central Company has an office with a sophisticated security system. There are $10^6$ employees, numbered from $1$ to $10^6$.
The security system logs entrances and departures. The entrance of the $i$-th employee is denoted by the integer $i$, while the departure of the $i$-th employee is denoted by the integer $-i... | n = int(input())
a = [int(i) for i in input().split()]
if n % 2 == 1:
print(-1)
exit(0)
cnt = [[] for i in range(max(abs(min(a)), max(a)) + 1)]
for i in a:
cnt[abs(i)].append(i)
flag = 0
for i in range(len(cnt)):
if len(cnt[i]) % 2 == 1:
flag = 1
break
for j in range(len(cnt[i])):
... | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR VAR FUNC_CALL FUNC_CALL VAR IF BIN_OP VAR NUMBER NUMBER EXPR FUNC_CALL VAR NUMBER EXPR FUNC_CALL VAR NUMBER ASSIGN VAR LIST VAR FUNC_CALL VAR BIN_OP FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL VAR VAR NUMBER FOR VAR VAR EXPR FUNC_CALL VAR F... |
The Central Company has an office with a sophisticated security system. There are $10^6$ employees, numbered from $1$ to $10^6$.
The security system logs entrances and departures. The entrance of the $i$-th employee is denoted by the integer $i$, while the departure of the $i$-th employee is denoted by the integer $-i... | n = int(input().strip())
a = [int(j) for j in input().strip().split()]
if a[0] < 0:
print(-1)
else:
numd = 0
ind = 0
days = []
dayset = set()
dayset.add(a[ind])
summ = a[ind]
flag = True
result = False
while flag:
ind += 1
x0 = a[ind]
if summ != 0:
... | ASSIGN VAR FUNC_CALL VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR VAR FUNC_CALL FUNC_CALL FUNC_CALL VAR IF VAR NUMBER NUMBER EXPR FUNC_CALL VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR LIST ASSIGN VAR FUNC_CALL VAR EXPR FUNC_CALL VAR VAR VAR ASSIGN VAR VAR VAR ASSIGN VAR NUMBER ASSIGN VAR NUMBE... |
The Central Company has an office with a sophisticated security system. There are $10^6$ employees, numbered from $1$ to $10^6$.
The security system logs entrances and departures. The entrance of the $i$-th employee is denoted by the integer $i$, while the departure of the $i$-th employee is denoted by the integer $-i... | import sys
input = sys.stdin.readline
f = lambda: list(map(int, input().split()))
n = int(input())
a = f()
cnt = {}
prs = set([])
ok = True
res = []
s = 0
for i in range(n):
if cnt.get(a[i], False):
ok = False
elif a[i] < 0 and not cnt.get(-a[i], False):
ok = False
elif a[i] > 0:
cn... | IMPORT ASSIGN VAR VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR ASSIGN VAR DICT ASSIGN VAR FUNC_CALL VAR LIST ASSIGN VAR NUMBER ASSIGN VAR LIST ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR VAR IF FUNC_CALL VAR VAR VAR NUMBER ASSIGN VAR ... |
The Central Company has an office with a sophisticated security system. There are $10^6$ employees, numbered from $1$ to $10^6$.
The security system logs entrances and departures. The entrance of the $i$-th employee is denoted by the integer $i$, while the departure of the $i$-th employee is denoted by the integer $-i... | def solve(events):
i = 0
splits = []
inside = set()
seen = set()
while i < len(events):
event = events[i]
arriving = event > 0
person = abs(event)
if arriving:
if person in inside or person in seen:
return None
inside.add(person... | FUNC_DEF ASSIGN VAR NUMBER ASSIGN VAR LIST ASSIGN VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR WHILE VAR FUNC_CALL VAR VAR ASSIGN VAR VAR VAR ASSIGN VAR VAR NUMBER ASSIGN VAR FUNC_CALL VAR VAR IF VAR IF VAR VAR VAR VAR RETURN NONE EXPR FUNC_CALL VAR VAR IF VAR VAR RETURN NONE EXPR FUNC_CALL VAR VAR EXPR FUNC_CALL VAR VAR... |
The Central Company has an office with a sophisticated security system. There are $10^6$ employees, numbered from $1$ to $10^6$.
The security system logs entrances and departures. The entrance of the $i$-th employee is denoted by the integer $i$, while the departure of the $i$-th employee is denoted by the integer $-i... | n = int(input())
A = input().split()
A = [int(k) for k in A]
imposs = False
days = []
curr_empl = set()
day_empl = set()
d_s = 0
for i in range(n):
e = A[i]
if e < 0:
if -e not in curr_empl:
imposs = True
break
curr_empl.remove(-e)
else:
if e in day_empl:
... | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR VAR VAR ASSIGN VAR NUMBER ASSIGN VAR LIST ASSIGN VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR VAR ASSIGN VAR VAR VAR IF VAR NUMBER IF VAR VAR ASSIGN VAR NUMBER EXPR FUNC_CALL VAR ... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.