In this HackerEarth ICPC Team Management problem solution Little Chandan is an exceptional manager - apart from his role in HackerEarth - as the person who has to bug everyone, in general... and if possible, try to get some work done.

He's also offered a job as the coach of the best Russian teams participating in the ACM-ICPC World Finals. Now, Chandan is an extremely good coach, too. But he's a weird person who thrives on patterns in life, in general. So, he has decided that if there are n number of students in total, and he is supposed to divide them into camps of k students - he wants them to be arranged in such a way that the length of names of all the students in a camp is equal.

I know, totally weird, right?

## HackerEarth ICPC Team Management problem solution.

```tc = int(raw_input())
assert(tc>0 and tc<51)
for i in xrange(tc):
n, k = map(int, raw_input().split())
l = *1000
ok = True
assert(n>0 and n<1001)
assert(k>0 and k<1001)
assert(n>=k)
assert(n%k==0)
for j in xrange(n):
a = raw_input()
l[len(a)] +=1
for z in l:
if z%k!=0:
ok = False
break
if (ok):
print "Possible"
else:
print "Not possible"
```

### Second solution

```#include<bits/stdc++.h>
using namespace std;
#define ll              long long int
#define vi              vector<int>
#define vl              vector<ll>
#define pii             pair<int,int>
#define pil             pair<int, ll>
#define pll             pair<ll, ll>
#define pli             pair<ll, int>
#define pb(v, a)        v.push_back(a)
#define mp(a, b)        make_pair(a, b)
#define MOD             1000000007
#define rep(i, a, b)    for(i=a; i<=b; ++i)
#define rrep(i, a, b)   for(i=a; i>=b; --i)
#define si(a)           scanf("%d", &a)
#define sl(a)           scanf("%lld", &a)
#define pi(a)           printf("%d", a)
#define pl(a)           printf("%lld", a)
#define pn              printf("\n")
ll pow_mod(ll a, ll b)
{
ll res = 1;
while(b)
{
if(b & 1)
res = (res * a) % MOD;
a = (a * a) % MOD;
b >>= 1;
}
return res;
}
int cnt;
int main()
{
int t, i;
si(t);
rep(i, 1, t)
{
memset(cnt, 0, sizeof(cnt));
int n, k, j;
si(n);
si(k);
string str;
rep(j, 1, n)
{
cin>>str;
cnt[str.length()]++;
}
bool flag = true;
rep(j, 1, 100)
{
if(cnt[j] % k)
{
flag = false;
break;
}
}
if(flag)
cout<<"Possible\n";
else
cout<<"Not possible\n";
}
return 0;
}```