Что выведет программа?
st = [] for x in [5, 1, 4, 2, 3]: if st and st[-1] > x: st.pop() st.append(x) print(sum(st))