dhyuti-n/xlcost-variable-roles huggingface dataset:
C# program:
using System ; class GFG { static double u_cal ( double u , int n ) { double temp = u ; for ( int i = 1 ; i < n ; i ++ ) temp = temp * ( u + i ) ; return temp ; } static int fact ( int n ) { int f = 1 ; for ( int i = 2 ; i <= n ; i ++ ) f *= i ; return f ; } static void Main ( ) { int n = 5 ; double [ ] x = { 1891 , 1901 , 1911 , 1921 , 1931 } ; double [ , ] y = new double [ n , n ] ; y [ 0 , 0 ] = 46 ; y [ 1 , 0 ] = 66 ; y [ 2 , 0 ] = 81 ; y [ 3 , 0 ] = 93 ; y [ 4 , 0 ] = 101 ; for ( int i = 1 ; i < n ; i ++ ) { for ( int j = n - 1 ; j >= i ; j -- ) y [ j , i ] = y [ j , i - 1 ] - y [ j - 1 , i - 1 ] ; } for ( int i = 0 ; i < n ; i ++ ) { for ( int j = 0 ; j <= i ; j ++ ) Console . Write ( y [ i , j ] + " TABSYMBOL " ) ; Console . WriteLine ( " " ) ; ; } double value = 1925 ; double sum = y [ n - 1 , 0 ] ; double u = ( value - x [ n - 1 ] ) / ( x [ 1 ] - x [ 0 ] ) ; for ( int i = 1 ; i < n ; i ++ ) { sum = sum + ( u_cal ( u , i ) * y [ n - 1 , i ] ) / fact ( i ) ; } Console . WriteLine ( " STRNEWLINE ▁ Value ▁ at ▁ " + value + " ▁ is ▁ " + Math . Round ( sum , 4 ) ) ; } }

Accumulator variables: f, i, j
Iterator variables: i, j
Class/struct names: GFG
C# program:
using System ; class GFG { static int sumDigitSquare ( int n ) { int sq = 0 ; while ( n != 0 ) { int digit = n % 10 ; sq += digit * digit ; n = n / 10 ; } return sq ; } static bool isHappy ( int n ) { while ( true ) { if ( n == 1 ) return true ; n = sumDigitSquare ( n ) ; if ( n == 4 ) return false ; } } static public void Main ( ) { int n = 23 ; if ( isHappy ( n ) ) Console . WriteLine ( " Yes " ) ; else Console . WriteLine ( " No " ) ; } }

Accumulator variables: sq
Class/struct names: GFG
C# program:
using System ; class GFG { static long findSumSubsets ( int n ) { return ( n * ( n + 1 ) / 2 ) * ( 1 << ( n - 1 ) ) ; } public static void Main ( ) { int n = 3 ; Console . WriteLine ( findSumSubsets ( n ) ) ; } }

Class/struct names: GFG
C# program:
using System ; class GFG { static int findMin ( int [ ] a , int n ) { double sum = 0 ; for ( int i = 0 ; i < n ; i ++ ) sum += Math . Log ( a [ i ] ) ; int x = ( int ) Math . Exp ( sum / n ) ; return x + 1 ; } public static void Main ( ) { int [ ] a = { 3 , 2 , 1 , 4 } ; int n = a . Length ; Console . WriteLine ( findMin ( a , n ) ) ; } }

Index/key variables: i
Accumulator variables: i, sum
Iterator variables: i
Class/struct names: GFG
C# program:
using System ; class GFG { static int countdigits ( int N ) { int count = 0 ; while ( N > 0 ) { count ++ ; N = N / 10 ; } return count ; } static void cyclic ( int N ) { int num = N ; int n = countdigits ( N ) ; while ( true ) { Console . WriteLine ( num ) ; int rem = num % 10 ; int dev = num / 10 ; num = ( int ) ( ( Math . Pow ( 10 , n - 1 ) ) * rem + dev ) ; if ( num == N ) break ; } } public static void Main ( ) { int N = 5674 ; cyclic ( N ) ; } }

Accumulator variables: count
Class/struct names: GFG
C# program:
using System ; class GFG { static bool sackRace ( int p1 , int s1 , int p2 , int s2 ) { return ( ( s1 > s2 && ( p2 - p1 ) % ( s1 - s2 ) == 0 ) || ( s2 > s1 && ( p1 - p2 ) % ( s2 - s1 ) == 0 ) ) ; } public static void Main ( ) { int p1 = 4 , s1 = 4 , p2 = 8 , s2 = 2 ; if ( sackRace ( p1 , s1 , p2 , s2 ) ) Console . WriteLine ( " Yes " ) ; else Console . WriteLine ( " No " ) ; } }

Class/struct names: GFG
C# program:
using System ; class GFG { public static void solve ( int n ) { double a = n / 2 ; if ( n % 2 != 0 ) { Console . WriteLine ( ( Math . Ceiling ( a ) - 1 ) + " ▁ " + ( Math . Floor ( a ) + 1 ) ) ; } else { if ( ( int ) ( a ) % 2 == 0 ) { Console . WriteLine ( ( Math . Ceiling ( a ) - 1 ) + " ▁ " + ( Math . Floor ( a ) + 1 ) ) ; } else { Console . WriteLine ( ( Math . Ceiling ( a ) - 2 ) + " ▁ " + ( Math . Floor ( a ) + 2 ) ) ; } } } public static void Main ( ) { int n = 34 ; solve ( n ) ; } }

Class/struct names: GFG
C# program:
using System ; class GFG { static int countDigits ( int a , int b ) { int count = 0 ; int p = Math . Abs ( a * b ) ; if ( p == 0 ) return 1 ; while ( p > 0 ) { count ++ ; p = p / 10 ; } return count ; } public static void Main ( ) { int a = 33 ; int b = - 24 ; Console . WriteLine ( " Number ▁ of ▁ digits ▁ = ▁ " + countDigits ( a , b ) ) ; } }

Accumulator variables: count
Class/struct names: GFG
C# program:
using System ; public class GFG { static void multiple ( int a , int b , int x ) { if ( b < 0 ) { if ( a == 1 && x == 1 ) Console . WriteLine ( "1" ) ; else Console . WriteLine ( "0" ) ; } int mul = ( int ) Math . Pow ( a , b ) ; int ans = mul / x ; int ans1 = x * ans ; int ans2 = x * ( ans + 1 ) ; Console . WriteLine ( ( ( mul - ans1 ) <= ( ans2 - mul ) ) ? ans1 : ans2 ) ; } static public void Main ( ) { int a = 349 , b = 1 , x = 4 ; multiple ( a , b , x ) ; } }

Class/struct names: GFG
C# program:
using System ; public class main { static int maxSum ( int n ) { if ( n == 1 ) return 1 ; else return ( n * ( n - 1 ) / 2 ) - 1 + n / 2 ; } public static void Main ( ) { int n = 3 ; Console . WriteLine ( maxSum ( n ) ) ; } }

Class/struct names: main
C# program:
using System ; public class GFG { static int compute_average ( int a , int b ) { return ( a + b ) / 2 ; } static public void Main ( ) { int a = int . MaxValue ; int b = int . MaxValue ; Console . WriteLine ( " Actual ▁ average ▁ : ▁ " + int . MaxValue ) ; Console . WriteLine ( " Computed ▁ average ▁ : ▁ " + compute_average ( a , b ) ) ; } }

Class/struct names: GFG
C# program:
using System ; class GFG { static int minNum ( int [ ] arr , int n ) { bool odd = false ; for ( int i = 0 ; i < n ; i ++ ) if ( arr [ i ] % 2 != 0 ) odd = ! odd ; if ( odd ) return 1 ; return 2 ; } public static void Main ( ) { int [ ] arr = { 1 , 2 , 3 , 4 , 5 , 6 , 7 , 8 , 9 } ; int n = arr . Length ; Console . Write ( minNum ( arr , n ) ) ; } }

Index/key variables: i
Accumulator variables: i
Iterator variables: i
Boolean variables: odd
Class/struct names: GFG
C# program:
using System ; public class GFG { static int msbPos ( int n ) { int pos = 0 ; while ( n != 0 ) { pos ++ ; n = n >> 1 ; } return pos ; } static int josephify ( int n ) { int position = msbPos ( n ) ; int j = 1 << ( position - 1 ) ; n = n ^ j ; n = n << 1 ; n = n | 1 ; return n ; } public static void Main ( ) { int n = 41 ; Console . WriteLine ( josephify ( n ) ) ; } }

Accumulator variables: pos
Class/struct names: GFG
C# program:
using System ; public class CountXor { static int countXorPair ( int [ ] arr , int n ) { int count = 0 ; for ( int i = 0 ; i < n ; i ++ ) { for ( int j = i + 1 ; j < n ; j ++ ) if ( ( arr [ i ] ^ arr [ j ] ) % 2 == 1 ) count ++ ; } return count ; } public static void Main ( ) { int [ ] arr = { 1 , 2 , 3 } ; Console . WriteLine ( countXorPair ( arr , arr . Length ) ) ; } }

Index/key variables: i, j
Accumulator variables: count, i, j
Iterator variables: i, j
Class/struct names: CountXor
C# program:
using System ; class GFG { static int powmod ( int x , int y , int p ) { while ( y > 0 ) { if ( ( y & 1 ) > 0 ) res = ( res * x ) % p ; x = ( x * x ) % p ; } return res ; } static int discreteLogarithm ( int a , int b , int m ) { int n = ( int ) ( Math . Sqrt ( m ) + 1 ) ; int [ ] value = new int [ m ] ; for ( int i = n ; i >= 1 ; -- i ) value [ powmod ( a , i * n , m ) ] = i ; for ( int j = 0 ; j < n ; ++ j ) { int cur = ( powmod ( a , j , m ) * b ) % m ; if ( value [ cur ] > 0 ) { int ans = value [ cur ] * n - j ; if ( ans < m ) return ans ; } } return - 1 ; } static void Main ( ) { int a = 2 , b = 3 , m = 5 ; Console . WriteLine ( discreteLogarithm ( a , b , m ) ) ; a = 3 ; b = 7 ; m = 11 ; Console . WriteLine ( discreteLogarithm ( a , b , m ) ) ; } }

Index/key variables: cur, m
Iterator variables: i, j
Class/struct names: GFG
C# program:
using System ; class GFG { static int discreteLogarithm ( int a , int b , int m ) { int n = ( int ) ( Math . Sqrt ( m ) + 1 ) ; int an = 1 ; for ( int i = 0 ; i < n ; ++ i ) an = ( an * a ) % m ; int [ ] value = new int [ m ] ; for ( int i = 1 , cur = an ; i <= n ; ++ i ) { if ( value [ cur ] == 0 ) value [ cur ] = i ; cur = ( cur * an ) % m ; } for ( int i = 0 , cur = b ; i <= n ; ++ i ) { if ( value [ cur ] > 0 ) { int ans = value [ cur ] * n - i ; if ( ans < m ) return ans ; } cur = ( cur * a ) % m ; } return - 1 ; } static void Main ( ) { int a = 2 , b = 3 , m = 5 ; Console . WriteLine ( discreteLogarithm ( a , b , m ) ) ; a = 3 ; b = 7 ; m = 11 ; Console . WriteLine ( discreteLogarithm ( a , b , m ) ) ; } }

Index/key variables: cur, m
Iterator variables: i
Class/struct names: GFG
C# program:
using System ; class GFG { static string nthprimedigitsnumber ( int number ) { int rem ; string num = " " ; while ( number > 0 ) { rem = number % 4 ; switch ( rem ) { case 1 : num += '2' ; break ; case 2 : num += '3' ; break ; case 3 : num += '5' ; break ; case 0 : num += '7' ; break ; } if ( number % 4 == 0 ) number -- ; number = number / 4 ; } char [ ] st = num . ToCharArray ( ) ; Array . Reverse ( st ) ; return new string ( st ) ; } static void Main ( ) { int number = 21 ; Console . WriteLine ( nthprimedigitsnumber ( 10 ) ) ; Console . WriteLine ( nthprimedigitsnumber ( number ) ) ; } }

Accumulator variables: num, number
Class/struct names: GFG
C# program:
using System ; class Test { static int countPairs ( int N ) { int count = 0 ; for ( int i = 1 ; i <= Math . Pow ( N , ( 1.0 / 3.0 ) ) ; i ++ ) { int cb = i * i * i ; int diff = N - cb ; int cbrtDiff = ( int ) Math . Pow ( diff , ( 1.0 / 3.0 ) ) ; if ( cbrtDiff * cbrtDiff * cbrtDiff == diff ) count ++ ; } return count ; } public static void Main ( ) { for ( int i = 1 ; i <= 10 ; i ++ ) Console . Write ( " For ▁ n ▁ = ▁ " + i + " , ▁ " + + countPairs ( i ) + " ▁ pair ▁ exists " + " STRNEWLINE " ) ; } }

Accumulator variables: count, i
Iterator variables: i
Class/struct names: Test
C# program:
using System ; using System . Collections ; using System . Collections . Generic ; class Test { static Dictionary < long , int > primeFactors ( long num ) { Dictionary < long , int > ans = new Dictionary < long , int > ( ) ; for ( long i = 2 ; i * i <= num ; i ++ ) { while ( num % i == 0 ) { num /= i ; if ( ! ans . ContainsKey ( i ) ) { ans [ i ] = 0 ; } ans [ i ] ++ ; } } if ( num > 1 ) { if ( ! ans . ContainsKey ( num ) ) { ans [ num ] = 0 ; } ans [ num ] ++ ; } return ans ; } static long legendre ( long factor , long num ) { long count = 0 , fac2 = factor ; while ( num >= factor ) { count += num / factor ; factor *= fac2 ; } return count ; } static bool possible ( Dictionary < long , int > factors , long num ) { foreach ( int itr in factors . Keys ) { if ( legendre ( itr , num ) < factors [ itr ] ) return false ; } return true ; } static long search ( long start , long end , Dictionary < long , int > factors ) { long mid = ( start + end ) / 2 ; if ( ! possible ( factors , mid ) ) return search ( mid + 1 , end , factors ) ; if ( start == mid ) return mid ; return search ( start , mid , factors ) ; } static long findFact ( long num ) { Dictionary < long , int > factors = primeFactors ( num ) ; return search ( 1 , num , factors ) ; } public static void Main ( ) { Console . WriteLine ( findFact ( 6 ) ) ; Console . WriteLine ( findFact ( 997587429953L ) ) ; } }

Index/key variables: i, itr, num
Accumulator variables: count, factor, i, num
Iterator variables: i, itr
Class/struct names: Test
C# program:
using System ; using System . Collections ; class Test { static void printEqualModNumbers ( int [ ] arr , int n ) { Array . Sort ( arr ) ; int d = arr [ n - 1 ] - arr [ 0 ] ; if ( d == 0 ) { Console . write ( " Infinite ▁ solution " ) ; return ; } ArrayList v = new ArrayList ( ) ; for ( int i = 1 ; i * i <= d ; i ++ ) { if ( d % i == 0 ) { v . Add ( i ) ; if ( i != d / i ) v . Add ( d / i ) ; } } for ( int i = 0 ; i < v . Count ; i ++ ) { int temp = arr [ 0 ] % ( int ) v [ i ] ; int j ; for ( j = 1 ; j < n ; j ++ ) if ( arr [ j ] % ( int ) v [ i ] != temp ) break ; if ( j == n ) Console . Write ( v [ i ] + " ▁ " ) ; } } public static void Main ( ) { int [ ] arr = { 38 , 6 , 34 } ; printEqualModNumbers ( arr , arr . Length ) ; } }

Index/key variables: i, j
Accumulator variables: i, j
Iterator variables: i, j
Class/struct names: Test
C# program:
using System ; public class GFG { static int FirstDigit ( int [ ] arr , int n ) { double S = 0 ; for ( int i = 0 ; i < n ; i ++ ) S = S + Math . Log10 ( arr [ i ] * 1.0 ) ; double fract_S = S - Math . Floor ( S ) ; int ans = ( int ) Math . Pow ( 10 , fract_S ) ; return ans ; } public static void Main ( ) { int [ ] arr = { 5 , 8 , 3 , 7 } ; int n = arr . Length ; Console . WriteLine ( FirstDigit ( arr , n ) ) ; } }

Index/key variables: i
Accumulator variables: i
Iterator variables: i
Class/struct names: GFG
C# program:
using System ; class GFG { static int countDigit ( int n ) { int temp = n , count = 0 ; while ( temp != 0 ) { int d = temp % 10 ; temp /= 10 ; if ( d > 0 && n % d == 0 ) count ++ ; } return count ; } public static void Main ( ) { int n = 1012 ; Console . Write ( countDigit ( n ) ) ; } }

Accumulator variables: count, temp
Class/struct names: GFG
C# program:
using System ; class GFG { static int makeOdd ( int n ) { if ( n % 2 != 0 ) return 1 ; int ans = 1 ; while ( n % 2 == 0 ) { n /= 2 ; ans *= 2 ; } return ans ; } public static void Main ( ) { int n = 36 ; int res = makeOdd ( n ) ; Console . Write ( res ) ; } }

Accumulator variables: ans, n
Class/struct names: GFG
C# program:
using System ; class Solution { static int closestMultiple ( int n , int x ) { if ( x > n ) return x ; n = n + x / 2 ; n = n - ( n % x ) ; return n ; } public static void Main ( ) { int n = 56287 , x = 27 ; Console . WriteLine ( closestMultiple ( n , x ) ) ; } }

Class/struct names: Solution
C# program:
using System ; class GFG { static void printCubes ( int a , int b ) { int acrt = ( int ) Math . Pow ( a , ( double ) 1 / 3 ) ; int bcrt = ( int ) Math . Pow ( b , ( double ) 1 / 3 ) ; for ( int i = acrt ; i <= bcrt ; i ++ ) if ( i * i * i >= a && i * i * i <= b ) Console . Write ( i * i * i + " ▁ " ) ; } static public void Main ( ) { int a = 24 ; int b = 576 ; Console . WriteLine ( " Perfect ▁ cubes ▁ " + " in ▁ given ▁ range : " ) ; printCubes ( a , b ) ; } }

Accumulator variables: i
Iterator variables: i
Class/struct names: GFG
C# program:
using System ; class GFG { static int number0f2s ( int n ) { int count = 0 ; while ( n > 0 ) { if ( n % 10 == 2 ) count ++ ; n = n / 10 ; } return count ; } static int numberOf2sinRange ( int n ) { int count = 0 ; for ( int i = 2 ; i <= n ; i ++ ) count += number0f2s ( i ) ; return count ; } public static void Main ( ) { Console . Write ( numberOf2sinRange ( 22 ) ) ; Console . WriteLine ( ) ; Console . Write ( numberOf2sinRange ( 100 ) ) ; } }

Accumulator variables: count, i
Iterator variables: i
Class/struct names: GFG
C# program:
using System ; class GFG { static int minToggle ( int [ ] arr , int n ) { int [ ] zero = new int [ n + 1 ] ; zero [ 0 ] = 0 ; for ( int i = 1 ; i <= n ; ++ i ) { if ( arr [ i - 1 ] == 0 ) zero [ i ] = zero [ i - 1 ] + 1 ; else zero [ i ] = zero [ i - 1 ] ; } int ans = n ; for ( int i = 1 ; i <= n ; ++ i ) ans = Math . Min ( ans , i - zero [ i ] + zero [ n ] - zero [ i ] ) ; return ans ; } public static void Main ( ) { int [ ] arr = { 1 , 0 , 1 , 1 , 0 } ; int n = arr . Length ; Console . WriteLine ( minToggle ( arr , n ) ) ; } }

Index/key variables: i, n
Iterator variables: i
Class/struct names: GFG
C# program:
using System ; class GFG { static bool check ( String str ) { int n = str . Length ; if ( ( str [ n - 1 ] - '0' ) % 2 != 0 ) return false ; int digitSum = 0 ; for ( int i = 0 ; i < n ; i ++ ) digitSum += ( str [ i ] - '0' ) ; return ( digitSum % 3 == 0 ) ; } public static void Main ( ) { String str = "1332" ; if ( check ( str ) ) Console . Write ( " Yes " ) ; else Console . Write ( " No " ) ; } }

Index/key variables: i
Accumulator variables: digitSum, i
Iterator variables: i
Class/struct names: GFG
C# program:
using System ; class Solution { static int res = 0 ; static int checkRecursive ( int num , int x , int k , int n ) { if ( x == 0 ) res ++ ; int r = ( int ) Math . Floor ( Math . Pow ( num , 1.0 / n ) ) ; for ( int i = k + 1 ; i <= r ; i ++ ) { int a = x - ( int ) Math . Pow ( i , n ) ; if ( a >= 0 ) checkRecursive ( num , x - ( int ) Math . Pow ( i , n ) , i , n ) ; } return res ; } static int check ( int x , int n ) { return checkRecursive ( x , x , 0 , n ) ; } public static void Main ( ) { Console . WriteLine ( check ( 10 , 2 ) ) ; } }

Accumulator variables: i, res
Iterator variables: i
Class/struct names: Solution
C# program:
using System ; class GFG { static int reverseNum ( int n ) { int rem , rev = 0 ; while ( n > 0 ) { rem = n % 10 ; rev = rev * 10 + rem ; n /= 10 ; } return rev ; } static bool isPalindrom ( int num ) { return num == reverseNum ( num ) ; } static int nthPalindrome ( int n , int k ) { int num = ( int ) Math . Pow ( 10 , k - 1 ) ; while ( true ) { if ( isPalindrom ( num ) ) -- n ; if ( n == 0 ) break ; ++ num ; } return num ; } public static void Main ( ) { int n = 6 , k = 5 ; Console . WriteLine ( n + " th ▁ palindrome ▁ of ▁ " + k + " ▁ digit ▁ = ▁ " + nthPalindrome ( n , k ) ) ; n = 10 ; k = 6 ; Console . WriteLine ( n + " th ▁ palindrome ▁ of ▁ " + k + " ▁ digit ▁ = ▁ " + nthPalindrome ( n , k ) ) ; } }

Accumulator variables: n
Class/struct names: GFG
C# program:
using System ; class GFG { static void nthPalindrome ( int n , int k ) { int temp = ( k & 1 ) != 0 ? ( k / 2 ) : ( k / 2 - 1 ) ; int palindrome = ( int ) Math . Pow ( 10 , temp ) ; palindrome += n - 1 ; Console . Write ( palindrome ) ; if ( ( k & 1 ) > 0 ) palindrome /= 10 ; while ( palindrome > 0 ) { Console . Write ( palindrome % 10 ) ; palindrome /= 10 ; } Console . WriteLine ( " " ) ; } static public void Main ( ) { int n = 6 , k = 5 ; Console . Write ( n + " th ▁ palindrome ▁ of ▁ " + k + " ▁ digit ▁ = ▁ " ) ; nthPalindrome ( n , k ) ; n = 10 ; k = 6 ; Console . Write ( n + " th ▁ palindrome ▁ of ▁ " + k + " ▁ digit ▁ = ▁ " ) ; nthPalindrome ( n , k ) ; } }

Accumulator variables: palindrome
Class/struct names: GFG
C# program:
using System ; public class GFG { static int findMax ( int n , int [ ] a , int [ ] b , int [ ] k , int m ) { int [ ] arr = new int [ n ] ; for ( int i = 0 ; i < m ; i ++ ) { int lowerbound = a [ i ] ; int upperbound = b [ i ] ; for ( int j = lowerbound ; j <= upperbound ; j ++ ) arr [ j ] += k [ i ] ; } int res = Int32 . MinValue ; for ( int i = 0 ; i < n ; i ++ ) res = Math . Max ( res , arr [ i ] ) ; return res ; } static public void Main ( ) { int n = 5 ; int [ ] a = { 0 , 1 , 2 } ; int [ ] b = { 1 , 4 , 3 } ; int [ ] k = { 100 , 100 , 100 } ; int m = a . Length ; Console . WriteLine ( " Maximum ▁ value ▁ after ▁ ' m ' ▁ " + " operations ▁ is ▁ " + findMax ( n , a , b , k , m ) ) ; } }

Index/key variables: i, j, n
Accumulator variables: i, j
Iterator variables: i, j
Class/struct names: GFG
C# program:
using System ; class GFG { static int MAX = 100001 ; static long [ ] phi = new long [ MAX ] ; static long [ ] result = new long [ MAX ] ; static void computeTotient ( ) { phi [ 1 ] = 1 ; for ( int i = 2 ; i < MAX ; i ++ ) { if ( phi [ i ] == 0 ) { phi [ i ] = i - 1 ; for ( int j = ( i << 1 ) ; j < MAX ; j += i ) { if ( phi [ j ] == 0 ) phi [ j ] = j ; phi [ j ] = ( phi [ j ] / i ) * ( i - 1 ) ; } } } } static void sumOfGcdPairs ( ) { computeTotient ( ) ; for ( int i = 1 ; i < MAX ; ++ i ) { for ( int j = 2 ; i * j < MAX ; ++ j ) result [ i * j ] += i * phi [ j ] ; } for ( int i = 2 ; i < MAX ; i ++ ) result [ i ] += result [ i - 1 ] ; } public static void Main ( ) { sumOfGcdPairs ( ) ; int N = 4 ; Console . WriteLine ( " Summation ▁ of ▁ " + N + " ▁ = ▁ " + result [ N ] ) ; N = 12 ; Console . WriteLine ( " Summation ▁ of ▁ " + N + " ▁ = ▁ " + result [ N ] ) ; N = 5000 ; Console . Write ( " Summation ▁ of ▁ " + N + " ▁ = ▁ " + + result [ N ] ) ; } }

Index/key variables: MAX, N, i, j
Accumulator variables: i, j
Iterator variables: i, j
Class/struct names: GFG
C# program:
using System ; using System . Collections ; class GFG { static final int N = 3 ; static ArrayList solve ( int [ ] v ) { ArrayList res = new ArrayList ( ) ; int all3 = v [ 0 ] + v [ 1 ] + v [ 2 ] ; res . Add ( all3 - v [ 1 ] * 2 ) ; res . Add ( all3 - v [ 2 ] * 2 ) ; res . Add ( all3 - v [ 0 ] * 2 ) ; return res ; } static void findVertex ( int [ ] xmid , int [ ] ymid ) { ArrayList V1 = solve ( xmid ) ; ArrayList V2 = solve ( ymid ) ; for ( int i = 0 ; i < 3 ; i ++ ) { Console . WriteLine ( V1 [ i ] + " ▁ " + V2 [ i ] ) ; } } public static void Main ( ) { int [ ] xmid = { 5 , 4 , 5 } ; int [ ] ymid = { 3 , 4 , 5 } ; findVertex ( xmid , ymid ) ; } }

Index/key variables: i
Accumulator variables: i
Iterator variables: i
Class/struct names: GFG
C# program:
using System ; using System . Collections ; class GFG { static int nthElement ( int a , int b , int n ) { ArrayList seq = new ArrayList ( ) ; for ( int i = 1 ; i <= n ; i ++ ) seq . Add ( a * i ) ; seq . Sort ( ) ; for ( int i = 1 , k = n ; i <= n && k > 0 ; i ++ ) { if ( ! seq . Contains ( b * i ) ) { seq . Add ( b * i ) ; seq . Sort ( ) ; k -- ; } } return ( int ) seq [ n - 1 ] ; } static void Main ( ) { int a = 3 , b = 5 , n = 5 ; Console . WriteLine ( nthElement ( a , b , n ) ) ; } }

Accumulator variables: i, k
Iterator variables: i
Class/struct names: GFG
C# program:
using System ; class GFG { static int gcd ( int a , int b ) { return b > 0 ? gcd ( b , a % b ) : a ; } static int countGCD ( int L , int R , int g ) { L = ( L + g - 1 ) / g ; R = R / g ; int ans = 0 ; for ( int i = L ; i <= R ; i ++ ) for ( int j = L ; j <= R ; j ++ ) if ( gcd ( i , j ) == 1 ) ans ++ ; return ans ; } public static void Main ( ) { int L = 1 , R = 11 , g = 5 ; Console . WriteLine ( countGCD ( L , R , g ) ) ; } }

Accumulator variables: ans, i, j
Iterator variables: i, j
Class/struct names: GFG
C# program:
using System ; class GFG { static int [ ] dig = { 1 , 1 , 2 , 6 , 4 , 2 , 2 , 4 , 2 , 8 } ; static int lastNon0Digit ( int n ) { if ( n < 10 ) return dig [ n ] ; if ( ( ( n / 10 ) % 10 ) % 2 == 0 ) return ( 6 * lastNon0Digit ( n / 5 ) * dig [ n % 10 ] ) % 10 ; else return ( 4 * lastNon0Digit ( n / 5 ) * dig [ n % 10 ] ) % 10 ; } public static void Main ( ) { int n = 14 ; Console . Write ( lastNon0Digit ( n ) ) ; } }

Index/key variables: n
Class/struct names: GFG
C# program:
using System ; class GFG { static int gcd ( int a , int b ) { if ( ( a % b ) == 0 ) return b ; return gcd ( b , a % b ) ; } static int firstFactorialDivisibleNumber ( int x ) { int new_x = x ; for ( i = 1 ; i < x ; i ++ ) { new_x /= gcd ( i , new_x ) ; if ( new_x == 1 ) break ; } return i ; } public static void Main ( ) { int x = 16 ; Console . Write ( firstFactorialDivisibleNumber ( x ) ) ; } }

Accumulator variables: i, new_x
Iterator variables: i
Class/struct names: GFG
C# program:
using System ; class GFG { static void sieve ( bool [ ] prime , int n ) { for ( int p = 2 ; p * p <= n ; p ++ ) { if ( prime [ p ] == false ) for ( int i = p * 2 ; i <= n ; i += p ) prime [ i ] = true ; } } static int maxDigitInPrimes ( int L , int R ) { bool [ ] prime = new bool [ R + 1 ] ; for ( int i = 0 ; i < R + 1 ; i ++ ) prime [ i ] = false ; sieve ( prime , R ) ; int [ ] freq = new int [ 10 ] ; for ( int i = L ; i <= R ; i ++ ) { if ( ! prime [ i ] ) { while ( p > 0 ) { freq [ p % 10 ] ++ ; p /= 10 ; } } } int max = freq [ 0 ] , ans = 0 ; for ( int j = 1 ; j < 10 ; j ++ ) { if ( max <= freq [ j ] ) { max = freq [ j ] ; ans = j ; } } return ( max != 0 ) ? ans : - 1 ; } public static void Main ( ) { int L = 1 , R = 20 ; Console . Write ( maxDigitInPrimes ( L , R ) ) ; } }

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