Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Runtime Error):
def partition(a, p, r):
    x = a[r]
    i = p-1

    for j in range(p, r):
        if a[j] <= x:
            i += 1
            tmp = a[i]
            a[i] = a[j]
            a[j] = tmp

    tmp = a[i+1]
    a[i+1] = a[r]
    a[r] = tmp
    return a, i+1


n = int(input())
A = list(map(int, input().split()))
ans, idx = partition(A, 0, n-1)
print(*ans[:idx], [ans[idx]], *ans[idx+1:])

Fixed submission:
def partition(p, r):
    x = a[r]
    i = p-1

    for j in range(p, r):
        if a[j] <= x:
            i += 1
            a[i], a[j] = a[j], a[i]

    a[i+1], a[r] = a[r], a[i+1]
    return i+1


n = int(input())
a = list(map(int, input().split()))
idx = partition(0, n-1)
a[idx] = [a[idx]]
print(*a)

Buggy python submission (verdict: Runtime Error):
def partition(a, p, r):
    x = a[r]
    i = p-1

    for j in range(p, r):
        if a[j] <= x:
            i += 1
            tmp = a[i]
            a[i] = a[j]
            a[j] = tmp

    tmp = a[i+1]
    a[i+1] = a[r]
    a[r] = tmp
    return a, i+1


n = int(input())
A = list(map(int, input().split()))
ans, idx = partition(A, 0, n-1)
print(*ans[:idx], [ans[idx]], *ans[idx+1:])

Fixed submission:
def partition(p, r):
    x = a[r]
    i = p-1

    for j in range(p, r):
        if a[j] <= x:
            i += 1
            a[i], a[j] = a[j], a[i]

    a[i+1], a[r] = a[r], a[i+1]
    return i+1


n = int(input())
a = list(map(int, input().split()))
idx = partition(0, n-1)
a[idx] = [a[idx]]
print(*a)

Buggy python submission (verdict: Runtime Error):
def partition(p, r):
    x = a[r]
    i = p-1

    for j in range(p, r):
        if a[j] <= x:
            i += 1
            a[i], a[j] = a[j], a[i]

    a[i+1], a[r] = a[r], a[i+1]
    return i+1


n = int(input())
a = list(map(int, input().split()))
idx = partition(0, n-1)
print(*a[:idx], [a[idx]], *a[idx+1:])

Fixed submission:
def partition(p, r):
    x = a[r]
    i = p-1

    for j in range(p, r):
        if a[j] <= x:
            i += 1
            a[i], a[j] = a[j], a[i]

    a[i+1], a[r] = a[r], a[i+1]
    return i+1


n = int(input())
a = list(map(int, input().split()))
idx = partition(0, n-1)
a[idx] = [a[idx]]
print(*a)
Buggy python submission (verdict: Runtime Error):
import sys
"""
a=[]
while True:
	n=input()
	if n==-1:
		break
	a.append(n)
"""
for line in sys.stdin:
	a.append(int(line))
for x in a:
	out=1
	while x:
		if x&1:
			print out,
		x/=2
		out*=2
	print 

Fixed submission:
import sys

for line in sys.stdin:
	x=int(line)
	out=1
	ret=""
	while x:
		if x&1:
			ret+=" "+str(out)
		x/=2
		out*=2
	print ret[1::]
Buggy python submission (verdict: Runtime Error):
import sys
rec=rho=0
for line in sys.stdin:
"""while True:
	line=raw_input()
	if line=="a":
		break
"""
	a,b,c=map(int,line.split(","))
	if a==b:
		rho+=1
	elif a*a+b*b==c*c:
		rec+=1
print rec
print rho

Fixed submission:
import sys
rec=rho=0
for line in sys.stdin:
	a,b,c=map(int,line.split(","))
	if a==b:
		rho+=1
	elif a*a+b*b==c*c:
		rec+=1
print rec
print rho
Buggy python submission (verdict: Runtime Error):
n = int(input())
a = list(map(int, input().split()))
dp = [[0] * 21 for i in range(n)]
dp[0][0] = 1
for i in range(n - 1):
    for j in range(21):
		if dp[i][j] == 0:
			continue
        if 0 <= j + a[i] <= 20:
            dp[i + 1][j + a[i]] += dp[i][j]
        if 0 <= j - a[i] <= 20:
            dp[i + 1][j - a[i]] += dp[i][j]
print(dp[n - 1][a[n - 1]])

Fixed submission:
n = int(input())
a = list(map(int, input().split()))
dp = [[0] * 21 for i in range(n - 1)]
dp[0][a[0]] = 1
for i in range(1, n - 1):
    for j in range(21):
        if 0 <= j + a[i] <= 20:
            dp[i][j] += dp[i - 1][j + a[i]]
        if 0 <= j - a[i] <= 20:
            dp[i][j] += dp[i - 1][j - a[i]]
print(dp[n - 2][a[n - 1]])
Buggy python submission (verdict: Runtime Error):
a,b,c = map(int, input().split())
print "Yes" if a<b and b<c else "No"


Fixed submission:
a,b,c = map(int, input().split())
print("Yes" if a<b and b<c else "No")
Buggy python submission (verdict: Runtime Error):
import sys
from collections import defaultdict


def read():
    n, v = map(int, sys.stdin.readline().split())
    a = tuple(map(int, sys.stdin.readline().split()))
    b = tuple(map(int, sys.stdin.readline().split()))
    c = tuple(map(int, sys.stdin.readline().split()))
    d = tuple(map(int, sys.stdin.readline().split()))

def main():
    read()
    mp = defaultdict(int)
    for val1 in c:
        for val2 in d:
            mp[val1 + val2] += 1
    print(sum(mp[v - val1 - val2] for val1 in a for val2 in b))

if __name__ == '__main__':
    main()



Fixed submission:
import sys
from collections import defaultdict


def main():
    n, v = map(int, sys.stdin.readline().split())
    a = list(map(int, sys.stdin.readline().split()))
    b = list(map(int, sys.stdin.readline().split()))
    c = list(map(int, sys.stdin.readline().split()))
    d = list(map(int, sys.stdin.readline().split()))
    mp = defaultdict(int)
    for val1 in c:
        for val2 in d:
            mp[val1 + val2] += 1
    print(sum(mp[v - val1 - val2] for val1 in a for val2 in b))

if __name__ == '__main__':
    main()
Buggy python submission (verdict: Runtime Error):
import sys
from union_find import UnionFind
from operator import attrgetter

class Kruskal:

    class Edge:
        def __init__(self, u, v, cost):
            self.u, self.v, self.cost = u, v, cost

        def __lt__(self, another):
            return self.cost < another.cost

    def __init__(self, node_size):
        self._node = node_size
        self._edge_list = []

    def add_edge(self, u, v, cost):
        self._edge_list.append(self.Edge(u, v, cost))

    def solve(self):
        uf = UnionFind(self._node)
        res = 0
        edge_count = 0
        sorted_edge_list = sorted(self._edge_list)
        for e in sorted_edge_list:
            if not uf.same(e.u, e.v):
                uf.unite(e.u, e.v)
                res += e.cost
                edge_count += 1
                if edge_count == self._node-1:
                    break
        return res

if __name__ == '__main__':
    n, m = map(int, sys.stdin.readline().split())
    kr = Kruskal(n)
    for _ in range(m):
        s, t, w = map(int, sys.stdin.readline().split())
        kr.add_edge(s, t, w)
    print(kr.solve())



Fixed submission:
import sys


class UnionFind:
    def __init__(self, node_size):
        self._node = node_size
        self.par = [i for i in range(self._node)]
        self.rank = [0] * self._node

    def find(self, ver):
        if self.par[ver] == ver:
            return ver
        else:
            self.par[ver] = self.find(self.par[ver])
            return self.par[ver]

    def unite(self, ver1, ver2):
        ver1, ver2 = self.find(ver1), self.find(ver2)
        if ver1 == ver2:
            return
        if self.rank[ver1] < self.rank[ver2]:
            ver1, ver2 = ver2, ver1
        self.par[ver2] = ver1
        if self.rank[ver1] == self.rank[ver2]:
            self.rank[ver1] += 1

    def same(self, ver1, ver2):
        return self.find(ver1) == self.find(ver2)


class Kruskal:

    class Edge:
        def __init__(self, u, v, cost):
            self.u, self.v, self.cost = u, v, cost

        def __lt__(self, another):
            return self.cost < another.cost

    def __init__(self, node_size):
        self._node = node_size
        self._edge_list = []

    def add_edge(self, u, v, cost):
        self._edge_list.append(self.Edge(u, v, cost))

    def solve(self):
        uf = UnionFind(self._node)
        res = 0
        self._edge_list.sort()
        for e in self._edge_list:
            if not uf.same(e.u, e.v):
                uf.unite(e.u, e.v)
                res += e.cost
        return res

if __name__ == '__main__':
    n, m = map(int, sys.stdin.readline().split())
    kr = Kruskal(n)
    for _ in range(m):
        s, t, w = map(int, sys.stdin.readline().split())
        kr.add_edge(s, t, w)
    print(kr.solve())
Buggy python submission (verdict: Runtime Error):
#coding:utf-8
from __future__ import division,print_function
try:
    input = raw_input
except NameError:
    pass
# 上記のコードはPython2とPython3の違いを一部吸収するためのもの
memo=[0]*31
def solve(x):
    if memo[x]==0:
        if x>1:
            memo[x]=solve(x-1)+solve(x-2)+solve(x-3)
            return memo[x]
        elif x==0:
            memo[x]=1
            return 1
        else:
            return 0
    else:
        return memo[x]

def main():
    while True:
        inp=input()
        if inp==0:
            break
        print(solve(inp))

main()

Fixed submission:
#coding:utf-8
from __future__ import division,print_function
try:
    input = raw_input
except NameError:
    pass
# 上記のコードはPython2とPython3の違いを一部吸収するためのもの
memo=[0]*31
def solve(x):
    if memo[x]==0:
        if x>0:
            memo[x]=solve(x-1)+solve(x-2)+solve(x-3)
            return memo[x]
        elif x==0:
            memo[x]=1
            return 1
        else:
            return 0
    else:
        return memo[x]

def main():
    while True:
        inp=int(input())
        if inp==0:
            break
        print((solve(inp)-1)//3650+1)

main()
Buggy python submission (verdict: Runtime Error):
#!/usr/bin/env python
import string
import sys
from itertools import chain, dropwhile, takewhile


def read(
    *shape, f=int, it=chain.from_iterable(sys.stdin), whitespaces=set(string.whitespace)
):
    def read_word():
        w = lambda c: c in whitespaces
        nw = lambda c: c not in whitespaces
        return f("".join(takewhile(nw, dropwhile(w, it))))

    if not shape:
        return read_word()
    elif len(shape) == 1:
        return [read_word() for _ in range(shape[0])]
    elif len(shape) == 2:
        return [[read_word() for _ in range(shape[1])] for _ in range(shape[0])]


def readi(*shape):
    return read(*shape)


def readi1(*shape):
    return [i - 1 for i in read(*shape)]


def readf(*shape):
    return read(*shape, f=float)


def reads(*shape):
    return read(*shape, f=str)


def arr(*shape, fill_value=0):
    if len(shape) == 1:
        return [fill_value] * shape[fill_value]
    elif len(shape) == 2:
        return [[fill_value] * shape[1] for _ in range(shape[0])]


def dbg(**kwargs):
    print(
        ", ".join("{} = {}".format(k, repr(v)) for k, v in kwargs.items()),
        file=sys.stderr,
    )


def main():
    n, k = readi(2)
    a = readi(n)
    tmp = sum(a[:k])
    ans = tmp
    dbg(tmp=tmp)
    for i in range(k, len(a)):
        tmp += a[i] - a[i - k]
        ans = max(ans, tmp)
        dbg(tmp=tmp)
    print(ans)


if __name__ == "__main__":
    main()



Fixed submission:
#!/usr/bin/env python
import string
import sys
from itertools import chain, dropwhile, takewhile


def read(
    *shape, f=int, it=chain.from_iterable(sys.stdin), whitespaces=set(string.whitespace)
):
    def read_word():
        w = lambda c: c in whitespaces
        nw = lambda c: c not in whitespaces
        return f("".join(takewhile(nw, dropwhile(w, it))))

    if not shape:
        return read_word()
    elif len(shape) == 1:
        return [read_word() for _ in range(shape[0])]
    elif len(shape) == 2:
        return [[read_word() for _ in range(shape[1])] for _ in range(shape[0])]


def readi(*shape):
    return read(*shape)


def readi1(*shape):
    return [i - 1 for i in read(*shape)]


def readf(*shape):
    return read(*shape, f=float)


def reads(*shape):
    return read(*shape, f=str)


def arr(*shape, fill_value=0):
    if len(shape) == 1:
        return [fill_value] * shape[fill_value]
    elif len(shape) == 2:
        return [[fill_value] * shape[1] for _ in range(shape[0])]


def dbg(**kwargs):
    print(
        ", ".join("{} = {}".format(k, repr(v)) for k, v in kwargs.items()),
        file=sys.stderr,
    )


def main():
    while True:
        n, k = readi(2)
        if n == 0:
            return
        a = readi(n)
        tmp = sum(a[:k])
        ans = tmp
        for i in range(k, len(a)):
            tmp += a[i] - a[i - k]
            ans = max(ans, tmp)
        print(ans)


if __name__ == "__main__":
    main()
Buggy python submission (verdict: Runtime Error):
import bisect
import collections
import heapq
import itertools
import math
import string
import sys
from itertools import chain, takewhile

import numpy as np


def read(
    f, *shape, it=chain.from_iterable(sys.stdin), whitespaces=set(string.whitespace)
):
    def read_word():
        return f("".join(takewhile(lambda c: c not in whitespaces, it)).strip())

    if not shape:
        return read_word()
    elif len(shape) == 1:
        return [read_word() for _ in range(shape[0])]
    elif len(shape) == 2:
        return [[read_word() for _ in range(shape[1])] for _ in range(shape[0])]


def arr(*shape, fill_value=0):
    if isinstance(shape[0], int):
        return np.full(shape, fill_value).tolist()
    return np.full_like(shape[0], fill_value).tolist()


def debug(**kwargs):
    print(
        ", ".join("{} = {}".format(k, repr(v)) for k, v in kwargs.items()),
        file=sys.stderr,
    )

def main():
    N, W = read(int, 2)
    values = arr(N)
    weights = arr(N)
    for i in range(N):
        values[i], weights[i] = read(int, 2)

    dp = arr(W + 1, fill_value=0)
    for i in range(N):
        for w in range(weights[i], W + 1):
            dp[w] = max(dp[w], dp[w - weights[i]] + values[i])

    print(dp[W])


if __name__ == "__main__":
    main()



Fixed submission:
#!/usr/bin/env python
import string
import sys
from itertools import chain, dropwhile, takewhile

INF = float("inf")


def read(
    *shape, f=int, it=chain.from_iterable(sys.stdin), whitespaces=set(string.whitespace)
):
    def read_word():
        w = lambda c: c in whitespaces
        nw = lambda c: c not in whitespaces
        return f("".join(takewhile(nw, dropwhile(w, it))))

    if not shape:
        return read_word()
    elif len(shape) == 1:
        return [read_word() for _ in range(shape[0])]
    elif len(shape) == 2:
        return [[read_word() for _ in range(shape[1])] for _ in range(shape[0])]


def readi(*shape):
    return read(*shape)


def readi1(*shape):
    return [i - 1 for i in readi(*shape)]


def readf(*shape):
    return read(*shape, f=float)


def reads(*shape):
    return read(*shape, f=str)


def arr(*shape, fill_value=0):
    if len(shape) == 1:
        return [fill_value] * shape[0]
    elif len(shape) == 2:
        return [[fill_value] * shape[1] for _ in range(shape[0])]


def dbg(**kwargs):
    print(
        ", ".join("{} = {}".format(k, repr(v)) for k, v in kwargs.items()),
        file=sys.stderr,
    )


def main():
    N, W = readi(2)
    vs, ws = zip(*readi(N, 2))
    dp = arr(N + 1, W + 1)
    for i in range(N):
        for j in range(W + 1):
            if j - ws[i] >= 0:
                dp[i + 1][j] = max(
                    dp[i + 1][j], dp[i][j - ws[i]] + vs[i], dp[i + 1][j - ws[i]] + vs[i]
                )
            dp[i + 1][j] = max(dp[i + 1][j], dp[i][j])

    print(dp[N][W])


if __name__ == "__main__":
    main()
Buggy python submission (verdict: Runtime Error):
while True:
  x = int(input().split())
  if x == 0:
    break
  print("Case ", c, ": ", x, sep="")
  c += 1    # c = c + 1 の略記法


Fixed submission:
c = 1
while True:
  x = int(input())
  if x == 0:
    break
  print("Case ", c, ": ", x, sep="")
  c += 1    # c = c + 1 の略記法

Buggy python submission (verdict: Runtime Error):
while True:
  x = int(input().split())
  if x == 0:
    break
  print("Case ", c, ": ", x, sep="")



Fixed submission:
c = 1
while True:
  x = int(input())
  if x == 0:
    break
  print("Case ", c, ": ", x, sep="")
  c += 1    # c = c + 1 の略記法

Buggy python submission (verdict: Runtime Error):
c = 1
while True:
  x = int(input().split())
  if x == 0:
    break
  print("Case ", c, ": ", x, sep="")
  c += 1    # c = c + 1 の略記法


Fixed submission:
c = 1
while True:
  x = int(input())
  if x == 0:
    break
  print("Case ", c, ": ", x, sep="")
  c += 1    # c = c + 1 の略記法
Buggy python submission (verdict: Runtime Error):
while True:
  x, y = map(int, input().split())
  if x == 0 and y == 0 :
　　    break
  if x>y:
    print(y, x)
  else:
    print(x,y)


Fixed submission:
while True:
  x, y = map(int, input().split())
  if x == 0 and y == 0 :
    break
  if x>y:
    print(y, x)
  else:
    print(x,y)

Buggy python submission (verdict: Runtime Error):
#include <iostream>
using namespace std;

int main()
{
　　int x, y;
　　while(true) {
　　  cin >> x >> y;
　　  if(x == 0 && y == 0) {
　　    break;
　　  }
　　  if(x>y) {
　　    cout << y << " " << x << endl;
　　  }
　　  else {
　　    cout << x << " " << y << endl;
　　  }
　　}
}


Fixed submission:
while True:
  x, y = map(int, input().split())
  if x == 0 and y == 0 :
    break
  if x>y:
    print(y, x)
  else:
    print(x,y)
Buggy python submission (verdict: Runtime Error):
from math import pi   // 円周率
r = float(input())
area = r * r * pi
cir =(r+r) * pi
print(f'{(area):.6f} {(cir):.6f}')


Fixed submission:
from math import pi   # 円周率
# 浮動小数点数で読む
r = float(input())   
area = r * r * pi
cir =(r+r) * pi
print(f'{(area):.6f} {(cir):.6f}')
Buggy python submission (verdict: Runtime Error):
while True:
  a,op,c = map(str, input().split())
  a = int(a)
  c = int(b)
  if op == '?': 
    break
  if op == '+':
    print(a+b)
  if op == '-':
    print(a-b)
  if op == '*':
    print(a*b)
  if op == '/':
    print(a//b)
  



Fixed submission:
while True:
  a,op,b = map(str, input().split())
  a = int(a)
  b = int(b)
  if op == '?': 
    break
  if op == '+':
    print(a+b)
  if op == '-':
    print(a-b)
  if op == '*':
    print(a*b)
  if op == '/':
    print(a//b)

Buggy python submission (verdict: Runtime Error):
while True:
  a,op,c = map(str, input().split())
  a = int(a)
  c = int()
  if op == '?': 
    break
  if op == '+':
    print(a+b)
  if op == '-':
    print(a-b)
  if op == '*':
    print(a*b)
  if op == '/':
    print(a//b)


Fixed submission:
while True:
  a,op,b = map(str, input().split())
  a = int(a)
  b = int(b)
  if op == '?': 
    break
  if op == '+':
    print(a+b)
  if op == '-':
    print(a-b)
  if op == '*':
    print(a*b)
  if op == '/':
    print(a//b)

Buggy python submission (verdict: Runtime Error):
while True:
  a,op,c = map(str, input().split())
  a = int(a)
  c = int(c)
  if op == '?': 
    break
  if op == '+':
    print(a+b)
  if op == '-':
    print(a-b)
  if op == '*':
    print(a*b)
  if op == '/':
    print(a//b)


Fixed submission:
while True:
  a,op,b = map(str, input().split())
  a = int(a)
  b = int(b)
  if op == '?': 
    break
  if op == '+':
    print(a+b)
  if op == '-':
    print(a-b)
  if op == '*':
    print(a*b)
  if op == '/':
    print(a//b)

Buggy python submission (verdict: Runtime Error):
while True:
  a,op,c = map(str, input().split())
  a = int(a)
  b = int(b)
  if op == '?': 
    break
  if op == '+':
    print(a+b)
  if op == '-':
    print(a-b)
  if op == '*':
    print(a*b)
  if op == '/':
    print(a//b)


Fixed submission:
while True:
  a,op,b = map(str, input().split())
  a = int(a)
  b = int(b)
  if op == '?': 
    break
  if op == '+':
    print(a+b)
  if op == '-':
    print(a-b)
  if op == '*':
    print(a*b)
  if op == '/':
    print(a//b)
Buggy python submission (verdict: Runtime Error):
n = int(input())
# min, max, sum は関数名なので
# 別名を使うとよい
min0 = 100000
max0 = -100000
sum0 = 0
for i in range(n):
  x = int(input())
  min0 = min(min0, x)
  max0 = max(max0, x)
 sum0 += x
 
print(min0, max0, sum0)


Fixed submission:
n = int(input())
ns = list(map(int, input().split()))

print(min(ns), max(ns), sum(ns))

Buggy python submission (verdict: Runtime Error):
n = int(input())
# min, max, sum は関数名なので
# 別名を使うとよい
min0 = 100000
max0 = -100000
sum0 = 0
for i in range(n):
  x = int(input())
  min0 = min(min0, x)
  max0 = max(max0, x)
  sum0 += x
 
print(min0, max0, sum0)



Fixed submission:
n = int(input())
ns = list(map(int, input().split()))

print(min(ns), max(ns), sum(ns))

Buggy python submission (verdict: Runtime Error):
n = int(input())
ns = list(map(int, input().split()))

print(min(ns), max(ns), sum(ns)


Fixed submission:
n = int(input())
ns = list(map(int, input().split()))

print(min(ns), max(ns), sum(ns))

Buggy python submission (verdict: Runtime Error):
n = int(input())
ns = list(map(int, input().split()))

print(min(ns), max(ns), sum(ns)


Fixed submission:
n = int(input())
ns = list(map(int, input().split()))

print(min(ns), max(ns), sum(ns))
Buggy python submission (verdict: Runtime Error):
def chess(h,w):
  if (h+w) % 2 == 0:
    return '#'
  return '.'

while True:
  H, W = map(int, input().split())
  if H == 0 and W == 0:
    break
  for i in range(H):
    for j in range(W):
      print(chess(I,j)', end='')
    print()
  print()



Fixed submission:
def chess(h,w):
  if (h+w) % 2 == 0:
    return '#'
  return '.'

while True:
  H, W = map(int, input().split())
  if H == 0 and W == 0:
    break
  for i in range(H):
    for j in range(W):
      print(chess(i,j), end='')
    print()
  print()

Buggy python submission (verdict: Runtime Error):
def chess(h,w):
  if (h+w) % 2 == 0:
    return '#'
  return '.'

while True:
  H, W = map(int, input().split())
  if H == 0 and W == 0:
    break
  for i in range(H):
    for j in range(W):
      print(chess(I,j), end='')
    print()
  print()



Fixed submission:
def chess(h,w):
  if (h+w) % 2 == 0:
    return '#'
  return '.'

while True:
  H, W = map(int, input().split())
  if H == 0 and W == 0:
    break
  for i in range(H):
    for j in range(W):
      print(chess(i,j), end='')
    print()
  print()
Buggy python submission (verdict: Runtime Error):
n = int(input())
min_r, max_d = int(input()), - 10**9
for in range(n - 1):
    r = int(input())
    max_d = max(max_d, r - min)
    min_r = min(min_r, r)
print(max_d)



Fixed submission:
n = int(input())
min_r, max_d = int(input()), - 10**9
for _ in range(n - 1):
    r = int(input())
    max_d = max(max_d, r - min_r)
    min_r = min(min_r, r)
print(max_d)

Buggy python submission (verdict: Runtime Error):
n = int(input())
min_r, max_d = int(input()), - 10**9
for _ in range(n - 1):
    r = int(input())
    max_d = max(max_d, r - min)
    min_r = min(min_r, r)
print(max_d)



Fixed submission:
n = int(input())
min_r, max_d = int(input()), - 10**9
for _ in range(n - 1):
    r = int(input())
    max_d = max(max_d, r - min_r)
    min_r = min(min_r, r)
print(max_d)
Buggy python submission (verdict: Runtime Error):
import sys

# 入力が終わるまで読み込む
while 1:
    line = sys.stdin.readline()
    if (not line):
        break
    # 2つの変数に読み込み
    x, y = map(int, line.split())
    # ユークリッドの互除法
    if (x > y):
        gcd = x
        t = y
    else :
        gcd = y
        t = x
    while (t > 0) :
        tmp = gcd % t
        gcd = t
        t = tmp
    # 最小公倍数を求める A * B = GCD * LCM
    lcm = x * y / gcd
    print str(gcd) + " " + str(lcm)

Fixed submission:
import sys

while 1:
    line = sys.stdin.readline()
    if (not line):
        break
    x, y = map(int, line.split())
    if (x > y):
        gcd = x
        t = y
    else :
        gcd = y
        t = x
    while (t > 0) :
        tmp = gcd % t
        gcd = t
        t = tmp
    lcm = x * y / gcd
    print str(gcd) + " " + str(lcm)

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

# 入力が終わるまで読み込む
while 1:
    line = sys.stdin.readline()
    if (not line):
        break
    # 2つの変数に読み込み
    x, y = map(int, line.split())
    # ユークリッドの互除法
    if (x > y):
        gcd = x
        t = y
    else :
        gcd = y
        t = x
    while (t > 0) :
        tmp = gcd % t
        gcd = t
        t = tmp
    # 最小公倍数を求める A * B = GCD * LCM
    lcm = x * y / gcd
    print str(gcd) + " " + str(lcm)

Fixed submission:
import sys

while 1:
    line = sys.stdin.readline()
    if (not line):
        break
    x, y = map(int, line.split())
    if (x > y):
        gcd = x
        t = y
    else :
        gcd = y
        t = x
    while (t > 0) :
        tmp = gcd % t
        gcd = t
        t = tmp
    lcm = x * y / gcd
    print str(gcd) + " " + str(lcm)