dhyuti-n/xlcost-variable-roles huggingface dataset:
Python program:
def has0 ( x ) :
    while ( x != 0 ) :
        if ( x % 10 == 0 ) :
            return 1
        x = x // 10
    return 0
def getCount ( n ) :
    count = 0
    for i in range ( 1 , n + 1 ) :
        count = count + has0 ( i )
    return count
n = 107
print ( " Count ▁ of ▁ numbers ▁ from ▁ 1" , " ▁ to ▁ " , n , " ▁ is ▁ " , getCount ( n ) )

Iterator variables: i
Python program:
def squareRootExists ( n , p ) :
    n = n % p
    for x in range ( 2 , p , 1 ) :
        if ( ( x * x ) % p == n ) :
            return True
    return False
if __name__ == ' _ _ main _ _ ' :
    p = 7
    n = 2
    if ( squareRootExists ( n , p ) == True ) :
        print ( " Yes " )
    else :
        print ( " No " )

Iterator variables: x
Python program:
def largestPower ( n , p ) :
    x = 0
    while n :
        n /= p
        x += n
    return x
n = 10 ; p = 3
print ( " The largest power of % d that divides % d ! is % d " % ( p , n , largestPower ( n , p ) ) )

Accumulator variables: n, x
Python program:
def Bitwise_AND_sum_i ( arr1 , arr2 , M , N ) :
    frequency = [ 0 ] * 32
    for i in range ( N ) :
        bit_position = 0
        num = arr1 [ i ]
        while ( num ) :
            if ( num & 1 ) :
                frequency [ bit_position ] += 1
            bit_position += 1
            num >>= 1
    for i in range ( M ) :
        num = arr2 [ i ]
        value_at_that_bit = 1
        bitwise_AND_sum = 0
        for bit_position in range ( 32 ) :
            if ( num & 1 ) :
                bitwise_AND_sum += frequency [ bit_position ] * value_at_that_bit
            num >>= 1
            value_at_that_bit <<= 1
        print ( bitwise_AND_sum , end = " ▁ " )
    return
if __name__ == ' _ _ main _ _ ' :
    arr1 = [ 1 , 2 , 3 ]
    arr2 = [ 1 , 2 , 3 ]
    N = len ( arr1 )
    M = len ( arr2 )
    Bitwise_AND_sum_i ( arr1 , arr2 , M , N )

Index/key variables: bit_position, i
Accumulator variables: bitwise_AND_sum, num, value_at_that_bit
Iterator variables: bit_position, i
Python program:
def FlipBits ( n ) :
    for bit in range ( 32 ) :
        if ( ( n >> bit ) & 1 ) :
            n = n ^ ( 1 << bit )
            break
    print ( " The ▁ number ▁ after ▁ unsetting ▁ the " , end = " ▁ " )
    print ( " rightmost ▁ set ▁ bit " , n )
if __name__ == ' _ _ main _ _ ' :
    N = 12 ;
    FlipBits ( N )

Iterator variables: bit
Python program:
def bitwiseAndOdd ( n ) :
    result = 1 ;
    for i in range ( 3 , n + 1 , 2 ) :
        result = ( result & i ) ;
    return result ;
if __name__ == " _ _ main _ _ " :
    n = 10 ;
    print ( bitwiseAndOdd ( n ) ) ;

Iterator variables: i
Python program:
def countgroup ( a , n ) :
    xs = 0
    for i in range ( n ) :
        xs = xs ^ a [ i ]
    if xs == 0 :
        return ( 1 << ( n - 1 ) ) - 1
    return 0
a = [ 1 , 2 , 3 ]
n = len ( a )
print ( countgroup ( a , n ) )

Index/key variables: i
Iterator variables: i
Python program:
def square ( n ) :
    if ( n < 0 ) :
        n = - n
    res = n
    for i in range ( 1 , n ) :
        res += n
    return res
for n in range ( 1 , 6 ) :
    print ( " n ▁ = " , n , end = " , ▁ " )
    print ( " n ^ 2 ▁ = " , square ( n ) )

Accumulator variables: res
Iterator variables: i, n
Python program:
def answer ( n ) :
    dp = [ 0 ] * 10
    prev = [ 0 ] * 10
    if ( n == 1 ) :
        return 10
    for j in range ( 0 , 10 ) :
        dp [ j ] = 1
    for i in range ( 2 , n + 1 ) :
        for j in range ( 0 , 10 ) :
            prev [ j ] = dp [ j ]
        for j in range ( 0 , 10 ) :
            if ( j == 0 ) :
                dp [ j ] = prev [ j + 1 ]
            elif ( j == 9 ) :
                dp [ j ] = prev [ j - 1 ]
            else :
                dp [ j ] = prev [ j - 1 ] + prev [ j + 1 ]
    sum = 0
    for j in range ( 1 , 10 ) :
        sum = sum + dp [ j ]
    return sum
n = 2
print ( answer ( n ) )

Index/key variables: j
Iterator variables: i, j
Python program:
MAX = 100000 ;
catalan = [ 0 ] * MAX ;
def catalanDP ( n ) :
    catalan [ 0 ] = catalan [ 1 ] = 1 ;
    for i in range ( 2 , n + 1 ) :
        catalan [ i ] = 0 ;
        for j in range ( i ) :
            catalan [ i ] += ( catalan [ j ] * catalan [ i - j - 1 ] ) ;
def CatalanSequence ( arr , n ) :
    catalanDP ( n ) ;
    s = set ( ) ;
    a = 1 ; b = 1 ;
    s . add ( a ) ;
    if ( n >= 2 ) :
        s . add ( b ) ;
    for i in range ( 2 , n ) :
        s . add ( catalan [ i ] ) ;
    temp = set ( )
    for i in range ( n ) :
        if arr [ i ] in s :
            temp . add ( arr [ i ] )
    s = s - temp ;
    return len ( s ) ;
if __name__ == " _ _ main _ _ " :
    arr = [ 1 , 1 , 2 , 5 , 41 ] ;
    n = len ( arr )
    print ( CatalanSequence ( arr , n ) ) ;

Index/key variables: i, j
Accumulator variables: s, temp
Iterator variables: i, j
Python program:
def odd_indices ( arr ) :
    sum = 0
    for k in range ( 0 , len ( arr ) , 2 ) :
        check = composite ( arr [ k ] )
        sum += arr [ k ] if check == 1 else 0
    print ( sum )
def composite ( n ) :
    flag = 0
    c = 0
    for j in range ( 1 , n + 1 ) :
        if ( n % j == 0 ) :
            c += 1
    if ( c >= 3 ) :
        flag = 1
    return flag
if __name__ == " _ _ main _ _ " :
    arr = [ 13 , 5 , 8 , 16 , 25 ]
    odd_indices ( arr )

Index/key variables: k
Accumulator variables: c, sum
Iterator variables: j, k
Python program:
import math
def preprocess ( p , x , y , n ) :
    for i in range ( n ) :
        p [ i ] = x [ i ] * x [ i ] + y [ i ] * y [ i ]
    p . sort ( )
def query ( p , n , rad ) :
    start = 0
    end = n - 1
    while ( ( end - start ) > 1 ) :
        mid = ( start + end ) // 2
        tp = math . sqrt ( p [ mid ] )
        if ( tp > ( rad * 1.0 ) ) :
            end = mid - 1
        else :
            start = mid
    tp1 = math . sqrt ( p [ start ] )
    tp2 = math . sqrt ( p [ end ] )
    if ( tp1 > ( rad * 1.0 ) ) :
        return 0
    elif ( tp2 <= ( rad * 1.0 ) ) :
        return end + 1
    else :
        return start + 1
if __name__ == " _ _ main _ _ " :
    x = [ 1 , 2 , 3 , - 1 , 4 ]
    y = [ 1 , 2 , 3 , - 1 , 4 ]
    n = len ( x )
    p = [ 0 ] * n
    preprocess ( p , x , y , n )
    print ( query ( p , n , 3 ) )
    print ( query ( p , n , 32 ) )

Index/key variables: end, i, mid, start
Iterator variables: i
Python program:
def isSpiralSorted ( arr , n ) :
    start = 0 ;
    end = n - 1 ;
    while ( start < end ) :
        if ( arr [ start ] > arr [ end ] ) :
            return False ;
        start += 1 ;
        if ( arr [ end ] > arr [ start ] ) :
            return False ;
        end -= 1 ;
    return True ;
if __name__ == " _ _ main _ _ " :
    arr = [ 1 , 10 , 14 , 20 , 18 , 12 , 5 ] ;
    N = len ( arr ) ;
    if ( isSpiralSorted ( arr , N ) ) :
        print ( " YES " ) ;
    else :
        print ( " NO " ) ;

Index/key variables: end, start
Python program:
def findWordsSameRow ( arr ) :
    mp = { ' q ' : 1 , ' w ' : 1 , ' e ' : 1 , ' r ' : 1 , ' t ' : 1 , ' y ' : 1 , ' u ' : 1 , ' o ' : 1 , ' p ' : 1 , ' i ' : 1 , ' a ' : 2 , ' s ' : 2 , ' d ' : 2 , ' f ' : 2 , ' g ' : 2 , ' h ' : 2 , ' j ' : 2 , ' k ' : 2 , ' l ' : 2 , ' z ' : 3 , ' x ' : 3 , ' c ' : 3 , ' v ' : 3 , ' b ' : 3 , ' n ' : 3 , ' m ' : 3 }
    for word in arr :
        if ( len ( word ) != 0 ) :
            flag = True
            rowNum = mp [ word [ 0 ] . lower ( ) ]
            M = len ( word )
            for i in range ( 1 , M ) :
                if ( mp [ word [ i ] . lower ( ) ] != rowNum ) :
                    flag = False
                    break
            if ( flag ) :
                print ( word , end = ' ▁ ' )
words = [ " Yeti " , " Had " , " GFG " , " comment " ]
findWordsSameRow ( words )

Index/key variables: i
Iterator variables: i, word
Boolean variables: flag
Python program:
maxN = 2002
def countSubsequece ( a , n ) :
    answer = 0
    for i in range ( n ) :
        for j in range ( i + 1 , n ) :
            for k in range ( j + 1 , n ) :
                for l in range ( k + 1 , n ) :
                    if ( a [ j ] == a [ l ] and a [ i ] == a [ k ] ) :
                        answer += 1
    return answer
if __name__ == ' _ _ main _ _ ' :
    a = [ 1 , 2 , 3 , 2 , 1 , 3 , 2 ]
    print ( countSubsequece ( a , 7 ) )

Index/key variables: i, j, k, l
Accumulator variables: answer
Iterator variables: i, j, k, l
Python program:
import sys
def minDistChar ( s ) :
    n = len ( s )
    first = [ ]
    last = [ ]
    for i in range ( 26 ) :
        first . append ( - 1 )
        last . append ( - 1 )
    for i in range ( n ) :
        if ( first [ ord ( s [ i ] ) - ord ( ' a ' ) ] == - 1 ) :
            first [ ord ( s [ i ] ) - ord ( ' a ' ) ] = i
        last [ ord ( s [ i ] ) - ord ( ' a ' ) ] = i
    min = sys . maxsize
    ans = '1'
    for i in range ( 26 ) :
        if ( last [ i ] == first [ i ] ) :
            continue
        if ( min > last [ i ] - first [ i ] ) :
            min = last [ i ] - first [ i ]
            ans = i + ord ( ' a ' )
    return chr ( ans )
if __name__ == " _ _ main _ _ " :
    str = " geeksforgeeks "
    print ( minDistChar ( str ) )

Index/key variables: i
Accumulator variables: first, last
Iterator variables: i
Python program:
n = 3
def minSteps ( arr ) :
    v = [ [ 0 for i in range ( n ) ] for j in range ( n ) ]
    q = [ [ 0 , 0 ] ]
    depth = 0
    while ( len ( q ) != 0 ) :
        x = len ( q )
        while ( x > 0 ) :
            y = q [ 0 ]
            i = y [ 0 ]
            j = y [ 1 ]
            q . remove ( q [ 0 ] )
            x -= 1
            if ( v [ i ] [ j ] ) :
                continue
            if ( i == n - 1 and j == n - 1 ) :
                return depth
            v [ i ] [ j ] = 1
            if ( i + arr [ i ] [ j ] < n ) :
                q . append ( [ i + arr [ i ] [ j ] , j ] )
            if ( j + arr [ i ] [ j ] < n ) :
                q . append ( [ i , j + arr [ i ] [ j ] ] )
        depth += 1
    return - 1
if __name__ == ' _ _ main _ _ ' :
    arr = [ [ 1 , 1 , 1 ] , [ 1 , 1 , 1 ] , [ 1 , 1 , 1 ] ]
    print ( minSteps ( arr ) )

Index/key variables: i, j
Accumulator variables: depth, q, x
Python program:
import sys
def solve ( a , n ) :
    max1 = - sys . maxsize - 1
    for i in range ( 0 , n , 1 ) :
        for j in range ( 0 , n , 1 ) :
            if ( abs ( a [ i ] - a [ j ] ) > max1 ) :
                max1 = abs ( a [ i ] - a [ j ] )
    return max1
if __name__ == ' _ _ main _ _ ' :
    arr = [ - 1 , 2 , 3 , - 4 , - 10 , 22 ]
    size = len ( arr )
    print ( " Largest ▁ gap ▁ is ▁ : " , solve ( arr , size ) )

Index/key variables: i, j
Iterator variables: i, j
Python program:
def solve ( a , n ) :
    min1 = a [ 0 ]
    max1 = a [ 0 ]
    for i in range ( n ) :
        if ( a [ i ] > max1 ) :
            max1 = a [ i ]
        if ( a [ i ] < min1 ) :
            min1 = a [ i ]
    return abs ( min1 - max1 )
if __name__ == " _ _ main _ _ " :
    arr = [ - 1 , 2 , 3 , 4 , - 10 ]
    size = len ( arr )
    print ( " Largest ▁ gap ▁ is ▁ : ▁ " , solve ( arr , size ) )

Index/key variables: i
Iterator variables: i
Python program:
def replaceOriginal ( s , n ) :
    r = [ ' ▁ ' ] * n
    for i in range ( n ) :
        r [ i ] = s [ n - 1 - i ]
        if ( s [ i ] != ' a ' and s [ i ] != ' e ' and s [ i ] != ' i ' and s [ i ] != ' o ' and s [ i ] != ' u ' ) :
            print ( r [ i ] , end = " " )
    print ( )
if __name__ == " _ _ main _ _ " :
    s = " geeksforgeeks "
    n = len ( s )
    replaceOriginal ( s , n )

Index/key variables: i
Iterator variables: i
Python program:
def sameStrings ( str1 , str2 ) :
    N = len ( str1 )
    M = len ( str2 )
    if ( N != M ) :
        return False
    a , b = [ 0 ] * 256 , [ 0 ] * 256
    for i in range ( N ) :
        a [ ord ( str1 [ i ] ) - ord ( ' a ' ) ] += 1
        b [ ord ( str2 [ i ] ) - ord ( ' a ' ) ] += 1
    i = 0
    while ( i < 256 ) :
        if ( ( a [ i ] == 0 and b [ i ] == 0 ) or ( a [ i ] != 0 and b [ i ] != 0 ) ) :
            i += 1
        else :
            return False
    a = sorted ( a )
    b = sorted ( b )
    for i in range ( 256 ) :
        if ( a [ i ] != b [ i ] ) :
            return False
    return True
if __name__ == ' _ _ main _ _ ' :
    S1 , S2 = " cabbba " , " abbccc "
    if ( sameStrings ( S1 , S2 ) ) :
        print ( " YES " )
    else :
        print ( " NO " )

Index/key variables: i
Iterator variables: i
Python program:
def search ( arr , l , h , key ) :
    if ( l > h ) :
        return - 1 ;
    mid = ( l + h ) // 2 ;
    if ( arr [ mid ] == key ) :
        return mid ;
    if ( ( arr [ l ] == arr [ mid ] ) and ( arr [ h ] == arr [ mid ] ) ) :
        l += 1 ;
        h -= 1 ;
        return search ( arr , l , h , key )
    if ( arr [ l ] <= arr [ mid ] ) :
        if ( key >= arr [ l ] and key <= arr [ mid ] ) :
            return search ( arr , l , mid - 1 , key ) ;
        return search ( arr , mid + 1 , h , key ) ;
    if ( key >= arr [ mid ] and key <= arr [ h ] ) :
        return search ( arr , mid + 1 , h , key ) ;
    return search ( arr , l , mid - 1 , key ) ;
if __name__ == " _ _ main _ _ " :
    arr = [ 3 , 3 , 1 , 2 , 3 , 3 ] ;
    n = len ( arr ) ;
    key = 3 ;
    print ( search ( arr , 0 , n - 1 , key ) ) ;

Index/key variables: h, l, mid
Python program:
def getSortedString ( s , n ) :
    v1 = [ ]
    v2 = [ ]
    for i in range ( n ) :
        if ( s [ i ] >= ' a ' and s [ i ] <= ' z ' ) :
            v1 . append ( s [ i ] )
        if ( s [ i ] >= ' A ' and s [ i ] <= ' Z ' ) :
            v2 . append ( s [ i ] )
    v1 = sorted ( v1 )
    v2 = sorted ( v2 )
    i = 0
    j = 0
    for k in range ( n ) :
        if ( s [ k ] >= ' a ' and s [ k ] <= ' z ' ) :
            s [ k ] = v1 [ i ]
            i += 1
        elif ( s [ k ] >= ' A ' and s [ k ] <= ' Z ' ) :
            s [ k ] = v2 [ j ]
            j += 1
    return " " . join ( s )
s = " gEeksfOrgEEkS "
ss = [ i for i in s ]
n = len ( ss )
print ( getSortedString ( ss , n ) )

Index/key variables: i, j, k
Accumulator variables: v1, v2
Iterator variables: i, k
Python program:
def check ( s ) :
    l = len ( s )
    s = ' ' . join ( sorted ( s ) )
    for i in range ( 1 , l ) :
        if ord ( s [ i ] ) - ord ( s [ i - 1 ] ) != 1 :
            return False
    return True
if __name__ == " _ _ main _ _ " :
    string = " dcef "
    if check ( string ) :
        print ( " Yes " )
    else :
        print ( " No " )
    string = " xyza "
    if check ( string ) :
        print ( " Yes " )
    else :
        print ( " No " )

Index/key variables: i
Iterator variables: i
Python program:
def minElements ( arr , n ) :
    halfSum = 0
    for i in range ( n ) :
        halfSum = halfSum + arr [ i ]
    halfSum = int ( halfSum / 2 )
    arr . sort ( reverse = True )
    res = 0
    curr_sum = 0
    for i in range ( n ) :
        curr_sum += arr [ i ]
        res += 1
        if curr_sum > halfSum :
            return res
    return res
arr = [ 3 , 1 , 7 , 1 ]
n = len ( arr )
print ( minElements ( arr , n ) )

Index/key variables: i
Accumulator variables: curr_sum, res
Iterator variables: i
Python program:
def arrayElementEqual ( arr , N ) :
    sum = 0
    for i in range ( N ) :
        sum += arr [ i ]
    if ( sum % N == 0 ) :
        print ( ' Yes ' )
    else :
        print ( " No " )
arr = [ 1 , 5 , 6 , 4 ]
N = len ( arr )
arrayElementEqual ( arr , N )

Index/key variables: i
Accumulator variables: sum
Iterator variables: i
Python program:
def pairProductMean ( arr , N ) :
    suffixSumArray = [ 0 ] * N
    suffixSumArray [ N - 1 ] = arr [ N - 1 ]
    for i in range ( N - 2 , - 1 , - 1 ) :
        suffixSumArray [ i ] = suffixSumArray [ i + 1 ] + arr [ i ]
    length = ( N * ( N - 1 ) ) // 2
    res = 0
    for i in range ( N - 1 ) :
        res += arr [ i ] * suffixSumArray [ i + 1 ]
    mean = 0
    if ( length != 0 ) :
        mean = res / length
    else :
        mean = 0
    return mean
if __name__ == ' _ _ main _ _ ' :
    arr = [ 1 , 2 , 4 , 8 ]
    N = len ( arr )
    print ( round ( pairProductMean ( arr , N ) , 2 ) )

Index/key variables: i
Accumulator variables: res
Iterator variables: i
Python program:
def find_max ( v , n ) :
    count = 0
    if ( n >= 2 ) :
        count = 2
    else :
        count = 1
    for i in range ( 1 , n - 1 ) :
        if ( v [ i - 1 ] [ 0 ] > ( v [ i ] [ 0 ] + v [ i ] [ 1 ] ) ) :
            count += 1
        elif ( v [ i + 1 ] [ 0 ] > ( v [ i ] [ 0 ] + v [ i ] [ 1 ] ) ) :
            count += 1
            v [ i ] [ 0 ] = v [ i ] [ 0 ] + v [ i ] [ 1 ]
        else :
            continue
    return count
n = 3
v = [ ]
v . append ( [ 10 , 20 ] )
v . append ( [ 15 , 10 ] )
v . append ( [ 20 , 16 ] )
print ( find_max ( v , n ) )

Index/key variables: i
Accumulator variables: count
Iterator variables: i
Python program:
def numberofsubstrings ( str , k , charArray ) :
    N = len ( str )
    available = [ 0 ] * 26
    for i in range ( 0 , k ) :
        available [ ord ( charArray [ i ] ) - ord ( ' a ' ) ] = 1
    lastPos = - 1
    ans = ( N * ( N + 1 ) ) / 2
    for i in range ( 0 , N ) :
        if ( available [ ord ( str [ i ] ) - ord ( ' a ' ) ] == 0 ) :
            ans -= ( ( i - lastPos ) * ( N - i ) )
            lastPos = i
    print ( int ( ans ) )
str = " abcb "
k = 2
charArray = [ ' a ' , ' b ' ]
numberofsubstrings ( str , k , charArray )

Index/key variables: i
Accumulator variables: ans
Iterator variables: i
Python program:
def minCost ( N , P , Q ) :
    cost = 0
    while ( N > 0 ) :
        if ( N & 1 ) :
            cost += P
            N -= 1
        else :
            temp = N // 2 ;
            if ( temp * P > Q ) :
                cost += Q
            else :
                cost += P * temp
            N //= 2
    return cost
N = 9
P = 5
Q = 1
print ( minCost ( N , P , Q ) )

Accumulator variables: N, cost
Python program:
def numberOfWays ( n , k ) :
    dp = [ 0 for i in range ( 1000 ) ]
    dp [ 0 ] = 1
    for i in range ( 1 , k + 1 , 1 ) :
        numWays = 0
        for j in range ( n ) :
            numWays += dp [ j ]
        for j in range ( n ) :
            dp [ j ] = numWays - dp [ j ]
    print ( dp [ 0 ] )
if __name__ == ' _ _ main _ _ ' :
    N = 5
    K = 3
    numberOfWays ( N , K )

Index/key variables: j
Accumulator variables: numWays
Iterator variables: i, j
Python program:
def findMinCost ( arr , X , n , i = 0 ) :
    if ( X <= 0 ) :
        return 0
    if ( i >= n ) :
        return 10 ** 8
    inc = findMinCost ( arr , X - arr [ i ] [ 0 ] , n , i + 1 )
    if ( inc != 10 ** 8 ) :
        inc += arr [ i ] [ 1 ]
    exc = findMinCost ( arr , X , n , i + 1 )
    return min ( inc , exc )
if __name__ == ' _ _ main _ _ ' :
    arr = [ [ 4 , 3 ] , [ 3 , 2 ] , [ 2 , 4 ] , [ 1 , 3 ] , [ 4 , 2 ] ]
    X = 7
    n = len ( arr )
    ans = findMinCost ( arr , X , n )
    if ( ans != 10 ** 8 ) :
        print ( ans )
    else :
        print ( - 1 )

Index/key variables: i
Python program:
def find ( N , sum ) :
    if ( sum > 6 * N or sum < N ) :
        return 0
    if ( N == 1 ) :
        if ( sum >= 1 and sum <= 6 ) :
            return 1.0 / 6
        else :
            return 0
    s = 0
    for i in range ( 1 , 7 ) :
        s = s + find ( N - 1 , sum - i ) / 6
    return s
if __name__ == " _ _ main _ _ " :
    N = 4
    a = 13
    b = 17
    probability = 0.0
    for sum in range ( a , b + 1 ) :
        probability = probability + find ( N , sum )
    print ( round ( probability , 6 ) )

Iterator variables: i, sum
Java program:
import java . io . * ; class GFG { static double Conversion ( double centi ) { double pixels = ( 96 * centi ) / 2.54 ; System . out . println ( pixels ) ; return 0 ; } public static void main ( String args [ ] ) { int centi = 15 ; Conversion ( centi ) ; } }

Class/struct names: GFG
Java program:
import java . util . * ; class GFG { static int xor_operations ( int N , int arr [ ] , int M , int K ) { if ( M < 0 M >= N ) return - 1 ; if ( K < 0 K >= N - M ) return - 1 ; for ( int p = 0 ; p < M ; p ++ ) { Vector < Integer > temp = new Vector < Integer > ( ) ; for ( int i = 0 ; i < N - 1 ; i ++ ) { int value = arr [ i ] ^ arr [ i + 1 ] ; temp . add ( value ) ; arr [ i ] = temp . get ( i ) ; } } int ans = arr [ K ] ; return ans ; } public static void main ( String [ ] args ) { int N = 5 ; int arr [ ] = { 1 , 4 , 5 , 6 , 7 } ; int M = 1 , K = 2 ; System . out . print ( xor_operations ( N , arr , M , K ) ) ; } }

Index/key variables: K, i
Accumulator variables: i, p
Iterator variables: i, p
Class/struct names: GFG
Java program:
class GFG { public static void canBreakN ( long n ) { for ( long i = 2 ; ; i ++ ) { long m = i * ( i + 1 ) / 2 ; if ( m > n ) break ; long k = n - m ; if ( k % i != 0 ) continue ; System . out . println ( i ) ; return ; } System . out . println ( " - 1" ) ; } public static void main ( String [ ] args ) { long N = 12 ; canBreakN ( N ) ; } }

Accumulator variables: i
Iterator variables: i
Class/struct names: GFG
Java program:
import java . util . * ; class GFG { public static void findCoprimePair ( int N ) { for ( int x = 2 ; x <= Math . sqrt ( N ) ; x ++ ) { if ( N % x == 0 ) { while ( N % x == 0 ) { N /= x ; } if ( N > 1 ) { System . out . println ( x + " ▁ " + N ) ; return ; } } } System . out . println ( - 1 ) ; } public static void main ( String [ ] args ) { int N = 45 ; findCoprimePair ( N ) ; N = 25 ; findCoprimePair ( N ) ; } }

Accumulator variables: N, x
Iterator variables: x
Class/struct names: GFG
Java program:
import java . util . * ; class GFG { static int MAX = 10000 ; static Vector < Integer > primes = new Vector < Integer > ( ) ; static void sieveSundaram ( ) { boolean marked [ ] = new boolean [ MAX / 2 + 1 ] ; for ( int i = 1 ; i <= ( Math . sqrt ( MAX ) - 1 ) / 2 ; i ++ ) { for ( int j = ( i * ( i + 1 ) ) << 1 ; j <= MAX / 2 ; j = j + 2 * i + 1 ) { marked [ j ] = true ; } } primes . add ( 2 ) ; for ( int i = 1 ; i <= MAX / 2 ; i ++ ) if ( marked [ i ] == false ) primes . add ( 2 * i + 1 ) ; } static boolean isWasteful ( int n ) { if ( n == 1 ) return false ; int original_no = n ; int sumDigits = 0 ; while ( original_no > 0 ) { sumDigits ++ ; original_no = original_no / 10 ; } int pDigit = 0 , count_exp = 0 , p = 0 ; for ( int i = 0 ; primes . get ( i ) <= n / 2 ; i ++ ) { while ( n % primes . get ( i ) == 0 ) { p = primes . get ( i ) ; n = n / p ; count_exp ++ ; } while ( p > 0 ) { pDigit ++ ; p = p / 10 ; } while ( count_exp > 1 ) { pDigit ++ ; count_exp = count_exp / 10 ; } } if ( n != 1 ) { while ( n > 0 ) { pDigit ++ ; n = n / 10 ; } } return ( pDigit > sumDigits ) ; } static void Solve ( int N ) { for ( int i = 1 ; i < N ; i ++ ) { if ( isWasteful ( i ) ) { System . out . print ( i + " ▁ " ) ; } } } public static void main ( String [ ] args ) { sieveSundaram ( ) ; int N = 10 ; Solve ( N ) ; } }

Index/key variables: i, j
Accumulator variables: count_exp, i, pDigit, sumDigits
Iterator variables: i, j
Class/struct names: GFG
Java program:
import java . util . * ; class GFG { static int printhexaRec ( int n ) { if ( n == 0 n == 1 n == 2 n == 3 n == 4 n == 5 ) return 0 ; else if ( n == 6 ) return 1 ; else return ( printhexaRec ( n - 1 ) + printhexaRec ( n - 2 ) + printhexaRec ( n - 3 ) + printhexaRec ( n - 4 ) + printhexaRec ( n - 5 ) + printhexaRec ( n - 6 ) ) ; } static void printhexa ( int n ) { System . out . print ( printhexaRec ( n ) + "NEW_LINE"); } public static void main ( String [ ] args ) { int n = 11 ; printhexa ( n ) ; } }

Class/struct names: GFG
Java program:
class GFG { static void printhexa ( int n ) { if ( n < 0 ) return ; int first = 0 ; int second = 0 ; int third = 0 ; int fourth = 0 ; int fifth = 0 ; int sixth = 1 ; int curr = 0 ; if ( n < 6 ) System . out . println ( first ) ; else if ( n == 6 ) System . out . println ( sixth ) ; else { for ( int i = 6 ; i < n ; i ++ ) { curr = first + second + third + fourth + fifth + sixth ; first = second ; second = third ; third = fourth ; fourth = fifth ; fifth = sixth ; sixth = curr ; } } System . out . println ( curr ) ; } public static void main ( String [ ] args ) { int n = 11 ; printhexa ( n ) ; } }

Accumulator variables: i
Iterator variables: i
Class/struct names: GFG
Java program:
class GFG { static void smallestNumber ( int N ) { System . out . print ( ( N % 9 + 1 ) * Math . pow ( 10 , ( N / 9 ) ) - 1 ) ; } public static void main ( String [ ] args ) { int N = 10 ; smallestNumber ( N ) ; } }

Class/struct names: GFG