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

Fixed submission:
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

n,a,b,k=map(int,input().split())
m=998244353
count=0

g1=[1,1]
g2=[1,1]
inverse=[0,1]

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

for j1 in range(n+1):
  if (k-a*j1)%b==0:
    j2=(k-a*j1)//b
    count+=cmb(n,j1,m)*cmb(n,j2,m)
  count%=m
print(count)

Buggy submission (verdict: Runtime Error):
def cmb(n,r,mod):
    r=min(r,n-r)
    return g1[n]*g2[r]*g2[n-r]%mod

n,a,b,k=map(int,input().split())
m=998244353
count=0

g1=[1,1]
g2=[1,1]
inverse=[0,1]

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

for i in range(n):
  if (k-a*i)%b==0 and (k-a*i)//b<=n:
    j=(k-a*i)//b
    count+=cmb(n,i,m)*cmb(n,j,m)
  count%=m
print(count)
Problem p03634 (python)

Fixed submission:
import sys
sys.setrecursionlimit(1000000)

def dfs(l,d,k):
  for i in l[k]:
    if d[i[0]]==-1:
      d[i[0]]=d[k]+i[1]
      dfs(l,d,i[0])

n=int(input())
l=[[] for i in range(n)]
for i in range(n-1):
  a,b,c=map(int,input().split())
  l[a-1].append([b-1,c])
  l[b-1].append([a-1,c])
q,k=map(int,input().split())
d=[-1 for i in range(n)]
d[k-1]=0
dfs(l,d,k-1)
L=[list(map(int,input().split())) for i in range(q)]
for i in range(q):
  print(d[L[i][0]-1]+d[L[i][1]-1])

Buggy submission (verdict: Runtime Error):
def dfs(l,d,k):
  for i in l[k]:
    if d[i[0]]==-1:
      d[i[0]]=d[k]+i[1]
      dfs(l,d,i[0])

n=int(input())
l=[[] for i in range(n)]
for i in range(n-1):
  a,b,c=map(int,input().split())
  l[a-1].append([b-1,c])
  l[b-1].append([a-1,c])
q,k=map(int,input().split())
d=[-1 for i in range(n)]
d[k-1]=0
dfs(l,d,k-1)
L=[list(map(int,input().split())) for i in range(q)]
for i in range(q):
  print(d[L[i][0]-1]+d[L[i][1]-1])
Problem p03705 (python)

Fixed submission:
n,a,b=map(int,input().split())
if a>b or (n==1 and a!=b):print(0)
else:print((n-2)*(b-a)+1)

Buggy submission (verdict: Runtime Error):
n,a,b=map(int,input().split())
if a>b:print(0)
elif n==1 and a!=b:print(0)
else:print((n-2)*(b-a)+1)​
Problem p03776 (python)

Fixed submission:
import math
n,a,b=map(int,input().split())
v=list(map(int,input().split()))
v.sort()
v.reverse()
if a==n:
  print(sum(v)/n)
  print(1)
elif v[a-1]!=v[a]:
  print(sum(v[0:a])/a)
  print(1)
elif v[0]!=v[a-1]:
  print(sum(v[0:a])/a)
  ct1=0;ct2=0
  for i in range(n):
    if v[i]==v[a-1]:
      ct1+=1
      if i<a:
        ct2+=1
  print(math.factorial(ct1)//(math.factorial(ct1-ct2)*math.factorial(ct2)))
else:
  print(sum(v[0:a])/a)
  ct1=0;ans=0
  for i in range(n):
    if v[i]==v[a-1]:
      ct1+=1
  for i in range(a,min(ct1+1,b+1)):
    ans+=math.factorial(ct1)//(math.factorial(ct1-i)*math.factorial(i))
  print(ans)

Buggy submission (verdict: Runtime Error):
import math
n,a,b=map(int,input().split())
v=list(map(int,input().split()))
v.sort()
v.reverse()
if a==n:
  print(sum(v)/n)
  print(1)
elif v[a-1]!=v[a]:
  print(sum(v[0:a])/a)
  print(1)
elif v[0]!=v[a-1]:
  print(sum(v[0:a])/a)
  ct1=0;ct2=0
  for i in range(n):
    if v[i]==v[a-1]:
      ct1+=1
      if i<a:
        ct2+=1
  print(math.factorial(ct1)//(math.factorial(ct1-ct2)*math.factorial(ct2)))
else:
  print(sum(v[0:a])/a)
  ct1=0;ans=0
  for i in range(n):
    if v[i]==v[a-1]:
      ct1+=1
  for i in range(a,b+1):
    ans+=math.factorial(ct1)//(math.factorial(ct1-i)*math.factorial(i))
  print(ans)
Problem p03804 (python)

Fixed submission:
n,m=map(int,input().split())
a=[list(input()) for a in range(n)]
b=[list(input()) for a in range(m)]
c=0;d=0
for p in range(n-m+1):
  for q in range(n-m+1):
    if b[0]==a[p][q:q+m]:
      for r in range(m):
        if b[r]!=a[p+r][q:q+m]:d+=1
      if d==0:c=1
      else:d=0
if c==0:print('No')
else:print('Yes')

Buggy submission (verdict: Runtime Error):
n,m=map(int,input().split())
a=[list(input()) for a in range(n)]
b=[list(input()) for a in range(m)]
c=0
for p in range(n-m+1):
  for q in range(n-m+1):
    if b[0]==a[p][q:q+m]:
      for r in range(1,m):
        if b[r]!=a[p+r][q:q+m]:break
       c=1
       break
if c==0:print('No')
else:print('Yes')

Buggy submission (verdict: Runtime Error):
n,m=map(int,input().split())
a=[list(input()) for a in range(n)]
b=[list(input()) for a in range(m)]
c=0
for p in range(n-m+1):
  for q in range(n-m+1):
    if b[0]==a[p][q:q+m]:
      for r in range(n-m+1):
        if b[r]!=a[p+r][q-m+1:q]:pass
        else:break
        c=1
if c==1:print('Yes')
else:print('No')
Problem p02550 (python)

Fixed submission:
N,X,M=map(int,input().split())

seen=[-2]*M
seen[X]
A=[X]
i=1
while(i<N):
    T=A[-1]**2%M
    if seen[T]!=-2:
        Roop=i-seen[T]
        Left,Right=seen[T],i
        break
    A.append(T)
    seen[T]=i
    i+=1

if i==N:
    print(sum(A))
    exit()

Roopsum=0
for i in range(Left,Right):
    Roopsum+=A[i]

Rest=N-len(A)

ans=sum(A)

ans+=Rest//Roop*Roopsum

for i in range(Rest%Roop):
    ans+=T
    T=T**2%M
print(ans)

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

seen=[-2]*M
seen[X]
A=[X]
i=1
while(i<N):
    T=A[-1]**2%M
    if seen[T]!=-2:
        Roop=i-seen[T]
        Left,Right=seen[T],i
        break
    A.append(T)
    seen[T]=i
    i+=1

if i==N:
    print(sum(A)+T)
    exit()

Roopsum=0
for i in range(Left,Right):
    Roopsum+=A[i]

Rest=N-len(A)

ans=sum(A)

ans+=Rest//Roop*Roopsum

for i in range(Rest%Roop):
    ans+=T
    T=T**2%M
print(ans)
Problem p02570 (python)

Fixed submission:
D,T,S=map(int,input().split())

if T*S>=D:
    print('Yes')
else:
    print('No')

Buggy submission (verdict: Runtime Error):
import sys,itertools,collections,bisect
from collections import deque,Counter,defaultdict
from heapq import heappush,heappop,heapify
read=sys.stdin.readline
sys.setrecursionlimit(10**6)

MOD=10**9+7
N=int(input())
A=list(map(int,input().split()))
cum=[0]*(N+1)
for i in range(N):
    cum[i+1]=(cum[i]+A[i])%MOD

ans=0
for i in range(N):
    res=(cum[N]-cum[i+1]+MOD)%MOD*A[i]%MOD
    ans=(ans+res)%MOD
print(ans)
Problem p02623 (python)

Fixed submission:
from bisect import bisect_left
N,M,K=map(int,input().split())
A=list(map(int,input().split()))
B=list(map(int,input().split()))

cumA=[0]*(N+1)
cumB=[0]*(M+1)

for i in range(N):
    cumA[i+1]=cumA[i]+A[i]
for i in range(M):
    cumB[i+1]=cumB[i]+B[i]

ans=0
for i in range(N+1):
    r=K-cumA[i]
    if r<0:
        break
    b=bisect_left(cumB,r)
    if b==M+1:
        ans=max(ans,i+M)
    else:
        if cumB[b]!=r:
            b-=1
        ans=max(ans,i+b)
print(ans)

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

i,j=0,0
time=0
cnt=0

while time<K and (i<N or j<M):
    if i==N:
        if time+B[j]>K:
            break
        time+=B[j]
        cnt+=1
        j+=1
    elif j==N:
        if time+A[i]>K:
            break
        time+=A[i]
        cnt+=1
        i+=1
    elif A[i]<B[j]:
        if time+A[i]>K:
            break
        time+=A[i]
        cnt+=1
        i+=1
    elif B[j]<A[i]:
        if time+B[j]>K:
            break
        time+=B[j]
        cnt+=1
        j+=1
    else:
        if time+A[i]>K:
            break
        if j==M-1 and i==N-1:
            time+=A[i]
            cnt+=1
            i+=1
        elif j==M-1:
            time+=A[i]
            cnt+=1
            i+=1
        elif i==N-1:
            time+=B[j]
            cnt+=1
            j+=1
        else:
            if A[i+1]<B[j+1]:
                time+=A[i]
                cnt+=1
                i+=1
            elif A[i+1]>B[j+1]:
                time+=B[j]
                cnt+=1
                j+=1
            else:
                time+=A[i]
                cnt+=1
                i+=1
print(cnt)
Problem p02679 (python)

Fixed submission:
from collections import Counter
import math
MOD=10**9+7
N=int(input())
li=[]
zcnt=0
az,bz=0,0
for i in range(N):
    A,B=map(int,input().split())
    if A==0 and B==0:
        zcnt+=1
        continue
    if A!=0 and B==0:
        bz+=1
        continue
    elif A==0 and B!=0:
        az+=1
        continue
    g=math.gcd(A,B)
    if A<0 and B<0:
        li.append((-(A//g),-(B//g)))
    elif A<0 and B>0:
        li.append((-(A//g),-(B//g)))
    else:
        li.append((A//g,B//g))
c=Counter(li)
dic={}
ans=(pow(2,az,MOD)+pow(2,bz,MOD)-1+MOD)%MOD
for a,b in c.keys():
    if (a,b) in dic:
        continue
    l,r=(-b,a),(b,-a)
    s=c.get(l,0)+c.get(r,0)
    dic[l],dic[r]=1,1
    res=(pow(2,c[(a,b)],MOD)+pow(2,s,MOD)-1+MOD)%MOD
    ans=(ans*res)%MOD
print((ans-1+zcnt)%MOD)

Buggy submission (verdict: Runtime Error):
from collections import Counter
import math
MOD=10**9+7
N=int(input())
li=[]
for i in range(N):
    A,B=map(int,input().split())
    g=math.gcd(A,B)
    li.append((A//g,B//g))
c=Counter(li)
dic={}
ans=1
for a,b in c.keys():
    if (a,b) in dic:
        continue
    l,r=(-b,a),(b,-a)
    s=c.get(l,0)+c.get(r,0)
    dic[l],dic[r]=1,1
    res=(pow(2,c[(a,b)],MOD)+pow(2,s,MOD)-1)%MOD
    ans=(ans*res)%MOD
print(ans-1)
Problem p02759 (python)

Fixed submission:
N=int(input())
if(N%2==1):
    print((N//2)+1)
else:
    print(N//2)

Buggy submission (verdict: Runtime Error):
from collections import deque
import collections
from collections import Counter
import bisect
import math
import fractions
import itertools
import scipy
import numpy
from scipy.special import comb

N=int(input())
if(N%2==1):
    print((N//2)+1)
else:
    print(N//2)
Problem p02793 (python)

Fixed submission:
MOD=10**9+7
def factorization(n):
    arr=[]
    tmp=n
    for i in range(2,int(n**0.5)+1):
        if(tmp%i==0):
            cnt=0
            while tmp%i==0:
                cnt+=1
                tmp//=i
            arr.append([i,cnt])
    if(not arr):
        arr.append([1,1])
    if(tmp!=1):
        arr.append([tmp,1])
    return arr
def moddiv(a,m):
    return pow(a,m-2,m)
N=int(input())
A=list(map(int,input().split()))
cnt={}
for i in range(N):
    arr=factorization(A[i])
    for a,b in arr:
        cnt[a]=max(cnt.get(a,0),b)
g=1;res=0
for k,v in cnt.items():
    g=g*(pow(k,v,MOD))%MOD
for i in range(N):
    res=(res+(g*moddiv(A[i],MOD))%MOD)%MOD
print(res)

Buggy submission (verdict: Runtime Error):
MOD=10**9+7
def factorization(n):
    arr=[]
    tmp=n
    for i in range(2,int(n**0.5)+1):
        if(tmp%i==0):
            cnt=0
            while tmp%i==0:
                cnt+=1
                tmp//=i
            arr.append([i,cnt])
    if(not arr):
        arr.append([1,1])
    if(tmp!=1):
        arr.append([tmp,1])
    return arr
def moddiv(a,m):
    return pow(a,m-2,m)
N=int(input())
A=list(map(int,input().split()))
cnt=[0]*1001
for i in range(N):
    arr=factorization(A[i])
    for a,b in arr:
        cnt[a]=max(cnt[a],b)
g=1;res=0
for i in range(1001):
    g=g*(pow(i,cnt[i],MOD))%MOD
for i in range(N):
    res=(res+(g*moddiv(A[i],MOD))%MOD)%MOD
print(res)

Buggy submission (verdict: Runtime Error):
MOD=10**9+7
def factorization(n):
    arr=[]
    tmp=n
    for i in range(2,int(n**0.5)+1):
        if(tmp%i==0):
            cnt=0
            while tmp%i==0:
                cnt+=1
                tmp//=i
            arr.append([i,cnt])
    if(not arr):
        arr.append([1,1])
    if(tmp!=1):
        arr.append([tmp,1])
    return arr
def moddiv(a,m):
    return pow(a,m-2,m)
N=int(input())
A=list(map(int,input().split()))
cnt=[0]*1001
for i in range(N):
    arr=factorization(A[i])
    for a,b in arr:
        cnt[a]=max(cnt[a],b)
g=1;res=0
for i in range(1001):
    g=g*(i**cnt[i])%MOD
for i in range(N):
    res=(res+g*moddiv(A[i],MOD))%MOD
print(res)

Buggy submission (verdict: Runtime Error):
import math
import fractions
N=int(input())
A=list(map(int,input().split()))
tmp=A[0]
ans=0

for i in range(N):
    tmp=math.floor((tmp*A[i])/(fractions.gcd(tmp,A[i])))

for i in range(N):
    ans+=(tmp/A[i])
    ans%=1000000007
    
print(int(ans))

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

for i in range(N):
    tmp=math.floor((tmp*A[i])/(math.gcd(tmp,A[i])))

for i in range(N):
    ans+=(tmp/A[i])
    ans%=1000000007
    
print(int(ans))
Problem p02835 (python)

Fixed submission:
A=list(map(int,input().split()))
if(sum(A)>21):
    print("bust")
else:
    print("win")

Buggy submission (verdict: Runtime Error):
MOD=10**9+7
N=int(input())
A=list(map(int,input().split()))
bit=[[0]*60 for i in range(N+1)]
for i in range(1,N+1):
    for j in range(60):
        if(A[i-1]>>j&1):
            bit[i][j]=bit[i-1][j]+1
        else:
            bit[i][j]=bit[i-1][j]
res=0
for i in range(N):
    for j in range(60):
        if not (A[i]>>j&1):
            res=(res+(2**j)*bit[i][j])%MOD
        else:
            res=(res+(2**j)*(i-bit[i][j]))%MOD
print(res)
Problem p02873 (python)

Fixed submission:
S=input()
n=len(S)
A=[0]*(n+1)
for i in range(n):
    if(S[i]=='<'):
        A[i+1]=A[i]+1
for i in reversed(range(n)):
    if(S[i]=='>'):
        A[i]=max(A[i],A[i+1]+1)
print(sum(A))

Buggy submission (verdict: Runtime Error):
S=input()
li=[]
cnt=1
now=S[0]
for i in range(1,len(S)):
    if(S[i]==now):
        cnt+=1
        if(i==len(S)-1):
            li.append([now,cnt])
    else:
        li.append([now,cnt])
        now=S[i]
        cnt=1
        if(i==len(S)-1):
            li.append([now,cnt])
res=0
if(li[0][0]=='>'):
    res+=li[0][1]
if(li[-1][0]=='<'):
    res+=li[-1][1]
for i in range(len(li)-1):
    if(li[i][0]=='<' and li[i+1][0]=='>'):
        max_=max(li[i][1],li[i+1][1])
        min_=min(li[i][1],li[i+1][1])
        res+=((max_+1)*max_)//2
        res+=((min_)*(min_-1))//2
print(res)
Problem p02933 (python)

Fixed submission:
a=int(input())
s=input()
if(a>=3200):
    print(s)
else:
    print("red")

Buggy submission (verdict: Runtime Error):
import sys
sys.setrecursionlimit(10**6)
def dfs(G,v,p):
    for nv in G[v]:
        if(nv==p):
            continue
        point[nv]+=point[v]
        dfs(G,nv,v)

N,Q=map(int,input().split())
G=[[] for i in range(N)]
for i in range(N-1):
    a,b=map(lambda x:int(x)-1,input().split())
    G[a].append(b)
    G[b].append(a)
point=[0]*N
for i in range(Q):
    p,x=map(int,input().split())
    point[p-1]+=x
dfs(G,0,-1)
print(*point)
Problem p03045 (python)

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

def update(v):
    for nv in con[v]:
        if seen[nv]:
            continue
        seen[nv]=1
        update(nv)

N,M=map(int,input().split())
seen=[0]*N
con=[[] for i in range(N)]
cnt=[[i,0] for i in range(N)]
for i in range(M):
    X,Y,Z=map(int,input().split())
    X,Y=X-1,Y-1
    con[X].append(Y)
    con[Y].append(X)
    cnt[X][1]+=1
    cnt[Y][1]+=1
cnt.sort(key=lambda x:x[1],reverse=True)
ans=0
for i,a in cnt:
    if(seen[i]):
        continue
    ans+=1
    seen[i]=1
    update(i)
print(ans)

Buggy submission (verdict: Runtime Error):
def update(v):
    for nv in con[v]:
        if seen[nv]:
            continue
        seen[nv]=1
        update(nv)

N,M=map(int,input().split())
seen=[0]*N
con=[[] for i in range(N)]
cnt=[[i,0] for i in range(N)]
for i in range(M):
    X,Y,Z=map(int,input().split())
    X,Y=X-1,Y-1
    con[X].append(Y)
    con[Y].append(X)
    cnt[X][1]+=1
    cnt[Y][1]+=1
cnt.sort(key=lambda x:x[1],reverse=True)
ans=0
for i,a in cnt:
    if(seen[i]):
        continue
    ans+=1
    seen[i]=1
    update(i)
print(ans)
Problem p03326 (python)

Fixed submission:
N,M=map(int,input().split())
c=[list(map(int,input().split())) for i in range(N)]

bit=[[] for i in range(2**3)]
for k in range(N):
    for i in range(2**3):
        t=c[k].copy()
        for j in range(3):
            if(i>>j&1):
                t[j]*=-1
        bit[i].append(t)
for i in range(2**3):
    bit[i].sort(key=lambda x:(x[0]+x[1]+x[2]),reverse=True)
res=0
for i in range(2**3):
    p=[1,1,1]
    for j in range(3):
        if(i>>j&1):
            p[j]*=-1
    z,o,t=0,0,0
    for k in range(M):
        z+=bit[i][k][0]*p[0]
        o+=bit[i][k][1]*p[1]
        t+=bit[i][k][2]*p[2]
    res=max(res,abs(z)+abs(o)+abs(t))
print(res)

Buggy submission (verdict: Runtime Error):
N,M=map(int,input().split())
c=[list(map(int,input().split())) for i in range(N)]

bit=[[] for i in range(2**3)]
for k in range(N):
    for i in range(2**3):
        t=c[k].copy()
        for j in range(3):
            if(i>>j&1):
                t[j]*=-1
        bit[i].append(t)
for i in range(2**3):
    bit[i].sort(key=lambda x:(x[0],x[1],x[2]),reverse=True)
res=0
for i in range(2**3):
    p=[1,1,1]
    for j in range(3):
        if(i>>j&1):
            p[j]*=-1
    z,o,t=0,0,0
    for k in range(M):
        z+=bit[i][k][0]*p[0]
        o+=bit[i][k][1]*p[1]
        t+=bit[i][k][2]*p[2]
    res=max(res,abs(z)+abs(o)+abs(t))
print(res)
Problem p02549 (python)

Fixed submission:
import math
import sys
import os
# import numpy as np

sys.setrecursionlimit(10**7)

def _S(): return sys.stdin.readline().rstrip()
def I(): return int(_S())
def LS(): return list(_S().split())
def LI(): return list(map(int,LS()))

if os.getenv("LOCAL"):
    inputFile = basename_without_ext = os.path.splitext(os.path.basename(__file__))[0]+'.txt'
    sys.stdin = open(inputFile, "r")
INF = float("inf")
MOD = 998244353    

# もらうDP, 区間の和を足しこむ
N,K = LI()
LRs = [LI() for _ in range(K)]

# S = set()
# for LR in LRs:
#     for i in range(LR[0],LR[1]+1):
#         S.add(i)

# cell = [0]*(N)
# cell[0] = 1

# Sa = sorted(list(S),reverse=True)
# for i in range(N):
#     for s in S:
#         if i+s<N:
#             cell[i+s]+=cell[i]

dp = [0]*(N+1)
# 組み合わせの数の累積和(区間和を足しこむため)
cum = [0]*(N+1)
dp[1] = 1
cum[1] = 1
for i in range(2, N+1):
    for j in range(K):
        l, r = LRs[j]
        start = max(0,i-r-1)
        end = max(0,i-l)
        # print('l,r: ',l,r)
        # print('start,end', start,end)
        dp[i] += cum[end] - cum[start]
        # dp[i] += cum[i-l]
        # if i - l >= 0:
        #     dp[i] += cum[i-l]
        # if i - (r+1) >= 0:
        #     dp[i] -= cum[i-(r+1)]
    # dp[i] = (dp[i] % MOD + MOD) % MOD
    dp[i] %= MOD
    # 累積和を更新
    cum[i] = (cum[i-1] + dp[i]) % MOD
print(dp[N])

# for s in Sa:
#     i = 0
#     while i+s<N:
#         # print(i,s)
#         cell[i+s] += cell[i]
#         i += 1
#     print(s,cell)
# ans = cell[-1]
# print(ans)

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

sys.setrecursionlimit(10**7)

def _S(): return sys.stdin.readline().rstrip()
def I(): return int(_S())
def LS(): return list(_S().split())
def LI(): return list(map(int,LS()))

if os.getenv("LOCAL"):
    inputFile = basename_without_ext = os.path.splitext(os.path.basename(__file__))[0]+'.txt'
    sys.stdin = open(inputFile, "r")
INF = float("inf")
MOD = 998244353    

N,K = LI()
LRs = [LI() for _ in range(K)]

S = set()
for LR in LRs:
    for i in range(LR[0],LR[1]+1):
        S.add(i)

cell = [0]*(N)
cell[0] = 1

# Sa = sorted(list(S),reverse=True)
for i in range(N):
    for s in S:
        if i+s<N:
            cell[i+s]+=cell[i]


# for s in Sa:
#     i = 0
#     while i+s<N:
#         # print(i,s)
#         cell[i+s] += cell[i]
#         i += 1
#     print(s,cell)
ans = cell[-1]
print(ans)
Problem p02594 (python)

Fixed submission:
import bisect,collections,copy,heapq,itertools,math,string
from collections import defaultdict as D
from functools import reduce
import numpy as np
from numba import njit
import sys
sys.setrecursionlimit(10**7)

def _S(): return sys.stdin.readline().rstrip()
def I(): return int(_S())
def LS(): return list(_S().split())
def LI(): return list(map(int,LS()))

X = I()
if X >= 30:
    ans = True
else:
    ans = False

if ans:
    print('Yes')
else:
    print('No')

Buggy submission (verdict: Runtime Error):
import numpy as np
import sys
sys.setrecursionlimit(10**7)

def _S(): return sys.stdin.readline().rstrip()
def I(): return int(_S())
def LS(): return list(_S().split())
def LI(): return list(map(int,LS()))

N,Q = LI()
_c = LI()
_lr = [LI() for _ in range(Q)]
lr = np.array(_lr)
c = np.zeros(N + 1)
c[1:] = _c

for pair in lr:
    print(len(set(c[pair[0]:pair[1]+1])))
Problem p02624 (python)

Fixed submission:
import math
import sys
import os
from operator import mul
import numpy as np
# import sympy

sys.setrecursionlimit(10**7)

def _S(): return sys.stdin.readline().rstrip()
def I(): return int(_S())
def LS(): return list(_S().split())
def LI(): return list(map(int,LS()))

if os.getenv("LOCAL"):
    inputFile = basename_without_ext = os.path.splitext(os.path.basename(__file__))[0]+'.txt'
    sys.stdin = open(inputFile, "r")
INF = float("inf")

N = I()
ans = 0

# 足し方の見方を変える。等差数列の和をKまで足す
# 1 + 2 + 3 + 4 +...
#   + 2     + 4 +...
for i in range(1,N+1):
    # Nを超えない整数
    y = N//i
    sum = y*(y+1)*i/2
    ans += sum

print(int(ans))





# 素数 エラトステネス
def seachPrimeNum(N):
   max = int(np.sqrt(N))
   seachList = [i for i in range(2,N+1)]
   primeNum = []
   while seachList[0] <= max:
       primeNum.append(seachList[0])
       tmp = seachList[0]
       seachList = [i for i in seachList if i % tmp != 0]
   primeNum.extend(seachList)
   return primeNum

# 約数
def divisor_count(n):
    divisors = 0
    for i in range(1, int(n**0.5)+1):
        if n % i == 0:
            divisors += 1
            if i != n // i:
                divisors += 1

    return divisors

Buggy submission (verdict: Runtime Error):
import math
import sys
import os
from operator import mul
import sympy

sys.setrecursionlimit(10**7)

def _S(): return sys.stdin.readline().rstrip()
def I(): return int(_S())
def LS(): return list(_S().split())
def LI(): return list(map(int,LS()))

if os.getenv("LOCAL"):
    inputFile = basename_without_ext = os.path.splitext(os.path.basename(__file__))[0]+'.txt'
    sys.stdin = open(inputFile, "r")
INF = float("inf")

# 約数
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 = I()
ans = 0

for i in range(1,N+1):
    ans += i * sympy.divisor_count(i)
    # print(i,sympy.divisor_count(i))

print(ans)