#A. Son rim raqamda #1

a=[(1000, "M"),(900, "CM"),(500, "D"), (400, "CD"),(100, "C"),(90, "XC"),(50, "L"),(40, "XL"),(10, "X"),(9, "IX"),(5, "V"), (4, "IV"),(1, "I"),]
n=int(input())
s=''
while n>0:
 for i,r in a:
   while n>=i:
     s+=r
     n-=i
print(s)

#B. Max {arr}

input_file = File.open("input.txt", "r")
arr = input_file.readline.split.map(&:to_i)
input_file.close
max_value = arr.max
output_file = File.open("output.txt", "w")
output_file.puts(max_value)
output_file.close

#C. Search {arr}

with open('input.txt', 'r') as f:
   arr = list(map(int, f.readline().split()))
   b = int(f.readline())
if b in arr:
   index = arr.index(b)
   with open('output.txt', 'w') as f:
       f.write(str(index + 1))
else:
   with open('output.txt', 'w') as f:
       f.write("-1")

#D. Type

a=input()
if a=="bool":
 print(1)
elif a=="char":
 print(1)
elif a=="int":
 print(4)
elif a=="float":
 print(4)
elif a=="double":
 print(8)
elif a=="short":
 print(2)
elif a=="long long":
 print(4)

E.  Missing Positive

a=list(map(int,input().split()))
s=max(a)
c=1
for i in range(1,s+1):
 if i not in a:
   print(i)
   c=0
   break
if c==1:
 print(s+1)       # pypy da jo'nating

#F. Ketma-ketlik yig'indisi

#include <iostream>
using namespace std;
int main(){
 int m;
 cin >> m;
 cout << ((m*m + m)*(4*m+5))/6;
 return 0;
} 

G. Muntazam ifoda moslashuvchi

Optimal yechim topilmadi