dhyuti-n/xlcost-variable-roles huggingface dataset:
C++ program:
#include <bits/stdc++.h>
using namespace std ; bool divisibleBy3 ( string number ) { int sumOfDigit = 0 ; for ( int i = 0 ; i < number . length ( ) ; i ++ ) sumOfDigit += number [ i ] - '0' ; if ( sumOfDigit % 3 == 0 ) return true ; return false ; } bool divisibleBy25 ( string number ) { if ( number . length ( ) < 2 ) return false ; int length = number . length ( ) ; int lastTwo = ( number [ length - 2 ] - '0' ) * 10 + ( number [ length - 1 ] - '0' ) ; if ( lastTwo % 25 == 0 ) return true ; return false ; } bool divisibleBy75 ( string number ) { if ( divisibleBy3 ( number ) && divisibleBy25 ( number ) ) return true ; return false ; } int main ( ) { string number = "754586672150" ; bool divisible = divisibleBy75 ( number ) ; if ( divisible ) cout << " Yes " ; else cout << " No " ; return 0 ; }

Index/key variables: i
Accumulator variables: i, stdc, sumOfDigit
Iterator variables: i
C++ program:
#include <bits/stdc++.h>
using namespace std ; int otherNumber ( int A , int Lcm , int Hcf ) { return ( Lcm * Hcf ) / A ; } int main ( ) { int A = 8 , Lcm = 8 , Hcf = 1 ; int result = otherNumber ( A , Lcm , Hcf ) ; cout << " B ▁ = ▁ " << result ; return 0 ; }

Accumulator variables: stdc
C++ program:
#include <bits/stdc++.h>
using namespace std ; float successiveChange ( int arr [ ] , int N ) { float var1 , var2 , result = 0 ; var1 = arr [ 0 ] ; var2 = arr [ 1 ] ; result = var1 + var2 + ( float ( var1 * var2 ) / 100 ) ; for ( int i = 2 ; i < N ; i ++ ) result = result + arr [ i ] + ( float ( result * arr [ i ] ) / 100 ) ; return result ; } int main ( ) { int arr [ ] = { 10 , 20 , 30 , 10 } ; int N = sizeof ( arr ) / sizeof ( arr [ 0 ] ) ; float result = successiveChange ( arr , N ) ; cout << " Percentage ▁ change ▁ is ▁ = ▁ " << result << " ▁ % " ; return 0 ; }

Index/key variables: i
Accumulator variables: i, stdc
Iterator variables: i
C++ program:
#include <bits/stdc++.h>
using namespace std ; int minimumNumbers ( int n , int s ) { if ( s % n ) return s / n + 1 ; else return s / n ; } int main ( ) { int n = 5 ; int s = 11 ; cout << minimumNumbers ( n , s ) ; return 0 ; }

Accumulator variables: stdc
C++ program:
#include <bits/stdc++.h>
using namespace std ; #define ll  long long int
ll sumAP ( ll n , ll d ) { n /= d ; return ( n ) * ( 1 + n ) * d / 2 ; } ll sumMultiples ( ll A , ll B , ll n ) { n -- ; ll common = ( A * B ) / __gcd ( A , B ) ; return sumAP ( n , A ) + sumAP ( n , B ) - sumAP ( n , common ) ; } int main ( ) { ll n = 100 , A = 5 , B = 10 ; cout << " Sum ▁ = ▁ " << sumMultiples ( A , B , n ) ; return 0 ; }

Accumulator variables: n, stdc
C++ program:
#include <bits/stdc++.h>
using namespace std ; bool isPrime ( int n ) { if ( n <= 1 ) return false ; for ( int i = 2 ; i <= sqrt ( n ) ; i ++ ) { if ( n % i == 0 ) return false ; } return true ; } bool isPossible ( int N ) { if ( isPrime ( N ) && isPrime ( N - 2 ) ) return true ; else return false ; } int main ( ) { int n = 13 ; if ( isPossible ( 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 totalPairs ( int arr1 [ ] , int arr2 [ ] , int K , int n , int m ) { set < pair < int , int > > s ; for ( int i = 0 ; i < n ; i ++ ) { for ( int j = 0 ; j < m ; j ++ ) { if ( arr1 [ i ] > arr2 [ j ] ) { if ( arr1 [ i ] % arr2 [ j ] == K ) s . insert ( make_pair ( arr1 [ i ] , arr2 [ j ] ) ) ; } else { if ( arr2 [ j ] % arr1 [ i ] == K ) s . insert ( make_pair ( arr2 [ j ] , arr1 [ i ] ) ) ; } } } return s . size ( ) ; } int main ( ) { int arr1 [ ] = { 8 , 3 , 7 , 50 } ; int arr2 [ ] = { 5 , 1 , 10 , 4 } ; int K = 3 ; int n = sizeof ( arr1 ) / sizeof ( arr1 [ 0 ] ) ; int m = sizeof ( arr2 ) / sizeof ( arr2 [ 0 ] ) ; cout << totalPairs ( arr1 , arr2 , K , n , m ) ; 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 ; int contiguousPerfectSquare ( int arr [ ] , int n ) { int a ; float b ; int current_length = 0 ; int max_length = 0 ; for ( int i = 0 ; i < n ; i ++ ) { b = sqrt ( arr [ i ] ) ; a = b ; if ( a == b ) current_length ++ ; else current_length = 0 ; max_length = max ( max_length , current_length ) ; } return max_length ; } int main ( ) { int arr [ ] = { 9 , 75 , 4 , 64 , 121 , 25 } ; int n = sizeof ( arr ) / sizeof ( arr [ 0 ] ) ; cout << contiguousPerfectSquare ( arr , n ) ; return 0 ; }

Index/key variables: i
Accumulator variables: current_length, i, stdc
Iterator variables: i
C++ program:
#include <bits/stdc++.h>
using namespace std ; int countPairs ( int n ) { int count = 0 ; for ( int x = 1 ; x < n ; x ++ ) { for ( int y = x + 1 ; y <= n ; y ++ ) { if ( ( y * x ) % ( y + x ) == 0 ) count ++ ; } } return count ; } int main ( ) { int n = 15 ; cout << countPairs ( n ) ; return 0 ; }

Accumulator variables: count, stdc, x, y
Iterator variables: x, y
C++ program:
#include <bits/stdc++.h>
using namespace std ; int getIndex ( int a [ ] , int n ) { if ( n == 1 ) return 0 ; int ptrL = 0 , ptrR = n - 1 , sumL = a [ 0 ] , sumR = a [ n - 1 ] ; while ( ptrR - ptrL > 1 ) { if ( sumL < sumR ) { ptrL ++ ; sumL += a [ ptrL ] ; } else if ( sumL > sumR ) { ptrR -- ; sumR += a [ ptrR ] ; } else { break ; } } return ptrL ; } int main ( ) { int a [ ] = { 2 , 7 , 9 , 8 , 7 } ; int n = sizeof ( a ) / sizeof ( a [ 0 ] ) ; cout << getIndex ( a , n ) ; return 0 ; }

Index/key variables: ptrL, ptrR
Accumulator variables: ptrL, ptrR, stdc, sumL, sumR
C++ program:
#include <bits/stdc++.h>
using namespace std ; int getPosition ( int a [ ] , int n , int m ) { for ( int i = 0 ; i < n ; i ++ ) { a [ i ] = ( a [ i ] / m + ( a [ i ] % m != 0 ) ) ; } int ans = -1 , max = -1 ; for ( int i = n - 1 ; i >= 0 ; i -- ) { if ( max < a [ i ] ) { max = a [ i ] ; ans = i ; } } return ans + 1 ; } int main ( ) { int a [ ] = { 2 , 5 , 4 } ; int n = sizeof ( a ) / sizeof ( a [ 0 ] ) ; int m = 2 ; cout << getPosition ( a , n , m ) ; return 0 ; }

Index/key variables: i
Accumulator variables: i, stdc
Iterator variables: i
C++ program:
#include <bits/stdc++.h>
using namespace std ; int calcFunction ( int n , int r ) { int finalDenominator = 1 ; int mx = max ( r , n - r ) ; for ( int i = mx + 1 ; i <= n ; i ++ ) { int denominator = ( int ) pow ( i , i ) ; int numerator = ( int ) pow ( i - mx , i - mx ) ; finalDenominator = ( finalDenominator * denominator ) / numerator ; } return finalDenominator ; } int main ( ) { int n = 6 , r = 2 ; cout << "1 / " << calcFunction ( n , r ) << endl ; return 0 ; }

Accumulator variables: i, stdc
Iterator variables: i
C++ program:
#include <bits/stdc++.h>
using namespace std ; bool isExists ( int a [ ] , int n ) { unordered_map < int , int > freq ; int sum = 0 ; for ( int i = 0 ; i < n ; i ++ ) { freq [ a [ i ] ] ++ ; sum += a [ i ] ; } if ( sum % 2 == 0 ) { if ( freq [ sum / 2 ] ) return true ; } return false ; } int main ( ) { int a [ ] = { 5 , 1 , 2 , 2 } ; int n = sizeof ( a ) / sizeof ( a [ 0 ] ) ; if ( isExists ( a , n ) ) cout << " Yes " ; else cout << " No " ; return 0 ; }

Index/key variables: i
Accumulator variables: i, stdc, sum
Iterator variables: i
C++ program:
#include <bits/stdc++.h>
using namespace std ; set < int > st ; void generateNumbers ( int n , int num , int a , int b ) { if ( num > 0 && num < n ) st . insert ( num ) ; if ( num >= n ) return ; if ( num * 10 + a > num ) generateNumbers ( n , num * 10 + a , a , b ) ; generateNumbers ( n , num * 10 + b , a , b ) ; } void printNumbers ( int n ) { for ( int i = 0 ; i <= 9 ; i ++ ) for ( int j = i + 1 ; j <= 9 ; j ++ ) generateNumbers ( n , 0 , i , j ) ; cout << " The ▁ numbers ▁ are : ▁ " ; while ( ! st . empty ( ) ) { cout << * st . begin ( ) << " ▁ " ; st . erase ( st . begin ( ) ) ; } } int main ( ) { int n = 12 ; printNumbers ( n ) ; return 0 ; }

Accumulator variables: i, j, stdc
Iterator variables: i, j
C++ program:
#include <bits/stdc++.h>
using namespace std ; #define ll  long long int
vector < ll > findPrime ( int MAX ) { bool pm [ MAX + 1 ] ; memset ( pm , true , sizeof ( pm ) ) ; pm [ 0 ] = pm [ 1 ] = false ; for ( int i = 2 ; i <= MAX ; i ++ ) if ( pm [ i ] ) for ( int j = 2 * i ; j <= MAX ; j += i ) pm [ j ] = false ; vector < ll > prime ; for ( int i = 0 ; i <= MAX ; i ++ ) if ( pm [ i ] ) prime . push_back ( i ) ; return prime ; } int findSmallest ( int arr [ ] , int n ) { int MAX = * max_element ( arr , arr + n ) ; vector < ll > prime = findPrime ( MAX ) ; unordered_set < int > s ; for ( int i = 0 ; i < n ; i ++ ) s . insert ( arr [ i ] ) ; int ans = -1 ; for ( int i = 0 ; i < prime . size ( ) ; i ++ ) if ( s . find ( prime [ i ] ) == s . end ( ) ) { ans = prime [ i ] ; break ; } return ans ; } int main ( ) { int arr [ ] = { 3 , 0 , 1 , 2 , 7 } ; int n = sizeof ( arr ) / sizeof ( arr [ 0 ] ) ; if ( findSmallest ( arr , n ) == -1 ) cout << " No ▁ prime ▁ number ▁ missing " ; else cout << findSmallest ( arr , n ) ; 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 ; int findNum ( int div [ ] , int rem [ ] , int N ) { int num = rem [ N - 1 ] ; for ( int i = N - 2 ; i >= 0 ; i -- ) { num = num * div [ i ] + rem [ i ] ; } return num ; } int main ( ) { int div [ ] = { 8 , 3 } ; int rem [ ] = { 2 , 2 } ; int N = sizeof ( div ) / sizeof ( div [ 0 ] ) ; cout << findNum ( div , rem , N ) ; return 0 ; }

Index/key variables: i
Accumulator variables: i, stdc
Iterator variables: i
C++ program:
#include <bits/stdc++.h>
#define mp  make_pair
#define pb  push_back
#define S  second
#define ll  long long
using namespace std ; const int mod = 1000000007 ; const int MAX = 100000 ; ll ways [ MAX + 1 ] ; void preCompute ( ) { ways [ 0 ] = 1LL ; ways [ 2 ] = 1LL ; for ( int i = 4 ; i <= MAX ; i += 2 ) { ways [ i ] = ( 1LL * ( i - 1 ) * ways [ i - 2 ] ) % mod ; } } void countWays ( int * arr , int n ) { map < int , int > count ; for ( int i = 0 ; i < n ; i ++ ) count [ arr [ i ] ] ++ ; vector < pair < int , int > > count_vector ; map < int , int > :: iterator it ; for ( it = count . begin ( ) ; it != count . end ( ) ; it ++ ) { count_vector . pb ( mp ( it -> first , it -> second ) ) ; } sort ( count_vector . begin ( ) , count_vector . end ( ) ) ; ll ans = 1 ; for ( int i = count_vector . size ( ) - 1 ; i > 0 ; i -- ) { int current_count = count_vector [ i ] . S ; int prev_count = count_vector [ i - 1 ] . S ; if ( current_count & 1 ) { ans = ( ans * ways [ current_count - 1 ] ) % mod ; ans = ( ans * current_count ) % mod ; ans = ( ans * prev_count ) % mod ; if ( prev_count & 1 ) { ans = ( ans * ways [ prev_count - 1 ] ) % mod ; count_vector [ i - 1 ] . S = 0 ; } else { count_vector [ i - 1 ] . S -- ; } } else { ans = ( ans * ways [ current_count ] ) % mod ; } } ans = ( ans * ways [ count_vector [ 0 ] . S ] ) % mod ; cout << ans << " STRNEWLINE " ; } int main ( ) { preCompute ( ) ; int arr [ ] = { 2 , 3 , 3 , 3 , 3 , 4 , 4 , 4 , 4 , 4 } ; int n = sizeof ( arr ) / sizeof ( arr [ 0 ] ) ; countWays ( arr , n ) ; return 0 ; }

Index/key variables: current_count, i
Accumulator variables: S, i, it, stdc
Iterator variables: i, it
C++ program:
#include <bits/stdc++.h>
using namespace std ; void profitLoss ( int N , int M ) { if ( N == M ) cout << " No ▁ Profit ▁ nor ▁ Loss " ; else { float result = 0.0 ; result = float ( abs ( N - M ) ) / M ; if ( N - M < 0 ) cout << " Loss ▁ = ▁ - " << result * 100 << " % " ; else cout << " Profit ▁ = ▁ " << result * 100 << " % " ; } } int main ( ) { int N = 8 , M = 9 ; profitLoss ( N , M ) ; return 0 ; }

Accumulator variables: stdc
C++ program:
#include <bits/stdc++.h>
using namespace std ; string convert_to_words ( string num ) { int len = num . length ( ) ; if ( len == 0 len > 4 ) { return " " ; } string single_digits_temp [ ] = { " " , " one " , " two " , " three " , " four " , " five " , " six " , " seven " , " eight " , " nine " } ; string single_digits [ ] = { " " , " first " , " second " , " third " , " fourth " , " fifth " , " sixth " , " seventh " , " eighth " , " ninth " } ; string two_digits [ ] = { " " , " tenth " , " eleventh " , " twelfth " , " thirteenth " , " fourteenth " , " fifteenth " , " sixteenth " , " seventeenth " , " eighteenth " , " nineteenth " } ; string tens_multiple [ ] = { " " , " tenth " , " twentieth " , " thirtieth " , " fortieth " , " fiftieth " , " sixtieth " , " seventieth " , " eightieth " , " ninetieth " } ; string tens_power [ ] = { " hundred " , " thousand " } ; string word = " " ; if ( len == 1 ) { word += single_digits [ num [ 0 ] - '0' ] ; return word ; } int i = 0 , ctr = 0 ; string s = " ▁ " ; while ( i < len ) { if ( len >= 3 ) { if ( num [ i ] != '0' ) { word += single_digits_temp [ num [ i ] - '0' ] + " ▁ " ; word += tens_power [ len - 3 ] + " ▁ " ; ctr ++ ; } len -- ; num . erase ( 0 , 1 ) ; } else { if ( ctr != 0 ) { s = " ▁ and ▁ " ; word . erase ( word . length ( ) - 1 ) ; } if ( num [ i + 1 ] == '0' ) if ( num [ i ] == '0' ) word = word + " th " ; else word += s + tens_multiple [ num [ i ] - '0' ] ; else if ( num [ i ] == '1' ) word += s + two_digits [ num [ i + 1 ] - '0' + 1 ] ; else { if ( num [ i ] != '0' ) word += s + tens_multiple [ num [ i ] - '0' ] . substr ( 0 , tens_multiple [ num [ i ] - '0' ] . length ( ) - 4 ) + " y ▁ " ; else word += s ; word += single_digits [ num [ i + 1 ] - '0' ] ; } i += 2 ; } if ( i == len ) { if ( word [ 0 ] == ' ▁ ' ) word . erase ( 0 , 1 ) ; } } return word ; } void Aronsons_sequence ( int n ) { string str = " T ▁ is ▁ the ▁ " ; int ind = 0 ; for ( int i = 0 ; i < str . length ( ) ; i ++ ) { if ( isalpha ( str [ i ] ) ) { ind += 1 ; } if ( str [ i ] == ' t ' or str [ i ] == ' T ' ) { n -= 1 ; str += convert_to_words ( to_string ( ind ) ) + " , ▁ " ; cout << ind << " , ▁ " ; } if ( n == 0 ) break ; } } int main ( void ) { int n = 6 ; Aronsons_sequence ( n ) ; return 0 ; }

Index/key variables: i
Accumulator variables: ctr, i, ind, len, n, stdc, str, word
Iterator variables: i
C++ program:
#include <bits/stdc++.h>
using namespace std ; void niceIndices ( int A [ ] , int n ) { int sum = 0 ; map < int , int > m ; for ( int i = 0 ; i < n ; ++ i ) { m [ A [ i ] ] ++ ; sum += A [ i ] ; } for ( int i = 0 ; i < n ; ++ i ) { int k = sum - A [ i ] ; if ( k % 2 == 0 ) { k = k >> 1 ; if ( m . find ( k ) != m . end ( ) ) { if ( ( A [ i ] == k && m [ k ] > 1 ) || ( A [ i ] != k ) ) cout << ( i + 1 ) << " ▁ " ; } } } } int main ( ) { int A [ ] = { 8 , 3 , 5 , 2 } ; int n = sizeof ( A ) / sizeof ( A [ 0 ] ) ; niceIndices ( A , n ) ; return 0 ; }

Index/key variables: i, k
Accumulator variables: stdc, sum
Iterator variables: i
C++ program:
#include <bits/stdc++.h>
using namespace std ; int countPieces ( int N ) { return 2 * N ; } int main ( ) { int N = 100 ; cout << countPieces ( N ) ; return 0 ; }

Accumulator variables: stdc
C++ program:
#include <bits/stdc++.h>
using namespace std ; long long sumAP ( long long n , long long d ) { n /= d ; return ( n ) * ( 1 + n ) * d / 2 ; } long long sumMultiples ( long long n ) { n -- ; return sumAP ( n , 3 ) + sumAP ( n , 7 ) - sumAP ( n , 21 ) ; } int main ( ) { long long n = 24 ; cout << sumMultiples ( n ) ; return 0 ; }

Accumulator variables: n, stdc
C++ program:
#include <bits/stdc++.h>
using namespace std ; bool productSumDivisible ( int n , int size ) { int sum = 0 , product = 1 ; while ( n > 0 ) { if ( size % 2 == 0 ) { product *= n % 10 ; } else { sum += n % 10 ; } n = n / 10 ; size -- ; } if ( product % sum == 0 ) return true ; return false ; } int main ( ) { int n = 1234 ; int len = 4 ; if ( productSumDivisible ( n , len ) ) cout << " TRUE " ; else cout << " FALSE " ; return 0 ; }

Accumulator variables: product, size, stdc, sum
C++ program:
#include <bits/stdc++.h>
using namespace std ; typedef long long int ll ; ll gcd ( ll a , ll b ) { if ( a == 0 ) return b ; return gcd ( b % a , a ) ; } ll powGCD ( ll a , ll n , ll b ) { for ( int i = 0 ; i < n ; i ++ ) a = a * a ; return gcd ( a , b ) ; } int main ( ) { ll a = 10 , b = 5 , n = 2 ; cout << powGCD ( a , n , b ) ; return 0 ; }

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

Accumulator variables: stdc
C++ program:
#include <bits/stdc++.h>
using namespace std ; int findNum ( int N , int K ) { int rem = ( N + K ) % K ; if ( rem == 0 ) return N ; else return N + K - rem ; } int main ( ) { int N = 45 , K = 6 ; cout << " Smallest ▁ number ▁ greater ▁ than ▁ or ▁ equal ▁ to ▁ " << N << " that is divisible by " ▁ < < ▁ K ▁ < < ▁ " is " return 0 ; }

Accumulator variables: stdc
C++ program:
#include <bits/stdc++.h>
using namespace std ; void countDigit ( int n ) { int temp = n , sum = 0 , product = 1 ; while ( temp != 0 ) { int d = temp % 10 ; temp /= 10 ; if ( d > 0 && n % d == 0 ) { sum += d ; product *= d ; } } cout << " Sum ▁ = ▁ " << sum ; cout << " Product = " } int main ( ) { int n = 1012 ; countDigit ( n ) ; return 0 ; }

Accumulator variables: product, stdc, sum, temp
C++ program:
#include <bits/stdc++.h>
using namespace std ; int findNum ( int N , int K ) { int rem = N % K ; if ( rem == 0 ) return N ; else return N - rem ; } int main ( ) { int N = 45 , K = 6 ; cout << " Largest ▁ number ▁ smaller ▁ than ▁ or ▁ equal ▁ to ▁ " << N << " that is divisible by " < < ▁ K ▁ < < ▁ " is " return 0 ; }

Accumulator variables: stdc
C++ program:
#include <bits/stdc++.h>
using namespace std ; bool isDivisiblePalindrome ( int n ) { int hash [ 10 ] = { 0 } ; int digitSum = 0 ; while ( n ) { digitSum += n % 10 ; hash [ n % 10 ] ++ ; n /= 10 ; } if ( digitSum % 3 != 0 ) return false ; int oddCount = 0 ; for ( int i = 0 ; i < 10 ; i ++ ) { if ( hash [ i ] % 2 != 0 ) oddCount ++ ; } if ( oddCount > 1 ) return false ; else return true ; } int main ( ) { int n = 34734 ; isDivisiblePalindrome ( n ) ? cout << " True " : cout << " False " ; return 0 ; }

Index/key variables: i
Accumulator variables: digitSum, i, n, oddCount, stdc
Iterator variables: i
C++ program:
#include <bits/stdc++.h>
using namespace std ; int lcm ( int a , int b ) { return ( a * b ) / ( __gcd ( a , b ) ) ; } int dfs ( int src , vector < int > adj [ ] , vector < bool > & visited ) { visited [ src ] = true ; int count = 1 ; for ( int i = 0 ; i < adj [ src ] . size ( ) ; i ++ ) if ( ! visited [ adj [ src ] [ i ] ] ) count += dfs ( adj [ src ] [ i ] , adj , visited ) ; return count ; } int findMinTime ( int arr [ ] , int P [ ] , int n ) { vector < int > adj [ n + 1 ] ; for ( int i = 0 ; i < n ; i ++ ) { adj [ arr [ i ] ] . push_back ( P [ i ] ) ; } vector < bool > visited ( n + 1 ) ; int ans = 1 ; for ( int i = 0 ; i < n ; i ++ ) { if ( ! visited [ i ] ) { ans = lcm ( ans , dfs ( i , adj , visited ) ) ; } } return ans ; } int main ( ) { int arr [ ] = { 1 , 2 , 3 } ; int P [ ] = { 3 , 2 , 1 } ; int n = sizeof ( arr ) / sizeof ( arr [ 0 ] ) ; cout << findMinTime ( arr , P , n ) ; return 0 ; }

Index/key variables: i, src
Accumulator variables: count, i, stdc
Iterator variables: i
C++ program:
#include <bits/stdc++.h>
using namespace std ; bool productDivisible ( int n , int k ) { int product = 1 , position = 1 ; while ( n > 0 ) { if ( position % 2 == 0 ) product *= n % 10 ; n = n / 10 ; position ++ ; } if ( product % k == 0 ) return true ; return false ; } int main ( ) { int n = 321922 ; int k = 3 ; if ( productDivisible ( n , k ) ) cout << " YES " ; else cout << " NO " ; return 0 ; }

Accumulator variables: position, product, stdc
C++ program:
#include <bits/stdc++.h>
using namespace std ; int factorial ( int n ) { int fact = 1 ; for ( int i = 2 ; i <= n ; i ++ ) fact = fact * i ; return fact ; } int npr ( int n , int r ) { int pnr = factorial ( n ) / factorial ( n - r ) ; return pnr ; } int countPermutations ( int n , int r , int k ) { return factorial ( k ) * ( r - k + 1 ) * npr ( n - k , r - k ) ; } int main ( ) { int n = 8 ; int r = 5 ; int k = 2 ; cout << countPermutations ( n , r , k ) ; return 0 ; }

Accumulator variables: i, stdc
Iterator variables: i
C++ program:
#include <bits/stdc++.h>
using namespace std ; int GIF ( float n ) { return floor ( n ) ; } int main ( ) { int n = 2.3 ; cout << GIF ( n ) ; return 0 ; }

Accumulator variables: stdc
C++ program:
#include <bits/stdc++.h>
using namespace std ; int factorial ( int n ) { int fact = 1 ; for ( int i = 2 ; i <= n ; i ++ ) fact = fact * i ; return fact ; } int ncr ( int n , int r ) { return factorial ( n ) / ( factorial ( r ) * factorial ( n - r ) ) ; } int main ( ) { int m = 3 , n = 4 , k = 5 ; int totalTriangles = ncr ( m + n + k , 3 ) - ncr ( m , 3 ) - ncr ( n , 3 ) - ncr ( k , 3 ) ; cout << totalTriangles << endl ; }

Accumulator variables: i, stdc
Iterator variables: i
C++ program:
#include <bits/stdc++.h>
using namespace std ; bool SumDivisible ( int n , int k ) { int sum = 0 , position = 1 ; while ( n > 0 ) { if ( position % 2 == 1 ) sum += n % 10 ; n = n / 10 ; position ++ ; } if ( sum % k == 0 ) return true ; return false ; } int main ( ) { int n = 592452 ; int k = 3 ; if ( SumDivisible ( n , k ) ) cout << " YES " ; else cout << " NO " ; return 0 ; }

Accumulator variables: position, stdc, sum
C++ program:
#include <bits/stdc++.h>
using namespace std ; bool sumDivisible ( int n , int k ) { int sum = 0 ; string num = to_string ( n ) ; int i ; for ( i = 0 ; i < num . size ( ) ; i ++ ) { if ( i % 2 != 0 ) { sum = sum + ( num [ i ] - '0' ) ; } } if ( sum % k == 0 ) { return true ; } else { return false ; } } int main ( ) { int n = 592452 ; int k = 3 ; if ( sumDivisible ( n , k ) ) { cout << ( " YES " ) ; } else { cout << ( " NO " ) ; } return 0 ; }

Index/key variables: i
Accumulator variables: i, stdc
Iterator variables: i
C++ program:
#include <bits/stdc++.h>
using namespace std ; string isTriangleExists ( int a , int b , int c ) { if ( a != 0 && b != 0 && c != 0 && ( a + b + c ) == 180 ) if ( ( a + b ) >= c || ( b + c ) >= a || ( a + c ) >= b ) return " YES " ; else return " NO " ; else return " NO " ; } int main ( ) { int a = 50 , b = 60 , c = 70 ; cout << isTriangleExists ( a , b , c ) << endl ; return 0 ; }

Accumulator variables: stdc
C++ program:
#include <iostream>
#include <math.h>
using namespace std ; class GfG { public : int findX ( int n , int k ) { int r = n , v , u ; int m = sqrt ( k ) + 1 ; for ( int i = 2 ; i <= m && k > 1 ; i ++ ) { if ( i == m ) { i = k ; } for ( u = v = 0 ; k % i == 0 ; v ++ ) { k /= i ; } if ( v > 0 ) { int t = n ; while ( t > 0 ) { t /= i ; u += t ; } r = min ( r , u / v ) ; } } return r ; } } ; int main ( ) { GfG g ; int n = 5 ; int k = 2 ; cout << g . findX ( n , k ) ; }

Accumulator variables: i, k, t, u, v
Iterator variables: i, u
Class/struct names: GfG
C++ program:
#include <bits/stdc++.h>
using namespace std ; int fact ( int n ) { int fact = 1 ; for ( int i = 2 ; i <= n ; i ++ ) fact *= i ; return fact ; } int ncr ( int n , int r ) { int ncr = fact ( n ) / ( fact ( r ) * fact ( n - r ) ) ; return ncr ; } int ways ( int m , int w , int n , int k ) { int ans = 0 ; while ( m >= k ) { ans += ncr ( m , k ) * ncr ( w , n - k ) ; k += 1 ; } return ans ; } int main ( ) { int m , w , n , k ; m = 7 ; w = 6 ; n = 5 ; k = 3 ; cout << ways ( m , w , n , k ) ; }

Accumulator variables: ans, fact, i, k, stdc
Iterator variables: i
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 productOfKthPrimes ( int arr [ ] , int n , int k ) { int c = 0 ; long long int product = 1 ; for ( int i = 0 ; i < n ; i ++ ) { if ( prime [ arr [ i ] ] ) { c ++ ; if ( c % k == 0 ) { product *= arr [ i ] ; c = 0 ; } } } cout << product << endl ; } int main ( ) { SieveOfEratosthenes ( ) ; int n = 5 , k = 2 ; int arr [ n ] = { 2 , 3 , 5 , 7 , 11 } ; productOfKthPrimes ( arr , n , k ) ; return 0 ; }

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