dhyuti-n/xlcost-variable-roles huggingface dataset:
C++ program:
#include <bits/stdc++.h>
using namespace std ; int Reduced ( vector < int > a , int n ) { vector < int > original_array ; original_array = a ; while ( a . size ( ) != 2 ) { int mid = a . size ( ) / 2 ; int mid_ele = a [ mid ] ; int start = a [ 0 ] ; a . erase ( a . begin ( ) ) ; int end = a [ a . size ( ) - 1 ] ; a . pop_back ( ) ; int rmd = ( start * end ) % mid_ele ; a . push_back ( rmd ) ; int remainder = ( a [ 0 ] * a [ 1 ] ) % n ; for ( int i = 0 ; i < original_array . size ( ) ; i ++ ) { if ( original_array [ i ] == remainder ) { return 1 ; } } } return 0 ; } int main ( ) { vector < int > Arr = { 2 , 3 , 4 , 8 , 5 , 7 } ; int N = Arr . size ( ) ; int x = Reduced ( Arr , N ) ; if ( x ) cout << ( " YES " ) ; else cout << ( " NO " ) ; return 0 ; }

Index/key variables: i, mid
Accumulator variables: i, stdc
Iterator variables: i
C++ program:
#include <bits/stdc++.h>
#define MaxBit  32
using namespace std ; int possiblePair ( int X , int Y ) { int Z = Y - X ; if ( Z < 0 ) { cout << " - 1" ; return 0 ; } for ( int k = 0 ; k < MaxBit ; k ++ ) { int bit1 = ( Z >> k ) & 1 ; int bit2 = ( Z >> k ) & 1 ; if ( bit1 && ! bit2 ) { cout << " - 1" ; return 0 ; } } cout << Z << ' ▁ ' << X ; return 0 ; } int main ( ) { int X = 7 , Y = 11 ; possiblePair ( X , Y ) ; return 0 ; }

Accumulator variables: k, stdc
Iterator variables: k
C++ program:
#include <bits/stdc++.h>
using namespace std ; void maxFrequencySubarrayUtil ( vector < int > A , int N , int M ) { int i = 0 ; unordered_map < int , int > m ; int val = 0 ; for ( ; i < M ; i ++ ) { m [ A [ i ] ] ++ ; val = max ( val , m [ A [ i ] ] ) ; } cout << val << " ▁ " ; for ( i = M ; i < N ; i ++ ) { m [ A [ i - M ] ] -- ; m [ A [ i ] ] ++ ; val = 0 ; for ( auto x : m ) { val = max ( val , x . second ) ; } cout << val << " ▁ " ; } } int main ( ) { vector < int > A = { 1 , 1 , 2 , 2 , 3 , 5 } ; int N = A . size ( ) ; int M = 4 ; maxFrequencySubarrayUtil ( A , N , M ) ; return 0 ; }

Index/key variables: i
Accumulator variables: i, stdc
Iterator variables: i, x
C++ program:
#include <bits/stdc++.h>
using namespace std ; int maximumPairs ( int a [ ] , int n ) { map < int , int > freq ; int count = 0 ; for ( int i = 0 ; i < n ; ++ i ) freq [ a [ i ] ] ++ ; priority_queue < int > pq ; for ( auto itr = freq . begin ( ) ; itr != freq . end ( ) ; itr ++ ) { pq . push ( itr -> second ) ; } while ( pq . size ( ) > 1 ) { int freq1 = pq . top ( ) ; pq . pop ( ) ; int freq2 = pq . top ( ) ; pq . pop ( ) ; count ++ ; freq1 -- ; freq2 -- ; if ( freq1 > 0 ) pq . push ( freq1 ) ; if ( freq2 > 0 ) pq . push ( freq2 ) ; } return count ; } int main ( ) { int arr [ ] = { 4 , 2 , 4 , 1 , 4 , 3 } ; int N = sizeof ( arr ) / sizeof ( arr [ 0 ] ) ; cout << maximumPairs ( arr , N ) ; return 0 ; }

Index/key variables: i
Accumulator variables: count, freq1, freq2, itr, stdc
Iterator variables: i, itr
C++ program:
#include <bits/stdc++.h>
using namespace std ; struct Node { int data ; Node * left , * right ; Node ( int val ) { data = val ; left = right = NULL ; } } ; Node * getNewNode ( int val ) { Node * newNode = new Node ( val ) ; newNode -> data = val ; newNode -> left = newNode -> right = NULL ; return newNode ; } Node * buildPerfectBT_helper ( int preStart , int preEnd , int pre [ ] ) { if ( preStart > preEnd ) return NULL ; Node * root = getNewNode ( pre [ preStart ] ) ; ; if ( preStart == preEnd ) return root ; int leftPreStart = preStart + 1 ; int rightPreStart = leftPreStart + ( preEnd - leftPreStart + 1 ) / 2 ; int leftPreEnd = rightPreStart - 1 ; int rightPreEnd = preEnd ; root -> left = buildPerfectBT_helper ( leftPreStart , leftPreEnd , pre ) ; root -> right = buildPerfectBT_helper ( rightPreStart , rightPreEnd , pre ) ; return root ; } Node * buildPerfectBT ( int pre [ ] , int size ) { return buildPerfectBT_helper ( 0 , size - 1 , pre ) ; } void printInorder ( Node * root ) { if ( ! root ) return ; printInorder ( root -> left ) ; cout << root -> data << " ▁ " ; printInorder ( root -> right ) ; } int main ( ) { int pre [ ] = { 1 , 2 , 4 , 5 , 3 , 6 , 7 } ; int N = sizeof ( pre ) / sizeof ( pre [ 0 ] ) ; Node * root = buildPerfectBT ( pre , N ) ; cout << " Inorder traversal of the tree : " ; printInorder ( root ) ; return 0 ; }

Index/key variables: preStart
Accumulator variables: stdc
Class/struct names: Node
C++ program:
#include <bits/stdc++.h>
using namespace std ; int countOperations ( int N , int M ) { bool visited [ 100001 ] ; fill ( visited , visited + 100001 , false ) ; queue < pair < int , int > > Q ; Q . push ( make_pair ( N , 0 ) ) ; visited [ N ] = true ; while ( ! Q . empty ( ) ) { int aux = Q . front ( ) . first ; int cont = Q . front ( ) . second ; Q . pop ( ) ; if ( aux == M ) return cont ; for ( int i = 2 ; i * i <= aux ; i ++ ) if ( aux % i == 0 ) { if ( aux + i <= M && ! visited [ aux + i ] ) { Q . push ( make_pair ( aux + i , cont + 1 ) ) ; visited [ aux + i ] = true ; } if ( aux + aux / i <= M && ! visited [ aux + aux / i ] ) { Q . push ( make_pair ( aux + aux / i , cont + 1 ) ) ; visited [ aux + aux / i ] = true ; } } } return -1 ; } int main ( ) { int N = 4 , M = 24 ; cout << countOperations ( N , M ) ; return 0 ; }

Index/key variables: N
Accumulator variables: i, stdc
Iterator variables: i
C++ program:
#include <bits/stdc++.h>
using namespace std ; void dfs ( int v , vector < vector < int > > & adj , vector < bool > & visited , int & num ) { visited [ v ] = true ; num ++ ; for ( int i = 0 ; i < adj [ v ] . size ( ) ; i ++ ) { if ( ! visited [ adj [ v ] [ i ] ] ) { dfs ( adj [ v ] [ i ] , adj , visited , num ) ; } } } void numberOfPairs ( int N , vector < vector < int > > arr ) { vector < vector < int > > adj ( N ) ; for ( vector < int > & i : arr ) { adj [ i [ 0 ] ] . push_back ( i [ 1 ] ) ; adj [ i [ 1 ] ] . push_back ( i [ 0 ] ) ; } vector < bool > visited ( N ) ; vector < int > v ; int num = 0 ; for ( int i = 0 ; i < N ; i ++ ) { if ( ! visited [ i ] ) { dfs ( i , adj , visited , num ) ; v . push_back ( num ) ; num = 0 ; } } int ans = N * ( N - 1 ) / 2 ; for ( int i : v ) { ans -= ( i * ( i - 1 ) / 2 ) ; } cout << ans ; } int main ( ) { int N = 6 ; vector < vector < int > > arr = { { 0 , 1 } , { 0 , 2 } , { 2 , 5 } } ; numberOfPairs ( N , arr ) ; return 0 ; }

Index/key variables: i, v
Accumulator variables: ans, i, num, stdc
Iterator variables: i
C++ program:
#include <bits/stdc++.h>
using namespace std ; const int MAX = 100005 ; bool isPerfect ( long long int N ) { long long int sum = 1 ; for ( long long int i = 2 ; i * i <= N ; i ++ ) { if ( N % i == 0 ) { if ( i * i != N ) sum = sum + i + N / i ; else sum = sum + i ; } } if ( sum == N && N != 1 ) return true ; return false ; } void Query ( int arr [ ] [ 2 ] , int N ) { int prefix [ MAX + 1 ] = { 0 } ; for ( int i = 2 ; i <= MAX ; i ++ ) { prefix [ i ] = prefix [ i - 1 ] + isPerfect ( i ) ; } for ( int i = 0 ; i < N ; i ++ ) { cout << prefix [ arr [ i ] [ 1 ] ] - prefix [ arr [ i ] [ 0 ] - 1 ] << " ▁ " ; } } int main ( ) { int arr [ ] [ 2 ] = { { 1 , 1000 } , { 1000 , 2000 } , { 2000 , 3000 } } ; int N = sizeof ( arr ) / sizeof ( arr [ 0 ] ) ; Query ( arr , N ) ; }

Index/key variables: i
Accumulator variables: i, stdc
Iterator variables: i
C++ program:
#include <bits/stdc++.h>
using namespace std ; int minSteps ( int N ) { int ans = 0 ; for ( int d = 2 ; d * d <= N ; d ++ ) { while ( N % d == 0 ) { ans += d ; N /= d ; } } if ( N != 1 ) { ans += N ; } return ans ; } int main ( ) { int N = 3 ; cout << minSteps ( N ) ; return 0 ; }

Accumulator variables: N, ans, d, stdc
Iterator variables: d
C++ program:
#include <bits/stdc++.h>
using namespace std ; void Create_Rectangle ( vector < string > arr , int n ) { pair < int , int > p1 = { -1 , -1 } ; pair < int , int > p2 = { -1 , -1 } ; pair < int , int > p3 ; pair < int , int > p4 ; for ( int i = 0 ; i < n ; i ++ ) { for ( int j = 0 ; j < n ; j ++ ) { if ( arr [ i ] [ j ] == '1' ) if ( p1 . first == -1 ) p1 = { i , j } ; else p2 = { i , j } ; } } p3 = p1 ; p4 = p2 ; if ( p1 . first == p2 . first ) { p3 . first = ( p1 . first + 1 ) % n ; p4 . first = ( p2 . first + 1 ) % n ; } else if ( p1 . second == p2 . second ) { p3 . second = ( p1 . second + 1 ) % n ; p4 . second = ( p2 . second + 1 ) % n ; } else { swap ( p3 . first , p4 . first ) ; } arr [ p3 . first ] [ p3 . second ] = '1' ; arr [ p4 . first ] [ p4 . second ] = '1' ; for ( int i = 0 ; i < n ; i ++ ) { cout << arr [ i ] << endl ; } } int main ( ) { int n = 4 ; vector < string > arr { "0010" , "0000" , "1000" , "0000" } ; Create_Rectangle ( 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 SumOfPrimeDivisors ( int n ) { int sum = 0 ; if ( n % 2 == 0 ) { sum = sum + 2 ; } while ( n % 2 == 0 ) { n = n / 2 ; } for ( int i = 3 ; i <= sqrt ( n ) ; i = i + 2 ) { if ( n % i == 0 ) { sum = sum + i ; } while ( n % i == 0 ) { n = n / i ; } } if ( n > 2 ) { sum = sum + n ; } return sum ; } int main ( ) { int n = 10 ; cout << SumOfPrimeDivisors ( n ) ; return 0 ; }

Accumulator variables: stdc
Iterator variables: i
C++ program:
#include <bits/stdc++.h>
using namespace std ; int countOfBase ( int N ) { int count = 0 ; for ( int i = 2 ; i <= N ; ++ i ) { int highestPower = ( int ) ( log ( N ) / log ( i ) ) ; int firstDigit = N / ( int ) pow ( i , highestPower ) ; if ( firstDigit == 1 ) { ++ count ; } } return count ; } int main ( ) { int N = 6 ; cout << countOfBase ( N ) ; return 0 ; }

Accumulator variables: stdc
Iterator variables: i
C++ program:
#include <bits/stdc++.h>
using namespace std ; void kthDigitFromLast ( int n , int k ) { if ( k <= 0 ) { cout << -1 << endl ; return ; } string temp = to_string ( n ) ; if ( k > temp . length ( ) ) { cout << -1 << endl ; } else { cout << temp [ temp . length ( ) - k ] - '0' ; } } int main ( ) { int n = 2354 ; int k = 2 ; kthDigitFromLast ( n , k ) ; }

Accumulator variables: stdc
C++ program:
#include <bits/stdc++.h>
using namespace std ; int countWays ( int arr [ ] , int N ) { int arr_xor = 0 ; for ( int i = 0 ; i < N ; i ++ ) arr_xor ^= arr [ i ] ; int pref_xor = 0 , suff_xor = 0 ; vector < int > pref_ind ; int suff_inds [ N + 1 ] ; memset ( suff_inds , 0 , sizeof suff_inds ) ; for ( int i = 0 ; i < N ; i ++ ) { pref_xor ^= arr [ i ] ; if ( pref_xor == arr_xor ) pref_ind . push_back ( i ) ; } for ( int i = N - 1 ; i >= 0 ; i -- ) { suff_xor ^= arr [ i ] ; suff_inds [ i ] += suff_inds [ i + 1 ] ; if ( suff_xor == arr_xor ) suff_inds [ i ] ++ ; } int tot_ways = 0 ; for ( int idx : pref_ind ) { if ( idx < N - 1 ) tot_ways += suff_inds [ idx + 2 ] ; } return tot_ways ; } int main ( ) { int arr [ ] = { 7 , 0 , 5 , 2 , 7 } ; int N = sizeof ( arr ) / sizeof ( arr [ 0 ] ) ; cout << countWays ( arr , N ) ; return 0 ; }

Index/key variables: i
Accumulator variables: arr_xor, i, pref_xor, stdc, suff_xor, tot_ways
Iterator variables: i, idx
C++ program:
#include <bits/stdc++.h>
using namespace std ; int dp [ 1000 ] [ 2 ] ; int IsSumEqualsXor ( int i , int n , bool bound , string & s ) { if ( i == n ) return 1 ; if ( dp [ i ] [ bound ] != -1 ) return dp [ i ] [ bound ] ; int ans = 0 ; if ( bound and s [ i ] == '0' ) { ans = IsSumEqualsXor ( i + 1 , n , 1 , s ) ; } else { ans = 2 * IsSumEqualsXor ( i + 1 , n , bound & ( s [ i ] == '1' ) , s ) ; ans += IsSumEqualsXor ( i + 1 , n , 0 , s ) ; } return dp [ i ] [ bound ] = ans ; } string convertToBinary ( int n ) { string ans ; while ( n ) { char rem = char ( n % 2 + '0' ) ; ans . push_back ( rem ) ; n /= 2 ; } reverse ( ans . begin ( ) , ans . end ( ) ) ; return ans ; } void IsSumEqualsXorUtil ( int N ) { string s = convertToBinary ( N ) ; memset ( dp , -1 , sizeof dp ) ; cout << IsSumEqualsXor ( 0 , s . size ( ) , 1 , s ) << endl ; } int main ( ) { int N = 10 ; IsSumEqualsXorUtil ( N ) ; return 0 ; }

Index/key variables: bound, i
Accumulator variables: ans, n, stdc
C++ program:
#include <bits/stdc++.h>
using namespace std ; void printMat ( int degseq [ ] , int n ) { int mat [ n ] [ n ] ; memset ( mat , 0 , sizeof ( mat ) ) ; for ( int i = 0 ; i < n ; i ++ ) { for ( int j = i + 1 ; j < n ; j ++ ) { if ( degseq [ i ] > 0 && degseq [ j ] > 0 ) { degseq [ i ] -- ; degseq [ j ] -- ; mat [ i ] [ j ] = 1 ; mat [ j ] [ i ] = 1 ; } } } cout << " STRNEWLINE " << setw ( 3 ) << " TABSYMBOL " ; for ( int i = 0 ; i < n ; i ++ ) cout << setw ( 3 ) << " ( " << i << " ) " ; cout << " STRNEWLINE STRNEWLINE " ; for ( int i = 0 ; i < n ; i ++ ) { cout << setw ( 4 ) << " ( " << i << " ) " ; for ( int j = 0 ; j < n ; j ++ ) cout << setw ( 5 ) << mat [ i ] [ j ] ; cout << " STRNEWLINE " ; } } int main ( ) { int degseq [ ] = { 2 , 2 , 1 , 1 , 1 } ; int n = sizeof ( degseq ) / sizeof ( degseq [ 0 ] ) ; printMat ( degseq , n ) ; 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 findDecimal ( float arr [ ] , int N ) { int bit , power = 0 , result = 0 ; for ( int i = N - 1 ; i >= 0 ; i -- ) { bit = abs ( floor ( arr [ i ] ) - round ( arr [ i ] ) ) ; if ( bit ) result += pow ( 2 , power ) ; power ++ ; } cout << result ; } int main ( ) { float arr [ ] = { 1.2 , 2.6 , 4.2 , 6.9 , 3.1 , 21.6 , 91.2 } ; int N = sizeof ( arr ) / sizeof ( arr [ 0 ] ) ; findDecimal ( arr , N ) ; return 0 ; }

Index/key variables: i
Accumulator variables: i, power, result, stdc
Iterator variables: i
C++ program:
#include <iostream>
using namespace std ; int totalMoney ( int N ) { int ans = 0 ; for ( int i = 0 ; i < N ; i ++ ) { ans += i / 7 ; ans += ( i % 7 + 1 ) ; } return ans ; } int main ( ) { int N = 15 ; cout << totalMoney ( N ) ; }

Accumulator variables: ans, i
Iterator variables: i
C++ program:
#include <bits/stdc++.h>
using namespace std ; int totalMoney ( int N ) { int CompWeeks = N / 7 ; int RemDays = N % 7 ; int X = 28 * CompWeeks + 7 * ( CompWeeks * ( CompWeeks - 1 ) / 2 ) ; int Y = RemDays * ( RemDays + 1 ) / 2 + CompWeeks * RemDays ; int cost = X + Y ; cout << cost << ' ' ; } int main ( ) { int N = 15 ; totalMoney ( N ) ; return 0 ; }

Accumulator variables: stdc
C++ program:
#include <bits/stdc++.h>
using namespace std ; struct pairr { int count , prevIndex ; pairr ( int countt , int prevIndexx ) { count = countt ; prevIndex = prevIndexx ; } } ; void findSum ( int arr [ ] , int n ) { map < int , pairr * > mapp ; int left [ n ] ; int right [ n ] ; for ( int i = 0 ; i < n ; i ++ ) { if ( mapp . find ( arr [ i ] ) == mapp . end ( ) ) { left [ i ] = 0 ; mapp [ arr [ i ] ] = new pairr ( 1 , i ) ; } else { pairr * tmp = mapp [ arr [ i ] ] ; left [ i ] = ( tmp -> count ) * ( i - tmp -> prevIndex ) + left [ tmp -> prevIndex ] ; mapp [ arr [ i ] ] = new pairr ( tmp -> count + 1 , i ) ; } } mapp . clear ( ) ; for ( int i = n - 1 ; i >= 0 ; i -- ) { if ( mapp . find ( arr [ i ] ) == mapp . end ( ) ) { right [ i ] = 0 ; mapp [ arr [ i ] ] = new pairr ( 1 , i ) ; } else { pairr * tmp = mapp [ arr [ i ] ] ; right [ i ] = ( tmp -> count ) * ( abs ( i - tmp -> prevIndex ) ) + right [ tmp -> prevIndex ] ; mapp [ arr [ i ] ] = new pairr ( tmp -> count + 1 , i ) ; } } for ( int i = 0 ; i < n ; i ++ ) cout << left [ i ] + right [ i ] << " ▁ " ; } int main ( ) { int arr [ ] = { 1 , 3 , 1 , 1 , 2 } ; int N = 5 ; findSum ( arr , N ) ; }

Index/key variables: i, n
Accumulator variables: i, stdc
Iterator variables: i
Class/struct names: pairr
C++ program:
#include <bits/stdc++.h>
using namespace std ; int isPresent ( int n , int x ) { string num = to_string ( n ) ; for ( int i = 0 ; i < num . size ( ) ; i ++ ) { if ( ( num [ i ] - '0' ) == x ) return i ; } return -1 ; } int removeDigit ( int n , int index ) { string num = to_string ( n ) ; string ans = " " ; for ( int i = 0 ; i < num . size ( ) ; i ++ ) { if ( i != index ) ans += num [ i ] ; } if ( ans == " " || ( ans . size ( ) == 1 && ans [ 0 ] == '0' ) ) return -1 ; int x = stoi ( ans ) ; return x ; } bool reduceNtoX ( int a , int b , int d [ ] , int n ) { queue < int > q ; q . push ( a ) ; unordered_map < int , bool > visited ; visited [ a ] = true ; while ( ! q . empty ( ) ) { int top = q . front ( ) ; q . pop ( ) ; if ( top < 0 ) continue ; if ( top == b ) return true ; for ( int i = 0 ; i < n ; i ++ ) { if ( d [ i ] != 0 && top % d [ i ] == 0 && ! visited [ top / d [ i ] ] ) { q . push ( top / d [ i ] ) ; visited [ top / d [ i ] ] = true ; } int index = isPresent ( top , d [ i ] ) ; if ( index != -1 ) { int newElement = removeDigit ( top , index ) ; if ( newElement != -1 && ( ! visited [ newElement ] ) ) { q . push ( newElement ) ; visited [ newElement ] = true ; } } } } return false ; } int main ( ) { int A = 5643 , B = 81 ; int D [ ] = { 3 , 8 , 1 } ; int N = sizeof ( D ) / sizeof ( D [ 0 ] ) ; if ( reduceNtoX ( A , B , D , N ) ) cout << " Yes " ; else cout << " No " ; return 0 ; }

Index/key variables: a, i, newElement
Accumulator variables: ans, i, stdc
Iterator variables: i
C++ program:
#include <bits/stdc++.h>
using namespace std ; bool prime [ 100000 ] ; void SieveOfEratosthenes ( int n ) { memset ( prime , true , sizeof ( prime ) ) ; for ( int p = 2 ; p * p <= n ; p ++ ) { if ( prime [ p ] == true ) { for ( int i = p * p ; i <= n ; i += p ) { prime [ i ] = false ; } } } } void findTriplets ( int N ) { SieveOfEratosthenes ( N ) ; vector < vector < int > > V ; for ( int i = 3 ; i <= N ; i ++ ) { if ( 2 + i <= N && prime [ i ] && prime [ 2 + i ] ) { V . push_back ( { 2 , i , i + 2 } ) ; } } for ( int i = 0 ; i < V . size ( ) ; i ++ ) { cout << V [ i ] [ 0 ] << " ▁ " << V [ i ] [ 1 ] << " ▁ " << V [ i ] [ 2 ] << " STRNEWLINE " ; } } int main ( ) { int N = 8 ; findTriplets ( N ) ; return 0 ; }

Index/key variables: i, p
Accumulator variables: i, p, stdc
Iterator variables: i, p
C++ program:
#include <bits/stdc++.h>
using namespace std ; const int MAX = 100000 ; vector < int > adj [ MAX ] ; vector < int > adjInv [ MAX ] ; bool visited [ MAX ] ; bool visitedInv [ MAX ] ; stack < int > s ; int scc [ MAX ] ; int counter = 1 ; void addEdges ( int a , int b ) { adj [ a ] . push_back ( b ) ; } void addEdgesInverse ( int a , int b ) { adjInv [ b ] . push_back ( a ) ; } void dfsFirst ( int u ) { if ( visited [ u ] ) return ; visited [ u ] = 1 ; for ( int i = 0 ; i < adj [ u ] . size ( ) ; i ++ ) dfsFirst ( adj [ u ] [ i ] ) ; s . push ( u ) ; } void dfsSecond ( int u ) { if ( visitedInv [ u ] ) return ; visitedInv [ u ] = 1 ; for ( int i = 0 ; i < adjInv [ u ] . size ( ) ; i ++ ) dfsSecond ( adjInv [ u ] [ i ] ) ; scc [ u ] = counter ; } void is2Satisfiable ( int n , int m , int a [ ] , int b [ ] ) { for ( int i = 0 ; i < m ; i ++ ) { if ( a [ i ] > 0 && b [ i ] > 0 ) { addEdges ( a [ i ] + n , b [ i ] ) ; addEdgesInverse ( a [ i ] + n , b [ i ] ) ; addEdges ( b [ i ] + n , a [ i ] ) ; addEdgesInverse ( b [ i ] + n , a [ i ] ) ; } else if ( a [ i ] > 0 && b [ i ] < 0 ) { addEdges ( a [ i ] + n , n - b [ i ] ) ; addEdgesInverse ( a [ i ] + n , n - b [ i ] ) ; addEdges ( - b [ i ] , a [ i ] ) ; addEdgesInverse ( - b [ i ] , a [ i ] ) ; } else if ( a [ i ] < 0 && b [ i ] > 0 ) { addEdges ( - a [ i ] , b [ i ] ) ; addEdgesInverse ( - a [ i ] , b [ i ] ) ; addEdges ( b [ i ] + n , n - a [ i ] ) ; addEdgesInverse ( b [ i ] + n , n - a [ i ] ) ; } else { addEdges ( - a [ i ] , n - b [ i ] ) ; addEdgesInverse ( - a [ i ] , n - b [ i ] ) ; addEdges ( - b [ i ] , n - a [ i ] ) ; addEdgesInverse ( - b [ i ] , n - a [ i ] ) ; } } for ( int i = 1 ; i <= 2 * n ; i ++ ) if ( ! visited [ i ] ) dfsFirst ( i ) ; while ( ! s . empty ( ) ) { int n = s . top ( ) ; s . pop ( ) ; if ( ! visitedInv [ n ] ) { dfsSecond ( n ) ; counter ++ ; } } for ( int i = 1 ; i <= n ; i ++ ) { if ( scc [ i ] == scc [ i + n ] ) { cout << " The ▁ given ▁ expression ▁ " " is ▁ unsatisfiable . " << endl ; return ; } } cout << " The ▁ given ▁ expression ▁ is ▁ satisfiable . " << endl ; return ; } int main ( ) { int n = 5 , m = 7 ; int a [ ] = { 1 , -2 , -1 , 3 , -3 , -4 , -3 } ; int b [ ] = { 2 , 3 , -2 , 4 , 5 , -5 , 4 } ; is2Satisfiable ( n , m , a , b ) ; return 0 ; }

Index/key variables: MAX, a, b, i, n, u
Accumulator variables: counter, i, stdc
Iterator variables: i
C++ program:
#include <bits/stdc++.h>
using namespace std ; #define ll  long long int
#define MAX  50
bool isPrime ( ll n ) { if ( n <= 1 ) return false ; if ( n <= 3 ) return true ; if ( n % 2 == 0 n % 3 == 0 ) return false ; for ( ll i = 5 ; i * i <= n ; i = i + 6 ) if ( n % i == 0 || n % ( i + 2 ) == 0 ) return false ; return true ; } void findPrime ( vector < ll > & primes ) { for ( ll i = 2 ; i <= MAX ; i ++ ) { if ( isPrime ( i ) ) primes . push_back ( i ) ; } } ll gcd ( ll a , ll b ) { if ( b == 0 ) return a ; else return gcd ( b , a % b ) ; } void findMinimumNumber ( ll arr [ ] , ll N ) { vector < ll > primes ; findPrime ( primes ) ; ll ans = INT_MAX ; ll n = primes . size ( ) ; for ( ll i = 1 ; i < ( 1 << n ) ; i ++ ) { ll temp = 1 ; for ( ll j = 0 ; j < n ; j ++ ) { if ( i & ( 1 << j ) ) { temp *= primes [ j ] ; } } bool check = true ; for ( ll k = 0 ; k < N ; k ++ ) { if ( gcd ( temp , arr [ k ] ) == 1 ) { check = false ; break ; } } if ( check ) ans = min ( ans , temp ) ; } cout << ans ; } int main ( ) { ll arr [ ] = { 3 , 4 , 6 , 7 , 8 , 9 , 10 } ; ll N = sizeof ( arr ) / sizeof ( arr [ 0 ] ) ; findMinimumNumber ( arr , N ) ; return 0 ; }

Index/key variables: j, k
Accumulator variables: i, j, k, stdc, temp
Iterator variables: i, j, k
Boolean variables: check
C++ program:
#include <bits/stdc++.h>
using namespace std ; #define R  100005
int arr [ R ] ; bool canExpress ( int N ) { int temp = N ; int n = 0 ; while ( N != 0 ) { N /= 10 ; n ++ ; } N = temp ; int sum = 0 ; while ( N != 0 ) { sum += pow ( N % 10 , n ) ; N /= 10 ; } return ( sum == temp ) ; } void precompute ( ) { for ( int i = 1 ; i < R ; i ++ ) { if ( canExpress ( i ) ) { arr [ i ] = 1 ; } } for ( int i = 1 ; i < R ; i ++ ) { arr [ i ] += arr [ i - 1 ] ; } } void countNumbers ( int queries [ ] [ 2 ] , int N ) { precompute ( ) ; for ( int i = 0 ; i < N ; i ++ ) { int L1 = queries [ i ] [ 0 ] ; int R1 = queries [ i ] [ 1 ] ; cout << ( arr [ R1 ] - arr [ L1 - 1 ] ) << ' ▁ ' ; } } int main ( ) { int queries [ ] [ 2 ] = { { 1 , 400 } , { 1 , 9 } } ; int N = sizeof ( queries ) / sizeof ( queries [ 0 ] ) ; countNumbers ( queries , N ) ; return 0 ; }

Index/key variables: R, R1, i
Accumulator variables: N, i, n, stdc, sum
Iterator variables: i
C++ program:
#include <iostream>
#include <vector>
using namespace std ; void sumOfNodeInAPath ( int node_value ) { int sum_of_node = 0 ; while ( node_value ) { sum_of_node += node_value ; node_value /= 2 ; } cout << sum_of_node ; return ; } void findSum ( vector < int > Q ) { for ( int i = 0 ; i < Q . size ( ) ; i ++ ) { int node_value = Q [ i ] ; sumOfNodeInAPath ( node_value ) ; cout << " ▁ " ; } } int main ( ) { vector < int > arr = { 1 , 5 , 20 , 100 } ; findSum ( arr ) ; return 0 ; }

Index/key variables: i
Accumulator variables: i, node_value, sum_of_node
Iterator variables: i
C++ program:
#include <bits/stdc++.h>
using namespace std ; int minDeletions ( int arr [ ] , int N ) { map < int , int > freq ; for ( int i = 0 ; i < N ; i ++ ) { freq [ arr [ i ] ] ++ ; } vector < int > v ; for ( auto z : freq ) { v . push_back ( z . second ) ; } sort ( v . begin ( ) , v . end ( ) ) ; int size = v . size ( ) ; int ans = N - ( v [ 0 ] * size ) ; for ( int i = 1 ; i < v . size ( ) ; i ++ ) { if ( v [ i ] != v [ i - 1 ] ) { int safe = v [ i ] * ( size - i ) ; ans = min ( ans , N - safe ) ; } } cout << ans ; } int main ( ) { int arr [ ] = { 2 , 4 , 3 , 2 , 5 , 3 } ; int N = sizeof ( arr ) / sizeof ( arr [ 0 ] ) ; minDeletions ( arr , N ) ; }

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