<jupyter_start><jupyter_text>Maximum Frequency<jupyter_code>from sys import stdin
def maxfreq(arr):
    #Write your code here 
    d = {} 
    for num in arr: 
        if num in d: 
            d[num] += 1 
        else: 
            d[num] = 1 
    ans = arr[0] 
    for num in arr: 
        if d[num] > d[ans]: 
            ans = num 
    return ans 

    
    
    
    
def takeInput():
    #To take fast I/O
    n=int(stdin.readline().strip())
    if n==0:
        return list(),0
    arr=list(map(int,stdin.readline().strip().split( )))
    return arr,n

arr,n=takeInput()
print(maxfreq(arr))<jupyter_output><empty_output><jupyter_text>Pair Sum To 0<jupyter_code>from sys import stdin
from math import factorial


def nc2(n):
    ans=0
    if n!=1:
        ans = factorial(n) / (factorial(2)*factorial(n-2))
    return int(ans)

# For creating frequency map
def freqMap(l):
    map={}
    for num in l:
        if num in map:
            map[num]+=1
        else:
            map[num]=1
    return map


def pairSum0(l,n):
    m=freqMap(l)
    count = 0
    for num in m:
        if num>0 and -num in m:
            count = count + (m[num]*m[-num])
                
        if num==0:
            count = count + nc2(m[num])
    return count
                
    
def takeInput():
    #To take fast I/O
    n=int(stdin.readline().strip())
    if n==0:
        return list(),0
    arr=list(map(int,stdin.readline().strip().split( )))
    return arr,n

arr,n=takeInput()
print(pairSum0(arr,n))<jupyter_output><empty_output><jupyter_text>Extract Unique characters<jupyter_code>def uniqueChar(s): 
    ans = '' 
    d = {} 
    for char in s: 
        if char not in d: 
            ans = ans + char 
            d[char] = True 
    return ans 

# Main 
s=input() 
print(uniqueChar(s))<jupyter_output><empty_output><jupyter_text>Longest Consecutive Sequence<jupyter_code>from sys import stdin

def longestConsecutiveSubsequence(arr,n): 
    visitedElements = {}
    elementToIndexMapping = {}
    for i in range(n):
        elementToIndexMapping[arr[i]] = i
        if arr[i] not in visitedElements:
            visitedElements[arr[i]]=True
            
    longestSequence=[]
    maxSequenceLength = 1
    minStartIndex = 0
    
    for i in range(n):
        num = arr[i]
        currentMinStartIndex = i
        count = 0
        tempNum = num
        
        while tempNum in visitedElements and visitedElements[tempNum]==True:
            visitedElements[tempNum] = False
            count+=1
            tempNum+=1
        
        tempNum = num - 1
        while tempNum in visitedElements and visitedElements[tempNum]==True:
            visitedElements[tempNum] = False
            count+=1
            currentMinStartIndex = elementToIndexMapping[tempNum]
            tempNum-=1
            
        if (count > maxSequenceLength):
            maxSequenceLength = count
            minStartIndex = currentMinStartIndex
        elif (count == maxSequenceLength):
            if (currentMinStartIndex < minStartIndex):
                minStartIndex = currentMinStartIndex
                
    startNum = arr[minStartIndex]

    longestSequence.append(startNum)
    if (maxSequenceLength > 1):
        longestSequence.append(startNum + maxSequenceLength - 1)
    
    
    return longestSequence
            
  

def takeInput():
    #To take fast I/O
    n=int(stdin.readline().strip())
    if n==0:
        return list(),0
    arr=list(map(int,stdin.readline().strip().split( )))
    return arr,n

    
# Main 
arr,n=takeInput()
ans = longestConsecutiveSubsequence(arr,n) 
# This ans array contains two numbers, ie, start and end of longest sequence respectively
print(*ans)<jupyter_output><empty_output><jupyter_text>Pairs with difference K<jupyter_code>def printPairDiffK(l, k):
    pairCount = 0
    m = {}
    for num in l:
        if num+k in m:
            pairCount += m[num+k]
        if k!=0 and num-k in m:
            pairCount += m[num-k]

        # Update map        
        if num in m:
            m[num] += 1
        else:
            m[num] = 1
            
    return pairCount
# Main
n=int(input())
l=list(int(i) for i in input().strip().split(' '))
k=int(input())
print(printPairDiffK(l, k))<jupyter_output><empty_output><jupyter_text>Longest subset zero sum<jupyter_code>def subsetSum(l):
    n = len(l)
    sum = [0] * n
    sum[0] = l[0]
    m = { l[0]:0}
    start, end = -1, -2
    if sum[0]==0:
        start, end = 0, 0
    for i in range(1, n):
        sum[i] = sum[i-1] + l[i]
        if sum[i]==0:
            start, end = 0, i
        elif sum[i] in m:
            #Found a subset with zero Sum
            if i-m[sum[i]] > end-start+1:
                start, end = m[sum[i]]+1, i
        else:
            m[sum[i]] = i
    return end-start+1


# Main
n=int(input())
l=list(int(i) for i in input().strip().split(' '))
print(subsetSum(l))<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.11932396660557931, 'fraction_numerical': 0.011199348401547547, 'mean_word_length': 2.056627255756067, 'pattern_counts': {'":': 0, '<': 26, '<?xml version=': 0, '>': 30, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '6', 'dir': 'jupyter-structured-clean-dedup', 'id': '235459', 'license': 'MIT', 'n_tokens_mistral': 1689, 'n_tokens_neox': 1645, 'n_words': 397, 'path': 'Coding-Ninjas-Data-Structure-and-Algorithm-in-Python-main/Dictionaries Maps/all in one.ipynb', 'repo_name': 'SaiPrasanth212/Coding-Ninjas-Data-Structures-and-Algorithms', 'size': '4911'}