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

Fixed submission:
def main():
    n = int(input())
    A = list(map(int, input().split()))
    A.sort(reverse=True)
    limit = 10 ** 18
    #print(A)

    if A[-1] == 0:
        print(0)
    elif A[0] > limit:
        print(-1)
    else:
        ans = A[0]
        for i in range(1, n):
            ans *= A[i]
            if ans > limit:
                print(-1)
                exit()

        print(ans)


if __name__ == "__main__":
    main()

Buggy submission (verdict: Runtime Error):
import numpy as np


def main():
    n = int(input())
    a = list(map(int, input().split()))
    a.sort(reverse=True)
    A = np.array(list(map(int, input().split())))
    limit = 10 ** 18

    if np.any(A == 0):
        print(0)
    elif np.any(A > limit):
        print(-1)
    else:
        ans = 1

        for i in range(n):
            ans *= A[i]
            if ans > limit:
                print(-1)
                exit()

        print(ans)


if __name__ == "__main__":
    main()

Buggy submission (verdict: Runtime Error):
import numpy as np
def main():
    n = int(input())
    A = np.array(list(map(int, input().split())))
    limit = 10 ** 18

    if np.any(A=0):
        print(0)
    else:
        ans = 1
        for i in range(n):
            ans *= A[i]
            if ans > limit:
                print(-1)
                exit()

        print(ans)


if __name__ == "__main__":
    main()
Problem p02663 (python)

Fixed submission:
def main():
    h1, m1, h2, m2, k = map(int, input().split())
    time = (h2 * 60 + m2) - (h1 * 60 + m1)
    ans = time - k
    print(ans)

if __name__ == "__main__":
    main()

Buggy submission (verdict: Runtime Error):
def main():
    n = int(input())
    A = list(map(int, input().split()))
    B = [0] * (n+1)
    if n == 1 and A[0] != 0:
        print(-1)
        exit()
        
    # Adが葉の個数、Bdが葉でないものの個数
    # A0 + B0 = 1
    # Bd ≤ Ad+1 + Bd+1 ≤ 2Bd --> B[d-1] - A[d] ≤ B[d] ≤ 2B[d-1] - A[d]
    # Bd ≤ Ad+1 + Ad+2 + · · · + AN = s - (A1 + ... + Ad)

    # now_s :葉の数
    now_s = sum(A)
    s = now_s
    for i in range(n+1):
        if i == 0:
            B[i] = 1 - A[i]
        else:
            now_s -= A[i]
            B[i] = min(now_s, 2 * B[i - 1] - A[i])
            #print(A,B,now_s)
            if B[i] < 0:
                print(-1)
                exit()

    print(sum(B) + s)


if __name__ == "__main__":
    main()
Problem p02727 (python)

Fixed submission:
def main():
    x, y, a, b, c = map(int, input().split())
    P = list(map(int, input().split()))
    Q = list(map(int, input().split()))
    R = list(map(int, input().split()))
    t = [1]
    t.sort()
    P.sort(reverse=True)
    Q.sort(reverse=True)
    R.sort(reverse=True)

    s = P[:x] + Q[:y]
    s.sort()
    for i in range(x + y):
        if i < c:
            if s[i] < R[i]:
                s[i] = R[i]
            else:
                break
        else:
            break
    print(sum(s))


if __name__ == "__main__":
    main()

Buggy submission (verdict: Runtime Error):
def main():
    x, y, a, b, c = map(int, input().split())
    P = list(map(int, input().split()))
    Q = list(map(int, input().split()))
    R = list(map(int, input().split()))
    t = [1]
    t.sort()
    P.sort(reverse=True)
    Q.sort(reverse=True)
    R.sort(reverse=True)

    s = P[:x] + Q[:y]
    s.sort()
    for i in range(x + y):
        if s[i] < R[i] and i < c:
            s[i] = R[i]
        else:
            break
    print(sum(s))

if __name__ == "__main__":
    main()

Buggy submission (verdict: Runtime Error):
def main():
    x, y, a, b, c = map(int, input().split())
    P = list(map(int, input().split()))
    Q = list(map(int, input().split()))
    R = list(map(int, input().split()))
    P.sort(reverse=True)
    Q.sort(reverse=True)
    R.sort(reverse=True)

    s = P[:x] + Q[:y]
    s.sort()
    for i in range(x + y):
        if s[i] < R[i]:
            s[i] = R[i]
        else:
            break
    print(sum(s))

if __name__ == "__main__":
    main()
Problem p02865 (python)

Fixed submission:
n = int(input())
if n % 2 == 0:
  print(n//2-1)
else:  
  print(n//2)

Buggy submission (verdict: Runtime Error):
import math
import collections

n = int(input())
d = list(map(int,input().split()))
MOD = 998244353
  
#同じ長さの位置に何個頂点があるか
cnt = dict(collections.Counter(d))
#print(cnt)
try:
  if cnt[0]!=0:
    ans = 1
    for i in range(len(dict(cnt))-1):
      val_1 = cnt[i]
      val_2 = cnt[i+1]
      ans *= (val_1**val_2)%MOD

    print(ans%MOD)
except KeyError:
  print(0)
Problem p02866 (python)

Fixed submission:
import collections
 
n = int(input())
d = list(map(int,input().split()))
MOD = 998244353
#頂点1が0でないとだめ
if d[0]!=0:
  print(0)
  exit()
  
#同じ長さの位置に何個頂点があるか
cnt = dict(collections.Counter(d))
#頂点1だけが0じゃないとだめ
if cnt[0]==1:
  m = max(cnt)
  #一番大きい数字までにちゃんとすべての数字が揃ってないとだめ
  for i in range(m):
    if i not in cnt:
      print(0)
      exit()
  ans = 1
  for i in range(m):
    val_1 = cnt[i]
    val_2 = cnt[i+1]
    ans *= (val_1**val_2)%MOD
 
  print(ans%MOD)
else:
  print(0)

Buggy submission (verdict: Runtime Error):
import math
import collections

n = int(input())
d = list(map(int,input().split()))
MOD = 998244353
  
#同じ長さの位置に何個頂点があるか
cnt = dict(collections.Counter(d))
#print(cnt)
if cnt[0]!=1:
  print(0)
  exit()
  
ans = 1
for i in range(len(dict(cnt))-1):
  val_1 = cnt[i]
  val_2 = cnt[i+1]
  ans *= (val_1**val_2)%MOD

print(ans%MOD)

Buggy submission (verdict: Runtime Error):
import math
import collections

n = int(input())
d = list(map(int,input().split()))
MOD = 998244353

if d[0]!=0:
  print(0)
  exit()
  
#print(n,d)
cnt = dict(collections.Counter(d))

ans = 1
for i in range(len(dict(cnt))-1):
  val_1 = cnt[i]
  val_2 = cnt[i+1]
  ans *= (val_1**val_2)%MOD

print(ans%MOD)

Buggy submission (verdict: Runtime Error):
import math
import collections

n = int(input())
d = list(map(int,input().split()))
MOD = 998244353

if d[0]!=0:
  print(0)
  exit()
  
#print(n,d)
cnt = dict(collections.Counter(d))

ans = 1
for i in range(len(dict(cnt))-1):
  val_1 = cnt[i]
  val_2 = cnt[i+1]
  ans *= val_1**val_2

print(ans%MOD)

Buggy submission (verdict: Runtime Error):
import math
n = int(input())
d = list(map(int,input().split()))
MOD = 998244353
s = list(set(d))
s.sort()

cnt = []
for num in s:
  cnt += [d.count(num)]
#print(cnt)

ans = 1
for c in cnt:
  if c != 1:
    ans *= math.factorial(c)
    
ans *= cnt[1]
print(ans%MOD)
Problem p02922 (python)

Fixed submission:
a,b = map(int,input().split())
if b == 1:
  print(0)
  exit()
  
cnt = 0  
for i in range(1,100):
  cnt = (a-1)*(i-1)+a
  if cnt>=b:
    ans = i
    break
print(ans)

Buggy submission (verdict: Runtime Error):
a,b = map(int,input().split())
if b == 1:
  print(0)
  exit()
  
cnt = 0  
for i in range(1,a+1):
  cnt = (a-1)*(i-1)+a
  if cnt>=b:
    ans = i
    break
print(ans)
Problem p02953 (python)

Fixed submission:
import sys
n = int(input())
h = list(map(int,input().split()))
mi = h[0]-1
if n == 1:
  print("Yes")
  sys.exit()
  
for i in range(1,n):
  if h[i-1]-1 == h[i]:
    if mi > h[i]:
      print("No")
      sys.exit()
    mi = h[i]
  elif h[i-1] > h[i]:
    print("No")
    sys.exit()
    
print("Yes")

Buggy submission (verdict: Runtime Error):
import sys
n = int(input())
h = list(map(int,input().split()))
d = [0]*(n-1)
cmd = [0]*(n-1)

for i in range(n-1):
  d[i]= h[i+1]-h[i]

m = 0
 
if n==1:
  print("Yes")
  sys.exit()
  
elif min(d) <= -2:
  print("No")
  sys.exit()

else:
  for i in range(n-1):
    if h[i] == h[i+1]:
      cmd[i] == 0
    elif h[i]+1 == h[i+1] and cmd[i]==1:
      print("No")
      sys.exit()
    elif h[i]+1 == h[i+1] and cmd[i]==0:
      cmd[i+1] == 1  
  print("Yes")

Buggy submission (verdict: Runtime Error):
import sys
n = int(input())
h = list(map(int,input().split()))
d = [0]*(n-1)

for i in range(n-1):
  d[i]= h[i+1]-h[i]

sd = sorted(d)
if min(sd) <= -2:
  print("No")
  sys.exit()
  
elif -1 in d:
  indexes = [i for i, x in enumerate(d) if x == -1]
  for j in range(len(indexes)-1):
    if d[j+1] != 0:
      print("No")
      sys.exit()

print("Yes")
Problem p03043 (python)

Fixed submission:
import math
N,K = map(int, input().split())
x=0
ans=0
for i in range(1,N+1):
  if i >=K:
    ans += 1
  else: 
    j = math.log(K/i,2)
    x = math.ceil(j)
    ans += (0.5)**x
   
win_rate = ans/N 
print(win_rate)

Buggy submission (verdict: Runtime Error):
import math
N,K = map(int, input().split())
#出た目をｎとすると、n>=K以上が最初に出れば勝ち
#1からK-1のときで負ける確率を考える
ans=0
S=[]
for i in range(1,K):
  x = math.log(K/i,2)
  for j in range(17):
    if j >= x:
      S.append(j)
    ans+=1-(1/2)**S[0]
 
win_rate = 1-ans
print(win_rate)
Problem p03047 (python)

Fixed submission:
N,K = map(int,input().split())
print(N-K+1)

Buggy submission (verdict: Runtime Error):
R,G,B,N = map(int,input().split())
for r in range(N+1):
  for g in range(N+1):
    n=N-R*r-G*g
    if n>=0 and n%B==0:
      b=int(n/B)
      print(r,g,b)

Buggy submission (verdict: Runtime Error):
R,G,B,N = map(int,input().split())
for r in range(N+1):
  for g in range(N+1):
    n = N-R*r-G*g
    if n >=0 and n%B==0:
      b=n/B
      print(r,g,b)
Problem p03059 (python)

Fixed submission:
A,B,T = map(int,input().split())
cnt = 0
n = A
while n <= T:
  n += A 
  cnt += B
print(cnt)

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

cnt = 0
for i in range(N):
  if V[i]-C[i] >0:
    cnt += V[i]-C[i]
print(cnt)
Problem p03061 (python)

Fixed submission:
from fractions import gcd
 
n = int(input())
a = list(map(int, input().split()))
 
rs, ls = [0], [0]
for i in range(n-1):
  rs.append(gcd(rs[i], a[i]))
  ls.append(gcd(ls[i], a[-i-1]))
 
print(max(gcd(r, l) for r, l in zip(rs, ls[::-1])))

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

#最大公約数を求めるfunction
def gcd(a,b):
  while b!=0:
    a,b=b,a%b
  return a  

def gcd_list(list,N):
  a = list[0]
  for i in range(1, N):
      b = gcd(a, list[i])
  return b

for i in range(N):
  newA = copy.copy(A)
  if i != N-1:
    newA[i] = newA[i+1]
  else:
    newA[i] = newA[i-1]
  ans = max(gcd_list(newA,N),ans)
print(ans)
Problem p03071 (python)

Fixed submission:
a,b = map(int,input().split())
m = max(a,b)
m1 = m*2-1
m2 = a+b
ans = max(m1,m2)
print(ans)

Buggy submission (verdict: Runtime Error):
a,b = map(int,input())
m = max(a,b)
m1 = m*2-1
m2 = a+b
ans = max(m1,m2)
print(ans)
Problem p03309 (python)

Fixed submission:
n = int(input())
a = list(map(int,input().split()))
b = []
for i in range(n):
  b.append(a[i]-i-1)
  
b.sort()

center = n//2
c1 = b[center]

ans = 0
for i in range(n):
  ans += abs(b[i]-c1)
print(ans)

Buggy submission (verdict: Runtime Error):
n = int(input())
a = list(map(int,input().split()))
b = []
for i in range(n):
  b.append(a[i]-i-1)
  
b.sort()

center = n//2
c1 = b[center]
c2 = b[center+1]

ans1 = 0
ans2 = 0
for i in range(n):
  ans1 += abs(b[i]-c1)
  ans2 += abs(b[i]-c2)
print(min(ans1,ans2))
Problem p03339 (python)

Fixed submission:
import collections
n = int(input())
s = input()
dic = dict(collections.Counter(s))
#W,Eどちらかしか無い場合
if len(dic)==1:
  print(0)
  exit()
left_w = 0
right_e = dic["E"]
cnt = [[] for _ in range(n)]
#(左にあるWの数+右にあるEの数)の最小値が答え


ans = n
for i in range(n):
  if s[i] == "W":
    cnt[i] = [left_w,right_e]
    ans = min(ans,left_w+right_e)
    left_w += 1
  elif s[i] == "E":
    cnt[i] = [left_w,right_e]
    ans = min(ans,left_w+right_e)
    right_e -= 1

#(右にあるWの数+左にあるEの数)の最小値が答えの場合もあるか
left_e = 0
right_w = dic["W"]

for i in range(n-1,-1,-1):
  if s[i] == "E":
    ans = min(ans,left_e+right_w)
    left_e += 1
  elif s[i] == "W":
    ans = min(ans,left_e + right_w)
    right_w -= 1

print(ans)

Buggy submission (verdict: Runtime Error):
import collections
n = int(input())
s = input()
dic = dict(collections.Counter(s))
left_w = 0
right_e = dic["E"]
cnt = [[] for _ in range(n)]
#(左あるWの数+右にあるEの数)の最小値が答え
ans = n
for i in range(n):
  if s[i] == "W":
    #cnt[i] = [left_w,right_e]
    ans = min(ans,left_w+right_e)
    left_w += 1
  elif s[i] == "E":
    #cnt[i] = [left_w,right_e]
    ans = min(ans,left_w+right_e)
    right_e -= 1
  
print(ans)
Problem p03436 (python)

Fixed submission:
import sys

h,w = map(int,input().split())

# マップを生成する。####で囲う。"."をカウントしておく(white)
m = []
m.append('#'*(w+2))
white = 0
for i in range(h):
  s = input()
  m.append(list('#' + s + '#'))
  white += s.count('.')
m.append('#'*(w+2))

stack = set([(1, 1)])
dist = 0

# stackがある限りループ
while len(stack) > 0:
  
  #ゴールまでの距離をカウントしていく
  dist += 1
  
  # 空のセットを用意
  next_w = set()
  
  for y, x in stack:
    m[y][x] = dist
    
    # ゴールに到着したら
    if (y, x) == (h, w):
      print(white - dist)
      exit()
      
 	# 上下左右に移動。
    for dx,dy in [0,1],[0,-1],[1,0],[-1,0]:
      # "."なら移動可能
      if m[y-dy][x-dx] == '.':
        next_w.add((y-dy,x-dx))
  stack = next_w

print('-1')

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

h, w = map(int, input().split())
maze = [list("#" * (w + 2))]
white = 0
for _ in [0] * h:
    line = "#" + input().strip() + "#"
    maze.append(list(line))
    white += line.count(".")

maze += [list("#" * (w + 2))]

q = deque()
q.append([1, 1])
maze[1][1] = 0
maze[-2][-2] = "goal"
#print(maze)

dir = [[1, 0], [0, 1], [-1, 0], [0, -1]]
dis = 0
while q:
    x, y = q.pop()
    dis += 1

    for dx, dy in dir:
        next_x, next_y = x + dx, y + dy
        if maze[next_y][next_x] == ".":
            #print(next_y, next_x)
            q.append([next_y, next_x])
            maze[next_y][next_x] = dis
            
        if maze[next_y][next_x] == "goal":
            print(white - dis - 1)
            exit()
print(-1)
Problem p03469 (python)

Fixed submission:
S = input().split('/')
S[0] = "2018"
ans = '/'.join(S)
print(ans)

Buggy submission (verdict: Runtime Error):
n,y = map(int,input().split())
ans_a = -1
ans_b = -1
ans_c = -1

for i in range(n+1):
  for j in range(n+1):
    x = y - 10000*i - 5000*j
    if x % 1000 == 0:
      k = x / 10000
      ans_a = i
      ans_b = j
      ans_c = k
print(ans_a,ans_b,ans_c)

Buggy submission (verdict: Runtime Error):
n,y = map(int,input().split())
ans_a = -1
ans_b = -1
ans_c = -1

for i in range(n+1):
  for j in range(n+1-i):
    x = y - 10000*i - 5000*j
    if x % 10000 == 0:
      k = x / 10000
      ans_a = i
      ans_b = j
      ans_c = k
print(ans_a,ans_b,ans_c)
Problem p03472 (python)

Fixed submission:
import math
n,h = map(int,input().split())
ab =[list(map(int,input().split())) for _ in range(n)]
lisA = []
lisB = []
#使いまわせるaを記録し、その最大値を見つける
for a,_ in ab:
  lisA.append(a)
m = max(lisA)

#ｍより大きければ収納
for _,b in ab:
  if b > m:
  	lisB.append(b)

s = sum(lisB)
lisB.sort(reverse=True)
#print(lisA,lisB)

cnt = 0
#もし、m以上のbの合計だけでhを超えられるなら、点数の低い順に抜いていく
if s>=h:
  while s>=h:
    #小さいやつを抜いていく
    s -= lisB.pop()
  cnt = len(lisB) + 1 
else:
  cnt = len(lisB) + math.ceil((h-s)/m)
  
print(cnt)

Buggy submission (verdict: Runtime Error):
import math
n,h = map(int,input().split())
ab =[list(map(int,input().split())) for _ in range(n)]
lisA = []
lisB = []
#使いまわせるaを記録し、その最大値を見つける
for a,_ in ab:
  lisA.append(a)
m = max(lisA)

#ｍより大きければ収納
for _,b in ab:
  if b > m:
  	lisB.append(b)

s = sum(lisB)
lisB.sort(reverse=True)
#print(lisA,lisB,m,s)

cnt = 0
#もし、m以上のbの合計だけでhを超えられるなら、点数の低い順に抜いていく
if s>=h:
  while s>=H:
    #小さいやつを抜いていく
    s -= lisB.pop()
  cnt = len(lisB)  
else:
  cnt = len(lisB) + math.ceil((h-s)//m)
  
print(cnt)
Problem p03625 (python)

Fixed submission:
import collections

n = int(input())
a = list(map(int,input().split()))
c = dict(collections.Counter(a))

d1 = []
d2 = []
for num,v in c.items():
  if v >= 2:
    d1.append(num)
  if v >= 4:
    d2.append(num)
    
d1.sort()
d2.sort()

if d2:
  ans = max(d2[-1]**2, d1[-1]*d1[-2])
  print(ans)
else:
  if len(d1)>=2:
    print(d1[-1]*d1[-2])
  else:
    print(0)

Buggy submission (verdict: Runtime Error):
import collections

n = int(input())
a = list(map(int,input().split()))
c = dict(collections.Counter(a))

d1 = []
d2 = []
for num,v in c.items():
  if v >= 2:
    d1.append(num)
  if v >= 4:
    d2.append(num)
    
d1.sort()
d2.sort()

if d2:
  ans = max(d2[-1]**2, d1[-1]*d1[-2])
  print(ans)
else:
  print(d1[-1]*d1[-2])
Problem p03633 (python)

Fixed submission:
n = int(input())
t = [int(input()) for _ in [0]*n]

if n==1:
  print(t[0])
  exit()
  
def gcd(x, y):
	while y:
		x, y = y, x % y
	return x

def lcm(x, y):
  return x * y // gcd (x, y)

ans = lcm(t[0],t[1])
if n>=3:
  for i in range(2,n):
    ans = lcm(ans,t[i])
    
print(ans)

Buggy submission (verdict: Runtime Error):
n = int(input())
t = [int(input()) for _ in [0]*n]

def gcd(x, y):
	while y:
		x, y = y, x % y
	return x

def lcm(x, y):
  return x * y // gcd (x, y)

ans = lcm(t[0],t[1])
if n>=3:
  for i in range(2,n):
    ans = lcm(ans,t[i])
    
print(ans)
Problem p03721 (python)

Fixed submission:
import numpy as np
n,k = map(int,input().split())
c = [0] * (10**5+1)
for _ in range(n):
  a,b = map(int,input().split())
  c[a] += b

A = np.array(c,dtype=np.int64)
A = A.cumsum()
answer = (A >= k).nonzero()[0].min()
print(answer)

Buggy submission (verdict: Runtime Error):
import numpy as np
n,k = map(int,input().split())
c = [0] * (10**5+1)
for _ in range(n):
  a,b = map(int,input().split())
  c[a] += b

A = np.array(c,dtype=np.int32)
A = A.cumsum()
answer = (A >= k).nonzero()[0].min()
print(answer)
Problem p03845 (python)

Fixed submission:
n = int(input())
t = list(map(int,input().split()))
m = int(input())
PX = [list(map(int,input().split())) for _ in range(m)]
s = sum(t)
for i in range(m):
  ans = s - t[PX[i][0]-1] + PX[i][1]   
  print(ans)

Buggy submission (verdict: Runtime Error):
n = int(input())
t = list(map(int,input().split()))
m = int(input())
PX = [list(map(int,input().split())) for _ in range(m)]
ans = 10**7
s1 = sum(t)
for i in range(m):
  s2 = s1 - t[PX[i][0]] + PX[i][1]
  ans = min(ans,s2)                         
print(ans)
Problem p04001 (python)

Fixed submission:
S = input()
 
cnt = len(S) - 1 #数字の間の数
 
ans = 0
 
for i in range(2 ** cnt):
  sign = [""] * cnt
  for j in range(cnt):
    if ((i>>j)&1):
      sign[j] = "+"
            
  formula = ""      
  for k in range(cnt):
    formula += S[k] + sign[k]
  formula += S[cnt]   
  ans += eval(formula)
print(ans)

Buggy submission (verdict: Runtime Error):
S = input()
print(S[0],S[1]) 
cnt = len(S) - 1 #数字の間の数
 
ans = 0
 
for i in range(2 ** cnt):
  sign = [""] * cnt
  for j in range(cnt):
    if ((i>>j)&1):
      sign[j] = "+"
            
  formula = ""      
  for k in range(cnt):
    formula += S[k] + sign[k]
    print(sign)
  formula += S[cnt]
  print(formula,i)       
  ans += eval(formula)
print(ans)
Problem p04013 (python)

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

#aとの差を記録してリストに入れなおす
x = list(map(lambda i: i-a, x))
#print(x)

#dp初期値
dp = {0: 1}

#dpにぶち込む値をxから取り出す
for num in x:
  #dpにあるすべてのkey,valueに対して、すでにdpにkeyがi+kのデータがあればそのvalueなければ,0を返し、それ+vをdpとする。
  for k,v in list(dp.items()):
    dp[num+k]=dp.get(num+k,0)+v
    
  #print(dp)
#全部使わない選択肢だけ引いておく  
print(dp[0]-1)
#print(dp)

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

#aとの差を記録してリストに入れなおす
x = list(map(lambda i: i-a, x))
#print(x)

#dp初期値
dp = {0: 1}

#dpにぶち込む値をxから取り出す
for num in x:
  #dpにあるすべてのkey,valueに対して、すでにdpにkeyがi+kのデータがあればそのvalueなければ,0を返し、それ+vをdpとする。
  for k,v in list(dp.items()):
    dp[i+k]=dp.get(i+k,0)+v
    
  #print(dp)
#全部使わない選択肢だけ引いておく  
print(dp[0]-1)
#print(dp)
Problem p02717 (python)

Fixed submission:
X,Y,Z = map(int,input().split())
print(Z,X,Y)

Buggy submission (verdict: Runtime Error):
X,Y,Z = map(int,input())
print(Z,X,Y)
Problem p02945 (python)

Fixed submission:
data = [int(x) for x in input().split(" ")]
print(max(sum(data),data[0]-data[1],data[0]*data[1]))

Buggy submission (verdict: Runtime Error):
data = [int(x) for x in input().split(" ")]
print(max(sum(data),data[0]-data[1],data[0]*data[1])
Problem p02947 (python)

Fixed submission:
"""
N = list(map(int,input().split()))
S = [str(input()) for _ in range(N)]
S = [list(map(int,list(input()))) for _ in range(h)] 
print(*S,sep="")
"""

import sys
sys.setrecursionlimit(10**6)
input = lambda: sys.stdin.readline().rstrip()
inf = float("inf") # 無限

n = int(input())

data = {}
for _ in range(n):
    temp = "".join(sorted(input()))
    # print(temp)
    if temp in data.keys():
        data[temp] += 1
    else:
        data[temp] = 1
# print(data)

answer = 0
for num in data.values():
    answer += (num*(num-1))//2
print(answer)

Buggy submission (verdict: Runtime Error):
num = int(input())
data = []
for _ in range(num):
    tmp = input()
    data.append(tmp.sort())
data = data.sort()
count = 0
for i in range(num):
    tmp = data[i]
    for j in range(i+1,num):
        if tmp == data[j]:
            count+=1
        else:
            break
print(count)
Problem p02690 (python)

Fixed submission:
X = int(input())
 
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

yakusu = make_divisors(X)
for k in yakusu:
    for A in range(-1000, 1000):
        B = A-k
        if A**4 + (A**3)*B + (A**2)*(B**2) + A*(B**3) + B**4 == X/k:
            print(A, B)
            break

Buggy submission (verdict: Runtime Error):
X = int(input())

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
  
for k in yakusu:
    hani = int(math.log(X/k)) + 1
    for A in range(-1000, 1000):
        B = A-k
        if A**4 + (A**3)*B + (A**2)*(B**2) + A*(B**3) + B**4 == X/k:
            print(A, B)
            break
Problem p02696 (python)

Fixed submission:
import math
A, B, N = map(int, input().split())

if N < B:
    if N % B == 0:
        x = N-1
    else:
        x = N

else:
    if N % B == 0:
        x = B-1
    else:
        x = B-1

ans = math.modf((x/B))[0]*A
print(int(ans))

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

N, M, Q = map(int, input().split())
abcd = [list(map(int, input().split())) for _ in range(Q)]

A = [0, 1]
combnation = list(product(A, repeat=Q))
abcd.sort()

ans = 0
for comb in combnation:
    print(comb)
    comb_list = [abcd[i] for i, k in enumerate(comb) if k==1]
    check = True
    A = [0 for i in range(N+1)]
    amount = 0
    for a, b, c, d in comb_list:
        amount += d
        if A[a] == 0 and A[b] == 0:
            if A[a] == 0 and A[b] == 0:
                A[a] = 1
                A[b] = 1 + c
    
        elif A[a] == 0 and A[b] != 0:
            if A[b] - c >= 1:
                A[a] = A[b] - c
            else:
                check = False
                break
    
        elif A[a] != 0 and A[b] == 0:
            if c + A[a] <= M:
                A[b] = A[a] + c
            else:
                check = False
                break
        else:
            if A[b] - A[a] != c:
                check = False
                break
    
    if check and amount > ans:
        ans = amount
print(ans)

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

if N < B:
    if N % B == 0:
        x = N-1
    else:
        x = N
        ans = math.modf((N/B))[0]*A

else:
    if N % B == 0:
        x = (N-1)%B
    else:
        x = N%B

ans = math.modf((x/B))[0]*A
print(int(ans))