dhyuti-n/xlcost-variable-roles huggingface dataset:
C# program:
using System ; class GFG { static void numberOfPairs ( int [ ] arr , int N ) { int [ ] set_bits = new int [ 31 ] ; for ( int i = 0 ; i < N ; i ++ ) { set_bits [ i ] = 0 ; } int count = 0 ; for ( int i = 0 ; i < N ; i ++ ) { int x = arr [ i ] ; int bitpos = - 1 ; while ( x > 0 ) { bitpos ++ ; x /= 2 ; } for ( int j = 0 ; j <= bitpos ; j ++ ) { count += set_bits [ j ] ; } set_bits [ bitpos ] ++ ; } Console . Write ( count ) ; } static public void Main ( ) { int [ ] arr = { 4 , 16 , 8 , 64 } ; int N = arr . Length ; numberOfPairs ( arr , N ) ; } }

Index/key variables: bitpos, i, j
Accumulator variables: bitpos, count, i, j, x
Iterator variables: i, j
Class/struct names: GFG
C# program:
using System ; class GFG { static void calculateQuery ( int [ ] arr , int N , int [ ] query , int M ) { for ( int i = 0 ; i < M ; i ++ ) { int X = query [ i ] ; int sum_start = 0 , sum_end = 0 ; for ( int j = 0 ; j < N ; j ++ ) { sum_start += arr [ j ] ; if ( arr [ j ] == X ) break ; } for ( int j = N - 1 ; j >= 0 ; j -- ) { sum_end += arr [ j ] ; if ( arr [ j ] == X ) break ; } Console . Write ( Math . Min ( sum_end , sum_start ) + " ▁ " ) ; } } static void Main ( ) { int [ ] arr = { 2 , 3 , 6 , 7 , 4 , 5 , 30 } ; int [ ] queries = { 6 , 5 } ; int N = arr . Length ; int M = queries . Length ; calculateQuery ( arr , N , queries , M ) ; } }

Index/key variables: i, j
Accumulator variables: i, j, sum_end, sum_start
Iterator variables: i, j
Class/struct names: GFG
C# program:
using System ; using System . Collections . Generic ; class GFG { static void calculateQuery ( int [ ] arr , int N , int [ ] query , int M ) { int prefix = 0 , suffix = 0 ; Dictionary < int , Tuple < int , int > > mp = new Dictionary < int , Tuple < int , int > > ( ) ; for ( int i = 0 ; i < N ; i ++ ) { prefix += arr [ i ] ; mp [ arr [ i ] ] = new Tuple < int , int > ( prefix , 0 ) ; } for ( int i = N - 1 ; i >= 0 ; i -- ) { suffix += arr [ i ] ; mp [ arr [ i ] ] = new Tuple < int , int > ( mp [ arr [ i ] ] . Item1 , suffix ) ; } for ( int i = 0 ; i < M ; i ++ ) { int X = query [ i ] ; Console . Write ( Math . Min ( mp [ X ] . Item1 , mp [ X ] . Item2 ) + " ▁ " ) ; } } static void Main ( ) { int [ ] arr = { 2 , 3 , 6 , 7 , 4 , 5 , 30 } ; int [ ] queries = { 6 , 5 } ; int N = arr . Length ; int M = queries . Length ; calculateQuery ( arr , N , queries , M ) ; } }

Index/key variables: X, i
Accumulator variables: i, prefix, suffix
Iterator variables: i
Class/struct names: GFG
C# program:
using System ; public class GFG { static void findMaximum ( int [ ] arr , int N , int Q , int [ , ] queries ) { int [ ] prefix_max = new int [ N + 1 ] ; int [ ] suffix_max = new int [ N + 1 ] ; prefix_max [ 0 ] = arr [ 0 ] ; for ( int i = 1 ; i < N ; i ++ ) { prefix_max [ i ] = Math . Max ( prefix_max [ i - 1 ] , arr [ i ] ) ; } suffix_max [ N - 1 ] = arr [ N - 1 ] ; for ( int i = N - 2 ; i >= 0 ; i -- ) { suffix_max [ i ] = Math . Max ( suffix_max [ i + 1 ] , arr [ i ] ) ; } for ( int i = 0 ; i < Q ; i ++ ) { int l = queries [ i , 0 ] ; int r = queries [ i , 1 ] ; if ( l == 0 && r == ( N - 1 ) ) Console . Write ( "0 STRNEWLINE " ) ; else if ( l == 0 ) Console . Write ( suffix_max [ r + 1 ] + " STRNEWLINE " ) ; else if ( r == ( N - 1 ) ) Console . Write ( prefix_max [ l - 1 ] + " STRNEWLINE " ) ; else Console . Write ( Math . Max ( prefix_max [ l - 1 ] , suffix_max [ r + 1 ] ) + " STRNEWLINE " ) ; } } static public void Main ( ) { int [ ] arr = { 5 , 6 , 8 , 10 , 15 } ; int N = arr . Length ; int [ , ] queries = { { 0 , 1 } , { 0 , 2 } , { 1 , 4 } } ; int Q = queries . GetLength ( 0 ) ; findMaximum ( arr , N , Q , queries ) ; } }

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

Index/key variables: i
Accumulator variables: even, i, odd
Iterator variables: i
Class/struct names: GFG
C# program:
using System ; public class GFG { static String minEmail ( String email ) { String ans = " " ; int len = email . Length ; ans += email [ 0 ] ; int i = 1 ; bool notAt = true ; while ( i < len ) { if ( i < len - 3 && notAt && email [ i ] == ' a ' && email [ i + 1 ] == ' t ' ) { ans += ' @ ' ; i += 1 ; notAt = false ; } else if ( i < len - 4 && email [ i ] == ' d ' && email [ i + 1 ] == ' o ' && email [ i + 2 ] == ' t ' ) { ans += ' . ' ; i += 2 ; } else { ans += email [ i ] ; } i += 1 ; } return ans ; } public static void Main ( String [ ] args ) { String email = " geeksforgeeksatgmaildotcom " ; Console . WriteLine ( minEmail ( email ) ) ; } }

Index/key variables: i
Accumulator variables: ans, i
Boolean variables: notAt
Class/struct names: GFG
C# program:
using System ; public class GFG { static bool isGreaterEqual ( int N , int X ) { return ( N * ( N + 1 ) / 2 ) >= X ; } static int minimumPossible ( int X ) { for ( int i = 1 ; i <= X ; i ++ ) { if ( isGreaterEqual ( i , X ) ) return i ; } return 0 ; } static public void Main ( ) { int X = 14 ; Console . Write ( minimumPossible ( X ) ) ; } }

Accumulator variables: i
Iterator variables: i
Class/struct names: GFG
C# program:
using System ; class GFG { public static int Max = 1000005 ; static bool CheckDivByAllDigits ( int number ) { int n = number ; while ( n > 0 ) { if ( n % 10 != 0 ) if ( number % ( n % 10 ) != 0 ) { return false ; } n /= 10 ; } return true ; } static void cntNumInRang ( int [ , ] arr , int N ) { int [ ] prefCntDiv = new int [ Max + 1 ] ; for ( int i = 1 ; i <= Max ; i ++ ) { int ans = 0 ; if ( CheckDivByAllDigits ( i ) ) ans = 1 ; prefCntDiv [ i ] = prefCntDiv [ i - 1 ] + ans ; } for ( int i = 0 ; i < N ; i ++ ) Console . Write ( ( prefCntDiv [ arr [ i , 1 ] ] - prefCntDiv [ arr [ i , 0 ] - 1 ] ) + " ▁ " ) ; } public static void Main ( string [ ] args ) { int [ , ] arr = { { 1 , 5 } , { 12 , 14 } } ; int N = arr . GetLength ( 0 ) ; cntNumInRang ( arr , N ) ; } }

Index/key variables: i
Accumulator variables: i, n
Iterator variables: i
Class/struct names: GFG
C# program:
using System ; class sol { public int arrayNesting ( int [ ] arr ) { int res = 0 ; for ( int i = 0 ; i < arr . Length ; i ++ ) { if ( arr [ i ] == i ) { res = Math . Max ( res , 1 ) ; } else { int count = 0 ; int curr_index = i ; while ( arr [ curr_index ] != curr_index ) { int next_index = arr [ curr_index ] ; arr [ curr_index ] = curr_index ; curr_index = next_index ; count ++ ; } res = Math . Max ( res , count ) ; } } return res ; } } class GFG { static public void Main ( ) { sol st = new sol ( ) ; int [ ] arr = { 5 , 4 , 0 , 3 , 1 , 6 , 2 } ; int res = st . arrayNesting ( arr ) ; Console . WriteLine ( res ) ; } }

Index/key variables: curr_index, i
Accumulator variables: count, i
Iterator variables: i
Class/struct names: GFG, sol
C# program:
using System ; class GFG { static int N = 200000 ; static int [ ] prime = new int [ 20000 ] ; static int index = 0 ; static void Sieve ( ) { index = 0 ; int [ ] p = new int [ N + 1 ] ; for ( int i = 0 ; i <= N ; i ++ ) { p [ i ] = 1 ; } p [ 0 ] = p [ 1 ] = 0 ; for ( int i = 2 ; i * i <= N ; i ++ ) { if ( p [ i ] == 1 ) { for ( int j = i * i ; j <= N ; j += i ) { p [ j ] = 0 ; } } } for ( int i = 1 ; i < N ; i ++ ) { if ( p [ i ] == 1 ) { prime [ index ++ ] = ( int ) ( Math . Pow ( i , 4 ) ) ; } } } static void countNumbers ( int L , int R ) { int Count = 0 ; for ( int i = 0 ; i < index ; i ++ ) { int p = prime [ i ] ; if ( p >= L && p <= R ) { Count ++ ; } } Console . WriteLine ( Count ) ; } public static void Main ( String [ ] args ) { int L = 16 , R = 85000 ; Sieve ( ) ; countNumbers ( L , R ) ; } }

Index/key variables: i, j
Accumulator variables: Count, i, index, j
Iterator variables: i, j
Class/struct names: GFG
C# program:
using System ; class GFG { static void countRemainingElements ( int [ ] L1 , int [ ] L2 , int n ) { int one = 0 ; int zero = 0 ; for ( int i = 0 ; i < n ; i ++ ) { if ( L1 [ i ] == 1 ) one ++ ; else zero ++ ; } int ans = n ; for ( int i = 0 ; i < n ; i ++ ) { if ( L2 [ i ] == 1 ) { one -- ; if ( one < 0 ) { ans = i ; break ; } } else { zero -- ; if ( zero < 0 ) { ans = i ; break ; } } } Console . WriteLine ( n - ans ) ; } static public void Main ( ) { int [ ] L1 = { 1 , 1 , 0 , 0 } ; int [ ] L2 = { 0 , 0 , 0 , 1 } ; int N = L1 . Length ; countRemainingElements ( L1 , L2 , N ) ; } }

Index/key variables: i
Accumulator variables: i, one, zero
Iterator variables: i
Class/struct names: GFG
C# program:
using System ; class GFG { static int getCount ( int rows , int columns , int [ , ] A ) { int res = 0 ; for ( int i = 0 ; i < rows ; i ++ ) { for ( int j = i + 1 ; j < rows ; j ++ ) { if ( A [ i , 0 ] * A [ j , 1 ] == A [ i , 1 ] * A [ j , 0 ] ) { res ++ ; } } } return res ; } static void Main ( ) { int [ , ] A = { { 4 , 8 } , { 10 , 20 } , { 15 , 30 } , { 3 , 6 } } ; int columns = 2 ; int rows = 4 ; Console . Write ( getCount ( rows , columns , A ) ) ; } }

Accumulator variables: i, j, res
Iterator variables: i, j
Class/struct names: GFG
C# program:
using System ; class GFG { static void Min_Score_Index ( int N , int [ ] A ) { int [ ] Score = new int [ N ] ; for ( int i = N - 1 ; i >= 0 ; i -- ) { if ( A [ i ] + i < N ) Score [ i ] = A [ i ] * Score [ A [ i ] + i ] ; else Score [ i ] = A [ i ] ; } int min_value = Int32 . MaxValue ; foreach ( int i in Score ) { min_value = Math . Min ( i , min_value ) ; } int ind = 0 ; for ( int i = 0 ; i < N ; i ++ ) { if ( Score [ i ] == min_value ) ind = i ; } Console . WriteLine ( ind ) ; } public static void Main ( ) { int N = 5 ; int [ ] A = { 1 , 2 , 3 , 4 , 5 } ; Min_Score_Index ( N , A ) ; } }

Index/key variables: N, i
Accumulator variables: i
Iterator variables: i
Class/struct names: GFG
C# program:
using System ; class GFG { static void minLength ( String S , String T , int N , int M ) { String temp = " " ; int subtract = 0 ; for ( int i = 0 ; i < N ; ++ i ) { temp += S [ i ] ; if ( temp . Length >= M ) { if ( T . Equals ( temp . Substring ( temp . Length - M , M ) ) ) { subtract += M ; int cnt = 0 ; while ( cnt != M ) { temp = temp . Substring ( 0 , temp . Length - 1 ) ; ++ cnt ; } } } } Console . WriteLine ( ( N - subtract ) ) ; } public static void Main ( String [ ] args ) { String S = " aabcbcbd " , T = " abc " ; int N = S . Length ; int M = T . Length ; minLength ( S , T , N , M ) ; } }

Index/key variables: i
Accumulator variables: subtract, temp
Iterator variables: i
Class/struct names: GFG
C# program:
using System ; class GFG { static int maximumCount ( int [ ] arr1 , int [ ] arr2 , int s1 , int s2 ) { int sum1 = 0 , sum2 = 0 ; for ( int i = 0 ; i < s1 ; i ++ ) { sum1 += arr1 [ i ] ; } for ( int a = 0 ; a < s2 ; a ++ ) { sum2 += arr2 [ a ] ; } int len = 0 ; if ( s1 >= s2 ) { len = s2 ; } else { len = s1 ; } Array . Sort ( arr1 ) ; Array . Sort ( arr2 ) ; int j = 0 , k = s2 - 1 , count = 0 ; for ( int i = 0 ; i < len ; i ++ ) { if ( sum1 <= sum2 ) { if ( arr2 [ k ] >= arr1 [ i ] ) { int dif1 = arr1 [ j ] , dif2 = arr2 [ k ] ; sum1 -= dif1 ; sum1 += dif2 ; sum2 -= dif2 ; sum2 += dif1 ; j ++ ; k -- ; count ++ ; } else { break ; } } else { break ; } } return count ; } static public void Main ( ) { int [ ] arr1 = new int [ ] { 1 , 3 , 2 , 4 } ; int [ ] arr2 = new int [ ] { 6 , 7 , 8 } ; int N = arr1 . Length ; int M = arr2 . Length ; Console . WriteLine ( maximumCount ( arr1 , arr2 , N , M ) ) ; } }

Index/key variables: a, i, j, k
Accumulator variables: a, count, i, j, k, sum1, sum2
Iterator variables: a, i
Class/struct names: GFG
C# program:
using System ; class GFG { static bool isValidDigit ( int digit , int K ) { while ( K != 0 ) { if ( K % 10 == digit ) { return true ; } K = K / 10 ; } return false ; } static int noOfValidNumbers ( int K , int [ ] arr ) { int count = 0 ; for ( int i = 0 ; i < arr . Length ; i ++ ) { int no = arr [ i ] ; bool flag = true ; while ( no != 0 ) { int digit = no % 10 ; if ( ! isValidDigit ( digit , K ) ) { flag = false ; break ; } no = no / 10 ; } if ( flag == true ) { count ++ ; } } return count ; } public static void Main ( String [ ] args ) { int K = 12 ; int [ ] arr = { 1 , 12 , 1222 , 13 , 2 } ; Console . WriteLine ( noOfValidNumbers ( K , arr ) ) ; } }

Index/key variables: i
Accumulator variables: count, i
Iterator variables: i
Boolean variables: flag
Class/struct names: GFG
C# program:
using System ; class GFG { static bool isSubarrayExistUtil ( int [ ] arr , int K , int N ) { int totalXOR = 0 ; int SubarrayXOR = 0 ; for ( int i = 0 ; i < N ; i ++ ) totalXOR ^= arr [ i ] ; for ( int i = 0 ; i < K ; i ++ ) SubarrayXOR ^= arr [ i ] ; if ( SubarrayXOR == ( totalXOR ^ SubarrayXOR ) ) return true ; for ( int i = K ; i < N ; i ++ ) { SubarrayXOR ^= arr [ i ] ; SubarrayXOR ^= arr [ i - 1 ] ; if ( SubarrayXOR == ( totalXOR ^ SubarrayXOR ) ) return true ; } return false ; } static void isSubarrayExist ( int [ ] arr , int K , int N ) { if ( isSubarrayExistUtil ( arr , K , N ) ) Console . Write ( " YES STRNEWLINE " ) ; else Console . Write ( " NO STRNEWLINE " ) ; } public static void Main ( String [ ] args ) { int [ ] arr = { 2 , 3 , 3 , 5 , 7 , 7 , 3 , 4 } ; int N = arr . Length ; int K = 5 ; isSubarrayExist ( arr , K , N ) ; } }

Index/key variables: i
Accumulator variables: SubarrayXOR, i, totalXOR
Iterator variables: i
Class/struct names: GFG
C# program:
using System ; class GFG { static void countPairs ( int L , int R ) { int count_even ; if ( L % 2 == 0 ) { count_even = ( R / 2 ) - ( L / 2 ) + 1 ; } else { count_even = ( R / 2 ) - ( L / 2 ) ; } int count_odd ; if ( L % 2 == 0 ) { count_odd = ( ( R + 1 ) / 2 ) - ( ( L + 1 ) / 2 ) ; } else { count_odd = ( ( R + 1 ) / 2 ) - ( ( L + 1 ) / 2 ) + 1 ; } count_even *= count_even ; count_odd *= count_odd ; Console . WriteLine ( count_even + count_odd ) ; } public static void Main ( String [ ] args ) { int L = 1 , R = 3 ; countPairs ( L , R ) ; } }

Accumulator variables: count_even, count_odd
Class/struct names: GFG
C# program:
using System ; class GFG { static int getDefiniteFinds ( int [ ] arr ) { int n = arr . Length ; int [ ] smallestRight = new int [ n + 1 ] ; smallestRight [ n ] = Int32 . MaxValue ; for ( int i = n - 1 ; i >= 0 ; i -- ) { smallestRight [ i ] = Math . Min ( smallestRight [ i + 1 ] , arr [ i ] ) ; } int mn = Int32 . MinValue ; int ans = 0 ; for ( int i = 0 ; i < n ; i ++ ) { if ( mn < arr [ i ] && arr [ i ] < smallestRight [ i + 1 ] ) { ans ++ ; } mn = Math . Max ( arr [ i ] , mn ) ; } return ans ; } static public void Main ( ) { int [ ] arr = new int [ ] { 5 , 4 , 9 } ; Console . WriteLine ( getDefiniteFinds ( arr ) ) ; } }

Index/key variables: i, n
Accumulator variables: ans, i
Iterator variables: i
Class/struct names: GFG
C# program:
using System ; class GFG { static void Count_numbers ( int L , int R ) { int count = ( R - L ) / 2 ; if ( R % 2 != 0 L % 2 != 0 ) count += 1 ; Console . Write ( count ) ; } public static void Main ( String [ ] args ) { int L = 6 , R = 30 ; Count_numbers ( L , R ) ; } }

Accumulator variables: count
Class/struct names: GFG
C# program:
using System ; class GFG { static bool checkReverse ( int leftSum , int rightSum ) { int rev = 0 ; int temp = rightSum ; while ( temp != 0 ) { rev = ( rev * 10 ) + ( temp % 10 ) ; temp /= 10 ; } if ( rev == leftSum ) { return true ; } return false ; } static int findIndex ( int [ ] arr , int N ) { int rightSum = 0 ; int leftSum = 0 ; for ( int i = 0 ; i < N ; i ++ ) { rightSum += arr [ i ] ; } for ( int i = 0 ; i < N ; i ++ ) { rightSum -= arr [ i ] ; if ( checkReverse ( leftSum , rightSum ) ) { return i ; } leftSum += arr [ i ] ; } return - 1 ; } static void Main ( ) { int [ ] arr = { 5 , 7 , 3 , 6 , 4 , 9 , 2 } ; int N = arr . Length ; Console . Write ( findIndex ( arr , N ) ) ; } }

Index/key variables: i
Accumulator variables: i, leftSum, rightSum, temp
Iterator variables: i
Class/struct names: GFG
C# program:
using System ; using System . Collections . Generic ; public class GFG { static int LCS ( int [ ] firstArr , int [ ] secondArr ) { Dictionary < int , int > mp = new Dictionary < int , int > ( ) ; for ( int i = 0 ; i < firstArr . Length ; i ++ ) { mp . Add ( firstArr [ i ] , i + 1 ) ; } List < int > tempArr = new List < int > ( ) ; for ( int i = 0 ; i < secondArr . Length ; i ++ ) { if ( mp . ContainsKey ( secondArr [ i ] ) ) { tempArr . Add ( mp [ secondArr [ i ] ] ) ; } } List < int > tail = new List < int > ( ) ; tail . Add ( tempArr [ 0 ] ) ; for ( int i = 1 ; i < tempArr . Count ; i ++ ) { if ( tempArr [ i ] > tail [ tail . Count - 1 ] ) tail . Add ( tempArr [ i ] ) ; else if ( tempArr [ i ] < tail [ 0 ] ) tail . Insert ( 0 , tempArr [ i ] ) ; } return ( int ) tail . Count ; } public static void Main ( String [ ] args ) { int [ ] firstArr = { 3 , 5 , 1 , 8 } ; int [ ] secondArr = { 3 , 3 , 5 , 3 , 8 } ; Console . Write ( LCS ( firstArr , secondArr ) ) ; } }

Index/key variables: i
Accumulator variables: i
Iterator variables: i
Class/struct names: GFG
C# program:
using System ; using System . Collections ; using System . Collections . Generic ; class GFG { static int totalWays ( int n , string str ) { ArrayList IdxOf0s = new ArrayList ( ) ; int cntWays = 1 ; for ( int i = 0 ; i < n ; i ++ ) { if ( str [ i ] == '0' ) { IdxOf0s . Add ( i ) ; } } int M = IdxOf0s . Count ; if ( ( M == 0 ) || ( ( M % 2 ) != 0 ) ) { return 0 ; } for ( int i = 2 ; i < M ; i += 2 ) { cntWays = cntWays * ( Convert . ToInt32 ( IdxOf0s [ i ] ) - Convert . ToInt32 ( IdxOf0s [ i - 1 ] ) ) ; } return cntWays ; } static public void Main ( ) { string str = "00100" ; int n = str . Length ; Console . Write ( totalWays ( n , str ) ) ; } }

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 countTriplets ( int [ ] arr , int N ) { List < int > zero_i = new List < int > ( ) ; List < int > one_i = new List < int > ( ) ; Dictionary < int , int > mp = new Dictionary < int , int > ( ) ; for ( int i = 0 ; i < N ; i ++ ) { if ( arr [ i ] == 0 ) zero_i . Add ( i + 1 ) ; else if ( arr [ i ] == 1 ) one_i . Add ( i + 1 ) ; else mp . Add ( i + 1 , 1 ) ; } int total = zero_i . Count * one_i . Count * mp . Count ; for ( int i = 0 ; i < zero_i . Count ; i ++ ) { for ( int j = 0 ; j < one_i . Count ; j ++ ) { int p = zero_i [ i ] ; int q = one_i [ j ] ; int r = 2 * p - q ; if ( mp . ContainsKey ( r ) && mp [ r ] > 0 ) total -- ; r = 2 * q - p ; if ( mp . ContainsKey ( r ) && mp [ r ] > 0 ) total -- ; r = ( p + q ) / 2 ; if ( mp . ContainsKey ( r ) && mp [ r ] > 0 && Math . Abs ( r - p ) == Math . Abs ( r - q ) ) total -- ; } } Console . Write ( total ) ; } public static void Main ( String [ ] args ) { int [ ] arr = { 0 , 1 , 2 , 1 } ; int N = arr . Length ; countTriplets ( arr , N ) ; } }

Index/key variables: i, j, r
Accumulator variables: i, j, total
Iterator variables: i, j
Class/struct names: GFG
C# program:
using System ; using System . Collections . Generic ; class GFG { static void PrimeFactors ( int N ) { Stack < int > st = new Stack < int > ( ) ; int i = 2 ; while ( N != 1 ) { if ( N % i == 0 ) { st . Push ( i ) ; while ( N % i == 0 ) { N = N / i ; } } i ++ ; } while ( st . Count != 0 ) { Console . Write ( st . Peek ( ) ) ; st . Pop ( ) ; } } public static void Main ( ) { int N = 8 ; PrimeFactors ( N ) ; ; } }

Accumulator variables: i
Class/struct names: GFG
C# program:
using System ; class GFG { static int CountSubarray ( int [ ] arr , int n , int k ) { int temp = k , count = 0 ; for ( int i = 0 ; i < n ; i ++ ) { if ( arr [ i ] == temp ) { if ( temp == 1 ) { count ++ ; temp = k ; } else temp -- ; } else { temp = k ; if ( arr [ i ] == k ) i -- ; } } return count ; } static public void Main ( ) { int [ ] arr = { 1 , 2 , 3 , 7 , 9 , 3 , 2 , 1 , 8 , 3 , 2 , 1 } ; int N = arr . Length ; int K = 3 ; Console . Write ( CountSubarray ( arr , N , K ) ) ; } }

Index/key variables: i
Accumulator variables: count, i, temp
Iterator variables: i
Class/struct names: GFG
C# program:
using System ; class GFG { static int LCM ( int A , int B ) { return ( A * B / __gcd ( A , B ) ) ; } static void findSmallestNumber ( int X ) { int lcm = 1 ; int temp = X ; while ( temp > 0 ) { int last = temp % 10 ; temp /= 10 ; if ( last == 0 ) continue ; lcm = LCM ( lcm , last ) ; } int answer = ( ( X + lcm - 1 ) / lcm ) * lcm ; Console . Write ( answer ) ; } static int __gcd ( int a , int b ) { return b == 0 ? a : __gcd ( b , a % b ) ; } public static void Main ( String [ ] args ) { int X = 280 ; findSmallestNumber ( X ) ; } }

Accumulator variables: temp
Class/struct names: GFG
C# program:
using System ; class GFG { static void minSum ( int N ) { long low = 0 , high = 1000000000 ; while ( low + 1 < high ) { long mid = low + ( high - low ) / 2 ; if ( mid * mid >= N ) { high = mid ; } else { low = mid ; } } long first = high ; low = 0 ; high = 1000000000 ; while ( low + 1 < high ) { long mid = low + ( high - low ) / 2 ; if ( first * mid > N ) { high = mid ; } else { low = mid ; } } long second = high ; Console . WriteLine ( first + second ) ; } static public void Main ( ) { int N = 10 ; minSum ( N ) ; } }

Class/struct names: GFG
C# program:
using System ; class GFG { static void minSum ( int N ) { int ans = ( int ) Math . Ceiling ( 2 * Math . Sqrt ( N + 1 ) ) ; Console . WriteLine ( ans ) ; } static public void Main ( ) { int N = 10 ; minSum ( N ) ; } }

Class/struct names: GFG
C# program:
using System ; class GFG { static readonly int INF = 1000000 ; static int [ ] pref = new int [ 500005 ] ; static int [ ] suf = new int [ 500005 ] ; static int [ ] MAX = new int [ 500005 ] ; static void build ( int [ ] a , int tl , int tr , int v ) { if ( tl == tr ) { MAX [ v ] = a [ tl ] ; pref [ v ] = a [ tl ] ; suf [ v ] = a [ tl ] ; } else { int tm = ( tl + tr ) / 2 ; build ( a , tl , tm , v * 2 ) ; build ( a , tm + 1 , tr , v * 2 + 1 ) ; MAX [ v ] = Math . Max ( MAX [ v * 2 ] , Math . Max ( MAX [ v * 2 + 1 ] , suf [ v * 2 ] + pref [ v * 2 + 1 ] ) ) ; pref [ v ] = Math . Max ( pref [ v * 2 ] , pref [ 2 * v ] + ( pref [ 2 * v ] == ( tm - tl + 1 ) ? 1 : 0 ) * pref [ v * 2 + 1 ] ) ; suf [ v ] = Math . Max ( suf [ v * 2 + 1 ] , suf [ 2 * v + 1 ] + suf [ v * 2 ] * ( suf [ 2 * v + 1 ] == ( tr - tm ) ? 1 : 0 ) ) ; } } static void update ( int [ ] a , int pos , int tl , int tr , int v ) { if ( tl > pos tr < pos ) { return ; } if ( tl == tr && tl == pos ) { MAX [ v ] = a [ pos ] ; pref [ v ] = a [ pos ] ; suf [ v ] = a [ pos ] ; } else { int tm = ( tl + tr ) / 2 ; update ( a , pos , tl , tm , v * 2 ) ; update ( a , pos , tm + 1 , tr , v * 2 + 1 ) ; MAX [ v ] = Math . Max ( MAX [ v * 2 ] , Math . Max ( MAX [ v * 2 + 1 ] , suf [ v * 2 ] + pref [ v * 2 + 1 ] ) ) ; pref [ v ] = Math . Max ( pref [ v * 2 ] , pref [ 2 * v ] + ( pref [ 2 * v ] == ( tm - tl + 1 ) ? 1 : 0 ) * pref [ v * 2 + 1 ] ) ; suf [ v ] = Math . Max ( suf [ v * 2 + 1 ] , suf [ 2 * v + 1 ] + ( suf [ 2 * v + 1 ] == ( tr - tm ) ? 1 : 0 ) * suf [ v * 2 ] ) ; } } static void solveQueries ( int [ ] arr , int n , int [ , ] Q , int k ) { int cntQuery = Q . GetLength ( 0 ) ; build ( arr , 0 , n - 1 , 1 ) ; for ( int i = 0 ; i < cntQuery ; i ++ ) { if ( Q [ i , 0 ] == 1 ) { Console . Write ( MAX [ 1 ] + " ▁ " ) ; } else { arr [ Q [ i , 1 ] - 1 ] ^= 1 ; update ( arr , Q [ i , 1 ] - 1 , 0 , n - 1 , 1 ) ; } } } public static void Main ( String [ ] args ) { int N = 10 ; int [ ] arr = { 1 , 1 , 0 , 1 , 1 , 1 , 0 , 0 , 1 , 1 } ; int [ , ] Q = { { 1 , 0 } , { 2 , 3 } , { 1 , 0 } } ; int K = 3 ; solveQueries ( arr , N , Q , K ) ; } }

Index/key variables: pos, tl, v
Accumulator variables: i
Iterator variables: i
Class/struct names: GFG