Harryxun/stf_run huggingface dataset:
n, m, k = map(int, input().split())
a = list(map(int, input().split()))
b = list(map(int, input().split()))

count = 0
while k > 0:
    for i in range(n+m):
        if a[0] > k and b[0] > k:
            k = 0
            break
        elif b[0] >= a[0]:
            atop = a.pop(0)
            k -= atop
            count += 1
        elif a[0] > b[0]:
            btop = b.pop(0)
            k -= btop
            count += 1

print(count)


### FIXED CODE ###

n,m,k=map(int,input().split())
arr1=list(map(int,input().split()))
arr2=list(map(int,input().split()))
acum1=[0]
for i in range(n): #累積和ai,bjを求める
 acum1.append(acum1[-1]+arr1[i])
acum2=[0]
for i in range(m):
 acum2.append(acum2[-1]+arr2[i])
ans=0
j=m
for i in range(n+1):
 if acum1[i]>k: #ai>Kであれば、どのようにjを選んでもai+bj<=Kとなることはないので探索を終了する
   break
 while acum2[j]>k-acum1[i] and j>0: #各iについて、bj<=K-aiを満たす最大のjを求める
   j-=1
 ans=max(ans,i+j)
print(ans)
import math

a, b = input().split()
n = int(a + b)

if sqrt(n) ** 2 == n:
    print("Yes")
else:
    print("No")


### FIXED CODE ###

import math

a, b = input().split()
n = int(a + b)

if math.floor(math.sqrt(n)) ** 2 == n:
    print("Yes")
else:
    print("No")
(n, a, b) = [int(x) for x in input().split()]

def charSum(s):
    r = 0
    for c in s:
        r += int(c)

ans = sum(list(filter(lambda x: a <= charSum(str(x)) <= b, range(1, n+1))))
print(ans)

### FIXED CODE ###

(n, a, b) = [int(x) for x in input().split()]

def charSum(s):
    r = 0
    for c in s:
        r += int(c)
    return r

ans = sum(list(filter(lambda x: a <= charSum(str(x)) <= b, range(1, n+1))))
print(ans)
n, x = map(int, raw_input().split())

if x == n:
	print 'Yes':
	for i in xrange(1, 2 * n):
		print i
else:
	print 'No'

### FIXED CODE ###

n = input()
s = raw_input()
t = raw_input()



z = n + n
for i in range(0, n + 1):
	if s[-i:] == t[:i]:
		z = min(z, n + n - i)

print z
import sys

def remove_bit(num, i):
    high = (num >> (i + 1)) << i
    low = num & ((1 << i) - 1)
    return high + low

def insert_bit(num1, num2, i):
    high = num1 >> i << (i + 1)
    low = num1 & (-1 + (1 << i))
    insert = num2 & (1 << i)
    return high + insert + low

def solve(N, A, B):
    if N == 1:
        return [A, B]

    r_bit = -1
    for i in range(N):
        if (A >> i) & 1 != (B >> i) & 1:
            r_bit = i
            break
    if r_bit == -1:
        import pdb; pdb.set_trace()

    AA = remove_bit(A, r_bit)
    BB = remove_bit(B, r_bit)

    for i in range(N-1):
        if (AA >> i) & 1 == (BB >i) &1:
            C = (AA & (-1 - (1<<i))) + (~AA & (1 << i))
            break
    A_list = solve(N - 1, AA, C)
    B_list = solve(N - 1, C, BB)

    A_list = list(map(lambda x: insert_bit(x, A, r_bit), A_list))
    B_list = list(map(lambda x: insert_bit(x, B, r_bit), B_list))

    return A_list + B_list


def main(N, A, B):
    if (bin(A).count('1') + bin(B).count('1')) % 2 == 0:
        print('NO')
        sys.exit()

    print('YES')
    ans_list = solve(N, A, B)
    import pdb; pdb.set_trace()

    assert A == ans_list[0]
    assert B == ans_list[-1]
    for i in range(len(ans_list) - 1):
        assert bin(ans_list[i] ^ ans_list[i+1]).count('1') == 1

    for num in ans_list:
        sys.stdout.write('%d '%num)
    print()



if __name__ == '__main__':
    N, A, B = map(int, input().split())
    main(N, A, B)


### FIXED CODE ###

import sys

def remove_bit(num, i):
    high = (num >> (i + 1)) << i
    low = num & ((1 << i) - 1)
    return high + low

def insert_bit(num1, num2, i):
    high = num1 >> i << (i + 1)
    low = num1 & (-1 + (1 << i))
    insert = num2 & (1 << i)
    return high + insert + low

def solve(N, A, B):
    if N == 1:
        return [A, B]

    r_bit = -1
    for i in range(N):
        if (A >> i) & 1 != (B >> i) & 1:
            r_bit = i
            break
    if r_bit == -1:
        import pdb; pdb.set_trace()

    AA = remove_bit(A, r_bit)
    BB = remove_bit(B, r_bit)

    C = -1
    for C in range(2**(N-1)):
        if bin(AA ^ C).count('1') % 2 == 1 and  bin(AA ^ C).count('1') % 2 == 1:
            break
    A_list = solve(N - 1, AA, C)
    B_list = solve(N - 1, C, BB)

    A_list = list(map(lambda x: insert_bit(x, A, r_bit), A_list))
    B_list = list(map(lambda x: insert_bit(x, B, r_bit), B_list))

    return A_list + B_list


def main(N, A, B):
    if (bin(A).count('1') + bin(B).count('1')) % 2 == 0:
        print('NO')
        sys.exit()

    print('YES')
    ans_list = solve(N, A, B)

    assert A == ans_list[0]
    assert B == ans_list[-1]
    for i in range(len(ans_list) - 1):
        assert bin(ans_list[i] ^ ans_list[i+1]).count('1') == 1

    for num in ans_list:
        sys.stdout.write('%d '%num)
    print()



if __name__ == '__main__':
    N, A, B = map(int, input().split())
    main(N, A, B)
n = int(input())
a = sorted(map(int, input().split()), reverse=True)
print(sum(a[0:][::2])-sum(a[1:][::2])

### FIXED CODE ###

n = int(input())
a = sorted(map(int, input().split()))
print(abs(sum(a[0:][::2])-sum(a[1:][::2])))
a = list(map(int,input().split()))
if sum(list) >= 22:
  print('bust')
else:
  print('win')

### FIXED CODE ###

a = list(map(int,input().split()))
if sum(a) >= 22:
    print('bust')
else:
    print('win')
while True:
    e = int(raw_input())
 
    if e == 0: break

    ans = 1e8

    x, y, z = 0, 0, 0

    for z in range(e):
        if z**3 > e: break
        for y in range(e):
            if y**2 + z**3 > e: break
            x = e - y**2 - z**3
            ans = min(ans, x+y+z)

    print ans



### FIXED CODE ###

#!/usr/bin/env python3

from math import sqrt

while True:
    e = int(input())

    if e == 0: break
    z, ans = 0, e

    while z ** 3 <= e:
        y = int(sqrt(e - z**3))
        x = e - y**2 - z**3
        ans = min(ans, x + y + z)
        z += 1

    print(ans)
import math


a, b = map(float, input().split())
times = 0
a = int(a)
b = int(math.float(100 * b))
times = a * b
new_times = times / 100
print(new_times)

### FIXED CODE ###

a,b=input().split()
a=int(a)
b=float(b)*1000
b=int(b)
print(int((a*b)//1000))
A = int(input())
B = int(input())

if A > B:
    print("Alice")
if A == B:
    print("Draw")
if A < B:
    print("Bob")

### FIXED CODE ###

l = input().split()

A = int(l[0])
B = int(l[1])

if A == 1:
    A = 14
if B == 1:
    B = 14
    
if A > B:
    print("Alice")
if A == B:
    print("Draw")
if A < B:
    print("Bob")
N=int(input())
ls_A=list(map(int,input().split()))
ls_A.sort()
ls=[]
for i in range(N):
  if i==0:
    if ls_A[0]!=ls_A[1]:
      ls.append(ls_A[0])
  if i==N-1:
    if ls_A[N-1]!=ls_A[N-2]:
      ls.append(ls_A[N-1]) 
  else:
    if ls_A[i]!=ls_A[i-1] and ls_A[i]!=ls_A[i+1]:
      ls.append(ls_A[i])       
    
ans=0
for i in range(len(ls)):
  for j in range(i):
    if ls[i]%ls[j]==0:
      break
    else:
      continue
  else:
    ans+=1
print(ans)

### FIXED CODE ###

N=int(input())
ls=list(map(int,input().split()))
ls.sort()

#定数倍のやつに＋１する
M=max(ls)
A=[0]*(M+1)
for i in range(N):
  a=M//ls[i]
  for j in range(1,a+1):
    if A[j*ls[i]]<=2:
      A[j*ls[i]]+=1
    
ans=0     
for i in range(len(ls)):
  if A[ls[i]]==1:
    ans+=1
print(ans)
n = int(input())
table[n] = map(int,input().split())
print("{}{}{}".format(max(table[n],min(table[n],sum(table[n])))))


### FIXED CODE ###

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

n = int(input())
A = list(map(int, input().split()))
A.sort()
ama = A[-1]
print(ama, end=' ')
ama2 = (ama + 1)//2
w = bisect.bisect_left(A, ama2)

a = A[w]
b = A[w+1]
if abs(a-ama2) > abs(b-ama2):
    print(b)
else:
    print(a)


### FIXED CODE ###

import bisect

n = int(input())
A = list(map(int, input().split()))
A.sort()
ama = A[-1]
print(ama, end=' ')
ama2 = (ama + 1)//2
w = bisect.bisect_left(A, ama2)

a = A[w-1]
b = A[w]
if abs(a-ama2) > abs(b-ama2):
    print(b)
else:
    print(a)
from math import gcd
MOD = 10**9+7

def LCM(n,r):
    return ((n*r) * pow(gcd(n,r), MOD-2,MOD)) % MOD
    
N = int(input())
A = list(map(int,input().split()))
lcm = LCM(A[0],A[1])
for i in range(1,N):
    lcm = LCM(lcm,A[i])

ans = 0
for i in range(N):
    ans += lcm * pow(A[i],MOD-2,MOD)
    ans %= MOD
print(ans)


### FIXED CODE ###

from collections import Counter
MOD = 10**9+7
N = int(input())
A = list(map(int,input().split()))
def prime_factorize(n):
    N = 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
prime = [0] * (10**6+5)
for i in range(N):
    c = Counter(prime_factorize(A[i]))
    for j in c.items():
        prime[j[0]] = max(j[1],prime[j[0]])
lcm = 1
for i in range(10**6+2):
    if prime[i] > 0:
        lcm *= pow(i,prime[i])
        lcm %= MOD

ans = 0
for i in range(N):
    ans += lcm * pow(A[i],MOD-2,MOD)
    ans %= MOD
print(ans)
def main():
    A = [list(map(int,input().split(" "))) for i in range(3)]
    N = int(input())
    b_list = [int(input()) for _ in range(N)]

    for i in range(3):
        for j in range(3):
            for b in b_list:
                if(A[i][j] == b):
                    A[i][j] = 0

    flag = False
    for i in range(3):
        for j in range(3):
                if(j+2 < 3 and A[i][j] == 0 and A[i][j+1] == 0 and A[i][j+2] == 0):
                    flag = True
                    break
                if(i+2 < 3 and A[i][j] == 0 and A[i+1][j] == 0 and A[i+2][j] == 0):
                    flag = True
                    break
                if(i+2 < 3 and j+2 < 3 and A[i][j] == 0 and A[i+1][j+1] == 0 and A[i+2][j+2] == 0):
                    flag = True
                    break
                if(i-2 >= 0 and j-2 >= 0 and A[i][j] == 0 and A[i-1][j-1] == 0 and A[i-2][j-2] == 0):
                    flag = True
                    break
                if(i-2 >= 0 and j+1 < 3 and A[i][j] == 0 and A[i-1][j+1] == 0 and A[i-2][j+2] == 0):
                    flag = True
                    break
                if(i+2 < 3 and j-2 >= 0 and A[i][j] == 0 and A[i+1][j-1] == 0 and A[i+2][j-2] == 0)
        if(flag):
            break

    if(flag):
        print("Yes")
    else:
        print("No")

if __name__ == "__main__":
    main()

### FIXED CODE ###

def main():
    A = [list(map(int,input().split(" "))) for i in range(3)]
    N = int(input())
    b_list = [int(input()) for _ in range(N)]

    for i in range(3):
        for j in range(3):
            for b in b_list:
                if(A[i][j] == b):
                    A[i][j] = 0

    flag = False
    for i in range(3):
        for j in range(3):
                if(j+2 < 3 and A[i][j] == 0 and A[i][j+1] == 0 and A[i][j+2] == 0):
                    flag = True
                    break
                if(i+2 < 3 and A[i][j] == 0 and A[i+1][j] == 0 and A[i+2][j] == 0):
                    flag = True
                    break
                if(i+2 < 3 and j+2 < 3 and A[i][j] == 0 and A[i+1][j+1] == 0 and A[i+2][j+2] == 0):
                    flag = True
                    break
                if(i-2 >= 0 and j-2 >= 0 and A[i][j] == 0 and A[i-1][j-1] == 0 and A[i-2][j-2] == 0):
                    flag = True
                    break
                if(i-2 >= 0 and j+2 < 3 and A[i][j] == 0 and A[i-1][j+1] == 0 and A[i-2][j+2] == 0):
                    flag = True
                    break
                if(i+2 < 3 and j-2 >= 0 and A[i][j] == 0 and A[i+1][j-1] == 0 and A[i+2][j-2] == 0):
                    flag = True
                    break
        if(flag):
            break

    if(flag):
        print("Yes")
    else:
        print("No")

if __name__ == "__main__":
    main()
char_list = list(input())
print(char_list)
char_list_num = len(char_list)
count_list = [0] * char_list_num

def f(first_char,n):
    if first_char == char_list[n+1]:
        return f(first_char,n+1)
    else:
        return n+1

def f2(first_char,n):
    if first_char == char_list[n-1]:
        return f2(first_char,n-1)
    else:
        return n-1

for i in range(char_list_num):
    if char_list[i] == 'R':
        reach_loop_num = f(char_list[i],i)
        decided_num = reach_loop_num - i
        if decided_num % 2 == 0:
            count_list[reach_loop_num-1] += 1
        else:
            count_list[reach_loop_num] += 1
    else:
        reach_loop_num = f2(char_list[i],i)
        decided_num = reach_loop_num - i
        if decided_num % 2 == 0:
            count_list[reach_loop_num+1] += 1
        else:
            count_list[reach_loop_num] += 1
print(' '.join(map(str,count_list)))

### FIXED CODE ###

import sys
sys.setrecursionlimit(1000000000)
char = list(input())
char_list_num = len(char)
count_list = [0] * char_list_num

def f(first_char,n,add_num):
    if first_char == char[n+add_num] and n + add_num != char_list_num - 1:
        return f(first_char,n+add_num,add_num)
    else:
        return n+add_num

num = 0
while not num == char_list_num - 1:
    reach_loop_num = f(char[num],num,1)
    diff = reach_loop_num - num
    if reach_loop_num == char_list_num - 1:
        if char[num] == char[reach_loop_num]:
            diff += 1
        else:
            count_list[reach_loop_num] += 1
    if char[num] == 'R':
        if diff % 2 == 0:
            count_list[reach_loop_num] += int(diff/2)
            count_list[reach_loop_num-1] += int(diff/2)
        else:
            count_list[reach_loop_num] += int(diff/2)
            count_list[reach_loop_num-1] += int(diff/2) +1
    else:
        if diff % 2 == 0:
            count_list[num] += int(diff/2)
            count_list[num-1] += int(diff/2)
        else:
            count_list[num] += int(diff/2) +1
            count_list[num-1] += int(diff/2)
    num = reach_loop_num
print(' '.join(map(str,count_list)))
n = int(input())
x = list(map(int, input().split()))

def naive(x):
    return [median(x[:i] + x[i+1:]) for i in range(len(x))]
  
for i in naive(x):
  print(i)

### FIXED CODE ###

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

y = sorted(x)
a = y[len(x)//2]
b = y[(len(x)//2) - 1]

for i in range(n):
    if x[i] <= b:
        print(a)
    else:
        print(b)
N,K = map(int,input().split())
A = [0]+list(map(int,input().split()))
dp = [False]*(N+1)
tele = 0
# 同じものが出てきた時
for i in range(10**5):
    if i == 0:
        tele = 1
        dp[1] = True
    else:
        tele = A[tele]
        if dp[tele] == False:
            dp[tele] = True
        else:
            finish = i
            tele1 = tele
            break
tele = 0
# 始めてループの数が現れる時
for i in range(10**5):
    if i == 0:
        tele = 1
        if tele == tele1:
            start = i
            break
    else:
        tele = A[tele]
        if tele == tele1:
            start = i
            break
loop = finish-start
if K<start:
    ans = 0
    for i in range(K+1):
        if i==0:
            ans = 1
        else:
            ans = A[ans]
else:
    ans = 0
    for i in range((K-start)%(finish-start)+1):
        if i == 0:
            ans = tele1
        else:
            ans = A[ans]
print(ans)

### FIXED CODE ###

N,K = map(int,input().split())
A = [0]+list(map(int,input().split()))
dp = [False]*(N+1)
tele = 0
for i in range(10**6):
    if i==0:
        tele = 1
        dp[tele]=True
    else:
        tele = A[tele]
        if dp[tele]==True:
            finish = i
            tele1 = tele
            break
        else:
            dp[tele]=True
#print(finish)
#print(tele)
tele = 0
for i in range(10**6):
    if i == 0:
        tele = 1
        if tele == tele1:
            start = i
            break
    else:
        tele = A[tele]
        if tele == tele1:
            start = i
            break
#print(start)
loop = finish-start
if K<=start:
    ans = 1
    for i in range(K):
        ans = A[ans]
    print(ans)
else:
    ans = 1
    for i in range(start+(K-start)%loop):
        ans = A[ans]
    print(ans)
import math
mod = (10**9) + 7

def kaijo(n):
    result = 1
    for i in reversed(range(1,n+1)):
        result = (result * i) % mod
    return result
def combinations_count(n, r):
    return (kaijo(n)) //(kaijo(n - r) * kaijo(r))

def nCk(n, k):
    ret = 1
    mo = 10**9 + 7
    for i in range(k):
        ret = ret * (n - i) * pow(i + 1, mo - 2, mo) % mo
    return ret


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

if (X+Y)%3 == 0:
    flag = False
    if X > Y:
        diff = X - Y
        all_num = (X+Y)//3
        count_2 = (X+Y)//2 - diff//2 - all_num
        if X > Y*2:
            flag = True
    elif Y > X:
        diff = Y - X
        all_num = (X+Y)//3
        count_2 = (X+Y)//2 - diff//2　- all_num
        if Y > X*2:
            flag = True
    else:
        all_num = (X+Y)//3
        count_2 = all_num//2
    if flag:
        print(0)
    else:
        print(nCk(all_num,count_2))
else:
    print(0)


### FIXED CODE ###

import math
mod = (10**9) + 7

def kaijo(n):
    result = 1
    for i in reversed(range(1,n+1)):
        result = (result * i) % mod
    return result
def combinations_count(n, r):
    return (kaijo(n)) //(kaijo(n - r) * kaijo(r))

def nCk(n, k):
    ret = 1
    mo = 10**9 + 7
    for i in range(k):
        ret = ret * (n - i) * pow(i + 1, mo - 2, mo) % mo
    return ret


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

if (X+Y)%3 == 0:
    flag = False
    if X > Y:
        diff = X - Y
        all_num = (X+Y)//3
        count_2 = Y - all_num
        if X > Y*2:
            flag = True
    elif Y > X:
        diff = Y - X
        all_num = (X+Y)//3
        count_2 = X - all_num
        if Y > X*2:
            flag = True
    else:
        all_num = (X+Y)//3
        count_2 = all_num//2
    if flag:
        print(0)
    else:
        print(nCk(all_num,count_2))
else:
    print(0)
print(len(set(input().split()))

### FIXED CODE ###

s = set(input().split())
print(len(s))
n,k = map(int, input().split())
from fractions import gcd

if n % k== 0:
  print 0
else:
  print gcd(n,k)

### FIXED CODE ###

n,k = map(int, raw_input().split())
from fractions import gcd

if n % k== 0:
  print 0
else:
  mini = n
  s = set()
  while True:
    if n > k:
      n = n % k
    else:
      n = abs(n-k)
    mini = min(n, mini)
    if n in s:
      print mini
      break
    s.add(n)
n = int(input())
s = [input() for _ in range(n)]

ans = 0
a = 0
for b in range(n):
    flag = 0
    for i in range(n):
        if flag == 1:
            break
        for j in range(n):
            if s[(i+a)%n][(j+b)%n] != s[(j+a)%n][(i+b)%n]:
                flag = 1
                break
    else:
        ans += n

print(ans)

### FIXED CODE ###

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

b = []
bn = 0
for i in range(n):
    bn += a[i]
    b.append(bn)
b.append(0)

b.sort()
num = []
i = 0
count = 0
for j in range(1, n+1):
    if b[i] == b[j]:
        count += 1
        if j == n:
            num.append(count)
    else:
        i = j
        num.append(count)
        count = 0

ans = 0
for i in num:
    ans += ((i+1) * i // 2)
print(ans)
while True:
	n,m=map(int, raw_input().split())
	if n==0:break
	c=sorted(map(int,raw_input().split()))[::-1]
#	if m > n:
#		print sum(c)
#	else:
#		c[m-1::m] = [0 for i in range(m-1,n,m)]
#		print sum(c)
	

### FIXED CODE ###

# try-except is necessary for avoiding Runtime Error 
while 1:
	try:
		n,m=map(int,raw_input().split())
		if n==0:break
		v=sorted(map(int,raw_input().split()))[::-1]
		for i in range(m-1,n,m):
			v[i]=0
		print sum(v)
	except:
		pass
import collections

N = int(input())
A = list(map(int, input().split()))  # (N,)
Q = int(input())
B, C = zip(*[list(map(int, input().split())) for _ in range(Q)])  # (Q,), (Q,)

value_count_map = collections.defaultdict(int)
value_sum_map = collections.defaultdict(int)
for a in A:
    value_count_map[a] += 1
    value_sum_map[a] += a

for b, c in zip(B, C):
    b_cnt = value_count_map[b]
    value_count_map[c] += b_cnt
    value_sum_map[c] += c * b_cnt
    if b in value_count_map:
        del value_count_map[b]
        del value_sum_map[b]
    print(sum(v for v in value_sum_map.values()))


### FIXED CODE ###

import collections

N = int(input())
A = list(map(int, input().split()))  # (N,)
Q = int(input())
B, C = zip(*[list(map(int, input().split())) for _ in range(Q)])  # (Q,), (Q,)

cur_sum = 0
value_count_map = collections.defaultdict(int)
for a in A:
    cur_sum += a
    value_count_map[a] += 1

for b, c in zip(B, C):
    b_cnt = value_count_map.get(b, 0)
    value_count_map[b] = 0
    value_count_map[c] += b_cnt
    cur_sum += (b_cnt * (c - b))
    print(cur_sum)
from collections import deque
import numpy as np

H,W = [int(zz) for zz in input().split()]
map = [['#']*(W+2) for _ in range(H+2)]

ans = 0
for i in range(1,H+1):
    tmp = input()
    s = list('#'+tmp+'#')
    map[i] = s
    ans += tmp.count('#')

check = [[1]*(W+2) for _ in range(H+2)]
count = [[0]*(W+2) for _ in range(H+2)]
q = deque([(1,1)])
check[1][1] = 0
while q:
    x,y = q.popleft()
    for i,j in [(1,0),(0,1),(-1,0),(0,-1)]:
        if check[x+i][y+j] and map[x+i][y+j] == '.':
            check[x+i][y+j] = 0
            q.append((x+i,y+j))
            count[x+i][y+j] = count[x][y]+1
zz = count[H][W]
if zz == 0:
    print(-1)
else:
    count = set((np.array(count)).flatten())
    for i in count:
        if i > zz:
            ans -= 1
    print(H*W-len(count)-ans)


### FIXED CODE ###

from collections import deque
import numpy as np

H,W = [int(i) for i in input().split()]
l = [list(input()) for _ in range(H)]
check = [[False]*W for _ in range(H)]
ans = [[0]*W for _ in range(H)]

q = deque()
q.append([0,0])
check[0][0] = True

while q:
    i,j = q.popleft()
    for next_i, next_j in [[i+1,j], [i-1,j], [i,j+1], [i,j-1]]:
        if 0 <= next_i < H and 0 <= next_j < W:
            if not check[next_i][next_j] and l[next_i][next_j] != '#':
                q.append([next_i,next_j])
                check[next_i][next_j] = True
                ans[next_i][next_j] = ans[i][j]+1

cnt = 0
for i in range(H):
    for j in range(W):
        if l[i][j] == '.':
            cnt += 1

if ans[H-1][W-1]:
    print(cnt-ans[H-1][W-1]-1)
else:
    print(-1)
import sys
def main():
  input = sys.stdin.readline
  h, w = map(int, input().split())
  A = []
  AB = []
  A_append = A.append
  AB_append = AB_append
  for i in range(h):
    row = list(map(int, input().split()))
    A_append(row)
  for i in range(h):
    row = [abs(A[i][j] - int(b)) for j, b in enumerate(input().split())]
    AB_append(row)
 
  dp = [[set([]) for j in range(w+1)] for i in range(h+1)]
  dp[0][0].add(AB[0][0])
  for i in range(h):
    for j in range(w):
      dif1 = 0
      dif2 = 0
      if j < w - 1:
        add1 = dp[i][j+1].add
        dif1 = AB[i][j+1]
      if i < h - 1:
        add2 = dp[j+1][i].add
        dif2 = AB[i+1][j]
      for item in dp[i][j]:
        if j < w - 1:
          add1(item+dif1)
          add1(abs(item-dif1))
        if i < h - 1:
          add2(item+dif2)
          add2(abs(item-dif2))
  print(min(dp[h-1][w-1]))
if __name__ == '__main__':
  main()


### FIXED CODE ###

import sys
def main():
  input = sys.stdin.readline
  h, w = map(int, input().split())
  A = []
  AB = []
  A_append = A.append
  AB_append = AB.append
  for i in range(h):
    row = list(map(int, input().split()))
    A_append(row)
  for i in range(h):
    row = [abs(A[i][j] - int(b)) for j, b in enumerate(input().split())]
    AB_append(row)
 
  dp_cur = [set([]) for _ in range(w)]
  dp_cur[0].add(AB[0][0])
  for i in range(h):
    dp_next = [set([]) for _ in range(w)]
    for j in range(w):
      if j < w - 1:
        add1 = dp_cur[j+1].add
        dif1 = AB[i][j+1]
      if i < h - 1:
        add2 = dp_next[j].add
        dif2 = AB[i+1][j]
      for item in dp_cur[j]:
        if j < w - 1:
          add1(item+dif1)
          add1(abs(item-dif1))
        if i < h - 1:
          add2(item+dif2)
          add2(abs(item-dif2))
    if i == h - 1:
      break
    dp_cur = dp_next
  print(min(dp_cur[w-1]))
if __name__ == '__main__':
  main()
text=input()
N=text

temp4=[4*i for i in range(25)]
temp7=[7*i for i in range(14)]

temp=list()
flg=False
for i in temp4:
    for j in temp7:
        temp.append(i+j)
        if int(N)==i+j:
            flg=True
            print("Yes")

if flg:
    pass
else:
    print("No")

### FIXED CODE ###

text=input()
N=int(text.split(" ")[0])
K=int(text.split(" ")[1])

if (N%K)!=0:
    print(1)
else:
    print(0)