Cant find this movie. please help

Only thing i remember about the movie was there was a device that makes edible stuff give intelligence. And at the end of movie main character thinks he passed because of the cake gave him intelligence but it was just a normal cake(?) and he passed the exam with his own knowledge. I watched this movie in 2010’s probably a niche movie but i dont know.