As a little proof of concept, I include here Python 3 code for recent »Week of code 37« competition problems. All of the solutions below are fast enough and got accepted.

1. The Average Rating of Top Employees

epsilon = 10**(-9)
avg = lambda it: round(sum(it)/len(it) + epsilon, 2) # rounded half up
rating = [int(input()) for _ in range(int(input()))]
print('{:.2f}'.format(avg([x for x in rating if x >= 90])))

2. Simple language

val = 0
for typ, x in [tuple(input().split()) for _ in range(int(input()))]:
    if typ == 'set':
        val = max(val, int(x))
    elif int(x) > 0:
        val += int(x)
print(val)

3. Superior Characters

import sys

for _ in range(int(sys.stdin.readline())):
    freq = list(filter(lambda x: x, map(int, sys.stdin.readline().split())))
    total = sum(freq)
    if total <= 2:
        print(0); continue
    seek, smaller = (total + 1)//2, 0
    for el in freq:
        if smaller + el >= seek:
            left = smaller + el - seek
            if total % 2 == 0 and left > 0:
                left -= 1
            bad = max(0, left - smaller + (smaller > 0))
            print((total - 1)//2 - bad)
            break
        smaller += el

4. Dynamic Line Intersection

import sys
from collections import defaultdict

lim = 10**5 + 10
d = defaultdict(lambda: defaultdict(int))
q_arr = [0 for _ in range(lim)]

for _ in range(int(sys.stdin.readline())):
    t, *x = sys.stdin.readline().split()
    if t in '+-':
        a, b, pm = int(x[0]), int(x[1]), 1 if t == '+' else -1
        if a < 333:
            d[a][b % a] += pm
        else:
            for q in range(b % a, lim, a):
                q_arr[q] += pm
    else:
        q, res = int(x[0]), 0
        for a in d.keys():
            res += d[a][q % a]
        print(res + q_arr[q])

5. Two efficient teams

from collections import deque
from copy import deepcopy

class Graph:
    def __init__(self, graph):
        ''' graph - adjacency matrix '''
        self.graph = graph
        self.N = len(graph)

    def bfs(self, s, t, parent):
        visited = [False] * self.N
        queue = deque()
        queue.append(s)
        visited[s] = True
        while queue:
            u = queue.popleft()
            for ind, val in enumerate(self.graph[u]):
                if not visited[ind] and val > 0:
                    queue.append(ind)
                    visited[ind] = True
                    parent[ind] = u
        return visited[t]

    def EdmondsKarp(self, source, sink):
        ''' Returns maximum flow from source to sink. '''
        parent = [-1] * self.N
        max_flow = 0

        while self.bfs(source, sink, parent):
            path_flow = float("inf")
            s = sink
            while s != source:
                path_flow = min(path_flow, self.graph[parent[s]][s])
                s = parent[s]
            max_flow += path_flow
            v = sink
            while v != source:
                u = parent[v]
                self.graph[u][v] -= path_flow
                self.graph[v][u] += path_flow
                v = parent[v]
        return max_flow

n, m = map(int, input().split())
total = 0
g = [[0 for _ in range(n)] for _ in range(n)]

for _ in range(m):
    k, f = map(int, input().split())
    total += f
    l = list(map(lambda x: int(x)-1, input().split()))
    for i in range(k):
        for j in range(i + 1, k):
            g[l[i]][l[j]] += f if k == 2 else f/2
            g[l[j]][l[i]] += f if k == 2 else f/2

res = 0
for i in range(n):
    for j in range(i + 1, n):
        res = max(res, total - Graph(deepcopy(g)).EdmondsKarp(i, j))
print(int(res))

6. Z-function

n, k, M = *map(int, input().split()), 10**9+7
pwr = [pow(k, i, M) for i in range(100)]

memo = {}
def dp(c, u, f, t, l):
    if (c, u, f, t, l) in memo:
        return memo[(c, u, f, t, l)]
    res = (1 if c&1 else -1) * pwr[f + n - u - l + len(set(t))] % M if c else 0
    for i in range(u + 1, n - l + 1):
        tlist = list(t)
        for j in range(i - u, l):
            val = tlist[j + u - i]
            if tlist[j] != val:
                for a in range(l):
                    if tlist[a] == val:
                        tlist[a] = tlist[j]
        res += dp(c + 1, i, f + max(0, i - u - l), tuple(tlist), l)
        res %= M
    memo[(c, u, f, t, l)] = res
    return res

result = 0
for l in range(1, n):
    result += dp(0, 0, 0, tuple(range(l)), l)
    result %= M
print(result)