Harryxun/stf_run huggingface dataset:
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Sun May  3 16:22:00 2020

@author: neb0123
"""

def maxProductSubarrayOfSizeK(A, n, k): 
  
    # sorting given input array 
    A.sort() 
  
    # variable to store final product of  
    # all element of sub-sequence of size k 
    product = 1
  
    # CASE I 
    # If max element is 0 and 
    # k is odd then max product will be 0 
    if (A[n - 1] == 0 and (k & 1)): 
        return 0
  
    # CASE II 
    # If all elements are negative and 
    # k is odd then max product will be 
    # product of rightmost-subarray of size k 
    if (A[n - 1] <= 0 and (k & 1)) : 
        for i in range(n - 1, n - k - 1, -1): 
            product *= A[i] 
        return product 
  
    # else 
    # i is current left pointer index 
    i = 0
  
    # j is current right pointer index 
    j = n - 1
  
    # CASE III 
    # if k is odd and rightmost element in 
    # sorted array is positive then it 
    # must come in subsequence 
    # Multiplying A[j] with product and 
    # correspondingly changing j 
    if (k & 1): 
        product *= A[j] 
        j-= 1
        k-=1
  
    # CASE IV 
    # Now k is even. So, Now we deal with pairs 
    # Each time a pair is multiplied to product 
    # ie.. two elements are added to subsequence  
    # each time. Effectively k becomes half 
    # Hence, k >>= 1 means k /= 2 
    k >>= 1
  
    # Now finding k corresponding pairs to get 
    # maximum possible value of product 
    for itr in range( k) : 
  
        # product from left pointers 
        left_product = A[i] * A[i + 1] 
  
        # product from right pointers 
        right_product = A[j] * A[j - 1] 
  
        # Taking the max product from two  
        # choices. Correspondingly changing 
        # the pointer's position 
        if (left_product > right_product) : 
            product *= left_product 
            i += 2
          
        else : 
            product *= right_product 
            j -= 2
  
    # Finally return product 
    return product

if __name__ == "__main__":
    N,K = map(int, input().split(' '))
    A = list(map(int,input().split(' ')))
    print(maxProductSubarrayOfSizeK(A,N,K) % (10**9 + 7))

### FIXED CODE ###

def solution(N):
    if N % 1000 == 0: return 0
    return 1000 - (N % 1000)

if __name__ == "__main__":
    N = int(input())
    print(solution(N))
n,k,q=map(int,input().split())
a=[int(input()) for _ in range(q)]
point=[-k]*n
for i in range(q):
  point[a[i]]+=1
for i in range(n):
  if point[i]>-2*k+q:
    print('Yes')
  else:
    print('No')
    
  


### FIXED CODE ###

n,k,q=map(int,input().split())
a=[int(input()) for _ in range(q)]
point=[-k]*n
for i in range(q):
  point[a[i]-1]+=1
for i in range(n):
  if point[i]>-2*k+q:
    print('Yes')
  else:
    print('No')
def gcd(a, b):
    while b > 0:
        a, b = b, a % b
    return a

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

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

ans = T[0]

for t in T[1:]:
    ans = lcm(t, ans)

print(ans)

### FIXED CODE ###

def gcd(a, b):
    if a < b:
        a, b = b, a
    while b > 0:
        a, b = b, a % b
    return a

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

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

ans = T[0]

for t in T[1:]:
    ans = lcm(ans, t)

print(ans)
a =  input("Enter a number:")
print(a + (a**2) + (a**3))

### FIXED CODE ###



a = int(input("\n"))

if 1 <= a <= 10:
    print(int(a + (a**2) + (a**3)))
INF = 10**6 + 1

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

a_l=[]
b_l=[]
c_l=[]

for i in range(M):
    a,b,c=map(int,raw_input().split())
    a_l.append(a-1)
    b_l.append(b-1)
    c_l.append(c-1)
    

d = [[] for i in range(N)]

for i in range(N):
    for j in range(N):
        if i==j:
            d[i][j].append(0)
        else:
            d[i][j].append(INF)
    

for i in range(M):
    d[a_l[i]][b_l[i]] = min(c_l[i],d[a_l[i]][b_l[i]])
    d[b_l[i]][a_l[i]] = min(c_l[i],d[b_l[i]][a_l[i]])


for i in range(N):
    for j in range(N):
        for k in range(N):
            d[i][j] = min(d[i][j],d[i][k]+d[k][j])
        
ans = M

for i in range(M):
    flag=False
    for j in range(N):
        for k in range(N):
            if d[j][k]==d[j][a[i]]+d[b[i]][k]:
                flag=True
    if flag:
        ans-=1
print ans

### FIXED CODE ###

N,M=list(map(int,input().split()))
e_list = [[] for i in range(N)]
e_list2 = []
for i in range(M):
    a,b,d = list(map(int,input().split()))
    a=a-1
    b=b-1
    e_list[a].append([b,d])
    e_list[b].append([a,d])
    e_list2.append([a,b,d])

dist_list = []
import heapq
for i in range(N):
    vi = i
    min_d_list = [10**27 for i in range(N)]
    min_d_list[vi] = 0
    prev_list = [-1 for i in range(N)]
    q = []
    for i in range(N):
        heapq.heappush(q,[min_d_list[i],i])

    while len(q)>0:
        d,v = heapq.heappop(q)
        for e in e_list[v]:
            v1,d1=e
            if min_d_list[v1]>d+d1:
                min_d_list[v1]=d+d1
                prev_list[v1]=v
                heapq.heappush(q,[d+d1,v1])
    dist_list.append(min_d_list)
count=len(e_list2)
for e in e_list2:
    for i in range(N):
        if dist_list[i][e[0]]+e[2]==dist_list[i][e[1]]:
            count-=1
            break

print(count)
x,y = map(raw_input().split())
x = int(x,16)
y = int(y,16)
if x>y:
	print ">"
elif x<y:
	print "<"
else:
	print"="

### FIXED CODE ###

x,y = map(str,raw_input().split())
x = int(x,16)
y = int(y,16)
if x>y:
	print ">"
elif x<y:
	print "<"
else:
	print "="
a,b = input().split()
if a=='H' xor b=='H':
  print("D")
else:
  print("H")

### FIXED CODE ###

a,b = input().split()
if((a=='H')^(b=='H')):
  print("D")
else:
  print("H")
abcx = input().split(" ")
a = int(abcd[0])
b = int(abcd[1])
c = int(abcd[2])
x = int(abcd[3])
if x <= a:
    print(x)
elif x <= a + b:
    print(a)
else:
    print(2*a + b - x)

### FIXED CODE ###

abcx = input().split(" ")
a = int(abcx[0])
b = int(abcx[1])
x = int(abcx[3])
if x <= a:
    print(x)
elif x <= a + b:
    print(a)
else:
    print(2 * a + b - x)
#!/bin/usr/python3
# -*- coding: utf-8 -*-

N, K = map(int, input().split())
S = list(input())

S[K] = S[K].lower()
S_out = "".join(S)
print(S_out)

### FIXED CODE ###

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

N, K = map(int, input().split())
S = list(input())

S[K-1] = S[K-1].lower()
S_out = "".join(S)
print(S_out)
x,n=map(int,input().split())
if n==0:
  print(x)
else:
  p=list(map(int,input().split()))
  p.sort()
  ans=0
  on=1
  dif=1
  if x in p:
    now=p.index(x)
    while on==1:
      if p[now-dif]!=x-dif:
        ans=x-dif
        on=0
      elif p[now+dif]!=x+dif:
        ans=x+dif
        on=0
      else:
        dif+=1
    print(ans)
  else:
    print(x)

### FIXED CODE ###

x,n=map(int,input().split())
if n==0:
  print(x)
else:
  p=list(map(int,input().split()))
  p.sort()
  ans=0
  on=1
  dif=1
  if x in p:
    now=p.index(x)
    while on==1:
      if now-dif<0:
        ans=x-dif
        on=0
      elif p[now-dif]!=x-dif:
        ans=x-dif
        on=0
      elif now+dif==n:
        ans=x+dif  
        on=0
      elif p[now+dif]!=x+dif:
        ans=x+dif
        on=0
      else:
        dif+=1
    print(ans)
  else:
    print(x)
def extract(string, i):
    split = string.split("01")
    split = split.split("10")
    i += len(split) - 1
    split_concat = "".join(split)
    if "01" in split_concat or "10" in split_concat:
        return extract(split_concat, i)
    else:
        return i * 2

S = input()
print(extract(S,0))


### FIXED CODE ###

S = input()

print(min(S.count('0'), S.count('1')) * 2)
s = input()
l = len(s)
te = [1] * 20000
c = 2019
for i in range(1, len(te)):
    te[i] = te[i-1]*10 % c

ans = 0
for i in range(l-1, -1, -1):
    t = int(s[i])
    if t == 0:
        ans += 1
    for j in range(1, i+1):
        t = t + int(s[i-j])*te[j]
        t = t%c
        if t == 0:
            ans += 1
print(ans)

### FIXED CODE ###

s = input()
l = len(s)
c = 2019
tm = 1
ti = int(s[-1])
co = [0]*2019
co[ti] += 1
for i in range(1, l):
    tm = tm*10 % c
    ti += int(s[l-i-1]) * tm
    ti = ti % c
    co[ti] += 1
if co[0] != 0:
    co[0] += 1
print(sum([i*(i-1)//2 for i in co]))
a,b = (map(int, input().split()))

a+b=k

a//3=m

b//3=n

k//3=r

if m==0 or n==0 or r==0:
  print("Possible")
else:
  print("Impossible")

### FIXED CODE ###

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

if (a+b)%3==0 or a%3==0 or b%3==0: 
  print("Possible")
else:
  print("Impossible")
n,m=map(int,input().split())
a = list(map(int, input().split()))

def gcd(a,b):
    if(b==0):
        return a
    else:
        return gcd(b,a%b)
def lcm(a,b):
    return a*b//gcd(a,b)
b=[0]*n
for i in range(n):
    b[i]=a[i]//2
flag=False
f=False
for i in range(n):
    if(b[i]%2!=b[0]%2):
        flag=True
x=1
if(b[0]%2==0):
    f=True
for i in range(n):
    x=lcm(x,b[i])

if(f):
    l=0
else:
    res=m//x+1
    res//=2
print(x)
if(flag):
    print(0)
else:
    print(res)


### FIXED CODE ###

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

def gcd(a,b):
    if(b==0):
        return a
    else:
        return gcd(b,a%b)

def lcm(a,b):
    return a*b//gcd(a,b)
b=[0]*n
for i in range(n):
    b[i]=a[i]//2
flag=False
f=0
keta=0
buf=b[0]
while(buf%2==0):
    buf/=2
    keta+=1
for i in range(n):
    buf=b[i]
    tmp=0
    while(buf%2==0):
        buf/=2
        tmp+=1
    if(keta!=tmp):
        flag=True
x=1
if(b[0]%2==0):
    f=1
for i in range(n):
    x=lcm(x,b[i])
res=m//x+1
res//=2
#print(x)
if(flag):
    print(0)
else:
    print(res)
N=int(input())
K=int(input())

d=len(str(N)) #桁数
a=int(str(N)[0]) #最上位桁の数
if K==1:
  l=9*(d-1)
  m=a-1
  n=1
  print(int(l+m+n))
  
if K==2:
  l=9**2*(d-1)*(d-2)/2 #最上位0
  m=(a-1)*9*(d-1) #最上位1~a-1 
  for i in range(1,d):
    if int(str(N)[i])!=0:
      n=(int(str(N)[i]))+9*(d-i-1)
      break
  print(int(l+m+n))
  
if K==3:
  l=9**3*(d-1)*(d-2)*(d-3)/6
  m=(a-1)*9**2*(d-1)*(d-2)/2
  for i in range(1,d):
    if int(str(N)[i])!=0:
      n=(int(str(N)[i]))*9*(d-i-1)+9**2*(d-i-1)*(d-i-2)/2
      break
  print(int(l+m+n))

### FIXED CODE ###

N=input()
K=int(input())

dpsm=[[0]*(K+1) for _ in range(len(N))] #dpsm[i][k]
dp=[[0]*(K+1) for _ in range(len(N))]

dpsm[0][0]=1
dpsm[0][1]=int(N[0])-1
dp[0][1]=1

for i in range(1,len(N)):
    for k in range(K-1,-1,-1):
        dpsm[i][k+1]+=dpsm[i-1][k]*9

    
    if N[i]=="0":
        for k in range(K,-1,-1):
            dpsm[i][k]+=dpsm[i-1][k]
            dp[i][k]+=dp[i-1][k]
    else:
        for k in range(K-1,-1,-1):
            dpsm[i][k+1]+=dp[i-1][k]*(int(N[i])-1)
            dp[i][k+1]+=dp[i-1][k]

        for k in range(K,-1,-1):
            dpsm[i][k]+=dpsm[i-1][k]
            dpsm[i][k]+=dp[i-1][k]
          
print(dp[-1][-1]+dpsm[-1][-1])
from collections import Counter
n = int(input())
s = []
for i in range(n):
    s.append(Counter(list(input())))
ans = s.copy()
cnt_ans = 0
while len(s):
    remove_list = []
    cnt = 0
    for i in range(1, len(s)):
        if s[0] == s[i]:
            cnt += 1
            remove_list.append(s[i])
    cnt = int((cnt+1) * (cnt) / 2)
    cnt_ans += cnt
    remove_list.append(s[0])
    for lst in remove_list:
        s.remove(lst)
print(cnt_ans)

### FIXED CODE ###

n = int(input())
s = []
for i in range(n):
    s.append(sorted(list(input())))
cnt_ans = 0
s.sort()
cnt = 0
left = 0
right = 1
while right <= n-1:
    if s[left] == s[right]:
        right += 1
        cnt += 1
    else:
        left, right = right, right+1
        cnt_ans += ((cnt+1)*cnt//2)
        cnt = 0
    if right == n:
        cnt_ans += ((cnt+1)*cnt//2)
print(cnt_ans)
import math
a,b,h,w=map(int,input().split())
deg_a=6*m
deg_b=30*h+m/2
deg_c=abs((deg_a)-(deg_b))
rad=math.radians(deg_c)
c**2=a**2+b**2-2*a*b*math.cos(rad)
print(c**0.5)


### FIXED CODE ###

import math
a,b,h,m=map(int,input().split())
deg_a=6*m
deg_b=30*h+m/2
deg_c=abs((deg_a)-(deg_b))
rad=math.radians(deg_c)
c=a**2+b**2-2*a*b*math.cos(rad)
print(c**0.5)
n = input()
a = map(int, input().split())
new_list = sorted(a, reverse=True)
sum = 0
for i,n in enumerate(new_list):
        if i % 2 == 0:
                sum += n
        else:
                sum -= n
print(sum)
~

### FIXED CODE ###

n = input()
a = map(int, input().split())
new_list = sorted(a, reverse=True)
sum = 0
for i,n in enumerate(new_list):
        if i % 2 == 0:
                sum += n
        else:
                sum -= n
print(sum)
num = map(int, input().split())
A = max(num)
B = min(num)

X = A*B
num = 0
while X >= num:
  num += B
  if 0 == num % A:
    print(num)
    break
  elif X == num:
    print(num)


### FIXED CODE ###

num = [int(i) for i in input().split()]
A = max(num)
B = min(num)

X = A*B
num = 0
while X >= num:
  num += B
  if 0 == num % A:
    print(num)
    break
  elif X == num:
    print(num)
n = int(input())
a = list(map(int,input().split()))
a.sort()
a =set(a)
for idx, i in enumerate(a[:-1]):
    if i == a[idx+1]:
        print('NO')
        break
if idx == n - 2:
    print('YES')

### FIXED CODE ###

n = int(input())
a = list(map(int,input().split()))
a = sorted(a)
flag = True
for idx, i in enumerate(a[:-1]):
    if i == a[idx+1]:
        print('NO')
        flag= False
        break
if flag:
    print('YES')
import numpy as np
n = int(input())
arr = []
for i in range(n-1):
    arr.append([int(s) for s in input().split(" ")])

mmk = np.zeros([n+1,n+1],dtype=int)

childNodeNums = np.zeros(n,dtype=int)
childNodeStatus = [-1 for i in range(n)]


def prepare(n, arr):
    s = [[] for i in range(n)]
    for ar in arr:
        s[ar[0] - 1].append(ar[1] - 1)
        s[ar[1] - 1].append(ar[0] - 1)
    return s


# x为记录入边的颜色
def dfs(currentNode, arr, x):
    childNodes = arr[currentNode]
    if len(childNodes) == 0:
        return

    childNodeNums[currentNode] = childNodeNums[currentNode] + len(arr[currentNode])
    childNodeStatus[currentNode] = 1

    kk = 0
    for i, childNodeIndex in enumerate(childNodes):

        if childNodeStatus[childNodeIndex] == -1:
            kk = kk + 1
            if x == kk:
                kk = kk + 1
            mmk[currentNode+1][childNodeIndex+1] = kk
            dfs(childNodeIndex, arr, kk)




data = prepare(n, arr)
dfs(0, data, -1)

print(max(childNodeNums))

for ar in arr:
    a0 = ar[0]
    a1 = ar[1]
    print(mmk[a0][a1])


### FIXED CODE ###

from sys import setrecursionlimit


def genid(a, b):
    if b < a:
        a, b = b, a
    return a * 100000 + b


def paint(currentNode, usedColor, parentNode, edges, colors):
    color = 1
    for childNode in edges[currentNode]:
        if childNode == parentNode:
            continue
        if color == usedColor:
            color += 1
        colors[genid(currentNode, childNode)] = color
        paint(childNode, color, currentNode, edges, colors)
        color += 1


setrecursionlimit(100000)

N = int(input())
ab = [list(map(int, input().split())) for _ in range(N - 1)]

edges = [[] for _ in range(N)]
for a, b in ab:
    edges[a - 1].append(b - 1)
    edges[b - 1].append(a - 1)

colors = {}
paint(0, -1, -1, edges, colors)

print(max(len(e) for e in edges))
for a, b in ab:
    print(colors[genid(a - 1, b - 1)])
L,R,d=map(int,input().split())
print(R//d - (L-1)//d)ac

### FIXED CODE ###

L,R,d=map(int,input().split())
print(R//d - (L-1)//d)
#D
from collections import deque
h,w=map(int,input().split())
s=[]

for i in range(h):
    s.append(list(input()))
dx=[1,0,-1,0]#東南西北
dy=[0,-1,0,1]
ans=0
def search(i,j):
    if s[i][j]=="#":
        return 0
    max_step=0
    que=deque()
    que.append([i,j])#1現在地
    dist=[[-1 for _ in range(w)] for _ in range (h)]
    #(h,w)
    dist[i][j]=0#現在地は0
    while que:#行き先が無くなるまで
        y,x=que.popleft()#現在地を取り出す(y,x)
        for dir in range(4):
            nx=x+dx[dir]#行き先(nx,xy)
            ny=y+dy[dir]
            if ny<0 or ny>=h or nx<0 or nx>=w or s[ny][nx]=="#":#壁の中
            elif dist[ny][nx]!=-1:#捜索済み
            #未捜索地点"."
            else:
                dist[ny][nx]=dist[y][x]+1#1進む
                que.append([ny,nx])
    out=0
    for i in range(h):
        for j in range(w):
            if dist[i][j]==-1:
                break
            out=max(out,dist[i][j])
    return out

for i in range(h):
    for j in range(w):
        step=search(i,j)#(j,i)の時の最大移動数を求める
        if ans<step:
            ans=step
print(ans)

### FIXED CODE ###

#D
from collections import deque
h,w=map(int,input().split())
s=[]

for i in range(h):
    s.append(list(input()))
dx=[1,0,-1,0]#東南西北
dy=[0,-1,0,1]
ans=0
def search(i,j):
    if s[i][j]=="#":
        return 0
    max_step=0
    que=deque()
    que.append([i,j])#1現在地
    dist=[[-1 for _ in range(w)] for _ in range (h)]
    #(h,w)
    dist[i][j]=0#現在地は0
    while que:#行き先が無くなるまで
        y,x=que.popleft()#現在地を取り出す(y,x)
        for dir in range(4):
            nx=x+dx[dir]#行き先(nx,xy)
            ny=y+dy[dir]
            if ny<0 or ny>=h or nx<0 or nx>=w or s[ny][nx]=="#":#壁の中
                pass#何もしない
            elif dist[ny][nx]!=-1:#捜索済み
                pass
            elif s[ny][nx]==".":
            #未捜索地点"."
                dist[ny][nx]=dist[y][x]+1#1進む
                que.append([ny,nx])
    out=0
    for i in range(h):
        for j in range(w):
            if dist[i][j]==-1:
                pass
            out=max(out,dist[i][j])
    return out

for i in range(h):
    for j in range(w):
        step=search(i,j)#(j,i)の時の最大移動数を求める
        if ans<step:
            ans=step
print(ans)
# UnionFind

# 配列で、子のID番目:(親のID), 親のID番目:(その塊の-サイズ)
# Union Findを使う
class UnionFind:
    def __init__(self, size):
        self.parent_indexes = [-1] * size
        
    def find_parent(self, n):
#         print(self.parent_indexes[n])
        if self.parent_indexes[n] < 0:
            return n
#         print('hewe')
        # 探しているnodeが指し示しているのが現在の親ではない場合、
        # 現在の親に書き換え(memo化)た上で返す
        self.parent_indexes[n] = self.find_parent(self.parent_indexes[n])
        return self.parent_indexes[n] 
    
    def union(self, n1, n2):
        if self.same_group(n1, n2):
            return False
        
        # サイズの大きい方の親が親であり続ける
        if self.size(n1) >= self.size(n2):
            tmp = self.size(n2)
            self.parent_indexes[self.find_parent(n2)] = self.find_parent(n1)
            self.parent_indexes[self.find_parent(n1)] -= tmp
            return True
        
        tmp = self.size(n1)
        self.parent_indexes[self.find_parent(n1)] = self.find_parent(n2)
        self.parent_indexes[self.find_parent(n2)] -= tmp
        return True
        
    
    def size(self, n):
        return -self.parent_indexes[self.find_parent(n)]
    
    def same_group(self, n1, n2):
        return self.find_parent(n1) == self.find_parent(n2)


n, m = map(lambda x: int(x), input().split())
uf = UnionFind(n)

n, m = map(lambda x: int(x), input().split())

uf = UnionFind(n)

for _ in range(m):
    a, b = map(lambda x: int(x), input().split())
    uf.union(a-1, b-1)
    
print(-min(uf.parent_indexes))

### FIXED CODE ###

# UnionFind

# 配列で、子のID番目:(親のID), 親のID番目:(その塊の-サイズ)
# Union Findを使う
class UnionFind:
    def __init__(self, size):
        self.parent_indexes = [-1] * size
        
    def find_parent(self, n):
#         print(self.parent_indexes[n])
        if self.parent_indexes[n] < 0:
            return n
#         print('hewe')
        # 探しているnodeが指し示しているのが現在の親ではない場合、
        # 現在の親に書き換え(memo化)た上で返す
        self.parent_indexes[n] = self.find_parent(self.parent_indexes[n])
        return self.parent_indexes[n] 
    
    def union(self, n1, n2):
        if self.same_group(n1, n2):
            return False
        
        # サイズの大きい方の親が親であり続ける
        if self.size(n1) >= self.size(n2):
            tmp = self.size(n2)
            self.parent_indexes[self.find_parent(n2)] = self.find_parent(n1)
            self.parent_indexes[self.find_parent(n1)] -= tmp
            return True
        
        tmp = self.size(n1)
        self.parent_indexes[self.find_parent(n1)] = self.find_parent(n2)
        self.parent_indexes[self.find_parent(n2)] -= tmp
        return True
        
    
    def size(self, n):
        return -self.parent_indexes[self.find_parent(n)]
    
    def same_group(self, n1, n2):
        return self.find_parent(n1) == self.find_parent(n2)



n, m = map(lambda x: int(x), input().split())
uf = UnionFind(n)

for _ in range(m):
    a, b = map(lambda x: int(x), input().split())
    uf.union(a-1, b-1)
    
print(-min(uf.parent_indexes))
def how_many_times_divisible(n):
    ans = 0
    while n % 2 == 0:
        n /= 2
        ans += 1
    return ans

n = int(input())
a = map(int, input().split)
ans = min(map(how_many_times_divisible, a))
print(ans)

### FIXED CODE ###

n = int(input())
a = list(map(int, input().split()))
cnt = 0
while all(i%2==0 for i in a):
    a = [i/2 for i in a]
    cnt += 1
print(cnt)
r=int(input)
print(2*r*3.1415)

### FIXED CODE ###

r=int(input())
print(2*r*3.1415)
from itertools import product
N=int(input())
s="abcdefghij"
a
ab
abc
abcd
for i in range(N):
  c=s[:i+1]
  for p in product(c,repeat=N-i):
    print(c+"".join(p))

### FIXED CODE ###

from itertools import product, combinations_with_replacement
N=int(input())
s="abcdefghij"
 
def get_gen(a, N):
  for c in s[:s.index(max(a))+2 if a else 1]:
    t = a+c
    if len(t) == N:
      print(t)
    else:
      get_gen(t,N)

get_gen("", N)
import sys

input = sys.stdin.readline

n_k = list(map(int, input().split()))
n = n_k[0]
k = n_k[1]
a = list(map(int, input().split()))
a_pos = list(filter(lambda v: v > 0, a))
a_neg = list(filter(lambda v: v < 0, a))

a_pos.sort(reverse=True)
a_neg.sort()

ans = 1
if len(a_pos) == 0 and k % 2 == 1:
    for i in reversed(range(len(a_neg) - k, len(a_neg))):
        ans = ans * a_neg[i] % 100000007
else:
    i_p = 0
    i_n = 0
    i = 0
    while i < k:
        if i == k - 1 or i_n+1 >= len(a_neg) or a_pos[i_p] > a_neg[i_n] * a_neg[i_n+1]:
            ans = ans * a_pos[i_p] % 1000000007
            i_p += 1
            i += 1
        else:
            ans = ans * a_neg[i_n] % 1000000007 * a_neg[i_n+1] % 1000000007
            i_n += 2
            i += 2
print(ans)


### FIXED CODE ###

import sys

input = sys.stdin.readline

n_k = list(map(int, input().split()))
n = n_k[0]
k = n_k[1]
a = list(map(int, input().split()))
a_pos = list(filter(lambda v: v >= 0, a))
a_neg = list(filter(lambda v: v < 0, a))

a_pos.sort(reverse=True)
a_neg.sort()

mod = 10**9+7

ans = 1
if n == k:
    for a_i in a:
        ans = ans * a_i % mod
elif len(a_pos) == 0 and k % 2 == 1:
    for i in reversed(range(len(a_neg) - k, len(a_neg))):
        ans = ans * a_neg[i] % mod
else:
    i_p = 0
    i_n = 0
    i = 0
    while i < k:
        if i_p < len(a_pos) and (i == k - 1 or i_n+1 >= len(a_neg) or a_pos[i_p] * (a_pos[i_p+1] if i_p+1 < len(a_pos) else 1) > a_neg[i_n] * a_neg[i_n+1]):
            ans = ans * a_pos[i_p] % mod
            i_p += 1
            i += 1
        else:
            ans = ans * a_neg[i_n] % mod * a_neg[i_n+1] % mod
            i_n += 2
            i += 2
print(ans)
line = input().split(" ")
 
n = 0
 
while n >= 0:
	if n*(int(line[0])-1) >= int(line[1])-int(line[0]):
		break
	else:
		n += 1
 
input(str(n+1))

### FIXED CODE ###

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

cnt = 1
k = a

while k < b:
  k += a-1
  cnt += 1

if b == 1:
  print(0)
else:
  print(cnt)
import math

for n in range(200):
    nums = list(map(int, input().split()))
    if nums==[]:
        break
    else:
        if nums[0]==0:
            a=1
        else:
            a = int(1.0+math.log(nums[0],10))
        if nums[1]==0:
            b=1
        else:
            b = int(1.0+math.log(nums[1],10))
        print(a+b)

### FIXED CODE ###

import math
import sys

for line in sys.stdin:
    words=line.strip().split(" ")
    a=int(words[0])
    b=int(words[1])
    c=a+b
    if c!=0:
        print(int(1.0000001+math.log(c,10)))
    else:
        print(1)
x,y = map(int. input ().split())
while True
    if x == y:
        break
    elif x < y:
        print(x,y)
    else:
        print(y,x)
        


### FIXED CODE ###

while True:
    x,y = map(int,input().split())

    if x == 0 and y == 0:
        break
    elif x < y:
        print(x,y)
    else:
        print(y,x)