Letχ1(n) denote the maximum possible absolute value of an entry of the inverse of annbyninvertible matrix with 0,1 entries. It is proved thatχ1(n)=n(1/2+o(1))n. This solves a problem of Graham and Sloane. Letm(n) denote the maximum possible numbermsuch that given a set ofmcoins out of a collection of coins of two unknown distinct weights, one can decide if all the coins have the same weight or not usingnweighings in a regular balance beam. It is shown thatm(n)=n(1/2+o(1))n. This settles a problem of Kozlov and Vũ. LetD(n) denote the maximum possible degree of a regular multi-hypergraph onnvertices that contains no proper regular nonempty subhypergraph. It is shown thatD(n)=n(1/2+o(1))n. This improves estimates of Shapley, van Lint and Pollak. All these results and several related ones are proved by a similar technique whose main ingredient is an extension of a construction of Håstad of threshold gates that require large weights.