dhyuti-n/xlcost-variable-roles huggingface dataset:
C# program:
using System ; class GFG { public static double PI = 3.14159265 ; static float areacircumscribed ( float a ) { return ( a * a * ( float ) ( PI / 2 ) ) ; } public static void Main ( ) { float a = 6 ; Console . Write ( " ▁ Area ▁ of ▁ an ▁ circumscribed " + " ▁ circle ▁ is ▁ : ▁ { 0 } " , Math . Round ( areacircumscribed ( a ) , 2 ) ) ; } }

Class/struct names: GFG
C# program:
using System ; class GFG { static int itemType ( int n ) { int count = 0 ; int day = 1 ; while ( count + day * ( day + 1 ) / 2 < n ) { count += day * ( day + 1 ) / 2 ; day ++ ; } for ( int type = day ; type > 0 ; type -- ) { count += type ; if ( count >= n ) { return type ; } } return 0 ; } public static void Main ( String [ ] args ) { int N = 10 ; Console . Write ( itemType ( N ) ) ; } }

Accumulator variables: count, day, type
Iterator variables: type
Class/struct names: GFG
C# program:
using System ; class GFG { public class Node { public int data ; public Node next ; } ; static bool isSortedDesc ( Node head ) { if ( head == null ) return true ; if ( head == null ) return true ; for ( Node t = head ; t . next != null ; t = t . next ) if ( t . data <= t . next . data ) return false ; return true ; } static Node newNode ( int data ) { Node temp = new Node ( ) ; temp . next = null ; temp . data = data ; return temp ; } public static void Main ( String [ ] args ) { Node head = newNode ( 7 ) ; head . next = newNode ( 5 ) ; head . next . next = newNode ( 4 ) ; head . next . next . next = newNode ( 3 ) ; if ( isSortedDesc ( head ) ) Console . WriteLine ( " Yes " ) ; else Console . WriteLine ( " No " ) ; } }

Iterator variables: t
Class/struct names: GFG, Node
C# program:
using System ; public class GFG { static int maxLength ( String str , int n , char c , int k ) { int ans = - 1 ; int cnt = 0 ; int left = 0 ; for ( int right = 0 ; right < n ; right ++ ) { if ( str [ right ] == c ) { cnt ++ ; } while ( cnt > k ) { if ( str [ left ] == c ) { cnt -- ; } left ++ ; } ans = Math . Max ( ans , right - left + 1 ) ; } return ans ; } static int maxConsecutiveSegment ( String S , int K ) { int N = S . Length ; return Math . Max ( maxLength ( S , N , '0' , K ) , maxLength ( S , N , '1' , K ) ) ; } public static void Main ( ) { String S = "1001" ; int K = 1 ; Console . WriteLine ( maxConsecutiveSegment ( S , K ) ) ; } }

Index/key variables: left, right
Accumulator variables: cnt, left, right
Iterator variables: right
Class/struct names: GFG
C# program:
using System ; public class GFG { static void find ( int N ) { int T , F , O ; F = ( int ) ( ( N - 4 ) / 5 ) ; if ( ( ( N - 5 * F ) % 2 ) == 0 ) { O = 2 ; } else { O = 1 ; } T = ( int ) Math . Floor ( ( double ) ( N - 5 * F - O ) / 2 ) ; Console . WriteLine ( " Count ▁ of ▁ 5 ▁ valueds ▁ coins : ▁ " + F ) ; Console . WriteLine ( " Count ▁ of ▁ 2 ▁ valueds ▁ coins : ▁ " + T ) ; Console . WriteLine ( " Count ▁ of ▁ 1 ▁ valueds ▁ coins : ▁ " + O ) ; } public static void Main ( String [ ] args ) { int N = 8 ; find ( N ) ; } }

Class/struct names: GFG
C# program:
using System ; class GFG { static void findMaxOccurence ( char [ ] str , int N ) { for ( int i = 0 ; i < N ; i ++ ) { if ( str [ i ] == ' ? ' ) { str [ i ] = '0' ; } } Console . Write ( str ) ; } public static void Main ( String [ ] args ) { String str = "10?0?11" ; int N = str . Length ; findMaxOccurence ( str . ToCharArray ( ) , N ) ; } }

Index/key variables: i
Accumulator variables: i
Iterator variables: i
Class/struct names: GFG
C# program:
using System ; class GFG { public static void checkInfinite ( String s ) { bool flag = true ; int N = s . Length ; for ( int i = 0 ; i < N - 1 ; i ++ ) { if ( s [ i ] == ( char ) ( ( int ) ( s [ i + 1 ] ) + 1 ) ) { continue ; } else if ( s [ i ] == ' a ' && s [ i + 1 ] == ' z ' ) { continue ; } else { flag = false ; break ; } } if ( ! flag ) Console . Write ( " NO " ) ; else Console . Write ( " YES " ) ; } public static void Main ( String [ ] args ) { String s = " ecbaz " ; checkInfinite ( s ) ; } }

Index/key variables: i
Accumulator variables: i
Iterator variables: i
Boolean variables: flag
Class/struct names: GFG
C# program:
using System ; public class GFG { static int minChangeInLane ( int [ ] barrier , int n ) { int [ ] dp = { 1 , 0 , 1 } ; for ( int j = 0 ; j < n ; j ++ ) { int val = barrier [ j ] ; if ( val > 0 ) { dp [ val - 1 ] = ( int ) 1e6 ; } for ( int i = 0 ; i < 3 ; i ++ ) { if ( val != i + 1 ) { dp [ i ] = Math . Min ( dp [ i ] , Math . Min ( dp [ ( i + 1 ) % 3 ] , dp [ ( i + 2 ) % 3 ] ) + 1 ) ; } } } return Math . Min ( dp [ 0 ] , Math . Min ( dp [ 1 ] , dp [ 2 ] ) ) ; } static public void Main ( ) { int [ ] barrier = { 0 , 1 , 2 , 3 , 0 } ; int N = barrier . Length ; Console . Write ( minChangeInLane ( barrier , N ) ) ; } }

Index/key variables: i, j
Accumulator variables: i, j
Iterator variables: i, j
Class/struct names: GFG
C# program:
using System ; class GFG { public static void numWays ( int [ , ] ratings , int [ , ] queries , int n , int k ) { int [ , ] dp = new int [ n , 10000 + 2 ] ; for ( int i = 0 ; i < k ; i ++ ) dp [ 0 , ratings [ 0 , i ] ] += 1 ; for ( int i = 1 ; i < n ; i ++ ) { for ( int sum = 0 ; sum <= 10000 ; sum ++ ) { for ( int j = 0 ; j < k ; j ++ ) { if ( sum >= ratings [ i , j ] ) dp [ i , sum ] += dp [ i - 1 , sum - ratings [ i , j ] ] ; } } } for ( int sum = 1 ; sum <= 10000 ; sum ++ ) { dp [ n - 1 , sum ] += dp [ n - 1 , sum - 1 ] ; } for ( int q = 0 ; q < queries . GetLength ( 0 ) ; q ++ ) { int a = queries [ q , 0 ] ; int b = queries [ q , 1 ] ; Console . Write ( dp [ n - 1 , b ] - dp [ n - 1 , a - 1 ] + " ▁ " ) ; } } public static void Main ( String [ ] args ) { int N = 2 , K = 3 ; int [ , ] ratings = { { 1 , 2 , 3 } , { 4 , 5 , 6 } } ; int [ , ] queries = { { 6 , 6 } , { 1 , 6 } } ; numWays ( ratings , queries , N , K ) ; } }

Accumulator variables: i, j, q, sum
Iterator variables: i, j, q, sum
Class/struct names: GFG
C# program:
using System ; class GFG { static void numberOfPermWithKInversion ( int N , int K ) { int [ , ] dp = new int [ 2 , K + 1 ] ; int mod = 1000000007 ; for ( int i = 1 ; i <= N ; i ++ ) { for ( int j = 0 ; j <= K ; j ++ ) { if ( i == 1 ) { dp [ i % 2 , j ] = ( j == 0 ) ? 1 : 0 ; } else if ( j == 0 ) dp [ i % 2 , j ] = 1 ; else dp [ i % 2 , j ] = ( dp [ i % 2 , j - 1 ] % mod + ( dp [ 1 - i % 2 , j ] - ( ( Math . Max ( j - ( i - 1 ) , 0 ) == 0 ) ? 0 : dp [ 1 - i % 2 , Math . Max ( j - ( i - 1 ) , 0 ) - 1 ] ) + mod ) % mod ) % mod ; } } Console . WriteLine ( dp [ N % 2 , K ] ) ; } public static void Main ( ) { int N = 3 , K = 2 ; numberOfPermWithKInversion ( N , K ) ; } }

Accumulator variables: i, j
Iterator variables: i, j
Class/struct names: GFG
C# program:
using System ; class GFG { static readonly int N = 100 ; static int n , m ; static int [ , ] a = new int [ N , N ] ; static int [ , ] dp = new int [ N , N ] ; static int [ , ] visited = new int [ N , N ] ; static int current_sum = 0 ; static int total_sum = 0 ; static void inputMatrix ( ) { n = 3 ; m = 3 ; a [ 0 , 0 ] = 500 ; a [ 0 , 1 ] = 100 ; a [ 0 , 2 ] = 230 ; a [ 1 , 0 ] = 1000 ; a [ 1 , 1 ] = 300 ; a [ 1 , 2 ] = 100 ; a [ 2 , 0 ] = 200 ; a [ 2 , 1 ] = 1000 ; a [ 2 , 2 ] = 200 ; } static int maximum_sum_path ( int i , int j ) { if ( i == n - 1 && j == m - 1 ) return a [ i , j ] ; if ( visited [ i , j ] != 0 ) return dp [ i , j ] ; visited [ i , j ] = 1 ; int total_sum = 0 ; if ( i < n - 1 & j < m - 1 ) { int current_sum = Math . Max ( maximum_sum_path ( i , j + 1 ) , Math . Max ( maximum_sum_path ( i + 1 , j + 1 ) , maximum_sum_path ( i + 1 , j ) ) ) ; total_sum = a [ i , j ] + current_sum ; } else if ( i == n - 1 ) total_sum = a [ i , j ] + maximum_sum_path ( i , j + 1 ) ; else total_sum = a [ i , j ] + maximum_sum_path ( i + 1 , j ) ; dp [ i , j ] = total_sum ; return total_sum ; } public static void Main ( String [ ] args ) { inputMatrix ( ) ; int maximum_sum = maximum_sum_path ( 0 , 0 ) ; Console . WriteLine ( maximum_sum ) ; } }

Class/struct names: GFG
C# program:
using System ; class GFG { static int MaxProfit ( int [ ] treasure , int [ ] color , int n , int k , int col , int A , int B ) { int sum = 0 ; if ( k == n ) return 0 ; if ( col == color [ k ] ) sum += Math . Max ( A * treasure [ k ] + MaxProfit ( treasure , color , n , k + 1 , color [ k ] , A , B ) , MaxProfit ( treasure , color , n , k + 1 , col , A , B ) ) ; else sum += Math . Max ( B * treasure [ k ] + MaxProfit ( treasure , color , n , k + 1 , color [ k ] , A , B ) , MaxProfit ( treasure , color , n , k + 1 , col , A , B ) ) ; return sum ; } public static void Main ( String [ ] args ) { int A = - 5 , B = 7 ; int [ ] treasure = { 4 , 8 , 2 , 9 } ; int [ ] color = { 2 , 2 , 6 , 2 } ; int n = color . Length ; Console . Write ( MaxProfit ( treasure , color , n , 0 , 0 , A , B ) ) ; } }

Index/key variables: k
Accumulator variables: sum
Class/struct names: GFG
C# program:
class GFG { static int printTetraRec ( int n ) { if ( n == 0 ) return 0 ; if ( n == 1 n == 2 ) return 1 ; if ( n == 3 ) return 2 ; else return printTetraRec ( n - 1 ) + printTetraRec ( n - 2 ) + printTetraRec ( n - 3 ) + printTetraRec ( n - 4 ) ; } static void printTetra ( int n ) { System . Console . WriteLine ( printTetraRec ( n ) + " ▁ " ) ; } static void Main ( ) { int n = 10 ; printTetra ( n ) ; } }

Class/struct names: GFG
C# program:
using System ; class GFG { static int sum = 0 ; static void Combination ( int [ ] a , int [ ] combi , int n , int r , int depth , int index ) { if ( index == r ) { int product = 1 ; for ( int i = 0 ; i < r ; i ++ ) product = product * combi [ i ] ; sum += product ; return ; } for ( int i = depth ; i < n ; i ++ ) { combi [ index ] = a [ i ] ; Combination ( a , combi , n , r , i + 1 , index + 1 ) ; } } static void allCombination ( int [ ] a , int n ) { for ( int i = 1 ; i <= n ; i ++ ) { int [ ] combi = new int [ i ] ; Combination ( a , combi , n , i , 0 , 0 ) ; Console . Write ( " f ( " + i + " ) ▁ - - > ▁ " + sum + " STRNEWLINE " ) ; sum = 0 ; } } static void Main ( ) { int n = 5 ; int [ ] a = new int [ n ] ; for ( int i = 0 ; i < n ; i ++ ) a [ i ] = i + 1 ; allCombination ( a , n ) ; } }

Index/key variables: i, index, n
Accumulator variables: i, sum
Iterator variables: i
Class/struct names: GFG
C# program:
using System ; class GFG { static int max ( int x , int y ) { return ( x > y ? x : y ) ; } static int maxTasks ( int [ ] high , int [ ] low , int n ) { int [ ] task_dp = new int [ n + 1 ] ; task_dp [ 0 ] = 0 ; task_dp [ 1 ] = high [ 0 ] ; for ( int i = 2 ; i <= n ; i ++ ) task_dp [ i ] = max ( high [ i - 1 ] + task_dp [ i - 2 ] , low [ i - 1 ] + task_dp [ i - 1 ] ) ; return task_dp [ n ] ; } static void Main ( ) { int n = 5 ; int [ ] high = { 3 , 6 , 8 , 7 , 6 } ; int [ ] low = { 1 , 5 , 4 , 5 , 3 } ; Console . WriteLine ( maxTasks ( high , low , n ) ) ; } }

Index/key variables: i, n
Accumulator variables: i
Iterator variables: i
Class/struct names: GFG
C# program:
using System ; class GFG { static int PermutationCoeff ( int n , int k ) { int Fn = 1 , Fk = 1 ; for ( int i = 1 ; i <= n ; i ++ ) { Fn *= i ; if ( i == n - k ) Fk = Fn ; } int coeff = Fn / Fk ; return coeff ; } public static void Main ( ) { int n = 10 , k = 2 ; Console . WriteLine ( " Value ▁ of ▁ P ( ▁ " + n + " , " + k + " ) ▁ is ▁ " + PermutationCoeff ( n , k ) ) ; } }

Accumulator variables: Fn, i
Iterator variables: i
Class/struct names: GFG
C# program:
using System ; class GFG { static bool findPartition ( int [ ] arr , int n ) { int sum = 0 ; int i , j ; for ( i = 0 ; i < n ; i ++ ) sum += arr [ i ] ; if ( sum % 2 != 0 ) return false ; bool [ , ] part = new bool [ sum / 2 + 1 , n + 1 ] ; for ( i = 0 ; i <= n ; i ++ ) part [ 0 , i ] = true ; for ( i = 1 ; i <= sum / 2 ; i ++ ) part [ i , 0 ] = false ; for ( i = 1 ; i <= sum / 2 ; i ++ ) { for ( j = 1 ; j <= n ; j ++ ) { part [ i , j ] = part [ i , j - 1 ] ; if ( i >= arr [ j - 1 ] ) part [ i , j ] = part [ i , j - 1 ] || part [ i - arr [ j - 1 ] , j - 1 ] ; } } return part [ sum / 2 , n ] ; } public static void Main ( ) { int [ ] arr = { 3 , 1 , 1 , 2 , 2 , 1 } ; int n = arr . Length ; if ( findPartition ( arr , n ) == true ) Console . Write ( " Can ▁ be ▁ divided " + " ▁ into ▁ two ▁ subsets ▁ of " + " ▁ equal ▁ sum " ) ; else Console . Write ( " Can ▁ not ▁ be ▁ " + " divided ▁ into ▁ two ▁ subsets " + " ▁ of ▁ equal ▁ sum " ) ; } }

Index/key variables: i
Accumulator variables: i, j, sum
Iterator variables: i, j
Class/struct names: GFG
C# program:
using System ; class GFG { static void minimumOperations ( string orig_str , int m , int n ) { string orig = orig_str ; int turn = 1 ; int j = 1 ; for ( int i = 0 ; i < orig_str . Length ; i ++ ) { string m_cut = orig_str . Substring ( orig_str . Length - m ) ; orig_str = orig_str . Substring ( 0 , orig_str . Length - m ) ; orig_str = m_cut + orig_str ; j = j + 1 ; if ( ! orig . Equals ( orig_str ) ) { turn = turn + 1 ; String n_cut = orig_str . Substring ( orig_str . Length - n ) ; orig_str = orig_str . Substring ( 0 , orig_str . Length - n ) ; orig_str = n_cut + orig_str ; j = j + 1 ; } if ( orig . Equals ( orig_str ) ) { break ; } turn = turn + 1 ; } Console . WriteLine ( turn ) ; } public static void Main ( ) { string S = " GeeksforGeeks " ; int X = 5 , Y = 3 ; minimumOperations ( S , X , Y ) ; } }

Accumulator variables: i
Iterator variables: i
Class/struct names: GFG
C# program:
using System ; class GFG { static int KMPSearch ( char [ ] pat , char [ ] txt ) { int M = pat . Length ; int N = txt . Length ; int [ ] lps = new int [ M ] ; computeLPSArray ( pat , M , lps ) ; int i = 0 ; int j = 0 ; while ( i < N ) { if ( pat [ j ] == txt [ i ] ) { j ++ ; i ++ ; } if ( j == M ) { return i - j ; } else if ( i < N && pat [ j ] != txt [ i ] ) { if ( j != 0 ) j = lps [ j - 1 ] ; else i = i + 1 ; } } return 0 ; } static void computeLPSArray ( char [ ] pat , int M , int [ ] lps ) { int len = 0 ; lps [ 0 ] = 0 ; int i = 1 ; while ( i < M ) { if ( pat [ i ] == pat [ len ] ) { len ++ ; lps [ i ] = len ; i ++ ; } else { if ( len != 0 ) { len = lps [ len - 1 ] ; } else { lps [ i ] = 0 ; i ++ ; } } } } static int countRotations ( string s ) { string s1 = s . Substring ( 1 , s . Length - 1 ) + s ; char [ ] pat = s . ToCharArray ( ) ; char [ ] text = s1 . ToCharArray ( ) ; return 1 + KMPSearch ( pat , text ) ; } public static void Main ( params string [ ] args ) { string s1 = " geeks " ; Console . Write ( countRotations ( s1 ) ) ; } }

Index/key variables: M, i, j, len
Accumulator variables: i, j, len
Class/struct names: GFG
C# program:
using System ; class GFG { static int dfa = 0 ; static void start ( char c ) { if ( c == ' t ' c == ' T ' ) dfa = 1 ; } static void state1 ( char c ) { if ( c == ' t ' c == ' T ' ) dfa = 1 ; else if ( c == ' h ' c == ' H ' ) dfa = 2 ; else dfa = 0 ; } static void state2 ( char c ) { if ( c == ' e ' c == ' E ' ) dfa = 3 ; else dfa = 0 ; } static void state3 ( char c ) { if ( c == ' t ' c == ' T ' ) dfa = 1 ; else dfa = 0 ; } static bool isAccepted ( char [ ] str ) { int len = str . Length ; for ( int i = 0 ; i < len ; i ++ ) { if ( dfa == 0 ) start ( str [ i ] ) ; else if ( dfa == 1 ) state1 ( str [ i ] ) ; else if ( dfa == 2 ) state2 ( str [ i ] ) ; else state3 ( str [ i ] ) ; } return ( dfa != 3 ) ; } static public void Main ( ) { char [ ] str = " forTHEgeeks " . ToCharArray ( ) ; if ( isAccepted ( str ) == true ) Console . WriteLine ( " ACCEPTED STRNEWLINE " ) ; else Console . WriteLine ( " NOT ▁ ACCEPTED STRNEWLINE " ) ; } }

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 [ ] parent = new int [ 26 ] ; static int find ( int x ) { if ( x != parent [ x ] ) return parent [ x ] = find ( parent [ x ] ) ; return x ; } static void join ( int x , int y ) { int px = find ( x ) ; int pz = find ( y ) ; if ( px != pz ) { parent [ pz ] = px ; } } static bool convertible ( String s1 , String s2 ) { Dictionary < int , int > mp = new Dictionary < int , int > ( ) ; for ( int i = 0 ; i < s1 . Length ; i ++ ) { if ( ! mp . ContainsKey ( s1 [ i ] - ' a ' ) ) { mp . Add ( s1 [ i ] - ' a ' , s2 [ i ] - ' a ' ) ; } else { if ( mp [ s1 [ i ] - ' a ' ] != s2 [ i ] - ' a ' ) return false ; } } foreach ( KeyValuePair < int , int > it in mp ) { if ( it . Key == it . Value ) continue ; else { if ( find ( it . Key ) == find ( it . Value ) ) return false ; else join ( it . Key , it . Value ) ; } } return true ; } static void initialize ( ) { for ( int i = 0 ; i < 26 ; i ++ ) { parent [ i ] = i ; } } public static void Main ( String [ ] args ) { String s1 , s2 ; s1 = " abbcaa " ; s2 = " bccdbb " ; initialize ( ) ; if ( convertible ( s1 , s2 ) ) Console . Write ( " Yes " + " STRNEWLINE " ) ; else Console . Write ( " No " + " STRNEWLINE " ) ; } }

Index/key variables: i, pz, x
Accumulator variables: i
Iterator variables: i, it
Class/struct names: GFG
C# program:
using System ; class GFG { static int SIZE = 26 ; static void SieveOfEratosthenes ( bool [ ] prime , int p_size ) { prime [ 0 ] = false ; prime [ 1 ] = false ; for ( int p = 2 ; p * p <= p_size ; p ++ ) { if ( prime [ p ] ) { for ( int i = p * 2 ; i < p_size ; i += p ) prime [ i ] = false ; } } } static void printChar ( string str , int n ) { bool [ ] prime = new bool [ n + 1 ] ; for ( int i = 0 ; i < n + 1 ; i ++ ) prime [ i ] = true ; SieveOfEratosthenes ( prime , str . Length + 1 ) ; int [ ] freq = new int [ SIZE ] ; for ( int i = 0 ; i < SIZE ; i ++ ) freq [ i ] = 0 ; for ( int i = 0 ; i < n ; i ++ ) freq [ str [ i ] - ' a ' ] ++ ; for ( int i = 0 ; i < n ; i ++ ) { if ( prime [ freq [ str [ i ] - ' a ' ] ] ) { Console . Write ( str [ i ] ) ; } } } public static void Main ( String [ ] args ) { String str = " geeksforgeeks " ; int n = str . Length ; printChar ( str , n ) ; } }

Index/key variables: SIZE, i, p
Accumulator variables: i, p
Iterator variables: i, p
Class/struct names: GFG
C# program:
using System ; using System . Collections . Generic ; class GFG { static bool prime ( int n ) { if ( n <= 1 ) return false ; int max_div = ( int ) Math . Floor ( Math . Sqrt ( n ) ) ; for ( int i = 2 ; i < 1 + max_div ; i ++ ) { if ( n % i == 0 ) return false ; } return true ; } static void checkString ( string s ) { Dictionary < char , int > freq = new Dictionary < char , int > ( ) ; for ( int i = 0 ; i < s . Length ; i ++ ) { if ( ! freq . ContainsKey ( s [ i ] ) ) freq [ s [ i ] ] = 0 ; freq [ s [ i ] ] += 1 ; } for ( int i = 0 ; i < s . Length ; i ++ ) { if ( prime ( freq [ s [ i ] ] ) ) Console . Write ( s [ i ] ) ; } } public static void Main ( ) { string s = " geeksforgeeks " ; checkString ( 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 SIZE = 26 ; static void printChar ( String str , int n ) { int [ ] freq = new int [ SIZE ] ; for ( int i = 0 ; i < n ; i ++ ) freq [ str [ i ] - ' a ' ] ++ ; for ( int i = 0 ; i < n ; i ++ ) { if ( freq [ str [ i ] - ' a ' ] % 2 == 0 ) { Console . Write ( str [ i ] ) ; } } } public static void Main ( String [ ] args ) { String str = " geeksforgeeks " ; int n = str . Length ; printChar ( str , n ) ; } }

Index/key variables: SIZE, i
Accumulator variables: i
Iterator variables: i
Class/struct names: GFG
C# program:
using System ; class GFG { static bool CompareAlphanumeric ( char [ ] str1 , char [ ] str2 ) { int i , j ; i = 0 ; j = 0 ; int len1 = str1 . Length ; int len2 = str2 . Length ; while ( i <= len1 && j <= len2 ) { while ( i < len1 && ( ! ( ( str1 [ i ] >= ' a ' && str1 [ i ] <= ' z ' ) || ( str1 [ i ] >= ' A ' && str1 [ i ] <= ' Z ' ) || ( str1 [ i ] >= '0' && str1 [ i ] <= '9' ) ) ) ) { i ++ ; } while ( j < len2 && ( ! ( ( str2 [ j ] >= ' a ' && str2 [ j ] <= ' z ' ) || ( str2 [ j ] >= ' A ' && str2 [ j ] <= ' Z ' ) || ( str2 [ j ] >= '0' && str2 [ j ] <= '9' ) ) ) ) { j ++ ; } if ( i == len1 && j == len2 ) { return true ; } else if ( str1 [ i ] != str2 [ j ] ) { return false ; } else { i ++ ; j ++ ; } } return false ; } static void CompareAlphanumericUtil ( string str1 , string str2 ) { bool res ; res = CompareAlphanumeric ( str1 . ToCharArray ( ) , str2 . ToCharArray ( ) ) ; if ( res == true ) { Console . WriteLine ( " Equal " ) ; } else { Console . WriteLine ( " Unequal " ) ; } } public static void Main ( ) { string str1 , str2 ; str1 = " Ram , ▁ Shyam " ; str2 = " ▁ Ram ▁ - ▁ Shyam . " ; CompareAlphanumericUtil ( str1 , str2 ) ; str1 = " abc123" ; str2 = "123abc " ; CompareAlphanumericUtil ( str1 , str2 ) ; } }

Index/key variables: i, j
Accumulator variables: i, j
Class/struct names: GFG
C# program:
using System ; class GFG { static void solveQueries ( String str , int [ , ] query ) { int len = str . Length ; int Q = query . GetLength ( 0 ) ; int [ , ] pre = new int [ len , 26 ] ; for ( int i = 0 ; i < len ; i ++ ) { pre [ i , str [ i ] - ' a ' ] ++ ; if ( i > 0 ) { for ( int j = 0 ; j < 26 ; j ++ ) pre [ i , j ] += pre [ i - 1 , j ] ; } } for ( int i = 0 ; i < Q ; i ++ ) { int l = query [ i , 0 ] ; int r = query [ i , 1 ] ; int maxi = 0 ; char c = ' a ' ; for ( int j = 0 ; j < 26 ; j ++ ) { int times = pre [ r , j ] ; if ( l > 0 ) times -= pre [ l - 1 , j ] ; if ( times > maxi ) { maxi = times ; c = ( char ) ( ' a ' + j ) ; } } Console . WriteLine ( " Query " + ( i + 1 ) + " : ▁ " + c ) ; } } public static void Main ( String [ ] args ) { String str = " striver " ; int [ , ] query = { { 0 , 1 } , { 1 , 6 } , { 5 , 6 } } ; solveQueries ( str , query ) ; } }

Index/key variables: i
Accumulator variables: i, j, times
Iterator variables: i, j
Class/struct names: GFG
C# program:
using System ; class GFG { static Boolean startsWith ( String str , String pre ) { int strLen = str . Length ; int preLen = pre . Length ; int i = 0 , j = 0 ; while ( i < strLen && j < preLen ) { if ( str [ i ] != pre [ j ] ) return false ; i ++ ; j ++ ; } return true ; } static Boolean endsWith ( String str , String suff ) { int i = str . Length - 1 ; int j = suff . Length - 1 ; while ( i >= 0 && j >= 0 ) { if ( str [ i ] != suff [ j ] ) return false ; i -- ; j -- ; } return true ; } static Boolean checkString ( String str , String a , String b ) { if ( str . Length != a . Length + b . Length ) return false ; if ( startsWith ( str , a ) ) { if ( endsWith ( str , b ) ) return true ; } if ( startsWith ( str , b ) ) { if ( endsWith ( str , a ) ) return true ; } return false ; } public static void Main ( String [ ] args ) { String str = " GeeksforGeeks " ; String a = " Geeksfo " ; String b = " rGeeks " ; if ( checkString ( str , a , b ) ) Console . WriteLine ( " Yes " ) ; else Console . WriteLine ( " No " ) ; } }

Index/key variables: i, j
Accumulator variables: i, j
Class/struct names: GFG
C# program:
using System ; class GFG { public static void printChar ( String str , int n ) { int [ ] freq = new int [ 26 ] ; for ( int i = 0 ; i < n ; i ++ ) freq [ str [ i ] - ' a ' ] ++ ; for ( int i = 0 ; i < n ; i ++ ) { if ( freq [ str [ i ] - ' a ' ] % 2 == 1 ) { Console . Write ( str [ i ] ) ; } } } public static void Main ( String [ ] args ) { String str = " geeksforgeeks " ; int n = str . Length ; printChar ( str , n ) ; } }

Index/key variables: i
Accumulator variables: i
Iterator variables: i
Class/struct names: GFG
C# program:
using System ; class GFG { static int minOperations ( string str , int n ) { int i , lastUpper = - 1 , firstLower = - 1 ; for ( i = n - 1 ; i >= 0 ; i -- ) { if ( Char . IsUpper ( str [ i ] ) ) { lastUpper = i ; break ; } } for ( i = 0 ; i < n ; i ++ ) { if ( Char . IsLower ( str [ i ] ) ) { firstLower = i ; break ; } } if ( lastUpper == - 1 firstLower == - 1 ) return 0 ; int countUpper = 0 ; for ( i = firstLower ; i < n ; i ++ ) { if ( Char . IsUpper ( str [ i ] ) ) { countUpper ++ ; } } int countLower = 0 ; for ( i = 0 ; i < lastUpper ; i ++ ) { if ( Char . IsLower ( str [ i ] ) ) { countLower ++ ; } } return Math . Min ( countLower , countUpper ) ; } public static void Main ( ) { string str = " geEksFOrGEekS " ; int n = str . Length ; Console . WriteLine ( minOperations ( str , n ) ) ; } }

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