Magnetic flux, current and magnetic field confusion

Relevant equations: I am confused. When dealing with Ampères law:
dl is supposed to be the length element? Like when we have Gauss' law for electric fields and we use a circular Gaussian surface, we have E(4πr^2)=Qenclosed/ε
So in this case, when we have a circular loop our dl will be 2πr, since that is the circumference of the loop ? Or do I just understand nothing of this type of problem?
I am confused because we seem to use 2π no matter what, like in this problem:

3. The attempt at the solution:
I don't see anyway to include 2π, but they still do: