dhyuti-n/xlcost-variable-roles huggingface dataset:
C# program:
using System ; using System . Collections . Generic ; public class GFG { public class Node { public int data ; public Node left , right ; } ; static Dictionary < int , int > grid = new Dictionary < int , int > ( ) ; static Node newNode ( int data ) { Node Node = new Node ( ) ; Node . data = data ; Node . left = Node . right = null ; return Node ; } static void addConsideringGrid ( Node root , int level , int index ) { if ( root == null ) return ; if ( grid . ContainsKey ( level - index ) ) grid [ level - index ] = grid [ level - index ] + ( root . data ) ; else grid . Add ( level - index , root . data ) ; addConsideringGrid ( root . left , level + 1 , index - 1 ) ; addConsideringGrid ( root . right , level + 1 , index + 1 ) ; } static List < int > diagonalSum ( Node root ) { grid . Clear ( ) ; addConsideringGrid ( root , 0 , 0 ) ; List < int > ans = new List < int > ( ) ; foreach ( KeyValuePair < int , int > x in grid ) { ans . Add ( x . Value ) ; } return ans ; } public static void Main ( String [ ] args ) { Node root = newNode ( 1 ) ; root . left = newNode ( 2 ) ; root . right = newNode ( 3 ) ; root . left . left = newNode ( 9 ) ; root . left . right = newNode ( 6 ) ; root . right . left = newNode ( 4 ) ; root . right . right = newNode ( 5 ) ; root . right . left . right = newNode ( 7 ) ; root . right . left . left = newNode ( 12 ) ; root . left . right . left = newNode ( 11 ) ; root . left . left . right = newNode ( 10 ) ; List < int > v = diagonalSum ( root ) ; for ( int i = 0 ; i < v . Count ; i ++ ) Console . Write ( v [ i ] + " ▁ " ) ; } }

Index/key variables: i
Accumulator variables: i
Iterator variables: i, x
Class/struct names: GFG, Node
C# program:
using System ; class GFG { static int N = 1000 ; static int [ ] prefixans = new int [ N ] ; static void countIndex ( int [ ] a , int n ) { for ( int i = 0 ; i < n - 1 ; i ++ ) { if ( a [ i ] == a [ i + 1 ] ) prefixans [ i ] = 1 ; if ( i != 0 ) prefixans [ i ] += prefixans [ i - 1 ] ; } } static int answer_query ( int l , int r ) { if ( l == 0 ) return prefixans [ r - 1 ] ; else return prefixans [ r - 1 ] - prefixans [ l - 1 ] ; } static void Main ( ) { int [ ] a = new int [ ] { 1 , 2 , 2 , 2 , 3 , 3 , 4 , 4 , 4 } ; int n = a . Length ; countIndex ( a , n ) ; int L , R ; L = 1 ; R = 8 ; Console . WriteLine ( answer_query ( L , R ) ) ; L = 0 ; R = 4 ; Console . WriteLine ( answer_query ( L , R ) ) ; } }

Index/key variables: N, i
Accumulator variables: i
Iterator variables: i
Class/struct names: GFG
C# program:
class Solution { static int primeSubarrays ( int [ ] A , int n ) { int max_val = ( int ) ( System . Math . Pow ( 10 , 7 ) ) ; bool [ ] prime = new bool [ max_val + 1 ] ; for ( int p = 0 ; p < max_val + 1 ; p ++ ) prime [ p ] = true ; prime [ 0 ] = false ; prime [ 1 ] = false ; for ( int p = 2 ; p * p <= max_val ; p ++ ) { if ( prime [ p ] == true ) { for ( int i = p * 2 ; i <= max_val ; i += p ) prime [ i ] = false ; } } int cnt = 0 ; for ( int i = 0 ; i < n - 1 ; ++ i ) { int val = A [ i ] ; for ( int j = i + 1 ; j < n ; ++ j ) { val += A [ j ] ; if ( prime [ val ] ) ++ cnt ; } } return cnt ; } static void Main ( ) { int [ ] A = { 1 , 2 , 3 , 4 , 5 } ; int n = A . Length ; System . Console . WriteLine ( primeSubarrays ( A , n ) ) ; } }

Index/key variables: i, j, p, val
Accumulator variables: i, p, val
Iterator variables: i, j, p
Class/struct names: Solution
C# program:
using System ; using System . Collections . Generic ; class GFG { static int repeated_digit ( int n ) { var s = new HashSet < int > ( ) ; while ( n != 0 ) { int d = n % 10 ; if ( s . Contains ( d ) ) { return 0 ; } s . Add ( d ) ; n = n / 10 ; } return 1 ; } static int calculate ( int L , int R ) { int answer = 0 ; for ( int i = L ; i < R + 1 ; ++ i ) { answer = answer + repeated_digit ( i ) ; } return answer ; } public static void Main ( String [ ] args ) { int L = 1 , R = 100 ; Console . WriteLine ( calculate ( L , R ) ) ; } }

Iterator variables: i
Class/struct names: GFG
C# program:
using System ; public class GFG { public static int countMinSwaps ( string st ) { int min_swaps = 0 ; int odd_0 = 0 , even_0 = 0 ; int odd_1 = 0 , even_1 = 0 ; int n = st . Length ; for ( int i = 0 ; i < n ; i ++ ) { if ( i % 2 == 0 ) { if ( st [ i ] == '1' ) { even_1 ++ ; } else { even_0 ++ ; } } else { if ( st [ i ] == '1' ) { odd_1 ++ ; } else { odd_0 ++ ; } } } int cnt_swaps_1 = Math . Min ( even_0 , odd_1 ) ; int cnt_swaps_2 = Math . Min ( even_1 , odd_0 ) ; return Math . Min ( cnt_swaps_1 , cnt_swaps_2 ) ; } public static void Main ( string [ ] args ) { string st = "000111" ; Console . WriteLine ( countMinSwaps ( st ) ) ; } }

Index/key variables: i
Accumulator variables: even_0, even_1, i, odd_0, odd_1
Iterator variables: i
Class/struct names: GFG
C# program:
using System ; using System . Collections . Generic ; class GFG { static int MAX = 100 ; static List < int > Prefix = new List < int > ( ) ; static int repeated_digit ( int n ) { HashSet < int > a = new HashSet < int > ( ) ; int d ; while ( n != 0 ) { d = n % 10 ; if ( a . Contains ( d ) ) return 0 ; a . Add ( d ) ; n /= 10 ; } return 1 ; } static void pre_calculations ( ) { Prefix . Add ( 0 ) ; Prefix . Add ( repeated_digit ( 1 ) ) ; for ( int i = 2 ; i < MAX + 1 ; i ++ ) Prefix . Add ( repeated_digit ( i ) + Prefix [ i - 1 ] ) ; } static int calculate ( int L , int R ) { return Prefix [ R ] - Prefix [ L - 1 ] ; } public static void Main ( String [ ] args ) { int L = 1 , R = 100 ; pre_calculations ( ) ; Console . WriteLine ( calculate ( L , R ) ) ; } }

Index/key variables: R
Accumulator variables: i, n
Iterator variables: i
Class/struct names: GFG
C# program:
using System ; class GFG { static void initializeDiffArray ( int [ ] A , int [ ] D ) { int n = A . Length ; D [ 0 ] = A [ 0 ] ; D [ n ] = 0 ; for ( int i = 1 ; i < n ; i ++ ) D [ i ] = A [ i ] - A [ i - 1 ] ; } static void update ( int [ ] D , int l , int r , int x ) { D [ l ] += x ; D [ r + 1 ] -= x ; } static int printArray ( int [ ] A , int [ ] D ) { for ( int i = 0 ; i < A . Length ; i ++ ) { if ( i == 0 ) A [ i ] = D [ i ] ; else A [ i ] = D [ i ] + A [ i - 1 ] ; Console . Write ( A [ i ] + " ▁ " ) ; } Console . WriteLine ( ) ; return 0 ; } public static void Main ( ) { int [ ] A = { 10 , 5 , 20 , 40 } ; int n = A . Length ; int [ ] D = new int [ n + 1 ] ; initializeDiffArray ( A , D ) ; update ( D , 0 , 1 , 10 ) ; printArray ( A , D ) ; update ( D , 1 , 3 , 20 ) ; update ( D , 2 , 2 , 30 ) ; printArray ( A , D ) ; } }

Index/key variables: i, l, n
Accumulator variables: i
Iterator variables: i
Class/struct names: GFG
C# program:
using System ; class GFG { static long modpow ( long base1 , long exp , long modulus ) { base1 %= modulus ; long result = 1 ; while ( exp > 0 ) { if ( ( exp & 1 ) > 0 ) result = ( result * base1 ) % modulus ; base1 = ( base1 * base1 ) % modulus ; exp >>= 1 ; } return result ; } public static void Main ( ) { long n = 654654 ; long mod = 971 ; Console . WriteLine ( ( ( modpow ( n , 6 , mod ) + modpow ( n , 2 , mod ) ) % mod + 355 ) % mod ) ; } }

Class/struct names: GFG
C# program:
using System ; class GFG { static int maxSubArraySum ( int [ ] a ) { int size = a . Length ; int max_so_far = int . MinValue , max_ending_here = 0 ; for ( int i = 0 ; i < size ; i ++ ) { max_ending_here = max_ending_here + a [ i ] ; if ( max_so_far < max_ending_here ) max_so_far = max_ending_here ; if ( max_ending_here < 0 ) max_ending_here = 0 ; } return max_so_far ; } public static void Main ( ) { int [ ] a = { - 2 , - 3 , 4 , - 1 , - 2 , 1 , 5 , - 3 } ; Console . Write ( " Maximum ▁ contiguous ▁ sum ▁ is ▁ " + maxSubArraySum ( a ) ) ; } }

Index/key variables: i
Accumulator variables: i
Iterator variables: i
Class/struct names: GFG
C# program:
using System ; class GFG { static int [ , ] solve ( int [ , ] arr , int n ) { int [ , ] ans = new int [ n , n ] ; for ( int i = 0 ; i < n ; i ++ ) { for ( int j = 0 ; j < n ; j ++ ) { ans [ i , j ] = arr [ j , ( i + j ) % n ] ; } } return ans ; } static void show ( int [ , ] arr , int n ) { int [ , ] res = solve ( arr , n ) ; for ( int i = 0 ; i < n ; i ++ ) { for ( int j = 0 ; j < n ; j ++ ) { Console . Write ( res [ i , j ] + " ▁ " ) ; } Console . WriteLine ( ) ; } } static int [ , ] makeArray ( int n ) { int [ , ] arr = new int [ n , n ] ; int c = 1 ; for ( int i = 0 ; i < n ; i ++ ) { for ( int j = 0 ; j < n ; j ++ ) arr [ i , j ] = c ++ ; } return arr ; } static void Main ( ) { int n = 5 ; int [ , ] arr = makeArray ( n ) ; show ( arr , n ) ; } }

Accumulator variables: c, i, j
Iterator variables: i, j
Class/struct names: GFG
C# program:
static int maxSubArraySum ( int [ ] a , int size ) { int max_so_far = a [ 0 ] , max_ending_here = 0 ; for ( int i = 0 ; i < size ; i ++ ) { max_ending_here = max_ending_here + a [ i ] ; if ( max_ending_here < 0 ) max_ending_here = 0 ; else if ( max_so_far < max_ending_here ) max_so_far = max_ending_here ; } return max_so_far ; }

Index/key variables: i
Accumulator variables: i
Iterator variables: i
C# program:
using System ; class GFG { static int findMinRooms ( string [ ] slots , int n , int m ) { int [ ] counts = new int [ m ] ; for ( int i = 0 ; i < m ; i ++ ) counts [ i ] = 0 ; for ( int i = 0 ; i < n ; i ++ ) for ( int j = 0 ; j < m ; j ++ ) if ( slots [ i ] [ j ] == '1' ) counts [ j ] ++ ; int max = - 1 ; for ( int i = 0 ; i < m ; i ++ ) if ( max < counts [ i ] ) max = counts [ i ] ; return max ; } public static void Main ( ) { int n = 3 , m = 7 ; String [ ] slots = { "0101011" , "0011001" , "0110111" } ; Console . Write ( findMinRooms ( slots , n , m ) ) ; } }

Index/key variables: i, j, m
Accumulator variables: i, j
Iterator variables: i, j
Class/struct names: GFG
C# program:
using System ; class GFG { static int maxSubArraySum ( int [ ] a , int size ) { int max_so_far = a [ 0 ] ; int curr_max = a [ 0 ] ; for ( int i = 1 ; i < size ; i ++ ) { curr_max = Math . Max ( a [ i ] , curr_max + a [ i ] ) ; max_so_far = Math . Max ( max_so_far , curr_max ) ; } return max_so_far ; } public static void Main ( ) { int [ ] a = { - 2 , - 3 , 4 , - 1 , - 2 , 1 , 5 , - 3 } ; int n = a . Length ; Console . Write ( " Maximum ▁ contiguous ▁ sum ▁ is ▁ " + maxSubArraySum ( a , n ) ) ; } }

Index/key variables: i
Accumulator variables: i
Iterator variables: i
Class/struct names: GFG
C# program:
using System ; class GFG { static void maxSubArraySum ( int [ ] a , int size ) { int max_so_far = int . MinValue , max_ending_here = 0 , start = 0 , end = 0 , s = 0 ; for ( int i = 0 ; i < size ; i ++ ) { max_ending_here += a [ i ] ; if ( max_so_far < max_ending_here ) { max_so_far = max_ending_here ; start = s ; end = i ; } if ( max_ending_here < 0 ) { max_ending_here = 0 ; s = i + 1 ; } } Console . WriteLine ( " Maximum ▁ contiguous ▁ " + " sum ▁ is ▁ " + max_so_far ) ; Console . WriteLine ( " Starting ▁ index ▁ " + start ) ; Console . WriteLine ( " Ending ▁ index ▁ " + end ) ; } public static void Main ( ) { int [ ] a = { - 2 , - 3 , 4 , - 1 , - 2 , 1 , 5 , - 3 } ; int n = a . Length ; maxSubArraySum ( a , n ) ; } }

Index/key variables: i
Accumulator variables: i, max_ending_here
Iterator variables: i
Class/struct names: GFG
C# program:
using System ; public class GfG { public static void countCurrency ( int amount ) { int [ ] notes = new int [ ] { 2000 , 500 , 200 , 100 , 50 , 20 , 10 , 5 , 1 } ; int [ ] noteCounter = new int [ 9 ] ; for ( int i = 0 ; i < 9 ; i ++ ) { if ( amount >= notes [ i ] ) { noteCounter [ i ] = amount / notes [ i ] ; amount = amount - noteCounter [ i ] * notes [ i ] ; } } Console . WriteLine ( " Currency ▁ Count ▁ - > " ) ; for ( int i = 0 ; i < 9 ; i ++ ) { if ( noteCounter [ i ] != 0 ) { Console . WriteLine ( notes [ i ] + " ▁ : ▁ " + noteCounter [ i ] ) ; } } } public static void Main ( ) { int amount = 868 ; countCurrency ( amount ) ; } }

Index/key variables: i
Accumulator variables: i
Iterator variables: i
Class/struct names: GfG
C# program:
using System ; using System . Linq ; public class GFG { static int minSum ( int [ ] A , int n ) { int min_val = A . Min ( ) ; return ( min_val * ( n - 1 ) ) ; } static public void Main ( ) { int [ ] A = { 3 , 6 , 2 , 8 , 7 , 5 } ; int n = A . Length ; Console . WriteLine ( minSum ( A , n ) ) ; } }

Class/struct names: GFG
C# program:
using System ; using System . Linq ; public class GFG { static void NextFit ( int [ ] blockSize , int m , int [ ] processSize , int n ) { int [ ] allocation = new int [ n ] ; int j = 0 ; Enumerable . Repeat ( - 1 , n ) . ToArray ( ) ; for ( int i = 0 ; i < n ; i ++ ) { while ( j < m ) { if ( blockSize [ j ] >= processSize [ i ] ) { allocation [ i ] = j ; blockSize [ j ] -= processSize [ i ] ; break ; } j = ( j + 1 ) % m ; } } Console . Write ( " STRNEWLINE Process ▁ No . TABSYMBOL Process ▁ Size TABSYMBOL Block ▁ no . STRNEWLINE " ) ; for ( int i = 0 ; i < n ; i ++ ) { Console . Write ( i + 1 + " TABSYMBOL TABSYMBOL " + processSize [ i ] + " TABSYMBOL TABSYMBOL " ) ; if ( allocation [ i ] != - 1 ) { Console . Write ( allocation [ i ] + 1 ) ; } else { Console . Write ( " Not ▁ Allocated " ) ; } Console . WriteLine ( " " ) ; } } static public void Main ( ) { int [ ] blockSize = { 5 , 10 , 20 } ; int [ ] processSize = { 10 , 20 , 5 } ; int m = blockSize . Length ; int n = processSize . Length ; NextFit ( blockSize , m , processSize , n ) ; } }

Index/key variables: i, j, n
Accumulator variables: i
Iterator variables: i
Class/struct names: GFG
C# program:
using System ; using System . Collections . Generic ; class GFG { static void Main ( ) { int [ ] price = { 2 , 30 , 15 , 10 , 8 , 25 , 80 } ; int profit = 0 ; for ( int i = 1 ; i < price . Length ; i ++ ) { int sub = price [ i ] - price [ i - 1 ] ; if ( sub > 0 ) profit += sub ; } Console . WriteLine ( " Maximum ▁ Profit = " + profit ) ; } }

Index/key variables: i
Accumulator variables: i, profit
Iterator variables: i
Class/struct names: GFG
C# program:
using System ; using System . Collections . Generic ; class GFG { public class Node { public int data ; public Node left , right ; } ; static Node newnode ( int data ) { Node node = new Node ( ) ; node . data = data ; node . left = node . right = null ; return ( node ) ; } static bool printPathUtil ( Node node , HashSet < int > s , int root_data ) { if ( node == null ) return false ; int rem = root_data - node . data ; if ( s . Contains ( rem ) ) return true ; s . Add ( node . data ) ; bool res = printPathUtil ( node . left , s , root_data ) || printPathUtil ( node . right , s , root_data ) ; s . Remove ( node . data ) ; return res ; } static bool isPathSum ( Node root ) { HashSet < int > s = new HashSet < int > ( ) ; return printPathUtil ( root . left , s , root . data ) || printPathUtil ( root . right , s , root . data ) ; } public static void Main ( String [ ] args ) { Node root = newnode ( 8 ) ; root . left = newnode ( 5 ) ; root . right = newnode ( 4 ) ; root . left . left = newnode ( 9 ) ; root . left . right = newnode ( 7 ) ; root . left . right . left = newnode ( 1 ) ; root . left . right . right = newnode ( 12 ) ; root . left . right . right . right = newnode ( 2 ) ; root . right . right = newnode ( 11 ) ; root . right . right . left = newnode ( 3 ) ; Console . Write ( isPathSum ( root ) == true ? " Yes " : " No " ) ; } }

Class/struct names: GFG, Node
C# program:
using System ; using System . Collections . Generic ; class LRU { public static void Main ( String [ ] args ) { int capacity = 4 ; int [ ] arr = { 7 , 0 , 1 , 2 , 0 , 3 , 0 , 4 , 2 , 3 , 0 , 3 , 2 } ; List < int > s = new List < int > ( capacity ) ; int count = 0 ; int page_faults = 0 ; foreach ( int i in arr ) { if ( ! s . Contains ( i ) ) { if ( s . Count == capacity ) { s . RemoveAt ( 0 ) ; s . Insert ( capacity - 1 , i ) ; } else s . Insert ( count , i ) ; page_faults ++ ; ++ count ; } else { s . Remove ( i ) ; s . Insert ( s . Count , i ) ; } } Console . WriteLine ( page_faults ) ; } }

Accumulator variables: page_faults
Iterator variables: i
Class/struct names: LRU
C# program:
using System ; class Test { static int [ ] arr = new int [ ] { 3 , 7 , 90 , 20 , 10 , 50 , 40 } ; static void findMinAvgSubarray ( int n , int k ) { if ( n < k ) return ; int res_index = 0 ; int curr_sum = 0 ; for ( int i = 0 ; i < k ; i ++ ) curr_sum += arr [ i ] ; int min_sum = curr_sum ; for ( int i = k ; i < n ; i ++ ) { curr_sum += arr [ i ] - arr [ i - k ] ; if ( curr_sum < min_sum ) { min_sum = curr_sum ; res_index = ( i - k + 1 ) ; } } Console . Write ( " Subarray ▁ between ▁ [ " + res_index + " , ▁ " + ( res_index + k - 1 ) + " ] ▁ has ▁ minimum ▁ average " ) ; } public static void Main ( ) { int k = 3 ; findMinAvgSubarray ( arr . Length , k ) ; } }

Index/key variables: i
Accumulator variables: curr_sum, i
Iterator variables: i
Class/struct names: Test
C# program:
using System ; class GFG { static int [ ] seg = new int [ 10 ] { 6 , 2 , 5 , 5 , 4 , 5 , 6 , 3 , 7 , 6 } ; static int computeSegment ( int x ) { if ( x == 0 ) return seg [ 0 ] ; int count = 0 ; while ( x > 0 ) { count += seg [ x % 10 ] ; x /= 10 ; } return count ; } static int elementMinSegment ( int [ ] arr , int n ) { int minseg = computeSegment ( arr [ 0 ] ) ; int minindex = 0 ; for ( int i = 1 ; i < n ; i ++ ) { int temp = computeSegment ( arr [ i ] ) ; if ( temp < minseg ) { minseg = temp ; minindex = i ; } } return arr [ minindex ] ; } static public void Main ( ) { int [ ] arr = { 489 , 206 , 745 , 123 , 756 } ; int n = arr . Length ; Console . WriteLine ( elementMinSegment ( arr , n ) ) ; } }

Index/key variables: i, minindex
Accumulator variables: count, i, x
Iterator variables: i
Class/struct names: GFG
C# program:
using System ; class GFG { static void findLargest ( int m , int s ) { if ( s == 0 ) { Console . Write ( m == 1 ? " Largest ▁ number ▁ is ▁ 0" : " Not ▁ possible " ) ; return ; } if ( s > 9 * m ) { Console . WriteLine ( " Not ▁ possible " ) ; return ; } int [ ] res = new int [ m ] ; for ( int i = 0 ; i < m ; i ++ ) { if ( s >= 9 ) { res [ i ] = 9 ; s -= 9 ; } else { res [ i ] = s ; s = 0 ; } } Console . Write ( " Largest ▁ number ▁ is ▁ " ) ; for ( int i = 0 ; i < m ; i ++ ) Console . Write ( res [ i ] ) ; } static public void Main ( ) { int s = 9 , m = 2 ; findLargest ( m , s ) ; } }

Index/key variables: i, m
Accumulator variables: i, s
Iterator variables: i
Class/struct names: GFG
C# program:
using System ; class GFG { static String str ; static int min ( int a , int b ) { return ( a < b ) ? a : b ; } static int findOverlappingPair ( String str1 , String str2 ) { int max = Int32 . MinValue ; int len1 = str1 . Length ; int len2 = str2 . Length ; for ( int i = 1 ; i <= min ( len1 , len2 ) ; i ++ ) { if ( str1 . Substring ( len1 - i ) . CompareTo ( str2 . Substring ( 0 , i ) ) == 0 ) { if ( max < i ) { max = i ; str = str1 + str2 . Substring ( i ) ; } } } for ( int i = 1 ; i <= min ( len1 , len2 ) ; i ++ ) { if ( str1 . Substring ( 0 , i ) . CompareTo ( str2 . Substring ( len2 - i ) ) == 0 ) { if ( max < i ) { max = i ; str = str2 + str1 . Substring ( i ) ; } } } return max ; } static String findShortestSuperstring ( String [ ] arr , int len ) { while ( len != 1 ) { int max = Int32 . MinValue ; int l = 0 , r = 0 ; String resStr = " " ; for ( int i = 0 ; i < len ; i ++ ) { for ( int j = i + 1 ; j < len ; j ++ ) { int res = findOverlappingPair ( arr [ i ] , arr [ j ] ) ; if ( max < res ) { max = res ; resStr = str ; l = i ; r = j ; } } } len -- ; if ( max == Int32 . MinValue ) arr [ 0 ] += arr [ len ] ; else { arr [ l ] = resStr ; arr [ r ] = arr [ len ] ; } } return arr [ 0 ] ; } public static void Main ( String [ ] args ) { String [ ] arr = { " catgc " , " ctaagt " , " gcta " , " ttca " , " atgcatc " } ; int len = arr . Length ; Console . Write ( " The ▁ Shortest ▁ Superstring ▁ is ▁ " + findShortestSuperstring ( arr , len ) ) ; } }

Index/key variables: i, j, l, len, r
Accumulator variables: i, j, len
Iterator variables: i, j
Class/struct names: GFG
C# program:
using System ; class GFG { static int minJumps ( int [ ] arr , int l , int h ) { if ( h == l ) return 0 ; if ( arr [ l ] == 0 ) return int . MaxValue ; int min = int . MaxValue ; for ( int i = l + 1 ; i <= h && i <= l + arr [ l ] ; i ++ ) { int jumps = minJumps ( arr , i , h ) ; if ( jumps != int . MaxValue && jumps + 1 < min ) min = jumps + 1 ; } return min ; } public static void Main ( ) { int [ ] arr = { 1 , 3 , 6 , 3 , 2 , 3 , 6 , 8 , 9 , 5 } ; int n = arr . Length ; Console . Write ( " Minimum ▁ number ▁ of ▁ jumps ▁ to ▁ reach ▁ end ▁ is ▁ " + minJumps ( arr , 0 , n - 1 ) ) ; } }

Index/key variables: l
Accumulator variables: i
Iterator variables: i
Class/struct names: GFG
C# program:
using System ; public class GFG { static int [ , ] dp = new int [ 1001 , 3001 ] ; static int recBananaCnt ( int A , int B , int C ) { if ( B <= A ) { return 0 ; } if ( B <= C ) { return B - A ; } if ( A == 0 ) { return B ; } if ( dp [ A , B ] != - 1 ) { return dp [ A , B ] ; } int maxCount = Int32 . MinValue ; int tripCount = B % C == 0 ? ( ( 2 * B ) / C ) - 1 : ( ( 2 * B ) / C ) + 1 ; for ( int i = 1 ; i <= A ; i ++ ) { int curCount = recBananaCnt ( A - i , B - tripCount * i , C ) ; if ( curCount > maxCount ) { maxCount = curCount ; dp [ A , B ] = maxCount ; } } return maxCount ; } static int maxBananaCnt ( int A , int B , int C ) { for ( int i = 0 ; i < 1001 ; i ++ ) for ( int j = 0 ; j < 3001 ; j ++ ) dp [ i , j ] = - 1 ; return recBananaCnt ( A , B , C ) ; } public static void Main ( string [ ] args ) { int A = 1000 ; int B = 3000 ; int C = 1000 ; Console . WriteLine ( maxBananaCnt ( A , B , C ) ) ; } }

Accumulator variables: i, j
Iterator variables: i, j
Class/struct names: GFG
C# program:
using System ; public class GFG { static int calculate ( int position , int used , int unused , int P , int M , int [ , , ] dp ) { if ( position == P ) { return unused == 0 ? 1 : 0 ; } if ( dp [ position , used , unused ] != - 1 ) return dp [ position , used , unused ] ; int result = 0 ; if ( unused > 0 ) { result += calculate ( position + 1 , used + 1 , unused - 1 , P , M , dp ) * unused ; } if ( used > M ) { result += calculate ( position + 1 , used , unused , P , M , dp ) * ( used - M ) ; } return dp [ position , used , unused ] = result ; } static int solve ( int N , int P , int M ) { int [ , , ] dp = new int [ 101 , 101 , 101 ] ; for ( int i = 0 ; i < 101 ; i ++ ) { for ( int j = 0 ; j < 101 ; j ++ ) for ( int k = 0 ; k < 101 ; k ++ ) dp [ i , j , k ] = - 1 ; } return calculate ( 0 , 0 , N , P , M , dp ) ; } public static void Main ( String [ ] args ) { int N = 2 , M = 0 , P = 3 ; Console . WriteLine ( solve ( N , P , M ) ) ; } }

Accumulator variables: i, j, k, result
Iterator variables: i, j, k
Class/struct names: GFG
C# program:
using System ; class GFG { public static int minJumps ( int [ ] arr , int n ) { int [ ] jumps = new int [ n ] ; int min ; jumps [ n - 1 ] = 0 ; for ( int i = n - 2 ; i >= 0 ; i -- ) { if ( arr [ i ] == 0 ) { jumps [ i ] = int . MaxValue ; } else if ( arr [ i ] >= n - i - 1 ) { jumps [ i ] = 1 ; } else { min = int . MaxValue ; for ( int j = i + 1 ; j < n && j <= arr [ i ] + i ; j ++ ) { if ( min > jumps [ j ] ) { min = jumps [ j ] ; } } if ( min != int . MaxValue ) { jumps [ i ] = min + 1 ; } else { jumps [ i ] = min ; } } } return jumps [ 0 ] ; } public static void Main ( string [ ] args ) { int [ ] arr = new int [ ] { 1 , 3 , 6 , 1 , 0 , 9 } ; int size = arr . Length ; Console . WriteLine ( " Minimum ▁ number ▁ of " + " ▁ jumps ▁ to ▁ reach ▁ end ▁ is ▁ " + minJumps ( arr , size ) ) ; } }

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