Buggy python submission (verdict: Time Limit Exceeded):

n,m = list(map(int,input().split()))
d = [0]*m
ma = 0
mi = 0
for i in range(m):
    a,b = list(map(int,input().split()))
    d[i] = ((1<<a)-1) ^ ((1<<b)-1)
    ma = max(ma,a,b)
    mi = min(mi,a,b)
s = ((1<<ma)-1) | ((1<<mi)-1) 
for bit in range(1<<n):
    if bit & s:
      spr = [True]*m
      for k in range(m):
        if (d[k] & bit) > 0:
          spr[k] = False
      if sum(spr) == 0:
        print(sum([1 for i in range(n) if bit & 1<<i]))
        exit()


Fixed submission:

n,m = list(map(int,input().split()))
d = [0]*m
spr = [True]*m
ma = 0
mi = 0
for i in range(m):
    a,b = list(map(int,input().split()))
    d[i] = [a,b]

d = sorted(d)
pre = d[0][1]
ans = 1
for i,(a,b) in enumerate(d):
  if a < pre:
    if b < pre:
      pre = b
  else:
    ans += 1
    pre = b

print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
def main():
  n,m = list(map(int,input().split()))
  d = [0]*m
  ma = 0
  mi = 0
  for i in range(m):
    a,b = list(map(int,input().split()))
    d[i] = ((1<<a)-1) ^ ((1<<b)-1)
    ma = max(ma,a,b)
    mi = min(mi,a,b)
  s = ((1<<ma)-1) | ((1<<mi)-1) 
  for bit in range(1<<n):
    if bit & s:
      spr = [True]*m
      for k in range(m):
        if (d[k] & bit) > 0:
          spr[k] = False
      if sum(spr) == 0:
        print(sum([1 for i in range(n) if bit & 1<<i]))
        exit()

main()


Fixed submission:

n,m = list(map(int,input().split()))
d = [0]*m
spr = [True]*m
ma = 0
mi = 0
for i in range(m):
    a,b = list(map(int,input().split()))
    d[i] = [a,b]

d = sorted(d)
pre = d[0][1]
ans = 1
for i,(a,b) in enumerate(d):
  if a < pre:
    if b < pre:
      pre = b
  else:
    ans += 1
    pre = b

print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
def main():
  n,m = list(map(int,input().split()))
  d = []
  ma = 0
  mi = 0
  for i in range(m):
    a,b = list(map(int,input().split()))
    d.append( ((1<<a)-1) ^ ((1<<b)-1) )
    ma = max(ma,a,b)
    mi = min(mi,a,b)
  s = ((1<<ma)-1) | ((1<<mi)-1) 
  for bit in range(1<<n):
    if bit & s:
      spr = [True]*m
      for k in range(m):
        if (d[k] & bit) > 0:
          spr[k] = False
      if sum(spr) == 0:
        print(sum([1 for i in range(n) if bit & 1<<i]))
        exit()

main()


Fixed submission:

n,m = list(map(int,input().split()))
d = [0]*m
spr = [True]*m
ma = 0
mi = 0
for i in range(m):
    a,b = list(map(int,input().split()))
    d[i] = [a,b]

d = sorted(d)
pre = d[0][1]
ans = 1
for i,(a,b) in enumerate(d):
  if a < pre:
    if b < pre:
      pre = b
  else:
    ans += 1
    pre = b

print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
n,m = list(map(int,input().split()))
d = []
ma = 0
mi = 0
for i in range(m):
  a,b = list(map(int,input().split()))
  d.append( ((1<<a)-1) ^ ((1<<b)-1) )
  ma = max(ma,a,b)
  mi = min(mi,a,b)
s = ((1<<ma)-1) | ((1<<mi)-1) 
for bit in range(1<<n):
  if bit & s:
    spr = [True]*m
    for k in range(m):
      if (d[k] & bit) > 0:
        spr[k] = False
    if sum(spr) == 0:
      print(sum([1 for i in range(n) if bit & 1<<i]))
      exit()


Fixed submission:

n,m = list(map(int,input().split()))
d = [0]*m
spr = [True]*m
ma = 0
mi = 0
for i in range(m):
    a,b = list(map(int,input().split()))
    d[i] = [a,b]

d = sorted(d)
pre = d[0][1]
ans = 1
for i,(a,b) in enumerate(d):
  if a < pre:
    if b < pre:
      pre = b
  else:
    ans += 1
    pre = b

print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
n,m = list(map(int,input().split()))
d = []
for i in range(m):
  a,b = list(map(int,input().split()))
  d.append( ((1<<a)-1) ^ ((1<<b)-1) )

for bit in range(1<<n):
    spr = [True]*m
    for k in range(m):
      if (d[k] & bit) > 0:
        spr[k] = False
    if sum(spr) == 0:
      print(sum([1 for i in range(n) if bit & 1<<i]))
      exit()


Fixed submission:

n,m = list(map(int,input().split()))
d = [0]*m
spr = [True]*m
ma = 0
mi = 0
for i in range(m):
    a,b = list(map(int,input().split()))
    d[i] = [a,b]

d = sorted(d)
pre = d[0][1]
ans = 1
for i,(a,b) in enumerate(d):
  if a < pre:
    if b < pre:
      pre = b
  else:
    ans += 1
    pre = b

print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
n,m = list(map(int,input().split()))
d = []
s = 1<<0
for i in range(m):
  a,b = list(map(int,input().split()))
  d.append( ((1<<a)-1) ^ ((1<<b)-1) )

ans = float('inf')
for bit in range(1<<n):
    spr = [True]*m
    for k in range(m):
      if (d[k] & bit) > 0:
        spr[k] = False
    if sum(spr) == 0:
      ans = min(ans, sum([1 for i in range(n) if bit & 1<<i]))
      print(ans)
      exit()


Fixed submission:

n,m = list(map(int,input().split()))
d = [0]*m
spr = [True]*m
ma = 0
mi = 0
for i in range(m):
    a,b = list(map(int,input().split()))
    d[i] = [a,b]

d = sorted(d)
pre = d[0][1]
ans = 1
for i,(a,b) in enumerate(d):
  if a < pre:
    if b < pre:
      pre = b
  else:
    ans += 1
    pre = b

print(ans)

Buggy python submission (verdict: Time Limit Exceeded):

n,m = list(map(int,input().split()))
d = []
spr = [[False]*m]
s = 1<<0
for i in range(m):
  a,b = list(map(int,input().split()))
  d.append( ((1<<a)-1) ^ ((1<<b)-1) )

for bit in range(1<<n):
  spr = [True for _ in range(m)]
  for k in range(m):
      if (d[k] & bit) > 0:
        spr[k] = False
  if sum(spr) == 0:
      print(sum([1 for i in range(n) if bit & 1<<i]))
      exit()




Fixed submission:

n,m = list(map(int,input().split()))
d = [0]*m
spr = [True]*m
ma = 0
mi = 0
for i in range(m):
    a,b = list(map(int,input().split()))
    d[i] = [a,b]

d = sorted(d)
pre = d[0][1]
ans = 1
for i,(a,b) in enumerate(d):
  if a < pre:
    if b < pre:
      pre = b
  else:
    ans += 1
    pre = b

print(ans)

Buggy python submission (verdict: Time Limit Exceeded):

n,m = list(map(int,input().split()))
d = []
spr = [[False]*m]
s = 1<<0
for i in range(m):
  a,b = list(map(int,input().split()))
  d.append( ((1<<a)-1) ^ ((1<<b)-1) )

ans = float('inf')
for bit in range(1<<n):
  spr = [True for _ in range(m)]
  for k in range(m):
      if (d[k] & bit) > 0:
        spr[k] = False
  if sum(spr) == 0:
      ans = min(ans, sum([1 for i in range(n) if bit & 1<<i]))
      print(ans)
      exit()


     



Fixed submission:

n,m = list(map(int,input().split()))
d = [0]*m
spr = [True]*m
ma = 0
mi = 0
for i in range(m):
    a,b = list(map(int,input().split()))
    d[i] = [a,b]

d = sorted(d)
pre = d[0][1]
ans = 1
for i,(a,b) in enumerate(d):
  if a < pre:
    if b < pre:
      pre = b
  else:
    ans += 1
    pre = b

print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
import numpy as np
n,m = list(map(int,input().split()))
d = [[1<<n] for _ in range(m)]
s = 1<<0
for i in range(m):
  a,b = list(map(int,input().split()))
  d[i] = ((1<<a)-1) ^ ((1<<b)-1)

spr = [[False] for _ in range(m)]

ans = float('inf')
for bit in range(1<<n):
  spr = [True for _ in range(m)]
  for k in range(m):
      if (d[k] & bit) > 0:
        spr[k] = False
  if sum(spr) == 0:
      ans = min(ans, sum([1 for i in range(n) if bit & 1<<i]))
      print(ans)
      exit()


Fixed submission:

n,m = list(map(int,input().split()))
d = [0]*m
spr = [True]*m
ma = 0
mi = 0
for i in range(m):
    a,b = list(map(int,input().split()))
    d[i] = [a,b]

d = sorted(d)
pre = d[0][1]
ans = 1
for i,(a,b) in enumerate(d):
  if a < pre:
    if b < pre:
      pre = b
  else:
    ans += 1
    pre = b

print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
import numpy as np
n,m = list(map(int,input().split()))
d = [[1<<n] for _ in range(m)]
s = 1<<0
for i in range(m):
  a,b = list(map(int,input().split()))
  d[i] = ((1<<a)-1) ^ ((1<<b)-1)

spr = [[False] for _ in range(m)]

ans = float('inf')
for bit in range(1<<n):
  spr = [True for _ in range(m)]
  for k in range(m):
      if (d[k] & bit) > 0:
        spr[k] = False
  if sum(spr) == 0:
      ans = min(ans, sum([1 for i in range(n) if bit & 1<<i]))

print(ans)
     


Fixed submission:

n,m = list(map(int,input().split()))
d = [0]*m
spr = [True]*m
ma = 0
mi = 0
for i in range(m):
    a,b = list(map(int,input().split()))
    d[i] = [a,b]

d = sorted(d)
pre = d[0][1]
ans = 1
for i,(a,b) in enumerate(d):
  if a < pre:
    if b < pre:
      pre = b
  else:
    ans += 1
    pre = b

print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
import numpy as np
n,m = list(map(int,input().split()))
d = [[1<<n] for _ in range(m)]
s = 1<<0
for i in range(m):
  a,b = list(map(int,input().split()))
  d[i] = ((1<<a)-1) ^ ((1<<b)-1)
  s |= d[i]

spr = [[False] for _ in range(m)]

ans = float('inf')
for bit in range(1<<n):
  spr = [True for _ in range(m)]
  if bit & s > 0:
    for k in range(m):
      if (d[k] & bit) > 0:
        spr[k] = False
    if sum(spr) == 0:
      ans = min(ans, sum([1 for i in range(n) if bit & 1<<i]))

print(ans)

Fixed submission:

n,m = list(map(int,input().split()))
d = [0]*m
spr = [True]*m
ma = 0
mi = 0
for i in range(m):
    a,b = list(map(int,input().split()))
    d[i] = [a,b]

d = sorted(d)
pre = d[0][1]
ans = 1
for i,(a,b) in enumerate(d):
  if a < pre:
    if b < pre:
      pre = b
  else:
    ans += 1
    pre = b

print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
import numpy as np
n,m = list(map(int,input().split()))
d = [[1<<n] for _ in range(m)]
s = 1<<0
for i in range(m):
  a,b = list(map(int,input().split()))
  d[i] = ((1<<a)-1) ^ ((1<<b)-1)
  s |= d[i]

spr = [[False] for _ in range(m)]

ans = float('inf')
for bit in range(1<<n):
  spr = [True for _ in range(m)]
  for i in range(n):
    if bit & 1<<i and s & 1<<i:
      for k in range(m):
        if (d[k] & 1<<i) > 0:
          spr[k] = False
      if sum(spr) == 0:
        ans = min(ans, sum([1 for i in range(n) if bit & 1<<i]))

print(ans)
     


Fixed submission:

n,m = list(map(int,input().split()))
d = [0]*m
spr = [True]*m
ma = 0
mi = 0
for i in range(m):
    a,b = list(map(int,input().split()))
    d[i] = [a,b]

d = sorted(d)
pre = d[0][1]
ans = 1
for i,(a,b) in enumerate(d):
  if a < pre:
    if b < pre:
      pre = b
  else:
    ans += 1
    pre = b

print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
import numpy as np
n,m = list(map(int,input().split()))
d = [[1<<n] for _ in range(m)]
for i in range(m):
  a,b = list(map(int,input().split()))
  d[i] = ((1<<a)-1) ^ ((1<<b)-1)

spr = [[False] for _ in range(m)]
s = 1<<0
for x in d:
  s |= x

ans = float('inf')
for bit in range(1<<n):
  spr = [True for _ in range(m)]
  for i in range(n):
    if bit & 1<<i and s & 1<<i:
      for k in range(m):
        if (d[k] & 1<<i) > 0:
          spr[k] = False
      if sum(spr) == 0:
        ans = min(ans, sum([1 for i in range(n) if bit & 1<<i]))

print(ans)


Fixed submission:

n,m = list(map(int,input().split()))
d = [0]*m
spr = [True]*m
ma = 0
mi = 0
for i in range(m):
    a,b = list(map(int,input().split()))
    d[i] = [a,b]

d = sorted(d)
pre = d[0][1]
ans = 1
for i,(a,b) in enumerate(d):
  if a < pre:
    if b < pre:
      pre = b
  else:
    ans += 1
    pre = b

print(ans)