dhyuti-n/xlcost-variable-roles huggingface dataset:
C# program:
using System ; using System . Collections . Generic ; class GFG { static void minOperation ( string S , int K , int N ) { int min = 0 ; int i ; for ( i = 0 ; i < N ; i ++ ) { if ( S [ i ] == '0' && i + K <= N ) { for ( int j = i ; j < i + K ; j ++ ) { if ( S [ j ] == '1' ) S = S . Substring ( 0 , j ) + '0' + S . Substring ( j + 1 ) ; else S = S . Substring ( 0 , j ) + '1' + S . Substring ( j + 1 ) ; } min ++ ; } } for ( i = 0 ; i < N ; i ++ ) { if ( S [ i ] == '0' ) break ; } if ( i == N ) Console . Write ( min ) ; else Console . Write ( - 1 ) ; } public static void Main ( ) { string S = "00010110" ; int K = 3 ; int N = S . Length ; minOperation ( S , K , N ) ; } }

Index/key variables: i, j
Accumulator variables: i, j, min
Iterator variables: i, j
Class/struct names: GFG
C# program:
using System ; using System . Collections . Generic ; class GFG { static bool validInsertionstring ( string S1 , string S2 ) { int N = S1 . Length ; int M = S2 . Length ; Stack < char > st = new Stack < char > ( ) ; for ( int i = 0 ; i < N ; i ++ ) { st . Push ( S1 [ i ] ) ; if ( S1 [ i ] == S2 [ M - 1 ] ) { int idx = M - 1 ; while ( idx >= 0 ) { if ( st . Count == 0 ) { return false ; } char c = st . Peek ( ) ; st . Pop ( ) ; if ( c != S2 [ idx ] ) { return false ; } idx -- ; } } } if ( st . Count > 0 ) { return false ; } else { return true ; } } public static void Main ( ) { string S1 = " aabb " ; string S2 = " ab " ; if ( validInsertionstring ( S1 , S2 ) == true ) Console . Write ( " Yes " ) ; else Console . Write ( " No " ) ; } }

Index/key variables: i, idx
Accumulator variables: i, idx
Iterator variables: i
Class/struct names: GFG
C# program:
using System ; using System . Collections . Generic ; class GFG { static int MAX = 256 ; static bool can_form_palindrome ( int [ ] arr , int n ) { string str = " " ; for ( int i = 0 ; i < n ; i ++ ) { str += arr [ i ] ; } int [ ] freq = new int [ MAX ] ; Array . Clear ( freq , 0 , MAX ) ; for ( int i = 0 ; i < str . Length ; i ++ ) { freq [ str [ i ] ] ++ ; } int count = 0 ; for ( int i = 0 ; i < MAX ; i ++ ) { if ( ( freq [ i ] & 1 ) != 0 ) { count ++ ; } if ( count > 1 ) { return false ; } } return true ; } public static void Main ( ) { int [ ] arr = { 1 , 2 , 3 , 1 , 2 } ; int n = arr . Length ; if ( can_form_palindrome ( arr , n ) ) Console . Write ( " YES " ) ; else Console . Write ( " NO " ) ; } }

Index/key variables: MAX, i
Accumulator variables: count, i, str
Iterator variables: i
Class/struct names: GFG
C# program:
using System ; public class GFG { static int minimumFlips ( String s ) { int n = s . Length ; int cnt0 = count ( s , '0' ) ; int cnt1 = 0 ; int res = n - cnt0 ; for ( int i = 0 ; i < n ; i ++ ) { if ( s [ i ] == '0' ) { cnt0 -= 1 ; } else if ( s [ i ] == '1' ) { res = Math . Min ( res , cnt1 + cnt0 ) ; cnt1 ++ ; } } return res ; } private static int count ( String s , char c ) { int ans = 0 ; for ( int j = 0 ; j < s . Length ; j ++ ) { char i = s [ j ] ; if ( c == i ) ans ++ ; } return ans ; } static public void Main ( ) { String S = "000110" ; Console . Write ( minimumFlips ( S ) ) ; } }

Index/key variables: i, j
Accumulator variables: ans, cnt0, cnt1, i, j
Iterator variables: i, j
Class/struct names: GFG
C# program:
using System ; using System . Collections . Generic ; class GFG { static HashSet < string > presentSubstring ( string s , int k ) { HashSet < string > st = new HashSet < string > ( ) ; int n = s . Length ; for ( int i = 0 ; i < n ; i ++ ) { string s1 = " " ; for ( int j = 0 ; j < k && i + j < n ; j ++ ) { s1 += s [ i + j ] ; st . Add ( s1 ) ; } } return st ; } static string smallestSubstring ( string s , int k ) { HashSet < string > st = new HashSet < string > ( ) ; st = presentSubstring ( s , k ) ; int index ; for ( int len = 1 ; len <= k ; len ++ ) { string t = " " ; for ( int i = 0 ; i < len ; i ++ ) t += ' a ' ; while ( true ) { if ( st . Contains ( t ) == false ) { return t ; } index = len - 1 ; while ( index >= 0 && t [ index ] == ' z ' ) { t = t . Substring ( 0 , index ) + ' a ' + t . Substring ( index + 1 ) ; index -- ; } if ( index >= 0 ) { t = t . Substring ( 0 , index ) + Convert . ToChar ( ( int ) t [ index ] + 1 ) + t . Substring ( index + 1 ) ; } else break ; } public static void Main ( ) { string s = " sdhaacbdefghijklmnopqrstuvwxyz " ; int K = 3 ; Console . Write ( smallestSubstring ( s , K ) ) ; } }

Index/key variables: index
Accumulator variables: i, index, j, len, s1, t
Iterator variables: i, j, len
Class/struct names: GFG
C# program:
using System ; public class GFG { static int maximumK ( String S ) { int N = S . Length ; int ans = N ; int flag = 0 ; for ( int i = 0 ; i < N - 1 ; i ++ ) { if ( S [ i ] != S [ i + 1 ] ) { flag = 1 ; ans = Math . Min ( ans , Math . Max ( i + 1 , N - i - 1 ) ) ; } } if ( flag == 0 ) return 0 ; return ans ; } static public void Main ( ) { string S = "010" ; Console . Write ( maximumK ( S ) ) ; } }

Index/key variables: i
Accumulator variables: i
Iterator variables: i
Class/struct names: GFG
C# program:
using System ; class GFG { static void minimumTimeToConvertString ( char [ ] S , int N ) { int upper = 0 , lower = 0 ; for ( int i = 0 ; i < N ; i ++ ) { char c = S [ i ] ; if ( Char . IsUpper ( c ) ) { upper ++ ; } else { lower ++ ; } } int moves = 0 ; if ( upper > N / 2 ) { int i = 0 ; while ( upper > N / 2 && i < N ) { if ( Char . IsUpper ( S [ i ] ) ) { S [ i ] += ( char ) 32 ; moves ++ ; upper -- ; lower ++ ; } i ++ ; } } else if ( lower > N / 2 ) { int i = 0 ; while ( lower > N / 2 && i < N ) { if ( Char . IsLower ( S [ i ] ) ) { S [ i ] = ( char ) ( ( int ) S [ i ] - 32 ) ; moves ++ ; upper ++ ; lower -- ; } i ++ ; } } Console . WriteLine ( moves ) ; Console . WriteLine ( new string ( S ) ) ; } static void Main ( ) { string S = " AbcdEf " ; int N = S . Length ; minimumTimeToConvertString ( S . ToCharArray ( ) , N ) ; } }

Index/key variables: i
Accumulator variables: i, lower, moves, upper
Iterator variables: i
Class/struct names: GFG
C# program:
using System ; using System . Collections . Generic ; class GFG { static void zigzag ( string s , int rows ) { int interval = 2 * rows - 2 ; for ( int i = 0 ; i < rows ; i ++ ) { int step = interval - 2 * i ; for ( int j = i ; j < s . Length ; j = j + interval ) { Console . Write ( s [ j ] ) ; if ( step > 0 && step < interval && step + j < s . Length ) { for ( int k = 0 ; k < ( interval - rows - i ) ; k ++ ) Console . Write ( " ▁ " ) ; Console . Write ( s [ j + step ] ) ; for ( int k = 0 ; k < i - 1 ; k ++ ) Console . Write ( " ▁ " ) ; } else { for ( int k = 0 ; k < ( interval - rows ) ; k ++ ) Console . Write ( " ▁ " ) ; } } Console . WriteLine ( ) ; } } public static void Main ( ) { string s = "123456789ABCDEFGHIJKLM " + " NOPQRSTUVWXYZabcdefghi " + " jklmnopqrstuvwxyz " ; int rows = 9 ; zigzag ( s , rows ) ; } }

Index/key variables: j
Accumulator variables: i, k
Iterator variables: i, j, k
Class/struct names: GFG
C# program:
using System . IO ; using System ; using System . Collections . Generic ; class GFG { static int subString ( string s , int n ) { Dictionary < int , int > hash = new Dictionary < int , int > ( ) ; hash [ 0 ] = 1 ; int pre = 0 ; int count = 0 ; for ( int i = 0 ; i < n ; i ++ ) { pre ^= ( 1 << ( int ) ( s [ i ] ) - 97 ) ; if ( hash . ContainsKey ( pre ) ) count += hash [ pre ] ; else count += 0 ; if ( hash . ContainsKey ( pre ) ) hash [ pre ] = hash [ pre ] + 1 ; else hash . Add ( pre , 1 ) ; } return count ; } static void Main ( ) { String S = " abbaa " ; int N = S . Length ; Console . WriteLine ( subString ( S , N ) ) ; } }

Index/key variables: i, pre
Accumulator variables: count, i, pre
Iterator variables: i
Class/struct names: GFG
C# program:
using System ; using System . Collections . Generic ; class GFG { static void atleastkDistinctChars ( string s , int k ) { int n = s . Length ; Dictionary < char , int > mp = new Dictionary < char , int > ( ) ; int begin = 0 , end = 0 ; int ans = 0 ; while ( end < n ) { char c = s [ end ] ; if ( mp . ContainsKey ( c ) ) mp ++ ; else mp . Add ( c , 1 ) ; end ++ ; while ( mp . Count >= k ) { char pre = s [ begin ] ; mp [ pre ] -- ; if ( mp [ pre ] == 0 ) { mp . Remove ( pre ) ; } ans += s . Length - end + 1 ; begin ++ ; } } Console . Write ( ans ) ; } public static void Main ( ) { string S = " abcca " ; int K = 3 ; atleastkDistinctChars ( S , K ) ; } }

Index/key variables: begin, end, pre
Accumulator variables: ans, begin, end, mp
Class/struct names: GFG
C# program:
using System ; public class GFG { static void canSplit ( string S ) { int [ ] frequency = new int [ 26 ] ; int cnt_singles = 0 ; int k = 0 ; for ( int i = 0 ; i < S . Length ; i ++ ) frequency [ S [ i ] - ' a ' ] ++ ; int odd = 0 , eve = 0 ; for ( int i = 0 ; i < 26 ; i ++ ) { if ( frequency [ i ] != 0 ) { odd += ( frequency [ i ] & 1 ) ; eve += frequency [ i ] / 2 ; } } if ( eve >= odd ) Console . WriteLine ( " Yes " ) ; else Console . WriteLine ( " No " ) ; } public static void Main ( string [ ] args ) { string S = " aaabbbccc " ; canSplit ( S ) ; } }

Index/key variables: i
Accumulator variables: eve, i, odd
Iterator variables: i
Class/struct names: GFG
C# program:
using System ; class GFG { static string removeAdjacent ( string s ) { if ( s . Length == 1 ) return s ; string sb = " " ; for ( int i = 0 ; i < s . Length - 1 ; i ++ ) { char c = s [ i ] ; char d = s [ i + 1 ] ; if ( c != d ) { sb = sb + c ; if ( i == s . Length - 2 ) { sb = sb + d ; } } else { for ( int j = i + 2 ; j < s . Length ; j ++ ) sb = sb + s [ j ] ; return sb ; } } return sb ; } static void reduceString ( string s ) { string result = " " ; string pre = s ; while ( true ) { result = removeAdjacent ( pre ) ; if ( result == pre ) break ; pre = result ; } if ( result . Length != 0 ) Console . WriteLine ( result ) ; else Console . WriteLine ( " Empty ▁ String " ) ; } static void Main ( ) { string S = " aaabccddd " ; reduceString ( S ) ; } }

Index/key variables: i, j
Accumulator variables: i, j
Iterator variables: i, j
Class/struct names: GFG
C# program:
using System ; public class GFG { static int minDeletions ( string str ) { int [ ] fre = new int [ 26 ] ; int n = str . Length ; for ( int i = 0 ; i < n ; i ++ ) { fre [ str [ i ] - ' a ' ] += 1 ; } int count = 0 ; for ( int i = 0 ; i < 26 ; i ++ ) { if ( fre [ i ] % 2 == 1 ) { count += 1 ; } } if ( count == 0 count == 1 ) { return 0 ; } else { return count - 1 ; } } public static void Main ( string [ ] args ) { string str = " ababbccca " ; Console . WriteLine ( minDeletions ( str ) ) ; } }

Index/key variables: i
Accumulator variables: count, i
Iterator variables: i
Class/struct names: GFG
C# program:
using System ; using System . Collections . Generic ; public class GFG { static void scoreOfParentheses ( String s ) { Stack < int > stack = new Stack < int > ( ) ; stack . Push ( 0 ) ; foreach ( char c in s . ToCharArray ( ) ) { if ( c == ' ( ' ) stack . Push ( 0 ) ; else { int tmp = stack . Pop ( ) ; int val = 0 ; if ( tmp > 0 ) val = tmp * 2 ; else val = 1 ; stack . Push ( stack . Pop ( ) + val ) ; } } Console . WriteLine ( stack . Peek ( ) ) ; } public static void Main ( String [ ] args ) { String S = " ( ( ) ( ( ) ) ) " ; scoreOfParentheses ( S ) ; } }

Iterator variables: c
Class/struct names: GFG
C# program:
using System ; class GFG { static void findSubstringInWraproundString ( string p ) { int ans = 0 ; int curLen = 0 ; int [ ] arr = new int [ 26 ] ; for ( int i = 0 ; i < ( int ) p . Length ; i ++ ) { int curr = p [ i ] - ' a ' ; if ( i > 0 && ( p [ i - 1 ] != ( ( curr + 26 - 1 ) % 26 + ' a ' ) ) ) { curLen = 0 ; } curLen ++ ; if ( curLen > arr [ curr ] ) { ans += ( curLen - arr [ curr ] ) ; arr [ curr ] = curLen ; } } Console . Write ( ans ) ; } static void Main ( ) { string p = " zab " ; findSubstringInWraproundString ( p ) ; } }

Index/key variables: curr, i
Accumulator variables: ans, curLen, i
Iterator variables: i
Class/struct names: GFG
C# program:
using System ; public class GFG { static int remove ( int N , int digit ) { String strN = N . ToString ( ) ; String ans = " " ; foreach ( char i in strN . ToCharArray ( ) ) { if ( ( i - '0' ) == digit ) { continue ; } ans += i ; } return Int32 . Parse ( ans ) ; } static void getMin ( int [ ] arr ) { int minSum = Int32 . MaxValue ; for ( int i = 0 ; i < 10 ; i ++ ) { int curSum = 0 ; foreach ( int num in arr ) curSum += remove ( num , i ) ; minSum = Math . Min ( minSum , curSum ) ; } Console . WriteLine ( minSum ) ; } static public void Main ( ) { int [ ] arr = { 34 , 23 , 85 , 93 } ; getMin ( arr ) ; } }

Accumulator variables: ans, curSum, i
Iterator variables: i, num
Class/struct names: GFG
C# program:
using System ; using System . Collections . Generic ; class GFG { public int maxUniqueSplit ( String S ) { return maxUnique ( S , new HashSet < String > ( ) ) ; } public int maxUnique ( String S , HashSet < String > set ) { int max = 0 ; for ( int i = 1 ; i <= S . Length ; i ++ ) { String tmp = S . Substring ( 0 , i ) ; if ( ! set . Contains ( tmp ) ) { set . Add ( tmp ) ; max = Math . Max ( max , maxUnique ( S . Substring ( i ) , set ) + 1 ) ; set . Remove ( tmp ) ; } } return max ; } } public class GFG { public static void Main ( String [ ] args ) { Solution st = new Solution ( ) ; String S = " ababccc " ; int res = st . maxUniqueSplit ( S ) ; Console . WriteLine ( res ) ; } }

Accumulator variables: i
Iterator variables: i
Class/struct names: GFG
C# program:
using System ; using System . Collections . Generic ; class GFG { static void removeValidBracketSequences ( string str , int N ) { List < int > A = new List < int > ( ) ; List < int > B = new List < int > ( ) ; List < int > C = new List < int > ( ) ; bool [ ] vis = new bool [ N ] ; for ( int i = 0 ; i < N ; i ++ ) { vis [ i ] = true ; } for ( int i = 0 ; i < N ; i ++ ) { if ( str [ i ] == ' ( ' ) { A . Add ( i ) ; } else if ( str [ i ] == ' { ' ) { B . Add ( i ) ; } else if ( str [ i ] == ' [ ' ) { C . Add ( i ) ; } else if ( str [ i ] == ' ) ' && ( A . Count > 0 ) ) { vis [ A [ A . Count - 1 ] ] = false ; A . RemoveAt ( A . Count - 1 ) ; vis [ i ] = false ; } else if ( str [ i ] == ' } ' && ( B . Count > 0 ) ) { vis [ B [ B . Count - 1 ] ] = false ; B . RemoveAt ( B . Count - 1 ) ; vis [ i ] = false ; } else if ( str [ i ] == ' ] ' && ( C . Count > 0 ) ) { vis [ C [ C . Count - 1 ] ] = false ; C . RemoveAt ( C . Count - 1 ) ; vis [ i ] = false ; } } for ( int i = 0 ; i < N ; ++ i ) { if ( vis [ i ] ) Console . Write ( str [ i ] ) ; } } static void Main ( ) { string str = " ( ( ) { ( ) ( { } ) " ; int N = str . Length ; removeValidBracketSequences ( str , N ) ; } }

Index/key variables: N, i
Accumulator variables: i
Iterator variables: i
Class/struct names: GFG
C# program:
using System ; public class GFG { static void update ( int [ , ] BIT , int idx , int i , int val ) { while ( i < 10005 ) { BIT [ idx , i ] += val ; i = i + ( i & ( - i ) ) ; } } static int query ( int [ , ] BIT , int idx , int i ) { int ans = 0 ; while ( i > 0 ) { ans += BIT [ idx , i ] ; i = i - ( i & ( - i ) ) ; } return ans ; } static void maxDiffFreq ( String s , int [ , ] queries ) { int [ , ] BIT = new int [ 26 , 10005 ] ; int n = s . Length ; for ( int i = 0 ; i < n ; i ++ ) { update ( BIT , s [ i ] - ' a ' , i + 1 , 1 ) ; } int Q = queries . GetLength ( 0 ) ; for ( int i = 0 ; i < Q ; ++ i ) { int mx = 0 ; int mn = int . MaxValue ; int l = queries [ i , 0 ] ; int r = queries [ i , 1 ] ; for ( int j = 0 ; j < 26 ; j ++ ) { int p = query ( BIT , j , r ) ; int q = query ( BIT , j , l - 1 ) ; mx = Math . Max ( mx , p - q ) ; if ( p > 0 ) { mn = Math . Min ( mn , p - q ) ; } } Console . Write ( mx - mn + " STRNEWLINE " ) ; } } public static void Main ( String [ ] args ) { String S = " abaabac " ; int [ , ] queries = { { 2 , 6 } , { 1 , 7 } } ; maxDiffFreq ( S , queries ) ; } }

Index/key variables: i
Accumulator variables: ans, i, j
Iterator variables: i, j
Class/struct names: GFG
C# program:
using System ; class GFG { static int minOperation ( String [ ] arr , int N ) { int cntMinOP = 0 ; int M = arr [ 0 ] . Length ; int [ , ] hash = new int [ 256 , M ] ; for ( int i = 0 ; i < N ; i ++ ) { for ( int j = 0 ; j < M ; j ++ ) { hash [ arr [ i ] [ j ] , j ] ++ ; } } for ( int i = 0 ; i < M ; i ++ ) { int Sum = 0 ; int Max = 0 ; for ( int j = 0 ; j < 256 ; j ++ ) { Sum += hash [ j , i ] ; Max = Math . Max ( Max , hash [ j , i ] ) ; } cntMinOP += ( Sum - Max ) ; } return cntMinOP ; } public static void Main ( String [ ] args ) { String [ ] arr = { " abcd " , " bcde " , " cdef " } ; int N = arr . Length ; Console . Write ( minOperation ( arr , N ) + " STRNEWLINE " ) ; } }

Index/key variables: i, j
Accumulator variables: Sum, cntMinOP, i, j
Iterator variables: i, j
Class/struct names: GFG
C# program:
using System ; class GFG { static void countStrings ( String s , int k ) { int ans = 1 ; int len = s . Length ; int flag = 0 ; int start_ind = 0 ; for ( int i = 0 ; i < len - 1 ; i ++ ) { if ( s [ i ] - '0' + s [ i + 1 ] - '0' == k && flag == 0 ) { flag = 1 ; start_ind = i ; } if ( flag == 1 && s [ i ] - '0' + s [ i + 1 ] - '0' != k ) { flag = 0 ; if ( ( i - start_ind + 1 ) % 2 != 0 ) ans *= ( i - start_ind + 1 - 1 ) / 2 + 1 ; } } if ( flag == 1 && ( len - start_ind ) % 2 != 0 ) ans *= ( len - start_ind ) / 2 + 1 ; Console . WriteLine ( ans ) ; } public static void Main ( String [ ] args ) { String S = "313" ; int K = 4 ; countStrings ( S , K ) ; } }

Index/key variables: i
Accumulator variables: ans, i
Iterator variables: i
Class/struct names: GFG
C# program:
using System ; using System . Globalization ; class GFG { static void find_num ( string n ) { int ans = 0 ; char [ ] digitsOfN = n . ToCharArray ( ) ; int sumOfDigitsN = 0 ; foreach ( char c in digitsOfN ) { sumOfDigitsN += Int32 . Parse ( Char . ToString ( c ) ) ; } for ( int x = 11 ; x > 0 ; x ++ ) { int newNum = x * Int32 . Parse ( n ) ; int tempSumDigits = 0 ; string str = newNum . ToString ( ) ; char [ ] temp = str . ToCharArray ( ) ; foreach ( char c in temp ) { tempSumDigits += Int32 . Parse ( Char . ToString ( c ) ) ; } if ( tempSumDigits == sumOfDigitsN ) { ans = x ; break ; } } Console . WriteLine ( ans ) ; } public static void Main ( ) { string N = "3029" ; find_num ( N ) ; } }

Accumulator variables: sumOfDigitsN, tempSumDigits, x
Iterator variables: c, x
Class/struct names: GFG
C# program:
using System ; using System . Collections . Generic ; class GFG { static void findDisStr ( List < string > arr , int N ) { HashSet < string > DistString = new HashSet < string > ( ) ; for ( int i = 0 ; i < N ; i ++ ) { if ( ! DistString . Contains ( arr [ i ] ) ) { DistString . Add ( arr [ i ] ) ; } } foreach ( string a in DistString ) { Console . Write ( a + " ▁ " ) ; } } public static void Main ( String [ ] args ) { List < String > arr = new List < string > ( new [ ] { " Geeks " , " For " , " Geeks " , " Code " , " Coder " } ) ; int N = arr . Count ; findDisStr ( arr , N ) ; } }

Index/key variables: i
Accumulator variables: i
Iterator variables: a, i
Class/struct names: GFG
C# program:
using System ; class GFG { static String modifyString ( int [ ] A , String str , int K ) { int N = str . Length ; int [ ] count = new int [ N + 1 ] ; for ( int i = 0 ; i < K ; i ++ ) { count [ A [ i ] ] ++ ; } for ( int i = 1 ; i <= N / 2 ; i ++ ) { count [ i ] = count [ i ] + count [ i - 1 ] ; if ( ( count [ i ] & 1 ) > 0 ) { str = swap ( str , i - 1 , N - i ) ; } } return str ; } static String swap ( String str , int i , int j ) { char [ ] ch = str . ToCharArray ( ) ; char temp = ch [ i ] ; ch [ i ] = ch [ j ] ; ch [ j ] = temp ; return String . Join ( " " , ch ) ; } public static void Main ( String [ ] args ) { String str = " abcdef " ; int [ ] arr = { 1 , 2 , 3 } ; int K = arr . Length ; Console . Write ( modifyString ( arr , str , K ) ) ; } }

Index/key variables: i, j
Accumulator variables: i
Iterator variables: i
Class/struct names: GFG
C# program:
using System ; class GFG { static int __gcd ( int a , int b ) { return b == 0 ? a : __gcd ( b , a % b ) ; } static void findFraction ( String s ) { String be_deci = " " , af_deci = " " , reccu = " " ; bool x = true , y = false , z = false ; for ( int i = 0 ; i < s . Length ; ++ i ) { if ( s [ i ] == ' . ' ) { x = false ; y = true ; continue ; } if ( s [ i ] == ' ( ' ) { z = true ; y = false ; continue ; } if ( x ) be_deci += s [ i ] ; if ( y ) af_deci += s [ i ] ; if ( z ) { for ( ; i < s . Length && s [ i ] != ' ) ' ; ++ i ) reccu += s [ i ] ; break ; } } int num_be_deci = Int32 . Parse ( be_deci ) ; int num_af_deci = 0 ; if ( af_deci . Length != 0 ) num_af_deci = Int32 . Parse ( af_deci ) ; int numr = num_be_deci * ( int ) Math . Pow ( 10 , af_deci . Length ) + num_af_deci ; int deno = ( int ) Math . Pow ( 10 , af_deci . Length ) ; if ( reccu . Length == 0 ) { int gd = __gcd ( numr , deno ) ; Console . Write ( numr / gd + " ▁ / ▁ " + deno / gd ) ; } else { int reccu_num = Int32 . Parse ( reccu ) ; int numr1 = numr * ( int ) Math . Pow ( 10 , reccu . Length ) + reccu_num ; int deno1 = deno * ( int ) Math . Pow ( 10 , reccu . Length ) ; int res_numr = numr1 - numr , res_deno = deno1 - deno ; int gd = __gcd ( res_numr , res_deno ) ; Console . Write ( res_numr / gd + " ▁ / ▁ " + res_deno / gd ) ; } } public static void Main ( String [ ] args ) { String str = "23.98(231 ) " ; findFraction ( str ) ; } }

Index/key variables: i
Accumulator variables: af_deci, be_deci, reccu
Iterator variables: i
Boolean variables: x, y, z
Class/struct names: GFG
C# program:
using System ; using System . Collections . Generic ; class GFG { static bool lexi_largest_String ( int [ ] a , int i , int sum , List < int > v ) { if ( sum < 0 ) return false ; if ( sum == 0 ) return true ; if ( i < 0 ) return false ; v . Add ( i ) ; if ( lexi_largest_String ( a , i , sum - a [ i ] , v ) ) return true ; v . RemoveAt ( v . Count - 1 ) ; return lexi_largest_String ( a , i - 1 , sum , v ) ; } static void generateString ( int [ ] a , int sum ) { List < int > v = new List < int > ( ) ; lexi_largest_String ( a , 25 , sum , v ) ; String s = " " ; for ( int j = 0 ; j < v . Count ; j ++ ) s += ( char ) ( v [ j ] + ' a ' ) ; Console . Write ( s + " STRNEWLINE " ) ; } public static void Main ( String [ ] args ) { int [ ] a = { 1 , 1 , 2 , 33 , 4 , 6 , 9 , 7 , 36 , 32 , 58 , 32 , 28 , 904 , 22 , 255 , 47 , 69 , 558 , 544 , 21 , 36 , 48 , 85 , 48 , 58 } ; int sum = 236 ; generateString ( a , sum ) ; } }

Index/key variables: i, j
Accumulator variables: j, s
Iterator variables: j
Class/struct names: GFG
C# program:
using System ; class GFG { static int fact ( int a ) { int i , f = 1 ; for ( i = 2 ; i <= a ; i ++ ) f = f * i ; return f ; } static int permute ( int n , int r ) { int ans = 0 ; ans = ( fact ( n ) / fact ( n - r ) ) ; return ans ; } static int findPermutations ( int n ) { int sum = 0 , P ; for ( int r = 1 ; r <= n ; r ++ ) { P = permute ( n , r ) ; sum = sum + P ; } return sum ; } public static void Main ( String [ ] args ) { String str = " xz " ; int n ; n = str . Length ; Console . Write ( findPermutations ( n ) ) ; } }

Accumulator variables: i, r
Iterator variables: i, r
Class/struct names: GFG
C# program:
using System ; class GFG { public static int V = 5 ; static int count = 0 ; static void DFS ( int [ , ] graph , bool [ ] marked , int n , int vert , int start ) { marked [ vert ] = true ; if ( n == 0 ) { marked [ vert ] = false ; if ( graph [ vert , start ] == 1 ) { count ++ ; return ; } else return ; } for ( int i = 0 ; i < V ; i ++ ) if ( ! marked [ i ] && graph [ vert , i ] == 1 ) DFS ( graph , marked , n - 1 , i , start ) ; marked [ vert ] = false ; } static int countCycles ( int [ , ] graph , int n ) { bool [ ] marked = new bool [ V ] ; for ( int i = 0 ; i < V - ( n - 1 ) ; i ++ ) { DFS ( graph , marked , n - 1 , i , i ) ; marked [ i ] = true ; } return count / 2 ; } public static void Main ( ) { int [ , ] graph = { { 0 , 1 , 0 , 1 , 0 } , { 1 , 0 , 1 , 0 , 1 } , { 0 , 1 , 0 , 1 , 0 } , { 1 , 0 , 1 , 0 , 1 } , { 0 , 1 , 0 , 1 , 0 } } ; int n = 4 ; Console . WriteLine ( " Total ▁ cycles ▁ of ▁ length ▁ " + n + " ▁ are ▁ " + countCycles ( graph , n ) ) ; } }

Index/key variables: V, i, vert
Accumulator variables: count, i
Iterator variables: i
Class/struct names: GFG