Harryxun/stf_run huggingface dataset:
N, K = list(map(int, input().split()))
T = input()
S = [int(x) for x in list(str(T))]

L = []
num = 1
for i in range(N-1):
    if S[i] == S[i+1]:
        num += 1
    else:
        L.append(num)
        num = 1
L.append(0)

if S[0] == 0:
    cand = L[0] + L[1]
    l = len(L)
    for i in range(1, (l+1)//2):
        length = L[2*i - 1] + L[2*i] + L[2*i + 1]
        cand = max(cand, length)
    print(cand)

### FIXED CODE ###

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


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

    """
    反転させる区間は独立であるとしてよい。実際反転させる２区間が左図のように
    オーバーラップしていたとすると、これは右図のように反転させるのと同値だからである：
               _______________                             _______  
        ______|_______        |     --->    ______        |       |
    ___|______|_______|_______|_____    ___|______|_______|_______|_____ 
    
    そうすると安直には0がなるべく長く連続している区間に反転をかけたくなるが、
    長い順に反転をかけた場合1が連続する保証がないのでダメ。

    そこで1の連続する箇所を固定したうえで、そこから0の連続する区間に順番に反転をかけることを考える。
    当然愚直にやるとTLEなので、累積和で実装する
    """

    A = []
    char = S[0]
    cnt = 1
    for i in range(1, N):
        if S[i] == char:
            cnt += 1
        else:
            A.append(cnt)
            char = S[i]
            cnt = 1
    A.append(cnt)
    #print("A={}".format(A))

    B = list(accumulate(A))
    B.append(B[-1])
    #print("B={}".format(B))
    l = len(A)
    if S[0] == '0':
        ans = B[min(K * 2 - 1, l - 1)]
        for i in range(1, l - K * 2 + 1):
            if i % 2 == 0:
                j = i + K * 2 - 1
                val = B[j] - B[i - 1]
            else:
                j = i + K * 2
                val = B[j] - B[i - 1]
            #print("[{}, {}]->val={}".format(i, j, val))
            ans = max(ans, val)
    else:
        ans = B[min(K * 2, l - 1)]
        for i in range(1, l - K * 2 + 1):
            if i % 2 == 1:
                j = i + K * 2 - 1
                val = B[j] - B[i - 1]
            else:
                j = i + K * 2
                val = B[j] - B[i - 1]
            #print("[{}, {}]->val={}".format(i, j, val))
            ans = max(ans, val)
    print(ans)
       


if __name__ == "__main__":
    main()
L, R = map(int,input().split())

mod = 2019
for i in range(500):
  if L <= 3**i%(1e9+7) <= R or L <= 673**i%(1e9+7) <= R or L <= 3*673*i%(1e9+7) <= R or L <= 3*i%(1e9+7) <= R or L <= 673*i%(1e9+7) <= R or L <= 3*673**i%(1e9+7) <= R:
    print(0)
    exit()
else:
  print(min((L*(L+1))%mod, R*(R-1)%mod, R*L%mod))

### FIXED CODE ###

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

R = min(R, L+673)
ans = 2018
for i in range(L, R+1):
  for j in range(i+1, R+1):
    ans = min(ans, i*j%2019)
print(ans)
level,eat = map(int, input().split())
burger = 'BPPPB'
for i in range(1, level):
  burger = 'B' + burger + 'P' + burger + 'B'
count=0
eat -=1
for i in range(len(burger)):
  if i > eat:
    break
  if burger[i] == 'P':
    count+=1
print(count)

### FIXED CODE ###

def f(N, X):
  if N == 0:
    if X >= 1:
      return 1
    return 0
  elif X <= 1 + a[N-1]:
    return f(N-1, X-1)
  else:
    return p[N-1] + 1 + f(N-1, X-a[N-1] - 2)

N, X = map(int, input().split(" "))
a = [1]
p = [1]
for i in range(N):
  a.append(a[i]*2+3)
  p.append(p[i]*2+1)

print(f(N,X))
n, m =map(int,input().split())
l = [{int(x) for x in input().split()}]
ans = 0
for _ in range(m-1):
    a = {int(x) for x in input().split()}
    for j, s in enumerate(l):
        if s & a:
            l[j] |= a
            ans = max(ans, len(l[j]))
            if ans >= n:
                print(ans)
                exit()
            break
    else:
        l.append(a)
print(ans)


### FIXED CODE ###

class UnionFind:
    #par[x]でxの親のID，xが根ならその木のサイズに―をつけたもの
    def __init__(self, n):
        #全て根として初期化
        self.par = [-1] * n
    
    #xの根を返す
    def root(self, x):
        #xが根なら終了
        if self.par[x] < 0:
            return x
        #そうでないならxの親について調べる
        self.par[x] = self.root(self.par[x])    #xの根が親になるように更新
        return self.par[x]

    #xとyを結合
    def union(self, x, y):
        x = self.root(x)
        y = self.root(y)
        #xとyが同じ根を持つ(＝同じ木に属する)なら終了
        if x == y:
            return
        #サイズの大きい木に小さい木を結合
        if self.par[x] > self.par[y]:   #xが大きくなるよう交換
            x, y = y, x
        self.par[x] += self.par[y]
        self.par[y] = x
    
    #xのサイズを返す
    def size(self, x):
        return -1 * self.par[self.root(x)]


#main
n, m = map(int, input().split())
uf = UnionFind(n)
#Union-FInd木を作る
for _ in range(m):
    a, b = map(int, input().split())
    uf.union(a-1, b-1)      #1からではなく0からに
#サイズが最大のものを探す
ans = 0
for i in range(n):
    ans = max(ans, uf.size(i))
print(ans)
A = input()
B = input()
C = input()
X = A + B + C
if X == "557" or X == "575" or X == "755":
    print("YES")
else: print("NO")

### FIXED CODE ###

X = input()
X = str(X)
if X == "5 5 7" or X == "5 7 5" or X == "7 5 5":
    print("YES")
else: print("NO")
N = int(input())
A = list(map(int, input().split()))
if N > 1:
    for i in range(N-1):
        if A[i]>A[i+1]:
            A[i] -= 1
            
    for i in range(N-1):
        if A[i] > A[i+1]:
            print("No")
            break
    else:
        print("Yes")
else:
    print("Yes")

### FIXED CODE ###

a, b,c = map(int, input().split())
d = c-(a-b)
if d<0:
    d = 0
print(d)
n = int(input())
a = list(map(int,input().split()))
t = []
for i in range(10):
    t.append([])
for i in range(n):
    j = a[i]//10#24
    t[j].append(a[i])
#print(t)
p = n
for i in range(len(t[0])):
    for j in range(len(t[0])):
        if(i != j):
            if(t[0][i] % t[0][j] == 0):
                p -= 1
                #print(t[0][i],t[0][j])
                break
for i in range(1,10):
    for j in range(len(t[i])):
        x = 0
        for k in range(len(t[i])):
            if(j != k):
                if(t[i][j] ==  t[i][k]):
                    p -= 1
                    #print(t[i][j],t[i][k],-1)
                    x = 1
                    break
        if(x == 0):
            for k in range((i+2)//2):
                for l in range(len(t[k])):
                    if(t[i][j] % t[k][l] == 0):
                        p -= 1
                        #print(t[i][j],t[k][l])
                        x = 1
                        break
                if(x == 1):
                    break

print(p)

### FIXED CODE ###

n = int(input())
a = list(map(int,input().split()))
m = max(a)
t = [1]*(m+1)
for i in range(n):
    if(t[a[i]] == 1):
        x = a[i]*2
        while(x <= m):
            t[x] = 0
            x += a[i]
for i in range(n):
    if(t[a[i]] == 0):
        n -= 1
    elif(t[a[i]] == 1):
        t[a[i]] = -1
    elif(t[a[i]] == -1):
        t[a[i]] = -2
        n -= 2
    else:
        n -= 1
print(n)
#sys.setrecursionlimit(20000)

class UnionFind:
    def __init__(self,N):
        self.par = [i for i in range(N)]
 
    def root(self,x):
        if self.par[x] == x:
            return x
        self.par[x] = self.root(self.par[x])
        return self.par[x]
 
    def unite(self,x,y):
        self.rx = self.root(x)
        self.ry = self.root(y)
        if self.rx == self.ry:
            return
        self.par[self.rx] = self.ry
 
    def same(self,x,y):
        self.rx = self.root(x)
        self.ry = self.root(y)
        return self.rx == self.ry
 
N,M = [int(i) for i in input().split()]
uf = UnionFind(N)
 
for _ in range(M):
    x,y,_ = [int(i)-1 for i in input().split()]
    uf.unite(x,y)
 
ans = set()
for i in range(N):
    ans.add(uf.root(i))
 
print(len(ans))


### FIXED CODE ###

import sys
sys.setrecursionlimit(200000)

class UnionFind:
    def __init__(self,N):
        self.par = [i for i in range(N)]
 
    def root(self,x):
        if self.par[x] == x:
            return x
        self.par[x] = self.root(self.par[x])
        return self.par[x]
 
    def unite(self,x,y):
        self.rx = self.root(x)
        self.ry = self.root(y)
        if self.rx == self.ry:
            return
        self.par[self.rx] = self.ry
 
    def same(self,x,y):
        self.rx = self.root(x)
        self.ry = self.root(y)
        return self.rx == self.ry
 
N,M = [int(i) for i in input().split()]
uf = UnionFind(N)
 
for _ in range(M):
    x,y,_ = [int(i)-1 for i in input().split()]
    uf.unite(x,y)
 
ans = set()
for i in range(N):
    ans.add(uf.root(i))
 
print(len(ans))
import sys
import math

def main():
    a, b, k = [int(x) for x in sys.stdin.readline().split()]
    query_range = list(range(a, b + 1))
    if k >= math.ceil((b - a + 1) / 2):
        res = query_range
    #else:
        #res = query_range[:k] + query_range[-k:]
    
    for i in res:
        print(i)
    
if __name__ == "__main__":
    main()


### FIXED CODE ###

import sys

a, b, k = map(int, sys.stdin.readline().split())

def main():
    if k >= b - a + 1:
        res = list(range(a, b+1))
    else:
        res = set(range(a, a+k)) | set(range(b, b-k, -1))
        res = sorted(res)
    return res

if __name__ == '__main__':
    ans = main()
    print(*ans, sep='\n')
def is_reachable(edges,start,end):
  g = {}
  for f,t,w in edges:
    if f in g: g[f].append(t)
    else: g[f] = [t]
  visiting = [start]
  visited = []
  while visiting:
    v = visiting.pop()
    if v in visited: continue
    if v == end: return True
    visited[v] = True
    for v2 in g.get(v, ()):
      if v2 in visited or v2 in visiting: continue
      visiting.append(v2)
  return False

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

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

neg_inf = float("-Inf")
no_answer = False

start = 1
end = N

distance = {}
for i in range(1,N+1):
  distance[i] = neg_inf
distance[start] = 0
previous = {}

for i in range(N-1):
    for f,t,w in edges:
        if distance[f] + w - P > distance[t]:
            distance[t] = distance[f] + w - P
            previous[t] = f

path = []
node = end
while node != start:
    path.append(node)
    node = previous[node]
path.append(start)

for f,t,w in edges:
    if distance[f] + w - P > distance[t] and is_reachable(edges,t,end):
        no_answer = True
        break

if no_answer:
    print(-1)
else:
    print(max(0,distance[end]))


### FIXED CODE ###

def is_reachable(edges,start,end):
  g = {}
  for f,t,w in edges:
    if f in g: g[f].append(t)
    else: g[f] = [t]
  visiting = [start]
  visited = {}
  while visiting:
    v = visiting.pop()
    if v in visited: continue
    if v == end: return True
    visited[v] = True
    for v2 in g.get(v, ()):
      if v2 in visited or v2 in visiting: continue
      visiting.append(v2)
  return False

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

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

neg_inf = float("-Inf")
no_answer = False

start = 1
end = N

distance = {}
for i in range(1,N+1):
  distance[i] = neg_inf
distance[start] = 0

for i in range(N-1):
    for f,t,w in edges:
        if distance[f] + w - P > distance[t]:
            distance[t] = distance[f] + w - P

for f,t,w in edges:
    if distance[f] + w - P > distance[t] and is_reachable(edges,t,end):
        no_answer = True
        break

if no_answer:
    print(-1)
else:
    print(max(0,distance[end]))
h,w=map(int,input().split())
list2=[[0 for i in range(w)]for j in range(h)]
list1 =  [for _ in range(h) input().split()[]
dx=[-1,-1,-1,0,0,1,1,1]
dy=[-1,0,1,-1,1,-1,0,1]
for j in range(h):
  for i in range(w):
   if list1[j][i]=="#":
    for k in range(8):
     xk=i+dx[k]
     yk=j+dy[k]
     if xk>=0 and xk<w and yk>=0 and yk<h:
      list2[yk][xk]+=1
for j in range(h):
  for i in range(w):
    if list1[j][i]=="#":
      list2[j][i]="#"
    else:
      list2[j][i]=str(list2[j][i])
for j in range(h):
 print("".join(list2[j]))

### FIXED CODE ###

h,w=map(int,input().split())
list1=[[0 for i in range(w)]for j in range(h)]
list2=[[0 for i in range(w)]for j in range(h)]
dx=[-1,-1,-1,0,0,1,1,1]
dy=[-1,0,1,-1,1,-1,0,1]
for j in range(h):
 s=input()
 for i in range(w):
  list1[j][i]=s[i]
for j in range(h):
  for i in range(w):
   if list1[j][i]=="#":
    for k in range(8):
     xk=i+dx[k]
     yk=j+dy[k]
     if xk>=0 and xk<w and yk>=0 and yk<h:
      list2[yk][xk]+=1
for j in range(h):
  for i in range(w):
    if list1[j][i]=="#":
      list2[j][i]="#"
    else:
      list2[j][i]=str(list2[j][i])
for j in range(h):
 print("".join(list2[j]))
a,b,c = list(map(int, input().split()))
if a==b==c:
  print(1)
elif a==b or b==C or a==c:
  print(2)
else:
  print(3)

### FIXED CODE ###

x,y,z = map(int,input().split())
if x == y and y==z:
  print(1)
elif x == y or y == z or z ==x :
  print(2)
else:
  print(3)
A = input()
B = input()
C = input()

temp = C - (A - B)
if temp < 0:
  temp = 0
  
print(temp)

### FIXED CODE ###

num = [int(i) for i in input().split()]

A = num[0]
B = num[1]
C = num[2]
 
temp = C - (A - B)
if temp < 0:
  temp = 0
  
print(temp)
def isRTri(a, b, c):
    if a * a + b * b == c * c: return 1
    else return 0

a = [0, 0, 0]
n = input()
for k in range(n):
    a = map(int, raw_input().split())
    r = isRTri(a[0], a[1], a[2])
    if r: print "YES"
    else: print "NO"

### FIXED CODE ###

def isRTri(a, b, c):
    return a * a + b * b == c * c

a = [0, 0, 0]
n = input()
for k in range(n):
    a = map(int, raw_input().split())
    a.sort()
    r = isRTri(a[0], a[1], a[2])
    print "YES" if r else "NO"
a,b,c=map(int,input.split())
print(a+b if a+B<=c else c)

### FIXED CODE ###

a,b,c=map(int,input().split())
print(a*b if a*b<=c else c)
import sys

n = int(input())
r0 = int(input())
r1 = int(input())
max = r1 - r0
min = min(r1, r0)

for i in map(int, sys.stdin.readlines(())):
    if max < i - min:
        max = i - min
        if 0 > i - min:
            min = i
    elif min > i:
        min = 1

### FIXED CODE ###

import sys

n = int(input())
mx = -2000000000
mn = int(input())

for i in map(int, sys.stdin.readlines()):
    mx = max(mx, i - mn)
    mn = min(mn, i)

print(mx)
n=input()
print("No" if int(n)%sum(map(int,input())) else "Yes")

### FIXED CODE ###

n=int(input())
sum=0
cnt=n

while cnt>0:
  sum+=cnt%10
  cnt//=10
  
if n%sum==0:
  print("Yes")
else:
  print("No")
import sys
from collections import Counter

sys.stdin = open('a1.in')


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


def read_str_list():
    return input().split()


def read_int():
    return int(input())


def read_str():
    return input()


def main():
    n = read_int_list()
    c = Counter(n)
    for i in c:
        if c[i] == 1:
            print(i)


main()


### FIXED CODE ###

import sys
from collections import Counter

# sys.stdin = open('a1.in')


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


def read_str_list():
    return input().split()


def read_int():
    return int(input())


def read_str():
    return input()


def main():
    n = read_int_list()
    c = Counter(n)
    for i in c:
        if c[i] == 1:
            print(i)


main()
n = int(input())
X = input()

cnt_1 = 0
for x in X:
    if x == "1":
        cnt_1 += 1

plus = [0]*n
minus = [0]*n
plus[0] = 1%(cnt_1+1)
minus[0] = 1%(cnt_1-1)
for i in range(1,n):
    plus[i] = (plus[i-1]*2)%(cnt_1+1)
    minus[i] = (minus[i]*2)%(cnt_1-1)

cnt = [0]*(200001)

for i in range(1,200001):
    pc = bin(i).count('1')
    cnt[i] = cnt[i%pc] + 1

ans = []
for i,x in enumerate(X[::-1]):
    if x == "0":
        res = plus[n-1] + plus[i]
        ans.append(cnt[res]+1)
    else:
        res = minus[n-1] + minus[i]
        ans.append(cnt[res]+1)

print(*ans[::-1],sep="\n")

### FIXED CODE ###

n = int(input())
X = input()

cnt = [0]*(200001)
for i in range(1,200001):
    pc = bin(i).count('1')
    cnt[i] = cnt[i%pc] + 1
    
plus = X.count("1")+1
minus = X.count("1")-1

defp = int(X, 2)%plus
if minus:
    defm = int(X, 2)%minus
else:
    defm = None

pl = 1
mi = 1
ans = []
for i, x in enumerate(X[::-1]):
    if x == "0":
        ans.append(cnt[(defp+pl)%plus]+1)
    else:
        if minus:
            ans.append(cnt[(defm-mi)%minus]+1)
        else:
            ans.append(0)
    pl = 2*pl%plus
    if minus:
        mi = 2*mi%minus

print(*ans[::-1], sep="\n")
a, b = map(int, input().split())
if a == b :
	print('H')
else : 
	print('D')

### FIXED CODE ###

a, b = map(str, input().split())
if a == b :
	print('H')
else : 
	print('D')
if __name__ == '__main__':
    s = input()
    d = {}
    unbalanced = False
    unbalanced_char = ''
    for c in s:
        if c in d:
            d[c] += 1
            unbalanced = (d[c] >= int(len(s) / 2))
            if unbalanced:
                unbalanced_char = c
                break
        else:
            d[c] = 1

    if unbalanced:
        count = 0
        start = s.find(unbalanced_char)
        end = start
        for i in range(start, len(s)):
            if s[i] == unbalanced_char:
                end = i
                count += 1
            if count >= int(len(s) / 2):
                break
        print(f"{start + 1} {end + 1}")
    else:
        print("-1 -1")


### FIXED CODE ###

if __name__ == '__main__':
    s = input()
    for i in range(len(s) - 1):
        if s[i] == s[i + 1]:
            print("{} {}".format(i + 1, i + 2))
            exit(0)
    for i in range(len(s) - 2):
        if s[i] == s[i + 2]:
            print("{} {}".format(i + 1, i + 3))
            exit(0)
    print("-1 -1")
A,B,C,X,Y = map(int,input().split())

D = (A + B) // 2
C2 = C * 2

ans = 0

if C2 <= min(A,B):
  ans += C2 * max(X,Y)
  print(ans)
elif C2 > max(A,B):
  ans += (A * X) + (B * Y)
  print(ans)
else:
  if D >= C:
    if X > Y:
    ans += C2 * Y
    ans += A * (X - Y)
    print(ans)
  else:
    ans += (A * X) + (B * Y)
    print(ans)

### FIXED CODE ###

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

C2 = C * 2
diff = abs(X - Y)

ans = 0


if C2 > A + B:
  ans = (A * X) + (B * Y)

elif C2 <= A + B:
  if X > Y:
    ans = min(C2 * Y + A * diff,C2 * X)

  else:
    ans = min(C2 * X + B * diff,C2 * Y)
    
print(ans)
print( x**3)

### FIXED CODE ###

x = int( input())
print( x ** 3)
#???????????\?????¨??????????????????????????°???
a = [1, 2, 4]
MAX_N = 30
for i in xrange(3, MAX_N+1):
    a.append(a[i-3] + a[i-2] + a[i-1])

while True:
    n = input()
    if n == 0:
        break
    else:
        print a[n-1] / 3650 + 1

### FIXED CODE ###

a = [1, 2, 4]
MAX_N = 30
for i in xrange(3, MAX_N+1):
    a.append(a[i-3] + a[i-2] + a[i-1])

while True:
    n = input()
    if n == 0:
        break
    else:
        print a[n-1] / 3650 + 1
n = int(input())
a = list(map(int, input().split()))
b = 1000
for i in range(n - 1):
    dp = [0] * 100000
    dp[0] = 0
    c = b
    for j in range(b + 1):
        dp[j + a[i]] = max(dp[j + a[i]], dp[j] + a[i + 1])
    for j in range(b + 1):
        c = max(c, dp[j] + b - j)
    b = c
print(b)

### FIXED CODE ###

n = int(input())
a = list(map(int, input().split()))
v = 1000
s = 0
for i in range(n - 1):
    if a[i] < a[i + 1]:
        s = v // a[i]
        v += (a[i + 1] - a[i]) * s
print(v)
import sys
# 整数の入力
N,M=list(map(int, input().split()))
p=[]
q=0
count=0
for i in range(0,M):
  p.append(list(map(int, input().split())))
for i in range(0,M):
  q+=p[i][0]-p[i][1]
if q%2==1:
  print("NO")
else:
  for j in range(0,M,M/100):
    for i in range(0,M):
      if p[i][0]==j or p[i][1]==j:
        count+=1
    if count%2==1:
      print("NO")
      sys.exit()
  else: 
    print("YES")

### FIXED CODE ###

import sys
# 整数の入力
N,M=list(map(int, input().split()))
p=[]
for i in range(0,N):
  p.append(0)
for i in range(0,M):
  count=list(map(int, input().split()))
  p[count[0]-1]+=1
  p[count[1]-1]+=1
for i in range(0,M):
  if p[i]%2==1:
    print("NO")
    sys.exit()
print("YES")
n,m,k = list(map(int,input().split()))
a = list(map(int,input().split()))
b = list(map(int,input().split()))

from collections import deque
a = deque([x for x in a])
b = deque([x for x in b])
a.append(10**9+1)
b.append(10**9+1)
ans = 0
def cnt(a,b,time):
  global ans
  print(ans, time,a,b)
  if (time <= k) & ( (len(a) > 1) | (len(b) > 1)):
    if a[0] < b[0]:
      time += a[0]
      a.popleft()
    else:
      time += b[0]
      b.popleft()
    if time <= k:
      ans += 1
      cnt(a,b,time)

cnt(a,b,0)

### FIXED CODE ###

n, m, k = map(int, input().split())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
sa = [0] * (n + 1)
sb = [0] * (m + 1)
for i in range(n):
  sa[i + 1] = sa[i] + a[i]
for i in range(m):
  sb[i + 1] = sb[i] + b[i]
r = m
ans = 0
for i in range(n + 1):
  if sa[i] > k:
    break
  while sa[i] + sb[r] > k:
    r -= 1
  ans = max(ans, i + r)
print(ans)
N,K=map(int,input().split())
price=list(map(int,input().split()))
price.sort(reverse=True)
price_N=price[:K]
j=0
for i in price_K:
	j+=i
print(j)

### FIXED CODE ###

N,K=map(int,input().split())
price=list(map(int,input().split()))
price.sort()
price_K=price[:K]
j=0
for i in price_K:
  j+=i
print(j)
import math

N, D = list(map(int, input().split(' ').rstrip()))

cnt = 0
def check(p, q):
  r = p**2 + q**2
  return math.sqrt(r)

for i in range(N):
  p, q = list(map(int, input().split(' ').rstrip()))
  if check(p, q) <= D:
    cnt += 1

print(cnt)


### FIXED CODE ###

import math
 
N, D = list(map(int, input().split(' ')))
 
cnt = 0
def check(p, q):
  r = p**2 + q**2
  return math.sqrt(r)
 
for i in range(N):
  p, q = list(map(int, input().split(' ')))
  if check(p, q) <= D:
    cnt += 1
 
print(cnt)
import sys
a ,b= map(int,input().split())
aaa = [list(map(int,input().split())) for i in range(b*2)]
 
s = {i for i in range(1,a+1)}

if a == 0:
    print(0)
    sys.exit

if b == 0:
    [print(i) for i in aaa]
    sys.exit
    

for i in range(1,a+1,2):
    for k in aaa[i]:
        s.discard(k)
 
print(len(s))

### FIXED CODE ###

a,b = map(int,input().split())
aaa = [list(map(int,input().split())) for i in range(b*2)]

c = set()
e = set()
for i in range(1,len(aaa),2):
  for k in aaa[i]:
     c.add(k)
    
print(a - len(c))
n = int(input())
a = list(map(int,input().split()))
cnt = 0
l3 = abs(a[-3])
l2 = abs(a[-2])
l1 = abs(a[-1])
last = l3 + l2 + l1
if n == 2 and sum(a) >= 0:
    print(abs(sum(a)))
elif n == 2:
    print(max(abs(a[0]),abs(a[1])))
else:
    for i in range(n-3):
        if a[i] < 0:
            a[i] *= -1
            a[i+1] *= -1
        cnt += a[i]
    # +,+,+ or +,-,- or -,-,+ or -,+,-
    #print(cnt,a[-3],a[-2],a[-1])
    if (a[-3] >= 0 and a[-2] >= 0 and a[-1] >= 0) or (a[-3] >= 0 and a[-2] <= 0 and a[-1] <= 0) or (a[-3] <= 0 and a[-2] <= 0 and a[-1] >= 0) or (a[-3] <= 0 and a[-2] >= 0 and a[-1] <= 0):
        print(cnt+last)
    elif (a[-3] <= 0 and a[-2] >= 0 and a[-1] >= 0): # -,+,+
        print(cnt + last - 2*min(l1,l2,l3))
    else:
        print(cnt + last - 2*min(l1,l2))

### FIXED CODE ###

n = int(input())
a = list(map(int,input().split()))
num = 0
mi = 10**9
for i in range(n):
    num += abs(a[i])
    if abs(mi) >= abs(a[i]):
        mi = a[i]
cnt = 0
for i in range(n):
    if a[i] < 0:
        cnt += 1
if cnt%2 == 1:
    print(num-2*abs(mi))
else:
    print(num)
import numpy as np
from collections import deque

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

maze = []
for h in range(H):
  s = input()
  maze.append(s)

def BFS(i,j):
  place = np.zeros((H,W))
  dist = 0
  queue = deque()
  queue.append((i,j,0))
  while queue:
    i,j,d = queue.popleft()
    if not place[i][j]:
      dist = max(dist,d)
      place[i][j] = 1
      for di,dj in [(1,0),(-1,0),(0,1),(0,-1)]:
        if (0 =< i+di and i+di < H and 0 =< j+dj and j+dj < W):
          if maze[i+di][j+dj] == '.' and place[i+di][j+dj] == 0:
            queue.append((i+di,j+dj,d+1))
  return dist

ans = 0
for h in range(H):
  for w in range(W):
    if maze[h][w] == '.':
      ans = max(ans,BFS(h,w))

print(ans)




### FIXED CODE ###

import numpy as np
from collections import deque

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

maze = []
for h in range(H):
  s = input()
  maze.append(s)

def BFS(i,j):
  place = np.zeros((H,W))
  dist = 0
  queue = deque()
  queue.append((i,j,0))
  while queue:
    i,j,d = queue.popleft()
    if not place[i][j]:
      dist = max(dist,d)
      place[i][j] = 1
      for di,dj in [(1,0),(-1,0),(0,1),(0,-1)]:
        if (0 <= i+di and i+di < H and 0 <= j+dj and j+dj < W):
          if maze[i+di][j+dj] == '.' and place[i+di][j+dj] == 0:
            queue.append((i+di,j+dj,d+1))
  return dist

ans = 0
for h in range(H):
  for w in range(W):
    if maze[h][w] == '.':
      ans = max(ans,BFS(h,w))

print(ans)