dhyuti-n/xlcost-variable-roles huggingface dataset:
C# program:
using System ; using System . Collections . Generic ; class GFG { static bool isPrime ( int n ) { if ( n <= 1 ) return false ; if ( n <= 3 ) return true ; if ( n % 2 == 0 n % 3 == 0 ) return false ; for ( int i = 5 ; i * i <= n ; i = i + 6 ) { if ( n % i == 0 || n % ( i + 2 ) == 0 ) { return false ; } } return true ; } static void sumOfPrimeSquare ( int n ) { int i = 0 ; List < int > squares = new List < int > ( ) ; while ( i * i < n ) { squares . Add ( i * i ) ; i ++ ; } bool flag = false ; for ( i = 0 ; i < squares . Count ; i ++ ) { int difference = n - squares [ i ] ; if ( isPrime ( difference ) ) { flag = true ; break ; } } if ( flag ) { Console . Write ( " Yes " ) ; } else Console . Write ( " No " ) ; } public static void Main ( ) { int N = 27 ; sumOfPrimeSquare ( N ) ; } }

Index/key variables: i
Accumulator variables: i
Iterator variables: i
Boolean variables: flag
Class/struct names: GFG
C# program:
using System ; class GFG { static void SieveOfEratosthenes ( bool [ ] prime , int n ) { prime [ 0 ] = false ; prime [ 1 ] = false ; for ( int p = 2 ; p * p <= n ; p ++ ) { if ( prime [ p ] == true ) { for ( int i = p * p ; i <= n ; i += p ) { prime [ i ] = false ; } } } } static void sumOfPrimeSquare ( int n ) { bool flag = false ; bool [ ] prime = new bool [ n + 1 ] ; Array . Fill ( prime , true ) ; SieveOfEratosthenes ( prime , n ) ; for ( int i = 0 ; i <= n ; i ++ ) { if ( ! prime [ i ] ) continue ; int dif = n - i ; if ( Math . Ceiling ( ( double ) Math . Sqrt ( dif ) ) == Math . Floor ( ( double ) Math . Sqrt ( dif ) ) ) { flag = true ; break ; } } if ( flag ) { Console . WriteLine ( " Yes " ) ; } else Console . WriteLine ( " No " ) ; } public static void Main ( ) { int N = 27 ; sumOfPrimeSquare ( N ) ; } }

Index/key variables: i, p
Accumulator variables: i, p
Iterator variables: i, p
Boolean variables: flag
Class/struct names: GFG
C# program:
using System ; class GFG { static bool check ( int [ ] arr , int M , int K , int ind ) { for ( int i = 0 ; i < M ; i ++ ) { for ( int j = 1 ; j < K ; j ++ ) { if ( arr [ ind + i ] != arr [ ind + i + j * M ] ) { return false ; } } } return true ; } static bool SubarrayRepeatsKorMore ( int [ ] arr , int N , int M , int K ) { for ( int ind = 0 ; ind <= N - M * K ; ind ++ ) { if ( check ( arr , M , K , ind ) ) { return true ; } } return false ; } static void Main ( ) { int [ ] arr = { 2 , 1 , 2 , 1 , 1 , 1 , 3 } ; int M = 2 , K = 2 ; int N = arr . Length ; if ( SubarrayRepeatsKorMore ( arr , N , M , K ) ) { Console . WriteLine ( " Yes " ) ; } else { Console . WriteLine ( " No " ) ; } } }

Accumulator variables: i, ind, j
Iterator variables: i, ind, j
Class/struct names: GFG
C# program:
using System ; class GFG { public static bool checkExists ( int [ ] arr , int N , int M , int K ) { int count = 0 ; for ( int i = 0 ; i < N - M ; i ++ ) { if ( arr [ i ] == arr [ i + M ] ) count ++ ; else count = 0 ; if ( count == M * ( K - 1 ) ) return true ; } return false ; } public static void Main ( ) { int [ ] arr = { 2 , 1 , 2 , 1 , 1 , 1 , 3 } ; int N = arr . Length ; int M = 2 , K = 2 ; if ( checkExists ( arr , N , M , K ) ) { Console . WriteLine ( " Yes " ) ; } else { Console . WriteLine ( " No " ) ; } } }

Index/key variables: i
Accumulator variables: count, i
Iterator variables: i
Class/struct names: GFG
C# program:
using System ; class GFG { static int CommonDigits ( int N , int M ) { int count = 0 ; int [ ] freq1 = new int [ 10 ] ; int [ ] freq2 = new int [ 10 ] ; while ( N > 0 ) { freq1 [ N % 10 ] ++ ; N = N / 10 ; } while ( M > 0 ) { freq2 [ M % 10 ] ++ ; M = M / 10 ; } for ( int i = 0 ; i < 10 ; i ++ ) { if ( freq1 [ i ] > 0 & freq2 [ i ] > 0 ) { count ++ ; } } return count ; } static void Main ( ) { int N = 748294 ; int M = 34298156 ; Console . WriteLine ( CommonDigits ( N , M ) ) ; } }

Index/key variables: i
Accumulator variables: count, i
Iterator variables: i
Class/struct names: GFG
C# program:
using System ; class GFG { static void minimumNumber ( int K , int X ) { if ( K > X ) { Console . Write ( " - 1" ) ; return ; } int ans = 0 ; int sum = 0 ; for ( int i = K ; i <= X ; i ++ ) { sum += i ; if ( sum >= X ) { ans = i ; break ; } } Console . Write ( ans ) ; } public static void Main ( ) { int K = 5 , X = 13 ; minimumNumber ( K , X ) ; } }

Accumulator variables: i, sum
Iterator variables: i
Class/struct names: GFG
C# program:
using System ; class GFG { static bool isGreaterEqual ( int N , int K , int X ) { return ( ( N * 1L * ( N + 1 ) / 2 ) - ( ( K - 1 ) * 1L * K / 2 ) ) >= X ; } static void minimumNumber ( int K , int X ) { if ( K > X ) { Console . Write ( " - 1" ) ; return ; } int low = K , high = X , res = - 1 ; while ( low <= high ) { int mid = low + ( high - low ) / 2 ; if ( isGreaterEqual ( mid , K , X ) ) { res = mid ; high = mid - 1 ; } else low = mid + 1 ; } Console . WriteLine ( res ) ; } public static void Main ( ) { int K = 5 , X = 13 ; minimumNumber ( K , X ) ; } }

Class/struct names: GFG
C# program:
using System ; class GFG { static int CountPairs ( int [ ] arr , int n ) { int count = 0 ; for ( int i = 0 ; i < n - 1 ; i ++ ) { for ( int j = i + 1 ; j < n ; j ++ ) { if ( ( i * j ) == ( arr [ i ] * arr [ j ] ) ) count ++ ; } } return count ; } public static void Main ( ) { int [ ] arr = { 1 , 0 , 3 , 2 , 6 } ; int N = arr . Length ; Console . Write ( CountPairs ( arr , 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 ; using System . Collections . Generic ; class GFG { static int distance ; static void dfs ( int src , List < List < int > > Adj , List < bool > visited , int level ) { visited [ src ] = true ; distance = Math . Max ( distance , level ) ; foreach ( int child in Adj [ src ] ) { if ( ( child != src ) && ( visited [ child ] == false ) ) { dfs ( child , Adj , visited , level + 1 ) ; } } visited [ src ] = false ; } static int maximumLength ( int [ , ] mat , int v ) { distance = 0 ; int N = mat . GetLength ( 0 ) ; List < bool > visited = new List < bool > ( ) ; for ( int i = 0 ; i < N ; i ++ ) { visited . Add ( false ) ; } List < List < int > > Adj = new List < List < int > > ( N ) ; for ( int i = 0 ; i < N ; i ++ ) { Adj . Add ( new List < int > ( ) ) ; } for ( int i = 0 ; i < mat . GetLength ( 0 ) ; i ++ ) { for ( int j = 0 ; j < mat . GetLength ( 0 ) ; j ++ ) { if ( mat [ i , j ] == 1 ) { Adj [ i ] . Add ( j ) ; } } } dfs ( v , Adj , visited , 0 ) ; return distance ; } static void Main ( ) { int [ , ] mat = { { 0 , 1 , 0 , 0 } , { 1 , 0 , 1 , 1 } , { 0 , 1 , 0 , 0 } , { 0 , 1 , 0 , 0 } } ; int v = 2 ; Console . Write ( maximumLength ( mat , v ) ) ; } }

Index/key variables: child, i, src
Accumulator variables: i, j
Iterator variables: child, i, j
Class/struct names: GFG
C# program:
using System ; using System . Collections . Generic ; class GFG { static int findLength ( string s , char i , char j ) { char required = i ; int length = 0 ; for ( int k = 0 ; k < s . Length ; k ++ ) { char curr = s [ k ] ; if ( curr == required ) { length += 1 ; if ( required == i ) required = j ; else required = i ; } } return length ; } static int minimumDeletions ( string S ) { int len = 0 ; int n = S . Length ; for ( int i = 0 ; i < 26 ; i ++ ) { for ( int j = i + 1 ; j < 26 ; j ++ ) { int newLen = findLength ( S , ( char ) ( i + 97 ) , ( char ) ( j + 97 ) ) ; len = Math . Max ( len , newLen ) ; } } return n - len ; } public static void Main ( string [ ] args ) { string S = " adebbeeaebd " ; Console . WriteLine ( minimumDeletions ( S ) ) ; } }

Index/key variables: k
Accumulator variables: i, j, k, length
Iterator variables: i, j, k
Class/struct names: GFG
C# program:
using System ; public class GFG { static int inv ( int a , int m ) { int m0 = m , t , q ; int x0 = 0 , x1 = 1 ; if ( m == 1 ) return 0 ; while ( a > 1 ) { q = a / m ; t = m ; m = a % m ; a = t ; t = x0 ; x0 = x1 - q * x0 ; x1 = t ; } if ( x1 < 0 ) x1 += m0 ; return x1 ; } static int findMinX ( int [ ] A , int [ ] B , int N ) { int prod = 1 ; for ( int i = 0 ; i < N ; i ++ ) prod *= A [ i ] ; int result = 0 ; for ( int i = 0 ; i < N ; i ++ ) { int pp = prod / A [ i ] ; result += B [ i ] * inv ( pp , A [ i ] ) * pp ; } return result % prod ; } static int product ( int [ ] a ) { int ans = 1 ; for ( int i = 0 ; i < a . Length ; i ++ ) { ans *= a [ i ] ; } return ans ; } public static void findSmallestInteger ( int [ ] A , int [ ] B , int P ) { int Y = findMinX ( A , B , A . Length ) ; int M = product ( A ) ; int K = ( int ) Math . Ceiling ( ( ( double ) P - ( double ) Y ) / ( double ) M ) ; int X = Y + K * M ; Console . WriteLine ( X ) ; } public static void Main ( string [ ] args ) { int [ ] A = { 3 , 4 , 5 } ; int [ ] B = { 2 , 3 , 1 } ; int P = 72 ; findSmallestInteger ( A , B , P ) ; } }

Index/key variables: i
Accumulator variables: ans, i, prod, result, x1
Iterator variables: i
Class/struct names: GFG
C# program:
using System ; public class GFG { static void numberOfGates ( string s ) { int N = s . Length ; int ans = 0 ; for ( int i = 0 ; i < s . Length ; i ++ ) { if ( s [ i ] == ' . ' s [ i ] == ' + ' s [ i ] == '1' ) { ans ++ ; } } Console . WriteLine ( ans ) ; } public static void Main ( string [ ] args ) { string S = " ( 1 - A ) . B + C " ; numberOfGates ( S ) ; } }

Index/key variables: i
Accumulator variables: ans, i
Iterator variables: i
Class/struct names: GFG
C# program:
using System ; class GFG { static void findPairs ( int [ ] arr , int N ) { for ( int i = 0 ; i < N ; i ++ ) arr [ i ] = Math . Abs ( arr [ i ] ) ; Array . Sort ( arr ) ; int left = 0 ; int ans = 0 ; for ( int right = 0 ; right < N ; right ++ ) { while ( 2 * arr [ left ] < arr [ right ] ) left ++ ; ans += ( right - left ) ; } Console . Write ( ans ) ; } public static void Main ( string [ ] args ) { int [ ] arr = { 1 , 3 , 5 , 7 } ; int N = arr . Length ; findPairs ( arr , N ) ; } }

Index/key variables: i, left, right
Accumulator variables: ans, i, left, right
Iterator variables: i, right
Class/struct names: GFG
C# program:
using System ; class GFG { static int GetDiff ( int [ ] A , int N ) { int [ ] SuffMaxArr = new int [ N ] ; SuffMaxArr [ N - 1 ] = A [ N - 1 ] ; for ( int i = N - 2 ; i >= 0 ; -- i ) { SuffMaxArr [ i ] = Math . Max ( SuffMaxArr [ i + 1 ] , A [ i + 1 ] ) ; } int MaximumSum = Int32 . MinValue ; for ( int i = 0 ; i < N - 1 ; i ++ ) { if ( A [ i ] < SuffMaxArr [ i ] ) MaximumSum = Math . Max ( MaximumSum , A [ i ] + SuffMaxArr [ i ] ) ; } int MinimumSum = Int32 . MaxValue ; int [ ] SuffMinArr = new int [ N ] ; SuffMinArr [ N - 1 ] = Int32 . MaxValue ; for ( int i = N - 2 ; i >= 0 ; -- i ) { SuffMinArr [ i ] = Math . Min ( SuffMinArr [ i + 1 ] , A [ i + 1 ] ) ; } for ( int i = 0 ; i < N - 1 ; i ++ ) { if ( A [ i ] < SuffMinArr [ i ] ) { MinimumSum = Math . Min ( MinimumSum , A [ i ] + SuffMinArr [ i ] ) ; } } return Math . Abs ( MaximumSum - MinimumSum ) ; } public static void Main ( String [ ] args ) { int [ ] arr = { 2 , 4 , 1 , 3 , 7 , 5 , 6 } ; int N = arr . Length ; Console . WriteLine ( GetDiff ( arr , N ) ) ; } }

Index/key variables: N, i
Accumulator variables: i
Iterator variables: i
Class/struct names: GFG
C# program:
using System ; class GFG { static void minimumSwaps ( int [ ] arr , int N ) { int even = 0 , odd = 0 ; for ( int i = 0 ; i < N ; i ++ ) { if ( arr [ i ] % 2 != i % 2 ) { if ( i % 2 == 0 ) { even ++ ; } else { odd ++ ; } } } if ( even != odd ) { Console . WriteLine ( - 1 ) ; } else { Console . WriteLine ( even ) ; } } public static void Main ( ) { int [ ] arr = { 3 , 2 , 7 , 6 } ; int N = arr . Length ; minimumSwaps ( arr , N ) ; } }

Index/key variables: i
Accumulator variables: even, i, odd
Iterator variables: i
Class/struct names: GFG
C# program:
using System ; class GFG { static int mininsert ( int [ ] arr , int K , int N ) { int ans = 0 ; for ( int i = 0 ; i < N - 1 ; i ++ ) { int a = Math . Min ( arr [ i ] , arr [ i + 1 ] ) ; int b = Math . Max ( arr [ i ] , arr [ i + 1 ] ) ; while ( K * a < b ) { a *= K ; ans ++ ; } } return ans ; } public static void Main ( string [ ] args ) { int [ ] arr = { 2 , 10 , 25 , 21 } ; int K = 2 ; int N = arr . Length ; Console . Write ( mininsert ( arr , K , N ) ) ; } }

Index/key variables: i
Accumulator variables: a, ans, i
Iterator variables: i
Class/struct names: GFG
C# program:
using System ; class GFG { static int sumOfDigits ( string s ) { int curr = 0 ; int ret = 0 ; foreach ( char ch in s ) { if ( ch >= 48 && ch <= 57 ) { curr = curr * 10 + ch - '0' ; } else { ret += curr ; curr = 0 ; } } ret += curr ; return ret ; } static void Main ( ) { string S = "11aa32bbb5" ; Console . WriteLine ( sumOfDigits ( S ) ) ; } }

Accumulator variables: ret
Iterator variables: ch
Class/struct names: GFG
C# program:
using System ; public class GFG { static void print_triplet ( int [ ] arr , int n ) { for ( int i = 1 ; i <= n - 2 ; i ++ ) { if ( arr [ i - 1 ] < arr [ i ] && arr [ i ] > arr [ i + 1 ] ) { Console . Write ( i - 1 + " ▁ " + i + " ▁ " + ( i + 1 ) ) ; return ; } } Console . Write ( - 1 ) ; } public static void Main ( String [ ] args ) { int [ ] arr = { 4 , 3 , 5 , 2 , 1 , 6 } ; int N = arr . Length ; print_triplet ( arr , N ) ; } }

Index/key variables: i
Accumulator variables: i
Iterator variables: i
Class/struct names: GFG
C# program:
using System ; class GFG { static void findConcatenatedNumbers ( int [ ] a , int [ ] b ) { bool ans = true ; int n1 = a . Length ; int n2 = b . Length ; int [ ] cnt = new int [ 100000 ] ; for ( int i = 0 ; i < n1 ; i ++ ) { cnt [ a [ i ] ] = 1 ; } for ( int i = 0 ; i < n2 ; i ++ ) { int left = b [ i ] ; int right = 0 ; int mul = 1 ; while ( left > 9 ) { right += ( left % 10 ) * mul ; left /= 10 ; mul *= 10 ; if ( cnt [ left ] == 1 && cnt [ right ] == 1 ) { ans = false ; Console . Write ( b [ i ] + " ▁ " ) ; } } } if ( ans ) Console . Write ( " - 1" ) ; } public static void Main ( String [ ] args ) { int [ ] a = { 2 , 34 , 4 , 5 } ; int [ ] b = { 26 , 24 , 345 , 4 , 22 } ; findConcatenatedNumbers ( a , b ) ; } }

Index/key variables: i, left, right
Accumulator variables: i, left, mul, right
Iterator variables: i
Boolean variables: ans
Class/struct names: GFG
C# program:
using System ; public class GFG { static void evenproduct ( int [ ] arr , int length ) { int count = 0 ; for ( int i = 0 ; i < arr . Length ; i ++ ) { int product = 1 ; for ( int j = i ; j < arr . Length ; j ++ ) { product *= arr [ j ] ; if ( product % 2 == 0 ) ++ count ; } } Console . WriteLine ( count ) ; } public static void Main ( string [ ] args ) { int [ ] arr = { 7 , 5 , 4 , 9 } ; int length = arr . Length - 1 ; evenproduct ( arr , length ) ; } }

Index/key variables: j
Accumulator variables: i, j, product
Iterator variables: i, j
Class/struct names: GFG
C# program:
using System ; using System . Collections . Generic ; public class GFG { static int ans = 0 ; static List < int > [ ] adj = new List < int > [ ( int ) ( 1e5 ) + 1 ] ; static void dfsUtil ( int u , int par , int depth ) { foreach ( int it in adj [ u ] ) { if ( it != par ) { dfsUtil ( it , u , depth + 1 ) ; } } ans += depth ; } static void dfs ( int u , int par , int depth ) { dfsUtil ( u , par , depth ) ; Console . Write ( ans + " STRNEWLINE " ) ; } static void countPairs ( int [ , ] edges ) { for ( int i = 0 ; i < edges . GetLength ( 0 ) ; i ++ ) { int u = edges [ i , 0 ] ; int v = edges [ i , 1 ] ; adj [ u ] . Add ( v ) ; adj [ v ] . Add ( u ) ; } dfs ( 1 , 1 , 1 ) ; } public static void Main ( String [ ] args ) { int [ , ] edges = { { 1 , 2 } , { 1 , 3 } , { 2 , 4 } } ; for ( int i = 0 ; i < adj . GetLength ( 0 ) ; i ++ ) adj [ i ] = new List < int > ( ) ; countPairs ( edges ) ; } }

Index/key variables: i, u, v
Accumulator variables: ans, i
Iterator variables: i, it
Class/struct names: GFG
C# program:
using System ; using System . Collections . Generic ; class GFG { class TreeNode { public int val ; public TreeNode left , right ; } ; static TreeNode newNode ( int key ) { TreeNode temp = new TreeNode ( ) ; temp . val = key ; temp . left = temp . right = null ; return temp ; } static int convertBinaryToDecimal ( List < int > arr ) { int ans = 0 ; foreach ( int i in arr ) ans = ( ans << 1 ) | i ; return ans ; } static void decimalEquilvalentAtEachLevel ( TreeNode root ) { int ans = 0 ; Queue < TreeNode > que = new Queue < TreeNode > ( ) ; que . Enqueue ( root ) ; while ( true ) { int length = que . Count ; if ( length == 0 ) break ; List < int > eachLvl = new List < int > ( ) ; while ( length > 0 ) { TreeNode temp = que . Peek ( ) ; que . Dequeue ( ) ; eachLvl . Add ( temp . val ) ; if ( temp . left != null ) que . Enqueue ( temp . left ) ; if ( temp . right != null ) que . Enqueue ( temp . right ) ; length -= 1 ; } ans += convertBinaryToDecimal ( eachLvl ) ; } Console . WriteLine ( ans ) ; } public static void Main ( ) { TreeNode root = newNode ( 0 ) ; root . left = newNode ( 1 ) ; root . right = newNode ( 0 ) ; root . left . left = newNode ( 0 ) ; root . left . right = newNode ( 1 ) ; root . right . left = newNode ( 1 ) ; root . right . right = newNode ( 1 ) ; decimalEquilvalentAtEachLevel ( root ) ; } }

Accumulator variables: ans, length
Iterator variables: i
Class/struct names: GFG, TreeNode
C# program:
using System ; using System . Collections . Generic ; class GFG { static void minimumOperations ( int [ ] arr , int N ) { int oddCnt = 0 , evenCnt = 0 ; for ( int i = 0 ; i < N ; i ++ ) { if ( arr [ i ] % 2 == 0 ) { evenCnt ++ ; } else { oddCnt ++ ; } } Console . Write ( Math . Min ( oddCnt , evenCnt ) ) ; } static void Main ( ) { int [ ] arr = { 4 , 1 , 2 } ; int N = arr . Length ; minimumOperations ( arr , N ) ; } }

Index/key variables: i
Accumulator variables: evenCnt, i, oddCnt
Iterator variables: i
Class/struct names: GFG
C# program:
using System ; public class GFG { static int minIncr ( int [ ] arr , int n ) { int forEven = 0 ; for ( int i = 0 ; i < n ; i ++ ) { if ( i % 2 == 1 ) { if ( ( arr [ i ] % 2 ) == 0 ) forEven += 1 ; } else { if ( arr [ i ] % 2 == 1 ) forEven += 1 ; } } return Math . Min ( forEven , n - forEven ) ; } public static void Main ( String [ ] args ) { int [ ] arr = { 1 , 4 , 6 , 8 , 9 , 5 } ; int n = arr . Length ; Console . WriteLine ( minIncr ( arr , n ) ) ; } }

Index/key variables: i
Accumulator variables: forEven, i
Iterator variables: i
Class/struct names: GFG
C# program:
using System ; using System . Collections . Generic ; class GFG { static void minOperations ( int [ ] arr , int N , int [ ] Q , int M ) { Dictionary < int , int > m1 = new Dictionary < int , int > ( ) ; Dictionary < int , int > m2 = new Dictionary < int , int > ( ) ; int front = 0 , rear = 0 ; for ( int i = 0 ; i < N ; i ++ ) { front += arr [ i ] ; m1 [ arr [ i ] ] = front ; } for ( int i = N - 1 ; i >= 0 ; i -- ) { rear += arr [ i ] ; m2 [ arr [ i ] ] = rear ; } for ( int i = 0 ; i < M ; i ++ ) { Console . Write ( Math . Min ( m1 [ Q [ i ] ] , m2 [ Q [ i ] ] ) + " ▁ " ) ; } } public static void Main ( ) { int [ ] arr = { 2 , 3 , 6 , 7 , 4 , 5 , 1 } ; int N = arr . Length ; int [ ] Q = { 7 , 6 } ; int M = Q . Length ; minOperations ( arr , N , Q , M ) ; } }

Index/key variables: i
Accumulator variables: front, i, rear
Iterator variables: i
Class/struct names: GFG
C# program:
using System ; using System . Collections . Generic ; class GFG { static bool checkAnagram ( string s1 , string s2 ) { List < int > s2hash = new List < int > ( ) ; for ( int i = 0 ; i < 26 ; i ++ ) s2hash . Add ( 0 ) ; List < int > s1hash = new List < int > ( ) ; for ( int i = 0 ; i < 26 ; i ++ ) s1hash . Add ( 0 ) ; int s1len = s1 . Length ; int s2len = s2 . Length ; if ( s1len > s2len ) return false ; int left = 0 , right = 0 ; while ( right < s1len ) { s1hash [ s1 [ right ] - ' a ' ] += 1 ; s2hash [ s2 [ right ] - ' a ' ] += 1 ; right ++ ; } right -= 1 ; while ( right < s2len ) { if ( s1hash == s2hash ) return true ; right ++ ; if ( right != s2len ) s2hash [ s2 [ right ] - ' a ' ] += 1 ; s2hash [ s2 [ left ] - ' a ' ] -= 1 ; left ++ ; } return false ; } public static void Main ( ) { string s1 = " ab " ; string s2 = " bbpobac " ; if ( checkAnagram ( s1 , s2 ) == true ) Console . WriteLine ( " NO " ) ; else Console . WriteLine ( " YES " ) ; } }

Index/key variables: left, right
Accumulator variables: i, left, right
Iterator variables: i
Class/struct names: GFG
C# program:
using System ; class GFG { static void canPlace ( string s , int n , int k ) { int cnt = 0 ; int i = 0 ; while ( i < n ) { if ( s [ i ] == '1' ) { i += 2 ; } else { if ( i == 0 ) { if ( s [ i + 1 ] == '0' ) { cnt ++ ; i += 2 ; } else i ++ ; } else if ( i == n - 1 ) { if ( s [ i - 1 ] == '0' ) { cnt ++ ; i += 2 ; } else i ++ ; } else { if ( s [ i + 1 ] == '0' && s [ i - 1 ] == '0' ) { cnt ++ ; i += 2 ; } else i ++ ; } } } if ( cnt >= k ) { Console . WriteLine ( " Yes " ) ; } else { Console . WriteLine ( " No " ) ; } } public static void Main ( String [ ] args ) { string S = "10001" ; int K = 1 ; int N = S . Length ; canPlace ( S , N , K ) ; } }

Index/key variables: i
Accumulator variables: cnt, i
Class/struct names: GFG
C# program:
using System ; using System . Collections . Generic ; class GFG { static void findMaxIntervals ( List < Tuple < int , int > > v , int n ) { int maxi = 0 ; for ( int i = 0 ; i < n ; i ++ ) { int c = n ; for ( int j = 0 ; j < n ; j ++ ) { if ( v [ i ] . Item2 < v [ j ] . Item1 v [ i ] . Item1 > v [ j ] . Item2 ) { c -- ; } } maxi = Math . Max ( c , maxi ) ; } Console . Write ( maxi ) ; } static void Main ( ) { List < Tuple < int , int > > arr = new List < Tuple < int , int > > ( ) ; arr . Add ( new Tuple < int , int > ( 1 , 2 ) ) ; arr . Add ( new Tuple < int , int > ( 3 , 4 ) ) ; arr . Add ( new Tuple < int , int > ( 2 , 5 ) ) ; int N = arr . Count ; findMaxIntervals ( arr , N ) ; } }

Index/key variables: i, j
Accumulator variables: c, i, j
Iterator variables: i, j
Class/struct names: GFG
C# program:
using System ; public class GFG { static bool check ( int [ ] a , int n ) { bool flag = false ; for ( int i = 1 ; i < n - 1 ; i ++ ) { if ( a [ i + 1 ] > a [ i ] && a [ i ] < a [ i - 1 ] ) flag = true ; } if ( flag ) return false ; else return true ; } public static void Main ( String [ ] args ) { int [ ] arr = { 1 , 3 , 5 , 2 } ; int N = arr . Length ; if ( check ( arr , N ) ) Console . Write ( " YES " ) ; else Console . Write ( " NO " ) ; } }

Index/key variables: i
Accumulator variables: i
Iterator variables: i
Boolean variables: flag
Class/struct names: GFG
C# program:
using System ; public class GFG { static void smallestNumber ( int [ ] arr , int len ) { int maxi = 0 ; for ( int i = 0 ; i < len ; i ++ ) { maxi = Math . Max ( maxi , arr [ i ] ) ; } int ans = - 1 ; for ( int i = 2 ; i < maxi + 2 ; i ++ ) { bool flag = true ; for ( int j = 0 ; j < len ; j ++ ) { if ( arr [ j ] % i == 0 ) { flag = false ; break ; } } if ( flag ) { ans = i ; break ; } } Console . WriteLine ( ans ) ; } public static void Main ( string [ ] args ) { int [ ] arr = { 3 , 2 , 6 , 9 , 2 } ; int N = arr . Length ; smallestNumber ( arr , N ) ; } }

Index/key variables: i, j
Accumulator variables: i, j
Iterator variables: i, j
Boolean variables: flag
Class/struct names: GFG
C# program:
using System ; class GFG { static void findDuplicate ( string str , int N ) { int first = 0 ; int second = 0 ; for ( int i = 0 ; i < N ; i ++ ) { if ( ( first & ( 1 << ( str [ i ] - ' a ' ) ) ) != 0 ) { second = second | ( 1 << ( str [ i ] - ' a ' ) ) ; } else { first = first | ( 1 << ( str [ i ] - ' a ' ) ) ; } } for ( int i = 0 ; i < 26 ; i ++ ) { if ( ( ( first & ( 1 << i ) ) & ( second & ( 1 << i ) ) ) != 0 ) { Console . Write ( ( char ) ( i + ' a ' ) + " ▁ " ) ; } } } static public void Main ( ) { string str = " geeksforgeeks " ; int N = str . Length ; findDuplicate ( str , N ) ; } }

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 void minOperations ( string S ) { int count = 0 ; for ( int i = 1 ; i < S . Length ; i ++ ) { if ( S [ i ] != S [ i - 1 ] ) { count += 1 ; } } Console . Write ( count ) ; } public static void Main ( ) { string S = "0101010101" ; minOperations ( S ) ; } }

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