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):
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
print('YES' if all([i % 2 == 0 for i in cnt]) else 'NO')

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

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

flg = True
for i in range(N):
    if t[i] % 2 == 1:
        flg = False
        break

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

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

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

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

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

x = [0] * n

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

c = 0
for i in range(n):
    if x[i] == 0:
        c += 1

if c == n:
    print('YES')
else:
    print('NO')

Solution (Python):
def inpl(): return [int(i) for i in input().split()]

N, M = inpl()
path = [True for _ in range(N+1)]

for _ in range(M):
    a, b = inpl()
    path[a] = not path[a]
    path[b] = not path[b]

if all(path):
    print('YES')
else:
    print('NO')

Solution (Python):

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

buf = [0 for i in range(N)]
for i in range(M):
    a,b = list(map(int,input().split()))
    buf[a-1]+=1
    buf[b-1]+=1
flag=True
for bf in buf:
    if bf%2==1:
        flag=False
        break

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

Solution (Python):





"""
agc014 B
"""

from collections import Counter
n, m = map(int, input().split())

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

for a in range(1, n+1):
    if cnt[a] % 2 == 1:
        print('NO')
        exit()

print('YES')

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

for num in nums:
    if num % 2:
        print('NO')
        break
else:
    print('YES')

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

sys.setrecursionlimit(10**5) 
 
def li(): return map(int, stdin.readline().split())
def li_(): return map(lambda x: int(x)-1, stdin.readline().split())
def lf(): return map(float, stdin.readline().split())
def ls(): return stdin.readline().split()
def ns(): return stdin.readline().rstrip()
def lc(): return list(ns())
def ni(): return int(stdin.readline())
def nf(): return float(stdin.readline())

n,m = li()

cnt = [0]*n
for _ in range(m):
    a,b = li_()
    cnt[a] += 1
    cnt[b] += 1
    
exist = True
for c in cnt:
    if c%2:
        exist = False
        break

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

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

sys.setrecursionlimit(10**5) 
 
def li(): return map(int, stdin.readline().split())
def li_(): return map(lambda x: int(x)-1, stdin.readline().split())
def lf(): return map(float, stdin.readline().split())
def ls(): return stdin.readline().split()
def ns(): return stdin.readline().rstrip()
def lc(): return list(ns())
def ni(): return int(stdin.readline())
def nf(): return float(stdin.readline())

from collections import defaultdict

n,m  = li()
query = []
for _ in range(m):
    mi,ma = li()
    if mi > ma:
        mi,ma = ma,mi
        
    query.append((mi,ma))

root = defaultdict(list)
for l,r in query:
    root[l].append(r)


even = -1
odd = -1
for k, v in root.items():
    if len(v)%2 == 0 and even == -1:
        even = k
        
    elif len(v)%2 == 1 and odd == -1:
        odd = k


top = even
dist = [0]*n
for l,r in query:
    if l==top:
        dist[r-1] += 1
    
    elif r==top:
        dist[l-1] += 1
    
    else:
        dist[r-1] += 1
        dist[l-1] += 1
        
exist = False
if top != -1 and all([disti % 2 == 0 for disti in dist]):
    exist = True
    


top = odd
dist = [0]*n
for l,r in query:
    if l==top:
        dist[r-1] += 1
    
    elif r==top:
        dist[l-1] += 1
    
    else:
        dist[r-1] += 1
        dist[l-1] += 1
        
if top != -1 and all([disti % 2 == 0 for disti in dist]):
    exist = True

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

Solution (Python):
import sys
N,M=map(int,input().split())
table=[]
for i in range(M):
    x,y=map(int,input().split())
    x,y=x-1,y-1
    if x>y:
        x,y=y,x
    table.append((x,y))
L=[0]*N
for x,y in table:
    if x==0:
        L[y]+=1
    else:
        L[x]+=1
        L[y]+=1
for s in L:
    if s%2==1:
        print('NO')
        sys.exit()
print('YES')

Solution (Python):
n, m=map(int, raw_input().split())
odd=[False]*(n+1)
for i in range(m):
	a, b=map(int, raw_input().split())
	odd[a]=not odd[a]
	odd[b]=not odd[b]
print "NO" if any(odd) else "YES"

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

Solution (Python):
from collections import Counter
N, M = map(int, input().split())
cnt = Counter(int(s) for _ in range(M) for s in input().split())
if all(v % 2 == 0 for v in cnt.values()):
    print('YES')
else:
    print('NO')

Solution (Python):
from itertools import accumulate as ac
n,m=map(int,input().split())
l=[0]*(n+1)
for _ in range(m):
  a,b=map(int,input().split())
  if a>b:a,b=b,a
  l[a]+=1
  l[b]-=1

*l,=ac(l)
*l,=filter(lambda x:x%2,l)
if l:
  print("NO")
else:
  print("YES")

Solution (Python):
n,m = (int(i) for i in input().split())
x = [0 for i in range(n)]
for _ in range(m):
	a,b = (int(i)-1 for i in input().split())
	x[a],x[b] = 1-x[a],1-x[b]
if sum(x): print("NO")
else: print("YES")

Solution (Python):
from collections import Counter

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

ok = True
for value in c.values():
	if value % 2 == 1:
		ok = False
		break
if ok:
	print("YES")
else:
	print("NO")

Solution (Python):

import bisect
import heapq
import math
import random
import sys
from collections import Counter, defaultdict, deque
from decimal import ROUND_CEILING, ROUND_HALF_UP, Decimal
from functools import lru_cache, reduce
from itertools import combinations, combinations_with_replacement, product, permutations
from operator import add, mul, sub

sys.setrecursionlimit(10000)


def read_int():
    return int(input())


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


def read_float():
    return float(input())


def read_float_n():
    return list(map(float, input().split()))


def read_str():
    return input().strip()


def read_str_n():
    return list(map(str, input().split()))


def error_print(*args):
    print(*args, file=sys.stderr)


def mt(f):
    import time

    def wrap(*args, **kwargs):
        s = time.time()
        ret = f(*args, **kwargs)
        e = time.time()

        error_print(e - s, 'sec')
        return ret

    return wrap


@mt
def slv(N, M, AB):
    c = Counter()
    for a, b in AB:
        c[a] += 1
        c[b] += 1
    for v in c.values():
        if v % 2 != 0:
            return 'NO'
    return 'YES'


def main():
    N, M = read_int_n()
    AB = [read_int_n() for _ in range(M)]
    print(slv(N, M, AB))


if __name__ == '__main__':
    main()

Solution (Python):

import bisect
import heapq
import math
import random
import sys
from collections import Counter, defaultdict, deque
from decimal import ROUND_CEILING, ROUND_HALF_UP, Decimal
from functools import lru_cache, reduce
from itertools import combinations, combinations_with_replacement, product, permutations
from operator import add, mul, sub

sys.setrecursionlimit(10000)


def read_int():
    return int(input())


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


def read_float():
    return float(input())


def read_float_n():
    return list(map(float, input().split()))


def read_str():
    return input().strip()


def read_str_n():
    return list(map(str, input().split()))


def error_print(*args):
    print(*args, file=sys.stderr)


def mt(f):
    import time

    def wrap(*args, **kwargs):
        s = time.time()
        ret = f(*args, **kwargs)
        e = time.time()

        error_print(e - s, 'sec')
        return ret

    return wrap


@mt
def slv(N, M, AB):
    c = Counter()
    for a, b in AB:
        c[a] += 1
        c[b] += 1
    for v in c.values():
        if v % 2 != 0:
            return 'NO'
    return 'YES'


def main():
    N, M = read_int_n()
    AB = [read_int_n() for _ in range(M)]
    print(slv(N, M, AB))


if __name__ == '__main__':
    main()

Solution (Python):
N, M = map(int, input().split())
L = [True] * (N+1)
for i in range(M):
    a, b = map(int, input().split())
    L[a] = not L[a]
    L[b] = not L[b]
if False in L:
    print("NO")
else:
    print("YES")

Solution (Python):


n,m = map(int,input().split())
a = []
for i in range(n+1):
	a.append(0)
for i in range(m):
	x,y = map(int,input().split())
	a[x] += 1
	a[y] += 1
ans = True
for i in range(n+1):
	if a[i]%2!=0:
		ans = False

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

Solution (Python):

import sys

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


count = [True] * N
for m in range(M):
    a_, b_ = map(int, input().split())
    a_ -= 1
    b_ -= 1
    
    
    count[a_] = count[a_] ^ True
    count[b_] = count[b_] ^ True




for m in range(M):
    if not count[m]:
        print("NO")
        sys.exit(0)
print("YES")

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

Solution (Python):
N, M = map(int, input().split())
node = [0] * (N+1)

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

if all(map(lambda x: x%2==0, node)):
    print("YES")
else:
    print("NO")

Solution (Python):
def read():
    return int(input())


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


def readmap():
    return map(int, input().split())


N, M = readmap()
cnt = [0] * N
for _ in range(M):
    a, b = readmap()
    cnt[a-1] += 1
    cnt[b-1] += 1

for i in range(N):
    if cnt[i] % 2:
        print("NO")
        quit()

print("YES")

Solution (Python):


import sys, math, copy




HUGE = 2147483647
HUGEL = 9223372036854775807
ABC = "abcdefghijklmnopqrstuvwxyz"

def main():
    n, m = map(int, input().split())
    cnt = [0 for i in range(n)]
    for i in range(m):
        a, b = map(int, input().split())
        cnt[a - 1] += 1
        cnt[b - 1] += 1
    flag = True
    for i in range(n):
        if cnt[i] % 2 == 1:
            flag = False
            break
    print("YES" if flag else "NO")

main()

Solution (Python):
from collections import Counter

n,m=[int(i) for i in input().split()]
a=[]
for i in range(m):
  s,e=[int(i) for i in input().split()]
  a.append(s)
  a.append(e)

c=Counter(a)
for i,j in c.most_common():
  if j % 2 !=0:
    print('NO')
    break
else:
  print('YES')

Solution (Python):
from collections import Counter

n, q = map(int, input().split())
c = Counter()
for _ in range(q):
    u, v = map(int, input().split())
    c[u] += 1
    c[v] += 1

safe = all(c[x] % 2 == 0 for x in c)
print('YES' if safe else 'NO')

Solution (Python):
n, m = map(int, input().split())
dic = {}
flag = 0
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
for num in dic:
    if dic[num] % 2 != 0:
        flag = 1
        break
if flag == 0:
    print("YES")
else:
    print("NO")

Solution (Python):
N,M=[int(i) for i in input().split()]
flag=[True for i in range(N)]

for i in range(M):
        for j in input().split():
                j=int(j)-1
                flag[j]=flag[j]^True

ans=True
for i in flag:
        if not i:
                ans=False
                break
if ans:
        print("YES")
else:
        print("NO")

Solution (Python):
from collections import defaultdict, Counter
from itertools import product, groupby, count, permutations, combinations
from math import pi, sqrt
from collections import deque
from bisect import bisect, bisect_left, bisect_right
INF = float("inf")


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 k, v in d.items():
        if v % 2 != 0:
            print("NO")
            return
    print("YES")


if __name__ == '__main__':
    main()

Solution (Python):
MAX_N = 10 ** 5 + 10
if __name__ == "__main__":
    N,M = map(int, input().split())
    deg = [0] * MAX_N
    for x in range(M):
        a,b = map(int, input().split())
        deg[a] += 1
        deg[b] += 1
    for x in range(MAX_N):
        if (deg[x] % 2 != 0):
            print ("NO")
            exit()
    print ("YES")

Solution (Python):
n, m = map(int, raw_input().strip().split())
ar = [0]*n
for _ in range(m):
	for v in map(int, raw_input().strip().split()):
		ar[v-1]+=1
answ = "YES"
for x in ar:
	if x % 2 != 0:
		answ = "NO"
		break
print answ

Solution (Python):
from collections import defaultdict

def unplanned_queries():
	n, m = map(int, raw_input().split(" "))
	a = []
	for i in range(m):
		a.append(map(int, raw_input().split(" ")))
	dic = defaultdict(int)
	for i in range(m):
		dic[a[i][0]] += 1
		dic[a[i][1]] += 1
	for key,value in dic.iteritems():
		if value%2!=0:
			print "NO"
			return
	print "YES"


if __name__ == "__main__":
	unplanned_queries()

Solution (Python):
n,m=map(int,input().split())
t=0
for i in range(m):
	u,v=map(int,input().split())
	t^=u^v
print("NO" if t else "YES")

Solution (Python):
n,m=map(int,input().split())
a=[0]*n
for i in range(m):
	u,v=map(int,input().split())
	a[u-1]^=1
	a[v-1]^=1
if sum(a):
	print("NO")
else:
	print("YES")

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

for x in frq:
   if x % 2 == 1:
      print "NO"
      exit(0)
print "YES"

Solution (Python):
N,M = map(int, raw_input().split())
hist = [0 for i in range(N)]
for i in range(M):
  a,b = map(int, raw_input().split())
  hist[a-1] += 1
  hist[b-1] += 1
for v in hist:
  if v%2 == 1:
    print 'NO'
    break
else : print 'YES'

Solution (Python):
n,m = map(int, input().split())
li = [0] * (n+1)

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

ans = 'YES' if all([x % 2 == 0 for x in li]) else 'NO'
print(ans)

Solution (Python):
N, M = map(int, raw_input().split())
Q = [map(int, raw_input().split()) for _ in range(M)]
 
cnt = [0 for _ in range(N)]
for a, b in Q:
    cnt[a-1] += 1
    cnt[b-1] += 1
 
for k in range(N):
    if cnt[k] % 2 != 0:
        print "NO"
        exit()
print "YES"

Solution (Python):
from collections import Counter
from itertools import chain

n, m = map(int, input().split())
c = Counter(chain.from_iterable(map(int, input().split()) for _ in range(m)))
print('NO' if any(i % 2 for i in c.values()) else 'YES')

Solution (Python):
from collections import Counter
N, M = map(int, input().split())
cnt = Counter()
for _ in range(M):
    a, b = map(int, input().split())
    cnt[a] += 1
    cnt[b] += 1
print("YES" if all(x % 2 == 0 for x in cnt.values()) else "NO")

Solution (Python):
import sys

def solve():
    N, M = map(int, input().split())

    ncnt = [0]*N

    for i in range(M):
        a, b = map(int, sys.stdin.readline().split())
        a, b = a-1, b-1

        ncnt[a] ^= 1
        ncnt[b] ^= 1

    print('NO' if any(ni for ni in ncnt) else 'YES')

if __name__ == '__main__':
    solve()

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

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

    for i in AB:
        if i % 2 > 0:
            print('NO')
            break
    else:
        print('YES')

main()

Solution (Python):
N, M = map(int, raw_input().split())
Q = [map(int, raw_input().split()) for _ in range(M)]

cnt = [0 for _ in range(N)]
for a, b in Q:
    cnt[a-1] += 1
    cnt[b-1] += 1

for k in range(N):
    if cnt[k] % 2 != 0:
        print "NO"
        exit()
print "YES"

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

for i in a:
    count[i-1] += 1
for i in b:
    count[i-1] += 1

if all([i%2==0 for i in count]):
    print("YES")
else:
    print("NO")

Solution (Python):
import sys

N,M=list(map(int, input().split()))
p=[]
for i in range(0,N):
  p.append(0)
for i in range(0,M):
  count=list(map(int, input().split()))
  p[count[0]-1]+=1
  p[count[1]-1]+=1
for i in range(0,M):
  if p[i]%2==1:
    print("NO")
    sys.exit()
print("YES")

Solution (Python):
if __name__ == '__main__':
	N, M=map(int, input().split())

	n=[]
	for j in range(N):
		n.append(0)

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

	flag = 0
	for i in range(N):
		if(n[i]%2==1):
			flag +=1

	if(flag<2):
		print('YES')
	else:
		print('NO')

Solution (Python):
n, m = map(int, input().split())
a = [list(map(int, input().split())) for x in range(m)]
field = [0 for x in range(n + 2)]
cfield = field[:]

for a1, a2 in a:
    field[a1] += 1
    field[a2] -= 1

for i in range(1, n):
    cfield[i] = field[i] + cfield[i - 1]
    if cfield[i] & 1:
        print("NO")
        break
else:
    print("YES")

Solution (Python):
from collections import Counter

n,m = map(int,input().split())
s = ""
for i in range(m):
    s = s + input()
counter = Counter(s)
for i in range(n+1):
    if counter[str(i)] % 2 != 0:
        print("NO")
        break
if i == n:
    print("YES")

Solution (Python):
import sys

def solve():
    N, M = map(int, input().split())

    ncnt = [0]*N

    for i in range(M):
        a, b = map(int, sys.stdin.readline().split())
        a -= 1
        b -= 1

        ncnt[a] += 1
        ncnt[b] += 1

    if all(ni & 1 == 0 for ni in ncnt):
        print('YES')
    else:
        print('NO')

if __name__ == '__main__':
    solve()

Solution (Python):
N,M = map(int,raw_input().split())
node_list = [0 for l in range(N)]
for i in range(M):
    items = map(int,raw_input().split())
    node_list[items[0]-1]+=1
    node_list[items[1]-1]+=1
flag=True
for i in range(N):
    if node_list[i]%2==1:
        flag=False


if flag:
    print 'YES'
else:
    print 'NO'

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

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

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

Solution (Python):
from collections import Counter

def main():
    n, q = map(int, input().split())
    c = Counter()
    for _ in range(q):
        u, v = map(int, input().split())
        c[u] += 1
        c[v] += 1

    safe = all(c[x] % 2 == 0 for x in c)
    print('YES' if safe else 'NO')

main()

Solution (Python):
N, M = list(map(int, input().split()))
ab = [list(map(int, input().split())) for i in range(M)]

count = [0 for i in range(N)]













for aibi in ab:
    ai = aibi[0]
    bi = aibi[1]
    if ai != 1 and bi != 1:
        count[ai - 1] += 1
        count[bi - 1] += 1
    else:
        if ai == 1:
            count[bi - 1] += 1
        else:
            count[ai - 1] += 1

yes_or_no = True
for num in count:
    if num % 2 == 1:
        yes_or_no = False

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

Solution (Python):


from collections import Counter

n, m = map(int, raw_input().split())
q = [flatten for i in range(0, m) for flatten in raw_input().split()]

counter = Counter(q)
for word, cnt in counter.most_common():
    if cnt % 2 != 0:
        print "NO"
        exit()

print "YES"

Solution (Python):
N, M = list(map(int, input().split()))
top = []
for i in range(N):
	top.append(0)
for i in range(M):
	a, b = list(map(int, input().split()))
	top[a - 1] += 1
	top[b - 1] += 1
judge = "YES"
for i in range(N):
	if top[i] % 2 == 1:
		judge = "NO"
		break
	else:
		pass
print(judge)

Solution (Python):
def main():
    n, m = [int(_) for _ in raw_input().split()]
    g = [[] for _ in xrange(n)]
    for i in xrange(m):
        a, b = [int(_) - 1 for _ in raw_input().split()]
        g[a].append(b)
        g[b].append(a)

    for i in xrange(n):
        while g[i]:
            j = g[i].pop()
            g[j].remove(i)
            while g[j]:
                k = g[j].pop()
                g[k].remove(j)
                j = k
                if i == j:
                    break
            else:
                return "NO"

    return "YES"

if __name__ == '__main__':
    print(main())

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

lis = [0 for i in range(N)]

for a_i,b_i in [ map(int,input().split()) for _ in range(M) ]:
	lis[a_i-1] += 1
	lis[b_i-1] += 1

for x in lis:
	if x%2==1:
		print("NO")
		quit()
print("YES")

Solution (Python):
from sys import stdin
from itertools import repeat
def main():
    n, m = map(int, stdin.readline().split())
    dat = map(int, stdin.read().split(), repeat(10, 2 * m))
    c = [0] * (n + 1)
    for x in dat:
        c[x] += 1
    f = 0
    for i in xrange(n + 1):
        if c[i] & 1:
            print "NO"
            return
    print "YES"
main()

Solution (Python):
N, M = map(int, input().split())
d = {}
for i in range(M):
	for i in [int(i) for i in input().split()]:
		if i not in d:
			d[i] = 1
		else:
			d[i] += 1
for i in d.values():
	if i%2:
		print("NO")
		break
else:
	print("YES")

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

res = 'YES'
for d in deg:
    if d % 2 == 1:
        res = 'NO'
print(res)

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

l = [0 for i in range(N)]

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

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

Solution (Python):



import numpy as np
N,M = map(int, input().split())

counter = np.zeros(N+1)
for m in range(M):
    a, b = map(int, input().split())
    counter[a] += 1
    counter[b] -= 1

cnt = 0
succ = True
for n in range(N+1):
    cnt += counter[n]
    if cnt % 2:
        succ = False
        break
if succ:
    print("YES")
else:
    print("NO")

Solution (Python):
n, m = map(int, input().split())
cnt = [0 for i in range(n+1)]
for i 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(n)]):
    print('YES')
else:
    print('NO')

Solution (Python):
N, M = map( int, input().split() )
imos = [ 0 for i in range( N + 1 ) ]
for i in range( M ):
  a, b = map( int, input().split() )
  imos[ a - 1 ] += 1
  imos[ b - 1 ] -= 1
for i in range( 1, N ):
  imos[ i ] += imos[ i - 1 ]
print( "NO" if any( imos[ i ] & 1 for i in range( N ) ) else "YES" )

Solution (Python):
n, m = map(int, raw_input().split())
deg = [0]*n
for i in xrange(m):
    a, b = map(int, raw_input().split())
    deg[a-1] += 1
    deg[b-1] += 1
print "YES"*all(d % 2 == 0 for d in deg)or"NO"

Solution (Python):



from random import *
from functools import reduce,partial
from time import time
from pprint import pprint

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

def identity(x):
    """Return the input itself."""
    return x

def constant(c):
    """Return an function which always
    returns the input constant c."""
    def const_function(const,*args):
        return const
    return partial(const_function,c)

def inc(c = 1):
    """Return a function which reads an input x and returns x + c as output.
    By default, c equals 1."""
    return lambda x: x + c

def add(*args):
    """Return the sum of the input."""
    def add2(x,y): return x + y
    return reduce(add2,args)

def mapv(f,*lst):
    """Return a vector of the result of map."""
    return list(map(f,*lst))

def vector(*args):
    """Return a vector of input parameters."""
    return args

def sequence(n,f = constant(0)):
    """Return a vector of length n, and initialize the i'th
    item with f(i).By default the vector will initialized with 0."""
    return [f(i) for i in range(0,n)]

def matrix(n,m,f = constant(0)):
    """Return a 2-dim vector which contains n vectors with length m.
    The j's item of vector i will be initialized by f(i,j).By default,
    the vector will be initialized with 0."""
    return [[f(i,j) for j in range(0,m)] for i in range(0,n)]

def flat(v):
    """Return a flat vector which contains the elements of v in their
    origin order.If the input is not a vector, return a vector which
    only contains the input."""
    if not isinstance(v,list): return [v]
    if not v: return []
    return reduce(add,mapv(flat,v))

def partition(v,f = identity):
    """Partition vector v by f(v[i]).
    e.g. partition([1,2,3,1,2,3],identity()) == {1:[1,1,1], 2:[2,2], 3:[3]}
    By default, the vector will be partitioned by identity function."""
    result = {}
    for item in v:
        key = f(item)
        s = result.get(key)
        if s:
            s.append(item)
        else:
            result.update({key:[item]})
    return result

def getValue(key):
    """Return a function which returns the value of key in a hash-map.
    If the key do not exist, it will throw an error."""
    return lambda x: x[key]

def mapValue(f,m):
    """Replace each value in hash-map m with f(value).
    Return the new hash-map."""
    res = {}
    for key in m:
        res.update({key: f(m[key])})
    return res

p = 1000000000 + 7

n,m = readln()
c = sequence(n)
for i in range(0,m):
    a,b = readln()
    c[a-1] += 1
    c[b-1] += 1
ans = 'YES'
for count in c:
    if count % 2 == 1:
        ans = 'NO'
print(ans)

Solution (Python):
N,M = map(int, raw_input().split())
C = [0]*N
for _ in range(M):
    a,b = map(int, raw_input().split())
    C[a-1] += 1
    C[b-1] += 1
ok = True
for c in C:
    if c%2!=0:
        ok = False
print "YES" if ok else "NO"

Solution (Python):
import math,string,itertools,fractions,heapq,collections,re,array,bisect,sys,random,time,copy,functools

sys.setrecursionlimit(10**7)
inf = 10**20
mod = 10**9 + 7

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


def main():
    n,m = LI()
    d = collections.defaultdict(int)
    for _ in range(m):
        a,b = LI()
        d[a] += 1
        d[b] += 1
    for c in d.values():
        if c % 2 == 1:
            return 'NO'
    return 'YES'


print(main())