TnT/Multi_CodeNet4Repair huggingface dataset:
Problem: You are given a sequence of length N: A_1, A_2, ..., A_N. For each integer i between 1 and N (inclusive), answer the following question:    * Find the maximum value among the N-1 elements other than A_i in the sequence.

Submission attempts (in order):
L=list()
N=int(input())
for i in range(N):
  a=int(input())
  L.append(a)
L=L.sorted(L)
c=L[-1]
d=L[-2]
for i in range(N):
  if L[i]==c:
    print(d)
  else:
    print(c)

L=list()
N=int(input())
for i in range(N):
  a=int(input())
  L.append(a)
c=max(L)
d=sorted(L)[-2]
for i in range(N):
  if L[i]==c:
    print(d)
  else:
    print(c)

Verdicts: Runtime Error

Accepted
Problem: You are given a sequence of length N: A_1, A_2, ..., A_N. For each integer i between 1 and N (inclusive), answer the following question:    * Find the maximum value among the N-1 elements other than A_i in the sequence.

Submission attempts (in order):
N = int(input())
a = []
b = 0
a.append(int(input()))


for i in range(N):
    b = a[i]
    a[i] = 0
    print(max(a))
    a[i] = b


n=int(input())
a=[int(input()) for i in range(n)]
l=[0]*n
r=[0]*n
t=0
for i in range(n):
  t=max(t,a[i])
  l[i]=t
t=0
for i in range(n-1,-1,-1):
  t=max(t,a[i])
  r[i]=t
# print(l)
# print(r)
for i in range(n):
  if i==0:
    print(r[i+1])
    continue
  if i==n-1:
    print(l[i-1])
    continue
  print(max(r[i+1],l[i-1]))


Verdicts: Runtime Error

Accepted
Problem: You are given a sequence of length N: A_1, A_2, ..., A_N. For each integer i between 1 and N (inclusive), answer the following question:    * Find the maximum value among the N-1 elements other than A_i in the sequence.

Submission attempts (in order):
# -*- coding: utf-8 -*-

n = int(input())
a = ["" for _ in range(n)]

for i in range(n):
    a[i] = int(input())


ans = ["" for _ in range(n)]
for i in range(n):
    a_test = a[:]
    del a_test[i]
    ans[i] = max(a_test)

print(ans)


# -*- coding: utf-8 -*-

n = int(input())
a = [int(input()) for _ in range(n)]

max_a = max(a)
b = a[:]
b.remove(max_a)
max_b = max(b)

if max_a == max_b:
    for i in range(n):
        print(max_a)
else:
    idx = a.index(max_a)
    for i in range(n):
        if idx == i:
            print(max_b)
        else:
            print(max_a)

Verdicts: Wrong Answer

Accepted
Problem: You are given a sequence of length N: A_1, A_2, ..., A_N. For each integer i between 1 and N (inclusive), answer the following question:    * Find the maximum value among the N-1 elements other than A_i in the sequence.

Submission attempts (in order):
N = int(input())
a = [int(input()) for i in range(N)]
a.sort(reverse=True)
amax = a[0]
for i in range(len(a)):
  if a[i]==amax:
    print(a[i+1])
  else:
    print(amax)

N = int(input())
a = [int(input()) for i in range(N)]
a.sort(reverse=True)
amax = a[0]
for i in range(len(a)):
  if a[i]==amax:
    print(a[1])
  else:
    print(amax)

N = int(input())
a = [int(input()) for i in range(N)]
a.sort(reverse=True)
amax = a[0]
amax2 = a[1]
for i in range(len(a)):
  if a[i]==amax:
    print(amax2)
  else:
    print(amax)

N = int(input())
a = [int(input()) for i in range(N)]
amax = max(a)
amax2 = sorted(a)[-2]
print(amax, amax2)
for i in range(len(a)):
  if a[i]==amax:
    print(amax2)
  else:
    print(amax)

N = int(input())
a = [int(input()) for i in range(N)]
amax = max(a)
amax2 = sorted(a)[-2]
for i in range(len(a)):
  if a[i]==amax:
    print(amax2)
  else:
    print(amax)

Verdicts: Runtime Error

Wrong Answer

Wrong Answer

Wrong Answer

Accepted
Problem: You are given a sequence of length N: A_1, A_2, ..., A_N. For each integer i between 1 and N (inclusive), answer the following question:    * Find the maximum value among the N-1 elements other than A_i in the sequence.

Submission attempts (in order):
n = int(input())
a = list(map(int,[input() for i in range(n)]))
a_set = set(a)

for num in a:
  print(max(a))

N = int(input())
A = []
for i in range(N):
    A.append(int(input()))
max_A = max(A)
max_num = 0
for i in range(N):
    if A[i] == max_A:
        
        max_num += 1
        if max_num > 1:
            print(max_A)
        else:
            print(max(A[:i] + A[i + 1:]))
    else:
        print(max_A)

Verdicts: Wrong Answer

Accepted
Problem: You are given a sequence of length N: A_1, A_2, ..., A_N. For each integer i between 1 and N (inclusive), answer the following question:    * Find the maximum value among the N-1 elements other than A_i in the sequence.

Submission attempts (in order):
n=int(input());
num_list=[];
for i in range(n):
    num_list.append(int(input()));
    m=max(num_list)
for j in range(n):
    if(num_list[j]==m):
        num_list[j]=0;
        print(max(num_list))
    print(m);


n=int(input())
num_list=[]
top1=0
top2=0
for i in range(n):
    num_list.append(int(input()))
    if top1<num_list[i]:
        top1=num_list[i]
    elif top2<num_list[i]:
        top2=num_list[i]
for j in range(n):
    if num_list[j]==top1:
        print(top2)
    else:
        print(top1)


Verdicts: Wrong Answer

Accepted
Problem: You are given a sequence of length N: A_1, A_2, ..., A_N. For each integer i between 1 and N (inclusive), answer the following question:    * Find the maximum value among the N-1 elements other than A_i in the sequence.

Submission attempts (in order):
N = int(input())
A = list(map(int, input()))
m, i = 0, -1
for j in range(len(A)):
  if A[j] > m:
    m, i = A[j], j
B = A[:]
B.remove(m)
M = max(B)
for k in range(len(A)):
  if k != i:
    A[k] = m
  else:
    A[k] = M
for l in range(len(A)):
  print(A[l])

N = int(input())
A = []
for c in range(N):
  A.append(int(input()))
m, i = 0, -1
for j in range(len(A)):
  if A[j] > m:
    m, i = A[j], j
B = A[:]
B.remove(m)
M = max(B)
for k in range(len(A)):
  if k != i:
    A[k] = m
  else:
    A[k] = M
for l in range(len(A)):
  print(A[l])

Verdicts: Runtime Error

Accepted
Problem: You are given a sequence of length N: A_1, A_2, ..., A_N. For each integer i between 1 and N (inclusive), answer the following question:    * Find the maximum value among the N-1 elements other than A_i in the sequence.

Submission attempts (in order):
n = int(input())
a = [0]*(n)
num = 0
max = 0
smax = 0
for i in range(n):
    a[i] = int(input())
for i in range(n):
    if a[i] > max:
        max = a[i]
        num = i
for j in range(n):
    if j != i:
        if a[j] > smax:
            smax = a[j]
for j in range(n):
    if j == i:
        max = smax
    print(max)

n = int(input())
a = [0]*(n)
num = 0
max = 0
smax = 0
for i in range(n):
    a[i] = int(input())
for i in range(n):
    if a[i] > max:
        max = a[i]
        num = i
for j in range(n):
    if j != i:
        if a[j] > smax:
            smax = a[j]
for j in range(n):
    if j == num:
        max = smax
    print(max)

n = int(input())
a = [int(input()) for i in range(n)]
num = a.index(max(a))
a_max = max(a)
a_second = sorted(a)[-2]
for i in range(n):
    if i == num:
        print(a_second)
    else:
        print(a_max)


Verdicts: Wrong Answer

Wrong Answer

Accepted
Problem: You are given a sequence of length N: A_1, A_2, ..., A_N. For each integer i between 1 and N (inclusive), answer the following question:    * Find the maximum value among the N-1 elements other than A_i in the sequence.

Submission attempts (in order):
from sys import stdin
n = int(stdin.readline().rstrip())
li = list(int(stdin.readline().rstrip()) for _ in range(n))
one = max(li)
two = sorted(li)[-2]
for i in range(n):
    if max(li) == li[i]:
        print(two)
    else:
        print(max(one))

from sys import stdin
n = int(stdin.readline().rstrip())
li = list(int(stdin.readline().rstrip()) for _ in range(n))
one = max(li)
two = li[-2]
for i in range(n):
    if max(li) == li[i]:
        print(two)
    else:
        print(one)

from sys import stdin

n = int(stdin.readline().rstrip())
li = list(int(stdin.readline().rstrip()) for _ in range(n))

for i in range(n-1):
    if max(li) == li[i]:
        if i == 0:
            a = [0]
            b = li[i+1:]
        else:
            a = li[:i]
            b = li[i+1:]
    else:
        print(max(li))
print(max(li[:n]))   

from sys import stdin
n = int(stdin.readline().rstrip())
li = list(int(stdin.readline().rstrip()) for _ in range(n))
one = max(li)
two = sorted(li)[-2]
for i in range(n):
    if max(li) == li[i]:
        print(two)
    else:
        print(max(one)

from sys import stdin
n = int(stdin.readline().rstrip())
li = list(int(stdin.readline().rstrip()) for _ in range(n))
li_to = sorted(li)
one = li_to[-1]
two = li_to[-2]
for i in range(n):
    if one == li[i]:
        print(two)
    else:
        print(one)

Verdicts: Runtime Error

Wrong Answer

Wrong Answer

Runtime Error

Accepted
Problem: You are given a sequence of length N: A_1, A_2, ..., A_N. For each integer i between 1 and N (inclusive), answer the following question:    * Find the maximum value among the N-1 elements other than A_i in the sequence.

Submission attempts (in order):


n=int(input())
a=[int(input()) for i in range(n)]
m1=max(a)
m2=sorted(a,reverse=True)[1]
for i in range(n):
    if m==a[i]:
        print(m2)
    else:
        print(m1)




n=int(input())
a=[int(input()) for i in range(n)]
m1=max(a)
m2=sorted(a,reverse=True)[1]
for i in range(n):
    if m1==a[i]:
        print(m2)
    else:
        print(m1)


Verdicts: Runtime Error

Accepted
Problem: You are given a sequence of length N: A_1, A_2, ..., A_N. For each integer i between 1 and N (inclusive), answer the following question:    * Find the maximum value among the N-1 elements other than A_i in the sequence.

Submission attempts (in order):
n = int(input())
list = []
for i in range(0,n):
  list.append(int(input()))
  
new_list = sorted(list, reverse=True)
for lst in new_list:
  print(lst)

n = int(input())
list = []
for i in range(0,n):
  list.append(int(input()))
  
new_list = sorted(list, reverse=True)
print lst in new_list:
  print(lst)

n = int(input())
lst = []
for i in range(0,n):
  lst.append(int(input()))
  
sort_lst = lst[:]
sort_lst.sort(reverse=True)
m = sort_lst[0]
m_s = max = sort_lst[1]
for i in range(0,len(lst)):
  if not lst[i] == m:
    print(m)
  else:
    print(m_s)

Verdicts: Wrong Answer

Runtime Error

Accepted
Problem: You are given a sequence of length N: A_1, A_2, ..., A_N. For each integer i between 1 and N (inclusive), answer the following question:    * Find the maximum value among the N-1 elements other than A_i in the sequence.

Submission attempts (in order):
#import numpy as np
#from itertools import combinations as comb
#from itertools import combinations_with_replacement as comb_with
from itertools import permutations as perm


N = int(input())
#H1,M1,H2,M2,K= map(int,input().split())
#A = list(map(int,input().split()))
#B = list(map(int,input().split()))
#S= str(input())
l=[]
for i in range(N):
    B = int(input())
    l.append(B)

for i in range(N):
    a=l.pop(i)
    m=max(l)
    print(m,l,i)
    l.insert(i,a)


#import numpy as np
#from itertools import combinations as comb
#from itertools import combinations_with_replacement as comb_with
from itertools import permutations as perm


N = int(input())
#H1,M1,H2,M2,K= map(int,input().split())
#A = list(map(int,input().split()))
#B = list(map(int,input().split()))
#S= str(input())
l=[]
for i in range(N):
    B = int(input())
    l.append(B)
m=max(l)
x=l.copy()
x.remove(m)
n=max(x)
for i in l:
    if i!=m:
        print(m)
    else:
        print(n)


Verdicts: Wrong Answer

Accepted
Problem: You are given a sequence of length N: A_1, A_2, ..., A_N. For each integer i between 1 and N (inclusive), answer the following question:    * Find the maximum value among the N-1 elements other than A_i in the sequence.

Submission attempts (in order):
N = int(input())
L = []
for l in range(N):
	L.append(int(input()))

maxL = max(L)
num = ["n"] * N

if L.count(maxL) >= 2:
	for i in range(N):
		print(maxL)
		
else:
	L = L.remove(maxL)
	secL = max(L)
	
	for i in range(N):
		if i in num:
			print(secL)
		else:
			print(maxL)


N = int(input())
L = []
for l in range(N):
	L.append(int(input()))

maxL = max(L)
subL = L
num = ["n"] * N

if L.count(maxL) >= 2:
	for i in range(N):
		print(maxL)
		
else:	
	for i in range(N):
		if L[i] == maxL:
			L[i] = 0
			print(max(L))
		else:
			print(maxL)

Verdicts: Runtime Error

Accepted
Problem: You are given a sequence of length N: A_1, A_2, ..., A_N. For each integer i between 1 and N (inclusive), answer the following question:    * Find the maximum value among the N-1 elements other than A_i in the sequence.

Submission attempts (in order):
N = int(input())
A = [int(input()) for _ in range(N)]

ans = []
front_max = back_max = 0

for i in reversed(range(N)):
    now = A[-1]
    A[-1] = 0
    front_max = max(A) if A else 0
    ans.append(max(front_max, back_max))
    back_max = max(now, back_max)

for i in reversed(range(N)):
    print(ans[i])


N = int(input())
A = [int(input()) for _ in range(N)]

A_ = sorted(A, reverse=True)
first, second = A_[0], A_[1]

for i in range(N):
    if A[i] != first:
        print(first)
    else:
        print(second)


Verdicts: Wrong Answer

Accepted
Problem: You are given a sequence of length N: A_1, A_2, ..., A_N. For each integer i between 1 and N (inclusive), answer the following question:    * Find the maximum value among the N-1 elements other than A_i in the sequence.

Submission attempts (in order):
N = int(input())
A = tuple(int(input()) for i in range(N)

B = list(A)

for j in range(N):
    B.pop(j)
    print(max(B))
    B = list(A)

N = int(input())
A = list(int(input()) for i in range(N))

max_value = max(A)
number = A.count(max_value)

if number > 1:
    for j in range(N):
        print(max_value)
else:
    position = A.index(max_value)
    A.remove(max_value)
    for j in range(N):
        if j == position:
            print(max(A))
        else:
            print(max_value)

Verdicts: Runtime Error

Accepted
Problem: You are given a sequence with N integers: A = \\{ A_1, A_2, \cdots, A_N \\}. For each of these N integers, we will choose a color and paint the integer with that color. Here the following condition must be satisfied:    * If A_i and A_j (i < j) are painted with the same color, A_i < A_j.  Find the minimum number of colors required to satisfy the condition.

Submission attempts (in order):
import sys
def input(): return sys.stdin.readline().strip()
def mapint(): return map(int, input().split())
sys.setrecursionlimit(10**9)

N = int(input())
As = [-int(input()) for _ in range(N)]

from bisect import bisect_left
lis = [1]
for a in As:
    if a>=lis[-1]:
        lis.append(a)
    else:
        lis[bisect_left(lis, a)-1] = a

print(len(lis))

N = int(input())
As = [int(input()) for _ in range(N)]
from bisect import bisect_right

def LIS(L):
    dp = [L[0]]
    length = len(L)
    for i in range(1, length):
        print(dp)
        a = L[i]
        if a >= dp[-1]:
            dp.append(a)
        else:
            dp[bisect_right(dp, a)] = a
    return dp

print(len(LIS(As[::-1])))

import sys
def input(): return sys.stdin.readline().strip()
def mapint(): return map(int, input().split())
sys.setrecursionlimit(10**9)

N = int(input())
As = [-int(input()) for _ in range(N)]

from bisect import bisect_right
lis = [1]
for a in As:
    if a>=lis[-1]:
        lis.append(a)
    else:
        lis[bisect_right(lis, a)] = a

print(len(lis))

Verdicts: Wrong Answer

Runtime Error

Accepted
Problem: You are given a sequence with N integers: A = \\{ A_1, A_2, \cdots, A_N \\}. For each of these N integers, we will choose a color and paint the integer with that color. Here the following condition must be satisfied:    * If A_i and A_j (i < j) are painted with the same color, A_i < A_j.  Find the minimum number of colors required to satisfy the condition.

Submission attempts (in order):
N = int(input())
A = [map(int, input()) for i in range(N)]

count = 0
temp = []
tempin = []
for i in range(N):
  if i in tempin:
    continue
  temp.append(A[i])
  for j in range(i+1, N):
    if j in tempin:
      continue
    elif temp[-1] < A[j]:
      temp.append(A[j])
      tempin.append(j)
  else:
    print(tempin)
    count += 1

print(count)

N = int(input())
A = [int(input()) for i in range(N)]

count = 0
temp = []
tempin = []
for i in range(N):
  if i in tempin:
    continue
  temp.append(A[i])
  for j in range(i+1, N):
    if j in tempin:
      continue
    elif temp[-1] < A[j]:
      temp.append(A[j])
      tempin.append(j)
  else:
    print(tempin)
    count += 1

print(count)


N = int(input())
A = [int(input()) for i in range(N)]

import bisect
from collections import deque

temp = deque()
temp.appendleft(A[0])
for i in range(1,N):
  if temp[0] >= A[i]:
    temp.appendleft(A[i])
  else:
    temp[bisect.bisect_left(temp,A[i])-1] = A[i]
print(len(temp))

Verdicts: Runtime Error

Wrong Answer

Accepted
Problem: You are given a sequence with N integers: A = \\{ A_1, A_2, \cdots, A_N \\}. For each of these N integers, we will choose a color and paint the integer with that color. Here the following condition must be satisfied:    * If A_i and A_j (i < j) are painted with the same color, A_i < A_j.  Find the minimum number of colors required to satisfy the condition.

Submission attempts (in order):
n=int(input())
a=[int(input())]
for i in range(n-1):
    t=int(input())
    b=bisect.bisect_left(a[::-1], t)
    if b==0:
        a.append(t)
    else:
        a[-b]=t
print(len(a))

import bisect
from collections import deque
n=int(input())
a=deque([int(input())])
for i in range(n-1):
    t=int(input())
    b=bisect.bisect_left(a, t)
    if b==0:
        a.appendleft(t)
    else:
        a[b-1]=t
    #print(a)
print(len(a))

Verdicts: Runtime Error

Accepted
Problem: You are given a sequence with N integers: A = \\{ A_1, A_2, \cdots, A_N \\}. For each of these N integers, we will choose a color and paint the integer with that color. Here the following condition must be satisfied:    * If A_i and A_j (i < j) are painted with the same color, A_i < A_j.  Find the minimum number of colors required to satisfy the condition.

Submission attempts (in order):
n = int(input())
dat = []
for i in range(n):
    dat.append(int(input()))
res = []
res.append(0 - dat[0])

import bisect

for i in range(1, n):
    print(res)
    a = bisect.bisect_right(res, 0 - dat[i])
    print("a={0}".format(a))

    if a == len(res):
        res.append( (0 - dat[i]) )
    else:
        res[a] = (0 - dat[i])

print(len(res))

n = int(input())
dat = []
for i in range(n):
    dat.append(int(input()))
res = []
res.append(0 - dat[0])

import bisect

for i in range(1, n):
    #print(res)
    a = bisect.bisect_right(res, 0 - dat[i])
    #print("a={0}".format(a))

    if a == len(res):
        res.append( (0 - dat[i]) )
    else:
        res[a] = (0 - dat[i])

print(len(res))

Verdicts: Runtime Error

Accepted
Problem: You are given a sequence with N integers: A = \\{ A_1, A_2, \cdots, A_N \\}. For each of these N integers, we will choose a color and paint the integer with that color. Here the following condition must be satisfied:    * If A_i and A_j (i < j) are painted with the same color, A_i < A_j.  Find the minimum number of colors required to satisfy the condition.

Submission attempts (in order):
from heapq import*
(N,M),*t=[map(int,s.split())for s in open(0)]
q=[0]*10**5
v=[[]for _ in q]
z=0
for a,b in t:v[a-1]+=[b]
for i in v[:M]:
	for j in i:heappush(q,-j)
	z-=heappop(q)
print(z)

from heapq import*
(N,M),*t=[map(int,s.split())for s in open(0)]
q=[0]*7**6
v=[[]for _ in q]
z=0
for a,b in t:v[a-1]+=[b]
for i in v[:M]:
	for j in i:heappush(q,-j)
	z-=heappop(q)
print(z)

from heapq import*
(n,m),*t=[map(int,s.split())for s in open(0)]
q=[0]*7**6
v=[[]for _ in q]
z=0
for a,b in t:
  v[a-1]+=[b]
for i in v[:m]:
  for j in i:
    heappush(q,-j)
  z-=heappop(q)
print(z)

import sys
input = sys.stdin.readline
n = int(input())
if n == 1:
  print(1)
  exit()
  
chk = []
for i in range(n):
  a = int(input())
  chk.append(a)
  
from bisect import bisect_left,insort_left
from collections import deque
ans = 0

c = deque([])
for j in chk:
  if i == 0:
    c.append(j)
  else:
    ind = bisect_left(c,j)
    if ind == 0:
      ans += 1
      c.appendleft(j)
    else:
      c[ind-1] = (j)
      
print(ans)

Verdicts: Runtime Error

Runtime Error

Runtime Error

Accepted
Problem: You are given a sequence with N integers: A = \\{ A_1, A_2, \cdots, A_N \\}. For each of these N integers, we will choose a color and paint the integer with that color. Here the following condition must be satisfied:    * If A_i and A_j (i < j) are painted with the same color, A_i < A_j.  Find the minimum number of colors required to satisfy the condition.

Submission attempts (in order):
import bisect
N = int(input())
A = [int(input()) for n in range(N)]

tree = [[A[0]]]
leaf = [A[0]]
for n in range(1,N):
    a = A[n]
    pos = min(n-1,bisect.bisect_left(leaf,a)-1)
    if pos==-1:
        tree = a + tree
        leaf = a + leaf
    else:
        tree[pos].append(a)
        leaf[pos] = a
print(len(tree))

import bisect
N = int(input())
A = [int(input()) for n in range(N)]

tree = [[A[0]]]
leaf = [A[0]]
for n in range(1,N):
    a = A[n]
    pos = min(n-1,bisect.bisect_left(leaf,a)-1)
    if pos==-1:
        tree = [a] + tree
        leaf = [a] + leaf
    else:
        tree[pos].append(a)
        leaf[pos] = a
print(len(tree))

import bisect
from collections import deque
N = int(input())
A = [int(input()) for n in range(N)]

tree = deque([[A[0]]])
leaf = deque([A[0]])
for n in range(1,N):
    a = A[n]
    pos = min(n-1,bisect.bisect_left(leaf,a)-1)
    if pos==-1:
        tree.appendleft([a])
        leaf.appendleft(a)
    else:
        tree[pos].append(a)
        leaf[pos] = a
print(len(tree))

Verdicts: Runtime Error

Runtime Error

Accepted
Problem: You are given a sequence with N integers: A = \\{ A_1, A_2, \cdots, A_N \\}. For each of these N integers, we will choose a color and paint the integer with that color. Here the following condition must be satisfied:    * If A_i and A_j (i < j) are painted with the same color, A_i < A_j.  Find the minimum number of colors required to satisfy the condition.

Submission attempts (in order):
import bisect


def main():
  n = int(input())
  a = [int(input()) for _ in range(n)]

  tail = []
  len_tail = 0
  for ai in a:
    print(tail, ai)
    idx = bisect.bisect_left(tail, -ai, lo=0, hi=len_tail) 
    if idx == len_tail:
      tail.append(-ai)
      len_tail += 1
    else:
      tail[idx] = - ai

  print(len_tail )


if __name__ == "__main__":
  main()


import bisect


def main():
  n = int(input())
  a = [int(input()) for _ in range(n)]

  tail = []
  len_tail = 0
  for ai in a:
    idx = bisect.bisect_right(tail, -ai, lo=0, hi=len_tail) 
    if idx == len_tail:
      tail.append(-ai)
      len_tail += 1
    else:
      tail[idx] = - ai

  print(len_tail )


if __name__ == "__main__":
  main()

Verdicts: Runtime Error

Accepted
Problem: You are given a sequence with N integers: A = \\{ A_1, A_2, \cdots, A_N \\}. For each of these N integers, we will choose a color and paint the integer with that color. Here the following condition must be satisfied:    * If A_i and A_j (i < j) are painted with the same color, A_i < A_j.  Find the minimum number of colors required to satisfy the condition.

Submission attempts (in order):
import bisect

n = int(input())
a = sorted([int(input()) for i in range(n)])
LIS = [a[0]]
for i in range(len(a)):
    if a[i] >= LIS[-1]:
        LIS.append(a[i])
    else:
        LIS[bisect.bisect_left(LIS, a[i])] = a[i]
print(len(LIS)-1)

import bisect

n = int(input())
a = [int(input()) for i in range(n)][::-1]
LIS = [a[0]]
for i in a[1:]:
    if i >= LIS[-1]:
        LIS.append(i)
    else:
        LIS[bisect.bisect_right(LIS, i)] = i
print(len(LIS))

Verdicts: Wrong Answer

Accepted
Problem: You are given a sequence with N integers: A = \\{ A_1, A_2, \cdots, A_N \\}. For each of these N integers, we will choose a color and paint the integer with that color. Here the following condition must be satisfied:    * If A_i and A_j (i < j) are painted with the same color, A_i < A_j.  Find the minimum number of colors required to satisfy the condition.

Submission attempts (in order):
import bisect
def LIS():
    L[0] = A[0]
    length = 1
    for i in range(1, N):
        print(A[i])
        if L[length-1] < A[i]:
            L[length] = A[i]
            length += 1
        else:
            j = bisect.bisect_left(L, A[i])
            L[min(length-1, j)] = A[i]
    return length

def LISDesc():
    L[0] = A[-1]
    length = 1
    for i in range(N-2, -1, -1):
        if L[length-1] <= A[i]:
            L[length] = A[i]
            length += 1
        else:
            j = bisect.bisect_left(L, A[i])
            print(i, A[i], j)
            L[min(length-1, j)] = A[i]
    return length

INFTY = 10**13
N = int(input())
A = [int(input()) for i in range(N)]
L = [INFTY for i in range(N)]
ans = LISDesc()
print(ans)
print(L)


import bisect
def LIS():
    L[0] = A[0]
    length = 1
    for i in range(1, N):
        if L[length-1] < A[i]:
            L[length] = A[i]
            length += 1
        else:
            j = bisect.bisect_left(L, A[i])
            L[min(length-1, j)] = A[i]
    return length

def LISDesc():
    L[0] = A[-1]
    length = 1
    for i in range(N-2, -1, -1):
        if L[length-1] <= A[i]:
            L[length] = A[i]
            length += 1
        else:
            j = bisect.bisect_right(L, A[i])
            L[min(length-1, j)] = A[i]
    return length

INFTY = 10**13
N = int(input())
A = [int(input()) for i in range(N)]
L = [INFTY for i in range(N)]
ans = LISDesc()
print(ans)


Verdicts: Wrong Answer

Accepted
Problem: You are given a sequence with N integers: A = \\{ A_1, A_2, \cdots, A_N \\}. For each of these N integers, we will choose a color and paint the integer with that color. Here the following condition must be satisfied:    * If A_i and A_j (i < j) are painted with the same color, A_i < A_j.  Find the minimum number of colors required to satisfy the condition.

Submission attempts (in order):
import heapq
N = int(input())

S = list(int(input()) for _ in range(N))

d = [S[0]]
cnt = 1
for i in range(1, N):
    temp = S[i]
    if d[0] >= S[i]:
        heapq.heappush(d, temp)
        cnt += 1
        continue
    ok = 0
    ng = cnt-1
    t = (ok+ng)//2
    while ok+1 < ng:
        t = (ok+ng)//2
        if d[t] < temp:
            ok = t
        else:
            ng = t
    d[t] = temp
    heapq.heapify(d)

print(cnt)

N = int(input())

S = list(int(input()) for _ in range(N))
d = set([S[0]])
ans = 1

for i in range(1, N):
    num = S[i]
    temp = 10**9+1
    for t in d:
        if t > num and t < temp:
            temp = t
    if temp == 10**9 + 1:
        ans += 1
        d.add(num)
    else:
        d.remove(temp)
        d.add(num)
print(ans)

N = int(input())
A = list(int(input()) for _ in range(N))

S = [A[0]]
for i in range(1, N):
    if A[i] <= S[0]:
        S.insert(0, A[i])
        continue
    ok = 0
    ng = len(S)
    tmp = (ok+ng)
    while ok+1 < ng:
        tmp = (ok+ng)//2
        if A[i] > S[tmp]:
            ok = tmp
        else:
            ng = tmp
    S[ok] = A[i]
print(len(S))


Verdicts: Wrong Answer

Wrong Answer

Accepted
Problem: You are given a sequence with N integers: A = \\{ A_1, A_2, \cdots, A_N \\}. For each of these N integers, we will choose a color and paint the integer with that color. Here the following condition must be satisfied:    * If A_i and A_j (i < j) are painted with the same color, A_i < A_j.  Find the minimum number of colors required to satisfy the condition.

Submission attempts (in order):
import collections
n = int(input())
a = []
for i in range(n):
    a.append(int(input()))
c = collections.Counter(a)
print(c.most_common()[1])

import bisect
import collections
n = int(input())
a = []
for i in range(n):
    a.append(int(input()))
m = collections.deque([])
for i in range(0, n):
    j = bisect.bisect_left(m, a[i])
    if j == 0:
        m.appendleft(a[i])
    else:
        m[j - 1] = a[i]
print(len(m))

Verdicts: Runtime Error

Accepted
Problem: You are given a sequence with N integers: A = \\{ A_1, A_2, \cdots, A_N \\}. For each of these N integers, we will choose a color and paint the integer with that color. Here the following condition must be satisfied:    * If A_i and A_j (i < j) are painted with the same color, A_i < A_j.  Find the minimum number of colors required to satisfy the condition.

Submission attempts (in order):
from bisect import bisect


def main():
    N = int(input())
    A = [int(input()) for _ in range(N)]
    L = [A[0]]
    for a in A[1:]:
        if a <= L[-1]:
            L.append(a)
        else:
            i = bisect(L, a)
            L[i] = a
    print(len(L))

    

if __name__ == "__main__":
    main()


from bisect import bisect


def main():
    N = int(input())
    A = [-int(input()) for _ in range(N)]
    L = [A[0]]
    for a in A[1:]:
        if a >= L[-1]:
            L.append(a)
        else:
            L[bisect(L, a)] = a
    print(len(L))


if __name__ == "__main__":
    main()


Verdicts: Runtime Error

Accepted
Problem: You are given a sequence with N integers: A = \\{ A_1, A_2, \cdots, A_N \\}. For each of these N integers, we will choose a color and paint the integer with that color. Here the following condition must be satisfied:    * If A_i and A_j (i < j) are painted with the same color, A_i < A_j.  Find the minimum number of colors required to satisfy the condition.

Submission attempts (in order):
import bisect

n=int(input())
arr=[int(input()) for _ in range(n)][::-1]
LIS = [arr[0]]
for i in range(1,n):
  print(LIS)
  if arr[i] >= LIS[-1]:
    LIS.append(arr[i])
  else:
    LIS[bisect.bisect_left(LIS, arr[i])] = arr[i]
print(len(LIS))

import collections
import bisect

n=int(input())
arr=[int(input()) for _ in range(n)]
num=1
ans=collections.deque([arr[0]])
print(ans)
for i in range(1,n):
  tmp=ans.popleft()
  if arr[i]<=tmp:
    ans.appendleft(tmp)
    ans.appendleft(arr[i])
  else:
    ans.appendleft(tmp)
    pos=bisect.bisect_right(ans,arr[i])
    ans[pos-1]=arr[i]
  print(ans)
print(ans)

import collections
import bisect

n=int(input())
arr=[int(input()) for _ in range(n)][::-1]
num=1
ans=collections.deque([arr[0]])
for i in range(1,n):
  tmp=ans.popleft()
  if arr[i]<=tmp:
    ans.appendleft(tmp)
    ans.appendleft(arr[i])
  else:
    ans.appendleft(tmp)
    pos=bisect.bisect_right(ans,arr[i])
    ans[pos-1]=arr[i]
print(ans)

import collections
import bisect

n=int(input())
arr=[int(input()) for _ in range(n)]
num=1
ans=collections.deque([arr[0]])
for i in range(1,n):
  tmp=ans.popleft()
  if arr[i]<=tmp:
    ans.appendleft(tmp)
    ans.appendleft(arr[i])
  else:
    ans.appendleft(tmp)
    pos=bisect.bisect_right(ans,arr[i])
    ans[pos-1]=arr[i]
print(ans)

import bisect

n=int(input())
arr=[int(input()) for _ in range(n)]
num=1
ans=[-arr[0]]
for i in range(1,n):
  if -arr[i]>=ans[-1]:
    ans.append(-arr[i])
    num+=1
  else:
    pos=bisect.bisect_right(ans,-arr[i])
    ans[pos]=-arr[i]
print(num)

Verdicts: Runtime Error

Runtime Error

Wrong Answer

Wrong Answer

Accepted
Problem: You are given a sequence with N integers: A = \\{ A_1, A_2, \cdots, A_N \\}. For each of these N integers, we will choose a color and paint the integer with that color. Here the following condition must be satisfied:    * If A_i and A_j (i < j) are painted with the same color, A_i < A_j.  Find the minimum number of colors required to satisfy the condition.

Submission attempts (in order):
n = int(input())
a = [int(input()) for _ in range(n)]
print(a)
ans = 0
lst = [a[0]]*2
for aa in a:
    if aa <= lst[0]:
        lst[0] = aa
        ans += 1
    elif lst[0] < aa <= lst[1]:
        lst[0] = aa
    elif aa > lst[1]:
        lst[1] = aa
    else: lst[0] = aa
print(ans)

from bisect import bisect_right

n = int(input())
a = [-int(input()) for _ in range(n)]
print(a)

lst = [a[0]]
for aa in a[1:]:
    i = bisect_right(lst, aa)
    if i == len(lst): lst.append(aa)
    else: lst[i] = aa

print(len(lst))

from bisect import bisect_right

n = int(input())
a = [-int(input()) for _ in range(n)]

lst = [a[0]]
for aa in a[1:]:
    i = bisect_right(lst, aa)
    if i == len(lst): lst.append(aa)
    else: lst[i] = aa

print(len(lst))

Verdicts: Wrong Answer

Wrong Answer

Accepted
Problem: You are given a sequence with N integers: A = \\{ A_1, A_2, \cdots, A_N \\}. For each of these N integers, we will choose a color and paint the integer with that color. Here the following condition must be satisfied:    * If A_i and A_j (i < j) are painted with the same color, A_i < A_j.  Find the minimum number of colors required to satisfy the condition.

Submission attempts (in order):
import sys
from bisect import bisect_right
read = sys.stdin.read
readline = sys.stdin.buffer.readline
sys.setrecursionlimit(10 ** 8)
INF = float('inf')
MOD = 10 ** 9 + 7


def main():
    N = int(readline())
    A = list(int(readline()) for _ in range(N))

    LIS = [INF]*N
    A.reverse()
    for a in A:
        i = bisect_right(LIS,a)
        LIS[i] = a
    print(bisect_right(LIS, INF))


if __name__ == '__main__':
    main()



import sys
from bisect import bisect_right, bisect_left
read = sys.stdin.read
readline = sys.stdin.buffer.readline
sys.setrecursionlimit(10 ** 8)
INF = float('inf')
MOD = 10 ** 9 + 7


def main():
    N = int(readline())
    A = list(int(readline()) for _ in range(N))

    LIS = [INF]*N
    A.reverse()
    for a in A:
        i = bisect_right(LIS,a)
        LIS[i] = a
    print(bisect_left(LIS, INF))


if __name__ == '__main__':
    main()



Verdicts: Wrong Answer

Accepted
Problem: You are given a sequence with N integers: A = \\{ A_1, A_2, \cdots, A_N \\}. For each of these N integers, we will choose a color and paint the integer with that color. Here the following condition must be satisfied:    * If A_i and A_j (i < j) are painted with the same color, A_i < A_j.  Find the minimum number of colors required to satisfy the condition.

Submission attempts (in order):
import sys
input = sys.stdin.readlinefrom collections import deque
from bisect import bisect_right, bisect_left
def main():
    N = int( input())
    A = [ int( input()) for _ in range(N)]
    d = deque()
    for a in A:
        t = bisect_right(d, a)
        if t == 0:
            d.appendleft(a)
            continue
        if d[t-1] == a:
            t = bisect_left(d, a)
        if t == 0:
            d.appendleft(a)
        else:
            d[t-1] = a
    print(len(d))

if __name__ == '__main__':
    main()


import sys
input = sys.stdin.readlinefrom collections
import deque
from bisect import bisect_right, bisect_left
def main():
    N = int( input())
    A = [ int( input()) for _ in range(N)]
    d = deque()
    for a in A:
        t = bisect_right(d, a)
        if t == 0:
            d.appendleft(a)
            continue
        if d[t-1] == a:
            t = bisect_left(d, a)
        if t == 0:
            d.appendleft(a)
        else:
            d[t-1] = a
    print(len(d))

if __name__ == '__main__':
    main()


#import sys
#input = sys.stdin.readline
from collections import deque
from bisect import bisect_right, bisect_left
def main():
    N = int( input())
    A = [ int( input()) for _ in range(N)]
    d = deque()
    for a in A:
        t = bisect_right(d, a)
        if t == 0:
            d.appendleft(a)
            continue
        if d[t-1] == a:
            t = bisect_left(d, a)
        if t == 0:
            d.append(a)
        else:
            d[t-1] = a
    print(len(d))
    print(d)
if __name__ == '__main__':
    main()


import sys
input = sys.stdin.readline
from collections import deque
from bisect import bisect_right, bisect_left
def main():
    N = int( input())
    A = [ int( input()) for _ in range(N)]
    d = deque()
    for a in A:
        t = bisect_right(d, a)
        if t == 0:
            d.appendleft(a)
            continue
        if d[t-1] == a:
            t = bisect_left(d, a)
        if t == 0:
            d.appendleft(a)
        else:
            d[t-1] = a
    print(len(d))

if __name__ == '__main__':
    main()


Verdicts: Runtime Error

Runtime Error

Wrong Answer

Accepted
Problem: You are given a sequence with N integers: A = \\{ A_1, A_2, \cdots, A_N \\}. For each of these N integers, we will choose a color and paint the integer with that color. Here the following condition must be satisfied:    * If A_i and A_j (i < j) are painted with the same color, A_i < A_j.  Find the minimum number of colors required to satisfy the condition.

Submission attempts (in order):

n = int(input())
a = []
for i in range(n):
  a.append(int(input()))

import bisect

color = []
color.append(a.pop(0))
color_count =0 
for i, ai in enumerate(a): 
    index = bisect.bisect_left(color, ai)
    print(index-1, ai, color)
    if index > 0:
        color[index -1] = ai
    else:
        color.insert(0, ai)
print(len(color), color)

n = int(input())
a = []
for i in range(n):
  a.append(int(input()))

from collections import deque
import bisect
color = deque([a.pop(0)])
color_count =0 
for i, ai in enumerate(a): 
    index = bisect.bisect_left(color, ai)
    print(index-1, ai, color)
    if index > 0:
        color[index -1] = ai
    else:
        color.appendleft(ai)
print(len(color))

n = int(input())
a = []
for i in range(n):
  a.append(int(input()))

color = []
color.append(a.pop(0))
clen = 1
for ai in a:
    for i, c in enumerate(color): 
        if ai > c:
            color[i] = ai
            color.sort(reverse=True)
            break
        else:
            if i+1 == clen:
                color.append(ai)
                clen += 1
                break
print(len(color), color)

n = int(input())
a = []
for i in range(n):
  a.append(int(input()))
from collections import deque
import bisect

color = deque([a.pop(0)])
color_count =0 
for ai in a: 
    index = bisect.bisect_left(color, ai)
    if index > 0:
        color[index -1] = ai
    else:
        color.appendleft(ai)
print(len(color))

Verdicts: Runtime Error

Runtime Error

Wrong Answer

Accepted
Problem: You are given a sequence with N integers: A = \\{ A_1, A_2, \cdots, A_N \\}. For each of these N integers, we will choose a color and paint the integer with that color. Here the following condition must be satisfied:    * If A_i and A_j (i < j) are painted with the same color, A_i < A_j.  Find the minimum number of colors required to satisfy the condition.

Submission attempts (in order):
import sys
input = sys.stdin.readline

N = int(input())
l = [int(input())]

for i in range(N-1):
  ai = int(input())
  flag = False
  for m in l:
    if max(m) < ai:
      m.append(ai)
      flag = True
      break
  if flag == False:
    l.append([ai])
    
print(len(l))

import sys
input = sys.stdin.readline
from bisect import bisect_right

N = int(input())
l = [-int(input())]

for i in range(N-1):
  ai = -int(input())

  if l[-1] <= ai:
    l.append(ai)
  else:
    b = bisect_right(l, ai)
    l[b] = ai
    
print(len(l))

Verdicts: Runtime Error

Accepted
Problem: You are given a sequence with N integers: A = \\{ A_1, A_2, \cdots, A_N \\}. For each of these N integers, we will choose a color and paint the integer with that color. Here the following condition must be satisfied:    * If A_i and A_j (i < j) are painted with the same color, A_i < A_j.  Find the minimum number of colors required to satisfy the condition.

Submission attempts (in order):
import sys
import numpy as np
from scipy.misc import comb
sys.setrecursionlimit(1000000)
 
n = int(input())

a = [int(input()) for i in range(n)]

color = [[-1] for i in range(n+1)]

max_j = 0
for i in range(n):
    for j in range(n):
        #print(color[j][-1])
        if a[i] > color[j][-1]:
            color[j].append(a[i])
            max_j = max(max_j,j+1)
            break
            
print(max_j)

import sys
input = sys.stdin.readline

from collections import deque

import bisect
n = int(input())

a = [int(input()) for i in range(n)]



d = deque()
d.appendleft(a[0])

for i in range(1,n):
    idx = bisect.bisect_left(d,a[i])
    if idx == 0:
        d.appendleft(a[i])
    else:
        d[idx-1] = a[i]
        
print(len(d))

Verdicts: Time Limit Exceeded

Accepted
Problem: You are given a sequence with N integers: A = \\{ A_1, A_2, \cdots, A_N \\}. For each of these N integers, we will choose a color and paint the integer with that color. Here the following condition must be satisfied:    * If A_i and A_j (i < j) are painted with the same color, A_i < A_j.  Find the minimum number of colors required to satisfy the condition.

Submission attempts (in order):
# Python3 (3.4.3)
import sys
input = sys.stdin.readline

# -------------------------------------------------------------
# function
# -------------------------------------------------------------


# -------------------------------------------------------------
# main
# -------------------------------------------------------------
N = int(input())
A = [int(input()) for _ in range(N)]

from collections import deque
from bisect import bisect_left

D = deque([])

for a in A:
    i = bisect_left(D,a)
    if i==0:
        D.appendleft(a)
    else:
        D[i-1] = a
    print(i,D)

print(len(D))

# Python3 (3.4.3)
import sys
input = sys.stdin.readline

# -------------------------------------------------------------
# function
# -------------------------------------------------------------


# -------------------------------------------------------------
# main
# -------------------------------------------------------------
N = int(input())
A = [int(input()) for _ in range(N)]

from collections import deque
from bisect import bisect_left

D = deque([])

for a in A:
    i = bisect_left(D,a)
    if i==0:
        D.appendleft(a)
    else:
        D[i-1] = a

print(len(D))

Verdicts: Runtime Error

Accepted
Problem: You are given a sequence with N integers: A = \\{ A_1, A_2, \cdots, A_N \\}. For each of these N integers, we will choose a color and paint the integer with that color. Here the following condition must be satisfied:    * If A_i and A_j (i < j) are painted with the same color, A_i < A_j.  Find the minimum number of colors required to satisfy the condition.

Submission attempts (in order):
import bisect

N = input()
N = int(N)
S = [-int(input()) for _ in range(N)]
result = []

for i in range(N):
    hoge = bisect.bisect_left(result,S[i])
    if hoge == 0:
        result.append(S[i])
    else:
        result[hoge - 1] = S[i]
print(len(result))

import bisect

N = input()
N = int(N)
S = [int(input()) for _ in range(N)]
result = []

for i in range(N):
    hoge = bisect.bisect_left(result,S[i])
    if hoge == 0:
        result = S[i] + result
    else:
        result[hoge - 1] = hoge
print(len(result))

N = input()
N = int(N)
S = [int(input()) for _ in range(N)]
result = 0

while onon < N:
    result += 1
    hoge = S.pop(0)
    onon = 0
    for j in range(len(S)):
        if S[onon] > hoge:
            S.pop(onon)
        else:
            onon + 1
print(result)

import bisect

N = input()
N = int(N)
S = [int(input()) for _ in range(N)]
result = []
result2=0

for i in range(N):
    hoge = bisect.bisect_left(result,S[i])
    if hoge == result2:
        result.append(hoge)
        result2 += 1
    else:
        result[hoge - 1] = S[i]
print(len(result))

import bisect

N = input()
N = int(N)
S = [-int(input()) for _ in range(N)]
result = []

for i in range(N):
    hoge = bisect.bisect(result,S[i])
    if hoge == len(result):
        result.append(S[i])
    else:
        result[hoge] = S[i]
print(len(result))

Verdicts: Wrong Answer

Runtime Error

Runtime Error

Wrong Answer

Accepted
Problem: You are given a sequence with N integers: A = \\{ A_1, A_2, \cdots, A_N \\}. For each of these N integers, we will choose a color and paint the integer with that color. Here the following condition must be satisfied:    * If A_i and A_j (i < j) are painted with the same color, A_i < A_j.  Find the minimum number of colors required to satisfy the condition.

Submission attempts (in order):
from bisect import *

def f(n):
    r = []
    for _ in range(n):
        a = int(input())
        if not r:
            r.append(a)
            continue
        i = bisect_left(r, a)
        if i:
            r[i]=a
        else:
            r = [a] + r
    print(len(r))

n = int(input())
f(n)


import sys
from collections import deque
from bisect import bisect_left

input = sys.stdin.readline

def f(n):
    r = deque()
    for _ in range(n):
        a = int(input())
        i = bisect_left(r, a)
        if i:
            r[i - 1] = a
        else:
            r.appendleft(a)
    print(len(r))

n = int(input())
f(n)


Verdicts: Runtime Error

Accepted
Problem: You are given a sequence with N integers: A = \\{ A_1, A_2, \cdots, A_N \\}. For each of these N integers, we will choose a color and paint the integer with that color. Here the following condition must be satisfied:    * If A_i and A_j (i < j) are painted with the same color, A_i < A_j.  Find the minimum number of colors required to satisfy the condition.

Submission attempts (in order):
import bisect
n = int(input())
l = []
l.append(int(input()))
for i in range(n-1):
    a = int(input())
    if l[0] >= a:
        l.insert(0,a)
    else:
        l[bisect.bisect_left(l,a+1)-1] = a
print(l)

import bisect
from collections import deque
n = int(input())
l = deque([])
l.append(int(input()))
for i in range(n-1):
    a = int(input())
    if l[0] >= a:
        l.appendleft(a)
    else:
        l[bisect.bisect_left(l,a)-1] = a
print(len(l))


Verdicts: Wrong Answer

Accepted
Problem: You are given a sequence with N integers: A = \\{ A_1, A_2, \cdots, A_N \\}. For each of these N integers, we will choose a color and paint the integer with that color. Here the following condition must be satisfied:    * If A_i and A_j (i < j) are painted with the same color, A_i < A_j.  Find the minimum number of colors required to satisfy the condition.

Submission attempts (in order):
import collections

N = int(input())    
color_list = []
color_list.append(int(input()))
for i in range(N-1):
    new_value = int(input())
    if(new_value > color_list[0]):
        color_list[0] = new_value
    elif(new_value <= color_list[-1]):
        color_list.append(new_value)
    else:
        for i in range(len(color_list)):
            if(new_value >= color_list[i]):
                color_list.insert(i, new_value)
print(len(color_list))

import bisect

N = int(input())    
color_list = []
color_list.append(int(input()))
for i in range(N-1):
    new_value = int(input())
    if(new_value > color_list[0]):
        color_list[0] = new_value
    elif(new_value <= color_list[-1]):
        color_list += [new_value]
    else:
        bisect.insert(color_list, new_value)
print(len(color_list))

def seek(value):
    right = len(color_list) - 1
    left = 0
    while(True):
        mid = (right + left) // 2
        if(value > color_list[mid]):
            right = mid
        else:
            left = mid
        if(right - left <= 1):
            return right

N = int(input())    
color_list =  [int(input())]
for i in range(N-1):
    new_value = int(input())
    if(new_value > color_list[0]):
        color_list[0] = new_value
    elif(new_value <= color_list[-1]):
        color_list.append(new_value)
    else:
        new_index = seek(new_value)
        color_list[new_index] = new_value
print(len(color_list))

Verdicts: Wrong Answer

Runtime Error

Accepted