dhyuti-n/xlcost-variable-roles huggingface dataset:
Python program:
def sieveOfEratosthenes ( N ) :
    isPrime = [ True for i in range ( N + 1 ) ]
    isPrime [ 0 ] = False
    isPrime [ 1 ] = False
    i = 2
    while ( ( i * i ) <= N ) :
        if ( isPrime [ i ] ) :
            j = 2
            while ( i * j <= N ) :
                isPrime [ i * j ] = False
                j += 1
        i += 1
    return isPrime
def numPairsWithPrimeSum ( arr , n ) :
    N = 2 * 1000000
    isPrime = sieveOfEratosthenes ( N )
    count = 0
    for i in range ( n ) :
        for j in range ( i + 1 , n ) :
            sum = arr [ i ] + arr [ j ]
            if ( isPrime [ sum ] ) :
                count += 1
    return count
if __name__ == " _ _ main _ _ " :
    arr = [ 1 , 2 , 3 , 4 , 5 ]
    n = len ( arr )
    print ( numPairsWithPrimeSum ( arr , n ) )

Index/key variables: i, j, sum
Accumulator variables: count
Iterator variables: i, j
Python program:
digit = [ 0 ] * 10
def digitsPresent ( n ) :
    lastDigit = 0 ;
    while ( n != 0 ) :
        lastDigit = n % 10 ;
        digit [ int ( lastDigit ) ] = 1 ;
        n /= 10 ;
def checkLastDigit ( num ) :
    count = 0 ;
    lastDigit = 0 ;
    lastDigit = num % 10 ;
    if ( digit [ int ( lastDigit ) ] == 1 ) :
        count += 1
    return count ;
def findCount ( N , K , arr ) :
    count = 0 ;
    for i in range ( K ) :
        if checkLastDigit ( arr [ i ] ) == 1 :
            count += 1
        else :
            count
    print ( count )
N = 1731 ;
digitsPresent ( N ) ;
K = 5 ;
arr = [ 57 , 6786 , 1111 , 3 , 9812 ] ;
findCount ( N , K , arr ) ;

Index/key variables: i
Accumulator variables: count, n
Iterator variables: i
Python program:
from collections import defaultdict
def countSubarrays ( arr , n ) :
    mp = defaultdict ( lambda : 0 )
    prefixSum = [ 0 ] * n
    prefixMin = 0
    prefixSum [ 0 ] = arr [ 0 ]
    prefixMin = min ( prefixMin , prefixSum [ 0 ] )
    for i in range ( 1 , n ) :
        prefixSum [ i ] = prefixSum [ i - 1 ] + arr [ i ]
        prefixMin = min ( prefixMin , prefixSum [ i ] )
    countSubs = 0
    mp [ 0 ] = 1
    for i in range ( n ) :
        j = 0
        while prefixSum [ i ] - j * j >= prefixMin :
            if prefixSum [ i ] - j * j in mp :
                countSubs += mp [ prefixSum [ i ] - j * j ]
            j += 1
        mp [ prefixSum [ i ] ] += 1
    return countSubs
arr = [ 2 , 3 , - 5 , 6 , - 7 , 4 ]
n = len ( arr )
ans = countSubarrays ( arr , n )
print ( ans )

Index/key variables: i
Accumulator variables: countSubs, j
Iterator variables: i
Python program:
def positiveProduct ( arr , n ) :
    even_count = 0
    odd_count = 0
    total_count = 0
    ans = 0
    for i in range ( n ) :
        if ( total_count % 2 == 0 ) :
            even_count += 1
        else :
            odd_count += 1
        if ( arr [ i ] < 0 ) :
            total_count += 1
        if ( total_count % 2 == 0 ) :
            ans += even_count
        else :
            ans += odd_count
    print ( ans )
if __name__ == ' _ _ main _ _ ' :
    A = [ 5 , - 3 , 3 , - 1 , 1 ]
    size = len ( A )
    positiveProduct ( A , size )

Index/key variables: i
Accumulator variables: ans, even_count, odd_count, total_count
Iterator variables: i
Python program:
import math
def findPair ( x ) :
    lim = 120
    for i in range ( - lim , lim + 1 ) :
        for j in range ( - lim , lim + 1 ) :
            if ( math . pow ( i , 5 ) - math . pow ( j , 5 ) == x ) :
                print ( i , end = ' ▁ ' )
                print ( j , end =   ' ' )
                return
    print ( " - 1" )
X = 33
findPair ( X )

Iterator variables: i, j
Python program:
def getCount ( d , n ) :
    no = n // d ;
    result = no ;
    for p in range ( 2 , int ( pow ( no , 1 / 2 ) ) + 1 ) :
        if ( no % p == 0 ) :
            while ( no % p == 0 ) :
                no //= p ;
            result -= result // p ;
    if ( no > 1 ) :
        result -= result // no ;
    return result ;
def sumOfGCDofPairs ( n ) :
    res = 0 ;
    for i in range ( 1 , int ( pow ( n , 1 / 2 ) ) + 1 ) :
        if ( n % i == 0 ) :
            d1 = i ;
            d2 = n // i ;
            res += d1 * getCount ( d1 , n ) ;
            if ( d1 != d2 ) :
                res += d2 * getCount ( d2 , n ) ;
    return res ;
if __name__ == ' _ _ main _ _ ' :
    n = 12 ;
    print ( sumOfGCDofPairs ( n ) ) ;

Accumulator variables: no, res, result
Iterator variables: i, p
Python program:
def checkIsFibonacci ( arr , n ) :
    if ( n == 1 or n == 2 ) :
        return True ;
    arr . sort ( )
    for i in range ( 2 , n ) :
        if ( ( arr [ i - 1 ] + arr [ i - 2 ] ) != arr [ i ] ) :
            return False ;
    return True ;
if __name__ == " _ _ main _ _ " :
    arr = [ 8 , 3 , 5 , 13 ] ;
    n = len ( arr ) ;
    if ( checkIsFibonacci ( arr , n ) ) :
        print ( " Yes " ) ;
    else :
        print ( " No " ) ;

Index/key variables: i
Iterator variables: i
Python program:
def nCr ( n , r ) :
    return fact ( n ) / ( fact ( r ) * fact ( n - r ) )
def fact ( n ) :
    res = 1
    for i in range ( 2 , n + 1 ) :
        res = res * i
    return res
def sumSubsequences ( arr , n , k ) :
    sum = 0
    for i in range ( 0 , n ) :
        sum = sum + arr [ i ]
    kLengthSubSequence = nCr ( n , k )
    ans = sum * ( ( k * kLengthSubSequence ) / n ) ;
    return ans
arr = [ 7 , 8 , 9 , 2 ]
k = 2
n = len ( arr )
print ( sumSubsequences ( arr , n , k ) )

Index/key variables: i
Iterator variables: i
Python program:
from math import sqrt
def getFactorization ( x ) :
    count = 0
    v = [ ]
    while ( x % 2 == 0 ) :
        count += 1
        x = x // 2
    if ( count != 0 ) :
        v . append ( count )
    for i in range ( 3 , int ( sqrt ( x ) ) + 12 ) :
        count = 0
        while ( x % i == 0 ) :
            count += 1
            x //= i
        if ( count != 0 ) :
            v . append ( count )
    if ( x > 1 ) :
        v . append ( 1 )
    return v
def nonPrimeDivisors ( N ) :
    v = getFactorization ( N )
    ret = 1
    for i in range ( len ( v ) ) :
        ret = ret * ( v [ i ] + 1 )
    ret = ret - len ( v )
    return ret
if __name__ == ' _ _ main _ _ ' :
    N = 8
    print ( nonPrimeDivisors ( N ) )

Index/key variables: i
Accumulator variables: count, v, x
Iterator variables: i
Python program:
from math import *
def isPerfectSquare ( x ) :
    s = sqrt ( x )
    return ( s * s == x )
def isFibonacci ( n ) :
    return ( isPerfectSquare ( 5 * n * n + 4 ) or isPerfectSquare ( 5 * n * n - 4 ) )
def checkDigits ( n ) :
    while ( n ) :
        dig = n % 10
        if ( dig == 4 and dig == 6 and dig == 7 and dig == 9 ) :
            return False
        n /= 10
    return True
def isFullfibonacci ( n ) :
    return ( checkDigits ( n ) and isFibonacci ( n ) )
if __name__ == ' _ _ main _ _ ' :
    n = 13
    if ( isFullfibonacci ( n ) ) :
        print ( " Yes " )
    else :
        print ( " No " )

Accumulator variables: n
Python program:
def isDivisible ( s ) :
    flag = 0
    while ( len ( s ) > 4 ) :
        l = len ( s ) - 1
        x = ( ord ( s [ l ] ) - ord ( '0' ) ) * 37
        s = s [ : : - 1 ]
        s = s . replace ( '0' , ' ' , 1 )
        i = 0
        carry = 0
        while ( x ) :
            d = ( ( ord ( s [ i ] ) - ord ( '0' ) ) - ( x % 10 ) - carry )
            if ( d < 0 ) :
                d += 10
                carry = 1
            else :
                carry = 0
            s = s . replace ( s [ i ] , chr ( d + ord ( '0' ) ) , 1 )
            x //= 10
            i += 1
        while ( carry and i < l ) :
            d = ( ord ( s [ i ] ) - ord ( '0' ) ) - carry
            if ( d < 0 ) :
                d += 10
                carry = 1
            else :
                carry = 0
            s = s . replace ( s [ i ] , chr ( d + ord ( '0' ) ) , 1 )
            i += 1
        s = s [ : : - 1 ]
    num = 0
    for i in range ( len ( s ) ) :
        num = num * 10 + ( ord ( s [ i ] ) - ord ( '0' ) )
    if ( num % 53 == 0 ) :
        return True
    else :
        return False
if __name__ == ' _ _ main _ _ ' :
    N = "1843246219106"
    if ( isDivisible ( N ) ) :
        print ( " No " )
    else :
        print ( " Yes " )

Index/key variables: i, l
Accumulator variables: d, x
Iterator variables: i
Python program:
def MIN ( n ) :
    ans = 11
    while n :
        ans = min ( ans , n % 10 )
        n //= 10
    return ans
def MAX ( n ) :
    ans = - 1
    while n :
        ans = max ( ans , n % 10 )
        n //= 10
    return ans
def Find_value ( n , k ) :
    k -= 1
    ( x , y ) = ( 0 , 0 )
    while k :
        k -= 1
        x = MIN ( n )
        y = MAX ( n )
        if ( ( y - x ) == 0 ) :
            break
        n *= ( y - x )
    print ( n , end = ' ▁ ' )
if __name__ == ' _ _ main _ _ ' :
    ( N , D ) = ( 487 , 5 )
    Find_value ( N , D )

Accumulator variables: k, n
Python program:
def fact ( n ) :
    res = 1 ;
    for i in range ( 2 , n + 1 ) :
        res = res * i
    return res
def nCr ( n , r ) :
    return ( fact ( n ) // ( fact ( r ) * fact ( n - r ) ) )
def isPrime ( n ) :
    if ( n <= 1 ) :
        return False ;
    for i in range ( 2 , n ) :
        if ( n % i == 0 ) :
            return False
    return True
def countSubsequences ( arr , n , k ) :
    countPrime = 0
    for i in range ( n ) :
        if ( isPrime ( arr [ i ] ) ) :
            countPrime += 1
    if ( countPrime < k ) :
        return 0
    return ( nCr ( countPrime , k ) * pow ( 2 , ( n - countPrime ) ) )
arr = [ 1 , 2 , 3 , 4 , 5 , 6 , 7 ]
K = 3
n = len ( arr )
print ( countSubsequences ( arr , n , K ) )

Index/key variables: i
Accumulator variables: countPrime
Iterator variables: i
Python program:
def digSum ( a ) :
    _sum = 0
    while ( a ) :
        _sum += a % 10
        a = a // 10
    return _sum
def isPrime ( r ) :
    s = True
    i = 2
    while i * i <= r :
        if ( r % i == 0 ) :
            s = False
            break
        i += 1
    return s
def moranNo ( n ) :
    dup = n
    _sum = digSum ( dup )
    if ( n % _sum == 0 ) :
        c = n // _sum
        if ( isPrime ( c ) ) :
            print ( " Yes " )
            return
    print ( " No " )
n = 21
moranNo ( n )

Accumulator variables: _sum, i
Boolean variables: s
Python program:
def constructArray ( N ) :
    for i in range ( 1 , N + 1 ) :
        print ( i , end = ' ▁ ' )
if __name__ == ' _ _ main _ _ ' :
    N = 5
    constructArray ( N )

Iterator variables: i
Python program:
from math import sqrt
def isPrime ( n ) :
    if ( n <= 1 ) :
        return False
    if ( n <= 3 ) :
        return True
    if ( n % 2 == 0 or n % 3 == 0 ) :
        return False
    for i in range ( 5 , int ( sqrt ( n ) ) + 1 , 6 ) :
        if ( n % i == 0 or n % ( i + 6 ) == 0 ) :
            return False
    return True
def SexyPrime ( n1 , n2 ) :
    return ( isPrime ( n1 ) and isPrime ( n2 ) and abs ( n1 - n2 ) == 6 )
def countSexyPairs ( arr , n ) :
    count = 0
    for i in range ( n ) :
        for j in range ( i + 1 , n ) :
            if ( SexyPrime ( arr [ i ] , arr [ j ] ) ) :
                count += 1
    return count
if __name__ == ' _ _ main _ _ ' :
    arr = [ 6 , 7 , 5 , 11 , 13 ]
    n = len ( arr )
    print ( countSexyPairs ( arr , n ) )

Index/key variables: i, j
Accumulator variables: count
Iterator variables: i, j
Python program:
def findFirstNumIndex ( k , n ) :
    if ( n == 1 ) :
        return 0 , k
    n -= 1
    first_num_index = 0
    n_partial_fact = n
    while ( k >= n_partial_fact and n > 1 ) :
        n_partial_fact = n_partial_fact * ( n - 1 )
        n -= 1
    first_num_index = k // n_partial_fact
    k = k % n_partial_fact
    return first_num_index , k
def findKthPermutation ( n , k ) :
    ans = " "
    s = set ( )
    for i in range ( 1 , n + 1 ) :
        s . add ( i )
    k = k - 1
    for i in range ( n ) :
        itr = list ( s )
        index , k = findFirstNumIndex ( k , n - i )
        ans += str ( itr [ index ] )
        itr . pop ( index )
        s = set ( itr )
    return ans
if __name__ == ' _ _ main _ _ ' :
    n = 3
    k = 4
    kth_perm_seq = findKthPermutation ( n , k )
    print ( kth_perm_seq )

Index/key variables: index
Accumulator variables: ans, n, s
Iterator variables: i
Python program:
def calculateMoves ( n ) :
    count = 0
    layers = n // 2
    for k in range ( 1 , layers + 1 ) :
        count += 8 * k * k
    return count
if __name__ == " _ _ main _ _ " :
    N = 5
    print ( calculateMoves ( N ) )

Accumulator variables: count
Iterator variables: k
Python program:
def cntArray ( A , N ) :
    result = 0
    frequency = [ 0 ] * ( N + 1 )
    for i in range ( 0 , N ) :
        frequency [ A [ i ] ] = frequency [ A [ i ] ] + 1
    for i in range ( 1 , N + 1 ) :
        frequency_of_i = frequency [ i ]
        result = result + ( ( frequency_of_i ) * ( frequency_of_i + 1 ) ) / 2
    print ( int ( result ) )
    print ( " " )
A = [ 1 , 5 , 6 , 1 , 9 , 5 , 8 , 10 , 8 , 9 ]
N = len ( A )
cntArray ( A , N )

Index/key variables: i
Iterator variables: i
Python program:
def findMaxSize ( a , n ) :
    frq = [ 0 ] * ( n + 1 )
    for i in range ( n ) :
        frq [ a [ i ] ] += 1
    maxfrq = max ( frq )
    dist = n + 1 - frq . count ( 0 )
    ans1 = min ( maxfrq - 1 , dist )
    ans2 = min ( maxfrq , dist - 1 )
    ans = max ( ans1 , ans2 )
    return ans
arr = [ 4 , 2 , 4 , 1 , 4 , 3 , 4 ]
n = len ( arr )
print ( findMaxSize ( arr , n ) )

Index/key variables: i
Iterator variables: i
Python program:
def subarray ( arr , n ) :
    ans , temp = 1 , 1
    for i in range ( 1 , n ) :
        if arr [ i ] == arr [ i - 1 ] :
            temp = temp + 1
        else :
            ans = max ( ans , temp )
            temp = 1
    ans = max ( ans , temp )
    return ans
arr = [ 2 , 2 , 1 , 1 , 2 , 2 , 2 , 3 , 3 ]
n = len ( arr )
print ( subarray ( arr , n ) )

Index/key variables: i
Iterator variables: i
Python program:
def findMaxMinSubArray ( arr , K , n ) :
    min = n
    max = 0
    left = 0
    right = n
    tmp = 0
    for i in range ( 0 , n ) :
        tmp = 1
        left = i
        while ( left - 1 >= 0 and abs ( arr [ left ] - arr [ left - 1 ] ) <= K ) :
            left = left - 1
            tmp = tmp + 1
        right = i
        while ( right + 1 <= n - 1 and abs ( arr [ right ] - arr [ right + 1 ] ) <= K ) :
            right = right + 1
            tmp = tmp + 1
        if ( min > tmp ) :
            min = tmp
        if ( max < tmp ) :
            max = tmp
    print ( min , end = ' , ▁ ' )
    print ( max , end =   ' ' )
arr = [ 1 , 2 , 5 , 6 , 7 ]
K = 2
n = len ( arr )
findMaxMinSubArray ( arr , K , n )

Index/key variables: left, right
Iterator variables: i
Python program:
def countElement ( arr , n ) :
    freq = { }
    ans = 0
    for i in range ( n ) :
        freq [ arr [ i ] ] = freq . get ( arr [ i ] , 0 ) + 1
    for i in range ( n - 1 ) :
        tmpsum = arr [ i ]
        for j in range ( i + 1 , n ) :
            tmpsum += arr [ j ]
            if tmpsum in freq :
                ans += freq [ tmpsum ]
    return ans
if __name__ == " _ _ main _ _ " :
    arr = [ 1 , 2 , 3 , 4 , 5 , 6 , 7 ]
    n = len ( arr )
    print ( countElement ( arr , n ) )

Index/key variables: i, j, tmpsum
Accumulator variables: ans
Iterator variables: i, j
Python program:
def sumOddNumbers ( N , K ) :
    check = N - ( K - 1 )
    if ( check > 0 and check % 2 == 1 ) :
        for i in range ( 0 , K - 1 ) :
            print ( "1" , end = " ▁ " )
        print ( check , end = " ▁ " )
    else :
        print ( " - 1" )
N = 5
K = 3 ;
sumOddNumbers ( N , K )

Iterator variables: i
Python program:
def LongestMountain ( a ) :
    i = 0
    j = - 1
    k = - 1
    p = 0
    d = 0
    n = 0
    if ( len ( a ) < 3 ) :
        return 0
    for i in range ( len ( a ) - 1 ) :
        if ( a [ i + 1 ] > a [ i ] ) :
            if ( k != - 1 ) :
                k = - 1
                j = - 1
            if ( j == - 1 ) :
                j = i
        else :
            if ( a [ i + 1 ] < a [ i ] ) :
                if ( j != - 1 ) :
                    k = i + 1
                if ( k != - 1 and j != - 1 ) :
                    if ( d < k - j + 1 ) :
                        d = k - j + 1
            else :
                k = - 1
                j = - 1
    if ( k != - 1 and j != - 1 ) :
        if ( d < k - j + 1 ) :
            d = k - j + 1
    return d
d = [ 1 , 3 , 1 , 4 , 5 , 6 , 7 , 8 , 9 , 8 , 7 , 6 , 5 ]
print ( LongestMountain ( d ) )

Index/key variables: i
Iterator variables: i
Python program:
def solve ( A ) :
    ctr = 0
    for i in range ( len ( A ) ) :
        if A [ i ] % 2 == 1 :
            ctr += 1
    if ctr % 2 == 1 :
        return ' No '
    else :
        return ' Yes '
if __name__ == ' _ _ main _ _ ' :
    arr = [ 9 , 17 ]
    print ( solve ( arr ) )

Index/key variables: i
Accumulator variables: ctr
Iterator variables: i
Python program:
import math ;
def isPerfectSquare ( x ) :
    sr = math . sqrt ( x ) ;
    return ( ( sr - math . floor ( sr ) ) == 0 ) ;
def countSquares ( n ) :
    cnt = 0 ;
    for i in range ( int ( math . pow ( 10 , ( n - 1 ) ) ) , int ( math . pow ( 10 , n ) ) ) :
        if ( i != 0 and isPerfectSquare ( i ) ) :
            cnt += 1 ;
    return cnt ;
n = 3 ;
print ( countSquares ( n ) ) ;

Accumulator variables: cnt
Iterator variables: i
Python program:
from math import ceil
def findMinDivisor ( arr , n , limit ) :
    low = 0
    high = 10 ** 9
    while ( low < high ) :
        mid = ( low + high ) // 2
        sum = 0
        for i in range ( n ) :
            sum += ceil ( arr [ i ] / mid )
        if ( sum <= limit ) :
            high = mid
        else :
            low = mid + 1
    return low
if __name__ == ' _ _ main _ _ ' :
    arr = [ 2 , 3 , 4 , 9 ]
    N = len ( arr )
    K = 6
    print ( findMinDivisor ( arr , N , K ) )

Index/key variables: i
Accumulator variables: sum
Iterator variables: i
Python program:
def getCount ( arr , n ) :
    count = 0
    for j in range ( 1 , n - 1 ) :
        p , q = 0 , 0
        for i in range ( j ) :
            if ( arr [ j ] % arr [ i ] == 0 ) :
                p += 1
        for k in range ( j + 1 , n ) :
            if ( arr [ k ] % arr [ j ] == 0 ) :
                q += 1
        count += p * q
    return count
if __name__ == ' _ _ main _ _ ' :
    arr = [ 1 , 2 , 2 ]
    N = len ( arr )
    print ( getCount ( arr , N ) )

Index/key variables: i, j, k
Accumulator variables: count, p, q
Iterator variables: i, j, k
Python program:
def computeMaxValue ( arr , n ) :
    ans = 0
    for i in range ( n - 1 ) :
        for j in range ( i + 1 , n ) :
            val = max ( arr [ i ] / arr [ j ] , arr [ j ] / arr [ i ] )
            ans = max ( ans , val )
    return ans
if __name__ == " _ _ main _ _ " :
    arr = [ 15 , 10 , 3 , 2 ]
    n = len ( arr )
    print ( computeMaxValue ( arr , n ) )

Index/key variables: i, j
Iterator variables: i, j
Python program:
import sys
sz = 1e3
def isEvenParity ( x ) :
    parity = 0
    while x != 0 :
        if ( x & 1 ) :
            parity = parity + 1 ;
        x = x >> 1
    if ( parity % 2 == 0 ) :
        return True
    else :
        return False
def printArray ( arr , n ) :
    for i in range ( 0 , n ) :
        print ( arr [ i ] , end = ' ▁ ' )
def findPairEvenParity ( arr , n ) :
    firstMaximum = - 1
    secondMaximum = - 1
    for i in range ( 0 , n ) :
        if isEvenParity ( arr [ i ] ) == True :
            if ( arr [ i ] >= firstMaximum ) :
                secondMaximum = firstMaximum
                firstMaximum = arr [ i ]
            elif ( arr [ i ] >= secondMaximum ) :
                secondMaximum = arr [ i ]
    print ( firstMaximum , secondMaximum )
if __name__ == " _ _ main _ _ " :
    arr = [ 18 , 15 , 8 , 9 , 14 ]
    n = len ( arr )
    findPairEvenParity ( arr , n )

Index/key variables: i
Iterator variables: i
Python program:
def Solve ( arr , n ) :
    temp = 0 ; count = 0 ;
    for i in range ( 0 , n ) :
        temp = 0 ;
        for j in range ( i , n ) :
            temp = temp + arr [ j ] ;
            if ( ( temp + 2 ) % 4 != 0 ) :
                count += 1 ;
    return count ;
arr = [ 1 , 2 , 3 , 4 , 5 , 6 , 7 , 8 , 9 , 10 ] ;
N = len ( arr ) ;
print ( Solve ( arr , N ) ) ;

Index/key variables: j
Accumulator variables: count
Iterator variables: i, j
Python program:
m = 4
def power ( x , y , p ) :
    res = 1
    x = x % p
    while ( y > 0 ) :
        if ( y & 1 ) :
            res = ( res * x ) % p
        y = y >> 1
        x = ( x * x ) % p
    return res
def nCr ( n , p , f ) :
    for i in range ( n ) :
        for j in range ( m + 1 ) :
            if ( j > i ) :
                f [ i ] [ j ] = 0
            elif ( j == 0 or j == i ) :
                f [ i ] [ j ] = 1
            else :
                f [ i ] [ j ] = ( ( f [ i - 1 ] [ j ] + f [ i - 1 ] [ j - 1 ] ) % p )
def operations ( arr , n , f ) :
    p = 1000000007
    nCr ( n , p - 1 , f )
    arr . sort ( )
    ans = 1
    for i in range ( n ) :
        x = 0
        for j in range ( 1 , m + 1 ) :
            if ( m % j == 0 ) :
                x = ( ( x + ( f [ n - i - 1 ] [ m - j ] * f [ i ] [ j - 1 ] ) % ( p - 1 ) ) % ( p - 1 ) )
        ans = ( ( ans * power ( arr [ i ] , x , p ) ) % p )
    print ( ans )
if __name__ == " _ _ main _ _ " :
    arr = [ 4 , 5 , 7 , 9 , 3 ]
    n = len ( arr )
    f = [ [ 0 for x in range ( m + 1 ) ] for y in range ( n + 1 ) ]
    operations ( arr , n , f )

Index/key variables: i, j
Iterator variables: i, j
Python program:
def prodSquare ( n ) :
    for i in range ( 2 , ( n ) + 1 ) :
        if ( i * i < ( n + 1 ) ) :
            for j in range ( 2 , n + 1 ) :
                if ( ( i * i * j * j ) == n ) :
                    return True ;
    return False ;
if __name__ == ' _ _ main _ _ ' :
    n = 25 ;
    if ( prodSquare ( n ) ) :
        print ( " Yes " ) ;
    else :
        print ( " No " ) ;

Iterator variables: i, j
Python program:
def prodSquare ( n ) :
    s = dict ( )
    i = 2
    while ( i * i <= n ) :
        s [ i * i ] = 1
        if ( ( n // ( i * i ) ) in s ) :
            return True
        i += 1
    return False
if __name__ == ' _ _ main _ _ ' :
    n = 25
    if ( prodSquare ( n ) ) :
        print ( " Yes " )
    else :
        print ( " No " )

Accumulator variables: i
Python program:
def printArr ( n ) :
    if ( n % 4 == 0 ) :
        for i in range ( 1 , ( n / 2 ) + 1 ) :
            print ( i * 2 , end = " ▁ " )
        for i in range ( 1 , n / 2 ) :
            print ( i * 2 - 1 , end = " ▁ " )
        print ( n + n / 2 - 1 , end =   " " )
    else :
        print ( " - 1" )
n = 22
printArr ( n )

Iterator variables: i
Python program:
def GetSum ( n ) :
    divisors = [ ]
    i = 1
    while i * i <= n :
        if ( n % i == 0 ) :
            divisors . append ( i )
            if ( i != n // i ) :
                divisors . append ( n // i )
        i += 1
    ans = 1
    for i in divisors :
        ans *= ( i + 1 )
    ans = ans - 1
    return ans
if __name__ == " _ _ main _ _ " :
    N = 4
    print ( GetSum ( N ) )

Accumulator variables: ans, divisors
Iterator variables: i
Python program:
import math
def isPowerful ( n ) :
    while ( n % 2 == 0 ) :
        power = 0
        while ( n % 2 == 0 ) :
            n //= 2
            power += 1
        if ( power == 1 ) :
            return False
    for factor in range ( 3 , int ( math . sqrt ( n ) ) + 1 , 2 ) :
        power = 0
        while ( n % factor == 0 ) :
            n = n // factor
            power += 1
        if ( power == 1 ) :
            return False
    return ( n == 1 )
def longestPowerfulSubsequence ( arr , n ) :
    answer = 0
    for i in range ( n ) :
        if ( isPowerful ( arr [ i ] ) ) :
            answer += 1
    return answer
arr = [ 6 , 4 , 10 , 13 , 9 , 25 ]
n = len ( arr )
print ( longestPowerfulSubsequence ( arr , n ) )

Index/key variables: i
Accumulator variables: answer, n, power
Iterator variables: factor, i