Harryxun/stf_run huggingface dataset:
#解答改良
n,m,k=map(int,input().split())

f=[[]for i in range(n)]
b=[[]for i in range(n)]
option=[]

for i in range(m):
    x,y=map(int,input().split())
    if i==0:
        option.append(x-1)
    f[x-1].append(y-1)
    f[y-1].append(x-1)
for i in range(k):
    x,y=map(int,input().split())
    b[x-1].append(y-1)
    b[y-1].append(x-1)

completed=[False for i in range(n)]
groups=[0]*n

x=0
while option:
    now=option.pop()
    groups[now]=x
    completed[now]=True
    for friend in f[now]:
        if completed[friend]==False and friend not in option:
            option.append(friend)
    if len(option)==0:
        x+=1
        for i in range(n):
            if completed[i]==False:
                option.append(i)
                break

size=[0]*(x)
for i in range(x):
    size[i]=groups.count(i)

for i in range(n):
    cnt=0
    for friend in f[i]:
        if groups[i]==groups[friend]:
            cnt+=1
    for block in b[i]:
        if groups[i]==groups[block]:
            cnt+=1
    print(size[groups[i]]-cnt-1,end=" ")

### FIXED CODE ###

class UnionFind():
    def __init__(self, n):
        self.n=n
        self.parents=[-1]*n #各要素の親要素の番号を格納するリスト

    def find(self, x): #要素xが属するグループの根を返す
        if self.parents[x]<0:
            return x
        else:
            self.parents[x]=self.find(self.parents[x])
            return self.parents[x]

    def union(self,x,y): #要素xが属するグループと要素yが属するグループとを併合する
        x=self.find(x)
        y=self.find(y)

        if x==y:
            return

        if self.parents[x]>self.parents[y]:
            x,y=y,x

        self.parents[x]+=self.parents[y]
        self.parents[y]=x

    def size(self,x): #要素xが属するグループのサイズ（要素数）を返す
        return -self.parents[self.find(x)]

    def same(self,x,y): #要素x, yが同じグループに属するかどうかを返す
        return self.find(x)==self.find(y)

    def members(self,x): #要素xが属するグループに属する要素をリストで返す
        root=self.find(x)
        return [i for i in range(self.n) if self.find(i)==root]

    def roots(self): #すべての根の要素をリストで返す
        return [i for i, x in enumerate(self.parents) if x<0]

    def group_count(self): #グループの数を返す
        return len(self.roots())

    def all_group_members(self): #{ルート要素: [そのグループに含まれる要素のリスト], ...}の辞書を返す
        return {r: self.members(r) for r in self.roots()}

    def __str__(self):
        return '\n'.join('{}: {}'.format(r, self.members(r)) for r in self.roots())

#print(list(uf.all_group_members().values())) #グループ一覧を表示

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

uf=UnionFind(n)
cnt=[0]*n

for _ in range(m):
    x,y=map(int,input().split())
    uf.union(x-1,y-1)
    cnt[x-1]+=1
    cnt[y-1]+=1
for _ in range(k):
    x,y=map(int,input().split())
    if uf.same(x-1,y-1):
        cnt[x-1]+=1
        cnt[y-1]+=1
    
for i in range(n):
    print(uf.size(i)-cnt[i]-1,end=" ")
A,B,C,D=map(int, input().split())

#上と右

p=998244353
dp=[[0]*(D+1) for _ in range(C+1)]

dp[A+1][B]=B
dp[A][B+1]=A

for h in range(A,C+1):
    for w in range(B,D+1):
        if h==A and w==B:
            dp[A][B]=1
            continue

        if h>A and w>B:
            x=dp[h][w-1]*h
            y=dp[h-1][w]*w
            z=dp[h-1][w-1]*(h-1)*(w-1)
            sub=x+y-z
            dp[h][w]=(sub)%p
        elif h==A:
            dp[h][w]=(dp[h][w-1]*h)%p
        else:
            dp[h][w]=(dp[h-1][w]*w)%p


print(dp[C][D])

### FIXED CODE ###

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

#上と右

p=998244353
dp=[[0]*(D+1) for _ in range(C+1)]



for h in range(A,C+1):
    for w in range(B,D+1):
        if h==A and w==B:
            dp[A][B]=1
            continue

        if h>A and w>B:
            x=dp[h][w-1]*h
            y=dp[h-1][w]*w
            z=dp[h-1][w-1]*(h-1)*(w-1)
            sub=x+y-z
            dp[h][w]=(sub)%p
        elif h==A:
            dp[h][w]=(dp[h][w-1]*h)%p
        else:
            dp[h][w]=(dp[h-1][w]*w)%p


print(dp[C][D])
N, W = map(int, input().split())
dp = [[0] * W for _ in range(N+1)]
weights = list()
values = list()
for _ in range(N):
    w, v = map(int, input().split())
    weights.append(w)
    values.append(v)

for i in range(N):
    for w in range(W):
        if w >= weights[i]: 
            dp[i+1][w] = max(dp[i][w-weights[i]] + values[i], dp[i][w])
        else:
            dp[i+1][w] = dp[i][w]

print(dp[n][W])


### FIXED CODE ###

N, W = map(int, input().split())
dp = [[0] * (W+1) for _ in range(N)]
weights = list() 
values = list() 
for _ in range(N):
    v, w = map(int, input().split())
    values.append(v)
    weights.append(w)

for n in range(N):
    for w in range(1, W+1):
        if n == 0 and w >= weights[n]:
            dp[n][w] = values[n]
        elif w >= weights[n]: 
            dp[n][w] = max(dp[n-1][w-weights[n]] + values[n], dp[n-1][w])
        else:
            dp[n][w] = dp[n-1][w]
print(dp[N-1][W])
a, b, k = input().split()
a = int(a)
b = int(b)
k = int(k)

first_a = a
a -= k if k < a else a
k -= first_a if a == 0 else 0
b -= k

print(f"{a} {b}")

### FIXED CODE ###

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

first_a = a
a -= k if k < a else a
k -= first_a if a == 0 else 0
b -= 0 if a != 0 else k
b = 0 if b < 0 else b

print(a, end=" ")
print(b)
A = input()
B = input()

ans = ['1', '2', '3']

for i in range(len(ans)):
  if ans[i] == A or ans[i] == B:
    del ans[i]
    
print(nas[0])


### FIXED CODE ###

A = int(input())
B = int(input())
print(6 - A - B)
from functools import reduce
from itertools import combinations
N = int(input())
S = {"M": set([]), "A": set([]), "R": set([]), "C": set([]), "H": set([])}
for _ in range(N):
    i = input()
    head = i[0]
    if head == "M":
        S["M"].add(i)
    elif head == "A":
        S["A"].add(i)
    elif head == "R":
        S["R"].add(i)
    elif head == "C":
        S["C"].add(i)
    elif head == "H":
        S["H"].add(i)
result = [len(S[head]) for head in list("MARCH") if len(S[head]) != 0]

ans = sum([reduce(lambda x, y: x * y, list(combinations(result, 3))[i])
           for i in range(len(result))])
print(ans)


### FIXED CODE ###

from functools import reduce
from itertools import combinations
N = int(input())
S = {"M": [], "A": [], "R": [], "C": [], "H": []}
for _ in range(N):
    i = input()
    head = i[0]
    if head == "M":
        S["M"].append(i)
    elif head == "A":
        S["A"].append(i)
    elif head == "R":
        S["R"].append(i)
    elif head == "C":
        S["C"].append(i)
    elif head == "H":
        S["H"].append(i)
counter = [len(S[head]) for head in list("MARCH") if len(S[head]) != 0]
combs = list(combinations(counter, 3))
ans = sum([reduce(lambda x, y: x * y, e) for e in combs])
print(ans)
import itertools

n = int(input())
a = [int(x) for x in input().split()]


base = max(a)
ans = 0
ans_set = []
for x in a:
    if x == base:
        pass
    elif len(list(itertools.combinations(range(1, base+1), x))) > ans:
        ans = len(list(itertools.combinations(range(1, base+1), x)))
        ans_set = [base, x]
print(*ans_set)

### FIXED CODE ###

n = int(input())
a = [int(x) for x in input().split()]

base = max(a)
tmp = 10**9
tmp_i = 0
for x in a:
    if x == base:
        pass
    elif abs(base - 2*x) < tmp:
        tmp = abs(base - 2*x)
        tmp_i = x

print(base, tmp_i)
ABCD = input()
A = int(ABCD[0])
B = int(ABCD[1])
C = int(ABCD[2])
D = int(ABCD[3])
if A + B + C + D == 7:
    print(str(A) + "+" + str(B) + "+" + str(C) + "+" + str(D) + "=7")
    break
if A - B + C + D == 7:
    print(str(A) + "-" + str(B) + "+" + str(C) + "+" + str(D) + "=7")
    break
if A + B - C + D == 7:
    print(str(A) + "+" + str(B) + "-" + str(C) + "+" + str(D) + "=7")
    break
if A + B + C - D == 7:
    print(str(A) + "+" + str(B) + "+" + str(C) + "-" + str(D) + "=7")
    break
if A - B - C + D == 7:
    print(str(A) + "-" + str(B) + "-" + str(C) + "+" + str(D) + "=7")
    break
if A - B + C - D == 7:
    print(str(A) + "-" + str(B) + "+" + str(C) + "-" + str(D) + "=7")
    break
if A + B - C - D == 7:
    print(str(A) + "+" + str(B) + "-" + str(C) + "-" + str(D) + "=7")
    break
if A - B - C - D == 7:
    print(str(A) + "-" + str(B) + "-" + str(C) + "-" + str(D) + "=7")
    break

### FIXED CODE ###

ABCD = input()
A = int(ABCD[0])
B = int(ABCD[1])
C = int(ABCD[2])
D = int(ABCD[3])
for i in range(1):
    if A + B + C + D == 7:
        print(str(A) + "+" + str(B) + "+" + str(C) + "+" + str(D) + "=7")
        exit()
    if A - B + C + D == 7:
        print(str(A) + "-" + str(B) + "+" + str(C) + "+" + str(D) + "=7")
        exit()
    if A + B - C + D == 7:
        print(str(A) + "+" + str(B) + "-" + str(C) + "+" + str(D) + "=7")
        exit()
    if A + B + C - D == 7:
        print(str(A) + "+" + str(B) + "+" + str(C) + "-" + str(D) + "=7")
        exit()
    if A - B - C + D == 7:
        print(str(A) + "-" + str(B) + "-" + str(C) + "+" + str(D) + "=7")
        exit()
    if A - B + C - D == 7:
        print(str(A) + "-" + str(B) + "+" + str(C) + "-" + str(D) + "=7")
        exit()
    if A + B - C - D == 7:
        print(str(A) + "+" + str(B) + "-" + str(C) + "-" + str(D) + "=7")
        exit()
    if A - B - C - D == 7:
        print(str(A) + "-" + str(B) + "-" + str(C) + "-" + str(D) + "=7")
        exit()
def resolve():
    n, m = map(int, input().split())
    li_broken = [int(input()) for _ in range(m)]
    dp = [0] * (n + 2)

    for i in reversed(range(n + 1)):

        if i == n:
            dp[i] = 1
            continue

        if i in li_broken:
            dp[i] = 0
            continue

        dp[i] = dp[i+1] + dp[i+2]

    print(dp[0] % 1000000007)（）
    
resolve()

### FIXED CODE ###

def step(n):
  if n == 0:
      return 1
  steps = [0 for i in range(n + 2)]
  steps[1] = 1
  steps[2] = 2
  for i in range(3, n + 1):
    steps[i] = steps[i - 1] + steps[i - 2]
  return steps[n]

n, m = map(int, input().split())
a = [int(input()) for _ in range(m)]

a.append(n)

sum = 1

for i in range(m + 1):

  if i == 0:
    sum *= step(a[i] - 1)
    continue
  
  elif i == m:
    sum *= step(a[m] - a[m-1] -1)
    
  elif a[i] - a[i-1] == 1:
    sum = 0
    break

  else:
    sum *= step(a[i] - a[i-1] -2)
    
if m == 0:
  sum = step(n)

print(sum % 1000000007)
def rec(vv):
    res = 0
    for nv in g[vv]:
        if p[nv] >= 0:
            res = max(res, p[nv] + 1)
        else:
            res = max(res, rec(nv) + 1)
    p[vv] = res
    return res


N, M = map(int, input().split())
g = [[] for _ in range(N)]
p = [-1 for _ in range(N)]

for _ in range(M):
    x, y = map(int, input().split())
    x -= 1
    y -= 1
    g[x].append(y)

ans = 0
for v in range(N):
    ans = max(ans, rec(v))
print(ans)


### FIXED CODE ###

import sys

sys.setrecursionlimit(10 ** 9)


def rec(v):
    if dp[v] != -1:
        return dp[v]

    res = 0
    for nv in g[v]:
        res = max(res, rec(nv) + 1)
    dp[v] = res
    return res


N, M = map(int, input().split())
g = [[] for _ in range(N)]
for _ in range(M):
    x, y = map(int, input().split())
    x -= 1
    y -= 1
    g[x].append(y)

dp = [-1 for _ in range(N)]

ans = 0
for t in range(N):
    ans = max(ans, rec(t))
print(ans)
S,T=map(int,input().split())
A,B=map(int,input().split())
U=int(input())

if S==U:
    A-=1
else:
    B-=1

print(str(A)+" "+str(B))


### FIXED CODE ###

S,T=input().split()
A,B=map(int,input().split())
U=input()

if S==U:
    A-=1
else:
    B-=1

print(str(A)+" "+str(B))
a,b=map(int,input().split())
c=[list(map(int,input().split())) for i in range(a-1)]
d=[list(map(int,input().split())) for i in range(b)]
e=[[]for i in range(a)]

for i in c:
  e[i[0]-1].append(i[1]-1)
  e[i[1]-1].append(i[0]-1)


g=[[i]for i in range(a)]

def s(i,e,f):
  for j,k in enumerate(e[i]):
    if f==k:
      e[i].pop(j)
      break
  if e[i]==[]:
    return []
  global g
  g[i]=g[i]+e[i]
  for j in e[i]:
    g[i]=g[i]+s(j,e,i)
  return e[i]


s(0,e,0) 
h=[0 for i in range(a)]
for i in d:
  for j in g[i[0]-1]:
    h[j]+=i[1]
    
print(" ".join(map(str,h)))
    
  

  
  

### FIXED CODE ###

from collections import deque
a,b=map(int,input().split())
e=[[]for i in range(a)]

for i in range(a-1):
  c1,c2=map(int,input().split())
  e[c1-1].append(c2-1)
  e[c2-1].append(c1-1)

g=[[]for i in range(a)]
f=deque()
f.append((0,-1))
ans=[0 for _ in range(a)]
for i in range(b):
  ten,p=map(int,input().split())
  ans[ten-1]+=p
i=0
while len(f)!=0:
  i,fr=f.popleft()
  for j in e[i]:
    if j==fr:
      continue
    else:
      ans[j]+=ans[i]
      f.append([j,i]) 
print(*ans)
n = int(input())
s_list = list(input())
mod = 10 ** 9 + 7

if s_list[0] == "W" or s_list[-1] == "W":
    print(0)
    return

from math import factorial

l_counter = 0
res = 1

for i in range(2 * n):
    s = s_list[i]
    if i % 2 == 0:
        s = "W" if s == "B" else "B"

    if s == "W":
        l_counter += 1
    else:
        res *= l_counter
        l_counter -= 1
        if l_counter < 0:
            print(0)
            return

if l_counter != 0:
    print(0)
else:
    print(res * factorial(n) % mod)

### FIXED CODE ###

import math
n = int(input())
s = [0 if i == "W" else 1 for i in list(input())]
cnt = 0
c = 1
for i in range(n * 2):
    if (s[i] + cnt) % 2 != 0:
        cnt += 1
    else:
        c = (c * (cnt if cnt != 0 else 1)) % (10 ** 9 + 7)
        cnt -= 1
    if cnt < 0:
        print(0)
        exit()
if cnt != 0:
    print(0)
else:
    print((c * math.factorial(n)) % (10 ** 9 + 7))
a, b, c, x = map(int, [input() for i in range(4)])
ans = 0
for i in range(a+1):
    for j in range(b+1):
        for k in range(c+1):
            in i * 500 + j * 100 + k * 50 == x:
                ans += 1
print(ans)

### FIXED CODE ###

a, b, c, x = map(int, [input() for i in range(4)])
ans = 0
for i in range(a+1):
    for j in range(b+1):
        for k in range(c+1):
            if i * 500 + j * 100 + k * 50 == x:
                ans += 1
print(ans)
# https://atcoder.jp/contests/abc063/tasks/arc075_b
import sys
import itertools
from collections import Counter
from collections import defaultdict
from collections import deque
import bisect
from heapq import heappush, heappop
import math
sys.setrecursionlimit(12345678)


def can_delete(ml, t, a, b):
    for i in range(len(ml)):
        ml[i] -= (b * t)

    count = 0
    for m in ml:
        if m > 0:
            count += math.ceil(m/(a-b))

    return t >= count


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

    l = 0
    r = 10**9
    while l < r:
        m = (l + r) // 2
        if can_delete(monsters.copy(), m, a, b):
            r = m
        else:
            l = m + 1

    print(r)


if __name__ == '__main__':
    main()


### FIXED CODE ###

# https://atcoder.jp/contests/abc063/tasks/arc075_b
import sys
import itertools
from collections import Counter
from collections import defaultdict
from collections import deque
import bisect
from heapq import heappush, heappop
import math
sys.setrecursionlimit(12345678)


def can_delete(ml, t, a, b):
    for i in range(len(ml)):
        ml[i] -= (b * t)

    count = 0
    for m in ml:
        if m > 0:
            count += math.ceil(m/(a-b))

    return t >= count


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

    l = 0
    r = 10**9
    while l < r:
        m = (l + r) // 2
        if can_delete(monsters.copy(), m, a, b):
            r = m
        else:
            l = m + 1

    print(r)


if __name__ == '__main__':
    main()
import sys
import numpy as np

read = sys.stdin.read
readline = sys.stdin.readline
readlines = sys.stdin.readlines
sys.setrecursionlimit(10 ** 9)
INF = 1 << 60
MOD = 1000000007


def main():
    N, *A = map(int, read().split())
    A = np.array(A)
    C = np.zeros((N, N))
    for i in range(N):
        C[i, i] = C[i, (i + 1) % N] = 1

    X = np.linalg.solve(C, A)
    X = [int(x * 2) for x in X]

    print(*X)
    return


if __name__ == '__main__':
    main()


### FIXED CODE ###

import sys

read = sys.stdin.read
readline = sys.stdin.readline
readlines = sys.stdin.readlines
sys.setrecursionlimit(10 ** 9)
INF = 1 << 60
MOD = 1000000007


def main():
    N, *A = map(int, read().split())
    X = [0] * N
    X[-1] = A[-1]
    for i, a in enumerate(A[:-1]):
        if i % 2:
            X[-1] += a
        else:
            X[-1] -= a

    for i in range(N - 2, -1, -1):
        X[i] = 2 * A[i] - X[i + 1]

    print(*X)
    return


if __name__ == '__main__':
    main()
a, b = (int(i) for i in input().split())  
if a%2 and b%2:
  	print("Yes")
  else:
    print("No")

### FIXED CODE ###

a, b = (int(i) for i in input().split())
if a % 2 and b % 2:
    print("Yes")
else:
    print("No")
n = int(input())
soFar = []
last = None
flag = True
for i in range(n + 1):
    x = input()
    if i == 0:
        soFar.append(x)
        last = x
    else:
        if x not in soFar and last[len(last) - 1] == x[0]:
            soFar.append(x)
            last = x
        else:
            flag = False
            break
if flag:
    print('Yes')
else:
    print('No')


### FIXED CODE ###

n = int(input())
w = [input() for i in range(n)]
count = 0
for i in range(1, n):
    if w[i - 1][len(w[i - 1]) - 1] != w[i][0]:
        count += 1
if count == 0 and len(list(set(w))) == n:
    print('Yes')
else:
    print('No')
N, M = map(int, input().split())
pref_dict = {}

for i in range(M):
    P, Y = map(int, input().split())
    pref_dict[i] = [P, Y]

sorted_dict = sorted(pref_dict.items(), key= lambda x: (x[1][0], x[1],[1]))
print(sorted_dict)

ans_dict = {}
buf = ""
count = 1

for tup in sorted_dict:

    row = tup[0]
    pref_name = f"00000{tup[1][0]}"[-6:]

    if pref_name == buf:
        count += 1
    else:
        count = 1

    pref_id = f"00000{count}"[-6:]
    ans_dict[row] = [pref_name, pref_id]
    buf = pref_name

for key, value in sorted(ans_dict.items(), key=lambda x: x[0]):
    print(*value, sep="")

### FIXED CODE ###

N, M = map(int, input().split())
pref_dict = {}

for i in range(M):
    P, Y = map(int, input().split())
    pref_dict[i] = [P, Y]

sorted_dict = sorted(pref_dict.items(), key= lambda x: (x[1][0], x[1],[1]))
ans_dict = {}
buf = ""
count = 1

for tup in sorted_dict:

    row = tup[0]
    pref_name = "00000{}".format(tup[1][0])
    pref_name = pref_name[-6:]

    if pref_name == buf:
        count += 1
    else:
        count = 1

    pref_id = "00000{}".format(count)
    pref_id = pref_id[-6:]
    ans_dict[row] = [pref_name, pref_id]
    buf = pref_name

for key, value in sorted(ans_dict.items(), key=lambda x: x[0]):
    print(*value, sep="")
import math

ranks = [False for i in range(8)]
highs = 0
n = int(input())
inps = [int(i) for i in input().split()]
highs = len([i for i in inps if i > 3199])
inps = [i for i in inps if i <= 3199]
for i in inps:
    ranks[math.floor(i/399)] = True

lows = len([i for i in ranks if i == True]) 

minimum = max(lows, 1)
maximum = lows + highs

print(minimum, maximum)


### FIXED CODE ###

import math

ranks = [False for i in range(8)]
highs = 0
n = int(input())
inps = [int(i) for i in input().split()]
highs = len([i for i in inps if i > 3199])
inps = [i for i in inps if i <= 3199]
for i in inps:
    if i >= 1 and i <= 399:
        ranks[0] = True
    elif i >= 400 and i <= 799:
        ranks[1] = True
    elif i >= 800 and i <= 1199:
        ranks[2] = True
    elif i >= 1200 and i <= 1599:
        ranks[3] = True
    elif i >= 1600 and i <= 1999:
        ranks[4] = True
    elif i >= 2000 and i <= 2399:
        ranks[5] = True
    elif i >= 2400 and i <= 2799:
        ranks[6] = True
    elif i >= 2800 and i <= 3199:
        ranks[7] = True
lows = len([i for i in ranks if i == True])

minimum = max(lows, 1)
maximum = lows + highs

print(minimum, maximum)
N=int(input())
A=list(map(int,input().split()))
B=[0]*(N//2+N%2)
ans=0
ans2=0
if N%2==0:
    for i in range(N):
        if A[i]%2==1 and (A[i]+1)/2<=N/2:
            B[(A[i]-1)//2]+=1
        else:
            print(0)
            exit()
    for i in range(len(B)):
        if B[i]!=2:
            print(0)
            exit()
    ans=pow(2,N/2)%(pow(10,9)+7)
    ans2=int(ans)
    print(ans2)
elif N%2==1:
    for i in range(N):
        if A[i]%2==0 and A[i]/2<=(N-1)/2:
            B[A[i]//2]+=1
        else:
            print(0)
            exit()
    if B[0]!=1:
        print(0)
        exit()
    for i in range(len(B)-1):
        if B[i+1]!=2:
            print(0)
            exit()
    ans=pow(2,(N-1)/2)%(pow(10,9)+7)
    ans2=int(ans)
    print(ans2)
else:
    print(0)

### FIXED CODE ###

N=int(input())
A=list(map(int,input().split()))
B=[0]*(N//2+N%2)
IndexCount=0
IndexRe=0
Divider=pow(10,9)+7
ans=1
if N%2==0:
    for i in range(N):
        if A[i]%2==1 and (A[i]+1)/2<=N/2:
            B[(A[i]-1)//2]+=1
        else:
            print(0)
            exit()
    for i in range((N//2+N%2)):
        if B[i]!=2:
            print(0)
            exit()
    IndexCount=int((N/2)//1000)
    IndexRe=int((N/2)%1000)
    for i in range(IndexCount):
        ans=(ans*(pow(2,1000)%Divider))%Divider
    ans=(ans*(pow(2,IndexRe)%Divider))%Divider
    print(ans)
elif N%2==1:
    for i in range(N):
        if A[i]%2==0 and A[i]/2<=(N-1)/2:
            B[A[i]//2]+=1
        else:
            print(0)
            exit()
    if B[0]!=1:
        print(0)
        exit()
    for i in range((N//2+N%2)-1):
        if B[i+1]!=2:
            print(0)
            exit()
    IndexCount=int(((N-1)/2)//1000)
    IndexRe=int(((N-1)/2)%1000)
    for i in range(IndexCount):
        ans=(ans*(pow(2,1000)%Divider))%Divider
    ans=(ans*(pow(2,IndexRe)%Divider))%Divider
    print(ans)
else:
    print(0)
n,m=map(int, input().split())
an=[int(i)//2 for i in input().split()]
ma=max(an)
count=0
q=1
mk=0
while m>=ma*q:
    for ak in an:
        if (ma*q)%ak==0 and ((ma*q)//ak)%2==1:
            mk=ma*q
        else:
            break
    q+=2
    if mk!=0
        break
print(m//mk)

### FIXED CODE ###

n,m=map(int, input().split())
an=[int(i) for i in input().split()]
import fractions
ans=an[0]
for i in range(1, n):
    ans = ans * an[i] // fractions.gcd(ans, an[i])

def count2(i):
    if i%2==0:
        c=0
        while i%2==0:
            i//=2
            c+=1
        return c
    else:
        return 0
    
c2=count2(ans)

for ak in an:
    if ak%(2**c2)==0:
        d=1
        pass
    else:
        d=0
        break

if d==0:
    print(0)
else:
    lca=ans//2
    if (m//lca)%2==0:
        print((m//lca)//2)
    else:
        print(((m//lca)+1)//2)
S = int(input())

first_half = round(S, -2) / 100
second_half = S - round(S, -2)

if 1 <= second_half <= 12 and 1 <= first_half <= 12 :
  print("AMBIGUOUS")
else:
  if 1 <= second_half <= 12 :
   		print("YYMM")
  elif 1 <= first_half <= 12 :
    	print("MMYY")
  else: 
        print("NA")

### FIXED CODE ###

N,K = map(int,input().split())
S = input()

letters = list(S)
letters[K-1] = letters[K-1].lower()

new_S = ""

for letter in letters:
  new_S += letter
  
print(new_S)
A, B, C, D = map(int, input().split())

Cprimes = {}
Dprimes = {}

tmpC = C
d = 2
while tmpC > 1:
    if tmpC % d == 0:
        if d in Cprimes:
            Cprimes[d] += 1
        else:
            Cprimes[d] = 1
        tmpC //= d
    else:
        d += 1

tmpD = D
d = 2
while tmpD > 1:
    if tmpD % d == 0:
        if d in Dprimes:
            Dprimes[d] += 1
        else:
            Dprimes[d] = 1
        tmpD //= d
    else:
        d += 1

comPrimes = {}
for k in Cprimes:
    comPrimes[k] = Cprimes[k]
for k in Dprimes:
    if k in comPrimes:
        if comPrimes[k] < Dprimes[k]:
            comPrimes[k] = Dprimes[k]
    else:
        comPrimes[k] = Dprimes[k]

comVal = 1
for k in comPrimes:
    comVal *= k**comPrimes[k]

#print(Cprimes)
#print(Dprimes)
#print(comPrimes)
#print(comVal)

CdivNum = B//C - (A-1)//C
DdivNum = B//D - (A-1)//D
comDivNum = B//comVal - (A-1)//comVal
ans = B-(A-1)
ans -= CdivNum
ans -= DdivNum
ans += comDivNum

print(ans)


### FIXED CODE ###

N = int(input())
BA = [[0] * 2 for i in range(N)]
for i in range(N):
    A, B = map(int, input().split())
    BA[i][0] = B
    BA[i][1] = A

BA.sort()
t = 0
ans = 'Yes'
#print(BA)
for ba in BA:
    B = ba[0]
    A = ba[1]
    t += A
    if t > B:
        ans = 'No'
        break

print(ans)