dhyuti-n/xlcost-variable-roles huggingface dataset:
C# program:
using System ; public class Node { public int data ; public Node left , right ; public Node ( int item ) { data = item ; left = right = null ; } } public class Count { public int count = 0 ; } public class BinaryTree { public Node root ; public Count ct = new Count ( ) ; public virtual bool countSingleRec ( Node node , Count c ) { if ( node == null ) { return true ; } bool left = countSingleRec ( node . left , c ) ; bool right = countSingleRec ( node . right , c ) ; if ( left == false right == false ) { return false ; } if ( node . left != null && node . data != node . left . data ) { return false ; } if ( node . right != null && node . data != node . right . data ) { return false ; } c . count ++ ; return true ; } public virtual int countSingle ( ) { return countSingle ( root ) ; } public virtual int countSingle ( Node node ) { countSingleRec ( node , ct ) ; return ct . count ; } public static void Main ( string [ ] args ) { BinaryTree tree = new BinaryTree ( ) ; tree . root = new Node ( 5 ) ; tree . root . left = new Node ( 4 ) ; tree . root . right = new Node ( 5 ) ; tree . root . left . left = new Node ( 4 ) ; tree . root . left . right = new Node ( 4 ) ; tree . root . right . right = new Node ( 5 ) ; Console . WriteLine ( " The ▁ count ▁ of ▁ single ▁ valued ▁ sub ▁ trees ▁ is ▁ : ▁ " + tree . countSingle ( ) ) ; } }

Accumulator variables: count
Class/struct names: BinaryTree, Count, Node
C# program:
using System ; class GFG { static int countSwap ( String str ) { char [ ] s = str . ToCharArray ( ) ; int n = str . Length ; int count = 0 ; for ( int i = 0 ; i < n / 2 ; i ++ ) { int left = i ; int right = n - left - 1 ; while ( left < right ) { if ( s [ left ] == s [ right ] ) { break ; } else { right -- ; } } if ( left == right ) { return - 1 ; } else { for ( int j = right ; j < n - left - 1 ; j ++ ) { char t = s [ j ] ; s [ j ] = s [ j + 1 ] ; s [ j + 1 ] = t ; count ++ ; } } } return count ; } public static void Main ( String [ ] args ) { String s = " geeksfgeeks " ; int ans1 = countSwap ( s ) ; char [ ] charArray = s . ToCharArray ( ) ; Array . Reverse ( charArray ) ; s = new string ( charArray ) ; int ans2 = countSwap ( s ) ; if ( ans1 > ans2 ) Console . WriteLine ( ans1 ) ; else Console . WriteLine ( ans2 ) ; } }

Index/key variables: j, left, right
Accumulator variables: count, i, j, right
Iterator variables: i, j
Class/struct names: GFG
C# program:
using System ; class GFG { static string reverse ( string str ) { string rev = " " ; for ( int i = str . Length - 1 ; i >= 0 ; i -- ) rev = rev + str [ i ] ; return rev ; } static string strBitwiseXOR ( string [ ] arr , int n ) { string result = " " ; int max_len = int . MinValue ; for ( int i = 0 ; i < n ; i ++ ) { max_len = Math . Max ( max_len , ( int ) arr [ i ] . Length ) ; arr [ i ] = reverse ( arr [ i ] ) ; } for ( int i = 0 ; i < n ; i ++ ) { string s = " " ; for ( int j = 0 ; j < max_len - arr [ i ] . Length ; j ++ ) s += '0' ; arr [ i ] = arr [ i ] + s ; } for ( int i = 0 ; i < max_len ; i ++ ) { int pres_bit = 0 ; for ( int j = 0 ; j < n ; j ++ ) pres_bit = pres_bit ^ ( arr [ j ] [ i ] - '0' ) ; result += ( char ) ( pres_bit + '0' ) ; } result = reverse ( result ) ; return result ; } public static void Main ( ) { string [ ] arr = { "1000" , "10001" , "0011" } ; int n = arr . Length ; Console . Write ( strBitwiseXOR ( arr , n ) ) ; } }

Index/key variables: i, j
Accumulator variables: i, j, result, s
Iterator variables: i, j
Class/struct names: GFG
C# program:
using System ; class GFG { static int [ ] sticks = { 6 , 7 , 4 , 6 , 5 , 4 , 6 , 5 , 2 , 4 , 4 , 3 , 6 , 6 , 6 , 5 , 7 , 6 , 5 , 3 , 5 , 4 , 6 , 4 , 3 , 4 } ; static int [ ] number = { 6 , 2 , 5 , 5 , 4 , 5 , 6 , 3 , 7 , 6 } ; static int countSticks ( string str ) { int cnt = 0 ; for ( int i = 0 ; i < str . Length ; i ++ ) { char ch = str [ i ] ; if ( ch >= ' A ' && ch <= ' Z ' ) { cnt += sticks [ ch - ' A ' ] ; } else { cnt += number [ ch - '0' ] ; } } return cnt ; } public static void Main ( ) { string str = " GEEKSFORGEEKS " ; Console . WriteLine ( countSticks ( str ) ) ; } }

Index/key variables: i
Accumulator variables: cnt, i
Iterator variables: i
Class/struct names: GFG
C# program:
using System ; using System . Collections . Generic ; using System . Linq ; public class GFG { public static void PrintMatchingCamelCase ( String [ ] arr , String pattern ) { String cctdString = arr . Aggregate ( ( i , j ) = > i + ' ; ' + j ) ; Dictionary < String , List < String > > map = new Dictionary < string , List < string > > ( ) ; int charPos = 0 ; int wordPos = 0 ; string strr = string . Empty ; for ( ; charPos < cctdString . Length ; charPos ++ ) { if ( cctdString [ charPos ] >= ' A ' && cctdString [ charPos ] <= ' Z ' ) { strr += cctdString [ charPos ] ; if ( map . ContainsKey ( strr ) ) { List < String > temp = new List < string > ( ) ; temp . AddRange ( map [ strr ] ) ; temp . Add ( arr [ wordPos ] ) ; map [ strr ] = temp ; } else { map . Add ( strr , new List < string > { arr [ wordPos ] } ) ; } } else if ( cctdString [ charPos ] == ' ; ' ) { wordPos ++ ; strr = string . Empty ; } } if ( map . ContainsKey ( pattern ) ) { foreach ( String word in map [ pattern ] ) { Console . WriteLine ( word ) ; } } else { Console . WriteLine ( " No ▁ Match ▁ Found " ) ; } } public static void Main ( String [ ] args ) { String [ ] arr = { " Hi " , " Hello " , " HelloWorld " , " HiTech " , " HiGeek " , " HiTechWorld " , " HiTechCity " , " HiTechLab " } ; String pattern = " HT " ; PrintMatchingCamelCase ( arr , pattern ) ; } }

Index/key variables: charPos, pattern, strr, wordPos
Accumulator variables: charPos, strr, wordPos
Iterator variables: word
Class/struct names: GFG
C# program:
using System ; using System . Collections . Generic ; public class GfG { private static String remainingDigit ( String S , int N ) { char [ ] c = S . ToCharArray ( ) ; int [ ] del = { 0 , 0 } ; int [ ] count = { 0 , 0 } ; List < int > q = new List < int > ( ) ; for ( int i = 0 ; i < N ; i ++ ) { int x = c [ i ] == '1' ? 1 : 0 ; count [ x ] ++ ; q . Add ( x ) ; } while ( count [ 0 ] > 0 && count [ 1 ] > 0 ) { int t = q [ 0 ] ; q . RemoveAt ( 0 ) ; if ( del [ t ] > 0 ) { del [ t ] -- ; count [ t ] -- ; } else { del [ t ^ 1 ] ++ ; q . Add ( t ) ; } } if ( count [ 0 ] > 0 ) return "0" ; return "1" ; } public static void Main ( String [ ] args ) { String S = "1010100100000" ; int N = S . Length ; Console . Write ( remainingDigit ( S , N ) ) ; } }

Index/key variables: i, t, x
Accumulator variables: i
Iterator variables: i
Class/struct names: GfG
C# program:
using System ; public class Node { public int key ; public Node left , right ; public Node ( int key ) { this . key = key ; left = right = null ; } } public class Distance { public int minDis = int . MaxValue ; } public class BinaryTree { public Node root ; public virtual void findLeafDown ( Node root , int lev , Distance minDist ) { if ( root == null ) { return ; } if ( root . left == null && root . right == null ) { if ( lev < ( minDist . minDis ) ) { minDist . minDis = lev ; } return ; } findLeafDown ( root . left , lev + 1 , minDist ) ; findLeafDown ( root . right , lev + 1 , minDist ) ; } public virtual int findThroughParent ( Node root , Node x , Distance minDist ) { if ( root == null ) { return - 1 ; } if ( root == x ) { return 0 ; } int l = findThroughParent ( root . left , x , minDist ) ; if ( l != - 1 ) { findLeafDown ( root . right , l + 2 , minDist ) ; return l + 1 ; } int r = findThroughParent ( root . right , x , minDist ) ; if ( r != - 1 ) { findLeafDown ( root . left , r + 2 , minDist ) ; return r + 1 ; } return - 1 ; } public virtual int minimumDistance ( Node root , Node x ) { Distance d = new Distance ( ) ; findLeafDown ( x , 0 , d ) ; findThroughParent ( root , x , d ) ; return d . minDis ; } public static void Main ( string [ ] args ) { BinaryTree tree = new BinaryTree ( ) ; tree . root = new Node ( 1 ) ; tree . root . left = new Node ( 12 ) ; tree . root . right = new Node ( 13 ) ; tree . root . right . left = new Node ( 14 ) ; tree . root . right . right = new Node ( 15 ) ; tree . root . right . left . left = new Node ( 21 ) ; tree . root . right . left . right = new Node ( 22 ) ; tree . root . right . right . left = new Node ( 23 ) ; tree . root . right . right . right = new Node ( 24 ) ; tree . root . right . left . left . left = new Node ( 1 ) ; tree . root . right . left . left . right = new Node ( 2 ) ; tree . root . right . left . right . left = new Node ( 3 ) ; tree . root . right . left . right . right = new Node ( 4 ) ; tree . root . right . right . left . left = new Node ( 5 ) ; tree . root . right . right . left . right = new Node ( 6 ) ; tree . root . right . right . right . left = new Node ( 7 ) ; tree . root . right . right . right . right = new Node ( 8 ) ; Node x = tree . root . right ; Console . WriteLine ( " The ▁ closest ▁ leaf ▁ to ▁ node ▁ with ▁ value ▁ " + x . key + " ▁ is ▁ at ▁ a ▁ distance ▁ of ▁ " + tree . minimumDistance ( tree . root , x ) ) ; } }

Class/struct names: BinaryTree, Distance, Node
C# program:
using System ; public class Node { public int data ; public Node left , right ; public Node ( int item ) { data = item ; left = right = null ; } } public class BinaryTree { public Node root ; public virtual int getMin ( int x , int y ) { return ( x < y ) ? x : y ; } public virtual int closestDown ( Node node ) { if ( node == null ) { return int . MaxValue ; } if ( node . left == null && node . right == null ) { return 0 ; } return 1 + getMin ( closestDown ( node . left ) , closestDown ( node . right ) ) ; } public virtual int findClosestUtil ( Node node , char k , Node [ ] ancestors , int index ) { if ( node == null ) { return int . MaxValue ; } if ( ( char ) node . data == k ) { int res = closestDown ( node ) ; for ( int i = index - 1 ; i >= 0 ; i -- ) { res = getMin ( res , index - i + closestDown ( ancestors [ i ] ) ) ; } return res ; } ancestors [ index ] = node ; return getMin ( findClosestUtil ( node . left , k , ancestors , index + 1 ) , findClosestUtil ( node . right , k , ancestors , index + 1 ) ) ; } public virtual int findClosest ( Node node , char k ) { Node [ ] ancestors = new Node [ 100 ] ; return findClosestUtil ( node , k , ancestors , 0 ) ; } public static void Main ( string [ ] args ) { BinaryTree tree = new BinaryTree ( ) ; tree . root = new Node ( ' A ' ) ; tree . root . left = new Node ( ' B ' ) ; tree . root . right = new Node ( ' C ' ) ; tree . root . right . left = new Node ( ' E ' ) ; tree . root . right . right = new Node ( ' F ' ) ; tree . root . right . left . left = new Node ( ' G ' ) ; tree . root . right . left . left . left = new Node ( ' I ' ) ; tree . root . right . left . left . right = new Node ( ' J ' ) ; tree . root . right . right . right = new Node ( ' H ' ) ; tree . root . right . right . right . left = new Node ( ' H ' ) ; char k = ' H ' ; Console . WriteLine ( " Distance ▁ of ▁ the ▁ closest ▁ key ▁ from ▁ " + k + " ▁ is ▁ " + tree . findClosest ( tree . root , k ) ) ; k = ' C ' ; Console . WriteLine ( " Distance ▁ of ▁ the ▁ closest ▁ key ▁ from ▁ " + k + " ▁ is ▁ " + tree . findClosest ( tree . root , k ) ) ; k = ' E ' ; Console . WriteLine ( " Distance ▁ of ▁ the ▁ closest ▁ key ▁ from ▁ " + k + " ▁ is ▁ " + tree . findClosest ( tree . root , k ) ) ; k = ' B ' ; Console . WriteLine ( " Distance ▁ of ▁ the ▁ closest ▁ key ▁ from ▁ " + k + " ▁ is ▁ " + tree . findClosest ( tree . root , k ) ) ; } }

Index/key variables: i, index
Accumulator variables: i
Iterator variables: i
Class/struct names: BinaryTree, Node
C# program:
using System ; class GFG { static int CountSubstring ( char [ ] str , int n ) { int ans = ( n * ( n + 1 ) ) / 2 ; int a_index = 0 ; int b_index = 0 ; int c_index = 0 ; for ( int i = 0 ; i < n ; i ++ ) { if ( str [ i ] == ' a ' ) { a_index = i + 1 ; ans -= Math . Min ( b_index , c_index ) ; } else if ( str [ i ] == ' b ' ) { b_index = i + 1 ; ans -= Math . Min ( a_index , c_index ) ; } else { c_index = i + 1 ; ans -= Math . Min ( a_index , b_index ) ; } } return ans ; } public static void Main ( ) { char [ ] str = " babac " . ToCharArray ( ) ; int n = str . Length ; Console . WriteLine ( CountSubstring ( str , n ) ) ; } }

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 { const int N = 2005 ; const int mod = 1000000007 ; static int n ; static int [ ] par = new int [ N ] ; static int [ ] Rank = new int [ N ] ; static Dictionary < int , int > m = new Dictionary < int , int > ( ) ; static void initialize ( ) { for ( int i = 0 ; i <= n ; i ++ ) { par [ i ] = i ; Rank [ i ] = 0 ; } } static int find ( int x ) { if ( par [ x ] != x ) par [ x ] = find ( par [ x ] ) ; return par [ x ] ; } static void Union ( int x , int y ) { int xpar = find ( x ) ; int ypar = find ( y ) ; if ( Rank [ xpar ] < Rank [ ypar ] ) par [ xpar ] = ypar ; else if ( Rank [ xpar ] > Rank [ ypar ] ) par [ ypar ] = xpar ; else { par [ ypar ] = xpar ; Rank [ xpar ] ++ ; } } static long power ( long a , long m1 ) { if ( m1 == 0 ) return 1 ; else if ( m1 == 1 ) return a ; else if ( m1 == 2 ) return ( 1L * a * a ) % mod ; else if ( m1 % 2 == 1 ) return ( 1L * a * power ( power ( a , m1 / 2 ) , 2 ) ) % mod ; else return power ( power ( a , m1 / 2 ) , 2 ) % mod ; } static void query ( int l , int r ) { if ( m . ContainsKey ( l + r ) ) m [ l + r ] = Math . Max ( m [ l + r ] , r ) ; else m [ l + r ] = r ; } static long possiblestrings ( ) { initialize ( ) ; foreach ( KeyValuePair < int , int > i in m ) { int x = i . Key - m [ i . Key ] ; int y = m [ i . Key ] ; while ( x < y ) { Union ( x , y ) ; x ++ ; y -- ; } } int ans = 0 ; for ( int i = 1 ; i <= n ; i ++ ) if ( par [ i ] == i ) ans ++ ; return power ( 26 , ans ) % mod ; } public static void Main ( string [ ] args ) { n = 4 ; query ( 1 , 3 ) ; query ( 2 , 4 ) ; Console . Write ( possiblestrings ( ) ) ; } }

Index/key variables: N, i, x, xpar, ypar
Accumulator variables: ans, i, x, y
Iterator variables: i
Class/struct names: GFG
C# program:
using System ; using System . Collections . Generic ; class GFG { public class node { public int data ; public node left ; public node right ; public node ( int data ) { this . data = data ; this . left = null ; this . right = null ; } } ; static Boolean iterativeSearch ( node root , int x ) { if ( root == null ) return false ; Queue < node > q = new Queue < node > ( ) ; q . Enqueue ( root ) ; while ( q . Count > 0 ) { node node = q . Peek ( ) ; if ( node . data == x ) return true ; q . Dequeue ( ) ; if ( node . left != null ) q . Enqueue ( node . left ) ; if ( node . right != null ) q . Enqueue ( node . right ) ; } return false ; } public static void Main ( String [ ] ags ) { node root = new node ( 2 ) ; root . left = new node ( 7 ) ; root . right = new node ( 5 ) ; root . left . right = new node ( 6 ) ; root . left . right . left = new node ( 1 ) ; root . left . right . right = new node ( 11 ) ; root . right . right = new node ( 9 ) ; root . right . right . left = new node ( 4 ) ; Console . WriteLine ( ( iterativeSearch ( root , 6 ) ? " Found STRNEWLINE " : " Not ▁ Found " ) ) ; Console . Write ( ( iterativeSearch ( root , 12 ) ? " Found STRNEWLINE " : " Not ▁ Found STRNEWLINE " ) ) ; } }

Class/struct names: GFG, node
C# program:
using System ; class Node { public int data ; public Node left , right , next ; public Node ( int item ) { data = item ; left = right = next = null ; } } Node root ; static Node next = null ; void populateNext ( Node node ) { populateNextRecur ( node , next ) ; } void populateNextRecur ( Node p , Node next_ref ) { if ( p != null ) { populateNextRecur ( p . right , next_ref ) ; p . next = next_ref ; next_ref = p ; populateNextRecur ( p . left , next_ref ) ; } }

Class/struct names: Node
C# program:
using System ; class gfg { static bool isValid ( string str , int len ) { for ( int i = 1 ; i < len ; i ++ ) { if ( str [ i ] == str [ i - 1 ] ) return false ; } return true ; } public static void Main ( ) { string str = "0110" ; int len = str . Length ; if ( isValid ( str , len ) ) Console . Write ( " Valid " ) ; else Console . Write ( " Invalid " ) ; } }

Index/key variables: i
Accumulator variables: i
Iterator variables: i
Class/struct names: gfg
C# program:
using System ; class GFG { static int check ( String s , int K ) { for ( int ch = 0 ; ch < 26 ; ch ++ ) { char c = ( char ) ( ' a ' + ch ) ; int last = - 1 ; bool found = true ; for ( int i = 0 ; i < K ; i ++ ) if ( s [ i ] == c ) last = i ; if ( last == - 1 ) continue ; for ( int i = K ; i < s . Length ; i ++ ) { if ( s [ i ] == c ) last = i ; if ( last <= ( i - K ) ) { found = false ; break ; } } if ( found ) return 1 ; } return 0 ; } static int binarySearch ( String s ) { int low = 1 , high = s . Length ; int ans = 0 ; while ( low <= high ) { int mid = ( high + low ) >> 1 ; if ( check ( s , mid ) == 1 ) { ans = mid ; high = mid - 1 ; } else low = mid + 1 ; } return ans ; } public static void Main ( ) { String s = " abcde " ; Console . WriteLine ( binarySearch ( s ) ) ; s = " aaaa " ; Console . WriteLine ( binarySearch ( s ) ) ; } }

Index/key variables: i
Accumulator variables: ch, i
Iterator variables: ch, i
Boolean variables: found
Class/struct names: GFG
C# program:
using System ; public class Gfg { static int vowel_calc ( string s ) { int n = s . Length ; int [ ] arr = new int [ n ] ; for ( int i = 0 ; i < n ; i ++ ) { if ( i == 0 ) arr [ i ] = n ; else arr [ i ] = ( n - i ) + arr [ i - 1 ] - i ; } int sum = 0 ; for ( int i = 0 ; i < n ; i ++ ) { char ch = s [ i ] ; if ( ch == ' a ' ch == ' e ' ch == ' i ' ch == ' o ' ch == ' u ' ) sum += arr [ i ] ; } return sum ; } public static void Main ( ) { string s = " daceh " ; Console . Write ( vowel_calc ( s ) ) ; } }

Index/key variables: i, n
Accumulator variables: i, sum
Iterator variables: i
Class/struct names: Gfg
C# program:
using System ; using System . Collections . Generic ; class GFG { class node { public int data ; public node left , right ; } ; static node newNode ( int data ) { node node = new node ( ) ; node . data = data ; node . left = node . right = null ; return ( node ) ; } static bool iterativeSearch ( node root , int x ) { if ( root == null ) return false ; Stack < node > nodeStack = new Stack < node > ( ) ; nodeStack . Push ( root ) ; while ( nodeStack . Count != 0 ) { node node = nodeStack . Peek ( ) ; if ( node . data == x ) return true ; nodeStack . Pop ( ) ; if ( node . right != null ) nodeStack . Push ( node . right ) ; if ( node . left != null ) nodeStack . Push ( node . left ) ; } return false ; } public static void Main ( String [ ] args ) { node root = newNode ( 2 ) ; root . left = newNode ( 7 ) ; root . right = newNode ( 5 ) ; root . left . right = newNode ( 6 ) ; root . left . right . left = newNode ( 1 ) ; root . left . right . right = newNode ( 11 ) ; root . right . right = newNode ( 9 ) ; root . right . right . left = newNode ( 4 ) ; if ( iterativeSearch ( root , 6 ) ) Console . WriteLine ( " Found " ) ; else Console . WriteLine ( " Not ▁ Found " ) ; if ( iterativeSearch ( root , 12 ) ) Console . WriteLine ( " Found " ) ; else Console . WriteLine ( " Not ▁ Found " ) ; } }

Class/struct names: GFG, node
C# program:
using System ; class GFG { public static bool find ( string s1 , string s2 ) { int len = s1 . Length , len_1 = s2 . Length ; if ( len != len_1 ) return false ; int [ ] d = new int [ len ] ; d [ 0 ] = s2 [ 0 ] - s1 [ 0 ] ; for ( int i = 1 ; i < len ; i ++ ) { if ( s1 [ i ] > s2 [ i ] ) return false ; else { d [ i ] = s2 [ i ] - s1 [ i ] ; } } for ( int i = 0 ; i < len - 1 ; i ++ ) { if ( d [ i ] < d [ i + 1 ] ) return false ; } return true ; } public static void Main ( ) { string s1 = " abcd " , s2 = " bcdd " ; if ( find ( s1 , s2 ) ) Console . WriteLine ( " Yes " ) ; else Console . WriteLine ( " No " ) ; } }

Index/key variables: i, len
Accumulator variables: i
Iterator variables: i
Class/struct names: GFG
C# program:
using System ; class GFG { static bool ispalindrome ( int x ) { int ans = 0 ; int temp = x ; while ( temp > 0 ) { ans = 10 * ans + temp % 10 ; temp = temp / 10 ; } return ans == x ; } static string Reverse ( string s ) { char [ ] charArray = s . ToCharArray ( ) ; Array . Reverse ( charArray ) ; return new string ( charArray ) ; } static int SuperPalindromes ( int L , int R ) { int LIMIT = 100000 ; int ans = 0 ; for ( int i = 0 ; i < LIMIT ; i ++ ) { string s = i . ToString ( ) ; string rs = s . Substring ( 0 , Math . Max ( 1 , s . Length - 1 ) ) ; rs = Reverse ( rs ) ; string p = s + rs ; int p_sq = ( int ) ( Math . Pow ( Int32 . Parse ( p ) , 2 ) ) ; if ( p_sq > R ) { break ; } if ( p_sq >= L && ispalindrome ( p_sq ) ) { ans = ans + 1 ; } } for ( int i = 0 ; i < LIMIT ; i ++ ) { string s = i . ToString ( ) ; string rs = Reverse ( s ) ; string p = s + rs ; int p_sq = ( int ) ( Math . Pow ( Int32 . Parse ( p ) , 2 ) ) ; if ( p_sq > R ) { break ; } if ( p_sq >= L && ispalindrome ( p_sq ) ) { ans = ans + 1 ; } } return ans ; } public static void Main ( ) { string L = "4" ; String R = "1000" ; Console . WriteLine ( SuperPalindromes ( Int32 . Parse ( L ) , Int32 . Parse ( R ) ) ) ; } }

Accumulator variables: i
Iterator variables: i
Class/struct names: GFG
C# program:
using System ; class GFG { static char NthCharacter ( int n ) { String s = " " ; int c = 1 ; for ( int i = 1 ; ; i ++ ) { if ( c < 10 ) s += c . ToString ( ) ; else { String s1 = " " ; int dup = c ; while ( dup > 0 ) { s1 += ( dup % 10 ) . ToString ( ) ; dup /= 10 ; } String temp = reverse ( s1 ) ; s += temp ; } c ++ ; if ( s . Length >= n ) { return s [ n - 1 ] ; } } } static String reverse ( String input ) { char [ ] a = input . ToCharArray ( ) ; int l , r = 0 ; 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 ) { int n = 11 ; Console . WriteLine ( NthCharacter ( n ) ) ; } }

Index/key variables: l, r
Accumulator variables: c, dup, i, l, r, s, s1
Iterator variables: i, l
Class/struct names: GFG
C# program:
using System ; using System . Collections . Generic ; class GFG { static void solve ( string s , int k ) { int count = 0 , length = 0 , pos = 0 ; Dictionary < char , int > m = new Dictionary < char , int > ( ) ; for ( int i = 0 ; i < s . Length ; i ++ ) { if ( m . ContainsKey ( s [ i ] ) ) m [ s [ i ] ] ++ ; else m [ s [ i ] ] = 1 ; length ++ ; if ( length > k ) { m [ s [ pos ] ] -- ; pos ++ ; length -- ; } if ( length == k && m [ s [ i ] ] == length ) count ++ ; } Console . WriteLine ( count ) ; } public static void Main ( ) { string s = " aaaabbbccdddd " ; int k = 4 ; solve ( s , k ) ; } }

Index/key variables: i, pos
Accumulator variables: count, i, length, pos
Iterator variables: i
Class/struct names: GFG
C# program:
using System ; using System . Collections . Generic ; class GFG { static int MAX = Int32 . MaxValue ; static Dictionary < string , int > m = new Dictionary < string , int > ( ) ; static int Min = Int32 . MaxValue ; static int minOperation ( string s , int i , int j , int count ) { if ( ( i >= s . Length && j < 0 ) || ( i == j ) ) { return MAX ; } if ( s [ i ] == s [ j ] || ( count >= Min ) ) { return count ; } string str = i . ToString ( ) + " | " + j . ToString ( ) ; if ( ! m . ContainsKey ( str ) ) { if ( i >= s . Length ) { m [ str ] = minOperation ( s , i , j - 1 , count + 1 ) ; } else if ( j < 0 ) { m [ str ] = minOperation ( s , i + 1 , j , count + 1 ) ; } else { m [ str ] = Math . Min ( minOperation ( s , i , j - 1 , count + 1 ) , minOperation ( s , i + 1 , j , count + 1 ) ) ; } } if ( m [ str ] < Min ) { Min = m [ str ] ; } return m [ str ] ; } static void Main ( ) { string s = " bacdefghipalop " ; int ans = minOperation ( s , 0 , s . Length - 1 , 0 ) ; if ( ans == MAX ) { Console . WriteLine ( - 1 ) ; } else { Console . WriteLine ( ans ) ; } } }

Index/key variables: i, j, str
Class/struct names: GFG