dhyuti-n/xlcost-variable-roles huggingface dataset:
Python program:
def palindrome_prod ( N ) :
    palindrome_list = [ ]
    for i in range ( 101 , 1000 ) :
        for j in range ( 121 , 1000 , ( 1 if i % 11 == 0 else 11 ) ) :
            n = i * j
            x = str ( n )
            if x == x [ : : - 1 ] :
                if n < N :
                    palindrome_list . append ( i * j )
    print ( max ( palindrome_list ) )
N = 101110
palindrome_prod ( N )

Accumulator variables: palindrome_list
Iterator variables: i, j
Python program:
def isEqualStrings ( arr , N ) :
    M = len ( arr [ 0 ] )
    cntFreq = [ 0 ] * 256
    for i in range ( N ) :
        for j in range ( M ) :
            cntFreq [ ord ( arr [ i ] [ j ] ) - ord ( ' a ' ) ] += 1
    for i in range ( 256 ) :
        if ( cntFreq [ i ] % N != 0 ) :
            return False
    return True
if __name__ == " _ _ main _ _ " :
    arr = [ " aab " , " bbc " , " cca " ]
    N = len ( arr )
    if isEqualStrings ( arr , N ) :
        print ( " YES " )
    else :
        print ( " NO " )

Index/key variables: i, j
Iterator variables: i, j
Python program:
def PrintStack ( s ) :
    if ( len ( s ) == 0 ) :
        return ;
    x = s [ - 1 ] ;
    s . pop ( ) ;
    PrintStack ( s ) ;
    print ( x , end = " " ) ;
    s . append ( x ) ;
def minString ( s ) :
    Stack = [ ] ;
    Stack . append ( s [ 0 ] ) ;
    for i in range ( 1 , len ( s ) ) :
        if ( len ( Stack ) == 0 ) :
            Stack . append ( s [ i ] ) ;
        else :
            if ( Stack [ - 1 ] == s [ i ] ) :
                Stack . pop ( ) ;
            else :
                Stack . append ( s [ i ] ) ;
    PrintStack ( Stack ) ;
if __name__ == " _ _ main _ _ " :
    string = "101001" ;
    minString ( string ) ;

Index/key variables: i
Accumulator variables: Stack
Iterator variables: i
Python program:
def count_of_accident ( a , b ) :
    n = len ( a )
    m = len ( b )
    if ( n > m ) :
        return ( m * ( m + 1 ) ) / 2
    else :
        return ( ( n * ( n + 1 ) ) / 2 + ( m - n ) * n )
def count_of_collision ( a , b ) :
    n = len ( a )
    m = len ( b )
    answer = 0
    count_of_truck_in_lane_b = 0
    for i in range ( 0 , m ) :
        if ( b [ i ] == ' T ' ) :
            count_of_truck_in_lane_b += 1
    i = 0
    while ( i < m and i < n ) :
        if ( a [ i ] == ' T ' ) :
            answer += count_of_truck_in_lane_b
        if ( b [ i ] == ' T ' ) :
            count_of_truck_in_lane_b -= 1
        i += 1
    return answer
def findProbability ( a , b ) :
    total_outcome = count_of_accident ( a , b ) ;
    favourable_outcome = count_of_collision ( a , b ) ;
    print ( favourable_outcome / total_outcome )
if __name__ == " _ _ main _ _ " :
    S = " TCCBCTTB "
    T = " BTCCBBTT "
    findProbability ( S , T )

Index/key variables: i
Accumulator variables: answer, count_of_truck_in_lane_b
Iterator variables: i
Python program:
def power ( x , y , p ) :
    res = 1
    x = x % p
    if ( x == 0 ) :
        return 0
    while ( y > 0 ) :
        if ( ( y & 1 ) == 1 ) :
            res = ( res * x ) % p
        y = y >> 1
        x = ( x * x ) % p
    return res
N = 3
if ( ( N == 1 ) or ( N == 2 ) ) :
    print ( 62 )
else :
    m = ( 10 ** 9 ) + 7
    if ( N % 2 == 0 ) :
        k = N // 2
        flag = True
    else :
        k = ( N - 1 ) // 2
        flag = False
    if ( flag ) :
        a = power ( 62 , k , m )
        print ( a )
    else :
        a = power ( 62 , ( k + 1 ) , m )
        print ( a )

Boolean variables: flag
Python program:
def lenOfLongestReqSubstr ( s , N ) :
    ind = { }
    mask = 0
    ind [ 0 ] = - 1
    ans = 0
    for i in range ( N ) :
        val = ord ( s [ i ] ) - ord ( '0' )
        mask ^= ( 1 << val )
        if ( mask in ind ) :
            ans = max ( ans , i - ind [ mask ] )
        else :
            ind [ mask ] = i
    return ans
if __name__ == " _ _ main _ _ " :
    s = "223015150"
    N = len ( s )
    print ( lenOfLongestReqSubstr ( s , N ) )

Index/key variables: i, mask
Iterator variables: i
Python program:
def uniqueMorseRep ( arr ) :
    morseCode = [ " . - " , " - . . . " , " - . - . " , " - . . " , " . " , " . . - . " , " - - . " , " . . . . " , " . . " , " . - - - " , " - . - " , " . - . . " , " - - " , " - . " , " - - - " , " . - - . " , " - - . - " , " . - . " , " . . . " , " - " , " . . - " , " . . . - " , " . - - " , " - . . - " , " - . - - " , " - - . . " ] ;
    st = set ( ) ;
    N = len ( arr ) ;
    for i in range ( N ) :
        temp = " " ;
        M = len ( arr [ i ] ) ;
        for j in range ( M ) :
            temp += morseCode [ ord ( arr [ i ] [ j ] ) - ord ( ' a ' ) ] ;
        st . add ( temp ) ;
    return len ( st ) ;
if __name__ == ' _ _ main _ _ ' :
    arr = [ " gig " , " zeg " , " gin " , " msn " ] ;
    print ( uniqueMorseRep ( arr ) , " " ) ;

Index/key variables: i, j
Accumulator variables: st, temp
Iterator variables: i, j
Python program:
def findFreq ( strr , N ) :
    freq = [ 0 ] * 256
    max = 0
    charMax = '0'
    for i in range ( N ) :
        ch = ord ( strr [ i ] )
        freq [ ch ] += 1
        if ( freq [ ch ] >= max ) :
            max = freq [ ch ]
            charMax = ch
        print ( chr ( charMax ) , " - > " , max )
if __name__ == ' _ _ main _ _ ' :
    strr = " abbc "
    N = len ( strr )
    findFreq ( strr , N )

Index/key variables: ch, i
Iterator variables: i
Python program:
def findMinCost ( strr , pos ) :
    n = len ( strr )
    if ( pos >= n / 2 ) :
        strr = strr [ : : - 1 ]
        pos = n - pos - 1
    left , right = pos , pos
    for i in range ( pos , - 1 , - 1 ) :
        if ( strr [ i ] != strr [ n - i - 1 ] ) :
            left = i
    for i in range ( pos , n // 2 ) :
        if ( strr [ i ] != strr [ n - i - 1 ] ) :
            right = i
    ans = 0
    for i in range ( left , right + 1 ) :
        if ( strr [ i ] != strr [ n - i - 1 ] ) :
            ans += 1
    dis = ( min ( ( 2 * ( pos - left ) + ( right - pos ) ) , ( 2 * ( right - pos ) + ( pos - left ) ) ) )
    ans = ans + dis
    return ans
if __name__ == ' _ _ main _ _ ' :
    S = " bass "
    P = 3
    print ( findMinCost ( S , P ) )

Index/key variables: i
Accumulator variables: ans
Iterator variables: i
Python program:
def minCost ( s , n ) :
    minValue = 100000000
    for i in range ( 26 ) :
        cnt = 0
        for j in range ( n ) :
            cnt += min ( abs ( i - ( ord ( s [ j ] ) - ord ( ' a ' ) ) ) , 26 - abs ( i - ( ord ( s [ j ] ) - ord ( ' a ' ) ) ) )
        minValue = min ( minValue , cnt )
    return minValue
if __name__ == " _ _ main _ _ " :
    st = " geeksforgeeks "
    N = len ( st )
    print ( minCost ( st , N ) )

Index/key variables: j
Accumulator variables: cnt
Iterator variables: i, j
Python program:
def max_len ( s , N , M ) :
    set_str = { }
    for i in s :
        set_str [ i ] = 1
    left_ans , right_ans = [ ] , [ ]
    mid = " "
    for i in range ( N ) :
        t = s [ i ]
        t = t [ : : - 1 ]
        if ( t == s [ i ] ) :
            mid = t
        elif ( t in set_str ) :
            left_ans . append ( s [ i ] )
            right_ans . append ( t )
            del set_str [ s [ i ] ]
            del set_str [ t ]
    for x in left_ans :
        print ( x , end = " " )
    print ( mid , end = " " )
    right_ans = right_ans [ : : - 1 ]
    for x in right_ans :
        print ( x , end = " " )
if __name__ == ' _ _ main _ _ ' :
    N = 4
    M = 3
    s = [ " omg " , " bbb " , " ffd " , " gmo " ]
    max_len ( s , N , M )

Index/key variables: i, t
Accumulator variables: left_ans, right_ans
Iterator variables: i, x
Python program:
def minimum_length ( x1 , y1 , x2 , y2 , str ) :
    n = len ( str )
    pos1 = - 1
    pos2 = - 1
    pos3 = - 1
    pos4 = - 1
    if ( x1 == x2 and y1 == y2 ) :
        print ( "0" )
    else :
        for i in range ( n ) :
            if ( x2 > x1 ) :
                if ( str [ i ] == ' E ' ) :
                    x1 = x1 + 1
                    if ( x1 == x2 ) :
                        pos1 = i
            if ( x2 < x1 ) :
                if ( str [ i ] == ' W ' ) :
                    x1 = x1 - 1
                    if ( x1 == x2 ) :
                        pos2 = i
            if ( y2 > y1 ) :
                if ( str [ i ] == ' N ' ) :
                    y1 = y1 + 1
                    if ( y1 == y2 ) :
                        pos3 = i
            if ( y2 < y1 ) :
                if ( str [ i ] == ' S ' ) :
                    y1 = y1 - 1
                    if ( y1 == y2 ) :
                        pos4 = i
        z = 0
        z = max ( pos1 , max ( max ( pos2 , pos3 ) , pos4 ) )
        if ( x1 == x2 and y1 == y2 ) :
            print ( z + 1 )
        else :
            print ( " - 1" )
str = " SESNW "
x1 = 0
x2 = 1
y1 = 0
y2 = 1
minimum_length ( x1 , y1 , x2 , y2 , str )

Index/key variables: i
Iterator variables: i
Python program:
def ShortenString ( str1 ) :
    st = [ ]
    i = 0
    while i < len ( str1 ) :
        if len ( st ) == 0 or str1 [ i ] != st [ - 1 ] :
            st . append ( str1 [ i ] )
            i += 1
        else :
            st . pop ( )
            i += 1
    if len ( st ) == 0 :
        return ( " Empty ▁ String " )
    else :
        short_string = " "
        for i in st :
            short_string += str ( i )
        return ( short_string )
if __name__ == " _ _ main _ _ " :
    str1 = " azzxzy "
    print ( ShortenString ( str1 ) )

Index/key variables: i
Accumulator variables: short_string, st
Iterator variables: i
Python program:
def fact ( n ) :
    res = 1
    for i in range ( 1 , n + 1 ) :
        res = res * i
    return res
def distinctWays ( str1 , str2 ) :
    n = len ( str1 )
    m = len ( str2 )
    if ( n == m ) :
        return 2 * fact ( n ) * fact ( m )
    return fact ( n ) * fact ( m )
str1 = " aegh "
str2 = " rsw "
print ( distinctWays ( str1 , str2 ) )

Iterator variables: i
Python program:
from math import log
def lenn ( A , B ) :
    res = " "
    logg = 0
    while True :
        logg = log ( B ) // log ( 2 )
        if ( logg != 0 ) :
            res += ( str ( A ) + " < < " + str ( int ( logg ) ) )
        else :
            res += A
            break
        B = B - pow ( 2 , logg )
        if ( B != 0 ) :
            res += " + "
        else :
            break
        if logg == 0 :
            break
    return res
def minimumString ( A , B ) :
    res1 = lenn ( A , B )
    res2 = lenn ( B , A )
    if ( len ( res1 ) > len ( res2 ) ) :
        print ( res2 )
    else :
        print ( res1 )
if __name__ == ' _ _ main _ _ ' :
    A = 6
    B = 10
    minimumString ( A , B )

Accumulator variables: res
Python program:
def countSubString ( s ) :
    res = 0 ;
    for i in range ( len ( s ) ) :
        x = 0 ;
        for j in range ( i , len ( s ) ) :
            temp = 1 << ord ( s [ j ] ) - ord ( ' a ' ) ;
            x ^= temp ;
            if ( ( x & ( x - 1 ) ) == 0 ) :
                res += 1 ;
    print ( res ) ;
if __name__ == ' _ _ main _ _ ' :
    str = " aaa " ;
    countSubString ( str ) ;

Index/key variables: j
Accumulator variables: res, x
Iterator variables: i, j
Python program:
from collections import defaultdict
def countSubstring ( s ) :
    answer = 0
    m = defaultdict ( lambda : 0 )
    m [ 0 ] = 1
    x = 0
    for j in range ( len ( s ) ) :
        x ^= 1 << ( ord ( s [ j ] ) - ord ( ' a ' ) )
        answer += m [ x ]
        for i in range ( 26 ) :
            answer += m [ x ^ ( 1 << i ) ]
        m [ x ] += 1
    print ( answer )
str = " abab "
countSubstring ( str )

Index/key variables: j, x
Accumulator variables: answer
Iterator variables: i, j
Python program:
def printResult ( result ) :
    result = result [ : : - 1 ]
    i = 0
    while ( i < len ( result ) ) :
        print ( result [ i ] , end = " " )
        i += 1
def sumOfLargeNumbers ( v , k , N ) :
    x = [ [ ] for i in range ( 1000 ) ]
    for i in range ( k ) :
        for j in range ( N ) :
            x [ i ] . append ( ord ( v [ i ] [ j ] ) - ord ( '0' ) )
    carry = 0
    result = [ ]
    for i in range ( N - 1 , - 1 , - 1 ) :
        sum = 0
        for j in range ( k ) :
            sum += x [ j ] [ i ]
        sum += carry
        temp = sum
        count = 0
        while ( temp > 9 ) :
            temp = temp % 10
            count += 1
        l = pow ( 10 , count )
        if ( l != 1 ) :
            carry = sum / l
        sum = sum % 10
        result . append ( sum )
    while ( carry != 0 ) :
        a = carry % 10
        result . append ( a )
        carry = carry // 10
    printResult ( result )
if __name__ == ' _ _ main _ _ ' :
    K = 10
    N = 5
    arr = [ "1111111111" , "1111111111" , "1111111111" , "1111111111" , "1111111111" ]
    sumOfLargeNumbers ( arr , N , K )

Index/key variables: i, j
Accumulator variables: count, result, sum
Iterator variables: i, j
Python program:
def printRev ( strr ) :
    strr = strr . split ( " ▁ " )
    st = [ ]
    for i in strr :
        st . append ( i )
    while len ( st ) > 0 :
        print ( st [ - 1 ] , end = " ▁ " )
        del st [ - 1 ]
if __name__ == ' _ _ main _ _ ' :
    strr = " geeks ▁ quiz ▁ practice ▁ code "
    printRev ( strr )

Accumulator variables: st
Iterator variables: i
Python program:
def countOfSubstringWithOnlyOnes ( s ) :
    count = 0
    res = 0
    for i in range ( 0 , len ( s ) ) :
        if s [ i ] == '1' :
            count = count + 1
        else :
            count = 0 ;
        res = res + count
    return res
s = "0110111"
print ( countOfSubstringWithOnlyOnes ( s ) )

Index/key variables: i
Iterator variables: i
Python program:
mod = 1000000007
def binExp ( base , power ) :
    x = 1
    while ( power ) :
        if ( power % 2 == 1 ) :
            x = ( ( ( x % mod ) * ( base % mod ) ) % mod )
        base = ( ( ( base % mod ) * ( base % mod ) ) % mod )
        power = power // 2
    return x
def fact ( num ) :
    result = 1
    for i in range ( 1 , num + 1 ) :
        result = ( ( ( result % mod ) * ( i % mod ) ) % mod )
    return result
def calculate_nCi ( N , i ) :
    nfact = fact ( N )
    ifact = fact ( i )
    dfact = fact ( N - i )
    inv_ifact = binExp ( ifact , mod - 2 )
    inv_dfact = binExp ( dfact , mod - 2 )
    denm = ( ( ( inv_ifact % mod ) * ( inv_dfact % mod ) ) % mod )
    answer = ( ( ( nfact % mod ) * ( denm % mod ) ) % mod )
    return answer
def countSubstring ( N , s , k ) :
    allWays = binExp ( 26 , N )
    noWays = 0
    for i in range ( s ) :
        nCi = calculate_nCi ( N , i )
        remaining = binExp ( 25 , N - i )
        multiply = ( ( ( nCi % mod ) * ( remaining % mod ) ) % mod )
        noWays = ( ( ( noWays % mod ) + ( multiply % mod ) ) % mod )
    answer = ( ( ( allWays % mod ) - ( noWays % mod ) ) % mod )
    if ( answer < 0 ) :
        answer += mod
    print ( answer )
if __name__ == " _ _ main _ _ " :
    st = " abc "
    k = 2
    s = len ( st )
    N = s + k
    countSubstring ( N , s , k )

Iterator variables: i
Python program:
N = 100005
prefix = [ 0 ] * N
sum = [ 0 ] * N
def isSpecial ( c , special ) :
    for i in special :
        if ( i == c ) :
            return True
    return False
def countRatio ( s , special ) :
    n = len ( s )
    for i in range ( n ) :
        prefix [ i ] = int ( isSpecial ( s [ i ] , special ) )
        if ( i > 0 ) :
            prefix [ i ] += prefix [ i - 1 ]
    for i in range ( n ) :
        sum [ i ] = prefix [ i ]
        if ( i > 0 ) :
            sum [ i ] += sum [ i - 1 ]
    ans = 0
    for i in range ( 1 , n + 1 ) :
        if i > 1 :
            count = sum [ n - 1 ] - sum [ i - 2 ]
        else :
            count = sum [ n - 1 ]
        if i < n :
            count -= sum [ n - i - 1 ]
        ans += count / i
    return ans
if __name__ == " _ _ main _ _ " :
    s = " abcd "
    special = [ ' b ' , ' c ' ]
    ans = countRatio ( s , special )
    print ( ' % .6f ' % ans )

Index/key variables: i
Accumulator variables: ans, count
Iterator variables: i
Python program:
def count_minimum ( s ) :
    n = len ( s )
    ans = 0
    i = 0
    while i < n :
        j = i
        while j < n and ( s [ j ] == s [ i ] ) :
            j += 1
        diff = j - i
        ans += diff // 2
        i = j
    print ( ans )
if __name__ == " _ _ main _ _ " :
    str = " caaab "
    count_minimum ( str )

Index/key variables: i, j
Accumulator variables: ans
Python program:
def min_cost ( st ) :
    vow = " aeiou "
    cost = 0
    for i in range ( len ( st ) ) :
        costs = [ ]
        for j in range ( 5 ) :
            costs . append ( abs ( ord ( st [ i ] ) - ord ( vow [ j ] ) ) )
        cost += min ( costs )
    return cost
str = " abcde "
print ( min_cost ( str ) )

Index/key variables: i, j
Accumulator variables: cost, costs
Iterator variables: i, j
Python program:
def isPalindrome ( Str ) :
    l = 0
    h = len ( Str ) - 1
    while ( h > l ) :
        if ( Str [ l ] != Str [ h ] ) :
            return False
        l += 1
        h -= 1
    return True
def makeOddString ( Str ) :
    odd = " "
    for i in range ( 1 , len ( Str ) , 2 ) :
        odd += Str [ i ]
    return odd
def makeevenString ( Str ) :
    even = " "
    for i in range ( 0 , len ( Str ) , 2 ) :
        even += Str [ i ]
    return even
def checkevenOddPalindrome ( Str ) :
    odd = makeOddString ( Str )
    even = makeevenString ( Str )
    if ( isPalindrome ( odd ) and isPalindrome ( even ) ) :
        print ( " Yes " )
    else :
        print ( " No " )
Str = " abzzab "
checkevenOddPalindrome ( Str )

Index/key variables: h, i, l
Accumulator variables: even, odd
Iterator variables: i
Python program:
def count_Strings ( n ) :
    x = 1 ;
    for i in range ( 1 , n ) :
        x = ( 1 << x ) ;
    return x - 1 ;
if __name__ == ' _ _ main _ _ ' :
    n = 3 ;
    print ( count_Strings ( n ) ) ;

Iterator variables: i
Python program:
def decrypt ( Str , Start , End ) :
    if ( Start > End ) :
        return ;
    mid = ( Start + End ) >> 1 ;
    print ( Str [ mid ] , end = " " ) ;
    decrypt ( Str , mid + 1 , End ) ;
    decrypt ( Str , Start , mid - 1 ) ;
N = 4 ;
Str = " abcd " ;
decrypt ( Str , 0 , N - 1 ) ;
print ( ) ;
N = 6 ;
Str = " gyuitp " ;
decrypt ( Str , 0 , N - 1 ) ;

Index/key variables: mid
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 , s ) :
    B_Number = 0 ;
    cnt = 0 ;
    while ( N != 0 ) :
        rem = N % 2 ;
        c = pow ( 10 , cnt ) ;
        B_Number += rem * c ;
        N //= 2 ;
        cnt += 1 ;
    bin = str ( B_Number ) ;
    return isSuffix ( s , bin ) ;
if __name__ == " _ _ main _ _ " :
    N = 23 ;
    s = "111" ;
    if ( CheckBinaryEquivalent ( N , s ) ) :
        print ( " Yes " )
    else :
        print ( " No " )

Accumulator variables: B_Number, N, cnt
Iterator variables: i
Python program:
def isvowel ( ch ) :
    return ( ch == ' a ' or ch == ' e ' or ch == ' i ' or ch == ' o ' or ch == ' u ' )
def isvalid ( s ) :
    n = len ( s )
    for i in range ( n ) :
        if ( not isvowel ( s [ i ] ) ) :
            return False
    return True
def CountTotal ( s ) :
    ans = 0
    n = len ( s )
    for i in range ( n ) :
        temp = " "
        for j in range ( i , n ) :
            temp += s [ j ]
            if ( isvalid ( temp ) ) :
                ans += 1
    return ans
if __name__ == ' _ _ main _ _ ' :
    s = " aeoibsddaaeiouudb "
    print ( CountTotal ( s ) )

Index/key variables: i, j
Accumulator variables: ans, temp
Iterator variables: i, j
Python program:
def isVowel ( c ) :
    return ( c == ' a ' or c == ' e ' or c == ' i ' or c == ' o ' or c == ' u ' )
def isValid ( s ) :
    n = len ( s )
    if ( n == 1 ) :
        return ( isVowel ( s [ 0 ] ) )
    if ( isVowel ( s [ 0 ] ) == False ) :
        return False
    for i in range ( 1 , n ) :
        if ( s [ i ] == s [ i - 1 ] or not isVowel ( s [ i ] ) ) :
            return False
    return True
def findMaxLen ( s ) :
    maxLen = 0
    n = len ( s )
    for i in range ( n ) :
        temp = " "
        for j in range ( i , n ) :
            temp = temp + s [ j ]
            if ( isValid ( temp ) ) :
                maxLen = ( max ( maxLen , ( j - i + 1 ) ) )
    return maxLen
if __name__ == " _ _ main _ _ " :
    Str = " aeoibsddaeiouudb "
    print ( findMaxLen ( Str ) )

Index/key variables: i, j
Iterator variables: i, j
Python program:
def BalancedNumber ( s ) :
    Leftsum = 0
    Rightsum = 0
    for i in range ( 0 , int ( len ( s ) / 2 ) ) :
        Leftsum = Leftsum + int ( s [ i ] )
        Rightsum = ( Rightsum + int ( s [ len ( s ) - 1 - i ] ) )
    if ( Leftsum == Rightsum ) :
        print ( " Balanced " , end =   ' ' )
    else :
        print ( " Not ▁ Balanced " , end =   ' ' )
s = "12321"
BalancedNumber ( s )

Index/key variables: i
Iterator variables: i
Python program:
mod = 1e9 + 7
def expo ( base , exponent ) :
    ans = 1
    while ( exponent != 0 ) :
        if ( ( exponent & 1 ) == 1 ) :
            ans = ans * base
            ans = ans % mod
        base = base * base
        base %= mod
        exponent >>= 1
    return ans % mod
def findCount ( N ) :
    ans = ( ( expo ( 26 , N ) - expo ( 5 , N ) - expo ( 21 , N ) ) % mod )
    ans += mod
    ans %= mod
    return ans
if __name__ == " _ _ main _ _ " :
    N = 3
    print ( int ( findCount ( N ) ) )

Accumulator variables: base, exponent
Python program:
import sys
def decompose ( S ) :
    s = [ ]
    N = len ( S )
    ans = 0
    nix = sys . maxsize
    for i in range ( N - 1 , - 1 , - 1 ) :
        if ( len ( s ) == 0 ) :
            s . append ( S [ i ] )
            nix = S [ i ]
        else :
            if ( S [ i ] < s [ - 1 ] ) :
                s . append ( S [ i ] )
                nix = min ( nix , S [ i ] )
            else :
                val = S [ i ]
                while ( len ( s ) != 0 and val >= s [ - 1 ] ) :
                    s . pop ( )
                nix = min ( nix , S [ i ] ) ;
                s . append ( nix )
        ans += len ( s )
    return ans
if __name__ == " _ _ main _ _ " :
    S = [ 9 , 6 , 9 , 35 ]
    print ( decompose ( S ) )

Index/key variables: i
Accumulator variables: ans, s
Iterator variables: i
Python program:
def maxSetBitCount ( s , k ) :
    maxCount = 0
    n = len ( s )
    count = 0
    for i in range ( k ) :
        if ( s [ i ] == '1' ) :
            count += 1
    maxCount = count
    for i in range ( k , n ) :
        if ( s [ i - k ] == '1' ) :
            count -= 1
        if ( s [ i ] == '1' ) :
            count += 1
        maxCount = max ( maxCount , count )
    return maxCount
if __name__ == ' _ _ main _ _ ' :
    s = "100111010"
    k = 3
    print ( maxSetBitCount ( s , k ) )

Index/key variables: i
Accumulator variables: count
Iterator variables: i
Python program:
def minDel ( s1 , s2 ) :
    i = len ( s1 )
    j = len ( s2 )
    while ( i > 0 and j > 0 ) :
        if ( s1 [ i - 1 ] != s2 [ j - 1 ] ) :
            break
        i -= 1
        j -= 1
    return i + j
if __name__ == ' _ _ main _ _ ' :
    s1 = " geeksforgeeks "
    s2 = " peeks "
    print ( minDel ( s1 , s2 ) )

Accumulator variables: i, j
Python program:
def minDel ( s1 , s2 ) :
    i = 0 ;
    while ( i < min ( len ( s1 ) , len ( s2 ) ) ) :
        if ( s1 [ i ] != s2 [ i ] ) :
            break ;
        i += 1 ;
    ans = ( ( len ( s1 ) - i ) + ( len ( s2 ) - i ) ) ;
    return ans ;
if __name__ == ' _ _ main _ _ ' :
    s1 = " geeks " ;
    s2 = " geeksfor " ;
    print ( minDel ( s1 , s2 ) ) ;

Index/key variables: i