Problem p02948 (python)

Fixed submission:
class Work:
    count=0
    def __init__(self,payday,money):
        Work.count+=1
        self.count=Work.count
        self.payday=payday
        self.money=money
 #moneyが大きい方、同じなら早くもらえる方、それも同じなら最初に書いてある方が強い方
    def __ft__(self,other):
        if self.money>other.money:
            return True
        if self.money==other.money:
            if self.payday<other.payday:
                return True
            if self.payday==other.payday:
                if self.count<other.count:
                    return True
        return False

    def __gt__(self,other):
        if self.money<other.money:
            return True
        if self.money==other.money:
            if self.payday>other.payday:
                return True
            if self.payday==other.payday:
                if self.count>other.count:
                    return True
        return False

#バイトの数、いつまでに稼ぐのか 
n,limit=[int(i) for i in input().split()]

#バイトのリストを作り、クラスを入れる O(n)
baitolist=[]
for i in range(n):
    payday,money=[int(i) for i in input().split()]
    work=Work(payday,money)
    baitolist.append(work)

#日数でランク付け　O(n)
summoney=0    
rank=[[] for i in range(limit+1)]
for baito in baitolist:
    if baito.payday<=limit:
        rank[baito.payday].append(baito)

        
import heapq
accessible=[]
count=1


for i in range(limit):
    for baito in rank[count]:
        heapq.heappush(accessible,baito)
    if accessible!=[]:
        dowork=heapq.heappop(accessible)
        summoney+=dowork.money
    count+=1
    
    
print(summoney)

Buggy submission (verdict: Runtime Error):
import heapq

class job:
    def __init__(self,name,date,award):
        self.name=name
        self.award=award
        self.date=date
    def __gt__(self,other):
        if self.award<other.award:
            return True
        elif self.award==other.award and self.date<other.date:
            return True
        elif self.award==other.award and self.date=other.date and self.name>other.name:
            return True
        else:
            return False
    def __lt__(self,other):
        if self.award>other.award:
            return True
        elif self.award==other.award and self.date>other.date:
            return True
        elif self.award==other.award and self.date=other.date and self.name<other.name:
            return False
        else:
            return False

jobs=[]
n,m=[int(i) for i in input().split()]
for i in range(n):
    info=[int(j) for j in input().split()]
    jobs.append(job(i,info[0],info[1]))
heapq.heapify(jobs)
ans=0
for i in range(m):
    while jobs:
        work=heapq.heappop(jobs)
#         print(work.award)
        if work.date+i<=m:
            ans+=work.award
            break
        
        
print(ans)

Buggy submission (verdict: Runtime Error):
class Work:
    count=0
    def __init__(self,payday,money):
        Work.count+=1
        self.count=count
        self.payday=payday
        self.money=money
 #moneyが大きい方、同じなら早くもらえる方、それも同じなら最初に書いてある方が強い方
    def __ft__(self,other):
        if self.money>other.money:
            return True
        if self.money==other.money:
            if self.payday<other.payday:
                return True
            if self.payday==other.payday:
                if self.count<other.count:
                    return True
        return False

    def __gt__(self,other):
        if self.money<other.money:
            return True
        if self.money==other.money:
            if self.payday>other.payday:
                return True
            if self.payday==other.payday:
                if self.count>other.count:
                    return True
        return False

#バイトの数、いつまでに稼ぐのか 
n,limit=[int(i) for i in input().split()]

#バイトのリストを作り、クラスを入れる O(n)
baitolist=[]
for i in range(n):
    payday,money=[int(i) for i in input().split()]
    work=Work(payday,money)
    baitolist.append(work)

#日数でランク付け　O(n)
summoney=0    
rank=[[] for i in range(limit+1)]
for baito in baitolist:
    if baito.payday<=limit:
        rank[baito.payday].append(baito)

        
import heapq
accessible=[]
count=1


for i in range(limit):
    for baito in rank[count]:
        heapq.heappush(accessible,baito)
    if accessible!=[]:
        dowork=heapq.heappop(accessible)
        summoney+=dowork.money
    count+=1
    
    
print(summoney)

Buggy submission (verdict: Runtime Error):
class Work:
    count=0
    def __init__(self,payday,money):
        Work.count+=1
        self.count=count
        self.payday=payday
        self.money=money
 #moneyが大きい方、同じなら早くもらえる方、それも同じなら最初に書いてある方が強い方
    def __gt__(self,other):
        if self.money>other.money:
            return True
        if self.money==other.money:
            if self.payday<other.payday:
                return True
            if self.payday==other.payday:
                if self.count<other.count:
                    return True
        return False

    def __ft__(self,other):
        if self.money<other.money:
            return True
        if self.money==other.money:
            if self.payday>other.payday:
                return True
            if self.payday==other.payday:
                if self.count>other.count:
                    return True
        return False

#     def __eq__(self,other):
#         if self.money==other.money and self.payday==other.payday:
#             return True
#         return False
#     def __fe__(self,other):
#         return self.__ft__(other) or self.__eq__(other)
#     def __ge__(self,other):
#         return self.__gt__(other) or self.__eq__(other)

#バイトの数、いつまでに稼ぐのか 
n,limit=[int(i) for i in input().split()]

#バイトのリストを作り、クラスを入れる O(n)
baitolist=[]
for i in range(n):
    payday,money=[int(i) for i in input().split()]
    work=Work(payday,money)
    baitolist.append(work)

#日数でランク付け　O(n)
summoney=0    
rank=[[] for i in range(limit+1)]
for baito in baitolist:
    if baito.payday<=limit:
        rank[baito.payday].append(baito)

accessible=[]
count=1
while baitolist and count<=limit:#最悪O(limit)
    for baito in rank[count]:
        accessible.append(baito)
    accessible.sort()
    if accessible!=[]:
        dowork=accessible.pop()
        summoney+=dowork.money
    count+=1
    
    
print(summoney)

Buggy submission (verdict: Runtime Error):
n,limit=[int(i) for i in input().split()]
baitolist=[[int(i) for i in input().split()] for j in range(n)]
baitodict={}
for i in range(1,limit+1):
    baitodict[str(i)]=[]
for baito in baitolist:
    if int(day)<=limit:
        day=str(baito[0])
        money=baito[1]
        baitodict[day].append(money)
        baitodict[day].sort()
# print(baitodict)

sumnum=0
for i in range(1,limit+1):
    maxindex=""
    maxmoney=0
    for j in range(1,i+1):
        if baitodict[str(j)]!=[]:
            a=baitodict[str(j)][-1]
            if maxmoney<a:
                maxmoney=a
                maxindex=str(j)
    if maxindex!="":
        baitodict[maxindex].pop()
    sumnum+=maxmoney
#     print(sumnum)
print(sumnum)