dhyuti-n/xlcost-variable-roles huggingface dataset:
C# program:
using System ; using System . Collections . Generic ; class GFG { public static int countOrderedPairs ( int [ ] A , int n ) { int orderedPairs = 0 ; Dictionary < int , int > m = new Dictionary < int , int > ( ) ; for ( int i = 0 ; i < n ; i ++ ) { if ( ! m . ContainsKey ( A [ i ] ) ) m . Add ( A [ i ] , 1 ) ; else { m [ A [ i ] ] ++ ; } } foreach ( KeyValuePair < int , int > entry in m ) { int X = entry . Key ; int Y = entry . Value ; for ( int j = 1 ; j <= Y ; j ++ ) { if ( m [ j ] >= X ) orderedPairs ++ ; } } return orderedPairs ; } public static void Main ( ) { int [ ] A = { 1 , 1 , 2 , 2 , 3 } ; int n = A . Length ; Console . Write ( countOrderedPairs ( A , n ) ) ; } }

Index/key variables: i, j
Accumulator variables: i, j, orderedPairs
Iterator variables: entry, i, j
Class/struct names: GFG
C# program:
using System ; class GFG { static int LongestSubarray ( int [ ] arr , int n , int k ) { int count = 1 ; int max_length = 1 ; int prev_mod = arr [ 0 ] % k ; for ( int i = 1 ; i < n ; i ++ ) { int curr_mod = arr [ i ] % k ; if ( curr_mod == prev_mod ) { count ++ ; } else { max_length = Math . Max ( max_length , count ) ; count = 1 ; prev_mod = curr_mod ; } } return Math . Max ( max_length , count ) ; } public static void Main ( ) { int [ ] arr = { 4 , 9 , 7 , 18 , 29 , 11 } ; int n = arr . Length ; int k = 11 ; Console . Write ( LongestSubarray ( 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 M = 3 ; static int N = 4 ; static bool binarySearch1D ( int [ ] arr , int K ) { int low = 0 ; int high = N - 1 ; while ( low <= high ) { int mid = low + ( high - low ) / 2 ; if ( arr [ mid ] == K ) { return true ; } if ( arr [ mid ] < K ) { low = mid + 1 ; } else { high = mid - 1 ; } } return false ; } static bool searchMatrix ( int [ , ] matrix , int K ) { int low = 0 ; int high = M - 1 ; while ( low <= high ) { int mid = low + ( high - low ) / 2 ; if ( K >= matrix [ mid , 0 ] && K <= matrix [ mid , N - 1 ] ) { return binarySearch1D ( GetRow ( matrix , mid ) , K ) ; } if ( K < matrix [ mid , 0 ] ) { high = mid - 1 ; } else { low = mid + 1 ; } } return false ; } public static int [ ] GetRow ( int [ , ] matrix , int row ) { var rowLength = matrix . GetLength ( 1 ) ; var rowVector = new int [ rowLength ] ; for ( var i = 0 ; i < rowLength ; i ++ ) rowVector [ i ] = matrix [ row , i ] ; return rowVector ; } public static void Main ( String [ ] args ) { int [ , ] matrix = { { 1 , 3 , 5 , 7 } , { 10 , 11 , 16 , 20 } , { 23 , 30 , 34 , 50 } } ; int K = 3 ; if ( searchMatrix ( matrix , K ) ) { Console . WriteLine ( " Found " ) ; } else { Console . WriteLine ( " Not ▁ found " ) ; } } }

Index/key variables: i, mid, rowLength
Accumulator variables: i
Iterator variables: i
Class/struct names: GFG
C# program:
using System ; class GFG { static int gcd ( int a , int b ) { if ( a == 0 ) return b ; return gcd ( b % a , a ) ; } static int divTermCount ( int a , int b , int lcm , int num ) { return num / a + num / b - num / lcm ; } static int findNthTerm ( int a , int b , int n ) { int low = 1 , high = int . MaxValue , mid ; int lcm = ( a * b ) / gcd ( a , b ) ; while ( low < high ) { mid = low + ( high - low ) / 2 ; if ( divTermCount ( a , b , lcm , mid ) < n ) low = mid + 1 ; else high = mid ; } return low ; } static public void Main ( ) { int a = 2 , b = 5 , n = 10 ; Console . WriteLine ( findNthTerm ( a , b , n ) ) ; } }

Class/struct names: GFG
C# program:
using System ; class gfg { public string replacePi ( string input ) { string output = " " ; int size = input . Length ; for ( int i = 0 ; i < size ; ++ i ) { if ( i + 1 < size && input [ i ] == ' p ' && input [ i + 1 ] == ' i ' ) { output += "3.14" ; i ++ ; } else { output += input [ i ] ; } } return output ; } } class geek { public static int Main ( ) { gfg g = new gfg ( ) ; string input = "2 ▁ * ▁ pi ▁ + ▁ 3 ▁ * ▁ pi ▁ = ▁ 5 ▁ * ▁ pi " ; Console . WriteLine ( g . replacePi ( input ) ) ; return 0 ; } }

Index/key variables: i
Accumulator variables: i, output
Iterator variables: i
Class/struct names: geek, gfg
C# program:
using System ; class GFG { public static int numberOfElements ( int [ ] height , int n ) { int max_so_far = 0 ; int coun = 0 ; for ( int i = n - 1 ; i >= 0 ; i -- ) { if ( height [ i ] > max_so_far ) { max_so_far = height [ i ] ; coun ++ ; } } return coun ; } public static void Main ( ) { int n = 6 ; int [ ] height = { 4 , 8 , 2 , 0 , 0 , 5 } ; Console . WriteLine ( numberOfElements ( height , n ) ) ; } }

Index/key variables: i
Accumulator variables: coun, i
Iterator variables: i
Class/struct names: GFG
C# program:
using System ; using System . Collections . Generic ; class GFG { static readonly int MAX = 100000 ; public class Node { public int data ; public Node next ; } static Node push ( Node head_ref , int new_data ) { Node new_node = new Node ( ) ; new_node . data = new_data ; new_node . next = ( head_ref ) ; ( head_ref ) = new_node ; return head_ref ; } static bool check_pair_product ( Node head , int prod ) { List < int > s = new List < int > ( ) ; Node p = head ; while ( p != null ) { int curr = p . data ; if ( ( prod % curr == 0 ) && ( s . Contains ( prod / curr ) ) ) { Console . Write ( curr + " ▁ " + ( prod / curr ) ) ; return true ; } s . Add ( p . data ) ; p = p . next ; } return false ; } public static void Main ( String [ ] args ) { Node head = null ; head = push ( head , 1 ) ; head = push ( head , 2 ) ; head = push ( head , 1 ) ; head = push ( head , 12 ) ; head = push ( head , 1 ) ; head = push ( head , 18 ) ; head = push ( head , 47 ) ; head = push ( head , 16 ) ; head = push ( head , 12 ) ; head = push ( head , 14 ) ; bool res = check_pair_product ( head , 24 ) ; if ( res == false ) Console . Write ( " NO ▁ PAIR ▁ EXIST " ) ; } }

Class/struct names: GFG, Node
C# program:
using System ; class GFG { static void solve ( int [ ] arr , int n , int k ) { Array . Sort ( arr ) ; if ( k == 1 && arr [ n - 2 ] != arr [ n - 1 ] ) { Console . WriteLine ( arr [ n - 1 ] ) ; return ; } int count = 1 ; for ( int i = n - 2 ; i >= 0 ; i -- ) { if ( arr [ i ] == arr [ i + 1 ] ) count ++ ; else count = 1 ; if ( count == k && ( i == 0 || ( arr [ i - 1 ] != arr [ i ] ) ) ) { Console . WriteLine ( arr [ i ] ) ; return ; } } Console . WriteLine ( " No ▁ such ▁ element " ) ; } static public void Main ( ) { int [ ] arr = { 1 , 1 , 2 , 3 , 3 , 4 , 5 , 5 , 6 , 6 , 6 } ; int k = 2 ; int n = arr . Length ; solve ( arr , n , k ) ; } }

Index/key variables: i
Accumulator variables: count, i
Iterator variables: i
Class/struct names: GFG
C# program:
using System ; using System . Collections . Generic ; class GfG { static void solve ( int [ ] arr , int n , int k ) { Dictionary < int , int > m = new Dictionary < int , int > ( ) ; for ( int i = 0 ; i < n ; i ++ ) { if ( m . ContainsKey ( arr [ i ] ) ) { var val = m [ arr [ i ] ] ; m . Remove ( arr [ i ] ) ; m . Add ( arr [ i ] , val + 1 ) ; } else { m . Add ( arr [ i ] , 1 ) ; } } int max = int . MinValue ; for ( int i = 0 ; i < n ; i ++ ) { if ( m [ arr [ i ] ] == k && max == int . MinValue ) { max = arr [ i ] ; } else if ( m [ arr [ i ] ] == k && max < arr [ i ] ) { max = arr [ i ] ; } } if ( max == int . MinValue ) Console . WriteLine ( " No ▁ such ▁ element " ) ; else Console . WriteLine ( max ) ; } public static void Main ( String [ ] args ) { int [ ] arr = { 1 , 1 , 2 , 3 , 3 , 4 , 5 , 5 , 6 , 6 , 6 } ; int k = 4 ; int n = arr . Length ; solve ( arr , n , k ) ; } }

Index/key variables: i
Accumulator variables: i
Iterator variables: i
Class/struct names: GfG
C# program:
using System ; class GFG { static int getMin ( int [ ] arr , int n ) { int res = arr [ 0 ] ; for ( int i = 1 ; i < n ; i ++ ) res = Math . Min ( res , arr [ i ] ) ; return res ; } static int getMax ( int [ ] arr , int n ) { int res = arr [ 0 ] ; for ( int i = 1 ; i < n ; i ++ ) res = Math . Max ( res , arr [ i ] ) ; return res ; } static int findSum ( int [ ] arr , int n ) { int min = getMin ( arr , n ) ; int max = getMax ( arr , n ) ; return min + max ; } static int findProduct ( int [ ] arr , int n ) { int min = getMin ( arr , n ) ; int max = getMax ( arr , n ) ; return min * max ; } public static void Main ( ) { int [ ] arr = { 12 , 1234 , 45 , 67 , 1 } ; int n = arr . Length ; Console . WriteLine ( " Sum ▁ = ▁ " + findSum ( arr , n ) ) ; Console . WriteLine ( " Product ▁ = ▁ " + findProduct ( arr , 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 { public static void countEle ( Stack < int > s , int [ ] a , int N ) { Dictionary < int , bool > mp = new Dictionary < int , bool > ( ) ; for ( int i = 0 ; i < N ; ++ i ) { int num = a [ i ] ; if ( mp . ContainsKey ( num ) ) Console . Write ( "0 ▁ " ) ; else { int cnt = 0 ; while ( s . Peek ( ) != num ) { mp . Add ( s . Peek ( ) , true ) ; s . Pop ( ) ; cnt ++ ; } s . Pop ( ) ; cnt ++ ; Console . Write ( cnt + " ▁ " ) ; } } } public static void Main ( String [ ] args ) { int N = 5 ; Stack < int > s = new Stack < int > ( ) ; s . Push ( 1 ) ; s . Push ( 2 ) ; s . Push ( 3 ) ; s . Push ( 4 ) ; s . Push ( 6 ) ; int [ ] a = { 6 , 3 , 4 , 1 , 2 } ; countEle ( s , a , N ) ; } }

Index/key variables: i
Accumulator variables: cnt
Iterator variables: i
Class/struct names: GFG
C# program:
using System ; using System . Collections . Generic ; class GFG { static int N = 6 ; static SortedSet < int > [ ] Tree = new SortedSet < int > [ 6 * N ] ; static void buildTree ( int [ ] arr , int idx , int s , int e ) { if ( s == e ) { Tree [ idx ] . Add ( arr [ s ] ) ; return ; } int mid = ( s + e ) / 2 ; buildTree ( arr , 2 * idx , s , mid ) ; buildTree ( arr , 2 * idx + 1 , mid + 1 , e ) ; foreach ( int it in Tree [ 2 * idx ] ) Tree [ idx ] . Add ( it ) ; foreach ( int it in Tree [ 2 * idx + 1 ] ) Tree [ idx ] . Add ( it ) ; } static bool query ( int idx , int s , int e , int qs , int qe , int x ) { if ( qs <= s && e <= qe ) { if ( Tree [ idx ] . Contains ( x ) ) return true ; else return false ; } if ( qe < s < qs ) return false ; int mid = ( s + e ) / 2 ; bool LeftAns = query ( 2 * idx , s , mid , qs , qe , x ) ; bool RightAns = query ( 2 * idx + 1 , mid + 1 , e , qs , qe , x ) ; return ( LeftAns RightAns ) ; } public static void Main ( String [ ] args ) { int [ ] arr = { 1 , 3 , 3 , 9 , 8 , 7 } ; int n = arr . Length ; for ( int i = 0 ; i < 6 * N ; i ++ ) Tree [ i ] = new SortedSet < int > ( ) ; buildTree ( arr , 1 , 0 , n - 1 ) ; int l , r , x ; l = 0 ; r = 3 ; x = 2 ; if ( query ( 1 , 0 , n - 1 , l , r , x ) ) Console . WriteLine ( " Yes " ) ; else Console . WriteLine ( " No " ) ; l = 2 ; r = 5 ; x = 3 ; if ( query ( 1 , 0 , n - 1 , l , r , x ) ) Console . WriteLine ( " Yes " ) ; else Console . WriteLine ( " No " ) ; } }

Index/key variables: i, idx, s
Accumulator variables: i
Iterator variables: i, it
Class/struct names: GFG
C# program:
using System ; class GFG { static int countChar ( String str ) { int n = str . Length ; if ( n <= 2 ) return n ; int count = 2 ; for ( int i = 1 ; i < n - 1 ; i ++ ) if ( str [ i - 1 ] == str [ i + 1 ] ) count ++ ; return count ; } public static void Main ( ) { String str = " egeeksk " ; Console . WriteLine ( countChar ( str ) ) ; } }

Accumulator variables: count, i
Iterator variables: i
Class/struct names: GFG
C# program:
using System ; using System . Collections . Generic ; class GfG { static bool [ ] prime = new bool [ 1000000 + 5 ] ; static void findPrime ( ) { Array . Fill ( prime , true ) ; prime [ 1 ] = false ; for ( int p = 2 ; p * p <= 1000000 ; p ++ ) { if ( prime [ p ] == true ) { for ( int i = p * 2 ; i <= 1000000 ; i += p ) prime [ i ] = false ; } } } static int lenOfLongSubarr ( int [ ] arr , int n ) { Dictionary < int , int > um = new Dictionary < int , int > ( ) ; int sum = 0 , maxLen = 0 ; for ( int i = 0 ; i < n ; i ++ ) { sum += prime [ arr [ i ] ] == false ? - 1 : 1 ; if ( sum == 1 ) maxLen = i + 1 ; else if ( ! um . ContainsKey ( sum ) ) um [ sum ] = i ; if ( um . ContainsKey ( sum - 1 ) ) { if ( maxLen < ( i - um [ sum - 1 ] ) ) maxLen = i - um [ sum - 1 ] ; } } return maxLen ; } public static void Main ( ) { findPrime ( ) ; int [ ] arr = { 1 , 9 , 3 , 4 , 5 , 6 , 7 , 8 } ; int n = arr . Length ; Console . WriteLine ( lenOfLongSubarr ( arr , n ) ) ; } }

Index/key variables: i, p, sum
Accumulator variables: i, p, sum
Iterator variables: i, p
Class/struct names: GfG
C# program:
using System ; class GfG { private static int next ( int [ ] arr , int target ) { int start = 0 , end = arr . Length - 1 ; if ( end == 0 ) return - 1 ; if ( target > arr [ end ] ) return end ; int ans = - 1 ; while ( start <= end ) { int mid = ( start + end ) / 2 ; if ( arr [ mid ] >= target ) { end = mid - 1 ; } else { ans = mid ; start = mid + 1 ; } } return ans ; } public static void Main ( ) { int [ ] arr = { 1 , 2 , 3 , 5 , 8 , 12 } ; Console . WriteLine ( next ( arr , 5 ) ) ; } }

Index/key variables: end, mid
Class/struct names: GfG
C# program:
using System ; class GfG { private static int next ( int [ ] arr , int target ) { int start = 0 , end = arr . Length - 1 ; int ans = - 1 ; while ( start <= end ) { int mid = ( start + end ) / 2 ; if ( arr [ mid ] <= target ) { start = mid + 1 ; } else { ans = mid ; end = mid - 1 ; } } return ans ; } public static void Main ( ) { int [ ] arr = { 1 , 2 , 3 , 5 , 8 , 12 } ; Console . WriteLine ( next ( arr , 8 ) ) ; } }

Index/key variables: mid
Class/struct names: GfG
C# program:
using System ; class GFG { static bool search ( int [ ] arr , int n , int x ) { int res = - 1 ; for ( int i = 0 ; i < n ; i ++ ) if ( x == arr [ i ] ) res = i ; if ( res == - 1 ) return false ; int temp = arr [ res ] ; for ( int i = res ; i > 0 ; i -- ) arr [ i ] = arr [ i - 1 ] ; arr [ 0 ] = temp ; return true ; } public static void Main ( ) { int [ ] arr = { 12 , 25 , 36 , 85 , 98 , 75 , 89 , 15 , 63 , 66 , 64 , 74 , 27 , 83 , 97 } ; int [ ] q = { 63 , 63 , 86 , 63 , 78 } ; int n = arr . Length ; int m = q . Length ; for ( int i = 0 ; i < m ; i ++ ) { if ( search ( arr , n , q [ i ] ) == true ) Console . Write ( " Yes ▁ " ) ; else Console . Write ( " No ▁ " ) ; } } }

Index/key variables: i, res
Accumulator variables: i
Iterator variables: i
Class/struct names: GFG
C# program:
using System ; class GFG { static float kPresentProbability ( int [ ] a , int n , int k ) { float count = 0 ; for ( int i = 0 ; i < n ; i ++ ) if ( a [ i ] == k ) count ++ ; return count / n ; } public static void Main ( ) { int [ ] A = { 4 , 7 , 2 , 0 , 8 , 7 , 5 } ; int K = 2 ; int N = A . Length ; double n = kPresentProbability ( A , N , K ) ; double p = ( double ) Math . Round ( n * 100 ) / 100 ; Console . Write ( p ) ; } }

Index/key variables: i
Accumulator variables: count, i
Iterator variables: i
Class/struct names: GFG
C# program:
class GFG { static int slopeOfNum ( string num , int n ) { int slope = 0 ; for ( int i = 1 ; i < n - 1 ; i ++ ) { if ( num [ i ] > num [ i - 1 ] && num [ i ] > num [ i + 1 ] ) slope ++ ; else if ( num [ i ] < num [ i - 1 ] && num [ i ] < num [ i + 1 ] ) slope ++ ; } return slope ; } public static void Main ( ) { string num = "1213321" ; int n = num . Length ; System . Console . WriteLine ( " Slope ▁ = ▁ " + slopeOfNum ( num , n ) ) ; } }

Index/key variables: i
Accumulator variables: i, slope
Iterator variables: i
Class/struct names: GFG
C# program:
using System ; using System . Collections . Generic ; class GFG { static bool pairExists ( int [ ] arr1 , int m , int [ ] arr2 , int n ) { HashSet < int > s = new HashSet < int > ( ) ; for ( int i = 0 ; i < m ; i ++ ) { for ( int j = 0 ; j < n ; j ++ ) { if ( s . Contains ( arr2 [ j ] - arr1 [ i ] ) ) return true ; } s . Add ( arr1 [ i ] ) ; } return false ; } public static void Main ( ) { int [ ] arr1 = { 1 , 5 , 10 , 8 } ; int [ ] arr2 = { 2 , 20 , 13 } ; if ( pairExists ( arr1 , 4 , arr2 , 3 ) ) Console . WriteLine ( 1 ) ; else Console . WriteLine ( 0 ) ; } }

Index/key variables: i, j
Accumulator variables: i, j
Iterator variables: i, j
Class/struct names: GFG
C# program:
using System ; class GFG { static int value ; static bool canBeOptimalValue ( int K , int [ ] arr , int N , int B ) { int [ ] tmp = new int [ N ] ; for ( int i = 0 ; i < N ; i ++ ) tmp [ i ] = ( arr [ i ] + K * ( i + 1 ) ) ; Array . Sort ( tmp ) ; value = 0 ; for ( int i = 0 ; i < K ; i ++ ) value += tmp [ i ] ; return value <= B ; } static void findNoOfElementsandValue ( int [ ] arr , int N , int B ) { int ans = 0 ; value = 0 ; while ( start <= end ) { int mid = ( start + end ) / 2 ; if ( canBeOptimalValue ( mid , arr , N , B ) ) { ans = mid ; start = mid + 1 ; } else end = mid - 1 ; } canBeOptimalValue ( ans , arr , N , B ) ; Console . Write ( ans + " ▁ " + value + " STRNEWLINE " ) ; } public static void Main ( String [ ] args ) { int [ ] arr = { 1 , 2 , 5 , 6 , 3 } ; int N = arr . Length ; int B = 90 ; findNoOfElementsandValue ( arr , N , B ) ; } }

Index/key variables: N, i
Accumulator variables: i, value
Iterator variables: i
Class/struct names: GFG
C# program:
using System ; class GFG { static void prevGreater ( int [ ] arr , int n ) { Console . Write ( " - 1 , ▁ " ) ; for ( int i = 1 ; i < n ; i ++ ) { int j ; for ( j = i - 1 ; j >= 0 ; j -- ) { if ( arr [ i ] < arr [ j ] ) { Console . Write ( arr [ j ] + " , ▁ " ) ; break ; } } if ( j == - 1 ) Console . Write ( " - 1 , ▁ " ) ; } } public static void Main ( ) { int [ ] arr = { 10 , 4 , 2 , 20 , 40 , 12 , 30 } ; int n = arr . Length ; prevGreater ( 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 void prevGreater ( int [ ] arr , int n ) { Stack < int > s = new Stack < int > ( ) ; s . Push ( arr [ 0 ] ) ; Console . Write ( " - 1 , ▁ " ) ; for ( int i = 1 ; i < n ; i ++ ) { while ( s . Count != 0 && s . Peek ( ) < arr [ i ] ) s . Pop ( ) ; if ( s . Count == 0 ) Console . Write ( " - 1 , ▁ " ) ; else Console . Write ( s . Peek ( ) + " , ▁ " ) ; s . Push ( arr [ i ] ) ; } } public static void Main ( String [ ] args ) { int [ ] arr = { 10 , 4 , 2 , 20 , 40 , 12 , 30 } ; int n = arr . Length ; prevGreater ( arr , n ) ; } }

Index/key variables: i
Accumulator variables: i
Iterator variables: i
Class/struct names: GFG
C# program:
using System ; class GFG { static void printDuplicates ( int [ ] arr , int n ) { int i ; int fl = 0 ; for ( i = 0 ; i < n ; i ++ ) { if ( arr [ arr [ i ] % n ] >= n ) { if ( arr [ arr [ i ] % n ] < 2 * n ) { Console . Write ( arr [ i ] % n + " ▁ " ) ; fl = 1 ; } } arr [ arr [ i ] % n ] += n ; } if ( ! ( fl > 0 ) ) Console . Write ( " - 1" ) ; } public static void Main ( ) { int [ ] arr = { 1 , 6 , 3 , 1 , 3 , 6 , 6 } ; int arr_size = arr . Length ; printDuplicates ( arr , arr_size ) ; } }

Index/key variables: i
Accumulator variables: i
Iterator variables: i
Class/struct names: GFG
C# program:
using System ; class GFG { static int findMissingNo ( int [ ] arr , int n ) { int val ; int nextval ; for ( int i = 0 ; i < n ; i ++ ) { if ( arr [ i ] <= 0 arr [ i ] > n ) continue ; val = arr [ i ] ; while ( arr [ val - 1 ] != val ) { nextval = arr [ val - 1 ] ; arr [ val - 1 ] = val ; val = nextval ; if ( val <= 0 val > n ) break ; } } for ( int i = 0 ; i < n ; i ++ ) { if ( arr [ i ] != i + 1 ) { return i + 1 ; } } return n + 1 ; } public static void Main ( String [ ] args ) { int [ ] arr = { 2 , 3 , 7 , 6 , 8 , - 1 , - 10 , 15 } ; int arr_size = arr . Length ; int missing = findMissingNo ( arr , arr_size ) ; Console . Write ( " The ▁ smallest ▁ positive " + " ▁ missing ▁ number ▁ is ▁ " + missing ) ; } }

Index/key variables: i
Accumulator variables: i
Iterator variables: i
Class/struct names: GFG
C# program:
using System ; class GFG { static void findTriplets ( int [ ] arr , int n , int sum ) { for ( int i = 0 ; i < n - 2 ; i ++ ) { for ( int j = i + 1 ; j < n - 1 ; j ++ ) { for ( int k = j + 1 ; k < n ; k ++ ) { if ( arr [ i ] + arr [ j ] + arr [ k ] == sum ) { Console . WriteLine ( arr [ i ] + " ▁ " + arr [ j ] + " ▁ " + arr [ k ] ) ; } } } } } static public void Main ( ) { int [ ] arr = { 0 , - 1 , 2 , - 3 , 1 } ; int n = arr . Length ; findTriplets ( arr , n , - 2 ) ; } }

Index/key variables: i, j, k
Accumulator variables: i, j, k
Iterator variables: i, j, k
Class/struct names: GFG
C# program:
using System ; using System . Collections . Generic ; public class GFG { static void findTriplets ( int [ ] arr , int n , int sum ) { for ( int i = 0 ; i < n - 1 ; i ++ ) { HashSet < int > s = new HashSet < int > ( ) ; for ( int j = i + 1 ; j < n ; j ++ ) { int x = sum - ( arr [ i ] + arr [ j ] ) ; if ( s . Contains ( x ) ) Console . Write ( " { 0 } ▁ { 1 } ▁ { 2 } STRNEWLINE " , x , arr [ i ] , arr [ j ] ) ; else s . Add ( arr [ j ] ) ; } } } public static void Main ( String [ ] args ) { int [ ] arr = { 0 , - 1 , 2 , - 3 , 1 } ; int sum = - 2 ; int n = arr . Length ; findTriplets ( arr , n , sum ) ; } }

Index/key variables: i, j
Accumulator variables: i, j
Iterator variables: i, j
Class/struct names: GFG
C# program:
using System ; class GFG { static int maxProduct ( int [ ] arr , int n ) { if ( n < 4 ) return - 1 ; int max_product = int . MinValue ; for ( int i = 0 ; i < n - 3 ; i ++ ) for ( int j = i + 1 ; j < n - 2 ; j ++ ) for ( int k = j + 1 ; k < n - 1 ; k ++ ) for ( int l = k + 1 ; l < n ; l ++ ) max_product = Math . Max ( max_product , arr [ i ] * arr [ j ] * arr [ k ] * arr [ l ] ) ; return max_product ; } public static void Main ( ) { int [ ] arr = { 10 , 3 , 5 , 6 , 20 } ; int n = arr . Length ; int max = maxProduct ( arr , n ) ; if ( max == - 1 ) Console . WriteLine ( " No ▁ Quadruple ▁ Exists " ) ; else Console . WriteLine ( " Maximum ▁ product ▁ is ▁ " + max ) ; } }

Index/key variables: i, j, k, l
Accumulator variables: i, j, k, l
Iterator variables: i, j, k, l
Class/struct names: GFG
C# program:
using System ; class GFG { static int maxProduct ( int [ ] arr , int n ) { if ( n < 4 ) return - 1 ; Array . Sort ( arr ) ; int x = arr [ n - 1 ] * arr [ n - 2 ] * arr [ n - 3 ] * arr [ n - 4 ] ; int y = arr [ 0 ] * arr [ 1 ] * arr [ 2 ] * arr [ 3 ] ; int z = arr [ 0 ] * arr [ 1 ] * arr [ n - 1 ] * arr [ n - 2 ] ; return Math . Max ( x , Math . Max ( y , z ) ) ; } public static void Main ( ) { int [ ] arr = { - 10 , - 3 , 5 , 6 , - 20 } ; int n = arr . Length ; int max = maxProduct ( arr , n ) ; if ( max == - 1 ) Console . WriteLine ( " No ▁ Quadruple ▁ Exists " ) ; else Console . WriteLine ( " Maximum ▁ product ▁ is ▁ " + max ) ; } }

Class/struct names: GFG
C# program:
using System ; class GFG { static int maxSum ( int [ ] arr , int n ) { if ( n < 2 ) return - 1 ; int ans = arr [ 0 ] + arr [ 1 ] ; for ( int i = 1 ; i + 1 < n ; i ++ ) ans = Math . Min ( ans , ( arr [ i ] + arr [ i + 1 ] ) ) ; return ans ; } public static void Main ( ) { int [ ] arr = { 1 , 12 , 2 , 2 } ; int n = arr . Length ; Console . WriteLine ( maxSum ( arr , n ) ) ; } }

Index/key variables: i
Accumulator variables: i
Iterator variables: i
Class/struct names: GFG
C# program:
using System ; class GFG { static int f ( int n ) { return n * ( 2 * n * n - 1 ) ; } static bool binarySearch ( int low , int high , int x ) { while ( low <= high ) { int mid = ( low + high ) / 2 ; if ( f ( mid ) < x ) low = mid + 1 ; else if ( f ( mid ) > x ) high = mid - 1 ; else return true ; } return false ; } static bool isStellaOctangula ( int x ) { if ( x == 0 ) return true ; int i = 1 ; while ( f ( i ) < x ) i = i * 2 ; if ( f ( i ) == x ) return true ; return binarySearch ( i / 2 , i , x ) ; } public static void Main ( ) { int n = 51 ; if ( isStellaOctangula ( n ) ) Console . WriteLine ( " Yes " ) ; else Console . WriteLine ( " No " ) ; } }

Class/struct names: GFG
C# program:
using System ; class GFG { static String sortString ( String str , int n ) { String new_str = " " ; for ( int i = ' a ' ; i <= ' z ' ; i ++ ) for ( int j = 0 ; j < n ; j ++ ) if ( str [ j ] == i ) new_str += str [ j ] ; return new_str ; } public static void Main ( ) { String str = " geeksforgeeks " ; int n = str . Length ; Console . Write ( sortString ( str , n ) ) ; } }

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