Harryxun/GPT-100-sft-dataset huggingface dataset:
Problem p02983 (python)

Fixed submission:

L, R = map(int, input().split())

mini = (L * R) % 2019

if R - L >= 2019:
    print(0)
    exit()

for i in range(L % 2019, R % 2019):
    for j in range(i + 1, R % 2019 + 1):
        mini = min(mini, (i * j) % 2019)



print(mini)

Buggy submission (verdict: Runtime Error):

L, R = map(int, input().split())

mini = (L * R) % 2019

if R - l >= 2019:
    print(0)
    exit()

for i in range(L % 2019, R % 2019):
    for j in range(i + 1, R % 2019 + 1):
        mini = min(mini, (i * j) % 2019)



print(mini)
Problem p03006 (python)

Fixed submission:
from collections import defaultdict

n = int(input())
x, y = [0] * n, [0] * n
data = defaultdict(int)
for i in range(n):
    x[i], y[i] = map(int, input().split())

if n == 1:
    print(1)
    exit()
for i in range(n):
    for j in range(n):
        if i != j:
            data[x[j] - x[i], y[j] - y[i]] += 1

print(n - max(data.values()))

Buggy submission (verdict: Runtime Error):
from collections import defaultdict

n = int(input())
x, y = [0] * n, [0] * n
data = defaultdict(int)
for i in range(n):
    x[i], y[i] = map(int, input().split())

for i in range(n):
    for j in range(n):
        if i != j:
            data[x[j] - x[i], y[j] - y[i]] += 1

print(n - max(data.values()))

Buggy submission (verdict: Runtime Error):
from collections import defaultdict

n = int(input())
x, y = [0] * n, [0] * n
data = defaultdict(int)
for i in range(n):
    x[i], y[i] = map(int, input().split())

for i in range(n):
    for j in range(i + 1, n):
        data[x[j] - x[i], y[j] - y[i]] += 1

print(n - max(data.values()))
Problem p03037 (python)

Fixed submission:

n, m = map(int, input().split())
L = [0] * m
R = [0] * m
for i in range(m):
    L[i], R[i] = map(int, input().split())
print(min(R) - max(L) + 1 if min(R) >= max(L) else 0)

Buggy submission (verdict: Runtime Error):

n, m = map(int, input().split())
L = [0] * m
R = [0] * m
for i in range(m):
    L[i], R[i] = map(int, input().split())
print(min(R) - max(L) + 1 if min(R) >= max(L else 0))

Buggy submission (verdict: Runtime Error):

n, m = map(int, input().split())
L = [0] * m
R = [0] * def funcname(self, parameter_list):
    pass
for i in range(m):
    L[i], R[i] = map(int, input().split())
print(min(R) - max(L) + 1)
Problem p03050 (python)

Fixed submission:
n = int(input())
ans = 0
def calc(x):
    x -= 1
    if x <= 0:
        return 0
    elif n // x == n % x:
        return x
    return 0

for i in range(1, int(n ** 0.5) + 1):
    if n % i == 0:
        ans += calc(n // i) + calc(i)
print(ans)

Buggy submission (verdict: Runtime Error):
n = int(input())
ans = 0
i = 1

def calc(x):
    x -= 1
    if n // x == n % x:
        return x
    return 0

for i in range(1, int(n ** 0.5) + 1):
    if n % i == 0:
        if i != 1:
            ans += calc(i)
        ans += calc(n // i)
print(ans)
Problem p03061 (python)

Fixed submission:
from fractions import gcd

n = int(input())
A = list(map(int, input().split()))
L, R = [0] * (n + 1), [0] * (n + 1)

for i in range(1, n + 1):
    L[i] = gcd(L[i - 1], A[i - 1])

for i in range(n - 1, -1, -1):
    R[i] = gcd(R[i + 1], A[i])

ans = 0
#print(L, R)
for i in range(n):
    ans = max(ans, gcd(L[i], R[i + 1]))
print(ans)

Buggy submission (verdict: Runtime Error):
from math import gcd

n = int(input())
A = list(map(int, input().split()))
L, R = [0] * (n + 1), [0] * (n + 1)

for i in range(1, n + 1):
    L[i] = gcd(L[i - 1], A[i - 1])

for i in range(n - 1, -1, -1):
    R[i] = gcd(R[i + 1], A[i])

ans = 0
#print(L, R)
for i in range(n):
    ans = max(ans, gcd(L[i], R[i + 1]))
print(ans)

Buggy submission (verdict: Runtime Error):
import math

n = int(input())
A = list(map(int, input().split()))

def calc_gcd(a, b):
    if a < b:
        temp = b
        b = a
        a = temp
    
    r = a % b
    while r != 0:
        a = b
        b = r
        r = a % b
    
    return b

gcd = math.gcd(A[0], A[1])

for i in range(2, n - 1):
    gcd = math.gcd(gcd, A[i])

ans = gcd
for i in range(1, n - 1):
    gcd1 = A[i - 1]
    gcd2 = A[i + 1]
    for j in range(i - 1):
        gcd1 = math.gcd(gcd1, A[j])
    
    for j in range(i + 2, n - 1):
        gcd2 = math.gcd(gcd2, A[i])
    gcd = math.gcd(gcd1, gcd2)
    ans = max(ans, gcd)
    
print(ans)
Problem p03086 (python)

Fixed submission:

s = input()

cnt = 0
ans = 0
for i in range(len(s)):
    if s[i] == 'A' or s[i] == 'T' or s[i] == 'C' or s[i] == 'G':
        cnt += 1
    else:
        ans = max(ans, cnt)
        cnt = 0

ans = max(ans, cnt)
print(ans)

Buggy submission (verdict: Runtime Error):
s = input()
i = 0
ans = 0
while i < len(s):
    if s[i] == "A" or s[i] == "T" or s[i] == "C" or s[i] == "G":
        for j in range(len(s) - i):
            if s[i + j] != "A" and s[i + j] != "T" and s[i + j] != "C" and s[i + j] != "G":
                break
        ans = max(ans, j)
    i += j
print(ans)
Problem p03087 (python)

Fixed submission:

n, q = map(int, input().split())
s = input()
cnt = 0
data = [0] * (n + 1)
ans = [0] * q
for i in range(n - 1):
    if s[i] == 'A' and s[i + 1] == 'C':
        cnt += 1
    data[i + 1] = cnt

data[n - 1] = cnt

for i in range(q):
    l, r = map(int, input().split())

    ans[i] = data[r - 1] - data[l - 1]

for i in range(q):
    print(ans[i])

Buggy submission (verdict: Runtime Error):

n, q = map(int, input().split())
s = input()
cnt = 0
for i in range(n):
    if s[i] == 'A' and s[i + 1] == 'C':
        cnt += 1

data = [0] * cnt
j = 0
ans = [0] * q
for i in range(n - 1):
    if s[i] == 'A' and s[i + 1] == 'C':
        data[j] = i + 1
        j += 1
        
for i in range(q):
    l, r = map(int, input().split())
    cnt = 0
    for j in range(len(data)):
        if data[j] <= r - 1 and data[j] >= l:
            cnt += 1
        elif data[j] >= r:
            break
    ans[i] = cnt

for i in range(q):
    print(ans[i])
Problem p03197 (python)

Fixed submission:
n = int(input())
a = [0] * n
flag = True
for i in range(n):
    a[i] = int(input())
    if a[i] % 2 == 1:
        flag = False
print("second" if flag else "first")

Buggy submission (verdict: Runtime Error):
n = int(input())
x = 0
for i in range(n):
    x = max(int(input()), x)
print("first" if sum % 2 == 1 else "second")
Problem p03231 (python)

Fixed submission:
from fractions import gcd
n, m = map(int, input().split())
s = list(input())
t = list(input())
i = 1
ans = n * m // gcd(n, m)
g = gcd(n, m)
for i in range(g):
    if s[i * n // g] != t[i * m // g]:
        ans = -1
        break
print(ans)

Buggy submission (verdict: Runtime Error):
from fractions import gcd
n, m = map(int, input().split())
s = list(input())
t = list(input())
i = 1
ans = n * m // gcd(n, m)

a = [""] * (ans + 1)
flag = False
for j in range(n):
    a[ans // n * j] = s[j]
for k in range(m):
    if a[ans // m * k] != "" and a[ans // m * k] != t[k]:
        i += 1
        flag = True
        break
    a[ans // m * k] = t[k]
if flag:
    ans = -1

print(ans)

Buggy submission (verdict: Runtime Error):
from fractions import gcd
n, m = map(int, input().split())
s = list(input())
t = list(input())
i = 1
ans = n * m // gcd(n, m)

a = [""] * (ans * i)
flag = False
for j in range(n):
    a[ans // n * j] = s[j]
for k in range(m):
    if a[ans // m * k] != "" and a[ans // m * k] != t[k]:
        i += 1
        flag = True
        break
    a[ans // m * k] = t[k]
if flag:
    ans = -1

print(ans)

Buggy submission (verdict: Runtime Error):
from fractions import gcd
n, m = map(int, input().split())
s = list(input())
t = list(input())
if max(n, m) % min(n, m) == 0:
    print(-1)
else:
    i = 1
    lcm = n * m // gcd(n, m)
    while 1:
        a = [""] * (lcm * i)
        flag = True
        for j in range(n):
            a[lcm // n * j] = s[j]
        for k in range(m):
            if a[lcm // m * k] != "" and a[lcm // m * k] != t[k]:
                i += 1
                flag = False
                break
            a[lcm // m * k] = t[k]
        if flag:
            print(lcm * i)
            exit()

Buggy submission (verdict: Runtime Error):
from math import gcd
n, m = map(int, input().split())
s = input()
t = input()
if max(n, m) % min(n, m) == 0:
    print(-1)
else:
    print(n * m // gcd(n, m))
Problem p03262 (python)

Fixed submission:
from fractions import gcd 

N, X = map(int, input().split())
x = list(map(int, input().split()))
ans = abs(X - x[0])
for i in range(1, N):
    ans = gcd(ans, abs(x[i - 1] - x[i]))

print(ans)

Buggy submission (verdict: Runtime Error):
from math import gcd 

N, X = map(int, input().split())
x = list(map(int, input().split()))
ans = abs(X - x[0])
for i in range(1, N):
    ans = gcd(ans, abs(x[i - 1] - x[i]))

print(ans)
Problem p03282 (python)

Fixed submission:

s = input()
n = int(input())

i = 0
while i != len(s) and s[i] == '1':
    i += 1

if n <= i:
    print(1)
else:
    print(s[i])

Buggy submission (verdict: Runtime Error):

s = input()
n = int(input())

i = 0
while s[i] == '1':
    i += 1

if n <= i:
    print(1)
else:
    print(s[i])
Problem p03292 (python)

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

a.sort()
ans = 0
for i in range(1, 3):
    ans += abs(a[i] - a[i - 1])

print(ans)

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

a.sort()
ans = 0:
for i in range(1, 3):
    ans += abs(a[i] - a[i - 1])

print(ans)
Problem p03324 (python)

Fixed submission:

d, n = map(int, input().split())

print(100 ** d * n if n <= 99 else 100 ** d * (n + 1))

Buggy submission (verdict: Runtime Error):

d, n = map(int, input().split())

print(100 ** d * n　if n <= 99 else 100 ** d * (n + 1))
Problem p03438 (python)

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

x, y = 0, 0
for i in range(n):
    dif = b[i] - a[i]
    if dif > 0:
        x += dif // 2
    else:
        y += -dif

print("Yes" if x >= y else "No")

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

cnt_a, cnt_b = sum(a), sum(b)
ans = "No"
i = 0
cnt = 0
while cnt < cnt_b - cnt_a:
    if a[i] < b[i]:
        cnt += int((b[i] - a[i]) / 2 + 0.5)
    else:
        cnt += a[i] - b[i]
    i += 1
    if i == n:
        ans = "Yes"

print(ans)
Problem p03472 (python)

Fixed submission:
from math import ceil
n, h = map(int, input().split())
data1, data2 = [], []
for i in range(n):
    a, b = map(int, input().split())
    data1.append([a, b])
    data2.append([a, b])

data1 = sorted(data1, key = lambda x: x[0], reverse = True)
data2 = sorted(data2, key = lambda x: x[1], reverse = True)
ans = 0
while h > 0 and data1[0][0] < data2[0][1]:
    h -= data2[0][1]
    ans += 1
    del data2[0]
    if len(data2) == 0:
        break
ans += ceil(max(0, h) / data1[0][0])
print(ans)

Buggy submission (verdict: Runtime Error):
from math import ceil
n, h = map(int, input().split())
data1, data2 = [], []
for i in range(n):
    a, b = map(int, input().split())
    data1.append([a, b])
    data2.append([a, b])

data1 = sorted(data1, key = lambda x: x[0], reverse = True)
data2 = sorted(data2, key = lambda x: x[1], reverse = True)
ans = 0
while data1[0][0] < data2[0][1]:
    h -= data2[0][1]
    ans += 1
    del data2[0]
ans += ceil(h / data1[0][0])
print(ans)
Problem p03476 (python)

Fixed submission:
q = int(input())
l, r = [0] * q, [0] * q
for i in range(q):
    l[i], r[i] = map(int, input().split())

mini = min(min(l), min(r))
maxi = max(max(l), max(r))
ans = [0] * (maxi + 1)
prime = [0] * (maxi + 1)
def judge_prime(n):
    for i in range(2, int(n ** 0.5) + 1):
        if n % i == 0:
            return False
    
    return True if n != 1 else False

for i in range((mini + 1) // 2, maxi + 1):
    prime[i] = judge_prime(i)

for i in range(mini, maxi + 1, 2):
    ans[i] = ans[i - 2] + 1 if prime[i] and prime[(i + 1) // 2] else ans[i - 2]
for i in range(q):
    print(ans[r[i]] - ans[max(0, l[i] - 2)])

Buggy submission (verdict: Runtime Error):
q = int(input())
l, r = [0] * q, [0] * q
for i in range(q):
    l[i], r[i] = map(int, input().split())

mini = min(min(l), min(r))
maxi = max(max(l), max(r))
ans = [0] * (maxi + 1)
prime = [0] * (maxi + 1)
def judge_prime(n):
    for i in range(2, int(n ** 0.5) + 1):
        if n % i == 0:
            return False
    
    return True if n != 1 else False

for i in range((mini + 1) // 2, maxi + 1):
    prime[i] = judge_prime(i)

for i in range(mini, maxi + 1, 2):
    ans[i] = ans[i - 2] + 1 if prime[i] and prime[(i + 1) // 2] else ans[i - 2
for i in range(q):
    print(ans[r[i]] - ans[max(0, l[i] - 2)])
Problem p03565 (python)

Fixed submission:
s = input()
t = input()
ans = []
if len(s) < len(t):
    print("UNRESTORABLE")
    exit()

for i in range(len(s) - len(t) + 1):
    prot = list(s)
    flag = True
    for j in range(len(t)):
        if prot[i + j] != t[j] and prot[i + j] != "?":
            flag = False
            break
        prot[i + j] = t[j]


    if flag == True:
        prot = "".join(prot).replace("?", "a")
        ans.append(prot)

if ans == []:
    print("UNRESTORABLE")
else:
    ans = sorted(ans)
    print(ans[0])

Buggy submission (verdict: Runtime Error):
s = input()
t = input()
ans = s
for i in range(len(t)):
    for j in range(len(s)):
        ans = list(s)
        flag = True
        if t[i] == s[j]:
            for k in range(i + 1, len(t)):
                if t[i + k] != s[j + k] and s[j + k] != "?":
                    flag = False
                    break
                ans[j + k] = t[i + k]
            for k in range(0, i):
                if t[i + k] != s[j + k] and s[j + k] != "?":
                    flag = False
                    break
                ans[j + k] = t[i + k]

            
            if flag == True:
                for i in range(len(ans)):
                    if ans[i] == "?":
                        ans[i] = "a"

                print("".join(ans))
                exit()

print("UNRESTORABLE")
Problem p03633 (python)

Fixed submission:
from fractions import gcd
n = int(input())

ans = 1
for i in range(n):
    t = int(input())
    ans = ans * t // gcd(ans, t)

print(ans)

Buggy submission (verdict: Runtime Error):
from math import gcd
n = int(input())

ans = 1
for i in range(n):
    t = int(input())
    ans = ans * t // gcd(ans, t)

print(ans)

Buggy submission (verdict: Runtime Error):
from fraction import gcd
n = int(input())

ans = 1
for i in range(n):
    t = int(input())
    ans = ans * t // gcd(ans, t)

print(ans)
Problem p03651 (python)

Fixed submission:
from fractions import gcd
n, k = map(int, input().split())
a = list(map(int, input().split()))

x = a[0]
for i in range(1, n):
    x = gcd(x, a[i])

print("POSSIBLE" if k % x == 0 and max(a) >= k else "IMPOSSIBLE")

Buggy submission (verdict: Runtime Error):
from math import gcd
n, k = map(int, input().split())
a = list(map(int, input().split()))

x = a[0]
for i in range(1, n):
    x = gcd(x, a[i])

print("POSSIBLE" if k % x == 0 and max(a) >= k else "IMPOSSIBLE")
Problem p03693 (python)

Fixed submission:
r, g, b = map(int, input().split())

n = int(str(r) + str(g) + str(b))
print("YES" if n % 4 == 0 else "NO")

Buggy submission (verdict: Runtime Error):
from collections import defaultdict

n = int(input())
a = list(map(int, input().split()))
ans = 0
cnt_free = sum(x >= 3200 for x in a)
for i in range(8):
    if sum(x >= 400 * i and x < 400 * (i + 1) for x in a) >= 1:
        ans += 1
print(max(1, ans))
print(min(8, ans + cnt_free))
Problem p03838 (python)

Fixed submission:
x, y = map(int, input().split())
ans = 10 ** 10
for i in range(2):
    for j in range(2):
        a = x
        b = y
        cnt = 0
        if i == 1:
            a *= -1
            cnt = 1
        if j == 1:
            b *= -1
            cnt += 1
        if a > b:
            continue
        cnt += b - a
        a += b - a
        #print(cnt, a, b)
        if a == b:
            ans = min(ans, cnt)

print(ans)

Buggy submission (verdict: Runtime Error):
x, y = map(int, input().split())
ans = 10 ** 10
for i in range(2):
    for j in range(2):
        a = x
        b = y
        cnt = 0
        if i == 1:
            a *= -1
            cnt = 1
        if j == 1:
            b *= -1
            cnt += 1
        if a >= b:
            continue
        cnt += b - a
        a += b - a¥
        if a == b:
            ans = min(ans, cnt)

print(ans)
Problem p03998 (python)

Fixed submission:
from collections import defaultdict

data = defaultdict()
cnt = defaultdict(int)
for i in range(3):
    s = input()
    data[chr(ord("a") + i)] = s

turn = "a"
while 1:
    cnt[turn] += 1
    if cnt[turn] > len(data[turn]):
        ans = ord(turn) - (ord("a") - ord("A"))
        break

    turn = data[turn][cnt[turn] - 1]
print(chr(ans))

Buggy submission (verdict: Runtime Error):
from collections import defaultdict

data = defaultdict()
for i in range(3):
    s = input()
    data[chr(ord("a") + i)] = s
cnt = defaultdict(int)
turn = "a"
while 1:
    if cnt[turn] == len(data[chr(ord(turn))]):
        ans = ord(turn) - (ord("a") - ord("A"))
        break

    cnt[turn] += 1
    turn = data[chr(ord(turn))][cnt[turn]]
print(chr(ans))
Problem p02646 (python)

Fixed submission:
A, V = map(int, input().split())
B, W = map(int, input().split())
T = int(input())

if V == W:
    print('NO')
    exit()

if 0 <= (abs(B - A) / (V - W)) <= T:
    print('YES')
else:
    print('NO')

Buggy submission (verdict: Runtime Error):
A, V = map(int, input().split())
B, W = map(int, input().split())
T = int(input())

if A - B == 0 and V != W:
    print('NO')
    exit()

if ((B - A) / (V - W)).is_integer() and ((B - A) / (V - W)) > 0:
    print('YES')
else:
    print('NO')
Problem p02678 (python)

Fixed submission:
from collections import deque

N, M = map(int, input().split())
arr = [[] for n in range(N)]
que = deque([1])

for m in range(M):
    a, b = map(int, input().split())
    arr[a - 1].append(b)
    arr[b - 1].append(a)

dist = [-1] * N
dist[0] = 0
arr2 = [0] * (N - 1)

print("Yes")
while que:
    c = que.popleft()
    for i in arr[c - 1]:
        if dist[i - 1] != -1:
            continue

        dist[i - 1] = 0
        arr2[i - 2] = c
        que.append(i)

for i in arr2:
    print(i)

Buggy submission (verdict: Runtime Error):
import numpy as np
from scipy.sparse import csr_matrix
from scipy.sparse.csgraph import shortest_path

N, M = map(int, input().split())
edge = np.array([input().split() + ['1'] for _ in range(M)], dtype=np.int64).T
graph = csr_matrix((edge[2], (edge[:2] - 1)), (N, N))

path = list(shortest_path(graph, method='D', directed=False)[0][1:])
judge = 'Yes' if all([p > 0 for p in path]) else 'No'

if judge == 'Yes':
    print(judge)
    for p in path:
        print(int(p))
else:
    print(judge)
Problem p02658 (python)

Fixed submission:
N=int(input())
total=1
A=list(map(int,input().split()))
flag=True
high=1*(10**18)+1
if A.count(0)>=1:
  total=0
else:
  for i in range(N):
    total*=A[i]
    if high<=total:
      flag=False
      break

if not flag:
  print("-1")
else:
  print(total)

Buggy submission (verdict: Runtime Error):
N=int(input())
total=1
A=list(map(int,input().split()))
if A.count(0)>=1:
  total=0
else:
  for i in range(x):
    total*=A[i]

if 1*(10**18)+1<=total:
  print("-1")
else:
  print(total)
Problem p02705 (python)

Fixed submission:
print(int(input())*2*3.14)

Buggy submission (verdict: Runtime Error):
print(input()*2*3.14)
Problem p02760 (python)

Fixed submission:
x=[list(map(str,input().split())) for _ in range(3)]
N=int(input())
B=[input() for _ in range(N)]
flag=0
for i in range(3):
  for j in range(3):
    if x[i][j] in B:
      x[i][j]=True

for p in range(3):
  if x[p].count(True)==3:
    flag=1
lis=[]
lis2=[]
for a in range(3):
  for b in range(3):
    lis2.append(x[b][a])
  else:
    lis.append(lis2)
    lis2=[]

for q in range(3):
  if lis[q].count(True)==3:
    flag=1
if x[0][0]==True and x[1][1]==True and x[2][2]==True:
  flag=1
elif  x[0][2]==True and x[1][1]==True and x[2][0]==True:
  flag=1
if flag==1:
  print("Yes")
else:
  print("No")

Buggy submission (verdict: Runtime Error):
x=[list(map(str,input().split())) for _ in range(3)]
N=int(input())
B=[input() for _ in range(N)]
flag=0
for i in range(3):
  for j in range(3):
    if x[i][j] in B:
      x[i][j]=True

for p in range(3):
  if x[p].count(True)==3:
    flag=1
lis=[]
lis2=[]
for a in range(3):
  for b in range(3):
    lis2.append(x[b][a])
  else:
    lis.append(lis2)
    lis2=[]

for q in range(3):
  if lis[q].count(True)==3:
    flag=1
if x[0][0]==True and x[1][1]==True and x[2][2]==True:
  flag=1
elif if x[0][2]==True and x[1][1]==True and x[2][0]==True:
if flag==1:
  print("Yes")
else:
  print("No")
Problem p02789 (python)

Fixed submission:
n,m=map(int,input().split())
if n==m:
  print("Yes")
else:
  print("No")

Buggy submission (verdict: Runtime Error):
n,m=map(int,input().split())
if n==m:
  print("Yes")
else:
  print("No
        ")
Problem p02813 (python)

Fixed submission:
import itertools
N=int(input())
candi=[str(i) for i in range(1,N+1)]
P="".join(input().split())
Q="".join(input().split())
count=0
#候補列挙
for j in itertools.permutations(candi,N):
  k="".join(list(j))
  count+=1
  if k==P:
    a=count
  if k==Q:
    b=count
print(abs(a-b))

Buggy submission (verdict: Runtime Error):
import itertools
N=int(input())
candi=[str(i) for i in range(1,N+1)]
P="".join(input().split())
Q="".join(input().split())
count=0

#候補列挙
for j in itertools.permutations(candi,N):
  k="".join(list(j))
  count+=1
  if k==P:
    a=count
  elif k==Q:
    b=count
print(abs(a-b))
Problem p02818 (python)

Fixed submission:
N,M,K=map(int,input().split())

if N<K:
  M=M-(K-N)
  N=0
else:
  N=N-K

if M<0:
  M=0
print(N,M)

Buggy submission (verdict: Runtime Error):
A,B,K=map(int,input().split())
if A>=K:
  print(str(A-K)+" "+str(B))
else:
  t=K-A
 
  print("0"+" "+str(max(B-t,"0")))
A,B,K=map(int,input().split())
if A>=K:
  print(str(A-K)+" "+str(B))
else:
  t=K-A
 
  print("0"+" "+str(max(B-t,0)))

Buggy submission (verdict: Runtime Error):

A,B,K=map(int,input().split())
if A>=K:
  print(str(A-K)+" "+str(B))
else:
  t=K-A
 
  print("0"+" "+str(max(B-t,"0")))
A,B,K=map(int,input().split())
if A>=K:
  print(str(A-K)+" "+str(B))
else:
  t=K-A
 
  print("0"+" "+str(max(B-t,"0")))

Buggy submission (verdict: Runtime Error):
A,B,K=map(int,input().split())
if A>=K:
  print(str(A-K)+" "+str(B))
else:
  t=K-A
 
  print("0"+" "+max(str(B-t),0))
Problem p03106 (python)

Fixed submission:
A,B,K = map(int,input().split())
if A>=B:
  A,B=B,A
new=[]

for i in range(1,A+1):
  if A%i==0 and B%i==0:
    new.append(i)
new.sort()

print(new[-K])

Buggy submission (verdict: Runtime Error):
A,B,K = map(int,input().split())
x = [A, B]
x.sort()
res = [1]
res_n=[]
i = 2

while i <= x[0]:
    if x[0] % i == 0 and x[1] % i == 0:
        x = [x[0] / i, x[1] / i]
        res.append(i)
    else:
        i += 1
t=[A,B]
for j in res:
  res_n.append(min(t)/j)
ans = list(set(res+res_n))
ans.sort()
print(ans[-K])

Buggy submission (verdict: Runtime Error):
A,B,K = map(int,input().split())
x = [A, B]
x.sort()
res = [1]
res_n=[1]
i = 2

while i <= x[0]:
    if x[0] % i == 0 and x[1] % i == 0:
        x = [x[0] / i, x[1] / i]
        res.append(i)
    else:
        i += 1

print(res[K-1])
Problem p03239 (python)

Fixed submission:
N,T = map(int,input().split())
a = [list(map(int,input().split())) for _ in range(N)]
x=[]
for i in range(N):
  if a[i][1]<=T:
    x.append(a[i])
if len(x)==0:
  print("TLE")
else:
  x.sort(key=lambda x:x[0])
  print(x[0][0])

Buggy submission (verdict: Runtime Error):
N,T = map(int,input().split())
a = [list(map(int,input().split())) for _ in range(N)]
x=[]
for i in range(N):
  if a[i][1]<=T:
    x.append(a[i])
if len(x)==0:
  print("TLE")
else:
  x.sort(key=lambda x:x[0])
print(x[0][0])

Buggy submission (verdict: Runtime Error):
N,T = map(int,input().split())
a = [list(map(int,input().split())) for _ in range(N)]
x=[]
for i in range(N):
  if a[i][1]<=T:
    x.append(a[i])
if len(x)==0:
  print("TLE")
else:
  x.sort(key=lambda x:x[0])
print(x[0][0])