Harryxun/sft_time huggingface dataset:
### BUGGY CODE ###

import sys
sys.setrecursionlimit(10**7)
from collections import deque
from heapq import heappush, heappop
def solve():
    H,W = map(int, input().split())
    A = [ list(input()) for _ in range(H)]
    HMANY = [ [10**9] * W for _ in range(H)]

    
    q = deque()
    for h in range(H):
        for w in range(W):
            if A[h][w] == "#" :
                q.append((0,h,w))
    while q:
        num,h,w = q.popleft()
        if HMANY[h][w] > num:
            HMANY[h][w] = num
            A[h][w] = "#"

            if h+1 <H and A[h+1][w] == ".":
                q.append( (num+1,h+1,w))
            if w+1 <W and A[h][w+1] == ".":
                q.append((num+1,h,w+1))
            if 0<=h-1 and A[h-1][w] == ".":
                q.append((num+1,h-1,w))
            if 0<=w-1 and A[h][w-1] == ".":
                q.append((num+1,h,w-1))

    ans = 0
    for h in range(H):
        ans = max(ans, max(HMANY[h]))
    print(ans)

if __name__ == "__main__":
    solve()

### FIXED CODE ###

import sys
sys.setrecursionlimit(10**7)
from collections import deque
from heapq import heappush, heappop
def solve():
    H,W = map(int, input().split())
    A = [ list(input()) for _ in range(H)]
    HMANY = [ [10**9] * W for _ in range(H)]

    
    
    # q = deque()
    for h in range(H):
        for w in range(W):
            if A[h][w] == "#" :
                HMANY[h][w] = 0
    for w in range(W):
        for h in range(H-1):
            if HMANY[h][w]+1 < HMANY[h+1][w]:
                HMANY[h+1][w] = HMANY[h][w] + 1
        for h in range(H-1, 0, -1):
            if HMANY[h][w]+1 < HMANY[h-1][w]:
                HMANY[h-1][w] = HMANY[h][w] + 1
    
    for h in range(H):
        for w in range(W-1):
            if HMANY[h][w]+1 < HMANY[h][w+1]:
                HMANY[h][w+1] = HMANY[h][w] + 1
        for w in range(W-1, 0, -1):
            if HMANY[h][w]+1 < HMANY[h][w-1]:
                HMANY[h][w-1] = HMANY[h][w] + 1        
    #             q.append((h,w))
    #             A[h][w] = "."
    # ans = 0
    # while q:
    #     nextQ = deque()
    #     for h,w in q:
    #         A[h][w] = "#"
    #         if h+1 <H and A[h+1][w] == ".":
    #             nextQ.append( (h+1,w))
    #         if w+1 <W and A[h][w+1] == ".":
    #             nextQ.append((h,w+1))
    #         if 0<=h-1 and A[h-1][w] == ".":
    #             nextQ.append((h-1,w))
    #         if 0<=w-1 and A[h][w-1] == ".":
    #             nextQ.append((h,w-1))        
    #     ans += 1
    #     q = nextQ
        # num,h,w = q.popleft()        
        # if HMANY[h][w] > num and A[h][w] == ".":
        #     HMANY[h][w] = num
        #     A[h][w] = "#"
        #     if h+1 <H and A[h+1][w] == ".":
        #         q.append( (num+1,h+1,w))
        #     if w+1 <W and A[h][w+1] == ".":
        #         q.append((num+1,h,w+1))
        #     if 0<=h-1 and A[h-1][w] == ".":
        #         q.append((num+1,h-1,w))
        #     if 0<=w-1 and A[h][w-1] == ".":
        #         q.append((num+1,h,w-1))

    ans = 0
    for h in range(H):
        ans = max(ans, max(HMANY[h]))
    # print(ans-1)
    print(ans)

if __name__ == "__main__":
    solve()
### BUGGY CODE ###

t = []
n = int(input())
for i in range(n):
    t.append(int(input()))



'''
n = 6
t=[4,1,5,7,5,4]
'''



maxv = t[1] - t[0]
for j in range(1,n):
    for i in range(j):
        maxv = max([maxv,t[j] - t[i]])
print(maxv)

### FIXED CODE ###

t = []
n = int(input())
for i in range(n):
    t.append(int(input()))



'''
n = 6
t=[4,1,5,7,5,4]
'''


minv = t[0]
maxv = t[1] - t[0]
for j in range(1,n):
    maxv = max([maxv,t[j] - minv])
    minv = min([minv,t[j]])
print(maxv)
### BUGGY CODE ###

x, k, d = map(int, input().split())
  
x = abs(x)

if x > k * d:
  print(x - k * d)
else:
  g = k - int(x / d)
  if g > 0:
    if g % 2 == 1:
      g -= 1
    k = k - g

  for i in range(k):
    if x < 0:
      x += d
    else:
      x -= d

  print(abs(x))

### FIXED CODE ###

x, k, d = map(int, input().split())
  
x = abs(x)

if x > k * d:
  print(x - k * d)
else:
  f = int(x / d)
  x = x - f * d
  g = (k - f) % 2
  if g == 1:
    x = x - d
  print(abs(x))
### BUGGY CODE ###

def ans():
  N, K = map(int,input().split())
  H = sorted([int(input()) for _ in range(N)])
  res = 1e9+7
  for i in range(N-K+1):
    tmp = H[i:i+K]
    res = min(res, max(tmp)-min(tmp))
  print(res)
ans()

### FIXED CODE ###

N, K = map(int,input().split())
h = sorted([int(input()) for i in range(N)])
trees = [h[i+K-1] - h[i] for i in range(N-K+1)]
print(min(trees))
### BUGGY CODE ###

from collections import defaultdict,deque
import sys,heapq,bisect,math,itertools,string,queue,copy,time
sys.setrecursionlimit(10**8)
input = sys.stdin.readline
INF = float('inf')
mod = 10**9+7
eps = 10**-7
def inp():
    '''
    一つの整数
    '''
    return int(input())
def inpl():
    '''
    一行に複数の整数
    '''
    return list(map(int, input().split()))
def inpl_str():
    '''
    一行に複数の文字
    '''
    return list(input().split())


s = list(map(int,list(input())[:-1]))
n=len(s)
left = [0]*(n+1)
right = [0] * (n + 1)
for i in range(n):
    left[i + 1] = (left[i] * 10 + s[i]) % 2019
    right[-i - 2] = (right[-i - 1] + s[-i-1] * 10**i) % 2019

log = defaultdict(lambda: 0)

for i in range(n + 1):
    log[right[-i - 1]] += 1
ans=0
for key,value in log.items():
    if value > 1:
        ans += value * (value - 1) // 2
print(ans)

### FIXED CODE ###

'''
1~9の文字列で構成されたSの中で
i文字目からj文字目までが2019の倍数になっているものの個数を求めよ

terms:
    1<=|S|<=2*10**5

input:
    1817181712114

output:
    3
'''
from collections import defaultdict
import sys
input = sys.stdin.readline
s = input()[:-1]
n=len(s)
arr = [int(s[i]) for i in range(n)]
ans = 0
dic = defaultdict(int)
dic[0] = 1
now = 0
for i in range(n - 1, -1, -1):
    now += arr[i] * pow(10, n - i - 1, 2019)
    now %= 2019
    ans += dic[now]
    dic[now] += 1
print(ans)
### BUGGY CODE ###

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

m = M
cost = []
for n in range(N + 1):
    #print(n, m)
    if sum(A[:n]) > K:
        break
    while True:
        #print(n, m)
        if sum(A[:n]) + sum(B[:m]) <= K:
            cost.append(n + m)
            break
        m -= 1
# print(cost)
print(max(cost))


### FIXED CODE ###

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

ma = [0] * (N + 1)
mb = [0]*(M+1)


for i in range(N):
    ma[i + 1] = ma[i] + A[i]

for i in range(M):
    mb[i + 1] = mb[i] + B[i]

j = M
max_num = 0

for i in range(N+1):
    if ma[i] > K:
        break
    while ma[i] + mb[j] > K:
        j -= 1
    max_num = max(max_num, i + j)
print(max_num)
### BUGGY CODE ###

n,k = map(int,input().split())
A = list(map(int,input().split()))
B = []
b = 1
ans = 1
while ans:
  a = b
  b = A[a-1]
  B.append(b)
  if len(B) == k:
    ans = 0

print(B[k-1])


### FIXED CODE ###

N,K = map(int,input().split())
A = list(map(int,input().split()))
pos = 0
visit = [0] * N
move = []
roop = []
while visit[pos]!=2:
    if visit[pos]==0:
        move.append(pos)
    else:
        roop.append(pos)
    visit[pos] += 1
    pos = A[pos] - 1
if len(move)>K:
    print(move[K]+1)
else:
    print(roop[(K-(len(move)-len(roop)))%len(roop)]+1)
### BUGGY CODE ###

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

for i in range(1,n+1):
    x=0
    for j in range(n-1):
        if i==a[j]:
            x+=1
    print(x)

### FIXED CODE ###

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

b=[0]*n
for i in a:
    b[i-1]+=1

for i in b:
    print(i)
### BUGGY CODE ###

H,W,K = map(int,input().split())
import numpy as np
from collections import deque
ans = 10000
S = np.array([list(map(int,list(input()))) for _ in range(H)])
cum = [[0]*W for _ in range(H+1)]
for j in range(W):
  for i in range(1,H+1):
    cum[i][j] = cum[i-1][j]+S[i-1][j]
    
cum = np.array(cum)
for i in range(2**(H-1)):
  q = deque([0])
  for h in range(H):
    if (i>>h)&1:
      q.append(h+1)
  q.append(H)
  p = deque()
  judge = False
  for a in range(len(q)-1):
    x = cum[q[a+1]]-cum[q[a]]
    if (x>K).any():
      judge = True
      break
    else:
      p.append(x)

  if judge:
    continue
  
  t_a = len(q)-2
  n = len(p)
  l = [0]*n
  for w in range(W):
    for x,a in enumerate(p):
      l[x] = l[x]+a[w]
      if l[x]>K:
        t_a+=1
        l = [0]*n
        for z,b in enumerate(p):
          l[z] = b[w]
        break
  ans = min(ans,t_a)
    
print(ans)

### FIXED CODE ###

def main():
  H,W,K = map(int,input().split())
  import numpy as np
  from collections import deque
  ans = 10000
  S = np.array([list(map(int,list(input()))) for _ in range(H)])
  cum = [[0]*W for _ in range(H+1)]
  for j in range(W):
    for i in range(1,H+1):
      cum[i][j] = cum[i-1][j]+S[i-1][j]

  cum = np.array(cum)
  for i in range(2**(H-1)):
    j = 0
    q = deque([0])
    for h in range(H):
      if (i>>h)&1:
        q.append(h+1)
    q.append(H)
    t_a = len(q)-2
    if t_a>=ans:
      continue
    p = deque()
    judge = False
    for a in range(len(q)-1):
      x = cum[q[a+1]]-cum[q[a]]
      if (x>K).any():
        judge = True
        break
      else:
        p.append(list(x))

    if judge:
      continue
    n = len(p)
    l = [0]*n
    for w in range(W):
      y = [l[j]+p[j][w] for j in range(n)]
      if max(y)>K:
        t_a+=1
        l = [p[j][w] for j in range(n)]
        if t_a>=ans:
          judge = True
          break
      else:
        l = y
    if judge:
      continue
    ans = min(ans,t_a)

  print(ans)
  
main()
### BUGGY CODE ###

import numpy as np

n = int(input())
sraw = []

for nn in range(n):
    sraw.append(sorted(input()))

ans = 0

#s = np.sort(np.array(sraw), axis=0).tolist()
s = sorted(sraw)
#print(s)

l = len(s)

for ss in range(0, l):
    fl = 0
    #print("")
    for sss in range(ss+1, l):
        #print("{0} {1}".format(s[ss],s[sss]))
        if s[ss] == s[sss]:
            ans += 1
            fl = 1

        elif fl == 1:

            break


print(ans)


### FIXED CODE ###

n = int(input())
sraw = dict()

for nn in range(n):
    i = "".join(sorted(input()))
    if i in sraw:
        sraw[i] += 1
    else:
        sraw[i] = 1

ans = 0

for ss in sraw:
    ans += round(sraw[ss]*(sraw[ss]-1)/2)

print(ans)
### BUGGY CODE ###

def main():
    import sys
    import queue
    input=sys.stdin.readline

    h,w,k=map(int,input().split())
    sy,sx,gy,gx=map(int,input().split())

    #maze=[]
    #for _ in range(h):
    #    maze.append(tuple(input()))

    maze=[tuple(input()) for _ in range(h)]

    sy-=1
    sx-=1
    gy-=1
    gx-=1

    #maze[sy][sx]="S"

    dis=[[-1]*w for _ in range(h)]
    dis[sy][sx]=0
    
    d= queue.Queue()
    d.put((sx,sy))
    #d = deque([(sx,sy)])
    #print(d)
    while not d.empty():
        (x,y)=d.get()
        #print(x,y)
        if x==gx and y==gy:
            print(dis[gy][gx])
            #maze[gy][gx]="G"

            #pri(dis)
            #pri(maze)

            exit()

        for (mx,my) in ((0,1),(1,0),(-1,0),(0,-1)):
            #print(mx,my,d)
            for j in range(1,k+1):
                nx=x+mx*j
                ny=y+my*j
                #print(y,x,">>",ny,nx)
                if 0<=nx<w and 0<=ny<h:
                    if maze[ny][nx]=="." and (dis[ny][nx]==-1 or dis[ny][nx]==dis[y][x]+1):
                        dis[ny][nx]=dis[y][x]+1
                        d.put((nx,ny))
                        #pri(dis)
                    else:
                        break
                else:
                    break

    print(-1)
        
if __name__ == '__main__':
    main()


                










### FIXED CODE ###

def main():
    import sys
    from collections import deque
    input=sys.stdin.readline

    h,w,k=map(int,input().split())
    sy,sx,gy,gx=map(int,input().split())

    #maze=[]
    #for _ in range(h):
    #    maze.append(tuple(input()))

    maze=[tuple(input()) for _ in range(h)]

    sy-=1
    sx-=1
    gy-=1
    gx-=1

    #maze[sy][sx]="S"

    dis=[[-1]*w for _ in range(h)]



    dis[sy][sx]=0



    d = deque([(sx,sy)])
    while len(d)>0:
        (x,y)=d.popleft()
        if x==gx and y==gy:
            print(dis[gy][gx])
            #maze[gy][gx]="G"

            #pri(dis)
            #pri(maze)

            exit()

        for (mx,my) in ((0,1),(1,0),(-1,0),(0,-1)):
            #print(mx,my,d)
            for j in range(1,k+1):
                nx=x+mx*j
                ny=y+my*j
                #print(y,x,">>",ny,nx)
                if 0<=nx<w and 0<=ny<h:
                    if maze[ny][nx]=="." and (dis[ny][nx]==-1 or dis[ny][nx]==dis[y][x]+1):
                        if dis[ny][nx]==-1:
                            d.append((nx,ny))
                        dis[ny][nx]=dis[y][x]+1
                        
                        #pri(dis)
                    else:
                        break
                else:
                    break

    print(-1)
        
if __name__ == '__main__':
    main()
### BUGGY CODE ###

from functools import reduce
from operator import mul

mod = 10**9 + 7

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

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

if N == K:
    print(reduce(mul, A)%mod)

else:

    AP = []
    AM = []
    for i in A:
        if i < 0:
            AM.append(i)
        else:
            AP.append(i%mod)
            
    if len(AP) == 0 and K%2 != 0:
        AM.sort(reverse=True)
        AM = AM[:K]
        print(reduce(mul, AM)%mod)

    else:
        
        AP.sort(reverse=True)
        AM.sort()
        
        ans = 1
        p = 0
        m = 0
        cnt = 0
        while True:
            if (K - cnt) == 1:
                ans *= AP[p]
                print(ans%mod)
                break
                
            elif 2 <= (len(AM) - m) and 2 <= (len(AP) - p):   
                if AP[p]*AP[p+1] >= AM[m]*AM[m+1]:
                    ans *= (AP[p]*AP[p+1])
                    p += 2
                    cnt += 2
                
                else:
                    ans *= (AM[m]*AM[m+1])
                    m += 2
                    cnt += 2 
                    
            elif 1 >= (len(AP) - p) and 2 <= (len(AM) - m):
                ans *= (AM[m]*AM[m+1])
                m += 2
                cnt += 2 
            
            elif 2 <= (len(AP) - p) and 1 >= (len(AM) - m):
                ans *= (AP[p]*AP[p+1])
                p += 2
                cnt += 2
            
            

            if cnt == K:
                print(ans%mod)
                break


### FIXED CODE ###

from bisect import bisect_left,bisect_right
p=10**9+7
n,k=map(int,input().split())
a=sorted(list(map(int,input().split())))
pi=1
ni=0
ans=1
i=0
while i<k-1:
  if a[ni]*a[ni+1]>a[-pi]*a[-pi-1]:
    ans=ans*a[ni]*a[ni+1]%p
    ni+=2
    i+=2
  else:
    ans=ans*a[-pi]%p
    pi+=1
    i+=1
if i==k-1:
  ans=ans*a[-pi]%p
if a[-1]<0 and k%2==1:
  ans=1
  for i in a[n-k:]:
    ans=ans*i%p
print(ans)
### BUGGY CODE ###

import collections
import sys
sys.setrecursionlimit(10 ** 5)
N, M, P = map(int, input().split())
e = collections.defaultdict(list)
for _ in range(M):
  u, v, c = map(int, input().split())
  e[u].append((v, c))
def isConnected(n):
  if n == N:
    return True
  vis = [0] * (N + 1)
  que = collections.deque([])
  que.append(n)
  while que:
    nc = que.popleft()
    vis[nc] = 1
    for o in e[nc]:
      if o[0] == N:
        return True
      if vis[o[0]] == 0:
        que.append(o[0])
  return False
inf = 10 ** 10
visited = [0] * (N + 1)
earn = [-inf] * (N + 1)
earn[1] = 0
def dfs(now):
  global visited
  global earn
  visited[now] = 1
  for n in e[now]:
    if visited[n[0]] == 0:
      if n[1] + earn[now] - P > earn[n[0]]:
        earn[n[0]] = n[1] + earn[now] - P
        dfs(n[0])
        visited[n[0]] = 0
    else:
      if earn[n[0]] < n[1] + earn[now] - P:
        if isConnected(n[0]) == True:
          print(-1)
          exit(0)
dfs(1)
print(max(earn[N], 0))




### FIXED CODE ###

import collections
import sys
import time
sys.setrecursionlimit(10 ** 5)
N, M, P = map(int, input().split())
e = collections.defaultdict(list)
st = time.time()
for _ in range(M):
  u, v, c = map(int, input().split())
  e[u].append((v, c))
def isConnected(n):
  if n == N:
    return True
  vis = [0] * (N + 1)
  que = collections.deque([])
  que.append(n)
  while que:
    nc = que.popleft()
    vis[nc] = 1
    for o in e[nc]:
      if o[0] == N:
        return True
      if vis[o[0]] == 0:
        que.append(o[0])
  return False
inf = 10 ** 10
visited = [0] * (N + 1)
earn = [-inf] * (N + 1)
earn[1] = 0
def dfs(now):
  global visited
  global earn
  nt = time.time() - st
  if nt > 1.95:
    print(max(earn[N], 0))
    exit(0)
  visited[now] = 1
  for n in e[now]:
    if visited[n[0]] == 0:
      if n[1] + earn[now] - P > earn[n[0]]:
        earn[n[0]] = n[1] + earn[now] - P
        dfs(n[0])
        visited[n[0]] = 0
    else:
      if earn[n[0]] < n[1] + earn[now] - P:
        if isConnected(n[0]) == True:
          print(-1)
          exit(0)
dfs(1)
print(max(earn[N], 0))
### BUGGY CODE ###

import math
from typing import List, Counter, Tuple
from collections import Counter
from itertools import permutations


def read_int() -> int:
    return int(input().strip())


def read_ints() -> List[int]:
    return list(map(int, input().strip().split(' ')))


INF = 10**9

def solve() -> int:
    N = read_int()
    D = read_ints()
    if N>23:
        return 0
    max_distance = -INF
    for mask in range(1<<N):
        distances = [0]
        min_distance = INF
        temp = mask
        for i in range(N):
            if temp&1 == 0:
                d = D[i]
            else:
                d = 24-D[i]
            current = min(min(abs(d0-d), 24-abs(d0-d)) for d0 in distances)
            distances.append(d)
            if current < min_distance:
                min_distance = current
            temp >>= 1
        if min_distance > max_distance:
            max_distance = min_distance
    return max_distance
        


if __name__ == '__main__':
    print(solve())


### FIXED CODE ###

import math
from typing import List, Counter, Tuple
from collections import Counter
from itertools import permutations


def read_int() -> int:
    return int(input().strip())


def read_ints() -> List[int]:
    return list(map(int, input().strip().split(' ')))


INF = 10**9

def solve() -> int:
    N = read_int()
    D = read_ints()
    if N>23:
        return 0
    D.sort(key=lambda d:min(d, 24-d))
    right = True
    assignment = [False]*24
    assignment[0] = True
    for d in D:
        if right:
            if assignment[d]:
                return 0
            assignment[d] = True
        else:
            if assignment[(24-d)%24]:
                return 0
            assignment[(24-d)%24] = True
        right = not right

    count = 0
    counts = []
    for i in range(1, len(assignment)+1):
        i %= 24
        if not assignment[i]:
            count += 1
        else:
            counts.append(count)
            count = 0
    return min(counts)+1
        


if __name__ == '__main__':
    print(solve())
### BUGGY CODE ###

N, = map(int, input().split())
M=10**9+7
n=N
_ALL=1<<n
def itercomb(n,k):
    if k==0:
        yield 0
    else:
        _a = (1<<k)-1
        yield _a
        while 1:
            _x = _a & -_a
            _y = _a + _x
            _a = (((_a & ~_y) // _x) >> 1) | _y
            if _a >= _ALL: break
            yield _a


xs = []
for _ in range(N):
    xs.append([1<<i for i, x in enumerate(input().split()) if int(x)])
d = [0]*(1<<N)
d[0] = 1
for i, x in enumerate(xs):
    for ai in x:
        for x in itercomb(N, i):
            if (not x&ai):
                d[x|ai] = (d[x|ai]+d[x])%M
print(d[-1])


### FIXED CODE ###

N, = map(int, input().split())
M=10**9+7
n=N
_ALL=1<<n
def itercomb(n,k):
    if k==0:
        yield 0
    else:
        _a = (1<<k)-1
        yield _a
        while 1:
            _x = _a & -_a
            _y = _a + _x
            _a = (((_a & ~_y) // _x) >> 1) | _y
            if _a >= _ALL: break
            yield _a


xs = []
for _ in range(N):
    xs.append([1<<i for i, x in enumerate(input().split()) if int(x)])
d = [0]*(1<<N)
d[0] = 1
for i, y in enumerate(xs):
    for x in itercomb(N, i):
        for ai in y:
            if (not x&ai):
                d[x|ai] += d[x]%M
                if d[x|ai] >M:
                    d[x|ai]-=M
print(d[-1])
### BUGGY CODE ###

X, Y = map(int, input().split(' '))

i = 1
cond = False
if X != Y:
    while i <= 1000000000:
        if (i % X) == 0:
            if (i % Y) != 0:
                cond = True
                break
        i += 1

if cond:
    print(i)
else:
    print(-1)

### FIXED CODE ###

X, Y = map(int, input().split(' '))

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

if X < Y:
    print(X)
elif X % Y == 0:
    print(-1)
elif gcd(X, Y) == 1:
    print(X)
else:
    tmp = X * gcd(X, Y)
    if tmp % Y != 0:
        print(tmp)
    else:
        print(X * int(X / gcd(X, Y)))
### BUGGY CODE ###

from sys import stdin,stdout
n,m=map(int,stdin.readline().split())
H=list(map(int,stdin.readline().split()))
L=[[]]*(n)
for i in range(m):
	a,b=map(int,stdin.readline().split())
	L[a-1] = L[a-1]+[H[b-1]]
	L[b-1] = L[b-1]+[H[a-1]]
	
#print(L)

count=0
for i in range(n):
	if L[i]!=[]:
		if H[i]>max(L[i]):
			count+=1
	else:
		count+=1
		
stdout.write(str(count))

### FIXED CODE ###

from sys import stdin,stdout
n,m=map(int,stdin.readline().split())
H=list(map(int,stdin.readline().split()))
L=[0]*n
for i in range(m):
	a,b=map(int,stdin.readline().split())
	L[a-1]=max(L[a-1],H[b-1])
	L[b-1]=max(L[b-1],H[a-1])
ans=0
for i in range(n):
	if H[i]>L[i]:
		ans+=1
		
stdout.write(str(ans))
### BUGGY CODE ###

n,p=[int(i) for i in input().split()]
#print(n,p)

list1=[]
flag=0
for i in range(n+1):
  for j in range(n+1-i):
    for k in range(n+1-i-j):
      total=10000*i+5000*j+1000*k
      if total==p and flag==0:
        print(i,j,k)
        flag=1
        
if flag==0:
  print(-1,-1,-1)

### FIXED CODE ###

n,y=(int(i) for i in input().split())
#print(n,y)

flag=0
for a in range(n+1):
  for b in range(n+1):
    c=n-a-b
    if 10*a+5*b+c==y/1000 and c>=0 and flag==0:
      flag=1
      print(str(a)+' '+str(b)+' '+str(c))

if flag==0:
      print(str(-1)+' '+str(-1)+' '+str(-1))
### BUGGY CODE ###

S=int(input())
cond=0

if S<=10**9:
 print(0,0,1,0,0,S)
else:
 for x2 in reversed(range(1,10**9+1)):
   if int(S/x2)+1 <=10**9:
      print(0,0,x2,1,x2-S%x2,int(S/x2)+1)
      break



### FIXED CODE ###

S=int(input())
cond=0

if S<=10**9:
 print(0,0,1,0,0,S)
elif S==10**18:
 print(0,0,10**9,0,0,10**9)
else:
 for x2 in reversed(range(1,10**9+1)):
   if int(S/x2)+1 <=10**9:
      print(0,0,x2,1,x2-S%x2,int(S/x2)+1)
      break