Harryxun/stf_run huggingface dataset:
mport sys

a = []
for line in sys.stdin:
    a.append(line)

for n in a:
    inl=n.split()
    num1=int(inl[0])
    check=1
    list=[]
    while check<=math.sqrt(num1):
        if num1%check==0:
            list.append(check)
        check+=1
    list.sort()
    list.reverse()
    num2=int(inl[1])
    for i in list:
        if num2%i==0:
            gud=i
            break
    lcm=num1*num2/gud
    print gud,lcm

### FIXED CODE ###

import sys
import math

a = []
for line in sys.stdin:
    a.append(line)

for n in a:
    inl=n.split()
    num1=int(inl[0])
    check=1
    list=[]
    while check<=math.sqrt(num1):
        if num1%check==0:
            list.append(check)
            list.append(num1/check)
        check+=1
    list.sort()
    list.reverse()
    num2=int(inl[1])
    for i in list:
        if num2%i==0:
            gud=i
            break
    lcm=num1*num2/gud
    print gud,lcm
from sys import stdin

a = stdin.readline().rstrip().split('/')

if(int(a[]) > 4) print("Heisei")
print("TBD")




### FIXED CODE ###

import sys

a = sys.stdin.readline().rstrip().split('/')

if(int(a[1]) > 4):
    print("TBD")
else:
	print("Heisei")
n =int(input())
ls =list(map(int,input().split()))
if 0 in ls:
	print(0)
else:
	ans = 1
	for a in ls:
		ans *= a
		if ans > 1000000000000000000:
			ans = -1;
			break;
		
print(ans)

### FIXED CODE ###

n =int(input())
ls =list(map(int,input().split()))
if 0 in ls:
	print(0)
else:
	ans = 1
	for a in ls:
		ans *= a
		if ans > 1000000000000000000:
			ans = -1;
			break;
		
	print(ans)
N = int(input())
number = []
    for A in range(1,10):
        for B in range(1,10):
            number.append(A*B)
if N in number :
  print("Yes")
else :
  print("No")

### FIXED CODE ###

N = int(input())
number = []
for a in range(1,10):
    for b in range(1,10):
        number.append(b*a)
if N in number :
    print("Yes")
else :
    print("No")
n = int(input()) #お札の枚数
p = int(input()) #目標金額

x = p//10000
y = (p - x*10000)//5000
z = int((p - x*10000 - y*5000)/1000)
if x+z+y>n:
    x = y = z = -1
print('{} {} {}'.format(x,y,z))

### FIXED CODE ###

n,p = map(int,input().split())
res10000 = res5000 = res1000 = -1
x = y = 0
end = False
for x in range(n+1):
    if end:
        break
    for y in range(n+1-x):
        if x*10000+y*5000+ (n-(x+y))*1000 == p:
            res10000 = x
            res5000 = y
            res1000 = n-(x+y)
            end = True
print('{} {} {}'.format(res10000,res5000,res1000))
"""
import sys
input = sys.stdin.readline
#"""

N=int(input())
A = [list(map(int,input().split())) for _ in [0]*N]

V = {(i,j):0 for i in range(N) for j in range(i+1,N)}
Ef = {(i,j):[] for i in range(N) for j in range(i+1,N)}
for i,B in enumerate(A):
    k1 = (0,B[0])
    for j in range(N-2):
        a1 = B[j+1]-1
        k0 = k1
        k1 = (i,a1) if i<a1 else (a1,i)
        Ef[k0].append(k1)
        V[k1] += 1

q = [k for k in V if V[k] == 0]
ans = 0
rmv = 0
while q:
    qq = []
    for k in q:
        for k2 in Ef[k]:
            V[k2] -= 1
            rmv += 1
            if V[k2] == 0 : qq.append(k2)
    ans += 1
    q = qq
if rmv != N*(N-2) : ans = -1
print(ans)

### FIXED CODE ###

#"""
import sys
input = sys.stdin.readline
#"""
def main():
    def get_key(i,j):
        if i<j: i,j = j,i
        return i*N+j
    N=int(input())
    A = [list(map(int,input().split())) for _ in [0]*N]
    V = [-1]*(N*N)
    for i in range(N):
        for j in range(i+1,N):
            V[get_key(i,j)] = 0
    Ef = [[] for _ in V]

    for i,B in enumerate(A):
        a0 = B[0]-1
        k1 = (i,a0)
        for a1 in B[1:]:
            a1 -= 1
            k0 = k1
            k1 = (i,a1)
            Ef[get_key(*k0)].append(get_key(*k1))
            V[get_key(*k1)] += 1

    q = [i for i,v in enumerate(V) if v == 0]
    ans = 0
    rmv = 0
    while q:
        qq = []
        for i in q:
            for j in Ef[i]:
                V[j] -= 1
                rmv += 1
                if V[j] == 0 : qq.append(j)
        ans += 1
        q = qq
    if rmv != N*(N-2) : ans = -1
    print(ans)
main()
def main():
    #input data
    import sys
    input = lambda:sys.stdin.readline().strip()
    S = input()
    N = len(S)
    #solve
    left = 0
    right = N-1

    ans = 0
    while True:
        if right==left:
            break
        if S[left]==S[right]:
            left+=1
            right-=1
            continue
        if S[left]!='x' and S[right]!='x':
            print(-1);exit()
        if S[left]=='x':
            left+=1
            ans+=1
        if S[right]=='x':
            right-=1
            ans+=1
    print(ans)


if __name__=='__main__':
    main()

### FIXED CODE ###

def main():
    #input data
    import sys
    input = lambda:sys.stdin.readline().strip()
    S = input()
    N = len(S)
    #solve
    left = 0
    right = N-1

    ans = 0
    while left<=right:
        if right==left:
            break
        if S[left]==S[right]:
            left+=1
            right-=1
            continue
        if S[left]!='x' and S[right]!='x':
            print(-1);exit()
        if S[left]=='x':
            left+=1
            ans+=1
        if S[right]=='x':
            right-=1
            ans+=1
    if right>left:
        print(-1)
    else:
        print(ans)


if __name__=='__main__':
    main()
N, K, Q = list(map(int, input().split()))
A = [int(input()) for i in range(Q)]
plus = np.array([A.count(n+1) for n in range(N)])
scores = plus+K-Q
for score in scores:
    if score>0:
        print('Yes') 
    else:
        print('No')

### FIXED CODE ###

import collections
N, K, Q = list(map(int, input().split()))
A = [int(input()) for i in range(Q)]
cs = collections.Counter(A)
for n in range(N):
    if cs[n+1] > Q-K:
        print('Yes')
    else:
        print('No')
N , i = map( int input( ) )
x = N - i + 1
print ( x )


### FIXED CODE ###

N,i=map(int,input().split( ))
count=0

while N>=i:
    count+=1
    N-=1


print(count)
N=int(input())
s=[input() for i in range(N)]
M=int(input())
l=[input() for i in range(M)]
list_str=list(dict.fromkeys(s+l))
s_l=[]
for i in range(len(list_str)):
  s_l.append(s.count(list_str[i])-l.count(list_str[i]))
print(all([i < 0 for i in s_l]))
if(all([i < 0 for i in s_l])):
  t='a'
  while(t==any(s_l)):
    t+='a'
  print(t)
else:print(max(s_l))

### FIXED CODE ###

a,b,c=map(int,input().split())
print('Yes' if (a+b>=c) else 'No')
N = int(input())
H = list(map(int, input().split()))
max = 0

for i in range(N):
  cnt = 0
  if i != N-1:
    now = i
    while H[now] < H[now+1]:
      now += 1
      cnt += 1
    if max < cnt:
      max = cnt
  cnt = 0
  if i != 0:
    now = i
    while H[now] < H[now-1]:
      now -= 1
      cnt += 1
    if max < cnt:
      max = cnt
print(max)

### FIXED CODE ###

N = int(input())
H = list(map(int, input().split()))
H.reverse()
max = 0
cnt = 0
 
for i in range(N-1):
  if H[i] <= H[i+1]:
    cnt += 1
  else:
    cnt = 0
  if cnt > max:
    max = cnt
if cnt > max:
  max = cnt
print(max)
s = input()
n = len(s)

a = s == reversed(a)
s1 = s[:(n-1)//2]
b = s1 == reversed(s1)
s2 = s[(n+3)//2 + 1:]
c = s2 == reversed(s2)

print(['No', 'Yes'][a and b and c])

### FIXED CODE ###

s = input()
n = len(s)
 
a = s == s[::-1]
s1 = s[:(n-1)//2]
b = s1 == s1[::-1]
s2 = s[(n+3)//2 - 1:]
c = s2 == s2[::-1]
 
print(['No', 'Yes'][a and b and c])
import numpy as np

N = int(input())
task = []
for i in range(N):
    a, b =map(int, input().split())
    task.append([a, b])

task = np.array(task)
task = task[np.argsort(task[:, 1])]

time = 0
for i in range(N):
    time += task[i, 0]
    if time > task[i, 1]:
        print("No")
        exit()

print("Yes")

### FIXED CODE ###

import numpy as np

N = int(input())
task = []
for i in range(N):
    a, b =map(int, input().split())
    task.append([a, b])

task = np.array(task)
task = task[np.argsort(task[:, 1])]

time = 0
for i in range(N):
    time += task[i, 0]
    if time > task[i, 1]:
        print("No")
        exit()

print("Yes")
a = int(input)
s = input
if a >= 3200:
  print(s)
else:
  print("red")

### FIXED CODE ###

a = int(input())
s = input()
if a >= 3200:
  print(s)
else:
  print("red")
x,y,z,k = map(int,input().split())
a = list(map(int,input().split()))
b = list(map(int,input().split()))
c = list(map(int,input().split()))

ab_list = []
for a_i in range(x):
    for b_i in range(y):
        ab_list.append(a[a_i]+b[b_i])
ab_list.sort(reverse=True)
sum_list = []
for ab_i in range(k):
    for c_i in range(z):
        sum_list.append(ab_list[ab_i]+c[c_i])
sum_list.sort(reverse=True)
for i in range(k):
    print(sum_list[i])

### FIXED CODE ###

x,y,z,k = map(int,input().split())
a = list(map(int,input().split()))
b = list(map(int,input().split()))
c = list(map(int,input().split()))
a.sort(reverse=True)
b.sort(reverse=True)
c.sort(reverse=True)
sum_list = []
for a_i in range(x):
    for b_i in range(y):
        if a_i*b_i > k:
            break
        for c_i in range(z):
            if a_i*b_i*c_i > k:
                break
            sum_list.append(a[a_i]+b[b_i]+c[c_i])
sum_list.sort(reverse=True)
for i in range(k):
    print(sum_list[i])
X = int(input())
If X >= 30:
print ('Yes')
else:
print('No')


### FIXED CODE ###

X= int(input())
if X >= 30:
 print("Yes")
else:
 print("No")
a=(input())
b=(input())

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

if a>b:
    print ('GREATER')

elif a<b:
    print ('LESS')

else:
    print ('EQUAL')


### FIXED CODE ###

abc = (input())
a,b,c = abc.split()

d = a[0]
e = b[0]
f = c[0]

print ((d+e+f).upper())
import bisect
a, b, q = map(int, input().split())
inf = 10**18
s = [-inf] + [int(input()) for i in range(a)] + [inf]
t = [-inf] + [int(input()) for i in range(b)] + [inf]

for i in range(q):
  x = int(input())
  b, d = bisect.bisect_right(s, x), bisect_right(t, x)
  res = inf
  for S in [s[b-1], s[b]]:
    for T in [t[b-1], t[b]]:
      d1, d2 = abs(S-x) + abs(T-S), abs(T-x) + abs(S-T)
      res = min(d1, d2, res)
  print(res)

### FIXED CODE ###

import bisect
a, b, q = map(int, input().split())
inf = 10**18
s = [-inf] + [int(input()) for i in range(a)] + [inf]
t = [-inf] + [int(input()) for i in range(b)] + [inf]

for i in range(q):
  x = int(input())
  b, d = bisect.bisect_right(s, x), bisect.bisect_right(t, x)
  res = inf
  for S in [s[b-1], s[b]]:
    for T in [t[d-1], t[d]]:
      d1, d2 = abs(S-x) + abs(T-S), abs(T-x) + abs(S-T)
      res = min(d1, d2, res)
  print(res)
s = []
s_conn = []
for i in range(h):
  s.append(input())
  s_conn.append([[0]*2 for j in range(w)])
 
# 縦にみる
for x in range(w):
  start = 0
  count = 0
  for y in range(h):
    if s[y][x] == '.':
      count += 1
      if y == h-1:
        for i in range(start, y):
          s_conn[i][x][0] = count
    else:
      for i in range(start, y):
        s_conn[i][x][0] = count
      count = 0
      start = y+1
 
# 横にみる
for y in range(h):
  start = 0
  count = 0
  for x in range(w):
    if s[y][x] == '.':
      count += 1
      if x == w-1:
        for i in range(start, x):
          s_conn[y][i][1] = count
    else:
      for i in range(start, x):
        s_conn[y][i][1] = count
      count = 0
      start = x+1

max_all = 0
for i in range(h):
  max_tmp = max(map(sum, s_conn[i]))
  if max_tmp > max_all:
    max_all = max_tmp
print(max_all - 1)

### FIXED CODE ###

h, w = map(int, input().split())
s = []
l = []
r = []
u = []
d = []
for i in range(h):
  s.append(input())
  l.append([0 for j in range(w)])
  r.append([0 for j in range(w)])
  u.append([0 for j in range(w)])
  d.append([0 for j in range(w)])
  
# lみる
for x in range(w):
  for y in range(h):
    if s[y][x] == '.':
      if x == 0:
        l[y][x] = 1
      else:
        l[y][x] = l[y][x-1] + 1
 
# rみる
for x in range(w-1, -1, -1):
  for y in range(h-1, -1, -1):
    if s[y][x] == '.':
      if x == w-1:
        r[y][x] = 1
      else:
        r[y][x] = r[y][x+1] + 1
 
# uみる
for y in range(h):
  for x in range(w):
    if s[y][x] == '.':
      if y == 0:
        u[y][x] = 1
      else:
        u[y][x] = u[y-1][x] + 1
 
# dみる
for y in range(h-1, -1, -1):
  for x in range(w-1, -1, -1):
    if s[y][x] == '.':
      if y == h-1:
        d[y][x] = 1
      else:
        d[y][x] = d[y+1][x] + 1
 
 
max_all = 0
for y in range(h):
  for x in range(w):
    max_tmp = l[y][x] + r[y][x] + u[y][x] + d[y][x]
    if max_tmp > max_all:
      max_all = max_tmp
      
print(max_all - 3)
print(sum([int(i)for i in range(1,int(input()+1))]))

### FIXED CODE ###

print(sum([int(i)for i in range(1,int(input())+1)]))
N = int(input())

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

#0の数がN-1になった時点で終了
#Aの中のminを割り出しそれのmodをA内でとるを繰り返す

mina = 0
while(1):
    if(len(A)==1):break
    mina = min(A)
    minaind = A.index(mina)
    delind =[]
    for i in range(0,len(A)):
        # print(A,minaind)
        if i == minaind:continue
        # print(i)
        A[i]%=mina
        if A[i] <= 0: delind.append(A.index(A[i]))
    for i in delind:
        del(A[i])

print(A[0])

### FIXED CODE ###

N = int(input())

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

#0の数がN-1になった時点で終了
#Aの中のminを割り出しそれのmodをA内でとるを繰り返す

mina = 0
while(1):
    if(len(A)==1):break
    mina = min(A)
    minaind = A.index(mina)
    delind =[]
    for i in range(0,len(A)):
        # print(A,minaind)
        if i == minaind:continue
        # print(i)
        A[i]%=mina
        # if A[i] <= 0: delind.append(i)
    B=[]
    for i in range(0,len(A)):
        if(A[i]>0):
            B.append(A[i])
            
    A = B

print(A[0])
N=int(input())
l1=list(map(int,input().split()))
ans=0
h=0
for i in range(N):
  if h<=l[i]:
    ans+=1
    h=max(h,l[i])
print(ans)

### FIXED CODE ###

N=int(input())
l1=list(map(int,input().split()))
ans=0
h=0
for i in range(N):
  if h<=l1[i]:
    ans+=1
    h=max(h,l1[i])
print(ans)
a = int(input())
b = list(map(int,input().split()))
c = 1
ans = 0
for i in range b:
    if i == c:
        c += 1
    else:
        ans += 1
if ans == a:
    ans = -1
print(ans)

### FIXED CODE ###

a = int(input())
b = list(map(int,input().split()))
c = 1
ans = 0
for i in b:
    if i == c:
        c += 1
    else:
        ans += 1
if ans == a:
    ans = -1
print(ans)
6 727202214173249351
6 5 2 5 3 2

### FIXED CODE ###

from collections import deque
n,k=map(int, input().split())

A = deque(map(int, input().split()))
li = []
li2 = [0]*n
li.append(1)

next = 0

t=0
rep = False

for i in range(k):
    if i == k:
        print(next+1)
        exit()

    if li2[next] == 1:
        t = li.index(next+1)
        rep = True
        li.pop()
        break

    li.append(A[next])
    li2[next] = 1
    next = A[next]-1


tmp = (k-t)%len(li[t:])
print(li[tmp+t])
from math import log2 as log
a,b=map(int,input().split())
r,l=int(log(a))+1,int(log(b))
if a==b:print(a);exit()
ans=pow(2,l)+int(r==1)
for i in range(a,pow(2,r)):
  ans^=i
for i in range(pow(2,l)+1,b+1):
  ans^=i
print(ans)

### FIXED CODE ###

a,b=map(int,input().split())
c,d=0,0
if a!=0:
  a-=1
  m=(-(-a//2))%2
  c=m if a%2 else m^a
m=m=(-(-b//2))%2
d=m if b%2 else m^b
print(c^d)
a = list(map(int, input()))
a.sort()
print(sum(a[:-1]))

### FIXED CODE ###

a = list(map(int, input().split()))
a.sort()
print(sum(a[:-1]))
import math,string,itertools,fractions,heapq,collections,re,array,bisect,sys,random,time,copy,functools

sys.setrecursionlimit(10**7)
inf = 10**20
mod = 10**9 + 7

def LI(): return [int(x) for x in sys.stdin.readline().split()]
def LI_(): return [int(x)-1 for x in sys.stdin.readline().split()]
def LF(): return [float(x) for x in sys.stdin.readline().split()]
def LS(): return sys.stdin.readline().split()
def I(): return int(sys.stdin.readline())
def F(): return float(sys.stdin.readline())
def S(): return input()


def main():
    H,W,h,w = LI()
    f = False
    if H % h == 0 and W % w == 0:
        return 'No'
    if W % w == 0:
        H,W,h,w = W,H,w,h
        f = True

    p = 10**6*(w-1) - 1
    m = -(10**6)
    a = []
    for i in range(W):
        if i % w == 0:
            a.append(p)
        else:
            a.append(m)
    aa = [a] * H
    r = aa
    if f:
        r = [[aa[i][j] for i in W] for j in H]

    return 'Yes\n' + '\n'.join(' '.join(map(str,t)) for t in r)


print(main())


### FIXED CODE ###

import math,string,itertools,fractions,heapq,collections,re,array,bisect,sys,random,time,copy,functools

sys.setrecursionlimit(10**7)
inf = 10**20
mod = 10**9 + 7

def LI(): return [int(x) for x in sys.stdin.readline().split()]
def LI_(): return [int(x)-1 for x in sys.stdin.readline().split()]
def LF(): return [float(x) for x in sys.stdin.readline().split()]
def LS(): return sys.stdin.readline().split()
def I(): return int(sys.stdin.readline())
def F(): return float(sys.stdin.readline())
def S(): return input()


def main():
    H,W,h,w = LI()
    f = False
    if H % h == 0 and W % w == 0:
        return 'No'
    if W % w == 0:
        H,W,h,w = W,H,w,h
        f = True

    p = 10**6*(w-1) - 1
    m = -(10**6)
    a = []
    for i in range(W):
        if i % w == 0:
            a.append(p)
        else:
            a.append(m)
    aa = [a] * H
    r = aa
    if f:
        r = [[aa[i][j] for i in range(H)] for j in range(W)]

    return 'Yes\n' + '\n'.join(' '.join(map(str,t)) for t in r)


print(main())
N = int(input())
A = int(inout())
print(N**2 - A)

### FIXED CODE ###

N = int(input())
A = int(input())
print(N**2 - A)
import sys
import math
import collections
import bisect
import copy

# import numpy as np

sys.setrecursionlimit(10 ** 9)
INF = 10 ** 16
MOD = 10 ** 9 + 7
# MOD = 998244353

ni = lambda: int(input())
ns = lambda: map(int, sys.stdin.readline().split())
na = lambda: list(map(int, sys.stdin.readline().split()))
na1 = lambda: list(map(lambda x: int(x) - 1, sys.stdin.readline().split()))


# ===CODE===


def main():
    n = ni()
    idxlist = [[] for _ in range(n)]
    d = []
    dp = [INF for _ in range(n + 1)]
    dp[0] = 1

    for i in range(n):
        di = ni()
        di -= 1
        if i > 0:
            if d[-1] == di:
                d.append(-1)
                continue
        d.append(di)
        idxlist[di].append(i)

    for i, di in enumerate(d):
        dp[i + 1] = dp[i]
        if di == -1:
            continue
        bidx = bisect.bisect_left(idxlist[di], i)
        if bidx - 1 >= 0:
            dp[i + 1] += dp[idxlist[di][bidx - 1] + 1]
            dp[i + 1] %= MOD

    print(dp[n])


if __name__ == '__main__':
    main()


### FIXED CODE ###

import sys
import math
import collections
import bisect
import copy

# import numpy as np

sys.setrecursionlimit(10 ** 9)
INF = 10 ** 16
MOD = 10 ** 9 + 7
# MOD = 998244353

ni = lambda: int(sys.stdin.readline())
ns = lambda: map(int, sys.stdin.readline().split())
na = lambda: list(map(int, sys.stdin.readline().split()))
na1 = lambda: list(map(lambda x: int(x) - 1, sys.stdin.readline().split()))


# ===CODE===


def main():
    n = ni()
    last = [-1 for _ in range(2 * 10 ** 5 + 1)]
    dp = [INF for _ in range(n + 1)]
    dp[0] = 1

    d = [ni()-1 for _ in range(n)]

    for i, di in enumerate(d):
        dp[i + 1] = dp[i]
        if last[di] != -1:
            if i - last[di] != 1:
                dp[i + 1] += dp[last[di] + 1]
                dp[i + 1] %= MOD
        last[di] = i

    print(dp[n])


if __name__ == '__main__':
    main()
from itertools import*
from math import*
from collections import*
from heapq import*
from bisect import bisect_left,bisect_right
from copy import deepcopy
inf = float("inf")
mod = 10**9+7
from functools import reduce
import sys
sys.setrecursionlimit(10**7)

N,M = map(int,input().split())
c = [0]*(N+1)
c[0] = 1
c[1] = 1
c[2] = 2
ans = 1
a = []
for i in range(3,N+1):
    c[i] = c[i-1]+c[i-2]
for i in range(M):
    ai = int(input())
    a.append(ai)
for i in range(M-1):
    if a[i+1]-a[i] <= 1:
        print(0)
        exit()
for i in range(M):
    if i == 0:
        ans *= c[a[i]-1]
        ans %= mod
    if i == M-1:
        ans *= c[N-a[i]-1]
        ans %= mod
    else:
        ans *= c[a[i+1]-a[i]-2]
        ans %= mod
print(ans)

### FIXED CODE ###

from itertools import*
from math import*
from collections import*
from heapq import*
from bisect import bisect_left,bisect_right
from copy import deepcopy
inf = float("inf")
mod = 10**9+7
from functools import reduce
import sys
sys.setrecursionlimit(10**7)

N,M = map(int,input().split())
c = [0]*(N+1)
c[0] = 1
c[1] = 1
ans = 1
a = []
al = 0
for i in range(2,N+1):
    c[i] = c[i-1]+c[i-2]
    c[i] %= mod
for i in range(M):
    ai = int(input())
    if i == 0:
        a.append(ai)
    else:
        if ai - al == 1:
            print(0)
            exit()
        else:
            a.append(ai)
    al = ai
if M == 0:
    print(c[N])
    exit()
for i in range(M):
    if i == 0:
        ans *= c[a[i]-1]
        ans %= mod
    if i == M-1:
        ans *= c[N-a[i]-1]
        ans %= mod
    else:
        if a[i+1] != a[i]:
            ans *= c[a[i+1]-a[i]-2]
            ans %= mod
print(ans)
###B - Foods Loved by Everyone
N, M = map(int, input().split())
kaito = []
for i in range(N):
    kaito.append([int(i) for i in input().split()])

cnt = 0
for i in range(1, M+1):
    jlist = []
    for j in range(N):
        if i in kaito[j][1:]:
            jlist.append(True)
        else:
            jlist.append(False)
    if all(jlist):
        cnt += 1
        
print(cnt)

### FIXED CODE ###

###A - B +/- A
A, B = map(int, input().split())
if B % A == 0:
    print(int(A+B))
else:
    print(int(B-A))
n, x = map(int, input().split())
l = list(map(int, input().split()))

cnt = 0
d = 0
while True:
    d += l[cnt]
    cnt += 1
    if d > x or cnt > len(l):
        break
print(cnt)


### FIXED CODE ###

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

ans = 1
d = 0
for i in range(n):
    d += l[i]
    if d <= x:
        ans += 1
print(ans)
def main():
    N, W = map(int, input().split())
    wi, vi = map(int, input().split())
    dp = [0] * wi + [vi] * (W + 1 - wi)
    for _ in range(1, N):
        wi, vi = map(int, input().split())
        for i in range(W, wi - 1, -1):
            t = dp[i - wi] + vi
            if t > dp[i]:
                dp[i] = t
    print(dp[-1])


if __name__ == '__main__':
    main()


### FIXED CODE ###

def printdp(dp):
    return
    print({i:v for i, v in enumerate(dp) if v < 10000})

def main():
    N, W = map(int, input().split())
    wv = [tuple(map(int, input().split())) for _ in range(N)]
    V = sum(v for _, v in wv)
    dp = [0] + [float('inf')] * V
    for wi, vi in wv:
        for i in range(V, vi - 1, -1):
            t = dp[i - vi] + wi
            if t < dp[i]:
                dp[i] = t
    for i in range(V, -1, -1):
        if dp[i] <= W:
            print(i)
            return


if __name__ == '__main__':
    main()
X, Y, A, B, C = map(int, input().split())
P = [int(i) for i in input().split()]
Q = [int(i) for i in input().split()]
R = [int(i) for i in input().split()]
P.sort()
Q.sort()
R.sort()

p, q, r = A - X, B - Y, C - 1
ans = 0

Amin = P[p]
Bmin = Q[q]
Cmax = R[r]
for i in range(C):
    if Cmax <= min(Amin, Bmin):
        break
    else:
        if Amin <= Bmin and p < A:
            ans += Cmax
            r -= 1
            p += 1
            Amin = P[p]
        elif Amin >= Bmin and q < B:
            ans += Cmax
            r -= 1
            q += 1
            Bmin = Q[q]
        Cmax = R[r]
ans += sum(P[p:])+sum(Q[q:])
print(ans)

### FIXED CODE ###

X, Y, A, B, C = map(int, input().split())
P = [int(i) for i in input().split()]
Q = [int(i) for i in input().split()]
R = [int(i) for i in input().split()]
P.sort()
Q.sort()
R.sort()

p, q, r = A - X, B - Y, C - 1
ans = 0

Amin = P[p]
Bmin = Q[q]
Cmax = R[r]
for i in range(C):
    if Cmax <= min(Amin, Bmin):
        break
    else:
        if Amin <= Bmin and p < A:
            ans += Cmax
            r -= 1
            p += 1
            if p < A:
                Amin = P[p]
            else:
                Amin = float("inf")
        elif Amin >= Bmin and q < B:
            ans += Cmax
            r -= 1
            q += 1
            if q < B:
                Bmin = Q[q]
            else:
                Bmin = float("inf")
        Cmax = R[r]
ans += sum(P[p:])+sum(Q[q:])
print(ans)
r = int(input())

return int(r*r)

### FIXED CODE ###

r = int(input())

print(r*r)
r = input()

l = 2*pi*r
s = r*r*pi

print "%.8f %.8f" %(float(l), float(s))

### FIXED CODE ###

import math
 
r = float(input())
    
l = 2*math.pi*r
s = r*r*math.pi
    
print "%.8f %.8f" %(s, l)