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())

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):
import sys
n,m=map(int,input().split())
ctl=[0]*n
for i in range(m):
  a,b=map(int,input().split())
  ctl[a-1]+=1
  ctl[b-1]+=1
for i in range(n):
  if ctl[i]%2==1:
    print('NO')
    sys.exit()
print('YES')

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

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

from collections import Counter
l=[]
for _ in range(m):
    l+=list(map(int,input().split()))

c=Counter(l)
print("YES" if all(v%2==0 for v in c.values()) else "NO")

Solution (Python):
from collections import defaultdict

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

if all([i % 2 == 0 for i in d.values()]):
    print('YES')
else:
    print('NO')

Solution (Python):
n,m=map(int,input().split())
lists=[0 for i in range(m)]
for i in range(m):
    x,y=map(int,input().split())
    lists[i]=(x,y)
anslist=[0 for i in range(n+1)]


for j in lists:
    if j[0]==1:
        anslist[j[1]]+=1
        
    elif j[1]==1:
        anslist[j[0]]+=1
        
    else:
        x=j[0]
        y=j[1]
        anslist[x]+=1
        anslist[y]+=1
flag=True
for k in anslist:
    if k%2!=0:
        flag=False
        break
if flag:
    print("YES")
else:
    print("NO")

Solution (Python):
from collections import Counter

N, M = map(int, input().split())
li = []
for _ in range(M):
  a, b = map(int, input().split())
  li.append(a)
  li.append(b)
  
cli = Counter(li)
if all([v % 2 == 0 for i, v in cli.items()]):
  print("YES")
else:
  print("NO")

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

Solution (Python):
import sys
from collections import Counter
ct = Counter()
n, m = [int(i) for i in sys.stdin.readline().split()]
for i in range(m):
    a, b = [int(i) for i in sys.stdin.readline().split()]
    ct.update([a, b])
if all([c % 2 == 0 for c in ct.values()]):
    print("YES")
else:
    print("NO")

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

N, M = map(int, input().split())
dic = {}
for _ in range(M):
    a, b = map(int, input().split())
    if not a in dic.keys():
        dic[a] = 1
    else:
        dic[a] += 1
    if not b in dic.keys():
        dic[b] = 1
    else:
        dic[b] += 1

ok = True
for l in dic.values():
    if l % 2 != 0:
        ok = False

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

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

flag = True
for i in range(n + 1):
    if c[i] % 2 == 1:
        flag = False
        break

if flag:
    ans = 'YES'
else:
    ans = 'NO'

print(ans)

Solution (Python):
from collections import Counter
N, M = map(int, input().split())
node = []
for i in range(M):
    a, b = map(int, input().split())
    a, b = a-1, b-1
    node.append(a)
    node.append(b)
C = Counter(node)
ret = 'YES'
for c in C.values():
    if c % 2 == 1:
        ret = 'NO'
        break
print(ret)

Solution (Python):
import sys

input = sys.stdin.readline

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

sel = [0] * N

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

ans = "YES"
for j in range(N):
    if sel[j] % 2 == 1:
        ans = "NO"

print(ans)

Solution (Python):
import collections
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())
table = collections.defaultdict(int)

for i in range(M):
    table[a[i]] += 1
    table[b[i]] += 1

odd = []
for x in table:
    if table[x] % 2 == 1:
        odd.append(x)

if len(odd) > 0:
    print("NO")
else:
    print("YES")

Solution (Python):


n,m=map(int,input().split())
res=[0]*n

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

for e in res:
    if e%2:
        print('NO')
        exit()
else:
    print('YES')

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

G = [[] for i in range(N)]

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

ans = "NO" if any(len(g)%2 for g in G) else "YES"

print(ans)

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

G = [[] for i in range(N)]

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

for i in range(N) :
    if len(G[i]) % 2 != 0 :
        ans = "NO"
        break
else :
    ans = "YES"

print(ans)

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

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

if __name__ == '__main__':
    main()

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

flag = True
for i in range(N):

    if lis[i] % 2 == 1:
        flag = False
        break

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

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

Solution (Python):



def main():
    n, m = map(int, input().split())
    c = [0 for _ in range(n)]

    
    
    
    
    
    
    
    for i in range(m):
        ai, bi = map(int, input().split())
        
        ai -= 1
        bi -= 1
        c[ai] += 1
        c[bi] += 1

    for ci in c:
        if ci % 2 == 1:
            print('NO')
            exit()

    print('YES')


if __name__ == '__main__':
    main()

Solution (Python):



def main():
    n, m = map(int, input().split())
    a = [0 for _ in range(n)]
    b = [0 for _ in range(n)]

    
    for i in range(m):
        ai, bi = map(int, input().split())
        
        ai -= 1
        bi -= 1

        if ai == 0:
            a[bi] += 1
        elif bi == 0:
            b[ai] += 1
        else:
            a[bi] += 1
            b[ai] += 1

    for ai, bi in zip(a, b):
        if (ai + bi) % 2 == 1:
            print('NO')
            exit()

    print('YES')


if __name__ == '__main__':
    main()

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

V = {}
v = [0,0]
for v[0],v[1] in AB:
  for i in range(2):
    if v[i] in V:
      V[v[i]] += 1
    else:
      V[v[i]] = 1
for val in V.values():
  if val % 2 == 1:
    print('NO')
    exit()
print('YES')

Solution (Python):
n,m = map(int, input().split())
d = {}
for i in range(m):
    for j in map(int, input().split()):
        d[j] = d.get(j, 0) + 1

if any(i%2 for i in d.values()):
    print("NO")
else:
    print("YES")

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

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

for value in Counter(lis).values():
    if value % 2 != 0:
        print('NO')
        sys.exit()
print('YES')

Solution (Python):
import sys
input = sys.stdin.readline
def main():
    N,M = map(int,input().split())
    pos = [0 for _ in range(N)]
    for i in range(M):
        a,b = map(int,input().split())
        pos[a-1] += 1
        pos[b-1] += 1

    for i in range(N):
        if pos[i]%2 != 0:
            print("NO")
            exit()

    print("YES")

if __name__ == "__main__":
    main()

Solution (Python):


import sys
from collections import Counter

def input(): return sys.stdin.readline().strip()
def list2d(a, b, c): return [[c] * b for i in range(a)]
def list3d(a, b, c, d): return [[[d] * c for j in range(b)] for i in range(a)]
def list4d(a, b, c, d, e): return [[[[e] * d for j in range(c)] for j in range(b)] for i in range(a)]
def ceil(x, y=1): return int(-(-x // y))
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(N=None): return list(MAP()) if N is None else [INT() for i in range(N)]
def Yes(): print('Yes')
def No(): print('No')
def YES(): print('YES')
def NO(): print('NO')
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
MOD = 10 ** 9 + 7

N, M = MAP()
C = Counter()
for i in range(M):
    a, b = MAP()
    C[a] += 1
    C[b] += 1

for k, v in C.items():
    if v%2 == 1:
        NO()
        exit()
YES()

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

counter = {}
for i in range(1, N+1):
    counter.setdefault(i, 0)

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

for num in counter.values():
    if num % 2 == 1:
        print('NO')
        exit()

print('YES')

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

l = [0]*n 

for _ in range(m):
    a,b = map(int,input().split())
    a,b = min(a,b),max(a,b)
    l[a-1] += 1
    l[b-1] += -1

for i in range(1,n):
    l[i] += l[i-1]

if all(x%2 == 0 for x in l):
    print('YES')
else:
    print('NO')

Solution (Python):
N,M = map(int,input().split())
node = [] 
dic = {}
for _ in range(M):
  a,b = map(int,input().split())
  dic[a] = dic.get(a,0) + 1
  dic[b] = dic.get(b,0) + 1
for k in dic:
  if dic[k]%2==1:
    print("NO")
    break
else:
  print("YES")

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

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

counter = [0] * N

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

flag = True
for i in range(len(counter)):
    if counter[i] % 2 != 0:
        flag = False


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

Solution (Python):
def main():
    import sys
    input = sys.stdin.readline
    N, M = map(int, input().split())
    C = [0]*(N+1)
    for i in range(M):
        a, b = map(int, input().split())
        C[a]+=1
        C[b]+=1
    for i in range(N+1):
        if C[i] % 2 == 1:
            return "NO"
    return "YES"

print(main())

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

flag = 1
for i in num:
    if i % 2 != 0:
        flag = 0

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

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

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

if all(x % 2 == 0 for x in e):
    print('YES')
else:
    print('NO')

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

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

Solution (Python):



import sys
import math
from bisect import bisect_right as br
from bisect import bisect_left as bl
sys.setrecursionlimit(1000000000)
from heapq import heappush, heappop,heappushpop
from collections import defaultdict
from itertools import accumulate
from collections import Counter
from collections import deque
from operator import itemgetter
from itertools import permutations
mod = 10**9 + 7
inf = float('inf')
def I(): return int(sys.stdin.readline())
def LI(): return list(map(int,sys.stdin.readline().split()))

n,m = LI()
cnt = [0]*n
for _ in range(m):
    a,b = LI()
    cnt[a-1] += 1
    cnt[b-1] += 1
for i in range(n):
    if cnt[i] % 2:
        print('NO')
        quit()
print('YES')

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

Solution (Python):
from collections import Counter

N, M, *AB = map(int, open(0).read().split())

C = Counter(AB)
if any(c % 2 == 1 for c in C.values()):
    print("NO")
else:
    print("YES")

Solution (Python):
from collections import Counter

N, M, *AB = map(int, open(0).read().split())
C = Counter(AB)
if all(c % 2 == 0 for c in C.values()):
    print("YES")
else:
    print("NO")

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

Solution (Python):

from collections import defaultdict,deque
from heapq import heappush, heappop
import sys
import math
import bisect
import random
def LI(): return [int(x) for x in sys.stdin.readline().split()]
def I(): return int(sys.stdin.readline())
def LS():return [list(x) for x in sys.stdin.readline().split()]
def S():
    res = list(sys.stdin.readline())
    if res[-1] == "\n":
        return res[:-1]
    return res
def IR(n):
    return [I() for i in range(n)]
def LIR(n):
    return [LI() for i in range(n)]
def SR(n):
    return [S() for i in range(n)]
def LSR(n):
    return [LS() for i in range(n)]

sys.setrecursionlimit(1000000)
mod = 1000000007


def A():
    def f(n):
        return ((1<<n)-(1-2*(n&1)))//3
    def k(x,n):
        return f(n)*s+(1-2*(n&1))*x
    a = LI()
    if a[0]%2 or a[1]%2 or a[2]%2:
        print(0)
        return
    if a[0] == a[1] == a[2]:
        print(-1)
        return
    s = sum(a)
    ans = 10**5
    for i in range(3):
        l = 0
        r = 10**5+1
        while r-l > 1:
            m = (l+r)>>1
            ka = k(a[i],m)
            if ka&((1<<m)-1) == 0:
                l = m
            else:
                r = m
        ans = min(ans, l)
    print(ans)
    return

def B():
    n,m = LI()
    f = [0]*n
    for i in range(m):
        a,b = LI()
        f[a-1] ^= 1
        f[b-1] ^= 1
    if all([not f[i]%2 for i in range(n)]):
        print("YES")
    else:
        print("NO")
    return


def C():

    return


def D():

    return


def E():

    return


def F():

    return


if __name__ == "__main__":
    B()

Solution (Python):
n, m = map(int, input().split())
info = [list(map(int, input().split())) for i in range(m)]

memo = {}
for i in range(m):
    if info[i][0] not in memo:
        memo[info[i][0]] = 1
    else:
        memo[info[i][0]] += 1
    if info[i][1] not in memo:
        memo[info[i][1]] = 1
    else:
        memo[info[i][1]] += 1
for i in memo:
    if memo[i] % 2 == 1:
        print("NO")
        exit()
print("YES")

Solution (Python):
n, m = map(int, input().split())
info = [list(map(int, input().split())) for i in range(m)]

memo = {}
for i in range(m):
    if info[i][0] not in memo:
        memo[info[i][0]] = 1
    else:
        memo[info[i][0]] += 1
    if info[i][1] not in memo:
        memo[info[i][1]] = 1
    else:
        memo[info[i][1]] += 1
for i in memo:
    if memo[i] % 2 == 1:
        print("NO")
        exit()
print("YES")

Solution (Python):
n,m=map(int,input().split())
cnt=[]
for i in range(n):
  cnt.append(0)
for i 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 Counter


def main():
    
    *A, = map(int, open(0).read().split())
    T = Counter(A[2:]).values()
    flg = any(i % 2 for i in T)
    print("NO" if flg else "YES")


if __name__ == "__main__":
    main()

Solution (Python):

from collections import Counter


def main():
    *A, = map(int, open(0).read().split())
    T = Counter(A[2:]).values()
    flg = all(i % 2 == 0 for i in T)
    print("YES" if flg else "NO")


if __name__ == "__main__":
    main()

Solution (Python):

from collections import Counter


def main():
    N, _, *A = map(int, open(0).read().split())
    T = Counter(A).values()
    flg = all(i % 2 == 0 for i in T)
    print("YES" if flg else "NO")


if __name__ == "__main__":
    main()

Solution (Python):

def main():
    N, _, *A = map(int, open(0).read().split())
    T = [0] * (N + 1)
    for i in A:
        T[i] += 1
    flg = all(i % 2 == 0 for i in T)
    print("YES" if flg else "NO")


if __name__ == "__main__":
    main()

Solution (Python):
import collections

N, M = map(int,input().split())
A = [0] * M
B = [0] * M
for i in range(M):
    A[i], B[i] = input().split()
C = A + B
D = collections.Counter(C)
for i in D:
    if D[i] % 2 == 0:
        continue
    else:
        print('NO')
        exit()
print('YES')

Solution (Python):
import sys
import heapq
from operator import itemgetter
from collections import deque, defaultdict
from bisect import bisect_left, bisect_right
input = sys.stdin.readline
sys.setrecursionlimit(10 ** 7)
MOD = 10**9 + 7

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

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

    for edge in edges:
        if len(edge) % 2 == 1:
            print('NO')
            return

    print('YES')


sol()

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

if sum(d) == 0:
    print("YES")
else:
    print("NO")

Solution (Python):
n,_,*l=map(int,open(0).read().split())
c=[0]*-~n
for a,b in zip(l[::2],l[1::2]):
	c[a]^=1;c[b]^=1
print("YNEOS"[any(i for i in c)::2])

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 i:
		print("NO")
		exit()
print("YES")

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

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

AB = [[int(x) for x in input().split()] for _ in range(M)]



counter = [0] * (N+1)
for x,y in AB:
    counter[x] += 1
    counter[y] += 1

answer = 'NO' if any(x&1 for x in counter) else 'YES'
print(answer)

Solution (Python):
N,M=map(int,input().split())
edge=[list(map(int,input().split())) for i in range(M)]
c=[[] for i in range(N)]
for i,j in edge:
    c[i-1].append(j-1)
    c[j-1].append(i-1)
print(['NO','YES'][all([len(ci)%2==0 for ci in c])])

Solution (Python):
def main():
    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")
            return
    print("YES")


if __name__ == "__main__":
    main()

Solution (Python):
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
ans = 'YES'
for i in range(1, N+1):
    if count[i] % 2 == 1:
        ans = 'NO'
        break
print(ans)

Solution (Python):
N, M = map(int, input().split())
cnt = [True]*N
for _ in range(M):
    a, b = map(int, input().split())
    cnt[a-1] = not cnt[a-1]; cnt[b-1] = not cnt[b-1];
print('YES' if all(cnt) else 'NO')

Solution (Python):
N, M = map(int, input().split())
paths = [tuple(map(int, input().split())) for _ in range(M)]
e_vals = [0]*(N+1)
for u, v in paths:
    if u > v: u, v = v, u
    e_vals[u] += 1; e_vals[v] -= 1;
for i in range(1, N+1):
    e_vals[i] += e_vals[i-1]
    if e_vals[i] % 2 == 1: print('NO'); break;
else: print('YES')

Solution (Python):
n,m=map(int,input().split())
g=[[] for _ in range(n+1)]
for _ in range(m):
  u,v=map(int,input().split())
  g[u].append(v)
  g[v].append(u)
flag=True
for i in range(1,n+1):
  if len(g[i])%2==0:
    continue
  else:
    flag=False
    break
if flag==True:
  print('YES')
else:
  print('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 _ in range(N+1):
    if L[_]%2==1:
        print("NO")
        exit()
print("YES")

Solution (Python):
N, M = map(int, input().split())
counts = {}
for i in range(M):
    a, b = map(int, input().split())
    if a not in counts:
        counts[a] = 1
    else:
        counts[a] += 1
    
    if b not in counts:
        counts[b] = 1
    else:
        counts[b] += 1
        
yes = True
for val in counts.values():
    if val % 2 != 0:
        yes = False
        break
        
if yes:
    print("YES")
else:
    print("NO")

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

Solution (Python):
N,M=map(int,input().split())
from collections import defaultdict
cnt=defaultdict(int)
for i 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):
def main():
    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")
            return
    print("YES")


if __name__ == "__main__":
    main()

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

Solution (Python):
from collections import Counter
n, m = [int(item) for item in input().split()]
cnt = Counter()
for i in range(m):
  a, b = [int(item) for item in input().split()]
  cnt[a] += 1
  cnt[b] += 1
  
for key in cnt.keys():
  if cnt[key] % 2 != 0:
    print("NO")
    exit()
print("YES")

Solution (Python):
N, M = [int(_) for _ in input().split()]
AB = [[int(_) for _ in input().split()] for _ in range(M)]
nodes = [0] * (N + 1)
for a, b in AB:
    nodes[a] += 1
    nodes[b] += 1
for x in nodes:
    if x % 2:
        print('NO')
        exit()
print('YES')

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

Solution (Python):
import collections
import sys
input = sys.stdin.readline
n,m=map(int,input().split())
A=[]
for i in range(m):
  a,b=map(int,input().split())
  A.append(a)
  A.append(b)
c=collections.Counter(A)
flag=1
for a in c.keys():
  if c[a]%2==1:
    flag=0
print("YES" if flag==1 else "NO")

Solution (Python):
import sys

from collections import deque, defaultdict, Counter; from heapq import heappush, heappop



sys.setrecursionlimit(10 ** 7)


"""for dx, dy in dd:
        nx = j + dx; ny = i + dy
            if 0 <= nx < w and 0 <= ny < h:"""
def wi(): return list(map(int, sys.stdin.readline().split()))
def wip(): return [int(x) - 1 for x in sys.stdin.readline().split()]
def ws(): return sys.stdin.readline().split()
def i(): return int(sys.stdin.readline())
def s(): return input()
def hi(n): return [i() for _ in range(n)]
def hs(n): return [s() for _ in range(n)]
def mi(n): return [wi() for _ in range(n)]
def mip(n): return [wip() for _ in range(n)]
def ms(n): return [ws() for _ in range(n)]

n, m = wi()
ab = mi(m)

point = [0 for i in range(n + 1)]

for i in range(m):
    point[ab[i][0]] += 1
    point[ab[i][1]] += 1

print("YES" if all(i % 2 == 0 for i in point) else "NO")

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

qd = {}
for _ in range(m):
  a, b = map(int, input().split())
  if a not in qd:
    qd[a] = 1
  else:
    qd[a] += 1
  if b not in qd:
    qd[b] = 1
  else:
    qd[b] += 1

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

Solution (Python):
from collections import*;print('YNEOS'[any(i%2for i in Counter(open(0).read().split()[2:]).values())::2])

Solution (Python):
n,m = map(int, input().split())
d = dict()
for i in range(1,n+1):
  d[i] = 0
for _ in range(m):
  a = map(int, input().split())
  for x in a:
    d[x] += 1
    d[x] %= 2
if any(d.values()):
  print("NO")
else:
  print("YES")

Solution (Python):
N,M=map(int,input().split())
import collections
e =[]
for i in range(M):
    ta,tb =map(int,input().split())
    e.extend([ta,tb])
c = collections.Counter(e)

ans = "YES"
for i in c:
    if c[i]%2 != 0:
        ans = "NO"
print(ans)

Solution (Python):

N, M = map(int, input().split())
A, B = zip(*(map(int, input().split()) for _ in range(M)))


dp = [0 for _ in range(N + 1)]
for a, b in zip(A, B):
    dp[a] += 1
    dp[b] += 1


ans = 'YES' if all(dp[i] % 2 == 0 for i in range(1, N + 1)) else 'NO'


print(ans)

Solution (Python):

import sys
sys.setrecursionlimit(10**9)
input = sys.stdin.readline
N, M = map(int, input().split())
node = [0]*(N)
for _ in range(M):
    a, b = map(lambda x: int(x)-1, input().split())
    node[a] ^= 1
    node[b] ^= 1

if any(node):
    print("NO")
else:
    print("YES")

Solution (Python):

import sys
sys.setrecursionlimit(10**9)
input = sys.stdin.readline
N, M = map(int, input().split())
node = [0]*(N+1)
for _ in range(M):
    a, b = map(lambda x: int(x)-1, input().split())
    node[a] += 1
    node[b] += 1

if all(x % 2 == 0 for x in node):
    print("YES")
else:
    print("NO")

Solution (Python):
N,M = map(int,input().split())
K = [0]*(10**5)
for i in range(M):
  P,Q = map(int,input().split())
  K[P-1] += 1
  K[Q-1] += 1
flag = True
for i in range(10**5):
  if K[i]%2 != 0:
    flag = False
    break
if flag:
  print('YES')
else:
  print('NO')

Solution (Python):
N,M = map(int,input().split())
L = []
for i in range(M):
  L.append(list(map(int,input().split())))
K = [0]*(10**5)
for i in range(M):
  for j in range(2):
    K[L[i][j]-1] += 1
flag = True
for i in range(10**5):
  if K[i]%2 != 0:
    flag = False
    break
if flag:
  print('YES')
else:
  print('NO')

Solution (Python):
def solve():
  n,m = (int(i) for i in input().split())
  a = [0]*n
  for i in range(m):
    a1,b1 = (int(i) for i in input().split())
    a[a1-1]+=1
    a[b1-1]+=1
  ans = 'YES'
  for i in range(n):
   if a[i]%2 == 1:
    ans ='NO'
  return ans
                   
  
if __name__ == '__main__':
  print(solve())

Solution (Python):
import sys
input=sys.stdin.readline
sys.setrecursionlimit(10**9)
n,m=map(int,input().split())
A=[0]*n
for _ in range(m):
    a,b=map(int,input().split())
    a-=1
    b-=1
    A[a]^=1
    A[b]^=1
print('NO' if any(A) else 'YES')

Solution (Python):
l=[0]*2**17
for i in open(0).read().split()[2:]:l[int(i)]+=1
print('YNEOS'[any(i%2for i in l)::2])

Solution (Python):
l=[0]*2**17
for i in open(0).read().split()[2:]:l[int(i)]+=1
print('YNEOS'[any(i%2for i in l)::2])

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

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

for i in range(M):
    if q[i]%2 != 0:
        print('NO')
        exit()

print('YES')

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

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

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

for i in count:
    if i % 2 == 1:
        print("NO")
        exit()

print("YES")

Solution (Python):
N, M = map(int, input().split())
X = [0] * (10 ** 5)

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

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

Solution (Python):
N, M = (int(i) for i in input().split())
DP = [False]*N
for i in range(M):
  a, b = (int(k) for k in input().split())
  for j in (a, b):
    DP[j-1] = not DP[j-1]
for i in range(N):
  if DP[i]:
    print('NO')
    break
else:
  print('YES')

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

Solution (Python):
N, M = map(int, input().split())
Path = [0 for i in range(N)]
for _ in range(M):
    a, b = map(int, input().split())
    a, b = min(a, b), max(a, b)
    Path[b-1] += 1
    if a > 1:
        Path[a-1] += 1

for p in Path:
    if p % 2 != 0:
        print("NO")
        break
else: print("YES")

Solution (Python):
import sys
n, m = map(int, sys.stdin.readline().split(' '))
mlt = [0] * n
for i in range(m):
    b, c = map(int, sys.stdin.readline().split(' '))
    b -= 1
    c -= 1
    mlt[b] += 1
    mlt[c] += 1
flag = False
for i in range(n):
    if mlt[i] & 1:
        flag = True
        break
if not flag:
    print("YES")
else:
    print("NO")

Solution (Python):
import sys
n, m = map(int, sys.stdin.readline().split(' '))
a = [0] * (2 * m)
for i in range(m):
    a[2 * i], a[2 * i + 1] = map(int, sys.stdin.readline().split(' '))
a.sort()
flag = False
tmp = 0
crr = 0
for i in range(2 * m):
    nxt = a[i]
    if crr == nxt:
        tmp += 1
    else:
        if tmp & 1:
            flag = True
            break
        tmp = 1
    crr = nxt
if not flag:
    print("YES")
else:
    print("NO")

Solution (Python):
def i1():
 return int(input())
def i2():
 return [int(i) for i in input().split()]
[n,m]=i2()
e=[0 for i in range(n+1)]
for i in range(m):
 [a,b]=i2()
 e[a]+=1
 e[b]+=1
s="YES"
for i in range(1,n+1):
 if e[i]%2==1:
   s="NO"
print(s)