Harryxun/stf_run huggingface dataset:
# coding: utf-8
from scipy.sparse.csgraph import floyd_warshall
from scipy.sparse import lil_matrix

N,M,L=map(int, input().split())
RG=lil_matrix((N,N))

for i in range(M):
    f,t,c = map(int, input().split())
    if c <= L:
        RG[(f-1,t-1)] = c
        RG[(t-1,f-1)] = c

Rd = floyd_warshall(RG, directed=False)

FG=lil_matrix((N,N))
for i in range(N):
    for j in range(i+1, N):
        if Rd[i][j] <= L:
            FG[(i,j)] = 1
            FG[(j,i)] = 1

Fd = floyd_warshall(FG, directed=False)

Q=int(input())
for i in range(Q):
    s, t = map(int, input().split())
    v = Fd[s-1][t-1]
    if s == t:
        print (str(0))
    if v == float('inf'):
        print (str(-1))
    else:
        print (str(int(v-1)))


### FIXED CODE ###

# coding: utf-8
from scipy.sparse.csgraph import floyd_warshall

N,M,L=map(int, input().split())
RG=[[0 for i in range(N)] for j in range(N)]

for i in range(M):
    f,t,c = map(int, input().split())
    if c <= L:
        RG[f-1][t-1] = c
        RG[t-1][f-1] = c

Rd = floyd_warshall(RG, directed=False)

FG=[[0 for i in range(N)] for j in range(N)]
for i in range(N):
    for j in range(i+1, N):
        if Rd[i][j] <= L:
            FG[i][j] = 1
            FG[j][i] = 1

Fd = floyd_warshall(FG, directed=False)

Q=int(input())
for i in range(Q):
    s, t = map(int, input().split())
    v = Fd[s-1][t-1]
    if s == t:
        print (str(0))
    if v == float('inf'):
        print (str(-1))
    else:
        print (str(int(v-1)))
import collections
import itertools
import sys


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

s = input()
k = getint()

t = list(itertools.takewhile(lambda s: s == '1', s))

if len(t) > k:
    print(1)
else:
    i = len(t)
    print(s[i])


### FIXED CODE ###



import collections
import itertools
import sys


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

s = input()
k = getint() - 1

t = list(itertools.takewhile(lambda s: s == '1', s))

if len(t) > k:
    print(1)
else:
    i = len(t)
    print(s[i])
import sys
def DFS(list,s,t):
    if s==t:
        print("YES")
        sys.exit()
    if not t in s:
        return

    for i in list:
        DFS(list,s,t+i)

list=["maerd","remaerd","esare","resare"]
s=input()
s=s[::-1]
t=""
DFS(list,s,t)
print("NO")

### FIXED CODE ###

import sys
def DFS(list,s,t):
    if s==t:
        print("YES")
        sys.exit()
    if not t in s:
        return

    for i in list:
        DFS(list,s,t+i)

list=["maerd","remaerd","esare","resare"]
s=input()
s=s[::-1]
t=""
c_index=0
while True:
    moto=c_index
    for i in list:
        index=0
        temp=c_index
        while index<len(i) and temp<len(s) and i[index]==s[temp]:
            index+=1
            temp+=1
        if index==len(i):
            c_index=temp
            break
    if c_index==len(s):
        print("YES")
        sys.exit()
    if c_index==moto:
        print("NO")
        sys.exit()
#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;

int main()
{
	char a;
	cin >> a;
	if (isupper(a))cout << 'A';
	else
		cout << 'a';
}

### FIXED CODE ###

a=input()
print('a' if a.islower() else 'A')
from collections import*
H,*A=open(0)
H,W,K=map(int,H.split())
*A,=map(list,A)
for i,a in enumerate(A):
	if'S'in a:j=a.index('S');Q=deque([(0,i,j)])
d=1e9
while Q:
	c,i,j=Q.popleft();d=min(d,i,j,H-i-1,W-j-1)
	if c<K:
		for h,w in((i+1,j),(i,j+1),(i-1,j),(i,j-1)):
			if(H>h>-1<w<W)*'.'==A[h][w]:A[h][w]=0;Q+=(c+1,h,w),
print(1--d//K)

### FIXED CODE ###

from collections import deque
h, w, k = map(int, input().split())
maze = [input() for _ in range(h)]
visited = [[-1]*w for j in range(h)]
for i in range(h):
    if 'S' in maze[i]:
        sy, sx = i, maze[i].index('S')
queue = deque([[sy, sx]])
visited[sy][sx] = 0
r = 10**18
while queue:
    y, x = queue.popleft()
    r = min(r, y, x, h-1-y, w-1-x)
    if visited[y][x] == k: continue
    for i, j in ([1, 0], [-1, 0], [0, 1], [0, -1]):
        new_y, new_x = y+i, x+j
        if new_y < 0 or new_y >= h: continue
        if new_x < 0 or new_x >= w: continue
        if maze[new_y][new_x] == '.' and visited[new_y][new_x] == -1:
            visited[new_y][new_x] = visited[y][x] + 1
            queue.append([new_y, new_x])
print(1 -(-r // k))
from collections import Counter

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

new = [key for key, val in Counter(a).most_common() if val == 1]
dp = [0] * 100010

for i in new:
    temp = i
    while i <= 100010:
        dp[i] += 1
        i += temp

ans = 0
for i in new:
    if dp[i] == 1:
        ans += 1
print(ans)


### FIXED CODE ###

from collections import Counter

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

# new = [key for key, val in Counter(a).most_common() if val == 1]
prime = [1] * 1000010

for i in set(a):
    # if prime[i]:
    for j in range(i + i, 1000001, i):
        prime[j] = 0

c = Counter(a)
ans = 0
for i in a:
    if prime[i] and c[i] == 1:
        ans += 1
print(ans)
# input
NW = [int(x) for x in input().split(" ")]
N = NW[0]
W = NW[1]

w = []
v = []

for _ in range(N):
	wv = [int(x) for x in input().split(" ")]
	w.append(wv[0])
	v.append(wv[1])

# 品物i-Nまでを使って容量Wのナップサックにいれられる品物の価値の総和の最大値
def rec(i, Wrec):
	if i >= N:
		return 0

	a = -1
	if Wrec - w[i] >= 0:
		a = v[i]+rec(i+1, Wrec-w[i])
	return max(
		a, #品物iを入れる
		rec(i+1, Wrec) #品物iを入れない
		)

print(rec(0,W))

### FIXED CODE ###

words = input().split(" ")

shiritori = "YES"

end = None

for word in words:
	if end is not None:
		if end != word[0]:
			shiritori = "NO"
			break
	end = word[-1]

print(shiritori)
import sys
sys.setrecursionlimit(2147483647)

n,m = map(int,input().split())
a = n - 1
b = m - 1
ans = 0

if m <= 1:
    ans = n*a/2
else:
    ans = n*a/2 + m*b/2

print(str(int(ans))

### FIXED CODE ###

import sys
sys.setrecursionlimit(2147483647)

n,m = map(int,input().split())
a = n - 1
b = m - 1
ans = 0

if m <= 1:
    ans = n*a/2
else:
    ans = n*a/2 + m*b/2

print(str(int(ans)))
s=input()
for i in range(len(s)):
  s[i]=x
print(s)

### FIXED CODE ###

print("x"*len(input()))
n = int(input())
a = list(map(int,input().split()))
a_dic = dict()
a_set = set()
for num in a:
  if num in a_dic:
    a_dic[num] += 1
  else:
    a_dic[num] = 1
  a_set.add(num)
k = len(a_dic)
a_set = list(a_set)
if k == 1:
  if a_dic[0] == n:
    print('Yes')
    exit()
elif k == 2:
  if a_dic[0] == n/3 and a_dic(a_set[1]) == 2*n/3:
    print('Yes')
    exit()
elif k == 3:
  if a_set[0] ^ a_set[1] ^ a_set[2] == 0:
    if a_dic[a_set[0]] == a_dic[a_set[1]] == a_dic[a_set[2]] == n/3:
      print('Yes')
      exit()
print('No')

### FIXED CODE ###

n = int(input())
a = list(map(int,input().split()))
a_dic = dict()
a_set = set()
for num in a:
  if num in a_dic:
    a_dic[num] += 1
  else:
    a_dic[num] = 1
  a_set.add(num)
k = len(a_dic)
a_set = list(a_set)
if k == 1:
  if 0 in a_dic:
    if a_dic[0] == n:
      print('Yes')
      exit()
elif k == 2:
  if a_dic[0] == n/3 and a_dic[a_set[1]] == 2*n/3:
    print('Yes')
    exit()
elif k == 3:
  if a_set[0] ^ a_set[1] ^ a_set[2] == 0:
    if a_dic[a_set[0]] == a_dic[a_set[1]] == a_dic[a_set[2]] == n/3:
      print('Yes')
      exit()
print('No')
import numpy as np
h,w=map(int,input().split())
lst=list(list(input()) for i in range(h))
for i in range(len(lst)):
    if "#" not in lst[h-i-1]:
        lst.pop(h-i-1)
lst=np.array(lst)
lst=np.rot90(lst,k=-1).tolist()
for i in range(len(lst)):
    if "#" not in lst[w-i-1]:
        lst.pop(w-i-1)
lst=np.array(lst)
lst=np.rot90(lst,k=1).tolist()
for b in range(h):
    print("".join(lst[b]))

### FIXED CODE ###

h,w=map(int,input().split())
lst=list(input() for i in range(h))
n_h=h
for i in range(len(lst)):
    if "#" not in lst[h-i-1]:
        n_h-=1
        lst.pop(h-i-1)
h=n_h
n_w=w
lst=list(map(list,lst))
for i in range(w):
    T=True
    for b in range(h):
        if lst[b][w-i-1]=="#":
            T=False
            break
    if T:
        for b in range(h):
            lst[b].pop(w-i-1)
            n_w-=1
for b in range(h):
    print("".join(lst[b]))
from collections import deque

S = input()
Q = deque(int(input()))
 
Q_list = [list(map(str, input().split())) for i in range(Q)]
 
for i in range(Q):                
  if int(Q_list[i][0]) == 1:
    if len(S) >= 2:
      S = S[::-1]
  
  else:
    F = Q_list[i][1]
    C = Q_list[i][2]
    
    if int(F) == 1:
      S.appendleft(C)
    else:
      S.append(C)
      
print(''.join(S))

### FIXED CODE ###

from collections import deque
 
S = deque(input())
Q = int(input())
 
Q_list = [list(map(str, input().split())) for i in range(Q)]
 
rev = False
 
for i in range(Q):
  if int(Q_list[i][0]) == 1:
    rev = not rev
  
  else:
    F = Q_list[i][1]
    C = Q_list[i][2]
    
    if rev ^ (int(F) == 1): # 排他的論理和片方真片方ぎの時真になる
      S.appendleft(C)
    else:
      S.append(C)
      
if rev:
  S.reverse()
  
print(''.join(S))
n,m=map(int,input().split())
a=[[int(i) for i in input().split()] for j in range(m)]
a.sort(key=lambda x:x[1])
a.sort(key=lambda x:x[0])
cc=0
for i in range(m):
    if a[i][0]==1:
        for j in range(i,m):
            if a[i][1]==a[j][0] and a[j][1]==n:
                cc=1
                break
    if cc==1:
        break
print("POSSIBLE" if cc==1 else "IMPOSSIBLE")

### FIXED CODE ###

print("ABC"+input())
S = input()

print(S.replace('2017','2018')

### FIXED CODE ###

S = input()

print(S.replace('2017', '2018'))
n, a, b = map(int, input().split())
x="b"*a+"r"*b
x= x*(10**5)
strx = x[0:n]
def split(w):
    return [all for all in w]
def countX(lst, x): 
    return lst.count(x) 
listx = split(strx)
print(countX(listx, "b"))

### FIXED CODE ###

n,a,b = map(int,input().split())
x = n//(a+b)
if n - x*(a+b) > a:
    Y =a
else:
    Y=n - x*(a+b)
print(a*x+Y)
N,M = map(int,input().split())
S = input()
T = input()
from fractions import gcd
L = N*M//gcd(N,M)
res = ['!']*(L+1)
cnt1 = 0
for s in S:
    res[cnt1*L//N] = s
    cnt1 += 1
cnt2 = 0
for t in T:
    if res[cnt2*L//M] == '!' or res[cnt2*L//M] == t:
        res[cnt2*L//M] = t
        cnt2 += 1
    else:
        print(-1)
        exit()
print(L) 

### FIXED CODE ###

N,M = map(int,input().split())
S = input()
T = input()
from fractions import gcd
G = gcd(N,M)
if S[::N//G] == T[::M//G]:
    print(N*M//G)
else:
    print(-1)
n_dic = {1:2,2:5,3:5,4:4,5:5,6:6,7:3,8:7,9:6}
n,m = map(int,input().split())
l = list(map(int,input().split()))
dic = {}
for i in l:
    if n_dic[i] not in dic or dic[n_dic[i]] < i:
        dic[n_dic[i]] = i
if n % min(dic) == 0:
    ans = str(dic[min(dic)]) * int(n / min(dic))
else:
    ans = str(dic[min(dic)]) * int(n / min(dic))
    sub = n - min(dic) * int(n / min(dic))
    ind = 0
    while sub > 0 and ind < len(ans):
        dif = 0
        v = int(ans[ind])
        for i in range(min(dic) + 1,min(dic) + sub + 1):
            if i in dic and int(dic[i]) > v:
                v = dic[i]
                dif = i - min(dic)
        sub -= dif
        ans = ans[:ind] + str(v) + ans[ind+1:]
        ind += 1
ind = 1
while sub != 0:
    for i in range(sub):
        if min(dic) + sub - i in dic:
            ans = ans[:-ind] + str(dic[min(dic) + sub - i]) + ans[len(ans) - ind + 1:]
            sub -= sub-i
            break
    ind += 1
print(ans)

### FIXED CODE ###

n,m = map(int, input().split())
a = [int(a) for a in input().split()]
l = [0,2,5,5,4,5,6,3,7,6]
a.sort(reverse=True)
dp = [0]+[-1]*n
for i in range(1,n+1):
    for j in a:
        if l[j] <= i:
            dp[i] = max(dp[i], dp[i-l[j]]*10+j)
print(dp[-1])
import sys

n = input()
for i in range(3):
  if(n[i] == "7"):
    printf("YES")
    sys.exit()

printf("NO")

### FIXED CODE ###

import sys

n = input()
for i in range(3):
    if(n[i] == "7"):
        print("Yes")
        sys.exit()

print("No")
N, M, K = map(int, input().split())
A = list(map(int, input().split()))
B = list(map(int, input().split()))
ans = 0
time = 0
n = 0
m = 0
for i in range(N+M):
    if n < N and m < M:
        if A[n] <= B[m]:
            time += A[n]
            n += 1
        else:
            time += B[m]
            m += 1
    else:
        if n == N -1:
            time += B[m]
            m += 1
        elif m == M -1:
            time += A[n]
            n += 1
    if time < K:
        ans += 1
    else:
        break
print(ans)

### FIXED CODE ###

N, M, K = map(int, input().split())
A = list(map(int, input().split()))
B = list(map(int, input().split()))
A_sum = [0]
for i in range(N):
    A_sum.append(A[i] + A_sum[i])
B_sum = [0]
for i in range(M):
    B_sum.append(B[i] + B_sum[i])    
import bisect
ans = 0
for i in range(N+1):
    a = A_sum[i]
    if K-a >=0:
        b_idx = bisect.bisect(B_sum, K-a) - 1
        if b_idx  < 0:
            b_idx = 0
        ans = max(ans, i+b_idx)
print(ans)
s = input()
count = 0
for i in s:
    if int(i) == 1:
        count += 1
print(count)

### FIXED CODE ###

a, b, c = map(int, input().split())
if (10*b + c) % 4 == 0:
    print("YES")
else:
    print("NO")
S=input
print("yes" if len(S)=len(set(S)) else "no")

### FIXED CODE ###

S=input()
print("yes" if len(S)==len(set(S)) else "no")
import math
n = int(input())
s = [0 if i == "W" else 1 for i in list(input())]
cnt = 0
c = 1
for i in range(n * 2):
    if (s
if cnt != 0:
    print(0)
else:
    print((c * math.factorial(n)) % (10 ** 9 + 7))


### FIXED CODE ###

import math
n = int(input())
s = [0 if i == "W" else 1 for i in list(input())]
cnt = 0
c = 1
for i in range(n * 2):
    if (s[i] + cnt) % 2 != 0:
        cnt += 1
    else:
        c = (c * (cnt if cnt != 0 else 1)) % (10 ** 9 + 7)
        cnt -= 1
    if cnt < 0:
        print(0)
        exit()
if cnt != 0:
    print(0)
else:
    print((c * math.factorial(n)) % (10 ** 9 + 7))
n=list(range(1,int(input())+1))
print(sum[i for i in n if i % 3 != 0 and i % 5 != 0])

### FIXED CODE ###

n=int(input())
n=list(range(1,n+1))
n=([i for i in n if i % 3 != 0])
n=([i for i in n if i % 5 != 0])
print(sum(n))
a = map(int, raw_input().split())
  
#a.sort()
print '%d, %d, %d' % (a[1], a[2], a[3])

### FIXED CODE ###

a = map(int, raw_input().split())
  
a.sort()
print '%d %d %d' % (a[0], a[1], a[2])
N = input()
N = int(N)
l = list(int(input().split))
l.sort()
sum = 0
for i in range(N-1):
    sum += l[i]
    
if sum >= l[N-1]:
    print('No')
else:
    print('Yes')





### FIXED CODE ###

N = input()
N = int(N)
l = list(map(int,input().split()))
l.sort()
sum = 0
for i in range(N-1):
    sum += l[i]
    
if sum > l[N-1]:
    print('Yes')
else:
    print('No')
while True:
    a,op,b=input().split()
    if op == "?":
        break
    else:
        if op == "+":
            print(int(a)+int(b))
        elif op == "-":
            print(int(a)-ing(b))
        elif op == "*":
            print(int(a)*int(b))
        elif op == "/":
            Print (int (a) //int (b))
        else:
            print("error")

### FIXED CODE ###

while True:
    a, op, b = input().split()
    if op == '?':
        break
    if op == '/':
        op = '//'
    print(eval(a + op + b))
N=int(input())
n=[str(input()) for i in range(N)]
M=int(input())
m=[str(input()) for i in range(M)]
for i in range(N):
  result=n.count(n[i-1])-m.count(n[i-1]) 
If result>=0:
  print(result)
else:
  print(0)

### FIXED CODE ###

N=int(input())
n=[str(input()) for i in range(N)]
M=int(input())
m=[str(input()) for i in range(M)]
print(max(0, max(n.count(n[i])-m.count(n[i]) for i in range(N))))
def resolve():
    a,b,c,d = map(int,input().split())

    dividable_by_c = b // c - (a-1) // c
    dividable_by_d = b // d - (a-1) // d
    lcm = c * d // fractions.gcd(c,d)
    dividable_by_c_and_d = b // lcm - (a-1) // lcm

    result = (b - a + 1) - dividable_by_c - dividable_by_d + dividable_by_c_and_d
    print(result)
resolve()

### FIXED CODE ###

import fractions

def resolve():
    a,b,c,d = map(int,input().split())
 
    dividable_by_c = b // c - (a-1) // c
    dividable_by_d = b // d - (a-1) // d
    lcm = c * d // fractions.gcd(c,d)
    dividable_by_c_and_d = b // lcm - (a-1) // lcm
 
    result = (b - a + 1) - dividable_by_c - dividable_by_d + dividable_by_c_and_d
    print(result)
resolve()
x = int(input())

h = x // 3600
m = x % 3600 / 60
s = % 60

print(h,m,s,sep=':')

### FIXED CODE ###

x = int(input())

h = x // 3600
m = x % 3600 // 60
s = x % 60

print(h,m,s,sep=':')
def color(A, dic):
  if len(A) == 0:
    return 1
  t = A.pop()
  dic[t] -= 1
  return ((3-dic[t])*color(A, dic)) % (10**9 + 7)

n = int(input())
A = list(map(int, input().split()))
dic = {}
for i in range(n):
  if A[i] in dic:
    dic[A[i]] += 1
  else:
    dic[A[i]] = 1
print(color(A, dic))


### FIXED CODE ###

n = int(input())
a = list(map(int, input().split()))
que = [-1, -1, -1]
ans = 1
for i in range(n):
  if que[0]+1 == a[i]:
    if que[0] == que[1] and que[0] == que[2]:
      ans *= 3
      ans %= (10**9 + 7)
    elif que[0] == que[1]:
      ans *= 2
      ans %= (10**9 + 7)
    que[0] = a[i]
  elif que[1]+1 == a[i]:
    if que[1] == que[2]:
      ans *= 2
      ans %= (10**9 + 7)
    que[1] = a[i]
  elif que[2]+1 == a[i]:
    que[2] = a[i]
  else:
    ans = 0
    break
print(ans)
from math import ceil
if __name__ == "__main__":
    a, b, x = map(int, input().split())
    if x > b:
        print(0)
    else:
        found = False
        i = a
        counter = 0
        while i < b + 1:
            if not found and i % x != 0:
                i += 1
            else:
                break
    print(ceil((b  + 1 - i)/x))
    


### FIXED CODE ###

if __name__ == "__main__":
    a, b, x = map(int, input().split())
    z = (b) // x
    z -= (a - 1) // x
    print(z)
A = int(input())
B = int(input())
if(A==1&&B==2):
  print(3)
if(A==2&&B==1):
  print(3)
if(A==1&&B==3):
  print(2)
if(A==3&&B==1):
  print(2)
if(A==3&&B==2):
  print(1)
if(A==2&&B==3):
  print(1)

### FIXED CODE ###

A = int(input())
B = int(input())
print(6-(A+B))
a, b, c = map(int, input().split())
if a%2 and b%2 and c%2:
  l = sorted(a, b, c)
  print(l[0]*l[1])
else:
  print(0)

### FIXED CODE ###

a, b, c = map(int, input().split())
if a%2 and b%2 and c%2:
  l = sorted([a, b, c])
  print(l[0]*l[1])
else:
  print(0)
import numpy as np
import math
import collections
import bisect
# import sympy


N = int(input())

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

A.sort()
setA = set(A)

Amax = A[len(A) - 1]
dp = [True for i in range(Amax + 1)]
ans = 0
for i in range(len(A)):
    if i < len(A) - 1:
        if A[i] == A[i + 1]:
            continue
    if i > 0:
        if A[i] == A[i - 1]:
            continue

    if dp[A[i]] == True and A[i] in set(A):
        c = 2
        ans += 1
        while(c * A[i] <= Amax):
            dp[c * A[i]] = False
            c += 1

print(ans)


### FIXED CODE ###

import numpy as np
import math
import collections
import bisect
from collections import Counter


N = int(input())

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

A.sort()
Set = set()

Amax = A[len(A) - 1]

counter = Counter(A)
ans = 0
for a in A:
    if a in Set:
        continue
    x = a
    while(x <= Amax):
        Set.add(x)
        x += a

    if counter[a] == 1:
        ans += 1

print(ans)
'''
Created on 2020/02/24

@author: fanta
'''
N = int(input())
X = [int(x) for x in input().split()]
X.insert(0,0)
X.append(0)

for n in range(N+1):
    sum += abs(X[n] - X[n+1])


for n in range(N):
    l = abs(X[n] - X[n+1])
    r = abs(X[n+1] - X[n+2])

    if X[n] < X[n+1] and X[n+1] < X[n+2]:
        print(sum)
    elif X[n] > X[n+1] and X[n+1] > X[n+2]:
        print(sum)

    elif l < r:
        sep = 2*abs(X[n] - X[n+1])
        print(sum - sep)
    else:
        sep = 2*abs(X[n+2] - X[n+1])
        print(sum - sep)




### FIXED CODE ###

N = int(input())
X = [int(x) for x in input().split()]
sum = 0
X.insert(0,0)
X.append(0)

for n in range(N+1):
    sum += abs(X[n] - X[n+1])


for n in range(N):
    l = abs(X[n] - X[n+1])
    r = abs(X[n+1] - X[n+2])

    if X[n] < X[n+1] and X[n+1] < X[n+2]:
        print(sum)
    elif X[n] > X[n+1] and X[n+1] > X[n+2]:
        print(sum)

    elif l < r:
        sep = 2*abs(X[n] - X[n+1])
        print(sum - sep)
    else:
        sep = 2*abs(X[n+2] - X[n+1])
        print(sum - sep)
import bisect, collections, copy, heapq, itertools, math, string, sys
input = lambda: sys.stdin.readline().rstrip() 
sys.setrecursionlimit(10**7)
INF = float('inf')
def I(): return int(input())
def F(): return float(input())
def SS(): return input()
def LI(): return [int(x) for x in input().split()]
def LI_(): return [int(x)-1 for x in input().split()]
def LF(): return [float(x) for x in input().split()]
def LSS(): return input().split()

def resolve():
    N, M = LI()
    cnt = [0] * N
    for _ in range(N):
        a, b = LI_()
        cnt[a] += 1
        cnt[b] += 1

    # 「全ての頂点が偶数回登場する」は必要条件
    # 奇数回登場する頂点があると、それに繋がる辺の中に必ず奇数になる辺が出るから
    # 深さ1の木を考えると、全ての頂点が偶数回登場するならば、
    # 葉iの登場回数=葉iに繋がる辺の数字より、全ての辺の数字が偶数
    if len([i for i in cnt if i % 2 == 0]) == N:
        print('YES')
    else:
        print('NO')

if __name__ == '__main__':
    resolve()


### FIXED CODE ###

import bisect, collections, copy, heapq, itertools, math, string, sys
input = lambda: sys.stdin.readline().rstrip() 
sys.setrecursionlimit(10**7)
INF = float('inf')
def I(): return int(input())
def F(): return float(input())
def SS(): return input()
def LI(): return [int(x) for x in input().split()]
def LI_(): return [int(x)-1 for x in input().split()]
def LF(): return [float(x) for x in input().split()]
def LSS(): return input().split()

def resolve():
    N, M = LI()
    cnt = [0] * N
    for _ in range(M):
        a, b = LI_()
        cnt[a] += 1
        cnt[b] += 1

    # 「全ての頂点が偶数回登場する」は必要条件
    # 奇数回登場する頂点があると、それに繋がる辺の中に必ず奇数になる辺が出るから
    # 深さ1の木を考えると、全ての頂点が偶数回登場するならば、
    # 葉iの登場回数=葉iに繋がる辺の数字より、全ての辺の数字が偶数
    if len([i for i in cnt if i % 2 == 0]) == N:
        print('YES')
    else:
        print('NO')

if __name__ == '__main__':
    resolve()
n, a, b = map(int, input().split())
v = n

if n == a + b:
    print(a)
    exit()

elif a == 0:
    print(0)
    exit()



c = n % (a +b)
if n % (a +b) < a:
    print((a * (n//(a+b))) + (n %(a+b)))
    exit()
else:
    print((a * (n//(a+b))) + a)
    eixt()


### FIXED CODE ###

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

if n == a + b:
    print(a)
    exit()

elif a == 0:
    print(0)
    exit()



c = n % (a +b)
if n % (a +b) < a:
    print((a * (n//(a+b))) + (n %(a+b)))
    exit()
else:
    print((a * (n//(a+b))) + a)
    exit()
# -*- coding: utf-8 -*-
import copy
# スペース区切りの整数の入力
N = int(input())
X = list(map(int, input().split()))
md = int(N/2)
d = {}
for x in X:
    if x in d:
        d[x] += 1
    else:
        d[x] = 1

for i in range(N):
    d_cp = copy.deepcopy(d)
    d_cp[X[i]] += -1
    sum_w = 0
    cum = []
    for i, key in enumerate(d_cp):
        sum_w += d_cp[key]
        cum.append([i,key,sum_w])
    for i,key,c in cum:
        if c >= md:
            print(key)
            break


### FIXED CODE ###

# -*- coding: utf-8 -*-
# スペース区切りの整数の入力
A,B,X = map(int, input().split())

if A + B >= X and A <= X:
    print('YES')
else:
    print('NO')
import sys, re, os
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians
from itertools import permutations, combinations, product, accumulate
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from fractions import gcd
 
def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def S_MAP(): return map(str, input().split())
def LIST(): return list(map(int, input().split()))
def S_LIST(): return list(map(str, input().split()))
 
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10 ** 9 + 7

N = INT()
S = []
for i in range(N):
    S.append(INT())

S = sorted(S)

if ans % 10 != 0:
    print(ans)
    exit()
ans = sum(S)
for i in range(N):
    if S[i] % 10 != 0:
        ans = ans - S[i]
        print(ans)
        exit()

print(0)


### FIXED CODE ###

#14:31-
N = int(input())
s = []
for i in range(N):
    s.append(int(input()))
sum_s = sum(s)
s.sort()
if sum_s % 10 != 0:
    ans = sum_s
else:
    for i in range(N):
        if s[i] % 10 != 0:
            ans = sum_s - s[i]
            break
    else:
        ans = 0
print(ans)