dhyuti-n/xlcost-variable-roles huggingface dataset:
Python program:
def decode ( Str ) :
    integerstack = [ ]
    stringstack = [ ]
    temp = " "
    result = " "
    i = 0
    while i < len ( Str ) :
        count = 0
        if ( Str [ i ] >= '0' and Str [ i ] <= '9' ) :
            while ( Str [ i ] >= '0' and Str [ i ] <= '9' ) :
                count = count * 10 + ord ( Str [ i ] ) - ord ( '0' )
                i += 1
            i -= 1
            integerstack . append ( count )
        elif ( Str [ i ] == ' ] ' ) :
            temp = " "
            count = 0
            if ( len ( integerstack ) != 0 ) :
                count = integerstack [ - 1 ]
                integerstack . pop ( )
            while ( len ( stringstack ) != 0 and stringstack [ - 1 ] != ' [ ' ) :
                temp = stringstack [ - 1 ] + temp
                stringstack . pop ( )
            if ( len ( stringstack ) != 0 and stringstack [ - 1 ] == ' [ ' ) :
                stringstack . pop ( )
            for j in range ( count ) :
                result = result + temp
            for j in range ( len ( result ) ) :
                stringstack . append ( result [ j ] )
            result = " "
        elif ( Str [ i ] == ' [ ' ) :
            if ( Str [ i - 1 ] >= '0' and Str [ i - 1 ] <= '9' ) :
                stringstack . append ( Str [ i ] )
            else :
                stringstack . append ( Str [ i ] )
                integerstack . append ( 1 )
        else :
            stringstack . append ( Str [ i ] )
        i += 1
    while len ( stringstack ) != 0 :
        result = stringstack [ - 1 ] + result
        stringstack . pop ( )
    return result
if __name__ == ' _ _ main _ _ ' :
    Str = "3 [ b2 [ ca ] ] "
    print ( decode ( Str ) )

Index/key variables: i, j
Accumulator variables: integerstack, stringstack
Iterator variables: j
Python program:
class newNode :
    def __init__ ( self , data ) :
        self . data = data
        self . left = self . right = None
def printAncestors ( root , key ) :
    if ( root == None ) :
        return
    st = [ ]
    while ( 1 ) :
        while ( root and root . data != key ) :
            st . append ( root )
            root = root . left
        if ( root and root . data == key ) :
            break
        if ( st [ - 1 ] . right == None ) :
            root = st [ - 1 ]
            st . pop ( )
            while ( len ( st ) != 0 and st [ - 1 ] . right == root ) :
                root = st [ - 1 ]
                st . pop ( )
        root = None if len ( st ) == 0 else st [ - 1 ] . right
    while ( len ( st ) != 0 ) :
        print ( st [ - 1 ] . data , end = " ▁ " )
        st . pop ( )
if __name__ == ' _ _ main _ _ ' :
    root = newNode ( 1 )
    root . left = newNode ( 2 )
    root . right = newNode ( 7 )
    root . left . left = newNode ( 3 )
    root . left . right = newNode ( 5 )
    root . right . left = newNode ( 8 )
    root . right . right = newNode ( 9 )
    root . left . left . left = newNode ( 4 )
    root . left . right . right = newNode ( 6 )
    root . right . right . left = newNode ( 10 )
    key = 6
    printAncestors ( root , key )

Accumulator variables: st
Class/struct names: newNode
Python program:
class StackWithMax :
    def __init__ ( self ) :
        self . mainStack = [ ]
        self . trackStack = [ ]
    def push ( self , x ) :
        self . mainStack . append ( x )
        if ( len ( self . mainStack ) == 1 ) :
            self . trackStack . append ( x )
            return
        if ( x > self . trackStack [ - 1 ] ) :
            self . trackStack . append ( x )
        else :
            self . trackStack . append ( self . trackStack [ - 1 ] )
    def getMax ( self ) :
        return self . trackStack [ - 1 ]
    def pop ( self ) :
        self . mainStack . pop ( )
        self . trackStack . pop ( )
if __name__ == ' _ _ main _ _ ' :
    s = StackWithMax ( )
    s . push ( 20 )
    print ( s . getMax ( ) )
    s . push ( 10 )
    print ( s . getMax ( ) )
    s . push ( 50 )
    print ( s . getMax ( ) )

Class/struct names: StackWithMax
Python program:
st = [ ] ;
def push_digits ( number ) :
    while ( number != 0 ) :
        st . append ( number % 10 ) ;
        number = int ( number / 10 ) ;
def reverse_number ( number ) :
    push_digits ( number ) ;
    reverse = 0 ;
    i = 1 ;
    while ( len ( st ) > 0 ) :
        reverse = reverse + ( st [ len ( st ) - 1 ] * i ) ;
        st . pop ( ) ;
        i = i * 10 ;
    return reverse ;
number = 39997 ;
print ( reverse_number ( number ) ) ;

Accumulator variables: st
Python program:
def pairWiseConsecutive ( s ) :
    aux = [ ]
    while ( len ( s ) != 0 ) :
        aux . append ( s [ - 1 ] )
        s . pop ( )
    result = True
    while ( len ( aux ) > 1 ) :
        x = aux [ - 1 ]
        aux . pop ( )
        y = aux [ - 1 ]
        aux . pop ( )
        if ( abs ( x - y ) != 1 ) :
            result = False
        s . append ( x )
        s . append ( y )
    if ( len ( aux ) == 1 ) :
        s . append ( aux [ - 1 ] )
    return result
if __name__ == ' _ _ main _ _ ' :
    s = [ ]
    s . append ( 4 )
    s . append ( 5 )
    s . append ( - 2 )
    s . append ( - 3 )
    s . append ( 11 )
    s . append ( 10 )
    s . append ( 5 )
    s . append ( 6 )
    s . append ( 20 )
    if ( pairWiseConsecutive ( s ) ) :
        print ( " Yes " )
    else :
        print ( " No " )
    print ( " Stack ▁ content ▁ ( from ▁ top ) " , " after ▁ function ▁ call " )
    while ( len ( s ) != 0 ) :
        print ( s [ - 1 ] , end = " ▁ " )
        s . pop ( )

Accumulator variables: aux, s
Boolean variables: result
Python program:
def simplify ( Str ) :
    Len = len ( Str )
    res = [ None ] * Len
    index = 0
    i = 0
    s = [ ]
    s . append ( 0 )
    while ( i < Len ) :
        if ( Str [ i ] == ' + ' ) :
            if ( s [ - 1 ] == 1 ) :
                res [ index ] = ' - '
                index += 1
            if ( s [ - 1 ] == 0 ) :
                res [ index ] = ' + '
                index += 1
        elif ( Str [ i ] == ' - ' ) :
            if ( s [ - 1 ] == 1 ) :
                res [ index ] = ' + '
                index += 1
            elif ( s [ - 1 ] == 0 ) :
                res [ index ] = ' - '
                index += 1
        elif ( Str [ i ] == ' ( ' and i > 0 ) :
            if ( Str [ i - 1 ] == ' - ' ) :
                x = 0 if ( s [ - 1 ] == 1 ) else 1
                s . append ( x )
            elif ( Str [ i - 1 ] == ' + ' ) :
                s . append ( s [ - 1 ] )
        elif ( Str [ i ] == ' ) ' ) :
            s . pop ( )
        else :
            res [ index ] = Str [ i ]
            index += 1
        i += 1
    return res
if __name__ == ' _ _ main _ _ ' :
    s1 = " a - ( b + c ) "
    s2 = " a - ( b - c - ( d + e ) ) - f "
    r1 = simplify ( s1 )
    for i in r1 :
        if i != None :
            print ( i , end = " ▁ " )
        else :
            break
    print ( )
    r2 = simplify ( s2 )
    for i in r2 :
        if i != None :
            print ( i , end = " ▁ " )
        else :
            break

Index/key variables: i, index
Accumulator variables: s
Iterator variables: i
Python program:
BOUND = 4
top = - 1 ;
a = [ ]
length = 0 ;
def create_new ( ) :
    global length ;
    new_a = [ 0 for i in range ( length + BOUND ) ] ;
    for i in range ( length ) :
        new_a [ i ] = a [ i ] ;
    length += BOUND ;
    return new_a
def push ( element ) :
    global top , a
    if ( top == length - 1 ) :
        a = create_new ( ) ;
    top += 1
    a [ top ] = element ;
    return a ;
def pop ( ) :
    global top
    top -= 1 ;
def display ( ) :
    global top
    if ( top == - 1 ) :
        print ( " Stack ▁ is ▁ Empty " )
    else :
        print ( " Stack : ▁ " , end = ' ' )
        for i in range ( top + 1 ) :
            print ( a [ i ] , end = ' ▁ ' )
        print ( )
if __name__ == ' _ _ main _ _ ' :
    a = create_new ( ) ;
    push ( 1 ) ;
    push ( 2 ) ;
    push ( 3 ) ;
    push ( 4 ) ;
    display ( ) ;
    push ( 5 ) ;
    push ( 6 ) ;
    display ( ) ;
    push ( 7 ) ;
    push ( 8 ) ;
    display ( ) ;
    push ( 9 ) ;
    display ( ) ;

Index/key variables: i, top
Iterator variables: i
Python program:
def constructBlanceArray ( BOP , BCP , str , n ) :
    stk = [ ]
    for i in range ( n ) :
        if ( str [ i ] == ' ( ' ) :
            stk . append ( i ) ;
        else :
            if ( len ( stk ) != 0 ) :
                BCP [ i ] = 1 ;
                BOP [ stk [ - 1 ] ] = 1 ;
                stk . pop ( ) ;
            else :
                BCP [ i ] = 0 ;
    for i in range ( 1 , n ) :
        BCP [ i ] += BCP [ i - 1 ] ;
        BOP [ i ] += BOP [ i - 1 ] ;
def query ( BOP , BCP , s , e ) :
    if ( BOP [ s - 1 ] == BOP [ s ] ) :
        return ( BCP [ e ] - BOP [ s ] ) * 2 ;
    else :
        return ( BCP [ e ] - BOP [ s ] + 1 ) * 2 ;
if __name__ == ' _ _ main _ _ ' :
    string = " ( ) ) ( ( ) ) ( ( ) ) ( " ;
    n = len ( string )
    BCP = [ 0 for i in range ( n + 1 ) ] ;
    BOP = [ 0 for i in range ( n + 1 ) ] ;
    constructBlanceArray ( BOP , BCP , string , n ) ;
    startIndex = 5
    endIndex = 11 ;
    print ( " Maximum ▁ Length ▁ Correct ▁ " + " Bracket ▁ Subsequence ▁ between ▁ " + str ( startIndex ) + " ▁ and ▁ " + str ( endIndex ) + " ▁ = ▁ " + str ( query ( BOP , BCP , startIndex , endIndex ) ) ) ;
    startIndex = 4 ;
    endIndex = 5 ;
    print ( " Maximum ▁ Length ▁ Correct ▁ " + " Bracket ▁ Subsequence ▁ between ▁ " + str ( startIndex ) + " ▁ and ▁ " + str ( endIndex ) + " ▁ = ▁ " + str ( query ( BOP , BCP , startIndex , endIndex ) ) )
    startIndex = 1 ;
    endIndex = 5 ;
    print ( " Maximum ▁ Length ▁ Correct ▁ " + " Bracket ▁ Subsequence ▁ between ▁ " + str ( startIndex ) + " ▁ and ▁ " + str ( endIndex ) + " ▁ = ▁ " + str ( query ( BOP , BCP , startIndex , endIndex ) ) ) ;

Index/key variables: e, i, s
Accumulator variables: stk
Iterator variables: i
Python program:
def heapify ( arr , n , i ) :
    largest = i
    l = 2 * i + 1
    r = 2 * i + 2
    if l < n and arr [ largest ] < arr [ l ] :
        largest = l
    if r < n and arr [ largest ] < arr [ r ] :
        largest = r
    if largest != i :
        arr [ i ] , arr [ largest ] = arr [ largest ] , arr [ i ]
        heapify ( arr , n , largest )
def heapSort ( arr ) :
    n = len ( arr )
    for i in range ( n // 2 - 1 , - 1 , - 1 ) :
        heapify ( arr , n , i )
    for i in range ( n - 1 , 0 , - 1 ) :
        arr [ i ] , arr [ 0 ] = arr [ 0 ] , arr [ i ]
        heapify ( arr , i , 0 )
arr = [ 12 , 11 , 13 , 5 , 6 , 7 ]
heapSort ( arr )
n = len ( arr )
print ( " Sorted ▁ array ▁ is " )
for i in range ( n ) :
    print ( " % d " % arr [ i ] ) ,

Index/key variables: i, l, largest, r
Iterator variables: i
Python program:
def buildMaxHeap ( arr , n ) :
    for i in range ( n ) :
        if arr [ i ] > arr [ int ( ( i - 1 ) / 2 ) ] :
            j = i
            while arr [ j ] > arr [ int ( ( j - 1 ) / 2 ) ] :
                ( arr [ j ] , arr [ int ( ( j - 1 ) / 2 ) ] ) = ( arr [ int ( ( j - 1 ) / 2 ) ] , arr [ j ] )
                j = int ( ( j - 1 ) / 2 )
def heapSort ( arr , n ) :
    buildMaxHeap ( arr , n )
    for i in range ( n - 1 , 0 , - 1 ) :
        arr [ 0 ] , arr [ i ] = arr [ i ] , arr [ 0 ]
        j , index = 0 , 0
        while True :
            index = 2 * j + 1
            if ( index < ( i - 1 ) and arr [ index ] < arr [ index + 1 ] ) :
                index += 1
            if index < i and arr [ j ] < arr [ index ] :
                arr [ j ] , arr [ index ] = arr [ index ] , arr [ j ]
            j = index
            if index >= i :
                break
if __name__ == ' _ _ main _ _ ' :
    arr = [ 10 , 20 , 15 , 17 , 9 , 21 ]
    n = len ( arr )
    print ( " Given ▁ array : ▁ " )
    for i in range ( n ) :
        print ( arr [ i ] , end = " ▁ " )
    print ( )
    heapSort ( arr , n )
    print ( " Sorted ▁ array : ▁ " )
    for i in range ( n ) :
        print ( arr [ i ] , end = " ▁ " )

Index/key variables: i, index, j
Iterator variables: i
Python program:
class newNode :
    def __init__ ( self , data ) :
        self . data = data
        self . left = self . right = None
def IsFoldable ( root ) :
    if ( root == None ) :
        return True
    return IsFoldableUtil ( root . left , root . right )
def IsFoldableUtil ( n1 , n2 ) :
    if n1 == None and n2 == None :
        return True
    if n1 == None or n2 == None :
        return False
    d1 = IsFoldableUtil ( n1 . left , n2 . right )
    d2 = IsFoldableUtil ( n1 . right , n2 . left )
    return d1 and d2
if __name__ == " _ _ main _ _ " :
    root = newNode ( 1 )
    root . left = newNode ( 2 )
    root . right = newNode ( 3 )
    root . left . right = newNode ( 4 )
    root . right . left = newNode ( 5 )
    if IsFoldable ( root ) :
        print ( " Tree ▁ is ▁ foldable " )
    else :
        print ( " Tree ▁ is ▁ not ▁ foldable " )

Class/struct names: newNode
Python program:
def isSumProperty ( node ) :
    left_data = 0
    right_data = 0
    if ( node == None or ( node . left == None and node . right == None ) ) :
        return 1
    else :
        if ( node . left != None ) :
            left_data = node . left . data
        if ( node . right != None ) :
            right_data = node . right . data
        if ( ( node . data == left_data + right_data ) and isSumProperty ( node . left ) and isSumProperty ( node . right ) ) :
            return 1
        else :
            return 0
class newNode :
    def __init__ ( self , data ) :
        self . data = data
        self . left = None
        self . right = None
if __name__ == ' _ _ main _ _ ' :
    root = newNode ( 10 )
    root . left = newNode ( 8 )
    root . right = newNode ( 2 )
    root . left . left = newNode ( 3 )
    root . left . right = newNode ( 5 )
    root . right . right = newNode ( 2 )
    if ( isSumProperty ( root ) ) :
        print ( " The ▁ given ▁ tree ▁ satisfies ▁ the " , " children ▁ sum ▁ property ▁ " )
    else :
        print ( " The ▁ given ▁ tree ▁ does ▁ not ▁ satisfy " , " the ▁ children ▁ sum ▁ property ▁ " )

Class/struct names: newNode
Python program:
def isHeap ( arr , i , n ) :
    if i >= int ( ( n - 2 ) / 2 ) :
        return True
    if ( arr [ i ] >= arr [ 2 * i + 1 ] and arr [ i ] >= arr [ 2 * i + 2 ] and isHeap ( arr , 2 * i + 1 , n ) and isHeap ( arr , 2 * i + 2 , n ) ) :
        return True
    return False
if __name__ == ' _ _ main _ _ ' :
    arr = [ 90 , 15 , 10 , 7 , 12 , 2 , 7 , 3 ]
    n = len ( arr ) - 1
    if isHeap ( arr , 0 , n ) :
        print ( " Yes " )
    else :
        print ( " No " )

Index/key variables: i
Python program:
def isHeap ( arr , n ) :
    for i in range ( int ( ( n - 2 ) / 2 ) + 1 ) :
        if arr [ 2 * i + 1 ] > arr [ i ] :
            return False
        if ( 2 * i + 2 < n and arr [ 2 * i + 2 ] > arr [ i ] ) :
            return False
    return True
if __name__ == ' _ _ main _ _ ' :
    arr = [ 90 , 15 , 10 , 7 , 12 , 2 , 7 , 3 ]
    n = len ( arr )
    if isHeap ( arr , n ) :
        print ( " Yes " )
    else :
        print ( " No " )

Index/key variables: i
Iterator variables: i
Python program:
import heapq
def minCost ( arr , n ) :
    heapq . heapify ( arr )
    res = 0
    while ( len ( arr ) > 1 ) :
        first = heapq . heappop ( arr )
        second = heapq . heappop ( arr )
        res += first + second
        heapq . heappush ( arr , first + second )
    return res
if __name__ == ' _ _ main _ _ ' :
    lengths = [ 4 , 3 , 2 , 6 ]
    size = len ( lengths )
    print ( " Total ▁ cost ▁ for ▁ connecting ▁ ropes ▁ is ▁ " + str ( minCost ( lengths , size ) ) )

Accumulator variables: res
Python program:
def generate_derangement ( N ) :
    S = [ i for i in range ( N + 1 ) ]
    PQ = [ ]
    for i in range ( 1 , N + 1 ) :
        PQ . append ( S [ i ] )
    D = [ 0 ] * ( N + 1 )
    PQ . sort ( )
    for i in range ( 1 , N + 1 ) :
        PQ . sort ( )
        d = PQ [ 0 ]
        del PQ [ 0 ]
        if ( d != S [ i ] ) or ( i == N ) :
            D [ i ] = d
        else :
            PQ . sort ( )
            D [ i ] = PQ [ 0 ]
            del PQ [ 0 ]
            PQ . append ( d )
    if D [ N ] == S [ N ] :
        t = D [ N - 1 ]
        D [ N - 1 ] = D [ N ]
        D [ N ] = t
    for i in range ( 1 , N + 1 ) :
        print ( D [ i ] , end = " ▁ " )
    print ( )
generate_derangement ( 10 )

Index/key variables: N, i
Accumulator variables: PQ
Iterator variables: i
Python program:
def generate_derangement ( N ) :
    S = [ 0 ] * ( N + 1 )
    for i in range ( 1 , N + 1 ) :
        S [ i ] = i
    D = [ 0 ] * ( N + 1 )
    for i in range ( 1 , N + 1 , 2 ) :
        if i == N :
            D [ N ] = S [ N - 1 ]
            D [ N - 1 ] = S [ N ]
        else :
            D [ i ] = i + 1
            D [ i + 1 ] = i
    for i in range ( 1 , N + 1 ) :
        print ( D [ i ] , end = " ▁ " )
    print ( )
if __name__ == ' _ _ main _ _ ' :
    generate_derangement ( 10 )

Index/key variables: N, i
Iterator variables: i
Python program:
def printLargest ( seq , N ) :
    res = [ 0 ] * N
    pq = [ ]
    for i in range ( N ) :
        pq . append ( seq [ i ] )
    for i in range ( N ) :
        pq . sort ( )
        pq . reverse ( )
        d = pq [ 0 ]
        del pq [ 0 ]
        if ( d != seq [ i ] or i == N - 1 ) :
            res [ i ] = d
        else :
            res [ i ] = pq [ 0 ]
            del pq [ 0 ]
            pq . append ( d )
    if ( res [ N - 1 ] == seq [ N - 1 ] ) :
        res [ N - 1 ] = res [ N - 2 ]
        res [ N - 2 ] = seq [ N - 1 ]
    print ( " Largest ▁ Derangement " )
    for i in range ( N ) :
        print ( res [ i ] , end = " ▁ " )
seq = [ 92 , 3 , 52 , 13 , 2 , 31 , 1 ]
n = len ( seq )
printLargest ( seq , n )

Index/key variables: i
Accumulator variables: pq
Iterator variables: i
Python program:
MOD = 1000000007 ;
def powerLL ( x , n ) :
    result = 1 ;
    while ( n ) :
        if ( n & 1 ) :
            result = result * x % MOD ;
        n = int ( n / 2 ) ;
        x = x * x % MOD ;
    return result ;
def powerStrings ( sa , sb ) :
    a = 0 ;
    b = 0 ;
    for i in range ( len ( sa ) ) :
        a = ( a * 10 + ( ord ( sa [ i ] ) - ord ( '0' ) ) ) % MOD ;
    for i in range ( len ( sb ) ) :
        b = ( b * 10 + ( ord ( sb [ i ] ) - ord ( '0' ) ) ) % ( MOD - 1 ) ;
    return powerLL ( a , b ) ;
sa = "2" ;
sb = "3" ;
print ( powerStrings ( sa , sb ) ) ;

Index/key variables: i
Iterator variables: i
Python program:
import math
def complement ( num ) :
    i = 0 ;
    len = 0 ;
    comp = 0 ;
    temp = num ;
    while ( 1 ) :
        len += 1 ;
        num = int ( num / 10 ) ;
        if ( abs ( num ) == 0 ) :
            break ;
    num = temp ;
    comp = math . pow ( 10 , len ) - num ;
    return int ( comp ) ;
print ( complement ( 25 ) ) ;
print ( complement ( 456 ) ) ;

Accumulator variables: len
Python program:
def countOddSum ( a , n ) :
    c_odd = 0 ;
    result = 0 ;
    odd = False ;
    for i in range ( n ) :
        if ( a [ i ] % 2 == 1 ) :
            if ( odd == True ) :
                odd = False ;
            else :
                odd = True ;
        if ( odd ) :
            c_odd += 1 ;
    for i in range ( n ) :
        result += c_odd ;
        if ( a [ i ] % 2 == 1 ) :
            c_odd = ( n - i - c_odd ) ;
    return result ;
if __name__ == ' _ _ main _ _ ' :
    ar = [ 5 , 4 , 4 , 5 , 1 , 3 ] ;
    n = len ( ar ) ;
    print ( " The ▁ Number ▁ of ▁ Subarrays " + " with ▁ odd ▁ sum ▁ is ▁ " , countOddSum ( ar , n ) ) ;

Index/key variables: i
Accumulator variables: c_odd, result
Iterator variables: i
Boolean variables: odd
Python program:
def calculateSum ( n ) :
    sum = 0
    for row in range ( n ) :
        sum = sum + ( 1 << row )
    return sum
n = 10
print ( " Sum ▁ of ▁ all ▁ elements : " , calculateSum ( n ) )

Iterator variables: row
Python program:
N = 1000000
phi = [ 0 for i in range ( N + 5 ) ]
def computeTotient ( ) :
    for i in range ( 1 , N + 1 ) :
        phi [ i ] = i
    for p in range ( 2 , N + 1 ) :
        if ( phi [ p ] == p ) :
            phi [ p ] = p - 1
            for i in range ( 2 * p , N + 1 , p ) :
                phi [ i ] = ( phi [ i ] // p ) * ( p - 1 )
def power ( x , y , p ) :
    while ( y > 0 ) :
        if ( y & 1 ) :
            res = ( res * x ) % p
        x = ( x * x ) % p
    return res
def calculate ( x , k , mod ) :
    arr = [ 0 for i in range ( N ) ]
    count = 0
    while ( mod > 1 ) :
        arr [ count ] = mod
        count += 1
        mod = phi [ mod ]
    result = 1
    loop = count + 1
    arr [ count ] = 1
    for i in range ( min ( k , loop ) , - 1 , - 1 ) :
        result = power ( x , result , arr [ i ] )
    return result
computeTotient ( )
x = 3
k = 2
m = 3
print ( calculate ( x , k , m ) )

Index/key variables: count, i, mod, p
Iterator variables: i, p
Python program:
from math import sqrt
MAX = 1005
def SieveOfEratosthenes ( primes ) :
    prime = [ True for i in range ( MAX ) ]
    for p in range ( 2 , int ( sqrt ( MAX ) ) + 1 , 1 ) :
        if ( prime [ p ] == True ) :
            for i in range ( p * 2 , MAX , p ) :
                prime [ i ] = False
    for p in range ( 2 , MAX , 1 ) :
        if ( prime [ p ] ) :
            primes . append ( p )
    return primes
def minimumSquareFreeDivisors ( N ) :
    prime = [ ]
    primes = [ ]
    primes = SieveOfEratosthenes ( prime )
    max_count = 0
    i = 0
    while ( len ( primes ) and primes [ i ] * primes [ i ] <= N ) :
        if ( N % primes [ i ] == 0 ) :
            tmp = 0
            while ( N % primes [ i ] == 0 ) :
                tmp += 1
                N /= primes [ i ]
            max_count = max ( max_count , tmp )
        i += 1
    if ( max_count == 0 ) :
        max_count = 1
    return max_count
if __name__ == ' _ _ main _ _ ' :
    N = 24
    print ( " Minimum ▁ Number ▁ of ▁ Square ▁ Free ▁ Divisors ▁ is " , minimumSquareFreeDivisors ( N ) )
    N = 6
    print ( " Minimum ▁ Number ▁ of ▁ Square ▁ Free ▁ Divisors ▁ is " , minimumSquareFreeDivisors ( N ) )

Index/key variables: i, p
Accumulator variables: N, primes, tmp
Iterator variables: i, p
Python program:
import math
def findMaxGCD ( arr , n , k ) :
    high = max ( arr )
    divisors = [ 0 ] * ( high + 1 )
    for i in range ( n ) :
        for j in range ( 1 , int ( math . sqrt ( arr [ i ] ) ) + 1 ) :
            if ( arr [ i ] % j == 0 ) :
                divisors [ j ] += 1
                if ( j != arr [ i ] // j ) :
                    divisors [ arr [ i ] // j ] += 1
    for i in range ( high , 0 , - 1 ) :
        if ( divisors [ i ] >= k ) :
            return i
if __name__ == " _ _ main _ _ " :
    arr = [ 1 , 2 , 4 , 8 , 8 , 12 ]
    k = 3
    n = len ( arr )
    print ( findMaxGCD ( arr , n , k ) )

Index/key variables: i, j
Iterator variables: i, j
Python program:
def mulmod ( a , b , mod ) :
    a = a % mod
    while ( b > 0 ) :
        if ( b % 2 == 1 ) :
            res = ( res + a ) % mod
        a = ( a * 2 ) % mod
        b //= 2
    return res % mod
def findProduct ( N ) :
    product = 1 ; fact = 1
    MOD = 1e9 + 7
    for i in range ( 1 , N + 1 ) :
        fact = mulmod ( fact , i , MOD )
        product = mulmod ( product , fact , MOD )
        if not product :
            return 0
    return int ( product )
N = 3
print ( findProduct ( N ) )
N = 5
print ( findProduct ( N ) )

Accumulator variables: b
Iterator variables: i
Python program:
import math
def divSum ( n ) :
    sum = 1 ;
    i = 2 ;
    while ( i * i <= n ) :
        if ( n % i == 0 ) :
            sum = ( sum + i + math . floor ( n / i ) ) ;
        i += 1 ;
    return sum ;
def areEquivalent ( num1 , num2 ) :
    return divSum ( num1 ) == divSum ( num2 ) ;
num1 = 559 ;
num2 = 703 ;
if ( areEquivalent ( num1 , num2 ) == True ) :
    print ( " Equivalent " ) ;
else :
    print ( " Not ▁ Equivalent " ) ;

Accumulator variables: i