dhyuti-n/xlcost-variable-roles huggingface dataset:
C# program:
using System ; using System . Collections ; using System . Collections . Generic ; class GFG { static void checkstateA ( string n ) { if ( n [ 0 ] == '0' ) stateB ( n . Substring ( 1 ) ) ; else stateD ( n . Substring ( 1 ) ) ; } static void stateB ( string n ) { if ( n . Length == 0 ) { Console . Write ( " string ▁ not ▁ accepted " ) ; } else { if ( n [ 0 ] == '1' ) stateC ( n . Substring ( 1 ) ) ; else stateD ( n . Substring ( 1 ) ) ; } } static void stateC ( string n ) { Console . Write ( " string ▁ accepted " ) ; } static void stateD ( string n ) { if ( n . Length == 0 ) Console . Write ( " string ▁ not ▁ accepted " ) ; else { if ( n [ 0 ] == '1' ) stateD ( n . Substring ( 1 ) ) ; else stateE ( n . Substring ( 1 ) ) ; } } static void stateE ( string n ) { if ( n . Length == 0 ) Console . Write ( " string ▁ not ▁ accepted " ) ; else { if ( n [ 0 ] == '0' ) stateE ( n . Substring ( 1 ) ) ; else stateF ( n . Substring ( 1 ) ) ; } } static void stateF ( string n ) { if ( n . Length == 0 ) Console . Write ( " string ▁ accepted " ) ; else { if ( n [ 0 ] == '1' ) stateD ( n . Substring ( 1 ) ) ; else stateE ( n . Substring ( 1 ) ) ; } } public static void Main ( string [ ] args ) { string n = "0100101" ; checkstateA ( n ) ; } }

Class/struct names: GFG
C# program:
using System ; class GFG { public static int HogbenNumber ( int a ) { int p = ( int ) ( Math . Pow ( a , 2 ) - a + 1 ) ; return p ; } public static void Main ( ) { int N = 10 ; Console . Write ( HogbenNumber ( N ) ) ; } }

Class/struct names: GFG
C# program:
using System ; class GFG { public static void check_string_exist ( String S ) { int size = S . Length ; bool check = true ; for ( int i = 0 ; i < size ; i ++ ) { if ( S [ i ] != S [ ( i + 2 ) % size ] ) { check = false ; break ; } } if ( check ) Console . WriteLine ( " Yes " ) ; else Console . WriteLine ( " No " ) ; } public static void Main ( String [ ] args ) { String S = " papa " ; check_string_exist ( S ) ; } }

Index/key variables: i
Accumulator variables: i
Iterator variables: i
Boolean variables: check
Class/struct names: GFG
C# program:
using System ; class GFG { static int getProduct ( int n ) { int product = 1 ; while ( n != 0 ) { product = product * ( n % 10 ) ; n = n / 10 ; } return product ; } static int productinRange ( int l , int r ) { if ( r - l > 9 ) return 0 ; else { int p = 1 ; for ( int i = l ; i <= r ; i ++ ) p *= getProduct ( i ) ; return p ; } } public static void Main ( String [ ] args ) { int l = 11 , r = 15 ; Console . Write ( productinRange ( l , r ) + " STRNEWLINE " ) ; l = 1 ; r = 15 ; Console . Write ( productinRange ( l , r ) ) ; } }

Accumulator variables: i, p
Iterator variables: i
Class/struct names: GFG
C# program:
using System ; using System . Collections . Generic ; class GFG { static int checkQwertyRow ( char x ) { char [ ] first_row1 = { '1' , '2' , '3' , '4' , '5' , '6' , '7' , '8' , '9' , '0' , ' - ' , ' = ' } ; HashSet < char > first_row = new HashSet < char > ( first_row1 ) ; char [ ] second_row1 = { ' Q ' , ' W ' , ' E ' , ' R ' , ' T ' , ' Y ' , ' U ' , ' I ' , ' O ' , ' P ' , ' [ ' , ' ] ' , ' q ' , ' w ' , ' e ' , ' r ' , ' t ' , ' y ' , ' u ' , ' i ' , ' o ' , ' p ' } ; HashSet < char > second_row = new HashSet < char > ( second_row1 ) ; char [ ] third_row1 = { ' A ' , ' S ' , ' D ' , ' F ' , ' G ' , ' H ' , ' J ' , ' K ' , ' L ' , ' ; ' , ' : ' , ' a ' , ' s ' , ' d ' , ' f ' , ' g ' , ' h ' , ' j ' , ' k ' , ' l ' } ; HashSet < char > third_row = new HashSet < char > ( third_row1 ) ; char [ ] fourth_row1 = { ' Z ' , ' X ' , ' C ' , ' V ' , ' B ' , ' N ' , ' M ' , ' , ' , ' . ' , ' / ' , ' z ' , ' x ' , ' c ' , ' v ' , ' b ' , ' n ' , ' m ' } ; HashSet < char > fourth_row = new HashSet < char > ( fourth_row1 ) ; if ( first_row . Contains ( x ) ) { return 1 ; } else if ( second_row . Contains ( x ) ) { return 2 ; } else if ( third_row . Contains ( x ) ) { return 3 ; } else if ( fourth_row . Contains ( x ) ) { return 4 ; } return 0 ; } static bool checkValidity ( String str ) { char x = str [ 0 ] ; int row = checkQwertyRow ( x ) ; for ( int i = 0 ; i < str . Length ; i ++ ) { x = str [ i ] ; if ( row != checkQwertyRow ( x ) ) { return false ; } } return true ; } public static void Main ( String [ ] args ) { String str = " GeeksforGeeks " ; if ( checkValidity ( str ) ) Console . WriteLine ( " Yes " ) ; else Console . WriteLine ( " No " ) ; } }

Index/key variables: i
Accumulator variables: i
Iterator variables: i
Class/struct names: GFG
C# program:
using System ; class GFG { static int fib ( long n ) { int f0 = 0 ; int f1 = 1 ; if ( n == 0 ) return 0 ; if ( n == 1 ) return 1 ; else { int rem = ( int ) ( n % 60 ) ; if ( rem == 0 ) return 0 ; for ( int i = 2 ; i < rem + 3 ; i ++ ) { int f = ( f0 + f1 ) % 60 ; f0 = f1 ; f1 = f ; } int s = f1 - 1 ; return s ; } } public static void Main ( ) { int m = 10087887 ; long n = 2983097899L ; int Final = ( int ) Math . Abs ( fib ( n ) - fib ( m - 1 ) ) ; Console . WriteLine ( Final % 10 ) ; } }

Accumulator variables: i
Iterator variables: i
Class/struct names: GFG
C# program:
using System ; class GFG { static void printSinX ( int N ) { int Xi = 0 ; int num = 1 ; while ( N -- > 0 ) { Console . Write ( " X " + num + " ▁ = ▁ " + Xi ) ; Console . Write ( " ▁ sin ( X " + num + " ) ▁ = ▁ " ) ; Console . Write ( " { 0 : F6 } " , Math . Sin ( Xi ) ) ; Console . WriteLine ( ) ; num += 1 ; Xi += 710 ; } } public static void Main ( String [ ] args ) { int N = 5 ; printSinX ( N ) ; } }

Accumulator variables: N, Xi, num
Class/struct names: GFG
C# program:
using System ; using System . Collections . Generic ; class GFG { static void sumBetweenZero ( int [ ] arr , int N ) { int i = 0 ; List < int > A = new List < int > ( ) ; int sum = 0 ; for ( i = 0 ; i < N ; i ++ ) { if ( arr [ i ] == 0 ) { i ++ ; break ; } } for ( ; i < N ; i ++ ) { if ( arr [ i ] == 0 ) { A . Add ( sum ) ; sum = 0 ; } else { sum += arr [ i ] ; } } for ( int j = 0 ; j < A . Count ; j ++ ) { Console . Write ( A [ j ] + " ▁ " ) ; } if ( A . Count == 0 ) Console . Write ( " - 1" ) ; } public static void Main ( String [ ] args ) { int [ ] arr = { 1 , 0 , 3 , 4 , 0 , 4 , 4 , 0 , 2 , 1 , 4 , 0 , 3 } ; int N = arr . Length ; sumBetweenZero ( arr , N ) ; } }

Index/key variables: i, j
Accumulator variables: i, j, sum
Iterator variables: i, j
Class/struct names: GFG
C# program:
using System ; public class GFG { static public int nthTerm ( int N ) { if ( N == 1 ) { return 2 ; } return ( ( N - 1 ) * 13 ) + nthTerm ( N - 1 ) ; } static public void Main ( ) { int N = 17 ; Console . WriteLine ( nthTerm ( N ) ) ; } }

Class/struct names: GFG
C# program:
using System ; using System . Collections . Generic ; class GFG { static void maximumSubsequence ( int [ ] arr , int N ) { Dictionary < int , int > M = new Dictionary < int , int > ( ) ; for ( int i = 0 ; i < N ; i ++ ) { if ( M . ContainsKey ( arr [ i ] ) ) { M [ arr [ i ] ] = M [ arr [ i ] ] + 1 ; } else { M . Add ( arr [ i ] , 1 ) ; } } int distinct_size = M . Count ; int maxFreq = 1 ; foreach ( KeyValuePair < int , int > m in M ) { maxFreq = Math . Max ( maxFreq , m . Value ) ; } Console . Write ( Math . Max ( Math . Min ( distinct_size , maxFreq - 1 ) , Math . Min ( distinct_size - 1 , maxFreq ) ) ) ; } public static void Main ( String [ ] args ) { int [ ] arr = { 1 , 2 , 3 , 4 , 4 , 4 , 4 , 4 , 5 } ; int N = arr . Length ; maximumSubsequence ( arr , N ) ; } }

Index/key variables: i
Accumulator variables: i
Iterator variables: i, m
Class/struct names: GFG
C# program:
using System ; using System . Collections . Generic ; using System . Linq ; class GFG { static int countCharacters ( List < string > strings , string chars ) { int res = 0 ; Dictionary < char , int > freq = new Dictionary < char , int > ( ) ; for ( int i = 0 ; i < chars . Length ; i ++ ) { if ( freq . ContainsKey ( chars [ i ] ) ) { freq [ chars [ i ] ] ++ ; } else { freq . Add ( chars [ i ] , freq . GetValueOrDefault ( chars [ i ] , 0 ) + 1 ) ; } } foreach ( string st in strings ) { bool flag = true ; foreach ( char c in st . ToCharArray ( ) ) { if ( ! freq . ContainsKey ( c ) ) { flag = false ; break ; } } if ( flag ) res += st . Length ; } return res ; } public static void Main ( string [ ] args ) { string [ ] tmp = { " hi " , " data " , " geeksforgeeks " } ; List < string > strings = tmp . ToList ( ) ; string chars = " tiadhae " ; Console . Write ( countCharacters ( strings , chars ) ) ; } }

Index/key variables: i
Accumulator variables: i, res
Iterator variables: c, i, st
Boolean variables: flag
Class/struct names: GFG
C# program:
using System ; class GFG { static void arrayConstruct ( int N ) { for ( int i = 2 ; i <= N ; i = i + 2 ) Console . Write ( i + " ▁ " ) ; for ( int i = 1 ; i < N - 1 ; i = i + 2 ) Console . Write ( i + " ▁ " ) ; Console . Write ( N - 1 + ( N / 2 ) + " STRNEWLINE " ) ; } static void createArray ( int N ) { if ( N % 4 == 0 ) arrayConstruct ( N ) ; else Console . Write ( - 1 + " STRNEWLINE " ) ; } public static void Main ( String [ ] args ) { int N = 8 ; createArray ( N ) ; } }

Iterator variables: i
Class/struct names: GFG
C# program:
using System ; using System . Collections . Generic ; class GFG { static int distinctSubstring ( string P , string Q , int K , int N ) { HashSet < string > S = new HashSet < string > ( ) ; for ( int i = 0 ; i < N ; ++ i ) { int sum = 0 ; string s = " " ; for ( int j = i ; j < N ; ++ j ) { int pos = P [ j ] - ' a ' ; sum += Q [ pos ] - '0' ; s += P [ j ] ; if ( sum <= K ) { S . Add ( s ) ; } else { break ; } } } return S . Count ; } static void Main ( ) { string S = " abcde " ; string W = "12345678912345678912345678" ; int K = 5 ; int N = S . Length ; Console . WriteLine ( distinctSubstring ( S , W , K , N ) ) ; } }

Index/key variables: j, pos
Accumulator variables: s, sum
Iterator variables: i, j
Class/struct names: GFG
C# program:
using System ; using System . Collections . Generic ; class GFG { static int distinctSubString ( String P , String Q , int K , int N ) { HashSet < String > S = new HashSet < String > ( ) ; for ( int i = 0 ; i < N ; ++ i ) { int sum = 0 ; String s = " " ; for ( int j = i ; j < N ; ++ j ) { int pos = P [ j ] - ' a ' ; sum += Q [ pos ] - '0' ; s += P [ j ] ; if ( sum <= K ) { S . Add ( s ) ; } else { break ; } } } return S . Count ; } public static void Main ( String [ ] args ) { String P = " abcde " ; String Q = "12345678912345678912345678" ; int K = 5 ; int N = P . Length ; Console . Write ( distinctSubString ( P , Q , K , N ) ) ; } }

Index/key variables: j, pos
Accumulator variables: s, sum
Iterator variables: i, j
Class/struct names: GFG
C# program:
using System ; class GFG { static void printPattern ( int n ) { int i , j ; for ( i = 1 ; i <= n ; i ++ ) { for ( j = 1 ; j < 2 * n ; j ++ ) { if ( j == ( n - i + 1 ) || j == ( n + i - 1 ) ) { Console . Write ( " * ▁ " ) ; } else if ( ( i >= 4 && i <= n - 4 ) && ( j == n - i + 4 j == n + i - 4 ) ) { Console . Write ( " * ▁ " ) ; } else if ( i == n || ( i == n - 4 && j >= n - ( n - 2 * 4 ) && j <= n + n - 2 * 4 ) ) { Console . Write ( " * ▁ " ) ; } else { Console . Write ( " ▁ " + " ▁ " ) ; } } Console . Write ( " STRNEWLINE " ) ; } } public static void Main ( String [ ] args ) { int N = 9 ; printPattern ( N ) ; } }

Accumulator variables: i, j
Iterator variables: i, j
Class/struct names: GFG
C# program:
using System ; class GFG { static bool isKAlternating ( String s , int k ) { if ( s . Length < k ) return false ; int checker = 0 ; for ( int i = 0 ; i < k ; i ++ ) { int bitAtIndex = s [ i ] - ' a ' ; if ( ( checker & ( 1 << bitAtIndex ) ) > 0 ) { return false ; } checker = checker | ( 1 << bitAtIndex ) ; } for ( int i = k ; i < s . Length ; i ++ ) if ( s [ i - k ] != s [ i ] ) return false ; return true ; } public static void Main ( ) { String str = " acdeac " ; int K = 4 ; if ( isKAlternating ( str , K ) ) 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 MAX = 100000 ; static void findFactors ( int N ) { int temp = ( int ) Math . Sqrt ( N ) ; int [ ] factor = new int [ MAX ] ; for ( int l = 0 ; l < MAX ; l ++ ) factor [ l ] = 1 ; int i , j , k ; int len1 = 1 ; while ( temp % 2 == 0 ) { factor [ len1 ++ ] = 2 ; factor [ len1 ++ ] = 2 ; temp /= 2 ; } for ( j = 3 ; j < Math . Sqrt ( temp ) ; j += 2 ) { while ( temp % j == 0 ) { factor [ len1 ++ ] = j ; factor [ len1 ++ ] = j ; temp /= j ; } } if ( temp > 2 ) { factor [ len1 ++ ] = temp ; factor [ len1 ++ ] = temp ; } int [ , ] M = new int [ len1 , MAX ] ; int tpc = 0 , tpr = 0 ; M [ 0 , 0 ] = 1 ; j = 1 ; while ( j < len1 ) { if ( factor [ j ] != factor [ j - 1 ] ) { tpr ++ ; M [ tpr , 0 ] = factor [ j ] ; j ++ ; tpc = 1 ; } else { M [ tpr , tpc ] = M [ tpr , tpc - 1 ] * factor [ j ] ; j ++ ; tpc ++ ; } } int [ ] arr1 = new int [ MAX ] ; int [ ] arr2 = new int [ MAX ] ; int l1 , l2 ; l1 = l2 = 1 ; arr1 [ 0 ] = arr2 [ 0 ] = 1 ; for ( i = 1 ; i < tpr + 1 ; i ++ ) { for ( j = 0 ; M [ i , j ] != 0 ; j ++ ) { for ( k = 0 ; k < l1 ; k ++ ) { arr2 [ l2 ++ ] = arr1 [ k ] * M [ i , j ] ; } } for ( j = l1 ; j < l2 ; j ++ ) { arr1 [ j ] = arr2 [ j ] ; } l1 = l2 ; } for ( i = 0 ; i < l2 ; i ++ ) { Console . Write ( arr2 [ i ] + " ▁ " ) ; } } public static void Main ( String [ ] args ) { int N = 900 ; findFactors ( N ) ; } }

Index/key variables: MAX, i, j, k, l
Accumulator variables: i, j, k, l, l2, len1, temp, tpc, tpr
Iterator variables: i, j, k, l
Class/struct names: GFG
C# program:
using System ; class GFG { static int [ , ] matrix = new int [ 100 , 100 ] ; static void printRequiredMatrix ( int n ) { if ( n == 1 ) { Console . WriteLine ( "1" ) ; } else if ( n % 2 != 0 ) { Console . WriteLine ( " - 1" ) ; } else { for ( int i = 0 ; i < n ; i ++ ) { matrix [ i , i ] = n ; } int u = n - 1 ; for ( int i = 0 ; i < n - 1 ; i ++ ) { matrix [ i , u ] = i + 1 ; for ( int j = 1 ; j < n / 2 ; j ++ ) { int a = ( i + j ) % ( n - 1 ) ; int b = ( i - j + n - 1 ) % ( n - 1 ) ; if ( a < b ) { int temp = a ; a = b ; b = temp ; } matrix [ b , a ] = i + 1 ; } } for ( int i = 0 ; i < n ; i ++ ) for ( int j = 0 ; j < i ; j ++ ) matrix [ i , j ] = matrix [ j , i ] + n ; for ( int i = 0 ; i < n ; i ++ ) { for ( int j = 0 ; j < n ; j ++ ) Console . Write ( matrix [ i , j ] + " ▁ " ) ; Console . WriteLine ( ) ; } } Console . WriteLine ( ) ; } public static void Main ( String [ ] args ) { int n = 1 ; printRequiredMatrix ( n ) ; n = 3 ; printRequiredMatrix ( n ) ; n = 6 ; printRequiredMatrix ( n ) ; } }

Accumulator variables: i, j
Iterator variables: i, j
Class/struct names: GFG
C# program:
using System ; class GFG { static int countSubstring ( string S , int n ) { int ans = 0 ; int i = 0 ; while ( i < n ) { int cnt0 = 0 , cnt1 = 0 ; if ( S [ i ] == '0' ) { while ( i < n && S [ i ] == '0' ) { cnt0 ++ ; i ++ ; } int j = i ; while ( j < n && S [ j ] == '1' ) { cnt1 ++ ; j ++ ; } } else { while ( i < n && S [ i ] == '1' ) { cnt1 ++ ; i ++ ; } int j = i ; while ( j < n && S [ j ] == '0' ) { cnt0 ++ ; j ++ ; } } ans += Math . Min ( cnt0 , cnt1 ) ; } return ans ; } static public void Main ( ) { string S = "0001110010" ; int n = S . Length ; Console . WriteLine ( countSubstring ( S , n ) ) ; } }

Index/key variables: i, j
Accumulator variables: ans, cnt0, cnt1, i, j
Class/struct names: GFG
C# program:
using System ; public class GFG { static void findNumbers ( int n ) { int i = 1 ; while ( i <= n ) { Console . Write ( ( 3 * i * ( i - 1 ) + 1 ) + " ▁ " ) ; i ++ ; } } public static void Main ( ) { int n = 4 ; findNumbers ( n ) ; } }

Accumulator variables: i
Class/struct names: GFG
C# program:
using System ; class GFG { static void decToOctal ( int n ) { int [ ] octalNum = new int [ 100 ] ; int i = 0 ; while ( n != 0 ) { octalNum [ i ] = n % 8 ; n = n / 8 ; i ++ ; } for ( int j = i - 1 ; j >= 0 ; j -- ) Console . Write ( octalNum [ j ] ) ; Console . WriteLine ( ) ; } static void nDigitPerfectSquares ( int n ) { int _decimal = ( int ) Math . Pow ( Math . Ceiling ( Math . Sqrt ( Math . Pow ( 8 , n ) ) ) - 1 , 2 ) ; decToOctal ( _decimal ) ; } public static void Main ( ) { int n = 2 ; nDigitPerfectSquares ( n ) ; } }

Index/key variables: i, j
Accumulator variables: i, j
Iterator variables: j
Class/struct names: GFG
C# program:
using System ; class GFG { static String s ; static void reverseStr ( int l , int h ) { int n = h - l ; for ( int i = 0 ; i < n / 2 ; i ++ ) { s = swap ( i + l , n - i - 1 + l ) ; } } static void reverseString ( int [ ] A , int n ) { reverseStr ( 0 , A [ 0 ] ) ; for ( int i = 1 ; i < n ; i ++ ) reverseStr ( A [ i - 1 ] , A [ i ] ) ; reverseStr ( A [ n - 1 ] , s . Length ) ; } static String swap ( int i , int j ) { char [ ] ch = s . ToCharArray ( ) ; char temp = ch [ i ] ; ch [ i ] = ch [ j ] ; ch [ j ] = temp ; return String . Join ( " " , ch ) ; } public static void Main ( String [ ] args ) { s = " abcdefgh " ; int [ ] A = { 2 , 4 , 6 } ; int n = A . Length ; reverseString ( A , n ) ; Console . Write ( s ) ; } }

Index/key variables: i, j
Accumulator variables: i
Iterator variables: i
Class/struct names: GFG
C# program:
using System ; using System . Collections . Generic ; class GFG { static bool Formatted ( String s ) { List < char > k = new List < char > ( ) ; int i = 0 ; while ( i < s . Length ) { if ( s [ i ] == ' ) ' || s [ i ] == ' ( ' ) { k . Add ( s [ i ] ) ; i += 1 ; } else { char st = ' \x0000' ; while ( s [ i ] != ' ) ' && s [ i ] != ' ) ' ) { st = s [ i ] ; i = i + 1 ; } k . Add ( st ) ; } } int depth = 0 , flag = 1 ; int open = 0 , close = 0 ; foreach ( char i2 in k ) { if ( i2 == ' ( ' ) { depth += 1 ; open += 1 ; } else if ( i2 == ' ) ' ) { depth -= 1 ; close += 1 ; } else { if ( i2 - '0' != depth ) { flag = 0 ; break ; } } } if ( open != close ) flag = 0 ; return ( flag == 1 ) ? true : false ; } public static void Main ( String [ ] args ) { String s = " ( (2 ) ( (3 ) ) ) " ; bool k = Formatted ( s ) ; if ( k == true ) Console . Write ( " Yes " ) ; else Console . Write ( " No " ) ; } }

Index/key variables: i
Accumulator variables: close, depth, i, open
Iterator variables: i2
Class/struct names: GFG
C# program:
using System ; class GFG { static int findSum ( int [ ] arr , int n , int k ) { if ( k <= n - 2 ) return ( arr [ n - 1 ] - arr [ 0 ] ) ; return 0 ; } public static void Main ( ) { int [ ] arr = { 1 , 2 , 3 , 4 } ; int n = arr . Length ; int k = 1 ; Console . WriteLine ( findSum ( arr , n , k ) ) ; } }

Class/struct names: GFG
C# program:
using System ; class GFG { static int maxSubStr ( String str , int n ) { int count0 = 0 , count1 = 0 ; int cnt = 0 ; for ( int i = 0 ; i < n ; i ++ ) { if ( str [ i ] == '0' ) { count0 ++ ; } else { count1 ++ ; } if ( count0 == count1 ) { cnt ++ ; } } if ( cnt == 0 ) { return - 1 ; } return cnt ; } public static void Main ( String [ ] args ) { String str = "0100110101" ; int n = str . Length ; Console . WriteLine ( maxSubStr ( str , n ) ) ; } }

Index/key variables: i
Accumulator variables: cnt, count0, count1, i
Iterator variables: i
Class/struct names: GFG
C# program:
using System ; class GFG { static long squareDigitSum ( String s ) { long lengthN = s . Length ; long result = ( lengthN / 9 ) * 81 + ( long ) Math . Pow ( ( lengthN % 9 ) , 2 ) ; return result ; } public static void Main ( String [ ] args ) { String s = "1111" ; Console . WriteLine ( squareDigitSum ( s ) ) ; } }

Class/struct names: GFG
C# program:
using System ; public class temp { static String getString ( char x ) { String s = String . Join ( " " , x ) ; return s ; } static Boolean solve ( String s1 , String s2 ) { String a = getString ( s1 [ 0 ] ) , b = getString ( s2 [ 0 ] ) ; for ( int i = 1 ; i < s1 . Length ; i ++ ) if ( s1 [ i ] != s1 [ i - 1 ] ) { a += getString ( s1 [ i ] ) ; } for ( int i = 1 ; i < s2 . Length ; i ++ ) if ( s2 [ i ] != s2 [ i - 1 ] ) { b += getString ( s2 [ i ] ) ; } if ( a == b ) return true ; return false ; } public static void Main ( String [ ] args ) { String s1 = " Geeks " , s2 = " Geks " ; if ( solve ( s1 , s2 ) ) Console . Write ( " Yes " ) ; else Console . Write ( " No " ) ; } }

Index/key variables: i
Accumulator variables: a, b, i
Iterator variables: i
Class/struct names: temp
C# program:
using System ; using System . Collections . Generic ; class GFG { static int x = 26 ; static int mod = 3001 ; static void CntSubstr ( char [ ] s , int l ) { int hash = 0 ; for ( int i = 0 ; i < l ; i ++ ) { hash = ( hash * x + ( s [ i ] - 97 ) ) % mod ; } int pow_l = 1 ; for ( int i = 0 ; i < l - 1 ; i ++ ) { pow_l = ( pow_l * x ) % mod ; } HashSet < int > result = new HashSet < int > ( ) ; result . Add ( hash ) ; for ( int i = l ; i < s . Length ; i ++ ) { hash = ( ( hash - pow_l * ( s [ i - l ] - 97 ) + 2 * mod ) * x + ( s [ i ] - 97 ) ) % mod ; result . Add ( hash ) ; } Console . WriteLine ( result . Count ) ; } public static void Main ( String [ ] args ) { String s = " abcba " ; int l = 2 ; CntSubstr ( s . ToCharArray ( ) , l ) ; } }

Index/key variables: i
Accumulator variables: i
Iterator variables: i
Class/struct names: GFG
C# program:
using System ; class GFG { private static bool isValidString ( string str , int n ) { int index = str . IndexOf ( " b " ) ; if ( index == 0 ) return false ; while ( index != - 1 ) { if ( str [ index - 1 ] != ' a ' ) return false ; if ( index + 1 < n && str [ index + 1 ] != ' b ' ) return false ; if ( index + 2 < n && str [ index + 2 ] == ' b ' ) return false ; if ( index == n - 1 ) return false ; index = str . IndexOf ( " b " , index + 2 ) ; } return true ; } public static void Main ( ) { string str = " abbaaabbabba " ; int n = str . Length ; Console . WriteLine ( isValidString ( str , n ) ) ; } }

Class/struct names: GFG
C# program:
using System ; class GFG { static bool endsWith ( string str , string pat ) { int patLen = pat . Length ; int strLen = str . Length ; if ( patLen > strLen ) return false ; patLen -- ; strLen -- ; while ( patLen >= 0 ) { if ( pat [ patLen ] != str [ strLen ] ) return false ; patLen -- ; strLen -- ; } return true ; } static int countOfStrings ( string pat , int n , string [ ] sArr ) { int count = 0 ; for ( int i = 0 ; i < n ; i ++ ) if ( endsWith ( sArr [ i ] , pat ) ) count ++ ; return count ; } public static void Main ( ) { string pat = " ks " ; int n = 4 ; string [ ] sArr = { " geeks " , " geeksforgeeks " , " games " , " unit " } ; Console . WriteLine ( countOfStrings ( pat , n , sArr ) ) ; } }

Index/key variables: i, patLen, strLen
Accumulator variables: count, i, patLen, strLen
Iterator variables: i
Class/struct names: GFG
C# program:
using System ; class GFG { static int getEndingIndex ( string str , int n , int i ) { i ++ ; while ( i < n ) { char curr = str [ i ] ; char prev = str [ i - 1 ] ; if ( ( curr == ' a ' && prev == ' z ' ) || ( curr - prev == 1 ) ) i ++ ; else break ; } return i - 1 ; } static int largestSubStr ( string str , int n ) { int len = 0 ; int i = 0 ; while ( i < n ) { int end = getEndingIndex ( str , n , i ) ; len = Math . Max ( end - i + 1 , len ) ; i = end + 1 ; } return len ; } public static void Main ( ) { string str = " abcabcdefabc " ; int n = str . Length ; Console . Write ( largestSubStr ( str , n ) ) ; } }

Index/key variables: i
Accumulator variables: i
Class/struct names: GFG
C# program:
class GFG { static int getSum ( int n , int d ) { if ( n < d ) return 0 ; while ( n % 10 != d ) n -- ; int k = n / 10 ; return ( k + 1 ) * d + ( k * 10 + 10 * k * k ) / 2 ; } public static void Main ( ) { int n = 30 ; int d = 3 ; System . Console . WriteLine ( getSum ( n , d ) ) ; } }

Accumulator variables: n
Class/struct names: GFG