Harryxun/stf_run huggingface dataset:
#!/usr/bin/python
# -*- coding: utf-8 -*-

s = raw_input()
H, W = [int(x) for x in s.split()]
A = [None] * H

for i in xrange(H):
	s = raw_input()
	A[i] = [int(x) for x in s.split()]

choose = [[False]*W for i in xrange(H)]
answer = -1
answerOps = []
ops = []

def dfs(y, x, even):
	global H, W, A, answer, answerOps, ops

	if x >= W:
		x, y = 0, y+1
	if x == 0 and y == H:
		if even > answer:
			answer = even
			answerOps = ops
		return
	if even + (H-y-1)*W + (W-x) <= answer:
		return

	# print y, x, A[y][x], even
	# print A

	coin = A[y][x]
	if coin % 2 == 1:
		A[y][x] = 0
		if x+1 < W:
			# print 'right'
			A[y][x+1] += coin
			ops.append((y, x, y, x+1))
			dfs(y, x+1, even+1)
			ops = ops[:-1]
			A[y][x+1] -= coin

		if y+1 < H:
			# print 'down'
			A[y+1][x] += coin
			ops.append((y, x, y+1, x))
			dfs(y, x+1, even+1)
			ops = ops[:-1]
			A[y+1][x] -= coin
		A[y][x] = coin

		dfs(y, x+1, even)
	else:
		dfs(y, x+1, even+1)


dfs(0, 0, 0)
# print answer
# print '----'
print len(answerOps)
for t in answerOps:
	print '%d %d %d %d' % tuple([x+1 for x in t])


### FIXED CODE ###

#!/usr/bin/python
# -*- coding: utf-8 -*-

s = raw_input()
H, W = [int(x) for x in s.split()]
# H, W = 500,500
A = [None] * H

for i in xrange(H):
	s = raw_input()
	A[i] = [int(x) for x in s.split()]
	# A[i] = [j for j in xrange(W)]

choose = [[False]*W for i in xrange(H)]
answer = -1
answerOps = []
ops = []

def dfs(y, x, even):
	global H, W, A, answer, answerOps, ops

	if x >= W:
		x, y = 0, y+1
	if x == 0 and y == H:
		if even > answer:
			answer = even
			answerOps = ops
		return
	if even + (H-y-1)*W + (W-x) <= answer:
		return

	# print y, x, A[y][x], even
	# print A

	coin = A[y][x]
	if coin % 2 == 1:
		A[y][x] = 0
		if x+1 < W:
			A[y][x+1] += coin
			ops.append((y, x, y, x+1))
			dfs(y, x+1, even+1)
			ops = ops[:-1]
			A[y][x+1] -= coin

		if y+1 < H:
			A[y+1][x] += coin
			ops.append((y, x, y+1, x))
			dfs(y, x+1, even+1)
			ops = ops[:-1]
			A[y+1][x] -= coin
		A[y][x] = coin

		dfs(y, x+1, even)
	else:
		dfs(y, x+1, even+1)


# dfs(0, 0, 0)


def check(y, x):
	if x+1 < W:
		if A[y][x+1] % 2 == 1:
			return 'right'
	if y+1 < H:
		if A[y+1][x] % 2 == 1:
			return 'down'
	if x+1 < W:
		return 'right'
	if y+1 < H:
		return 'down'

for i in xrange(H):
	for j in range(W):
		if A[i][j] % 2 == 1:
			ret = check(i, j)
			if ret == 'right':
				A[i][j+1] += A[i][j]
				answerOps.append((i, j, i, j+1))
			elif ret == 'down':
				A[i+1][j] += A[i][j]
				answerOps.append((i, j, i+1, j))

print len(answerOps)
for t in answerOps:
	print '%d %d %d %d' % tuple([x+1 for x in t])
N, T = list(map(int, input().split()))

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

if N == 1:
    print(T)
    exit(T)

ans = 0
buff = 0
for i in range(N):
    if T > t[i]:
        buff = t[i]
        if i == N-1:
            ans += buff
    elif T <= t[i]:
        if buff + T > t[i]:
            ans += t[i]
        elif buff + T < t[i]:
            ans += T + buff
        elif buff == t[i]:
            pass
        buff = 0

ans += T
print(ans)




### FIXED CODE ###

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

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

if N == 1:
    print(T)
    exit()

# t.pop(0)
ans = 0
buff = 0
for i in range(N):
    if i != 0:
        if t[i] - t[i-1] < T:
            ans += t[i] - t[i-1]
        else:
            ans += T

ans += T
print(ans)
N = int(input())
S = str(input())

count = S.count('E')

if S[0] == 'E':
	coun-=1

countmin = count

for i in range (1, N):
	if S[i] == 'E':
		count-=1
	if S[i-1] == 'W':
		count+=1
	if count < countmin:
		countmin = count

print(countmin) 

### FIXED CODE ###

N = int(input())
S = str(input())

count = S.count('E')

if S[0] == 'E':
	count-=1

countmin = count

for i in range (1, N):
	if S[i] == 'E':
		count-=1
	if S[i-1] == 'W':
		count+=1
	if count < countmin:
		countmin = count

print(countmin)
import sys;input=sys.stdin.readline
from bisect import*

n,q=map(int,input().split())
event=[]
stopped={-1}

def doevent(l):
    global stopped
    if l[1]==1:
        if stopped=={-1}:
            stopped=set()
        stopped.add(l[2])
    elif l[1]==-1:
        stopped.remove(l[2])
        if len(stopped)==0:
            stopped={-1}
            
for i in range(n):
    s,t,x=map(int,input().split())
    event.append((s-x,1,x))
    event.append((t-x,-1,x))
event.append((-float("inf"),"x","x"))
event.append((float("inf"),"x","x"))
event.sort(key=lambda x:x[0])
eventtime=[i[0]for i in event]
#print(eventtime)
query=[bisect_right(eventtime,int(input()))-1 for i in range(q)]
#print(query)
c=0
#print(event)
for i in range(2*n):
    doevent(event[i])
    while i==query[c]:
        print(min(stopped))
        c+=1
        if c==q:
            break
for i in range(query.count(2*n)):
    print(-1)


### FIXED CODE ###

a,p=map(int,input().split())
print((a*3+p)//2)
n = int(input())
xy = [list(map(int,input().split())) for _ in range(n)]

import math
if n == 2:
  (x1, y1), (x2, y2) = xy
  print(math.sqrt((x2-x1)**2+(y2-y1)**2)/2)

rs=[]
import itertools
for com in itertools.combinations(xy, 3):
  (x1, y1), (x2, y2),(x3,y3)= com
  a=x1*(y2-y3)-y1*(x2-x3)+x2*y3-x3*y2
  b=(x1**2+y1**2)*(y3-y2)+(x2**2+y2**2)*(y1-y3)+(x3**2+y3**2)*(y2-y1)
  c=(x1**2+y1**2)*(x2-x3)+(x2**2+y2**2)*(x3-x1)+(x3**2+y3**2)*(x1-x2)
  d = (x1 ** 2 + y1 ** 2) * (x3 * y2 - x2 * y3) + (x2 ** 2 + y2 ** 2) * (x1 * y3 - x3 * y1) + (x3 ** 2 + y3 ** 2) * (x2 * y1 - x1 * y2)
  if a == 0:
    continue
  x=-b/(2*a)
  y=-c/(2*a)
  r = math.sqrt((b ** 2 + c ** 2 - 4 * a * d) / (4 * a ** 2))
  
  rs.append(r)

print(max(rs))


### FIXED CODE ###

import sys
input = sys.stdin.readline
LOCAL = len(sys.argv) > 1 and sys.argv[1] == 'LOCAL'


def dprint(*args):
  if LOCAL:
    print(*args)


n = int(input())
xy = [list(map(int, input().split())) for _ in range(n)]


import math
import itertools


def distanse(x1, y1, x2, y2):
  return math.sqrt((x1 - x2)**2 + (y1 - y2)**2)


def isValid(ox, oy, r):
  # global ox, oy, r
  global xy
  for x, y in xy:
    if distanse(x, y, ox, oy) - r > 1e-6:
      return False
  return True


rs = []
for (x1, y1), (x2, y2) in itertools.combinations(xy, r=2):
  dprint(x1, y1, x2, y2)
  r = distanse(x1, y1, x2, y2) / 2
  ox = (x1 + x2) / 2
  oy = (y1 + y2) / 2
  dprint(ox, oy, r)
  if isValid(ox, oy, r):
    rs.append(r)
# for c1, c2 in itertools.combinations(xy, r=2):
#   dprint(c1, c2)
#   r = distanse(c1, c2)
#   o=(c1+c2)/2

for (x1, y1), (x2, y2), (x3, y3) in itertools.combinations(xy, r=3):
  # http://www.ambrsoft.com/TrigoCalc/Circle3D.htm
  a = x1 * (y2 - y3) - y1 * (x2 - x3) + x2 * y3 - x3 * y2
  b = (x1**2 + y1**2) * (y3 - y2) + (x2**2 + y2**2) * \
      (y1 - y3) + (x3**2 + y3**2) * (y2 - y1)
  c = (x1**2 + y1**2) * (x2 - x3) + (x2**2 + y2**2) * \
      (x3 - x1) + (x3**2 + y3**2) * (x1 - x2)
  d = (x1 ** 2 + y1 ** 2) * (x3 * y2 - x2 * y3) + (x2 ** 2 + y2 ** 2) * \
      (x1 * y3 - x3 * y1) + (x3 ** 2 + y3 ** 2) * (x2 * y1 - x1 * y2)
  if a == 0:
    continue
  ox = -b / (2 * a)
  oy = -c / (2 * a)
  r = math.sqrt((b ** 2 + c ** 2 - 4 * a * d) / (4 * a ** 2))
  if isValid(ox, oy, r):
    rs.append(r)

dprint(rs)
print('{:.18f}'.format(min(rs)))
N,K=map(int,input().split())
u1, u2=divmod(N,K)
ans=u1**3

A=[u1]*K
for i in range(u2):
    A[i+1]+=1
if K%2==0:
    ans+=A[K//2+1]**3
print(ans)

### FIXED CODE ###

N,K=map(int,input().split())
u1=N//K
u2=N%K
ans=u1**3

A=[u1]*K
for i in range(u2):
    A[i+1]+=1
if K%2==0:
    ans+=A[K//2]**3
print(ans)
import numpy as np

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

cost = np.full(N,10**9)
cost[0] = 0
for i in range(1 , N):
    
    size =  min(i,K)
    cost[i] = (np.abs(a[i] - a[i-size:i]) + cost[i-size:i])

print(int(cost[-1]))

### FIXED CODE ###

import numpy as np

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

cost = np.full(N,10**9)
cost[0] = 0
for i in range(1 , N):
    
    size =  min(i,K)
    cost[i] = (np.abs(a[i] - a[i-size:i]) + cost[i-size:i]).min()

print(int(cost[-1]))
n=int(input())

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

a.sort()

if a[0] == a[1]:
    ans = 0
else:
    ans = 1

for i in range(1,n):
    flag = True
    for j in range(i):
        if a[i] % a[j] == 0:
            flag = False
            break
        if int(a[i]**0.5)+1 < a[j]:  
            break
    if i == n-1:
        if flag and a[i] != a[i-1]:
            ans += 1
    else:
        if flag and a[i] != a[i-1] and a[i] != a[i+1]:
            ans += 1
print(ans)
        

### FIXED CODE ###

n = int(input())
a = sorted(list(map(int, input().split())))
if n == 1:
    print(1)
    exit()  
check_list = [0] * (10**6 + 2)
ans = 0
for i in range(n):
    tmp = a[i]
    while tmp <= a[-1]:
        check_list[tmp] += 1
        tmp += a[i]
for aa in a:
    if check_list[aa] == 1:
        ans += 1
print(ans)
N = int(input())
H_list = input().split()
A_list = []
H_list.reverse()
k = 0
for i in range(N-1):
    if H_list[i] <= H_list[i + 1]:
        k += 1
    else:
        A_list.append(k)
        k = 0 
print(max(A_list))

### FIXED CODE ###

N = int(input())
H_list = list(map(int, input().split()))
A_list = []
H_list.reverse()
k = 0
if N == 1:
    print(0)
else:
    for i in range(N-1):
        if H_list[i] <= H_list[i + 1]:
            k += 1
            A_list.append(k)
        else:
            k = 0
            A_list.append(k)
    if len(A_list) == 0:
        print(k)
    else:
        print(max(A_list))
n=int(input())-1;print(n*(n+1)//2)

### FIXED CODE ###

#python3

def main():
    s = input()
    t = input()
    cnt = 0
    for i,j in zip(s,t):
        if i == j:
            cnt += 1
    print(cnt)
main()
S = input()
K = input()
s = len(str(S))
i=0

while i < s-1:
  if S[i] == '1':
    i = i + 1
  else:
    break
if K > i:
  print(S[k])
else:
  print(1)

### FIXED CODE ###

S = input()
K = int(input())
s = len(str(S))
i=0

while i < s-1:
  if S[i] == '1':
    i = i + 1
  else:
    break

if K > i:
  print(S[i])
else:
  print(1)
# 重複順列　19C10
from itertools import combinations_with_replacement as cw

n,m,q = map(int, input().split())
a_candidates = cw([i+1 for i in range(m)],m)
fs = [list(map(int, input().split())) for i in range(q)]

def calc(fs,As):
    cnt = 0
    for a,b,c,d in fs:
        a -= 1
        b -= 1
        if As[b]-As[a] == c: cnt += d
    return cnt

ans = 0
for As in list(a_candidates):
    ans = max(ans, calc(fs,As))

print(ans)

### FIXED CODE ###

# 重複順列　19C10
from itertools import combinations_with_replacement as cw

n,m,q = map(int, input().split())
a_candidates = cw([i+1 for i in range(m)],n)
fs = [list(map(int, input().split())) for i in range(q)]

def calc(fs,As):
    cnt = 0
    for a,b,c,d in fs:
        a -= 1
        b -= 1
        if As[b]-As[a] == c: cnt += d
    return cnt

ans = 0
for As in list(a_candidates):
    ans = max(ans, calc(fs,As))

print(ans)
n=int(input())
l={}
ans=[]
for i in range(n):
    s=input()
    if s in l:
        l[s]+=1
    else:
        l.setdefault(s,1)
max_l=max(l.values)

for i in l.keys():
  if l[i]==max_l:
    ans.append(i)
    
ans.sort()
 
for j in ans:
  print(j)

### FIXED CODE ###

n=int(input())
l={}
ans=[]
for i in range(n):
    s=input()
    if s in l:
        l[s]+=1
    else:
        l.setdefault(s,1)
max_l=max(l.values())

for i in l.keys():
  if l[i]==max_l:
    ans.append(i)
    
ans.sort()
 
for j in ans:
  print(j)
#文字列の入力
S = input()

#listを一文字ずつのlistに
list_S = list(S)

AorB = S_list[0]
counter = 0
for i in range(len(S_list)):
  if(AorB == S_list[i]):
    counter =+ 1

if(counter == len(S_list)):
  print("No")
else:
  print("Yes")

### FIXED CODE ###

#文字列の入力
S = input()
 
#listを一文字ずつのlistに
S_list = list(S)
 
AorB = S_list[0]
counter = 0
for i in range(len(S_list)):
  if(AorB == S_list[i]):
    counter = counter + 1
 
if(counter == len(S_list)):
  print("No")
else:
  print("Yes")
a,b,c,d = input().split()
if int(d) < int(a):
    print(int(d))
elif int(d) < int(a) + int(b):
    print(int(a) + (int(d) - int(a))* 0)
else:
    res = int(a) - (int(d)-(int(a)+ int(b)))
    print(res)
~                

### FIXED CODE ###

a,b,c,d = input().split()
if int(d) < int(a):
    print(int(d))
elif int(d) < int(a) + int(b):
    print(int(a) + (int(d) - int(a))* 0)
else:
    res = int(a) - (int(d)-(int(a)+ int(b)))
    print(res)
import collections
import math

n = int(input())
li = list(map(int, input().split()))
counter = collections.Counter(li)


def combinations_count(n, r):
    return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))

sum_count = sum([combinations_count(n, 2) for n in counter.values()])

for k in range(n):
    print(sum_count - counter[li[k]] + 1)

### FIXED CODE ###

import collections

n = int(input())
li = list(map(int, input().split()))
counter = collections.Counter(li)

sum_count = sum([n*(n-1)//2 for n in counter.values()])

for k in range(n):
    print(sum_count - counter[li[k]] + 1)
x, y = map(int, input().split())

if yx% y == 0:
    print(-1)
else:
    print(x)


### FIXED CODE ###

x, y = map(int, input().split())

if x% y == 0:
    print(-1)
else:
    print(x)
N=int(input())
E=[[] for _ in range(N)]
for i in range(N-1):
  a,b = map(int, input().split())
  E[a-1].append((b-1,i))
ans=[[] for _ in range(N-1)]
def sub(p, n):
  m=1
  for b,i in E[p]:
    if m == n: m+=1
    ans[i]=m
    sub(b,m)
    m+=1
sub(0,0)
print(max(ans))
for a in ans:
  print(a)

### FIXED CODE ###

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

N=int(input())
E=[[] for _ in range(N)]
for i in range(N-1):
  a,b = map(int, input().split())
  E[a-1].append((b-1,i))
ans=[[] for _ in range(N-1)]
def sub(p, n):
  m=1
  for b,i in E[p]:
    if m == n: m+=1
    ans[i]=m
    sub(b,m)
    m+=1
sub(0,0)
print(max(ans))
for a in ans:
  print(a)
from collections import deque
from bisect import bisect_right
import sys
sys.setrecursionlimit(10**7)
n=int(input())
a=list(map(int,input().split()))
edge=[[] for _ in range(n)]
for _ in range(n-1):
    u,v=map(int,input().split())
    u-=1
    v-=1
    edge[u].append(v)
    edge[v].append(u)
stack=deque([])
lis=[]
ans=[0 for _ in range(n)]
visited=[True]*n
#print(edge)
def dfs(s):
    visited[s]=False
    if len(lis)==0 or lis[-1]<a[s]:
        lis.append(a[s])
        stack.append((len(lis)-1,-1))
    else:
        #print(lis)
        idx=bisect_right(lis,a[s])
        #print(idx)
        stack.append((idx,lis[idx]))
        lis[idx]=a[s]
    ans[s]=len(lis)
    for x in edge[s]:
        if visited[x]:
            dfs(x)
    idx,val=stack.pop()
    if val==-1:
        del lis[-1]
    else:
        lis[idx]=val
dfs(0)
for i in range(n):
    print(ans[i])

### FIXED CODE ###

from collections import deque
from bisect import bisect_left
import sys
sys.setrecursionlimit(10**7)
n=int(input())
a=list(map(int,input().split()))
edge=[[] for _ in range(n)]
for _ in range(n-1):
    u,v=map(int,input().split())
    u-=1
    v-=1
    edge[u].append(v)
    edge[v].append(u)
stack=deque([])
inf=10**18
lis=[inf]*(n+1)
ans=[0 for _ in range(n)]
visited=[True]*n
#print(edge)
def dfs(s):
    visited[s]=False
    idx=bisect_left(lis,a[s])
    stack.append((idx,lis[idx]))
    lis[idx]=a[s]
    ans[s]=bisect_left(lis,inf)
    for x in edge[s]:
        if visited[x]:
            dfs(x)
    idx,val=stack.pop()
    lis[idx]=val
dfs(0)
#print(lis)
for i in range(n):
    print(ans[i])
A,B = map(int,input())
sum = A+B

if sum >= 24:
    print(sum-24)
else:
    print(sum)

### FIXED CODE ###

A,B = map(int,input().split())
sum = A+B

if sum >= 24:
    print(sum-24)
else:
    print(sum)
import math
import bisect
import heapq
from collections import deque

n = int(input())

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

d = [math.inf] * n
d[0] = 0
d[1] = abs(h[0] - h[1])

for i in range(2,n):
    d[i] = min(d[i-1] + abs(h[i-1]-h[i]), d[i-2] + abs(h[i-2]-h[i]))

print(d[n-1])


### FIXED CODE ###

import math
import bisect
import heapq
from collections import deque

n = int(input())

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

d = [float('inf')] * n
d[0] = 0
d[1] = abs(h[0] - h[1])

for i in range(2,n):
    d[i] = min(d[i-1] + abs(h[i-1]-h[i]), d[i-2] + abs(h[i-2]-h[i]))

print(d[n-1])
x,y,z = list(map(int,input().split()))
ans = x//(y+z)
num = x%(y+z)
if num => y:
    ans+=1
print(ans)


### FIXED CODE ###

x,y,z = list(map(int,input().split()))
x-=z
ans = x//(y+z)
print(ans)
import itertools
while 1:
	n = input()
	if n == 0: break
	s = sorted(map(int,raw_input().split()))
	sm = sum(s)
	for i in range(1,n-1):
		ans = sorted(abs(sm - 2*sum(party)) for party in itertools.combinations(s,i))[0]
		if ans == 0: break
	print ans

### FIXED CODE ###

def S(i,x,y):
	if 2*x >= A: return 2*x-A
	if 2*y >= A: return 2*y-A
	return min(S(i+1,x+a[i],y),S(i+1,x,y+a[i]))
while 1:
	n = input()
	if n == 0: break
	a = sorted(map(int,raw_input().split()))[::-1]
	A = sum(a)
	print S(1,a[0],0)
def acinput():
    return list(map(int, input().split(" ")))



import numpy as np
#from functools import reduce
import matha
import string
import itertools
import fractions
import heapq
import collections
import re
import array
import bisect
import sys
import random
import time
import copy
import functools

N,M=acinput()

if N==M:
    print("Yes")
else:
    print("No")


### FIXED CODE ###

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


N,M=acinput()

if N==M:
    print("Yes")
else:
    print("No")
h,w,n=map(int,input().split())
D=dict()
for i in range(n):
    a,b=map(int,input().split())
    for p in range(-1,2):
        for q in range(-1,2):
            aa=a+p
            bb=b+q
            if 2<=aa<=h-1 and 2<=bb<=w-1:
                aabb=str(aa)+str(bb)
                if aabb in D:
                    D[aabb]+=1
                else:
                    D[aabb]=1
ans=[0]*10
V=list(D.values())
for v in V:
    ans[v]+=1
ans[0]=(h-2)*(w-2)-sum(ans)
for i in range(10):
    print(ans[i])

### FIXED CODE ###

h,w,n=map(int,input().split())
D=dict()
for i in range(n):
    a,b=map(int,input().split())
    for p in range(-1,2):
        for q in range(-1,2):
            aa=a+p
            bb=b+q
            if 2<=aa<=h-1 and 2<=bb<=w-1:
                aabb=str(aa)+"_"+str(bb)
                if aabb in D:
                    D[aabb]+=1
                else:
                    D[aabb]=1
ans=[0]*10
V=list(D.values())
for v in V:
    ans[v]+=1
ans[0]=(h-2)*(w-2)-sum(ans)
for i in range(10):
    print(ans[i])
from operator import itemgetter

n, m = map(int, input().split())
yp = []
for i in range(m):
  p_, y_ = map(int, input().split())
  yp.append([y_, p_, i+1])
py = sorted(yp)
ken = [0]*m
res = []
for i in range(m):
  ken[py[i][1]] += 1
  p, q, r = py[i][1], ken[py[i][1]], py[i][2]
  res.append([p, q, r])
#print(yp)
#print(py)

res.sort(key=itemgetter(2))
#print(res)
for i in range(m):
  ans1 = [0]*(6-len(str(res[i][0])))
  ans1.append(res[i][0])
  ans2 = [0]*(6-len(str(res[i][1])))
  ans2.append(res[i][1])
  print(*ans1, *ans2, sep='')

### FIXED CODE ###

from operator import itemgetter

n, m = map(int, input().split())
yp = []
for i in range(m):
  p_, y_ = map(int, input().split())
  yp.append([y_, p_, i+1])
py = sorted(yp)
ken = [0]*n
res = []
for i in range(m):
  ken[py[i][1]-1] += 1
  p, q, r = py[i][1], ken[py[i][1]-1], py[i][2]
  res.append([p, q, r])
#print(yp)
#print(py)

res.sort(key=itemgetter(2))
#print(res)
for i in range(m):
  ans1 = [0]*(6-len(str(res[i][0])))
  ans1.append(res[i][0])
  ans2 = [0]*(6-len(str(res[i][1])))
  ans2.append(res[i][1])
  print(*ans1, *ans2, sep='')
n = int(input())
if n ==1:
    print("Hello World")
elif n ==2:
    a,b = map(int,input().split())
    print(a+b)

### FIXED CODE ###

n = int(input())
if n ==1:
    print("Hello World")
elif n ==2:
    a = int(input())
    b = int(input())
    print(a+b)
n = input()
c1=c2=0
l = len(n)
c1 = n - (len([i for i in l[0::2] if i == "0"])) - (len([i for i in l[1::2] if i == "1"]))
c2 = n - (len([i for i in l[0::2] if i == "1"])) - (len([i for i in l[1::2] if i == "0"]))

print(min(c1,c2))

### FIXED CODE ###

S = input()
c1 = c2 = 0
 
N = len(S)
c1 = N - len([s for s in S[0::2] if s == "0"]) - len([s for s in S[1::2] if s == "1"])
c2 = N - len([s for s in S[0::2] if s == "1"]) - len([s for s in S[1::2] if s == "0"])
 
print(min(c1, c2))
a,b,c,d=map(int,input().split())
while a>0 or c>0:
    c-=b
    if c<=0:
        print('Yes')
        sys.exit()
    a-=d
    if a<=0:
        print('No')
        sys.exit()

### FIXED CODE ###

import sys
a,b,c,d=map(int,input().split())
while a>0 or c>0:
    c-=b
    if c<=0:
        print('Yes')
        sys.exit()
    a-=d
    if a<=0:
        print('No')
        sys.exit()
sn = list(input())
t = list(input())
ls = len(sn)
lt = len(t)
Flag = False
reali = 0
for i in range(ls-lt+1):
  ss = sn[i:i+lt]
  count = 0
  for j in range(lt):
    if ss[j] == "?" or ss[j] == t[j]:
      count += 1
  if count == lt:
    reali = i
    Flag = True
    break
for i in range(ls):
  if i == reali:
    for j in range(lt):
      sn[i+j] = t[j]
  if sn[i] == "?":
    sn[i] = "a"
if Flag:
  for i in sn:
    print(i,end="")
else:
  print("UNRESTORABLE")

### FIXED CODE ###

sn = list(input())
t = list(input())
ls = len(sn)
lt = len(t)
Flag = False  
reali = 0 #tの文が始まるときのi
if lt > ls:
  print("UNRESTORABLE")
  exit()
for i in range(ls-lt+1): #スライスを繰り返して当てはまるところを探す
  ss = sn[i:i+lt]
  count = 0
  for j in range(lt):
    if ss[j] == "?" or ss[j] == t[j]:
      count += 1
  if count == lt:
    reali = i
    Flag = True
for i in range(ls): #見つけたとこをtの文にしてそれ以外をaにする
  if i == reali:
    for j in range(lt):
      sn[i+j] = t[j]
  if sn[i] == "?":
    sn[i] = "a"
if Flag:
  for i in sn:
    print(i,end="")
else:
  print("UNRESTORABLE")
n = list(map(int, list(input())))
ans = 0
c_in = 0
q = 0


def carry(x, i, q):
    if x[i] <= 8:
        x[i] += 1
    else:
        x[i] = 0
        if x[i] == x[0]:
            x[i] = 0
            q += 1
        else:
            carry(x, i-1, q)


while len(n) > 0:
    s = n.pop()
    if 0 <= s <= 5:
        ans += s
        if c_in:
            c_in = 0
    elif 6 <= s <= 9:
        ans += 10 - s
        c_in = 1
        carry(n, -1, q)
    print(s, ans)

ans += q
print(ans)



### FIXED CODE ###

n = [0] + list(map(int, list(input())))
ans = 0
c_in = 0

while n:
    s = n.pop()
    s += c_in
    if 0 <= s <= 4:
        ans += s
        c_in = 0
    elif 6 <= s:
        ans += abs(10 - s)
        c_in = 1
    else:
        ans += 5
        if 5 <= n[-1]:
            c_in = 1
        else:
            c_in = 0

print(ans)
from collections import Counter
n = input()
s = [list(input()).sort() for i in range(n)]
d = {a: len(a) for a in s}
count = 0
for i in d.values():
  if i !=1:
    count+=i
print(count)

### FIXED CODE ###

n = int(input())
d = dict()
for i in range(n):
  S = ''.join(sorted(list(input())))
  if S in d.keys():
    d[S] +=1
  else:
    d[S] = 1
 
ans = 0
for i in d.values():
  ans += i*(i-1)//2
print(ans)
N,L=map(int,input().split())
li=[]
for i in range(N):
    li.append(L+i+1-1)
A=True
li.sort()
for j in range(N-1):
    if abs(li[j])<=abs(li[j+1]):
        S-=li[j]
        A=False
        break

if A==True:
    S-=li[N-1]

print(S)


### FIXED CODE ###

N,L=map(int,input().split())
li=[]
for i in range(N):
    li.append(L+i+1-1)
A=True
li.sort()
S=sum(li)
for j in range(N-1):
    if abs(li[j])<=abs(li[j+1]):
        S-=li[j]
        A=False
        break

if A==True:
    S-=li[N-1]

print(S)
N, M = map(int, raw_input().split())

def max_vote(places):
  max_index = places.index(max(places))
  places[max_index] = -1
  return max_index + 1, places

while 1:
  places = []
  for m in  range(M):
    places.append(0)
  for n in N:
    votes = map(int, raw_input().split())
    count = 0
    for vote in votes:
      if vote == 1:
        places[count] += 1
      else:
        pass
      count += 1 
  for m in range(M):
    answer, places = max_vote(places)
    print answer,

### FIXED CODE ###

while 1:
    n,m=map(int,raw_input().split())
    if n+m==0:
        break
    a = dict(zip(range(m),[0]*m))
    for i in range(n):
        c=map(int,raw_input().split())
        for j in range(m):
            a[j]+=c[j]
    for k,v in sorted(a.items(),key=lambda x:x[1],reverse=1):
        print k+1,
    print