fork download
  1. def find_color(x):
  2. # Determine color based on the value of x
  3. return 1 if x % 2 == 1 else 0
  4.  
  5. def main():
  6. import sys
  7. input = sys.stdin.read
  8. data = input().strip().split()
  9.  
  10. Q = int(data[0]) # Number of queries
  11. results = []
  12.  
  13. index = 1
  14. for _ in range(Q):
  15. x = int(data[index])
  16. # y is not used in the color determination
  17. index += 2
  18. color = find_color(x)
  19. results.append(color)
  20.  
  21. # Print all results
  22. print(" ".join(map(str, results)))
  23.  
  24. if __name__ == "__main__":
  25. main()
Success #stdin #stdout 0.04s 9776KB
stdin
6
1 1
5 3
8 2
8 6
5 4
6 4
stdout
1 1 0 0 1 0