<jupyter_start><jupyter_text><jupyter_code>n=int(input())
for i in range(1,2*n,1):
    j=1
    for j in range(1,2*n,1):
        
            if i==j==n:
                print("1",end="")
            else:
                print(n,end="")
            
        
    print()<jupyter_output>3
33333
33333
33133
33333
33333<jupyter_text>1 2 3 4 5 6 13 14 15 16 17 18 25 26 27 28 29 30 31 32 33 34 35 36 19 20 21 22 23 24 7 8 9 10 11 12<jupyter_code>n=int(input())
for i in range(1,n+1,1):
    j=1
    for j in range(1,n+1,1):
        if i==1:
            print(j,"",end="")
        elif i==n:
            print(n+j,"",end="")
        else:
            print(n*i+j,"", end="")
    print()
n=int(input())
for i in range(2*n-1):
    print(i)
n=int(input())
for i in range(2*n-1):
    if i<n:
        k=i
    else:
        k=2*(n-1)-i
    for j in range(0,k):
        print(n-j,end='')
    for j in range(0,2*(n-k)-1):
        print(n-k,end='')
    for j in range(k-1,-1,-1):
        print(n-j,end='')
    print()
n = int(input())
for i in range(1,n+1): 
    temp = n 
    for j in range(1,i):
        print(temp,end="")
        temp = temp -1 
    for j in range(1,(2*n) - (2*i) + 2): 
        print(n-i+1,end="") 
    for j in range(1,i):
        temp = temp+1 
        print(temp,end="")
    print()
for i in range(n-1,0,-1):
    temp = n 
    for j in range(1,i):
        print(temp,end="") 
        temp = temp - 1 
    for j in range(1,(2*n) - (2*i) + 2):
        print(n-i+1,end="") 
    for j in range(1,i): 
        temp = temp+1 
        print(temp,end="") 
    print()
while start <= end : 
    cel = (5/9)*(start - 32) 
    print(str(start)+"\t"+str(int(cel))) 
    start = start + w
def printTable(start,end,step):
    while start<=end:
        cel = (5/9)*(start - 32)
        print(str(start)+"\t"+str(int(cel)))
        start=start+step
s = int(input())
e = int(input())
step = int(input())
printTable(s,e,step)

Reverse = 0    
num = int(input())
a=num
while(a> 0): 
    Reminder = a %10    
    Reverse = (Reverse *10) + Reminder    
    a = a//10 
if(Reverse==num):
    print('true')
else:
    print('false')
def checkPalindrome(num):
    Reverse=0
    a=num
    while(a> 0): 
        Reminder = a %10    
        Reverse = (Reverse *10) + Reminder    
        a = a//10 
        
    return Reverse
    
num = int(input())
checkPalindrome(num)

isPalindrome = checkPalindrome(num)
if(isPalindrome==num):
	print('true')
else:
	print('false')
import math
def checkMember(n):
    phi = 0.5 + 0.5 * math.sqrt(5.0)
    a = phi * n
    return n == 0 or abs(round(a) - a) < 1.0 / n
n=int(input())
if(checkMember(n)):
    print("true")
else:
    print("false")

def checkMember(n):
    f=0
    s=1
    for x in range(0,n+1):
        next=f+s                           
        f=s
        s=next
    return f
checkMember(7)<jupyter_output><empty_output><jupyter_text>F(n) = F(n-1) + F(n-2)<jupyter_code>n=int(input())
li1=[int(x) for x in input().split()]
n2=int(input())
li2=[int(x) for x in input().split()]
c=[]
for i in li1:
    if i in li2:
        li2.remove(i)
        c.append(i)
for i in c:
    print(i)
    
n=int(input())
li=[int(x) for x in input().split()]
for i in range(0,n-1):
    j=0
    for i in range(n-1): 
        if li[i]==0:
            li[i],li[i+1]=li[i+1],li[i]
for x in range(len(li)): 
    print(li[x],end=" ")
n=int(input())
a=[int(x) for x in input().split()]
def sortBinaryArray(a, n): 
    j = -1
    for i in range(n): 
  
        # if number is smaller 
        # than 1 then swap it 
        # with j-th number 
        if a[i] < 1: 
            j = j + 1
              
            # swap 
            a[i], a[j] = a[j], a[i] 
      
  

n = len(a) 
  
sortBinaryArray(a, n) 
  
for i in range(n): 
        print(a[i], end = " ")
n=int(input())
li=[int(x) for x in input().split()]
x=int(input())
for i in range(len(li)):
    j=i+1
    while j<len(li):
        if li[i]+li[j]==x:
            if li[i]<li[j]:
                print(li[i],li[j])
            else:
                print(li[j],li[i])
        j=j+1
    
n=int(input())
li=[int(x) for x in input().split()]
x=int(input())
for i in range(len(li)):
    j=i+1
    while j<len(li):
        a=j
        while a<len(li):
            if li[i]+li[j]+li[a]==x:
                if li[i]<=li[j] and li[i]<=li[a]:
                    if li[j]<=li[a]:
                        print(li[i],li[j],li[a])
                    else:
                        print(li[i],li[a],li[j])
                elif li[a]<=li[j] and li[a]<=li[i]:
                    if li[i]<=li[j]:
                        print(li[a],li[i],li[j])
                    else:
                        print(li[a],li[j],li[i])
                elif li[j]<=li[i] and li[j]<=li[a]:
                    if li[i]<=li[a]:
                        print(li[j],li[i],li[a])
                    else:
                        print(li[j],li[a],li[i])
            a=a+1
        j=j+1
n=int(input())
li=[int(x) for x in input().split()]
i=0
j=0
while i<len(li):
    while j<(len(li)):
        if li[i]>0 and li[j]>0 and i<len(li):
            i=i+1
            j=j+1
            break
        elif li[i]==0:
            i=i+1
            
        elif li[j]==0 and li[i]>0:
            li[i],li[j]=li[j],li[i]
            i=i+1
            j=j+1
            break
            
        elif li[i]==0 and li[j]==0:
            i=i+1
            break
        
        
        j=j+1
    i=i+1

for i in range(len(li)): 
    print(li[i],end=' ')

def Rotate(arr, d):
    li=[]
    for i in range(d):
        li.append(arr[i])
    for i in range(len(arr)-d):
        arr[i]=arr[i+d]

    for i in range(len(li)):
        arr.append(li[i])
    
    
    
n=int(input())
arr=list(int(i) for i in input().strip().split(' '))
d=int(input())
Rotate(arr, d)
print(*arr)
n=int(input())
li=[int(x) for x in input().split()]
i=0
j=0
while i<len(li):
    if li[i]==0:
        i+=1
        continue
    li[j]=li[i]
    j+=1
    i=i+1
            
while j<len(li):
    li[j]=0
    j+=1
        

    

for i in range(len(li)): 
    print(li[i],end=' ')
## Read input as specified in the question.
## Print output as specified in the question.

n=int(input())

largest=-1
second=-1
if n<=1:
    print("-2147483648")
else:
    li=[int(x) for x in input().split()]
    for i in range(len(li)):
        if li[i]>largest:
            second=largest
            largest=li[i]
        
        elif li[i]<largest and li[i]>second:
            second=li[i]
        elif li[i]==largest or li[i]==second:
            pass
        else:        
            print("-2147483648")
            break
            
            
    print(second)
def countRotations(arr, n): 
  
    # We basically find index 
    # of minimum element 
    min = arr[0] 
    for i in range(0, j): 
      
        if (min > arr[i]): 
          
            min = arr[i] 
            min_index = i 
          
    return min_index; 
  
  
# Driver code 
n=int(input())
li=[int(x) for x in input().split()]
j = len(li) 
print(countRotations(li, j))
n1=int(input())
li1=[int(x) for x in input().split()]
n2=int(input())
li2=[int(x) for x in input().split()]
result=[]
carry=0
if len(li1)>=len(li2):
    for i in range(len(li2),1,-1):
    
        num=li1[i]+li2[i]+carry
        carry=num//10
        remainder=num%10
        result.append(remainder)
    print(result)    

def sort012(arr, n): 
  
    # Variables to maintain the count of 0's,  
    # 1's and 2's in the array 
    count0 = 0
    count1 = 0
    count2 = 0
    for i in range(0,n): 
        if (arr[i] == 0): 
            count0=count0+1
        if (arr[i] == 1): 
            count1=count1+1
        if (arr[i] == 2): 
            count2=count2+1
      
  
    # Putting the 0's in the array in starting. 
    for i in range(0,count0): 
        arr[i] = 0
      
    # Putting the 1's in the array after the 0's. 
    for i in range( count0, (count0 + count1)) : 
        arr[i] = 1
      
    # Putting the 2's in the array after the 1's 
    for i in range((count0 + count1),n) : 
        arr[i] = 2
      
    return
  
  
# Prints the array 
def printArray( arr,  n): 
  
    for i in range(0,n): 
        print( arr[i] , end=" ") 
    print() 
  
n1=int(input())
arr = [int(x) for x in input().split()] 
n = len(arr) 
sort012(arr, n) 
printArray(arr, n) 

a = "abce" >= "abcdef"
print(a)
def reverse(s): 
    return s[::-1] 
  
def isPalindrome(s): 
    # Calling reverse function 
    rev = reverse(s) 
  
    # Checking if both string are equal or not 
    if (s == rev): 
        print("true")
    else:
        print ("false")
s1=str(input())
reverse(s1)
isPalindrome(s1)
def compress(s):
    ans = s[0] 
    i, length = 1, len(s)
    while i<len(s): 
        if ans[-1]==s[i]: 
            count = 2 
            i += 1 
            while i<len(s) and ans[-1]==s[i]: 
                count += 1 
                i += 1 
                ans += str(count)
                
        else: 
            ans += s[i] 
            i += 1 
    return ans 
s=input() 
print(compress(s))
string=input()
i=0
string2=""
for i in range(len(string)):
    if i+1<len(string) and string[i]==string[i+1]:
        pass
    else:
        string2 += string[i]
        
    
print(string2)
d = {1:2, 2:5, "d":7}
print(d.get(0,5))
def rowWiseSum(arr):
    li=[]
    for row in arr:
        sum=0
        for ele in row:
            sum=sum+ele
        li.append(sum)
    return li
    


m, n=(int(i) for i in input().strip().split(' '))
l=[int(i) for i in input().strip().split(' ')]
arr = [ [ l[(j*n)+i] for i in range(n)] for j in range(m)]
l=rowWiseSum(arr)
print(*l)

m, n=(int(i) for i in input().strip().split(' '))
l=[int(i) for i in input().strip().split(' ')]
arr = [ [ l[(j*n)+i] for i in range(n)] for j in range(m)]
arr
# solver.py
def solve(bo):
    """
    Solves a sudoku board using backtracking
    :param bo: 2d list of ints
    :return: solution
    """
    find = find_empty(bo)
    if find:
        row, col = find
    else:
        return True

    for i in range(1,10):
        if valid(bo, (row, col), i):
            bo[row][col] = i

            if solve(bo):
                return True

            bo[row][col] = 0

    return False


def valid(bo, pos, num):
    """
    Returns if the attempted move is valid
    :param bo: 2d list of ints
    :param pos: (row, col)
    :param num: int
    :return: bool
    """

    # Check row
    for i in range(0, len(bo)):
        if bo[pos[0]][i] == num and pos[1] != i:
            return False

    # Check Col
    for i in range(0, len(bo)):
        if bo[i][pos[1]] == num and pos[1] != i:
            return False

    # Check box

    box_x = pos[1]//3
    box_y = pos[0]//3

    for i in range(box_y*3, box_y*3 + 3):
        for j in range(box_x*3, box_x*3 + 3):
            if bo[i][j] == num and (i,j) != pos:
                return False

    return True


def find_empty(bo):
    """
    finds an empty space in the board
    :param bo: partially complete board
    :return: (int, int) row col
    """

    for i in range(len(bo)):
        for j in range(len(bo[0])):
            if bo[i][j] == 0:
                return (i, j)

    return None


def print_board(bo):
    """
    prints the board
    :param bo: 2d List of ints

    :return: None
    """
    for i in range(len(bo)):
        if i % 3 == 0 and i != 0:
            print("- - - - - - - - - - - - - -")
        for j in range(len(bo[0])):
            if j % 3 == 0:
                print(" | ",end="")

            if j == 8:
                print(bo[i][j], end="\n")
            else:
                print(str(bo[i][j]) + " ", end="")   

def recSearch( arr, l, r, x): 
    if r < l: 
        return -1
    if arr[l] == x: 
        return l 
    if arr[r] == x: 
        return r 
    return recSearch(arr, l+1, r-1, x) 
m=int(input())    
arr =list(int(i) for i in input().strip().split(' ')) 
n = len(arr) 
x = int(input())
index = recSearch(arr, 0, n-1, x) 
if index != -1: 
    print("true") 
else: 
    print ("false")  
  
def firstindex(arr,x):
    l=len(arr)
    if l==0:
        return -1
    if arr[0]==x:
        return 0
    smallerlist = arr[1:]
    
    smallerlistoutput=firstindex(smallerlist,x)
    
    if smallerlistoutput==-1:
        return -1
    else:
        return smallerlistoutput + 1
def lastindex(arr,x):
    l=len(arr)
    if l==0:
        return -1
    
    smallerlist=a[1:]
    smallerlistoutput= lastindex(smallerlist,x)
    if smallerlistoutput != -1:
        return smallerlistoutput+1
    else:
        if arr[0]==x:
            return 0
        else:
            return -1
        
# Problem: Remove x from string
def removeX(string): 
    l=len(string)
    if l==0:
        return string
    output = removeX(string[1:])
    if string[0]=="x":
        return output
    else:
        return string[0] + outputif 
    

string = input()
print(removeX(string))

# Problem ID 91, removeConsecutiveDuplicates
def removeConsecutiveDuplicates(string):
    l=len(string)
    if l==0 or l==1:
        return string
    if string[0]==string[1]:
        output= removeConsecutiveDuplicates(string[1:])
        return output
    else:
        output=removeConsecutiveDuplicates(string[1:])
        return string[0]+ output
    

# Main
string = input().strip()
print(removeConsecutiveDuplicates(string))


def mergeSort(myList):
    if len(myList) > 1:
        mid = len(myList) // 2
        left = myList[:mid]
        right = myList[mid:]

        # Recursive call on each half
        mergeSort(left)
        mergeSort(right)

        # Two iterators for traversing the two halves
        i = 0
        j = 0
        
        # Iterator for the main list
        k = 0
        
        while i < len(left) and j < len(right):
            if left[i] < right[j]:
              # The value from the left half has been used
              myList[k] = left[i]
              # Move the iterator forward
              i += 1
            else:
                myList[k] = right[j]
                j += 1
            # Move to the next slot
            k += 1

        # For all the remaining values
        while i < len(left):
            myList[k] = left[i]
            i += 1
            k += 1

        while j < len(right):
            myList[k]=right[j]
            j += 1
            k += 1





n=int(input())
myList=list(int(i) for i in input().strip().split(' '))
mergeSort(myList)
print(*myList)<jupyter_output>5
8 7 6 5 4
4 5 6 7 8
{'fraction_non_alphanumeric': 0.1620985603543743, 'fraction_numerical': 0.02983111849390919, 'mean_word_length': 1.682695878202748, 'pattern_counts': {'":': 2, '<': 45, '<?xml version=': 0, '>': 22, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 1, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '3', 'dir': 'jupyter-structured-clean-dedup', 'id': '152037', 'license': 'MIT', 'n_tokens_mistral': 5721, 'n_tokens_neox': 5380, 'n_words': 1393, 'path': 'Untitled.ipynb', 'repo_name': 'jatin-pahuja/coding-ninjas-introduction-to-python', 'size': '14448'}