Golang | O(N * Len(FriendShip) | Bitset, SIMD, Loop Unroll | Beat 100%
\nfunc minimumTeachings(n int, langs [][]int, friends [][]int) int {\n    m := len(langs)\n    \n    set := make([][8]uint64, m)\n    for i, lang := range langs
```\nfunc minimumTeachings(n int, langs [][]int, friends [][]int) int {\n    m := len(langs)\n    \n    set := make([][8]uint64, m)\n    for i, lang := range langs {\n        for _, l := range lang {\n           set[i] = turnOn(set[i], l - 1)\n        } \n    }\n    \n    added := make([]bool, m)\n    \n    min := m+1\n    for l := 0; l < n; l++ {\n        // try to teach language: l\n        reset(added)\n       \n        result := 0\n        for _, fri := range friends {\n            u, v := fri[0] - 1, fri[1] - 1\n            \n            if !canCommunicate(set[u], set[v]) {\n                if !contains(set[u], l) && !added[u] {\n                    added[u] = true\n                    result++\n                }\n                \n                if !contains(set[v], l) && !added[v] {\n                    added[v] = true\n                    result++\n                }\n            }\n        }\n        \n        if min > result {\n            min = result\n        }\n    }\n   \n    return min\n}\n\n// go compiler will try to use SIMD for special case like: memset 0, memset false\n// (auto-vectorization)\nfunc reset(v []bool) {\n    for i := range v {\n        v[i] = false\n    }\n}\n\n// go compiler will try to make this on stack (small buffer optimization)\n// that\'s why we must return value\nfunc turnOn(set [8]uint64, pos int) [8]uint64 {\n    set[pos >> 6] |= uint64(1 << (pos & 63))\n    return set\n}\n\nfunc contains(set [8]uint64, pos int) bool {\n    return (set[pos >> 6] >> uint64(pos & 63)) & 1 == 1\n}\n\n// loop unrolling optimization\nfunc canCommunicate(s1, s2 [8]uint64) bool {\n    return (s1[0] & s2[0] != 0) ||\n            (s1[1] & s2[1] != 0) ||\n            (s1[2] & s2[2] != 0) ||\n            (s1[3] & s2[3] != 0) ||\n            (s1[4] & s2[4] != 0) ||\n            (s1[5] & s2[5] != 0) ||\n            (s1[6] & s2[6] != 0) ||\n            (s1[7] & s2[7] != 0)\n}\n```
['Go']