Harryxun/stf_run huggingface dataset:
N,M=map(int,input().split())

parent = [i for i in range(N+1)]
distance = [0 for i in range(N+1)]
depth = [1 for i in range(N+1)]

def root(x):
    if x == parent[x]:
        return x
    else:
        return root(parent[x])

def to_root(x):
    if x == parent[x]:
        return 0
    else:
        return distance[x] + to_root(parent[x])

for _ in range(M):
    L, R, D = map(int, input().split())
    if root(L) == root(R):
        l = to_root(L)
        r = to_root(R)
        if D != r-l:
            print("No")
            exit()
    else:
        if depth[L] < depth[R]:
            L,R = R,L
            D = -D
        rootL = root(L)
        rootR = root(R)
        parent[rootR] = rootL
        distance[rootR] = -to_root(R)+to_root(L)+D

        depth[rootL] = max(rootL, depth[R]+1)
print("Yes")


### FIXED CODE ###

N,M=map(int,input().split())

parent = [i for i in range(N+1)]
distance = [0 for i in range(N+1)]
depth = [1 for i in range(N+1)]

def root(x):
    if x == parent[x]:
        return x
    else:
        return root(parent[x])

def to_root(x):
    if x == parent[x]:
        return 0
    else:
        return distance[x] + to_root(parent[x])

for _ in range(M):
    L, R, D = map(int, input().split())
    # print("distance", D, to_root(L), to_root(R))
    # print("root    ", root(L), root(R))
    # print(_, L, R, D)
    if root(L) == root(R):
        l = to_root(L)
        r = to_root(R)
        # print("distance", D, l, r)
        # print("root    ", root(L), root(R))
        if D != r-l:
            # print(parent)
            # print(distance)
            print("No")
            exit()
    else:
        rootL = root(L)
        rootR = root(R)
        if depth[rootL] < depth[rootR]:
            L,R = R,L
            D = -D
        rootL = root(L)
        rootR = root(R)
        parent[rootR] = rootL
        distance[rootR] = -to_root(R)+to_root(L)+D
        depth[rootL] = max(rootL, depth[rootR]+1)
print("Yes")
N = int(input())
A = list(map(int, input().split()))
B = list(map(int, input().split()))

cnt = sum(B) - sum(A)
a, b = cnt, cnt
for i in range(N):
    if A[i] < B[i]:
        b -= (B[i]-A[i+1])//2
    elif A[i] > B[i]:
        a -= A[i]-B[i]
    if a < 0 or b < 0:
        print("No")
        break
else:
    print("Yes")

### FIXED CODE ###

N = int(input())
A = list(map(int, input().split()))
B = list(map(int, input().split()))

cnt = sum(B) - sum(A)
a, b = cnt, cnt
for i in range(N):
    if A[i] < B[i]:
        b -= (B[i]-A[i]+1)//2
    elif A[i] > B[i]:
        a -= A[i]-B[i]
    if a < 0 or b < 0:
        print("No")
        break
else:
    print("Yes")
S = input()
T = input()

if S == T:
    print(Yes)
l = len(S)
L = list(S)
for i in range(l):
    a = L[0]
    del L[0]
    L.append(a)
    s = ''.join(L)
    if s == T:
        print('Yes')
        break
else:
    print('No')

### FIXED CODE ###

S = input()
T = input()

if S == T:
    print('Yes')
else:
    l = len(S)
    L = list(S)
    for i in range(l):
        a = L[0]
        del L[0]
        L.append(a)
        s = ''.join(L)
        if s == T:
            print('Yes')
            break
    else:
        print('No')
import sys

input = sys.stdin.readline


def main():
    n = int(input())
    points = reversed(
        [[int(i) for i in input().split()] for _ in range(n)],
        key=lambda x: x[2],
        reverse=True,
    )
    print(points)
    hoge = 101
    for cx in range(hoge):
        for cy in range(hoge):
            x, y, z = points[0]
            h = max(z + abs(x - cx) + abs(y - cy), 0)
            # print(h, [max(z + abs(x - cx) + abs(y - cy), 0) for x, y, z in points])
            if h == 0:
                continue
            if all(
                [h == max(z + abs(x - cx) + abs(y - cy), 0) for x, y, z in points[1:]]
            ):
                print(cx, cy, h)
                break


if __name__ == "__main__":
    main()


### FIXED CODE ###

import sys

input = sys.stdin.readline


def main():
    n = int(input())
    points = sorted(
        [[int(i) for i in input().split()] for _ in range(n)],
        key=lambda x: x[2],
        reverse=True,
    )
    hoge = 101
    for cx in range(hoge):
        for cy in range(hoge):
            x, y, z = points[0]
            h = z + abs(x - cx) + abs(y - cy)

            if h < 1:
                continue
            if all([z == max(h - abs(x - cx) - abs(y - cy), 0) for x, y, z in points]):
                print(cx, cy, h)
                return


if __name__ == "__main__":
    main()
n=int(input())
a=list(map(int,input().split()))

import sys
import math
def setwise_coprime(a):
  ans=a[0]
  for i in range(1,n):
    ans=math.gcd(ans,a[i])
  return ans

#エラストテネスのふるい
def create_sieve(n):
  sieve=[0]*(n+1)
  for i in range(2,n+1):
    if sieve[i]==0:
      for j in range(i*i,n+1,i):
        sieve[j]=i
  return sieve

#高速素因数分解
def fast_factorization(n, sieve):
  prime={}
  while n>1:
    p=sieve[n]
    #nが素数の場合
    if p==0:
      prime[n]=prime.get(n,0)+1
      break
    #nが素数ではない場合
    else:
      prime[p]=prime.get(p,0)+1
      n=n//p
  return prime

check=set()
if setwise_coprime(a)==1:
  #素因数のダブリをcheck
  sieve=create_sieve(10**6)
  for i in range(n):
    if a[i]!=1:
      s=fast_factorization(a[i], sieve)
      for i in s:
        if i in check:
          print("setwise coprime")
          sys.exit()
        else:
          check.add(i)
  print("pairwise coprime")    
else:
  print("not coprime")
  
  



      
      
    


### FIXED CODE ###

d,t,s=map(int,input().split())
if s*t>=d:
  print("Yes")
else:
  print("No")
n = int(input())
s = list(input().split)

print(len(set(s)))

### FIXED CODE ###

n = int(input())
s = list(input().split())
s = set(s)
if len(s) == 3:
    print('Three')
else:
    print('Four')
import sys
import math

input = sys.stdin.readline

def can(arr, m, K):
  need = 0
  for x in arr:
    need += int(x // m)
  return need <= K

N, K = map(int, input().split())
arr = list(map(int, input().split()))
arr = sorted(arr)

lo = 0.0
hi = 1e9

while (abs(lo - hi) > 1e-5):
  m = (lo + hi) / 2.0
  if (can(arr, m, K)):
    hi = m
  else:
    lo = m
ans = lo

print(int(math.ceil(lo)))
  
  



### FIXED CODE ###

n = int(input())
if n >= 30:
  print('Yes')
else:
  print('No')
for j in range(N):
    if N == 1:
       break
 
    if H[j] >= H[j+1]:
        count += 1
    else:
        if count > ans:
            ans   = count
            count = 0
        else:
            pass
 
 
    if j == N-2:
        if count > ans:
            ans   = count
        break

print(ans)


### FIXED CODE ###

N = int(input())
H = list(map(int, input().split()))

ans   = 0
count = 0


for j in range(N):
    if N == 1:
       break
 
    if H[j] >= H[j+1]:
        count += 1
    else:
        ans   = max(count, ans)
        count = 0
 
    if j == N-2:
        if count > ans:
            ans   = count
        break

print(ans)
x = int(input())
y = int(input())
z = int(input())

def swap(a,b):
  temp = a
  a = b
  b = temp
  return(a,b)

x,y = swap(x,y)
x,z = swap(x,z)
print(x,y,z)

### FIXED CODE ###

x,y,z = list(map(int,input().split()))
 
def swap(a,b):
    temp = a
    a = b
    b = temp
    return (a,b)
 
x,y = swap(x,y)
x,z = swap(x,z)
print(x,y,z)
import math
from functools import lru_cache
mod = 10 ** 9 + 7
N, K = map(int, input().split())
graph = [[] for _ in range(N)]
for _ in range(N-1):
    a, b = map(int, input().split())
    a -= 1
    b -= 1
    graph[a].append(b)
    graph[b].append(a)

@lru_cache(maxsize=10**6)
def fact(x):
    return math.factorial(x)

@lru_cache(maxsize=10**6)
def permutation_count(n, r):
    return fact(n) // fact(n-r)

stack = []
for v in graph[0]:
    stack.append((v, 0))
ans = K * permutation_count(K-1, len(graph[0]))
while stack:
    v, parent = stack.pop()
    ans *= permutation_count(K-2, len(graph[v])-1)
    ans %= mod
    for child in graph[v]:
        if child == parent:
            continue
        stack.append((child, v))

print(ans)


### FIXED CODE ###

N, K = map(int, input().split())
graph = [[] for i in range(N)]

for i in range(N-1):
    a, b = map(int, input().split())
    a -= 1
    b -= 1
    graph[a].append(b)
    graph[b].append(a)

stack = [0]
ans = K
mod = 10**9+7
r = [True] * N
r[0] = False
while stack:
    v = stack.pop()
    tmp = K - 1
    if v > 0:
        tmp -= 1
    for child in graph[v]:
        if r[child]:
            r[child] = False
            stack.append(child)
            ans *= tmp
            tmp -= 1
            ans %= mod
print(ans)
##(N,K)=map(int,input().split())
##v=list(map(int, input().split()))
N=input()

v=[0]*N
for i in range(N):
    c=input()
    v[c]=i

for i in v:
    print(i+" ")

### FIXED CODE ###

##(N,K)=map(int,input().split())

N=int(input())
c=list(map(int, input().split()))
v=[0]*N
for i in range(N):
    v[c[i]-1]=i

for i in v:
    print(i+1)
    print(" ")
N,D = map(int,input().split())
xy = []
for i in range(N):
    x,y = map(int,input().split())
    xy.append([x,y])
ans = 0
for i in range(N):
    x = xy[i][0]
    y = xy[i][1]
    if(D >= (x*x + y*y) / D):
        ans+=1
print(ans)

### FIXED CODE ###

N,D = map(int,input().split())
xy = []
for i in range(N):
    x,y = map(int,input().split())
    xy.append([x,y])
ans = 0
for i in range(N):
    x = xy[i][0]
    y = xy[i][1]
    if(D*D >= (x*x + y*y)):
        ans+=1
print(ans)
N = int(input())
A = list(map(int, input().split()))
for i in range(N):
    A[i] = A[i] - i - 1
A = sorted(A)
medN = N//2

x = 0
for i in range(N):
    x = x + abs(A[i] - A[halfN])
print(x)


### FIXED CODE ###

N = int(input())
A = list(map(int, input().split()))
for i in range(N):
    A[i] = A[i] - i - 1
A = sorted(A)
medN = N//2

x = 0
for i in range(N):
    x = x + abs(A[i] - A[medN])
print(x)
a = input()

if (a[2] = a[3] and a[4] = a[5]):
  print(Yes)
else:
  print(No)

### FIXED CODE ###

S = input()
 
if (S[2] == S[3] and S[4] == S[5]):
  print("Yes")
else:
  print("No")
L,R = [int(x) for x in input().split()]
 
#L = input_arr[0]
#R = input_arr[1]
 
min_ans = 10**18
for i in range(L+1,R+1):
  if ans < min_ans:
    min_ans = ans
  if min_ans == 0:
    break

print(min_ans)


### FIXED CODE ###

L,R = [int(x) for x in input().split()]
 
min_ans = 10**18

if R-L>=2019:
  min_ans=0
else:
  for i in range(L,R):
      for j in range(i+1,R+1):
          ans = (i*j)%2019

          if ans < min_ans:
              min_ans = ans
          if min_ans == 0:
              break
print(min_ans)
s = input()
def f(n):
  if n%2 == 0:
    return n/2
  else:
    return 3*n+1
a = []
a.append(s)
for i in range(1,1000001):
  if f(a[i-1]) in a:
    print(i)
    break
  else:
    a.append(f(a[i-1]))
  

### FIXED CODE ###

s = int(input())
def f(n):
  if n%2 == 0:
    return n/2
  else:
    return 3*n+1
a = []
a.append(s)
for i in range(1,1000001):
  if f(a[i-1]) in a:
    print(i+1)
    break
  else:
    a.append(f(a[i-1]))
# Union find
# かっつぱさんの解説と公式のスライドみた
# https://www.youtube.com/watch?time_continue=916&v=zxor0DdwoXA&feature=emb_logo
# https://www.slideshare.net/chokudai/union-find-49066733

import sys
sys.setrecursionlimit(10 ** 9)

n, m = map(int, input().split())
AB = [list(map(int, input().split())) for _ in range(m)]

root = [-1]*n

def find(x):
    if root[x] < 0:
        return x
    else:
        root[x] = find(root[x])
        return root[x]

def unite(x, y):
    gx = find(x)
    gy = find(y)
    
    if gx == gy:
        return
      
    if root[gx] > root[gy]:
        gx, gy = gy, gx
        
    root[gx] += root[gy]
    root[gy] = gx
    print(root)

def size(x):
    x = find(x)
    return -root[x]

for a, b in AB:
    a -= 1
    b -= 1
    unite(a, b)

ans = 0
for i in range(n):
    ans = max(ans, size(i))
print(ans)

### FIXED CODE ###

# Union find
# かっつぱさんの解説と公式のスライドみた
# https://www.youtube.com/watch?time_continue=916&v=zxor0DdwoXA&feature=emb_logo
# https://www.slideshare.net/chokudai/union-find-49066733

import sys
sys.setrecursionlimit(10 ** 9)

n, m = map(int, input().split())
AB = [list(map(int, input().split())) for _ in range(m)]

root = [-1]*n

def find(x):
    if root[x] < 0:
        return x
    else:
        root[x] = find(root[x])
        return root[x]

def unite(x, y):
    gx = find(x)
    gy = find(y)
    
    if gx == gy:
        return
      
    if root[gx] > root[gy]:
        gx, gy = gy, gx
        
    root[gx] += root[gy]
    root[gy] = gx

def size(x):
    x = find(x)
    return -root[x]

for a, b in AB:
    a -= 1
    b -= 1
    unite(a, b)

ans = 0
for i in range(n):
    ans = max(ans, size(i))
print(ans)
S = input()
 
def step(x,y):
    N_last = S[x:y-1]
    return N_last.find('##') == -1
 
 
pass_path = True

if C > D:
    for b in range(B-1,D):
        if S[b-1] == '.' and S[b+1] == '.':
            continue
        elif S[b] == '#':
            path_pass = False
            break

if step(A,C) and step(B,D)  and pass_path == True:
    print('Yes')
else:
    print('No')

### FIXED CODE ###

N,A,B,C,D = map(int,input().split())
S = input()
 
def step(x,y):
    N_last = S[x:y-1]
    return N_last.find('##') == -1

Ans = step(A,C) and step(B,D)
 
if C > D:
    pass_path = False
    for b in range(B-1,D):
        if S[b] == '#':
            continue
        if S[b-1] == '.' and S[b+1] == '.':
            pass_path = True
            break
    Ans = step(A,C) and step(B,D) and  pass_path


if Ans == True:
    print('Yes')
else:
    print('No')
print(int(int(input()**2))

### FIXED CODE ###

print(int(int(input())**2))
A=sorted(list(map(int,input())))
print(A[2]-A[0])

### FIXED CODE ###

A=sorted(list(map(int,input().split())))
print(A[2]-A[0])
while True:
    a, op, b = input(),split()
    a = int(a)
    b = int(b)


    if op == '?':
        break


    if op == '+':
        print(a + b)


    if op == '-':
        print(a - b)


    if op == '*':
        print(a * b)


    if op == '/':
        print(a / b)

### FIXED CODE ###

while True:
    a, op, b = input().split()
    a = int(a)
    b = int(b)
   
    if op == '?':
        break
   
    if op == '+':
        print(a + b)
   
    if op == '-':
        print(a - b)
   
    if op == '*':
        print(a *b)
   
    if op == '/':
        print(a // b)
#!/usr/bin/env python
# coding: utf-8

# In[31]:


N, M = map(int, input().split())
As = [int(input()) for i in range(M)]
"""
100 5
1
23
45
67
89
"""


# In[32]:


import numpy as np


# In[33]:


As = np.array(As)
oAs = As[1:]-As[:-1]
if 1 in oAs:
    print(0)
    sys.exit()


# In[34]:


stairs = [0]*(N+3)
stairs[0] = 1
#stairs[1] = 1

start_stage = 0
for i in range(M):
    collapsed_stage = As[i]
    finish_stage = collapsed_stage - 1
    #print(start_stage, finish_stage)
    continuous_stairs = finish_stage - start_stage
    if continuous_stairs < 2:
        stairs[finish_stage+2] = stairs[start_stage]
        start_stage = finish_stage+2
    else:
        stairs[start_stage+1] = stairs[start_stage]
        for i in range(continuous_stairs-1):
            stairs[start_stage+i+2] = stairs[start_stage+i] + stairs[start_stage+i+1]
        stairs[finish_stage+2] = stairs[finish_stage]
        start_stage = finish_stage+2

if N-start_stage < 2:
    stairs[N] = stairs[start_stage]
else:
    continuous_stairs = N - start_stage
    stairs[start_stage+1] = stairs[start_stage]
    for i in range(continuous_stairs-1):
        stairs[start_stage+i+2] = stairs[start_stage+i] + stairs[start_stage+i+1]
        #print(stairs)
        
#print(list(range(N+1)))
#print(stairs)
print(stairs[N]%1000000007)


# In[ ]:






### FIXED CODE ###

#!/usr/bin/env python
# coding: utf-8

# In[31]:


N, M = map(int, input().split())
As = [int(input()) for i in range(M)]
"""
100 5
1
23
45
67
89
"""


# In[32]:


import numpy as np
import sys


# In[33]:


As = np.array(As)
oAs = As[1:]-As[:-1]
if 1 in oAs:
    print(0)
    sys.exit()


# In[34]:


stairs = [0]*(N+3)
stairs[0] = 1
#stairs[1] = 1

start_stage = 0
for i in range(M):
    collapsed_stage = As[i]
    finish_stage = collapsed_stage - 1
    #print(start_stage, finish_stage)
    continuous_stairs = finish_stage - start_stage
    if continuous_stairs < 2:
        stairs[finish_stage+2] = stairs[start_stage]
        start_stage = finish_stage+2
    else:
        stairs[start_stage+1] = stairs[start_stage]
        for i in range(continuous_stairs-1):
            stairs[start_stage+i+2] = stairs[start_stage+i] + stairs[start_stage+i+1]
        stairs[finish_stage+2] = stairs[finish_stage]
        start_stage = finish_stage+2

if N-start_stage < 2:
    stairs[N] = stairs[start_stage]
else:
    continuous_stairs = N - start_stage
    stairs[start_stage+1] = stairs[start_stage]
    for i in range(continuous_stairs-1):
        stairs[start_stage+i+2] = stairs[start_stage+i] + stairs[start_stage+i+1]
        #print(stairs)
        
#print(list(range(N+1)))
#print(stairs)
print(stairs[N]%1000000007)


# In[ ]:
x = input()
    a = int( x.split(' ')[0] )
    b = int( x.split(' ')[1] )
    print( a * b, (a + b) * 2 )


### FIXED CODE ###


line = input().split()

a = int(line[0])
b = int(line[1])

print(str(a * b) + ' ' + str((a+b) * 2))
H,W=map(int,input().split())
G=[input() for i in range(H)]
F=[[0]*W for i in range(H)]

def judge(p0,p1,res):
  if p0==H-1 and p1==W-1:
    return res
  
  a=float("inf")
  if p0<H-1 and F[p0+1][p1]==0 and G[p0+1][p1]==".":
    F[p0+1][p1]=1
    m=judge(p0+1,p1,res+1)
    if m!=False:
      a=min(a,m)
  
  if p1<W-1 and F[p0][p1+1]==0 and G[p0][p1+1]==".":
    F[p0][p1+1]=1
    m=judge(p0,p1+1,res+1)
    if m!=False:
      a=min(a,m)
      
  if p0>0 and F[p0-1][p1]==0 and G[p0-1][p1]==".":
    F[p0-1][p1]=1
    m=judge(p0-1,p1,res+1)
    if m!=False:
      a=min(a,m)
   
  if p1>0 and F[p0][p1-1]==0 and G[p0][p1-1]==".":
    F[p0][p1-1]=1
    m=judge(p0,p1-1,res+1)
    if m!=False:
      a=min(a,m)
    
  if a!=float("inf"):
    return a
    
  return False
k=judge(0,0,0)
if k!=False:
  ans=W*H-(k+1)
  for i in range(H):
    ans-=G[i].count("#")
  print(ans)
else:
  print(-1)

### FIXED CODE ###

from collections import deque
H,W=map(int,input().split())
G=[input() for i in range(H)]

b_n= [G[i].count("#") for i in range(H)]

root_min=float("inf")
root=deque([[0,0,1]])
F=[[0]*W for i in range(H)]
while len(root)!=0:
  p=root.popleft()
  if p[:2]==[H-1,W-1]:
    print(H*W-p[2]-sum(b_n))
    exit()
  F[p[0]][p[1]]=1
  for i in range(4):
    if i==0:
      n=[max(0,p[0]-1),p[1],p[2]+1]
    elif i==1:
      n=[min(H-1,p[0]+1),p[1],p[2]+1]
    elif i==2:
      n=[p[0],max(0,p[1]-1),p[2]+1]
    else:
      n=[p[0],min(W-1,p[1]+1),p[2]+1]
      
    if G[n[0]][n[1]]=="#":
      continue
    if F[n[0]][n[1]]==1:
      continue
    if n in root:
      continue
    root.append(n)
print(-1)
str=list(input())
if str.count(str[0])==2 and str.count(str[1])==2:
    print("Yes")
elif str.count(str[0])==2 and str.count(str[2])==2:
else:
    print("No")
    

### FIXED CODE ###

s=input()
for i in s:
    if s.count(i)!=2:
        print('No')
        break
else:
    print('Yes')
a, b = int(input()).split()

if a < b:
    print("a < b")

elif a > b:
    print("a > b")

else:
    print("a == b")



### FIXED CODE ###

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

if a < b:
    print("a < b")

elif a > b:
    print("a > b")

else:
    print("a == b")
n = int(input())
a = int(input())
b = int(input())
if n == 1 and a == b:
    print(1)
elif n<2 or a>b:
    print(0)
else:
    print((n-2)*(b-a)+1)


### FIXED CODE ###

a,b,c = map(int,input().split())
if a<=1:
    if b==c:
        print(1)
    else:
        print(0)
elif b>c:
    print(0)
else:
    print((a-2)*(c-b)+1)
N, M, R = map(int, input().split())
R_LIST = list(map(int, input().split()))
ABC = []
for _ in range(M):
    a,b,c = map(int, input().split())
    ABC.append((a,b,c))

edges = ABC[:]


def warshall_floyd(d, n):
    # d: グラフ二次元リスト
    # n: 頂点数 (0始まり)
    #d[i][j]: iからjへの最短距離
    for k in range(n):
        for i in range(n):
            for j in range(n):
                d[i][j] = min(d[i][j],d[i][k] + d[k][j])
    return d

# グラフ無効グラフ化
graph = [[float("inf") for i in range(N+1)] for i in range(N+1)] 
for x,y,z in edges:
    graph[x][y] = z
    graph[y][x] = z
for i in range(N+1):
    graph[i][i] = 0 #自身のところに行くコストは０

#最短経路
shortest =  warshall_floyd(graph, N+1)
    
# 順列全探索
import sys
INT_MAX = sys.maxsize # 9223372036854775807
ans = INT_MAX

import queue

q = queue.Queue()
for t in travels:
    q.put((
        0,
        (t,)
    ))

travels = R_LIST[:]

while not q.empty():
    past = q.get()
    if len(past[1]) == len(travels):
        ans = min(ans, past[0])
    
    for t in travels:
        if not t in past[1]:
            cost = past[0]
            #print(past[1][-1],t)
            cost += shortest[past[1][-1]][t]
            if ans <= cost:
                continue
            next_past = past[1] + (t,)
            q.put((
                cost,
                next_past
            ))
print(ans)
      
        
        



### FIXED CODE ###

N, M, R = map(int, input().split())
R_LIST = list(map(int, input().split()))
ABC = []
for _ in range(M):
    a,b,c = map(int, input().split())
    ABC.append((a,b,c))
    
    
edges = ABC[:]


def warshall_floyd(d, n):
    # d: グラフ二次元リスト
    # n: 頂点数 (0始まり)
    #d[i][j]: iからjへの最短距離
    for k in range(n):
        for i in range(n):
            for j in range(n):
                d[i][j] = min(d[i][j],d[i][k] + d[k][j])
    return d

# グラフ無効グラフ化
graph = [[float("inf") for i in range(N+1)] for i in range(N+1)] 
for x,y,z in edges:
    graph[x][y] = z
    graph[y][x] = z
for i in range(N+1):
    graph[i][i] = 0 #自身のところに行くコストは０

#最短経路
shortest =  warshall_floyd(graph, N+1)
    
# 順列全探索
import sys
INT_MAX = sys.maxsize # 9223372036854775807
ans = INT_MAX

import queue

rest = set(R_LIST[:])

import copy  
def dfs(cost,pre,rest):
    if len(rest) == 0:
        return cost
    
    ret = INT_MAX
    for r in rest:
        if pre == None:
            next_cost = 0
        else:
            next_cost = cost + shortest[pre][r]
        next_rest = copy.copy(rest)
        next_rest.remove(r)
        
        tmp_ret = dfs(next_cost, r, next_rest)
        ret = min(ret, tmp_ret)
        
    return ret
        
    

print(dfs(0, None, rest))
import math

def lcm(x, y):
    return (x * y) // math.gcd(x, y)

A, B = list(map(lambda x: int(x), input().split()))

print(lcm(A, B))

### FIXED CODE ###

import fractions

A, B = list(map(lambda x: int(x), input().split()))

print(int((A * B) / fractions.gcd(A, B)))
while True:
    input=input().split()
    H=int(input[0])
    W=int(input[1])
    if H==0:
        break
    for i in range(1,H+1):
        if i%2!=0:
            if W%2==0:
                print("#."*(W/2))
            if W%2!=0:
                print("#."*(W/2)+".")
        if i%2==0:
            if W%2==0:
                print(".#"*(W/2))
            if W%2!=0:
                print(".#"*(W/2)+".")
    print()


### FIXED CODE ###

while True:
    s=input().split()
    h=int(s[0])
    w=int(s[1])
    if h==0:
        break
    for i in range(1,h+1):
        if i%2==1:
            if w%2==0:
                print("#."*(w//2))
            else:
                print("#."*(w//2)+"#")
        else:
            if w%2==0:
                print(".#"*(w//2))
            else:
                print(".#"*(w//2)+".")
    print()
number = int(input().split())
if (number[1] * 10 + number [2]) % 4 == 0:
    print("YES")
else:
    print("NO")

### FIXED CODE ###

number = input().split()
number = [int(i) for i in number]
if (number[1] * 10 + number [2]) % 4 == 0:
    print("YES")
else:
    print("NO")