dhyuti-n/xlcost-variable-roles huggingface dataset:
C# program:
using System ; class GFG { public static void addAP ( int [ ] A , int Q , int [ , ] operations ) { for ( int j = 0 ; j < 2 ; ++ j ) { int L = operations [ j , 0 ] , R = operations [ j , 1 ] , a = operations [ j , 2 ] , d = operations [ j , 3 ] ; int curr = a ; for ( int i = L - 1 ; i < R ; i ++ ) { A [ i ] += curr ; curr += d ; } } for ( int i = 0 ; i < 4 ; ++ i ) Console . Write ( A [ i ] + " ▁ " ) ; } public static void Main ( string [ ] args ) { int [ ] A = { 5 , 4 , 2 , 8 } ; int Q = 2 ; int [ , ] query = { { 1 , 2 , 1 , 3 } , { 1 , 4 , 4 , 1 } } ; addAP ( A , Q , query ) ; } }

Index/key variables: i
Accumulator variables: curr, i
Iterator variables: i, j
Class/struct names: GFG
C# program:
using System ; class GFG { public static void maximizeNumber ( int N , int K ) { String s = N . ToString ( ) ; int L = s . Length ; string result = " " ; int i = 0 ; while ( ( i < L ) && ( K <= ( ( int ) s [ i ] - ( int ) '0' ) ) ) { result += ( s [ i ] ) ; ++ i ; } result += ( ( char ) ( K + ( int ) '0' ) ) ; while ( i < L ) { result += ( s [ i ] ) ; ++ i ; } Console . Write ( result ) ; } static void Main ( ) { int N = 6673 , K = 6 ; maximizeNumber ( N , K ) ; } }

Index/key variables: i
Accumulator variables: result
Class/struct names: GFG
C# program:
using System ; class GFG { static int power ( int x , int y ) { int res = 1 ; while ( y > 0 ) { if ( y % 2 != 0 ) res = res * x ; y = y >> 1 ; x = x * x ; } return res ; } static void countArrays ( int N , int K ) { Console . WriteLine ( ( int ) ( power ( N , K ) ) ) ; } public static void Main ( ) { int N = 5 , K = 6 ; countArrays ( N , K ) ; } }

Class/struct names: GFG
C# program:
using System ; class GFG { public static void minimumDistance ( int [ ] arr , int N ) { int ind = 0 ; int prev = arr [ ind ] ; int s = arr . Length ; for ( int i = 0 ; i < N ; i ++ ) { int distance = Int32 . MaxValue ; if ( i < arr [ 0 ] ) { distance = arr [ 0 ] - i ; } else if ( i >= prev && ind + 1 < s && i <= arr [ ind + 1 ] ) { distance = Math . Min ( i - prev , arr [ ind + 1 ] - i ) ; if ( i == arr [ ind + 1 ] ) { distance = 0 ; prev = arr [ ind + 1 ] ; ind ++ ; } } else { distance = i - prev ; } Console . Write ( distance + " ▁ " ) ; } } public static void Main ( string [ ] args ) { int N = 5 ; int [ ] arr = { 0 , 4 } ; minimumDistance ( arr , N ) ; } }

Index/key variables: ind
Accumulator variables: i, ind
Iterator variables: i
Class/struct names: GFG
C# program:
using System ; using System . Collections . Generic ; class GFG { static int countOfPairs ( int [ ] arr , int N , int X ) { int count = 0 ; for ( int i = 0 ; i < N - 1 ; i ++ ) { for ( int j = i + 1 ; j < N ; j ++ ) { if ( ( ( arr [ i ] ^ arr [ j ] ) & X ) == 0 ) count ++ ; } } return count ; } public static void Main ( ) { int [ ] arr = { 3 , 2 , 5 , 4 , 6 , 7 } ; int X = 6 ; int N = arr . Length ; Console . Write ( countOfPairs ( arr , N , X ) ) ; } }

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 { static int countOfPairs ( int [ ] arr , int N , int X ) { int count = 0 ; Dictionary < int , int > M = new Dictionary < int , int > ( ) ; for ( int i = 0 ; i < N ; i ++ ) { if ( M . ContainsKey ( arr [ i ] & X ) ) M [ ( arr [ i ] & X ) ] ++ ; else M . Add ( arr [ i ] & X , 1 ) ; } foreach ( KeyValuePair < int , int > entry in M ) { int p = entry . Value ; count += p * ( p - 1 ) / 2 ; } return count ; } public static void Main ( ) { int [ ] arr = { 3 , 2 , 5 , 4 , 6 , 7 } ; int X = 6 ; int N = arr . Length ; Console . Write ( countOfPairs ( arr , N , X ) ) ; } }

Index/key variables: i
Accumulator variables: count, i
Iterator variables: entry, i
Class/struct names: GFG
C# program:
using System ; class GFG { static int MAX = 1000 ; static int cntMatrices ( int [ , ] arr , int N , int M , int K ) { int cnt = 0 ; int [ , ] pre = new int [ N + 1 , M + 1 ] ; for ( int i = 1 ; i <= N ; i ++ ) { for ( int j = 1 ; j <= M ; j ++ ) { pre [ i , j ] = arr [ i - 1 , j - 1 ] + pre [ i - 1 , j ] + pre [ i , j - 1 ] - pre [ i - 1 , j - 1 ] ; } } for ( int i = 1 ; i <= N ; i ++ ) { for ( int j = 1 ; j <= M ; j ++ ) { for ( int l = i , r = j ; l > 0 && r > 0 ; l -- , r -- ) { int sum1 = ( K * ( i - l + 1 ) * ( i - r + 1 ) ) ; int sum2 = pre [ i , j ] - pre [ l - 1 , r ] - pre [ l , r - 1 ] + pre [ l - 1 , r - 1 ] ; if ( sum1 <= sum2 ) cnt ++ ; } } } return cnt ; } public static void Main ( string [ ] args ) { int [ , ] arr = { { 2 , 2 , 3 } , { 3 , 4 , 5 } , { 4 , 5 , 5 } } ; int K = 4 ; int N = arr . GetLength ( 0 ) ; int M = arr . GetLength ( 0 ) ; Console . WriteLine ( cntMatrices ( arr , N , M , K ) ) ; } }

Accumulator variables: cnt, i, j, l, r
Iterator variables: i, j, l
Class/struct names: GFG
C# program:
using System ; class GFG { static int ConcatenateArr ( int [ ] arr , int N ) { int ans = arr [ 0 ] ; for ( int i = 1 ; i < N ; i ++ ) { int l = ( int ) Math . Floor ( Math . Log10 ( arr [ i ] ) + 1 ) ; ans = ans * ( int ) Math . Pow ( 10 , l ) ; ans += arr [ i ] ; } return ans ; } public static void Main ( ) { int [ ] arr = { 1 , 23 , 456 } ; int N = arr . Length ; Console . Write ( ConcatenateArr ( arr , N ) ) ; } }

Index/key variables: i
Accumulator variables: ans, i
Iterator variables: i
Class/struct names: GFG
C# program:
using System ; class GFG { static int countXor ( int N ) { int cnt = ( int ) N / 2 + 1 ; return cnt ; } static void Main ( ) { int N = 4 ; Console . WriteLine ( countXor ( N ) ) ; } }

Class/struct names: GFG
C# program:
using System ; using System . Collections . Generic ; class GFG { static int DistRecursion ( string S , int i , int dist ) { if ( i == S . Length ) return Math . Abs ( dist ) ; if ( S [ i ] == ' L ' ) return DistRecursion ( S , i + 1 , dist - 1 ) ; if ( S [ i ] == ' R ' ) return DistRecursion ( S , i + 1 , dist + 1 ) ; return Math . Max ( DistRecursion ( S , i + 1 , dist - 1 ) , DistRecursion ( S , i + 1 , dist + 1 ) ) ; } static int maxDistance ( string S ) { return DistRecursion ( S , 0 , 0 ) ; } public static void Main ( ) { string S = " ? RRR ? " ; Console . Write ( maxDistance ( S ) ) ; } }

Index/key variables: i
Class/struct names: GFG
C# program:
using System ; using System . Collections . Generic ; class GFG { static void findPairs ( int p , int q , int r ) { List < int > v = new List < int > ( ) ; for ( int i = p ; i <= q ; i ++ ) { if ( i % r == 0 ) { v . Add ( i ) ; } } List < List < int > > ans = new List < List < int > > ( ) ; for ( int i = 0 ; i < v . Count ; i ++ ) { for ( int j = i + 1 ; j < v . Count ; j ++ ) { if ( v [ i ] * v [ j ] >= p * q / 4 && v [ i ] * v [ j ] <= p * q ) { List < int > temp = new List < int > ( ) ; temp . Add ( v [ i ] ) ; temp . Add ( v [ j ] ) ; ans . Add ( temp ) ; } } } if ( ans . Count == 0 ) { Console . Write ( - 1 ) ; } else { foreach ( List < int > subList in ans ) { foreach ( int item in subList ) { Console . Write ( item + " ▁ " ) ; } Console . WriteLine ( ) ; } } } public static void Main ( ) { int p = 14 , q = 30 , r = 5 ; findPairs ( p , q , r ) ; } }

Index/key variables: i, j
Accumulator variables: i, j
Iterator variables: i, item, j, subList
Class/struct names: GFG
C# program:
using System ; class GFG { static void printRectPattern ( int c1 , int c2 , int n ) { for ( int i = 0 ; i < n ; i ++ ) { for ( int j = 0 ; j < n ; j ++ ) { Console . Write ( ( Math . Max ( Math . Abs ( c1 - i ) , Math . Abs ( c2 - j ) ) ) + " ▁ " ) ; } Console . WriteLine ( ) ; } } public static void Main ( String [ ] args ) { int c1 = 2 ; int c2 = 2 ; int n = 5 ; printRectPattern ( c1 , c2 , n ) ; } }

Accumulator variables: i, j
Iterator variables: i, j
Class/struct names: GFG
C# program:
using System ; class GFG { static int countNumbers ( int l , int r ) { int count = 0 ; for ( int i = l ; i <= r ; i ++ ) { if ( ( i & 1 ) == 0 ) count += 1 ; } return count ; } public static void Main ( ) { int l = 10 , r = 20 ; Console . WriteLine ( countNumbers ( l , r ) ) ; } }

Accumulator variables: count, i
Iterator variables: i
Class/struct names: GFG
C# program:
using System ; using System . Collections . Generic ; class GFG { static int countNumbers ( int l , int r ) { return ( ( r / 2 ) - ( l - 1 ) / 2 ) ; } public static void Main ( ) { int l = 10 , r = 20 ; Console . Write ( countNumbers ( l , r ) ) ; } }

Class/struct names: GFG
C# program:
using System ; using System . Collections . Generic ; class GFG { static bool isPerfectSquare ( int x ) { int s = ( int ) Math . Sqrt ( x ) ; return ( s * s == x ) ; } static bool isFibonacci ( int n ) { return isPerfectSquare ( 5 * n * n + 4 ) || isPerfectSquare ( 5 * n * n - 4 ) ; } static int contiguousFibonacciNumber ( int [ ] arr , int n ) { int current_length = 0 ; int max_length = 0 ; for ( int i = 0 ; i < n ; i ++ ) { if ( isFibonacci ( arr [ i ] ) ) { current_length ++ ; } else { current_length = 0 ; } max_length = Math . Max ( max_length , current_length ) ; } return max_length ; } public static void Main ( ) { int [ ] arr = { 11 , 8 , 21 , 5 , 3 , 28 , 4 } ; int n = arr . Length ; Console . Write ( contiguousFibonacciNumber ( arr , n ) ) ; } }

Index/key variables: i
Accumulator variables: current_length, i
Iterator variables: i
Class/struct names: GFG
C# program:
using System ; class GFG { static int [ , ] direction = { { - 1 , 0 } , { 0 , 1 } , { 0 , - 1 } , { 1 , 0 } } ; static bool dfs ( int [ , ] matrix , int i , int j , int N , int M ) { if ( i == N - 1 && j == M - 1 ) { return true ; } matrix [ i , j ] = 1 ; for ( int k = 0 ; k < 4 ; k ++ ) { int newX = i + direction [ k , 0 ] ; int newY = j + direction [ k , 1 ] ; if ( newX >= 0 && newX < N && newY >= 0 && newY < M && matrix [ newX , newY ] == 0 ) { if ( dfs ( matrix , newX , newY , N , M ) ) { return true ; } } } return false ; } static int solve ( int [ , ] matrix ) { int N = matrix . GetLength ( 0 ) ; int M = matrix . GetLength ( 1 ) ; if ( ! dfs ( matrix , 0 , 0 , N , M ) ) { return 0 ; } if ( ! dfs ( matrix , 0 , 0 , N , M ) ) { return 1 ; } return 2 ; } public static void Main ( String [ ] args ) { int [ , ] mat = { { 0 , 1 , 0 , 0 } , { 0 , 1 , 0 , 0 } , { 0 , 0 , 0 , 0 } } ; Console . WriteLine ( solve ( mat ) ) ; } }

Accumulator variables: k
Iterator variables: k
Class/struct names: GFG
C# program:
using System ; using System . Collections . Generic ; class GFG { static int Kadane ( int [ ] arr , int n ) { int largestSum = 0 , currMax = 0 ; int currSum = 0 ; for ( int i = 0 ; i < n ; i ++ ) { currSum += arr [ i ] ; currMax = Math . Max ( currMax , arr [ i ] ) ; largestSum = Math . Max ( largestSum , currMax * currSum ) ; if ( currSum < 0 ) { currMax = 0 ; currSum = 0 ; } } return largestSum ; } static int maximumWeight ( int [ ] arr , int n ) { int largestSum = Kadane ( arr , n ) ; for ( int i = 0 ; i < n ; i ++ ) { arr [ i ] = - arr [ i ] ; } largestSum = Math . Max ( largestSum , Kadane ( arr , n ) ) ; return largestSum ; } public static void Main ( ) { int [ ] arr = { 2 , - 3 , 8 , - 2 , 5 } ; int N = arr . Length ; Console . Write ( maximumWeight ( arr , N ) ) ; } }

Index/key variables: i
Accumulator variables: currSum, i
Iterator variables: i
Class/struct names: GFG
C# program:
using System ; using System . Collections . Generic ; class GFG { static void arrayPartition ( int [ ] a , int n ) { int [ ] ans = new int [ n ] ; int cnt = 0 ; int ind = 0 , flag = 0 ; Dictionary < int , int > mp = new Dictionary < int , int > ( ) ; for ( int i = 0 ; i < n ; i ++ ) { if ( mp . ContainsKey ( a [ i ] ) ) mp [ a [ i ] ] ++ ; else mp . Add ( a [ i ] , 1 ) ; } for ( int i = 0 ; i < n ; i ++ ) { if ( mp . ContainsKey ( a [ i ] ) && mp [ a [ i ] ] == 1 ) cnt ++ ; if ( mp . ContainsKey ( a [ i ] ) && mp [ a [ i ] ] > 2 && flag == 0 ) { flag = 1 ; ind = i ; } } int p = ( cnt + 1 ) / 2 ; int ans1 = 0 ; for ( int i = 0 ; i < n ; i ++ ) ans [ i ] = 1 ; for ( int i = 0 ; i < n ; i ++ ) { if ( mp . ContainsKey ( a [ i ] ) && mp [ a [ i ] ] == 1 && ans1 < p ) { ans [ i ] = 1 ; ans1 ++ ; } else if ( mp . ContainsKey ( a [ i ] ) && mp [ a [ i ] ] == 1 ) { ans [ i ] = 2 ; } } if ( cnt % 2 == 1 && flag == 0 ) { Console . Write ( - 1 ) ; return ; } if ( cnt % 2 == 0 ) { for ( int i = 0 ; i < n ; i ++ ) { Console . Write ( ans [ i ] + " ▁ " ) ; } } else { for ( int i = 0 ; i < n ; i ++ ) { if ( ind == i ) Console . Write ( 2 + " ▁ " ) ; else Console . Write ( ans [ i ] + " ▁ " ) ; } } } public static void Main ( ) { int [ ] arr = { 1 , 1 , 2 , 3 , 4 , 4 } ; int N = arr . Length ; arrayPartition ( arr , N ) ; } }

Index/key variables: i, n
Accumulator variables: ans1, cnt, i
Iterator variables: i
Class/struct names: GFG
C# program:
using System ; class GFG { static void evenOdd ( int [ ] arr , int N ) { for ( int i = 0 ; i < N ; i ++ ) { int even_digits = 0 ; int odd_digits = 0 ; int temp = arr [ i ] ; while ( temp > 0 ) { if ( ( temp % 10 ) % 2 != 0 ) odd_digits ++ ; else even_digits ++ ; temp /= 10 ; } if ( even_digits > odd_digits ) { int res = 0 ; while ( arr [ i ] > 0 ) { res += arr [ i ] % 10 ; arr [ i ] /= 10 ; } Console . Write ( res + " ▁ " ) ; } else if ( odd_digits > even_digits ) { int res = 1 ; while ( arr [ i ] > 0 ) { res *= arr [ i ] % 10 ; arr [ i ] /= 10 ; } Console . Write ( res + " ▁ " ) ; } else Console . Write ( arr [ i ] + " ▁ " ) ; } } public static void Main ( ) { int [ ] arr = { 113 , 141 , 214 , 3186 } ; int N = arr . Length ; evenOdd ( arr , N ) ; } }

Index/key variables: i
Accumulator variables: even_digits, i, odd_digits, res, temp
Iterator variables: i
Class/struct names: GFG
C# program:
using System ; using System . Collections . Generic ; class GFG { static void primeFactorization ( int N ) { int [ ] sieve = new int [ N / 2 + 1 ] ; for ( int i = 0 ; i <= N / 2 ; i ++ ) { sieve [ i ] = 0 ; } for ( int i = 2 ; i <= N / 2 ; i ++ ) { if ( sieve [ i ] == 0 ) { for ( int j = i * i ; j <= N / 2 ; j += i ) { sieve [ j ] = 1 ; } } } List < int > prime = new List < int > ( ) ; for ( int i = 3 ; i <= N / 2 ; i ++ ) if ( sieve [ i ] == 0 ) prime . Add ( i ) ; int x = prime . Count ; Console . WriteLine ( "2 - > " + x ) ; foreach ( int i in prime ) Console . WriteLine ( i + " - > 1" ) ; } public static void Main ( String [ ] args ) { int N = 18 ; primeFactorization ( 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 sumOfFirstM ( int [ ] A , int N , int M ) { int sum = 0 ; for ( int i = 0 ; i < M ; i ++ ) { sum = sum + A [ i % N ] ; } return sum ; } public static void Main ( ) { int [ ] arr = { 1 , 2 , 3 } ; int M = 5 ; int N = arr . Length ; Console . WriteLine ( sumOfFirstM ( arr , N , M ) ) ; } }

Accumulator variables: i
Iterator variables: i
Class/struct names: GFG
C# program:
using System ; class GFG { static void canReach0toM ( int [ , ] a , int n , int m ) { int [ ] rightMost = new int [ m + 1 ] ; int [ ] dp = new int [ m + 1 ] ; for ( int i = 0 ; i <= m ; i ++ ) { rightMost [ i ] = 0 ; } for ( int i = 0 ; i < n ; i ++ ) { int a1 = a [ i , 0 ] ; int b1 = a [ i , 1 ] ; rightMost [ a1 ] = Math . Max ( rightMost [ a1 ] , b1 ) ; } for ( int i = m ; i >= 0 ; i -- ) { dp [ i ] = i ; for ( int j = Math . Min ( m , rightMost [ i ] ) ; j > i ; j -- ) { dp [ i ] = Math . Max ( dp [ i ] , dp [ j ] ) ; } } if ( dp [ 0 ] >= m ) { Console . Write ( " Yes " ) ; } else { Console . Write ( " No " ) ; } } public static void Main ( ) { int [ , ] arr = { { 0 , 2 } , { 2 , 2 } , { 2 , 5 } , { 4 , 5 } } ; int M = 5 ; int N = arr . GetLength ( 0 ) ; canReach0toM ( arr , N , M ) ; } }

Index/key variables: a1, i, j
Accumulator variables: i, j
Iterator variables: i, j
Class/struct names: GFG
C# program:
using System ; class GFG { static int gcd ( int a , int b ) { if ( b == 0 ) return a ; return gcd ( b , a % b ) ; } static void countPairs ( int [ ] arr , int N ) { for ( int i = 0 ; i < N ; i ++ ) { int count = 0 ; for ( int x = 1 ; x <= arr [ i ] ; x ++ ) { for ( int y = x ; y <= arr [ i ] ; y ++ ) { if ( gcd ( x , y ) > 1 ) count ++ ; } } Console . Write ( count + " ▁ " ) ; } } public static void Main ( String [ ] args ) { int [ ] arr = { 5 , 10 , 20 } ; int N = 3 ; countPairs ( arr , N ) ; } }

Index/key variables: i
Accumulator variables: count, i, x, y
Iterator variables: i, x, y
Class/struct names: GFG
C# program:
using System ; class GFG { static int MAX = 1005 ; static void preCalculate ( int [ ] phi , int [ ] ans ) { phi [ 0 ] = 0 ; phi [ 1 ] = 1 ; for ( int i = 2 ; i <= MAX ; i ++ ) phi [ i ] = i ; for ( int i = 2 ; i <= MAX ; i ++ ) { if ( phi [ i ] == i ) { for ( int j = i ; j <= MAX ; j += i ) phi [ j ] -= ( phi [ j ] / i ) ; } } for ( int i = 1 ; i <= MAX ; i ++ ) ans [ i ] = ans [ i - 1 ] + ( i - phi [ i ] ) ; } static void countPairs ( int [ ] arr , int N ) { int [ ] phi = new int [ 100000 ] ; Array . Clear ( phi , 0 , 100000 ) ; int [ ] ans = new int [ 100000 ] ; Array . Clear ( ans , 0 , 100000 ) ; preCalculate ( phi , ans ) ; for ( int i = 0 ; i < N ; ++ i ) { Console . Write ( ans [ arr [ i ] ] + " ▁ " ) ; } } public static void Main ( ) { int [ ] arr = { 5 , 10 , 20 } ; int N = 3 ; countPairs ( arr , N ) ; } }

Index/key variables: i, j
Accumulator variables: i, j
Iterator variables: i, j
Class/struct names: GFG
C# program:
using System ; using System . Collections . Generic ; class GFG { static int maximumTurns ( int [ ] arr , int N ) { int Count = 0 ; for ( int i = 0 ; i < N ; i ++ ) { while ( arr [ i ] % 2 == 0 ) { Count ++ ; arr [ i ] = arr [ i ] / 2 ; } } return Count ; } public static void Main ( ) { int [ ] arr = { 5 , 2 , 4 } ; int N = arr . Length ; Console . Write ( maximumTurns ( arr , N ) ) ; } }

Index/key variables: i
Accumulator variables: Count, i
Iterator variables: i
Class/struct names: GFG
C# program:
using System ; class GFG { static void isPossible ( int W , int B , int D ) { if ( W > B ) { int temp = W ; W = B ; B = temp ; } if ( B > W * ( D + 1 ) ) Console . WriteLine ( " NO " ) ; else Console . WriteLine ( " YES " ) ; } public static void Main ( ) { int W = 2 ; int B = 5 ; int D = 2 ; isPossible ( W , B , D ) ; } }

Class/struct names: GFG
C# program:
using System ; class GFG { public static int GCD ( int a , int b ) { if ( b == 0 ) return a ; return GCD ( b , a % b ) ; } public static int maxGCDInRange ( int L , int R ) { int ans = 1 ; for ( int Z = R ; Z >= 1 ; Z -- ) { if ( ( R / Z ) - ( L - 1 ) / Z > 1 ) { ans = Z ; break ; } } return ans ; } public static void Main ( ) { int L = 102 ; int R = 139 ; Console . Write ( maxGCDInRange ( L , R ) ) ; } }

Accumulator variables: Z
Iterator variables: Z
Class/struct names: GFG
C# program:
using System ; using System . Collections . Generic ; class GFG { static int noOfWays ( int N , int K ) { string S = N . ToString ( ) ; int ans = 1 ; for ( int i = 1 ; i < S . Length ; i ++ ) { int count = 1 ; while ( i < S . Length && ( int ) S [ i ] - 48 + ( int ) S [ i - 1 ] - 48 == K ) { count ++ ; i ++ ; } if ( count % 2 == 1 ) ans *= ( count + 1 ) / 2 ; } return ans ; } public static void Main ( ) { int N = 1454781 ; int K = 9 ; Console . Write ( noOfWays ( N , K ) ) ; } }

Index/key variables: i
Accumulator variables: ans, count, i
Iterator variables: i
Class/struct names: GFG
C# program:
using System ; using System . Collections . Generic ; class GFG { static int countSetBits ( int n ) { int count = 0 ; while ( n > 0 ) { n = n & ( n - 1 ) ; count ++ ; } return count ; } static int minOperations ( int A , int B ) { int cnt1 = 0 , cnt2 = 0 ; cnt1 += countSetBits ( A ) ; cnt2 += countSetBits ( B ) ; if ( ( cnt1 + cnt2 ) % 2 != 0 ) return - 1 ; int oneZero = 0 , zeroOne = 0 ; int ans = 0 ; for ( int i = 0 ; i < Math . Max ( cnt1 , cnt2 ) ; i ++ ) { int bitpos = 1 << i ; if ( ( ( bitpos & A ) == 0 ) && ( bitpos & B ) != 0 ) zeroOne ++ ; if ( ( bitpos & A ) != 0 && ( ( bitpos & B ) == 0 ) ) oneZero ++ ; } ans = ( zeroOne / 2 ) + ( oneZero / 2 ) ; if ( zeroOne % 2 != 0 ) ans += 2 ; return ans ; } public static void Main ( ) { int A = 27 , B = 5 ; Console . Write ( minOperations ( A , B ) ) ; } }

Accumulator variables: ans, cnt1, cnt2, count, i, oneZero, zeroOne
Iterator variables: i
Class/struct names: GFG
C# program:
using System ; using System . Collections . Generic ; class GFG { static int MAX = 10000 ; static List < int > primes = new List < int > ( ) ; static void sieveSundaram ( ) { int [ ] marked = new int [ MAX / 2 + 100 ] ; Array . Clear ( marked , 0 , MAX / 2 + 100 ) ; for ( int i = 1 ; i <= ( int ) ( Math . Sqrt ( MAX ) - 1 ) / 2 ; i ++ ) for ( int j = ( i * ( i + 1 ) ) << 1 ; j <= MAX / 2 ; j = j + 2 * i + 1 ) marked [ j ] = 1 ; primes . Add ( 2 ) ; for ( int i = 1 ; i <= ( int ) MAX / 2 ; i ++ ) if ( marked [ i ] == 0 ) primes . Add ( 2 * i + 1 ) ; } static bool isSmith ( int n ) { int original_no = n ; int pDigitSum = 0 ; for ( int i = 0 ; primes [ i ] <= n / 2 ; i ++ ) { while ( n % primes [ i ] == 0 ) { int p = primes [ i ] ; n = n / p ; while ( p > 0 ) { pDigitSum += ( p % 10 ) ; p = p / 10 ; } } } if ( n != 1 && n != original_no ) { while ( n > 0 ) { pDigitSum = pDigitSum + n % 10 ; n = n / 10 ; } } int sumDigits = 0 ; while ( original_no > 0 ) { sumDigits = sumDigits + original_no % 10 ; original_no = original_no / 10 ; } return ( pDigitSum == sumDigits ) ; } static bool isSmithBrotherPair ( int X , int Y ) { return isSmith ( X ) && isSmith ( Y ) && Math . Abs ( X - Y ) == 1 ; } static int countSmithBrotherPairs ( int [ ] A , int N ) { int count = 0 ; for ( int i = 0 ; i < N ; i ++ ) for ( int j = i + 1 ; j < N ; j ++ ) { if ( isSmithBrotherPair ( A [ i ] , A [ j ] ) ) count ++ ; } return count ; } public static void Main ( ) { sieveSundaram ( ) ; int [ ] A = { 728 , 729 , 28 , 2964 , 2965 } ; int N = A . Length ; Console . Write ( countSmithBrotherPairs ( A , N ) ) ; } }

Index/key variables: i, j
Accumulator variables: count, i, j, pDigitSum
Iterator variables: i, j
Class/struct names: GFG
C# program:
using System ; class GFG { public static void countPairs ( int [ ] arr , int N ) { int count = 0 , totalSum = 0 ; for ( int i = 0 ; i < N ; i ++ ) { totalSum += arr [ i ] ; } for ( int i = 0 ; i < N ; i ++ ) { for ( int j = i + 1 ; j < N ; j ++ ) { if ( totalSum % ( arr [ i ] + arr [ j ] ) == 0 ) { count += 1 ; } } } Console . WriteLine ( count ) ; } static public void Main ( ) { int [ ] arr = { 1 , 2 , 3 , 4 , 5 } ; int N = arr . Length ; countPairs ( arr , N ) ; } }

Index/key variables: i, j
Accumulator variables: count, i, j, totalSum
Iterator variables: i, j
Class/struct names: GFG
C# program:
using System ; using System . Collections . Generic ; class GFG { static int gcd ( int a , int b ) { return b == 0 ? a : gcd ( b , a % b ) ; } static void printUnitaryDivisors ( int n ) { for ( int i = 1 ; i <= ( int ) Math . Sqrt ( n ) ; i ++ ) { if ( n % i == 0 ) { if ( n / i == i && gcd ( i , n / i ) == 1 ) { Console . Write ( i + " ▁ " ) ; } else { if ( gcd ( i , n / i ) == 1 ) { Console . Write ( i + " ▁ " + n / i + " ▁ " ) ; } } } } } public static void Main ( ) { int N = 12 ; printUnitaryDivisors ( N ) ; } }

Accumulator variables: i
Iterator variables: i
Class/struct names: GFG
C# program:
using System ; using System . Collections . Generic ; class GFG { static int gcd ( int a , int b ) { if ( b == 0 ) return a ; else return gcd ( b , a % b ) ; } static int largestK ( int [ ] A , int N ) { int l = 0 , r = N - 1 , flag = 0 ; while ( l < r ) { if ( A [ l ] != A [ r ] ) { flag = 1 ; break ; } l ++ ; r -- ; } if ( flag == 0 ) return - 1 ; int K = Math . Abs ( A [ 0 ] - A [ N - 1 ] ) ; for ( int i = 1 ; i < N / 2 ; i ++ ) K = gcd ( K , Math . Abs ( A [ i ] - A [ N - i - 1 ] ) ) ; return K ; } public static void Main ( ) { int [ ] A = { 1 , 2 , 3 , 2 , 1 } ; int N = A . Length ; Console . Write ( largestK ( A , N ) ) ; } }

Index/key variables: i, l, r
Accumulator variables: i, l, r
Iterator variables: i
Class/struct names: GFG