Main fixed with kattis version. UnsafePositions fixed.