dhyuti-n/xlcost-variable-roles huggingface dataset:
C# program:
using System ; class GFG { static readonly int MAXN = 1000005 ; static int [ ] even = new int [ MAXN ] ; static int [ ] odd = new int [ MAXN ] ; static void precompute ( int [ ] arr , int n ) { for ( int i = 0 ; i < n ; i ++ ) { if ( arr [ i ] % 2 == 1 ) odd [ i ] = 1 ; if ( arr [ i ] % 2 == 0 ) even [ i ] = 1 ; } for ( int i = 1 ; i < n ; i ++ ) { even [ i ] = even [ i ] + even [ i - 1 ] ; odd [ i ] = odd [ i ] + odd [ i - 1 ] ; } } static bool isOdd ( int L , int R ) { int cnt = odd [ R ] ; if ( L > 0 ) cnt -= odd [ L - 1 ] ; if ( cnt == R - L + 1 ) return true ; return false ; } static void performQueries ( int [ ] a , int n , int [ , ] q , int m ) { precompute ( a , n ) ; for ( int i = 0 ; i < m ; i ++ ) { int L = q [ i , 0 ] , R = q [ i , 1 ] ; if ( isOdd ( L , R ) ) Console . WriteLine ( " Odd " ) ; else Console . WriteLine ( " Even " ) ; } } public static void Main ( String [ ] args ) { int [ ] a = { 2 , 1 , 5 , 7 , 6 , 8 , 9 } ; int n = a . Length ; int [ , ] q = { { 0 , 2 } , { 1 , 2 } , { 2 , 3 } , { 3 , 6 } } ; int m = q . GetLength ( 0 ) ; performQueries ( a , n , q , m ) ; } }

Index/key variables: MAXN, R, i
Accumulator variables: cnt, i
Iterator variables: i
Class/struct names: GFG
C# program:
using System ; using System . Collections . Generic ; class GFG { static void findTriplets ( int x ) { List < int > fact = new List < int > ( ) ; HashSet < int > factors = new HashSet < int > ( ) ; for ( int i = 2 ; i <= Math . Sqrt ( x ) ; i ++ ) { if ( x % i == 0 ) { fact . Add ( i ) ; if ( x / i != i ) fact . Add ( x / i ) ; factors . Add ( i ) ; factors . Add ( x / i ) ; } } bool found = false ; int k = fact . Count ; for ( int i = 0 ; i < k ; i ++ ) { int a = fact [ i ] ; for ( int j = 0 ; j < k ; j ++ ) { int b = fact [ j ] ; if ( ( a != b ) && ( x % ( a * b ) == 0 ) && ( x / ( a * b ) != a ) && ( x / ( a * b ) != b ) && ( x / ( a * b ) != 1 ) ) { Console . Write ( a + " ▁ " + b + " ▁ " + ( x / ( a * b ) ) ) ; found = true ; break ; } } if ( found ) break ; } if ( ! found ) Console . Write ( " - 1" ) ; } public static void Main ( String [ ] args ) { int x = 105 ; findTriplets ( x ) ; } }

Index/key variables: i, j
Accumulator variables: i, j
Iterator variables: i, j
Boolean variables: found
Class/struct names: GFG
C# program:
using System ; class GFG { static int countPair ( int a , int b ) { String s = String . Join ( " " , b ) ; int i ; for ( i = 0 ; i < s . Length ; i ++ ) { if ( s [ i ] != '9' ) break ; } int result ; if ( i == s . Length ) result = a * s . Length ; else result = a * ( s . Length - 1 ) ; return result ; } public static void Main ( String [ ] args ) { int a = 5 , b = 101 ; Console . Write ( countPair ( a , b ) ) ; } }

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 List < int > makeSeq ( String s , int [ ] a ) { List < int > seq = new List < int > ( ) ; for ( int i = 0 ; i < s . Length ; i ++ ) if ( s [ i ] == ' A ' ) seq . Add ( a [ i ] ) ; for ( int i = 0 ; i < s . Length ; i ++ ) if ( s [ i ] == ' B ' ) seq . Add ( a [ i ] ) ; return seq ; } static bool checkSeq ( List < int > v ) { bool check = true ; for ( int i = 1 ; i < v . Count ; i ++ ) if ( v [ i ] < v [ i - 1 ] ) check = false ; return check ; } static String digitPartition ( int X ) { String num = String . Join ( " " , X ) ; int l = num . Length ; int [ ] a = new int [ l ] ; for ( int i = 0 ; i < l ; i ++ ) a [ i ] = ( num [ i ] - '0' ) ; for ( int D = 0 ; D < 10 ; D ++ ) { String res = " " ; for ( int i = 0 ; i < l ; i ++ ) { if ( a [ i ] < D ) res += ' A ' ; else if ( a [ i ] > D ) res += ' B ' ; else res += ' C ' ; } bool flag = false ; for ( int i = 0 ; i < l ; i ++ ) { if ( res [ i ] == ' B ' ) flag = true ; if ( res [ i ] == ' C ' ) res = res . Substring ( 0 , i ) + ( flag ? ' A ' : ' B ' ) + res . Substring ( i + 1 ) ; } List < int > seq = makeSeq ( res , a ) ; if ( checkSeq ( seq ) ) return res ; } return " - 1" ; } public static void Main ( String [ ] args ) { int X = 777147777 ; Console . Write ( digitPartition ( X ) ) ; } }

Index/key variables: i, l
Accumulator variables: D, i, res
Iterator variables: D, i
Boolean variables: check, flag
Class/struct names: GFG
C# program:
using System ; class GFG { static float getArea ( int a ) { float area = ( float ) ( Math . PI * a * a ) / 4 ; return area ; } public static void Main ( ) { int a = 3 ; Console . Write ( getArea ( a ) ) ; } }

Class/struct names: GFG
C# program:
using System ; class GFG { static bool flipsPossible ( int [ ] a , int n ) { int count_odd = 0 , count_even = 0 ; for ( int i = 0 ; i < n ; i ++ ) { if ( ( a [ i ] & 1 ) == 1 ) count_odd ++ ; else count_even ++ ; } if ( count_odd % 2 == 1 && count_even % 2 == 1 ) return false ; else return true ; } public static void Main ( String [ ] args ) { int [ ] a = { 1 , 0 , 1 , 1 , 0 , 1 } ; int n = a . Length ; if ( flipsPossible ( a , n ) ) Console . WriteLine ( " Yes " ) ; else Console . WriteLine ( " No " ) ; } }

Index/key variables: i
Accumulator variables: count_even, count_odd, i
Iterator variables: i
Class/struct names: GFG
C# program:
using System ; using System . Collections . Generic ; class GFG { static void PerformQueries ( int [ ] a , int [ , ] vec ) { List < int > ans = new List < int > ( ) ; int n = ( int ) a . Length - 1 ; int q = ( int ) vec . GetLength ( 0 ) ; for ( int i = 0 ; i < q ; ++ i ) { long t = vec [ i , 0 ] ; int m = vec [ i , 1 ] ; if ( m > n ) { ans . Add ( - 1 ) ; continue ; } int turn = ( int ) ( t / n ) ; int rem = ( int ) ( t % n ) ; if ( rem == 0 && turn % 2 == 1 ) { ans . Add ( - 1 ) ; continue ; } if ( rem == 0 && turn % 2 == 0 ) { ans . Add ( a [ m ] ) ; continue ; } if ( turn % 2 == 0 ) { int cursize = n - rem ; if ( cursize < m ) { ans . Add ( - 1 ) ; continue ; } ans . Add ( a [ m + rem ] ) ; } else { int cursize = rem ; if ( cursize < m ) { ans . Add ( - 1 ) ; continue ; } ans . Add ( a [ m ] ) ; } } foreach ( int i in ans ) Console . Write ( i + " STRNEWLINE " ) ; } public static void Main ( String [ ] args ) { int [ ] a = { - 1 , 1 , 2 , 3 , 4 , 5 } ; int [ , ] vec = { { 1 , 4 } , { 6 , 1 } , { 3 , 5 } } ; PerformQueries ( a , vec ) ; } }

Index/key variables: m
Iterator variables: i
Class/struct names: GFG
C# program:
using System ; class GFG { static int sumEqualProduct ( int [ ] a , int n ) { int zero = 0 , two = 0 ; for ( int i = 0 ; i < n ; i ++ ) { if ( a [ i ] == 0 ) { zero ++ ; } if ( a [ i ] == 2 ) { two ++ ; } } int cnt = ( zero * ( zero - 1 ) ) / 2 + ( two * ( two - 1 ) ) / 2 ; return cnt ; } public static void Main ( String [ ] args ) { int [ ] a = { 2 , 2 , 3 , 4 , 2 , 6 } ; int n = a . Length ; Console . Write ( sumEqualProduct ( a , n ) ) ; } }

Index/key variables: i
Accumulator variables: i, two, zero
Iterator variables: i
Class/struct names: GFG
C# program:
using System ; class GFG { static int minSum ( int n ) { int sum = 0 ; while ( n > 0 ) { sum += ( n % 10 ) ; n /= 10 ; } if ( sum == 1 ) return 10 ; return sum ; } public static void Main ( String [ ] args ) { int n = 1884 ; Console . Write ( minSum ( n ) ) ; } }

Accumulator variables: n, sum
Class/struct names: GFG
C# program:
using System ; class GFG { static void initialize ( int [ ] mul , int [ ] div , int size ) { for ( int i = 1 ; i < size ; i ++ ) { mul [ i ] = ( mul [ i ] * mul [ i - 1 ] ) / div [ i ] ; } } static void update ( int l , int r , int x , int [ ] mul , int [ ] div ) { mul [ l ] *= x ; div [ r + 1 ] *= x ; } static void printArray ( int [ ] ar , int [ ] mul , int [ ] div , int n ) { for ( int i = 0 ; i < n ; i ++ ) { ar [ i ] = ar [ i ] * mul [ i ] ; Console . Write ( ar [ i ] + " ▁ " ) ; } } public static void Main ( String [ ] args ) { int [ ] ar = { 10 , 5 , 20 , 40 } ; int n = ar . Length ; int [ ] mul = new int [ n + 1 ] ; int [ ] div = new int [ n + 1 ] ; for ( int i = 0 ; i < n + 1 ; i ++ ) { mul [ i ] = div [ i ] = 1 ; } update ( 0 , 1 , 10 , mul , div ) ; update ( 1 , 3 , 20 , mul , div ) ; update ( 2 , 2 , 2 , mul , div ) ; initialize ( mul , div , n + 1 ) ; printArray ( ar , mul , div , n ) ; } }

Index/key variables: i, l
Accumulator variables: i
Iterator variables: i
Class/struct names: GFG
C# program:
using System ; class GFG { static String getWinner ( String str , int len ) { int total = 0 ; for ( int i = 0 ; i < len ; i ++ ) { if ( str [ i ] == ' S ' ) { total ++ ; } } if ( ( total % 2 ) == 1 ) return " First " ; return " Second " ; } public static void Main ( string [ ] args ) { string str = " GSSS " ; int len = str . Length ; Console . WriteLine ( getWinner ( str , len ) ) ; } }

Index/key variables: i
Accumulator variables: i, total
Iterator variables: i
Class/struct names: GFG
C# program:
using System ; class GFG { static readonly long MAX = 1000000000 ; static void findTriangle ( long S ) { long X1 = 0 , Y1 = 0 ; long X2 = MAX , Y2 = 1 ; long X3 = ( MAX - S % MAX ) % MAX ; long Y3 = ( S + X3 ) / MAX ; Console . WriteLine ( " ( " + X1 + " , ▁ " + Y1 + " ) " ) ; Console . WriteLine ( " ( " + X2 + " , ▁ " + Y2 + " ) " ) ; Console . WriteLine ( " ( " + X3 + " , ▁ " + Y3 + " ) " ) ; } public static void Main ( String [ ] args ) { long S = 4 ; findTriangle ( S ) ; } }

Class/struct names: GFG
C# program:
using System ; using System . Linq ; class GFG { static void printArr ( int [ ] arr , int n ) { for ( int i = 0 ; i < n ; i ++ ) Console . Write ( arr [ i ] + " ▁ " ) ; } static void findArrangement ( int [ ] arr , int n ) { if ( n < 2 ) { Console . Write ( " - 1" ) ; return ; } int minVal = arr . Min ( ) ; for ( int i = 0 ; i < n ; i ++ ) { if ( arr [ i ] == minVal ) { swap ( arr , i , n - 1 ) ; break ; } } int andVal = arr [ 0 ] ; for ( int i = 1 ; i < n - 1 ; i ++ ) { andVal &= arr [ i ] ; } if ( andVal == arr [ n - 1 ] ) printArr ( arr , n ) ; else Console . Write ( " - 1" ) ; } static int [ ] swap ( int [ ] arr , int i , int j ) { int temp = arr [ i ] ; arr [ i ] = arr [ j ] ; arr [ j ] = temp ; return arr ; } public static void Main ( String [ ] args ) { int [ ] arr = { 1 , 5 , 3 , 3 } ; int n = arr . Length ; findArrangement ( arr , n ) ; } }

Index/key variables: i, j
Accumulator variables: andVal, i
Iterator variables: i
Class/struct names: GFG
C# program:
using System ; class GFG { static int maxOperations ( int X , int Y ) { if ( X > Y ) return - 1 ; int diff = Y - X ; if ( diff == 1 ) return - 1 ; if ( diff % 2 == 0 ) return ( diff / 2 ) ; return ( 1 + ( ( diff - 3 ) / 2 ) ) ; } public static void Main ( String [ ] args ) { int X = 5 , Y = 16 ; Console . WriteLine ( maxOperations ( X , Y ) ) ; } }

Class/struct names: GFG
C# program:
using System ; class GFG { readonly static int DIGITS = 10 ; readonly static int MAX = 10000 ; readonly static int MOD = 1000000007 ; static int [ , ] dp = new int [ MAX , DIGITS ] ; static int [ , ] cnt = new int [ MAX , DIGITS ] ; static void precompute ( ) { for ( int i = 0 ; i < DIGITS ; i ++ ) { dp [ 1 , i ] = i ; cnt [ 1 , i ] = 1 ; } for ( int i = 2 ; i < MAX ; i ++ ) { for ( int j = 0 ; j < DIGITS ; j ++ ) { for ( int k = 0 ; k < DIGITS ; k ++ ) { if ( j != k ) { dp [ i , j ] = dp [ i , j ] + ( dp [ i - 1 , k ] + ( cnt [ i - 1 , k ] * j ) % MOD ) % MOD ; dp [ i , j ] %= MOD ; cnt [ i , j ] += cnt [ i - 1 , k ] ; cnt [ i , j ] %= MOD ; } } } } } public static void Main ( String [ ] args ) { int x = 6 , y = 4 ; precompute ( ) ; Console . WriteLine ( dp [ x , y ] ) ; } }

Accumulator variables: i, j, k
Iterator variables: i, j, k
Class/struct names: GFG
C# program:
using System ; class GFG { static int N = 10000 ; static int MOD = 1000000007 ; static int [ ] F = new int [ N ] ; static void precompute ( ) { F [ 1 ] = 2 ; F [ 2 ] = 3 ; F [ 3 ] = 4 ; for ( int i = 4 ; i < N ; i ++ ) F [ i ] = ( F [ i - 1 ] + F [ i - 2 ] ) % MOD ; } public static void Main ( String [ ] args ) { int n = 8 ; precompute ( ) ; Console . WriteLine ( F [ n ] ) ; } }

Index/key variables: N, i, n
Accumulator variables: i
Iterator variables: i
Class/struct names: GFG
C# program:
using System ; class GFG { static int maxSubArraySum ( int [ ] a , int size ) { int max_so_far = int . MinValue , max_ending_here = 0 ; for ( int i = 0 ; i < size ; i ++ ) { max_ending_here = max_ending_here + a [ i ] ; if ( max_so_far < max_ending_here ) max_so_far = max_ending_here ; if ( max_ending_here < 0 ) max_ending_here = 0 ; } return max_so_far ; } static double minimizedSum ( int [ ] a , int n , int K ) { int sum = maxSubArraySum ( a , n ) ; double totalSum = 0 ; for ( int i = 0 ; i < n ; i ++ ) totalSum += a [ i ] ; if ( sum < 0 ) return totalSum ; totalSum = totalSum - sum + ( double ) sum / ( double ) K ; return totalSum ; } public static void Main ( String [ ] args ) { int [ ] a = { 1 , - 2 , 3 } ; int n = a . Length ; int K = 2 ; Console . WriteLine ( minimizedSum ( a , n , K ) ) ; } }

Index/key variables: i
Accumulator variables: i, totalSum
Iterator variables: i
Class/struct names: GFG
C# program:
using System ; class GFG { static int findMin ( int N ) { int digit = N % 10 ; switch ( digit ) { case 0 : if ( N >= 90 ) return 10 ; break ; case 1 : if ( N >= 81 ) return 9 ; break ; case 2 : if ( N >= 72 ) return 8 ; break ; case 3 : if ( N >= 63 ) return 7 ; break ; case 4 : if ( N >= 54 ) return 6 ; break ; case 5 : if ( N >= 45 ) return 5 ; break ; case 6 : if ( N >= 36 ) return 4 ; break ; case 7 : if ( N >= 27 ) return 3 ; break ; case 8 : if ( N >= 18 ) return 2 ; break ; case 9 : if ( N >= 9 ) return 1 ; break ; } return - 1 ; } public static void Main ( String [ ] args ) { int N = 27 ; Console . WriteLine ( findMin ( N ) ) ; } }

Class/struct names: GFG
C# program:
using System ; class GFG { static void printArr ( int [ ] arr , int n ) { for ( int i = 0 ; i < n ; i ++ ) Console . Write ( arr [ i ] + " ▁ " ) ; } static void randomList ( int m , int n ) { int [ ] arr = new int [ m ] ; for ( int i = 0 ; i < n ; i ++ ) { Random rnd = new Random ( ) ; arr [ rnd . Next ( 0 , n ) % m ] ++ ; } printArr ( arr , m ) ; } public static void Main ( ) { int m = 4 , n = 8 ; randomList ( m , n ) ; } }

Index/key variables: i, m
Accumulator variables: i
Iterator variables: i
Class/struct names: GFG
C# program:
using System ; class GFG { static int maxPartition ( string s ) { int n = s . Length , P = 0 ; string current = " " , previous = " " ; for ( int i = 0 ; i < n ; i ++ ) { current += s [ i ] ; if ( ! current . Equals ( previous ) ) { previous = current ; current = " " ; P ++ ; } } return P ; } public static void Main ( ) { string s = " geeksforgeeks " ; int ans = maxPartition ( s ) ; Console . WriteLine ( ans ) ; } }

Index/key variables: i
Accumulator variables: P, current, i
Iterator variables: i
Class/struct names: GFG
C# program:
using System ; class GFG { public static void Main ( String [ ] args ) { int N = 4 , i , j , min ; Console . WriteLine ( " Value ▁ of ▁ N : ▁ " + N ) ; for ( i = 1 ; i <= N ; i ++ ) { for ( j = 1 ; j <= N ; j ++ ) { min = i < j ? i : j ; Console . Write ( N - min + 1 ) ; } for ( j = N - 1 ; j >= 1 ; j -- ) { min = i < j ? i : j ; Console . Write ( N - min + 1 ) ; } Console . WriteLine ( ) ; } } }

Accumulator variables: i, j
Iterator variables: i, j
Class/struct names: GFG
C# program:
using System ; using System . Collections . Generic ; class GFG { static int findMissingPositive ( int [ ] arr , int n ) { int m = 1 ; HashSet < int > x = new HashSet < int > ( ) ; for ( int i = 0 ; i < n ; i ++ ) { if ( m < arr [ i ] ) { x . Add ( arr [ i ] ) ; } else if ( m == arr [ i ] ) { m = m + 1 ; while ( x . Contains ( m ) ) { x . Remove ( m ) ; m = m + 1 ; } } } return m ; } public static void Main ( String [ ] args ) { int [ ] arr = { 2 , 3 , - 7 , 6 , 8 , 1 , - 10 , 15 } ; int n = arr . Length ; Console . WriteLine ( findMissingPositive ( arr , n ) ) ; } }

Index/key variables: i
Accumulator variables: i
Iterator variables: i
Class/struct names: GFG
C# program:
using System ; class GFG { static bool prime ( int n ) { if ( n == 1 ) return false ; for ( int i = 2 ; i * i <= n ; ++ i ) if ( n % i == 0 ) return false ; return true ; } static int Min_Sum ( int n ) { if ( prime ( n ) ) return 1 ; if ( n % 2 == 0 ) return 2 ; else { if ( prime ( n - 2 ) ) return 2 ; else return 3 ; } } public static void Main ( ) { int n = 27 ; Console . WriteLine ( Min_Sum ( n ) ) ; } }

Iterator variables: i
Class/struct names: GFG
C# program:
using System ; class GFG { static int find_maximum_value ( int [ ] a , int n ) { int sum = 0 ; int minimum = int . MaxValue ; int pos = 0 , neg = 0 ; for ( int i = 0 ; i < n ; i ++ ) { minimum = Math . Min ( minimum , Math . Abs ( a [ i ] ) ) ; sum += Math . Abs ( a [ i ] ) ; if ( a [ i ] >= 0 ) pos += 1 ; else neg += 1 ; } if ( pos > 0 && neg > 0 ) return sum ; return ( sum - 2 * minimum ) ; } static public void Main ( ) { int [ ] a = { 5 , 4 , 6 , 2 } ; int n = a . Length ; Console . WriteLine ( find_maximum_value ( a , n ) ) ; } }

Index/key variables: i
Accumulator variables: i, neg, pos, sum
Iterator variables: i
Class/struct names: GFG
C# program:
using System ; class GFG { static String find_number ( int N , int K ) { String r ; if ( N % 100 == 0 ) { N += 1 ; r = N . ToString ( ) ; } else { r = N . ToString ( ) ; } for ( int i = 1 ; i <= K ; i ++ ) r += "00" ; return r ; } public static void Main ( String [ ] args ) { int N = 1000 , K = 2 ; String ans = find_number ( N , K ) ; Console . WriteLine ( ans ) ; } }

Accumulator variables: N, i, r
Iterator variables: i
Class/struct names: GFG
C# program:
using System ; using System . Collections . Generic ; class GFG { static int countPairs ( String s ) { HashSet < char > st = new HashSet < char > ( ) ; st . Add ( ' a ' ) ; st . Add ( ' e ' ) ; st . Add ( ' i ' ) ; st . Add ( ' o ' ) ; st . Add ( ' u ' ) ; int count = 0 ; int n = s . Length ; for ( int i = 0 ; i < n - 1 ; i ++ ) { if ( st . Contains ( s [ i ] ) && ! st . Contains ( s [ i + 1 ] ) ) count ++ ; } return count ; } public static void Main ( String [ ] args ) { String s = " geeksforgeeks " ; Console . Write ( countPairs ( s ) ) ; } }

Index/key variables: i
Accumulator variables: count, i
Iterator variables: i
Class/struct names: GFG
C# program:
using System ; class GFG { static void solve ( int d1 , int d2 , int d3 ) { int maxx = Math . Max ( d1 , Math . Max ( d2 , d3 ) ) ; int sum = ( d1 + d2 + d3 ) ; if ( 2 * maxx > sum sum % 2 == 1 ) { Console . WriteLine ( " - 1" ) ; return ; } int x1 = 0 , y1 = 0 ; int x2 = d1 , y2 = 0 ; int x3 = ( d1 + d2 - d3 ) / 2 ; int y3 = ( d2 + d3 - d1 ) / 2 ; Console . WriteLine ( " ( " + x1 + " , ▁ " + y1 + " ) , ▁ ( " + x2 + " , ▁ " + y2 + " ) ▁ and ▁ ( " + x3 + " , ▁ " + y3 + " ) " ) ; } static void Main ( ) { int d1 = 3 , d2 = 4 , d3 = 5 ; solve ( d1 , d2 , d3 ) ; } }

Class/struct names: GFG
C# program:
using System ; using System . Collections . Generic ; class GFG { static int maxSize ( List < int > v , int n ) { v . Add ( 0 ) ; v . Add ( 100001 ) ; n += 2 ; v . Sort ( ) ; int mx = 0 ; for ( int i = 1 ; i < n - 1 ; i ++ ) { int L = v [ i - 1 ] + 1 ; int R = v [ i + 1 ] - 1 ; int cnt = R - L + 1 ; mx = Math . Max ( mx , cnt ) ; } return mx ; } public static void Main ( String [ ] args ) { int [ ] arr = { 200 , 10 , 5 } ; List < int > v = new List < int > ( arr ) ; int n = v . Count ; Console . WriteLine ( maxSize ( v , n ) ) ; } }

Accumulator variables: i, n
Iterator variables: i
Class/struct names: GFG
C# program:
using System ; class GFG { static int maxLength ( int [ ] a , int n ) { int sum = 0 , len = 0 ; for ( int i = 0 ; i < n ; i ++ ) { sum += a [ i ] ; } { return n ; } for ( int i = 0 ; i < n ; i ++ ) { if ( a [ i ] % 2 == 1 ) { len = Math . Max ( len , Math . Max ( n - i - 1 , i ) ) ; } } return len ; } static public void Main ( ) { int [ ] a = { 1 , 2 , 3 , 2 } ; int n = a . Length ; Console . WriteLine ( maxLength ( a , n ) ) ; } }

Index/key variables: i
Accumulator variables: i, sum
Iterator variables: i
Class/struct names: GFG
C# program:
using System ; class GFG { static void solve ( long n ) { long [ , ] initial_array = new long [ ( int ) n - 1 , ( int ) n - 1 ] ; long [ , ] final_array = new long [ ( int ) n , ( int ) n ] ; for ( long i = 0 ; i < n - 1 ; ++ i ) initial_array [ 0 , ( int ) i ] = i + 1 ; for ( long i = 1 ; i < n - 1 ; ++ i ) for ( long j = 0 ; j < n - 1 ; ++ j ) initial_array [ ( int ) i , ( int ) j ] = initial_array [ ( int ) i - 1 , ( int ) ( ( int ) j + 1 ) % ( ( int ) n - 1 ) ] ; for ( long i = 0 ; i < n - 1 ; ++ i ) for ( long j = 0 ; j < n - 1 ; ++ j ) final_array [ ( int ) i , ( int ) j ] = initial_array [ ( int ) i , ( int ) j ] ; for ( long i = 0 ; i < n ; ++ i ) final_array [ ( int ) i , ( int ) n - 1 ] = final_array [ ( int ) n - 1 , ( int ) i ] = 0 ; for ( long i = 0 ; i < n ; ++ i ) { long t0 = final_array [ ( int ) i , ( int ) i ] ; long t1 = final_array [ ( int ) i , ( int ) n - 1 ] ; long s = final_array [ ( int ) i , ( int ) i ] ; final_array [ ( int ) i , ( int ) i ] = final_array [ ( int ) i , ( int ) n - 1 ] ; final_array [ ( int ) i , ( int ) n - 1 ] = s ; final_array [ ( int ) n - 1 , ( int ) i ] = t0 ; } for ( long i = 0 ; i < n ; ++ i ) { for ( long j = 0 ; j < n ; ++ j ) Console . Write ( final_array [ ( int ) i , ( int ) j ] + " ▁ " ) ; Console . WriteLine ( ) ; } } public static void Main ( String [ ] args ) { long n = 5 ; solve ( n ) ; } }

Iterator variables: i, j
Class/struct names: GFG
C# program:
using System ; using System . Collections . Generic ; class GFG { static void findPerm ( int n , List < int > differences ) { List < int > ans = new List < int > ( ) ; ans . Clear ( ) ; ans . Add ( 0 ) ; int x = 0 ; for ( int i = 0 ; i <= n - 2 ; ++ i ) { int diff = differences [ i ] ; x = x + diff ; ans . Add ( x ) ; } List < int > anss = new List < int > ( ) ; foreach ( int obj in ans ) anss . Add ( obj ) ; ans . Sort ( ) ; int flag = - 1 ; for ( int i = 1 ; i <= n - 1 ; ++ i ) { int res = ans [ i ] - ans [ i - 1 ] ; if ( res != 1 ) { flag = 0 ; } } if ( flag == 0 ) { Console . Write ( - 1 ) ; return ; } else { Dictionary < int , int > mpp = new Dictionary < int , int > ( ) ; mpp . Clear ( ) ; int j = 1 ; List < int > value_at_index = new List < int > ( ) ; foreach ( int x1 in ans ) { mpp . Add ( x1 , j ) ; ++ j ; } foreach ( int x2 in anss ) { value_at_index . Add ( mpp [ x2 ] ) ; } foreach ( int x3 in value_at_index ) { Console . Write ( x3 + " ▁ " ) ; } Console . WriteLine ( ) ; } } public static void Main ( String [ ] args ) { List < int > differences = new List < int > ( ) ; differences . Add ( 2 ) ; differences . Add ( - 3 ) ; differences . Add ( 2 ) ; int n = differences . Count + 1 ; findPerm ( n , differences ) ; } }

Index/key variables: i, x2
Iterator variables: i, obj, x1, x2, x3
Class/struct names: GFG
C# program:
using System ; class GFG { static int getMinVal ( int p , int q ) { if ( q % p == 0 ) return p ; return - 1 ; } public static void Main ( ) { int p = 24 , q = 48 ; Console . WriteLine ( getMinVal ( p , q ) ) ; } }

Class/struct names: GFG
C# program:
using System ; class GfG { static bool isPalindrome ( string str , int i , int j ) { while ( i < j ) { if ( str [ i ] != str [ j ] ) return false ; i ++ ; j -- ; } return true ; } static int countPrimePalindrome ( string str , int len ) { bool [ ] prime = new bool [ len + 1 ] ; Array . Fill ( prime , true ) ; prime [ 0 ] = prime [ 1 ] = false ; for ( int p = 2 ; p * p <= len ; p ++ ) { if ( prime [ p ] ) { for ( int i = p * p ; i <= len ; i += p ) prime [ i ] = false ; } } int count = 0 ; for ( int j = 2 ; j <= len ; j ++ ) { if ( prime [ j ] ) { for ( int i = 0 ; i + j - 1 < len ; i ++ ) { if ( isPalindrome ( str , i , i + j - 1 ) ) count ++ ; } } } return count ; } public static void Main ( ) { string s = " geeksforgeeks " ; int len = s . Length ; Console . WriteLine ( countPrimePalindrome ( s , len ) ) ; } }

Index/key variables: i, j, p
Accumulator variables: count, i, j, p
Iterator variables: i, j, p
Class/struct names: GfG
C# program:
using System ; class GFG { static int minOperations ( int N ) { double x = Math . Log ( N , 2 ) ; int ans = ( int ) ( Math . Ceiling ( x ) ) ; return ans ; } static void Main ( ) { int N = 10 ; Console . WriteLine ( minOperations ( N ) ) ; } }

Class/struct names: GFG
C# program:
using System ; class GFG { static int find_greatest_divisor ( int l , int r ) { if ( l == r ) { return l ; } return 1 ; } public static void Main ( ) { int l = 2 , r = 12 ; Console . WriteLine ( find_greatest_divisor ( l , r ) ) ; } }

Class/struct names: GFG