dhyuti-n/xlcost-variable-roles huggingface dataset:
C# program:
using System ; class GFG { static void longestPalindrome ( String [ ] a , int n ) { String [ ] pair1 = new String [ n ] ; String [ ] pair2 = new String [ n ] ; int r = 0 ; for ( int i = 0 ; i < n ; i ++ ) { String s = a [ i ] ; s = reverse ( s ) ; for ( int j = i + 1 ; j < n ; j ++ ) { if ( a [ i ] != " " && a [ j ] != " " ) { if ( s . Equals ( a [ j ] ) ) { pair1 [ r ] = a [ i ] ; pair2 [ r ++ ] = a [ j ] ; a [ i ] = " " ; a [ j ] = " " ; break ; } } } } String s1 = " " ; for ( int i = 0 ; i < n ; i ++ ) { String s = a [ i ] ; a [ i ] = reverse ( a [ i ] ) ; if ( a [ i ] != " " ) { if ( a [ i ] . Equals ( s ) ) { s1 = a [ i ] ; break ; } } } String ans = " " ; for ( int i = 0 ; i < r ; i ++ ) { ans = ans + pair1 [ i ] ; } if ( s1 != " " ) { ans = ans + s1 ; } for ( int j = r - 1 ; j >= 0 ; j -- ) { ans = ans + pair2 [ j ] ; } Console . Write ( ans + " STRNEWLINE " ) ; } 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 [ ] a1 = { " aba " , " aba " } ; int n1 = a1 . Length ; longestPalindrome ( a1 , n1 ) ; String [ ] a2 = { " abc " , " dba " , " kop " , " abd " , " cba " } ; int n2 = a2 . Length ; longestPalindrome ( a2 , n2 ) ; } }

Index/key variables: i, j, l, n, r
Accumulator variables: i, j, l, r
Iterator variables: i, j, l
Class/struct names: GFG
C# program:
using System ; class GFG { static void printValue ( char digit ) { switch ( digit ) { case '0' : Console . Write ( " Zero ▁ " ) ; break ; case '1' : Console . Write ( " One ▁ " ) ; break ; case '2' : Console . Write ( " Two ▁ " ) ; break ; case '3' : Console . Write ( " Three ▁ " ) ; break ; case '4' : Console . Write ( " Four ▁ " ) ; break ; case '5' : Console . Write ( " Five ▁ " ) ; break ; case '6' : Console . Write ( " Six ▁ " ) ; break ; case '7' : Console . Write ( " Seven ▁ " ) ; break ; case '8' : Console . Write ( " Eight ▁ " ) ; break ; case '9' : Console . Write ( " Nine ▁ " ) ; break ; } } static void printWord ( string N ) { int i , length = N . Length ; for ( i = 0 ; i < length ; i ++ ) { printValue ( N [ i ] ) ; } } public static void Main ( ) { string N = "123" ; printWord ( N ) ; } }

Index/key variables: i
Accumulator variables: i
Iterator variables: i
Class/struct names: GFG
C# program:
using System ; class GFG { static int ALPHABET_SIZE = 26 ; class TrieNode { public TrieNode [ ] children = new TrieNode [ ALPHABET_SIZE ] ; public bool isEndOfWord ; public TrieNode ( ) { } } ; static TrieNode getNode ( ) { TrieNode pNode = new TrieNode ( ) ; pNode . isEndOfWord = false ; for ( int i = 0 ; i < ALPHABET_SIZE ; i ++ ) pNode . children [ i ] = null ; return pNode ; } static void insert ( TrieNode root , String key ) { TrieNode pCrawl = root ; for ( int i = 0 ; i < key . Length ; i ++ ) { int index = key [ i ] - ' a ' ; if ( pCrawl . children [ index ] == null ) pCrawl . children [ index ] = getNode ( ) ; pCrawl = pCrawl . children [ index ] ; } pCrawl . isEndOfWord = true ; } static bool search ( TrieNode root , String key ) { TrieNode pCrawl = root ; for ( int i = 0 ; i < key . Length ; i ++ ) { int index = key [ i ] - ' a ' ; if ( pCrawl . children [ index ] == null ) return false ; pCrawl = pCrawl . children [ index ] ; } return ( pCrawl != null && pCrawl . isEndOfWord ) ; } static void wordBreakAll ( TrieNode root , String word , int n , String result ) { for ( int i = 1 ; i <= n ; i ++ ) { String prefix = word . Substring ( 0 , i ) ; if ( search ( root , prefix ) ) { if ( i == n ) { result += prefix ; Console . Write ( " TABSYMBOL " + result + " STRNEWLINE " ) ; return ; } wordBreakAll ( root , word . Substring ( i , n - i ) , n - i , result + prefix + " ▁ " ) ; } } } public static void Main ( String [ ] args ) { new TrieNode ( ) ; TrieNode root = getNode ( ) ; String [ ] dictionary = { " sam " , " sung " , " samsung " } ; int n = dictionary . Length ; for ( int i = 0 ; i < n ; i ++ ) { insert ( root , dictionary [ i ] ) ; } for ( int i = 0 ; i < n ; i ++ ) { Console . Write ( dictionary [ i ] + " : ▁ STRNEWLINE " ) ; wordBreakAll ( root , dictionary [ i ] , dictionary [ i ] . Length , " " ) ; } } }

Index/key variables: ALPHABET_SIZE, i, index
Accumulator variables: i, result
Iterator variables: i
Boolean variables: isEndOfWord
Class/struct names: GFG, TrieNode
C# program:
using System ; class GFG { static double jaro_distance ( string s1 , string s2 ) { if ( s1 == s2 ) return 1.0 ; int len1 = s1 . Length ; int len2 = s2 . Length ; int max_dist = ( int ) ( Math . Floor ( ( double ) ( ( Math . Max ( len1 , len2 ) / 2 ) - 1 ) ) ) ; int match = 0 ; int [ ] hash_s1 = new int [ s1 . Length ] ; int [ ] hash_s2 = new int [ s2 . Length ] ; for ( int i = 0 ; i < len1 ; i ++ ) { for ( int j = Math . Max ( 0 , i - max_dist ) ; j < Math . Min ( len2 , i + max_dist + 1 ) ; j ++ ) if ( s1 [ i ] == s2 [ j ] && hash_s2 [ j ] == 0 ) { hash_s1 [ i ] = 1 ; hash_s2 [ j ] = 1 ; match ++ ; break ; } } if ( match == 0 ) return 0.0 ; double t = 0 ; int point = 0 ; for ( int i = 0 ; i < len1 ; i ++ ) if ( hash_s1 [ i ] == 1 ) { while ( hash_s2 [ point ] == 0 ) point ++ ; if ( s1 [ i ] != s2 [ point ++ ] ) t ++ ; } t /= 2 ; return ( ( ( double ) match ) / ( ( double ) len1 ) + ( ( double ) match ) / ( ( double ) len2 ) + ( ( double ) match - t ) / ( ( double ) match ) ) / 3.0 ; } public static void Main ( ) { string s1 = " CRATE " , s2 = " TRACE " ; Console . WriteLine ( jaro_distance ( s1 , s2 ) ) ; } }

Index/key variables: i, j, point
Accumulator variables: i, j, match, point, t
Iterator variables: i, j
Class/struct names: GFG
C# program:
using System ; using System . Collections . Generic ; class GFG { public class node { public char data ; public int cnt ; public node left , right ; } ; static node add ( char data ) { node newnode = new node ( ) ; newnode . data = data ; newnode . cnt = 1 ; newnode . left = newnode . right = null ; return newnode ; } static node addinlvlorder ( node root , char data ) { if ( root == null ) { return add ( data ) ; } List < node > Q = new List < node > ( ) ; Q . Add ( root ) ; while ( Q . Count != 0 ) { node temp = Q [ 0 ] ; Q . RemoveAt ( 0 ) ; if ( temp . data == data ) { temp . cnt ++ ; break ; } if ( temp . left == null ) { temp . left = add ( data ) ; break ; } else { if ( temp . left . data == data ) { temp . left . cnt ++ ; break ; } Q . Add ( temp . left ) ; } if ( temp . right == null ) { temp . right = add ( data ) ; break ; } else { if ( temp . right . data == data ) { temp . right . cnt ++ ; break ; } Q . Add ( temp . right ) ; } } return root ; } static void printlvlorder ( node root ) { List < node > Q = new List < node > ( ) ; Q . Add ( root ) ; while ( Q . Count != 0 ) { node temp = Q [ 0 ] ; if ( temp . cnt > 1 ) { Console . Write ( ( temp . data + " " + temp . cnt ) ) ; } else { Console . Write ( ( char ) temp . data ) ; } Q . RemoveAt ( 0 ) ; if ( temp . left != null ) { Q . Add ( temp . left ) ; } if ( temp . right != null ) { Q . Add ( temp . right ) ; } } } public static void Main ( String [ ] args ) { String s = " geeksforgeeks " ; node root = null ; for ( int i = 0 ; i < s . Length ; i ++ ) { root = addinlvlorder ( root , s [ i ] ) ; } printlvlorder ( root ) ; } }

Index/key variables: i
Accumulator variables: cnt, i
Iterator variables: i
Class/struct names: GFG, node
C# program:
using System ; class GFG { static String replaceRemove ( char [ ] s , char X , char Y , char Z ) { int start = 0 , end = s . Length - 1 ; while ( start <= end ) { if ( s [ start ] == Z ) { while ( end >= 0 && s [ end ] == Z ) { end -- ; } char temp ; if ( end > start ) { temp = s [ start ] ; s [ start ] = s [ end ] ; s [ end ] = temp ; if ( s [ start ] == X ) s [ start ] = Y ; start ++ ; } } else { if ( s [ start ] == X ) s [ start ] = Y ; start ++ ; } } String new_s = new String ( s ) ; while ( new_s . Length > 0 && new_s [ new_s . Length - 1 ] == Z ) { new_s = new_s . Substring ( 0 , new_s . Length - 1 ) ; } return new_s ; } public static void Main ( String [ ] args ) { String str = " batman " ; char X = ' a ' , Y = ' d ' , Z = ' b ' ; str = replaceRemove ( str . ToCharArray ( ) , X , Y , Z ) ; if ( str . Length == 0 ) { Console . WriteLine ( - 1 ) ; } else { Console . WriteLine ( str ) ; } } }

Index/key variables: end, start
Accumulator variables: end, start
Class/struct names: GFG
C# program:
using System ; class GFG { static string canMake ( string s ) { int o = 0 , z = 0 ; for ( int i = 0 ; i < s . Length ; i ++ ) { if ( s [ i ] - '0' == 1 ) o ++ ; else z ++ ; } if ( o % 2 == 1 && z % 2 == 1 ) return " NO " ; else return " YES " ; } public static void Main ( ) { string s = "01011" ; Console . WriteLine ( canMake ( s ) ) ; } }

Index/key variables: i
Accumulator variables: i, o, z
Iterator variables: i
Class/struct names: GFG
C# program:
using System ; class GFG { static int findMinSwaps ( string s , int k ) { int ans = 0 ; int c_one = 0 , c_zero = 0 ; for ( int i = s . Length - 1 ; i >= 0 ; i -- ) { if ( s [ i ] == '1' ) c_one ++ ; if ( s [ i ] == '0' ) { c_zero ++ ; ans += c_one ; } if ( c_zero == k ) break ; } if ( c_zero < k ) return - 1 ; return ans ; } public static void Main ( ) { string s = "100111" ; int k = 2 ; Console . WriteLine ( findMinSwaps ( s , k ) ) ; } }

Index/key variables: i
Accumulator variables: ans, c_one, c_zero, i
Iterator variables: i
Class/struct names: GFG
C# program:
using System ; using System . Collections . Generic ; class GFG { class Node { public char data ; public Node left , right ; public Node ( char _val ) { data = _val ; left = right = null ; } } ; static Node addinBT ( Node root , char data ) { if ( root == null ) { root = new Node ( data ) ; } else { List < Node > Q = new List < Node > ( ) ; Q . Add ( root ) ; while ( Q . Count != 0 ) { Node temp = Q [ 0 ] ; Q . RemoveAt ( 0 ) ; if ( temp . left == null ) { temp . left = new Node ( data ) ; break ; } else Q . Add ( temp . left ) ; if ( temp . right == null ) { temp . right = new Node ( data ) ; break ; } else Q . Add ( temp . right ) ; } } return root ; } static void print ( Node root ) { List < Node > Q = new List < Node > ( ) ; Q . Add ( root ) ; while ( Q . Count > 0 ) { Node temp = Q [ 0 ] ; Q . RemoveAt ( 0 ) ; Console . Write ( temp . data ) ; if ( temp . left != null ) Q . Add ( temp . left ) ; if ( temp . right != null ) Q . Add ( temp . right ) ; } } static bool checkvowel ( char ch ) { ch = char . ToLower ( ch ) ; if ( ch == ' a ' ch == ' e ' ch == ' i ' ch == ' o ' ch == ' u ' ) { return true ; } else { return false ; } } static Node removevowels ( Node root ) { List < Node > Q = new List < Node > ( ) ; Q . Add ( root ) ; Node root1 = null ; while ( Q . Count != 0 ) { Node temp = Q [ 0 ] ; Q . RemoveAt ( 0 ) ; if ( ! checkvowel ( temp . data ) ) { root1 = addinBT ( root1 , temp . data ) ; } if ( temp . left != null ) { Q . Add ( temp . left ) ; } if ( temp . right != null ) { Q . Add ( temp . right ) ; } } return root1 ; } public static void Main ( String [ ] args ) { String s = " geeks " ; Node root = null ; for ( int i = 0 ; i < s . Length ; i ++ ) { root = addinBT ( root , s [ i ] ) ; } root = removevowels ( root ) ; print ( root ) ; } }

Index/key variables: i
Accumulator variables: i
Iterator variables: i
Class/struct names: GFG, Node
C# program:
using System ; class GFG { static int countSubStr ( string str , int len ) { int ans = 0 ; for ( int i = 0 ; i < len ; i ++ ) { if ( str [ i ] == '0' ) ans += ( i + 1 ) ; } return ans ; } public static void Main ( ) { string str = "10010" ; int len = str . Length ; Console . WriteLine ( countSubStr ( str , len ) ) ; } }

Index/key variables: i
Accumulator variables: ans, i
Iterator variables: i
Class/struct names: GFG
C# program:
using System ; class GFG { static int INT_MAX = int . MaxValue ; static int findLength ( string s , int k ) { int ans = INT_MAX ; int l = 0 ; int r = 0 ; int cnt_zero = 0 , cnt_one = 0 ; while ( l < s . Length && r <= s . Length ) { if ( cnt_zero >= k && cnt_one >= 1 ) { ans = Math . Min ( ans , r - l ) ; l ++ ; if ( s [ l - 1 ] == '0' ) cnt_zero -- ; else cnt_one -- ; } else { if ( r == s . Length ) break ; if ( s [ r ] == '0' ) cnt_zero ++ ; else cnt_one ++ ; r ++ ; } } if ( ans == INT_MAX ) return - 1 ; return ans ; } public static void Main ( ) { string s = "100" ; int k = 2 ; Console . WriteLine ( findLength ( s , k ) ) ; } }

Index/key variables: r
Accumulator variables: cnt_one, cnt_zero, l, r
Class/struct names: GFG
C# program:
using System ; class GFG { static string largestSubStr ( string s ) { while ( s . Length != 0 && s [ s . Length - 1 ] == '1' ) s = s . Substring ( 0 , s . Length - 1 ) ; if ( s . Length == 0 ) return " - 1" ; else return s ; } public static void Main ( ) { string s = "11001" ; Console . WriteLine ( largestSubStr ( s ) ) ; } }

Class/struct names: GFG
C# program:
using System ; class GFG { static int MAX = 26 ; static bool areEqual ( int [ ] a , int [ ] b ) { for ( int i = 0 ; i < MAX ; i ++ ) if ( a [ i ] != b [ i ] ) return false ; return true ; } static bool xExistsInY ( String x , String y ) { if ( x . Length > y . Length ) return false ; int [ ] cnt_x = new int [ MAX ] ; int [ ] cnt = new int [ MAX ] ; for ( int i = 0 ; i < x . Length ; i ++ ) cnt_x [ x [ i ] - ' a ' ] ++ ; for ( int i = 0 ; i < x . Length ; i ++ ) cnt [ y [ i ] - ' a ' ] ++ ; if ( areEqual ( cnt_x , cnt ) ) return true ; for ( int i = 1 ; i < y . Length - x . Length + 1 ; i ++ ) { cnt [ y [ i - 1 ] - ' a ' ] -- ; cnt [ y [ i + x . Length - 1 ] - ' a ' ] ++ ; if ( areEqual ( cnt , cnt_x ) ) return true ; } return false ; } public static void Main ( String [ ] args ) { String x = " skege " ; String y = " geeksforgeeks " ; if ( xExistsInY ( x , y ) ) Console . Write ( " Yes " ) ; else Console . Write ( " No " ) ; } }

Index/key variables: MAX, i
Accumulator variables: i
Iterator variables: i
Class/struct names: GFG
C# program:
using System ; using System . Collections . Generic ; using System . Text ; class GFG { static void reverse ( char [ ] A , int l , int h ) { if ( l < h ) { char ch = A [ l ] ; A [ l ] = A [ h ] ; A [ h ] = ch ; reverse ( A , l + 1 , h - 1 ) ; } } static string reverseParentheses ( string str , int len ) { Stack < int > st = new Stack < int > ( ) ; for ( int i = 0 ; i < len ; i ++ ) { if ( str [ i ] == ' ( ' ) { st . Push ( i ) ; } else if ( str [ i ] == ' ) ' ) { char [ ] A = str . ToCharArray ( ) ; reverse ( A , st . Peek ( ) + 1 , i ) ; str = new string ( A ) ; st . Pop ( ) ; } } string res = " " ; for ( int i = 0 ; i < len ; i ++ ) { if ( str [ i ] != ' ) ' && str [ i ] != ' ( ' ) { res += str [ i ] ; } } return res ; } static public void Main ( ) { string str = " ( skeeg ( for ) skeeg ) " ; int len = str . Length ; Console . WriteLine ( reverseParentheses ( str , len ) ) ; } }

Index/key variables: h, i, l
Accumulator variables: i, res
Iterator variables: i
Class/struct names: GFG
C# program:
using System ; class GFG { static int MAX = 26 ; static void updateFreq ( String str , int [ ] freq ) { int len = str . Length ; for ( int i = 0 ; i < len ; i ++ ) { freq [ str [ i ] - ' a ' ] ++ ; } } static int maxCount ( String str , String patt ) { int [ ] strFreq = new int [ MAX ] ; updateFreq ( str , strFreq ) ; int [ ] pattFreq = new int [ MAX ] ; updateFreq ( patt , pattFreq ) ; int ans = int . MaxValue ; for ( int i = 0 ; i < MAX ; i ++ ) { if ( pattFreq [ i ] == 0 ) continue ; ans = Math . Min ( ans , strFreq [ i ] / pattFreq [ i ] ) ; } return ans ; } public static void Main ( String [ ] args ) { String str = " geeksforgeeks " ; String patt = " geeks " ; Console . Write ( maxCount ( str , patt ) ) ; } }

Index/key variables: MAX, i
Accumulator variables: i
Iterator variables: i
Class/struct names: GFG
C# program:
using System ; class GFG { static int TEN = 10 ; static int minNum ( char [ ] str , int len ) { int res = int . MaxValue ; for ( int i = 0 ; i < len ; i ++ ) { if ( str [ i ] == '4' str [ i ] == '8' ) { res = Math . Min ( res , str [ i ] - '0' ) ; } } for ( int i = 0 ; i < len - 1 ; i ++ ) { for ( int j = i + 1 ; j < len ; j ++ ) { int num = ( str [ i ] - '0' ) * TEN + ( str [ j ] - '0' ) ; if ( num % 4 == 0 ) { res = Math . Min ( res , num ) ; } } } return ( ( res == int . MaxValue ) ? - 1 : res ) ; } public static void Main ( String [ ] args ) { String str = "17" ; int len = str . Length ; Console . Write ( minNum ( str . ToCharArray ( ) , len ) ) ; } }

Index/key variables: i, j
Accumulator variables: i, j
Iterator variables: i, j
Class/struct names: GFG
C# program:
using System ; using System . Collections . Generic ; class GFG { static Boolean canBeEqual ( char [ ] a , char [ ] b , int n ) { List < char > A = new List < char > ( ) ; List < char > B = new List < char > ( ) ; for ( int i = 0 ; i < n ; i ++ ) { if ( a [ i ] != b [ i ] ) { A . Add ( a [ i ] ) ; B . Add ( b [ i ] ) ; } } if ( A . Count == B . Count && B . Count == 0 ) return true ; if ( A . Count == B . Count && B . Count == 2 ) { if ( A [ 0 ] == A [ 1 ] && B [ 0 ] == B [ 1 ] ) return true ; } return false ; } public static void Main ( String [ ] args ) { char [ ] A = " SEEKSFORGEEKS " . ToCharArray ( ) ; char [ ] B = " GEEKSFORGEEKG " . ToCharArray ( ) ; if ( canBeEqual ( A , B , A . Length ) ) 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 ; public class GFG { static void findMidAlphabet ( String s1 , String s2 , int n ) { for ( int i = 0 ; i < n ; i ++ ) { int mid = ( s1 [ i ] + s2 [ i ] ) / 2 ; Console . Write ( ( char ) mid ) ; } } public static void Main ( String [ ] args ) { String s1 = " akzbqzgw " ; String s2 = " efhctcsz " ; int n = s1 . Length ; findMidAlphabet ( s1 , s2 , n ) ; } }

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 readonly int N = 2 ; static Boolean isVowel ( char ch ) { return ( ch == ' a ' ch == ' e ' ch == ' i ' ch == ' o ' ch == ' u ' ) ; } static void performQueries ( String str , int len , int [ , ] queries , int q ) { int [ ] pre = new int [ len ] ; if ( isVowel ( str [ 0 ] ) ) pre [ 0 ] = 1 ; else pre [ 0 ] = 0 ; for ( int i = 1 ; i < len ; i ++ ) { if ( isVowel ( str [ i ] ) ) pre [ i ] = 1 + pre [ i - 1 ] ; else pre [ i ] = pre [ i - 1 ] ; } for ( int i = 0 ; i < q ; i ++ ) { if ( queries [ i , 0 ] == 0 ) { Console . WriteLine ( pre [ queries [ i , 1 ] ] ) ; } else { Console . WriteLine ( ( pre [ queries [ i , 1 ] ] - pre [ queries [ i , 0 ] - 1 ] ) ) ; } } } public static void Main ( String [ ] args ) { String str = " geeksforgeeks " ; int len = str . Length ; int [ , ] queries = { { 1 , 3 } , { 2 , 4 } , { 1 , 9 } } ; int q = queries . GetLength ( 0 ) ; performQueries ( str , len , queries , q ) ; } }

Index/key variables: i, len
Accumulator variables: i
Iterator variables: i
Class/struct names: GFG
C# program:
using System ; class GFG { static int sumDigits ( int n ) { int sum = 0 ; while ( n > 0 ) { int digit = n % 10 ; sum += digit ; n /= 10 ; } return sum ; } static bool isDivBySix ( String str , int n ) { int sum = 0 ; for ( int i = 0 ; i < n ; i ++ ) { sum += ( int ) ( str [ i ] - ' a ' + 1 ) ; } if ( sum % 3 != 0 ) return false ; int lastDigit = ( ( int ) ( str [ n - 1 ] - ' a ' + 1 ) ) % 10 ; if ( lastDigit % 2 != 0 ) return false ; return true ; } public static void Main ( String [ ] args ) { String str = " ab " ; int n = str . Length ; if ( isDivBySix ( str , n ) ) Console . WriteLine ( " Yes " ) ; else Console . WriteLine ( " No " ) ; } }

Index/key variables: i
Accumulator variables: i, n, sum
Iterator variables: i
Class/struct names: GFG
C# program:
using System ; using System . Collections . Generic ; class GFG { static char [ ] CHARS = "0123456789ABCDEF " . ToCharArray ( ) ; static int DIGITS = 16 ; static bool isDivisible ( String s , int m ) { Dictionary < char , int > mp = new Dictionary < char , int > ( ) ; for ( int i = 0 ; i < DIGITS ; i ++ ) { if ( mp . ContainsKey ( CHARS [ i ] ) ) mp [ CHARS [ i ] ] = i ; else mp . Add ( CHARS [ i ] , i ) ; } int r = 0 ; for ( int i = 0 ; i < s . Length ; i ++ ) { r = ( r * 16 + mp [ s [ i ] ] ) % m ; } if ( r == 0 ) return true ; return false ; } public static void Main ( String [ ] args ) { String s = "10" ; int m = 3 ; if ( isDivisible ( s , m ) ) 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 cntSplits ( String s ) { if ( s [ s . Length - 1 ] == '1' ) return - 1 ; int ans = 0 ; for ( int i = 0 ; i < s . Length ; i ++ ) ans += ( s [ i ] == '0' ) ? 1 : 0 ; return ans ; } public static void Main ( String [ ] args ) { String s = "10010" ; Console . WriteLine ( cntSplits ( 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 String CHARS = " qwertyuiopasdfghjklzxcvbnm " ; static int MAX = 26 ; static String getString ( char [ ] str , int n ) { Dictionary < char , char > uMap = new Dictionary < char , char > ( ) ; for ( int i = 0 ; i < MAX ; i ++ ) { if ( ! uMap . ContainsKey ( CHARS [ i ] ) ) uMap . Add ( CHARS [ i ] , CHARS [ ( i + 1 ) % MAX ] ) ; else uMap [ CHARS [ i ] ] = CHARS [ ( i + 1 ) % MAX ] ; } for ( int i = 0 ; i < n ; i ++ ) { str [ i ] = uMap [ str [ i ] ] ; } return String . Join ( " " , str ) ; } public static void Main ( String [ ] args ) { String str = " geeks " ; int n = str . Length ; Console . WriteLine ( getString ( str . ToCharArray ( ) , n ) ) ; } }

Index/key variables: i
Accumulator variables: i
Iterator variables: i
Class/struct names: GFG
C# program:
using System ; using System . Collections . Generic ; class GFG { public class Item { public int min , max ; public int total , sum ; public Item ( int price ) { min = price ; max = price ; total = 1 ; this . sum = price ; } } static void findPrices ( String [ ] item , int [ ] price , int n ) { Dictionary < String , Item > map = new Dictionary < String , Item > ( ) ; for ( int i = 0 ; i < n ; i ++ ) { if ( map . ContainsKey ( item [ i ] ) ) { Item currItem = map [ item [ i ] ] ; currItem . min = Math . Min ( currItem . min , price [ i ] ) ; currItem . max = Math . Max ( currItem . max , price [ i ] ) ; currItem . total ++ ; currItem . sum += price [ i ] ; } else { Item currItem = new Item ( price [ i ] ) ; map . Add ( item [ i ] , currItem ) ; } } Console . WriteLine ( " Item ▁ Min ▁ Max ▁ Average " ) ; foreach ( KeyValuePair < String , Item > ob in map ) { String key = ob . Key ; Item currItem = ob . Value ; Console . WriteLine ( key + " ▁ " + currItem . min + " ▁ " + currItem . max + " ▁ " + ( ( float ) currItem . sum / ( float ) currItem . total ) ) ; } } public static void Main ( String [ ] args ) { String [ ] item = { " toy " , " pen " , " notebook " , " pen " } ; int n = item . Length ; int [ ] price = { 2 , 1 , 3 , 2 } ; findPrices ( item , price , n ) ; } }

Index/key variables: i
Accumulator variables: i, sum, total
Iterator variables: i, ob
Class/struct names: GFG, Item
C# program:
using System ; class GFG { static int Count ( String s , int pos ) { int c = s [ pos - 1 ] ; int counter = 0 ; for ( int i = 0 ; i < pos - 1 ; i ++ ) { if ( s [ i ] == c ) counter = counter + 1 ; } return counter ; } public static void Main ( String [ ] args ) { String s = " abacsddaa " ; int pos ; int n = s . Length ; int [ ] query = { 9 , 3 , 2 } ; int Q = query . Length ; for ( int i = 0 ; i < Q ; i ++ ) { pos = query [ i ] ; Console . WriteLine ( Count ( s , pos ) ) ; } } }

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