dhyuti-n/xlcost-variable-roles huggingface dataset:
C++ program:
#include <bits/stdc++.h>
using namespace std ; int PentacontahenagonNum ( int N ) { return ( 49 * N * N - 47 * N ) / 2 ; } int main ( ) { int N = 3 ; cout << "3rd ▁ Pentacontahenagon ▁ Number ▁ is ▁ " << PentacontahenagonNum ( N ) ; return 0 ; }

Accumulator variables: stdc
C++ program:
#include <bits/stdc++.h>
using namespace std ; bool isSaintExuperyNum ( int n ) { for ( int i = 1 ; i <= n / 3 ; i ++ ) { for ( int j = i + 1 ; j <= n / 2 ; j ++ ) { int k = n / i / j ; if ( i * i + j * j == k * k ) { if ( i * j * k == n ) return true ; ; } } } return false ; } int main ( ) { int N = 60 ; if ( isSaintExuperyNum ( N ) ) cout << " Yes " ; else cout << " No " ; return 0 ; }

Accumulator variables: i, j, stdc
Iterator variables: i, j
C++ program:
#include <iostream>
using namespace std ; bool isRepdigit ( int num , int b ) { int prev = -1 ; while ( num ) { int digit = num % b ; num /= b ; if ( prev != -1 && digit != prev ) return false ; prev = digit ; } return true ; } int main ( ) { int num = 2000 , base = 7 ; isRepdigit ( num , base ) ? cout << " Yes " : cout << " No " ; return 0 ; }

Accumulator variables: num
C++ program:
#include <iostream>
#include <math.h>
using namespace std ; bool isComposite ( int n ) { if ( n <= 3 ) return false ; if ( n % 2 == 0 n % 3 == 0 ) return true ; for ( int i = 5 ; i * i <= n ; i = i + 6 ) if ( n % i == 0 || n % ( i + 2 ) == 0 ) return true ; return false ; } int concatenatePrimeFactors ( int n ) { char concatenate ; if ( n % 2 == 0 ) { concatenate += char ( 2 ) ; while ( n % 2 == 0 ) n = n / 2 ; } for ( int i = 3 ; i <= sqrt ( n ) ; i = i + 2 ) { if ( n % i == 0 ) { concatenate += i ; while ( n % i == 0 ) n = n / i ; } } if ( n > 2 ) concatenate += n ; return concatenate ; } bool isEnlightened ( int N ) { if ( ! isComposite ( N ) ) return false ; char num = char ( N ) ; char prefixConc = concatenatePrimeFactors ( N ) ; return int ( prefixConc ) ; } int main ( ) { int n = 250 ; if ( isEnlightened ( n ) ) cout << " Yes " ; else cout << " No " ; }

Accumulator variables: concatenate
Iterator variables: i
C++ program:
#include <bits/stdc++.h>
using namespace std ; bool isIdoneal ( int n ) { for ( int a = 1 ; a <= n ; a ++ ) { for ( int b = a + 1 ; b <= n ; b ++ ) { for ( int c = b + 1 ; c <= n ; c ++ ) { if ( a * b + b * c + c * a == n ) return false ; } } } return true ; } int main ( ) { int N = 10 ; if ( isIdoneal ( N ) ) cout << " Yes " ; else cout << " No " ; return 0 ; }

Accumulator variables: a, b, c, stdc
Iterator variables: a, b, c
C++ program:
#include <bits/stdc++.h>
using namespace std ; bool checkDivisibility ( int n , int digit ) { return ( digit != 0 && n % digit == 0 ) ; } bool isAllDigitsDivide ( int n ) { int temp = n ; while ( temp > 0 ) { int digit = temp % 10 ; if ( ! ( checkDivisibility ( n , digit ) ) ) return false ; temp /= 10 ; } return true ; } bool isAllDigitsDistinct ( int n ) { bool arr [ 10 ] ; for ( int i = 0 ; i < 10 ; i ++ ) arr [ i ] = false ; while ( n > 0 ) { int digit = n % 10 ; if ( arr [ digit ] ) return false ; arr [ digit ] = true ; n = n / 10 ; } return true ; } bool isLynchBell ( int n ) { return isAllDigitsDivide ( n ) && isAllDigitsDistinct ( n ) ; } int main ( ) { int N = 12 ; if ( isLynchBell ( N ) ) cout << " Yes " ; else cout << " No " ; return 0 ; }

Index/key variables: digit, i
Accumulator variables: i, stdc, temp
Iterator variables: i
C++ program:
#include <iostream>
#include <math.h>
using namespace std ; bool isRepunitNum ( int n , int b ) { int length = 0 ; int countOne = 0 ; while ( n != 0 ) { int r = n % b ; length ++ ; if ( r == 1 ) countOne ++ ; n = n / b ; } return countOne >= 3 && countOne == length ; } int main ( ) { int n = 31 ; int base = 2 ; if ( isRepunitNum ( n , base ) ) cout << " Yes " ; else cout << " NO " ; return 0 ; }

Accumulator variables: countOne, length
C++ program:
#include <bits/stdc++.h>
using namespace std ; int firstDigit ( int n ) { int digits = ( int ) log10 ( n ) ; n = ( int ) ( n / pow ( 10 , digits ) ) ; return n ; } int lastDigit ( int n ) { return ( n % 10 ) ; } bool isGapful ( int n ) { int first_dig = firstDigit ( n ) ; int last_dig = lastDigit ( n ) ; int concatenation = first_dig * 10 + last_dig ; return ( n % concatenation == 0 ) ; } int main ( ) { int n = 108 ; if ( isGapful ( n ) ) cout << " Yes " ; else cout << " No " ; return 0 ; }

Accumulator variables: stdc
C++ program:
#include <bits/stdc++.h>
using namespace std ; const int MAX = 10000 ; 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 = 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 ) ; } bool isEconomical ( int n ) { if ( n == 1 ) return false ; int original_no = n ; int sumDigits = 0 ; while ( original_no > 0 ) { sumDigits ++ ; original_no = original_no / 10 ; } int pDigit = 0 , count_exp = 0 , p ; for ( int i = 0 ; primes [ i ] <= n / 2 ; i ++ ) { while ( n % primes [ i ] == 0 ) { p = primes [ i ] ; n = n / p ; count_exp ++ ; } while ( p > 0 ) { pDigit ++ ; p = p / 10 ; } while ( count_exp > 1 ) { pDigit ++ ; count_exp = count_exp / 10 ; } } if ( n != 1 ) { while ( n > 0 ) { pDigit ++ ; n = n / 10 ; } } return ( pDigit < sumDigits ) ; } int main ( ) { sieveSundaram ( ) ; for ( int i = 1 ; i < 200 ; i ++ ) if ( isEconomical ( i ) ) cout << i << " ▁ " ; return 0 ; }

Index/key variables: i, j
Accumulator variables: count_exp, i, pDigit, stdc, sumDigits
Iterator variables: i, j
C++ program:
#include <bits/stdc++.h>
using namespace std ; bool isPossible ( int A , int B , int N , int K , int L ) { int needa , needb ; if ( A % K == 0 ) needa = A / K ; else needa = A / K + 1 ; if ( B % L == 0 ) needb = B / L ; else needb = B / L + 1 ; int total = needa + needb ; if ( total > N ) return false ; else return true ; } int main ( ) { int A = 3 , B = 3 , N = 3 ; int K = 4 , M = 2 ; if ( isPossible ( A , B , N , K , M ) ) cout << " YES " << endl ; else cout << " NO " << endl ; return 0 ; }

Accumulator variables: stdc
C++ program:
#include <bits/stdc++.h>
using namespace std ; #define MAX  1000050
#define lli  long int
lli spf [ MAX + 1 ] ; void calculate_SPF ( ) { for ( lli i = 0 ; i <= MAX ; i ++ ) spf [ i ] = i ; for ( lli i = 4 ; i <= MAX ; i += 2 ) spf [ i ] = 2 ; for ( lli i = 3 ; i * i <= MAX ; i ++ ) { if ( spf [ i ] == i ) { for ( int j = i * i ; j <= MAX ; j += i ) if ( spf [ j ] == j ) spf [ j ] = i ; } } } lli tfactor [ MAX + 1 ] ; lli pre [ MAX + 1 ] ; void CountTotalfactors ( ) { tfactor [ 1 ] = pre [ 1 ] = 1 ; for ( lli i = 2 ; i <= MAX ; i ++ ) { lli mspf = spf [ i ] ; lli prim = mspf ; lli temp = i ; lli cnt = 0 ; while ( temp % mspf == 0 ) { temp /= mspf ; cnt += 1 ; prim = prim * mspf ; } tfactor [ i ] = ( cnt + 1 ) * tfactor [ temp ] ; pre [ i ] = pre [ i - 1 ] + tfactor [ i ] ; } } lli BinarySearch ( lli X ) { lli start = 1 ; lli end = MAX - 1 ; while ( start < end ) { lli mid = ( start + end ) / 2 ; if ( pre [ mid ] == X ) return mid ; else if ( pre [ mid ] < X ) start = mid + 1 ; else end = mid ; } return start ; } void findSumOfCount ( int X ) { calculate_SPF ( ) ; CountTotalfactors ( ) ; cout << BinarySearch ( X ) << endl ; } int main ( ) { int X = 10 ; findSumOfCount ( X ) ; return 0 ; }

Index/key variables: i, j, mid, temp
Accumulator variables: cnt, i, j, stdc, temp
Iterator variables: i, j
C++ program:
#include <bits/stdc++.h>
using namespace std ; vector < bool > prime ; void buildSieve ( int sum ) { prime = vector < bool > ( sum + 1 , true ) ; prime [ 0 ] = false ; prime [ 1 ] = false ; for ( int p = 2 ; p * p < ( sum + 1 ) ; p ++ ) { if ( prime [ p ] == true ) { for ( int i = p * 2 ; i < ( sum + 1 ) ; i += p ) prime [ i ] = false ; } } } int getSum ( int a [ 4 ] [ 5 ] ) { int s = 0 ; for ( int i = 0 ; i < 4 ; i ++ ) for ( int j = 0 ; j < 5 ; j ++ ) s += a [ i ] [ j ] ; return s ; } bool checkIndex ( int n , int m , int a [ 4 ] [ 5 ] ) { for ( int i = 0 ; i < n ; i ++ ) for ( int j = 0 ; j < m ; j ++ ) { if ( prime [ i + j ] && ! prime [ a [ i ] [ j ] ] ) { return false ; } } return true ; } int main ( ) { int n = 4 , m = 5 ; int a [ 4 ] [ 5 ] = { { 1 , 2 , 3 , 2 , 2 } , { 2 , 2 , 7 , 7 , 7 } , { 7 , 7 , 21 , 7 , 10 } , { 2 , 2 , 3 , 6 , 7 } } ; int sum = getSum ( a ) ; buildSieve ( sum ) ; if ( prime [ sum ] && checkIndex ( n , m , a ) ) { cout << " YES " << endl ; } else cout << " NO " << endl ; return 0 ; }

Index/key variables: i, j, p, sum
Accumulator variables: i, j, p, s, stdc
Iterator variables: i, j, p
C++ program:
#include <bits/stdc++.h>
using namespace std ; #define ll  long long
#define mod  1000000007
#define pb  push_back
#define mod  1000000007
#define vi  vector<int>
vi lis [ 100001 ] ; vi primes ; int vis [ 100001 ] ; int dis [ 100001 ] ; bool isPrime ( int n ) { for ( int i = 2 ; i * i <= n ; i ++ ) { if ( n % i == 0 ) return false ; } return true ; } bool valid ( int a , int b ) { int c = 0 ; while ( a ) { if ( ( a % 10 ) != ( b % 10 ) ) { c ++ ; } a = a / 10 ; b = b / 10 ; } if ( c == 1 ) { return true ; } else { return false ; } } void makePrimes ( int N ) { int i , j ; int L = pow ( 10 , N - 1 ) ; int R = pow ( 10 , N ) - 1 ; for ( int i = L ; i <= R ; i ++ ) { if ( isPrime ( i ) ) { primes . pb ( i ) ; } } for ( i = 0 ; i < primes . size ( ) ; i ++ ) { for ( j = i + 1 ; j < primes . size ( ) ; j ++ ) { int a = primes [ i ] ; int b = primes [ j ] ; if ( valid ( a , b ) ) { lis [ a ] . pb ( b ) ; lis [ b ] . pb ( a ) ; } } } } void bfs ( int src ) { queue < int > q ; q . push ( src ) ; vis [ src ] = 1 ; dis [ src ] = 0 ; while ( ! q . empty ( ) ) { int curr = q . front ( ) ; q . pop ( ) ; for ( int x : lis [ curr ] ) { if ( vis [ x ] == 0 ) { vis [ x ] = 1 ; q . push ( x ) ; dis [ x ] = dis [ curr ] + 1 ; } } } } int main ( ) { int N = 4 ; makePrimes ( N ) ; int A = 1033 , B = 8179 ; bfs ( A ) ; if ( dis [ B ] == -1 ) cout << " - 1" << endl ; else cout << dis [ B ] << endl ; return 0 ; }

Index/key variables: B, a, b, curr, i, j, src, x
Accumulator variables: c, i, j, stdc
Iterator variables: i, j, x
C++ program:
#include <bits/stdc++.h>
using namespace std ; int placeValue ( int N , int num ) { int total = 1 , value = 0 , rem = 0 ; while ( true ) { rem = N % 10 ; N = N / 10 ; if ( rem == num ) { value = total * rem ; break ; } total = total * 10 ; } return value ; } int main ( ) { int D = 5 ; int N = 85932 ; cout << ( placeValue ( N , D ) ) ; }

Accumulator variables: stdc
C++ program:
#include <bits/stdc++.h>
using namespace std ; void BeattySequence ( int n ) { for ( int i = 1 ; i <= n ; i ++ ) { double ans = floor ( i * sqrt ( 2 ) ) ; cout << ans << " , ▁ " ; } } int main ( ) { int n = 5 ; BeattySequence ( n ) ; return 0 ; }

Accumulator variables: i, stdc
Iterator variables: i
C++ program:
#include <bits/stdc++.h>
using namespace std ; int getSum ( int n ) { int sum = 0 ; for ( int i = 1 ; i <= sqrt ( n ) ; i ++ ) { if ( n % i == 0 ) { if ( n / i == i ) sum = sum + i ; { sum = sum + i ; sum = sum + ( n / i ) ; } } } return sum ; } bool checkAbundant ( int n ) { return ( getSum ( n ) - n > n ) ; } bool isDeficient ( int n ) { return ( getSum ( n ) < ( 2 * n ) ) ; } bool checkPrimitiveAbundant ( int num ) { if ( ! checkAbundant ( num ) ) { return false ; } for ( int i = 2 ; i <= sqrt ( num ) ; i ++ ) { if ( num % i == 0 && i != num ) { if ( i * i == num ) { if ( ! isDeficient ( i ) ) { return false ; } } else if ( ! isDeficient ( i ) || ! isDeficient ( num / i ) ) { return false ; } } } return true ; } int main ( ) { int n = 20 ; if ( checkPrimitiveAbundant ( n ) ) { cout << " Yes " ; } else { cout << " No " ; } return 0 ; }

Accumulator variables: i, stdc
Iterator variables: i
C++ program:
#include <bits/stdc++.h>
using namespace std ; int calculateSum ( int N ) { return N * ( N - 1 ) / 2 + N * ( N - 1 ) * ( 2 * N - 1 ) / 6 ; } int main ( ) { int N = 3 ; cout << calculateSum ( N ) ; return 0 ; }

Accumulator variables: stdc
C++ program:
#include <bits/stdc++.h>
using namespace std ; int divSum ( int num ) { int result = 0 ; for ( int i = 1 ; i <= sqrt ( num ) ; i ++ ) { if ( num % i == 0 ) { if ( i == ( num / i ) ) result += i ; else result += ( i + num / i ) ; } } return ( result - 1 - num ) ; } int getSum ( int n ) { int sum = 0 ; while ( n != 0 ) { int r = n % 10 ; sum = sum + r * r ; n = n / 10 ; } return sum ; } bool isCanada ( int n ) { return divSum ( n ) == getSum ( n ) ; } int main ( ) { int n = 125 ; if ( isCanada ( 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 ; int getSum ( int n ) { int sum = 0 ; while ( n != 0 ) { sum = sum + n % 10 ; n = n / 10 ; } return sum ; } bool isSelfNum ( int n ) { for ( int m = 1 ; m <= n ; m ++ ) { if ( m + getSum ( m ) == n ) return false ; } return true ; } int main ( ) { int n = 20 ; if ( isSelfNum ( n ) ) { cout << " Yes " ; } else { cout << " No " ; } return 0 ; }

Accumulator variables: m, stdc
Iterator variables: m
C++ program:
#include <bits/stdc++.h>
using namespace std ; int binomialCoeff ( int n , int k ) { int C [ n + 1 ] [ k + 1 ] ; int i , j ; for ( i = 0 ; i <= n ; i ++ ) { for ( j = 0 ; j <= min ( i , k ) ; j ++ ) { if ( j == 0 j == i ) C [ i ] [ j ] = 1 ; else C [ i ] [ j ] = C [ i - 1 ] [ j - 1 ] + C [ i - 1 ] [ j ] ; } } return C [ n ] [ k ] ; } int main ( ) { int n = 3 ; int k = n ; n = 2 * n ; cout << binomialCoeff ( n , k ) ; }

Index/key variables: i, j, k, n
Accumulator variables: i, j, stdc
Iterator variables: i, j
C++ program:
#include <bits/stdc++.h>
using namespace std ; int getSum ( int n ) { int sum = 0 ; for ( int i = 1 ; i <= sqrt ( n ) ; i ++ ) { if ( n % i == 0 ) { if ( n / i == i ) sum = sum + i ; else { sum = sum + i ; sum = sum + ( n / i ) ; } } } return sum ; } bool MultiplyPerfectNumber ( int n ) { if ( getSum ( n ) % n == 0 ) return true ; else return false ; } int main ( ) { int n = 28 ; if ( MultiplyPerfectNumber ( n ) ) { cout << " Yes " ; } else { cout << " No " ; } return 0 ; }

Accumulator variables: i, stdc
Iterator variables: i
C++ program:
#include <bits/stdc++.h>
using namespace std ; int phi ( int n ) { int result = n ; for ( int p = 2 ; p * p <= n ; ++ p ) { if ( n % p == 0 ) { while ( n % p == 0 ) n /= p ; result -= result / p ; } } if ( n > 1 ) result -= result / n ; return result ; } int isPerfectTotientNum ( int n ) { int temp = n ; int sum = 0 ; while ( n > 1 ) { sum = sum + phi ( n ) ; n = phi ( n ) ; } if ( sum == temp ) return true ; return false ; } int main ( ) { int n = 9 ; if ( isPerfectTotientNum ( n ) ) cout << " Yes " ; else cout << " No " ; return 0 ; }

Accumulator variables: n, result, stdc
Iterator variables: p
C++ program:
#include <bits/stdc++.h>
using namespace std ; bool isPower ( int a ) { if ( a == 1 ) return true ; for ( int i = 2 ; i * i <= a ; i ++ ) { double val = log ( a ) / log ( i ) ; if ( ( val - ( int ) val ) < 0.00000001 ) return true ; } return false ; } bool isCunningham ( int n ) { return isPower ( n - 1 ) || isPower ( n + 1 ) ; } int main ( ) { int n = 126 ; if ( isCunningham ( n ) ) cout << " Yes " ; else cout << " No " ; return 0 ; }

Accumulator variables: i, stdc
Iterator variables: i
C++ program:
#include <bits/stdc++.h>
using namespace std ; long int SubArrayProdct ( int arr [ ] , int n ) { long int result = 1 ; for ( int i = 0 ; i < n ; i ++ ) result *= pow ( arr [ i ] , ( i + 1 ) * ( n - i ) ) ; return result ; } int main ( ) { int arr [ ] = { 2 , 4 } ; int N = sizeof ( arr ) / sizeof ( arr [ 0 ] ) ; cout << SubArrayProdct ( arr , N ) << endl ; return 0 ; }

Index/key variables: i
Accumulator variables: i, result, stdc
Iterator variables: i
C++ program:
#include <bits/stdc++.h>
using namespace std ; int fact ( int n ) ; int nCr ( int n , int r ) { return fact ( n ) / ( fact ( r ) * fact ( n - r ) ) ; } int fact ( int n ) { int res = 1 ; for ( int i = 2 ; i <= n ; i ++ ) res = res * i ; return res ; } int countWays ( int m , int n , int x , int y ) { return nCr ( m + n , m ) - nCr ( x + y , x ) * nCr ( m + n - x - y , m - x ) ; } int main ( ) { int m = 5 ; int n = 4 ; int x = 3 ; int y = 2 ; cout << countWays ( m , n , x , y ) ; return 0 ; }

Accumulator variables: i, stdc
Iterator variables: i
C++ program:
#include <bits/stdc++.h>
using namespace std ; int CountGreater ( int n , int k ) { int a = 0 ; while ( n ) { if ( ( n % 10 ) > k ) { a ++ ; } n = n / 10 ; } return a ; } int PrintList ( list < int > ans ) { for ( auto it = ans . begin ( ) ; it != ans . end ( ) ; it ++ ) cout << * it ; } void getNumber ( int n , int k ) { int count = CountGreater ( n , k ) ; if ( count == 0 ) { cout << n ; return ; } list < int > ans ; bool changed = false ; while ( n > 0 ) { int digit = n % 10 ; if ( changed == true ) { ans . push_front ( digit ) ; } else { if ( count == 0 && digit < k ) { ans . push_front ( digit + 1 ) ; changed = true ; } else { ans . push_front ( 1 ) ; if ( digit > k ) { count -- ; } } } n = n / 10 ; } if ( changed == false ) { ans . push_front ( 1 ) ; } PrintList ( ans ) ; return ; } int main ( ) { int N = 51234 ; int K = 4 ; getNumber ( N , K ) ; return 0 ; }

Accumulator variables: a, count, it, stdc
Iterator variables: it
Boolean variables: changed
C++ program:
#include <bits/stdc++.h>
using namespace std ; double averageRuns ( int runs , int matches , int notout ) { int out = matches - notout ; if ( out == 0 ) return -1 ; double avg = double ( runs ) / out ; return avg ; } int main ( ) { int runs = 10000 ; int matches = 250 ; int notout = 50 ; double avg = averageRuns ( runs , matches , notout ) ; if ( avg == -1 ) cout << " NA " ; else cout << avg ; return 0 ; }

Accumulator variables: stdc
C++ program:
#include <bits/stdc++.h>
using namespace std ; int seriesSumUtil ( int k , int n , int prevSum , int multi , int add ) { if ( k == n + 1 ) { return prevSum ; } multi = multi * k ; add = add + k ; prevSum = prevSum + multi - add ; return seriesSumUtil ( k + 1 , n , prevSum , multi , add ) ; } int seriesSum ( int n ) { if ( n == 1 ) return 0 ; int prevSum = 0 ; int multi = 1 ; int add = 1 ; return seriesSumUtil ( 2 , n , prevSum , multi , add ) ; } int main ( ) { int N = 5 ; cout << seriesSum ( N ) << " ▁ " ; }

Accumulator variables: stdc
C++ program:
#include <bits/stdc++.h>
using namespace std ; typedef long long int ll ; void solve ( ll N ) { ll ans = 0 ; while ( N != 0 ) { ans += N ; N /= 2 ; } cout << ans << endl ; } int main ( ) { ll N = 5 ; solve ( N ) ; return 0 ; }

Accumulator variables: N, ans, stdc
C++ program:
#include <bits/stdc++.h>
using namespace std ; int maximumAND ( int L , int R ) { return R ; } int main ( ) { int l = 3 ; int r = 7 ; cout << maximumAND ( l , r ) ; return 0 ; }

Accumulator variables: stdc
C++ program:
#include <bits/stdc++.h>
using namespace std ; bool oddSum ( vector < int > & A , int N , int K ) { set < int > Odd ; set < int > Even ; for ( int i = 0 ; i < N ; i ++ ) { if ( A [ i ] % 2 == 0 ) { Even . insert ( A [ i ] ) ; } else { Odd . insert ( A [ i ] ) ; } } if ( Odd . size ( ) >= K ) return true ; bool flag = false ; for ( int i = 1 ; i < K ; i += 2 ) { int needed = K - i ; if ( needed <= Even . size ( ) ) { return true ; } } return flag ; } int main ( ) { int K = 5 ; vector < int > A = { 12 , 1 , 7 , 7 , 26 , 18 } ; int N = 3 ; if ( oddSum ( A , N , K ) ) cout << " YES " ; else cout << " NO " ; return 0 ; }

Index/key variables: i
Accumulator variables: i, stdc
Iterator variables: i
Boolean variables: flag
C++ program:
#include <bits/stdc++.h>
using namespace std ; int countEle ( int a [ ] , int n ) { int len = 0 ; unordered_map < int , int > hmap ; for ( int i = 0 ; i < n ; i ++ ) { len = max ( len , a [ i ] ) ; hmap [ a [ i ] ] ++ ; } bool v [ len + 1 ] ; for ( int i = 0 ; i <= len ; i ++ ) { v [ i ] = true ; } for ( int i = 0 ; i < n ; i ++ ) { if ( v [ a [ i ] ] == false ) continue ; for ( int j = 2 * a [ i ] ; j <= len ; j += a [ i ] ) { v [ j ] = false ; } } int count = 0 ; for ( int i = 1 ; i <= len ; i ++ ) { if ( v [ i ] == true && hmap . count ( i ) == 1 && hmap [ i ] == 1 ) { count += 1 ; } } return count ; } int main ( ) { int arr [ ] = { 86 , 45 , 18 , 4 , 8 , 28 , 19 , 33 , 2 } ; int n = sizeof ( arr ) / sizeof ( int ) ; cout << countEle ( arr , n ) ; return 0 ; }

Index/key variables: i, j
Accumulator variables: count, i, j, stdc
Iterator variables: i, j
C++ program:
#include <iostream>
#include <math.h>
using namespace std ; void smallestNumber ( int N ) { int L = pow ( 10 , N ) - 1 ; int S = pow ( 10 , N - 1 ) ; for ( int i = S ; i <= L ; i ++ ) { if ( i % N == 0 ) { cout << i ; return ; } } } int main ( ) { int N = 2 ; smallestNumber ( N ) ; return 0 ; }

Accumulator variables: i
Iterator variables: i
C++ program:
#include <bits/stdc++.h>
using namespace std ; int maxPrimefactorNum ( int N ) { int arr [ N + 1 ] ; for ( int i = 0 ; i < N + 1 ; i ++ ) arr [ i ] = 1 ; for ( int i = 2 ; i <= N ; i ++ ) { if ( arr [ i ] == 1 ) { for ( int j = i ; j <= N ; j += i ) { arr [ j ] *= i ; } } } int maxValue = 1 ; for ( int i = 2 ; i <= N ; i ++ ) { if ( arr [ i ] > maxValue ) { maxValue = i ; } } return maxValue ; } int main ( ) { int N = 20 ; cout << maxPrimefactorNum ( N ) ; return 0 ; }

Index/key variables: i, j
Accumulator variables: i, j, stdc
Iterator variables: i, j
C++ program:
#include <iostream>
#include <unordered_map>
#include <vector>
using namespace std ; void spf_array ( int spf [ ] ) { spf [ 1 ] = 1 ; for ( int i = 2 ; i < 1000 ; i ++ ) spf [ i ] = i ; for ( int i = 4 ; i < 1000 ; i += 2 ) spf [ i ] = 2 ; for ( int i = 3 ; i * i < 1000 ; i ++ ) { if ( spf [ i ] == i ) { for ( int j = i * i ; j < 1000 ; j += i ) if ( spf [ j ] == j ) spf [ j ] = i ; } } } int minimum_operation ( int b [ ] , int d , int spf [ ] ) { unordered_map < int , int > m ; int i = 0 ; int c = 0 ; for ( i = 0 ; i < d ; i ++ ) { int x = b [ i ] ; while ( x != 1 ) { x = x / spf [ x ] ; if ( m [ spf [ x ] ] == 0 ) { m [ spf [ x ] ] = 1 ; } } } m . erase ( 1 ) ; for ( auto x : m ) { int e = 0 , o = 0 ; int j = x . first ; for ( i = 0 ; i < d ; i ++ ) { if ( b [ i ] % j == 0 ) { int h = 0 ; int g = b [ i ] ; while ( g != 0 ) { if ( g % j != 0 ) { break ; } g = g / j ; h = h + 1 ; } if ( h % 2 == 0 ) { e = e + 1 ; } else { o = o + 1 ; } } else { e = e + 1 ; } } c = c + min ( o , e ) ; } return c ; } int main ( ) { int spf [ 1001 ] ; int b [ ] = { 1 , 4 , 6 } ; int d = sizeof ( b ) / sizeof ( b [ 0 ] ) ; spf_array ( spf ) ; cout << minimum_operation ( b , d , spf ) << endl ; }

Index/key variables: i, j, x
Accumulator variables: i, j
Iterator variables: i, j, x
C++ program:
#include <bits/stdc++.h>
using namespace std ; int getProduct ( int n ) { int product = 1 ; while ( n != 0 ) { product = product * ( n % 10 ) ; n = n / 10 ; } return product ; } bool isZuckerman ( int n ) { return n % getProduct ( n ) == 0 ; } int main ( ) { int n = 115 ; if ( isZuckerman ( n ) ) cout << " Yes " ; else cout << " No " ; return 0 ; }

Accumulator variables: stdc
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 ; } int getSum ( int n ) { int sum = 0 ; while ( n != 0 ) { sum = sum + n % 10 ; n = n / 10 ; } return sum ; } bool isAdditivePrime ( int n ) { if ( ! isPrime ( n ) ) return false ; return isPrime ( getSum ( n ) ) ; } int main ( ) { int N = 23 ; if ( isAdditivePrime ( N ) ) cout << " Yes " ; else cout << " No " ; }

Accumulator variables: stdc
Iterator variables: i
C++ program:
#include <bits/stdc++.h>
using namespace std ; bool isStraighLineNum ( int N ) { if ( N <= 99 ) return false ; string str = to_string ( N ) ; int d = str [ 1 ] - str [ 0 ] ; for ( int i = 2 ; i < str . length ( ) ; i ++ ) if ( str [ i ] - str [ i - 1 ] != d ) return false ; return true ; } int main ( ) { int N = 135 ; if ( isStraighLineNum ( n ) ) cout << " Yes " ; else cout << " No " ; }

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