dhyuti-n/xlcost-variable-roles huggingface dataset:
Javascript program:
class Node { constructor ( ) { this . data = 0 ; this . next = null ; } } function push ( head_ref , data ) { var ptr1 = new Node ( ) ; var temp = head_ref ; ptr1 . data = data ; ptr1 . next = head_ref ; if ( head_ref != null ) { while ( temp . next != head_ref ) temp = temp . next ; temp . next = ptr1 ; } else ptr1 . next = ptr1 ; head_ref = ptr1 ; return head_ref ; } function deleteNode ( head_ref , del ) { var temp = head_ref ; if ( head_ref == del ) head_ref = del . next ; while ( temp . next != del ) { temp = temp . next ; } temp . next = del . next ; del = null ; return ; } function largestElement ( head_ref ) { var current ; current = head_ref ; var maxEle = Number . MIN_VALUE ; do { if ( current . data > maxEle ) { maxEle = current . data ; } current = current . next ; } while ( current != head_ref ) ; return maxEle ; } function createHash ( hash , maxElement ) { var prev = 0 , curr = 1 ; hash . add ( prev ) ; hash . add ( curr ) ; while ( curr <= maxElement ) { var temp = curr + prev ; hash . add ( temp ) ; prev = curr ; curr = temp ; } } function deleteFibonacciNodes ( head ) { var maxEle = largestElement ( head ) ; var hash = new Set ( ) ; createHash ( hash , maxEle ) ; var ptr = head ; var next ; do { if ( hash . has ( ptr . data ) ) deleteNode ( head , ptr ) ; next = ptr . next ; ptr = next ; } while ( ptr != head ) ; } function printList ( head ) { var temp = head ; if ( head != null ) { do { document . write ( temp . data + " " ) ; temp = temp . next ; } while ( temp != head ) ; } } var head = null ; head = push ( head , 20 ) ; head = push ( head , 13 ) ; head = push ( head , 6 ) ; head = push ( head , 34 ) ; head = push ( head , 11 ) ; head = push ( head , 9 ) ; deleteFibonacciNodes ( head ) ; printList ( head ) ;

Class/struct names: Node
Javascript program:
class Node { constructor ( ) { this . data = 0 ; this . next = null ; } } ; function push ( head_ref , data ) { var ptr1 = new Node ( ) ; var temp = head_ref ; ptr1 . data = data ; ptr1 . next = head_ref ; if ( head_ref != null ) { while ( temp . next != head_ref ) temp = temp . next ; temp . next = ptr1 ; return head_ref ; } else ptr1 . next = ptr1 ; head_ref = ptr1 ; return head_ref ; } function deleteNode ( head_ref , del ) { var temp = head_ref ; if ( head_ref == del ) head_ref = del . next ; while ( temp . next != del ) { temp = temp . next ; } temp . next = del . next ; return head_ref ; } function deleteoddNodes ( head ) { var ptr = head ; var next ; do { if ( ptr . data % 2 == 1 ) deleteNode ( head , ptr ) ; next = ptr . next ; ptr = next ; } while ( ptr != head ) ; return head ; } function printList ( head ) { var temp = head ; if ( head != null ) { do { document . write ( temp . data + " " ) ; temp = temp . next ; } while ( temp != head ) ; } } var head = null ; head = push ( head , 2 ) ; head = push ( head , 12 ) ; head = push ( head , 11 ) ; head = push ( head , 57 ) ; head = push ( head , 61 ) ; head = push ( head , 56 ) ; document . write ( " " ) ; head = deleteoddNodes ( head ) ; printList ( head ) ;

Class/struct names: Node
Javascript program:
class Node { constructor ( val ) { this . data = val ; this . next = null ; } } function create ( ) { var new_node = new Node ( ) ; new_node . next = null ; return new_node ; } function find_head ( random ) { if ( random == null ) return null ; var head , vari = random ; while ( ! ( vari . data > vari . next . data vari . next == random ) ) { vari = vari . next ; } return vari . next ; } function sortedInsert ( head_ref , new_node ) { var current = head_ref ; if ( current == null ) { new_node . next = new_node ; head_ref = new_node ; } else if ( current . data >= new_node . data ) { while ( current . next != head_ref ) current = current . next ; current . next = new_node ; new_node . next = head_ref ; head_ref = new_node ; } else { while ( current . next != head_ref && current . next . data < new_node . data ) { current = current . next ; } new_node . next = current . next ; current . next = new_node ; } return head_ref ; } function printList ( start ) { var temp ; if ( start != null ) { temp = start ; do { document . write ( temp . data + " " ) ; temp = temp . next ; } while ( temp != start ) ; } } var arr = [ 12 , 56 , 2 , 11 , 1 , 90 ] ; var list_size , i ; var start = null ; var temp ; for ( i = 0 ; i < 6 ; i ++ ) { if ( start != null ) for ( j = 0 ; j < ( Math . random ( ) * 10 ) ; j ++ ) start = start . next ; temp = create ( ) ; temp . data = arr [ i ] ; start = sortedInsert ( find_head ( start ) , temp ) ; } printList ( find_head ( start ) ) ;

Index/key variables: i
Accumulator variables: i, j
Iterator variables: i, j
Class/struct names: Node
Javascript program:
class Node { constructor ( ) { let data ; let next ; } } function addToEmpty ( last , data ) { if ( last != null ) return last ; let temp = new Node ( ) ; temp . data = data ; last = temp ; last . next = last ; return last ; } function addBegin ( last , data ) { if ( last == null ) return addToEmpty ( data ) ; let temp = new Node ( ) ; temp . data = data ; temp . next = last . next ; last . next = temp ; return last ; } function traverse ( last ) { let p ; if ( last == null ) { document . write ( " " ) ; return ; } p = last . next ; do { document . write ( p . data + " " ) ; p = p . next ; } while ( p != last . next ) ; document . write ( " " ) ; } function length ( last ) { let x = 0 ; if ( last == null ) return x ; let itr = last . next ; while ( itr . next != last . next ) { x ++ ; itr = itr . next ; } return ( x + 1 ) ; } function split ( last , k ) { let pass = new Node ( ) ; if ( last == null ) return last ; let newLast , itr = last ; for ( let i = 0 ; i < k ; i ++ ) { itr = itr . next ; } newLast = itr ; pass . next = itr . next ; newLast . next = last . next ; last . next = pass . next ; return newLast ; } let clist = null ; clist = addToEmpty ( clist , 12 ) ; clist = addBegin ( clist , 10 ) ; clist = addBegin ( clist , 8 ) ; clist = addBegin ( clist , 6 ) ; clist = addBegin ( clist , 4 ) ; clist = addBegin ( clist , 2 ) ; document . write ( " " ) ; traverse ( clist ) ; let k = 4 ; let clist2 = split ( clist , k ) document . write ( " " ) ; traverse ( clist2 ) ; traverse ( clist ) ;

Accumulator variables: i, x
Iterator variables: i
Class/struct names: Node
Javascript program:
class Node { constructor ( val ) { this . data = val ; this . left = null ; this . right = null ; } } function inorder ( root , v ) { if ( root == null ) return ; inorder ( root . left , v ) ; v . push ( root . data ) ; inorder ( root . right , v ) ; } function bTreeToCList ( root ) { if ( root == null ) return null ; var v = [ ] ; inorder ( root , v ) ; var head_ref = new Node ( v [ 0 ] ) ; var curr = head_ref ; for ( i = 1 ; i < v . length ; i ++ ) { var temp = curr ; curr . right = new Node ( v [ i ] ) ; curr = curr . right ; curr . left = temp ; } curr . right = head_ref ; head_ref . left = curr ; return head_ref ; } function displayCList ( head ) { document . write ( " " ) ; var itr = head ; do { document . write ( itr . data + " " ) ; itr = itr . right ; } while ( head != itr ) ; document . write ( ) ; } var root = new Node ( 10 ) ; root . left = new Node ( 12 ) ; root . right = new Node ( 15 ) ; root . left . left = new Node ( 25 ) ; root . left . right = new Node ( 30 ) ; root . right . left = new Node ( 36 ) ; var head = bTreeToCList ( root ) ; displayCList ( head ) ;

Index/key variables: i
Accumulator variables: i
Iterator variables: i
Class/struct names: Node
Javascript program:
function DeleteAllOddNode ( head ) { let len = Length ( head ) ; let count = 0 ; var previous = head , next = head ; if ( head == null ) { document . write ( " " + " " + " " ) ; return null ; } if ( len == 1 ) { head = DeleteFirst ( head ) ; return head ; } while ( len > 0 ) { if ( count == 0 ) { head = DeleteFirst ( head ) ; } if ( count % 2 == 0 && count != 0 ) { head = deleteNode ( head , previous ) ; } previous = previous . next ; next = previous . next ; len -- ; count ++ ; } return head ; }

Accumulator variables: count, len
Javascript program:
function DeleteAllEvenNode ( head ) { var len = Length ( head ) ; var count = 1 ; var previous = head , next = head ; if ( head == null ) { document . write ( " " ) ; return null ; } if ( len < 2 ) { return null ; } previous = head ; next = previous . next ; while ( len > 0 ) { if ( count % 2 == 0 ) { previous . next = next . next ; previous = next . next ; next = previous . next ; } len -- ; count ++ ; } return head ; }

Accumulator variables: count, len
Javascript program:
class Node { constructor ( ) { this . data = 0 ; this . next = null ; } } function Length ( head ) { var current = head ; let count = 0 ; if ( head == null ) { return 0 ; } else { do { current = current . next ; count ++ ; } while ( current != head ) ; } return count ; } function Display ( head ) { var current = head ; if ( head == null ) { document . write ( " " + " " + " " ) ; return ; } else { do { document . write ( current . data + " " ) ; current = current . next ; } while ( current != head ) ; } } function Insert ( head , data ) { var current = head ; var newNode = new Node ( ) ; if ( newNode == null ) { document . write ( " " + " " + " " ) ; return null ; } newNode . data = data ; if ( head == null ) { newNode . next = newNode ; head = newNode ; return head ; } else { while ( current . next != head ) { current = current . next ; } newNode . next = head ; current . next = newNode ; } return head ; } function deleteNode ( head_ref , del ) { var temp = head_ref ; if ( head_ref == del ) { head_ref = del . next ; } while ( temp . next != del ) { temp = temp . next ; } temp . next = del . next ; return head_ref ; } function DeleteFirst ( head ) { var previous = head , next = head ; if ( head == null ) { document . write ( " " + " " + " " ) ; return head ; } if ( previous . next == previous ) { head = null ; return head ; } while ( previous . next != head ) { previous = previous . next ; next = previous . next ; } previous . next = next . next ; head = previous . next ; return head ; } function DeleteAllOddNode ( head ) { let len = Length ( head ) ; let count = 0 ; var previous = head , next = head ; if ( head == null ) { document . write ( " " + " " + " " ) ; return null ; } if ( len == 1 ) { head = DeleteFirst ( head ) ; return head ; } while ( len > 0 ) { if ( count == 0 ) { head = DeleteFirst ( head ) ; } if ( count % 2 == 0 && count != 0 ) { head = deleteNode ( head , previous ) ; } previous = previous . next ; next = previous . next ; len -- ; count ++ ; } return head ; } function DeleteAllEvenNode ( head ) { let len = Length ( head ) ; let count = 1 ; var previous = head , next = head ; if ( head == null ) { document . write ( " " + " " + " " ) ; return null ; } if ( len < 2 ) { return null ; } previous = head ; next = previous . next ; while ( len > 0 ) { if ( count % 2 == 0 ) { previous . next = next . next ; previous = next . next ; next = previous . next ; } len -- ; count ++ ; } return head ; } var head = null ; head = Insert ( head , 99 ) ; head = Insert ( head , 11 ) ; head = Insert ( head , 22 ) ; head = Insert ( head , 33 ) ; head = Insert ( head , 44 ) ; head = Insert ( head , 55 ) ; head = Insert ( head , 66 ) ; document . write ( " " ) ; Display ( head ) ; document . write ( " " + " " ) ; head = DeleteAllOddNode ( head ) ; Display ( head ) ; document . write ( " " + " " + " " ) ; Display ( head ) ; document . write ( " " + " " ) ; head = DeleteAllEvenNode ( head ) ; Display ( head ) ;

Accumulator variables: count, len
Class/struct names: Node
Javascript program:
class Node { constructor ( ) { this . data = 0 ; this . next = null ; } } function printMinMax ( head ) { if ( head == null ) { return ; } var current ; current = head ; var min = Number . MAX_VALUE , max = Number . MIN_VALUE ; while ( current . next != head ) { if ( current . data < min ) { min = current . data ; } if ( current . data > max ) { max = current . data ; } current = current . next ; } document . write ( " " + min + " " + max ) ; } function insertNode ( head , data ) { var current = head ; var newNode = new Node ( ) ; if ( newNode == null ) { document . write ( " " ) ; return null ; } newNode . data = data ; if ( head == null ) { newNode . next = newNode ; head = newNode ; return head ; } else { while ( current . next != head ) { current = current . next ; } newNode . next = head ; current . next = newNode ; } return head ; } function displayList ( head ) { var current = head ; if ( head == null ) { document . write ( " " ) ; return ; } else { do { document . write ( current . data + " " ) ; current = current . next ; } while ( current != head ) ; } } var Head = null ; Head = insertNode ( Head , 99 ) ; Head = insertNode ( Head , 11 ) ; Head = insertNode ( Head , 22 ) ; Head = insertNode ( Head , 33 ) ; Head = insertNode ( Head , 44 ) ; Head = insertNode ( Head , 55 ) ; Head = insertNode ( Head , 66 ) ; document . write ( " " ) ; displayList ( Head ) ; printMinMax ( Head ) ;

Class/struct names: Node
Javascript program:
class Node { constructor ( ) { this . data = 0 ; this . next = null ; } } function push ( head_ref , data ) { var ptr1 = new Node ( ) ; var temp = head_ref ; ptr1 . data = data ; ptr1 . next = head_ref ; if ( head_ref != null ) { while ( temp . next != head_ref ) temp = temp . next ; temp . next = ptr1 ; return head_ref ; } else ptr1 . next = ptr1 ; head_ref = ptr1 ; return head_ref ; } function deleteNode ( head_ref , del ) { var temp = head_ref ; if ( head_ref == del ) head_ref = del . next ; while ( temp . next != del ) { temp = temp . next ; } temp . next = del . next ; return head_ref ; } function deleteEvenNodes ( head ) { var ptr = head ; var next ; do { if ( ptr . data % 2 == 0 ) deleteNode ( head , ptr ) ; next = ptr . next ; ptr = next ; } while ( ptr != head ) ; return head ; } function printList ( head ) { var temp = head ; if ( head != null ) { do { document . write ( temp . data + " " ) ; temp = temp . next ; } while ( temp != head ) ; } } var head = null ; head = push ( head , 61 ) ; head = push ( head , 12 ) ; head = push ( head , 56 ) ; head = push ( head , 2 ) ; head = push ( head , 11 ) ; head = push ( head , 57 ) ; document . write ( " " ) ; head = deleteEvenNodes ( head ) ; printList ( head ) ;

Class/struct names: Node
Javascript program:
class Node { constructor ( ) { this . data = 0 ; this . next = null ; } } function push ( head_ref , data ) { var ptr1 = new Node ( ) ; var temp = head_ref ; ptr1 . data = data ; ptr1 . next = head_ref ; if ( head_ref != null ) { while ( temp . next != head_ref ) temp = temp . next ; temp . next = ptr1 ; } else ptr1 . next = ptr1 ; head_ref = ptr1 ; return head_ref ; } function sumOfList ( head ) { var temp = head ; var sum = 0 ; if ( head != null ) { do { temp = temp . next ; sum += temp . data ; } while ( temp != head ) ; } return sum ; } var head = null ; head = push ( head , 12 ) ; head = push ( head , 56 ) ; head = push ( head , 2 ) ; head = push ( head , 11 ) ; document . write ( " " + " " + sumOfList ( head ) ) ;

Accumulator variables: sum
Class/struct names: Node
Javascript program:
class Node { constructor ( val ) { this . data = val ; this . next = null ; } } function printList ( head ) { if ( head == null ) return ; var temp = head ; do { document . write ( temp . data + " " ) ; temp = temp . next ; } while ( temp != head ) ; document . write ( head . data + " " ) ; } function deleteK ( head_ref , k ) { var head = head_ref ; if ( head == null ) return null ; var curr = head , prev = null ; while ( true ) { if ( curr . next == head && curr == head ) break ; printList ( head ) ; for ( i = 0 ; i < k ; i ++ ) { prev = curr ; curr = curr . next ; } if ( curr == head ) { prev = head ; while ( prev . next != head ) prev = prev . next ; head = curr . next ; prev . next = head ; head_ref = head ; } else if ( curr . next == head ) { prev . next = head ; } else { prev . next = curr . next ; } } return head ; } function insertNode ( head_ref , x ) { var head = head_ref ; var temp = new Node ( x ) ; if ( head == null ) { temp . next = temp ; head_ref = temp ; return head_ref ; } else { var temp1 = head ; while ( temp1 . next != head ) temp1 = temp1 . next ; temp1 . next = temp ; temp . next = head ; } return head ; } var head = null ; head = insertNode ( head , 1 ) ; head = insertNode ( head , 2 ) ; head = insertNode ( head , 3 ) ; head = insertNode ( head , 4 ) ; head = insertNode ( head , 5 ) ; head = insertNode ( head , 6 ) ; head = insertNode ( head , 7 ) ; head = insertNode ( head , 8 ) ; head = insertNode ( head , 9 ) ; var k = 4 ; head = deleteK ( head , k ) ;

Accumulator variables: i
Iterator variables: i
Class/struct names: Node
Javascript program:
class node { constructor ( ) { this . data = 0 ; this . next = null ; this . prev = null ; } } function getNode ( ) { return new node ( ) ; } function displayList ( temp ) { var t = temp ; if ( temp == null ) return 0 ; else { document . write ( " " ) ; while ( temp . next != t ) { document . write ( temp . data + " " ) ; temp = temp . next ; } document . write ( temp . data + " " ) ; return 1 ; } } function countList ( start ) { var temp = start ; var count = 0 ; while ( temp . next != start ) { temp = temp . next ; count ++ ; } count ++ ; return count ; } function insertAtLocation ( start , data , loc ) { var temp , newNode ; var i , count ; newNode = getNode ( ) ; temp = start ; count = countList ( start ) ; if ( temp == null count < loc ) return start ; else { newNode . data = data ; for ( i = 1 ; i < loc - 1 ; i ++ ) { temp = temp . next ; } newNode . next = temp . next ; temp . next . prev = newNode ; temp . next = newNode ; newNode . prev = temp ; return start ; } } function createList ( arr , n , start ) { var newNode , temp ; var i ; for ( i = 0 ; i < n ; i ++ ) { newNode = getNode ( ) ; newNode . data = arr [ i ] ; if ( i == 0 ) { start = newNode ; newNode . prev = start ; newNode . next = start ; } else { temp = start . prev ; temp . next = newNode ; newNode . next = start ; newNode . prev = temp ; temp = start ; temp . prev = newNode ; } } return start ; } var arr = [ 1 , 2 , 3 , 4 , 5 , 6 ] ; var n = arr . length ; var start = null ; start = createList ( arr , n , start ) ; displayList ( start ) ; start = insertAtLocation ( start , 8 , 3 ) ; displayList ( start ) ;

Index/key variables: i
Accumulator variables: count, i
Iterator variables: i
Class/struct names: node
Javascript program:
class node { constructor ( ) { this . data = 0 ; this . next = this . prev = null ; } } function getNode ( ) { return new node ( ) ; } function displayList ( temp ) { let t = temp ; if ( temp == null ) return 0 ; else { document . write ( " " ) ; while ( temp . next != t ) { document . write ( temp . data + " " ) ; temp = temp . next ; } document . write ( temp . data ) ; return 1 ; } } function createList ( arr , n , start ) { let newNode , temp ; let i ; for ( i = 0 ; i < n ; i ++ ) { newNode = getNode ( ) ; newNode . data = arr [ i ] ; if ( i == 0 ) { start = newNode ; newNode . prev = start ; newNode . next = start ; } else { temp = ( start ) . prev ; temp . next = newNode ; newNode . next = start ; newNode . prev = temp ; temp = start ; temp . prev = newNode ; } } return start ; } let arr = [ 1 , 2 , 3 , 4 , 5 ] ; let n = arr . length ; let start = null ; start = createList ( arr , n , start ) ; displayList ( start ) ;

Index/key variables: i
Accumulator variables: i
Iterator variables: i
Class/struct names: node
Javascript program:
class Node { constructor ( ) { this . data = 0 ; this . next = null ; } } function newNode ( data ) { var node = new Node ( ) ; node . data = data ; node . next = null ; return node ; } function alivesol ( Num ) { if ( Num == 1 ) return 1 ; var last = newNode ( 1 ) ; last . next = last ; for ( var i = 2 ; i <= Num ; i ++ ) { var tem = newNode ( i ) ; tem . next = last . next ; last . next = tem ; last = tem ; } var curr = last . next ; var tem1 = new Node ( ) ; while ( curr . next != curr ) { tem1 = curr ; curr = curr . next ; tem1 . next = curr . next ; tem1 = tem1 . next ; curr = tem1 ; } var res = tem1 . data ; return res ; } var N = 100 ; document . write ( alivesol ( N ) + " " ) ;

Accumulator variables: i
Iterator variables: i
Class/struct names: Node
Javascript program:
class Node { constructor ( data ) { this . left = null ; this . right = null ; this . data = data ; } } function findDepth ( root ) { if ( root == null ) return 0 ; let left = findDepth ( root . left ) ; let right = findDepth ( root . right ) ; return 1 + Math . max ( left , right ) ; } function DFS ( root , curr , depth ) { if ( root == null ) return null ; if ( curr == depth ) return root ; let left = DFS ( root . left , curr + 1 , depth ) ; let right = DFS ( root . right , curr + 1 , depth ) ; if ( left != null && right != null ) return root ; return ( left != null ) ? left : right ; } function lcaOfDeepestLeaves ( root ) { if ( root == null ) return null ; let depth = findDepth ( root ) - 1 ; return DFS ( root , 0 , depth ) ; } let root = new Node ( 1 ) ; root . left = new Node ( 2 ) ; root . right = new Node ( 3 ) ; root . left . left = new Node ( 4 ) ; root . left . right = new Node ( 5 ) ; root . right . left = new Node ( 6 ) ; root . right . right = new Node ( 7 ) ; root . right . left . left = new Node ( 8 ) ; root . right . left . right = new Node ( 9 ) ; document . write ( lcaOfDeepestLeaves ( root ) . data ) ;

Class/struct names: Node
Javascript program:
function filter ( x , y , z ) { if ( x != - 1 && y != - 1 ) { return z ; } return x == - 1 ? y : x ; } function samePathUtil ( mtrx , vrtx , v1 , v2 , i ) { let ans = - 1 ; if ( i == v1 i == v2 ) return i ; for ( let j = 0 ; j < vrtx ; j ++ ) { if ( mtrx [ i ] [ j ] == 1 ) { ans = filter ( ans , samePathUtil ( mtrx , vrtx , v1 , v2 , j ) , i ) ; } } return ans ; } function isVertexAtSamePath ( mtrx , vrtx , v1 , v2 , i ) { let lca = samePathUtil ( mtrx , vrtx , v1 - 1 , v2 - 1 , i ) ; if ( lca == v1 - 1 lca == v2 - 1 ) return true ; return false ; } let vrtx = 7 ; let mtrx = [ [ 0 , 1 , 1 , 1 , 0 , 0 , 0 ] , [ 0 , 0 , 0 , 0 , 1 , 0 , 0 ] , [ 0 , 0 , 0 , 0 , 0 , 1 , 0 ] , [ 0 , 0 , 0 , 0 , 0 , 0 , 1 ] , [ 0 , 0 , 0 , 0 , 0 , 0 , 0 ] , [ 0 , 0 , 0 , 0 , 0 , 0 , 0 ] , [ 0 , 0 , 0 , 0 , 0 , 0 , 0 ] ] ; let v1 = 1 , v2 = 5 ; if ( isVertexAtSamePath ( mtrx , vrtx , v1 , v2 , 0 ) ) document . write ( " " ) ; else document . write ( " " ) ;

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