Harryxun/stf_run huggingface dataset:
import sys

# 関数 solve は，もちろん，問題に応じて書き換える
def solve(a, b):
      c=a-b+1
    return(c)
# ここから下は，入力・出力形式が同じであれば，変えなくて良い．
def readQuestion():
    line = sys.stdin.readline().rstrip()
    [str_a, str_b] = line.split(' ')
    return (int(str_a), int(str_b))

def main():
    a, b = readQuestion()
    answer = solve(a, b)
    print(answer)
    
if __name__ == '__main__':
    main()

### FIXED CODE ###

a,b=map(int,input().split())
t=a-b+1
print(t)
S = sorted(input())

if S==[a,b,c]:
  print("Yes")
else:
  print("No")


### FIXED CODE ###

a = input()
b = sorted(a)

if "".join(b) == "abc":
  print("Yes")
else:
  print("No")
x,y = map(int,input().split())
for i in range(x+1):
    num = i*2 + (x-i)*4
    if(num == y):
        print('Yes')
        exit()

print('No

### FIXED CODE ###

x,y = map(int,input().split())
for i in range(x+1):
    num = i*2 + (x-i)*4
    if(num == y):
        print('Yes')
        exit()

print('No')
H, W = [int(i) for i in input().split()]
A = [[int(i) for i in input().split()] for _ in range(H)]

ans = []
for h in range(H):
    for w in range(W - 1):
        if A[h][w] % 2 == 1:
            A[h][w + 1] += 1
            ans.append([h + 1, w + 1, h + 1, w + 2])
    if h < H - 1 and A[h][w - 1] % 2 == 1:
        A[h + 1][w - 1] += 1
        ans.append([h + 1, w, h + 2, w])

print(len(ans))
for a in ans:
    print(*a)

### FIXED CODE ###

H, W = [int(i) for i in input().split()]
A = [[int(i) for i in input().split()] for _ in range(H)]

ans = []
for h in range(H):
    for w in range(W - 1):
        if A[h][w] % 2 == 1:
            A[h][w + 1] += 1
            ans.append([h + 1, w + 1, h + 1, w + 2])
    if h < H - 1 and A[h][W - 1] % 2 == 1:
        A[h + 1][W - 1] += 1
        ans.append([h + 1, W, h + 2, W])

print(len(ans))
for a in ans:
    print(*a)
N,M = map(int, input().split())
citys = [list(map(int,input().split()))+[i] for i in range(M)]

citys.sort(key = lambda x:x[1])
nums = [0]*(N+1)
states = [None]*(M+1)

for p,y,i in citys:
    nums[p] += 1
    states[i] = [str(p), str(nums[p])]

for s in states:
    print(s[0].zfill(6)+s[1].zfill(6))

### FIXED CODE ###

X,Y = map(int, input().split())

print(int(X+Y/2))
s = input()
q = int(input())
for i in range(q):
  n = int(input())
  if n == 1:
    s = s[::-1]
  else:
    f,c = map(str,input().split())
    if int(f) == 1:
      s = c + s
    else:
      s = s + c
print(s)
    


### FIXED CODE ###

s=input()
q=int(input())
head=[]
tail=[]
rev=False
for _ in range(q):
  tmp=list(input().split())
  if tmp[0]=='1':
    if rev==False:
      rev=True
    else:
      rev=False
  if tmp[0]=='2':
    if rev==False:
      if tmp[1]=='1':
        head.append(tmp[2])
      if tmp[1]=='2':
        tail.append(tmp[2])
    if rev==True:
      if tmp[1]=='1':
        tail.append(tmp[2])
      if tmp[1]=='2':
        head.append(tmp[2])
head=''.join(map(str,head))
tail=''.join(map(str,tail))
ans=head[::-1]+s+tail
if rev==True:
  ans=ans[::-1]
print(ans)
a,b,k=map(int,input().split())
print([i for i in range(1,min([a,b])+1) if i%a==0 and i%b==0][-k])

### FIXED CODE ###

a,b,k=map(int,input().split())
print([i for i in range(1,min([a,b])+1) if a%i==0 and b%i==0][-k])
# coding:utf-8
import math

x1,y1,x2,y2=map(int,raw_input().split())

print(math.sqrt((x2-x1)**2+(y2-y1)**2))

### FIXED CODE ###

# coding:utf-8
import math

x1,y1,x2,y2=list(map(float,input().split()))

print(math.sqrt((x2-x1)**2+(y2-y1)**2))
import queue

n,m = list(map(int, input().split()))
puted = [0]*(n+1)

ab = [[] for i in range(n+1)]
for i in range(m):
	a,b = readInts()
	ab[a].append(b)
	ab[b].append(a)

q = queue.Queue()
flg = [-1]*n
flg[0] = 0
q.put(1)

while -1 in flg or q.empty():
	item = q.get()
	for i in ab[item]:
		if puted[i]==0:
			flg[i-1]=item
			q.put(i)
			puted[i]=1

if -1 in flg:
	print("No")
	exit()

print("Yes")
for i in range(1,len(flg)):
	print(flg[i])


### FIXED CODE ###

import queue

n,m = list(map(int, input().split()))
puted = [0]*(n+1)

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

q = queue.Queue()
flg = [-1]*n
flg[0] = 0
q.put(1)

while not q.empty():
	item = q.get()
	for i in ab[item]:
		if puted[i]==0:
			flg[i-1]=item
			q.put(i)
			puted[i]=1

if -1 in flg:
	print("No")
	exit()

print("Yes")
for i in range(1,len(flg)):
	print(flg[i])
a,b = input( , )
print(int(a) * int(b)),((int(a) * 2) + (int(b) * 2))

### FIXED CODE ###

a ,b = input().split(' ')
print(int(a) * int(b),(int(a) * 2) + (int(b) * 2))
a=input()
d=a
if a>2:
else 
    b=a
    a=2
while c!=0:
    c=a%b
    a=b
    b=c
print(d*2/b)


### FIXED CODE ###

N=input()
N=int(N)
if N%2==0:
    print(N)
else:
    print(N*2)
from fractions import*
n=gcd(*map(int,input().split()))
a=1
i=2
while i*i<=n:
 a+=n%i<1
 while n%i<1:n//=i
 i+=1
print(ans+(n>1))

### FIXED CODE ###

from subprocess import*
a,b=map(int,input().split())
x=set(map(int,Popen(['factor',str(a)],stdout=PIPE).communicate()[0].decode().split()[1:]))
y=set(map(int,Popen(['factor',str(b)],stdout=PIPE).communicate()[0].decode().split()[1:]))
print(len(x&y)+1)
n,m = map(int, input().split())
n = range(1,n+1)
for i in range(m):
  a,b = map(int, input().split())
  n = [j for j in n if a <= j <= b]
print(len(j))

### FIXED CODE ###

n,m = map(int, input().split())
p,q = float('-inf'),float('inf')
for i in range(m):
  a,b = map(int, input().split())
  if a > p:
    p = a
  if b < q:
    q = b
if (q-p) < 0:
  print(0)
else:
  print(q-p+1)
#! /usr/bin/env python
import math

while True:
    inp = input()
    if inp == '0': break

    num = math.factorial(int(inp))
    cnt = 0
    while True:
        if num % 10 == 0:
            cnt = cnt + 1
            num = num / 10
        else:
            break

    print(cnt)

### FIXED CODE ###

while True:
    inp = input()
    if inp == '0': break

    num = 1
    for i in range(1, int(inp)+1):
        num = num * i

    cnt = 0
    strnum = str(num)
    while True:
        if strnum[-1] == '0':
            cnt = cnt + 1
            strnum = strnum[:-1]
        else:
            break

    print(cnt)
a, b = [int(x) for x in input().split()]
# a = [int(input()) for _ in range(m)]
# a = [int(x) for x in input().split()]

import math


print((a*b)//(math.gcd(a, b)))

### FIXED CODE ###

a, b = [int(x) for x in input().split()]
# a = [int(input()) for _ in range(m)]
# a = [int(x) for x in input().split()]

from fractions import gcd



print((a*b)//gcd(a, b))
x = int(input())
j = False
for i in range(len(x))
  if x[i] == 7:
    j = True
if j:
  print('Yes')
else:
  print('No')

### FIXED CODE ###

x = input()
j = False
for i in range(len(x)):
  if x[i] == '7':
    j = True
if j:
  print('Yes')
else:
  print('No')
K = int(input())
def gcd(x, y):
  a, b = x, y
  while b != 0:
    a, b = b, a % b
  return a
gcds = [[0 for j in range(K)] for i in range(K)]
for i in range(K):
  for j in range(K):
    gcds[i][j] = gcd(i+1, j+1)
S = 0
for i in range(K):
  for j in range(K):
    for k in range(K):
      S += gcds[gcds[i][j]][k]
print(S)

### FIXED CODE ###

K = int(input())
def gcd(x, y):
  a, b = x, y
  while b != 0:
    a, b = b, a % b
  return a
gcds = [[0 for j in range(K)] for i in range(K)]
for i in range(K):
  for j in range(K):
    gcds[i][j] = gcd(i+1, j+1)
S = 0
for i in range(K):
  for j in range(K):
    for k in range(K):
      S += gcds[gcds[j][k]-1][i]
print(S)
A,B = map(int, input().split())
count = 0
for i in range(A, B+1):
  i = str(i)
  if i == i[::-1]:
    count += 1
print(count)

### FIXED CODE ###

a = input()
b = input()
c = input()

print(a[0]+b[1]+c[2])
c = a*b

if (c%2 == 0):
	print('Even')
else:
    print('Odd')

### FIXED CODE ###

a, b = map(int, input().split())

c = a*b

if c%2 == 0:
    print("Even")
else:
    print("Odd")
v=map(int,open(0).read().split())
if v[5]>=v[4]-v[0]:
  print("Yay")
else:
  print(":(")

### FIXED CODE ###

a=int(input())
b=int(input())
c=int(input())
d=int(input())
e=int(input())
k=int(input())

m=e-a
if m>k:
  print(":(")
else:
  print("Yay!")
N, A = map(int, input().split())
X = list(map(lambda x: int(x) - A, input().split()))
maxn = max(max(X), A)
 
dp = [[0 for _ in range(2 * N * maxn + 1)] for _ in range(N + 1)]
dp[0][N * maxn] = 1
 
for i in range(N):
    for k in range(2 * N * maxn + 1):
        dp[i + 1][k] = dp[i][k]
        if 0 <= k - X[i] <= 2 * N * maxn:
            dp[i + 1][k] += dp[i][k - X[i]]
 
print(dp[N][N * maxn] - 1)
N, A = map(int, input().split())
X = list(map(lambda x: int(x) - A, input().split()))
maxn = max(max(X), A)

dp = [[0 for _ in range(2 * N * maxn + 1)] for _ in range(N + 1)]
dp[0][N * maxn] = 1

for i in range(N):
    for k in range(2 * N * maxn + 1):
        dp[i + 1][k] = dp[i][k]
        if 0 <= k - X[i] < 2 * N * maxn:
            dp[i + 1][k] += dp[i][k - X[i]]

print(dp[N][N * maxn] - 1)


### FIXED CODE ###

N, A = map(int, input().split())
X = list(map(lambda x: int(x) - A, input().split()))
maxn = max(max(X), A)
 
dp = [[0 for _ in range(2 * N * maxn + 1)] for _ in range(N + 1)]
dp[0][N * maxn] = 1
 
for i in range(N):
    for k in range(2 * N * maxn + 1):
        dp[i + 1][k] = dp[i][k]
        if 0 <= k - X[i] <= 2 * N * maxn:
            dp[i + 1][k] += dp[i][k - X[i]]
 
print(dp[N][N * maxn] - 1)
#!/usr/bin/env python
# -*- coding:utf-8 -*-
import sys

def read_data():
    lines = [line.rstrip() for line in sys.stdin]
    ns = [int(n) for n in lines[1].split()]
    ms = []
    for line in lines[3:]:
        num, sec = line.split()
        ms.append((int(num)-1, int(sec)))
    return ns, ms

def main():
    ns, ms = read_data()
    for (drink_num, drink_sec) in ms:
        result = sum(ns) - ns[drink_num] + drink_sec
        print result


if __name__ == "__main__":
    main()

### FIXED CODE ###

#!/usr/bin/env python
# -*- coding:utf-8 -*-

def main():
    a, op, b = raw_input().split()
    if op == '+':
        result = int(a) + int(b)
    else:
        result = int(a) - int(b)
    print result


if __name__ == "__main__":
    main()
n = list(map(int, input().split()))
c = Counter(n)
    for i in c:
        if c[i] == 1:
            res = i
            print(res)

### FIXED CODE ###

import sys
from collections import Counter

# sys.stdin = open('a1.in')


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


def read_str_list():
    return input().split()


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


def read_str():
    return input()


def main():
    n = read_int_list()
    c = Counter(n)
    for i in c:
        if c[i] == 1:
            print(i)


main()
A=int(input())
B=int(input())

C=A*B

if C>81:
	print("-1")
elif C<1:
	print("-1")
else:
	print(C)

### FIXED CODE ###

A,B=map(int,input().split())

if A<10 and B<10:
	print(A*B)
else:
	print(-1)
from heapq import heappush, heappop

n, m = map(int, input().split())
a = list(map(int, input().split()))
card = [list(map(int, input().split())) for _ in range(m)]
card = sorted(card, key=lambda x:-x[1])

hq = []
for i in range(n):
    heappush(hq, a[i])

ans = sum(a)
for i in range(m):
    for j in range(card[i][0]):
        num = heappop(hq)
        if num >= card[i][1]:
            heappush(hq, num)
            break
        else:
            ans += card[i][1]-num
print(ans)


### FIXED CODE ###

from heapq import heappush, heappop

n, m = map(int, input().split())
a = list(map(int, input().split()))
card = [list(map(int, input().split())) for _ in range(m)]
card = sorted(card, key=lambda x:-x[1])

hq = []
for i in range(n):
    heappush(hq, a[i])

ans = sum(a)
for i in range(m):
    for j in range(card[i][0]):
        if hq == []:
            break
        num = heappop(hq)
        if num >= card[i][1]:
            heappush(hq, num)
            break
        else:
            ans += card[i][1]-num
print(ans)
N=int(input())
K=int(input())
import math
x=math.floor(math.log10(N))+1
def combinations_count(n, r):
  return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))
ans=0
if K==1:
  ans=(x-1)*9
  ans+=(N//10**(x-1))
  print(ans)
elif K==2:
  for i in range(2,x):
    ans+=(9**2)*(i-1)
  f=(N//10**(x-1))
  n=str(N)
  for i in range(1,x):
    if n[i]!='0':
      s_n=x-i
      s=int(n[i])
      break
  ans+=(f-1)*9*(x-1)
  ans+=9*(s_n-1)
  ans+=s
  print(ans)
else:
  for i in range(3,x):
    ans+=(9**3)*combinations_count(i-1,2)
  f=(N//10**(x-1))
  n=str(N)
  for i in range(1,x):
    if n[i]!='0':
      s_n=x-i
      s=int(n[i])
      break
  for i in range(x-s_n+1,x):
    if n[i]!='0':
      t_n=x-i
      t=int(n[i])
      break
  ans+=(f-1)*9**2*combinations_count(x-1,2)
  ans+=9**2*combinations_count(s_n-1,2)
  ans+=(s-1)*9*(s_n-1)
  ans+=9*(t_n-1)
  ans+=t
  print(ans)

### FIXED CODE ###

Nstr=input()
N=int(Nstr)
K=int(input())
x=len(Nstr)
dp0=[[0]*(K+1) for i in range(x+1)]
dp1=[[0]*(K+1) for i in range(x+1)]

dp1[0][0]=1

for i in range(1,x+1):
  dp0[i][0]=dp0[i-1][0]+dp1[i-1][0]
  for j in range(1,K+1):
    if Nstr[i-1]!='0':
      dp1[i][j]=dp1[i-1][j-1]
      dp0[i][j]+=(dp1[i-1][j-1]*(int(Nstr[i-1])-1)+dp1[i-1][j])
    else:
      dp1[i][j]=dp1[i-1][j]
    dp0[i][j]+=(dp0[i-1][j]+dp0[i-1][j-1]*9)

    
  '''  
  if Nstr[i-1]!='0':
    for j in range(1,K+1):
      dp1[i][j]=dp1[i-1][j-1]
      dp0[i][j]+=(dp1[i-1][j-1]*(int(Nstr[i-1])-1)+dp1[i-1][j])
  else:
    for j in range(1,K+1):
      dp1[i][j]=dp1[i-1][j]
  for j in range(1,K+1):
    dp0[i][j]+=(dp0[i-1][j]+dp0[i-1][j-1]*9)
  '''
print(dp0[x][K]+dp1[x][K])
def solve(i, m):
  if dp[i][m]==0 or dp[i][m]==1:
    return dp[i][m]

  if m == 0:
    dp[i][m] = 1
  elif i >= n:
    dp[i][m] = 0
  elif solve(i+1, m):
    dp[i][m] = 1
  elif solve(i+1, m-A[i]):
    dp[i][m] = 1
  else:
    dp[i][m] = 0

  return dp[i][m]



n = input()
A = map(int, raw_input().split())
p = input()
m = map(int, raw_input().split())
for i in range(p):
  if solve(0, m[i]):
    print 'yes'
  else:
    print 'no'

### FIXED CODE ###

def solve(i, m):
  if dp[i][m] != -1:
    return dp[i][m]

  if m == 0:
    dp[i][m] = 1
  elif i >= n:
    dp[i][m] = 0
  elif solve(i+1, m):
    dp[i][m] = 1
  elif solve(i+1, m-A[i]):
    dp[i][m] = 1
  else:
    dp[i][m] = 0

  return dp[i][m]



n = input()
A = map(int, raw_input().split())
p = input()
m = map(int, raw_input().split())

dp = [[-1 for col in range(2000)] for row in range(n+1)]

for i in range(p):
  if solve(0, m[i]):
    print 'yes'
  else:
    print 'no'
import numpy as np


def resolve():
    N, M = map(int, input().split())
    H = list(map(int, input().split()))

    A = np.zeros((N, N))
    for i in range(M):
        pp, ss = map(int, input().split())
        ss -= 1
        pp -= 1
        A[pp][ss] = H[ss]
        A[ss][pp] = H[pp]

    ans = 0
    for j in range(N):
        np_max = np.amax(A[j], initial=0)

        now = H[j]
        if (np_max == 0 or now > np_max):
            ans += 1

    print(ans)


resolve()

### FIXED CODE ###

def resolve():
    n, m = map(int, input().split())
    hhh = list(map(int, input().split()))
    nice = [1] * n

    for _ in range(m):
        a, b = map(int, input().split())
        a -= 1
        b -= 1
        ha = hhh[a]
        hb = hhh[b]
        if ha <= hb:
            nice[a] = False
        if ha >= hb:
            nice[b] = False

    print(sum(nice))


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

    ans+= pow(N//K,3)
    if k%2 == 0:
        ans = pow((n-k//2)//k, 3)
    print(ans)


if __name__ == '__main__':
    main()

### FIXED CODE ###

def main():
    n,k = map(int, input().split())

    ans = (n//k)**3
    if k%2 == 0:
        ans += ((n+k//2)//k)**3
    print(ans)


if __name__ == '__main__':
    main()
n = int(input())
edges = [[] for _ in range(n)]
for _ in range(n - 1):
  a, b = map(int, input().split())
  edges[a - 1].append(b - 1)
  edges[b - 1].append(a - 1)


vertice = [0 for _ in range(n)]

def dfs(v, color_i):
    vertice[v] = color_i
    for i in edges[v]:
        if vertice[i] == 0:
            dfs(i, color_i*(-1))

dfs(0, 1)

ans = []
if vertice.count(1) <= n // 3:
    not3 = [i for i in range(1, n+1) if i % 3 != 0]
    num3 = [i for i in range(1, n+1) if i % 3 == 0]
    for v in vertice:
        if v == 1:
            if num3:
                ans.append(str(num3.pop()))
                continue
        ans.append(str(not3.pop()))
elif vertice.count(-1) <= n // 3:
    not3 = [i for i in range(1, n+1) if i % 3 != 0]
    num3 = [i for i in range(1, n+1) if i % 3 == 0]
    for v in vertice:
        if v == -1:
            if num3:
                ans.append(str(num3.pop()))
                continue
        ans.append(str(not3.pop()))
else:
    num1 = [i for i in range(1, n+1) if i % 3 == 1]
    num2 = [i for i in range(1, n+1) if i % 3 == 2]
    num3 = [i for i in range(1, n+1) if i % 3 == 0]
    for v in vertice:
        if v == 1:
            if num1:
                ans.append(str(num1.pop()))
            else:
                ans.append(str(num3.pop()))
        else:
            if num2:
                ans.append(str(num2.pop()))
            else:
                ans.append(str(num3.pop()))

print(" ".join(ans))


### FIXED CODE ###

n = int(input())
edge = [[] for _ in range(n)]
for _ in range(n-1):
  a, b = map(int, input().split())
  edge[a-1].append(b-1)
  edge[b-1].append(a-1)
 
group = [False] * n
parent = list(range(n))
stack = [0]
while stack:
  v = stack.pop()
  while edge[v]:
    u = edge[v].pop()
    if parent[v] != u:
      group[u] = not group[v]
      parent[u] = v
      stack.append(u)
 
three = 3
p = [0] * n
if group.count(False) <= n // 3:
  other = 1
  for i in range(n):
    if group[i] and other <= n:
      p[i] = other
      other += other % 3
    else:
      p[i] = three
      three += 3
elif group.count(True) <= n // 3:
  other = 1
  for i in range(n):
    if not group[i] and other <= n:
      p[i] = other
      other += other % 3
    else:
      p[i] = three
      three += 3
else:
  one, two = 1, 2
  for i in range(n):
    if group[i] and one <= n:
      p[i] = one
      one += 3
    elif not group[i] and two <= n:
      p[i] = two
      two += 3
    else:
      p[i] = three
      three += 3
print(' '.join(map(str, p)))
n = int(input())
a = list(map(int, input().split()))
l_abs = []
max_v = 0
for i, a_i in enumerate(a):
    if(max_v < a_i):
        max_v = a_i
    l_abs.append(abs((i+1)-a_i))

min = 10 ** 16
if sum(l_abs) == 0:
    min = 0
else:
    for b in range(-(max_v+1), max_v+1):
        sum = 0
        for j, a_j in enumerate(a):
            sum += abs(a_j-(b+j+1))
        if(min > sum):
            min = sum
print(min)


### FIXED CODE ###

n = int(input())
if(n%2==0):
    print(str(n))
else:
    print(str(n * 2))
N = int(input())
P = list(range(1, N+1))

M = []
for i in range(1, N+1):
    m = list(map(lambda x : i%x, P))
    #print(m)
    M.append(max(m))
    #print(m.index(max(m)))
    del P[m.index(max(m))]
print(sum(M))

### FIXED CODE ###

N = int(input())
print((N-1)*N//2)
list_s = list(str(input()))
k = int(input())
for i in range(len(list_s)):
    if list_s[i] != "1":
        bord = i
        break
if k <= bord:
    print(1)
else:
    print(list_s[i])


### FIXED CODE ###

list_s = list(str(input()))
k = int(input())
bord = 10 **9
for i in range(len(list_s)):
    if list_s[i] != "1":
        bord = i
        break
if k <= bord:
    print(1)
else:
    print(list_s[i])
N,M = map(int,input().split())
edges = [[]for _ in range(N+1)]
for _ in range(M):
    a,b = map(int,input().split())
    edges[a].append(b)
    edges[b].append(a)

colors = [-1]*(N+1)
def paint(n,p,c):
    ret = 1
    if colors[n]!=-1 and colors[n]!=c:
        ret = 0
    else:
        colors[n] = c
        for nx in edges[n]:
            if nx != p:
                ret = min(ret,paint(nx,n,(c+1)%2))
    return ret

def choose(n,k):
    import math
    return math.factorial(n)//(math.factorial(n-k)*math.factorial(k))
res = paint(1,0,1)
if res == 0:
    ans = choose(N,2)-M
else:
    ans = colors.count(0)*(N-colors.count(0))-M

print(ans)


### FIXED CODE ###

"""
グラフが二部グラフかどうかを判定する。
二部グラフであれば、AグループのノードとBグループのノード同士をそれぞれ結ぶことができる。
二部グラフでない場合、すべてのノード同士を結ぶことができる。
"""
import math
from collections import Counter
import sys
sys.setrecursionlimit(200000)
def choose(n):
    return math.factorial(n)//(math.factorial(n-2)*math.factorial(2))
N,M = map(int,input().split())
edges = [[]for _ in range(N+1)]
for _ in range(M):
    A,B = map(int,input().split())
    edges[A].append(B)
    edges[B].append(A)

colors = [-1]*(N+1)
def f(n,p):
    c = colors[n]
    for v in edges[n]:
        if v != p:
            if colors[v] == -1:
                colors[v] = 1 if c==0 else 0
                f(v,n)
            elif colors[v] == c:
                print(choose(N)-M)
                exit()
colors[1]=0
f(1,0)
count1 = colors.count(0)
count2 = colors.count(1)
print(count1*count2-M)
a,b,k = map(int,input().split())
lis = [i for i in range(a,b+1)]
ans = []

for i in range(k):
  ans.append(lis[i])
  ans.append(lis[-i-1])


for i in sorted(set(ans)):
  print(i)

### FIXED CODE ###

a,b,k = map(int,input().split())

if (b-a)<k*2:
  for i in range(a,b+1):
    print(i)
else:
  for i in range(a,a+k):
    print(i)
  for j in range(b-k+1,b+1):
    print(j)
n=int(input())
h=list(map(int,input().split()))
h[0]=h[0]-1
for i in range(1,n):
    try:
        if h[i]-1>=h[i+1]:
            h[i]=h[i]-1
    except IndexError:
        pass
for i in range(n):
    try:
        if h[i]>h[i+1]:
                print("No")
                exit()
    except IndexError:
        pass
print("Yes")

### FIXED CODE ###

a,b,c=map(int,input().split())
print(max(c-(a-b),0))
check = [#.] * 300
while 1:
  h, w = map(int, raw_input().split())
  if h == w == 0:
    break
  for i in range(h):
    if h % 2 == 0:
      print check[:w]
    else:
      print check[1:w+1]
  print ""
  

### FIXED CODE ###

import sys
while 1:
  H, W = map(int, raw_input().split())
  if H == 0 and W == 0:
    break
  else:
    for h in range(H):
      for w in range(W):
         if (h + w) % 2 == 0:
           sys.stdout.write("#")
         else:
           sys.stdout.write(".")
      print ""
    print ""
N, K = map(int, input().split())


def comb(n, k):
    m = 1
    if n < k:
        return 0
    elif n < 2 * k:
        k = n - k
    for i in range(1, k + 1):
        m = m * (n - i + 1) / i
    return int(m)


for j in range(1, K + 1):
    pts = comb(N - K + 1, j) % 1000000007
    nums = comb(K - 1, j - 1) % 1000000007
    print((pts * nums) % 1000000007)

### FIXED CODE ###

N, K = map(int, input().split())
mod = 10 ** 9 + 7

f = [1 for _ in range(N + 1)]
inv = [1 for _ in range(N + 1)]
finv = [1 for _ in range(N + 1)]

for i in range(2, N + 1):
    f[i] = f[i - 1] * i % mod
    inv[i] = mod - inv[mod % i] * (mod // i) % mod
    finv[i] = finv[i - 1] * inv[i] % mod


def comb(n, r):
    return f[n] * (finv[r] * finv[n - r] % mod) % mod


for i in range(1, K + 1):
    print((comb(N - K + 1, i) * comb(K - 1, i - 1)) % mod) if i <= N - K + 1 else print(0)
N,K = map(int, input().split())
L = []
for i in range(N):
  d = int(input)
  A = list(map(int, input().split()))
  for j in range(d):
    L.append(A[j])
print(N-len(set(L)))

### FIXED CODE ###

N,K = map(int, input().split())
L = []
for i in range(K):
  d = int(input())
  A = list(map(int, input().split()))
  for j in range(d):
    L.append(A[j])
print(N-len(set(L)))
n = int(input())
c = list(input())

w = c.index("W")
r = n-1 - c[::-1].index("R")

cnt = 0
while w < r:
  c[w],c[r] = c[r],c[w]
  w = c.index("W")
  r = n-1 - c[::-1].index("R")
  cnt += 1
else:
  print(cnt)

### FIXED CODE ###

n = int(input())
c = list(input())

r = c.count('R')  
wr = c[:r].count('W')  

print(wr)