dhyuti-n/xlcost-variable-roles huggingface dataset:
C# program:
using System ; class GFG { public static void FindwinnerOfGame ( string S ) { int cntZero = 0 ; int cntConOne = 0 ; int nimSum = 0 ; int N = S . Length ; for ( int i = 0 ; i < N ; i ++ ) { if ( S [ i ] == '1' ) { cntConOne += 1 ; } else { nimSum ^= cntConOne ; cntConOne = 0 ; cntZero ++ ; } } nimSum ^= cntConOne ; if ( cntZero % 2 == 0 ) { Console . Write ( " Tie " ) ; } else if ( nimSum != 0 ) { Console . Write ( " player ▁ 1" ) ; } else { Console . Write ( " player ▁ 2" ) ; } } public static void Main ( string [ ] args ) { string S = "0110011" ; FindwinnerOfGame ( S ) ; } }

Index/key variables: i
Accumulator variables: cntConOne, cntZero, i, nimSum
Iterator variables: i
Class/struct names: GFG
C# program:
using System ; class GFG { static void generatepermutation ( int N ) { int [ ] answer = new int [ N ] ; answer [ 0 ] = N ; for ( int i = 1 ; i < N ; i ++ ) { answer [ i ] = i ; } foreach ( int i in answer ) Console . Write ( i + " ▁ " ) ; } static public void Main ( ) { int N = 4 ; generatepermutation ( N ) ; } }

Index/key variables: N, i
Accumulator variables: i
Iterator variables: i
Class/struct names: GFG
C# program:
using System ; class GFG { static void maxValueAtIndexK ( int N , int K , int M ) { int S1 = 0 , S2 = 0 ; S1 = K * ( K + 1 ) / 2 ; S2 = ( N - K - 1 ) * ( N - K ) / 2 ; int X = ( M + S1 + S2 ) / N ; Console . WriteLine ( X ) ; } static public void Main ( ) { int N = 3 , K = 1 , M = 7 ; maxValueAtIndexK ( N , K , M ) ; } }

Class/struct names: GFG
C# program:
using System ; class GFG { static void farthestCellDistance ( int N , int M , int R , int C ) { int d1 = N + M - R - C ; int d2 = R + C - 2 ; int d3 = N - R + C - 1 ; int d4 = M - C + R - 1 ; int maxDistance = Math . Max ( d1 , Math . Max ( d2 , Math . Max ( d3 , d4 ) ) ) ; Console . WriteLine ( maxDistance ) ; } static public void Main ( ) { int N = 15 , M = 12 , R = 1 , C = 6 ; farthestCellDistance ( N , M , R , C ) ; } }

Class/struct names: GFG
C# program:
using System ; class GFG { static void maxSum ( int [ ] arr , int N ) { for ( int i = N - 1 ; i >= 0 ; i -- ) { int t = i ; if ( t + arr [ i ] < N ) { arr [ i ] += arr [ t + arr [ i ] ] ; } } for ( int i = 0 ; i < N ; i ++ ) { Console . Write ( arr [ i ] + " ▁ " ) ; } } static public void Main ( ) { int [ ] arr = { 1 , 2 , 7 , 1 , 8 } ; int N = arr . Length ; maxSum ( arr , N ) ; } }

Index/key variables: i
Accumulator variables: i
Iterator variables: i
Class/struct names: GFG
C# program:
using System ; class GFG { static int findInGrid ( int i , int j ) { if ( i == j ) return ( i * i - ( i - 1 ) ) ; else if ( i > j ) { if ( i % 2 == 0 ) return i * i - ( j - 1 ) ; else return ( i - 1 ) * ( i - 1 ) + 1 + ( j - 1 ) ; } else { if ( j % 2 == 0 ) return ( j - 1 ) * ( j - 1 ) + 1 + ( i - 1 ) ; else return j * j - ( i - 1 ) ; } } static public void Main ( ) { int i = 3 , j = 4 ; Console . WriteLine ( findInGrid ( i , j ) ) ; } }

Class/struct names: GFG
C# program:
using System ; using System . Collections . Generic ; class GFG { static void minOpsToTurnArrToZero ( int [ ] arr , int N ) { HashSet < int > st = new HashSet < int > ( ) ; for ( int i = 0 ; i < N ; i ++ ) { if ( st . Contains ( arr [ i ] ) arr [ i ] == 0 ) { continue ; } else { st . Add ( arr [ i ] ) ; } } Console . WriteLine ( st . Count ) ; } public static void Main ( String [ ] args ) { int [ ] arr = { 3 , 7 , 3 } ; int N = arr . Length ; minOpsToTurnArrToZero ( arr , N ) ; } }

Index/key variables: i
Accumulator variables: i
Iterator variables: i
Class/struct names: GFG
C# program:
using System ; using System . Collections . Generic ; using System . Linq ; class GFG { static int gcd ( int a , int b ) { if ( b == 0 ) return a ; return gcd ( b , a % b ) ; } static void splitArray ( int [ ] arr , int n ) { Dictionary < int , int > mp = new Dictionary < int , int > ( ) ; for ( int i = 0 ; i < n ; ++ i ) { if ( mp . ContainsKey ( arr [ i ] ) == true ) mp [ arr [ i ] ] += 1 ; else mp [ arr [ i ] ] = 1 ; } int G = 0 ; foreach ( KeyValuePair < int , int > i in mp ) { G = gcd ( G , i . Value ) ; } if ( G > 1 ) Console . Write ( " YES " ) ; else Console . Write ( " NO " ) ; } public static void Main ( ) { int [ ] arr = { 1 , 2 , 3 , 4 , 4 , 3 , 2 , 1 } ; int n = arr . Length ; splitArray ( arr , n ) ; } }

Index/key variables: i
Iterator variables: i
Class/struct names: GFG
C# program:
using System ; using System . Linq ; class GFG { static bool CheckAllEqual ( int [ ] arr , int N ) { for ( int i = 1 ; i < N ; i ++ ) { if ( arr [ 0 ] != arr [ i ] ) { return false ; } } return true ; } static int minCntOperations ( int [ ] arr , int N ) { int Max = arr . Max ( ) ; bool isPower2 ; if ( ( int ) ( Math . Ceiling ( ( Math . Log ( N ) / Math . Log ( N ) ) ) ) == ( int ) ( Math . Floor ( ( ( Math . Log ( N ) / Math . Log ( 2 ) ) ) ) ) ) { isPower2 = true ; } else { isPower2 = false ; } if ( isPower2 && CheckAllEqual ( arr , N ) ) { return ( int ) ( Math . Log ( Max ) / Math . Log ( 2 ) ) ; } else { return ( int ) Math . Ceiling ( Math . Log ( Max ) / Math . Log ( 2 ) ) + 1 ; } } static public void Main ( ) { int [ ] arr = new int [ ] { 2 , 4 } ; int N = arr . Length ; Console . WriteLine ( minCntOperations ( arr , N ) ) ; } }

Index/key variables: i
Accumulator variables: i
Iterator variables: i
Boolean variables: isPower2
Class/struct names: GFG
C# program:
using System ; using System . Collections . Generic ; class GFG { static string greatestReducedNumber ( string num , string s ) { bool [ ] vis_s = new bool [ 10 ] ; for ( int i = 0 ; i < ( int ) s . Length ; i ++ ) { vis_s [ ( int ) ( s [ i ] ) - 48 ] = true ; } int n = num . Length ; int In = - 1 ; for ( int i = 0 ; i < n ; i ++ ) { if ( vis_s [ ( int ) num [ i ] - '0' ] ) { In = i ; break ; } } if ( In == - 1 ) { return num ; } for ( char dig = num [ In ] ; dig >= '0' ; dig -- ) { if ( vis_s [ ( int ) dig - '0' ] == false ) { num = num . Substring ( 0 , In ) + dig + num . Substring ( In + 1 , n - In - 1 ) ; break ; } } char LargestDig = '0' ; for ( char dig = '9' ; dig >= '0' ; dig -- ) { if ( vis_s [ dig - '0' ] == false ) { LargestDig = dig ; break ; } } for ( int i = In + 1 ; i < n ; i ++ ) { num = num . Substring ( 0 , i ) + LargestDig ; } int Count = 0 ; for ( int i = 0 ; i < n ; i ++ ) { if ( num [ i ] == '0' ) Count ++ ; else break ; } num = num . Substring ( Count , n ) ; if ( ( int ) num . Length == 0 ) return "0" ; return num ; } static void Main ( ) { string N = "12345" ; string S = "23" ; Console . Write ( greatestReducedNumber ( N , S ) ) ; } }

Index/key variables: In, i
Accumulator variables: Count, dig, i
Iterator variables: dig, i
Class/struct names: GFG
C# program:
using System ; class GFG { private static void minXOR ( int [ ] Arr , int N ) { for ( int i = 0 ; i < N ; i ++ ) { if ( Arr [ i ] == 2 ) { Console . Write ( ( Arr [ i ] ^ 3 ) + " ▁ " ) ; } else { Console . Write ( ( Arr [ i ] ^ 2 ) + " ▁ " ) ; } } } public static void Main ( ) { int [ ] Arr = { 5 , 4 , 7 , 6 } ; int N = Arr . Length ; minXOR ( Arr , N ) ; } }

Index/key variables: i
Accumulator variables: i
Iterator variables: i
Class/struct names: GFG
C# program:
using System ; class GFG { static int [ ] findArray ( int n ) { int [ ] Arr = new int [ n + 1 ] ; Arr [ 0 ] = 0 ; Arr [ 1 ] = 1 ; for ( int i = 2 ; i <= n ; i ++ ) { if ( i % 2 == 0 ) { Arr [ i ] = Arr [ i / 2 ] ; } else { Arr [ i ] = Arr [ ( i - 1 ) / 2 ] + Arr [ ( i - 1 ) / 2 + 1 ] ; } } return Arr ; } static int maxElement ( int n ) { if ( n == 0 ) return 0 ; if ( n == 1 ) return 1 ; int [ ] Arr = findArray ( n ) ; int ans = int . MinValue ; for ( int i = 0 ; i < n ; i ++ ) { ans = Math . Max ( ans , Arr [ i ] ) ; } return ans ; } public static void Main ( String [ ] args ) { int N = 7 ; Console . WriteLine ( maxElement ( N ) ) ; } }

Index/key variables: i
Accumulator variables: i
Iterator variables: i
Class/struct names: GFG
C# program:
using System ; using System . Collections . Generic ; public class GFG { class pair { public int first , second ; public pair ( int first , int second ) { this . first = first ; this . second = second ; } } static void constGraphWithCon ( int N , int K ) { int Max = ( ( N - 1 ) * ( N - 2 ) ) / 2 ; if ( K > Max ) { Console . Write ( - 1 + " STRNEWLINE " ) ; return ; } List < pair > ans = new List < pair > ( ) ; for ( int i = 1 ; i < N ; i ++ ) { for ( int j = i + 1 ; j <= N ; j ++ ) { ans . Add ( new pair ( i , j ) ) ; } } for ( int i = 0 ; i < ( N - 1 ) + Max - K ; i ++ ) { Console . Write ( ans [ i ] . first + " ▁ " + ans [ i ] . second + " STRNEWLINE " ) ; } } public static void Main ( String [ ] args ) { int N = 5 , K = 3 ; constGraphWithCon ( N , K ) ; } }

Index/key variables: i
Accumulator variables: i, j
Iterator variables: i, j
Class/struct names: GFG, pair
C# program:
using System ; class GFG { static int min_steps_required ( int n , int m , int r , int c ) { int i , j ; int corner_steps_req = int . MaxValue ; i = 1 ; j = 1 ; corner_steps_req = Math . Min ( corner_steps_req , Math . Abs ( r - i ) + Math . Abs ( j - c ) ) ; i = n ; j = 1 ; corner_steps_req = Math . Min ( corner_steps_req , Math . Abs ( r - i ) + Math . Abs ( j - c ) ) ; i = 1 ; j = m ; corner_steps_req = Math . Min ( corner_steps_req , Math . Abs ( r - i ) + Math . Abs ( j - c ) ) ; i = n ; j = m ; corner_steps_req = Math . Min ( corner_steps_req , Math . Abs ( r - i ) + Math . Abs ( j - c ) ) ; int minimum_steps = Math . Min ( 2 * ( n - 1 ) + m - 1 , 2 * ( m - 1 ) + n - 1 ) ; return minimum_steps + corner_steps_req ; } public static void Main ( String [ ] args ) { int n = 3 ; int m = 2 ; int r = 1 ; int c = 1 ; Console . Write ( min_steps_required ( n , m , r , c ) ) ; } }

Class/struct names: GFG
C# program:
using System ; using System . Collections . Generic ; class GFG { static int min_elements ( int [ ] arr , int N , int K ) { Dictionary < int , int > mp = new Dictionary < int , int > ( ) ; for ( int i = 0 ; i < N ; i ++ ) { if ( mp . ContainsKey ( arr [ i ] ) ) { mp [ arr [ i ] ] = mp [ arr [ i ] ] + 1 ; } else { mp . Add ( arr [ i ] , 1 ) ; } } List < int > Freq = new List < int > ( ) ; foreach ( KeyValuePair < int , int > it in mp ) { int i = it . Key ; Freq . Add ( mp [ i ] ) ; } Freq . Sort ( ) ; Freq . Reverse ( ) ; int len = Freq . Count ; if ( len <= K ) { return 0 ; } int cntMin = 0 ; for ( int i = K ; i < len ; i ++ ) { cntMin += Freq [ i ] ; } return cntMin ; } public static void Main ( String [ ] args ) { int [ ] arr = { 5 , 1 , 3 , 2 , 4 , 1 , 1 , 2 , 3 , 4 } ; int N = arr . Length ; int K = 3 ; Console . Write ( min_elements ( arr , N , K ) ) ; } }

Index/key variables: i
Accumulator variables: cntMin, i
Iterator variables: i, it
Class/struct names: GFG
C# program:
using System ; class GFG { static int sumzero ( int [ ] arr , int N , int K ) { int sum = 0 ; for ( int i = 0 ; i < N ; i ++ ) { sum += arr [ i ] ; } if ( sum == 0 ) Console . Write ( " Yes " ) ; else if ( sum > 0 ) { if ( sum % K == 0 ) Console . Write ( " Yes " ) ; else Console . Write ( " No " ) ; } else Console . Write ( " No " ) ; return 0 ; } public static void Main ( String [ ] args ) { int K , N ; int [ ] arr1 = { 1 , - 6 , 2 , 2 } ; K = 1 ; N = arr1 . Length ; sumzero ( arr1 , N , K ) ; } }

Index/key variables: i
Accumulator variables: i, sum
Iterator variables: i
Class/struct names: GFG
C# program:
using System ; class GFG { static int cntOnesArrWithGivenOp ( int [ ] arr , int N ) { int cntOnes = 0 ; for ( int i = 1 ; i <= N ; i ++ ) { for ( int j = i - 1 ; j < N ; j += i ) { arr [ j ] = arr [ j ] == 0 ? 1 : 0 ; } } for ( int i = 0 ; i < N ; i ++ ) { if ( arr [ i ] == 1 ) { cntOnes += 1 ; } } return cntOnes ; } public static void Main ( String [ ] args ) { int [ ] arr = { 0 , 0 , 0 , 0 , 0 } ; int N = arr . Length ; Console . Write ( cntOnesArrWithGivenOp ( arr , N ) ) ; } }

Index/key variables: i, j
Accumulator variables: cntOnes, i, j
Iterator variables: i, j
Class/struct names: GFG
C# program:
using System ; class GFG { static int cntOnesArrWithGivenOp ( int [ ] arr , int N ) { int cntOnes = 0 ; cntOnes = ( int ) Math . Sqrt ( N ) ; return cntOnes ; } public static void Main ( String [ ] args ) { int [ ] arr = { 0 , 0 , 0 , 0 , 0 } ; int N = arr . Length ; Console . WriteLine ( cntOnesArrWithGivenOp ( arr , N ) ) ; } }

Class/struct names: GFG
C# program:
using System ; class GFG { static int cntKnightsAttackPawn ( int [ , ] knights , int [ ] pawn , int M ) { int cntKnights = 0 ; for ( int i = 0 ; i < M ; i ++ ) { int X = Math . Abs ( knights [ i , 0 ] - pawn [ 0 ] ) ; int Y = Math . Abs ( knights [ i , 1 ] - pawn [ 1 ] ) ; if ( ( X == 1 && Y == 2 ) || ( X == 2 && Y == 1 ) ) { cntKnights ++ ; } } return cntKnights ; } static void Main ( ) { int [ , ] knights = { { 0 , 4 } , { 4 , 5 } , { 1 , 4 } , { 3 , 1 } } ; int [ ] pawn = { 2 , 3 } ; int M = knights . GetLength ( 0 ) ; Console . WriteLine ( cntKnightsAttackPawn ( knights , pawn , M ) ) ; } }

Accumulator variables: cntKnights, i
Iterator variables: i
Class/struct names: GFG
C# program:
using System ; using System . Collections . Generic ; class GFG { static void findWinnerGameRemoveGCD ( int [ ] arr , int n ) { Dictionary < int , int > mp = new Dictionary < int , int > ( ) ; for ( int i = 0 ; i < n ; i ++ ) { for ( int j = 2 ; j * j <= arr [ i ] ; j ++ ) { if ( arr [ i ] % j == 0 ) { if ( mp . ContainsKey ( j ) ) { mp [ j ] = mp [ j ] + 1 ; } else { mp . Add ( j , 1 ) ; } while ( arr [ i ] % j == 0 ) { arr [ i ] = arr [ i ] / j ; } } } if ( arr [ i ] > 1 ) { if ( mp . ContainsKey ( arr [ i ] ) ) { mp [ arr [ i ] ] = mp [ arr [ i ] ] + 1 ; } else { mp . Add ( arr [ i ] , 1 ) ; } } } int maxCnt = 0 ; foreach ( KeyValuePair < int , int > i in mp ) { maxCnt = Math . Max ( maxCnt , i . Value ) ; } if ( n % 2 == 0 ) { if ( maxCnt >= n - 1 ) { Console . Write ( " Player ▁ 1" ) ; } else { Console . Write ( " Player ▁ 2" ) ; } } else { if ( maxCnt == n ) { Console . Write ( " Player ▁ 1" ) ; } else { Console . Write ( " Player ▁ 2" ) ; } } } public static void Main ( String [ ] args ) { int [ ] arr = { 2 , 4 , 8 } ; int N = arr . Length ; findWinnerGameRemoveGCD ( 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 void maxksum ( int L , int R , int K ) { int N = ( R / 10 - L / 10 ) + 1 ; if ( K > N ) { Console . Write ( " - 1" ) ; return ; } R = R / 10 ; int X = R - K ; int sum = 10 * ( ( R * ( R + 1 ) ) / 2 - ( X * ( X + 1 ) ) / 2 ) ; Console . Write ( sum ) ; } public static void Main ( ) { int L = 16 , R = 60 , K = 4 ; maxksum ( L , R , K ) ; } }

Class/struct names: GFG
C# program:
using System ; class GFG { static void minimumSwaps ( int [ ] arr1 , int [ ] arr2 , int n ) { int sumArr1 = 0 , sumArr2 = 0 ; for ( int i = 0 ; i < n ; ++ i ) { sumArr1 += arr1 [ i ] ; sumArr2 += arr2 [ i ] ; } if ( sumArr1 % 2 == 0 && sumArr2 % 2 == 0 ) { Console . Write ( 0 ) ; return ; } if ( sumArr1 % 2 != 0 && sumArr2 % 2 != 0 ) { int flag = - 1 ; for ( int i = 0 ; i < n ; ++ i ) { if ( ( arr1 [ i ] + arr2 [ i ] ) % 2 == 1 ) { flag = 1 ; break ; } } Console . Write ( flag ) ; return ; } Console . Write ( - 1 ) ; } public static void Main ( ) { int [ ] arr1 = { 11 , 14 , 20 , 2 } ; int [ ] arr2 = { 5 , 9 , 6 , 3 } ; int N = arr1 . Length ; minimumSwaps ( arr1 , arr2 , N ) ; } }

Index/key variables: i
Accumulator variables: sumArr1, sumArr2
Iterator variables: i
Class/struct names: GFG
C# program:
using System ; class GFG { static void corpFlightBookings ( int [ , ] Bookings , int N ) { int [ ] res = new int [ N ] ; for ( int i = 0 ; i < Bookings . GetLength ( 0 ) ; i ++ ) { int l = Bookings [ i , 0 ] ; int r = Bookings [ i , 1 ] ; int K = Bookings [ i , 2 ] ; res [ l - 1 ] = res [ l - 1 ] + K ; if ( r <= res . Length - 1 ) res [ r ] = ( - K ) + res [ r ] ; } for ( int i = 1 ; i < res . Length ; i ++ ) res [ i ] = res [ i ] + res [ i - 1 ] ; for ( int i = 0 ; i < res . Length ; i ++ ) { Console . Write ( res [ i ] + " ▁ " ) ; } } public static void Main ( String [ ] args ) { int [ , ] bookings = { { 1 , 3 , 100 } , { 2 , 6 , 100 } , { 3 , 4 , 100 } } ; int N = 6 ; corpFlightBookings ( bookings , N ) ; } }

Index/key variables: N, i, r
Accumulator variables: i
Iterator variables: i
Class/struct names: GFG
C# program:
using System ; public class GFG { static int findXOR ( int n ) { switch ( n & 3 ) { case 0 : return n ; case 1 : return 1 ; case 2 : return n + 1 ; } return 0 ; } static void findOddXOR ( int n ) { if ( n % 2 == 0 ) Console . Write ( ( ( findXOR ( n ) ) ^ ( 2 * findXOR ( n / 2 ) ) ) ) ; else Console . Write ( ( ( findXOR ( n ) ) ^ ( 2 * findXOR ( ( n - 1 ) / 2 ) ) ) ) ; } public static void Main ( String [ ] args ) { int N = 11 ; findOddXOR ( N ) ; } }

Class/struct names: GFG
C# program:
using System ; class GFG { static void findSmallestNumber ( int n ) { for ( int i = n ; i <= ( n + 2520 ) ; ++ i ) { int possible = 1 ; int temp = i ; while ( temp != 0 ) { if ( temp % 10 != 0 ) { int digit = temp % 10 ; if ( i % digit != 0 ) { possible = 0 ; break ; } } temp /= 10 ; } if ( possible == 1 ) { Console . Write ( i ) ; return ; } } } public static void Main ( String [ ] args ) { int N = 31 ; findSmallestNumber ( N ) ; } }

Accumulator variables: temp
Iterator variables: i
Class/struct names: GFG
C# program:
using System ; class GFG { static void path_to_root ( int node ) { while ( node >= 1 ) { Console . Write ( node + " ▁ " ) ; node /= 2 ; } } public static void Main ( String [ ] args ) { int N = 7 ; path_to_root ( N ) ; } }

Accumulator variables: node
Class/struct names: GFG
C# program:
using System ; class GFG { static void findSmallestNumberPossible ( int N , int K ) { if ( N > 45 * K ) { Console . Write ( " - 1" ) ; return ; } string res = " " ; int count = 0 ; for ( int i = 9 ; i >= 1 ; ) { if ( count == K ) { i -- ; count = 0 ; } if ( N > i ) { N -= i ; res += ( char ) ( '0' + i ) ; } else { res += ( char ) ( '0' + N ) ; N = 0 ; break ; } count ++ ; } string ans = " " ; for ( int i = res . Length - 1 ; i >= 0 ; i -- ) { ans += res [ i ] + " " ; } Console . WriteLine ( ans ) ; } public static void Main ( ) { int N = 25 , K = 3 ; findSmallestNumberPossible ( N , K ) ; } }

Index/key variables: i
Accumulator variables: N, ans, count, i, res
Iterator variables: i
Class/struct names: GFG
C# program:
using System ; class GFG { static int minValue ( int [ ] arr , int n ) { Array . Sort ( arr ) ; int minimum = arr [ 0 ] ; int sum = 0 ; for ( int i = 0 ; i < n ; i ++ ) { sum = sum + ( arr [ i ] - minimum ) ; } return sum ; } static public void Main ( ) { int [ ] arr = { 1 , 2 , 3 } ; int N = arr . Length ; Console . WriteLine ( minValue ( arr , N ) ) ; } }

Index/key variables: i
Accumulator variables: i
Iterator variables: i
Class/struct names: GFG
C# program:
using System ; class GFG { static void result ( int n ) { if ( n > 45 ) { Console . Write ( - 1 ) ; return ; } string res = " " ; int digit = 9 ; while ( n > digit ) { res = ( char ) ( '0' + digit ) + res ; n -= digit ; digit -= 1 ; } if ( n > 0 ) { res = ( char ) ( '0' + n ) + res ; } Console . Write ( res ) ; } public static void Main ( ) { int N = 19 ; result ( N ) ; } }

Accumulator variables: digit, n
Class/struct names: GFG
C# program:
using System ; class GFG { public static int countEvenPairs ( int N , int M ) { int count = 0 ; int nEven = ( int ) Math . Floor ( ( double ) N / 2 ) ; int nOdd = ( int ) Math . Ceiling ( ( double ) N / 2 ) ; int mEven = ( int ) Math . Floor ( ( double ) M / 2 ) ; int mOdd = ( int ) Math . Ceiling ( ( double ) M / 2 ) ; count = nEven * mEven + nOdd * mOdd ; return count ; } public static void Main ( String [ ] args ) { int N = 4 ; int M = 6 ; Console . Write ( countEvenPairs ( N , M ) ) ; } }

Class/struct names: GFG
C# program:
using System ; class GFG { static char lastRemovedCharacter ( char [ ] str ) { int n = str . Length ; if ( n == 1 ) return str [ 0 ] ; if ( str [ n - 2 ] == '0' ) { return ( char ) ( '1' - str [ n - 1 ] + '0' ) ; } else return str [ n - 1 ] ; } public static void Main ( ) { string str = "10010" ; Console . Write ( lastRemovedCharacter ( str . ToCharArray ( ) ) ) ; } }

Class/struct names: GFG
C# program:
using System ; public class GFG { static void findNumbers ( int aXORb , int aANDb , int aXORc , int aANDc , int bXORc , int bANDc ) { int a , b , c ; int aSUMb ; int aSUMc ; int bSUMc ; aSUMb = aXORb + aANDb * 2 ; aSUMc = aXORc + aANDc * 2 ; bSUMc = bXORc + bANDc * 2 ; a = ( aSUMb - bSUMc + aSUMc ) / 2 ; b = aSUMb - a ; c = aSUMc - a ; System . Console . Write ( " a ▁ = ▁ " + a ) ; System . Console . Write ( " , ▁ b ▁ = ▁ " + b ) ; System . Console . Write ( " , ▁ c ▁ = ▁ " + c ) ; } static public void Main ( ) { int aXORb = 30 , aANDb = 0 , aXORc = 20 , aANDc = 10 , bXORc = 10 , bANDc = 20 ; findNumbers ( aXORb , aANDb , aXORc , aANDc , bXORc , bANDc ) ; } }

Class/struct names: GFG
C# program:
using System ; class GFG { static void findArray ( int N , int K ) { if ( N == 1 ) { Console . Write ( K + " ▁ " ) ; return ; } if ( N == 2 ) { Console . Write ( 0 + " ▁ " + K ) ; return ; } int P = N - 2 ; int Q = N - 1 ; int VAL = 0 ; for ( int i = 1 ; i <= ( N - 3 ) ; i ++ ) { Console . Write ( i + " ▁ " ) ; VAL ^= i ; } if ( VAL == K ) { Console . Write ( P + " ▁ " + Q + " ▁ " + ( P ^ Q ) ) ; } else { Console . Write ( 0 + " ▁ " + P + " ▁ " + ( P ^ K ^ VAL ) ) ; } } public static void Main ( ) { int N = 4 , X = 6 ; findArray ( N , X ) ; } }

Accumulator variables: VAL, i
Iterator variables: i
Class/struct names: GFG
C# program:
using System ; class GFG { static int findNumber ( int N ) { int count = 0 ; while ( ( N & 1 ) == 1 ) { N = N >> 1 ; count ++ ; } return N << count ; } public static void Main ( ) { int N = 39 ; Console . WriteLine ( findNumber ( N ) ) ; } }

Accumulator variables: count
Class/struct names: GFG
C# program:
using System ; class GFG { static int findNumber ( int N ) { return N & ( N + 1 ) ; } public static void Main ( String [ ] args ) { int N = 39 ; Console . Write ( findNumber ( N ) ) ; } }

Class/struct names: GFG
C# program:
using System ; using System . Collections . Generic ; class GFG { static List < string > subString ( string s , int n ) { List < string > v = new List < string > ( ) ; for ( int i = 0 ; i < n ; i ++ ) { for ( int len = 1 ; len <= n - i ; len ++ ) { string find = s . Substring ( i , len ) ; v . Add ( find ) ; } } return v ; } static int IsPresent ( string str , string target ) { if ( str . Contains ( target ) ) { return 1 ; } return - 1 ; } static void countSubStrings ( string S , string T ) { List < string > v = subString ( S , S . Length ) ; int ans = 0 ; foreach ( string it in v ) { if ( IsPresent ( it , T ) != - 1 ) { ans ++ ; } } Console . WriteLine ( ans ) ; } public static void Main ( string [ ] args ) { string S = " dabc " ; string T = " ab " ; countSubStrings ( S , T ) ; } }

Accumulator variables: ans, i, len
Iterator variables: i, it, len
Class/struct names: GFG
C# program:
using System ; class GFG { static void minOperation ( int [ ] X , int [ ] Y , int n ) { int C = 0 ; int count = 0 ; for ( int i = 1 ; i < n ; i = i + 2 ) { if ( X [ i ] != Y [ i ] ) { count ++ ; } else { if ( count != 0 ) C ++ ; count = 0 ; } } if ( count != 0 ) C ++ ; count = 0 ; for ( int i = 0 ; i < n ; i = i + 2 ) { if ( X [ i ] != Y [ i ] ) { count ++ ; } else { if ( count != 0 ) C ++ ; count = 0 ; } } if ( count != 0 ) C ++ ; Console . Write ( C ) ; } public static void Main ( String [ ] args ) { int [ ] X = { 1 , 0 , 0 , 0 , 0 , 1 } ; int [ ] Y = { 1 , 1 , 0 , 1 , 1 , 1 } ; int N = X . Length ; minOperation ( X , Y , N ) ; } }

Index/key variables: i
Accumulator variables: C, count
Iterator variables: i
Class/struct names: GFG
C# program:
using System ; class GFG { static int minimumcntOperationReq ( int [ ] arr , int N ) { int cntOp = 0 ; for ( int i = 0 ; i < N - 1 ; i ++ ) { if ( arr [ i ] == arr [ i + 1 ] ) { cntOp ++ ; } } return ( cntOp + 1 ) / 2 ; } static void Main ( ) { int [ ] arr = { 1 , 1 , 1 , 0 , 1 , 0 , 0 , 0 } ; int N = arr . Length ; Console . WriteLine ( minimumcntOperationReq ( arr , N ) ) ; } }

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