dhyuti-n/xlcost-variable-roles huggingface dataset:
C# program:
using System ; class GFG { static void SieveOfEratosthenes ( int n , bool [ ] isPrime ) { isPrime [ 0 ] = isPrime [ 1 ] = false ; for ( int i = 2 ; i <= n ; i ++ ) isPrime [ i ] = true ; for ( int p = 2 ; p * p <= n ; p ++ ) { if ( isPrime [ p ] == true ) { for ( int i = p * 2 ; i <= n ; i += p ) isPrime [ i ] = false ; } } } static int countDigit ( int n ) { int count = 0 ; while ( n != 0 ) { n = n / 10 ; ++ count ; } return count ; } static bool isBrilliant ( int n ) { bool [ ] isPrime = new bool [ n + 1 ] ; SieveOfEratosthenes ( n , isPrime ) ; for ( int i = 2 ; i < n ; i ++ ) { int x = n / i ; if ( isPrime [ i ] && isPrime [ x ] && ( x * i ) == n ) { if ( countDigit ( i ) == countDigit ( x ) ) return true ; } } return false ; } public static void Main ( ) { int n = 1711 ; if ( isBrilliant ( n ) ) Console . Write ( " Yes " ) ; else Console . Write ( " No " ) ; } }

Index/key variables: i, p, x
Accumulator variables: i, p
Iterator variables: i, p
Class/struct names: GFG
C# program:
using System ; class GFG { static int icosikaienneagonalNum ( int n ) { return ( 27 * n * n - 25 * n ) / 2 ; } public static void Main ( ) { int n = 3 ; Console . Write ( icosikaienneagonalNum ( n ) ) ; } }

Class/struct names: GFG
C# program:
using System ; using System . Collections ; using System . Collections . Generic ; class GFG { public static ArrayList largestSumpair ( int [ ] arr , int n ) { ArrayList pair = new ArrayList ( ) ; int max_sum = int . MinValue , i ; for ( i = 1 ; i < n ; i ++ ) { if ( max_sum < ( arr [ i ] + arr [ i - 1 ] ) ) { max_sum = arr [ i ] + arr [ i - 1 ] ; if ( pair . Count == 0 ) { pair . Add ( arr [ i - 1 ] ) ; pair . Add ( arr [ i ] ) ; } else { pair [ 0 ] = arr [ i - 1 ] ; pair [ 1 ] = arr [ i ] ; } } } return pair ; } public static void Main ( string [ ] args ) { int [ ] arr = { 11 , - 5 , 9 , - 3 , 2 } ; int N = arr . Length ; ArrayList pair = new ArrayList ( ) ; pair = largestSumpair ( arr , N ) ; foreach ( int it in pair ) { Console . Write ( it + " ▁ " ) ; } } }

Index/key variables: i
Accumulator variables: i
Iterator variables: i, it
Class/struct names: GFG
C# program:
using System ; class GFG { public static int x = 0 , y = 0 , x1 = 0 , y1 = 0 ; public static int x0 = 0 , y0 = 0 , g = 0 ; public static int gcd ( int a , int b ) { if ( b == 0 ) { x = 1 ; y = 0 ; return a ; } int store_gcd = gcd ( b , a % b ) ; x = y1 ; y = x1 - y1 * ( a / b ) ; return store_gcd ; } public static int possible_solution ( int a , int b , int c ) { g = gcd ( Math . Abs ( a ) , Math . Abs ( b ) ) ; if ( c % g != 0 ) { return 0 ; } x0 *= c / g ; y0 *= c / g ; if ( a < 0 ) x0 *= - 1 ; if ( b < 0 ) y0 *= - 1 ; return 1 ; } public static void shift_solution ( int a , int b , int shift_var ) { x += shift_var * b ; y -= shift_var * a ; } public static int find_min_sum ( int a , int b , int c ) { int x = 0 , y = 0 , g = 0 ; if ( possible_solution ( a , b , c ) == 0 ) return - 1 ; if ( g != 0 ) { a /= g ; b /= g ; } int sign_a = a > 0 ? + 1 : - 1 ; int sign_b = b > 0 ? + 1 : - 1 ; shift_solution ( a , b , - x / b ) ; if ( x < 0 ) shift_solution ( a , b , sign_b ) ; int minx1 = x ; shift_solution ( a , b , y / a ) ; if ( y < 0 ) shift_solution ( a , b , - sign_a ) ; int minx2 = x ; if ( minx2 > x ) { int temp = minx2 ; minx2 = x ; x = temp ; } int minx = Math . Max ( minx1 , minx2 ) ; if ( minx > x ) return - 1 ; int miny = ( c - a * x ) / b ; return ( miny + minx ) ; } public static void Main ( String [ ] args ) { int a = 2 , b = 2 , c = 0 ; Console . Write ( find_min_sum ( a , b , c ) ) ; } }

Accumulator variables: a, b, x, x0, y, y0
Class/struct names: GFG
C# program:
using System ; class GFG { static bool isSuperdNum ( int n ) { for ( int d = 2 ; d < 10 ; d ++ ) { String subString = newString ( d ) ; if ( String . Join ( " " , ( d * Math . Pow ( n , d ) ) ) . Contains ( subString ) ) return true ; } return false ; } private static String newString ( int d ) { String ans = " " ; for ( int i = 0 ; i < d ; i ++ ) { ans += String . Join ( " " , d ) ; } return ans ; } public static void Main ( String [ ] args ) { int n = 261 ; if ( isSuperdNum ( n ) == true ) Console . WriteLine ( " Yes " ) ; else Console . WriteLine ( " No " ) ; } }

Accumulator variables: ans, d, i
Iterator variables: d, i
Class/struct names: GFG
C# program:
using System ; class GFG { static void findNthTerm ( int n ) { Console . Write ( n * ( 2 * n + 1 ) ) ; } public static void Main ( ) { int N = 4 ; findNthTerm ( N ) ; } }

Class/struct names: GFG
C# program:
using System ; class GFG { static bool isApocalyptic ( int n ) { if ( Math . Pow ( 2 , n ) . ToString ( ) . Contains ( "666" ) ) return true ; return false ; } static public void Main ( ) { int N = 157 ; if ( isApocalyptic ( N ) ) Console . WriteLine ( " Yes " ) ; else Console . WriteLine ( " No " ) ; } }

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 divSum ( int n ) { int result = 0 ; for ( int i = 2 ; i <= Math . Sqrt ( n ) ; i ++ ) { if ( n % i == 0 ) { if ( i == ( n / i ) ) result += i ; else result += ( i + n / i ) ; } } return ( result + n + 1 ) ; } static bool isDuffinian ( int n ) { int sumDivisors = divSum ( n ) ; if ( sumDivisors == n + 1 ) return false ; int hcf = gcd ( n , sumDivisors ) ; return hcf == 1 ; } public static void Main ( string [ ] args ) { int n = 36 ; if ( isDuffinian ( n ) ) { Console . Write ( " Yes " ) ; } else { Console . Write ( " No " ) ; } } }

Accumulator variables: i, result
Iterator variables: i
Class/struct names: GFG
C# program:
using System ; using System . Collections . Generic ; class GFG { static int MAX = 1000000 ; static List < int > primes = new List < int > ( ) ; static void sieveSundaram ( ) { bool [ ] marked = new bool [ MAX / 2 + 1 ] ; for ( int i = 1 ; i <= ( Math . Sqrt ( MAX ) - 1 ) / 2 ; i ++ ) for ( int j = ( i * ( i + 1 ) ) << 1 ; j <= MAX / 2 ; j += 2 * i + 1 ) marked [ j ] = true ; primes . Add ( 2 ) ; for ( int i = 1 ; i <= MAX / 2 ; i ++ ) if ( marked [ i ] == false ) primes . Add ( 2 * i + 1 ) ; } static int calculateKummer ( int n ) { int result = 1 ; for ( int i = 0 ; i < n ; i ++ ) result = result * primes [ i ] ; return - 1 + result ; } public static void Main ( String [ ] args ) { int n = 5 ; sieveSundaram ( ) ; for ( int i = 1 ; i <= n ; i ++ ) Console . Write ( calculateKummer ( i ) + " , ▁ " ) ; } }

Index/key variables: i, j
Accumulator variables: i, j
Iterator variables: i, j
Class/struct names: GFG
C# program:
using System ; using System . Collections . Generic ; class GFG { static void check ( int n ) { HashSet < int > digits = new HashSet < int > ( ) ; int temp = n ; int sum = 0 ; int count = 0 ; while ( temp > 0 ) { sum += temp % 10 ; digits . Add ( temp % 10 ) ; count ++ ; temp = temp / 10 ; } if ( sum % count == 0 && digits . Contains ( sum / count ) ) Console . Write ( " Yes " + " STRNEWLINE " ) ; else Console . Write ( " No " + " STRNEWLINE " ) ; } public static void Main ( String [ ] args ) { int n = 42644 ; check ( n ) ; } }

Accumulator variables: count, sum
Class/struct names: GFG
C# program:
using System ; class GFG { static void countSmaller ( String str ) { int n = str . Length ; for ( int i = 0 ; i < n ; i ++ ) { int cnt = 0 ; for ( int j = i + 1 ; j < n ; j ++ ) { if ( str [ j ] < str [ i ] ) { cnt += 1 ; } } Console . Write ( cnt + " ▁ " ) ; } } public static void Main ( String [ ] args ) { String str = " edcba " ; countSmaller ( str ) ; } }

Index/key variables: i, j
Accumulator variables: cnt, i, j
Iterator variables: i, j
Class/struct names: GFG
C# program:
using System ; using System . Collections ; using System . Collections . Generic ; class GFG { public static ArrayList smallestSumpair ( int [ ] arr , int n ) { ArrayList pair = new ArrayList ( ) ; int min_sum = int . MaxValue , i ; for ( i = 1 ; i < n ; i ++ ) { if ( min_sum > ( arr [ i ] + arr [ i - 1 ] ) ) { min_sum = arr [ i ] + arr [ i - 1 ] ; if ( pair . Count == 0 ) { pair . Add ( arr [ i - 1 ] ) ; pair . Add ( arr [ i ] ) ; } else { pair [ 0 ] = arr [ i - 1 ] ; pair [ 1 ] = arr [ i ] ; } } } return pair ; } public static void Main ( string [ ] args ) { int [ ] arr = { 4 , 9 , - 3 , 2 , 0 } ; int N = arr . Length ; ArrayList pair = new ArrayList ( ) ; pair = smallestSumpair ( arr , N ) ; Console . Write ( pair [ 0 ] + " ▁ " + pair [ 1 ] ) ; } }

Index/key variables: i
Accumulator variables: i
Iterator variables: i
Class/struct names: GFG
C# program:
using System . Collections . Generic ; using System ; using System . Linq ; using System . Text ; class GFG { static int val ( char c ) { if ( c >= '0' && c <= '9' ) return ( int ) c - '0' ; else return ( int ) c - ' A ' + 10 ; } static int convert ( string num , int bases ) { int len = ( num . Length ) ; int power = 1 ; int res = 0 ; int i ; for ( i = len - 1 ; i >= 0 ; i -- ) { res += val ( num [ i ] ) * power ; power = power * bases ; } return res ; } static void dec_to_base ( int num , int bases ) { var base_num = new StringBuilder ( ) ; while ( num > 0 ) { int dig = ( num % bases ) ; if ( dig < 10 ) base_num . Append ( dig . ToString ( ) ) ; else base_num . Append ( ( ' A ' + dig - 10 ) . ToString ( ) ) ; num /= bases ; } for ( int i = base_num . Length - 1 ; i >= 0 ; i -- ) Console . Write ( base_num [ i ] ) ; } public static void Main ( String [ ] args ) { String a = "123" ; String b = "234" ; int base_a = 6 ; int base_b = 8 ; int a10 = convert ( a , base_a ) ; int b10 = convert ( b , base_b ) ; int summ = a10 + b10 ; int min_base = Math . Min ( base_a , base_b ) ; dec_to_base ( summ , min_base ) ; } }

Index/key variables: i
Accumulator variables: i, num, res
Iterator variables: i
Class/struct names: GFG
C# program:
using System ; class GFG { static int sumOfProductOfDigits ( int n1 , int n2 ) { int sum = 0 ; while ( n1 > 0 && n2 > 0 ) { sum += ( ( n1 % 10 ) * ( n2 % 10 ) ) ; n1 /= 10 ; n2 /= 10 ; } return sum ; } public static void Main ( ) { int n1 = 25 ; int n2 = 1548 ; Console . WriteLine ( sumOfProductOfDigits ( n1 , n2 ) ) ; } }

Accumulator variables: n1, n2, sum
Class/struct names: GFG
C# program:
using System ; class GFG { static void printPermutation ( int N ) { int temp = N , count = 0 ; while ( temp > 0 ) { count ++ ; temp /= 10 ; } int [ ] num = new int [ count ] ; while ( N > 0 ) { num [ count -- - 1 ] = N % 10 ; N = N / 10 ; } while ( next_permutation ( num ) ) { for ( int i = 0 ; i < num . Length ; i ++ ) Console . Write ( num [ i ] ) ; Console . Write ( " STRNEWLINE " ) ; } } static bool next_permutation ( int [ ] p ) { for ( int a = p . Length - 2 ; a >= 0 ; -- a ) if ( p [ a ] < p [ a + 1 ] ) for ( int b = p . Length - 1 ; ; -- b ) if ( p [ b ] > p [ a ] ) { int t = p [ a ] ; p [ a ] = p [ b ] ; p [ b ] = t ; for ( ++ a , b = p . Length - 1 ; a < b ; ++ a , -- b ) { t = p [ a ] ; p [ a ] = p [ b ] ; p [ b ] = t ; } return true ; } return false ; } public static void Main ( String [ ] args ) { int N = 324 ; printPermutation ( N ) ; } }

Index/key variables: a, b, count, i
Accumulator variables: count, i, temp
Iterator variables: a, b, i
Class/struct names: GFG
C# program:
using System ; using System . Collections ; using System . Collections . Generic ; class GFG { static int n = 500000 - 2 ; static ArrayList v = new ArrayList ( ) ; static void sieveoferanthones ( ) { bool [ ] prime = new bool [ n + 1 ] ; Array . Fill ( prime , true ) ; for ( int i = 2 ; i <= ( int ) Math . Sqrt ( n ) ; i ++ ) { if ( prime [ i ] ) { for ( int j = i * i ; j <= n ; j += i ) { prime [ j ] = false ; } } } for ( int i = 2 ; i < n ; i ++ ) { if ( prime [ i ] ) v . Add ( i ) ; } } static void numberOfWays ( int n ) { int count = 0 ; for ( int j = 1 ; 2 * ( Math . Pow ( j , 2 ) ) < n ; j ++ ) { for ( int i = 1 ; ( int ) v [ i ] + 2 <= n ; i ++ ) { if ( n == ( int ) v [ i ] + ( 2 * ( Math . Pow ( j , 2 ) ) ) ) count ++ ; } } Console . Write ( count ) ; } public static void Main ( string [ ] args ) { sieveoferanthones ( ) ; int n = 9 ; numberOfWays ( 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 double Convert ( double degree ) { double pi = 3.14159265359 ; return ( degree * ( pi / 180 ) ) ; } public static void Main ( ) { double degree = 30 ; double radian = Convert ( degree ) ; Console . Write ( " { 0 : F6 } " , radian ) ; } }

Class/struct names: GFG
C# program:
using System ; using System . Collections . Generic ; class GFG { static void bcdToHexaDecimal ( char [ ] s ) { int len = s . Length , check = 0 ; int num = 0 , sum = 0 , mul = 1 ; List < char > ans = new List < char > ( ) ; for ( int i = len - 1 ; i >= 0 ; i -- ) { sum += ( s [ i ] - '0' ) * mul ; mul *= 2 ; check ++ ; if ( check == 4 i == 0 ) { if ( sum <= 9 ) ans . Add ( ( char ) ( sum + '0' ) ) ; else ans . Add ( ( char ) ( sum + 55 ) ) ; check = 0 ; sum = 0 ; mul = 1 ; } } len = ans . Count ; for ( int i = len - 1 ; i >= 0 ; i -- ) Console . Write ( ans [ i ] ) ; } public static void Main ( String [ ] args ) { String s = "100000101111" ; bcdToHexaDecimal ( s . ToCharArray ( ) ) ; } }

Index/key variables: i
Accumulator variables: check, i, mul, sum
Iterator variables: i
Class/struct names: GFG
C# program:
using System ; class GFG { static int Dodecagonal_num ( int n ) { return ( 5 * n * n - 4 * n ) ; } static int sum_Dodecagonal_num ( int n ) { int summ = 0 ; for ( int i = 1 ; i < n + 1 ; i ++ ) { summ += Dodecagonal_num ( i ) ; } return summ ; } public static void Main ( String [ ] args ) { int n = 5 ; Console . WriteLine ( sum_Dodecagonal_num ( n ) ) ; } }

Accumulator variables: i, summ
Iterator variables: i
Class/struct names: GFG
C# program:
using System ; class GFG { static bool isMyriagon ( int N ) { double n = ( 9996 + Math . Sqrt ( 79984 * N + 99920016 ) ) / 19996 ; return ( n - ( int ) n ) == 0 ; } static public void Main ( ) { int N = 10000 ; if ( isMyriagon ( N ) ) { Console . Write ( " Yes " ) ; } else { Console . Write ( " No " ) ; } } }

Class/struct names: GFG
C# program:
using System ; class GFG { public static bool isheptagonal ( int N ) { double n = ( 3 + Math . Sqrt ( 40 * N + 9 ) ) / 10 ; return ( n - ( int ) n ) == 0 ; } public static void Main ( String [ ] args ) { int N = 7 ; if ( isheptagonal ( N ) ) { Console . WriteLine ( " Yes " ) ; } else { Console . WriteLine ( " No " ) ; } } }

Class/struct names: GFG
C# program:
using System ; class GFG { static bool isenneadecagonal ( int N ) { float n = ( float ) ( 15 + Math . Sqrt ( 136 * N + 225 ) ) / 34 ; return ( n - ( int ) n ) == 0 ; } static public void Main ( ) { int N = 19 ; if ( isenneadecagonal ( N ) ) { Console . Write ( " Yes " ) ; } else { Console . Write ( " No " ) ; } } }

Class/struct names: GFG
C# program:
using System ; class GFG { static bool isCenteredtridecagonal ( int N ) { float n = ( float ) ( ( 13 + Math . Sqrt ( 104 * N + 65 ) ) / 26 ) ; return ( n - ( int ) n ) == 0 ; } public static void Main ( string [ ] args ) { int N = 14 ; if ( isCenteredtridecagonal ( N ) ) { Console . Write ( " Yes " ) ; } else { Console . Write ( " No " ) ; } } }

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 countDistinctWays ( int N , int M ) { int ans = 0 ; for ( int i = 0 ; i < N ; i ++ ) { int K = gcd ( i , N ) ; ans += ( int ) Math . Pow ( M , K ) ; } ans /= N ; Console . Write ( ans ) ; } public static void Main ( string [ ] args ) { int N = 4 , M = 3 ; countDistinctWays ( N , M ) ; } }

Accumulator variables: ans, i
Iterator variables: i
Class/struct names: GFG
C# program:
using System ; class GFG { static void findNum ( int n , int k ) { int q = k / ( n - 1 ) ; int r = k % ( n - 1 ) ; int a = 0 ; if ( r != 0 ) a = ( n * q ) + r ; else a = ( n * q ) - 1 ; Console . WriteLine ( a ) ; } public static void Main ( String [ ] args ) { int A = 4 ; int N = 6 ; findNum ( A , N ) ; } }

Class/struct names: GFG
C# program:
using System ; using System . Collections . Generic ; class GFG { static int ans = 0 ; static List < int > [ ] graph = new List < int > [ 100 ] ; static int [ ] weight = new int [ 100 ] ; static bool isPerfect ( int n ) { int sum = 1 ; for ( int i = 2 ; i * i <= n ; i ++ ) { if ( n % i == 0 ) { if ( i * i != n ) sum = sum + i + n / i ; else sum = sum + i ; } } if ( sum == n && n != 1 ) return true ; return false ; } static void dfs ( int node , int parent ) { if ( isPerfect ( weight [ node ] ) ) ans += 1 ; foreach ( int to in graph [ node ] ) { if ( to == parent ) continue ; dfs ( to , node ) ; } } public static void Main ( String [ ] args ) { for ( int i = 0 ; i < graph . Length ; i ++ ) graph [ i ] = new List < int > ( ) ; weight [ 1 ] = 5 ; weight [ 2 ] = 10 ; weight [ 3 ] = 11 ; weight [ 4 ] = 8 ; weight [ 5 ] = 6 ; graph [ 1 ] . Add ( 2 ) ; graph [ 2 ] . Add ( 3 ) ; graph [ 2 ] . Add ( 4 ) ; graph [ 1 ] . Add ( 5 ) ; dfs ( 1 , 1 ) ; Console . Write ( ans ) ; } }

Index/key variables: i, node
Accumulator variables: ans, i
Iterator variables: i, to
Class/struct names: GFG
C# program:
using System ; using System . Collections . Generic ; class GFG { static int GetMinCost ( int N ) { List < int > pq = new List < int > ( ) ; for ( int i = 1 ; i <= N ; i ++ ) { pq . Add ( i ) ; } int cost = 0 ; pq . Sort ( ) ; while ( pq . Count > 1 ) { int mini = pq [ 0 ] ; pq . RemoveAt ( 0 ) ; int secondmini = pq [ 0 ] ; pq . RemoveAt ( 0 ) ; int current = mini * secondmini ; cost += current ; pq . Add ( current ) ; pq . Sort ( ) ; } return cost ; } static void Main ( ) { int N = 5 ; Console . WriteLine ( GetMinCost ( N ) ) ; } }

Accumulator variables: cost, i
Iterator variables: i
Class/struct names: GFG
C# program:
using System ; class GFG { static int numPrimeArrangements ( int n ) { bool [ ] prime = new bool [ n + 1 ] ; for ( int i = 0 ; i < prime . Length ; i ++ ) prime [ i ] = true ; prime [ 0 ] = false ; prime [ 1 ] = false ; for ( int i = 2 ; i <= Math . Sqrt ( n ) ; i ++ ) { if ( prime [ i ] ) { for ( int factor = 2 ; factor * i <= n ; factor ++ ) prime [ factor * i ] = false ; } } int primeIndices = 0 ; for ( int i = 1 ; i <= n ; i ++ ) if ( prime [ i ] ) primeIndices ++ ; int mod = ( int ) ( 1e9 + 7 ) , res = 1 ; for ( int i = 1 ; i <= primeIndices ; i ++ ) res = ( int ) ( ( 1L * res * i ) % mod ) ; for ( int i = 1 ; i <= ( n - primeIndices ) ; i ++ ) res = ( int ) ( ( 1L * res * i ) % mod ) ; return res ; } public static void Main ( String [ ] args ) { int N = 5 ; Console . Write ( numPrimeArrangements ( N ) ) ; } }

Index/key variables: i
Accumulator variables: factor, i, primeIndices
Iterator variables: factor, i
Class/struct names: GFG
C# program:
using System ; public class GFG { static int fact ( int n ) { int res = 1 ; for ( int i = 2 ; i <= n ; i ++ ) res = res * i ; return res ; } static double count_heads ( int n , int r ) { double output ; output = fact ( n ) / ( fact ( r ) * fact ( n - r ) ) ; output = output / ( Math . Pow ( 2 , n ) ) ; return output ; } public static void Main ( String [ ] args ) { int n = 4 , r = 3 ; Console . Write ( count_heads ( n , r ) ) ; } }

Accumulator variables: i
Iterator variables: i
Class/struct names: GFG
C# program:
using System ; using System . Collections . Generic ; class GFG { static int dfs ( int u , List < int > [ ] adj , int [ ] vis ) { vis [ u ] = 1 ; int componentSize = 1 ; foreach ( int it in adj [ u ] ) { if ( vis [ it ] == 0 ) { componentSize += dfs ( it , adj , vis ) ; } } return componentSize ; } static int maximumComponentSize ( int [ ] a , int n ) { List < int > [ ] adj = new List < int > [ n ] ; for ( int i = 0 ; i < adj . Length ; i ++ ) adj [ i ] = new List < int > ( ) ; for ( int i = 0 ; i < n ; i ++ ) { for ( int j = i + 1 ; j < n ; j ++ ) { if ( __gcd ( a [ i ] , a [ j ] ) > 1 ) adj [ i ] . Add ( j ) ; adj [ j ] . Add ( i ) ; } } int answer = 0 ; int [ ] vis = new int [ n ] ; for ( int k = 0 ; k < n ; k ++ ) { vis [ k ] = 0 ; } for ( int i = 0 ; i < n ; i ++ ) { if ( vis [ i ] == 0 ) { answer = Math . Max ( answer , dfs ( i , adj , vis ) ) ; } } return answer ; } static int __gcd ( int a , int b ) { return b == 0 ? a : __gcd ( b , a % b ) ; } public static void Main ( String [ ] args ) { int n = 8 ; int [ ] A = { 2 , 3 , 6 , 7 , 4 , 12 , 21 , 39 } ; Console . Write ( maximumComponentSize ( A , n ) ) ; } }

Index/key variables: i, it, j, k, n, u
Accumulator variables: componentSize, i, j, k
Iterator variables: i, it, j, k
Class/struct names: GFG
C# program:
using System ; using System . Collections . Generic ; class GFG { static int [ ] spf = new int [ 100005 ] ; static void sieve ( ) { for ( int i = 2 ; i < 100005 ; i ++ ) { if ( spf [ i ] == 0 ) { spf [ i ] = i ; for ( int j = 2 * i ; j < 100005 ; j += i ) { if ( spf [ j ] == 0 ) spf [ j ] = i ; } } } } static void factorize ( int n , HashSet < int > s ) { while ( n > 1 ) { int z = spf [ n ] ; s . Add ( z ) ; while ( n % z == 0 ) n /= z ; } } static int [ ] id = new int [ 100005 ] ; static int [ ] par = new int [ 100005 ] ; static int [ ] sizeContainer = new int [ 100005 ] ; static int root ( int i ) { if ( par [ i ] == i ) return i ; else return par [ i ] = root ( par [ i ] ) ; } static void merge ( int a , int b ) { int p = root ( a ) ; int q = root ( b ) ; if ( p == q ) return ; if ( sizeContainer [ p ] > sizeContainer [ q ] ) { p = p + q ; q = p - q ; p = p - q ; } par [ p ] = q ; sizeContainer [ q ] += sizeContainer [ p ] ; } static int maximumComponentsizeContainer ( int [ ] a , int n ) { for ( int i = 0 ; i < 100005 ; i ++ ) { par [ i ] = i ; sizeContainer [ i ] = 1 ; } sieve ( ) ; for ( int i = 0 ; i < n ; i ++ ) { HashSet < int > s = new HashSet < int > ( ) ; factorize ( a [ i ] , s ) ; foreach ( int it in s ) { if ( id [ it ] == 0 ) id [ it ] = i + 1 ; else merge ( i + 1 , id [ it ] ) ; } } int answer = 0 ; for ( int i = 0 ; i < n ; i ++ ) answer = Math . Max ( answer , sizeContainer [ i ] ) ; return answer ; } public static void Main ( String [ ] args ) { int n = 8 ; int [ ] A = { 2 , 3 , 6 , 7 , 4 , 12 , 21 , 39 } ; Console . Write ( maximumComponentsizeContainer ( A , n ) ) ; } }

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