dhyuti-n/xlcost-variable-roles huggingface dataset:
C# program:
using System ; public class GFG { static void printORSumforEachElement ( int [ ] arr , int N ) { for ( int i = 0 ; i < N ; i ++ ) { int req_sum = 0 ; for ( int j = 0 ; j < N ; j ++ ) { req_sum += ( arr [ i ] arr [ j ] ) ; } Console . Write ( req_sum + " ▁ " ) ; } } public static void Main ( String [ ] args ) { int [ ] arr = { 1 , 2 , 3 , 4 } ; int N = arr . Length ; printORSumforEachElement ( arr , N ) ; } }

Index/key variables: i, j
Accumulator variables: i, j, req_sum
Iterator variables: i, j
Class/struct names: GFG
C# program:
using System ; class GFG { static void Bitwise_OR_sum_i ( int [ ] arr1 , int [ ] arr2 , int M , int N ) { int [ ] frequency = new int [ 32 ] ; for ( int i = 0 ; i < 32 ; i ++ ) { frequency [ i ] = 0 ; } for ( int i = 0 ; i < N ; i ++ ) { int bit_position = 0 ; int num = arr1 [ i ] ; while ( num != 0 ) { if ( ( num & 1 ) != 0 ) { frequency [ bit_position ] += 1 ; } bit_position += 1 ; num >>= 1 ; } } for ( int i = 0 ; i < M ; i ++ ) { int num = arr2 [ i ] ; int value_at_that_bit = 1 ; int bitwise_OR_sum = 0 ; for ( int bit_position = 0 ; bit_position < 32 ; bit_position ++ ) { if ( ( num & 1 ) != 0 ) { bitwise_OR_sum += N * value_at_that_bit ; } else { bitwise_OR_sum += frequency [ bit_position ] * value_at_that_bit ; } num >>= 1 ; value_at_that_bit <<= 1 ; } Console . Write ( bitwise_OR_sum + " ▁ " ) ; } return ; } public static void Main ( ) { int [ ] arr1 = { 1 , 2 , 3 } ; int [ ] arr2 = { 1 , 2 , 3 } ; int N = arr1 . Length ; int M = arr2 . Length ; Bitwise_OR_sum_i ( arr1 , arr2 , M , N ) ; } }

Index/key variables: bit_position, i
Accumulator variables: bit_position, bitwise_OR_sum, i
Iterator variables: bit_position, i
Class/struct names: GFG
C# program:
using System ; class GFG { static void countPairs ( int [ ] arr , int k , int size ) { int count = 0 , x ; for ( int i = 0 ; i < size - 1 ; i ++ ) { for ( int j = i + 1 ; j < size ; j ++ ) { x = arr [ i ] | arr [ j ] ; if ( x == k ) count ++ ; } } Console . WriteLine ( count ) ; } public static void Main ( ) { int [ ] arr = { 2 , 38 , 44 , 29 , 62 } ; int K = 46 ; int N = arr . Length ; countPairs ( arr , K , N ) ; } }

Index/key variables: i, j
Accumulator variables: count, i, j
Iterator variables: i, j
Class/struct names: GFG
C# program:
using System ; using System . Collections . Generic ; class GFG { public class pair { public int first , second ; public pair ( int first , int second ) { this . first = first ; this . second = second ; } } static List < pair > [ ] adj = new List < pair > [ 100005 ] ; static int [ ] visited = new int [ 100005 ] ; static int ans = 0 ; static void dfs ( int node , int xorr , int k ) { visited [ node ] = 1 ; if ( node != 1 && xorr == k ) ans ++ ; foreach ( pair x in adj [ node ] ) { if ( visited [ x . first ] != 1 ) { int xorr1 = xorr ^ x . second ; dfs ( x . first , xorr1 , k ) ; } } } static void countNodes ( int N , int K , int R , int [ , ] edges ) { for ( int i = 0 ; i < N - 1 ; i ++ ) { int u = edges [ i , 0 ] ; int v = edges [ i , 1 ] , w = edges [ i , 2 ] ; adj [ u ] . Add ( new pair ( v , w ) ) ; adj [ v ] . Add ( new pair ( u , w ) ) ; } dfs ( R , 0 , K ) ; Console . Write ( ans + " STRNEWLINE " ) ; } public static void Main ( String [ ] args ) { int K = 0 , R = 1 ; for ( int i = 0 ; i < adj . Length ; i ++ ) adj [ i ] = new List < pair > ( ) ; int [ , ] edges = { { 1 , 2 , 3 } , { 1 , 3 , 1 } , { 2 , 4 , 3 } , { 2 , 5 , 4 } , { 3 , 6 , 1 } , { 3 , 7 , 2 } } ; int N = edges . GetLength ( 0 ) ; countNodes ( N , K , R , edges ) ; } }

Index/key variables: i, node, u, v
Accumulator variables: ans, i
Iterator variables: i, x
Class/struct names: GFG, pair
C# program:
using System ; class GFG { static void findMinXORSubarray ( int [ ] arr , int n , int k ) { if ( n < k ) return ; int res_index = 0 ; int curr_xor = 0 ; for ( int i = 0 ; i < k ; i ++ ) curr_xor ^= arr [ i ] ; int min_xor = curr_xor ; for ( int i = k ; i < n ; i ++ ) { curr_xor ^= ( arr [ i ] ^ arr [ i - k ] ) ; if ( curr_xor < min_xor ) { min_xor = curr_xor ; res_index = ( i - k + 1 ) ; } } Console . WriteLine ( min_xor ) ; } public static void Main ( String [ ] args ) { int [ ] arr = { 3 , 7 , 90 , 20 , 10 , 50 , 40 } ; int k = 3 ; int n = arr . Length ; findMinXORSubarray ( arr , n , k ) ; } }

Index/key variables: i
Accumulator variables: curr_xor, i
Iterator variables: i
Class/struct names: GFG
C# program:
using System ; class GFG { static int findmax ( int [ ] arr , int n , int k ) { int trav , i ; int c = 0 , maximum = 0 ; for ( i = 0 ; i < n - k + 1 ; i ++ ) { trav = i - 1 ; c = 0 ; while ( trav >= 0 && arr [ trav ] == 1 ) { trav -- ; c ++ ; } trav = i + k ; while ( trav < n && arr [ trav ] == 1 ) { trav ++ ; c ++ ; } c += k ; if ( c > maximum ) maximum = c ; } return maximum ; } public static void Main ( ) { int k = 3 ; int [ ] arr = { 0 , 0 , 1 , 1 , 0 , 0 , 0 , 0 } ; int n = arr . Length ; int ans = findmax ( arr , n , k ) ; Console . WriteLine ( ans ) ; } }

Index/key variables: trav
Accumulator variables: c, i, trav
Iterator variables: i
Class/struct names: GFG
C# program:
using System ; using System . Collections . Generic ; class GFG { static int height ( int N ) { return ( int ) Math . Ceiling ( Math . Log ( N + 1 ) / Math . Log ( 2 ) ) - 1 ; } static void findLeafNodes ( int [ ] arr , int n ) { int h = height ( n ) ; List < int > arrlist = new List < int > ( ) ; for ( int i = n - 1 ; i >= 0 ; i -- ) { if ( height ( i + 1 ) == h ) { arrlist . Add ( arr [ i ] ) ; } else if ( height ( i + 1 ) == h - 1 && n <= ( ( 2 * i ) + 1 ) ) { arrlist . Add ( arr [ i ] ) ; } else { break ; } } printLeafNodes ( arrlist ) ; } static void printLeafNodes ( List < int > arrlist ) { for ( int i = arrlist . Count - 1 ; i >= 0 ; i -- ) { Console . Write ( arrlist [ i ] + " ▁ " ) ; } } public static void Main ( String [ ] args ) { int [ ] arr = { 1 , 2 , 3 , 4 , 5 , 6 , 7 , 8 , 9 , 10 } ; findLeafNodes ( arr , arr . Length ) ; } }

Index/key variables: i
Accumulator variables: i
Iterator variables: i
Class/struct names: GFG
C# program:
using System ; using System . Collections . Generic ; class GFG { static int powerOfTwo ( int [ ] a , int n ) { Dictionary < int , int > mp = new Dictionary < int , int > ( ) ; for ( int i = 0 ; i < n ; i ++ ) { if ( mp . ContainsKey ( a [ i ] ) ) { mp [ a [ i ] ] = mp [ a [ i ] ] + 1 ; } else { mp . Add ( a [ i ] , 1 ) ; } } int count = 0 ; for ( int i = 0 ; i < n ; i ++ ) { bool f = false ; for ( int j = 0 ; j < 31 ; j ++ ) { int s = ( 1 << j ) - a [ i ] ; if ( mp . ContainsKey ( s ) && ( mp [ s ] > 1 || mp [ s ] == 1 && s != a [ i ] ) ) f = true ; } if ( f == false ) count ++ ; } return count ; } public static void Main ( String [ ] args ) { int [ ] a = { 6 , 2 , 11 } ; int n = a . Length ; Console . Write ( powerOfTwo ( a , n ) ) ; } }

Index/key variables: i, s
Accumulator variables: count, i, j
Iterator variables: i, j
Boolean variables: f
Class/struct names: GFG
C# program:
using System ; class GFG { static void findArray ( int n , int a , int b , int c ) { int [ ] arr = new int [ n + 1 ] ; for ( int bit = 30 ; bit >= 0 ; bit -- ) { int set = a & ( 1 << bit ) ; if ( set != 0 ) { for ( int i = 0 ; i < n ; i ++ ) arr [ i ] |= set ; } else { if ( ( b & ( 1 << bit ) ) != 0 ) { arr [ 0 ] |= ( 1 << bit ) ; if ( ( c & ( 1 << bit ) ) == 0 ) { arr [ 1 ] |= ( 1 << bit ) ; } } } } int aa = int . MaxValue , bb = 0 , cc = 0 ; for ( int i = 0 ; i < n ; i ++ ) { aa &= arr [ i ] ; bb |= arr [ i ] ; cc ^= arr [ i ] ; } if ( a == aa && b == bb && c == cc ) { for ( int i = 0 ; i < n ; i ++ ) Console . Write ( arr [ i ] + " ▁ " ) ; } else Console . WriteLine ( " - 1" ) ; } public static void Main ( String [ ] args ) { int n = 3 , a = 4 , b = 6 , c = 6 ; findArray ( n , a , b , c ) ; } }

Index/key variables: i
Accumulator variables: aa, bb, bit, cc, i
Iterator variables: bit, i
Class/struct names: GFG
C# program:
using System ; class GFG { static int maxAndXor ( int [ ] arr , int n ) { int ans = 9999999 ; Array . Sort ( arr ) ; for ( int i = 0 ; i < n - 1 ; i ++ ) { ans = Math . Min ( ans , arr [ i ] ^ arr [ i + 1 ] ) ; } return ans ; } public static void Main ( ) { int [ ] arr = new int [ ] { 1 , 2 , 3 , 4 , 5 } ; int N = arr . Length ; Console . Write ( maxAndXor ( arr , N ) ) ; } }

Index/key variables: i
Accumulator variables: i
Iterator variables: i
Class/struct names: GFG
C# program:
using System ; class GFG { static int countSubarray ( int [ ] arr , int K , int N ) { if ( K % 2 != 0 ) return 0 ; if ( N < K ) return 0 ; int start = 0 ; int i = 0 ; int count = 0 ; int currXor = arr [ i ++ ] ; while ( i < K ) { currXor ^= arr [ i ] ; i ++ ; } if ( currXor == 0 ) count ++ ; currXor ^= arr [ start ++ ] ; while ( i < N ) { currXor ^= arr [ i ] ; i ++ ; if ( currXor == 0 ) count ++ ; currXor ^= arr [ start ++ ] ; } return count ; } public static void Main ( ) { int [ ] arr = { 2 , 4 , 4 , 2 , 2 , 4 } ; int K = 4 ; int N = arr . Length ; Console . Write ( countSubarray ( arr , K , N ) ) ; } }

Index/key variables: i
Accumulator variables: count, currXor, i, start
Class/struct names: GFG
C# program:
using System ; class GFG { static int even , odd ; static void keep_count ( int [ ] arr , int N ) { int count ; for ( int i = 0 ; i < N ; i ++ ) { count = 0 ; while ( arr [ i ] != 0 ) { arr [ i ] = ( arr [ i ] - 1 ) & arr [ i ] ; count ++ ; } if ( count % 2 == 0 ) even ++ ; else odd ++ ; } return ; } static void solveQueries ( int [ ] arr , int n , int [ ] q , int m ) { even = 0 ; odd = 0 ; keep_count ( arr , n ) ; for ( int i = 0 ; i < m ; i ++ ) { int X = q [ i ] ; int count = 0 ; while ( X != 0 ) { X = ( X - 1 ) & X ; count ++ ; } if ( count % 2 == 0 ) { Console . Write ( even + " ▁ " + odd + " STRNEWLINE " ) ; } else { Console . Write ( odd + " ▁ " + even + " STRNEWLINE " ) ; } } } public static void Main ( ) { int [ ] arr = { 2 , 7 , 4 , 5 , 3 } ; int n = arr . Length ; int [ ] q = { 3 , 4 , 12 , 6 } ; int m = q . Length ; solveQueries ( arr , n , q , m ) ; } }

Index/key variables: i
Accumulator variables: count, even, i, odd
Iterator variables: i
Class/struct names: GFG
C# program:
using System ; class GFG { static int [ ] pref = new int [ 100001 ] ; static int isEvenParity ( int num ) { int parity = 0 ; int x = num ; while ( x != 0 ) { if ( ( x & 1 ) == 1 ) parity ++ ; x = x >> 1 ; } if ( parity % 2 == 0 ) return num ; else return 0 ; } static void preCompute ( ) { for ( int i = 1 ; i < 100001 ; i ++ ) { pref [ i ] = pref [ i - 1 ] + isEvenParity ( i ) ; } } static void printSum ( int L , int R ) { Console . WriteLine ( pref [ R ] - pref [ L - 1 ] ) ; } static void printSum ( int [ , ] arr , int Q ) { preCompute ( ) ; for ( int i = 0 ; i < Q ; i ++ ) { printSum ( arr [ i , 0 ] , arr [ i , 1 ] ) ; } } public static void Main ( ) { int N = 2 ; int [ , ] Q = { { 1 , 10 } , { 121 , 211 } } ; printSum ( Q , N ) ; } }

Index/key variables: R, i
Accumulator variables: i, parity
Iterator variables: i
Class/struct names: GFG
C# program:
using System ; using System . Linq ; class GFG { static int findLargestNumber ( int [ ] arr ) { int k = arr . Max ( ) ; int [ ] m = new int [ k + 1 ] ; foreach ( int n in arr ) ++ m [ n ] ; for ( int n = arr . Length - 1 ; n > 0 ; -- n ) { if ( n == m [ n ] ) return n ; } return - 1 ; } public static void Main ( String [ ] args ) { int [ ] arr = { 3 , 2 , 5 , 2 , 4 , 5 } ; Console . Write ( findLargestNumber ( arr ) + " STRNEWLINE " ) ; } }

Index/key variables: n
Iterator variables: n
Class/struct names: GFG
C# program:
using System ; class GFG { static int findLargestNumber ( int [ ] arr , int n ) { for ( int i = 0 ; i < n ; i ++ ) { arr [ i ] &= 0xFFFF ; if ( arr [ i ] <= n ) { arr [ i ] += 0x10000 ; } } for ( int i = n - 1 ; i > 0 ; -- i ) { if ( ( arr [ i ] >> 16 ) == i ) return i + 1 ; } return - 1 ; } public static void Main ( String [ ] args ) { int [ ] arr = { 3 , 2 , 5 , 5 , 2 , 4 , 5 } ; int n = arr . Length ; Console . Write ( findLargestNumber ( arr , n ) + " STRNEWLINE " ) ; } }

Index/key variables: i
Accumulator variables: i
Iterator variables: i
Class/struct names: GFG
C# program:
using System ; class GFG { static int NoCarrySum ( int N , int M ) { return N ^ M ; } static public void Main ( String [ ] args ) { int N = 37 ; int M = 12 ; Console . Write ( NoCarrySum ( N , M ) ) ; } }

Class/struct names: GFG
C# program:
using System ; public class GFG { static bool CheckBits ( int N , int K ) { int check = 0 ; int count = 0 ; for ( int i = 31 ; i >= 0 ; i -- ) { if ( ( ( 1 << i ) & N ) > 0 ) { if ( check == 0 ) { check = 1 ; } else { if ( count < K ) { return false ; } } count = 0 ; } else { count ++ ; } } return true ; } static public void Main ( ) { int N = 5 ; int K = 1 ; if ( CheckBits ( N , K ) ) { Console . Write ( " YES " ) ; } else { Console . Write ( " NO " ) ; } } }

Accumulator variables: count, i
Iterator variables: i
Class/struct names: GFG
C# program:
using System ; class GFG { static int minimumFlips ( int X , int Y , int Z ) { int res = 0 ; while ( X > 0 Y > 0 Z > 0 ) { if ( ( ( X % 2 == 1 ) || ( Y % 2 == 1 ) ) && ( Z % 2 == 1 ) ) { X = X >> 1 ; Y = Y >> 1 ; Z = Z >> 1 ; continue ; } else if ( ! ( X % 2 == 1 ) && ! ( Y % 2 == 1 ) && ( Z % 2 == 1 ) ) { res ++ ; } else if ( ( X % 2 == 1 ) || ( Y % 2 == 1 ) ) { if ( ( X % 2 == 1 ) && ( Y % 2 == 1 ) && ! ( Z % 2 == 1 ) ) { res += 2 ; } else if ( ( ( X % 2 == 1 ) || ( Y % 2 == 1 ) ) && ! ( Z % 2 == 1 ) ) { res ++ ; } } X = X >> 1 ; Y = Y >> 1 ; Z = Z >> 1 ; } return res ; } public static void Main ( ) { int X = 5 , Y = 8 , Z = 6 ; Console . Write ( minimumFlips ( X , Y , Z ) ) ; } }

Accumulator variables: res
Class/struct names: GFG
C# program:
static int countSubseq ( int [ ] arr , int n ) { int count = 0 ; Dictionary < int , int > mp = new Dictionary < int , int > ( ) ; for ( int i = 0 ; i < n ; i ++ ) { if ( mp . ContainsKey ( arr [ i ] ) ) { var val = mp [ arr [ i ] ] ; mp . Remove ( arr [ i ] ) ; mp . Add ( arr [ i ] , val + 1 ) ; } else { mp . Add ( arr [ i ] , 1 ) ; } } foreach ( KeyValuePair < int , int > entry in mp ) { if ( entry . Key == 0 ) count += ( int ) ( Math . Pow ( 2 , entry . Value - 1 ) ) ; else count += ( int ) ( Math . Pow ( 2 , entry . Value - 1 ) ) ; } return count ; } public static void Main ( String [ ] args ) { int [ ] arr = { 2 , 2 , 2 , 5 , 6 } ; int n = arr . Length ; Console . WriteLine ( countSubseq ( arr , n ) ) ; } }

Index/key variables: i
Accumulator variables: count, i
Iterator variables: entry, i
C# program:
using System ; using System . Collections . Generic ; class GFG { static int calculate ( List < int > section , int pos ) { if ( pos < 0 ) return 0 ; List < int > on_section = new List < int > ( ) , off_section = new List < int > ( ) ; foreach ( int el in section ) { if ( ( ( el >> pos ) & 1 ) == 0 ) off_section . Add ( el ) ; else on_section . Add ( el ) ; } if ( off_section . Count == 0 ) return calculate ( on_section , pos - 1 ) ; if ( on_section . Count == 0 ) return calculate ( off_section , pos - 1 ) ; return Math . Min ( calculate ( off_section , pos - 1 ) , calculate ( on_section , pos - 1 ) ) + ( 1 << pos ) ; } static int minXorValue ( int [ ] a , int n ) { List < int > section = new List < int > ( ) ; for ( int i = 0 ; i < n ; i ++ ) section . Add ( a [ i ] ) ; return calculate ( section , 30 ) ; } public static void Main ( String [ ] args ) { int N = 4 ; int [ ] A = { 3 , 2 , 5 , 6 } ; Console . Write ( minXorValue ( A , N ) ) ; } }

Index/key variables: i
Accumulator variables: i
Iterator variables: el, i
Class/struct names: GFG
C# program:
using System ; class GFG { static void findNthNum ( int N ) { int bit_L = 1 , last_num = 0 ; while ( bit_L * ( bit_L + 1 ) / 2 < N ) { last_num = last_num + bit_L ; bit_L ++ ; } int bit_R = N - last_num - 1 ; Console . Write ( ( 1 << bit_L ) + ( 1 << bit_R ) + " STRNEWLINE " ) ; } public static void Main ( String [ ] args ) { int N = 13 ; findNthNum ( N ) ; } }

Accumulator variables: bit_L
Class/struct names: GFG
C# program:
using System ; class GFG { static int MAX = 1000005 ; static bool [ ] prime = new bool [ MAX ] ; static void SieveOfEratosthenes ( bool [ ] prime ) { prime [ 1 ] = false ; prime [ 0 ] = false ; for ( int p = 2 ; p * p < MAX ; p ++ ) { if ( prime [ p ] == true ) { for ( int i = p * 2 ; i < MAX ; i += p ) prime [ i ] = false ; } } } static void prime_xor ( int [ ] arr , int n , int k ) { for ( int i = 0 ; i < MAX ; i ++ ) prime [ i ] = true ; SieveOfEratosthenes ( prime ) ; int ans = 0 ; for ( int i = 0 ; i < n ; i ++ ) { if ( prime [ arr [ i ] ] ) { if ( ( i + 1 ) % k == 0 ) { ans ^= arr [ i ] ; } } } Console . WriteLine ( ans ) ; } public static void Main ( string [ ] args ) { int [ ] arr = { 2 , 3 , 5 , 7 , 11 , 8 } ; int n = arr . Length ; int K = 2 ; prime_xor ( arr , n , K ) ; } }

Index/key variables: MAX, i, p
Accumulator variables: ans, i, p
Iterator variables: i, p
Class/struct names: GFG
C# program:
using System ; class GFG { static int xorOfArray ( int [ ] arr , int n ) { int xor_arr = 0 ; for ( int i = 0 ; i < n ; i ++ ) { xor_arr = xor_arr ^ arr [ i ] ; } return xor_arr ; } public static void Main ( string [ ] args ) { int [ ] arr = { 3 , 9 , 12 , 13 , 15 } ; int n = arr . Length ; Console . WriteLine ( xorOfArray ( arr , n ) ) ; } }

Index/key variables: i
Accumulator variables: i
Iterator variables: i
Class/struct names: GFG
C# program:
using System ; class GFG { static void countEvenBit ( int [ ] A , int [ ] B , int n , int m ) { int i , cntOdd = 0 , cntEven = 0 ; for ( i = 0 ; i < n ; i ++ ) { int x = bitCount ( A [ i ] ) ; if ( x % 2 == 1 ) { cntEven ++ ; } else { cntOdd ++ ; } } int [ ] CountB = new int [ m ] ; for ( i = 0 ; i < m ; i ++ ) { int x = bitCount ( B [ i ] ) ; if ( x % 2 == 1 ) { CountB [ i ] = cntEven ; } else { CountB [ i ] = cntOdd ; } } for ( i = 0 ; i < m ; i ++ ) { Console . Write ( CountB [ i ] + " ▁ " ) ; } } static int bitCount ( int x ) { int setBits = 0 ; while ( x != 0 ) { x = x & ( x - 1 ) ; setBits ++ ; } return setBits ; } public static void Main ( String [ ] args ) { int [ ] A = { 4 , 2 , 15 , 9 , 8 , 8 } ; int [ ] B = { 3 , 4 , 22 } ; countEvenBit ( A , B , 6 , 3 ) ; } }

Index/key variables: i, m
Accumulator variables: cntEven, cntOdd, i, setBits
Iterator variables: i
Class/struct names: GFG
C# program:
using System ; class GFG { static bool isEven ( int n ) { if ( ( n ^ 1 ) == n + 1 ) return true ; else return false ; } public static void Main ( String [ ] args ) { int n = 100 ; Console . Write ( isEven ( n ) == true ? " Even " : " Odd " ) ; } }

Class/struct names: GFG
C# program:
using System ; class GFG { static int bitwiseOrTillN ( int n ) { int result = 2 ; for ( int i = 4 ; i <= n ; i = i + 2 ) { result = result | i ; } return result ; } static public void Main ( ) { int n = 10 ; Console . WriteLine ( bitwiseOrTillN ( n ) ) ; } }

Iterator variables: i
Class/struct names: GFG
C# program:
using System ; class GFG { static int bitwiseOrTillN ( int n ) { if ( n < 2 ) return 0 ; int bitCount = ( int ) ( Math . Log ( n ) / Math . Log ( 2 ) ) + 1 ; return ( int ) Math . Pow ( 2 , bitCount ) - 2 ; } public static void Main ( ) { int n = 10 ; Console . WriteLine ( bitwiseOrTillN ( n ) ) ; } }

Class/struct names: GFG
C# program:
using System ; class GFG { static void genSequence ( int n , int val ) { for ( int i = 0 ; i < ( 1 << n ) ; i ++ ) { int x = i ^ ( i >> 1 ) ^ val ; Console . Write ( x + " ▁ " ) ; } } public static void Main ( ) { int n = 3 , k = 2 ; genSequence ( n , k ) ; } }

Accumulator variables: i
Iterator variables: i
Class/struct names: GFG
C# program:
using System ; using System . Collections . Generic ; class GFG { static String winner ( String moves ) { Dictionary < char , int > data = new Dictionary < char , int > ( ) ; data . Add ( ' R ' , 0 ) ; data . Add ( ' P ' , 1 ) ; data . Add ( ' S ' , 2 ) ; if ( moves [ 0 ] == moves [ 1 ] ) { return " Draw " ; } if ( ( ( data [ moves [ 0 ] ] | 1 << ( 2 ) ) - ( data [ moves [ 1 ] ] | 0 << ( 2 ) ) ) % 3 != 0 ) { return " A " ; } return " B " ; } static void performQueries ( String [ ] arr , int n ) { for ( int i = 0 ; i < n ; i ++ ) Console . Write ( winner ( arr [ i ] ) + " STRNEWLINE " ) ; } public static void Main ( String [ ] args ) { String [ ] arr = { " RS " , " SR " , " SP " , " PP " } ; int n = arr . Length ; performQueries ( arr , n ) ; } }

Index/key variables: i
Accumulator variables: i
Iterator variables: i
Class/struct names: GFG
C# program:
using System ; class GFG { static int maxConsecutiveOnes ( int x ) { int count = 0 ; while ( x != 0 ) { x = ( x & ( x << 1 ) ) ; count ++ ; } return count ; } static int maxOnes ( int [ ] arr , int n ) { int ans = 0 ; for ( int i = 0 ; i < n ; i ++ ) { int currMax = maxConsecutiveOnes ( arr [ i ] ) ; ans = Math . Max ( ans , currMax ) ; } return ans ; } public static void Main ( String [ ] args ) { int [ ] arr = { 1 , 2 , 3 , 4 } ; int n = arr . Length ; Console . WriteLine ( maxOnes ( arr , n ) ) ; } }

Index/key variables: i
Accumulator variables: count, i
Iterator variables: i
Class/struct names: GFG
C# program:
using System ; class GFG { static int maxOR ( int L , int R ) { int maximum = int . MinValue ; for ( int i = L ; i < R ; i ++ ) for ( int j = i + 1 ; j <= R ; j ++ ) maximum = Math . Max ( maximum , ( i j ) ) ; return ; } public static void ( String [ ] args ) { int L = 4 , R = 5 ; Console . WriteLine ( maxOR ( L , R ) ) ; } }

Accumulator variables: i, j
Iterator variables: i, j
Class/struct names: GFG
C# program:
using System ; class GFG { static int MAX = 64 ; static int maxOR ( int L , int R ) { if ( L == R ) { return L ; } int ans = 0 ; for ( int i = MAX - 1 ; i >= 0 ; i -- ) { int p , lbit , rbit ; p = 1 << i ; if ( ( rbit == 1 ) && ( lbit == 0 ) ) { ans += ( p << 1 ) - 1 ; break ; } if ( rbit == 1 ) { ans += p ; } } return ans ; } public static void Main ( String [ ] args ) { int L = 4 , R = 5 ; Console . WriteLine ( maxOR ( L , R ) ) ; } }

Accumulator variables: ans, i
Iterator variables: i
Class/struct names: GFG
C# program:
using System ; using System . Collections . Generic ; class GFG { static int findLen ( int [ ] arr , int n , int m ) { List < int > filter = new List < int > ( ) ; for ( int i = 0 ; i < n ; i ++ ) if ( ( arr [ i ] & m ) == m ) filter . Add ( arr [ i ] ) ; if ( filter . Count == 0 ) return 0 ; int c_and = filter [ 0 ] ; for ( int i = 1 ; i < filter . Count ; i ++ ) c_and &= filter [ i ] ; if ( c_and == m ) return filter . Count ; return 0 ; } public static void Main ( String [ ] args ) { int [ ] arr = { 7 , 3 , 3 , 1 , 3 } ; int n = arr . Length ; int m = 3 ; Console . WriteLine ( findLen ( arr , n , m ) ) ; } }

Index/key variables: i
Accumulator variables: c_and, i
Iterator variables: i
Class/struct names: GFG
C# program:
using System ; class GFG { static int toggleBit ( int n , int k ) { return ( n ^ ( 1 << ( k - 1 ) ) ) ; } public static void Main ( String [ ] args ) { int n = 5 , k = 2 ; Console . WriteLine ( " { 0 } " , toggleBit ( n , k ) ) ; } }

Class/struct names: GFG
C# program:
using System ; class GFG { static int clearBit ( int n , int k ) { return ( n & ( ~ ( 1 << ( k - 1 ) ) ) ) ; } public static void Main ( String [ ] args ) { int n = 5 , k = 1 ; Console . WriteLine ( clearBit ( n , k ) ) ; } }

Class/struct names: GFG
C# program:
using System ; class GFG { static int MAX = 32 ; static int maximizeExpression ( int a , int b ) { int result = a ; for ( int bit = MAX - 1 ; bit >= 0 ; bit -- ) { int bitOfD = 1 << bit ; int x = b & bitOfD ; if ( x == bitOfD ) { int y = result & bitOfD ; if ( y == 0 ) { result = result ^ bitOfD ; } } } return result ; } public static void Main ( String [ ] args ) { int a = 11 , b = 14 ; Console . WriteLine ( maximizeExpression ( a , b ) ) ; } }

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