dhyuti-n/xlcost-variable-roles huggingface dataset:
Python program:
MAX = 10000
prime = [ True for i in range ( MAX + 1 ) ]
def SieveOfEratosthenes ( ) :
    prime [ 1 ] = False
    for p in range ( 2 , MAX + 1 ) :
        if ( prime [ p ] == True ) :
            i = p * 2
            while ( i <= MAX ) :
                prime [ i ] = False
                i = i + p
def solve ( n ) :
    count = 0
    num = 1
    total = 0
    while ( count < n ) :
        if ( prime [ num ] ) :
            total = total + num
            count = count + 1
        num = num + 1
    return total
SieveOfEratosthenes ( )
n = 4
print ( " Sum ▁ of ▁ 1st ▁ N ▁ prime ▁ " + " numbers ▁ are ▁ : " , solve ( n ) )

Index/key variables: i, num, p
Iterator variables: p
Python program:
import math as ma
def CountDigits ( n ) :
    if ( n == 1 ) :
        return 1
    sum = 0
    for i in range ( 2 , n + 1 ) :
        sum += ma . log ( i , 10 )
    sum *= n
    return ma . ceil ( sum )
if __name__ == ' _ _ main _ _ ' :
    N = 5
    print ( CountDigits ( N ) )

Accumulator variables: sum
Iterator variables: i
Python program:
MAX = 200006
CONS = 32766
def calc ( a , b , lr , q , n ) :
    cc = 0
    for i in range ( n - 1 ) :
        a [ i + 1 ] += a [ i ]
        b [ i + 1 ] += b [ i ]
    while ( q > 0 ) :
        l = lr [ cc ]
        cc += 1
        r = lr [ cc ]
        cc += 1
        l -= 2
        r -= 1
        suma = a [ r ]
        sumb = b [ r ]
        if ( l >= 0 ) :
            suma -= a [ l ]
            sumb -= b [ l ]
        M = max ( CONS * suma + CONS * sumb , - CONS * suma - CONS * sumb )
        M = max ( M , max ( CONS * suma - CONS * sumb , - CONS * suma + CONS * sumb ) )
        m = min ( CONS * suma + CONS * sumb , - CONS * suma - CONS * sumb )
        m = min ( m , min ( CONS * suma - CONS * sumb , - CONS * suma + CONS * sumb ) )
        print ( M - m )
        q -= 1
if __name__ == " _ _ main _ _ " :
    n = 5
    q = 2
    a = [ 0 , 7 , 3 , 4 , 5 ]
    b = [ 0 , 3 , 1 , 2 , 3 ]
    lr = [ 0 ] * ( q * 2 )
    lr [ 0 ] = 1
    lr [ 1 ] = 1
    lr [ 2 ] = 1
    lr [ 3 ] = 3
    calc ( a , b , lr , q , n )

Index/key variables: cc, i, l, r
Accumulator variables: q, suma, sumb
Iterator variables: i
Python program:
power = [ 0 ] * 31
pre = [ 0 ] * 31
def PowerOfTwo ( ) :
    x = 1
    for i in range ( 31 ) :
        power [ i ] = x
        x *= 2
    pre [ 0 ] = 1
    for i in range ( 1 , 31 ) :
        pre [ i ] = pre [ i - 1 ] + power [ i ]
def Sum ( n ) :
    ans = n * ( n + 1 ) // 2
    for i in range ( 31 ) :
        if ( power [ i ] > n ) :
            ans -= 2 * pre [ i - 1 ]
            break
    return ans
if __name__ == " _ _ main _ _ " :
    PowerOfTwo ( )
    n = 4
    print ( Sum ( n ) )

Index/key variables: i
Accumulator variables: ans, x
Iterator variables: i
Python program:
def findNumber ( n ) :
    i = n - 1
    while ( i >= 0 ) :
        count = [ 0 for i in range ( 10 ) ]
        x = i
        count1 = 0
        count2 = 0
        while ( x ) :
            count [ x % 10 ] += 1
            x = int ( x / 10 )
            count1 += 1
        for j in range ( 0 , 10 , 1 ) :
            if ( count [ j ] == 1 ) :
                count2 += 1
        if ( count1 == count2 ) :
            return i
        i -= 1
if __name__ == ' _ _ main _ _ ' :
    n = 8490
    print ( findNumber ( n ) )

Index/key variables: j
Accumulator variables: count1, count2, i
Iterator variables: j
Python program:
class Node :
    def __init__ ( self ) :
        self . data = 0
        self . next = None
def isPermutation ( first , second ) :
    sum1 = 0
    sum2 = 0
    mul1 = 1
    mul2 = 1
    temp1 = first
    while ( temp1 != None ) :
        sum1 += temp1 . data
        mul1 *= temp1 . data
        temp1 = temp1 . next
    temp2 = second
    while ( temp2 != None ) :
        sum2 += temp2 . data
        mul2 *= temp2 . data
        temp2 = temp2 . next
    return ( ( sum1 == sum2 ) and ( mul1 == mul2 ) )
def push ( head_ref , new_data ) :
    new_node = Node ( )
    new_node . data = new_data
    new_node . next = head_ref
    head_ref = new_node
    return head_ref
if __name__ == ' _ _ main _ _ ' :
    first = None
    first = push ( first , 1 )
    first = push ( first , 34 )
    first = push ( first , 10 )
    first = push ( first , 1 )
    first = push ( first , 35 )
    first = push ( first , 12 )
    second = None
    second = push ( second , 35 )
    second = push ( second , 1 )
    second = push ( second , 12 )
    second = push ( second , 1 )
    second = push ( second , 10 )
    second = push ( second , 34 )
    if ( isPermutation ( first , second ) ) :
        print ( " Yes " )
    else :
        print ( " No " )

Accumulator variables: mul1, mul2, sum1, sum2
Class/struct names: Node
Python program:
def countDivisors ( n , k ) :
    count = 0
    for i in range ( 1 , n + 1 ) :
        if ( n % i == 0 and i % k == 0 ) :
            count += 1
    return count
if __name__ == " _ _ main _ _ " :
    n , k = 12 , 3
    print ( countDivisors ( n , k ) )

Accumulator variables: count
Iterator variables: i
Python program:
MOD = 1000000007
def power ( x , y , p ) :
    res = 1
    x = x % p
    while y > 0 :
        if y & 1 :
            res = ( res * x ) % p
        x = ( x * x ) % p
    return res
def sumProd ( n , t ) :
    dino = power ( t + 1 , MOD - 2 , MOD )
    ans = 1
    for i in range ( n + t + 1 , n , - 1 ) :
        ans = ( ans % MOD * i % MOD ) % MOD
    tfact = 1
    for i in range ( 1 , t + 1 ) :
        tfact = ( tfact * i ) % MOD
    ans = ans * dino - tfact + MOD
    return ans % MOD
if __name__ == " _ _ main _ _ " :
    n , t = 3 , 2
    print ( sumProd ( n , t ) )

Iterator variables: i
Python program:
mod = 1000000007
def power ( a , b ) :
    res = 1
    while ( b ) :
        if ( b & 1 ) :
            res *= a
            res %= mod
        b //= 2
        a *= a
        a %= mod
    return res
def minPlayer ( n , k ) :
    num = ( ( power ( k , n ) - 1 ) + mod ) % mod
    den = ( power ( k - 1 , mod - 2 ) + mod ) % mod
    ans = ( ( ( num * den ) % mod ) * k ) % mod
    return ans
if __name__ == " _ _ main _ _ " :
    n , k = 3 , 3
    print ( minPlayer ( n , k ) )

Accumulator variables: a, b, res
Python program:
def sieveOfEratosthenes ( N , s ) :
    prime = [ False ] * ( N + 1 )
    for i in range ( 2 , N + 1 , 2 ) :
        s [ i ] = 2
    for i in range ( 3 , N + 1 , 2 ) :
        if prime [ i ] == False :
            s [ i ] = i
            for j in range ( i , ( N + 1 ) // i , 2 ) :
                if prime [ i * j ] == False :
                    prime [ i * j ] = True
                    s [ i * j ] = i
def findSum ( N ) :
    s = [ 0 ] * ( N + 1 )
    ans = 1
    sieveOfEratosthenes ( N , s )
    currFactor = s [ N ]
    power = 1
    while N > 1 :
        N //= s [ N ]
        if currFactor == s [ N ] :
            power += 1
            continue
        sum = 0
        for i in range ( power + 1 ) :
            sum += pow ( currFactor , i )
        ans *= sum
        currFactor = s [ N ]
        power = 1
    return ans
if __name__ == " _ _ main _ _ " :
    n = 12
    print ( " Sum ▁ of ▁ the ▁ factors ▁ is ▁ : " , end = " ▁ " )
    print ( findSum ( n ) )

Index/key variables: N, i
Accumulator variables: ans, power, sum
Iterator variables: i, j
Python program:
def countMultiples ( n ) :
    multiple = [ 2 , 3 , 5 ]
    count = 0
    mask = int ( pow ( 2 , 3 ) )
    for i in range ( 1 , mask ) :
        prod = 1
        for j in range ( 3 ) :
            if ( i & ( 1 << j ) ) :
                prod = prod * multiple [ j ]
        if ( bin ( i ) . count ( '1' ) % 2 == 1 ) :
            count = count + n // prod
        else :
            count = count - n // prod
    return count
if __name__ == ' _ _ main _ _ ' :
    n = 10
    print ( countMultiples ( n ) )

Index/key variables: j
Iterator variables: i, j
Python program:
def Circular ( n ) :
    Result = 1
    while n > 0 :
        Result = Result * n
        n -= 1
    return Result
if __name__ == " _ _ main _ _ " :
    n = 4
    print ( Circular ( n - 1 ) )

Accumulator variables: n
Python program:
def calTime ( arr , n ) :
    work = 0
    for i in range ( n ) :
        work += 1 / arr [ i ]
    return 1 / work
arr = [ 6.0 , 3.0 , 4.0 ]
n = len ( arr )
print ( calTime ( arr , n ) , " Hours " )

Index/key variables: i
Accumulator variables: work
Iterator variables: i
Python program:
from math import sqrt , floor
def printTwins ( low , high ) :
    prime = [ True for i in range ( high + 1 ) ]
    twin = False
    prime [ 0 ] = False
    prime [ 1 ] = False
    k = floor ( sqrt ( high ) ) + 2
    for p in range ( 2 , k , 1 ) :
        if ( prime [ p ] ) :
            for i in range ( p * 2 , high + 1 , p ) :
                prime [ i ] = False
    i = high
    while ( i >= low ) :
        if ( prime [ i ] and ( i - 2 >= low and prime [ i - 2 ] == True ) ) :
            print ( " Largest ▁ twins ▁ in ▁ given ▁ range : ( " , ( i - 2 ) , " , " , ( i ) , " ) " )
            twin = True
            break
        i -= 1
    if ( twin == False ) :
        print ( " No ▁ such ▁ pair ▁ exists " )
if __name__ == ' _ _ main _ _ ' :
    printTwins ( 10 , 100 )

Index/key variables: i, p
Iterator variables: i, p
Boolean variables: twin
Python program:
def MaximumDivisors ( X , Y ) :
    arr = [ 0 ] * ( Y - X + 1 )
    mx = 0
    cnt = 0
    i = 1
    while i * i <= Y :
        sq = i * i
        if ( ( X // i ) * i >= X ) :
            first_divisible = ( X // i ) * i
        else :
            first_divisible = ( X // i + 1 ) * i
        for j in range ( first_divisible , Y + 1 , i ) :
            if j < sq :
                continue
            elif j == sq :
                arr [ j - X ] += 1
            else :
                arr [ j - X ] += 2
        i += 1
    for i in range ( X , Y + 1 ) :
        if arr [ i - X ] > mx :
            cnt = 1
            mx = arr [ i - X ]
        elif arr [ i - X ] == mx :
            cnt += 1
    return cnt
if __name__ == " _ _ main _ _ " :
    X = 1
    Y = 10
    print ( MaximumDivisors ( X , Y ) )

Accumulator variables: cnt
Iterator variables: i, j
Python program:
def print_C ( p0 ) :
    i = 0 ;
    while ( True ) :
        flag = 1 ;
        x = pow ( 2 , i ) ;
        p1 = x * p0 + ( x - 1 ) ;
        for k in range ( 2 , p1 ) :
            if ( p1 % k == 0 ) :
                flag = 0 ;
                break ;
        if ( flag == 0 ) :
            break ;
        print ( p1 , end = " ▁ " ) ;
        i += 1 ;
p0 = 2 ;
print_C ( p0 ) ;

Accumulator variables: i
Iterator variables: k
Python program:
def findOddPair ( A , N ) :
    oddPair = 0
    for i in range ( 0 , N - 1 ) :
        for j in range ( i + 1 , N - 1 ) :
            if ( ( A [ i ] & A [ j ] ) % 2 != 0 ) :
                oddPair = oddPair + 1
    return oddPair
a = [ 5 , 1 , 3 , 2 ]
n = len ( a )
print ( findOddPair ( a , n ) )

Index/key variables: i, j
Iterator variables: i, j
Python program:
def summ ( n ) :
    if ( n == 0 ) :
        return 0 ;
    if ( n % 9 == 0 ) :
        return 9 ;
    else :
        return ( n % 9 ) ;
def printDigitalRoot ( n ) :
    maxi = 1 ;
    dig = 1 ;
    for i in range ( 1 , int ( pow ( n , 1 / 2 ) + 1 ) ) :
        if ( n % i == 0 ) :
            d1 = summ ( n / i ) ;
            d2 = summ ( i ) ;
            if ( d1 > maxi ) :
                dig = n / i ;
                maxi = d1 ;
            if ( d2 > maxi ) :
                dig = i ;
                maxi = d2 ;
            if ( d1 == maxi ) :
                if ( dig < ( n / i ) ) :
                    dig = n / i ;
                    maxi = d1 ;
            if ( d2 == maxi ) :
                if ( dig < i ) :
                    dig = i ;
                    maxi = d2 ;
    print ( int ( dig ) , " ▁ " , int ( maxi ) ) ;
if __name__ == ' _ _ main _ _ ' :
    n = 10 ;
    printDigitalRoot ( n ) ;

Iterator variables: i
Python program:
def checkEqual ( S ) :
    for i in range ( len ( S ) ) :
        if ( S [ i ] != '1' and S [ i ] != '0' and S [ i ] != '8' ) :
            return " No " ;
    start = 0 ;
    end = len ( S ) - 1 ;
    while ( start < end ) :
        if ( S [ start ] != S [ end ] ) :
            return " No " ;
        start += 1 ;
        end -= 1 ;
    return " Yes " ;
S = "101" ;
print ( checkEqual ( S ) ) ;

Index/key variables: end, i, start
Iterator variables: i
Python program:
def check_polydivisible ( n ) :
    N = n
    digit = [ ]
    while ( n > 0 ) :
        digit . append ( n % 10 )
        n /= 10
    digit . reverse ( )
    flag = True
    n = digit [ 0 ]
    for i in range ( 1 , len ( digit ) , 1 ) :
        n = n * 10 + digit [ i ]
        if ( n % ( i + 1 ) != 0 ) :
            flag = False
            break
    if ( flag ) :
        print ( N , " is ▁ Polydivisible ▁ number . " ) ;
    else :
        print ( N , " is ▁ Not ▁ Polydivisible ▁ number . " )
if __name__ == ' _ _ main _ _ ' :
    n = 345654
    check_polydivisible ( n )

Index/key variables: i
Accumulator variables: digit, n
Iterator variables: i
Boolean variables: flag
Python program:
def Log2n ( n ) :
    return ( 1 + Log2n ( n / 2 ) ) if ( n > 1 ) else 0 ;
def isPowerOfd ( n , d ) :
    count = 0 ;
    if ( n and ( n & ( n - 1 ) ) == 0 ) :
        while ( n > 1 ) :
            n >>= 1 ;
            count += 1 ;
        return ( count % ( Log2n ( d ) ) == 0 ) ;
    return False ;
n = 64 ;
d = 8 ;
if ( isPowerOfd ( n , d ) ) :
    print ( n , " is ▁ a ▁ power ▁ of " , d ) ;
else :
    print ( n , " is ▁ not ▁ a ▁ power ▁ of " , d ) ;

Accumulator variables: count, n
Python program:
def seriessum ( n ) :
    sum = 0
    for i in range ( 1 , n + 1 ) :
        sum += i * ( i + 1 ) / 2
    return sum
n = 4
print ( seriessum ( n ) )

Accumulator variables: sum
Iterator variables: i
Python program:
def checkCentrosymmetricted ( n , m ) :
    mid_row = 0 ;
    if ( ( n & 1 ) > 0 ) :
        mid_row = n / 2 + 1 ;
    else :
        mid_row = n / 2 ;
    for i in range ( int ( mid_row ) ) :
        for j in range ( n ) :
            if ( m [ i ] [ j ] != m [ n - i - 1 ] [ n - j - 1 ] ) :
                return False ;
    return True ;
n = 3 ;
m = [ [ 1 , 3 , 5 ] , [ 6 , 8 , 6 ] , [ 5 , 3 , 1 ] ] ;
if ( checkCentrosymmetricted ( n , m ) ) :
    print ( " Yes " ) ;
else :
    print ( " No " ) ;

Index/key variables: i, j
Iterator variables: i, j
Python program:
from math import gcd
def findGCD ( arr , n ) :
    result = arr [ 0 ]
    for i in range ( 1 , n ) :
        result = gcd ( arr [ i ] , result )
    return result
def compute ( arr , n ) :
    answer = [ ]
    GCD_of_array = findGCD ( arr , n )
    if ( GCD_of_array == arr [ 0 ] ) :
        answer . append ( arr [ 0 ] )
        for i in range ( 1 , n ) :
            answer . append ( arr [ 0 ] )
            answer . append ( arr [ i ] )
        for i in range ( len ( answer ) ) :
            print ( answer [ i ] , end = " ▁ " )
    else :
        print ( " No ▁ array ▁ can ▁ be ▁ build " )
if __name__ == ' _ _ main _ _ ' :
    n = 3
    input = [ 2 , 5 , 6 , 7 , 11 ]
    GCD = set ( )
    for i in range ( len ( input ) ) :
        GCD . add ( input [ i ] )
    arr = [ ]
    for i in GCD :
        arr . append ( i )
    compute ( arr , n )

Index/key variables: i
Accumulator variables: GCD, answer, arr
Iterator variables: i
Python program:
def binomialCoeff ( n , k ) :
    C = [ [ 0 for i in range ( k + 1 ) ] for j in range ( n + 1 ) ]
    for i in range ( n + 1 ) :
        for j in range ( min ( i , k ) + 1 ) :
            if ( j == 0 or j == i ) :
                C [ i ] [ j ] = 1
            else :
                C [ i ] [ j ] = ( C [ i - 1 ] [ j - 1 ] + C [ i - 1 ] [ j ] )
    return C [ n ] [ k ]
def k_Leaves ( n , k ) :
    ans = ( ( binomialCoeff ( n , k ) * binomialCoeff ( n , k - 1 ) ) // n )
    print ( " Number ▁ of ▁ trees ▁ " , " having ▁ 4 ▁ edges ▁ and ▁ exactly ▁ 2 ▁ " , " leaves ▁ : ▁ " , ans )
def numberOfNodes ( n , d ) :
    ans = binomialCoeff ( 2 * n - 1 - d , n - 1 )
    print ( " Number ▁ of ▁ Nodes ▁ " , " of ▁ degree ▁ 1 ▁ in ▁ a ▁ tree ▁ having ▁ 4 ▁ " , " edges ▁ : ▁ " , ans )
def rootDegreeR ( n , r ) :
    ans = r * binomialCoeff ( 2 * n - 1 - r , n - 1 )
    ans = ans // n
    print ( " Number ▁ of ▁ trees ▁ " , " having ▁ 4 ▁ edges ▁ where ▁ root ▁ has ▁ " , " degree ▁ 2 ▁ : ▁ " , ans )
if __name__ == ' _ _ main _ _ ' :
    k_Leaves ( 3 , 2 )
    numberOfNodes ( 3 , 1 )
    rootDegreeR ( 3 , 2 )

Index/key variables: i, j, k, n
Iterator variables: i, j
Python program:
def repUnitValue ( n ) :
    if ( n % 2 == 0 or n % 5 == 0 ) :
        return 0
    rem = 1
    power = 1
    k = 1
    while ( rem % n != 0 ) :
        k += 1
        power = power * 10 % n
        rem = ( rem + power ) % n
    return k
n = 13
print ( repUnitValue ( n ) )

Accumulator variables: k
Python program:
def isPossibleToZero ( a , n ) :
    num = 0 ;
    for i in range ( n ) :
        num = num * 10 + a [ i ] ;
    return ( num % 11 == 0 ) ;
arr = [ 0 , 1 , 1 , 0 ] ;
n = len ( arr ) ;
if ( isPossibleToZero ( arr , n ) ) :
    print ( " YES " ) ;
else :
    print ( " NO " ) ;

Index/key variables: i
Iterator variables: i
Python program:
def isBlumInteger ( n ) :
    prime = [ True ] * ( n + 1 )
    i = 2
    while ( i * i <= n ) :
        if ( prime [ i ] == True ) :
            for j in range ( i * 2 , n + 1 , i ) :
                prime [ j ] = False
        i = i + 1
    for i in range ( 2 , n + 1 ) :
        if ( prime [ i ] ) :
            if ( ( n % i == 0 ) and ( ( i - 3 ) % 4 ) == 0 ) :
                q = int ( n / i )
                return ( q != i and prime [ q ] and ( q - 3 ) % 4 == 0 )
    return False
n = 249
if ( isBlumInteger ( n ) ) :
    print ( " Yes " )
else :
    print ( " No " )

Index/key variables: i, j, q
Iterator variables: i, j
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
n = 5
r = 3
print ( int ( nCr ( n , r ) ) )

Iterator variables: i
Python program:
def find_sum_of_two_squares ( a , b ) :
    ab = a * b
    i = 0 ;
    while ( i * i <= ab ) :
        j = i
        while ( i * i + j * j <= ab ) :
            if ( i * i + j * j == ab ) :
                print ( i , " ^ 2 ▁ + ▁ " , j , " ^ 2 ▁ = ▁ " , ab )
            j += 1
        i += 1
a = 1 * 1 + 2 * 2
b = 3 * 3 + 4 * 4
print ( " Representation ▁ of ▁ a ▁ * ▁ b ▁ as ▁ sum " " ▁ of ▁ 2 ▁ squares : " )
find_sum_of_two_squares ( a , b )

Accumulator variables: i, j
Python program:
def check_euler_four_square_identity ( a , b , ab ) :
    s = 0 ;
    i = 0 ;
    while ( i * i <= ab ) :
        s = i * i ;
        j = i ;
        while ( j * j <= ab ) :
            s = j * j + i * i ;
            k = j ;
            while ( k * k <= ab ) :
                s = k * k + j * j + i * i ;
                l = k ;
                while ( l * l <= ab ) :
                    s = l * l + k * k + j * j + i * i ;
                    if ( s == ab ) :
                        print ( " i ▁ = " , i ) ;
                        print ( " j ▁ = " , j ) ;
                        print ( " k ▁ = " , k ) ;
                        print ( " l ▁ = " , l ) ;
                        print ( " Product ▁ of ▁ " , a , " and " , b , end = " " ) ;
                        print ( " ▁ can ▁ be ▁ written ▁ as ▁ sum ▁ of " , " squares ▁ of ▁ i , ▁ j , ▁ k , ▁ l " ) ;
                        print ( ab , " = ▁ " , end = " " ) ;
                        print ( i , " * " , i , " + ▁ " , end = " " ) ;
                        print ( j , " * " , j , " + ▁ " , end = " " ) ;
                        print ( k , " * " , k , " + ▁ " , end = " " ) ;
                        print ( l , " * " , l ) ;
                        print ( " " ) ;
                    l += 1 ;
                k += 1 ;
            j += 1 ;
        i += 1 ;
ab = a * b ;
check_euler_four_square_identity ( a , b , ab ) ;

Accumulator variables: i, j, k, l
Python program:
import math
def calculateDivisors ( A , B ) :
    N = A - B
    noOfDivisors = 0
    a = math . sqrt ( N )
    for i in range ( 1 , int ( a + 1 ) ) :
        if ( ( N % i == 0 ) ) :
            if ( i > B ) :
                noOfDivisors += 1
            if ( ( N / i ) != i and ( N / i ) > B ) :
                noOfDivisors += 1 ;
    return noOfDivisors
def numberOfPossibleWaysUtil ( A , B ) :
    if ( A == B ) :
        return - 1
    if ( A < B ) :
        return 0
    noOfDivisors = 0
    noOfDivisors = calculateDivisors ;
    return noOfDivisors
def numberOfPossibleWays ( A , B ) :
    noOfSolutions = numberOfPossibleWaysUtil ( A , B )
    if ( noOfSolutions == - 1 ) :
        print ( " For ▁ A ▁ = ▁ " , A , " ▁ and ▁ B ▁ = ▁ " , B , " , ▁ X ▁ can ▁ take ▁ Infinitely ▁ many ▁ values " , " ▁ greater ▁ than ▁ " , A )
    else :
        print ( " For ▁ A ▁ = ▁ " , A , " ▁ and ▁ B ▁ = ▁ " , B , " , ▁ X ▁ can ▁ take ▁ " , noOfSolutions , " ▁ values " )
A = 26
B = 2
numberOfPossibleWays ( A , B )
A = 21
B = 5
numberOfPossibleWays ( A , B )

Accumulator variables: noOfDivisors
Iterator variables: i
Python program:
import math
def powerNumbers ( n ) :
    v = [ ]
    for i in range ( 2 , int ( math . pow ( n , 1.0 / 3.0 ) ) + 1 ) :
        j = i * i
        while ( j * i <= n ) :
            j = j * i
            s = int ( math . sqrt ( j ) )
            if ( s * s != j ) :
                v . append ( j )
    v . sort ( )
    v = list ( dict . fromkeys ( v ) )
    return len ( v ) + int ( math . sqrt ( n ) )
if __name__ == ' _ _ main _ _ ' :
    print ( powerNumbers ( 50 ) )

Accumulator variables: v
Iterator variables: i
Python program:
import math ;
def mean ( a , n ) :
    sum = 0 ;
    for i in range ( n ) :
        for j in range ( n ) :
            sum += a [ i ] [ j ] ;
    return math . floor ( int ( sum / ( n * n ) ) ) ;
def variance ( a , n , m ) :
    sum = 0 ;
    for i in range ( n ) :
        for j in range ( n ) :
            a [ i ] [ j ] -= m ;
            a [ i ] [ j ] *= a [ i ] [ j ] ;
    for i in range ( n ) :
        for j in range ( n ) :
            sum += a [ i ] [ j ] ;
    return math . floor ( int ( sum / ( n * n ) ) ) ;
mat = [ [ 1 , 2 , 3 ] , [ 4 , 5 , 6 ] , [ 7 , 8 , 9 ] ] ;
m = mean ( mat , 3 ) ;
var = variance ( mat , 3 , m ) ;
dev = math . sqrt ( var ) ;
print ( " Mean : " , m ) ;
print ( " Variance : " , var ) ;
print ( " Deviation : " , math . floor ( dev ) ) ;

Index/key variables: i, j
Accumulator variables: sum
Iterator variables: i, j
Python program:
import math
def isValid ( i , m ) :
    sq_i = math . sqrt ( i )
    sq = min ( m , sq_i )
    for j in range ( 2 , sq + 1 ) :
        if ( i % j == 0 ) :
            return False
    return True
def findLargestNum ( n , m ) :
    for i in range ( n , m , - 1 ) :
        if ( isValid ( i , m ) ) :
            print ( " { } " . format ( i ) ) ;
            return
    print ( " Number Doesn ' t Exists " )
n = 16
m = 3
findLargestNum ( n , m )

Iterator variables: i, j
Python program:
def printGP ( a , r , n ) :
    for i in range ( 0 , n ) :
        curr_term = a * pow ( r , i )
        print ( curr_term , end = " ▁ " )
a = 2
r = 3
n = 5
printGP ( a , r , n )

Iterator variables: i