solved problems from SRM640