#include<bits/stdc++.h>
using namespace std;
void solve(){
int x,y;
cin>>x>>y;
int ans=y/2+(y%2!=0);
int tmp=ans*15-y*4-x;
if(tmp<0){
tmp*=-1;
ans+=tmp/15+(tmp%15!=0);
}
cout<<ans<<endl;
}
int main(){
ios::sync_with_stdio(false), cin.tie(0), cout.tie(0);
int t;
cin>>t;
//t=1;
while(t--)solve();
return 0;
}
#include<bits/stdc++.h>
using namespace std;
void solve(){
int n;
cin>>n;
vector<char>c;
string s;
cin>>s;
string s1=s;
sort(s.begin(),s.end());
s=s.erase(unique(s.begin(),s.end())-s.begin());
map<char,char>mp;
for(int i=0;i<s.length();i++){
mp[s[i]]=s[s.length()-i-1];
}
for(auto i:s1)cout<<mp[i];
cout<<endl;
}
int main(){
ios::sync_with_stdio(false), cin.tie(0), cout.tie(0);
int t;
cin>>t;
//t=1;
while(t--)solve();
return 0;
}
#include<bits/stdc++.h>
#define int long long
using namespace std;
const int N=1e7+10;
void solve(){
int n;
cin>>n;
vector<int>a(n+1);
for(int i=1;i<=n;i++){
cin>>a[i];
}
map<tuple<int,int,int>,int>mp,flag;
for(int i=1;i<=n-2;i++){
mp[{a[i],a[i+1],a[i+2]}]++;
mp[{a[i],a[i+1],N}]++;
mp[{a[i],N,a[i+2]}]++;
mp[{N,a[i+1],a[i+2]}]++;
}
int ans=0,pos=0;
for(int i=1;i<=n-2;i++){
ans+=max(0ll,mp[{a[i],a[i+1],N}]-1)+max(0ll,mp[{a[i],N,a[i+2]}]-1)+max(0ll,mp[{N,a[i+1],a[i+2]}]-1);
if(mp[{a[i],a[i+1],a[i+2]}]>1&&flag[{a[i],a[i+1],a[i+2]}]==0)pos+=3*(mp[{a[i],a[i+1],a[i+2]}]-1)*(mp[{a[i],a[i+1],a[i+2]}]),flag[{a[i],a[i+1],a[i+2]}]=1;
}
ans-=pos;
ans/=2;
cout<<ans<<endl;
}
signed main(){
ios::sync_with_stdio(false), cin.tie(0), cout.tie(0);
int t;
cin>>t;
//t=1;
while(t--)solve();
return 0;
}
#include<bits/stdc++.h>
using namespace std;
const int N=1e7+10;
void solve(){
int n;
cin>>n;
string s;
cin>>s;
map<char,int>mp,hav;
for(int i=0;i<s.length();i++){
mp[s[i]]++;
}
if(n&1){cout<<"NO"<<endl;return ;}
int pos=0;
if(mp['N']&1)pos++;
if(mp['S']&1)pos++;
if(pos==1){cout<<"NO"<<endl;return ;}
pos=0;
if(mp['W']&1)pos++;
if(mp['E']&1)pos++;
if(pos==1){cout<<"NO"<<endl;return ;}
if(mp['W']==1&&mp['E']==1&&mp['S']==1&&mp['N']==1){
for(auto i:s){
if(i=='W'||i=='E')cout<<'R';
else cout<<'H';
}
cout<<endl;
return ;
}
vector<char>v;
for(int i=0;i<s.length();i++){
if(mp[s[i]]&1)v.push_back('R'),mp[s[i]]--;
else {
if(hav[s[i]]){
v.push_back('H');
hav[s[i]]--;
}
else {
v.push_back('R');
hav[s[i]]++;
}
}
}
bool f1=0,f2=0;
for(auto i:v){
if(i=='R')f1=1;
if(i=='H')f2=1;
}
if(f1&&f2){
for(auto i:v)cout<<i;
}
else {cout<<"NO"<<endl;return ;}
cout<<endl;
}
int main(){
ios::sync_with_stdio(false), cin.tie(0), cout.tie(0);
int t;
cin>>t;
//t=1;
while(t--)solve();
return 0;
}
#include<bits/stdc++.h>
using namespace std;
void solve(){
priority_queue<int>q;
int m,x;
cin>>m>>x;
int sum=0,ans=m;
for(int i=1;i<=m;i++){
int a;
cin>>a;
sum-=a;
q.push(a);
if(sum<0){
sum+=q.top(),q.pop();
ans--;
}
sum+=x;
}
cout<<ans<<endl;
}
int main(){
ios::sync_with_stdio(false), cin.tie(0), cout.tie(0);
int t;
cin>>t;
//t=1;
while(t--)solve();
return 0;
}