Me and my friends were working for upcoming ICPC regional. We got stuck at these two problems.

1-(This one is solved in comment sectiom) You are given an array with n elements, you can increase one element's value by one with one cost. Your goal is to make xor of all elements 0 with minimum cost. *n* <= 1000, *a*_{i} <= 10^{9}

Here is the link for the problem: http://algotester.com/en/ArchiveProblem/Display/40442

2-You will be given n intervals like [*l*_{i}, *r*_{i}]. You have to divide these intervals into two subsets A and B such that every interval belongs to exactly one subset and the intersection of A and B maximized and print this subset. The intersection of two sets of intervals is sum of every pair of intervals' (one from A, one from B) intersection length. *n* <= 100000, 0 <= *l*_{i} <= *r*_{i} <= 10^{9}

Link to this problem: http://algotester.com/en/ArchiveProblem/Display/40384

Thank you for your help (: