Harryxun/stf_run huggingface dataset:
#include<stdio.h>
#include<stdlib.h>
#include<string.h>

#define NEW(p,n){p=malloc((n)*sizeof(p[0]));if(p==NULL){printf("not enough memory\n");exit(1);};}
//pの型の変数n個の要素分のメモリを確保し、そのアドレスをpに代入するマクロ

#define MAX(a, b) ((a) > (b) ? (a) : (b))
#define MIN(a, b) ((a) < (b) ? (a) : (b))
#define SWAP(type, x, y) do { type tmp = x; x = y; y = tmp; } while (0)

#define MOD 1000000007 

int main(void){
    int H,W;
    scanf("%d%d",&H,&W);

    char map[H][W+1];
    for(int i=0;i<H;i++) scanf("%s",map[i]);

    for(int i=0;i<H;i++){
        for(int j=0;j<W;j++){
            int flg=0;
            if(map[i][j]=='#'){
                if(i>0 && map[i-1][j]=='#') flg=1;
                if(i<H-1 && map[i+1][j]=='#') flg=1;
                if(j>0 && map[i][j-1]=='#') flg=1;
                if(j<W-1 && map[i][j+1]=='#') flg=1;
            }
            if(!flg){
                printf("No\n");
                return 0;
            }
        }
    }
    
    printf("Yes\n");

    return 0;
}

### FIXED CODE ###

#coding: utf-8
import math
import heapq
import bisect
import numpy as np
from collections import Counter
#from scipy.misc import comb

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

s = ['.'*(W+2)]
for i in range(H):
    row = input()
    s.append('.' + row + '.')
s.append('.'*(W+2))

flg = 1
for i in range(1,H+1):
    for j in range(1,W+1):
        if s[i][j] == "#":
            if s[i-1][j] == "." and s[i+1][j] == "." and s[i][j-1] == "." and s[i][j+1] == ".":
                flg = 0

if flg:
    print("Yes")
else:
    print("No")
import sys
x = input()
x1 = list(x)
h = len(x)
x = int(x)

if x>2000:
  print('1')
  sys.exit()

a1 = int(x1[h-1])
a2 = int(x1[h-2])

if a1<=5:
  c1 = 1
else:
  c1 = 2

c2 = a2*2
if int(x1[0])+int(x1[1]) < c1+c2:
  print('0')
else:
  print('1')

### FIXED CODE ###

import sys
x = input()
x1 = list(x)
h = len(x)
x = int(x)

if x>2000:
  print('1')
  sys.exit()

a1 = int(x1[h-1])
a2 = int(x1[h-2])

if 0 < a1 <= 5:
  c1 = 1
elif a1 == 0:
  c1 = 0
else:
  c1 = 2

c2 = a2*2
#print(x1[0],x1[1])
if h>3:
  if 10*int(x1[0])+int(x1[1]) < c1+c2:
    print('0')
  else:
    print('1')
else:
  if int(x1[0]) < c1+c2:
    print('0')
  else:
    print('1')
N = int(input())
A = list(map(int,input().split()))


def gcd(a,b):
    if b == 0:
        return a
    return gcd(b,a%b)
def lcm(a,b):
    return a*b/gcd(a,b)

L = 1

D = 1000000007
for i in range(N):
    L = lcm(L,A[i]) 
L = L % D

res = 0
for i in range(N):
    res = (res + L * pow(A[i],D-2,D)) % D  
print(int(res))





### FIXED CODE ###

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


def gcd(a,b):
    if b == 0:
        return a
    return gcd(b,a%b)
def lcm(a,b):
    return a*b//gcd(a,b)

L = 1

D = 1000000007
for i in range(N):
    L = lcm(L,A[i]) 
L = L % D

res = 0
for i in range(N):
    res = (res + L * pow(A[i],D-2,D)) % D  
print(int(res))
tmp = input().split()
   ans = tmp[0] * tmp[1]
  print(ans)
 

### FIXED CODE ###

tmp = input().split()
ans = int(tmp[0]) * int(tmp[1])
print(ans)
import sys
sys.setrecursionlimit(10**6)
from math import floor,ceil,sqrt,factorial,log
from heapq import heappop, heappush, heappushpop
from collections import Counter,defaultdict,deque
from itertools import accumulate,permutations,combinations,product,combinations_with_replacement
from bisect import bisect_left,bisect_right
from copy import deepcopy
from operator import itemgetter
from fractions import gcd
mod = 10 ** 9 + 7
 
#整数input
def ii(): return int(sys.stdin.readline().rstrip()) #int(input())
def mii(): return map(int,sys.stdin.readline().rstrip().split())
def limii(): return list(mii()) #list(map(int,input().split()))
def lin(n:int): return [ii() for _ in range(n)]
def llint(n: int): return [limii() for _ in range(n)]
#文字列input
def ss(): return sys.stdin.readline().rstrip() #input()
def mss(): return sys.stdin.readline().rstrip()
def limss(): return list(mss()) #list(input().split())
def lst(n:int): return [ss() for _ in range(n)]
def llstr(n: int): return [limss() for _ in range(n)]

#本当に貪欲法か？ DP法では？？
#本当に貪欲法か？ DP法では？？
#本当に貪欲法か？ DP法では？？

n=ii()
arr=mii()

cnt=0
for i in range(n):
    if arr[i]%2==1:
        cnt+=1

if cnt%2==1:
    print("NO")
else:
    print("YES")



### FIXED CODE ###

import sys
sys.setrecursionlimit(10**6)
from math import floor,ceil,sqrt,factorial,log
from heapq import heappop, heappush, heappushpop
from collections import Counter,defaultdict,deque
from itertools import accumulate,permutations,combinations,product,combinations_with_replacement
from bisect import bisect_left,bisect_right
from copy import deepcopy
from operator import itemgetter
from fractions import gcd
mod = 10 ** 9 + 7
 
#整数input
def ii(): return int(sys.stdin.readline().rstrip()) #int(input())
def mii(): return map(int,sys.stdin.readline().rstrip().split())
def limii(): return list(mii()) #list(map(int,input().split()))
def lin(n:int): return [ii() for _ in range(n)]
def llint(n: int): return [limii() for _ in range(n)]
#文字列input
def ss(): return sys.stdin.readline().rstrip() #input()
def mss(): return sys.stdin.readline().rstrip()
def limss(): return list(mss()) #list(input().split())
def lst(n:int): return [ss() for _ in range(n)]
def llstr(n: int): return [limss() for _ in range(n)]

#本当に貪欲法か？ DP法では？？
#本当に貪欲法か？ DP法では？？
#本当に貪欲法か？ DP法では？？

n=ii()
arr=limii()

cnt=0
for i in range(n):
    if arr[i]%2==1:
        cnt+=1

if cnt%2==1:
    print("NO")
else:
    print("YES")
N,K = map(int,input().split(' '))
MOD = 10**9 + 7

n = N-K+1
print(n)
for i in range(2,K+1):
	n = (n * (N-K+2-i) * (K-i+1) // (i * (i-1)))
	print(n % MOD)


### FIXED CODE ###


s=input()
dic={}
for i in range(4):
    if s[i] in dic.keys():
        dic[s[i]]+=1
    else:
        dic[s[i]]=1
ans=0
for i in range(4):
    if dic[s[i]]!=2:
        ans=1
if ans==0:
    print("Yes")
else:
    print("No")
n = int(input())
a = list(map(int, input().split()))
for i in range(n):
    if a[i]%2 == 0:
        if a[i]%3 == 0 or a[i]%5 == 0:
            ans = 'APPROVED'
        else:
            ans = 'DENIED'
            break
print(ans)

### FIXED CODE ###

n = int(input())
a = list(map(int, input().split()))
for i in a:
    if i%2 == 0:
        if i%3 == 0 or i%5 == 0:
            continue
        else:
            print('DENIED')
            exit()
print('APPROVED')
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
using pii = pair<int, int>;
#define endl '\n'

int main(){
	ios_base::sync_with_stdio(false);
	int n;
	cin >> n;

	int a = n / 200 - 1;
	a = 9 - a;

	cout << a << endl;
	return 0;
}

### FIXED CODE ###

n = int(input())
a = 10 - n // 200
print(a)
N,K = map(int, input().split())
l = [int(i) for i in input().split()]
ls = l.sort(reverse = True)
toral = 0
for i in range(K):
  total += ls[i]
print(total)

### FIXED CODE ###

N,K = map(int, input().split())
l = list(map(int,input().split()))
l.sort()
lrev = l[::-1]
print(sum(lrev[:K]))
a, b, c, d = map(int, input().split())
e = (c-a)*60
print(e-d)

### FIXED CODE ###

H1, M1, H2, M2, K = map(int, input().split())
hour1 = (H1 * 60) + M1
hour2 = (H2 * 60) + M2
hour = hour2 - hour1
minute = hour - K
print(minute)
import itertools
import math

n = int(input())
p = list(map(str,input().split()))
q = list(map(str,input().split()))
lst = []
for i in range(n):
    lst.append(str(i+1))
lst_perm = list(itertools.permutations(lst))
for i in range(math.factorial(n)):
    if ("".join(p))==("".join(lst_perm[i])):
        a = i
    elif ("".join(q))==("".join(lst_perm[i])):
        b = i
print(abs(a-b))

### FIXED CODE ###

import itertools
import math

n = int(input())
p = list(map(str,input().split()))
q = list(map(str,input().split()))
lst = []
for i in range(n):
    lst.append(str(i+1))
lst_perm = list(itertools.permutations(lst))
a=0
b=0
for i in range(math.factorial(n)):
    if ("".join(p))==("".join(q)):
        if ("".join(p))==("".join(lst_perm[i])):
            a=i
            b=i
    else:
        if ("".join(p))==("".join(lst_perm[i])):
            a = i
        elif ("".join(q))==("".join(lst_perm[i])):
            b = i
print(abs(a-b))
a,b,k = map(int,input().split())
 
for a,b in range(k):
	if a >=  1:
        a -= 1
  
	elif a < 1 and b >= 1:
        b -= 1
	else:
        break
        
print (a,b,end=" ")

### FIXED CODE ###

s = input().split()
print(s[1] + s[0])
s = input()
 
s = s[::-1]
 
dp = [0 for _ in range(13)]
 
if s[0] == '?':
    for j in range(10):
        dp[j] = 1
else:
    dp[int(s[0])] = 1
m = 1
MOD = 10**9 +7
 
for i in range(1,len(s)):
    m = m*10 % 13
    ans = [0 for _ in range(13)]
 
    if s[i] == '?':
        for k in range(13):
            for j in range(10):
                ans[(j*m+k)%13] += dp[k]
                ans[k] % MOD
    else:
        for k in range(13):
            ans[(int(s[i])*m + k) %13] += dp[k]
            ans[k] % MOD
    for k in range(13):
        dp[k] = ans[k]
        ans[k] = ans[k] % MOD

print(ans[5] % MOD )

### FIXED CODE ###

s = input()
 
s = s[::-1]
 
dp = [[0 for _ in range(13)] for __ in range(len(s)+1)]
 
l = len(s)
 
 
if s[0] == '?':
    for j in range(10):
        dp[0][j] = 1
else:
    dp[0][int(s[0])] = 1
 
m = 1
MOD = 10**9 +7
 
for i in range(1,len(s)):
    m = m*10 % 13
 
    if s[i] == '?':
        for k in range(13):
            for j in range(10):
                dp[i][(j*m+k)%13] += dp[i-1][k]
                dp[i][k] %= MOD
    else:
        for k in range(13):
            dp[i][(int(s[i])*m + k) %13] += dp[i-1][k]
            dp[i][k] %= MOD
 
print(dp[len(s)-1][5] % MOD )
a=int(input())
b=int(input())
if a%500 < b:
  print('Yes')
else('No')

### FIXED CODE ###

a=int(input())
b=int(input())
if a%500 <= b:
  print('Yes')
else: print('No')
A= int,input()
B= int,input()
# A,Bの入力

print(6-A-B)

### FIXED CODE ###

a = int(input())
b = int(input())

print(6-a-b)
import math

money=N
if money%1000==0:
  print(0)
else:
  money=(math.ceil(money/1000))*1000-money
  print(money)

### FIXED CODE ###

n = int(input())

if n % 1000 == 0:
  print(0)
else:
  print(1000-(n%1000))
n = int(input())
li = list(map(int, input().split()))

# print(li)
li.sort()
# print(li)

one = [1 for _ in range(n)]

if li[0] == li[1]:
    one[0] = 0

check = [i for i in range(1, n)]

for i in range(n-1):
    a = set([_ for _ in range(i+1, n)]) & set(check)
    for j in a:
        if li[j] % li[i] == 0:
            one[j] = 0
    del check[0]
print(sum(one))


### FIXED CODE ###

n = int(input())
*A, = map(int, input().split())
maxA = max(A)
# C[a] = A内のaの個数
C = {a: 0 for a in A}
for a in A:
    C[a] += 1
# D[a]=1: Aにaより小さいaの約数が存在する
D = {a: 0 for a in A}
for a in A:
    if C[a] > 0:
        t = 2
        while a * t <= maxA:
            D[a * t] = 1
            t += 1
ans = 0
for a in A:
    if C[a] == 1 and D[a] == 0:
        ans += 1
print(ans)
l = input()
m = input()
z = l.split(' ')
M = int(z[1])
N = int(z[0])
C = (1/(4*M))*N
F = m.split(' ')
X = []
for item in F:
	votes = int(item)
	X.append(votes)
X.sort(reverse = True)
for i in range(M):
	if X[i]<C:
		print("No")
		return
print("Yes")


### FIXED CODE ###

l = input()
m = input()
z = l.split(' ')
M = int(z[1])
N = int(z[0])
F = m.split(' ')
X = []
 
for item in F:
  votes = int(item)
  X.append(votes)

S = sum(X)
C = (S/(4*M))
X.sort(reverse=True)
if X[M-1]<C:
  print("No")
else:
  print("Yes")
def gcd(a,b):
	if b == 0:
     	return a
	else:
     	return gcd(b,a%b)

n = int(raw_input())
sm = 0;
for i in range(1,n+1):
  for j in range(1,n+1):
    for k in range(1,n+1):
      sm += gcd(gcd(i,j),k)
      
print(sm)


### FIXED CODE ###

def gcd(a,b):
	if b == 0:
		return a
	else:
		return gcd(b,a%b)

n = int(raw_input())
sm = 0;
for i in range(1,n+1):
  for j in range(1,n+1):
    for k in range(1,n+1):
      sm += gcd(gcd(i,j),k)
      
print(sm)
a=0
n = int(input())
b = list(map(int, input().split()))

for i in range(n-2):
  if b[i] >= b[i+1]:
    a = a + b[i+1]
  if b[i+1] > b[i]:
    a = a + b[i]
  a = a + b[n-1] + b[0]
print(a)

### FIXED CODE ###

n = int(input())
b = list(map(int, input().split()))
a_sum = 0

a_sum += b[0]

for i in range(n-2):
    if b[i] >= b[i+1]:
        a_sum += b[i+1]
    if b[i+1] > b[i]:
        a_sum += b[i]

a_sum += b[n-2]
print(a_sum)
A,B,C = map(int,input().split())
maxi = max(A,B,C)
mini = min(A,B,C)
mid = sum([A,B,C]) - (maxi+mini)
i,j,k,l = 0,0,0,0
if mini%2 != mid%2:
    #midだけ偶奇が違うとき
    if maxi%2 == mini%2 and maxi%2 != mid%2:
        if mid - maxi != 1:
            ans += (maxi+1-mid)//2
            mid = maxi + 1
    #miniだけ偶奇が違うとき
    if maxi%2 != mini%2 and maxi%2 == mid%2:
        if mini - maxi != 1:
            ans += (maxi+1-mini)//2
            mini = maxi + 1
while maxi - mini > 1:
    mini += 2
    k += 1
while maxi - mid > 1:
    mid += 2
    l += 1
if maxi == mini and maxi == mid:
    print(i+j+k+l)
else:
    print(i+j+k+l+1)

### FIXED CODE ###

A,B,C = map(int,input().split())
maxi = max(A,B,C)
mini = min(A,B,C)
mid = sum([A,B,C]) - (maxi+mini)
i,j,k,l = 0,0,0,0
if mini%2 != mid%2:
    #midだけ偶奇が違うとき
    if maxi%2 == mini%2 and maxi%2 != mid%2:
        if mid - maxi != 1:
            i = (maxi+1-mid)//2
            mid = maxi + 1
    #miniだけ偶奇が違うとき
    if maxi%2 != mini%2 and maxi%2 == mid%2:
        if mini - maxi != 1:
            j = (maxi+1-mini)//2
            mini = maxi + 1
while maxi - mini > 1:
    mini += 2
    k += 1
while maxi - mid > 1:
    mid += 2
    l += 1
if maxi == mini and maxi == mid:
    print(i+j+k+l)
else:
    print(i+j+k+l+1)
n=int(input())
a=[]
t=[]
t.append(1)
for i in range(n):
  a.append(input())

x=a[0]
while True:
  if x==2:
    print(len(t))
    break
  elif x in t:
    print(-1)
    break
  else:
    t.append(x)
    y=x
    x=a[y-1]


### FIXED CODE ###

n=int(input())
a=[int(input()) for i in range(n)]
ans=1
res=1
for i in range(n):
  if a[res-1]==2:
    print(ans)
    exit()
  else:
    ans+=1
    res=a[res-1]

print(-1)
# _*_ coding:utf-8 _*_
#  Atcoder_EducationDP_ContestX-1_other2
#  TODO https://atcoder.jp/contests/dp/tasks/dp_a
#  参考文献 https://qiita.com/drken/items/dc53c683d6de8aeacf5a#%E8%A7%A3%E6%B3%95
#  C++ バージョンを上から書き下す
#  TODO メモ化再帰
#  https://qiita.com/drken/items/dc53c683d6de8aeacf5a#%E5%88%A5%E8%A7%A3-2-%E3%83%A1%E3%83%A2%E5%8C%96%E5%86%8D%E5%B8%B0
import sys

# 初期化
# 足場の数となる要素数は足場の値の最大値であるMAX
blockMAXElement = 100010
blockElementRange = range(0,blockMAXElement,+1)
# DPテーブルの中身は今回は最小値を求めるため最大値を利用

dp = [sys.maxsize] * blockMAXElement
# コスト
# 参考文献のC++では配列は宣言時に初期化されるがpythonはそれがないのでまずはあえて0で初期化
h = [0] * blockMAXElement
# 入力データ諸々
N = int(input().strip())
inputh = list(map(int,input().strip().split(' ')))
# h配列を入力データから取り出した物に置き換える
for i  in range(0,len(inputh),+1):
	h[i] = inputh[i]

# 初期の条件 0歩の時だけはコストがないので、0にセット
dp[0] = 0

def rec(position):
	# まずは最大値にセット(上でもやっているのだが)
	answer = sys.maxsize
	if position == 0:
		answer = 0
	else:
		# 貰うDPを想定して組む
		# 一つ手前の足場から来た場合
		nowCost = rec(position-1)+abs(h[position]-h[position-1])
		if nowCost < answer:
			answer=nowCost
		# 二つ手前から来た場合→position = 1では-1を参照するので不具合
		if 2 <= position :
			nowCost = rec(position-2)+abs(h[position]-h[position-2])
			if nowCost < answer:
				answer=nowCost
	# この位置についての最小値はdp配列にメモする
	dp[position] = answer
	return answer

answer = rec(N-1)
print("{}".format(answer))

### FIXED CODE ###

# _*_ coding:utf-8 _*_
#  Atcoder_EducationDP_ContestX-1
#  TODO https://atcoder.jp/contests/dp/tasks/dp_a
#  参考文献 https://qiita.com/drken/items/dc53c683d6de8aeacf5a#%E8%A7%A3%E6%B3%95
#  C++ バージョンを上から書き下す
#  貰う型DP
import sys

# 初期化
# 足場の数となる要素数は足場の値の最大値であるMAX
blockMAXElement = 100010
blockElementRange = range(0,blockMAXElement,+1)
# DPテーブルの中身は今回は最小値を求めるため最大値を利用
dp = list()
for _ in blockElementRange:
	dp.append(sys.maxsize)

N = int(input().strip())
blockRange = range(0,N,+1)
h = list(map(int,input().strip().split(' ')))

# 初期の条件 0歩の時は値が与えられていないのでDPは0にセット
dp[0] = 0
for position in range(1,N,+1):
#   一つ手前の足場までで最適な値のはず、のコスト
	previousMinCost = dp[position-1]
#   一つ手前から来た場合の足場positionでのコスト計
#   pM = previousMin
	pMNowCost = dp[position-1]+abs(h[position]-h[position-1])
#   今の足場で設定されている足場へのコストより小さくなるならそれを改めて入れる
	if pMNowCost <= dp[position]:
		dp[position] = pMNowCost
#   これは二つ手前から来たケースを考えるのでpositon = 1の場合を除いて考える
#   それ以降は一個手前からと同じ
	if 1 < position:
		previous2MinCost = dp[position-2]
		pM2NowCost = dp[position-2]+abs(h[position]-h[position-2])
		if pM2NowCost <= dp[position]:
			dp[position] = pM2NowCost

print("{}".format(dp[N-1]))
import math
abc = input()
abc = abc.split(' ')
a = int(abc[0])
b = int(abc[1])
c = int(abc[2])

if 4*a*b<(c-a-b)*(c-a-b):
    print('Yes')
else:
    print('No')



### FIXED CODE ###

array = [1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, \
2, 5, 4, 1, 4, 1, 51]

inp = input()

inp = int(inp)

print('{}'.format(array[inp-1]))
N=int(input())
print('ABC'+N)

### FIXED CODE ###

N=int(input())
print('ABC',N,sep='')
import sys
input = sys.stdin.readline
#-------------
n,k = map(int,input().split())
a = list(map(int,input().split()))
#-------------
a.sort(reverse = True)
w = 10**9 + 7
ans = 1
if k%2 == 1:#kは奇数
  for i in range(k):
    ans *= a[i]
  print(ans % w)


else:#kは偶数
  if n%2 == 0:#nは偶数
    A = n//2
    a_new = [a[2*i]*a[2*i+1] for i in range(A)]
    a_new.sort(reverse = True)
    for j in range(k//2):
      ans *= a_new[j]
    print(ans % w)
      
  else:#nは奇数
    a_plus =[]
    a_minus = []
    positive = 0
    for i in range(n):
      if a[i] > 0 :
        a_plus.append(a[i])
        positive += 1
      else:
        a_minus.append(a[i])
    a_plus.sort(reverse = True)
    a_minus.sort()
    C = positive
    D = n-C
    a_new = []
    a_new.append([a_plus[2*i]*a_plus[2*i+1] for i in range(C//2)])
    a_new.append([a_minus[2*i]*a_minus[2*i+1] for i in range(D//2)])
    a_new.sort(reverse = True)
    for j in range(k//2):
      ans *= a_new[j]
    print(ans % w)

### FIXED CODE ###

import sys
 
n, k = map(int, input().split())
a = [int(x) for x in input().split()]
mod = pow(10, 9)+7
zero = 0
plus = []
minus = []
for i in range(n):
  if a[i] == 0:
    zero += 1
  elif a[i] > 0:
    plus.append(a[i])
  else:
    minus.append(a[i])
 
P, M = len(plus), len(minus)
plus.sort(reverse=True)
minus.sort()
ans = 1
if n == k:
  for i in range(n):
    ans *= a[i]
    ans %= mod
elif P+M < k:
  ans = 0
elif P == 0:
  if zero and k%2:
    ans = 0
  else:
    if k%2:
      minus.reverse()
    for i in range(k):
      ans *= minus[i]
      ans %= mod
else:
  q = 0
  if k%2:
    ans *= plus[0]
    ans %= mod
    q = 1
  judge = []
  for i in range((len(plus)-q)//2):
    judge.append(plus[2*i+q]*plus[2*i+q+1])
  for i in range(len(minus)//2):
    judge.append(minus[2*i]*minus[2*i+1])
  judge.sort(reverse=True)
  for i in range(k//2):
    ans *= (judge[i]%mod)
    ans %= mod
 
print(ans)
t = input()
ans = t.replace(?, D)
print(ans)


### FIXED CODE ###

t = input()
ans = t.replace("?", "D")
print(ans)
import sys
    while 1:
    try:
    temp = input()
    if (temp==0):
    break
    N = temp
    a = []
    for i in range(N):
    a.append(map(int, raw_input().split())+[0])
    a.append([0 for i in range(0,temp+1)])	
    for i in range(0,temp):#行に関して
    for j in range(0,temp):#列に関して
    a[i][temp] += a[i][j]
    for k in range(0,temp+1):#列に関して
    for l in range(0,temp):#行に関して
    a[temp][k] += a[l][k]
    for m in range(0,temp+1):
    for n in range(0,temp+1):
    sys.stdout.write(str(a[m][n]).rjust(5))
    print ""
    except(RuntimeError):
    pass

### FIXED CODE ###

import sys
try:
	while 1:
		temp = input()
		if (temp==0):
			break
		N = temp
		a = []
		for i in range(N):
			a.append(map(int, raw_input().split())+[0])
		a.append([0 for i in range(0,temp+1)])
		for i in range(0,temp):
			for j in range(0,temp):
				a[i][temp] += a[i][j]
		for k in range(0,temp+1):
			for l in range(0,temp):
				a[temp][k] += a[l][k]
		for m in range(0,temp+1):
			for n in range(0,temp+1):
				sys.stdout.write(str(a[m][n]).rjust(5))
			print ""
except(RuntimeError):
	pass
N=input()
if N[-1] = 2 :
    print("hon")
elif N[-1] = 4 :
    print("hon")
elif N[-1] = 5 :
    print("hon")
elif N[-1] = 7 :
    print("hon")
elif N[-1] = 9 :
    print("hon")
elif N[-1] = 1 :
    print("pon")
elif N[-1] = 6 :
    print("pon")
elif N[-1] = 8 :
    print("pon")
else :
    print("bon")

### FIXED CODE ###

N=input()
if N[-1] == '2' :
    print("hon")
elif N[-1] == '4' :
    print("hon")
elif N[-1] == '5' :
    print("hon")
elif N[-1] == '7' :
    print("hon")
elif N[-1] == '9' :
    print("hon")
elif N[-1] == '0' :
    print("pon")
elif N[-1] == '1' :
    print("pon")
elif N[-1] == '6' :
    print("pon")
elif N[-1] == '8' :
    print("pon")
else :
    print("bon")
N = int(input())
graph = [[] for _ in range(N+1)] #木構造を入れておく
long = [0] * (N+1) #Kから任意のノードまでの距離

for i in range(N-1):
  x, y, z = map(int, input().split())
  graph[x].append([y, z])
  graph[y].append([x, z])
  
Q, K = map(int, input().split())
def dfs(n, num):
    for t in graph[n]:
        if t[0] == num:
            continue
        else:
            long[t[0]] = long[n] + t[1]
            dfs(t[0], n)
 
 
dfs(K, 0)

for i in range(Q):
  x_i, y_i = map(int, input().split())
  ans = long[x_i] + long[y_i]
  print(ans)

### FIXED CODE ###

import sys
sys.setrecursionlimit(500000)
 
N = int(input())
ABC = [list(map(int, input().split())) for i in range(N-1)]
Q, K = map(int, input().split())
D = [0] * (N+1)
L = [[] for i in range(N+1)]
for a, b, c in ABC:
    L[a].append([b, c])
    L[b].append([a, c])
 
 
def dfs(n, np):
    for nc in L[n]:
        if nc[0] == np:
            continue
        else:
            D[nc[0]] = D[n] + nc[1]
            dfs(nc[0], n)
 
 
dfs(K, 0)
for i in range(Q):
    x, y = map(int, input().split())
    print(D[x] + D[y])
N = int(input())
p = []
for i in range(N):
    _p = int(input())
    p.append(_p)
biggest = 0
j = 0
for i in range(N):
    if(p[i]>=biggest):
        j = i
        biggest=p[i]
p[j] = p[j] / 2
print(int(sum(p)))

### FIXED CODE ###

d = int(input())
if(d==25):
    print("Christmas")
elif(d==24):
    print("Christmas Eve")
elif(d==23):
    print("Christmas Eve Eve")
else:
    print("Christmas Eve Eve Eve")
import math
a, b, x = map(int,input().split())
sita = 0
c = 0
if a*a*b/2 <= x:
  c = a*a*a/2/(a*a*b-x)
  sita = math.atan(c)
else:
  c = 2*x/a/b/b
  sita = math.atan(c)
print('{:.10g}'.format(90-math.degrees(sita)))

### FIXED CODE ###

import math
a, b, x = map(int,input().split())
sita = 0
c = 0
if x == a*b*b:
  sita = math.pi/2
elif a*a*b/2 <= x:
  c = a*a*a/2/(a*a*b-x)
  sita = math.atan(c)
else:
  c = 2*x/a/b/b
  sita = math.atan(c)
print('{:.10g}'.format(90-math.degrees(sita)))
l = map(int, raw_input().split())
print((l[0] + l[1]) % 24)

### FIXED CODE ###

L = [int(i) for i in input().split(' ')]
print((L[0] + L[1]) % 24)
N,T = map(int, input().split())

ans = []

for i in range(N):
    c,t = map(int, input().split())
    if T > t[i]:
        number = c[i]
        ans.appned(number)
    

if len(ans) == 0:
    print("TLE")
else:
    print(min(ans))        
    

### FIXED CODE ###

n = int(input())
 
if n==1:
  print("Hello World")
else:
  A = int(input())
  B = int(input())
  print(A+B)
n=int(input())
s=input()
cnt=0
for i in range(1,n):
  if(s[i-1]=='A' and s[i]=='B' and s[i+1]=='C'):
    cnt+=1
print(cnt)
    

### FIXED CODE ###

n=int(input())
s=input()
cnt=0
i=1
while(i<n-1):
    if(s[i-1]=='A' and s[i]=='B' and s[i+1]=='C'):
        cnt+=1
    i+=1
        
print(cnt)
s=str(input())
ans=-4
for i in range(4):
  if s[i]='+':
    ans+=2
print(ans)


### FIXED CODE ###

s=str(input())
ans=-4
for i in range(4):
    if s[i]=='+':
        ans+=2
print(ans)
N,K=map(int,input().split())
A=list(map(int,input().split()))

for i in range(K+1):
    if A[i+K]>A[i]:
        print('Yes')
    else:
        print('No')

### FIXED CODE ###

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

for i in range(N-K):
    if A[i+K]>A[i]:
        print('Yes')
    else:
        print('No')