dhyuti-n/xlcost-variable-roles huggingface dataset:
C# program:
using System ; class GFG { static int countAlternatingSubstrings ( string S , int N ) { int [ , ] dp = new int [ 2 , N ] ; for ( int i = 0 ; i < 2 ; i ++ ) { for ( int j = 0 ; j < N ; j ++ ) { dp [ i , j ] = 0 ; } } for ( int i = N - 1 ; i >= 0 ; i -- ) { if ( i == N - 1 ) { if ( S [ i ] == '1' ) dp [ 1 , i ] = 1 ; else dp [ 0 , i ] = 1 ; } else { if ( S [ i ] == '0' ) dp [ 0 , i ] = 1 + dp [ 1 , i + 1 ] ; else dp [ 1 , i ] = 1 + dp [ 0 , i + 1 ] ; } } int ans = 0 ; for ( int i = 0 ; i < N ; i ++ ) { ans += Math . Max ( dp [ 0 , i ] , dp [ 1 , i ] ) ; } return ans ; } public static void Main ( ) { string S = "0010" ; int N = S . Length ; Console . Write ( countAlternatingSubstrings ( S , N ) ) ; } }

Index/key variables: i
Accumulator variables: ans, i, j
Iterator variables: i, j
Class/struct names: GFG
C# program:
using System ; public class GFG { static int solve ( int [ ] A , int N , int K ) { int sum = 0 ; int c = 0 ; for ( int i = 0 ; i < N ; i ++ ) { sum += A [ i ] ; if ( A [ i ] == 0 ) c ++ ; } if ( ( K > sum ) || ( ( ( sum + K ) % 2 ) != 0 ) ) return 0 ; sum = ( sum + K ) / 2 ; int [ , ] dp = new int [ N + 1 , sum + 1 ] ; for ( int i = 0 ; i <= sum ; i ++ ) dp [ 0 , i ] = 0 ; for ( int i = 0 ; i <= N ; i ++ ) dp [ i , 0 ] = 1 ; for ( int i = 1 ; i <= N ; i ++ ) { for ( int j = 1 ; j <= sum ; j ++ ) { if ( ( A [ i - 1 ] <= j ) && ( A [ i - 1 ] != 0 ) ) dp [ i , j ] = dp [ i - 1 , j ] + dp [ i - 1 , j - A [ i - 1 ] ] ; else dp [ i , j ] = dp [ i - 1 , j ] ; } } return dp [ N , sum ] + ( int ) Math . Pow ( 2 , c ) ; } static public void Main ( ) { int [ ] A = { 1 , 1 , 2 , 3 } ; int N = A . Length ; int K = 3 ; Console . Write ( solve ( A , N , K ) ) ; } }

Index/key variables: i
Accumulator variables: c, i, j, sum
Iterator variables: i, j
Class/struct names: GFG
C# program:
using System ; class GFG { static int maximizeAnd ( int i , int mask , int [ ] A , int [ ] B , int N , int [ , ] dp ) { if ( i == N ) return 0 ; if ( dp [ i , mask ] != - 1 ) return dp [ i , mask ] ; for ( int j = 0 ; j < N ; ++ j ) { if ( ( mask & ( 1 << j ) ) == 0 ) { dp [ i , mask ] = Math . Max ( dp [ i , mask ] , ( A [ i ] & B [ j ] ) + maximizeAnd ( i + 1 , mask | ( 1 << j ) , A , B , N , dp ) ) ; } } return dp [ i , mask ] ; } static int maximizeAndUtil ( int [ ] A , int [ ] B , int N ) { int [ , ] dp = new int [ N , ( 1 << N ) + 1 ] ; for ( int i = 0 ; i < N ; i ++ ) { for ( int j = 0 ; j < ( 1 << N ) + 1 ; j ++ ) { dp [ i , j ] = - 1 ; } } return maximizeAnd ( 0 , 0 , A , B , N , dp ) ; } static void Main ( ) { int [ ] A = { 3 , 5 , 7 , 11 } ; int [ ] B = { 2 , 6 , 10 , 12 } ; int N = A . Length ; Console . Write ( maximizeAndUtil ( A , B , N ) ) ; } }

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 [ , , , ] dp = new int [ 100 , 2 , 10 , 2 ] ; static int __gcd ( int a , int b ) { return b == 0 ? a : __gcd ( b , a % b ) ; } static int noncoprimeCount ( int i , int N , char [ ] S , int bound , int prev , int allZeros ) { if ( i == N ) return 1 ; int val = dp [ i , bound , prev , allZeros ] ; if ( val != - 1 ) return val ; int cnt = 0 ; for ( int j = 0 ; j <= ( bound != 0 ? ( S [ i ] - '0' ) : 9 ) ; ++ j ) { if ( ( __gcd ( j , prev ) != 1 ) || ( i == 0 ) allZeros == 1 ) { cnt += noncoprimeCount ( i + 1 , N , S , bound != 0 & ( j == ( S [ i ] - '0' ) ) ? 1 : 0 , j , ( allZeros != 0 & ( j == 0 ) ) ? 1 : 0 ) ; } } return val = cnt ; } static void noncoprimeCountUtil ( int R ) { String S = String . Join ( " " , R ) ; int N = S . Length ; for ( int i = 0 ; i < 100 ; i ++ ) for ( int j = 0 ; j < 2 ; j ++ ) for ( int k = 0 ; k < 10 ; k ++ ) for ( int l = 0 ; l < 2 ; l ++ ) dp [ i , j , k , l ] = - 1 ; int ans = noncoprimeCount ( 0 , N , S . ToCharArray ( ) , 1 , 0 , 1 ) ; Console . Write ( ans - 1 + " STRNEWLINE " ) ; } public static void Main ( String [ ] args ) { int N = 10000 ; noncoprimeCountUtil ( N ) ; } }

Index/key variables: i
Accumulator variables: cnt, i, j, k, l
Iterator variables: i, j, k, l
Class/struct names: GFG
C# program:
using System ; public class GFG { static int ans = 0 ; static int maximumStonesUtil ( int [ ] arr , int n , int i , int [ ] dp ) { if ( i >= n ) return 0 ; ans = dp [ i ] ; if ( ans != - 1 ) return ans ; ans = int . MinValue ; ans = Math . Max ( ans , arr [ i ] - maximumStonesUtil ( arr , n , i + 1 , dp ) ) ; if ( i + 1 < n ) ans = Math . Max ( ans , arr [ i ] + arr [ i + 1 ] - maximumStonesUtil ( arr , n , i + 2 , dp ) ) ; if ( i + 2 < n ) ans = Math . Max ( ans , arr [ i ] + arr [ i + 1 ] + arr [ i + 2 ] - maximumStonesUtil ( arr , n , i + 3 , dp ) ) ; return ans ; } static String maximumStones ( int [ ] arr , int n ) { int [ ] dp = new int [ n ] ; for ( int i = 0 ; i < n ; i ++ ) dp [ i ] = - 1 ; int res = maximumStonesUtil ( arr , n , 0 , dp ) ; if ( res > 0 ) return " Player1" ; else if ( res < 0 ) return " Player2" ; else return " Tie " ; } public static void Main ( String [ ] args ) { int [ ] arr = { 1 , 2 , 3 , 7 } ; int n = arr . Length ; Console . Write ( maximumStones ( arr , n ) ) ; } }

Index/key variables: i, n
Accumulator variables: i
Iterator variables: i
Class/struct names: GFG
C# program:
using System ; class GFG { static int numberOfWays ( int N ) { int [ , ] DP = new int [ N + 1 , 5 ] ; for ( int i = 0 ; i < N + 1 ; i ++ ) { for ( int j = 0 ; j < 5 ; j ++ ) { DP [ i , j ] = 0 ; } } DP [ 1 , 1 ] = 1 ; DP [ 1 , 2 ] = 1 ; DP [ 1 , 3 ] = 1 ; DP [ 1 , 4 ] = 1 ; for ( int i = 2 ; i <= N ; i ++ ) { if ( i - 1 > 0 && DP [ i - 1 , 1 ] > 0 ) DP [ i , 1 ] = DP [ i - 1 , 4 ] ; if ( i - 2 > 0 && DP [ i - 2 , 2 ] > 0 ) DP [ i , 2 ] = DP [ i - 2 , 4 ] ; if ( i - 3 > 0 && DP [ i - 3 , 3 ] > 0 ) DP [ i , 3 ] = DP [ i - 3 , 4 ] ; DP [ i , 4 ] = ( DP [ i , 1 ] + DP [ i , 2 ] + DP [ i , 3 ] ) ; } return DP [ N , 4 ] ; } static public void Main ( ) { int N = 15 ; Console . WriteLine ( numberOfWays ( N ) ) ; } }

Accumulator variables: i, j
Iterator variables: i, j
Class/struct names: GFG
C# program:
using System ; class GFG { static int countSortedArrays ( int start , int m , int size , int n ) { if ( size == m ) return 1 ; if ( start > n ) return 0 ; int notTaken = 0 , taken = 0 ; taken = countSortedArrays ( start , m , size + 1 , n ) ; notTaken = countSortedArrays ( start + 1 , m , size , n ) ; return taken + notTaken ; } public static void Main ( ) { int n = 2 , m = 3 ; Console . WriteLine ( countSortedArrays ( 1 , m , 0 , n ) ) ; } }

Class/struct names: GFG
C# program:
using System ; class GFG { public static void maximumSum ( int [ ] arr , int n ) { long [ ] preSum = new long [ n ] ; long sum = 0 ; long maxSum = 0 ; for ( int i = 0 ; i < n ; i ++ ) { sum = Math . Max ( arr [ i ] , sum + arr [ i ] ) ; maxSum = Math . Max ( maxSum , sum ) ; preSum [ i ] = maxSum ; } sum = 0 ; maxSum = 0 ; long [ ] postSum = new long [ n + 1 ] ; for ( int i = n - 1 ; i >= 0 ; i -- ) { sum = Math . Max ( arr [ i ] , sum + arr [ i ] ) ; maxSum = Math . Max ( maxSum , sum ) ; postSum [ i ] = maxSum ; } long ans = 0 ; for ( int i = 0 ; i < n ; i ++ ) { ans = Math . Max ( ans , preSum [ i ] + postSum [ i + 1 ] ) ; } Console . WriteLine ( ans ) ; } static void Main ( ) { int [ ] arr = { 7 , 6 , - 1 , - 4 , - 5 , 7 , 1 } ; maximumSum ( arr , arr . Length ) ; } }

Index/key variables: i, n
Accumulator variables: i
Iterator variables: i
Class/struct names: GFG
C# program:
using System ; class GFG { static int numberOfUniqueOutcomes ( int N , int S ) { if ( S < N ) return 0 ; if ( N == 1 N == S ) return 1 ; return ( numberOfUniqueOutcomes ( N - 1 , S - 1 ) + numberOfUniqueOutcomes ( N - 1 , S - 2 ) ) ; } static public void Main ( ) { int N = 3 , S = 4 ; Console . WriteLine ( numberOfUniqueOutcomes ( N , S ) ) ; } }

Class/struct names: GFG
C# program:
using System ; using System . Collections . Generic ; class GFG { static int mn = - 2147483648 ; static int lisOtimised ( string s ) { int [ ] dp = new int [ 30 ] ; Array . Clear ( dp , 0 , 30 ) ; int N = s . Length ; int lis = mn ; for ( int i = 0 ; i < N ; i ++ ) { int val = ( int ) s [ i ] - 97 ; int curr = 0 ; for ( int j = 0 ; j < val ; j ++ ) { curr = Math . Max ( curr , dp [ j ] ) ; } curr ++ ; lis = Math . Max ( lis , curr ) ; dp [ val ] = Math . Max ( dp [ val ] , curr ) ; } return lis ; } public static void Main ( ) { string s = " fdryutiaghfse " ; Console . Write ( lisOtimised ( s ) ) ; } }

Index/key variables: i, j, val
Accumulator variables: curr, i, j
Iterator variables: i, j
Class/struct names: GFG
C# program:
using System ; class GFG { static int MAX = ( int ) ( 1e9 ) ; static int MinimumLength ( int [ ] A , int N , int K ) { Array . Sort ( A ) ; int [ ] suffix = new int [ N + 1 ] ; for ( int i = N - 1 ; i >= 0 ; i -- ) suffix [ i ] = suffix [ i + 1 ] + A [ i ] ; int [ , ] dp = new int [ N + 1 , K + 1 ] ; for ( int i = 0 ; i <= N ; i ++ ) for ( int j = 0 ; j <= K ; j ++ ) dp [ i , j ] = MAX ; dp [ N , 0 ] = 0 ; for ( int i = N - 1 ; i >= 0 ; i -- ) { for ( int j = K ; j >= 0 ; j -- ) { if ( j <= A [ i ] ) { dp [ i , j ] = A [ i ] ; continue ; } if ( dp [ i + 1 , j - A [ i ] ] == MAX ) dp [ i , j ] = MAX ; else dp [ i , j ] = Math . Min ( dp [ i + 1 , j ] , dp [ i + 1 , j - A [ i ] ] + A [ i ] ) ; } } for ( int i = N - 1 ; i >= 0 ; i -- ) { if ( suffix [ i ] - dp [ i , K ] >= K ) { return N - i ; } } return - 1 ; } public static void Main ( string [ ] args ) { int [ ] arr = { 7 , 4 , 5 , 6 , 8 } ; int K = 13 ; int N = arr . Length ; Console . WriteLine ( MinimumLength ( arr , N , K ) ) ; } }

Index/key variables: i
Accumulator variables: i, j
Iterator variables: i, j
Class/struct names: GFG
C# program:
using System ; class GFG { static int size = 20 ; static int [ ] dp = new int [ size ] ; static int ans ; static void insertVector ( int mask ) { for ( int i = 0 ; i < 20 ; i ++ ) { if ( ( mask & 1 << i ) == 0 ) continue ; if ( dp [ i ] == 0 ) { dp [ i ] = mask ; ++ ans ; return ; } mask ^= dp [ i ] ; } } static void maxSizeSet ( int [ ] arr , int N ) { for ( int i = 0 ; i < N ; i ++ ) { insertVector ( arr [ i ] ) ; } Console . WriteLine ( 1 << ans ) ; } public static void Main ( string [ ] args ) { int [ ] arr = { 1 , 2 , 3 , 4 , 5 } ; int N = arr . Length ; maxSizeSet ( arr , N ) ; } }

Index/key variables: i, size
Accumulator variables: i, mask
Iterator variables: i
Class/struct names: GFG
C# program:
using System ; class GFG { static void maxSum ( int [ ] arr , int N , int K ) { int [ ] dp = new int [ N + 2 ] ; for ( int i = 0 ; i < N + 2 ; i ++ ) { dp [ i ] = 0 ; } int maxval = 0 ; for ( int i = N - 1 ; i >= 0 ; i -- ) { if ( ( i + K * arr [ i ] ) >= N ) { dp [ i ] = arr [ i ] ; } else { dp [ i ] = dp [ i + K * arr [ i ] ] + arr [ i ] ; } maxval = Math . Max ( maxval , dp [ i ] ) ; } Console . WriteLine ( maxval ) ; } static public void Main ( ) { int [ ] arr = { 2 , 1 , 3 , 1 , 2 } ; int N = arr . Length ; int K = 3 ; maxSum ( arr , N , K ) ; } }

Index/key variables: i
Accumulator variables: i
Iterator variables: i
Class/struct names: GFG
C# program:
using System ; public class GFG { static void maxSubmatrixSum ( int [ , ] matrix ) { int r = matrix . GetLength ( 0 ) ; int c = matrix . GetLength ( 1 ) ; int maxSubmatrix = 0 ; for ( int i = 0 ; i < r ; i ++ ) { for ( int j = 0 ; j < c ; j ++ ) { for ( int k = i ; k < r ; k ++ ) { for ( int l = j ; l < c ; l ++ ) { int sumSubmatrix = 0 ; for ( int m = i ; m <= k ; m ++ ) { for ( int n = j ; n <= l ; n ++ ) { sumSubmatrix += matrix [ m , n ] ; } } maxSubmatrix = Math . Max ( maxSubmatrix , sumSubmatrix ) ; } } } } Console . WriteLine ( maxSubmatrix ) ; } public static void Main ( String [ ] args ) { int [ , ] matrix = { { 0 , - 2 , - 7 , 0 } , { 9 , 2 , - 6 , 2 } , { - 4 , 1 , - 4 , 1 } , { - 1 , 8 , 0 , - 2 } } ; maxSubmatrixSum ( matrix ) ; } }

Accumulator variables: i, j, k, l, m, n, sumSubmatrix
Iterator variables: i, j, k, l, m, n
Class/struct names: GFG
C# program:
using System ; class GFG { static void maximumSubsetSum ( int [ ] arr1 , int [ ] arr2 , int length ) { int [ ] dp = new int [ length + 1 ] ; if ( length == 1 ) { Console . WriteLine ( Math . Max ( arr1 [ 0 ] , arr2 [ 0 ] ) ) ; return ; } if ( length == 2 ) { Console . WriteLine ( Math . Max ( Math . Max ( arr1 [ 1 ] , arr2 [ 1 ] ) , Math . Max ( arr1 [ 0 ] , arr2 [ 0 ] ) ) ) ; return ; } else { dp [ 0 ] = Math . Max ( arr1 [ 0 ] , arr2 [ 0 ] ) ; dp [ 1 ] = Math . Max ( Math . Max ( arr1 [ 1 ] , arr2 [ 1 ] ) , Math . Max ( arr1 [ 0 ] , arr2 [ 0 ] ) ) ; int index = 2 ; while ( index < length ) { dp [ index ] = Math . Max ( Math . Max ( arr1 [ index ] , arr2 [ index ] ) , Math . Max ( Math . Max ( arr1 [ index ] + dp [ index - 2 ] , arr2 [ index ] + dp [ index - 2 ] ) , dp [ index - 1 ] ) ) ; ++ index ; } Console . WriteLine ( dp [ length - 1 ] ) ; } } static public void Main ( ) { int [ ] arr1 = { - 1 , - 2 , 4 , - 4 , 5 } ; int [ ] arr2 = { - 1 , - 2 , - 3 , 4 , 10 } ; int length = arr1 . Length ; maximumSubsetSum ( arr1 , arr2 , length ) ; } }

Index/key variables: index
Class/struct names: GFG
C# program:
using System ; using System . Collections . Generic ; class GFG { static void minAtEachIndex ( int n , int [ ] arr ) { int [ ] dp1 = new int [ n ] ; int [ ] dp2 = new int [ n ] ; int i ; dp1 [ 0 ] = arr [ 0 ] ; for ( i = 1 ; i < n ; i ++ ) dp1 [ i ] = Math . Min ( arr [ i ] , dp1 [ i - 1 ] + 1 ) ; dp2 [ n - 1 ] = arr [ n - 1 ] ; for ( i = n - 2 ; i >= 0 ; i -- ) dp2 [ i ] = Math . Min ( arr [ i ] , dp2 [ i + 1 ] + 1 ) ; List < int > v = new List < int > ( ) ; for ( i = 0 ; i < n ; i ++ ) v . Add ( Math . Min ( dp1 [ i ] , dp2 [ i ] ) ) ; foreach ( int x in v ) Console . Write ( x + " ▁ " ) ; } public static void Main ( String [ ] args ) { int [ ] arr = { 1 , 4 , 2 , 5 , 3 } ; int N = arr . Length ; minAtEachIndex ( N , arr ) ; } }

Index/key variables: i, n
Accumulator variables: i
Iterator variables: i, x
Class/struct names: GFG
C# program:
using System ; using System . Collections . Generic ; class GFG { static int totalArrays ( int N , int M ) { int [ ] end_with_one = new int [ N + 1 ] ; int [ ] end_not_with_one = new int [ N + 1 ] ; end_with_one [ 0 ] = 1 ; end_not_with_one [ 0 ] = 0 ; end_with_one [ 1 ] = 0 ; end_not_with_one [ 1 ] = M - 1 ; for ( int i = 2 ; i < N ; i ++ ) { end_with_one [ i ] = end_not_with_one [ i - 1 ] ; end_not_with_one [ i ] = end_with_one [ i - 1 ] * ( M - 1 ) + end_not_with_one [ i - 1 ] * ( M - 2 ) ; } return end_with_one [ N - 1 ] ; } static void Main ( ) { int N = 3 , M = 3 ; int temp = totalArrays ( N , M ) ; int ans = M * temp ; Console . WriteLine ( ans ) ; } }

Index/key variables: i
Accumulator variables: i
Iterator variables: i
Class/struct names: GFG
C# program:
using System ; class GFG { static int prodOfDigit ( int N ) { int res = 1 ; while ( N > 0 ) { res = res * ( N % 10 ) ; N /= 10 ; } return res ; } static int cntNumRange ( int L , int R , int K ) { int cnt = 0 ; for ( int i = L ; i <= R ; i ++ ) { if ( prodOfDigit ( i ) == K ) { cnt ++ ; } } return cnt ; } static void Main ( ) { int L = 20 , R = 10000 , K = 14 ; Console . WriteLine ( cntNumRange ( L , R , K ) ) ; } }

Accumulator variables: N, cnt, i
Iterator variables: i
Class/struct names: GFG
C# program:
using System ; class GFG { static double findMedXOR ( int [ , ] mat , int N , int M ) { int [ , ] dp = new int [ N , M ] ; int [ ] med = new int [ N * M ] ; dp [ 0 , 0 ] = mat [ 0 , 0 ] ; med [ 0 ] = dp [ 0 , 0 ] ; int len = 1 ; for ( int i = 1 ; i < N ; i ++ ) { dp [ i , 0 ] = dp [ i - 1 , 0 ] ^ mat [ i , 0 ] ; med [ len ++ ] = dp [ i , 0 ] ; } for ( int i = 1 ; i < M ; i ++ ) { dp [ 0 , i ] = dp [ 0 , i - 1 ] ^ mat [ 0 , i ] ; med [ len ++ ] = dp [ 0 , i ] ; } for ( int i = 1 ; i < N ; i ++ ) { for ( int j = 1 ; j < M ; j ++ ) { dp [ i , j ] = dp [ i - 1 , j ] ^ dp [ i , j - 1 ] ^ dp [ i - 1 , j - 1 ] ^ mat [ i , j ] ; med [ len ++ ] = dp [ i , j ] ; } } Array . Sort ( med ) ; if ( len % 2 == 0 ) { return ( med [ ( len / 2 ) ] + med [ ( len / 2 ) - 1 ] ) / 2.0 ; } return med [ len / 2 ] ; } public static void Main ( String [ ] args ) { int [ , ] mat = { { 1 , 2 } , { 2 , 3 } } ; int N = mat . GetLength ( 0 ) ; int M = 2 ; Console . WriteLine ( findMedXOR ( mat , N , M ) ) ; } }

Accumulator variables: i, j, len
Iterator variables: i, j
Class/struct names: GFG
C# program:
using System ; class GFG { static void countWaysToTileBoard ( int N ) { int [ ] dp = new int [ N + 1 ] ; dp [ 0 ] = 1 ; dp [ 1 ] = 2 ; for ( int i = 2 ; i <= N ; i ++ ) { dp [ i ] = ( 2 * dp [ i - 1 ] + dp [ i - 2 ] ) ; } Console . Write ( dp [ N ] ) ; } public static void Main ( String [ ] args ) { int N = 2 ; countWaysToTileBoard ( N ) ; } }

Index/key variables: N, i
Accumulator variables: i
Iterator variables: i
Class/struct names: GFG
C# program:
using System ; class GFG { static void FindSub ( string str , string res , int i ) { if ( i == str . Length ) { if ( res . Length > 0 ) { Console . Write ( res + " ▁ " ) ; } return ; } char ch = str [ i ] ; FindSub ( str , res , i + 1 ) ; FindSub ( str , res + ch , i + 1 ) ; FindSub ( str , res + ( int ) ch , i + 1 ) ; } public static void Main ( String [ ] args ) { string str = " ab " ; string res = " " ; int N = str . Length ; FindSub ( str , res , 0 ) ; } }

Index/key variables: i
Class/struct names: GFG
C# program:
using System ; class GFG { public static int MinOp ( int N ) { if ( N <= 1 ) return N ; int bit = ( int ) ( Math . Log ( N ) / Math . Log ( 2 ) ) + 1 ; return ( ( 1 << bit ) - 1 ) - MinOp ( N - ( 1 << ( bit - 1 ) ) ) ; } public static void Main ( ) { int N = 4 ; Console . WriteLine ( MinOp ( N ) ) ; } }

Class/struct names: GFG
C# program:
using System ; class GFG { static int maxProductPath ( int [ , ] grid ) { int n = grid . GetLength ( 0 ) ; int m = grid . GetLength ( 1 ) ; int [ , ] maxPath = new int [ n , m ] ; int [ , ] minPath = new int [ n , m ] ; for ( int i = 0 ; i < n ; i ++ ) { for ( int j = 0 ; j < m ; j ++ ) { int mn = Int32 . MaxValue ; int mx = Int32 . MinValue ; if ( i == 0 && j == 0 ) { mx = grid [ i , j ] ; mn = grid [ i , j ] ; } if ( i > 0 ) { int tempmx = Math . Max ( ( maxPath [ i - 1 , j ] * grid [ i , j ] ) , ( minPath [ i - 1 , j ] * grid [ i , j ] ) ) ; mx = Math . Max ( mx , tempmx ) ; int tempmn = Math . Min ( ( maxPath [ i - 1 , j ] * grid [ i , j ] ) , ( minPath [ i - 1 , j ] * grid [ i , j ] ) ) ; mn = Math . Min ( mn , tempmn ) ; } if ( j > 0 ) { int tempmx = Math . Max ( ( maxPath [ i , j - 1 ] * grid [ i , j ] ) , ( minPath [ i , j - 1 ] * grid [ i , j ] ) ) ; mx = Math . Max ( mx , tempmx ) ; int tempmn = Math . Min ( ( maxPath [ i , j - 1 ] * grid [ i , j ] ) , ( minPath [ i , j - 1 ] * grid [ i , j ] ) ) ; mn = Math . Min ( mn , tempmn ) ; } maxPath [ i , j ] = mx ; minPath [ i , j ] = mn ; } } if ( maxPath [ n - 1 , m - 1 ] < 0 ) { return - 1 ; } else { return ( maxPath [ n - 1 , m - 1 ] ) ; } } static public void Main ( ) { int [ , ] mat = { { 1 , - 2 , 1 } , { 1 , - 2 , 1 } , { 3 , - 4 , 1 } } ; Console . WriteLine ( maxProductPath ( mat ) ) ; } }

Accumulator variables: i, j
Iterator variables: i, j
Class/struct names: GFG
C# program:
using System ; using System . Collections . Generic ; class GFG { static int removeSmallestSubarray ( int [ ] arr , int S , int n , int k ) { int target_remainder = S % k ; Dictionary < int , int > map1 = new Dictionary < int , int > ( ) ; map1 . Add ( 0 , - 1 ) ; int curr_remainder = 0 ; int res = int . MaxValue ; for ( int i = 0 ; i < n ; i ++ ) { curr_remainder = ( curr_remainder + arr [ i ] + k ) % k ; map1 [ curr_remainder ] = i ; int mod = ( curr_remainder - target_remainder + k ) % k ; if ( map1 . ContainsKey ( mod ) ) { res = Math . Min ( res , i - map1 [ mod ] ) ; } } if ( res == int . MaxValue res == n ) { res = - 1 ; } return res ; } static int smstSubmatDeleted ( int [ , ] mat , int N , int M , int K ) { int S = 0 ; for ( int i = 0 ; i < N ; i ++ ) { for ( int j = 0 ; j < M ; j ++ ) S += mat [ i , j ] ; } int min_area = N * M ; int left = 0 ; int right = 0 ; int width ; int area ; int [ ] prefixRowSum = new int [ N ] ; for ( left = 0 ; left < M ; left ++ ) { for ( int i = 0 ; i < prefixRowSum . Length ; i ++ ) prefixRowSum [ i ] = 0 ; for ( right = left ; right < M ; right ++ ) { for ( int i = 0 ; i < N ; i ++ ) { prefixRowSum [ i ] += mat [ i , right ] ; } width = removeSmallestSubarray ( prefixRowSum , S , N , K ) ; if ( width != - 1 ) { area = ( right - left + 1 ) * ( width ) ; if ( area < min_area ) { min_area = area ; } } } } return min_area ; } public static void Main ( String [ ] args ) { int [ , ] mat = { { 6 , 2 , 6 } , { 3 , 2 , 8 } , { 2 , 5 , 3 } } ; int K = 3 ; int N = mat . GetLength ( 0 ) ; int M = mat . GetLength ( 1 ) ; Console . Write ( smstSubmatDeleted ( mat , N , M , K ) ) ; } }

Index/key variables: N, curr_remainder, i, mod
Accumulator variables: S, i, j, left, right
Iterator variables: i, j, left, right
Class/struct names: GFG
C# program:
using System ; using System . Collections . Generic ; class GFG { static int countstrings ( int n , int start ) { if ( n == 0 ) { return 1 ; } int cnt = 0 ; for ( int i = start ; i < 5 ; i ++ ) { cnt += countstrings ( n - 1 , i ) ; } return cnt ; } static int countVowelStrings ( int n ) { return countstrings ( n , 0 ) ; } static void Main ( ) { int n = 2 ; Console . Write ( countVowelStrings ( n ) ) ; } }

Accumulator variables: cnt, i
Iterator variables: i
Class/struct names: GFG
C# program:
using System ; class GFG { static int findNumberOfStrings ( int n ) { return ( n + 1 ) * ( n + 2 ) * ( n + 3 ) * ( n + 4 ) / 24 ; } public static void Main ( string [ ] args ) { int N = 2 ; Console . Write ( findNumberOfStrings ( N ) ) ; } }

Class/struct names: GFG
C# program:
using System ; using System . Collections ; using System . Collections . Generic ; class GFG { static int mod = ( int ) 1e9 + 7 ; static int findTotalPath ( int X , int n , int [ ] dp ) { if ( X == 0 ) { return 1 ; } int ans = 0 ; if ( dp [ X ] != - 1 ) { return dp [ X ] ; } for ( int i = 1 ; i <= Math . Min ( X , n ) ; ++ i ) { ans += findTotalPath ( X - i , n , dp ) % mod ; ans %= mod ; } dp [ X ] = ans ; return ans ; } public static void Main ( ) { int n = 3 , X = 2 ; int [ ] dp = new int [ X + 1 ] ; Array . Fill ( dp , - 1 ) ; Console . WriteLine ( findTotalPath ( X , n , dp ) ) ; } }

Index/key variables: X
Accumulator variables: ans
Iterator variables: i
Class/struct names: GFG
C# program:
using System ; class GFG { static int [ , ] bin = new int [ 3000 , 3000 ] ; static void countWays ( int [ ] arr ) { int mod = ( int ) 1e9 + 7 ; bin [ 0 , 0 ] = 1 ; for ( int i = 1 ; i < 3000 ; i ++ ) { bin [ i , 0 ] = 1 ; for ( int j = 1 ; j <= i ; j ++ ) { bin [ i , j ] = ( bin [ i - 1 , j ] + bin [ i - 1 , j - 1 ] ) % mod ; } } int n = 0 ; foreach ( int x in arr ) n += x ; int [ ] ways = new int [ n + 1 ] ; for ( int i = 1 ; i <= n ; i ++ ) { ways [ i ] = 1 ; for ( int j = 0 ; j < arr . Length ; j ++ ) { ways [ i ] = ( ways [ i ] * bin [ arr [ j ] + i - 1 , i - 1 ] ) % mod ; } for ( int j = 1 ; j < i ; j ++ ) { ways [ i ] = ( ( ways [ i ] - bin [ i , j ] * ways [ j ] ) % mod + mod ) % mod ; } } int ans = 0 ; foreach ( int x in ways ) ans = ( ans + x ) % mod ; Console . Write ( ans + " STRNEWLINE " ) ; } public static void Main ( String [ ] args ) { int [ ] arr = { 1 , 1 } ; countWays ( arr ) ; } }

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