dhyuti-n/xlcost-variable-roles huggingface dataset:
C# program:
using System ; class GFG { static string findSum ( string str1 , string str2 ) { if ( str1 . Length > str2 . Length ) { string t = str1 ; str1 = str2 ; str2 = t ; } string str = " " ; int n1 = str1 . Length , n2 = str2 . Length ; int diff = n2 - n1 ; int carry = 0 ; for ( int i = n1 - 1 ; i >= 0 ; i -- ) { int sum = ( ( int ) ( str1 [ i ] - '0' ) + ( int ) ( str2 [ i + diff ] - '0' ) + carry ) ; str += ( char ) ( sum % 10 + '0' ) ; carry = sum / 10 ; } for ( int i = n2 - n1 - 1 ; i >= 0 ; i -- ) { int sum = ( ( int ) ( str2 [ i ] - '0' ) + carry ) ; str += ( char ) ( sum % 10 + '0' ) ; carry = sum / 10 ; } if ( carry > 0 ) str += ( char ) ( carry + '0' ) ; char [ ] ch2 = str . ToCharArray ( ) ; Array . Reverse ( ch2 ) ; return new string ( ch2 ) ; } static void Main ( ) { string str1 = "12" ; string str2 = "198111" ; Console . WriteLine ( findSum ( str1 , str2 ) ) ; } }

Index/key variables: i
Accumulator variables: i, str
Iterator variables: i
Class/struct names: GFG
C# program:
using System ; using System . Collections . Generic ; class GFG { static Boolean isPalindrome ( String str ) { int len = str . Length ; for ( int i = 0 ; i < len / 2 ; i ++ ) if ( str [ i ] != str [ len - i - 1 ] ) return false ; return true ; } static Boolean checkPalindromePair ( List < String > vect ) { for ( int i = 0 ; i < vect . Count - 1 ; i ++ ) { for ( int j = i + 1 ; j < vect . Count ; j ++ ) { String check_str = " " ; check_str = check_str + vect [ i ] + vect [ j ] ; if ( isPalindrome ( check_str ) ) return true ; check_str = vect [ j ] + vect [ j ] ; if ( isPalindrome ( check_str ) ) return true ; } } return false ; } public static void Main ( String [ ] args ) { List < String > vect = new List < String > ( ) { " geekf " , " geeks " , " or " , " keeg " , " abc " , " bc " } ; if ( checkPalindromePair ( vect ) == true ) Console . WriteLine ( " Yes " ) ; else Console . WriteLine ( " No " ) ; } }

Index/key variables: i, j
Accumulator variables: i, j
Iterator variables: i, j
Class/struct names: GFG
C# program:
using System ; class GFG { static void print ( String str1 ) { char [ ] str = str1 . ToCharArray ( ) ; Console . Write ( str [ 0 ] ) ; for ( int i = 1 ; i < str . Length ; i ++ ) { if ( ( str [ i ] == str [ i - 1 ] + 1 ) || ( str [ i ] == str [ i - 1 ] - 1 ) ) { Console . Write ( str [ i ] ) ; } else { Console . Write ( " STRNEWLINE " + str [ i ] ) ; } } } public static void Main ( ) { String str = " ABCXYZACCD " ; print ( str ) ; } }

Index/key variables: i
Accumulator variables: i
Iterator variables: i
Class/struct names: GFG
C# program:
using System ; class GFG { static bool areChractersUnique ( string str ) { int checker = 0 ; for ( int i = 0 ; i < str . Length ; ++ i ) { int val = ( str [ i ] - ' a ' ) ; if ( ( checker & ( 1 << val ) ) > 0 ) return false ; checker |= ( 1 << val ) ; } return true ; } public static void Main ( ) { string s = " aaabbccdaa " ; if ( areChractersUnique ( s ) ) Console . Write ( " Yes " ) ; else Console . Write ( " No " ) ; } }

Index/key variables: i
Accumulator variables: checker
Iterator variables: i
Class/struct names: GFG
C# program:
using System ; public class GFG { static int countWords ( string str , int len ) { int count = 1 ; if ( len == 1 ) return count ; if ( str [ 0 ] == str [ 1 ] ) count *= 1 ; else count *= 2 ; for ( int j = 1 ; j < len - 1 ; j ++ ) { if ( str [ j ] == str [ j - 1 ] && str [ j ] == str [ j + 1 ] ) count *= 1 ; else if ( str [ j ] == str [ j - 1 ] str [ j ] == str [ j + 1 ] str [ j - 1 ] == str [ j + 1 ] ) count *= 2 ; else count *= 3 ; } if ( str [ len - 1 ] == str [ len - 2 ] ) count *= 1 ; else count *= 2 ; return count ; } public static void Main ( ) { string str = " abc " ; int len = str . Length ; Console . WriteLine ( countWords ( str , len ) ) ; } }

Index/key variables: j
Accumulator variables: count, j
Iterator variables: j
Class/struct names: GFG
C# program:
using System ; class GFG { static int replaceDig ( int x , int from , int to ) { int result = 0 ; int multiply = 1 ; while ( x > 0 ) { int reminder = x % 10 ; if ( reminder == from ) result = result + to * multiply ; else result = result + reminder * multiply ; multiply *= 10 ; x = x / 10 ; } return result ; } static void calculateMinMaxSum ( int x1 , int x2 ) { int minSum = replaceDig ( x1 , 6 , 5 ) + replaceDig ( x2 , 6 , 5 ) ; int maxSum = replaceDig ( x1 , 5 , 6 ) + replaceDig ( x2 , 5 , 6 ) ; Console . Write ( " Minimum ▁ sum ▁ = ▁ " + minSum ) ; Console . Write ( " STRNEWLINE Maximum ▁ sum ▁ = ▁ " + maxSum ) ; } public static void Main ( ) { int x1 = 5466 , x2 = 4555 ; calculateMinMaxSum ( x1 , x2 ) ; } }

Accumulator variables: multiply
Class/struct names: GFG
C# program:
using System ; class GFG { static void qType1 ( int l , int x , char [ ] str ) { str [ l - 1 ] = ( char ) x ; } static void qType2 ( int l , int r , char [ ] str ) { int [ ] freq = new int [ 27 ] ; for ( int i = l - 1 ; i <= r - 1 ; i ++ ) { freq [ str [ i ] - ' a ' ] ++ ; } int count = 0 ; for ( int j = 0 ; j < 26 ; j ++ ) { if ( freq [ j ] % 2 != 0 ) { count ++ ; } } if ( count <= 1 ) { Console . WriteLine ( " Yes " ) ; } else { Console . WriteLine ( " No " ) ; } } public static void Main ( String [ ] args ) { char [ ] str = " geeksforgeeks " . ToCharArray ( ) ; int n = str . Length ; qType1 ( 4 , ' g ' , str ) ; qType2 ( 1 , 4 , str ) ; qType2 ( 2 , 3 , str ) ; qType1 ( 10 , ' t ' , str ) ; qType2 ( 10 , 11 , str ) ; } }

Index/key variables: i, j
Accumulator variables: count, i, j
Iterator variables: i, j
Class/struct names: GFG
C# program:
using System ; class GFG { static int max = 1000 ; static int getFrequency ( int [ , ] tree , int idx , int i ) { int sum = 0 ; while ( idx > 0 ) { sum += tree [ idx , i ] ; idx -= ( idx & - idx ) ; } return sum ; } static void update ( int [ , ] tree , int idx , int val , int i ) { while ( idx <= max ) { tree [ idx , i ] += val ; idx += ( idx & - idx ) ; } } static void qType1 ( int [ , ] tree , int l , int x , char [ ] str ) { update ( tree , l , - 1 , str [ l - 1 ] - 97 + 1 ) ; str [ l - 1 ] = ( char ) x ; update ( tree , l , 1 , str [ l - 1 ] - 97 + 1 ) ; } static void qType2 ( int [ , ] tree , int l , int r , char [ ] str ) { int count = 0 ; for ( int i = 1 ; i <= 26 ; i ++ ) { if ( l == 1 ) { if ( getFrequency ( tree , r , i ) % 2 == 1 ) count ++ ; } else { if ( ( getFrequency ( tree , r , i ) - getFrequency ( tree , l - 1 , i ) ) % 2 == 1 ) count ++ ; } } if ( count <= 1 ) Console . WriteLine ( " Yes " ) ; else Console . WriteLine ( " No " ) ; } static void buildBIT ( int [ , ] tree , char [ ] str , int n ) { for ( int i = 0 ; i < n ; i ++ ) update ( tree , i + 1 , 1 , str [ i ] - 97 + 1 ) ; } static void Main ( ) { char [ ] str = " geeksforgeeks " . ToCharArray ( ) ; int n = str . Length ; int [ , ] tree = new int [ max , 27 ] ; buildBIT ( tree , str , n ) ; qType1 ( tree , 4 , ' g ' , str ) ; qType2 ( tree , 1 , 4 , str ) ; qType2 ( tree , 2 , 3 , str ) ; qType1 ( tree , 10 , ' t ' , str ) ; qType2 ( tree , 10 , 11 , str ) ; } }

Index/key variables: i
Accumulator variables: count, i, idx, sum
Iterator variables: i
Class/struct names: GFG
C# program:
using System ; class GFG { static void findDivision ( string str , int a , int b ) { int len = str . Length ; int [ ] lr = new int [ len + 1 ] ; lr [ 0 ] = ( ( int ) str [ 0 ] - ( int ) '0' ) % a ; for ( int i = 1 ; i < len ; i ++ ) lr [ i ] = ( ( lr [ i - 1 ] * 10 ) % a + ( ( int ) str [ i ] - ( int ) '0' ) ) % a ; int [ ] rl = new int [ len + 1 ] ; rl [ len - 1 ] = ( ( int ) str [ len - 1 ] - ( int ) '0' ) % b ; int power10 = 10 ; for ( int i = len - 2 ; i >= 0 ; i -- ) { rl [ i ] = ( rl [ i + 1 ] + ( ( int ) str [ i ] - ( int ) '0' ) * power10 ) % b ; power10 = ( power10 * 10 ) % b ; } for ( int i = 0 ; i < len - 1 ; i ++ ) { if ( lr [ i ] != 0 ) continue ; if ( rl [ i + 1 ] == 0 ) { Console . WriteLine ( " YES " ) ; for ( int k = 0 ; k <= i ; k ++ ) Console . Write ( str [ k ] ) ; Console . Write ( " , ▁ " ) ; for ( int k = i + 1 ; k < len ; k ++ ) Console . Write ( str [ k ] ) ; return ; } } Console . WriteLine ( " NO " ) ; } static void Main ( ) { string str = "123" ; int a = 12 , b = 3 ; findDivision ( str , a , b ) ; } }

Index/key variables: i, k
Accumulator variables: i, k
Iterator variables: i, k
Class/struct names: GFG
C# program:
using System ; using System . Text ; class GFG { public static string findTwoscomplement ( StringBuilder str ) { int n = str . Length ; int i ; for ( i = n - 1 ; i >= 0 ; i -- ) { if ( str [ i ] == '1' ) { break ; } } if ( i == - 1 ) { return "1" + str ; } for ( int k = i - 1 ; k >= 0 ; k -- ) { if ( str [ k ] == '1' ) { str . Remove ( k , k + 1 - k ) . Insert ( k , "0" ) ; } else { str . Remove ( k , k + 1 - k ) . Insert ( k , "1" ) ; } } return str . ToString ( ) ; } public static void Main ( string [ ] args ) { StringBuilder str = new StringBuilder ( "00000101" ) ; Console . WriteLine ( findTwoscomplement ( str ) ) ; } }

Index/key variables: i, k
Accumulator variables: i, k
Iterator variables: i, k
Class/struct names: GFG
C# program:
using System ; class GFG { static bool isequal ( string str ) { int n = str . Length ; int num = 0 , x = 1 , i = n - 1 ; for ( i = n - 1 ; i >= 0 ; i -- ) { if ( '0' <= str [ i ] && str [ i ] <= '9' ) { num = ( str [ i ] - '0' ) * x + num ; x = x * 10 ; if ( num >= n ) return false ; } else break ; } return num == i + 1 ; } static public void Main ( ) { string str = " geeksforgeeks13" ; if ( isequal ( 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 ; using System . Collections . Generic ; public class GFG { public static bool kAnagrams ( string str1 , string str2 , int k ) { int flag = 0 ; List < char > list = new List < char > ( ) ; if ( str1 . Length != str2 . Length ) { return false ; } char [ ] arr1 = str1 . ToCharArray ( ) ; char [ ] arr2 = str2 . ToCharArray ( ) ; Array . Sort ( arr1 ) ; Array . Sort ( arr2 ) ; for ( int i = 0 ; i < str1 . Length ; i ++ ) { if ( arr1 [ i ] != arr2 [ i ] ) { list . Add ( arr2 [ i ] ) ; } } if ( list . Count <= k ) flag = 1 ; if ( flag == 1 ) return true ; else return false ; } static public void Main ( ) { string str1 = " fodr " ; string str2 = " gork " ; int k = 2 ; kAnagrams ( str1 , str2 , k ) ; if ( kAnagrams ( str1 , str2 , k ) == true ) 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 int countToMake0lternate ( string s ) { int result = 0 ; for ( int i = 0 ; i < ( s . Length - 1 ) ; i ++ ) if ( s [ i ] == s [ i + 1 ] ) return result ; } static public void Main ( ) { Console . WriteLine ( countToMake0lternate ( "000111" ) ) ; Console . WriteLine ( countToMake0lternate ( "11111" ) ) ; Console . WriteLine ( countToMake0lternate ( "01010101" ) ) ; } }

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 bool checkString ( String str , int k ) { int n = str . Length ; if ( n % k != 0 ) return false ; Dictionary < String , int > mp = new Dictionary < String , int > ( ) ; for ( int i = 0 ; i < n ; i += k ) { if ( ! mp . ContainsKey ( str . Substring ( i , k ) ) ) mp . Add ( str . Substring ( i , k ) , 1 ) ; else mp [ str . Substring ( i , k ) ] = mp [ str . Substring ( i , k ) ] + 1 ; } if ( mp . Count == 1 ) return true ; if ( mp . Count != 2 ) return false ; foreach ( KeyValuePair < String , int > entry in mp ) { if ( entry . Value == ( n / k - 1 ) entry . Value == 1 ) return true ; } return false ; } public static void Main ( String [ ] args ) { if ( checkString ( " abababcd " , 2 ) ) Console . WriteLine ( " Yes " ) ; else Console . WriteLine ( " No " ) ; } }

Accumulator variables: i
Iterator variables: entry, i
Class/struct names: GFG
C# program:
using System ; class GFG { static int MAX_CHAR = 26 ; static void printGrouped ( String str ) { int n = str . Length ; int [ ] count = new int [ MAX_CHAR ] ; for ( int i = 0 ; i < n ; i ++ ) count [ str [ i ] - ' a ' ] ++ ; for ( int i = 0 ; i < n ; i ++ ) { while ( count [ str [ i ] - ' a ' ] != 0 ) { Console . Write ( str [ i ] ) ; count [ str [ i ] - ' a ' ] -- ; } count [ str [ i ] - ' a ' ] = 0 ; } } public static void Main ( ) { string str = " geeksforgeeks " ; printGrouped ( str ) ; } }

Index/key variables: MAX_CHAR, i
Accumulator variables: i
Iterator variables: i
Class/struct names: GFG
C# program:
using System ; class GFG { static int MAX_CHAR = 26 ; static void sortByPattern ( char [ ] str , char [ ] pat ) { int [ ] count = new int [ MAX_CHAR ] ; for ( int i = 0 ; i < str . Length ; i ++ ) { count [ str [ i ] - ' a ' ] ++ ; } int index = 0 ; for ( int i = 0 ; i < pat . Length ; i ++ ) { for ( int j = 0 ; j < count [ pat [ i ] - ' a ' ] ; j ++ ) { str [ index ++ ] = pat [ i ] ; } } } public static void Main ( String [ ] args ) { char [ ] pat = " bca " . ToCharArray ( ) ; char [ ] str = " abc " . ToCharArray ( ) ; sortByPattern ( str , pat ) ; Console . WriteLine ( String . Join ( " " , str ) ) ; } }

Index/key variables: MAX_CHAR, i
Accumulator variables: i, index, j
Iterator variables: i, j
Class/struct names: GFG
C# program:
using System ; public class GFG { static bool isPossiblePalindrome ( char [ ] str ) { int n = str . Length ; for ( int i = 0 ; i < n / 2 ; i ++ ) { if ( str [ i ] != ' . ' && str [ n - i - 1 ] != ' . ' && str [ i ] != str [ n - i - 1 ] ) return false ; } return true ; } static void smallestPalindrome ( char [ ] str ) { if ( ! isPossiblePalindrome ( str ) ) Console . WriteLine ( " Not ▁ Possible " ) ; int n = str . Length ; for ( int i = 0 ; i < n ; i ++ ) { if ( str [ i ] == ' . ' ) { if ( str [ n - i - 1 ] != ' . ' ) str [ i ] = str [ n - i - 1 ] ; else str [ i ] = str [ n - i - 1 ] = ' a ' ; } } for ( int i = 0 ; i < n ; i ++ ) Console . Write ( str [ i ] + " " ) ; } public static void Main ( ) { String str = " ab . . e . c . a " ; char [ ] s = str . ToCharArray ( ) ; smallestPalindrome ( s ) ; } }

Index/key variables: i
Accumulator variables: i
Iterator variables: i
Class/struct names: GFG
C# program:
using System ; class GFG { public static char flip ( char ch ) { return ( ch == '0' ) ? '1' : '0' ; } public static int getFlipWithStartingCharcter ( String str , char expected ) { int flipCount = 0 ; for ( int i = 0 ; i < str . Length ; i ++ ) { if ( str [ i ] != expected ) flipCount ++ ; expected = flip ( expected ) ; } return flipCount ; } public static int minFlipToMakeStringAlternate ( string str ) { return Math . Min ( getFlipWithStartingCharcter ( str , '0' ) , getFlipWithStartingCharcter ( str , '1' ) ) ; } public static void Main ( ) { string str = "0001010111" ; Console . Write ( minFlipToMakeStringAlternate ( str ) ) ; } }

Index/key variables: i
Accumulator variables: flipCount, i
Iterator variables: i
Class/struct names: GFG
C# program:
using System ; class GFG { static int remainderWith7 ( String num ) { int [ ] series = { 1 , 3 , 2 , - 1 , - 3 , - 2 } ; int series_index = 0 ; int result = 0 ; for ( int i = num . Length - 1 ; i >= 0 ; i -- ) { int digit = num [ i ] - '0' ; result += digit * series [ series_index ] ; series_index = ( series_index + 1 ) % 6 ; result %= 7 ; } if ( result < 0 ) result = ( result + 7 ) % 7 ; return result ; } public static void Main ( ) { String str = "12345" ; Console . Write ( " Remainder ▁ with ▁ 7 ▁ is ▁ " + remainderWith7 ( str ) ) ; } }

Index/key variables: i, series_index
Accumulator variables: i, result
Iterator variables: i
Class/struct names: GFG
C# program:
using System ; class GFG { static Boolean canBecomeEmpty ( String str , String sub_str ) { while ( str . Length > 0 ) { int idx = str . IndexOf ( sub_str ) ; if ( idx == - 1 ) { break ; } str = str . Replace ( sub_str , " " ) ; } return ( str . Length == 0 ) ; } public static void Main ( String [ ] args ) { String str = " GEEGEEKSKS " , sub_str = " GEEKS " ; if ( canBecomeEmpty ( str , sub_str ) ) { Console . Write ( " STRNEWLINE Yes " ) ; } else { Console . Write ( " STRNEWLINE No " ) ; } } }

Class/struct names: GFG
C# program:
using System ; class GFG { public static bool isReversible ( string str ) { int i = 0 , j = str . Length - 1 ; while ( i < j ) { if ( str [ i ] != str [ j ] ) { return false ; } i ++ ; j -- ; } return true ; } public static void Main ( string [ ] args ) { string str = " aba " ; if ( isReversible ( str ) ) { Console . Write ( " YES " ) ; } else { Console . Write ( " NO " ) ; } } }

Index/key variables: i, j
Accumulator variables: i, j
Class/struct names: GFG
C# program:
using System ; class GFG { static int CHAR_SIZE = 256 ; static bool checkPattern ( String str , String pat ) { int [ ] label = new int [ CHAR_SIZE ] ; for ( int i = 0 ; i < CHAR_SIZE ; i ++ ) label [ i ] = - 1 ; int order = 1 ; for ( int i = 0 ; i < pat . Length ; i ++ ) { label [ pat [ i ] ] = order ; order ++ ; } int last_order = - 1 ; for ( int i = 0 ; i < str . Length ; i ++ ) { if ( label [ str [ i ] ] != - 1 ) { if ( label [ str [ i ] ] < last_order ) return false ; last_order = label [ str [ i ] ] ; } } return true ; } public static void Main ( String [ ] args ) { String str = " engineers ▁ rock " ; String pattern = " gsr " ; Console . WriteLine ( checkPattern ( str , pattern ) ) ; } }

Index/key variables: CHAR_SIZE, i
Accumulator variables: i, order
Iterator variables: i
Class/struct names: GFG
C# program:
using System ; using System . Collections . Generic ; using System . Text ; class GFG { public static bool followsPattern ( String str , String pattern ) { HashSet < char > patternSet = new HashSet < char > ( ) ; for ( int i = 0 ; i < pattern . Length ; i ++ ) patternSet . Add ( pattern [ i ] ) ; StringBuilder modifiedString = new StringBuilder ( str ) ; for ( int i = str . Length - 1 ; i >= 0 ; i -- ) if ( ! patternSet . Contains ( modifiedString [ i ] ) ) modifiedString . Remove ( i , 1 ) ; for ( int i = modifiedString . Length - 1 ; i > 0 ; i -- ) if ( modifiedString [ i ] == modifiedString [ i - 1 ] ) modifiedString . Remove ( i , 1 ) ; if ( pattern . Length != modifiedString . Length ) return false ; for ( int i = 0 ; i < pattern . Length ; i ++ ) if ( pattern [ i ] != modifiedString [ i ] ) return false ; return true ; } public static void Main ( String [ ] args ) { String str = " engineers ▁ rock " ; String pattern = " er " ; Console . WriteLine ( " Expected : ▁ true , ▁ Actual : ▁ " + followsPattern ( str , pattern ) ) ; str = " engineers ▁ rock " ; pattern = " egr " ; Console . WriteLine ( " Expected : ▁ false , ▁ Actual : ▁ " + followsPattern ( str , pattern ) ) ; str = " engineers ▁ rock " ; pattern = " gsr " ; Console . WriteLine ( " Expected : ▁ false , ▁ Actual : ▁ " + followsPattern ( str , pattern ) ) ; str = " engineers ▁ rock " ; pattern = " eger " ; Console . WriteLine ( " Expected : ▁ true , ▁ Actual : ▁ " + followsPattern ( str , pattern ) ) ; } }

Index/key variables: i
Accumulator variables: i
Iterator variables: i
Class/struct names: GFG
C# program:
using System ; class GFG { static char encodedChar ( string str , int k ) { String expand = " " ; for ( int i = 0 ; i < str . Length ; ) { while ( i < str . Length && str [ i ] >= ' a ' && str [ i ] <= ' z ' ) { temp += str [ i ] ; i ++ ; } while ( i < str . Length && str [ i ] >= '1' && str [ i ] <= '9' ) { freq = freq * 10 + str [ i ] - '0' ; i ++ ; } for ( int j = 1 ; j <= freq ; j ++ ) expand += temp ; } if ( freq == 0 ) expand += temp ; return expand [ k - 1 ] ; } public static void Main ( ) { string str = " ab4c12ed3" ; int k = 21 ; Console . Write ( encodedChar ( str , k ) ) ; } }

Index/key variables: i
Accumulator variables: expand, i, j, temp
Iterator variables: i, j
Class/struct names: GFG
C# program:
using System ; class GFG { static String intToRoman ( int num ) { String [ ] m = { " " , " M " , " MM " , " MMM " } ; String [ ] c = { " " , " C " , " CC " , " CCC " , " CD " , " D " , " DC " , " DCC " , " DCCC " , " CM " } ; String [ ] x = { " " , " X " , " XX " , " XXX " , " XL " , " L " , " LX " , " LXX " , " LXXX " , " XC " } ; String [ ] i = { " " , " I " , " II " , " III " , " IV " , " V " , " VI " , " VII " , " VIII " , " IX " } ; String thousands = m [ num / 1000 ] ; String hundereds = c [ ( num % 1000 ) / 100 ] ; String tens = x [ ( num % 100 ) / 10 ] ; String ones = i [ num % 10 ] ; String ans = thousands + hundereds + tens + ones ; return ans ; } public static void Main ( ) { int number = 3549 ; Console . WriteLine ( intToRoman ( number ) ) ; } }

Class/struct names: GFG
C# program:
using System ; public class GFG { static int findMinLength ( string [ ] arr , int n ) { int min = int . MaxValue ; for ( int i = 0 ; i <= ( n - 1 ) ; i ++ ) { if ( arr [ i ] . Length < min ) { min = arr [ i ] . Length ; } } return min ; } static bool allContainsPrefix ( string [ ] arr , int n , string str , int start , int end ) { for ( int i = 0 ; i <= ( n - 1 ) ; i ++ ) { string arr_i = arr [ i ] ; for ( int j = start ; j <= end ; j ++ ) if ( arr_i [ j ] != str [ j ] ) return false ; } return true ; } static string commonPrefix ( string [ ] arr , int n ) { int index = findMinLength ( arr , n ) ; int low = 0 , high = index ; while ( low <= high ) { int mid = low + ( high - low ) / 2 ; if ( allContainsPrefix ( arr , n , arr [ 0 ] , low , mid ) ) { prefix = prefix + arr [ 0 ] . Substring ( low , mid + 1 ) ; low = mid + 1 ; } { high = mid - 1 ; } } return prefix ; } public static void Main ( ) { string [ ] arr = { " geeksforgeeks " , " geeks " , " geek " , " geezer " } ; int n = arr . Length ; string ans = commonPrefix ( arr , n ) ; if ( ans . Length > 0 ) Console . WriteLine ( " The ▁ longest ▁ common " + " ▁ prefix ▁ is ▁ - ▁ " + ans ) ; else Console . WriteLine ( " There ▁ is ▁ no ▁ common " + " ▁ prefix " ) ; } }

Index/key variables: i, j
Accumulator variables: i, j
Iterator variables: i, j
Class/struct names: GFG
C# program:
using System ; class GFG { static String to_upper ( char [ ] str ) { for ( int i = 0 ; i < str . Length ; i ++ ) if ( ' a ' <= str [ i ] && str [ i ] <= ' z ' ) str [ i ] = ( char ) ( ( int ) str [ i ] & ( ~ ( 1 << 5 ) ) ) ; return String . Join ( " " , str ) ; } public static void Main ( String [ ] args ) { String str = " geeksforgeeks " ; Console . WriteLine ( to_upper ( str . ToCharArray ( ) ) ) ; } }

Index/key variables: i
Accumulator variables: i
Iterator variables: i
Class/struct names: GFG
C# program:
using System ; class GFG { static string commonPrefixUtil ( string str1 , string str2 ) { string result = " " ; int n1 = str1 . Length , n2 = str2 . Length ; for ( int i = 0 , j = 0 ; i <= n1 - 1 && j <= n2 - 1 ; i ++ , j ++ ) { if ( str1 [ i ] != str2 [ j ] ) break ; result += str1 [ i ] ; } return ( result ) ; } static string commonPrefix ( string [ ] arr , int low , int high ) { if ( low == high ) return ( arr [ low ] ) ; if ( high > low ) { int mid = low + ( high - low ) / 2 ; string str1 = commonPrefix ( arr , low , mid ) ; string str2 = commonPrefix ( arr , mid + 1 , high ) ; return ( commonPrefixUtil ( str1 , str2 ) ) ; } return null ; } public static void Main ( ) { String [ ] arr = { " geeksforgeeks " , " geeks " , " geek " , " geezer " } ; int n = arr . Length ; String ans = commonPrefix ( arr , 0 , n - 1 ) ; if ( ans . Length != 0 ) { Console . Write ( " The ▁ longest ▁ common ▁ " + " prefix ▁ is ▁ " + ans ) ; } else { Console . Write ( " There ▁ is ▁ no ▁ common ▁ prefix " ) ; } } }

Index/key variables: i, j, low
Accumulator variables: i, j, result
Iterator variables: i
Class/struct names: GFG