for i in range(int(input())):
x,y=map(int, input().split())
c=0
r=abs(x-y)
while r!=0:
if r>=5:
c=c+r//5
r=r%5
elif r>=2:
c+=r//2
r=r%2
else:
r-=1
c+=1
print(c)
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define fi first
#define se second
#define pb push_back
#define all(vr) vr.begin(), vr.end()
#define ll long long
#define vi vector<int>
#define mina *min_element
#define maxa *max_element
#define fast_in_out ios_base::sync_with_stdio(false); cin.tie(NULL);
const char nl = '\n';
const int maxN = 1e6 + 2;
const int minN = 1e5 + 10;
const int mod = 1e9 + 7;
const int INF = 1e18;
void solve()
{
int a,b; cin>>a>>b;
int tmp=abs(a-b);
int res=tmp/5;
tmp%=5;
res+=tmp/2;
tmp%=2;
cout<<res+tmp;
}
signed main()
{
fast_in_out;
system("color 2");
int t=1;
cin >> t;
while (t--)
{
solve();
cout<<nl;
}
return 0;
}
1465. Maximum Area of a Piece of Cake After Horizontal and Vertical Cuts | 501A - Contest |
160A- Twins | 752. Open the Lock |
1535A - Fair Playoff | 1538F - Interesting Function |
1920. Build Array from Permutation | 494. Target Sum |
797. All Paths From Source to Target | 1547B - Alphabetical Strings |
1550A - Find The Array | 118B - Present from Lena |
27A - Next Test | 785. Is Graph Bipartite |
90. Subsets II | 1560A - Dislike of Threes |
36. Valid Sudoku | 557. Reverse Words in a String III |
566. Reshape the Matrix | 167. Two Sum II - Input array is sorted |
387. First Unique Character in a String | 383. Ransom Note |
242. Valid Anagram | 141. Linked List Cycle |
21. Merge Two Sorted Lists | 203. Remove Linked List Elements |
733. Flood Fill | 206. Reverse Linked List |
83. Remove Duplicates from Sorted List | 116. Populating Next Right Pointers in Each Node |