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

Fixed submission:
import numpy as np
import sys 
read = sys.stdin.readline
n = int(input())
a = np.fromstring(read(), dtype=np.int32, sep=' ')
b = np.fromstring(read(), dtype=np.int32, sep=' ')[::-1]

kokan = []
same = -1
for i in range(n):
    if a[i] == b[i]:
        same = a[i]
if same == -1:
    print('Yes')
    print(*b)
    exit()

for i in range(n):
    if a[i] != b[i] and a[i] != same and b[i] != same:
        kokan.append(i)
for i in range(n):
    if a[i] == b[i]:
        if len(kokan) == 0:
            print('No')
            exit()
        else:
            j = kokan[-1]
            b[i], b[j] = b[j], b[i] 
            kokan.pop()
print('Yes')
print(*b)

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

offset = 0
i = 0
while i + offset < n:
    while a[i + offset] == b[i]:
        offset += 1
    i += 1

c = []
for i in range(offset, n + offset):
    c.append(b[i % n])

for i in range(n):
    if a[i] == c[i]:
        print('No')
        exit()

print('Yes')
print(*c)

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

offset = 0
while a[0] == b[offset]:
    offset += 1
c = []
for i in range(offset, offset + n):
    c.append(b[i % n])

for i in range(n):
    if a[i] == c[i]:
        print('No')
        exit()


print('Yes')
print(*c)
Problem p02679 (python)

Fixed submission:
from collections import defaultdict
from math import gcd

mod = 10 ** 9 + 7

n = int(input())
ab = [tuple(map(int, input().split())) for _ in range(n)]

d = defaultdict(int)
zero = 0
for a, b in ab:
    # zero　別処理
    if a == b == 0:
        zero += 1
        continue
    if a == 0:
        d[(0, 1)] += 1
        continue
    if b == 0:
        d[(1, 0)] += 1
        continue

    # a[i]が絶対に非負になるように
    if a < 0:
        a *= -1
        b *= -1
    g = gcd(a, b)
    d[(a // g, b // g)] += 1

all = n - zero
ans = 1
for k1, v in d.items():
    k2 = (k1[1], -k1[0])
    if k2 in d.keys():
        all -= v
        all -= d[k2]
        ans = ans * (pow(2, v, mod) + pow(2, d[k2], mod) - 1) % mod
ans = ans * pow(2, all, mod) % mod
print((ans - 1 + zero) % mod)

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

mod = 10 ** 9 + 7

n = int(input())
ab = [tuple(map(int, input().split())) for _ in range(n)]

d = defaultdict(int)
for a, b in ab:
    # a[i]が絶対に非負になるように
    if a < 0:
        a *= -1
        b *= -1
    g = gcd(a, b)
    d[(a // g, b // g)] += 1

all = n
ans = 1
for k1, v in d.items():
    k2 = (k1[1], -k1[0])
    if k2 in d.keys():
        all -= v
        all -= d[k2]
        ans = ans * (pow(2, v, mod) + pow(2, d[k2], mod) - 1) % mod

ans = ans * pow(2, all, mod) % mod
print(ans - 1)
Problem p02834 (python)

Fixed submission:
import sys
sys.setrecursionlimit(10**6)

n, u, v = map(int, input().split())
# よりたかはしくんが早く辿り着ける葉のうち、青木君から最も遠いで
u -= 1
v -= 1

g = [[] for _ in range(n)]
for _ in range(n - 1):
    a, b = map(lambda x: int(x) - 1, input().split())
    g[a].append(b)
    g[b].append(a)

INF = 1 << 30
t = [INF] * n
a = [INF] * n

t[u] = 0
a[v] = 0


def dfs(v, p, d):
    for nv in g[v]:
        if nv == p:
            continue
        if d[nv] == INF:
            d[nv] = d[v] + 1
            dfs(nv, v, d)


dfs(u, -1, t)
dfs(v, -1, a)

ans = 0
for i in range(n):
    if t[i] < a[i]:
        ans = max(ans, a[i] - 1)
print(ans)

Buggy submission (verdict: Runtime Error):
n, u, v = map(int, input().split())
# よりたかはしくんが早く辿り着ける葉のうち、青木君から最も遠いで
u -= 1
v -= 1

g = [[] for _ in range(n)]
for _ in range(n - 1):
    a, b = map(lambda x: int(x) - 1, input().split())
    g[a].append(b)
    g[b].append(a)

INF = 1 << 30
t = [INF] * n
a = [INF] * n

t[u] = 0
a[v] = 0


def dfs(v, p, d):
    for nv in g[v]:
        if nv == p:
            continue
        if d[nv] == INF:
            d[nv] = d[v] + 1
            dfs(nv, v, d)


dfs(u, -1, t)
dfs(v, -1, a)

ans = 0
for i in range(n):
    if t[i] < a[i]:
        ans = max(ans, a[i] - 1)
print(ans)
Problem p03806 (python)

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

item = [tuple(map(int, input().split())) for _ in range(n)]

INF = 5000
dp = [[INF] * 444 for _ in range(444)]


dp[0][0] = 0

for i in range(n):
    next = [[INF] * 444 for _ in range(444)]
    for j in range(401):
        for k in range(401):
            a, b, c = item[i]
            next[j + a][k + b] = min(next
                                     [j + a][k + b], dp[j][k] + c)
            next[j][k] = min(next[j][k], dp[j][k])
    dp = next

ans = INF
for i in range(1, 401):
    for j in range(1, 401):  # i : j == ma : mb
        if ma * j == i * mb:
            ans = min(ans, dp[i][j])
print(ans if ans != INF else -1)

Buggy submission (verdict: Runtime Error):
import numpy as np
n, ma, mb = map(int, input().split())

item = [tuple(map(int, input().split())) for _ in range(n)]

INF = 5000
dp = np.full((n + 1, 444, 444), INF, dtype=np.int)

dp[0][0][0] = 0

for i in range(n):
    for j in range(401):
        for k in range(401):
            a, b, c = item[i]
            dp[i + 1][j + a][k + b] = min(dp[i + 1]
                                          [j + a][k + b], dp[i][j][k] + c)
            dp[i + 1][j][k] = min(dp[i + 1][j][k], dp[i][j][k])

ans = INF
for i in range(1, 401):
    for j in range(1, 401):  # i : j == ma : mb
        if ma * j == i * mb:
            ans = min(ans, dp[n][i][j])
print(ans if ans != INF else -1)
Problem p02623 (python)

Fixed submission:
from itertools import accumulate
from bisect import bisect_right

R = lambda: map(int, input().split())
*_, k = R()
a = accumulate(R())
b = list(accumulate(R()))
r = bisect_right(b, k)
for i, x in enumerate(a, 1):
  if x > k:
    break
  j = bisect_right(b, k - x)
  r = max(r, i + j) 
print(r)

Buggy submission (verdict: Runtime Error):
from itertools import accumulate
enum = enumerate

R = lambda: map(int, input().split())
*_, k = R()
a = accumulate(R())
b = tuple(accumulate(R()))
print(max(i + j for i, x in enum(a, 1) for j, y in enum(b, 1) if x + y <= k))
Problem p02735 (python)

Fixed submission:
h, w = map(int, input().split())
a0 = '.' * w
r0 = [200] * w
for i in range(h):
  a = input()
  r = [i * 200]
  for x, y, z, u in zip(a0, '.' + a, a, r0):
    r.append(min(u + (x + z == '.#'), r[-1] + (y + z == '.#')))
  a0 = a
  r0 = r[1:]
print(r[-1])

Buggy submission (verdict: Runtime Error):
from itertools import count, repeat

h = int(input().split()[0])
a0 = repeat('.')
r0 = list(range(w))
for i in range(h):
  a = input()
  r = [i]
  for x, y, z, u in zip(a0, '.' + a, a, r0):
    r.append(min(u + (x + z == '.#'), r[-1] + (y + z == '.#')))
  a0 = a
  r0 = r[1:]
print(r[-1])
Problem p02773 (python)

Fixed submission:
from collections import Counter
from itertools import groupby
from operator import itemgetter

c = Counter(input() for _ in range(int(input())))
a = sorted((-c[x],x) for x in c)
for _, s in next(groupby(a, itemgetter(0)))[1]:
  print(s)

Buggy submission (verdict: Runtime Error):
from itertools import groupby
from itertools import itemgetter

a = groupby(sorted(input() for _ in range(int(input()))))
a = [(len(tuple(g)), s) for s, g in a]
m = max(a, key=itemgetter(0))[0]
for k, s in a:
  if k == m:
    print(s)

Buggy submission (verdict: Runtime Error):
from itertools import groupby
from iterator import itemgetter

a = groupby(sorted(input() for _ in range(int(input()))))
a = [(len(tuple(g)), s) for s, g in a]
m = max(a, key=itemgetter(0))[0]
for k, s in a:
  if k == m:
    print(s)

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

c = Counter(input() for _ in range(int(input())))
m = max(c.values())
for s in sorted(s for s, k in c.items() if k == m) 
  print(s)
Problem p02792 (python)

Fixed submission:
n = int(input())
r = range(1, 10)
a = [[0] * 9 for _ in r]
for i in r:
  if i <= n:
    a[i - 1][i - 1] += 1
for i in r:
  for j in r:
    k = 1
    while 10 * k * i + j <= n:
      a[i - 1][j - 1] += min(k, (n - j) // 10 - k * i + 1)
      k *= 10
print(sum(a[i][j] * a[j][i] for i in range(9) for j in range(9)))

Buggy submission (verdict: Runtime Error):
r = range(1, 10)
n = int(input())
a = [None] + [[0] * 10 for _ in r]
for i in r:
  if i <= n:
    a[i][j] += 1
for i in r:
  for j in r:
    k = 1
    while 10 * k * i + j <= n:
      a[i][j] += min(k, (n - j) // 10 - k * i + 1)
      k *= 10
print(sum(a[i][j] * a[j][i] for i in r for j in r))
Problem p02873 (python)

Fixed submission:
from itertools import groupby, chain, islice
 
def pairs(t):
    a = True
    while a:
        a =[sum(1 for _ in g) for k, g in islice(t, 2)]
        if a:
            yield sum(x * (x - 1) // 2 for x in a) + max(a)
 
s = input()
t = groupby(s)
d = [(0, ())]
if s[0] == '>':
    t = chain(d, t)
if s[-1] == '<':
    t = chain(t, d)
print(sum(pairs(t)))

Buggy submission (verdict: Runtime Error):
from itertools import groupby

r = p = 0
for k, g in groupby(input()):
    r += sum(i for i, _ in enumerate(g, 1))
    if k == '>':
        r -= min(i, p)
    p = i
print(r)
Problem p02891 (python)

Fixed submission:
from itertools import groupby

s = input()
k = int(input())
a = [sum(1 for _ in g) for _, g in groupby(s)]
if len(a) == 1:
    print(len(s) * k // 2)
else:
    x, y = a[0], a[-1]
    b = (x + y) // 2 if s[0] == s[-1] else x // 2 + y // 2
    print(x // 2 + y // 2 + sum(x // 2 for x in a[1:-1]) * k + b * (k - 1))

Buggy submission (verdict: Runtime Error):
from itertools import groupby
from functools import reduce
from operator import xor

s = input()
k = int(input())
r = len(s) * k // 2
a = [reduce(xor, (1 for _ g)) for _, g in groupby(s)]
if len(a) > 1:
  r -= sum(a) * k // 2
  if s[0] == s[-1] and a[0] & a[-1]:
    r += k - 1
print(r)

Buggy submission (verdict: Runtime Error):
from itertools import groupby

s = input()
k = int(input())
a = [sum(1 for _ in g) for _, g in groupby(s)]
if s[0] == s[-1]:
    a[0] += a.pop()
print(sum(x // 2 for x in a) * k)
Problem p02989 (python)

Fixed submission:
n = int(input())
a = sorted(map(int, input().split()))
print(a[n // 2] - a[n // 2 - 1])

Buggy submission (verdict: Runtime Error):
m = int(input()) // 2
a = sorted(map(int, input().split()))
print(a[n] - a[m - 1])
Problem p03038 (python)

Fixed submission:
import heapq
from itertools import repeat, starmap
from operator import mul

R = lambda: map(int, input().split())
n, m = R()
a = list(zip(R(), repeat(1)))
heapq.heapify(a)
for _ in range(m):
    b, c = R()
    i = b
    while i:
        x, y = a[0]
        if x >= c:
            break
        heapq.heappop(a)
        d = min(i, y)
        i -= d
        y -= d
        if y:
            heapq.heappush(a, (x, y))
    heapq.heappush(a, (c, b - i))
print(sum(starmap(mul, a)))

Buggy submission (verdict: Runtime Error):
import heapq
from itertools import repeat, starmap
from operator import mul

R = lambda: map(int, input().split())
n, m = R()
a = list(zip(R(), repeat(1)))
heapq.heapify(a)
for _ in range(m):
    b, c = R()
    i = b
    while i and a[0][0] < c:
        x, y = a[0]
        if i < y:
            a[0] = x, y - i
            i = 0
        else:
            heapq.heappop(a)
            i -= y
    if i < b
        heapq.heappush(a, (c, b - i))
print(sum(starmap(mul, a)))

Buggy submission (verdict: Runtime Error):
import heapq
from itertools import starmap
from operator import mul

R = lambda: map(int, input().split())
n, m = R()
a = [[x, 1] for x in R()]
heapq.heapify(a)
for _ in range(m):
    b, c = R()
    i = b
    while i and a[0][0] < c:
        x, y = a[0]
        if i < y:
            a[0][1] -= i
            i = 0
        else:
            heapq.heappop(a)
            i -= y
    if i < b:
        heapq.heappush(a, (c, b - i))
print(sum(starmap(mul, a)))
Problem p03053 (python)

Fixed submission:
h, w = map(int, input().split())
a = [['#'] * (w + 2)] + [['#'] + list(input()) + ['#']
                          for _ in range(h)] + [['#'] * (w + 2)]
p = [(i, j) for i in range(1, h + 1) for j in range(1, w + 1) if a[i][j] == '#']
d = (-1, 0), (1, 0), (0, -1), (0, 1)
r = -1
while p:
    r += 1
    s = []
    for i, j in p:
        for di, dj in d:
            di += i
            dj += j
            if a[di][dj] == '.':
                a[di][dj] = '#'
                s.append((di, dj))
    p = s
print(r)

Buggy submission (verdict: Runtime Error):
h, w = map(int, input().split())
a = [['#'] * (w + 2)] * 2
a[1: 1] = (['#'] + list(input()) + ['#'] for _ in range(h)]
d = (-1, 0), (1, 0), (0, -1), (0, 1)

step = [(i, j) for i in range(1, h + 1) for j in range(1, w + 1)
       if a[i][j] == '#']

def next_step():
    r = []
    for i, j in step:
        for di, dj in d:
            di += i
            dj += j
            if a[di][dj] == '.':
                a[di][dj] = '#'
                r.append((di, dj))
    return r

n = h * w - len(step)
r = 0
while n:
    r += 1
    step = next_step()
    n -= len(step)
print(r)

Buggy submission (verdict: Runtime Error):
h, w = map(int, input().split())
rb = [['#'] * (w + 2)]
a = rb + [list('#' + input() + '#') for _ in range(h)] + rb
p = [(i, j) for i in range(1, h + 1) for j in range(1, w + 1) if a[i][j] == '#']
d = (-1, 0), (1, 0), (0, -1), (0, 1)
r = -1
while p:
    r += 1
    s = []
    for i, j in p:
    for di, dj in d:
            di += i
            dj += j
            if a[di][dj] == '.':
                a[di][dj] = '#'
                s.append((di, dj))
    p = s
print(r)

Buggy submission (verdict: Runtime Error):
h, w = map(int, input().split())
rb = ['#'] * (w + 2)
a = [rb + [['#'] + list(input()) + ['#'] for _ in range(h)] + rb]
p = [(i, j) for i in range(1, h + 1) for j in range(1, w + 1) if a[i][j] == '#']
d = (-1, 0), (1, 0), (0, -1), (0, 1)
r = -1
while p:
    r += 1
    s = []
    for i, j in p:
        for di, dj in d:
            di += i
            dj += j
            if a[di][dj] == '.':
                a[di][dj] = '#'
                s.append((di, dj))
    p = s
print(r)

Buggy submission (verdict: Runtime Error):
h, w = map(int, input().split())
rb = ['#'] * (w + 2)]
a = [rb + [['#'] + list(input()) + ['#'] for _ in range(h)] + rb]
p = [(i, j) for i in range(1, h + 1) for j in range(1, w + 1) if a[i][j] == '#']
d = (-1, 0), (1, 0), (0, -1), (0, 1)
r = -1
while p:
    r += 1
    s = []
    for i, j in p:
        for di, dj in d:
            di += i
            dj += j
            if a[di][dj] == '.':
                a[di][dj] = '#'
                s.append((di, dj))
    p = s
print(r)
Problem p02623 (python)

Fixed submission:
n,m,k = map(int,input().split())
nlist = list(map(int,input().split()))
mlist = list(map(int,input().split()))
result = 0

# mlistが読める残り時間。ncount(nが読める冊数)が増えるたびに減少していく
mrest = k

# mlistが読める冊数。最初はの最大冊数だが、ncount(nが読める冊数)が増えるたびに減少していく
mcount = m

# mcount分読むのにかかる時間。最初は最大冊数分持っているか、mcountが減るたびに減少していく
mtime = sum(mlist)

# ncount分読むのにかかる時間。ncountが増えるたびに増加していく
ntime = 0

# ncount(nが読める冊数)を1ずつ増やしていく
for ncount in range(len(nlist) + 1):
  # ncountが1以上の場合は、1冊読んだので、mrestをその時間分減らす
  if ncount > 0:
    mrest -= nlist[ncount - 1]
    ntime += nlist[ncount - 1]
  # もしntimeが最大時間を超えてしまったら終了する
  if ntime > k:
    break;
  # mlistが読める残り時間も冊数もあれば、mlistから本を取っていく
  # もしmlistが読める残り時間が最大時間を超えていたら後ろから諦めていく
  while mcount > 0 and mtime > mrest:
    mcount -= 1
    mtime -= mlist[mcount]
  # このループで読める冊数はncount+mcount。ループごとの最大値が答え
  result = max(result, ncount + mcount)
  # nlistの本を全部読み終わっていたら処理を終了する
  if ncount == n:
    break;
print(result)

Buggy submission (verdict: Runtime Error):
n,m,k = map(int,input().split())
nlist = list(map(int,input().split()))
mlist = list(map(int,input().split()))
result = 0

# mlistが読める残り時間。ncount(nが読める冊数)が増えるたびに減少していく
mrest = k

# mlistが読める冊数。最初はの最大冊数だが、ncount(nが読める冊数)が増えるたびに減少していく
mcount = m

# mcount分読むのにかかる時間。最初は最大冊数分持っているか、mcountが減るたびに減少していく
mtime = sum(mlist)

# ncount(nが読める冊数)を1ずつ増やしていく
for ncount in range(0, len(nlist) + 1):
  # mlistが読める残り時間も冊数もあれば、mlistから本を取っていく
  # もしmlistが読める残り時間が最大時間を超えていたら後ろから諦めていく
  while mrest > 0 and mcount > 0 and mtime > mrest:
    mcount -= 1
    mtime -= mlist[mcount]
  # このループで読める冊数はncount+mcount。ループごとの最大値が応え
  result = max(result, ncount + mcount)
  # ncountから1冊読んだので、mrestをその時間分減らす
  mrest -= nlist[ncount]
  # これでmlistを読む時間が無くなってしまったら処理を終了する
  if mrest <= 0:
    break
print(result)

Buggy submission (verdict: Runtime Error):
n,m,k = map(int,input().split())
nlist = list(map(int,input().split()))
mlist = list(map(int,input().split()))
result = 0

# mlistが読める残り時間。ncount(nが読める冊数)が増えるたびに減少していく
mrest = sum(mlist)
# mlistが読める冊数。最初はの最大冊数だが、ncount(nが読める冊数)が増えるたびに減少していく
mcount = m

# ncount(nが読める冊数)を1ずつ増やしていく
for ncount in range(0, len(nlist) + 1):
  # mlistが読める残り時間も冊数もあれば、mlistから本を取っていく
  # もしmlistが読める残り時間が最大時間を超えていたら後ろから諦めていく
  while mrest > 0 and mcount > 0 and mrest > k:
    mcount -= 1
    mrest -= mlist[mcount - 1]
  # このループで読める冊数はncount+mcount。ループごとの最大値が応え
  result = max(result, ncount + mcount)
  # ncountから1冊読んだので、mrestをその時間分減らす
  mrest -= nlist[ncount]
  # これでmlistを読む時間が無くなってしまったら処理を終了する
  if mrest <= 0:
    break
print(result)

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

n = 0
m = 0
r = 0
while n < len(nn) or m < len(mm):
  if (m == len(mm) or nn[n] < mm[m]) and n < len(nn):
    if k < nn[n]:
      break
    k -= nn[n]
    r += 1
    n += 1
  else:
    if k < mm[m]:
      break
    r += 1
    m += 1
print(r)
Problem p03745 (python)

Fixed submission:
def solve(): 

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

    i = 0
    result = 0

    while i < N:
        while i+1 < N and A[i] == A[i+1]:
            i += 1
        if i+1 < N and A[i] < A[i+1]:
            while i+1 < N and A[i] <= A[i+1]:
                i += 1
        elif i+1 < N and A[i] > A[i+1]:
            while i+1 < N and A[i] >= A[i+1]:
                i += 1
        
        result += 1
        i += 1

    print(result)    

if __name__ == "__main__":
    solve()

Buggy submission (verdict: Runtime Error):
def solve(): 

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

    i = 0
    result = 0

    while i < N:
        while i+1 < n and A[i] == A[i+1]:
            i += 1
        if i+1 < N and A[i] < A[i+1]:
            while i+1 < n and A[i] <= A[i+1]:
                i += 1
        elif i+1 < N and A[i] > A[i+1]:
            while i+1 < n and A[i] >= A[i+1]:
                i += 1
        
        result += 1
        i += 1

    print(result)    

if __name__ == "__main__":
    solve()

Buggy submission (verdict: Runtime Error):
def solve(): 

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

    i = 0
    result = 0

    while i < n:
        while i+1 < n and A[i] == A[i+1]:
            i += 1
        if i+1 < n and A[i] < A[i+1]:
            while i+1 < n and A[i] <= A[i+1]:
                i += 1
        elif i+1 < n and A[i] > A[i+1]:
            while i+1 < n and A[i] >= A[i+1]:
                i += 1
        
        result += 1
        i += 1

    print(result)    

if __name__ == "__main__":
    solve()
Problem p02596 (python)

Fixed submission:
k = int(input())
mo = 7
mo = mo % k
for i in range(1 , k + 1):
  if mo == 0:
    print(i)
    break
  if mo != 0:
    mo = (mo * 10 + 7) % k
else:
  print(-1)

Buggy submission (verdict: Runtime Error):
k = int(input())
mo = 0
for i in range(1, k + 1):
    mo = mo * 10 + 7
    k = mo % k
    if mod == 0:
        print(i)
        break
else:
    print(-1)
Problem p02753 (python)

Fixed submission:
S=input()
if S=="AAA" or S=="BBB":
    print("No")
else:
    print("Yes")

Buggy submission (verdict: Runtime Error):
S=input()
if S=="AAA"or"BBB":
    print("No")
  else:
    print("Yes")
Problem p02754 (python)

Fixed submission:
N,A,B=(int(x) for x in input().split())
a=int(A+B)
b=int(N/a)
c=int(N%a)
if c<A:
  print(int(b*A+c))
else:
  print(int(b*A+A))

Buggy submission (verdict: Runtime Error):
N=int(input())
A=int(input())
B=int(input())
a=int(A+B)
b=int(N/a)
c=int(N%a)
if c<A:
  print(int(b*A+c))
else:
  print(int(b*A+A))

Buggy submission (verdict: Runtime Error):
N=input()
A=input()
B=input()
a=int(A+B)
b=int(N/a)
c=int(N%a)
if c<A:
  print(int(b*A+c))
else:
  print(int(b*A+A))

Buggy submission (verdict: Runtime Error):
N=input()
A=input()
B=input()
a=str(A+B)
b=str(N/a)
c=str(N%a)
if c<A:
  print(str(b*A+c))
else:
  print(str(b*A+A))

Buggy submission (verdict: Runtime Error):
N=input()
A=input()
B=input()
a=A+B
b=str(N/a)
c=str(N%a)
if c<A:
  print(b*A+c)
else:
  print(b*A+A)

Buggy submission (verdict: Runtime Error):
N=input()
A=input()
B=input()
a=A+B
b=N/a
c=N%a
if c<A:
  print(b*A+c)
else:
  print(b*A+A)
Problem p03242 (python)

Fixed submission:
print(1110-int(input()))

Buggy submission (verdict: Runtime Error):
print(1100-int(input())
Problem p03307 (python)

Fixed submission:
N=int(input())
if N%2: print(N*2)
else: print(N)

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

a0=A[1:N-1]
a1n=A[0]
a2n=A[-1]
a1=A[0]
a2=A[-1]
while True:
    if a0==[]:break
    if a1n<a2n:
        a1n+=a0[0]
        a1.append(a0[0])
        a0.pop(0)
    else:
        a2n+=a0[-1]
        a2.insert(0,a0[0])
        a0.pop(-1)
        
a3n=a1[0]
a4n=a1[-1]
while True:
    if a1==[]:break
    elif a3n<a4n:
        a3n+=a1[0]
        a1.pop(0)
    else:
        a4n+=a1[-1]
        a1.pop(-1)
        
a5n=a2[0]
a6n=a2[-1]
while True:
    if a2==[]:break
    elif a5n<a6n:
        a5n+=a2[0]
        a2.pop(0)
    else:
        a6n+=a2[-1]
        a2.pop(-1)
        
num=[sum(a3),sum(a4),sum(a5),sum(a6)]
print(max(num)-min(num))

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

a0=A[1:N-1]
a1n=A[0]
a2n=A[-1]
a1=A[0]
a2=A[-1]
while True:
    if a0==[]:break
    if a1n<a2n:
        a1n+=a0[0]
        a1.append(a0[0])
        a0.pop(0)
    else:
        a2n+=a0[-1]
        a2.insert(0,a0[0])
        a0.pop(-1)
        
a3n=a1[0]
a4n=a1[-1]
while True:
    if a1==[]:break
    elif a3n<a4n:
        a3n+=a1[0]
        a1.pop(0)
    else:
        a4n+=a1[-1]
        a1.pop(-1)
        
a5n=a2[0]
a6n=a2[-1]
while True:
    if a2==[]:break
    elif a5n<a6n:
        a5n+=a2[0]
        a2.pop(0)
    else:
        a6n+=a2[-1]
        a2.pop(-1)
        
num=[sum(a3),sum(a4),sum(a5),sum(a6)]
print(max(num)-min(num))
Problem p03315 (python)

Fixed submission:
S=input()
ans=0
for i in S:
    if i=='+':ans+=1
    else: ans-=1
print(ans)

Buggy submission (verdict: Runtime Error):
S=input()
ans=0
for i in S:
    if i='+':ans+=1
    else: i-=1
Problem p02570 (python)

Fixed submission:
d, t, s = map(int, input().split())
if t*s >= d:
	print ("Yes")
else:
	print ("No")

Buggy submission (verdict: Runtime Error):
d, t, s = input().split()
if t*s >= d:
	print "Yes"
else:
	print "No"

Buggy submission (verdict: Runtime Error):
d, t, s = input().split()
if t*s >= d:
	return "Yes"
else:
	return "No"
Problem p02577 (python)

Fixed submission:
n = int(input())
if n % 9 == 0:
    print("Yes")
else:
    print("No")

Buggy submission (verdict: Runtime Error):
n = input()
if n % 9 == 0:
    print("Yes")
else:
    print("No")