description stringlengths 171 4k | code stringlengths 94 3.98k | normalized_code stringlengths 57 4.99k |
|---|---|---|
You are given sequence a_1, a_2, ..., a_{n} of integer numbers of length n. Your task is to find such subsequence that its sum is odd and maximum among all such subsequences. It's guaranteed that given sequence contains subsequence with odd sum.
Subsequence is a sequence that can be derived from another sequence by de... | n = int(input())
l = list(map(int, input().split()))
sum = 0
k = 0
for i in range(0, n):
if l[i] > 0:
sum += l[i]
k = k + 1
if sum % 2 == 1:
print(sum)
else:
min = float("inf")
if k >= 2:
for i in range(0, n):
if l[i] > 0 and l[i] < min and l[i] % 2 != 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 NUMBER FOR VAR FUNC_CALL VAR NUMBER VAR IF VAR VAR NUMBER VAR VAR VAR ASSIGN VAR BIN_OP VAR NUMBER IF BIN_OP VAR NUMBER NUMBER EXPR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR STRING IF ... |
You are given sequence a_1, a_2, ..., a_{n} of integer numbers of length n. Your task is to find such subsequence that its sum is odd and maximum among all such subsequences. It's guaranteed that given sequence contains subsequence with odd sum.
Subsequence is a sequence that can be derived from another sequence by de... | n = int(input())
arr = [int(x) for x in input().split()]
even = []
odd = []
odd_n = []
s = 0
for i in arr:
if i > 0:
s += i
if i % 2:
odd.append(i)
else:
even.append(i)
elif i % 2:
odd_n.append(i)
if s % 2:
print(s)
else:
if len(odd) > 0 and len(od... | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR LIST ASSIGN VAR LIST ASSIGN VAR LIST ASSIGN VAR NUMBER FOR VAR VAR IF VAR NUMBER VAR VAR IF BIN_OP VAR NUMBER EXPR FUNC_CALL VAR VAR EXPR FUNC_CALL VAR VAR IF BIN_OP VAR NUMBER EXPR FUNC_CALL VAR VAR IF BIN_OP VAR... |
You are given sequence a_1, a_2, ..., a_{n} of integer numbers of length n. Your task is to find such subsequence that its sum is odd and maximum among all such subsequences. It's guaranteed that given sequence contains subsequence with odd sum.
Subsequence is a sequence that can be derived from another sequence by de... | n = int(input())
a = list(map(int, input().split()))
even = -float("Inf")
odd = -float("Inf")
for i in range(n):
if a[i] % 2 == 0:
even = max([even + a[i], a[i], even])
odd = max([odd + a[i], odd])
if a[i] % 2 != 0:
odd, even = max([even + a[i], odd, a[i]]), max([odd + a[i], even])
if od... | 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 STRING ASSIGN VAR FUNC_CALL VAR STRING FOR VAR FUNC_CALL VAR VAR IF BIN_OP VAR VAR NUMBER NUMBER ASSIGN VAR FUNC_CALL VAR LIST BIN_OP VAR VAR VAR VAR VAR VAR ASSIGN VAR FUNC_CALL VAR LIST B... |
You are given sequence a_1, a_2, ..., a_{n} of integer numbers of length n. Your task is to find such subsequence that its sum is odd and maximum among all such subsequences. It's guaranteed that given sequence contains subsequence with odd sum.
Subsequence is a sequence that can be derived from another sequence by de... | n = int(input())
a = list(map(int, input().split()))
INF = 10**18
dp = [([-INF] * 2) for i in range(n)]
if a[0] % 2 == 0:
dp[0][0] = a[0]
else:
dp[0][1] = a[0]
for i in range(1, n):
if a[i] % 2:
dp[i][0] = max(dp[i - 1][1] + a[i], dp[i - 1][0])
dp[i][1] = max([a[i], dp[i - 1][0] + a[i], dp[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 NUMBER NUMBER ASSIGN VAR BIN_OP LIST VAR NUMBER VAR FUNC_CALL VAR VAR IF BIN_OP VAR NUMBER NUMBER NUMBER ASSIGN VAR NUMBER NUMBER VAR NUMBER ASSIGN VAR NUMBER NUMBER VAR NUMBER FOR VAR FUNC_CALL V... |
You are given sequence a_1, a_2, ..., a_{n} of integer numbers of length n. Your task is to find such subsequence that its sum is odd and maximum among all such subsequences. It's guaranteed that given sequence contains subsequence with odd sum.
Subsequence is a sequence that can be derived from another sequence by de... | def odd_sum(lst):
k, m = 0, 10**9
for elem in lst:
if elem >= 0:
k += elem
if k % 2:
return k
for elem in lst:
if elem % 2:
m = min(m, abs(elem))
return k - m
n = int(input())
a = [int(i) for i in input().split()]
print(odd_sum(a)) | FUNC_DEF ASSIGN VAR VAR NUMBER BIN_OP NUMBER NUMBER FOR VAR VAR IF VAR NUMBER VAR VAR IF BIN_OP VAR NUMBER RETURN VAR FOR VAR VAR IF BIN_OP VAR NUMBER ASSIGN VAR FUNC_CALL VAR VAR FUNC_CALL VAR VAR RETURN BIN_OP VAR VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR VAR FUNC_CALL FUNC_CALL VAR EXPR... |
You are given sequence a_1, a_2, ..., a_{n} of integer numbers of length n. Your task is to find such subsequence that its sum is odd and maximum among all such subsequences. It's guaranteed that given sequence contains subsequence with odd sum.
Subsequence is a sequence that can be derived from another sequence by de... | n = int(input())
a = list(map(int, input().split()))
codd, odd, even = 0, 0, 0
modd = 0
Modd = 10**5
K = -(10**5)
for i in range(n):
if a[i] > 0:
if a[i] % 2 == 0:
even += a[i]
if a[i] % 2 == 1:
odd += a[i]
modd = max(modd, a[i])
Modd = min(Modd, 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 VAR VAR NUMBER NUMBER NUMBER ASSIGN VAR NUMBER ASSIGN VAR BIN_OP NUMBER NUMBER ASSIGN VAR BIN_OP NUMBER NUMBER FOR VAR FUNC_CALL VAR VAR IF VAR VAR NUMBER IF BIN_OP VAR VAR NUMBER NUMBER VAR VAR VAR IF B... |
You are given sequence a_1, a_2, ..., a_{n} of integer numbers of length n. Your task is to find such subsequence that its sum is odd and maximum among all such subsequences. It's guaranteed that given sequence contains subsequence with odd sum.
Subsequence is a sequence that can be derived from another sequence by de... | n = int(input())
a = sorted(list(map(int, input().split())))
mx = max(a)
b = []
c = []
d = []
e = []
sum1 = 0
sum2 = 0
for i in range(n):
if a[i] >= 0:
sum1 += a[i]
if a[i] % 2 == 0:
b.append(a[i])
else:
c.append(a[i])
else:
sum2 += a[i]
if a[i] % ... | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR ASSIGN VAR LIST ASSIGN VAR LIST ASSIGN VAR LIST ASSIGN VAR LIST ASSIGN VAR NUMBER ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR VAR IF VAR VAR NUMBER VAR VAR VAR IF BIN_OP VAR V... |
You are given sequence a_1, a_2, ..., a_{n} of integer numbers of length n. Your task is to find such subsequence that its sum is odd and maximum among all such subsequences. It's guaranteed that given sequence contains subsequence with odd sum.
Subsequence is a sequence that can be derived from another sequence by de... | k = int(input())
liste = list(map(int, input().split()))
x = 0
list1 = []
for i in liste:
if i > 0:
x += i
if x % 2:
print(x)
else:
for i in liste:
if i % 2:
list1.append(abs(i))
print(x - min(list1)) | 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 FOR VAR VAR IF VAR NUMBER VAR VAR IF BIN_OP VAR NUMBER EXPR FUNC_CALL VAR VAR FOR VAR VAR IF BIN_OP VAR NUMBER EXPR FUNC_CALL VAR FUNC_CALL VAR VAR EXPR FUNC_CALL VAR BIN_OP VAR FU... |
You are given sequence a_1, a_2, ..., a_{n} of integer numbers of length n. Your task is to find such subsequence that its sum is odd and maximum among all such subsequences. It's guaranteed that given sequence contains subsequence with odd sum.
Subsequence is a sequence that can be derived from another sequence by de... | n = int(input())
l = list(map(int, input().split()))
su = 0
minodd = 2147483647
for i in range(n):
if l[i] > 0:
su += l[i]
if l[i] % 2 != 0:
minodd = min(abs(l[i]), minodd)
if su % 2 != 0:
print(su)
else:
print(su - minodd) | 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 FOR VAR FUNC_CALL VAR VAR IF VAR VAR NUMBER VAR VAR VAR IF BIN_OP VAR VAR NUMBER NUMBER ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR VAR VAR IF BIN_OP VAR NUMBER NUMBER EXPR FUNC_C... |
You are given sequence a_1, a_2, ..., a_{n} of integer numbers of length n. Your task is to find such subsequence that its sum is odd and maximum among all such subsequences. It's guaranteed that given sequence contains subsequence with odd sum.
Subsequence is a sequence that can be derived from another sequence by de... | n = int(input())
a = list(map(int, input().split()))
oddSum = 0
evenSum = 0
smallPos = 10**4 + 1
smallNeg = -(10**4) + 1
for i in range(n):
if a[i] > 0:
if a[i] % 2 == 0:
evenSum += a[i]
else:
oddSum += a[i]
smallPos = min(smallPos, a[i])
elif a[i] % 2 == 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 NUMBER ASSIGN VAR BIN_OP BIN_OP NUMBER NUMBER NUMBER ASSIGN VAR BIN_OP BIN_OP NUMBER NUMBER NUMBER FOR VAR FUNC_CALL VAR VAR IF VAR VAR NUMBER IF BIN_OP VAR VAR NUMBER NUMBER VAR VAR VA... |
You are given sequence a_1, a_2, ..., a_{n} of integer numbers of length n. Your task is to find such subsequence that its sum is odd and maximum among all such subsequences. It's guaranteed that given sequence contains subsequence with odd sum.
Subsequence is a sequence that can be derived from another sequence by de... | n = int(input())
l_n = list(map(int, input().split()))
l_o = list()
s = 0
for n in l_n:
if n % 2 == 0:
if abs(n) == n:
s += n
else:
l_o.append(n)
l_o.sort()
m_s = s
t_s = s
m_n_o = None
n_i = -1
for i in range(len(l_o)):
if abs(l_o[i]) != l_o[i]:
m_n_o = l_o[i]
n_... | 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 FOR VAR VAR IF BIN_OP VAR NUMBER NUMBER IF FUNC_CALL VAR VAR VAR VAR VAR EXPR FUNC_CALL VAR VAR EXPR FUNC_CALL VAR ASSIGN VAR VAR ASSIGN VAR VAR ASSIGN VAR NONE ASSIGN VAR... |
You are given sequence a_1, a_2, ..., a_{n} of integer numbers of length n. Your task is to find such subsequence that its sum is odd and maximum among all such subsequences. It's guaranteed that given sequence contains subsequence with odd sum.
Subsequence is a sequence that can be derived from another sequence by de... | n = int(input())
a = [int(x) for x in input().split()]
dp = [[(0) for x in range(2)] for y in range(n)]
dp[0][not a[0] % 2] = 0
dp[0][a[0] % 2] = a[0]
for i in range(1, n):
if a[i] % 2 == 0:
dp[i][0] = max(a[i] + dp[i - 1][0], dp[i - 1][0], a[i])
if dp[i - 1][1] != 0:
dp[i][1] = max(a[i]... | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR NUMBER VAR FUNC_CALL VAR NUMBER VAR FUNC_CALL VAR VAR ASSIGN VAR NUMBER BIN_OP VAR NUMBER NUMBER NUMBER ASSIGN VAR NUMBER BIN_OP VAR NUMBER NUMBER VAR NUMBER FOR VAR FUNC_CALL VAR NUMBER VAR IF BIN_OP VAR VAR NUMB... |
You are given sequence a_1, a_2, ..., a_{n} of integer numbers of length n. Your task is to find such subsequence that its sum is odd and maximum among all such subsequences. It's guaranteed that given sequence contains subsequence with odd sum.
Subsequence is a sequence that can be derived from another sequence by de... | n = int(input())
a = list(map(int, input().split()))
a.sort()
b = []
c = []
for i in range(n):
if a[i] >= 0:
b = a[i:]
break
c.append(a[i])
r = sum(b)
c = c[::-1]
if r % 2 != 0:
print(r)
else:
m = k = -10000000000.0
for i in b:
if (r - i) % 2 != 0:
k = r - i
... | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR EXPR FUNC_CALL VAR ASSIGN VAR LIST ASSIGN VAR LIST FOR VAR FUNC_CALL VAR VAR IF VAR VAR NUMBER ASSIGN VAR VAR VAR EXPR FUNC_CALL VAR VAR VAR ASSIGN VAR FUNC_CALL VAR VAR ASSIGN VAR VAR NUMBER IF BIN_OP VAR NUMBER N... |
You are given sequence a_1, a_2, ..., a_{n} of integer numbers of length n. Your task is to find such subsequence that its sum is odd and maximum among all such subsequences. It's guaranteed that given sequence contains subsequence with odd sum.
Subsequence is a sequence that can be derived from another sequence by de... | n = int(input())
o1 = []
o2 = []
e1 = []
e2 = []
l = list(map(int, input().split()))
for i in range(n):
if l[i] % 2 == 0:
if l[i] < 0:
e1.append(l[i])
elif l[i] > 0:
e2.append(l[i])
elif l[i] > 0:
o2.append(l[i])
elif l[i] < 0:
o1.append(l[i])
if len(o... | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR LIST ASSIGN VAR LIST ASSIGN VAR LIST ASSIGN VAR LIST ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR FOR VAR FUNC_CALL VAR VAR IF BIN_OP VAR VAR NUMBER NUMBER IF VAR VAR NUMBER EXPR FUNC_CALL VAR VAR VAR IF VAR VAR NUMBER EXPR FUNC_CALL VAR VAR VAR IF... |
You are given sequence a_1, a_2, ..., a_{n} of integer numbers of length n. Your task is to find such subsequence that its sum is odd and maximum among all such subsequences. It's guaranteed that given sequence contains subsequence with odd sum.
Subsequence is a sequence that can be derived from another sequence by de... | N = int(input())
A = [int(i) for i in input().split()]
try:
minposodd = min(a for a in A if a > 0 and a % 2)
except ValueError:
minposodd = None
try:
maxnegodd = max(a for a in A if a < 0 and a % 2)
except ValueError:
maxnegodd = None
sm = sum(a for a in A if a > 0)
if sm % 2:
print(sm)
else:
be... | 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 VAR VAR NUMBER BIN_OP VAR NUMBER VAR ASSIGN VAR NONE ASSIGN VAR FUNC_CALL VAR VAR VAR VAR VAR NUMBER BIN_OP VAR NUMBER VAR ASSIGN VAR NONE ASSIGN VAR FUNC_CALL VAR VAR VAR VAR VAR NUMBER IF B... |
You are given sequence a_1, a_2, ..., a_{n} of integer numbers of length n. Your task is to find such subsequence that its sum is odd and maximum among all such subsequences. It's guaranteed that given sequence contains subsequence with odd sum.
Subsequence is a sequence that can be derived from another sequence by de... | n = int(input())
t = list(map(int, input().split()))
s = sum(i for i in t if i > 0)
if s % 2:
print(s)
else:
m = [abs(i) for i in t if i % 2 == 1]
print(s - min(m)) | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR VAR VAR VAR NUMBER IF BIN_OP VAR NUMBER EXPR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR VAR VAR VAR BIN_OP VAR NUMBER NUMBER EXPR FUNC_CALL VAR BIN_OP VAR FUNC_CALL VAR VAR |
You are given sequence a_1, a_2, ..., a_{n} of integer numbers of length n. Your task is to find such subsequence that its sum is odd and maximum among all such subsequences. It's guaranteed that given sequence contains subsequence with odd sum.
Subsequence is a sequence that can be derived from another sequence by de... | input()
a = list(map(int, input().split()))
s = 0
p, n = [i for i in a if i > 0], [j for j in a if j < 0]
s = sum(p)
if s % 2 == 1:
print(s)
else:
m = -10000000
for x in sorted(n)[::-1]:
if x % 2 == 1:
m = x
break
for y in sorted(p):
if y % 2 == 1:
m =... | EXPR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR NUMBER ASSIGN VAR VAR VAR VAR VAR VAR NUMBER VAR VAR VAR VAR NUMBER ASSIGN VAR FUNC_CALL VAR VAR IF BIN_OP VAR NUMBER NUMBER EXPR FUNC_CALL VAR VAR ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR VAR NUMBER IF BIN_OP VAR NUMBER NUM... |
You are given sequence a_1, a_2, ..., a_{n} of integer numbers of length n. Your task is to find such subsequence that its sum is odd and maximum among all such subsequences. It's guaranteed that given sequence contains subsequence with odd sum.
Subsequence is a sequence that can be derived from another sequence by de... | n = int(input())
l = list(map(int, input().split()))
op = float("inf")
on = float("-inf")
flag1 = 0
flag2 = 0
sum = 0
for i in l:
if i > 0:
sum += i
if i % 2 != 0 and i > 0:
flag1 = 1
op = min(op, i)
elif i % 2 != 0 and i < 0:
flag2 = 1
on = max(on, i)
if flag1 == 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 STRING ASSIGN VAR FUNC_CALL VAR STRING ASSIGN VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR NUMBER FOR VAR VAR IF VAR NUMBER VAR VAR IF BIN_OP VAR NUMBER NUMBER VAR NUMBER ASSIGN VAR NUMBER ASSIG... |
You are given sequence a_1, a_2, ..., a_{n} of integer numbers of length n. Your task is to find such subsequence that its sum is odd and maximum among all such subsequences. It's guaranteed that given sequence contains subsequence with odd sum.
Subsequence is a sequence that can be derived from another sequence by de... | n = int(input())
a = list(map(int, input().split()))
odds = 0
evens = 0
even_sum = 0
odd_sum = 0
ev_min = 100000
odd_min = 100000
neg_ev_max = -1000000
neg_odd_max = -1000000
for x in a:
if x >= 0:
if x % 2 == 0:
even_sum += x
evens += 1
ev_min = min(ev_min, x)
el... | 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 NUMBER ASSIGN VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR NUMBER FOR VAR VAR IF VAR NUMBER IF BIN_OP VAR NUMBER NUMBER VAR VAR VAR NUMB... |
You are given sequence a_1, a_2, ..., a_{n} of integer numbers of length n. Your task is to find such subsequence that its sum is odd and maximum among all such subsequences. It's guaranteed that given sequence contains subsequence with odd sum.
Subsequence is a sequence that can be derived from another sequence by de... | n = int(input())
a = [int(i) for i in input().split()]
otrmax = -(10**4) - 1
polmin = 10**4 + 1
sm = 0
for i in a:
if i < 0:
if i > otrmax and i % 2 == 1:
otrmax = i
else:
if i < polmin and i % 2 == 1:
polmin = i
sm += i
if sm % 2 == 0:
vrs = []
if polmin ... | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR BIN_OP BIN_OP NUMBER NUMBER NUMBER ASSIGN VAR BIN_OP BIN_OP NUMBER NUMBER NUMBER ASSIGN VAR NUMBER FOR VAR VAR IF VAR NUMBER IF VAR VAR BIN_OP VAR NUMBER NUMBER ASSIGN VAR VAR IF VAR VAR BIN_OP VAR NUMBER NUMBER A... |
You are given sequence a_1, a_2, ..., a_{n} of integer numbers of length n. Your task is to find such subsequence that its sum is odd and maximum among all such subsequences. It's guaranteed that given sequence contains subsequence with odd sum.
Subsequence is a sequence that can be derived from another sequence by de... | n = int(input())
li = list(map(int, input().split()))
pos_sum = 0
mop = False
mon = False
min_od = int(pow(10, 6))
max_od = int(pow(10, 6))
max_od *= -1
for i in range(n):
if li[i] > 0:
pos_sum += li[i]
if li[i] % 2 != 0:
mop = True
min_od = min(min_od, li[i])
elif abs(li... | 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 FUNC_CALL VAR FUNC_CALL VAR NUMBER NUMBER ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR NUMBER NUMBER VAR NUMBER FOR VAR FUNC_CALL VAR VAR IF VAR VAR NUMBER... |
You are given sequence a_1, a_2, ..., a_{n} of integer numbers of length n. Your task is to find such subsequence that its sum is odd and maximum among all such subsequences. It's guaranteed that given sequence contains subsequence with odd sum.
Subsequence is a sequence that can be derived from another sequence by de... | n = int(input())
li = list(map(int, input().split()))
evensum, lis = 0, []
for i in li:
if i > 0:
evensum += i
if i % 2 != 0:
lis.append(abs(i))
print(evensum if evensum % 2 != 0 else evensum - min(lis)) | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR VAR NUMBER LIST FOR VAR VAR IF VAR NUMBER VAR VAR IF BIN_OP VAR NUMBER NUMBER EXPR FUNC_CALL VAR FUNC_CALL VAR VAR EXPR FUNC_CALL VAR BIN_OP VAR NUMBER NUMBER VAR BIN_OP VAR FUNC_CALL VAR VAR |
You are given sequence a_1, a_2, ..., a_{n} of integer numbers of length n. Your task is to find such subsequence that its sum is odd and maximum among all such subsequences. It's guaranteed that given sequence contains subsequence with odd sum.
Subsequence is a sequence that can be derived from another sequence by de... | n = int(input())
l = list(map(int, input().split()))
p = 9999
ne = -9999
s = 0
for i in l:
if i > 0:
s += i
if i % 2 == 1 and i < p:
p = i
elif i % 2 == 1 and i > ne:
ne = i
if s % 2 == 0:
print(s - min(p, -ne))
else:
print(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 NUMBER ASSIGN VAR NUMBER ASSIGN VAR NUMBER FOR VAR VAR IF VAR NUMBER VAR VAR IF BIN_OP VAR NUMBER NUMBER VAR VAR ASSIGN VAR VAR IF BIN_OP VAR NUMBER NUMBER VAR VAR ASSIGN VAR VAR IF BIN_OP VAR NUMBER NUM... |
You are given sequence a_1, a_2, ..., a_{n} of integer numbers of length n. Your task is to find such subsequence that its sum is odd and maximum among all such subsequences. It's guaranteed that given sequence contains subsequence with odd sum.
Subsequence is a sequence that can be derived from another sequence by de... | input()
l = list(map(int, input().split()))
l.sort(reverse=True)
s = 0
beforeNeg = -(10**12)
posEven = [x for x in l if x > 0 and x % 2 == 0]
posOdd = [x for x in l if x > 0 and x % 2 != 0]
posEven.sort()
posOdd.sort()
negOdd = [x for x in l if x < 0 and x % 2 != 0]
negOdd.sort(reverse=True)
if len(posOdd) % 2:
pri... | EXPR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR EXPR FUNC_CALL VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR BIN_OP NUMBER NUMBER ASSIGN VAR VAR VAR VAR VAR NUMBER BIN_OP VAR NUMBER NUMBER ASSIGN VAR VAR VAR VAR VAR NUMBER BIN_OP VAR NUMBER NUMBER EXPR FUNC_CALL VAR EXPR FUNC_CALL VAR AS... |
You are given sequence a_1, a_2, ..., a_{n} of integer numbers of length n. Your task is to find such subsequence that its sum is odd and maximum among all such subsequences. It's guaranteed that given sequence contains subsequence with odd sum.
Subsequence is a sequence that can be derived from another sequence by de... | n = int(input())
line = [int(x) for x in input().split()]
m = -10001
ans = []
b = []
for i in line:
if i % 2 == 0 and i > 0:
ans.append(i)
elif i % 2 != 0:
if i > 0:
ans.append(i)
m = 0
else:
b.append(i)
if m < i:
m = i
ans.... | 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 LIST ASSIGN VAR LIST FOR VAR VAR IF BIN_OP VAR NUMBER NUMBER VAR NUMBER EXPR FUNC_CALL VAR VAR IF BIN_OP VAR NUMBER NUMBER IF VAR NUMBER EXPR FUNC_CALL VAR VAR ASSIGN VAR NUMBER EXPR FUNC_CALL VA... |
You are given sequence a_1, a_2, ..., a_{n} of integer numbers of length n. Your task is to find such subsequence that its sum is odd and maximum among all such subsequences. It's guaranteed that given sequence contains subsequence with odd sum.
Subsequence is a sequence that can be derived from another sequence by de... | n = int(input())
arr = list(map(int, input().strip().split(" ")))
s = 0
pos = []
neg = []
for i in arr:
if i % 2 == 0:
s += max(0, i)
elif i >= 0:
pos.append(i)
else:
neg.append(i)
pos.sort(reverse=True)
neg.sort(reverse=True)
if len(pos) % 2 == 1:
s += sum(pos[:])
elif len(pos) ... | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL FUNC_CALL VAR STRING ASSIGN VAR NUMBER ASSIGN VAR LIST ASSIGN VAR LIST FOR VAR VAR IF BIN_OP VAR NUMBER NUMBER VAR FUNC_CALL VAR NUMBER VAR IF VAR NUMBER EXPR FUNC_CALL VAR VAR EXPR FUNC_CALL VAR VAR EXPR FUNC_CALL VAR... |
You are given sequence a_1, a_2, ..., a_{n} of integer numbers of length n. Your task is to find such subsequence that its sum is odd and maximum among all such subsequences. It's guaranteed that given sequence contains subsequence with odd sum.
Subsequence is a sequence that can be derived from another sequence by de... | n = int(input())
arr = list(map(int, input().strip().split()))
m = 2**31
res = 0
odd = False
for i in range(n):
if arr[i] > 0:
res += arr[i]
if arr[i] % 2 != 0:
odd = True
m = min(m, abs(arr[i]))
if not odd:
print(-1)
else:
if res % 2 == 0:
res -= m
print(res) | 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 BIN_OP NUMBER NUMBER ASSIGN VAR NUMBER ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR VAR IF VAR VAR NUMBER VAR VAR VAR IF BIN_OP VAR VAR NUMBER NUMBER ASSIGN VAR NUMBER ASSIGN VAR FUNC_CALL VAR VAR F... |
You are given sequence a_1, a_2, ..., a_{n} of integer numbers of length n. Your task is to find such subsequence that its sum is odd and maximum among all such subsequences. It's guaranteed that given sequence contains subsequence with odd sum.
Subsequence is a sequence that can be derived from another sequence by de... | n = int(input())
a = list(map(int, input().split()))
INF = 10**10
even = 0
odd = []
one = -INF
for x in a:
if x % 2:
odd.append(x)
elif x > 0:
even += x
odd = list(reversed(sorted(odd)))
ans = even + odd[0]
i = 0
while i < len(odd):
ans = max(even + odd[i], ans)
if i < len(odd) - 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 BIN_OP NUMBER NUMBER ASSIGN VAR NUMBER ASSIGN VAR LIST ASSIGN VAR VAR FOR VAR VAR IF BIN_OP VAR NUMBER EXPR FUNC_CALL VAR VAR IF VAR NUMBER VAR VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR VA... |
You are given sequence a_1, a_2, ..., a_{n} of integer numbers of length n. Your task is to find such subsequence that its sum is odd and maximum among all such subsequences. It's guaranteed that given sequence contains subsequence with odd sum.
Subsequence is a sequence that can be derived from another sequence by de... | import sys
n = int(input())
A = list(int(i) for i in input().split())
positiveeven = 0
positiveodd = 0
negativeeven = 0
negativeodd = 0
minpositiveodd = 10**18
maxnnegativeodd = -(10**18)
for i in range(n):
if A[i] % 2 == 0:
if A[i] >= 0:
positiveeven += A[i]
else:
negativee... | IMPORT ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR BIN_OP NUMBER NUMBER ASSIGN VAR BIN_OP NUMBER NUMBER FOR VAR FUNC_CALL VAR VAR IF BIN_OP VAR VAR NUMBER NUMBER IF VAR VA... |
You are given sequence a_1, a_2, ..., a_{n} of integer numbers of length n. Your task is to find such subsequence that its sum is odd and maximum among all such subsequences. It's guaranteed that given sequence contains subsequence with odd sum.
Subsequence is a sequence that can be derived from another sequence by de... | n = int(input())
al = list(map(int, input().split()))
alpp = [a for a in al if a > 0 and a % 2 == 0]
s = sum(alpp)
alpi = [a for a in al if a > 0 and a % 2 == 1]
if len(alpi) % 2 == 0:
if alpi:
mini = min(alpi)
s += sum(alpi)
alni = [a for a in al if a < 0 and a % 2 == 1]
if alni:
... | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR VAR VAR VAR VAR NUMBER BIN_OP VAR NUMBER NUMBER ASSIGN VAR FUNC_CALL VAR VAR ASSIGN VAR VAR VAR VAR VAR NUMBER BIN_OP VAR NUMBER NUMBER IF BIN_OP FUNC_CALL VAR VAR NUMBER NUMBER IF VAR ASSIGN VAR FUNC_CA... |
You are given sequence a_1, a_2, ..., a_{n} of integer numbers of length n. Your task is to find such subsequence that its sum is odd and maximum among all such subsequences. It's guaranteed that given sequence contains subsequence with odd sum.
Subsequence is a sequence that can be derived from another sequence by de... | n = int(input())
arr = list(map(int, input().split()))
i = 0
arr = sorted(arr, reverse=True)
Sum = 0
while i < n and arr[i] > 0:
Sum += arr[i]
i += 1
if Sum % 2 == 1:
print(Sum)
else:
k = i
negSum = Sum
while k < n and negSum % 2 == 0:
if arr[k] % 2 == 1:
negSum += arr[k]
... | 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 VAR NUMBER ASSIGN VAR NUMBER WHILE VAR VAR VAR VAR NUMBER VAR VAR VAR VAR NUMBER IF BIN_OP VAR NUMBER NUMBER EXPR FUNC_CALL VAR VAR ASSIGN VAR VAR ASSIGN VAR VAR WHILE VAR... |
You are given sequence a_1, a_2, ..., a_{n} of integer numbers of length n. Your task is to find such subsequence that its sum is odd and maximum among all such subsequences. It's guaranteed that given sequence contains subsequence with odd sum.
Subsequence is a sequence that can be derived from another sequence by de... | n = int(input())
x = sorted(map(int, input().split()))
s = 0
odd = []
ev = []
for i in range(n):
if x[i] % 2 == 0:
if x[i] > 0:
s += x[i]
else:
odd += [x[i]]
s += odd[-1]
j = len(odd) - 2
while j >= 1:
if odd[j] + odd[j - 1] > 0:
s += odd[j] + odd[j - 1]
j -= 2
... | 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 LIST FOR VAR FUNC_CALL VAR VAR IF BIN_OP VAR VAR NUMBER NUMBER IF VAR VAR NUMBER VAR VAR VAR VAR LIST VAR VAR VAR VAR NUMBER ASSIGN VAR BIN_OP FUNC_CALL VAR VAR NUMBER W... |
You are given sequence a_1, a_2, ..., a_{n} of integer numbers of length n. Your task is to find such subsequence that its sum is odd and maximum among all such subsequences. It's guaranteed that given sequence contains subsequence with odd sum.
Subsequence is a sequence that can be derived from another sequence by de... | n = int(input())
a = list(map(int, input().split()))
ans = int(0)
mx = int(-2000000000.0)
for i in a:
if i > 0:
ans += i
if ans % 2:
print(ans)
else:
for i in a:
if i < 0 and i % 2:
mx = max(mx, ans + i)
if i > 0 and i % 2:
mx = max(mx, ans - i)
print(mx) | 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 NUMBER ASSIGN VAR FUNC_CALL VAR NUMBER FOR VAR VAR IF VAR NUMBER VAR VAR IF BIN_OP VAR NUMBER EXPR FUNC_CALL VAR VAR FOR VAR VAR IF VAR NUMBER BIN_OP VAR NUMBER ASSIGN VAR FUNC_CALL VAR VAR... |
You are given sequence a_1, a_2, ..., a_{n} of integer numbers of length n. Your task is to find such subsequence that its sum is odd and maximum among all such subsequences. It's guaranteed that given sequence contains subsequence with odd sum.
Subsequence is a sequence that can be derived from another sequence by de... | n = int(input())
arr = list(map(int, input().split()))
max_odd_neg = -1000000000.0
for i in arr:
if i < 0 and i % 2 == 1:
max_odd_neg = max(max_odd_neg, i)
min_pos_odd = 1000000000.0
for i in arr:
if i > 0 and i % 2 == 1:
min_pos_odd = min(min_pos_odd, i)
s = 0
for i in arr:
if 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 NUMBER FOR VAR VAR IF VAR NUMBER BIN_OP VAR NUMBER NUMBER ASSIGN VAR FUNC_CALL VAR VAR VAR ASSIGN VAR NUMBER FOR VAR VAR IF VAR NUMBER BIN_OP VAR NUMBER NUMBER ASSIGN VAR FUNC_CALL VAR VAR VAR ASSIGN VAR... |
You are given sequence a_1, a_2, ..., a_{n} of integer numbers of length n. Your task is to find such subsequence that its sum is odd and maximum among all such subsequences. It's guaranteed that given sequence contains subsequence with odd sum.
Subsequence is a sequence that can be derived from another sequence by de... | n = int(input())
a = input()
A = list(map(int, list(a.split())))
e = [0] * n
o = [0] * n
if A[0] % 2 == 0:
e[0] = A[0]
else:
o[0] = A[0]
for i in range(1, n):
if A[i] % 2 == 0:
e[i] = max(A[i], A[i] + e[i - 1], e[i - 1])
if o[i - 1] != 0:
o[i] = max(A[i] + o[i - 1], o[i - 1])
... | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR BIN_OP LIST NUMBER VAR ASSIGN VAR BIN_OP LIST NUMBER VAR IF BIN_OP VAR NUMBER NUMBER NUMBER ASSIGN VAR NUMBER VAR NUMBER ASSIGN VAR NUMBER VAR NUMBER FOR VAR FUNC_CALL VAR NU... |
You are given sequence a_1, a_2, ..., a_{n} of integer numbers of length n. Your task is to find such subsequence that its sum is odd and maximum among all such subsequences. It's guaranteed that given sequence contains subsequence with odd sum.
Subsequence is a sequence that can be derived from another sequence by de... | n = int(input())
a = list(map(int, input().split()))
ans = 0
min_odd = float("-inf")
max_odd = float("inf")
for i in a:
if i > 0:
ans += i
if i % 2 != 0:
if i < 0:
min_odd = max(min_odd, i)
else:
max_odd = min(max_odd, i)
if ans % 2 == 0:
print(max(ans + min_o... | 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 STRING ASSIGN VAR FUNC_CALL VAR STRING FOR VAR VAR IF VAR NUMBER VAR VAR IF BIN_OP VAR NUMBER NUMBER IF VAR NUMBER ASSIGN VAR FUNC_CALL VAR VAR VAR ASSIGN VAR FUNC_CALL VA... |
You are given sequence a_1, a_2, ..., a_{n} of integer numbers of length n. Your task is to find such subsequence that its sum is odd and maximum among all such subsequences. It's guaranteed that given sequence contains subsequence with odd sum.
Subsequence is a sequence that can be derived from another sequence by de... | n = int(input())
a = list(map(int, input().split()))
s = 0
b = 0
c = 0
for i in a:
if i > 0:
s += i
if i % 2 != 0:
if b > 0:
b = min(b, i)
if b == 0:
b = i
if i < 0 and i % 2 != 0:
if c < 0:
c = max(c, i)
if 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 NUMBER ASSIGN VAR NUMBER ASSIGN VAR NUMBER FOR VAR VAR IF VAR NUMBER VAR VAR IF BIN_OP VAR NUMBER NUMBER IF VAR NUMBER ASSIGN VAR FUNC_CALL VAR VAR VAR IF VAR NUMBER ASSIGN VAR VAR IF VAR NUMBER BIN_OP V... |
You are given sequence a_1, a_2, ..., a_{n} of integer numbers of length n. Your task is to find such subsequence that its sum is odd and maximum among all such subsequences. It's guaranteed that given sequence contains subsequence with odd sum.
Subsequence is a sequence that can be derived from another sequence by de... | n = int(input())
x = list(map(int, input().split()))
odd_cnt = []
ans = 0
for i in range(n):
if x[i] % 2 == 0 and x[i] > 0:
ans += x[i]
elif x[i] % 2 != 0:
odd_cnt.append(x[i])
odd_cnt.sort(reverse=True)
for j in range(len(odd_cnt)):
if j == 0 and odd_cnt[j] < 0:
ans += odd_cnt[j]
... | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR LIST ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR VAR IF BIN_OP VAR VAR NUMBER NUMBER VAR VAR NUMBER VAR VAR VAR IF BIN_OP VAR VAR NUMBER NUMBER EXPR FUNC_CALL VAR VAR VAR EXPR FUNC_CALL VAR NUMBER FOR VAR FU... |
You are given sequence a_1, a_2, ..., a_{n} of integer numbers of length n. Your task is to find such subsequence that its sum is odd and maximum among all such subsequences. It's guaranteed that given sequence contains subsequence with odd sum.
Subsequence is a sequence that can be derived from another sequence by de... | n = int(input())
a = list(map(int, input().split(" ")))
minus_odd = -10001
plus_odd = 10001
total = 0
for i in a:
if i % 2:
if i < 0:
minus_odd = max(minus_odd, i)
else:
plus_odd = min(plus_odd, i)
if i > 0:
total += i
if total % 2 == 0:
if minus_odd == -10001... | 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 NUMBER ASSIGN VAR NUMBER FOR VAR VAR IF BIN_OP VAR NUMBER IF VAR NUMBER ASSIGN VAR FUNC_CALL VAR VAR VAR ASSIGN VAR FUNC_CALL VAR VAR VAR IF VAR NUMBER VAR VAR IF BIN_OP VAR NUMB... |
You are given sequence a_1, a_2, ..., a_{n} of integer numbers of length n. Your task is to find such subsequence that its sum is odd and maximum among all such subsequences. It's guaranteed that given sequence contains subsequence with odd sum.
Subsequence is a sequence that can be derived from another sequence by de... | def LOS(L):
sum1 = 0
for i in range(len(L)):
if L[i] > 0:
sum1 = sum1 + L[i]
if sum1 % 2 != 0:
return sum1
isodd = False
min = 0
for i in range(len(L)):
if isodd == False and L[i] % 2 != 0:
isodd = True
min = L[i]
elif isodd == ... | FUNC_DEF ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR FUNC_CALL VAR VAR IF VAR VAR NUMBER ASSIGN VAR BIN_OP VAR VAR VAR IF BIN_OP VAR NUMBER NUMBER RETURN VAR ASSIGN VAR NUMBER ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR FUNC_CALL VAR VAR IF VAR NUMBER BIN_OP VAR VAR NUMBER NUMBER ASSIGN VAR NUMBER ASSIGN VAR VAR VAR IF VAR NUM... |
You are given sequence a_1, a_2, ..., a_{n} of integer numbers of length n. Your task is to find such subsequence that its sum is odd and maximum among all such subsequences. It's guaranteed that given sequence contains subsequence with odd sum.
Subsequence is a sequence that can be derived from another sequence by de... | n = int(input())
arr = [int(i) for i in input().split()]
s = 0
for i in range(n):
if arr[i] > 0:
s += arr[i]
if s % 2 != 0:
print(s)
else:
m = 100000
for i in range(n):
if arr[i] > 0 and arr[i] % 2 != 0:
m = min(m, arr[i])
ans = s - m
for i in range(n):
if arr... | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR VAR IF VAR VAR NUMBER VAR VAR VAR IF BIN_OP VAR NUMBER NUMBER EXPR FUNC_CALL VAR VAR ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR VAR IF VAR VAR NUMBER BIN_OP VAR VAR NUMBER NUMBER ASSIGN V... |
You are given sequence a_1, a_2, ..., a_{n} of integer numbers of length n. Your task is to find such subsequence that its sum is odd and maximum among all such subsequences. It's guaranteed that given sequence contains subsequence with odd sum.
Subsequence is a sequence that can be derived from another sequence by de... | tam = int(input())
numeros = [*map(int, input().split())]
intMax = 1000000
soma = 0
m = intMax
for e in numeros:
if e > 0:
soma += e
if e % 2 != 0:
m = min(m, abs(e))
if soma % 2 == 0:
soma -= m
print(soma) | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR LIST FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR VAR FOR VAR VAR IF VAR NUMBER VAR VAR IF BIN_OP VAR NUMBER NUMBER ASSIGN VAR FUNC_CALL VAR VAR FUNC_CALL VAR VAR IF BIN_OP VAR NUMBER NUMBER VAR VAR EXPR FUNC_CALL VAR VAR |
You are given sequence a_1, a_2, ..., a_{n} of integer numbers of length n. Your task is to find such subsequence that its sum is odd and maximum among all such subsequences. It's guaranteed that given sequence contains subsequence with odd sum.
Subsequence is a sequence that can be derived from another sequence by de... | def makeodd(listt):
c = 0
for r in range(len(listt)):
if listt[r] % 2 == 0:
listt[r] = "blah"
c += 1
for e in range(c):
listt.remove("blah")
n = int(input())
inp = input()
nums = inp.split(" ")
for w in range(len(nums)):
nums[w] = int(nums[w])
sum = 0
tsum = 0
n... | FUNC_DEF ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR FUNC_CALL VAR VAR IF BIN_OP VAR VAR NUMBER NUMBER ASSIGN VAR VAR STRING VAR NUMBER FOR VAR FUNC_CALL VAR VAR EXPR FUNC_CALL VAR STRING ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR STRING FOR VAR FUNC_CALL VAR FUNC_CALL VAR VAR ... |
You are given sequence a_1, a_2, ..., a_{n} of integer numbers of length n. Your task is to find such subsequence that its sum is odd and maximum among all such subsequences. It's guaranteed that given sequence contains subsequence with odd sum.
Subsequence is a sequence that can be derived from another sequence by de... | from sys import stdin, stdout
def get():
return stdin.readline().strip()
def getf():
return [int(i) for i in get().split()]
def put(a, end="\n"):
stdout.write(str(a) + end)
def putf(a, sep=" ", end="\n"):
stdout.write(sep.join(map(str, a)) + end)
def main():
n = int(get())
a = getf()
... | FUNC_DEF RETURN FUNC_CALL FUNC_CALL VAR FUNC_DEF RETURN FUNC_CALL VAR VAR VAR FUNC_CALL FUNC_CALL VAR FUNC_DEF STRING EXPR FUNC_CALL VAR BIN_OP FUNC_CALL VAR VAR VAR FUNC_DEF STRING STRING EXPR FUNC_CALL VAR BIN_OP FUNC_CALL VAR FUNC_CALL VAR VAR VAR VAR FUNC_DEF ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_C... |
You are given sequence a_1, a_2, ..., a_{n} of integer numbers of length n. Your task is to find such subsequence that its sum is odd and maximum among all such subsequences. It's guaranteed that given sequence contains subsequence with odd sum.
Subsequence is a sequence that can be derived from another sequence by de... | n = int(input())
arr = list(map(int, input().split()))
smallest_odd = 10**9
greatest_neg_odd = -(10**9)
ans = 0
for i in arr:
if i > 0:
ans += i
if i > 0 and i % 2 != 0:
smallest_odd = min(smallest_odd, i)
if i < 0 and i % 2 != 0:
greatest_neg_odd = max(greatest_neg_odd, i)
if 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 BIN_OP NUMBER NUMBER ASSIGN VAR BIN_OP NUMBER NUMBER ASSIGN VAR NUMBER FOR VAR VAR IF VAR NUMBER VAR VAR IF VAR NUMBER BIN_OP VAR NUMBER NUMBER ASSIGN VAR FUNC_CALL VAR VAR VAR IF VAR NUMBER BIN_OP VAR N... |
You are given sequence a_1, a_2, ..., a_{n} of integer numbers of length n. Your task is to find such subsequence that its sum is odd and maximum among all such subsequences. It's guaranteed that given sequence contains subsequence with odd sum.
Subsequence is a sequence that can be derived from another sequence by de... | _ = input()
v = [int(x) for x in input().split()]
neg_par = []
neg_impar = []
poz_par = []
poz_impar = []
for x in v:
if x < 0:
if x % 2 == 0:
neg_par.append(x)
else:
neg_impar.append(x)
elif x % 2 == 0:
poz_par.append(x)
else:
poz_impar.append(x)
neg_... | ASSIGN VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR LIST ASSIGN VAR LIST ASSIGN VAR LIST ASSIGN VAR LIST FOR VAR VAR IF VAR NUMBER IF BIN_OP VAR NUMBER NUMBER EXPR FUNC_CALL VAR VAR EXPR FUNC_CALL VAR VAR IF BIN_OP VAR NUMBER NUMBER EXPR FUNC_CALL VAR VAR EXPR FUNC_CALL VAR VAR ... |
You are given sequence a_1, a_2, ..., a_{n} of integer numbers of length n. Your task is to find such subsequence that its sum is odd and maximum among all such subsequences. It's guaranteed that given sequence contains subsequence with odd sum.
Subsequence is a sequence that can be derived from another sequence by de... | n = int(input())
a = list(map(int, input().split()))
cn = sum([val for val in a if val % 2 == 0 and val > 0])
odd = [val for val in a if val & 1]
odd.sort()
if odd[-1] < 0:
cn += odd[-1]
else:
pos = [val for val in odd if val > 0]
neg = [val for val in odd if val < 0]
sz = len(pos)
cn += sum(pos[sz ... | 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 VAR VAR BIN_OP VAR NUMBER NUMBER VAR NUMBER ASSIGN VAR VAR VAR VAR BIN_OP VAR NUMBER EXPR FUNC_CALL VAR IF VAR NUMBER NUMBER VAR VAR NUMBER ASSIGN VAR VAR VAR VAR VAR NUMBER ASSIGN VAR ... |
You are given sequence a_1, a_2, ..., a_{n} of integer numbers of length n. Your task is to find such subsequence that its sum is odd and maximum among all such subsequences. It's guaranteed that given sequence contains subsequence with odd sum.
Subsequence is a sequence that can be derived from another sequence by de... | n = int(input())
a = list(map(int, input().split(" ")))
s = 0
od = []
od_neg = []
for i in range(n):
if a[i] > 0:
s += a[i]
if a[i] > 0 and a[i] % 2:
od.append(a[i])
elif a[i] < 0 and a[i] % 2:
od_neg.append(a[i])
od.sort()
od_neg.sort()
if s % 2:
print(s)
elif od and od_neg:
... | 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 LIST ASSIGN VAR LIST FOR VAR FUNC_CALL VAR VAR IF VAR VAR NUMBER VAR VAR VAR IF VAR VAR NUMBER BIN_OP VAR VAR NUMBER EXPR FUNC_CALL VAR VAR VAR IF VAR VAR NUMBER BIN_OP VAR VAR N... |
You are given sequence a_1, a_2, ..., a_{n} of integer numbers of length n. Your task is to find such subsequence that its sum is odd and maximum among all such subsequences. It's guaranteed that given sequence contains subsequence with odd sum.
Subsequence is a sequence that can be derived from another sequence by de... | n = int(input())
a = [int(i) for i in input().split()]
sp = 0
for i in a:
if i >= 0:
sp += i
if sp % 2 == 1:
print(sp)
else:
v = list(filter(lambda x: x > 0 and x % 2 == 1, a))
if len(v) == 0:
sm = -1000000000.0
else:
sm = sp - min(v)
for i in a:
if i < 0 and i % ... | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR NUMBER FOR VAR VAR IF VAR NUMBER VAR VAR IF BIN_OP VAR NUMBER NUMBER EXPR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR NUMBER BIN_OP VAR NUMBER NUMBER VAR IF FUNC_CALL VAR VAR NUMBER ASSIGN VAR NUM... |
You are given sequence a_1, a_2, ..., a_{n} of integer numbers of length n. Your task is to find such subsequence that its sum is odd and maximum among all such subsequences. It's guaranteed that given sequence contains subsequence with odd sum.
Subsequence is a sequence that can be derived from another sequence by de... | n = int(input())
numbers = [int(i) for i in input().split()]
l = 0
r = 0
positive = [i for i in numbers if i >= 0]
negative = [i for i in numbers if i < 0]
sumT = sum(positive)
negative.sort(reverse=True)
positive.sort()
imparPositivo = 0
flag = False
for v in positive:
if v % 2 == 1:
flag = True
im... | 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 VAR VAR VAR VAR NUMBER ASSIGN VAR VAR VAR VAR VAR NUMBER ASSIGN VAR FUNC_CALL VAR VAR EXPR FUNC_CALL VAR NUMBER EXPR FUNC_CALL VAR ASSIGN VAR NUMBER ASSIGN VAR NUMBER FOR VAR VA... |
You are given sequence a_1, a_2, ..., a_{n} of integer numbers of length n. Your task is to find such subsequence that its sum is odd and maximum among all such subsequences. It's guaranteed that given sequence contains subsequence with odd sum.
Subsequence is a sequence that can be derived from another sequence by de... | n = int(input())
A = list(map(int, input().split()))
p = []
m = []
for a in A:
if a > 0:
p.append(a)
elif a < 0 and a % 2:
m.append(a)
if p:
p.sort()
sm = sum(p)
else:
sm = 0
if sm % 2:
print(sm)
exit()
pcand = float("inf")
if m:
mcand = max(m)
else:
mcand = -float("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 LIST ASSIGN VAR LIST FOR VAR VAR IF VAR NUMBER EXPR FUNC_CALL VAR VAR IF VAR NUMBER BIN_OP VAR NUMBER EXPR FUNC_CALL VAR VAR IF VAR EXPR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR ASSIGN VAR NUMBER IF BI... |
You are given sequence a_1, a_2, ..., a_{n} of integer numbers of length n. Your task is to find such subsequence that its sum is odd and maximum among all such subsequences. It's guaranteed that given sequence contains subsequence with odd sum.
Subsequence is a sequence that can be derived from another sequence by de... | n = int(input())
A = list(map(int, input().split()))
sumpos = 0
maxoddneg = 100000000
minoddpos = 100000000
for i in A:
if i > 0:
sumpos += i
if i % 2:
minoddpos = min(minoddpos, i)
elif i % 2:
maxoddneg = min(-i, maxoddneg)
if sumpos % 2:
print(sumpos)
else:
print(su... | 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 FOR VAR VAR IF VAR NUMBER VAR VAR IF BIN_OP VAR NUMBER ASSIGN VAR FUNC_CALL VAR VAR VAR IF BIN_OP VAR NUMBER ASSIGN VAR FUNC_CALL VAR VAR VAR IF BIN_OP VAR NUMB... |
You are given sequence a_1, a_2, ..., a_{n} of integer numbers of length n. Your task is to find such subsequence that its sum is odd and maximum among all such subsequences. It's guaranteed that given sequence contains subsequence with odd sum.
Subsequence is a sequence that can be derived from another sequence by de... | n = int(input())
l = list(map(int, input().split()))
su = 0
l1 = []
for x in l:
if x % 2 == 0 and x > 0:
su += x
elif abs(x) % 2 != 0:
l1.append(x)
l1 = sorted(l1)
l1 = l1[::-1]
su += l1[0]
for i in range(2, len(l1), 2):
q = l1[i] + l1[i - 1]
if q > 0:
su += q
print(su) | 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 FOR VAR VAR IF BIN_OP VAR NUMBER NUMBER VAR NUMBER VAR VAR IF BIN_OP FUNC_CALL VAR VAR NUMBER NUMBER EXPR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR VAR ASSIGN VAR VAR NUMBER VAR V... |
You are given sequence a_1, a_2, ..., a_{n} of integer numbers of length n. Your task is to find such subsequence that its sum is odd and maximum among all such subsequences. It's guaranteed that given sequence contains subsequence with odd sum.
Subsequence is a sequence that can be derived from another sequence by de... | n = int(input())
A = [int(num) for num in input().split()]
odd = sorted(list(filter(lambda t: t % 2 != 0, A)), reverse=True)
even = sorted(list(filter(lambda t: t % 2 == 0, A)), reverse=True)
max_ev = 0
i = 0
while i < len(even) and even[i] > 0:
max_ev += even[i]
i += 1
d = []
for j in odd:
if d == []:
... | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR BIN_OP VAR NUMBER NUMBER VAR NUMBER ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR BIN_OP VAR NUMBER NUMBER VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR NUMBER WHILE VAR ... |
You are given sequence a_1, a_2, ..., a_{n} of integer numbers of length n. Your task is to find such subsequence that its sum is odd and maximum among all such subsequences. It's guaranteed that given sequence contains subsequence with odd sum.
Subsequence is a sequence that can be derived from another sequence by de... | n = int(input())
a = list(map(int, input().split()))
d = []
a.sort()
e = []
for j in range(n):
if a[j] >= 0:
d.append(a[j])
else:
e.append(a[j])
if len(d) == 0:
for j in range(n - 1, -1, -1):
if a[j] % 2 == 1:
val = a[j]
break
else:
s = sum(d)
if s % 2... | 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 EXPR FUNC_CALL VAR ASSIGN VAR LIST FOR VAR FUNC_CALL VAR VAR IF VAR VAR NUMBER EXPR FUNC_CALL VAR VAR VAR EXPR FUNC_CALL VAR VAR VAR IF FUNC_CALL VAR VAR NUMBER FOR VAR FUNC_CALL VAR BIN_OP VAR NUMB... |
You are given sequence a_1, a_2, ..., a_{n} of integer numbers of length n. Your task is to find such subsequence that its sum is odd and maximum among all such subsequences. It's guaranteed that given sequence contains subsequence with odd sum.
Subsequence is a sequence that can be derived from another sequence by de... | input()
nums = sorted(int(x) for x in input().split())
s = 0
odds, s = [], 0
for n in nums:
if n % 2 != 0:
odds.append(n)
elif n > 0:
s += n
cnt, last = 0, None
while True:
if not odds:
break
if odds[-1] < 0:
break
o = odds.pop(-1)
s += o
last = o
cnt += 1... | EXPR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR NUMBER ASSIGN VAR VAR LIST NUMBER FOR VAR VAR IF BIN_OP VAR NUMBER NUMBER EXPR FUNC_CALL VAR VAR IF VAR NUMBER VAR VAR ASSIGN VAR VAR NUMBER NONE WHILE NUMBER IF VAR IF VAR NUMBER NUMBER ASSIGN VAR FUNC_CALL VAR NUMBER ... |
You are given sequence a_1, a_2, ..., a_{n} of integer numbers of length n. Your task is to find such subsequence that its sum is odd and maximum among all such subsequences. It's guaranteed that given sequence contains subsequence with odd sum.
Subsequence is a sequence that can be derived from another sequence by de... | n = int(input())
l = list(map(int, input().split()))
nas = min(map(abs, filter(lambda n: n % 2 == 1, l)))
out = sum(filter(lambda n: n > 0, l))
if out % 2 == 0:
print(out - nas)
else:
print(out) | 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 VAR BIN_OP VAR NUMBER NUMBER VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR NUMBER VAR IF BIN_OP VAR NUMBER NUMBER EXPR FUNC_CALL VAR BIN_OP VAR VAR EXPR FUNC_CA... |
You are given sequence a_1, a_2, ..., a_{n} of integer numbers of length n. Your task is to find such subsequence that its sum is odd and maximum among all such subsequences. It's guaranteed that given sequence contains subsequence with odd sum.
Subsequence is a sequence that can be derived from another sequence by de... | def main():
n = int(input())
a = list(map(int, input().split()))
ans = sum(x for x in a if x > 0)
if ans % 2 == 1:
print(ans)
return
c = None
for x in a:
if x % 2 == 1:
if c is None:
c = abs(x)
else:
c = min(c, abs(x... | 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 VAR VAR VAR VAR NUMBER IF BIN_OP VAR NUMBER NUMBER EXPR FUNC_CALL VAR VAR RETURN ASSIGN VAR NONE FOR VAR VAR IF BIN_OP VAR NUMBER NUMBER IF VAR NONE ASSIGN VAR FUNC_CALL VAR VAR AS... |
You are given sequence a_1, a_2, ..., a_{n} of integer numbers of length n. Your task is to find such subsequence that its sum is odd and maximum among all such subsequences. It's guaranteed that given sequence contains subsequence with odd sum.
Subsequence is a sequence that can be derived from another sequence by de... | n = int(input())
a = [int(m) for m in input().split()]
b = []
ans = 0
for i in a:
if i & 1:
b.append(i)
elif i > 0:
ans += i
b.sort(reverse=True)
ans += b[0]
L = len(b)
for i in range(1, L, 2):
if i + 1 >= L:
break
r = b[i] + b[i + 1]
if r > 0:
ans += r
else:
... | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR LIST ASSIGN VAR NUMBER FOR VAR VAR IF BIN_OP VAR NUMBER EXPR FUNC_CALL VAR VAR IF VAR NUMBER VAR VAR EXPR FUNC_CALL VAR NUMBER VAR VAR NUMBER ASSIGN VAR FUNC_CALL VAR VAR FOR VAR FUNC_CALL VAR NUMBER VAR NUMBER IF... |
You are given sequence a_1, a_2, ..., a_{n} of integer numbers of length n. Your task is to find such subsequence that its sum is odd and maximum among all such subsequences. It's guaranteed that given sequence contains subsequence with odd sum.
Subsequence is a sequence that can be derived from another sequence by de... | n = int(input())
nums = list(map(int, input().split()))
pos = [x for x in nums if x > 0]
neg = [x for x in nums if x < 0]
s1 = sum(pos)
if s1 % 2 == 1:
print(s1)
exit()
podd = [x for x in pos if x % 2 == 1]
nodd = [x for x in neg if x % 2 == 1]
if podd:
min_podd = min(podd)
if not nodd:
s1 -= mi... | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR VAR VAR VAR VAR NUMBER ASSIGN VAR VAR VAR VAR VAR NUMBER ASSIGN VAR FUNC_CALL VAR VAR IF BIN_OP VAR NUMBER NUMBER EXPR FUNC_CALL VAR VAR EXPR FUNC_CALL VAR ASSIGN VAR VAR VAR VAR BIN_OP VAR NUMBER NUMBER... |
You are given sequence a_1, a_2, ..., a_{n} of integer numbers of length n. Your task is to find such subsequence that its sum is odd and maximum among all such subsequences. It's guaranteed that given sequence contains subsequence with odd sum.
Subsequence is a sequence that can be derived from another sequence by de... | def solve(n, arr):
ans = 0
min_odd = float("inf")
max_neg = float("-inf")
for v in arr:
if v < 0:
if abs(v) % 2 == 1:
max_neg = max(max_neg, v)
else:
ans += v
if v % 2 == 1:
min_odd = min(min_odd, v)
if ans % 2 == 0:... | FUNC_DEF ASSIGN VAR NUMBER ASSIGN VAR FUNC_CALL VAR STRING ASSIGN VAR FUNC_CALL VAR STRING FOR VAR VAR IF VAR NUMBER IF BIN_OP FUNC_CALL VAR VAR NUMBER NUMBER ASSIGN VAR FUNC_CALL VAR VAR VAR VAR VAR IF BIN_OP VAR NUMBER NUMBER ASSIGN VAR FUNC_CALL VAR VAR VAR IF BIN_OP VAR NUMBER NUMBER VAR FUNC_CALL VAR VAR VAR EXPR ... |
You are given sequence a_1, a_2, ..., a_{n} of integer numbers of length n. Your task is to find such subsequence that its sum is odd and maximum among all such subsequences. It's guaranteed that given sequence contains subsequence with odd sum.
Subsequence is a sequence that can be derived from another sequence by de... | n = int(input())
a = [int(s) for s in input().split()]
ap = [x for x in a if x > 0]
ap.sort()
bp = [(x % 2) for x in ap]
ao = [x for x in a if x < 0]
ao.sort()
ao.reverse()
bo = [(x % 2) for x in ao]
s = sum(ap)
cp = bp.count(1)
co = bo.count(1)
if cp % 2 == 1:
print(s)
elif cp > 0:
if co > 0:
print(max... | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR VAR VAR VAR VAR NUMBER EXPR FUNC_CALL VAR ASSIGN VAR BIN_OP VAR NUMBER VAR VAR ASSIGN VAR VAR VAR VAR VAR NUMBER EXPR FUNC_CALL VAR EXPR FUNC_CALL VAR ASSIGN VAR BIN_OP VAR NUMBER VAR VAR ASSIGN VAR FUNC_CALL VAR ... |
You are given sequence a_1, a_2, ..., a_{n} of integer numbers of length n. Your task is to find such subsequence that its sum is odd and maximum among all such subsequences. It's guaranteed that given sequence contains subsequence with odd sum.
Subsequence is a sequence that can be derived from another sequence by de... | n = int(input())
l = list(map(int, input().split()))
l1, l2, l1e, l1o, l2e, l2o = [], [], [], [], [], []
for i in range(len(l)):
if l[i] >= 0:
l1.append(l[i])
else:
l2.append(l[i])
for i in range(len(l)):
if l[i] >= 0 and l[i] % 2 == 0 and l[i] != 0:
l1e.append(l[i])
elif l[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 VAR VAR VAR VAR LIST LIST LIST LIST LIST LIST FOR VAR FUNC_CALL VAR FUNC_CALL VAR VAR IF VAR VAR NUMBER EXPR FUNC_CALL VAR VAR VAR EXPR FUNC_CALL VAR VAR VAR FOR VAR FUNC_CALL VAR FUNC_CALL VAR VAR I... |
You are given sequence a_1, a_2, ..., a_{n} of integer numbers of length n. Your task is to find such subsequence that its sum is odd and maximum among all such subsequences. It's guaranteed that given sequence contains subsequence with odd sum.
Subsequence is a sequence that can be derived from another sequence by de... | n = int(input())
a = list(map(int, input().split()))
ans = 0
for i in range(n):
if a[i] > 0:
ans += a[i]
if ans % 2 != 0:
print(ans)
else:
x = [i for i in a if i % 2 != 0 and i < 0]
y = [i for i in a if i % 2 != 0 and i > 0]
x = sorted(x)
y = sorted(y)
if x and y:
if abs(x[-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 FOR VAR FUNC_CALL VAR VAR IF VAR VAR NUMBER VAR VAR VAR IF BIN_OP VAR NUMBER NUMBER EXPR FUNC_CALL VAR VAR ASSIGN VAR VAR VAR VAR BIN_OP VAR NUMBER NUMBER VAR NUMBER ASSIGN VAR VAR VAR VAR BIN_OP ... |
You are given sequence a_1, a_2, ..., a_{n} of integer numbers of length n. Your task is to find such subsequence that its sum is odd and maximum among all such subsequences. It's guaranteed that given sequence contains subsequence with odd sum.
Subsequence is a sequence that can be derived from another sequence by de... | from sys import exit
negative = []
positive = []
n = int(input())
total = 0
for i in input().split():
a = int(i)
if a > 0:
positive.append(a)
total += a
else:
negative.append(-a)
if total % 2 == 1:
print(total)
exit(0)
positive.sort()
negative.sort()
a1 = 10000007
a2 = 10000... | ASSIGN VAR LIST ASSIGN VAR LIST ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR NUMBER FOR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR IF VAR NUMBER EXPR FUNC_CALL VAR VAR VAR VAR EXPR FUNC_CALL VAR VAR IF BIN_OP VAR NUMBER NUMBER EXPR FUNC_CALL VAR VAR EXPR FUNC_CALL VAR NUMBER EXPR FUNC_CALL VAR EXPR F... |
You are given sequence a_1, a_2, ..., a_{n} of integer numbers of length n. Your task is to find such subsequence that its sum is odd and maximum among all such subsequences. It's guaranteed that given sequence contains subsequence with odd sum.
Subsequence is a sequence that can be derived from another sequence by de... | n = int(input())
a = input().split()
s = 0
mc = 10001
mn = -10001
for i in a:
i = int(i)
if i > 0:
s += i
if i % 2 != 0 and i < mc:
mc = i
elif i > mn and i % 2 != 0:
mn = i
if s % 2 != 0:
print(s)
elif s == 0:
print(mn)
else:
print(s - min(mc, mn * -1)) | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR NUMBER FOR VAR VAR ASSIGN VAR FUNC_CALL VAR VAR IF VAR NUMBER VAR VAR IF BIN_OP VAR NUMBER NUMBER VAR VAR ASSIGN VAR VAR IF VAR VAR BIN_OP VAR NUMBER NUMBER ASSIGN VAR VAR IF BIN_OP VAR NUMBER NUMBER... |
You are given sequence a_1, a_2, ..., a_{n} of integer numbers of length n. Your task is to find such subsequence that its sum is odd and maximum among all such subsequences. It's guaranteed that given sequence contains subsequence with odd sum.
Subsequence is a sequence that can be derived from another sequence by de... | n = int(input())
a = [int(i) for i in input().split()]
mn = 20000
s = 0
for k in a:
if k > 0:
s += k
if k % 2 == 1:
mn = min(mn, k)
elif k % 2 == 1:
mn = min(mn, abs(k))
if s % 2 == 1:
print(s)
else:
print(s - mn) | 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 FOR VAR VAR IF VAR NUMBER VAR VAR IF BIN_OP VAR NUMBER NUMBER ASSIGN VAR FUNC_CALL VAR VAR VAR IF BIN_OP VAR NUMBER NUMBER ASSIGN VAR FUNC_CALL VAR VAR FUNC_CALL VAR VAR IF BIN_OP VAR NUMB... |
You are given sequence a_1, a_2, ..., a_{n} of integer numbers of length n. Your task is to find such subsequence that its sum is odd and maximum among all such subsequences. It's guaranteed that given sequence contains subsequence with odd sum.
Subsequence is a sequence that can be derived from another sequence by de... | n = int(input())
ls = list(map(int, input().split()))
pos_sum = sum(list(filter(lambda x: x > 0, ls)))
ls = list(map(abs, ls))
ls = list(filter(lambda x: x % 2 != 0, ls))
if pos_sum % 2 != 0:
print(pos_sum)
else:
print(pos_sum - min(ls)) | 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 FUNC_CALL VAR VAR NUMBER VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR BIN_OP VAR NUMBER NUMBER VAR IF BIN_OP VAR NUMBER NUMBER EXP... |
You are given sequence a_1, a_2, ..., a_{n} of integer numbers of length n. Your task is to find such subsequence that its sum is odd and maximum among all such subsequences. It's guaranteed that given sequence contains subsequence with odd sum.
Subsequence is a sequence that can be derived from another sequence by de... | n = int(input())
arr = list(map(int, input().strip().split()))
minOddPos = float("inf")
minOddNeg = -float("inf")
posSumi = 0
for i in arr:
if i > 0:
if i % 2:
minOddPos = min(minOddPos, i)
posSumi += i
elif i % 2:
minOddNeg = max(minOddNeg, i)
if posSumi > 0:
if posSumi ... | 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 FUNC_CALL VAR STRING ASSIGN VAR FUNC_CALL VAR STRING ASSIGN VAR NUMBER FOR VAR VAR IF VAR NUMBER IF BIN_OP VAR NUMBER ASSIGN VAR FUNC_CALL VAR VAR VAR VAR VAR IF BIN_OP VAR NUMBER ASSIGN VAR FU... |
You are given sequence a_1, a_2, ..., a_{n} of integer numbers of length n. Your task is to find such subsequence that its sum is odd and maximum among all such subsequences. It's guaranteed that given sequence contains subsequence with odd sum.
Subsequence is a sequence that can be derived from another sequence by de... | import sys
n = int(input())
a = list(map(int, input().split()))
minf = -(2 * 10**9)
dp = [([minf] * 2) for _ in range(n + 1)]
dp[0][0] = 0
for i, x in enumerate(a):
dp[i + 1][0 + x & 1] = max(dp[i][0 + x & 1], dp[i + 1][0 + x & 1], dp[i][0] + x)
dp[i + 1][1 + x & 1] = max(dp[i][1 + x & 1], dp[i + 1][1 + x & 1]... | 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 BIN_OP NUMBER BIN_OP NUMBER NUMBER ASSIGN VAR BIN_OP LIST VAR NUMBER VAR FUNC_CALL VAR BIN_OP VAR NUMBER ASSIGN VAR NUMBER NUMBER NUMBER FOR VAR VAR FUNC_CALL VAR VAR ASSIGN VAR BIN_OP VAR NUMBER ... |
You are given sequence a_1, a_2, ..., a_{n} of integer numbers of length n. Your task is to find such subsequence that its sum is odd and maximum among all such subsequences. It's guaranteed that given sequence contains subsequence with odd sum.
Subsequence is a sequence that can be derived from another sequence by de... | a = int(input())
z = list(map(int, input().split()))
oddp = []
eve = []
oddn = []
for i in range(len(z)):
if z[i] % 2 == 0 and z[i] > 0:
eve.append(z[i])
elif z[i] % 2 == 1:
if z[i] > 0:
oddp.append(z[i])
else:
oddn.append(z[i])
if len(oddp) == 0:
print(max(od... | 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 FOR VAR FUNC_CALL VAR FUNC_CALL VAR VAR IF BIN_OP VAR VAR NUMBER NUMBER VAR VAR NUMBER EXPR FUNC_CALL VAR VAR VAR IF BIN_OP VAR VAR NUMBER NUMBER IF VAR VAR NUMBER EX... |
You are given sequence a_1, a_2, ..., a_{n} of integer numbers of length n. Your task is to find such subsequence that its sum is odd and maximum among all such subsequences. It's guaranteed that given sequence contains subsequence with odd sum.
Subsequence is a sequence that can be derived from another sequence by de... | import sys
n = int(input())
x = list(map(int, input().strip().split()))[:n]
sum = 0
for i in x:
if i > 0:
sum += i
if sum % 2 == 1:
print(sum)
else:
sum1 = sum
ans1 = -sys.maxsize
for i in x:
if i < 0 and i % 2 == 1:
ans1 = max(ans1, i)
sum1 += ans1
sum2 = sum
... | IMPORT ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL FUNC_CALL VAR VAR ASSIGN VAR NUMBER FOR VAR VAR IF VAR NUMBER VAR VAR IF BIN_OP VAR NUMBER NUMBER EXPR FUNC_CALL VAR VAR ASSIGN VAR VAR ASSIGN VAR VAR FOR VAR VAR IF VAR NUMBER BIN_OP VAR NUMBER NUMBER ASSIGN VA... |
You are given sequence a_1, a_2, ..., a_{n} of integer numbers of length n. Your task is to find such subsequence that its sum is odd and maximum among all such subsequences. It's guaranteed that given sequence contains subsequence with odd sum.
Subsequence is a sequence that can be derived from another sequence by de... | import sys
input = sys.stdin.readline
n = int(input())
a = [int(x) for x in input().split(" ")]
dp = [(0, -float("inf"))]
for i in range(n):
if a[i] % 2 == 0:
dp.append((max(a[i], 0) + dp[-1][0], max(a[i], 0) + dp[-1][1]))
else:
dp.append((max(dp[-1][0], dp[-1][1] + a[i]), max(dp[-1][1], dp[-1]... | IMPORT ASSIGN VAR VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR VAR FUNC_CALL FUNC_CALL VAR STRING ASSIGN VAR LIST NUMBER FUNC_CALL VAR STRING FOR VAR FUNC_CALL VAR VAR IF BIN_OP VAR VAR NUMBER NUMBER EXPR FUNC_CALL VAR BIN_OP FUNC_CALL VAR VAR VAR NUMBER VAR NUMBER NUMBER BIN_OP FUNC_CALL VAR... |
You are given sequence a_1, a_2, ..., a_{n} of integer numbers of length n. Your task is to find such subsequence that its sum is odd and maximum among all such subsequences. It's guaranteed that given sequence contains subsequence with odd sum.
Subsequence is a sequence that can be derived from another sequence by de... | import sys
n = int(sys.stdin.readline())
l = list(map(int, sys.stdin.readline().split()))
ans = 0
for i in range(n):
if l[i] > 0:
ans += l[i]
max_odd_neg = -(10**5)
min_odd_pos = 10**5
for i in range(n):
if l[i] % 2 == 1:
if l[i] > 0:
min_odd_pos = min(min_odd_pos, l[i])
eli... | 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 FOR VAR FUNC_CALL VAR VAR IF VAR VAR NUMBER VAR VAR VAR ASSIGN VAR BIN_OP NUMBER NUMBER ASSIGN VAR BIN_OP NUMBER NUMBER FOR VAR FUNC_CALL VAR VAR IF BIN_OP VAR VAR NUMBER NUMBER IF VAR VAR ... |
You are given sequence a_1, a_2, ..., a_{n} of integer numbers of length n. Your task is to find such subsequence that its sum is odd and maximum among all such subsequences. It's guaranteed that given sequence contains subsequence with odd sum.
Subsequence is a sequence that can be derived from another sequence by de... | n = int(input())
l = list(map(int, input().split()))
sum_l = int(0)
m1, m2 = -(10**5), 10**5
for ele in l:
if ele > 0:
sum_l += ele
if ele % 2 != 0:
if ele < 0:
m1 = max(m1, ele)
else:
m2 = min(m2, ele)
if sum_l % 2 != 0:
print(sum_l)
else:
if m1 != -(10**... | 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 NUMBER ASSIGN VAR VAR BIN_OP NUMBER NUMBER BIN_OP NUMBER NUMBER FOR VAR VAR IF VAR NUMBER VAR VAR IF BIN_OP VAR NUMBER NUMBER IF VAR NUMBER ASSIGN VAR FUNC_CALL VAR VAR VAR ASSIGN VAR FUNC_... |
You are given sequence a_1, a_2, ..., a_{n} of integer numbers of length n. Your task is to find such subsequence that its sum is odd and maximum among all such subsequences. It's guaranteed that given sequence contains subsequence with odd sum.
Subsequence is a sequence that can be derived from another sequence by de... | MOD = 1000000007
ii = lambda: int(input())
si = lambda: input()
dgl = lambda: list(map(int, input()))
f = lambda: list(map(int, input().split()))
il = lambda: list(map(int, input().split()))
ls = lambda: list(input())
n = ii()
l = il()
dpeve = [0] * (n + 1)
dpodd = [0] * (n + 1)
if l[0] & 1:
dpodd[0] = l[0]
dpe... | ASSIGN VAR NUMBER ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN V... |
You are given sequence a_1, a_2, ..., a_{n} of integer numbers of length n. Your task is to find such subsequence that its sum is odd and maximum among all such subsequences. It's guaranteed that given sequence contains subsequence with odd sum.
Subsequence is a sequence that can be derived from another sequence by de... | from itertools import chain, compress, islice
def f(s):
s = [int(x) for x in s.split(" ")]
even = [x for x in s if x % 2 == 0 and x > 0]
odd = [x for x in s if x % 2 == 1]
odd.sort()
odd.reverse()
_sum = odd[0] if len(odd) else 0
i = 1
while i + 1 < len(odd):
t_sum = odd[i] + o... | FUNC_DEF ASSIGN VAR FUNC_CALL VAR VAR VAR FUNC_CALL VAR STRING ASSIGN VAR VAR VAR VAR BIN_OP VAR NUMBER NUMBER VAR NUMBER ASSIGN VAR VAR VAR VAR BIN_OP VAR NUMBER NUMBER EXPR FUNC_CALL VAR EXPR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR VAR NUMBER NUMBER ASSIGN VAR NUMBER WHILE BIN_OP VAR NUMBER FUNC_CALL VAR VAR ASSIG... |
You are given sequence a_1, a_2, ..., a_{n} of integer numbers of length n. Your task is to find such subsequence that its sum is odd and maximum among all such subsequences. It's guaranteed that given sequence contains subsequence with odd sum.
Subsequence is a sequence that can be derived from another sequence by de... | def meu_map(l):
for i in range(len(l)):
l[i] = int(l[i])
def f(n, array):
impares = []
primeiro = True
maior_negativo = 0
for i in range(len(array) - 1, -1, -1):
if array[i] % 2 == 1 or array[i] % 2 == -1:
if array[i] < 0:
if primeiro:
... | FUNC_DEF FOR VAR FUNC_CALL VAR FUNC_CALL VAR VAR ASSIGN VAR VAR FUNC_CALL VAR VAR VAR FUNC_DEF ASSIGN VAR LIST ASSIGN VAR NUMBER ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR BIN_OP FUNC_CALL VAR VAR NUMBER NUMBER NUMBER IF BIN_OP VAR VAR NUMBER NUMBER BIN_OP VAR VAR NUMBER NUMBER IF VAR VAR NUMBER IF VAR EXPR FUNC_CALL VAR ... |
You are given sequence a_1, a_2, ..., a_{n} of integer numbers of length n. Your task is to find such subsequence that its sum is odd and maximum among all such subsequences. It's guaranteed that given sequence contains subsequence with odd sum.
Subsequence is a sequence that can be derived from another sequence by de... | n = int(input())
a = list(map(int, input().split(" ")))
odd = [None] * n
even = [None] * n
is_odd = lambda x: True if x % 2 else False
if is_odd(a[0]):
odd[0] = a[0]
else:
even[0] = a[0]
def my_sum(a, b):
if a is None:
return b
if b is None:
return a
return a + b
def my_max(*args... | 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 BIN_OP LIST NONE VAR ASSIGN VAR BIN_OP LIST NONE VAR ASSIGN VAR BIN_OP VAR NUMBER NUMBER NUMBER IF FUNC_CALL VAR VAR NUMBER ASSIGN VAR NUMBER VAR NUMBER ASSIGN VAR NUMBER VAR NUMBER FUNC_DEF IF VA... |
You are given sequence a_1, a_2, ..., a_{n} of integer numbers of length n. Your task is to find such subsequence that its sum is odd and maximum among all such subsequences. It's guaranteed that given sequence contains subsequence with odd sum.
Subsequence is a sequence that can be derived from another sequence by de... | n = int(input())
a = list(map(int, input().split()))
s = 0
neg = -10000
pos = 10000
for i in range(n):
if a[i] % 2:
if a[i] < 0:
neg = max(a[i], neg)
else:
pos = min(a[i], pos)
if a[i] > 0:
s += a[i]
if neg % 2 == 0:
neg = 10000
if pos % 2 == 0:
pos = 1000... | 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 FOR VAR FUNC_CALL VAR VAR IF BIN_OP VAR VAR NUMBER IF VAR VAR NUMBER ASSIGN VAR FUNC_CALL VAR VAR VAR VAR ASSIGN VAR FUNC_CALL VAR VAR VAR VAR IF VAR VAR NUMBER... |
You are given sequence a_1, a_2, ..., a_{n} of integer numbers of length n. Your task is to find such subsequence that its sum is odd and maximum among all such subsequences. It's guaranteed that given sequence contains subsequence with odd sum.
Subsequence is a sequence that can be derived from another sequence by de... | n = int(input())
ar = list(map(int, input().split()))
odd = [i for i in ar if i % 2 == 1]
even = [i for i in ar if i % 2 == 0]
odd.sort(reverse=True)
even.sort(reverse=True)
sum_even = 0
for i in even:
if i > 0:
sum_even += i
preSum = []
preSum.append(odd[0])
for i in range(1, len(odd)):
preSum.append(p... | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR VAR VAR VAR BIN_OP VAR NUMBER NUMBER ASSIGN VAR VAR VAR VAR BIN_OP VAR NUMBER NUMBER EXPR FUNC_CALL VAR NUMBER EXPR FUNC_CALL VAR NUMBER ASSIGN VAR NUMBER FOR VAR VAR IF VAR NUMBER VAR VAR ASSIGN VAR LIS... |
You are given sequence a_1, a_2, ..., a_{n} of integer numbers of length n. Your task is to find such subsequence that its sum is odd and maximum among all such subsequences. It's guaranteed that given sequence contains subsequence with odd sum.
Subsequence is a sequence that can be derived from another sequence by de... | n = int(input())
lis = list(map(int, input().split()))
pe = []
po = []
ne = []
no = []
for i in lis:
if i > 0 and i % 2:
po.append(i)
elif i > 0 and i % 2 == 0:
pe.append(i)
elif i < 0 and i % 2:
no.append(i)
else:
ne.append(i)
po.sort()
pe.sort()
no.sort()
ne.sort()
if l... | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR LIST ASSIGN VAR LIST ASSIGN VAR LIST ASSIGN VAR LIST FOR VAR VAR IF VAR NUMBER BIN_OP VAR NUMBER EXPR FUNC_CALL VAR VAR IF VAR NUMBER BIN_OP VAR NUMBER NUMBER EXPR FUNC_CALL VAR VAR IF VAR NUMBER BIN_OP ... |
You are given sequence a_1, a_2, ..., a_{n} of integer numbers of length n. Your task is to find such subsequence that its sum is odd and maximum among all such subsequences. It's guaranteed that given sequence contains subsequence with odd sum.
Subsequence is a sequence that can be derived from another sequence by de... | n = int(input())
a = list(map(int, input().split()))
s = 0
p = 99999999
q = -9999999
for i in range(n):
if a[i] > 0:
s += a[i]
if a[i] < 0 and a[i] > q and a[i] % 2 != 0:
q = a[i]
if a[i] > 0 and a[i] < p and a[i] % 2 != 0:
p = a[i]
if s % 2 == 0:
print(max(s + q, s - p))
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 NUMBER ASSIGN VAR NUMBER ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR VAR IF VAR VAR NUMBER VAR VAR VAR IF VAR VAR NUMBER VAR VAR VAR BIN_OP VAR VAR NUMBER NUMBER ASSIGN VAR VAR VAR IF VAR VAR NUMBER VAR VAR ... |
You are given sequence a_1, a_2, ..., a_{n} of integer numbers of length n. Your task is to find such subsequence that its sum is odd and maximum among all such subsequences. It's guaranteed that given sequence contains subsequence with odd sum.
Subsequence is a sequence that can be derived from another sequence by de... | n = int(input())
s = input()
s = s.split()
l = []
o = []
on = []
sum = 0
for i in s:
te = int(i)
l.append(te)
if te > 0 and te % 2 == 1:
o.append(te)
elif te > 0 and te % 2 == 0:
sum += te
elif te < 0 and te % 2 == 1:
on.append(te)
o.sort(reverse=True)
on.sort(reverse=True)
k... | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR ASSIGN VAR LIST ASSIGN VAR LIST ASSIGN VAR LIST ASSIGN VAR NUMBER FOR VAR VAR ASSIGN VAR FUNC_CALL VAR VAR EXPR FUNC_CALL VAR VAR IF VAR NUMBER BIN_OP VAR NUMBER NUMBER EXPR FUNC_CALL VAR VAR IF VAR NUMBER BIN_OP VAR NUMBER NUMBER ... |
You are given sequence a_1, a_2, ..., a_{n} of integer numbers of length n. Your task is to find such subsequence that its sum is odd and maximum among all such subsequences. It's guaranteed that given sequence contains subsequence with odd sum.
Subsequence is a sequence that can be derived from another sequence by de... | n = int(input())
maxOdd, maxEven = -1000000001, 0
for x in map(int, input().split()):
if x % 2 == 1:
maxOdd, maxEven = max(maxOdd, maxEven + x), max(maxEven, maxOdd + x)
elif x > 0:
maxOdd += x
maxEven += x
print(maxOdd) | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR VAR NUMBER NUMBER FOR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR IF BIN_OP VAR NUMBER NUMBER ASSIGN VAR VAR FUNC_CALL VAR VAR BIN_OP VAR VAR FUNC_CALL VAR VAR BIN_OP VAR VAR IF VAR NUMBER VAR VAR VAR VAR EXPR FUNC_CALL VAR VAR |
You are given sequence a_1, a_2, ..., a_{n} of integer numbers of length n. Your task is to find such subsequence that its sum is odd and maximum among all such subsequences. It's guaranteed that given sequence contains subsequence with odd sum.
Subsequence is a sequence that can be derived from another sequence by de... | n = int(input())
l = [int(i) for i in input().split()]
l.sort()
a = 0
for i in l:
if i > 0:
a += i
x = float("inf")
y = -1 * x
if a % 2 == 0:
for i in l:
if i % 2 != 0 and i < 0:
y = max(y, i)
elif i % 2 != 0 and i > 0:
x = min(x, i)
a -= min(x, -1 * y)
print(... | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR VAR FUNC_CALL FUNC_CALL VAR EXPR FUNC_CALL VAR ASSIGN VAR NUMBER FOR VAR VAR IF VAR NUMBER VAR VAR ASSIGN VAR FUNC_CALL VAR STRING ASSIGN VAR BIN_OP NUMBER VAR IF BIN_OP VAR NUMBER NUMBER FOR VAR VAR IF BIN_OP VAR NUMBER NUMBER VAR NUMBER ASSIGN VAR FU... |
You are given sequence a_1, a_2, ..., a_{n} of integer numbers of length n. Your task is to find such subsequence that its sum is odd and maximum among all such subsequences. It's guaranteed that given sequence contains subsequence with odd sum.
Subsequence is a sequence that can be derived from another sequence by de... | n = int(input())
arr = list(map(int, input().split()))
s = sum([a for a in arr if a > 0])
if s % 2 == 1:
print(s)
else:
mn_odd = 10001
for ele in arr:
if ele % 2 == 1 and ele > 0:
mn_odd = min(mn_odd, ele)
mx_odd = -10001
for ele in arr:
if ele % 2 == 1 and ele < 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 VAR VAR VAR VAR NUMBER IF BIN_OP VAR NUMBER NUMBER EXPR FUNC_CALL VAR VAR ASSIGN VAR NUMBER FOR VAR VAR IF BIN_OP VAR NUMBER NUMBER VAR NUMBER ASSIGN VAR FUNC_CALL VAR VAR VAR ASSIGN VAR NU... |
You are given sequence a_1, a_2, ..., a_{n} of integer numbers of length n. Your task is to find such subsequence that its sum is odd and maximum among all such subsequences. It's guaranteed that given sequence contains subsequence with odd sum.
Subsequence is a sequence that can be derived from another sequence by de... | n = int(input())
a = list(map(int, input().split()))
res = 0
new_a = []
for i in range(n):
if a[i] % 2 == 0:
if a[i] > 0:
res += a[i]
else:
new_a.append(a[i])
a = new_a
a.sort()
res += a[-1]
a.pop()
while len(a) > 1:
if a[-1] + a[-2] > 0:
res += a[-1] + a[-2]
a.po... | 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 FOR VAR FUNC_CALL VAR VAR IF BIN_OP VAR VAR NUMBER NUMBER IF VAR VAR NUMBER VAR VAR VAR EXPR FUNC_CALL VAR VAR VAR ASSIGN VAR VAR EXPR FUNC_CALL VAR VAR VAR NUMBER EXPR FUNC_CALL V... |
You are given sequence a_1, a_2, ..., a_{n} of integer numbers of length n. Your task is to find such subsequence that its sum is odd and maximum among all such subsequences. It's guaranteed that given sequence contains subsequence with odd sum.
Subsequence is a sequence that can be derived from another sequence by de... | n = int(input())
a = list(map(int, input().strip().split()))
c = 0
d = []
for i in range(n):
if a[i] % 2 == 0:
if a[i] > 0:
c += a[i]
else:
d.append(a[i])
d.sort(reverse=True)
c += d[0]
i = 1
while i < len(d) - 1:
if d[i] + d[i + 1] > 0:
c += d[i] + d[i + 1]
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 NUMBER ASSIGN VAR LIST FOR VAR FUNC_CALL VAR VAR IF BIN_OP VAR VAR NUMBER NUMBER IF VAR VAR NUMBER VAR VAR VAR EXPR FUNC_CALL VAR VAR VAR EXPR FUNC_CALL VAR NUMBER VAR VAR NUMBER ASSIGN VAR NUM... |
You are given sequence a_1, a_2, ..., a_{n} of integer numbers of length n. Your task is to find such subsequence that its sum is odd and maximum among all such subsequences. It's guaranteed that given sequence contains subsequence with odd sum.
Subsequence is a sequence that can be derived from another sequence by de... | n = int(input())
a = list(map(int, input().split()))
pe = []
po = []
ne = []
no = []
for i in range(n):
if a[i] > 0 and a[i] % 2 == 0:
pe.append(a[i])
if a[i] > 0 and a[i] % 2 != 0:
po.append(a[i])
if a[i] < 0 and a[i] % 2 == 0:
ne.append(a[i])
if a[i] < 0 and a[i] % 2 != 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 LIST FOR VAR FUNC_CALL VAR VAR IF VAR VAR NUMBER BIN_OP VAR VAR NUMBER NUMBER EXPR FUNC_CALL VAR VAR VAR IF VAR VAR NUMBER BIN_OP VAR VAR NUMBER NUMBER EXP... |
You are given sequence a_1, a_2, ..., a_{n} of integer numbers of length n. Your task is to find such subsequence that its sum is odd and maximum among all such subsequences. It's guaranteed that given sequence contains subsequence with odd sum.
Subsequence is a sequence that can be derived from another sequence by de... | from sys import stderr, stdin
def find(A):
big = 0
for i in range(len(A)):
if A[i] > 0:
big += A[i]
if big % 2 == 1:
return big
else:
minodd = 10**10
for i in range(len(A)):
if A[i] % 2 == 1:
if A[i] > 0 and A[i] < minodd:
... | FUNC_DEF ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR FUNC_CALL VAR VAR IF VAR VAR NUMBER VAR VAR VAR IF BIN_OP VAR NUMBER NUMBER RETURN VAR ASSIGN VAR BIN_OP NUMBER NUMBER FOR VAR FUNC_CALL VAR FUNC_CALL VAR VAR IF BIN_OP VAR VAR NUMBER NUMBER IF VAR VAR NUMBER VAR VAR VAR ASSIGN VAR VAR VAR ASSIGN VAR BIN_OP NUMBER NUMBER... |
You are given sequence a_1, a_2, ..., a_{n} of integer numbers of length n. Your task is to find such subsequence that its sum is odd and maximum among all such subsequences. It's guaranteed that given sequence contains subsequence with odd sum.
Subsequence is a sequence that can be derived from another sequence by de... | n = int(input().strip())
ais = list(map(int, input().strip().split()))
def solve(n, ais):
s = sum(a for a in ais if a >= 0)
if s % 2 == 1:
return s
maxoddneg = max([a for a in ais if a % 2 == 1 and a < 0], default=0)
minoddpos = min([a for a in ais if a % 2 == 1 and a > 0], default=0)
v = ... | ASSIGN VAR FUNC_CALL VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL FUNC_CALL VAR FUNC_DEF ASSIGN VAR FUNC_CALL VAR VAR VAR VAR VAR NUMBER IF BIN_OP VAR NUMBER NUMBER RETURN VAR ASSIGN VAR FUNC_CALL VAR VAR VAR VAR BIN_OP VAR NUMBER NUMBER VAR NUMBER NUMBER ASSIGN VAR FUNC_CA... |
You are given sequence a_1, a_2, ..., a_{n} of integer numbers of length n. Your task is to find such subsequence that its sum is odd and maximum among all such subsequences. It's guaranteed that given sequence contains subsequence with odd sum.
Subsequence is a sequence that can be derived from another sequence by de... | le = int(input())
seq = input().split()
neg = -(10**4 + 1)
odd = 0
z = 0
min_odd = 10**4
for i in seq:
if int(i) > 0 and int(i) % 2 == 0:
z += int(i)
elif int(i) > 0 and int(i) % 2 == 1:
odd += int(i)
if int(i) < min_odd:
min_odd = int(i)
elif int(i) < 0 and int(i) % 2 ==... | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR BIN_OP BIN_OP NUMBER NUMBER NUMBER ASSIGN VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR BIN_OP NUMBER NUMBER FOR VAR VAR IF FUNC_CALL VAR VAR NUMBER BIN_OP FUNC_CALL VAR VAR NUMBER NUMBER VAR FUNC_CALL VAR VAR IF FUNC_CALL VAR VAR NUMBER BIN... |
You are given sequence a_1, a_2, ..., a_{n} of integer numbers of length n. Your task is to find such subsequence that its sum is odd and maximum among all such subsequences. It's guaranteed that given sequence contains subsequence with odd sum.
Subsequence is a sequence that can be derived from another sequence by de... | n = int(input())
A = list(map(int, input().split()))
dp = [[-9999999999, -9999999999]]
for elem in A:
dp += [[0, 0]]
if elem % 2 == 0:
dp[-1][0] = max(dp[-2][0] + elem, dp[-2][0], elem)
dp[-1][1] = max(dp[-2][1] + elem, dp[-2][1])
else:
dp[-1][0] = max(dp[-2][1] + elem, dp[-2][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 LIST NUMBER NUMBER FOR VAR VAR VAR LIST LIST NUMBER NUMBER IF BIN_OP VAR NUMBER NUMBER ASSIGN VAR NUMBER NUMBER FUNC_CALL VAR BIN_OP VAR NUMBER NUMBER VAR VAR NUMBER NUMBER VAR ASSIGN VAR NUMBER NUM... |
You are given sequence a_1, a_2, ..., a_{n} of integer numbers of length n. Your task is to find such subsequence that its sum is odd and maximum among all such subsequences. It's guaranteed that given sequence contains subsequence with odd sum.
Subsequence is a sequence that can be derived from another sequence by de... | n = int(input())
arr = list(map(int, input().split()))
res = sum(filter(lambda x: x > 0, arr))
if res & 1 == 0:
delta = abs(min(filter(lambda x: x & 1, arr), key=abs))
res -= delta
print(res) | 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 NUMBER VAR IF BIN_OP VAR NUMBER NUMBER ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR BIN_OP VAR NUMBER VAR VAR VAR VAR EXPR FUNC_CALL VAR VAR |
You are given sequence a_1, a_2, ..., a_{n} of integer numbers of length n. Your task is to find such subsequence that its sum is odd and maximum among all such subsequences. It's guaranteed that given sequence contains subsequence with odd sum.
Subsequence is a sequence that can be derived from another sequence by de... | n = int(input())
a = list(map(int, input().split()))
f = 0
for i in range(n):
if a[i] >= 0:
f += a[i]
if f % 2:
print(f)
else:
m = 10**9
for i in range(n):
if a[i] % 2:
m = min(m, abs(a[i]))
print(f - m) | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR VAR IF VAR VAR NUMBER VAR VAR VAR IF BIN_OP VAR NUMBER EXPR FUNC_CALL VAR VAR ASSIGN VAR BIN_OP NUMBER NUMBER FOR VAR FUNC_CALL VAR VAR IF BIN_OP VAR VAR NUMBER ASSIGN VAR FU... |
You are given sequence a_1, a_2, ..., a_{n} of integer numbers of length n. Your task is to find such subsequence that its sum is odd and maximum among all such subsequences. It's guaranteed that given sequence contains subsequence with odd sum.
Subsequence is a sequence that can be derived from another sequence by de... | n = int(input())
l = list(map(int, input().split()))
l1 = []
l2 = []
l3 = []
l4 = []
for i in l:
if i > 0:
if i % 2 == 0:
l1.append(i)
else:
l2.append(i)
elif i < 0:
if i % 2 == 0:
l3.append(i)
else:
l4.append(i)
l1.sort()
l2.sort()... | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR LIST ASSIGN VAR LIST ASSIGN VAR LIST ASSIGN VAR LIST FOR VAR VAR IF VAR NUMBER IF BIN_OP VAR NUMBER NUMBER EXPR FUNC_CALL VAR VAR EXPR FUNC_CALL VAR VAR IF VAR NUMBER IF BIN_OP VAR NUMBER NUMBER EXPR FUN... |
You are given sequence a_1, a_2, ..., a_{n} of integer numbers of length n. Your task is to find such subsequence that its sum is odd and maximum among all such subsequences. It's guaranteed that given sequence contains subsequence with odd sum.
Subsequence is a sequence that can be derived from another sequence by de... | n = int(input())
a = list(map(int, input().split()))
neg = list()
pos = list()
for i in range(n):
if a[i] < 0:
neg.append(a[i])
elif a[i] > 0:
pos.append(a[i])
sn = sum(pos)
mnp = 100000
mxn = -100000
for i in range(len(neg)):
if neg[i] % 2 == 1 and neg[i] > mxn:
mxn = neg[i]
for j 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 FOR VAR FUNC_CALL VAR VAR IF VAR VAR NUMBER EXPR FUNC_CALL VAR VAR VAR IF VAR VAR NUMBER EXPR FUNC_CALL VAR VAR VAR ASSIGN VAR FUNC_CALL VAR VAR ASSIGN VAR NUMBER A... |
You are given sequence a_1, a_2, ..., a_{n} of integer numbers of length n. Your task is to find such subsequence that its sum is odd and maximum among all such subsequences. It's guaranteed that given sequence contains subsequence with odd sum.
Subsequence is a sequence that can be derived from another sequence by de... | n = int(input())
a = list(map(int, input().split()))
a.sort(reverse=True)
s = 0
for i in range(n):
if a[i] > 0:
s += a[i]
else:
break
if s % 2:
print(s)
else:
mx = -100000
for i in range(n):
if a[i] < 0 and a[i] % 2:
mx = max(a[i], mx)
mn = 100000
for i in... | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR EXPR FUNC_CALL VAR NUMBER ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR VAR IF VAR VAR NUMBER VAR VAR VAR IF BIN_OP VAR NUMBER EXPR FUNC_CALL VAR VAR ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR VAR IF VAR VAR NUMBER BIN_OP V... |
You are given sequence a_1, a_2, ..., a_{n} of integer numbers of length n. Your task is to find such subsequence that its sum is odd and maximum among all such subsequences. It's guaranteed that given sequence contains subsequence with odd sum.
Subsequence is a sequence that can be derived from another sequence by de... | def max(a, b):
if a > b:
return a
else:
return b
def min(a, b):
if a < b:
return a
else:
return b
def __starting_point():
n = int(input())
A = input().split(" ")
ans, count, Min, Max = 0, 0, 1000000000, -100000000000
for i in range(n):
now = in... | FUNC_DEF IF VAR VAR RETURN VAR RETURN VAR FUNC_DEF IF VAR VAR RETURN VAR RETURN VAR FUNC_DEF ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL FUNC_CALL VAR STRING ASSIGN VAR VAR VAR VAR NUMBER NUMBER NUMBER NUMBER FOR VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR VAR VAR IF BIN_OP VAR NUMBER NUMBER VAR FUNC... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.