It's possible to resign from the job within contract period.

Well, this depends upon what your contract says. If your contract specifies that "if you resign before agreed period then the expenses occured (for your training, visa, ticket etc.) would be born by you". Then yes, you have to pay the company expenses.