Language: C

class Node
  def initialize(key, priority)
    @key = key
    @priority = priority
    @parent = nil
    @left = nil
    @right = nil
  end
  attr_accessor :key, :priority, :parent, :left, :right
end

def right_rotate(node_t)
  node_s = node_t.left
  node_t.left = node_s.right
  node_s.right = node_t
  return node_s
end

def left_rotate(node_t)
  node_s = node_t.right
  node_t.right = node_s.left
  node_s.left = node_t
  return node_s
end

def insert(node_t, key, priority)
  if node_t == nil
    return Node.new(key,priority)
  end
  if key == node_t.key
    return node_t
  end

  if key < node_t.key
    node_t.left = insert(node_t.left, key, priority)
    if node_t.priority < node_t.left.priority
      node_t = right_rotate(node_t)
    end
  else
    node_t.right = insert(node_t.right, key, priority)
    if node_t.priority < node_t.right.priority
      node_t = left_rotate(node_t)
    end
  end
  return node_t
end

def find?(key)
  node_x = @root
  loop do
    if node_x == nil
      return false
    elsif node_x.key == key
      return node_x
    elsif key < node_x.key
      node_x = node_x.left
    else
      node_x = node_x.right
    end
  end
end

def delete(node_t, key)
  if node_t == nil
    return nil
  end
  if key < node_t.key
    node_t.left = delete(node_t.left, key)
  elsif key > node_t.key
    node_t.right = delete(node_t.right, key)
  else
    return _delete(node_t, key)
  end
  return node_t
end

def _delete(node_t, key)
  if node_t.left == nil && node_t.right ==nil
    return nil
  elsif node_t.left == nil
    node_t = left_rotate(node_t)
  elsif node_t.right == nil
    node_t = right_rotate(node_t)
  else
    if node_t.left.priority > node_t.right.priority
      node_t = right_rotate(node_t)
    else
      node_t = left_rotate(node_t)
    end
  end
  return delete(node_t, key)
end


def inorder_tree_walk(node)
  if node != nil
    inorder_tree_walk(node.left)
    print " "
    print node.key
    inorder_tree_walk(node.right)
  end
end

def preorder_tree_walk(node)
  if node != nil
    print " "
    print node.key
    preorder_tree_walk(node.left)
    preorder_tree_walk(node.right)
  end
end

def print_tree
  inorder_tree_walk(@root)
  puts
  preorder_tree_walk(@root)
  puts
end


@root = nil

m = gets.to_i
m.times do |t|
  input = gets.split(" ")
  command = input.shift
  input.map!{|x| x.to_i}
  if command == "insert"
    @root = insert(@root, input[0], input[1])
  elsif command == "find"
    if find?(input[0])
      puts "yes"
    else
      puts "no"
    end
  elsif command == "delete"
    @root = delete(@root, input[0])
  else
    print_tree
  end
end



Compiler output:
main.c:1:1: error: unknown type name 'class'
    1 | class Node
      | ^~~~~
main.c:2:3: error: expected '=', ',', ';', 'asm' or '__attribute__' before 'def'
    2 |   def initialize(key, priority)
      |   ^~~
main.c:2:3: error: unknown type name 'def'
main.c:3:5: error: stray '@' in program
    3 |     @key = key
      |     ^
main.c:4:5: error: stray '@' in program
    4 |     @priority = priority
      |     ^
main.c:5:5: error: stray '@' in program
    5 |     @parent = nil
      |     ^
main.c:6:5: error: stray '@' in program
    6 |     @left = nil
      |     ^
main.c:7:5: error: stray '@' in program
    7 |     @right = nil
      |     ^
main.c:49:12: error: stray '@' in program
   49 |   node_x = @root
      |            ^
main.c:114:21: error: stray '@' in program
  114 |   inorder_tree_walk(@root)
      |                     ^
main.c:116:22: error: stray '@' in program
  116 |   preorder_tree_walk(@root)
      |                      ^
main.c:121:1: error: stray '@' in program
  121 | @root = nil
      | ^
main.c:128:3: error: expected identifier or '(' before 'if'
  128 |   if command == "insert"
      |   ^~
main.c:129:5: error: stray '@' in program
  129 |     @root = insert(@root, input[0], input[1])
      |     ^
main.c:129:20: error: stray '@' in program
  129 |     @root = insert(@root, input[0], input[1])
      |                    ^
main.c:137:5: error: stray '@' in program
  137 |     @root = delete(@root, input[0])
      |     ^
main.c:137:20: error: stray '@' in program
  137 |     @root = delete(@root, input[0])
      |                    ^