dhyuti-n/xlcost-variable-roles huggingface dataset:
C++ program:
#include <bits/stdc++.h>
using namespace std ; int min_value ( int arr [ ] , int N ) { int x , X , K ; set < int > S ; for ( int i = 0 ; i < N ; i ++ ) { S . insert ( arr [ i ] ) ; } int count = 0 ; for ( int i = 1 ; i <= 1024 ; i ++ ) { count = 0 ; for ( auto it = S . begin ( ) ; it != S . end ( ) ; it ++ ) { X = ( ( i * it ) - ( i & * it ) ) ; if ( S . find ( X ) != S . end ( ) ) { count ++ ; } } if ( count == S . size ( ) ) { K = i ; return K ; } } return -1 ; } int main ( ) { int arr [ ] = { 1 , 0 , 3 , 3 , 0 , 2 } ; int N = sizeof ( arr ) / sizeof ( arr [ 0 ] ) ; cout << min_value ( arr , N ) ; return 0 ; }

Index/key variables: i
Accumulator variables: count, i, it, stdc
Iterator variables: i, it
C++ program:
#include <bits/stdc++.h>
using namespace std ; int sum ( int n ) { int sum = 0 ; while ( n != 0 ) { int r = n % 10 ; sum = sum + r ; n = n / 10 ; } return sum ; } bool isJunction ( int n ) { int count = 0 ; for ( int i = 1 ; i <= n ; i ++ ) { if ( i + sum ( i ) == n ) count ++ ; } return count >= 2 ; } int main ( ) { int N = 111 ; if ( isJunction ( N ) ) cout << " Yes " ; else cout << " No " ; return 0 ; }

Accumulator variables: count, i, stdc
Iterator variables: i
C++ program:
#include <bits/stdc++.h>
using namespace std ; int digProduct ( int n ) { int product = 1 ; while ( n != 0 ) { product = product * ( n % 10 ) ; n = n / 10 ; } return product ; } 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 ; } int nextPrime ( int N ) { if ( N <= 1 ) return 2 ; int prime = N ; bool found = false ; while ( ! found ) { prime ++ ; if ( isPrime ( prime ) ) found = true ; } return prime ; } bool isPointerPrime ( int n ) { if ( isPrime ( n ) && ( n + digProduct ( n ) == nextPrime ( n ) ) ) return true ; else return false ; } int main ( ) { int N = 23 ; if ( isPointerPrime ( N ) ) cout << " Yes " ; else cout << " No " ; return 0 ; }

Accumulator variables: prime, stdc
Iterator variables: i
Boolean variables: found
C++ program:
#include <bits/stdc++.h>
using namespace std ; int power ( int x , unsigned int y ) { if ( y == 0 ) { return 1 ; } if ( y % 2 == 0 ) { return ( power ( x , y / 2 ) * power ( x , y / 2 ) ) ; } return ( x * power ( x , y / 2 ) * power ( x , y / 2 ) ) ; } bool isPerfectDigitalInvariant ( int x ) { for ( int fixed_power = 1 ; ; fixed_power ++ ) { int temp = x , sum = 0 ; while ( temp ) { int r = temp % 10 ; sum += power ( r , fixed_power ) ; temp = temp / 10 ; } if ( sum == x ) { return true ; } if ( sum > x ) { return false ; } } } int main ( ) { int N = 4150 ; if ( isPerfectDigitalInvariant ( N ) ) cout << " Yes " ; else cout << " No " ; }

Accumulator variables: fixed_power, stdc, sum
Iterator variables: fixed_power
C++ program:
#include <bits/stdc++.h>
using namespace std ; bool 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 ; } } } int countDigit ( long long n ) { return floor ( log10 ( n ) + 1 ) ; } bool isBrilliant ( int n ) { int flag = 0 ; bool isPrime [ n + 1 ] ; SieveOfEratosthenes ( n , isPrime ) ; for ( int i = 2 ; i < n ; i ++ ) { int x = n / i ; if ( isPrime [ i ] && isPrime [ x ] and x * i == n ) { if ( countDigit ( i ) == countDigit ( x ) ) return true ; } } return false ; } int main ( ) { int n = 1711 ; if ( isBrilliant ( n ) ) cout << " Yes " ; else cout << " No " ; return 0 ; }

Index/key variables: i, p, x
Accumulator variables: i, p, stdc
Iterator variables: i, p
C++ program:
#include <bits/stdc++.h>
using namespace std ; vector < int > largestSumpair ( int arr [ ] , int n ) { vector < int > pair ; int max_sum = INT_MIN , i ; for ( i = 1 ; i < n ; i ++ ) { if ( max_sum < ( arr [ i ] + arr [ i - 1 ] ) ) { max_sum = arr [ i ] + arr [ i - 1 ] ; if ( pair . empty ( ) ) { pair . push_back ( arr [ i - 1 ] ) ; pair . push_back ( arr [ i ] ) ; } else { pair [ 0 ] = arr [ i - 1 ] ; pair [ 1 ] = arr [ i ] ; } } } return pair ; } int main ( ) { int arr [ ] = { 11 , -5 , 9 , -3 , 2 } ; int N = sizeof ( arr ) / sizeof ( arr [ 0 ] ) ; vector < int > pair = largestSumpair ( arr , N ) ; for ( auto it = pair . begin ( ) ; it != pair . end ( ) ; ++ it ) { cout << * it << ' ▁ ' ; } return 0 ; }

Index/key variables: i
Accumulator variables: i, stdc
Iterator variables: i, it
C++ program:
#include <bits/stdc++.h>
using namespace std ; int gcd ( int a , int b , int * x , int * y ) { if ( b == 0 ) { * x = 1 ; * y = 0 ; return a ; } int x1 , y1 ; int store_gcd = gcd ( b , a % b , & x1 , & y1 ) ; * x = y1 ; * y = x1 - y1 * ( a / b ) ; return store_gcd ; } int possible_solution ( int a , int b , int c , int * x0 , int * y0 , int * g ) { * g = gcd ( fabs ( a ) , fabs ( b ) , x0 , y0 ) ; if ( c % * g ) { return 0 ; } * x0 *= c / * g ; * y0 *= c / * g ; if ( a < 0 ) * x0 *= -1 ; if ( b < 0 ) * y0 *= -1 ; return 1 ; } void shift_solution ( int * x , int * y , int a , int b , int shift_var ) { * x += shift_var * b ; * y -= shift_var * a ; } int find_min_sum ( int a , int b , int c ) { int x , y , g ; if ( ! possible_solution ( a , b , c , & x , & y , & g ) ) return -1 ; a /= g ; b /= g ; int sign_a = a > 0 ? +1 : -1 ; int sign_b = b > 0 ? +1 : -1 ; shift_solution ( & x , & y , a , b , - x / b ) ; if ( x < 0 ) shift_solution ( & x , & y , a , b , sign_b ) ; int minx1 = x ; shift_solution ( & x , & y , a , b , y / a ) ; if ( y < 0 ) shift_solution ( & x , & y , a , b , - sign_a ) ; int minx2 = x ; if ( minx2 > x ) swap ( minx2 , x ) ; int minx = max ( minx1 , minx2 ) ; if ( minx > x ) return -1 ; int miny = ( c - a * x ) / b ; return ( miny + minx ) ; } int main ( ) { int a = 2 , b = 2 , c = 0 ; cout << find_min_sum ( a , b , c ) << " STRNEWLINE " ; return 0 ; }

Accumulator variables: a, b, stdc, x, x0, y, y0
C++ program:
#include <bits/stdc++.h>
using namespace std ; int divSum ( int n ) { int result = 0 ; for ( int i = 2 ; i <= sqrt ( n ) ; i ++ ) { if ( n % i == 0 ) { if ( i == ( n / i ) ) result += i ; else result += ( i + n / i ) ; } } return ( result + n + 1 ) ; } bool isDuffinian ( int n ) { int sumDivisors = divSum ( n ) ; if ( sumDivisors == n + 1 ) return false ; int hcf = __gcd ( n , sumDivisors ) ; return hcf == 1 ; } int main ( ) { int n = 36 ; if ( isDuffinian ( n ) ) cout << " Yes " ; else cout << " No " ; return 0 ; }

Accumulator variables: i, result, stdc
Iterator variables: i
C++ program:
#include <bits/stdc++.h>
using namespace std ; const int MAX = 1000000 ; vector < int > primes ; void sieveSundaram ( ) { bool marked [ MAX / 2 + 1 ] = { 0 } ; for ( int i = 1 ; i <= ( sqrt ( MAX ) - 1 ) / 2 ; i ++ ) for ( int j = ( i * ( i + 1 ) ) << 1 ; j <= MAX / 2 ; j += 2 * i + 1 ) marked [ j ] = true ; primes . push_back ( 2 ) ; for ( int i = 1 ; i <= MAX / 2 ; i ++ ) if ( marked [ i ] == false ) primes . push_back ( 2 * i + 1 ) ; } int calculateKummer ( int n ) { int result = 1 ; for ( int i = 0 ; i < n ; i ++ ) result = result * primes [ i ] ; return -1 + result ; } int main ( ) { int n = 5 ; sieveSundaram ( ) ; for ( int i = 1 ; i <= n ; i ++ ) cout << calculateKummer ( i ) << " , ▁ " ; return 0 ; }

Index/key variables: i, j
Accumulator variables: i, j, stdc
Iterator variables: i, j
C++ program:
#include <bits/stdc++.h>
using namespace std ; void check ( int n ) { set < int > digits ; int temp = n ; int sum = 0 ; int count = 0 ; while ( temp > 0 ) { sum += temp % 10 ; digits . insert ( temp % 10 ) ; count ++ ; temp = temp / 10 ; } if ( sum % count == 0 && digits . find ( sum / count ) != digits . end ( ) ) cout << " Yes " << endl ; else cout << " No " << endl ; } int main ( ) { int n = 42644 ; check ( n ) ; }

Accumulator variables: count, stdc, sum
C++ program:
#include <bits/stdc++.h>
using namespace std ; 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 ; } } cout << cnt << " ▁ " ; } } int main ( ) { string str = " edcba " ; countSmaller ( str ) ; }

Index/key variables: i, j
Accumulator variables: cnt, i, j, stdc
Iterator variables: i, j
C++ program:
#include <bits/stdc++.h>
using namespace std ; vector < int > smallestSumpair ( int arr [ ] , int n ) { vector < int > pair ; int min_sum = INT_MAX ; for ( int i = 1 ; i < n ; i ++ ) { if ( min_sum > ( arr [ i ] + arr [ i - 1 ] ) ) { min_sum = arr [ i ] + arr [ i - 1 ] ; if ( pair . empty ( ) ) { pair . push_back ( arr [ i - 1 ] ) ; pair . push_back ( arr [ i ] ) ; } else { pair [ 0 ] = arr [ i - 1 ] ; pair [ 1 ] = arr [ i ] ; } } } return pair ; } int main ( ) { int arr [ ] = { 4 , 9 , -3 , 2 , 0 } ; int n = sizeof ( arr ) / sizeof ( arr [ 0 ] ) ; vector < int > pair = smallestSumpair ( arr , n ) ; cout << pair [ 0 ] << " ▁ " << pair [ 1 ] ; }

Index/key variables: i
Accumulator variables: i, stdc
Iterator variables: i
C++ program:
#include <bits/stdc++.h>
using namespace std ; int val ( char c ) { if ( c >= '0' && c <= '9' ) return ( int ) c - '0' ; else return ( int ) c - ' A ' + 10 ; } int convert ( string num , int base ) { int len = ( num . size ( ) ) ; int power = 1 ; int res = 0 ; int i ; for ( i = len - 1 ; i >= 0 ; i -- ) { res += val ( num [ i ] ) * power ; power = power * base ; } return res ; } int dec_to_base ( int num , int base ) { string base_num = " " ; while ( num > 0 ) { int dig = int ( num % base ) ; if ( dig < 10 ) base_num += to_string ( dig ) ; else base_num += to_string ( ' A ' + dig - 10 ) ; num /= base ; } reverse ( base_num . begin ( ) , base_num . end ( ) ) ; return stoi ( base_num ) ; } int main ( ) { 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 = min ( base_a , base_b ) ; cout << ( dec_to_base ( summ , min_base ) ) ; }

Index/key variables: i
Accumulator variables: base_num, i, num, res, stdc
Iterator variables: i
C++ program:
#include <bits/stdc++.h>
using namespace std ; 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 ; } int main ( ) { int n1 = 25 ; int n2 = 1548 ; cout << sumOfProductOfDigits ( n1 , n2 ) ; }

Accumulator variables: n1, n2, stdc, sum
C++ program:
#include <bits/stdc++.h>
using namespace std ; void printPermutation ( int N ) { int temp = N , count = 0 ; while ( temp > 0 ) { count ++ ; temp /= 10 ; } vector < int > num ( count ) ; while ( N > 0 ) { num [ count -- - 1 ] = N % 10 ; N = N / 10 ; } while ( next_permutation ( num . begin ( ) , num . end ( ) ) ) { for ( int i = 0 ; i < num . size ( ) ; i ++ ) cout << num [ i ] ; cout << " STRNEWLINE " ; } } int main ( ) { int N = 324 ; printPermutation ( N ) ; return 0 ; }

Index/key variables: i
Accumulator variables: count, i, stdc, temp
Iterator variables: i
C++ program:
#include <bits/stdc++.h>
using namespace std ; long long int n = 500000 - 2 ; vector < long long int > v ; void sieveoferanthones ( ) { bool prime [ n + 1 ] ; memset ( prime , true , sizeof ( prime ) ) ; for ( long long int i = 2 ; i <= sqrt ( n ) ; i ++ ) { if ( prime [ i ] ) for ( long long int j = i * i ; j <= n ; j += i ) { prime [ j ] = false ; } } for ( long long int i = 2 ; i < n ; i ++ ) { if ( prime [ i ] ) v . push_back ( i ) ; } } void numberOfWays ( long long int n ) { long long int count = 0 ; for ( long long int j = 1 ; 2 * ( pow ( j , 2 ) ) < n ; j ++ ) { for ( long long int i = 1 ; v [ i ] + 2 <= n ; i ++ ) { if ( n == v [ i ] + ( 2 * ( pow ( j , 2 ) ) ) ) count ++ ; } } cout << count << endl ; } int main ( ) { sieveoferanthones ( ) ; long long int n = 9 ; numberOfWays ( n ) ; return 0 ; }

Index/key variables: i, j
Accumulator variables: count, i, j, stdc
Iterator variables: i, j
C++ program:
#include <bits/stdc++.h>
using namespace std ; void bToHexaDecimal ( string s ) { int len = s . length ( ) , check = 0 ; int num = 0 , sum = 0 , mul = 1 ; vector < char > ans ; 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 . push_back ( sum + '0' ) ; else ans . push_back ( sum + 55 ) ; check = 0 ; sum = 0 ; mul = 1 ; } } len = ans . size ( ) ; for ( int i = len - 1 ; i >= 0 ; i -- ) cout << ans [ i ] ; } int main ( ) { string s = "100000101111" ; bToHexaDecimal ( s ) ; return 0 ; }

Index/key variables: i
Accumulator variables: check, i, mul, stdc, sum
Iterator variables: i
C++ program:
#include <bits/stdc++.h>
using namespace std ; int Dodecagonal_num ( int n ) { return ( 5 * n * n - 4 * n ) ; } int sum_Dodecagonal_num ( int n ) { int summ = 0 ; for ( int i = 1 ; i < n + 1 ; i ++ ) { summ += Dodecagonal_num ( i ) ; } return summ ; } int main ( ) { int n = 5 ; cout << ( sum_Dodecagonal_num ( n ) ) ; return 0 ; }

Accumulator variables: i, stdc, summ
Iterator variables: i
C++ program:
#include <bits/stdc++.h>
using namespace std ; bool isMyriagon ( int N ) { float n = ( 9996 + sqrt ( 79984 * N + 99920016 ) ) / 19996 ; return ( n - ( int ) n ) == 0 ; } int main ( ) { int N = 10000 ; if ( isMyriagon ( N ) ) { cout << " Yes " ; } else { cout << " No " ; } return 0 ; }

Accumulator variables: stdc
C++ program:
#include <bits/stdc++.h>
using namespace std ; bool isheptagonal ( int N ) { float n = ( 3 + sqrt ( 40 * N + 9 ) ) / 10 ; return ( n - ( int ) n ) == 0 ; } int main ( ) { int N = 7 ; if ( isheptagonal ( N ) ) { cout << " Yes " ; } else { cout << " No " ; } return 0 ; }

Accumulator variables: stdc
C++ program:
#include <bits/stdc++.h>
using namespace std ; bool isenneadecagonal ( int N ) { float n = ( 15 + sqrt ( 136 * N + 225 ) ) / 34 ; return ( n - ( int ) n ) == 0 ; } int main ( ) { int N = 19 ; if ( isenneadecagonal ( N ) ) { cout << " Yes " ; } else { cout << " No " ; } return 0 ; }

Accumulator variables: stdc
C++ program:
#include <bits/stdc++.h>
using namespace std ; bool isCenteredtridecagonal ( int N ) { float n = ( 13 + sqrt ( 104 * N + 65 ) ) / 26 ; return ( n - ( int ) n ) == 0 ; } int main ( ) { int N = 14 ; if ( isCenteredtridecagonal ( N ) ) { cout << " Yes " ; } else { cout << " No " ; } return 0 ; }

Accumulator variables: stdc
C++ program:
#include <bits/stdc++.h>
using namespace std ; void countDistinctWays ( int N , int M ) { int ans = 0 ; for ( int i = 0 ; i < N ; i ++ ) { int K = __gcd ( i , N ) ; ans += pow ( M , K ) ; } ans /= N ; cout << ans << endl ; } int main ( ) { int N = 4 , M = 3 ; countDistinctWays ( N , M ) ; return 0 ; }

Accumulator variables: ans, i, stdc
Iterator variables: i
C++ program:
#include <bits/stdc++.h>
using namespace std ; void findNum ( int n , int k ) { int q = k / ( n - 1 ) ; int r = k % ( n - 1 ) ; int a ; if ( r != 0 ) a = ( n * q ) + r ; else a = ( n * q ) - 1 ; cout << a ; } int main ( ) { int A = 4 , N = 6 ; findNum ( A , N ) ; return 0 ; }

Accumulator variables: stdc
C++ program:
#include <bits/stdc++.h>
using namespace std ; int ans = 0 ; vector < int > graph [ 100 ] ; vector < int > weight ( 100 ) ; bool isPerfect ( long long int n ) { long long int sum = 1 ; for ( long long 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 ; } void dfs ( int node , int parent ) { if ( isPerfect ( weight [ node ] ) ) ans += 1 ; for ( int to : graph [ node ] ) { if ( to == parent ) continue ; dfs ( to , node ) ; } } int main ( ) { weight [ 1 ] = 5 ; weight [ 2 ] = 10 ; weight [ 3 ] = 11 ; weight [ 4 ] = 8 ; weight [ 5 ] = 6 ; graph [ 1 ] . push_back ( 2 ) ; graph [ 2 ] . push_back ( 3 ) ; graph [ 2 ] . push_back ( 4 ) ; graph [ 1 ] . push_back ( 5 ) ; dfs ( 1 , 1 ) ; cout << ans ; return 0 ; }

Index/key variables: node
Accumulator variables: ans, i, stdc
Iterator variables: i, to
C++ program:
#include <bits/stdc++.h>
using namespace std ; int GetMinCost ( int N ) { priority_queue < int , vector < int > , greater < int > > pq ; for ( int i = 1 ; i <= N ; i ++ ) { pq . push ( i ) ; } int cost = 0 ; while ( pq . size ( ) > 1 ) { int mini = pq . top ( ) ; pq . pop ( ) ; int secondmini = pq . top ( ) ; pq . pop ( ) ; int current = mini * secondmini ; cost += current ; pq . push ( current ) ; } return cost ; } int main ( ) { int N = 5 ; cout << GetMinCost ( N ) ; }

Accumulator variables: cost, i, stdc
Iterator variables: i
C++ program:
#include <bits/stdc++.h>
using namespace std ; static const int MOD = 1e9 + 7 ; int numPrimeArrangements ( int n ) { vector < bool > prime ( n + 1 , true ) ; prime [ 0 ] = false ; prime [ 1 ] = false ; for ( int i = 2 ; i <= 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 = 1e9 + 7 , res = 1 ; for ( int i = 1 ; i <= primeIndices ; i ++ ) res = ( 1LL * res * i ) % mod ; for ( int i = 1 ; i <= ( n - primeIndices ) ; i ++ ) res = ( 1LL * res * i ) % mod ; return res ; } int main ( ) { int N = 5 ; cout << numPrimeArrangements ( N ) ; return 0 ; }

Index/key variables: i
Accumulator variables: factor, i, primeIndices, stdc
Iterator variables: factor, i
C++ program:
#include <bits/stdc++.h>
using namespace std ; int fact ( int n ) { int res = 1 ; for ( int i = 2 ; i <= n ; i ++ ) res = res * i ; return res ; } double count_heads ( int n , int r ) { double output ; output = fact ( n ) / ( fact ( r ) * fact ( n - r ) ) ; output = output / ( pow ( 2 , n ) ) ; return output ; } int main ( ) { int n = 4 , r = 3 ; cout << count_heads ( n , r ) ; return 0 ; }

Accumulator variables: i, stdc
Iterator variables: i
C++ program:
#include <bits/stdc++.h>
using namespace std ; int dfs ( int u , vector < int > * adj , int vis [ ] ) { vis [ u ] = 1 ; int componentSize = 1 ; for ( auto it : adj [ u ] ) { if ( ! vis [ it ] ) { componentSize += dfs ( it , adj , vis ) ; } } return componentSize ; } int maximumComponentSize ( int a [ ] , int n ) { vector < int > adj [ n ] ; for ( int i = 0 ; i < n ; i ++ ) { for ( int j = i + 1 ; j < n ; j ++ ) { if ( __gcd ( a [ i ] , a [ j ] ) > 1 ) adj [ i ] . push_back ( j ) ; adj [ j ] . push_back ( i ) ; } } int answer = 0 ; int vis [ n ] ; for ( int k = 0 ; k < n ; k ++ ) { vis [ k ] = 0 ; } for ( int i = 0 ; i < n ; i ++ ) { if ( ! vis [ i ] ) { answer = max ( answer , dfs ( i , adj , vis ) ) ; } } return answer ; } int main ( ) { int n = 8 ; int A [ ] = { 2 , 3 , 6 , 7 , 4 , 12 , 21 , 39 } J2 : J6 ; cout << maximumComponentSize ( A , n ) ; return 0 ; }

Index/key variables: i, it, j, k, n, u
Accumulator variables: componentSize, i, j, k, stdc
Iterator variables: i, it, j, k
C++ program:
#include <bits/stdc++.h>
using namespace std ; int spf [ 100005 ] ; 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 ; } } } } void factorize ( int n , set < int > & s ) { while ( n > 1 ) { int z = spf [ n ] ; s . insert ( z ) ; while ( n % z == 0 ) n /= z ; } } int id [ 100005 ] ; int par [ 100005 ] ; int sizeContainer [ 100005 ] ; int root ( int i ) { if ( par [ i ] == i ) return i ; else return par [ i ] = root ( par [ i ] ) ; } void merge ( int a , int b ) { int p = root ( a ) ; int q = root ( b ) ; if ( p == q ) return ; if ( sizeContainer [ p ] > sizeContainer [ q ] ) swap ( p , q ) ; par [ p ] = q ; sizeContainer [ q ] += sizeContainer [ p ] ; } 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 ++ ) { set < int > s ; factorize ( a [ i ] , s ) ; for ( auto it : 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 = max ( answer , sizeContainer [ i ] ) ; return answer ; } int main ( ) { int n = 8 ; int A [ ] = { 2 , 3 , 6 , 7 , 4 , 12 , 21 , 39 } ; cout << maximumComponentsizeContainer ( A , n ) ; return 0 ; }

Index/key variables: i, it, j, n, p, q
Accumulator variables: i, j, n, stdc
Iterator variables: i, it, j
C++ program:
#include <bits/stdc++.h>
using namespace std ; int N = 1000000 ; vector < int > prime ; void SieveOfEratosthenes ( ) { bool check [ N + 1 ] ; memset ( check , true , sizeof ( check ) ) ; for ( int p = 2 ; p * p <= N ; p ++ ) { if ( check [ p ] == true ) { prime . push_back ( p ) ; for ( int i = p * p ; i <= N ; i += p ) check [ i ] = false ; } } } struct Node { int key ; struct Node * left , * right ; } ; Node * newNode ( int key ) { Node * temp = new Node ; temp -> key = key ; temp -> left = temp -> right = NULL ; return ( temp ) ; } bool IsChilrenPrimeFactor ( struct Node * parent , struct Node * a ) { if ( prime [ a -> key ] && ( parent -> key % a -> key == 0 ) ) return true ; else return false ; } unsigned int GetCount ( struct Node * node ) { if ( ! node ) return 0 ; queue < Node * > q ; int count = 0 ; q . push ( node ) ; while ( ! q . empty ( ) ) { struct Node * temp = q . front ( ) ; q . pop ( ) ; if ( temp -> left == NULL && temp -> right != NULL ) { if ( IsChilrenPrimeFactor ( temp , temp -> right ) ) count ++ ; } else { if ( temp -> right == NULL && temp -> left != NULL ) { if ( IsChilrenPrimeFactor ( temp , temp -> left ) ) count ++ ; } else { if ( temp -> left != NULL && temp -> right != NULL ) { if ( IsChilrenPrimeFactor ( temp , temp -> right ) && IsChilrenPrimeFactor ( temp , temp -> left ) ) count ++ ; } } } if ( temp -> left != NULL ) q . push ( temp -> left ) ; if ( temp -> right != NULL ) q . push ( temp -> right ) ; } return count ; } int main ( ) { Node * root = newNode ( 10 ) ; root -> left = newNode ( 2 ) ; root -> right = newNode ( 5 ) ; root -> right -> left = newNode ( 18 ) ; root -> right -> right = newNode ( 12 ) ; root -> right -> left -> left = newNode ( 2 ) ; root -> right -> left -> right = newNode ( 3 ) ; root -> right -> right -> left = newNode ( 3 ) ; root -> right -> right -> right = newNode ( 14 ) ; root -> right -> right -> right -> left = newNode ( 7 ) ; SieveOfEratosthenes ( ) ; cout << GetCount ( root ) << endl ; return 0 ; }

Index/key variables: i, p
Accumulator variables: count, i, p, stdc
Iterator variables: i, p
Class/struct names: Node
C++ program:
#include <bits/stdc++.h>
using namespace std ; string check ( int Arr [ ] , int n , int M , int K ) { int flag = 0 ; for ( int i = 0 ; i < n ; i ++ ) { if ( Arr [ i ] == 0 ) flag = 1 ; } if ( K % 2 != 0 && flag == 0 ) return " No " ; else return " Yes " ; } int main ( ) { int Arr [ ] = { 1 , 1 , 2 , 4 , 7 , 8 } ; int M = 5 ; int K = 6 ; int n = sizeof ( Arr ) / sizeof ( Arr [ 0 ] ) ; cout << check ( Arr , n , M , K ) ; return 0 ; }

Index/key variables: i
Accumulator variables: i, stdc
Iterator variables: i
C++ program:
#include <bits/stdc++.h>
using namespace std ; #include <vector>
void factor ( int n ) { int base [ 4 ] = { 2 , 3 , 5 , 7 } ; int start = int ( sqrt ( n ) ) ; vector < vector < int > > pairs ; int len = sizeof ( base ) / sizeof ( base [ 0 ] ) ; for ( int i = start ; i < n ; i ++ ) { vector < int > v ; for ( int j = 0 ; j < len ; j ++ ) { int lhs = ( ( int ) pow ( i , 2 ) ) % n ; int rhs = ( ( int ) pow ( base [ j ] , 2 ) ) % n ; if ( lhs == rhs ) { v . push_back ( i ) ; v . push_back ( base [ j ] ) ; pairs . push_back ( v ) ; } } } vector < int > newvec ; len = pairs . size ( ) ; for ( int i = 0 ; i < len ; i ++ ) { int factor = __gcd ( pairs [ i ] [ 0 ] - pairs [ i ] [ 1 ] , n ) ; if ( factor != 1 ) newvec . push_back ( factor ) ; } set < int > s ; for ( int i = 0 ; i < newvec . size ( ) ; i ++ ) s . insert ( newvec [ i ] ) ; for ( auto i = s . begin ( ) ; i != s . end ( ) ; i ++ ) cout << ( * i ) << " ▁ " ; } int main ( ) { factor ( 23449 ) ; }

Index/key variables: i, j
Accumulator variables: i, j, stdc
Iterator variables: i, j