description
stringlengths
171
4k
code
stringlengths
94
3.98k
normalized_code
stringlengths
57
4.99k
You are given an array $a$ consisting of $n$ integers. You can remove at most one element from this array. Thus, the final length of the array is $n-1$ or $n$. Your task is to calculate the maximum possible length of the strictly increasing contiguous subarray of the remaining array. Recall that the contiguous subar...
n = int(input()) A = list(map(int, input().strip().split())) L = [1] * len(A) R = [1] * len(A) Ans = [1] * len(A) for i in range(1, len(A)): if A[i] > A[i - 1]: L[i] = L[i] + L[i - 1] for i in range(len(A) - 1, 0, -1): if A[i - 1] < A[i]: R[i - 1] = R[i - 1] + R[i] Ans[-1] = L[-1] for i in range...
ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL FUNC_CALL VAR ASSIGN VAR BIN_OP LIST NUMBER FUNC_CALL VAR VAR ASSIGN VAR BIN_OP LIST NUMBER FUNC_CALL VAR VAR ASSIGN VAR BIN_OP LIST NUMBER FUNC_CALL VAR VAR FOR VAR FUNC_CALL VAR NUMBER FUNC_CALL VAR VAR IF VAR VAR VA...
You are given an array $a$ consisting of $n$ integers. You can remove at most one element from this array. Thus, the final length of the array is $n-1$ or $n$. Your task is to calculate the maximum possible length of the strictly increasing contiguous subarray of the remaining array. Recall that the contiguous subar...
n = int(input()) f = input().split(" ") a = [int(f[i]) for i in range(0, n)] pred = [0] * n suc = [0] * n ans = 0 pred[0] = 1 for i in range(1, n): if a[i] > a[i - 1]: pred[i] = pred[i - 1] + 1 else: pred[i] = 1 ans = max(ans, pred[i]) suc[n - 1] = 1 i = n - 2 while i >= 0: if a[i + 1] >...
ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL FUNC_CALL VAR STRING ASSIGN VAR FUNC_CALL VAR VAR VAR VAR FUNC_CALL VAR NUMBER VAR ASSIGN VAR BIN_OP LIST NUMBER VAR ASSIGN VAR BIN_OP LIST NUMBER VAR ASSIGN VAR NUMBER ASSIGN VAR NUMBER NUMBER FOR VAR FUNC_CALL VAR NUMBER VAR IF VAR VAR VAR BIN_OP VAR NUMBER ...
You are given an array $a$ consisting of $n$ integers. You can remove at most one element from this array. Thus, the final length of the array is $n-1$ or $n$. Your task is to calculate the maximum possible length of the strictly increasing contiguous subarray of the remaining array. Recall that the contiguous subar...
n = int(input()) a = list(map(int, input().split())) segs = [[a[0]]] for i in range(1, n): if segs[-1][-1] < a[i]: segs[-1].append(a[i]) else: segs.append([a[i]]) ret = len(segs[0]) for i in range(1, len(segs)): prev, cur = segs[i - 1], segs[i] ret = max(ret, len(cur)) if len(cur) > ...
ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR LIST LIST VAR NUMBER FOR VAR FUNC_CALL VAR NUMBER VAR IF VAR NUMBER NUMBER VAR VAR EXPR FUNC_CALL VAR NUMBER VAR VAR EXPR FUNC_CALL VAR LIST VAR VAR ASSIGN VAR FUNC_CALL VAR VAR NUMBER FOR VAR FUNC_CALL ...
You are given an array $a$ consisting of $n$ integers. You can remove at most one element from this array. Thus, the final length of the array is $n-1$ or $n$. Your task is to calculate the maximum possible length of the strictly increasing contiguous subarray of the remaining array. Recall that the contiguous subar...
n = int(input()) a = [int(x) for x in input().split()] i = 1 d = [] maxi = 0 while i < n: c = 1 j = i while i < n and a[i] > a[i - 1]: i += 1 c += 1 d.append([c, j, i]) i += 1 maxi = max(maxi, d[-1][0]) for i in range(len(d) - 1): if ( a[d[i][2] - 2] < a[d[i + 1][1] -...
ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR NUMBER ASSIGN VAR LIST ASSIGN VAR NUMBER WHILE VAR VAR ASSIGN VAR NUMBER ASSIGN VAR VAR WHILE VAR VAR VAR VAR VAR BIN_OP VAR NUMBER VAR NUMBER VAR NUMBER EXPR FUNC_CALL VAR LIST VAR VAR VAR VAR NUMBER ASSIGN VAR F...
You are given an array $a$ consisting of $n$ integers. You can remove at most one element from this array. Thus, the final length of the array is $n-1$ or $n$. Your task is to calculate the maximum possible length of the strictly increasing contiguous subarray of the remaining array. Recall that the contiguous subar...
n = int(input()) a = [int(x) for x in input().split()] end = [0] * n beg = [0] * n for i in range(n): if i > 0 and a[i] > a[i - 1]: end[i] = end[i - 1] + 1 else: end[i] = 1 for i in reversed(range(n)): if i < n - 1 and a[i] < a[i + 1]: beg[i] = beg[i + 1] + 1 else: beg[i]...
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 BIN_OP LIST NUMBER VAR FOR VAR FUNC_CALL VAR VAR IF VAR NUMBER VAR VAR VAR BIN_OP VAR NUMBER ASSIGN VAR VAR BIN_OP VAR BIN_OP VAR NUMBER NUMBER ASSIGN VAR VAR NUMBER FOR VAR FUNC_...
You are given an array $a$ consisting of $n$ integers. You can remove at most one element from this array. Thus, the final length of the array is $n-1$ or $n$. Your task is to calculate the maximum possible length of the strictly increasing contiguous subarray of the remaining array. Recall that the contiguous subar...
N = int(input()) a = list(map(int, input().split())) dp_l = [0] * N dp_r = [0] * N for i in range(N): if a[i] > a[i - 1]: dp_l[i] = dp_l[i - 1] + 1 else: dp_l[i] = 1 dp_r[-1] = 1 for i in range(N - 2, -1, -1): if a[i] < a[i + 1]: dp_r[i] = dp_r[i + 1] + 1 else: dp_r[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 ASSIGN VAR BIN_OP LIST NUMBER VAR FOR VAR FUNC_CALL VAR VAR IF VAR VAR VAR BIN_OP VAR NUMBER ASSIGN VAR VAR BIN_OP VAR BIN_OP VAR NUMBER NUMBER ASSIGN VAR VAR NUMBER ASSIGN VAR NUM...
You are given an array $a$ consisting of $n$ integers. You can remove at most one element from this array. Thus, the final length of the array is $n-1$ or $n$. Your task is to calculate the maximum possible length of the strictly increasing contiguous subarray of the remaining array. Recall that the contiguous subar...
n = int(input()) arr = [int(i) for i in input().split()] def maxsub(a): inc = [[a[0]]] for x in a[1:]: if x > inc[-1][-1]: inc[-1].append(x) else: inc.append([x]) l = len(inc) for i in range(l - 1): if len(inc[i + 1]) == 1: if i + 2 < l: ...
ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR VAR FUNC_CALL FUNC_CALL VAR FUNC_DEF ASSIGN VAR LIST LIST VAR NUMBER FOR VAR VAR NUMBER IF VAR VAR NUMBER NUMBER EXPR FUNC_CALL VAR NUMBER VAR EXPR FUNC_CALL VAR LIST VAR ASSIGN VAR FUNC_CALL VAR VAR FOR VAR FUNC_CALL VAR BIN_OP VAR NUMBER IF FUNC_CALL...
You are given an array $a$ consisting of $n$ integers. You can remove at most one element from this array. Thus, the final length of the array is $n-1$ or $n$. Your task is to calculate the maximum possible length of the strictly increasing contiguous subarray of the remaining array. Recall that the contiguous subar...
d0 = [0] * 200010 d1 = [0] * 200010 d2 = [0] * 200010 n = int(input()) v = list(map(int, input().split())) d0[0] = 1 d1[0] = 0 d2[0] = 1 ans = 1 for i in range(1, n): d0[i] = 1 if v[i] > v[i - 1]: d0[i] = d0[i - 1] + 1 d2[i] = d2[i - 1] + 1 d1[i] = d0[i - 1] if i > 1 and v[i] > v[i - 2]:...
ASSIGN VAR BIN_OP LIST NUMBER NUMBER ASSIGN VAR BIN_OP LIST NUMBER NUMBER ASSIGN VAR BIN_OP LIST NUMBER NUMBER ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR NUMBER NUMBER ASSIGN VAR NUMBER NUMBER ASSIGN VAR NUMBER NUMBER ASSIGN VAR NUMBER FOR VAR FU...
You are given an array $a$ consisting of $n$ integers. You can remove at most one element from this array. Thus, the final length of the array is $n-1$ or $n$. Your task is to calculate the maximum possible length of the strictly increasing contiguous subarray of the remaining array. Recall that the contiguous subar...
import sys def rl(): return sys.stdin.readline() def compute(A, N): A.append(0) st = 0 n = A[0] l = [] for i, v in enumerate(A[1:]): if v <= n: l.append((st, i)) st = i + 1 n = v max1 = l[0][1] - l[0][0] + 1 for i in range(1, len(l)): i...
IMPORT FUNC_DEF RETURN FUNC_CALL VAR FUNC_DEF EXPR FUNC_CALL VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR VAR NUMBER ASSIGN VAR LIST FOR VAR VAR FUNC_CALL VAR VAR NUMBER IF VAR VAR EXPR FUNC_CALL VAR VAR VAR ASSIGN VAR BIN_OP VAR NUMBER ASSIGN VAR VAR ASSIGN VAR BIN_OP BIN_OP VAR NUMBER NUMBER VAR NUMBER NUMBER NUMBER FOR V...
You are given an array $a$ consisting of $n$ integers. You can remove at most one element from this array. Thus, the final length of the array is $n-1$ or $n$. Your task is to calculate the maximum possible length of the strictly increasing contiguous subarray of the remaining array. Recall that the contiguous subar...
n = int(input()) a = list(map(int, input().split())) b = [] now = [] prev = 0 ans = 0 for i in range(n): if prev < a[i]: now.append(a[i]) else: b.append(now) ans = max(ans, len(now)) now = [a[i]] prev = a[i] if len(now) != 0: ans = max(ans, len(now)) b.append(now) 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 LIST ASSIGN VAR LIST ASSIGN VAR NUMBER ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR VAR IF VAR VAR VAR EXPR FUNC_CALL VAR VAR VAR EXPR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR VAR FUNC_CALL VAR VAR ASSIGN V...
You are given an array $a$ consisting of $n$ integers. You can remove at most one element from this array. Thus, the final length of the array is $n-1$ or $n$. Your task is to calculate the maximum possible length of the strictly increasing contiguous subarray of the remaining array. Recall that the contiguous subar...
n = int(input()) a = list(map(int, input().split(" "))) listas = [[a[0]]] j = 0 for i in range(0, len(a) - 1): if a[i + 1] > a[i]: listas[j].append(a[i + 1]) else: j += 1 listas.append([]) listas[j].append(a[i + 1]) long = [] for i in range(0, len(listas)): long.append(len(li...
ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR STRING ASSIGN VAR LIST LIST VAR NUMBER ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR NUMBER BIN_OP FUNC_CALL VAR VAR NUMBER IF VAR BIN_OP VAR NUMBER VAR VAR EXPR FUNC_CALL VAR VAR VAR BIN_OP VAR NUMBER VAR NUMBER EXPR FU...
You are given an array $a$ consisting of $n$ integers. You can remove at most one element from this array. Thus, the final length of the array is $n-1$ or $n$. Your task is to calculate the maximum possible length of the strictly increasing contiguous subarray of the remaining array. Recall that the contiguous subar...
import sys RI = lambda: [int(x) for x in sys.stdin.readline().split()] ri = lambda: sys.stdin.readline().strip() mod = 10**7 + 1 n = int(ri()) a = RI() l = [1] * len(a) r = [1] * len(a) ans = -1 for i in range(1, len(a)): if a[i] > a[i - 1]: l[i] = l[i - 1] + 1 ans = max(ans, l[i]) for i in range(len(a...
IMPORT ASSIGN VAR FUNC_CALL VAR VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR BIN_OP BIN_OP NUMBER NUMBER NUMBER ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR ASSIGN VAR BIN_OP LIST NUMBER FUNC_CALL VAR VAR ASSIGN VAR BIN_OP LIST NUMBER FUNC_CALL VAR VAR ASSIGN VAR NUMB...
You are given an array $a$ consisting of $n$ integers. You can remove at most one element from this array. Thus, the final length of the array is $n-1$ or $n$. Your task is to calculate the maximum possible length of the strictly increasing contiguous subarray of the remaining array. Recall that the contiguous subar...
n = int(input()) arr = list(map(int, input().split())) l = [(1) for i in range(n)] r = [(1) for i in range(n)] for i in range(1, n): if arr[i] > arr[i - 1]: l[i] = l[i - 1] + 1 else: l[i] = 1 for i in range(n - 2, -1, -1): if arr[i] < arr[i + 1]: r[i] = r[i + 1] + 1 else: ...
ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR NUMBER VAR FUNC_CALL VAR VAR ASSIGN VAR NUMBER VAR FUNC_CALL VAR VAR FOR VAR FUNC_CALL VAR NUMBER VAR IF VAR VAR VAR BIN_OP VAR NUMBER ASSIGN VAR VAR BIN_OP VAR BIN_OP VAR NUMBER NUMBER ASSIGN VAR VAR NU...
You are given an array $a$ consisting of $n$ integers. You can remove at most one element from this array. Thus, the final length of the array is $n-1$ or $n$. Your task is to calculate the maximum possible length of the strictly increasing contiguous subarray of the remaining array. Recall that the contiguous subar...
n = int(input()) a = list(map(int, input().split())) i = 0 b = [] while i < n: j = i + 1 l = 1 while j < n: if a[j] > a[j - 1]: l += 1 j += 1 else: break while i < j: b.append(l) i += 1 c = [] for i in range(1, n - 1): if a[i] <= a[...
ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR NUMBER ASSIGN VAR LIST WHILE VAR VAR ASSIGN VAR BIN_OP VAR NUMBER ASSIGN VAR NUMBER WHILE VAR VAR IF VAR VAR VAR BIN_OP VAR NUMBER VAR NUMBER VAR NUMBER WHILE VAR VAR EXPR FUNC_CALL VAR VAR VAR NUMBER AS...
You are given an array $a$ consisting of $n$ integers. You can remove at most one element from this array. Thus, the final length of the array is $n-1$ or $n$. Your task is to calculate the maximum possible length of the strictly increasing contiguous subarray of the remaining array. Recall that the contiguous subar...
n = int(input()) a = list(map(int, input().strip().split())) b = [[(1) for i in range(n)] for j in range(2)] if a[0] < a[1]: b[0][1] = 2 for i in range(2, n): d = 0 if a[i - 1] < a[i]: b[0][i] = b[0][i - 1] + 1 d = b[1][i - 1] + 1 c = 0 if a[i - 2] < a[i]: c = b[0][i - 2] + 1...
ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL FUNC_CALL VAR ASSIGN VAR NUMBER VAR FUNC_CALL VAR VAR VAR FUNC_CALL VAR NUMBER IF VAR NUMBER VAR NUMBER ASSIGN VAR NUMBER NUMBER NUMBER FOR VAR FUNC_CALL VAR NUMBER VAR ASSIGN VAR NUMBER IF VAR BIN_OP VAR NUMBER VAR VA...
You are given an array $a$ consisting of $n$ integers. You can remove at most one element from this array. Thus, the final length of the array is $n-1$ or $n$. Your task is to calculate the maximum possible length of the strictly increasing contiguous subarray of the remaining array. Recall that the contiguous subar...
def process(A): answer = 1 n = len(A) current = [[A[0], A[0], 0, 0]] for i in range(1, n): if A[i] <= current[-1][1]: answer = max(answer, current[-1][3] - current[-1][2] + 1) current.append([A[i], A[i], i, i]) else: current[-1][1] = A[i] c...
FUNC_DEF ASSIGN VAR NUMBER ASSIGN VAR FUNC_CALL VAR VAR ASSIGN VAR LIST LIST VAR NUMBER VAR NUMBER NUMBER NUMBER FOR VAR FUNC_CALL VAR NUMBER VAR IF VAR VAR VAR NUMBER NUMBER ASSIGN VAR FUNC_CALL VAR VAR BIN_OP BIN_OP VAR NUMBER NUMBER VAR NUMBER NUMBER NUMBER EXPR FUNC_CALL VAR LIST VAR VAR VAR VAR VAR VAR ASSIGN VAR ...
You are given an array $a$ consisting of $n$ integers. You can remove at most one element from this array. Thus, the final length of the array is $n-1$ or $n$. Your task is to calculate the maximum possible length of the strictly increasing contiguous subarray of the remaining array. Recall that the contiguous subar...
n = int(input()) a = list(map(int, input().split())) inc = [] curinc = 1 curincmax = [] gap = 0 gaps = [] maxinc = 1 for i in range(1, n): if a[i] > a[i - 1]: if gap > 0: if gap == 1 and a[i - 1] > a[i - 3]: gaps.append(len(inc)) gap = 0 curinc += 1 else: ...
ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR LIST ASSIGN VAR NUMBER ASSIGN VAR LIST ASSIGN VAR NUMBER ASSIGN VAR LIST ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR NUMBER VAR IF VAR VAR VAR BIN_OP VAR NUMBER IF VAR NUMBER IF VAR NUMBER VAR BIN_OP VAR NUM...
You are given an array $a$ consisting of $n$ integers. You can remove at most one element from this array. Thus, the final length of the array is $n-1$ or $n$. Your task is to calculate the maximum possible length of the strictly increasing contiguous subarray of the remaining array. Recall that the contiguous subar...
n = int(input()) l = [int(x) for x in input().split()] a = [] b = [] j = 0 last = 0 for i in l: if j < i: a.append(last + 1) last += 1 else: a.append(1) last = 1 j = i j = 10**10 last = 0 for i in range(n - 1, -1, -1): if l[i] < j: b.append(last + 1) last ...
ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR LIST ASSIGN VAR LIST ASSIGN VAR NUMBER ASSIGN VAR NUMBER FOR VAR VAR IF VAR VAR EXPR FUNC_CALL VAR BIN_OP VAR NUMBER VAR NUMBER EXPR FUNC_CALL VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR VAR ASSIGN VAR BIN_OP NUMBER N...
You are given an array $a$ consisting of $n$ integers. You can remove at most one element from this array. Thus, the final length of the array is $n-1$ or $n$. Your task is to calculate the maximum possible length of the strictly increasing contiguous subarray of the remaining array. Recall that the contiguous subar...
n = int(input()) a = [int(i) for i in input().split()] ind = [0] * n temp = [] cnt = 0 count = 1 for i in range(1, n): if a[i] > a[i - 1]: count += 1 ind[i] = cnt else: temp.append(count) count = 1 cnt += 1 ind[i] = cnt temp.append(count) maxi = max(temp) for i in...
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 LIST ASSIGN VAR NUMBER ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR NUMBER VAR IF VAR VAR VAR BIN_OP VAR NUMBER VAR NUMBER ASSIGN VAR VAR VAR EXPR FUNC_CALL VAR VAR ASSIGN VAR NUMBER V...
You are given an array $a$ consisting of $n$ integers. You can remove at most one element from this array. Thus, the final length of the array is $n-1$ or $n$. Your task is to calculate the maximum possible length of the strictly increasing contiguous subarray of the remaining array. Recall that the contiguous subar...
n = int(input()) arr = list(map(int, input().split())) incLen = list() incS = list() tempAns = 1 last = arr[0] currS = 0 currLen = 1 for i in range(1, n): curr = arr[i] if curr > last: last = curr currLen += 1 else: tempAns = max(tempAns, currLen) incLen.append(currLen) ...
ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR ASSIGN VAR NUMBER ASSIGN VAR VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR NUMBER VAR ASSIGN VAR VAR VAR IF VAR VAR ASSIGN VAR VAR VAR NUMBER...
You are given an array $a$ consisting of $n$ integers. You can remove at most one element from this array. Thus, the final length of the array is $n-1$ or $n$. Your task is to calculate the maximum possible length of the strictly increasing contiguous subarray of the remaining array. Recall that the contiguous subar...
N = int(input()) L = list(map(int, input().split())) dp = [([0] * 2) for _ in range(N)] dp[0][0] = 1 ans = 1 for i in range(1, N): if L[i - 1] < L[i]: dp[i][0] = dp[i - 1][0] + 1 dp[i][1] = dp[i - 1][1] + 1 if i >= 2 and L[i - 2] < L[i]: dp[i][1] = max(dp[i][1], dp[i - 2][0] + 1)...
ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR BIN_OP LIST NUMBER NUMBER VAR FUNC_CALL VAR VAR ASSIGN VAR NUMBER NUMBER NUMBER ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR NUMBER VAR IF VAR BIN_OP VAR NUMBER VAR VAR ASSIGN VAR VAR NUMBER BIN_OP VAR BIN_OP...
You are given an array $a$ consisting of $n$ integers. You can remove at most one element from this array. Thus, the final length of the array is $n-1$ or $n$. Your task is to calculate the maximum possible length of the strictly increasing contiguous subarray of the remaining array. Recall that the contiguous subar...
def rint(): return int(input()) def rints(): return list(map(int, input().split())) n = rint() a = rints() rng = [] l = 0 for i in range(1, len(a)): if a[i] <= a[i - 1]: rng.append((l, i)) l = i rng.append((l, n)) mx = max(r - l for l, r in rng) for i in range(len(rng) - 1): l1, r1 =...
FUNC_DEF RETURN FUNC_CALL VAR FUNC_CALL VAR FUNC_DEF RETURN FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR ASSIGN VAR LIST ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR NUMBER FUNC_CALL VAR VAR IF VAR VAR VAR BIN_OP VAR NUMBER EXPR FUNC_CALL VAR VAR VAR ASSIGN VAR VA...
You are given an array $a$ consisting of $n$ integers. You can remove at most one element from this array. Thus, the final length of the array is $n-1$ or $n$. Your task is to calculate the maximum possible length of the strictly increasing contiguous subarray of the remaining array. Recall that the contiguous subar...
n = int(input()) a = [int(i) for i in input().split()] left = [(0) for _ in range(n)] right = [(0) for _ in range(n)] for i in range(n): val = 0 if i - 1 >= 0 and a[i - 1] < a[i]: val = max(val, left[i - 1]) left[i] = 1 + val for i in range(n - 1, -1, -1): val = 0 if i + 1 < n and a[i] < a[i...
ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR NUMBER VAR FUNC_CALL VAR VAR ASSIGN VAR NUMBER VAR FUNC_CALL VAR VAR FOR VAR FUNC_CALL VAR VAR ASSIGN VAR NUMBER IF BIN_OP VAR NUMBER NUMBER VAR BIN_OP VAR NUMBER VAR VAR ASSIGN VAR FUNC_CALL VAR VAR VAR BIN_OP VA...
You are given an array $a$ consisting of $n$ integers. You can remove at most one element from this array. Thus, the final length of the array is $n-1$ or $n$. Your task is to calculate the maximum possible length of the strictly increasing contiguous subarray of the remaining array. Recall that the contiguous subar...
n = int(input()) a = list(map(int, input().split())) dp = [[a[0]]] for i in range(1, n): if a[i] > a[i - 1]: dp[-1].append(a[i]) else: dp.append([a[i]]) maxm = 1 for x in dp: maxm = max(maxm, len(x)) m = len(dp) for i in range(m): if len(dp[i]) == 1: if i + 1 < m and i - 1 >= 0 a...
ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR LIST LIST VAR NUMBER FOR VAR FUNC_CALL VAR NUMBER VAR IF VAR VAR VAR BIN_OP VAR NUMBER EXPR FUNC_CALL VAR NUMBER VAR VAR EXPR FUNC_CALL VAR LIST VAR VAR ASSIGN VAR NUMBER FOR VAR VAR ASSIGN VAR FUNC_CALL...
You are given an array $a$ consisting of $n$ integers. You can remove at most one element from this array. Thus, the final length of the array is $n-1$ or $n$. Your task is to calculate the maximum possible length of the strictly increasing contiguous subarray of the remaining array. Recall that the contiguous subar...
def solve(): n = int(input()) a = list(map(int, input().split(" "))) l, r = [1] * n, [1] * n for i, v in enumerate(reversed(a)): if i > 0: l[i] = l[i - 1] + 1 if v < a[-i] else 1 l = list(reversed(l)) for i, v in enumerate(a): if i > 0: r[i] = r[i - 1] + 1...
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 VAR BIN_OP LIST NUMBER VAR BIN_OP LIST NUMBER VAR FOR VAR VAR FUNC_CALL VAR FUNC_CALL VAR VAR IF VAR NUMBER ASSIGN VAR VAR VAR VAR VAR BIN_OP VAR BIN_OP VAR NUMBER NUMBER NUMBER ASSIGN VA...
You are given an array $a$ consisting of $n$ integers. You can remove at most one element from this array. Thus, the final length of the array is $n-1$ or $n$. Your task is to calculate the maximum possible length of the strictly increasing contiguous subarray of the remaining array. Recall that the contiguous subar...
n = int(input()) a = list(map(int, input().split())) inc_seq = [] last = 0 for i in range(len(a)): if i == 0 or a[i] > a[i - 1]: continue else: inc_seq.append((last, i - 1, a[i - 1])) last = i inc_seq.append((last, len(a) - 1, a[-1])) maxList = list(map(lambda x: x[1] - x[0] + 1, inc_seq...
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 FUNC_CALL VAR VAR IF VAR NUMBER VAR VAR VAR BIN_OP VAR NUMBER EXPR FUNC_CALL VAR VAR BIN_OP VAR NUMBER VAR BIN_OP VAR NUMBER ASSIGN VAR VAR EXPR FUNC_CALL VAR...
You are given an array $a$ consisting of $n$ integers. You can remove at most one element from this array. Thus, the final length of the array is $n-1$ or $n$. Your task is to calculate the maximum possible length of the strictly increasing contiguous subarray of the remaining array. Recall that the contiguous subar...
n = int(input()) a = list(map(int, input().split())) b = [0] * n c = [0] * n cnt = 1 b[0] = 1 for i in range(1, n): if a[i - 1] < a[i]: cnt += 1 b[i] = cnt else: cnt = 1 b[i] = cnt cnt = 1 c[n - 1] = 1 for i in range(0, n - 1)[::-1]: if a[i] < a[i + 1]: cnt += 1 ...
ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR BIN_OP LIST NUMBER VAR ASSIGN VAR BIN_OP LIST NUMBER VAR ASSIGN VAR NUMBER ASSIGN VAR NUMBER NUMBER FOR VAR FUNC_CALL VAR NUMBER VAR IF VAR BIN_OP VAR NUMBER VAR VAR VAR NUMBER ASSIGN VAR VAR VAR ASSIGN ...
You are given an array $a$ consisting of $n$ integers. You can remove at most one element from this array. Thus, the final length of the array is $n-1$ or $n$. Your task is to calculate the maximum possible length of the strictly increasing contiguous subarray of the remaining array. Recall that the contiguous subar...
n = int(input()) a = list(map(int, input().split())) f = [[1, 0] for i in range(200002)] use = [(False) for i in range(200002)] ans = 1 if a[1] > a[0]: f[1][0] = 2 ans = 2 for i in range(2, len(a)): u1 = 0 u2 = 0 v1 = 0 if a[i] > a[i - 1]: u1 = f[i - 1][0] u2 = f[i - 1][1] if...
ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR LIST NUMBER NUMBER VAR FUNC_CALL VAR NUMBER ASSIGN VAR NUMBER VAR FUNC_CALL VAR NUMBER ASSIGN VAR NUMBER IF VAR NUMBER VAR NUMBER ASSIGN VAR NUMBER NUMBER NUMBER ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR N...
You are given an array $a$ consisting of $n$ integers. You can remove at most one element from this array. Thus, the final length of the array is $n-1$ or $n$. Your task is to calculate the maximum possible length of the strictly increasing contiguous subarray of the remaining array. Recall that the contiguous subar...
n = int(input()) A = list(map(int, input().split())) R = [1] * n L = [1] * n for i in reversed(range(n - 1)): if A[i] < A[i + 1]: R[i] = R[i + 1] + 1 for i in range(1, n): if A[i - 1] < A[i]: L[i] = L[i - 1] + 1 ans = max(L) for i in range(1, n - 1): if A[i - 1] < A[i + 1]: ans = max...
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 BIN_OP LIST NUMBER VAR FOR VAR FUNC_CALL VAR FUNC_CALL VAR BIN_OP VAR NUMBER IF VAR VAR VAR BIN_OP VAR NUMBER ASSIGN VAR VAR BIN_OP VAR BIN_OP VAR NUMBER NUMBER FOR VAR ...
You are given an array $a$ consisting of $n$ integers. You can remove at most one element from this array. Thus, the final length of the array is $n-1$ or $n$. Your task is to calculate the maximum possible length of the strictly increasing contiguous subarray of the remaining array. Recall that the contiguous subar...
n = int(input()) a = list(map(int, input().split())) arr = [0] * n arr[0] = 1 temp = [-1] * n m = 1 for i in range(1, n): if a[i] > a[i - 1]: arr[i] += arr[i - 1] + 1 m = max(m, arr[i]) else: arr[i] = 1 if arr[n - 1] == 1: temp[n - 1] = n - 1 for i in range(n - 2, -1, -1): if arr...
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 NUMBER ASSIGN VAR BIN_OP LIST NUMBER VAR ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR NUMBER VAR IF VAR VAR VAR BIN_OP VAR NUMBER VAR VAR BIN_OP VAR BIN_OP VAR NUMBER ...
You are given an array $a$ consisting of $n$ integers. You can remove at most one element from this array. Thus, the final length of the array is $n-1$ or $n$. Your task is to calculate the maximum possible length of the strictly increasing contiguous subarray of the remaining array. Recall that the contiguous subar...
n = int(input()) arr = [int(x) for x in input().split()] if n is 2: print(2 if arr[1] > arr[0] else 1) exit() l = [0] * (n + 1) r = [0] * (n + 1) l[0] = 1 r[n - 1] = 1 for i in range(1, n): l[i] = l[i - 1] + 1 if arr[i] > arr[i - 1] else 1 for i in range(n - 2, -1, -1): r[i] = r[i + 1] + 1 if arr[i] < a...
ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR VAR FUNC_CALL FUNC_CALL VAR IF VAR NUMBER EXPR FUNC_CALL VAR VAR NUMBER VAR NUMBER NUMBER NUMBER EXPR FUNC_CALL VAR ASSIGN VAR BIN_OP LIST NUMBER BIN_OP VAR NUMBER ASSIGN VAR BIN_OP LIST NUMBER BIN_OP VAR NUMBER ASSIGN VAR NUMBER NUMBER ASSIGN VAR BIN_...
You are given an array $a$ consisting of $n$ integers. You can remove at most one element from this array. Thus, the final length of the array is $n-1$ or $n$. Your task is to calculate the maximum possible length of the strictly increasing contiguous subarray of the remaining array. Recall that the contiguous subar...
n = int(input()) arr = list(map(int, input().split())) inc = [] count = 1 start = 0 if len(arr) == 1: print(1) else: for i in range(1, len(arr)): if arr[i] > arr[i - 1]: count += 1 else: if i - start != 1: inc.append([start, i - 1, i - start]) ...
ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR LIST ASSIGN VAR NUMBER ASSIGN VAR NUMBER IF FUNC_CALL VAR VAR NUMBER EXPR FUNC_CALL VAR NUMBER FOR VAR FUNC_CALL VAR NUMBER FUNC_CALL VAR VAR IF VAR VAR VAR BIN_OP VAR NUMBER VAR NUMBER IF BIN_OP VAR VAR...
You are given an array $a$ consisting of $n$ integers. You can remove at most one element from this array. Thus, the final length of the array is $n-1$ or $n$. Your task is to calculate the maximum possible length of the strictly increasing contiguous subarray of the remaining array. Recall that the contiguous subar...
n = int(input()) A = list(map(int, input().split())) I = [(0) for _ in range(n)] D = [(0) for _ in range(n)] for i in range(n): if i == 0: I[i] = 1 elif A[i] > A[i - 1]: I[i] = I[i - 1] + 1 else: I[i] = 1 for i in range(n - 1, -1, -1): if i == n - 1: D[i] = 1 elif A[i...
ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR NUMBER VAR FUNC_CALL VAR VAR ASSIGN VAR NUMBER VAR FUNC_CALL VAR VAR FOR VAR FUNC_CALL VAR VAR IF VAR NUMBER ASSIGN VAR VAR NUMBER IF VAR VAR VAR BIN_OP VAR NUMBER ASSIGN VAR VAR BIN_OP VAR BIN_OP VAR NU...
You are given an array $a$ consisting of $n$ integers. You can remove at most one element from this array. Thus, the final length of the array is $n-1$ or $n$. Your task is to calculate the maximum possible length of the strictly increasing contiguous subarray of the remaining array. Recall that the contiguous subar...
n = int(input()) a = list(map(int, input().split())) hehe = [(1) for i in range(n)] lol = [(1) for i in range(n)] for i in range(1, n): if a[i] > a[i - 1]: hehe[i] = 1 + hehe[i - 1] for i in range(n - 2, -1, -1): if a[i] < a[i + 1]: lol[i] = 1 + lol[i + 1] mx = 0 for i in range(1, n - 1): if...
ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR NUMBER VAR FUNC_CALL VAR VAR ASSIGN VAR NUMBER VAR FUNC_CALL VAR VAR FOR VAR FUNC_CALL VAR NUMBER VAR IF VAR VAR VAR BIN_OP VAR NUMBER ASSIGN VAR VAR BIN_OP NUMBER VAR BIN_OP VAR NUMBER FOR VAR FUNC_CALL...
You are given an array $a$ consisting of $n$ integers. You can remove at most one element from this array. Thus, the final length of the array is $n-1$ or $n$. Your task is to calculate the maximum possible length of the strictly increasing contiguous subarray of the remaining array. Recall that the contiguous subar...
n = int(input()) list1 = list(map(int, input().split())) left = [] right = [] for i in range(n): left.append(1) right.append(1) for i in range(1, n): if list1[i] > list1[i - 1]: left[i] = left[i - 1] + 1 for i in range(n - 2, -1, -1): if list1[i] < list1[i + 1]: right[i] = right[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 ASSIGN VAR LIST FOR VAR FUNC_CALL VAR VAR EXPR FUNC_CALL VAR NUMBER EXPR FUNC_CALL VAR NUMBER FOR VAR FUNC_CALL VAR NUMBER VAR IF VAR VAR VAR BIN_OP VAR NUMBER ASSIGN VAR VAR BIN_OP VAR BIN_OP VAR N...
You are given an array $a$ consisting of $n$ integers. You can remove at most one element from this array. Thus, the final length of the array is $n-1$ or $n$. Your task is to calculate the maximum possible length of the strictly increasing contiguous subarray of the remaining array. Recall that the contiguous subar...
n = int(input()) a = [-1] + list(map(int, input().split())) cur = 0 l = [0] * n m = [0] * n for i in range(1, n + 1): if a[i] > a[i - 1]: cur += 1 else: cur = 1 l[i - 1] = cur cur = n - 1 num = l[cur] while cur >= 0: m[cur] = num if l[cur] == 1: num = l[cur - 1] cur -= 1 ...
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 NUMBER ASSIGN VAR BIN_OP LIST NUMBER VAR ASSIGN VAR BIN_OP LIST NUMBER VAR FOR VAR FUNC_CALL VAR NUMBER BIN_OP VAR NUMBER IF VAR VAR VAR BIN_OP VAR NUMBER VAR NUMBER ASSIGN VAR NUMBER ...
You are given an array $a$ consisting of $n$ integers. You can remove at most one element from this array. Thus, the final length of the array is $n-1$ or $n$. Your task is to calculate the maximum possible length of the strictly increasing contiguous subarray of the remaining array. Recall that the contiguous subar...
n = int(input()) mass = list(map(int, input().split())) left = [1] * n right = [1] * n for i in range(1, n): if mass[i] > mass[i - 1]: left[i] = left[i - 1] + 1 for i in range(n - 2, -1, -1): if mass[i] < mass[i + 1]: right[i] = right[i + 1] + 1 mx = 1 for i in range(n): if i == 0: m...
ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR BIN_OP LIST NUMBER VAR ASSIGN VAR BIN_OP LIST NUMBER VAR FOR VAR FUNC_CALL VAR NUMBER VAR IF VAR VAR VAR BIN_OP VAR NUMBER ASSIGN VAR VAR BIN_OP VAR BIN_OP VAR NUMBER NUMBER FOR VAR FUNC_CALL VAR BIN_OP ...
You are given an array $a$ consisting of $n$ integers. You can remove at most one element from this array. Thus, the final length of the array is $n-1$ or $n$. Your task is to calculate the maximum possible length of the strictly increasing contiguous subarray of the remaining array. Recall that the contiguous subar...
class X: def __init__(self, d): self.start = d self.end = d self.before_end = d self.after_start = d self.size = 1 def add(self, d): self.before_end = self.end if self.after_start == self.start: self.after_start = d self.end = d ...
CLASS_DEF FUNC_DEF ASSIGN VAR VAR ASSIGN VAR VAR ASSIGN VAR VAR ASSIGN VAR VAR ASSIGN VAR NUMBER FUNC_DEF ASSIGN VAR VAR IF VAR VAR ASSIGN VAR VAR ASSIGN VAR VAR VAR NUMBER FUNC_DEF ASSIGN VAR LIST VAR VAR IF VAR VAR VAR VAR EXPR FUNC_CALL VAR BIN_OP BIN_OP VAR VAR NUMBER RETURN FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL V...
You are given an array $a$ consisting of $n$ integers. You can remove at most one element from this array. Thus, the final length of the array is $n-1$ or $n$. Your task is to calculate the maximum possible length of the strictly increasing contiguous subarray of the remaining array. Recall that the contiguous subar...
from sys import stdin, stdout cin = stdin.readline cout = stdout.write n = int(cin()) a = list(map(int, cin().split())) length = i = 1 k = 0 x = [1] while i < n: j = i while j < n: if a[j] > a[j - 1]: j += 1 x.append(j - i + 1) else: x.append(1) b...
ASSIGN VAR VAR 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 ASSIGN VAR NUMBER ASSIGN VAR LIST NUMBER WHILE VAR VAR ASSIGN VAR VAR WHILE VAR VAR IF VAR VAR VAR BIN_OP VAR NUMBER VAR NUMBER EXPR FUNC_CALL VAR BIN_OP BIN_OP V...
You are given an array $a$ consisting of $n$ integers. You can remove at most one element from this array. Thus, the final length of the array is $n-1$ or $n$. Your task is to calculate the maximum possible length of the strictly increasing contiguous subarray of the remaining array. Recall that the contiguous subar...
n = int(input()) a = [int(o) for o in input().split()] arr = [1] * n upto = [1] * n c = 1 for i in range(1, n): flag = 0 if a[i - 1] < a[i]: c += 1 else: flag = 1 for j in range(i - c, i): arr[j] = c c -= 1 c = 1 upto[i] = c if i == n - 1 and f...
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 BIN_OP LIST NUMBER VAR ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR NUMBER VAR ASSIGN VAR NUMBER IF VAR BIN_OP VAR NUMBER VAR VAR VAR NUMBER ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR BIN...
You are given an array $a$ consisting of $n$ integers. You can remove at most one element from this array. Thus, the final length of the array is $n-1$ or $n$. Your task is to calculate the maximum possible length of the strictly increasing contiguous subarray of the remaining array. Recall that the contiguous subar...
n = int(input()) a = list(map(int, input().split())) + [0] seq = [] cur_start = 0 prev = 0 for i, x in enumerate(a): if prev < x: pass else: seq.append((cur_start, i)) cur_start = i prev = x best = max([(r - l) for l, r in seq]) for (l1, r1), (l2, r2) in zip(seq, seq[1:]): if a[l...
ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR BIN_OP FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR LIST NUMBER ASSIGN VAR LIST ASSIGN VAR NUMBER ASSIGN VAR NUMBER FOR VAR VAR FUNC_CALL VAR VAR IF VAR VAR EXPR FUNC_CALL VAR VAR VAR ASSIGN VAR VAR ASSIGN VAR VAR ASSIGN VAR FUNC_CALL VAR BIN_OP VAR VAR VAR V...
You are given an array $a$ consisting of $n$ integers. You can remove at most one element from this array. Thus, the final length of the array is $n-1$ or $n$. Your task is to calculate the maximum possible length of the strictly increasing contiguous subarray of the remaining array. Recall that the contiguous subar...
def solve(n, ar): r = [1] * n l = [1] * n ans = 0 for i in range(n - 2, -1, -1): if ar[i] < ar[i + 1]: r[i] = r[i + 1] + 1 ans = max(ans, r[i]) for i in range(1, n): if ar[i] > ar[i - 1]: l[i] = l[i - 1] + 1 ans = max(ans, l[i]) for i in ra...
FUNC_DEF ASSIGN VAR BIN_OP LIST NUMBER VAR ASSIGN VAR BIN_OP LIST NUMBER VAR ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR BIN_OP VAR NUMBER NUMBER NUMBER IF VAR VAR VAR BIN_OP VAR NUMBER ASSIGN VAR VAR BIN_OP VAR BIN_OP VAR NUMBER NUMBER ASSIGN VAR FUNC_CALL VAR VAR VAR VAR FOR VAR FUNC_CALL VAR NUMBER VAR IF VAR VAR VAR BI...
You are given an array $a$ consisting of $n$ integers. You can remove at most one element from this array. Thus, the final length of the array is $n-1$ or $n$. Your task is to calculate the maximum possible length of the strictly increasing contiguous subarray of the remaining array. Recall that the contiguous subar...
import sys input = sys.stdin.readline n = int(input()) a = list(map(int, input().split())) lr = [0] * n lr[-1] = 1 for i in range(n - 1)[::-1]: if a[i] < a[i + 1]: lr[i] = lr[i + 1] + 1 else: lr[i] = 1 rl = [0] * n rl[0] = 1 for i in range(n - 1): if a[i] < a[i + 1]: rl[i + 1] = rl[...
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 BIN_OP LIST NUMBER VAR ASSIGN VAR NUMBER NUMBER FOR VAR FUNC_CALL VAR BIN_OP VAR NUMBER NUMBER IF VAR VAR VAR BIN_OP VAR NUMBER ASSIGN VAR VAR BIN_OP VAR BIN_OP VAR NUMBER NUMBER AS...
You are given an array $a$ consisting of $n$ integers. You can remove at most one element from this array. Thus, the final length of the array is $n-1$ or $n$. Your task is to calculate the maximum possible length of the strictly increasing contiguous subarray of the remaining array. Recall that the contiguous subar...
n = int(input()) arr = list(map(int, input().split())) dp = [1] * n for i in range(1, n): if arr[i] > arr[i - 1]: dp[i] = dp[i - 1] + 1 ds = [1] * n for i in range(n - 2, -1, -1): if arr[i] < arr[i + 1]: ds[i] = ds[i + 1] + 1 ys = 0 for i in range(1, n - 1): if arr[i - 1] < arr[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 BIN_OP LIST NUMBER VAR FOR VAR FUNC_CALL VAR NUMBER VAR IF VAR VAR VAR BIN_OP VAR NUMBER ASSIGN VAR VAR BIN_OP VAR BIN_OP VAR NUMBER NUMBER ASSIGN VAR BIN_OP LIST NUMBER VAR FOR VAR FUNC_CALL VAR BIN_OP ...
You are given an array $a$ consisting of $n$ integers. You can remove at most one element from this array. Thus, the final length of the array is $n-1$ or $n$. Your task is to calculate the maximum possible length of the strictly increasing contiguous subarray of the remaining array. Recall that the contiguous subar...
n = int(input()) A = [int(x) for x in input().split()] B = [0] * n k = 0 K = [1] for i in range(1, n): if A[i - 1] >= A[i]: k += 1 K.append(0) K[k] += 1 B[i] = k m = max(K) if n > 2: for i in range(1, n - 1): mm = K[B[i - 1]] + K[B[i + 1]] if K[B[i]] == 1: if ...
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 ASSIGN VAR LIST NUMBER FOR VAR FUNC_CALL VAR NUMBER VAR IF VAR BIN_OP VAR NUMBER VAR VAR VAR NUMBER EXPR FUNC_CALL VAR NUMBER VAR VAR NUMBER ASSIGN VAR VAR VAR ASSIGN VAR F...
You are given an array $a$ consisting of $n$ integers. You can remove at most one element from this array. Thus, the final length of the array is $n-1$ or $n$. Your task is to calculate the maximum possible length of the strictly increasing contiguous subarray of the remaining array. Recall that the contiguous subar...
import sys input = sys.stdin.readline n = int(input()) a = list(map(int, input().split())) dp = [1] for i in range(1, n): if a[i - 1] < a[i]: dp.append(dp[i - 1] + 1) else: dp.append(1) dp2 = [1] * n for i in range(n - 2, -1, -1): if a[i + 1] > a[i]: dp2[i] = dp2[i + 1] + 1 ans = ma...
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 LIST NUMBER FOR VAR FUNC_CALL VAR NUMBER VAR IF VAR BIN_OP VAR NUMBER VAR VAR EXPR FUNC_CALL VAR BIN_OP VAR BIN_OP VAR NUMBER NUMBER EXPR FUNC_CALL VAR NUMBER ASSIGN VAR BIN_OP LIST...
You are given an array $a$ consisting of $n$ integers. You can remove at most one element from this array. Thus, the final length of the array is $n-1$ or $n$. Your task is to calculate the maximum possible length of the strictly increasing contiguous subarray of the remaining array. Recall that the contiguous subar...
n = int(input()) s = input() l = list(map(int, s.split())) records = [] current = 1 for i in range(1, len(l)): if l[i - 1] < l[i]: current += 1 if l[i - 1] >= l[i]: records.append(current) append0 = False if i > 1 and l[i] <= l[i - 2]: append0 = True if i < le...
ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL VAR ASSIGN VAR LIST ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR NUMBER FUNC_CALL VAR VAR IF VAR BIN_OP VAR NUMBER VAR VAR VAR NUMBER IF VAR BIN_OP VAR NUMBER VAR VAR EXPR FUNC_CALL VAR VAR ASSIGN VAR NUMBER ...
You are given an array $a$ consisting of $n$ integers. You can remove at most one element from this array. Thus, the final length of the array is $n-1$ or $n$. Your task is to calculate the maximum possible length of the strictly increasing contiguous subarray of the remaining array. Recall that the contiguous subar...
x = input() a = list(map(int, input().split())) m, clast, cnow = 1, 0, 1 last = 1 for i in range(1, len(a)): if a[i] > a[i - 1]: cnow += 1 m = max(m, cnow) else: if clast > 1 and cnow > 1: if a[last - 1] < a[last + 1] or a[last] < a[last + 2]: m = max(m, clast...
ASSIGN VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR VAR VAR NUMBER NUMBER NUMBER ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR NUMBER FUNC_CALL VAR VAR IF VAR VAR VAR BIN_OP VAR NUMBER VAR NUMBER ASSIGN VAR FUNC_CALL VAR VAR VAR IF VAR NUMBER VAR NUMBER IF VAR BIN_OP VAR NUM...
You are given an array $a$ consisting of $n$ integers. You can remove at most one element from this array. Thus, the final length of the array is $n-1$ or $n$. Your task is to calculate the maximum possible length of the strictly increasing contiguous subarray of the remaining array. Recall that the contiguous subar...
n = int(input().strip()) a = [int(j) for j in input().strip().split()] a.append(0) b = [a[0]] r = [] for i in range(len(a) - 1): left = a[i] right = a[i + 1] if right > left: b.append(right) else: r.append(b) b = [a[i + 1]] def find_len(list1, list2, list3): max_len = max(l...
ASSIGN VAR FUNC_CALL VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR VAR FUNC_CALL FUNC_CALL FUNC_CALL VAR EXPR FUNC_CALL VAR NUMBER ASSIGN VAR LIST VAR NUMBER ASSIGN VAR LIST FOR VAR FUNC_CALL VAR BIN_OP FUNC_CALL VAR VAR NUMBER ASSIGN VAR VAR VAR ASSIGN VAR VAR BIN_OP VAR NUMBER IF VAR VAR EXPR FUNC_CALL VAR...
You are given an array $a$ consisting of $n$ integers. You can remove at most one element from this array. Thus, the final length of the array is $n-1$ or $n$. Your task is to calculate the maximum possible length of the strictly increasing contiguous subarray of the remaining array. Recall that the contiguous subar...
n = int(input()) a = list(map(int, input().split())) l = [] c = 0 c1 = 0 for i in range(1, n): if a[i] > a[i - 1]: c1 += 1 else: l.append([c, c1]) c = c1 + 1 c1 += 1 l.append([c, c1]) m = 1 for i in l: m = max(m, i[1] - i[0] + 1) for i in range(1, len(l)): if l[i][0] != l...
ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR LIST ASSIGN VAR NUMBER ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR NUMBER VAR IF VAR VAR VAR BIN_OP VAR NUMBER VAR NUMBER EXPR FUNC_CALL VAR LIST VAR VAR ASSIGN VAR BIN_OP VAR NUMBER VAR NUMBER EXPR FUNC_CAL...
You are given an array $a$ consisting of $n$ integers. You can remove at most one element from this array. Thus, the final length of the array is $n-1$ or $n$. Your task is to calculate the maximum possible length of the strictly increasing contiguous subarray of the remaining array. Recall that the contiguous subar...
n = int(input()) a = [int(_) for _ in input().split()] l1 = [] l2 = [a[0]] l3 = [] for i in range(1, n): if a[i] > a[i - 1]: l2.append(a[i]) else: l1.append(l2[:]) l2.clear() l2.append(a[i]) l1.append(l2) for i in l1: l3.append(len(i)) max_ = max(l3) for i in range(1, len(l3)...
ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR LIST ASSIGN VAR LIST VAR NUMBER ASSIGN VAR LIST FOR VAR FUNC_CALL VAR NUMBER VAR IF VAR VAR VAR BIN_OP VAR NUMBER EXPR FUNC_CALL VAR VAR VAR EXPR FUNC_CALL VAR VAR EXPR FUNC_CALL VAR EXPR FUNC_CALL VAR VAR VAR EXP...
You are given an array $a$ consisting of $n$ integers. You can remove at most one element from this array. Thus, the final length of the array is $n-1$ or $n$. Your task is to calculate the maximum possible length of the strictly increasing contiguous subarray of the remaining array. Recall that the contiguous subar...
n = int(input()) a = list(map(int, input().split())) pref = [0] * n suff = [0] * n pref[0] = 1 suff[-1] = 1 l = 0 r = n - 1 for i in range(1, n): if a[i] > a[i - 1]: pref[i] = i - l + 1 else: l = i pref[i] = 1 for i in range(n - 2, -1, -1): if a[i] < a[i + 1]: suff[i] = r - 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 ASSIGN VAR BIN_OP LIST NUMBER VAR ASSIGN VAR NUMBER NUMBER ASSIGN VAR NUMBER NUMBER ASSIGN VAR NUMBER ASSIGN VAR BIN_OP VAR NUMBER FOR VAR FUNC_CALL VAR NUMBER VAR IF VAR VAR VAR B...
You are given an array $a$ consisting of $n$ integers. You can remove at most one element from this array. Thus, the final length of the array is $n-1$ or $n$. Your task is to calculate the maximum possible length of the strictly increasing contiguous subarray of the remaining array. Recall that the contiguous subar...
n = int(input()) max_length = 0 curr_length = 0 prev_length = 0 curr_first, curr_second = None, None curr_last, curr_prelast = None, None prev_last, prev_prelast = None, None prev = 0 seq = list(map(int, input().split())) for i in range(n): curr = seq[i] if curr > prev: curr_length += 1 if curr_...
ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR VAR NONE NONE ASSIGN VAR VAR NONE NONE ASSIGN VAR VAR NONE NONE ASSIGN VAR NUMBER ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR FOR VAR FUNC_CALL VAR VAR ASSIGN VAR VAR VAR IF VAR VAR VAR NUMBER ...
You are given an array $a$ consisting of $n$ integers. You can remove at most one element from this array. Thus, the final length of the array is $n-1$ or $n$. Your task is to calculate the maximum possible length of the strictly increasing contiguous subarray of the remaining array. Recall that the contiguous subar...
import sys reader = (line.rstrip() for line in sys.stdin) input = reader.__next__ n = int(input()) a = list(map(int, input().split())) segm = [] st = 0 for i in range(1, n): if a[i - 1] >= a[i]: if i - 1 > st: segm.append((st, i - 1)) st = i if n - 1 > st: segm.append((st, n - 1)) i...
IMPORT ASSIGN VAR FUNC_CALL VAR VAR VAR 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 LIST ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR NUMBER VAR IF VAR BIN_OP VAR NUMBER VAR VAR IF BIN_OP VAR NUMBER VAR EXPR FUNC_CALL VAR VAR BIN_OP VAR ...
You are given an array $a$ consisting of $n$ integers. You can remove at most one element from this array. Thus, the final length of the array is $n-1$ or $n$. Your task is to calculate the maximum possible length of the strictly increasing contiguous subarray of the remaining array. Recall that the contiguous subar...
input() nums = list(map(int, input().split())) n = len(nums) pure = [0] * n skipped = [0] * n pure[0] = 1 skipped[0] = 1 pure[1] = 2 if nums[0] < nums[1] else 1 skipped[1] = 1 for i in range(2, n): if nums[i] > nums[i - 1]: pure[i] = 1 + pure[i - 1] skipped[i] = 1 + skipped[i - 1] if nums[i]...
EXPR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR ASSIGN VAR BIN_OP LIST NUMBER VAR ASSIGN VAR BIN_OP LIST NUMBER VAR ASSIGN VAR NUMBER NUMBER ASSIGN VAR NUMBER NUMBER ASSIGN VAR NUMBER VAR NUMBER VAR NUMBER NUMBER NUMBER ASSIGN VAR NUMBER NUMBER FOR VAR ...
You are given an array $a$ consisting of $n$ integers. You can remove at most one element from this array. Thus, the final length of the array is $n-1$ or $n$. Your task is to calculate the maximum possible length of the strictly increasing contiguous subarray of the remaining array. Recall that the contiguous subar...
import sys input = sys.stdin.readline def main(): N = int(input()) A = [int(x) for x in input().split()] AX = [] for i in range(N): if i == 0: AX.append(1) elif A[i] > A[i - 1]: AX.append(AX[i - 1] + 1) else: AX.append(1) BX = [1] * N ...
IMPORT ASSIGN VAR 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 LIST FOR VAR FUNC_CALL VAR VAR IF VAR NUMBER EXPR FUNC_CALL VAR NUMBER IF VAR VAR VAR BIN_OP VAR NUMBER EXPR FUNC_CALL VAR BIN_OP VAR BIN_OP VAR NUMBER NUMBER EXPR FUNC_CALL VAR NUMB...
You are given an array $a$ consisting of $n$ integers. You can remove at most one element from this array. Thus, the final length of the array is $n-1$ or $n$. Your task is to calculate the maximum possible length of the strictly increasing contiguous subarray of the remaining array. Recall that the contiguous subar...
from sys import stdin, stdout outputs = [] n = int(stdin.readline().strip()) arr = [int(num) for num in stdin.readline().strip().split()] req = [] l, r = 0, 0 for i in range(n - 1): if arr[i] < arr[i + 1]: r += 1 else: req.append([l, r]) l = i + 1 r = i + 1 if l == n - 1: re...
ASSIGN VAR LIST ASSIGN VAR FUNC_CALL VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR VAR FUNC_CALL FUNC_CALL FUNC_CALL VAR ASSIGN VAR LIST ASSIGN VAR VAR NUMBER NUMBER FOR VAR FUNC_CALL VAR BIN_OP VAR NUMBER IF VAR VAR VAR BIN_OP VAR NUMBER VAR NUMBER EXPR FUNC_CALL VAR LIST VAR VAR ASSIGN VAR BIN_OP VAR NUMBE...
You are given an array $a$ consisting of $n$ integers. You can remove at most one element from this array. Thus, the final length of the array is $n-1$ or $n$. Your task is to calculate the maximum possible length of the strictly increasing contiguous subarray of the remaining array. Recall that the contiguous subar...
def solve(arr, n): if n == 1: return 1 if n == 2: if arr[1] > arr[0]: return 2 else: return 1 dp = list() org = list() curr = 1 org.append(1) for i in range(1, n): if arr[i] > arr[i - 1]: curr += 1 org.append(cur...
FUNC_DEF IF VAR NUMBER RETURN NUMBER IF VAR NUMBER IF VAR NUMBER VAR NUMBER RETURN NUMBER RETURN NUMBER ASSIGN VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR ASSIGN VAR NUMBER EXPR FUNC_CALL VAR NUMBER FOR VAR FUNC_CALL VAR NUMBER VAR IF VAR VAR VAR BIN_OP VAR NUMBER VAR NUMBER EXPR FUNC_CALL VAR VAR ASSIGN VAR NUMBER EXPR...
You are given an array $a$ consisting of $n$ integers. You can remove at most one element from this array. Thus, the final length of the array is $n-1$ or $n$. Your task is to calculate the maximum possible length of the strictly increasing contiguous subarray of the remaining array. Recall that the contiguous subar...
input() A, B, C = [int(_) for _ in input().split()], [1], [1] for i in range(1, len(A)): if A[i] > A[i - 1]: B.append(B[-1] + 1) C.append(C[-1] + 1) else: B.append(1) C.append(1) if i >= 2 and A[i] > A[i - 2]: C[-1] = max(C[-1], B[i - 2] + 1) print(max(*B, *C))
EXPR FUNC_CALL VAR ASSIGN VAR VAR VAR FUNC_CALL VAR VAR VAR FUNC_CALL FUNC_CALL VAR LIST NUMBER LIST NUMBER FOR VAR FUNC_CALL VAR NUMBER FUNC_CALL VAR VAR IF VAR VAR VAR BIN_OP VAR NUMBER EXPR FUNC_CALL VAR BIN_OP VAR NUMBER NUMBER EXPR FUNC_CALL VAR BIN_OP VAR NUMBER NUMBER EXPR FUNC_CALL VAR NUMBER EXPR FUNC_CALL VAR...
You are given an array $a$ consisting of $n$ integers. You can remove at most one element from this array. Thus, the final length of the array is $n-1$ or $n$. Your task is to calculate the maximum possible length of the strictly increasing contiguous subarray of the remaining array. Recall that the contiguous subar...
n = int(input()) arr = list(map(int, input().split())) incs = [1] decs = [1] inc = 1 dec = 1 ans = 0 for i in range(1, n): if arr[i] > arr[i - 1]: inc += 1 else: inc = 1 incs.append(inc) ans = max(ans, inc) if arr[n - i] > arr[n - i - 1]: dec += 1 else: dec = 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 ASSIGN VAR LIST NUMBER ASSIGN VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR NUMBER VAR IF VAR VAR VAR BIN_OP VAR NUMBER VAR NUMBER ASSIGN VAR NUMBER EXPR FUNC_CALL VAR ...
You are given an array $a$ consisting of $n$ integers. You can remove at most one element from this array. Thus, the final length of the array is $n-1$ or $n$. Your task is to calculate the maximum possible length of the strictly increasing contiguous subarray of the remaining array. Recall that the contiguous subar...
n = int(input()) incseq = [0] seq = list(map(int, input().split())) incseq[0] = [seq[0]] for i in range(1, len(seq)): if seq[i] > seq[i - 1]: incseq[-1].append(seq[i]) else: incseq.append([seq[i]]) seqLen = max(len(k) for k in incseq) for i in range(1, len(incseq) - 1): if len(incseq[i]) == ...
ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR LIST NUMBER ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR NUMBER LIST VAR NUMBER FOR VAR FUNC_CALL VAR NUMBER FUNC_CALL VAR VAR IF VAR VAR VAR BIN_OP VAR NUMBER EXPR FUNC_CALL VAR NUMBER VAR VAR EXPR FUNC_CALL VAR LIST VAR VAR ASSIGN VAR ...
You are given an array $a$ consisting of $n$ integers. You can remove at most one element from this array. Thus, the final length of the array is $n-1$ or $n$. Your task is to calculate the maximum possible length of the strictly increasing contiguous subarray of the remaining array. Recall that the contiguous subar...
def solve(lst): dp = [[1, 1] for _ in range(len(lst))] val = 0 for i in range(1, len(lst)): if lst[i] > lst[i - 1]: dp[i][0] = max(dp[i - 1][0] + 1, dp[i][0]) dp[i][1] = max(dp[i - 1][1] + 1, dp[i][1]) if i > 1 and lst[i] > lst[i - 2]: dp[i][1] = max(dp[i ...
FUNC_DEF ASSIGN VAR LIST NUMBER NUMBER VAR FUNC_CALL VAR FUNC_CALL VAR VAR ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR NUMBER FUNC_CALL VAR VAR IF VAR VAR VAR BIN_OP VAR NUMBER ASSIGN VAR VAR NUMBER FUNC_CALL VAR BIN_OP VAR BIN_OP VAR NUMBER NUMBER NUMBER VAR VAR NUMBER ASSIGN VAR VAR NUMBER FUNC_CALL VAR BIN_OP VAR BIN_OP...
You are given an array $a$ consisting of $n$ integers. You can remove at most one element from this array. Thus, the final length of the array is $n-1$ or $n$. Your task is to calculate the maximum possible length of the strictly increasing contiguous subarray of the remaining array. Recall that the contiguous subar...
n = int(input()) l = list(map(int, input().split())) x = 1 l1 = [1] * n l1[0] = 1 ans = 1 temp = 1 for i in range(1, n): if l[i] > l[i - 1]: ans += 1 temp = max(temp, ans) else: ans = 1 ans = temp for i in range(1, n): if l[i] > l[i - 1]: l1[i] = l1[i - 1] + 1 else: ...
ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR NUMBER ASSIGN VAR BIN_OP LIST NUMBER VAR ASSIGN VAR NUMBER NUMBER ASSIGN VAR NUMBER ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR NUMBER VAR IF VAR VAR VAR BIN_OP VAR NUMBER VAR NUMBER ASSIGN VAR FUNC_CALL VAR...
You are given an array $a$ consisting of $n$ integers. You can remove at most one element from this array. Thus, the final length of the array is $n-1$ or $n$. Your task is to calculate the maximum possible length of the strictly increasing contiguous subarray of the remaining array. Recall that the contiguous subar...
n = int(input()) ai = list(map(int, input().split())) ans = [([0] * n) for i in range(4)] ans[0][0] = 1 ans[1][0] = ai[0] for i in range(1, n): if ans[1][i - 1] < ai[i] and ans[3][i - 1] < ai[i]: ans[0][i] = ans[0][i - 1] + 1 ans[1][i] = ai[i] ans[2][i] = ans[2][i - 1] + 1 ans[3][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 VAR FUNC_CALL VAR NUMBER ASSIGN VAR NUMBER NUMBER NUMBER ASSIGN VAR NUMBER NUMBER VAR NUMBER FOR VAR FUNC_CALL VAR NUMBER VAR IF VAR NUMBER BIN_OP VAR NUMBER VAR VAR VAR NUMBER BIN...
You are given an array $a$ consisting of $n$ integers. You can remove at most one element from this array. Thus, the final length of the array is $n-1$ or $n$. Your task is to calculate the maximum possible length of the strictly increasing contiguous subarray of the remaining array. Recall that the contiguous subar...
n = int(input()) a = list(map(int, input().split())) dp1 = [(0) for i in range(n + 1)] dp2 = [(0) for i in range(n + 1)] dp1[1] = 1 for i in range(2, n + 1): if a[i - 1] > a[i - 2]: dp1[i] = dp1[i - 1] + 1 else: dp1[i] = 1 dp2[n] = 1 for i in range(n - 1, 0, -1): if a[i - 1] < a[i]: ...
ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR NUMBER VAR FUNC_CALL VAR BIN_OP VAR NUMBER ASSIGN VAR NUMBER VAR FUNC_CALL VAR BIN_OP VAR NUMBER ASSIGN VAR NUMBER NUMBER FOR VAR FUNC_CALL VAR NUMBER BIN_OP VAR NUMBER IF VAR BIN_OP VAR NUMBER VAR BIN_O...
You are given an array $a$ consisting of $n$ integers. You can remove at most one element from this array. Thus, the final length of the array is $n-1$ or $n$. Your task is to calculate the maximum possible length of the strictly increasing contiguous subarray of the remaining array. Recall that the contiguous subar...
n = int(input()) s = list(map(int, input().split())) def increasing_subsquence_end(L): DP = [(1) for i in L] for i in range(1, len(L)): if L[i] > L[i - 1]: DP[i] = DP[i - 1] + 1 return DP def increasing_subsquence_begin(L): DP = [(1) for i in L] for i in range(len(L) - 2, -1,...
ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR FUNC_DEF ASSIGN VAR NUMBER VAR VAR FOR VAR FUNC_CALL VAR NUMBER FUNC_CALL VAR VAR IF VAR VAR VAR BIN_OP VAR NUMBER ASSIGN VAR VAR BIN_OP VAR BIN_OP VAR NUMBER NUMBER RETURN VAR FUNC_DEF ASSIGN VAR NUMBER VAR VAR FO...
You are given an array $a$ consisting of $n$ integers. You can remove at most one element from this array. Thus, the final length of the array is $n-1$ or $n$. Your task is to calculate the maximum possible length of the strictly increasing contiguous subarray of the remaining array. Recall that the contiguous subar...
n = int(input()) num = [int(x) for x in input().split()] f = [] for i in range(n): f.append([1, 0, 0]) for i in range(1, n): if num[i] > num[i - 1]: f[i][0] = f[i - 1][0] + 1 f[i][1] = f[i - 1][0] f[i][2] = f[i - 1][2] + 1 if i >= 2 and num[i] > num[i - 2]: f[i][2] = ...
ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR LIST FOR VAR FUNC_CALL VAR VAR EXPR FUNC_CALL VAR LIST NUMBER NUMBER NUMBER FOR VAR FUNC_CALL VAR NUMBER VAR IF VAR VAR VAR BIN_OP VAR NUMBER ASSIGN VAR VAR NUMBER BIN_OP VAR BIN_OP VAR NUMBER NUMBER NUMBER ASSIGN...
You are given an array $a$ consisting of $n$ integers. You can remove at most one element from this array. Thus, the final length of the array is $n-1$ or $n$. Your task is to calculate the maximum possible length of the strictly increasing contiguous subarray of the remaining array. Recall that the contiguous subar...
def answer(n, A): l = [1] * n for i in range(1, n): if A[i] > A[i - 1]: l[i] = l[i - 1] + 1 r = [1] * n for i in range(n - 2, -1, -1): if A[i] < A[i + 1]: r[i] = r[i + 1] + 1 ans = 0 for i in range(0, n): if i <= n - 3 and A[i + 2] > A[i]: ...
FUNC_DEF ASSIGN VAR BIN_OP LIST NUMBER VAR FOR VAR FUNC_CALL VAR NUMBER VAR IF VAR VAR VAR BIN_OP VAR NUMBER ASSIGN VAR VAR BIN_OP VAR BIN_OP VAR NUMBER NUMBER ASSIGN VAR BIN_OP LIST NUMBER VAR FOR VAR FUNC_CALL VAR BIN_OP VAR NUMBER NUMBER NUMBER IF VAR VAR VAR BIN_OP VAR NUMBER ASSIGN VAR VAR BIN_OP VAR BIN_OP VAR NU...
You are given an array $a$ consisting of $n$ integers. You can remove at most one element from this array. Thus, the final length of the array is $n-1$ or $n$. Your task is to calculate the maximum possible length of the strictly increasing contiguous subarray of the remaining array. Recall that the contiguous subar...
from sys import stdin, stdout n = int(stdin.readline().strip()) s = list(map(int, stdin.readline().strip().split())) dp = [(0) for i in range(n)] dp[0] = 1 for i in range(1, n): if s[i] > s[i - 1]: dp[i] = dp[i - 1] + 1 else: dp[i] = 1 aux = [(0) for i in range(n)] aux[-1] = dp[-1] for i in ran...
ASSIGN VAR FUNC_CALL VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL FUNC_CALL VAR ASSIGN VAR NUMBER VAR FUNC_CALL VAR VAR ASSIGN VAR NUMBER NUMBER FOR VAR FUNC_CALL VAR NUMBER VAR IF VAR VAR VAR BIN_OP VAR NUMBER ASSIGN VAR VAR BIN_OP VAR BIN_OP VAR NUMBER NUMBER ASSIGN VAR V...
You are given an array $a$ consisting of $n$ integers. You can remove at most one element from this array. Thus, the final length of the array is $n-1$ or $n$. Your task is to calculate the maximum possible length of the strictly increasing contiguous subarray of the remaining array. Recall that the contiguous subar...
import sys input = sys.stdin.buffer.readline n = int(input()) data = [int(i) for i in input().split()] l = [1] idx = [0] for i in range(1, len(data)): if data[i] > data[i - 1]: l[-1] += 1 else: l.append(1) idx.append(i) max_length = 0 for i in range(1, len(idx)): index = idx[i] ...
IMPORT 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 LIST NUMBER ASSIGN VAR LIST NUMBER FOR VAR FUNC_CALL VAR NUMBER FUNC_CALL VAR VAR IF VAR VAR VAR BIN_OP VAR NUMBER VAR NUMBER NUMBER EXPR FUNC_CALL VAR NUMBER EXPR FUNC_CALL VAR VAR ASSIGN VA...
You are given an array $a$ consisting of $n$ integers. You can remove at most one element from this array. Thus, the final length of the array is $n-1$ or $n$. Your task is to calculate the maximum possible length of the strictly increasing contiguous subarray of the remaining array. Recall that the contiguous subar...
import sys def read_ints(): return [int(x) for x in sys.stdin.readline().strip().split()] def main(): N = read_ints()[0] nums = read_ints() pref = [0] * N suf = [0] * N pref[0] = 1 ans = 1 for ix in range(1, N): pref[ix] = 1 + (pref[ix - 1] if nums[ix] > nums[ix - 1] else 0) ...
IMPORT FUNC_DEF RETURN FUNC_CALL VAR VAR VAR FUNC_CALL FUNC_CALL FUNC_CALL VAR FUNC_DEF ASSIGN VAR FUNC_CALL VAR NUMBER ASSIGN VAR FUNC_CALL VAR ASSIGN VAR BIN_OP LIST NUMBER VAR ASSIGN VAR BIN_OP LIST NUMBER VAR ASSIGN VAR NUMBER NUMBER ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR NUMBER VAR ASSIGN VAR VAR BIN_OP NUMBER VA...
You are given an array $a$ consisting of $n$ integers. You can remove at most one element from this array. Thus, the final length of the array is $n-1$ or $n$. Your task is to calculate the maximum possible length of the strictly increasing contiguous subarray of the remaining array. Recall that the contiguous subar...
n = int(input()) arr = [int(x) for x in input().split()] ending = [1] starting = [1] for x in range(1, n): if arr[x] > arr[x - 1]: ending.append(ending[-1] + 1) else: ending.append(1) for x in range(n - 2, -1, -1): if arr[x] < arr[x + 1]: starting.append(starting[-1] + 1) else: ...
ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR LIST NUMBER ASSIGN VAR LIST NUMBER FOR VAR FUNC_CALL VAR NUMBER VAR IF VAR VAR VAR BIN_OP VAR NUMBER EXPR FUNC_CALL VAR BIN_OP VAR NUMBER NUMBER EXPR FUNC_CALL VAR NUMBER FOR VAR FUNC_CALL VAR BIN_OP VAR NUMBER NU...
You are given an array $a$ consisting of $n$ integers. You can remove at most one element from this array. Thus, the final length of the array is $n-1$ or $n$. Your task is to calculate the maximum possible length of the strictly increasing contiguous subarray of the remaining array. Recall that the contiguous subar...
ii = lambda: int(input()) kk = lambda: map(int, input().split()) ll = lambda: list(kk()) n = ii() ls = ll() l, r = [1] * n, [1] * n m = 0 for i in range(1, n): if ls[i] > ls[i - 1]: l[i] = l[i - 1] + 1 for i in range(n - 2, -1, -1): if ls[i] < ls[i + 1]: r[i] = r[i + 1] + 1 for i in range(1, n -...
ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR ASSIGN VAR VAR BIN_OP LIST NUMBER VAR BIN_OP LIST NUMBER VAR ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR NUMBER VAR IF VAR VAR VAR BIN_OP VAR N...
You are given an array $a$ consisting of $n$ integers. You can remove at most one element from this array. Thus, the final length of the array is $n-1$ or $n$. Your task is to calculate the maximum possible length of the strictly increasing contiguous subarray of the remaining array. Recall that the contiguous subar...
import sys n = int(sys.stdin.readline()) a = [int(i) for i in sys.stdin.readline().split()] if n == 1: print(1) elif n == 2: if a[0] < a[1]: print(2) else: print(1) else: arr = [0] * n par = [-1] * n ctr = 1 ans = 1 ind = 0 for g in range(n - 1): if a[g] < a[...
IMPORT ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR VAR FUNC_CALL FUNC_CALL VAR IF VAR NUMBER EXPR FUNC_CALL VAR NUMBER IF VAR NUMBER IF VAR NUMBER VAR NUMBER EXPR FUNC_CALL VAR NUMBER EXPR FUNC_CALL VAR NUMBER ASSIGN VAR BIN_OP LIST NUMBER VAR ASSIGN VAR BIN_OP LIST NUMBER VAR ASSIGN VAR NUMBER ...
You are given an array $a$ consisting of $n$ integers. You can remove at most one element from this array. Thus, the final length of the array is $n-1$ or $n$. Your task is to calculate the maximum possible length of the strictly increasing contiguous subarray of the remaining array. Recall that the contiguous subar...
from sys import exit def iis(): return map(int, input().split()) def ii(): return int(input()) def liis(): return list(map(int, input().split())) n = ii() a = liis() fim = [0] * n fim[0] = 1 tam = 1 for i in range(1, n): if a[i] <= a[i - 1]: tam = 1 fim[i] = tam else: ...
FUNC_DEF RETURN FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR FUNC_DEF RETURN FUNC_CALL VAR FUNC_CALL VAR FUNC_DEF RETURN FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR ASSIGN VAR BIN_OP LIST NUMBER VAR ASSIGN VAR NUMBER NUMBER ASSIGN VAR NUMBER FOR VAR FUNC_CALL V...
You are given an array $a$ consisting of $n$ integers. You can remove at most one element from this array. Thus, the final length of the array is $n-1$ or $n$. Your task is to calculate the maximum possible length of the strictly increasing contiguous subarray of the remaining array. Recall that the contiguous subar...
from sys import stdin read = stdin.readline def main(): n = int(read()) nums = list(map(int, read().strip().split())) inclass, ac, edges, cnt = dict(), 1, list(), 0 for num in nums: inclass[num] = 0 for i in range(len(nums) - 1): if nums[i + 1] > nums[i]: ac += 1 ...
ASSIGN VAR VAR FUNC_DEF ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL FUNC_CALL VAR ASSIGN VAR VAR VAR VAR FUNC_CALL VAR NUMBER FUNC_CALL VAR NUMBER FOR VAR VAR ASSIGN VAR VAR NUMBER FOR VAR FUNC_CALL VAR BIN_OP FUNC_CALL VAR VAR NUMBER IF VAR BIN_OP VAR NUMBER VA...
You are given an array $a$ consisting of $n$ integers. You can remove at most one element from this array. Thus, the final length of the array is $n-1$ or $n$. Your task is to calculate the maximum possible length of the strictly increasing contiguous subarray of the remaining array. Recall that the contiguous subar...
n = int(input()) arr = list(map(int, input().split())) ind = 0 dp = [] co = 0 maxi = 1 for i in range(0, n - 1): if arr[i] >= arr[i + 1]: if ind == i: dp.append([ind]) ind += 1 else: if (len(dp) > 0 and len(dp[-1]) > 1) and ( arr[dp[-1][1] - 1] < a...
ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR NUMBER ASSIGN VAR LIST ASSIGN VAR NUMBER ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR NUMBER BIN_OP VAR NUMBER IF VAR VAR VAR BIN_OP VAR NUMBER IF VAR VAR EXPR FUNC_CALL VAR LIST VAR VAR NUMBER IF FUNC_CALL V...
You are given an array $a$ consisting of $n$ integers. You can remove at most one element from this array. Thus, the final length of the array is $n-1$ or $n$. Your task is to calculate the maximum possible length of the strictly increasing contiguous subarray of the remaining array. Recall that the contiguous subar...
n = int(input()) a = [1e18] + [int(i) for i in input().split()] + [-1] l, r = [0] * (n + 1), [0] * (n + 1) cnt = 0 for i in range(1, n + 1): if a[i] <= a[i - 1]: cnt = 0 cnt += 1 l[i] = cnt for i in reversed(range(1, n + 1)): if a[i] >= a[i + 1]: cnt = 0 cnt += 1 r[i] = cnt ans =...
ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR BIN_OP BIN_OP LIST NUMBER FUNC_CALL VAR VAR VAR FUNC_CALL FUNC_CALL VAR LIST NUMBER ASSIGN VAR VAR BIN_OP LIST NUMBER BIN_OP VAR NUMBER BIN_OP LIST NUMBER BIN_OP VAR NUMBER ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR NUMBER BIN_OP VAR NUMBER IF VAR VAR VAR BIN_OP VAR NUMBER...
You are given an array $a$ consisting of $n$ integers. You can remove at most one element from this array. Thus, the final length of the array is $n-1$ or $n$. Your task is to calculate the maximum possible length of the strictly increasing contiguous subarray of the remaining array. Recall that the contiguous subar...
n = int(input()) a = [int(x) for x in input().split()] l = [(1) for i in range(n)] r = [(1) for i in range(n)] for i in range(1, n): if a[i] > a[i - 1]: l[i] = l[i - 1] + 1 for i in range(n - 2, 0, -1): if a[i] < a[i + 1]: r[i] = r[i + 1] + 1 maxi = -9999999999 p = max(max(l), max(r)) for i in r...
ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR NUMBER VAR FUNC_CALL VAR VAR ASSIGN VAR NUMBER VAR FUNC_CALL VAR VAR FOR VAR FUNC_CALL VAR NUMBER VAR IF VAR VAR VAR BIN_OP VAR NUMBER ASSIGN VAR VAR BIN_OP VAR BIN_OP VAR NUMBER NUMBER FOR VAR FUNC_CALL VAR BIN_O...
You are given an array $a$ consisting of $n$ integers. You can remove at most one element from this array. Thus, the final length of the array is $n-1$ or $n$. Your task is to calculate the maximum possible length of the strictly increasing contiguous subarray of the remaining array. Recall that the contiguous subar...
n = int(input()) lst = [*map(int, input().split())] d, item, j = {(0): 1}, [[lst[0]]], 0 res = 0 for i, x in enumerate(lst[1:]): if x > lst[i]: d[j] += 1 item[-1].append(x) else: res = max(res, d[j]) j += 1 d[j] = 1 item.append([x]) res = max(res, d[j]) for i, x i...
ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR LIST FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR VAR VAR DICT NUMBER NUMBER LIST LIST VAR NUMBER NUMBER ASSIGN VAR NUMBER FOR VAR VAR FUNC_CALL VAR VAR NUMBER IF VAR VAR VAR VAR VAR NUMBER EXPR FUNC_CALL VAR NUMBER VAR ASSIGN VAR FUNC_CALL VAR VAR VAR VAR VAR N...
You are given an array $a$ consisting of $n$ integers. You can remove at most one element from this array. Thus, the final length of the array is $n-1$ or $n$. Your task is to calculate the maximum possible length of the strictly increasing contiguous subarray of the remaining array. Recall that the contiguous subar...
n = int(input().strip()) A = list(map(int, input().strip().split())) max_l = 0 fir_sub_max_l = 0 sec_sub_max_l = 1 last = A[0] sec_last = -1000000000000000000000000000000000 remove_type = "other" for i, a in enumerate(A[1:]): if a > last: sec_sub_max_l += 1 sec_last = last last = a elif ...
ASSIGN VAR FUNC_CALL VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL FUNC_CALL VAR ASSIGN VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR STRING FOR VAR VAR FUNC_CALL VAR VAR NUMBER IF VAR VAR VAR NUMBER ASSIGN VAR VAR ASSIGN V...
You are given an array $a$ consisting of $n$ integers. You can remove at most one element from this array. Thus, the final length of the array is $n-1$ or $n$. Your task is to calculate the maximum possible length of the strictly increasing contiguous subarray of the remaining array. Recall that the contiguous subar...
N = int(input()) A = list(map(int, input().split())) increasing = [1] * N for i in range(1, N): if A[i] > A[i - 1]: increasing[i] = increasing[i - 1] + 1 decreasing = [1] * N for i in range(N - 2, -1, -1): if A[i] < A[i + 1]: decreasing[i] = decreasing[i + 1] + 1 afterRem = [1] * N for i in rang...
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 NUMBER VAR IF VAR VAR VAR BIN_OP VAR NUMBER ASSIGN VAR VAR BIN_OP VAR BIN_OP VAR NUMBER NUMBER ASSIGN VAR BIN_OP LIST NUMBER VAR FOR VAR FUNC_CALL VAR BIN_OP ...
You are given an array $a$ consisting of $n$ integers. You can remove at most one element from this array. Thus, the final length of the array is $n-1$ or $n$. Your task is to calculate the maximum possible length of the strictly increasing contiguous subarray of the remaining array. Recall that the contiguous subar...
n = int(input()) x = [int(i) for i in input().split()] y = x[::-1] lst1 = [1] * n lst2 = [1] * n for i in range(1, n): if x[i - 1] < x[i]: lst1[i] += lst1[i - 1] for i in range(n - 1): if y[i] > y[i + 1]: lst2[-i - 2] += lst2[-i - 1] res = max(lst1) for i in range(n - 2): if x[i + 2] > x[i]:...
ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR VAR NUMBER ASSIGN VAR BIN_OP LIST NUMBER VAR ASSIGN VAR BIN_OP LIST NUMBER VAR FOR VAR FUNC_CALL VAR NUMBER VAR IF VAR BIN_OP VAR NUMBER VAR VAR VAR VAR VAR BIN_OP VAR NUMBER FOR VAR FUNC_CALL VAR BIN_OP VAR NUMBE...
You are given an array $a$ consisting of $n$ integers. You can remove at most one element from this array. Thus, the final length of the array is $n-1$ or $n$. Your task is to calculate the maximum possible length of the strictly increasing contiguous subarray of the remaining array. Recall that the contiguous subar...
n = int(input()) arr = list(map(int, input().split())) dp = [[1, 1] for i in range(n)] for i in range(1, n): if arr[i] > arr[i - 1]: dp[i][1] = dp[i - 1][1] + 1 dp[i][0] = dp[i - 1][0] + 1 if i > 1 and arr[i] > arr[i - 2]: dp[i][1] = max(dp[i][1], dp[i - 2][0] + 1) print(max(max(dp[i]) f...
ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR LIST NUMBER NUMBER VAR FUNC_CALL VAR VAR FOR VAR FUNC_CALL VAR NUMBER VAR IF VAR VAR VAR BIN_OP VAR NUMBER ASSIGN VAR VAR NUMBER BIN_OP VAR BIN_OP VAR NUMBER NUMBER NUMBER ASSIGN VAR VAR NUMBER BIN_OP VA...
You are given an array $a$ consisting of $n$ integers. You can remove at most one element from this array. Thus, the final length of the array is $n-1$ or $n$. Your task is to calculate the maximum possible length of the strictly increasing contiguous subarray of the remaining array. Recall that the contiguous subar...
import sys input = sys.stdin.readline n = int(input()) a = list(map(int, input().split())) dpl = [0] * n dpl[0] = 1 for i in range(1, n): if a[i - 1] < a[i]: dpl[i] = dpl[i - 1] + 1 else: dpl[i] = 1 dpr = [0] * n dpr[-1] = 1 for i in range(n - 2, -1, -1): if a[i] < a[i + 1]: dpr[i] ...
IMPORT ASSIGN VAR VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR BIN_OP LIST NUMBER VAR ASSIGN VAR NUMBER NUMBER FOR VAR FUNC_CALL VAR NUMBER VAR IF VAR BIN_OP VAR NUMBER VAR VAR ASSIGN VAR VAR BIN_OP VAR BIN_OP VAR NUMBER NUMBER ASSIGN VAR VAR N...
You are given an array $a$ consisting of $n$ integers. You can remove at most one element from this array. Thus, the final length of the array is $n-1$ or $n$. Your task is to calculate the maximum possible length of the strictly increasing contiguous subarray of the remaining array. Recall that the contiguous subar...
n = int(input()) l = list(map(int, input().split())) ll = [1] for i in range(1, n): if l[i] > l[i - 1]: ll[-1] += 1 else: ll.append(1) t = 0 ans = max(ll) for i in range(len(ll) - 1): t += ll[i] if ll[i] != 1: end = t - 1 bb = l[end - 1] kk = l[end + 1] if...
ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR LIST NUMBER FOR VAR FUNC_CALL VAR NUMBER VAR IF VAR VAR VAR BIN_OP VAR NUMBER VAR NUMBER NUMBER EXPR FUNC_CALL VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR FUNC_CALL VAR VAR FOR VAR FUNC_CALL VAR BIN_OP FUNC_...
You are given an array $a$ consisting of $n$ integers. You can remove at most one element from this array. Thus, the final length of the array is $n-1$ or $n$. Your task is to calculate the maximum possible length of the strictly increasing contiguous subarray of the remaining array. Recall that the contiguous subar...
n = int(input().strip()) A = list(map(int, input().strip().split())) max_l = 0 dp = 0, 0 last = -10000000000000000000000 for i, a in enumerate(A): if a > last: dp = dp[0] + 1, dp[1] + 1 elif i > 1 and a > A[i - 2] or i < n - 1 and A[i + 1] > A[i - 1]: dp = 1, dp[0] else: dp = 1, 1 ...
ASSIGN VAR FUNC_CALL VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL FUNC_CALL VAR ASSIGN VAR NUMBER ASSIGN VAR NUMBER NUMBER ASSIGN VAR NUMBER FOR VAR VAR FUNC_CALL VAR VAR IF VAR VAR ASSIGN VAR BIN_OP VAR NUMBER NUMBER BIN_OP VAR NUMBER NUMBER IF VAR NUMBER VAR VAR BIN_OP VA...
You are given an array $a$ consisting of $n$ integers. You can remove at most one element from this array. Thus, the final length of the array is $n-1$ or $n$. Your task is to calculate the maximum possible length of the strictly increasing contiguous subarray of the remaining array. Recall that the contiguous subar...
n = int(input()) xs = [int(x) for x in input().split()] dp0 = [(1) for _ in range(n)] dp1 = [(1) for _ in range(n)] for i in range(1, n): dp0[i] = dp0[i - 1] + 1 if xs[i] > xs[i - 1] else 1 if i > 1: left = dp1[i - 1] + 1 if xs[i] > xs[i - 1] else 1 right = dp0[i - 2] + 1 if xs[i] > xs[i - 2] el...
ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR NUMBER VAR FUNC_CALL VAR VAR ASSIGN VAR NUMBER VAR FUNC_CALL VAR VAR FOR VAR FUNC_CALL VAR NUMBER VAR ASSIGN VAR VAR VAR VAR VAR BIN_OP VAR NUMBER BIN_OP VAR BIN_OP VAR NUMBER NUMBER NUMBER IF VAR NUMBER ASSIGN VA...
You are given an array $a$ consisting of $n$ integers. You can remove at most one element from this array. Thus, the final length of the array is $n-1$ or $n$. Your task is to calculate the maximum possible length of the strictly increasing contiguous subarray of the remaining array. Recall that the contiguous subar...
n = int(input()) dp = [[0, 0] for i in range(n)] dp[0] = [1, 1] t = list(map(int, input().split())) for j in range(1, n): if t[j] > t[j - 1]: dp[j][0] = dp[j - 1][0] + 1 dp[j][1] = dp[j - 1][1] + 1 else: dp[j][0] = 1 dp[j][1] = 1 if j >= 2 and t[j] > t[j - 2]: dp[j][1...
ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR LIST NUMBER NUMBER VAR FUNC_CALL VAR VAR ASSIGN VAR NUMBER LIST NUMBER NUMBER ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR FOR VAR FUNC_CALL VAR NUMBER VAR IF VAR VAR VAR BIN_OP VAR NUMBER ASSIGN VAR VAR NUMBER BIN_OP VAR BIN_OP VAR NUMBER NUMBER N...
You are given an array $a$ consisting of $n$ integers. You can remove at most one element from this array. Thus, the final length of the array is $n-1$ or $n$. Your task is to calculate the maximum possible length of the strictly increasing contiguous subarray of the remaining array. Recall that the contiguous subar...
n = int(input()) a = [int(x) for x in input().split()] l = [(1) for _ in range(n)] r = [(1) for _ in range(n)] for i in range(1, n): if a[i] > a[i - 1]: l[i] = l[i - 1] + 1 for i in range(n - 2, -1, -1): if a[i] < a[i + 1]: r[i] = r[i + 1] + 1 ans = max(l) for i in range(n - 2): if a[i] < a[...
ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR NUMBER VAR FUNC_CALL VAR VAR ASSIGN VAR NUMBER VAR FUNC_CALL VAR VAR FOR VAR FUNC_CALL VAR NUMBER VAR IF VAR VAR VAR BIN_OP VAR NUMBER ASSIGN VAR VAR BIN_OP VAR BIN_OP VAR NUMBER NUMBER FOR VAR FUNC_CALL VAR BIN_O...
You are given an array $a$ consisting of $n$ integers. You can remove at most one element from this array. Thus, the final length of the array is $n-1$ or $n$. Your task is to calculate the maximum possible length of the strictly increasing contiguous subarray of the remaining array. Recall that the contiguous subar...
from sys import stdin, stdout n = stdin.readline() n = int(n) total = stdin.readline().split() ar = [] for i in total: ar.append(int(i)) lt = [1] * n rt = [1] * n ans = int(0) for i in range(1, n): if ar[i - 1] < ar[i]: lt[i] = lt[i - 1] + 1 ans = max(ans, lt[i]) for i in range(n - 2, -1, -1): ...
ASSIGN VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR LIST FOR VAR VAR EXPR FUNC_CALL VAR FUNC_CALL VAR VAR ASSIGN VAR BIN_OP LIST NUMBER VAR ASSIGN VAR BIN_OP LIST NUMBER VAR ASSIGN VAR FUNC_CALL VAR NUMBER FOR VAR FUNC_CALL VAR NUMBER VAR IF VAR BIN_OP VAR NUMBER VAR VAR ...
You are given an array $a$ consisting of $n$ integers. You can remove at most one element from this array. Thus, the final length of the array is $n-1$ or $n$. Your task is to calculate the maximum possible length of the strictly increasing contiguous subarray of the remaining array. Recall that the contiguous subar...
n = int(input()) a = [int(i) for i in input().split()] b1 = [1] * n b2 = [1] * n for i in range(1, n): if a[i - 1] < a[i]: b1[i] = max(b1[i - 1] + 1, b1[i]) b2[i] = max(b2[i - 1] + 1, b2[i]) if i < n - 1 and a[i - 1] < a[i + 1]: b2[i + 1] = b1[i - 1] + 1 print(max(b2))
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 BIN_OP LIST NUMBER VAR FOR VAR FUNC_CALL VAR NUMBER VAR IF VAR BIN_OP VAR NUMBER VAR VAR ASSIGN VAR VAR FUNC_CALL VAR BIN_OP VAR BIN_OP VAR NUMBER NUMBER VAR VAR ASSIGN VAR VAR FU...
You are given an array $a$ consisting of $n$ integers. You can remove at most one element from this array. Thus, the final length of the array is $n-1$ or $n$. Your task is to calculate the maximum possible length of the strictly increasing contiguous subarray of the remaining array. Recall that the contiguous subar...
def solve(): n = int(input()) nums = [int(x) for x in input().split()] dp = [([1] * n) for i in range(2)] flag = [0] * n if n == 0: print(0) return if n == 1: print(1) return if n == 2: if nums[0] < nums[1]: print(2) else: ...
FUNC_DEF 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 VAR FUNC_CALL VAR NUMBER ASSIGN VAR BIN_OP LIST NUMBER VAR IF VAR NUMBER EXPR FUNC_CALL VAR NUMBER RETURN IF VAR NUMBER EXPR FUNC_CALL VAR NUMBER RETURN IF VAR NUMBER IF VAR NUMBER ...
You are given an array $a$ consisting of $n$ integers. You can remove at most one element from this array. Thus, the final length of the array is $n-1$ or $n$. Your task is to calculate the maximum possible length of the strictly increasing contiguous subarray of the remaining array. Recall that the contiguous subar...
import sys N = int(sys.stdin.readline()) a = list(map(int, sys.stdin.readline().split())) list_check = [1] * N list_check.append(0) list_r = [(1) for _ in range(N)] for i in range(1, N): if a[i] > a[i - 1]: list_check[i] += list_check[i - 1] list_check_r = list_check[:] s, e = 0, 1 while s <= e and e < N: ...
IMPORT ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR BIN_OP LIST NUMBER VAR EXPR FUNC_CALL VAR NUMBER ASSIGN VAR NUMBER VAR FUNC_CALL VAR VAR FOR VAR FUNC_CALL VAR NUMBER VAR IF VAR VAR VAR BIN_OP VAR NUMBER VAR VAR VAR BIN_OP VAR NUMBER ASSIGN VAR ...
You are given an array $a$ consisting of $n$ integers. You can remove at most one element from this array. Thus, the final length of the array is $n-1$ or $n$. Your task is to calculate the maximum possible length of the strictly increasing contiguous subarray of the remaining array. Recall that the contiguous subar...
import sys def input(): return sys.stdin.readline().strip() def list2d(a, b, c): return [([c] * b) for i in range(a)] def list3d(a, b, c, d): return [[([d] * c) for j in range(b)] for i in range(a)] def list4d(a, b, c, d, e): return [[[([e] * d) for j in range(c)] for j in range(b)] for i in ran...
IMPORT FUNC_DEF RETURN FUNC_CALL FUNC_CALL VAR FUNC_DEF RETURN BIN_OP LIST VAR VAR VAR FUNC_CALL VAR VAR FUNC_DEF RETURN BIN_OP LIST VAR VAR VAR FUNC_CALL VAR VAR VAR FUNC_CALL VAR VAR FUNC_DEF RETURN BIN_OP LIST VAR VAR VAR FUNC_CALL VAR VAR VAR FUNC_CALL VAR VAR VAR FUNC_CALL VAR VAR FUNC_DEF NUMBER RETURN FUNC_CALL ...
You are given an array $a$ consisting of $n$ integers. You can remove at most one element from this array. Thus, the final length of the array is $n-1$ or $n$. Your task is to calculate the maximum possible length of the strictly increasing contiguous subarray of the remaining array. Recall that the contiguous subar...
n = int(input()) li = list(map(int, input().split())) arr = [] p = 0 b = [] ans = [] for i in range(n - 1): if p == 0: b.append(i) p = 1 if li[i] < li[i + 1]: p += 1 else: b.append(i) arr.append(b) ans.append(p) b = [] p = 0 if p != 0: b.ap...
ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR LIST ASSIGN VAR NUMBER ASSIGN VAR LIST ASSIGN VAR LIST FOR VAR FUNC_CALL VAR BIN_OP VAR NUMBER IF VAR NUMBER EXPR FUNC_CALL VAR VAR ASSIGN VAR NUMBER IF VAR VAR VAR BIN_OP VAR NUMBER VAR NUMBER EXPR FUNC...
You are given an array $a$ consisting of $n$ integers. You can remove at most one element from this array. Thus, the final length of the array is $n-1$ or $n$. Your task is to calculate the maximum possible length of the strictly increasing contiguous subarray of the remaining array. Recall that the contiguous subar...
def max_length(length, arr): sub_arr_1 = [1] * length sub_arr_2 = [1] * length for j in range(length - 2, -1, -1): if arr[j] < arr[j + 1]: sub_arr_1[j] = sub_arr_1[j + 1] + 1 sub_arr_2[j] = sub_arr_2[j + 1] + 1 if j + 2 < length and arr[j] < arr[j + 2]: su...
FUNC_DEF ASSIGN VAR BIN_OP LIST NUMBER VAR ASSIGN VAR BIN_OP LIST NUMBER VAR FOR VAR FUNC_CALL VAR BIN_OP VAR NUMBER NUMBER NUMBER IF VAR VAR VAR BIN_OP VAR NUMBER ASSIGN VAR VAR BIN_OP VAR BIN_OP VAR NUMBER NUMBER ASSIGN VAR VAR BIN_OP VAR BIN_OP VAR NUMBER NUMBER IF BIN_OP VAR NUMBER VAR VAR VAR VAR BIN_OP VAR NUMBER...
You are given an array $a$ consisting of $n$ integers. You can remove at most one element from this array. Thus, the final length of the array is $n-1$ or $n$. Your task is to calculate the maximum possible length of the strictly increasing contiguous subarray of the remaining array. Recall that the contiguous subar...
n = int(input()) a = list(map(int, input().split())) d = [] for i in range(0, n - 1): d.append(a[i + 1] - a[i]) i = 0 flag = 0 j = 0 t = [] while i < n - 1: count = 0 while i < n - 1 and d[i] > 0: i = i + 1 count = count + 1 t.append([i, count + 1]) if i == n - 1 and count + 1 == 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 FOR VAR FUNC_CALL VAR NUMBER BIN_OP VAR NUMBER EXPR FUNC_CALL VAR BIN_OP VAR BIN_OP VAR NUMBER VAR VAR ASSIGN VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR LIST WHILE VAR BIN_OP VAR NUMB...
You are given an array $a$ consisting of $n$ integers. You can remove at most one element from this array. Thus, the final length of the array is $n-1$ or $n$. Your task is to calculate the maximum possible length of the strictly increasing contiguous subarray of the remaining array. Recall that the contiguous subar...
n = int(input()) l = list(map(int, input().split())) sufinc = [1] * n count = 1 for i in range(n - 2, -1, -1): if l[i] < l[i + 1]: count += 1 sufinc[i] = count else: count = 1 sufinc[i] = count preinc = [1] * n count = 1 for i in range(1, n): if l[i] > l[i - 1]: count...
ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR BIN_OP LIST NUMBER VAR ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR BIN_OP VAR NUMBER NUMBER NUMBER IF VAR VAR VAR BIN_OP VAR NUMBER VAR NUMBER ASSIGN VAR VAR VAR ASSIGN VAR NUMBER ASSIGN VAR VAR VAR ASSIGN V...
You are given an array $a$ consisting of $n$ integers. You can remove at most one element from this array. Thus, the final length of the array is $n-1$ or $n$. Your task is to calculate the maximum possible length of the strictly increasing contiguous subarray of the remaining array. Recall that the contiguous subar...
n = int(input()) lis = list(map(int, input().split())) dp = [0] * len(lis) for i in range(len(lis) - 1, -1, -1): if i == len(lis) - 1: dp[i] = 1 continue if lis[i] < lis[i + 1]: dp[i] = dp[i + 1] + 1 else: dp[i] = 1 dp2 = [0] * len(lis) for i in range(len(lis)): if i == 0...
ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR BIN_OP LIST NUMBER FUNC_CALL VAR VAR FOR VAR FUNC_CALL VAR BIN_OP FUNC_CALL VAR VAR NUMBER NUMBER NUMBER IF VAR BIN_OP FUNC_CALL VAR VAR NUMBER ASSIGN VAR VAR NUMBER IF VAR VAR VAR BIN_OP VAR NUMBER ASSI...