Harryxun/stf_run huggingface dataset:
def check(i, j):
  T = []
  if i >= 1:
    if M[i-1][j] == 0:
      if D[i][j] != D[i-1][j]:
        T.append((i-1, j))
        M[i-1][j] = 1
        T.extend(check(i-1, j))
  if i < H - 1:
    if M[i+1][j] == 0:
      if D[i][j] != D[i+1][j]:
        T.append((i+1, j))
        M[i+1][j] = 1
        T.extend(check(i+1,j))
  if j >= 1:
    if M[i][j-1] == 0:
      if D[i][j] != D[i][j-1]:
        T.append((i, j-1))
        M[i][j-1] = 1
        T.extend(check(i, j-1))
  if j < W - 1:
    if M[i][j+1] == 0:
      if D[i][j] != D[i][j+1]:
        T.append((i, j+1))
        M[i][j+1] = 1
        T.extend(check(i, j+1))
  return T

H, W = list(map(int, input().split()))

D = []
for i in range(H):
  D.append(input())

M = [[0] * W for i in range(H)]
L = []
for i in range(H):
  for j in range(W):
    if M[i][j] == 0:
      L.append(check(i, j))

cnt = 0
for i in L:
  E = 0
  A = 0
  for j in i:
    if (j[0] + j[1]) % 2 == 0:
      E += 1
    else:
      A += 1
  cnt += E * A
print(cnt)

### FIXED CODE ###

def getminLT(i):
  if LT[i] == i:
    return i
  else:
    return getminLT(LT[i])

H, W = list(map(int, input().split()))

D = []
for i in range(H):
  D.append(input())

M = [[0] * W for i in range(H)]
LT = [0]
for i in range(H):
  for j in range(W):
    if i == 0 and j == 0:
      continue
    flag = False
    if i != 0:
      if D[i][j] != D[i-1][j]:
        M[i][j] = M[i-1][j]
        flag = True
    if j != 0:
      if D[i][j] != D[i][j-1]:
        M[i][j] = M[i][j-1]
        if flag == True:
          
          LT[max(getminLT(M[i-1][j]), getminLT(M[i][j-1]))] = LT[min(getminLT(M[i][j-1]), getminLT(M[i-1][j]))]
        flag = True
    if flag == False:
        M[i][j] = len(LT)
        LT.append(len(LT))
for i in range(len(LT)):
  LT[i] = getminLT(LT[i])
  
L = [[] for i in range(len(LT))]
for i in range(H):
  for j in range(W):
  	L[LT[M[i][j]]].append((i, j))
#print(M)
#print(LT)
#print(L)
cnt = 0
for i in L:
  E = 0
  A = 0
  for j in i:
    if (j[0] + j[1]) % 2 == 0:
      E += 1
    else:
      A += 1
  cnt += E * A
print(cnt)
[N,X] = list(map(int,input().split(' ')))

def paty(n,x):
  if n == 0:
    if x == 1:
      return 1
    elif x == 0:
      return 0
  elif int((2**(n+2)-3 - 1) / 2) >= x:
    return paty(n-1,x-2)
  elif int((2**(n+2)-3 + 1) / 2) == x:
    return paty(n-1,x-2) + 1
  else:
    return 2**n + paty(n-1, x-(2**(n+1)-3) -3)
  
ans = paty(N,X)
print(ans)

### FIXED CODE ###

[N,X] = list(map(int,input().split(' ')))

def paty(n,x):
  #print('n:{}'.format(n))
  #print('x:{}'.format(x))
  if x == 0:
    return 0
  if n == 0:
    return x
  elif ((2**(n+2))-3 - 1) / 2 >= x:
    return paty(n-1,x-1)
  elif ((2**(n+2))-3 + 1) / 2 == x:
    return 2**n
  elif ((2**(n+2))-3) - 1 <= x:
    return 2**(n+1) - 1
  else:
    return 2**n + paty(n-1, x-((2**(n+1))-3) -2)
  
ans = paty(N,X)
print(ans)
import math,itertools,fractions,heapq,collections,bisect,sys,queue,copy

sys.setrecursionlimit(10**7)
inf=10**20
mod=998244353
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()

class nCrMod():
  def __init__(self,n):
    self.n=n
    self.fact=[0]*(n+1)
    self.ifact=[0]*(n+1)
    self.fact[0]=1  
    for i in range(1,n+1):
      self.fact[i]=self.fact[i-1]*i
      self.fact[i]%=mod
    self.ifact[n]=pow(self.fact[n],mod-2,mod)
    for i in range(1,n+1)[::-1]:
      self.ifact[i-1]=self.ifact[i]*i
      self.ifact[i-1]%=mod
  def comb(self,n,k):
    if k<0 or n<k:
      return 0
    return self.fact[n]*self.ifact[k]*self.ifact[n-k]%mod

def main():
  n,m,k=LI()
  c=nCrMod(100005)
  ans=0
  col=m
  for x in range(n)[::-1]:
    now=col
    now*=c.comb(n-1,x)
    if x<=k:
      ans+=now
      ans%=mod
    col*=m-1
  return ans

# main()
print(main())


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

com_mx=200005
mod=998244353
fac=[0]*com_mx
finv=[0]*com_mx
inv=[0]*com_mx
fac[0]=1
fac[1]=1
finv[0]=1
finv[1]=1
inv[1]=1
for i in range(2,com_mx):
  fac[i]=fac[i-1]*i%mod
  inv[i]=-inv[mod%i]*(mod//i)%mod
  finv[i]=finv[i-1]*inv[i]%mod

def com(n,k):
  if n<k or n<0 or k<0:
    return 0
  return fac[n]*(finv[k]*finv[n-k]%mod)%mod

def main():
  n,m,k=LI()
  res=0
  tmp=m*pow(m-1,n-k-1,mod)
   
  for r in range(n-k-1,n):
    res=(res+tmp*com(n-1,r)%mod)%mod
    tmp=tmp*(m-1)%mod
  return res

# main()
print(main())
a,b,c=list(map(int,input().split()))
print(a[0]+b[0]+c[0])

### FIXED CODE ###

a,b,c=list(input().split())
print(a[0]+b[0]+c[0])
n=int(input())
dat = list(map(int, input().split()))
dan = []
for e in dat:
    e = list(str(bin(e)))
    e.reverse()

re = 0
for e in dat:
     w=len(e)
     
     
print(re)
     

 
      
      
             


    
    
     
                

         
           




### FIXED CODE ###

import sys

def main():
    N = int(input())
    A = [int(_) for _ in input().split()]

    t = 0
    while True:
        for i in range(N):
            if A[i] % 2 == 0:
                A[i] //= 2
            else:
                print(t)
                sys.exit()
        t += 1

main()
import numpy as np
from scipy.sparse import csr_matrix
from scipy.sparse.csgraph import floyd_warshall

n,m,l=map(int,input().split())
ll=[]
for i in range(m):
    a,b,c=[int(j) for j in input().split()]
    if c<=l:
        ll.append((a,b,c))
if ll==[]:
    print(-1)
    exit()
edge=np.array(ll,dtype=np.int64).T
graph=csr_matrix(((edge[2],edge[:2]-1)),(n,n))

#False->無向グラフ True->有効グラフ
ans=floyd_warshall(graph,directed=False)
v=[]
s=set(list(range(1,n+1)))
for i in range(n):
    for j in range(n):
        if ans[i][j]<=l:
            if i+1 in s:
                s.remove(i+1)
            if j+1 in s:
                s.remove(j+1)
            v.append((i+1,j+1,1))
for i in s:
    v.append((1,i,float("inf")))
edge=np.array(v,dtype=np.int64).T
graph=csr_matrix(((edge[2],edge[:2]-1)),(n,n))
ans2=floyd_warshall(graph,directed=False)

q=int(input())
st=[]
for i in range(q):
    st.append([int(j)-1 for j in input().split()])

for i,j in st:
    if int(ans2[i][j])==float("inf"):
        print(-1)
    else:
        print(int(ans2[i][j])-1)



### FIXED CODE ###

import numpy as np
from scipy.sparse.csgraph import floyd_warshall

n,m,l=map(int,input().split())
ans=[[0]*n for i in range(n)]
for i in range(m):
    a,b,c=[int(j) for j in input().split()]
    ans[a-1][b-1]=c
    ans[b-1][a-1]=c
q=int(input())
st=[]
for i in range(q):
    st.append([int(j)-1 for j in input().split()])

ans=floyd_warshall(ans)

for i in range(n):
    for j in range(n):
        if ans[i][j]<=l:
            ans[i][j]=1
        else:
            ans[i][j]=0

ans=floyd_warshall(ans)

for i,j in st:
    if ans[i][j]==float("inf"):
        print(-1)
    else:
        print(int(ans[i][j])-1)
L = int(input())
print(*sorted(input() for i in range(L)), sep='')


### FIXED CODE ###

N, L = map(int, input().split())
S = [input() for i in range(N)]
s = sorted(S)
print(*s, sep='')
l = [int(input) in i for range(5)]
l_0 = l % 10
ar = []
for n in l_0:
  if n != 0:
    ar.append(10-n)
  else:
    ar.append(0)
s = l_0.index(max(l_0))
ans = sum(l[l.index()!=s]) + sum(l_0[l_0.index()!=s]) + l[s]
print(ans)

### FIXED CODE ###

l = [int(input()) for i in range(5)]
l_0 = [a%10 for a in l]
ar = []
for n in l_0:
  if n != 0:
    ar.append(10-n)
  else:
    ar.append(0)
s = ar.index(max(ar))
ar.pop(s)
ans = sum(l) + sum(ar)
print(ans)
def tasu(x):
    return x / 2 * (x + 1)

def kitaiti(n , k , p):

    ans = 0
    count = 0
    kitai = [0]*n
    mod = 10**9+7

    for i in range(n):
        kitai[i] = round(tasu(p[i]) / p[i] , 6)

    for i in range(n - k + 1):

        if i == 0:
            count = sum(kitai[i:i+k]) % mod
        else:
            count -= kitai[i-1] % mod
            count += kitai[i + k] % mod
#        count = sum(kitai[i:i+k]) % mod
#       for w in range(i , i + k):
#            count += kitai[w]
#            count += tasu(p[w]) / p[w]
        ans = max(ans , count)

    return ans

def main():
    n , k = map(int , input().split())
    p = list(map(int,input().split()))
    print(kitaiti(n , k , p))

if __name__ == '__main__':
    main()

### FIXED CODE ###

def tasu(x):
    return x / 2 * (x + 1)

def kitaiti(n , k , p):

    ans = 0
    count = 0
    kitai = [0]*n
    kitaisum = [0]*n
    mod = 10**9+7

    for i in range(n):
        kitai[i] = tasu(p[i]) / p[i]

    for i in range(n):
        if i == 0:
            kitaisum[i] += kitai[i]
        else:
            kitaisum[i] += kitai[i] + kitaisum[i-1]

    for i in range(n - k + 1):

        ans = max(ans , (kitaisum[i + k - 1] - kitaisum[i-1]) if i != 0 else kitaisum[i + k - 1])

    return ans

def main():
    n , k = map(int , input().split())
    p = list(map(int,input().split()))
    print(kitaiti(n , k , p))

if __name__ == '__main__':
    main()
a, b, c=map(int,input().split())
m=max(a+b,a-b,a*b)
print(m)

### FIXED CODE ###

a, b=map(int, input().split())
print(max(a*b,a+b,a-b))
N = int(input())
H = int(input())
W = int(input())
while 0<N:
    A = int(input())
    B = int(input())
if (H == A and W == B) or (H == A/2 and W == B/2):
    cnt = +1
print(int(cnt))

### FIXED CODE ###

n = str(input())
print(n.count('2'))
H, W = map(int, input().split())
S = [['.']*W]
for i in range(H):
    S.append(['.'] + list(input()) + ['.'])
S.append(['.']*W)

for i in range(1, H+1):
    for j in range(1, W+1):
        if S[i][j] == '#':
            if S[i+1][j] == '.' and S[i-1][j] == '.' and S[i][j+1] == '.' and S[i][j-1] == '.':
                print('No')
                break
    else:
        continue
    break

else:
    print('Yes')

### FIXED CODE ###

H, W = map(int, input().split())
S = [['.']*(W+2)]
for i in range(H):
    S.append(['.'] + list(input()) + ['.'])
S.append(['.']*(W+2))

for i in range(1, H+1):
    for j in range(1, W+1):
        if S[i][j] == '#':
            if S[i+1][j] == '.' and S[i-1][j] == '.' and S[i][j+1] == '.' and S[i][j-1] == '.':
                print('No')
                break
    else:
        continue
    break
else:
    print('Yes')
n,m = map(int,input().split())
max_int = 1000000007
a = [0] * m
for i in range(m):
    a[i] = int(input())
piv = 0
b = [1] * (n+1)
if a[0] == 1:
    piv += 1
    b[1] = 0
for i in range(2,n+1):
    if piv == m:
        b[i] = b[i-1] + b[i-2]
        #b[i] %= max_int
    elif i == a[piv]:
        piv += 1
        b[i] = 0
    else:
        b[i] = b[i-1] + b[i-2]
        #b[i] %= max_int

print(b[n]%max_int)


### FIXED CODE ###

n,m = map(int,input().split())
max_int = 1000000007
a = [-1] * (m+1)
for i in range(m):
    a[i] = int(input())
piv = 0
b = [1] * (n+1)
if a[0] == 1:
    piv += 1
    b[1] = 0
for i in range(2,n+1):
    if i == a[piv]:
        piv += 1
        b[i] = 0
    else:
        b[i] = b[i-1] + b[i-2]
        b[i] %= max_int

print(b[n]%max_int)
import math
import numpy as np
from functools import reduce
N,X=map(int,input().split(" "))
x=np.array(list(map(int, input().split(' '))))
y=abs(x-X)
print(reduce(math.gcd,y))

### FIXED CODE ###

import numpy as np
from functools import reduce

def euclid(m,n):
    while n:
        m,n=n,m%n
    return m

N,X=map(int,input().split(" "))
x=np.array(list(map(int, input().split(' '))))
y=abs(x-X)
print(reduce(euclid,y))
import collections as c
n=int(input())
a=list(map(int,input().split()))
b=c.Counter(a)
for i in range(1,N+1):
    print(b[i])

### FIXED CODE ###

import collections as c
n=int(input())
a=list(map(int,input().split()))
b=c.Counter(a)
for i in range(1,n+1):
    print(b[i])
import sys
import math

s = input()
l = len(s) //2

if is_kaibun(s):
    print(0)
    sys.exit()

def is_kaibun(kaibun):
    for i in range(len(kaibun)//2):
        if kaibun[i] != kaibun[-i-1]:
            return False
    return True

def kisu(s):    
    ans_k = 0
    l = len(s) //2
    for i in range(l +1, len(s)):
        if s[i] != s[l -i]:
            s.replace(s[i], s[l -i])
            ans_k += 1
        if is_kaibun(s):
            return ans_k
    return l -1

def gusu(s):
    ans_g = 0
    l = len(s) //2
    for i in range(l):
        if s[i] != s[l]:
            s.replace(s[i], s[l +i])
            ans_g += 1
        if is_kaibun(s):
            return ans_g
    return l
if len(s) % 2 == 0:
    print(gusu(s))
else:
    print(kisu(s))


### FIXED CODE ###

s = input()
cnt = 0
for i in range(len(s)//2):
    if s[i] != s[-i -1]:
        cnt += 1
print(cnt)
N,Y=map(int,input().split())
a=-1
b=-1
c=-1
for i in range(0,N+1):
    for j in range(0,N-i+1):
        if 10000*i+5000*j+1000*(N-i-j) == Y:
                a=i
                b=j
                c=N-i-j
print(a,b,c)

### FIXED CODE ###

S=input()
print("2018"+S[4:])
a = [input().split() for l in range(2)]
count = 0
N = int(a[0][0])
 
for i in range(N):
    for j in range(i):
        if i != j:
            count = (int(a[1][i])*int(a[1][j])) % 1000000007 + count
count = count % 1000000007
print(count)


### FIXED CODE ###

D,T,S=(int(x) for x in input().split())
if D >S*T:
  print('No')
else:
  print('Yes')
S==input()
if S=='Sunny':
  print'Cloudy'
elif S=='Cloudy':
  print'Rainy'
elif S=='Rainy':
  print'Sunny'

### FIXED CODE ###

S=input()
if S=='Sunny':
  print('Cloudy')
elif S=='Cloudy':
  print('Rainy')
elif S=='Rainy':
  print('Sunny')
import sys
sys.setrecursionlimit(10**5)

input=sys.stdin.readline

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

tree=[[] for _ in range(n)]

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

point=[0]*n
for _ in range(q):
    q,x=map(int,input().split())
    point[q-1]+=x

result=[0]*n

def counter(chouten,count):
    global result,point,tree
    count+=point[chouten]
    result[chouten]=count

    #print(chouten,result)

    for item in tree[chouten]:
        if result[item]==0:
            counter(item,count)

counter(0,0)

result=map(str,result)
print(" ".join(result))


### FIXED CODE ###

import sys
sys.setrecursionlimit(10**8)

input=sys.stdin.readline

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

tree=[[] for _ in range(n)]

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

point=[0]*n
for _ in range(q):
    q,x=map(int,input().split())
    point[q-1]+=x

result=["no"]*n

def counter(chouten,count):
    global result,point,tree
    count+=point[chouten]
    result[chouten]=count

    #print(chouten,result)

    for item in tree[chouten]:
        if result[item]=="no":
            counter(item,count)

counter(0,0)

result=map(str,result)
print(" ".join(result))
x,k,d = [int(i) for i in input().split()]
x=x-k*d*x//abs(x) if abs(x)>=k*d else x-(abs(x)//d)*d*x//abs(x)-(d if abs(x)//d%2==1 else 0)*x//abs(x)
print(x)

### FIXED CODE ###

x,k,d = [int(i) for i in input().split()]
x=abs(x)
x=x-k*d if x>=k*d else abs(x%d-(k-x//d)%2*d)
print(x)
a, b, c =map(int, input().split())
print("Yes" if b-a=c=b else "No")

### FIXED CODE ###

a, b, c = map(int, input().split())
print("YES" if b-a==c-b else "NO")
import numpy as np

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

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

a_cum = np.cumsum(a)
b_cum = np.cumsum(b)

j = m-1
ans = 0
for i in range(n):
    if a_cum[i] > k:
        break
    while a_cum[i] + b_cum[j] > k:
        j -= 1
    ans = max(ans, i + 1 + j + 1)
    
print(ans)


### FIXED CODE ###

import numpy as np

n, m, k = map(int, input().split())
A = [int(x) for x in input().split()]
B = [int(x) for x in input().split()]

a = [0]
b = [0]

a = np.append(a, np.cumsum(A))
b = np.append(b, np.cumsum(B))

j = m
ans = 0
for i in range(n + 1):
    if a[i] > k:
        break
    while a[i] + b[j] > k:
        j -= 1
    ans = max(ans, i + j)
    
print(ans)
xkd = input()

xstr,kstr,dstr = xkd.split()

x = int(xstr)
k = int(kstr)
d = int(dstr)

if x >= k*d:
    print(x-(k*d))
else:
    if x <= -(k*d):
        print(x+(k*d))
    else:
        if x <= 0:
            lxl = -x
        else:
            lxl = x
        if x <= 0:
            now_x = x + (d * (int(lxl / d) + 1))
            left_x = -now_x
            right_x = now_x + d
        else:
            now_x = x - (d * (int(lxl / d) + 1))
            left_x = -(now_x - d)
            right_x = now_x
        now_k = k - int(lxl / d) - 1
        if now_x <= 0:
            if now_k % 2 == 0:
                print(left_x)
            else:
                print(right_x)
        else:
            if now_k % 2 == 0:
                print(right_x)
            else:
                print(left_x)
            
        
        


### FIXED CODE ###

sd = input()
ok = 0
if sd[0] == 'R':
    if sd[1] == 'R':
        if sd[2] == 'R':
            ok = 1
            print(3)
        else:
            ok = 1
            print(2)
    else:
        ok = 1
        print(1)
else:
    if sd[1] == 'R':
        if sd[2] == 'R':
            ok =1 
            print(2)
        else:
            ok = 1
            print(1)
    else:
        if sd[2] == 'R':
            print(1)
            ok = 1
if ok == 0:
    print(0)
n = int(input())
table = [int(input()) for i in range(n)]
print("{} {} {}".format(min(table),max(table),sum(table)))



### FIXED CODE ###

n = input()
table = list(map(int,input().split()))
print("{} {} {}".format(min(table),max(table),sum(table)))
n, m = map(int, input().split())
S = []
tmp = int(input())
s = tmp + 1
for _ in range(m-1):
  a = int(input())
  S.append(a-tmp)
  tmp = a
g = n-tmp+1

fib = [1 for _ in range(n+1)]
for i in range(2, n-1):
  fib[i+2] = fib[i] + fib[i+1]
total = fib[s]*fib[g]

fib[1] = 0

for x in S:
  total *= fib[x]
  
print(s, S, g)
print(total%1000000007)

### FIXED CODE ###

n, m = map(int, input().split())
S = []
tmp = -1
for _ in range(m):
  a = int(input())
  S.append(a-tmp-2)
  tmp = a
S.append(n-tmp-1)

fib = [1 for _ in range(n+1)]
for i in range(n-1):
  fib[i+2] = fib[i] + fib[i+1]

total = 1
for x in S:
  if x == -1:
    print(0)
    exit()
  total *= fib[x]

#print(S)
print(total%1000000007)
n=int(input())
ans=0
for i in range(n):
  x,u=map(str,input().split())
  x=int(x)
  if u=="BTC":
    x*=380000
  ans+=x
print(ans)

### FIXED CODE ###

n=int(input())
sum=0
for j in range(n):
  i,c=input().split()
  if c=="BTC":
    sum+=float(i)*380000
  else:
    sum+=int(i)
print(sum)
import sys
s = input()
T=input()
p = 0
for i in range(len(s)-len(T)+1,0,-1):
  for j in range(len(T)):
    if T[j]!=s[i-1+j] and "?"!= s[i-1+j] :
      p = 1
      break
if p == 0:
  s=s[:i-1]+T+s[i+len(T)-1:]
  s = s.replace('?', 'a')
  print(s)
sys.exit()
if p == 1:
  print("UNRESTORABLE")

### FIXED CODE ###

S = input()
T = input()
 
for i in range(len(S) - len(T), -1, -1):
    for j in range(len(T)):
        if S[i + j] != '?' and S[i + j] != T[j]:
            break
    else:
        print((S[:i] + T + S[i + len(T):]).replace('?', 'a'))
        break
else:
    print('UNRESTORABLE')
A,B,C=map(int,input().split())
even += A%2+B%2+C%2
answer = 0
if even == 1:
  answer = 1
  if A%2:
    A += 1
  if B%2:
    B += 1
  if C%2:
    C += 1
elif even == 2:
  answer = 1
  if not A%2:
    A += 1
  if not B%2:
    B += 1
  if not C%2:
    C += 1
D = sorted([A,B,C])
answer += (D[2]-D[0])//2+(D[2]-D[1])//2

### FIXED CODE ###

A,B,C=map(int,input().split())
odd = A%2+B%2+C%2
answer = 0
if odd == 1:
  answer = 1
  if not A%2:
    A += 1
  if not B%2:
    B += 1
  if not C%2:
    C += 1
elif odd == 2:
  answer = 1
  if A%2:
    A += 1
  if B%2:
    B += 1
  if C%2:
    C += 1
D = sorted([A,B,C])
answer += (D[2]-D[0])//2+(D[2]-D[1])//2
print(answer)
n,d= map(int, input().split())
x,y=[int(input()) for i in range(n)]
s=0
def distance_count():
  
  for i in range(N)
  　　if (x[i]**2 + y[i]**2)**(1/2)<= d:
     　　s=s+1
  return s
distance_count(x,y)
print(s)

### FIXED CODE ###

N,D = map(int, input().split())
XY = [map(int, input().split()) for _ in range(N)]
X,Y = [list(i) for i in zip(*XY)]

s=0
for i in range (N):
  if X[i]*X[i]+Y[i]*Y[i]<=D*D:
    s=s+1
print(s)
n = int(input())
a = sorted(list(map(int, input().split())), reverse=True)
swi = 0
s = [0, 0]
i = 0
while i < len(a):
    if a[i] == a[i + 1]:
        s[swi] = a[i]
        i += 1
        swi += 1
        if swi == 2:
            break
    i += 1

print(s[0] * s[1])


### FIXED CODE ###

n = int(input())
a = sorted(list(map(int, input().split())), reverse=True)
swi = 0
s = [0, 0]
i = 0
while i < len(a) - 1:
    if a[i] == a[i + 1]:
        s[swi] = a[i]
        i += 1
        swi += 1
        if swi == 2:
            break
    i += 1

print(s[0] * s[1])
j=10501
l=[0 for i in range(j)]
for x in range(1,101):
  for y in range(1,101):
    for z in range(1,101):
      v=x*x+y*y+z*z+y*x+x*z+z*y
      if(v<j):
        l[v]+=1
for i in range(n+1):
  print(l[i+1])


### FIXED CODE ###

n=int(input())
j=10501
l=[0 for i in range(j)]
for x in range(1,101):
  for y in range(1,101):
    for z in range(1,101):
      v=x*x+y*y+z*z+y*x+x*z+z*y
      if(v<j):
        l[v]+=1
for i in range(n):
  print(l[i+1])
import math

a, b, c, d = list(map(int, input().split()))

c_n = (b // c) - ((a - 1) // c)
d_n = (b // d) - ((a - 1) // d)

lcm = (c * d) // math.gcd(c, d)
lcm_n = (b // lcm) - ((a - 1) // lcm)

ans = (b - a + 1) - (c_n + d_n - lcm_n)
print(ans)


### FIXED CODE ###

import fractions

a, b, c, d = list(map(int, input().split()))

c_n = (b // c) - ((a - 1) // c)
d_n = (b // d) - ((a - 1) // d)

lcm = (c * d) // fractions.gcd(c, d)
lcm_n = (b // lcm) - ((a - 1) // lcm)

ans = (b - a + 1) - (c_n + d_n - lcm_n)
print(ans)