"I did not drink anything."
Translation:मैंने कुछ नहीं पिया।
The letter या is added to the root verbs which don't end in consonant sound but in end in vowel sound as in आ, ई, etc. For Eg: The infinitive verb खाना ends in vowel sound so या is added to its past tense as खाया (for masc. singular). Another one example, let's take बोलना which ends in consonant sound (ल ) thus its past tense will be बोला (for masc. singular). Hope mine clarifies yours.
In last sentence you use the word "pi" and you explain that there is "ne" so need not to use "ya". But in this sentence when I try like you said by using only "pi" then i got wrong answer. Im not quite to understand this. Sorry to write in roman coz i dont have devanagiri script.