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



Sample input:
4 4
1 2
2 4
1 3
3 4


Sample output:
YES

Submission status: Accepted

Solution code:
"""
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")

Submission status: Accepted

Solution code:
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')

Submission status: Accepted

Solution code:
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")

Submission status: Accepted

Solution code:
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')

Submission status: Accepted

Solution code:
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")

Submission status: Accepted

Solution code:
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')

Submission status: Accepted

Solution code:
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')

Submission status: Accepted

Solution code:
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")

Submission status: Accepted

Solution code:
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")

Submission status: Accepted

Solution code:
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')

Submission status: Accepted

Solution code:
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()

Submission status: Accepted

Solution code:
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')

Submission status: Accepted

Solution code:
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")

Submission status: Accepted

Solution code:
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")

Submission status: Accepted

Solution code:
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')

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-

#############
# Libraries #
#############

import sys
input = sys.stdin.readline

import math
#from math import gcd
import bisect
import heapq
from collections import defaultdict
from collections import deque
from collections import Counter
from functools import lru_cache


#############
# Constants #
#############

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

#############
# Functions #
#############

######INPUT######
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)]

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

#####Shorten#####
def DD(arg): return defaultdict(arg)


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

######Combination######
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

######Factorization######
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

#####MakeDivisors######
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

#####MakePrimes######
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

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

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

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

#####ChangeBase#####
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))))

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

#############
# Main Code #
#############
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")

Submission status: Accepted

Solution code:
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')

Submission status: Accepted

Solution code:
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')

Submission status: Accepted

Solution code:
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')

Submission status: Accepted

Solution code:
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")

Submission status: Accepted

Solution code:
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()

Submission status: Accepted

Solution code:
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')

Submission status: Accepted

Solution code:
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()

Submission status: Accepted

Solution code:
import math
import numpy as np
import queue
from collections import deque,defaultdict
import heapq as hpq
from sys import stdin,setrecursionlimit
#from scipy.sparse.csgraph import dijkstra
#from scipy.sparse import csr_matrix
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()

Submission status: Accepted

Solution code:
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")

Submission status: Accepted

Solution code:
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')

Submission status: Accepted

Solution code:
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'

# main()
print(main())

Submission status: Accepted

Solution code:
# https://atcoder.jp/contests/agc014/tasks/agc014_b

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

Submission status: Accepted

Solution code:
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)

Submission status: Accepted

Solution code:
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)

Submission status: Accepted

Solution code:
import sys

# import re
import math
import collections
# import decimal
import bisect
import itertools
import fractions
# import functools
import copy
import heapq
import decimal
# import statistics
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()))


# ===CODE===


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

Submission status: Accepted

Solution code:
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')

Submission status: Accepted

Solution code:
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")

Submission status: Accepted

Solution code:
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()

Submission status: Accepted

Solution code:
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')

Submission status: Accepted

Solution code:
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')

Submission status: Accepted

Solution code:
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')

Submission status: Accepted

Solution code:
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")

Submission status: Accepted

Solution code:
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")

Submission status: Accepted

Solution code:
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()

Submission status: Accepted

Solution code:
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()

Submission status: Accepted

Solution code:
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()

Submission status: Accepted

Solution code:
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()

Submission status: Accepted

Solution code:
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")

Submission status: Accepted

Solution code:
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")

Submission status: Accepted

Solution code:
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")

Submission status: Accepted

Solution code:
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)

Submission status: Accepted

Solution code:
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()

Submission status: Accepted

Solution code:
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")

Submission status: Accepted

Solution code:
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")

Submission status: Accepted

Solution code:
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")

Submission status: Accepted

Solution code:
def main():
    N, M = map( int, input().split())
    AB = [ tuple( map( int, input().split())) for _ in range(M)]
    V = [0]*(N+1)
    for a, b in AB:
        V[a] += 1
        V[b] += 1
    for v in V:
        if v%2 == 1:
            print("NO")
            return
    print("YES")
        
if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
import sys
def input(): return sys.stdin.readline().rstrip()
from collections import Counter
def main():
    n,m=map(int,input().split())
    AB=[]
    for i in range(m):
        a,b=map(int,input().split())
        AB.append(a)
        AB.append(b)
    abc=list(Counter(AB).values())
    print("YES" if all(x%2==0 for x in abc) else "NO")


if __name__=='__main__':
    main()

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N, M = map(int, input().split(' '))
count = [0 for _ in range(N)]

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

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

Submission status: Accepted

Solution code:
from collections import Counter

N, M = map(int, input().split())
X = [list(map(int, input().split())) for _ in range(M)]

ctr = Counter()
for a, b in X:
    ctr[a] += 1
    ctr[b] += 1

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

Submission status: Accepted

Solution code:
n, m = map(int,input().split())
num = [0 for i in range(n)]

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

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

print("YES")

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
n,m=map(int,input().split())
che=[0]*n
for i in range(m):
    a,b=map(int,input().split())
    che[a-1] += 1
    che[b-1] += 1
    
error=0
for i in range(n):
    if che[i]%2!=0:
        error += 1

if error==0:
    print('YES')
else:
    print('NO')

Submission status: Accepted

Solution code:
from collections import Counter
n,m = map(int,input().split())
ab_input = [int(j) for i in range(m) for j in input().split()]

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

Submission status: Accepted

Solution code:
import sys
input = sys.stdin.readline
def main():
  n,m=map(int,input().split())
  ab=[list(map(int,input().split())) for _ in range(m)]
  c=[0]*n
  for a,b in ab:
    c[a-1]+=1
    c[b-1]+=1
  print('NO' if len([ci for ci in c if ci%2==1])>0 else 'YES')
if __name__=='__main__':
  main()

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
sys.setrecursionlimit(10 ** 7)

n, m = map(int, readline().split())
check = [0] * (n + 1)
for i in range(m):
    a, b = map(int, readline().split())
    check[a] += 1
    check[b] += 1
for v in check:
    if v % 2 == 1:
        print('NO')
        break
else:
    print('YES')

Submission status: Accepted

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

flag = False

for i in ab:
    if i%2 == 1:
        flag = True
        break

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

Submission status: Accepted

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

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

print("YES" if all(c[i]%2 == 0 for i in range(N+1)) else "NO")

Submission status: Accepted

Solution code:
import sys

input = sys.stdin.readline


def main():
    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

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


if __name__ == "__main__":
    main()

Submission status: Accepted

Solution code:
import sys

input = sys.stdin.readline


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

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


if __name__ == "__main__":
    main()

Submission status: Accepted

Solution code:
import sys

input = sys.stdin.readline


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

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


if __name__ == "__main__":
    main()

Submission status: Accepted

Solution code:
import sys

sys.setrecursionlimit(10 ** 7)
f_inf = float('inf')
mod = 10 ** 9 + 7


def resolve():
    n, m = map(int, input().split())

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

    for i in cnt:
        if i % 2:
            print("NO")
            break
    else:
        print("YES")


if __name__ == '__main__':
    resolve()

Submission status: Accepted

Solution code:

n,m = list(map(int, input().split()))
times = [0 for i in range(n)]
for i in range(m):
    t = list(map(int, input().split()))
    times[t[0]-1]+=1
    times[t[1]-1]+=1

ans = 1
for i in range(n):
    ans *= (times[i]+1)%2
    
if(ans==1):
    print("YES")
else:
    print("NO")