Including external code in a solution

Is it allowed to include publicly available open source code in my AI at an competition ?

Example :
I would like to use some fancy algorithm for optimization, that has been released under an open source license (MIT / GPL / other ).
Am I allowed to copy-paste the algorithm into my code ?
Is any license that allows me to do this ok ? Or am I limited to certain licenses (i.e. MIT is ok, GPL not).

yes it is allowed