dhyuti-n/xlcost-variable-roles huggingface dataset:
Python program:
import math
sub = [ 0 for i in range ( 100005 ) ]
def minDivisorDifference ( n ) :
    num1 = 0
    num2 = 0
    for i in range ( int ( math . sqrt ( n ) ) , n + 1 ) :
        if ( n % i == 0 ) :
            num1 = i
            num2 = n // i
            break
    return abs ( num1 - num2 )
def dfs ( g , u , par ) :
    sub [ u ] = minDivisorDifference ( u )
    mx = 0
    for c in g [ u ] :
        if ( c != par ) :
            ans = dfs ( g , c , u )
            mx = max ( mx , ans )
    sub [ u ] += mx
    return sub [ u ]
if __name__ == ' _ _ main _ _ ' :
    g = [ [ ] for i in range ( 100005 ) ]
    edges = 6
    g [ 18 ] . append ( 7 )
    g [ 7 ] . append ( 18 )
    g [ 18 ] . append ( 15 )
    g [ 15 ] . append ( 18 )
    g [ 15 ] . append ( 2 )
    g [ 2 ] . append ( 15 )
    g [ 7 ] . append ( 4 )
    g [ 4 ] . append ( 7 )
    g [ 7 ] . append ( 12 )
    g [ 12 ] . append ( 7 )
    g [ 12 ] . append ( 9 )
    g [ 9 ] . append ( 12 )
    root = 18
    print ( dfs ( g , root , - 1 ) )

Index/key variables: u
Iterator variables: c, i
Python program:
def isCenteredcube ( N ) :
    i = 1 ;
    while ( True ) :
        ith_term = ( ( 2 * i + 1 ) * ( i * i + i + 1 ) ) ;
        if ( ith_term == N ) :
            return True ;
        if ( ith_term > N ) :
            return False ;
        i += 1 ;
N = 9 ;
if ( isCenteredcube ( N ) ) :
    print ( " Yes " ) ;
else :
    print ( " No " ) ;

Accumulator variables: i
Python program:
def productOfGP ( a , r , n ) :
    product = 1 ;
    for i in range ( 0 , n ) :
        product = product * a ;
        a = a * r ;
    return product ;
a = 1
r = 2 ;
N = 4 ;
print ( productOfGP ( a , r , N ) )

Iterator variables: i
Python program:
def gcd ( a , b ) :
    if ( b == 0 ) :
        return a
    return gcd ( b , a % b )
def findlcm ( arr , n ) :
    ans = arr [ 0 ]
    for i in range ( 1 , n ) :
        ans = ( ( ( arr [ i ] * ans ) ) // ( gcd ( arr [ i ] , ans ) ) )
    return ans
def addReduce ( n , num , den ) :
    final_numerator = 0
    final_denominator = findlcm ( den , n )
    for i in range ( n ) :
        final_numerator = ( final_numerator + ( num [ i ] ) * ( final_denominator // den [ i ] ) )
    GCD = gcd ( final_numerator , final_denominator )
    final_numerator //= GCD
    final_denominator //= GCD
    print ( final_numerator , " / " , final_denominator )
N = 3
arr1 = [ 1 , 2 , 5 ]
arr2 = [ 2 , 1 , 6 ]
addReduce ( N , arr1 , arr2 )

Index/key variables: i
Iterator variables: i
Python program:
import sys
def gcd ( a , b ) :
    if ( b == 0 ) :
        return a ;
    return gcd ( b , a % b ) ;
def minLCM ( arr , n ) :
    ans = 1000000000 ;
    for i in range ( n ) :
        for j in range ( i + 1 , n ) :
            g = gcd ( arr [ i ] , arr [ j ] ) ;
            lcm = arr [ i ] / g * arr [ j ] ;
            ans = min ( ans , lcm ) ;
    return ans ;
arr = [ 2 , 4 , 3 , 6 , 5 ] ;
print ( minLCM ( arr , 5 ) )

Index/key variables: i, j
Iterator variables: i, j
Python program:
from math import pow , ceil
def solve ( n ) :
    upper_limit = ceil ( pow ( n , 1.0 / 4 ) ) ;
    for x in range ( upper_limit + 1 ) :
        for y in range ( upper_limit + 1 ) :
            num1 = x * x * x * x ;
            num2 = y * y * y * y ;
            if ( num1 - num2 == n ) :
                print ( " x ▁ = " , x , " , ▁ y ▁ = " , y ) ;
                return ;
    print ( - 1 ) ;
if __name__ == " _ _ main _ _ " :
    n = 15 ;
    solve ( n ) ;

Iterator variables: x, y
Python program:
import math
def divisorsSame ( n ) :
    even_div = 0 ; odd_div = 0 ;
    for i in range ( 1 , int ( math . sqrt ( n ) ) ) :
        if ( n % i == 0 ) :
            if ( n // i == i ) :
                if ( i % 2 == 0 ) :
                    even_div += 1 ;
                else :
                    odd_div += 1 ;
            else :
                if ( i % 2 == 0 ) :
                    even_div += 1 ;
                else :
                    odd_div += 1 ;
                if ( n // ( i % 2 ) == 0 ) :
                    even_div += 1 ;
                else :
                    odd_div += 1 ;
    return ( even_div == odd_div ) ;
N = 6 ;
if ( divisorsSame ( N ) == 0 ) :
    print ( " Yes " ) ;
else :
    print ( " No " ) ;

Accumulator variables: even_div, odd_div
Iterator variables: i
Python program:
def isPrime ( n ) :
    if n <= 1 :
        return False
    if n <= 3 :
        return True
    if n % 2 == 0 or n % 3 == 0 :
        return False
    i = 5
    while i * i <= n :
        if ( n % i == 0 or n % ( i + 2 ) == 0 ) :
            return False
        i += 6
    return True
def isBalancedPrime ( n ) :
    if not isPrime ( n ) or n == 2 :
        return False
    previous_prime = n - 1
    next_prime = n + 1
    while not isPrime ( next_prime ) :
        next_prime += 1
    while not isPrime ( previous_prime ) :
        previous_prime -= 1
    mean = ( previous_prime + next_prime ) / 2
    if n == mean :
        return True
    else :
        return False
n = 53
if isBalancedPrime ( n ) :
    print ( " Yes " )
else :
    print ( " No " )

Accumulator variables: i, next_prime, previous_prime
Python program:
import math
N = 100001
adj = [ [ ] for i in range ( N ) ]
a = [ 0 for i in range ( N ) ]
ans = [ 0 for i in range ( N ) ]
def hasOddNumberOfDivisors ( n ) :
    if ( math . sqrt ( n ) == int ( math . sqrt ( n ) ) ) :
        return True
    return False
def dfs ( node , parent ) :
    count = 0
    for i in adj [ node ] :
        if ( i != parent ) :
            count += dfs ( i , node )
    if ( hasOddNumberOfDivisors ( a [ node ] ) ) :
        count += 1
    ans [ node ] = count
    return count
if __name__ == " _ _ main _ _ " :
    n = 5
    i = 0
    q = [ 4 , 1 , 5 , 3 ]
    adj [ 1 ] . append ( 2 )
    adj [ 2 ] . append ( 1 )
    adj [ 2 ] . append ( 3 )
    adj [ 3 ] . append ( 2 )
    adj [ 3 ] . append ( 4 )
    adj [ 4 ] . append ( 3 )
    adj [ 1 ] . append ( 5 )
    adj [ 5 ] . append ( 1 )
    a [ 1 ] = 4
    a [ 2 ] = 9
    a [ 3 ] = 14
    a [ 4 ] = 100
    a [ 5 ] = 5
    dfs ( 1 , - 1 )
    for i in range ( len ( q ) ) :
        print ( ans [ q [ i ] ] , end = ' ▁ ' )

Index/key variables: i, node
Accumulator variables: count
Iterator variables: i
Python program:
def lowerBound ( array , length , value ) :
    low = 0
    high = length
    while ( low < high ) :
        mid = ( low + high ) // 2
        if ( value <= array [ mid ] ) :
            high = mid
        else :
            low = mid + 1
    return low
def costCalculation ( current , arr , n , pref , a , r , minimum ) :
    index = lowerBound ( arr , len ( arr ) , current )
    left = index * current - pref [ index ]
    right = ( pref [ n ] - pref [ index ] - ( n - index ) * current )
    res = min ( left , right )
    left -= res
    right -= res
    total = res * minimum
    total += left * a
    total += right * r
    return total
def solve ( arr , n , a , r , m ) :
    arr . sort ( )
    minimum = min ( a + r , m )
    pref = [ 0 ] * ( n + 1 )
    for i in range ( n ) :
        pref [ i + 1 ] = pref [ i ] + arr [ i ]
    ans = 10000
    for i in range ( n ) :
        ans = min ( ans , costCalculation ( arr [ i ] , arr , n , pref , a , r , minimum ) )
    ans = min ( ans , costCalculation ( pref [ n ] // n , arr , n , pref , a , r , minimum ) )
    ans = min ( ans , costCalculation ( pref [ n ] // n + 1 , arr , n , pref , a , r , minimum ) )
    print ( ans )
if __name__ == " _ _ main _ _ " :
    arr = [ 5 , 5 , 3 , 6 , 5 ]
    A = 1
    R = 2
    M = 4
    size = len ( arr )
    solve ( arr , size , A , R , M )

Index/key variables: i, index, mid, n
Iterator variables: i
Python program:
from math import *
def countBinaries ( N ) :
    ctr = 1
    ans = 0
    while ( N > 0 ) :
        if ( N % 10 == 1 ) :
            ans += pow ( 2 , ctr - 1 )
        elif ( N % 10 > 1 ) :
            ans = pow ( 2 , ctr ) - 1
        ctr += 1
        N //= 10
    return ans
if __name__ == ' _ _ main _ _ ' :
    N = 20
    print ( int ( countBinaries ( N ) ) )

Accumulator variables: N, ans, ctr
Python program:
def countBinaries ( N ) :
    powersOfTwo = [ 0 ] * 11
    powersOfTwo [ 0 ] = 1
    for i in range ( 1 , 11 ) :
        powersOfTwo [ i ] = powersOfTwo [ i - 1 ] * 2
    ctr = 1
    ans = 0
    while ( N > 0 ) :
        if ( N % 10 == 1 ) :
            ans += powersOfTwo [ ctr - 1 ]
        elif ( N % 10 > 1 ) :
            ans = powersOfTwo [ ctr ] - 1
        ctr += 1
        N = N // 10
    return ans
N = 20
print ( countBinaries ( N ) )

Index/key variables: ctr, i
Accumulator variables: ans
Iterator variables: i
Python program:
def center_heptagonal_num ( n ) :
    return ( 7 * n * n - 7 * n + 2 ) // 2
def sum_center_heptagonal_num ( n ) :
    summ = 0
    for i in range ( 1 , n + 1 ) :
        summ += center_heptagonal_num ( i )
    return summ
if __name__ == ' _ _ main _ _ ' :
    n = 5
    print ( sum_center_heptagonal_num ( n ) )

Accumulator variables: summ
Iterator variables: i
Python program:
def Centered_Dodecagonal_num ( n ) :
    return 6 * n * ( n - 1 ) + 1
def sum_Centered_Dodecagonal_num ( n ) :
    summ = 0
    for i in range ( 1 , n + 1 ) :
        summ += Centered_Dodecagonal_num ( i )
    return summ
if __name__ == ' _ _ main _ _ ' :
    n = 5
    print ( sum_Centered_Dodecagonal_num ( n ) )

Accumulator variables: summ
Iterator variables: i
Python program:
def center_Octagonal_num ( n ) :
    return ( 4 * n * n - 4 * n + 1 )
def sum_center_Octagonal_num ( n ) :
    summ = 0
    for i in range ( 1 , n + 1 ) :
        summ += center_Octagonal_num ( i )
    return summ
if __name__ == ' _ _ main _ _ ' :
    n = 5
    print ( sum_center_Octagonal_num ( n ) )

Accumulator variables: summ
Iterator variables: i
Python program:
def Centered_decagonal_num ( n ) :
    return ( 5 * n * n - 5 * n + 1 )
def sum_Centered_decagonal_num ( n ) :
    summ = 0
    for i in range ( 1 , n + 1 ) :
        summ += Centered_decagonal_num ( i )
    return summ
if __name__ == ' _ _ main _ _ ' :
    n = 5
    print ( sum_Centered_decagonal_num ( n ) )

Accumulator variables: summ
Iterator variables: i
Python program:
def center_octadecagon_num ( n ) :
    return ( 9 * n * n - 9 * n + 1 )
def sum_center_octadecagon_num ( n ) :
    summ = 0
    for i in range ( 1 , n + 1 ) :
        summ += center_octadecagon_num ( i )
    return summ
if __name__ == ' _ _ main _ _ ' :
    n = 3
    print ( sum_center_octadecagon_num ( n ) )

Accumulator variables: summ
Iterator variables: i
Python program:
def Centered_Pentadecagonal_num ( n ) :
    return ( 15 * n * n - 15 * n + 2 ) // 2
def sum_Centered_Pentadecagonal_num ( n ) :
    summ = 0
    for i in range ( 1 , n + 1 ) :
        summ += Centered_Pentadecagonal_num ( i )
    return summ
if __name__ == ' _ _ main _ _ ' :
    n = 5
    print ( sum_Centered_Pentadecagonal_num ( n ) )

Accumulator variables: summ
Iterator variables: i
Python program:
def Icosagonal_num ( n ) :
    return ( 18 * n * n - 16 * n ) // 2
def sum_Icosagonal_num ( n ) :
    summ = 0
    for i in range ( 1 , n + 1 ) :
        summ += Icosagonal_num ( i )
    return summ
if __name__ == ' _ _ main _ _ ' :
    n = 5
    print ( sum_Icosagonal_num ( n ) )

Accumulator variables: summ
Iterator variables: i
Python program:
def Centered_Pentagonal_num ( n ) :
    return ( 5 * n * n - 5 * n + 2 ) // 2
def sum_Centered_Pentagonal_num ( n ) :
    summ = 0
    for i in range ( 1 , n + 1 ) :
        summ += Centered_Pentagonal_num ( i )
    return summ
if __name__ == ' _ _ main _ _ ' :
    n = 5
    print ( sum_Centered_Pentagonal_num ( n ) )

Accumulator variables: summ
Iterator variables: i
Python program:
def Centered_tridecagonal_num ( n ) :
    return ( 13 * n * ( n - 1 ) + 2 ) // 2
def sum_Centered_tridecagonal_num ( n ) :
    summ = 0
    for i in range ( 1 , n + 1 ) :
        summ += Centered_tridecagonal_num ( i )
    return summ
if __name__ == ' _ _ main _ _ ' :
    n = 5
    print ( sum_Centered_tridecagonal_num ( n ) )

Accumulator variables: summ
Iterator variables: i
Python program:
def computePrime ( N ) :
    Prime = [ True ] * ( N + 1 )
    Prime [ 0 ] = False
    Prime [ 1 ] = False
    i = 2
    while i * i <= N :
        if ( Prime [ i ] ) :
            for j in range ( i * i , N , i ) :
                Prime [ j ] = False
        i += 1
    return Prime
def countSexyPairs ( arr , n ) :
    maxE = max ( arr )
    Prime = computePrime ( maxE )
    count = 0
    freq = [ 0 ] * ( maxE + 6 )
    for i in range ( n ) :
        freq [ arr [ i ] ] += 1
    arr . sort ( )
    for i in range ( n ) :
        if ( Prime [ arr [ i ] ] ) :
            if ( ( arr [ i ] + 6 ) <= ( maxE ) and freq [ arr [ i ] + 6 ] > 0 and Prime [ arr [ i ] + 6 ] ) :
                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 isAutoBiographyNum ( number ) :
    count = 0 ;
    NUM = str ( number ) ;
    size = len ( NUM ) ;
    for i in range ( size ) :
        position = ord ( NUM [ i ] ) - ord ( '0' ) ;
        count = 0 ;
        for j in range ( size ) :
            digit = ord ( NUM [ j ] ) - ord ( '0' ) ;
            if ( digit == i ) :
                count += 1 ;
        if ( position != count ) :
            return False ;
    return True ;
def checkArray ( arr , n ) :
    current_length = 0 ;
    max_length = 0 ;
    for i in range ( n ) :
        if ( isAutoBiographyNum ( arr [ i ] ) ) :
            current_length += 1 ;
        else :
            current_length = 0 ;
        max_length = max ( max_length , current_length ) ;
    return max_length ;
if __name__ == " _ _ main _ _ " :
    arr = [ 21200 , 1 , 1303 , 1210 , 2020 ] ;
    n = len ( arr ) ;
    print ( checkArray ( arr , n ) ) ;

Index/key variables: i, j
Accumulator variables: count, current_length
Iterator variables: i, j
Python program:
MAX = 100000
graph = [ [ ] for i in range ( MAX + 1 ) ]
Prime = [ True for i in range ( MAX + 1 ) ]
height = [ 0 for i in range ( MAX + 1 ) ]
def SieveOfEratosthenes ( ) :
    Prime [ 0 ] = Prime [ 1 ] = False
    i = 2
    while i * i <= MAX :
        if ( Prime [ i ] ) :
            for j in range ( 2 * i , MAX , i ) :
                Prime [ j ] = False
        i += 1
def dfs ( node , parent , h ) :
    height [ node ] = h
    for to in graph [ node ] :
        if ( to == parent ) :
            continue
        dfs ( to , node , h + 1 )
def primeHeightNode ( N ) :
    SieveOfEratosthenes ( )
    for i in range ( 1 , N + 1 ) :
        if ( Prime [ height [ i ] ] ) :
            print ( i , end = ' ▁ ' )
if __name__ == " _ _ main _ _ " :
    N = 5
    graph [ 1 ] . append ( 2 )
    graph [ 1 ] . append ( 3 )
    graph [ 2 ] . append ( 4 )
    graph [ 2 ] . append ( 5 )
    dfs ( 1 , 1 , 0 )
    primeHeightNode ( N )

Index/key variables: i, j, node
Iterator variables: i, j, to
Python program:
def reverse ( a ) :
    rev = 0 ;
    while ( a != 0 ) :
        r = a % 10 ;
        rev = rev * 10 + r ;
        a = a // 10 ;
    return ( rev ) ;
def prime ( a ) :
    k = 0 ;
    for i in range ( 2 , a ) :
        if ( a % i == 0 ) :
            k = 1 ;
            break ;
    if ( k == 1 ) :
        return ( 0 ) ;
    else :
        return ( 1 ) ;
def adam ( a ) :
    r1 = reverse ( a ) ;
    s1 = a * a ;
    s2 = r1 * r1 ;
    r2 = reverse ( s2 ) ;
    if ( s1 == r2 ) :
        return ( 1 ) ;
    else :
        return ( 0 ) ;
def find ( m , n ) :
    if ( m > n ) :
        print ( " INVALID INPUT " ) ;
    else :
        c = 0 ;
    for i in range ( m , n ) :
        l = prime ( i ) ;
        k = adam ( i ) ;
        if ( ( l == 1 ) and ( k == 1 ) ) :
            print ( i , " TABSYMBOL " , end = " ▁ " ) ;
L = 5 ; R = 100 ;
find ( L , R ) ;

Iterator variables: i
Python program:
def digit_sum ( n ) :
    sum = 0
    while ( n > 0 ) :
        m = n % 10 ;
        sum = sum + m ;
        n = n // 10
    return ( sum )
def reverse ( n ) :
    r = 0
    while ( n != 0 ) :
        r = r * 10
        r = r + n % 10
        n = n // 10
    return ( r )
def operation ( n ) :
    i = 1
    count = 0
    while ( count < n ) :
        a = digit_sum ( i )
        r = reverse ( i )
        if ( i % a == 0 and r % a == 0 ) :
            print ( i , end = " ▁ " )
            count += 1
            i += 1
        else :
            i += 1
if __name__ == ' _ _ main _ _ ' :
    n = 10
    operation ( n )

Accumulator variables: count, i
Python program:
def createSets ( N ) :
    if ( N <= 2 ) :
        print ( " - 1" ) ;
        return ;
    for i in range ( 2 , N + 1 , 2 ) :
        print ( i , end = " ▁ " ) ;
    print ( " " ) ;
    for i in range ( 1 , N + 1 , 2 ) :
        print ( i , end = " ▁ " ) ;
if __name__ == ' _ _ main _ _ ' :
    N = 6 ;
    createSets ( N ) ;

Iterator variables: i
Python program:
graph = [ [ ] for i in range ( 100 ) ]
weight = [ 0 ] * 100
ans = 0
def isPowerful ( n ) :
    while ( n % 2 == 0 ) :
        power = 0 ;
        while ( n % 2 == 0 ) :
            n /= 2 ;
            power += 1 ;
        if ( power == 1 ) :
            return False ;
    factor = 3
    while ( factor * factor <= n ) :
        power = 0 ;
        while ( n % factor == 0 ) :
            n = n / factor ;
            power += 1 ;
        if ( power == 1 ) :
            return False ;
        factor += 2 ;
    return ( n == 1 ) ;
def dfs ( Node , parent ) :
    global ans ;
    if ( isPowerful ( weight [ Node ] ) ) :
        ans += 1 ;
    for to in graph [ Node ] :
        if ( to == parent ) :
            continue ;
        dfs ( to , Node ) ;
if __name__ == ' _ _ main _ _ ' :
    weight [ 1 ] = 5 ;
    weight [ 2 ] = 10 ;
    weight [ 3 ] = 11 ;
    weight [ 4 ] = 8 ;
    weight [ 5 ] = 6 ;
    graph [ 1 ] . append ( 2 ) ;
    graph [ 2 ] . append ( 3 ) ;
    graph [ 2 ] . append ( 4 ) ;
    graph [ 1 ] . append ( 5 ) ;
    dfs ( 1 , 1 ) ;
    print ( ans ) ;

Index/key variables: Node
Accumulator variables: factor, n, power
Iterator variables: to
Python program:
def findNthNumber ( N ) :
    arr = [ 0 for i in range ( N + 1 ) ]
    q = [ ]
    for i in range ( 1 , 10 , 1 ) :
        q . append ( i )
    for i in range ( 1 , N + 1 , 1 ) :
        arr [ i ] = q [ 0 ]
        q . remove ( q [ 0 ] )
        if ( arr [ i ] % 10 != 0 ) :
            q . append ( arr [ i ] * 10 + arr [ i ] % 10 - 1 )
        q . append ( arr [ i ] * 10 + arr [ i ] % 10 )
        if ( arr [ i ] % 10 != 9 ) :
            q . append ( arr [ i ] * 10 + arr [ i ] % 10 + 1 )
    print ( arr [ N ] )
if __name__ == ' _ _ main _ _ ' :
    N = 21
    findNthNumber ( N )

Index/key variables: N, i
Accumulator variables: q
Iterator variables: i
Python program:
def findUniqueElements ( arr , N , K ) :
    s = set ( )
    for x in arr :
        s . add ( x )
    arr_sum = sum ( arr )
    set_sum = 0
    for x in s :
        set_sum += x
    print ( ( K * set_sum - arr_sum ) // ( K - 1 ) )
if __name__ == ' _ _ main _ _ ' :
    arr = [ 12 , 1 , 12 , 3 , 12 , 1 , 1 , 2 , 3 , 2 , 2 , 3 , 7 ]
    N = len ( arr )
    K = 3
    findUniqueElements ( arr , N , K )

Accumulator variables: s, set_sum
Iterator variables: x
Python program:
from math import sqrt
def dydx ( x , y ) :
    return ( x - y ) / 2
def Gill ( x0 , y0 , x , h ) :
    n = ( ( x - x0 ) / h )
    y = y0
    for i in range ( 1 , int ( n + 1 ) , 1 ) :
        k1 = h * dydx ( x0 , y )
        k2 = h * dydx ( x0 + 0.5 * h , y + 0.5 * k1 )
        k3 = h * dydx ( x0 + 0.5 * h , y + 0.5 * ( - 1 + sqrt ( 2 ) ) * k1 + k2 * ( 1 - 0.5 * sqrt ( 2 ) ) )
        k4 = h * dydx ( x0 + h , y - ( 0.5 * sqrt ( 2 ) ) * k2 + k3 * ( 1 + 0.5 * sqrt ( 2 ) ) )
        y = y + ( 1 / 6 ) * ( k1 + ( 2 - sqrt ( 2 ) ) * k2 + ( 2 + sqrt ( 2 ) ) * k3 + k4 )
        x0 = x0 + h
    return y
if __name__ == ' _ _ main _ _ ' :
    x0 = 0
    y = 3.0
    x = 5.0
    h = 0.2
    print ( " y ( x ) ▁ = " , round ( Gill ( x0 , y , x , h ) , 6 ) )

Iterator variables: i
Python program:
def PrintReverseOrder ( N ) :
    for i in range ( N , 0 , - 1 ) :
        print ( i , end = " ▁ " ) ;
if __name__ == ' _ _ main _ _ ' :
    N = 5 ;
    PrintReverseOrder ( N ) ;

Iterator variables: i
Python program:
from math import sqrt
def ArithmeticMean ( A , B ) :
    return ( A + B ) / 2
def HarmonicMean ( A , B ) :
    return ( 2 * A * B ) / ( A + B )
def CheckArithmeticHarmonic ( arr , A , B , N ) :
    AM = ArithmeticMean ( A , B )
    HM = HarmonicMean ( A , B )
    Hash = set ( )
    for i in range ( N ) :
        Hash . add ( arr [ i ] )
    if ( A in Hash and B in Hash ) :
        if ( AM in Hash and HM in Hash ) :
            print ( " GM ▁ = " , round ( sqrt ( AM * HM ) , 2 ) )
        else :
            print ( " AM ▁ and ▁ HM ▁ not ▁ found " )
    else :
        print ( " Numbers ▁ not ▁ found " )
if __name__ == ' _ _ main _ _ ' :
    arr = [ 1.0 , 2.0 , 2.5 , 3.0 , 4.0 , 4.5 , 5.0 , 6.0 ]
    N = len ( arr )
    A = 3.0
    B = 6.0
    CheckArithmeticHarmonic ( arr , A , B , N )

Index/key variables: i
Accumulator variables: Hash
Iterator variables: i
Python program:
def PythagoreanTriplet ( n ) :
    flag = 0
    for a in range ( 1 , n , 1 ) :
        b = ( n * n - 2 * n * a ) // ( 2 * n - 2 * a )
        c = n - a - b
        if ( a * a + b * b == c * c and b > 0 and c > 0 ) :
            print ( a , b , c )
            flag = 1
            break
    if ( flag == 0 ) :
        print ( " - 1" )
    return
if __name__ == ' _ _ main _ _ ' :
    N = 12
    PythagoreanTriplet ( N )

Iterator variables: a
Python program:
from math import sqrt
def check ( X , K ) :
    prime = 0
    temp = X
    sqr = int ( sqrt ( X ) )
    for i in range ( 2 , sqr + 1 , 1 ) :
        while ( temp % i == 0 ) :
            temp = temp // i
            prime += 1
    if ( temp > 2 ) :
        prime += 1
    if ( X == 1 ) :
        return False
    if ( prime == 1 and K == 1 ) :
        return True
    elif ( prime >= K ) :
        return True
    else :
        return False
if __name__ == ' _ _ main _ _ ' :
    X = 4
    K = 2
    if ( check ( X , K ) ) :
        print ( " Yes " )
    else :
        print ( " No " )

Accumulator variables: prime
Iterator variables: i
Python program:
class Node :
    def __init__ ( self , key ) :
        self . key = key
        self . left = None
        self . right = None
def newNode ( key ) :
    temp = Node ( key )
    return temp
N = 1000000
prime = [ ]
def SieveOfEratosthenes ( ) :
    check = [ True for i in range ( N + 1 ) ]
    p = 2
    while ( p * p <= N ) :
        if ( check [ p ] ) :
            prime . append ( p )
            for i in range ( p * p , N + 1 , p ) :
                check [ i ] = False
        p += 1
def isPathCo_Prime ( path ) :
    max = 0
    for x in path :
        if ( max < x ) :
            max = x
    i = 0
    while ( i * prime [ i ] <= max // 2 ) :
        ct = 0
        for x in path :
            if ( x % prime [ i ] == 0 ) :
                ct += 1
        if ( ct > 1 ) :
            return False
        i += 1
    return True
def printCo_PrimePaths ( path ) :
    for x in path :
        print ( x , end = ' ▁ ' )
    print ( )
def findCo_PrimePaths ( root , path ) :
    if ( root == None ) :
        return path
    path . append ( root . key )
    path = findCo_PrimePaths ( root . left , path )
    path = findCo_PrimePaths ( root . right , path )
    if ( root . left == None and root . right == None ) :
        if ( isPathCo_Prime ( path ) ) :
            printCo_PrimePaths ( path )
    path . pop ( )
    return path
def printCo_PrimePath ( node ) :
    SieveOfEratosthenes ( )
    path = [ ]
    path = findCo_PrimePaths ( node , path )
if __name__ == " _ _ main _ _ " :
    root = newNode ( 10 )
    root . left = newNode ( 48 )
    root . right = newNode ( 3 )
    root . right . left = newNode ( 11 )
    root . right . right = newNode ( 37 )
    root . right . left . left = newNode ( 7 )
    root . right . left . right = newNode ( 29 )
    root . right . right . left = newNode ( 42 )
    root . right . right . right = newNode ( 19 )
    root . right . right . right . left = newNode ( 7 )
    printCo_PrimePath ( root )

Index/key variables: i, p
Accumulator variables: ct, prime
Iterator variables: i, x
Class/struct names: Node