dhyuti-n/xlcost-variable-roles huggingface dataset:
C# program:
using System ; class GFG { static void isSequenceValid ( int [ ] B , int N ) { for ( int i = 0 ; i < N ; i ++ ) { if ( ( i + 1 ) % B [ i ] != 0 ) { Console . WriteLine ( " No " ) ; return ; } } Console . WriteLine ( " Yes " ) ; } public static void Main ( ) { int N = 4 ; int [ ] arr = { 1 , 2 , 3 , 2 } ; isSequenceValid ( arr , N ) ; } }

Index/key variables: i
Accumulator variables: i
Iterator variables: i
Class/struct names: GFG
C# program:
using System ; class GFG { static void ConstArrayAdjacentCoprime ( int N ) { for ( int i = 1 ; i <= N ; i ++ ) { Console . Write ( i + " ▁ " ) ; } } public static void Main ( ) { int N = 6 ; ConstArrayAdjacentCoprime ( N ) ; } }

Accumulator variables: i
Iterator variables: i
Class/struct names: GFG
C# program:
using System ; using System . Collections . Generic ; class GFG { static int maxEqrows ( List < List < int > > mat , int N , int M ) { Dictionary < List < int > , int > mp = new Dictionary < List < int > , int > ( ) ; for ( int i = 0 ; i < N ; i ++ ) { if ( mp . ContainsKey ( mat [ i ] ) ) { mp [ mat [ i ] ] ++ ; } else { mp [ mat [ i ] ] = 1 ; } } int cntMaxRows = 0 ; for ( int i = 0 ; i < N ; i ++ ) { List < int > onesCompRow = new List < int > ( ) ; for ( int j = 0 ; j < M ; j ++ ) { onesCompRow . Add ( 0 ) ; } for ( int j = 0 ; j < M ; j ++ ) { onesCompRow [ j ] = ( mat [ i ] [ j ] ^ 1 ) ; } if ( ! mp . ContainsKey ( mat [ i ] ) ) { cntMaxRows = Math . Max ( cntMaxRows , mp [ onesCompRow ] + 1 ) ; } else if ( ! mp . ContainsKey ( onesCompRow ) ) { cntMaxRows = Math . Max ( cntMaxRows , mp [ mat [ i ] ] + 1 ) ; } else { cntMaxRows = Math . Max ( cntMaxRows , mp [ mat [ i ] ] + mp [ onesCompRow ] + 1 ) ; } } return cntMaxRows ; } static void Main ( ) { List < List < int > > mat = new List < List < int > > ( ) ; mat . Add ( new List < int > { 0 , 1 , 0 , 0 , 1 } ) ; mat . Add ( new List < int > { 1 , 1 , 0 , 1 , 1 } ) ; mat . Add ( new List < int > { 1 , 0 , 1 , 1 , 0 } ) ; int N = mat . Count ; int M = mat [ 0 ] . Count ; Console . WriteLine ( maxEqrows ( mat , N , M ) ) ; } }

Index/key variables: i, j, onesCompRow
Accumulator variables: i, j
Iterator variables: i, j
Class/struct names: GFG
C# program:
using System ; using System . Collections . Generic ; class GFG { public static void minimumCost ( string a , string b ) { int [ ] fre1 = new int [ 256 ] ; int [ ] fre2 = new int [ 256 ] ; foreach ( char c in a . ToCharArray ( ) ) fre1 [ ( int ) ( c ) ] ++ ; foreach ( char c in b . ToCharArray ( ) ) fre2 [ ( int ) ( c ) ] ++ ; int mincost = 0 ; for ( int i = 0 ; i < 256 ; i ++ ) { mincost += Math . Abs ( fre1 [ i ] - fre2 [ i ] ) ; } Console . Write ( mincost ) ; } public static void Main ( ) { string A = "1AB + - " , B = " cc " ; minimumCost ( A , B ) ; } }

Index/key variables: i
Accumulator variables: i, mincost
Iterator variables: c, i
Class/struct names: GFG
C# program:
using System ; class GFG { public void minCost ( int [ ] arr ) { int odd = 0 , even = 0 ; for ( int i = 0 ; i < arr . Length ; i ++ ) { if ( arr [ i ] % 2 == 0 ) even ++ ; else odd ++ ; } Console . Write ( Math . Min ( even , odd ) ) ; } public static void Main ( ) { GFG obj = new GFG ( ) ; int [ ] arr = { 1 , 2 , 3 } ; obj . minCost ( arr ) ; } }

Index/key variables: i
Accumulator variables: even, i, odd
Iterator variables: i
Class/struct names: GFG
C# program:
using System ; class GFG { static int findMaxSumByAlternatingSign ( int [ ] arr , int N ) { int cntNeg = 0 ; int MaxAltSum = 0 ; int SmValue = 0 ; int sum = 0 ; for ( int i = 0 ; i < N ; i ++ ) { if ( arr [ i ] < 0 ) { cntNeg += 1 ; } sum += Math . Abs ( arr [ i ] ) ; SmValue = Math . Min ( SmValue , Math . Abs ( arr [ i ] ) ) ; } MaxAltSum = sum ; if ( cntNeg % 2 == 1 ) { MaxAltSum -= 2 * SmValue ; } return MaxAltSum ; } public static void Main ( String [ ] args ) { int [ ] arr = { 1 , 1 , - 2 , - 4 , 5 } ; int N = arr . Length ; Console . Write ( findMaxSumByAlternatingSign ( arr , N ) ) ; } }

Index/key variables: i
Accumulator variables: MaxAltSum, cntNeg, i, sum
Iterator variables: i
Class/struct names: GFG
C# program:
using System ; class GFG { static void constructNewArraySumZero ( int [ ] arr , int N ) { int [ ] newArr = new int [ N ] ; for ( int i = 0 ; i < N ; i ++ ) { if ( i % 2 == 0 ) { newArr [ i ] = arr [ i + 1 ] ; } else { newArr [ i ] = - arr [ i - 1 ] ; } } for ( int i = 0 ; i < N ; i ++ ) { Console . Write ( newArr [ i ] + " ▁ " ) ; } } public static void Main ( ) { int [ ] arr = { 1 , 2 , 3 , - 5 , - 6 , 8 } ; int N = arr . Length ; constructNewArraySumZero ( arr , N ) ; } }

Index/key variables: N, i
Accumulator variables: i
Iterator variables: i
Class/struct names: GFG
C# program:
using System ; using System . Collections . Generic ; class GFG { public static void bitonicSequence ( int num , int lower , int upper ) { if ( num > ( upper - lower ) * 2 + 1 ) { Console . WriteLine ( - 1 ) ; return ; } List < int > ans = new List < int > ( ) ; for ( int i = 0 ; i < Math . Min ( upper - lower + 1 , num - 1 ) ; i ++ ) ans . Add ( upper - i ) ; for ( int i = 0 ; i < num - ans . Count ; i ++ ) ans . Insert ( 0 , upper - i - 1 ) ; Console . Write ( " [ " ) ; foreach ( int x in ans ) Console . Write ( x + " , ▁ " ) ; Console . Write ( " ] " ) ; } public static void Main ( String [ ] args ) { int N = 5 , L = 3 , R = 10 ; bitonicSequence ( N , L , R ) ; } }

Accumulator variables: i
Iterator variables: i, x
Class/struct names: GFG
C# program:
using System ; class GFG { static int countSubStrings ( String s , String t ) { int answ = 0 ; for ( int i = 0 ; i < s . Length ; i ++ ) { for ( int j = 0 ; j < t . Length ; j ++ ) { if ( t [ j ] != s [ i ] ) { answ += 1 ; int k = 1 ; int z = - 1 ; int q = 1 ; while ( j + z >= 0 && 0 <= i + z && s [ i + z ] == t [ j + z ] ) { z -= 1 ; answ += 1 ; q += 1 ; } while ( s . Length > i + k && j + k < t . Length && s [ i + k ] == t [ j + k ] ) { k += 1 ; answ += q ; z = - 1 ; } } } } return answ ; } public static void Main ( String [ ] args ) { String S = " aba " ; String T = " baba " ; Console . WriteLine ( countSubStrings ( S , T ) ) ; } }

Index/key variables: i, j
Accumulator variables: answ, i, j, k, q, z
Iterator variables: i, j
Class/struct names: GFG
C# program:
using System ; class GFG { public static int minimumCntOfFlipsRequired ( string str ) { int n = str . Length ; int zeros = 0 ; for ( int i = 0 ; i < n ; i ++ ) { if ( str [ i ] == '0' ) { zeros ++ ; } } if ( zeros == 0 zeros == n ) { return 0 ; } int minFlips = Int32 . MaxValue ; int currOnes = 0 ; int flips ; for ( int i = 0 ; i < n ; i ++ ) { if ( str [ i ] == '1' ) { currOnes ++ ; } flips = currOnes + ( zeros - ( i + 1 - currOnes ) ) ; minFlips = Math . Min ( minFlips , flips ) ; } return minFlips ; } public static void Main ( ) { string s1 = "100101" ; Console . WriteLine ( minimumCntOfFlipsRequired ( s1 ) ) ; } }

Index/key variables: i
Accumulator variables: currOnes, i, zeros
Iterator variables: i
Class/struct names: GFG
C# program:
using System ; class GFG { static int findLongestNonDecreasing ( int [ ] A , int N ) { int res = 0 ; int start = 0 ; int end = N - 1 ; int prev = - 1 ; while ( start <= end ) { if ( A [ start ] <= A [ end ] ) { if ( prev == - 1 ) { prev = A [ start ] ; res ++ ; start ++ ; } else { if ( A [ start ] >= prev ) { res ++ ; prev = A [ start ] ; start ++ ; } else if ( A [ end ] >= prev ) { res ++ ; prev = A [ end ] ; end -- ; } else { break ; } } } else { if ( prev == - 1 ) { prev = A [ end ] ; res ++ ; end -- ; } else { if ( A [ end ] >= prev ) { res ++ ; prev = A [ end ] ; end -- ; } else if ( A [ start ] >= prev ) { res ++ ; prev = A [ start ] ; start ++ ; } else { break ; } } } } return res ; } public static void Main ( ) { int [ ] A = { 1 , 1 , 3 , 5 , 4 , 3 , 6 , 2 , 1 } ; int N = A . Length ; Console . Write ( findLongestNonDecreasing ( A , N ) ) ; } }

Index/key variables: end, start
Accumulator variables: end, res, start
Class/struct names: GFG
C# program:
using System ; class GFG { static void findPairs ( int N ) { for ( int i = 0 ; i <= N ; i ++ ) { Console . Write ( " ( " + i + " , ▁ " + ( N - i ) + " ) , ▁ " ) ; } } public static void Main ( ) { int N = 5 ; findPairs ( N ) ; } }

Accumulator variables: i
Iterator variables: i
Class/struct names: GFG
C# program:
using System ; class GFG { static int GCD ( int a , int b ) { if ( b == 0 ) return a ; return GCD ( b , a % b ) ; } static int findPartition ( int [ ] nums , int N ) { int [ ] prefix = new int [ N ] ; int [ ] suffix = new int [ N ] ; int i , k ; prefix [ 0 ] = nums [ 0 ] ; for ( i = 1 ; i < N ; i ++ ) { prefix [ i ] = prefix [ i - 1 ] * nums [ i ] ; } suffix [ N - 1 ] = nums [ N - 1 ] ; for ( i = N - 2 ; i >= 0 ; i -- ) { suffix [ i ] = suffix [ i + 1 ] * nums [ i ] ; } for ( k = 0 ; k < N - 1 ; k ++ ) { if ( GCD ( prefix [ k ] , suffix [ k + 1 ] ) == 1 ) { return k ; } } return - 1 ; } static void Main ( ) { int [ ] arr = { 2 , 3 , 4 , 5 } ; int N = arr . Length ; Console . WriteLine ( findPartition ( arr , N ) ) ; } }

Index/key variables: N, i, k
Accumulator variables: i, k
Iterator variables: i, k
Class/struct names: GFG
C# program:
using System ; class GFG { static int separate ( int [ ] arr , int n , int parity ) { int count = 1 , res = 0 ; for ( int i = 1 ; i < n ; i ++ ) { if ( ( ( arr [ i ] + parity ) & 1 ) != 0 && ( ( arr [ i - 1 ] + parity ) & 1 ) != 0 ) count ++ ; else { if ( count > 1 ) res += count - 1 ; count = 1 ; } } return res ; } void printArray ( int [ ] arr , int n ) { for ( int i = 0 ; i < n ; i ++ ) Console . Write ( arr [ i ] + " ▁ " ) ; } static void requiredOps ( int [ ] arr , int N ) { int res1 = separate ( arr , N , 0 ) ; int res2 = separate ( arr , N , 1 ) ; Console . Write ( Math . Max ( res1 , res2 ) ) ; } public static void Main ( ) { int [ ] arr = { 13 , 2 , 6 , 8 , 3 , 5 , 7 , 10 , 14 , 15 } ; int N = arr . Length ; requiredOps ( arr , N ) ; } }

Index/key variables: i
Accumulator variables: count, i, res
Iterator variables: i
Class/struct names: GFG
C# program:
using System ; class GFG { public static bool [ ] SieveOfEratosthenes ( int N ) { bool [ ] isPrime = new bool [ N + 1 ] ; for ( int i = 0 ; i < N + 1 ; i ++ ) { isPrime [ i ] = true ; } isPrime [ 0 ] = false ; isPrime [ 1 ] = false ; for ( int p = 2 ; p * p <= N ; p ++ ) { if ( isPrime [ p ] ) { for ( int i = p * p ; i <= N ; i += p ) { isPrime [ i ] = false ; } } } return isPrime ; } public static int cntPairsdiffOfPrimeisPrime ( int N ) { int cntPairs = 0 ; bool [ ] isPrime = SieveOfEratosthenes ( N ) ; for ( int i = 2 ; i <= N ; i ++ ) { if ( isPrime [ i ] && isPrime [ i - 2 ] ) { cntPairs += 2 ; } } return cntPairs ; } public static void Main ( ) { int N = 5 ; Console . WriteLine ( cntPairsdiffOfPrimeisPrime ( N ) ) ; } }

Index/key variables: i, p
Accumulator variables: cntPairs, i, p
Iterator variables: i, p
Class/struct names: GFG
C# program:
using System ; class GFG { static void longestSubsequence ( int [ ] arr , int N ) { int count = 1 ; for ( int i = 1 ; i < N ; i ++ ) { if ( arr [ i ] != arr [ i - 1 ] ) { count ++ ; } } Console . WriteLine ( count ) ; } public static void Main ( ) { int [ ] arr = { 7 , 8 , 1 , 2 , 2 , 5 , 5 , 1 } ; int N = arr . Length ; longestSubsequence ( arr , N ) ; } }

Index/key variables: i
Accumulator variables: count, i
Iterator variables: i
Class/struct names: GFG
C# program:
using System ; class GFG { static int substringCount ( string s ) { int [ ] freq = new int [ 26 ] ; char max_char = ' # ' ; int maxfreq = Int32 . MinValue ; for ( int i = 0 ; i < s . Length ; i ++ ) { freq [ s [ i ] - ' a ' ] ++ ; if ( maxfreq < freq [ s [ i ] - ' a ' ] ) maxfreq = freq [ s [ i ] - ' a ' ] ; } for ( int i = 0 ; i < 26 ; i ++ ) { if ( maxfreq == freq [ i ] ) { max_char = ( char ) ( i + ' a ' ) ; break ; } } int ans = 0 ; for ( int i = 0 ; i < s . Length ; i ++ ) { char ch = s [ i ] ; if ( max_char == ch ) { ans += ( s . Length - i ) ; } } return ans ; } public static void Main ( ) { string S = " abcab " ; Console . WriteLine ( substringCount ( S ) ) ; } }

Index/key variables: i
Accumulator variables: ans, i
Iterator variables: i
Class/struct names: GFG
C# program:
using System ; class GFG { static void minSum ( int [ ] arr , int n ) { int [ ] ans = new int [ n ] ; for ( int i = 0 ; i < n ; i ++ ) ans [ i ] = 1 ; for ( int i = 1 ; i < n ; i ++ ) { if ( arr [ i ] > arr [ i - 1 ] ) { ans [ i ] = Math . Max ( ans [ i ] , ans [ i - 1 ] + 1 ) ; } } for ( int i = n - 2 ; i >= 0 ; i -- ) { if ( arr [ i ] > arr [ i + 1 ] ) { ans [ i ] = Math . Max ( ans [ i ] , ans [ i + 1 ] + 1 ) ; } } int s = 0 ; foreach ( int x in ans ) { s = s + x ; } Console . Write ( s + " STRNEWLINE " ) ; } public static void Main ( String [ ] args ) { int [ ] arr = { 1 , 2 , 2 } ; int N = arr . Length ; minSum ( arr , N ) ; } }

Index/key variables: i, n
Accumulator variables: i
Iterator variables: i, x
Class/struct names: GFG
C# program:
using System ; class GFG { static void minSteps ( string S ) { string new_str = " " ; int N = S . Length ; int i = 0 ; while ( i < N ) { new_str += S [ i ] ; int j = i ; while ( i < N && S [ i ] == S [ j ] ) ++ i ; } Console . Write ( ( int ) Math . Ceiling ( ( new_str . Length + 1 ) / 2.0 ) ) ; } public static void Main ( ) { string S = "0010100" ; minSteps ( S ) ; } }

Index/key variables: i, j
Accumulator variables: new_str
Class/struct names: GFG
C# program:
using System ; using System . Collections . Generic ; class GFG { static int countPairs ( int [ ] arr , int N ) { int cntPairs = 0 ; Dictionary < int , int > mp = new Dictionary < int , int > ( ) ; for ( int i = 0 ; i < N ; i ++ ) { if ( ! mp . ContainsKey ( arr [ i ] ) ) mp . Add ( arr [ i ] , 1 ) ; else mp [ arr [ i ] ] = mp [ arr [ i ] ] + 1 ; } foreach ( KeyValuePair < int , int > freq in mp ) { cntPairs += ( freq . Value * ( freq . Value - 1 ) ) / 2 ; } return cntPairs ; } public static void Main ( ) { int [ ] arr = { 1 , 2 , 3 , 1 , 2 , 2 } ; int N = arr . Length ; Console . WriteLine ( countPairs ( arr , N ) ) ; } }

Index/key variables: i
Accumulator variables: cntPairs, i
Iterator variables: freq, i
Class/struct names: GFG
C# program:
using System ; using System . Collections . Generic ; class GFG { public class pair { public int first , second ; public pair ( int first , int second ) { this . first = first ; this . second = second ; } } static void palindromeMatrix ( int N , int M , int [ , ] arr ) { int ans = 0 ; for ( int i = 0 ; i < ( N + 1 ) / 2 ; i ++ ) { for ( int j = 0 ; j < ( M + 1 ) / 2 ; j ++ ) { HashSet < pair > s = new HashSet < pair > ( ) ; s . Add ( new pair ( i , j ) ) ; s . Add ( new pair ( i , M - j - 1 ) ) ; s . Add ( new pair ( N - i - 1 , j ) ) ; s . Add ( new pair ( N - i - 1 , M - j - 1 ) ) ; List < int > values = new List < int > ( ) ; foreach ( pair p in s ) { values . Add ( arr [ p . first , p . second ] ) ; } values . Sort ( ) ; int max = values [ values . Count - 1 ] ; for ( int k = 1 ; k < values . Count ; k ++ ) { ans += max - values [ k ] ; } } } Console . Write ( ans ) ; } public static void Main ( String [ ] args ) { int N = 3 , M = 3 ; int [ , ] arr = { { 1 , 2 , 1 } , { 3 , 4 , 1 } , { 1 , 2 , 1 } } ; palindromeMatrix ( N , M , arr ) ; } }

Index/key variables: k
Accumulator variables: ans, i, j, k
Iterator variables: i, j, k, p
Class/struct names: GFG, pair
C# program:
using System ; class GFG { static int minimumMoves ( int n ) { int cnt2 = 0 , cnt5 = 0 ; while ( n % 2 == 0 ) { n /= 2 ; cnt2 ++ ; } while ( n % 5 == 0 ) { n /= 5 ; cnt5 ++ ; } if ( n == 1 && cnt2 <= cnt5 ) { return 2 * cnt5 - cnt2 ; } else return - 1 ; } public static void Main ( ) { int N = 25 ; Console . WriteLine ( minimumMoves ( N ) ) ; } }

Accumulator variables: cnt2, cnt5, n
Class/struct names: GFG
C# program:
using System ; class solution { static void check ( int n ) { if ( ( n & n - 1 ) != 0 ) Console . WriteLine ( " YES " ) ; else Console . WriteLine ( " NO " ) ; } public static void Main ( String [ ] args ) { int n = 5 ; check ( n ) ; } }

Class/struct names: solution
C# program:
using System ; class GFG { public static int MinOperation ( int [ ] arr , int N , int K ) { int cntOpe = 0 ; for ( int i = 0 ; i < N ; i ++ ) { if ( K > arr [ i ] ) { if ( ( K - arr [ i ] ) % 2 == 0 ) { cntOpe += 2 ; } else { cntOpe += 1 ; } } else if ( K < arr [ i ] ) { if ( ( K - arr [ i ] ) % 2 == 0 ) { cntOpe += 1 ; } else { cntOpe += 2 ; } } } return cntOpe ; } public static void Main ( String [ ] args ) { int [ ] arr = { 8 , 7 , 2 , 1 , 3 } ; int K = 5 ; int N = arr . Length ; Console . WriteLine ( MinOperation ( arr , N , K ) ) ; } }

Index/key variables: i
Accumulator variables: cntOpe, i
Iterator variables: i
Class/struct names: GFG
C# program:
using System ; using System . Collections ; using System . Collections . Generic ; class GFG { static ArrayList rearrangeArray ( ArrayList A , ArrayList B , int N ) { Dictionary < int , int > m = new Dictionary < int , int > ( ) ; int xor_value = 0 ; for ( int i = 0 ; i < N ; i ++ ) { xor_value ^= ( int ) A [ i ] ; xor_value ^= ( int ) B [ i ] ; if ( ! m . ContainsKey ( ( int ) B [ i ] ) ) m . Add ( ( int ) B [ i ] , 1 ) ; else m [ ( int ) B [ i ] ] = m [ ( int ) B [ i ] ] + 1 ; } for ( int i = 0 ; i < N ; i ++ ) { B [ i ] = ( int ) A [ i ] ^ xor_value ; if ( m . ContainsKey ( ( int ) B [ i ] ) ) { m [ ( int ) B [ i ] ] -- ; } else return ( new ArrayList ( ) ) ; } return B ; } static void rearrangeArrayUtil ( ArrayList A , ArrayList B , int N ) { ArrayList ans = rearrangeArray ( A , B , N ) ; if ( ans . Count != 0 ) { for ( int i = 0 ; i < ans . Count ; i ++ ) { Console . Write ( ans [ i ] + " ▁ " ) ; } } else { Console . WriteLine ( " - 1" ) ; } } public static void Main ( ) { ArrayList A = new ArrayList { 13 , 21 , 33 , 49 , 53 } ; ArrayList B = new ArrayList { 54 , 50 , 34 , 22 , 14 } ; int N = A . Count ; rearrangeArrayUtil ( A , B , N ) ; } }

Index/key variables: i
Accumulator variables: i, xor_value
Iterator variables: i
Class/struct names: GFG
C# program:
using System ; class GFG { static long binCoff ( long n , long r ) { long val = 1 ; int i ; if ( r > ( n - r ) ) r = ( n - r ) ; for ( i = 0 ; i < r ; i ++ ) { val *= ( n - i ) ; val /= ( i + 1 ) ; } return val ; } static void findWays ( int M , int X ) { int n = M / 2 ; long a , b ; a = binCoff ( 2 * n , n ) ; b = a / ( n + 1 ) ; Console . WriteLine ( b ) ; } public static void Main ( ) { int M = 4 ; int X = 5 ; findWays ( M , X ) ; } }

Accumulator variables: i, val
Iterator variables: i
Class/struct names: GFG
C# program:
using System ; class GFG { static int gcd ( int a , int b ) { if ( a == 0 ) return b ; return gcd ( b % a , a ) ; } static void countInverse ( int [ ] arr , int N , int M ) { int XOR = 0 ; for ( int i = 0 ; i < N ; i ++ ) { int gcdOfMandelement = gcd ( M , arr [ i ] ) ; if ( gcdOfMandelement == 1 ) { XOR ^= arr [ i ] ; } } Console . WriteLine ( XOR ) ; } public static void Main ( ) { int [ ] arr = { 1 , 2 , 3 } ; int M = 4 ; int N = arr . Length ; countInverse ( arr , N , M ) ; } }

Index/key variables: i
Accumulator variables: XOR, i
Iterator variables: i
Class/struct names: GFG
C# program:
using System ; class GFG { static int Moves_Calculator ( int x , int y , int row , int col ) { int total_moves = 0 ; if ( ( row - x ) > 0 && ( col - y ) > 0 ) total_moves += Math . Min ( ( row - x ) , ( col - y ) ) ; if ( ( y - 1 ) > 0 && ( x - 1 ) > 0 ) total_moves += Math . Min ( ( y - 1 ) , ( x - 1 ) ) ; if ( ( x - 1 ) > 0 && ( col - y ) > 0 ) total_moves += Math . Min ( ( x - 1 ) , ( col - y ) ) ; if ( ( row - x ) > 0 && ( y - 1 ) > 0 ) total_moves += Math . Min ( ( row - x ) , ( y - 1 ) ) ; total_moves += ( row - 1 ) + ( col - 1 ) ; int king_moves = 0 ; if ( x + 1 <= row ) king_moves += 1 ; if ( x - 1 > 0 ) king_moves += 1 ; if ( y + 1 <= col ) king_moves += 1 ; if ( y - 1 > 0 ) king_moves += 1 ; if ( x + 1 <= row && y + 1 <= col ) king_moves += 1 ; if ( x + 1 <= row && y - 1 > 0 ) king_moves += 1 ; if ( x - 1 > 0 && y - 1 > 0 ) king_moves += 1 ; if ( x - 1 > 0 && y + 1 <= col ) king_moves += 1 ; return total_moves - king_moves ; } public static void Main ( ) { int n = 8 , m = 8 ; int x = 1 , y = 1 ; Console . WriteLine ( Moves_Calculator ( x , y , m , n ) ) ; } }

Accumulator variables: king_moves, total_moves
Class/struct names: GFG
C# program:
using System ; class GFG { static int clstNum ( int N ) { return ( N - 1 ) ; } public static void Main ( ) { int N = 11 ; Console . Write ( clstNum ( N ) ) ; } }

Class/struct names: GFG
C# program:
using System ; class GFG { static int equvInverse ( int [ ] arr , int N , int P ) { int cntElem = 0 ; for ( int i = 0 ; i < N ; i ++ ) { if ( ( arr [ i ] * arr [ i ] ) % P == 1 ) { cntElem ++ ; } } return cntElem ; } public static void Main ( ) { int [ ] arr = { 1 , 6 , 4 , 5 } ; int N = arr . Length ; int P = 7 ; Console . WriteLine ( equvInverse ( arr , N , P ) ) ; } }

Index/key variables: i
Accumulator variables: cntElem, i
Iterator variables: i
Class/struct names: GFG
C# program:
using System ; using System . Collections . Generic ; class GFG { static int power ( int K , int M ) { int res = 1 ; while ( M > 0 ) { if ( ( M & 1 ) == 1 ) { res = ( res * K ) ; } M = M >> 1 ; K = ( K * K ) ; } return res ; } static int cntWays ( int [ ] arr , int N , int K ) { int cntways = 0 ; int M = 0 ; HashSet < int > st = new HashSet < int > ( ) ; for ( int i = 0 ; i < N ; i ++ ) { st . Add ( arr [ i ] ) ; } M = st . Count ; cntways = power ( K , M ) ; return cntways ; } public static void Main ( ) { int [ ] arr = { 2 , 3 } ; int N = arr . Length ; int K = 2 ; Console . WriteLine ( cntWays ( arr , N , K ) ) ; } }

Index/key variables: i
Accumulator variables: i
Iterator variables: i
Class/struct names: GFG
C# program:
using System ; class GFG { static int mod = ( int ) 1e9 + 7 ; static void minProduct ( int n ) { int ans = 1 ; for ( int i = 1 ; i <= ( n - 4 ) / 2 ; i ++ ) { ans = ( int ) ( 1L * ans * ( n - 2 ) ) % mod ; } ans = ( int ) ( 1L * ans * ( n - 2 ) * ( n - 1 ) ) % mod ; Console . Write ( ans + " STRNEWLINE " ) ; } public static void Main ( String [ ] args ) { int N = 8 ; minProduct ( N ) ; } }

Accumulator variables: i
Iterator variables: i
Class/struct names: GFG
C# program:
using System ; class GFG { public static int TotalXorPair ( int [ ] arr , int N ) { int totalXOR = 0 ; for ( int i = 0 ; i < N ; i ++ ) { for ( int j = i + 1 ; j < N ; j ++ ) { totalXOR ^= arr [ i ] ^ arr [ j ] ; } } return totalXOR ; } public static void Main ( String [ ] args ) { int [ ] arr = { 1 , 2 , 3 , 4 } ; int N = arr . Length ; Console . Write ( TotalXorPair ( arr , N ) ) ; } }

Index/key variables: i, j
Accumulator variables: i, j, totalXOR
Iterator variables: i, j
Class/struct names: GFG
C# program:
using System ; class GFG { static void possibleAcyclicGraph ( int N ) { Console . Write ( ( int ) Math . Pow ( 2 , N - 1 ) ) ; return ; } public static void Main ( ) { int N = 4 ; possibleAcyclicGraph ( N ) ; } }

Class/struct names: GFG
C# program:
using System ; class GFG { static int minProd ( int X , int Y , int N ) { if ( X <= Y ) { if ( N < X ) return ( X - N ) * Y ; else { return Math . Max ( Y - ( N - X + 1 ) , 1 ) ; } } if ( Y >= N ) return ( Y - N ) * X ; return Math . Max ( X - ( N - Y + 1 ) , 1 ) ; } public static void Main ( String [ ] args ) { int X = 47 , Y = 42 , N = 167 ; Console . WriteLine ( minProd ( X , Y , N ) ) ; } }

Class/struct names: GFG
C# program:
using System ; class GFG { static int countPairs ( int [ ] arr , int n ) { int oneCount = 0 ; int desiredPair = 0 ; for ( int i = 0 ; i < n ; i ++ ) { if ( arr [ i ] == 1 ) { oneCount ++ ; } if ( arr [ i ] == 0 ) { desiredPair += oneCount ; } } return desiredPair ; } public static void Main ( String [ ] args ) { int [ ] arr = { 3 , 1 , 1 , 0 } ; int N = arr . Length ; Console . WriteLine ( countPairs ( arr , N ) ) ; } }

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