dhyuti-n/xlcost-variable-roles huggingface dataset:
C# program:
using System ; class GFG { static int factorial ( int n ) { int fact = 1 ; for ( int i = 2 ; i <= n ; i ++ ) fact = fact * i ; return fact ; } static int ncr ( int n , int r ) { return factorial ( n ) / ( factorial ( r ) * factorial ( n - r ) ) ; } static int countWays ( String str ) { int [ ] freq = new int [ 26 ] ; for ( int i = 0 ; i < 26 ; i ++ ) { freq [ i ] = 0 ; } int nvowels = 0 , nconsonants = 0 ; int vplaces , cways , vways ; for ( int i = 0 ; i < str . Length ; i ++ ) ++ freq [ str [ i ] - ' a ' ] ; for ( int i = 0 ; i < 26 ; i ++ ) { if ( i == 0 i == 4 i == 8 i == 14 i == 20 ) nvowels += freq [ i ] ; else nconsonants += freq [ i ] ; } vplaces = nconsonants + 1 ; cways = factorial ( nconsonants ) ; for ( int i = 0 ; i < 26 ; i ++ ) { if ( i != 0 && i != 4 && i != 8 && i != 14 && i != 20 && freq [ i ] > 1 ) { cways = cways / factorial ( freq [ i ] ) ; } } vways = ncr ( vplaces , nvowels ) * factorial ( nvowels ) ; for ( int i = 0 ; i < 26 ; i ++ ) { if ( i == 0 i == 4 i == 8 i == 14 i == 20 && freq [ i ] > 1 ) { vways = vways / factorial ( freq [ i ] ) ; } } return cways * vways ; } public static void Main ( ) { String str = " permutation " ; Console . WriteLine ( countWays ( str ) ) ; } }

Index/key variables: i
Accumulator variables: i, nconsonants, nvowels
Iterator variables: i
Class/struct names: GFG
C# program:
using System ; class GFG { static int setBits ( int n ) { int count = 0 ; while ( n > 0 ) { n = n & ( n - 1 ) ; count ++ ; } return count ; } static int countPairs ( int [ ] a , int n ) { int count = 0 ; for ( int i = 0 ; i < n - 1 ; i ++ ) { int setbits_x = setBits ( a [ i ] ) ; for ( int j = i + 1 ; j < n ; j ++ ) { int setbits_y = setBits ( a [ j ] ) ; int setbits_xor_xy = setBits ( a [ i ] ^ a [ j ] ) ; if ( setbits_x + setbits_y == setbits_xor_xy ) count ++ ; } } return count ; } public static void Main ( ) { int [ ] a = { 2 , 3 , 4 , 5 , 6 } ; int n = a . Length ; Console . Write ( countPairs ( a , n ) ) ; } }

Index/key variables: i, j
Accumulator variables: count, i, j
Iterator variables: i, j
Class/struct names: GFG
C# program:
using System ; public class GFG { static int gcd ( int a , int b ) { if ( a == 0 ) return b ; return gcd ( b % a , a ) ; } static int findPossibleDerivables ( int [ ] arr , int n , int D , int A , int B ) { int gcdAB = gcd ( A , B ) ; int counter = 0 ; for ( int i = 0 ; i < n ; i ++ ) { if ( ( Math . Abs ( arr [ i ] - D ) % gcdAB ) == 0 ) { counter ++ ; } } return counter ; } public static void Main ( ) { int [ ] arr = { 1 , 2 , 3 , 4 , 7 , 13 } ; int n = arr . Length ; int D = 5 , A = 4 , B = 2 ; Console . WriteLine ( findPossibleDerivables ( arr , n , D , A , B ) ) ; int [ ] a = { 1 , 2 , 3 } ; n = a . Length ; D = 6 ; A = 3 ; B = 2 ; Console . WriteLine ( findPossibleDerivables ( a , n , D , A , B ) ) ; } }

Index/key variables: i
Accumulator variables: counter, i
Iterator variables: i
Class/struct names: GFG
C# program:
using System ; class GFG { static int calSum ( int n ) { return ( n * ( 2 * n * n * n + 12 * n * n + 25 * n + 21 ) ) / 2 ; } static public void Main ( ) { int n = 3 ; Console . WriteLine ( calSum ( n ) ) ; } }

Class/struct names: GFG
C# program:
using System ; class GFG { static void getElements ( int a , int [ ] arr , int n ) { int [ ] elements = new int [ n + 1 ] ; elements [ 0 ] = a ; for ( int i = 0 ; i < n ; i ++ ) { elements [ i + 1 ] = arr [ i ] ^ elements [ i ] ; } for ( int i = 0 ; i < n + 1 ; i ++ ) Console . Write ( elements [ i ] + " ▁ " ) ; } public static void Main ( ) { int [ ] arr = { 13 , 2 , 6 , 1 } ; int n = arr . Length ; int a = 5 ; getElements ( a , arr , 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 maxGCD ( int N , int P ) { int ans = 1 ; Dictionary < int , int > prime_factors = new Dictionary < int , int > ( ) ; for ( int i = 2 ; i * i <= P ; i ++ ) { while ( P % i == 0 ) { if ( ! prime_factors . ContainsKey ( i ) ) prime_factors . Add ( i , 1 ) ; else prime_factors [ i ] = prime_factors [ i ] + 1 ; P /= i ; } } if ( P != 1 ) if ( ! prime_factors . ContainsKey ( P ) ) prime_factors . Add ( P , 1 ) ; else prime_factors [ P ] = prime_factors [ P ] + 1 ; foreach ( KeyValuePair < int , int > me in prime_factors ) { ans *= ( int ) Math . Pow ( me . Key , me . Value / N ) ; } return ans ; } public static void Main ( String [ ] args ) { int N = 3 , P = 24 ; Console . WriteLine ( maxGCD ( N , P ) ) ; } }

Index/key variables: P, i
Accumulator variables: P, ans, i
Iterator variables: i, me
Class/struct names: GFG
C# program:
using System ; public class GFG { static int distinctDigitSum ( int n ) { bool [ ] used = new bool [ 10 ] ; int sum = 0 ; while ( n > 0 ) { int digit = n % 10 ; if ( ! used [ digit ] ) { used [ digit ] = true ; sum += digit ; } n = n / 10 ; } return sum ; } static String checkSum ( int m , int n ) { int sumM = distinctDigitSum ( m ) ; int sumN = distinctDigitSum ( n ) ; if ( sumM == sumN ) return " YES " ; return " NO " ; } static public void Main ( ) { int m = 2452 , n = 9222 ; Console . WriteLine ( checkSum ( m , n ) ) ; } }

Index/key variables: digit
Accumulator variables: sum
Class/struct names: GFG
C# program:
using System ; using System . Collections ; class solution { static bool isPrime ( int n ) { if ( n <= 1 ) return false ; if ( n <= 3 ) return true ; if ( n % 2 == 0 n % 3 == 0 ) return false ; for ( int i = 5 ; i * i <= n ; i = i + 6 ) if ( n % i == 0 || n % ( i + 2 ) == 0 ) return false ; return true ; } static int countPairs ( int [ ] a , int n ) { int count = 0 ; Hashtable m = new Hashtable ( ) ; for ( int i = 0 ; i < n - 1 ; i ++ ) { for ( int j = i + 1 ; j < n ; j ++ ) { if ( isPrime ( a [ i ] ^ a [ j ] ) && m [ a [ i ] ^ a [ j ] ] == null ) { m . Add ( ( a [ i ] ^ a [ j ] ) , 1 ) ; count ++ ; } } } return count ; } public static void Main ( ) { int [ ] a = { 10 , 12 , 23 , 45 , 5 , 6 } ; int n = a . Length ; Console . WriteLine ( countPairs ( a , n ) ) ; } }

Index/key variables: i, j
Accumulator variables: count, i, j
Iterator variables: i, j
Class/struct names: solution
C# program:
using System ; using System . Collections . Generic ; class GFG { static int MAXN = 1000001 ; static int [ ] spf = new int [ MAXN ] ; static void sieve ( ) { spf [ 1 ] = 1 ; for ( int i = 2 ; i < MAXN ; i ++ ) spf [ i ] = i ; for ( int i = 4 ; i < MAXN ; i += 2 ) spf [ i ] = 2 ; for ( int i = 3 ; i * i < MAXN ; i ++ ) { if ( spf [ i ] == i ) { for ( int j = i * i ; j < MAXN ; j += i ) if ( spf [ j ] == j ) spf [ j ] = i ; } } } static int sumFactors ( int [ ] arr , int n ) { sieve ( ) ; Dictionary < int , int > map = new Dictionary < int , int > ( ) ; for ( int i = 0 ; i < MAXN ; ++ i ) map . Add ( i , 0 ) ; for ( int i = 0 ; i < n ; ++ i ) { if ( map . ContainsKey ( arr [ i ] ) ) { map [ arr [ i ] ] = 1 ; } else { map . Add ( arr [ i ] , 1 ) ; } } int sum = 0 ; for ( int i = 0 ; i < n ; ++ i ) { int num = arr [ i ] ; while ( num != 1 && ( int ) ( map [ spf [ num ] ] ) == 1 ) { num /= spf [ num ] ; } if ( num == 1 ) sum += arr [ i ] ; } return sum ; } public static void Main ( String [ ] args ) { int [ ] arr = { 5 , 11 , 55 , 25 , 100 } ; int n = arr . Length ; Console . WriteLine ( sumFactors ( arr , n ) ) ; } }

Index/key variables: MAXN, i, j, num
Accumulator variables: i, j, num, sum
Iterator variables: i, j
Class/struct names: GFG
C# program:
using System ; class GFG { static int doubleFactorial ( int n ) { int fact = 1 ; for ( int i = 1 ; i <= n ; i = i + 2 ) { fact = fact * i ; } return fact ; } static int hermiteNumber ( int n ) { if ( n % 2 == 1 ) return 0 ; else { int number = ( int ) ( Math . Pow ( 2 , n / 2 ) ) * doubleFactorial ( n - 1 ) ; if ( ( n / 2 ) % 2 == 1 ) number = number * - 1 ; return number ; } } public static void Main ( ) { int n = 6 ; Console . WriteLine ( hermiteNumber ( n ) ) ; } }

Iterator variables: i
Class/struct names: GFG
C# program:
using System ; using System . Collections . Generic ; public class GFG { static int N = 100005 ; static long MAX = ( long ) 1e18 ; static List < long > powers = new List < long > ( ) ; static HashSet < long > squares = new HashSet < long > ( ) ; static HashSet < long > s = new HashSet < long > ( ) ; static void powersPrecomputation ( ) { for ( long i = 2 ; i < N ; i ++ ) { squares . Add ( i * i ) ; if ( squares . Contains ( i ) ) continue ; long temp = i ; while ( i * i <= MAX / temp ) { temp *= ( i * i ) ; s . Add ( temp ) ; } } foreach ( long x in s ) powers . Add ( x ) ; } static long calculateAnswer ( long L , long R ) { powersPrecomputation ( ) ; long perfectSquares = ( long ) ( Math . Floor ( Math . Sqrt ( R ) ) - Math . Floor ( Math . Sqrt ( L - 1 ) ) ) ; long high = Array . BinarySearch ( powers . ToArray ( ) , R ) ; long low = Array . BinarySearch ( powers . ToArray ( ) , L ) ; long perfectPowers = perfectSquares + ( high - low ) ; long ans = ( R - L + 1 ) - perfectPowers ; return ans ; } public static void Main ( String [ ] args ) { long L = 13 , R = 20 ; Console . WriteLine ( calculateAnswer ( L , R ) ) ; } }

Accumulator variables: i, temp
Iterator variables: i, x
Class/struct names: GFG
C# program:
using System ; public class GFG { static void printThreeParts ( int N ) { if ( N % 3 == 0 ) Console . WriteLine ( " ▁ x ▁ = ▁ 1 , ▁ y ▁ = ▁ 1 , ▁ z ▁ = ▁ " + ( N - 2 ) ) ; else Console . WriteLine ( " ▁ x ▁ = ▁ 1 , ▁ y ▁ = ▁ 2 , ▁ z ▁ = ▁ " + ( N - 3 ) ) ; } static public void Main ( ) { int N = 10 ; printThreeParts ( N ) ; } }

Class/struct names: GFG
C# program:
using System ; class GFG { static bool isPrime ( int N ) { for ( int i = 2 ; i <= Math . Sqrt ( N ) ; i ++ ) { if ( N % i == 0 ) return false ; } return true ; } static int getDifference ( int N ) { if ( N == 0 ) return 2 ; else if ( N == 1 ) return 1 ; else if ( isPrime ( N ) ) return 0 ; int aboveN = - 1 , belowN = - 1 ; int n1 ; n1 = N + 1 ; while ( true ) { if ( isPrime ( n1 ) ) { aboveN = n1 ; break ; } else n1 ++ ; } n1 = N - 1 ; while ( true ) { if ( isPrime ( n1 ) ) { belowN = n1 ; break ; } else n1 -- ; } int diff1 = aboveN - N ; int diff2 = N - belowN ; return Math . Min ( diff1 , diff2 ) ; } public static void Main ( ) { int N = 25 ; Console . WriteLine ( getDifference ( N ) ) ; } }

Accumulator variables: i, n1
Iterator variables: i
Class/struct names: GFG
C# program:
using System ; public class GFG { static bool check ( int [ ] arr , int x , int n ) { long sum = 0 ; for ( int i = 0 ; i < n ; i ++ ) { double y = Math . Sqrt ( arr [ i ] ) ; if ( Math . Floor ( y ) == Math . Ceiling ( y ) ) { sum += arr [ i ] ; } } if ( sum % x == 0 ) return true ; else return false ; } public static void Main ( ) { int [ ] arr = { 2 , 3 , 4 , 9 , 10 } ; int n = arr . Length ; int x = 13 ; if ( check ( arr , x , n ) ) { Console . Write ( " Yes " ) ; } else { Console . Write ( " No " ) ; } } }

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 int MAX = ( int ) 1e5 ; static int findLargestDivisor ( int n ) { int m = n ; HashSet < int > s = new HashSet < int > ( ) ; s . Add ( 1 ) ; s . Add ( n ) ; for ( int i = 2 ; i < ( int ) Math . Sqrt ( n ) + 1 ; i ++ ) { if ( n % i == 0 ) { s . Add ( n / i ) ; s . Add ( i ) ; while ( m % i == 0 ) m /= i ; } } if ( m > 1 ) s . Add ( m ) ; List < int > l = new List < int > ( s ) ; l . Sort ( ) ; l . Reverse ( ) ; List < int > vec = new List < int > ( ) ; for ( int i = 2 ; i <= MAX ; i ++ ) vec . Add ( i * i ) ; foreach ( int d in l ) { int divi = 0 ; for ( int j = 0 ; j < vec . Count && vec [ j ] <= d ; j ++ ) { if ( d % vec [ j ] == 0 ) { divi = 1 ; break ; } } if ( divi == 0 ) return d ; } return 0 ; } static void Main ( ) { int n = 12 ; Console . WriteLine ( findLargestDivisor ( n ) ) ; n = 97 ; Console . WriteLine ( findLargestDivisor ( n ) ) ; } }

Index/key variables: j
Accumulator variables: i, j, m
Iterator variables: d, i, j
Class/struct names: GFG
C# program:
using System ; class GFG { static void MinimumMaximumPairs ( int n , int m ) { int max_pairs = ( ( n - m + 1 ) * ( n - m ) ) / 2 ; int min_pairs = m * ( ( ( n - m ) / m + 1 ) * ( ( n - m ) / m ) ) / 2 + ( int ) Math . Ceiling ( ( double ) ( ( n - m ) / ( double ) ( m ) ) ) * ( ( n - m ) % m ) ; Console . WriteLine ( " Minimum ▁ no . ▁ of ▁ pairs ▁ = ▁ " + min_pairs ) ; Console . WriteLine ( " Maximum ▁ no . ▁ of ▁ pairs ▁ = ▁ " + max_pairs ) ; } public static void Main ( ) { int n = 5 , m = 2 ; MinimumMaximumPairs ( n , m ) ; } }

Class/struct names: GFG
C# program:
using System ; public class GFG { static void findGreater ( int a , int b ) { double x = ( double ) a * ( double ) ( Math . Log ( ( double ) ( b ) ) ) ; double y = ( double ) b * ( double ) ( Math . Log ( ( double ) ( a ) ) ) ; if ( y > x ) { Console . Write ( " a ^ b ▁ is ▁ greater STRNEWLINE " ) ; } else if ( y < x ) { Console . Write ( " b ^ a ▁ is ▁ greater " + " STRNEWLINE " ) ; } else { Console . Write ( " Both ▁ are ▁ equal " ) ; } } public static void Main ( ) { int a = 3 , b = 5 , c = 2 , d = 4 ; findGreater ( a , b ) ; findGreater ( c , d ) ; } }

Class/struct names: GFG
C# program:
using System ; public class GFG { static long m = 1000000007 ; static long gcd ( long a , long b ) { if ( a == 0 ) return b ; return gcd ( b % a , a ) ; } static long modexp ( long x , long n ) { if ( n == 0 ) { return 1 ; } else if ( n % 2 == 0 ) { return modexp ( ( x * x ) % m , n / 2 ) ; } else { return ( x * modexp ( ( x * x ) % m , ( n - 1 ) / 2 ) % m ) ; } } static long getFractionModulo ( long a , long b ) { long c = gcd ( a , b ) ; a = a / c ; b = b / c ; long d = modexp ( b , m - 2 ) ; long ans = ( ( a % m ) * ( d % m ) ) % m ; return ans ; } static public void Main ( ) { long a = 2 , b = 6 ; Console . WriteLine ( getFractionModulo ( a , b ) ) ; } }

Class/struct names: GFG
C# program:
using System ; class GFG { static int maxPrimeFactors ( int n ) { int num = n ; int maxPrime = - 1 ; while ( n % 2 == 0 ) { maxPrime = 2 ; n /= 2 ; } for ( int i = 3 ; i <= Math . Sqrt ( n ) ; i += 2 ) { while ( n % i == 0 ) { maxPrime = i ; n = n / i ; } } if ( n > 2 ) { maxPrime = n ; } int sum = maxPrime + num ; return sum ; } static void Main ( ) { int n = 19 ; Console . WriteLine ( maxPrimeFactors ( n ) ) ; } }

Accumulator variables: i, n
Iterator variables: i
Class/struct names: GFG
C# program:
using System ; class GFG { static int sumOfDigits ( int n ) { int res = 0 ; while ( n > 0 ) { res += n % 10 ; n /= 10 ; } return res ; } static int findNumber ( int n ) { int i = n - 1 ; while ( i > 0 ) { if ( sumOfDigits ( i ) > sumOfDigits ( n ) ) return i ; i -- ; } return - 1 ; } static public void Main ( ) { int n = 824 ; Console . WriteLine ( findNumber ( n ) ) ; } }

Accumulator variables: i, n, res
Class/struct names: GFG
C# program:
using System ; public class GFG { static int findNth ( int N ) { int b = 14 ; int i ; for ( i = 2 ; i <= N ; i ++ ) { if ( i % 2 == 0 ) b = b * 2 ; else b = b - 8 ; } return b ; } static public void Main ( ) { int N = 6 ; Console . WriteLine ( findNth ( N ) ) ; } }

Accumulator variables: i
Iterator variables: i
Class/struct names: GFG
C# program:
using System ; class GFG { readonly static int N = 4 ; static void predictMatrix ( int [ , ] arr , int range1a , int range1b , int range0a , int range0b , int K , int [ , ] b ) { int c = 0 ; while ( K != 0 ) { K -- ; for ( int i = 0 ; i < N ; i ++ ) { for ( int j = 0 ; j < N ; j ++ ) { c = 0 ; if ( i > 0 && arr [ i - 1 , j ] == 1 ) c ++ ; if ( j > 0 && arr [ i , j - 1 ] == 1 ) c ++ ; if ( i > 0 && j > 0 && arr [ i - 1 , j - 1 ] == 1 ) c ++ ; if ( i < N - 1 && arr [ i + 1 , j ] == 1 ) c ++ ; if ( j < N - 1 && arr [ i , j + 1 ] == 1 ) c ++ ; if ( i < N - 1 && j < N - 1 && arr [ i + 1 , j + 1 ] == 1 ) c ++ ; if ( i < N - 1 && j > 0 && arr [ i + 1 , j - 1 ] == 1 ) c ++ ; if ( i > 0 && j < N - 1 && arr [ i - 1 , j + 1 ] == 1 ) c ++ ; if ( arr [ i , j ] == 1 ) { if ( c >= range1a && c <= range1b ) b [ i , j ] = 1 ; else b [ i , j ] = 0 ; } if ( arr [ i , j ] == 0 ) { if ( c >= range0a && c <= range0b ) b [ i , j ] = 1 ; else b [ i , j ] = 0 ; } } } for ( int k = 0 ; k < N ; k ++ ) for ( int m = 0 ; m < N ; m ++ ) arr [ k , m ] = b [ k , m ] ; } } public static void Main ( ) { int [ , ] arr = { { 0 , 0 , 0 , 0 } , { 0 , 1 , 1 , 0 } , { 0 , 0 , 1 , 0 } , { 0 , 1 , 0 , 1 } } ; int range1a = 2 , range1b = 2 ; int range0a = 2 , range0b = 3 ; int K = 3 ; int [ , ] b = new int [ N , N ] ; predictMatrix ( arr , range1a , range1b , range0a , range0b , K , b ) ; for ( int i = 0 ; i < N ; i ++ ) { Console . WriteLine ( ) ; for ( int j = 0 ; j < N ; j ++ ) Console . Write ( b [ i , j ] + " ▁ " ) ; } } }

Accumulator variables: K, c, i, j, k, m
Iterator variables: i, j, k, m
Class/struct names: GFG
C# program:
using System ; class GFG { static int countMoves ( int n ) { int ct = 0 ; for ( int i = 1 ; i <= n ; i ++ ) ct += i * ( n - i ) ; ct += n ; return ct ; } static void Main ( ) { int n = 3 ; Console . WriteLine ( countMoves ( n ) ) ; } }

Accumulator variables: ct, i
Iterator variables: i
Class/struct names: GFG
C# program:
using System . Collections ; using System ; class GFG { public static ArrayList getPerfectSquares ( int n ) { ArrayList perfectSquares = new ArrayList ( ) ; int current = 1 , i = 1 ; while ( current <= n ) { perfectSquares . Add ( current ) ; current = ( int ) Math . Pow ( ++ i , 2 ) ; } return perfectSquares ; } public static int countTriplets ( int n ) { ArrayList perfectSquares = getPerfectSquares ( ( int ) Math . Pow ( n , 2 ) ) ; int count = 0 ; for ( int a = 1 ; a <= n ; a ++ ) { int aSquare = ( int ) Math . Pow ( a , 2 ) ; for ( int i = 0 ; i < perfectSquares . Count ; i ++ ) { int cSquare = ( int ) perfectSquares [ i ] ; int bSquare = cSquare - aSquare ; int b = ( int ) Math . Sqrt ( bSquare ) ; int c = ( int ) Math . Sqrt ( cSquare ) ; if ( c < a || ! perfectSquares . Contains ( bSquare ) ) continue ; if ( ( b >= a ) && ( b <= c ) && ( aSquare + bSquare == cSquare ) ) count ++ ; } } return count ; } public static void Main ( ) { int n = 10 ; Console . WriteLine ( countTriplets ( n ) ) ; } }

Index/key variables: i
Accumulator variables: a, count, i
Iterator variables: a, i
Class/struct names: GFG
C# program:
using System ; class GFG { static double countNumbers ( int N ) { return ( Math . Pow ( 10 , N ) - 1 ) - ( Math . Pow ( 10 , N ) - Math . Pow ( 8 , N ) ) / 2 ; } static public void Main ( ) { int n = 2 ; Console . WriteLine ( countNumbers ( n ) ) ; } }

Class/struct names: GFG
C# program:
using System ; class GFG { static int N = 3 ; static double calcDeterminant ( int [ ] arr ) { double determinant = 0 ; for ( int i = 0 ; i < N ; i ++ ) { determinant += Math . Pow ( arr [ i ] , 3 ) ; } determinant -= 3 * arr [ 0 ] * arr [ 1 ] * arr [ 2 ] ; return determinant ; } static public void Main ( ) { int [ ] arr = { 4 , 5 , 3 } ; Console . WriteLine ( calcDeterminant ( arr ) ) ; } }

Index/key variables: i
Accumulator variables: determinant, i
Iterator variables: i
Class/struct names: GFG
C# program:
using System ; class GFG { static int minimumMoves ( int k , int l , int r ) { int count = r - l + 1 ; if ( count % k == 0 ) return 0 ; return ( k - ( count % k ) ) ; } public static void Main ( ) { int k = 3 , l = 10 , r = 10 ; Console . WriteLine ( minimumMoves ( k , l , r ) ) ; } }

Class/struct names: GFG
C# program:
using System ; public class GFG { static int sumNatural ( int n ) { int sum = ( n * ( n + 1 ) ) ; return sum ; } static int sumEven ( int l , int r ) { return sumNatural ( r / 2 ) - sumNatural ( ( l - 1 ) / 2 ) ; } static public void Main ( ) { int l = 2 , r = 5 ; Console . WriteLine ( " Sum ▁ of ▁ Natural ▁ numbers ▁ from ▁ L ▁ to ▁ R ▁ is ▁ " + sumEven ( l , r ) ) ; } }

Class/struct names: GFG
C# program:
using System ; class GFG { static bool isDivisibleRec ( int x , int a , int b , int n ) { if ( x > n ) return false ; if ( n % x == 0 ) return true ; return ( isDivisibleRec ( x * 10 + a , a , b , n ) || isDivisibleRec ( x * 10 + b , a , b , n ) ) ; } static bool isDivisible ( int a , int b , int n ) { return isDivisibleRec ( a , a , b , n ) || isDivisibleRec ( b , a , b , n ) ; } static public void Main ( ) { int a = 3 , b = 5 , n = 53 ; if ( isDivisible ( a , b , n ) ) Console . WriteLine ( " Yes " ) ; else Console . WriteLine ( " No " ) ; } }

Class/struct names: GFG
C# program:
using System ; class GFG { static void MinSteps ( int SourceX , int SourceY , int DestX , int DestY ) { Console . WriteLine ( Math . Max ( Math . Abs ( SourceX - DestX ) , Math . Abs ( SourceY - DestY ) ) ) ; while ( ( SourceX != DestX ) || ( SourceY != DestY ) ) { if ( SourceX < DestX ) { Console . Write ( ' U ' ) ; SourceX ++ ; } if ( SourceX > DestX ) { Console . Write ( ' D ' ) ; SourceX -- ; } if ( SourceY > DestY ) { Console . Write ( ' L ' ) ; SourceY -- ; } if ( SourceY < DestY ) { Console . Write ( ' R ' ) ; SourceY ++ ; } Console . WriteLine ( ) ; } } public static void Main ( ) { int sourceX = 4 , sourceY = 4 ; int destinationX = 7 , destinationY = 0 ; MinSteps ( sourceX , sourceY , destinationX , destinationY ) ; } }

Accumulator variables: SourceX, SourceY
Class/struct names: GFG
C# program:
using System ; using System . Collections ; using System . Collections . Generic ; public class GFG { public static ArrayList getPerfectSquares ( int n ) { ArrayList perfectSquares = new ArrayList ( ) ; int current = 1 , i = 1 ; while ( current <= n ) { perfectSquares . Add ( current ) ; current = ( int ) Math . Pow ( ++ i , 2 ) ; } return perfectSquares ; } public static int maxPairSum ( int [ ] arr ) { int n = arr . Length ; int max , secondMax ; if ( arr [ 0 ] > arr [ 1 ] ) { max = arr [ 0 ] ; secondMax = arr [ 1 ] ; } else { max = arr [ 1 ] ; secondMax = arr [ 0 ] ; } for ( int i = 2 ; i < n ; i ++ ) { if ( arr [ i ] > max ) { secondMax = max ; max = arr [ i ] ; } else if ( arr [ i ] > secondMax ) { secondMax = arr [ i ] ; } } return ( max + secondMax ) ; } public static int countPairsWith ( int n , ArrayList perfectSquares , ArrayList nums ) { int count = 0 ; for ( int i = 0 ; i < perfectSquares . Count ; i ++ ) { int temp = ( int ) perfectSquares [ i ] - n ; if ( temp > n && nums . Contains ( temp ) ) count ++ ; } return count ; } public static int countPairs ( int [ ] arr ) { int i , n = arr . Length ; int max = maxPairSum ( arr ) ; ArrayList perfectSquares = getPerfectSquares ( max ) ; ArrayList nums = new ArrayList ( ) ; for ( i = 0 ; i < n ; i ++ ) nums . Add ( arr [ i ] ) ; int count = 0 ; for ( i = 0 ; i < n ; i ++ ) { count += countPairsWith ( arr [ i ] , perfectSquares , nums ) ; } return count ; } public static void Main ( ) { int [ ] arr = { 2 , 3 , 6 , 9 , 10 , 20 } ; Console . WriteLine ( countPairs ( arr ) ) ; } }

Index/key variables: i
Accumulator variables: count, i
Iterator variables: i
Class/struct names: GFG
C# program:
using System ; class GFG { static int findEle ( int [ ] arr , int n ) { int sum = 0 ; for ( int i = 0 ; i < n ; i ++ ) sum += arr [ i ] ; for ( int i = 0 ; i < n ; i ++ ) if ( arr [ i ] == sum - arr [ i ] ) return arr [ i ] ; return - 1 ; } static public void Main ( String [ ] args ) { int [ ] arr = { 1 , 2 , 3 , 6 } ; int n = arr . Length ; Console . WriteLine ( findEle ( arr , n ) ) ; } }

Index/key variables: i
Accumulator variables: i, sum
Iterator variables: i
Class/struct names: GFG
C# program:
using System ; class GFG { static int sumNatural ( int n ) { int sum = ( n * ( n + 1 ) ) / 2 ; return sum ; } static int suminRange ( int l , int r ) { return sumNatural ( r ) - sumNatural ( l - 1 ) ; } static public void Main ( ) { int l = 2 , r = 5 ; Console . WriteLine ( " Sum ▁ of ▁ Natural ▁ numbers ▁ " + " from ▁ L ▁ to ▁ R ▁ is ▁ " + suminRange ( l , r ) ) ; } }

Class/struct names: GFG