dhyuti-n/xlcost-variable-roles huggingface dataset:
C# program:
using System ; public class GFG { static int LCS ( String S , int N , String T , int M , int [ , ] dp ) { if ( N == 0 M == 0 ) return 0 ; if ( dp [ N , M ] != 0 ) return dp [ N , M ] ; if ( S [ N - 1 ] == T [ M - 1 ] ) { return dp [ N , M ] = 1 + LCS ( S , N - 1 , T , M - 1 , dp ) ; } return dp [ N , M ] = Math . Max ( LCS ( S , N - 1 , T , M , dp ) , LCS ( S , N , T , M - 1 , dp ) ) ; } static int minimumchar ( String S ) { String T = " abcdefghijklmnopqrstuvwxyz " ; int N = S . Length , M = T . Length ; int [ , ] dp = new int [ N + 1 , M + 1 ] ; return ( 26 - LCS ( S , N , T , M , dp ) ) ; } public static void Main ( String [ ] args ) { String S = " abcdadc " ; Console . WriteLine ( minimumchar ( S ) ) ; } }

Class/struct names: GFG
C# program:
using System ; public class GFG { static long MOD = 1000000007 ; public static long exp_mod ( long a , long b ) { long ret = 1 ; for ( ; b > 0 ; b >>= 1 , a = a * a % MOD ) { if ( ( b & 1 ) > 0 ) ret = ret * a % MOD ; } return ret ; } public static long countOfWays ( String s , int k ) { int N = s . Length ; long ans = 0 ; for ( int i = 0 ; i < N ; i ++ ) { if ( s [ i ] == '5' s [ 0 ] == '0' ) { ans = ( ans + exp_mod ( 2 , i ) ) % MOD ; } } long q = exp_mod ( 2 , N ) ; long qk = exp_mod ( q , k ) ; long inv = exp_mod ( q - 1 , MOD - 2 ) ; ans = ans * ( qk - 1 ) % MOD ; ans = ans * inv % MOD ; return ans ; } public static void Main ( String [ ] args ) { String S = "1256" ; int K = 1 ; Console . WriteLine ( countOfWays ( S , K ) ) ; } }

Index/key variables: i
Accumulator variables: i
Iterator variables: i
Class/struct names: GFG
C# program:
using System ; using System . Collections . Generic ; class GFG { static void printMiddleString ( string S , string T , int N ) { int [ ] a1 = new int [ N + 1 ] ; for ( int i = 0 ; i < N ; i ++ ) { a1 [ i + 1 ] = ( int ) S [ i ] - 97 + ( int ) T [ i ] - 97 ; } for ( int i = N ; i >= 1 ; i -- ) { a1 [ i - 1 ] += ( int ) a1 [ i ] / 26 ; a1 [ i ] %= 26 ; } for ( int i = 0 ; i <= N ; i ++ ) { if ( ( a1 [ i ] & 1 ) != 0 ) { if ( i + 1 <= N ) { a1 [ i + 1 ] += 26 ; } } a1 [ i ] = ( int ) a1 [ i ] / 2 ; } for ( int i = 1 ; i <= N ; i ++ ) { Console . Write ( Convert . ToChar ( a1 [ i ] + ' a ' ) ) ; } } public static void Main ( ) { int N = 5 ; string S = " afogk " ; string T = " asdji " ; printMiddleString ( S , T , N ) ; } }

Index/key variables: i
Accumulator variables: i
Iterator variables: i
Class/struct names: GFG
C# program:
using System ; class GFG { static char KthCharacter ( string s , string t , long k ) { long f = 1 ; long ss = 2 ; string tmp = " " ; int len = tmp . Length ; while ( len < k ) { long tf = f ; long ts = ss ; while ( tf -- != 0 ) { tmp += s ; } while ( ts -- != 0 ) { tmp += t ; } f += 2 ; ss += 2 ; len = tmp . Length ; } char output = tmp [ ( int ) k - 1 ] ; return output ; } public static void Main ( string [ ] args ) { string S1 = " a " , S2 = " bc " ; int k = 4 ; char ans = KthCharacter ( S1 , S2 , k ) ; Console . Write ( ans ) ; } }

Accumulator variables: f, ss, tf, tmp, ts
Class/struct names: GFG
C# program:
using System ; public class GFG { static char Kthchar ( String s , String t , long k ) { long n = s . Length ; long m = t . Length ; long first = 1 ; long second = 2 ; char output = ' ? ' ; while ( k > 0 ) { if ( k > first * n ) { long x = first * n ; k = k - x ; first = first + 2 ; if ( k > second * m ) { long y = second * m ; k = k - y ; second = second + 2 ; } else { long ind = k % m ; ind -- ; if ( ind < 0 ) ind = m - 1 ; output = t [ ( int ) ( ind ) ] ; break ; } } else { long ind = k % n ; ind -- ; if ( ind < 0 ) ind = n - 1 ; output = s [ ( int ) ( ind ) ] ; break ; } } return output ; } public static void Main ( String [ ] args ) { String S1 = " a " , S2 = " bc " ; int k = 4 ; char ans = Kthchar ( S1 , S2 , k ) ; Console . WriteLine ( ans ) ; } }

Accumulator variables: ind
Class/struct names: GFG
C# program:
using System ; class GFG { static void makeContiguous ( string S , int N ) { int fst_occur = 0 , lst_occur = 0 ; for ( int x = 0 ; x < N ; x ++ ) { if ( S [ x ] == '1' ) { fst_occur = x ; break ; } } for ( int x = N - 1 ; x >= 0 ; x -- ) { if ( S [ x ] == '1' ) { lst_occur = x ; break ; } } int count = 0 ; for ( int x = fst_occur ; x <= lst_occur ; x ++ ) { if ( S [ x ] == '0' ) { count ++ ; } } Console . Write ( count ) ; } public static void Main ( ) { string S = "010001011" ; int N = S . Length ; makeContiguous ( S , N ) ; } }

Index/key variables: x
Accumulator variables: count, x
Iterator variables: x
Class/struct names: GFG
C# program:
using System ; using System . Collections . Generic ; class GFG { static int fact ( int n ) { int ans = 1 ; for ( int i = 2 ; i <= n ; i ++ ) ans = ans * i ; return ans ; } static int findComb ( int N , int M ) { int x = fact ( N + 1 ) ; int y = fact ( M ) ; return ( x * y ) ; } public static void Main ( ) { int N = 2 ; Console . Write ( findComb ( N , M ) ) ; } }

Accumulator variables: i
Iterator variables: i
Class/struct names: GFG
C# program:
using System ; using System . Collections . Generic ; class GFG { static int findRepitition ( char a ) { if ( a <= ' z ' && a >= ' a ' ) { return ( int ) a - 97 ; } else if ( a <= ' Z ' && a >= ' A ' ) { return ( int ) a - 65 ; } return 0 ; } static void decodeString ( string str ) { string output = " " ; for ( int i = 0 ; i < str . Length ; i ++ ) { output += str [ i ] ; i += findRepitition ( str [ i ] ) ; } Console . Write ( " Decrypted ▁ code ▁ is ▁ { " + output + " } " ) ; } public static void Main ( ) { string str = " abbbb ▁ acccdddd " ; decodeString ( str ) ; } }

Index/key variables: i
Accumulator variables: i, output
Iterator variables: i
Class/struct names: GFG
C# program:
using System ; public class GFG { static void printString ( String S , int N ) { String [ ] plaintext = new String [ 5 ] ; int [ ] freq = new int [ 26 ] ; int [ ] freqSorted = new int [ 26 ] ; int [ ] Used = new int [ 26 ] ; for ( int i = 0 ; i < N ; i ++ ) { if ( S [ i ] != ' ▁ ' ) { freq [ S [ i ] - ' A ' ] ++ ; } } for ( int i = 0 ; i < 26 ; i ++ ) { freqSorted [ i ] = freq [ i ] ; } String T = " ETAOINSHRDLCUMWFGYPBVKJXQZ " ; Array . Sort ( freqSorted ) ; freqSorted = reverse ( freqSorted ) ; for ( int i = 0 ; i < 5 ; i ++ ) { int ch = - 1 ; for ( int j = 0 ; j < 26 ; j ++ ) { if ( freqSorted [ i ] == freq [ j ] && Used [ j ] == 0 ) { Used [ j ] = 1 ; ch = j ; break ; } } if ( ch == - 1 ) break ; int x = T [ i ] - ' A ' ; x = x - ch ; String curr = " " ; for ( int k = 0 ; k < N ; k ++ ) { if ( S [ k ] == ' ▁ ' ) { curr += ( char ) ' ▁ ' ; continue ; } int y = S [ k ] - ' A ' ; y += x ; if ( y < 0 ) y += 26 ; if ( y > 25 ) y -= 26 ; curr += ( char ) ( ' A ' + y ) ; } plaintext [ i ] = curr ; } for ( int i = 0 ; i < 5 ; i ++ ) { Console . Write ( plaintext [ i ] + " STRNEWLINE " ) ; } } static int [ ] reverse ( int [ ] a ) { int i , n = a . Length , t ; for ( i = 0 ; i < n / 2 ; i ++ ) { t = a [ i ] ; a [ i ] = a [ n - i - 1 ] ; a [ n - i - 1 ] = t ; } return a ; } public static void Main ( String [ ] args ) { String S = " B ▁ TJNQMF ▁ NFTTBHF " ; int N = S . Length ; printString ( S , N ) ; } }

Index/key variables: i, j, k
Accumulator variables: curr, i, j, k, y
Iterator variables: i, j, k
Class/struct names: GFG
C# program:
using System ; using System . Collections . Generic ; public class GFG { static String canMadeEmpty ( String s , int n ) { Stack < char > St = new Stack < char > ( ) ; for ( int i = 0 ; i < n ; i ++ ) { if ( s [ i ] == ' c ' ) { if ( St . Count >= 2 ) { char b = St . Peek ( ) ; St . Pop ( ) ; char a = St . Peek ( ) ; St . Pop ( ) ; if ( a != ' a ' b != ' b ' ) return " No " ; } else return " No " ; } else St . Push ( s [ i ] ) ; } if ( St . Count == 0 ) { return " Yes " ; } else { return " No " ; } } public static void Main ( String [ ] args ) { String S = " aabcbc " ; int N = S . Length ; Console . Write ( canMadeEmpty ( S , N ) ) ; } }

Index/key variables: i
Accumulator variables: i
Iterator variables: i
Class/struct names: GFG
C# program:
using System ; class GFG { public static void countOperations ( string S ) { int n = S . Length ; int ans = 0 ; int cnt = 0 ; for ( int i = 0 ; i < n ; i ++ ) { if ( S [ i ] == '0' ) { cnt ++ ; } else { if ( cnt > 0 ) { cnt -- ; ans ++ ; } } } Console . Write ( ans ) ; } public static void Main ( string [ ] args ) { string S = "110011010" ; countOperations ( S ) ; } }

Index/key variables: i
Accumulator variables: ans, cnt, i
Iterator variables: i
Class/struct names: GFG
C# program:
using System ; using System . Collections . Generic ; public static class GFG { public static IEnumerable < T > Reverse < T > ( this LinkedList < T > list ) { var el = list . Last ; while ( el != null ) { yield return el . Value ; el = el . Previous ; } } public static string check ( string S ) { int N = S . Length ; LinkedList < int > A = new LinkedList < int > ( ) ; LinkedList < int > B = new LinkedList < int > ( ) ; LinkedList < int > C = new LinkedList < int > ( ) ; for ( int i = 0 ; i < N ; i ++ ) { if ( S [ i ] == ' A ' ) { A . AddLast ( i ) ; } else if ( S [ i ] == ' B ' ) { B . AddLast ( i ) ; } else { C . AddLast ( i ) ; } } if ( N % 3 > 0 A . Count != B . Count A . Count != C . Count ) { return " No " ; } foreach ( var itr in B ) { int b = itr ; if ( A . Count > 0 && b > A . First . Value ) { A . RemoveFirst ( ) ; } else { return " No " ; } } foreach ( var itr in B . Reverse ( ) ) { int b = itr ; if ( C . Count > 0 && b < C . Last . Value ) { C . RemoveLast ( ) ; } else { return " No " ; } } return " Yes " ; } static public void Main ( ) { string S = " ABABCC " ; Console . Write ( check ( S ) ) ; } }

Index/key variables: i
Accumulator variables: i
Iterator variables: i, itr
Class/struct names: GFG
C# program:
using System ; public class GFG { static String isSumEqual ( String A , String B , String C ) { int L = A . Length ; int M = B . Length ; int N = A . Length ; A = reverse ( A ) ; B = reverse ( B ) ; C = reverse ( C ) ; int rem = 0 ; for ( int i = 0 ; i < Math . Max ( L , Math . Max ( M , N ) ) ; i ++ ) { int curr = rem ; if ( i < L ) curr += A [ i ] - ' a ' ; if ( i < M ) curr += B [ i ] - ' a ' ; rem = curr / 10 ; curr %= 10 ; if ( i < N && curr != C [ i ] - ' a ' ) { return " No " ; } } if ( rem > 0 ) return " No " ; else return " Yes " ; } 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 A = " acb " , B = " cba " , C = " cdb " ; Console . Write ( isSumEqual ( A , B , C ) ) ; } }

Index/key variables: i, l, r
Accumulator variables: curr, i, l, r
Iterator variables: i, l
Class/struct names: GFG
C# program:
using System ; using System . Collections . Generic ; class GFG { static int MinimumLengthSubstring ( string S , int N ) { int ans = N ; S = "0" + S + "0" ; for ( char c = ' a ' ; c <= ' z ' ; ++ c ) { int prev = 0 ; int max_len = 0 ; S = S . Substring ( 0 , 0 ) + c + S . Substring ( 1 ) ; S = S . Substring ( 0 , N + 1 ) + c + S . Substring ( N + 2 ) ; for ( int i = 1 ; i <= N + 1 ; ++ i ) { if ( S [ i ] == c ) { int len = i - prev ; max_len = Math . Max ( max_len , len ) ; prev = i ; } } ans = Math . Min ( ans , max_len ) ; } return ans ; } public static void Main ( ) { string S = " abcde " ; int N = S . Length ; Console . Write ( MinimumLengthSubstring ( S , N ) ) ; } }

Index/key variables: i
Iterator variables: c, i
Class/struct names: GFG
C# program:
using System ; using System . Collections . Generic ; class GFG { static int minimumHammingDistance ( string S , int K ) { int n = S . Length ; int [ ] pref = new int [ n ] ; pref [ 0 ] = ( int ) S [ 0 ] - 48 ; for ( int i = 1 ; i < n ; i ++ ) pref [ i ] = pref [ i - 1 ] + ( ( int ) S [ i ] - 48 ) ; int cnt = pref [ n - 1 ] ; int ans = cnt ; for ( int i = 0 ; i < n - K ; i ++ ) { int value = pref [ i + K - 1 ] - ( i - 1 >= 0 ? pref [ i - 1 ] : 0 ) ; ans = Math . Min ( ans , cnt - value + ( K - value ) ) ; } return ans ; } public static void Main ( ) { string s = "101" ; int K = 2 ; Console . Write ( minimumHammingDistance ( s , K ) ) ; } }

Index/key variables: i, n
Accumulator variables: i
Iterator variables: i
Class/struct names: GFG
C# program:
using System ; class GFG { private static bool isPrime ( int n ) { if ( n <= 1 ) return false ; else if ( n == 2 ) return true ; else if ( n % 2 == 0 ) return false ; for ( int i = 3 ; i <= Math . Sqrt ( n ) ; i += 2 ) { if ( n % i == 0 ) return false ; } return true ; } private static void checkPermutation ( string s1 , string s2 ) { int [ ] freq = new int [ 26 ] ; foreach ( char ch in s1 . ToCharArray ( ) ) { freq [ ch - ' a ' ] -- ; } foreach ( char ch in s2 . ToCharArray ( ) ) { freq [ ch - ' a ' ] ++ ; } bool isAllChangesPrime = true ; for ( int i = 0 ; i < 26 ; i ++ ) { if ( freq [ i ] == 0 ) { continue ; } else if ( ! isPrime ( Math . Abs ( freq [ i ] ) ) ) { isAllChangesPrime = false ; break ; } } if ( isAllChangesPrime != false ) { Console . WriteLine ( " Yes " ) ; } else { Console . WriteLine ( " No " ) ; } } public static void Main ( String [ ] args ) { string S1 = " gekforgk " ; string S2 = " geeksforgeeks " ; checkPermutation ( S1 , S2 ) ; } }

Index/key variables: i
Accumulator variables: i
Iterator variables: ch, i
Boolean variables: isAllChangesPrime
Class/struct names: GFG
C# program:
using System ; using System . Collections . Generic ; class GFG { static void isEqualSubstring ( string str , int x ) { int n = str . Length ; int i = 0 ; while ( i < n && i < x ) { if ( str [ i ] != str [ n - i - 1 ] ) { Console . Write ( " false " ) ; return ; } i ++ ; } Console . Write ( " true " ) ; } public static void Main ( ) { string str = " GeeksforGeeks " ; int x = 3 ; isEqualSubstring ( str , x ) ; } }

Index/key variables: i
Accumulator variables: i
Class/struct names: GFG
C# program:
using System ; class GFG { public static void minimumOperations ( string S , int N ) { int ans = 0 ; int cntOne = 0 ; for ( int i = N - 1 ; i >= 0 ; i -- ) { if ( S [ i ] == '0' ) { ans += cntOne ; cntOne *= 2 ; } else cntOne ++ ; } Console . WriteLine ( ans ) ; } static void Main ( ) { string S = "001" ; int N = S . Length ; minimumOperations ( S , N ) ; } }

Index/key variables: i
Accumulator variables: ans, cntOne, i
Iterator variables: i
Class/struct names: GFG
C# program:
using System ; class GFG { static void differentBitwiseOR ( String s1 , String s2 ) { int n = s1 . Length ; int t00 = 0 , t10 = 0 , t01 = 0 , t11 = 0 ; for ( int i = 0 ; i < n ; i ++ ) { if ( s1 [ i ] == '0' && s2 [ i ] == '0' ) { t00 ++ ; } if ( s1 [ i ] == '1' && s2 [ i ] == '0' ) { t10 ++ ; } if ( s1 [ i ] == '1' && s2 [ i ] == '1' ) { t11 ++ ; } if ( s1 [ i ] == '0' && s2 [ i ] == '1' ) { t01 ++ ; } } int ans = t00 * t10 + t01 * t10 + t00 * t11 ; Console . Write ( ans ) ; } public static void Main ( ) { String S1 = "01001" ; String S2 = "11011" ; differentBitwiseOR ( S1 , S2 ) ; } }

Index/key variables: i
Accumulator variables: i, t00, t01, t10, t11
Iterator variables: i
Class/struct names: GFG
C# program:
using System ; using System . Collections . Generic ; class GFG { static void RemoveCharacters ( string s ) { string ans = " " ; int [ ] c = new int [ 26 ] ; for ( int i = 0 ; i < 26 ; i ++ ) c [ i ] = 0 ; int pos = 0 ; for ( int i = 0 ; i < s . Length ; i ++ ) { if ( c [ ( int ) s [ i ] - 97 ] == 0 ) { c [ ( int ) s [ i ] - 97 ] = 1 ; pos = i ; ans += s [ i ] ; } } for ( int i = pos + 1 ; i < s . Length ; i ++ ) { if ( s [ i ] == s [ 0 ] ) { ans += s [ i ] ; break ; } } Console . Write ( ans ) ; } public static void Main ( ) { string S = " abcaadbcd " ; RemoveCharacters ( S ) ; } }

Index/key variables: i
Accumulator variables: ans, i
Iterator variables: i
Class/struct names: GFG
C# program:
using System ; using System . Collections . Generic ; class GFG { static void changeCharacters ( string S , int N , int K ) { int flag = 1 ; int count = 0 ; Stack < char > st = new Stack < char > ( ) ; for ( int i = 0 ; i < N ; i ++ ) { if ( st . Count == 0 ) { if ( S [ i ] == '0' ) { flag = 0 ; break ; } count = 0 ; st . Push ( S [ i ] ) ; } else { if ( S [ i ] == '0' ) { count ++ ; if ( count == K ) { st . Pop ( ) ; count = 0 ; } } else { count = 0 ; } } } if ( flag == 1 ) Console . Write ( " YES " ) ; else Console . Write ( " NO " ) ; } public static void Main ( ) { string S = "100100" ; int N = S . Length ; int K = 2 ; changeCharacters ( S , N , K ) ; } }

Index/key variables: i
Accumulator variables: count, i
Iterator variables: i
Class/struct names: GFG
C# program:
using System ; using System . Collections . Generic ; class GFG { static bool prefixDivisble ( int n ) { int i = 1 ; while ( n > 0 ) { if ( n % i != 0 ) return false ; n = n / 10 ; i ++ ; } return true ; } public static void Main ( ) { int n = 52248 ; if ( prefixDivisble ( n ) ) Console . Write ( " Yes " ) ; else Console . Write ( " No " ) ; } }

Accumulator variables: i
Class/struct names: GFG
C# program:
using System ; using System . Collections . Generic ; class GFG { static void MinimumCost ( string S , int A , int B ) { int count = 0 ; int group = 0 ; for ( int i = 0 ; i < S . Length ; i ++ ) { if ( S [ i ] == '0' ) { count += 1 ; } else { if ( count > 0 ) { group += 1 ; } count = 0 ; } } if ( count > 0 ) group += 1 ; if ( group == 0 ) { Console . WriteLine ( 0 ) ; } else { Console . Write ( Math . Min ( A , B ) * ( group - 1 ) + B ) ; } } public static void Main ( ) { int A = 1 ; int B = 5 ; string S = "01100" ; MinimumCost ( S , A , B ) ; } }

Index/key variables: i
Accumulator variables: count, group, i
Iterator variables: i
Class/struct names: GFG
C# program:
using System ; using System . Collections . Generic ; class GFG { static bool isPrime ( int num ) { bool flag = false ; if ( num > 1 ) { for ( int i = 2 ; i < num ; i ++ ) { if ( ( num % i ) == 0 ) { flag = true ; break ; } } } if ( flag ) return false ; else return true ; } static int order ( int x ) { int n = 0 ; while ( x != 0 ) { n = n + 1 ; x = x / 10 ; } return n ; } static bool isArmstrong ( int x ) { int n = order ( x ) ; int temp = x ; int sum1 = 0 ; while ( temp != 0 ) { int r = temp % 10 ; sum1 = sum1 + ( int ) ( Math . Pow ( r , n ) ) ; temp = temp / 10 ; } return ( sum1 == x ) ; } static int count_armstrong ( string [ ] li ) { int c = 0 ; foreach ( string ele in li ) { int val = 0 ; foreach ( char che in ele ) val += che ; if ( isArmstrong ( val ) ) c += 1 ; } return c ; } static int count_prime ( string [ ] li ) { int c = 0 ; foreach ( string ele in li ) { int val = 0 ; foreach ( char che in ele ) val += che ; if ( isPrime ( val ) ) c += 1 ; } return c ; } public static void Main ( ) { string [ ] arr = { " geeksforgeeks " , " a " , " computer " , " science " , " portal " , " for " , " geeks " } ; Console . WriteLine ( " Number ▁ of ▁ Armstrong ▁ Strings ▁ are : ▁ " + count_armstrong ( arr ) ) ; Console . WriteLine ( " Number ▁ of ▁ Prime ▁ Strings ▁ are : ▁ " + count_prime ( arr ) ) ; } }

Accumulator variables: c, i, val
Iterator variables: che, ele, i
Boolean variables: flag
Class/struct names: GFG
C# program:
using System ; class GFG { static void findMinimumCost ( String s , int N ) { int count_1 = 0 , count_0 = 0 ; for ( int i = 0 ; i < N ; i ++ ) { if ( s [ i ] == '1' ) count_1 ++ ; else count_0 ++ ; } int k = Math . Abs ( count_0 - count_1 ) ; if ( count_1 == N count_0 == N ) Console . WriteLine ( - 1 ) ; else Console . WriteLine ( k / 2 ) ; } static public void Main ( ) { String S = "110110" ; int N = S . Length ; findMinimumCost ( S , N ) ; } }

Index/key variables: i
Accumulator variables: count_0, count_1, i
Iterator variables: i
Class/struct names: GFG
C# program:
using System ; using System . Collections . Generic ; class GFG { static void findMinimumTime ( string S , int N , int K ) { if ( N == 0 ) { Console . Write ( 0 ) ; return ; } int maxfreq = Int32 . MinValue ; char maxchar = ' ▁ ' ; Dictionary < char , int > um = new Dictionary < char , int > ( ) ; for ( int i = 0 ; i < N ; i ++ ) { if ( um . ContainsKey ( S [ i ] ) ) um [ S [ i ] ] ++ ; else um . Add ( S [ i ] , 1 ) ; if ( um . ContainsKey ( S [ i ] ) && um [ S [ i ] ] > maxfreq ) { maxfreq = um [ S [ i ] ] ; maxchar = S [ i ] ; } } int emptySlots = ( maxfreq - 1 ) * K ; foreach ( KeyValuePair < char , int > kvp in um ) { if ( kvp . Key == maxchar ) continue ; emptySlots -= Math . Min ( kvp . Value , maxfreq - 1 ) ; } int ans = N + Math . Max ( 0 , emptySlots ) ; Console . Write ( ans ) ; } public static void Main ( ) { string S = " AAABBB " ; int K = 2 ; int N = S . Length ; findMinimumTime ( S , N , K ) ; } }

Index/key variables: i
Accumulator variables: emptySlots, i
Iterator variables: i, kvp
Class/struct names: GFG
C# program:
using System ; class GFG { static void canMakeEqual ( String S ) { int N = S . Length ; int weightOfString = 0 ; for ( int i = 0 ; i < N ; i ++ ) { weightOfString += S [ i ] - ' a ' + 1 ; } if ( weightOfString % N == 0 ) Console . WriteLine ( " Yes " ) ; else Console . WriteLine ( " No " ) ; } public static void Main ( String [ ] args ) { String S = " beb " ; canMakeEqual ( S ) ; } }

Index/key variables: i
Accumulator variables: i, weightOfString
Iterator variables: i
Class/struct names: GFG
C# program:
using System ; class GFG { static void addFrequencyToCharacter ( string Str ) { int [ ] frequency = new int [ 26 ] ; int N = Str . Length ; char [ ] S = Str . ToCharArray ( ) ; 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 . Write ( new string ( S ) ) ; } public static void Main ( string [ ] args ) { string S = " geeksforgeeks " ; addFrequencyToCharacter ( S ) ; } }

Index/key variables: i
Accumulator variables: i
Iterator variables: i
Class/struct names: GFG
C# program:
using System ; using System . Collections . Generic ; class GFG { static int minLength ( String S ) { Stack < char > st = new Stack < char > ( ) ; foreach ( char ch in S . ToCharArray ( ) ) { if ( st . Count == 0 ) st . Push ( ch ) ; else { char top = st . Peek ( ) ; if ( Math . Abs ( ch - top ) == 1 ) st . Pop ( ) ; else { st . Push ( ch ) ; } } } return st . Count ; } public static void Main ( String [ ] args ) { String S = "12213" ; Console . WriteLine ( minLength ( S ) ) ; } }

Iterator variables: ch
Class/struct names: GFG
C# program:
using System ; using System . Collections . Generic ; class GFG { static void findMinimumTime ( String tasks , int K ) { Dictionary < char , int > map = new Dictionary < char , int > ( ) ; int curr_time = 0 ; foreach ( char c in tasks . ToCharArray ( ) ) { if ( map . ContainsKey ( c ) ) { if ( curr_time - map <= K ) { curr_time += K - ( curr_time - map ) + 1 ; } } if ( ! map . ContainsKey ( c ) ) map . Add ( c , curr_time ) ; else map = curr_time ; curr_time ++ ; } Console . WriteLine ( curr_time ) ; } public static void Main ( String [ ] args ) { String S = " ABACCA " ; int K = 2 ; findMinimumTime ( S , K ) ; } }

Accumulator variables: curr_time
Iterator variables: c
Class/struct names: GFG
C# program:
using System ; using System . Collections . Generic ; class GFG { static void checkforSubsequence ( String S , String target ) { Stack < char > s = new Stack < char > ( ) ; for ( int i = 0 ; i < target . Length ; i ++ ) { s . Push ( target [ i ] ) ; } for ( int i = ( int ) S . Length - 1 ; i >= 0 ; i -- ) { if ( s . Count == 0 ) { Console . WriteLine ( " Yes " ) ; return ; } if ( S [ i ] == s . Peek ( ) ) { s . Pop ( ) ; } } if ( s . Count == 0 ) Console . WriteLine ( " Yes " ) ; else Console . WriteLine ( " No " ) ; } public static void Main ( String [ ] args ) { String S = " KOTTAYAM " ; String target = " KOTA " ; checkforSubsequence ( S , target ) ; } }

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