dhyuti-n/xlcost-variable-roles huggingface dataset:
C# program:
using System ; class GFG { static bool isDivisibleBy10 ( string bin , int n ) { if ( bin [ n - 1 ] == '1' ) return false ; int sum = 0 ; for ( int i = n - 2 ; i >= 0 ; i -- ) { if ( bin [ i ] == '1' ) { int posFromRight = n - i - 1 ; if ( posFromRight % 4 == 1 ) sum = sum + 2 ; else if ( posFromRight % 4 == 2 ) sum = sum + 4 ; else if ( posFromRight % 4 == 3 ) sum = sum + 8 ; else if ( posFromRight % 4 == 0 ) sum = sum + 6 ; } } if ( sum % 10 == 0 ) return true ; return false ; } static bool isDivisibleBy20 ( string bin , int n ) { if ( bin [ n - 1 ] == '1' ) return false ; return isDivisibleBy10 ( bin , n - 1 ) ; } public static void Main ( ) { string bin = "101000" ; int n = bin . Length ; if ( isDivisibleBy20 ( bin , n - 1 ) ) Console . WriteLine ( " Yes " ) ; else Console . WriteLine ( " No " ) ; } }

Index/key variables: i
Accumulator variables: i
Iterator variables: i
Class/struct names: GFG
C# program:
using System ; class GFG { static int toggleBits ( int n1 , int n2 ) { return ( n1 ^ n2 ) ; } public static void Main ( ) { int n1 = 2 , n2 = 5 ; Console . WriteLine ( toggleBits ( n1 , n2 ) ) ; } }

Class/struct names: GFG
C# program:
using System ; class GFG { static int evenbittogglenumber ( int n ) { int res = 0 , count = 0 ; for ( int temp = n ; temp > 0 ; temp >>= 1 ) { if ( count % 2 == 1 ) res |= ( 1 << count ) ; count ++ ; } return n ^ res ; } public static void Main ( ) { int n = 11 ; Console . WriteLine ( evenbittogglenumber ( n ) ) ; } }

Accumulator variables: count, res
Iterator variables: temp
Class/struct names: GFG
C# program:
using System ; class GFG { static int takeLandFsetbits ( int n ) { n |= n >> 1 ; n |= n >> 2 ; n |= n >> 4 ; n |= n >> 8 ; n |= n >> 16 ; return ( ( n + 1 ) >> 1 ) + 1 ; } static int toggleFandLbits ( int n ) { if ( n == 1 ) return 0 ; return n ^ takeLandFsetbits ( n ) ; } public static void Main ( ) { int n = 10 ; Console . WriteLine ( toggleFandLbits ( n ) ) ; } }

Accumulator variables: n
Class/struct names: GFG
C# program:
using System ; class GFG { static int countSetBits ( int n ) { int count = 0 ; while ( n != 0 ) { n &= ( n - 1 ) ; count ++ ; } return count ; } static bool checkOdious ( int n ) { return ( countSetBits ( n ) % 2 == 1 ) ; } public static void Main ( ) { int num = 32 ; if ( checkOdious ( num ) ) Console . Write ( " Yes " ) ; else Console . Write ( " No " ) ; } }

Accumulator variables: count, n
Class/struct names: GFG
C# program:
using System ; class GFG { static int setleftmostunsetbit ( int n ) { if ( ( n & ( n + 1 ) ) == 0 ) return n ; int pos = 0 ; for ( int temp = n , count = 0 ; temp > 0 ; temp >>= 1 , count ++ ) if ( ( temp & 1 ) == 0 ) pos = count ; return ( n | ( 1 << ( pos ) ) ) ; } public static void Main ( ) { int n = 10 ; Console . WriteLine ( setleftmostunsetbit ( n ) ) ; } }

Accumulator variables: count
Iterator variables: temp
Class/struct names: GFG
C# program:
using System ; public class main { static int maxXorSum ( int n , int k ) { if ( k == 1 ) return n ; int res = 1 ; while ( res <= n ) res <<= 1 ; return res - 1 ; } public static void Main ( ) { int n = 4 , k = 3 ; Console . WriteLine ( maxXorSum ( n , k ) ) ; } }

Class/struct names: main
C# program:
using System ; class GFG { static int getPosOfRightmostSetBit ( int n ) { return ( int ) ( Math . Log ( n & - n ) / Math . Log ( 2 ) ) ; } static int toggleLastKBits ( int n , int k ) { int num = ( 1 << k ) - 1 ; return ( n ^ num ) ; } static int incrementByOne ( int n ) { int k = getPosOfRightmostSetBit ( ~ n ) ; n = ( ( 1 << k ) n ) ; if ( k != 0 ) n = toggleLastKBits ( n , k ) ; return n ; } public static void Main ( ) { int n = 15 ; Console . WriteLine ( incrementByOne ( n ) ) ; } }

Class/struct names: GFG
C# program:
using System ; public class GfG { public static int xnor ( int a , int b ) { if ( a < b ) { int t = a ; a = b ; b = t ; } if ( a == 0 && b == 0 ) return 1 ; int a_rem = 0 ; int b_rem = 0 ; int count = 0 ; int xnornum = 0 ; while ( true ) { a_rem = a & 1 ; b_rem = b & 1 ; if ( a_rem == b_rem ) xnornum |= ( 1 << count ) ; count ++ ; a = a >> 1 ; b = b >> 1 ; if ( a < 1 ) break ; } return xnornum ; } public static void Main ( ) { int a = 10 , b = 50 ; Console . WriteLine ( xnor ( a , b ) ) ; } }

Accumulator variables: count, xnornum
Class/struct names: GfG
C# program:
using System ; class GFG { static int togglebit ( int n ) { if ( n == 0 ) return 1 ; int i = n ; n |= n >> 1 ; n |= n >> 2 ; n |= n >> 4 ; n |= n >> 8 ; n |= n >> 16 ; return i ^ n ; } static int xnor ( int num1 , int num2 ) { if ( num1 < num2 ) { int temp = num1 ; num1 = num2 ; num2 = temp ; } num1 = togglebit ( num1 ) ; return num1 ^ num2 ; } public static void Main ( ) { int a = 10 , b = 20 ; Console . WriteLine ( xnor ( a , b ) ) ; } }

Accumulator variables: n
Class/struct names: GFG
C# program:
using System ; class GFG { static void MaximumSum ( int [ ] a , int [ ] b , int n ) { int sum1 = 0 , sum2 = 0 ; for ( int i = 0 ; i < n ; i ++ ) { sum1 |= a [ i ] ; sum2 |= b [ i ] ; } Console . WriteLine ( sum1 + sum2 ) ; } public static void Main ( ) { int [ ] A = { 1 , 2 , 4 , 3 , 2 } ; int [ ] B = { 2 , 3 , 3 , 12 , 1 } ; int n = A . Length ; MaximumSum ( A , B , n ) ; } }

Index/key variables: i
Accumulator variables: i, sum1, sum2
Iterator variables: i
Class/struct names: GFG
C# program:
using System ; class GFG { static int posOfRightmostSetBit ( int n ) { return ( int ) ( Math . Log ( n & - n ) / Math . Log ( 2 ) ) + 1 ; } static int posOfCarryBit ( int a , int b ) { return posOfRightmostSetBit ( a & b ) ; } public static void Main ( ) { int a = 10 , b = 2 ; Console . Write ( posOfCarryBit ( a , b ) ) ; } }

Class/struct names: GFG
C# program:
using System ; class GFG { static bool isPowerOfTwo ( int x ) { return x != 0 && ( ( x & ( x - 1 ) ) == 0 ) ; } static bool differAtOneBitPos ( int a , int b ) { return isPowerOfTwo ( a ^ b ) ; } public static void Main ( ) { int a = 13 , b = 9 ; if ( differAtOneBitPos ( a , b ) == true ) Console . WriteLine ( " Yes " ) ; else Console . WriteLine ( " No " ) ; } }

Class/struct names: GFG
C# program:
using System ; class GFG { static long power2 ( long n ) { if ( n == 0 ) return 1 ; if ( n == 1 ) return 2 ; return power2 ( n / 2 ) * power2 ( n / 2 ) ; } static long multiply ( long x , long n ) { return x * power2 ( n ) ; } public static void Main ( ) { long x = 70 , n = 2 ; Console . WriteLine ( multiply ( x , n ) ) ; } }

Class/struct names: GFG
C# program:
using System ; class GFG { static int multiply ( int x , int n ) { return x << n ; } public static void Main ( ) { int x = 70 , n = 2 ; Console . WriteLine ( multiply ( x , n ) ) ; } }

Class/struct names: GFG
C# program:
using System ; class GFG { static bool isDivBy2PowerM ( int n , int m ) { if ( ( n & ( ( 1 << m ) - 1 ) ) == 0 ) return true ; return false ; } public static void Main ( ) { int n = 8 , m = 2 ; if ( isDivBy2PowerM ( n , m ) ) Console . Write ( " Yes " ) ; else Console . Write ( " No " ) ; } }

Class/struct names: GFG
C# program:
using System ; class GFG { static int findWinner ( int N ) { return N & 1 ; } public static void Main ( ) { int N = 15 ; if ( findWinner ( N ) == 1 ) Console . Write ( " Player ▁ A " ) ; else Console . Write ( " Player ▁ B " ) ; } }

Class/struct names: GFG
C# program:
using System ; class GFG { static int evenbittogglenumber ( int n ) { int res = 0 , count = 0 ; for ( int temp = n ; temp > 0 ; temp >>= 1 ) { if ( count % 2 == 0 ) res |= ( 1 << count ) ; count ++ ; } return n ^ res ; } public static void Main ( ) { int n = 11 ; Console . WriteLine ( evenbittogglenumber ( n ) ) ; } }

Accumulator variables: count, res
Iterator variables: temp
Class/struct names: GFG
C# program:
using System ; public class GFG { static void divide ( int n , int m ) { Console . WriteLine ( " Remainder ▁ = ▁ " + ( ( n ) & ( m - 1 ) ) ) ; Console . WriteLine ( " Quotient ▁ = ▁ " + ( n >> ( int ) ( Math . Log ( m ) ) ) ) ; } static public void Main ( ) { int n = 43 , m = 8 ; divide ( n , m ) ; } }

Class/struct names: GFG
C# program:
using System ; public class GfG { static int maxAND ( int [ ] arr , int n ) { int res = 0 ; for ( int i = 0 ; i < n ; i ++ ) for ( int j = i + 1 ; j < n ; j ++ ) res = res > ( arr [ i ] & arr [ j ] ) ? res : ( arr [ i ] & arr [ j ] ) ; return res ; } public static void Main ( ) { int [ ] arr = { 4 , 8 , 6 , 2 } ; int n = arr . Length ; Console . WriteLine ( " Maximum ▁ AND ▁ Value ▁ = ▁ " + maxAND ( arr , n ) ) ; } }

Index/key variables: i, j
Accumulator variables: i, j
Iterator variables: i, j
Class/struct names: GfG
C# program:
using System ; class GFG { static int index ( int i ) { return 1 + ( i >> 31 ) - ( - i >> 31 ) ; } static void check ( int n ) { String [ ] s = { " negative " , " zero " , " positive " } ; int val = index ( n ) ; Console . WriteLine ( n + " ▁ is ▁ " + s [ val ] ) ; } public static void Main ( ) { check ( 30 ) ; check ( - 20 ) ; check ( 0 ) ; } }

Index/key variables: val
Class/struct names: GFG
C# program:
using System ; public class GFG { static void compute ( long S , long X ) { long A = ( S - X ) / 2 ; int a = 0 , b = 0 ; for ( int i = 0 ; i < 8 * sizeof ( long ) ; i ++ ) { long Xi = ( X & ( 1 << i ) ) ; long Ai = ( A & ( 1 << i ) ) ; if ( Xi == 0 && Ai == 0 ) { } else if ( Xi == 0 && Ai > 0 ) { a = ( ( 1 << i ) a ) ; b = ( ( 1 << i ) b ) ; } else if ( Xi > 0 && Ai == 0 ) { a = ( ( 1 << i ) a ) ; } { Console . WriteLine ( " Not ▁ Possible " ) ; return ; } } Console . WriteLine ( " a ▁ = ▁ " + a + " b = " } public static void ( ) { long S = 17 , X = 13 ; compute ( S , X ) ; } }

Accumulator variables: i
Iterator variables: i
Class/struct names: GFG
C# program:
using System ; class GFG { static bool checking ( string s ) { int c = 0 ; int n = s . Length ; for ( int i = n - 1 ; i >= 0 ; i -- ) { if ( s [ i ] == '0' ) c ++ ; if ( c >= 6 && s [ i ] == '1' ) return true ; } return false ; } public static void Main ( ) { String s = "100010001" ; if ( checking ( s ) ) Console . WriteLine ( " Possible " ) ; else Console . WriteLine ( " Not ▁ possible " ) ; } }

Index/key variables: i
Accumulator variables: c, i
Iterator variables: i
Class/struct names: GFG
C# program:
using System ; class GFG { public static int modifyBit ( int n , int p , int b ) { int mask = 1 << p ; return ( n & ~ mask ) | ( ( b << p ) & mask ) ; } static public void Main ( ) { Console . WriteLine ( modifyBit ( 6 , 2 , 0 ) ) ; Console . WriteLine ( modifyBit ( 6 , 5 , 1 ) ) ; } }

Class/struct names: GFG
C# program:
using System ; class GFG { static int countSetBits ( int n ) { int count = 0 ; while ( n > 0 ) { n &= ( n - 1 ) ; count ++ ; } return count ; } static int countSetBitsInGivenRange ( int n , int l , int r ) { int num = ( ( 1 << r ) - 1 ) ^ ( ( 1 << ( l - 1 ) ) - 1 ) ; return countSetBits ( n & num ) ; } public static void Main ( ) { int n = 42 ; int l = 2 , r = 5 ; Console . WriteLine ( countSetBitsInGivenRange ( n , l , r ) ) ; } }

Accumulator variables: count, n
Class/struct names: GFG
C# program:
using System ; class GFG { public static bool areAllBitsSet ( long n ) { if ( n == 0 ) return false ; if ( ( ( n + 1 ) & n ) == 0 ) return true ; return false ; } public static bool isOnesComplementOfOther ( long a , long b ) { return areAllBitsSet ( a ^ b ) ; } public static void Main ( ) { long a = 10 , b = 5 ; if ( isOnesComplementOfOther ( a , b ) ) Console . Write ( " Yes " ) ; else Console . Write ( " No " ) ; } }

Class/struct names: GFG
C# program:
using System ; class GFG { static int findUnique ( int [ ] a , int n , int k ) { byte sizeof_int = 4 ; int INT_SIZE = 8 * sizeof_int ; int [ ] count = new int [ INT_SIZE ] ; for ( int i = 0 ; i < INT_SIZE ; i ++ ) for ( int j = 0 ; j < n ; j ++ ) if ( ( a [ j ] & ( 1 << i ) ) != 0 ) count [ i ] += 1 ; int res = 0 ; for ( int i = 0 ; i < INT_SIZE ; i ++ ) res += ( count [ i ] % k ) * ( 1 << i ) ; return res ; } public static void Main ( String [ ] args ) { int [ ] a = { 6 , 2 , 5 , 2 , 2 , 6 , 6 } ; int n = a . Length ; int k = 3 ; Console . WriteLine ( findUnique ( a , n , k ) ) ; } }

Index/key variables: INT_SIZE, i, j
Accumulator variables: i, j, res
Iterator variables: i, j
Class/struct names: GFG
C# program:
using System ; class GFG { static bool powerOfTwo ( uint n ) { return ( ( n & n - 1 ) == 0 ) ; } static bool onlyFirstAndLastAreSet ( uint n ) { if ( n == 1 ) return true ; return powerOfTwo ( n - 1 ) ; } public static void Main ( ) { uint n = ( uint ) 9 ; if ( onlyFirstAndLastAreSet ( n ) ) Console . WriteLine ( " Yes " ) ; else Console . WriteLine ( " No " ) ; } }

Class/struct names: GFG
C# program:
using System ; class GFG { static bool allBitsAreSet ( int n ) { if ( ( ( n + 1 ) & n ) == 0 ) return true ; return false ; } static bool bitsAreInAltOrder ( int n ) { int num = n ^ ( n >> 1 ) ; return allBitsAreSet ( num ) ; } public static void Main ( ) { int n = 10 ; if ( bitsAreInAltOrder ( n ) ) Console . WriteLine ( " Yes " ) ; else Console . WriteLine ( " No " ) ; } }

Class/struct names: GFG
C# program:
using System ; class GFG { static int setBit ( int xorValue ) { int count = 0 ; while ( xorValue >= 1 ) { if ( xorValue % 2 == 1 ) count ++ ; xorValue /= 2 ; } return count ; } static int minFlip ( int n , int k ) { int size = ( int ) ( Math . Log ( n ) / Math . Log ( 2 ) ) + 1 ; int max = ( int ) Math . Pow ( 2 , k ) - 1 ; max = max << ( size - k ) ; int xorValue = ( n ^ max ) ; return ( setBit ( xorValue ) ) ; } public static void Main ( ) { int n = 27 , k = 3 ; Console . Write ( " Min ▁ Flips ▁ = ▁ " + minFlip ( n , k ) ) ; } }

Accumulator variables: count, xorValue
Class/struct names: GFG
C# program:
using System ; class GFG { static int setallbitgivenrange ( int n , int l , int r ) { int range = ( ( ( 1 << ( l - 1 ) ) - 1 ) ^ ( ( 1 << ( r ) ) - 1 ) ) ; return ( n range ) ; } static void Main ( ) { int n = 17 , l = 2 , r = 3 ; Console . Write ( setallbitgivenrange ( n , l , r ) ) ; } }

Class/struct names: GFG
C# program:
using System ; class GFG { static uint countBits ( uint number ) { return ( uint ) Math . Log ( number , 2.0 ) + 1 ; } public static void Main ( ) { uint num = 65 ; Console . WriteLine ( countBits ( num ) ) ; } }

Class/struct names: GFG
C# program:
using System ; public class GFG { static String allBitsSetInTheGivenRange ( int n , int l , int r ) { int num = ( ( 1 << r ) - 1 ) ^ ( ( 1 << ( l - 1 ) ) - 1 ) ; int new_num = n & num ; if ( new_num == 0 ) return " Yes " ; return " No " ; } static public void Main ( ) { int n = 17 ; int l = 2 ; int r = 4 ; Console . WriteLine ( allBitsSetInTheGivenRange ( n , l , r ) ) ; } }

Class/struct names: GFG
C# program:
using System ; class GFG { static int setAllBitsAfterMSB ( int n ) { n |= n >> 1 ; n |= n >> 2 ; n |= n >> 4 ; n |= n >> 8 ; n |= n >> 16 ; return n ; } static int toggle ( int n ) { n = n ^ setAllBitsAfterMSB ( n ) ; return n ; } public static void Main ( ) { int n = 10 ; n = toggle ( n ) ; Console . WriteLine ( n ) ; } }

Accumulator variables: n
Class/struct names: GFG
C# program:
using System ; class GFG { static bool adjacentSet ( int n ) { int x = ( n & ( n >> 1 ) ) ; if ( x > 0 ) return true ; else return false ; } public static void Main ( ) { int n = 3 ; if ( adjacentSet ( n ) ) Console . WriteLine ( " Yes " ) ; else Console . WriteLine ( " No " ) ; } }

Class/struct names: GFG
C# program:
using System ; class GFG { static int getRightMostSetBit ( int n ) { return ( int ) ( ( Math . Log ( n & - n ) ) / ( Math . Log ( 2 ) ) ) + 1 ; } static int posOfRightMostSameBit ( int m , int n ) { return getRightMostSetBit ( ~ ( m ^ n ) ) ; } public static void Main ( ) { int m = 16 , n = 7 ; Console . Write ( " Position ▁ = ▁ " + posOfRightMostSameBit ( m , n ) ) ; } }

Class/struct names: GFG
C# program:
using System ; class GFG { static int posOfRightMostSameBit ( int m , int n ) { int loopCounter = 1 ; while ( m > 0 n > 0 ) { Boolean a = m % 2 == 1 ; Boolean b = n % 2 == 1 ; if ( ! ( a ^ b ) ) { return loopCounter ; } m = m >> 1 ; n = n >> 1 ; loopCounter ++ ; } return - 1 ; } public static void Main ( String [ ] args ) { int m = 16 , n = 7 ; Console . Write ( " Position ▁ = ▁ " + posOfRightMostSameBit ( m , n ) ) ; } }

Accumulator variables: loopCounter
Class/struct names: GFG
C# program:
using System ; class GFG { static String allBitsSetInTheGivenRange ( int n , int l , int r ) { int num = ( ( 1 << r ) - 1 ) ^ ( ( 1 << ( l - 1 ) ) - 1 ) ; int new_num = n & num ; if ( num == new_num ) return " Yes " ; return " No " ; } public static void Main ( ) { int n = 22 ; int l = 2 , r = 3 ; Console . Write ( allBitsSetInTheGivenRange ( n , l , r ) ) ; } }

Class/struct names: GFG
C# program:
using System ; class GFG { static void printNonConsecutive ( int n ) { int p = ( 1 << n ) ; for ( int i = 1 ; i < p ; i ++ ) if ( ( i & ( i << 1 ) ) == 0 ) Console . Write ( i + " ▁ " ) ; } public static void Main ( ) { int n = 3 ; printNonConsecutive ( n ) ; } }

Accumulator variables: i
Iterator variables: i
Class/struct names: GFG
C# program:
using System ; class GFG { static int INT_SIZE = 32 ; static int constructNthNumber ( int group_no , int aux_num , int op ) { int [ ] a = new int [ INT_SIZE ] ; int num = 0 , len_f ; int i = 0 ; if ( op == 2 ) { len_f = 2 * group_no ; a [ len_f - 1 ] = a [ 0 ] = 1 ; while ( aux_num > 0 ) { a [ group_no + i ] = a [ group_no - 1 - i ] = aux_num & 1 ; aux_num = aux_num >> 1 ; i ++ ; } } else if ( op == 0 ) { len_f = 2 * group_no + 1 ; a [ len_f - 1 ] = a [ 0 ] = 1 ; a [ group_no ] = 0 ; while ( aux_num > 0 ) { a [ group_no + 1 + i ] = a [ group_no - 1 - i ] = aux_num & 1 ; aux_num = aux_num >> 1 ; i ++ ; } } { len_f = 2 * group_no + 1 ; a [ len_f - 1 ] = a [ 0 ] = 1 ; a [ group_no ] = 1 ; while ( aux_num > 0 ) { a [ group_no + 1 + i ] = a [ group_no - 1 - i ] = aux_num & 1 ; aux_num = aux_num >> 1 ; i ++ ; } } for ( i = 0 ; i < len_f ; i ++ ) num += ( 1 << i ) * a [ i ] ; return num ; } static int getNthNumber ( int n ) { int group_no = 0 , group_offset ; int count_upto_group = 0 , count_temp = 1 ; int op , aux_num ; while ( count_temp < n ) { group_no ++ ; count_upto_group = count_temp ; count_temp += 3 * ( 1 << ( group_no - 1 ) ) ; } group_offset = n - count_upto_group - 1 ; if ( ( group_offset + 1 ) <= ( 1 << ( group_no - 1 ) ) ) { aux_num = group_offset ; } else { if ( ( ( group_offset + 1 ) - ( 1 << ( group_no - 1 ) ) ) % 2 == 1 ) else aux_num = ( ( group_offset ) - ( 1 << ( group_no - 1 ) ) ) / 2 ; } return constructNthNumber ( group_no , aux_num , op ) ; } public static void Main ( String [ ] args ) { int n = 9 ; Console . Write ( " { 0 } " , getNthNumber ( n ) ) ; } }

Index/key variables: INT_SIZE, group_no, i
Accumulator variables: count_temp, group_no, i, num
Iterator variables: i
Class/struct names: GFG
C# program:
using System ; class GFG { static void shuffle ( int N , int key ) { int NO_OF_BITS = N ; int reverse_num = 0 , temp ; for ( int i = 0 ; i < NO_OF_BITS ; i ++ ) { temp = ( key & ( 1 << i ) ) ; if ( temp > 0 ) reverse_num |= ( 1 << ( ( NO_OF_BITS - 1 ) - i ) ) ; } Console . Write ( reverse_num ) ; } public static void Main ( ) { int N = 3 ; int key = 3 ; shuffle ( N , key ) ; } }

Accumulator variables: i, reverse_num
Iterator variables: i
Class/struct names: GFG
C# program:
using System ; class GFG { static int countSetBits ( int n ) { int count = 0 ; while ( n > 0 ) { n = n & ( n - 1 ) ; count ++ ; } return count ; } static int findSum ( int n ) { int sum = 0 ; for ( int i = 1 ; i <= n ; i ++ ) if ( countSetBits ( i ) == 2 ) sum += i ; return sum ; } static public void Main ( ) { int n = 10 ; Console . WriteLine ( findSum ( n ) ) ; } }

Accumulator variables: count, i, sum
Iterator variables: i
Class/struct names: GFG
C# program:
using System ; namespace Toggle { public class GFG { public static int toggleLastMBits ( int n , int m ) { int num = ( 1 << m ) - 1 ; return ( n ^ num ) ; } public static void Main ( ) { int n = 107 , m = 4 ; n = toggleLastMBits ( n , m ) ; Console . Write ( n ) ; } } }

Class/struct names: GFG
C# program:
using System ; class GFG { static int getPosOfRightmostSetBit ( int n ) { return ( int ) ( ( Math . Log10 ( n & - n ) ) / ( Math . Log10 ( 2 ) ) ) + 1 ; } static int setRightmostUnsetBit ( int n ) { if ( n == 0 ) return 1 ; if ( ( n & ( n + 1 ) ) == 0 ) return n ; int pos = getPosOfRightmostSetBit ( ~ n ) ; return ( ( 1 << ( pos - 1 ) ) n ) ; } public static void Main ( String [ ] arg ) { int n = 21 ; Console . Write ( setRightmostUnsetBit ( n ) ) ; } }

Class/struct names: GFG
C# program:
using System ; class GFG { static int getFirstSetBitPos ( int n ) { return ( int ) ( Math . Log ( n & - n ) / Math . Log ( 2 ) ) + 1 ; } static int previousSmallerInteger ( int n ) { int pos = getFirstSetBitPos ( n ) ; return ( n & ~ ( 1 << ( pos - 1 ) ) ) ; } public static void Main ( ) { int n = 25 ; Console . WriteLine ( " Previous ▁ small ▁ Integer ▁ = " + previousSmallerInteger ( n ) ) ; } }

Class/struct names: GFG
C# program:
using System ; class GFG { static String areAllBitsSet ( int n ) { if ( n == 0 ) return " No " ; while ( n > 0 ) { if ( ( n & 1 ) == 0 ) return " No " ; n = n >> 1 ; } return " Yes " ; } static public void Main ( ) { int n = 7 ; Console . WriteLine ( areAllBitsSet ( n ) ) ; } }

Class/struct names: GFG
C# program:
using System ; class GFG { static String areAllBitsSet ( int n ) { if ( n == 0 ) return " No " ; if ( ( ( n + 1 ) & n ) == 0 ) return " Yes " ; return " No " ; } static public void Main ( ) { int n = 7 ; Console . WriteLine ( areAllBitsSet ( n ) ) ; } }

Class/struct names: GFG
C# program:
using System ; class GFG { static int getFirstSetBitPos ( int n ) { return ( ( int ) ( Math . Log ( n & - n ) / Math . Log ( 2 ) ) + 1 ) - 1 ; } static int nextGreaterWithOneMoreSetBit ( int n ) { int pos = getFirstSetBitPos ( ~ n ) ; if ( pos > - 1 ) return ( 1 << pos ) | n ; return ( ( n << 1 ) + 1 ) ; } public static void Main ( ) { int n = 10 ; Console . Write ( " Next ▁ greater ▁ integer ▁ = ▁ " + nextGreaterWithOneMoreSetBit ( n ) ) ; } }

Class/struct names: GFG
C# program:
using System ; class GFG { static int CountZeroBit ( int x ) { int count = 0 ; while ( x > 0 ) { if ( ( x & 1 ) == 0 ) count ++ ; x >>= 1 ; } return count ; } static int CountXORandSumEqual ( int x ) { int count = CountZeroBit ( x ) ; return ( 1 << count ) ; } static public void Main ( ) { int x = 10 ; Console . WriteLine ( CountXORandSumEqual ( x ) ) ; } }

Accumulator variables: count
Class/struct names: GFG
C# program:
using System ; class GFG { static int missingNumber ( int [ ] arr1 , int [ ] arr2 , int n ) { int mnum = 0 ; for ( int i = 0 ; i < n ; i ++ ) mnum = mnum ^ arr1 [ i ] ; for ( int i = 0 ; i < n - 1 ; i ++ ) mnum = mnum ^ arr2 [ i ] ; return mnum ; } public static void Main ( ) { int [ ] arr1 = { 4 , 8 , 1 , 3 , 7 } ; int [ ] arr2 = { 7 , 4 , 3 , 1 } ; int n = arr1 . Length ; Console . Write ( " Missing ▁ number ▁ = ▁ " + missingNumber ( arr1 , arr2 , n ) ) ; } }

Index/key variables: i
Accumulator variables: i
Iterator variables: i
Class/struct names: GFG
C# program:
using System ; class BitArray { int [ ] arr ; public BitArray ( int n ) { arr = new int [ ( int ) ( n >> 5 ) + 1 ] ; } bool get ( int pos ) { int index = ( pos >> 5 ) ; int bitNo = ( pos & 0x1F ) ; return ( arr [ index ] & ( 1 << bitNo ) ) != 0 ; } void set ( int pos ) { int index = ( pos >> 5 ) ; int bitNo = ( pos & 0x1F ) ; arr [ index ] |= ( 1 << bitNo ) ; } static void checkDuplicates ( int [ ] arr ) { BitArray ba = new BitArray ( 320000 ) ; for ( int i = 0 ; i < arr . Length ; i ++ ) { int num = arr [ i ] ; if ( ba . get ( num ) ) Console . Write ( num + " ▁ " ) ; else ba . set ( num ) ; } } public static void Main ( ) { int [ ] arr = { 1 , 5 , 1 , 10 , 12 , 10 } ; checkDuplicates ( arr ) ; } }

Index/key variables: i, index
Accumulator variables: i
Iterator variables: i
Class/struct names: BitArray
C# program:
using System ; class GFG { static int countValues ( int x ) { int count = 0 , n = 1 ; while ( x != 0 ) { if ( x % 2 == 0 ) count += n ; n *= 2 ; x /= 2 ; } return count ; } public static void Main ( ) { int x = 10 ; Console . Write ( countValues ( x ) ) ; } }

Accumulator variables: count, n, x
Class/struct names: GFG