Harryxun/stf_run huggingface dataset:
import sys
input = sys.stdin.readline

def bellmanford(G, s, N):
    n = len(G)
    inf = float('inf')
    dist = [inf] * n
    dist[s] = 0
    for i in range(n+1):
        for v in range(n):
            for w, c in G[v]:
                if dist[w] > dist[v] + c:
                    dist[w] = dist[v] + c
                    if i == n and w == N - 1:
                        return False
    return dist

def bellmanford(G, s):
    n = len(G)
    inf = float('inf')
    dist = [inf] * n
    dist[s] = 0
    for i in range(n):
        for v in range(n):
            for w, c in G[v]:
                if dist[w] > dist[v] + c:
                    dist[w] = dist[v] + c
                    if i == n - 1 and w == n - 1:
                        return -1
    return dist

def main():
    N, M, P = map(int, input().split())
    G = [[] for _ in range(N)]
    for _ in range(M):
        a, b, c = map(int, input().split())
        a -= 1
        b -= 1
        G[a].append((b, -c+P))
    ans = bellmanford(G, 0, N)
    if ans:
        print(max(0, -ans[N-1]))
    else:
        print(-1)

if __name__ == '__main__':
    main()

### FIXED CODE ###

import sys
input = sys.stdin.readline

def dfs(edges, s):
    use = {s}
    stack = [s]
    while stack:
        v = stack.pop()
        for w in edges[v]:
            if w in use: continue
            use.add(w)
            stack.append(w)
    return use

def bellmanford(num_v, edges, source):
    inf = float('inf')
    dist = [inf] * num_v
    dist[source] = 0
    for i in range(num_v):
        flag = False
        for s, t, cost in edges:
            if dist[s] == inf: continue
            if dist[s] + cost < dist[t]:
                dist[t] = dist[s] + cost
                flag = True
        if not flag: break
    else:
        return False
    return dist

def main():
    N, M, P = map(int, input().split())
    G = [[] for _ in range(N)]
    G_rev = [[] for _ in range(N)]
    edges = []
    for _ in range(M):
        a, b, c = map(int, input().split())
        a -= 1
        b -= 1
        G[a].append(b)
        G_rev[b].append(a)
        edges.append((a, b, P-c))
    
    use = dfs(G_rev, N-1)
    edges = [(a, b, c) for a, b, c in edges if a in use and b in use]
    dist = bellmanford(N, edges, 0)
    if dist:
        print(max(0, -dist[N-1]))
    else:
        print(-1)

if __name__ == '__main__':
    main()
n = int(input())
l = []
for _ in range(n):
  A = list(map(int, input().split()))
  l.append(A)
  
l = sorted(l)

x0,l0 = l[0][0],l[0][1]
y = x0 + l0
count = 1
for i in range(n-1):
  x,d = l[i+1][0],l[i+1][1]
  z = x - d
  
  if z > y:
    y = x + d
    count = count + 1
  else:
    continue
print(count)

### FIXED CODE ###

h = int(input())
w = int(input())
n = int(input())

m = max(h,w)
a = n // m
b = n % m
if b == 0:
  print(a)
else:
  print(a+1)
# BFS
from collections import deque
import numpy as np


def main():
    dx = [1, 0, -1, 0]
    dy = [0, 1, 0, -1]
    # 頂点数と辺数
    H, W = map(int, input().split())
    A = [list(input()) for _ in range(H)]
    # 全頂点を未訪問に初期化
    dist = [[-1] * W for _ in range(H)]

    ans = float('inf')
    que = deque()
    for h in range(H):
        for w in range(W):
            if A[h][w] == '#':
                que.append([h, w])
                dist[h][w] = 0

    # bfs開始 (キューが空になるまで探索を行う)
    while len(que) > 0:
        v = que.popleft()  # キューから先頭頂点を取り出す
        for i in range(4):
            nx = v[0] + dx[i]
            ny = v[1] + dy[i]
            if (0 <= nx and nx < H and 0 <= ny and ny < W and dist[nx][ny] == -1):
                que.append([nx, ny])
                dist[nx][ny] = dist[v[0]][v[1]] + 1
    print(np.max(dist))


if __name__ == "__main__":
    main()


### FIXED CODE ###

# BFS
from collections import deque


def main():
    dx = [1, 0, -1, 0]
    dy = [0, 1, 0, -1]
    # 頂点数と辺数
    H, W = map(int, input().split())
    A = [list(input()) for _ in range(H)]
    # 全頂点を未訪問に初期化
    dist = [[-1] * W for _ in range(H)]

    ans = float('inf')
    que = deque()
    for h in range(H):
        for w in range(W):
            if A[h][w] == '#':
                que.append([h, w])
                dist[h][w] = 0

    # bfs開始 (キューが空になるまで探索を行う)
    while len(que) > 0:
        v = que.popleft()  # キューから先頭頂点を取り出す
        for i in range(4):
            nx = v[0] + dx[i]
            ny = v[1] + dy[i]
            if (0 <= nx and nx < H and 0 <= ny and ny < W and dist[nx][ny] == -1):
                que.append([nx, ny])
                dist[nx][ny] = dist[v[0]][v[1]] + 1
    ans = 0
    for h in range(H):
        for w in range(W):
            ans = max(ans, dist[h][w])
    print(ans)


if __name__ == "__main__":
    main()
A = int(input())
B = int(input())
C = int(input())

if A == 5 and B == 5 and C == 7:
    print("YES")

elif A == 5 and B == 7 and C == 5:
    print("YES")

elif A == 7 and B == 5 and C == 7:
    print("YES")

elif A == 7 and B == 7 and C == 5:
    print("YES")
    
else:
    print("NO")


### FIXED CODE ###

a=input().split()
if a.count('5')==2 and a.count('7')==1:
    print('YES')
else:
    print('NO')
n = int(input())
a = map(int,input().Split())
count = 0;
while true:
	for i in a :
  		if i%2!=0:
          break
        else :
          a[i] = a%i
    count++
    
print(str(count))

### FIXED CODE ###

count = input().count('1')
print(count)
a,b,c=map(int, input.split())
print(str(z)+" "+str(x)+" "+str(y))

### FIXED CODE ###

x,y,z=map(int,input().split())
print(str(z)+" "+str(x)+" "+str(y))
import math
radius = int(input())

print(2 * math.pi * radius

### FIXED CODE ###

import math

radius = int(input())

print(2 * math.pi * radius)
n=int(input())
l=input().split()

def BubbleSort(c):
    for i in range(len(c)-1):
        for j in range(len(c)-1, i, -1):
            if int(c[j][-1]) < int(c[j-1][-1]):
                c[j], c[j-1]=c[j-1],c[j]
    return c

def SelectionSort(C):
    for i in range(len(c)-1):
        m=i
        for j in range(i, len(c)-1):
            if int(c[j][-1]) < int(c[m][-1]):
                c[j], c[m]=c[m],c[j]
    return c

print(BubbleSort(l))
print(SelectionSort(l))


### FIXED CODE ###

n=int(raw_input())
r=raw_input().split()

def BubbleSort(c, n):
    for i in range(n):
        for j in range(n-1, i, -1):
            if int(c[j][-1]) < int(c[j-1][-1]):
                c[j], c[j-1]=c[j-1],c[j]
    return c

def SelectionSort(c, n):
    for i in range(n):
        m=i
        for j in range(i, n):
            if int(c[j][-1]) < int(c[m][-1]):
                m=j
        c[i],c[m]=c[m],c[i]
    return c

l=list(r)
a=BubbleSort(l, n)
print ' '.join(a)
print 'Stable'
l=list(r)
b=SelectionSort(l, n)
print ' '.join(b)
if a==b:
    print 'Stable'
else:
    print 'Not stable'
from math import ceil,floor,factorial,gcd,sqrt,log2,cos,sin,tan,acos,asin,atan,degrees,radians,pi,inf,comb
from itertools import accumulate,groupby,permutations,combinations,product,combinations_with_replacement
from collections import deque,defaultdict,Counter
from bisect import bisect_left,bisect_right
from operator import itemgetter
from heapq import heapify,heappop,heappush
from queue import Queue,LifoQueue,PriorityQueue
from copy import deepcopy
from time import time
from functools import reduce
import string
import sys
sys.setrecursionlimit(10 ** 7)
def input() : return sys.stdin.readline().strip()
def INT()   : return int(input())
def MAP()   : return map(int,input().split())
def LIST()  : return list(MAP())

h, w, k = MAP()
s = []
p = []
q = []
for i in range(h):
    s.append(input())
    if s[i].count('#') > 0:
        p.append(i)
    else:
        q.append(i)

a = [[0]*w for i in range(h)]
num = 0
if p:
    for i in p:
        num += 1
        m = 0
        while s[i][m] == '.':
            a[i][m] = num
            m += 1
        a[i][m] = num
        m += 1
        if m < w:
            for j in range(m, w):
                if s[i][j] == '#':
                    num += 1
                a[i][j] = num

if q:
    for i in q:
        m = i
        while m < h and a[m][j] == 0:
            m += 1
        if m >= h:
            m = i
            while m > 0 and a[m][j] == 0:
                m -= 1
        for j in range(w):
            a[i][j] = a[m][j]
for i in range(h):
    print(*a[i][:])

### FIXED CODE ###

from math import ceil,floor,factorial,gcd,sqrt,log2,cos,sin,tan,acos,asin,atan,degrees,radians,pi,inf,comb
from itertools import accumulate,groupby,permutations,combinations,product,combinations_with_replacement
from collections import deque,defaultdict,Counter
from bisect import bisect_left,bisect_right
from operator import itemgetter
from heapq import heapify,heappop,heappush
from queue import Queue,LifoQueue,PriorityQueue
from copy import deepcopy
from time import time
from functools import reduce
import string
import sys
sys.setrecursionlimit(10 ** 7)
def input() : return sys.stdin.readline().strip()
def INT()   : return int(input())
def MAP()   : return map(int,input().split())
def LIST()  : return list(MAP())

h, w, k = MAP()
s = []
p = []
q = []
for i in range(h):
    s.append(input())
    if s[i].count('#') > 0:
        p.append(i)
    else:
        q.append(i)

a = [[0]*w for i in range(h)]
num = 0
if p:
    for i in p:
        num += 1
        m = 0
        while s[i][m] == '.':
            a[i][m] = num
            m += 1
        if m < w:
            if s[i][m] == '#':
                a[i][m] = num
                m += 1
            if m < w:
                for j in range(m, w):
                    if s[i][j] == '#':
                        num += 1
                    a[i][j] = num

if q:
    for i in q:
        m = i
        while m < h and a[m][0] == 0:
            m += 1
        if m >= h:
            m = i
            while m > 0 and a[m][0] == 0:
                m -= 1
        a[i][:] = a[m][:]
for i in range(h):
    print(*a[i][:])
K = int(input())
A = list(map(int,input().split()))
a = K-1
p = 2
while 0 <= a:
    if A[a-1] > A[a]*2:
        print('-1')
        exit()
    num = 1
    if A[a] < p:
        while A[a]*num < p:
            num += 1
    p = num*A[a]
    a -= 1
pmax = p
while pmax < A[1]*2:
    pmax += A[0]
pmax -= A[0]
print(p,pmax)


### FIXED CODE ###

import math
K = int(input())
A = list(map(int,input().split()))
a = 1
L,S = 2,2 

while a <= K:
    if math.ceil(S/A[-a])*A[-a] < S or L < math.ceil(S/A[-a])*A[-a]:
        print('-1')
        exit()
    S = math.ceil(S/A[-a])*A[-a]
    L = math.floor(L/A[-a])*A[-a] + A[-a] -1
    a += 1
print(S,L)
N = input()

print(2*N*3.1416)

### FIXED CODE ###

N = float(input())
 
print(2*N*3.1416)
n,m=map(int, input().split())
sc = [list(map(int, input().split())) for i in range(m)]

ans = ['0']*(m+1)
for i in range(len(sc)):
    if ans[sc[i][0]] == '0' or ans[sc[i][0]] >= str(sc[i][1]):
        if sc[i][1] != 0:
            ans[sc[i][0]] = str(sc[i][1])
    else:
        continue
if ans[1] == '0':
    print(-1)
else:
    print(int(''.join(ans)))


### FIXED CODE ###

n,m=map(int, input().split())
sc = [list(map(int, input().split())) for x in range(m)]

ans = ['0']*(n+1)
flg = 0
for i in range(m):
    if ans[sc[i][0]] == '0':
        if sc[i][1] != 0:
            ans[sc[i][0]] = str(sc[i][1])
            if sc[i][0] == 1:
                flg = 1
        elif sc[i][0] == 1 and sc[i][1] == 0 and flg == 0:
            ans[sc[i][0]] = str(sc[i][1])
            flg = 1
        else:
            continue
    elif ans[sc[i][0]] == str(sc[i][1]):
        continue
    else:
        print(-1)
        exit()
if flg == 0 and len(ans) != 2:
    ans[1] = '1'
    print(int(''.join(ans)))
elif ans[1] == '0' and len(ans) != 2:
    print(-1)
else:
    print(int(''.join(ans)))
N, M = map(int, input().split())

import sys

teiki = defaultdict(set)
for i in range(M):
    a, b = map(int, input().split())
    teiki[a].add(b)


if 1 not in teiki:
    print('IMPOSSIBLE')
    sys.exit()

for i in teiki[1]:
    if i in teiki and N in teiki[i]:
        print('POSSIBLE')
        sys.exit()

print('IMPOSSIBLE')

### FIXED CODE ###

from collections import defaultdict

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

import sys

teiki = defaultdict(set)
for i in range(M):
    a, b = map(int, input().split())
    teiki[a].add(b)


if 1 not in teiki:
    print('IMPOSSIBLE')
    sys.exit()

for i in teiki[1]:
    if i in teiki and N in teiki[i]:
        print('POSSIBLE')
        sys.exit()

print('IMPOSSIBLE')
a,b,c,d = map(int(),input().split())

if a*b == c*d:
    print(a*b)
if a*b =< c*d:
    print(c*d)
if a*b >= c*d:
    print(a*b)




### FIXED CODE ###

#二つの長方形
#縦A、横B A*B
#縦C、横D C*D

a,b,c,d = map(int,input().split())

if a*b == c*d:
    print(a*b)
if a*b < c*d:
    print(c*d)
if a*b > c*d:
    print(a*b)
N = int(input())
S = str(input())
# '.'の場合は白, '#'の場合は黒

if S[0] == '.':
    count_white = [1]
    count_black = [0]
else:
    count_white = [0]
    count_black = [1]


for i in range(1, N):
    if S[i] == '.':
        # 見ている石が白なら
        count_white.append(count_white[i-1]+1)
        count_black.append(count_black[i-1])
    else:
        # 見ている石が黒なら
        count_white.append(count_white[i-1])
        count_black.append(count_black[i-1]+1)

# print(count_black)
# print(count_white)

# change_count = [x+y for x, y in zip(count_white, count_black)]
change_count = []
for i in range(1, N):
    change_count.append(count_black[i-1] + (count_white[N-1] - count_white[i]))

print(min(change_count))


### FIXED CODE ###

N = int(input())
S = str(input())
# '.'の場合は白, '#'の場合は黒

if S[0] == '.':
    count_white = [1]
    count_black = [0]
else:
    count_white = [0]
    count_black = [1]


for i in range(1, N):
    if S[i] == '.':
        # 見ている石が白なら
        count_white.append(count_white[i-1]+1)
        count_black.append(count_black[i-1])
    else:
        # 見ている石が黒なら
        count_white.append(count_white[i-1])
        count_black.append(count_black[i-1]+1)

tmp = 9999999999
for i in range(1, N):
    min_sum = 0
    min_sum += count_black[i-1]
    min_sum += (count_white[N-1] - count_white[i])
    tmp = min(tmp, min_sum)

# print(tmp)

cnt = 0
target = S[0]
for i in range(1, N):
    if target == '#' and S[i] == '.':
        cnt += 1
        target = '#'  # 黒に変える
        continue

    if S[i] == '#':
        target = '#'
    else:
        target = '.'

cnt_2 = 0
aim = S[-1]
for i in range(N-1, -1, -1):
    if aim == '.' and S[i] == '#':
        cnt_2 += 1
        aim = '.'
        continue

    if S[i] == '#':
        aim = '#'
    else:
        aim = '.'


print(int(min(cnt, cnt_2, tmp)))
N = int(input())
a = []
b = 0
a.append(int(input()))
# for i in range(N):

for i in range(N):
    b = a[i]
    a[i] = 0
    print(max(a))
    a[i] = b


### FIXED CODE ###

N = int(input())
a = []
b = []
a_max = 0
a_second = 0

for i in range(N):
    a.append(int(input()))

b = a[:]
a.sort(reverse=True)

a_max = a[0]
a_second = a[1]

for i in range(N):
    if b[i] == a_max:
        print(a_second)
    else:
        print(a_max)
input_num = map(int, input().split())
seki = input_num[0] * input_num[1]
if seki % 2 == 0:
    print("Even")
else:
    print("Odd")

### FIXED CODE ###

num1, num2 = map(int, input().split())
seki = num1 * num2
if seki % 2 == 0:
    print("Even")
else:
    print("Odd")
n=int(input())
A=list(map(int,input().split()))
from collections import defaultdict

balls = defaultdict(int)
for i in range(n-1,-1,-1):
    count=A[i]
    for j in range(n//(i+1)):
        count+=balls[(j*(i+1))-1]
    if count%2:
        balls[i]=1

ans=[i+1 for i in range(n) if balls[i]==1]
print(len(ans))
print(*ans)
n=int(input())
A=list(map(int,input().split()))
from collections import defaultdict

balls = defaultdict(int)
for i in range(n-1,-1,-1):
    count=A[i]
    for j in range(n//(i+1)):
        count+=balls[(j*(i+1))-1]
    if count%2:
        balls[i]=1

ans=[i+1 for i in range(n) if balls[i]==1]
print(len(ans))
print(*ans)


### FIXED CODE ###

def main(A,N):
    A = [0] + A
    for a in range(N-1,0,-1):
        #print(inds[ind::ind+1])
        if sum(A[a::a]) %2== 0:
            A[a] = 0
        else:
            A[a] = 1
        
    res = [x for x in range(0,N+1) if A[x]]
    print(len(res))
    print(*res)

N = int(input())
A = [int(x) for x in input().split()]
    
main(A,N)
a, b, c = map(int, input().split())
if a*b*c = 245:
  print('YES')
else:
  print('NO')


### FIXED CODE ###

a, b, c = map(int, input().split())
if a*b*c == 175:
  print('YES')
else:
  print('NO')
print(int((a + b - 1)//2))

### FIXED CODE ###

a, b = map(int, input().split())
print((a + b + 1)//2)
n, k = map(int, input().split())
a = list(map(int, input().split()))
a.sort()

def f(l, s):
    return s if l % s == 0 else f(s, l % s)

z = f(a[1], a[0])
for i in a:
    z = f(i, z)

if a[-1] >= k and k % z == 0:
    print('POSSIBLE')
else:
    print('IMPOSSIBLE')

### FIXED CODE ###

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


a.sort()
if a[-1] < k:
    print('IMPOSSIBLE')
    sys.exit(0)

seta = set(a)
if k in seta:
    print('POSSIBLE')
    sys.exit(0)
change = True
while change:
    change = False
    setb = seta.copy()
    sorteda = sorted(seta)
    mini = sorteda[0] if sorteda[0] != 0 else sorteda[1]
    for i in range(1, len(sorteda)):
        setb.add(sorteda[i] % mini)
    if setb != seta:
        change = True
        seta = setb

mini = sorted(seta)[1]
a.reverse()

for i in a:
    if (k - i) % mini == 0:
        print('POSSIBLE')
        sys.exit(0)
print('IMPOSSIBLE')
T = list(input())
N = len(T)
if T[-1] == "?":
    T[-1] = "D"

if N == 1 and T[0] == "?":
    T[0] = D
elif N == 2:
    if T[0] == "?" and T[1] == "?":
        T[0] = "P"
        T[1] = "D"
                
    elif T[0] == "?" and T[1] == "D":
        T[0] = "P"
                
    elif T[0] == "?" and T[1] == "P":
        T[0] = "D"
        
    elif T[0] == "P" and T[1] == "?":
        T[1] = "D"
elif N > 2:        
    if T[0] == "?" and T[1] == "?":
        T[0] = "P"
        T[1] = "D"
          
    elif T[0] == "?" and T[1] == "D":
        T[0] = "P"
            
    elif T[0] == "?" and T[1] == "P":
        T[0] = "D"
            
    elif T[0] == "D" and T[1] == "?" and T[2] == "D":
        T[1] = "P"
            
    elif T[0] == "D" and T[1] == "?" and T[2] == "P":
        T[1] = "D"
    
    elif T[0] == "P" and T[1] == "?":
        T[1] = "D"
        
    for i in range(2,N-1):
         if T[i-2] == "P" and T[i-1] == "D" and T[i+1] == "D" and T[i] == "?":
            T[i] = "P"
              continue
        elif T[i] == "?":
            T[i] = "D"
        

ans = "".join(T)         
print(ans)


### FIXED CODE ###

T = list(input())
N = len(T)
if T[-1] == "?":
    T[-1] = "D"

if N == 1 and T[0] == "?":
    T[0] = D
elif N == 2:
    if T[0] == "?" and T[1] == "?":
        T[0] = "P"
        T[1] = "D"
                
    elif T[0] == "?" and T[1] == "D":
        T[0] = "P"
                
    elif T[0] == "?" and T[1] == "P":
        T[0] = "D"
        
    elif T[0] == "P" and T[1] == "?":
        T[1] = "D"
        
elif N > 2:        
    if T[0] == "?" and T[1] == "?":
        T[0] = "P"
        T[1] = "D"
          
    elif T[0] == "?" and T[1] == "D":
        T[0] = "P"
            
    elif T[0] == "?" and T[1] == "P":
        T[0] = "D"
            
    elif T[0] == "D" and T[1] == "?" and T[2] == "D":
        T[1] = "P"
            
    elif T[0] == "D" and T[1] == "?" and T[2] == "P":
        T[1] = "D"
    
    elif T[0] == "P" and T[1] == "?":
        T[1] = "D"
        
    for i in range(2,N-1):
        if T[i-2] == "P" and T[i-1] == "D" and T[i+1] == "D" and T[i] == "?":
            T[i] = "P"
            continue
        
        elif T[i] == "?":
            T[i] = "D"
        

ans = "".join(T)         
print(ans)
n, m = map(int, input().split())
l = []
for i in range(m+1):
  l.append([])
types = set()
combo = []
for i in range(m):
  f, t = map(int, input().split())
  if not t in l[f]:
    l[f].append(t)
  
  if not f in l[t]:
    l[t].append(f)

def dfs(path, now):
  if len(set(path)) == n and not path in combo:
    combo.append(path)
    return

  for i in l[now]:
    if not i in path:
      temp = path[:]
      temp.append(i)
      dfs(temp, i)

  return
if m < n-1:
  print(0)
else:
  dfs([1], 1)
  print(len(combo))

### FIXED CODE ###

n, m = map(int, input().split())
l = []
combo = []
for i in range(max(n, m)+1):
  l.append([])
  
def dfs(path, now):
  if len(set(path)) == n and not path in combo:
    combo.append(path)
    return

  for i in l[now]:
    if not i in path:
      temp = path[:]
      temp.append(i)
      dfs(temp, i)

  return

if m == 0:
  print(0)
else:

  for i in range(m):
    f, t = map(int, input().split())
    if not t in l[f]:
      l[f].append(t)
    
    if not f in l[t]:
      l[t].append(f)

  dfs([1], 1)
  print(len(combo))
N = input()
print((N-1)//2)

### FIXED CODE ###

N = int(input())
print((N-1)//2)
x = input()
if x == 'a' || x == 'i' || x == 'u'||x=='e'||x=='o':
  print ('vowel')
else:
  print ('consonant')

### FIXED CODE ###

x = input()
if x == 'a' or x == 'i' or x == 'u' or x=='e' or x=='o':
  print ('vowel')
else:
  print ('consonant')
n=input()
t,a=input().split()
h=[]
n=int(n)
t=int(t)
a=int(a)
b=input().split()
min=1000
for i in range(n):
     b[i]=int(b[i])
     if min > abs(a-t+0.006*b[i]):
          min=abs(a-t+0.006*b[i]))
          id=i+1
print(id)

### FIXED CODE ###

n=input()
t,a=input().split()
n=int(n)
t=int(t)
a=int(a)
b=input().split()
min=1000
for i in range(n):
    diff=abs(a-t+0.006*int(b[i]))
    if min>diff:
        id=i+1
        min=diff

print (id)
n, x = map(int, input().split())
a = list(map(int, input().split()))
a.sort()
ans = 0
i = 0
while x > 0:
    if a[i] > x:
        break
    else:
        x -= a[i]
        ans += 1
        i += 1


print(ans)


### FIXED CODE ###

n, x = map(int, input().split())
a = list(map(int, input().split()))
a.sort()
ans = 0
i = 0
while i != n:
    if a[i] > x:
        break
    else:
        x -= a[i]
        ans += 1
        i += 1
if x > 0 and i == n:
    ans -= 1
if ans < 0:
    ans = 0
print(ans)
import numpy as np
H,W,M=map(int, input().split())
hl=np.array([0 for i in range(H+1)])
wl=np.array([0 for i in range(W+1)])
ms=[]
for i in range(M):
    h,w=map(int, input().split())
    hl[h]+=1
    wl[w]+=1
    ms.append([h,w])
a=max(hl)
b=max(wl)
hmax=[]
wmax=[]
s=0
for x in ms:
    if  hl[x[0]-1]==a and wl[x[1]-1]==b:
        s+=1
c=hl.count(a)
d=wl.count(b)
if s<c*d:
    print(a+b)
else:
    print(a+b-1)

### FIXED CODE ###


H,W,M=map(int, input().split())
hl=[0 for i in range(H+1)]
wl=[0 for i in range(W+1)]
ms=[]
for i in range(M):
    h,w=map(int, input().split())
    hl[h]+=1
    wl[w]+=1
    ms.append([h,w])
a=max(hl)
b=max(wl)
hmax=[]
wmax=[]
s=0
for x in ms:
    if  hl[x[0]]==a and wl[x[1]]==b:
        s+=1
c=hl.count(a)
d=wl.count(b)
if s<c*d:
    print(a+b)
else:
    print(a+b-1)
n = int(input())
max_n = 100000
dp = [10000 for i in range(max_n)]
dp[0] = 0

for i in range(n+1):
  k = 1
  while k <= n:
    dp[i] = min(dp[i],dp[i-k]+1)
    k *=6
  k = 1
  while k <= n:
    dp[i] = min(dp[i],dp[i-k]+1)
    k*=9
print(dp[n])

### FIXED CODE ###

n = int(input())
max_n = 100000
dp = [10000 for i in range(max_n+1)]
dp[0] = 0

for i in range(n+1):
  k = 1
  while k <= n:
    dp[i] = min(dp[i],dp[i-k]+1)
    k *=6
  k = 1
  while k <= n:
    dp[i] = min(dp[i],dp[i-k]+1)
    k*=9
print(dp[n])
#include <bits/stdc++.h>
#include <math.h>
using namespace std;

int main() {
  int N;
  cin >> N;
  vector<int> vals(N);
  for (int i = 0; i < N;i++){
    cin >> vals.at(i);
  }
  int prod = std::accumulate(vals.begin(), vals.end(), 1, [](int init, int v) { return init * v; });
  if (prod > pow(10, 18)){
    cout << "-1" << endl;
  }
  else cout << prod << endl;
}


### FIXED CODE ###

N = input()
A = list(map(int,input().split()))
def main(A):
    if 0 in A:
        print(0)
        return

    prod = 1
    for a in A:
        prod *= a
        if prod > 1000000000000000000:
            print(-1)
            return

    print(prod)

main(A)
N = int(input())

if N == 1:
  print("Hello World")
else:
  A, B = map(int, input().split())
  print(A+B)

### FIXED CODE ###

N = int(input())

if N == 1:
  print("Hello World")
else:
  A= int(input())
  B= int(input())
  print(A+B)