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

Fixed submission:
from collections import Counter

mod = 1000000007


def inverse(a):
    return pow(a, mod - 2, mod)


def usearch(x, a):
    lft = 0
    rgt = len(a) + 1
    while rgt - lft > 1:
        mid = (rgt + lft) // 2
        if a[mid] <= x:
            lft = mid
        else:
            rgt = mid
    return lft

def main():
    m = int(input())
    ans = 0
    a = 0
    for i in range(m):
        d, c = map(int, input().split())
        ans += c
        a += d * c
    print(ans + (a - 1) // 9 - 1)

main()

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

mod = 1000000007


def inverse(a):
    return pow(a, mod - 2, mod)


def usearch(x, a):
    lft = 0
    rgt = len(a) + 1
    while rgt - lft > 1:
        mid = (rgt + lft) // 2
        if a[mid] <= x:
            lft = mid
        else:
            rgt = mid
    return lft

memo = [
    [0, 1, 1],
    [1,10,9],
    [2,11,9],
    [3,4,3],
    [4,13,9],
    [5,14,9],
    [6,5,3],
    [7,16,9],
    [8,17,9],
    [9,2,1],
]


def main():
    m = int(input())
    dc = [[int(i) for i in input().split()] for _ in range(m)]
    s = []
    ans = 0
    for i in range(m):
        d = dc[i][0]
        c = dc[i][1]
        ans += c // memo[d][2] * memo[d][1]
        if d == 9:
            ans -= 2
            s.append(d)
        else:
            s.extend([d] * (c % memo[d][2]))

    t = s[0]
    for i in range(1, len(s)):
        ans += 1
        t += s[i]
        if t > 9:
            ans += 1
            t = t % 10 + t // 10

    print(ans)

main()
Problem p02861 (python)

Fixed submission:
n=int(input())
a=[tuple(map(int,input().split())) for i in range(n)]
ans=0
for i in range(n):
  for j in range(i+1,n):
    ans += ((a[i][0] - a[j][0])**2 +(a[i][1] - a[j][1])**2 )**0.5
    
print(ans / n*2)

Buggy submission (verdict: Runtime Error):
n=int(input())
a=[tuple(map(int,input().split())) for i in range(n)]
ans=0
for i in range(n):
  for j in range(i+1,n):
    ans +=
Problem p02909 (python)

Fixed submission:
a=["Sunny","Cloudy","Rainy"]
i=a.index(input())
print(a[i-2])

Buggy submission (verdict: Runtime Error):
a=["Sunny","Cloudy","Rainy"]
i=a.index(ioput())
print(a[i-2])
Problem p02918 (python)

Fixed submission:
from collections import Counter
mod = 1000000007


def inverse(a):
    return pow(a, mod - 2, mod)


def usearch(x, a):
    lft = 0
    rgt = len(a) + 1
    while rgt - lft > 1:
        mid = (rgt + lft) // 2
        if a[mid] <= x:
            lft = mid
        else:
            rgt = mid
    return lft


def main():
    n, k = map(int, input().split())
    s = input()
    cnt = 0
    for i in range(n-1):
        if s[i] != s[i+1]:
            cnt += 1
    ans = n - 1 - cnt
    while cnt >= 2 and k > 0:
        ans += 2
        cnt -= 2
        k -= 1

    if k > 0 and cnt > 0:
        ans += 1

    print(ans)

main()

Buggy submission (verdict: Runtime Error):
from collections import Counter
mod = 1000000007


def inverse(a):
    return pow(a, mod - 2, mod)


def usearch(x, a):
    lft = 0
    rgt = len(a) + 1
    while rgt - lft > 1:
        mid = (rgt + lft) // 2
        if a[mid] <= x:
            lft = mid
        else:
            rgt = mid
    return lft


def main():
    n, k = map(int, input().split())
    s = input()
    cnt = 0
    for i in range(n-1):
        if s[i] != s[i+1]:
            cnt += 1
    ans = n - 1 - cnt
    ans += k * 2
    ans = min(ans, n-1)
    print(ans)

main()
c
Problem p03006 (python)

Fixed submission:
def inverse(a):
    return pow(a, mod - 2, mod)

def main():
    n = int(input())
    a = [0] * n
    b = [0] * n
    for i in range(n):
        x, y = map(int, input().split())
        a[i] = x
        b[i] = y
    from collections import defaultdict
    if n == 1:
        print(1)
        return 
    d = defaultdict(lambda: 0)
    for i in range(n):
        for j in range(i+1, n):
            t = a[i] - a[j]
            y = b[i] - b[j]
            tmp = 1 if (t > 0 or (t == 0 and y > 0)) else -1
            d[(tmp * t, tmp * y)] += 1

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

main()

Buggy submission (verdict: Runtime Error):
def inverse(a):
    return pow(a, mod - 2, mod)

def main():
    n = int(input())
    a = [0] * n
    b = [0] * n
    for i in range(n):
        x, y = tuple(map(int, input().split()))
        a[i] = x
        b[i] = y
    from collections import defaultdict
    d = defaultdict(lambda: 0)
    for i in range(n):
        for j in range(i+1, n):
            t = a[i] - a[j]
            y = b[i] - b[j]
            tmp = 1 if (t > 0 or (t == 0 and y > 0)) else -1
            d[(tmp * t, tmp * y)] += 1

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

main()

Buggy submission (verdict: Runtime Error):
def inverse(a):
    return pow(a, mod - 2, mod)

def main():
    n = int(input())
    a = [0] * n
    b = [0] * n
    for i in range(n):
        x, y  =tuple(map(int, input().split()))
        a[i] = x
        b[i] = y
    from collections import defaultdict
    d = defaultdict(lambda : 0)
    for i in range(n):
        for j in range(i+1, n):
            d[(abs(a[i] - a[j]), abs(b[i] - b[j]))] += 1

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

main()
Problem p03063 (python)

Fixed submission:
def main():
    n=int(input())
    s=input()
    # if len(set(s)) == 1:
    #     print(0)
    #     return
    # s = s[s.index('#'):]
    # n = len(s)
    ans = n
    b = [0] * (n+1)
    w = [0] * (n+1)
    for i in range(n):
        b[i+1] = b[i] + (1 if s[i] == '#' else 0)
        w[i+1] = w[i] + (0 if s[i] == '#' else 1)

    for i in range(n+1):
        tmp = b[i] + (w[n] - w[i])
        ans = min([ans, tmp])
    print(ans)
main()

Buggy submission (verdict: Runtime Error):
def main():
    n=int(input())
    s=input()
    if '.' not in s or '#' not in s:
        print(0)
        return
    j = s.index('.')
    a = len([i for i in s[j:] if i == '#'])
    j = n - s[:-1].index('.')
    b = len([i for i in s[:j] if i == '#'])
    print(min([a, b]))

main()
Problem p03076 (python)

Fixed submission:
a=[int(input()) for _ in range(5)]
a.sort(key=lambda x:(x-1) % 10)
print(a[0] + sum(i if i % 10 == 0 else (i // 10 +1) * 10 for i in a[1:]))

Buggy submission (verdict: Runtime Error):
a=[int(input()) for _ in range(5)]
a.sort()
a=[i*10 + j for i, j in enumurate(a)]
print(max(a))
Problem p03086 (python)

Fixed submission:
a=''.join([i if i in ['A', 'C', 'G', 'T'] else ' ' for i in input()])
print(len(max(a.split() + [''], key=len)))

Buggy submission (verdict: Runtime Error):
a=''.join([i if i in ['A', 'C', 'G', 'T'] else ' ' for i in input()])
print(max(len, a.split())
Problem p03197 (python)

Fixed submission:
n=int(input())
if [i for i in [int(input()) for _ in range(n)] if i % 2]:
    print('first')
else:
    print('second')

Buggy submission (verdict: Runtime Error):
n=int(input())
if [i for i in [int(input()) for _ in range(n)] if i % 2]:
  print('first')
 else:
  print('second')

Buggy submission (verdict: Runtime Error):
n=input()
if [i for i in [int(input()) for _ in range(n)] if i % 2]:
  print('first')
 else:
  print('second')

Buggy submission (verdict: Runtime Error):
input()
if [i for i in map(int, input().split()) if i % 2]:
  print('first')
 else:
  print('second')
Problem p03223 (python)

Fixed submission:
import itertools


def main():
    n = int(input())

    a = []
    for i in range(n):
        a.append(int(input()))
    a.sort()
    if n == 2:
        print(abs(a[0] - a[1]))
        return
    if n == 3:
        tmp1 = abs(a[0] - a[1]) + abs(a[0] - a[2])
        tmp2 = abs(a[0] - a[2]) + abs(a[1] - a[2])
        print(max([tmp1, tmp2]))
        return
    if n < 10:
        ans = 0
        for a in itertools.permutations(a):
            tmp = 0
            for i in range(len(a) - 1):
                tmp += abs(a[i] - a[i + 1])
            ans = max([ans, tmp])
        print(ans)
        return
    ret1 = a[:n // 2 + (1 if n % 2 == 1 else 0)]
    ret2 = a[n // 2 + (1 if n % 2 == 1else 0):]
    ret1 = [ret1[-1]] + ret1[:-2] + [ret1[-2]]
    ret2 = ret2[1:] + [ret2[0]]
    ans = 0

    ans += abs(ret1[-1] - ret2[-1])
    for i in range(len(ret2) - 1):
        ans += abs(ret1[i] - ret2[i])
        ans += abs(ret1[i + 1] - ret2[i])
    if len(ret1) != len(ret2):
        ans += abs(ret1[-2] - ret2[-1])

    if n % 2 == 0:
        print(ans)
        return
    ans1 = ans

    ret1 = a[:n // 2 + (0 if n % 2 == 1 else 1)]
    ret2 = a[n // 2 + (0 if n % 2 == 1else 1):]
    # ret1 = ret1[1:] + [ret1[0]]
    ret2 = [ret2[0]] + ret2[2:] + [ret2[1]]
    ans = 0

    ans += abs(ret1[-1] - ret2[-1])
    for i in range(len(ret1) - 1):
        ans += abs(ret2[i] - ret1[i])
        ans += abs(ret2[i + 1] - ret1[i])
    if len(ret1) != len(ret2):
        ans += abs(ret1[-1] - ret2[-2])
    print(max([ans, ans1]))


main()

Buggy submission (verdict: Runtime Error):
import itertools


def main():
    n = int(input())

    a = []
    for i in range(n):
        a.append(int(input()))
    a.sort()
    if n == 2:
        print(abs(a[0] - a[1]))
        return
    if n == 3:
        tmp1 = abs(a[0] - a[1]) + abs(a[0] - a[2])
        tmp2 = abs(a[0] - a[2]) + abs(a[1] - a[2])
        print(max([tmp1, tmp2]))
        return
    if n < 10:
        ans = 0
        for a in itertools.permutations(a):
            tmp = 0
            for i in range(len(a) - 1):
                tmp += abs(a[i] - a[i + 1])
            ans = max([ans, tmp])
        print(ans)
        return
    ret1 = a[:n // 2 + (1 if n % 2 == 1 else 0)]
    ret2 = a[n // 2 + (1 if n % 2 == 1else 0):]
    ret1 = [ret1[-1]] + ret1[:-2] + [ret1[-2]]
    ret2 = ret2[1:] + [ret2[0]]
    ans = 0

    ans += abs(ret1[-1] - ret2[-1])
    for i in range(len(ret2) - 1):
        ans += abs(ret1[i] - ret2[i])
        ans += abs(ret1[i + 1] - ret2[i])
    if len(ret1) != len(ret2):
        ans += abs(ret1[-2] - ret2[-1])

    # if n % 2 == 0:
    #     print(ans)
    #     return
    ans1 = ans

    ret1 = a[:n // 2 + (0 if n % 2 == 1 else 1)]
    ret2 = a[n // 2 + (0 if n % 2 == 1else 1):]
    # ret1 = ret1[1:] + [ret1[0]]
    ret2 = [ret2[0]] + ret2[2:] + [ret2[1]]
    ans = 0

    ans += abs(ret1[-1] - ret2[-1])
    for i in range(len(ret1) - 1):
        ans += abs(ret2[i] - ret1[i])
        ans += abs(ret2[i + 1] - ret1[i])
    if len(ret1) != len(ret2):
        ans += abs(ret1[-1] - ret2[-2])
    print(max([ans, ans1]))


main()
7541
Problem p03231 (python)

Fixed submission:
import fractions


def main():
    n, m = map(int, input().split())
    s = input()
    t = input()
    l = n * m // fractions.gcd(n, m)
    x = {}
    for i in range(n):
        x[i * (l // n)] = s[i]
    for i in range(m):
        if i * (l // m) not in x:
            continue
        if x[i * (l // m)] != t[i]:
            print(-1)
            return
    print(l)


if __name__ == '__main__':
    main()

Buggy submission (verdict: Runtime Error):
import fractions


def main():
    n, m = map(int, input().split())
    s = input()
    t = input()
    l =  n * m // fractions.gcd(n, m)
    x = [' '] * l
    for i in range(n):
        x[i * (l // n)] = s[i]
    for i in range(m):
        if x[i * (l // m)] == ' ':
            continue
        if x[i * (l // m)] != t[i]:
            print(-1)
            return
    print(l)


if __name__ == '__main__':
    main()

Buggy submission (verdict: Runtime Error):
import fractions
def main():
    n, m = map(int, input().split())
    s = input()
    t = input()
    x = [' '] * n*m
    for i in range(n):
        x[i*m] = s[i]
    for i in range(m):
        if x[i*n] == ' ':
            continue
        if x[i*n] != t[i]:
            print(-1)
            return
    print(n * m // fractions.gcd(n, m))

if __name__ == '__main__':
    main()

Buggy submission (verdict: Runtime Error):
import fraction


def main():
    n, m = map(int, input().split())
    s = input()
    t = input()
    x = [' '] * n * m
    for i in range(n):
        x[i * m] = s[i]
    for i in range(m):
        if x[i * n] == ' ':
            continue
        if x[i * n] != t[i]:
            print(-1)
            return
    print(n * m // fraction.gcd(n, m))


if __name__ == '__main__':
    main()

Buggy submission (verdict: Runtime Error):
import math
def main():
    n, m = map(int, input().split())
    s = input()
    t = input()
    x = [' '] * n*m
    for i in range(n):
        x[i*m] = s[i]
    for i in range(m):
        if x[i*n] == ' ':
            continue
        if x[i*n] != t[i]:
            print(-1)
            return
    print(n * m // math.gcd(n, m))

if __name__ == '__main__':
    main()
Problem p03260 (python)

Fixed submission:
a,b=map(int, input().split())
print('Yes' if a * b % 2 == 1 else 'No')

Buggy submission (verdict: Runtime Error):
print("Yes" if list(filter(lambda x:x%2==0,map(int, input().split()))) "No")
Problem p03268 (python)

Fixed submission:
a, b=map(int, input().split())
try:
    c = a // (b // 2)
    c = c //2 + c%2
except Exception as  e:
    c = 0
if b % 2 == 1:
    c = 0
try:
    d = a // b
except Exception as e:
    d = 0
print(c**3 + d**3)

Buggy submission (verdict: Runtime Error):
a, b=map(int, input().split())
try:
	c = a // (b // 2)
	c = c //2 + c% 2
except Exception:
  c = 0
try:
    d = a // b
except Exception:
  d = 0
    print(c**3 + d **3)

Buggy submission (verdict: Runtime Error):
a, b=map(int, input().split())
c = a // (b // 2)
c = c //2 + c% 2
d = a // b
print(c**3 + d **3)
Problem p03294 (python)

Fixed submission:
n = int(input())
a=list(map(int, input().split()))
print(sum(a) - len(a))

Buggy submission (verdict: Runtime Error):
n = int(input())
a=map(int, input().split())
print(sum(a) - len(a))
Problem p03311 (python)

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

for i in range(len(a)):
    a[i] -= i + 1

a.sort()

d1 = a[len(a) // 2]
print(sum([abs(i - d1) for i in a]))

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

for i in range(len(a)):
    a[i] -= i + 1

a.sort()
b = [a[0]]
for i in a[1:]:
    b.append(b[-1] + i)
hi = len(a)
lo = 0


def score(index):
    return abs((lft * a[index] - b[index]) - (b[-1] - b[index] - (len(a) - index) * a[index]))


for i in range(10000):
    lft = (hi + 2 * lo) // 3
    rgt = (2 * hi + lo) // 3
    ltmp = score(lft)
    rtmp = score(rgt)
    if ltmp <= rtmp:
        lo = lft
    else:
        hi = rgt

printmin([(score(lo), score(lo + 1)]))

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

a = list(map(int, input().split()))

for i in range(len(a)):
    a[i] -= i + 1

a.sort()

d1, d2 = a[len(a) // 2], a[len(a) // 2 + 1]
print(sum([abs(i - d1) for i in a]))
Problem p03319 (python)

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

a = list(map(int, input().split()))

b = min(a)

lft = 0
rgt = 0
for i in range(len(a)):
    if a[i] == b:
        lft = i
        break

ret = 0
i = 0
for i in range(len(a)):
    if a[i] == b:
        continue
    flag = False
    for j in range(k - 1):
        if not i + j < n:
            break
        if a[i+j] == b:
            flag = True
        a[i+j] = b
    if flag and i+k-1 < len(a):
        a[i+k-1] = b
    ret += 1

print(ret)

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

a = list(map(int, input().split()))

b = min(a)

lft = 0
rgt = 0
for i in range(len(a)):
    if a[i] == b:
        lft = i
        break

ret = 0
i = 0
for i in range(len(a)):
    if a[i] == b:
        continue
    flag = False
    for j in range(k - 1):
        if not i + j < n:
            break
        if a[i+j] == b:
            flag = True
        a[i+j] = b
    if flag:
        a[i+k-1] = b
    ret += 1

print(ret)
Problem p03399 (python)

Fixed submission:
print(sum([min([int(input())for i in[1,2]])for j in[1,2]]))

Buggy submission (verdict: Runtime Error):
print(sum([min([int(input())for i in[1,2])for j in[1,2]]))

Buggy submission (verdict: Runtime Error):
print(sum([min([int(input())for i in[1,2]]for j in[1,2]))
Problem p03407 (python)

Fixed submission:
a,b,c=map(int,input().split())
print('No'if a+b<c else'Yes')

Buggy submission (verdict: Runtime Error):
a,b,c=map(int,input().split())
print('No'ifa+b<c else'Yes')
Problem p03471 (python)

Fixed submission:
n, y = map(int, input().split())
yen = [1000, 5000, 10000]

def f():
    for i in range(n+1):
        r = yen[2] * i
        if r > y:
            continue
        for j in range(n+1):
            if i + j > n:
                continue
            if r + yen[1] * j + yen[0] * (n - i -j)== y:
                print('{} {} {}'.format(i, j, n - i - j))
                return
    print('-1 -1 -1')

f()

Buggy submission (verdict: Runtime Error):
    n, y = map(int, input().split())
    yen = [1000, 5000, 10000]
     
    def f():
      for i range(n):
        r = yen[2] * i
        if r > y:
          continue
        for j range(n):
          if i + j > n:
            continue
          r += yen[1] * j  + yen[1] * (n - i -j)
          if r == y:
            print('{} {} {}'.format(i, j, n - i - j))
            return
      print('-1 -1 -1')
     
    f()

Buggy submission (verdict: Runtime Error):
n, y = map(int, input().split())
yen = [1000, 5000, 10000]

def f():
  for i range(n):
    r = yen[2] * i
    if r > y:
      continue
    for j range(n):
      if i + j > n:
        continue
      r += yen[1] * j  + yen[1] * (n - i -j)
      if r == y:
        print('{} {} {}".format(i, j, n - i - j))
        return
  print('-1 -1 -1')

f()
Problem p03476 (python)

Fixed submission:
work = [True] * 100001
work[0] = False
work[1] = False
primes = []
for i in range(100001):
    if work[i]:
        for j in range(2* i, 100001, i):
            work[j] = False


csum = [0] * 100001
index = 0
for i in range(1, 100001):
    if work[i] and work[(i+1)//2]:
        csum[i] = csum[i - 1] + 1
    else:
        csum[i] = csum[i - 1]

q = int(input())
for i in range(q):
    l, r = map(int, input().split())
    low = csum[l-1]
    high = csum[r]
    print(high-low)

Buggy submission (verdict: Runtime Error):
work = [True] * 100001
work[0] = False
work[1] = False
primes = []
for i in range(100001):
    if work[i]:
        primes.append(i)
        for j in range(2, 100001 // i):
            work[j * i] = False

ret = [i for i in primes if (i + 1) // 2 in primes]

csum = [0]
index = 0
for i in range(1, 10001):
    if i < ret[index]:
        csum.append(csum[-1])
    else:
        csum.append(csum[-1] + 1)
        index += 1

q = int(input())
for i in range(q):
    l, r = map(int, input().split())
    low = csum[l-1]
    high = csum[r]
    print(high-low)
Problem p03477 (python)

Fixed submission:
a=map(int,input().split())
r = next(a)
r += next(a)
r -= next(a)
r -= next(a)
print('Left' if r > 0 else 'Balanced' if r == 0 else 'Right')

Buggy submission (verdict: Runtime Error):
a=map(input().split(), int)
r = next(a)
r += next(a)
r -= next(a)
r -= next(a)
print('Left' if r > 0 else 'Balanced' if r == 0 else 'Right')
Problem p03485 (python)

Fixed submission:
a=eval(input().replace(' ', '+'));print(a//2+a%2)

Buggy submission (verdict: Runtime Error):
a=eval(input().replace(' ', '+');print(a//2+a%2)

Buggy submission (verdict: Runtime Error):
a,b=map(input().split(),int);print(a/b+a%b)

Buggy submission (verdict: Runtime Error):
a,b=input().split()
print(a/b+a%b)

Buggy submission (verdict: Runtime Error):
a,b=input().split();print(a/b+a%b)

Buggy submission (verdict: Runtime Error):
    a,b=input().split();printa/b+a%b)

Buggy submission (verdict: Runtime Error):
a,b=input().split();print(eval(a/b+a%b))

Buggy submission (verdict: Runtime Error):
a,b=input().split();print(eval(a/b+a%b)
Problem p03494 (python)

Fixed submission:
input()
n = eval(input().replace(' ', '|'))
for i in range(201):
    if n & 1 << i:
        print(i)
        break

Buggy submission (verdict: Runtime Error):
input();print(max(int(i) for i in input().split() if int(i) in [1 << i for i in range(9)]))

Buggy submission (verdict: Runtime Error):
n = [1 << i for i range(9)]
print(max(int(i) for i in input().split() if int(i) in n))
Problem p03495 (python)

Fixed submission:
n, k = map(int, input().split())
a = {}
for i in [int(j) for j in input().split()]:
    if i in a:
        a[i] += 1
    else:
        a[i] = 1
if len(a) <= k:
    print(0)
else:
    print(sum(sorted(a.values())[:len(a) - k]))

Buggy submission (verdict: Runtime Error):
n, k = input().split()
a = {}
for i in [int(j) for j in input().split()]:
  if i in a:
    a[i] += 1
   else:
    a[i] = 1
if len(a) <= k:
  print(0)
else:
	print(sum(sorted(a.values())[len(a) - k]))
Problem p03504 (python)

Fixed submission:
def func():
    tvs = []
    for i in range(num):
        tvs.append((-1, -1))
    for i in range(len(bans)):
        now = bans[i][0]
        can = bans[i][2]
        tvs = [tv for tv in tvs if tv[1] == can] + [tv for tv in tvs if tv[1] != can]
        for j, tv in enumerate(tvs):
            if tv[1] == -1 or (tv[1] == can and tv[0] <= now) or tv[0] <= now - 1:
                del tvs[j]
                tvs.append((bans[i][1], can))
                break
        else:
            return False
    return True


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

bans = []
for i in range(n):
    bans.append(tuple(map(int, input().split())))
bans.sort(key=lambda x: x[0])

for num in range(1, 1024):
    if func():
        print(num)
        break

Buggy submission (verdict: Runtime Error):
def func():
    tvs = []
    for i in range(num):
        tvs.append((-1, -1))
    for i in range(len(bans)):
        now = bans[i][0]
        can = bans[i][1]
        for j, tv in enumerate([tv for tv in tvs if tv[1] == can] + [tv for tv in tvs if tv[1 != can]]):
            if tv[1] == -1 or (tv[1] == can and tv[0] <= now) or tv[0] <= now - 1:
                del tvs[j]
                tvs.append((bans[i][1], can))
                break
        else:
            return False
    return True


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

bans = []
for i in range(n):
    s, t, c = map(int, input().split())
    bans.append((2 * s, 2 * t, c))
bans.sort(key=lambda x: x[0])

for num in range(1, 1024):
    if func():
        print(num)
        break
Problem p03550 (python)

Fixed submission:
n,z,w=map(int,input().split())
a=list(map(int,input().split()))
if n == 1:
    print(abs(a[0]- w))
else:
    print(max([abs(a[-1] - a[-2]), abs(w - a[-1])]))

Buggy submission (verdict: Runtime Error):
n,z,w=map(int,input().split())
a=list(map(int,input().split()))
a[-1], b = w, a[-1]
print(max((x-b) if x > a else b-x for x in a))
Problem p03564 (python)

Fixed submission:
n=int(input())
m=int(input())
s=1
for i in range(n):
  s = min(s*2, s+m)
print(s)

Buggy submission (verdict: Runtime Error):
import math
n=int(input())
m=int(input())
s=1
for i in range(n):
  s = math.min(s*2, s+m)
print(s)
Problem p03573 (python)

Fixed submission:
a=input().split()
print(a[0] if a[1] == a[2] else a[1] if a[0] == a[2] else a[2])

Buggy submission (verdict: Runtime Error):
a=input().split()
print(a[0] if a[1] == a[2] else a[1] a[0] == a[2] else a[2])
Problem p02556 (python)

Fixed submission:
N = int(input())
v = [list(map(int, input().split())) for i in range(N)]
minx = min([v[i][0] for i in range(N)])
miny = min([v[i][1] for i in range(N)])
v.sort(key = lambda x:x[0] - minx + x[1] - miny)
d = abs(v[0][0] - v[N-1][0]) + abs(v[0][1] - v[N-1][1])
result = d
v.sort(key = lambda x:x[0] - minx - (x[1] - miny))
d = abs(v[0][0] - v[N-1][0]) + abs(v[0][1] - v[N-1][1])
print(max(d, result))

Buggy submission (verdict: Runtime Error):
N = int(input())
v = [list(map(input().split)) for i in range(N)]
v.sort(key = lambda x:abs(x[0]) + abs(x[1]))
d = abs(v[0][0] - v[N-1][0]) + abs(v[0][1] - v[N-1][1])
print(d)