dhyuti-n/xlcost-variable-roles huggingface dataset:
C++ program:
#include <bits/stdc++.h>
using namespace std ; #define ROW  4
#define COL  4
struct Point { int x , y ; } ; struct Node { Point pt ; int dist ; } ; bool isValid ( int row , int col ) { return ( row >= 0 ) && ( col >= 0 ) && ( row < ROW ) && ( col < COL ) ; } int dRow [ ] = { -1 , 0 , 0 , 1 } ; int dCol [ ] = { 0 , -1 , 1 , 0 } ; void pathMoves ( char mat [ ] [ COL ] , Point src , Point dest ) { int d [ ROW ] [ COL ] ; memset ( d , -1 , sizeof d ) ; d [ src . x ] [ src . y ] = 0 ; bool visited [ ROW ] [ COL ] ; memset ( visited , false , sizeof visited ) ; visited [ src . x ] [ src . y ] = true ; queue < Node > q ; Node s = { src , 0 } ; q . push ( s ) ; bool ok = false ; while ( ! q . empty ( ) ) { Node curr = q . front ( ) ; Point pt = curr . pt ; if ( pt . x == dest . x && pt . y == dest . y ) { int xx = pt . x , yy = pt . y ; int dist = curr . dist ; d [ pt . x ] [ pt . y ] = dist ; string pathmoves = " " ; while ( xx != src . x yy != src . y ) { if ( xx > 0 && d [ xx - 1 ] [ yy ] == dist - 1 ) { pathmoves += ' D ' ; xx -- ; } if ( xx < ROW - 1 && d [ xx + 1 ] [ yy ] == dist - 1 ) { pathmoves += ' U ' ; xx ++ ; } if ( yy > 0 && d [ xx ] [ yy - 1 ] == dist - 1 ) { pathmoves += ' R ' ; yy -- ; } if ( yy < COL - 1 && d [ xx ] [ yy + 1 ] == dist - 1 ) { pathmoves += ' L ' ; yy ++ ; } dist -- ; } reverse ( pathmoves . begin ( ) , pathmoves . end ( ) ) ; cout << pathmoves ; ok = true ; break ; } q . pop ( ) ; for ( int i = 0 ; i < 4 ; i ++ ) { int row = pt . x + dRow [ i ] ; int col = pt . y + dCol [ i ] ; if ( isValid ( row , col ) && ( mat [ row ] [ col ] == '1' mat [ row ] [ col ] == ' s ' mat [ row ] [ col ] == ' d ' ) && ! visited [ row ] [ col ] ) { visited [ row ] [ col ] = true ; Node adjCell = { { row , col } , curr . dist + 1 } ; q . push ( adjCell ) ; d [ row ] [ col ] = curr . dist + 1 ; } } } if ( ! ok ) cout << -1 ; } int main ( ) { char mat [ ROW ] [ COL ] = { { '0' , '1' , '0' , '1' } , { '1' , '0' , '1' , '1' } , { '0' , '1' , '1' , '1' } , { '1' , '1' , '1' , '0' } } ; Point src = { 0 , 3 } ; Point dest = { 3 , 0 } ; pathMoves ( mat , src , dest ) ; return 0 ; }

Index/key variables: COL, ROW, col, i, row, xx, yy
Accumulator variables: dist, i, pathmoves, stdc, xx, yy
Iterator variables: i
Boolean variables: ok
Class/struct names: Node, Point
C++ program:
#include <bits/stdc++.h>
using namespace std ; bool find ( vector < double > & v , int n , double dest , string s ) { if ( n == 1 ) { if ( abs ( v [ 0 ] - dest ) <= 0.0000001 ) { cout << s + to_string ( int ( dest ) ) << " ▁ " ; return 1 ; } return 0 ; } for ( int i = 0 ; i < n ; i ++ ) { for ( int j = i + 1 ; j < n ; j ++ ) { double a = v [ i ] , b = v [ j ] ; string p = s ; v [ i ] = a + b ; v [ j ] = v [ n - 1 ] ; s = ( s + to_string ( int ( a ) ) + ' + ' + to_string ( int ( b ) ) + " ▁ = > ▁ " ) ; if ( find ( v , n - 1 , dest , s ) ) return 1 ; s = p ; v [ i ] = a - b ; v [ j ] = v [ n - 1 ] ; s = ( s + to_string ( int ( a ) ) + ' - ' + to_string ( int ( b ) ) + " ▁ = > ▁ " ) ; if ( find ( v , n - 1 , dest , s ) ) return 1 ; s = p ; v [ i ] = b - a ; v [ j ] = v [ n - 1 ] ; s = ( s + to_string ( int ( b ) ) + ' - ' + to_string ( int ( a ) ) + " ▁ = > ▁ " ) ; if ( find ( v , n - 1 , dest , s ) ) return 1 ; s = p ; v [ i ] = a * b ; v [ j ] = v [ n - 1 ] ; s = ( s + to_string ( int ( a ) ) + ' * ' + to_string ( int ( b ) ) + " ▁ = > ▁ " ) ; if ( find ( v , n - 1 , dest , s ) ) return 1 ; s = p ; if ( b != 0 ) { v [ i ] = a / b ; v [ j ] = v [ n - 1 ] ; s = ( s + to_string ( int ( a ) ) + ' / ' + to_string ( int ( b ) ) + " ▁ = > ▁ " ) ; if ( find ( v , n - 1 , dest , s ) ) return 1 ; } s = p ; if ( a != 0 ) { v [ i ] = b / a ; v [ j ] = v [ n - 1 ] ; s = ( s + to_string ( int ( b ) ) + ' / ' + to_string ( int ( a ) ) + " ▁ = > ▁ " ) ; if ( find ( v , n - 1 , dest , s ) ) return 1 ; } s = p ; v [ i ] = a ; v [ j ] = b ; } } return 0 ; } void checkPossibleOperation ( vector < double > & arr , double K ) { string s = " " ; if ( ! find ( arr , arr . size ( ) , K , s ) ) { cout << " - 1" ; } } int main ( ) { vector < double > arr = { 2 , 0 , 0 , 2 } ; double K = 4 ; checkPossibleOperation ( arr , K ) ; return 0 ; }

Index/key variables: i, j
Accumulator variables: i, j, stdc
Iterator variables: i, j
C++ program:
#include <iostream>
using namespace std ; #define N  9
void print ( int arr [ N ] [ N ] ) { for ( int i = 0 ; i < N ; i ++ ) { for ( int j = 0 ; j < N ; j ++ ) cout << arr [ i ] [ j ] << " ▁ " ; cout << endl ; } } bool isSafe ( int grid [ N ] [ N ] , int row , int col , int num ) { for ( int x = 0 ; x <= 8 ; x ++ ) if ( grid [ row ] [ x ] == num ) return false ; for ( int x = 0 ; x <= 8 ; x ++ ) if ( grid [ x ] [ col ] == num ) return false ; int startRow = row - row % 3 , startCol = col - col % 3 ; for ( int i = 0 ; i < 3 ; i ++ ) for ( int j = 0 ; j < 3 ; j ++ ) if ( grid [ i + startRow ] [ j + startCol ] == num ) return false ; return true ; } bool solveSuduko ( int grid [ N ] [ N ] , int row , int col ) { if ( row == N - 1 && col == N ) return true ; if ( col == N ) { row ++ ; col = 0 ; } if ( grid [ row ] [ col ] > 0 ) return solveSuduko ( grid , row , col + 1 ) ; for ( int num = 1 ; num <= N ; num ++ ) { if ( isSafe ( grid , row , col , num ) ) { grid [ row ] [ col ] = num ; if ( solveSuduko ( grid , row , col + 1 ) ) return true ; } grid [ row ] [ col ] = 0 ; } return false ; } int main ( ) { int grid [ N ] [ N ] = { { 3 , 0 , 6 , 5 , 0 , 8 , 4 , 0 , 0 } , { 5 , 2 , 0 , 0 , 0 , 0 , 0 , 0 , 0 } , { 0 , 8 , 7 , 0 , 0 , 0 , 0 , 3 , 1 } , { 0 , 0 , 3 , 0 , 1 , 0 , 0 , 8 , 0 } , { 9 , 0 , 0 , 8 , 6 , 3 , 0 , 0 , 5 } , { 0 , 5 , 0 , 0 , 9 , 0 , 6 , 0 , 0 } , { 1 , 3 , 0 , 0 , 0 , 0 , 2 , 5 , 0 } , { 0 , 0 , 0 , 0 , 0 , 0 , 0 , 7 , 4 } , { 0 , 0 , 5 , 2 , 0 , 6 , 3 , 0 , 0 } } ; if ( solveSuduko ( grid , 0 , 0 ) ) print ( grid ) ; else cout << " no ▁ solution ▁ exists ▁ " << endl ; return 0 ; }

Index/key variables: N, col, i, j, row, x
Accumulator variables: i, j, num, row, x
Iterator variables: i, j, num, x
C++ program:
#include <bits/stdc++.h>
using namespace std ; #define ARRAYSIZE ( a )  (sizeof(a))/(sizeof(a[0]))
static int total_nodes ; void printSubset ( int A [ ] , int size ) { for ( int i = 0 ; i < size ; i ++ ) { cout << " ▁ " << A [ i ] ; } cout << " STRNEWLINE " ; } int comparator ( const void * pLhs , const void * pRhs ) { int * lhs = ( int * ) pLhs ; int * rhs = ( int * ) pRhs ; return * lhs > * rhs ; } void subset_sum ( int s [ ] , int t [ ] , int s_size , int t_size , int sum , int ite , int const target_sum ) { total_nodes ++ ; if ( target_sum == sum ) { printSubset ( t , t_size ) ; if ( ite + 1 < s_size && sum - s [ ite ] + s [ ite + 1 ] <= target_sum ) { subset_sum ( s , t , s_size , t_size - 1 , sum - s [ ite ] , ite + 1 , target_sum ) ; } return ; } else { if ( ite < s_size && sum + s [ ite ] <= target_sum ) { for ( int i = ite ; i < s_size ; i ++ ) { t [ t_size ] = s [ i ] ; if ( sum + s [ i ] <= target_sum ) { subset_sum ( s , t , s_size , t_size + 1 , sum + s [ i ] , i + 1 , target_sum ) ; } } } } } void generateSubsets ( int s [ ] , int size , int target_sum ) { int * tuplet_vector = ( int * ) malloc ( size * sizeof ( int ) ) ; int total = 0 ; qsort ( s , size , sizeof ( int ) , & comparator ) ; for ( int i = 0 ; i < size ; i ++ ) { total += s [ i ] ; } if ( s [ 0 ] <= target_sum && total >= target_sum ) { subset_sum ( s , tuplet_vector , size , 0 , 0 , 0 , target_sum ) ; } free ( tuplet_vector ) ; } int main ( ) { int weights [ ] = { 15 , 22 , 14 , 26 , 32 , 9 , 16 , 8 } ; int target = 53 ; int size = ARRAYSIZE ( weights ) ; generateSubsets ( weights , size , target ) ; cout << " Nodes ▁ generated ▁ " << total_nodes ; return 0 ; }

Index/key variables: i, ite, t_size
Accumulator variables: i, stdc, total, total_nodes
Iterator variables: i
C++ program:
#include <bits/stdc++.h>
using namespace std ; void printPairs ( int arr [ ] , int arr_size , int sum ) { unordered_set < int > s ; for ( int i = 0 ; i < arr_size ; i ++ ) { int temp = sum - arr [ i ] ; if ( s . find ( temp ) != s . end ( ) ) cout << " Pair ▁ with ▁ given ▁ sum ▁ " << sum << " ▁ is ▁ ( " << arr [ i ] << " , " << temp << " ) " << endl ; s . insert ( arr [ i ] ) ; } } int main ( ) { int A [ ] = { 1 , 4 , 45 , 6 , 10 , 8 } ; int n = 16 ; int arr_size = sizeof ( A ) / sizeof ( A [ 0 ] ) ; printPairs ( A , arr_size , n ) ; return 0 ; }

Index/key variables: i
Accumulator variables: i, stdc
Iterator variables: i
C++ program:
#include <bits/stdc++.h>
using namespace std ; struct Node { int data ; Node * left , * right ; } ; Node * newNode ( int data ) { Node * temp = new Node ; temp -> data = data ; temp -> left = temp -> right = NULL ; return temp ; } void longestConsecutiveUtil ( Node * root , int curLength , int expected , int & res ) { if ( root == NULL ) return ; if ( root -> data == expected ) curLength ++ ; else curLength = 1 ; res = max ( res , curLength ) ; longestConsecutiveUtil ( root -> left , curLength , root -> data + 1 , res ) ; longestConsecutiveUtil ( root -> right , curLength , root -> data + 1 , res ) ; } int longestConsecutive ( Node * root ) { if ( root == NULL ) return 0 ; int res = 0 ; longestConsecutiveUtil ( root , 0 , root -> data , res ) ; return res ; } int main ( ) { Node * root = newNode ( 6 ) ; root -> right = newNode ( 9 ) ; root -> right -> left = newNode ( 7 ) ; root -> right -> right = newNode ( 10 ) ; root -> right -> right -> right = newNode ( 11 ) ; printf ( " % d STRNEWLINE " , longestConsecutive ( root ) ) ; return 0 ; }

Accumulator variables: curLength, stdc
Class/struct names: Node
C++ program:
#include <bits/stdc++.h>
using namespace std ; long long int power ( long long x , long long int y , long long int p ) { long long int res = 1 ; x = x % p ; if ( x == 0 ) return 0 ; while ( y > 0 ) { if ( y & 1 ) res = ( res * x ) % p ; y = y >> 1 ; x = ( x * x ) % p ; } return res ; } long long int remainder ( long long int n , long long int a , long long int p ) { long long int ans = a % p ; for ( long long int i = 1 ; i <= n ; i ++ ) ans = power ( ans , i , p ) ; return ans ; } int main ( ) { long long int A = 2 , N = 1 , P = 2 ; cout << remainder ( N , A , P ) << endl ; }

Accumulator variables: i, stdc
Iterator variables: i
C++ program:
#include <bits/stdc++.h>
using namespace std ; void findMajority ( int arr [ ] , int n ) { int count1 = 0 , count2 = 0 ; int first = INT_MAX , second = INT_MAX ; int flag = 0 ; for ( int i = 0 ; i < n ; i ++ ) { if ( first == arr [ i ] ) count1 ++ ; else if ( second == arr [ i ] ) count2 ++ ; else if ( count1 == 0 ) { count1 ++ ; first = arr [ i ] ; } else if ( count2 == 0 ) { count2 ++ ; second = arr [ i ] ; } else { count1 -- ; count2 -- ; } } count1 = 0 ; count2 = 0 ; for ( int i = 0 ; i < n ; i ++ ) { if ( arr [ i ] == first ) count1 ++ ; else if ( arr [ i ] == second ) count2 ++ ; } if ( count1 > n / 3 ) { cout << first << " ▁ " ; flag = 1 ; } if ( count2 > n / 3 ) { cout << second << " ▁ " ; flag = 1 ; } if ( flag == 0 ) { cout << " No ▁ Majority ▁ Element " << endl ; } } int main ( ) { int arr [ ] = { 2 , 2 , 3 , 1 , 3 , 2 , 1 , 1 } ; int n = sizeof ( arr ) / sizeof ( arr [ 0 ] ) ; findMajority ( arr , n ) ; return 0 ; }

Index/key variables: i
Accumulator variables: count1, count2, i, stdc
Iterator variables: i
C++ program:
#include <bits/stdc++.h>
using namespace std ; pair < int , int > Multiply ( pair < int , int > p , pair < int , int > q , int M ) { int x = ( ( p . first * q . first ) % M - ( p . second * q . second ) % M + M ) % M ; int y = ( ( p . first * q . second ) % M + ( p . second * q . first ) % M ) % M ; return { x , y } ; } pair < int , int > compPow ( pair < int , int > complex , int k , int M ) { pair < int , int > res = { 1 , 0 } ; while ( k > 0 ) { if ( k & 1 ) { res = Multiply ( res , complex , M ) ; } complex = Multiply ( complex , complex , M ) ; k = k >> 1 ; } return res ; } int main ( ) { int A = 7 , B = 3 , k = 10 , M = 97 ; pair < int , int > ans = compPow ( { A , B } , k , M ) ; cout << ans . first << " ▁ + ▁ i " << ans . second ; return 0 ; }

Accumulator variables: stdc
C++ program:
#include <bits/stdc++.h>
#define seg_max  51
using namespace std ; pair < int , int > seg_tree [ seg_max ] ; int n ; pair < int , int > buildMaxTree ( int l , int r , int i , int arr [ ] ) { if ( l == r ) { seg_tree [ i ] = { arr [ l ] , l } ; return seg_tree [ i ] ; } seg_tree [ i ] = max ( buildMaxTree ( l , ( l + r ) / 2 , 2 * i + 1 , arr ) , buildMaxTree ( ( l + r ) / 2 + 1 , r , 2 * i + 2 , arr ) ) ; return seg_tree [ i ] ; } pair < int , int > rangeMax ( int l , int r , int arr [ ] , int i = 0 , int sl = 0 , int sr = n - 1 ) { if ( sr < l sl > r ) return { INT_MIN , -1 } ; if ( sl >= l and sr <= r ) return seg_tree [ i ] ; return max ( rangeMax ( l , r , arr , 2 * i + 1 , sl , ( sl + sr ) / 2 ) , rangeMax ( l , r , arr , 2 * i + 2 , ( sl + sr ) / 2 + 1 , sr ) ) ; } int maxSumSubarray ( int arr [ ] , int l = 0 , int r = n - 1 ) { if ( l > r ) return 0 ; pair < int , int > a = rangeMax ( l , r , arr ) ; return a . first * ( r - a . second + 1 ) * ( a . second - l + 1 ) + maxSumSubarray ( arr , l , a . second - 1 ) + maxSumSubarray ( arr , a . second + 1 , r ) ; } int main ( ) { int arr [ ] = { 1 , 3 , 1 , 7 } ; n = sizeof ( arr ) / sizeof ( int ) ; buildMaxTree ( 0 , n - 1 , 0 , arr ) ; cout << maxSumSubarray ( arr ) ; return 0 ; }

Index/key variables: i, l, seg_max
Accumulator variables: stdc
C++ program:
#include <bits/stdc++.h>
using namespace std ; int exponentMod ( int A , int B , int C ) { if ( A == 0 ) return 0 ; if ( B == 0 ) return 1 ; long y ; if ( B % 2 == 0 ) { y = exponentMod ( A , B / 2 , C ) ; y = ( y * y ) % C ; } else { y = A % C ; y = ( y * exponentMod ( A , B - 1 , C ) % C ) % C ; } return ( int ) ( ( y + C ) % C ) ; } int main ( ) { int A = 2 , B = 5 , C = 13 ; cout << " Power ▁ is ▁ " << exponentMod ( A , B , C ) ; return 0 ; }

Accumulator variables: stdc
C++ program:
#include <iostream>
using namespace std ; void findFrequencies ( int ele [ ] , int n ) { int freq = 1 ; int idx = 1 ; int element = ele [ 0 ] ; while ( idx < n ) { if ( ele [ idx - 1 ] == ele [ idx ] ) { freq ++ ; idx ++ ; } else { cout << element << " ▁ " << freq << endl ; element = ele [ idx ] ; idx ++ ; freq = 1 ; } } cout << element << " ▁ " << freq ; } int main ( ) { cout << " - - - frequencies ▁ in ▁ a ▁ sorted ▁ array - - - - " << endl ; int arr [ ] = { 10 , 20 , 30 , 30 , 30 , 40 , 50 , 50 , 50 , 50 , 70 } ; int n = sizeof ( arr ) / sizeof ( arr [ 0 ] ) ; findFrequencies ( arr , n ) ; }

Index/key variables: idx
Accumulator variables: freq, idx
C++ program:
#include <bits/stdc++.h>
using namespace std ; struct Node { int key ; struct Node * left ; struct Node * right ; } ; struct Node * newNode ( int key ) { struct Node * node = new Node ( ) ; node -> left = NULL ; node -> right = NULL ; node -> key = key ; return node ; } void findMaxBendsUtil ( struct Node * node , char dir , int bends , int * maxBends , int soFar , int * len ) { if ( node == NULL ) return ; if ( node -> left == NULL && node -> right == NULL ) { if ( bends > * maxBends ) { * maxBends = bends ; * len = soFar ; } } else { if ( dir == ' l ' ) { findMaxBendsUtil ( node -> left , dir , bends , maxBends , soFar + 1 , len ) ; findMaxBendsUtil ( node -> right , ' r ' , bends + 1 , maxBends , soFar + 1 , len ) ; } else { findMaxBendsUtil ( node -> right , dir , bends , maxBends , soFar + 1 , len ) ; findMaxBendsUtil ( node -> left , ' l ' , bends + 1 , maxBends , soFar + 1 , len ) ; } } } int findMaxBends ( struct Node * node ) { if ( node == NULL ) return 0 ; int len = 0 , bends = 0 , maxBends = -1 ; if ( node -> left ) findMaxBendsUtil ( node -> left , ' l ' , bends , & maxBends , 1 , & len ) ; if ( node -> right ) findMaxBendsUtil ( node -> right , ' r ' , bends , & maxBends , 1 , & len ) ; len ++ ; return len ; } int main ( ) { struct Node * root = newNode ( 10 ) ; root -> left = newNode ( 8 ) ; root -> right = newNode ( 2 ) ; root -> left -> left = newNode ( 3 ) ; root -> left -> right = newNode ( 5 ) ; root -> right -> left = newNode ( 2 ) ; root -> right -> left -> right = newNode ( 1 ) ; root -> right -> left -> right -> left = newNode ( 9 ) ; cout << findMaxBends ( root ) - 1 ; return 0 ; }

Accumulator variables: len, stdc
Class/struct names: Node
C++ program:
#include <bits/stdc++.h>
using namespace std ; double magnitude ( double arr [ ] , int N ) { double magnitude = 0 ; for ( int i = 0 ; i < N ; i ++ ) magnitude += arr [ i ] * arr [ i ] ; return sqrt ( magnitude ) ; } double dotProduct ( double arr [ ] , double brr [ ] , int N ) { double product = 0 ; for ( int i = 0 ; i < N ; i ++ ) product = product + arr [ i ] * brr [ i ] ; return product ; } void angleBetweenVectors ( double arr [ ] , double brr [ ] , int N ) { double dotProductOfVectors = dotProduct ( arr , brr , N ) ; double magnitudeOfA = magnitude ( arr , N ) ; double magnitudeOfB = magnitude ( brr , N ) ; double angle = dotProductOfVectors / ( magnitudeOfA * magnitudeOfB ) ; cout << angle ; } int main ( ) { double arr [ ] = { -0.5 , -2 , 1 } ; double brr [ ] = { -1 , -1 , 0.3 } ; int N = sizeof ( arr ) / sizeof ( arr [ 0 ] ) ; angleBetweenVectors ( arr , brr , N ) ; return 0 ; }

Index/key variables: i
Accumulator variables: i, magnitude, stdc
Iterator variables: i
C++ program:
#include <bits/stdc++.h>
using namespace std ; void secondary_polygon ( int Angle ) { int edges_primary = 360 / Angle ; if ( edges_primary >= 6 ) { int edges_max_secondary = edges_primary / 2 ; cout << edges_max_secondary + 3 ; } else cout << " Not ▁ Possible " ; } int main ( ) { int Angle = 45 ; secondary_polygon ( Angle ) ; return 0 ; }

Accumulator variables: stdc
C++ program:
#include <bits/stdc++.h>
using namespace std ; struct Node { struct Node * left , * right ; int key ; } ; Node * newNode ( int key ) { Node * temp = new Node ; temp -> key = key ; temp -> left = temp -> right = NULL ; return temp ; } struct Node * findLCA ( struct Node * root , int n1 , int n2 ) { if ( root == NULL ) return NULL ; if ( root -> key == n1 root -> key == n2 ) return root ; Node * left_lca = findLCA ( root -> left , n1 , n2 ) ; Node * right_lca = findLCA ( root -> right , n1 , n2 ) ; if ( left_lca && right_lca ) return root ; return ( left_lca != NULL ) ? left_lca : right_lca ; } bool CountTurn ( Node * root , int key , bool turn , int * count ) { if ( root == NULL ) return false ; if ( root -> key == key ) return true ; if ( turn == true ) { if ( CountTurn ( root -> left , key , turn , count ) ) return true ; if ( CountTurn ( root -> right , key , ! turn , count ) ) { * count += 1 ; return true ; } } else { if ( CountTurn ( root -> right , key , turn , count ) ) return true ; if ( CountTurn ( root -> left , key , ! turn , count ) ) { * count += 1 ; return true ; } } return false ; } int NumberOFTurn ( struct Node * root , int first , int second ) { struct Node * LCA = findLCA ( root , first , second ) ; if ( LCA == NULL ) return -1 ; int Count = 0 ; if ( LCA -> key != first && LCA -> key != second ) { if ( CountTurn ( LCA -> right , second , false , & Count ) || CountTurn ( LCA -> left , second , true , & Count ) ) ; if ( CountTurn ( LCA -> left , first , true , & Count ) || CountTurn ( LCA -> right , first , false , & Count ) ) ; return Count + 1 ; } if ( LCA -> key == first ) { CountTurn ( LCA -> right , second , false , & Count ) ; CountTurn ( LCA -> left , second , true , & Count ) ; return Count ; } else { CountTurn ( LCA -> right , first , false , & Count ) ; CountTurn ( LCA -> left , first , true , & Count ) ; return Count ; } } int main ( ) { Node * root = newNode ( 1 ) ; root -> left = newNode ( 2 ) ; root -> right = newNode ( 3 ) ; root -> left -> left = newNode ( 4 ) ; root -> left -> right = newNode ( 5 ) ; root -> right -> left = newNode ( 6 ) ; root -> right -> right = newNode ( 7 ) ; root -> left -> left -> left = newNode ( 8 ) ; root -> right -> left -> left = newNode ( 9 ) ; root -> right -> left -> right = newNode ( 10 ) ; int turn = 0 ; if ( ( turn = NumberOFTurn ( root , 5 , 10 ) ) ) cout << turn << endl ; else cout << " Not ▁ Possible " << endl ; return 0 ; }

Accumulator variables: count, stdc
Class/struct names: Node
C++ program:
#include <bits/stdc++.h>
using namespace std ; void checkTypeOfTriangle ( int a , int b , int c ) { int sqa = pow ( a , 2 ) ; int sqb = pow ( b , 2 ) ; int sqc = pow ( c , 2 ) ; if ( sqa == sqb + sqc sqb == sqc + sqa sqc == sqa + sqb ) { cout << " Right - angled ▁ Triangle " ; } else if ( sqa > sqc + sqb sqb > sqa + sqc sqc > sqa + sqb ) { cout << " Obtuse - angled ▁ Triangle " ; } else { cout << " Acute - angled ▁ Triangle " ; } } int main ( ) { int a , b , c ; a = 2 ; b = 2 ; c = 2 ; checkTypeOfTriangle ( a , b , c ) ; return 0 ; }

Accumulator variables: stdc
C++ program:
#include <bits/stdc++.h>
using namespace std ; bool Valid ( int a , int b , int c ) { if ( a + b + c == 180 && a != 0 && b != 0 && c != 0 ) return true ; else return false ; } int main ( ) { int a = 60 , b = 40 , c = 80 ; if ( Valid ( a , b , c ) ) cout << " Valid " ; else cout << " Invalid " ; }

Accumulator variables: stdc
C++ program:
#include <bits/stdc++.h>
using namespace std ; float trianglearea ( float a ) { if ( a < 0 ) return -1 ; float area = ( 3 * sqrt ( 3 ) * pow ( a , 2 ) ) / 4 ; return area ; } int main ( ) { float a = 6 ; cout << trianglearea ( a ) << endl ; return 0 ; }

Accumulator variables: stdc
C++ program:
#include <bits/stdc++.h>
#include <iomanip>
#include <iostream>
#include <math.h>
using namespace std ; void equation_ellipse ( float x1 , float y1 , float a , float b , float c , float e ) { float t = a * a + b * b ; float a1 = t - e * ( a * a ) ; float b1 = t - e * ( b * b ) ; float c1 = ( -2 * t * x1 ) - ( 2 * e * c * a ) ; float d1 = ( -2 * t * y1 ) - ( 2 * e * c * b ) ; float e1 = -2 * e * a * b ; float f1 = ( - e * c * c ) + ( t * x1 * x1 ) + ( t * y1 * y1 ) ; cout << fixed ; cout << setprecision ( 2 ) ; cout << " Equation ▁ of ▁ ellipse ▁ is ▁ STRNEWLINE " << a1 << " ▁ x ^ 2 ▁ + ▁ " << b1 << " ▁ y ^ 2 ▁ + ▁ " << c1 << " ▁ x ▁ + ▁ " << d1 << " ▁ y ▁ + ▁ " << e1 << " ▁ xy ▁ + ▁ " << f1 << " ▁ = ▁ 0" ; } int main ( ) { float x1 = 1 , y1 = 1 , a = 1 , b = -1 , c = 3 , e = 0.5 * 0.5 ; equation_ellipse ( x1 , y1 , a , b , c , e ) ; return 0 ; }

Accumulator variables: stdc
C++ program:
#include <bits/stdc++.h>
using namespace std ; struct Node { int data ; Node * left , * right , * abtr ; } ; struct Node * newNode ( int data ) { struct Node * node = new Node ; node -> data = data ; node -> left = node -> right = node -> abtr = NULL ; return node ; } void preorderTraversal ( Node * root , vector < Node * > * even_ptrs , vector < Node * > * odd_ptrs ) { if ( ! root ) return ; if ( root -> data % 2 == 0 ) ( * even_ptrs ) . push_back ( root ) ; else ( * odd_ptrs ) . push_back ( root ) ; preorderTraversal ( root -> left , even_ptrs , odd_ptrs ) ; preorderTraversal ( root -> right , even_ptrs , odd_ptrs ) ; } void createLoops ( Node * root ) { vector < Node * > even_ptrs , odd_ptrs ; preorderTraversal ( root , & even_ptrs , & odd_ptrs ) ; int i ; for ( i = 1 ; i < even_ptrs . size ( ) ; i ++ ) even_ptrs [ i - 1 ] -> abtr = even_ptrs [ i ] ; even_ptrs [ i - 1 ] -> abtr = even_ptrs [ 0 ] ; for ( i = 1 ; i < odd_ptrs . size ( ) ; i ++ ) odd_ptrs [ i - 1 ] -> abtr = odd_ptrs [ i ] ; odd_ptrs [ i - 1 ] -> abtr = odd_ptrs [ 0 ] ; } void traverseLoop ( Node * start ) { Node * curr = start ; do { cout << curr -> data << " ▁ " ; curr = curr -> abtr ; } while ( curr != start ) ; } int main ( ) { struct Node * root = NULL ; root = newNode ( 1 ) ; root -> left = newNode ( 2 ) ; root -> right = newNode ( 3 ) ; root -> left -> left = newNode ( 4 ) ; root -> left -> right = newNode ( 5 ) ; root -> right -> left = newNode ( 6 ) ; root -> right -> right = newNode ( 7 ) ; createLoops ( root ) ; cout << " Odd ▁ nodes : ▁ " ; traverseLoop ( root -> right ) ; cout << endl << " Even ▁ nodes : ▁ " ; traverseLoop ( root -> left ) ; return 0 ; }

Index/key variables: i
Accumulator variables: i, stdc
Iterator variables: i
Class/struct names: Node
C++ program:
# include <bits/stdc++.h>
# define PI  3.14
using namespace std ; float circle_inscribed ( int a ) { return PI * ( a * a ) / 12 ; } int main ( ) { int a = 4 ; cout << circle_inscribed ( a ) ; return 0 ; }

Accumulator variables: stdc