Skip to content

Commit 205d4be

Browse files
authored
Create solution_6.py
1 parent cfeb059 commit 205d4be

File tree

1 file changed

+37
-0
lines changed

1 file changed

+37
-0
lines changed

problem_1/solution_6.py

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
from collections import deque
2+
from sys import stdin
3+
lines = deque(line.strip() for line in stdin.readlines())
4+
5+
def nextline():
6+
return lines.popleft()
7+
8+
def types(cast, sep=None):
9+
return tuple(cast(x) for x in strs(sep=sep))
10+
11+
def ints(sep=None):
12+
return types(int, sep=sep)
13+
14+
def strs(sep=None):
15+
return tuple(nextline()) if sep == '' else tuple(nextline().split(sep=sep))
16+
17+
def main():
18+
# lines will now contain all of the input's lines in a list
19+
T = int(nextline())
20+
for testCase in range(1, T + 1):
21+
n, m, k = ints()
22+
min_k = max(n, m)
23+
if min_k > k:
24+
print(-1)
25+
continue
26+
if (n - m) % 2 == 0:
27+
if k % 2 == n % 2:
28+
print(k)
29+
continue
30+
print(k - 2)
31+
continue
32+
print(k - 1)
33+
34+
def __starting_point():
35+
main()
36+
37+
__starting_point()

0 commit comments

Comments
 (0)