Problem:
 Score : 500 points    Problem Statement Takahashi is not good at problems about trees in programming contests, and Aoki is helping him practice.  First, Takahashi created a tree with N vertices numbered 1 through N , and wrote 0 at each edge.  Then, Aoki gave him M queries. The i -th of them is as follows:   Increment the number written at each edge along the path connecting vertices a_i and b_i , by one.   After Takahashi executed all of the queries, he told Aoki that, for every edge, the written number became an even number.
However, Aoki forgot to confirm that the graph Takahashi created was actually a tree, and it is possible that Takahashi made a mistake in creating a tree or executing queries.  Determine whether there exists a tree that has the property mentioned by Takahashi.      Constraints  2 ≤ N ≤ 10^5  1 ≤ M ≤ 10^5  1 ≤ a_i,b_i ≤ N  a_i ≠ b_i         Input Input is given from Standard Input in the following format:  N  M  a_1  b_1 : a_M  b_M       Output Print YES if there exists a tree that has the property mentioned by Takahashi; print NO otherwise.        Sample Input 1 4 4
1 2
2 4
1 3
3 4      Sample Output 1 YES  For example, Takahashi's graph has the property mentioned by him if it has the following edges: 1-2 , 1-3 and 1-4 .
In this case, the number written at every edge will become 2 .       Sample Input 2 5 5
1 2
3 5
5 1
3 4
2 3      Sample Output 2 NO

Solution (Python):
import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, tan, asin, acos, atan, radians, degrees, log2, gcd, log
from itertools import accumulate, permutations, combinations, combinations_with_replacement, product, groupby
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from bisect import bisect, bisect_left, insort, insort_left
from heapq import heappush, heappop
from functools import reduce
def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))
def ZIP(n): return zip(*(MAP() for _ in range(n)))
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10 ** 9 + 7 

from decimal import *



N, M = MAP()

node = []
for _ in range(M):
	a, b = MAP()
	node.append(a-1)
	node.append(b-1)

for x in Counter(node).values():
	if x%2:
		print("NO")
		break
else:
	print("YES")

Solution (Python):
import sys
from collections import Counter
n, m = map(int, sys.stdin.readline().split())
cAB = Counter()
for i in range(m):
    a,b = map(int, sys.stdin.readline().split())
    cAB[a] += 1
    cAB[b] += 1
print('YES' if all([cAB[key]%2==0 for key in cAB.keys()]) else 'NO')

Solution (Python):
n, m = map(int, input().split())
cnt = [0 for _ in range(n)]

for _ in range(m):
    a, b = map(int, input().split())
    a -= 1
    b -= 1
    cnt[a] = (cnt[a] + 1) % 2
    cnt[b] = (cnt[b] + 1) % 2
if 1 in cnt:
    print("NO")
else:
    print("YES")

Solution (Python):
n, m = map(int, input().split())

dis = [0] * n

for i in range(m):
    a, b = map(int, input().split())
    a -= 1
    b -= 1
    dis[a] += 1
    dis[b] += 1

for i in range(n):
    if dis[i] % 2 == 1:
        print("NO")
        exit(0)

print("YES")

Solution (Python):





import math
import fractions
import sys
import bisect
import heapq  
import collections
from collections import Counter
from collections import deque
import pprint
import itertools

sr = lambda: input()
ir = lambda: int(sr())
lr = lambda: list(map(int, sr().split()))

"""nを素因数分解"""
"""2以上の整数n => [[素因数, 指数], ...]の2次元リスト"""


def factorization(n):
    arr = []
    temp = n
    if n == 1:
        return arr

    for i in range(2, int(-(-n ** 0.5 // 1)) + 1):
        if temp % i == 0:
            cnt = 0
            while temp % i == 0:
                cnt += 1
                temp //= i
            arr.append([i, cnt])

    if temp != 1:
        arr.append([temp, 1])

    if arr == []:
        arr.append([n, 1])

    return arr



def power(a, n, mod):
    x = 1
    while n:
        if n & 1:
            x *= a % mod
        n >>= 1
        a *= a % mod
    return x % mod



def kaijo(n, l, mod):
    if n == 0:
        return 1
    a = n
    tmp = n - 1
    while (tmp >= l):
        a = a * tmp % mod
        tmp -= 1
    return a


class UnionFind():
    def __init__(self, n):
        self.n = n
        self.parents = [-1] * n

    def find(self, x):
        if self.parents[x] < 0:
            return x
        else:
            self.parents[x] = self.find(self.parents[x])
            return self.parents[x]

    def union(self, x, y):
        x = self.find(x)
        y = self.find(y)

        if x == y:
            return

        if self.parents[x] > self.parents[y]:
            x, y = y, x

        self.parents[x] += self.parents[y]
        self.parents[y] = x

    def size(self, x):
        return -self.parents[self.find(x)]

    def same(self, x, y):
        return self.find(x) == self.find(y)

    def members(self, x):
        root = self.find(x)
        return [i for i in range(self.n) if self.find(i) == root]

    def roots(self):
        return [i for i, x in enumerate(self.parents) if x < 0]

    def group_count(self):
        return len(self.roots())

    def all_group_members(self):
        return {r: self.members(r) for r in self.roots()}

    def __str__(self):
        return '\n'.join('{}: {}'.format(r, self.members(r)) for r in self.roots())


def make_divisors(n):
    divisors = []
    for i in range(1, int(n**0.5)+1):
        if n % i == 0:
            divisors.append(i)
            if i != n // i:
                divisors.append(n//i)

    divisors.sort()
    return divisors


inf = 10 ** 18
mod = 10 ** 9 + 7

n,m = lr()
x = [0 for i in range(n-1)]
for i in range(m):
    a,b = lr()
    a,b = min(a,b), max(a,b)
    a-=1
    b-=1
    x[a]+=1
    if b != n-1:
        x[b]-=1
x1 = [0]
for i in range(n-1):
    x1.append(x1[-1]+x[i])
flag = True
for num in x1:
    if num%2 == 1:
        flag = False
        break
if flag:
    print('YES')
else:
    print('NO')

Solution (Python):
N,M = map(int,input().split())
lis = [0] * N
for i in range(M):
    a,b = map(int,input().split())
    lis[a-1] += 1
    lis[b-1] += 1
ans = 'YES'
for i in lis:
    if i % 2 == 1:
        ans = 'NO'
print(ans)

Solution (Python):
from collections import Counter

N, M = map(int, input().split())
tree = []
for _ in range(M):
    a, b = map(int, input().split())
    tree.append(a)
    tree.append(b)

dic = Counter(tree)

f = 1
for v in dic.values():
    if v%2:
        f = 0
        break

if f:
    print("YES")
else:
    print("NO")

Solution (Python):
n,m = map(int,input().split())
cnt = [0]*n
for _ in range(m):
    a,b = map(int,input().split())
    a,b = a-1,b-1
    cnt[a]+=1
    cnt[b]+=1
for i in range(n):
    if cnt[i]&1:
        print("NO")
        break
else:
    print("YES")

Solution (Python):
N, M = map(int, input().split())

tree = [0]*(N-1)

for i in range(M):
    a, b = map(int, input().split())
    if a == 1:
        tree[b-2] += 1
    elif b == 1:
        tree[a-2] += 1
    else:
        tree[a-2] += 1
        tree[b-2] += 1

if all(tree[i] % 2 == 0 for i in range(N-1)):
    print('YES')
else:
    print('NO')

Solution (Python):

import sys
from collections import deque, Counter
from heapq import heappop, heappush
from bisect import bisect_right
from itertools import accumulate

sys.setrecursionlimit(10**6)
INF = 10**12
m = 10**9 + 7

def main():
    N, M = map(int, input().split())
    ans = [0] * N
    for _ in range(M):
        a, b = map(lambda x: int(x)-1, input().split())
        ans[a] = 1-ans[a]
        ans[b] = 1-ans[b]
    if 1 in ans:
        print('NO')
    else:
        print('YES')

if __name__ == "__main__":
    main()

Solution (Python):
import sys
input = sys.stdin.readline

N, M = map(int, input().split())
cnt = [0]*N

for _ in range(M):
    a, b = map(int, input().split())
    cnt[a-1] += 1
    cnt[b-1] += 1

for i in range(N):
    if cnt[i]%2==1:
        print('NO')
        exit()

print('YES')

Solution (Python):
from collections import defaultdict
def main():
    N, M = map(int, input().split())
    d = defaultdict(int)
    for _ in range(M):
        a, b = map(int, input().split())
        d[a] += 1
        d[b] += 1

    for i, j in d.items():
        if j % 2 == 1:
            print('NO')
            exit()

    print('YES')


if __name__ == "__main__":
    main()

Solution (Python):
import sys
import itertools

import time
import math
import heapq
from collections import defaultdict
sys.setrecursionlimit(10 ** 7)
 
INF = 10 ** 18
MOD = 10 ** 9 + 7
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines



N, M = map(int, input().split())
A = [0] * N
for i in range(M):
    a, b = map(int, input().split())
    a -= 1
    b -= 1
    A[a] += 1
    A[b] += 1

for a in A:
    if a % 2 == 1:
        print("NO")
        break
else:
    print("YES")

Solution (Python):
n,m=map(int,input().split())
v={}
for _ in range(m):
    a,b=map(int,input().split())
    v[a]=v.get(a, 0)+1
    v[b]=v.get(b, 0)+1

for ki,vi in v.items():
    if(vi%2!=0):
        print('NO')
        break
else:
    print('YES')

Solution (Python):
from itertools import accumulate

N, M = map(int, input().split())
acc = [0] * N
for _ in range(M):
    a, b = map(int, input().split())
    if a > b:
        a, b = b, a
    acc[a - 1] += 1
    acc[b - 1] -= 1
print("NO") if any(a % 2 for a in accumulate(acc)) else print("YES")

Solution (Python):
from itertools import accumulate

N, M = map(int, input().split())
acc = [0] * N
for _ in range(M):
    a, b = map(int, input().split())
    if a > b:
        a, b = b, a
    acc[a - 1] += 1
    acc[b - 1] -= 1
acc = list(accumulate(acc))
print("NO") if any(a % 2 for a in acc) else print("YES")

Solution (Python):
import sys
from collections import defaultdict

read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline

in_n = lambda: int(readline())
in_nn = lambda: map(int, readline().split())
in_nl = lambda: list(map(int, readline().split()))
in_na = lambda: map(int, read().split())
in_s = lambda: readline().rstrip().decode('utf-8')


def main():
    N, M = in_nn()
    d = defaultdict(int)
    for x in in_na():
        d[x] += 1

    ans = 'YES'
    for i in range(1, N + 1):
        if d[i] % 2 == 1:
            ans = 'NO'
            break

    print(ans)


if __name__ == '__main__':
    main()

Solution (Python):
import sys
input = lambda : sys.stdin.readline().rstrip()
sys.setrecursionlimit(max(1000, 10**9))
write = lambda x: sys.stdout.write(x+"\n")


from collections import defaultdict
n,m = map(int, input().split())
ns = defaultdict(int)
for _ in range(m):
    u,v = map(int, input().split())
    u -= 1
    v -= 1
    ns[u] += 1
    ns[v] += 1
if all(val%2==0 for val in ns.values()):
    ans = "YES"
else:
    ans = "NO"
print(ans)

Solution (Python):
n,m = map(int,input().split())
ans = "YES"
cnt = [0]*n
for _ in range(m):
    a,b = map(int,input().split())
    a -= 1
    b -= 1
    cnt[a] += 1
    cnt[b] += 1
for i in range(n):
    if cnt[i]%2 != 0:
        ans = "NO"
        break
print(ans)

Solution (Python):
n,m=map(int,input().split())
dic = {}
for i in range(1,n+1):
  dic[i]=0
for i in range(m):
  a,b = map(int,input().split())
  dic[a] += 1
  dic[b] += 1
ret = 'YES'
for i in range(1,n+1):
  if dic[i]%2==1:
    ret = 'NO'
    break
print(ret)

Solution (Python):
n, m = map(int, input().split())
cnt = [0] * (n + 1)
for _ in range(m):
    a, b = map(int, input().split())
    cnt[a] += 1
    cnt[b] += 1
for i in cnt:
    if not i % 2 == 0:
        print("NO")
        exit()
print("YES")

Solution (Python):
n, m = [int(w) for w in input().split()]

node = [0] * (n+1)

for i in range(m):
    a, b = [int(w) for w in input().split()]
    node[a] ^= 1
    node[b] ^= 1

cond = all([w == 0 for w in node])
print("YES" if cond else "NO")

Solution (Python):
"""
rootを決めて、aから必ずrootを通ってbに到達するとする
aとbのlcaより上は、+2されることになるので、実質通っていないのと同値
どんな木であっても、自分自身が偶数回(0を含む)でてこないと
ノードの値は偶数にはなりえない
"""
n, m = map(int, input().split())
cnts = [0] * (n+1) 
for i in range(m):
    a,b = map(int, input().split())
    cnts[a] += 1
    cnts[b] += 1
if all([c%2 == 0 for c in cnts]):
    print("YES")
else:
    print("NO")

Solution (Python):
N, M = map(int, input().split())

lst = [0]*(N+1)

for _ in range(M):
  a,b = map(int, input().split())
  lst[a] += 1
  lst[b] += 1
  
for i in lst:
  if i % 2 == 1:
    print('NO')
    exit()
    
print('YES')

Solution (Python):
from collections import defaultdict
n,m = map(int,input().split())
d = defaultdict(int)
for i in range(m):
    a,b = map(int,input().split())
    d[a] += 1
    d[b] += 1
ans = True
for i in d.values():
    if i % 2 != 0:
        ans = False
if ans:
    print("YES")
else:
    print("NO")

Solution (Python):
N,M=map(int,input().split())
cnt=[0]*N
for i in range(M):
    a,b=map(lambda x:int(x)-1,input().split())
    if a>b:
        a,b=b,a
    if a==0:
        cnt[b]+=1
    else:
        cnt[a]+=1
        cnt[b]+=1
for i in range(1,N):
    if cnt[i]%2:
        print('NO')
        exit()
print('YES')

Solution (Python):
from collections import Counter
N,M = list(map(int,input().split()))

counter = Counter()
for i in range(M):
    counter.update(map(int,input().split()))

for count in counter.most_common():
    if count[1]%2 != 0:
        print("NO")
        break
else:
    print("YES")

Solution (Python):
import sys
import numpy as np


read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
nums = np.array(read().split(), np.int32)[2:]
flg = np.all(np.bincount(nums) % 2 == 0)
if flg:
    print('YES')
else:
    print('NO')

Solution (Python):
n,m=map(int,input().split())
from collections import defaultdict
d=defaultdict(int)

for i in range(m):
    a,b=map(int,input().split())
    a,b=a-1,b-1
    d[a]+=1
    d[b]+=1

for i in range(n):
    if d[i]%2==1:
        print('NO')
        exit()
print('YES')

Solution (Python):
import bisect
import copy
import heapq
import math
import sys
from collections import *
from functools import lru_cache
from itertools import accumulate, combinations, permutations, product
def input():
    return sys.stdin.readline()[:-1]
def ruiseki(lst):
    return [0]+list(accumulate(lst))
sys.setrecursionlimit(500000)
mod=pow(10,9)+7
al=[chr(ord('a') + i) for i in range(26)]
direction=[[1,0],[0,1],[-1,0],[0,-1]]

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

dic=defaultdict(int)

for i in range(m):
    a,b=ab[i]
    dic[a]+=1
    dic[b]+=1

for i in range(n):
    if dic[i+1]%2==0:
        continue
    else:
        print("NO")
        break
else:
    print("YES")

Solution (Python):
import numpy as np

n, m = map(int, input().split())

arr = []
for _ in range(m):
    a, b = map(int, input().split())
    arr.append(a)
    arr.append(b)

arr = np.array(arr)

print("YES" if np.where(np.bincount(arr) % 2 != 0)[0].shape[0] == 0 else "NO")

Solution (Python):
import sys
import numpy as np

read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines

nums = np.array(read().split(), np.int32)[2:]

cond = np.all(np.bincount(nums) % 2 == 0)
print('YES' if cond else 'NO')

Solution (Python):
from collections import defaultdict

def main():
    N, M = map(int, input().split())
    d = defaultdict(int)
    for _ in range(M):
        a, b = map(int, input().split())
        d[a] += 1
        d[b] += 1

    for i, j in d.items():
        if j % 2 == 1:
            print('NO')
            exit()


    print('YES')


if __name__ == "__main__":
    main()

Solution (Python):
import sys
import math
from collections import defaultdict
from bisect import bisect_left, bisect_right

sys.setrecursionlimit(10**7)
def input():
    return sys.stdin.readline()[:-1]

mod = 10**9 + 7

def I(): return int(input())
def LI(): return list(map(int, input().split()))
def LIR(row,col):
    if row <= 0:
        return [[] for _ in range(col)]
    elif col == 1:
        return [I() for _ in range(row)]
    else:
        read_all = [LI() for _ in range(row)]
        return map(list, zip(*read_all))



N,M = LI()
a,b = LIR(M,2)

count = [0]*(N+1)
for i in range(M):
    count[a[i]] += 1
    count[b[i]] += 1

for i in range(1,N+1):
    if count[i]%2 == 1:
        print('NO')
        exit()

print('YES')

Solution (Python):
n, m = map(int, input().split())
dat = [0] * (n+10)
for _ in range(m):
    a,b = map(int, input().split())
    dat[a] += 1
    dat[b] += 1
can = True
for i in range(n):
    if dat[i] % 2 == 1:
        can = False
print("YES" if can else "NO")

Solution (Python):
N,M=map(int,input().split())
L=[0 for i in range(N+1)]
for i in range(M):
    a,b=map(int,input().split())
    L[a]+=1
    L[b]+=1

for i in range(1,len(L)):
    if L[i]%2==1:
        print("NO")
        exit()
print("YES")

Solution (Python):
n, m = map(int, input().split())
d = {i: 0 for i in range(1, n+1)}
for _ in range(m):
    a, b = map(int, input().split())
    d[a] += 1
    d[b] += 1
for k, v in d.items():
    if v % 2:
        print('NO')
        break
else:
    print('YES')

Solution (Python):






import sys
input = sys.stdin.readline

import math

import bisect
import heapq
from collections import defaultdict
from collections import deque
from collections import Counter
from functools import lru_cache






MOD = 10**9+7
INF = float('inf')
AtoZ = "abcdefghijklmnopqrstuvwxyz"






def I(): return int(input().strip())
def S(): return input().strip()
def IL(): return list(map(int,input().split()))
def SL(): return list(map(str,input().split()))
def ILs(n): return list(int(input()) for _ in range(n))
def SLs(n): return list(input().strip() for _ in range(n))
def ILL(n): return [list(map(int, input().split())) for _ in range(n)]
def SLL(n): return [list(map(str, input().split())) for _ in range(n)]


def P(arg): print(arg); return
def Y(): print("Yes"); return
def N(): print("No"); return
def E(): exit()
def PE(arg): print(arg); exit()
def YE(): print("Yes"); exit()
def NE(): print("No"); exit()


def DD(arg): return defaultdict(arg)



def inv(n): return pow(n, MOD-2, MOD)


kaijo_memo = []
def kaijo(n):
  if(len(kaijo_memo) > n):
    return kaijo_memo[n]
  if(len(kaijo_memo) == 0):
    kaijo_memo.append(1)
  while(len(kaijo_memo) <= n):
    kaijo_memo.append(kaijo_memo[-1] * len(kaijo_memo) % MOD)
  return kaijo_memo[n]

gyaku_kaijo_memo = []
def gyaku_kaijo(n):
  if(len(gyaku_kaijo_memo) > n):
    return gyaku_kaijo_memo[n]
  if(len(gyaku_kaijo_memo) == 0):
    gyaku_kaijo_memo.append(1)
  while(len(gyaku_kaijo_memo) <= n):
    gyaku_kaijo_memo.append(gyaku_kaijo_memo[-1] * pow(len(gyaku_kaijo_memo),MOD-2,MOD) % MOD)
  return gyaku_kaijo_memo[n]

def nCr(n,r):
  if(n == r):
    return 1
  if(n < r or r < 0):
    return 0
  ret = 1
  ret = ret * kaijo(n) % MOD
  ret = ret * gyaku_kaijo(r) % MOD
  ret = ret * gyaku_kaijo(n-r) % MOD
  return ret


def factorization(n):
  arr = []
  temp = n
  for i in range(2, int(-(-n**0.5//1))+1):
    if temp%i==0:
      cnt=0
      while temp%i==0: 
        cnt+=1 
        temp //= i
      arr.append([i, cnt])
  if temp!=1:
    arr.append([temp, 1])
  if arr==[]:
    arr.append([n, 1])
  return arr


def make_divisors(n):
  divisors = []
  for i in range(1, int(n**0.5)+1):
    if n % i == 0:
      divisors.append(i)
      if i != n // i: 
        divisors.append(n//i)
  return divisors


def make_primes(N):
  max = int(math.sqrt(N))
  seachList = [i for i in range(2,N+1)]
  primeNum = []
  while seachList[0] <= max:
    primeNum.append(seachList[0])
    tmp = seachList[0]
    seachList = [i for i in seachList if i % tmp != 0]
  primeNum.extend(seachList)
  return primeNum


def gcd(a, b):
    while b:
        a, b = b, a % b
    return a


def lcm(a, b):
    return a * b // gcd (a, b)


def count_bit(n):
  count = 0
  while n:
    n &= n -1
    count += 1
  return count


def base_10_to_n(X, n):
  if X//n:
    return base_10_to_n(X//n, n)+[X%n]
  return [X%n]

def base_n_to_10(X, n):
  return sum(int(str(X)[-i-1])*n**i for i in range(len(str(X))))


def int_log(n, a):
  count = 0
  while n>=a:
    n //= a
    count += 1
  return count




N ,M = IL()
dic = DD(int)

for _ in range(M):
  a,b = IL()
  dic[a]+=1
  dic[b] += 1
for i in range(N):
  if dic[i]%2:
    print("NO")
    exit()
print("YES")

Solution (Python):
from collections import defaultdict
n, m = map(int, input().split())
cnt = defaultdict(int)
for _ in range(m):
    a, b = map(int, input().split())
    cnt[a] = (cnt[a]+1) % 2
    cnt[b] = (cnt[b]+1) % 2

if any(v for v in cnt.values()):
    print('NO')
else:
    print('YES')

Solution (Python):
from collections import defaultdict
n, m = map(int, input().split())
cnt = defaultdict(int)
for _ in range(m):
    a, b = map(int, input().split())
    cnt[a] ^= 1
    cnt[b] ^= 1

if any(v for v in cnt.values()):
    print('NO')
else:
    print('YES')

Solution (Python):
from collections import defaultdict
n, m = map(int, input().split())
cnt = defaultdict(int)
for _ in range(m):
    a, b = map(int, input().split())
    cnt[a] += 1
    cnt[b] += 1

if all(v % 2 == 0 for v in cnt.values()):
    print('YES')
else:
    print('NO')

Solution (Python):
n, m = map(int, input().split())

c = [0] * n
for _ in range(m):
    a, b = map(int, input().split())
    c[a-1] += 1
    c[b-1] += 1

for i in range(n):
    if c[i] % 2 == 1:
        print("NO")
        exit()
print("YES")

Solution (Python):
import sys
from collections import defaultdict

sys.setrecursionlimit(10 ** 7)
rl = sys.stdin.readline


def solve():
    N, M = map(int, rl().split())
    
    counter = defaultdict(int)
    for _ in range(M):
        a, b = map(int, rl().split())
        counter[a] += 1
        counter[b] += 1
    
    for i in range(1, N + 1):
        if counter[i] % 2:
            print('NO')
            return
    print('YES')


if __name__ == '__main__':
    solve()

Solution (Python):
n, m = map(int, input().split())
nnode = [0]*n
for _ in range(m):
    a, b = map(int, input().split())
    nnode[a-1] += 1
    nnode[b-1] += 1
for i in nnode:
    if i%2==1:
        print('NO')
        break
else:
    print('YES')

Solution (Python):
def main():
    import sys
    input = sys.stdin.readline
    N, M = [int(x) for x in input().strip().split()]
    l = [0] * N
    for m in range(M):
        a, b = [int(x) for x in input().strip().split()]
        l[a-1] += 1
        l[b-1] += 1
    if [i for i in l if i % 2]:
        print('NO')
    else:
        print('YES')

if __name__ == '__main__':
    main()

Solution (Python):
import math
import numpy as np
import queue
from collections import deque,defaultdict
import heapq as hpq
from sys import stdin,setrecursionlimit


ipt = stdin.readline
setrecursionlimit(10**7)

def main():
    n,m = map(int,ipt().split())
    ts = np.zeros(n+1,dtype=int)
    for _ in range(m):
        a,b = map(int,ipt().split())
        ts[a] += 1
        ts[b] += 1
    if np.count_nonzero(ts%2) == 0:
        print("YES")
    else:
        print("NO")
    return

if __name__ == '__main__':
    main()

Solution (Python):
n , m = map(int,input().split())
ans = [1 for i in range(n)]
for i in range(m):
    a , b = map(int,input().split())
    if a != 1:
        ans[a-1] *= -1
    if b != 1:
        ans[b-1] *= -1
        
for i in ans:
    if i == -1:
        print("NO")
        exit()
print("YES")

Solution (Python):
N, M = map(int, input().split())
Ans = [0] * N
for _ in range(M):
    a, b = map(int, input().split())
    a -= 1
    b -= 1
    Ans[a] += 1
    Ans[b] += 1

for a in Ans:
    if a % 2 != 0:
        print('NO')
        exit()
print('YES')

Solution (Python):
import math,itertools,fractions,heapq,collections,bisect,sys,queue,copy

sys.setrecursionlimit(10**7)
inf=10**20
mod=10**9+7
dd=[(-1,0),(0,1),(1,0),(0,-1)]
ddn=[(-1,0),(-1,1),(0,1),(1,1),(1,0),(1,-1),(0,-1),(-1,-1)]

def LI(): return [int(x) for x in sys.stdin.readline().split()]
def LF(): return [float(x) for x in sys.stdin.readline().split()]
def I(): return int(sys.stdin.readline())
def F(): return float(sys.stdin.readline())
def LS(): return sys.stdin.readline().split()
def S(): return input()

def main():
  n,m=LI()
  l=[0]*n

  for _ in range(m):
    a,b=LI()
    a-=1
    b-=1
    l[a]+=1
    l[b]+=1

  for i in range(n):
    if l[i]%2==1:
      return 'NO'

  return 'YES'


print(main())

Solution (Python):


from collections import defaultdict

n, m = map(int, input().split())
counter = defaultdict(int)
for _ in range(m):
    ai, bi = map(int, input().split())
    counter[ai] += 1
    counter[bi] += 1


for key in counter:
    if counter[key] % 2 != 0:
        print("NO")
        exit()
else:
    print("YES")

Solution (Python):
from collections import Counter
N,M=map(int,input().split())
a=[0]*M
b=[0]*M
c=[]
for i in range(M):
  a[i],b[i]= map(int,input().split())
  c.append(a[i])
  c.append(b[i])
  
d=dict(Counter(c))
ans="YES"
for e in d:
  if d[e]%2==1:
    ans="NO"
print(ans)

Solution (Python):
n,m=map(int,input().split())
l=[0]*n
for i in range(m):
  a,b=map(int,input().split())
  l[a-1]+=1
  l[b-1]+=1
x='YES'
for i in l:
  if i%2:
    x='NO'
    break
print(x)

Solution (Python):
import sys


import math
import collections

import bisect
import itertools
import fractions

import copy
import heapq
import decimal

import queue

sys.setrecursionlimit(10000001)
INF = 10 ** 16
MOD = 10 ** 9 + 7

ni = lambda: int(sys.stdin.readline())
ns = lambda: map(int, sys.stdin.readline().split())
na = lambda: list(map(int, sys.stdin.readline().split()))





def main():
    n, m = ns()
    table = [0 for _ in range(n)]

    for _ in range(m):
        a, b = ns()
        a -= 1
        b -= 1
        table[a] ^= 1
        table[b] ^= 1

    ans = max(table)

    print("NO" if ans else "YES")





if __name__ == '__main__':
    main()

Solution (Python):
n, m = map(int, input().split())

dic = {}

for i in range(m):
    a, b = map(int, input().split())

    if a in dic:
        dic[a] += 1
    else:
        dic[a] = 1
    if b in dic:
        dic[b] += 1
    else:
        dic[b] = 1

ok = 1

for k, v in dic.items():
    if v % 2 != 0:
        ok = 0
        break

print('YES' if ok else 'NO')

Solution (Python):
n,m = map(int,input().split())
s = [0]*(n)
for i in range(m):
    a,b = map(int,input().split())
    s[a-1] += 1
    s[b-1] += 1
for i in s:
    if i%2 != 0:
        print("NO")
        exit()
print("YES")

Solution (Python):
def main():
    n,m=map(int, input().split())
    k = [0]*n
    for i in range(m):
        a,b=map(int, input().split())
        k[a-1]+=1
        k[b-1]+=1
    for i in k:
        if i%2==1:
            print("NO")
            exit()
    print("YES")
if __name__ == '__main__':
    main()

Solution (Python):
N, M = map(int, input().split(' '))
l = [0]*(N-1)
for i in range(M):
    a, b = map(int, input().split(' '))
    if 1 in [a, b]:
        a, b = sorted([a, b])
        l[b-2] += 1
    else:
        l[a - 2] += 1
        l[b - 2] += 1
for i in l:
    if i % 2 != 0:
        print('NO')
        exit()
print('YES')

Solution (Python):
n, m = map(int, input().split())
cnt = {i: 0 for i in range(1, n+1)}
for _ in range(m):
    a, b = map(int, input().split())
    cnt[a] += 1
    cnt[b] += 1

if all(cnt[i] % 2 == 0 for i in range(1, n+1)):
    print('YES')
else:
    print('NO')

Solution (Python):
from collections import defaultdict
dic = defaultdict(int)
n, m = map(int, input().split())
for i in range(m):
    a, b = map(int, input().split())
    dic[a] += 1
    dic[b] += 1
if [value for value in dic.values() if value % 2 == 1]:
    print('NO')
else:
    print('YES')

Solution (Python):
n,m=map(int,input().split())
l=[0]*n
for i in range(m):
    a,b=map(int,input().split())
    l[a-1]+=1
    l[b-1]+=1
k=0
while k<n:
    if l[k]%2==0:
        k+=1
        continue
    else:
        print("NO")
        exit()
print("YES")

Solution (Python):
import sys

N, M = map(int, sys.stdin.readline().strip().split())

paths = []
count = {}
for _ in range(M):
    a, b = map(int, sys.stdin.readline().strip().split())
    paths.append((a, b))

    if a not in count:
        count[a] = 0
    if b not in count:
        count[b] = 0
    count[a] += 1
    count[b] += 1

for key, c in count.items():
    if c % 2 != 0:
        print("NO")
        break
else:
    print("YES")

Solution (Python):
def Z(): return int(input())
def ZZ(): return [int(_) for _ in input().split()]

def main():
    N, M = ZZ()
    cnt = [0] * (N + 1)
    for _ in range(M):
        a, b = ZZ()
        cnt[a] += 1
        cnt[b] += 1
    print('YES' if all([c%2 == 0 for c in cnt]) else 'NO')

    return

if __name__ == '__main__':
    main()

Solution (Python):
import sys
from collections import defaultdict
readline = sys.stdin.buffer.readline
sys.setrecursionlimit(10 ** 8)
INF = float('inf')
MOD = 10 ** 9 + 7

def main():
    N, M = map(int, readline().split())
    d = defaultdict(int)
    for _ in range(M):
        a, b = map(int, readline().split())
        d[a] += 1
        d[b] += 1
    for i in d.values():
        if i%2==1:
            print('NO')
            break
        else:
            continue
    else:
        print('YES')

if __name__ == '__main__':
    main()

Solution (Python):
import sys
sys.setrecursionlimit(10 ** 5 + 10)
def input(): return sys.stdin.readline().strip()

def resolve():
    def main():
    
        N,M=map(int,input().split())
        L=[0]*N
        for i in range(M):
            a,b=map(int,input().split())
            L[a-1]+=1
            L[b-1]+=1
        for i in range(N):
            if L[i]%2==1: return 'NO'
        return 'YES'
    print(main())
        


    
resolve()

Solution (Python):
def main():
    vertex, query = map(int, input().split())
    cnt = [0 for _ in range(vertex)]
    for _ in range(query):
        a, b = map(lambda x: int(x) - 1, input().split())
        cnt[a] += 1
        cnt[b] += 1
    print("YES" if all(cnt[i] % 2 == 0 for i in range(vertex)) else "NO")


if __name__ == '__main__':
    main()

Solution (Python):
n,m=map(int,input().split())
g=[0]*(n+1)
for _ in range(m):
  a,b=map(int,input().split())
  g[a]+=1
  g[b]+=1
  g[a]%=2
  g[b]%=2
  
print("YES" if 1-max(g) else "NO")

Solution (Python):
n, m = map(int, input().split())
d = {i: 0 for i in range(n)}
for i in range(m):
    a, b = map(int, input().split())
    d[a - 1] += 1
    d[b - 1] += 1
for i in d.values():
    if i % 2 == 1:
        print("NO")
        exit()
print("YES")

Solution (Python):
n, m = map(int, input().split())
c_list = [0]*n
for _ in range(m):
    a, b = map(int, input().split())
    a -= 1
    b -= 1
    c_list[a] += 1
    c_list[b] += 1

ok = True
for c in c_list:
    if c % 2 != 0:
        ok = False
if ok:
    print("YES")
else:
    print("NO")

Solution (Python):
n,m = map(int,input().split())
chk = [0]*n
for i in range(m):
  a,b = map(int,input().split())
  chk[a-1] += 1
  chk[b-1] += 1
ans = 'YES'
for i in chk:
  if i % 2  == 1:
    ans = 'NO'
print(ans)

Solution (Python):
import sys

input = sys.stdin.readline


def main():
    N, M = map(int, input().split())
    count = [0] * (N + 1)
    for _ in range(M):
        a, b = map(int, input().split())
        count[a] += 1
        count[b] += 1

    if all(c % 2 == 0 for c in count):
        ans = "YES"
    else:
        ans = "NO"
    print(ans)


if __name__ == "__main__":
    main()

Solution (Python):
n,m=map(int,input().split())
l=[0]*(n+1)
ku=[]
for _ in range(m):
    ku.append(tuple(map(int,input().split())))
for x in ku:
    a,b=x
    l[a]=(l[a]+1)%2
    l[b]=(l[b]+1)%2
print("NO" if 1 in l else "YES")

Solution (Python):
N, M = map(int, input().split())
A = [0]*(N+1)
for _ in range(M):
  a, b = map(int, input().split())
  A[a] = (A[a]+1)%2
  A[b] = (A[b]+1)%2
print("YES" if len(list(filter(lambda x:x==1, A))) < 1 else "NO")