Https://hack.codingblocks.com/app/practice/3/1001/problem

import java.util.*;
public class Main {
public static void main(String args[]) {
Scanner scan = new Scanner(System.in);
int tc = scan.nextInt();
long sum = 0;
while (tc != 0) {
long n = scan.nextLong();
if ((n &1)== 0) {
sum = n / 2;
} else {
sum = -((n / 2) + 1);
}
System.out.println(sum);
tc–;
}

}

}

// On hackerblock it occurs run time error