Grammar
N2AI-drafted〜か〜ないかのうちに
no sooner ... than; almost before
Formation
V-辞書形 + か + V-ない形 + かのうちに(同じ動詞)
Usage
Two events happen so close together that it is unclear whether the first one had even finished. The same verb is repeated, once in the dictionary form (or た form) and once in the negative. Like 〜たとたん, the sentence normally reports a past fact, but here the nuance is 'barely finished / not quite finished', and it is a little more written and descriptive.
Examples
ベルが鳴るか鳴らないかのうちに、生徒たちは教室を出て行った。
ベルがなるかならないかのうちに、せいとたちはきょうしつをでていった。
The students left the classroom almost before the bell had rung.
彼は席に着くか着かないかのうちに、話し始めた。
かれはせきにつくかつかないかのうちに、はなしはじめた。
He began talking almost before he had sat down.
子どもは「いただきます」と言ったか言わないかのうちに、ケーキを食べ終えた。
こどもは「いただきます」といったかいわないかのうちに、ケーキをたべおえた。
The child finished the cake almost before saying "itadakimasu".