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

Fixed submission:
import fractions

def main():
  n = int(input())
  a = list(map(int, input().split()))

  right = []
  left  = []

  right.append(a[0])
  left.append(a[-1])

  for i in range(1, len(a)-1):
    right.append(fractions.gcd(right[i-1], a[i]))
    left.append(fractions.gcd(left[i-1], a[-i-1]))
  
  ans = max(right[-1], left[-1])
  
  for i in range(len(right)-1):
    ans = max(ans, fractions.gcd(right[i], left[-i-2]))
    
  print(ans)
  
main()

Buggy submission (verdict: Runtime Error):
import math

def main():
  n = int(input())
  a = list(map(int, input().split()))

  right = []
  left  = []

  right.append(a[0])
  left.append(a[-1])

  for i in range(1, len(a)-1):
    right.append(math.gcd(right[i-1], a[i]))
    left.append(math.gcd(left[i-1], a[len(a)-i-1]))
  
  ans = max(right[-1], left[-1])
  
  for i in range(len(right)-1):
    ans = max(ans, math.gcd(right[0], left[len(left)-2-i]))
    
  print(ans)
  
main()

Buggy submission (verdict: Runtime Error):
import math

def main():
  n = int(input())
  a = list(map(int, input().split()))

  right = []
  left  = []

  right.append(a[0])
  left.append(a[-1])

  for i in range(1, len(a)-1):
    right.append(math.gcd(right[i-1], a[i]))
    left.append(math.gcd(left[i-1], a[-i-1]))
  
  ans = max(right[-1], left[-1])
  
  for i in range(len(right)-1):
    ans = max(ans, math.gcd(right[0], left[-2-i]))
    
  print(ans)
  
main()

Buggy submission (verdict: Runtime Error):
import math

def main():
  n = int(input())
  a = list(map(int, input().split()))

  right = []
  left  = []

  right.append(a[0])
  left.append(a[-1])

  for i in range(1, len(a)-1):
    right.append(math.gcd(right[i-1], a[i]))
    left.append(math.gcd(left[i-1], a[len(a)-i-1]))
  
  ans = max(right[-1], left[-1])
  
  for i in range(len(right)-1):
    ans = max(ans, math.gcd(right[0], left[-2-i]))
    
  print(ans)
  
main()
Problem p03284 (python)

Fixed submission:
nums = [int(i) for i in input().split()]

if nums[0] % nums[1] == 0 :
    print(0)
else:
    print(1)

Buggy submission (verdict: Runtime Error):
n = int(input())
k = int(input())

if n % k == 0 :
    print(0)
else:
    print(1)
Problem p03411 (python)

Fixed submission:
import bisect as bs
import sys

n = int(input())
array = []

for i in range(n):
  a,b = map(int, input().split())
  array.append((a,b,False))
  
for j in range(n):
  c,d = map(int, input().split())
  array.append((c,d,True))
  
array.sort()

blue = []

count = 0 
for v in array:
  if v[2]:
    index = bs.bisect_left(blue, v[1])
    if index != 0:
      blue[index-1] = sys.maxsize
      count += 1
      blue.sort()
      
  else:
    blue.append(v[1])
    blue.sort()
    
print(count)

Buggy submission (verdict: Runtime Error):
import bisect as bs
import sys

n = int(input())
array = []

for i in range(n):
  a,b = map(int, input().split())
  array.append((a,b,False))
  
for j in range(n):
  c,d = map(int, input().split())
  array.append((c,d,True))
  
array.sort()

blue = []

count = 0 
for v in array:
  if v[2]:
    index = bs.bisect_left(blue, v[1])
    if index != 0:
      blue[index-1] = sys.maxsize
      count += 1
      blue.sort()
      
  else:
    blue.append(v[1])
    blue.sort()
    
print(count)import bisect as bs
import sys

n = int(input())
array = []

for i in range(n):
  a,b = map(int, input().split())
  array.append((a,b,False))
  
for j in range(n):
  c,d = map(int, input().split())
  array.append((c,d,True))
  
array.sort()

blue = []

count = 0 
for v in array:
  if v[2]:
    index = bs.bisect_left(blue, v[1])
    if index != 0:
      blue[index-1] = sys.maxsize
      count += 1
      blue.sort()
      
  else:
    blue.append(v[1])
    blue.sort()
    
print(count)
Problem p03452 (python)

Fixed submission:
import sys

sys.setrecursionlimit(4100000)

def func(array, arr, d):
  for v in arr:
    if array[v[0]] == None:
      d1 = d + v[1]
      array[v[0]] = d1
      arr1 = dic.get(v[0], [])
      
      if not func(array, arr1, d1):
        return False
      
    elif array[v[0]] != d + v[1]:
      return False
    
  return True
      

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

array = [None] * n
dic = {}

for i in range(m):
  l,r,d = map(int, input().split())
  l -= 1
  r -= 1
  
  dic.setdefault(l,[])
  dic.setdefault(r,[])
  dic[l].append((r,d))
  dic[r].append((l,-d))
  
for i in range(n):
  if array[i] != None:
    continue
    
  array[i] = 0
  arr = dic.get(i, [])
  
  if not func(array, arr, 0):
    print('No')
    sys.exit()

print('Yes')

Buggy submission (verdict: Runtime Error):
import sys

def func(array, arr, d):
  for v in arr:
    if array[v[0]] == None:
      d1 = d + v[1]
      array[v[0]] = d1
      arr1 = dic.get(v[0], [])
      
      if not func(array, arr1, d1):
        return False
      
    elif array[v[0]] != d + v[1]:
      return False
    
  return True
      

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

array = [None] * n
dic = {}

for i in range(m):
  l,r,d = map(int, input().split())
  l -= 1
  r -= 1
  
  dic.setdefault(l,[])
  dic.setdefault(r,[])
  dic[l].append((r,d))
  dic[r].append((l,-d))
  
for i in range(n):
  if array[i] != None:
    continue
    
  array[i] = 0
  arr = dic.get(i, [])
  
  if not func(array, arr, 0):
    print('No')
    sys.exit()

print('Yes')
Problem p04032 (python)

Fixed submission:
import sys

s = 'a' + input()

for i in range(3,len(s)):
  if s[i] != s[i-1] and s[i] != s[i-2]:
    continue
  elif s[i] == s[i-1]:
    print(i-1,i)
    sys.exit(0)
  elif s[i] == s[i-2]:
    print(i-2,i)
    sys.exit(0)

if s[1] == s[2]:
  print(1,2)
  sys.exit(0)
print(-1,-1)

Buggy submission (verdict: Runtime Error):
import sys

s = a + input()

for i in range(3,len(s)):
  if s[i] != s[i-1] and s[i] != s[i-2]:
    continue
  elif s[i] == s[i-1]:
    print(i-1,i)
    sys.exit(0)
  elif s[i] == s[i-2]:
    print(i-2,i)
    sys.exit(0)
    
print(-1,-1)
Problem p02767 (python)

Fixed submission:
n=int(input())
a=list(map(int,input().split()))
ans=1e10
for i in range(1,101):
  sum=0
  for x in a: sum+=pow(abs(x-i),2)
  ans=min(ans,sum)
print(ans)

Buggy submission (verdict: Runtime Error):
n=int(input())
a=list(map(int,input().split()))
ans=(int)1e10
for i in range(1,101):
  sum=0
  for x in a: sum+=abs(x-i)
  ans=min(ans,sum)
print(ans)
Problem p02787 (python)

Fixed submission:
def IN(): return map(int,input().split())
ans = pow(2,31); mod = pow(10,9)+7
h,n=IN()
A=[]; dp=[pow(2,31)]*111111
for i in range(n):
  x,y=IN()
  A.append((x,y))
dp[0]=0
for a,b in A:
  for i in range(h+1111):
    dp[i+a]=min(dp[i+a],dp[i]+b)
for i in range(h,11111):
  ans=min(ans,dp[i])
print(ans)

Buggy submission (verdict: Runtime Error):
h,n=map(int,input().split())
dp=[0]*(h+1010)
A=[list(map(int,input().split())) for i in range(n)]
dp[0]=0
for i in range(h+1010):
  dp[i]=min(dp[i-a]+b for a,b in A)
print(min(dp[h:]))

Buggy submission (verdict: Runtime Error):
h,n=map(int,input().split())
dp=[0]*(h+10)
A=[list(map(int,input().split())) for i in range(n)]
dp[0]=0
for i in range(h+10):
  dp[i]=min(dp[i-a]+b for a,b in A)
print(min(dp[h:]))

Buggy submission (verdict: Runtime Error):
def IN(): return map(int,input().split())
ans = pow(2,31); mod = pow(10,9)+7
h,n=IN()
A=[]; dp=[pow(2,31)]*111111
for i in range(n):
  x,y=IN()
  A.append((x,y))
dp[0]=0
for a,b in A:
  for i in range(10111):
    dp[index]=min(dp[index],dp[i]+b)
for i in range(h,111111):
  ans=min(ans,dp[i])
print(ans)

Buggy submission (verdict: Runtime Error):
def IN(): return map(int,input().split())
ans = pow(2,31); mod = pow(10,9)+7
h,n=IN()
A=[]; dp=[pow(2,31)]*11111
for i in range(n):
  x,y=IN()
  A.append((x,y))
dp[0]=0
for a,b in A:
  for i in range(10111):
    dp[i+a]=min(dp[i+a],dp[i]+b)
for i in range(h,11111):
  ans=min(ans,dp[i])
print(ans)
Problem p02788 (python)

Fixed submission:
from bisect import bisect_left as lower_bound
from bisect import bisect_right as upper_bound
import math
n,d,a=map(int,input().split())
X, H=[], []; ans=0; L=[]
for i in range(n):
  x,h=map(int,input().split())
  L.append((x,h))
L.sort()
for x,h in L:
  X.append(x); H.append(h)
X.append(10**9); H.append(10**9)
imos=[0]*(n+5)
de=0 # decrease count
for i in range(n):
  de+=imos[i]
  HP=H[i]-de*a
  # 右から貪欲にダメージを減らす
  # 敵の体力が残ってるとき
  # print("HP is",HP)
  if HP>0:
    atk_cnt=math.ceil(HP/a) # 何回殴る必要があるか
    de+=atk_cnt
    ans+=atk_cnt
    index=upper_bound(X,X[i]+2*d)
    # print(X,X[i]+2*d)
    # print(index, atk_cnt)
    imos[index]-=atk_cnt
print(ans)

Buggy submission (verdict: Runtime Error):
from bisect import bisect_left as lower_bound
from bisect import bisect_right as upper_bound
import math
n,d,a=map(int,input().split())
X, H=[], []; ans=0; L=[]
for i in range(n):
  x,h=map(int,input().split())
  L.append((x,h))
L.sort()
for x,h in L:
  X.append(x); H.append(h)
X.append(10**9); H.append(10**9)
imos=[0]*(n+1)
de=0 # decrease count
for i in range(n):
  de+=imos[i]
  HP=H[i]-de*a
  # 右から貪欲にダメージを減らす
  # 敵の体力が残ってるとき
  # print("HP is",HP)
  if HP>0:
    atk_cnt=math.ceil(HP/a) # 何回殴る必要があるか
    de+=atk_cnt
    ans+=atk_cnt
    index=upper_bound(X,X[i]+2*d)
    # print(X,X[i]+2*d)
    # print(index, atk_cnt)
    imos[index]-=atk_cnt
print(ans)
Problem p02811 (python)

Fixed submission:
K,X=map(int,input().split())
if K*500>=X:
    print('Yes')
else:
    print('No')

Buggy submission (verdict: Runtime Error):
K,X=map(int,input().split())
If K*500>=X:
    print(‘Yes’)
else:
    print(‘No’)
Problem p03026 (python)

Fixed submission:
import sys
import resource

sys.setrecursionlimit(20000)
n=int(input())
edges=[list(map(int,input().split())) for i in range(n-1)]
e = [[] for i in range(n)]
for a,b in edges:
  a-=1;b-=1
  e[a].append(b);e[b].append(a)
c=sorted(list(map(int,input().split())))
print(sum(c[:-1]))
visited=[False for i in range(n)]
node=[0]*n
cnt=0
def dfs(pos):
  global cnt,node,c
  if visited[pos]:return
  visited[pos]=True
  for p in e[pos]:
    dfs(p)
  node[pos]=c[cnt]
  cnt+=1
dfs(0)
print(' '.join(map(str,node)))

Buggy submission (verdict: Runtime Error):
n=int(input())
edges=[list(map(int,input().split())) for i in range(n-1)]
e = [[] for i in range(n)]
for a,b in edges:
  a-=1;b-=1
  e[a].append(b);e[b].append(a)
c=sorted(list(map(int,input().split())))
print(sum(c[:-1]))
visited=[False for i in range(n)]
node=[0]*n
cnt=0
def dfs(pos):
  global cnt,node,c
  if visited[pos]:return
  visited[pos]=True
  for p in e[pos]:
    dfs(p)
  node[pos]=c[cnt]
  cnt+=1
dfs(0)
print(' '.join(map(str,node)))
Problem p03152 (python)

Fixed submission:
from bisect import bisect_left
n,m=map(int,input().split())
A=sorted(list(map(int,input().split())))
B=sorted(list(map(int,input().split())))
a=[0]*(n*m+1); b=[0]*(n*m+1)
for ax in A: a[ax]+=1
for bx in B: b[bx]+=1
# print(a,b)
ans=1; mod=pow(10,9)+7
for i in reversed(range(1,n*m+1)):
  if a[i]>0 and b[i]>0: 
    if a[i]>1 or b[i]>1: ans=0
  elif a[i]>0:
    if a[i]>1: ans=0
    ans*=m-bisect_left(B,i)
    ans%=mod
  elif b[i]>0:
    if a[i]>1: ans=0
    ans*=n-bisect_left(A,i)
    ans%=mod
  else:
    ax=n-bisect_left(A,i)
    bx=m-bisect_left(B,i)
    mul = ax*bx-(n*m-i)
    ans=(ans*mul)%mod
print(ans)

Buggy submission (verdict: Runtime Error):
from bisect import bisect_left
n,m=map(int,input().split())
A=sorted(list(map(int,input().split())))
B=sorted(list(map(int,input().split())))
a=[0]*(max(A)+1); b=[0]*(max(B)+1)
for ax in A: a[ax]+=1
for bx in B: b[bx]+=1
# print(a,b)
ans=1; mod=pow(10,9)+7
for i in reversed(range(1,n*m+1)):
  if a[i]>0 and b[i]>0: 
    if a[i]>1 or b[i]>1: ans=0
  elif a[i]>0:
    if a[i]>1: ans=0
    ans*=m-bisect_left(B,i)
    ans%=mod
  elif b[i]>0:
    if a[i]>1: ans=0
    ans*=n-bisect_left(A,i)
    ans%=mod
  else:
    ax=n-bisect_left(A,i)
    bx=m-bisect_left(B,i)
    mul = ax*bx-(n*m-i)
    ans=(ans*mul)%mod
print(ans)
Problem p03263 (python)

Fixed submission:
h,w=map(int,input().split())
c=[list(map(int,input().split())) for i in range(h)]
ans=[]
for i in range(h):
  for j in range(w):
    if c[i][j]%2==1:
      if i<h-1:
        ans.append((i+1,j+1,i+2,j+1))
        c[i+1][j]+=1
      elif j<w-1:
        ans.append((i+1,j+1,i+1,j+2))
        c[i][j+1]+=1
print(len(ans))
for a in ans:
  print(' '.join(map(str,a)))

Buggy submission (verdict: Runtime Error):
h,w=map(int,input().split())
c=[list(map(int,input().split())) for i in range(h)]
ans=[]
for i in range(h):
  for j in range(w):
    if c[i][j]%2==1:
      if i<=h-1:
        ans.append((i,j,i+1,j))
        c[i+1][j]+=1
      elif j<=w-1:
        ans.append((i,j,i,j+1))
        c[i][j+1]+=1
print(len(ans))
for a in ans:
  print(' '.join(map(str,a)))
Problem p03304 (python)

Fixed submission:
n,m,d=(int(x) for x in input().split())
if d==0:
  print((m-1)/n)
else:
  print(2*(n-d)/(n*n)*(m-1))

Buggy submission (verdict: Runtime Error):
n,m,d=int(input().split())
if d==0:
  print(1/n)
else:
  print(2*(n-d)/(n*n))
Problem p03337 (python)

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

Buggy submission (verdict: Runtime Error):
a,b=map(int,input().split())
print(max(a=b,a-b,a*b))
Problem p03547 (python)

Fixed submission:
x,y=input().split()
if x<y:c='<'
elif x>y:c='>'
else: c='='
print(c)

Buggy submission (verdict: Runtime Error):
x,y=input().split()
if x<y:c='<'
else if x>y:c='>'
else: c='='
print(c)
Problem p03837 (python)

Fixed submission:
n,m=map(int,input().split())
l=[list(map(int,input().split()))for i in range(m)]
dist=[[1<<29]*n for i in range(n)]
for i in range(n): dist[i][i]=0
for a in l:
  dist[a[0]-1][a[1]-1] = min(dist[a[0]-1][a[1]-1],a[2])
  dist[a[1]-1][a[0]-1] = min(dist[a[1]-1][a[0]-1],a[2])
# print(dist)
for k in range(n):
  for i in range(n):
    for j in range(n):
      dist[i][j] = min(dist[i][j], dist[i][k] + dist[k][j])
# 経路復元
ans=m
for a in l:
  flag=False
  for j in range(n): 
    if dist[j][a[0]-1]+a[2]==dist[j][a[1]-1]: flag=True
  if flag: ans-=1
print(ans)

Buggy submission (verdict: Runtime Error):
n,m=map(int,input().split())
l=[list(map(int,input().split()))for i in range(m)]
dist=[[1<<29]*n for i in range(n)]
for i in range(m): dist[i][i]=0
for a in l:
  dist[a[0]-1][a[1]-1] = min(dist[a[0]-1][a[1]-1],a[2])
  dist[a[1]-1][a[0]-1] = min(dist[a[1]-1][a[0]-1],a[2])
# print(dist)
for k in range(n):
  for i in range(n):
    for j in range(n):
      dist[i][j] = min(dist[i][j], dist[i][k] + dist[k][j])
# 経路復元
ans=m
for a in l:
  flag=False
  for j in range(n): 
    if dist[j][a[0]-1]+a[2]==dist[j][a[1]-1]: flag=True
  if flag: ans-=1
print(ans)

Buggy submission (verdict: Runtime Error):
n,m=map(int,input().split())
l=[list(map(int,input().split()))for i in range(m)]
dist=[[1<<29]*n for i in range(n)]
for i in range(m): dist[i][i]=0
for a in l:
  dist[a[0]-1][a[1]-1] = min(dist[a[0]-1][a[1]-1],a[2])
  dist[a[1]-1][a[0]-1] = min(dist[a[1]-1][a[0]-1],a[2])
for k in range(n):
  for i in range(n):
    for j in range(n):
      dist[i][j] = min(dist[i][j], dist[i][k] + dist[k][j])
# 経路復元
ans=m
for a in l:
  flag=False
  for j in range(n): 
    if dist[j][a[0]-1]+a[2]==dist[j][a[1]-1]: flag=True
  if flag: ans-=1
print(ans)
Problem p04035 (python)

Fixed submission:
import numpy as np
n,l=map(int,input().split())
a=list(map(int,input().split()))
flag=False;idx=0
for i in range(n-1):
  if a[i]+a[i+1]>=l:
    flag=True
    idx=i
if not flag:
  print("Impossible")
  exit(0)
print("Possible")
for x in range(idx):
  print(x+1)
for x in reversed(range(idx,n-1)):
  print(x+1)

Buggy submission (verdict: Runtime Error):
import numpy as np
n,l=map(int,input().split())
a=list(map(int,input().split()))
flag=False;idx=0
for i in range(n-1):
  if a[i]+a[i+1]>=l:
    flag=True
    idx=i
if not Flag:
  print("Impossible")
  exit(0)
print("Possible")
for x in range(idx):
  print(x+1)
for x in reversed(range(idx+1)):
  print(x+1)
Problem p02555 (python)

Fixed submission:
S = int(input())
A = [0]*(S+1)
A[0] = 1
MOD = 10**9+7

if S<=2:
    print(A[S])
    exit()

for i in range(3,S+1):
    for j in range(i-2):
        A[i] += A[j]
    A[i]%=MOD
print(A[S])

Buggy submission (verdict: Runtime Error):
from scipy.special import comb

S = int(input())

n = S//3
k = S%3
Q = 10**9+7
ans = 0
for i in range(n):
    #iはしきりをとった数
    m = n-i #要素数
    ans += comb(n-1,i,exact=true)*comb(m,k,exact=True)
    if k==2:
        ans += k
    ans %=Q
print(ans)
Problem p02684 (python)

Fixed submission:
N,K = map(int,input().split())
A = list(map(int,input().split()))
x = 1
step = 0
count = [0]*N
count[0] += 1
memo = [-1]*N
memo[0] = 0
M = K
flag = 0
for i in range(M):
    x = A[x-1]
    count[x-1] += 1
    step += 1
    K -= 1
    if memo[x-1] != -1:
        s = memo[x-1]
        t = step-s
#        print(s,t)
        flag = 1
        break
    memo[x-1] = step
#    print(step,x,count,memo)
if flag == 0:
    print(x)
else:
    if t>= 1:
        K %= t
    else:
        K = 1
    for i in range(K):
        x = A[x-1]
    print(x)

Buggy submission (verdict: Runtime Error):
N,K = map(int,input().split())
A = list(map(int,input().split()))
x = 1
step = 0
count = [0]*N
count[0] += 1
memo = [-1]*N
memo[0] = 0
M = K
for i in range(M):
    x = A[x-1]
    count[x-1] += 1
    step += 1
    K -= 1
    if memo[x-1] != -1:
        s = memo[x-1]
        t = step-s
#        print(s,t)
        break
    memo[x-1] = step
#    print(step,x,count,memo)

K %= t
for i in range(K):
    x = A[x-1]
print(x)
Problem p02696 (python)

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

def f(x):
    v = math.floor(A*x/B)-A*math.floor(x/B)
    return v

if N>=B-1:
    print(f(B-1))
else:
    print(f(N))

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

x= np.arange(0,N+1,1)
y1 = np.floor(A*x/B)
y2 = A*np.floor(x/B)
y3 = y1-y2

print(int(max(y3)))
Problem p02780 (python)

Fixed submission:
N,K = map(int, input().split())
p = list(map(int, input().split()))

sum_memo = [0]*1001
x_memo = [0] * 1001
x_list = [0]*N

for i in range(1,1001):
    sum_memo[i] = sum_memo[i-1] + i

for i in range(N):
    if x_memo[p[i]] == 0:
        x_memo[p[i]] = sum_memo[p[i]]/p[i]
    x_list[i] = x_memo[p[i]]


ans = 0
tmp = sum(x_list[:K])
#print(tmp)
#print(x_list)
if N==K:
    print(tmp)
    exit()
for l in range(N-K):
    r = l+K
    tmp = tmp -  x_list[l] + x_list[r]
#    print(l,r,x_list[l], x_list[r], tmp)
    ans = max(ans, tmp)
print(ans)

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

sum_memo = [0]*1001
x_memo = [0] * 1000
x_list = [0]*N

for i in range(1,1001):
    sum_memo[i] = sum_memo[i-1] + i

for i in range(N):
    if x_memo[p[i]] == 0:
        x_memo[p[i]] = sum_memo[p[i]]/p[i]
    x_list[i] = x_memo[p[i]]


ans = 0
tmp = sum(x_list[:K])
for l in range(N-K):
    r = l+K
    tmp = tmp -  x_list[l] + x_list[r]
    ans = max(ans, tmp)
print(ans)
Problem p02866 (python)

Fixed submission:
N = int(input())
D = list(map(int, input().split()))

count = [0]*(max(D)+1)
ans = 1

for i in range(N):
    count[D[i]] += 1

if count[0] != 1 or D[0] != 0:
  print(0)
  exit()
 
for i in range(1,max(D)+1):
    ans *= count[i-1]**count[i]
    ans %= 998244353
print(ans)

Buggy submission (verdict: Runtime Error):
import numpy as np
N = int(input())
D = np.array(input().split(), dtype=np.int64)

C = np.zeros(max(D)+1)
for i in range(N):
    C[D[i]] += 1
    
if D[0] != 0 or C[0] != 1:
    ans = 0
    print(ans)
    exit()

ans = 1
for i in range(1,max(D)+1):
  ans *= C[i-1]**C[i]
  ans %= 998244353
print(int(ans))
Problem p02882 (python)

Fixed submission:
import math
a,b,x = map(int, input().split())

theta1 = math.atan((2/a*(b-x/(a**2))))
if math.tan(theta1) <= 2*x/(a**3):
  print(math.degrees(theta1))
  exit()
else:
  theta2 = math.atan(a*b**2/(2*x))
  print(math.degrees(theta2))

Buggy submission (verdict: Runtime Error):
import math
a,b,x = map(int, input().split())

ans1 = (b-x/(a**2))*2/a
ans1 = math.degrees(math.asin(ans1))

ans2 = a*(b**2)/(2*x)
ans2 = math.degrees(math.atan(ans2))
print(min(ans1,ans2))
Problem p02910 (python)

Fixed submission:
S = input()
N = len(S)
for i in range(0,N,2):
  if S[i] == "L":
    print("No")
    exit()
for i in range(1,N,2):
  if S[i] == "R":
    print("No")
    exit()
print("Yes")

Buggy submission (verdict: Runtime Error):
def lcs(s1, s2):
    dp = []
    for s2_k in s2:
        bgn_idx = 0
        for i, cur_idx in enumerate(dp):
            chr_idx = s1.find(s2_k, bgn_idx) + 1
            if not chr_idx:
                break
            dp[i] = min(cur_idx, chr_idx)
            bgn_idx = cur_idx
        else:
            chr_idx = s1.find(s2_k, bgn_idx) + 1
            if chr_idx:
                dp.append(chr_idx)
    return len(dp)

def solve():
    N = int(input())
    S = input()
    ans = 0
    for i in range(1,N):
      S1 = S[:i]
      S2 = S[i:]
      ans = max(ans,lcs(S1, S2))
    print(ans)

if __name__ == '__main__':
    solve()
Problem p02936 (python)

Fixed submission:
from collections import deque
import sys
input = sys.stdin.readline
N, Q = map(int, input().split())
table = [[] for i in range(N)]
for i in range(N-1):
  a,b = map(int, input().split())
  a -= 1
  b -= 1
  table[a].append(b)
task = [0]*N
count = [0]*N
for i in range(Q):
  p,x = map(int,input().split())
  p -= 1
  task[p] += x
H = deque()
H.append(0)
while H:
  y = H.popleft()
  count[y] += task[y]
  for ny in table[y]:
    H.append(ny)
    count[ny] = count[y]
print(" ".join(map(str,count)))

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

N, Q = map(int, input().split())
table = [[] for i in range(N)]
for i in range(N-1):
  a,b = map(int, input().split())
  a -= 1
  b -= 1
  table[a].append(b)
  table[b].append(a)
task = [0]*N
point = [-1]*N
point[0] = 0
for i in range(Q):
  p,x = map(int, input().split())
  p -= 1
  task[p] += x
H = deque()
H.append(0)

while H:
  p = H.popleft()
  point[p] += task[p]
  for np in table[p]:
    if point[np] == -1:
      H.append(np)
      point[np] = point[p]

print(" ".join(map(str, point[i])))
Problem p03006 (python)

Fixed submission:
import collections

N = int(input())
xy = [list(map(int, input().split())) for _ in range(N)]
ans = N
if N == 1:
  print(1)
  exit()
pq = []

for i in range(N):
  for j in range(N):
    pq.append((xy[j][0]-xy[i][0], xy[j][1]-xy[i][1]))
c = collections.Counter(pq)
if c.most_common()[0][0] == (0,0):
  ans -= c.most_common()[1][1]
else:
  ans -= c.most_common()[0][1]
print(ans)

Buggy submission (verdict: Runtime Error):
import collections

N = int(input())
xy = [list(map(int, input().split())) for _ in range(N)]
ans = N
pq = []

for i in range(N):
  for j in range(N):
    pq.append((xy[j][0]-xy[i][0], xy[j][1]-xy[i][1]))
c = collections.Counter(pq)
if c.most_common()[0][0] == (0,0):
  ans -= c.most_common()[1][1]
else:
  ans -= c.most_common()[0][1]
print(ans)

Buggy submission (verdict: Runtime Error):
import collections

N = int(input())
xy = [list(map(int, input().split())) for _ in range(N)]
ans = N
pq = []

for i in range(N):
  for j in range(i+1, N):
    pq.append((xy[j][0]-xy[i][0], xy[j][1]-xy[i][1]))
c = collections.Counter(pq)
ans -= c.most_common()[0][1]
print(ans)