dhyuti-n/xlcost-variable-roles huggingface dataset:
C program:
#include <limits.h>
#include <stdio.h>
#include <math.h>
#define NO_OF_CHARS  256
int firstNonRepeating ( char * str ) { int arr [ NO_OF_CHARS ] ; for ( int i = 0 ; i < NO_OF_CHARS ; i ++ ) arr [ i ] = -1 ; for ( int i = 0 ; str [ i ] ; i ++ ) { if ( arr [ str [ i ] ] == -1 ) arr [ str [ i ] ] = i ; else arr [ str [ i ] ] = -2 ; } int res = INT_MAX ; for ( int i = 0 ; i < NO_OF_CHARS ; i ++ ) if ( arr [ i ] >= 0 ) res = min ( res , arr [ i ] ) ; return res ; } int main ( ) { char str [ ] = " geeksforgeeks " ; int index = firstNonRepeating ( str ) ; if ( index == INT_MAX ) printf ( " Either ▁ all ▁ characters ▁ are ▁ " " repeating ▁ or ▁ string ▁ is ▁ empty " ) ; else printf ( " First ▁ non - repeating ▁ character " " ▁ is ▁ % c " , str [ index ] ) ; return 0 ; }

Index/key variables: NO_OF_CHARS, i, index
Accumulator variables: i
Iterator variables: i
C program:
#include <stdio.h>
#include <stdlib.h>
void flip ( int arr [ ] , int i ) { int temp , start = 0 ; while ( start < i ) { temp = arr [ start ] ; arr [ start ] = arr [ i ] ; arr [ i ] = temp ; start ++ ; i -- ; } } int findMax ( int arr [ ] , int n ) { int mi , i ; for ( mi = 0 , i = 0 ; i < n ; ++ i ) if ( arr [ i ] > arr [ mi ] ) mi = i ; return mi ; } void pancakeSort ( int * arr , int n ) { for ( int curr_size = n ; curr_size > 1 ; -- curr_size ) { int mi = findMax ( arr , curr_size ) ; if ( mi != curr_size - 1 ) { flip ( arr , mi ) ; flip ( arr , curr_size - 1 ) ; } } } void printArray ( int arr [ ] , int n ) { for ( int i = 0 ; i < n ; ++ i ) printf ( " % d ▁ " , arr [ i ] ) ; } int main ( ) { int arr [ ] = { 23 , 10 , 20 , 11 , 12 , 6 , 7 } ; int n = sizeof ( arr ) / sizeof ( arr [ 0 ] ) ; pancakeSort ( arr , n ) ; puts ( " Sorted ▁ Array ▁ " ) ; printArray ( arr , n ) ; return 0 ; }

Index/key variables: i, mi, start
Accumulator variables: i, start
Iterator variables: curr_size, i, mi
C# program:
using System ; using System . Collections . Generic ; class GFG { static int maxPresum ( List < int > a , List < int > b ) { int X = Math . Max ( a [ 0 ] , 0 ) ; for ( int i = 1 ; i < a . Count ; i ++ ) { a [ i ] += a [ i - 1 ] ; X = Math . Max ( X , a [ i ] ) ; } int Y = Math . Max ( b [ 0 ] , 0 ) ; for ( int i = 1 ; i < b . Count ; i ++ ) { b [ i ] += b [ i - 1 ] ; Y = Math . Max ( Y , b [ i ] ) ; } return X + Y ; } static void Main ( ) { List < int > A = new List < int > ( new int [ ] { 2 , - 1 , 4 , - 5 } ) ; List < int > B = new List < int > ( new int [ ] { 4 , - 3 , 12 , 4 , - 3 } ) ; Console . WriteLine ( maxPresum ( A , B ) ) ; } }

Index/key variables: i
Accumulator variables: i
Iterator variables: i
Class/struct names: GFG
C# program:
using System ; class GFG { static bool sumOfTwoCubes ( int n ) { int lo = 1 , hi = ( int ) Math . Pow ( n , ( 1.0 / 3.0 ) ) ; while ( lo <= hi ) { int curr = ( lo * lo * lo + hi * hi * hi ) ; if ( curr == n ) return true ; if ( curr < n ) lo ++ ; else hi -- ; } return false ; } public static void Main ( String [ ] args ) { int N = 28 ; if ( sumOfTwoCubes ( N ) ) { Console . Write ( " True " ) ; } else { Console . Write ( " False " ) ; } } }

Accumulator variables: hi, lo
Class/struct names: GFG
C# program:
using System ; class GFG { static long findNthNumber ( long N ) { long result = 0 ; long p = 1 ; while ( N > 0 ) { result += ( p * ( N % 9 ) ) ; N = N / 9 ; p = p * 10 ; } return result ; } static void Main ( ) { int N = 9 ; Console . Write ( findNthNumber ( N ) ) ; } }

Accumulator variables: result
Class/struct names: GFG
C# program:
using System ; public class GFG { static int check ( int A , int B ) { if ( A == B ) { return 1 ; } int dig1 = ( int ) Math . Floor ( Math . Log10 ( A ) + 1 ) ; int dig2 = ( int ) Math . Floor ( Math . Log10 ( B ) + 1 ) ; if ( dig1 != dig2 ) { return 0 ; } int temp = A ; while ( true ) { int power = ( int ) Math . Pow ( 10 , dig1 - 1 ) ; int firstdigit = A / power ; A = A - firstdigit * power ; A = A * 10 + firstdigit ; if ( A == B ) { return 1 ; } if ( A == temp ) { return 0 ; } } } public static void Main ( String [ ] args ) { int A = 967 , B = 679 ; if ( check ( A , B ) == 1 ) Console . WriteLine ( " Yes " ) ; else Console . WriteLine ( " No " ) ; } }

Class/struct names: GFG
C# program:
using System ; class GFG { static void sameProductQuadruples ( int [ ] nums , int N ) { int [ ] umap = new int [ 10000 ] ; int res = 0 ; for ( int i = 0 ; i < N ; ++ i ) { for ( int j = i + 1 ; j < N ; ++ j ) { int prod = nums [ i ] * nums [ j ] ; res += 8 * umap [ prod ] ; ++ umap [ prod ] ; } } Console . Write ( res ) ; } public static void Main ( String [ ] args ) { int [ ] arr = { 2 , 3 , 4 , 6 } ; int N = arr . Length ; sameProductQuadruples ( arr , N ) ; } }

Index/key variables: i, j, prod
Accumulator variables: res
Iterator variables: i, j
Class/struct names: GFG
C# program:
using System ; public class GFG { public static int MOD = 1000000007 ; static int power ( int x , int y , int p ) { p = MOD ; int res = 1 ; x = x % p ; while ( y > 0 ) { if ( ( y & 1 ) != 0 ) res = ( res * x ) % p ; y = y >> 1 ; x = ( x * x ) % p ; } return res ; } static void totalWays ( int N , int M ) { int X = N / 2 ; int S = ( X * ( X + 1 ) ) % MOD ; Console . WriteLine ( power ( S , M , MOD ) ) ; } static public void Main ( ) { int N = 5 , M = 2 ; totalWays ( N , M ) ; } }

Class/struct names: GFG
C# program:
using System ; class GFG { static void isCycleExists ( int [ ] arr , int N ) { for ( int i = 1 ; i < N ; i ++ ) { if ( arr [ i ] < arr [ i - 1 ] && arr [ i ] < arr [ i + 1 ] ) { Console . WriteLine ( " Yes " ) ; return ; } } Console . WriteLine ( " No " ) ; } public static void Main ( ) { int [ ] arr = { 1 , 3 , 2 , 4 , 5 } ; int N = arr . Length ; isCycleExists ( arr , N ) ; } }

Index/key variables: i
Accumulator variables: i
Iterator variables: i
Class/struct names: GFG
C# program:
using System ; class GFG { static void getMax ( int [ ] arr , int N , int K ) { for ( int i = 1 ; i < N ; i ++ ) { int cur_val = arr [ i ] ; while ( K >= i ) { if ( cur_val > 0 ) { arr [ 0 ] = arr [ 0 ] + 1 ; cur_val = cur_val - 1 ; K = K - i ; } else break ; } } Console . Write ( arr [ 0 ] ) ; } static void Main ( ) { int [ ] arr = { 1 , 0 , 3 , 2 } ; int N = arr . Length ; int K = 5 ; getMax ( arr , N , K ) ; } }

Index/key variables: i
Accumulator variables: i
Iterator variables: i
Class/struct names: GFG
C# program:
using System ; class GFG { public static int minSwaps ( int [ , ] b ) { int n = b . GetLength ( 0 ) ; for ( int i = 0 ; i < n ; i ++ ) { for ( int j = 0 ; j < n ; j ++ ) { if ( ( b [ 0 , 0 ] ^ b [ 0 , j ] ^ b [ i , 0 ] ^ b [ i , j ] ) == 1 ) { return - 1 ; } } } int rowSum = 0 ; int colSum = 0 ; int rowSwap = 0 ; int colSwap = 0 ; for ( int i = 0 ; i < n ; i ++ ) { rowSum += b [ i , 0 ] ; colSum += b [ 0 , i ] ; int cond1 = 0 ; int cond2 = 0 ; if ( b [ i , 0 ] == i % 2 ) cond1 = 1 ; if ( b [ 0 , i ] == i % 2 ) cond2 = 1 ; rowSwap += cond1 ; colSwap += cond2 ; } if ( rowSum != n / 2 && rowSum != ( n + 1 ) / 2 ) return - 1 ; if ( colSum != n / 2 && colSum != ( n + 1 ) / 2 ) return - 1 ; if ( n % 2 == 1 ) { if ( ( colSwap % 2 ) == 1 ) colSwap = n - colSwap ; if ( ( rowSwap % 2 ) == 1 ) rowSwap = n - rowSwap ; } else { colSwap = Math . Min ( colSwap , n - colSwap ) ; rowSwap = Math . Min ( rowSwap , n - rowSwap ) ; } return ( rowSwap + colSwap ) / 2 ; } public static void Main ( String [ ] args ) { int [ , ] M = { { 0 , 1 , 1 , 0 } , { 0 , 1 , 1 , 0 } , { 1 , 0 , 0 , 1 } , { 1 , 0 , 0 , 1 } } ; int ans = minSwaps ( M ) ; Console . WriteLine ( ans ) ; } }

Accumulator variables: colSum, colSwap, i, j, rowSum, rowSwap
Iterator variables: i, j
Class/struct names: GFG
C# program:
using System ; class GFG { static void count_setbit ( int N ) { int result = 0 ; for ( int i = 0 ; i < 32 ; i ++ ) { if ( ( ( 1 << i ) & N ) > 0 ) { result ++ ; } } Console . WriteLine ( result ) ; } static void Main ( ) { int N = 43 ; count_setbit ( N ) ; } }

Accumulator variables: i, result
Iterator variables: i
Class/struct names: GFG
C# program:
using System ; class GFG { static int mod = 1000000007 ; static int ValOfTheExpression ( int n ) { int [ ] factorial = new int [ n + 1 ] ; factorial [ 0 ] = factorial [ 1 ] = 1 ; for ( int i = 2 ; i <= n ; i ++ ) { factorial [ i ] = ( ( factorial [ i - 1 ] % mod ) * ( i % mod ) ) % mod ; } int [ ] dp = new int [ n + 1 ] ; dp [ 1 ] = 1 ; for ( int i = 2 ; i <= n ; i ++ ) { dp [ i ] = ( ( dp [ i - 1 ] % mod ) * ( factorial [ i ] % mod ) ) % mod ; } return dp [ n ] ; } static void Main ( ) { int n = 4 ; Console . WriteLine ( ValOfTheExpression ( n ) ) ; } }

Index/key variables: i, n
Accumulator variables: i
Iterator variables: i
Class/struct names: GFG
C# program:
using System ; public class GFG { static void minChocolates ( int [ ] A , int N ) { int [ ] B = new int [ N ] ; for ( int i = 0 ; i < N ; i ++ ) { B [ i ] = 1 ; } for ( int i = 1 ; i < N ; i ++ ) { if ( A [ i ] > A [ i - 1 ] ) B [ i ] = B [ i - 1 ] + 1 ; else B [ i ] = 1 ; } for ( int i = N - 2 ; i >= 0 ; i -- ) { if ( A [ i ] > A [ i + 1 ] ) B [ i ] = Math . Max ( B [ i + 1 ] + 1 , B [ i ] ) ; else B [ i ] = Math . Max ( B [ i ] , 1 ) ; } int sum = 0 ; for ( int i = 0 ; i < N ; i ++ ) { sum += B [ i ] ; } Console . Write ( sum + " STRNEWLINE " ) ; } public static void Main ( String [ ] args ) { int [ ] A = { 23 , 14 , 15 , 14 , 56 , 29 , 14 } ; int N = A . Length ; minChocolates ( A , N ) ; } }

Index/key variables: N, i
Accumulator variables: i, sum
Iterator variables: i
Class/struct names: GFG
C# program:
using System ; class GFG { static void constructArrayWithGivenLCM ( int N ) { int [ ] newArr = new int [ N ] ; int j = 0 ; for ( int i = 1 ; i * i <= N ; i ++ ) { if ( N % i == 0 ) { newArr [ j ] = i ; j ++ ; if ( N / i != i ) { newArr [ j ] = N / i ; j ++ ; } } } Array . Sort ( newArr ) ; for ( int i = j ; i < N ; i ++ ) { Console . Write ( newArr [ i ] + " ▁ " ) ; } } public static void Main ( String [ ] args ) { int N = 12 ; constructArrayWithGivenLCM ( N ) ; } }

Index/key variables: N, i, j
Accumulator variables: i, j
Iterator variables: i
Class/struct names: GFG
C# program:
using System ; using System . Collections . Generic ; class GFG { static int getPower ( int p ) { int res = 1 ; while ( p > 0 ) { res *= 5 ; p -- ; } return res ; } static int countNumbersUtil ( int N ) { int count = 0 ; List < int > digits = new List < int > ( ) ; while ( N > 0 ) { digits . Add ( N % 10 ) ; N /= 10 ; } digits . Reverse ( ) ; int D = digits . Count ; for ( int i = 1 ; i <= D ; i ++ ) { int res = getPower ( i ) ; if ( i == D ) { for ( int p = 1 ; p <= D ; p ++ ) { int x = digits [ p - 1 ] ; int tmp = 0 ; if ( p % 2 == 0 ) { tmp = ( 5 - ( x / 2 + 1 ) ) * getPower ( D - p ) ; } else { tmp = ( 5 - ( x + 1 ) / 2 ) * getPower ( D - p ) ; } res -= tmp ; if ( p % 2 != x % 2 ) { break ; } } } count += res ; } return count ; } static void countNumbers ( int L , int R ) { Console . WriteLine ( countNumbersUtil ( R ) - countNumbersUtil ( L - 1 ) ) ; } public static void Main ( String [ ] args ) { int L = 128 , R = 162 ; countNumbers ( L , R ) ; } }

Accumulator variables: N, count, i, p, res
Iterator variables: i, p
Class/struct names: GFG
C# program:
using System ; class GFG { static int alternatingSumOfFirst_N ( int N ) { int alternateSum = 0 ; for ( int i = 1 ; i <= N ; i ++ ) { if ( i % 2 == 0 ) { alternateSum += - i ; } else { alternateSum += i ; } } return alternateSum ; } public static void Main ( String [ ] args ) { int N = 6 ; Console . Write ( alternatingSumOfFirst_N ( N ) ) ; } }

Accumulator variables: alternateSum, i
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 int findSum ( int N ) { int sum = 0 ; for ( int i = 1 ; i < N ; i ++ ) { if ( gcd ( i , N ) == 1 ) { sum += i ; } } return sum ; } public static void Main ( String [ ] args ) { int N = 5 ; Console . Write ( findSum ( N ) ) ; } }

Accumulator variables: i, sum
Iterator variables: i
Class/struct names: GFG
C# program:
using System ; using System . Collections . Generic ; class GFG { static void solve ( int [ ] arr , int n ) { Dictionary < int , int > mp = new Dictionary < int , int > ( ) ; for ( int i = 0 ; i < n ; i ++ ) { if ( mp . ContainsKey ( arr [ i ] ) ) { mp [ arr [ i ] ] = mp [ arr [ i ] ] + 1 ; } else { mp . Add ( arr [ i ] , 1 ) ; } } int cnt = 0 ; foreach ( KeyValuePair < int , int > x in mp ) { cnt += ( ( x . Value ) * ( x . Value - 1 ) / 2 ) ; } int [ ] ans = new int [ n ] ; for ( int i = 0 ; i < n ; i ++ ) { ans [ i ] = cnt - ( mp [ arr [ i ] ] - 1 ) ; } for ( int i = 0 ; i < n ; i ++ ) { Console . Write ( ans [ i ] + " ▁ " ) ; } } public static void Main ( String [ ] args ) { int [ ] arr = { 1 , 1 , 2 , 1 , 2 } ; int N = arr . Length ; solve ( arr , N ) ; } }

Index/key variables: i, n
Accumulator variables: cnt, i
Iterator variables: i, x
Class/struct names: GFG
C# program:
using System ; using System . Collections . Generic ; class GFG { public static void findMode ( int [ ] a , int n ) { Dictionary < int , int > map = new Dictionary < int , int > ( ) ; int max = 0 ; int mode = 0 ; for ( int i = 0 ; i < n ; i ++ ) { if ( map . ContainsKey ( a [ i ] ) ) { map [ a [ i ] ] = map [ a [ i ] ] + 1 ; } else { map . Add ( a [ i ] , 1 ) ; } if ( map [ a [ i ] ] >= max ) { max = map [ a [ i ] ] ; mode = a [ i ] ; } Console . Write ( mode ) ; Console . Write ( " ▁ " ) ; } } public static void Main ( String [ ] args ) { int [ ] arr = { 2 , 7 , 3 , 2 , 5 } ; int n = arr . Length ; findMode ( arr , n ) ; } }

Index/key variables: i
Accumulator variables: i
Iterator variables: i
Class/struct names: GFG
C# program:
using System . Collections . Generic ; using System ; class GFG { static long modexp ( long x , long n , long m ) { if ( n == 0 ) { return 1 ; } else if ( n % 2 == 0 ) { return modexp ( ( x * x ) % m , n / 2 , m ) ; } else { return ( x * modexp ( ( x * x ) % m , ( n - 1 ) / 2 , m ) % m ) ; } } static long modInverse ( long x , long m ) { return modexp ( x , m - 2 , m ) ; } static void countNumbers ( string N ) { long m = 1000000007 ; long [ ] factorial = new long [ 100001 ] ; factorial [ 0 ] = 1 ; for ( int i = 1 ; i < 100001 ; i ++ ) { factorial [ i ] = ( factorial [ i - 1 ] * i ) % m ; } long [ ] count = new long [ 10 ] ; for ( int i = 0 ; i < 10 ; i ++ ) { count [ i ] = 0 ; } long length = N . Length ; for ( int i = 0 ; i < length ; i ++ ) count [ N [ i ] - '0' ] ++ ; long result = factorial [ ( int ) length ] ; for ( int i = 0 ; i < 10 ; i ++ ) { result = ( result * modInverse ( factorial [ ( int ) count [ i ] ] , m ) ) % m ; } Console . WriteLine ( result ) ; } public static void Main ( ) { string N = "0223" ; countNumbers ( N ) ; } }

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 int [ ] spf = new int [ 10001 ] ; static void spf_array ( int [ ] spf ) { spf [ 1 ] = 1 ; for ( int i = 2 ; i < 1000 ; i ++ ) spf [ i ] = i ; for ( int i = 4 ; i < 1000 ; i += 2 ) spf [ i ] = 2 ; for ( int i = 3 ; i * i < 1000 ; i ++ ) { if ( spf [ i ] == i ) { for ( int j = i * i ; j < 1000 ; j += i ) if ( spf [ j ] == j ) spf [ j ] = i ; } } } static void frequent_prime ( int [ ] arr , int N , int K ) { spf_array ( spf ) ; SortedDictionary < int , int > Hmap = new SortedDictionary < int , int > ( ) ; List < int > result = new List < int > ( ) ; int i = 0 ; for ( i = 0 ; i < N ; i ++ ) { int x = arr [ i ] ; while ( x != 1 ) { if ( Hmap . ContainsKey ( spf [ x ] ) ) Hmap [ spf [ x ] ] = spf [ x ] + 1 ; else Hmap . Add ( spf [ x ] , 1 ) ; x = x / spf [ x ] ; } } Hmap . Remove ( 1 ) ; foreach ( KeyValuePair < int , int > x in Hmap ) { int primeNum = x . Key ; int frequency = x . Value ; if ( frequency % K == 0 ) { result . Add ( primeNum ) ; } } if ( result . Count > 0 ) { foreach ( int it in result ) { Console . Write ( it + " ▁ " ) ; } } else { Console . Write ( " { } " ) ; } } public static void Main ( String [ ] args ) { int [ ] arr = { 1 , 4 , 6 } ; int K = 1 ; int N = arr . Length ; frequent_prime ( arr , N , K ) ; } }

Index/key variables: i, j, x
Accumulator variables: i, j
Iterator variables: i, it, j, x
Class/struct names: GFG
C# program:
using System ; class GFG { static void Kmultiples ( int n , int k ) { int a = n ; for ( int i = 1 ; i <= k ; i ++ ) { Console . Write ( n + " ▁ * ▁ " + i + " ▁ = ▁ " + a + " STRNEWLINE " ) ; int j = 0 ; while ( n >= ( 1 << j ) ) { a += n & ( 1 << j ) ; j ++ ; } } } public static void Main ( String [ ] args ) { int N = 16 , K = 7 ; Kmultiples ( N , K ) ; } }

Accumulator variables: a, i, j
Iterator variables: i
Class/struct names: GFG
C# program:
using System ; using System . Linq ; class GFG { private static double calculateB ( int [ ] x , int [ ] y ) { int n = x . Length ; int sx = x . Sum ( ) ; int sy = y . Sum ( ) ; int sxsy = 0 ; int sx2 = 0 ; for ( int i = 0 ; i < n ; i ++ ) { sxsy += x [ i ] * y [ i ] ; sx2 += x [ i ] * x [ i ] ; } double b = ( double ) ( n * sxsy - sx * sy ) / ( n * sx2 - sx * sx ) ; return b ; } public static void leastRegLine ( int [ ] X , int [ ] Y ) { double b = calculateB ( X , Y ) ; int n = X . Length ; int meanX = X . Sum ( ) / n ; int meanY = Y . Sum ( ) / n ; double a = meanY - b * meanX ; Console . WriteLine ( " Regression ▁ line : " ) ; Console . Write ( " Y ▁ = ▁ " ) ; Console . Write ( " { 0 : F3 } " , a ) ; Console . Write ( " ▁ + ▁ " ) ; Console . Write ( " { 0 : F3 } " , b ) ; Console . Write ( " * X " ) ; } public static void Main ( String [ ] args ) { int [ ] X = { 95 , 85 , 80 , 70 , 60 } ; int [ ] Y = { 90 , 80 , 70 , 65 , 60 } ; leastRegLine ( X , Y ) ; } }

Index/key variables: i
Accumulator variables: i, sx2, sxsy
Iterator variables: i
Class/struct names: GFG
C# program:
using System ; class GFG { static int countRepeatingDigits ( int N ) { int res = 0 ; int [ ] cnt = new int [ 10 ] ; while ( N > 0 ) { int rem = N % 10 ; cnt [ rem ] ++ ; N = N / 10 ; } for ( int i = 0 ; i < 10 ; i ++ ) { if ( cnt [ i ] > 1 ) { res ++ ; } } return res ; } public static void Main ( String [ ] args ) { int N = 12 ; Console . WriteLine ( countRepeatingDigits ( N ) ) ; } }

Index/key variables: i, rem
Accumulator variables: i, res
Iterator variables: i
Class/struct names: GFG
C# program:
using System ; class GFG { static void findTemperature ( int x , int y , int s ) { double Day1 , Day2 ; double diff = ( x - y ) * 6 ; Day2 = ( diff + s ) / 2 ; Day1 = s - Day2 ; Console . Write ( " Day1 ▁ : ▁ " + Day1 + ' STRNEWLINE ' ) ; Console . WriteLine ( " Day2 ▁ : ▁ " + Day2 + ' STRNEWLINE ' ) ; } public static void Main ( string [ ] args ) { int x = 5 , y = 10 , s = 40 ; findTemperature ( x , y , s ) ; } }

Class/struct names: GFG
C# program:
using System ; class GFG { static int freqCount ( String str , char k ) { int count = 0 ; for ( int i = 0 ; i < str . Length ; i ++ ) { if ( str [ i ] == k ) count ++ ; } return count ; } static void findAandB ( int n , int k ) { int flag = 0 ; for ( int i = 1 ; i < n ; i ++ ) { if ( freqCount ( i . ToString ( ) , ( char ) ( k + 48 ) ) == 0 && freqCount ( ( n - i ) . ToString ( ) , ( char ) ( k + 48 ) ) == 0 ) { Console . Write ( " ( " + i + " , ▁ " + ( n - i ) + " ) " ) ; flag = 1 ; break ; } } if ( flag == 0 ) Console . Write ( - 1 ) ; } public static void Main ( String [ ] args ) { int N = 100 ; int K = 0 ; findAandB ( N , K ) ; } }

Index/key variables: i
Accumulator variables: count, i
Iterator variables: i
Class/struct names: GFG
C# program:
using System ; class GFG { static long calculate ( long p , long q ) { long mod = 998244353 , expo ; expo = mod - 2 ; while ( expo != 0 ) { if ( ( expo & 1 ) == 1 ) { p = ( p * q ) % mod ; } q = ( q * q ) % mod ; expo >>= 1 ; } return p ; } public static void Main ( string [ ] args ) { long p = 1 , q = 4 ; Console . WriteLine ( calculate ( p , q ) ) ; } }

Class/struct names: GFG
C# program:
using System ; class GFG { static void maxLCMWithGivenSum ( int X ) { int A , B ; if ( ( X & 1 ) == 1 ) { A = X / 2 ; B = X / 2 + 1 ; } else { if ( ( X / 2 ) % 2 == 0 ) { A = X / 2 - 1 ; B = X / 2 + 1 ; } else { A = X / 2 - 2 ; B = X / 2 + 2 ; } } Console . WriteLine ( A + " ▁ " + B ) ; } public static void Main ( String [ ] args ) { int X = 30 ; maxLCMWithGivenSum ( X ) ; } }

Class/struct names: GFG
C# program:
using System ; class GFG { static int MaxSubarrayLength ( int [ ] arr , int n , int k ) { int left = - 1 ; int right = 0 ; int sum = 0 ; for ( int i = 0 ; i < n ; i ++ ) { if ( ( arr [ i ] % k ) != 0 ) { if ( left == - 1 ) { left = i ; } right = i ; } sum += arr [ i ] ; } if ( ( sum % k ) != 0 ) { return n ; } else if ( left == - 1 ) { return - 1 ; } else { int prefix_length = left + 1 ; int suffix_length = n - right ; return n - Math . Min ( prefix_length , suffix_length ) ; } } public static void Main ( string [ ] args ) { int [ ] arr = { 6 , 3 , 12 , 15 } ; int n = arr . Length ; int K = 3 ; Console . Write ( MaxSubarrayLength ( arr , n , K ) ) ; } }

Index/key variables: i
Accumulator variables: i, sum
Iterator variables: i
Class/struct names: GFG
C# program:
using System ; class GFG { static int solve ( int X , int Y ) { if ( X > Y ) { int temp = X ; X = Y ; Y = temp ; } if ( X == Y ) Console . WriteLine ( 0 ) ; else if ( Y % X == 0 ) Console . WriteLine ( 1 ) ; else Console . WriteLine ( 2 ) ; return 0 ; } public static void Main ( String [ ] args ) { int X = 8 , Y = 13 ; solve ( X , Y ) ; } }

Class/struct names: GFG
C# program:
using System ; using System . Collections . Generic ; class GFG { static long countQuadraples ( long N ) { long cnt = 0 ; Dictionary < long , long > m = new Dictionary < long , long > ( ) ; for ( long a = 1 ; a <= N ; a ++ ) { for ( long b = 1 ; b <= N ; b ++ ) { long x = a * a + b * b ; if ( m . ContainsKey ( x ) ) m [ x ] = m [ x ] + 1 ; else m . Add ( x , 1 ) ; } } for ( long c = 1 ; c <= N ; c ++ ) { for ( long d = 1 ; d <= N ; d ++ ) { long x = c * c + d * d ; if ( m . ContainsKey ( x ) ) cnt += m [ x ] ; } } return cnt ; } public static void Main ( String [ ] args ) { long N = 2 ; Console . WriteLine ( countQuadraples ( N ) ) ; } }

Index/key variables: x
Accumulator variables: a, b, c, cnt, d
Iterator variables: a, b, c, d
Class/struct names: GFG
C# program:
using System ; class GFG { static int count_pairs ( int [ ] a , int [ ] b , int N ) { int i , j ; int count = 0 ; for ( i = 0 ; i < ( N - 1 ) ; i ++ ) { for ( j = ( i + 1 ) ; j < N ; j ++ ) { if ( ( a [ i ] + a [ j ] ) > ( b [ i ] + b [ j ] ) ) { count ++ ; } } } return count ; } public static void Main ( ) { int N = 5 ; int [ ] a = new int [ ] { 1 , 2 , 3 , 4 , 5 } ; int [ ] b = new int [ ] { 2 , 5 , 6 , 1 , 9 } ; Console . Write ( count_pairs ( a , b , N ) ) ; } }

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 numberOfPairs ( int [ ] a , int [ ] b , int n ) { int [ ] c = new int [ n ] ; for ( int i = 0 ; i < n ; i ++ ) { c [ i ] = a [ i ] - b [ i ] ; } Array . Sort ( c ) ; int answer = 0 ; for ( int i = 1 ; i < n ; i ++ ) { if ( c [ i ] <= 0 ) continue ; int pos = - 1 ; for ( int j = 0 ; j < n ; j ++ ) { if ( c [ i ] + c [ j ] > 0 ) { pos = j ; break ; } } answer += ( i - pos ) ; } return answer ; } static void Main ( ) { int n = 5 ; int [ ] a = { 1 , 2 , 3 , 4 , 5 } ; int [ ] b = { 2 , 5 , 6 , 1 , 9 } ; Console . WriteLine ( numberOfPairs ( a , b , n ) ) ; } }

Index/key variables: i, j, n
Accumulator variables: answer, i, j
Iterator variables: i, j
Class/struct names: GFG
C# program:
using System ; using System . Collections ; using System . Collections . Generic ; class GFG { static void print_h_index ( int [ ] arr , int N ) { ArrayList ms = new ArrayList ( ) ; for ( int i = 0 ; i < N ; i ++ ) { ms . Add ( arr [ i ] ) ; int t = int . MaxValue ; foreach ( int x in ms ) { if ( x < t ) { t = x ; } } if ( t < ms . Count ) { ms . Remove ( t ) ; } Console . Write ( ms . Count + " ▁ " ) ; } } public static void Main ( string [ ] args ) { int [ ] arr = { 9 , 10 , 7 , 5 , 0 , 10 , 2 , 0 } ; int N = arr . Length ; print_h_index ( arr , N ) ; } }

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