dhyuti-n/xlcost-variable-roles huggingface dataset:
C# program:
using System ; class GFG { static int countFreq ( int N , int K ) { int count = 0 ; while ( N > 0 ) { if ( N % 10 == K ) { count ++ ; } N = N / 10 ; } return count ; } static int findElementUtil ( int [ ] arr , int N , int K ) { int c ; int max ; int ele = 0 ; max = 0 ; for ( int i = 0 ; i < N ; i ++ ) { c = countFreq ( arr [ i ] , K ) ; if ( c > max ) { max = c ; ele = arr [ i ] ; } } if ( max == 0 ) return - 1 ; else return ele ; } static void findElement ( int [ ] arr , int N , int K ) { int ele = findElementUtil ( arr , N , K ) ; if ( ele == - 1 ) Console . Write ( " - 1" ) ; else Console . Write ( ele ) ; } public static void Main ( String [ ] args ) { int K = 3 ; int [ ] arr = { 3 , 77 , 343 , 456 } ; int N = arr . Length ; findElement ( arr , K , N ) ; } }

Index/key variables: i
Accumulator variables: count, i
Iterator variables: i
Class/struct names: GFG
C# program:
using System ; public class GFG { static int findMinDeletions ( int [ , ] v , int n ) { int minDel = int . MaxValue ; for ( int i = 0 ; i < n ; i ++ ) { int L = v [ i , 0 ] ; int R = v [ i , 1 ] ; int Count = 0 ; for ( int j = 0 ; j < n ; j ++ ) { if ( v [ j , 0 ] >= L && v [ j , 1 ] <= R ) { Count += 1 ; } } minDel = Math . Min ( minDel , n - Count ) ; } return minDel ; } public static void Main ( String [ ] args ) { int [ , ] v = { { 1 , 3 } , { 4 , 12 } , { 5 , 8 } , { 13 , 20 } } ; int N = v . GetLength ( 0 ) ; Console . Write ( findMinDeletions ( v , N ) ) ; } }

Accumulator variables: Count, i, j
Iterator variables: i, j
Class/struct names: GFG
C# program:
using System ; class GFG { static int maxEvenints ( int [ ] arr , int N , int M ) { int curr = 0 ; for ( int i = 0 ; i < M ; i ++ ) { if ( arr [ i ] % 2 == 0 ) curr ++ ; } int ans = curr ; for ( int i = M ; i < N ; i ++ ) { if ( arr [ i - M ] % 2 == 0 ) { curr -- ; } if ( arr [ i ] % 2 == 0 ) curr ++ ; ans = Math . Max ( ans , curr ) ; } return ans ; } public static void Main ( String [ ] args ) { int [ ] arr = { 2 , 3 , 5 , 4 , 7 , 6 } ; int M = 3 ; int N = arr . Length ; Console . Write ( maxEvenints ( arr , N , M ) + " STRNEWLINE " ) ; } }

Index/key variables: i
Accumulator variables: curr, i
Iterator variables: i
Class/struct names: GFG
C# program:
using System ; class GFG { static void countNumbers ( int n , int d ) { int total = 0 ; for ( int i = 1 ; i <= n ; i ++ ) { int x = i ; while ( x > 0 ) { if ( x % 8 == d ) { total ++ ; break ; } x = x / 8 ; } } Console . WriteLine ( total ) ; } static void Main ( ) { int n = 20 , d = 7 ; countNumbers ( n , d ) ; } }

Accumulator variables: i, total
Iterator variables: i
Class/struct names: GFG
C# program:
using System ; class GFG { static int build ( int [ ] tree , int [ ] A , int start , int end , int node ) { if ( start == end ) { tree [ node ] = A [ start ] ; return tree [ node ] ; } int mid = ( start + end ) / 2 ; int X = build ( tree , A , start , mid , 2 * node + 1 ) ; int Y = build ( tree , A , mid + 1 , end , 2 * node + 2 ) ; return ( tree [ node ] = Math . Min ( X , Y ) ) ; } static int query ( int [ ] tree , int start , int end , int l , int r , int node ) { if ( start > r end < l ) return Int32 . MaxValue ; if ( start >= l && end <= r ) return tree [ node ] ; int mid = ( start + end ) / 2 ; int X = query ( tree , start , mid , l , r , 2 * node + 1 ) ; int Y = query ( tree , mid + 1 , end , l , r , 2 * node + 2 ) ; return Math . Min ( X , Y ) ; } static int longestSubArray ( int [ ] A , int N , int K ) { int res = 1 ; int [ ] preSum = new int [ N + 1 ] ; preSum [ 0 ] = A [ 0 ] ; for ( int i = 0 ; i < N ; i ++ ) preSum [ i + 1 ] = preSum [ i ] + A [ i ] ; int [ ] tree = new int [ 4 * N + 5 ] ; build ( tree , A , 0 , N - 1 , 0 ) ; for ( int i = 0 ; i < N ; i ++ ) { int start = i ; int end = N - 1 ; int mid ; int max_index = i ; while ( start <= end ) { mid = ( start + end ) / 2 ; int min_element = query ( tree , 0 , N - 1 , i , mid , 0 ) ; int expected_sum = ( mid - i + 1 ) * min_element ; int actual_sum = preSum [ mid + 1 ] - preSum [ i ] ; if ( actual_sum - expected_sum <= K ) { start = mid + 1 ; max_index = Math . Max ( max_index , mid ) ; } else { end = mid - 1 ; } } res = Math . Max ( res , max_index - i + 1 ) ; } return res ; } static void Main ( ) { int [ ] arr = { 1 , 7 , 3 , 4 , 5 , 6 } ; int k = 6 ; int n = 6 ; Console . WriteLine ( longestSubArray ( arr , n , k ) ) ; } }

Index/key variables: i, node, start
Accumulator variables: i
Iterator variables: i
Class/struct names: GFG
C# program:
using System ; class GFG { static int findCntTriplet ( int N ) { int cntTriplet = 0 ; for ( int i = 1 ; i < N ; i ++ ) { if ( N % i != 0 ) { cntTriplet += N / i ; } else { cntTriplet += ( N / i ) - 1 ; } } return cntTriplet ; } public static void Main ( String [ ] args ) { int N = 3 ; Console . WriteLine ( findCntTriplet ( N ) ) ; } }

Accumulator variables: cntTriplet, i
Iterator variables: i
Class/struct names: GFG
C# program:
using System ; class GFG { static void countDivisors ( int n ) { int count = 0 ; int j = 0 ; int [ ] divisor = new int [ n ] ; for ( int i = 2 ; i <= Math . Sqrt ( n ) ; i ++ ) { if ( n % i == 0 ) { if ( n / i == i ) { divisor [ j ] = i ; j += 1 ; } else { divisor [ j ] = i ; divisor [ j + 1 ] = n / i ; j += 2 ; } } } divisor [ j ] = n ; for ( int i = 0 ; i <= j ; i ++ ) { int x = divisor [ i ] ; x -= 1 ; if ( ( n / x ) == ( n % x ) ) count ++ ; } Console . Write ( count ) ; } public static void Main ( String [ ] args ) { int N = 10000000 ; countDivisors ( N ) ; } }

Index/key variables: i, j, n
Accumulator variables: count, i, j, x
Iterator variables: i
Class/struct names: GFG
C# program:
using System ; class GFG { static int smallestIndexArrayElementsFlip ( int [ ] arr , int N ) { int pos = - 1 ; for ( int i = 0 ; i < N ; i ++ ) { arr [ i ] *= - 1 ; int sum = 0 ; for ( int j = 0 ; j < N ; j ++ ) { sum += arr [ j ] ; } if ( sum == 0 ) { pos = i ; break ; } else { arr [ i ] *= - 1 ; } } return pos ; } public static void Main ( String [ ] args ) { int [ ] arr = { 1 , 3 , - 5 , 3 , 4 } ; int N = arr . Length ; Console . WriteLine ( smallestIndexArrayElementsFlip ( arr , N ) ) ; } }

Index/key variables: i, j
Accumulator variables: i, j, sum
Iterator variables: i, j
Class/struct names: GFG
C# program:
using System ; class GFG { static int smallestIndexArrayElementsFlip ( int [ ] arr , int N ) { int pos = - 1 ; int ArrSum = 0 ; for ( int i = 0 ; i < N ; i ++ ) { ArrSum += arr [ i ] ; } for ( int i = 0 ; i < N ; i ++ ) { if ( 2 * arr [ i ] == ArrSum ) { pos = i ; break ; } } return pos ; } static public void Main ( ) { int [ ] arr = new int [ ] { 1 , 3 , - 5 , 3 , 4 } ; int N = arr . Length ; Console . WriteLine ( smallestIndexArrayElementsFlip ( arr , N ) ) ; } }

Index/key variables: i
Accumulator variables: ArrSum, i
Iterator variables: i
Class/struct names: GFG
C# program:
using System ; public class GFG { static String make_String_S_to_T ( String S , String T ) { bool possible = false ; int M = T . Length ; int N = S . Length ; for ( int i = 0 ; i <= M ; i ++ ) { int prefix_length = i ; int suffix_length = M - i ; String prefix = S . Substring ( 0 , prefix_length ) ; String suffix = S . Substring ( N - suffix_length , suffix_length ) ; if ( ( prefix + suffix ) . Equals ( T ) ) { possible = true ; break ; } } if ( possible ) return " YES " ; else return " NO " ; } public static void Main ( String [ ] args ) { String S = " ababcdcd " ; String T = " abcd " ; Console . Write ( make_String_S_to_T ( S , T ) ) ; } }

Accumulator variables: i
Iterator variables: i
Boolean variables: possible
Class/struct names: GFG
C# program:
using System ; class GFG { public static void findSum ( int [ ] a ) { int ans = 0 ; for ( int low = 0 ; low < a . Length ; low ++ ) { for ( int high = low ; high < a . Length ; high ++ ) { int count = 0 ; int maxNumber = 0 ; for ( int i = low ; i <= high ; i ++ ) { if ( a [ i ] == maxNumber ) count ++ ; else if ( a [ i ] > maxNumber ) { maxNumber = a [ i ] ; count = 1 ; } } ans += maxNumber * ( ( count % 2 == 0 ) ? 2 : 1 ) ; } } Console . WriteLine ( ans ) ; } public static void Main ( ) { int [ ] arr = { 2 , 1 , 4 , 4 , 2 } ; findSum ( arr ) ; } }

Index/key variables: i
Accumulator variables: ans, count, high, i, low
Iterator variables: high, i, low
Class/struct names: GFG
C# program:
using System ; using System . Collections . Generic ; class GFG { static void countPairs ( int [ ] arr , int n ) { Dictionary < int , int > mp1 = new Dictionary < int , int > ( ) ; int sum = 0 ; for ( int i = 0 ; i < n ; i ++ ) { sum += arr [ i ] ; if ( mp1 . ContainsKey ( sum ) ) { mp1 . Add ( sum , mp1 [ sum ] + 1 ) ; } else { mp1 . Add ( sum , 1 ) ; } } sum = 0 ; int ans = 0 ; for ( int i = n - 1 ; i >= 0 ; i -- ) { sum += arr [ i ] ; if ( mp1 . ContainsKey ( sum ) ) { ans += mp1 [ sum ] ; } } Console . Write ( ans ) ; } static public void Main ( ) { int [ ] arr = { 1 , 2 , 1 , 1 } ; int n = arr . Length ; countPairs ( arr , n ) ; } }

Index/key variables: i, sum
Accumulator variables: ans, i, sum
Iterator variables: i
Class/struct names: GFG
C# program:
using System ; class GFG { static bool isMagic ( int num ) { return ( num % 9 == 1 ) ; } static bool isComposite ( int n ) { if ( n <= 1 ) return false ; if ( n <= 3 ) return false ; if ( n % 2 == 0 n % 3 == 0 ) return true ; for ( int i = 5 ; i * i <= n ; i = i + 6 ) if ( n % i == 0 || n % ( i + 2 ) == 0 ) return true ; return false ; } static void find ( int [ ] L , int [ ] R , int q ) { int [ ] dp = new int [ 1000005 ] ; dp [ 0 ] = 0 ; dp [ 1 ] = 0 ; for ( int i = 1 ; i < 1000005 ; i ++ ) { if ( isComposite ( i ) && isMagic ( i ) == true ) { dp [ i ] = dp [ i - 1 ] + 1 ; } else dp [ i ] = dp [ i - 1 ] ; } for ( int i = 0 ; i < q ; i ++ ) Console . WriteLine ( dp [ R [ i ] ] - dp [ L [ i ] - 1 ] ) ; } public static void Main ( ) { int [ ] L = { 10 , 3 } ; int [ ] R = { 100 , 2279 } ; int Q = 2 ; find ( L , R , Q ) ; } }

Index/key variables: i
Accumulator variables: i
Iterator variables: i
Class/struct names: GFG
C# program:
using System ; using System . Linq ; class GFG { static int findSmallestInteger ( int [ ] arr , int N , int K ) { int left = 1 ; int right = arr . Max ( ) ; while ( left < right ) { int mid = ( left + right ) / 2 ; int sum = 0 ; for ( int i = 0 ; i < N ; i ++ ) { sum += ( arr [ i ] + mid - 1 ) / mid ; } if ( sum > K ) { left = mid + 1 ; } else { right = mid ; } } return left ; } public static void Main ( ) { int [ ] arr = { 1 , 2 , 5 , 9 } ; int N = arr . Length ; int K = 6 ; Console . Write ( findSmallestInteger ( arr , 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 minimum_deci_binary_number ( string s ) { int m = int . MinValue ; for ( int i = 0 ; i < s . Length ; i ++ ) { int temp = s [ i ] - '0' ; if ( temp > m ) { m = temp ; } } return m ; } public static void Main ( String [ ] args ) { string S = "31" ; Console . WriteLine ( minimum_deci_binary_number ( S ) ) ; } }

Index/key variables: i
Accumulator variables: i
Iterator variables: i
Class/struct names: GFG
C# program:
using System ; class GFG { static void minOperations ( int [ ] arr , int n ) { int flips = 0 ; for ( int i = 0 ; i < n ; i += 2 ) { if ( arr [ i ] % 2 == 1 ) { continue ; } while ( i < n && arr [ i ] % 2 == 0 ) { i += 2 ; } flips ++ ; } for ( int i = 1 ; i < n ; i += 2 ) { if ( arr [ i ] % 2 == 1 ) { continue ; } while ( i < n && arr [ i ] % 2 == 0 ) { i += 2 ; } flips ++ ; } Console . WriteLine ( flips ) ; } public static void Main ( String [ ] args ) { int [ ] arr = { 2 , 3 , 4 , 3 , 5 , 3 , 2 } ; int N = arr . Length ; minOperations ( arr , N ) ; } }

Index/key variables: i
Accumulator variables: flips, i
Iterator variables: i
Class/struct names: GFG
C# program:
using System ; public class GFG { static int minimumReverse ( String s , int n ) { int k = 0 , l = 0 ; int sum1 = 0 , sum0 = 0 ; for ( int i = 1 ; i < n ; i ++ ) { if ( s [ i ] == '1' ) sum1 ++ ; else sum0 ++ ; if ( s [ i ] == s [ i - 1 ] && s [ i ] == '0' ) k ++ ; else if ( s [ i ] == s [ i - 1 ] && s [ i ] == '1' ) l ++ ; } if ( s [ 0 ] == '1' ) sum1 ++ ; sum0 ++ ; if ( Math . Abs ( sum1 - sum0 ) > 1 ) return - 1 ; return Math . Max ( k , l ) ; } public static void Main ( String [ ] args ) { String S = "10001" ; int N = S . Length ; Console . Write ( minimumReverse ( S , N ) ) ; } }

Index/key variables: i
Accumulator variables: i, k, l, sum0, sum1
Iterator variables: i
Class/struct names: GFG
C# program:
using System ; class GFG { static int cntPairsInTwoArray ( int [ ] arr , int [ ] brr , int N , int M ) { int cntOddArr = 0 ; int cntOddBrr = 0 ; for ( int i = 0 ; i < N ; i ++ ) { if ( arr [ i ] % 2 == 1 ) { cntOddArr += 1 ; } } for ( int i = 0 ; i < M ; i ++ ) { if ( brr [ i ] % 2 == 1 ) { cntOddBrr += 1 ; } } return ( N * M ) - ( cntOddArr * cntOddBrr ) ; } public static void Main ( ) { int [ ] arr = { 1 , 2 , 3 } ; int N = arr . Length ; int [ ] brr = { 1 , 2 } ; int M = brr . Length ; Console . Write ( cntPairsInTwoArray ( arr , brr , N , M ) ) ; } }

Index/key variables: i
Accumulator variables: cntOddArr, cntOddBrr, i
Iterator variables: i
Class/struct names: GFG
C# program:
using System ; class GFG { static void max_freq ( int [ ] arr , int N ) { Array . Sort ( arr ) ; int Max = arr [ N - 1 ] ; int Min = arr [ 0 ] ; int [ ] freq = new int [ Max - Min + 1 ] ; for ( int i = 0 ; i < N ; i ++ ) { freq [ arr [ i ] - Min ] ++ ; } int maxSum = 0 ; for ( int i = 0 ; i < ( Max - Min - 1 ) ; i ++ ) { int val = freq [ i ] + freq [ i + 1 ] + freq [ i + 2 ] ; maxSum = Math . Max ( maxSum , val ) ; } Console . WriteLine ( maxSum ) ; } public static void Main ( ) { int [ ] arr = { 3 , 1 , 4 , 1 , 5 , 9 , 2 } ; int N = arr . Length ; max_freq ( arr , N ) ; } }

Index/key variables: i
Accumulator variables: i
Iterator variables: i
Class/struct names: GFG
C# program:
using System ; using System . Linq ; class GFG { static int findMaxLength ( int N , int [ ] arr ) { int [ ] dp = new int [ N + 1 ] ; for ( int i = 1 ; i <= N ; i ++ ) { dp [ i ] = 1 ; } for ( int i = 1 ; i <= N ; i ++ ) { for ( int j = 2 * i ; j <= N ; j += i ) { if ( arr [ i - 1 ] < arr [ j - 1 ] ) { dp [ j ] = Math . Max ( dp [ j ] , dp [ i ] + 1 ) ; } } } return dp . Max ( ) ; ; } public static void Main ( ) { int [ ] arr = { 2 , 3 , 4 , 5 , 6 , 7 , 8 , 9 } ; int N = arr . Length ; Console . WriteLine ( findMaxLength ( N , arr ) ) ; } }

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 void Sort ( List < int > ans , int num ) { int pos = - 1 ; for ( int i = 0 ; i < ans . Count ; i ++ ) { if ( ans [ i ] >= num ) { pos = i ; break ; } } if ( pos == - 1 ) ans . Add ( num ) ; else ans . Insert ( pos , num ) ; } static void sortStream ( int [ ] arr , int N ) { List < int > ans = new List < int > ( ) ; for ( int i = 0 ; i < N ; i ++ ) { Sort ( ans , arr [ i ] ) ; for ( int j = 0 ; j < ans . Count ; j ++ ) { Console . Write ( ans [ j ] + " ▁ " ) ; } Console . WriteLine ( ) ; } } public static void Main ( String [ ] args ) { int [ ] arr = { 4 , 1 , 7 , 6 , 2 } ; int N = arr . Length ; sortStream ( 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 countSubArraySignChange ( int [ ] arr , int N ) { Dictionary < int , int > prefixCount = new Dictionary < int , int > ( ) ; Dictionary < int , int > suffixCount = new Dictionary < int , int > ( ) ; int total = 0 ; for ( int i = N - 1 ; i >= 0 ; i -- ) { total += arr [ i ] ; if ( suffixCount . ContainsKey ( arr [ i ] ) ) { suffixCount [ arr [ i ] ] = suffixCount [ arr [ i ] ] + 1 ; } else { suffixCount . Add ( arr [ i ] , 1 ) ; } } int prefixSum = 0 ; int suffixSum = 0 ; int count = 0 ; for ( int i = 0 ; i < N - 1 ; i ++ ) { prefixSum += arr [ i ] ; if ( prefixCount . ContainsKey ( arr [ i ] ) ) { prefixCount [ arr [ i ] ] = prefixCount [ arr [ i ] ] + 1 ; } else { prefixCount . Add ( arr [ i ] , 1 ) ; } suffixSum = total - prefixSum ; if ( suffixCount . ContainsKey ( arr [ i ] ) ) { suffixCount [ arr [ i ] ] = suffixCount [ arr [ i ] ] - 1 ; } int diff = prefixSum - suffixSum ; if ( diff % 2 == 0 ) { int x = ( prefixCount . ContainsKey ( diff / 2 ) ? prefixCount : 0 ) + ( suffixCount . ContainsKey ( - diff / 2 ) ? suffixCount [ - diff / 2 ] : 0 ) ; count = count + x ; } } return count ; } public static void Main ( String [ ] args ) { int [ ] arr = { 2 , 2 , - 3 , 3 } ; int N = arr . Length ; Console . Write ( countSubArraySignChange ( arr , N ) ) ; } }

Index/key variables: i
Accumulator variables: i, prefixSum, total
Iterator variables: i
Class/struct names: GFG
C# program:
using System ; using System . Collections . Generic ; class GFG { static int countCommonChar ( int ind , String S ) { int cnt = 0 ; HashSet < char > ls = new HashSet < char > ( ) ; HashSet < char > rs = new HashSet < char > ( ) ; for ( int i = 0 ; i < ind ; ++ i ) { ls . Add ( S [ i ] ) ; } for ( int i = ind ; i < S . Length ; ++ i ) { rs . Add ( S [ i ] ) ; } foreach ( char v in ls ) { if ( rs . Contains ( v ) ) { ++ cnt ; } } return cnt ; } static void partitionStringWithMaxCom ( String S ) { int ans = 0 ; for ( int i = 1 ; i < S . Length ; ++ i ) { ans = Math . Max ( ans , countCommonChar ( i , S ) ) ; } Console . Write ( ans + " STRNEWLINE " ) ; } public static void Main ( String [ ] args ) { String str = " aabbca " ; partitionStringWithMaxCom ( str ) ; } }

Index/key variables: i
Iterator variables: i, v
Class/struct names: GFG
C# program:
using System ; class GFG { static int longestSubarray ( String s ) { s += '0' ; int i ; int res = 0 ; int prev_one = 0 ; int curr_one = 0 ; int numberOfZeros = 0 ; for ( i = 0 ; i < s . Length ; i ++ ) { if ( s [ i ] == '1' ) { curr_one += 1 ; } else { numberOfZeros += 1 ; prev_one += curr_one ; res = Math . Max ( res , prev_one ) ; prev_one = curr_one ; curr_one = 0 ; } } if ( numberOfZeros == 1 ) { res -= 1 ; } return res ; } public static void Main ( String [ ] args ) { String S = "1101" ; Console . WriteLine ( longestSubarray ( S ) ) ; } }

Index/key variables: i
Accumulator variables: curr_one, i, numberOfZeros, prev_one, res, s
Iterator variables: i
Class/struct names: GFG
C# program:
using System ; class GFG { static int longestSubarray ( string s ) { int i = 0 , j = 0 , k = 1 ; for ( j = 0 ; j < s . Length ; ++ j ) { if ( s [ j ] == '0' ) k -= 1 ; if ( k < 0 && s [ i ++ ] == '0' ) k ++ ; } return j - i - 1 ; } public static void Main ( string [ ] args ) { string S = "011101101" ; Console . Write ( longestSubarray ( S ) ) ; } }

Index/key variables: j
Accumulator variables: i, k
Iterator variables: j
Class/struct names: GFG
C# program:
using System ; class GFG { static String SmallestString ( String s , char c ) { for ( int i = 0 ; i < s . Length ; i ++ ) { if ( s [ i ] > c ) { String temp = s ; s = s . Substring ( 0 , i ) ; s += c ; s += temp . Substring ( i , temp . Length - 1 ) ; return s ; } } s += c ; return s ; } public static void Main ( String [ ] args ) { String S = " acd " ; char C = ' b ' ; Console . WriteLine ( SmallestString ( S , C ) ) ; } }

Index/key variables: i
Accumulator variables: i, s
Iterator variables: i
Class/struct names: GFG
C# program:
using System ; using System . Collections . Generic ; class GFG { static void LarUnEl ( int [ ] arr , int N ) { Dictionary < int , int > map = new Dictionary < int , int > ( ) ; for ( int i = 0 ; i < N ; i ++ ) { if ( map . ContainsKey ( arr [ i ] ) == true ) map [ arr [ i ] ] += 1 ; else map [ arr [ i ] ] = 1 ; } int LNRElem = Int32 . MinValue ; int ind = - 1 ; for ( int i = 0 ; i < N ; i ++ ) { if ( map [ arr [ i ] ] == 1 && arr [ i ] > LNRElem ) { ind = i ; LNRElem = arr [ i ] ; } } if ( ind == - 1 ) { Console . WriteLine ( ind ) ; return ; } Console . WriteLine ( arr [ ind ] ) ; } public static void Main ( ) { int [ ] arr = { 3 , 1 , 8 , 8 , 4 } ; int N = arr . Length ; LarUnEl ( arr , N ) ; } }

Index/key variables: i, ind
Accumulator variables: i
Iterator variables: i
Class/struct names: GFG
C# program:
using System ; using System . Collections . Generic ; class GFG { static void countShifts ( string str ) { int firstOne = - 1 ; int lastOne = - 1 ; int count = 0 ; for ( int i = 0 ; i < str . Length ; i ++ ) { if ( str [ i ] == '1' ) { if ( firstOne == - 1 ) firstOne = i ; lastOne = i ; } } if ( ( firstOne == - 1 ) || ( firstOne == lastOne ) ) { Console . Write ( 0 ) ; return ; } for ( int i = firstOne ; i <= lastOne ; i ++ ) { if ( str [ i ] == '0' ) { count ++ ; } } Console . WriteLine ( count ) ; } static void Main ( ) { string str = "00110111011" ; countShifts ( str ) ; } }

Index/key variables: i
Accumulator variables: count, i
Iterator variables: i
Class/struct names: GFG
C# program:
using System ; class GFG { static bool checkSubsequenceUtil ( int [ ] arr , int L , int R , int N ) { for ( int i = 0 ; i < L ; i ++ ) if ( arr [ i ] == arr [ L ] ) return true ; for ( int i = R + 1 ; i < N ; i ++ ) if ( arr [ i ] == arr [ R ] ) return true ; return false ; } static void checkSubsequence ( int [ ] arr , int L , int R , int N ) { if ( checkSubsequenceUtil ( arr , L , R , N ) ) { Console . Write ( " YES STRNEWLINE " ) ; } else { Console . Write ( " NO STRNEWLINE " ) ; } } public static void Main ( ) { int [ ] arr = { 1 , 7 , 12 , 1 , 7 , 5 , 10 , 11 , 42 } ; int N = arr . Length ; int L = 3 , R = 6 ; checkSubsequence ( arr , L , R , N ) ; } }

Index/key variables: L, R, i
Accumulator variables: i
Iterator variables: i
Class/struct names: GFG
C# program:
using System ; class GFG { public class Node { public int data ; public Node next ; public Node prev ; } ; static Node push ( Node head_ref , int new_data ) { Node new_node = new Node ( ) ; new_node . data = new_data ; new_node . prev = null ; new_node . next = head_ref ; if ( head_ref != null ) { head_ref . prev = new_node ; } head_ref = new_node ; return head_ref ; } static int search ( Node head_ref , int x ) { Node temp = head_ref ; int pos = 0 ; while ( temp . data != x && temp . next != null ) { pos ++ ; temp = temp . next ; } if ( temp . data != x ) return - 1 ; return ( pos + 1 ) ; } public static void Main ( String [ ] args ) { Node head = null ; int X = 8 ; head = push ( head , 14 ) ; head = push ( head , 9 ) ; head = push ( head , 8 ) ; head = push ( head , 15 ) ; head = push ( head , 18 ) ; Console . Write ( search ( head , X ) ) ; } }

Accumulator variables: pos
Class/struct names: GFG, Node
C# program:
using System ; class GFG { static void largestSubarray ( int [ ] arr , int N , int K ) { int count = 0 ; int len = 0 ; for ( int i = 0 ; i < N ; i ++ ) { if ( arr [ i ] < K ) { count += 1 ; } else { len = Math . Max ( len , count ) ; count = 0 ; } } if ( count != 0 ) { len = Math . Max ( len , count ) ; } Console . WriteLine ( len ) ; } static void Main ( ) { int [ ] arr = { 1 , 8 , 3 , 5 , 2 , 2 , 1 , 13 } ; int N = arr . Length ; int K = 6 ; largestSubarray ( arr , N , K ) ; } }

Index/key variables: i
Accumulator variables: 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 findPair ( int [ ] A , int N ) { int [ ] right_prod = new int [ N ] ; int flag = 0 ; right_prod [ N - 1 ] = A [ N - 1 ] ; for ( int i = N - 2 ; i >= 0 ; i -- ) right_prod [ i ] = right_prod [ i + 1 ] * A [ i ] ; int total_prod = right_prod [ 0 ] ; int product ; for ( int i = 1 ; i < N - 1 ; i ++ ) { product = 1 ; for ( int j = i ; j < N - 1 ; j ++ ) { product *= A [ j ] ; if ( gcd ( product , right_prod [ j + 1 ] ) == 1 || gcd ( product , total_prod / right_prod [ i ] ) == 1 ) { flag = 1 ; Console . WriteLine ( " ( " + ( i - 1 ) + " , ▁ " + ( j + 1 ) + " ) " ) ; break ; } } if ( flag == 1 ) break ; } if ( flag == 0 ) Console . Write ( - 1 ) ; } public static void Main ( String [ ] args ) { int [ ] arr = { 2 , 4 , 1 , 3 , 7 } ; int N = arr . Length ; findPair ( arr , N ) ; } }

Index/key variables: N, i, j
Accumulator variables: i, j, product
Iterator variables: i, j
Class/struct names: GFG