dhyuti-n/xlcost-variable-roles huggingface dataset:
Python program:
limit = 1000000000
MAX_PRIME = 2000000
MAX = 1000000
I_MAX = 50000
mp = { }
b = [ 0 ] * MAX
p = [ 0 ] * MAX
j = 0
prime = [ True ] * ( MAX_PRIME + 1 )
def SieveOfEratosthenes ( n ) :
    global j
    p = 2
    while p * p <= n :
        if ( prime [ p ] == True ) :
            for i in range ( p * p , n + 1 , p ) :
                prime [ i ] = False
        p += 1
    for p in range ( 2 , n + 1 ) :
        if ( prime [ p ] ) :
            b [ j ] = p
            j += 1
def gcd ( a , b ) :
    if ( b == 0 ) :
        return a
    return gcd ( b , a % b )
def printSeries ( n ) :
    SieveOfEratosthenes ( MAX_PRIME )
    ar = [ 0 ] * ( I_MAX + 2 )
    for i in range ( j ) :
        if ( ( b [ i ] * b [ i + 1 ] ) > limit ) :
            break
        p [ i ] = b [ i ]
        mp [ b [ i ] * b [ i + 1 ] ] = 1
    d = 550
    flag = False
    k = 2
    while ( k < d - 1 ) and not flag :
        m = 2
        while ( m < d ) and not flag :
            for l in range ( m + k , d , k ) :
                if ( ( ( b [ l ] * b [ l + k ] ) < limit ) and ( l + k ) < d and p [ i - 1 ] != b [ l + k ] and p [ i - 1 ] != b [ l ] and ( ( b [ l ] * b [ l + k ] in mp ) and mp [ b [ l ] * b [ l + k ] ] != 1 ) ) :
                    if ( mp [ p [ i - 1 ] * b [ l ] ] != 1 ) :
                        p [ i ] = b [ l ]
                        mp [ p [ i - 1 ] * b [ l ] ] = 1
                        i += 1
                if ( i >= I_MAX ) :
                    flag = True
                    break
            m += 1
        k += 1
    for i in range ( n ) :
        ar [ i ] = p [ i ] * p [ i + 1 ]
    for i in range ( n - 1 ) :
        print ( ar [ i ] , end = " ▁ " )
    g = gcd ( ar [ n - 1 ] , ar [ n - 2 ] )
    print ( g * 2 )
if __name__ == " _ _ main _ _ " :
    n = 4
    printSeries ( n )

Index/key variables: i, j, l, p
Accumulator variables: k, m
Iterator variables: i, l, p
Boolean variables: flag
Python program:
MAX = 620000
prime = [ 0 ] * MAX
def Sieve ( ) :
    for i in range ( 2 , MAX ) :
        if ( prime [ i ] == 0 ) :
            for j in range ( 2 * i , MAX , i ) :
                prime [ j ] = 1
def printSequence ( n ) :
    Sieve ( )
    v = [ ]
    u = [ ]
    for i in range ( 13 , MAX ) :
        if ( prime [ i ] == 0 ) :
            v . append ( i )
    if ( n == 3 ) :
        print ( 6 , 10 , 15 )
        return
    k = 0
    for k in range ( n - 2 ) :
        if ( k % 3 == 0 ) :
            u . append ( v [ k ] * 6 )
        elif ( k % 3 == 1 ) :
            u . append ( v [ k ] * 15 )
        else :
            u . append ( v [ k ] * 10 )
    u . append ( v [ k ] * 7 )
    u . append ( 7 * 11 )
    u [ 0 ] = u [ 0 ] * 11
    print ( * u )
if __name__ == ' _ _ main _ _ ' :
    n = 4
    printSequence ( n )

Index/key variables: i, j, k
Accumulator variables: u, v
Iterator variables: i, j, k
Python program:
def midptellipse ( rx , ry , xc , yc ) :
    x = 0 ;
    y = ry ;
    d1 = ( ( ry * ry ) - ( rx * rx * ry ) + ( 0.25 * rx * rx ) ) ;
    dx = 2 * ry * ry * x ;
    dy = 2 * rx * rx * y ;
    while ( dx < dy ) :
        print ( " ( " , x + xc , " , " , y + yc , " ) " ) ;
        print ( " ( " , - x + xc , " , " , y + yc , " ) " ) ;
        print ( " ( " , x + xc , " , " , - y + yc , " ) " ) ;
        print ( " ( " , - x + xc , " , " , - y + yc , " ) " ) ;
        if ( d1 < 0 ) :
            x += 1 ;
            dx = dx + ( 2 * ry * ry ) ;
            d1 = d1 + dx + ( ry * ry ) ;
        else :
            x += 1 ;
            y -= 1 ;
            dx = dx + ( 2 * ry * ry ) ;
            dy = dy - ( 2 * rx * rx ) ;
            d1 = d1 + dx - dy + ( ry * ry ) ;
    d2 = ( ( ( ry * ry ) * ( ( x + 0.5 ) * ( x + 0.5 ) ) ) + ( ( rx * rx ) * ( ( y - 1 ) * ( y - 1 ) ) ) - ( rx * rx * ry * ry ) ) ;
    while ( y >= 0 ) :
        print ( " ( " , x + xc , " , " , y + yc , " ) " ) ;
        print ( " ( " , - x + xc , " , " , y + yc , " ) " ) ;
        print ( " ( " , x + xc , " , " , - y + yc , " ) " ) ;
        print ( " ( " , - x + xc , " , " , - y + yc , " ) " ) ;
        if ( d2 > 0 ) :
            y -= 1 ;
            dy = dy - ( 2 * rx * rx ) ;
            d2 = d2 + ( rx * rx ) - dy ;
        else :
            y -= 1 ;
            x += 1 ;
            dx = dx + ( 2 * ry * ry ) ;
            dy = dy - ( 2 * rx * rx ) ;
            d2 = d2 + dx - dy + ( rx * rx ) ;
midptellipse ( 10 , 15 , 50 , 50 ) ;

Accumulator variables: x, y
Python program:
def isDivisible ( n ) :
    temp = n
    sum = 0 ;
    while ( n ) :
        k = n % 10 ;
        sum += k ;
        n /= 10 ;
    if ( temp % sum == 0 ) :
        return " YES " ;
    return " NO " ;
n = 123 ;
print ( isDivisible ( n ) ) ;

Accumulator variables: n, sum
Python program:
def getResult ( n ) :
    st = str ( n )
    sum = 0
    length = len ( st )
    for i in st :
        sum = sum + int ( i )
    if ( n % sum == 0 ) :
        return " Yes "
    else :
        return " No "
n = 123
print ( getResult ( n ) )

Iterator variables: i
Python program:
from math import sqrt
def digitProduct ( n ) :
    prod = 1
    while ( n ) :
        prod = prod * ( n % 10 )
        n = int ( n / 10 )
    return prod
def printMultiplicativePrimes ( n ) :
    prime = [ True for i in range ( n + 1 ) ]
    prime [ 0 ] = prime [ 1 ] = False
    for p in range ( 2 , int ( sqrt ( n ) ) + 1 , 1 ) :
        if ( prime [ p ] ) :
            for i in range ( p * 2 , n + 1 , p ) :
                prime [ i ] = False
    for i in range ( 2 , n + 1 , 1 ) :
        if ( prime [ i ] and prime [ digitProduct ( i ) ] ) :
            print ( i , end = " ▁ " )
if __name__ == ' _ _ main _ _ ' :
    n = 10
    printMultiplicativePrimes ( n )

Index/key variables: i, p
Iterator variables: i, p
Python program:
import math as mt
def gcd ( a , b ) :
    if ( b == 0 ) :
        return a
    else :
        return gcd ( b , a % b )
def coPrime ( n1 , n2 ) :
    if ( gcd ( n1 , n2 ) == 1 ) :
        return True
    else :
        return False
def largestCoprime ( N ) :
    half = mt . floor ( N / 2 )
    while ( coPrime ( N , half ) == False ) :
        half -= 1
    return half
n = 50
print ( largestCoprime ( n ) )

Accumulator variables: half
Python program:
from math import sqrt
def printSafePrimes ( n ) :
    prime = [ 0 for i in range ( n + 1 ) ]
    for i in range ( 2 , n + 1 ) :
        prime [ i ] = 1
    prime [ 0 ] = prime [ 1 ] = 0
    for p in range ( 2 , int ( sqrt ( n ) ) + 1 , 1 ) :
        if ( prime [ p ] == 1 ) :
            for i in range ( p * 2 , n + 1 , p ) :
                prime [ i ] = 0
    for i in range ( 2 , n + 1 , 1 ) :
        if ( prime [ i ] != 0 ) :
            temp = ( 2 * i ) + 1
            if ( temp <= n and prime [ temp ] != 0 ) :
                prime [ temp ] = 2
    for i in range ( 5 , n + 1 ) :
        if ( prime [ i ] == 2 ) :
            print ( i , end = " ▁ " )
if __name__ == ' _ _ main _ _ ' :
    n = 20
    printSafePrimes ( n )

Index/key variables: i, p, temp
Iterator variables: i, p
Python program:
def Divisors ( x ) :
    c = 0
    v = [ ]
    while ( x % 2 == 0 ) :
        c += 1
        x /= 2
    v . append ( c )
    c = 0
    while ( x % 3 == 0 ) :
        c += 1
        x /= 3
    v . append ( c )
    c = 0
    while ( x % 7 == 0 ) :
        c += 1
        x /= 7
    v . append ( c )
    v . append ( x )
    return v
def MinOperations ( a , b ) :
    va = Divisors ( a )
    vb = Divisors ( b )
    if ( va [ 3 ] != vb [ 3 ] ) :
        return - 1
    minOperations = abs ( va [ 0 ] - vb [ 0 ] ) + abs ( va [ 1 ] - vb [ 1 ] ) + abs ( va [ 2 ] - vb [ 2 ] )
    return minOperations
if __name__ == ' _ _ main _ _ ' :
    a = 14
    b = 28
    print ( MinOperations ( a , b ) )

Accumulator variables: c, x
Python program:
def printNum ( n , k ) :
    x = 0
    m = n
    while ( m ) :
        x += m & 1
        m >>= 1
    if k < x or k > n :
        print ( " - 1" )
        return
    pq = [ ]
    two = 1
    while ( n ) :
        if ( n & 1 ) :
            pq . append ( two )
        two = two * 2
        n = n >> 1
    while ( len ( pq ) < k ) :
        el = pq [ - 1 ]
        pq . pop ( )
        pq . append ( el // 2 )
        pq . append ( el // 2 )
    ind = 0
    pq . sort ( )
    while ( ind < k ) :
        print ( pq [ - 1 ] , end = " ▁ " )
        pq . pop ( )
        ind += 1
n = 9
k = 4
printNum ( n , k )

Accumulator variables: ind, m, pq, x
Python program:
n = 100002 ;
phi = [ 0 ] * ( n + 2 ) ;
ans = [ 0 ] * ( n + 2 ) ;
def ETF ( ) :
    for i in range ( 1 , n + 1 ) :
        phi [ i ] = i ;
    for i in range ( 2 , n + 1 ) :
        if ( phi [ i ] == i ) :
            phi [ i ] = i - 1 ;
            for j in range ( 2 * i , n + 1 , i ) :
                phi [ j ] = ( phi [ j ] * ( i - 1 ) ) // i ;
def LcmSum ( m ) :
    ETF ( ) ;
    for i in range ( 1 , n + 1 ) :
        for j in range ( i , n + 1 , i ) :
            ans [ j ] += ( i * phi [ i ] ) ;
    answer = ans [ m ] ;
    answer = ( answer + 1 ) * m ;
    answer = answer // 2 ;
    return answer ;
m = 5 ;
print ( LcmSum ( m ) ) ;

Index/key variables: i, j, m
Iterator variables: i, j
Python program:
def factorial ( n ) :
    fact = 1 ;
    for i in range ( 2 , n + 1 ) :
        fact = fact * i
    return fact
def ncr ( n , r ) :
    return factorial ( n ) // ( factorial ( r ) * factorial ( n - r ) )
def countWays ( string ) :
    freq = [ 0 ] * 26
    nvowels , nconsonants = 0 , 0
    for i in range ( len ( string ) ) :
        freq [ ord ( string [ i ] ) - ord ( ' a ' ) ] += 1
    for i in range ( 26 ) :
        if ( i == 0 or i == 4 or i == 8 or i == 14 or i == 20 ) :
            nvowels += freq [ i ]
        else :
            nconsonants += freq [ i ]
    vplaces = nconsonants + 1
    cways = factorial ( nconsonants )
    for i in range ( 26 ) :
        if ( i != 0 and i != 4 and i != 8 and i != 14 and i != 20 and freq [ i ] > 1 ) :
            cways = cways // factorial ( freq [ i ] )
    vways = ncr ( vplaces , nvowels ) * factorial ( nvowels )
    for i in range ( 26 ) :
        if ( i == 0 or i == 4 or i == 8 or i == 14 or i == 20 and freq [ i ] > 1 ) :
            vways = vways // factorial ( freq [ i ] )
    return cways * vways ;
if __name__ == " _ _ main _ _ " :
    string = " permutation "
    print ( countWays ( string ) )

Index/key variables: i
Accumulator variables: nconsonants, nvowels
Iterator variables: i
Python program:
def setBits ( n ) :
    count = 0
    while ( n ) :
        n = n & ( n - 1 )
        count += 1
    return count
def countPairs ( a , n ) :
    count = 0
    for i in range ( 0 , n - 1 , 1 ) :
        setbits_x = setBits ( a [ i ] )
        for j in range ( i + 1 , n , 1 ) :
            setbits_y = setBits ( a [ j ] )
            setbits_xor_xy = setBits ( a [ i ] ^ a [ j ] ) ;
            if ( setbits_x + setbits_y == setbits_xor_xy ) :
                count += 1
    return count
if __name__ == ' _ _ main _ _ ' :
    a = [ 2 , 3 , 4 , 5 , 6 ]
    n = len ( a )
    print ( countPairs ( a , n ) )

Index/key variables: i, j
Accumulator variables: count
Iterator variables: i, j
Python program:
def gcd ( a , b ) :
    if ( a == 0 ) :
        return b
    return gcd ( b % a , a ) ;
def findPossibleDerivables ( arr , n , D , A , B ) :
    gcdAB = gcd ( A , B )
    counter = 0
    for i in range ( n ) :
        if ( ( abs ( arr [ i ] - D ) % gcdAB ) == 0 ) :
            counter += 1
    return counter
if __name__ == " _ _ main _ _ " :
    arr = [ 1 , 2 , 3 , 4 , 7 , 13 ]
    n = len ( arr )
    D , A , B = 5 , 4 , 2
    print ( findPossibleDerivables ( arr , n , D , A , B ) )
    a = [ 1 , 2 , 3 ]
    n = len ( a )
    D , A , B = 6 , 3 , 2
    print ( findPossibleDerivables ( a , n , D , A , B ) )

Index/key variables: i
Accumulator variables: counter
Iterator variables: i
Python program:
def getElements ( a , arr , n ) :
    elements = [ 1 for i in range ( n + 1 ) ]
    elements [ 0 ] = a
    for i in range ( n ) :
        elements [ i + 1 ] = arr [ i ] ^ elements [ i ]
    for i in range ( n + 1 ) :
        print ( elements [ i ] , end = " ▁ " )
arr = [ 13 , 2 , 6 , 1 ]
n = len ( arr )
a = 5
getElements ( a , arr , n )

Index/key variables: i
Iterator variables: i
Python program:
from math import sqrt
def maxGCD ( N , P ) :
    ans = 1
    prime_factors = { }
    for i in range ( 2 , int ( sqrt ( P ) + 1 ) ) :
        while ( P % i == 0 ) :
            if i not in prime_factors :
                prime_factors [ i ] = 0
            prime_factors [ i ] += 1
            P //= i
    if ( P != 1 ) :
        prime_factors [ P ] += 1
    for key , value in prime_factors . items ( ) :
        ans *= pow ( key , value // N )
    return ans
if __name__ == " _ _ main _ _ " :
    N , P = 3 , 24
    print ( maxGCD ( N , P ) )

Index/key variables: P, i
Accumulator variables: ans
Iterator variables: i, key, value
Python program:
def distinctDigitSum ( n ) :
    used = [ False ] * 10
    sum = 0
    while ( n > 0 ) :
        digit = n % 10
        if ( not used [ digit ] ) :
            used [ digit ] = True
            sum += digit
        n = n // 10
    return sum
def checkSum ( m , n ) :
    sumM = distinctDigitSum ( m )
    sumN = distinctDigitSum ( n )
    if ( sumM == sumN ) :
        return " YES "
    return " NO "
if __name__ == " _ _ main _ _ " :
    m = 2452
    n = 9222
    print ( checkSum ( m , n ) )

Index/key variables: digit
Accumulator variables: sum
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 countPairs ( a , n ) :
    count = 0
    m = dict ( )
    for i in range ( n - 1 ) :
        for j in range ( i + 1 , n ) :
            if isPrime ( a [ i ] ^ a [ j ] ) and m . get ( a [ i ] ^ a [ j ] , 0 ) == 0 :
                m [ ( a [ i ] ^ a [ j ] ) ] = 1
                count += 1
    return count
a = [ 10 , 12 , 23 , 45 , 5 , 6 ]
n = len ( a )
print ( countPairs ( a , n ) )

Index/key variables: i, j
Accumulator variables: count
Iterator variables: i, j
Python program:
from collections import defaultdict
MAXN = 1000001
MAXN_sqrt = int ( MAXN ** ( 0.5 ) )
spf = [ None ] * ( MAXN )
def sieve ( ) :
    spf [ 1 ] = 1
    for i in range ( 2 , MAXN ) :
        spf [ i ] = i
    for i in range ( 4 , MAXN , 2 ) :
        spf [ i ] = 2
    for i in range ( 3 , MAXN_sqrt ) :
        if spf [ i ] == i :
            for j in range ( i * i , MAXN , i ) :
                if spf [ j ] == j :
                    spf [ j ] = i
def sumFactors ( arr , n ) :
    sieve ( )
    Map = defaultdict ( lambda : 0 )
    for i in range ( 0 , n ) :
        Map [ arr [ i ] ] = 1
    Sum = 0
    for i in range ( 0 , n ) :
        num = arr [ i ]
        while num != 1 and Map [ spf [ num ] ] == 1 :
            num = num // spf [ num ]
        if num == 1 :
            Sum += arr [ i ]
    return Sum
if __name__ == " _ _ main _ _ " :
    arr = [ 5 , 11 , 55 , 25 , 100 ]
    n = len ( arr )
    print ( sumFactors ( arr , n ) )

Index/key variables: i, j, num
Accumulator variables: Sum
Iterator variables: i, j
Python program:
from math import pow
def doubleFactorial ( n ) :
    fact = 1
    for i in range ( 1 , n + 1 , 2 ) :
        fact = fact * i
    return fact
def hermiteNumber ( n ) :
    if ( n % 2 == 1 ) :
        return 0
    else :
        number = ( ( pow ( 2 , n / 2 ) ) * doubleFactorial ( n - 1 ) )
        if ( ( n / 2 ) % 2 == 1 ) :
            number = number * - 1
        return number
if __name__ == ' _ _ main _ _ ' :
    n = 6
    print ( int ( hermiteNumber ( n ) ) )

Iterator variables: i
Python program:
from bisect import bisect as upper_bound
from bisect import bisect_left as lower_bound
from math import floor
N = 1000005
MAX = 10 ** 18
powers = [ ]
squares = dict ( )
s = dict ( )
def powersPrecomputation ( ) :
    for i in range ( 2 , N ) :
        squares [ i * i ] = 1
        if ( i not in squares . keys ( ) ) :
            continue
        temp = i
        while ( i * i <= ( MAX // temp ) ) :
            temp *= ( i * i )
            s [ temp ] = 1
    for x in s :
        powers . append ( x )
def calculateAnswer ( L , R ) :
    powersPrecomputation ( )
    perfectSquares = floor ( ( R ) ** ( .5 ) ) - floor ( ( L - 1 ) ** ( .5 ) )
    high = upper_bound ( powers , R )
    low = lower_bound ( powers , L )
    perfectPowers = perfectSquares + ( high - low )
    ans = ( R - L + 1 ) - perfectPowers
    return ans
L = 13
R = 20
print ( calculateAnswer ( L , R ) )

Index/key variables: temp
Accumulator variables: powers
Iterator variables: i, x
Python program:
def getSum ( n , d ) :
    sum = 0 ;
    for i in range ( n + 1 ) :
        if ( i % 10 == d ) :
            sum += i
    return sum
if __name__ == " _ _ main _ _ " :
    n , d = 30 , 3
    print ( getSum ( n , d ) )

Accumulator variables: sum
Iterator variables: i
Python program:
from math import sqrt
def isPrime ( N ) :
    k = int ( sqrt ( N ) ) + 1
    for i in range ( 2 , k , 1 ) :
        if ( N % i == 0 ) :
            return False
    return True
def getDifference ( N ) :
    if ( N == 0 ) :
        return 2
    elif ( N == 1 ) :
        return 1
    elif ( isPrime ( N ) ) :
        return 0
    aboveN = - 1
    belowN = - 1
    n1 = N + 1
    while ( True ) :
        if ( isPrime ( n1 ) ) :
            aboveN = n1
            break
        else :
            n1 += 1
    n1 = N - 1
    while ( True ) :
        if ( isPrime ( n1 ) ) :
            belowN = n1
            break
        else :
            n1 -= 1
    diff1 = aboveN - N
    diff2 = N - belowN
    return min ( diff1 , diff2 )
if __name__ == ' _ _ main _ _ ' :
    N = 25
    print ( getDifference ( N ) )

Accumulator variables: n1
Iterator variables: i
Python program:
import math
def check ( a , y ) :
    sum = 0
    for i in range ( len ( a ) ) :
        x = math . sqrt ( a [ i ] )
        if ( math . floor ( x ) == math . ceil ( x ) ) :
            sum = sum + a [ i ]
    if ( sum % y == 0 ) :
        return True
    else :
        return False
a = [ 2 , 3 , 4 , 9 , 10 ]
x = 13
if check ( a , x ) :
    print ( " Yes " )
else :
    print ( " No " )

Index/key variables: i
Iterator variables: i
Python program:
MAX = 10 ** 5
def findLargestDivisor ( n ) :
    m = n
    s = set ( )
    s . add ( 1 )
    s . add ( n )
    for i in range ( 2 , int ( n ** ( 0.5 ) ) + 1 ) :
        if n % i == 0 :
            s . add ( n // i )
            s . add ( i )
            while m % i == 0 :
                m //= i
    if m > 1 :
        s . add ( m )
    vec = [ i ** 2 for i in range ( 2 , MAX + 1 ) ]
    for d in sorted ( s , reverse = True ) :
        divi , j = 0 , 0
        while j < len ( vec ) and vec [ j ] <= d :
            if d % vec [ j ] == 0 :
                divi = 1
                break
            j += 1
        if not divi :
            return d
if __name__ == " _ _ main _ _ " :
    n = 12
    print ( findLargestDivisor ( n ) )
    n = 97
    print ( findLargestDivisor ( n ) )

Index/key variables: j
Accumulator variables: m, s
Iterator variables: d, i
Python program:
from collections import defaultdict
def NCR ( n , r ) :
    numerator = 1
    denominator = 1
    while ( r > 0 ) :
        numerator *= n
        denominator *= r
        n -= 1
        r -= 1
    return ( numerator // denominator )
def findWays ( arr , n ) :
    count = defaultdict ( int )
    if ( n < 4 ) :
        return 0
    for i in range ( n ) :
        count [ arr [ i ] ] += 1
    remaining_choices = 4
    ans = 1
    for it in reversed ( sorted ( count . keys ( ) ) ) :
        number = it
        frequency = count [ it ]
        toSelect = min ( remaining_choices , frequency )
        ans = ans * NCR ( frequency , toSelect )
        remaining_choices -= toSelect
        if ( not remaining_choices ) :
            break
    return ans
if __name__ == " _ _ main _ _ " :
    arr = [ 1 , 2 , 3 , 3 , 3 , 5 ]
    n = len ( arr )
    maxQuadrupleWays = findWays ( arr , n )
    print ( maxQuadrupleWays )

Index/key variables: i, it
Accumulator variables: denominator, n, numerator, r, remaining_choices
Iterator variables: i, it
Python program:
from math import sqrt
def maxPrimeFactors ( n ) :
    num = n
    maxPrime = - 1 ;
    while ( n % 2 == 0 ) :
        maxPrime = 2
        n = n / 2
    p = int ( sqrt ( n ) + 1 )
    for i in range ( 3 , p , 2 ) :
        while ( n % i == 0 ) :
            maxPrime = i
            n = n / i
    if ( n > 2 ) :
        maxPrime = n
    sum = maxPrime + num
    return sum
if __name__ == ' _ _ main _ _ ' :
    n = 19
    print ( maxPrimeFactors ( n ) )

Iterator variables: i
Python program:
def sumOfDigits ( n ) :
    res = 0 ;
    while ( n > 0 ) :
        res += n % 10
        n /= 10
    return res ;
def findNumber ( n ) :
    i = n - 1 ;
    while ( i > 0 ) :
        if ( sumOfDigits ( i ) > sumOfDigits ( n ) ) :
            return i
        i -= 1
    return - 1 ;
if __name__ == " _ _ main _ _ " :
    n = 824 ;
    print ( findNumber ( n ) )

Accumulator variables: i, n, res
Python program:
def findNth ( N ) :
    b = 14
    for i in range ( 2 , N + 1 ) :
        if ( i % 2 == 0 ) :
            b = b * 2
        else :
            b = b - 8
    return b
N = 6
print ( findNth ( N ) )

Iterator variables: i
Python program:
N = 4
def predictMatrix ( arr , range1a , range1b , range0a , range0b , K , b ) :
    c = 0
    while ( K ) :
        for i in range ( N ) :
            for j in range ( N ) :
                c = 0
                if ( i > 0 and arr [ i - 1 ] [ j ] == 1 ) :
                    c += 1
                if ( j > 0 and arr [ i ] [ j - 1 ] == 1 ) :
                    c += 1
                if ( i > 0 and j > 0 and arr [ i - 1 ] [ j - 1 ] == 1 ) :
                    c += 1
                if ( i < N - 1 and arr [ i + 1 ] [ j ] == 1 ) :
                    c += 1
                if ( j < N - 1 and arr [ i ] [ j + 1 ] == 1 ) :
                    c += 1
                if ( i < N - 1 and j < N - 1 and arr [ i + 1 ] [ j + 1 ] == 1 ) :
                    c += 1
                if ( i < N - 1 and j > 0 and arr [ i + 1 ] [ j - 1 ] == 1 ) :
                    c += 1
                if ( i > 0 and j < N - 1 and arr [ i - 1 ] [ j + 1 ] == 1 ) :
                    c += 1
                if ( arr [ i ] [ j ] == 1 ) :
                    if ( c >= range1a and c <= range1b ) :
                        b [ i ] [ j ] = 1
                    else :
                        b [ i ] [ j ] = 0
                if ( arr [ i ] [ j ] == 0 ) :
                    if ( c >= range0a and c <= range0b ) :
                        b [ i ] [ j ] = 1
                    else :
                        b [ i ] [ j ] = 0
        K -= 1
        for k in range ( N ) :
            for m in range ( N ) :
                arr [ k ] [ m ] = b [ k ] [ m ]
if __name__ == " _ _ main _ _ " :
    arr = [ [ 0 , 0 , 0 , 0 ] , [ 0 , 1 , 1 , 0 ] , [ 0 , 0 , 1 , 0 ] , [ 0 , 1 , 0 , 1 ] ]
    range1a = 2
    range1b = 2
    range0a = 2
    range0b = 3
    K = 3
    b = [ [ 0 for x in range ( N ) ] for y in range ( N ) ]
    predictMatrix ( arr , range1a , range1b , range0a , range0b , K , b )
    for i in range ( N ) :
        print ( )
        for j in range ( N ) :
            print ( b [ i ] [ j ] , end = " ▁ " )

Index/key variables: i, j, k, m
Accumulator variables: K, c
Iterator variables: i, j, k, m
Python program:
def countMoves ( n ) :
    ct = 0
    for i in range ( 1 , n + 1 ) :
        ct += i * ( n - i )
    ct += n
    return ct
if __name__ == " _ _ main _ _ " :
    n = 3
    print ( countMoves ( n ) )

Accumulator variables: ct
Iterator variables: i