Newer
Older
{"cells": [{"cell_type": "markdown", "metadata": {}, "source": ["## **A+B+...**", "\u041d\u0430\u043a\u043e\u043d\u0435\u0446-\u0442\u043e \u043c\u044b \u043c\u043e\u0436\u0435\u043c \u043e\u0431\u0440\u0430\u0431\u0430\u0442\u044b\u0432\u0430\u0442\u044c \u0434\u0430\u043d\u043d\u044b\u0435, \u043d\u0435 \u0438\u043c\u0435\u044f \u043d\u0438 \u043c\u0430\u043b\u0435\u0439\u0448\u0435\u0433\u043e \u043f\u043e\u043d\u044f\u0442\u0438\u044f \u043e\u0431 \u0438\u0445 \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u0435.<br><br>\u041d\u0430\u043f\u0438\u0448\u0438\u0442\u0435 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0443, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u043d\u0430\u0445\u043e\u0434\u0438\u0442 \u0441\u0443\u043c\u043c\u0443 \u0432\u0441\u0435\u0445 \u0447\u0438\u0441\u0435\u043b \u0432\u0432\u0435\u0434\u0451\u043d\u043d\u044b\u0445 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u0435\u043c.", "### **\u0424\u043e\u0440\u043c\u0430\u0442 \u0432\u0432\u043e\u0434\u0430**", "\u0412\u0432\u043e\u0434\u044f\u0442\u0441\u044f \u0441\u0442\u0440\u043e\u043a\u0438 \u0447\u0438\u0441\u0435\u043b.", "### **\u0424\u043e\u0440\u043c\u0430\u0442 \u0432\u044b\u0432\u043e\u0434\u0430**", "\u041e\u0434\u043d\u043e \u0447\u0438\u0441\u043b\u043e \u2014 \u0441\u0443\u043c\u043c\u0430 \u0432\u0441\u0435\u0445 \u0447\u0438\u0441\u0435\u043b \u0432 \u043f\u043e\u0442\u043e\u043a\u0435 \u0432\u0432\u043e\u0434\u0430.", "### **\u041f\u0440\u0438\u043c\u0435\u0440**", "|\u0412\u0432\u043e\u0434 |\u0412\u044b\u0432\u043e\u0434|", "|-----|-----|", "|1 2<br>3 4 5<br>6<br>7 8 9 10<br>|55<br> <br> <br> <br>|"]}, {"cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": ["from sys import stdin", "", "arr = []", "for line in stdin:", " arr += [int(i) for i in line.rstrip(\"\\n\").split()]", "", "print(sum(arr))"]}, {"cell_type": "markdown", "metadata": {}, "source": ["## **\u0421\u0440\u0435\u0434\u043d\u0438\u0439 \u0440\u043e\u0441\u0442**", "\u0423\u0447\u0438\u0442\u0435\u043b\u044c \u0444\u0438\u0437\u043a\u0443\u043b\u044c\u0442\u0443\u0440\u044b \u0437\u0430\u0434\u0430\u043b\u0441\u044f \u0432\u043e\u043f\u0440\u043e\u0441\u043e\u043c, \u043d\u0430 \u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0432 \u0441\u0440\u0435\u0434\u043d\u0435\u043c \u0435\u0433\u043e \u043f\u043e\u0434\u043e\u043f\u0435\u0447\u043d\u044b\u0435 \u0432\u044b\u0440\u043e\u0441\u043b\u0438 \u0437\u0430 \u043f\u0440\u043e\u0448\u0435\u0434\u0448\u0438\u0439 \u043c\u0435\u0441\u044f\u0446.<br><br>\u041d\u0430\u043f\u0438\u0448\u0438\u0442\u0435 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0443, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u044f\u0435\u0442, \u043d\u0430 \u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0438\u0437\u043c\u0435\u043d\u0438\u043b\u0441\u044f \u0441\u0440\u0435\u0434\u043d\u0438\u0439 \u0440\u043e\u0441\u0442 \u0443\u0447\u0435\u043d\u0438\u043a\u043e\u0432 \u0432 \u043a\u043b\u0430\u0441\u0441\u0435.", "### **\u0424\u043e\u0440\u043c\u0430\u0442 \u0432\u0432\u043e\u0434\u0430**", "\u0412\u0432\u043e\u0434\u0438\u0442\u0441\u044f \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u044f \u043e \u0434\u0435\u0442\u044f\u0445 \u0432 \u0444\u043e\u0440\u043c\u0430\u0442\u0435:", "### **\u0424\u043e\u0440\u043c\u0430\u0442 \u0432\u044b\u0432\u043e\u0434\u0430**", "\u041e\u0434\u043d\u043e \u0447\u0438\u0441\u043b\u043e \u2014 \u043e\u0442\u0432\u0435\u0442 \u043d\u0430 \u0432\u043e\u043f\u0440\u043e\u0441 \u0437\u0430\u0434\u0430\u0447\u0438.<br>\u041e\u0442\u0432\u0435\u0442 \u043e\u043a\u0440\u0443\u0433\u043b\u0438\u0442\u0435 \u0434\u043e \u0446\u0435\u043b\u044b\u0445. \u041d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u0444\u0443\u043d\u043a\u0446\u0438\u0435\u0439 round.", "### **\u041f\u0440\u0438\u043c\u0435\u0440 1**", "|\u0412\u0432\u043e\u0434 |\u0412\u044b\u0432\u043e\u0434|", "|-----|-----|", "|\u0410\u043d\u044f 160 162<br>\u0411\u043e\u0440\u044f 165 172<br>\u0412\u043e\u0432\u0430 165 165<br>|3<br> <br> <br>|", "### **\u041f\u0440\u0438\u043c\u0435\u0440 2**", "|\u0412\u0432\u043e\u0434 |\u0412\u044b\u0432\u043e\u0434|", "|-----|-----|", "|\u0410\u043d\u044f 161 165<br>\u0411\u043e\u0440\u044f 167 172<br>\u0412\u043e\u0432\u0430 165 166<br>\u0414\u0438\u043c\u0430 173 178<br>|4<br> <br> <br> <br>|"]}, {"cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": ["from sys import stdin", "", "high_arr = []", "for line in stdin:", " high = [int(i) for i in line.rstrip(\"\\n\").split()[1:]]", " high_arr.append(high[1] - high[0])", "", "print(round(sum(high_arr) / len(high_arr)))"]}, {"cell_type": "markdown", "metadata": {}, "source": ["## **\u0411\u0435\u0437 \u043a\u043e\u043c\u043c\u0435\u043d\u0442\u0430\u0440\u0438\u0435\u0432 2.0**", "\u041a\u0430\u043a \u0432\u044b \u043f\u043e\u043c\u043d\u0438\u0442\u0435, \u043a\u043e\u0433\u0434\u0430 \u0432\u044b \u043a\u043e\u043c\u043c\u0435\u043d\u0442\u0438\u0440\u0443\u0435\u0442\u0435 \u0441\u0432\u043e\u0439 \u043a\u043e\u0434, \u043f\u0435\u0440\u0435\u0434 \u0435\u0433\u043e \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u0435\u043c \u0438\u043d\u0442\u0435\u0440\u043f\u0440\u0435\u0442\u0430\u0442\u043e\u0440 \u0443\u0434\u0430\u043b\u044f\u0435\u0442 \u043a\u043e\u043c\u043c\u0435\u043d\u0442\u0430\u0440\u0438\u0438.<br>\u041d\u0430\u043f\u0438\u0448\u0438\u0442\u0435 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0443, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0435\u0442 \u0434\u0430\u043d\u043d\u0443\u044e \u0444\u0443\u043d\u043a\u0446\u0438\u044e \u0437\u0430 \u0438\u043d\u0442\u0435\u0440\u043f\u0440\u0435\u0442\u0430\u0442\u043e\u0440.", "### **\u0424\u043e\u0440\u043c\u0430\u0442 \u0432\u0432\u043e\u0434\u0430**", "\u0412\u0432\u043e\u0434\u044f\u0442\u0441\u044f \u0441\u0442\u0440\u043e\u043a\u0438 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u044b.", "### **\u0424\u043e\u0440\u043c\u0430\u0442 \u0432\u044b\u0432\u043e\u0434\u0430**", "\u041a\u0430\u0436\u0434\u0443\u044e \u0441\u0442\u0440\u043e\u043a\u0443 \u043d\u0443\u0436\u043d\u043e \u043e\u0447\u0438\u0441\u0442\u0438\u0442\u044c \u043e\u0442 \u043a\u043e\u043c\u043c\u0435\u043d\u0442\u0430\u0440\u0438\u0435\u0432.<br>\u0410 \u0435\u0441\u043b\u0438 \u043a\u043e\u043c\u043c\u0435\u043d\u0442\u0430\u0440\u0438\u0439 \u2014 \u0432\u0441\u044f \u0441\u0442\u0440\u043e\u043a\u0430, \u0442\u043e \u0432\u044b\u0432\u043e\u0434\u0438\u0442\u044c \u0435\u0451 \u043d\u0435 \u043d\u0443\u0436\u043d\u043e.", "### **\u041f\u0440\u0438\u043c\u0435\u0440 1**", "|\u0412\u0432\u043e\u0434 |\u0412\u044b\u0432\u043e\u0434|", "|-----|-----|", "|# \u041c\u043e\u044f \u043f\u0435\u0440\u0432\u0430\u044f \u0441\u0443\u043f\u0435\u0440-\u043f\u0443\u043f\u0435\u0440 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0430<br>print(\"What is your name?\") # \u041a\u0430\u043a \u0442\u0435\u0431\u044f \u0437\u043e\u0432\u0443\u0442?<br>name = input() # \u0421\u043e\u0445\u0440\u0430\u043d\u044f\u0435\u043c \u0438\u043c\u044f<br>print(f\"Hello, {name}!\") # \u0417\u0434\u043e\u0440\u043e\u0432\u0430\u0435\u043c\u0441\u044f# \u041a\u043e\u043d\u0435\u0446 \u043c\u043e\u0435\u0439 \u0441\u0443\u043f\u0435\u0440-\u043f\u0443\u043f\u0435\u0440 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u044b<br>|print(\"What is your name?\")<br>name = input()<br>print(f\"Hello, {name}!\")<br> <br>|", "### **\u041f\u0440\u0438\u043c\u0435\u0440 2**", "|\u0412\u0432\u043e\u0434 |\u0412\u044b\u0432\u043e\u0434|", "|-----|-----|", "|# \u041c\u043e\u0439 \u043f\u0435\u0440\u0432\u044b\u0439 \u0446\u0438\u043a\u043b<br>for i in range(10): # \u0421\u0447\u0438\u0442\u0430\u0435\u043c \u0434\u043e 10<br> print(i) # \u0432\u044b\u0432\u043e\u0434\u0438\u043c \u0447\u0438\u0441\u043b\u043e<br>|for i in range(10):<br> print(i)<br> <br>|"]}, {"cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": ["from sys import stdin", "", "code = []", "for line in stdin:", " if line.find(\"#\") != 0:", " print(line[: line.find(\"#\")])"]}, {"cell_type": "markdown", "metadata": {}, "source": ["## **\u041d\u0430\u0439\u0434\u0451\u0442\u0441\u044f \u0432\u0441\u0451 2.0**", "\u041f\u043e\u0438\u0441\u043a \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u0438 \u2014 \u0432\u0430\u0436\u043d\u0430\u044f \u0447\u0430\u0441\u0442\u044c \u0441\u043e\u0432\u0440\u0435\u043c\u0435\u043d\u043d\u043e\u0439 \u0436\u0438\u0437\u043d\u0438. \u0421\u043e\u0437\u0434\u0430\u0439\u0442\u0435 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0443, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u0440\u0435\u0430\u043b\u0438\u0437\u0443\u0435\u0442 \u043c\u0430\u043b\u0435\u043d\u044c\u043a\u0438\u0439 \u043a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442 \u043f\u043e\u0438\u0441\u043a\u043e\u0432\u043e\u0439 \u0441\u0438\u0441\u0442\u0435\u043c\u044b.", "### **\u0424\u043e\u0440\u043c\u0430\u0442 \u0432\u0432\u043e\u0434\u0430**", "\u0412\u0432\u043e\u0434\u044f\u0442\u0441\u044f \u0437\u0430\u0433\u043e\u043b\u043e\u0432\u043a\u0438 \u0441\u0442\u0440\u0430\u043d\u0438\u0446.<br>\u0412 \u043f\u043e\u0441\u043b\u0435\u0434\u043d\u0435\u0439 \u0441\u0442\u0440\u043e\u043a\u0435 \u0437\u0430\u043f\u0438\u0441\u0430\u043d \u043f\u043e\u0438\u0441\u043a\u043e\u0432\u044b\u0439 \u0437\u0430\u043f\u0440\u043e\u0441.", "### **\u0424\u043e\u0440\u043c\u0430\u0442 \u0432\u044b\u0432\u043e\u0434\u0430**", "\u0412\u044b\u0432\u0435\u0441\u0442\u0438 \u0432\u0441\u0435 \u0437\u0430\u0433\u043e\u043b\u043e\u0432\u043a\u0438 \u0441\u0442\u0440\u0430\u043d\u0438\u0446, \u0432 \u043a\u043e\u0442\u043e\u0440\u044b\u0445 \u043f\u0440\u0438\u0441\u0443\u0442\u0441\u0442\u0432\u0443\u0435\u0442 \u043f\u043e\u0438\u0441\u043a\u043e\u0432\u044b\u0439 \u0437\u0430\u043f\u0440\u043e\u0441 (\u0440\u0435\u0433\u0438\u0441\u0442\u0440 \u043d\u0435 \u0438\u043c\u0435\u0435\u0442 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f).<br>\u041f\u043e\u0440\u044f\u0434\u043e\u043a \u0437\u0430\u0433\u043e\u043b\u043e\u0432\u043a\u043e\u0432 \u0434\u043e\u043b\u0436\u0435\u043d \u0441\u043e\u0445\u0440\u0430\u043d\u0438\u0442\u044c\u0441\u044f.", "### **\u041f\u0440\u0438\u043c\u0435\u0440 1**", "|\u0412\u0432\u043e\u0434 |\u0412\u044b\u0432\u043e\u0434|", "|-----|-----|", "|\u042f\u043d\u0434\u0435\u043a\u0441 \u0432\u044b\u043f\u0443\u0441\u0442\u0438\u043b \u0437\u0430\u0434\u0430\u0447\u043d\u0438\u043a \u043f\u043e \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044e<br>\u041d\u0430 \u0441\u043e\u0440\u0435\u0432\u043d\u043e\u0432\u0430\u043d\u0438\u044f\u0445 \u043f\u043e \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044e \u043f\u043e\u0431\u0435\u0434\u0438\u043b \u043b\u044e\u0431\u0438\u0442\u0435\u043b\u044c \u043f\u0438\u0442\u043e\u043d\u0430<br>\u041a\u0430\u043a \u0437\u0430\u043a\u0430\u0437\u0430\u0442\u044c \u042f\u043d\u0434\u0435\u043a\u0441.\u0422\u0430\u043a\u0441\u0438?!<br>\u044f\u043d\u0434\u0435\u043a\u0441<br>|\u042f\u043d\u0434\u0435\u043a\u0441 \u0432\u044b\u043f\u0443\u0441\u0442\u0438\u043b \u0437\u0430\u0434\u0430\u0447\u043d\u0438\u043a \u043f\u043e \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044e<br>\u041a\u0430\u043a \u0437\u0430\u043a\u0430\u0437\u0430\u0442\u044c \u042f\u043d\u0434\u0435\u043a\u0441.\u0422\u0430\u043a\u0441\u0438?!<br> <br> <br>|", "### **\u041f\u0440\u0438\u043c\u0435\u0440 2**", "|\u0412\u0432\u043e\u0434 |\u0412\u044b\u0432\u043e\u0434|", "|-----|-----|", "|\u0441\u0435\u0440\u0438\u0430\u043b \u0448\u0435\u0440\u043b\u043e\u043a \u0441\u043c\u043e\u0442\u0440\u0435\u0442\u044c \u043e\u043d\u043b\u0430\u0439\u043d<br>\u0443\u0447\u0435\u0431\u043d\u0438\u043a \u043f\u0438\u0442\u043e\u043d\u0430<br>\u043c\u0435\u043c\u044b<br>\u0441\u043e\u0446\u0438\u0430\u043b\u044c\u043d\u0430\u044f \u0441\u0435\u0442\u044c<br>\u0443\u043f\u0440\u0430\u0436\u043d\u0435\u043d\u0438\u044f \u043f\u043e \u043f\u0438\u0442\u043e\u043d\u0443<br>\u043a\u043e\u0440\u043c\u043e\u0432\u044b\u0435 \u043c\u044b\u0448\u0438 \u0434\u043b\u044f \u043f\u0438\u0442\u043e\u043d\u043e\u0432<br>\u043e\u0442\u0432\u0435\u0442\u044b \u0435\u0433\u044d \u0441\u043a\u0430\u0447\u0430\u0442\u044c \u0431\u0435\u0441\u043f\u043b\u0430\u0442\u043d\u043e<br>\u043a\u043e\u043c\u043f\u044c\u044e\u0442\u0435\u0440\u043d\u044b\u0435 \u043c\u044b\u0448\u0438<br>\u043f\u0438\u0442\u043e\u043d<br>|\u0443\u0447\u0435\u0431\u043d\u0438\u043a \u043f\u0438\u0442\u043e\u043d\u0430<br>\u0443\u043f\u0440\u0430\u0436\u043d\u0435\u043d\u0438\u044f \u043f\u043e \u043f\u0438\u0442\u043e\u043d\u0443<br>\u043a\u043e\u0440\u043c\u043e\u0432\u044b\u0435 \u043c\u044b\u0448\u0438 \u0434\u043b\u044f \u043f\u0438\u0442\u043e\u043d\u043e\u0432<br> <br> <br> <br> <br> <br> <br>|"]}, {"cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": ["from sys import stdin", "", "sentences = []", "for line in stdin:", " sentences.append(line.rstrip(\"\\n\"))", "", "search = sentences.pop(-1)", "res = []", "", "for sen in sentences:", " if search.lower() in sen.lower():", " res.append(sen)", "", "print(*res, sep=\"\\n\")"]}, {"cell_type": "markdown", "metadata": {}, "source": ["## **\u0410 \u0440\u043e\u0437\u0430 \u0443\u043f\u0430\u043b\u0430 \u043d\u0430 \u043b\u0430\u043f\u0443 \u0410\u0437\u043e\u0440\u0430 6.0**", "\u041c\u044b \u0443\u0436\u0435 \u043f\u0438\u0441\u0430\u043b\u0438 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u044b, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u044f\u043b\u0438, \u0430 \u043f\u0430\u043b\u0438\u043d\u0434\u0440\u043e\u043c \u043f\u0435\u0440\u0435\u0434 \u043d\u0430\u043c\u0438 \u0438\u043b\u0438 \u043d\u0435\u0442.<br>\u0414\u0430\u0432\u0430\u0439\u0442\u0435 \u0442\u0435\u043f\u0435\u0440\u044c \u043d\u0430\u0439\u0434\u0451\u043c \u0432\u0441\u0435 \u0441\u043b\u043e\u0432\u0430-\u043f\u0430\u043b\u0438\u043d\u0434\u0440\u043e\u043c\u044b \u0441\u0440\u0435\u0434\u0438 \u0432\u0432\u0435\u0434\u0451\u043d\u043d\u044b\u0445 \u0441\u0442\u0440\u043e\u043a.", "### **\u0424\u043e\u0440\u043c\u0430\u0442 \u0432\u0432\u043e\u0434\u0430**", "\u0412\u0432\u043e\u0434\u044f\u0442\u0441\u044f \u0441\u043b\u043e\u0432\u0430.", "### **\u0424\u043e\u0440\u043c\u0430\u0442 \u0432\u044b\u0432\u043e\u0434\u0430**", "\u0421\u043f\u0438\u0441\u043e\u043a \u0441\u043b\u043e\u0432-\u043f\u0430\u043b\u0438\u043d\u0434\u0440\u043e\u043c\u043e\u0432 \u0432 \u0430\u043b\u0444\u0430\u0432\u0438\u0442\u043d\u043e\u043c \u043f\u043e\u0440\u044f\u0434\u043a\u0435 \u0431\u0435\u0437 \u043f\u043e\u0432\u0442\u043e\u0440\u0435\u043d\u0438\u0439.", "### **\u041f\u0440\u0438\u043c\u0435\u0447\u0430\u043d\u0438\u0435**", "\u041f\u0440\u0438 \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0435 \u0441\u043b\u043e\u0432 \u043d\u0435 \u043e\u0431\u0440\u0430\u0449\u0430\u0439\u0442\u0435 \u0432\u043d\u0438\u043c\u0430\u043d\u0438\u0435 \u043d\u0430 \u0440\u0435\u0433\u0438\u0441\u0442\u0440.", "### **\u041f\u0440\u0438\u043c\u0435\u0440**", "|\u0412\u0432\u043e\u0434 |\u0412\u044b\u0432\u043e\u0434|", "|-----|-----|", "|\u0410\u043d\u043d\u0430 \u0411\u043e\u0440\u044f \u0412\u043e\u0432\u0430<br>\u042f \u043f\u043e\u0441\u043b\u0435\u0434\u043d\u044f\u044f \u0431\u0443\u043a\u0432\u0430 \u0430\u043b\u0444\u0430\u0432\u0438\u0442\u0430<br>\u0414\u0435\u0434 \u0441\u0442\u0440\u043e\u0438\u0442 \u0448\u0430\u043b\u0430\u0448<br>\u0428\u0430\u043b\u0430\u0448 \u0431\u044b\u043b \u0445\u043e\u0440\u043e\u0448<br>\u0414\u0435\u0434 \u0441\u043b\u044b\u0448\u0438\u0442 \u0442\u043e\u043f\u043e\u0442<br>\u0410\u0440\u0430 \u0437\u0430\u043b\u0435\u0442\u0435\u043b \u0432 \u0448\u0430\u043b\u0430\u0448<br> <br> <br>|\u0410\u043d\u043d\u0430<br>\u0410\u0440\u0430<br>\u0414\u0435\u0434<br>\u0428\u0430\u043b\u0430\u0448<br>\u042f<br>\u0432<br>\u0442\u043e\u043f\u043e\u0442<br>\u0448\u0430\u043b\u0430\u0448<br>|"]}, {"cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": ["from sys import stdin", "", "res = set()", "for line in stdin:", " for word in line.rstrip(\"\\n\").split():", " if word.lower() == word[::-1].lower():", " res.add(word)", "", "print(*sorted(list(res)), sep=\"\\n\")"]}, {"cell_type": "markdown", "metadata": {}, "source": ["## **\u0422\u0440\u0430\u043d\u0441\u043b\u0438\u0442\u0435\u0440\u0430\u0446\u0438\u044f 2.0**", "\u0414\u043b\u044f \u043c\u0435\u0436\u0434\u0443\u043d\u0430\u0440\u043e\u0434\u043d\u044b\u0445 \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u043e\u0432 \u0440\u0443\u0441\u0441\u043a\u0438\u0439 \u0442\u0435\u043a\u0441\u0442 \u043f\u0440\u0435\u043e\u0431\u0440\u0430\u0437\u0443\u0435\u0442\u0441\u044f \u0441 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435\u043c \u043b\u0430\u0442\u0438\u043d\u0441\u043a\u043e\u0433\u043e \u0430\u043b\u0444\u0430\u0432\u0438\u0442\u0430. \u0413\u041e\u0421\u0422 \u0420 52535.1-2006 \u0437\u0430\u0434\u0430\u0451\u0442 \u043f\u0440\u0430\u0432\u0438\u043b\u0430 \u0442\u0440\u0430\u043d\u0441\u043b\u0438\u0442\u0435\u0440\u0430\u0446\u0438\u0438 \u0438\u0434\u0435\u043d\u0442\u0438\u0444\u0438\u043a\u0430\u0446\u0438\u043e\u043d\u043d\u044b\u0445 \u043a\u0430\u0440\u0442.<br>\u041d\u0438\u0436\u0435 \u043f\u0440\u0438\u0432\u0435\u0434\u0435\u043d\u0430 \u0442\u0430\u0431\u043b\u0438\u0446\u0430 \u0437\u0430\u043c\u0435\u043d:<br>", "\u0410 \u2014 A<br>\u0411 \u2014 B<br>\u0412 \u2014 V<br>\u0413 \u2014 G<br>\u0414 \u2014 D<br>\u0415 \u2014 E<br>\u0401 \u2014 E<br>\u0416 \u2014 ZH<br>\u0417 \u2014 Z<br>\u0418 \u2014 I<br>\u0419 \u2014 I<br>\u041a \u2014 K<br>\u041b \u2014 L<br>\u041c \u2014 M<br>\u041d \u2014 N<br>\u041e \u2014 O<br>\u041f \u2014 P<br>\u0420 \u2014 R<br>\u0421 \u2014 S<br>\u0422 \u2014 T<br>\u0423 \u2014 U<br>\u0424 \u2014 F<br>\u0425 \u2014 KH<br>\u0426 \u2014 TC<br>\u0427 \u2014 CH<br>\u0428 \u2014 SH<br>\u0429 \u2014 SHCH<br>\u042b \u2014 Y<br>\u042d \u2014 E<br>\u042e \u2014 IU<br>\u042f \u2014 IA<br>\u0414\u0430\u0432\u0430\u0439\u0442\u0435 \u0442\u0440\u0430\u043d\u0441\u043b\u0438\u0442\u0435\u0440\u0438\u0440\u0443\u0435\u043c \u0440\u0443\u0441\u0441\u043a\u0438\u0439 \u0442\u0435\u043a\u0441\u0442.<br>\u0411\u0443\u043a\u0432\u0443 \u00ab\u0451\u00bb \u0442\u0440\u0430\u043d\u0441\u043b\u0438\u0442\u0435\u0440\u0438\u0440\u0443\u0439\u0442\u0435 \u043a\u0430\u043a \u00abe\u00bb, \u00ab\u0439\u00bb \u043a\u0430\u043a \u00ab\u0438\u00bb, \u0430 \u00ab\u044a\u00bb \u0438 \u00ab\u044c\u00bb (\u0438 \u0438\u0445 \u0437\u0430\u0433\u043b\u0430\u0432\u043d\u044b\u0435 \u0432\u0435\u0440\u0441\u0438\u0438 \u00ab\u042a\u00bb \u0438 \u00ab\u042c\u00bb) \u0434\u043e\u043b\u0436\u043d\u044b \u0438\u0441\u0447\u0435\u0437\u043d\u0443\u0442\u044c \u0438\u0437 \u0442\u0435\u043a\u0441\u0442\u0430. \u0421\u0442\u0440\u043e\u0447\u043d\u044b\u0435 \u0431\u0443\u043a\u0432\u044b \u0437\u0430\u043c\u0435\u043d\u044f\u044e\u0442\u0441\u044f \u043d\u0430 \u0441\u0442\u0440\u043e\u0447\u043d\u044b\u0435, \u0437\u0430\u0433\u043b\u0430\u0432\u043d\u044b\u0435 \u0437\u0430\u043c\u0435\u043d\u044f\u044e\u0442\u0441\u044f \u043d\u0430 \u0437\u0430\u0433\u043b\u0430\u0432\u043d\u044b\u0435. \u0415\u0441\u043b\u0438 \u0437\u0430\u0433\u043b\u0430\u0432\u043d\u0430\u044f \u0431\u0443\u043a\u0432\u0430 \u043f\u0440\u0435\u0432\u0440\u0430\u0449\u0430\u0435\u0442\u0441\u044f \u043f\u0440\u0438 \u0442\u0440\u0430\u043d\u0441\u043b\u0438\u0442\u0435\u0440\u0430\u0446\u0438\u0438 \u0432 \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0431\u0443\u043a\u0432, \u0442\u043e \u0437\u0430\u0433\u043b\u0430\u0432\u043d\u043e\u0439 \u0434\u043e\u043b\u0436\u043d\u0430 \u043e\u0441\u0442\u0430\u0442\u044c\u0441\u044f \u0442\u043e\u043b\u044c\u043a\u043e \u043f\u0435\u0440\u0432\u0430\u044f \u0438\u0437 \u043d\u0438\u0445 (\u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u00ab\u0426\u00bb \u2192 \u00abTc\u00bb). \u0412\u0441\u0435 \u043d\u0435\u043a\u0438\u0440\u0438\u043b\u043b\u0438\u0447\u0435\u0441\u043a\u0438\u0435 \u0441\u0438\u043c\u0432\u043e\u043b\u044b \u0434\u043e\u043b\u0436\u043d\u044b \u043e\u0441\u0442\u0430\u0442\u044c\u0441\u044f \u043d\u0430 \u043c\u0435\u0441\u0442\u0435.", "### **\u0424\u043e\u0440\u043c\u0430\u0442 \u0432\u0432\u043e\u0434\u0430**", "\u0412 \u043e\u0434\u043d\u043e\u0439 \u043f\u0430\u043f\u043a\u0435 \u0441 \u0432\u0430\u0448\u0435\u0439 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u043e\u0439 \u043b\u0435\u0436\u0438\u0442 \u0444\u0430\u0439\u043b cyrillic.txt. \u0412 \u043d\u0451\u043c, \u0432 \u0447\u0438\u0441\u043b\u0435 \u043f\u0440\u043e\u0447\u0438\u0445, \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u0442\u0441\u044f \u043d\u0435\u043a\u043e\u0442\u043e\u0440\u043e\u0435 \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u043a\u0438\u0440\u0438\u043b\u043b\u0438\u0447\u0435\u0441\u043a\u0438\u0445 \u0441\u0438\u043c\u0432\u043e\u043b\u043e\u0432.", "### **\u0424\u043e\u0440\u043c\u0430\u0442 \u0432\u044b\u0432\u043e\u0434\u0430**", "\u0412 \u0444\u0430\u0439\u043b transliteration.txt \u0437\u0430\u043f\u0438\u0441\u0430\u0442\u044c \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442 \u0442\u0440\u0430\u043d\u0441\u043b\u0438\u0442\u0435\u0440\u0430\u0446\u0438\u0438 \u0438\u0441\u0445\u043e\u0434\u043d\u043e\u0433\u043e \u0444\u0430\u0439\u043b\u0430.", "### **\u041f\u0440\u0438\u043c\u0435\u0440 1**", "|\u0412\u0432\u043e\u0434 |\u0412\u044b\u0432\u043e\u0434|", "|-----|-----|", "|\u041f\u0440\u0438\u0432\u0435\u0442, \u043c\u0438\u0440!<br>|Privet, mir!<br>|", "### **\u041f\u0440\u0438\u043c\u0435\u0440 2**", "|\u0412\u0432\u043e\u0434 |\u0412\u044b\u0432\u043e\u0434|", "|-----|-----|", "|\u042f \u043f\u043e\u043c\u043d\u044e \u0447\u0443\u0434\u043d\u043e\u0435 \u043c\u0433\u043d\u043e\u0432\u0435\u043d\u044c\u0435: \u041f\u0435\u0440\u0435\u0434\u043e \u043c\u043d\u043e\u0439 \u044f\u0432\u0438\u043b\u0430\u0441\u044c \u0442\u044b, \u041a\u0430\u043a \u043c\u0438\u043c\u043e\u043b\u0435\u0442\u043d\u043e\u0435 \u0432\u0438\u0434\u0435\u043d\u044c\u0435, \u041a\u0430\u043a \u0433\u0435\u043d\u0438\u0439 \u0447\u0438\u0441\u0442\u043e\u0439 \u043a\u0440\u0430\u0441\u043e\u0442\u044b.<br>|Ia pomniu chudnoe mgnovene: Peredo mnoi iavilas ty, Kak mimoletnoe videne, Kak genii chistoi krasoty.<br>|"]}, {"cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": ["d = {", " '\u0410': 'A',", " '\u0430': 'a',", " '\u0411': 'B',", " '\u0431': 'b',", " '\u0412': 'V',", " '\u0432': 'v',", " '\u0413': 'G',", " '\u0433': 'g',", " '\u0414': 'D',", " '\u0434': 'd',", " '\u0415': 'E',", " '\u0435': 'e',", " '\u0401': 'E',", " '\u0451': 'e',", " '\u0416': 'Zh',", " '\u0436': 'zh',", " '\u0417': 'Z',", " '\u0437': 'z',", " '\u0418': 'I',", " '\u0438': 'i',", " '\u0419': 'I',", " '\u0439': 'i',", " '\u041a': 'K',", " '\u043a': 'k',", " '\u041b': 'L',", " '\u043b': 'l',", " '\u041c': 'M',", " '\u043c': 'm',", " '\u041d': 'N',", " '\u043d': 'n',", " '\u041e': 'O',", " '\u043e': 'o',", " '\u041f': 'P',", " '\u043f': 'p',", " '\u0420': 'R',", " '\u0440': 'r',", " '\u0421': 'S',", " '\u0441': 's',", " '\u0422': 'T',", " '\u0442': 't',", " '\u0423': 'U',", " '\u0443': 'u',", " '\u0424': 'F',", " '\u0444': 'f',", " '\u0425': 'Kh',", " '\u0445': 'kh',", " '\u0426': 'Tc',", " '\u0446': 'tc',", " '\u0427': 'Ch',", " '\u0447': 'ch',", " '\u0428': 'Sh',", " '\u0448': 'sh',", " '\u0429': 'Shch',", " '\u0449': 'shch',", " '\u042b': 'Y',", " '\u044b': 'y',", " '\u042d': 'E',", " '\u044d': 'e',", " '\u042e': 'Iu',", " '\u044e': 'iu',", " '\u042f': 'Ia',", " '\u044f': 'ia'", "}", "string = \"\"", "with open(\"cyrillic.txt\", \"r\", encoding=\"utf-8\") as input_file:", " with open(\"transliteration.txt\", \"w\", encoding=\"utf-8\") as output_file:", " for line in input_file:", " string = line", " new_string = \"\"", " for i in string: ", " if i in d.keys():", " new_string += d[i]", " elif i.lower() in [\"\u044c\", \"\u044a\"]:", " continue", " else:", " new_string += i", " output_file.write(new_string)"]}, {"cell_type": "markdown", "metadata": {}, "source": ["## **\u0424\u0430\u0439\u043b\u043e\u0432\u0430\u044f \u0441\u0442\u0430\u0442\u0438\u0441\u0442\u0438\u043a\u0430**", "\u041d\u0430\u043f\u0438\u0448\u0438\u0442\u0435 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0443, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u0434\u043b\u044f \u0437\u0430\u0434\u0430\u043d\u043d\u043e\u0433\u043e \u0444\u0430\u0439\u043b\u0430 \u0432\u044b\u0447\u0438\u0441\u043b\u044f\u0435\u0442 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0435 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u044b:<br>", "* \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u0432\u0441\u0435\u0445 \u0447\u0438\u0441\u0435\u043b;", "* \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u043f\u043e\u043b\u043e\u0436\u0438\u0442\u0435\u043b\u044c\u043d\u044b\u0445 \u0447\u0438\u0441\u0435\u043b;", "* \u043c\u0438\u043d\u0438\u043c\u0430\u043b\u044c\u043d\u043e\u0435 \u0447\u0438\u0441\u043b\u043e;", "* \u043c\u0430\u043a\u0441\u0438\u043c\u0430\u043b\u044c\u043d\u043e\u0435 \u0447\u0438\u0441\u043b\u043e;", "* \u0441\u0443\u043c\u043c\u0430 \u0432\u0441\u0435\u0445 \u0447\u0438\u0441\u0435\u043b;", "* \u0441\u0440\u0435\u0434\u043d\u0435\u0435 \u0430\u0440\u0438\u0444\u043c\u0435\u0442\u0438\u0447\u0435\u0441\u043a\u043e\u0435 \u0432\u0441\u0435\u0445 \u0447\u0438\u0441\u0435\u043b \u0441 \u0442\u043e\u0447\u043d\u043e\u0441\u0442\u044c\u044e \u0434\u043e \u0434\u0432\u0443\u0445 \u0437\u043d\u0430\u043a\u043e\u0432 \u043f\u043e\u0441\u043b\u0435 \u0437\u0430\u043f\u044f\u0442\u043e\u0439.", "", "", "### **\u0424\u043e\u0440\u043c\u0430\u0442 \u0432\u0432\u043e\u0434\u0430**", "\u041f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044c \u0432\u0432\u043e\u0434\u0438\u0442 \u0438\u043c\u044f \u0444\u0430\u0439\u043b\u0430.<br>\u0424\u0430\u0439\u043b \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u0442 \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u043b\u044c\u043d\u043e\u0435 \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u0447\u0438\u0441\u0435\u043b, \u0440\u0430\u0437\u0434\u0435\u043b\u0451\u043d\u043d\u044b\u0445 \u043f\u0440\u043e\u0431\u0435\u043b\u0430\u043c\u0438 \u0438 \u0441\u0438\u043c\u0432\u043e\u043b\u0430\u043c\u0438 \u043f\u0435\u0440\u0435\u0432\u043e\u0434\u0430 \u0441\u0442\u0440\u043e\u043a\u0438.", "### **\u0424\u043e\u0440\u043c\u0430\u0442 \u0432\u044b\u0432\u043e\u0434\u0430**", "\u0412\u044b\u0432\u0435\u0434\u0438\u0442\u0435 \u0441\u0442\u0430\u0442\u0438\u0441\u0442\u0438\u043a\u0443 \u0432 \u0443\u043a\u0430\u0437\u0430\u043d\u043d\u043e\u043c \u043f\u043e\u0440\u044f\u0434\u043a\u0435.", "### **\u041f\u0440\u0438\u043c\u0435\u0440**", "|\u0412\u0432\u043e\u0434 |\u0412\u044b\u0432\u043e\u0434|", "|-----|-----|", "|# \u041f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u0441\u043a\u0438\u0439 \u0432\u0432\u043e\u0434:<br>numbers.txt<br><br># \u0421\u043e\u0434\u0435\u0440\u0436\u0438\u043c\u043e\u0435 \u0444\u0430\u0439\u043b\u0430 numbers.txt<br>1 2 3 4 5<br>-5 -4 -3 -2 -1<br>10 20<br>20 10<br>|14<br>9<br>-5<br>20<br>60<br>4.29<br> <br> <br>|"]}, {"cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": ["file_name = input()", "", "data = []", "with open(file_name, \"r\", encoding=\"utf-8\") as file:", " for line in file:", " data += [int(i) for i in line.rstrip(\"\\n\").split()]", "", "print(len(data))", "print(len([i for i in data if i > 0]))", "print(min(data))", "print(max(data))", "print(sum(data))", "print(round(sum(data) / len(data), 2))"]}, {"cell_type": "markdown", "metadata": {}, "source": ["## **\u0424\u0430\u0439\u043b\u043e\u0432\u0430\u044f \u0440\u0430\u0437\u043d\u0438\u0446\u0430**", "\u041d\u0430\u043f\u0438\u0448\u0438\u0442\u0435 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0443, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u044f\u0435\u0442, \u043a\u0430\u043a\u0438\u0435 \u0441\u043b\u043e\u0432\u0430 \u0435\u0441\u0442\u044c \u0442\u043e\u043b\u044c\u043a\u043e \u0432 \u043e\u0434\u043d\u043e\u043c \u0438\u0437 \u0444\u0430\u0439\u043b\u043e\u0432.", "### **\u0424\u043e\u0440\u043c\u0430\u0442 \u0432\u0432\u043e\u0434\u0430**", "\u041f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044c \u0432\u0432\u043e\u0434\u0438\u0442 \u0442\u0440\u0438 \u0438\u043c\u0435\u043d\u0438 \u0444\u0430\u0439\u043b\u043e\u0432.<br>\u041a\u0430\u0436\u0434\u044b\u0439 \u0438\u0437 \u0432\u0445\u043e\u0434\u043d\u044b\u0445 \u0444\u0430\u0439\u043b\u043e\u0432 \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u0442 \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u043b\u044c\u043d\u043e\u0435 \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u0441\u043b\u043e\u0432, \u0440\u0430\u0437\u0434\u0435\u043b\u0451\u043d\u043d\u044b\u0445 \u043f\u0440\u043e\u0431\u0435\u043b\u0430\u043c\u0438 \u0438 \u0441\u0438\u043c\u0432\u043e\u043b\u0430\u043c\u0438 \u043f\u0435\u0440\u0435\u0432\u043e\u0434\u0430 \u0441\u0442\u0440\u043e\u043a\u0438.", "### **\u0424\u043e\u0440\u043c\u0430\u0442 \u0432\u044b\u0432\u043e\u0434\u0430**", "\u0412 \u0442\u0440\u0435\u0442\u0438\u0439 \u0444\u0430\u0439\u043b \u0432\u044b\u0432\u0435\u0434\u0438\u0442\u0435 \u0432 \u0430\u043b\u0444\u0430\u0432\u0438\u0442\u043d\u043e\u043c \u043f\u043e\u0440\u044f\u0434\u043a\u0435 \u0431\u0435\u0437 \u043f\u043e\u0432\u0442\u043e\u0440\u0435\u043d\u0438\u0439 \u0441\u043f\u0438\u0441\u043e\u043a \u0441\u043b\u043e\u0432, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0435\u0441\u0442\u044c \u0442\u043e\u043b\u044c\u043a\u043e \u0432 \u043e\u0434\u043d\u043e\u043c \u0438\u0437 \u0444\u0430\u0439\u043b\u043e\u0432.", "### **\u041f\u0440\u0438\u043c\u0435\u0440**", "|\u0412\u0432\u043e\u0434 |\u0412\u044b\u0432\u043e\u0434|", "|-----|-----|", "|# \u041f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u0441\u043a\u0438\u0439 \u0432\u0432\u043e\u0434:<br>first.txt<br>second.txt<br>answer.txt<br><br># \u0421\u043e\u0434\u0435\u0440\u0436\u0438\u043c\u043e\u0435 \u0444\u0430\u0439\u043b\u0430 first.txt<br>\u043a\u043e\u0444\u0435 \u043c\u043e\u043b\u043e\u043a\u043e<br>\u0447\u0430\u0439 \u043f\u0435\u0447\u0435\u043d\u044c\u0435<br>\u0432\u0435\u043b\u043e\u0441\u0438\u043f\u0435\u0434<br><br># \u0421\u043e\u0434\u0435\u0440\u0436\u0438\u043c\u043e\u0435 \u0444\u0430\u0439\u043b\u0430 second.txt<br>\u043a\u043e\u0444\u0435 \u0432\u0435\u043b\u043e\u0441\u0438\u043f\u0435\u0434<br>\u043f\u0440\u044f\u043d\u0438\u043a \u0436\u0432\u0430\u0447\u043a\u0430 \u0432\u0435\u0441\u043b\u043e<br><br>|# \u0421\u043e\u0434\u0435\u0440\u0436\u0438\u043c\u043e\u0435 \u0444\u0430\u0439\u043b\u0430 answer.txt<br>\u0432\u0435\u0441\u043b\u043e<br>\u0436\u0432\u0430\u0447\u043a\u0430<br>\u043c\u043e\u043b\u043e\u043a\u043e<br>\u043f\u0435\u0447\u0435\u043d\u044c\u0435<br>\u043f\u0440\u044f\u043d\u0438\u043a<br>\u0447\u0430\u0439<br> <br> <br> <br> <br> <br> <br> <br>|"]}, {"cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": ["file1_name, file2_name = input(), input()", "fileres_name = input()", "set1, set2 = set(), set()", "", "with open(file1_name, \"r\", encoding=\"utf-8\") as file1:", " for line in file1:", " for word in line.rstrip(\"\\n\").split():", " set1.add(word)", "", "with open(file2_name, \"r\", encoding=\"utf-8\") as file2:", " for line in file2:", " for word in line.rstrip(\"\\n\").split():", " set2.add(word)", "", "res = sorted(list(set1 ^ set2))", "", "with open(fileres_name, \"w+\", encoding=\"utf-8\") as fileres:", " for elem in res:", " fileres.write(f\"{elem}\\n\")"]}, {"cell_type": "markdown", "metadata": {}, "source": ["## **\u0424\u0430\u0439\u043b\u043e\u0432\u0430\u044f \u0447\u0438\u0441\u0442\u043a\u0430**", "Python \u0432 \u043f\u0435\u0440\u0432\u0443\u044e \u043e\u0447\u0435\u0440\u0435\u0434\u044c \u0441\u043a\u0440\u0438\u043f\u0442\u043e\u0432\u044b\u0439 \u044f\u0437\u044b\u043a. \u0422\u0430\u043a\u0438\u0435 \u044f\u0437\u044b\u043a\u0438 \u0447\u0430\u0441\u0442\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044e\u0442\u0441\u044f \u0434\u043b\u044f \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044f \u043a\u043e\u043d\u0441\u043e\u043b\u044c\u043d\u044b\u0445 \u0443\u0442\u0438\u043b\u0438\u0442.<br><br>\u041d\u0430\u043f\u0438\u0448\u0438\u0442\u0435 \u043f\u0440\u043e\u0441\u0442\u0443\u044e \u0443\u0442\u0438\u043b\u0438\u0442\u0443, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u043e\u0447\u0438\u0449\u0430\u0435\u0442 \u0437\u0430\u0434\u0430\u043d\u043d\u044b\u0439 \u0444\u0430\u0439\u043b \u043e\u0442:<br>", "* \u043f\u043e\u0432\u0442\u043e\u0440\u044f\u044e\u0449\u0438\u0445\u0441\u044f \u043f\u0440\u043e\u0431\u0435\u043b\u043e\u0432;", "* \u043f\u043e\u0432\u0442\u043e\u0440\u044f\u044e\u0449\u0438\u0445\u0441\u044f \u0441\u0438\u043c\u0432\u043e\u043b\u043e\u0432 \u043f\u0435\u0440\u0435\u0432\u043e\u0434\u0430 \u0441\u0442\u0440\u043e\u043a\u0438;", "* \u0442\u0430\u0431\u0443\u043b\u044f\u0446\u0438\u0439,", "* \u0438\u0437\u043b\u0438\u0448\u043d\u0438\u0445 \u043f\u0440\u043e\u0431\u0435\u043b\u043e\u0432 \u0432 \u043d\u0430\u0447\u0430\u043b\u0435 \u0438 \u043a\u043e\u043d\u0446\u0435 \u0441\u0442\u0440\u043e\u043a.", "", "", "### **\u0424\u043e\u0440\u043c\u0430\u0442 \u0432\u0432\u043e\u0434\u0430**", "\u041f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044c \u0432\u0432\u043e\u0434\u0438\u0442 \u0434\u0432\u0430 \u0438\u043c\u0435\u043d\u0438 \u0444\u0430\u0439\u043b\u043e\u0432.<br>\u0412\u0445\u043e\u0434\u043d\u043e\u0439 \u0444\u0430\u0439\u043b \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u0442 \u043d\u0435\u0444\u043e\u0440\u043c\u0430\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u0439 \u0442\u0435\u043a\u0441\u0442 \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u043b\u044c\u043d\u043e\u0439 \u0434\u043b\u0438\u043d\u044b.", "### **\u0424\u043e\u0440\u043c\u0430\u0442 \u0432\u044b\u0432\u043e\u0434\u0430**", "\u0412\u043e \u0432\u0442\u043e\u0440\u043e\u0439 \u0444\u0430\u0439\u043b \u0432\u044b\u0432\u0435\u0434\u0438\u0442\u0435 \u043e\u0447\u0438\u0449\u0435\u043d\u043d\u044b\u0439 \u0442\u0435\u043a\u0441\u0442.", "### **\u041f\u0440\u0438\u043c\u0435\u0440**", "|\u0412\u0432\u043e\u0434 |\u0412\u044b\u0432\u043e\u0434|", "|-----|-----|", "|# \u041f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u0441\u043a\u0438\u0439 \u0432\u0432\u043e\u0434:<br>first.txt<br>second.txt<br><br># \u0421\u043e\u0434\u0435\u0440\u0436\u0438\u043c\u043e\u0435 \u0444\u0430\u0439\u043b\u0430 first.txt<br> \u043e\u0447\u0435\u043d\u044c \t\t \u043f\u043b\u043e\u0445\u043e \u0444\u043e\u0440\u043c\u0430\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u0439 \u0442\u0435\u043a\u0441\u0442<br><br><br>\u043d\u0443\t\t\u043d\u0443\t<br>\u043f\u0440\u044f\u043c\u043e<br><br>\u043e\u0447\u0435\u043d\u044c-\u043e\u0447\u0435\u043d\u044c<br><br>\t<br>|# \u0421\u043e\u0434\u0435\u0440\u0436\u0438\u043c\u043e\u0435 \u0444\u0430\u0439\u043b\u0430 second.txt<br>\u043e\u0447\u0435\u043d\u044c \u043f\u043b\u043e\u0445\u043e \u0444\u043e\u0440\u043c\u0430\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u0439 \u0442\u0435\u043a\u0441\u0442<br>\u043d\u0443\u043d\u0443<br>\u043f\u0440\u044f\u043c\u043e<br>\u043e\u0447\u0435\u043d\u044c-\u043e\u0447\u0435\u043d\u044c<br> <br> <br> <br> <br> <br> <br> <br> <br> <br>|"]}, {"cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": ["first_file_name, second_file_name = input(), input()", "", "with open(first_file_name, \"r\", encoding=\"utf-8\") as first_file:", " with open(second_file_name, \"w\", encoding=\"utf-8\") as second_file:", " for line in first_file:", " string = line.rstrip(\"\\n\")", " if not string:", " continue", " if \"\\t\" in string:", " while \"\\t\" in string:", " ind = string.index(\"\\t\")", " string = string[:ind] + string[ind + 1:]", " words = string.split()", " string = \" \".join(words)", " second_file.write(string + \"\\n\")"]}, {"cell_type": "markdown", "metadata": {}, "source": ["## **\u0425\u0432\u043e\u0441\u0442**", "\u0412 \u0441\u0435\u043c\u0435\u0439\u0441\u0442\u0432\u0435 \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u043e\u043d\u043d\u044b\u0445 \u0441\u0438\u0441\u0442\u0435\u043c Linux \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u0435\u0442 \u043e\u0434\u043d\u0430 \u043f\u0440\u0435\u043a\u0440\u0430\u0441\u043d\u0430\u044f \u043a\u043e\u043d\u0441\u043e\u043b\u044c\u043d\u0430\u044f \u0443\u0442\u0438\u043b\u0438\u0442\u0430 \u2014 tail. \u041e\u043d\u0430 \u043f\u0440\u0435\u0434\u043d\u0430\u0437\u043d\u0430\u0447\u0435\u043d\u0430 \u0434\u043b\u044f \u0441\u043b\u0443\u0447\u0430\u0435\u0432, \u043a\u043e\u0433\u0434\u0430 \u043d\u0430\u043c \u043d\u0435 \u043d\u0443\u0436\u043d\u043e \u0447\u0438\u0442\u0430\u0442\u044c \u0432\u0435\u0441\u044c \u0444\u0430\u0439\u043b, \u0430 \u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e \u043f\u0440\u043e\u0441\u043c\u043e\u0442\u0440\u0435\u0442\u044c \u0442\u043e\u043b\u044c\u043a\u043e \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u043f\u043e\u0441\u043b\u0435\u0434\u043d\u0438\u0445 \u0441\u0442\u0440\u043e\u043a.<br><br>\u041d\u0430\u043f\u0438\u0448\u0438\u0442\u0435 \u0430\u043d\u0430\u043b\u043e\u0433 \u044d\u0442\u043e\u0439 \u0443\u0442\u0438\u043b\u0438\u0442\u044b.", "### **\u0424\u043e\u0440\u043c\u0430\u0442 \u0432\u0432\u043e\u0434\u0430**", "\u041f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044c \u0432\u0432\u043e\u0434\u0438\u0442 \u0438\u043c\u044f \u0444\u0430\u0439\u043b\u0430 ( <br>F<br> F), \u0430 \u0437\u0430\u0442\u0435\u043c \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u0441\u0442\u0440\u043e\u043a ( <br>N<br> N), \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043e\u043d \u0445\u043e\u0447\u0435\u0442 \u0443\u0432\u0438\u0434\u0435\u0442\u044c.", "### **\u0424\u043e\u0440\u043c\u0430\u0442 \u0432\u044b\u0432\u043e\u0434\u0430**", "\u0412\u044b\u0432\u0435\u0434\u0438\u0442\u0435 <br>N<br> N \u043f\u043e\u0441\u043b\u0435\u0434\u043d\u0438\u0445 \u0441\u0442\u0440\u043e\u043a \u0444\u0430\u0439\u043b\u0430 <br>F<br> F.", "### **\u041f\u0440\u0438\u043c\u0435\u0440**", "|\u0412\u0432\u043e\u0434 |\u0412\u044b\u0432\u043e\u0434|", "|-----|-----|", "|# \u041f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u0441\u043a\u0438\u0439 \u0432\u0432\u043e\u0434:<br>some_file.txt<br>2<br><br># \u0421\u043e\u0434\u0435\u0440\u0436\u0438\u043c\u043e\u0435 \u0444\u0430\u0439\u043b\u0430 some_file.txt<br>1 \u0441\u0442\u0440\u043e\u043a\u0430<br>2 \u0441\u0442\u0440\u043e\u043a\u0430<br>3 \u0441\u0442\u0440\u043e\u043a\u0430<br>4 \u0441\u0442\u0440\u043e\u043a\u0430<br>5 \u0441\u0442\u0440\u043e\u043a\u0430<br>|4 \u0441\u0442\u0440\u043e\u043a\u0430<br>5 \u0441\u0442\u0440\u043e\u043a\u0430<br> <br> <br> <br> <br> <br> <br> <br> <br>|"]}, {"cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": ["file_name, n = input(), int(input())", "c = 0", "with open(file_name, \"r\", encoding=\"utf-8\") as file:", " for line in file:", " c += 1", "", "with open(file_name, \"r\", encoding=\"utf-8\") as file:", " line_number = 0", " for line in file:", " line_number += 1", " if line_number > c - n:", " print(line, end=\"\")"]}, {"cell_type": "markdown", "metadata": {}, "source": ["## **\u0424\u0430\u0439\u043b\u043e\u0432\u0430\u044f \u0441\u0442\u0430\u0442\u0438\u0441\u0442\u0438\u043a\u0430 2.0**", "\u041d\u0430\u043f\u0438\u0448\u0438\u0442\u0435 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0443, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u0434\u043b\u044f \u0437\u0430\u0434\u0430\u043d\u043d\u043e\u0433\u043e \u0444\u0430\u0439\u043b\u0430 \u0432\u044b\u0447\u0438\u0441\u043b\u044f\u0435\u0442 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0435 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u044b:<br>", "* \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u0432\u0441\u0435\u0445 \u0447\u0438\u0441\u0435\u043b;", "* \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u043f\u043e\u043b\u043e\u0436\u0438\u0442\u0435\u043b\u044c\u043d\u044b\u0445 \u0447\u0438\u0441\u0435\u043b;", "* \u043c\u0438\u043d\u0438\u043c\u0430\u043b\u044c\u043d\u043e\u0435 \u0447\u0438\u0441\u043b\u043e;", "* \u043c\u0430\u043a\u0441\u0438\u043c\u0430\u043b\u044c\u043d\u043e\u0435 \u0447\u0438\u0441\u043b\u043e;", "* \u0441\u0443\u043c\u043c\u0430 \u0432\u0441\u0435\u0445 \u0447\u0438\u0441\u0435\u043b;", "* \u0441\u0440\u0435\u0434\u043d\u0435\u0435 \u0430\u0440\u0438\u0444\u043c\u0435\u0442\u0438\u0447\u0435\u0441\u043a\u043e\u0435 \u0432\u0441\u0435\u0445 \u0447\u0438\u0441\u0435\u043b \u0441 \u0442\u043e\u0447\u043d\u043e\u0441\u0442\u044c\u044e \u0434\u043e \u0434\u0432\u0443\u0445 \u0437\u043d\u0430\u043a\u043e\u0432 \u043f\u043e\u0441\u043b\u0435 \u0437\u0430\u043f\u044f\u0442\u043e\u0439.", "", "", "### **\u0424\u043e\u0440\u043c\u0430\u0442 \u0432\u0432\u043e\u0434\u0430**", "\u041f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044c \u0432\u0432\u043e\u0434\u0438\u0442 \u0434\u0432\u0430 \u0438\u043c\u0435\u043d\u0438 \u0444\u0430\u0439\u043b\u0430.<br>\u041f\u0435\u0440\u0432\u044b\u0439 \u0444\u0430\u0439\u043b \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u0442 \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u043b\u044c\u043d\u043e\u0435 \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u0447\u0438\u0441\u0435\u043b, \u0440\u0430\u0437\u0434\u0435\u043b\u0451\u043d\u043d\u044b\u0445 \u043f\u0440\u043e\u0431\u0435\u043b\u0430\u043c\u0438 \u0438 \u0441\u0438\u043c\u0432\u043e\u043b\u0430\u043c\u0438 \u043f\u0435\u0440\u0435\u0432\u043e\u0434\u0430 \u0441\u0442\u0440\u043e\u043a\u0438.", "### **\u0424\u043e\u0440\u043c\u0430\u0442 \u0432\u044b\u0432\u043e\u0434\u0430**", "\u0412\u044b\u0432\u0435\u0434\u0438\u0442\u0435 \u0441\u0442\u0430\u0442\u0438\u0441\u0442\u0438\u043a\u0443 \u0432\u043e \u0432\u0442\u043e\u0440\u043e\u0439 \u0444\u0430\u0439\u043b \u0432 \u0444\u043e\u0440\u043c\u0430\u0442\u0435 JSON.<br><br>\u041a\u043b\u044e\u0447\u0438 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0439 \u0437\u0430\u0434\u0430\u0439\u0442\u0435 \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0435\u043d\u043d\u043e:<br>", "* count \u2014 \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u0432\u0441\u0435\u0445 \u0447\u0438\u0441\u0435\u043b;", "* positive_count \u2014 \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u043f\u043e\u043b\u043e\u0436\u0438\u0442\u0435\u043b\u044c\u043d\u044b\u0445 \u0447\u0438\u0441\u0435\u043b;", "* min \u2014 \u043c\u0438\u043d\u0438\u043c\u0430\u043b\u044c\u043d\u043e\u0435 \u0447\u0438\u0441\u043b\u043e;", "* max \u2014 \u043c\u0430\u043a\u0441\u0438\u043c\u0430\u043b\u044c\u043d\u043e\u0435 \u0447\u0438\u0441\u043b\u043e;", "* sum \u2014 \u0441\u0443\u043c\u043c\u0430 \u0432\u0441\u0435\u0445 \u0447\u0438\u0441\u0435\u043b;", "* average \u2014 \u0441\u0440\u0435\u0434\u043d\u0435\u0435 \u0430\u0440\u0438\u0444\u043c\u0435\u0442\u0438\u0447\u0435\u0441\u043a\u043e\u0435 \u0432\u0441\u0435\u0445 \u0447\u0438\u0441\u0435\u043b \u0441 \u0442\u043e\u0447\u043d\u043e\u0441\u0442\u044c\u044e \u0434\u043e \u0434\u0432\u0443\u0445 \u0437\u043d\u0430\u043a\u043e\u0432 \u043f\u043e\u0441\u043b\u0435 \u0437\u0430\u043f\u044f\u0442\u043e\u0439.", "", "", "### **\u041f\u0440\u0438\u043c\u0435\u0440**", "|\u0412\u0432\u043e\u0434 |\u0412\u044b\u0432\u043e\u0434|", "|-----|-----|", "|# \u041f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u0441\u043a\u0438\u0439 \u0432\u0432\u043e\u0434:<br>numbers.txt<br>statistics.json<br><br># \u0421\u043e\u0434\u0435\u0440\u0436\u0438\u043c\u043e\u0435 \u0444\u0430\u0439\u043b\u0430 numbers.txt<br>1 2 3 4 5<br>-5 -4 -3 -2 -1<br>10 20<br>20 10<br>|# \u0421\u043e\u0434\u0435\u0440\u0436\u0438\u043c\u043e\u0435 \u0444\u0430\u0439\u043b\u0430 statistics.json<br>{<br> \"count\": 14,<br> \"positive_count\": 9,<br> \"min\": -5,<br> \"max\": 20,<br> \"sum\": 60,<br> \"average\": 4.29<br>}<br>|"]}, {"cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": ["import json", "", "in_file, js_file = input(), input()", "res = {\"count\": 0, \"positive_count\": 0, \"min\": float(\"inf\"),", " \"max\": float(\"-inf\"), \"sum\": 0, \"average\": 0}", "", "with open(in_file, \"r\", encoding=\"utf-8\")as inp:", " for line in inp:", " for num in [int(i) for i in line.split()]:", " res[\"count\"] += 1", " if num > 0:", " res[\"positive_count\"] += 1", " res[\"min\"] = min(res[\"min\"], num)", " res[\"max\"] = max(res[\"max\"], num)", " res[\"sum\"] += num", "", "res[\"average\"] = round((res[\"sum\"] / res[\"count\"]), 2)", "", "with open(js_file, \"w\", encoding=\"UTF-8\") as js:", " json.dump(res, js, ensure_ascii=False, indent=2)"]}, {"cell_type": "markdown", "metadata": {}, "source": ["## **\u0420\u0430\u0437\u0434\u0435\u043b\u044f\u0439 \u0438 \u0432\u043b\u0430\u0441\u0442\u0432\u0443\u0439**", "\u041d\u0430\u043f\u0438\u0448\u0438\u0442\u0435 \u0443\u0442\u0438\u043b\u0438\u0442\u0443, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u0440\u0430\u0437\u0434\u0435\u043b\u044f\u0435\u0442 \u0447\u0438\u0441\u043b\u0430, \u0437\u0430\u043f\u0438\u0441\u0430\u043d\u043d\u044b\u0435 \u0432 \u0444\u0430\u0439\u043b\u0435, \u043d\u0430 \u0442\u0440\u0438 \u0433\u0440\u0443\u043f\u043f\u044b:<br>", "* \u0447\u0438\u0441\u043b\u0430 \u0441 \u043f\u0440\u0435\u043e\u0431\u043b\u0430\u0434\u0430\u044e\u0449\u0438\u043c \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e\u043c \u0447\u0451\u0442\u043d\u044b\u0445 \u0446\u0438\u0444\u0440;", "* \u0447\u0438\u0441\u043b\u0430 \u0441 \u043f\u0440\u0435\u043e\u0431\u043b\u0430\u0434\u0430\u044e\u0449\u0438\u043c \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e\u043c \u043d\u0435\u0447\u0451\u0442\u043d\u044b\u0445 \u0446\u0438\u0444\u0440;", "* \u0447\u0438\u0441\u043b\u0430 \u0441 \u043e\u0434\u0438\u043d\u0430\u043a\u043e\u0432\u044b\u043c \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e\u043c \u0447\u0451\u0442\u043d\u044b\u0445 \u0438 \u043d\u0435\u0447\u0451\u0442\u043d\u044b\u0445 \u0446\u0438\u0444\u0440.", "", "", "### **\u0424\u043e\u0440\u043c\u0430\u0442 \u0432\u0432\u043e\u0434\u0430**", "\u041f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044c \u0432\u0432\u043e\u0434\u0438\u0442 \u0447\u0435\u0442\u044b\u0440\u0435 \u0438\u043c\u0435\u043d\u0438 \u0444\u0430\u0439\u043b\u0430.<br>\u041f\u0435\u0440\u0432\u044b\u0439 \u0444\u0430\u0439\u043b \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u0442 \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u043b\u044c\u043d\u043e\u0435 \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u0447\u0438\u0441\u0435\u043b, \u0440\u0430\u0437\u0434\u0435\u043b\u0451\u043d\u043d\u044b\u0445 \u043f\u0440\u043e\u0431\u0435\u043b\u0430\u043c\u0438 \u0438 \u0441\u0438\u043c\u0432\u043e\u043b\u0430\u043c\u0438 \u043f\u0435\u0440\u0435\u0432\u043e\u0434\u0430 \u0441\u0442\u0440\u043e\u043a\u0438.", "### **\u0424\u043e\u0440\u043c\u0430\u0442 \u0432\u044b\u0432\u043e\u0434\u0430**", "\u0412 \u0442\u0440\u0438 \u0434\u0440\u0443\u0433\u0438\u0435 \u0444\u0430\u0439\u043b\u0430 \u0432\u044b\u0432\u0435\u0434\u0438\u0442\u0435 \u0447\u0438\u0441\u043b\u0430, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043f\u043e\u0434\u0445\u043e\u0434\u044f\u0442 \u043f\u043e\u0434 \u0442\u0440\u0435\u0431\u0443\u0435\u043c\u043e\u0435 \u0443\u0441\u043b\u043e\u0432\u0438\u0435.<br>\u0421\u043e\u0445\u0440\u0430\u043d\u0438\u0442\u0435 \u043f\u043e\u043b\u043e\u0436\u0435\u043d\u0438\u0435 \u0447\u0438\u0441\u0435\u043b \u0432 \u0441\u0442\u0440\u043e\u043a\u0430\u0445.", "### **\u041f\u0440\u0438\u043c\u0435\u0440**", "|\u0412\u0432\u043e\u0434 |\u0412\u044b\u0432\u043e\u0434|", "|-----|-----|", "|# \u041f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u0441\u043a\u0438\u0439 \u0432\u0432\u043e\u0434:<br>numbers.txt<br>even.txt<br>odd.txt<br>eq.txt<br><br># \u0421\u043e\u0434\u0435\u0440\u0436\u0438\u043c\u043e\u0435 \u0444\u0430\u0439\u043b\u0430 numbers.txt<br>650975472 591084323 629700 1504180 577023<br>8460612246 42161437 29409368 58531725 5725268 2198001838<br>796451 69358 7195510 975628465 9756641<br>44200289 126541 979391 93479581 291170 28987042 86139603<br> <br> <br> <br> <br> <br> <br>|# \u0421\u043e\u0434\u0435\u0440\u0436\u0438\u043c\u043e\u0435 \u0444\u0430\u0439\u043b\u0430 even.txt<br>629700 1504180<br>8460612246 29409368 5725268 2198001838<br>975628465<br>44200289 28987042<br><br># \u0421\u043e\u0434\u0435\u0440\u0436\u0438\u043c\u043e\u0435 \u0444\u0430\u0439\u043b\u0430 odd.txt<br>650975472 591084323 577023<br>58531725<br>796451 69358 7195510 9756641<br>979391 93479581 291170<br><br># \u0421\u043e\u0434\u0435\u0440\u0436\u0438\u043c\u043e\u0435 \u0444\u0430\u0439\u043b\u0430 eq.txt<br><br>42161437<br><br>126541 86139603<br>|"]}, {"cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": ["def count_even_cif(num):", " c = 0", " for i in num:", " if int(i) % 2 == 0:", " c += 1", "", " return c", "", "", "finputname, fevenname, foddname, feqname = [input() for _ in range(4)]", "", "even, odd, eq = [], [], []", "evenfile = open(fevenname, \"w\", encoding=\"utf-8\")", "oddfile = open(foddname, \"w\", encoding=\"utf-8\")", "eqfile = open(feqname, \"w\", encoding=\"utf-8\")", "with open(finputname, \"r\", encoding=\"utf-8\")as inputfile:", " for line in inputfile:", " for num in line.rstrip(\"\\n\").split():", " ev = count_even_cif(num)", " if len(num) - ev > ev:", " odd.append(num)", " elif len(num) == 2 * ev:", " eq.append(num)", " else:", " even.append(num) ", "", " evenfile.write(\" \".join(even) + \"\\n\")", " oddfile.write(\" \".join(odd) + \"\\n\")", " eqfile.write(\" \".join(eq) + \"\\n\")", " even, odd, eq = [], [], []", " ", "evenfile.close()", "oddfile.close()", "eqfile.close()"]}, {"cell_type": "markdown", "metadata": {}, "source": ["## **\u041e\u0431\u043d\u043e\u0432\u043b\u0435\u043d\u0438\u0435 \u0434\u0430\u043d\u043d\u044b\u0445**", "\u0427\u0430\u0441\u0442\u043e \u043f\u0440\u0438\u0445\u043e\u0434\u0438\u0442\u0441\u044f \u043e\u0431\u043d\u043e\u0432\u043b\u044f\u0442\u044c \u0434\u0430\u043d\u043d\u044b\u0435.<br><br>\u0421\u043e\u0437\u0434\u0430\u0439\u0442\u0435 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0443, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u043e\u0431\u043d\u043e\u0432\u043b\u044f\u0435\u0442 JSON \u0444\u0430\u0439\u043b.", "### **\u0424\u043e\u0440\u043c\u0430\u0442 \u0432\u0432\u043e\u0434\u0430**", "\u041f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044c \u0432\u0432\u043e\u0434\u0438\u0442 \u0438\u043c\u044f \u0444\u0430\u0439\u043b\u0430.<br>\u0417\u0430\u0442\u0435\u043c \u0432\u0432\u043e\u0434\u044f\u0442\u0441\u044f \u0441\u0442\u0440\u043e\u043a\u0438 \u0432\u0438\u0434\u0430 \u043a\u043b\u044e\u0447 == \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435.", "### **\u0424\u043e\u0440\u043c\u0430\u0442 \u0432\u044b\u0432\u043e\u0434\u0430**", "\u0412 \u0437\u0430\u0434\u0430\u043d\u043d\u044b\u0439 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u0435\u043c \u0444\u0430\u0439\u043b \u0441\u043b\u0435\u0434\u0443\u0435\u0442 \u0437\u0430\u043f\u0438\u0441\u0430\u0442\u044c \u043e\u0431\u043d\u043e\u0432\u043b\u0435\u043d\u043d\u044b\u0439 JSON.", "### **\u041f\u0440\u0438\u043c\u0435\u0440**", "|\u0412\u0432\u043e\u0434 |\u0412\u044b\u0432\u043e\u0434|", "|-----|-----|", "|# \u041f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u0441\u043a\u0438\u0439 \u0432\u0432\u043e\u0434:<br>data.json<br>one == \u043e\u0434\u0438\u043d<br>two == \u0434\u0432\u0430<br>three == \u0442\u0440\u0438<br><br># \u0421\u043e\u0434\u0435\u0440\u0436\u0438\u043c\u043e\u0435 \u0444\u0430\u0439\u043b\u0430 data.json<br>{<br> \"one\": 1,<br> \"three\": 2<br>}<br>|# \u0421\u043e\u0434\u0435\u0440\u0436\u0438\u043c\u043e\u0435 \u0444\u0430\u0439\u043b\u0430 data.json<br>{<br> \"one\": \"\u043e\u0434\u0438\u043d\",<br> \"three\": \"\u0442\u0440\u0438\",<br> \"two\": \"\u0434\u0432\u0430\"<br>}<br> <br> <br> <br> <br> <br>|"]}, {"cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": ["from sys import stdin", "import json", "", "file_name = input()", "d = {}", "", "for line in stdin:", " key, val = line.rstrip().split(\" == \")", " d[key] = val", "", "with open(file_name, \"r\", encoding=\"UTF-8\") as js:", " data = json.load(js)", " for key, val in d.items():", " data[key] = val", "", "with open(file_name, \"w\", encoding=\"UTF-8\") as js:", " json.dump(data, js, ensure_ascii=False, indent=2)"]}, {"cell_type": "markdown", "metadata": {}, "source": ["## **\u0421\u043b\u0438\u044f\u043d\u0438\u0435 \u0434\u0430\u043d\u043d\u044b\u0445**", "\u041e\u0434\u043d\u0430 \u043c\u0435\u0441\u0442\u043d\u0430\u044f \u043a\u043e\u043c\u043f\u0430\u043d\u0438\u044f \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u0438\u0442 \u043e\u0431\u043d\u043e\u0432\u043b\u0435\u043d\u0438\u0435 \u0434\u0430\u043d\u043d\u044b\u0445 \u043e \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f\u0445 \u0438 \u0437\u0430\u043e\u0434\u043d\u043e \u0440\u0435\u0448\u0438\u043b\u0438 \u0440\u0435\u043e\u0440\u0433\u0430\u043d\u0438\u0437\u043e\u0432\u0430\u0442\u044c \u0441\u0438\u0441\u0442\u0435\u043c\u0443 \u0445\u0440\u0430\u043d\u0435\u043d\u0438\u044f.<br><br>\u041d\u0430\u043f\u0438\u0448\u0438\u0442\u0435 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0443, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u043e\u0431\u043d\u043e\u0432\u043b\u044f\u0435\u0442 \u0434\u0430\u043d\u043d\u044b\u0435 \u043e \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f\u0445, \u0437\u0430\u043f\u0438\u0441\u0430\u043d\u043d\u044b\u0445 \u0432 JSON \u0444\u0430\u0439\u043b\u0435.", "### **\u0424\u043e\u0440\u043c\u0430\u0442 \u0432\u0432\u043e\u0434\u0430**", "\u041f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044c \u0432\u0432\u043e\u0434\u0438\u0442 \u0434\u0432\u0430 \u0438\u043c\u0435\u043d\u0438 \u0444\u0430\u0439\u043b\u0430.<br>\u0412 \u043f\u0435\u0440\u0432\u043e\u043c \u0445\u0440\u0430\u043d\u0438\u0442\u0441\u044f JSON \u043c\u0430\u0441\u0441\u0438\u0432 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u0435\u0439.<br>\u0412\u043e \u0432\u0442\u043e\u0440\u043e\u043c \u2014 \u043c\u0430\u0441\u0441\u0438\u0432 \u043d\u043e\u0432\u044b\u0445 \u0434\u0430\u043d\u043d\u044b\u0445.<br><br>\u0418\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u044f \u043e \u043a\u0430\u0436\u0434\u043e\u043c \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u0435 \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u0442\u0441\u044f JSON \u043e\u0431\u044a\u0435\u043a\u0442\u043e\u043c, \u0432 \u043a\u043e\u0442\u043e\u0440\u043e\u043c \u043e\u0431\u044f\u0437\u0430\u0442\u0435\u043b\u044c\u043d\u043e \u043f\u0440\u0438\u0441\u0443\u0442\u0441\u0442\u0432\u0443\u0435\u0442 \u043f\u043e\u043b\u0435 name, \u043e\u043f\u0438\u0441\u044b\u0432\u0430\u044e\u0449\u0435\u0435 \u0438\u043c\u044f \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f. \u041e\u0441\u0442\u0430\u043b\u044c\u043d\u044b\u0435 \u043f\u043e\u043b\u044f \u044f\u0432\u043b\u044f\u044e\u0442\u0441\u044f \u0434\u043e\u043f\u043e\u043b\u043d\u0438\u0442\u0435\u043b\u044c\u043d\u044b\u043c\u0438.", "### **\u0424\u043e\u0440\u043c\u0430\u0442 \u0432\u044b\u0432\u043e\u0434\u0430**", "\u0412 \u043f\u0435\u0440\u0432\u044b\u0439 \u0444\u0430\u0439\u043b \u0437\u0430\u043f\u0438\u0448\u0438\u0442\u0435 \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u044e \u043e \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f\u0445 \u0432 \u0432\u0438\u0434\u0435 JSON \u043e\u0431\u044a\u0435\u043a\u0442\u0430, \u043a\u043b\u044e\u0447\u0430\u043c\u0438 \u043a\u043e\u0442\u043e\u0440\u043e\u0433\u043e \u0432\u044b\u0441\u0442\u0443\u043f\u0430\u044e\u0442 \u0438\u043c\u0435\u043d\u0430 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u0435\u0439, \u0430 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f\u043c\u0438 \u2014 \u043e\u0431\u044a\u0435\u043a\u0442\u044b \u0441 \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u0435\u0439 \u043e \u043d\u0438\u0445.<br><br>\u0415\u0441\u043b\u0438 \u043a\u0430\u043a\u0430\u044f-\u043b\u0438\u0431\u043e \u0434\u043e\u043f\u043e\u043b\u043d\u0438\u0442\u0435\u043b\u044c\u043d\u0430\u044f \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u044f \u043e \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u0435 \u0438\u0437\u043c\u0435\u043d\u044f\u0435\u0442\u0441\u044f, \u0442\u043e \u0442\u0440\u0435\u0431\u0443\u0435\u0442\u0441\u044f \u0441\u043e\u0445\u0440\u0430\u043d\u0438\u0442\u044c \u043b\u0435\u043a\u0441\u0438\u043a\u043e\u0433\u0440\u0430\u0444\u0438\u0447\u0435\u0441\u043a\u0438 \u0431\u043e\u043b\u044c\u0448\u0435\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435.", "### **\u041f\u0440\u0438\u043c\u0435\u0440**", "|\u0412\u0432\u043e\u0434 |\u0412\u044b\u0432\u043e\u0434|", "|-----|-----|", "|# \u041f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u0441\u043a\u0438\u0439 \u0432\u0432\u043e\u0434:<br>users.json<br>updates.json<br><br># \u0421\u043e\u0434\u0435\u0440\u0436\u0438\u043c\u043e\u0435 \u0444\u0430\u0439\u043b\u0430 users.json<br>[<br> {<br> \"name\": \"Ann\",<br> \"address\": \"Flower st.\"<br> },<br> {<br> \"name\": \"Bob\",<br> \"address\": \"Summer st.\",<br> \"phone\": \"+7 (123) 456-78-90\"<br> }<br>]<br><br># \u0421\u043e\u0434\u0435\u0440\u0436\u0438\u043c\u043e\u0435 \u0444\u0430\u0439\u043b\u0430 updates.json<br>[<br> {<br> \"name\": \"Ann\",<br> \"address\": \"Awesome st.\",<br> \"phone\": \"+7 (098) 765-43-21\"<br> },<br> {<br> \"name\": \"Bob\",<br> \"address\": \"Winter st.\"<br> }<br>]<br><br>|# \u0421\u043e\u0434\u0435\u0440\u0436\u0438\u043c\u043e\u0435 \u0444\u0430\u0439\u043b\u0430 users.json<br>{<br> \"Ann\": {<br> \"address\": \"Flower st.\",<br> \"phone\": \"+7 (098) 765-43-21\"<br> },<br> \"Bob\": {<br> \"address\": \"Winter st.\",<br> \"phone\": \"+7 (123) 456-78-90\"<br> }<br>}<br> <br> <br> <br> <br> <br> <br> <br> <br> <br> <br> <br> <br> <br> <br> <br> <br> <br> <br> <br>|"]}, {"cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": ["import json", "", "", "jsusersname, jsupdatesname = input(), input()", "", "", "data = []", "with open(jsusersname, \"r\", encoding=\"UTF-8\") as js:", " data = json.load(js)", "", "newdata = {}", "for d in data:", " newdata[d[\"name\"]] = {}", " for key, val in d.items():", " if key == \"name\":", " continue", " newdata[d[\"name\"]][key] = val", "", "with open(jsupdatesname, \"r\", encoding=\"UTF-8\") as js:", " data = json.load(js)", "", "for d in data:", " name = d[\"name\"]", " for key, newval in d.items():", " if key == \"name\":", " continue", " if key in newdata[name]:", " val = newdata[name][key]", " newdata[name][key] = sorted([val, newval], reverse=True)[0]", " else:", " newdata[name][key] = newval", "", "with open(jsusersname, \"w\", encoding=\"UTF-8\") as js:", " json.dump(newdata, js, ensure_ascii=False, indent=2)"]}, {"cell_type": "markdown", "metadata": {}, "source": ["## **\u041f\u043e\u0441\u0442\u0430\u0432\u044c \u0441\u0435\u0431\u044f \u043d\u0430 \u043c\u043e\u0451 \u043c\u0435\u0441\u0442\u043e**", "\u0412\u044b \u0443\u0436\u0435 \u0434\u043e\u043b\u0433\u043e\u0435 \u0432\u0440\u0435\u043c\u044f \u0440\u0435\u0448\u0430\u0435\u0442\u0435 \u0437\u0430\u0434\u0430\u0447\u0438 \u0432 \u042f\u043d\u0434\u0435\u043a\u0441.\u041a\u043e\u043d\u0442\u0435\u0441\u0442\u0435.<br>\u0421\u0435\u0433\u043e\u0434\u043d\u044f \u043f\u0440\u0438\u0448\u043b\u043e \u0432\u0440\u0435\u043c\u044f \u043f\u043e\u0447\u0443\u0432\u0441\u0442\u0432\u043e\u0432\u0430\u0442\u044c \u0441\u0435\u0431\u044f \u043d\u0430 \u0435\u0433\u043e \u043c\u0435\u0441\u0442\u0435.<br><br>\u041d\u0430\u043f\u0438\u0448\u0438\u0442\u0435 \u043d\u0435\u0431\u043e\u043b\u044c\u0448\u043e\u0439 \u043a\u0443\u0441\u043e\u0447\u0435\u043a \u0442\u0435\u0441\u0442\u0438\u0440\u0443\u044e\u0449\u0435\u0439 \u0441\u0438\u0441\u0442\u0435\u043c\u044b.<br><br>\u0412\u0430\u0448\u0435\u043c\u0443 \u0440\u0435\u0448\u0435\u043d\u0438\u044e \u0434\u043e\u0441\u0442\u0443\u043f\u0435\u043d \u0444\u0430\u0439\u043b scoring.json, \u0432 \u043a\u043e\u0442\u043e\u0440\u043e\u043c \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u0442\u0441\u044f \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u044f \u043e \u0441\u0438\u0441\u0442\u0435\u043c\u0435 \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0438.<br><br>\u041e\u0441\u043d\u043e\u0432\u043e\u0439 \u0441\u0438\u0441\u0442\u0435\u043c\u044b \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0441\u043f\u0438\u0441\u043e\u043a \u0433\u0440\u0443\u043f\u043f \u0442\u0435\u0441\u0442\u043e\u0432.<br>\u041a\u0430\u0436\u0434\u0430\u044f \u0433\u0440\u0443\u043f\u043f\u0430 \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u0442 \u0441\u043e\u0431\u043e\u0439 \u043e\u0431\u044a\u0435\u043a\u0442 \u0441 \u043f\u043e\u043b\u044f\u043c\u0438:<br>", "* points \u2014 \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u043e\u0447\u043a\u043e\u0432, \u043a\u043e\u0442\u043e\u0440\u043e\u0435 \u043c\u043e\u0436\u043d\u043e \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u0437\u0430 \u043f\u0440\u043e\u0445\u043e\u0436\u0434\u0435\u043d\u0438\u0435 \u0434\u0430\u043d\u043d\u043e\u0439 \u0433\u0440\u0443\u043f\u043f\u044b;", "* tests \u2014 \u0441\u043f\u0438\u0441\u043e\u043a \u043e\u0431\u044a\u0435\u043a\u0442\u043e\u0432 \u0441 \u043e\u043f\u0438\u0441\u0430\u043d\u0438\u0435\u043c \u043a\u043e\u043d\u043a\u0440\u0435\u0442\u043d\u043e\u0433\u043e \u0442\u0435\u0441\u0442\u0430.", "", "\u041e\u0431\u044a\u0435\u043a\u0442 \u043e\u043f\u0438\u0441\u044b\u0432\u0430\u044e\u0449\u0438\u0439 \u0442\u0435\u0441\u0442 \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u0442 \u043f\u043e\u043b\u044f:<br>", "* input \u2014 \u0441\u0442\u0440\u043e\u043a\u0430 \u0432\u0445\u043e\u0434\u043d\u044b\u0445 \u0434\u0430\u043d\u043d\u044b\u0445 \u0442\u0435\u0441\u0442\u0430;", "* pattern \u2014 \u0441\u0442\u0440\u043e\u043a\u0430 \u043e\u0436\u0438\u0434\u0430\u0435\u043c\u044b\u0445 \u0432 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0435 \u043e\u0442\u0432\u0435\u0442\u0430.", "", "\u0412 \u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u043d\u044b\u0439 \u043f\u043e\u0442\u043e\u043a \u0432\u0432\u043e\u0434\u0430 \u0432\u0430\u0448\u0435\u0433\u043e \u0440\u0435\u0448\u0435\u043d\u0438\u044f \u043f\u0435\u0440\u0435\u0434\u0430\u044e\u0442\u0441\u044f \u043e\u0442\u0432\u0435\u0442\u044b, \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u043d\u044b\u0435 \u043e\u0442 \u0442\u0435\u0441\u0442\u0438\u0440\u0443\u0435\u043c\u043e\u0439 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u044b.", "### **\u0424\u043e\u0440\u043c\u0430\u0442 \u0432\u0432\u043e\u0434\u0430**", "\u0412 \u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u043d\u044b\u0439 \u043f\u043e\u0442\u043e\u043a \u0432\u0432\u043e\u0434\u0430 \u043f\u0435\u0440\u0435\u0434\u0430\u044e\u0442\u0441\u044f \u0441\u0442\u0440\u043e\u043a\u0438 \u2014 \u043e\u0442\u0432\u0435\u0442\u044b \u0442\u0435\u0441\u0442\u0438\u0440\u0443\u0435\u043c\u043e\u0439 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u044b \u043d\u0430 \u043a\u0430\u0436\u0434\u044b\u0439 \u0442\u0435\u0441\u0442. \u0412 \u0444\u0430\u0439\u043b\u0435 scoring.json \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u0442\u0441\u044f \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u044f \u043e \u0442\u0435\u0441\u0442\u0430\u0445 \u0437\u0430\u0434\u0430\u0447\u0438.", "### **\u0424\u043e\u0440\u043c\u0430\u0442 \u0432\u044b\u0432\u043e\u0434\u0430**", "\u041e\u0434\u043d\u043e \u0447\u0438\u0441\u043b\u043e \u2014 \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u043d\u044b\u0445 \u0442\u0435\u0441\u0442\u0438\u0440\u0443\u0435\u043c\u043e\u0439 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u043e\u0439 \u0431\u0430\u043b\u043b\u043e\u0432.<br>\u0415\u0441\u043b\u0438 \u0433\u0440\u0443\u043f\u043f\u0430 \u0442\u0435\u0441\u0442\u043e\u0432 \u043d\u0435 \u0431\u044b\u043b\u0430 \u043f\u0440\u043e\u0439\u0434\u0435\u043d\u0430 \u043f\u043e\u043b\u043d\u043e\u0441\u0442\u044c\u044e, \u0442\u043e \u0437\u0430 \u0434\u0430\u043d\u043d\u0443\u044e \u0433\u0440\u0443\u043f\u043f\u0443 \u0441\u0442\u0430\u0432\u0438\u0442\u0441\u044f \u043f\u0440\u043e\u043f\u043e\u0440\u0446\u0438\u043e\u043d\u0430\u043b\u044c\u043d\u044b\u0439 \u0431\u0430\u043b\u043b.<br>\u0413\u0430\u0440\u0430\u043d\u0442\u0438\u0440\u0443\u0435\u0442\u0441\u044f, \u0447\u0442\u043e \u0431\u0430\u043b\u043b\u044b \u0437\u0430 \u0433\u0440\u0443\u043f\u043f\u0443 \u043a\u0440\u0430\u0442\u043d\u044b \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u0443 \u0442\u0435\u0441\u0442\u043e\u0432 \u0432 \u043d\u0435\u0439.", "### **\u041f\u0440\u0438\u043c\u0435\u0440**", "|\u0412\u0432\u043e\u0434 |\u0412\u044b\u0432\u043e\u0434|", "|-----|-----|", "|# \u041f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u0441\u043a\u0438\u0439 \u0432\u0432\u043e\u0434:<br>4<br>12<br>3<br>100<br>0<br><br># \u0421\u043e\u0434\u0435\u0440\u0436\u0438\u043c\u043e\u0435 \u0444\u0430\u0439\u043b\u0430 scoring.json<br>[<br> {<br> \"points\": 10,<br> \"tests\": [<br> {<br> \"input\": \"2 2\",<br> \"pattern\": \"4\"<br> },<br> {<br> \"input\": \"4 3\",<br> \"pattern\": \"7\"<br> }<br> ]<br> },<br> {<br> \"points\": 30,<br> \"tests\": [<br> {<br> \"input\": \"2 1\",<br> \"pattern\": \"3\"<br> },<br> {<br> \"input\": \"25 4\",<br> \"pattern\": \"29\"<br> },<br> {<br> \"input\": \"3 -3\",<br> \"pattern\": \"0\"<br> }<br> ]<br> }<br>]<br>|25<br> <br> <br> <br> <br> <br> <br> <br> <br> <br> <br> <br> <br> <br> <br> <br> <br> <br> <br> <br> <br> <br> <br> <br> <br> <br> <br> <br> <br> <br> <br> <br> <br> <br> <br> <br> <br> <br> <br> <br>|"]}, {"cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": ["import json", "from sys import stdin", "", "", "name = \"scoring.json\"", "", "data = []", "with open(name, \"r\", encoding=\"utf-8\") as js:", " data = json.load(js)", "", "testcnt = 0", "for elem in data:", " testcnt += len(elem[\"tests\"])", "", "c = 0", "packc = 0", "pointsum = 0", "", "d = data[packc]", "points = d[\"points\"]", "tests = d[\"tests\"]", "for line in stdin:", " answer = line.rstrip(\"\\n\")", " if c < len(tests):", " if tests[c][\"pattern\"] == answer:", " pointsum += int(points / len(tests))", " c += 1", " else:", " packc += 1", " d = data[packc]", " points = d[\"points\"]", " tests = d[\"tests\"]", " c = 0", " if c < len(tests):", " if tests[c][\"pattern\"] == answer:", " pointsum += int(points / len(tests))", " c += 1", "", "print(pointsum)"]}, {"cell_type": "markdown", "metadata": {}, "source": ["## **\u041d\u0430\u0439\u0434\u0451\u0442\u0441\u044f \u0432\u0441\u0451 3.0**", "\u0414\u0430\u0432\u0430\u0439\u0442\u0435 \u0432\u043d\u043e\u0432\u044c \u043d\u0430\u043f\u0438\u0448\u0435\u043c \u043d\u0435\u0431\u043e\u043b\u044c\u0448\u043e\u0439 \u043a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442 \u043f\u043e\u0438\u0441\u043a\u043e\u0432\u043e\u0439 \u0441\u0438\u0441\u0442\u0435\u043c\u044b.", "### **\u0424\u043e\u0440\u043c\u0430\u0442 \u0432\u0432\u043e\u0434\u0430**", "\u0421\u043d\u0430\u0447\u0430\u043b\u0430 \u0432\u0432\u043e\u0434\u0438\u0442\u0441\u044f \u043f\u043e\u0438\u0441\u043a\u043e\u0432\u044b\u0439 \u0437\u0430\u043f\u0440\u043e\u0441.<br>\u0417\u0430\u0442\u0435\u043c \u0432\u0432\u043e\u0434\u044f\u0442\u0441\u044f \u0438\u043c\u0435\u043d\u0430 \u0444\u0430\u0439\u043b\u043e\u0432, \u0441\u0440\u0435\u0434\u0438 \u043a\u043e\u0442\u043e\u0440\u044b\u0445 \u0441\u043b\u0435\u0434\u0443\u0435\u0442 \u043f\u0440\u043e\u0438\u0437\u0432\u0435\u0441\u0442\u0438 \u043f\u043e\u0438\u0441\u043a.", "### **\u0424\u043e\u0440\u043c\u0430\u0442 \u0432\u044b\u0432\u043e\u0434\u0430**", "\u0412\u044b\u0432\u0435\u0434\u0438\u0442\u0435 \u0432\u0441\u0435 \u0438\u043c\u0435\u043d\u0430 \u0444\u0430\u0439\u043b\u043e\u0432, \u0432 \u043a\u043e\u0442\u043e\u0440\u044b\u0445 \u0435\u0441\u0442\u044c \u043f\u043e\u0438\u0441\u043a\u043e\u0432\u0430\u044f \u0441\u0442\u0440\u043e\u043a\u0430 \u0431\u0435\u0437 \u0443\u0447\u0435\u0442\u0430 \u0440\u0435\u0433\u0438\u0441\u0442\u0440\u0430 \u0438 \u043f\u043e\u0432\u0442\u043e\u0440\u044f\u044e\u0449\u0438\u0445\u0441\u044f \u043f\u0440\u043e\u0431\u0435\u043b\u044c\u043d\u044b\u0445 \u0441\u0438\u043c\u0432\u043e\u043b\u043e\u0432.<br>\u0415\u0441\u043b\u0438 \u043d\u0438 \u0432 \u043e\u0434\u043d\u043e\u043c \u0444\u0430\u0439\u043b\u0435 \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u044f \u043d\u0435 \u0431\u044b\u043b\u0430 \u043d\u0430\u0439\u0434\u0435\u043d\u0430, \u0432\u044b\u0432\u0435\u0434\u0438\u0442\u0435 \"404. Not Found\".", "### **\u041f\u0440\u0438\u043c\u0435\u0447\u0430\u043d\u0438\u0435**", "\u0421\u0438\u0441\u0442\u0435\u043c\u0430 \u043f\u043e\u0438\u0441\u043a\u0430 \u0434\u043e\u043b\u0436\u043d\u0430 \u043e\u0431\u0440\u0430\u0431\u0430\u0442\u044b\u0432\u0430\u0442\u044c \u0441\u0442\u0440\u043e\u043a\u0438 \"a b\", \"a b\" \u0438 \"a\\nb\" \u043a\u0430\u043a \u043e\u0434\u0438\u043d\u0430\u043a\u043e\u0432\u044b\u0435.", "### **\u041f\u0440\u0438\u043c\u0435\u0440 1**", "|\u0412\u0432\u043e\u0434 |\u0412\u044b\u0432\u043e\u0434|", "|-----|-----|", "|# \u041f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u0441\u043a\u0438\u0439 \u0432\u0432\u043e\u0434:<br>\u041c\u0430\u043c\u0430 \u043c\u044b\u043b\u0430 \u0420\u0410\u041c\u0423<br>first.txt<br>second.txt<br><br># \u0421\u043e\u0434\u0435\u0440\u0436\u0438\u043c\u043e\u0435 \u0444\u0430\u0439\u043b\u0430 first.txt<br>\u0412 \u044d\u0442\u043e\u043c \u0444\u0430\u0439\u043b\u0435 \u0433\u043e\u0432\u043e\u0440\u0438\u0442\u0441\u044f \u043e \u0442\u043e\u043c \u0447\u0442\u043e \u041c\u0410\u041c\u0410 <br><br>\u043c\u044b\u043b\u0410<br>\u0420\u0430\u043c\u0443<br><br># \u0421\u043e\u0434\u0435\u0440\u0436\u0438\u043c\u043e\u0435 \u0444\u0430\u0439\u043b\u0430 second.txt<br>\u0410 \u0432 \u044d\u0442\u043e\u043c \u043d\u0435 \u0433\u043e\u0432\u043e\u0440\u0438\u0442\u0441\u044f<br><br>|first.txt<br> <br> <br> <br> <br> <br> <br> <br> <br> <br> <br> <br> <br> <br>|", "### **\u041f\u0440\u0438\u043c\u0435\u0440 2**", "|\u0412\u0432\u043e\u0434 |\u0412\u044b\u0432\u043e\u0434|", "|-----|-----|", "|# \u041f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u0441\u043a\u0438\u0439 \u0432\u0432\u043e\u0434:<br>Python<br>only_one_file.txt<br><br># \u0421\u043e\u0434\u0435\u0440\u0436\u0438\u043c\u043e\u0435 \u0444\u0430\u0439\u043b\u0430 only_one_file.txt<br>\u0422\u0443\u0442 \u043d\u0435\u0442 \u043d\u0438\u043a\u0430\u043a\u0438\u0445 \u0437\u043c\u0435\u0439<br><br>|404. Not Found<br> <br> <br> <br> <br> <br> <br>|"]}, {"cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": ["from sys import stdin", "", "", "search_task = input().lower().split()", "", "filenames = [line.rstrip(\"\\n\") for line in stdin]", "is_something = False", "", "for fname in filenames:", "", " active_searches = []", " ind = 0", " f = False", " with open(fname, \"r\", encoding=\"utf-8\") as file:", " for line in file:", " for word in line.replace(\" \", \" \").rstrip(\"\\n\").lower().split():", " if not word:", " continue", " if word == search_task[0]:", " active_searches.append([word])", " continue", " if active_searches:", " for i in range(len(active_searches) - 1, -1, -1):", " if len(active_searches[i]) == len(search_task):", " f = True", " break ", " elif search_task[len(active_searches[i])] == word:", " active_searches[i].append(word)", " else:", " del active_searches[i]", "", " if f:", " break", " ", " if active_searches:", " for i in range(len(active_searches) - 1, -1, -1):", " if len(active_searches[i]) == len(search_task):", " f = True", " break", " ", " if f:", " break", " if f:", " print(fname)", " is_something = True", "", "if not is_something:", " print(\"404. Not Found\")"]}, {"cell_type": "markdown", "metadata": {}, "source": ["## **\u041f\u0440\u044f\u0442\u043a\u0438**", "\u0421\u0442\u0435\u0433\u0430\u043d\u043e\u0433\u0440\u0430\u0444\u0438\u044f \u2014 \u0441\u043f\u043e\u0441\u043e\u0431 \u043f\u0435\u0440\u0435\u0434\u0430\u0447\u0438 \u0438\u043b\u0438 \u0445\u0440\u0430\u043d\u0435\u043d\u0438\u044f \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u0438 \u0441 \u0443\u0447\u0451\u0442\u043e\u043c \u0441\u043e\u0445\u0440\u0430\u043d\u0435\u043d\u0438\u044f \u0432 \u0442\u0430\u0439\u043d\u0435 \u0441\u0430\u043c\u043e\u0433\u043e \u0444\u0430\u043a\u0442\u0430 \u0442\u0430\u043a\u043e\u0439 \u043f\u0435\u0440\u0435\u0434\u0430\u0447\u0438 (\u0445\u0440\u0430\u043d\u0435\u043d\u0438\u044f).<br><br>\u0412 \u043e\u0442\u043b\u0438\u0447\u0438\u0435 \u043e\u0442 \u043a\u0440\u0438\u043f\u0442\u043e\u0433\u0440\u0430\u0444\u0438\u0438, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u0441\u043a\u0440\u044b\u0432\u0430\u0435\u0442 \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u043c\u043e\u0435 \u0442\u0430\u0439\u043d\u043e\u0433\u043e \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u044f, \u0441\u0442\u0435\u0433\u0430\u043d\u043e\u0433\u0440\u0430\u0444\u0438\u044f \u0441\u043a\u0440\u044b\u0432\u0430\u0435\u0442 \u0441\u0430\u043c \u0444\u0430\u043a\u0442 \u0435\u0433\u043e \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u043e\u0432\u0430\u043d\u0438\u044f. \u041a\u0430\u043a \u043f\u0440\u0430\u0432\u0438\u043b\u043e, \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u0435 \u0431\u0443\u0434\u0435\u0442 \u0432\u044b\u0433\u043b\u044f\u0434\u0435\u0442\u044c \u043a\u0430\u043a \u0447\u0442\u043e-\u043b\u0438\u0431\u043e \u0438\u043d\u043e\u0435, \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u043a\u0430\u043a \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u0435, \u0441\u0442\u0430\u0442\u044c\u044f, \u0441\u043f\u0438\u0441\u043e\u043a \u043f\u043e\u043a\u0443\u043f\u043e\u043a, \u043f\u0438\u0441\u044c\u043c\u043e \u0438\u043b\u0438 \u0441\u0443\u0434\u043e\u043a\u0443. \u0421\u0442\u0435\u0433\u0430\u043d\u043e\u0433\u0440\u0430\u0444\u0438\u044e \u043e\u0431\u044b\u0447\u043d\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044e\u0442 \u0441\u043e\u0432\u043c\u0435\u0441\u0442\u043d\u043e \u0441 \u043c\u0435\u0442\u043e\u0434\u0430\u043c\u0438 \u043a\u0440\u0438\u043f\u0442\u043e\u0433\u0440\u0430\u0444\u0438\u0438, \u0442\u0430\u043a\u0438\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c, \u0434\u043e\u043f\u043e\u043b\u043d\u044f\u044f \u0435\u0451.<br><br>\u041d\u0430\u043c \u0431\u044b\u043b \u0434\u0430\u043d \u0444\u0430\u0439\u043b \u0441\u043e \u0441\u043a\u0440\u044b\u0442\u044b\u043c \u0442\u0435\u043a\u0441\u0442\u043e\u043c. \u0418 \u0431\u044b\u043b\u043e \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u043e, \u0447\u0442\u043e \u0434\u043b\u044f \u0432\u044b\u0434\u0435\u043b\u0435\u043d\u0438\u044f \u043f\u043e\u043b\u0435\u0437\u043d\u043e\u0439 \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u0438, \u043d\u0443\u0436\u043d\u043e \u0438\u0437 \u043a\u0430\u0436\u0434\u043e\u0433\u043e \u043a\u043e\u0434\u0430 \u0441\u0438\u043c\u0432\u043e\u043b\u0430 \u0432 \u0442\u0435\u043a\u0441\u0442\u0435 \u00ab\u0432\u044b\u0434\u0435\u0440\u043d\u0443\u0442\u044c\u00bb \u043c\u043b\u0430\u0434\u0448\u0438\u0439 \u0431\u0430\u0439\u0442. \u042d\u0442\u043e \u0438 \u0431\u0443\u0434\u0435\u0442 \u043a\u043e\u0434 \u0441\u0438\u043c\u0432\u043e\u043b\u0430 \u043f\u043e\u043b\u0435\u0437\u043d\u043e\u0439 \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u0438.<br>\u041e\u0434\u043d\u0430\u043a\u043e \u0435\u0441\u0442\u044c \u043e\u0434\u043d\u043e \u00ab\u043d\u043e\u00bb. \u0415\u0441\u043b\u0438 \u043a\u043e\u0434 \u0441\u0438\u043c\u0432\u043e\u043b\u0430 \u043c\u0435\u043d\u044c\u0448\u0435 128 \u2014 \u044d\u0442\u043e \u0438 \u0435\u0441\u0442\u044c \u043f\u043e\u043b\u0435\u0437\u043d\u0430\u044f \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u044f.<br><br>\u0420\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0430\u0439\u0442\u0435 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0443, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u0438\u0437 \u0442\u0435\u043a\u0441\u0442\u043e\u0432\u043e\u0433\u043e \u0444\u0430\u0439\u043b\u0430 \u0432\u044b\u0434\u0435\u043b\u044f\u0435\u0442 \u043f\u043e\u043b\u0435\u0437\u043d\u0443\u044e \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u044e.", "### **\u0424\u043e\u0440\u043c\u0430\u0442 \u0432\u0432\u043e\u0434\u0430**", "\u0412 \u0444\u0430\u0439\u043b\u0435 secret.txt \u0445\u0440\u0430\u043d\u0438\u0442\u0441\u044f \u0442\u0435\u043a\u0441\u0442.", "### **\u0424\u043e\u0440\u043c\u0430\u0442 \u0432\u044b\u0432\u043e\u0434\u0430**", "\u0412\u044b\u0432\u0435\u0434\u0438\u0442\u0435 \u0441\u043f\u0440\u044f\u0442\u0430\u043d\u043d\u043e\u0435 \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u0435.", "### **\u041f\u0440\u0438\u043c\u0435\u0447\u0430\u043d\u0438\u0435**", "\u0414\u043b\u044f \u043c\u0430\u043d\u0438\u043f\u0443\u043b\u044f\u0446\u0438\u0438 \u043a\u043e\u0434\u0430\u043c\u0438 \u0441\u0438\u043c\u0432\u043e\u043b\u043e\u0432 \u0438\u0437\u0443\u0447\u0438\u0442\u0435 \u0440\u0430\u0431\u043e\u0442\u0443 \u0444\u0443\u043d\u043a\u0446\u0438\u0439 chr \u0438 ord.", "### **\u041f\u0440\u0438\u043c\u0435\u0440**", "|\u0412\u0432\u043e\u0434 |\u0412\u044b\u0432\u043e\u0434|", "|-----|-----|", "|\u1948\u0b65\u166c\u1c6c\u176f, \u1b77\u176f\u0b72\u0a6c\u0e64!<br>|Hello, world!<br>|"]}, {"cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": ["fname = \"secret.txt\"", "", "with open(fname, \"r\", encoding=\"utf-8\") as file:", " for line in file:", " string = line.rstrip(\"\\n\")", " res = ''", "", " for char in string:", " b = bin(ord(char))[2:]", " if len(b) % 8 != 0:", " bytenum = len(b) // 8 + 1", " b = \"0\" * (8 * bytenum - len(b)) + b", " if len(b) <= 8:", " res += chr(int(b, 2))", " else:", " res += chr(int(b[8:], 2))", "", " print(res)"]}, {"cell_type": "markdown", "metadata": {}, "source": ["## **\u0421\u043a\u043e\u043b\u044c\u043a\u043e \u0432\u0435\u0448\u0430\u0442\u044c \u0432 \u0431\u0430\u0439\u0442\u0430\u0445?**", "\u0420\u0430\u0437\u043c\u0435\u0440 \u2014 \u0432\u0430\u0436\u043d\u0430\u044f \u0445\u0430\u0440\u0430\u043a\u0442\u0435\u0440\u0438\u0441\u0442\u0438\u043a\u0430 \u043b\u044e\u0431\u043e\u0433\u043e \u0444\u0430\u0439\u043b\u0430. \u0412 \u043d\u0430\u0448\u0435\u0439 \u0441\u0442\u0440\u0430\u043d\u0438\u0446\u0435 \u0441\u043e\u0433\u043b\u0430\u0441\u043d\u043e \u0413\u041e\u0421\u0422 8.417-2002 \u043e\u0431\u044a\u0451\u043c \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u0438 \u0438\u0437\u043c\u0435\u0440\u044f\u0435\u0442\u0441\u044f \u0432 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0445 \u0435\u0434\u0438\u043d\u0438\u0446\u0430\u0445:<br>", "\u0431\u0438\u0442 (\u0431)<br>\u0411\u0430\u0439\u0442 (\u0411) = 8 \u0431\u0438\u0442<br>\u041a\u0438\u043b\u043e\u0431\u0430\u0439\u0442 (\u041a\u0411) = 1024 \u0411<br>\u041c\u0435\u0433\u0430\u0431\u0430\u0439\u0442 (\u041c\u0411) = 1024 \u041a\u0411<br>\u0413\u0438\u0433\u0430\u0431\u0430\u0439\u0442 (\u0413\u0411) = 1024 \u041c\u0411<br>\u041d\u0430\u043f\u0438\u0448\u0438\u0442\u0435 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0443, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u0432\u044b\u0447\u0438\u0441\u043b\u044f\u0435\u0442 \u043e\u0431\u044a\u0451\u043c \u0437\u0430\u0434\u0430\u043d\u043d\u043e\u0433\u043e \u0444\u0430\u0439\u043b\u0430.", "### **\u0424\u043e\u0440\u043c\u0430\u0442 \u0432\u0432\u043e\u0434\u0430**", "\u0412\u0432\u043e\u0434\u0438\u0442\u0441\u044f \u043e\u0434\u043d\u043e \u0438\u043c\u044f \u0444\u0430\u0439\u043b\u0430.", "### **\u0424\u043e\u0440\u043c\u0430\u0442 \u0432\u044b\u0432\u043e\u0434\u0430**", "\u0412\u044b\u0432\u0435\u0434\u0438\u0442\u0435 \u043e\u0431\u044a\u0451\u043c \u0444\u0430\u0439\u043b\u0430 \u0432 \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0443\u044e\u0449\u0438\u0445 \u0435\u0434\u0438\u043d\u0438\u0446\u0430\u0445 \u0438\u0437\u043c\u0435\u0440\u0435\u043d\u0438\u044f.<br>\u041f\u0440\u0438 \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u0438\u0438 \u0434\u0440\u043e\u0431\u043d\u043e\u0433\u043e \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f, \u043f\u0440\u043e\u0438\u0437\u0432\u0435\u0434\u0438\u0442\u0435 \u043e\u043a\u0440\u0443\u0433\u043b\u0435\u043d\u0438\u0435 \u0432\u0432\u0435\u0440\u0445.", "### **\u041f\u0440\u0438\u043c\u0435\u0447\u0430\u043d\u0438\u0435**", "\u0414\u043b\u044f \u0440\u0435\u0448\u0435\u043d\u0438\u044f \u0434\u0430\u043d\u043d\u043e\u0439 \u0437\u0430\u0434\u0430\u0447\u0438 \u0432\u044b \u043c\u043e\u0436\u0435\u0442\u0435 \u043f\u043e\u0439\u0442\u0438 \u0434\u0432\u0443\u043c\u044f \u043f\u0443\u0442\u044f\u043c\u0438:<br>", "* \u0438\u0437\u0443\u0447\u0438\u0442\u0435 \u0447\u0442\u0435\u043d\u0438\u0435 \u0444\u0430\u0439\u043b\u043e\u0432 \u0432 \u043f\u043e\u0431\u0430\u0439\u0442\u043d\u043e\u043c \u0440\u0435\u0436\u0438\u043c\u0435;", "* \u0438\u0437\u0443\u0447\u0438\u0442\u0435 \u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u043d\u0443\u044e \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0443 os.", "", "", "### **\u041f\u0440\u0438\u043c\u0435\u0440 1**", "|\u0412\u0432\u043e\u0434 |\u0412\u044b\u0432\u043e\u0434|", "|-----|-----|", "|# \u041f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u0441\u043a\u0438\u0439 \u0432\u0432\u043e\u0434<br>file.txt<br><br># \u0421\u043e\u0434\u0435\u0440\u0436\u0438\u043c\u043e\u0435 \u0444\u0430\u0439\u043b\u0430 file.txt<br>\u042d\u0442\u043e\u0442 \u0444\u0430\u0439\u043b \u0432\u0435\u0441\u0438\u0442 \u0431\u043e\u043b\u044c\u0448\u0435 \u0447\u0435\u043c \u043a\u0430\u0436\u0435\u0442\u0441\u044f ))<br>|67\u0411<br> <br> <br> <br> <br>|", "### **\u041f\u0440\u0438\u043c\u0435\u0440 2**", "|\u0412\u0432\u043e\u0434 |\u0412\u044b\u0432\u043e\u0434|", "|-----|-----|", "|# \u041f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u0441\u043a\u0438\u0439 \u0432\u0432\u043e\u0434<br>another_file.txt<br><br># \u0421\u043e\u0434\u0435\u0440\u0436\u0438\u043c\u043e\u0435 \u0444\u0430\u0439\u043b\u0430 another_file.txt<br>\u0425\u043e\u0442\u0435\u043b\u043e\u0441\u044c \u0431\u044b \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u043f\u0440\u0438\u043c\u0435\u0440 \u0441 \u0444\u0430\u0439\u043b\u043e\u043c \u0431\u043e\u043b\u044c\u0448\u0435 1\u041a\u0411<br>\u041d\u0435 \u043f\u0435\u0440\u0435\u0436\u0438\u0432\u0430\u0439\u0442\u0435, \u0442\u0430\u043a\u043e\u0439 \u043e\u0431\u044f\u0437\u0430\u0442\u0435\u043b\u044c\u043d\u043e \u0431\u0443\u0434\u0435\u0442 \u0432 \u0441\u043a\u0440\u044b\u0442\u044b\u0445 \u0442\u0435\u0441\u0442\u0430\u0445 ))<br>|193\u0411<br> <br> <br> <br> <br> <br>|"]}, {"cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": ["import os", "", "types = [\"\u0411\", \"\u041a\u0411\", \"\u041c\u0411\", \"\u0413\u0411\"]", "fname = input()", "bytessum = 0", "type = 0", "bytessum = os.stat(fname).st_size", " ", "while bytessum >= 1024:", " if bytessum == 3:", " break", " type += 1", " bytessum = bytessum // 1024 + (bytessum % 1024 > 0)", "", "print(f\"{bytessum}{types[type]}\")", ""]}, {"cell_type": "markdown", "metadata": {}, "source": ["## **\u042d\u0442\u043e \u0431\u0443\u0434\u0435\u0442 \u043d\u0430\u0448 \u0441\u0435\u043a\u0440\u0435\u0442**", "\u0428\u0438\u0444\u0440 \u0426\u0435\u0437\u0430\u0440\u044f, \u0442\u0430\u043a\u0436\u0435 \u0438\u0437\u0432\u0435\u0441\u0442\u043d\u044b\u0439 \u043a\u0430\u043a \u0448\u0438\u0444\u0440 \u0441\u0434\u0432\u0438\u0433\u0430, \u043a\u043e\u0434 \u0426\u0435\u0437\u0430\u0440\u044f \u2014 \u043e\u0434\u0438\u043d \u0438\u0437 \u0441\u0430\u043c\u044b\u0445 \u043f\u0440\u043e\u0441\u0442\u044b\u0445 \u0438 \u043d\u0430\u0438\u0431\u043e\u043b\u0435\u0435 \u0448\u0438\u0440\u043e\u043a\u043e \u0438\u0437\u0432\u0435\u0441\u0442\u043d\u044b\u0445 \u043c\u0435\u0442\u043e\u0434\u043e\u0432 \u0448\u0438\u0444\u0440\u043e\u0432\u0430\u043d\u0438\u044f. \u041e\u043d \u043d\u0430\u0437\u0432\u0430\u043d \u0432 \u0447\u0435\u0441\u0442\u044c \u0440\u0438\u043c\u0441\u043a\u043e\u0433\u043e \u043f\u043e\u043b\u043a\u043e\u0432\u043e\u0434\u0446\u0430 \u0413\u0430\u044f \u042e\u043b\u0438\u044f \u0426\u0435\u0437\u0430\u0440\u044f, \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0432\u0448\u0435\u0433\u043e \u0435\u0433\u043e \u0434\u043b\u044f \u0441\u0435\u043a\u0440\u0435\u0442\u043d\u043e\u0439 \u043f\u0435\u0440\u0435\u043f\u0438\u0441\u043a\u0438 \u0441\u043e \u0441\u0432\u043e\u0438\u043c\u0438 \u0433\u0435\u043d\u0435\u0440\u0430\u043b\u0430\u043c\u0438.<br><br>\u0414\u0430\u0432\u0430\u0439\u0442\u0435 \u0440\u0435\u0430\u043b\u0438\u0437\u0443\u0435\u043c \u044d\u0442\u0443 \u0441\u0438\u0441\u0442\u0435\u043c\u0443 \u0448\u0438\u0444\u0440\u043e\u0432\u0430\u043d\u0438\u044f. \u041e\u0434\u043d\u0430\u043a\u043e \u0434\u043b\u044f \u043f\u0440\u043e\u0441\u0442\u043e\u0442\u044b \u043c\u044b \u0431\u0443\u0434\u0435\u043c \u0441\u0434\u0432\u0438\u0433\u0430\u0442\u044c \u0442\u043e\u043b\u044c\u043a\u043e \u043b\u0430\u0442\u0438\u043d\u0441\u043a\u0438\u0435 \u0441\u0438\u043c\u0432\u043e\u043b\u044b \u043f\u043e \u043a\u0440\u0443\u0433\u0443.", "### **\u0424\u043e\u0440\u043c\u0430\u0442 \u0432\u0432\u043e\u0434\u0430**", "\u0412\u0432\u043e\u0434\u0438\u0442\u0441\u044f \u0440\u0430\u0437\u043c\u0435\u0440 \u0441\u0434\u0432\u0438\u0433\u0430 \u0434\u043b\u044f \u0448\u0438\u0444\u0440\u043e\u0432\u0430\u043d\u0438\u044f.<br><br>\u0412 \u0444\u0430\u0439\u043b\u0435 public.txt \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u0442\u0441\u044f \u0442\u0435\u043a\u0441\u0442 \u043d\u0430 \u0430\u043d\u0433\u043b\u0438\u0439\u0441\u043a\u043e\u043c \u044f\u0437\u044b\u043a\u0435.", "### **\u0424\u043e\u0440\u043c\u0430\u0442 \u0432\u044b\u0432\u043e\u0434\u0430**", "\u0412 \u0444\u0430\u0439\u043b private.txt \u0437\u0430\u043f\u0438\u0448\u0438\u0442\u0435 \u0437\u0430\u0448\u0438\u0444\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u0439 \u0442\u0435\u043a\u0441\u0442.", "### **\u041f\u0440\u0438\u043c\u0435\u0440 1**", "|\u0412\u0432\u043e\u0434 |\u0412\u044b\u0432\u043e\u0434|", "|-----|-----|", "|# \u041f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u0441\u043a\u0438\u0439 \u0432\u0432\u043e\u0434<br>3<br><br># \u0421\u043e\u0434\u0435\u0440\u0436\u0438\u043c\u043e\u0435 \u0444\u0430\u0439\u043b\u0430 public.txt<br>Hello, world!<br>|# \u0421\u043e\u0434\u0435\u0440\u0436\u0438\u043c\u043e\u0435 \u0444\u0430\u0439\u043b\u0430 private.txt<br>Khoor, zruog!<br> <br> <br> <br>|", "### **\u041f\u0440\u0438\u043c\u0435\u0440 2**", "|\u0412\u0432\u043e\u0434 |\u0412\u044b\u0432\u043e\u0434|", "|-----|-----|", "|# \u041f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u0441\u043a\u0438\u0439 \u0432\u0432\u043e\u0434<br>-10<br><br># \u0421\u043e\u0434\u0435\u0440\u0436\u0438\u043c\u043e\u0435 \u0444\u0430\u0439\u043b\u0430 public.txt<br>English alphabet: ABCDEFG...XYZ<br>|# \u0421\u043e\u0434\u0435\u0440\u0436\u0438\u043c\u043e\u0435 \u0444\u0430\u0439\u043b\u0430 private.txt<br>Udwbyix qbfxqruj: QRSTUVW...NOP<br> <br> <br> <br>|"]}, {"cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": ["inpname = \"public.txt\"", "outname = \"private.txt\"", "", "change = int(input())", "", "with open(inpname, \"r\", encoding=\"utf-8\") as inpfile:", " with open(outname, \"w\", encoding=\"utf-8\") as outfile:", " for line in inpfile:", " s = ''", " for c in line:", " code = ord(c)", " if 65 <= code <= 90:", " code += change", " if code > 90:", " while code > 90:", " code = code - 26", " elif code < 65:", " while code < 65:", " code = 26 + code", " c = chr(code)", " elif 97 <= code <= 122:", " code += change", " if code > 122:", " while code > 122:", " code = code - 26", " elif code < 97:", " while code < 97:", " code = 26 + code", " c = chr(code)", " ", " s += c", " outfile.write(s)", "", "", ""]}, {"cell_type": "markdown", "metadata": {}, "source": ["## **\u0424\u0430\u0439\u043b\u043e\u0432\u0430\u044f \u0441\u0443\u043c\u043c\u0430**", "\u041d\u0430\u043f\u0438\u0448\u0438\u0442\u0435 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0443, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u0432\u044b\u0447\u0438\u0441\u043b\u044f\u0435\u0442 \u0441\u0443\u043c\u043c\u0443 \u0432\u0441\u0435\u0445 \u0437\u0430\u043f\u0438\u0441\u0430\u043d\u043d\u044b\u0445 \u0432 \u0444\u0430\u0439\u043b\u0435 \u0447\u0438\u0441\u0435\u043b \u0432 2-\u0431\u0430\u0439\u0442\u043d\u043e\u043c \u0434\u0438\u0430\u043f\u0430\u0437\u043e\u043d\u0435.", "### **\u0424\u043e\u0440\u043c\u0430\u0442 \u0432\u0432\u043e\u0434\u0430**", "\u0412 \u0444\u0430\u0439\u043b\u0435 numbers.num \u0441\u043e\u0434\u0435\u0440\u0436\u0430\u0442\u0441\u044f \u0447\u0438\u0441\u043b\u0430 \u0432 \u0443\u043a\u0430\u0437\u0430\u043d\u043d\u043e\u043c \u0444\u043e\u0440\u043c\u0430\u0442\u0435.", "### **\u0424\u043e\u0440\u043c\u0430\u0442 \u0432\u044b\u0432\u043e\u0434\u0430**", "\u041e\u0434\u043d\u043e \u0447\u0438\u0441\u043b\u043e \u2014 \u0441\u0443\u043c\u043c\u0430 \u0432\u0441\u0435\u0445 \u0447\u0438\u0441\u0435\u043b \u0432 \u0444\u0430\u0439\u043b\u0435 \u043d\u0430 2-\u0431\u0430\u0439\u0442\u043d\u043e\u043c \u0434\u0438\u0430\u043f\u0430\u0437\u043e\u043d\u0435.", "### **\u041f\u0440\u0438\u043c\u0435\u0447\u0430\u043d\u0438\u0435**", "\u0414\u043b\u044f \u043f\u0440\u043e\u0441\u0442\u043e\u0442\u044b \u0444\u0430\u0439\u043b\u044b \u0432 \u043f\u0440\u0438\u043c\u0435\u0440\u0430\u0445 \u0437\u0430\u043f\u0438\u0441\u0430\u043d\u044b \u0432 HEX \u0444\u043e\u0440\u043c\u0430\u0442\u0435. \u0412 \u044d\u0442\u043e\u043c \u0432\u0438\u0434\u0435 \u0444\u0430\u0439\u043b \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u043a\u0430\u043a \u043f\u043e\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u044c \u0447\u0435\u0442\u044b\u0440\u0435\u0445\u0437\u043d\u0430\u0447\u043d\u044b\u0445 \u0448\u0435\u0441\u0442\u043d\u0430\u0434\u0446\u0430\u0442\u0435\u0440\u0438\u0447\u043d\u044b\u0445 \u0447\u0438\u0441\u0435\u043b.<br><br>\u0412 \u043f\u0435\u0440\u0432\u043e\u043c \u043f\u0440\u0438\u043c\u0435\u0440\u0435 \u0437\u0430\u043f\u0438\u0441\u0430\u043d\u043e 5 \u0448\u0435\u0441\u0442\u043d\u0430\u0434\u0446\u0430\u0442\u0435\u0440\u0438\u0447\u043d\u044b\u0445 \u0447\u0438\u0441\u0435\u043b: 1, 2, 3, 4, 5. \u0418\u0445 \u0441\u0443\u043c\u043c\u0430 \u0440\u0430\u0432\u043d\u0430 15.<br>\u0412\u043e \u0432\u0442\u043e\u0440\u043e\u043c \u2014 255 \u0438 257. \u0418\u0445 \u0441\u0443\u043c\u043c\u0430 \u0440\u0430\u0432\u043d\u0430 512.<br><br>\u0424\u0430\u0439\u043b \u0438\u0437 \u043f\u0440\u0438\u043c\u0435\u0440\u043e\u0432 \u0432 \u0438\u0437\u043d\u0430\u0447\u0430\u043b\u044c\u043d\u043e\u043c \u0432\u0438\u0434\u0435 \u043c\u043e\u0436\u043d\u043e \u0437\u0430\u0433\u0440\u0443\u0437\u0438\u0442\u044c \u0437\u0434\u0435\u0441\u044c:<br>", "\u041f\u0435\u0440\u0432\u044b\u0439 \u043f\u0440\u0438\u043c\u0435\u0440<br>\u0412\u0442\u043e\u0440\u043e\u0439 \u043f\u0440\u0438\u043c\u0435\u0440<br>\u0415\u0441\u043b\u0438 \u0432\u044b \u0445\u043e\u0442\u0438\u0442\u0435 \u0438\u0437\u0443\u0447\u0438\u0442\u044c \u043f\u0440\u0438\u043d\u0446\u0438\u043f \u0445\u0440\u0430\u043d\u0435\u043d\u0438\u044f \u0446\u0435\u043b\u044b\u0445 \u0447\u0438\u0441\u0435\u043b \u0432 \u042d\u0412\u041c, \u0441\u043e\u0432\u0435\u0442\u0443\u0435\u043c \u043f\u043e\u0447\u0438\u0442\u0430\u0442\u044c \u043f\u0440\u043e \u043f\u0440\u044f\u043c\u043e\u0439, \u043e\u0431\u0440\u0430\u0442\u043d\u044b\u0439 \u0438 \u0434\u043e\u043f\u043e\u043b\u043d\u0438\u0442\u0435\u043b\u044c\u043d\u044b\u0439 \u043a\u043e\u0434\u044b.", "### **\u041f\u0440\u0438\u043c\u0435\u0440 1**", "|\u0412\u0432\u043e\u0434 |\u0412\u044b\u0432\u043e\u0434|", "|-----|-----|", "|0001 0002 0003 0004 0005<br>|15<br>|", "### **\u041f\u0440\u0438\u043c\u0435\u0440 2**", "|\u0412\u0432\u043e\u0434 |\u0412\u044b\u0432\u043e\u0434|", "|-----|-----|", "|00FF 0101<br>|512<br>|"]}, {"cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": ["fname = \"numbers.num\"", "", "snum = 0", "with open(fname, \"rb\") as file:", " while (byte := file.read(2)):", " snum += int.from_bytes(byte)", "", "snum = snum % 2**16", "print(snum)"]}], "metadata": {"kernelspec": {"display_name": "Python 3", "language": "python", "name": "python3"}, "language_info": {"name": "python", "version": "3.11.1"}}, "nbformat": 4, "nbformat_minor": 2}