dhyuti-n/xlcost-variable-roles huggingface dataset:
C# program:
using System ; class GFG { static double probability ( int [ ] arr1 , int [ ] arr2 ) { int N = arr1 . Length ; int M = arr2 . Length ; double res = 0 ; Array . Sort ( arr2 ) ; for ( int i = 0 ; i < N ; i ++ ) { int y = countGreater ( arr2 , arr1 [ i ] ) ; res += y ; } res = ( double ) res / ( double ) ( N * M ) ; return res ; } static int countGreater ( int [ ] arr , int k ) { int n = arr . Length ; int l = 0 ; int r = n - 1 ; int leftGreater = n ; while ( l <= r ) { int m = l + ( r - l ) / 2 ; if ( arr [ m ] > k ) { leftGreater = m ; r = m - 1 ; } else l = m + 1 ; } return ( n - leftGreater ) ; } public static void Main ( ) { int [ ] arr1 = { 5 , 2 , 6 , 1 } ; int [ ] arr2 = { 1 , 6 , 10 , 1 } ; Console . Write ( probability ( arr1 , arr2 ) ) ; } }

Index/key variables: i, m
Accumulator variables: i, res
Iterator variables: i
Class/struct names: GFG
C# program:
using System ; public class GFG { static void minCost ( char [ , ] arr , int A , int B ) { int n = arr . GetLength ( 0 ) ; int m = arr . GetLength ( 1 ) ; int ans = 0 ; for ( int i = 0 ; i < n ; i ++ ) { for ( int j = 0 ; j < m ; j ++ ) { if ( arr [ i , j ] == ' * ' ) continue ; if ( j == m - 1 ) ans += A ; else { if ( arr [ i , j + 1 ] == ' . ' ) { ans += Math . Min ( 2 * A , B ) ; j ++ ; } else ans += A ; } } } Console . WriteLine ( ans ) ; } static public void Main ( ) { char [ , ] arr = { { ' . ' , ' . ' , ' * ' } , { ' . ' , ' * ' , ' * ' } } ; int A = 2 , B = 10 ; minCost ( arr , A , B ) ; } }

Accumulator variables: ans, i, j
Iterator variables: i, j
Class/struct names: GFG
C# program:
using System ; using System . Collections . Generic ; class GFG { static void countInversions ( int [ ] arr , int n ) { List < int > v = new List < int > ( ) ; for ( int i = 1 ; i <= n ; i ++ ) { v . Add ( i ) ; } int ans = 0 ; for ( int i = 0 ; i < n ; i ++ ) { int itr = v . IndexOf ( arr [ i ] ) ; ans += itr ; v . RemoveAt ( itr ) ; } Console . WriteLine ( ans ) ; } public static void Main ( string [ ] args ) { int [ ] arr = { 2 , 3 , 1 , 5 , 4 } ; int n = arr . Length ; countInversions ( arr , n ) ; } }

Index/key variables: i
Accumulator variables: ans, i
Iterator variables: i
Class/struct names: GFG
C# program:
using System ; class GFG { static void findPairs ( int A , int B ) { for ( int i = 1 ; i <= B ; i ++ ) { int y = A ^ i ; if ( y > 0 && ( i y ) == B ) { Console . WriteLine ( i + " ▁ " + y ) ; } } } static void Main ( ) { int A = 8 , B = 10 ; findPairs ( A , B ) ; } }

Accumulator variables: i
Iterator variables: i
Class/struct names: GFG
C# program:
using System ; using System . Collections . Generic ; class GFG { static int binarysearch ( int [ ] array , int right , int element ) { int left = 1 ; while ( left <= right ) { int mid = ( left + right / 2 ) ; if ( array [ mid ] == element ) { return mid ; } if ( mid - 1 > 0 && array [ mid ] > element && array [ mid - 1 ] < element ) { return mid ; } else if ( array [ mid ] < element ) { left = mid + 1 ; } else { right = mid - 1 ; } } return 1 ; } static void countDistinct ( List < int > arr , int L , int R ) { int count = 0 ; int [ ] pref = new int [ arr . Count + 1 ] ; for ( int i = 1 ; i <= arr . Count ; ++ i ) { count += arr [ i - 1 ] ; pref [ i ] = count ; } int left = binarysearch ( pref , arr . Count + 1 , L ) ; int right = binarysearch ( pref , arr . Count + 1 , R ) ; Console . Write ( right - left + 1 ) ; } public static void Main ( ) { List < int > arr = new List < int > ( ) { 3 , 6 , 7 , 1 , 8 } ; int L = 3 ; int R = 7 ; countDistinct ( arr , L , R ) ; } }

Index/key variables: i, mid
Accumulator variables: count
Iterator variables: i
Class/struct names: GFG
C# program:
using System ; public class GFG { public static void countSubstrings ( string s ) { int n = s . Length ; int ans = 0 ; for ( int i = 0 ; i < n ; i ++ ) { int cnt = 0 ; for ( int j = i ; j < n ; j ++ ) { if ( s [ j ] == ' a ' ) cnt ++ ; else if ( s [ j ] == ' c ' ) cnt -- ; if ( cnt > 0 ) { ans ++ ; } } } Console . WriteLine ( ans ) ; } public static void Main ( string [ ] args ) { string S = " abccaab " ; countSubstrings ( S ) ; } }

Index/key variables: j
Accumulator variables: ans, cnt, i, j
Iterator variables: i, j
Class/struct names: GFG
C# program:
using System ; using System . Collections . Generic ; public class GFG { static bool ischar ( char x ) { if ( ( x >= ' A ' && x <= ' Z ' ) || ( x >= ' a ' && x <= ' z ' ) ) { return true ; } return false ; } static bool isnum ( char x ) { if ( x >= '0' && x <= '9' ) return true ; return false ; } static void findIdandDoMain ( String S , int N ) { String ID = " " , Domain = " " ; List < String > words = new List < String > ( ) ; String curr = " " ; for ( int i = 0 ; i < N ; i ++ ) { if ( S [ i ] == ' ▁ ' ) { words . Add ( curr ) ; curr = " " ; } else { if ( S [ i ] == ' . ' ) { if ( i + 1 == N || ( i + 1 < N && S [ i + 1 ] == ' ▁ ' ) ) continue ; } curr += S [ i ] ; } } if ( curr . Length > 0 ) words . Add ( curr ) ; foreach ( String ss in words ) { if ( ss . Length == 10 ) { bool flag = false ; for ( int j = 0 ; j <= 9 ; j ++ ) { if ( j >= 5 && j < 9 ) { if ( isnum ( ss [ j ] ) == false ) flag = true ; } else { if ( ischar ( ss [ j ] ) == false ) flag = true ; } } if ( ! flag ) { ID = ss ; } } if ( ss . Length > 2 && ss . Substring ( 0 , 3 ) . Equals ( " www " ) && ss . Substring ( ss . Length - 3 ) . Equals ( " com " ) ) { Domain = ss . Substring ( 4 , ss . Length - 4 ) ; } } Console . Write ( " ID ▁ = ▁ " + ID + " STRNEWLINE " ) ; Console . Write ( " Domain ▁ = ▁ " + Domain ) ; } public static void Main ( String [ ] args ) { String S = " We ▁ thank ▁ ABCDE1234F ▁ for ▁ visiting ▁ " + " us ▁ and ▁ buying ▁ products ▁ item ▁ AMZrr @ ! k . ▁ " + " For ▁ more ▁ offers , ▁ visit ▁ us ▁ at ▁ www . amazon . com " ; int N = S . Length ; findIdandDoMain ( S , N ) ; } }

Index/key variables: i, j
Accumulator variables: curr, i, j
Iterator variables: i, j, ss
Boolean variables: flag
Class/struct names: GFG
C# program:
using System ; class GFG { static bool isValid ( int [ ] weight , int n , int D , int mx ) { int st = 1 ; int sum = 0 ; for ( int i = 0 ; i < n ; i ++ ) { sum += weight [ i ] ; if ( sum > mx ) { st ++ ; sum = weight [ i ] ; } if ( st > D ) return false ; } return true ; } static void shipWithinDays ( int [ ] weight , int D , int n ) { int sum = 0 ; for ( int i = 0 ; i < n ; i ++ ) sum += weight [ i ] ; int s = weight [ 0 ] ; for ( int i = 1 ; i < n ; i ++ ) { s = Math . Max ( s , weight [ i ] ) ; } int e = sum ; int res = - 1 ; while ( s <= e ) { int mid = s + ( e - s ) / 2 ; if ( isValid ( weight , n , D , mid ) ) { res = mid ; e = mid - 1 ; } else s = mid + 1 ; } Console . WriteLine ( res ) ; } public static void Main ( ) { int [ ] weight = { 9 , 8 , 10 } ; int D = 3 ; int N = weight . Length ; shipWithinDays ( weight , D , N ) ; } }

Index/key variables: i
Accumulator variables: i, st, sum
Iterator variables: i
Class/struct names: GFG
C# program:
using System ; class GFG { public static int findSum ( int [ ] arr , int N , int pt ) { int sum = 0 ; for ( int i = 0 ; i < N ; i ++ ) { sum += Math . Abs ( arr [ i ] - pt ) ; } return sum ; } public static void findPoint ( int [ ] arr , int N , int K ) { int left ; if ( N % 2 != 0 ) { left = arr [ N / 2 ] ; } else { left = arr [ N / 2 - 1 ] + 1 ; } int right = arr [ N - 1 ] ; while ( left <= right ) { int mid = ( left + right ) / 2 ; int temp = findSum ( arr , N , mid ) ; if ( temp == K ) { Console . WriteLine ( mid ) ; return ; } else if ( K < temp ) { right = mid - 1 ; } else { left = mid + 1 ; } } left = arr [ 0 ] ; right = arr [ N / 2 ] - 1 ; while ( left <= right ) { int mid = ( left + right ) / 2 ; int temp = findSum ( arr , N , mid ) ; if ( temp == K ) { Console . WriteLine ( mid ) ; return ; } else if ( K > temp ) { right = mid - 1 ; } else { left = mid + 1 ; } } Console . WriteLine ( " - 1" ) ; } public static void Main ( string [ ] args ) { int [ ] arr = { 1 , 3 , 6 , 7 , 11 } ; int K = 18 ; int N = arr . Length ; findPoint ( arr , N , K ) ; } }

Index/key variables: i
Accumulator variables: i, sum
Iterator variables: i
Class/struct names: GFG
C# program:
using System ; using System . Collections . Generic ; class GFG { static void findArray ( int [ ] arr , int n ) { List < int > v = new List < int > ( ) ; for ( int i = 0 ; i < n ; i ++ ) { int ans = - 1 , old_c = 0 ; for ( int j = i + 1 ; j < n ; j ++ ) { if ( arr [ j ] > arr [ i ] ) { int curr_c = 0 ; for ( int k = j ; k < n ; k ++ ) { if ( arr [ k ] == arr [ j ] ) { curr_c ++ ; } } ; if ( curr_c == old_c ) { if ( arr [ j ] < ans ) ans = arr [ j ] ; } if ( curr_c > old_c ) { ans = arr [ j ] ; old_c = curr_c ; } } } v . Add ( ans ) ; } for ( int i = 0 ; i < v . Count ; i ++ ) Console . Write ( v [ i ] + " ▁ " ) ; } public static void Main ( ) { int [ ] arr = { 4 , 5 , 2 , 25 , 10 , 5 , 10 , 3 , 10 , 5 } ; int size = arr . Length ; findArray ( arr , size ) ; } }

Index/key variables: i, j, k
Accumulator variables: curr_c, i, j, k
Iterator variables: i, j, k
Class/struct names: GFG
C# program:
using System ; class GFG { static void prodEquilibrium ( int [ ] arr , int N ) { int product = 1 ; for ( int i = 0 ; i < N ; i ++ ) { product *= arr [ i ] ; } int left = 1 ; int right = product ; for ( int i = 0 ; i < N ; i ++ ) { left = left * arr [ i ] ; right = right / arr [ i ] ; if ( left == right ) { Console . WriteLine ( i + 1 + " STRNEWLINE " ) ; return ; } } Console . WriteLine ( - 1 + " STRNEWLINE " ) ; } public static void Main ( string [ ] args ) { int [ ] arr = { 1 , 2 , 3 , 3 , 2 , 1 } ; int N = arr . Length ; prodEquilibrium ( arr , N ) ; } }

Index/key variables: i
Accumulator variables: i, product
Iterator variables: i
Class/struct names: GFG
C# program:
using System ; using System . Collections . Generic ; class GFG { static int countTriplets ( int D , int [ ] arr ) { Dictionary < int , int > freq = new Dictionary < int , int > ( ) ; int ans = 0 ; for ( int i = 0 ; i < arr . Length ; i ++ ) { if ( freq . ContainsKey ( arr [ i ] - D ) && freq . ContainsKey ( arr [ i ] - 2 * D ) ) { ans += freq [ arr [ i ] - D ] * freq [ arr [ i ] - 2 * D ] ; } if ( ! freq . ContainsKey ( arr [ i ] ) ) freq [ arr [ i ] ] = 0 ; freq [ arr [ i ] ] ++ ; } return ans ; } public static void Main ( ) { int [ ] arr = { 1 , 2 , 4 , 5 , 7 , 8 , 10 } ; int D = 1 ; Console . WriteLine ( countTriplets ( D , arr ) ) ; } }

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 int find_index ( int [ ] arr , int N ) { int max_value = Int32 . MinValue ; for ( int i = 0 ; i < N ; i ++ ) { max_value = Math . Max ( max_value , arr [ i ] ) ; } Dictionary < int , int > store = new Dictionary < int , int > ( ) ; for ( int i = 1 ; i <= max_value ; i ++ ) { if ( ! store . ContainsKey ( i ) ) store [ i ] = 0 ; store [ i ] ++ ; } if ( store . ContainsKey ( 1 ) ) { store . Remove ( 1 ) ; } for ( int i = 2 ; i <= Math . Sqrt ( max_value ) ; i ++ ) { int multiple = 2 ; while ( ( i * multiple ) <= max_value ) { if ( store . ContainsKey ( i * multiple ) ) { store . Remove ( i * multiple ) ; } multiple ++ ; } } int prime_sum_from_left = 0 ; int [ ] first_array = new int [ N ] ; for ( int i = 0 ; i < N ; i ++ ) { first_array [ i ] = prime_sum_from_left ; if ( store . ContainsKey ( arr [ i ] ) ) { prime_sum_from_left += arr [ i ] ; } } int prime_sum_from_right = 0 ; int [ ] second_array = new int [ N ] ; for ( int i = N - 1 ; i >= 0 ; i -- ) { second_array [ i ] = prime_sum_from_right ; if ( store . ContainsKey ( arr [ i ] ) ) { prime_sum_from_right += arr [ i ] ; } } for ( int i = 0 ; i < N ; i ++ ) { if ( first_array [ i ] == second_array [ i ] ) { return i ; } } return - 1 ; } public static void Main ( ) { int [ ] arr = { 11 , 4 , 7 , 6 , 13 , 1 , 5 } ; int N = arr . Length ; Console . WriteLine ( find_index ( arr , N ) ) ; } }

Index/key variables: N, i
Accumulator variables: i, multiple, prime_sum_from_left, prime_sum_from_right
Iterator variables: i
Class/struct names: GFG
C# program:
using System ; class GFG { static void convert ( int [ ] arr , int n ) { int [ ] brr = new int [ n ] ; for ( int i = 0 ; i < n ; i ++ ) brr [ i ] = arr [ i ] ; Array . Sort ( brr ) ; for ( int i = 0 ; i < n ; i ++ ) { int l = 0 , r = n - 1 , mid ; while ( l <= r ) { mid = ( l + r ) / 2 ; if ( brr [ mid ] == arr [ i ] ) { Console . Write ( mid + " ▁ " ) ; break ; } else if ( brr [ mid ] < arr [ i ] ) { l = mid + 1 ; } else { r = mid - 1 ; } } } } public static void Main ( string [ ] args ) { int [ ] arr = { 10 , 20 , 15 , 12 , 11 , 50 } ; int N = arr . Length ; convert ( arr , N ) ; } }

Index/key variables: i, mid, n
Accumulator variables: i
Iterator variables: i
Class/struct names: GFG
C# program:
using System ; using System . Collections . Generic ; public class GFG { static int findIndex ( int [ ] arr , int N ) { int maxValue = Int32 . MinValue ; for ( int i = 0 ; i < N ; i ++ ) { maxValue = Math . Max ( maxValue , arr [ i ] ) ; } Dictionary < int , int > St = new Dictionary < int , int > ( ) ; for ( int i = 1 ; i <= maxValue ; i ++ ) { St . Add ( i , 1 ) ; } if ( St . ContainsKey ( 1 ) ) { St . Remove ( 1 ) ; } for ( int i = 2 ; i <= Math . Sqrt ( maxValue ) ; i ++ ) { int j = 2 ; while ( ( i * j ) <= maxValue ) { if ( St . ContainsKey ( i * j ) ) { St . Remove ( i * j ) ; } j ++ ; } } int LeftCount = 0 ; int [ ] Prefix = new int [ N ] ; for ( int i = 0 ; i < N ; i ++ ) { Prefix [ i ] = LeftCount ; if ( St . ContainsKey ( arr [ i ] ) ) { LeftCount ++ ; } } int RightCount = 0 ; int [ ] Suffix = new int [ N ] ; for ( int i = N - 1 ; i >= 0 ; i -- ) { Suffix [ i ] = RightCount ; if ( St . ContainsKey ( arr [ i ] ) ) { RightCount ++ ; } } for ( int i = 0 ; i < N ; i ++ ) { if ( Prefix [ i ] == Suffix [ i ] ) { return i ; } } return - 1 ; } static public void Main ( ) { int [ ] arr = { 2 , 3 , 4 , 7 , 5 , 10 , 1 , 8 } ; int N = arr . Length ; Console . WriteLine ( findIndex ( arr , N ) ) ; } }

Index/key variables: N, i
Accumulator variables: LeftCount, RightCount, i, j
Iterator variables: i
Class/struct names: GFG
C# program:
using System ; using System . Collections . Generic ; public class GFG { public static int getCountPairs ( int [ ] arr , int N , int S ) { int count = 0 ; for ( int i = 0 ; i < arr . Length ; i ++ ) { for ( int j = i + 1 ; j < arr . Length ; j ++ ) { if ( ( arr [ i ] + arr [ j ] ) == S ) count ++ ; } } return count ; } public static int countPairs ( int [ ] arr , int N ) { int count = 0 ; HashSet < int > S = new HashSet < int > ( ) ; for ( int i = 0 ; i < N ; i ++ ) S . Add ( arr [ i ] ) ; foreach ( int ele in S ) { int sum = 2 * ele ; count += getCountPairs ( arr , N , sum ) ; } return count ; } public static void Main ( String [ ] args ) { int [ ] arr = { 4 , 2 , 5 , 1 , 3 , 5 } ; int N = arr . Length ; Console . Write ( countPairs ( arr , N ) ) ; } }

Index/key variables: i, j
Accumulator variables: count, i, j
Iterator variables: ele, i, j
Class/struct names: GFG
C# program:
using System ; using System . Collections . Generic ; public class GFG { static bool isPowerOfTwo ( int n ) { if ( n == 0 ) return false ; return ( Math . Ceiling ( Math . Log ( n ) / Math . Log ( 2 ) ) == Math . Floor ( Math . Log ( n ) / Math . Log ( 2 ) ) ) ; } static void printArray ( List < string > res ) { ( res ) . Sort ( ) ; for ( int i = 0 ; i < res . Count ; i ++ ) { Console . Write ( res [ i ] + " ▁ " ) ; } } static void sortedStrings ( string [ ] S , int N ) { Dictionary < char , int > freq = new Dictionary < char , int > ( ) ; List < string > res = new List < string > ( ) ; for ( int i = 0 ; i < N ; i ++ ) { string st = " " ; for ( int j = 0 ; j < S [ i ] . Length ; j ++ ) { if ( ! freq . ContainsKey ( S [ i ] [ j ] ) ) freq . Add ( S [ i ] [ j ] , 0 ) ; freq [ S [ i ] [ j ] ] ++ ; } foreach ( KeyValuePair < char , int > ch in freq ) { if ( isPowerOfTwo ( freq [ ch . Key ] ) ) { for ( int j = 0 ; j < freq [ ch . Key ] ; j ++ ) { st += ch . Key ; } } } freq . Clear ( ) ; if ( st . Length == 0 ) continue ; char [ ] myCharArr = st . ToCharArray ( ) ; Array . Sort ( myCharArr ) ; string ns = " " ; for ( int j = myCharArr . Length - 1 ; j >= 0 ; -- j ) ns += myCharArr [ j ] ; res . Add ( ns ) ; } printArray ( res ) ; } static public void Main ( ) { string [ ] arr = { " aaacbb " , " geeks " , " aaa " } ; int N = arr . Length ; sortedStrings ( arr , N ) ; } }

Index/key variables: i, j
Accumulator variables: i, j, ns, st
Iterator variables: ch, i, j
Class/struct names: GFG
C# program:
using System ; public class GFG { static void replaceCharacters ( string s , char [ , ] p ) { int n = s . Length , k = p . GetLength ( 0 ) ; char [ ] arr = new char [ 26 ] ; char [ ] brr = new char [ 26 ] ; for ( int i = 0 ; i < n ; i ++ ) { arr [ s [ i ] - ' a ' ] = s [ i ] ; brr [ s [ i ] - ' a ' ] = s [ i ] ; } for ( int j = 0 ; j < k ; j ++ ) { char a = p [ j , 0 ] , b = p [ j , 1 ] ; for ( int i = 0 ; i < 26 ; i ++ ) { if ( arr [ i ] == a ) { brr [ i ] = b ; } } } for ( int i = 0 ; i < n ; i ++ ) { Console . Write ( brr [ s [ i ] - ' a ' ] ) ; } } static public void Main ( ) { String S = " aabbgg " ; char [ , ] P = { { ' a ' , ' b ' } , { ' b ' , ' g ' } , { ' g ' , ' a ' } } ; replaceCharacters ( S , P ) ; } }

Index/key variables: i
Accumulator variables: i, j
Iterator variables: i, j
Class/struct names: GFG
C# program:
using System ; class GFG { static int MAX = 100001 ; static void SieveOfEratosthenes ( bool [ ] prime ) { prime [ 0 ] = false ; prime [ 1 ] = false ; for ( int p = 2 ; p * p < MAX ; p ++ ) { if ( prime [ p ] == true ) { for ( int i = p * p ; i < MAX ; i += p ) prime [ i ] = false ; } } } static void smallestSemiPrime ( int n ) { bool [ ] prime = new bool [ MAX ] ; for ( int i = 0 ; i < prime . Length ; i ++ ) { prime [ i ] = true ; } SieveOfEratosthenes ( prime ) ; int num1 = n + 1 ; while ( prime [ num1 ] != true ) { num1 ++ ; } int num2 = num1 + n ; while ( prime [ num2 ] != true ) { num2 ++ ; } Console . Write ( num1 * num2 ) ; } static void Main ( ) { int N = 2 ; smallestSemiPrime ( N ) ; } }

Index/key variables: MAX, i, num1, num2, p
Accumulator variables: i, num1, num2, p
Iterator variables: i, p
Class/struct names: GFG
C# program:
using System ; using System . Collections . Generic ; class GFG { static void productOfTwoPerfectCubes ( int N ) { Dictionary < int , int > cubes = new Dictionary < int , int > ( ) ; for ( int i = 1 ; i * i * i <= N ; i ++ ) { cubes . Add ( i * i * i , i ) ; } foreach ( KeyValuePair < int , int > kvp in cubes ) { int firstNumber = kvp . Key ; if ( N % kvp . Key == 0 ) { int secondNumber = N / kvp . Key ; if ( cubes . ContainsKey ( secondNumber ) ) { Console . Write ( " Yes " ) ; return ; } } } Console . Write ( " No " ) ; } public static void Main ( ) { int N = 216 ; productOfTwoPerfectCubes ( N ) ; } }

Accumulator variables: i
Iterator variables: i, kvp
Class/struct names: GFG
C# program:
using System ; using System . Collections . Generic ; using System . Linq ; class GFG { public static void productOfTwoPerfectCubes ( double N ) { double cube_root ; cube_root = Math . Round ( Math . Cbrt ( N ) ) ; if ( cube_root * cube_root * cube_root == N ) { Console . Write ( " Yes " ) ; return ; } else { Console . Write ( " No " ) ; return ; } } static public void Main ( ) { double N = 216 ; productOfTwoPerfectCubes ( N ) ; } }

Class/struct names: GFG
C# program:
using System ; class GFG { static bool bound ( int w , int h , int N , int x ) { int val = ( x / w ) * ( x / h ) ; if ( val >= N ) return true ; else return false ; } static int FindSquare ( int N , int W , int H ) { int i = 1 ; int j = W * H * N ; while ( i < j ) { int mid = i + ( j - i ) / 2 ; if ( bound ( W , H , N , mid ) ) j = mid ; else i = mid + 1 ; } return j ; } public static void Main ( ) { int W = 2 ; int H = 3 ; int N = 10 ; Console . WriteLine ( FindSquare ( N , W , H ) ) ; } }

Class/struct names: GFG
C# program:
using System ; using System . Collections . Generic ; class GFG { static void printNumberOfPairs ( int N ) { HashSet < int > st = new HashSet < int > ( ) ; for ( int i = 2 ; i * i <= N ; i ++ ) { int x = i ; while ( x <= N ) { x *= i ; if ( x <= N ) { st . Add ( x ) ; } } } Console . WriteLine ( st . Count ) ; } public static void Main ( string [ ] args ) { int N = 10000 ; printNumberOfPairs ( N ) ; } }

Accumulator variables: i, x
Iterator variables: i
Class/struct names: GFG
C# program:
using System ; public class GFG { public static int countSetBits ( int n ) { int count = 0 ; while ( n > 0 ) { count += n & 1 ; n >>= 1 ; } return count ; } public static void maximumProduct ( string [ ] words ) { int [ ] bits = new int [ words . Length ] ; for ( int i = 0 ; i < words . Length ; i ++ ) { for ( int j = 0 ; j < words [ i ] . Length ; j ++ ) { bits [ i ] = bits [ i ] | 1 << ( words [ i ] [ j ] - ' a ' ) ; } } int result = 0 ; for ( int i = 0 ; i < bits . Length ; i ++ ) { for ( int j = i + 1 ; j < bits . Length ; j ++ ) { if ( ( bits [ i ] & bits [ j ] ) == 0 ) { int L = countSetBits ( bits [ i ] ) ; int R = countSetBits ( bits [ j ] ) ; result = Math . Max ( L * R , result ) ; } } } Console . WriteLine ( result ) ; } static public void Main ( ) { string [ ] arr = { " abcw " , " baz " , " foo " , " bar " , " xtfn " , " abcdef " } ; maximumProduct ( arr ) ; } }

Index/key variables: i, j
Accumulator variables: count, i, j
Iterator variables: i, j
Class/struct names: GFG
C# program:
using System ; using System . Collections . Generic ; class GFG { static bool palindrome ( string str ) { int st = 0 ; int ed = str . Length - 1 ; while ( st < ed ) { if ( str [ st ] == str [ ed ] ) { st ++ ; ed -- ; } else return false ; } return true ; } static void printReverse ( string sentence ) { List < string > newlist = new List < string > ( ) ; List < string > lis = new List < string > ( ) ; string temp = " " ; foreach ( char x in sentence ) { if ( x == ' ▁ ' ) { lis . Add ( temp ) ; temp = " " ; } else temp += x ; } lis . Add ( temp ) ; foreach ( string x in lis ) { if ( palindrome ( x ) ) newlist . Add ( x ) ; } newlist . Reverse ( ) ; int j = 0 ; for ( int i = 0 ; i < lis . Count ; i ++ ) { if ( palindrome ( lis [ i ] ) ) { lis [ i ] = newlist [ j ] ; j = j + 1 ; } } foreach ( string x in lis ) Console . Write ( x + " ▁ " ) ; } public static void Main ( ) { string sentence = " mom ▁ and ▁ dad ▁ went ▁ to ▁ eye ▁ hospital " ; printReverse ( sentence ) ; } }

Index/key variables: ed, i, j, st
Accumulator variables: ed, i, st, temp
Iterator variables: i, x
Class/struct names: GFG
C# program:
using System ; class GFG { static int minCount ( int [ ] A , int [ ] B , int N ) { int i = 0 ; for ( int j = 0 ; j < N ; j ++ ) { if ( A [ i ] == B [ j ] ) { i ++ ; } } return N - i ; } public static void Main ( string [ ] args ) { int [ ] A = { 1 , 2 , 3 , 4 , 5 } ; int [ ] B = { 1 , 5 , 2 , 3 , 4 } ; int N = A . Length ; Console . WriteLine ( minCount ( A , B , N ) ) ; } }

Index/key variables: i, j
Accumulator variables: i, j
Iterator variables: j
Class/struct names: GFG
C# program:
using System ; class GFG { static bool possible ( int [ ] A , int N , int mid , int K ) { int count = 0 ; for ( int i = 0 ; i < N ; i ++ ) { count += ( A [ i ] - 1 ) / mid ; } return count <= K ; } static int minimumMaximum ( int [ ] A , int N , int K ) { int lo = 1 ; Array . Sort ( A ) ; int hi = A [ N - 1 ] ; int mid ; while ( lo < hi ) { mid = ( lo + hi ) / 2 ; if ( possible ( A , N , mid , K ) ) { hi = mid ; } else { lo = mid + 1 ; } } return hi ; } public static void Main ( string [ ] args ) { int [ ] arr = { 2 , 4 , 8 , 2 } ; int K = 4 ; int N = arr . Length ; Console . WriteLine ( minimumMaximum ( arr , N , K ) ) ; } }

Index/key variables: i
Accumulator variables: count, i
Iterator variables: i
Class/struct names: GFG
C# program:
using System ; using System . Collections . Generic ; class GFG { static void maximumNumber ( int [ ] arr , int N , int K ) { int mn = 100000000 ; for ( int i = 0 ; i < N ; i ++ ) { if ( arr [ i ] < mn ) mn = arr [ i ] ; } int ans = mn + K ; for ( int i = 0 ; i < N ; i ++ ) { if ( Math . Abs ( arr [ i ] - ans ) > K ) { ans = - 1 ; break ; } } Console . Write ( ans ) ; } public static void Main ( ) { int [ ] arr = { 1 , 2 , 5 } ; int K = 2 ; int N = arr . Length ; maximumNumber ( arr , N , K ) ; } }

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