dhyuti-n/xlcost-variable-roles huggingface dataset:
Python program:
def makeAndCheckString ( words , str ) :
    n = len ( words )
    first = second = False
    for i in range ( n ) :
        if words [ i ] == str :
            return True
        if str [ 0 ] == words [ i ] [ 1 ] :
            first = True
        if str [ 1 ] == words [ i ] [ 0 ] :
            second = True
        if first and second :
            return True
    return False
str = ' ya '
words = [ ' ah ' , ' oy ' , ' to ' , ' ha ' ]
if makeAndCheckString ( words , str ) :
    print ( ' YES ' )
else :
    print ( ' NO ' )

Index/key variables: i
Iterator variables: i
Boolean variables: first, second
Python program:
def getBinaryRep ( N , num_of_bits ) :
    r = " " ;
    num_of_bits -= 1
    while ( num_of_bits >= 0 ) :
        if ( N & ( 1 << num_of_bits ) ) :
            r += ( "1" ) ;
        else :
            r += ( "0" ) ;
        num_of_bits -= 1
    return r ;
def NBitBinary ( N ) :
    r = [ ]
    first = 1 << ( N - 1 ) ;
    last = first * 2 ;
    for i in range ( last - 1 , first - 1 , - 1 ) :
        zero_cnt = 0 ;
        one_cnt = 0 ;
        t = i ;
        num_of_bits = 0 ;
        while ( t ) :
            if ( t & 1 ) :
                one_cnt += 1
            else :
                zero_cnt += 1
            num_of_bits += 1
            t = t >> 1 ;
        if ( one_cnt >= zero_cnt ) :
            all_prefix_match = True ;
            msk = ( 1 << num_of_bits ) - 2 ;
            prefix_shift = 1 ;
            while ( msk ) :
                prefix = ( ( msk & i ) >> prefix_shift ) ;
                prefix_one_cnt = 0 ;
                prefix_zero_cnt = 0 ;
                while ( prefix ) :
                    if ( prefix & 1 ) :
                        prefix_one_cnt += 1
                    else :
                        prefix_zero_cnt += 1
                    prefix = prefix >> 1 ;
                if ( prefix_zero_cnt > prefix_one_cnt ) :
                    all_prefix_match = False ;
                    break ;
                prefix_shift += 1
                msk = msk & ( msk << 1 ) ;
            if ( all_prefix_match ) :
                r . append ( getBinaryRep ( i , num_of_bits ) ) ;
    return r
if __name__ == " _ _ main _ _ " :
    n = 4 ;
    results = NBitBinary ( n ) ;
    for i in range ( len ( results ) ) :
        print ( results [ i ] , end = " ▁ " )
    print ( )

Index/key variables: i
Accumulator variables: num_of_bits, one_cnt, prefix_one_cnt, prefix_shift, prefix_zero_cnt, r, zero_cnt
Iterator variables: i
Boolean variables: all_prefix_match
Python program:
from collections import defaultdict
def findWinner ( votes ) :
    mapObj = defaultdict ( int )
    for st in votes :
        mapObj [ st ] += 1
    maxValueInMap = 0
    winner = " "
    for entry in mapObj :
        key = entry
        val = mapObj [ entry ]
        if ( val > maxValueInMap ) :
            maxValueInMap = val
            winner = key
        elif ( val == maxValueInMap and winner > key ) :
            winner = key
    print ( winner )
if __name__ == " _ _ main _ _ " :
    votes = [ " john " , " johnny " , " jackie " , " johnny " , " john " , " jackie " , " jamie " , " jamie " , " john " , " johnny " , " jamie " , " johnny " , " john " ]
    findWinner ( votes )

Index/key variables: entry, st
Iterator variables: entry, st
Python program:
def checkLuhn ( cardNo ) :
    nDigits = len ( cardNo )
    nSum = 0
    isSecond = False
    for i in range ( nDigits - 1 , - 1 , - 1 ) :
        d = ord ( cardNo [ i ] ) - ord ( '0' )
        if ( isSecond == True ) :
            d = d * 2
        nSum += d // 10
        nSum += d % 10
        isSecond = not isSecond
    if ( nSum % 10 == 0 ) :
        return True
    else :
        return False
if __name__ == " _ _ main _ _ " :
    cardNo = "79927398713"
    if ( checkLuhn ( cardNo ) ) :
        print ( " This ▁ is ▁ a ▁ valid ▁ card " )
    else :
        print ( " This ▁ is ▁ not ▁ a ▁ valid ▁ card " )

Index/key variables: i
Accumulator variables: nSum
Iterator variables: i
Boolean variables: isSecond
Python program:
MAX_CHAR = 26
def distributingBalls ( k , n , string ) :
    a = [ 0 ] * MAX_CHAR
    for i in range ( n ) :
        a [ ord ( string [ i ] ) - ord ( ' a ' ) ] += 1
    for i in range ( MAX_CHAR ) :
        if ( a [ i ] > k ) :
            return False
    return True
if __name__ == " _ _ main _ _ " :
    n , k = 6 , 3
    string = " aacaab "
    if ( distributingBalls ( k , n , string ) ) :
        print ( " YES " )
    else :
        print ( " NO " )

Index/key variables: i
Iterator variables: i
Python program:
def isVowel ( x ) :
    if ( x == ' a ' or x == ' e ' or x == ' i ' or x == ' o ' or x == ' u ' ) :
        return True
    return False
def FindSubstr1ing ( str1 ) :
    n = len ( str1 )
    for i in range ( n ) :
        hash = dict ( )
        for j in range ( i , n ) :
            if ( isVowel ( str1 [ j ] ) == False ) :
                break
            hash [ str1 [ j ] ] = 1
            if ( len ( hash ) == 5 ) :
                print ( str1 [ i : j + 1 ] , end = " ▁ " )
str1 = " aeoibsddaeiouudb "
FindSubstr1ing ( str1 )

Index/key variables: j
Iterator variables: i, j
Python program:
def check ( list , s ) :
    n = len ( list )
    if ( n == 0 ) :
        return False
    for i in range ( 0 , n , 1 ) :
        if ( len ( list [ i ] ) != len ( s ) ) :
            continue
        diff = False
        for j in range ( 0 , len ( list [ i ] ) , 1 ) :
            if ( list [ i ] [ j ] != s [ j ] ) :
                if ( diff == False ) :
                    diff = True
                else :
                    diff = False
                    break
        if ( diff ) :
            return True
    return False
if __name__ == ' _ _ main _ _ ' :
    s = [ ]
    s . append ( " bana " )
    s . append ( " apple " )
    s . append ( " banacb " )
    s . append ( " bonanza " )
    s . append ( " banamf " )
    print ( int ( check ( s , " banana " ) ) )

Index/key variables: i, j
Iterator variables: i, j
Boolean variables: diff
Python program:
def xorZero ( str ) :
    one_count = 0
    zero_count = 0
    n = len ( str )
    for i in range ( 0 , n , 1 ) :
        if ( str [ i ] == '1' ) :
            one_count += 1
        else :
            zero_count += 1
    if ( one_count % 2 == 0 ) :
        return zero_count
    return one_count
if __name__ == ' _ _ main _ _ ' :
    str = "11111"
    print ( xorZero ( str ) )

Index/key variables: i
Accumulator variables: one_count, zero_count
Iterator variables: i
Python program:
MAX_CHAR = 26
def checkCorrectOrNot ( s ) :
    global MAX_CHAR
    count = [ 0 ] * MAX_CHAR
    n = len ( s )
    if n == 1 :
        return true
    i = 0 ; j = n - 1
    while i < j :
        count [ ord ( s [ i ] ) - ord ( ' a ' ) ] += 1
        count [ ord ( s [ j ] ) - ord ( ' a ' ) ] -= 1
        i += 1 ; j -= 1
    for i in range ( MAX_CHAR ) :
        if count [ i ] != 0 :
            return False
    return True
s = " abab "
print ( " Yes " if checkCorrectOrNot ( s ) else " No " )

Index/key variables: i, j
Iterator variables: i
Python program:
def checkString ( s ) :
    Len = len ( s )
    first = len ( s ) + 1
    for i in range ( Len ) :
        if ( s [ i ] == '1' ) :
            first = i
            break
    last = 0
    for i in range ( Len - 1 , - 1 , - 1 ) :
        if ( s [ i ] == '1' ) :
            last = i
            break
    for i in range ( first , last + 1 ) :
        if ( s [ i ] == '0' ) :
            return False
    return True
s = "00011111111100000"
if ( checkString ( s ) ) :
    print ( " VALID " )
else :
    print ( " NOT ▁ VALID " )

Index/key variables: i
Iterator variables: i
Python program:
def printAllSubstrings ( s , n ) :
    for i in range ( n ) :
        temp = " "
        for j in range ( i , n ) :
            temp += s [ j ]
            print ( temp )
s = " Geeky "
printAllSubstrings ( s , len ( s ) )

Index/key variables: j
Accumulator variables: temp
Iterator variables: i, j
Python program:
def preserveSpace ( Str ) :
    n = len ( Str )
    Str = list ( Str )
    start = 0
    end = n - 1
    while ( start < end ) :
        if ( Str [ start ] == ' ▁ ' ) :
            start += 1
            continue
        elif ( Str [ end ] == ' ▁ ' ) :
            end -= 1
            continue
        else :
            Str [ start ] , Str [ end ] = ( Str [ end ] , Str [ start ] )
            start += 1
            end -= 1
    print ( ' ' . join ( Str ) )
Str = " internship ▁ at ▁ geeks ▁ for ▁ geeks "
preserveSpace ( Str ) ;

Index/key variables: end, start
Python program:
def amendSentence ( string ) :
    string = list ( string )
    for i in range ( len ( string ) ) :
        if string [ i ] >= ' A ' and string [ i ] <= ' Z ' :
            string [ i ] = chr ( ord ( string [ i ] ) + 32 )
            if i != 0 :
                print ( " ▁ " , end = " " )
            print ( string [ i ] , end = " " )
        else :
            print ( string [ i ] , end = " " )
if __name__ == " _ _ main _ _ " :
    string = " BruceWayneIsBatman "
    amendSentence ( string )

Index/key variables: i
Iterator variables: i
Python program:
def repeat ( s , n ) :
    s1 = s
    for i in range ( 1 , n ) :
        s += s1
    return s
s = " geeks "
n = 3
print ( repeat ( s , n ) )

Accumulator variables: s
Iterator variables: i
Python program:
MAX_CHAR = 26
def factorial ( n ) :
    fact = 1 ;
    for i in range ( 2 , n + 1 ) :
        fact = fact * i ;
    return fact
def countDistinctPermutations ( st ) :
    length = len ( st )
    freq = [ 0 ] * MAX_CHAR
    for i in range ( 0 , length ) :
        if ( st [ i ] >= ' a ' ) :
            freq [ ( ord ) ( st [ i ] ) - 97 ] = freq [ ( ord ) ( st [ i ] ) - 97 ] + 1 ;
    fact = 1
    for i in range ( 0 , MAX_CHAR ) :
        fact = fact * factorial ( freq [ i ] )
    return factorial ( length ) / fact
st = " fvvfhvgv "
print ( countDistinctPermutations ( st ) )

Index/key variables: i
Iterator variables: i
Python program:
import math
def uniqueCharacters ( str ) :
    checker = 0
    for i in range ( len ( str ) ) :
        bitAtIndex = ord ( str [ i ] ) - ord ( ' a ' )
        if ( ( bitAtIndex ) > 0 ) :
            if ( ( checker & ( ( 1 << bitAtIndex ) ) ) > 0 ) :
                return False
            checker = checker | ( 1 << bitAtIndex )
    return True
if __name__ == ' _ _ main _ _ ' :
    input = " geekforgeeks "
    if ( uniqueCharacters ( input ) ) :
        print ( " The ▁ String ▁ " + input + " ▁ has ▁ all ▁ unique ▁ characters " )
    else :
        print ( " The ▁ String ▁ " + input + " ▁ has ▁ duplicate ▁ characters " )

Index/key variables: i
Iterator variables: i
Python program:
def isVowel ( ch ) :
    if ( ch == ' a ' or ch == ' e ' or ch == ' i ' or ch == ' o ' or ch == ' u ' ) :
        return True
    return False
def createAltStr ( str1 , str2 , start , l ) :
    finalStr = " "
    i = 0
    for j in range ( start , l ) :
        finalStr = ( finalStr + str1 [ i ] ) + str2 [ j ]
        i + 1
    return finalStr
def findAltStr ( str1 ) :
    nv = 0
    nc = 0
    vstr = " "
    cstr = " "
    l = len ( str1 )
    for i in range ( 0 , l ) :
        if ( isVowel ( str1 [ i ] ) ) :
            nv += 1
            vstr = vstr + str1 [ i ]
        else :
            nc += 1
            cstr = cstr + str1 [ i ]
    if ( abs ( nv - nc ) >= 2 ) :
        return " no ▁ such ▁ string "
    if ( nv > nc ) :
        return ( vstr [ 0 ] + createAltStr ( cstr , vstr , 1 , nv ) )
    if ( nc > nv ) :
        return ( cstr [ 0 ] + createAltStr ( vstr , cstr , 1 , nc ) )
    if ( cstr [ 0 ] < vstr [ 0 ] ) :
        return createAltStr ( cstr , vstr , 0 , nv )
    return createAltStr ( vstr , cstr , 0 , nc )
if __name__ == " _ _ main _ _ " :
    str1 = " geeks "
    print ( findAltStr ( str1 ) )

Index/key variables: i, j
Accumulator variables: nc, nv
Iterator variables: i, j
Python program:
MAX_CHAR = 26 ;
def countSubstringWithEqualEnds ( s ) :
    result = 0 ;
    n = len ( s ) ;
    count = [ 0 ] * MAX_CHAR ;
    for i in range ( n ) :
        count [ ord ( s [ i ] ) - ord ( ' a ' ) ] += 1 ;
    for i in range ( MAX_CHAR ) :
        result += ( count [ i ] * ( count [ i ] + 1 ) / 2 ) ;
    return result ;
s = " abcab " ;
print ( countSubstringWithEqualEnds ( s ) ) ;

Index/key variables: i
Accumulator variables: result
Iterator variables: i
Python program:
def maxRepeating ( str ) :
    n = len ( str )
    count = 0
    res = str [ 0 ]
    cur_count = 1
    for i in range ( n ) :
        if ( i < n - 1 and str [ i ] == str [ i + 1 ] ) :
            cur_count += 1
        else :
            if cur_count > count :
                count = cur_count
                res = str [ i ]
            cur_count = 1
    return res
if __name__ == " _ _ main _ _ " :
    str = " aaaabbaaccde "
    print ( maxRepeating ( str ) )

Index/key variables: i
Accumulator variables: cur_count
Iterator variables: i
Python program:
MAX = 10000
CHAR_SIZE = 26
def precompute ( mat , str , Len ) :
    for i in range ( CHAR_SIZE ) :
        mat [ Len ] [ i ] = Len
    for i in range ( Len - 1 , - 1 , - 1 ) :
        for j in range ( CHAR_SIZE ) :
            mat [ i ] [ j ] = mat [ i + 1 ] [ j ]
        mat [ i ] [ ord ( str [ i ] ) - ord ( ' a ' ) ] = i
def query ( mat , str , Len ) :
    pos = 0
    for i in range ( len ( str ) ) :
        if ( mat [ pos ] [ ord ( str [ i ] ) - ord ( ' a ' ) ] >= Len ) :
            return False
        else :
            pos = mat [ pos ] [ ord ( str [ i ] ) - ord ( ' a ' ) ] + 1
    return True
S = " geeksforgeeks "
Len = len ( S )
mat = [ [ 0 for i in range ( CHAR_SIZE ) ] for j in range ( MAX ) ]
precompute ( mat , S , Len )
get = " No "
if ( query ( mat , " gg " , Len ) ) :
    get = " Yes "
print ( get )
get = " No "
if ( query ( mat , " gro " , Len ) ) :
    get = " Yes "
print ( get )
get = " No "
if ( query ( mat , " gfg " , Len ) ) :
    get = " Yes "
print ( get )
get = " No "
if ( query ( mat , " orf " , Len ) ) :
    get = " Yes "
print ( get )

Index/key variables: Len, i, j, pos
Iterator variables: i, j
Python program:
def query ( s , i , j ) :
    n = len ( s )
    i %= n
    j %= n
    print ( " Yes " ) if s [ i ] == s [ j ] else print ( " No " )
if __name__ == " _ _ main _ _ " :
    X = " geeksforgeeks "
    query ( X , 0 , 8 )
    query ( X , 8 , 13 )
    query ( X , 6 , 15 )

Index/key variables: i, j
Python program:
def countPairs ( str1 ) :
    result = 0 ;
    n = len ( str1 )
    for i in range ( 0 , n ) :
        for j in range ( i + 1 , n ) :
            if ( abs ( ord ( str1 [ i ] ) - ord ( str1 [ j ] ) ) == abs ( i - j ) ) :
                result += 1 ;
    return result ;
if __name__ == " _ _ main _ _ " :
    str1 = " geeksforgeeks " ;
    print ( countPairs ( str1 ) ) ;

Index/key variables: i, j
Accumulator variables: result
Iterator variables: i, j
Python program:
def longestString ( str1 , str2 ) :
    count1 = [ 0 ] * 26
    count2 = [ 0 ] * 26
    for i in range ( len ( str1 ) ) :
        count1 [ ord ( str1 [ i ] ) - ord ( ' a ' ) ] += 1
    for i in range ( len ( str2 ) ) :
        count2 [ ord ( str2 [ i ] ) - ord ( ' a ' ) ] += 1
    result = " "
    for i in range ( 26 ) :
        for j in range ( 1 , min ( count1 [ i ] , count2 [ i ] ) + 1 ) :
            result = result + chr ( ord ( ' a ' ) + i )
    print ( result )
if __name__ == " _ _ main _ _ " :
    str1 = " geeks "
    str2 = " cake "
    longestString ( str1 , str2 )

Index/key variables: i
Iterator variables: i, j
Python program:
def checkPattern ( string , pattern ) :
    l = len ( pattern )
    if len ( string ) < l :
        return False
    for i in range ( l - 1 ) :
        x = pattern [ i ]
        y = pattern [ i + 1 ]
        last = string . rindex ( x )
        first = string . index ( y )
        if last == - 1 or first == - 1 or last > first :
            return False
    return True
if __name__ == " _ _ main _ _ " :
    string = " engineers ▁ rock "
    pattern = " gsr "
    print ( checkPattern ( string , pattern ) )

Index/key variables: i
Iterator variables: i
Python program:
def findSum ( str1 ) :
    temp = "0"
    Sum = 0
    for ch in str1 :
        if ( ch . isdigit ( ) ) :
            temp += ch
        else :
            Sum += int ( temp )
            temp = "0"
    return Sum + int ( temp )
str1 = "12abc20yz68"
print ( findSum ( str1 ) )

Accumulator variables: Sum, temp
Iterator variables: ch
Python program:
def countkDist ( str1 , k ) :
    n = len ( str1 )
    res = 0
    cnt = [ 0 ] * 27
    for i in range ( 0 , n ) :
        dist_count = 0
        cnt = [ 0 ] * 27
        for j in range ( i , n ) :
            if ( cnt [ ord ( str1 [ j ] ) - 97 ] == 0 ) :
                dist_count += 1
            cnt [ ord ( str1 [ j ] ) - 97 ] += 1
            if ( dist_count == k ) :
                res += 1
            if ( dist_count > k ) :
                break
    return res
if __name__ == " _ _ main _ _ " :
    str1 = " abcbaa "
    k = 3
    print ( " Total ▁ substrings ▁ with ▁ exactly " , k , " distinct ▁ characters ▁ : ▁ " , end = " " )
    print ( countkDist ( str1 , k ) )

Index/key variables: j
Accumulator variables: dist_count, res
Iterator variables: i, j
Python program:
def to_upper ( string ) :
    for i in range ( len ( string ) ) :
        if ( ' a ' <= string [ i ] <= ' z ' ) :
            string = ( string [ 0 : i ] + chr ( ord ( string [ i ] ) - ord ( ' a ' ) + ord ( ' A ' ) ) + string [ i + 1 : ] )
    return string ;
if __name__ == ' _ _ main _ _ ' :
    str = " geeksforgeeks " ;
    print ( to_upper ( str ) ) ;

Index/key variables: i
Iterator variables: i
Python program:
def findMinLength ( arr , n ) :
    min = len ( arr [ 0 ] )
    for i in range ( 1 , n ) :
        if ( len ( arr [ i ] ) < min ) :
            min = len ( arr [ i ] )
    return ( min )
def commonPrefix ( arr , n ) :
    minlen = findMinLength ( arr , n )
    result = " "
    for i in range ( minlen ) :
        current = arr [ 0 ] [ i ]
        for j in range ( 1 , n ) :
            if ( arr [ j ] [ i ] != current ) :
                return result
        result = result + current
    return ( result )
if __name__ == " _ _ main _ _ " :
    arr = [ " geeksforgeeks " , " geeks " , " geek " , " geezer " ]
    n = len ( arr )
    ans = commonPrefix ( arr , n )
    if ( len ( ans ) ) :
        print ( " The ▁ longest ▁ common ▁ prefix ▁ is ▁ " , ans )
    else :
        print ( " There ▁ is ▁ no ▁ common ▁ prefix " )

Index/key variables: i, j
Iterator variables: i, j
Python program:
def isPalin ( str , st , end ) :
    while ( st < end ) :
        if ( str [ st ] != str [ end ] ) :
            return False
        st += 1
        end - - 1
    return True
def findMinInsert ( str , n ) :
    for i in range ( n - 1 , - 1 , - 1 ) :
        if ( isPalin ( str , 0 , i ) ) :
            return ( n - i - 1 )
Input = " JAVA "
print ( findMinInsert ( Input , len ( Input ) ) )

Index/key variables: end, st
Iterator variables: i
Python program:
def removeRecur ( n ) :
    prev_digit = n % 10
    pow = 10
    res = prev_digit
    while ( n ) :
        curr_digit = n % 10
        if ( curr_digit != prev_digit ) :
            res += curr_digit * pow
            prev_digit = curr_digit
            pow *= 10
        n = int ( n / 10 )
    return res
if __name__ == ' _ _ main _ _ ' :
    n = 12224
    print ( removeRecur ( n ) )

Accumulator variables: pow, res
Python program:
import sys
def myAtoi ( Str ) :
    sign , base , i = 1 , 0 , 0
    while ( Str [ i ] == ' ▁ ' ) :
        i += 1
    if ( Str [ i ] == ' - ' or Str [ i ] == ' + ' ) :
        sign = 1 - 2 * ( Str [ i ] == ' - ' )
        i += 1
    while ( i < len ( Str ) and Str [ i ] >= '0' and Str [ i ] <= '9' ) :
        if ( base > ( sys . maxsize // 10 ) or ( base == ( sys . maxsize // 10 ) and ( Str [ i ] - '0' ) > 7 ) ) :
            if ( sign == 1 ) :
                return sys . maxsize
            else :
                return - ( sys . maxsize )
        base = 10 * base + ( ord ( Str [ i ] ) - ord ( '0' ) )
        i += 1
    return base * sign
Str = list ( " ▁ - 123" )
val = myAtoi ( Str )
print ( val )

Index/key variables: i
Python program:
NO_OF_CHARS = 256
def areAnagram ( str1 , str2 ) :
    count = [ 0 for i in range ( NO_OF_CHARS ) ]
    i = 0
    for i in range ( len ( str1 ) ) :
        count [ ord ( str1 [ i ] ) - ord ( ' a ' ) ] += 1 ;
        count [ ord ( str2 [ i ] ) - ord ( ' a ' ) ] -= 1 ;
    if ( len ( str1 ) != len ( str2 ) ) :
        return False ;
    for i in range ( NO_OF_CHARS ) :
        if ( count [ i ] != 0 ) :
            return False
    return True
str1 = " geeksforgeeks "
str2 = " forgeeksgeeks "
if ( areAnagram ( str1 , str2 ) ) :
    print ( " The ▁ two ▁ strings ▁ are ▁ anagram ▁ of ▁ each ▁ other " )
else :
    print ( " The ▁ two ▁ strings ▁ are ▁ not ▁ anagram ▁ of ▁ each ▁ other " )

Index/key variables: i
Iterator variables: i
Python program:
def unique ( s ) :
    st = " "
    length = len ( s )
    for i in range ( length ) :
        c = s [ i ]
        if c not in st :
            st += c
    return st
if __name__ == " _ _ main _ _ " :
    s = " geeksforgeeks "
    print ( unique ( s ) )

Index/key variables: i
Accumulator variables: st
Iterator variables: i
Python program:
import math
def isPerfect ( x ) :
    sum_div = 1
    for i in range ( 2 , ( x // 2 ) + 1 ) :
        if ( x % i == 0 ) :
            sum_div += i
    if ( sum_div == x ) :
        return 1
    else :
        return 0
def subsetSum ( arr , l , r , sum ) :
    if ( l > r ) :
        if ( isPerfect ( sum ) != 0 ) :
            print ( sum , end = " ▁ " )
        return
    subsetSum ( arr , l + 1 , r , sum + arr [ l ] )
    subsetSum ( arr , l + 1 , r , sum )
arr = [ 5 , 4 , 6 ]
N = len ( arr )
subsetSum ( arr , 0 , N - 1 , 0 )

Index/key variables: l
Accumulator variables: sum_div
Iterator variables: i
Python program:
MAX = 100
store = [ 0 for i in range ( MAX ) ]
n = 0
graph = [ [ 0 for j in range ( MAX ) ] for i in range ( MAX ) ]
d = [ 0 for i in range ( MAX ) ]
ans = 0
def SieveOfEratosthenes ( prime , p_size ) :
    prime [ 0 ] = False
    prime [ 1 ] = False
    p = 2
    while ( p * p <= p_size ) :
        if ( prime [ p ] ) :
            for i in range ( p * 2 , p_size + 1 , p ) :
                prime [ i ] = False
        p += 1
def is_clique ( b ) :
    for i in range ( 1 , b ) :
        for j in range ( i + 1 , b ) :
            if ( graph [ store [ i ] ] [ store [ j ] ] == 0 ) :
                return False
    return True
def primeCliques ( i , l , prime ) :
    global ans
    for j in range ( i + 1 , n + 1 ) :
        store [ l ] = j
        if ( is_clique ( l + 1 ) ) :
            if ( prime [ l ] ) :
                ans += 1
            primeCliques ( j , l + 1 , prime )
if __name__ == ' _ _ main _ _ ' :
    edges = [ [ 1 , 2 ] , [ 2 , 3 ] , [ 3 , 1 ] , [ 4 , 3 ] , [ 4 , 5 ] , [ 5 , 3 ] ]
    size = len ( edges )
    n = 5
    prime = [ True for i in range ( n + 2 ) ]
    SieveOfEratosthenes ( prime , n + 1 )
    for i in range ( size ) :
        graph [ edges [ i ] [ 0 ] ] [ edges [ i ] [ 1 ] ] = 1
        graph [ edges [ i ] [ 1 ] ] [ edges [ i ] [ 0 ] ] = 1
        d [ edges [ i ] [ 0 ] ] += 1
        d [ edges [ i ] [ 1 ] ] += 1
    ans = 0
    primeCliques ( 0 , 1 , prime )
    print ( ans )

Index/key variables: i, j, l, p
Accumulator variables: ans
Iterator variables: i, j