dhyuti-n/xlcost-variable-roles huggingface dataset:
C# program:
using System ; class GFG { public static Tuple < int , int > count_ht ( char s , int N ) { Tuple < int , int > p = Tuple . Create ( 0 , 0 ) ; if ( s == ' H ' ) { p = Tuple . Create ( ( int ) Math . Floor ( N / 2.0 ) , ( int ) Math . Ceiling ( N / 2.0 ) ) ; } else if ( s == ' T ' ) { p = Tuple . Create ( ( int ) Math . Ceiling ( N / 2.0 ) , ( int ) Math . Floor ( N / 2.0 ) ) ; } return p ; } static void Main ( ) { char C = ' H ' ; int N = 5 ; Tuple < int , int > p = count_ht ( C , N ) ; Console . WriteLine ( " Head ▁ = ▁ " + p . Item1 ) ; Console . WriteLine ( " Tail ▁ = ▁ " + p . Item2 ) ; } }

Class/struct names: GFG
C# program:
using System ; class GFG { static String findPalindrome ( String C ) { String S = C ; S = reverse ( S ) ; C = C + " & " + S ; int n = C . Length ; int [ ] longestPalindrome = new int [ n ] ; longestPalindrome [ 0 ] = 0 ; int len = 0 ; int i = 1 ; while ( i < n ) { if ( C [ i ] == C [ len ] ) { len ++ ; longestPalindrome [ i ] = len ; i ++ ; } else { if ( len != 0 ) { len = longestPalindrome [ len - 1 ] ; } else { longestPalindrome [ i ] = 0 ; i ++ ; } } } String ans = C . Substring ( 0 , longestPalindrome [ n - 1 ] ) ; return ans ; } static String findAns ( String s ) { String A = " " ; String B = " " ; String F = " " ; int i = 0 ; int j = s . Length - 1 ; int len = s . Length ; while ( i < j && s [ i ] == s [ j ] ) { i = i + 1 ; j = j - 1 ; } if ( i > 0 ) { A = s . Substring ( 0 , i ) ; B = s . Substring ( len - i , i ) ; } if ( len > 2 * i ) { String C = s . Substring ( i , ( s . Length - 2 * i ) ) ; String D = findPalindrome ( C ) ; C = reverse ( C ) ; String E = findPalindrome ( C ) ; if ( D . Length > E . Length ) { F = D ; } else { F = E ; } } String answer = A + F + B ; return answer ; } static String reverse ( String input ) { char [ ] a = input . ToCharArray ( ) ; int l , r = a . Length - 1 ; for ( l = 0 ; l < r ; l ++ , r -- ) { char temp = a [ l ] ; a [ l ] = a [ r ] ; a [ r ] = temp ; } return String . Join ( " " , a ) ; } public static void Main ( String [ ] args ) { String str = " abcdefghiedcba " ; Console . Write ( findAns ( str ) + " STRNEWLINE " ) ; } }

Index/key variables: i, j, l, len, n, r
Accumulator variables: i, l, len, r
Iterator variables: l
Class/struct names: GFG
C# program:
using System ; class GFG { static int nthTerm ( int N ) { int nth = 0 ; if ( N % 2 == 1 ) nth = ( N * N ) + 1 ; else nth = ( N * N ) - 1 ; return nth ; } public static void Main ( String [ ] args ) { int N = 5 ; Console . Write ( nthTerm ( N ) + " STRNEWLINE " ) ; } }

Class/struct names: GFG
C# program:
using System ; class GFG { static int nthTerm ( int N ) { int nth = 0 , first_term = 12 ; nth = ( int ) ( ( first_term * ( Math . Pow ( 2 , N - 1 ) ) ) + 11 * ( ( Math . Pow ( 2 , N - 1 ) ) - 1 ) ) ; return nth ; } public static void Main ( String [ ] args ) { int N = 5 ; Console . Write ( nthTerm ( N ) + " STRNEWLINE " ) ; } }

Class/struct names: GFG
C# program:
using System ; class GFG { static int nthTerm ( int N ) { int nth = 0 , first_term = 4 ; int pi = 1 , po = 1 ; int n = N ; while ( n > 1 ) { pi *= n - 1 ; n -- ; po *= 2 ; } nth = ( first_term * pi ) / po ; return nth ; } public static void Main ( String [ ] args ) { int N = 5 ; Console . Write ( nthTerm ( N ) + " STRNEWLINE " ) ; } }

Accumulator variables: n, pi, po
Class/struct names: GFG
C# program:
using System ; class GFG { static int finalNum ( int [ ] arr , int n ) { int result = 0 ; for ( int i = 0 ; i < n ; i ++ ) { result = __gcd ( result , arr [ i ] ) ; } return result ; } static int __gcd ( int a , int b ) { return b == 0 ? a : __gcd ( b , a % b ) ; } public static void Main ( String [ ] args ) { int [ ] arr = { 3 , 9 , 6 , 36 } ; int n = arr . Length ; Console . Write ( finalNum ( arr , n ) ) ; } }

Index/key variables: i
Accumulator variables: i
Iterator variables: i
Class/struct names: GFG
C# program:
using System ; class GFG { static bool isVowel ( char ch ) { switch ( ch ) { case ' a ' : case ' e ' : case ' i ' : case ' o ' : case ' u ' : return true ; } return false ; } static bool isSatisfied ( char [ ] str , int n ) { for ( int i = 1 ; i < n ; i ++ ) { if ( ! isVowel ( str [ i ] ) && ! isVowel ( str [ i - 1 ] ) ) { return false ; } } for ( int i = 1 ; i < n - 1 ; i ++ ) { if ( isVowel ( str [ i ] ) && ! isVowel ( str [ i - 1 ] ) && ! isVowel ( str [ i + 1 ] ) ) { return false ; } } return true ; } public static void Main ( String [ ] args ) { String str = " acaba " ; int n = str . Length ; if ( isSatisfied ( str . ToCharArray ( ) , n ) ) Console . WriteLine ( " Yes " ) ; else Console . WriteLine ( " No " ) ; } }

Index/key variables: i
Accumulator variables: i
Iterator variables: i
Class/struct names: GFG
C# program:
using System ; class GfG { static int LengthlongestPrefixSuffix ( string s ) { int n = s . Length ; int [ ] lps = new int [ n ] ; lps [ 0 ] = 0 ; int len = 0 ; int i = 1 ; while ( i < n ) { if ( s [ i ] == s [ len ] ) { len ++ ; lps [ i ] = len ; i ++ ; } else { if ( len != 0 ) { len = lps [ len - 1 ] ; } else { lps [ i ] = 0 ; i ++ ; } } } int res = lps [ n - 1 ] ; return ( res > n / 2 ) ? n / 2 : res ; } static String longestPrefixSuffix ( string s ) { int len = LengthlongestPrefixSuffix ( s ) ; string prefix = " " ; for ( int i = 0 ; i < len ; i ++ ) prefix += s [ i ] ; return prefix ; } public static void Main ( ) { string s = " abcab " ; string ans = longestPrefixSuffix ( s ) ; if ( ans == " " ) Console . WriteLine ( " - 1" ) ; else Console . WriteLine ( ans ) ; } }

Index/key variables: i, len, n
Accumulator variables: i, len, prefix
Iterator variables: i
Class/struct names: GfG
C# program:
using System ; class GFG { static int no_of_characters ( int M ) { int k = 1 ; while ( true ) { if ( ( int ) Math . Pow ( 2 , k + 1 ) - 2 < M ) k ++ ; else break ; } return k ; } static void print_string ( int M ) { int k , num , N ; k = no_of_characters ( M ) ; N = M - ( ( int ) Math . Pow ( 2 , k ) - 2 ) ; while ( k > 0 ) { num = ( int ) Math . Pow ( 2 , k - 1 ) ; if ( num >= N ) Console . Write ( " A " ) ; else { Console . Write ( " B " ) ; N -= num ; } k -- ; } Console . WriteLine ( ) ; } public static void Main ( ) { int M ; M = 30 ; print_string ( M ) ; M = 55 ; print_string ( M ) ; M = 100 ; print_string ( M ) ; } }

Accumulator variables: N, k
Class/struct names: GFG
C# program:
using System ; class GFG { static string updateString ( string S , string A , string B ) { int l = A . Length ; for ( int i = 0 ; i + l <= S . Length ; i ++ ) { string curr = S . Substring ( i , l ) ; if ( curr . Equals ( A ) ) { string new_string = S . Substring ( 0 , i ) + B + S . Substring ( i + l ) ; S = new_string ; i += l - 1 ; } else { string new_string = S . Substring ( 0 , i ) + A + S . Substring ( i + l ) ; S = new_string ; i += l - 1 ; } } return S ; } public static void Main ( ) { string S = " aab " ; string A = " aa " ; string B = " bb " ; Console . WriteLine ( updateString ( S , A , B ) ) ; } }

Accumulator variables: i
Iterator variables: i
Class/struct names: GFG
C# program:
using System ; class GFG { static void printPattern ( int n , int m ) { if ( m > 2 * ( n + 1 ) m < n - 1 ) { Console . Write ( " - 1" ) ; } else if ( Math . Abs ( n - m ) <= 1 ) { while ( n > 0 && m > 0 ) { Console . Write ( "01" ) ; n -- ; m -- ; } if ( n != 0 ) { Console . Write ( "0" ) ; } if ( m != 0 ) { Console . Write ( "1" ) ; } } else { while ( m - n > 1 && n > 0 ) { Console . Write ( "110" ) ; m = m - 2 ; n = n - 1 ; } while ( n > 0 ) { Console . Write ( "10" ) ; n -- ; m -- ; } while ( m > 0 ) { Console . Write ( "1" ) ; m -- ; } } } public static void Main ( ) { int n = 4 , m = 8 ; printPattern ( n , m ) ; } }

Accumulator variables: m, n
Class/struct names: GFG
C# program:
using System ; class GFG { static int countDecreasing ( int [ ] A , int n ) { int len = 1 ; for ( int i = 0 ; i < n - 1 ; ++ i ) { if ( A [ i + 1 ] < A [ i ] ) len ++ ; else { cnt += ( ( ( len - 1 ) * len ) / 2 ) ; len = 1 ; } } if ( len > 1 ) cnt += ( ( ( len - 1 ) * len ) / 2 ) ; return cnt ; } static void Main ( ) { int [ ] A = { 100 , 3 , 1 , 13 } ; int n = A . Length ; Console . WriteLine ( countDecreasing ( A , n ) ) ; } }

Index/key variables: i
Accumulator variables: cnt, len
Iterator variables: i
Class/struct names: GFG
C# program:
using System ; class GFG { static int minimumChar ( String S1 , String S2 ) { int n = S1 . Length ; int m = S2 . Length ; int ans = Int32 . MaxValue ; for ( int i = 0 ; i < m - n + 1 ; i ++ ) { int minRemovedChar = 0 ; for ( int j = 0 ; j < n ; j ++ ) { if ( S1 [ j ] != S2 [ i + j ] ) { minRemovedChar ++ ; } } ans = Math . Min ( minRemovedChar , ans ) ; } return ans ; } public static void Main ( ) { String S1 = " abc " ; String S2 = " paxzk " ; Console . WriteLine ( minimumChar ( S1 , S2 ) ) ; } }

Index/key variables: j
Accumulator variables: i, j, minRemovedChar
Iterator variables: i, j
Class/struct names: GFG
C# program:
using System ; public class GFG { static int countFreq ( String pat , String txt ) { int M = pat . Length ; int N = txt . Length ; int res = 0 ; for ( int i = 0 ; i <= N - M ; i ++ ) { int j ; for ( j = 0 ; j < M ; j ++ ) { if ( txt [ i + j ] != pat [ j ] ) { break ; } } if ( j == M ) { res ++ ; j = 0 ; } } return res ; } static public void Main ( ) { String txt = " dhimanman " ; String pat = " man " ; Console . Write ( countFreq ( pat , txt ) ) ; } }

Index/key variables: j
Accumulator variables: i, j, res
Iterator variables: i, j
Class/struct names: GFG
C# program:
using System ; using System . Collections . Generic ; class GFG { static int findMissingDigit ( string a , string b , string c ) { int w = 1 ; int a_mod_11 = 0 ; for ( int i = a . Length - 1 ; i >= 0 ; i -- ) { a_mod_11 = ( a_mod_11 + w * ( ( int ) a [ i ] - 48 ) ) % 11 ; w = w * - 1 ; } int b_mod_11 = 0 ; w = 1 ; for ( int i = b . Length - 1 ; i >= 0 ; i -- ) { b_mod_11 = ( b_mod_11 + w * ( ( int ) b [ i ] - 48 ) ) % 11 ; w = w * - 1 ; } int c_mod_11 = 0 ; bool xSignIsPositive = true ; w = 1 ; for ( int i = c . Length - 1 ; i >= 0 ; i -- ) { if ( c [ i ] == ' x ' ) { xSignIsPositive = ( w == 1 ) ; } else { c_mod_11 = ( c_mod_11 + w * ( ( int ) c [ i ] - '0' ) ) % 11 ; } w = w * - 1 ; } int x = ( ( a_mod_11 * b_mod_11 ) - c_mod_11 ) % 11 ; if ( xSignIsPositive == false ) { x = - x ; } return ( x % 11 + 11 ) % 11 ; } public static void Main ( ) { string A = "123456789" ; string B = "987654321" ; string C = "12193263111x635269" ; Console . Write ( findMissingDigit ( A , B , C ) ) ; } }

Index/key variables: i
Accumulator variables: i
Iterator variables: i
Boolean variables: xSignIsPositive
Class/struct names: GFG
C# program:
using System ; using System . Collections . Generic ; class GFG { static void findIfPossible ( int N , string str ) { int countG = 0 , countF = 0 ; for ( int i = 0 ; i < N ; i ++ ) { if ( str [ i ] == ' G ' ) countG ++ ; else countF ++ ; } if ( 2 * countF != countG ) { Console . WriteLine ( " NO " ) ; } else { int id = 0 ; bool flag = true ; for ( int i = 0 ; i < N ; i ++ ) { if ( str [ i ] == ' G ' ) { countG -- ; id ++ ; } else { countF -- ; id -- ; } if ( id < 0 ) { flag = false ; break ; } if ( countG < countF ) { flag = false ; break ; } } if ( flag ) { Console . WriteLine ( " YES " ) ; } else { Console . WriteLine ( " NO " ) ; } } } public static void Main ( ) { int n = 6 ; string str = " GFGFGG " ; findIfPossible ( n , str ) ; } }

Index/key variables: i
Accumulator variables: countF, countG, i, id
Iterator variables: i
Boolean variables: flag
Class/struct names: GFG
C# program:
using System ; using System . Collections . Generic ; class GFG { static void isPossible ( string str1 , string str2 ) { int [ ] arr = new int [ 256 ] ; Array . Clear ( arr , 0 , 256 ) ; int l1 = str1 . Length ; int l2 = str2 . Length ; int i ; bool possible = true ; for ( i = 0 ; i < l1 ; i ++ ) { arr [ str1 [ i ] ] = 1 ; } for ( i = 0 ; i < l2 ; i ++ ) { if ( str2 [ i ] != ' ▁ ' ) { if ( arr [ str2 [ i ] ] == 1 ) continue ; else { possible = false ; break ; } } } if ( possible ) { Console . Write ( " Yes " ) ; } else { Console . Write ( " No " ) ; } } public static void Main ( ) { string str1 = " we ▁ all ▁ love ▁ geeksforgeeks " ; string str2 = " we ▁ all ▁ love ▁ geeks " ; isPossible ( str1 , str2 ) ; } }

Index/key variables: i
Accumulator variables: i
Iterator variables: i
Boolean variables: possible
Class/struct names: GFG
C# program:
using System ; using System . Collections . Generic ; class GFG { static int findSubsequence ( string S , char ch ) { int N = S . Length ; int ans = 0 ; for ( int i = 0 ; i < N ; i ++ ) { if ( S [ i ] == ch ) { ans ++ ; ch ++ ; } } return ans ; } static int findMaxSubsequence ( string S ) { int ans = 0 ; for ( char ch = ' a ' ; ch <= ' z ' ; ch ++ ) { ans = Math . Max ( ans , findSubsequence ( S , ch ) ) ; } return ans ; } public static void Main ( ) { string S = " abcabefghijk " ; Console . Write ( findMaxSubsequence ( S ) ) ; } }

Index/key variables: i
Accumulator variables: ans, ch, i
Iterator variables: ch, i
Class/struct names: GFG
C# program:
using System ; using System . Collections . Generic ; class GFG { static void minOpsToEmptyString ( string s ) { int ans = 0 ; int cn0 = 0 ; int cn1 = 0 ; for ( int i = 0 ; i < s . Length ; i ++ ) { if ( s [ i ] == '0' ) { if ( cn1 > 0 ) cn1 -- ; cn0 ++ ; } else { if ( cn0 > 0 ) cn0 -- ; cn1 ++ ; } ans = Math . Max ( ans , Math . Max ( cn0 , cn1 ) ) ; } Console . Write ( ans ) ; } public static void Main ( ) { string S = "010101" ; minOpsToEmptyString ( S ) ; } }

Index/key variables: i
Accumulator variables: cn0, cn1, i
Iterator variables: i
Class/struct names: GFG
C# program:
using System ; public class GFG_JAVA { static int shortestString ( string S , int N ) { int st = 0 ; for ( int i = 0 ; i < N ; i ++ ) { if ( st > 0 && S [ i ] == '1' ) { st -- ; } else { st ++ ; } } return st ; } public static void Main ( string [ ] args ) { string S = "1010" ; int N = S . Length ; Console . WriteLine ( shortestString ( S , N ) ) ; } }

Index/key variables: i
Accumulator variables: i, st
Iterator variables: i
Class/struct names: GFG_JAVA
C# program:
using System ; class GFG { static int findLength ( String str , int n ) { int [ ] pre = new int [ n ] ; int [ ] post = new int [ n ] ; for ( int i = 0 ; i < n ; i ++ ) { pre [ i ] = 0 ; post [ i ] = 0 ; } for ( int i = 0 ; i < n ; i ++ ) { if ( i != 0 ) { pre [ i ] += pre [ i - 1 ] ; } if ( str [ i ] == '1' ) { pre [ i ] += 1 ; } } for ( int i = n - 1 ; i >= 0 ; i -- ) { if ( i != n - 1 ) post [ i ] += post [ i + 1 ] ; if ( str [ i ] == '0' ) post [ i ] += 1 ; } int ans = 0 ; for ( int i = 0 ; i < n ; i ++ ) { ans = Math . Max ( ans , pre [ i ] + post [ i ] ) ; } return ans ; } public static void Main ( String [ ] args ) { String S = "0101110110100001011" ; Console . WriteLine ( findLength ( S , S . Length ) ) ; } }

Index/key variables: i, n
Accumulator variables: i
Iterator variables: i
Class/struct names: GFG
C# program:
using System ; using System . Collections . Generic ; class GFG { static int countSubstring ( String S , int N ) { Dictionary < int , int > prevSum = new Dictionary < int , int > ( ) ; int res = 0 ; int currentSum = 0 ; for ( int i = 0 ; i < N ; i ++ ) { if ( S [ i ] >= ' A ' && S [ i ] <= ' Z ' ) { currentSum ++ ; } else currentSum -- ; if ( currentSum == 0 ) res ++ ; if ( prevSum . ContainsKey ( currentSum ) ) { res += prevSum [ currentSum ] ; prevSum [ currentSum ] = prevSum [ currentSum ] + 1 ; } else prevSum . Add ( currentSum , 1 ) ; } return res ; } public static void Main ( String [ ] args ) { String S = " gEEk " ; Console . WriteLine ( countSubstring ( S , S . Length ) ) ; } }

Index/key variables: currentSum, i
Accumulator variables: currentSum, i, res
Iterator variables: i
Class/struct names: GFG
C# program:
using System ; using System . Collections . Generic ; public class GFG { static int subString ( string s , int n ) { int count = 0 ; for ( int i = 0 ; i < n ; i ++ ) { for ( int len = i + 1 ; len <= n ; len ++ ) { string test_str = s . Substring ( i , len - i ) ; Dictionary < char , int > res = new Dictionary < char , int > ( ) ; foreach ( char keys in test_str . ToCharArray ( ) ) { if ( ! res . ContainsKey ( keys ) ) res . Add ( keys , 0 ) ; res [ keys ] ++ ; } int flag = 0 ; foreach ( KeyValuePair < char , int > keys in res ) { if ( keys . Value % 2 != 0 ) { flag = 1 ; break ; } } if ( flag == 0 ) count += 1 ; } } return count ; } static public void Main ( ) { string S = " abbaa " ; int N = S . Length ; Console . WriteLine ( subString ( S , N ) ) ; } }

Index/key variables: keys
Accumulator variables: count, i, len
Iterator variables: i, keys, len
Class/struct names: GFG
C# program:
using System ; class GFG { static void countStringPairs ( string [ ] a , int n ) { int ans = 0 ; for ( int i = 0 ; i < n ; i ++ ) { for ( int j = i + 1 ; j < n ; j ++ ) { char [ ] p = a [ i ] . ToCharArray ( ) ; char [ ] q = a [ j ] . ToCharArray ( ) ; if ( p [ 0 ] != q [ 0 ] ) { char temp = p [ 0 ] ; p [ 0 ] = q [ 0 ] ; q [ 0 ] = temp ; int flag1 = 0 ; int flag2 = 0 ; for ( int k = 0 ; k < n ; k ++ ) { if ( a [ k ] . Equals ( new string ( p ) ) ) { flag1 = 1 ; } if ( a [ k ] . Equals ( new string ( q ) ) ) { flag2 = 1 ; } } if ( flag1 == 0 && flag2 == 0 ) { ans = ans + 1 ; } } } } Console . WriteLine ( ans ) ; } public static void Main ( string [ ] args ) { string [ ] arr = { " good " , " bad " , " food " } ; int N = arr . Length ; countStringPairs ( arr , N ) ; } }

Index/key variables: i, j, k
Accumulator variables: i, j, k
Iterator variables: i, j, k
Class/struct names: GFG
C# program:
using System ; class GFG { static void addFrequencyToCharacter ( char [ ] s ) { int [ ] frequency = new int [ 26 ] ; int n = s . Length ; for ( int i = 0 ; i < n ; i ++ ) { frequency [ s [ i ] - ' a ' ] += 1 ; } for ( int i = 0 ; i < n ; i ++ ) { int add = frequency [ s [ i ] - ' a ' ] % 26 ; if ( ( int ) ( s [ i ] ) + add <= ( int ) ( ' z ' ) ) s [ i ] = ( char ) ( ( int ) ( s [ i ] ) + add ) ; else { add = ( ( int ) ( s [ i ] ) + add ) - ( ( int ) ( ' z ' ) ) ; s [ i ] = ( char ) ( ( int ) ( ' a ' ) + add - 1 ) ; } } Console . WriteLine ( s ) ; } public static void Main ( string [ ] args ) { string str = " geeks " ; addFrequencyToCharacter ( str . ToCharArray ( ) ) ; } }

Index/key variables: i
Accumulator variables: i
Iterator variables: i
Class/struct names: GFG
C# program:
using System ; using System . Collections . Generic ; public class GFG { static string isPossible ( string S , int R , int N ) { int cntl = 0 , cntr = 0 ; int cntu = 0 , cntd = 0 ; for ( int i = 0 ; i < N ; i ++ ) { if ( S [ i ] == ' L ' ) cntl ++ ; else if ( S [ i ] == ' R ' ) cntr ++ ; else if ( S [ i ] == ' U ' ) cntu ++ ; else cntd ++ ; } if ( Math . Max ( Math . Max ( cntl , cntr ) , Math . Max ( cntu , cntd ) ) >= R ) return " Yes " ; Dictionary < int , int > mp = new Dictionary < int , int > ( ) ; int r_square = R * R ; for ( int i = 1 ; i * i <= r_square ; i ++ ) { mp . Add ( i * i , i ) ; if ( mp . ContainsKey ( r_square - i * i ) ) { if ( Math . Max ( cntl , cntr ) >= mp [ r_square - i * i ] && Math . Max ( cntu , cntd ) >= i ) return " Yes " ; if ( Math . Max ( cntl , cntr ) >= i && Math . Max ( cntu , cntd ) >= mp [ r_square - i * i ] ) return " Yes " ; } } return " No " ; } static public void Main ( ) { string S = " RDLLDDLDU " ; int R = 5 ; int N = S . Length ; Console . WriteLine ( isPossible ( S , R , N ) ) ; } }

Index/key variables: i
Accumulator variables: cntd, cntl, cntr, cntu, i
Iterator variables: i
Class/struct names: GFG
C# program:
using System ; public class GFG { static void addASCII ( char [ ] S , char [ ] N ) { for ( int i = 0 ; i < S . Length ; i ++ ) { int a = ( int ) ( N [ i ] ) - '0' ; int b = ( int ) ( S [ i ] ) + a ; if ( b > 122 ) b -= 26 ; S [ i ] = ( char ) ( b ) ; } Console . Write ( S ) ; } public static void Main ( String [ ] args ) { String S = " sun " , N = "966" ; addASCII ( S . ToCharArray ( ) , N . ToCharArray ( ) ) ; } }

Index/key variables: i
Accumulator variables: b, i
Iterator variables: i
Class/struct names: GFG
C# program:
using System ; using System . Collections . Generic ; class GFG { static int findMinimumChairs ( string s ) { int count = 0 ; int i = 0 ; int mini = Int32 . MinValue ; while ( i < s . Length ) { if ( s [ i ] == ' E ' ) count ++ ; else count -- ; mini = Math . Max ( count , mini ) ; i ++ ; } return mini ; } public static void Main ( ) { string s = " EELEE " ; Console . WriteLine ( findMinimumChairs ( s ) ) ; } }

Index/key variables: i
Accumulator variables: count, i
Class/struct names: GFG
C# program:
using System ; using System . Collections . Generic ; class GFG { static void fillString ( string str , int k ) { char [ ] s = str . ToCharArray ( ) ; Dictionary < int , int > mp = new Dictionary < int , int > ( ) ; for ( int i = 0 ; i < s . Length ; i ++ ) { if ( s [ i ] != ' ? ' ) { mp [ i % k ] = s [ i ] ; } } for ( int i = 0 ; i < s . Length ; i ++ ) { if ( ! mp . ContainsKey ( i % k ) ) { Console . WriteLine ( - 1 ) ; return ; } s [ i ] = ( char ) mp [ i % k ] ; } Console . WriteLine ( new string ( s ) ) ; } static void Main ( ) { string S = " ? ? ? ? abcd " ; int K = 4 ; fillString ( S , K ) ; } }

Index/key variables: i
Accumulator variables: i
Iterator variables: i
Class/struct names: GFG
C# program:
using System ; class GFG { static void rearrangeString ( char [ ] s1 , char [ ] s2 ) { int [ ] cnt = new int [ 26 ] ; for ( int i = 0 ; i < s2 . Length ; i ++ ) cnt [ s2 [ i ] - ' a ' ] ++ ; int unique = 0 ; for ( int i = 0 ; i < 26 ; i ++ ) if ( cnt [ i ] != 0 ) unique ++ ; if ( unique == 1 ) { int count_in_s2 = s2 . Length ; int count_in_s1 = 0 ; for ( int i = 0 ; i < s1 . Length ; i ++ ) if ( s1 [ i ] == s2 [ 0 ] ) count_in_s1 ++ ; if ( count_in_s1 < count_in_s2 ) { Console . Write ( new string ( s1 ) ) ; return ; } Console . Write ( - 1 ) ; } else { int inc = 1 ; for ( int i = 0 ; i < s2 . Length - 1 ; i ++ ) if ( s2 [ i ] > s2 [ i + 1 ] ) inc = 0 ; if ( inc == 1 ) { Array . Sort ( s1 ) ; Array . Reverse ( s1 ) ; Console . Write ( new string ( s1 ) ) ; } else { Array . Sort ( s1 ) ; Console . Write ( new string ( s1 ) ) ; } } } static void Main ( ) { char [ ] s1 = " abcd " . ToCharArray ( ) ; char [ ] s2 = " ab " . ToCharArray ( ) ; rearrangeString ( s1 , s2 ) ; } }

Index/key variables: i
Accumulator variables: count_in_s1, i, unique
Iterator variables: i
Class/struct names: GFG
C# program:
using System ; using System . Collections . Generic ; class GFG { static bool isReducible ( string str ) { int N = str . Length ; List < char > s = new List < char > ( ) ; for ( int i = 0 ; i < N ; i ++ ) { if ( str [ i ] == '1' ) s . Add ( str [ i ] ) ; else if ( s . Count > 0 ) s . RemoveAt ( s . Count - 1 ) ; else return false ; } if ( s . Count == 0 ) { return true ; } else { return false ; } } static void Main ( ) { string str = "11011000" ; if ( isReducible ( str ) ) Console . WriteLine ( " Yes " ) ; else Console . WriteLine ( " No " ) ; } }

Index/key variables: i
Accumulator variables: i
Iterator variables: i
Class/struct names: GFG
C# program:
using System ; class GFG { static int cntMinOperation ( char [ ] S , int N ) { int cntOp = 0 ; for ( int i = 0 ; i < N - 1 ; i ++ ) { if ( S [ i ] == '0' && S [ i + 1 ] == '0' ) { S [ i + 1 ] = '1' ; cntOp += 1 ; } } return cntOp ; } public static void Main ( string [ ] args ) { string S = "10001" ; int N = S . Length ; Console . WriteLine ( cntMinOperation ( S . ToCharArray ( ) , N ) ) ; } }

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