dhyuti-n/xlcost-variable-roles huggingface dataset:
C# program:
using System ; class GFG { static String Minimum_Window ( char [ ] s , char [ ] t ) { int [ ] m = new int [ 256 ] ; int ans = int . MaxValue ; int start = 0 ; int count = 0 , i = 0 ; for ( i = 0 ; i < t . Length ; i ++ ) { if ( m [ t [ i ] ] == 0 ) count ++ ; m [ t [ i ] ] ++ ; } i = 0 ; int j = 0 ; while ( j < s . Length ) { m [ s [ j ] ] -- ; if ( m [ s [ j ] ] == 0 ) count -- ; if ( count == 0 ) { while ( count == 0 ) { if ( ans > j - i + 1 ) { ans = Math . Min ( ans , j - i + 1 ) ; start = i ; } m [ s [ i ] ] ++ ; if ( m [ s [ i ] ] > 0 ) count ++ ; i ++ ; } } j ++ ; } if ( ans != int . MaxValue ) return String . Join ( " " , s ) . Substring ( start , ans ) ; else return " - 1" ; } public static void Main ( String [ ] args ) { String s = " ADOBECODEBANC " ; String t = " ABC " ; Console . Write ( " - - > Smallest ▁ window ▁ that ▁ contain ▁ all ▁ character ▁ : ▁ " ) ; Console . Write ( Minimum_Window ( s . ToCharArray ( ) , t . ToCharArray ( ) ) ) ; } }

Index/key variables: i, j
Accumulator variables: count, i, j
Iterator variables: i
Class/struct names: GFG
C# program:
using System ; class GFG { public class RunLength_Encoding { public static void printRLE ( String str ) { int n = str . Length ; for ( int i = 0 ; i < n ; i ++ ) { int count = 1 ; while ( i < n - 1 && str [ i ] == str [ i + 1 ] ) { count ++ ; i ++ ; } Console . Write ( str [ i ] ) ; Console . Write ( count ) ; } } public static void Main ( String [ ] args ) { String str = " wwwwaaadexxxxxxywww " ; printRLE ( str ) ; } } }

Index/key variables: i
Accumulator variables: count, i
Iterator variables: i
Class/struct names: GFG, RunLength_Encoding
C# program:
using System ; class GFG { static int NO_OF_CHARS = 256 ; static void print ( string [ ] list , string word , int list_size ) { int [ ] map = new int [ NO_OF_CHARS ] ; int i , j , count , word_size ; for ( i = 0 ; i < word . Length ; i ++ ) map [ word [ i ] ] = 1 ; word_size = word . Length ; for ( i = 0 ; i < list_size ; i ++ ) { for ( j = 0 , count = 0 ; j < list [ i ] . Length ; j ++ ) { if ( map [ list [ i ] [ j ] ] > 0 ) { count ++ ; map [ list [ i ] [ j ] ] = 0 ; } } if ( count == word_size ) Console . WriteLine ( list [ i ] ) ; for ( j = 0 ; j < word . Length ; j ++ ) map [ word [ j ] ] = 1 ; } } public static void Main ( string [ ] args ) { string str = " sun " ; string [ ] list = { " geeksforgeeks " , " unsorted " , " sunday " , " just " , " sss " } ; print ( list , str , 5 ) ; } }

Index/key variables: NO_OF_CHARS, i, j
Accumulator variables: count, i, j
Iterator variables: i, j
Class/struct names: GFG
C# program:
using System ; using System . Globalization ; class GFG { static int NO_OF_CHARS = 256 ; static char [ ] count = new char [ NO_OF_CHARS ] ; static void getCharCountArray ( string str ) { for ( int i = 0 ; i < str . Length ; i ++ ) count [ str [ i ] ] ++ ; } static int firstNonRepeating ( string str ) { getCharCountArray ( str ) ; int index = - 1 , i ; for ( i = 0 ; i < str . Length ; i ++ ) { if ( count [ str [ i ] ] == 1 ) { index = i ; break ; } } return index ; } public static void Main ( ) { string str = " geeksforgeeks " ; int index = firstNonRepeating ( str ) ; Console . WriteLine ( index == - 1 ? " Either ▁ " + " all ▁ characters ▁ are ▁ repeating ▁ or ▁ string ▁ " + " is ▁ empty " : " First ▁ non - repeating ▁ character " + " ▁ is ▁ " + str [ index ] ) ; } }

Index/key variables: NO_OF_CHARS, i, index
Accumulator variables: i
Iterator variables: i
Class/struct names: GFG
C# program:
using System ; class GFG { static void divideString ( String str , int n ) { int str_size = str . Length ; int part_size ; if ( str_size % n != 0 ) { Console . Write ( " Invalid ▁ Input : ▁ String ▁ size " + " is ▁ not ▁ divisible ▁ by ▁ n " ) ; return ; } part_size = str_size / n ; for ( int i = 0 ; i < str_size ; i ++ ) { if ( i % part_size == 0 ) Console . WriteLine ( ) ; Console . Write ( str [ i ] ) ; } } static void Main ( ) { String str = " a _ simple _ divide _ string _ quest " ; divideString ( str , 4 ) ; } }

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 readonly String [ ] dictionary = { " GEEKS " , " FOR " , " QUIZ " , " GUQ " , " EE " } ; static readonly int n = dictionary . Length ; static readonly int M = 3 , N = 3 ; static bool isWord ( String str ) { for ( int i = 0 ; i < n ; i ++ ) if ( str . Equals ( dictionary [ i ] ) ) return true ; return false ; } static void findWordsUtil ( char [ , ] boggle , bool [ , ] visited , int i , int j , String str ) { visited [ i , j ] = true ; str = str + boggle [ i , j ] ; if ( isWord ( str ) ) Console . WriteLine ( str ) ; for ( int row = i - 1 ; row <= i + 1 && row < M ; row ++ ) for ( int col = j - 1 ; col <= j + 1 && col < N ; col ++ ) if ( row >= 0 && col >= 0 && ! visited [ row , col ] ) findWordsUtil ( boggle , visited , row , col , str ) ; str = " " + str [ str . Length - 1 ] ; visited [ i , j ] = false ; } static void findWords ( char [ , ] boggle ) { bool [ , ] visited = new bool [ M , N ] ; String str = " " ; for ( int i = 0 ; i < M ; i ++ ) for ( int j = 0 ; j < N ; j ++ ) findWordsUtil ( boggle , visited , i , j , str ) ; } public static void Main ( String [ ] args ) { char [ , ] boggle = { { ' G ' , ' I ' , ' Z ' } , { ' U ' , ' E ' , ' K ' } , { ' Q ' , ' S ' , ' E ' } } ; Console . WriteLine ( " Following ▁ words ▁ of ▁ " + " dictionary ▁ are ▁ present " ) ; findWords ( boggle ) ; } }

Index/key variables: i
Accumulator variables: col, i, j, row
Iterator variables: col, i, j, row
Class/struct names: GFG
C# program:
using System ; using System . Collections . Generic ; public class GFG { class node { public int data ; public node left , right ; } ; static node newNode ( int key ) { node temp = new node ( ) ; temp . data = key ; temp . left = temp . right = null ; return ( temp ) ; } static void printLevelOrder ( node root ) { if ( root == null ) return ; Queue < node > q = new Queue < node > ( ) ; q . Enqueue ( root ) ; while ( q . Count != 0 ) { node temp = q . Peek ( ) ; Console . Write ( temp . data + " ▁ " ) ; q . Dequeue ( ) ; if ( temp . left != null ) { q . Enqueue ( temp . left ) ; } else if ( temp . right != null ) { Console . Write ( " null ▁ " ) ; } if ( temp . right != null ) { q . Enqueue ( temp . right ) ; } else if ( temp . left != null ) { Console . Write ( " null ▁ " ) ; } } } static node pruneTree ( node root ) { if ( root == null ) { return null ; } root . left = pruneTree ( root . left ) ; root . right = pruneTree ( root . right ) ; if ( root . data % 2 == 0 && root . right == null && root . left == null ) return null ; return root ; } public static void Main ( String [ ] args ) { node root = newNode ( 1 ) ; root . left = newNode ( 2 ) ; root . left . left = newNode ( 8 ) ; root . left . right = newNode ( 10 ) ; root . right = newNode ( 7 ) ; root . right . left = newNode ( 12 ) ; root . right . right = newNode ( 5 ) ; node newRoot = pruneTree ( root ) ; printLevelOrder ( newRoot ) ; } }

Class/struct names: GFG, node
C# program:
using System ; class GFG { static int countWays ( int [ , ] mtrx , int vrtx , int i , int dest , bool [ ] visited ) { if ( i == dest ) { return 1 ; } int total = 0 ; for ( int j = 0 ; j < vrtx ; j ++ ) { if ( mtrx [ i , j ] == 1 && ! visited [ j ] ) { visited [ j ] = true ; total += countWays ( mtrx , vrtx , j , dest , visited ) ; visited [ j ] = false ; } } return total ; } static int totalWays ( int [ , ] mtrx , int vrtx , int src , int dest ) { bool [ ] visited = new bool [ vrtx ] ; for ( int i = 0 ; i < vrtx ; i ++ ) { visited [ i ] = false ; } visited [ src ] = true ; return countWays ( mtrx , vrtx , src , dest , visited ) ; } public static void Main ( ) { int vrtx = 11 ; int [ , ] mtrx = { { 0 , 1 , 0 , 0 , 0 , 0 , 1 , 0 , 0 , 0 , 0 } , { 1 , 0 , 1 , 1 , 0 , 0 , 0 , 0 , 0 , 0 , 0 } , { 0 , 1 , 0 , 1 , 0 , 0 , 0 , 0 , 0 , 0 , 0 } , { 0 , 1 , 1 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 } , { 0 , 0 , 0 , 0 , 0 , 1 , 0 , 0 , 0 , 1 , 0 } , { 0 , 0 , 0 , 0 , 1 , 0 , 1 , 0 , 0 , 1 , 0 } , { 1 , 0 , 0 , 0 , 0 , 1 , 0 , 1 , 0 , 0 , 0 } , { 0 , 0 , 0 , 0 , 0 , 0 , 1 , 0 , 1 , 0 , 0 } , { 0 , 0 , 0 , 0 , 0 , 0 , 0 , 1 , 0 , 1 , 0 } , { 0 , 0 , 0 , 0 , 1 , 1 , 0 , 0 , 1 , 0 , 0 } , { 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 1 , 0 } } ; int src = 3 ; int dest = 9 ; Console . Write ( totalWays ( mtrx , vrtx , src - 1 , dest - 1 ) ) ; } }

Index/key variables: i, j, src, vrtx
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 printExistPath ( Stack < int > sx , Stack < int > sy , int last ) { if ( sx . Count == 0 sy . Count == 0 ) { return ; } int x = sx . Peek ( ) ; int y = sy . Peek ( ) ; sx . Pop ( ) ; sy . Pop ( ) ; printExistPath ( sx , sy , last ) ; if ( sx . Count == last - 1 ) { Console . Write ( " ( " + x + " , ▁ " + y + " ) " ) ; } else { Console . Write ( " ( " + x + " , ▁ " + y + " ) - > " ) ; } } static bool storePath ( int srcX , int srcY , int destX , int destY , Stack < int > sx , Stack < int > sy ) { if ( srcX > destX srcY > destY ) { return false ; } sx . Push ( srcX ) ; sy . Push ( srcY ) ; if ( srcX == destX && srcY == destY ) { printExistPath ( sx , sy , sx . Count ) ; return true ; } if ( storePath ( ( 2 * srcX ) + srcY , srcY , destX , destY , sx , sy ) ) { return true ; } if ( storePath ( srcX , ( 2 * srcY ) + srcX , destX , destY , sx , sy ) ) { return true ; } sx . Pop ( ) ; sy . Pop ( ) ; return false ; } static bool isPathExist ( int srcX , int srcY , int destX , int destY ) { Stack < int > sx = new Stack < int > ( ) ; Stack < int > sy = new Stack < int > ( ) ; return storePath ( srcX , srcY , destX , destY , sx , sy ) ; } static void printPath ( int srcX , int srcY , int destX , int destY ) { if ( ! isPathExist ( srcX , srcY , destX , destY ) ) { Console . Write ( " - 1" ) ; } } public static void Main ( String [ ] args ) { int srcX = 5 , srcY = 8 ; int destX = 83 , destY = 21 ; printPath ( srcX , srcY , destX , destY ) ; } }

Class/struct names: GFG
C# program:
using System ; class GFG { class Node { public int key ; public Node left , right ; } ; static Node newNode ( int key ) { Node temp = new Node ( ) ; temp . key = key ; temp . left = temp . right = null ; return ( temp ) ; } static int evenPaths ( Node node , int count ) { if ( node == null || ( node . key % 2 != 0 ) ) { return count ; } if ( node . left == null && node . right == null ) { count ++ ; } count = evenPaths ( node . left , count ) ; return evenPaths ( node . right , count ) ; } static int countEvenPaths ( Node node ) { return evenPaths ( node , 0 ) ; } public static void Main ( String [ ] args ) { Node root = newNode ( 12 ) ; root . left = newNode ( 13 ) ; root . right = newNode ( 12 ) ; root . right . left = newNode ( 14 ) ; root . right . right = newNode ( 16 ) ; root . right . left . left = newNode ( 21 ) ; root . right . left . right = newNode ( 22 ) ; root . right . right . left = newNode ( 22 ) ; root . right . right . right = newNode ( 24 ) ; root . right . right . right . left = newNode ( 8 ) ; Console . WriteLine ( countEvenPaths ( root ) ) ; } }

Accumulator variables: count
Class/struct names: GFG, Node
C# program:
using System ; using System . Collections . Generic ; class GFG { static List < int > c = new List < int > ( ) ; static int ans = 0 ; static void subsetSum ( int i , int curr ) { if ( i == c . Count ) { ans += curr ; return ; } subsetSum ( i + 1 , curr + c [ i ] ) ; subsetSum ( i + 1 , curr ) ; } static void subsetGen ( int [ ] arr , int i , int n ) { if ( i == n ) { subsetSum ( 0 , 0 ) ; return ; } subsetGen ( arr , i + 1 , n ) ; c . Add ( arr [ i ] ) ; subsetGen ( arr , i + 1 , n ) ; c . RemoveAt ( c . Count - 1 ) ; } public static void Main ( String [ ] args ) { int [ ] arr = { 1 , 1 } ; int n = arr . Length ; subsetGen ( arr , 0 , n ) ; Console . WriteLine ( ans ) ; } }

Index/key variables: i
Accumulator variables: ans
Class/struct names: GFG
C# program:
using System ; using System . Collections . Generic ; public class GFG { static int N = 1000 ; static List < List < int > > adj = new List < List < int > > ( ) ; static void dfsUtil ( int u , int node , bool [ ] visited , List < List < int > > road_used , int parent , int it ) { int c = 0 ; for ( int i = 0 ; i < node ; i ++ ) if ( visited [ i ] ) c ++ ; if ( c == node ) return ; visited [ u ] = true ; road_used . Add ( new List < int > ( ) { parent , u } ) ; Console . Write ( u + " ▁ " ) ; foreach ( int x in adj [ u ] ) { if ( ! visited [ x ] ) { dfsUtil ( x , node , visited , road_used , u , it + 1 ) ; } } for ( int y = 0 ; y < road_used . Count ; y ++ ) { if ( road_used [ y ] [ 1 ] == u ) { dfsUtil ( road_used [ y ] [ 0 ] , node , visited , road_used , u , it + 1 ) ; } } } static void dfs ( int node ) { bool [ ] visited = new bool [ node ] ; List < List < int > > road_used = new List < List < int > > ( ) ; for ( int i = 0 ; i < node ; i ++ ) { visited [ i ] = false ; } dfsUtil ( 0 , node , visited , road_used , - 1 , 0 ) ; } static void insertEdge ( int u , int v ) { adj [ u ] . Add ( v ) ; adj [ v ] . Add ( u ) ; } static public void Main ( ) { int node = 11 ; for ( int i = 0 ; i < N ; i ++ ) { adj . Add ( new List < int > ( ) ) ; } insertEdge ( 0 , 1 ) ; insertEdge ( 0 , 2 ) ; insertEdge ( 1 , 5 ) ; insertEdge ( 1 , 6 ) ; insertEdge ( 2 , 4 ) ; insertEdge ( 2 , 9 ) ; insertEdge ( 6 , 7 ) ; insertEdge ( 6 , 8 ) ; insertEdge ( 7 , 8 ) ; insertEdge ( 2 , 3 ) ; insertEdge ( 3 , 9 ) ; insertEdge ( 3 , 10 ) ; insertEdge ( 9 , 10 ) ; dfs ( node ) ; } }

Index/key variables: i, node, u, v, x, y
Accumulator variables: c, i, y
Iterator variables: i, x, y
Class/struct names: GFG
C# program:
using System ; class GFG { static String max ; static void findMaximumNum ( char [ ] str , int k ) { if ( k == 0 ) return ; int n = str . Length ; for ( int i = 0 ; i < n - 1 ; i ++ ) { for ( int j = i + 1 ; j < n ; j ++ ) { if ( str [ i ] < str [ j ] ) { char t = str [ i ] ; str [ i ] = str [ j ] ; str [ j ] = t ; if ( String . Join ( " " , str ) . CompareTo ( max ) > 0 ) max = String . Join ( " " , str ) ; findMaximumNum ( str , k - 1 ) ; char c = str [ i ] ; str [ i ] = str [ j ] ; str [ j ] = c ; } } } } public static void Main ( String [ ] args ) { String str = "129814999" ; int k = 4 ; max = str ; findMaximumNum ( str . ToCharArray ( ) , k ) ; Console . Write ( max + " STRNEWLINE " ) ; } }

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 List < List < int > > allPaths = new List < List < int > > ( ) ; static void findPathsUtil ( List < List < int > > maze , int m , int n , int i , int j , List < int > path , int indx ) { if ( i == m - 1 ) { for ( int k = j ; k < n ; k ++ ) { path [ indx + k - j ] = maze [ i ] [ k ] ; } Console . Write ( " [ " + path [ 0 ] + " , ▁ " ) ; for ( int z = 1 ; z < path . Count - 1 ; z ++ ) { Console . Write ( path [ z ] + " , ▁ " ) ; } Console . WriteLine ( path [ path . Count - 1 ] + " ] " ) ; allPaths . Add ( path ) ; return ; } if ( j == n - 1 ) { for ( int k = i ; k < m ; k ++ ) { path [ indx + k - i ] = maze [ k ] [ j ] ; } Console . Write ( " [ " + path [ 0 ] + " , ▁ " ) ; for ( int z = 1 ; z < path . Count - 1 ; z ++ ) { Console . Write ( path [ z ] + " , ▁ " ) ; } Console . WriteLine ( path [ path . Count - 1 ] + " ] " ) ; allPaths . Add ( path ) ; return ; } path [ indx ] = maze [ i ] [ j ] ; findPathsUtil ( maze , m , n , i + 1 , j , path , indx + 1 ) ; findPathsUtil ( maze , m , n , i , j + 1 , path , indx + 1 ) ; } static void findPaths ( List < List < int > > maze , int m , int n ) { List < int > path = new List < int > ( ) ; for ( int i = 0 ; i < m + n - 1 ; i ++ ) { path . Add ( 0 ) ; } findPathsUtil ( maze , m , n , 0 , 0 , path , 0 ) ; } static void Main ( ) { List < List < int > > maze = new List < List < int > > ( ) ; maze . Add ( new List < int > { 1 , 2 , 3 } ) ; maze . Add ( new List < int > { 4 , 5 , 6 } ) ; maze . Add ( new List < int > { 7 , 8 , 9 } ) ; findPaths ( maze , 3 , 3 ) ; } }

Index/key variables: i, indx, j, k, z
Accumulator variables: i, k, z
Iterator variables: i, k, z
Class/struct names: GFG
C# program:
using System ; class GFG { static bool chkPair ( int [ ] A , int size , int x ) { for ( int i = 0 ; i < ( size - 1 ) ; i ++ ) { for ( int j = ( i + 1 ) ; j < size ; j ++ ) { if ( A [ i ] + A [ j ] == x ) { Console . WriteLine ( " Pair ▁ with ▁ a ▁ given ▁ sum ▁ " + x + " ▁ is ▁ ( " + A [ i ] + " , ▁ " + A [ j ] + " ) " ) ; return true ; } } } return false ; } public static void Main ( ) { int [ ] A = { 0 , - 1 , 2 , - 3 , 1 } ; int x = - 2 ; int size = A . Length ; if ( chkPair ( A , size , x ) ) { Console . WriteLine ( " Valid ▁ pair ▁ exists " ) ; } else { Console . WriteLine ( " No ▁ valid ▁ pair ▁ exists ▁ for ▁ " + x ) ; } } }

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 List < int > merge ( List < int > x , List < int > y ) { foreach ( int i in y ) { if ( x [ x . Count - 1 ] > i ) x . Add ( i ) ; } return x ; } static List < int > mergeDel ( List < int > l ) { if ( l . Count == 1 ) return l ; int m = l . Count / 2 ; List < int > temp1 = l . GetRange ( 0 , m ) ; List < int > temp2 = l . GetRange ( m , l . Count - m ) ; return merge ( mergeDel ( temp1 ) , mergeDel ( temp2 ) ) ; } public static void Main ( string [ ] args ) { List < int > arr = new List < int > { 5 , 4 , 3 , 2 , 1 } ; List < int > ans = mergeDel ( arr ) ; Console . Write ( " [ ▁ " ) ; foreach ( int x in ans ) Console . Write ( x + " , ▁ " ) ; Console . Write ( " ] " ) ; } }

Iterator variables: i, x
Class/struct names: GFG
C# program:
using System ; class GFG { static int mergeSort ( int [ ] arr , int array_size ) { int [ ] temp = new int [ array_size ] ; return _mergeSort ( arr , temp , 0 , array_size - 1 ) ; } static int _mergeSort ( int [ ] arr , int [ ] temp , int left , int right ) { int mid , inv_count = 0 ; if ( right > left ) { mid = ( right + left ) / 2 ; inv_count = _mergeSort ( arr , temp , left , mid ) ; inv_count += _mergeSort ( arr , temp , mid + 1 , right ) ; inv_count += merge ( arr , temp , left , mid + 1 , right ) ; } return inv_count ; } static int merge ( int [ ] arr , int [ ] temp , int left , int mid , int right ) { int i , j , k ; int inv_count = 0 ; i = left ; j = mid ; k = left ; while ( ( i <= mid - 1 ) && ( j <= right ) ) { if ( arr [ i ] > 2 * arr [ j ] ) { inv_count += ( mid - i ) ; j ++ ; } else { i ++ ; } } i = left ; j = mid ; k = left ; while ( ( i <= mid - 1 ) && ( j <= right ) ) { if ( arr [ i ] <= arr [ j ] ) { temp [ k ++ ] = arr [ i ++ ] ; } else { temp [ k ++ ] = arr [ j ++ ] ; } } while ( i <= mid - 1 ) temp [ k ++ ] = arr [ i ++ ] ; while ( j <= right ) temp [ k ++ ] = arr [ j ++ ] ; for ( i = left ; i <= right ; i ++ ) arr [ i ] = temp [ i ] ; return inv_count ; } public static void Main ( ) { int [ ] arr = { 1 , 20 , 6 , 4 , 5 } ; int n = arr . Length ; Console . WriteLine ( mergeSort ( arr , n ) ) ; } }

Index/key variables: array_size, i, j
Accumulator variables: i, inv_count, j, k
Iterator variables: i
Class/struct names: GFG
C# program:
using System ; using System . Collections . Generic ; public class geeks { static int N = 100005 ; static int [ ] lazy = new int [ 4 * N ] ; static HashSet < int > se = new HashSet < int > ( ) ; public static void update ( int x , int y , int value , int id , int l , int r ) { if ( x >= r l >= y ) return ; if ( x <= l && r <= y ) { lazy [ id ] = value ; return ; } int mid = ( l + r ) / 2 ; if ( lazy [ id ] != 0 ) lazy [ 2 * id ] = lazy [ 2 * id + 1 ] = lazy [ id ] ; lazy [ id ] = 0 ; update ( x , y , value , 2 * id , l , mid ) ; update ( x , y , value , 2 * id + 1 , mid , r ) ; } public static void query ( int id , int l , int r ) { if ( lazy [ id ] != 0 ) { se . Add ( lazy [ id ] ) ; return ; } if ( r - l < 2 ) return ; int mid = ( l + r ) / 2 ; query ( 2 * id , l , mid ) ; query ( 2 * id + 1 , mid , r ) ; } public static void Main ( String [ ] args ) { int n = 5 , q = 3 ; update ( 1 , 4 , 1 , 1 , 0 , n ) ; update ( 0 , 2 , 2 , 1 , 0 , n ) ; update ( 3 , 4 , 3 , 1 , 0 , n ) ; query ( 1 , 0 , n ) ; Console . WriteLine ( se . Count ) ; } }

Index/key variables: id
Class/struct names: geeks
C# program:
using System ; class GFG { static void shuffleArray ( int [ ] a , int n ) { for ( int i = 0 , q = 1 , k = n ; i < n ; i ++ , k ++ , q ++ ) for ( int j = k ; j > i + q ; j -- ) { int temp = a [ j - 1 ] ; a [ j - 1 ] = a [ j ] ; a [ j ] = temp ; } } public static void Main ( ) { int [ ] a = { 1 , 3 , 5 , 7 , 2 , 4 , 6 , 8 } ; shuffleArray ( a , a . Length / 2 ) ; for ( int i = 0 ; i < a . Length ; i ++ ) Console . Write ( a [ i ] + " ▁ " ) ; } }

Index/key variables: i, j
Accumulator variables: i, j, k, q
Iterator variables: i, j
Class/struct names: GFG
C# program:
using System ; public class GFG { static bool isFeasible ( int mid , int [ ] arr , int n , int k ) { int pos = arr [ 0 ] ; int elements = 1 ; for ( int i = 1 ; i < n ; i ++ ) { if ( arr [ i ] - pos >= mid ) { pos = arr [ i ] ; elements ++ ; if ( elements == k ) return true ; } } return false ; } static int largestMinDist ( int [ ] arr , int n , int k ) { Array . Sort ( arr ) ; int res = - 1 ; int left = 1 , right = arr [ n - 1 ] ; while ( left < right ) { int mid = ( left + right ) / 2 ; if ( isFeasible ( mid , arr , n , k ) ) { res = Math . Max ( res , mid ) ; left = mid + 1 ; } else right = mid ; } return res ; } public static void Main ( ) { int [ ] arr = { 1 , 2 , 8 , 4 , 9 } ; int n = arr . Length ; int k = 3 ; Console . WriteLine ( largestMinDist ( arr , n , k ) ) ; } }

Index/key variables: i
Accumulator variables: elements, i
Iterator variables: i
Class/struct names: GFG
C# program:
using System ; using System . Collections . Generic ; class GFG { static void findFrequency ( int [ ] arr , int n ) { Dictionary < int , int > mp = new Dictionary < int , int > ( ) ; for ( int i = 0 ; i < n ; i ++ ) { if ( ! mp . ContainsKey ( arr [ i ] ) ) mp [ arr [ i ] ] = 0 ; mp [ arr [ i ] ] ++ ; } foreach ( KeyValuePair < int , int > kvp in mp ) Console . WriteLine ( " Element ▁ " + kvp . Key + " ▁ occurs ▁ " + kvp . Value + " ▁ times " ) ; } public static void Main ( ) { int [ ] arr = { 1 , 1 , 1 , 2 , 3 , 3 , 5 , 5 , 8 , 8 , 8 , 9 , 9 , 10 } ; int n = arr . Length ; findFrequency ( arr , n ) ; } }

Index/key variables: i
Accumulator variables: i
Iterator variables: i, kvp
Class/struct names: GFG
C# program:
using System ; class GFG { public static int floorSqrt ( int x ) { if ( x == 0 x == 1 ) return x ; int start = 1 , end = x , ans = 0 ; while ( start <= end ) { int mid = ( start + end ) / 2 ; if ( mid * mid == x ) return mid ; if ( mid * mid < x ) { start = mid + 1 ; ans = mid ; } else end = mid - 1 ; } return ans ; } static public void Main ( ) { int x = 11 ; Console . WriteLine ( floorSqrt ( x ) ) ; } }

Class/struct names: GFG
C# program:
using System ; class GFG { static void findSides ( double A , double C , double c ) { double B = 180 - ( A + C ) ; A = A * ( 3.14159 / 180 ) ; C = C * ( 3.14159 / 180 ) ; B = B * ( 3.14159 / 180 ) ; double a = ( c / Math . Sin ( C ) ) * Math . Sin ( A ) ; double b = ( c / Math . Sin ( C ) ) * Math . Sin ( B ) ; Console . WriteLine ( " { 0 : F2 } " , a ) ; Console . WriteLine ( " { 0 : F2 } " , b ) ; } public static void Main ( String [ ] args ) { double A = 45.0 ; double C = 35.0 ; double c = 23 ; findSides ( A , C , c ) ; } }

Class/struct names: GFG