全部都是WA
#include <bits/stdc++.h>
using namespace std;
const int N = 1e5 + 10;
struct man{
int price,T;
}a[N];
int main(){
//freopen("bus.in","r",stdin);
//freopen("bus.out","w",stdout);
int n,x=0,y=0,ans=0,w,p,t;
cin >> n;
while (n--){
cin >> w >> p >> t;
if (w == 0){
a[x].price = p;
a[x].T = t;
x++;
ans += p;
}else if (w == 1){
int cnt=0;
for (int i=y; i<x; i++){
if (a[i].price >= p && t - a[i].T <= 45){
cnt++;
y++;
}
}
if (cnt == 0){
ans += p;
}
}
}
cout << ans;
return 0;
}