Harryxun/stf_run huggingface dataset:
a, b, c = map(int, input().split())
if (100*a + 10*b + c) %4 = 0:
  print("YES")
else:
  print("NO")

### FIXED CODE ###

a, b, c = map(int, input().split())
d = 100*a + 10*b + c
if d%4 == 0:
  print("YES")
else:
  print("NO")
from collections import Counter
N, M = map(int, input().split())
c = []
for i in range(N):
    a, b = map(int, input().split())
    c.append(a)
    c.append(b)
c = Counter(c)
if all(cnt%2==0 for cnt in c.values()):
    print('YES')
else:
    print('NO')

### FIXED CODE ###

from collections import Counter
N, M = map(int, input().split())
c = []
for i in range(M):
    a, b = map(int, input().split())
    c.append(a)
    c.append(b)
c = Counter(c)
if all(cnt%2==0 for cnt in c.values()):
    print('YES')
else:
    print('NO')
t=list(map(int,input().split()))
a=list(map(int,input().split()))
b=list(map(int,input().split()))
p,q=[0],[0]
x,y=[(a[0]-b[0])*t[0],(a[1]-b[1])*t[1]]
#print(x,y,abs(x)<abs(y))
#exit()
if x+y==0:
    print("infinity")
elif (x<0 and y<0) or (x>0 and y>0):
    print(0)
elif (x<0 and x+(x+y)>0) or (x>0 and x+(x+y)<0):
    print(1)
elif x<0 and x+y>0:
    print((abs(x)//(x+y))*2+[0,1][abs(x)%(x+y)>1])
elif x<0 and x+y<0:
    print((y//abs(x+y))*2)
elif x>0 and x+y<0:
    print((x//abs(x+y))*2+[0,1][x%abs(x+y)>0])
elif x>0 and x+y<0:
    print((x//abs(x+y))*2+[0,1][x%abs(x+y)>0])
else:
    print(hhh)


### FIXED CODE ###

T1, T2 = map(int, input().split())
A1, A2 = map(int, input().split())
B1, B2 = map(int, input().split())
 
P = (A1 - B1) * T1
Q = (A2 - B2) * T2
if P > 0:
	P *= -1
	Q *= -1
 
if P + Q < 0:
	print(0)
elif P + Q == 0:
	print("infinity")
else:
	S = (-P) // (P + Q)
	T = (-P) % (P + Q)
	if T != 0:
		print(S * 2 + 1)
	else:
		print(S * 2)
a=input()
b=input()

print(max(max(a+b,a-b),a*b))

### FIXED CODE ###

a, b = input().split()
a = int(a)
b = int(b)
print(max(max(a+b, a-b), a*b))
from itertools import product
class Grid():
    def __init__(self, grid, w=0, h=0, function=lambda x: x):
        self.w = w = w if w else len(grid[0])
        self.h = h = h if h else len(grid)
        dtype = type(function(grid[0][0]))
        self.grid = np.empty((h, w), dtype=dtype)
        for i, rows in zip(range(h), grid):
            for j, val in zip(range(w), rows):
                self.grid[i][j] = function(val)
    
    def is_valid_x(self, x):
        return 0 <= x < self.w
    def is_valid_y(self, y):
        return 0 <= y < self.h
    def is_valid_xy(self, x, y):
        return self.is_valid_x(x) and self.is_valid_y(y) 
    
    def __iter__(self):
        return iter(self.grid)
    def __repr__(self):
        return '\n'.join([' '.join(map(str, rows)) for rows in self.grid])

h, w = map(int, inputs[0].split())
grid = Grid(inputs[1:])

def dfs(root):
    count = 1
    stack = [root]
    while stack:
        x, y = stack.pop()
        grid.grid[y, x] = '.'
        for dx, dy in zip([1, 0, -1, 0], [0, 1, 0, -1]):
            if grid.is_valid_xy(x+dx, y+dy) and grid.grid[y+dy, x+dx] == '#':
                stack.append((x+dx, y+dy))
                count += 1
    return count

ans = 'No'
for i, j in product(range(h), range(w)):
    if grid.grid[i, j] == '#':
        if dfs((j, i)) == 1:
            ans = 'Yes'
            break
print(ans)

### FIXED CODE ###

from itertools import product
import numpy as np
inputs = open(0).readlines()

class Grid():
    def __init__(self, grid, w=0, h=0, function=lambda x: x):
        self.w = w = w if w else len(grid[0])
        self.h = h = h if h else len(grid)
        dtype = type(function(grid[0][0]))
        self.grid = np.empty((h, w), dtype=dtype)
        for i, rows in zip(range(h), grid):
            for j, val in zip(range(w), rows):
                self.grid[i][j] = function(val)
    
    def is_valid_x(self, x):
        return 0 <= x < self.w
    def is_valid_y(self, y):
        return 0 <= y < self.h
    def is_valid_xy(self, x, y):
        return self.is_valid_x(x) and self.is_valid_y(y) 
    
    def __iter__(self):
        return iter(self.grid)
    def __repr__(self):
        return '\n'.join([' '.join(map(str, rows)) for rows in self.grid])

h, w = map(int, inputs[0].split())
grid = Grid(inputs[1:])

def dfs(root):
    count = 1
    stack = [root]
    while stack:
        x, y = stack.pop()
        grid.grid[y, x] = '.'
        for dx, dy in zip([1, 0, -1, 0], [0, 1, 0, -1]):
            if grid.is_valid_xy(x+dx, y+dy) and grid.grid[y+dy, x+dx] == '#':
                stack.append((x+dx, y+dy))
                count += 1
    return count

ans = 'Yes'
for i, j in product(range(h), range(w)):
    if grid.grid[i, j] == '#':
        if dfs((j, i)) == 1:
            ans = 'No'
            break
print(ans)
a,b = list(map(int, input().split()))

if (a*b)%2 == 0:
    print(Even)

else:
    print(Odd)

### FIXED CODE ###

a,b = list(map(int, input().split()))

if (a*b)%2 == 0:
    print("Even")

else:
    print("Odd")
def fibonacci(N):
    a = 1
    b = 2
    c = 0

    if N <= 1:
        return 1
    elif N == 2:
        return 2
    else:
        for i in range(N-2):
            c = a+b
            a = b
            b = c
    return c


def main():
    N,M = map(int,input().split())
    A = [int(input()) for _ in range(M)]

    temp = 1
    for i in range(M+1):
        if i == 0:
            num = fibonacci(A[i]-1)
        else:
            if i <= M-1:
                if A[i-1] == A[i]-1:
                    print(0)
                    return
                num = fibonacci(A[i]-A[i-1]-2)
            else:
                num = fibonacci(N-A[i-1]-1)
        temp *= num
    print(temp%1000000007)


if __name__ == '__main__':
    main()


### FIXED CODE ###

def fibonacci(N):
    a = 1
    b = 2
    c = 0

    if N <= 1:
        return 1
    elif N == 2:
        return 2
    else:
        for i in range(N-2):
            c = a+b
            a = b
            b = c
    return c


def main():
    N,M = map(int,input().split())
    A = [int(input()) for _ in range(M)]

    temp = 1
    for i in range(M+1):
        if M == 0:
            temp = fibonacci(N)
            break
        else:
            if i == 0:
                num = fibonacci(A[i]-1)
            else:
                if i <= M-1:
                    if A[i-1] == A[i]-1:
                        print(0)
                        return
                    num = fibonacci(A[i]-A[i-1]-2)
                else:
                    num = fibonacci(N-A[i-1]-1)
        temp *= num
    print(temp%1000000007)


if __name__ == '__main__':
    main()
while(1):
	H, W = map(int, input().split())
	if H == 0 and W == 0:
		break
	for i in range(H):
		for j in range(W):
			print("#", end='')
			if j == W-1
				print("")

### FIXED CODE ###

while(1):
	H, W = map(int, input().split())
	if H == 0 and W == 0:
		break
	for i in range(H):
		for j in range(W):
			print("#", end='')
		print("\n", end='')
	print("\n", end='')
import numpy as np
import sys

input = sys.stdin.readline

H,W = map(int,input())

if H*W%2 == 0:
    print(int(H*W/2))
else:
    print(int(H*W)/2+1)

### FIXED CODE ###

import numpy as np
import sys

input = sys.stdin.readline

H,W = map(int,input().split())

if H == 1 or W == 1:
    print(1)
else:
    if H*W%2 == 0:
        print(H*W//2)
    else:
        print(H*W//2+1)
from collections import deque
class Graph:
    edges = {}

    def append_edge(self, sv, ev, weight = 1):
        if sv in self.edges:
            self.edges[sv].append((ev, weight))
        else:
            self.edges[sv] = [(ev, weight)]

    def bfs(self, sv):
        dist = [0]*len(self.edges.keys())
        q = deque([])   # キュー
        q.append(sv)
        dist[sv] = 0
        connect_vtxs = []
        while len(q) > 0:
            p = q.popleft()     # キュー取りだし（先頭）
            connect_vtxs.append(p)
            for (ev, w) in self.edges[p]:
                if dist[ev] != -1:
                    continue
                q.append(ev)    # キュー追加
                dist[ev] = dist[p] + 1
        return dist, connect_vtxs


N, X, Y = list(map(int, input().split()))

g = Graph()
for i in range(N - 1):
    g.append_edge(i, i + 1)
    g.append_edge(i + 1, i)
g.append_edge(X - 1, Y - 1)
g.append_edge(Y - 1, X - 1)

dist_cnt = [0]*N
for sv in range(N):
    dist, connect_vtxs = g.bfs(sv)
    for j in range(dist.shape[0]):
        if dist[j] == -1: continue
        dist_cnt[dist[j]] += 1

for i in range(N-1):
    print(int(dist_cnt[i+1]/2))


### FIXED CODE ###

K, N = list(map(int, input().split()))
A = list(map(int, input().split()))
A.append(K+A[0])
diff_list = []
for i in range(len(A) - 1):
    diff_list.append(A[i+1]-A[i])
print(K - max(diff_list))
import functools

@functools.lru_cache(None)
def Fib(n):
    if n == 1:
        return 0
    elif n == 2:
        return 1
    else:
        return Fib(n-1)+Fib(n-2)

        
n, m = [int(i) for i in input().split()]
a = [int(input()) for i in range(m)]
MOD = 1000000007

#出来ない判定
for i in range(m-1):
    if (a[i+1] - a[i]) == 1:
        print(0)
        exit()

#壊れてる床前後で組み合わせ
allnum = 1
i = 0
for b in range(m):
    allnum = (allnum * Fib(a[b]-1 - i + 2))%MOD
    i = a[b]+1

allnum = (allnum * Fib(n - i + 2))%MOD

print(allnum)

### FIXED CODE ###

import sys
 
n, m = list(map(int, input().split()))
if m > 0:
    aaa = set(map(int, sys.stdin))
else:
    aaa = set()
dp = [0] * (n + 1)
dp[0] = 1
dp[1] = 1 if 1 not in aaa else 0
MOD = 10 ** 9 + 7
 
for i in range(2, n + 1):
    if i in aaa:
        continue
    dp[i] = (dp[i - 2] + dp[i - 1]) % MOD
print(dp[n])
N, M = input.split()
a = list.split()
a.sort(reverse=True)
if (a[M-1] >= sum(a) / 4*M)==True
	print("Yes")
else print("No")

### FIXED CODE ###

N, M = map(int,input().split())
a = list(map(int,input().split()))
a.sort(reverse=True)
if a[M-1] >= sum(a) / (4*M):
	print("Yes")
else:
	print("No")
from itertools import product

value, variety = map(int, input().split())
coins = list(map(int, input().split()))
dp = [float("inf") for _ in range(value + 1)]
dp[0] = 0
for (c,j) in product(coins,list(range(value + 1))):
    dp[j] = min(dp[j], dp[j - c] + 1)
print(dp[value])

### FIXED CODE ###

from itertools import product

value, variety = map(int, input().split())
coins = list(map(int, input().split()))
dp = [float("inf") for _ in range(value + 1)]
dp[0] = 0
for (c,j) in product(coins,list(range(value + 1))):
    if c <= j:
        dp[j] = min(dp[j], dp[j - c] + 1)
    else:
        dp[j] = dp[j]
print(dp[value])
W, H, x, y = map(int, input().split())
 
print((H * W) / 2, end=" ")
 
if W / 2 == x and H /2 == y:
    print(1)
else:
    print(0)

### FIXED CODE ###

X,A = map(int, input().split())

if X < A:
    print(0)
else:
    print(10)
x = int(input().split()[1])
ans = 0
 
a = input().split()
a.sort()
 
for i in len(a):
  if a[i] > x:
    print(ans)
    break
  else:
    x-=a[i]
    if i!=len(a)-1:
      ans+=1
    else:
      if x==0:
        ans+=1
      print(ans)

### FIXED CODE ###

line = input().split()
N = int(line[0])
x = int(line[1])
ans = 0

a = input().split()
a = [int(i) for i in a]
a.sort()

for i in range(N):
    if a[i] > x:
        print(ans)
        break
    else:
        x -= a[i]
        if i != (N - 1):
            ans += 1
        else:
            if x == 0:
                ans += 1
            print(ans)
A, B = [int(i) for i in input().split()]

ans = []

true_A_max = A + 0.999
true_B_max = B + 0.999

X_A = math.floor(A / 0.08)
X_max_A = math.ceil(true_A_max /0.08)
X_B = math.floor(B / 0.1)
X_max_B = math.ceil(true_B_max /0.08)

if X_max_A - X_A >= X_max_B - X_B:
    X_min = X_B
    X_max = X_max_B

else:
    X_min = X_A
    X_max = X_max_A

for X in range(X_min, X_max):
    cal_A = math.floor(X * 0.08)
    cal_B = math.floor(X * 0.1)
    
    if cal_A == A and cal_B == B:
        ans.append(X)
            
if len(ans) > 0:
    print(min(ans))
else:
    print(-1)

### FIXED CODE ###

import math

A, B = [int(i) for i in input().split()]

ans = []

true_A_max = A + 0.999
true_B_max = B + 0.999

X_A = math.floor(A / 0.08)
X_max_A = math.ceil(true_A_max /0.08)
X_B = math.floor(B / 0.1)
X_max_B = math.ceil(true_B_max /0.08)

if X_max_A - X_A >= X_max_B - X_B:
    X_min = X_B
    X_max = X_max_B

else:
    X_min = X_A
    X_max = X_max_A

for X in range(X_min, X_max):
    cal_A = math.floor(X * 0.08)
    cal_B = math.floor(X * 0.1)
    
    if cal_A == A and cal_B == B:
        ans.append(X)
            
if len(ans) > 0:
    print(min(ans))
else:
    print(-1)
N = int(input())

point = []
dist = []

for _ in range(N) :
    x, y = map(int, input().split())
    point.append((x, y))
    dist.append(abs(x) + abs(y))

distSort = sorted(dist)
maxDist = dist[-1]
for d in distSort :
    if (maxDist - d) % 2 == 1 :  # 実現不可能
        print(-1)
        break
else :  # 実現可能
    print(maxDist) # 腕の数
    out = [1] * maxDist
    print(*out)

    for i, (x, y) in enumerate(point) :
        out = ['']
        if x < 0 :
            out = ['L'] * abs(x)
        else :
            out = ['R'] * abs(x)
        print(''.join(out), end='')
        if y < 0 :
            out = ['D'] * abs(y)
        else :
            out = ['U'] * abs(y)
        print(''.join(out), end = '')
        out = ['LR'] * ((maxDist - dist[i]) // 2)
        print(''.join(out))



### FIXED CODE ###

N=int(input())

point = []
parity = {}
for _ in range(N) :
    x, y = map(int, input().split())
    point.append((x, y))
    parity[(x + y) % 2] = 1

if len(set(parity)) == 2 :
    print('-1')
else :
    m = 38
    parity = 1 if (1 in parity) else 0
    print(m + 1 - parity)
    if parity == 1 :  # 距離が奇数
        print(*[1 << i for i in range(m)])
    else :
        print(1, *[1 << i for i in range(m)])

    def arm(x, y, m) :
        if abs(x) >= abs(y) :
            if x >= 0 :
                return ('R', x - (1<<m), y)
            else :
                return ('L', x + (1<<m), y)
        else :
            if y >= 0 :
                return ('U', x, y - (1<<m))
            else :
                return ('D', x, y + (1<<m))

    for x, y in point :
        ans = []
        for i in range(m-1, -1, -1) :
            mode, x, y = arm(x, y, i)
            ans.append(mode)
        if parity == 0 :  # 偶数の場合一つ足す
            if x == 1 :
                ans.append('R')
            elif x == -1 :
                ans.append('L')
            elif y == 1 :
                ans.append('U')
            elif y == -1 :
                ans.append('D')
        print(''.join(ans[::-1]))
n = list(input())
sum = 0
for i in n:
  sum += int(i)
  
if sum%int(n) == 0:
  print('Yes')
else:
  print('No')
  

### FIXED CODE ###

n = input()
N = list(n)
sum = 0
for i in N:
  sum += int(i)
  
if int(n)%sum == 0:
  print('Yes')
else:
  print('No')
[a,b,c]=int(x) for x in input().split
if a>b and b>c:
 print("Yes")
else:
 print("No")

### FIXED CODE ###

[a,b,c]=[int(x) for x in input().split()]
if a<b<c:
 print("Yes")
else:
 print("No")
import math
from functools import reduce

def get_ints():
    return list(map(int, input().split()))

[n, m] = get_ints()
a = get_ints()

l = reduce(lambda n, m: n * m // math.gcd(n, m), map(lambda x: x // 2, a))
t = m // l
print(t // 2 if t % 2 == 0 else t // 2 + 1)


### FIXED CODE ###

from fractions import gcd
from functools import reduce

def get_ints():
    return list(map(int, input().split()))

[n, m] = get_ints()
a = get_ints()

def small_lcm(x, y):
    if x is None or y is None:
        return None
    ans = x * y // gcd(x, y)
    return ans if ans <= m else None

def count_div2(a):
    ans = 0
    while a % 2 == 0:
        ans += 1
        a //= 2
    return ans

cds = list(map(count_div2, a))
for v in cds:
    if v != cds[0]:
        print(0)
        exit(0)

l = reduce(small_lcm, map(lambda x: x // 2, a))
if l is None:
    print(0)
    exit(0)
t = m // l
print(t // 2 if t % 2 == 0 else t // 2 + 1)
S,T=map(int, input().split())
print(T+S)

### FIXED CODE ###

S,T=map(str, input().split())
print(T+S)
import math
n = int(input())
K = int(input())

def calk1(n):
    m = int(math.log10(n))
    num = m * 9
    num += n//(10**m)
    return num

def calk2(n):
    m = int(math.log10(n))
    num = m * (m - 1) // 2 * 9**2
    num += (n//(10**m)-1) * m * 9
    num += calk1(n - (n//(10**m)*10**m))
    return num

def calk3(n):
    m = int(math.log10(n))
    num = m * (m - 1) * (m - 2) // 6 * 9**3
    num += (n//(10**m)-1) * (m * (m - 1) // 2 * 9**2)
    num += calk2(n - (n//(10**m)*10**m))
    return num
if n < 10 ** (K - 1): print(0)
else:
    if K == 1: print(calk1(n))
    elif K == 2: print(calk2(n))
    else: print(calk3(n))


### FIXED CODE ###

import math
n = int(input())
K = int(input())

def calk1(n):
    if n == 0: return 0
    m = int(math.log10(n))
    num = m * 9
    num += n//(10**m)
    return num

def calk2(n):
    m = int(math.log10(n))
    num = m * (m - 1) // 2 * 9**2
    num += (n//(10**m)-1) * m * 9
    num += calk1(n - (n//(10**m)*10**m))
    return num

def calk3(n):
    m = int(math.log10(n))
    num = m * (m - 1) * (m - 2) // 6 * 9**3
    num += (n//(10**m)-1) * (m * (m - 1) // 2 * 9**2)
    num += calk2(n - (n//(10**m)*10**m))
    return num
if n < 10 ** (K - 1): print(0)
else:
    if K == 1: print(calk1(n))
    elif K == 2: print(calk2(n))
    else: print(calk3(n))
x,k = map(int,input().split())
arr = list(map(int,input().split()))


dp = [0]*len(arr)
for i in range(1,k):
  dp[i] = abs(arr[i]-arr[0])

for i in range(k,len(arr)):
  curr = float("inf")
  for j in range(1,k+1):
    curr = min(curr,dp[i-j] + abs(arr[i]-arr[i-j]))
  dp[i] = curr
print(dp[-1])

### FIXED CODE ###

n, k = [int(e) for e in input().split()]
arr = [int(e) for e in input().split()]
dp = [0]*len(arr)
 
for i in range(1,len(arr)):
  dp[i] = min(dp[j] + abs(arr[i]-arr[j]) for j in range(max(i-k,0),i))
print(dp[-1])
INF = 10000000000000
class Vertice:
  def __init__(self, num):
    self.num = num
    self.connected = []
    self.edge = []
    self.pos = INF
    
def DFS(vertice):
  judge = True
  for con in vertice.connected:
    index = vertice.connected.index(con)
    if con.pos == INF:
      con.pos = vertice.pos + vertice.edge[index]
      judge = DFS(con)
    elif con.pos != vertice.pos + vertice.edge[index]:
      judge = False
    if judge == False:
      break
  return judge
 
N, M = map(int, input().split())
vertices = [Vertice(i) for i in range(N)]
L, R, D = ([None for i in range(M)] for j in range(3))
for i in range(M):
  L[i], R[i], D[i] = map(int, input().split())
for i in range(M):
  if not vertices[R[i] - 1] in vertices[L[i] - 1].connected:
    vertices[L[i] - 1].connected.append(vertices[R[i] - 1])
    vertices[R[i] - 1].connected.append(vertices[L[i] - 1])
    vertices[L[i] - 1].edge.append(D[i])
    vertices[R[i] - 1].edge.append(-D[i])
judge = True
for i in range(N):
  if vertices[i].pos == INF:
    vertices[i].pos = 0
    judge = DFS(vertices[i])
    if judge == False:
      break
if judge:
  print("Yes")
else:
  print("No")

### FIXED CODE ###

import sys
sys.setrecursionlimit(2000002)

def DFS(i, pos, connected, distances):
  if pos[i] == None:
    pos[i] = 0
  size = len(connected[i])
  for j in range(size):
    if pos[connected[i][j]] == None:
      pos[connected[i][j]] = pos[i] + distances[i][j]
      if DFS(connected[i][j], pos, connected, distances) == False:
        return False
    elif pos[connected[i][j]] != pos[i] + distances[i][j]:
      return False
  return True

N, M = map(int, input().split())
pos = [None for i in range(N + 1)]
connected = [[] for i in range(N + 1)]
distances = [[] for i in range(N + 1)]
for i in range(M):
  l, r, d = map(int, input().split())
  connected[l].append(r)
  distances[l].append(d)
  connected[r].append(l)
  distances[r].append(-d)
judge = True
for i in range(1, N + 1):
  if pos[i] == None:
    judge = DFS(i, pos, connected, distances)
    if judge == False:
      break
if judge:
  print('Yes')
else:
  print('No')
n = input()
t, a = map(float, input().split())
h = list(map(float, input().split()))
for i in range(n):
  h[i] = abs( a - (t - h[i] * (-0.006)))
print(min(h))

### FIXED CODE ###

n = int(input())
t, a = map(float, input().split())
h = list(map(float, input().split()))
import numpy as np
for i in range(n):
  h[i] = abs( a - (t - h[i] * 0.006))
print(np.argmin(h) + 1)
H,W = map(int,input().split())
A = [list(map(int,input().split())) for _ in range(H)]
B = [list(map(int,input().split())) for _ in range(H)]
M = 0
for h in range(H):
    for w in range(W):
        M = max(abs(A[h][w]-B[h][w]),M)
M *= H+W
dp = [[[False]*M for _ in range(W)] for _ in range(H)]

dp[0][0][abs(A[0][0]-B[0][0])] = True
for h in range(H-1):
    for w in range(W-1):
        v1 = abs(A[h+1][w]-B[h+1][w])
        v2 = abs(A[h][w+1]-B[h][w+1])
        for v in range(M):
            if dp[h][w][v]:
                dp[h+1][w][v1+v] = True
                dp[h+1][w][abs(v1-v)] = True
                dp[h][w+1][v2+v] = True
                dp[h][w+1][abs(v2-v)] = True

v0 = abs(A[H-1][W-1]-B[H-1][W-1])
for v in range(M):
    if dp[H-1][W-2][v]:
        dp[H-1][W-1][v0+v] = True
        dp[H-1][W-1][abs(v0-v)] = True
    if dp[H-2][W-1][v]:
        dp[H-1][W-1][v0+v] = True
        dp[H-1][W-1][abs(v0-v)] = True

for v in range(M):
    if dp[H-1][W-1][v]:
        ans = v
        break

print(ans)

### FIXED CODE ###

H,W = map(int,input().split())
A = [list(map(int,input().split())) for _ in range(H)]
B = [list(map(int,input().split())) for _ in range(H)]
D = [[abs(A[h][w]-B[h][w]) for w in range(W)] for h in range(H)]
def cal():
    dp1 = [set() for _ in range(W)]
    dp2 = [set() for _ in range(W)]
    for h in range(H):
        for w in range(W):
            d = D[h][w]
            if h==0 and w==0:
                dp2[0].add(d)
            for v in dp1[w]:
                v1 = v+d
                v2 = v-d if v>=d else -v+d
                dp2[w].add(v1)
                dp2[w].add(v2)
            if 0 < w:
                for v in dp2[w-1]:
                    v1 = v+d
                    v2 = v-d if v>=d else -v+d
                    dp2[w].add(v1)
                    dp2[w].add(v2)
        dp1 = dp2
        dp2 = [set() for _ in range(W)]
    return min(dp1[W-1])
ans = cal()
print(ans)
import sys
import time
#from collections import deque, Counter, defaultdict
#from fractions import gcd
#import bisect
#import heapq
import math
start=time.time()
input = sys.stdin.readline
sys.setrecursionlimit(10**8)
inf = 10**18
MOD = 1000000007
ri = lambda : int(input())
rs = lambda : input().strip()
rl = lambda : list(map(int, input().split()))
n=ri()
a=rl()
t=0
for i in a:
    t^=i
t=bin(t)[2:]
max_len=max(len(bin(max(a)))-2,len(t))

if len(t)<max_len:t="0"+t
try:
    a=list(map(lambda x : bin(x)[2:],a))
except:
    sys.exit()
    
try:
    for i in range(n):
        if len(a[i])<max_len:
            a[i]="0"+a[i]
except:
    sys.exit()


#print(a)
ans=[[] for i in range(n)]
for i in range(max_len):
    for j in range(n):
        if a[j][i]==t[i]:
            ans[j].append("0")
        else:
            ans[j].append("1")
#print(ans)
for i in ans:
    print(int("".join(i), 2))


### FIXED CODE ###

import sys
import time
#from collections import deque, Counter, defaultdict
#from fractions import gcd
#import bisect
#import heapq
import math
start=time.time()
input = sys.stdin.readline
sys.setrecursionlimit(10**8)
inf = 10**18
MOD = 1000000007
ri = lambda : int(input())
rs = lambda : input().strip()
rl = lambda : list(map(int, input().split()))
n=ri()
a=rl()
t=0
for i in a:
    t^=i
t=bin(t)[2:]
max_len=max(len(bin(max(a)))-2,len(t))

if len(t)<max_len:t="0"*(max_len-len(t))+t
try:
    a=list(map(lambda x : bin(x)[2:],a))
except:
    sys.exit()
    
try:
    for i in range(n):
        if len(a[i])<max_len:
            a[i]="0"*(max_len-len(a[i]))+a[i]
except:
    sys.exit()


ans=[[] for i in range(n)]
for i in range(max_len):
    for j in range(n):  
            if a[j][i]==t[i]:
                ans[j].append("0")
            else:
                ans[j].append("1")

for i in ans:
    print(int("".join(i), 2))