Harryxun/stf_run huggingface dataset:
import sys
sys.setrecursionlimit(10**12)

def modinv(a,m=10**9+7):
    if a==0: return 1
    else:
        b=m
        (x, lastx) = (0, 1)
        (y, lasty) = (1, 0)
        while b != 0:
            q = a // b
            (a, b) = (b, a % b)
            (x, lastx) = (lastx - q * x, x)
            (y, lasty) = (lasty - q * y, y)
        return lastx % m

def cur(p):
    if neighbor[p]==[]: return
    for x in neighbor[p]:
        par[x]=p
        neighbor[x].remove(p)
        cur(x)
    descend[par[p]]+=descend[p]

def cur2(p):
    for x in neighbor[p]:
        ans[x]=ans[p]*descend[x]*modinv(n-descend[x])
        ans[x]%=mod
        cur2(x)

mod=10**9+7
n=int(input())
neighbor=[set()  for _ in range(n+2)]
descend=[1 for i in range(n+1)]
par=[0]+[0]*(n+1)

for _ in range(n-1):
    a,b=map(int,input().split())
    neighbor[a].add(b)
    neighbor[b].add(a)

cur(1)


ans=[1]*(n+1)
ans1=1
for i in range(1,n+1):
    ans1=ans1*i*modinv(descend[i])
    ans1%=mod
ans[1]=ans1

cur2(1)

for i in range(1,n+1):
    print(ans[i])

### FIXED CODE ###

import sys
sys.setrecursionlimit(10**7)

def modinv(a,m=10**9+7):
    if a==0: return 1
    else:
        b=m
        (x, lastx) = (0, 1)
        (y, lasty) = (1, 0)
        while b != 0:
            q = a // b
            (a, b) = (b, a % b)
            (x, lastx) = (lastx - q * x, x)
            (y, lasty) = (lasty - q * y, y)
        return lastx % m

def cur(p):
    if neighbor[p]==[]: return
    for x in neighbor[p]:
        par[x]=p
        neighbor[x].remove(p)
        cur(x)
    descend[par[p]]+=descend[p]

def cur2(p):
    for x in neighbor[p]:
        ans[x]=ans[p]*descend[x]*modinv(n-descend[x])
        ans[x]%=mod
        cur2(x)

mod=10**9+7
n=int(input())
neighbor=[set()  for _ in range(n+2)]
descend=[1 for i in range(n+1)]
par=[0]+[0]*(n+1)

for _ in range(n-1):
    a,b=map(int,input().split())
    neighbor[a].add(b)
    neighbor[b].add(a)

cur(1)


ans=[1]*(n+1)
ans1=1
for i in range(1,n+1):
    ans1=ans1*i*modinv(descend[i])
    ans1%=mod
ans[1]=ans1

cur2(1)

for i in range(1,n+1):
    print(ans[i])
a,b,c=map(int,input().split())
if c-a-b<=0:
	print("No")
else:
	p=(a*b)**(1/2)
	if 2*p<(c-a-b):
    	print("Yes")
    else:
    	print("No")

### FIXED CODE ###

a,b,c=map(int,input().split())
if c-a-b<=0:
	print("No")
else:
	if 4*a*b<(c-a-b)**2:
		print("Yes")
	else:
		print("No")
l,r=map(int,input().split())
if r-l>=3000: print(0)
else:
    min_mod=2018
    for i in range(l,r+1):
        for j in range(i+1,r+1):
            min_mod = min(min_mod, i*j%2019)
print(min_mod)

### FIXED CODE ###

l,r=map(int,input().split())
mod=2019
if r-l>=2019: print(0)
else:
    res=2018 #2019の剰余なので最大でも2018
    for i in range(l,r):
        for j in range(i+1,r+1):
            res = min(res, (i*j)%mod)
    print(res)
H,W = map(int, input().split())


h = 0
w = 0
w1 = w2 = 0
if W % 2 == 1:#横が奇数
    w = int(W /2) + 1
    if H % 2 == 1:#縦が奇数
        h = int(H / 2) + 1
        w1 = h * w
        w2 = (w-1) * (h-1)
        print(w1 + w2)
    else:#縦が偶数
        h = int(H / 2)
        w1 = w * h
        w2 = (w-1) * h
        print(w1 + w2)
        
        
else:#横が偶数
    w = int(W / 2)
    print(w * H)


### FIXED CODE ###


K = int(input())


S = [1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51]

print(S[K-1])
import numpy as np

n,s = map(int,input().split())
a = list(map(int,input().split()))
mod = 998244353

res = 0
dp = np.zeros(s + 1)

for i in range(n):
    dp[0] += 1
    dp[a[i]:] += dp[:s+1-a[i]]
    dp %= mod
    res += dp[s]
    res %= mod

print(int(res))


### FIXED CODE ###

import numpy as np

n,s = map(int,input().split())
a = list(map(int,input().split()))
mod = 998244353

res = 0
dp = np.zeros(s + 1, dtype = int)

for i in range(n):
    dp[0] += 1
    dp[a[i]:] += dp[:-a[i]].copy()
    dp %= mod
    res += dp[s]
    res %= mod

print(res)
class UnionFind:
    def __init__(self, size: int):
        self.__size = size
        self.__root = [-1] * size

    def root(self, x: int)->int:
        if self.__root[x] < 0:
            return x
        self.__root[x] = self.root(self.__root[x])
        return self.__root[x]

    def size(self, x: int)->int:
        root = self.root(x)
        return self.__root[root]

    def same(self, x: int, y: int)->bool:
        return self.root(x) == self.root(y)

    def unite(self, x: int, y: int):
        rx, ry = self.root(x), self.root(y)

        if rx == ry:
            return

        if ry < rx:
            rx, ry = ry, rx

        self.__root[rx] += self.__root[ry]
        self.__root[ry] = rx


def connectivity(N: int, K: int, L: int, roads: list, rails: list)->list:
    road_uf, rail_uf = UnionFind(N), UnionFind(N)

    for p, q in roads:
        road_uf.unite(p-1, q-1)

    for r, s in rails:
        rail_uf.unite(r-1, s-1)

    freq = {}
    for i in range(N):
        p = (road_uf.root(i), rail_uf.root(i))
        freq.setdefault(p, 0)
        freq[p] += 1

    return [freq[(road_uf.root(i), rail_uf.root(i))] for i in range(N)]


if __name__ == "__main__":
    K = 0
    L = 0
    N, K, L = map(int, input().split())
    roads = [tuple(int(s) for s in input().split()) for _ in range(K)]
    rails = [tuple(int(s) for s in input().split()) for _ in range(K)]
    ans = connectivity(N, K, L, roads, rails)
    print(' '.join(map(str, ans)))


### FIXED CODE ###

class UnionFind:
    def __init__(self, size: int):
        self.__size = size
        self.__root = [-1] * size

    def root(self, x: int)->int:
        if self.__root[x] < 0:
            return x
        self.__root[x] = self.root(self.__root[x])
        return self.__root[x]

    def size(self, x: int)->int:
        root = self.root(x)
        return self.__root[root]

    def same(self, x: int, y: int)->bool:
        return self.root(x) == self.root(y)

    def unite(self, x: int, y: int):
        rx, ry = self.root(x), self.root(y)

        if rx == ry:
            return

        if ry < rx:
            rx, ry = ry, rx

        self.__root[rx] += self.__root[ry]
        self.__root[ry] = rx


def connectivity(N: int, K: int, L: int, roads: list, rails: list)->list:
    road_uf, rail_uf = UnionFind(N), UnionFind(N)

    for p, q in roads:
        road_uf.unite(p-1, q-1)

    for r, s in rails:
        rail_uf.unite(r-1, s-1)

    freq = {}
    for i in range(N):
        p = (road_uf.root(i), rail_uf.root(i))
        freq.setdefault(p, 0)
        freq[p] += 1

    return [freq[(road_uf.root(i), rail_uf.root(i))] for i in range(N)]


if __name__ == "__main__":
    K = 0
    L = 0
    N, K, L = map(int, input().split())
    roads = [tuple(int(s) for s in input().split()) for _ in range(K)]
    rails = [tuple(int(s) for s in input().split()) for _ in range(L)]
    ans = connectivity(N, K, L, roads, rails)
    print(' '.join(map(str, ans)))
n,m=map(int,input().split())
d=["a"]*n
ans=""
for i in range(m):
    s,c=map(str,input().split())
    s=int(s)
    if d[s-1]=="a" or d[s-1]==c:
        d[s-1]=c #置き換え
    else:
        ans="-1"
        break
if d[0]=="0":
    print(-1)
elif d[0]=="a":
    d[0]="1"
    if d[2]=="a":
        print(-1)
    else:
        print(("".join(d)))
else:
    print(("".join(d)).replace("a","0"))

### FIXED CODE ###

n,m=map(int,input().split())
d=["a"]*n
ans=""
if n==1 and m==0:
    print(0)
    exit()
for i in range(m):
    s,c=map(str,input().split())
    if s=="1" and c=="0" and n==1:
        print(0)
        exit()
    s=int(s)
    if d[s-1]=="a" or d[s-1]==c:
        d[s-1]=c #置き換え
    else:
        ans="-1"
        print(ans)
        break
if d[0]!="0" and ans!="-1":
    if d[0]=="a" or d[0]=="0":
        print("".join(["1"]+d[1:]).replace("a","0"))
    else:
        print(("".join(d)).replace("a","0"))
elif d[0]=="0":
    print(-1)
a, b = int(input())
if (a*b)%2 == 0:
  print('Even')
elif (a*b)%2 == 1:
  print('Odd')

### FIXED CODE ###

a, b = map(int, input().split())
if (a*b)%2 == 0:
    print('Even')
elif (a*b)%2 == 1:
    print('Odd')
# ABC141
def main():
    N, M, *A = map(int, open(0).read().split())
    if N == 1:
        ans = A[0] >> M
        print(ans)
        return
    A.sort(reverse=1)
    A += [0, 0]
    cur, prev = 0, 0
    for _ in range(M):
        x, y = A[cur] >> 1, A[cur + 1] >> 1
        if x > y:
            A[cur] = x
        else:
            A[cur + 1] = y
        if A[cur + 2] >= A[cur]:
            cur += 1
    ans = sum(A)
    print(ans)


if __name__ == "__main__":
    main()

### FIXED CODE ###

# ABC141D - Powerful Discount Tickets
from heapq import heapify, heappop, heappush


def main():
    N, M, *A = map(int, open(0).read().split())
    B = [-i for i in A]
    heapify(B)
    for _ in range(M):
        x = -heappop(B) >> 1
        heappush(B, -x)
    ans = -sum(B)
    print(ans)


if __name__ == "__main__":
    main()
#Partition
import math
N,M = map(int,input().split())
n = 1
rootM = int(math.sqrt(M))
for i in range(rootM+1):
    if M % (i+1) == 0 and N*(i+1) <= M:
        n = i+1
if N == 1:
    n = M
print(n)

### FIXED CODE ###

#Programming Education
N = int(input())
if N == 1:
    print("Hello World")
else:
    A = int(input())
    B = int(input())
    print(A+B)
n,m = map(int,input().split())
a = list(map(int,iuput().split()))
x = n - sum(a)
if x >= 0:
    print(x)
else:
    print(-1)

### FIXED CODE ###

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

c = list(map(int,input().split()))
c_sum = sum(c)

day_count = n-c_sum

if day_count>=0:
  print(day_count)
else:
  print(-1)
n,k,*a=map(int,open(0).read().split())
d=[2*k]*n
s=0
while k:s=a[s]-1;d[s]=k=~-k%(d[s]-k)
print(s+1)

### FIXED CODE ###

n,k,*a=map(int,open(0).read().split())
d=[0]+[-1]*n
s=0
for i in range(k):
  s=a[s]-1
  if(j:=d[s])>-1:
    exec((k-j)%(i+1-j)*'s=a[s]-1;')
    exit(print(s+1))
  d[s]=i+1
print(s+1)
n=int(input())

if n%2==1:
    print(0)
    exit(0)
def findTrailingZeros(n):
    # Initialize result
    count = 0

    i = 10

    while (i<=n):
        count+=floor(n/i)
        i *= 5

    return count
get5s=findTrailingZeros(n)
print(get5s)



### FIXED CODE ###

n=int(input())


def findTrailingZeros(n):
    # Initialize result
    count = 0

    i = 10

    while (i<=n):
        count+=n//i
        i *= 5

    return count


if n % 2 == 1:
    print(0)
else:
 get5s=findTrailingZeros(n)
 print(get5s)
h, w = map(int, input().split())

a = h * w
if a % 2 == 0:
  print(int(a / 2))
else:
  print(int;((a + 1) / 2))

### FIXED CODE ###

h, w = map(int, input().split())

if h == 1 or w == 1:
  print(1)
else:
  a = h * w
  if a % 2 == 0:
    print(int(a / 2))
  else:
    print(int((a + 1) / 2))
h = input()
score = 0
fak = 1
while h>1:
	score += fak
	h //= 2
	fak *= 2
print(score+1)

### FIXED CODE ###

h = int(input())
score = 0
fak = 1
while h>1:
	score += fak
	h = int(h/2)
	fak *= 2
print(score+fak)
n, m = map(int, input().split)
a = list(map(int, input().split()))
ct = 0
for i in range(m):
    ct += a[i]

if n - ct >= 0:
    print(n - ct)
else:
    print(-1)


### FIXED CODE ###

n, m = map(int, input().split())
a = list(map(int, input().split()))
ct = 0
for i in range(m):
    ct += a[i]

if n - ct >= 0:
    print(n - ct)
else:
    print(-1)
##この問題はグループの最大人数を求めれば良い

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

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

#print(a[0][1])

l = [n+1]*n
# lで何のグループに属しているか判定する
p = [1]*n
# lでどのグループがどのくらいのpowerを持っているか判定する

##最終的にlがn+1でない中で,pが一番大きいのを解答に出す
##ただ,これでは更新頻度がえぐいため工夫がいる.


for j in range(m):
    if(l[a[j][0]] == n+1 & l[a[j][1]] == n+1):
        if(a[j][0] > a[j][1]):
            l[a[j][0]] = a[j][1]
            l[a[j][1]] = a[j][1]
            p[a[j][1]] = 2
        else:
            l[a[j][0]] = a[j][0]
            l[a[j][1]] = a[j][0]
            p[a[j][0]] = 2

    elif(l[a[j][0]] != n+1 & l[a[j][1]] != n+1):
        if(l[a[j][0]] < l[a[j][1]]):

            ###give up


### FIXED CODE ###

# union-find を使う

# unionするクエリが飛んでくる(クエリ:要求)
# find(どのグループ,集合かわかるようにする)
# findはある要素とある要素が同じグループに属するか,そのグループのサイズはどうか
# この二つを処理する

# 計算量 O(log N) か 工夫すると O(a(N)):アッカーマン計算量の逆関数... ならし計算量

##木構造を作っていく. グループのidはnodeのidにする. findするときは根の番号に辿るようにする

## 計算量を落とす.
### 木がどんどん深くなると処理が長くなる.

## 1. くっつける先を根に向かうようにする, グループとグループは根から根に繋げるようにする
## 小さい方を大きい方にくっつける
## -> 一回あたりO(log(N))
### 高さが高々 log(N)にしかならないから
#### 根から辿ると,一個辿ると頂点の個数が半分以下になっていくから
##### 証明できる: 辺が張られた後は そのグループはいじられない
##### さらに,最初につけたときに既に 残りのグループの方が大きいため

## 2. 経路縮約的な考え
# 計算結果をメモしておく
# 一回計算したところは直接つなぐ　-> メモ化で　ならしlog(N)

##3. 両方を採用すると ならし　アッカーマン関数の逆関数



##実装の工夫

# 根にマイナスのサイズを持つようにする。
# 葉には親のidを持つようにする
# メモ化するためにd[x]を親のfindと一致させるようにする

# MSTを考えてuniteでくっつけられるかどうかを考える

class UnionFind():
    def __init__(self, n):
        self.parents = [-1]*n #各親を格納する,自分が親ならマイナスサイズを持つ
    
    def find(self, 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 = 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):
        return -self.parents[self.find(x)]
    
def main():
    n,m = map(int,input().split())
    uf = UnionFind(n)
    for _ in range(m):
        a, b = map(int, input().split())
        uf.union(a-1,b-1)
    
    ans = 1
    for i in range(n):
        ans = max(ans, uf.size(i))
    print(ans)

if __name__ == "__main__":
    main()
import numpy as np
INT = lambda: int(input())
INTM = lambda: map(int,input().split())
STRM = lambda: map(str,input().split())
STR = lambda: str(input())
LIST = lambda: list(map(int,input().split()))
LISTS = lambda: list(map(str,input().split()))

def do():
    imos1=np.array([0]*(10**9))
    imos2=np.array([0]*(10**9))
    n=INT()

    for i in range(n):
        a,b=INTM()
        b=10**9+1-b
        imos1[a-1:]+=1
        imos2[b-1:]+=1
        
    if n%2==1:
        for i in range(n//2+1,n+1):
            if (i in imos1) and (i in imos2): 
                ta=imos1.index(i)+1
                tb=10**9-imos2.index(i)
                break
            else:
                pass
        print(tb-ta+1)
    else:
        for i in range(n//2,n+1):
            if (i in imos1) and (i in imos2): 
                for k in range(i+1,n+1):
                    if (k in imos1) and (k in imos2):
                        ta1=imos1.index(i)+1
                        ta2=imos1.index(k)+1
                        tb1=10**9-imos2.index(i)
                        tb2=10**9-imos2.index(k)
                        avea=(ta1+ta2)/2
                        ave=b(tb1+tb2)/2
                        print(int((aveb-avea)*2)+1)
                        break
                        break
                    else:
                        pass
            else:
                pass
        
        
    
if __name__ == '__main__':
    do()

### FIXED CODE ###

import numpy as np
INT = lambda: int(input())
INTM = lambda: map(int,input().split())
STRM = lambda: map(str,input().split())
STR = lambda: str(input())
LIST = lambda: list(map(int,input().split()))
LISTS = lambda: list(map(str,input().split()))
 
def do():
    n=INT()
    A=[]
    B=[]
    for i in range(n):
        a,b=INTM()
        A.append(a)
        B.append(b)
        #print(A,B)
    A=sorted(A)
    B=sorted(B,reverse=True)
    if n%2==1:
        ta=A[n//2]
        tb=B[n//2]
        print(tb-ta+1)
    else:
        ta1=A[n//2-1]
        ta2=A[n//2]
        tb1=B[n//2-1]
        tb2=B[n//2]
        avea=(ta1+ta2)/2
        aveb=(tb1+tb2)/2
        print(int((aveb-avea)*2)+1)
        
        
    
if __name__ == '__main__':
    do()
s = 'S'

print(len(s))

s_length = len(s)
print(s_length)

if s_length=2
print (s)

else print str[::-1]
str = "S"

### FIXED CODE ###

str = input()

if len(str)==(2): 
  print(str)
else:
  print(str[::-1])
import math
a,b=map(int,input().split())
c=math.gcd(a,b)
d=[]
for i in range(2,int(c**0.5)+2):
    while c%i==0:
        c//=i
        d.append(i)
if c!=1:
    d.append(c)
print(d)
print(len(set(d))+1)

### FIXED CODE ###

import math
a,b=map(int,input().split())
while b!=0:
    a,b=b,a%b
c=a
d=[]
for i in range(2,int(c**0.5)+2):
    while c%i==0:
        c//=i
        d.append(i)
if c!=1:
    d.append(c)
print(len(set(d))+1)
def main():
    N = int(input())
    S = str(input())

    if N % 2 == 1:
        print('No')
        return 0

    s_start = S[:N//2]
    s_end = S[N//2:]

    is s_start == s_end:
        print('Yes')
    else:
        print('No')
    return 0


if __name__ == '__main__':
    main()


### FIXED CODE ###

def main():
    N = int(input())
    S = str(input())

    if N % 2 == 1:
        print('No')
        return 0

    s_start = S[:N//2]
    s_end = S[N//2:]

    if s_start == s_end:
        print('Yes')
    else:
        print('No')
    return 0


if __name__ == '__main__':
    main()
S = input()

if S == 'SUN':
  ans = 7
elif S == 'MON':
  ans = 6
elif S == 'TUE':
  ans == 5
elif S == 'WED':
  ans = 4
elif S == 'THU':
  ans = 3
elif S == 'FRI':
  ans = 2
elif S == 'SAT':
  ans = 1

print(ans)

### FIXED CODE ###

S = input()

if S == 'SUN':
  ans = 7
elif S == 'MON':
  ans = 6
elif S == 'TUE':
  ans = 5
elif S == 'WED':
  ans = 4
elif S == 'THU':
  ans = 3
elif S == 'FRI':
  ans = 2
elif S == 'SAT':
  ans = 1

print(ans)
s=input().split()
a=int(s[0])
b=int(s[1])
k=int(s[2])
if a>=k:
    print((a-k)+" "+b)
else:
    if a+b>=k:
        print("0 "+b+a-k)
    else:
        print("0 0")



### FIXED CODE ###

s=input().split()
a=int(s[0])
b=int(s[1])
k=int(s[2])
if a>=k:
    print(str(a-k)+" "+str(b))
else:
    if a+b>=k:
        print("0 "+str(b+a-k))
    else:
        print("0 0")
3 2 10 20
8 15 13
16 22

### FIXED CODE ###

n,m,x,y = map(int,input().split())
xs = list(map(int,input().split()))
ys = list(map(int,input().split()))

war = True

for z in range(-100,101):
    new_xs = xs + [z]
    new_ys = ys + [z]
    new_xs.sort()
    new_ys.sort()
    if new_xs[-1] == z and new_xs[-2] != z and new_ys[0] == z and x<z<=y:
        war = False
        
if war:
    print('War')
else:
    print('No War')
N =int( input())
L = list(map(int,input().split())
 
L.sort
 
s = 0
 
for n in range(N):
    s += L[2*n]
print(s)

### FIXED CODE ###

n = int(input())
list_L = list(map(int, input().split()))
list_L.sort()
sum = 0
for i in range(n):
    sum += list_L[2*i]
print(sum)
from decimal import *
a,b=map(str,input().split())
b = Decimal(b)
a = Decimal(a)
print(int(a*b))


### FIXED CODE ###

from decimal import *
a,b=map(str,input().split())
b = Decimal(b)
a = Decimal(a)
print(int(a*b))
a, b. c = map(int, input().split())
i = a
j = 0
if(a <= i and i <= b) :
  if(c % i == 0) :
    j += 1
  else :
    pass
else :
  print(j)



### FIXED CODE ###

a, b, c = map(int, input().split())
s = 0

for i in range(a, b + 1) :
    if c % i == 0 :
        s += 1
        
print(s)
import sympy
n = int(input())
ans = 0
for i in range(1,n+1):
    ans += i*sympy.divisor_count(i)
print(ans)

### FIXED CODE ###

import sys
input = sys.stdin.buffer.readline
n = int(input())

ans = 0
for i in range(1,n+1):
    ans += i*(n//i)*(n//i+1)//2

print(ans)
n, m = map(int, input().split())
a = set(input().split()[1:])
for i in range(n - 1):
    a &= set(reads()[1:])
print(len(a))

### FIXED CODE ###

def read():
    return int(input())

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

n,m = reads()
a = []
r = []
for i in range(n):
    a.append(reads())
for i in range(n):
    for j in range(1,a[i][0]+1):
        r.append(a[i][j])
ans = 0
for i in set(r):
    if r.count(i) == n:
        ans += 1
print(ans)
s = input()
    
if s[0] != 'A' or s[1].islower() == False or s[-1].islower() == False:
    print('WA')
elif s[2:-1].count('C') != 1:
    print('WA')
else:
    for i in range(3, len(s)-1):
        if s[i].islower() or s[i] == 'C':
            flag = 'AC'
        else:
            flag = 'WA'
            break
    print(flag)

### FIXED CODE ###

s = input()
    
if s[0] != 'A' or s[1].islower() == False or s[-1].islower() == False:
    print('WA')
elif s[2:-1].count('C') != 1:
    print('WA')
else:
    flag = 'AC'
    for i in range(3, len(s)-1):
        if s[i].islower() or s[i] == 'C':
            flag = 'AC'
        else:
            flag = 'WA'
            break
    print(flag)
h,w = map(int, input().split())

if w == 1 or w == 2:
    print(0)
    exit()

if w % 2 == 1:
    idle = int((w - 1) / 2)
    can = w - idle
    second = can - 1
    num = can + second
elif w % 2 == 1 and h == 1:
    idle = int((w - 1) / 2)
    can = w - idle
    print(can)
    exit()
else:
    idle = int(w / 2)
    num = idle * 2
    
if h % 2 == 1:
    row = int(h // 2)
    print(num * row + can)
else:
    row = int(h / 2)
    print(num * row)

### FIXED CODE ###

h,w = map(int, input().split())

if w == 1 or h == 1:
    print(1)
    exit()
    
if w == 2 and h == 2:
    print(2)
    exit()

if w % 2 == 1:
    idle = int((w - 1) / 2)
    can = w - idle
    second = can - 1
    num = can + second
elif w % 2 == 1 and h == 1:
    idle = int((w - 1) / 2)
    can = w - idle
    print(can)
    exit()
elif w % 2 == 0 and h == 1:
    print(1)
    exit()
else:
    idle = int(w / 2)
    num = idle * 2

if h % 2 == 1 and w % 2 == 0:
    print(int((w / 2) * h))
    exit()

if h % 2 == 1:
    row = int(h // 2)
    print(num * row + can)
else:
    row = int(h / 2)
    print(num * row)
def Fib(n):
    a, b = 1, 1
    if n == 1:
        return a
    elif n == 2:
        return b
    else:
        for i in range(n-2):
            a, b = b, a + b
        return b
N, M = map(int, input().split())
a = [int(input()) for _ in range(M)]
m = Fib(a[0])*Fib(N-a[M-1])
flag = True
for i in range(M-1):
    if a[i] + 1 == a[i+1]:
        print(0)
        flag = False
        break
if flag:
    for j in range(M-1):
        dev = a[j+1]-a[j]
        m = m*Fib(dev)
    print(m%1000000007)

### FIXED CODE ###

def Fib(n):
    a, b = 1, 1
    if n == 1:
        return a
    elif n == 2:
        return b
    else:
        for i in range(n-2):
            a, b = b, a + b
        return b
N, M = map(int, input().split())
a = [int(input()) for _ in range(M)]

flag = True
if M == 1:
    print(Fib(a[0])*Fib(N-a[M-1]))
elif M == 0:
    print(Fib(N+1)%1000000007)
else:
    m = Fib(a[0])*Fib(N-a[M-1])
    for i in range(M-1):
        if a[i] + 1 == a[i+1]:
            print(0)
            flag = False
            break
    if flag:
        for j in range(M-1):
            dev = a[j+1]-a[j]-1
            m = m*Fib(dev)%1000000007
        print(m%1000000007)
a = int(input())
b = int(input())
print(a*b)

### FIXED CODE ###

a = input()
a = [int(n) for n in a.split()]
print(a[0] * a[1])
n=int(input())
d=list(map(int,input().split()))

if d[0] != 0:
  print(0)
  exit()

ans=1

a=[0]*n

for i in d:
  a[i] += 1

if a[0] != 1:
  print(0)
  exit()

for j in range(n):
  if j!=0 and a[j] == 0:
    for k in range(j+1,n):
      if a[k] != 0:
        print(0)
        exit()
    break
  else:
    ans*=(a[j]**a[j+1])
    ans%=998244353

print(ans)

### FIXED CODE ###

n=int(input())
d=list(map(int,input().split()))

if d[0] != 0:
  print(0)
  exit()

ans=1

a=[0]*(n+1)

for i in d:
  a[i] += 1

if a[0] != 1:
  print(0)
  exit()

for j in range(n):
  if j!=0 and a[j] == 0:
    for k in range(j+1,n):
      if a[k] != 0:
        print(0)
        exit()
    break
  else:
    ans*=(a[j]**a[j+1])
    ans%=998244353

print(ans)
s = str(input())
t = str(input())
c = 0
for i in len(s):
  if(s[i] != t[i]):
    c+=1

print(c)

### FIXED CODE ###

s = str(input())
t = str(input())
c = 0
for i in range(len(s)):
  if(s[i] != t[i]):
    c+=1
 
print(c)
N = int(input())
if N>=1,N<=999:
    print('ABC')
if N>=1000,N<=1998:
    print('ABD')

### FIXED CODE ###

N = input()
N=int(N)
if N>=1 and N<=999:
    print('ABC')
if N>=1000 and N<=1998:
    print('ABD')