p316.ans1
======================
84 45
92 52
100 50

=================
p316.cpp
======================
#include <bits/stdc++.h>

using namespace std;

template<typename T1, typename T2>
ostream& operator<<(ostream& out, const pair<T1, T2>& x) {
    return out << x.first << ' ' << x.second;
}

template<typename T1, typename T2>
istream& operator>>(istream& in, pair<T1, T2>& x) {
    return in >> x.first >> x.second;
}

template<typename T>
istream& operator>>(istream& in, vector<T>& a) {
    for(auto& x: a) {
        in >> x;
    }
    return in;
};

template<typename T>
ostream& operator<<(ostream& out, const vector<T>& a) {
    for(auto x: a) {
        out << x << ' ';
    }
    return out;
};

int n, m;
vector<pair<int, int>> shots;

void read() {
    cin >> n >> m;
    shots.resize(m);
    cin >> shots;
}

void solve() {
    // Direct simulation of the match log:
    //
    // - hit_points[i] starts at 100, score_points[i] at 0.
    //
    // - For each shot (shooter, target), if the target still had positive
    //   hit points before the shot the shooter gains 3 score points, then
    //   the target loses 8 hit points regardless.
    //
    // - At the end every tank with positive hit points additionally gains
    //   half of its remaining hit points as score.

    vector<int> hit_points(n, 100), score_points(n, 0);
    for(auto [shooter, target]: shots) {
        shooter--;
        target--;
        if(hit_points[target] > 0) {
            score_points[shooter] += 3;
        }

        hit_points[target] -= 8;
    }

    for(int i = 0; i < n; i++) {
        if(hit_points[i] > 0) {
            score_points[i] += hit_points[i] / 2;
        }
    }

    for(int i = 0; i < n; i++) {
        cout << hit_points[i] << ' ' << score_points[i] << '\n';
    }
}

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);

    int T = 1;
    // cin >> T;
    for(int test = 1; test <= T; test++) {
        read();
        // cout << "Case #" << test << ": ";
        solve();
    }

    return 0;
}

=================
p316.in1
======================
3 3
2 1
1 2
2 1

=================
p316.py
======================
def process_match():
    N, M = map(int, input().split())
    shots = [tuple(map(int, input().split())) for _ in range(M)]

    hit_points = [100] * N
    score_points = [0] * N

    for shot in shots:
        shooter, target = shot
        shooter -= 1
        target -= 1

        if hit_points[target] > 0:
            score_points[shooter] += 3

        hit_points[target] -= 8

    for i in range(N):
        if hit_points[i] > 0:
            score_points[i] += hit_points[i] // 2

    for i in range(N):
        print(hit_points[i], score_points[i])


process_match()

=================
statement.txt
======================
316. Code Tanks
Time limit per test: 0.25 second(s)
Memory limit: 65536 kilobytes
input: standard
output: standard



Hopefully yesterday you participated in the fascinating Code Game Challenge event. And now you have a unique chance to play on the side of the organizers team. You need to solve one of the many challenging tasks organizers have met during the Code Game Challenge preparation process.

The problem is the following. You are given the log of one match with N tanks participating. The log is a sequence of successful bullet shots, i.e. hits. Shots are listed in the log in the order of the corresponding bullet hit the target tank as this happened in the match. You need to calculate the number of hit points and the score of each tank at the end of the match.

Here are the Code Game Challenge rules essential for this problem:

Each tank has 100 hit points and 0 score points at the beginning of the match.

Each shot always reduces the hit points of the target tank by 8, and if the number of hit points of the target before the shot was greater than zero, the shooting tank receives 3 score points.

Only "active" tanks (with a positive number of hit points) can shoot, so you can expect to find only shots fired by the "active" tanks in the log.

At the end of the match each tanks with positive hit points additionally receive the number of score points equal to the half of its hit points.



Input
The first line of the input contains two integer numbers N and M (2 ≤ N ≤ 6; 1 ≤ M ≤ 4000), where N is the number of tanks participating in the match and M is the number of shots fired. The following M lines contain the descriptions of the shots. Each description consists of two different integer numbers from 1 to N. The first one is the number of the tank which fired the shot and the second one is the number of the tank which was hit by the shot.

Output
Write N lines to the output, one line for each tank, in the order of the tank numbers. Write two integer numbers to each line — the number of hit points and the number of score points of the corresponding tank at the end of the match.

Example(s)
sample input
sample output
3 3
2 1
1 2
2 1
84 45
92 52
100 50

=================
