Committing Brute Force version of program. Failed in CodeChef