A. Choosing teams time limit/test 1 second memory limit per test 256 megabytes input standard input Output standard OU Tput
The Saratov state University Olympiad Programmers Training Center (SSU OPTC) has n students. For each student your know the number of times he/she has participated, the ACM ICPC World Programming Championship. According to the ACM ICPC rules, which can participate in the World Championship at most 5 times.
The head of the SSU OPTC are recently gathering teams to participate into the world championship. Each team must consist of the exactly three people, at which, any person cannot is a member of the two or more teams. What Maximum number of teams can the head make if it wants each team to participate in the world Championship with the SAM E members at the least k times? Input
The contains two integers, N and K (1≤n≤2000; 1≤k≤5). The next line contains n integers:y1, y2, ..., yn (0≤yi≤5), where Yi shows the number of the i-th person partic Ipated in the ACM ICPC World Championship. Output
Print a single number-the answer to the problem. Examples Input
5 2
0 4 5 1 0
Output
1
Input
6 4
0 1 2 3 4 5
Output
0
Input
6 5
0 0 0 0 0 0
Output
2
Note
In the ' one ' team could is made:the the fourth and the fifth participants.
In the second sample no teams could is created.
In the third sample two teams could is created. Any partition into two teams fits.
To participate in the number of games plus k, less than or equal to 5 of people, can form a few teams (each team must have three people, each person can only participate in a team)
Water
#include <iostream>
#include <deque>
#include <cstring>
#include <algorithm>
#include <stdio.h>
#include <map>
#include <vector>
#include <iomanip>
#include <string>
#include <cstring>
#include <functional>
#include <queue >
using namespace std;
int main ()
{
int n,m;
while (cin>>n>>m)
{
int ans=0,temp=5-m;
while (n--)
{
int temp2;
cin>>temp2;
if (temp2<=temp)
ans++;
}
cout<<ans/3<<endl;
}
return 0;
}