description stringlengths 171 4k | code stringlengths 94 3.98k | normalized_code stringlengths 57 4.99k |
|---|---|---|
Given two positive integers n and k, the binary string Sn is formed as follows:
S1 = "0"
Si = Si-1 + "1" + reverse(invert(Si-1)) for i > 1
Where + denotes the concatenation operation, reverse(x) returns the reversed string x, and invert(x) inverts all the bits in x (0 changes to 1 and 1 changes to 0).
For example, t... | def reverse(m):
t = ""
for i in m:
if i == "1":
t = t + "0"
else:
t = t + "1"
return t
class Solution:
def findKthBit(self, n: int, k: int) -> str:
s = "0"
while n > 1:
t = reverse(s)
s = s + "1" + t[::-1]
n -... | FUNC_DEF ASSIGN VAR STRING FOR VAR VAR IF VAR STRING ASSIGN VAR BIN_OP VAR STRING ASSIGN VAR BIN_OP VAR STRING RETURN VAR CLASS_DEF FUNC_DEF VAR VAR ASSIGN VAR STRING WHILE VAR NUMBER ASSIGN VAR FUNC_CALL VAR VAR ASSIGN VAR BIN_OP BIN_OP VAR STRING VAR NUMBER VAR NUMBER RETURN VAR BIN_OP VAR NUMBER VAR |
Given two positive integers n and k, the binary string Sn is formed as follows:
S1 = "0"
Si = Si-1 + "1" + reverse(invert(Si-1)) for i > 1
Where + denotes the concatenation operation, reverse(x) returns the reversed string x, and invert(x) inverts all the bits in x (0 changes to 1 and 1 changes to 0).
For example, t... | class Solution:
def findKthBit(self, n: int, k: int) -> str:
s = "0"
for i in range(2, n + 1):
sRevInv = "".join([("1" if c == "0" else "0") for c in s[::-1]])
s = s + "1" + sRevInv
if len(s) >= k:
return s[k - 1]
return s[k - 1] | CLASS_DEF FUNC_DEF VAR VAR ASSIGN VAR STRING FOR VAR FUNC_CALL VAR NUMBER BIN_OP VAR NUMBER ASSIGN VAR FUNC_CALL STRING VAR STRING STRING STRING VAR VAR NUMBER ASSIGN VAR BIN_OP BIN_OP VAR STRING VAR IF FUNC_CALL VAR VAR VAR RETURN VAR BIN_OP VAR NUMBER RETURN VAR BIN_OP VAR NUMBER VAR |
Given two positive integers n and k, the binary string Sn is formed as follows:
S1 = "0"
Si = Si-1 + "1" + reverse(invert(Si-1)) for i > 1
Where + denotes the concatenation operation, reverse(x) returns the reversed string x, and invert(x) inverts all the bits in x (0 changes to 1 and 1 changes to 0).
For example, t... | class Solution:
def findKthBit(self, n: int, k: int) -> str:
dp = [None] * n
dp[0] = "0"
for i in range(1, n):
m = ""
inv = self.invert(dp[i - 1], m)
rev = self.reverse(inv)
dp[i] = dp[i - 1] + "1" + rev
return dp[-1][k - 1]
def r... | CLASS_DEF FUNC_DEF VAR VAR ASSIGN VAR BIN_OP LIST NONE VAR ASSIGN VAR NUMBER STRING FOR VAR FUNC_CALL VAR NUMBER VAR ASSIGN VAR STRING ASSIGN VAR FUNC_CALL VAR VAR BIN_OP VAR NUMBER VAR ASSIGN VAR FUNC_CALL VAR VAR ASSIGN VAR VAR BIN_OP BIN_OP VAR BIN_OP VAR NUMBER STRING VAR RETURN VAR NUMBER BIN_OP VAR NUMBER VAR FUN... |
Given two positive integers n and k, the binary string Sn is formed as follows:
S1 = "0"
Si = Si-1 + "1" + reverse(invert(Si-1)) for i > 1
Where + denotes the concatenation operation, reverse(x) returns the reversed string x, and invert(x) inverts all the bits in x (0 changes to 1 and 1 changes to 0).
For example, t... | class Solution:
def findKthBit(self, n: int, k: int) -> str:
switch = {"0": "1", "1": "0"}
s = "0"
while len(s) < k:
s = s + "1" + "".join(switch[i] for i in reversed(s))
return s[k - 1] | CLASS_DEF FUNC_DEF VAR VAR ASSIGN VAR DICT STRING STRING STRING STRING ASSIGN VAR STRING WHILE FUNC_CALL VAR VAR VAR ASSIGN VAR BIN_OP BIN_OP VAR STRING FUNC_CALL STRING VAR VAR VAR FUNC_CALL VAR VAR RETURN VAR BIN_OP VAR NUMBER VAR |
Given two positive integers n and k, the binary string Sn is formed as follows:
S1 = "0"
Si = Si-1 + "1" + reverse(invert(Si-1)) for i > 1
Where + denotes the concatenation operation, reverse(x) returns the reversed string x, and invert(x) inverts all the bits in x (0 changes to 1 and 1 changes to 0).
For example, t... | class Solution:
def findKthBit(self, n: int, k: int) -> str:
def reverse(cur_s):
return "".join([c for c in reversed(cur_s)])
def invert(cur_s):
return "".join([("1" if c == "0" else "0") for c in cur_s])
S = "0"
for i in range(1, n):
S += "1" ... | CLASS_DEF FUNC_DEF VAR VAR FUNC_DEF RETURN FUNC_CALL STRING VAR VAR FUNC_CALL VAR VAR FUNC_DEF RETURN FUNC_CALL STRING VAR STRING STRING STRING VAR VAR ASSIGN VAR STRING FOR VAR FUNC_CALL VAR NUMBER VAR VAR BIN_OP STRING FUNC_CALL VAR FUNC_CALL VAR VAR RETURN VAR BIN_OP VAR NUMBER VAR |
Given two positive integers n and k, the binary string Sn is formed as follows:
S1 = "0"
Si = Si-1 + "1" + reverse(invert(Si-1)) for i > 1
Where + denotes the concatenation operation, reverse(x) returns the reversed string x, and invert(x) inverts all the bits in x (0 changes to 1 and 1 changes to 0).
For example, t... | class Solution:
def findKthBit(self, n: int, k: int) -> str:
s = "0"
inv = "1"
rev_inv = "1"
for i in range(n - 1):
s = s + "1" + rev_inv
inv = ""
rev_inv = ""
for j in range(len(s)):
if s[j] == "0":
... | CLASS_DEF FUNC_DEF VAR VAR ASSIGN VAR STRING ASSIGN VAR STRING ASSIGN VAR STRING FOR VAR FUNC_CALL VAR BIN_OP VAR NUMBER ASSIGN VAR BIN_OP BIN_OP VAR STRING VAR ASSIGN VAR STRING ASSIGN VAR STRING FOR VAR FUNC_CALL VAR FUNC_CALL VAR VAR IF VAR VAR STRING VAR STRING VAR STRING ASSIGN VAR VAR NUMBER RETURN VAR BIN_OP VAR... |
Given two positive integers n and k, the binary string Sn is formed as follows:
S1 = "0"
Si = Si-1 + "1" + reverse(invert(Si-1)) for i > 1
Where + denotes the concatenation operation, reverse(x) returns the reversed string x, and invert(x) inverts all the bits in x (0 changes to 1 and 1 changes to 0).
For example, t... | class Solution:
def invert(s):
inv_s = ""
for char in s:
if char == "1":
inv_s += "0"
else:
inv_s += "1"
return inv_s
answer = ["0"]
for i in range(1, 21):
prev_s = answer[i - 1]
answer.append(prev_s + "1" + in... | CLASS_DEF FUNC_DEF ASSIGN VAR STRING FOR VAR VAR IF VAR STRING VAR STRING VAR STRING RETURN VAR ASSIGN VAR LIST STRING FOR VAR FUNC_CALL VAR NUMBER NUMBER ASSIGN VAR VAR BIN_OP VAR NUMBER EXPR FUNC_CALL VAR BIN_OP BIN_OP VAR STRING FUNC_CALL VAR VAR NUMBER FUNC_DEF VAR VAR RETURN VAR BIN_OP VAR NUMBER BIN_OP VAR NUMBER... |
Given two positive integers n and k, the binary string Sn is formed as follows:
S1 = "0"
Si = Si-1 + "1" + reverse(invert(Si-1)) for i > 1
Where + denotes the concatenation operation, reverse(x) returns the reversed string x, and invert(x) inverts all the bits in x (0 changes to 1 and 1 changes to 0).
For example, t... | class Solution:
def findKthBit(self, n: int, k: int) -> str:
if n == 1:
return "0"
def rev(s):
return s[::-1]
def invert(r):
t = ""
for i in r:
if i == "1":
t += "0"
else:
... | CLASS_DEF FUNC_DEF VAR VAR IF VAR NUMBER RETURN STRING FUNC_DEF RETURN VAR NUMBER FUNC_DEF ASSIGN VAR STRING FOR VAR VAR IF VAR STRING VAR STRING VAR STRING RETURN VAR ASSIGN VAR STRING FOR VAR FUNC_CALL VAR NUMBER BIN_OP VAR NUMBER ASSIGN VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR VAR VAR BIN_OP STRING VAR RETURN ... |
Given two positive integers n and k, the binary string Sn is formed as follows:
S1 = "0"
Si = Si-1 + "1" + reverse(invert(Si-1)) for i > 1
Where + denotes the concatenation operation, reverse(x) returns the reversed string x, and invert(x) inverts all the bits in x (0 changes to 1 and 1 changes to 0).
For example, t... | class Solution:
def findKthBit(self, n: int, k: int) -> str:
s = ["0"]
for _ in range(n - 1):
s += ["1"] + [("1", "0")[int(x)] for x in reversed(s)]
return s[k - 1] | CLASS_DEF FUNC_DEF VAR VAR ASSIGN VAR LIST STRING FOR VAR FUNC_CALL VAR BIN_OP VAR NUMBER VAR BIN_OP LIST STRING STRING STRING FUNC_CALL VAR VAR VAR FUNC_CALL VAR VAR RETURN VAR BIN_OP VAR NUMBER VAR |
Given two positive integers n and k, the binary string Sn is formed as follows:
S1 = "0"
Si = Si-1 + "1" + reverse(invert(Si-1)) for i > 1
Where + denotes the concatenation operation, reverse(x) returns the reversed string x, and invert(x) inverts all the bits in x (0 changes to 1 and 1 changes to 0).
For example, t... | class Solution:
def findKthBit(self, n: int, k: int) -> str:
k -= 1
s = "0"
i = 0
while i < n:
inverted = "".join("1" if c == "0" else "0" for c in s)[::-1]
s = s + "1" + inverted
i += 1
return s[k] | CLASS_DEF FUNC_DEF VAR VAR VAR NUMBER ASSIGN VAR STRING ASSIGN VAR NUMBER WHILE VAR VAR ASSIGN VAR FUNC_CALL STRING VAR STRING STRING STRING VAR VAR NUMBER ASSIGN VAR BIN_OP BIN_OP VAR STRING VAR VAR NUMBER RETURN VAR VAR VAR |
Given two positive integers n and k, the binary string Sn is formed as follows:
S1 = "0"
Si = Si-1 + "1" + reverse(invert(Si-1)) for i > 1
Where + denotes the concatenation operation, reverse(x) returns the reversed string x, and invert(x) inverts all the bits in x (0 changes to 1 and 1 changes to 0).
For example, t... | class Solution:
def findKthBit(self, n: int, k: int) -> str:
def build_string(n):
previous = "0"
for i in range(1, n):
invert = ""
for c in previous:
if c == "1":
invert += "0"
else:
... | CLASS_DEF FUNC_DEF VAR VAR FUNC_DEF ASSIGN VAR STRING FOR VAR FUNC_CALL VAR NUMBER VAR ASSIGN VAR STRING FOR VAR VAR IF VAR STRING VAR STRING VAR STRING ASSIGN VAR BIN_OP BIN_OP VAR STRING VAR NUMBER RETURN VAR ASSIGN VAR FUNC_CALL VAR VAR RETURN VAR BIN_OP VAR NUMBER VAR |
Given two positive integers n and k, the binary string Sn is formed as follows:
S1 = "0"
Si = Si-1 + "1" + reverse(invert(Si-1)) for i > 1
Where + denotes the concatenation operation, reverse(x) returns the reversed string x, and invert(x) inverts all the bits in x (0 changes to 1 and 1 changes to 0).
For example, t... | class Solution:
def findKthBit(self, n: int, k: int) -> str:
S = [0]
for i in range(2, n + 1):
S += [1] + [(1 if i == 0 else 0) for i in S[::-1]]
return str(S[k - 1]) | CLASS_DEF FUNC_DEF VAR VAR ASSIGN VAR LIST NUMBER FOR VAR FUNC_CALL VAR NUMBER BIN_OP VAR NUMBER VAR BIN_OP LIST NUMBER VAR NUMBER NUMBER NUMBER VAR VAR NUMBER RETURN FUNC_CALL VAR VAR BIN_OP VAR NUMBER VAR |
Given two positive integers n and k, the binary string Sn is formed as follows:
S1 = "0"
Si = Si-1 + "1" + reverse(invert(Si-1)) for i > 1
Where + denotes the concatenation operation, reverse(x) returns the reversed string x, and invert(x) inverts all the bits in x (0 changes to 1 and 1 changes to 0).
For example, t... | class Solution:
def findKthBit(self, n: int, k: int) -> str:
s = ["0"]
for i in range(n - 1):
temp1 = s.copy()
for i in range(len(temp1)):
if temp1[i] == "0":
temp1[i] = "1"
elif temp1[i] == "1":
temp1[i... | CLASS_DEF FUNC_DEF VAR VAR ASSIGN VAR LIST STRING FOR VAR FUNC_CALL VAR BIN_OP VAR NUMBER ASSIGN VAR FUNC_CALL VAR FOR VAR FUNC_CALL VAR FUNC_CALL VAR VAR IF VAR VAR STRING ASSIGN VAR VAR STRING IF VAR VAR STRING ASSIGN VAR VAR STRING EXPR FUNC_CALL VAR ASSIGN VAR BIN_OP BIN_OP VAR LIST STRING VAR ASSIGN VAR VAR RETURN... |
Given two positive integers n and k, the binary string Sn is formed as follows:
S1 = "0"
Si = Si-1 + "1" + reverse(invert(Si-1)) for i > 1
Where + denotes the concatenation operation, reverse(x) returns the reversed string x, and invert(x) inverts all the bits in x (0 changes to 1 and 1 changes to 0).
For example, t... | class Solution:
def findKthBit(self, n: int, k: int) -> str:
l = [0]
for _ in range(n - 1):
l = l + [1] + [(1 - b) for b in reversed(l)]
if len(l) >= k:
return str(l[k - 1])
return str(l[k - 1]) | CLASS_DEF FUNC_DEF VAR VAR ASSIGN VAR LIST NUMBER FOR VAR FUNC_CALL VAR BIN_OP VAR NUMBER ASSIGN VAR BIN_OP BIN_OP VAR LIST NUMBER BIN_OP NUMBER VAR VAR FUNC_CALL VAR VAR IF FUNC_CALL VAR VAR VAR RETURN FUNC_CALL VAR VAR BIN_OP VAR NUMBER RETURN FUNC_CALL VAR VAR BIN_OP VAR NUMBER VAR |
Given two positive integers n and k, the binary string Sn is formed as follows:
S1 = "0"
Si = Si-1 + "1" + reverse(invert(Si-1)) for i > 1
Where + denotes the concatenation operation, reverse(x) returns the reversed string x, and invert(x) inverts all the bits in x (0 changes to 1 and 1 changes to 0).
For example, t... | class Solution:
def findKthBit(self, n: int, k: int) -> str:
bits = [False]
for i in range(1, n + 1):
bits.extend([True] + [(j == False) for j in bits[::-1]])
return str(int(bits[k - 1])) | CLASS_DEF FUNC_DEF VAR VAR ASSIGN VAR LIST NUMBER FOR VAR FUNC_CALL VAR NUMBER BIN_OP VAR NUMBER EXPR FUNC_CALL VAR BIN_OP LIST NUMBER VAR NUMBER VAR VAR NUMBER RETURN FUNC_CALL VAR FUNC_CALL VAR VAR BIN_OP VAR NUMBER VAR |
Given two positive integers n and k, the binary string Sn is formed as follows:
S1 = "0"
Si = Si-1 + "1" + reverse(invert(Si-1)) for i > 1
Where + denotes the concatenation operation, reverse(x) returns the reversed string x, and invert(x) inverts all the bits in x (0 changes to 1 and 1 changes to 0).
For example, t... | class Solution:
def findKthBit(self, n: int, k: int) -> str:
memo_table = [""] * n
memo_table[0] = "0"
for i in range(1, n):
memo_table[i] = self.new_level(memo_table[i - 1])
return memo_table[n - 1][k - 1]
def new_level(self, old_level: str):
new_level = ["... | CLASS_DEF FUNC_DEF VAR VAR ASSIGN VAR BIN_OP LIST STRING VAR ASSIGN VAR NUMBER STRING FOR VAR FUNC_CALL VAR NUMBER VAR ASSIGN VAR VAR FUNC_CALL VAR VAR BIN_OP VAR NUMBER RETURN VAR BIN_OP VAR NUMBER BIN_OP VAR NUMBER VAR FUNC_DEF VAR ASSIGN VAR BIN_OP LIST STRING BIN_OP BIN_OP FUNC_CALL VAR VAR NUMBER NUMBER ASSIGN VAR... |
Given two positive integers n and k, the binary string Sn is formed as follows:
S1 = "0"
Si = Si-1 + "1" + reverse(invert(Si-1)) for i > 1
Where + denotes the concatenation operation, reverse(x) returns the reversed string x, and invert(x) inverts all the bits in x (0 changes to 1 and 1 changes to 0).
For example, t... | class Solution:
def findKthBit(self, n: int, k: int) -> str:
cache = [""] * n
def gen_str(n):
if n - 1 in cache:
return cache[n - 1]
if n == 1:
s = "0"
cache[0] = s
return s
prev = gen_str(n - 1)
... | CLASS_DEF FUNC_DEF VAR VAR ASSIGN VAR BIN_OP LIST STRING VAR FUNC_DEF IF BIN_OP VAR NUMBER VAR RETURN VAR BIN_OP VAR NUMBER IF VAR NUMBER ASSIGN VAR STRING ASSIGN VAR NUMBER VAR RETURN VAR ASSIGN VAR FUNC_CALL VAR BIN_OP VAR NUMBER ASSIGN VAR BIN_OP VAR STRING FOR VAR FUNC_CALL VAR VAR IF VAR STRING VAR STRING VAR STRI... |
Given two positive integers n and k, the binary string Sn is formed as follows:
S1 = "0"
Si = Si-1 + "1" + reverse(invert(Si-1)) for i > 1
Where + denotes the concatenation operation, reverse(x) returns the reversed string x, and invert(x) inverts all the bits in x (0 changes to 1 and 1 changes to 0).
For example, t... | class Solution:
def findKthBit(self, n: int, k: int) -> str:
s0 = "0"
i = 1
while i <= n:
s0 = s0 + "1" + self.reverse(s0)
i = i + 1
return s0[k - 1]
def reverse(self, s):
mapp = {"1": "0", "0": "1"}
ans = ""
for x in s:
... | CLASS_DEF FUNC_DEF VAR VAR ASSIGN VAR STRING ASSIGN VAR NUMBER WHILE VAR VAR ASSIGN VAR BIN_OP BIN_OP VAR STRING FUNC_CALL VAR VAR ASSIGN VAR BIN_OP VAR NUMBER RETURN VAR BIN_OP VAR NUMBER VAR FUNC_DEF ASSIGN VAR DICT STRING STRING STRING STRING ASSIGN VAR STRING FOR VAR VAR ASSIGN VAR BIN_OP VAR VAR VAR RETURN VAR NUM... |
Given two positive integers n and k, the binary string Sn is formed as follows:
S1 = "0"
Si = Si-1 + "1" + reverse(invert(Si-1)) for i > 1
Where + denotes the concatenation operation, reverse(x) returns the reversed string x, and invert(x) inverts all the bits in x (0 changes to 1 and 1 changes to 0).
For example, t... | class Solution:
def findKthBit(self, n: int, k: int) -> str:
def invert(data):
ans = ""
for val in data:
ans += "1" if val == "0" else "0"
return ans
output = "0"
for i in range(1, n + 1):
output += "1" + invert(output)[::-1]... | CLASS_DEF FUNC_DEF VAR VAR FUNC_DEF ASSIGN VAR STRING FOR VAR VAR VAR VAR STRING STRING STRING RETURN VAR ASSIGN VAR STRING FOR VAR FUNC_CALL VAR NUMBER BIN_OP VAR NUMBER VAR BIN_OP STRING FUNC_CALL VAR VAR NUMBER IF FUNC_CALL VAR VAR VAR RETURN VAR BIN_OP VAR NUMBER VAR |
Given two positive integers n and k, the binary string Sn is formed as follows:
S1 = "0"
Si = Si-1 + "1" + reverse(invert(Si-1)) for i > 1
Where + denotes the concatenation operation, reverse(x) returns the reversed string x, and invert(x) inverts all the bits in x (0 changes to 1 and 1 changes to 0).
For example, t... | class Solution:
def findKthBit(self, n: int, k: int) -> str:
s = "0"
for i in range(1, n):
chars = []
for j in reversed(list(range(len(s)))):
chars.append("1" if s[j] == "0" else "0")
s += "1" + "".join(chars)
return s[k - 1] | CLASS_DEF FUNC_DEF VAR VAR ASSIGN VAR STRING FOR VAR FUNC_CALL VAR NUMBER VAR ASSIGN VAR LIST FOR VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR VAR EXPR FUNC_CALL VAR VAR VAR STRING STRING STRING VAR BIN_OP STRING FUNC_CALL STRING VAR RETURN VAR BIN_OP VAR NUMBER VAR |
Given two positive integers n and k, the binary string Sn is formed as follows:
S1 = "0"
Si = Si-1 + "1" + reverse(invert(Si-1)) for i > 1
Where + denotes the concatenation operation, reverse(x) returns the reversed string x, and invert(x) inverts all the bits in x (0 changes to 1 and 1 changes to 0).
For example, t... | class Solution:
def findKthBit(self, n: int, k: int) -> str:
series = ["0"]
for i in range(n - 1):
series = self.getNext(series)
return series[k - 1]
def getNext(self, series):
extension = series[::-1]
for idx, c in enumerate(extension):
if c == ... | CLASS_DEF FUNC_DEF VAR VAR ASSIGN VAR LIST STRING FOR VAR FUNC_CALL VAR BIN_OP VAR NUMBER ASSIGN VAR FUNC_CALL VAR VAR RETURN VAR BIN_OP VAR NUMBER VAR FUNC_DEF ASSIGN VAR VAR NUMBER FOR VAR VAR FUNC_CALL VAR VAR IF VAR STRING ASSIGN VAR VAR STRING ASSIGN VAR VAR STRING RETURN BIN_OP BIN_OP VAR LIST STRING VAR |
This is the easy version of Problem F. The only difference between the easy version and the hard version is the constraints.
We will call a non-empty string balanced if it contains the same number of plus and minus signs. For example: strings "+--+" and "++-+--" are balanced, and strings "+--", "--" and "" are not bal... | def solution():
n = int(input())
s = input()
ans = 0
for i in range(n):
record = {"+": 0, "-": 0}
for j in range(i, n):
record[s[j]] += 1
dif = record["-"] - record["+"]
ans += dif >= 0 and dif % 3 == 0
print(ans)
t = int(input())
for _ in range(... | FUNC_DEF ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR VAR ASSIGN VAR DICT STRING STRING NUMBER NUMBER FOR VAR FUNC_CALL VAR VAR VAR VAR VAR VAR NUMBER ASSIGN VAR BIN_OP VAR STRING VAR STRING VAR VAR NUMBER BIN_OP VAR NUMBER NUMBER EXPR FUNC_CALL VAR VAR ASSIGN ... |
This is the easy version of Problem F. The only difference between the easy version and the hard version is the constraints.
We will call a non-empty string balanced if it contains the same number of plus and minus signs. For example: strings "+--+" and "++-+--" are balanced, and strings "+--", "--" and "" are not bal... | for _ in range(int(input())):
n = int(input())
s = input()
ans = 0
for i in range(len(s)):
p, m = 0, 0
for j in range(i, len(s)):
if s[j] == "+":
p = p + 1
elif s[j] == "-":
m = m + 1
if m >= p and (m - p) % 3 == 0:
... | FOR VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR FUNC_CALL VAR VAR ASSIGN VAR VAR NUMBER NUMBER FOR VAR FUNC_CALL VAR VAR FUNC_CALL VAR VAR IF VAR VAR STRING ASSIGN VAR BIN_OP VAR NUMBER IF VAR VAR STRING ASSIGN VAR... |
This is the easy version of Problem F. The only difference between the easy version and the hard version is the constraints.
We will call a non-empty string balanced if it contains the same number of plus and minus signs. For example: strings "+--+" and "++-+--" are balanced, and strings "+--", "--" and "" are not bal... | n = int(input())
for i in range(n):
t = int(input())
l = input()
m = 0
c = 0
R = []
for j, ch in enumerate(l):
if ch == "-":
a = 1
else:
a = -1
f = []
if j == 0:
f.append(a)
if a < 0:
a = 0
... | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR FOR VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR ASSIGN VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR LIST FOR VAR VAR FUNC_CALL VAR VAR IF VAR STRING ASSIGN VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR LIST IF VAR NUMBER EXPR FUNC_CALL VAR VAR IF VAR... |
This is the easy version of Problem F. The only difference between the easy version and the hard version is the constraints.
We will call a non-empty string balanced if it contains the same number of plus and minus signs. For example: strings "+--+" and "++-+--" are balanced, and strings "+--", "--" and "" are not bal... | def promisingstring(s):
n = len(s)
presum = [0] * (n + 1)
ans = 0
for i in range(1, n + 1):
if s[i - 1] == "+":
presum[i] = presum[i - 1] + 1
else:
presum[i] = presum[i - 1] - 1
for i in range(1, n + 1):
for j in range(i):
if presum[i] - pr... | FUNC_DEF ASSIGN VAR FUNC_CALL VAR VAR ASSIGN VAR BIN_OP LIST NUMBER BIN_OP VAR NUMBER ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR NUMBER BIN_OP VAR NUMBER IF VAR BIN_OP VAR NUMBER STRING ASSIGN VAR VAR BIN_OP VAR BIN_OP VAR NUMBER NUMBER ASSIGN VAR VAR BIN_OP VAR BIN_OP VAR NUMBER NUMBER FOR VAR FUNC_CALL VAR NUMBER BIN_OP... |
This is the easy version of Problem F. The only difference between the easy version and the hard version is the constraints.
We will call a non-empty string balanced if it contains the same number of plus and minus signs. For example: strings "+--+" and "++-+--" are balanced, and strings "+--", "--" and "" are not bal... | def promising(x):
if not x % 3 and x > -1:
return 1
return 0
for tc in range(int(input())):
count, n, balance = (
0,
int(input()),
[(1 if char == "-" else -1) for char in input()],
)
for i in range(n - 1):
x = sum(balance[i : i + 2])
count += promisi... | FUNC_DEF IF BIN_OP VAR NUMBER VAR NUMBER RETURN NUMBER RETURN NUMBER FOR VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR VAR VAR NUMBER FUNC_CALL VAR FUNC_CALL VAR VAR STRING NUMBER NUMBER VAR FUNC_CALL VAR FOR VAR FUNC_CALL VAR BIN_OP VAR NUMBER ASSIGN VAR FUNC_CALL VAR VAR VAR BIN_OP VAR NUMBER VAR FUNC_CALL... |
This is the easy version of Problem F. The only difference between the easy version and the hard version is the constraints.
We will call a non-empty string balanced if it contains the same number of plus and minus signs. For example: strings "+--+" and "++-+--" are balanced, and strings "+--", "--" and "" are not bal... | t = int(input())
for i in range(t):
n = int(input())
s = input()
c = 0
se = set()
lsta = []
for j in range(n - 1):
p = 0
m = 0
for k in range(j, n):
if s[k] == "+":
p += 1
else:
m += 1
if p == m:
... | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR FOR VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR ASSIGN VAR NUMBER ASSIGN VAR FUNC_CALL VAR ASSIGN VAR LIST FOR VAR FUNC_CALL VAR BIN_OP VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR VAR VAR IF VAR VAR STRING VAR NUMB... |
This is the easy version of Problem F. The only difference between the easy version and the hard version is the constraints.
We will call a non-empty string balanced if it contains the same number of plus and minus signs. For example: strings "+--+" and "++-+--" are balanced, and strings "+--", "--" and "" are not bal... | ans = []
for i in range(int(input())):
n = int(input())
inpstr = list(input().strip())
balance = []
bal = n
balance.append(bal)
cnt = 0
for _ in range(1, n + 1):
if inpstr[_ - 1] == "+":
bal += 1
else:
bal -= 1
balance.append(bal)
for _... | ASSIGN VAR LIST FOR VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR LIST ASSIGN VAR VAR EXPR FUNC_CALL VAR VAR ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR NUMBER BIN_OP VAR NUMBER IF VAR BIN_OP VAR NUMBER STRING VAR NUMBER VAR ... |
This is the easy version of Problem F. The only difference between the easy version and the hard version is the constraints.
We will call a non-empty string balanced if it contains the same number of plus and minus signs. For example: strings "+--+" and "++-+--" are balanced, and strings "+--", "--" and "" are not bal... | t = int(input())
for _ in range(t):
n = int(input())
s = input()
promising = 0
for i in range(n):
plus = 0
minus = 0
for j in range(i, n):
if s[j] == "+":
plus += 1
elif s[j] == "-":
minus += 1
if plus <= minus a... | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR FOR VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR VAR ASSIGN VAR NUMBER ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR VAR VAR IF VAR VAR STRING VAR NUMBER IF VAR VAR STRING VAR NUMBER IF VAR VAR BIN_OP BIN_O... |
This is the easy version of Problem F. The only difference between the easy version and the hard version is the constraints.
We will call a non-empty string balanced if it contains the same number of plus and minus signs. For example: strings "+--+" and "++-+--" are balanced, and strings "+--", "--" and "" are not bal... | for _ in range(int(input())):
n = int(input())
temp = input()
subl, plul = [(0) for i in range(n + 1)], [(0) for i in range(n + 1)]
ans = 0
for i in range(n):
if temp[i] == "+":
plul[i + 1] = plul[i] + 1
subl[i + 1] = subl[i]
else:
subl[i + 1] = su... | FOR VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR ASSIGN VAR VAR NUMBER VAR FUNC_CALL VAR BIN_OP VAR NUMBER NUMBER VAR FUNC_CALL VAR BIN_OP VAR NUMBER ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR VAR IF VAR VAR STRING ASSIGN VAR BIN_OP VAR NUMBER BIN_OP VAR VAR... |
This is the easy version of Problem F. The only difference between the easy version and the hard version is the constraints.
We will call a non-empty string balanced if it contains the same number of plus and minus signs. For example: strings "+--+" and "++-+--" are balanced, and strings "+--", "--" and "" are not bal... | tst = int(input())
for _ in range(tst):
n = int(input())
s = input()
f = [(0) for i in range(3)]
cur_bal = n
cnt_bal = [(0) for i in range(2 * n + 1)]
cnt_bal[cur_bal] += 1
f[cur_bal % 3] += 1
ans = 0
for i in range(n):
new_bal = cur_bal
if s[i] == "-":
ne... | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR FOR VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR ASSIGN VAR NUMBER VAR FUNC_CALL VAR NUMBER ASSIGN VAR VAR ASSIGN VAR NUMBER VAR FUNC_CALL VAR BIN_OP BIN_OP NUMBER VAR NUMBER VAR VAR NUMBER VAR BIN_OP VAR NUMBER NUMBER ASSIGN VAR NUMBER FOR... |
This is the easy version of Problem F. The only difference between the easy version and the hard version is the constraints.
We will call a non-empty string balanced if it contains the same number of plus and minus signs. For example: strings "+--+" and "++-+--" are balanced, and strings "+--", "--" and "" are not bal... | testcase = int(input())
for _ in range(testcase):
ans = 0
length = int(input())
string = input()
for i in range(length):
plus = minus = 0
for j in range(i, length):
if string[j] == "+":
plus += 1
else:
minus += 1
if minu... | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR FOR VAR FUNC_CALL VAR VAR ASSIGN VAR NUMBER ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FOR VAR FUNC_CALL VAR VAR ASSIGN VAR VAR NUMBER FOR VAR FUNC_CALL VAR VAR VAR IF VAR VAR STRING VAR NUMBER VAR NUMBER IF VAR VAR IF BIN_OP BIN_OP BIN_OP VAR VAR NUMBER NUMBE... |
This is the easy version of Problem F. The only difference between the easy version and the hard version is the constraints.
We will call a non-empty string balanced if it contains the same number of plus and minus signs. For example: strings "+--+" and "++-+--" are balanced, and strings "+--", "--" and "" are not bal... | tst = int(input())
for _ in range(tst):
n = int(input())
s = input()
b = [(0) for i in range(n + 1)]
bal = n
b[0] = bal
ans = 0
for i in range(1, n + 1):
if s[i - 1] == "+":
bal += 1
else:
bal -= 1
b[i] = bal
for j in range(i):
... | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR FOR VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR ASSIGN VAR NUMBER VAR FUNC_CALL VAR BIN_OP VAR NUMBER ASSIGN VAR VAR ASSIGN VAR NUMBER VAR ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR NUMBER BIN_OP VAR NUMBER IF VAR BIN_OP VAR NUMBER STRING VAR... |
This is the easy version of Problem F. The only difference between the easy version and the hard version is the constraints.
We will call a non-empty string balanced if it contains the same number of plus and minus signs. For example: strings "+--+" and "++-+--" are balanced, and strings "+--", "--" and "" are not bal... | t = int(input())
for _ in range(t):
n = int(input())
s = input()
pr = [(0) for i in range(n + 1)]
for i in range(1, n + 1):
if s[i - 1] == "-":
pr[i] = pr[i - 1] + 1
else:
pr[i] = pr[i - 1] - 1
c = 0
for r in range(n + 1):
for l in range(r):
... | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR FOR VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR ASSIGN VAR NUMBER VAR FUNC_CALL VAR BIN_OP VAR NUMBER FOR VAR FUNC_CALL VAR NUMBER BIN_OP VAR NUMBER IF VAR BIN_OP VAR NUMBER STRING ASSIGN VAR VAR BIN_OP VAR BIN_OP VAR NUMBER NUMBER ASSIGN ... |
Hideo Kojima has just quit his job at Konami. Now he is going to find a new place to work. Despite being such a well-known person, he still needs a CV to apply for a job.
During all his career Hideo has produced n games. Some of them were successful, some were not. Hideo wants to remove several of them (possibly zero)... | input()
n = [int(x) for x in input().split()]
a = -1
aa = 0
for i, x in enumerate(n):
aaa = aa + len([x for x in n[i:] if x])
if aaa > a:
a = aaa
if not x:
aa += 1
print(max(a, aa)) | EXPR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR NUMBER ASSIGN VAR NUMBER FOR VAR VAR FUNC_CALL VAR VAR ASSIGN VAR BIN_OP VAR FUNC_CALL VAR VAR VAR VAR VAR VAR IF VAR VAR ASSIGN VAR VAR IF VAR VAR NUMBER EXPR FUNC_CALL VAR FUNC_CALL VAR VAR VAR |
Hideo Kojima has just quit his job at Konami. Now he is going to find a new place to work. Despite being such a well-known person, he still needs a CV to apply for a job.
During all his career Hideo has produced n games. Some of them were successful, some were not. Hideo wants to remove several of them (possibly zero)... | def solve(s):
zeroes = accum(s, 0)
ones = list(reversed(accum(reversed(s), 1)))
return max(x + y for x, y in zip(zeroes, ones))
def accum(lst, value):
counts = [0]
for el in lst:
if el == value:
counts.append(counts[-1] + 1)
else:
counts.append(counts[-1])
... | FUNC_DEF ASSIGN VAR FUNC_CALL VAR VAR NUMBER ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR VAR NUMBER RETURN FUNC_CALL VAR BIN_OP VAR VAR VAR VAR FUNC_CALL VAR VAR VAR FUNC_DEF ASSIGN VAR LIST NUMBER FOR VAR VAR IF VAR VAR EXPR FUNC_CALL VAR BIN_OP VAR NUMBER NUMBER EXPR FUNC_CALL VAR VAR NUMBER RE... |
Hideo Kojima has just quit his job at Konami. Now he is going to find a new place to work. Despite being such a well-known person, he still needs a CV to apply for a job.
During all his career Hideo has produced n games. Some of them were successful, some were not. Hideo wants to remove several of them (possibly zero)... | n = int(input())
t = list(map(int, input().split()))
print(max([(i - sum(t[:i]) + sum(t[i:])) for i in range(n + 1)])) | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR EXPR FUNC_CALL VAR FUNC_CALL VAR BIN_OP BIN_OP VAR FUNC_CALL VAR VAR VAR FUNC_CALL VAR VAR VAR VAR FUNC_CALL VAR BIN_OP VAR NUMBER |
Hideo Kojima has just quit his job at Konami. Now he is going to find a new place to work. Despite being such a well-known person, he still needs a CV to apply for a job.
During all his career Hideo has produced n games. Some of them were successful, some were not. Hideo wants to remove several of them (possibly zero)... | n = int(input())
s = [int(x) for x in input().split()]
max_fails = []
fails = 0
for i in range(n):
if s[i] == 0:
fails += 1
max_fails.append(fails)
max_successes = []
successes = 0
for i in range(n - 1, -1, -1):
if s[i] == 1:
successes += 1
max_successes.append(successes)
max_successes =... | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR LIST ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR VAR IF VAR VAR NUMBER VAR NUMBER EXPR FUNC_CALL VAR VAR ASSIGN VAR LIST ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR BIN_OP VAR NUMBER NUMBER NUMBER IF VAR VAR NUMBER VAR NU... |
Hideo Kojima has just quit his job at Konami. Now he is going to find a new place to work. Despite being such a well-known person, he still needs a CV to apply for a job.
During all his career Hideo has produced n games. Some of them were successful, some were not. Hideo wants to remove several of them (possibly zero)... | n = int(input())
s = input()
def max_l(s):
if len(s) <= 1:
return len(s)
lenE = 0
ind = 0
prev = -1
for i in range(len(s)):
if s[i] == "1":
lenE += 1
if s[i] == "1" and prev == "0":
ind = i - 1
prev = s[i]
lenZ = 0
for i in range(ind ... | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_DEF IF FUNC_CALL VAR VAR NUMBER RETURN FUNC_CALL VAR VAR ASSIGN VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR FUNC_CALL VAR VAR IF VAR VAR STRING VAR NUMBER IF VAR VAR STRING VAR STRING ASSIGN VAR BIN_OP VAR NUMBER ASSIGN VAR VA... |
Hideo Kojima has just quit his job at Konami. Now he is going to find a new place to work. Despite being such a well-known person, he still needs a CV to apply for a job.
During all his career Hideo has produced n games. Some of them were successful, some were not. Hideo wants to remove several of them (possibly zero)... | n = int(input())
k = -1
l = input()
for i in range(len(l) + 1):
s = l[:i].count("0") + l[i:].count("1")
if s > k:
k = s
print(k) | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR NUMBER ASSIGN VAR FUNC_CALL VAR FOR VAR FUNC_CALL VAR BIN_OP FUNC_CALL VAR VAR NUMBER ASSIGN VAR BIN_OP FUNC_CALL VAR VAR STRING FUNC_CALL VAR VAR STRING IF VAR VAR ASSIGN VAR VAR EXPR FUNC_CALL VAR VAR |
Hideo Kojima has just quit his job at Konami. Now he is going to find a new place to work. Despite being such a well-known person, he still needs a CV to apply for a job.
During all his career Hideo has produced n games. Some of them were successful, some were not. Hideo wants to remove several of them (possibly zero)... | n = int(input())
s = list(map(int, input().split()))
res = max([(i - sum(s[:i]) + 1 + sum(s[i + 1 :])) for i in range(n)])
print(res) | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR BIN_OP BIN_OP BIN_OP VAR FUNC_CALL VAR VAR VAR NUMBER FUNC_CALL VAR VAR BIN_OP VAR NUMBER VAR FUNC_CALL VAR VAR EXPR FUNC_CALL VAR VAR |
Hideo Kojima has just quit his job at Konami. Now he is going to find a new place to work. Despite being such a well-known person, he still needs a CV to apply for a job.
During all his career Hideo has produced n games. Some of them were successful, some were not. Hideo wants to remove several of them (possibly zero)... | n = int(input())
lst = list(map(int, input().split()))
l, r = 0, lst.count(0)
res = r
for i, x in enumerate(lst):
if x == 0:
r -= 1
else:
l += 1
if l + r < res:
res = l + r
print(n - res) | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR VAR NUMBER FUNC_CALL VAR NUMBER ASSIGN VAR VAR FOR VAR VAR FUNC_CALL VAR VAR IF VAR NUMBER VAR NUMBER VAR NUMBER IF BIN_OP VAR VAR VAR ASSIGN VAR BIN_OP VAR VAR EXPR FUNC_CALL VAR BIN_OP VAR VAR |
Hideo Kojima has just quit his job at Konami. Now he is going to find a new place to work. Despite being such a well-known person, he still needs a CV to apply for a job.
During all his career Hideo has produced n games. Some of them were successful, some were not. Hideo wants to remove several of them (possibly zero)... | n = int(input())
a = list(map(int, input().split()))
cnt = a.count(0)
ans = 0
for i in range(cnt + 1):
a1 = a[::-1]
a2 = []
cnt1 = i
index = 0
while cnt1:
if not a1[index]:
cnt1 -= 1
else:
a2.append(a1[index])
index += 1
for j in range(index, n):
... | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR NUMBER ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR BIN_OP VAR NUMBER ASSIGN VAR VAR NUMBER ASSIGN VAR LIST ASSIGN VAR VAR ASSIGN VAR NUMBER WHILE VAR IF VAR VAR VAR NUMBER EXPR FUNC_CALL VAR VA... |
Hideo Kojima has just quit his job at Konami. Now he is going to find a new place to work. Despite being such a well-known person, he still needs a CV to apply for a job.
During all his career Hideo has produced n games. Some of them were successful, some were not. Hideo wants to remove several of them (possibly zero)... | def list_input():
return list(map(int, input().split()))
def map_input():
return map(int, input().split())
def map_string():
return input().split()
n = int(input())
a = list_input()
cur = 0
ans = 0
for i in range(n):
if a[i] == 0:
cur += 1
ans = max(ans, cur + a[i + 1 :].count(1))
... | FUNC_DEF RETURN FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR FUNC_DEF RETURN FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR FUNC_DEF RETURN FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR ASSIGN VAR NUMBER ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR VAR IF VAR VAR NUMBER VAR NU... |
Hideo Kojima has just quit his job at Konami. Now he is going to find a new place to work. Despite being such a well-known person, he still needs a CV to apply for a job.
During all his career Hideo has produced n games. Some of them were successful, some were not. Hideo wants to remove several of them (possibly zero)... | def test(i):
answer = s[:i].count(0) + s[i:].count(1)
return answer
n = int(input())
s = list(map(int, input().split()))
answer = []
for i in range(n + 1):
answer.append(test(i))
print(max(answer)) | FUNC_DEF ASSIGN VAR BIN_OP FUNC_CALL VAR VAR NUMBER FUNC_CALL VAR VAR NUMBER RETURN VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR LIST FOR VAR FUNC_CALL VAR BIN_OP VAR NUMBER EXPR FUNC_CALL VAR FUNC_CALL VAR VAR EXPR FUNC_CALL VAR FUNC_CALL VAR ... |
Hideo Kojima has just quit his job at Konami. Now he is going to find a new place to work. Despite being such a well-known person, he still needs a CV to apply for a job.
During all his career Hideo has produced n games. Some of them were successful, some were not. Hideo wants to remove several of them (possibly zero)... | n = int(input())
a = [int(x) for x in input().split()]
r = 0
for i in range(len(a) + 1):
x = a[:i].count(0)
y = a[i:].count(1)
r = max(r, x + y)
print(r) | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR BIN_OP FUNC_CALL VAR VAR NUMBER ASSIGN VAR FUNC_CALL VAR VAR NUMBER ASSIGN VAR FUNC_CALL VAR VAR NUMBER ASSIGN VAR FUNC_CALL VAR VAR BIN_OP VAR VAR EXPR FUNC_CALL VAR VAR |
Hideo Kojima has just quit his job at Konami. Now he is going to find a new place to work. Despite being such a well-known person, he still needs a CV to apply for a job.
During all his career Hideo has produced n games. Some of them were successful, some were not. Hideo wants to remove several of them (possibly zero)... | N = 107
n = int(input())
a = list(map(int, input().split()))
a.insert(0, 0)
f = [[(0) for j in range(N)] for i in range(N)]
f[0][0] = 0
f[1][0] = 0
f[1][1] = 1
for i in range(2, n + 1):
for j in range(i):
if a[j] == 0 or a[j] == 1 and a[i] == 1:
f[i][i] = max(f[i][i], f[i - 1][j] + 1)
f[... | ASSIGN VAR NUMBER ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR EXPR FUNC_CALL VAR NUMBER NUMBER ASSIGN VAR NUMBER VAR FUNC_CALL VAR VAR VAR FUNC_CALL VAR VAR ASSIGN VAR NUMBER NUMBER NUMBER ASSIGN VAR NUMBER NUMBER NUMBER ASSIGN VAR NUMBER NUMBER NUMBER FOR V... |
Hideo Kojima has just quit his job at Konami. Now he is going to find a new place to work. Despite being such a well-known person, he still needs a CV to apply for a job.
During all his career Hideo has produced n games. Some of them were successful, some were not. Hideo wants to remove several of them (possibly zero)... | import sys
input = sys.stdin.readline
n = int(input())
s = list(map(int, input().split()))
zc, res = [(0) for i in range(105)], 0
for i in range(1, n + 1):
zc[i] = zc[i - 1] + (1 if s[i - 1] == 0 else 0)
for i in range(1, n + 1):
lzc = zc[i - 1]
roc = n - i - (zc[n] - zc[i])
res = max(res, lzc + 1 + ro... | IMPORT ASSIGN VAR VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR VAR NUMBER VAR FUNC_CALL VAR NUMBER NUMBER FOR VAR FUNC_CALL VAR NUMBER BIN_OP VAR NUMBER ASSIGN VAR VAR BIN_OP VAR BIN_OP VAR NUMBER VAR BIN_OP VAR NUMBER NUMBER NUMBER NUMBER FOR ... |
Hideo Kojima has just quit his job at Konami. Now he is going to find a new place to work. Despite being such a well-known person, he still needs a CV to apply for a job.
During all his career Hideo has produced n games. Some of them were successful, some were not. Hideo wants to remove several of them (possibly zero)... | n = int(input())
s = list(map(int, input().split(" ")))
ones = sum(1 for v in s if v == 1)
zeroes = sum(1 for v in s if v == 0)
zero_ones = 0
loss = 0
for i in range(n):
if s[i] == 1:
loss += 1
continue
loss_zeroes = 0
j = i + 1
while j < n:
if s[j] == 0 and s[j - 1] == 1:
... | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR STRING ASSIGN VAR FUNC_CALL VAR NUMBER VAR VAR VAR NUMBER ASSIGN VAR FUNC_CALL VAR NUMBER VAR VAR VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR VAR IF VAR VAR NUMBER VAR NUMBER ASSIGN VAR NUM... |
Hideo Kojima has just quit his job at Konami. Now he is going to find a new place to work. Despite being such a well-known person, he still needs a CV to apply for a job.
During all his career Hideo has produced n games. Some of them were successful, some were not. Hideo wants to remove several of them (possibly zero)... | n = int(input())
line = list(map(int, input().split()))
ans = -1
for i in range(n + 1):
ans1 = 0
for j in range(n):
if j < i and line[j] == 0:
ans1 += 1
elif j >= i and line[j] == 1:
ans1 += 1
ans = max(ans, ans1)
print(ans) | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR BIN_OP VAR NUMBER ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR VAR IF VAR VAR VAR VAR NUMBER VAR NUMBER IF VAR VAR VAR VAR NUMBER VAR NUMBER ASSIGN VAR FUNC_CALL VAR VAR VAR EXPR ... |
Hideo Kojima has just quit his job at Konami. Now he is going to find a new place to work. Despite being such a well-known person, he still needs a CV to apply for a job.
During all his career Hideo has produced n games. Some of them were successful, some were not. Hideo wants to remove several of them (possibly zero)... | n = input()
a = [int(x) for x in input().split()]
sum0 = 0
sum1 = 0
for i in a:
if i == 1:
sum1 = max(sum1 + 1, sum0 + 1)
else:
sum0 = sum0 + 1
print(max(sum1, sum0)) | ASSIGN VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR NUMBER ASSIGN VAR NUMBER FOR VAR VAR IF VAR NUMBER ASSIGN VAR FUNC_CALL VAR BIN_OP VAR NUMBER BIN_OP VAR NUMBER ASSIGN VAR BIN_OP VAR NUMBER EXPR FUNC_CALL VAR FUNC_CALL VAR VAR VAR |
Hideo Kojima has just quit his job at Konami. Now he is going to find a new place to work. Despite being such a well-known person, he still needs a CV to apply for a job.
During all his career Hideo has produced n games. Some of them were successful, some were not. Hideo wants to remove several of them (possibly zero)... | n = int(input())
l = input().split()
z, o = 1, l.count("1")
maxi = max(o, n - o)
for i in l:
if i == "1":
o -= 1
if o + z > maxi:
maxi = o + z
else:
z += 1
print(maxi) | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR VAR NUMBER FUNC_CALL VAR STRING ASSIGN VAR FUNC_CALL VAR VAR BIN_OP VAR VAR FOR VAR VAR IF VAR STRING VAR NUMBER IF BIN_OP VAR VAR VAR ASSIGN VAR BIN_OP VAR VAR VAR NUMBER EXPR FUNC_CALL VAR VAR |
Hideo Kojima has just quit his job at Konami. Now he is going to find a new place to work. Despite being such a well-known person, he still needs a CV to apply for a job.
During all his career Hideo has produced n games. Some of them were successful, some were not. Hideo wants to remove several of them (possibly zero)... | n = int(input())
a = list(map(int, input().split()))
one = []
zero = 0
for i in range(n):
if a[i] == 1:
one.append(i)
else:
zero += 1
if len(one) == 0:
print(zero)
else:
num = zero
for i in range(len(one)):
pre0 = 0
suf0 = 0
tmp1 = 0
for j in range(n):... | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR LIST ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR VAR IF VAR VAR NUMBER EXPR FUNC_CALL VAR VAR VAR NUMBER IF FUNC_CALL VAR VAR NUMBER EXPR FUNC_CALL VAR VAR ASSIGN VAR VAR FOR VAR FUNC_CALL VAR FUNC_CALL VAR ... |
Hideo Kojima has just quit his job at Konami. Now he is going to find a new place to work. Despite being such a well-known person, he still needs a CV to apply for a job.
During all his career Hideo has produced n games. Some of them were successful, some were not. Hideo wants to remove several of them (possibly zero)... | n = int(input())
a = list(map(int, input().split()))
max_l = 0
z, o = 0, 0
for i in range(n):
o = 0
if a[i] == 0:
z += 1
for j in range(i, n):
if a[j] == 1:
o += 1
max_l = max(max_l, z + o)
print(max_l) | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR NUMBER ASSIGN VAR VAR NUMBER NUMBER FOR VAR FUNC_CALL VAR VAR ASSIGN VAR NUMBER IF VAR VAR NUMBER VAR NUMBER FOR VAR FUNC_CALL VAR VAR VAR IF VAR VAR NUMBER VAR NUMBER ASSIGN VAR FUNC_CALL VAR VAR BIN_OP... |
Hideo Kojima has just quit his job at Konami. Now he is going to find a new place to work. Despite being such a well-known person, he still needs a CV to apply for a job.
During all his career Hideo has produced n games. Some of them were successful, some were not. Hideo wants to remove several of them (possibly zero)... | n = int(input())
s = [0] + list(map(int, input().split()))
a, b = [0] * (n + 1), [0] * (n + 2)
for i in range(n):
a[i + 1] = a[i] if s[i + 1] else a[i] + 1
b[n - i] = b[n - i + 1] + 1 if s[n - i] else b[n - i + 1]
ans = 0
for i in range(n + 1):
ans = max(ans, a[i] + b[i + 1])
print(ans) | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR BIN_OP LIST NUMBER FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR VAR BIN_OP LIST NUMBER BIN_OP VAR NUMBER BIN_OP LIST NUMBER BIN_OP VAR NUMBER FOR VAR FUNC_CALL VAR VAR ASSIGN VAR BIN_OP VAR NUMBER VAR BIN_OP VAR NUMBER VAR VAR BIN_OP VAR VAR NUMBER... |
Hideo Kojima has just quit his job at Konami. Now he is going to find a new place to work. Despite being such a well-known person, he still needs a CV to apply for a job.
During all his career Hideo has produced n games. Some of them were successful, some were not. Hideo wants to remove several of them (possibly zero)... | n = int(input())
games = list(map(int, input().split()))
after = [0] * n
if games[-1] == 1:
after[-1] = 1
else:
after[-1] = 0
for i in range(n - 2, -1, -1):
if games[i] == 1:
after[i] = after[i + 1] + 1
else:
after[i] = after[i + 1]
curnull = 0
ans = 0
for i in range(n):
if games[i] ... | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR BIN_OP LIST NUMBER VAR IF VAR NUMBER NUMBER ASSIGN VAR NUMBER NUMBER ASSIGN VAR NUMBER NUMBER FOR VAR FUNC_CALL VAR BIN_OP VAR NUMBER NUMBER NUMBER IF VAR VAR NUMBER ASSIGN VAR VAR BIN_OP VAR BIN_OP VAR ... |
Hideo Kojima has just quit his job at Konami. Now he is going to find a new place to work. Despite being such a well-known person, he still needs a CV to apply for a job.
During all his career Hideo has produced n games. Some of them were successful, some were not. Hideo wants to remove several of them (possibly zero)... | n = int(input())
a = [int(i) for i in input().split()]
answer = [0] * n
answer[0] = 1
for i in range(1, n):
if a[i] == 1:
answer[i] = max(answer) + 1
else:
temp_max = 0
for j in range(i):
if a[j] == 0 and answer[j] > temp_max:
temp_max = answer[j]
answ... | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR BIN_OP LIST NUMBER VAR ASSIGN VAR NUMBER NUMBER FOR VAR FUNC_CALL VAR NUMBER VAR IF VAR VAR NUMBER ASSIGN VAR VAR BIN_OP FUNC_CALL VAR VAR NUMBER ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR VAR IF VAR VAR NUMBER VAR V... |
Hideo Kojima has just quit his job at Konami. Now he is going to find a new place to work. Despite being such a well-known person, he still needs a CV to apply for a job.
During all his career Hideo has produced n games. Some of them were successful, some were not. Hideo wants to remove several of them (possibly zero)... | N = int(input())
A = list(map(int, input().split()))
ans = sum(1 for x in A if x == 0)
for i in range(N):
if A[i] == 1:
pref = sum(1 for x in A[:i] if x == 0)
suff = sum(1 for x in A[i:] if x == 1)
ans = max(ans, pref + suff)
print(ans) | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR NUMBER VAR VAR VAR NUMBER FOR VAR FUNC_CALL VAR VAR IF VAR VAR NUMBER ASSIGN VAR FUNC_CALL VAR NUMBER VAR VAR VAR VAR NUMBER ASSIGN VAR FUNC_CALL VAR NUMBER VAR VAR VAR VAR NUMBER ASSIGN VA... |
Hideo Kojima has just quit his job at Konami. Now he is going to find a new place to work. Despite being such a well-known person, he still needs a CV to apply for a job.
During all his career Hideo has produced n games. Some of them were successful, some were not. Hideo wants to remove several of them (possibly zero)... | n = int(input())
seq = list(input().split(" "))
totalzeroes = seq.count("0")
ans = totalzeroes
ones, zeroes = 0, 0
for s in seq[::-1]:
if s == "1":
ones += 1
else:
zeroes += 1
ans = max(ans, totalzeroes + ones - zeroes)
print(ans) | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL FUNC_CALL VAR STRING ASSIGN VAR FUNC_CALL VAR STRING ASSIGN VAR VAR ASSIGN VAR VAR NUMBER NUMBER FOR VAR VAR NUMBER IF VAR STRING VAR NUMBER VAR NUMBER ASSIGN VAR FUNC_CALL VAR VAR BIN_OP BIN_OP VAR VAR VAR EXPR FUNC_CALL VAR VAR |
Hideo Kojima has just quit his job at Konami. Now he is going to find a new place to work. Despite being such a well-known person, he still needs a CV to apply for a job.
During all his career Hideo has produced n games. Some of them were successful, some were not. Hideo wants to remove several of them (possibly zero)... | n = int(input())
a = [int(i) for i in input().split()]
ans = 0
for i in range(a.count(0) + 1):
zc = 0
for j in range(n):
if a[j] == 0:
zc += 1
if zc == i:
break
ans = max(ans, i + a[j:].count(1))
print(ans) | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR BIN_OP FUNC_CALL VAR NUMBER NUMBER ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR VAR IF VAR VAR NUMBER VAR NUMBER IF VAR VAR ASSIGN VAR FUNC_CALL VAR VAR BIN_OP VAR FUNC_CALL VAR VAR NUMBER ... |
Hideo Kojima has just quit his job at Konami. Now he is going to find a new place to work. Despite being such a well-known person, he still needs a CV to apply for a job.
During all his career Hideo has produced n games. Some of them were successful, some were not. Hideo wants to remove several of them (possibly zero)... | n = int(input())
s = [int(i) for i in input().split()]
print(max([(s[:i].count(0) + s[i:].count(1)) for i in range(len(s) + 1)])) | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR VAR FUNC_CALL FUNC_CALL VAR EXPR FUNC_CALL VAR FUNC_CALL VAR BIN_OP FUNC_CALL VAR VAR NUMBER FUNC_CALL VAR VAR NUMBER VAR FUNC_CALL VAR BIN_OP FUNC_CALL VAR VAR NUMBER |
Hideo Kojima has just quit his job at Konami. Now he is going to find a new place to work. Despite being such a well-known person, he still needs a CV to apply for a job.
During all his career Hideo has produced n games. Some of them were successful, some were not. Hideo wants to remove several of them (possibly zero)... | n = int(input())
a = list(map(int, input().split()))
res = 0
for i in range(n):
res = max(res, i - sum(a[:i]) + 1 + sum(a[i + 1 :]))
print(res) | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR VAR BIN_OP BIN_OP BIN_OP VAR FUNC_CALL VAR VAR VAR NUMBER FUNC_CALL VAR VAR BIN_OP VAR NUMBER EXPR FUNC_CALL VAR VAR |
Hideo Kojima has just quit his job at Konami. Now he is going to find a new place to work. Despite being such a well-known person, he still needs a CV to apply for a job.
During all his career Hideo has produced n games. Some of them were successful, some were not. Hideo wants to remove several of them (possibly zero)... | n = int(input())
t = -1
an = 0
a = list(map(int, input().split()))
while a.count(1):
an = max(a.index(1) + a.count(1), an)
del a[a.index(1)]
print(max(an, len(a))) | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR WHILE FUNC_CALL VAR NUMBER ASSIGN VAR FUNC_CALL VAR BIN_OP FUNC_CALL VAR NUMBER FUNC_CALL VAR NUMBER VAR VAR FUNC_CALL VAR NUMBER EXPR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL V... |
Hideo Kojima has just quit his job at Konami. Now he is going to find a new place to work. Despite being such a well-known person, he still needs a CV to apply for a job.
During all his career Hideo has produced n games. Some of them were successful, some were not. Hideo wants to remove several of them (possibly zero)... | n = int(input())
projects = input().split(" ")
best = 0
for i in range(len(projects)):
cur = 1
cur += projects[:i].count("0")
cur += projects[i + 1 : n].count("1")
best = max(best, cur)
print(best) | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL FUNC_CALL VAR STRING ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR FUNC_CALL VAR VAR ASSIGN VAR NUMBER VAR FUNC_CALL VAR VAR STRING VAR FUNC_CALL VAR BIN_OP VAR NUMBER VAR STRING ASSIGN VAR FUNC_CALL VAR VAR VAR EXPR FUNC_CALL VAR VAR |
Hideo Kojima has just quit his job at Konami. Now he is going to find a new place to work. Despite being such a well-known person, he still needs a CV to apply for a job.
During all his career Hideo has produced n games. Some of them were successful, some were not. Hideo wants to remove several of them (possibly zero)... | import sys
sys.setrecursionlimit(100000)
def parser():
while 1:
data = list(input().split(" "))
for number in data:
if len(number) > 0:
yield number
input_parser = parser()
def get_word():
global input_parser
return next(input_parser)
def get_number():
... | IMPORT EXPR FUNC_CALL VAR NUMBER FUNC_DEF WHILE NUMBER ASSIGN VAR FUNC_CALL VAR FUNC_CALL FUNC_CALL VAR STRING FOR VAR VAR IF FUNC_CALL VAR VAR NUMBER EXPR VAR ASSIGN VAR FUNC_CALL VAR FUNC_DEF RETURN FUNC_CALL VAR VAR FUNC_DEF ASSIGN VAR FUNC_CALL VAR RETURN FUNC_CALL VAR VAR VAR RETURN FUNC_CALL VAR VAR ASSIGN VAR NU... |
Hideo Kojima has just quit his job at Konami. Now he is going to find a new place to work. Despite being such a well-known person, he still needs a CV to apply for a job.
During all his career Hideo has produced n games. Some of them were successful, some were not. Hideo wants to remove several of them (possibly zero)... | n = int(input())
s = list(map(int, input().split()))
f0 = [0] * (n + 1)
for i in range(n):
if s[i] == 0:
f0[i] = f0[i - 1] + 1
else:
f0[i] = f0[i - 1]
f1 = [0] * (n + 1)
for i in range(n - 1, -1, -1):
if s[i] == 1:
f1[i] = f1[i + 1] + 1
else:
f1[i] = f1[i + 1]
ans = 0
for... | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR BIN_OP LIST NUMBER BIN_OP VAR NUMBER FOR VAR FUNC_CALL VAR VAR IF VAR VAR NUMBER ASSIGN VAR VAR BIN_OP VAR BIN_OP VAR NUMBER NUMBER ASSIGN VAR VAR VAR BIN_OP VAR NUMBER ASSIGN VAR BIN_OP LIST NUMBER BIN_... |
Hideo Kojima has just quit his job at Konami. Now he is going to find a new place to work. Despite being such a well-known person, he still needs a CV to apply for a job.
During all his career Hideo has produced n games. Some of them were successful, some were not. Hideo wants to remove several of them (possibly zero)... | n = int(input())
def it():
A = list(map(int, input().split()))
A.reverse()
c1 = 0
r0 = len(A) - sum(A)
yield r0
for a in A:
if a == 1:
c1 += 1
yield c1 + r0
else:
r0 -= 1
print(max(it())) | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_DEF ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR EXPR FUNC_CALL VAR ASSIGN VAR NUMBER ASSIGN VAR BIN_OP FUNC_CALL VAR VAR FUNC_CALL VAR VAR EXPR VAR FOR VAR VAR IF VAR NUMBER VAR NUMBER EXPR BIN_OP VAR VAR VAR NUMBER EXPR FUNC_CALL VAR FUNC_CALL VAR FUNC... |
Hideo Kojima has just quit his job at Konami. Now he is going to find a new place to work. Despite being such a well-known person, he still needs a CV to apply for a job.
During all his career Hideo has produced n games. Some of them were successful, some were not. Hideo wants to remove several of them (possibly zero)... | def read_ints():
return [int(i) for i in input().split()]
n = int(input())
s = read_ints()
to_rem = n if sum(s) else 0
for i in range(n):
to_rem = min(to_rem, s[:i].count(1) + (s[i:].count(0) if sum(s[i:]) else 0))
print(n - to_rem) | FUNC_DEF RETURN FUNC_CALL VAR VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR VAR NUMBER FOR VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR VAR BIN_OP FUNC_CALL VAR VAR NUMBER FUNC_CALL VAR VAR VAR FUNC_CALL VAR VAR NUMBER NUMBER EXPR FUNC_CAL... |
Hideo Kojima has just quit his job at Konami. Now he is going to find a new place to work. Despite being such a well-known person, he still needs a CV to apply for a job.
During all his career Hideo has produced n games. Some of them were successful, some were not. Hideo wants to remove several of them (possibly zero)... | n = int(input())
a = [int(i) for i in input().split()]
ans = sum(a)
for i in range(len(a) - 1, -1, -1):
ans = min(ans, len(a) - i - sum(a[i:]) + sum(a[:i]))
print(len(a) - ans) | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR FOR VAR FUNC_CALL VAR BIN_OP FUNC_CALL VAR VAR NUMBER NUMBER NUMBER ASSIGN VAR FUNC_CALL VAR VAR BIN_OP BIN_OP BIN_OP FUNC_CALL VAR VAR VAR FUNC_CALL VAR VAR VAR FUNC_CALL VAR VAR VAR EXPR FUNC_C... |
Hideo Kojima has just quit his job at Konami. Now he is going to find a new place to work. Despite being such a well-known person, he still needs a CV to apply for a job.
During all his career Hideo has produced n games. Some of them were successful, some were not. Hideo wants to remove several of them (possibly zero)... | def procv(s, n):
for i in range(n - 1):
if s[i] == "1":
for j in range(i, n - 1):
if s[j + 1] == "0":
s[j + 1] = "x"
break
f = list(filter(lambda v: v != "x", s))
return len(f)
n = int(input())
s = list(input().split())
print(proc... | FUNC_DEF FOR VAR FUNC_CALL VAR BIN_OP VAR NUMBER IF VAR VAR STRING FOR VAR FUNC_CALL VAR VAR BIN_OP VAR NUMBER IF VAR BIN_OP VAR NUMBER STRING ASSIGN VAR BIN_OP VAR NUMBER STRING ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR STRING VAR RETURN FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VA... |
Hideo Kojima has just quit his job at Konami. Now he is going to find a new place to work. Despite being such a well-known person, he still needs a CV to apply for a job.
During all his career Hideo has produced n games. Some of them were successful, some were not. Hideo wants to remove several of them (possibly zero)... | n = int(input())
m = 0
ls = list(map(int, input().split()))
for i in range(n + 1):
s = 0
for j in range(i):
s += not ls[j]
for j in range(i, n):
s += ls[j]
m = max(s, m)
print(m) | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR NUMBER ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR FOR VAR FUNC_CALL VAR BIN_OP VAR NUMBER ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR VAR VAR VAR VAR FOR VAR FUNC_CALL VAR VAR VAR VAR VAR VAR ASSIGN VAR FUNC_CALL VAR VAR VAR EXPR FUNC_CALL VAR VAR |
Hideo Kojima has just quit his job at Konami. Now he is going to find a new place to work. Despite being such a well-known person, he still needs a CV to apply for a job.
During all his career Hideo has produced n games. Some of them were successful, some were not. Hideo wants to remove several of them (possibly zero)... | n = int(input())
a = list(map(int, input().split()))
l = [(a[i + 1 :].count(0) + a[:i].count(1)) for i in range(n)]
print(n - min(l)) | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR BIN_OP FUNC_CALL VAR BIN_OP VAR NUMBER NUMBER FUNC_CALL VAR VAR NUMBER VAR FUNC_CALL VAR VAR EXPR FUNC_CALL VAR BIN_OP VAR FUNC_CALL VAR VAR |
Hideo Kojima has just quit his job at Konami. Now he is going to find a new place to work. Despite being such a well-known person, he still needs a CV to apply for a job.
During all his career Hideo has produced n games. Some of them were successful, some were not. Hideo wants to remove several of them (possibly zero)... | KoKoKo = int
kudaxKudax = input
kukareku = max
kokokokoko = print
kudkudax = range
kokoko = KoKoKo(kudaxKudax())
ko = [KoKoKo(x) for x in kudaxKudax().split()]
KO = KOKOKO = 0
for kok in kudkudax(kokoko - 1, -1, -1):
KO += ko[kok]
KOKOKO = kukareku(KOKOKO, KO + ko[: kok + 1].count(0))
kokokokoko(KOKOKO) | ASSIGN VAR VAR ASSIGN VAR VAR ASSIGN VAR VAR ASSIGN VAR VAR ASSIGN VAR VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR VAR NUMBER FOR VAR FUNC_CALL VAR BIN_OP VAR NUMBER NUMBER NUMBER VAR VAR VAR ASSIGN VAR FUNC_CALL VAR VAR BIN_OP VAR FUNC_CALL VAR BIN_OP ... |
Hideo Kojima has just quit his job at Konami. Now he is going to find a new place to work. Despite being such a well-known person, he still needs a CV to apply for a job.
During all his career Hideo has produced n games. Some of them were successful, some were not. Hideo wants to remove several of them (possibly zero)... | n = int(input())
data = list(map(int, input().split()))
data2 = [0] * n
data2[0] = data[0]
for i in range(1, n):
if data[i]:
data2[i] = data2[i - 1] + 1
else:
data2[i] = data2[i - 1]
data2 = [0] + data2
ma = -2
for i in range(n + 1):
ma = max(ma, data2[-1] - data2[i] + i - data2[i])
print(ma... | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR BIN_OP LIST NUMBER VAR ASSIGN VAR NUMBER VAR NUMBER FOR VAR FUNC_CALL VAR NUMBER VAR IF VAR VAR ASSIGN VAR VAR BIN_OP VAR BIN_OP VAR NUMBER NUMBER ASSIGN VAR VAR VAR BIN_OP VAR NUMBER ASSIGN VAR BIN_OP L... |
Hideo Kojima has just quit his job at Konami. Now he is going to find a new place to work. Despite being such a well-known person, he still needs a CV to apply for a job.
During all his career Hideo has produced n games. Some of them were successful, some were not. Hideo wants to remove several of them (possibly zero)... | a = int(input())
b = list(map(int, input().split()))
c = []
d = []
count = 0
for i in b:
if i == 0:
count += 1
c.append(count)
count = 0
for i in b[::-1]:
if i == 1:
count += 1
d.append(count)
d = d[::-1]
x = []
for i in range(a):
x.append(c[i] + d[i])
print(max(x)) | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR LIST ASSIGN VAR LIST ASSIGN VAR NUMBER FOR VAR VAR IF VAR NUMBER VAR NUMBER EXPR FUNC_CALL VAR VAR ASSIGN VAR NUMBER FOR VAR VAR NUMBER IF VAR NUMBER VAR NUMBER EXPR FUNC_CALL VAR VAR ASSIGN VAR VAR NUMB... |
Hideo Kojima has just quit his job at Konami. Now he is going to find a new place to work. Despite being such a well-known person, he still needs a CV to apply for a job.
During all his career Hideo has produced n games. Some of them were successful, some were not. Hideo wants to remove several of them (possibly zero)... | from sys import stdin, stdout
n = int(stdin.readline())
values = list(map(int, stdin.readline().split()))
dp = [[0, 0] for i in range(n)]
for i in range(n):
if not values[i]:
dp[i][0] = 1
for j in range(i - 1, -1, -1):
dp[i][0] = max(dp[i][0], dp[j][0] + 1)
else:
dp[i][1] = ... | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR LIST NUMBER NUMBER VAR FUNC_CALL VAR VAR FOR VAR FUNC_CALL VAR VAR IF VAR VAR ASSIGN VAR VAR NUMBER NUMBER FOR VAR FUNC_CALL VAR BIN_OP VAR NUMBER NUMBER NUMBER ASSIGN VAR VAR NUMBER FUNC_CALL VAR VAR VA... |
Hideo Kojima has just quit his job at Konami. Now he is going to find a new place to work. Despite being such a well-known person, he still needs a CV to apply for a job.
During all his career Hideo has produced n games. Some of them were successful, some were not. Hideo wants to remove several of them (possibly zero)... | import sys
cases = sys.stdin.readline()
numbers = [int(x) for x in sys.stdin.readline().strip().split(" ")]
my_sum = sum(numbers)
answers = []
ones_so_far = 0
zeroes_so_far = 0
index = 0
for x in numbers:
if x == 1:
ones_so_far += 1
else:
zeroes_so_far += 1
remaining_ones = my_sum - ones_so... | IMPORT ASSIGN VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR VAR FUNC_CALL FUNC_CALL FUNC_CALL VAR STRING ASSIGN VAR FUNC_CALL VAR VAR ASSIGN VAR LIST ASSIGN VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR NUMBER FOR VAR VAR IF VAR NUMBER VAR NUMBER VAR NUMBER ASSIGN VAR BIN_OP VAR VAR ASSIGN VAR BIN_OP BIN_OP BIN_OP FUNC_CALL... |
Hideo Kojima has just quit his job at Konami. Now he is going to find a new place to work. Despite being such a well-known person, he still needs a CV to apply for a job.
During all his career Hideo has produced n games. Some of them were successful, some were not. Hideo wants to remove several of them (possibly zero)... | n = int(input())
a = list(map(int, input().split()))
p = [0] * n
p[0] = a[0]
for i in range(1, n):
p[i] = p[i - 1] + a[i]
ans = min(n, n - p[n - 1])
for i in range(n):
l = p[i]
r = n - i - 1 - (p[n - 1] - p[i])
ans = min(ans, l + r)
print(n - ans) | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR BIN_OP LIST NUMBER VAR ASSIGN VAR NUMBER VAR NUMBER FOR VAR FUNC_CALL VAR NUMBER VAR ASSIGN VAR VAR BIN_OP VAR BIN_OP VAR NUMBER VAR VAR ASSIGN VAR FUNC_CALL VAR VAR BIN_OP VAR VAR BIN_OP VAR NUMBER FOR ... |
Hideo Kojima has just quit his job at Konami. Now he is going to find a new place to work. Despite being such a well-known person, he still needs a CV to apply for a job.
During all his career Hideo has produced n games. Some of them were successful, some were not. Hideo wants to remove several of them (possibly zero)... | input()
a = list(map(int, input().split()))
f = 0
for i in range(len(a)):
s = 0
for j in range(len(a)):
if j <= i:
if a[j] == 0:
s += 1
if j >= i:
if a[j] == 1:
s += 1
if s > f:
f = s
print(f) | EXPR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR FUNC_CALL VAR VAR ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR FUNC_CALL VAR VAR IF VAR VAR IF VAR VAR NUMBER VAR NUMBER IF VAR VAR IF VAR VAR NUMBER VAR NUMBER IF VAR VAR ASSIGN VAR VAR EXPR FUNC_CA... |
Hideo Kojima has just quit his job at Konami. Now he is going to find a new place to work. Despite being such a well-known person, he still needs a CV to apply for a job.
During all his career Hideo has produced n games. Some of them were successful, some were not. Hideo wants to remove several of them (possibly zero)... | length = int(input())
array = list(map(int, input().split()))
count = []
total = 0
for k in range(length):
if array[length - 1 - k] == 1:
total += 1
count.append(total)
count.reverse()
total = 0
maximum = 0
for k in range(length):
if array[k] == 0:
total += 1
maximum = max(maximum, total... | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR LIST ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR VAR IF VAR BIN_OP BIN_OP VAR NUMBER VAR NUMBER VAR NUMBER EXPR FUNC_CALL VAR VAR EXPR FUNC_CALL VAR ASSIGN VAR NUMBER ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR ... |
Hideo Kojima has just quit his job at Konami. Now he is going to find a new place to work. Despite being such a well-known person, he still needs a CV to apply for a job.
During all his career Hideo has produced n games. Some of them were successful, some were not. Hideo wants to remove several of them (possibly zero)... | n = int(input())
nums = list(map(int, input().split()))
result = -1
for l in range(n):
r = l + 1
tempresult = nums[: l + 1].count(0) + nums[r:].count(1)
result = max(result, tempresult)
result = max(result, nums.count(1))
result = max(result, nums.count(0))
print(result) | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR VAR ASSIGN VAR BIN_OP VAR NUMBER ASSIGN VAR BIN_OP FUNC_CALL VAR BIN_OP VAR NUMBER NUMBER FUNC_CALL VAR VAR NUMBER ASSIGN VAR FUNC_CALL VAR VAR VAR ASSIGN VAR FUNC_CALL VAR V... |
Hideo Kojima has just quit his job at Konami. Now he is going to find a new place to work. Despite being such a well-known person, he still needs a CV to apply for a job.
During all his career Hideo has produced n games. Some of them were successful, some were not. Hideo wants to remove several of them (possibly zero)... | n = int(input())
l = list(map(int, input().split()))
max_games = [(1) for i in range(n)]
if n > 1:
if l[1] == 0:
if l[0] == 1:
max_games[1] = 1
else:
max_games[1] = 2
else:
max_games[1] = 2
t_max = max(max_games)
if n > 2:
for i in range(2, n):
if l[i]... | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR NUMBER VAR FUNC_CALL VAR VAR IF VAR NUMBER IF VAR NUMBER NUMBER IF VAR NUMBER NUMBER ASSIGN VAR NUMBER NUMBER ASSIGN VAR NUMBER NUMBER ASSIGN VAR NUMBER NUMBER ASSIGN VAR FUNC_CALL VAR VAR IF VAR NUMBER ... |
Hideo Kojima has just quit his job at Konami. Now he is going to find a new place to work. Despite being such a well-known person, he still needs a CV to apply for a job.
During all his career Hideo has produced n games. Some of them were successful, some were not. Hideo wants to remove several of them (possibly zero)... | n = int(input())
p = list(map(int, input().split()))
ind_z = []
ind_o = []
for i in range(n):
if p[i] == 0:
ind_z.append(i)
else:
ind_o.append(i)
z = [0] * len(ind_z)
o = [0] * len(ind_o)
for i in range(len(z)):
z[i] = i + 1
for j in range(ind_z[i], n):
if p[j] == 1:
... | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR LIST ASSIGN VAR LIST FOR VAR FUNC_CALL VAR VAR IF VAR VAR NUMBER EXPR FUNC_CALL VAR VAR EXPR FUNC_CALL VAR VAR ASSIGN VAR BIN_OP LIST NUMBER FUNC_CALL VAR VAR ASSIGN VAR BIN_OP LIST NUMBER FUNC_CALL VAR ... |
Hideo Kojima has just quit his job at Konami. Now he is going to find a new place to work. Despite being such a well-known person, he still needs a CV to apply for a job.
During all his career Hideo has produced n games. Some of them were successful, some were not. Hideo wants to remove several of them (possibly zero)... | a = int(input())
b = input().split()
zerocount = 0
zero = []
onecount = 0
one = []
maxi = 0
for i in range(a):
if b[i] == "0":
zerocount += 1
zero.append(zerocount)
for i in range(a - 1, -1, -1):
if b[i] == "1":
onecount += 1
one.append(onecount)
one.reverse()
if maxi < one[0]:
maxi ... | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR NUMBER ASSIGN VAR LIST ASSIGN VAR NUMBER ASSIGN VAR LIST ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR VAR IF VAR VAR STRING VAR NUMBER EXPR FUNC_CALL VAR VAR FOR VAR FUNC_CALL VAR BIN_OP VAR NUMBER NUMBER NUMBER IF VAR VAR STRING VAR NUMBER... |
Hideo Kojima has just quit his job at Konami. Now he is going to find a new place to work. Despite being such a well-known person, he still needs a CV to apply for a job.
During all his career Hideo has produced n games. Some of them were successful, some were not. Hideo wants to remove several of them (possibly zero)... | n = int(input())
m = list(map(int, input().split()))
x = m.count(0)
y = n - x
a = 0
b = 0
l = max(x, y)
for i in range(n):
if m[i] == 1:
a += 1
c = []
d = 0
e = 0
for j in range(i + 1):
if m[j] == 1:
d += 1
else:
e += 1
... | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR NUMBER ASSIGN VAR BIN_OP VAR VAR ASSIGN VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR FUNC_CALL VAR VAR VAR FOR VAR FUNC_CALL VAR VAR IF VAR VAR NUMBER VAR NUMBER ASSIGN VAR LIST ASSIGN VAR NUMBE... |
Hideo Kojima has just quit his job at Konami. Now he is going to find a new place to work. Despite being such a well-known person, he still needs a CV to apply for a job.
During all his career Hideo has produced n games. Some of them were successful, some were not. Hideo wants to remove several of them (possibly zero)... | n = int(input())
a = [int(x) for x in input().split(" ")]
case1 = 0
for i in range(n):
if a[i] == 0:
case1 += 1
case2 = 0
for i in range(n):
if a[i] == 1:
case2 += 1
final = max(case1, case2)
for i in range(n - 1):
result = 0
s1 = a[: i + 1]
s2 = a[i + 1 :]
for j in s1:
i... | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR VAR FUNC_CALL FUNC_CALL VAR STRING ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR VAR IF VAR VAR NUMBER VAR NUMBER ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR VAR IF VAR VAR NUMBER VAR NUMBER ASSIGN VAR FUNC_CALL VAR VAR VAR FOR VAR FUNC_CALL VAR BIN_OP VAR NUMBE... |
Hideo Kojima has just quit his job at Konami. Now he is going to find a new place to work. Despite being such a well-known person, he still needs a CV to apply for a job.
During all his career Hideo has produced n games. Some of them were successful, some were not. Hideo wants to remove several of them (possibly zero)... | def rezume(lst):
ones, zeros = 0, 0
l, r = [0] * len(lst), [0] * len(lst)
result = 0
for i in range(len(lst)):
l[i] = ones
if lst[i]:
ones += 1
r[len(lst) - i - 1] = zeros
if not lst[len(lst) - i - 1]:
zeros += 1
for i in range(len(lst)):
... | FUNC_DEF ASSIGN VAR VAR NUMBER NUMBER ASSIGN VAR VAR BIN_OP LIST NUMBER FUNC_CALL VAR VAR BIN_OP LIST NUMBER FUNC_CALL VAR VAR ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR FUNC_CALL VAR VAR ASSIGN VAR VAR VAR IF VAR VAR VAR NUMBER ASSIGN VAR BIN_OP BIN_OP FUNC_CALL VAR VAR VAR NUMBER VAR IF VAR BIN_OP BIN_OP FUNC_CALL VAR V... |
Hideo Kojima has just quit his job at Konami. Now he is going to find a new place to work. Despite being such a well-known person, he still needs a CV to apply for a job.
During all his career Hideo has produced n games. Some of them were successful, some were not. Hideo wants to remove several of them (possibly zero)... | n = int(input())
m = list(map(int, input().split()))
maxi = 0
for i in range(n + 1):
cur = m[:i].count(0) + m[i:].count(1)
if cur > maxi:
maxi = cur
print(maxi) | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR BIN_OP VAR NUMBER ASSIGN VAR BIN_OP FUNC_CALL VAR VAR NUMBER FUNC_CALL VAR VAR NUMBER IF VAR VAR ASSIGN VAR VAR EXPR FUNC_CALL VAR VAR |
Hideo Kojima has just quit his job at Konami. Now he is going to find a new place to work. Despite being such a well-known person, he still needs a CV to apply for a job.
During all his career Hideo has produced n games. Some of them were successful, some were not. Hideo wants to remove several of them (possibly zero)... | def main():
n = int(input())
a = list(map(int, input().split()))
ans = max(sum(a), n - sum(a))
for i in range(n):
ans = max(ans, sum(a[i:]) + i - sum(a[:i]))
print(ans)
main() | FUNC_DEF ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR BIN_OP VAR FUNC_CALL VAR VAR FOR VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR VAR BIN_OP BIN_OP FUNC_CALL VAR VAR VAR VAR FUNC_CALL VAR VAR VAR EXPR FUNC_CALL V... |
Hideo Kojima has just quit his job at Konami. Now he is going to find a new place to work. Despite being such a well-known person, he still needs a CV to apply for a job.
During all his career Hideo has produced n games. Some of them were successful, some were not. Hideo wants to remove several of them (possibly zero)... | a = int(input())
b = [int(i) for i in input().split()]
c = b.copy()
ans = 0
for i in range(a):
if b[i] == 1:
ans += b[i:].count(1)
break
ans += 1
ans1 = 0
for i in range(a):
if b[i] == 1:
ans1 = max(ans1, b[:i].count(0) + b[i:a].count(1))
print(max(ans, ans1, b.count(0), b.count(1))) | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR VAR IF VAR VAR NUMBER VAR FUNC_CALL VAR VAR NUMBER VAR NUMBER ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR VAR IF VAR VAR NUMBER ASSIGN VAR FUNC_CALL VAR VAR BIN_OP... |
Hideo Kojima has just quit his job at Konami. Now he is going to find a new place to work. Despite being such a well-known person, he still needs a CV to apply for a job.
During all his career Hideo has produced n games. Some of them were successful, some were not. Hideo wants to remove several of them (possibly zero)... | n = int(input())
A = input().split()
count_0 = 0
count_1 = 0
i = 0
if n == 1:
print(n)
else:
for i in range(0, n):
if A[i] == "0":
count_0 += 1
if A[i] == "1":
count_1 += 1
maxm = max(count_0, count_1)
for i in range(0, n):
max_now = 0
for j in ran... | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR NUMBER IF VAR NUMBER EXPR FUNC_CALL VAR VAR FOR VAR FUNC_CALL VAR NUMBER VAR IF VAR VAR STRING VAR NUMBER IF VAR VAR STRING VAR NUMBER ASSIGN VAR FUNC_CALL VAR VAR VAR FOR VAR FUNC_CALL VAR NUMBER VA... |
Hideo Kojima has just quit his job at Konami. Now he is going to find a new place to work. Despite being such a well-known person, he still needs a CV to apply for a job.
During all his career Hideo has produced n games. Some of them were successful, some were not. Hideo wants to remove several of them (possibly zero)... | n = int(input())
games = list(map(int, input().split()))
strike = [0] * n
for i in range(n):
strike[i] = 1
for j in range(i):
if games[j] <= games[i]:
strike[i] = max(strike[i], strike[j] + 1)
print(max(strike)) | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR BIN_OP LIST NUMBER VAR FOR VAR FUNC_CALL VAR VAR ASSIGN VAR VAR NUMBER FOR VAR FUNC_CALL VAR VAR IF VAR VAR VAR VAR ASSIGN VAR VAR FUNC_CALL VAR VAR VAR BIN_OP VAR VAR NUMBER EXPR FUNC_CALL VAR FUNC_CALL... |
Hideo Kojima has just quit his job at Konami. Now he is going to find a new place to work. Despite being such a well-known person, he still needs a CV to apply for a job.
During all his career Hideo has produced n games. Some of them were successful, some were not. Hideo wants to remove several of them (possibly zero)... | INF = 10**9 + 7
def cutoff(games, pos):
leave = 0
for i, g in enumerate(games):
if i < pos:
if g == 0:
leave += 1
elif g == 1:
leave += 1
return leave
def main():
n = int(input())
games = [int(x) for x in input().split()]
max_leave = -I... | ASSIGN VAR BIN_OP BIN_OP NUMBER NUMBER NUMBER FUNC_DEF ASSIGN VAR NUMBER FOR VAR VAR FUNC_CALL VAR VAR IF VAR VAR IF VAR NUMBER VAR NUMBER IF VAR NUMBER VAR NUMBER RETURN VAR FUNC_DEF ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR VAR FOR VAR FUNC_CALL VAR BIN... |
Hideo Kojima has just quit his job at Konami. Now he is going to find a new place to work. Despite being such a well-known person, he still needs a CV to apply for a job.
During all his career Hideo has produced n games. Some of them were successful, some were not. Hideo wants to remove several of them (possibly zero)... | n = int(input())
arr = list(map(int, input().split()))
pref1 = [0]
for i in arr:
pref1.append(pref1[-1] + i)
suf0 = [0]
for i in arr[::-1]:
suf0.append(suf0[-1] + (i + 1) % 2)
ans = []
for i in range(n + 1):
ans.append(n - (suf0[::-1][i] + pref1[i]))
print(max(ans)) | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR LIST NUMBER FOR VAR VAR EXPR FUNC_CALL VAR BIN_OP VAR NUMBER VAR ASSIGN VAR LIST NUMBER FOR VAR VAR NUMBER EXPR FUNC_CALL VAR BIN_OP VAR NUMBER BIN_OP BIN_OP VAR NUMBER NUMBER ASSIGN VAR LIST FOR VAR FUN... |
Hideo Kojima has just quit his job at Konami. Now he is going to find a new place to work. Despite being such a well-known person, he still needs a CV to apply for a job.
During all his career Hideo has produced n games. Some of them were successful, some were not. Hideo wants to remove several of them (possibly zero)... | n = int(input())
s = list(map(int, input().split()))
ans = 0
x0 = 0
x1 = 0
for i in range(n):
if s[i] == 1:
x1 = max(x0, x1) + 1
else:
x0 = x0 + 1
ans = max(x0, x1)
print(ans) | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR VAR IF VAR VAR NUMBER ASSIGN VAR BIN_OP FUNC_CALL VAR VAR VAR NUMBER ASSIGN VAR BIN_OP VAR NUMBER ASSIGN VAR FUNC_CALL VAR VAR VAR EXPR FU... |
Hideo Kojima has just quit his job at Konami. Now he is going to find a new place to work. Despite being such a well-known person, he still needs a CV to apply for a job.
During all his career Hideo has produced n games. Some of them were successful, some were not. Hideo wants to remove several of them (possibly zero)... | n = int(input())
arr = input()
arr = arr.split(" ")
arr = list(map(int, arr))
maxi = -1
ones = list(range(n + 1))
ones[n] = 0
for j in range(1, n):
if arr[n - j] == 1:
ones[n - j] = ones[n - j + 1] + 1
else:
ones[n - j] = ones[n - j + 1]
if arr[0] == 1:
ones[0] = ones[1] + 1
else:
ones[0... | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR STRING ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR VAR ASSIGN VAR NUMBER ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR BIN_OP VAR NUMBER ASSIGN VAR VAR NUMBER FOR VAR FUNC_CALL VAR NUMBER VAR IF VAR BIN_OP VAR VAR NUMBER ASSIGN VAR BIN_OP ... |
Hideo Kojima has just quit his job at Konami. Now he is going to find a new place to work. Despite being such a well-known person, he still needs a CV to apply for a job.
During all his career Hideo has produced n games. Some of them were successful, some were not. Hideo wants to remove several of them (possibly zero)... | n = int(input())
s = list(map(int, input().split()))
c = []
t = 0
while s[t] == 0 and t < n - 1:
t += 1
for i in range(t, n):
if s[i] == 1:
k = 0
for j in range(i):
if s[j] == 1:
k += 1
for j in range(i + 1, n):
if s[j] == 0:
k += 1... | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR LIST ASSIGN VAR NUMBER WHILE VAR VAR NUMBER VAR BIN_OP VAR NUMBER VAR NUMBER FOR VAR FUNC_CALL VAR VAR VAR IF VAR VAR NUMBER ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR VAR IF VAR VAR NUMBER VAR NUMBER FOR V... |
Hideo Kojima has just quit his job at Konami. Now he is going to find a new place to work. Despite being such a well-known person, he still needs a CV to apply for a job.
During all his career Hideo has produced n games. Some of them were successful, some were not. Hideo wants to remove several of them (possibly zero)... | n = int(input())
string = "".join(map(str, input().split()))
maxx = 0
for i in range(n + 1):
maxx = max(maxx, string[:i].count("0") + string[i:].count("1"))
print(maxx) | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL STRING FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR BIN_OP VAR NUMBER ASSIGN VAR FUNC_CALL VAR VAR BIN_OP FUNC_CALL VAR VAR STRING FUNC_CALL VAR VAR STRING EXPR FUNC_CALL VAR VAR |
Hideo Kojima has just quit his job at Konami. Now he is going to find a new place to work. Despite being such a well-known person, he still needs a CV to apply for a job.
During all his career Hideo has produced n games. Some of them were successful, some were not. Hideo wants to remove several of them (possibly zero)... | n = int(input())
lis = [int(e) for e in input().split()]
ct = []
c0 = 0
c1 = 0
for i in range(len(lis)):
if lis[i] == 0:
c0 += 1
if lis[i] == 1:
c1 += 1
ct.append(c0)
ct.append(c1)
for i in range(1, len(lis)):
c0 = 0
c1 = 0
for j in range(i - 1, -1, -1):
if lis[j] == 0:
... | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR LIST ASSIGN VAR NUMBER ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR FUNC_CALL VAR VAR IF VAR VAR NUMBER VAR NUMBER IF VAR VAR NUMBER VAR NUMBER EXPR FUNC_CALL VAR VAR EXPR FUNC_CALL VAR VAR FOR VAR FUNC_CALL VAR NUMBER... |
Hideo Kojima has just quit his job at Konami. Now he is going to find a new place to work. Despite being such a well-known person, he still needs a CV to apply for a job.
During all his career Hideo has produced n games. Some of them were successful, some were not. Hideo wants to remove several of them (possibly zero)... | def main():
n = int(input())
games = list(map(int, input().split(" ")))
result = max([(games[:i].count(0) + games[i:].count(1)) for i in range(n + 1)])
print(result)
main() | FUNC_DEF ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR STRING ASSIGN VAR FUNC_CALL VAR BIN_OP FUNC_CALL VAR VAR NUMBER FUNC_CALL VAR VAR NUMBER VAR FUNC_CALL VAR BIN_OP VAR NUMBER EXPR FUNC_CALL VAR VAR EXPR FUNC_CALL VAR |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.