JavaScript faster than 100%
\n/**\n * @param {number} n\n * @param {number[][]} languages\n * @param {number[][]} friendships\n * @return {number}\n */\nvar minimumTeachings = function(n, 
```\n/**\n * @param {number} n\n * @param {number[][]} languages\n * @param {number[][]} friendships\n * @return {number}\n */\nvar minimumTeachings = function(n, languages, friendships) {\n    // user count\n    const len = languages.length\n    function Node(val) {\n        \n    }\n    Node.table = new Array(1 + len)\n    \n    \n    const lang2people = new Array(1 + n)\n    for (let lang = 1; lang <= n; lang++)\n        lang2people[lang] = []\n    for (let val = 1; val <= len; val++) {\n        const node = Node.table[val] = new Node(val)\n        const langs = languages[val - 1]\n        node.languages = new Set(langs)\n        \n        for (const lang of langs.values())\n            lang2people[lang].push(val)\n    }\n\n    \n    const commonTable = new Array(1 + len)\n    for (let val = 1; val <= len; val++)\n        commonTable[val] = []\n    for (const [lang, people] of lang2people.entries()) {\n        if (!people)    continue\n        people.sort((a, b) => a - b)\n        for (let i = 0; i < people.length - 1; i++) {\n            const fromVal = people[i]\n            for (let j = 1 + i; j < people.length; j++) {\n                const toVal = people[j]\n                if (fromVal < toVal)\n                    commonTable[fromVal][toVal] = true\n                else\n                    commonTable[toVal][fromVal] = true\n            }\n        }\n    }\n\n    \n    const edges = []\n    for (let edge of friendships.values()) {\n        let [fromVal, toVal] = edge\n        if (fromVal > toVal) {\n            [fromVal, toVal] = [toVal, fromVal]\n        }\n        \n        if (commonTable[fromVal] && commonTable[fromVal][toVal]) {\n            \n        } else {\n            edges.push(edge)\n        }\n    }\n    \n    \n    let result = len\n    for (let lang = 1; lang <= n; lang++) {\n        let teachUs = new Set()\n        for (const edge of edges.values()) {\n            const [fromVal, toVal] = edge\n            const fromNode = Node.table[fromVal], toNode = Node.table[toVal]\n            if (!fromNode.languages.has(lang))    teachUs.add(fromVal)\n            if (!toNode.languages.has(lang))  teachUs.add(toVal)\n        }\n        \n        let outcome = teachUs.size\n        result = Math.min(result, outcome)\n    }\n    \n    \n    return result\n};\n```
[]