Harryxun/stf_run huggingface dataset:
# -*- coding: utf-8 -*-
import sys

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

#str_lines = [x.strip("\n") for x in sys.stdin.readlines()]
str_lines = [input() for i in range(M)]

list_str_P_S=[]
for S in str_lines:
  list_str_P_S.append( list(S.split()) )

#-----
#-----

list_question_no=list(set(list(zip(*list_str_P_S))[0]))

#print("list_str_P_S=",list_str_P_S)
#print("list_question_no=",list_question_no)

count_AC=0
count_WA=0
for str_i in list_question_no:

  for L in list_str_P_S:
    str_number = L[0]
    result = L[1]
    
    if str_number == str_i:
      if result == "WA":
        count_WA += 1
        #print("L",L,count_AC,count_WA)
      elif result == "AC":
        count_AC += 1
        #print("L",L,count_AC,count_WA)
        break

#print("ans=",count_AC,count_WA)
print(count_AC,count_WA)


### FIXED CODE ###

# -*- coding: utf-8 -*-

N,M = list(map(int, input().rstrip().split()))
pS_list = []

for i in range(M):
    inp = input().rstrip().split()
    pS_list.append( [int(inp[0]), inp[1]] )

#-----
problem_AC_set = set()
problem_WA_dic = {}

for p,S in pS_list:
    if (S == "AC") and (p not in problem_AC_set):
        problem_AC_set.add(p)
    
    if (S == "WA") and (p not in problem_AC_set):
        problem_WA_dic.setdefault(p, 0)
        problem_WA_dic[p] += 1

cnt_AC = len(problem_AC_set)
cnt_WA = sum([v for k,v in problem_WA_dic.items() if k in problem_AC_set])

print(cnt_AC, cnt_WA)
a = input()
b = input()

ans1 = a * b
ans2 = 2 * ( a + b )

print ans1 ans2

### FIXED CODE ###

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

ans1 = a * b
ans2 = 2 * ( a + b )

print ans1 , ans2
N = int(input())
A = int(input())
B = int(input())
if N == 1:
    print("Hello World")
elif N == 2:
    print(A + B)

### FIXED CODE ###

N = int(input())
if N == 1:
    print("Hello World")
else:
    A = int(input())
    B = int(input())
    print(A + B)
S = input()

for s in S[0::2]:
    if s != 'R' and s != 'U' and s != 'D':
        print('No')
        quit()

for s in S[1::2]:
    if S[i] != 'L' and S[i] != 'U' and S[i] != 'D':
        print('No')
        quit()

print('Yes')


### FIXED CODE ###

S = input()

for s in S[0::2]:
    if s != 'R' and s != 'U' and s != 'D':
        print('No')
        quit()

for s in S[1::2]:
    if s != 'L' and s != 'U' and s != 'D':
        print('No')
        quit()

print('Yes')
s=input()
a=0
for i in s:
  if i in ATGC:
    a+=1
  else:
    b=a
    a=0
print(max(a,b))

### FIXED CODE ###

s=input()
a=0
b=0
for i in s:
  if i in "ATGC" :
    a+=1
  else:
    b=max(a,b)
    a=0
print(max(a,b))
list1 = list(input())

#貪欲
for i in range(1,len(list1)):
	if list1[i] == list1[i-1]:
		if list1[i] == "1":
			list1[i] = "0"
		else:
			list1[i] = "1"
		count += 1
print(count)

### FIXED CODE ###

list1 = list(input())
count = 0
#貪欲
for i in range(1,len(list1)):
	if list1[i] == list1[i-1]:
		if list1[i] == "1":
			list1[i] = "0"
		else:
			list1[i] = "1"
		count += 1
print(count)
H, A = map(int, input().split())
H, A = int(H. A)
def a(H,A):
  if H/B <= 0:
    print(H//A+1)
  else:
    print(H/A)
    return

a(H,B)

### FIXED CODE ###

H, A =map(int, input().split())
if H%A == 0:
  print(int(H/A))
else:
  print(H//A+1)
A = list(map(int,input().split()))
K = int(input())
 
A = A.sort
ans =A[0]+A[1]+A[2]*(2**K)

print(ans)

### FIXED CODE ###

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

if a<=b:
    print(a)
else:
    print(a-1)
N,M = map(int,input().split())
X = [list(map,int(input().split())) for i in range(M)]

keymax = 10**6
keymin = 0
for i in range(M):
	if X[i][0] > keymin:
		keymin = X[i][0]
	if X[i][1] < keymax:
		keymax = X[i][1]

print(keymax-keymin+1)

### FIXED CODE ###

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

keymax = 10**6
keymin = 0
for i in range(M):
	if X[i][0] > keymin:
		keymin = X[i][0]
	if X[i][1] < keymax:
		keymax = X[i][1]

if keymax >= keymin:
	print(keymax-keymin+1)
else:
	print("0")
import numpy as np
N,Q = map(int,input().split())
a = []
b = []
p = []
x = []
ans = np.array([0]*N)
test = np.array([1]*N)
test = np.diag(test)
for i in range(1,N):
    ai,bi = map(int,input().split())
    test[ai-1,bi-1]+=1
    # a.append(ai)
    # b.append(bi)

for k in reversed(range(N)):
    check = np.where(test[k] > 0)
    test[k]+=np.sum(test[check],axis=0)
test = np.where(test > 0,1,0)
# print(test)

for j in range(Q):
    pj,xj = map(int,input().split())
    temp = test[pj-1]*xj
    ans += temp

    # p.append(pj)
    # x.append(xj)
print(' '.join(map(str,ans)))

### FIXED CODE ###

N,Q = map(int,input().split())
ans = [0]*N
ab = []
for i in range(1,N):
    ab.append(list(map(int,input().split())))
for j in range(Q):
    pj,xj = map(int,input().split())
    ans[pj-1] += xj
ab.sort()
for i in range(N-1):
    ans[ab[i][1]-1]+=ans[ab[i][0]-1]
print(' '.join(map(str,ans)))
n = int(input())
s = input()
cnt= 0

if n%2 == 0:
  for i in range(len(s)/2):
    if s[i] == s[-1-i]:
      cnt += 1
  if n/2 == cnt:
    print("Yes")
  else:
    print("No")
else:
  print("No")
    

### FIXED CODE ###

n = int(input())//2
s = input()
 
if s[:n] == s[n:]:
  print("Yes")
else:
  print("No")
import math
A = int(input())
B = int(input())
H = int(input())
M = int(input())

def angle():
  wa = 0.5
  wb = 6
  w = wb-wa
  t = H*60 + M
  wnew = (w*t)%360
  if wnew>=180:
    wnew = 360 - wnew
  return wnew

cos_angle = math.cos(math.radians(angle()))
distance = A**2 + A**2 - 2*A*B*cos_angle
answer = distance**0.5
print(answer)

### FIXED CODE ###

import math

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

def angle():
  wa = 0.5
  wb = 6
  w = wb-wa
  t = H*60 + M
  wnew = (w*t)%360
  if wnew>=180:
    wnew = 360 - wnew
  return wnew


cos_angle = math.cos(math.radians(angle()))
distance = A**2 + B**2 - 2*A*B*cos_angle
answer = distance**0.5
print(answer)
from math import log2, ceil


def _check(bbb):
    ret = 0
    pb = -1
    for b in bbb:
        if pb > b:
            d = ceil((pb - b) / 2) * 2
            ret += d
            b += d
        pb = b
    return ret


def check(x, bbb):
    ret = x
    ret += _check(bbb[x:])
    ret += _check(reversed(bbb[:x]))
    return ret


def solve(n, aaa):
    l = 0
    r = n
    bbb = list(map(log2, aaa))
    while l < r:
        m1 = (l + r) // 2
        m2 = m1 + 1
        res1 = check(m1, bbb)
        res2 = check(m2, bbb)
        # print(l, r, m1, m2, res1, res2)
        if res1 > res2:
            l = m1 + 1
        else:
            r = m1
    return check(r, bbb)


n = int(input())
aaa = list(map(int, input().split()))
print(solve(n, aaa))


### FIXED CODE ###

import numpy as np


def calc_mul4_dp(n, aaa):
    # dp[i] = aaa[i] 以右をascendingにするために4をかける必要のある回数

    # 「支配的」である数と位置を記録するstack
    # 支配的: それを4倍すると、それより右で次に支配的な数までは全て4倍する必要のある数
    # (支配的な数, ←をいじらなかった場合の支配区間の最後の数, 最初の数の位置)
    stack = [(10 ** 20, 10 ** 20, n), (aaa[-1], aaa[-1], n - 1)]
    INF = 10 ** 19
    result = [0, 0]

    for i in range(n - 2, -1, -1):
        a = aaa[i]
        c = a
        inc = 0
        while (c << 2) > stack[-1][0]:
            b, e, j = stack.pop()
            mul = 0
            while c > b:
                b <<= 2
                mul += 1
            inc += mul * (stack[-1][2] - j)
            c = min(e << (2 * mul), INF)
        stack.append((a, c, i))
        result.append(inc)
        # print(a, stack, result)
    result = np.add.accumulate(result, dtype=np.int64)[::-1]
    return result


def solve(n, aaa):
    fdp = calc_mul4_dp(n, aaa)
    bdp = calc_mul4_dp(n, aaa[::-1])[::-1]
    # print(fdp)
    # print(bdp)
    return ((fdp + bdp) * 2 + np.arange(n + 1, dtype=np.int64)).min()


def test():
    import random
    n = 200000
    # aaa = random.choices(range(1, 10 ** 9), k=n)
    # aaa = [1, 10 ** 9] * (n // 2)
    aaa = list(range(10 ** 9, 10 ** 9 - n, -1))
    print(n)
    # print(aaa)
    print(solve(n, aaa))


# test()

n = int(input())
aaa = list(map(int, input().split()))
print(solve(n, aaa))
S=input()
if S[2]==S[3] && S[4]==S[5]:
  print('Yes')
else:
  print('No')

### FIXED CODE ###

S=str(input())
if S[2]==S[3] and S[4]==S[5]:
  print('Yes')
else:
  print('No')
n, m = map(int, input().split())
g = [[] for i in range(n)]
for  i in range(n):
    a, b = map(int, input().split())
    a-=1; b-=1
    g[a].append(b)
    g[b].append(a)

used = [False] * n
ans = 0
def dfs(itr, n, cnt=0):
    if len(itr)==n:
        return 1
    elif len(itr)==0:
        ans = cnt
        for i in range(n):
            used[i] = True
            ans += dfs([i], n)
        return ans
    else:
        ans = cnt
        for e in g[itr[-1]]:
            if used[e]:
                continue
            used[e] = True
            ans+=dfs(itr+[e], n)
            used[e] = False
        return ans

print(dfs([], n, 0))

### FIXED CODE ###

import sys
sys.setrecursionlimit(10**8)
n, m = map(int, input().split())
g = [[] for i in range(n)]
for  i in range(m):
    a, b = map(int, input().split())
    a-=1; b-=1
    g[a].append(b)
    g[b].append(a)

used = [False] * n
ans = 0
def dfs(itr, n, cnt=0):
    ans = 0
    if len(itr)==n:
        return 1
    else:
        ans = cnt
        for e in g[itr[-1]]:
            if used[e]:
                continue
            used[e] = True
            ans+=dfs(itr+[e], n)
            used[e] = False
    return ans

used[0] = True
print(dfs([0], n, 0))
import numpy as np

H, W, M = map(int, input().split())
h_t = [0]*H
w_t = [0]*W
t = {}
for i in range(M):
    h, w = map(int, input().split())
    t[(h-1, w-1)] = 1
    h_t[h-1]+=1
    w_t[w-1]+=1
print(t)
h_max = max(h_t)
h_max_list = [i for i in range(len(h_t)) if h_t[i] == h_max]
w_max = max(w_t)
w_max_list = [i for i in range(len(w_t)) if w_t[i] == w_max]

for h in h_max_list:
    for w in w_max_list:
        if (h, w) not in t:
            print(h_max + w_max)
            exit()
print(h_max + w_max - 1)

### FIXED CODE ###

N, X, T = map(int, input().split())
a = (N // X) * T
if N % X != 0:
    a += T
print(a)
a = int(input())
b = int(input())
a * b 
(a + b) * 2

### FIXED CODE ###

[a, b] = map(int, input().split())
print(a*b, (a+b)*2)
n = int(input())
a = list(map(int, input().split()))
sa = sorted(a)
am, asl = sa[-1], sa[-2]
print(*[asl if ai == am else am for ai in a], sep='\n')

### FIXED CODE ###

n = int(input())
a = [int(input()) for i in range(n)]
b = a.copy()
b.sort()
a_max = b[-1]
a_second = b[-2]
for i in range(n):
    if a[i] == a_max:
        print(a_second)
    else:
        print(a_max)
S,W=input().sep("")
S=int(S)

W=int(W)

if W >= S:
  print("unsafe")
else:
  print("safe")


### FIXED CODE ###

s, w = input().split(" ")

s = int(s)
w = int(w)

if w >= s:
    print("unsafe")
else:
    print("safe")
x = map(int,input().split())

W = x[0]
H = x[1]
x = x[2]
y = x[3]
r = x[4]

if 0 <= x-r and x+r <= W and 0 <= y-r and y+r <= H:
    print "Yes"
else:
    print "No"

### FIXED CODE ###

m = map(int,raw_input().split())

W = m[0]
H = m[1]
x = m[2]
y = m[3]
r = m[4]


if 0 <= x-r and x+r <= W and 0 <= y-r and y+r <= H:
    print "Yes"
else:
    print "No"
n=int(input())
d=n//500
e=n%500
f=e//5
print('d*1000 + f*5)


### FIXED CODE ###

n=int(input())
d=n//500
e=n%500
f=e//5
print(d*1000+f*5)
N = int(input())
Flag = False
MAXC = 0
for TN in range(0,N):
    D1,D2 = (int(T) for T in input().split())
    if Flag==False and D1==D2:
        Flag = True
        Cout = 1
    elif Flag==True and D1==D2:
        Cout += 1
    elif Flag==True and D1!=D2:
        Flag = False
        MAXC = max(MAXC,Cout)
MAXC = [MAXC,max(MAXC,Cout)][Flag]
print(['No','Yes'][MAXC>=3])

### FIXED CODE ###

N = int(input())
Flag = False
MAXC = 0
Cout = 0
for TN in range(0,N):
    D1,D2 = (int(T) for T in input().split())
    if Flag==False and D1==D2:
        Flag = True
        Cout = 1
    elif Flag==True and D1==D2:
        Cout += 1
    elif Flag==True and D1!=D2:
        Flag = False
        MAXC = max(MAXC,Cout)
MAXC = [MAXC,max(MAXC,Cout)][Flag]
print(['No','Yes'][MAXC>=3])
s = input()
t = input()
lent = len(t)
ans = []
for i in range(len(s) - lent):
    ss = s[i:i+lent]
    ans1 = 0
    for s1, t1 in zip(ss, t):
        ans1 += (s1==t1)
    ans.append(ans1)
print(lent-max(ans))

### FIXED CODE ###

s = input()
t = input()
lent = len(t)
ans = []
if len(s) == lent:
    ans1 = 0
    for s1, t1 in zip(s, t):
        ans1 += (s1==t1)
    ans.append(ans1)
else:
    for i in range(len(s) - lent):
        ss = s[i:i+lent]
        ans1 = 0
        for s1, t1 in zip(ss, t):
            ans1 += (s1==t1)
        ans.append(ans1)
print(lent-max(ans))
a = int(input())
# スペース区切りの整数の入力
b = input().split()
b = [int(i) for i in b]


//a = 4
//b=[5, 6, 8, 10]

c = len(b)
d = 0


while c == len(b):
  c=0
  for i in b:
    if b %2 == 0:
      c +=1
  if(c == len(a)):
    d += 1
    b = [b /2 for i in b]
print (d)
   




### FIXED CODE ###


a = int(input())
# スペース区切りの整数の入力
b = input().split()
b = [int(i) for i in b]

c = len(b)
d = 0


while c == len(b):
  c=0
  for i in b:
    if i %2 == 0:
      c +=1
  if(c == len(b)):
    d += 1
    b = [i/2 for i in b]
print (d)
import math
test = input()
five_hundred = math.floor(test / 500) * 1000
five_happy = math.floor((test - five_hundred*500)/5) * 5
print(five_hundred + five_happy)

### FIXED CODE ###

import math
numeric = int(input())
result = math.floor(numeric / 500)*1000
intermediate = numeric - math.floor(numeric / 500)*500
result = result + math.floor(intermediate / 5)*5
print(result)
import math
import numpy as np
import sys
import os
from operator import mul
from operator import itemgetter
from collections import defaultdict as D


sys.setrecursionlimit(10**7)

def _S(): return sys.stdin.readline().rstrip()
def I(): return int(_S())
def LS(): return list(_S().split())
def LI(): return list(map(int,LS()))

if os.getenv("LOCAL"):
    inputFile = basename_without_ext = os.path.splitext(os.path.basename(__file__))[0]+'.txt'
    sys.stdin = open(inputFile, "r")
INF = float("inf")
IINF = 10 ** 18
MOD = 10 ** 9 + 7
# MOD = 998244353    

N,M = LI()
H = LI()
AB = [LI() for _ in range(M)]

obs = [(i-1,h) for i,h in enumerate(H)]
obs.sort(key=itemgetter(1),reverse=True)

seenFromHigher = set()

roads = D(set)

for i in range(M):
    f = AB[i][0]-1
    t = AB[i][1]-1
    roads[f].add(t)
    roads[t].add(f)

ans = 0
for ob in obs:
    if not (ob[0] in seenFromHigher):
        isHighest = True
        for i in roads[ob[0]]:
            seenFromHigher.add(i)
            if ob[1] < H[i]:
                isHighest = False 
        if isHighest:
            ans += 1

print(ans)

# p = []
# d = {}
# for i in range(N):
#     d[i]=H[i]

# # g = np.zeros(shape=(N,N),dtype='int')
# g = [set()] * N
# a = [True] * N

# for i in range(M):
#     f = AB[i][0]-1
#     t = AB[i][1]-1
#     if d[t]>d[f]:
#         a[f]=False
#     elif d[f]>d[t]:
#         a[t]=False
#     else:
#         a[f]=False
#         a[t]=False
# print(sum(a))  


### FIXED CODE ###

import math
import numpy as np
import sys
import os
from operator import mul
from operator import itemgetter

sys.setrecursionlimit(10**7)

def _S(): return sys.stdin.readline().rstrip()
def I(): return int(_S())
def LS(): return list(_S().split())
def LI(): return list(map(int,LS()))

if os.getenv("LOCAL"):
    inputFile = basename_without_ext = os.path.splitext(os.path.basename(__file__))[0]+'.txt'
    sys.stdin = open(inputFile, "r")
INF = float("inf")
IINF = 10 ** 18
MOD = 10 ** 9 + 7
# MOD = 998244353    

N,M = LI()
H = LI()
AB = [LI() for _ in range(M)]

p = []
d = {}
for i in range(N):
    # p.append((i,H[i]))
    d[i]=H[i]
# p.sort(key=itemgetter(1),reverse=True)
# print(p)
# print(d)

# g = np.zeros(shape=(N,N),dtype='int')
g = [set()] * N
a = [True] * N

for i in range(M):
    f = AB[i][0]-1
    t = AB[i][1]-1
    if d[t]>d[f]:
        a[f]=False
    elif d[f]>d[t]:
        a[t]=False
    else:
        a[f]=False
        a[t]=False
# print(a)
print(sum(a))  
    # print(g[f])
    # g[f] = np.append(g[f],t)
    # g[t] = np.append(g[t],f)
   
    # g[f][t]=1
    # g[t][f]=1

# print(g)
# list.sort(key=itemgetter(0))

# for i in range(N):


# a = np.where(g[0]==1)
# print(a)
S = list(input())
K = int(input())
S.extend(S)

prev = ''
cnt = 0
for s in S:
    if s == prev:
        cnt += 1
        prev = ''
    else:
        prev = s

b = 0
if K > 2 and S[0] == S[-1]:
    mae = 1
    while S[mae] == S[0]:
        mae += 1
    if mae % 2 == 1 and mae != len(S):
        usiro = 1
        i = len(S) - 2
        while S[i] == S[-1]:
            usiro += 1
            i -= 1
        if usiro % 2 == 1:
            b = K // 2

if K % 2 == 0:
    res = cnt * (K // 2) + (b - 1)
else:
    res = cnt * (K // 2) + cnt // 2 + b
print(res)


### FIXED CODE ###

S = list(input())
K = int(input())
S.extend(S)

prev = ''
cnt = 0
for s in S:
    if s == prev:
        cnt += 1
        prev = ''
    else:
        prev = s

b = 0
if K % 2 == 0:
    b += 1
if K > 2 and S[0] == S[-1]:
    mae = 1
    while mae < len(S) and S[mae] == S[0]:
        mae += 1
    if mae % 2 == 1 and mae != len(S):
        usiro = 1
        i = len(S) - 2
        while S[i] == S[-1]:
            usiro += 1
            i -= 1
        if usiro % 2 == 1:
            b = K // 2

if K % 2 == 0:
    res = cnt * (K // 2) + (b - 1)
else:
    res = cnt * (K // 2) + cnt // 2 + b
print(res)
n = int(input())
num = {}
for i in range(n):
    a = input()
    num[a]=True
print(num.keys().count())

### FIXED CODE ###

n = int(input())
num = {}
for i in range(n):
    a = input()
    num[a]=True
print(len(num.keys()))
for i in range(10000):
  x = input().split()
  h = int(x[0])
  w = int(x[1])
  for i in range(h):
    for i in range(w):
      print("#",end="")
    print() 


### FIXED CODE ###

for i in range(10000):
  x = input().split()
  h = int(x[0])
  w = int(x[1])
  if h ==0 and w == 0:
    break
  for i in range(h):
    for i in range(w):
      print("#",end="")
    print() 
  print()
S=input()
A=S.replace(01"")
B=A.replace(10"")
print(len(S)-len(B))


### FIXED CODE ###

S=list(input())
a=S.count("1")
b=S.count("0")
if a>=b:
    print(b*2)
else :
    print(a*2)
N, M = map(int, input().split())
ab = [list(map(int, input().split())) for i in range(MM)]
ans = 0
tyukan = []
saigo = []

for i in range(M):
    if ab[i][0] == 1:
        tyukan.append(ab[i][1])

for i in ab:
    if ab[i][0] in tyukan:
        if ab[i][1] == N:
            ans =1
            break

print('POSSIBLE' if ans == 1 else 'INPOSSIBLE')

### FIXED CODE ###

N, M = map(int, input().split())
mid, las = [], []
ans = 0

for i in range(M):
    a, b = map(int, input().split())
    if a == 1:
        mid.append(b)
    
    elif b == N:
        las.append(a)

if len(set(mid) & set(las)) != 0:
    ans =1

print('POSSIBLE' if ans == 1 else 'IMPOSSIBLE')
from bisect import bisect_left
from itertools import accumulate
N,M,*A = map(int, open('0').read().split())
A.sort()
B = list(accumulate(A[::-1]))
l = -1
r = 10**9
while l+1<r:
  s = (l+r)//2
  cnt = 0
  for c in A:
    i = bisect_left(A,s-c)
    cnt += N-i
  if cnt>=M:
    l = s
  else:
    r = s
ans = 0
for c in A:
  i = bisect_left(A,r-c)
  M -= N-i
  if i<N:
    ans += B[N-1-i]+c*(N-i)
ans += M*l
print(ans)

### FIXED CODE ###

N, M = map(int, input().split())
A = [int(c) for c in input().split()]
A.sort(reverse=True)
B = A[::-1]
l = 0
r = 10**6
def f(m):
  cnt = 0
  j = 0
  for i in range(N):
    while j<N:
      if A[i]+B[j]>=m:
        cnt += N-j
        break
      j += 1
  return cnt>=M
while l+1<r:
  n = (l+r)//2
  if f(n):
    l = n
  else:
    r = n
C = [0]
for i in range(N):
  C += [C[-1]+B[i]]
ans = 0
j = 0
m = 0
flag = False
for i in range(N):
  while j<N:
    if A[i]+B[j]>l:
      ans += C[-1]-C[j]+A[i]*(N-j)
      m += N-j
      break
    j += 1
ans += (M-m)*l
print(ans)
N = int(input())
data = list(map(int,input().split()))
dataSum = sum(data)
min = 100
for i in range(N):
    sumT = sum(data[0:i + 1])
    if abs(dataSum - sumT)  < min:
        min = abs(dataSum - sumT)
    else:
        print min
        break

### FIXED CODE ###

N = int(input())
data = list(map(int,input().split()))
dataSum = sum(data)
min = 10000
for i in range(N):
    sumT = sum(data[0:i + 1])
    if abs(sumT * 2 - dataSum)  < min:
        min = abs(sumT * 2 - dataSum)
    else:
        print (min)
        break
def solve(H, W, field):
    ret = []
    operated = set()
    for y in range(0, H):
        for x in range(0, W):
            if field[y][x] % 2 == 0:
                continue
            else:
                for (xi, yi) in [(x + 1, y), (x, y + 1)]:
                    if 0 <= xi < W and 0 <= yi < H:
	                    ret.append(" ".join([str(y + 1), str(x + 1), str(yi + 1), str(xi + 1)]))
                        field[yi][xi] += 1
                        field[y][x] -= 1
                        break
 
    return [len(ret)] + ret

### FIXED CODE ###

def solve(H, W, field):
    ret = []
    for y in range(0, H):
        for x in range(0, W):
            if field[y][x] % 2 == 1:
                for (xi, yi) in [(x + 1, y), (x, y + 1)]:
                    if 0 <= xi < W and 0 <= yi < H:
                            ret.append(" ".join([str(y + 1), str(x + 1), str(yi + 1), str(xi + 1)]))
                            field[y][x] -= 1
                            field[yi][xi] += 1
                            break
    return [len(ret)] + ret


if __name__ == "__main__":
    l = input()
    H, W = int(l.split()[0]), int(l.split()[1])
    field = [[int(c) for c in input().split(" ")] for _ in range(0, H)]
    [print(l) for l in solve(H, W, field)]
n , k , q = map(int , input().split())
a = [0] * (n + 1)
b = list(map ( int , input().split()))
for i in range(1 , n + 1):
	a[i] = b[i - 1];
def check( l , r):
	cnt = 0;
	ln = 0;
	res = 0;
	for i in range(1 , n + 1):
		if a[i] < l:
			res += min(cnt , max(0 , ln - k + 1))
			ln = 0;
			cnt = 0;
		else :
			ln += 1;
			if a[i] <= r:
				cnt += 1;
	res += min(cnt , max(0 , ln - k + 1))
	if(res >= q):
		return True;
	return False;						

l = 0;
r = 1000000000;
res = 1000000000;
while(l <= r):
	m = (l + r) // 2;
	ok = 0;
	for i in range(1 , n + 1):
		ok |= check(a[i] - m , a[i]);
	if ok == 1:
		r = m - 1;
		res = m;
	else :
		l = m + 1;
print(res)

### FIXED CODE ###

n , k , q = map(int , input().split())
a = [0] * (n + 1)
b = list(map ( int , input().split()))
for i in range(1 , n + 1):
	a[i] = b[i - 1];
def check( l , r):
	cnt = 0;
	ln = 0;
	res = 0;
	for i in range(1 , n + 1):
		if a[i] < l:
			res += min(cnt , max(0 , ln - k + 1))
			ln = 0;
			cnt = 0;
		else :
			ln += 1;
			if a[i] <= r:
				cnt += 1;
	res += min(cnt , max(0 , ln - k + 1))
	if(res >= q):
		return True;
	return False;						

l = 0;
r = 1000000000;
res = 1000000000;
while(l <= r):
	m = (l + r) // 2;
	ok = 0;
	for i in range(1 , n + 1):
		ok |= check(a[i] - m , a[i]);
	if ok == 1:
		r = m - 1;
		res = m;
	else :
		l = m + 1;
print(res)
import sys
a,b = map(int(sys.stdin.readline().split()))
print(a*b,2(a+b))


### FIXED CODE ###

import sys
a,b=map(int,sys.stdin.readline().split())
print(a*b,2*(a+b))
while 1:
	x = raw_input().split()
	a,op,b = int(x[0]),x[1],int(x[2)
	if op == "+":
		print a+b
	elif op == "-":
		print a-b
	elif op == "/":
		print a/b
	elif op == "*":
		print a*b
	else:
		break

### FIXED CODE ###

while 1:
	x = raw_input().split()
	a,op,b = int(x[0]),x[1],int(x[2])
	if op == "+":
		print a+b
	elif op == "-":
		print a-b
	elif op == "/":
		print a/b
	elif op == "*":
		print a*b
	else:
		break
n,*a=map(int,open(0).read().split())
b=[q-i for i,q in enumerate(a,1)]
b.sort()

c=b[(n+1)//2]+b[::-1][(n+1)//2]
c//=2

ans=float("inf")
for i in range(-10+c,11+c):
  tmp=sum(map(abs,[q-i for q in b]))
  ans=min(ans,tmp)
print(ans)

### FIXED CODE ###

import statistics
n,*a=map(int,open(0).read().split())
b=[q-i for i,q in enumerate(a,1)]
c=statistics.median(b)
ans=sum(map(abs,[p-c for p in b]))
print(int(ans))
def resolve():
  found = False
  N = int(input())
  for x in range(int(N/1.08), int((N+1)/1.08+1)):
    if N == math.floor(x*1.08):
      print(x)
      found = True
      break
  
  if not found:
    print(":(")
  
resolve()

### FIXED CODE ###

import math
def resolve():
  found = False
  N = int(input())
  for x in range(int(N/1.08), int((N+1)/1.08+1)):
    if N == math.floor(x*1.08):
      print(x)
      found = True
      break
  
  if not found:
    print(":(")

resolve()
S = input()
if S[2] == S[3] && S[4] == S[5]:
	print("Yes")
else:
	print("No")


### FIXED CODE ###

S = input()
if (S[2] == S[3]) and (S[4] == S[5]):
	print("Yes")
else:
	print("No")