Harryxun/stf_run huggingface dataset:
import numpy as np


def yoko(row):
    cnt = sum(row)
    return cnt == len(row)


def main():
    h, w = map(int, input().split(' '))
    a = []

    for i in range(h):
        b = input()
        a += [1 if c == '.' else 0 for c in b]
    a = np.array(a).reshape(h, w)

    while True:
        cnt = 0
        del_list = []
        for i in range(len(a)):
            judge = yoko(a[i])
            if judge:
                del_list.append(i)

        if len(del_list):
            for idx in del_list:
                a = np.delete(a, idx, axis=0)
        else:
            cnt += 1

        a = a.T

        del_list = []
        for i in range(len(a)):
            judge = yoko(a[i])
            if judge:
                del_list.append(i)

        if len(del_list):
            for idx in del_list:
                a = np.delete(a, idx, axis=0)
        else:
            cnt += 1

        a = a.T

        if cnt >= 2:
            break

    for i in range(len(a)):
        r = ''
        for j in a[i]:
            if j == 1:
                r += '.'
            else:
                r += '#'
        print(r)


main()


### FIXED CODE ###

import numpy as np


def yoko(row):
    cnt = sum(row)
    return cnt == len(row)


def main():
    h, w = map(int, input().split(' '))
    a = []

    for i in range(h):
        b = input()
        a += [1 if c == '.' else 0 for c in b]
    a = np.array(a).reshape(h, w)

    while True:
        cnt = 0
        del_list = []
        for i in range(len(a)):
            judge = yoko(a[i])
            if judge:
                del_list.append(i)

        if len(del_list):
            del_cnt = 0
            for idx in del_list:
                a = np.delete(a, idx - del_cnt, axis=0)
                del_cnt += 1
        else:
            cnt += 1

        a = a.T

        del_list = []
        for i in range(len(a)):
            judge = yoko(a[i])
            if judge:
                del_list.append(i)

        if len(del_list):
            del_cnt = 0
            for idx in del_list:
                a = np.delete(a, idx - del_cnt, axis=0)
                del_cnt += 1
        else:
            cnt += 1

        a = a.T

        if cnt >= 2:
            break

    for i in range(len(a)):
        r = ''
        for j in a[i]:
            if j == 1:
                r += '.'
            else:
                r += '#'
        print(r)


main()
# @author 

import sys

class DAnythingGoesToZero:
    def solve(self, tc=0):
        n = int(input())
        # n = 10 ** 5
        x = input().strip()
        cache = [-1] * (n + 1)
        cache[0] = 0
        for nb in range(n + 1):
            v = 0
            i = nb
            while cache[i] == -1:
                i %= bin(i).count('1')
                v += 1

            cache[nb] = v + cache[i]

        # print(cache[8191])

        def brem(N, D):
            n = len(N)
            R = 0
            for i in range(n - 1, -1, -1):
                R <<= 1
                R |= int(N[n - 1 - i])
                if R >= D:
                    R -= D
            return R

        x = list(x)
        ones = x.count('1')
        r1 = brem(x, ones + 1)
        r2 = brem(x, ones - 1) if ones != 0 else 0
        for i in range(n):
            if x[i] == '0':
                # print((r + pow(2, n - 1 - i, ones + 1)) % (ones + 1), '*')
                print(cache[(r1 + pow(2, n - 1 - i, ones + 1)) % (ones + 1)] + 1)
            else:
                print(cache[(r2 - pow(2, n - 1 - i, ones - 1)) % (ones - 1)] + 1)
            # x[i] = str(int(x[i]) ^ 1)
            # print(cache[brem(x, x.count('1'))] + 1)
            # x[i] = str(int(x[i]) ^ 1)

solver = DAnythingGoesToZero()
input = sys.stdin.readline

solver.solve()


### FIXED CODE ###

# @author 

import sys

class DAnythingGoesToZero:
    def solve(self, tc=0):
        n = int(input())
        # n = 10 ** 5
        x = input().strip()
        cache = [-1] * (n + 1)
        cache[0] = 0
        for nb in range(n + 1):
            v = 0
            i = nb
            while cache[i] == -1:
                i %= bin(i).count('1')
                v += 1

            cache[nb] = v + cache[i]

        # print(cache[8191])

        def brem(N, D):
            n = len(N)
            R = 0
            for i in range(n - 1, -1, -1):
                R <<= 1
                R |= int(N[n - 1 - i])
                if R >= D:
                    R -= D
            return R

        x = list(x)
        ones = x.count('1')
        r1 = brem(x, ones + 1)
        r2 = brem(x, ones - 1) if ones > 1 else 0
        for i in range(n):
            if x[i] == '0':
                # print((r + pow(2, n - 1 - i, ones + 1)) % (ones + 1), '*')
                print(cache[(r1 + pow(2, n - 1 - i, ones + 1)) % (ones + 1)] + 1)
            else:
                if ones == 1:
                    print(0)
                    continue
                print(cache[(r2 - pow(2, n - 1 - i, ones - 1)) % (ones - 1)] + 1)
            # x[i] = str(int(x[i]) ^ 1)
            # print(cache[brem(x, x.count('1'))] + 1)
            # x[i] = str(int(x[i]) ^ 1)

solver = DAnythingGoesToZero()
input = sys.stdin.readline

solver.solve()
S = input()

AGCT = ['A','G','C','T']
AGCT_list = []

i = 0
while i < len(S):
    print('i=',i)
    if S[i] in AGCT:
        k = 1
        agct_tmp = S[i]
        while S[i+k] in AGCT:
            print('k=', k)
            print('i+k=',i+k)
            agct_tmp += S[i+k]
            if i+k+1 < len(S):
                k +=1
            else:
                break
    
        AGCT_list.append(agct_tmp)
        i = i + k + 1
    else:
        i += 1
if AGCT_list:
    print(max([len(string) for string in AGCT_list]))
else:
    print('0')
    

### FIXED CODE ###

S = input()

AGCT = ['A','G','C','T']
AGCT_list = []

i = 0
while i < len(S):
    #print('i=',i)
    if S[i] in AGCT:
        k = 1
        agct_tmp = S[i]
        if i+k < len(S):
            while S[i+k] in AGCT:
                #print('k=', k)
                #print('i+k=',i+k)
                agct_tmp += S[i+k]
                if i+k+1 < len(S):
                    k +=1
                else:
                    break
    
        AGCT_list.append(agct_tmp)
        i = i + k + 1
    else:
        i += 1
if AGCT_list:
    print(max([len(string) for string in AGCT_list]))
else:
    print('0')
import scipy.misc as scm

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

a = sorted(a, reverse=True)

comb = -1
a_i = a[0]
comb = 0
for i in range(1, n):
    c = scm.comb(a_i, a[i])
    if comb > c:
        comb = c
        a_j = a[i]
    else:
        break
print(a_i, a_j)


### FIXED CODE ###

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

a = sorted(a, reverse=True)

comb = -1
a_i = a[0]
if a_i % 2 == 0:
    mid = int(a_i/2)
    dif = 10**9
    for i in range(1, n):
        if dif > abs(a[i]-mid):
            dif = abs(a[i]-mid)
            a_j = a[i]
else:
    mid = int(a_i/2)
    dif = 10**9
    for i in range(1, n):
        if a[i] > mid:
            if dif > abs(a[i]-mid-1):
                dif = abs(a[i]-mid-1)
                a_j = a[i]
        else:
            if dif > abs(a[i]-mid):
                dif = abs(a[i]-mid)
                a_j = a[i]

print(a_i, a_j)
from math import gcd

A, B, C, D = [int(x) for x in input().split(" ")]

c = (B // C) - (A // C) + int(A % C == 0)
d = (B // D) - (A // D) + int(A % D == 0)
lcm_cd = (C * D) // gcd(C, D)
cd = (B // (lcm_cd)) - (A // (lcm_cd)) + int(A % (lcm_cd) == 0)

c_or_d = c + d - cd

print((B - A + 1) - c_or_d)


### FIXED CODE ###

from fractions import gcd

A, B, C, D = [int(x) for x in input().split(" ")]

c = (B // C) - (A // C) + int(A % C == 0)
d = (B // D) - (A // D) + int(A % D == 0)
lcm_cd = (C * D) // gcd(C, D)
cd = (B // (lcm_cd)) - (A // (lcm_cd)) + int(A % (lcm_cd) == 0)

c_or_d = c + d - cd

print((B - A + 1) - c_or_d)
import sys, os

f = lambda:list(map(int,input().split()))
if 'local' in os.environ :
    sys.stdin = open('./input.txt', 'r')

def solve():
    a, op, b = input().split()
    a = int(a)
    b = int(b)
    if op == '+':
        print(a+b)
    elif op == '-':
        print(a-b)

solve()

### FIXED CODE ###

import sys, os

f = lambda:list(map(int,input().split()))
if 'local' in os.environ :
    sys.stdin = open('./input.txt', 'r')

def solve():
    a, op, b = input().split()
    a = int(a)
    b = int(b)
    if op == '+':
        print(a+b)
    elif op == '-':
        print(a-b)

solve()
# AOJ GRL_1_A
# http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=GRL_1_A

INF = 100000000

def solve(v, dic):
    dp = []
    for i in range(0, v):
        dp += [[INF] * v ]
        for t, d in dic[i]:
            dp[i][t] = d
        dp[i][i] = 0
    for k in range(0, v):
        for i in range(0, v):
            for j in range(0, v):
                if dp[i][j] > dp[i][k] + dp[k][j]:
                    dp[i][j] = dp[i][k] + dp[k][j]
    return dp

dic = {}
dp = []
line = input()
v, e, r = list(map(int, list(line.split())))
for _ in range(0, e):
    line = input()
    s, t, d = list(map(int, list(line.split())))
    if s not in dic:
        dic[s] = [[t, d]]
    else:
        dic[s] += [[t, d]]
dp = solve(v, dic)
for i in range(0, v):
    print(dp[r][i] if dp[r][i] != INF else "INF")


### FIXED CODE ###

# AOJ GRL_1_A
# http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=GRL_1_A

from heapq import heappush, heappop

INF = 10000000000

def solve(r, v, dic):
    dp = []
    q = []
    dp = [INF] * v
    dp[r] = 0
    heappush(q, (0, r))
    while q:
        cost, vtx = heappop(q)
        if dp[vtx] < cost:
            continue
        if vtx not in dic:
            continue
        for vtx1, cost1 in dic[vtx]:
            if cost + cost1 < dp[vtx1]:
                dp[vtx1] = cost + cost1
                heappush(q, (cost + cost1, vtx1))
    return dp

dic = {}
dp = []
line = input()
v, e, r = list(map(int, line.split()))
for _ in range(0, e):
    line = input()
    s, t, d = list(map(int, line.split()))
    if s not in dic:
        dic[s] = [[t, d]]
    else:
        dic[s] += [[t, d]]
dp = solve(r, v, dic)
for t in range(0, v):
    print(dp[t] if dp[t] != INF else "INF")
a = input().split

sum = 0

sum += 1 * a[0]
a[3] -= a[0]
a[3] -= a[1]

if a[2] < a[3]:
    sum -= 1 * a[0]

print(sum)

### FIXED CODE ###

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

sum = 0

if a[0] >= a[3]:
    sum += 1 * a[3]
else:
    sum += 1 * a[0]

a[3] -= a[0]
a[3] -= a[1]

if a[3] > 0:
    if a[2] > a[3]:
        sum += -1 * a[3]
    else:
        sum += -1 * a[2]

print(sum)
x, n = map(int, input().split())
p = list(map(int, input().split()))
i, ans = 0, 0
for i in range(max(p)+2):
    if x+i not in p:
        if x-i not in p:
            ans=x-i
            break
        ans=x+i
        break
    if x-i not in p:
        ans=x-i
        break
print(ans)

### FIXED CODE ###

x, n = map(int, input().split())
p = list(map(int, input().split()))
i, ans = 0, 0
a = 1
while a:
    if x not in p: print(x); break
    for i in range(max(p)+2):
        if x+i not in p:
            if x-i not in p:
                ans=x-i
                break
            ans=x+i
            break
        if x-i not in p:
            ans=x-i
            break
    print(ans)
    a = 0
A,B = map(int,input().split())
print(6-A-B)

### FIXED CODE ###

A = int(input())
B = int(input())
print(6 - A - B)
n = int(input())

s = {}
for i in range(n):
    temp = input()
    if temp in s:
        s[temp] += 1
    else:
        s[temp] = 1



max_s_val = max(s.value())
t = [k for k, v in s.items() if v == max_s_val]
t.sort()

for i in range(len(t)):
    print(t[i])



### FIXED CODE ###

n = int(input())

s = {}
for i in range(n):
    temp = input()
    if temp in s:
        s[temp] += 1
    else:
        s[temp] = 1



max_s_val = max(s.values())
t = [k for k, v in s.items() if v == max_s_val]
t.sort()

for i in range(len(t)):
    print(t[i])
a,b,c=map(int,input().split())
print(a+b+c-max(a,b.c))

### FIXED CODE ###

a,b,c=map(int,input().split())
print(a+b+c-max(a,b,c))
import sys
import os
f = open("C:/Users/user/Documents/python/atcoder/ABC118/import.txt","r")
sys.stdin = f

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

a,b = map(int,input().split())
if a % b == 0:
    print(a+b)
else:
    print(b-a)


### FIXED CODE ###

a,b = map(int,input().split())
if b % a== 0:
    print(a+b)
else:
    print(b-a)
a

### FIXED CODE ###

S = input()

zikkou= [0,2]

isto = True

for n in zikkou:
    if S.count("A") == 3 or S.count("B") == 3:
        isto = False


if isto:
    print("Yes")
else:
    print("No")
from fractions import gcd
n = int(input())
a = list(set(map(int,input().split())))
a.sort(reverse=True)
b = gcd(a[0], a[1])
c = [a[0], a[1]]
for i in range(2, len(a)):
    g1 = gcd(b, a[i])    
    d = []
    for j in c:
        g2 = gcd(j, a[i])
        if g2 > 1:
            d.append(g2)
    c = d
    if b > 1:
        c.append(b)
    b = g1

if c:
    print(max(c))
else:
    print(1)

### FIXED CODE ###

from fractions import gcd
from collections import Counter
n = int(input())
a = list(map(int,input().split()))
c = Counter(a)
oc = []
b = 0
for i, v in c.items():
    if v == 1:
        oc.append(i)
    else:
        if b == 0:
            b = i
        else:
            b = gcd(b, i)

loc = len(oc)
if loc <= 1:
    print(b)
    exit()

c = [oc[0], oc[1]]
e = gcd(oc[0], oc[1])
if loc == 2:
    c.append(e)
for i in range(2, loc):
    g1 = gcd(e, oc[i])
    d = []
    for cc in c:
        g2 = gcd(cc, oc[i])
        if g2 > 1:
            d.append(g2)
    c = d
    if e > 1:
        c.append(e)
    if i == loc-1:
        c.append(g1)
    e = g1

if b >= 2:
    print(max([gcd(cc, b) for cc in c]))
elif b == 0:
    print(max(c))
else:
    print(1)
n=int(input())
S=input()
a='abcdefghijklmnopqrstuvwxyz'
ans=1
for i in range(26):
  cnt=S.count(a[i])
  if cnt >0:
    ans=ans*(1.5**(cnt-1))*2
  ans=ans%(10^9+7)
ans-=1
print(ans)

### FIXED CODE ###

n=int(input())
S=input()
a='abcdefghijklmnopqrstuvwxyz'
ans=1
for i in range(26):
  cnt=S.count(a[i])
  ans=ans*(cnt+1)
ans-=1
ans=ans%(10**9+7)
print(int(ans))
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# FileName: 	B
# CreatedDate:  2020-04-19 21:11:23 +0900
# LastModified: 2020-04-19 21:14:03 +0900
#


import os
import sys
import numpy as np
import pandas as pd


def main():
    n,m=map(int,input().split())
    a = list(map(int,input().split()))
    if n-sum(a)<0:
        print(-1)
        return 

    print(n-sum(a))
    


if __name__ == "__main__":
    main()


### FIXED CODE ###

#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# FileName: 	B
# CreatedDate:  2020-04-19 21:11:23 +0900
# LastModified: 2020-04-19 21:15:31 +0900
#


import os
import sys

def main():
    n,m=map(int,input().split())
    a = list(map(int,input().split()))
    if n-sum(a)<0:
        print(-1)
        return 

    print(n-sum(a))
    


if __name__ == "__main__":
    main()
l = list(map(int, input().split()))

while(l != None):
    length =len(str(l[0]+l[1]))
    print(int(length))
    l = list(map(int, input().split()))


### FIXED CODE ###

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

while(l != []):
    try:
        length = len(str(l[0]+l[1]))
        print(length)
        l = list(map(int, input().split()))
    except:
        break
import sys
l = [int(i) for i in sys.stdin.readline().split()]
l.sort()
print(" ".join(l))

### FIXED CODE ###

import sys
l = [int(i) for i in sys.stdin.readline().split()]
l.sort()
print(" ".join(map(str, l)))
N = int(input())
ans = 0
for i in N:
  if len(list(i)) % 2 == 1:
    ans += 1
print(ans)

### FIXED CODE ###

N = int(input())
ans = 0
for i in range(1, N+1):
  if len(list(str(i))) % 2 == 1:
    ans += 1
print(ans)
S=input()
s=[S]

for i in range(1000):
  if s[i]%2==0:
    s.append(s[i]/2)
    if s[i+1] in s:
      print(i)
      break
  else:
    s.append(s[i]*3 + 1)
    if s[i+1] in s:
      print(i)
      break

### FIXED CODE ###

s = int(input())
a = []
while(s not in a):
    a.append(s)
    if s%2==0:
        s = s//2
    else:
        s = 3*s + 1
print(len(a)+1)
i = 1

while True:
    x=map(int,input())
    if x=False:
        break
    
    print("case ", i , ": ", x)




### FIXED CODE ###

# itp1_3_b

i = 1

while True:
    x=int(input())
    if x==False:
        break
    print("Case {}: {}".format(i,x))
    i+=1
N=int(input())
a_list=[]
a_list = list(map(int, input().split())) # "1 2 3"と入力
min_num=min(a_list)
nokori_list=[i%min_num for i in a_list if i%min_num!=0]
answer=0
if len(nokori_list)==0:
    print(min_num)
else:
    can_min=min(nokori_list)
    futuer_min=min_num%can_min
    while futuer_min>0:
        big=max(can_min,futuer_min)
        small=min(can_min,futuer_min)
        futuer_min=big%small
        if futuer_min==0:
            answer=small
            break
    answer=small
    print(answer)

### FIXED CODE ###

N=int(input())
a_list=[]
a_list = list(map(int, input().split())) # "1 2 3"と入力
min_num=min(a_list)
nokori_list=[i%min_num for i in a_list if i%min_num!=0]
if len(nokori_list)==0:
    print(min_num)
else:    
    while len(nokori_list)!=0:
        if len(nokori_list)==0:
            answer=min_num
            break
        else:
            nokori_list.append(min_num)
            min_num=min(nokori_list)
            new_list=[i%min_num for i in nokori_list if i%min_num!=0]
            nokori_list=new_list
        answer=min_num
    print(answer)
input = sys.stdin.readline

a, b = map(int, input().rstrip().split())
print(a + b // 2)

### FIXED CODE ###

x, y = map(int, input().split())
print(x + y // 2)
import numpy as np


def count(a):
    i = 0
    while a > 0:
        i += 1
        a -= i
        if a == 0:
            break
        if a < 0:
            i -= 1
            break
    return i


def main(N):
    num = N
    ans = 0
    A = np.zeros((1000000), np.int32)
    i = 2
    last = 0
    if N == 1:
        return 0
    while True:
        if num % i == 0:
            num = num//i
            A[i] += 1
        else:
            i += 1
            if num == 1:
                break
            if i*i > num:
                last = 1
                break
    for j in range(i):
        ans += count(A[j])
    ans += last
    return ans


N = int(input())
print(main(N))


### FIXED CODE ###

import numpy as np


def main(A, B):

    ans = A*B
    return ans


A, B = map(int, input().split())
print(main(A, B))
import math

from functools import reduce

def gcd(*numbers):
    return reduce(math.gcd, numbers)

input()

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

print(gcd(*li))


### FIXED CODE ###

from functools import reduce

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

def gcd(*numbers):
    return reduce(mgcd, numbers)

input()

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

print(gcd(*li))
n = int(input())
a = [int(input()) for i in range(n)]
print("{} {} {}".format(min(a),max(a),sum(a)))



### FIXED CODE ###

n = input()
table = list(map(int,input().split()))
print("{} {} {}".format(min(table),max(table),sum(table)))
N = int(input())
ans = 0
for i in range(1,N+1,2):
    cnt = 0
    for n in range(1,N+1,2):
        if n%i == 0:
            cnt += 1
    if cnt == 8:
        ans += 1
print(ans)

### FIXED CODE ###

h,w=map(int,input().split())
a=[list(input()) for i in range(h)]
for i in range(h):
    if '#' not in a[i]:
        a[i]=['n']*w
for i in range(w):
    l=[a[j][i] for j in range(len(a))]
    if '#' not in l:
        for k in range(len(a)):
           a[k][i]='n'
for i in a:
    l=[x for x in i if x!='n']
    if l:
        print(''.join(l))
c1 = list(map(int,input().split()))
A = np.array(c1)
c1 = list(map(int,input().split()))
B = np.array(c1)
c1 = list(map(int,input().split()))
C = np.array(c1)

D = A-B 
D1 = list(D)
D1 = set(D1)
if len(D1) == 1:
    continue 
else:
    print('No')
    exit()

E = B-C
E1 = list(E)
E1 = set(E1) 
if len(E1)== 1:
    print('Yes') 
else:
    print('No')

### FIXED CODE ###

import numpy as np
c1 = list(map(int,input().split()))
A = np.array(c1)
c1 = list(map(int,input().split()))
B = np.array(c1)
c1 = list(map(int,input().split()))
C = np.array(c1)

D = A-B 
D1 = list(D)
D1 = set(D1)
if len(D1) == 1:
    pass 
else:
    print('No')
    exit()

E = B-C
E1 = list(E)
E1 = set(E1) 
if len(E1)== 1:
    print('Yes') 
else:
    print('No')
import sys

n=1001
a=range(1,n)
a+=[n]+a[::-1]

for n in map(int,sys.stdin):
  x=0
  for i in range(max(0,n-2000),n+1):
    x+=a[i]*a[n-i]
  print x

### FIXED CODE ###

import sys
n=1001
a=range(1,n)
a+=[n]+a[::-1]
for n in map(int,sys.stdin):
  print sum([a[i]*a[n-i] for i in range(max(0,n-2000),min(n,2000)+1)])
a,b,c = map(int,input().split())
ar = []
if a + c > b:
    d = b+1
else:
    d = a+c
for i in range(a,d):
    ar.append(i)
if b - c < a:
    e = a
else:
    e = b-c+1
for i in range(e,b+1):
    ar.append(i)
br = set(ar)
cr = sorted(br)
for i in cr:
    print(i)


### FIXED CODE ###

ar = list(input())
if "a" in ar and "b" in ar and "c" in ar:
  print("Yes")
else:
  print("No")
n,k=map(int,input().split())
ans=[0]*(10**5+1)
for i in range(n):
    a,b=map(int,input().split())
    ans[a]+=b
    
for i in range(len(ba)):
    k-=ans[i]
    if k<=0:
        print(i)
        break

### FIXED CODE ###

n,k=map(int,input().split())
ans=[0]*(10**5+1)
for i in range(n):
    a,b=map(int,input().split())
    ans[a]+=b
    
v=0
for i in range(k):
    v+=ans[i]
    if ans[i]==0:
        i-=1
    if v>=k:
        a=i
        break
    
print(a)
while True:
    x,y = map(int, input().split())
    if x == 0 and y == 0:
    break
if x > y:
    print(y, x)
else:
    print(x, y)


### FIXED CODE ###

c = 1  
while True:
    x = int(input())
    if x == 0: 
       break
    print("Case {}: {}".format(c, x))
    c += 1
def cal(A, B):
    if A >= 13:
        return B
    elif 6 <= A and A <= 12:
        return B/2
    elif 0 <= A and A <= 5:
        return 0

if __name__ == "__main__":
    print(cal(int(input()), int(input())))

### FIXED CODE ###

def main():
    i = list(map(int, input().split()))
    a = i[0]
    b = i[1]

    #if isinstance(a, int) == False or isinstance(b, int) == False or a < 0 or 100 < a or b < 2 or 1000 < b or b % 2 != 0:
    #    return

    if 13 <= a and a <= 100:
        print(b)
    elif 6 <= a and a <= 12:
        print(b//2)
    elif 0 <= a and a <= 5:
        print(0)

if __name__ == "__main__":
    main()
import sys
from functools import lru_cache

INF = 10 ** 18
def LI(): return [int(x) for x in sys.stdin.readline().split()]
def II(): return int(sys.stdin.readline())

N = II()
A_li = LI()
N = len(A_li)

@lru_cache(maxsize=None)
def dp(i,j):
    if i == 0:
        if j == 0: return 0
        elif j == 1: return -INF
    else:
        if j == 0: return max(dp(i-1,0) + A_li[i-1], dp(i-1,1) - A_li[i-1])
        if j == 1: return max(dp(i-1,0) - A_li[i-1], dp(i-1,1) + A_li[i-1])

print(dp(N,0))

### FIXED CODE ###

import sys

def LI(): return [int(x) for x in sys.stdin.readline().split()]
def II(): return int(sys.stdin.readline())

N = II()
A_li = LI()

import numpy as np

A_abs = np.abs(A_li)
A_neg_count = sum([1 if i<0 else 0 for i in A_li])

if 0 in A_li or A_neg_count%2 == 0: print(sum(A_abs))
else: print(sum(A_abs) - 2 * min(A_abs))
print('ABC' if int(intput()) < 1000 else 'ABD')


### FIXED CODE ###

print('ABC' if int(input()) < 1000 else 'ABD')
X,K,D = map(int,input().split())
A = abs(X)
ans = 0
if A >= D*K:
    print( A - (D * K))
else :
    e = A//D
    K -= e
    x %= D
    if K%2 == 0:
        print(x)
    else:
        print(D-x)

### FIXED CODE ###

X,K,D = map(int,input().split())
A = abs(X)
ans = 0
if A >= D*K:
    print( A - (D * K))
else :
    e = A//D
    K -= e
    A %= D
    if K%2 == 0:
        print(A)
    else:
        print(D-A)