dhyuti-n/xlcost-variable-roles huggingface dataset:
C# program:
using System ; using System . Collections . Generic ; class GFG { static int k ; static void dfs ( List < int > [ ] graph , bool [ ] visited , int x ) { for ( int i = 0 ; i < graph [ x ] . Count ; i ++ ) { if ( ! visited [ graph [ x ] [ i ] ] ) { ( k ) ++ ; visited [ graph [ x ] [ i ] ] = true ; dfs ( graph , visited , graph [ x ] [ i ] ) ; } } } static int countNonAccessible ( List < int > [ ] graph , int N ) { bool [ ] visited = new bool [ N * N + N ] ; int ans = 0 ; for ( int i = 1 ; i <= N * N ; i ++ ) { if ( ! visited [ i ] ) { visited [ i ] = true ; int k = 1 ; dfs ( graph , visited , i ) ; ans += k * ( N * N - k ) ; } } return ans ; } static void insertpath ( List < int > [ ] graph , int N , int x1 , int y1 , int x2 , int y2 ) { int a = ( x1 - 1 ) * N + y1 ; int b = ( x2 - 1 ) * N + y2 ; graph [ a ] . Add ( b ) ; graph [ b ] . Add ( a ) ; } public static void Main ( String [ ] args ) { int N = 2 ; List < int > [ ] graph = new List < int > [ N * N + 1 ] ; for ( int i = 1 ; i <= N * N ; i ++ ) graph [ i ] = new List < int > ( ) ; insertpath ( graph , N , 1 , 1 , 1 , 2 ) ; insertpath ( graph , N , 1 , 2 , 2 , 2 ) ; Console . WriteLine ( countNonAccessible ( graph , N ) ) ; } }

Index/key variables: a, b, i, x
Accumulator variables: ans, i
Iterator variables: i
Class/struct names: GFG
C# program:
using System ; using System . Text ; class GFG { static void findMinimum ( String s ) { int n = s . Length ; int [ ] x = new int [ n + 1 ] ; StringBuilder s2 = new StringBuilder ( s ) ; s2 = reverse ( s2 . ToString ( ) ) ; String s3 = s2 . ToString ( ) ; for ( int i = 0 ; i < n ; i ++ ) { if ( s3 [ i ] == '1' ) { if ( x [ i ] == 1 ) { x [ i + 1 ] = 1 ; x [ i ] = 0 ; } else if ( 1 <= i && ( i & x [ i - 1 ] ) == 1 ) { x [ i + 1 ] = 1 ; x [ i - 1 ] = - 1 ; } else x [ i ] = 1 ; } } int c = 0 ; for ( int i = 0 ; i <= n ; i ++ ) { if ( x [ i ] != 0 ) c ++ ; } Console . WriteLine ( c ) ; } static StringBuilder reverse ( String input ) { char [ ] a = input . ToCharArray ( ) ; int l , r = a . Length - 1 ; for ( l = 0 ; l < r ; l ++ , r -- ) { char temp = a [ l ] ; a [ l ] = a [ r ] ; a [ r ] = temp ; } return new StringBuilder ( String . Join ( " " , a ) ) ; } public static void Main ( String [ ] args ) { String str = "111" ; findMinimum ( str ) ; } }

Index/key variables: i, l, r
Accumulator variables: c, i, l, r
Iterator variables: i, l
Class/struct names: GFG
C# program:
using System ; using System . Collections ; using System . Collections . Generic ; class GFG { static bool splitIntoFibonacciHelper ( int pos , string S , ArrayList seq ) { if ( pos == S . Length && ( seq . Count >= 3 ) ) { return true ; } long num = 0 ; for ( int i = pos ; i < S . Length ; i ++ ) { num = num * 10 + ( S [ i ] - '0' ) ; if ( num > Int64 . MaxValue ) break ; if ( S [ pos ] == '0' && i > pos ) break ; if ( seq . Count > 2 && ( num > ( ( long ) seq [ seq . Count - 1 ] + ( long ) seq [ seq . Count - 2 ] ) ) ) break ; if ( seq . Count < 2 || ( num == ( ( long ) seq [ seq . Count - 1 ] + ( long ) seq [ seq . Count - 2 ] ) ) ) { seq . Add ( num ) ; if ( splitIntoFibonacciHelper ( i + 1 , S , seq ) ) return true ; seq . Remove ( seq . Count - 1 ) ; } } return false ; } static void splitIntoFibonacci ( string S ) { ArrayList seq = new ArrayList ( ) ; splitIntoFibonacciHelper ( 0 , S , seq ) ; if ( seq . Count >= 3 ) { for ( int i = 0 ; i < seq . Count ; i ++ ) Console . Write ( seq [ i ] + " ▁ " ) ; } else { Console . Write ( " - 1" ) ; } } public static void Main ( string [ ] args ) { string S = "11235813" ; splitIntoFibonacci ( S ) ; } }

Index/key variables: i, pos
Accumulator variables: i
Iterator variables: i
Class/struct names: GFG
C# program:
using System ; class GFG { public static int good_pairs ( string [ ] str , int N ) { int [ ] arr = new int [ 32 ] ; int strCount = 0 ; for ( int i = 0 ; i < N ; i ++ ) { int Weight = 0 ; for ( int j = 0 ; j < str [ i ] . Length ; j ++ ) { switch ( str [ i ] [ j ] ) { case ' a ' : Weight = Weight | 1 ; break ; case ' e ' : Weight = Weight | 2 ; break ; case ' i ' : Weight = Weight | 4 ; break ; case ' o ' : Weight = Weight | 8 ; break ; case ' u ' : Weight = Weight | 16 ; break ; } } arr [ Weight ] ++ ; } for ( int i = 0 ; i < 32 ; i ++ ) { for ( int j = i + 1 ; j < 32 ; j ++ ) { if ( ( i j ) == 31 ) strCount += arr [ i ] * arr [ j ] ; } } strCount += ( arr [ 31 ] * ( arr [ 31 ] - 1 ) ) / 2 ; return strCount ; } public static void Main ( string [ ] args ) { string [ ] str = { " aaweiolkju " , " oxdfgujkmi " } ; int N = str . Length ; Console . Write ( good_pairs ( str , N ) ) ; } }

Index/key variables: Weight, i, j
Accumulator variables: i, j, strCount
Iterator variables: i, j
Class/struct names: GFG
C# program:
using System ; using System . Collections . Generic ; class GFG { static void solve ( List < int > arr , int r , int c ) { int idx = 1 ; int [ , ] dp = new int [ r , c ] ; for ( int i = 0 ; i < r ; i ++ ) { if ( i % 2 == 0 ) { for ( int j = 0 ; j < c ; j ++ ) { if ( arr [ idx - 1 ] == 0 ) idx ++ ; dp [ i , j ] = idx ; arr [ idx - 1 ] = arr [ idx - 1 ] - 1 ; } } else { for ( int j = c - 1 ; j >= 0 ; j -- ) { if ( arr [ idx - 1 ] == 0 ) idx ++ ; dp [ i , j ] = idx ; arr [ idx - 1 ] = arr [ idx - 1 ] - 1 ; } } } for ( int i = 0 ; i < r ; ++ i ) { for ( int j = 0 ; j < c ; ++ j ) { Console . Write ( dp [ i , j ] + " ▁ " ) ; } Console . Write ( ' STRNEWLINE ' ) ; } } public static void Main ( string [ ] args ) { int r = 3 , c = 5 ; List < int > arr = new List < int > ( ) ; arr . Add ( 1 ) ; arr . Add ( 2 ) ; arr . Add ( 3 ) ; arr . Add ( 4 ) ; arr . Add ( 5 ) ; solve ( arr , r , c ) ; } }

Accumulator variables: i, idx, j
Iterator variables: i, j
Class/struct names: GFG
C# program:
using System ; class GFG { public static int count ( int k , String s ) { int [ ] ar = new int [ s . Length ] ; int end = 0 ; for ( int i = 0 ; i < s . Length ; i ++ ) { if ( s [ i ] == '1' ) { for ( int j = i ; j < s . Length && j <= i + k ; j ++ ) { ar [ j ] = - 1 ; end = j ; } i = end ; } } end = 0 ; for ( int i = s . Length - 1 ; i >= 0 ; i -- ) { if ( s [ i ] == '1' ) { for ( int j = i ; j >= 0 && j >= i - k ; j -- ) { ar [ j ] = - 1 ; end = j ; } i = end ; } } int ans = 0 ; end = 0 ; for ( int j = 0 ; j < s . Length ; j ++ ) { if ( ar [ j ] == 0 ) { ans ++ ; for ( int g = j ; g <= j + k && g < s . Length ; g ++ ) { ar [ g ] = - 1 ; end = g ; } j = end - 1 ; } } return ans ; } public static void Main ( String [ ] args ) { int K = 2 ; String s = "000000" ; Console . WriteLine ( count ( K , s ) ) ; } }

Index/key variables: g, i, j
Accumulator variables: ans, g, i, j
Iterator variables: g, i, j
Class/struct names: GFG
C# program:
using System ; class GFG { static readonly int row = 6 ; static readonly int col = 7 ; static int [ , ] vis = new int [ row + 1 , col + 1 ] ; static int id ; static int diameter = 0 , length = 0 ; static int x = 0 , y = 0 ; static int [ ] dx = { - 1 , 1 , 0 , 0 } ; static int [ ] dy = { 0 , 0 , - 1 , 1 } ; static void dfs ( int a , int b , int [ , ] lis ) { vis [ a , b ] = id ; length ++ ; if ( length > diameter ) { x = a ; y = b ; diameter = length ; } for ( int j = 0 ; j < 4 ; j ++ ) { int cx = a + dx [ j ] ; int cy = b + dy [ j ] ; if ( cx < 0 cy < 0 cx >= row cy >= col lis [ cx , cy ] == 0 vis [ cx , cy ] > 0 ) { continue ; } dfs ( cx , cy , lis ) ; } vis [ a , b ] = 0 ; length -- ; } static void findMaximumLength ( int [ , ] lis ) { id ++ ; length = 0 ; diameter = 0 ; for ( int i = 0 ; i < row ; i ++ ) { for ( int j = 0 ; j < col ; j ++ ) { if ( lis [ i , j ] != 0 ) { dfs ( i , j , lis ) ; i = row ; break ; } } } id ++ ; length = 0 ; diameter = 0 ; dfs ( x , y , lis ) ; Console . Write ( diameter ) ; } public static void Main ( String [ ] args ) { int [ , ] grid = { { 0 , 0 , 0 , 0 , 0 , 0 , 0 } , { 0 , 1 , 0 , 1 , 0 , 0 , 0 } , { 0 , 1 , 0 , 1 , 0 , 0 , 0 } , { 0 , 1 , 0 , 1 , 0 , 1 , 0 } , { 0 , 1 , 1 , 1 , 1 , 1 , 0 } , { 0 , 0 , 0 , 1 , 0 , 0 , 0 } } ; findMaximumLength ( grid ) ; } }

Index/key variables: j
Accumulator variables: i, id, j, length
Iterator variables: i, j
Class/struct names: GFG
C# program:
using System ; namespace GFG { class GFG { public static String get_last_two_digit ( int N ) { if ( N % 4 == 0 ) return "01" ; else if ( N % 4 == 1 ) return "07" ; else if ( N % 4 == 2 ) return "49" ; return "43" ; } public static void Main ( ) { int N = 12 ; Console . Write ( get_last_two_digit ( N ) ) ; } } }

Class/struct names: GFG
C# program:
using System ; using System . Collections . Generic ; class GFG { static void getSubsequence ( int [ ] ar ) { int N = ar . Length ; List < int > ans = new List < int > ( ) ; ans . Add ( ar [ 0 ] ) ; for ( int i = 1 ; i < N - 1 ; i ++ ) { if ( ar [ i ] > ar [ i - 1 ] ) { if ( i < N - 1 && ar [ i ] <= ar [ i + 1 ] ) { continue ; } else { ans . Add ( ar [ i ] ) ; } } else { if ( i < N - 1 && ar [ i + 1 ] < ar [ i ] ) { continue ; } else { ans . Add ( ar [ i ] ) ; } } } ans . Add ( ar [ N - 1 ] ) ; foreach ( int it in ans ) Console . Write ( it + " ▁ " ) ; } public static void Main ( String [ ] args ) { int [ ] arr = { 1 , 2 , 4 , 3 , 5 } ; getSubsequence ( arr ) ; } }

Index/key variables: i
Accumulator variables: i
Iterator variables: i, it
Class/struct names: GFG
C# program:
using System ; using System . Collections . Generic ; public class GFG { static int curMax ; static int dfs ( List < int > [ ] g , int u , int v ) { int max1 = 0 , max2 = 0 , total = 0 ; for ( int i = 0 ; i < g [ u ] . Count ; i ++ ) { if ( g [ u ] [ i ] == v ) continue ; total = Math . Max ( total , dfs ( g , g [ u ] [ i ] , u ) ) ; if ( curMax > max1 ) { max2 = max1 ; max1 = curMax ; } else max2 = Math . Max ( max2 , curMax ) ; } total = Math . Max ( total , max1 + max2 ) ; curMax = max1 + 1 ; return total ; } static int maxProductOfTwoPaths ( List < int > [ ] g , int N ) { int res = int . MinValue ; int path1 , path2 ; for ( int i = 1 ; i < N + 2 ; i ++ ) { for ( int j = 0 ; j < g [ i ] . Count ; j ++ ) { curMax = 0 ; path1 = dfs ( g , g [ i ] [ j ] , i ) ; curMax = 0 ; path2 = dfs ( g , i , g [ i ] [ j ] ) ; res = Math . Max ( res , path1 * path2 ) ; } } return res ; } static void addEdge ( List < int > [ ] g , int u , int v ) { g [ u ] . Add ( v ) ; g [ v ] . Add ( u ) ; } public static void Main ( String [ ] args ) { int [ , ] edges = { { 1 , 8 } , { 2 , 6 } , { 3 , 1 } , { 5 , 3 } , { 7 , 8 } , { 8 , 4 } , { 8 , 6 } } ; int N = edges . GetLength ( 0 ) ; List < int > [ ] g = new List < int > [ N + 2 ] ; for ( int i = 0 ; i < g . Length ; i ++ ) g [ i ] = new List < int > ( ) ; for ( int i = 0 ; i < N ; i ++ ) addEdge ( g , edges [ i , 0 ] , edges [ i , 1 ] ) ; Console . Write ( maxProductOfTwoPaths ( g , N ) + " STRNEWLINE " ) ; } }

Index/key variables: i, j, u, v
Accumulator variables: i, j
Iterator variables: i, j
Class/struct names: GFG
C# program:
using System ; class GFG { static int Minsteps ( int n ) { int ans = 0 ; while ( n > 1 ) { if ( n % 5 == 0 ) { ans ++ ; n = n / 5 ; continue ; } else if ( n % 4 == 0 ) { ans ++ ; n = n / 4 ; continue ; } else if ( n % 3 == 0 ) { ans ++ ; n = n / 3 ; continue ; } else if ( n % 2 == 0 ) { ans ++ ; n = n / 2 ; continue ; } return - 1 ; } return ans ; } public static void Main ( ) { int n = 10 ; Console . Write ( Minsteps ( n ) ) ; } }

Accumulator variables: ans
Class/struct names: GFG
C# program:
using System ; using System . Collections . Generic ; class GFG { static int minDifference ( int num ) { char [ ] maximum = ( num . ToString ( ) ) . ToCharArray ( ) ; char [ ] minimum = ( num . ToString ( ) ) . ToCharArray ( ) ; int n = maximum . Length ; for ( int i = 0 ; i < n ; i ++ ) { if ( maximum [ i ] != '9' ) { char digit = maximum [ i ] ; for ( int j = i ; j < n ; j ++ ) { if ( maximum [ j ] == digit ) maximum [ j ] = '9' ; } break ; } } if ( minimum [ 0 ] == '1' ) { for ( int i = 1 ; i < n ; i ++ ) { if ( minimum [ i ] - '0' > 1 ) { char digit = minimum [ i ] ; for ( int j = i ; j < n ; j ++ ) { if ( digit == minimum [ j ] ) minimum [ j ] = '0' ; } break ; } } } else { char digit = minimum [ 0 ] ; for ( int i = 0 ; i < n ; i ++ ) { if ( minimum [ i ] == digit ) minimum [ i ] = '1' ; } } return Convert . ToInt32 ( string . Join ( " " , maximum ) ) - Convert . ToInt32 ( string . Join ( " " , minimum ) ) ; } static void Main ( ) { int N = 1101157 ; Console . Write ( minDifference ( 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 checkDivisible ( int x , int k ) { int g = __gcd ( x , k ) ; k /= g ; if ( x % k == 0 ) { Console . Write ( " YES STRNEWLINE " ) ; } else { Console . Write ( " NO STRNEWLINE " ) ; } } static int __gcd ( int a , int b ) { return b == 0 ? a : __gcd ( b , a % b ) ; } public static void Main ( String [ ] args ) { int x = 6 , k = 9 ; checkDivisible ( x , k ) ; } }

Accumulator variables: k
Class/struct names: GFG
C# program:
using System ; class GFG { static int MinimumValue ( int [ ] arr , int n ) { Array . Sort ( arr ) ; int minXor = Int32 . MaxValue ; int val = 0 ; for ( int i = 0 ; i < n - 1 ; i ++ ) { val = arr [ i ] ^ arr [ i + 1 ] ; minXor = Math . Min ( minXor , val ) ; } return minXor ; } public static void Main ( ) { int N = 6 ; int [ ] A = new int [ ] { 12 , 3 , 14 , 5 , 9 , 8 } ; Console . Write ( MinimumValue ( A , N ) ) ; } }

Index/key variables: i
Accumulator variables: i
Iterator variables: i
Class/struct names: GFG
C# program:
using System ; public class GFG { static int maxNormalSubString ( char [ ] P , char [ ] Q , int K , int N ) { if ( K == 0 ) return 0 ; int count = 0 ; int left = 0 , right = 0 ; int ans = 0 ; while ( right < N ) { while ( right < N && count <= K ) { int pos = P [ right ] - ' a ' ; if ( Q [ pos ] == '0' ) { if ( count + 1 > K ) break ; else count ++ ; } right ++ ; if ( count <= K ) ans = Math . Max ( ans , right - left ) ; } while ( left < right ) { int pos = P [ left ] - ' a ' ; left ++ ; if ( Q [ pos ] == '0' ) count -- ; if ( count < K ) break ; } } return ans ; } public static void Main ( String [ ] args ) { String P = " giraffe " , Q = "01111001111111111011111111" ; int K = 2 ; int N = P . Length ; Console . Write ( maxNormalSubString ( P . ToCharArray ( ) , Q . ToCharArray ( ) , K , N ) ) ; } }

Index/key variables: left, pos, right
Accumulator variables: count, left, right
Class/struct names: GFG
C# program:
using System ; class GFG { static int countOperations ( int [ ] arr , int n ) { int count = 0 ; for ( int i = 0 ; i < n - 1 ; i ++ ) { if ( arr [ i ] % 2 == 1 ) { arr [ i ] ++ ; arr [ i + 1 ] ++ ; count += 2 ; } } for ( int i = 0 ; i < n ; i ++ ) { if ( arr [ i ] % 2 == 1 ) return - 1 ; } return count ; } public static void Main ( ) { int [ ] arr = { 2 , 3 , 4 , 5 , 6 } ; int n = arr . Length ; Console . Write ( countOperations ( 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 countPairs ( int [ ] arr , int k ) { Array . Sort ( arr ) ; int pair = 0 ; int index = 0 ; while ( index < arr . Length - 1 ) { if ( arr [ index + 1 ] - arr [ index ] <= k ) { pair += 1 ; index += 2 ; } else { index += 1 ; } } return pair ; } public static void Main ( ) { int [ ] arr = { 1 , 4 , 3 , 7 , 5 } ; int k = 2 ; int count = countPairs ( arr , k ) ; Console . WriteLine ( count ) ; } }

Index/key variables: index
Accumulator variables: index, pair
Class/struct names: GFG
C# program:
using System ; class GFG { static int maxProfit ( int [ ] profitA , int [ ] profitB , int n ) { int [ ] preSum = new int [ n ] ; preSum [ 0 ] = profitA [ 0 ] ; for ( int i = 1 ; i < n ; i ++ ) { preSum [ i ] = preSum [ i - 1 ] + profitA [ i ] ; } int [ ] suffSum = new int [ n ] ; suffSum [ n - 1 ] = profitB [ n - 1 ] ; for ( int i = n - 2 ; i >= 0 ; i -- ) { suffSum [ i ] = suffSum [ i + 1 ] + profitB [ i ] ; } int res = preSum [ n - 1 ] ; for ( int i = 1 ; i < n - 1 ; i ++ ) { res = Math . Max ( res , preSum [ i ] + suffSum [ i + 1 ] ) ; } res = Math . Max ( res , suffSum [ 0 ] ) ; return res ; } public static void Main ( String [ ] args ) { int [ ] profitA = { 2 , 3 , 2 } ; int [ ] profitB = { 10 , 30 , 40 } ; int n = profitA . Length ; Console . WriteLine ( maxProfit ( profitA , profitB , n ) ) ; } }

Index/key variables: i, n
Accumulator variables: i
Iterator variables: i
Class/struct names: GFG
C# program:
using System ; using System . Collections . Generic ; class Pair { public int first ; public int second ; public Pair ( int first , int second ) { this . first = first ; this . second = second ; } } class GFG { static int minEdges ( List < Pair > v , int n ) { int [ , ] adj = new int [ n + 1 , n + 1 ] ; for ( int i = 0 ; i < v . Count ; i ++ ) { adj [ v [ i ] . first , v [ i ] . second ] = 1 ; adj [ v [ i ] . second , v [ i ] . first ] = 1 ; } int edgesNeeded = 0 ; for ( int i = 1 ; i <= n ; i ++ ) { for ( int j = i + 1 ; j <= n ; j ++ ) { for ( int k = j + 1 ; k <= n ; k ++ ) { if ( adj [ i , j ] == 1 && adj [ j , k ] == 1 && adj [ k , i ] == 1 ) return 0 ; if ( ! ( adj [ i , j ] == 1 adj [ j , k ] == 1 adj [ k , i ] == 1 ) ) edgesNeeded = Math . Min ( edgesNeeded , 3 ) ; else { if ( ( adj [ i , j ] == 1 && adj [ j , k ] == 1 ) || ( adj [ j , k ] == 1 && adj [ k , i ] == 1 ) || ( adj [ k , i ] == 1 && adj [ i , j ] == 1 ) ) { edgesNeeded = 1 ; } else edgesNeeded = Math . Min ( edgesNeeded , 2 ) ; } } } } return edgesNeeded ; } public static void Main ( String [ ] args ) { int n = 3 ; List < Pair > v = new List < Pair > ( ) ; v . Add ( new Pair ( 1 , 2 ) ) ; v . Add ( new Pair ( 1 , 3 ) ) ; Console . WriteLine ( minEdges ( v , n ) ) ; } }

Index/key variables: i
Accumulator variables: i, j, k
Iterator variables: i, j, k
Class/struct names: GFG, Pair
C# program:
using System ; using System . Collections . Generic ; class GFG { static int gcd ( int a , int b ) { if ( a == 0 ) return b ; return gcd ( b % a , a ) ; } static int FindMinOperation ( int [ ] a , int n , int k ) { List < int > Q = new List < int > ( ) ; for ( int i = 0 ; i < n ; i ++ ) Q . Add ( a [ i ] ) ; Q . Sort ( ) ; int ans = 0 ; while ( true ) { if ( Q [ 0 ] >= k ) break ; if ( Q . Count < 2 ) return - 1 ; int x = Q [ 0 ] ; Q . RemoveAt ( 0 ) ; int y = Q [ 0 ] ; Q . RemoveAt ( 0 ) ; int z = ( x * y ) / gcd ( x , y ) ; Q . Add ( z ) ; Q . Sort ( ) ; ans ++ ; } return ans ; } static void Main ( ) { int [ ] a = { 3 , 5 , 7 , 6 , 8 } ; int k = 8 ; int n = a . Length ; Console . WriteLine ( FindMinOperation ( a , n , k ) ) ; } }

Index/key variables: i
Accumulator variables: ans, i
Iterator variables: i
Class/struct names: GFG
C# program:
using System ; using System . Collections ; class GfG { static string Check ( int [ , ] a , int [ , ] b , int n , int m ) { for ( int i = 0 ; i < n ; i ++ ) for ( int j = 0 ; j < m ; j ++ ) if ( a [ i , j ] > b [ i , j ] ) { int tmp = a [ i , j ] ; a [ i , j ] = b [ i , j ] ; b [ i , j ] = tmp ; } for ( int i = 0 ; i < n ; i ++ ) for ( int j = 0 ; j < m - 1 ; j ++ ) if ( a [ i , j ] >= a [ i , j + 1 ] b [ i , j ] >= b [ i , j + 1 ] ) return " No " ; for ( int i = 0 ; i < n - 1 ; i ++ ) for ( int j = 0 ; j < m ; j ++ ) if ( a [ i , j ] >= a [ i + 1 , j ] b [ i , j ] >= b [ i + 1 , j ] ) return " No " ; return " Yes " ; } public static void Main ( string [ ] arg ) { int n = 2 , m = 2 ; int [ , ] a = { { 2 , 10 } , { 11 , 5 } } ; int [ , ] b = { { 9 , 4 } , { 3 , 12 } } ; Console . Write ( Check ( a , b , n , m ) ) ; } }

Accumulator variables: i, j
Iterator variables: i, j
Class/struct names: GfG
C# program:
using System ; class GFG { static string smallestString ( int N , int [ ] A ) { char ch = ' a ' ; string S = " " ; if ( N < 1 A [ 0 ] != 1 ) { S = " - 1" ; return S ; } S += ch ; ch ++ ; for ( int i = 1 ; i < N ; i ++ ) { int diff = A [ i ] - A [ i - 1 ] ; if ( diff > 1 diff < 0 A [ i ] > 26 ) { S = " - 1" ; return S ; } else if ( diff == 0 ) S += ' a ' ; else { S += ch ; ch ++ ; } } return S ; } static void Main ( ) { int [ ] arr = { 1 , 1 , 2 , 3 , 3 } ; int n = arr . Length ; Console . WriteLine ( smallestString ( n , arr ) ) ; } }

Index/key variables: i
Accumulator variables: S, ch, i
Iterator variables: i
Class/struct names: GFG
C# program:
using System ; class GFG { static bool canBePicked ( int [ ] digits , int num ) { int [ ] copyDigits = ( int [ ] ) digits . Clone ( ) ; while ( num > 0 ) { int digit = num % 10 ; if ( copyDigits [ digit ] == 0 ) return false ; else copyDigits [ digit ] -- ; num /= 10 ; } return true ; } static int countAlphabets ( int n ) { int i , count = 0 ; int [ ] digits = new int [ 10 ] ; while ( n > 0 ) { int digit = n % 10 ; digits [ digit ] ++ ; n /= 10 ; } for ( i = ' a ' ; i <= ' z ' ; i ++ ) if ( canBePicked ( digits , i ) ) count ++ ; for ( i = ' A ' ; i <= ' Z ' ; i ++ ) if ( canBePicked ( digits , i ) ) count ++ ; return count ; } public static void Main ( ) { int n = 1623455078 ; Console . WriteLine ( countAlphabets ( n ) ) ; } }

Index/key variables: digit
Accumulator variables: count, i, n, num
Iterator variables: i
Class/struct names: GFG
C# program:
using System ; class GFG { static int countSetBits ( int n ) { int count = 0 ; while ( n > 0 ) { count += n & 1 ; n >>= 1 ; } return count ; } static int greatestKBits ( int X , int K ) { int set_bit_count = countSetBits ( X ) ; if ( set_bit_count <= K ) return X ; int diff = set_bit_count - K ; for ( int i = 0 ; i < diff ; i ++ ) X &= ( X - 1 ) ; return X ; } public static void Main ( ) { int X = 21 , K = 2 ; Console . WriteLine ( greatestKBits ( X , K ) ) ; } }

Accumulator variables: X, count, i
Iterator variables: i
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 findTwoNumbers ( int sum , int gcd ) { if ( __gcd ( gcd , sum - gcd ) == gcd && sum != gcd ) Console . WriteLine ( " a ▁ = ▁ " + Math . Min ( gcd , sum - gcd ) + " , ▁ b ▁ = ▁ " + ( int ) ( sum - Math . Min ( gcd , sum - gcd ) ) ) ; else Console . WriteLine ( - 1 ) ; } public static void Main ( ) { int sum = 8 ; int gcd = 2 ; findTwoNumbers ( sum , gcd ) ; } }

Class/struct names: GFG
C# program:
using System ; class GFG { static int findMaxDistance ( int numOfCities , int [ ] station , int n ) { bool [ ] hasStation = new bool [ numOfCities + 1 ] ; for ( int city = 0 ; city < n ; city ++ ) { hasStation [ station [ city ] ] = true ; } int dist = 0 ; int maxDist = int . MaxValue ; for ( int i = 0 ; i < n ; i ++ ) { maxDist = Math . Min ( station [ i ] , maxDist ) ; } for ( int city = 0 ; city < numOfCities ; city ++ ) { if ( hasStation [ city ] == true ) { maxDist = Math . Max ( ( dist + 1 ) / 2 , maxDist ) ; dist = 0 ; } else dist += 1 ; } return Math . Max ( maxDist , dist ) ; } public static void Main ( String [ ] args ) { int numOfCities = 6 ; int [ ] station = { 3 , 1 } ; int n = station . Length ; Console . WriteLine ( " Max ▁ Distance : " + findMaxDistance ( numOfCities , station , n ) ) ; } }

Index/key variables: city, i
Accumulator variables: city, dist, i
Iterator variables: city, i
Class/struct names: GFG
C# program:
using System ; public class GFG { static void split ( int x , int n ) { if ( x < n ) Console . WriteLine ( " - 1 ▁ " ) ; else if ( x % n == 0 ) { for ( int i = 0 ; i < n ; i ++ ) Console . Write ( ( x / n ) + " ▁ " ) ; } else { int zp = n - ( x % n ) ; int pp = x / n ; for ( int i = 0 ; i < n ; i ++ ) { if ( i >= zp ) Console . Write ( ( pp + 1 ) + " ▁ " ) ; else Console . Write ( pp + " ▁ " ) ; } } } static public void Main ( ) { int x = 5 ; int n = 3 ; split ( x , n ) ; } }

Accumulator variables: i
Iterator variables: i
Class/struct names: GFG
C# program:
using System ; public class GFG { static long cal_minimum_time ( long X ) { long t = 0 ; long sum = 0 ; while ( sum < X ) { t ++ ; sum = sum + t ; } return t ; } static public void Main ( ) { long n = 6 ; long ans = cal_minimum_time ( n ) ; Console . WriteLine ( " The ▁ minimum ▁ time ▁ required ▁ is ▁ : ▁ " + ans ) ; } }

Accumulator variables: t
Class/struct names: GFG