dhyuti-n/xlcost-variable-roles huggingface dataset:
C++ program:
#include <bits/stdc++.h>
using namespace std ; int square ( int n ) { return n * n ; } int sum ( int n ) { if ( n == 0 ) return 0 ; return square ( ( n + 1 ) / 2 ) + sum ( n / 2 ) ; } return square ( n / 2 ) + sum ( n / 2 ) ; } } int oddDivSum ( int a , int b ) { return sum ( b ) - sum ( a - 1 ) ; } int main ( ) { int a = 3 , b = 9 ; cout << oddDivSum ( a , b ) << endl ; return 0 ; }

Accumulator variables: stdc
C++ program:
#include <bits/stdc++.h>
using namespace std ; int countBits ( int n ) { int count = 0 ; while ( n ) { count ++ ; n >>= 1 ; } return count ; } int main ( ) { int n = 32 ; cout << " Minimum ▁ value ▁ of ▁ K ▁ is ▁ = ▁ " << countBits ( n ) << endl ; return 0 ; }

Accumulator variables: count, stdc
C++ program:
#include <bits/stdc++.h>
using namespace std ; int OddDivCount ( int a , int b ) { int res = 0 ; for ( int i = a ; i <= b ; ++ i ) { int divCount = 0 ; for ( int j = 1 ; j <= i ; ++ j ) { if ( i % j == 0 ) { ++ divCount ; } } if ( divCount % 2 ) { ++ res ; } } return res ; } int main ( ) { int a = 1 , b = 10 ; cout << OddDivCount ( a , b ) << endl ; return 0 ; }

Accumulator variables: stdc
Iterator variables: i, j
C++ program:
#include <cmath>
#include <iostream>
using namespace std ; int largestSquareFactor ( int num ) { int answer = 1 ; for ( int i = 2 ; i < sqrt ( num ) ; ++ i ) { int cnt = 0 ; int j = i ; while ( num % j == 0 ) { cnt ++ ; j *= i ; } if ( cnt & 1 ) { cnt -- ; answer *= pow ( i , cnt ) ; } else { answer *= pow ( i , cnt ) ; } } return answer ; } int main ( ) { int N = 420 ; cout << largestSquareFactor ( N ) ; return 0 ; }

Accumulator variables: answer, cnt, j
Iterator variables: i
C++ program:
#include <bits/stdc++.h>
using namespace std ; int Nth_Term ( int n ) { return ( 3 * pow ( n , 2 ) - n + 2 ) / ( 2 ) ; } int main ( ) { int N = 5 ; cout << Nth_Term ( N ) << endl ; }

Accumulator variables: stdc
C++ program:
#include <bits/stdc++.h>
using namespace std ; void countPermutations ( int N , int B ) { int x = pow ( B , N ) ; int y = pow ( B , N - 1 ) ; cout << x - y << " STRNEWLINE " ; } int main ( ) { int N = 6 ; int B = 4 ; countPermutations ( N , B ) ; return 0 ; }

Accumulator variables: stdc
C++ program:
#include <bits/stdc++.h>
using namespace std ; int calculateDifference ( int arr [ ] , int n ) { int max_val = * max_element ( arr , arr + n ) ; vector < bool > prime ( max_val + 1 , true ) ; prime [ 0 ] = false ; prime [ 1 ] = false ; for ( int p = 2 ; p * p <= max_val ; p ++ ) { if ( prime [ p ] == true ) { for ( int i = p * 2 ; i <= max_val ; i += p ) prime [ i ] = false ; } } int P1 = 1 , P2 = 1 ; for ( int i = 0 ; i < n ; i ++ ) { if ( prime [ arr [ i ] ] ) { P1 *= arr [ i ] ; } else if ( arr [ i ] != 1 ) { P2 *= arr [ i ] ; } } return abs ( P2 - P1 ) ; } int main ( ) { int arr [ ] = { 1 , 3 , 5 , 10 , 15 , 7 } ; int n = sizeof ( arr ) / sizeof ( arr [ 0 ] ) ; cout << calculateDifference ( arr , n ) ; return 0 ; }

Index/key variables: i, p
Accumulator variables: P1, P2, i, p, stdc
Iterator variables: i, p
C++ program:
#include <bits/stdc++.h>
using namespace std ; int EqualNumbers ( int a [ ] , int n ) { int sum = 0 ; for ( int i = 0 ; i < n ; i ++ ) sum += a [ i ] ; if ( sum % n ) return n - 1 ; return n ; } int main ( ) { int a [ ] = { 1 , 4 , 1 } ; int n = sizeof ( a ) / sizeof ( a [ 0 ] ) ; cout << EqualNumbers ( a , n ) ; return 0 ; }

Index/key variables: i
Accumulator variables: i, stdc, sum
Iterator variables: i
C++ program:
#include <bits/stdc++.h>
using namespace std ; int count_odd_pair ( int n , int a [ ] ) { int odd = 0 , even = 0 ; for ( int i = 0 ; i < n ; i ++ ) { if ( a [ i ] % 2 == 0 ) even ++ ; else odd ++ ; } int ans = odd * even * 2 ; return ans ; } int count_even_pair ( int odd_sum_pairs , int n ) { int total_pairs = ( n * ( n - 1 ) ) ; int ans = total_pairs - odd_sum_pairs ; return ans ; } int main ( ) { int n = 6 ; int a [ ] = { 2 , 4 , 5 , 9 , 1 , 8 } ; int odd_sum_pairs = count_odd_pair ( n , a ) ; int even_sum_pairs = count_even_pair ( odd_sum_pairs , n ) ; cout << " Even ▁ Sum ▁ Pairs ▁ = ▁ " << even_sum_pairs << endl ; cout << " Odd ▁ Sum ▁ Pairs = ▁ " << odd_sum_pairs << endl ; return 0 ; }

Index/key variables: i
Accumulator variables: even, i, odd, stdc
Iterator variables: i
C++ program:
#include <bits/stdc++.h>
using namespace std ; int findSteps ( int n , int m , int a [ ] ) { int cur = 1 ; int steps = 0 ; for ( int i = 0 ; i < m ; i ++ ) { if ( a [ i ] >= cur ) steps += ( a [ i ] - cur ) ; else steps += ( n - cur + a [ i ] ) ; cur = a [ i ] ; } return steps ; } int main ( ) { int n = 3 , m = 3 ; int a [ ] = { 2 , 1 , 2 } ; cout << findSteps ( n , m , a ) ; }

Index/key variables: i
Accumulator variables: i, stdc, steps
Iterator variables: i
C++ program:
#include <bits/stdc++.h>
using namespace std ; void HexToBin ( string hexdec ) { long int i = 0 ; while ( hexdec [ i ] ) { switch ( hexdec [ i ] ) { case '0' : cout << "0000" ; break ; case '1' : cout << "0001" ; break ; case '2' : cout << "0010" ; break ; case '3' : cout << "0011" ; break ; case '4' : cout << "0100" ; break ; case '5' : cout << "0101" ; break ; case '6' : cout << "0110" ; break ; case '7' : cout << "0111" ; break ; case '8' : cout << "1000" ; break ; case '9' : cout << "1001" ; break ; case ' A ' : case ' a ' : cout << "1010" ; break ; case ' B ' : case ' b ' : cout << "1011" ; break ; case ' C ' : case ' c ' : cout << "1100" ; break ; case ' D ' : case ' d ' : cout << "1101" ; break ; case ' E ' : case ' e ' : cout << "1110" ; break ; case ' F ' : case ' f ' : cout << "1111" ; break ; default : cout << " Invalid hexadecimal digit " << hexdec [ i ] ; } i ++ ; } } int main ( ) { char hexdec [ 100 ] = "1AC5" ; cout << " Equivalent Binary value is : " HexToBin ( hexdec ) ; return 0 ; }

Index/key variables: i
Accumulator variables: i, stdc
C++ program:
#include <bits/stdc++.h>
using namespace std ; bool isPowerOfTwo ( int x ) { return x && ( ! ( x & ( x - 1 ) ) ) ; } void Count_pairs ( int a [ ] , int n ) { int count = 0 ; for ( int i = 0 ; i < n ; i ++ ) { if ( isPowerOfTwo ( a [ i ] ) ) count ++ ; } int ans = ( count * ( count - 1 ) ) / 2 ; cout << ans << " STRNEWLINE " ; } int main ( ) { int a [ ] = { 2 , 5 , 8 , 16 , 128 } ; int n = sizeof ( a ) / sizeof ( a [ 0 ] ) ; Count_pairs ( a , n ) ; return 0 ; }

Index/key variables: i
Accumulator variables: count, i, stdc
Iterator variables: i
C++ program:
#include <bits/stdc++.h>
using namespace std ; int factorial ( int n ) { int result = 1 ; for ( int i = 1 ; i <= n ; i ++ ) result = result * i ; return result ; } int nCr ( int n , int r ) { return factorial ( n ) / ( factorial ( r ) * factorial ( n - r ) ) ; } int calculate_result ( int n ) { int result = 2 * nCr ( ( n - 2 ) , ( n / 2 - 1 ) ) ; return result ; } int main ( void ) { int a = 2 , b = 4 ; cout << calculate_result ( 2 * a ) << endl ; cout << calculate_result ( 2 * b ) << endl ; return 0 ; }

Accumulator variables: i, stdc
Iterator variables: i
C++ program:
#include <bits/stdc++.h>
using namespace std ; void PossibleValues ( int b , int x , int n ) { int leastdivisible = ( b / x + 1 ) * x ; int flag = 1 ; while ( leastdivisible <= n ) { if ( leastdivisible - b >= 1 ) { cout << leastdivisible - b << " ▁ " ; leastdivisible += x ; flag = 0 ; } else break ; } if ( flag ) cout << -1 ; } int main ( ) { int b = 10 , x = 6 , n = 40 ; PossibleValues ( b , x , n ) ; return 0 ; }

Accumulator variables: leastdivisible, stdc
C++ program:
#include <bits/stdc++.h>
using namespace std ; int digitProduct ( int digits [ ] , int start , int end ) { int pro = 1 ; for ( int i = start ; i <= end ; i ++ ) { pro *= digits [ i ] ; } return pro ; } bool isDistinct ( int N ) { string s = to_string ( N ) ; int len = s . length ( ) ; int digits [ len ] ; unordered_set < int > products ; for ( int i = 0 ; i < len ; i ++ ) { digits [ i ] = s [ i ] - '0' ; } for ( int i = 0 ; i < len ; i ++ ) { for ( int j = i ; j < len ; j ++ ) { int val = digitProduct ( digits , i , j ) ; if ( products . find ( val ) != products . end ( ) ) return false ; else products . insert ( val ) ; } } return true ; } int main ( ) { int N = 324 ; if ( isDistinct ( N ) ) cout << " YES " ; else cout << " NO " ; return 0 ; }

Index/key variables: i, len
Accumulator variables: i, j, pro, stdc
Iterator variables: i, j
C++ program:
#include <bits/stdc++.h>
using namespace std ; #define MAX  10000
vector < int > arr ; void ulam ( ) { unordered_set < int > s ; arr . push_back ( 1 ) ; s . insert ( 1 ) ; arr . push_back ( 2 ) ; s . insert ( 2 ) ; for ( int i = 3 ; i < MAX ; i ++ ) { int count = 0 ; for ( int j = 0 ; j < arr . size ( ) ; j ++ ) { if ( s . find ( i - arr [ j ] ) != s . end ( ) && arr [ j ] != ( i - arr [ j ] ) ) count ++ ; if ( count > 2 ) break ; } if ( count == 2 ) { arr . push_back ( i ) ; s . insert ( i ) ; } } } int main ( ) { ulam ( ) ; int n = 9 ; cout << arr [ n - 1 ] ; return 0 ; }

Index/key variables: j
Accumulator variables: count, i, j, stdc
Iterator variables: i, j
C++ program:
#include <bits/stdc++.h>
using namespace std ; long nthHilbertNumber ( int n ) { return 4 * ( n - 1 ) + 1 ; } int main ( ) { int n = 5 ; cout << nthHilbertNumber ( n ) ; return 0 ; }

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

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

Accumulator variables: stdc
C++ program:
#include <bits/stdc++.h>
using namespace std ; bool isPowerOfTwo ( int n ) { return ( n && ! ( n & ( n - 1 ) ) ) ; } bool isProthNumber ( int n ) { int k = 1 ; while ( k < ( n / k ) ) { if ( n % k == 0 ) { if ( isPowerOfTwo ( n / k ) ) return true ; } k = k + 2 ; } return false ; } int main ( ) { int n = 25 ; if ( isProthNumber ( n - 1 ) ) cout << " YES " ; else cout << " NO " ; return 0 ; }

Accumulator variables: stdc
C++ program:
#include <iostream>
using namespace std ; #define ll  long int
int get_last_two_digit ( long long int N ) { if ( N <= 10 ) { ll ans = 0 , fac = 1 ; for ( int i = 1 ; i <= N ; i ++ ) { fac = fac * i ; ans += fac ; } return ans % 100 ; } return 13 ; } int main ( ) { long long int N = 1 ; for ( N = 1 ; N <= 10 ; N ++ ) cout << " For ▁ N ▁ = ▁ " << N << " ▁ : ▁ " << get_last_two_digit ( N ) << endl ; return 0 ; }

Accumulator variables: N, ans, i
Iterator variables: N, i
C++ program:
#include <bits/stdc++.h>
using namespace std ; bool isProductEven ( int arr [ ] , int n ) { for ( int i = 0 ; i < n ; i ++ ) if ( ( arr [ i ] & 1 ) == 0 ) return true ; return false ; } int main ( ) { int arr [ ] = { 2 , 4 , 3 , 5 } ; int n = sizeof ( arr ) / sizeof ( arr [ 0 ] ) ; if ( isProductEven ( arr , n ) ) cout << " Even " ; else cout << " Odd " ; return 0 ; }

Index/key variables: i
Accumulator variables: i, stdc
Iterator variables: i
C++ program:
#include <bits/stdc++.h>
using namespace std ; int calculateSquareSum ( int n ) { if ( n <= 0 ) return 0 ; int fibo [ n + 1 ] ; fibo [ 0 ] = 0 , fibo [ 1 ] = 1 ; int sum = ( fibo [ 0 ] * fibo [ 0 ] ) + ( fibo [ 1 ] * fibo [ 1 ] ) ; for ( int i = 2 ; i <= n ; i ++ ) { fibo [ i ] = fibo [ i - 1 ] + fibo [ i - 2 ] ; sum += ( fibo [ i ] * fibo [ i ] ) ; } return sum ; } int main ( ) { int n = 6 ; cout << " Sum ▁ of ▁ squares ▁ of ▁ Fibonacci ▁ numbers ▁ is ▁ : ▁ " << calculateSquareSum ( 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 ; int MinimumMoves ( int a [ ] , int n , int x ) { int ans = 0 ; for ( int i = 1 ; i < n ; i ++ ) { if ( a [ i ] <= a [ i - 1 ] ) { int p = ( a [ i - 1 ] - a [ i ] ) / x + 1 ; ans += p ; a [ i ] += p * x ; } } return ans ; } int main ( ) { int arr [ ] = { 1 , 3 , 3 , 2 } ; int x = 2 ; int n = sizeof ( arr ) / sizeof ( arr [ 0 ] ) ; cout << MinimumMoves ( arr , n , x ) ; return 0 ; }

Index/key variables: i
Accumulator variables: ans, i, stdc
Iterator variables: i
C++ program:
#include <bits/stdc++.h>
using namespace std ; int SumOfDigits ( string str , int n ) { int sum = 0 ; for ( int i = 0 ; i < n ; i ++ ) sum += ( int ) ( str [ i ] - '0' ) ; return sum ; } bool Divisible ( string str , int n ) { if ( SumOfDigits ( str , n ) % 3 == 0 and str [ n - 1 ] == '0' ) return true ; return false ; } int main ( ) { string str = "263730746028908374890" ; int n = str . size ( ) ; if ( Divisible ( str , 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 ; bool isPrime ( int k ) { if ( k <= 1 ) return false ; for ( int i = 2 ; i < k ; i ++ ) if ( k % i == 0 ) return false ; return true ; } int check ( int num , int k ) { int flag = 1 ; for ( int i = 2 ; i < k ; i ++ ) { if ( num % i == 0 ) flag = 0 ; } if ( flag == 1 ) { if ( num % k == 0 ) return 1 ; else return 0 ; } else return 0 ; } int findCount ( int a , int b , int k ) { int count = 0 ; if ( ! isPrime ( k ) ) return 0 ; else { int ans ; for ( int i = a ; i <= b ; i ++ ) { ans = check ( i , k ) ; if ( ans == 1 ) count ++ ; else continue ; } } return count ; } int main ( ) { int a = 2020 , b = 6300 , k = 29 ; cout << findCount ( a , b , k ) ; return 0 ; }

Accumulator variables: count, i, stdc
Iterator variables: i
C++ program:
#include <bits/stdc++.h>
using namespace std ; #define ll  long long
int findLargest ( int n , vector < int > & v ) { int flag = 0 ; ll sum = 0 ; for ( int i = 0 ; i < n ; i ++ ) { if ( v [ i ] == 0 ) flag = 1 ; sum += v [ i ] ; } if ( ! flag ) cout << " Not ▁ possible " << endl ; else { sort ( v . begin ( ) , v . end ( ) , greater < int > ( ) ) ; if ( v [ 0 ] == 0 ) { cout << "0" << endl ; return 0 ; } else { int flag = 0 ; int y = sum % 3 ; if ( y != 0 ) { for ( int i = n - 1 ; i >= 0 ; i -- ) { if ( v [ i ] % 3 == y ) { v . erase ( v . begin ( ) + i ) ; flag = 1 ; break ; } } if ( flag == 0 ) { y = 3 - y ; int cnt = 0 ; for ( int i = n - 1 ; i >= 0 ; i -- ) { if ( v [ i ] % 3 == y ) { v . erase ( v . begin ( ) + i ) ; cnt ++ ; if ( cnt >= 2 ) break ; } } } } if ( * v . begin ( ) == 0 ) cout << "0" << endl ; else for ( int i : v ) { cout << i ; } } } } int main ( ) { int n = 11 ; vector < int > v { 3 , 9 , 9 , 6 , 4 , 3 , 6 , 4 , 9 , 6 , 0 } ; findLargest ( n , v ) ; return 0 ; }

Index/key variables: i
Accumulator variables: cnt, i, stdc, sum
Iterator variables: i
C++ program:
#include <bits/stdc++.h>
using namespace std ; void findkth ( int n , int k ) { vector < int > v1 ; vector < int > v2 ; for ( int i = 1 ; i <= sqrt ( n ) ; i ++ ) { if ( n % i == 0 ) { v1 . push_back ( i ) ; if ( i != sqrt ( n ) ) v2 . push_back ( n / i ) ; } } reverse ( v2 . begin ( ) , v2 . end ( ) ) ; if ( k > ( v1 . size ( ) + v2 . size ( ) ) ) cout << " Doesn ' t ▁ Exist " ; else { if ( k <= v1 . size ( ) ) cout << v1 [ k - 1 ] ; else cout << v2 [ k - v1 . size ( ) - 1 ] ; } } int main ( ) { int n = 15 , k = 2 ; findkth ( n , k ) ; return 0 ; }

Accumulator variables: i, stdc
Iterator variables: i
C++ program:
#include <bits/stdc++.h>
using namespace std ; int NumberOfSolutions ( int a , int b , int c , int d ) { int ans = 0 ; for ( int i = a ; i <= b ; i ++ ) if ( d >= max ( c , i + 1 ) ) ans += d - max ( c , i + 1 ) + 1 ; return ans ; } int main ( ) { int a = 2 , b = 3 , c = 3 , d = 4 ; cout << NumberOfSolutions ( a , b , c , d ) ; return 0 ; }

Accumulator variables: ans, i, stdc
Iterator variables: i
C++ program:
#include <bits/stdc++.h>
using namespace std ; #define ll  long long
ll findF_N ( ll n ) { ll ans = 0 ; for ( ll i = 0 ; i < n ; ++ i ) ans += ( i + 1 ) * ( n - i - 1 ) ; return ans ; } int main ( ) { ll n = 3 ; cout << findF_N ( n ) ; return 0 ; }

Accumulator variables: ans, stdc
Iterator variables: i
C++ program:
#include <bits/stdc++.h>
using namespace std ; string findNumber ( int n , int d ) { string ans = " " ; if ( d != 10 ) { ans += to_string ( d ) ; for ( int i = 1 ; i < n ; i ++ ) ans += '0' ; } else { if ( n == 1 ) ans += " Impossible " ; else { ans += '1' ; for ( int i = 1 ; i < n ; i ++ ) ans += '0' ; } } return ans ; } int main ( ) { int n = 12 , d = 3 ; cout << findNumber ( n , d ) ; return 0 ; }

Accumulator variables: ans, i, stdc
Iterator variables: i
C++ program:
#include <bits/stdc++.h>
using namespace std ; #define MAX  1000000
int sieve_Prime [ MAX + 4 ] = { 0 } , sieve_count [ MAX + 4 ] = { 0 } ; void form_sieve ( ) { sieve_Prime [ 1 ] = 1 ; for ( int i = 2 ; i <= MAX ; i ++ ) { if ( sieve_Prime [ i ] == 0 ) { for ( int j = i * 2 ; j <= MAX ; j += i ) { if ( sieve_Prime [ j ] == 0 ) { sieve_Prime [ j ] = 1 ; sieve_count [ i ] ++ ; } } } } } int main ( ) { form_sieve ( ) ; int n = 2 ; cout << " Count ▁ = ▁ " << ( sieve_count [ n ] + 1 ) << endl ; n = 3 ; cout << " Count ▁ = ▁ " << ( sieve_count [ n ] + 1 ) << endl ; return 0 ; }

Index/key variables: i, j, n
Accumulator variables: i, j, stdc
Iterator variables: i, j
C++ program:
#include <bits/stdc++.h>
using namespace std ; int main ( ) { int matrix [ 5 ] [ 5 ] , row_index , column_index , x = 0 , size = 5 ; for ( row_index = 0 ; row_index < size ; row_index ++ ) { for ( column_index = 0 ; column_index < size ; column_index ++ ) { matrix [ row_index ] [ column_index ] = ++ x ; } } cout << " The ▁ matrix ▁ is STRNEWLINE " ; for ( row_index = 0 ; row_index < size ; row_index ++ ) { for ( column_index = 0 ; column_index < size ; column_index ++ ) { cout << matrix [ row_index ] [ column_index ] << " ▁ " ; } cout << endl ; } cout << " Elements on Secondary diagonal : " for ( row_index = 0 ; row_index < size ; row_index ++ ) { for ( column_index = 0 ; column_index < size ; column_index ++ ) { if ( ( row_index + column_index ) == size - 1 ) cout << matrix [ row_index ] [ column_index ] << " , ▁ " ; } } return 0 ; }

Index/key variables: column_index, row_index
Accumulator variables: column_index, row_index, stdc
Iterator variables: column_index, row_index
C++ program:
#include <bits/stdc++.h>
using namespace std ; int main ( ) { int matrix [ 5 ] [ 5 ] , row_index , column_index , x = 0 , size = 5 ; for ( row_index = 0 ; row_index < size ; row_index ++ ) { for ( column_index = 0 ; column_index < size ; column_index ++ ) { matrix [ row_index ] [ column_index ] = ++ x ; } } cout << " The ▁ matrix ▁ is STRNEWLINE " ; for ( row_index = 0 ; row_index < size ; row_index ++ ) { for ( column_index = 0 ; column_index < size ; column_index ++ ) { cout << matrix [ row_index ] [ column_index ] << " ▁ " ; } cout << endl ; } cout << " Elements above Secondary diagonal are : " ; for ( row_index = 0 ; row_index < size ; row_index ++ ) { for ( column_index = 0 ; column_index < size ; column_index ++ ) { if ( ( row_index + column_index ) < size - 1 ) cout << matrix [ row_index ] [ column_index ] << " , ▁ " ; } } return 0 ; }

Index/key variables: column_index, row_index
Accumulator variables: column_index, row_index, stdc
Iterator variables: column_index, row_index
C++ program:
#include <bits/stdc++.h>
using namespace std ; int main ( ) { int matrix [ 5 ] [ 5 ] , row_index , column_index , x = 0 , size = 5 ; for ( row_index = 0 ; row_index < size ; row_index ++ ) { for ( column_index = 0 ; column_index < size ; column_index ++ ) { matrix [ row_index ] [ column_index ] = ++ x ; } } cout << " The ▁ matrix ▁ is " << endl ; for ( row_index = 0 ; row_index < size ; row_index ++ ) { for ( column_index = 0 ; column_index < size ; column_index ++ ) { cout << " TABSYMBOL " << matrix [ row_index ] [ column_index ] ; } cout << endl ; } cout << " Corner Elements are : " ; for ( row_index = 0 ; row_index < size ; row_index ++ ) { for ( column_index = 0 ; column_index < size ; column_index ++ ) { if ( ( row_index == 0 row_index == size - 1 ) && ( column_index == 0 column_index == size - 1 ) ) cout << matrix [ row_index ] [ column_index ] << " , " ; } } return 0 ; }

Index/key variables: column_index, row_index
Accumulator variables: column_index, row_index, stdc
Iterator variables: column_index, row_index
C++ program:
#include <bits/stdc++.h>
using namespace std ; vector < int > PrimeFactors ( int n ) { vector < int > v ; int x = n ; for ( int i = 2 ; i * i <= n ; i ++ ) { if ( x % i == 0 ) { v . push_back ( i ) ; while ( x % i == 0 ) x /= i ; } } if ( x > 1 ) v . push_back ( x ) ; return v ; } int GoodNumber ( int n ) { vector < int > v = PrimeFactors ( n ) ; int ans = 1 ; for ( int i = 0 ; i < v . size ( ) ; i ++ ) ans *= v [ i ] ; return ans ; } int main ( ) { int n = 12 ; cout << GoodNumber ( n ) ; return 0 ; }

Index/key variables: i
Accumulator variables: ans, i, stdc, x
Iterator variables: i
C++ program:
#include <bits/stdc++.h>
using namespace std ; bool checkSpecialPrime ( bool * sieve , int num ) { while ( num ) { if ( ! sieve [ num ] ) { return false ; } num /= 10 ; } return true ; } void findSpecialPrime ( int N ) { bool sieve [ N + 10 ] ; memset ( sieve , true , sizeof ( sieve ) ) ; sieve [ 0 ] = sieve [ 1 ] = false ; for ( long long i = 2 ; i <= N ; i ++ ) { if ( sieve [ i ] ) { for ( long long j = i * i ; j <= N ; j += i ) { sieve [ j ] = false ; } } } while ( true ) { if ( checkSpecialPrime ( sieve , N ) ) { cout << N << ' ' ; break ; } else N -- ; } } int main ( ) { findSpecialPrime ( 379 ) ; findSpecialPrime ( 100 ) ; return 0 ; }

Index/key variables: i, j, num
Accumulator variables: N, i, j, num, stdc
Iterator variables: i, j
C++ program:
#include <bits/stdc++.h>
using namespace std ; #define MAX  1000000
vector < int > arr ; bool sprime [ MAX ] ; void computeSemiPrime ( ) { memset ( sprime , false , sizeof ( sprime ) ) ; for ( int i = 2 ; i < MAX ; i ++ ) { int cnt = 0 ; int num = i ; for ( int j = 2 ; cnt < 2 && j * j <= num ; ++ j ) { while ( num % j == 0 ) { } } if ( num > 1 ) ++ cnt ; if ( cnt == 2 ) { sprime [ i ] = true ; arr . push_back ( i ) ; } } } bool checkSemiPrime ( int n ) { int i = 0 ; while ( arr [ i ] <= n / 2 ) { if ( sprime [ n - arr [ i ] ] ) { return true ; } i ++ ; } return false ; } int main ( ) { computeSemiPrime ( ) ; int n = 30 ; if ( checkSemiPrime ( n ) ) cout << " YES " ; else cout << " NO " ; return 0 ; }

Index/key variables: MAX, i
Accumulator variables: i, stdc
Iterator variables: i, j
C++ program:
#include <bits/stdc++.h>
using namespace std ; float heightCalculate ( int H , int n , int m ) { float N = n * 1.0 ; float M = m * 1.0 ; float h = H * sqrt ( N / ( N + M ) ) ; return h ; } int main ( ) { int H = 10 , n = 3 , m = 4 ; cout << heightCalculate ( H , n , m ) ; return 0 ; }

Accumulator variables: stdc
C++ program:
#include <bits/stdc++.h>
using namespace std ; bool isprime ( int x ) { for ( int i = 2 ; i * i <= x ; i ++ ) if ( x % i == 0 ) return false ; return true ; } bool isNSqMinusnMSqPrime ( int m , int n ) { if ( n - m == 1 and isprime ( m + n ) ) return true ; else return false ; } int main ( ) { int m = 13 , n = 16 ; if ( isNSqMinusnMSqPrime ( m , n ) ) cout << " YES " ; else cout << " NO " ; return 0 ; }

Accumulator variables: i, stdc
Iterator variables: i
C++ program:
#include <bits/stdc++.h>
using namespace std ; #define ll  long long
void findsolution ( ll n , ll x , ll y ) { if ( ( y - n + 1 ) * ( y - n + 1 ) + n - 1 < x y < n ) { cout << " No ▁ solution " ; return ; } cout << y - n + 1 ; while ( n -- > 1 ) cout << endl << 1 ; } int main ( ) { ll n , x , y ; n = 5 , x = 15 , y = 15 ; findsolution ( n , x , y ) ; return 0 ; }

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

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

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

Accumulator variables: stdc