Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Runtime Error):
[print(["YES", "NO"][0 if int(i[0]) ** 2 + int(i[1]) ** 2 == int(i[2]) ** 2 else 1]) for i in sorted(input().split()) for _ in range(int(input()))]

Fixed submission:
[print("YES" if i[0] + i[1] == i[2] else "NO") for _ in range(int(input())) for i in [sorted([int(x) ** 2 for x in input().split()])]]

Buggy python submission (verdict: Runtime Error):
[print(["YES", "NO"][0 if int(i[0]) ** 2 + int(i[1]) ** 2 == int(i[2]) ** 2 else 1]) for i in sorted([int(x) for x in input().split()]) for _ in range(int(input()))]

Fixed submission:
[print("YES" if i[0] + i[1] == i[2] else "NO") for _ in range(int(input())) for i in [sorted([int(x) ** 2 for x in input().split()])]]

Buggy python submission (verdict: Runtime Error):
[ print(["YES", "NO"][0 if i[0] ** 2 + i[1] ** 2 == i[2] ** 2 else 1]) for i in [sorted([int(x) ** 2 for x in input().split()])] for _ in range(int(input()))]

Fixed submission:
[print("YES" if i[0] + i[1] == i[2] else "NO") for _ in range(int(input())) for i in [sorted([int(x) ** 2 for x in input().split()])]]

Buggy python submission (verdict: Runtime Error):
[ print(["YES", "NO"][0 if d[0] ** 2 + d[1] ** 2 == d[2] ** 2 else 1]) for i,d in enumerate([sorted([int(x) ** 2 for x in input().split()])]) for _ in range(int(input()))]

Fixed submission:
[print("YES" if i[0] + i[1] == i[2] else "NO") for _ in range(int(input())) for i in [sorted([int(x) ** 2 for x in input().split()])]]
Buggy python submission (verdict: Runtime Error):
[print("{0:.3f} {1:.3f}".format((k[2] - k[1] * ((k[0] * k[5] - k[2] * k[3]) / (k[0] * k[4] - k[1] * k[3]))) / k[0], ((k[0] * k[5] - k[2] * k[3]) / (k[0] * k[4] - k[1] * k[3])))) for i in sys.stdin for k in [[int(j) for j in i.split()]]]

Fixed submission:
import sys
[print("{0:.3f} {1:.3f}".format((k[2] - k[1] * ((k[0] * k[5] - k[2] * k[3]) / (k[0] * k[4] - k[1] * k[3]))) / k[0], ((k[0] * k[5] - k[2] * k[3]) / (k[0] * k[4] - k[1] * k[3])))) for i in sys.stdin for k in [[int(float(j)) for j in i.split()]]]

Buggy python submission (verdict: Runtime Error):
[print("{0:.3f} {1:.3f}".format(
	(k[2] - k[1] * ((k[0] * k[5] - k[2] * k[3]) / (k[0] * k[4] - k[1] * k[3]))) / k[0],
	((k[0] * k[5] - k[2] * k[3]) / (k[0] * k[4] - k[1] * k[3])))
) for i in sys.stdin for k in [int(j) for j in i.split()]]

Fixed submission:
import sys
[print("{0:.3f} {1:.3f}".format((k[2] - k[1] * ((k[0] * k[5] - k[2] * k[3]) / (k[0] * k[4] - k[1] * k[3]))) / k[0], ((k[0] * k[5] - k[2] * k[3]) / (k[0] * k[4] - k[1] * k[3])))) for i in sys.stdin for k in [[int(float(j)) for j in i.split()]]]

Buggy python submission (verdict: Runtime Error):
[print("{0:.3f} {1:.3f}".format((k[2] - k[1] * ((k[0] * k[5] - k[2] * k[3]) / (k[0] * k[4] - k[1] * k[3]))) / k[0], ((k[0] * k[5] - k[2] * k[3]) / (k[0] * k[4] - k[1] * k[3])))) for i in sys.stdin for k in [[int(float(j)) for j in i.split()]]]

Fixed submission:
import sys
[print("{0:.3f} {1:.3f}".format((k[2] - k[1] * ((k[0] * k[5] - k[2] * k[3]) / (k[0] * k[4] - k[1] * k[3]))) / k[0], ((k[0] * k[5] - k[2] * k[3]) / (k[0] * k[4] - k[1] * k[3])))) for i in sys.stdin for k in [[int(float(j)) for j in i.split()]]]
Buggy python submission (verdict: Runtime Error):
import sys
from math import gcd
[print("{}{}".format(gcd(k[0], k[1]), k[0] * k[1] // gcd(k[0], k[1]))) for i in sys.stdin for k in [[int(j) for j in i.split()]]]

Fixed submission:

import sys
from fractions import gcd
[print("{} {}".format(gcd(k[0], k[1]), (k[0] * k[1]) // gcd(k[0], k[1]))) for i in sys.stdin for k in [[int(j) for j in i.split()]]]

Buggy python submission (verdict: Runtime Error):
import sys
from fractions import gcd
[print("{}{}".format(gcd(k[0], k[1]), k[0] * k[1] // gcd(k[0], k[1]))) for i in sys.stdin for k in [[int(j) for j in i.split()]]]

Fixed submission:

import sys
from fractions import gcd
[print("{} {}".format(gcd(k[0], k[1]), (k[0] * k[1]) // gcd(k[0], k[1]))) for i in sys.stdin for k in [[int(j) for j in i.split()]]]

Buggy python submission (verdict: Runtime Error):

import sys
# from fractions import gcd
from math import gcd
[print("{} {}".format(gcd(k[0], k[1]), (k[0] * k[1]) // gcd(k[0], k[1]))) for i in sys.stdin for k in [[int(j) for j in i.split()]]]

Fixed submission:

import sys
from fractions import gcd
[print("{} {}".format(gcd(k[0], k[1]), (k[0] * k[1]) // gcd(k[0], k[1]))) for i in sys.stdin for k in [[int(j) for j in i.split()]]]
Buggy python submission (verdict: Runtime Error):
print(input()[::-3]))

Fixed submission:
print(input()[::-1])
Buggy python submission (verdict: Runtime Error):
 [print(e)for e in sorted([int(input())for _ in range(10)],reverse=True)[0:3]]

Fixed submission:
[print(e)for e in sorted([int(input())for _ in range(10)],reverse=True)[0:3]]

Buggy python submission (verdict: Runtime Error):
 [print(e)for e in sorted([int(input())for _ in range(10)],reverse=True)[0:3]]

Fixed submission:
[print(e)for e in sorted([int(input())for _ in range(10)],reverse=True)[0:3]]
Buggy python submission (verdict: Runtime Error):
for i in range(1,10):
    for j in range(1,10):
        print "".join([i,"x",j,"=",i*j])

Fixed submission:
for i in range(1,10):
    for j in range(1,10):
        print str(i) + "x" + str(j) + "=" + str(i*j)
Buggy python submission (verdict: Runtime Error):
import sys 

for line in sys.stdin():
    [a,b,e,c,d,f] = [int(x) for x in line.split()]
    delta = a*d-b*c
    x = (d*e-b*f)/delta
    y = (-e*c+a*f)/delta
    print x,y
    

Fixed submission:
import sys

for line in sys.stdin:
    [a, b, c, d, e, f] = [float(x) for x in line.split()]
    determinant = a * e - d * b
    x = e * c - b * f
    y = -d * c + a * f
    x /= determinant
    y /= determinant
    if "%.3f" % (x) == "-0.000":
        result_x = "0.000"
    else:
        result_x = "%.3f" % (x)

    if "%.3f" % (y) == "-0.000":
        result_y = "0.000"
    else:
        result_y = "%.3f" % (y)

    print result_x, result_y
Buggy python submission (verdict: Time Limit Exceeded):
# -*- coding: utf-8 -*-
num = int(raw_input())
numbers = []
counter = 0
while counter < num:
    numbers.append(int(raw_input()))
    counter += 1

maximum = None

for index, num in enumerate(numbers[:-1]):
    max_diff = max(numbers[index+1:]) - num
    if max_diff > maximum:
        maximum = max_diff

print maximum

Fixed submission:
# -*- coding: utf-8 -*-
num = int(raw_input())
a = int(raw_input())
b = int(raw_input())
diff = b - a
pre_min = min(a,b)

counter = 2
while counter < num:
    current_num = int(raw_input())
    if diff < current_num - pre_min:
        diff = current_num - pre_min
    if pre_min > current_num:
        pre_min = current_num
    counter += 1

print diff
Buggy python submission (verdict: Runtime Error):
class MyStack(object):
    """stack class

    Attributes:
        stack: stack
    """

    def __init__(self):
        self.stack = []

    def pop(self):
        """pop method

        Returns:
            popped object
        """
        return self.stack.pop()

    def push(self, value):
        """ push method
        Args:
            value: value to be pushed
        """
        self.stack.append(value)


sequence = raw_input().split()
operators = {"*": "*", "+": "+", "-": "-"}
stack = MyStack()
for s in sequence:
    if s in operators:
        value1 = stack.pop()
        value2 = stack.pop()
        stack.push(eval(value1 + operators[s] + value2))
    else:
        stack.push(s)

print(stack.pop())

Fixed submission:
class MyStack(object):
    """stack class

    Attributes:
        stack: stack
    """

    def __init__(self):
        self.stack = [0] * 1000
        self.top = 0

    def pop(self):
        """pop method

        Returns:
            popped object
        """
        if self.top - 1 < 0:
            print("Stack Underflow")
        else:
            value = self.stack[self.top]
            self.stack[self.top] = 0
            self.top -= 1
            return value

    def push(self, value):
        """ push method
        Args:
            value: value to be pushed
        """
        if self.top + 1 >= len(self.stack):
            print("Stack Overflow")
        else:
            self.top += 1
            self.stack[self.top] = value

sequence = raw_input().split()
operators = {"*": "*", "+": "+", "-": "-"}
stack = MyStack()
for s in sequence:
    if s in operators:
        value2 = stack.pop()
        value1 = stack.pop()
        stack.push(str(eval(value1 + operators[s] + value2)))
    else:
        stack.push(s)

print(stack.pop())
Buggy python submission (verdict: Time Limit Exceeded):
# -*- coding: utf-8 -*-

def do_binary_search(target_value, target_list, target_list_length=None):
    left = 0
    right = target_list_length

    while right - left > 0:
        mid = (right + left) / 2
        key = target_list[mid]
        if key == target_value:
            return True
        elif target_value < key:
            right = mid
        else:
            left = mid + 1
    return False



def main():
    s_length = int(raw_input())
    s = [int(x) for x in raw_input().strip().split(' ')]
    t_length = raw_input()
    t = [int(x) for x in raw_input().strip().split(' ')]

    counter = 0
    for value in t:
        # counter += int(do_binary_search(value, s, s_length))
        counter += int(value in s)

    print counter 

if __name__ == '__main__':
    main()

Fixed submission:
# -*- coding: utf-8 -*-

def do_binary_search(target_value, target_list, target_list_length=None):
    left = 0
    right = target_list_length

    while right - left > 0:
        mid = (right + left) / 2
        key = target_list[mid]
        if key == target_value:
            return True
        elif target_value < key:
            right = mid
        else:
            left = mid + 1
    return False



def main():
    s_length = int(raw_input())
    s = [int(x) for x in raw_input().strip().split(' ')]
    t_length = raw_input()
    t = [int(x) for x in raw_input().strip().split(' ')]

    counter = 0
    for value in t:
        counter += int(do_binary_search(value, s, s_length))

    print counter 

if __name__ == '__main__':
    main()
Buggy python submission (verdict: Time Limit Exceeded):
# coding=utf-8


def solve_recursively(candidate_numbers, target_number):
    """classify if the target number is represented a summation of elements of candidate_numbers

    Args:
        candidate_numbers: candidate_numbers
        target_number: target_number

    Returns:
        if target number is represented a summation of elements of candidate_numbers(book)
    """
    if target_number == 0:
        return True
    elif len(candidate_numbers) == 0:
        return False

    solution = solve_recursively(candidate_numbers[1:], target_number - candidate_numbers[0]) or solve_recursively(
        candidate_numbers[1:], target_number)

    return solution


def main():
    raw_input()  # pass length
    candidate_numbers = [int(x) for x in raw_input().strip().split(' ')]
    raw_input()  # pass length
    target_numbers = [int(x) for x in raw_input().strip().split(' ')]

    for target_number in target_numbers:
        if solve_recursively(candidate_numbers, target_number):
            print "yes"
        else:
            print "no"


if __name__ == "__main__":
    main()

Fixed submission:
# -*- coding: utf-8 -*-


def main():
    raw_input()  # pass length
    candidate_number_list = [int(x) for x in raw_input().strip().split(' ')]
    raw_input()  # pass length
    target_number_list = [int(x) for x in raw_input().strip().split(' ')]

    representable_number_set = {0}
    for candidate_number in candidate_number_list:
        for num in representable_number_set.copy():
            representable_number_set.add(num + candidate_number)

    for target_number in target_number_list:
        if target_number in representable_number_set:
            print "yes"
        else:
            print "no"

if __name__ == "__main__":
    main()
Buggy python submission (verdict: Runtime Error):
import math

[x1,y1,x2,y2] = [float(x) for x in raw_input().split()]
print(math.sqrt((x2-x1)**2.0 + (y2-y1)**2.0)

Fixed submission:
import math

[x1, y1, x2, y2] = [float(x) for x in raw_input().split()]
print(math.sqrt((x2 - x1) ** 2.0 + (y2 - y1) ** 2.0))
Buggy python submission (verdict: Runtime Error):
import sys

map(int, [a,b]) = sys.stdin.readlines().strip()

print("{0} {1}".format(a+b, 2*a + 2*b))

Fixed submission:
import sys
 
lines = [x.strip().split() for x in sys.stdin.readlines()][0]
[a, b] = [int(x) for x in lines]
 
print a*b, 2*(a+b)

Buggy python submission (verdict: Runtime Error):
import sys

[a,b] = [int(x) for x in sys.stdin.readlines().strip()]


print("{0} {1}".format(a+b, 2*a + 2*b))

Fixed submission:
import sys
 
lines = [x.strip().split() for x in sys.stdin.readlines()][0]
[a, b] = [int(x) for x in lines]
 
print a*b, 2*(a+b)

Buggy python submission (verdict: Runtime Error):
import sys

[a,b] = [int(x) for x in sys.stdin.readlines().strip().split()]


print("{0} {1}".format(a+b, 2*a + 2*b))

Fixed submission:
import sys
 
lines = [x.strip().split() for x in sys.stdin.readlines()][0]
[a, b] = [int(x) for x in lines]
 
print a*b, 2*(a+b)
Buggy python submission (verdict: Runtime Error):
import sys

input_value = int(sys.stdin.readlines()[0].split())

hour = input_value/3600
input_value -= hour * 3600
minute = input_value/60
input_value -= minute * 60
second = input_value

print("{0}:{1}:{2}".format(hour, minute, second))

Fixed submission:
import sys

input_value = int(sys.stdin.readline())

hour = input_value/3600
input_value -= hour * 3600
minute = input_value/60
input_value -= minute * 60
second = input_value

print("{0}:{1}:{2}".format(hour, minute, second))
Buggy python submission (verdict: Runtime Error):
import sys

[Width, Height, x, y, r] = [int(x) for x in sys.stdin.readline().stlip()]

lower_x = r
lower_y = r
upper_x = Width - r
upper_y = Height -r 

if lower_x <= x <= upper_x and lower_y <= y <= upper_y:
   print("Yes")
else:
   print("No")

Fixed submission:
import sys

[Width, Height, x, y, r] = [int(x) for x in sys.stdin.readline().split()]

lower_x = r
lower_y = r
upper_x = Width - r
upper_y = Height -r 

if lower_x <= x <= upper_x and lower_y <= y <= upper_y:
   print("Yes")
else:
   print("No")
Buggy python submission (verdict: Runtime Error):
import sys

for index, line in sys.stdin():
    value = int(line.strip())
    print("Case {0}: {1}".format(index, value))

Fixed submission:
import sys

for index, line in enumerate(sys.stdin):
    value = int(line.strip())
    if value == 0:
        break
    print("Case {0}: {1}".format(index+1, value))

Buggy python submission (verdict: Runtime Error):
import sys

for index, line in sys.stdin:
    value = int(line.strip())
    print("Case {0}: {1}".format(index, value))

Fixed submission:
import sys

for index, line in enumerate(sys.stdin):
    value = int(line.strip())
    if value == 0:
        break
    print("Case {0}: {1}".format(index+1, value))
Buggy python submission (verdict: Runtime Error):
import sys

[a, b, c] = [int(x) for x in sys.stdin.readline()]

counter = 0
for value in range(a, b + 1):
    if c / value == 0:
        counter += 1

print(counter)

Fixed submission:
import sys

[a, b, c] = [int(x) for x in sys.stdin.readline().split()]
counter = 0
for value in range(a, b + 1):
    if c % value == 0:
        counter += 1

print(counter)

Buggy python submission (verdict: Runtime Error):
# -*- coding: utf-8 -*-
import math

def prime_number_identifier(num):
    for candidate in range(int())
    return True


input_num = int(raw_input())
counter = 0
while counter < input_num:
    candidate_number = int(raw_input())
    if prime_number_identifier(candidate_number):
        print candidate_number
    counter += 1

Fixed submission:
import sys

[a, b, c] = [int(x) for x in sys.stdin.readline().split()]
counter = 0
for value in range(a, b + 1):
    if c % value == 0:
        counter += 1

print(counter)
Buggy python submission (verdict: Runtime Error):
import sys
import math

value = int(sys.stdin.readline())

print round(math.pi * value * value,7), round(2.0 * math.pi * value, 7)

Fixed submission:
import sys
import math

value = float(sys.stdin.readline())

print "%.9f %.9f" % (math.pi * value * value, 2.0 * math.pi * value)
Buggy python submission (verdict: Runtime Error):
while True:
    [W, H] = raw_input().split()
    if [W, H] == [0, 0]:
        break
    print('#' * W)
    counter = 0
    while counter < H - 1:
        print('#' + '.' * (W - 2) + '#')
    print('#' * W)

Fixed submission:
while True:
    [H, W] = [int(x) for x in raw_input().split()]
    if [H, W] == [0, 0]:
        break
    print('#' * W)
    counter = 0
    while counter < H - 2:
        print('#' + '.' * (W - 2) + '#')
        counter += 1
    print('#' * W + '\n')

Buggy python submission (verdict: Time Limit Exceeded):
while True:
    [W, H] = [int(x) for x in raw_input().split()]
    if [W, H] == [0, 0]:
        break
    print('#' * W)
    counter = 0
    while counter < H - 1:
        print('#' + '.' * (W - 2) + '#')
    print('#' * W)

Fixed submission:
while True:
    [H, W] = [int(x) for x in raw_input().split()]
    if [H, W] == [0, 0]:
        break
    print('#' * W)
    counter = 0
    while counter < H - 2:
        print('#' + '.' * (W - 2) + '#')
        counter += 1
    print('#' * W + '\n')

Buggy python submission (verdict: Time Limit Exceeded):
while True:
    [W, H] = [int(x) for x in raw_input().split()]
    if [W, H] == [0, 0]:
        break
    print('#' * W)
    counter = 0
    while counter < H - 1:
        print('#' + '.' * (W - 2) + '#')
    print('#' * W)

Fixed submission:
while True:
    [H, W] = [int(x) for x in raw_input().split()]
    if [H, W] == [0, 0]:
        break
    print('#' * W)
    counter = 0
    while counter < H - 2:
        print('#' + '.' * (W - 2) + '#')
        counter += 1
    print('#' * W + '\n')
Buggy python submission (verdict: Runtime Error):
import numpy as np
print("hello")

Fixed submission:
[n, m] = [int(x) for x in raw_input().split()]
A = []

counter = 0
while counter < n:
    A.append([int(x) for x in raw_input().split()])
    counter += 1

B = [int(raw_input()) for j in range(m)]

counter = 0
while counter < n:
    result = 0
    for j in range(m):
        result += A[counter][j] * B[j]
    print(result)
    counter += 1

Buggy python submission (verdict: Runtime Error):
[n, m] = [int(x) for x in raw_input().split()]
A = []
B = [0] * m

counter = 0
while counter < n:
    A.append([int(x) for x in raw_input().split()])
    counter += 1

B[counter] = [int(raw_input()) for j in range(m)]

counter = 0
while counter < n:
    result = 0
    for j in range(m):
        result += A[counter][j] * B[j]
    print(result)
    counter += 1

Fixed submission:
[n, m] = [int(x) for x in raw_input().split()]
A = []

counter = 0
while counter < n:
    A.append([int(x) for x in raw_input().split()])
    counter += 1

B = [int(raw_input()) for j in range(m)]

counter = 0
while counter < n:
    result = 0
    for j in range(m):
        result += A[counter][j] * B[j]
    print(result)
    counter += 1
Buggy python submission (verdict: Runtime Error):
while True:
    value = [int(x) for x in raw_input().split()]
    if value == 0:
        break
    print(sum(value))

Fixed submission:
while True:
    value = [int(x) for x in raw_input()]
    if value[0] == 0:
        break
    print(sum(value))
Buggy python submission (verdict: Runtime Error):
alphabet = "abcdefghijklmnopqrstuvwxyz"
dictionary = {}
for character in alphabet:
    dictionary[character] = 0

for character in raw_input():
    if character.lowercase() in dictionary:
        dictionary[character.lowercase()] += 1

for character in alphabet:
    print(character + ' ' + dictionary[character])

Fixed submission:
import sys
alphabet = "abcdefghijklmnopqrstuvwxyz"
dictionary = {}
for character in alphabet:
    dictionary[character] = 0

for line in sys.stdin:
    for character in line.strip():
        if character.lower() in dictionary:
            dictionary[character.lower()] += 1

for character in alphabet:
    print(character + ' : ' + str(dictionary[character]))

Buggy python submission (verdict: Runtime Error):
alphabet = "abcdefghijklmnopqrstuvwxyz"
dictionary = {}
for character in alphabet:
    dictionary[character] = 0

for character in raw_input():
    if character.lower() in dictionary:
        dictionary[character.lower()] += 1

for character in alphabet:
    print(character + ' ' + dictionary[character])

Fixed submission:
import sys
alphabet = "abcdefghijklmnopqrstuvwxyz"
dictionary = {}
for character in alphabet:
    dictionary[character] = 0

for line in sys.stdin:
    for character in line.strip():
        if character.lower() in dictionary:
            dictionary[character.lower()] += 1

for character in alphabet:
    print(character + ' : ' + str(dictionary[character]))
Buggy python submission (verdict: Runtime Error):
ring = raw_input() * 2
word = raw_input()

flag = 0
counter = 0
while counter < len(ring/2):
    if ring[counter:counter + len(word)] == word:
        flag = 1
        break

if flag:
    print("Yes")
else:
    print("No")

Fixed submission:
ring = raw_input() * 2

if raw_input() in ring:
    print("Yes")
else:
    print("No")
Buggy python submission (verdict: Runtime Error):
while True:
    cards = raw_input()
    if cards == '-':
        break
    shuffle_num = int(raw_input())
    counter = 0
    while counter < num:
        h = int(raw_input)
        cards = cards[h:] + cards[:h]
        num += 1
    print(cards)

Fixed submission:
while True:
    cards = raw_input()
    if cards == '-':
        break
    shuffle_num = int(raw_input())
    counter = 0
    while counter < shuffle_num:
        h = int(raw_input())
        cards = cards[h:] + cards[:h]
        counter += 1
    print(cards)
Buggy python submission (verdict: Runtime Error):
round = int(raw_input())
score = {"taro":0, "hanako":0}
counter = 0
while counter < round:
    [taro,hanako] = raw_input.split()
    if taro < hanako:
        score["hanako"] += 3
    elif taro > hanako:
        score["taro"] += 3
    else:
        score["taro"] += 1
        score["hanako"] += 1
    counter += 1

print score["taro"], score["hanako"]

Fixed submission:
round = int(raw_input())
score = {"taro":0, "hanako":0}
counter = 0
while counter < round:
    [taro,hanako] = raw_input().split()
    if taro < hanako:
        score["hanako"] += 3
    elif taro > hanako:
        score["taro"] += 3
    else:
        score["taro"] += 1
        score["hanako"] += 1
    counter += 1

print score["taro"], score["hanako"]
Buggy python submission (verdict: Runtime Error):
#coding: utf-8

import sys

for line in sys.stdin:
    l = (map(int,line.split()))
    l.sort()
    a = l[0]
    b = l[1]
    for i in range(2,b+1):
        if a%i == 0 and b%i == 0:
            ans = i:
    print a*b/ans,ans

Fixed submission:
#coding: utf-8

import sys

def gojo(a,b):
    if b % a == 0:
        return a
    else:
        return gojo(b % a, a)

for line in sys.stdin:
    l = map(int,line.split())
    l.sort()
    a = l[0]
    b = l[1]
    print gojo(a,b),a*b/gojo(a,b)
Buggy python submission (verdict: Time Limit Exceeded):
#coding: utf-8

l = range(0, 1000001)
l[1] = 0
for i in range(0, 1000):
    if l[i] != 0:
        for k in range(i + i, 1000001, i):
            l[k] = 0
        continue
l = [x for x in l if x]

while True:
    l2 = map(int,raw_input().split())
    if l2 == [0,0,0]:
        break
    a = l2[0]
    d = l2[1]
    n = l2[2]
    c = 0
    while True:
        if a in l:
            c = c + 1
        if c == n:
            break
        a = a + d
    print a
        

Fixed submission:
#coding: utf-8

l = range(0, 1001)
l[1] = 0
for i in range(0, 50):
    if l[i] != 0:
        for k in range(i + i, 1001, i):
            l[k] = 0
        continue
l = [x for x in l if x]
while True:
    l2 = map(int,raw_input().split())
    if l2 == [0,0,0]:
        break
    a = l2[0]
    d = l2[1]
    n = l2[2]
    c = 0
    ch = 0
    while True:
        for p in l:
            if (a != p and a % p == 0) or a == 1:#?´???°???????????????
                ch = 1
                break
        if ch == 1:
            a = a + d
            ch = 0
            continue
        c = c + 1
        if c == n:
            break
        a = a + d
    print a