Language: C++

# http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=ALDS1_2_C&lang=jp
sample_input = list(range(3))
sample_input[0] = '''5
H4 C9 S4 D2 C3'''
sample_input[1] = '''2
S1 H1'''
sample_input[2] = '''5
H4 C9 S4 D2 C3'''
give_sample_input = None
if give_sample_input is not None:
    sample_input_list = sample_input[give_sample_input].split('\n')
    def input():
        return sample_input_list.pop(0)
        
# main
import copy

def swap_list_item(lst, i, j):
    tmp = lst[i]
    lst[i] = lst[j]
    lst[j] = tmp
    
class Card:
    number = None
    mark = None
    def __init__(self, str_card):
        self.number = int(str_card[1])
        self.mark = str_card[0]
        pass
    def __eq__(self, other):
        return self.number == other.number
    def __lt__(self, other):
        return self.number < other.number
    def to_str(self):
        return self.mark + str(self.number)

def selection_sort(list_of_data):
    num_of_data = len(list_of_data)
    for i in range(num_of_data):
        minj = i
        for j in range(i, num_of_data):
            if list_of_data[minj] > list_of_data[j]:
                minj = j
        if not minj == i:
            swap_list_item(list_of_data, i, minj)
            
def bubble_sort(list_of_data):
    flag = True
    while flag:
        flag = False
        n = num_of_data - 1
        while n >= 1:
            if list_of_data[n] < list_of_data[n-1]:
                swap_list_item(list_of_data, n, n-1)
                flag = True
            n -= 1
        
def get_mark_order_info(card_list, number):
    result = ''
    for card in card_list:
        if card.number == number:
            result += card.mark
    return result

def print_card_list(card_list):
    output = ''
    for card in card_list:
        output += card.to_str() + ' '
    output.rstrip()
    print(output)

num_of_data = int(input())
data_list_str = input().split()
data_cards = [Card(str) for str in data_list_str]
data_cards_bubble = copy.copy(data_cards)
data_cards_selection = copy.copy(data_cards)

mark_order_info = []
for number in [n+1 for n in range(13)]:
    mark_order_info.append(get_mark_order_info(data_cards, number))
    
bubble_sort(data_cards_bubble)
selection_sort(data_cards_selection)

mark_order_info_bubble = []
for number in [n+1 for n in range(13)]:
    mark_order_info_bubble.append(get_mark_order_info(data_cards_bubble, number))

mark_order_info_selection = []
for number in [n+1 for n in range(13)]:
    mark_order_info_selection.append(get_mark_order_info(data_cards_selection, number))
    
print_card_list(data_cards_bubble)
if (mark_order_info == mark_order_info_bubble):
    print('Stable')
else:
    print('Not Stable')
    
print_card_list(data_cards_selection)
if (mark_order_info == mark_order_info_selection):
    print('Stable')
else:
    print('Not Stable')

Compiler output:
a.cc:1:3: error: invalid preprocessing directive #http
    1 | # http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=ALDS1_2_C&lang=jp
      |   ^~~~
a.cc:3:19: error: empty character constant
    3 | sample_input[0] = '''5
      |                   ^~
a.cc:3:21: warning: missing terminating ' character
    3 | sample_input[0] = '''5
      |                     ^
a.cc:3:21: error: missing terminating ' character
    3 | sample_input[0] = '''5
      |                     ^~
a.cc:4:15: error: empty character constant
    4 | H4 C9 S4 D2 C3'''
      |               ^~
a.cc:4:17: warning: missing terminating ' character
    4 | H4 C9 S4 D2 C3'''
      |                 ^
a.cc:4:17: error: missing terminating ' character
a.cc:5:19: error: empty character constant
    5 | sample_input[1] = '''2
      |                   ^~
a.cc:5:21: warning: missing terminating ' character
    5 | sample_input[1] = '''2
      |                     ^
a.cc:5:21: error: missing terminating ' character
    5 | sample_input[1] = '''2
      |                     ^~
a.cc:6:6: error: empty character constant
    6 | S1 H1'''
      |      ^~
a.cc:6:8: warning: missing terminating ' character
    6 | S1 H1'''
      |        ^
a.cc:6:8: error: missing terminating ' character
a.cc:7:19: error: empty character constant
    7 | sample_input[2] = '''5
      |                   ^~
a.cc:7:21: warning: missing terminating ' character
    7 | sample_input[2] = '''5
      |                     ^
a.cc:7:21: error: missing terminating ' character
    7 | sample_input[2] = '''5
      |                     ^~
a.cc:8:15: error: empty character constant
    8 | H4 C9 S4 D2 C3'''
      |               ^~
a.cc:8:17: warning: missing terminating ' character
    8 | H4 C9 S4 D2 C3'''
      |                 ^
a.cc:8:17: error: missing terminating ' character
a.cc:15:3: error: invalid preprocessing directive #main
   15 | # main
      |   ^~~~
a.cc:59:14: error: empty character constant
   59 |     result = ''
      |              ^~
a.cc:66:14: error: empty character constant
   66 |     output = ''
      |              ^~
a.cc:95:11: warning: multi-character literal with 6 characters exceeds 'int' size of 4 bytes
   95 |     print('Stable')
      |           ^~~~~~~~
a.cc:97:11: warning: multi-character literal with 10 characters exceeds 'int' size of 4 bytes
   97 |     print('Not Stable')
      |           ^~~~~~~~~~~~
a.cc:101:11: warning: multi-character literal with 6 characters exceeds 'int' size of 4 bytes
  101 |     print('Stable')
      |           ^~~~~~~~
a.cc:103:11: warning: multi-character literal with 10 characters exceeds 'int' size of 4 bytes
  103 |     print('Not Stable')
      |           ^~~~~~~~~~~~
a.cc:2:1: error: 'sample_input' does not name a type
    2 | sample_input = list(range(3))
      | ^~~~~~~~~~~~