dhyuti-n/xlcost-variable-roles huggingface dataset:
Python program:
import math
def isPower ( a ) :
    if ( a == 1 ) :
        return True
    i = 2
    while ( i * i <= a ) :
        val = math . log ( a ) / math . log ( i )
        if ( ( val - int ( val ) ) < 0.00000001 ) :
            return True
        i += 1
    return False
def isCunningham ( n ) :
    return isPower ( n - 1 ) or isPower ( n + 1 )
n = 126
if ( isCunningham ( n ) ) :
    print ( " Yes " )
else :
    print ( " No " )

Accumulator variables: i
Python program:
def SubArrayProdct ( arr , n ) :
    result = 1 ;
    for i in range ( 0 , n ) :
        result *= pow ( arr [ i ] , ( i + 1 ) * ( n - i ) ) ;
    return result ;
arr = [ 2 , 4 ] ;
N = len ( arr ) ;
print ( SubArrayProdct ( arr , N ) )

Index/key variables: i
Accumulator variables: result
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 countWays ( m , n , x , y ) :
    return ( nCr ( m + n , m ) - nCr ( x + y , x ) * nCr ( m + n - x - y , m - x ) )
m = 5
n = 4
x = 3
y = 2
print ( countWays ( m , n , x , y ) )

Iterator variables: i
Python program:
def CountGreater ( n , k ) :
    a = 0
    while ( n > 0 ) :
        if ( ( n % 10 ) > k ) :
            a += 1
        n = n // 10
    return a
def PrintList ( ans ) :
    for i in ans :
        print ( i , end = ' ' )
def getNumber ( n , k ) :
    count = CountGreater ( n , k )
    if ( count == 0 ) :
        print ( n )
        return
    ans = [ ]
    changed = False
    while ( n > 0 ) :
        digit = n % 10
        if ( changed == True ) :
            ans . insert ( 0 , digit )
        else :
            if ( count == 0 and digit < k ) :
                ans . insert ( 0 , digit + 1 )
                changed = True
            else :
                ans . insert ( 0 , 1 )
                if ( digit > k ) :
                    count -= 1
        n = n // 10
    if ( changed == False ) :
        ans . insert ( 0 , 1 )
    PrintList ( ans )
    return
N = 51234
K = 4
getNumber ( N , K )

Accumulator variables: a, count
Iterator variables: i
Boolean variables: changed
Python program:
def solve ( N ) :
    ans = 0
    while ( N != 0 ) :
        ans += N
        N //= 2
    print ( ans )
N = 5
solve ( N )

Accumulator variables: N, ans
Python program:
def oddSum ( A , N , K ) :
    Odd = set ( [ ] )
    Even = set ( [ ] )
    for i in range ( N ) :
        if ( A [ i ] % 2 == 0 ) :
            Even . add ( A [ i ] )
        else :
            Odd . add ( A [ i ] )
    if ( len ( Odd ) >= K ) :
        return True
    flag = False
    for i in range ( 1 , K , 2 ) :
        needed = K - i
        if ( needed <= len ( Even ) ) :
            return True
    return flag
if __name__ == " _ _ main _ _ " :
    K = 5
    A = [ 12 , 1 , 7 , 7 , 26 , 18 ]
    N = 3
    if ( oddSum ( A , N , K ) ) :
        print ( " YES " )
    else :
        print ( " NO " )

Index/key variables: i
Accumulator variables: Even, Odd
Iterator variables: i
Boolean variables: flag
Python program:
def countEle ( a , n ) :
    len = 0
    hmap = { }
    for i in range ( n ) :
        len = max ( len , a [ i ] )
        hmap [ a [ i ] ] = hmap . get ( a [ i ] , 0 ) + 1
    v = [ True for i in range ( len + 1 ) ]
    for i in range ( n ) :
        if ( v [ a [ i ] ] == False ) :
            continue
        for j in range ( 2 * a [ i ] , len + 1 , a [ i ] ) :
            v [ j ] = False
    count = 0
    for i in range ( 1 , len + 1 ) :
        if ( v [ i ] == True and ( i in hmap ) and hmap [ i ] == 1 ) :
            count += 1
    return count
if __name__ == ' _ _ main _ _ ' :
    arr = [ 86 , 45 , 18 , 4 , 8 , 28 , 19 , 33 , 2 ]
    n = len ( arr )
    print ( countEle ( arr , n ) )

Index/key variables: i, j
Accumulator variables: count
Iterator variables: i, j
Python program:
def smallestNumber ( N ) :
    L = pow ( 10 , N ) - 1 ;
    S = pow ( 10 , N - 1 ) ;
    for i in range ( S , L ) :
        if ( i % N == 0 ) :
            print ( i ) ;
            return ;
if __name__ == " _ _ main _ _ " :
    N = 2 ;
    smallestNumber ( N )

Iterator variables: i
Python program:
def maxPrimefactorNum ( N ) :
    arr = [ ]
    for i in range ( N + 1 ) :
        arr . append ( 1 )
    for i in range ( 2 , N + 1 ) :
        if ( arr [ i ] == 1 ) :
            for j in range ( i , N + 1 , i ) :
                arr [ j ] *= i
    maxValue = 1
    for i in range ( 2 , N + 1 ) :
        if ( arr [ i ] > maxValue ) :
            maxValue = i
    return maxValue
N = 20 ;
print ( maxPrimefactorNum ( N ) )

Index/key variables: i, j
Accumulator variables: arr
Iterator variables: i, j
Python program:
def isStraighLineNum ( N ) :
    if ( N <= 99 ) :
        return False ;
    str1 = str ( N ) ;
    d = int ( str1 [ 1 ] ) - int ( str1 [ 0 ] ) ;
    for i in range ( 2 , len ( str1 ) ) :
        if ( int ( str1 [ i ] ) - int ( str1 [ i - 1 ] ) != d ) :
            return False ;
    return True ;
N = 135 ;
if ( isStraighLineNum ( N ) ) :
    print ( " Yes " ) ;
else :
    print ( " No " ) ;

Index/key variables: i
Iterator variables: i
Python program:
def isEvenOddForm ( s ) :
    n = len ( s )
    for i in range ( n ) :
        if ( i % 2 == 0 and int ( s [ i ] ) % 2 != 0 ) :
            return False
        if ( i % 2 == 1 and int ( s [ i ] ) % 2 != 1 ) :
            return False
    return True
def isOddEvenForm ( s ) :
    n = len ( s )
    for i in range ( n ) :
        if ( i % 2 == 0 and int ( s [ i ] ) % 2 != 1 ) :
            return False
        if ( i % 2 == 1 and int ( s [ i ] ) % 2 != 0 ) :
            return False
    return True
def isAlternating ( n ) :
    s = str ( n )
    return ( isEvenOddForm ( s ) or isOddEvenForm ( s ) )
N = 129
if ( isAlternating ( N ) ) :
    print ( " Yes " )
else :
    print ( " No " )

Index/key variables: i
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 = i + 6
    return True
TEN = 10
def updateFreq ( n , freq ) :
    while ( n ) :
        digit = n % TEN
        freq [ digit ] += 1
        n = n // TEN
def areAnagrams ( a , b ) :
    freqA = [ 0 ] * TEN
    freqB = [ 0 ] * TEN
    updateFreq ( a , freqA )
    updateFreq ( b , freqB )
    for i in range ( TEN ) :
        if ( freqA [ i ] != freqB [ i ] ) :
            return False
    return True
def OrmistonPrime ( n1 , n2 ) :
    return ( isPrime ( n1 ) and isPrime ( n2 ) and areAnagrams ( n1 , n2 ) )
n1 , n2 = 1913 , 1931
if ( OrmistonPrime ( n1 , n2 ) ) :
    print ( " YES " )
else :
    print ( " NO " )

Index/key variables: digit, i
Iterator variables: i
Python program:
def iszygodromeNum ( N ) :
    s = str ( N ) ;
    s = ' ▁ ' + s + ' ▁ ' ;
    i = 1
    while i < len ( s ) - 1 :
        if ( ( s [ i ] != s [ i - 1 ] ) and ( s [ i ] != s [ i + 1 ] ) ) :
            return False ;
        i += 1
    return True ;
if __name__ == ' _ _ main _ _ ' :
    n = 1122 ;
    if iszygodromeNum ( n ) :
        print ( " Yes " )
    else :
        print ( " No " )

Index/key variables: i
Python program:
import math
def isLoeschian ( n ) :
    for x in range ( 1 , ( int ) ( math . sqrt ( n ) ) + 1 ) :
        for y in range ( 1 , ( int ) ( math . sqrt ( n ) ) + 1 ) :
            if ( x * x + x * y + y * y == n ) :
                return True
    return False
N = 19
if ( isLoeschian ( N ) ) :
    print ( " Yes " )
else :
    print ( " No " )

Iterator variables: x, y
Python program:
def printSeries ( N ) :
    ith_term = 0 ;
    for i in range ( 1 , N + 1 ) :
        ith_term = ( 13 * i * ( i - 1 ) ) / 2 + 2 ;
        print ( int ( ith_term ) , " , ▁ " , end = " " ) ;
if __name__ == ' _ _ main _ _ ' :
    N = 7 ;
    printSeries ( N ) ;

Iterator variables: i
Python program:
def Pairs ( C ) :
    ans = [ ]
    for i in range ( C ) :
        for j in range ( i + 1 , C ) :
            if ( ( i * i ) + ( j * j ) == ( C * C ) ) :
                ans . append ( [ i , j ] )
    return ans ;
if __name__ == " _ _ main _ _ " :
    C = 13 ;
    ans = Pairs ( C ) ;
    if ( len ( ans ) == 0 ) :
        print ( " No ▁ valid ▁ pair ▁ exist " )
        exit ( )
    for i in range ( len ( ans ) ) :
        print ( " ( " + str ( ans [ i ] [ 0 ] ) + " , ▁ " + str ( ans [ i ] [ 1 ] ) + " ) " )

Index/key variables: i
Accumulator variables: ans
Iterator variables: i, j
Python program:
import math
def factorize ( N ) :
    count = 0
    cnt = 0
    while ( ( N % 2 ) == 0 ) :
        N = N // 2
        count += 1
    cnt = cnt + count
    sq = int ( math . sqrt ( N ) )
    for i in range ( 3 , sq , 2 ) :
        count = 0
        while ( N % i == 0 ) :
            count += 1
            N = N // i
        cnt = cnt + count
    if ( N > 2 ) :
        cnt = cnt + 1
    return cnt
def ifNumberExists ( X , Y ) :
    C = X - Y - 1
    dsum = factorize ( X )
    if ( dsum >= C ) :
        print ( " YES " )
    else :
        print ( " NO " )
if __name__ == " _ _ main _ _ " :
    X = 6
    Y = 4
    ifNumberExists ( X , Y )

Accumulator variables: count
Iterator variables: i
Python program:
maxi = 10000000
prime = [ False ] * ( maxi )
def SieveOfEratosthenes ( maxm ) :
    prime [ 0 ] = prime [ 1 ] = True
    for i in range ( 2 , maxm + 1 ) :
        if i * i > maxm :
            break
        if ( not prime [ i ] ) :
            for j in range ( i * i , maxm + 1 , i ) :
                prime [ j ] = True
def print_nearest_prime ( arr , N ) :
    maxm = max ( arr )
    SieveOfEratosthenes ( maxm )
    primes = [ ]
    for i in range ( N ) :
        if ( not prime [ arr [ i ] ] ) :
            primes . append ( i )
    if len ( primes ) == 0 :
        for i in range ( N ) :
            print ( - 1 , end = " ▁ " )
        return
    curr = 0
    for i in range ( N ) :
        if ( curr == len ( primes ) - 1 or i <= primes [ curr ] ) :
            print ( arr [ primes [ curr ] ] , end = " ▁ " )
            continue
        if ( abs ( primes [ curr ] - i ) < abs ( primes [ curr + 1 ] - i ) ) :
            print ( arr [ primes [ curr ] ] , end = " ▁ " )
        else :
            curr += 1
            print ( arr [ primes [ curr ] ] , end = " ▁ " )
if __name__ == ' _ _ main _ _ ' :
    N = 6
    arr = [ 8 , 7 , 12 , 15 , 3 , 11 ]
    print_nearest_prime ( arr , N )

Index/key variables: curr, i, j
Accumulator variables: primes
Iterator variables: i, j
Python program:
def findPosition ( n ) :
    i = 0
    pos = 0
    while ( n > 0 ) :
        if ( n % 10 == 7 ) :
            pos = pos + pow ( 2 , i + 1 )
        else :
            pos = pos + pow ( 2 , i )
        i += 1
        n = n // 10
    print ( pos )
if __name__ == ' _ _ main _ _ ' :
    N = 777
    findPosition ( N )

Accumulator variables: i
Python program:
import math
def findNumberL ( n ) :
    if ( n == 1 ) :
        return "1"
    result = " "
    length = math . floor ( math . log10 ( n ) + 1 )
    for i in range ( 1 , n - ( 2 * length ) + 1 ) :
        result += '9'
    result = ( str ( n ) + result + str ( n ) )
    return result
def findNumberS ( n ) :
    if ( n == 1 ) :
        return "1"
    result = " "
    length = math . floor ( math . log10 ( n ) + 1 )
    for i in range ( 1 , n - ( 2 * length ) + 1 ) :
        result += '0'
    result = ( str ( n ) + result + str ( n ) )
    return result
if __name__ == " _ _ main _ _ " :
    N = 3
    print ( " Smallest ▁ Number ▁ = ▁ " + findNumberS ( N ) )
    print ( " Largest ▁ Number ▁ = ▁ " + findNumberL ( N ) )

Accumulator variables: result
Iterator variables: i
Python program:
def canReplace ( arr , n ) :
    i = 0
    count = 0
    while ( i < n ) :
        if ( arr [ i ] == 0 and ( i == 0 or arr [ i - 1 ] == 0 ) and ( i == n - 1 or arr [ i + 1 ] == 0 ) ) :
            arr [ i ] = 1
            count += 1
        i += 1
    return count
if __name__ == ' _ _ main _ _ ' :
    arr = [ 1 , 0 , 0 , 0 , 1 ]
    print ( canReplace ( arr , 5 ) )

Index/key variables: i
Accumulator variables: count
Python program:
def solve ( n , vec ) :
    a = [ ]
    b = [ ]
    for pr in vec :
        a . append ( pr [ 0 ] )
        b . append ( pr [ 1 ] )
    a . sort ( )
    b . sort ( )
    if ( ( n & 1 ) ) :
        left = a [ n // 2 ]
        right = b [ n // 2 ]
        ans = right - left + 1
    else :
        left = ( a [ n // 2 ] + a [ n // 2 - 1 ] )
        right = ( b [ n // 2 ] + b [ n // 2 - 1 ] )
        ans = right - left + 1
    print ( ans )
if __name__ == " _ _ main _ _ " :
    N = 3
    vec = [ ( 100 , 100 ) , ( 10 , 10000 ) , ( 1 , 1000000000 ) ]
    solve ( N , vec )

Accumulator variables: a, b
Iterator variables: pr
Python program:
from collections import defaultdict
mp = defaultdict ( int )
def find_pairs ( arr , n ) :
    ans = 0
    for i in range ( n ) :
        mp [ arr [ i ] ] += 1
    for i in mp . values ( ) :
        count = i
        if ( count > 1 ) :
            ans += ( ( count * ( count - 1 ) ) // 2 )
    return ans
if __name__ == " _ _ main _ _ " :
    arr = [ 1 , 2 , 3 , 3 , 4 , 5 , 5 , 7 , 8 ]
    arr_size = len ( arr )
    print ( find_pairs ( arr , arr_size ) )

Index/key variables: i
Accumulator variables: ans
Iterator variables: i
Python program:
def getParity ( n , A ) :
    for x in A :
        if ( x & 1 ) :
            print ( " Even " )
            return
    print ( " Odd " )
if __name__ == ' _ _ main _ _ ' :
    N = 3
    A = [ 2 , 3 , 1 ]
    getParity ( N , A )

Iterator variables: x
Python program:
def isPossible ( arr , N , K ) :
    oddCount = 0
    evenCount = 0
    for i in range ( N ) :
        if ( arr [ i ] % 2 == 0 ) :
            evenCount += 1
        else :
            oddCount += 1
    if ( evenCount == N or ( oddCount == N and K % 2 == 0 ) or ( K == N and oddCount % 2 == 0 ) ) :
        return False
    else :
        return True
if __name__ == ' _ _ main _ _ ' :
    arr = [ 1 , 2 , 3 , 4 , 5 , 8 ]
    K = 5
    N = len ( arr )
    if ( isPossible ( arr , N , K ) ) :
        print ( " Possible " )
    else :
        print ( " Not ▁ Possible " )

Index/key variables: i
Accumulator variables: evenCount, oddCount
Iterator variables: i
Python program:
def lastTwoDigits ( N ) :
    if ( N >= 10 ) :
        print ( "00" , end = " " )
        return
    fac = 1
    for i in range ( 1 , N + 1 ) :
        fac = ( fac * i ) % 100
    print ( fac )
if __name__ == ' _ _ main _ _ ' :
    N = 7
    lastTwoDigits ( N )

Iterator variables: i
Python program:
from math import sqrt
def solve ( n ) :
    for x in range ( 1 , int ( sqrt ( n ) ) + 1 ) :
        if ( n % x == 0 ) :
            small = x ;
            big = n // x ;
            if ( small % 2 == big % 2 ) :
                a = ( small + big ) // 2 ;
                b = ( big - small ) // 2 ;
                print ( a , b ) ;
                return ;
    print ( - 1 ) ;
if __name__ == " _ _ main _ _ " :
    n = 7 ;
    solve ( n ) ;

Iterator variables: x
Python program:
def commonSubarrays ( A , B , N ) :
    Map = [ 0 for i in range ( N + 1 ) ]
    for i in range ( N ) :
        Map [ A [ i ] ] = i
    for i in range ( N ) :
        B [ i ] = Map [ B [ i ] ]
    count = 0
    i = 0
    while i < N :
        K = 1
        i += 1
        while i < N and B [ i ] == B [ i - 1 ] + 1 :
            i += 1
            K += 1
        count = count + ( ( K ) * ( K + 1 ) ) // 2
    return count
N = 3
A = [ 1 , 2 , 3 ]
B = [ 2 , 3 , 1 ]
print ( commonSubarrays ( A , B , N ) )
N = 5
A = [ 1 , 2 , 3 , 4 , 5 ]
B = [ 2 , 3 , 1 , 4 , 5 ]
print ( commonSubarrays ( A , B , N ) )

Index/key variables: i
Accumulator variables: K
Iterator variables: i
Python program:
def getArrayOfSizeK ( n , k ) :
    ans = [ ]
    odd = n - ( ( k - 1 ) * 1 )
    if ( odd > 0 and odd % 2 != 0 ) :
        for i in range ( k - 1 ) :
            ans . append ( 1 )
        ans . append ( odd )
    even = n - ( ( k - 1 ) * 2 )
    if ( even > 0 and even % 2 == 0 and len ( ans ) == 0 ) :
        for i in range ( k - 1 ) :
            ans . append ( 2 )
        ans . append ( even )
    if ( len ( ans ) > 0 ) :
        for i in range ( k ) :
            print ( ans [ i ] , end = " ▁ " )
    else :
        print ( " NO " )
if __name__ == " _ _ main _ _ " :
    n , k = 10 , 3
    getArrayOfSizeK ( n , k )

Index/key variables: i
Accumulator variables: ans
Iterator variables: i
Python program:
def inv ( a , m ) :
    m0 = m
    x0 = 0
    x1 = 1
    if ( m == 1 ) :
        return 0
    while ( a > 1 ) :
        q = a // m
        t = m
        m = a % m
        a = t
        t = x0
        x0 = x1 - q * x0
        x1 = t
    if ( x1 < 0 ) :
        x1 += m0
    return x1
def derivative ( x ) :
    return 3 * x * x
def Image ( x , k ) :
    return x * x * x - k
def next_power ( a_t , t , a1 , prime , k ) :
    power_p = int ( pow ( prime , t + 1 ) )
    next_a = ( a_t - Image ( a_t , k ) * inv ( derivative ( a1 ) , prime ) ) % power_p
    if ( next_a < 0 ) :
        next_a += power_p
        return next_a
    return next_a
def powerOfPrime ( prime , power , k , a1 ) :
    if ( derivative ( a1 ) != 0 ) :
        a_t = a1
        for p in range ( 1 , power ) :
            a_t = next_power ( a_t , p , a1 , prime , k )
        return a_t
    return - 1
prime = 7
a1 = 3
power = 2
k = 3
print ( powerOfPrime ( prime , power , k , a1 ) )

Iterator variables: p
Python program:
import math
def count_same_digit ( L , R ) :
    tmp = 0 ; ans = 0 ;
    n = int ( math . log10 ( R ) + 1 ) ;
    for i in range ( 0 , n ) :
        tmp = tmp * 10 + 1 ;
        for j in range ( 1 , 9 ) :
            if ( L <= ( tmp * j ) and ( tmp * j ) <= R ) :
                ans += 1 ;
    return ans ;
L = 12 ; R = 68 ;
print ( count_same_digit ( L , R ) )

Accumulator variables: ans
Iterator variables: i, j
Python program:
import sys
def minLCM ( arr , n ) :
    mx = 0
    for i in range ( n ) :
        mx = max ( mx , arr [ i ] )
    mul = [ [ ] for i in range ( mx + 1 ) ]
    for i in range ( n ) :
        if ( len ( mul [ arr [ i ] ] ) > 1 ) :
            continue
        mul [ arr [ i ] ] . append ( arr [ i ] )
    for i in range ( 1 , mx + 1 ) :
        for j in range ( i + i , mx + 1 , i ) :
            if ( len ( mul [ i ] ) > 1 ) :
                break
            for k in mul [ j ] :
                if ( len ( mul [ i ] ) > 1 ) :
                    break
                mul [ i ] . append ( k )
    ans = sys . maxsize
    for i in range ( 1 , mx + 1 ) :
        if ( len ( mul [ i ] ) <= 1 ) :
            continue
        a , b = mul [ i ] [ 0 ] , mul [ i ] [ 1 ]
        lcm = ( a * b ) // i
        ans = min ( ans , lcm )
    return ans
arr = [ 2 , 4 , 3 , 6 , 5 ]
n = len ( arr )
print ( minLCM ( arr , n ) )

Index/key variables: i, j
Iterator variables: i, j, k
Python program:
def findSmallestArray ( A , n ) :
    count = n - 1
    mp = { ' ' }
    for i in range ( 0 , n ) :
        if ( count <= 0 ) :
            break ;
        mn = A [ i ]
        pos = i
        for j in range ( i + 1 , n ) :
            if ( A [ j ] < mn ) :
                mn = A [ j ]
                pos = j
        while ( pos > i and count > 0 and ( ( pos - 1 , pos ) not in mp ) ) :
            mp . add ( ( pos - 1 , pos ) )
            A [ pos ] , A [ pos - 1 ] = A [ pos - 1 ] , A [ pos ]
            pos -= 1
            count -= 1
    for i in range ( 0 , n ) :
        print ( A [ i ] , end = " ▁ " )
A = [ 2 , 1 , 4 , 3 , 6 , 5 ]
n = len ( A )
findSmallestArray ( A , n )

Index/key variables: i, j, pos
Accumulator variables: count, mp
Iterator variables: i, j
Python program:
def isSuffix ( s1 , s2 ) :
    n1 = len ( s1 ) ;
    n2 = len ( s2 ) ;
    if ( n1 > n2 ) :
        return False ;
    for i in range ( n1 ) :
        if ( s1 [ n1 - i - 1 ] != s2 [ n2 - i - 1 ] ) :
            return False ;
    return True ;
def CheckBinaryEquivalent ( N ) :
    B_Number = 0 ;
    cnt = 0 ;
    while ( N != 0 ) :
        rem = N % 2 ;
        c = 10 ** cnt ;
        B_Number += rem * c ;
        N //= 2 ;
        cnt += 1 ;
    bin = str ( B_Number ) ;
    return isSuffix ( "001" , bin ) ;
if __name__ == " _ _ main _ _ " :
    N = 9 ;
    if ( CheckBinaryEquivalent ( N ) ) :
        print ( " Yes " ) ;
    else :
        print ( " No " ) ;

Accumulator variables: B_Number, N, cnt
Iterator variables: i
Python program:
import math
def get_divisors ( A ) :
    ans = [ ]
    ans . append ( 1 )
    for i in range ( 2 , math . floor ( math . sqrt ( A ) ) + 1 ) :
        if ( A % i == 0 ) :
            ans . append ( i )
            if ( ( i * i ) != A ) :
                ans . append ( A // i )
    return ans
def summ_Possible ( sett , summ ) :
    n = len ( sett )
    subsett = [ [ 0 for i in range ( summ + 1 ) ] for j in range ( n + 1 ) ]
    for i in range ( n + 1 ) :
        subsett [ i ] [ 0 ] = True
    for i in range ( 1 , summ + 1 ) :
        subsett [ 0 ] [ i ] = False
    for i in range ( n + 1 ) :
        for j in range ( summ + 1 ) :
            if ( j < sett [ i - 1 ] ) :
                subsett [ i ] [ j ] = subsett [ i - 1 ] [ j ]
            if ( j >= sett [ i - 1 ] ) :
                subsett [ i ] [ j ] = ( subsett [ i - 1 ] [ j ] or subsett [ i - 1 ] [ j - sett [ i - 1 ] ] )
    return subsett [ n ] [ summ ]
def Is_Practical ( A ) :
    divisors = [ ]
    divisors = get_divisors ( A )
    for i in range ( 2 , A ) :
        if ( summ_Possible ( divisors , i ) == False ) :
            return False
    return True
def print_practica_No ( A , B ) :
    for i in range ( A , B + 1 ) :
        if ( Is_Practical ( i ) == True ) :
            print ( i , end = " ▁ " )
A = 1
B = 100
print_practica_No ( A , B )

Index/key variables: i, j, n, summ
Accumulator variables: ans
Iterator variables: i, j
Python program:
def maxDivision ( arr , n ) :
    arr . sort ( reverse = True )
    mxdiv = arr [ 1 ]
    for i in range ( 2 , n ) :
        mxdiv = mxdiv / arr [ i ]
    return arr [ 0 ] / mxdiv
arr = [ 100 , 1000 , 10 , 2 ]
n = len ( arr )
print ( maxDivision ( arr , n ) )

Index/key variables: i
Iterator variables: i
Python program:
def coPrimeSet ( n ) :
    firstadj = 0 ;
    secadj = 0 ;
    if ( n < 4 ) :
        print ( " ( ▁ " ) ;
        for i in range ( 1 , n + 1 ) :
            print ( i + " , ▁ " ) ;
        print ( " ) " ) ;
    else :
        if ( n % 2 == 0 ) :
            for i in range ( 0 , n / 2 ) :
                firstadj = 2 * i + 1 ;
                secadj = 2 * i + 2 ;
                print ( " ( " , firstadj , " , ▁ " , secadj , " ) " ) ;
        else :
            for i in range ( 0 , int ( n / 2 ) - 1 ) :
                firstadj = 2 * i + 1 ;
                secadj = 2 * i + 2 ;
                print ( " ( " , firstadj , " , ▁ " , secadj , " ) " ) ;
            print ( " ( " , ( n - 2 ) , " , ▁ " , ( n - 1 ) , " , ▁ " , n , " ) " ) ;
if __name__ == ' _ _ main _ _ ' :
    n = 5 ;
    coPrimeSet ( n ) ;

Iterator variables: i
Python program:
def operation ( arr , N ) :
    right = 0 ; ans = 0 ;
    num = 0 ;
    for left in range ( 0 , N ) :
        while ( right < N and num + arr [ right ] == ( num ^ arr [ right ] ) ) :
            num += arr [ right ] ;
            right += 1 ;
        ans += right - left ;
        if ( left == right ) :
            right += 1 ;
        else :
            num -= arr [ left ] ;
    return ans ;
arr = [ 1 , 2 , 3 , 4 , 5 ] ;
N = len ( arr )
print ( operation ( arr , N ) ) ;

Index/key variables: left, right
Accumulator variables: ans, num
Iterator variables: left