Harryxun/stf_run huggingface dataset:
import sys
sys.setrecursionlimit(10**6)
N = int(input())

fizzbuzz = []

for i in range(1, N):
    if i % 15 == 0:
        fizzbuzz.append('0')
    elif i % 3 == 0:
        fizzbuzz.append('0')
    elif i % 5 == 0:
        fizzbuzz.append('0')
    else:
        fizzbuzz.append(str(i))

num = [int(s) for s in fizzbuzz]
print(int(sum(num))


### FIXED CODE ###



N = int(input())

fizzbuzz = []

for i in range(1, N+1):
    if i % 3 == 0 or i % 5 == 0:
        fizzbuzz.append('0')
    else:
        fizzbuzz.append(str(i))

num = [int(s) for s in fizzbuzz]
print(sum(num))
import sys
input = sys.stdin.readline
x, y = [int(x) for x in input().split()]
A = [1, 3, 5, 7, 8, 10, 12]
B = [4, 6, 9, 11]
C = [2]
x, y = [int(x) for x in input().split()]
for i in [A, B, C]:
    if x in i and y in i:
        print("Yes")
        sys.exit()
print("No")

### FIXED CODE ###

import sys
input = sys.stdin.readline
x, y = [int(x) for x in input().split()]
A = [1, 3, 5, 7, 8, 10, 12]
B = [4, 6, 9, 11]
C = [2]
for i in [A, B, C]:
    if x in i and y in i:
        print("Yes")
        sys.exit()
print("No")
from collections import deque
import heapq
n, k = map(int, input().split())
v = list(map(int, input().split()))

result = []
for i in range(k):
    for j in range(k-i):
        jue = []
        heapq.heapify(jue)
        for ii in range(i):
            heapq.heappush(jue, v[ii])
        for jj in range(j):
            heapq.heappush(jue, v[-jj-1])
        for le in range(min(k-i-j, i+j)):
            heapq.heappop(jue)
        result.append(sum(jue))

print(max(result))

### FIXED CODE ###

import heapq
n, k = map(int, input().split())
v = list(map(int, input().split()))

result = []
for i in range(min(n, k)+1):
    for j in range(min(n, k)+1-i):
        x = v[:i]+v[n-j:]
        c = k - (i + j)
        x.sort()
        for t in range(min(len(x), c)):
            if x[0]<0:
                x.pop(0)
            else:
                break
        result.append(sum(x))
print(max(result))
S = input()

week = {"SUT":1, "SUN":7, "MON":6, "TUE":5, "WED":4, "THU":3,"FRI":2}

print(week[S])

### FIXED CODE ###

S = input()

week = {"SAT":1, "SUN":7, "MON":6, "TUE":5, "WED":4, "THU":3,"FRI":2}

ans = week[S]

print(ans)
s =input()
A=0
Z=0

for i in range(len(s)):
  s[i] =="A":
    A +=i+1
    break

    
for j in range(len(s)):
  s[-(j+1)] =="Z":
    Z +=len(s)-j
    break
    
print(Z-A+1)
    
    


### FIXED CODE ###

s = input()

id_a = len(s)
id_z = 0
for i in range(len(s)):
  if s[i] == 'A':
    id_a = min(id_a, i)
  if s[i] == 'Z':
    id_z = max(id_z, i)
    
print(id_z - id_a + 1)
K=int(input())
A,B=map(int,input().split())
a=0    
for i in range(A,B,1):
    if i % K ==0:
       print("OK")
       a+=1
       break 
        
elif a==0:
   print("NG")
   
        

### FIXED CODE ###

K=int(input())
A,B=map(int,input().split())
a=0    
for i in range(A,B+1):
    if i % K ==0:
       a=1
        
if a==0:
  print("NG")
    
else:
  print("OK")
import math
from functools import reduce
from collections import deque
import sys
sys.setrecursionlimit(10**7)

# スペース区切りの入力を読み込んで数値リストにして返します。
def get_nums_l():
    return [ int(s) for s in input().split(" ")]

# 改行区切りの入力をn行読み込んで数値リストにして返します。
def get_nums_n(n):
    return [ int(input()) for _ in range(n)]

# 改行またはスペース区切りの入力をすべて読み込んでイテレータを返します。
def get_all_int():
    return map(int, open(0).read().split())

def log(*args):
    print("DEBUG:", *args, file=sys.stderr)

table = [False]*9

aaa1 = get_nums_l()
aaa2 = get_nums_l()
aaa3 = get_nums_l()
aaa = [*aaa1, *aaa2, *aaa3]
n = int(input())
bbb = get_nums_n(n)

for b in bbb:
    for i,a in enumerate(aaa):
        if a == b:
            table[i] = True

check = [
    (0,3,6),
    (1,4,7),
    (2,5,8),
    (0,1,2),
    (3,4,5),
    (6,7,8),
    (0,4,8),
    (2,4,6)
]

for ch in check:
    for c in ch:
        if not table[c]:
            break
    else:
        print("Yes")
        exit()
print("No")

### FIXED CODE ###

import math
from functools import reduce
from collections import deque
import sys
sys.setrecursionlimit(10**7)

# スペース区切りの入力を読み込んで数値リストにして返します。
def get_nums_l():
    return [ int(s) for s in input().split(" ")]

# 改行区切りの入力をn行読み込んで数値リストにして返します。
def get_nums_n(n):
    return [ int(input()) for _ in range(n)]

# 改行またはスペース区切りの入力をすべて読み込んでイテレータを返します。
def get_all_int():
    return map(int, open(0).read().split())

def log(*args):
    print("DEBUG:", *args, file=sys.stderr)

table = [False]*9

aaa1 = get_nums_l()
aaa2 = get_nums_l()
aaa3 = get_nums_l()
aaa = aaa1 + aaa2 + aaa3
n = int(input())
bbb = get_nums_n(n)

for b in bbb:
    for i,a in enumerate(aaa):
        if a == b:
            table[i] = True

check = [
    (0,3,6),
    (1,4,7),
    (2,5,8),
    (0,1,2),
    (3,4,5),
    (6,7,8),
    (0,4,8),
    (2,4,6)
]

for ch in check:
    for c in ch:
        if not table[c]:
            break
    else:
        print("Yes")
        exit()
print("No")
def a(s):
    count = 0
    for i in range(len(s) - 2):
        if s[i] == s[i + 1]:
            s = s[:i + 1] + 'A' + s[i + 2:]
            count += 1
    if s[-1] == s[-2]:
        count += 1
    return count


s = input()
k = int(input())
if s[0] != s[-1] or k == 1:
    print(a(s) * k)
elif k == 2:
    new_s = s * 2
    print(a(new_s))
elif len(s) % 2 == 1 and len(s) == s.count(s[0]):
    new_s = s * 2
    count_2 = a(new_s)
    print(count_2 * (k // 2) + a(s) * (k % 2))
else:
    new_s = s * 2
    count_2 = a(new_s)
    count_3 = a(new_s + s)
    diff = count_3 - count_2
    print(count_3 + (k-3) * diff)


### FIXED CODE ###

def a(s):
    count = 0
    test = s[0]
    for i in range(len(s) - 1):
        if s[i] == s[i + 1] and test[i] != 'A':
            # s = s[:i + 1] + 'A' + s[i + 2:]
            test += 'A'
            count += 1
        else:
            test += s[i]
    return count


s = input()
k = int(input())
if s[0] != s[-1] or k == 1:
    print(a(s) * k)
elif k == 2:
    new_s = s * 2
    print(a(new_s))
elif len(s) == s.count(s[0]):
    new_s = s * 2
    count_2 = a(new_s)
    print(count_2 * (k // 2) + a(s) * (k % 2))
else:
    new_s = s * 2
    count_2 = a(new_s)
    count_3 = a(new_s + s)
    diff = count_3 - count_2
    print(count_3 + (k-3) * diff)
N, M = [int(i) for i in input().split()]
G = [[None for j in range(N)] for i in range(N)]
G_ls = []
d = [None for i in range(N)]
for i in range(M):
    a, b, c = [int(i) for i in input().split()]
    a -= 1
    b -= 1
    G[a][b] = c
    G_ls.append([a,b,c])

def update(x, y, is_updated):
    if x < y:
        is_updated = True
        x = y
    return x, is_updated

d[G_ls[0][0]] = 0
for i in range(N):
    is_updated = False
    for j in range(M):
        a, b, c = G_ls[j]
        if d[b] is None:
            d[b] = d[a] + c
            is_updated = True
            continue
        if d[a] is None:
            continue
        d[b], is_updated = update(d[b], d[a] + c, is_updated)
    if not is_updated:
        break
if is_updated:
    print("inf")
else:
    print(d[-1])

### FIXED CODE ###

N, M = [int(i) for i in input().split()]
G_ls = []
d = [-float("inf") for i in range(N)]
for i in range(M):
    a, b, c = [int(i) for i in input().split()]
    a -= 1
    b -= 1
    G_ls.append([a,b,c])

def update(x, y, is_updated):
    if x < y:
        is_updated = True
        x = y
    return x, is_updated
d[0] = 0
G_ls.sort(key=lambda x:x[0])
for i in range(N):
    for j in range(M):
        is_updated = False
        a, b, c = G_ls[j]
        d[b], is_updated = update(d[b], d[a] + c, is_updated)
if is_updated:
    print("inf")
else:
    print(d[-1])
N, M = [int(elem) for elem in input().split(' ')]
coord_list = [[int(elem) for elem in input().split(' ')] for _ in range(N)]
assert len(coord_list) == N
assert len(coord_list[0]) == 3


def search_max(sorted_coord_list, M, key):
    len_list = len(sorted_coord_list)
    if M == len_list:
        total_x, total_y, total_z = 0, 0, 0
        for x, y, z in sorted_coord_list:
            total_x += x
            total_y += y
            total_z += z
        total = abs(total_x) + abs(total_y) + abs(total_z)
        return total

    elif M == 1:
        x, y, z = sorted_coord_list[0]
        total = abs(x) + abs(y) + abs(z)
        return total

    # 2 <= M < N
    else:
        if sorted_coord_list[M - 1][key] == sorted_coord_list[M][key]:
            considering_val = coord_list[M - 1][key]
            current_idx = M - 1
            candidate_list = list()
            while (coord_list[current_idx][key] == considering_val) or current_idx == len_list:
                candidate_list.append(sorted_coord_list[current_idx])
                current_idx += 1
            total_x, total_y, total_z = 0, 0, 0
            for x, y, z in sorted_coord_list[:M - 1]:
                total_x += x
                total_y += y
                total_z += z
            max_total = 0
            for x, y, z in candidate_list:
                total = abs(total_x + x) + abs(total_y + y) + abs(total_z + z)
                max_total = max(max_total, total)
            return max_total

        else:
            total_x, total_y, total_z = 0, 0, 0
            for x, y, z in sorted_coord_list[:M]:
                total_x += x
                total_y += y
                total_z += z
            total = abs(total_x) + abs(total_y) + abs(total_z)
            return total


max_candidates = [0] * 6
for i in range(3):
    # sort coord_list: O(NlogN)
    sorted_coord_list = sorted(coord_list, key=lambda x: x[i])
    max_candidates[2 * i] = search_max(sorted_coord_list, M, i)
    max_candidates[2 * i + 1] = search_max(sorted_coord_list[::-1], M, i)

print(max(max_candidates))


### FIXED CODE ###

from itertools import product

N, M = [int(elem) for elem in input().split(' ')]
coord_list = [[int(elem) for elem in input().split(' ')] for _ in range(N)]
assert len(coord_list) == N
assert len(coord_list[0]) == 3

max_total = 0
for f_x, f_y, f_z in product([-1, 1], repeat=3):
    sum_list = [(f_x * x + f_y * y + f_z * z, i) for i, (x, y, z) in enumerate(coord_list)]
    # sort with index
    sum_list = sorted(sum_list, key=lambda x: x[0])[::-1]
    total_x, total_y, total_z = 0, 0, 0
    for _, idx in sum_list[:M]:
        total_x += coord_list[idx][0]
        total_y += coord_list[idx][1]
        total_z += coord_list[idx][2]
    total = abs(total_x) + abs(total_y) + abs(total_z)
    max_total = max(total, max_total)

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

def dfs(m,cnt):
    if cnt >= len(list):
        return 0
    b = list[cnt][1] if list[cnt][1] < m else m
    a = b*list[cnt][0]
    if m - b < 0 :
        return 0

    return a + dfs(m-b,cnt+1)

print(dfs(M,0))

### FIXED CODE ###

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

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

list.sort()
sum = 0
cnt = 0

for A,B in list:
    if cnt + B >= M:
        sum += A*(M - cnt)
        cnt += M - cnt
        break
    sum += A*B
    cnt += B

print(sum)
n=int(input())
list_v=list(map(int, input().split()))
list_c=list(map(int, input().split()))
list_ans = list_v - list_c
ans = 0
for i in range(n):
  if list_ans[i] > 0:
    ans += list_ans[i]
print(ans)

### FIXED CODE ###

n=int(input())
list_v=list(map(int, input().split()))
list_c=list(map(int, input().split()))
ans = 0
for i in range(n):
  ans_p = list_v[i] - list_c[i]
  if ans_p > 0:
    ans += ans_p
print(ans)
a,b=map(int,input())
A=str(a)*b
B=str(b)*a
print(min(int(A),int(B)))

### FIXED CODE ###

a,b=map(int,input().split())
if a<b:
    print(str(a)*b)
else:
    print((str(b)*a))
S,T = map(input().split())
print(sum[x!=y for x,y in zip(S,T)])

### FIXED CODE ###

S = input()
T = input()
print(sum([x!=y for x,y in zip(S,T)]))
s=list(input())
k=int(input())
z=[]
for i in range(1,k+1):
    for j in range(len(s)):
        if j+i<len(s):
            z.append(s[j:j+i])
z.sort()
print(z[k-1])

### FIXED CODE ###

s=list(input())
k=int(input())
z=[]
for i in range(1,k+1):
    for j in range(len(s)):
        if j+i<=len(s):
            z.append(s[j:j+i])
a=[]
for i in z:
    a.append(''.join(i))
a=list(set(a))
a.sort()
print(a[k-1])
a = input()
b = input()
c = input()

player = a
while True:
  l = player[0]
  player = player[1:]
  if len(player) == 0
  	print(player)
  player = l
  

### FIXED CODE ###

a = input()
b = input()
c = input()

i = "a"
player = {"a":a,"b":b,"c":c}

while True:
    if len(player[i])==0:
        print(i.upper())
        break
    l = player[i][0]
    player[i] = player[i][1:]
    i = l
n,m=map(int,raw_input().split())
st=[]
ch=[]
l=[]
for i in range(n):
    g=map(int,raw_input().split())
    st.append(g)
for y in range(n):
    r=map(int,raw_input().split())
    ch.append(r)





def dis(a,b):
    return abs(a[0]-b[0])+abs(a[1]-b[1])

for stu in st:
    ctr=0
    gh=10**9+7
    new={}
    for che in ch:
        # print stu,che,dis(stu,che)
        if dis(stu,che)<gh:
            gh=dis(stu,che)
            ctr+=1
            if gh not in new:
                new[gh]=[ctr]
            else:
                new[gh].append(ctr)


        else:
            ctr+=1
    # print new
    po=new.keys()
    # print po
    po.sort()
    poi=new[po[0]]
    # print poi
    poi.sort()
    l.append(poi[0])
for numb in l:
    print numb


### FIXED CODE ###

n,m=map(int,raw_input().split())
stu=[]
point=[]


for i in xrange(n):
    stu.append(map(int,raw_input().split()))
for j in xrange(m):
    point.append(map(int,raw_input().split()))


def dis(a,b):
    return abs(a[0]-b[0])+abs(a[1]-b[1])



for co in stu:
    ctr=1
    l=[]
    for po in point:
        l.append((dis(po,co),ctr))
        ctr+=1
    l.sort()
    print l[0][1]
#   ABC129　D問題
import numpy as np

H, W = map(int, input().split())    #   1 <= H, W <= 2000
S_arr = []
for _ in range(H):
    S_arr.append(list(input()))

point_arr = np.zeros((H, W))

start = 0
stop = W
for y in range(H):
    start = 0
    stop = W
    for x in range(W):
        if S_arr[y][x] == "#":
            stop = x
            point_arr[y, start:stop] += stop - start
            start = stop + 1
    point_arr[y, start:W] += W - start
    

for x in range(W):  #   コードのコピペ禁止の原則に違反してるけど、改善方法が思いつかない問題
    start = 0
    stop = H
    for y in range(H):
        if S_arr[y][x] == "#":
            stop = y
            point_arr[start:stop, x] += stop - start
            start = stop + 1
    point_arr[start:H, x] += H - start

print(int(np.max(point_arr))-1) 
#   O(H*W)程度の計算量で十分高速だと思ってたのに、そうでもない問題
#   2019/06/10 現在未解決　PyPy使ったらどうなるのかやってみた。Numpy含まれてるからランタイムエラーになるのだろうか？

### FIXED CODE ###

#   ABC129　D問題
H, W = map(int, input().split())    #   1 <= H, W <= 2000
S_arr = []
for _ in range(H):
    S_arr.append(list(input()))

point_arr = [[0]*W for _ in range(H)]

start = 0
stop = W
for y in range(H):
    start = 0
    stop = W
    for x in range(W):
        if S_arr[y][x] == "#":
            stop = x
            for i in range(start, stop):
                point_arr[y][i] += stop - start
            start = stop + 1
    for i in range(start, W):
        point_arr[y][i] += W - start


for x in range(W):  #   コードのコピペ禁止の原則に違反してるけど、改善方法が思いつかない問題
    start = 0
    stop = H
    for y in range(H):
        if S_arr[y][x] == "#":
            stop = y
            for i in range(start, stop):
                point_arr[i][x] += stop - start
            start = stop + 1
    for i in range(start, H):
        point_arr[i][x] += H - start

ans = 0
for i in range(H):
    for j in range(W):
        if ans < point_arr[i][j]:
            ans = point_arr[i][j]
ans -= 1
print(ans)
#   O(H*W)程度の計算量で十分高速だと思ってたのに、そうでもない問題
#   2019/06/10 現在未解決　PyPy使ったらどうなるのかやってみた。Numpy含まれてるからランタイムエラーになるのだろうか？
h, w = map(int, input().split())

s = [input() for _ in range(h)]

ans = 'Yes'

for i in range(h):
    for j in range(w):
        if s[i][j] == '#' and s[i-1][j] == '.' and s[i+1][j] == '.' and s[i][j-1] == '.' and s[i][j+1] == '.':
            ans = 'No'

print(ans)

### FIXED CODE ###

h, w = map(int, input().split())

s = [input() for _ in range(h)]

ans = 'Yes'

for i in range(1, h-1):
    for j in range(1, w-1):
        if s[i][j] == '#' and s[i-1][j] == '.' and s[i+1][j] == '.' and s[i][j-1] == '.' and s[i][j+1] == '.':
            ans = 'No'

print(ans)
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
# 問題：https://atcoder.jp/contests/abc126/tasks/abc129_c

N, M = map(int, input().strip().split())
a = [int(input()) for _ in range(M)]

def fibonacci(x):
    if x > 2:
        return fibonacci(x-1) + fibonacci(x-2)
    else:
        return 1

res = 1
count = 0
for i in range(N+1):
    if i in a:
        if count == 0:
            res = 0
            break
        res *= fibonacci(count)
        res %= 1000000007
        count = 0
        continue
    count += 1

if res != 0:
    res *= fibonacci(count)
    res %= 1000000007

print(res)


### FIXED CODE ###

#!/usr/bin/env python3
# -*- coding: utf-8 -*-
# 問題：https://atcoder.jp/contests/abc126/tasks/abc129_c

mod = 1000000007
N, M = map(int, input().strip().split())
a = [int(input()) for _ in range(M)]
a.append(N+1)

def fibonacci(x):
    a = 1
    b = 1
    if x <= 2:
        return a
    else:
        for _ in range(x-2):
            tmp = a
            a = b
            b = tmp + b
        return b

res = 1
prev_a = -1
for cur_a in a:
    if  cur_a - prev_a == 1:
        res = 0
        break
    res *= fibonacci(cur_a - prev_a - 1) % mod
    res %= mod
    prev_a = cur_a
    continue

print(res)
N = int(input())
sum=0
for i in range(N):
    x, u = map(input().split())
    if x == "JPY":
        sum+=int(x)
    else:
        sum+=int(x)*380000
print(sum)

### FIXED CODE ###

N = int(input())
sum=0
for i in range(N):
    x, u = list(map(str, input().split()))
    if u == "JPY":
        sum+=int(x)
    else:
        sum+=float(x)*380000
print(sum)
n, a, b = map(int,input().split())
if n＊a < b:
  print(n＊a)
elif n＊a >= b:
  print(b)


### FIXED CODE ###

n, a, b = map(int,input().split())
if n*a > b:
  print(b)
else:
  print(n*a)
_, *a = map(int, open(0).read().split())
a.sorted()
print(sum(a[-1::2]) - sum(a[-2::2]))


### FIXED CODE ###

_, *a = map(int, open(0).read().split())
a.sort()
print(sum(a[-1::-2]) - sum(a[-2::-2]))
import sys
N,M = map(int,input().split())
s = [0] * M
c = [0] * M
a = ["1"] + ["0"] * (N-1)
if M == 0:
    print(int("".join(a)))
    sys.exit()
for i in range(M):
    s[i],c[i] = map(int,input().split())

for j in range(N):
    if s[j] == 1 and c[j] == 0:
        print(-1)
        sys.exit()
    elif a[s[j]-1] == "0" or (s[j] == 1 and a[0] == "1"):
        a[s[j]-1] = str(c[j])
    elif a[s[j]-1] == str(c[j]):
        pass
    else:
        print(-1)
        sys.exit()
ans = "".join(a)
print(int(ans))

### FIXED CODE ###

import sys
N,M = map(int,input().split())
s = [0] * M
c = [0] * M
a = ["-1"] * (N)
if N == 1 and M == 0:
    print(0)
    sys.exit()
for i in range(M):
    s[i],c[i] = map(int,input().split())

for j in range(M):
    if s[j] == 1 and c[j] == 0 and N != 1:
        print(-1)
        sys.exit()
    elif a[s[j]-1] == "-1":
        a[s[j]-1] = str(c[j])
    elif a[s[j]-1] == str(c[j]):
        pass
    else:
        print(-1)
        sys.exit()
if a[0] == "-1":
    a[0] = "1"
for h in range(1,N):
    if a[h] == "-1":
        a[h] = "0"
ans = "".join(a)
print(int(ans))
N, Q = map(int, input().split())

def update(p, x):
    counter[p] += x
    for pp in tree[p]:
        update(pp, x)
    
tree = {i: [] for i in range(N)}
counter = [0] * N
for _ in range(N-1):
    a, b = map(int, input().split())
    tree[a-1].append(b-1)
for _ in range(Q):
    p, x = map(int, input().split())
    update(p-1, x)
print(" ".join(map(str, counter)))

### FIXED CODE ###

from sys import setrecursionlimit
from sys import stdin
input = stdin.readline
setrecursionlimit(10**7)

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

def update(v, p):
    for next in tree[v]:
        if next == p:
            continue
        counter[next] += counter[v]
        update(next, v)

tree = [[] for _ in range(N)]
counter = [0] * N

for _ in range(N-1):
    a, b = map(int, input().split())
    tree[a-1].append(b-1)
    tree[b-1].append(a-1)
for _ in range(Q):
    p, x = map(int, input().split())
    counter[p-1] += x
update(0, -1)
print(" ".join(map(str, counter)))
import numpy as np

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

na = np.array(a)

mat = np.bitwise_xor(na.reshape(N,1),na)

print(sum(sum(mat))//2%(10**9+7))

### FIXED CODE ###

import math
import  numpy as np

N = int(input())
a = np.array(list(map(int, input().split())))

ans = 0
a_max = max(a)

if a_max==0:alog=1
else:alog = int(math.log2(a_max))+1

for i in range(alog):
    p = pow(2, i)
    cnt = np.count_nonzero((a >> i)& 1 == 1)
    
    ans += cnt * (N - cnt)*(2**i)
print(ans%(10**9+7))
import sys
import itertools
import funtools
sys.setrecursionlimit(1000000000)
from heapq import heapify,heappop,heappush,heappushpop
import math
import collections

n = int(input())
if n%2 == 0:
    print(n)
else:
    print(2*n)

### FIXED CODE ###

import sys
import itertools
sys.setrecursionlimit(1000000000)
from heapq import heapify,heappop,heappush,heappushpop

import collections

n = int(input())
if n%2 == 0:
    print(n)
else:
    print(2*n)
# ANSHUL GAUTAM
# IIIT-D

'''

'''

def solve(grid):
	H,W = len(grid),len(grid[0])
	q = []
	dist = [0]*H
	for i in range(H):
		dist[i] = []
	for i in range(H):
		for j in range(W):
			if(grid[i][j] == '#'):
				q.append([i,j])
				grid[i][j] = 0
	maxx = 0
	for i,j in q:
		for r,c in [[i+1,j],[i-1,j],[i,j+1],[i,j-1]]:
			if(0 <= r < H and 0 <= c < W and grid[r][c] == '.'):
				grid[r][c] = grid[i][j] + 1
				maxx = max(maxx,grid[r][c])
				q.append([r,c])
	return maxx

H,W = map(int, input().split())
grid = []
for h in range(H):
	s = list(input())
	grid.append(s)
ans = solve(grid)
print(ans)



### FIXED CODE ###

# ANSHUL GAUTAM
# IIIT-D

'''

'''

def solve(grid):
	H,W = len(grid),len(grid[0])
	q = []
	dist = [0]*H
	for i in range(H):
		dist[i] = []
	for i in range(H):
		for j in range(W):
			if(grid[i][j] == '#'):
				q.append([i,j])
				grid[i][j] = 0
	maxx = 0
	while(q):
		qq = []
		for i,j in q:
			for r,c in [[i+1,j],[i-1,j],[i,j+1],[i,j-1]]:
				if(0 <= r < H and 0 <= c < W and grid[r][c] == '.'):
					grid[r][c] = grid[i][j] + 1
					maxx = max(maxx,grid[r][c])
					qq.append([r,c])
		q = qq
	return maxx

H,W = map(int, raw_input().split())
grid = []
for h in range(H):
	s = list(raw_input())
	grid.append(s)
ans = solve(grid)
print(ans)
a,b,c=map(int,input().split())
rank=0
for i in range(1,max(a,b)+1):
  	if a%i==0 and b%i==0:
      rank+=1
    if rank==c:
      print(i)
      break

### FIXED CODE ###

a,b,c=map(int,input().split())
l=[]
for i in range(1,max(a,b)+1):
  if a%i==0 and b%i==0:
    l.append(i)
print(l[-c])
import numpy as np
n=input()
data=list(map(int,input().split()))
is_i=0
num=sorted(data)
count=num[1]
if num[0]!=num[1]:
    count=num[1]/2+1
for i in range(count+1)[::-1]:
    is_i=0
    if all([x%i==0 for x in data]):
        print(i)
        break
    else:
        for j in range(len(data)):
            if data[j]%i!=0:
                is_i+=1
        if is_i==1:
            print(i)
            break

### FIXED CODE ###

from fractions import gcd
import numpy as np
n=int(input())
data=list(map(int,input().split()))
left=np.zeros(n+1,dtype=np.int)
right=np.zeros(n+1,dtype=np.int)
kotae=1
for i in range(n):
    left[i+1]=gcd(left[i],data[i])
    right[n-i-1]=gcd(right[n-i],data[n-i-1])
for j in range(n):
    num=gcd(left[j],right[j+1])
    kotae=max(num,kotae)
print(kotae)
import numpy as np
n, k = map(int, input().split())
hs = []
for i in range(n):
    hs.append(int(input()))

if list(np.diff(hs)) == list(np.zeros(n-1, dtype=int)):
    print(0)
elif k == 1:
    print(0)
else:
    sorted_hs = np.sort(hs)
    print(min([min(np.diff(sorted_hs[i::k-1])) for i in range(k)]))

### FIXED CODE ###

import numpy as np
n, k = map(int, input().split())
hs = []
for i in range(n):
    hs.append(int(input()))

if list(np.diff(hs)) == list(np.zeros(n-1, dtype=int)):
    print('0')
else:
    sorted_hs = np.sort(hs)
    try:
        print(min([min(np.diff(sorted_hs[i::k-1])) for i in range(k) if not len(sorted_hs[i::k-1]) == 1]))
    except:
        print('0')