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

Fixed submission:
import math,string,itertools,fractions,heapq,collections,re,array,bisect,sys,random,time, copy

sys.setrecursionlimit(10**7)
inf = 10**20
mod = 10**9 + 7

stdin = sys.stdin

ni = lambda: int(ns())
na = lambda: list(map(int, stdin.readline().split()))
ns = lambda: stdin.readline().rstrip()  # ignore trailing spaces

h, w = na()
m = []
m = [ns() for _ in range(h)]
dp = [[inf] * w for _ in range(h)]
dp[0][0] = int(m[0][0] == '#')
for x in range(1, w):
    dp[0][x] = dp[0][x-1] + (int(m[0][x]=="#") if m[0][x-1]=="." else 0)
for y in range(1, h):
    dp[y][0] = dp[y-1][0] + (int(m[y][0]=="#") if m[y-1][0]=="." else 0)
    for x in range(1, w):
        dp[y][x] = min(
            dp[y][x-1] + (int(m[y][x]=="#") if m[y][x-1]=="." else 0),
            dp[y-1][x] + (int(m[y][x]=="#") if m[y-1][x]=="." else 0)
        )
print(dp[-1][-1])

Buggy submission (verdict: Runtime Error):
import math,string,itertools,fractions,heapq,collections,re,array,bisect,sys,random,time, copy

sys.setrecursionlimit(10**7)
inf = 10**20
mod = 10**9 + 7

stdin = sys.stdin

ni = lambda: int(ns())
na = lambda: list(map(int, stdin.readline().split()))
ns = lambda: stdin.readline().rstrip()  # ignore trailing spaces

h, w = na()
m = []
m = [ns() for _ in range(h)]
dp = [[inf] * w for _ in range(h)]
dp[0][0] = int(m[0][0] == '#')
for x in range(1, w):
    dp[0][x] = dp[0][x-1] + (int(m[0][x]=="#") if m[0][x-1]=="." else 0)
for y in range(1, h):
    dp[y][0] = dp[y-1][0] + (int(S[y][0]=="#") if S[y-1][0]=="." else 0)
    for x in range(1, W):
        dp[y][x] = min(
            dp[y][x-1] + (int(S[y][x]=="#") if S[y][x-1]=="." else 0),
            dp[y-1][x] + (int(S[y][x]=="#") if S[y-1][x]=="." else 0)
        )
print(dp[-1][-1])
Problem p02819 (python)

Fixed submission:
import sys
import bisect
import math
stdin = sys.stdin

ni = lambda: int(ns())
na = lambda: list(map(int, stdin.readline().split()))
ns = lambda: stdin.readline().rstrip()  # ignore trailing spaces

def get_primenumber(number):
    prime_list = []
    #2からnumberまでの数字をsearch_listに入れる
    search_list = list(range(2,number+1))
    while True:
      #search_listの先頭の値が√nの値を超えたら処理終了
      if search_list[0] > math.sqrt(number):
        #prime_listにsearch_listを結合
        prime_list.extend(search_list)
        break
      else:
        #search_listの先頭をprime_listに入れる
        head_num = search_list[0]
        prime_list.append(head_num)
        #search_listの先頭をpopする
        search_list.pop(0)
        #head_numの倍数を取り除く
        search_list = [num for num in search_list if num % head_num != 0]
    return prime_list


X = ni()
l = get_primenumber(10 ** 5 +10)
idx = bisect.bisect_left(l, X)
print(l[idx])

Buggy submission (verdict: Runtime Error):
import sys
import bisect
import math
stdin = sys.stdin

ni = lambda: int(ns())
na = lambda: list(map(int, stdin.readline().split()))
ns = lambda: stdin.readline().rstrip()  # ignore trailing spaces

def get_primenumber(number):
    prime_list = []
    #2からnumberまでの数字をsearch_listに入れる
    search_list = list(range(2,number+1))
    while True:
      #search_listの先頭の値が√nの値を超えたら処理終了
      if search_list[0] > math.sqrt(number):
        #prime_listにsearch_listを結合
        prime_list.extend(search_list)
        break
      else:
        #search_listの先頭をprime_listに入れる
        head_num = search_list[0]
        prime_list.append(head_num)
        #search_listの先頭をpopする
        search_list.pop(0)
        #head_numの倍数を取り除く
        search_list = [num for num in search_list if num % head_num != 0]
    return prime_list


X = ni()
l = get_primenumber(10 ** 5)
idx = bisect.bisect_left(l, X)
print(l[idx])
Problem p02862 (python)

Fixed submission:
import sys
import itertools
import bisect
import math

stdin = sys.stdin

ni = lambda: int(ns())
na = lambda: list(map(int, stdin.readline().split()))
ns = lambda: stdin.readline().rstrip()  # ignore trailing spaces

def cmb(n, r, mod):
    if ( r<0 or r>n ):
        return 0
    r = min(r, n-r)
    return g1[n] * g2[r] * g2[n-r] % mod

mod = 10**9+7 #出力の制限
N = 10**6
g1 = [1, 1] # 元テーブル
g2 = [1, 1] #逆元テーブル
inverse = [0, 1] #逆元テーブル計算用テーブル

for i in range( 2, N + 1 ):
    g1.append( ( g1[-1] * i ) % mod )
    inverse.append( ( -inverse[mod % i] * (mod//i) ) % mod )
    g2.append( (g2[-1] * inverse[-1]) % mod )


mod = 10 ** 9 + 7
x, y = na()
if (x + y) % 3 != 0:
    print(0)
else:
    n = ((x + y) // 3 + (y - x)) // 2
    m = y - (2 * n)
    if n < 0 or m < 0:
        print(0)
    else:
        print(cmb(n+m, n, mod))

Buggy submission (verdict: Runtime Error):
import sys
import itertools
import bisect
import math
stdin = sys.stdin

ni = lambda: int(ns())
na = lambda: list(map(int, stdin.readline().split()))
ns = lambda: stdin.readline().rstrip()  # ignore trailing spaces

mod = 10 ** 9 + 7
x, y = na()
dp = [[0 for i in range(x+1)] for j in range(y+1)]
dp[0][0] = 1
for i in range(x+1):
    for j in range(y+1):
        if i >=1 and j >= 2:
            dp[i][j] += dp[i-1][j-2]
        if i >= 2 and j >= 1:
            dp[i][j] += dp[i-2][j-1]
        dp[i][j] %= mod
print(dp[x][y])
Problem p03013 (python)

Fixed submission:
import sys

stdin = sys.stdin

ni = lambda: int(ns())
na = lambda: list(map(int, stdin.readline().split()))
ns = lambda: stdin.readline().rstrip()  # ignore trailing spaces

mm = 1000000007
n, m = na()
ai = [-1]
for i in range(m):
    ai.append(int(input()))
ai.append(n+1)
li = [1, 1]
for i in range(n+4):
    li.append(li[i] + li[i+1])
ans = 1
#print(li)
if m == 0:
    print(li[n] % mm)
else:
    for i in range(len(ai) - 1):
        if ai[i+1] - ai[i] == 1:
            ans = 0
            break
        else:
            ans *= li[(ai[i+1] - ai[i]) - 2]
            ans = ans % mm
    print(ans)

Buggy submission (verdict: Runtime Error):
import sys

stdin = sys.stdin

ni = lambda: int(ns())
na = lambda: list(map(int, stdin.readline().split()))
ns = lambda: stdin.readline().rstrip()  # ignore trailing spaces

mm = 1000000007
n, m = na()
ai = [-1]
for i in range(m):
    ai.append(int(input()))
ai.append(n+1)
li = [1, 1]
for i in range(n-2):
    li.append(li[i] + li[i+1])
ans = 1
for i in range(len(ai) - 1):
    if ai[i+1] - ai[i] == 1:
        ans = 0
    else:
        ans *= li[(ai[i+1] - ai[i]) - 2]
        ans = ans % mm
print(ans)
Problem p03075 (python)

Fixed submission:
import sys

stdin = sys.stdin

ni = lambda: int(ns())
na = lambda: list(map(int, stdin.readline().split()))
ns = lambda: stdin.readline().rstrip()  # ignore trailing spaces

li = []
for i in range(5):
    li.append(int(input()))
k = int(input())
for i in range(5):
    li
if max(li)-min(li) <= k:
    print('Yay!')
else:
    print(":(")

Buggy submission (verdict: Runtime Error):
import sys

stdin = sys.stdin

ni = lambda: int(ns())
na = lambda: list(map(int, stdin.readline().split()))
ns = lambda: stdin.readline().rstrip()  # ignore trailing spaces

ab = []
res = []
x, y, z, k = na()
a_li = na()
b_li = na()
c_li = na()
for a in a_li:
    for b in b_li:
        ab.append((a * b))
list.sort(ab, reverse=True)
list.sort(c_li, reverse=True)
for a_b in ab:
    for c in c_li:
        res.append(a_b * c)
for num in sorted(res,reverse=True)[-k:]:
    print(num)
Problem p03077 (python)

Fixed submission:
import sys

stdin = sys.stdin

ni = lambda: int(ns())
na = lambda: list(map(int, stdin.readline().split()))
ns = lambda: stdin.readline().rstrip()  # ignore trailing spaces


li = []
n = int(input())
for i in range(5):
    li.append(int(input()))
if n <= min(li):
    print(5)
else:
    if n % min(li) == 0:
        print(5 + n // min(li) -1)
    else:
        print(5 + n // min(li))

Buggy submission (verdict: Runtime Error):
import sys

stdin = sys.stdin

ni = lambda: int(ns())
na = lambda: list(map(int, stdin.readline().split()))
ns = lambda: stdin.readline().rstrip()  # ignore trailing spaces


li = []
n = int(input())
for i in range(5):
    li.append(int(input()))
if n == min(i):
    print(5)
else:
    print(5 + n // min(li))
Problem p03137 (python)

Fixed submission:
import sys

stdin = sys.stdin

ni = lambda: int(ns())
na = lambda: list(map(int, stdin.readline().split()))
ns = lambda: stdin.readline().rstrip()  # ignore trailing spaces

n, m = na()
li = na()
ls = []
list.sort(li)
for i in range(len(li) - 1):
    ls.append(li[i + 1] - li[i])
ls = sorted(ls, reverse=True)
print(sum(ls[n-1:]))

Buggy submission (verdict: Runtime Error):
import sys

stdin = sys.stdin

ni = lambda: int(ns())
na = lambda: list(map(int, stdin.readline().split()))
ns = lambda: stdin.readline().rstrip()  # ignore trailing spaces

n, m = na()
li = na()
list.sort(li)
ls = []
for i in range(len(li)-1):
    ls.append(li[i+1]-li[i])
for j in range(n - 1):
    ls.remove(max(ls))
print(sum(ls))
Problem p03209 (python)

Fixed submission:
import sys
from collections import deque
stdin = sys.stdin

ni = lambda: int(ns())
na = lambda: list(map(int, stdin.readline().split()))
ns = lambda: stdin.readline().rstrip()  # ignore trailing spaces

n, x = na()
a = [1]
p = [1]
for i in range(n):
    a.append(a[i] * 2 + 3)
    p.append(p[i] * 2 + 1)

def f(n, x):
    if n == 0:
        return 0 if x <= 0 else 1
    elif x <= 1 + a[n-1]:
        return f(n-1, x-1)
    else:
        return p[n-1] + 1 + f(n-1, x-2-a[n-1])

print(f(n,x))

Buggy submission (verdict: Runtime Error):
import sys
from collections import deque
stdin = sys.stdin

ni = lambda: int(ns())
na = lambda: list(map(int, stdin.readline().split()))
ns = lambda: stdin.readline().rstrip()  # ignore trailing spaces

n, x = na()
bg = "P"
an = 2 ** (n+2) - 3
bn = 2 ** (n+1) - 1
if an > x:
    print(bn)
else:
    for i in range(n - 1):
        bg = "B" + bg + "P" + bg + "B"
        if len(bg) > x:
            bg = bg[:x]
    print(bg[:x].count("P"))

Buggy submission (verdict: Runtime Error):
import sys
from collections import deque
stdin = sys.stdin

ni = lambda: int(ns())
na = lambda: list(map(int, stdin.readline().split()))
ns = lambda: stdin.readline().rstrip()  # ignore trailing spaces

n, x = na()
bg = "BPPPB"
for i in range(n-1):
    bg = "B" + bg + "P" + bg + "B"
    if len(bg) > x:
        bg = bg[:x]
print(bg[:x].count("P"))
Problem p03775 (python)

Fixed submission:
import sys
import copy
import string
import  math
from _bisect import *
from collections import *
from operator import itemgetter
from math import factorial
"""
from fractions import gcd
def lcm(x, y):
    return (x * y) // gcd(x, y)
"""
stdin = sys.stdin
ni = lambda: int(ns())
na = lambda: list(map(int, stdin.readline().split()))
ns = lambda: stdin.readline()

def make_divisors(n):
    divisors = []
    for i in range(1, int(n**0.5)+1):
        if n % i == 0:
            divisors.append(i)
            if i != n // i:
                divisors.append(n//i)

    divisors.sort()
    return divisors

n = ni()
li = make_divisors(n)
ans = 10000000000000000
for i in range(len(li) // 2):
    if li[i] * li[-(i+1)] == n:
        f = max(len(str(li[i])), len(str(li[-(i+1)])))
        ans = min(f, ans)
if len(li) % 2 != 0:
    if len(li) == 1:
        ans = 1
    else:
        print()
        ans = min(len(str(li[len(li)//2])), ans)
print(ans)

Buggy submission (verdict: Runtime Error):
import sys
import copy
import string
import  math
from _bisect import *
from collections import *
from operator import itemgetter
from math import factorial
"""
from fractions import gcd
def lcm(x, y):
    return (x * y) // gcd(x, y)
"""
stdin = sys.stdin
ni = lambda: int(ns())
na = lambda: list(map(int, stdin.readline().split()))
ns = lambda: stdin.readline()

def make_divisors(n):
    divisors = []
    for i in range(1, int(n**0.5)+1):
        if n % i == 0:
            divisors.append(i)
            if i != n // i:
                divisors.append(n//i)

    divisors.sort()
    return divisors

li = make_divisors(ni())
ans = 10000000000000000
for i in range(len(li) // 2):
    f = max(len(str(li[i])), len(str(li[-(i+1)])))
    ans = min(f, ans)
if len(li) % 2 != 0:
    if len(li) == 1
        ans = 1
    else:
        ans = min(len(str(li[len(li)//2 + 1])), ans)
print(ans)

Buggy submission (verdict: Runtime Error):
import sys
import copy
import string
import  math
from _bisect import *
from collections import *
from operator import itemgetter
from math import factorial
"""
from fractions import gcd
def lcm(x, y):
    return (x * y) // gcd(x, y)
"""
stdin = sys.stdin
ni = lambda: int(ns())
na = lambda: list(map(int, stdin.readline().split()))
ns = lambda: stdin.readline()

def make_divisors(n):
    divisors = []
    for i in range(1, int(n**0.5)+1):
        if n % i == 0:
            divisors.append(i)
            if i != n // i:
                divisors.append(n//i)

    divisors.sort()
    return divisors

li = make_divisors(ni())
ans = 10000000000000000
for i in range(len(li) // 2):
    f = max(len(str(li[i])), len(str(li[-(i+1)])))
    ans = min(f, ans)
if len(li) % 2 != 0:
    ans = min(len(str(li[len(li)//2 + 1])), ans)
print(ans)
Problem p03834 (python)

Fixed submission:
import sys
import copy
import string
from _bisect import *
from collections import *
from operator import itemgetter
from math import factorial
"""
from fractions import gcd
def lcm(x, y):
    return (x * y) // gcd(x, y)
"""
stdin = sys.stdin
ni = lambda: int(ns())
na = lambda: list(map(int, stdin.readline().split()))
ns = lambda: stdin.readline()

li = input().split(",")
print(*li)

Buggy submission (verdict: Runtime Error):
k, s = list(map(int, input().split()))
ct = 0
for x in range(k+1):
    for y in range(k+1):
        z = s - x - y
        if 0 <= z <= k:
            ct += 1
print(ct)

Buggy submission (verdict: Runtime Error):
k, s = list(map(int, input().split()))
ct = 0
for x in range(k+1):
    for y in range(x, k+1):
        if x + y > s:
            break;
        for z in range(y, k+1):
            if x + y + z == s:
                if x == y and y == z:
                    ct += 1
                elif x != y and y != z:
                    ct += 6
                else:
                    ct += 3
                break;
print(ct)

Buggy submission (verdict: Runtime Error):
k, s = list(map(int, input().split()))
ct = 0
for x in range(k+1):
    for y in range(k+1):
        for z in range(k+1):
            if x + y + z == s:
                ct += 1
                break;
print(ct)
Problem p03835 (python)

Fixed submission:
k, s = list(map(int, input().split()))
ct = 0
for x in range(k+1):
    for y in range(k+1):
        z = s - x - y
        if 0 <= z <= k:
            ct += 1
print(ct)

Buggy submission (verdict: Runtime Error):
import sys
import copy
import string
from _bisect import *
from collections import *
from operator import itemgetter
from math import factorial
"""
from fractions import gcd
def lcm(x, y):
    return (x * y) // gcd(x, y)
"""
stdin = sys.stdin
ni = lambda: int(ns())
na = lambda: list(map(int, stdin.readline().split()))
ns = lambda: stdin.readline()

k, s = na()
ct = 0
for x in range(k+1):
    for y in range(k+1):
        z = s - x - y
        if 0 <= z <= k:
            ct += 1
print(ct)
Problem p02753 (python)

Fixed submission:
# -*- coding: utf-8 -*-
S = (input())
# 出力
# 奇数を取得
if(S[0] == S[1] == S[2]):
    print('No')
else:
    print('Yes')

Buggy submission (verdict: Runtime Error):
# -*- coding: utf-8 -*-
S = (input())
# 出力
# 奇数を取得
if(S[0] == s[1] == s[2]):
    print('No')
else:
    print('Yes')
Problem p02948 (python)

Fixed submission:
# -*- coding: utf-8 -*-
import numpy as np
from collections import deque
from collections import defaultdict
import heapq
import collections
import itertools
import bisect


mod = 10 ** 9 + 7
N, M = list(map(int, input().split()))
A = [0]*N
B = [0]*N
# 日数別にもらえる額を管理
# money = defaultdict(list)
keys = list(range(1, 1+10**5))
# print(keys)
values = [[] for i in range(1, 1+10**5)]
job = dict(zip(keys, values))
for i in range(N):
    a, b = map(int, input().split())
    job[a].append(-b)
    # A[i], B[i] = a, b
# A日後にB円もらえる、M日後に報酬最大化
ans = 0
can_work = []
heapq.heapify(can_work)
for delay in range(1, 1+M):
    for item in job[delay]:
        heapq.heappush(can_work, item)
    # print('delay', delay)
    # print(job)
    if (len(can_work) != 0):
        ans -= heapq.heappop(can_work)

    # for i in range(delay):
    #     print(delay-i)
    #     if len(jpb[delay-i]) != 0:
    #         print('found')
    #         max_money = max(jpb[delay-i])
    #         ans += max_money
    #         jpb[delay-i].remove(max_money)
    #         jpb[delay-i]
    #         break
    #     print('===========')
print(ans)

Buggy submission (verdict: Runtime Error):
# -*- coding: utf-8 -*-
import numpy as np
from collections import deque
from collections import defaultdict
import heapq
import collections
import itertools
import bisect


mod = 10 ** 9 + 7
N, M = list(map(int, input().split()))
A = [0]*N
B = [0]*N
# 日数別にもらえる額を管理
# money = defaultdict(list)
keys = list(range(1, 10**5))
# print(keys)
values = [[] for i in range(1, 10**5)]
job = dict(zip(keys, values))
for i in range(N):
    a, b = map(int, input().split())
    job[a].append(b)
    # A[i], B[i] = a, b
# A日後にB円もらえる、M日後に報酬最大化
ans = 0
can_work = []
for delay in range(1, 1+M):
    can_work.extend(job[delay])
    # print('delay', delay)
    # print(job)
    if (len(can_work) != 0):
        max_money = max(can_work)
        ans += max_money
        can_work.remove(max_money)

    # for i in range(delay):
    #     print(delay-i)
    #     if len(jpb[delay-i]) != 0:
    #         print('found')
    #         max_money = max(jpb[delay-i])
    #         ans += max_money
    #         jpb[delay-i].remove(max_money)
    #         jpb[delay-i]
    #         break
    #     print('===========')
print(ans)
Problem p02989 (python)

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

Buggy submission (verdict: Runtime Error):
n=int(input())
d=sorted(list(map(int,input().split())))
print(d[n//2]-d[N//2-1])
Problem p02990 (python)

Fixed submission:
n,k=map(int,input().split())
c=[[0]*(n+1) for _ in range(n+1)]
for i in range(n+1):
  c[i][0]=1
mod=10**9+7
for i in range(1,n+1):
  for j in range(1,i+1):
    c[i][j]=c[i-1][j]+c[i-1][j-1]
for i in range(1,k+1):
  print(c[n-k+1][i]*c[k-1][i-1]%mod)

Buggy submission (verdict: Runtime Error):
n,k=map(int,input().split())
c=[[1 for _ in range(n)] for _ in range(n)]
mod=10**9+7
for i in range(1,n):
  for j in range(1,i):
    c[i][j]=c[i-1][j]+c[i-1][j-1]
for i in range(1,k+1):
  print(c[n-k+1][i]*c[k-1][i-1]%mod)
Problem p03075 (python)

Fixed submission:
x=[int(input()) for i in range(5)]
k=int(input())
print("Yay!" if max(x)-min(x)<=k else ":(")

Buggy submission (verdict: Runtime Error):
x=[int(input()) for i in range(5)]
print("Yay!" if max(x)-min(x)>=k else ":(")

Buggy submission (verdict: Runtime Error):
x=[input() for i in range(5)]
print("Yay!" if max(x)-min(x)>=k else ":(")
Problem p03137 (python)

Fixed submission:
n,m=map(int,input().split())
x=sorted([int(i) for i in input().split()])
if n>=m:
  print(0)
else:
  l=sorted([x[i+1]-x[i] for i in range(m-1)])
  print(sum(l[:m-n]))

Buggy submission (verdict: Runtime Error):
n,m=map(int,input().split())
x=sorted([int(i) for i in input().split()])
if n>=m:
  print(0)
else:
  l=sorted([x(i+1)-x(i) for i in range(m-1)])
  print(sum(l[:m-n]))
Problem p03272 (python)

Fixed submission:
a,b=map(int,input().split());print(a-b+1)

Buggy submission (verdict: Runtime Error):
print(int(input())-int(input())+1)
Problem p03286 (python)

Fixed submission:
N=int(input())
L=[]
M=""
while N!=0:
  M=int((-1)*(N%(-2)))
  if N<0:
    N=int((N-1)/(-2))
  else:
    N=int(N/(-2))
  L.insert(0,str(M))
if len(L)==0:
  L=["0"]
print("".join(L))

Buggy submission (verdict: Runtime Error):
N=int(input())
L=[]
M=""
while N!=0:
  M=int((-1)*(N%(-2)))
  if N<0:
    N=int((N-1)/(-2))
  else:
    N=int(N/(-2))
  L.insert(0,str(M))
if N=0:
  print(0)
else:
  print("".join(L))
Problem p03327 (python)

Fixed submission:
print("AB"+["D","C"][int(input())<1000])

Buggy submission (verdict: Runtime Error):
print("AB"+["D","C"][n<1000])
Problem p03634 (python)

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

def dfs(now_node,parent_node,dist):
  depth[now_node]=dist
  for next_node,w in graph[now_node]:
    if next_node==parent_node:
      continue
    dfs(next_node,now_node,dist+w)

n=int(input())
graph=[[] for _ in range(n+1)]
for _ in range(n-1):
  a,b,c=map(int,input().split())
  graph[a].append((b,c))
  graph[b].append((a,c))
  
q,k=map(int,input().split())
depth=[-1]*(n+1)
dfs(k,0,0)
for _ in range(q):
  x,y=map(int,input().split())
  print(depth[x]+depth[y])

Buggy submission (verdict: Runtime Error):
def dfs(now_node,parent_node,dist):
  depth[now_node]=dist
  for next_node,w in graph[now_node]:
    if next_node==parent_node:
      continue
    dfs(next_node,now_node,dist+w)

n=int(input())
graph=[[] for _ in range(n+1)]
for _ in range(n-1):
  a,b,c=map(int,input().split())
  graph[a].append((b,c))
  graph[b].append((a,c))
  
q,k=map(int,input().split())
depth=[-1]*(n+1)
dfs(k,0,0)
for _ in range(q):
  x,y=map(int,input().split())
  print(depth[x]+depth[y])
Problem p02987 (python)

Fixed submission:
s=list(input())

s.sort()
if s[0]==s[1] and s[2]==s[3] and s[1]!=s[2]:
  print("Yes")
else:
  print("No")

Buggy submission (verdict: Runtime Error):
t=list(input())

for i in range(1,4):
  s=t
  if s[0]==s[i]:
    z=s[0]
    s.pop(i)
    s.pop(0)
    if z!=s[0] and s[0]==s[1]:
      print("Yes")
      
print("No")

Buggy submission (verdict: Runtime Error):
t=list(input())

for i in range(1,4):
  s=t
  if s[0]==s[i]:
    z=s[0]
    s.pop(i)
    s.pop(0)
    if z=!s[0] and s[0]==s[1]:
      print("Yes")
      
print("No")
Problem p02623 (python)

Fixed submission:
import sys
import copy
from collections import deque
import collections
stdin = sys.stdin

mod = 10**9+7

ni = lambda: int(ns())
na = lambda: list(map(int, stdin.readline().split()))
ns = lambda: stdin.readline().rstrip()  # ignore trailing spaces

n, m, k = na()

a = na()
b = na()

num_books = 0
sum_time = 0
for i in a:
    if sum_time+i > k:
        break
    num_books += 1
    sum_time += i
# print(num_books)


res = num_books
ia = num_books - 1
ib = 0
if num_books==0 and b[ib] > k:
    print(0)
    exit(0)
while ib < len(b):
    if sum_time < k:
        sum_time += b[ib]
        ib += 1
        num_books += 1
    else:
        if ia == -1:
            break
        sum_time -= a[ia]
        ia -= 1
        num_books -= 1
    if sum_time <= k:
        res = max(res, num_books)

print(res)

Buggy submission (verdict: Runtime Error):
import sys
import copy
from collections import deque
import collections
stdin = sys.stdin

mod = 10**9+7

ni = lambda: int(ns())
na = lambda: list(map(int, stdin.readline().split()))
ns = lambda: stdin.readline().rstrip()  # ignore trailing spaces

n, m, k = na()

a = na()
b = na()

num_books = 0
sum_time = 0
for i in a:
    if sum_time+i > k:
        break
    num_books += 1
    sum_time += i
# print(num_books)


res = num_books
ia = num_books - 1
ib = 0
if num_books==0 and b[ib] > k:
    print(0)
    exit(0)
while ib < len(b):
    if sum_time < k:
        sum_time += b[ib]
        ib += 1
        num_books += 1
    else:
        sum_time -= a[ia]
        ia -= 1
        num_books -= 1
    if sum_time <= k:
        res = max(res, num_books)

print(res)
Problem p03250 (python)

Fixed submission:
a,b,c=sorted(map(int,input().split()))
print(10*c+a+b)

Buggy submission (verdict: Runtime Error):
a,b,c=sorted(map(int,input()))
print(10*c+a+b)
Problem p02572 (python)

Fixed submission:
import itertools
ans=0
n=int(input())
li=list(map(int,input().split()))
L=list(itertools.accumulate(li))
for i in range(1,n):
    ans+=L[i-1]*li[i]
print(ans%(10**9+7))

Buggy submission (verdict: Runtime Error):
import numpy as np
ans=0
n=int(input())
li=list(map(int,input().split()))
for i in range(1,n):
    L=li
    k=np.cumsum(L[:i])
    ans+=k*li[i]
print(ans%(10**9+7))
Problem p02831 (python)

Fixed submission:
import math
a,b=map(int,input().split())
def lcm(x, y):
    return (x * y) // math.gcd(x, y)

print(lcm(a, b))

Buggy submission (verdict: Runtime Error):
import math
a=int(input())
b=int(input())
def lcm(x, y):
    return (x * y) // math.gcd(x, y)

print(lcm(a, b))