Harryxun/stf_run huggingface dataset:
import itertools

n,m = map(int,input().xplit())
path=[[False]*n for _ in range(n)]
for _ in range(m):
  a,b = map(int,input().split())
  a-=1
  b-=1
  path[a][b]=True
  path[b][a]=True
ans=0

for i in itertools.permutations(range(6), 6):
   if i[0] == 0:
     for j in range(n):
       if j==n-1:
         ans+=1
         break
       if not path[i[j]][i[j+1]]:
         break

print(ans)

### FIXED CODE ###

import itertools

n, m = map(int, input().split())

path = [[False] * n for i in range(n)]
for i in range(m):
    a, b = map(int, input().split())
    a -= 1
    b -= 1
    path[a][b] = True
    path[b][a] = True

ans = 0

# 頂点を並び替える順列を生成してループ
for i in itertools.permutations(range(n), n):
    # 頂点1が始点
    if i[0] == 0:
        # 生成した順列の中をさらにループ
        for j in range(n):
            # n - 1 まで続いたら条件を満たすパスが存在する
            if j == n - 1:
                ans += 1
                break
            # i[j] から i[j + 1] に行くパスがなければ終了
            if not path[i[j]][i[j + 1]]:
                break

print(ans)
n=int(input())
l=sorted([int(i) for i in input().split()],reverse=True)

ans=0
for i in range(n-2):
    c=l[i]
    x=0
    for j in range(i+1,n-1):
        b=l[j]
        for k in range(j+1,n):
            a=l[k]
            if c<(a+b):
                co+=1
            else:
                if k==j+1:
                    x=1
                break
        if x==1:
            break

print(ans)

### FIXED CODE ###

from bisect import bisect_left

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

L.sort()
ans = 0
for i in range(N - 2):
    for j in range(i + 1, N - 1):
        ans += bisect_left(L, L[i] + L[j]) - j - 1
print(ans)
import sys

class Deque:
    class Cell2:
        def __init__(self, x, y = None, z = None):
            self.data = x
            self.next = y
            self.prev = z

    def __init__(self):
        head = Deque.Cell2(None)
        head.next = head        
        head.prev = head
        self.size = 0
        self.head = head

    def push_front(self, x):
        h = self.head
        q = h.next
        p = Deque.Cell2(x, q, h)
        h.next = p
        q.prev = p
        self.size += 1

    def pop_back(self):
        if self.size == 0: raise IndexError
        h = self.head
        q = h.prev
        p = q.prev
        p.next = h
        h.prev = p
        self.size -= 1
        return q.data

    def pop_front(self):
        if self.size == 0: raise IndexError
        h = self.head
        q = h.next
        p = q.next
        p.prev = h
        h.next = p
        self.size -= 1
        return q.data

    def delete(self,x):
        h=self.head.next
        while h.data!=x:
            h=h.next
            if h==self.head: raise IndexError
        q=h.next
        p=h.prev
        q.prev=p
        p.next=q
        self.size -= 1
        return

    def __str__(self):
        if self.size == 0: return
        buff = ''
        n = self.size
        cp = self.head.next
        while n > 1:
            buff += '%s ' % cp.data
            cp = cp.next
            n -= 1
        buff += '%s' % cp.data
        return buff
    
A=Deque()
n=int(raw_input())
while n:
    s = (raw_input().split())
    if s[0] == 'insert':
        A.push_front(s[1])
    elif s[0] == 'delete':
        A.delete(s[1])
    elif s[0] == 'deleteFirst':
        A.pop_front()
    elif s[0] == 'deleteLast':
        A.pop_back()
    n -=1
    
print A

### FIXED CODE ###

import sys,gc
    
A=[]
fp =0
bp =0

n=int(raw_input())
while n:
    s = raw_input()
    if s[0] == 'i':
        A.append(int(s[7:]))
        fp += 1
    elif s[6] == ' ':
        try:
            i = A[::-1].index(int(s[7:]))
            if i!=-1:
                del A[-i-1]
                fp -=1
        except:
            pass
    elif s[6] == 'F':
        A.pop()
        fp -=1
    elif s[6] == 'L':
        bp +=1
    n -=1

for e in A[bp:fp+1][::-1]:
    print int(e),
import collections
A, B = map(int, input().split())

a = collections.Counter(prime_factorize(A))
b = collections.Counter(prime_factorize(B))

l_a = list(a.keys())
l_b = list(b.keys())

ans = 1
for i in l_b:
  if i in l_a:
    ans += 1
    
print(ans)

### FIXED CODE ###

import collections
A, B = map(int, input().split())

def prime_factorize(n):
    a = []
    while n % 2 == 0:
        a.append(2)
        n //= 2
    f = 3
    while f * f <= n:
        if n % f == 0:
            a.append(f)
            n //= f
        else:
            f += 2
    if n != 1:
        a.append(n)
    return a

a = set(prime_factorize(A))
b = set(prime_factorize(B))

ans = 1
for i in b:
  if i in a:
    ans += 1
    
print(ans)
n = int(input())
table = list[for i in range(n)]
print("{} {} {}".format(min(table),max(table),sum(table)))



### FIXED CODE ###

n = input()
table = list(map(int,input().split()))
print("{} {} {}".format(min(table),max(table),sum(table)))
import sys
input = sys.stdin.readline

n = int(input())
a = list(map(int, input().split()))
rbg = [-1, -1, -1]
ans = 1
mod = 10 ** 9 + 7

for A in a:
    ans *= rbg.count(A - 1)
    ans %= mod
    rbg[rbg.index(A - 1)] = A

print(ans)


### FIXED CODE ###

import sys
input = sys.stdin.readline

n = int(input())
a = list(map(int, input().split()))
rbg = [-1, -1, -1]
ans = 1
mod = 10 ** 9 + 7

for A in a:
    ans *= rbg.count(A - 1)
    ans %= mod
    for i in range(3):
        if rbg[i] == A - 1:
            rbg[i] = A
            break

print(ans)
n,k=(int(i) for i in input().split())
h=[0 for i in range(k)]
p=0
for i in input().split():
  p+=i
  if h[0]<i:
    h[0]=i
    h.sort()
print(p-sum(h))

### FIXED CODE ###

n,k=(int(i) for i in input().split())
h=[]
for i in input().split():
  h.append(int(i))
h.sort()
if k!=0:
	for i in range(min(n,k)):
 	  h.pop(-1)
print(sum(h))
from sys import stdin
N, M = [int(x) for x in stdin.readline().rstrip().split()]
data = [stdin.readline().rstrip().split() for _ in range(M)]

island = list(range(N))
counts = [1] * N
total = int((N * (N - 1)) / 2)
result = []

for c in reversed(data):
    ref0 = int(c[0]) - 1
    while island[ref0] != ref0:
        ref0 = island[ref0]
    ref1 = int(c[1]) - 1
    while island[ref1] != ref1:
        ref1 = island[ref1]

    if ref0 == ref1:
        result.append(0);
    else:
        island[c[0] - 1] = min(ref0, ref1)
        island[c[1] - 1] = min(ref0, ref1)
        result.append(counts[ref0] * counts[ref1]);
        counts[min(ref0,ref1)] = counts[ref0] + counts[ref1]

res = [total]
for r in result:
    res.append((res[-1] - r))

print('\n'.join(reversed([str(x) for x in res][:-1])))


### FIXED CODE ###

from sys import stdin
N, M = [int(x) for x in stdin.readline().rstrip().split()]
data = [stdin.readline().rstrip().split() for _ in range(M)]

island = list(range(N))
counts = [1] * N
total = int((N * (N - 1)) / 2)
result = []

for c in reversed(data):
    ref0 = int(c[0]) - 1
    while island[ref0] != ref0:
        ref0 = island[ref0]
    ref1 = int(c[1]) - 1
    while island[ref1] != ref1:
        ref1 = island[ref1]

    if ref0 == ref1:
        result.append(0);
    else:
        island[max(ref0,ref1)] = min(ref0, ref1)
        result.append(counts[ref0] * counts[ref1]);
        counts[min(ref0,ref1)] = counts[ref0] + counts[ref1]

res = [total]
for r in result:
    res.append((res[-1] - r))

print('\n'.join(reversed([str(x) for x in res][:-1])))
N = int(input())
T = [int(input()) for i in range(N)]

dvs = []
dvs_all = []

def gcd(m,n):
  x = max(m,n)
  y = min(m,n)
  if x%y == 0:
    return y
  else:
    while x%y != 0:
      z = x%y
      x = y
      y = z
    else:
      return z

def lcm(m,n):
  return int(m * n / gcd(m,n))

for i in range(N - 1):
  ans = lcm(T[i], T[i+1])
  T[i+1] = ans

print(ans)

### FIXED CODE ###

N = int(input())
T = [int(input()) for i in range(N)]

def gcd(m,n):
  x = max(m,n)
  y = min(m,n)
  if x%y == 0:
    return y
  else:
    while x%y != 0:
      z = x%y
      x = y
      y = z
    else:
      return z

def lcm(m,n):
  return int(m * n // gcd(m,n))

ans = 1
for i in range(N):
    ans = lcm(T[i], ans)

print(ans)
from sys import stdin
from itertools import accumulate

input = stdin.readline
from collections import Counter

N, M = map(int, input().split())
friends = [tuple(map(int, inp.strip().split())) for inp in stdin.read().splitlines()]
father = list(range(N))


def getfather(x):
    if father[x] != x:
        father[x] = getfather(father[x])
    return father[x]


def union(x, y):
    fx = getfather(x)
    fy = getfather(y)
    if fx != fy:
        father[fx] = fy


for a, b in friends:
    union(a - 1, b - 1)
print(max(Counter([getfather(i) for i in range(N)]).values()))


### FIXED CODE ###

from sys import stdin


input = stdin.readline


N, M = map(int, input().split())
friends = [tuple(map(int, inp.strip().split())) for inp in stdin.read().splitlines()]
father = [-1] * N


def getfather(x):
    if father[x] < 0: return x
    father[x] = getfather(father[x])
    return father[x]


def union(x, y):
    x = getfather(x)
    y = getfather(y)
    if x != y:
        if father[x] > father[y]:
            x,y = y,x
        father[x] += father[y]
        father[y] = x;


for a, b in friends:
    union(a - 1, b - 1)
# print(max(Counter([getfather(i) for i in range(N)]).values()))
print(max([-father[getfather(i)] for i in range(N)] or [0]) )
#おかしの問題
n,m = map(int,input().split())
number = list(int(input().split()))
a = []
#ここから書きかえ
for i in range(n):
    for j in range(n-i):
            b=[]
            for k range(n):
                b.append(number[j+k+1])
            if sum(b)%m == 0:
                a.append(1)
            else:
                pass
print(len(a))

### FIXED CODE ###

n,m = map(int,input().split())
a = list(map(int,input().split()))
check = {};ios = [a[0]%m]*n
for i in range(n-1):
    ios[i+1] = (a[i+1] + ios[i])%m
    check[ios[i]] = 0
check[ios[n-1]] = 0
for i in range(len(ios)):
    check[ios[i]%m] += 1
ans = 0
for i in range(n):
    num = check[ios[i]];check[ios[i]] = 'finish'
    if num == 'finish':continue
    if ios[i] % m == 0:ans += num
    ans += (num * (num - 1))//2
print(ans)
N, M = map(int, input().split())
A = [0]*N
res = True
for m in range(M):
    s, c = map(int, input().split())
    if A[s-1] != 0:
        if A[s-1] != c:
            res = False
            break
    else:
        A[s-1] = c
A = str(A[0]) + str(A[1]) + str(A[2])
if res:
    print(A)
else:
    print('-1')

### FIXED CODE ###

N, M = map(int, input().split())
S = []
C = []
for m in range(M):
    s, c = map(int, input().split())
    S.append(s)
    C.append(c)
cnt = -1
man = False
for n in range(1000):
    num = str(n)
    res = True
    if len(num) != N:
        res = False
        continue
    for m in range(M):
        if num[S[m]-1] != str(C[m]):
            res = False
    if res:
        cnt = int(num)
        man = True
        break
if man:
    print(cnt)
else:
    print(cnt)
import math

a,b,c,d = map(int, input().split())
x = (b//c - (a - 0.1)//c)
y = (b//d - (a - 0.1)//d)
z = (b//((c * d)//math.gcd(c,d)) - (a - 0.1)//((c * d)//math.gcd(c,d)))

print(int((b - a + 1) - (x + y - z)))


### FIXED CODE ###

import fractions

a,b,c,d = map(int, input().split())
x = (b//c - (a - 1)//c)
y = (b//d - (a - 1)//d)
z = (b//((c * d)//fractions.gcd(c,d)) - (a - 1)//((c * d)//fractions.gcd(c,d)))

print(int((b - a + 1) - (x + y - z)))
a = [] 
while True:
    num = int(input())
    if n == 0:
        break 
    a.append(n)
    count = 0
    for i in a:
        count += 1
    print("Case " + str(count) + ":" + str(n))

### FIXED CODE ###

i = 0
while True:
    n = int(input())
    if n == 0: 
        break
    else:
        i += 1
    print("Case " + str(i) + ": " + str(n))
N,A,B = map(int,input().split())
student = input()
passp = 0
passb = 0
for s in student:
	if s == "a":
		if passp < (A+B):
			passp += 1
			print("Yes")
 		else:
			print("No")
	elif s == "b":
		if passp < (A+B) and passb < B:
			passp += 1
			passb += 1
			print("Yes")
		else:
			print("No")
	else:
		print("No")

### FIXED CODE ###

N,A,B = map(int,input().split())
student = input()
passp = 0
passb = 0
ab = (A+B)
for s in student:
	if s == "a":
		if passp < ab:
			passp += 1
			print("Yes")
		else:
			print("No")
	elif s == "b":
		if passp < ab and passb < B:
			passp += 1
			passb += 1
			print("Yes")
		else:
			print("No")
	else:
		print("No")
n = int(input())

input_patterns = []

patterns = {}

def init_key():
    ini_key = []
    for i in range(26):
        ini_key.append(0)
    return ini_key

for i in range(n):
    val = input()
    input_patterns.append(val)

#input_patterns = ['acornistnt', 'peanutbomb', 'constraint']
count = 0
for inp in input_patterns:
#    key = init_key()
    #for j in range(len(inp)):
        # make [0, 0, 1, 0, 2, 3, ...]
        #       a  b  c  d  e  f  
    #    for k in range(26):
    #        if inp[j] == chr(ord('a') + k):
    #            key[k] = key[k] + 1
    
    key = sorted(inp)
    skey = ''

    for k in range(len(key)):
        skey = skey + key[k]

    if skey in patterns:
        patterns[skey] = patterns[skey] + 1
    else:
        patterns[skey] = 1

    if patterns[skey] > 1:
        count = count + patterns[skey] - 1
    
result = 0

#for skey in patterns:
#    if patterns[skey] > 1:
#        for i in range(1, int(patterns[skey])):
#            result = result + i

print('{}'.format(count))


### FIXED CODE ###

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

print('{}'.format(max(a+b, a-b, a*b)))
a = int(input())
b = int(input())

print(['No', 'Yes'][(b % 500) <= a]

### FIXED CODE ###

a = int(input())
b = int(input())
print(['No', 'Yes'][(a % 500) <= b])
N = int(input())
A = [0] + list(map(int, input().split()))

for i in range(N-1, 0, -1):
    tmp = 0
    for t in range(i, N+1, i):
        tmp += A[t]
    if tmp % 2 == i:
        break

ret = []
for i in range(1, tmp+1):
    if i % tmp == 0:
        ret.append(i)
print(len(ret))
print(*ret)

### FIXED CODE ###

N = int(input())
A = [0] + list(map(int, input().split()))

for i in range(N//2, 0, -1):
    # tmp = 0
    # j = i
    # while j < N+1:
    #     tmp += A[j]
    #     j += j
    # A[i] = tmp % 2
    A[i] = sum(A[i::i]) % 2
ans = [i for i, j in enumerate(A) if j == 1]

print(len(ans))
print(*ans)
with open("td3") as f:
    open0read = f.read()
n=list(map(int,open0read.split()))
n.sort(key=lambda x:-((x-1)%10))
print(sum([((x-1)//10+1)*10 for x in n[:-1]]+[n[-1]]))


### FIXED CODE ###

n=list(map(int,open(0).read().split()))
n.sort(key=lambda x:-((x-1)%10))
print(sum([((x-1)//10+1)*10 for x in n[:-1]]+[n[-1]]))
class UnionFind():
    def __init__(self, n):
        self._n = n
        self._table = [-1]*n

    def _root(self, x):
        stack = []
        while self._table[x] >= 0:
            stack.append(x)
            x = self._table[x]
        for y in stack:
            self._table[y] = x
        return x
    
    def unite(self, x, y):
        x, y = self._root(x), self._root(y)
        if x == y:
            return
        if x > y:
            x, y = y, x
        self._table[x] += self._table[y]
        self._table[y] = x
    
    def same(self, x, y):
        return self._root(x) == self._root(y)

    def count_members(self, x):
        return -self._table[self._root(x)]
    
    def count_groups(self):
        return len({self._root(i) for i in range(self._n)})
    
    def __str__(self):
        return str([self._root(i) for i in range(self._n)])
    
    def __repr__(self):           
        return repr([self._root(i) for i in range(self._n)])

n, m, *AB = map(int, open(0).read().split())
uf = UnionFind(n)
for a, b in zip(AB[::2], AB[1::2]):
    uf.unite(a, b)
s = 0
for group in {uf._root(i) for i in range(n)}:
    s += uf.count_members(group)-1
print(s)

### FIXED CODE ###

class UnionFind():
    def __init__(self, n):
        self._n = n
        self._table = [-1]*n

    def _root(self, x):
        stack = []
        while self._table[x] >= 0:
            stack.append(x)
            x = self._table[x]
        for y in stack:
            self._table[y] = x
        return x
    
    def unite(self, x, y):
        x, y = self._root(x), self._root(y)
        if x == y:
            return
        if x > y:
            x, y = y, x
        self._table[x] += self._table[y]
        self._table[y] = x
    
    def same(self, x, y):
        return self._root(x) == self._root(y)

    def count_members(self, x):
        return -self._table[self._root(x)]
    
    def count_groups(self):
        return len({self._root(i) for i in range(self._n)})
    
    def __str__(self):
        return str([self._root(i) for i in range(self._n)])
    
    def __repr__(self):           
        return repr([self._root(i) for i in range(self._n)])

n, m, *AB = map(int, open(0).read().split())
uf = UnionFind(n)
for a, b in zip(AB[::2], AB[1::2]):
    uf.unite(a-1, b-1)
print(max(uf.count_members(group) for group in {uf._root(i) for i in range(n)}))
# -*- coding: utf-8 -*-

import sys

N,P = map(int, raw_input().split())
a = map(int, raw_input().split())

count_0 = 0
count_1 = 0
number = 0

def comb(n,r):
    if n < 0 or r < 0 or n < r:
        return 0
    elif n == 0 or r == 0:
        return 1
    else:
        return comb(n-1,r-1)+comb(n-1,r)

for i in range(N):
    if a[i] % 2 == 0:
        count_0 += 1
    else:
        count_1 += 1

print "count_0 = %d" % count_0
print "count_1 = %d" % count_1

if P == 0:
    if count_1 == 0:
        number = 1
    else:
        for j in range(count_1 /2 +1):
            number += comb(count_1,2*j)
else:
    if count_1 != 0:
        if count_1 % 2 == 0:
            for j in range(1,count_1 / 2):            
                number += comb(count_1,2*j - 1)
        else:
            for j in range(1,count_1/2 + 1):
                number += comb(count_1, 2*j - 1)

if number != 0:
    print "number = %d" % number * (2**count_0)


### FIXED CODE ###

# -*- coding: utf-8 -*-

import sys

N,P = map(int, raw_input().split())
a = map(int, raw_input().split())

count_0 = 0
count_1 = 0
number = 0

def comb(n, r):
    r = min(r, n - r)
    if r == 0: return 1;
    if r == 1: return n;
    numerator = [n - r + i + 1 for i in range(r)]
    denominator  = [i + 1 for i in range(r)]
    for p in range(2, r + 1):
        pivot = denominator[p - 1]
        if pivot > 1:
            offset = (n - r) % p
            for k in range(p - 1, r, p):
                numerator[k - offset] /= pivot
                denominator[k] /= pivot
    result = 1
    for k in range(r):
        if numerator[k] > 1:
            result *= numerator[k]
    return result

for i in range(N):
    if a[i] % 2 == 0:
        count_0 += 1
    else:
        count_1 += 1


if P == 0:
    if count_1 == 0:
        number = 1
    else:
        for j in range(count_1 /2 +1):
            number += comb(count_1,2*j)
else:
    if count_1 != 0:
        if count_1 % 2 == 0:
            for j in range(1,count_1 / 2 + 1):
                number += comb(count_1,2*j - 1)
        else:
            for j in range(1,count_1/2 + 2):
                number += comb(count_1, 2*j - 1)

if number != 0:
    print number * (2**count_0)
else:
    print number
a,b,t = map(int, input.split(" "))
  
  total=0
  
  for i in range(1,20):
    if a*i > t:
      break
    else:
      total += b
  
  print(total)
  
  
  

### FIXED CODE ###

a,b,t = map(int, input().split(" "))

total=int(t/a)*b

print(total)
import math
N=int(input())
s = list( map(int , input().split()) )
ans = s[0]
count = 0
for i in range(1,N):
 ans = math.gcd(ans,s[i])
while i < pow(10,9):
 if ans%2 == 0:
  count +=1
  ans = ans/2
 else:
  break
print(count)

### FIXED CODE ###

import fractions
N=int(input())
s = list( map(int , input().split()) )
ans = s[0]
count = 0
for i in range(1,N):
 ans = fractions.gcd(ans,s[i])
while i < pow(10,9):
 if ans%2 == 0:
  count +=1
  ans = ans/2
 else:
  break
print(count)
import sys


def g(a, b):
    d = abs(a - b)
    return g(d, a) if a % d != 0 else d


def lcm(a, b, gcd):
    return a * b // gcd


for line in sys.stdin:
    a, b = map(int, line.split())
    c = g(a, b)
    print(c, lcm(a, b, c))

### FIXED CODE ###

import sys
 
def gcd(inta, intb):
    large = max(inta, intb)
    small = min(inta,intb)
    mod = large % small
    if mod ==0:
        return small
    else:
        return gcd(small, mod) 
     
def lcm(inta, intb, intgcd):
    return (inta * intb // intgcd)
 
sets = sys.stdin.readlines()
for line in sets:
    a, b = map(int, line.split())
    c = gcd(a, b)
    print(c, lcm(a, b, c))
s = list(input())
sums = sum([int(ss) for ss in s])

if len(s) == 1:
    print(1)
elif sums == len(s):
    print(len(s))
else:
    a = []
    for i in range(len(s)-1):
        if s[i] != s[i+1]:
            a.append(max(i+1, len(s)-i-1))
            
    print(min(a))

### FIXED CODE ###

s = list(input())
l = len(s)
a = [l]
for i in range(len(s)-1):
    if s[i] != s[i+1]:
        a.append(max(i+1, len(s)-i-1))
        
print(min(a))
n = int(input())
a = list(map(int,input().split()))
l = [False]*n
if a[0]==a[1]:
    l[0]=True

a.sort()
#print(a)
for i in range(n-1):
    for j in range(i+1,n):
        if l[j]:
            continue
        if a[j]%a[i]==0:
            l[j]=True
    #print(l)
print(l.count(False))

### FIXED CODE ###


n = int(input())
a = list(map(int,input().split()))+[10**7]
a.sort()
l = [True]*(10**6+1)

ans=0
a.sort()
for i in range(n):
    if l[a[i]]:
        for j in range(a[i],10**6+1,a[i]):
            l[j]=False
        if a[i]!=a[i+1]:
            ans+=1
print(ans)
import bisect
n,k=map(int, input().split())
V=list(map(int, input().split()))
ans=0
for i in range(k+1):
  for j in range(k+1-i):
    if i+j>n:
      break  
    #手に取りだしたもの
    A=sorted(V[:i]+V[n-j:])
    a=min(n-i-j,bisect.bisect_left(A, 0))
    ans=max(ans,sum(S[a:]))
print(ans)

### FIXED CODE ###

import bisect
n,k=map(int, input().split())
V=list(map(int, input().split()))
ans=0
for i in range(k+1):
  for j in range(k+1-i):
    if i+j>n:
      break  
    #手に取りだしたもの
    A=sorted(V[:i]+V[n-j:])
    a=min(k-i-j,bisect.bisect_left(A, 0))
    ans=max(ans,sum(A[a:]))
print(ans)
n = int(input())
ans = 0
ans = (pow(n,2) - n) / 2
if not n 2:
  print(int(ans))
else:
  print(2)

### FIXED CODE ###

n = int(input())
ans = 0
ans = (pow(n,2) - n) // 2
print(ans)
if __name__ == '__main__':
    N = int(input().strip())
    A = list(map(int, input().strip().split(" ")))


    if A[0] != 1 and len(A) == 1:
        print(-1)

    tree = [0] * (sum([2 ** i for i in range(N + 1)]))
    for i, a in enumerate(A[::-1]):
        depth = len(A) - 1 - i
        depth_hierarchy_start_index = sum([2 ** i for i in range(depth)]) if depth != 0 else 0
        depth_hierarchy_end_index = sum([2 ** i for i in range(depth + 1)]) if depth != 0 else 1

        # keisho
        if depth != N:
            for i in range(depth_hierarchy_start_index, depth_hierarchy_end_index):
                if tree[2 * i + 1] != 0 or tree[2 * i + 2] != 0:
                    tree[i] = 2

        # 1 ume
        count = 0
        part = 2
        while True:
            try:
                for i in range(0, 2 ** depth, int(2 ** depth / part) if int(2 ** depth / part) != 0 else 1):
                    if tree[depth_hierarchy_start_index + i] == 0:
                        tree[depth_hierarchy_start_index + i] = 1
                        count += 1
                    if count == a:
                        break
                    part *= 2
                if count == a:
                    break
            except:
                print(-1)

    print(sum([1 if i != 0 else 0 for i in tree]))


### FIXED CODE ###

if __name__ == '__main__':
    H1, M1, H2, M2, K = map(int, input().strip().split(" "))

    diff_min = (H2 - H1) * 60 + M2 - M1
    ans = diff_min - K
    print(ans)
n=input()
a=[]
for i in range(len(n)):
  a.append(int(s[i]))
print("Yes" if int(n)%sum(a)==0 else "No")


### FIXED CODE ###

n=input()
a=[]
for i in range(len(n)):
  a.append(int(n[i]))
print("Yes" if int(n)%sum(a)==0 else "No")