Harryxun/stf_run huggingface dataset:
H,W = map(int,input().split())

A=[]
for i in range(H):
    A.append(list(map(int,input().split())))

num=0

for i in range(H):
    for j in range(W):
        if i%2==0:
            n=j
        else:
            n=W-1-j
        if A[i][n]%2==1:
            A[i][n]-=1
            if i!=H-1 and (i%2==0 and n==W-1) or (i%2==1 and n==0):
                num+=1
                A[i+1][n]+=1
                print(i+1,n+1,i+2,n+1)
            if (i%2==0 and n!=W-1) or (i%2==1 and n!=0):
                num+=1
                A[i][n+(-1)**(i%2)]+=1
                print(i+1,n+1,i+1,n+1+(-1)**(i%2))



### FIXED CODE ###

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

A=[]
for i in range(H):
    A.append(list(map(int,input().split())))

ans=[]

for i in range(H):
    for j in range(W):
        if i%2==0:
            n=j
        else:
            n=W-1-j
        if A[i][n]%2==1:
            A[i][n]-=1
            if i<H-1 and ((i%2==0 and n==W-1) or (i%2==1 and n==0)):
                A[i+1][n]+=1
                ans.append('{} {} {} {}'.format(i+1,n+1,i+2,n+1))
            if (i%2==0 and n!=W-1) or (i%2==1 and n!=0):
                A[i][n+(-1)**(i%2)]+=1
                ans.append('{} {} {} {}'.format(i+1,n+1,i+1,n+1+(-1)**(i%2)))

print(len(ans))
for s in ans:
    print(s)
import numpy as np
n,s=map(int,input().split())
t=np.zeros(s+1)
m=998244353
a=list(map(int,input().split()))
ans=0
for i in range(n):
    if a[i]<=s:
        t[a[i]:]+=t[:-a[i]]
        t[a[i]]+=i+1
    ans+=t[-1]
    ans%=m
print(int(ans))

### FIXED CODE ###

n,s=map(int,input().split())
t=[0]*(s+1)
m=998244353
a=list(map(int,input().split()))
ans=0
for i in range(n):
    d=t.copy()
    if a[i]<=s:
        for j in range(a[i],s+1):
            t[j]+=d[j-a[i]]
        t[a[i]]+=i+1
    ans+=t[-1]
    ans%=m
print(int(ans))
N,Q=map(int,input().split())
S=input()
A=[0]*N+1
for i in range(N):
  t[i+1]=t[i]+(1 if S[i:i+2]=="AC" else 0)
for i in range(Q):
  l,r=map(int,input().split())
  print(t[r-1]-t[l-1])

### FIXED CODE ###

N,Q=map(int,input().split())
S=input()
t=[0]*(N+1)
for i in range(N):
  t[i+1]=t[i]+(1 if S[i:i+2]=="AC" else 0)
for i in range(Q):
  l,r=map(int,input().split())
  print(t[r-1]-t[l-1])
from functools import reduce

 def gcd(a, b):
     while b:
         a, b = b, a % b
     return a

 def lcm(a, b):
     return a * b / gcd(a,b)

 N = int(input())
 Ts = []
 for i in range(N):
     Ts.append(int(input()))

 c = 1
 for T in Ts:
     c = lcm(c, T)

 print(int(c))


### FIXED CODE ###

from functools import reduce

#def gcd(a, b):
#    while b:
#        a, b = b, a % b
#    return a

def gcd(m, n):
    r = m % n
    return gcd(n, r) if r else n

def lcm(a, b):
    return a * b // gcd(a,b)

N = int(input())
Ts = []
c = 1
for i in range(N):
    c = lcm(c, int(input()))

print(int(c))
import sys
from collections import defaultdict
from collections import deque

read = sys.stdin.read
readline = sys.stdin.readline
readlines = sys.stdin.readlines

N, M, V, P = map(int, input().split())

A = list(map(int, input().split()))
A.sort(reverse=True)

NUM = [0] * N
ACN = [0] * N
cnt = 0
mx = A[0]

# cnt and accumulation
for a in A:
    d = mx - a
    cnt += 1
    NUM[d] += 1
    ACN[d] = cnt

# P Number Problem
PROBLEM_P = 0
p = P
for i in range(0, A[0]+1):
    if NUM[i] == 0:
        continue

    p -= NUM[i]

    if p < 0:
        PROBLEM_P = i
        break

    if i == (A[0]+1) and p > 0:
        print(N)
        exit()

#print("NUM", NUM)
#print("PROBLEM_P", PROBLEM_P)

# R Number Problem
R = PROBLEM_P + M

# P-1 Problem
ans = 0
NG_POINT = (P-1) * M
NG_POINT += (N - ACN[R]) * M
MV = M * V

# p problem num
num_p = ACN[PROBLEM_P] - P

print(1)
exit()

for r in range(R, -1, -1):
    need_point = M
    total = (need_point * NUM[r]) + NG_POINT

    for q in range(r-1, PROBLEM_P, -1):
        if NUM[q] == 0:
            continue
        total += NUM[q] * (q - r + M)

    total += num_p * (PROBLEM_P - r + M)

    if total >= MV:
        ans = r
        break
    else:
        NG_POINT += NUM[r] * M

print(ACN[ans])


### FIXED CODE ###

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

ans = 0

sml = A
big = B

if (A-B) > 0:
    sml = B
    big = A

if (A - B) % 2 == 0:
    ans = (big - sml) // 2
else:
    s = sml - 1
    b = N - big

    if s > b:
        t = (big - sml) + (2*b) + 1
    else:
        t = (big - sml) + (2*s) + 1

    ans = t // 2

print(ans)
a = str(input())
print(str(x)*len(a))

### FIXED CODE ###

a = len(input())
print("x"*a)
a = list(map(int,input().split())

del a[4]
del a[7]

b =sum(a)
q = 19
if q <=a:
    print("Heisei")
else :
    print("TBD")

### FIXED CODE ###

a = list(map(int,input().split("/")))



if a[0]== 2019 and a[1]<5:
    print("Heisei")
elif a[0]<2019 and a[1]< 12:
    print("Heisei")
else:
    print("TBD")
import sys

sys.setrecursionlimit(10 ** 6)

def don(dk, rate, amin):
    if not rate:
        return dk
    if dk < amin:
        return dk
    if dp[dk] != -1:
        return dp[dk]
    mx = 0
    for a, b in rate:
        if a > dk: continue
        tmp = don(dk - a, rate, amin) + b
        if tmp > mx:
            mx = tmp
    dp[dk] = mx
    return mx

n = int(input())
aa = list(map(int, input().split()))
bb = list(map(int, input().split()))
atob = []
btoa = []
amin = 10 ** 7
bmin = 10 ** 7
for a, b in zip(aa, bb):
    if a < b:
        atob.append([a, b])
        if a < amin:
            amin = a
    elif a > b:
        btoa.append([b, a])
        if b < bmin:
            bmin = b
dp = [-1] * (n + 1)
n = don(n, atob, amin)
dp = [-1] * (n + 1)
print(don(n, btoa, bmin))


### FIXED CODE ###

import sys

sys.setrecursionlimit(10 ** 6)

def don(dk, rate, amin):
    if not rate:
        return dk
    if len(rate)==1:
        a,b=rate[0]
        p,m=divmod(dk,a)
        return p*b+m
    if len(rate)==2:
        a0,b0=rate[0]
        a1,b1=rate[1]
        if b0/a0<b1/a1:
            a0,b0,a1,b1=a1,b1,a0,b0
        p0,m=divmod(dk,a0)
        re=b0*p0
        p1,m=divmod(m,a1)
        re+=b1*p1+m
        while p0>0 and m>0:
            p0-=1
            m+=a0
            p2,m=divmod(m,a1)
            p1+=p2
            tmp=p0*b0+p1*b1+m
            if tmp>re:
                re=tmp
        return re
    if dk < amin:
        return dk
    if dp[dk] != -1:
        return dp[dk]
    mx = 0
    for a, b in rate:
        if a > dk: continue
        tmp = don(dk - a, rate, amin) + b
        if tmp > mx:
            mx = tmp
    dp[dk] = mx
    return mx

n = int(input())
aa = list(map(int, input().split()))
bb = list(map(int, input().split()))
atob = []
btoa = []
amin = 10 ** 7
bmin = 10 ** 7
for a, b in zip(aa, bb):
    if a < b:
        atob.append([a, b])
        if a < amin:
            amin = a
    elif a > b:
        btoa.append([b, a])
        if b < bmin:
            bmin = b
dp = [-1] * (n + 1)
n = don(n, atob, amin)
dp = [-1] * (n + 1)
print(don(n, btoa, bmin))
N=int(input())

a=[0]*10**4

for x in range(1,(N+1)):
     for y in range(1,(N+1)):
         for z in range(1,(N+1)):
             n=(x+y+z)**2-(x*y+y*z+z*x)
             a[n]+=1

for n in range(1+N+1):
    print(a[n])







### FIXED CODE ###

N=int(input())

a=[0]*10**4

for x in range(1,100):
     for y in range(1,100):
         for z in range(1,100):
             n=(x+y+z)**2-(x*y+y*z+z*x)
             if n<=10000:
                 a[n-1]+=1

for n in range(N):
    print(a[n])
import math
N, *a = map(int, open(0).read().split())
ave = math.round(sum(a) / N)
ans = 0
for x in a:
  ans += (x - ave) * (x - ave)
print(ans)


### FIXED CODE ###

N, *a = map(int, open(0).read().split())
ave = round(sum(a) / N)
ans = 0
for x in a:
  ans += (x - ave) * (x - ave)
print(ans)
N, P = map(int, input().split())
Y = [i for i in range(1,int(P**(1/N))+1) if P % i == 0]
m = int(P**(1/N))
while True:
  if P % m == 0:
    x = m**N
    if P % x == 0 and P / x in Y:
      break
  m -= 1
print(m)

### FIXED CODE ###

N, P = map(int, input().split())
if N >= 40:
  print(1)
else:
  m = int(P**(1/N))+1
  while True:
    if P % m == 0:
      x = m**N
      if P % x == 0:
        break
    m -= 1
  print(m)
li = list(map(int, input().split()))

n=0

for i in range(0,3):
  if li[i+1] - li[i] ==0:
    n++

if n==1:
  print("Yes")
else:
  print("No")



### FIXED CODE ###

li = list(map(int, input().split()))

n=0

for i in range(0,2):
  if li[i+1] - li[i] ==0:
    n+=1
if li[2] - li[0] ==0:
  n+=1

if n==1:
  print("Yes")
else:
  print("No")
a = list(map(int,input().split()))
b = list(map(int,input().split()))
c = list(map(int,input().split()))
d = [a[0],b[0],c[0]]
e = [a[1],b[1],c[1]]
f = [a[2],b[2],c[2]]
g = [a[0],b[1],c[2]]
h = [a[2],b[1],c[0]]

n = int(input())

bs = []
for _ in range(n):
             bs.append(int(input())
       
for l in [a,b,c,d,e,f,g,h]:
             if (l[0] in bs) and (l[1] in bs) and (l[2] in bs):
             print("Yes")
             break
else:
             print("No")


### FIXED CODE ###

a = list(map(int,input().split()))
b = list(map(int,input().split()))
c = list(map(int,input().split()))
d = [a[0],b[0],c[0]]
e = [a[1],b[1],c[1]]
f = [a[2],b[2],c[2]]
g = [a[0],b[1],c[2]]
h = [a[2],b[1],c[0]]

n = int(input())

bs = []
for _ in range(n):
    bs.append(int(input()))

for l in [a,b,c,d,e,f,g,h]:
    if (l[0] in bs) and (l[1] in bs) and (l[2] in bs):
        print("Yes")
        break
else:
        print("No")
a = int(input())
b = int(input())
if a == b:
   print("a==b")
elif a > b:
   print("a > b")
else:
   print("a < b")

### FIXED CODE ###

a,b = map(int,input().split()) 
if a > b:
   print("a > b")
elif a < b:
   print("a < b")
else:
   print("a == b")
k=intinput()
x=intinput()
if x <= k :
  print("Yes")
else :
  print("No")


### FIXED CODE ###

k,x = map(int,input().split())
if x <= 500*k :
    print('Yes')
else :
    print('No')
#include <stdio.h>
#include <math.h>

int count(char *s, char c, int N1, int N2)
{
  int i, num = 0;
  for (i = N1; i < N2; ++i)
  {
    if (s[i] == c) ++num;
  }
  return num;
}

int main()
{
  int N;
  scanf("%d", &N);
  char S[N];
  scanf("%s", S);

  int n_list[N];
  int j;
  for (j = 0; j < N: ++j)
  {
    n_list[j] = 0;
  }

  int num = 0;
  num += count(S, 'E', 1, N);
  n_list[0] = num;
  int i;
  for (i = 1; i < N - 2; ++i)
  {
    num = 0;
    num += count(S, 'W', 0, i-1);
    num += count(S, 'E', i+1, N);
    n_list[i] = num;
  }
  num = 0;
  num += count(S, 'W', 0, N-1);
  n_list[0] = num;

  num = 10;
  for (i = 0; i < N; ++i)
  {
    printf("%d\n", n_list[i]);
    if (n_list[i] < num) num = n_list[i];
  }

  printf("%d", num);
}


### FIXED CODE ###

line = input()
line = line.split()

A = int(line[0])
B = int(line[1])
print(max(A + B, A - B, A * B))
enpitu = input("N ==:")
if enpitu <= 999:
	honsuu = enpitu // 10
	if honsuu == 3:
		print("bon")
	elif honsuu == 0, 1, 6, 8:
		print("pon")
	else:
		print("hon")
else:
    break


### FIXED CODE ###

n = int(input()) % 10
if n == 3:
    print("bon")
elif n in {0, 1, 6, 8}:
    print("pon")
else:
    print("hon")
import math
A, B, H, M = map(int, input().split())

A_x = A * math.cos(2 * math.pi * (H + M / 60.) / 12.)
A_y =  A * math.sin(2 * math.pi * (H + M / 60.) / 12.)
B_x = B * math.cos(2 * math.pi * M / 60.)
B_y = B * math.sin(2 * math.pi * M / 60.)

print('{:.15f}'.format(math.sqrt((A_x - B_x) ** 2 + (A_y - B_y) ** 2)))

### FIXED CODE ###

N = int(input())
n = N % 10

if n == 3:
    print('bon')
elif n in [0, 1, 6, 8]:
    print('pon')
else:
    print('hon')
A,B = map(int, input().split())
#B = int(input())

if A <= 2 * B:
  print(0)
else:
  print(A-

### FIXED CODE ###

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

if A <= 2 * B:
  print(0)
else:
  print(A-(2*B))
S = list(input())
for i in range(len(S)):
  if i % 2 == 0:
   	if S[i] == ("R" or "U" or "D"):
    	continue
   	else:
    	print("No")
      	exit()
  else:
    if S[i] == ("L" or "U" or "D"):
    	continue
    else:
    	print("No")
      	exit()
print("Yes")


### FIXED CODE ###

s = input()
if s == "Sunny":
  print("Cloudy")
elif s == "Cloudy":
  print("Rainy")
else:
  print("Sunny")
import numpy as np

N = int(input())
X = input()
px = X.count('1')

def xmod(m):
    res = []
    mod = 1
    for s in reversed(X):
        res.append(mod)
        mod = (mod * 2) % m
    
    return list(reversed(res))

plus = xmod(px+1)
minus = xmod(px-1)
sp = sum(plus)
sm = sum(minus)

for i in range(N):
    if X[i] == '0':
        sum_ = (sp - plus[i]) % (px+1)
        if sum_ == 0:
            print(0)
        else:
            cnt = 0
            while sum_ == 0:
                cnt += 1
                sum_ = sum_ % popcpunt(sum_)
            print(cnt)
    else:
        sum_ = (sm - minus[i]) % (px-1)
        if sum_ == 0:
            print(0)
        else:
            cnt = 0
            while sum_ == 0:
                cnt += 1
                sum_ = sum_ % popcpunt(sum_)
            print(cnt)
      
def popcount(x):
    x = x - ((x >> 1) & 0x5555555555555555)

    x = (x & 0x3333333333333333) + ((x >> 2) & 0x3333333333333333)

    x = (x + (x >> 4)) & 0x0f0f0f0f0f0f0f0f # 8bitごと
    x = x + (x >> 8) # 16bitごと
    x = x + (x >> 16) # 32bitごと
    x = x + (x >> 32) # 64bitごと = 全部の合計
    return x & 0x0000007f


### FIXED CODE ###

L, R, d = map(int, input().split())

n = R-L+1
print(sum(1 if i%d == 0 else 0 for i in range(L, L+n)))
while True:
	n=input()
	hon="24579"
	pon="0168"
	x=n[len(n)-1]
	if x in hon:
		print("hon")
	elif x in pon:
		print("pon")
	else:
		print("bon")


### FIXED CODE ###

n=input()
hon="24579"
pon="0168"
x=n[len(n)-1]
if x in hon:
	print("hon")
elif x in pon:
	print("pon")
else:
	print("bon")
import sys
import math

a = int(sys.argv[1])
b = int(sys.argv[2])
c = int(sys.argv[3])

result = (math.sqrt(a) + math.sqrt(b)) < math.sqrt(c)
if result:
    print("Yes")
else:
    print("No")

### FIXED CODE ###

import sys

argument = sys.stdin.readline()
args = argument.split()
a = int(args[0])
b = int(args[1])
c = int(args[2])

d = c - a - b

result = (d > 0) and 4 * a * b < d**2
if result:
    print("Yes")
else:
    print("No")
word = input().lower()
texts = []
while TRUE:
  str = input()
  if str == 'END_OF_TEXT':
    break
  str = str.lower()
  texts.extend([s.lower() for s in str.split()] )
    

ans = texts.count(word)

print ans

### FIXED CODE ###

word = input().lower()
texts = []
while True:
  str = input()
  if str == 'END_OF_TEXT':
    break
  texts.extend([s.lower() for s in str.split()] )
    

ans = texts.count(word)

print(ans)
n, m = map(int, input().split())
 
A = [int(i) for i in input().split()]
 
L = []
for i in range(m):
    b,c = map(int, input().split())
    L.append((b,c))
    
A = sorted(A)
 
from bisect import bisect_left
import numpy as np
A = np.array(A)
for l in L:
    tmp0 = l[0]
    tmp1 = l[1]
    A_select = A[0:tmp0]
    A_len = bisect_left(A_select, tmp1)
    A[0:A_len] = tmp1
    A = np.sort(A)
    
    
print(sum(A))

### FIXED CODE ###

N, M = map(int, input().split())
A = [int(i) for i in input().split()]

D = {}
for i in range(M):
    b,c = map(int, input().split())
    if c in D:
        D[c] += b
    else:
        D[c] = b
        
for a in A:
    if a in D:
        D[a] += 1
    else:
        D[a] = 1
        
D_sort = sorted(D.items(), reverse=True)
check = 0
ans = 0
for d in D_sort:
    check += d[1]
    if check <= N:
        ans += d[0] * d[1]
    else:
        ans += d[0] * (d[1] - (check - N))
        break
print(ans)
friend_dic = {}
block_dic = {}

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

for i in range(N):
    friend_dic[i+1] = []
    block_dic[i+1] = [i+1]

for _ in range(M):
    a, b = map(int, input().split())
    friend_dic[a].append(b)
    friend_dic[b].append(a)

for _ in range(K):
    a, b = map(int, input().split())
    block_dic[a].append(b)
    block_dic[b].append(a)

def search_friends(n, friends):
    for my_friend in friend_dic[n]:
        if my_friend not in friends:
            friends.append(my_friend)
            search_friends(my_friend, friends)

result = []
for i in range(1, N+1):
    friends = []
    search_friends(i, friends)
    result.append(str(len(set(friends)-set(friend_dic[i])-set(block_dic[i]))))

print(" ".join(result))


### FIXED CODE ###

class UnionFind:
    """
    parents: 各要素の親要素
             要素がrootの場合には　-(そのグループに属する要素数) を格納
    """
    def __init__(self, n):
        self.n = n
        self.parents = [-1] * n

    def find(self, x):
        # xが属するグループのrootを取得
        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 same(self, x, y):
        return self.find(x) == self.find(y)

    def members(self, 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())

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

union_find = UnionFind(n)
friends_counter = {i: 0 for i in range(n)}
blocks_counter = {i: 0 for i in range(n)}

for _ in range(m):
    a, b = map(int, input().split())
    union_find.union(a-1, b-1)
    friends_counter[a-1] += 1
    friends_counter[b-1] += 1

for _ in range(k):
    c, d = map(int, input().split())
    if union_find.same(c-1, d-1):
        blocks_counter[c-1] += 1
        blocks_counter[d-1] += 1

result = []
for i in range(n):
    result.append(str(union_find.size(i) - friends_counter[i] - blocks_counter[i] - 1))

print(" ".join(result))
n = int(input())
#n, m = list(map(int, input().split()))
# a, b, c = list(map(int, input().split()))
abc = [int(input()) for i in range(5)]
count = 0
start = math.ceil(n/abc[0])-1
_min = abc[0]
for i in range(5):
    if abc[i] < _min:
        count += math.ceil((_min-abc[i])/abc[i])
        _min = abc[i]

print(count+start+5)


### FIXED CODE ###

import math
n = int(input())
#n, m = list(map(int, input().split()))
# a, b, c = list(map(int, input().split()))
abc = [int(input()) for i in range(5)]
_min = min(abc)
min_idx = abc.index(min(abc))
count = math.ceil(n/_min)
count += min_idx+(4-min_idx)
print(count)
N, T = map(int, input().split())
weight = []
value = []

dp = [[0] * (6010) for i in range(3010)]

for i in range(N):
    w, v = map(int, input().split())
    weight.append(w)
    value.append(v)
#配る
addi = set([])
for i, (ww, vv) in enumerate(zip(weight, value)):
    for w in range(T):            
        dp[i+1][w] = max(dp[i+1][w], dp[i][w])
        if w+W >= T:
            addi.add(w+W)
        dp[i+1][w+ww] = max(dp[i][w+ww], dp[i][w] + vv)
        #else: dp[i+1][w] = dp[i][w]

    for w in addi:
        dp[i+1][w] = max(dp[i+1][w], dp[i][w])


print(max(dp[N]))
"""
for i, v in enumerate(dp[N][:200]):
    print("{}:{}, ".format(i, v), end="")
"""


### FIXED CODE ###

import sys
def input(): return sys.stdin.readline().strip()

def main():
    N, T = map(int, input().split())
    cv = [tuple(map(int, input().split())) for _ in range(N)]
    cv = sorted(cv, key=lambda x : x[0])

    dp = [[0]*(T+1) for _ in range(N+1)]
    dp_ext = [[0]*(T+1) for _ in range(N+1)]

    values = [v for c, v in cv]
    max_values = [max(values[i:]) for i in range(N)]
    # 貰うdp
    for i in range(N):
        cost, value = cv[i]
        for now in range(cost, T+1):
            old = now - cost
            dp[i+1][now] = max(dp[i][now], dp[i][old] + value)

        for j in range(1, T+1):
            dp[i+1][j] = max(dp[i+1][j], dp[i+1][j-1])
        
        for j in range(1, T+1):
            dp_ext[i+1][j] = max(dp[i+1][j], dp[i][j-1] + max_values[i], dp_ext[i][j])

    print(dp_ext[N][T])

if __name__ == "__main__":
    main()
N,K=map(int,input().split())
A=list(map(int,input().split()))
lk=len(bin(K))-2
C=[0]*lk
for j in range(N):
  a=A[j]
  for i in range(lk):
    if a%2==1:
      C[i]+=1
    a=(a-a%2)//2

X="0b"
for i in reversed(range(lk)):
  if C[i]>=N-C[i]:
    X+="0"
  else:
    X+="1"
    
if int(X,0)<=K:
  X=int(X,0)
  ans=0
  for i in range(N):
    ans+=X^A[i]
  print(ans)
else:
  ans=-1
  for i in range(2,lk+2):
    x=int(bin(K)[:i]+"0"+X[i+1:],0)
    if x<=K:
      a=0
      for i in range(N):
        a+=x^A[i]
      ans=max(ans,a)
  print(ans)


### FIXED CODE ###

T,X=map(int,input().split())
print(T/X)
a,b = list(map(int, input().split()))
if a == b:
  print(2 * a)
else:
  printf(max(a,b) * 2 - 1)

### FIXED CODE ###

a, b = list(map(int,input().split()))
if a == b:
  print(2 * a)
else:
  print(max(a,b) * 2 -1)
a = int(input)
print(a//3)

### FIXED CODE ###

a = int(input())
print(a//3)
import math
a,b=map(int,input().split())
print(ceil((a+b)/2))

### FIXED CODE ###

import math
a,b=map(int,input().split())
print(math.ceil((a+b)/2))
x,y = input().split()
x = int()
y = int()
while true:
    if x < y:
        print(y,x)
    if x > y:
        print(x,y)
    if x==0 and y==0:
        break
    


### FIXED CODE ###


while True:
    x,y = input().split()
    x = int(x)
    y = int(y)
    if x==0 and y==0:
        break
    elif x<y:
        print(x,y)
    elif x>=y:
        print(y,x)
S = input()
ans = {'SUN': 7, 'MON': 6, 'TUE': 5 'WED': 4, 'THU': 3, 'FRI': 2, 'SAT': 1}
print(ans[S])

### FIXED CODE ###

S = input()
ans = {'SUN': 7, 'MON': 6, 'TUE': 5, 'WED': 4, 'THU': 3, 'FRI': 2, 'SAT': 1}
print(ans[S])
#include <iostream>
#include <map>
typedef int64_t int64;
using namespace std;



int main() {
	int64 n, d, a;
	cin >> n;
	cin >> d;
	cin >> a;
	map<int64, pair<int64, int64>> m;
	for (int64 i=0; i<n; i++) {
		int64 b, c;
		cin >> b;
		cin >> c;
		m[b] = {c, 0};
	}
	int64 destroy = 0;
	int64 bombs = 0;

	for (auto [x, values]: m) {
		auto [health, update] = values;
		health -= destroy;
		if (health > 0) {
			int64 times = (health-1) / a + 1;
			bombs += times;
			if (d==0) continue;
			destroy += times*a;
			if (m.count(x+2*d)) m[x+2*d] = {m[x+2*d].first, times};
			else m[x+2*d] = {0, times};	
		}
		destroy -= update*a;
	}
	cout << bombs;
	return 0;
			
}	


### FIXED CODE ###

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

D = True

pos = []
pos1 = []

for i in range(n):
	x, h = map(int, input().split())
	pos.append((x, h))

pos.sort(key=lambda x: x[0])

bombs = 0
damage = 0
y, z = 0, 0


while y < n:
	x0 = pos[y][0]
	try:
		x1 = pos1[z][0]
	except IndexError:
		x1 = 1e16
	if x0 <= x1:
		health = pos[y][1]
		health -= damage
		number = max(0, (health-1) // a + 1)
		bombs += number
		damage += number*a
		pos1.append((x0+2*d, number*a))
		y+=1
	else:
		damage -= pos1[z][1]
		z += 1
	

print(bombs)
N=int(input())
p=list(map(int,input().split()))
co=0
ans='YES'
for i in range(N):
  if p[i]!=i+1:
    co+=1
if co<=1:
  break
else:
  ans='NO'
print(ans)

### FIXED CODE ###

N=int(input())
p=list(map(int,input().split()))
np=sorted(p)
co=0
ans='YES'
for i in range(N):
  if p[i]!=np[i]:
    co+=1
if co<=2:
  print('YES')
else:
  print('NO')
n = int(input())
def f(x):
    x%10+f(x//10) if x else 0
print(min([f(i)+f(n-i) for i in range(0,n+1)]))

### FIXED CODE ###

def f(x):
    return x%10+f(x//10) if x else 0
n = int(input())
print(min([f(i)+f(n-i) for i in range(1,n)]))