description stringlengths 171 4k | code stringlengths 94 3.98k | normalized_code stringlengths 57 4.99k |
|---|---|---|
You are given a string, consisting of lowercase Latin letters.
A pair of neighbouring letters in a string is considered ugly if these letters are also neighbouring in a alphabet. For example, string "abaca" contains ugly pairs at positions $(1, 2)$ β "ab" and $(2, 3)$ β "ba". Letters 'a' and 'z' aren't considered neig... | t = int(input())
for i in range(t):
str = input().strip()
ascii_a = ord("a")
nums = [0] * 26
for char in str:
nums[ord(char) - ascii_a] += 1
n = 0
oddStr = ""
evenStr = ""
for i in range(len(nums)):
num = nums[i]
if num != 0:
if n % 2 == 0:
... | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR FOR VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR STRING ASSIGN VAR BIN_OP LIST NUMBER NUMBER FOR VAR VAR VAR BIN_OP FUNC_CALL VAR VAR VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR STRING ASSIGN VAR STRING FOR VAR FUNC_CALL VAR FUNC_CALL VAR VAR ASSIG... |
You are given a string, consisting of lowercase Latin letters.
A pair of neighbouring letters in a string is considered ugly if these letters are also neighbouring in a alphabet. For example, string "abaca" contains ugly pairs at positions $(1, 2)$ β "ab" and $(2, 3)$ β "ba". Letters 'a' and 'z' aren't considered neig... | from sys import stdin
input = stdin.readline
t = int(input())
for _ in range(t):
s = list(input().rstrip())
even = []
odd = []
for c in s:
if ord(c) % 2 == 0:
even.append(c)
else:
odd.append(c)
even.sort()
odd.sort()
if even == [] or odd == []:
... | ASSIGN VAR VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR FOR VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR LIST ASSIGN VAR LIST FOR VAR VAR IF BIN_OP FUNC_CALL VAR VAR NUMBER NUMBER EXPR FUNC_CALL VAR VAR EXPR FUNC_CALL VAR VAR EXPR FUNC_CALL VAR EXPR FUNC_CALL VAR IF VAR LIST VAR LIST ... |
You are given a string, consisting of lowercase Latin letters.
A pair of neighbouring letters in a string is considered ugly if these letters are also neighbouring in a alphabet. For example, string "abaca" contains ugly pairs at positions $(1, 2)$ β "ab" and $(2, 3)$ β "ba". Letters 'a' and 'z' aren't considered neig... | a = int(input())
for i in range(a):
A = []
b = input()
for j in range(len(b)):
A.append(ord(b[j]) - 96)
A.sort()
B = []
C = []
q = 1
B.append(A[0])
for j in range(1, len(b)):
if A[j] != A[j - 1]:
q *= -1
if q == 1:
B.append(A[j])
... | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR FOR VAR FUNC_CALL VAR VAR ASSIGN VAR LIST ASSIGN VAR FUNC_CALL VAR FOR VAR FUNC_CALL VAR FUNC_CALL VAR VAR EXPR FUNC_CALL VAR BIN_OP FUNC_CALL VAR VAR VAR NUMBER EXPR FUNC_CALL VAR ASSIGN VAR LIST ASSIGN VAR LIST ASSIGN VAR NUMBER EXPR FUNC_CALL VAR VAR NUMBER FOR VAR FUNC_CALL VA... |
You are given a string, consisting of lowercase Latin letters.
A pair of neighbouring letters in a string is considered ugly if these letters are also neighbouring in a alphabet. For example, string "abaca" contains ugly pairs at positions $(1, 2)$ β "ab" and $(2, 3)$ β "ba". Letters 'a' and 'z' aren't considered neig... | def check(s):
for i in range(0, len(s) - 1):
if abs(ord(s[i]) - ord(s[i + 1])) == 1:
return False
return True
t = int(input())
m = "acegikmoqsuwybdfhjlnprtvxz"
n = "bdfhjlnprtvxzacegikmoqsuwy"
while t > 0:
s = input()
cnt = dict()
ans = ""
for i in s:
cnt[i] = s.cou... | FUNC_DEF FOR VAR FUNC_CALL VAR NUMBER BIN_OP FUNC_CALL VAR VAR NUMBER IF FUNC_CALL VAR BIN_OP FUNC_CALL VAR VAR VAR FUNC_CALL VAR VAR BIN_OP VAR NUMBER NUMBER RETURN NUMBER RETURN NUMBER ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR STRING ASSIGN VAR STRING WHILE VAR NUMBER ASSIGN VAR FUNC_CALL VAR ASSIGN VAR FUNC_... |
You are given a string, consisting of lowercase Latin letters.
A pair of neighbouring letters in a string is considered ugly if these letters are also neighbouring in a alphabet. For example, string "abaca" contains ugly pairs at positions $(1, 2)$ β "ab" and $(2, 3)$ β "ba". Letters 'a' and 'z' aren't considered neig... | n = int(input())
def ind_max(array, i):
flg = 0
if i == None:
m = max(array)
k = 0
while k < 26:
if (array[k] == m) & (digits[k] > 0):
flg = 1
break
else:
k += 1
else:
m = array[i]
for j in rang... | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_DEF ASSIGN VAR NUMBER IF VAR NONE ASSIGN VAR FUNC_CALL VAR VAR ASSIGN VAR NUMBER WHILE VAR NUMBER IF BIN_OP VAR VAR VAR VAR VAR NUMBER ASSIGN VAR NUMBER VAR NUMBER ASSIGN VAR VAR VAR FOR VAR FUNC_CALL VAR FUNC_CALL VAR VAR IF FUNC_CALL VAR BIN_OP VAR VAR NUMBER IF VAR VAR VAR... |
You are given a string, consisting of lowercase Latin letters.
A pair of neighbouring letters in a string is considered ugly if these letters are also neighbouring in a alphabet. For example, string "abaca" contains ugly pairs at positions $(1, 2)$ β "ab" and $(2, 3)$ β "ba". Letters 'a' and 'z' aren't considered neig... | q = int(input())
b = []
c = []
for p in range(q):
b = []
c = []
e = []
a = list(input())
for i in range(len(a)):
if a[i] == "a":
a[i] = 1
if a[i] == "b":
a[i] = 2
if a[i] == "c":
a[i] = 3
if a[i] == "d":
a[i] = 4
... | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR LIST ASSIGN VAR LIST FOR VAR FUNC_CALL VAR VAR ASSIGN VAR LIST ASSIGN VAR LIST ASSIGN VAR LIST ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR FOR VAR FUNC_CALL VAR FUNC_CALL VAR VAR IF VAR VAR STRING ASSIGN VAR VAR NUMBER IF VAR VAR STRING ASSIGN VAR VAR NUMBER IF VAR VAR STRIN... |
You are given a string, consisting of lowercase Latin letters.
A pair of neighbouring letters in a string is considered ugly if these letters are also neighbouring in a alphabet. For example, string "abaca" contains ugly pairs at positions $(1, 2)$ β "ab" and $(2, 3)$ β "ba". Letters 'a' and 'z' aren't considered neig... | def is_all_zero(l):
for i in l:
if i != 0:
return False
return True
def main():
n = int(input())
for _ in range(n):
l = [0] * 26
s = input()
for i in s:
l[ord(i) - ord("a")] += 1
pr = []
l1 = l[::2]
l2 = l[1::2]
if... | FUNC_DEF FOR VAR VAR IF VAR NUMBER RETURN NUMBER RETURN NUMBER FUNC_DEF ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR FOR VAR FUNC_CALL VAR VAR ASSIGN VAR BIN_OP LIST NUMBER NUMBER ASSIGN VAR FUNC_CALL VAR FOR VAR VAR VAR BIN_OP FUNC_CALL VAR VAR FUNC_CALL VAR STRING NUMBER ASSIGN VAR LIST ASSIGN VAR VAR NUMBER ASSIGN VAR VAR... |
You are given a string, consisting of lowercase Latin letters.
A pair of neighbouring letters in a string is considered ugly if these letters are also neighbouring in a alphabet. For example, string "abaca" contains ugly pairs at positions $(1, 2)$ β "ab" and $(2, 3)$ β "ba". Letters 'a' and 'z' aren't considered neig... | T = int(input())
for _ in range(T):
s = input()
d = {}
for i in s:
d[i] = d.get(i, 0) + 1
k = sorted(list(d.keys()))
n = len(k)
if n == 2:
if abs(ord(k[0]) - ord(k[1])) == 1:
ans = "No answer"
else:
ans = s
elif n == 3:
if abs(ord(k[0])... | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR FOR VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR ASSIGN VAR DICT FOR VAR VAR ASSIGN VAR VAR BIN_OP FUNC_CALL VAR VAR NUMBER NUMBER ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR IF VAR NUMBER IF FUNC_CALL VAR BIN_OP FUNC_CALL VAR VAR NUMBER FUN... |
You are given a string, consisting of lowercase Latin letters.
A pair of neighbouring letters in a string is considered ugly if these letters are also neighbouring in a alphabet. For example, string "abaca" contains ugly pairs at positions $(1, 2)$ β "ab" and $(2, 3)$ β "ba". Letters 'a' and 'z' aren't considered neig... | def check(s):
for i in range(len(s) - 1):
if abs(ord(s[i]) - ord(s[i + 1])) == 1:
return False
return True
query = int(input())
while query > 0:
raw = input()
sorted_str = "".join(sorted(raw))
new1 = ""
l = 0
r = len(sorted_str) - 1
while l <= r:
i = l
... | FUNC_DEF FOR VAR FUNC_CALL VAR BIN_OP FUNC_CALL VAR VAR NUMBER IF FUNC_CALL VAR BIN_OP FUNC_CALL VAR VAR VAR FUNC_CALL VAR VAR BIN_OP VAR NUMBER NUMBER RETURN NUMBER RETURN NUMBER ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR WHILE VAR NUMBER ASSIGN VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL STRING FUNC_CALL VAR VAR ASSIGN VAR ST... |
You are given a string, consisting of lowercase Latin letters.
A pair of neighbouring letters in a string is considered ugly if these letters are also neighbouring in a alphabet. For example, string "abaca" contains ugly pairs at positions $(1, 2)$ β "ab" and $(2, 3)$ β "ba". Letters 'a' and 'z' aren't considered neig... | nums = int(input())
strings = [input() for _ in range(nums)]
for i in strings:
odds = []
evens = []
for j in i:
if ord(j) - 97 & 1 == 0:
evens.append(j)
else:
odds.append(j)
num = None
possible = False
if len(odds) == 0 or len(evens) == 0:
possible... | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR FUNC_CALL VAR VAR FOR VAR VAR ASSIGN VAR LIST ASSIGN VAR LIST FOR VAR VAR IF BIN_OP BIN_OP FUNC_CALL VAR VAR NUMBER NUMBER NUMBER EXPR FUNC_CALL VAR VAR EXPR FUNC_CALL VAR VAR ASSIGN VAR NONE ASSIGN VAR NUMBER IF FUNC_CALL VAR VAR NUMBER FUNC_CALL VAR ... |
You are given a string, consisting of lowercase Latin letters.
A pair of neighbouring letters in a string is considered ugly if these letters are also neighbouring in a alphabet. For example, string "abaca" contains ugly pairs at positions $(1, 2)$ β "ab" and $(2, 3)$ β "ba". Letters 'a' and 'z' aren't considered neig... | t = int(input())
for _ in range(t):
s = str(input())
def check(s):
n = len(s)
for i in range(n - 1):
if abs(ord(s[i]) - ord(s[i + 1])) == 1:
return False
else:
return True
odd = []
even = []
for c in s:
i = ord(c) - ord("a")
... | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR FOR VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_DEF ASSIGN VAR FUNC_CALL VAR VAR FOR VAR FUNC_CALL VAR BIN_OP VAR NUMBER IF FUNC_CALL VAR BIN_OP FUNC_CALL VAR VAR VAR FUNC_CALL VAR VAR BIN_OP VAR NUMBER NUMBER RETURN NUMBER RETURN NUMBER ASSIGN VAR LIST ASSIG... |
You are given a string, consisting of lowercase Latin letters.
A pair of neighbouring letters in a string is considered ugly if these letters are also neighbouring in a alphabet. For example, string "abaca" contains ugly pairs at positions $(1, 2)$ β "ab" and $(2, 3)$ β "ba". Letters 'a' and 'z' aren't considered neig... | import sys
T = int(sys.stdin.readline().strip())
for t in range(0, T):
s = sys.stdin.readline().strip()
x = [0] * 26
y = ord("a")
for l in s:
i = ord(l) - y
x[i] = x[i] + 1
n = 0
s1 = ""
s2 = ""
for i in range(0, 26):
if x[i] != 0:
if n % 2 == 0:
... | IMPORT ASSIGN VAR FUNC_CALL VAR FUNC_CALL FUNC_CALL VAR FOR VAR FUNC_CALL VAR NUMBER VAR ASSIGN VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR BIN_OP LIST NUMBER NUMBER ASSIGN VAR FUNC_CALL VAR STRING FOR VAR VAR ASSIGN VAR BIN_OP FUNC_CALL VAR VAR VAR ASSIGN VAR VAR BIN_OP VAR VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR STRING AS... |
You are given a string, consisting of lowercase Latin letters.
A pair of neighbouring letters in a string is considered ugly if these letters are also neighbouring in a alphabet. For example, string "abaca" contains ugly pairs at positions $(1, 2)$ β "ab" and $(2, 3)$ β "ba". Letters 'a' and 'z' aren't considered neig... | t = int(input())
al = [
"a",
"b",
"c",
"d",
"e",
"f",
"g",
"h",
"i",
"j",
"k",
"l",
"m",
"n",
"o",
"p",
"q",
"r",
"s",
"t",
"u",
"v",
"w",
"x",
"y",
"z",
]
hash = {}
for i in range(26):
hash[al[i]] = i
for i in r... | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR LIST STRING STRING STRING STRING STRING STRING STRING STRING STRING STRING STRING STRING STRING STRING STRING STRING STRING STRING STRING STRING STRING STRING STRING STRING STRING STRING ASSIGN VAR DICT FOR VAR FUNC_CALL VAR NUMBER ASSIGN VAR VAR VAR VAR FOR VAR FUNC_CA... |
You are given a string, consisting of lowercase Latin letters.
A pair of neighbouring letters in a string is considered ugly if these letters are also neighbouring in a alphabet. For example, string "abaca" contains ugly pairs at positions $(1, 2)$ β "ab" and $(2, 3)$ β "ba". Letters 'a' and 'z' aren't considered neig... | n = int(input())
for _ in range(n):
s = input()
a = [ord(x) for x in s]
a.sort()
letter = [a[0]]
count = [0]
for c in a:
if c == letter[-1]:
count[-1] = count[-1] + 1
else:
letter.append(c)
count.append(1)
if len(letter) == 1:
print... | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR FOR VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR VAR VAR EXPR FUNC_CALL VAR ASSIGN VAR LIST VAR NUMBER ASSIGN VAR LIST NUMBER FOR VAR VAR IF VAR VAR NUMBER ASSIGN VAR NUMBER BIN_OP VAR NUMBER NUMBER EXPR FUNC_CALL VAR VAR EXPR FUNC_CALL VAR NUMBER IF... |
After the educational reform Polycarp studies only two subjects at school, Safety Studies and PE (Physical Education). During the long months of the fourth term, he received n marks in them. When teachers wrote a mark in the journal, they didn't write in what subject the mark was for, they just wrote the mark.
Now it'... | n = int(input())
a, b = map(int, input().split())
l = list(map(int, input().split()))
if a == b:
print(*([1] * a + [2] * b))
else:
h = [[l[i], i] for i in range(n)]
h.sort(key=lambda x: x[0])
ans = [(0) for i in range(n)]
if b < a:
i = n - b
j = n - b - 1
if h[i][0] == h[j][0... | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR IF VAR VAR EXPR FUNC_CALL VAR BIN_OP BIN_OP LIST NUMBER VAR BIN_OP LIST NUMBER VAR ASSIGN VAR LIST VAR VAR VAR VAR FUNC_CALL VAR VAR EXPR FUNC_CALL VAR VAR N... |
After the educational reform Polycarp studies only two subjects at school, Safety Studies and PE (Physical Education). During the long months of the fourth term, he received n marks in them. When teachers wrote a mark in the journal, they didn't write in what subject the mark was for, they just wrote the mark.
Now it'... | n = int(input())
a, b = map(int, input().split())
c = [int(i) for i in input().split()]
p = [i for i in range(n)]
Z = [x for _, x in sorted(zip(c, p))]
ans = [0] * n
if a == b:
for i in range(a):
print(1, end=" ")
for i in range(b):
print(2, end=" ")
exit()
if a > b:
Z = [x for _, x in s... | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR VAR VAR FUNC_CALL VAR VAR ASSIGN VAR VAR VAR VAR FUNC_CALL VAR FUNC_CALL VAR VAR VAR ASSIGN VAR BIN_OP LIST NUMBER VAR IF VAR VAR FOR VAR FUNC_CALL VAR VAR ... |
After the educational reform Polycarp studies only two subjects at school, Safety Studies and PE (Physical Education). During the long months of the fourth term, he received n marks in them. When teachers wrote a mark in the journal, they didn't write in what subject the mark was for, they just wrote the mark.
Now it'... | n = int(input())
a, b = list(map(int, input().split()))
arr = list(map(int, input().split()))
if a == b:
print("1 " * a + "2 " * (a - 1) + "2")
else:
arr = [(j, i) for i, j in enumerate(arr)]
if a < b:
ans = [1] * n
arr.sort(key=lambda x: (x[0], -x[1]))
for i in range(b):
... | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR IF VAR VAR EXPR FUNC_CALL VAR BIN_OP BIN_OP BIN_OP STRING VAR BIN_OP STRING BIN_OP VAR NUMBER STRING ASSIGN VAR VAR VAR VAR VAR FUNC_CALL VAR V... |
After the educational reform Polycarp studies only two subjects at school, Safety Studies and PE (Physical Education). During the long months of the fourth term, he received n marks in them. When teachers wrote a mark in the journal, they didn't write in what subject the mark was for, they just wrote the mark.
Now it'... | n = int(input())
a, b = [int(d) for d in input().split()]
t = [int(d) for d in input().split()]
arr = [s for s in range(n)]
if a != b:
arr = sorted(arr, reverse=a < b, key=lambda i: t[i])
for i in arr[0:a]:
t[i] = 1
for i in arr[a:n]:
t[i] = 2
for d in t:
print(d, end=" ") | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR VAR FUNC_CALL VAR VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR VAR VAR FUNC_CALL VAR VAR IF VAR VAR ASSIGN VAR FUNC_CALL VAR VAR VAR VAR VAR VAR FOR VAR VAR NUMBER VAR ASSIGN VAR VAR NUMBER FOR VAR VAR VAR VAR ASSIG... |
After the educational reform Polycarp studies only two subjects at school, Safety Studies and PE (Physical Education). During the long months of the fourth term, he received n marks in them. When teachers wrote a mark in the journal, they didn't write in what subject the mark was for, they just wrote the mark.
Now it'... | n = int(input())
a, b = list(map(int, input().split()))
c = list(map(int, input().split()))
if a < b:
d = [(1) for i in range(n)]
e = [[] for i in range(5)]
for i in range(n):
e[c[i] - 1].append(i)
e = e[::-1]
for i in range(5):
e1 = len(e[i])
if e1 > a or a == 0:
... | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR IF VAR VAR ASSIGN VAR NUMBER VAR FUNC_CALL VAR VAR ASSIGN VAR LIST VAR FUNC_CALL VAR NUMBER FOR VAR FUNC_CALL VAR VAR EXPR FUNC_CALL VAR BIN_OP... |
After the educational reform Polycarp studies only two subjects at school, Safety Studies and PE (Physical Education). During the long months of the fourth term, he received n marks in them. When teachers wrote a mark in the journal, they didn't write in what subject the mark was for, they just wrote the mark.
Now it'... | n = int(input())
a, b = map(int, input().split())
l = list(map(int, input().split()))
arr = [(l[i], i) for i in range(n)]
if a < b:
arr.sort(key=lambda x: (-x[0], x[1]))
else:
arr.sort(key=lambda x: (-x[0], -x[1]))
ans = [0] * n
if a < b:
for i in range(a):
ans[arr[i][1]] = 1
for i in range(a, a... | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR VAR VAR VAR VAR FUNC_CALL VAR VAR IF VAR VAR EXPR FUNC_CALL VAR VAR NUMBER VAR NUMBER EXPR FUNC_CALL VAR VAR NUMBER VAR NUMBER ASSIGN VAR BIN_OP L... |
After the educational reform Polycarp studies only two subjects at school, Safety Studies and PE (Physical Education). During the long months of the fourth term, he received n marks in them. When teachers wrote a mark in the journal, they didn't write in what subject the mark was for, they just wrote the mark.
Now it'... | import sys
n = int(sys.stdin.readline())
a, b = map(int, sys.stdin.readline().split())
marks = list(map(int, sys.stdin.readline().split()))
if a == b:
sys.stdout.write("1 " * (n // 2) + "2 " * (n // 2 - 1) + "2")
else:
Ans = [2] * n
if a > b:
sorted_marks = sorted(marks)
x = 0
xx = ... | IMPORT ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR IF VAR VAR EXPR FUNC_CALL VAR BIN_OP BIN_OP BIN_OP STRING BIN_OP VAR NUMBER BIN_OP STRING BIN_OP BIN_OP VAR NUMBER NUMBER STRING ASSIGN VAR BIN_OP LIS... |
After the educational reform Polycarp studies only two subjects at school, Safety Studies and PE (Physical Education). During the long months of the fourth term, he received n marks in them. When teachers wrote a mark in the journal, they didn't write in what subject the mark was for, they just wrote the mark.
Now it'... | n = int(input())
a, b = map(int, input().split())
if a == b:
print("1 " * a + "2 " * b)
else:
t = [[] for i in range(6)]
for i, j in enumerate(map(int, input().split())):
t[j].append(i)
if b < a:
t = t[1] + t[2] + t[3] + t[4] + t[5]
t.reverse()
p = ["1"] * n
for i... | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR IF VAR VAR EXPR FUNC_CALL VAR BIN_OP BIN_OP STRING VAR BIN_OP STRING VAR ASSIGN VAR LIST VAR FUNC_CALL VAR NUMBER FOR VAR VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR EXPR FUNC_CALL VAR VAR VAR IF VAR VAR ASSI... |
Oleg the client and Igor the analyst are good friends. However, sometimes they argue over little things. Recently, they started a new company, but they are having trouble finding a name for the company.
To settle this problem, they've decided to play a game. The company name will consist of n letters. Oleg and Igor ea... | s = input()
t = input()
n = len(s)
vs = [0] * 26
vt = vs[:]
for i in range(n):
vs[ord(s[i]) - 97] += 1
vt[ord(t[i]) - 97] += 1
ns = n // 2 + n % 2
nt = n // 2
cur = 0
starts = 0
ends = 0
for i in range(26):
if cur + vs[i] < ns:
cur += vs[i]
else:
vs[i] = ns - cur
cur = ns
... | ASSIGN VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR ASSIGN VAR BIN_OP LIST NUMBER NUMBER ASSIGN VAR VAR FOR VAR FUNC_CALL VAR VAR VAR BIN_OP FUNC_CALL VAR VAR VAR NUMBER NUMBER VAR BIN_OP FUNC_CALL VAR VAR VAR NUMBER NUMBER ASSIGN VAR BIN_OP BIN_OP VAR NUMBER BIN_OP VAR NUMBER ASSIGN VAR BIN_... |
Oleg the client and Igor the analyst are good friends. However, sometimes they argue over little things. Recently, they started a new company, but they are having trouble finding a name for the company.
To settle this problem, they've decided to play a game. The company name will consist of n letters. Oleg and Igor ea... | s1 = input()
s2 = input()
n = len(s1)
s1 = sorted(s1)
s2 = sorted(s2)[::-1]
i = 0
j = 0
res = ["?"] * n
rear = n - 1
front = 0
Neven = n % 2 == 0
n1 = (n + 1) // 2 - 1
n2 = n // 2 - 1
for k in range(n):
if k % 2 == 0:
if s1[i] < s2[j]:
res[front] = s1[i]
front += 1
i += 1... | ASSIGN VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR BIN_OP LIST STRING VAR ASSIGN VAR BIN_OP VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR BIN_OP VAR NUMBER NUMBER ASSIGN VAR BIN_OP BIN_O... |
Oleg the client and Igor the analyst are good friends. However, sometimes they argue over little things. Recently, they started a new company, but they are having trouble finding a name for the company.
To settle this problem, they've decided to play a game. The company name will consist of n letters. Oleg and Igor ea... | from sys import stdin, stdout
def rint():
return map(int, stdin.readline().split())
a = list(input())
b = list(input())
a.sort()
b.sort(reverse=True)
n = len(a)
ans = ["" for i in range(n)]
ai = 0
bi = 0
aj = 0
bj = 0
aiend = n // 2 - 1
if n % 2:
aiend += 1
biend = n // 2 - 1
i = 0
j = 0
flag = 0
while i + ... | FUNC_DEF RETURN FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR EXPR FUNC_CALL VAR EXPR FUNC_CALL VAR NUMBER ASSIGN VAR FUNC_CALL VAR VAR ASSIGN VAR STRING VAR FUNC_CALL VAR VAR ASSIGN VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR NUMBE... |
Oleg the client and Igor the analyst are good friends. However, sometimes they argue over little things. Recently, they started a new company, but they are having trouble finding a name for the company.
To settle this problem, they've decided to play a game. The company name will consist of n letters. Oleg and Igor ea... | from sys import *
f = lambda: sorted(stdin.readline()[:-1])
t = [f()[::-1], f()]
n = len(t[0])
p = [n & 1, 1]
s = ""
for i in range(n):
k = t[0][-1] < t[1][-1]
p[k] ^= 1
s += t[p[k]].pop()
print(s) | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR NUMBER ASSIGN VAR LIST FUNC_CALL VAR NUMBER FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR NUMBER ASSIGN VAR LIST BIN_OP VAR NUMBER NUMBER ASSIGN VAR STRING FOR VAR FUNC_CALL VAR VAR ASSIGN VAR VAR NUMBER NUMBER VAR NUMBER NUMBER VAR VAR NUMBER VAR FUNC_CALL VAR VAR VAR EXPR FUNC_CALL... |
Oleg the client and Igor the analyst are good friends. However, sometimes they argue over little things. Recently, they started a new company, but they are having trouble finding a name for the company.
To settle this problem, they've decided to play a game. The company name will consist of n letters. Oleg and Igor ea... | from sys import *
f = lambda: sorted(stdin.readline()[:-1])
a, b = f(), f()
n = len(a)
u = v = ""
i, j = 0, -1
x, y = n - 1 >> 1, n - 2 >> 1
while x != -1:
if a[i] < b[j]:
u += a[i]
i += 1
else:
v += a[i + x]
x -= 1
if y == -1:
break
elif a[i] < b[j]:
u += b[... | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR NUMBER ASSIGN VAR VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR ASSIGN VAR VAR STRING ASSIGN VAR VAR NUMBER NUMBER ASSIGN VAR VAR BIN_OP BIN_OP VAR NUMBER NUMBER BIN_OP BIN_OP VAR NUMBER NUMBER WHILE VAR NUMBER IF VAR VAR VAR VAR VAR VAR VAR VAR NUMBER VAR VAR BIN_O... |
Oleg the client and Igor the analyst are good friends. However, sometimes they argue over little things. Recently, they started a new company, but they are having trouble finding a name for the company.
To settle this problem, they've decided to play a game. The company name will consist of n letters. Oleg and Igor ea... | from sys import stdin, stdout
a = stdin.readline().rstrip()
b = stdin.readline().rstrip()
a_count = 26 * [0]
b_count = 26 * [0]
length = len(a)
for i in range(length):
a_count[ord(a[i]) - ord("a")] += 1
b_count[ord(b[i]) - ord("a")] += 1
result = length * ["a"]
left = 0
right = length - 1
mina, minb, maxa, max... | ASSIGN VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR BIN_OP NUMBER LIST NUMBER ASSIGN VAR BIN_OP NUMBER LIST NUMBER ASSIGN VAR FUNC_CALL VAR VAR FOR VAR FUNC_CALL VAR VAR VAR BIN_OP FUNC_CALL VAR VAR VAR FUNC_CALL VAR STRING NUMBER VAR BIN_OP FUNC_CALL VAR VAR VAR FUNC_CALL VAR STRING NUMBER... |
Oleg the client and Igor the analyst are good friends. However, sometimes they argue over little things. Recently, they started a new company, but they are having trouble finding a name for the company.
To settle this problem, they've decided to play a game. The company name will consist of n letters. Oleg and Igor ea... | oleg = input()
igor = input()
oleg = sorted(list(oleg))
igor = sorted(list(igor))
n = len(oleg)
oleg_turns = (n + 1) // 2
igor_turns = n // 2
min_oleg_id = 0
min_igor_id = n - igor_turns
ans = ["?"] * n
max_oleg_id = oleg_turns - 1
max_igor_id = n - 1
curr_turn = "o"
next_turn = {"o": "i", "i": "o"}
l_ans = 0
r_ans = n... | ASSIGN VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR VAR ASSIGN VAR BIN_OP BIN_OP VAR NUMBER NUMBER ASSIGN VAR BIN_OP VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR BIN_OP VAR VAR ASSIGN VAR BIN_OP LIST STRING VAR ASSIG... |
Oleg the client and Igor the analyst are good friends. However, sometimes they argue over little things. Recently, they started a new company, but they are having trouble finding a name for the company.
To settle this problem, they've decided to play a game. The company name will consist of n letters. Oleg and Igor ea... | a = list(input())
b = list(input())
name = [None for _ in range(len(a))]
a.sort()
b.sort(reverse=True)
ai = 0
aj = (len(a) + 1) // 2 - 1
bi = 0
bj = len(b) // 2 - 1
turn = 0
ansi = 0
ansj = len(name) - 1
for _ in range(len(name)):
if not turn:
if a[ai] < b[bi]:
name[ansi] = a[ai]
ai ... | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR NONE VAR FUNC_CALL VAR FUNC_CALL VAR VAR EXPR FUNC_CALL VAR EXPR FUNC_CALL VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR BIN_OP BIN_OP BIN_OP FUNC_CALL VAR VAR NUMBER NUMBER NUMBER ASSIGN VAR NUMBER ASSIGN VAR BIN_OP BIN_OP FUNC_CALL VAR... |
Oleg the client and Igor the analyst are good friends. However, sometimes they argue over little things. Recently, they started a new company, but they are having trouble finding a name for the company.
To settle this problem, they've decided to play a game. The company name will consist of n letters. Oleg and Igor ea... | s = input()
s1 = input()
n = len(s1)
sl = []
sl1 = []
for i in range(n):
sl += [s[i]]
sl1 += [s1[i]]
ans = sl1[:]
sl1.sort()
sl.sort()
sl1.reverse()
i = 0
i2 = (n - 1) // 2
k = 0
k2 = n // 2 - 1
j = len(s) - 1
temp = 0
for x in range(len(s1)):
if x % 2 == 0:
if sl[i] < sl1[k]:
ans[temp] ... | ASSIGN VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR ASSIGN VAR LIST ASSIGN VAR LIST FOR VAR FUNC_CALL VAR VAR VAR LIST VAR VAR VAR LIST VAR VAR ASSIGN VAR VAR EXPR FUNC_CALL VAR EXPR FUNC_CALL VAR EXPR FUNC_CALL VAR ASSIGN VAR NUMBER ASSIGN VAR BIN_OP BIN_OP VAR NUMBER NUMBER ASSIGN VAR NUMBE... |
Oleg the client and Igor the analyst are good friends. However, sometimes they argue over little things. Recently, they started a new company, but they are having trouble finding a name for the company.
To settle this problem, they've decided to play a game. The company name will consist of n letters. Oleg and Igor ea... | import sys
def main():
s = sys.stdin.readline().rstrip()
t = sys.stdin.readline().rstrip()
result = []
iisl = 0
iisr = len(s) // 2 + len(s) % 2 - 1
iitl = 0
iitr = len(s) // 2 - 1
aas = list(sorted(list(s)))
aat = list(sorted(list(t), reverse=True))
rl = 0
rr = len(s) - 1
... | IMPORT FUNC_DEF ASSIGN VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR LIST ASSIGN VAR NUMBER ASSIGN VAR BIN_OP BIN_OP BIN_OP FUNC_CALL VAR VAR NUMBER BIN_OP FUNC_CALL VAR VAR NUMBER NUMBER ASSIGN VAR NUMBER ASSIGN VAR BIN_OP BIN_OP FUNC_CALL VAR VAR NUMBER NUMBER ASSIGN VAR FUNC_CALL VAR FUNC... |
Oleg the client and Igor the analyst are good friends. However, sometimes they argue over little things. Recently, they started a new company, but they are having trouble finding a name for the company.
To settle this problem, they've decided to play a game. The company name will consist of n letters. Oleg and Igor ea... | a = list(input())
b = list(input())
n = len(a)
if len(a) == 1:
print(a[0])
return
a.sort()
b.sort()
a = a[: (len(a) + 1) // 2]
if n % 2 == 1:
b = b[len(b) // 2 + 1 :]
else:
b = b[len(b) // 2 :]
sa = 0
ea = len(a) - 1
sb = 0
eb = len(b) - 1
stb = 0
ste = n - 1
st = [""] * n
for i in range(n):
if i % ... | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR IF FUNC_CALL VAR VAR NUMBER EXPR FUNC_CALL VAR VAR NUMBER RETURN EXPR FUNC_CALL VAR EXPR FUNC_CALL VAR ASSIGN VAR VAR BIN_OP BIN_OP FUNC_CALL VAR VAR NUMBER NUMBER IF BIN_OP VAR NUMBER NUMBER ASSIGN VAR VAR BIN_OP... |
Oleg the client and Igor the analyst are good friends. However, sometimes they argue over little things. Recently, they started a new company, but they are having trouble finding a name for the company.
To settle this problem, they've decided to play a game. The company name will consist of n letters. Oleg and Igor ea... | a = list(input())
b = list(input())
a.sort()
b.sort(reverse=True)
ans = list()
for i in a:
ans.append("a")
len1 = len(a) // 2 - 1
len2 = len(a) // 2 - 1
if len(a) % 2:
len1 = len1 + 1
i = 0
j = 0
flag = 0
ai = 0
aj = 0
bi = 0
bj = 0
while i + j < len(a):
if i + j < len(a):
if a[ai] < b[bi] and flag ... | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR EXPR FUNC_CALL VAR EXPR FUNC_CALL VAR NUMBER ASSIGN VAR FUNC_CALL VAR FOR VAR VAR EXPR FUNC_CALL VAR STRING ASSIGN VAR BIN_OP BIN_OP FUNC_CALL VAR VAR NUMBER NUMBER ASSIGN VAR BIN_OP BIN_OP FUNC_CALL VAR VAR NUMBER NUMBER IF BIN_OP FUNC_CALL ... |
Oleg the client and Igor the analyst are good friends. However, sometimes they argue over little things. Recently, they started a new company, but they are having trouble finding a name for the company.
To settle this problem, they've decided to play a game. The company name will consist of n letters. Oleg and Igor ea... | s1 = list(input())
s2 = list(input())
s1.sort()
s2.sort(reverse=True)
n = len(s1)
s = ["?"] * n
i, j, ni, nj = 0, 0, (n + 1) // 2 - 1, n // 2 - 1
front, rear = 0, n - 1
for cur in range(n):
if cur & 1 == 0:
if s1[i] < s2[j]:
s[front] = s1[i]
i += 1
front += 1
else... | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR EXPR FUNC_CALL VAR EXPR FUNC_CALL VAR NUMBER ASSIGN VAR FUNC_CALL VAR VAR ASSIGN VAR BIN_OP LIST STRING VAR ASSIGN VAR VAR VAR VAR NUMBER NUMBER BIN_OP BIN_OP BIN_OP VAR NUMBER NUMBER NUMBER BIN_OP BIN_OP VAR NUMBER NUMBER ASSIGN VAR VAR NUMB... |
Oleg the client and Igor the analyst are good friends. However, sometimes they argue over little things. Recently, they started a new company, but they are having trouble finding a name for the company.
To settle this problem, they've decided to play a game. The company name will consist of n letters. Oleg and Igor ea... | a = sorted(input())
b = sorted(input(), reverse=True)
n = len(a)
a = "".join(a[: (n + 1) // 2])
b = "".join(b[: n // 2])
name = [""] * (len(a) + len(b))
ia = ib = ic = 0
ja = len(a) - 1
jb = len(b) - 1
jc = len(name) - 1
turn = 1
while ic <= jc:
if turn == 1:
if ib > jb:
name[ic] = a[ia]
... | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR NUMBER ASSIGN VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL STRING VAR BIN_OP BIN_OP VAR NUMBER NUMBER ASSIGN VAR FUNC_CALL STRING VAR BIN_OP VAR NUMBER ASSIGN VAR BIN_OP LIST STRING BIN_OP FUNC_CALL VAR VAR FUNC_CALL VAR VAR ASSIGN VAR VAR VAR ... |
Oleg the client and Igor the analyst are good friends. However, sometimes they argue over little things. Recently, they started a new company, but they are having trouble finding a name for the company.
To settle this problem, they've decided to play a game. The company name will consist of n letters. Oleg and Igor ea... | s = list(map(str, input()))
c = list(map(str, input()))
n = len(s)
s.sort()
c.sort(reverse=True)
s = s[: (n + 1) // 2]
c = c[: n // 2]
l_s = len(s)
l_c = len(c)
begin_s = 0
begin_c = 0
end_s = l_s - 1
end_c = l_c - 1
ans1 = []
ans2 = []
for i in range(n - 1):
if i % 2 == 0:
if s[begin_s] >= c[begin_c]:
... | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR EXPR FUNC_CALL VAR EXPR FUNC_CALL VAR NUMBER ASSIGN VAR VAR BIN_OP BIN_OP VAR NUMBER NUMBER ASSIGN VAR VAR BIN_OP VAR NUMBER ASSIGN VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VA... |
There are $n$ quests. If you complete the $i$-th quest, you will gain $a_i$ coins. You can only complete at most one quest per day. However, once you complete a quest, you cannot do the same quest again for $k$ days. (For example, if $k=2$ and you do quest $1$ on day $1$, then you cannot do it on day $2$ or $3$, but yo... | def bina(l, r, c, d, ss, n):
m = (l + r + 1) // 2
if l == r:
return l
y = d // (m + 1)
otv = ss[min(n - 1, m)] * y
if (m + 1) * y < d:
otv += ss[min(n, d - y * (m + 1)) - 1]
if otv >= c:
return bina(m, r, c, d, ss, n)
else:
return bina(l, m - 1, c, d, ss, n)
... | FUNC_DEF ASSIGN VAR BIN_OP BIN_OP BIN_OP VAR VAR NUMBER NUMBER IF VAR VAR RETURN VAR ASSIGN VAR BIN_OP VAR BIN_OP VAR NUMBER ASSIGN VAR BIN_OP VAR FUNC_CALL VAR BIN_OP VAR NUMBER VAR VAR IF BIN_OP BIN_OP VAR NUMBER VAR VAR VAR VAR BIN_OP FUNC_CALL VAR VAR BIN_OP VAR BIN_OP VAR BIN_OP VAR NUMBER NUMBER IF VAR VAR RETURN... |
There are $n$ quests. If you complete the $i$-th quest, you will gain $a_i$ coins. You can only complete at most one quest per day. However, once you complete a quest, you cannot do the same quest again for $k$ days. (For example, if $k=2$ and you do quest $1$ on day $1$, then you cannot do it on day $2$ or $3$, but yo... | import sys
input = sys.stdin.readline
def solve():
N, C, D = list(map(int, input().split()))
A = list(map(int, input().split()))
A.sort()
i = N - 1
temp = 0
for _ in range(min(D, N)):
temp += A[i]
i -= 1
if temp >= C:
print("Infinity")
return
... | IMPORT ASSIGN VAR VAR FUNC_DEF ASSIGN VAR VAR VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR EXPR FUNC_CALL VAR ASSIGN VAR BIN_OP VAR NUMBER ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR FUNC_CALL VAR VAR VAR VAR VAR VAR VAR NUMBER IF VAR VAR EXP... |
There are $n$ quests. If you complete the $i$-th quest, you will gain $a_i$ coins. You can only complete at most one quest per day. However, once you complete a quest, you cannot do the same quest again for $k$ days. (For example, if $k=2$ and you do quest $1$ on day $1$, then you cannot do it on day $2$ or $3$, but yo... | def compute_max(numbers, k, d, n):
sum = 0
for i in range(d):
if i % (k + 1) < n:
sum += numbers[i % (k + 1)]
return sum
t = int(input())
while t > 0:
ncd = [int(x) for x in input().split()]
n = ncd[0]
c = ncd[1]
d = ncd[2]
list_of_numbers = [int(x) for x in input()... | FUNC_DEF ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR VAR IF BIN_OP VAR BIN_OP VAR NUMBER VAR VAR VAR BIN_OP VAR BIN_OP VAR NUMBER RETURN VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR WHILE VAR NUMBER ASSIGN VAR FUNC_CALL VAR VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR VAR NUMBER ASSIGN VAR VAR NUMBER ASSIGN VAR VAR NUMBER ASSI... |
There are $n$ quests. If you complete the $i$-th quest, you will gain $a_i$ coins. You can only complete at most one quest per day. However, once you complete a quest, you cannot do the same quest again for $k$ days. (For example, if $k=2$ and you do quest $1$ on day $1$, then you cannot do it on day $2$ or $3$, but yo... | t = int(input())
while t > 0:
n, c, d = list(map(int, input().split(" ")))
a = list(map(int, input().split(" ")))
a.sort(reverse=True)
left, right = 0, d + 2
while left < right:
mid = left + (right - left + 1) // 2
total = 0
current = 0
for i in range(d):
... | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR WHILE VAR NUMBER ASSIGN VAR VAR VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR STRING ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR STRING EXPR FUNC_CALL VAR NUMBER ASSIGN VAR VAR NUMBER BIN_OP VAR NUMBER WHILE VAR VAR ASSIGN VAR BIN_OP VAR BIN_OP... |
There are $n$ quests. If you complete the $i$-th quest, you will gain $a_i$ coins. You can only complete at most one quest per day. However, once you complete a quest, you cannot do the same quest again for $k$ days. (For example, if $k=2$ and you do quest $1$ on day $1$, then you cannot do it on day $2$ or $3$, but yo... | def calc(v, arr):
v += 1
tmp1 = d // v
tmp2 = d % v
t = sum(arr[:v])
tmp_out = tmp1 * t + sum(arr[:tmp2])
if tmp_out >= c:
return tmp_out
else:
return False
def binarySearch(low, high, out):
index = (high + low + 1) // 2
tmp_out = calc(index, arr_sort)
if high =... | FUNC_DEF VAR NUMBER ASSIGN VAR BIN_OP VAR VAR ASSIGN VAR BIN_OP VAR VAR ASSIGN VAR FUNC_CALL VAR VAR VAR ASSIGN VAR BIN_OP BIN_OP VAR VAR FUNC_CALL VAR VAR VAR IF VAR VAR RETURN VAR RETURN NUMBER FUNC_DEF ASSIGN VAR BIN_OP BIN_OP BIN_OP VAR VAR NUMBER NUMBER ASSIGN VAR FUNC_CALL VAR VAR VAR IF VAR VAR RETURN VAR IF VAR... |
There are $n$ quests. If you complete the $i$-th quest, you will gain $a_i$ coins. You can only complete at most one quest per day. However, once you complete a quest, you cannot do the same quest again for $k$ days. (For example, if $k=2$ and you do quest $1$ on day $1$, then you cannot do it on day $2$ or $3$, but yo... | t = int(input())
for _ in range(t):
n, c, d = map(int, input().split())
q = list(map(int, input().split()))
q.sort(reverse=True)
def check_k(k):
blocks = d // (k + 1)
block_sum = sum(q[: min(k + 1, n)])
pre_mon = blocks * block_sum
left_over = d - (k + 1) * blocks
... | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR FOR VAR FUNC_CALL VAR VAR ASSIGN VAR VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR EXPR FUNC_CALL VAR NUMBER FUNC_DEF ASSIGN VAR BIN_OP VAR BIN_OP VAR NUMBER ASSIGN VAR FUNC_CALL VAR VAR FUNC_CALL VAR BIN_OP VA... |
There are $n$ quests. If you complete the $i$-th quest, you will gain $a_i$ coins. You can only complete at most one quest per day. However, once you complete a quest, you cannot do the same quest again for $k$ days. (For example, if $k=2$ and you do quest $1$ on day $1$, then you cannot do it on day $2$ or $3$, but yo... | def bin():
l = 0
r = 1
while isok(r):
r *= 2
while r - l > 1:
m = (l + r) // 2
if isok(m):
l = m
else:
r = m
return l
def isok(n):
pz = d // n
npz = d % n
sum = pz * p[min(n, len(s))] + p[min(npz, len(s))]
return sum >= c
fo... | FUNC_DEF ASSIGN VAR NUMBER ASSIGN VAR NUMBER WHILE FUNC_CALL VAR VAR VAR NUMBER WHILE BIN_OP VAR VAR NUMBER ASSIGN VAR BIN_OP BIN_OP VAR VAR NUMBER IF FUNC_CALL VAR VAR ASSIGN VAR VAR ASSIGN VAR VAR RETURN VAR FUNC_DEF ASSIGN VAR BIN_OP VAR VAR ASSIGN VAR BIN_OP VAR VAR ASSIGN VAR BIN_OP BIN_OP VAR VAR FUNC_CALL VAR VA... |
There are $n$ quests. If you complete the $i$-th quest, you will gain $a_i$ coins. You can only complete at most one quest per day. However, once you complete a quest, you cannot do the same quest again for $k$ days. (For example, if $k=2$ and you do quest $1$ on day $1$, then you cannot do it on day $2$ or $3$, but yo... | for _ in range(int(input())):
a, b1, c = map(int, input().split())
ls = sorted(list(map(int, input().split())), reverse=True)
b = [0] * (a + 1)
for i in range(1, a + 1):
b[i] = b[i - 1] + ls[i - 1]
if b[min(a, c)] >= b1:
print("Infinity")
continue
flag = -1
for i in r... | FOR VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR NUMBER ASSIGN VAR BIN_OP LIST NUMBER BIN_OP VAR NUMBER FOR VAR FUNC_CALL VAR NUMBER BIN_OP VAR NUMBER ASSIGN VAR VAR BIN_OP VAR ... |
There are $n$ quests. If you complete the $i$-th quest, you will gain $a_i$ coins. You can only complete at most one quest per day. However, once you complete a quest, you cannot do the same quest again for $k$ days. (For example, if $k=2$ and you do quest $1$ on day $1$, then you cannot do it on day $2$ or $3$, but yo... | inf = 2**60
for tcase in range(int(input())):
n, c, d = map(int, input().split())
a = list(map(int, input().split()))
a.sort(reverse=True)
a = [0] + a
for i in range(n):
a[i + 1] += a[i]
l, r = -1, inf
while r - l > 1:
k = (l + r) // 2
d1, d2 = divmod(d, k + 1)
... | ASSIGN VAR BIN_OP NUMBER NUMBER FOR VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR EXPR FUNC_CALL VAR NUMBER ASSIGN VAR BIN_OP LIST NUMBER VAR FOR VAR FUNC_CALL VAR VAR VAR BIN_OP VAR NUMBER VA... |
There are $n$ quests. If you complete the $i$-th quest, you will gain $a_i$ coins. You can only complete at most one quest per day. However, once you complete a quest, you cannot do the same quest again for $k$ days. (For example, if $k=2$ and you do quest $1$ on day $1$, then you cannot do it on day $2$ or $3$, but yo... | t = int(input())
for _ in range(t):
a = [int(i) for i in input().split()]
n = a[0]
c = a[1]
d = a[2]
a = [int(i) for i in input().split()]
a.sort()
a = a[::-1]
if sum(a[: min(n, d)]) >= c:
print("Infinity")
continue
if d * a[0] < c:
print("Impossible")
... | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR FOR VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR VAR NUMBER ASSIGN VAR VAR NUMBER ASSIGN VAR VAR NUMBER ASSIGN VAR FUNC_CALL VAR VAR VAR FUNC_CALL FUNC_CALL VAR EXPR FUNC_CALL VAR ASSIGN VAR VAR NUMBER IF FUNC_CALL VAR VAR FUNC_CALL VAR... |
There are $n$ quests. If you complete the $i$-th quest, you will gain $a_i$ coins. You can only complete at most one quest per day. However, once you complete a quest, you cannot do the same quest again for $k$ days. (For example, if $k=2$ and you do quest $1$ on day $1$, then you cannot do it on day $2$ or $3$, but yo... | def calc(pre, k, d):
recur = 0
if k >= len(pre):
recur = pre[-1]
else:
recur = pre[k - 1]
cycles = d // k
leftover = d % k
add = 0
if leftover > len(pre):
add = pre[-1]
elif leftover == 0:
add = 0
else:
add = pre[leftover - 1]
return recur ... | FUNC_DEF ASSIGN VAR NUMBER IF VAR FUNC_CALL VAR VAR ASSIGN VAR VAR NUMBER ASSIGN VAR VAR BIN_OP VAR NUMBER ASSIGN VAR BIN_OP VAR VAR ASSIGN VAR BIN_OP VAR VAR ASSIGN VAR NUMBER IF VAR FUNC_CALL VAR VAR ASSIGN VAR VAR NUMBER IF VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR VAR BIN_OP VAR NUMBER RETURN BIN_OP BIN_OP VAR VAR VA... |
There are $n$ quests. If you complete the $i$-th quest, you will gain $a_i$ coins. You can only complete at most one quest per day. However, once you complete a quest, you cannot do the same quest again for $k$ days. (For example, if $k=2$ and you do quest $1$ on day $1$, then you cannot do it on day $2$ or $3$, but yo... | t = int(input())
for i in range(t):
n, c, d = [int(x) for x in input().split()]
L = [int(x) for x in input().split()]
L.sort(reverse=True)
l, r = 0, 10**15
while l < r:
m = (l + r + 1) // 2
if m == 0:
l = 0
break
if sum(L[: min(m, n)]) * (d // m) + sum... | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR FOR VAR FUNC_CALL VAR VAR ASSIGN VAR VAR VAR FUNC_CALL VAR VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR VAR FUNC_CALL FUNC_CALL VAR EXPR FUNC_CALL VAR NUMBER ASSIGN VAR VAR NUMBER BIN_OP NUMBER NUMBER WHILE VAR VAR ASSIGN VAR BIN_OP BIN_OP BIN_OP VAR VAR NUMBER NUM... |
There are $n$ quests. If you complete the $i$-th quest, you will gain $a_i$ coins. You can only complete at most one quest per day. However, once you complete a quest, you cannot do the same quest again for $k$ days. (For example, if $k=2$ and you do quest $1$ on day $1$, then you cannot do it on day $2$ or $3$, but yo... | testcase = int(input())
for _ in range(testcase):
n, c, d = [int(num) for num in input().split()]
arr = [int(num) for num in input().split()]
arr.sort(reverse=True)
if sum(arr[:d]) >= c:
print("Infinity")
continue
if arr[0] * d < c:
print("Impossible")
continue
l ... | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR FOR VAR FUNC_CALL VAR VAR ASSIGN VAR VAR VAR FUNC_CALL VAR VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR VAR FUNC_CALL FUNC_CALL VAR EXPR FUNC_CALL VAR NUMBER IF FUNC_CALL VAR VAR VAR VAR EXPR FUNC_CALL VAR STRING IF BIN_OP VAR NUMBER VAR VAR EXPR FUNC_CALL VAR STRI... |
There are $n$ quests. If you complete the $i$-th quest, you will gain $a_i$ coins. You can only complete at most one quest per day. However, once you complete a quest, you cannot do the same quest again for $k$ days. (For example, if $k=2$ and you do quest $1$ on day $1$, then you cannot do it on day $2$ or $3$, but yo... | for _ in range(int(input())):
n, c, d = map(int, input().split())
arr = list(map(int, input().split()))
arr.sort()
zeros = []
if d > n:
zeros = [0] * (d - n)
arr = zeros + arr
m = len(arr)
ans = 0
arr1 = [0] * m
if arr[m - 1] * d < c:
ans = "Impossible"
el... | FOR VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR EXPR FUNC_CALL VAR ASSIGN VAR LIST IF VAR VAR ASSIGN VAR BIN_OP LIST NUMBER BIN_OP VAR VAR ASSIGN VAR BIN_OP VAR VAR ASSIGN VAR FUNC_CALL VAR ... |
There are $n$ quests. If you complete the $i$-th quest, you will gain $a_i$ coins. You can only complete at most one quest per day. However, once you complete a quest, you cannot do the same quest again for $k$ days. (For example, if $k=2$ and you do quest $1$ on day $1$, then you cannot do it on day $2$ or $3$, but yo... | from itertools import accumulate, count, dropwhile
for _ in range(int(input())):
n, c, d = map(int, input().split())
rwds = list(sorted(map(int, input().split()), reverse=True))
sums = [0] + list(accumulate(rwds))
if sums[min(d, len(rwds))] >= c:
print("Infinity")
elif d // len(rwds) * sums... | FOR VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR NUMBER ASSIGN VAR BIN_OP LIST NUMBER FUNC_CALL VAR FUNC_CALL VAR VAR IF VAR FUNC_CALL VAR VAR FUNC_CALL VAR VAR VAR EXPR FUNC_CA... |
There are $n$ quests. If you complete the $i$-th quest, you will gain $a_i$ coins. You can only complete at most one quest per day. However, once you complete a quest, you cannot do the same quest again for $k$ days. (For example, if $k=2$ and you do quest $1$ on day $1$, then you cannot do it on day $2$ or $3$, but yo... | import sys
input = sys.stdin.readline
for t in range(int(input())):
n, c, d = map(int, input().split())
lst = list(map(int, input().split()))
if d > n:
for i in range(d - n):
lst.append(0)
n = len(lst)
lst.sort()
lst = lst[n - d :]
sm = sum(lst)
if sm >= c:
s... | IMPORT ASSIGN VAR VAR FOR VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR IF VAR VAR FOR VAR FUNC_CALL VAR BIN_OP VAR VAR EXPR FUNC_CALL VAR NUMBER ASSIGN VAR FUNC_CALL VAR VAR EXPR FUNC_CALL VA... |
There are $n$ quests. If you complete the $i$-th quest, you will gain $a_i$ coins. You can only complete at most one quest per day. However, once you complete a quest, you cannot do the same quest again for $k$ days. (For example, if $k=2$ and you do quest $1$ on day $1$, then you cannot do it on day $2$ or $3$, but yo... | t = int(input())
for h in range(t):
n, c, d = map(int, input().split())
a = list(map(int, input().split()))
a = sorted(a, reverse=True)
b = [0] * (n + 1)
for i in range(n):
b[i + 1] = b[i] + a[i]
f = -1
for k in range(d + 10):
s = b[min(k + 1, n)] * (d // (k + 1)) + b[min(d %... | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR FOR VAR FUNC_CALL VAR VAR ASSIGN VAR VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR NUMBER ASSIGN VAR BIN_OP LIST NUMBER BIN_OP VAR NUMBER FOR VAR FUNC_CALL VAR VAR ASSIGN VAR BIN_OP... |
There are $n$ quests. If you complete the $i$-th quest, you will gain $a_i$ coins. You can only complete at most one quest per day. However, once you complete a quest, you cannot do the same quest again for $k$ days. (For example, if $k=2$ and you do quest $1$ on day $1$, then you cannot do it on day $2$ or $3$, but yo... | arr = [4, 4, 2, 1, 2, 2]
d = 8
c = 22
def check(k):
num = min(k, len(arr) - 1)
num = min(d - 1, num)
multi = d // (k + 1)
modul = d % (k + 1)
modul = min(modul, len(arr))
sum = 0
for i in range(0, num + 1):
sum += arr[i]
if multi > 0:
sum *= multi
if modul > 0:
... | ASSIGN VAR LIST NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER ASSIGN VAR NUMBER ASSIGN VAR NUMBER FUNC_DEF ASSIGN VAR FUNC_CALL VAR VAR BIN_OP FUNC_CALL VAR VAR NUMBER ASSIGN VAR FUNC_CALL VAR BIN_OP VAR NUMBER VAR ASSIGN VAR BIN_OP VAR BIN_OP VAR NUMBER ASSIGN VAR BIN_OP VAR BIN_OP VAR NUMBER ASSIGN VAR FUNC_CALL VAR VAR ... |
There are $n$ quests. If you complete the $i$-th quest, you will gain $a_i$ coins. You can only complete at most one quest per day. However, once you complete a quest, you cannot do the same quest again for $k$ days. (For example, if $k=2$ and you do quest $1$ on day $1$, then you cannot do it on day $2$ or $3$, but yo... | for __ in range(int(input())):
n, c, d = map(int, input().split())
a = sorted(list(map(int, input().split())), reverse=True)
sumlst = [0]
for i in a:
sumlst.append(sumlst[-1] + i)
ans = "Impossible"
for k in range(d + 1):
if sumlst[min(n, k + 1)] * (d // (k + 1)) + sumlst[min(n, ... | FOR VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR NUMBER ASSIGN VAR LIST NUMBER FOR VAR VAR EXPR FUNC_CALL VAR BIN_OP VAR NUMBER VAR ASSIGN VAR STRING FOR VAR FUNC_CALL VAR BIN_O... |
There are $n$ quests. If you complete the $i$-th quest, you will gain $a_i$ coins. You can only complete at most one quest per day. However, once you complete a quest, you cannot do the same quest again for $k$ days. (For example, if $k=2$ and you do quest $1$ on day $1$, then you cannot do it on day $2$ or $3$, but yo... | T = int(input())
for hasbulla in range(T):
n, c, d = [int(x) for x in map(int, input().split())]
t = list(map(int, input().split()))
t.sort(reverse=True)
if t[0] * d < c:
print("Impossible")
continue
l = 0
r = d + 9
ans = 0
while l != r:
mid = (l + r) // 2
... | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR FOR VAR FUNC_CALL VAR VAR ASSIGN VAR VAR VAR FUNC_CALL VAR VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR EXPR FUNC_CALL VAR NUMBER IF BIN_OP VAR NUMBER VAR VAR EXPR FUNC_CALL VAR STRING ASSIGN VAR NUMBER ASSIGN... |
There are $n$ quests. If you complete the $i$-th quest, you will gain $a_i$ coins. You can only complete at most one quest per day. However, once you complete a quest, you cannot do the same quest again for $k$ days. (For example, if $k=2$ and you do quest $1$ on day $1$, then you cannot do it on day $2$ or $3$, but yo... | t = int(input())
def possible(k, n, c, d, nums):
ssum = 0
for i in range(d):
try:
a = nums[i % (k + 1)]
except:
a = 0
ssum += a
return ssum >= c
def solve():
n, c, d = [int(x) for x in input().split()]
nums = [int(x) for x in input().split()]
n... | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_DEF ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR VAR ASSIGN VAR VAR BIN_OP VAR BIN_OP VAR NUMBER ASSIGN VAR NUMBER VAR VAR RETURN VAR VAR FUNC_DEF ASSIGN VAR VAR VAR FUNC_CALL VAR VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR VAR FUNC_CALL FUNC_CALL VAR EXPR FUNC_CA... |
There are $n$ quests. If you complete the $i$-th quest, you will gain $a_i$ coins. You can only complete at most one quest per day. However, once you complete a quest, you cannot do the same quest again for $k$ days. (For example, if $k=2$ and you do quest $1$ on day $1$, then you cannot do it on day $2$ or $3$, but yo... | def N():
return int(input())
def A():
return [int(x) for x in input().split()]
def S():
return input()
for _ in range(N()):
n, c, d = A()
l = 0
if "codeforces" == 28226329:
print("Tanmay")
a = A()
h = 10**18
a.sort()
a.reverse()
while l < h:
k = (h + 1 +... | FUNC_DEF RETURN FUNC_CALL VAR FUNC_CALL VAR FUNC_DEF RETURN FUNC_CALL VAR VAR VAR FUNC_CALL FUNC_CALL VAR FUNC_DEF RETURN FUNC_CALL VAR FOR VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR VAR VAR FUNC_CALL VAR ASSIGN VAR NUMBER IF STRING NUMBER EXPR FUNC_CALL VAR STRING ASSIGN VAR FUNC_CALL VAR ASSIGN VAR BIN_OP NUMBER NUMB... |
There are $n$ quests. If you complete the $i$-th quest, you will gain $a_i$ coins. You can only complete at most one quest per day. However, once you complete a quest, you cannot do the same quest again for $k$ days. (For example, if $k=2$ and you do quest $1$ on day $1$, then you cannot do it on day $2$ or $3$, but yo... | import sys
input = sys.stdin.readline
nel = int(input())
for i in range(nel):
data = list(map(int, input().split(" ")))
n_quest = data[0]
n_coins = data[1]
n_days = data[2]
data = list(map(int, input().split(" ")))
rew = sorted(data)[::-1]
if rew[0] >= n_coins:
print("Infinity")
... | IMPORT ASSIGN VAR VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR FOR VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR STRING ASSIGN VAR VAR NUMBER ASSIGN VAR VAR NUMBER ASSIGN VAR VAR NUMBER ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR STRING ASSIGN VAR FUNC_CAL... |
There are $n$ quests. If you complete the $i$-th quest, you will gain $a_i$ coins. You can only complete at most one quest per day. However, once you complete a quest, you cannot do the same quest again for $k$ days. (For example, if $k=2$ and you do quest $1$ on day $1$, then you cannot do it on day $2$ or $3$, but yo... | def f(k, s, d):
ck = s[min(k, n - 1)] * (d // (k + 1))
if d % (k + 1) > 0:
ck += s[min(d % (k + 1) - 1, n - 1)]
return ck
T = int(input())
for t in range(T):
n, c, d = [int(x) for x in input().split()]
a = [int(x) for x in input().split()]
a.sort(reverse=True)
s = [0] * n
s[0] ... | FUNC_DEF ASSIGN VAR BIN_OP VAR FUNC_CALL VAR VAR BIN_OP VAR NUMBER BIN_OP VAR BIN_OP VAR NUMBER IF BIN_OP VAR BIN_OP VAR NUMBER NUMBER VAR VAR FUNC_CALL VAR BIN_OP BIN_OP VAR BIN_OP VAR NUMBER NUMBER BIN_OP VAR NUMBER RETURN VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR FOR VAR FUNC_CALL VAR VAR ASSIGN VAR VAR VAR FUNC_CA... |
There are $n$ quests. If you complete the $i$-th quest, you will gain $a_i$ coins. You can only complete at most one quest per day. However, once you complete a quest, you cannot do the same quest again for $k$ days. (For example, if $k=2$ and you do quest $1$ on day $1$, then you cannot do it on day $2$ or $3$, but yo... | def check(mid, a, d, c):
num = mid + 1
lun = d // num
lunsum = a[min(num, len(a)) - 1]
res = lun * lunsum
yu = d % num
if yu:
res += a[min(yu, len(a)) - 1]
if res >= c:
return 1
else:
return 0
def solve():
n, c, d = input().split(" ")
n = int(n)
c = ... | FUNC_DEF ASSIGN VAR BIN_OP VAR NUMBER ASSIGN VAR BIN_OP VAR VAR ASSIGN VAR VAR BIN_OP FUNC_CALL VAR VAR FUNC_CALL VAR VAR NUMBER ASSIGN VAR BIN_OP VAR VAR ASSIGN VAR BIN_OP VAR VAR IF VAR VAR VAR BIN_OP FUNC_CALL VAR VAR FUNC_CALL VAR VAR NUMBER IF VAR VAR RETURN NUMBER RETURN NUMBER FUNC_DEF ASSIGN VAR VAR VAR FUNC_CA... |
There are $n$ quests. If you complete the $i$-th quest, you will gain $a_i$ coins. You can only complete at most one quest per day. However, once you complete a quest, you cannot do the same quest again for $k$ days. (For example, if $k=2$ and you do quest $1$ on day $1$, then you cannot do it on day $2$ or $3$, but yo... | for _ in range(int(input())):
n, c, d = map(int, input().split())
A = list(map(int, input().split()))
A = sorted(A)[::-1]
if sum(A[:d]) >= c:
print("Infinity")
elif A[0] * d < c:
print("Impossible")
else:
l, r = 0, d
mid = (l + r + 1) // 2
while l < r:
... | FOR VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR NUMBER IF FUNC_CALL VAR VAR VAR VAR EXPR FUNC_CALL VAR STRING IF BIN_OP VAR NUMBER VAR VAR EXPR FUNC_CALL VAR STR... |
There are $n$ quests. If you complete the $i$-th quest, you will gain $a_i$ coins. You can only complete at most one quest per day. However, once you complete a quest, you cannot do the same quest again for $k$ days. (For example, if $k=2$ and you do quest $1$ on day $1$, then you cannot do it on day $2$ or $3$, but yo... | def solve():
n, c, d = tuple(map(int, input().split()))
a = list(map(int, input().split()))
a.sort(reverse=True)
agg = 0
for i in range(n):
if i >= d:
break
agg += a[i]
a[i] = agg
if agg >= c:
print("Infinity")
return
for i in r... | FUNC_DEF ASSIGN VAR VAR VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR EXPR FUNC_CALL VAR NUMBER ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR VAR IF VAR VAR VAR VAR VAR ASSIGN VAR VAR VAR IF VAR VAR EXPR FUNC_CALL VAR STRING RETURN FOR VAR FUNC_... |
There are $n$ quests. If you complete the $i$-th quest, you will gain $a_i$ coins. You can only complete at most one quest per day. However, once you complete a quest, you cannot do the same quest again for $k$ days. (For example, if $k=2$ and you do quest $1$ on day $1$, then you cannot do it on day $2$ or $3$, but yo... | T = int(input())
while T > 0:
T -= 1
n, c, d = map(int, input().split())
arr = list(map(int, input().split()))
aoi = sorted(arr, reverse=True)
l = 1
r = d + 1
sum = 0
for i in range(len(aoi)):
sum += aoi[i]
def check(k):
sana = 0
for i in range(d):
... | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR WHILE VAR NUMBER VAR NUMBER ASSIGN VAR VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR BIN_OP VAR NUMBER ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR FU... |
There are $n$ quests. If you complete the $i$-th quest, you will gain $a_i$ coins. You can only complete at most one quest per day. However, once you complete a quest, you cannot do the same quest again for $k$ days. (For example, if $k=2$ and you do quest $1$ on day $1$, then you cannot do it on day $2$ or $3$, but yo... | def binp(b, m, c, y):
if b[c] >= m and b[c - 1] < m:
return c
elif b[c] > m:
return binp(b, m, c - y, max(y // 2, 1))
elif b[c] < m:
return binp(b, m, c + y, max(y // 2, 1))
for _ in range(int(input())):
n, c, d = map(int, input().split())
a = list(map(int, input().split())... | FUNC_DEF IF VAR VAR VAR VAR BIN_OP VAR NUMBER VAR RETURN VAR IF VAR VAR VAR RETURN FUNC_CALL VAR VAR VAR BIN_OP VAR VAR FUNC_CALL VAR BIN_OP VAR NUMBER NUMBER IF VAR VAR VAR RETURN FUNC_CALL VAR VAR VAR BIN_OP VAR VAR FUNC_CALL VAR BIN_OP VAR NUMBER NUMBER FOR VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR VA... |
There are $n$ quests. If you complete the $i$-th quest, you will gain $a_i$ coins. You can only complete at most one quest per day. However, once you complete a quest, you cannot do the same quest again for $k$ days. (For example, if $k=2$ and you do quest $1$ on day $1$, then you cannot do it on day $2$ or $3$, but yo... | def binary_search(a, days, cnt):
a = a
days = days
cnt = cnt
l = 0
r = days
while r - l != 1:
m = (r + l) // 2
temp = sum(a[0:m]) * (days // m) + sum(a[0 : days - m * (days // m)])
if temp >= cnt:
l = m
else:
r = m
return l - 1
t = in... | FUNC_DEF ASSIGN VAR VAR ASSIGN VAR VAR ASSIGN VAR VAR ASSIGN VAR NUMBER ASSIGN VAR VAR WHILE BIN_OP VAR VAR NUMBER ASSIGN VAR BIN_OP BIN_OP VAR VAR NUMBER ASSIGN VAR BIN_OP BIN_OP FUNC_CALL VAR VAR NUMBER VAR BIN_OP VAR VAR FUNC_CALL VAR VAR NUMBER BIN_OP VAR BIN_OP VAR BIN_OP VAR VAR IF VAR VAR ASSIGN VAR VAR ASSIGN V... |
There are $n$ quests. If you complete the $i$-th quest, you will gain $a_i$ coins. You can only complete at most one quest per day. However, once you complete a quest, you cannot do the same quest again for $k$ days. (For example, if $k=2$ and you do quest $1$ on day $1$, then you cannot do it on day $2$ or $3$, but yo... | from itertools import accumulate
test = int(input())
while test:
n, c, d = map(int, input().split())
a = [int(x) for x in input().split()]
a.sort(reverse=True)
pre_sum = list(accumulate(a))
low = -1
high = d + 1
while low < high:
mid = low + high + 1 >> 1
curr_coins = 0
... | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR WHILE VAR ASSIGN VAR VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR VAR FUNC_CALL FUNC_CALL VAR EXPR FUNC_CALL VAR NUMBER ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR ASSIGN VAR NUMBER ASSIGN VAR BIN_OP VAR NUMBER WHILE VAR VAR ASSIGN VAR BIN_OP BIN_O... |
There are $n$ quests. If you complete the $i$-th quest, you will gain $a_i$ coins. You can only complete at most one quest per day. However, once you complete a quest, you cannot do the same quest again for $k$ days. (For example, if $k=2$ and you do quest $1$ on day $1$, then you cannot do it on day $2$ or $3$, but yo... | t = int(input(""))
aas = [0] * t
for j in range(t):
ncd = input("").split(" ")
n = int(ncd[0])
c = int(ncd[1])
d = int(ncd[2])
y = input("").split(" ")
y = sorted([int(z) for z in y])[::-1]
y += [0] * d
z = [0] * (n + 1 + d)
for i in range(n + d):
z[i + 1] = z[i] + y[i]
i... | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR STRING ASSIGN VAR BIN_OP LIST NUMBER VAR FOR VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL FUNC_CALL VAR STRING STRING ASSIGN VAR FUNC_CALL VAR VAR NUMBER ASSIGN VAR FUNC_CALL VAR VAR NUMBER ASSIGN VAR FUNC_CALL VAR VAR NUMBER ASSIGN VAR FUNC_CALL FUNC_CALL VAR STRING STRING ASSIGN V... |
Every Codeforces user has rating, described with one integer, possibly negative or zero. Users are divided into two divisions. The first division is for users with rating 1900 or higher. Those with rating 1899 or lower belong to the second division. In every contest, according to one's performance, his or her rating ch... | import sys
def change_rating(div, change):
if div == 1:
ranged[0] = max(ranged[0], 1900)
else:
ranged[1] = min(ranged[1], 1899)
if ranged[0] > ranged[1]:
return False
ranged[0] += change
ranged[1] += change
return True
def get_max_cur(start):
t = start
m = sta... | IMPORT FUNC_DEF IF VAR NUMBER ASSIGN VAR NUMBER FUNC_CALL VAR VAR NUMBER NUMBER ASSIGN VAR NUMBER FUNC_CALL VAR VAR NUMBER NUMBER IF VAR NUMBER VAR NUMBER RETURN NUMBER VAR NUMBER VAR VAR NUMBER VAR RETURN NUMBER FUNC_DEF ASSIGN VAR VAR ASSIGN VAR VAR FOR VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR VAR BIN_OP VAR VA... |
Every Codeforces user has rating, described with one integer, possibly negative or zero. Users are divided into two divisions. The first division is for users with rating 1900 or higher. Those with rating 1899 or lower belong to the second division. In every contest, according to one's performance, his or her rating ch... | n = int(input())
l = -1000000000000000.0
r = 1000000000000000.0
c = list(range(n))
d = list(range(n))
s = list(range(n))
for i in range(n):
c[i], d[i] = map(int, input().split())
if i > 0:
s[i] = s[i - 1] + c[i - 1]
if d[i] == 1:
l = max(1900 - s[i], l)
else:
r = ... | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FOR VAR FUNC_CALL VAR VAR ASSIGN VAR VAR VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR IF VAR NUMBER ASSIGN VAR ... |
Every Codeforces user has rating, described with one integer, possibly negative or zero. Users are divided into two divisions. The first division is for users with rating 1900 or higher. Those with rating 1899 or lower belong to the second division. In every contest, according to one's performance, his or her rating ch... | Q = int(input())
change = 0
D1 = []
D2 = []
check1 = 0
check2 = 0
change, start = list(map(int, input().strip().split(" ")))
pred = start
for i in range(1, Q):
c, d = list(map(int, input().strip().split(" ")))
if i == 1:
if d == 1:
MIN1 = change
D1 = [MIN1]
else:
... | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR NUMBER ASSIGN VAR LIST ASSIGN VAR LIST ASSIGN VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL FUNC_CALL VAR STRING ASSIGN VAR VAR FOR VAR FUNC_CALL VAR NUMBER VAR ASSIGN VAR VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FU... |
Every Codeforces user has rating, described with one integer, possibly negative or zero. Users are divided into two divisions. The first division is for users with rating 1900 or higher. Those with rating 1899 or lower belong to the second division. In every contest, according to one's performance, his or her rating ch... | n = int(input())
INF = 10**9
emax, emin = INF, -INF
for _ in range(n):
c, d = map(int, input().split())
if d == 1:
emin = max(emin, 1900)
elif d == 2:
emax = min(emax, 1899)
emin += c
emax += c
if emin > emax:
print("Impossible")
elif emax >= INF / 2:
print("Infinity")
else:
... | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR BIN_OP NUMBER NUMBER ASSIGN VAR VAR VAR VAR FOR VAR FUNC_CALL VAR VAR ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR IF VAR NUMBER ASSIGN VAR FUNC_CALL VAR VAR NUMBER IF VAR NUMBER ASSIGN VAR FUNC_CALL VAR VAR NUMBER VAR VAR VAR VAR IF VAR VAR EXPR FUNC_CALL V... |
Every Codeforces user has rating, described with one integer, possibly negative or zero. Users are divided into two divisions. The first division is for users with rating 1900 or higher. Those with rating 1899 or lower belong to the second division. In every contest, according to one's performance, his or her rating ch... | n = int(input())
r = 0
xmin = -(10**8)
xmax = 10**8
infin = 1
c, d = [int(t) for t in input().split(" ")]
if d == 2:
xmax = 1899
infin = 0
else:
xmin = 1900
for i in range(n - 1):
c0 = c
d0 = d
c, d = [int(t) for t in input().split(" ")]
xmax += c0
xmin += c0
if d == 2:
xmax ... | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR NUMBER ASSIGN VAR BIN_OP NUMBER NUMBER ASSIGN VAR BIN_OP NUMBER NUMBER ASSIGN VAR NUMBER ASSIGN VAR VAR FUNC_CALL VAR VAR VAR FUNC_CALL FUNC_CALL VAR STRING IF VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR BIN_OP VAR NUMBER ASSIG... |
Every Codeforces user has rating, described with one integer, possibly negative or zero. Users are divided into two divisions. The first division is for users with rating 1900 or higher. Those with rating 1899 or lower belong to the second division. In every contest, according to one's performance, his or her rating ch... | INF = float("inf")
n = int(input())
dp1 = [(0) for _ in range(n + 1)]
dp2 = [(0) for _ in range(n + 1)]
d = list()
c = list()
for _ in range(n):
x, y = map(int, input().split())
c.append(x)
d.append(y)
if d[0] == 1:
dp1[0] = 1900
dp2[0] = INF
else:
dp1[0] = -INF
dp2[0] = 1899
impossible = Fa... | ASSIGN VAR FUNC_CALL VAR STRING ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR NUMBER VAR FUNC_CALL VAR BIN_OP VAR NUMBER ASSIGN VAR NUMBER VAR FUNC_CALL VAR BIN_OP VAR NUMBER ASSIGN VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FOR VAR FUNC_CALL VAR VAR ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR EXPR FUN... |
Every Codeforces user has rating, described with one integer, possibly negative or zero. Users are divided into two divisions. The first division is for users with rating 1900 or higher. Those with rating 1899 or lower belong to the second division. In every contest, according to one's performance, his or her rating ch... | n = int(input())
dirs = []
for x in range(0, n):
line = input().split()
dirs.append([int(line[0]), int(line[1])])
pre = 0
L = -200000000
R = 200000000
for dir in dirs:
if dir[1] == 1:
L = max(L, 1900 - pre)
else:
R = min(R, 1899 - pre)
pre = pre + dir[0]
if L > R:
print("Impossib... | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR LIST FOR VAR FUNC_CALL VAR NUMBER VAR ASSIGN VAR FUNC_CALL FUNC_CALL VAR EXPR FUNC_CALL VAR LIST FUNC_CALL VAR VAR NUMBER FUNC_CALL VAR VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR NUMBER FOR VAR VAR IF VAR NUMBER NUMBER ASSIGN VAR FUNC_CALL VAR VAR BIN_OP ... |
Every Codeforces user has rating, described with one integer, possibly negative or zero. Users are divided into two divisions. The first division is for users with rating 1900 or higher. Those with rating 1899 or lower belong to the second division. In every contest, according to one's performance, his or her rating ch... | n = int(input())
c = [(0) for i in range(n)]
c[0], d = map(int, input().split())
INF = 1000000000.0
a = -INF
b = INF
if d == 1:
a = 1900
else:
b = 1899
s = 0
for i in range(1, n):
c[i], d = map(int, input().split())
s += c[i - 1]
if d == 1:
a = max(1900 - s, a)
else:
b = min(1899... | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR NUMBER VAR FUNC_CALL VAR VAR ASSIGN VAR NUMBER VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR NUMBER ASSIGN VAR VAR ASSIGN VAR VAR IF VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR NUMBER VAR ASSIGN VAR VAR VAR FUNC_CALL... |
Every Codeforces user has rating, described with one integer, possibly negative or zero. Users are divided into two divisions. The first division is for users with rating 1900 or higher. Those with rating 1899 or lower belong to the second division. In every contest, according to one's performance, his or her rating ch... | n = int(input())
rounds = [[*map(int, input().split())] for _ in range(n)]
ans = -1
def check(m):
d = int()
for i, j in rounds:
d = 2 if m < 1900 else 1
if d != j:
if d == 2:
return 0
else:
return -1
m += i
global ans
ans ... | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR LIST FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR VAR FUNC_CALL VAR VAR ASSIGN VAR NUMBER FUNC_DEF ASSIGN VAR FUNC_CALL VAR FOR VAR VAR VAR ASSIGN VAR VAR NUMBER NUMBER NUMBER IF VAR VAR IF VAR NUMBER RETURN NUMBER RETURN NUMBER VAR VAR ASSIGN VAR VAR RETURN NUMBER FUNC_DE... |
Every Codeforces user has rating, described with one integer, possibly negative or zero. Users are divided into two divisions. The first division is for users with rating 1900 or higher. Those with rating 1899 or lower belong to the second division. In every contest, according to one's performance, his or her rating ch... | def main():
(n,) = read()
mn, mx = -(10**18), 10**18
for _ in range(n):
c, d = read()
if d == 1:
mn = max(mn, 1900)
elif d == 2:
mx = min(mx, 1899)
mn += c
mx += c
if mn > mx:
print("Impossible")
return
if mx > 10**17:
... | FUNC_DEF ASSIGN VAR FUNC_CALL VAR ASSIGN VAR VAR BIN_OP NUMBER NUMBER BIN_OP NUMBER NUMBER FOR VAR FUNC_CALL VAR VAR ASSIGN VAR VAR FUNC_CALL VAR IF VAR NUMBER ASSIGN VAR FUNC_CALL VAR VAR NUMBER IF VAR NUMBER ASSIGN VAR FUNC_CALL VAR VAR NUMBER VAR VAR VAR VAR IF VAR VAR EXPR FUNC_CALL VAR STRING RETURN IF VAR BIN_OP ... |
Every Codeforces user has rating, described with one integer, possibly negative or zero. Users are divided into two divisions. The first division is for users with rating 1900 or higher. Those with rating 1899 or lower belong to the second division. In every contest, according to one's performance, his or her rating ch... | n = int(input())
score = 0
div2_max = -100000000
only_div1 = 1
div = 0
change = 0
contest = [(0, 0)] * (n + 5)
for i in range(1, n + 1):
c, d = map(int, input().split())
only_div1 &= d == 1
if div == 1 and d == 2 and change >= 0:
print("Impossible")
exit()
if div == 2 and d == 1 and chan... | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR BIN_OP LIST NUMBER NUMBER BIN_OP VAR NUMBER FOR VAR FUNC_CALL VAR NUMBER BIN_OP VAR NUMBER ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR VAR VAR NUMBER IF VAR NUMBER VAR... |
Every Codeforces user has rating, described with one integer, possibly negative or zero. Users are divided into two divisions. The first division is for users with rating 1900 or higher. Those with rating 1899 or lower belong to the second division. In every contest, according to one's performance, his or her rating ch... | n = int(input())
l = [[0, 0] for i in range(n + 1)]
for i in range(n):
if i == 0:
l.append([0, 0])
a, b = list(map(int, input().split()))
l[i + 1][0] += l[i][0] + a
l[i][1] = b
def search(x):
for i in range(n):
if l[i][1] == 2 and x > 1899 - l[i][0]:
return "s"
... | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR LIST NUMBER NUMBER VAR FUNC_CALL VAR BIN_OP VAR NUMBER FOR VAR FUNC_CALL VAR VAR IF VAR NUMBER EXPR FUNC_CALL VAR LIST NUMBER NUMBER ASSIGN VAR VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR VAR BIN_OP VAR NUMBER NUMBER BIN_OP VAR VAR NUMBER VAR ASSIGN VAR ... |
Every Codeforces user has rating, described with one integer, possibly negative or zero. Users are divided into two divisions. The first division is for users with rating 1900 or higher. Those with rating 1899 or lower belong to the second division. In every contest, according to one's performance, his or her rating ch... | I = lambda: list(map(int, input().split()))
n = I()[0]
c, d = [([0] * n) for _ in range(2)]
for i in range(n):
_c, _d = I()
c[i] = _c
d[i] = _d
lb, ub, change = -1e100, 1e100, 0
for i in range(n)[::-1]:
change -= c[i]
if d[i] == 1:
lb = max(lb, 1900 - change)
else:
ub = min(ub, 1... | 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 LIST NUMBER VAR VAR FUNC_CALL VAR NUMBER FOR VAR FUNC_CALL VAR VAR ASSIGN VAR VAR FUNC_CALL VAR ASSIGN VAR VAR VAR ASSIGN VAR VAR VAR ASSIGN VAR VAR VAR NUMBER NUMBER NUMBER FOR VAR FUNC_CALL VAR VAR... |
Every Codeforces user has rating, described with one integer, possibly negative or zero. Users are divided into two divisions. The first division is for users with rating 1900 or higher. Those with rating 1899 or lower belong to the second division. In every contest, according to one's performance, his or her rating ch... | n = int(input())
con = []
for i in range(n):
r, d = map(int, input().split())
con.append((r, d))
if all(c[1] == 1 for c in con):
print("Infinity")
exit()
tot = 0
if con[0][1] == 1:
s, f = 1900, 10**19
else:
s, f = -(10**19), 1899
for i in range(n - 1):
tot += con[i][0]
aft = con[i + 1][1... | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR LIST FOR VAR FUNC_CALL VAR VAR ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR EXPR FUNC_CALL VAR VAR VAR IF FUNC_CALL VAR VAR NUMBER NUMBER VAR VAR EXPR FUNC_CALL VAR STRING EXPR FUNC_CALL VAR ASSIGN VAR NUMBER IF VAR NUMBER NUMBER NUMBER ASSIGN VAR VAR NUMBER... |
Every Codeforces user has rating, described with one integer, possibly negative or zero. Users are divided into two divisions. The first division is for users with rating 1900 or higher. Those with rating 1899 or lower belong to the second division. In every contest, according to one's performance, his or her rating ch... | n = int(input())
up = 0
wasup = 0
down = 0
wasdown = 0
for i in range(n):
c, d = [int(i) for i in input().split()]
if d == 1:
if not wasdown:
down = 1900
wasdown = 1
down = max(down, 1900)
down += c
if wasup:
up += c
if d == 2:
if n... | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR VAR ASSIGN VAR VAR FUNC_CALL VAR VAR VAR FUNC_CALL FUNC_CALL VAR IF VAR NUMBER IF VAR ASSIGN VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR FUNC_CALL VAR VAR NUMBER VAR VAR IF VAR VAR VAR IF VAR... |
Every Codeforces user has rating, described with one integer, possibly negative or zero. Users are divided into two divisions. The first division is for users with rating 1900 or higher. Those with rating 1899 or lower belong to the second division. In every contest, according to one's performance, his or her rating ch... | num_contests = int(input())
rating = 0
upper_bound = None
lower_bound = None
for contest_num in range(num_contests):
ci, di = map(int, input().split())
if di == 1:
if upper_bound is None or rating < upper_bound:
upper_bound = rating
else:
assert di == 2
if lower_bound is ... | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR NUMBER ASSIGN VAR NONE ASSIGN VAR NONE FOR VAR FUNC_CALL VAR VAR ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR IF VAR NUMBER IF VAR NONE VAR VAR ASSIGN VAR VAR VAR NUMBER IF VAR NONE VAR VAR ASSIGN VAR VAR VAR VAR IF VAR NONE EXPR FUNC_CALL VAR STRING IF VAR ... |
Every Codeforces user has rating, described with one integer, possibly negative or zero. Users are divided into two divisions. The first division is for users with rating 1900 or higher. Those with rating 1899 or lower belong to the second division. In every contest, according to one's performance, his or her rating ch... | s = 0
a = b = ""
for i in range(int(input())):
c, d = map(int, input().split())
if d == 1:
a = min(a, s) if a != "" else s
else:
b = max(b, s) if b != "" else s
s += c
print(
"Infinity" if b == "" else "Impossible" if a != "" and a - b < 1 else 1899 - b + s
) | ASSIGN VAR NUMBER ASSIGN VAR VAR STRING FOR VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR IF VAR NUMBER ASSIGN VAR VAR STRING FUNC_CALL VAR VAR VAR VAR ASSIGN VAR VAR STRING FUNC_CALL VAR VAR VAR VAR VAR VAR EXPR FUNC_CALL VAR VAR STRING STRING VAR STRING BIN_OP ... |
Every Codeforces user has rating, described with one integer, possibly negative or zero. Users are divided into two divisions. The first division is for users with rating 1900 or higher. Those with rating 1899 or lower belong to the second division. In every contest, according to one's performance, his or her rating ch... | n = int(input())
ratings = []
divs = []
for i in range(n):
a, b = map(int, input().split())
ratings.append(a)
divs.append(b)
curmax = float("inf")
curmin = float("-inf")
if n == 1:
if divs[0] == 1:
print("Infinity")
else:
print(1899 + ratings[0])
else:
for k in range(n - 1):
... | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR LIST ASSIGN VAR LIST FOR VAR FUNC_CALL VAR VAR ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR EXPR FUNC_CALL VAR VAR EXPR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR STRING ASSIGN VAR FUNC_CALL VAR STRING IF VAR NUMBER IF VAR NUMBER NUMBER EXPR FUNC_CALL VAR ST... |
Every Codeforces user has rating, described with one integer, possibly negative or zero. Users are divided into two divisions. The first division is for users with rating 1900 or higher. Those with rating 1899 or lower belong to the second division. In every contest, according to one's performance, his or her rating ch... | import sys
def input():
return sys.stdin.readline().strip()
def iinput():
return int(input())
def minput():
return map(int, input().split())
def listinput():
return list(map(int, input().split()))
rate = 0
a = 10**9
b = -a
for _ in range(iinput()):
r, d = minput()
if d == 1:
b ... | IMPORT FUNC_DEF RETURN FUNC_CALL FUNC_CALL VAR FUNC_DEF RETURN FUNC_CALL VAR FUNC_CALL VAR FUNC_DEF RETURN FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR FUNC_DEF RETURN FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR NUMBER ASSIGN VAR BIN_OP NUMBER NUMBER ASSIGN VAR VAR FOR VAR FUNC_CALL VAR FUNC_CALL VA... |
Every Codeforces user has rating, described with one integer, possibly negative or zero. Users are divided into two divisions. The first division is for users with rating 1900 or higher. Those with rating 1899 or lower belong to the second division. In every contest, according to one's performance, his or her rating ch... | def ri():
return map(int, input().split())
n = int(input())
maxr = 100 * 200000 + 10**9
minr = -maxr
INF = maxr
if n == 1:
c, d = ri()
if d == 1:
print("Infinity")
else:
print(1899 + c)
exit()
csum = 0
r = 0
c, d = ri()
cprev = c
dprev = d
if d == 1:
r = maxr
minr = 1900
el... | FUNC_DEF RETURN FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR BIN_OP BIN_OP NUMBER NUMBER BIN_OP NUMBER NUMBER ASSIGN VAR VAR ASSIGN VAR VAR IF VAR NUMBER ASSIGN VAR VAR FUNC_CALL VAR IF VAR NUMBER EXPR FUNC_CALL VAR STRING EXPR FUNC_CALL VAR BIN_OP NUMBER VAR EXPR FUNC_CAL... |
Every Codeforces user has rating, described with one integer, possibly negative or zero. Users are divided into two divisions. The first division is for users with rating 1900 or higher. Those with rating 1899 or lower belong to the second division. In every contest, according to one's performance, his or her rating ch... | n = int(input())
max_r = float("inf")
min_r = -max_r
for i in range(0, n):
x, y = input().split()
x, y = int(x), int(y)
if i == 0:
if y == 1:
min_r = 1900
else:
max_r = 1899
else:
if y == 1 and max_r < 1900:
print("Impossible")
exit... | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR STRING ASSIGN VAR VAR FOR VAR FUNC_CALL VAR NUMBER VAR ASSIGN VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL VAR VAR IF VAR NUMBER IF VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR NUMBER IF VAR NUMBER VAR NUMBER EXPR FUNC_CALL VAR STR... |
Every Codeforces user has rating, described with one integer, possibly negative or zero. Users are divided into two divisions. The first division is for users with rating 1900 or higher. Those with rating 1899 or lower belong to the second division. In every contest, according to one's performance, his or her rating ch... | n = int(input())
INF = 10**18
l = -INF
r = INF
s = 0
for _ in range(n):
c, d = map(int, input().split())
if d == 1 and l + s < 1900:
l = 1900 - s
if d == 2 and r + s >= 1900:
r = 1899 - s
s += c
if l < -INF:
l = -INF
if r > INF:
r = INF
if l > r:
print("Imposs... | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR BIN_OP NUMBER NUMBER ASSIGN VAR VAR ASSIGN VAR VAR ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR VAR ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR IF VAR NUMBER BIN_OP VAR VAR NUMBER ASSIGN VAR BIN_OP NUMBER VAR IF VAR NUMBER BIN_OP VAR VAR NUMBER ASSIGN VAR BIN_OP... |
Every Codeforces user has rating, described with one integer, possibly negative or zero. Users are divided into two divisions. The first division is for users with rating 1900 or higher. Those with rating 1899 or lower belong to the second division. In every contest, according to one's performance, his or her rating ch... | n = int(input())
c, div = map(int, input().split())
if div == 1:
x = None
y = 1900
else:
x = 1899
y = None
proof = True
for i in range(n - 1):
if x != None:
x += c
if y != None:
y += c
c, div = map(int, input().split())
if div == 1:
if x != None and x < 1900:
... | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR IF VAR NUMBER ASSIGN VAR NONE ASSIGN VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR NONE ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR BIN_OP VAR NUMBER IF VAR NONE VAR VAR IF VAR NONE VAR VAR ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL F... |
Every Codeforces user has rating, described with one integer, possibly negative or zero. Users are divided into two divisions. The first division is for users with rating 1900 or higher. Those with rating 1899 or lower belong to the second division. In every contest, according to one's performance, his or her rating ch... | n = int(input())
c, d = [], []
for i in range(n):
ci, di = map(int, input().split())
c.append(ci), d.append(di)
s = [0] * (n + 1)
geq, leq = 0, 0
for i in reversed(range(n)):
s[i] = s[i + 1] + c[i]
if d[i] == 1:
if geq == 0:
g = s[i] + 1900
else:
g = max(g, s[i] +... | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR VAR LIST LIST FOR VAR FUNC_CALL VAR VAR ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR EXPR FUNC_CALL VAR VAR FUNC_CALL VAR VAR ASSIGN VAR BIN_OP LIST NUMBER BIN_OP VAR NUMBER ASSIGN VAR VAR NUMBER NUMBER FOR VAR FUNC_CALL VAR FUNC_CALL VAR VAR ASSIGN VAR VAR ... |
Every Codeforces user has rating, described with one integer, possibly negative or zero. Users are divided into two divisions. The first division is for users with rating 1900 or higher. Those with rating 1899 or lower belong to the second division. In every contest, according to one's performance, his or her rating ch... | inf = float("inf")
def solve(c, d):
l = -inf
h = inf
for i in range(n):
if d[i] == 1:
l = max(1900, l)
else:
h = min(1899, h)
l += c[i]
h += c[i]
if h == inf:
return "Infinity"
if l > h:
return "Impossible"
return h
n = ... | ASSIGN VAR FUNC_CALL VAR STRING FUNC_DEF ASSIGN VAR VAR ASSIGN VAR VAR FOR VAR FUNC_CALL VAR VAR IF VAR VAR NUMBER ASSIGN VAR FUNC_CALL VAR NUMBER VAR ASSIGN VAR FUNC_CALL VAR NUMBER VAR VAR VAR VAR VAR VAR VAR IF VAR VAR RETURN STRING IF VAR VAR RETURN STRING RETURN VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VA... |
Every Codeforces user has rating, described with one integer, possibly negative or zero. Users are divided into two divisions. The first division is for users with rating 1900 or higher. Those with rating 1899 or lower belong to the second division. In every contest, according to one's performance, his or her rating ch... | import sys
def Main(n):
mn, mx = -(10**18), 10**18
for _ in range(n):
c, d = map(int, input().split())
if d == 1:
mn = max(mn, 1900)
else:
mx = min(mx, 1899)
mn += c
mx += c
if mn > mx:
print("Impossible")
return 0
if mx >... | IMPORT FUNC_DEF ASSIGN VAR VAR BIN_OP NUMBER NUMBER BIN_OP NUMBER NUMBER FOR VAR FUNC_CALL VAR VAR ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR IF VAR NUMBER ASSIGN VAR FUNC_CALL VAR VAR NUMBER ASSIGN VAR FUNC_CALL VAR VAR NUMBER VAR VAR VAR VAR IF VAR VAR EXPR FUNC_CALL VAR STRING RETURN NUMBER IF VAR BIN_... |
Every Codeforces user has rating, described with one integer, possibly negative or zero. Users are divided into two divisions. The first division is for users with rating 1900 or higher. Those with rating 1899 or lower belong to the second division. In every contest, according to one's performance, his or her rating ch... | from sys import stdin
def main():
input()
mi, ma = -(10**9), 10**9
for s in stdin.read().splitlines():
c, d = map(int, s.split())
if d == 1:
if mi < 1900:
mi = 1900
elif ma > 1899:
ma = 1899
if mi > ma:
print("Impossible")... | FUNC_DEF EXPR FUNC_CALL VAR ASSIGN VAR VAR BIN_OP NUMBER NUMBER BIN_OP NUMBER NUMBER FOR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL VAR IF VAR NUMBER IF VAR NUMBER ASSIGN VAR NUMBER IF VAR NUMBER ASSIGN VAR NUMBER IF VAR VAR EXPR FUNC_CALL VAR STRING RETURN VAR VAR VAR VAR EXPR FUNC_CALL VAR... |
Every Codeforces user has rating, described with one integer, possibly negative or zero. Users are divided into two divisions. The first division is for users with rating 1900 or higher. Those with rating 1899 or lower belong to the second division. In every contest, according to one's performance, his or her rating ch... | n = int(input())
firstT, firstB = True, True
t = 1
b = 0
x = 0
for i in range(n):
c, d = map(int, input().split())
if d == 1:
if firstB:
b = 1900 - x
firstB = False
b = max(b, 1900 - x)
else:
if firstT:
t = 1900 - x
firstT = False
... | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR VAR NUMBER NUMBER ASSIGN VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR VAR ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR IF VAR NUMBER IF VAR ASSIGN VAR BIN_OP NUMBER VAR ASSIGN VAR NUMBER ASSIGN VAR FUNC_CALL VAR VAR BIN_OP NUMBER VAR ... |
Every Codeforces user has rating, described with one integer, possibly negative or zero. Users are divided into two divisions. The first division is for users with rating 1900 or higher. Those with rating 1899 or lower belong to the second division. In every contest, according to one's performance, his or her rating ch... | n = int(input())
loi = []
infinity = False
impossible = False
for i in range(n):
loi.append(list(map(int, input().split(" "))))
if loi[0][1] == 1:
upper_bound = 99999999999999999
lower_bound = 1900
last_div = 1
if loi[0][1] == 2:
upper_bound = 1899
lower_bound = -99999999999999999
last_div =... | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR LIST ASSIGN VAR NUMBER ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR VAR EXPR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR STRING IF VAR NUMBER NUMBER NUMBER ASSIGN VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR NUMBER IF VAR NUMBER NUMBER NUMBER ASSIGN VAR ... |
Every Codeforces user has rating, described with one integer, possibly negative or zero. Users are divided into two divisions. The first division is for users with rating 1900 or higher. Those with rating 1899 or lower belong to the second division. In every contest, according to one's performance, his or her rating ch... | MAX = 999999999
def do():
n = int(input())
mx = MAX
mn = -MAX
change, thisDiv = list(map(int, input().split()))
ratingChange = [0, change]
divChange = [0, thisDiv]
for i in range(n - 1):
change, thisDiv = list(map(int, input().split()))
ratingChange.append(ratingChange[-1] ... | ASSIGN VAR NUMBER FUNC_DEF ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR VAR ASSIGN VAR VAR ASSIGN VAR VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR LIST NUMBER VAR ASSIGN VAR LIST NUMBER VAR FOR VAR FUNC_CALL VAR BIN_OP VAR NUMBER ASSIGN VAR VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FU... |
Every Codeforces user has rating, described with one integer, possibly negative or zero. Users are divided into two divisions. The first division is for users with rating 1900 or higher. Those with rating 1899 or lower belong to the second division. In every contest, according to one's performance, his or her rating ch... | FIRST_DIV_START = 1900
def solve():
n = int(input())
min_rating = None
max_rating = None
for _ in range(n):
c, d = list(map(int, input().split()))
if d == 2:
if max_rating is None:
max_rating = FIRST_DIV_START - 1
else:
max_rating... | ASSIGN VAR NUMBER FUNC_DEF ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR NONE ASSIGN VAR NONE FOR VAR FUNC_CALL VAR VAR ASSIGN VAR VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR IF VAR NUMBER IF VAR NONE ASSIGN VAR BIN_OP VAR NUMBER ASSIGN VAR FUNC_CALL VAR BIN_OP VAR NUMBER VAR IF VAR NONE VAR VAR RET... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.