Maps and Structs

Maps and structs: counting occurrences and composite data.

A map is a "key → value" dictionary with instant access by key. It is created with make, and reading a missing key returns zero — so counting occurrences needs no checks at all: count[x]++ just works.
Go

Counting occurrences. Enter: 6, then 1 2 2 3 3 3

Careful: the order of iterating a map with range is random — Go shuffles it deliberately. If you need an order, collect the keys into a slice and sort them. A struct combines fields of different types into one type — for example, a point with coordinates or a student with a name and a score.
Go

Structs: a "student" type

Task: read n numbers and print how many distinct values there are (hint: map[int]bool as a set, the answer is the map's len). Mark the lesson as completed — the final lesson on fast input/output remains.
Доска