dhyuti-n/xlcost-variable-roles huggingface dataset:
C++ program:
#include <iostream>
using namespace std ; int modInverse ( int a , int m ) { for ( int x = 1 ; x < m ; x ++ ) if ( ( ( a % m ) * ( x % m ) ) % m == 1 ) return x ; } int main ( ) { int a = 3 , m = 11 ; cout << modInverse ( a , m ) ; return 0 ; }

Accumulator variables: x
Iterator variables: x
C++ program:
#include <bits/stdc++.h>
using namespace std ; int modInverse ( int a , int m ) { int m0 = m ; int y = 0 , x = 1 ; if ( m == 1 ) return 0 ; while ( a > 1 ) { int q = a / m ; int t = m ; m = a % m , a = t ; t = y ; y = x - q * y ; x = t ; } if ( x < 0 ) x += m0 ; return x ; } int main ( ) { int a = 3 , m = 11 ; cout << " Modular ▁ multiplicative ▁ inverse ▁ is ▁ " << modInverse ( a , m ) ; return 0 ; }

Accumulator variables: stdc, x
C++ program:
#include <iostream>
using namespace std ; int gcd ( int a , int b ) { if ( a == 0 ) return b ; return gcd ( b % a , a ) ; } int phi ( unsigned int n ) { unsigned int result = 1 ; for ( int i = 2 ; i < n ; i ++ ) if ( gcd ( i , n ) == 1 ) result ++ ; return result ; } int main ( ) { int n ; for ( n = 1 ; n <= 10 ; n ++ ) cout << " phi ( " << n << " ) ▁ = ▁ " << phi ( n ) << endl ; return 0 ; }

Accumulator variables: i, n, result
Iterator variables: i, n
C++ program:
#include <bits/stdc++.h>
using namespace std ; int phi ( int n ) { float result = n ; for ( int p = 2 ; p * p <= n ; ++ p ) { if ( n % p == 0 ) { while ( n % p == 0 ) n /= p ; result *= ( 1.0 - ( 1.0 / ( float ) p ) ) ; } } if ( n > 1 ) result *= ( 1.0 - ( 1.0 / ( float ) n ) ) ; return ( int ) result ; } int main ( ) { int n ; for ( n = 1 ; n <= 10 ; n ++ ) { cout << " Phi " << " ( " << n << " ) " << " ▁ = ▁ " << phi ( n ) << endl ; } return 0 ; }

Accumulator variables: n, result, stdc
Iterator variables: n, p
C++ program:
#include <iostream>
using namespace std ; int getRemainder ( int num , int divisor ) { while ( num >= divisor ) num -= divisor ; return num ; } int main ( ) { int num = 100 , divisor = 7 ; cout << getRemainder ( num , divisor ) ; return 0 ; }

Accumulator variables: num
C++ program:
#include <iostream>
using namespace std ; int factorial ( int n ) { int res = 1 ; for ( int i = 2 ; i <= n ; i ++ ) res *= i ; return res ; } double sum ( int n ) { double sum = 0 ; for ( int i = 1 ; i <= n ; i ++ ) sum += 1.0 / factorial ( i ) ; return sum ; } int main ( ) { int n = 5 ; cout << sum ( n ) ; return 0 ; }

Accumulator variables: i, res, sum
Iterator variables: i
C++ program:
#include <bits/stdc++.h>
using namespace std ; unsigned long int binomialCoeff ( unsigned int n , unsigned int k ) { unsigned long int res = 1 ; if ( k > n - k ) k = n - k ; for ( int i = 0 ; i < k ; ++ i ) { res *= ( n - i ) ; res /= ( i + 1 ) ; } return res ; } unsigned long int catalan ( unsigned int n ) { unsigned long int c = binomialCoeff ( 2 * n , n ) ; return c / ( n + 1 ) ; } unsigned long int findWays ( unsigned n ) { if ( n & 1 ) return 0 ; return catalan ( n / 2 ) ; } int main ( ) { int n = 6 ; cout << " Total ▁ possible ▁ expressions ▁ of ▁ length ▁ " << n << " ▁ is ▁ " << findWays ( 6 ) ; return 0 ; }

Accumulator variables: res, stdc
Iterator variables: i
C++ program:
#include <iostream>
using namespace std ; bool isOperand ( char c ) { return ( c >= '0' && c <= '9' ) ; } int value ( char c ) { return ( c - '0' ) ; } int evaluate ( char * exp ) { if ( * exp == ' \0' ) return -1 ; int res = value ( exp [ 0 ] ) ; for ( int i = 1 ; exp [ i ] ; i += 2 ) { char opr = exp [ i ] , opd = exp [ i + 1 ] ; if ( ! isOperand ( opd ) ) return -1 ; if ( opr == ' + ' ) res += value ( opd ) ; else if ( opr == ' - ' ) res -= value ( opd ) ; else if ( opr == ' * ' ) res *= value ( opd ) ; else if ( opr == ' / ' ) res /= value ( opd ) ; else return -1 ; } return res ; } int main ( ) { char expr1 [ ] = "1 + 2*5 + 3" ; int res = evaluate ( expr1 ) ; ( res == -1 ) ? cout << expr1 << " ▁ is ▁ " << " Invalid STRNEWLINE " : cout << " Value ▁ of ▁ " << expr1 << " ▁ is ▁ " << res << endl ; char expr2 [ ] = "1 + 2*3" ; res = evaluate ( expr2 ) ; ( res == -1 ) ? cout << expr2 << " ▁ is ▁ " << " Invalid STRNEWLINE " : cout << " Value ▁ of ▁ " << expr2 << " ▁ is ▁ " << res << endl ; char expr3 [ ] = "4-2 + 6*3" ; res = evaluate ( expr3 ) ; ( res == -1 ) ? cout << expr3 << " ▁ is ▁ " << " Invalid STRNEWLINE " : cout << " Value ▁ of ▁ " << expr3 << " ▁ is ▁ " << res << endl ; char expr4 [ ] = "1 + + 2" ; res = evaluate ( expr4 ) ; ( res == -1 ) ? cout << expr4 << " ▁ is ▁ " << " Invalid STRNEWLINE " : cout << " Value ▁ of ▁ " << expr4 << " ▁ is ▁ " << res << endl ; return 0 ; }

Index/key variables: i
Accumulator variables: i, res
Iterator variables: i
C++ program:
#include <bits/stdc++.h>
using namespace std ; void printFibonacciNumbers ( int n ) { int f1 = 0 , f2 = 1 , i ; if ( n < 1 ) return ; cout << f1 << " ▁ " ; for ( i = 1 ; i < n ; i ++ ) { cout << f2 << " ▁ " ; int next = f1 + f2 ; f1 = f2 ; f2 = next ; } } int main ( ) { printFibonacciNumbers ( 7 ) ; return 0 ; }

Accumulator variables: i, stdc
Iterator variables: i
C++ program:
#include <bits/stdc++.h>
using namespace std ; int main ( ) { int arr [ ] = { 12 , 3 , 4 , 15 } ; int n = sizeof ( arr ) / sizeof ( arr [ 0 ] ) ; cout << " Sum ▁ of ▁ given ▁ array ▁ is ▁ " << accumulate ( arr , arr + n , 0 ) ; return 0 ; }

Accumulator variables: stdc
C++ program:
#include <bits/stdc++.h>
using namespace std ; # define MAX  11
bool isMultipleof5 ( int n ) { char str [ MAX ] ; int len = strlen ( str ) ; if ( str [ len - 1 ] == '5' str [ len - 1 ] == '0' ) return true ; return false ; } int main ( ) { int n = 19 ; if ( isMultipleof5 ( n ) == true ) cout << n << " ▁ is ▁ multiple ▁ of ▁ 5" << endl ; else cout << n << " ▁ is ▁ not ▁ multiple ▁ of ▁ 5" << endl ; return 0 ; }

Index/key variables: MAX
Accumulator variables: stdc
C++ program:
#include <bits/stdc++.h>
using namespace std ; const long long M = 1e9 + 7 ; vector < pair < int , int > > directions = { { 0 , 1 } , { -1 , 0 } , { 0 , -1 } , { 1 , 0 } , { 1 , 1 } , { -1 , -1 } , { -1 , 1 } , { 1 , -1 } } ; bool isInside ( int i , int j , int N , int M ) { if ( i >= 0 && i < N && j >= 0 && j < M ) { return true ; } return false ; } void DFS ( vector < vector < int > > mat , int N , int M , int i , int j , vector < vector < bool > > & visited ) { if ( visited [ i ] [ j ] == true ) { return ; } visited [ i ] [ j ] = true ; for ( auto it : directions ) { int I = i + it . first ; int J = j + it . second ; if ( isInside ( I , J , N , M ) ) { if ( mat [ I ] [ J ] == 0 ) { DFS ( mat , N , M , I , J , visited ) ; } } } } void check ( int N , int M , vector < vector < int > > & mat ) { int black = 0 ; for ( int i = 0 ; i < N ; i ++ ) { for ( int j = 0 ; j < M ; j ++ ) { if ( mat [ i ] [ j ] == 0 ) { black ++ ; } } } if ( black < 2 * ( max ( N , M ) ) ) { cout << " NO " << endl ; return ; } vector < vector < bool > > visited ; for ( int i = 0 ; i < N ; i ++ ) { vector < bool > temp ; for ( int j = 0 ; j < M ; j ++ ) { temp . push_back ( false ) ; } visited . push_back ( temp ) ; } int black_spots = 0 ; for ( int i = 0 ; i < N ; i ++ ) { for ( int j = 0 ; j < M ; j ++ ) { if ( visited [ i ] [ j ] == false && mat [ i ] [ j ] == 0 ) { black_spots ++ ; DFS ( mat , N , M , i , j , visited ) ; } } } int T = __gcd ( N , M ) ; cout << ( black_spots >= T ? " Yes " : " No " ) ; } int main ( ) { int N = 3 , M = 3 ; vector < vector < int > > mat = { { 0 , 0 , 1 } , { 1 , 1 , 1 } , { 0 , 0 , 1 } } ; check ( M , N , mat ) ; return 0 ; }

Index/key variables: I, J, i, j
Accumulator variables: black, black_spots, i, j, stdc
Iterator variables: i, it, j
C++ program:
#include <bits/stdc++.h>
using namespace std ; int countSubsequences ( vector < int > arr ) { int odd = 0 ; int even = 0 ; for ( int x : arr ) { if ( x & 1 ) odd ++ ; else even ++ ; } return ( ( 1 << odd ) - 1 ) * ( 1 << even ) ; } int main ( ) { vector < int > arr = { 2 , 4 , 1 } ; cout << countSubsequences ( arr ) ; }

Accumulator variables: even, odd, stdc
Iterator variables: x
C++ program:
#include <bits/stdc++.h>
using namespace std ; void Or_of_Ands_for_each_query ( int arr [ ] , int n , int queries [ ] [ 2 ] , int q ) { int bits [ 32 ] = { 0 } ; for ( int i = 0 ; i < 32 ; i ++ ) { for ( int j = 0 ; j < n ; j ++ ) { if ( ( 1 << i ) & arr [ j ] ) { bits [ i ] ++ ; } } } for ( int p = 0 ; p < q ; p ++ ) { for ( int i = 0 ; i < 32 ; i ++ ) { if ( ( 1 << i ) & arr [ queries [ p ] [ 0 ] ] ) { bits [ i ] -- ; } if ( queries [ p ] [ 1 ] & ( 1 << i ) ) { bits [ i ] ++ ; } } arr [ queries [ p ] [ 0 ] ] = queries [ p ] [ 1 ] ; int ans = 0 ; for ( int i = 0 ; i < 32 ; i ++ ) { if ( bits [ i ] != 0 ) { ans |= ( 1 << i ) ; } } cout << ans << endl ; } } int main ( ) { int n = 3 , q = 2 ; int arr [ ] = { 3 , 5 , 7 } ; int queries [ 2 ] [ 2 ] = { { 1 , 2 } , { 2 , 1 } } ; Or_of_Ands_for_each_query ( arr , n , queries , q ) ; return 0 ; }

Index/key variables: i, j, p
Accumulator variables: ans, i, j, p, stdc
Iterator variables: i, j, p
C++ program:
#include <bits/stdc++.h>
using namespace std ; int XorSum ( int A [ ] , int B [ ] , int N , int M ) { int ans = -1 ; for ( int i = 0 ; i < N ; i ++ ) { for ( int j = 0 ; j < M ; j ++ ) { if ( ans == -1 ) ans = ( A [ i ] & B [ j ] ) ; else ans ^= ( A [ i ] & B [ j ] ) ; } } return ans ; } int main ( ) { int A [ ] = { 3 , 5 } ; int B [ ] = { 2 , 3 } ; int N = sizeof ( A ) / sizeof ( A [ 0 ] ) ; int M = sizeof ( B ) / sizeof ( B [ 0 ] ) ; cout << XorSum ( A , B , N , M ) << endl ; }

Index/key variables: i, j
Accumulator variables: ans, i, j, stdc
Iterator variables: i, j
C++ program:
#include <bits/stdc++.h>
using namespace std ; int countbitdiff ( int xo ) { int count = 0 ; while ( xo ) { if ( xo % 2 == 1 ) { count ++ ; } xo = xo / 2 ; } return count ; } void shortestPath ( int n , int a , int b ) { int xorVal = a ^ b ; int cnt = countbitdiff ( xorVal ) ; if ( cnt % 2 == 0 ) cout << cnt / 2 << endl ; else cout << " - 1" << endl ; } int main ( ) { int n = 15 ; int a = 15 , b = 3 ; shortestPath ( n , a , b ) ; return 0 ; }

Accumulator variables: count, stdc
C++ program:
#include <bits/stdc++.h>
using namespace std ; const int M = 3 ; const int N = 3 ; int findXOR ( int X ) { int ans = 0 ; while ( X ) { ans ^= ( X % 10 ) ; X /= 10 ; } return ans ; } void printXORmatrix ( int arr [ M ] [ N ] ) { for ( int i = 0 ; i < M ; i ++ ) { for ( int j = 0 ; j < N ; j ++ ) { cout << arr [ i ] [ j ] << " ▁ " ; } cout << " STRNEWLINE " ; } } void convertXOR ( int arr [ M ] [ N ] ) { for ( int i = 0 ; i < M ; i ++ ) { for ( int j = 0 ; j < N ; j ++ ) { int X = arr [ i ] [ j ] ; int temp = findXOR ( X ) ; arr [ i ] [ j ] = temp ; } } printXORmatrix ( arr ) ; } int main ( ) { int arr [ ] [ 3 ] = { { 27 , 173 , 5 } , { 21 , 6 , 624 } , { 5 , 321 , 49 } } ; convertXOR ( arr ) ; return 0 ; }

Index/key variables: M, N, i, j
Accumulator variables: X, ans, i, j, stdc
Iterator variables: i, j
C++ program:
#include <bits/stdc++.h>
#define M  1000000007
using namespace std ; void findSum ( int A [ ] , int N ) { long long ans = 0 ; for ( int i = 0 ; i < 30 ; i ++ ) { vector < long long > vec ; for ( int j = 0 ; j < N ; j ++ ) { if ( ( A [ j ] >> i ) & 1 ) { long long X = ( A [ j ] >> ( i + 1 ) ) ; X = X * ( 1 << ( i + 1 ) ) ; X %= M ; vec . push_back ( A [ j ] - X ) ; } } sort ( vec . begin ( ) , vec . end ( ) ) ; for ( int j = 0 ; j < vec . size ( ) ; j ++ ) { int Y = ( 1 << ( i + 1 ) ) + ( 1 << i ) - vec [ j ] ; int idx = lower_bound ( vec . begin ( ) + j + 1 , vec . end ( ) , Y ) - vec . begin ( ) ; ans += ( vec . size ( ) - idx ) * 1ll * ( 1 << i ) ; ans %= M ; } } cout << ans % M << endl ; } int main ( ) { int arr [ ] = { 1 , 3 , 3 } ; int N = sizeof ( arr ) / sizeof ( arr [ 0 ] ) ; findSum ( arr , N ) ; return 0 ; }

Index/key variables: j
Accumulator variables: ans, i, j, stdc
Iterator variables: i, j
C++ program:
#include <iostream>
using namespace std ; int countSet ( int N ) { int ans = 0 ; while ( N ) { ans += N & 1 ; N >>= 1 ; } return ans ; } int countSub ( int * arr , int k ) { int ans = 0 ; int setK = 0 ; for ( int i = 0 ; i < 5 ; i ++ ) { if ( countSet ( arr [ i ] ) == k ) setK += 1 ; else setK = 0 ; ans += setK ; } return ans ; } int main ( ) { int arr [ ] = { 4 , 2 , 1 , 5 , 6 } ; int K = 2 ; cout << ( countSub ( arr , K ) ) ; return 0 ; }

Index/key variables: i
Accumulator variables: ans, i, setK
Iterator variables: i
C++ program:
#include <bits/stdc++.h>
using namespace std ; void oddXorSubarray ( int a [ ] , int n ) { int odd = 0 ; int c_odd = 0 ; int result = 0 ; for ( int i = 0 ; i < n ; i ++ ) { if ( a [ i ] & 1 ) { odd = ! odd ; } if ( odd ) { c_odd ++ ; } } for ( int i = 0 ; i < n ; i ++ ) { result += c_odd ; if ( a [ i ] & 1 ) { c_odd = ( n - i - c_odd ) ; } } cout << result ; } int main ( ) { int arr [ ] = { 1 , 4 , 7 , 9 , 10 } ; int N = sizeof ( arr ) / sizeof ( arr [ 0 ] ) ; oddXorSubarray ( arr , N ) ; return 0 ; }

Index/key variables: i
Accumulator variables: c_odd, i, result, stdc
Iterator variables: i
C++ program:
#include <bits/stdc++.h>
#include <inttypes.h>
using namespace std ; struct Node { int data ; struct Node * nxp ; } ; struct Node * XOR ( struct Node * a , struct Node * b ) { return ( struct Node * ) ( ( uintptr_t ) ( a ) ^ ( uintptr_t ) ( b ) ) ; } struct Node * insert ( struct Node * * head , int value ) { if ( * head == NULL ) { struct Node * node = new Node ; node -> data = value ; node -> nxp = XOR ( NULL , NULL ) ; * head = node ; } else { struct Node * curr = * head ; struct Node * prev = NULL ; struct Node * node = new Node ( ) ; curr -> nxp = XOR ( node , XOR ( NULL , curr -> nxp ) ) ; node -> nxp = XOR ( NULL , curr ) ; * head = node ; node -> data = value ; } return * head ; } void printList ( struct Node * * head ) { struct Node * curr = * head ; struct Node * prev = NULL ; struct Node * next ; while ( curr != NULL ) { cout << curr -> data << " ▁ " ; next = XOR ( prev , curr -> nxp ) ; prev = curr ; curr = next ; } } struct Node * RevInGrp ( struct Node * * head , int K , int len ) { struct Node * curr = * head ; if ( curr == NULL ) return NULL ; int count = 0 ; struct Node * prev = NULL ; struct Node * next ; while ( count < K && count < len ) { next = XOR ( prev , curr -> nxp ) ; prev = curr ; curr = next ; count ++ ; } prev -> nxp = XOR ( NULL , XOR ( prev -> nxp , curr ) ) ; if ( curr != NULL ) curr -> nxp = XOR ( XOR ( curr -> nxp , prev ) , NULL ) ; if ( len < K ) { return prev ; } else { len -= K ; struct Node * dummy = RevInGrp ( & curr , K , len ) ; ( * head ) -> nxp = XOR ( XOR ( NULL , ( * head ) -> nxp ) , dummy ) ; if ( dummy != NULL ) dummy -> nxp = XOR ( XOR ( dummy -> nxp , NULL ) , * head ) ; return prev ; } } int main ( ) { struct Node * head = NULL ; insert ( & head , 0 ) ; insert ( & head , 2 ) ; insert ( & head , 1 ) ; insert ( & head , 3 ) ; insert ( & head , 11 ) ; insert ( & head , 8 ) ; insert ( & head , 6 ) ; insert ( & head , 7 ) ; head = RevInGrp ( & head , 3 , 8 ) ; printList ( & head ) ; return ( 0 ) ; }

Accumulator variables: count, len, stdc
Class/struct names: Node
C++ program:
#include <bits/stdc++.h>
using namespace std ; void printORSumforEachElement ( int arr [ ] , int N ) { for ( int i = 0 ; i < N ; i ++ ) { int req_sum = 0 ; for ( int j = 0 ; j < N ; j ++ ) { req_sum += ( arr [ i ] arr [ j ] ) ; } cout << req_sum << " ▁ " ; } } int main ( ) { int arr [ ] = { 1 , 2 , 3 , 4 } ; int N = sizeof ( arr ) / sizeof ( arr [ 0 ] ) ; printORSumforEachElement ( arr , N ) ; return 0 ; }

Index/key variables: i, j
Accumulator variables: i, j, req_sum, stdc
Iterator variables: i, j
C++ program:
#include <bits/stdc++.h>
using namespace std ; struct Node { int data ; Node * nxp ; } ; Node * XOR ( Node * a , Node * b ) { return ( Node * ) ( ( uintptr_t ) ( a ) ^ ( uintptr_t ) ( b ) ) ; } Node * insert ( Node * * head , int value ) { if ( * head == NULL ) { Node * node = new Node ( ) ; node -> data = value ; node -> nxp = XOR ( NULL , NULL ) ; * head = node ; } else { Node * curr = * head ; Node * prev = NULL ; Node * node = new Node ( ) ; curr -> nxp = XOR ( node , XOR ( NULL , curr -> nxp ) ) ; node -> nxp = XOR ( NULL , curr ) ; * head = node ; node -> data = value ; } return * head ; } void printList ( Node * * head ) { Node * curr = * head ; Node * prev = NULL ; Node * next ; while ( curr != NULL ) { cout << curr -> data << " ▁ " ; next = XOR ( prev , curr -> nxp ) ; prev = curr ; curr = next ; } cout << endl ; } Node * reverse ( Node * * head ) { Node * curr = * head ; if ( curr == NULL ) return NULL ; else { Node * prev = NULL ; Node * next ; while ( XOR ( prev , curr -> nxp ) != NULL ) { next = XOR ( prev , curr -> nxp ) ; prev = curr ; curr = next ; } * head = curr ; return * head ; } } int main ( ) { Node * head = NULL ; insert ( & head , 10 ) ; insert ( & head , 20 ) ; insert ( & head , 30 ) ; insert ( & head , 40 ) ; cout << " XOR ▁ linked ▁ list : ▁ " ; printList ( & head ) ; reverse ( & head ) ; cout << " Reversed ▁ XOR ▁ linked ▁ list : ▁ " ; printList ( & head ) ; return 0 ; }

Accumulator variables: stdc
Class/struct names: Node
C++ program:
#include <bits/stdc++.h>
using namespace std ; void Bitwise_OR_sum_i ( int arr1 [ ] , int arr2 [ ] , int M , int N ) { int frequency [ 32 ] = { 0 } ; for ( int i = 0 ; i < N ; i ++ ) { int bit_position = 0 ; int num = arr1 [ i ] ; while ( num ) { if ( num & 1 ) { frequency [ bit_position ] += 1 ; } bit_position += 1 ; num >>= 1 ; } } for ( int i = 0 ; i < M ; i ++ ) { int num = arr2 [ i ] ; int value_at_that_bit = 1 ; int bitwise_OR_sum = 0 ; for ( int bit_position = 0 ; bit_position < 32 ; bit_position ++ ) { if ( num & 1 ) { bitwise_OR_sum += N * value_at_that_bit ; } else { bitwise_OR_sum += frequency [ bit_position ] * value_at_that_bit ; } num >>= 1 ; value_at_that_bit <<= 1 ; } cout << bitwise_OR_sum << ' ▁ ' ; } return ; } int main ( ) { int arr1 [ ] = { 1 , 2 , 3 } ; int arr2 [ ] = { 1 , 2 , 3 } ; int N = sizeof ( arr1 ) / sizeof ( arr1 [ 0 ] ) ; int M = sizeof ( arr2 ) / sizeof ( arr2 [ 0 ] ) ; Bitwise_OR_sum_i ( arr1 , arr2 , M , N ) ; return 0 ; }

Index/key variables: bit_position, i
Accumulator variables: bit_position, bitwise_OR_sum, i, stdc
Iterator variables: bit_position, i
C++ program:
#include <bits/stdc++.h>
#include <inttypes.h>
using namespace std ; struct Node { int data ; struct Node * nxp ; } ; struct Node * XOR ( struct Node * a , struct Node * b ) { return ( struct Node * ) ( ( uintptr_t ) ( a ) ^ ( uintptr_t ) ( b ) ) ; } struct Node * insert ( struct Node * * head , int value ) { if ( * head == NULL ) { struct Node * node = new Node ; node -> data = value ; node -> nxp = XOR ( NULL , NULL ) ; * head = node ; } else { struct Node * curr = * head ; struct Node * prev = NULL ; struct Node * node = new Node ( ) ; curr -> nxp = XOR ( node , XOR ( NULL , curr -> nxp ) ) ; node -> nxp = XOR ( NULL , curr ) ; * head = node ; node -> data = value ; } return * head ; } void printList ( struct Node * * head ) { struct Node * curr = * head ; struct Node * prev = NULL ; struct Node * next ; while ( curr != NULL ) { cout << curr -> data << " ▁ " ; next = XOR ( prev , curr -> nxp ) ; prev = curr ; curr = next ; } } struct Node * NthNode ( struct Node * * head , int N ) { int count = 0 ; struct Node * curr = * head ; struct Node * curr1 = * head ; struct Node * prev = NULL ; struct Node * prev1 = NULL ; struct Node * next ; struct Node * next1 ; while ( count < N && curr != NULL ) { next = XOR ( prev , curr -> nxp ) ; prev = curr ; curr = next ; count ++ ; } if ( curr == NULL && count < N ) { cout << " Wrong ▁ Input STRNEWLINE " ; return ( uintptr_t ) 0 ; } else { while ( curr != NULL ) { next = XOR ( prev , curr -> nxp ) ; next1 = XOR ( prev1 , curr1 -> nxp ) ; prev = curr ; prev1 = curr1 ; curr = next ; curr1 = next1 ; } cout << curr1 -> data << " ▁ " ; } } int main ( ) { struct Node * head = NULL ; insert ( & head , 0 ) ; insert ( & head , 2 ) ; insert ( & head , 1 ) ; insert ( & head , 3 ) ; insert ( & head , 11 ) ; insert ( & head , 8 ) ; insert ( & head , 6 ) ; insert ( & head , 7 ) ; NthNode ( & head , 3 ) ; return ( 0 ) ; }

Accumulator variables: count, stdc
Class/struct names: Node
C++ program:
#include <bits/stdc++.h>
#include <inttypes.h>
using namespace std ; struct Node { int data ; struct Node * nxp ; } ; struct Node * XOR ( struct Node * a , struct Node * b ) { return ( struct Node * ) ( ( uintptr_t ) ( a ) ^ ( uintptr_t ) ( b ) ) ; } struct Node * insert ( struct Node * * head , int value ) { if ( * head == NULL ) { struct Node * node = new Node ; node -> data = value ; node -> nxp = XOR ( NULL , NULL ) ; * head = node ; } else { struct Node * curr = * head ; struct Node * prev = NULL ; struct Node * node = new Node ( ) ; curr -> nxp = XOR ( node , XOR ( NULL , curr -> nxp ) ) ; node -> nxp = XOR ( NULL , curr ) ; * head = node ; node -> data = value ; } return * head ; } int printMiddle ( struct Node * * head , int len ) { int count = 0 ; struct Node * curr = * head ; struct Node * prev = NULL ; struct Node * next ; int middle = ( int ) len / 2 ; while ( count != middle ) { next = XOR ( prev , curr -> nxp ) ; prev = curr ; curr = next ; count ++ ; } if ( len & 1 ) { cout << curr -> data << " ▁ " ; } else { cout << prev -> data << " ▁ " << curr -> data << " ▁ " ; } } int main ( ) { struct Node * head = NULL ; insert ( & head , 4 ) ; insert ( & head , 7 ) ; insert ( & head , 5 ) ; printMiddle ( & head , 3 ) ; return ( 0 ) ; }

Accumulator variables: count, stdc
Class/struct names: Node
C++ program:
#include <bits/stdc++.h>
using namespace std ; struct Node { int data ; struct Node * nxp ; } ; struct Node * XOR ( struct Node * a , struct Node * b ) { return ( struct Node * ) ( ( uintptr_t ) ( a ) ^ ( uintptr_t ) ( b ) ) ; } struct Node * insert ( struct Node * * head , int value , int position ) { if ( * head == NULL ) { if ( position == 1 ) { struct Node * node = new Node ( ) ; node -> data = value ; node -> nxp = XOR ( NULL , NULL ) ; * head = node ; } else { cout << " Invalid ▁ Position STRNEWLINE " ; } } else { int Pos = 1 ; struct Node * curr = * head ; struct Node * prev = NULL ; struct Node * next = XOR ( prev , curr -> nxp ) ; while ( next != NULL && Pos < position - 1 ) { prev = curr ; curr = next ; next = XOR ( prev , curr -> nxp ) ; Pos ++ ; } if ( Pos == position - 1 ) { struct Node * node = new Node ( ) ; struct Node * temp = XOR ( curr -> nxp , next ) ; curr -> nxp = XOR ( temp , node ) ; if ( next != NULL ) { next -> nxp = XOR ( node , XOR ( next -> nxp , curr ) ) ; } node -> nxp = XOR ( curr , next ) ; node -> data = value ; } else if ( position == 1 ) { struct Node * node = new Node ( ) ; curr -> nxp = XOR ( node , XOR ( NULL , curr -> nxp ) ) ; node -> nxp = XOR ( NULL , curr ) ; * head = node ; node -> data = value ; } else { cout << " Invalid ▁ Position STRNEWLINE " ; } } return * head ; } void printList ( struct Node * * head ) { struct Node * curr = * head ; struct Node * prev = NULL ; struct Node * next ; while ( curr != NULL ) { cout << curr -> data << " ▁ " ; next = XOR ( prev , curr -> nxp ) ; prev = curr ; curr = next ; } } int main ( ) { struct Node * head = NULL ; insert ( & head , 10 , 1 ) ; insert ( & head , 20 , 1 ) ; insert ( & head , 30 , 3 ) ; insert ( & head , 40 , 2 ) ; printList ( & head ) ; return 0 ; }

Accumulator variables: Pos, stdc
Class/struct names: Node
C++ program:
#include <iostream>
using namespace std ; void countPairs ( int arr [ ] , int k , int size ) { int count = 0 , x ; for ( int i = 0 ; i < size - 1 ; i ++ ) { for ( int j = i + 1 ; j < size ; j ++ ) { x = arr [ i ] | arr [ j ] ; if ( x == k ) count ++ ; } } cout << count ; } int main ( ) { int arr [ ] = { 2 , 38 , 44 , 29 , 62 } ; int K = 46 ; int N = sizeof ( arr ) / sizeof ( arr [ 0 ] ) ; countPairs ( arr , K , N ) ; return 0 ; }

Index/key variables: i, j
Accumulator variables: count, i, j
Iterator variables: i, j