dhyuti-n/xlcost-variable-roles huggingface dataset:
C++ program:
#include <bits/stdc++.h>
#define endl  "
" #define ll  long long
using namespace std ; bool is_prime ( ll n ) { if ( n == 1 ) { return false ; } for ( ll i = 2 ; i <= sqrt ( n ) ; i ++ ) { if ( n % i == 0 ) { return false ; } } return true ; } void consecutive_primes ( int n ) { ll first = -1 , second = -1 ; for ( ll i = sqrt ( n ) ; i >= 2 ; i -- ) { if ( is_prime ( i ) ) { first = i ; break ; } } for ( ll i = sqrt ( n ) + 1 ; i <= n / 2 ; i ++ ) { if ( is_prime ( i ) ) { second = i ; break ; } } if ( first * second >= n ) { cout << first << " ▁ " << second << endl ; } else { for ( ll i = second + 1 ; i <= n ; i ++ ) { if ( is_prime ( i ) ) { cout << second << " ▁ " << i << endl ; return ; } } } } int main ( ) { ll n = 14 ; consecutive_primes ( n ) ; return 0 ; }

Accumulator variables: i, stdc
Iterator variables: i
C++ program:
#include <bits/stdc++.h>
using namespace std ; const int n = 3 ; const int m = 3 ; void countDecrements ( long long arr [ ] [ m ] ) { int count_1 = 0 ; int count_2 = 0 ; for ( int i = 0 ; i < n ; i ++ ) { for ( int j = 0 ; j < m ; j ++ ) { if ( ( i + j ) % 2 == arr [ i ] [ j ] % 2 ) count_1 ++ ; if ( 1 - ( i + j ) % 2 == arr [ i ] [ j ] % 2 ) count_2 ++ ; } } cout << min ( count_1 , count_2 ) ; } int main ( ) { long long arr [ ] [ m ] = { { 1 , 2 , 3 } , { 1 , 2 , 3 } , { 1 , 2 , 3 } } ; countDecrements ( arr ) ; return 0 ; }

Index/key variables: i, j, m
Accumulator variables: count_1, count_2, i, j, stdc
Iterator variables: i, j
C++ program:
#include <bits/stdc++.h>
using namespace std ; void check ( int X , int Y ) { if ( X > 3 ) { cout << " Yes " ; } else if ( X == 1 and Y == 1 ) { cout << " Yes " ; } else if ( X == 2 and Y <= 3 ) { cout << " Yes " ; } else if ( X == 3 and Y <= 3 ) { cout << " Yes " ; } else { cout << " No " ; } } int main ( ) { int X = 6 , Y = 8 ; check ( X , Y ) ; return 0 ; }

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

Accumulator variables: stdc
C++ program:
#include <bits/stdc++.h>
using namespace std ; void evenXorSubarray ( int arr [ ] , int n ) { int ans = 0 ; int freq [ ] = { 0 , 0 } ; int XOR = 0 ; for ( int i = 0 ; i < n ; i ++ ) { XOR = XOR ^ arr [ i ] ; if ( XOR % 2 == 0 ) { ans += freq [ 0 ] + 1 ; freq [ 0 ] ++ ; } else { ans += freq [ 1 ] ; freq [ 1 ] ++ ; } } cout << ans ; } int main ( ) { int arr [ ] = { 1 , 2 , 3 , 4 } ; int N = sizeof ( arr ) / sizeof ( arr [ 0 ] ) ; evenXorSubarray ( arr , N ) ; return 0 ; }

Index/key variables: i
Accumulator variables: ans, i, stdc
Iterator variables: i
C++ program:
#include <bits/stdc++.h>
using namespace std ; int countOccurrences ( int N , int X ) { int count = 0 ; for ( int i = 1 ; i < sqrt ( X ) ; i ++ ) { if ( X % i == 0 ) { int a = i ; int b = X / i ; if ( a <= N && b <= N ) { if ( a == b ) count += 1 ; else count += 2 ; } } } return count ; } int main ( ) { int N = 7 ; int X = 12 ; cout << countOccurrences ( N , X ) ; return 0 ; }

Accumulator variables: count, i, stdc
Iterator variables: i
C++ program:
#include <bits/stdc++.h>
using namespace std ; void findArrayWithMaxProduct ( int arr [ ] , int N ) { for ( int i = 0 ; i < N ; i ++ ) if ( arr [ i ] >= 0 ) { arr [ i ] = - arr [ i ] - 1 ; } if ( N % 2 == 1 ) { int max_element = -1 ; int index = -1 ; for ( int i = 0 ; i < N ; i ++ ) if ( abs ( arr [ i ] ) > max_element ) { max_element = abs ( arr [ i ] ) ; index = i ; } arr [ index ] = - arr [ index ] - 1 ; } for ( int i = 0 ; i < N ; i ++ ) printf ( " % d ▁ " , arr [ i ] ) ; } int main ( ) { int arr [ ] = { -3 , 0 , 1 } ; int N = sizeof ( arr ) / sizeof ( arr [ 0 ] ) ; findArrayWithMaxProduct ( arr , N ) ; return 0 ; }

Index/key variables: i, index
Accumulator variables: i, stdc
Iterator variables: i
C++ program:
#include <iostream>
using namespace std ; void findPerfectIndex ( int N , int K ) { int i = 0 ; for ( ; i < K ; i ++ ) { cout << ( N - K + 1 ) + i << " ▁ " ; } for ( ; i < N ; i ++ ) { cout << i - K + 1 << " ▁ " ; } } int main ( ) { int N = 10 , K = 3 ; findPerfectIndex ( N , K ) ; return 0 ; }

Accumulator variables: i
C++ program:
#include <bits/stdc++.h>
using namespace std ; long countPairs ( long L , long R ) { long firstNum = 2 * L ; long lastNum = 2 * R ; long Cntpairs = lastNum - firstNum + 1 ; cout << Cntpairs ; } int main ( ) { long L = 2 , R = 3 ; countPairs ( L , R ) ; return 0 ; }

Accumulator variables: stdc
C++ program:
#include <bits/stdc++.h>
using namespace std ; void countPairs ( int A [ ] , int n ) { long long count = ( n * ( n - 1 ) ) / 2 ; unordered_map < long long , long long > ump ; for ( int i = 0 ; i < n ; i ++ ) { ump [ A [ i ] ] ++ ; } for ( auto it = ump . begin ( ) ; it != ump . end ( ) ; ++ it ) { long long c = it -> second ; count = count - ( c * ( c - 1 ) ) / 2 ; } cout << count ; } int main ( ) { int A [ ] = { 1 , 4 , 7 } ; int N = sizeof ( A ) / sizeof ( A [ 0 ] ) ; countPairs ( A , N ) ; return 0 ; }

Index/key variables: i
Accumulator variables: i, stdc
Iterator variables: i, it
C++ program:
#include <bits/stdc++.h>
using namespace std ; bitset < 100003 > bit ; void constructBinaryString ( int arr [ ] , int N , int K ) { bit [ 0 ] = 1 ; for ( int i = 0 ; i < N ; i ++ ) { bit |= bit << arr [ i ] ; } for ( int i = 1 ; i <= K ; i ++ ) { cout << bit [ i ] ; } } int main ( ) { int arr [ ] = { 1 , 6 , 1 } ; int N = sizeof ( arr ) / sizeof ( arr [ 0 ] ) ; int K = 8 ; constructBinaryString ( arr , N , K ) ; }

Index/key variables: i
Accumulator variables: bit, i, stdc
Iterator variables: i
C++ program:
#include <bits/stdc++.h>
using namespace std ; string check ( int current_row , int current_col , int destination_row , int destination_col ) { if ( current_row == destination_row ) return " POSSIBLE " ; else if ( current_col == destination_col ) return " POSSIBLE " ; else return " NOT ▁ POSSIBLE " ; } int main ( ) { int current_row = 8 ; int current_col = 8 ; int destination_row = 8 ; int destination_col = 4 ; string output = check ( current_row , current_col , destination_row , destination_col ) ; cout << output ; return 0 ; }

Accumulator variables: stdc
C++ program:
#include <bits/stdc++.h>
using namespace std ; bool isDiv ( int N , int X , int M , int & res ) { if ( X == 0 ) { if ( N % M == 0 ) { res = N ; return true ; } return false ; } for ( int i = 0 ; i <= 9 ; i ++ ) { if ( isDiv ( N * 10 + i , X - 1 , M , res ) ) { return true ; } } } int main ( ) { int N = 4 , M = 50 , X = 2 ; int res = -1 ; isDiv ( N , X , M , res ) ; cout << res ; }

Accumulator variables: i, stdc
Iterator variables: i
C++ program:
#include <bits/stdc++.h>
using namespace std ; void minimumMoves ( int arr [ ] , int N ) { int sum = 0 ; int maxelement = -1 ; if ( N == 2 ) { cout << 0 ; } for ( int i = 0 ; i < N ; i ++ ) { sum += arr [ i ] ; maxelement = max ( maxelement , arr [ i ] ) ; } int K = ( sum + N - 2 ) / ( N - 1 ) ; K = max ( maxelement , K ) ; int ans = K * ( N - 1 ) - sum ; cout << ans ; } int main ( ) { int arr [ ] = { 2 , 3 , 7 } ; int N = 3 ; minimumMoves ( arr , N ) ; return 0 ; }

Index/key variables: i
Accumulator variables: i, stdc, sum
Iterator variables: i
C++ program:
#include <iostream>
using namespace std ; void printSubsequence ( int N ) { cout << " { ▁ " ; for ( int i = 1 ; i < N - 1 ; i ++ ) { cout << i << " , ▁ " ; } cout << N - 1 << " ▁ } STRNEWLINE " ; cout << " { ▁ " << N << " ▁ } " ; } int main ( ) { int N = 8 ; printSubsequence ( N ) ; return 0 ; }

Accumulator variables: i
Iterator variables: i
C++ program:
#include <iostream>
using namespace std ; void array_divisbleby_k ( int N , int K ) { bool flag = false ; int d1 , d2 ; for ( int i = 2 ; i * i <= K ; i ++ ) { if ( K % i == 0 ) { flag = true ; d1 = i ; d2 = K / i ; break ; } } if ( flag ) { for ( int i = 0 ; i < N ; i ++ ) { if ( i % 2 == 1 ) { cout << d2 << " ▁ " ; } else { cout << d1 << " ▁ " ; } } } else { cout << -1 ; } } int main ( ) { int N = 5 , K = 21 ; array_divisbleby_k ( N , K ) ; return 0 ; }

Accumulator variables: i
Iterator variables: i
Boolean variables: flag
C++ program:
#include " bits / stdc + + . h "
using namespace std ; void addEdge ( vector < int > adj [ ] , int u , int v ) { adj [ u ] . push_back ( v ) ; adj [ v ] . push_back ( u ) ; } void DFS ( int u , vector < int > adj [ ] , int & cnt , vector < bool > & visited , int fre [ ] , string S ) { visited [ u ] = true ; cnt ++ ; fre [ S [ u ] - ' a ' ] ++ ; for ( int i = 0 ; i < adj [ u ] . size ( ) ; i ++ ) { if ( ! visited [ adj [ u ] [ i ] ] ) { DFS ( adj [ u ] [ i ] , adj , cnt , visited , fre , S ) ; } } } int minimumOperations ( string & S , int m ) { int V = 100 ; vector < int > adj [ V ] ; int total = 0 , N = S . length ( ) ; for ( int i = 0 ; i < N ; i ++ ) { addEdge ( adj , i , N - i - 1 ) ; addEdge ( adj , N - i - 1 , i ) ; } for ( int i = 0 ; i < N - m ; i ++ ) { addEdge ( adj , i , i + m ) ; addEdge ( adj , i + m , i ) ; } vector < bool > visited ( V , 0 ) ; for ( int i = 0 ; i < N ; i ++ ) { if ( ! visited [ i ] ) { int fre [ 26 ] = { 0 } ; int cnt = 0 , maxx = -1 ; DFS ( i , adj , cnt , visited , fre , S ) ; for ( int j = 0 ; j < 26 ; j ++ ) maxx = max ( maxx , fre [ j ] ) ; total += cnt - maxx ; } } cout << total ; } int main ( ) { string S = " abaaba " ; int K = 2 ; minimumOperations ( S , K ) ; return 0 ; }

Index/key variables: V, i, j, u, v
Accumulator variables: cnt, i, j, total
Iterator variables: i, j
C++ program:
#include <bits/stdc++.h>
using namespace std ; void print ( vector < vector < char > > arr , int n , int m ) { for ( int i = 0 ; i < n ; i ++ ) { for ( int j = 0 ; j < m ; j ++ ) { char a = arr [ i ] [ j ] ; if ( ( i + j ) % 2 == 0 && a == ' F ' ) { arr [ i ] [ j ] = '1' ; } else if ( a == ' F ' ) { arr [ i ] [ j ] = '2' ; } } } for ( int i = 0 ; i < n ; i ++ ) { for ( int j = 0 ; j < m ; j ++ ) { cout << arr [ i ] [ j ] ; } cout << endl ; } } int main ( ) { int n = 4 , m = 4 ; vector < vector < char > > arr = { { ' F ' , ' F ' , ' F ' , ' F ' } , { ' F ' , ' O ' , ' F ' , ' F ' } , { ' F ' , ' F ' , ' O ' , ' F ' } , { ' F ' , ' F ' , ' F ' , ' F ' } , } ; print ( arr , 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 ; string removeDuplicateLetters ( string s ) { int cnt [ 26 ] = { 0 } ; int vis [ 26 ] = { 0 } ; int n = s . size ( ) ; for ( int i = 0 ; i < n ; i ++ ) cnt [ s [ i ] - ' a ' ] ++ ; string res = " " ; for ( int i = 0 ; i < n ; i ++ ) { cnt [ s [ i ] - ' a ' ] -- ; if ( ! vis [ s [ i ] - ' a ' ] ) { while ( res . size ( ) > 0 && res . back ( ) > s [ i ] && cnt [ res . back ( ) - ' a ' ] > 0 ) { vis [ res . back ( ) - ' a ' ] = 0 ; res . pop_back ( ) ; } res += s [ i ] ; vis [ s [ i ] - ' a ' ] = 1 ; } } return res ; } int main ( ) { string S = " acbc " ; cout << removeDuplicateLetters ( S ) ; return 0 ; }

Index/key variables: i
Accumulator variables: i, res, stdc
Iterator variables: i
C++ program:
#include <bits/stdc++.h>
using namespace std ; int countPairs ( int arr [ ] , int N ) { int countPowerof2 = 0 ; for ( int i = 0 ; i < N ; i ++ ) { if ( __builtin_popcount ( arr [ i ] ) == 1 ) countPowerof2 ++ ; } int desiredPairs = ( countPowerof2 * ( countPowerof2 - 1 ) ) / 2 ; cout << desiredPairs << ' ▁ ' ; } int main ( ) { int arr [ 4 ] = { 2 , 4 , 7 , 2 } ; int N = sizeof ( arr ) / sizeof ( arr [ 0 ] ) ; countPairs ( arr , N ) ; return 0 ; }

Index/key variables: i
Accumulator variables: countPowerof2, i, stdc
Iterator variables: i
C++ program:
#include <bits/stdc++.h>
using namespace std ; #define MAXN  1000000
int is_prime [ MAXN ] = { 0 } ; int count_of_primes [ MAXN ] = { 0 } ; void sieve ( ) { for ( int i = 3 ; i < MAXN ; i += 2 ) { is_prime [ i ] = 1 ; } for ( int i = 3 ; i * i < MAXN ; i += 2 ) { if ( is_prime [ i ] ) for ( int j = i * i ; j < MAXN ; j += i ) { is_prime [ j ] = 0 ; } } is_prime [ 2 ] = 1 ; for ( int i = 1 ; i < MAXN ; i ++ ) count_of_primes [ i ] = count_of_primes [ i - 1 ] + is_prime [ i ] ; } long long int power ( long long int x , long long int y , long long int p ) { long long result = 1 ; while ( y > 0 ) { if ( y & 1 == 1 ) result = ( result * x ) % p ; x = ( x * x ) % p ; y >>= 1 ; } return result ; } void numberOfWays ( int N ) { long long int count = count_of_primes [ N ] - 1 ; long long int mod = 1000000007 ; long long int answer = power ( 2 , count , mod ) ; if ( N == 1 ) answer = 0 ; cout << answer ; } int main ( ) { sieve ( ) ; int N = 7 ; numberOfWays ( N ) ; return 0 ; }

Index/key variables: MAXN, N, i, j
Accumulator variables: i, j, stdc
Iterator variables: i, j
C++ program:
#include <bits/stdc++.h>
using namespace std ; void maxSumOfSquares ( int N , int S ) { int res = 0 ; if ( S < N S > 9 * N ) { cout << ( -1 ) ; return ; } S = S - N ; int c = 0 ; while ( S > 0 ) { c ++ ; if ( S / 8 > 0 ) { res += 9 * 9 ; S -= 8 ; } else { res += ( S + 1 ) * ( S + 1 ) ; break ; } } res = res + ( N - c ) ; cout << ( res ) ; } int main ( ) { int N = 3 ; int S = 12 ; maxSumOfSquares ( N , S ) ; }

Accumulator variables: S, c, res, stdc
C++ program:
#include <bits/stdc++.h>
using namespace std ; int clearLastBit ( int N , int K ) { int mask = ( -1 << K + 1 ) ; return N = N & mask ; } int main ( ) { int N = 730 , K = 3 ; cout << clearLastBit ( N , K ) ; return 0 ; }

Accumulator variables: stdc
C++ program:
#include <bits/stdc++.h>
using namespace std ; bool isPossible ( int r , int b , int g ) { r = r % 3 ; b = b % 3 ; g = g % 3 ; if ( r == b b == g g == r ) { return true ; } else { return false ; } } int main ( ) { int R = 1 , B = 3 , G = 6 ; if ( isPossible ( R , B , G ) ) { cout << " Yes " << endl ; } else { cout << " No " << endl ; } return 0 ; }

Accumulator variables: stdc
C++ program:
#include <bits/stdc++.h>
using namespace std ; int calculate_steps ( int arr [ ] , int n , int minimum ) { int count = 0 ; for ( int i = 0 ; i < n ; i ++ ) { int val = arr [ i ] ; if ( arr [ i ] > minimum ) { arr [ i ] = arr [ i ] - minimum ; count += arr [ i ] / 5 ; arr [ i ] = arr [ i ] % 5 ; count += arr [ i ] / 2 ; arr [ i ] = arr [ i ] % 2 ; if ( arr [ i ] ) { count ++ ; } } arr [ i ] = val ; } return count ; } int solve ( int arr [ ] , int n ) { sort ( arr , arr + n , greater < int > ( ) ) ; int minimum = arr [ n - 1 ] ; int count1 = 0 , count2 = 0 , count3 = 0 ; count1 = calculate_steps ( arr , n , minimum ) ; count2 = calculate_steps ( arr , n , minimum - 1 ) ; count3 = calculate_steps ( arr , n , minimum - 2 ) ; return min ( count1 , min ( count2 , count3 ) ) ; } int main ( ) { int arr [ ] = { 3 , 6 , 6 } ; int N = sizeof ( arr ) / sizeof ( arr [ 0 ] ) ; cout << solve ( arr , N ) ; }

Index/key variables: i
Accumulator variables: count, i, stdc
Iterator variables: i
C++ program:
#include <bits/stdc++.h>
using namespace std ; string mergePalindromes ( string S , string P ) { unordered_map < char , int > mapS , mapP , mapT ; int n = S . size ( ) , m = P . size ( ) ; for ( int i = 0 ; i < n ; i ++ ) { mapS [ S [ i ] ] ++ ; } for ( int i = 0 ; i < m ; i ++ ) { mapP [ P [ i ] ] ++ ; } for ( char i = ' a ' ; i <= ' z ' ; i ++ ) { if ( mapS [ i ] % 2 == 0 ) { mapT [ i ] += mapS [ i ] ; mapS [ i ] = 0 ; } else { mapT [ i ] += mapS [ i ] - 1 ; mapS [ i ] = 1 ; } if ( mapP [ i ] % 2 == 0 ) { mapT [ i ] += mapP [ i ] ; mapP [ i ] = 0 ; } else { mapT [ i ] += mapP [ i ] - 1 ; mapP [ i ] = 1 ; } } int check = 0 ; for ( char i = ' a ' ; i <= ' z ' ; i ++ ) { if ( mapS [ i ] > 0 && mapP [ i ] > 0 ) { mapT [ i ] += 2 ; check = 1 ; break ; } } string half1 = " " , half2 = " " ; for ( char i = ' a ' ; i <= ' z ' ; i ++ ) { for ( int j = 0 ; ( 2 * j ) < mapT [ i ] ; j ++ ) { half1 += i ; half2 += i ; } } reverse ( half2 . begin ( ) , half2 . end ( ) ) ; if ( check ) { return half1 + half2 ; } for ( char i = ' a ' ; i <= ' z ' ; i ++ ) { if ( mapS [ i ] > 0 mapP [ i ] > 0 ) { half1 += i ; return half1 + half2 ; } } return half1 + half2 ; } int main ( ) { string S = " aeabb " ; string P = " dfedf " ; cout << mergePalindromes ( S , P ) ; return 0 ; }

Index/key variables: i
Accumulator variables: half1, half2, i, j, stdc
Iterator variables: i, j
C++ program:
#include <bits/stdc++.h>
using namespace std ; int countOfSubarray ( int arr [ ] , int N ) { for ( int i = 0 ; i < N ; i ++ ) arr [ i ] -- ; int pref [ N ] ; pref [ 0 ] = arr [ 0 ] ; for ( int i = 1 ; i < N ; i ++ ) pref [ i ] = pref [ i - 1 ] + arr [ i ] ; map < int , int > mp ; int answer = 0 ; mp [ 0 ] ++ ; for ( int i = 0 ; i < N ; i ++ ) { answer += mp [ pref [ i ] ] ; mp [ pref [ i ] ] ++ ; } return answer ; } int main ( ) { int arr [ ] = { 1 , 1 , 0 } ; int N = sizeof arr / sizeof arr [ 0 ] ; cout << countOfSubarray ( arr , N ) ; return 0 ; }

Index/key variables: N, i
Accumulator variables: answer, i, stdc
Iterator variables: i
C++ program:
#include <bits/stdc++.h>
using namespace std ; void printsubset ( int n , int k ) { int count = 0 , x = 0 ; vector < int > vec ; while ( n ) { x = n & 1 ; if ( x ) { vec . push_back ( pow ( k , count ) ) ; } n = n >> 1 ; count ++ ; } for ( int i = 0 ; i < vec . size ( ) ; i ++ ) cout << vec [ i ] << " ▁ " ; } int main ( ) { int n = 7 , k = 4 ; printsubset ( n , k ) ; return 0 ; }

Index/key variables: i
Accumulator variables: count, i, stdc
Iterator variables: i
C++ program:
#include <bits/stdc++.h>
using namespace std ; int solve ( string s , int x , int y ) { int res = 0 ; for ( auto c : s ) { if ( c - '0' == x ) { res ++ ; swap ( x , y ) ; } } if ( x != y && res % 2 == 1 ) -- res ; return res ; } int find_min ( string s ) { int count = 0 ; for ( int i = 0 ; i < 10 ; i ++ ) { for ( int j = 0 ; j < 10 ; j ++ ) { count = max ( count , solve ( s , i , j ) ) ; } } return count ; } int main ( ) { string s = "100120013" ; int n = s . size ( ) ; int answer = find_min ( s ) ; cout << ( n - answer ) ; return 0 ; }

Accumulator variables: i, j, res, stdc
Iterator variables: c, i, j
C++ program:
#include <bits/stdc++.h>
using namespace std ; unsigned int countSetBitsUtil ( unsigned int x ) { if ( x <= 0 ) return 0 ; return ( ( x % 2 == 0 ? 0 : 1 ) + countSetBitsUtil ( x / 2 ) ) ; } unsigned int countSetBits ( unsigned int L , unsigned int R ) { int bitCount = 0 ; for ( int i = L ; i <= R ; i ++ ) { bitCount += countSetBitsUtil ( i ) ; } return bitCount ; } int main ( ) { int L = 3 , R = 5 ; printf ( " Total ▁ set ▁ bit ▁ count ▁ is ▁ % d " , countSetBits ( L , R ) ) ; return 0 ; }

Accumulator variables: bitCount, i, stdc
Iterator variables: i
C++ program:
#include <bits/stdc++.h>
using namespace std ; void values_of_Q ( int X ) { vector < int > val_Q ; for ( int i = 1 ; i <= X ; i ++ ) { if ( ( ( ( X + i ) * X ) ) % i == 0 ) { val_Q . push_back ( X + i ) ; } } cout << val_Q . size ( ) << endl ; for ( int i = 0 ; i < val_Q . size ( ) ; i ++ ) { cout << val_Q [ i ] << " ▁ " ; } } int main ( ) { int X = 3 ; values_of_Q ( X ) ; return 0 ; }

Index/key variables: i
Accumulator variables: i, stdc
Iterator variables: i
C++ program:
#include <bits/stdc++.h>
using namespace std ; string gcd ( string str1 , string str2 ) { if ( str1 . length ( ) < str2 . length ( ) ) { return gcd ( str2 , str1 ) ; } else if ( str1 . find ( str2 ) != 0 ) { return " " ; } else if ( str2 == " " ) { return str1 ; } else { return gcd ( str1 . substr ( str2 . length ( ) ) , str2 ) ; } } string findGCD ( string arr [ ] , int n ) { string result = arr [ 0 ] ; for ( int i = 1 ; i < n ; i ++ ) { result = gcd ( result , arr [ i ] ) ; } return result ; } int main ( ) { string arr [ ] = { " GFGGFG " , " GFGGFG " , " GFGGFGGFGGFG " } ; int n = sizeof ( arr ) / sizeof ( arr [ 0 ] ) ; cout << findGCD ( arr , n ) ; }

Index/key variables: i
Accumulator variables: i, stdc
Iterator variables: i
C++ program:
#include <bits/stdc++.h>
using namespace std ; #define N  4
#define M  4
string balancedMatrix ( int mat [ ] [ M ] ) { bool is_balanced = true ; for ( int i = 0 ; i < N && is_balanced ; i ++ ) { for ( int j = 0 ; j < M && is_balanced ; j ++ ) { if ( ( i == 0 i == N - 1 ) && ( j == 0 j == M - 1 ) ) { if ( mat [ i ] [ j ] >= 2 ) is_balanced = false ; } else if ( i == 0 i == N - 1 j == 0 j == M - 1 ) { if ( mat [ i ] [ j ] >= 3 ) is_balanced = false ; } else { if ( mat [ i ] [ j ] >= 4 ) is_balanced = false ; } } } if ( is_balanced ) return " Balanced " ; else return " Unbalanced " ; } int main ( ) { int mat [ N ] [ M ] = { { 1 , 2 , 3 , 4 } , { 3 , 5 , 2 , 6 } , { 5 , 3 , 6 , 1 } , { 9 , 5 , 6 , 0 } } ; cout << balancedMatrix ( mat ) ; return 0 ; }

Index/key variables: M, N, i, j
Accumulator variables: i, j, stdc
Iterator variables: i, j
Boolean variables: is_balanced
C++ program:
#include <bits/stdc++.h>
using namespace std ; string unixTimeToHumanReadable ( long int seconds ) { string ans = " " ; int daysOfMonth [ ] = { 31 , 28 , 31 , 30 , 31 , 30 , 31 , 31 , 30 , 31 , 30 , 31 } ; long int currYear , daysTillNow , extraTime , extraDays , index , date , month , hours , minutes , secondss , flag = 0 ; daysTillNow = seconds / ( 24 * 60 * 60 ) ; extraTime = seconds % ( 24 * 60 * 60 ) ; currYear = 1970 ; while ( daysTillNow >= 365 ) { if ( currYear % 400 == 0 || ( currYear % 4 == 0 && currYear % 100 != 0 ) ) { daysTillNow -= 366 ; } else { daysTillNow -= 365 ; } currYear += 1 ; } extraDays = daysTillNow + 1 ; if ( currYear % 400 == 0 || ( currYear % 4 == 0 && currYear % 100 != 0 ) ) flag = 1 ; month = 0 , index = 0 ; if ( flag == 1 ) { while ( true ) { if ( index == 1 ) { if ( extraDays - 29 < 0 ) break ; month += 1 ; extraDays -= 29 ; } else { if ( extraDays - daysOfMonth [ index ] < 0 ) { break ; } month += 1 ; extraDays -= daysOfMonth [ index ] ; } index += 1 ; } } else { while ( true ) { if ( extraDays - daysOfMonth [ index ] < 0 ) { break ; } month += 1 ; extraDays -= daysOfMonth [ index ] ; index += 1 ; } } if ( extraDays > 0 ) { month += 1 ; date = extraDays ; } else { if ( month == 2 && flag == 1 ) date = 29 ; else { date = daysOfMonth [ month - 1 ] ; } } hours = extraTime / 3600 ; minutes = ( extraTime % 3600 ) / 60 ; secondss = ( extraTime % 3600 ) % 60 ; ans += to_string ( date ) ; ans += " / " ; ans += to_string ( month ) ; ans += " / " ; ans += to_string ( currYear ) ; ans += " ▁ " ; ans += to_string ( hours ) ; ans += " : " ; ans += to_string ( minutes ) ; ans += " : " ; ans += to_string ( secondss ) ; return ans ; } int main ( ) { long int T = 1595497956 ; string ans = unixTimeToHumanReadable ( T ) ; cout << ans << " STRNEWLINE " ; return 0 ; }

Index/key variables: index
Accumulator variables: ans, currYear, daysTillNow, extraDays, index, month, stdc
C++ program:
#include <bits/stdc++.h>
using namespace std ; double AreaofRectangle ( int L , int W ) { double area = ( W + L ) * ( W + L ) / 2 ; return area ; } int main ( ) { int L = 18 ; int W = 12 ; cout << AreaofRectangle ( L , W ) ; return 0 ; }

Accumulator variables: stdc
C++ program:
#include <bits/stdc++.h>
using namespace std ; int downToZero ( int n ) { if ( n <= 3 ) return n ; vector < int > dp ( n + 1 , -1 ) ; dp [ 0 ] = 0 ; dp [ 1 ] = 1 ; dp [ 2 ] = 2 ; dp [ 3 ] = 3 ; int sqr ; for ( int i = 4 ; i <= n ; i ++ ) { sqr = sqrt ( i ) ; int best = INT_MAX ; while ( sqr > 1 ) { if ( i % sqr == 0 ) { best = min ( best , 1 + dp [ sqr ] ) ; } sqr -- ; } best = min ( best , 1 + dp [ i - 1 ] ) ; dp [ i ] = best ; } return dp [ n ] ; } int main ( ) { int n = 4 ; cout << downToZero ( n ) ; return 0 ; }

Index/key variables: i, n, sqr
Accumulator variables: i, sqr, stdc
Iterator variables: i
C++ program:
#include <bits/stdc++.h>
using namespace std ; int downToZero ( int n ) { if ( n <= 3 ) return n ; return n % 2 == 0 ? 3 : 4 ; } int main ( ) { int n = 4 ; cout << downToZero ( n ) ; return 0 ; }

Accumulator variables: stdc
C++ program:
#include <bits/stdc++.h>
using namespace std ; int minimumrequired ( int A [ ] , int N ) { int K = N ; int ans ; while ( K > 0 ) { if ( K % 2 == 1 ) { ans = K ; break ; } bool ispalindrome = 1 ; for ( int i = 0 ; i < K / 2 ; i ++ ) { if ( A [ i ] != A [ K - 1 - i ] ) ispalindrome = 0 ; } if ( ispalindrome ) { ans = K / 2 ; K /= 2 ; } else { ans = K ; break ; } } return ans ; } int main ( ) { int a [ ] = { 1 , 2 , 2 , 1 , 1 , 2 , 2 , 1 } ; int N = sizeof a / sizeof a [ 0 ] ; cout << minimumrequired ( a , N ) ; return 0 ; }

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