dhyuti-n/xlcost-variable-roles huggingface dataset:
C++ program:
#include <bits/stdc++.h>
using namespace std ; 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 ; } bool isThreeDisctFactors ( long long n ) { int sq = ( int ) sqrt ( n ) ; if ( 1LL * sq * sq != n ) return false ; return isPrime ( sq ) ? true : false ; } int main ( ) { long long num = 9 ; if ( isThreeDisctFactors ( num ) ) cout << " Yes STRNEWLINE " ; else cout << " No STRNEWLINE " ; num = 15 ; if ( isThreeDisctFactors ( num ) ) cout << " Yes STRNEWLINE " ; else cout << " No STRNEWLINE " ; num = 12397923568441 ; if ( isThreeDisctFactors ( num ) ) cout << " Yes STRNEWLINE " ; else cout << " No STRNEWLINE " ; return 0 ; }

Accumulator variables: stdc
Iterator variables: i
C++ program:
#include <iostream>
using namespace std ; int computeLastDigit ( long long int A , long long int B ) { int variable = 1 ; return 1 ; else if ( ( B - A ) >= 5 ) return 0 ; else { for ( long long int i = A + 1 ; i <= B ; i ++ ) variable = ( variable * ( i % 10 ) ) ; return variable % 10 ; } } int main ( ) { cout << computeLastDigit ( 2632 , 2634 ) ; return 0 ; }

Accumulator variables: i
Iterator variables: i
C++ program:
#include <bits/stdc++.h>
using namespace std ; float sumOfAP ( float a , float d , int n ) { float sum = 0 ; for ( int i = 0 ; i < n ; i ++ ) { sum = sum + a ; a = a + d ; } return sum ; } int main ( ) { int n = 20 ; float a = 2.5 , d = 1.5 ; cout << sumOfAP ( a , d , n ) ; return 0 ; }

Accumulator variables: i, stdc
Iterator variables: i
C++ program:
#include <bits/stdc++.h>
#define M  1000000007
using namespace std ; long long multiplyFactors ( int n ) { long long prod = 1 ; for ( int i = 1 ; i * i <= n ; i ++ ) { if ( n % i == 0 ) { if ( n / i == i ) prod = ( prod * i ) % M ; else { prod = ( prod * i ) % M ; prod = ( prod * n / i ) % M ; } } } return prod ; } int main ( ) { int n = 12 ; cout << multiplyFactors ( n ) << endl ; return 0 ; }

Accumulator variables: i, stdc
Iterator variables: i
C++ program:
#include <bits/stdc++.h>
#define M  1000000007
using namespace std ; long long power ( long long x , long long y ) { long long res = 1 ; while ( y > 0 ) { if ( y & 1 ) res = ( res * x ) % M ; y = ( y >> 1 ) % M ; x = ( x * x ) % M ; } return res ; } int countFactors ( int n ) { int count = 0 ; for ( int i = 1 ; i * i <= n ; i ++ ) { if ( n % i == 0 ) { if ( n / i == i ) count ++ ; else count += 2 ; } } return count ; } long long multiplyFactors ( int n ) { int numFactor = countFactors ( n ) ; long long product = power ( n , numFactor / 2 ) ; if ( numFactor & 1 ) product = ( product * ( int ) sqrt ( n ) ) % M ; return product ; } int main ( ) { int n = 12 ; cout << multiplyFactors ( n ) << endl ; return 0 ; }

Accumulator variables: count, i, stdc
Iterator variables: i
C++ program:
#include <bits/stdc++.h>
using namespace std ; bool isDivisibleBy10 ( string bin ) { int n = bin . size ( ) ; if ( bin [ n - 1 ] == '1' ) return false ; int sum = 0 ; for ( int i = n - 2 ; i >= 0 ; i -- ) { if ( bin [ i ] == '1' ) { int posFromRight = n - i - 1 ; if ( posFromRight % 4 == 1 ) sum = sum + 2 ; else if ( posFromRight % 4 == 2 ) sum = sum + 4 ; else if ( posFromRight % 4 == 3 ) sum = sum + 8 ; else if ( posFromRight % 4 == 0 ) sum = sum + 6 ; } } if ( sum % 10 == 0 ) return true ; return false ; } int main ( ) { string bin = "11000111001110" ; if ( isDivisibleBy10 ( bin ) ) cout << " Yes " ; else cout << " No " ; return 0 ; }

Index/key variables: i
Accumulator variables: i, stdc
Iterator variables: i
C++ program:
#include <iostream>
using namespace std ; void printTrib ( int n ) { if ( n < 1 ) return ; int first = 0 , second = 0 ; int third = 1 ; cout << first << " ▁ " ; if ( n > 1 ) cout << second << " ▁ " ; if ( n > 2 ) cout << second << " ▁ " ; for ( int i = 3 ; i < n ; i ++ ) { int curr = first + second + third ; first = second ; second = third ; third = curr ; cout << curr << " ▁ " ; } } int main ( ) { int n = 10 ; printTrib ( n ) ; return 0 ; }

Accumulator variables: i
Iterator variables: i
C++ program:
#include <bits/stdc++.h>
using namespace std ; #include <cmath>
vector < int > SieveOfEratosthenes ( int n ) { bool prime [ n + 1 ] ; memset ( prime , false , sizeof ( prime ) ) ; for ( int p = 2 ; p * p <= n ; p ++ ) { if ( prime [ p ] == false ) for ( int i = p * 2 ; i < n + 1 ; i += p ) prime [ i ] = true ; } vector < int > lis ; for ( int p = 2 ; p <= n ; p ++ ) if ( prime [ p ] == false ) lis . push_back ( p ) ; return lis ; } int setBits ( int n ) { return __builtin_popcount ( n ) ; } int main ( ) { int x = 4 , y = 8 ; int count = 0 ; vector < int > primeArr = SieveOfEratosthenes ( ceil ( log2 ( y ) ) ) ; for ( int i = x ; i < y + 1 ; i ++ ) { int temp = setBits ( i ) ; for ( int j = 0 ; j < primeArr . size ( ) ; j ++ ) { if ( temp == primeArr [ j ] ) { count += 1 ; break ; } } } cout << count << endl ; return 0 ; }

Index/key variables: i, j, p
Accumulator variables: count, i, j, p, stdc
Iterator variables: i, j, p
C++ program:
#include <bits/stdc++.h>
using namespace std ; int countTrailingZeroes ( int N ) { int res = log2 ( N ^ ( N - 1 ) ) ; return res >= 0 ? res : 0 ; } int main ( ) { int N = 12 ; cout << countTrailingZeroes ( N ) ; return 0 ; }

Accumulator variables: stdc
C++ program:
#include <bits/stdc++.h>
using namespace std ; int calcScr ( vector < int > arr ) { int ans = 0 ; for ( int i = 0 ; i < arr . size ( ) ; i ++ ) ans += ( i ^ arr [ i ] ) ; return ans ; } int getMax ( vector < int > arr , int ans , vector < bool > chosen , int N ) { if ( arr . size ( ) == N ) { ans = max ( ans , calcScr ( arr ) ) ; return ans ; } for ( int i = 0 ; i < N ; i ++ ) { if ( chosen [ i ] ) continue ; chosen [ i ] = true ; arr . push_back ( i ) ; ans = getMax ( arr , ans , chosen , N ) ; chosen [ i ] = false ; arr . pop_back ( ) ; } return ans ; } int main ( ) { int N = 2 ; vector < int > arr ; int ans = -1 ; vector < bool > chosen ( N , false ) ; ans = getMax ( arr , ans , chosen , N ) ; cout << ans << endl ; }

Index/key variables: i
Accumulator variables: ans, i, stdc
Iterator variables: i
C++ program:
#include <bits/stdc++.h>
using namespace std ; void additiveCongruentialMethod ( int Xo , int m , int c , vector < int > & randomNums , int noOfRandomNums ) { randomNums [ 0 ] = Xo ; for ( int i = 1 ; i < noOfRandomNums ; i ++ ) { randomNums [ i ] = ( randomNums [ i - 1 ] + c ) % m ; } } int main ( ) { int Xo = 3 ; int m = 15 ; int c = 2 ; int noOfRandomNums = 20 ; vector < int > randomNums ( noOfRandomNums ) ; additiveCongruentialMethod ( Xo , m , c , randomNums , noOfRandomNums ) ; for ( int i = 0 ; i < noOfRandomNums ; i ++ ) { cout << randomNums [ i ] << " ▁ " ; } return 0 ; }

Index/key variables: i
Accumulator variables: i, stdc
Iterator variables: i
C++ program:
#include <bits/stdc++.h>
using namespace std ; const int MOD = 1e9 + 7 ; const int N = 1e5 + 5 ; vector < int > BIT ( N , 0 ) ; int power ( int x , int y ) { if ( x == 0 ) return 0 ; int ans = 1 ; while ( y > 0 ) { if ( y & 1 ) ans = ( 1LL * ans * x ) % MOD ; x = ( 1LL * x * x ) % MOD ; y >>= 1 ; } return ans ; } void updateBIT ( int idx , int val ) { assert ( idx > 0 ) ; while ( idx < N ) { BIT [ idx ] += val ; idx += idx & - idx ; } } int queryBIT ( int idx ) { int ans = 0 ; while ( idx > 0 ) { ans += BIT [ idx ] ; idx -= idx & - idx ; } return ans ; } int numWays ( int arr [ ] , int n ) { int mx = 0 ; for ( int i = 0 ; i < n ; i ++ ) { updateBIT ( arr [ i ] , 1 ) ; mx = max ( mx , arr [ i ] ) ; } int ans = 1 ; for ( int i = 2 ; i <= mx ; i ++ ) { vector < int > factors ; for ( int j = 1 ; j * j <= i ; j ++ ) { if ( i % j == 0 ) { factors . push_back ( j ) ; if ( i / j != j ) factors . push_back ( i / j ) ; } } sort ( factors . rbegin ( ) , factors . rend ( ) ) ; int cnt = 1 ; int prev = 0 ; for ( int j = 0 ; j < factors . size ( ) ; j ++ ) { int remFactors = int ( factors . size ( ) ) - j ; int indexes = n - queryBIT ( factors [ j ] - 1 ) ; cnt = ( 1LL * cnt * power ( remFactors , indexes - prev ) ) % MOD ; prev = max ( prev , indexes ) ; } factors . erase ( factors . begin ( ) ) ; int toSubtract = 1 ; prev = 0 ; for ( int j = 0 ; j < factors . size ( ) ; j ++ ) { int remFactors = int ( factors . size ( ) ) - j ; int indexes = n - queryBIT ( factors [ j ] - 1 ) ; toSubtract = ( 1LL * toSubtract * power ( remFactors , indexes - prev ) ) ; prev = max ( prev , indexes ) ; } ans = ( 1LL * ans + cnt - toSubtract + MOD ) % MOD ; } return ans ; } int main ( ) { int arr [ ] = { 6 , 3 } ; int n = sizeof ( arr ) / sizeof ( arr [ 0 ] ) ; int ans = numWays ( arr , n ) ; cout << ans << endl ; return 0 ; }

Index/key variables: i, idx, j
Accumulator variables: ans, i, idx, j, stdc
Iterator variables: i, j
C++ program:
#include <bits/stdc++.h>
using namespace std ; int gonNum65537 ( int n ) { return ( 65535 * n * n - 65533 * n ) / 2 ; } int main ( ) { int n = 3 ; cout << gonNum65537 ( n ) ; return 0 ; }

Accumulator variables: stdc
C++ program:
#include <bits/stdc++.h>
using namespace std ; int HexacontatetragonNum ( int n ) { return ( 62 * n * n - 60 * n ) / 2 ; } int main ( ) { int n = 3 ; cout << HexacontatetragonNum ( n ) ; return 0 ; }

Accumulator variables: stdc
C++ program:
#include <bits/stdc++.h>
using namespace std ; int icosikaipentagonNum ( int N ) { return ( 23 * N * N - 21 * N ) / 2 ; } int main ( ) { int n = 3 ; cout << "3rd ▁ icosikaipentagon ▁ Number ▁ is ▁ " << icosikaipentagonNum ( n ) ; return 0 ; }

Accumulator variables: stdc
C++ program:
#include <bits/stdc++.h>
using namespace std ; int chiliagonNum ( int n ) { return ( 998 * n * n - 996 * n ) / 2 ; } int main ( ) { int n = 3 ; cout << "3rd ▁ chiliagon ▁ Number ▁ is ▁ = ▁ " << chiliagonNum ( n ) ; return 0 ; }

Accumulator variables: stdc
C++ program:
#include <bits/stdc++.h>
using namespace std ; int pentacontagonNum ( int n ) { return ( 48 * n * n - 46 * n ) / 2 ; } int main ( ) { int n = 3 ; cout << "3rd ▁ pentacontagon ▁ Number ▁ is ▁ = ▁ " << pentacontagonNum ( n ) ; return 0 ; }

Accumulator variables: stdc
C++ program:
#include <bits/stdc++.h>
using namespace std ; int prod_of_max_min ( int n ) { int largest = 0 ; int smallest = 10 ; while ( n ) { int r = n % 10 ; largest = max ( r , largest ) ; smallest = min ( r , smallest ) ; n = n / 10 ; } return largest * smallest ; } int formed_no ( int N , int K ) { if ( K == 1 ) { return N ; } int answer = N ; while ( K -- ) { int a_current = prod_of_max_min ( answer ) ; if ( a_current == 0 ) break ; answer += a_current ; } return answer ; } int main ( ) { int N = 487 , K = 100000000 ; cout << formed_no ( N , K ) << endl ; return 0 ; }

Accumulator variables: K, answer, stdc
C++ program:
#include <bits/stdc++.h>
using namespace std ; int countDigit ( long long n ) { return floor ( log10 ( n ) + 1 ) ; } int main ( ) { double N = 80 ; cout << countDigit ( N ) ; return 0 ; }

Accumulator variables: stdc
C++ program:
#include <bits/stdc++.h>
using namespace std ; double sum ( int x , int n ) { double i , total = 1.0 , multi = x ; cout << total << " ▁ " ; for ( i = 1 ; i < n ; i ++ ) { total = total + multi ; cout << multi << " ▁ " ; multi = multi * x ; } cout << " STRNEWLINE " ; return total ; } int main ( ) { int x = 2 ; int n = 5 ; cout << fixed << setprecision ( 2 ) << sum ( x , n ) ; return 0 ; }

Accumulator variables: i, stdc
Iterator variables: i
C++ program:
#include <bits/stdc++.h>
using namespace std ; int findRemainder ( int n ) { int x = n & 3 ; return x ; } int main ( ) { int N = 43 ; int ans = findRemainder ( N ) ; cout << ans << endl ; return 0 ; }

Accumulator variables: stdc
C++ program:
#include <bits/stdc++.h>
using namespace std ; bool isAutoBio ( int num ) { string autoStr ; int index , number , i , j , cnt ; autoStr = to_string ( num ) ; for ( int i = 0 ; i < autoStr . size ( ) ; i ++ ) { index = autoStr . at ( i ) - '0' ; cnt = 0 ; for ( j = 0 ; j < autoStr . size ( ) ; j ++ ) { number = autoStr . at ( j ) - '0' ; if ( number == i ) cnt ++ ; } if ( index != cnt ) return false ; } return true ; } void findAutoBios ( int n ) { int high , low , i , flag = 0 ; low = pow ( 10 , n - 1 ) ; high = pow ( 10 , n ) - 1 ; for ( i = low ; i <= high ; i ++ ) { if ( isAutoBio ( i ) ) { flag = 1 ; cout << i << " , ▁ " ; } } if ( ! flag ) cout << " There ▁ is ▁ no ▁ " << " Autobiographical ▁ number " << " ▁ with ▁ " << n << " ▁ digits STRNEWLINE " ; } int main ( ) { int N = 0 ; findAutoBios ( N ) ; N = 4 ; findAutoBios ( N ) ; return 0 ; }

Accumulator variables: cnt, i, j, stdc
Iterator variables: i, j
C++ program:
#include <bits/stdc++.h>
using namespace std ; void checkPalindrome ( int num ) { string str = to_string ( num ) ; int l = 0 , r = str . length ( ) - 1 ; while ( l < r ) { if ( str [ l ] != str [ r ] ) { cout << " No " ; return ; } l ++ ; r -- ; } cout << " Yes " ; return ; } int main ( ) { int n = 19 , k = 3 ; checkPalindrome ( n + k ) ; return 0 ; }

Index/key variables: l, r
Accumulator variables: l, r, stdc
C++ program:
#include <iostream>
using namespace std ; int subsetSum ( int arr [ ] , int n , int i , int sum , int count ) { if ( i == n ) { if ( sum == 0 ) { count ++ ; } return count ; } count = subsetSum ( arr , n , i + 1 , sum - arr [ i ] , count ) ; count = subsetSum ( arr , n , i + 1 , sum , count ) ; return count ; } int main ( ) { int arr [ ] = { 1 , 2 , 3 , 4 , 5 } ; int sum = 10 ; int n = sizeof ( arr ) / sizeof ( arr [ 0 ] ) ; cout << subsetSum ( arr , n , 0 , sum , 0 ) ; }

Index/key variables: i
Accumulator variables: count
C++ program:
#include <bits/stdc++.h>
using namespace std ; vector < int > sieve ( int n ) { vector < int > prime ( n + 1 , 0 ) ; int p = 2 ; while ( p * p <= n ) { if ( prime [ p ] == 0 ) { for ( int i = 2 * p ; i < n + 1 ; i += p ) prime [ i ] = 1 ; } p += 1 ; } vector < int > allPrimes ; for ( int i = 2 ; i < n ; i ++ ) if ( prime [ i ] == 0 ) allPrimes . push_back ( i ) ; return allPrimes ; } vector < int > distPrime ( vector < int > arr , vector < int > allPrimes ) { vector < int > list1 ; for ( int i : allPrimes ) { for ( int j : arr ) { if ( j % i == 0 ) { list1 . push_back ( i ) ; break ; } } } return list1 ; } int main ( ) { vector < int > allPrimes = sieve ( 10000 ) ; vector < int > arr = { 15 , 30 , 60 } ; vector < int > ans = distPrime ( arr , allPrimes ) ; cout << " [ " ; for ( int i : ans ) cout << i << " ▁ " ; cout << " ] " ; }

Index/key variables: i, p
Accumulator variables: i, p, stdc
Iterator variables: i, j
C++ program:
#include <bits/stdc++.h>
using namespace std ; int sum ( int m , int n ) { return 8 * m * n - 6 * m - 6 * n + 4 ; } int main ( ) { int m = 3 , n = 2 ; cout << sum ( m , n ) ; return 0 ; }

Accumulator variables: stdc
C++ program:
#include <bits/stdc++.h>
using namespace std ; int count ( int arr [ ] , int n , int k ) { sort ( arr , arr + n ) ; int cnt = 0 ; int i = 0 , j = 1 ; while ( i < n && j < n ) { j = ( j <= i ) ? ( i + 1 ) : j ; while ( j < n && ( arr [ j ] - arr [ i ] ) < k ) j ++ ; cnt += ( n - j ) ; i ++ ; } return cnt ; } int main ( ) { int arr [ ] = { 1 , 2 , 3 , 4 } ; int n = sizeof ( arr ) / sizeof ( arr [ 0 ] ) ; int k = 2 ; cout << count ( arr , n , k ) ; return 0 ; }

Index/key variables: i, j
Accumulator variables: cnt, i, j, stdc
C++ program:
#include <bits/stdc++.h>
using namespace std ; double volumeRec ( double a , double b , double e , double h ) { return ( ( ( b * h ) / 6 ) * ( 2 * a + e ) ) ; } int main ( ) { double a = 2 ; double b = 5 ; double e = 5 ; double h = 6 ; printf ( " Volume ▁ = ▁ % .1f " , volumeRec ( a , b , e , h ) ) ; return 0 ; }

Accumulator variables: stdc
C++ program:
#include <bits/stdc++.h>
using namespace std ; int count_square ( int n ) { int count = 0 ; for ( int i = 1 ; i <= n ; i = i + 2 ) { int k = n - i + 1 ; count += ( k * k ) ; } return count ; } int main ( ) { int N = 8 ; cout << count_square ( N ) ; return 0 ; }

Accumulator variables: count, stdc
Iterator variables: i
C++ program:
#include <bits/stdc++.h>
using namespace std ; static int countAnomalies ( int arr [ ] , int n , int k ) { int cnt = 0 ; int i , sum = 0 ; for ( i = 0 ; i < n ; i ++ ) sum += arr [ i ] ; for ( i = 0 ; i < n ; i ++ ) if ( abs ( arr [ i ] - ( sum - arr [ i ] ) ) > k ) cnt ++ ; return cnt ; } int main ( ) { int arr [ ] = { 1 , 3 , 5 } ; int n = sizeof ( arr ) / sizeof ( arr [ 0 ] ) ; int k = 1 ; cout << countAnomalies ( arr , n , k ) ; }

Index/key variables: i
Accumulator variables: cnt, i, stdc, sum
Iterator variables: i
C++ program:
#include <bits/stdc++.h>
using namespace std ; #define N  100005
int d [ N ] , pre [ N ] ; void Positive_Divisors ( ) { for ( int i = 1 ; i < N ; i ++ ) { for ( int j = 1 ; j * j <= i ; j ++ ) { if ( i % j == 0 ) { if ( j * j == i ) d [ i ] ++ ; else d [ i ] += 2 ; } } } int ans = 0 ; for ( int i = 2 ; i < N ; i ++ ) { if ( d [ i ] == d [ i - 1 ] ) ans ++ ; pre [ i ] = ans ; } } int main ( ) { Positive_Divisors ( ) ; int n = 15 ; cout << pre [ n ] << endl ; return 0 ; }

Index/key variables: N, i, n
Accumulator variables: ans, i, j, stdc
Iterator variables: i, j
C++ program:
#include <bits/stdc++.h>
using namespace std ; int numLen ( int K ) { if ( K % 2 == 0 K % 5 == 0 ) return -1 ; int number = 0 ; int len = 1 ; for ( len = 1 ; len <= K ; len ++ ) { number = number * 10 + 1 ; if ( ( number % K == 0 ) ) return len ; } return -1 ; } int main ( ) { int K = 7 ; cout << numLen ( K ) ; return 0 ; }

Accumulator variables: len, stdc
Iterator variables: len
C++ program:
#include <bits/stdc++.h>
using namespace std ; bool doesContainB ( int a , int b , int c ) { if ( a == b ) return true ; if ( ( b - a ) * c > 0 && ( b - a ) % c == 0 ) return true ; return false ; } int main ( ) { int a = 1 , b = 7 , c = 3 ; if ( doesContainB ( a , b , c ) ) cout << " Yes " ; else cout << " No " ; return 0 ; }

Accumulator variables: stdc
C++ program:
#include <bits/stdc++.h>
using namespace std ; void printPermutation ( int n , int k ) { for ( int i = 1 ; i <= n ; i ++ ) { int x = 2 * i - 1 ; int y = 2 * i ; if ( i <= k ) cout << y << " ▁ " << x << " ▁ " ; else cout << x << " ▁ " << y << " ▁ " ; } } int main ( ) { int n = 2 , k = 1 ; printPermutation ( n , k ) ; return 0 ; }

Accumulator variables: i, stdc
Iterator variables: i
C++ program:
#include <bits/stdc++.h>
using namespace std ; #define ll  long long int
ll maxSum ( int N ) { ll ans = 0 ; for ( int u = 1 ; u <= N ; u ++ ) { for ( int v = 1 ; v <= N ; v ++ ) { if ( u == v ) continue ; int degreeU = 2 ; if ( u == 1 u == N ) degreeU = 1 ; int degreeV = 2 ; if ( v == 1 v == N ) degreeV = 1 ; ans += ( degreeU * degreeV ) ; } } return ans ; } int main ( ) { int N = 6 ; cout << maxSum ( N ) ; }

Accumulator variables: ans, stdc, u, v
Iterator variables: u, v
C++ program:
#include <bits/stdc++.h>
using namespace std ; void maximumFactor ( vector < int > arr ) { int n = arr . size ( ) ; vector < int > rank ; vector < int > factors ; int max = * max_element ( arr . begin ( ) , arr . end ( ) ) ; for ( int i = 2 ; i <= max ; i ++ ) { int count = 0 ; for ( int j = 0 ; j < n ; j ++ ) { if ( arr [ j ] % i == 0 ) count += 1 ; rank . push_back ( count ) ; factors . push_back ( i ) ; } } int m = * max_element ( rank . begin ( ) , rank . end ( ) ) ; for ( int i = 0 ; i < rank . size ( ) ; i ++ ) { if ( rank [ i ] == m ) cout << factors [ i ] << " ▁ " ; } } int main ( ) { vector < int > arr = { 120 , 15 , 24 , 63 , 18 } ; maximumFactor ( arr ) ; }

Index/key variables: i, j
Accumulator variables: count, i, j, stdc
Iterator variables: i, j
C++ program:
#include <iostream>
using namespace std ; int findSum ( int n ) { int sum = 0 ; for ( int x = 1 ; x <= n ; x ++ ) sum = sum + x ; return sum ; } int main ( ) { int n = 5 ; cout << findSum ( n ) ; return 0 ; }

Accumulator variables: x
Iterator variables: x
C++ program:
#include <bits/stdc++.h>
using namespace std ; double findMedian ( int a [ ] , int n ) { sort ( a , a + n ) ; if ( n % 2 != 0 ) return ( double ) a [ n / 2 ] ; return ( double ) ( a [ ( n - 1 ) / 2 ] + a [ n / 2 ] ) / 2.0 ; } int main ( ) { int a [ ] = { 1 , 3 , 4 , 2 , 7 , 5 , 8 , 6 } ; int n = sizeof ( a ) / sizeof ( a [ 0 ] ) ; cout << " Median ▁ = ▁ " << findMedian ( a , n ) << endl ; return 0 ; }

Accumulator variables: stdc
C++ program:
#include <bits/stdc++.h>
using namespace std ; double findMean ( int a [ ] , int n ) { int sum = 0 ; for ( int i = 0 ; i < n ; i ++ ) sum += a [ i ] ; return ( double ) sum / ( double ) n ; } int main ( ) { int a [ ] = { 1 , 3 , 4 , 2 , 7 , 5 , 8 , 6 } ; int n = sizeof ( a ) / sizeof ( a [ 0 ] ) ; cout << " Mean ▁ = ▁ " << findMean ( a , n ) << endl ; return 0 ; }

Index/key variables: i
Accumulator variables: i, stdc, sum
Iterator variables: i
C++ program:
#include <bits/stdc++.h>
using namespace std ; bool CheckArray ( int arr [ ] , int n ) { int prod = 1 ; unordered_set < int > freq ; for ( int i = 0 ; i < n ; ++ i ) { freq . insert ( arr [ i ] ) ; prod *= arr [ i ] ; } int root = sqrt ( prod ) ; if ( root * root == prod ) if ( freq . find ( root ) != freq . end ( ) ) return true ; return false ; } int main ( ) { int arr [ ] = { 1 , 2 , 12 , 3 , 2 } ; int n = sizeof ( arr ) / sizeof ( arr [ 0 ] ) ; if ( CheckArray ( arr , n ) ) cout << " YES " ; else cout << " NO " ; return 0 ; }

Index/key variables: i
Accumulator variables: prod, stdc
Iterator variables: i
C++ program:
#include <bits/stdc++.h>
using namespace std ; int minAreaRect ( vector < vector < int > > A ) { map < int , vector < int > > columns ; for ( auto i : A ) columns [ i [ 0 ] ] . push_back ( i [ 1 ] ) ; map < pair < int , int > , int > lastx ; int ans = INT_MAX ; for ( auto x : columns ) { vector < int > column = x . second ; sort ( column . begin ( ) , column . end ( ) ) ; for ( int j = 0 ; j < column . size ( ) ; j ++ ) { for ( int i = 0 ; i < j ; i ++ ) { int y1 = column [ i ] ; if ( lastx . find ( { y1 , column [ j ] } ) != lastx . end ( ) ) { ans = min ( ans , ( x . first - lastx [ { y1 , column [ j ] } ] ) * ( column [ j ] - column [ i ] ) ) ; } lastx [ { y1 , column [ j ] } ] = x . first ; } } } if ( ans < INT_MAX ) return ans ; else return 0 ; } int main ( ) { vector < vector < int > > A = { { 1 , 1 } , { 1 , 3 } , { 3 , 1 } , { 3 , 3 } , { 2 , 2 } } ; cout << ( minAreaRect ( A ) ) ; return 0 ; }

Index/key variables: i, j
Accumulator variables: i, j, stdc
Iterator variables: i, j, x
C++ program:
#include <bits/stdc++.h>
using namespace std ; int toK ( int N , int K ) { int w = 1 ; int s = 0 ; while ( N != 0 ) { int r = N % K ; N = N / K ; s = r * w + s ; w *= 10 ; } return s ; } bool check ( int N ) { bool fl = false ; while ( N != 0 ) { int r = N % 10 ; N = N / 10 ; if ( fl == true and r == 0 ) return false ; if ( r > 0 ) { fl = false ; continue ; } fl = true ; } return true ; } void hasConsecutiveZeroes ( int N , int K ) { int z = toK ( N , K ) ; if ( check ( z ) ) cout << " Yes " << endl ; else cout << " No " << endl ; } int main ( ) { int N = 15 ; int K = 8 ; hasConsecutiveZeroes ( N , K ) ; }

Accumulator variables: stdc, w
Boolean variables: fl
C++ program:
#include <bits/stdc++.h>
using namespace std ; #define MAX  1000000
bool prime [ MAX + 1 ] ; void SieveOfEratosthenes ( ) { memset ( prime , true , sizeof ( prime ) ) ; prime [ 1 ] = false ; prime [ 0 ] = false ; for ( int p = 2 ; p * p <= MAX ; p ++ ) { if ( prime [ p ] == true ) { for ( int i = p * 2 ; i <= MAX ; i += p ) prime [ i ] = false ; } } } void SumOfKthPrimes ( int arr [ ] , int n , int k ) { int c = 0 ; long long int sum = 0 ; for ( int i = 0 ; i < n ; i ++ ) { if ( prime [ arr [ i ] ] ) { c ++ ; if ( c % k == 0 ) { sum += arr [ i ] ; c = 0 ; } } } cout << sum << endl ; } int main ( ) { SieveOfEratosthenes ( ) ; int arr [ ] = { 2 , 3 , 5 , 7 , 11 } ; int n = sizeof ( arr ) / sizeof ( arr [ 0 ] ) ; int k = 2 ; SumOfKthPrimes ( arr , n , k ) ; return 0 ; }

Index/key variables: i, p
Accumulator variables: c, i, p, stdc, sum
Iterator variables: i, p