dhyuti-n/xlcost-variable-roles huggingface dataset:
C# program:
using System ; class GFG { static readonly int N = 3 , M = 3 ; static bool check ( int [ , ] a , int [ , ] b ) { for ( int i = 1 ; i < N ; i ++ ) { for ( int j = 1 ; j < M ; j ++ ) { if ( a [ i , j ] != b [ i , j ] ) { a [ i , j ] ^= 1 ; a [ 0 , 0 ] ^= 1 ; a [ 0 , j ] ^= 1 ; a [ i , 0 ] ^= 1 ; } } } for ( int i = 0 ; i < N ; i ++ ) { for ( int j = 0 ; j < M ; j ++ ) { if ( a [ i , j ] != b [ i , j ] ) return false ; } } return true ; } public static void Main ( String [ ] args ) { int [ , ] a = { { 0 , 1 , 0 } , { 0 , 1 , 0 } , { 1 , 0 , 0 } } ; int [ , ] b = { { 1 , 0 , 0 } , { 1 , 0 , 0 } , { 1 , 0 , 0 } } ; if ( check ( a , b ) ) Console . Write ( " Yes " ) ; else Console . Write ( " No " ) ; } }

Accumulator variables: i, j
Iterator variables: i, j
Class/struct names: GFG
C# program:
using System ; class GFG { static int FindIndexKthBit ( int n , int k ) { int cnt = 0 ; int ind = 0 ; while ( n > 0 ) { if ( ( n & 1 ) != 0 ) cnt ++ ; if ( cnt == k ) return ind ; ind ++ ; n = n >> 1 ; } return - 1 ; } public static void Main ( ) { int n = 15 , k = 3 ; int ans = FindIndexKthBit ( n , k ) ; if ( ans != - 1 ) Console . WriteLine ( ans ) ; else Console . WriteLine ( " No ▁ k - th ▁ set ▁ bit " ) ; } }

Accumulator variables: cnt, ind
Class/struct names: GFG
C# program:
using System ; using System . Collections . Generic ; class GFG { static void hasEqualBlockFrequency ( int N ) { string S = Convert . ToString ( N , 2 ) ; HashSet < int > p = new HashSet < int > ( ) ; int c = 1 ; for ( int i = 0 ; i < S . Length - 1 ; i ++ ) { if ( S [ i ] == S [ i + 1 ] ) c += 1 ; else { p . Add ( c ) ; c = 1 ; } p . Add ( c ) ; } if ( p . Count == 1 ) Console . WriteLine ( " Yes " ) ; else Console . WriteLine ( " No " ) ; } static void Main ( ) { int N = 5 ; hasEqualBlockFrequency ( N ) ; } }

Index/key variables: i
Accumulator variables: c, i
Iterator variables: i
Class/struct names: GFG
C# program:
using System ; class GFG { static int minDistance ( int n1 , int n2 ) { int bitCount1 = ( int ) Math . Floor ( ( Math . Log ( n1 ) / Math . Log ( 2 ) ) ) + 1 ; int bitCount2 = ( int ) Math . Floor ( ( Math . Log ( n2 ) / Math . Log ( 2 ) ) ) + 1 ; int bitDiff = Math . Abs ( bitCount1 - bitCount2 ) ; int maxBitCount = Math . Max ( bitCount1 , bitCount2 ) ; if ( bitCount1 > bitCount2 ) { n2 = n2 * ( int ) Math . Pow ( 2 , bitDiff ) ; } else { n1 = n1 * ( int ) Math . Pow ( 2 , bitDiff ) ; } int xorValue = n1 ^ n2 ; int bitCountXorValue ; if ( xorValue == 0 ) bitCountXorValue = 1 ; else { bitCountXorValue = ( int ) Math . Floor ( ( Math . Log ( xorValue ) / Math . Log ( 2 ) ) ) + 1 ; } int disSimilarBitPosition = maxBitCount - bitCountXorValue ; int result = bitCount1 + bitCount2 - 2 * disSimilarBitPosition ; return result ; } public static void Main ( String [ ] args ) { int n1 = 12 , n2 = 5 ; Console . WriteLine ( minDistance ( n1 , n2 ) ) ; } }

Class/struct names: GFG
C# program:
using System ; class GFG { static int printMaxAfterRemoval ( String s ) { bool flag = false ; int n = s . Length ; for ( int i = 0 ; i < n ; i ++ ) { if ( s [ i ] == '0' && flag == false ) { flag = true ; continue ; } else Console . Write ( s [ i ] ) ; } return 0 ; } static void Main ( ) { String s = "1001" ; printMaxAfterRemoval ( s ) ; } }

Index/key variables: i
Accumulator variables: i
Iterator variables: i
Boolean variables: flag
Class/struct names: GFG
C# program:
using System ; class GFG { static int bitPos ( int n1 , int n2 ) { if ( n1 == n2 ) return 0 ; int bitCount1 = ( int ) Math . Floor ( Math . Log ( n1 ) / Math . Log ( 2 ) ) + 1 ; int bitCount2 = ( int ) Math . Floor ( Math . Log ( n2 ) / Math . Log ( 2 ) ) + 1 ; int bitDiff = Math . Abs ( bitCount1 - bitCount2 ) ; int maxBitCount = Math . Max ( bitCount1 , bitCount2 ) ; if ( bitCount1 > bitCount2 ) { n2 = n2 * ( int ) Math . Pow ( 2 , bitDiff ) ; } else { n1 = n1 * ( int ) Math . Pow ( 2 , bitDiff ) ; } int xorValue = n1 ^ n2 ; int bitCountXorValue = ( int ) Math . Floor ( Math . Log ( xorValue ) / Math . Log ( 2 ) ) + 1 ; int disSimilarBitPosition = maxBitCount - bitCountXorValue + 1 ; return disSimilarBitPosition ; } public static void Main ( ) { int n1 = 53 , n2 = 55 ; Console . Write ( bitPos ( n1 , n2 ) ) ; } }

Class/struct names: GFG
C# program:
using System ; public class GFG { static int countOddPair ( int [ ] A , int N ) { int count = 0 ; for ( int i = 0 ; i < N ; i ++ ) { if ( ( A [ i ] % 2 != 1 ) ) { count ++ ; } } int evenPairCount = count * ( count - 1 ) / 2 ; int totPairs = N * ( N - 1 ) / 2 ; return totPairs - evenPairCount ; } public static void Main ( ) { int [ ] A = { 5 , 6 , 2 , 8 } ; int N = A . Length ; Console . WriteLine ( countOddPair ( A , N ) ) ; } }

Index/key variables: i
Accumulator variables: count, i
Iterator variables: i
Class/struct names: GFG
C# program:
using System ; class GFG { static void ReplaceElements ( int [ ] arr , int n ) { if ( n <= 1 ) return ; int prev = arr [ 0 ] ; arr [ 0 ] = arr [ 0 ] ^ arr [ 1 ] ; for ( int i = 1 ; i < n - 1 ; i ++ ) { int curr = arr [ i ] ; arr [ i ] = prev ^ arr [ i + 1 ] ; prev = curr ; } arr [ n - 1 ] = prev ^ arr [ n - 1 ] ; } public static void Main ( ) { int [ ] arr = { 2 , 3 , 4 , 5 , 6 } ; int n = arr . Length ; ReplaceElements ( arr , n ) ; for ( int i = 0 ; i < n ; i ++ ) Console . Write ( arr [ i ] + " ▁ " ) ; } }

Index/key variables: i
Accumulator variables: i
Iterator variables: i
Class/struct names: GFG
C# program:
using System ; class GFG { static int luckiest_person ( int n ) { int len = ( int ) ( Math . Log ( n ) / Math . Log ( 2 ) ) + 1 ; int n2 = n ; for ( int i = 0 ; i < len ; i ++ ) { n2 = n2 ^ ( 1 << i ) ; } return Math . Abs ( n - n2 ) ; } public static void Main ( ) { int N = 3 ; int lucky_p = luckiest_person ( N ) ; Console . Write ( lucky_p ) ; } }

Accumulator variables: i
Iterator variables: i
Class/struct names: GFG
C# program:
using System ; class GFG { static int setBitNumber ( int n ) { n |= n >> 1 ; n |= n >> 2 ; n |= n >> 4 ; n |= n >> 8 ; n |= n >> 16 ; n = n + 1 ; return ( n >> 1 ) ; } static int luckiest_person ( int n ) { int nearestPower = setBitNumber ( n ) ; return 2 * ( n - nearestPower ) + 1 ; } public static void Main ( ) { int N = 8 ; int lucky_p = luckiest_person ( N ) ; Console . Write ( lucky_p ) ; } }

Accumulator variables: n
Class/struct names: GFG
C# program:
using System ; class GFG { static void maxTriplet ( int [ ] a , int n ) { Boolean [ ] f = new Boolean [ n ] ; for ( int i = 0 ; i < n ; ++ i ) f [ i ] = true ; int [ , ] bits = new int [ n , 33 ] ; for ( int i = 0 ; i < n ; ++ i ) { int num = a [ i ] ; int j = 32 ; while ( num > 0 ) { if ( num % 2 == 1 ) { bits [ i , j ] = 1 ; } j -- ; num >>= 1 ; } } long ans = 0 ; int cnt ; for ( int i = 0 ; i <= 32 ; ++ i ) { cnt = 0 ; for ( int j = 0 ; j < n ; ++ j ) { if ( bits [ j , i ] == 1 & f [ j ] ) { cnt ++ ; } } if ( cnt >= 3 ) { ans += ( long ) Math . Pow ( 2 , 32 - i ) ; for ( int j = 0 ; j < n ; ++ j ) { if ( bits [ j , i ] != 1 ) { f [ j ] = false ; } } } } cnt = 0 ; for ( int i = 0 ; i < n ; ++ i ) { if ( f [ i ] ) { cnt ++ ; } } long NumberOfTriplets = ( cnt * ( cnt - 1 ) * ( cnt - 2 ) ) / 6 ; Console . Write ( NumberOfTriplets + " ▁ " + ans ) ; } public static void Main ( String [ ] args ) { int [ ] a = { 4 , 11 , 10 , 15 , 26 } ; int n = a . Length ; maxTriplet ( a , n ) ; } }

Index/key variables: i, j, n
Accumulator variables: ans, cnt, j
Iterator variables: i, j
Class/struct names: GFG
C# program:
using System ; class GFG { static int OR ( int [ ] a , int n ) { int ans = a [ 0 ] ; int i ; for ( i = 1 ; i < n ; i ++ ) { ans |= a [ i ] ; } return ans ; } public static void Main ( ) { int [ ] a = { 1 , 4 , 6 } ; int n = a . Length ; Console . Write ( OR ( a , n ) ) ; } }

Index/key variables: i
Accumulator variables: ans, i
Iterator variables: i
Class/struct names: GFG
C# program:
using System ; class GFG { static int bit ( int n ) { int count = 0 ; while ( n > 0 ) { count ++ ; n = n & ( n - 1 ) ; } return count ; } static int maxSumOfBits ( int [ ] arr , int n ) { for ( int i = 0 ; i < n ; i ++ ) { arr [ i ] = bit ( arr [ i ] ) ; } int incl = arr [ 0 ] ; int excl = 0 ; int excl_new ; for ( int i = 1 ; i < n ; i ++ ) { excl_new = ( incl > excl ) ? incl : excl ; incl = excl + arr [ i ] ; excl = excl_new ; } return ( ( incl > excl ) ? incl : excl ) ; } public static void Main ( ) { int [ ] arr = { 1 , 2 , 4 , 5 , 6 , 7 , 20 , 25 } ; int n = arr . Length ; Console . WriteLine ( maxSumOfBits ( arr , n ) ) ; } }

Index/key variables: i
Accumulator variables: count, i
Iterator variables: i
Class/struct names: GFG
C# program:
class GFG { static char increment ( char i ) { int i1 = - ( ~ ( int ) ( i ) ) ; return ( char ) ( i1 ) ; } static void Main ( ) { char n = ' a ' ; System . Console . WriteLine ( increment ( n ) ) ; } }

Class/struct names: GFG
C# program:
using System ; class GFG { static int findOddPair ( int [ ] A , int N ) { int i , count = 0 ; for ( i = 0 ; i < N ; i ++ ) { if ( A [ i ] % 2 == 0 ) count ++ ; } return count * ( N - count ) ; } public static void Main ( ) { int [ ] a = { 5 , 4 , 7 , 2 , 1 } ; int n = a . Length ; Console . Write ( findOddPair ( a , n ) ) ; } }

Index/key variables: i
Accumulator variables: count, i
Iterator variables: i
Class/struct names: GFG
C# program:
using System ; class GFG { static int MSBPosition ( long N ) { int msb_p = - 1 ; while ( N > 0 ) { N = N >> 1 ; msb_p ++ ; } return msb_p ; } static long findBitwiseOR ( long L , long R ) { long res = 0 ; int msb_p1 = MSBPosition ( L ) ; int msb_p2 = MSBPosition ( R ) ; while ( msb_p1 == msb_p2 ) { long res_val = ( 1 << msb_p1 ) ; res += res_val ; L -= res_val ; R -= res_val ; msb_p1 = MSBPosition ( L ) ; msb_p2 = MSBPosition ( R ) ; } msb_p1 = Math . Max ( msb_p1 , msb_p2 ) ; for ( int i = msb_p1 ; i >= 0 ; i -- ) { long res_val = ( 1 << i ) ; res += res_val ; } return res ; } public static void Main ( ) { int L = 12 , R = 18 ; Console . WriteLine ( findBitwiseOR ( L , R ) ) ; } }

Accumulator variables: L, R, i, msb_p, res
Iterator variables: i
Class/struct names: GFG
C# program:
using System ; class GFG { public static long maxOR ( long [ ] arr , int n , int k , int x ) { long [ ] preSum = new long [ n + 1 ] ; long [ ] suffSum = new long [ n + 1 ] ; long res = 0 , pow = 1 ; for ( int i = 0 ; i < k ; i ++ ) pow *= x ; preSum [ 0 ] = 0 ; for ( int i = 0 ; i < n ; i ++ ) preSum [ i + 1 ] = preSum [ i ] | arr [ i ] ; suffSum [ n ] = 0 ; for ( int i = n - 1 ; i >= 0 ; i -- ) suffSum [ i ] = suffSum [ i + 1 ] | arr [ i ] ; res = 0 ; for ( int i = 0 ; i < n ; i ++ ) res = Math . Max ( res , preSum [ i ] | ( arr [ i ] * pow ) suffSum [ i + 1 ] ) ; return res ; } public static void Main ( ) { long [ ] arr = { 1 , 2 , 4 , 8 } ; int n = 4 ; int k = 2 , x = 3 ; long ans = maxOR ( arr , n , k , x ) ; Console . Write ( ans ) ; } }

Index/key variables: i, n
Accumulator variables: i, pow
Iterator variables: i
Class/struct names: GFG
C# program:
using System ; class GFG { static int turnOnK ( int n , int k ) { if ( k <= 0 ) return n ; return ( n | ( 1 << ( k - 1 ) ) ) ; } public static void Main ( ) { int n = 4 ; int k = 2 ; Console . Write ( turnOnK ( n , k ) ) ; } }

Class/struct names: GFG
C# program:
using System ; public class GFG { static int minSum ( int [ ] a , int n ) { Array . Sort ( a ) ; int num1 = 0 ; int num2 = 0 ; for ( int i = 0 ; i < n ; i ++ ) { if ( i % 2 == 0 ) num1 = num1 * 10 + a [ i ] ; else num2 = num2 * 10 + a [ i ] ; } return num2 + num1 ; } static public void Main ( ) { int [ ] arr = { 5 , 3 , 0 , 7 , 4 } ; int n = arr . Length ; Console . WriteLine ( " The ▁ required ▁ sum ▁ is ▁ " + minSum ( arr , n ) ) ; } }

Index/key variables: i
Accumulator variables: i
Iterator variables: i
Class/struct names: GFG
C# program:
using System ; class GFG { static void printKthBit ( long n , long k ) { Console . WriteLine ( ( n & ( 1 << ( k - 1 ) ) ) >> ( k - 1 ) ) ; } public static void Main ( ) { long n = 13 , k = 2 ; printKthBit ( n , k ) ; } }

Class/struct names: GFG
C# program:
using System ; class GFG { static int N = 100010 ; public class Edge { public int u , v ; public Edge ( int u , int v ) { this . u = u ; this . v = v ; } } static int [ ] id = new int [ N ] ; static int [ ] sz = new int [ N ] ; static int Root ( int idx ) { int i = idx ; while ( i != id [ i ] ) { id [ i ] = id [ id [ i ] ] ; i = id [ i ] ; } return i ; } static void Union ( int a , int b ) { int i = Root ( a ) , j = Root ( b ) ; if ( i != j ) { if ( sz [ i ] >= sz [ j ] ) { id [ j ] = i ; sz [ i ] += sz [ j ] ; sz [ j ] = 0 ; } else { id [ i ] = j ; sz [ j ] += sz [ i ] ; sz [ i ] = 0 ; } } } static void UnionUtil ( Edge [ ] e , int [ ] W , int q ) { for ( int i = 0 ; i < q ; i ++ ) { int u , v ; u = e [ i ] . u ; v = e [ i ] . v ; u -- ; v -- ; if ( W [ u ] % 2 == 0 && W [ v ] % 2 == 0 ) Union ( u , v ) ; } } static int findMax ( int n , int [ ] W ) { int maxi = 0 ; for ( int i = 1 ; i < n ; i ++ ) if ( W [ i ] % 2 == 0 ) maxi = Math . Max ( maxi , sz [ i ] ) ; return maxi ; } public static void Main ( String [ ] args ) { int [ ] W = { 1 , 2 , 6 , 4 , 2 , 0 , 3 } ; int n = W . Length ; for ( int i = 0 ; i < n ; i ++ ) { id [ i ] = i ; sz [ i ] = 1 ; } Edge [ ] e = { new Edge ( 1 , 2 ) , new Edge ( 1 , 3 ) , new Edge ( 2 , 4 ) , new Edge ( 2 , 5 ) , new Edge ( 4 , 6 ) , new Edge ( 6 , 7 ) } ; int q = e . Length ; UnionUtil ( e , W , q ) ; int maxi = findMax ( n , W ) ; Console . Write ( " Maximum ▁ size ▁ of ▁ the ▁ subtree ▁ with ▁ " ) ; Console . WriteLine ( " even ▁ weighted ▁ nodes ▁ = ▁ { 0 } STRNEWLINE " , maxi ) ; } }

Index/key variables: N, i, j, u, v
Accumulator variables: i, u, v
Iterator variables: i
Class/struct names: Edge, GFG
C# program:
using System ; class GFG { static int countSetBits ( int n ) { int count = 0 ; while ( n > 0 ) { count += n & 1 ; n >>= 1 ; } return count ; } static int countOfOddsPascal ( int n ) { int c = countSetBits ( n ) ; return ( int ) Math . Pow ( 2 , c ) ; } public static void Main ( ) { int n = 20 ; Console . WriteLine ( countOfOddsPascal ( n ) ) ; } }

Accumulator variables: count
Class/struct names: GFG
C# program:
using System ; class GFG { static void ansQueries ( int [ ] prefeven , int [ ] prefodd , int l , int r ) { if ( ( r - l + 1 ) % 2 == 0 ) Console . WriteLine ( "0" ) ; else { if ( l % 2 == 0 ) Console . WriteLine ( prefeven [ r ] ^ prefeven [ l - 1 ] ) ; else Console . WriteLine ( prefodd [ r ] ^ prefodd [ l - 1 ] ) ; } } static void wrapper ( int [ ] arr , int n , int [ ] l , int [ ] r , int q ) { int [ ] prefodd = new int [ 100 ] ; int [ ] prefeven = new int [ 100 ] ; for ( int i = 1 ; i <= n ; i ++ ) { if ( ( i ) % 2 == 0 ) { prefeven [ i ] = arr [ i - 1 ] ^ prefeven [ i - 1 ] ; prefodd [ i ] = prefodd [ i - 1 ] ; } else { prefeven [ i ] = prefeven [ i - 1 ] ; prefodd [ i ] = prefodd [ i - 1 ] ^ arr [ i - 1 ] ; } } int j = 0 ; while ( j != q ) { ansQueries ( prefeven , prefodd , l [ j ] , r [ j ] ) ; j ++ ; } } public static void Main ( ) { int [ ] arr = { 1 , 2 , 3 , 4 , 5 } ; int n = arr . Length ; int [ ] l = { 1 , 1 , 2 } ; int [ ] r = { 2 , 3 , 4 } ; int q = l . Length ; wrapper ( arr , n , l , r , q ) ; } }

Index/key variables: i, j, r
Accumulator variables: i, j
Iterator variables: i
Class/struct names: GFG
C# program:
using System ; class GFG { static int solve ( int [ ] p , int n ) { int G = 0 ; for ( int i = 0 ; i < n ; i ++ ) { if ( p [ i ] % 2 != 0 ) G ^= ( p [ i ] + 1 ) ; G ^= ( p [ i ] - 1 ) ; } return G ; } public static void Main ( ) { int n = 3 ; int [ ] p = { 32 , 49 , 58 } ; int res = solve ( p , n ) ; Console . WriteLine ( " Player ▁ 2 ▁ wins " ) ; Console . WriteLine ( " Player ▁ 1 ▁ wins " ) ; } }

Index/key variables: i
Accumulator variables: G, i
Iterator variables: i
Class/struct names: GFG
C# program:
using System ; public class GfG { static int checkBit ( int pattern , int [ ] arr , int n ) { int count = 0 ; for ( int i = 0 ; i < n ; i ++ ) if ( ( pattern & arr [ i ] ) == pattern ) count ++ ; return count ; } static int maxAND ( int [ ] arr , int n ) { int res = 0 , count ; for ( int bit = 31 ; bit >= 0 ; bit -- ) { count = checkBit ( res | ( 1 << bit ) , arr , n ) ; if ( count >= 2 ) res |= ( 1 << bit ) ; } 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
Accumulator variables: bit, count, i, res
Iterator variables: bit, i
Class/struct names: GfG
C# program:
using System ; class GFG { public static int findMiniFlip ( int [ ] nums ) { int n = nums . Length ; String s = " " ; for ( int i = 0 ; i < n ; i ++ ) s += nums [ i ] ; long num = Convert . ToInt32 ( s , 2 ) ; int minXor = n ; long mask = ( 1 << ( n - 1 ) ) ; while ( n - 1 > 0 ) { long temp = ( num ^ mask ) ; minXor = Math . Min ( minXor , countones ( temp ) ) ; n -- ; mask = ( mask | ( 1 << n - 1 ) ) ; } return minXor ; } public static int countones ( long n ) { int c = 0 ; while ( n > 0 ) { n = n & ( n - 1 ) ; c ++ ; } return c ; } public static void Main ( String [ ] args ) { int [ ] nums = { 1 , 0 , 1 , 1 , 0 , 0 , 0 } ; int n = findMiniFlip ( nums ) ; Console . WriteLine ( n ) ; } }

Index/key variables: i
Accumulator variables: c, i, n, s
Iterator variables: i
Class/struct names: GFG
C# program:
using System ; using System . Collections . Generic ; class GFG { public static int convertStringToInt ( String s ) { int ans = 0 ; for ( int i = 0 ; i < s . Length ; i ++ ) { if ( s [ i ] == '1' ) ans += 1 << i ; } return ans ; } public static int getNthNumber ( int n ) { Queue < String > q = new Queue < String > ( ) ; if ( n == 1 ) return 1 ; n = n - 1 ; q . Enqueue ( "11" ) ; while ( n -- > 0 ) { String curr = q . Dequeue ( ) ; if ( n == 0 ) return convertStringToInt ( curr ) ; int len = curr . Length ; if ( len % 2 == 0 ) { q . Enqueue ( curr . Substring ( 0 , len / 2 ) + "0" + curr . Substring ( len / 2 ) ) ; q . Enqueue ( curr . Substring ( 0 , len / 2 ) + "1" + curr . Substring ( len / 2 ) ) ; } else { char midChar = curr [ len / 2 ] ; q . Enqueue ( curr . Substring ( 0 , len / 2 ) + midChar + curr . Substring ( len / 2 ) ) ; } } return - 1 ; } public static void Main ( String [ ] args ) { int n = 9 ; Console . WriteLine ( getNthNumber ( n ) ) ; } }

Index/key variables: i
Accumulator variables: ans, i, n
Iterator variables: i
Class/struct names: GFG
C# program:
using System ; class GFG { static byte longSize = 8 ; static int ULL_SIZE = 8 * longSize ; static bool bit_anagram_check ( long a ) { return ( BitCount ( ( int ) a ) == ( ULL_SIZE >> 1 ) ) ; } static int BitCount ( int n ) { int count = 0 ; while ( n != 0 ) { count ++ ; n &= ( n - 1 ) ; } return count ; } public static void Main ( String [ ] args ) { long a = 4294967295L ; Console . WriteLine ( bit_anagram_check ( a ) ) ; } }

Accumulator variables: count, n
Class/struct names: GFG
C# program:
using System ; public class main { static int findSum ( int n ) { int sum = 0 ; for ( int i = 1 ; 1 << i < n ; i ++ ) { for ( int j = 0 ; j < i ; j ++ ) { int num = ( 1 << i ) + ( 1 << j ) ; if ( num <= n ) sum += num ; } } return sum ; } public static void Main ( String [ ] args ) { int n = 10 ; Console . WriteLine ( findSum ( n ) ) ; } }

Accumulator variables: i, j, sum
Iterator variables: i, j
Class/struct names: main
C# program:
using System ; class GFG { static int posOfRightMostDiffBit ( int m , int n ) { return ( int ) Math . Floor ( Math . Log10 ( Math . Pow ( m ^ n , 2 ) ) ) + 2 ; } public static void Main ( String [ ] args ) { int m = 52 , n = 4 ; Console . Write ( " Position ▁ = ▁ " + posOfRightMostDiffBit ( m , n ) ) ; } }

Class/struct names: GFG
C# program:
using System ; class GFG { static int setKthBit ( int n , int k ) { return ( ( 1 << k ) n ) ; } public static void Main ( ) { int n = 10 , k = 2 ; Console . Write ( " Kth ▁ bit ▁ set ▁ number ▁ = ▁ " + setKthBit ( n , k ) ) ; } }

Class/struct names: GFG
C# program:
using System ; class GFG { static void reverseArray ( int [ ] arr , int n ) { int x = ( int . MinValue / int . MaxValue ) ; for ( int i = 0 ; i < n / 2 ; i ++ ) swap ( arr , i , n + ( x * i ) + x ) ; } static int [ ] swap ( int [ ] arr , int i , int j ) { int temp = arr [ i ] ; arr [ i ] = arr [ j ] ; arr [ j ] = temp ; return arr ; } public static void Main ( ) { int [ ] arr = { 5 , 3 , 7 , 2 , 1 , 6 } ; int n = arr . Length ; reverseArray ( arr , n ) ; for ( int i = 0 ; i < n ; i ++ ) Console . Write ( arr [ i ] + " ▁ " ) ; } }

Index/key variables: i, j
Accumulator variables: i
Iterator variables: i
Class/struct names: GFG
C# program:
using System ; class GFG { static void reverseArray ( int [ ] arr , int n ) { for ( int i = 0 ; i < n / 2 ; i ++ ) { swap ( arr , i , ( n + ~ i + 1 ) + ~ 1 + 1 ) ; } } static int [ ] swap ( int [ ] arr , int i , int j ) { int temp = arr [ i ] ; arr [ i ] = arr [ j ] ; arr [ j ] = temp ; return arr ; } public static void Main ( String [ ] args ) { int [ ] arr = { 5 , 3 , 7 , 2 , 1 , 6 } ; int n = arr . Length ; reverseArray ( arr , n ) ; for ( int i = 0 ; i < n ; i ++ ) { Console . Write ( arr [ i ] + " ▁ " ) ; } } }

Index/key variables: i, j
Accumulator variables: i
Iterator variables: i
Class/struct names: GFG
C# program:
using System ; class Xor { static int maxXORInRange ( int L , int R ) { int LXR = L ^ R ; int msbPos = 0 ; while ( LXR > 0 ) { msbPos ++ ; LXR >>= 1 ; } int maxXOR = 0 ; int two = 1 ; while ( msbPos -- > 0 ) { maxXOR += two ; two <<= 1 ; } return maxXOR ; } public static void Main ( ) { int L = 8 ; int R = 20 ; Console . WriteLine ( maxXORInRange ( L , R ) ) ; } }

Accumulator variables: maxXOR, msbPos
Class/struct names: Xor
C# program:
using System ; class GFG { static int CountZeroBit ( int n ) { int count = 0 ; while ( n > 0 ) { if ( n % 2 != 0 ) count ++ ; n >>= 1 ; } return count ; } static int CountORandSumEqual ( int N ) { int count = CountZeroBit ( N ) ; return ( 1 << count ) ; } public static void Main ( ) { int N = 10 ; Console . Write ( CountORandSumEqual ( N ) ) ; } }

Accumulator variables: count
Class/struct names: GFG
C# program:
using System ; class GFG { static int countNumbers ( int n ) { int k = 0 ; int count = 0 ; while ( n > 0 ) { if ( ( n & 1 ) == 0 ) count += ( int ) ( Math . Pow ( 2 , k ) ) ; k += 1 ; n >>= 1 ; } return count ; } public static void Main ( ) { int n = 11 ; Console . WriteLine ( countNumbers ( n ) ) ; } }

Accumulator variables: count, k
Class/struct names: GFG
C# program:
using System ; using System . Collections . Generic ; class GFG { static int xorPairCount ( int [ ] arr , int n , int x ) { HashSet < int > s = new HashSet < int > ( ) ; for ( int i = 0 ; i < n ; i ++ ) { if ( s . Contains ( x ^ arr [ i ] ) ) { result ++ ; } s . Add ( arr [ i ] ) ; } return result ; } public static void Main ( ) { int [ ] arr = { 5 , 4 , 10 , 15 , 7 , 6 } ; int n = arr . Length ; int x = 5 ; Console . WriteLine ( " Count ▁ of ▁ pairs ▁ with ▁ given ▁ XOR ▁ = ▁ " + xorPairCount ( arr , n , x ) ) ; } }

Index/key variables: i
Accumulator variables: i, result
Iterator variables: i
Class/struct names: GFG
C# program:
using System ; class GFG { static bool isMultipleOf4 ( int n ) { if ( n == 1 ) return false ; int XOR = 0 ; for ( int i = 1 ; i <= n ; i ++ ) XOR = XOR ^ i ; return ( XOR == n ) ; } public static void Main ( ) { for ( int n = 0 ; n <= 42 ; n ++ ) { if ( isMultipleOf4 ( n ) ) Console . Write ( n + " ▁ " ) ; } } }

Accumulator variables: i, n
Iterator variables: i, n
Class/struct names: GFG
C# program:
using System ; class GFG { static bool isMultipleOf4 ( int n ) { if ( n == 0 ) return true ; return ( ( ( n >> 2 ) << 2 ) == n ) ; } static void Main ( ) { for ( int n = 0 ; n <= 42 ; n ++ ) if ( isMultipleOf4 ( n ) ) Console . Write ( n + " ▁ " ) ; } }

Accumulator variables: n
Iterator variables: n
Class/struct names: GFG