Learn practical skills, build real-world projects, and advance your career
#finding coprimes for given array
from math import gcd
def gcd1(a,b):
    while a!=0:
        res=a
        a=b%a
        b=res
    if res==1:
        return True
    else:
        return False
def problem(n,arr):
    c=0
    for i in range(0,len(arr)-1):
        for j in range(i+1,len(arr)):
            if gcd1(arr[i],arr[j])==True:
                c+=1
                #print(i,j)
    return (c)
n=int(input())
arr=list(map(int,input().split()))
problem(n,arr)
4 4 8 3 9
4
#find the nth occurance of elements in the given array
def number(n,arr,l,r):
    c=0
    for i in range(0,len(arr)):
        if arr[i]==l:
            c+=1
        if c==r:
            return (i)
    return(-1)
    
n=int(input())
arr=list(map(int,input().split()))
l=int(input())
r=int(input())
print(number(n,arr,l,r))
7 1 4 6 7 6 3 6 6 3 6
#find element in given array
def find(arr,n):
        if n in arr:
            return "Found"
        else:
            return "Not Found"
arr=list(map(int,input().split()))
n=int(input())
find(arr,n)
1 2 3 4
'Not Found'
def secondlarge(arr):
    maxi=max(arr)
    arr.remove(maxi)
    print(max(arr))
arr=list(map(int,input().split()))
23 45 7 34 25 25 89 89
#finding element in the sorted array **m+n time complexity**
def matrix(arr,n,x):
    i=0
    j=n-1
    while(i<n and j>=0):
        if arr[i][j]==x:
            return (i,j)
        if arr[i][j]>x:
            j-=1
        else:
            i+=1
row=int(input())
col=int(input())
arr=[]
for i in range(0,(row)):
    x=list(map(int,input().split()))
    arr.append(x)
x=int(input())
print(matrix(arr,row,x))
    
3 3 1 2 3 4 5 6 7 8 9 8 (2, 1)