fork download
  1. import sys
  2. for i in range(int(sys.stdin.readline())):
  3. #import sys
  4. def get_ints():return map(int,sys.stdin.readline().strip().split())
  5. def single_ints():return int(sys.stdin.readline())
  6. def p(a):return sys.stdout.write(a)
  7. n,k=get_ints()
  8. temp=1<<k
  9. if n&temp==0:
  10. print(n+temp)
  11. else:
  12. print(n-temp)
Success #stdin #stdout 0.02s 9116KB
stdin
5
10 2
0 2
3 0
8 0
7 2
stdout
14
4
2
9
3