Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Runtime Error):
print((lambda n,m,d:(m-1)/(n*n)*([n,2*(n-d))][d>0]))(*map(int,input().split())))

Fixed submission:
print((lambda n, m, d: (m - 1) / (n * n) * (n if d == 0 else (2 * (n - d))))(*map(int, input().split())))
Buggy python submission (verdict: Runtime Error):
p=input;p();a=map(int,p().split());print(max(a)-min(a))

Fixed submission:
p=input;p();a=sorted([int(i)for i in p().split()]);print(a[-1]-a[0])
Buggy python submission (verdict: Runtime Error):
print(*["YNeos"[(int(s)%sum(int(i))for i in s)>0::2]for s in[input()]])


Fixed submission:
print(*["YNeos"[(int(s)%sum(int(i)for i in s))>0::2]for s in[input()]])

Buggy python submission (verdict: Runtime Error):
print(*[["Yes","No"][int(s)%sum(int(i)for i in s)]for s in[input()]])

Fixed submission:
print(*["YNeos"[(int(s)%sum(int(i)for i in s))>0::2]for s in[input()]])
Buggy python submission (verdict: Runtime Error):
n,m = map(int,input().split())
l = [[int(i)for i in input().split()]for _ in [0]*n]

def  g(k):
  a = [x[0]if k&1 else -x[0])+(x[1]if k&2 else -x[1])+(x[2]if k&4 else -x[2])  for x in l]
  a.sort(reverse=True)
  return sum(a[:m])
print(max([g(i) for i range(8)]))

Fixed submission:
n, m = map(int, input().split())
l = [[int(i) for i in input().split()] for _ in [0]*n]
ans = 0

def  getmm(k):
  f = lambda x: (x[0] if k & 1 else -x[0]) + (x[1] if k & 2 else -x[1]) + (x[2] if k & 4 else -x[2])
  al = [f(e) for e in l]
  al.sort(reverse=True)
  return sum(al[:m])

for i in range(8):
  ans = max(ans, getmm(i))
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
#!/usr/bin/env python
# -*- coding: utf-8 -*-

from queue import Queue

def solve():
    n, m = map(int, input().split())
    al = [[int(i) for i in input().split()] for _ in range(n)]

    ans = 0
    q = Queue()
    for i in range(n):
        tq = Queue()
        while not q.empty():
            elem = q.get()
            t = [elem[0] + 1, 
                    [
                        elem[1][0] + al[i][0],
                        elem[1][1] + al[i][1],
                        elem[1][2] + al[i][2]
                        ]
                    ]
            if t[0] == m:
                ans = max(ans, abs(t[1][0]) + abs(t[1][1]) + abs(t[1][2]))
            else:
                tq.put(t)
            tq.put(elem)
        q = tq
        q.put([1, [al[i][0], al[i][1], al[i][2]]])
    print(ans)


if __name__=="__main__":
    solve()


Fixed submission:
n, m = map(int, input().split())
l = [[int(i) for i in input().split()] for _ in [0]*n]
ans = 0

def  getmm(k):
  f = lambda x: (x[0] if k & 1 else -x[0]) + (x[1] if k & 2 else -x[1]) + (x[2] if k & 4 else -x[2])
  al = [f(e) for e in l]
  al.sort(reverse=True)
  return sum(al[:m])

for i in range(8):
  ans = max(ans, getmm(i))
print(ans)
Buggy python submission (verdict: Runtime Error):
n = int(input())
s = n > 1000 if 'D' else 'C'
print('AB' + s + str(n % 1000)) 

Fixed submission:
s = print('AB' + ('D' if int(input()) > 999 else 'C'))
Buggy python submission (verdict: Runtime Error):
print((lambda x:max(eval(x[0]+c+x[1])for c in"*+-"))(input()))

Fixed submission:
print((lambda x:max(eval(x[0]+c+x[1])for c in"*+-"))(input().split()))
Buggy python submission (verdict: Runtime Error):
p=input;n,s=p(),p();print(max(len(set(s[:i])&set(s[i:]))for i in range(n)))

Fixed submission:
p=input;n,s=int(p()),p();print(max(len(set(s[:i])&set(s[i:]))for i in range(n)))
Buggy python submission (verdict: Runtime Error):
x,ans=int(input()),1
for i in range(int(x**0.5)+1):
  ans = max(ans, max(i**j for j in range(10) if i**j<=x))
print(ans)

Fixed submission:
a,b,c,d=map(int,input().split())
print(["No","Yes"][abs(a-c)<=d or (abs(a-b) <= d and abs(b-c)<=d)])
Buggy python submission (verdict: Runtime Error):
print(max([max(i**j for j in range(10) if i**j<=x) for i in range(x)] for x in range(int(input())**0.5+1)))

Fixed submission:
x,ans=int(input()),1
for i in range(int(x**0.5)+1):
  ans = max(ans, max(i**j for j in range(10) if i**j<=x))
print(ans)
Buggy python submission (verdict: Runtime Error):
p=input;a=[i for i in p().split()];print(sum(a)+max(a)*2**int(p()))

Fixed submission:
p=input;a=[int(i)for i in p().split()];m=max(a);print(sum(a)-m+m*2**int(p()))

Buggy python submission (verdict: Runtime Error):
p=input;a=map(int,p().split());print(sum(a)+max(a)*2**int(p()))

Fixed submission:
p=input;a=[int(i)for i in p().split()];m=max(a);print(sum(a)-m+m*2**int(p()))
Buggy python submission (verdict: Runtime Error):
h, w = map(int, input().split())
table = [list(input()) for _ in range(h))
visited = [["." for _ in range(w)] for _ in range(h)]

mx = [0, 1, 0, -1]
my = [1, 0, -1, 0]
for i in range(h):
  for  j in range(w):
    if table[i][j] == "#":
      for k in range(4):
        tx, ty = j + mx[k], i + my[k]
        if 0 <= tx <= w and 0 <= ty <= h and table[ty][tx] == "#":
          visited[i][j] = visited[ty][tx] = "#"

for i in range(h):
  for  j in range(w):
    if table[i][j] != visited[i][j]:
      print("No")
      exit(0)
print("Yes")

Fixed submission:
h, w = map(int, input().split())
table = [list(input()) for _ in range(h)]
visited = [["." for _ in range(w)] for _ in range(h)]

mx = [0, 1, 0, -1]
my = [1, 0, -1, 0]
for i in range(h):
  for  j in range(w):
    if table[i][j] == "#":
      for k in range(4):
        tx, ty = j + mx[k], i + my[k]
        if 0 <= tx < w and 0 <= ty < h and table[ty][tx] == "#":
          visited[i][j] = visited[ty][tx] = "#"

for i in range(h):
  for  j in range(w):
    if table[i][j] != visited[i][j]:
      print("No")
      exit(0)
print("Yes")
Buggy python submission (verdict: Runtime Error):
n, x = map(int, input().split())
l = [int(i) for i in range(n)]
print(n+(x-sum(l))//min(l))

Fixed submission:
n, x = map(int, input().split())
l = [int(input()) for _ in range(n)]
print(n+(x-sum(l))//min(l))

Buggy python submission (verdict: Runtime Error):
n, x = map(int, input().split())
l = [int(i) for i in range(n)]
print(n+((x-sum(l))//min(l))

Fixed submission:
n, x = map(int, input().split())
l = [int(input()) for _ in range(n)]
print(n+(x-sum(l))//min(l))

Buggy python submission (verdict: Runtime Error):
n, x = map(int, input().split())
l = [int(i) for i in range(n)]
print(n+((x-sum(l))//min(l)))


Fixed submission:
n, x = map(int, input().split())
l = [int(input()) for _ in range(n)]
print(n+(x-sum(l))//min(l))
Buggy python submission (verdict: Runtime Error):
a, b, x = map(int, input().split())
s = set()
for i in [j for j in range(a, min(b + 1, a + x))] :
  print(i)
  s.add(i)
for i in [j for j in range(max(a, b - x + 1), b + 1)] :
  if i not in s:
    print(i)


Fixed submission:
print(["No","Yes"]["".join(sorted(input()))=="abc"])

Buggy python submission (verdict: Runtime Error):
print(["No","Yes"][input().sort()=="abc"])

Fixed submission:
print(["No","Yes"]["".join(sorted(input()))=="abc"])
Buggy python submission (verdict: Runtime Error):
from collections import defaultdict
d = defaultdict(int)
for _ in range(int(input())):
    d[input()] += 1
for _ in range(int(input())):
    d[input()] -= 1
print(max(d.values(),0))

Fixed submission:

from collections import defaultdict
d = defaultdict(int)
for _ in range(int(input())):
    d[input()] += 1
for _ in range(int(input())):
    d[input()] -= 1
print(max(max(d.values()),0))
Buggy python submission (verdict: Runtime Error):
a,b=map(input().split());print(len([1 for i in range(a,b+1) if i//1000==i%100]))


Fixed submission:
a,b=map(int,input().split());print(len([1 for i in range(a,b+1)if i//1000==i%10*10+i%100//10]))

Buggy python submission (verdict: Runtime Error):
a,b=map(input().split());print(len([1 for i in range(a,b+1)if i//1000==i%100]))

Fixed submission:
a,b=map(int,input().split());print(len([1 for i in range(a,b+1)if i//1000==i%10*10+i%100//10]))
Buggy python submission (verdict: Runtime Error):
n, a = [int(input()) for _ range(2)]
print("Yes" if (n%500)<=a else "No")

Fixed submission:
n, a = [int(input()) for _ in range(2)]
print("Yes" if n%500<=a else "No")

Buggy python submission (verdict: Runtime Error):
n, a = [int(input()) for _ range(2)]
print("Yes"if n%500<=a else"No")

Fixed submission:
n, a = [int(input()) for _ in range(2)]
print("Yes" if n%500<=a else "No")
Buggy python submission (verdict: Runtime Error):
input();
al=[int(i) for i in input().split()]
al.sort()[::-1]
print(sum(al[::2])-sum(al[1::2]))

Fixed submission:
input();
al=[int(i) for i in input().split()]
al.sort()
al = al[::-1]
print(sum(al[::2])-sum(al[1::2]))
Buggy python submission (verdict: Runtime Error):
print((lambda x: int((int(x[0]) + int(x[1])) / 2 + 0.999999999999999999999999999999))(input().split())print((lambda x: int(0.999999999999 + ((int(x[0]) + int(x[1])) / 2)))(input().split()))

Fixed submission:
print((lambda x: int(0.999999999999 + ((int(x[0]) + int(x[1])) / 2)))(input().split()))
Buggy python submission (verdict: Runtime Error):
from collections import defaultdict

n, k = map(int, input().split())
al = [int(i) for i in input().split()]

# dictionary で種類と数値をとっておく
d = defaultdict(int)
for a in al:
  d[a] += 1

# 種類が少ないものから色を変えていくと最小の変えなければいけないボールの数がわかる
ans = 0
if d.keys() > k:
  # 色を塗り替えないといけないので数えなければ…
  v = d.values()
  v.sort()
  ans = sum(v[:d.keys() - k])
print(ans)

Fixed submission:
from collections import defaultdict

n, k = map(int, input().split())
al = [int(i) for i in input().split()]

# dictionary で種類と数値をとっておく
d = defaultdict(int)
for a in al:
  d[a] += 1

# 種類が少ないものから色を変えていくと最小の変えなければいけないボールの数がわかる
ans = 0
if len(d.keys()) > k:
  # 色を塗り替えないといけないので数えなければ…
  v = list(d.values())
  v.sort()
  ans = sum(v[:len(d.keys()) - k])
print(ans)

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

n, k = map(int, input().split())
al = [int(i) for i in range(n)]

# dictionary で種類と数値をとっておく
d = defaultdict(int)
for a in al:
  d[a] += 1

# 種類が少ないものから色を変えていくと最小の変えなければいけないボールの数がわかる
ans = 0
if d.keys() > k:
  # 色を塗り替えないといけないので数えなければ…
  v = d.values()
  v.sort()
  ans = sum(v[:d.keys() - k])
print(ans)

Fixed submission:
from collections import defaultdict

n, k = map(int, input().split())
al = [int(i) for i in input().split()]

# dictionary で種類と数値をとっておく
d = defaultdict(int)
for a in al:
  d[a] += 1

# 種類が少ないものから色を変えていくと最小の変えなければいけないボールの数がわかる
ans = 0
if len(d.keys()) > k:
  # 色を塗り替えないといけないので数えなければ…
  v = list(d.values())
  v.sort()
  ans = sum(v[:len(d.keys()) - k])
print(ans)
Buggy python submission (verdict: Runtime Error):
#!/usr/bin/env python
# -*- coding: utf-8 -*-

def solve():
    n, c = map(int, input().split())
    c_info = [[int(i) for i in input().split()] for _ in range(n)]
    c_info.sort(key=lambda x: (x[2], x[0]))
    info = []
    cnt = 0
    while cnt < n:
        if cnt == n - 1:
            info.append(c_info[cnt])
            break
        if c_info[cnt][1] == c_info[cnt + 1][0] and c_info[cnt][2] == c_info[cnt + 1][2]:
            tc = c_info[cnt][2]
            t = [c_info[cnt][0], c_info[cnt + 1][1], tc]
            cnt += 1
            while cnt < n - 1 and t[1] == c_info[cnt + 1][0] and tc == c_info[cnt + 1][2]:
                t = [t[1], c_info[cnt + 1][1], tc]
                cnt += 1
            info.append(t)
            if cnt == n - 1:
                break
        else:
            info.append(c_info[cnt])
        cnt += 1

    tarr = [0] * (1 + 10 ** 5)
    for elem in info:
       tarr[elem[0]] += 1
       tarr[elem[1] + 1] -= 1
    
    ans = 1
    tans = 0
    for elem in tarr:
        tans += elem
        ans = max(ans, tans)
    print(ans)

if __name__=="__main__":
    solve()


Fixed submission:
#!/usr/bin/env python
# -*- coding: utf-8 -*-

def solve():
    n, c = map(int, input().split())
    c_info = [[int(i) for i in input().split()] for _ in range(n)]
    c_info.sort(key=lambda x: (x[2], x[0]))
    info = []
    cnt = 0
    
    while cnt < n:
        if cnt == n - 1:
            info.append(c_info[cnt])
            break
        if c_info[cnt][1] == c_info[cnt + 1][0] and c_info[cnt][2] == c_info[cnt + 1][2]:
            tc = c_info[cnt][2]
            t = [c_info[cnt][0], c_info[cnt + 1][1], tc]
            cnt += 1
            while cnt < n - 1 and t[1] == c_info[cnt + 1][0] and tc == c_info[cnt + 1][2]:
                t = [t[0], c_info[cnt + 1][1], tc]
                cnt += 1
            info.append(t)
            if cnt == n - 1:
                break
        else:
            info.append(c_info[cnt])
        cnt += 1

    tarr = [0] * (2 + 10 ** 5)
    for elem in info:
       tarr[elem[0]] += 1
       tarr[elem[1] + 1] -= 1
    
    ans = 1
    tans = 0
    for elem in tarr:
        tans += elem
        ans = max(ans, tans)
    print(ans)

if __name__=="__main__":
    solve()
Buggy python submission (verdict: Runtime Error):
print(max([i*i for i in range(10001) if int(input())>=i]))

Fixed submission:
print((lambda x:max([i*i for i in range(100001) if x>=i*i]))(int(input())))
Buggy python submission (verdict: Runtime Error):
n,g=map(int,input().split())
print(2*(n-g))

Fixed submission:
i,p=int,input
print(-i(p())+2*i(p()))
Buggy python submission (verdict: Runtime Error):
from collections import Counter

def solve():
    h, w = map(int, input().split())
    wd = dict(Counter(list("".join([input() for _ in range(h)]))))

    g1 = (w % 2) & (h % 2)
    g2 = (w % 2) * h//2 + (h % 2) * w//2
    g4 = h//2 * w//2
    
    for k in wd.keys():
        if (g1 > 0) and v % 4 == 1 or v % 4 == 3:
            g1 -= 1
            wd[k] -= 1
        while (g4 > 0) and v >= 4:
            g4 -= 1
            wd[k] -= 4
        while (g2 > 0) and v >= 2:
            g2 -= 1
            wd[k] -= 2
            
    print("No" if sum(wd.values()) else "Yes")
    
if __name__=="__main__":
    solve()


Fixed submission:
from collections import Counter
from math import floor

def solve():
    h, w = map(int, input().split())
    word_dict = dict(Counter(list("".join([input() for _ in range(h)]))))

    g1 = (w % 2) & (h % 2)
    g2 = floor((w % 2) * h/2) + floor((h % 2) * w/2)
    g4 = floor(h/2) * floor(w/2)
    
    for k, v in word_dict.items():
        if g1 == 0:
            break
        if v % 4 == 1 or v % 4 == 3:
            g1 -= 1
            word_dict[k] -= 1
            v -= 1
            
    for k, v in word_dict.items():
        if g4 == 0:
            break
        while v >= 4:
            g4 -= 1
            word_dict[k] -= 4
            v -= 4

    for k, v in word_dict.items():
        if g2 == 0:
            break
        while v >= 2:
            g2 -= 1
            word_dict[k] -= 2
            v -= 2
            
    print("No" if [1 for v in word_dict.values() if v != 0] else "Yes")
    
if __name__=="__main__":
    solve()
Buggy python submission (verdict: Runtime Error):
p=input;p();k=p();print(sum([2*min(int(i),abs(k-int(i)))for i in p().split()]))

Fixed submission:
p=input;p();k=int(p());print(sum([2*min(i,abs(k-i))for i in map(int,p().split())]))
Buggy python submission (verdict: Runtime Error):
print("YNeos"["9"not in input()::2])
print("Yes"if"9"in input()else"No")

Fixed submission:
print("Yes" if input().count("9") > 0 else "No")
Buggy python submission (verdict: Runtime Error):
print(sum([(lambda x:b+1-a)(map(int,input().split())for _ in  int(input())]))

Fixed submission:
ans = 0
for i in range(int(input())):
  a, b = map(int, input().split())
  ans += b + 1 - a
print(ans)
Buggy python submission (verdict: Runtime Error):
print(("None" if not x else x[0])(sorted(set(chr(97+i) for i in range(26))-set(input())))

Fixed submission:
print((lambda x:"None" if not x else sorted(list(x))[0])(set([chr(i) for i in range(97,97+26)])-set(list(input()))))

Buggy python submission (verdict: Runtime Error):
print((lambda x:"None" if not x else x[0])(sorted(set([chr(97+i) for i in range(26)]-list(input()))))))

Fixed submission:
print((lambda x:"None" if not x else sorted(list(x))[0])(set([chr(i) for i in range(97,97+26)])-set(list(input()))))
Buggy python submission (verdict: Time Limit Exceeded):
n = input()
t = [int(i) for i in input().split()]
ans = []
for i in t:
  if i in ans:
    continue
  c = t.count(i)
  if c >= 2:
    if c >= 4:
      ans.extend([i,i])
    else:
      ans.append(i)
ans.sort()
if len(ans) < 2:
  print(0)
else:
  print(ans[-1]*ans[-2])


Fixed submission:
from collections import defaultdict

input()
t = defaultdict(lambda: 0)
for e in [int(i) for i in input().split()]:
  t[e] += 1
ans = []
for k, v in t.items():
  if v >= 2:
    if v >= 4:
      ans.extend([k, k])
    else:
      ans.append(k)
ans.sort()
if len(ans) < 2:
  print(0)
else:
  print(ans[-1]*ans[-2])

Buggy python submission (verdict: Time Limit Exceeded):
n = input()
t = [int(i) for i in input().split()]
ans = []
for i in t:
  if i in ans:
    continue
  c = t.count(i)
  if c >= 2:
    if c >= 4:
      ans.extend([i,i])
    else:
      ans.append(i)
ans.sort()
if len(ans) < 2:
  print(0)
else:
  print(ans[-1]*ans[-2])

Fixed submission:
from collections import defaultdict

input()
t = defaultdict(lambda: 0)
for e in [int(i) for i in input().split()]:
  t[e] += 1
ans = []
for k, v in t.items():
  if v >= 2:
    if v >= 4:
      ans.extend([k, k])
    else:
      ans.append(k)
ans.sort()
if len(ans) < 2:
  print(0)
else:
  print(ans[-1]*ans[-2])
Buggy python submission (verdict: Runtime Error):
def solve():
    n = int(input())
    pattern = [[a, b] for a, b in zip(list(input()), list(input()))]
    pointer, ans = 0, 0
    if pattern[0][0] == pattern[0][1]:
        ans = 3
    else:
        ans = 6
    while pointer < n - 1:
        current = pattern[pointer][0]
        if current == pattern[pointer][1]:
            if pattern[pointer+1][0] == pattern[pointer+1][1]:
                ans *= 2
                # print("X->X")
            else:
                ans *= 2
                # print("X->Y")
            pointer += 1
        else:
            if pattern[pointer+2][0] == pattern[pointer+2][1]:
                ans *= 1
                # print("Y->X")
            else:
                ans *= 3
                # print("Y->Y")
            pointer += 2
    print(ans % 1000000007)

if __name__=="__main__":
    solve()


Fixed submission:
def solve():
    n = int(input())
    pattern = [[a, b] for a, b in zip(list(input()), list(input()))]
    pointer, ans = 0, 0
    if pattern[0][0] == pattern[0][1]:
        ans = 3
    else:
        ans = 6
    while pointer < n - 1:
        current = pattern[pointer][0]
        if current == pattern[pointer][1]:
            if pattern[pointer+1][0] == pattern[pointer+1][1]:
                ans *= 2
                # print("X->X")
            else:
                ans *= 2
                # print("X->Y")
            pointer += 1
        else:
            if pointer + 2 >= n - 1:
                break
            if pattern[pointer+2][0] == pattern[pointer+2][1]:
                ans *= 1
                # print("Y->X")
            else:
                ans *= 3
                # print("Y->Y")
            pointer += 2
    print(ans % 1000000007)

if __name__=="__main__":
    solve()
Buggy python submission (verdict: Runtime Error):
from collections import defaultdict

d = defaultdict([0])
goal, n = map(int, input().split())
for _ in range(n):
  f, t = map(int, input().split())
  d[f].append(t)
  d[t].append(f)
for current in d[1]:
  if goal in d[current]:
    print("POSSIBLE")
    break
else:
  print("IMPOSSIBLE")

Fixed submission:
from collections import defaultdict

d = defaultdict(list)
goal, n = map(int, input().split())
for _ in range(n):
  f, t = map(int, input().split())
  d[f].append(t)
  d[t].append(f)
for current in d[1]:
  if goal in d[current]:
    print("POSSIBLE")
    break
else:
  print("IMPOSSIBLE")

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

d = defaultdict([])
goal, n = map(int, input().split())
for _ in range(n):
  f, t = map(int, input().split())
  d[f].append(t)
  d[t].append(f)
for current in d[1]:
  if goal in d[current]:
    print("POSSIBLE")
    break
else:
  print("IMPOSSIBLE")

Fixed submission:
from collections import defaultdict

d = defaultdict(list)
goal, n = map(int, input().split())
for _ in range(n):
  f, t = map(int, input().split())
  d[f].append(t)
  d[t].append(f)
for current in d[1]:
  if goal in d[current]:
    print("POSSIBLE")
    break
else:
  print("IMPOSSIBLE")

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

d = defaultdict([])
goal, n = map(int, input().split())
for _ in range(n):
  from, to = map(int, input().split())
  d[from].append(to)
  d[to].append(from)
for current in d[1]:
  if goal in d[current]:
    print("POSSIBLE")
    break
else:
  print("IMPOSSIBLE")

Fixed submission:
from collections import defaultdict

d = defaultdict(list)
goal, n = map(int, input().split())
for _ in range(n):
  f, t = map(int, input().split())
  d[f].append(t)
  d[t].append(f)
for current in d[1]:
  if goal in d[current]:
    print("POSSIBLE")
    break
else:
  print("IMPOSSIBLE")

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

d = defaultdict([])
goal, n = map(int,  input().split())
for _ in range(n):
  from, to = map(int, input().split())
  d[from].append[to]
  d[to].append[from]
for current in d[1]:
  if goal in d[current]:
    print("POSSIBLE")
    break
else:
  print("IMPOSSIBLE")

Fixed submission:
from collections import defaultdict

d = defaultdict(list)
goal, n = map(int, input().split())
for _ in range(n):
  f, t = map(int, input().split())
  d[f].append(t)
  d[t].append(f)
for current in d[1]:
  if goal in d[current]:
    print("POSSIBLE")
    break
else:
  print("IMPOSSIBLE")
Buggy python submission (verdict: Runtime Error):
a,b,c=map(int,input().split())
print(min(a+b, b+c, c+a)

Fixed submission:
a,b,c=map(int,input().split())
print(min(a+b, b+c, c+a))
Buggy python submission (verdict: Runtime Error):
n = int(input())
lst = [int(input()) for _ in[0]*n]
visit = set()
current = 0
while True:
  visit.add(current)
  current = lst[current]
  if current == 2:
    print(len(visit) + 1)
    break
  if current in visit:
    print(-1)
    break
  

Fixed submission:
def solve():
    n = int(input())
    lst = [int(input())-1 for _ in[0]*n]
    visit = set()
    current = 0
    while True:
        visit.add(current)
        current = lst[current]
        if current == 1:
            print(len(visit))
            break
        if current in visit:
            print(-1)
            break

if __name__=="__main__":
    solve()
Buggy python submission (verdict: Runtime Error):
n, m = map(int, input().split())
if -2 < (n - m) < 2:
  ans = 1
  for i in range(n):
    ans *= n
    ans %= 10_0000_0007
  for i in range(m):
    ans *= n
    ans %= 10_0000_0007
  print(ans)
else:
  print(0)

Fixed submission:
def solve():
    n, m = map(int, input().split())
    if -2 < (n - m) < 2:
        ans = 1
        for i in range(1, n+1):
            ans *= i
            ans %= 1000000007
        for i in range(1, m+1):
            ans *= i
            ans %= 1000000007
        if n != m:
            print(ans)
        else:
            print(((ans) * 2) % 1000000007)
    else:
        print(0)


if __name__=="__main__":
    solve()

Buggy python submission (verdict: Runtime Error):
n, m = map(int, input().split())
if -2 < (n -m) < 2:
  ans = 1
  for i in range(n):
    ans *= n
    ans %= 10_0000_0007
  for i in range(m):
    ans *= n
    ans %= 10_0000_0007
  print(ans)
else:
  print(0)

Fixed submission:
def solve():
    n, m = map(int, input().split())
    if -2 < (n - m) < 2:
        ans = 1
        for i in range(1, n+1):
            ans *= i
            ans %= 1000000007
        for i in range(1, m+1):
            ans *= i
            ans %= 1000000007
        if n != m:
            print(ans)
        else:
            print(((ans) * 2) % 1000000007)
    else:
        print(0)


if __name__=="__main__":
    solve()