#include<stdio.h>
int main(){
	int t;
	scanf("%d",&t);
	while(t>0){
		int n,k,d;
		scanf("%d %d %d",&n,&k,&d);
		int a[n];
		int b[101];
		int max = k;
		int s = 0;
		for(int i = 0;i<101;i++){
			b[i] = 0;
		}
		for(int i = 0;i<n;i++) scanf("%d",&a[i]);
		for(int i = 0;i<n;i++){
			if(i+d>n) continue;
			for(int k = i;k-i<d;k++){
				b[a[k]]++;
			}
			for(int k = 0;k<101;k++){
				if(b[k]>0) s++;
				b[k] = 0;
			}
			max = max>s?s:max;
			s = 0;
		}
		printf("%d\n",max);
		t--;
	}
	return 0;
}

/*  AUTHOR:AKASH JAIN
*   USERNAME:akash19jain
*   DATE:26/10/2019
*/
// #include<algorithm>
// #include <bits/stdc++.h>
// using namespace std;

#include<stdio.h>
#include<math.h>
#include<string.h>
#include<stdlib.h>
#include<stdbool.h>
#include<ctype.h>
#define SC1(x)          scanf("%lld",&x)
#define SC2(x,y)        scanf("%lld%lld",&x,&y)
#define SC3(x,y,z)      scanf("%lld%lld%lld",&x,&y,&z)
#define SCS(x)          scanf("\n%s", x)
#define PF1(x)          printf("%lld\n",x)
#define PF2(x,y)        printf("%lld %lld\n",x,y)
#define PF3(x,y,z)      printf("%lld %lld %lld\n",x,y,z)
#define PFN                printf("\n")
#define REP(i,n)        for(long long i=0;i<(n);++i)
#define FOR(i,a,b)      for(long long i=(a);i<=(b);++i)
#define FORD(i,a,b)     for(long long i=(a);i>=(b);--i)
#define WHILE(n)        while(n--)
#define MEM(a, b)       memset(a, (b), sizeof(a))
#define ITOC(c)         ((char)(((ll)'0')+c))
#define MID(s,e)        (s+(e-s)/2)
#define SZ(a)            strlen(a)
#define MOD             1000000007
#define MAX             10000000005
#define MIN             -10000000005
#define PI              3.1415926535897932384626433832795
#define DEB(x)          printf("The value of \"%s\" is: %d\n",#x,x)
#define CASES           ll t;SC1(t);while(t--)
#define ABS(a)          ((a>0)?a:-(a))
#define SWAP(a,b)        ll z=a;a=b;b=z
#define SWAPC(a,b)        char z=a;a=b;b=z

const int INF = 1<<29;
typedef long long ll;
typedef unsigned long long ull;
#define FILEIO(name) \  freopen(name".in", "r", stdin); \   freopen(name".out", "w", stdout);
int cmp(const void * a,const void * b);
long long maxv(long long a,long long b);
long long minv(long long a,long long b);
long long gcd(long long u,long long v);
long long digits(long long n);
bool isPoweroftwo(long long n);
int count[1000001];
int main()
{
    CASES
    {
        ll n,k,d;
        SC3(n,k,d);
        ll arr[n];
        REP(i,n)
            SC1(arr[i]);
        ll min=MAX,c=0;
        MEM(count,0);
        REP(i,d)
        {
            ll x=arr[i];
            if(count[x]==0)
                c++;
            count[x]++;
        }
        min=c;
        FOR(i,d,n-1)
        {
            ll x=arr[i];
            if(count[x]==0)
                c++;
            count[x]++;
            x=arr[i-d];
            count[x]--;
            if(count[x]==0)
                c--;
            min=minv(c,min);
        }
        PF1(min);
    }
    return 0;
}

//qsort(arr,n,sizeof(arr[0]),cmp);
int cmp (const void * a, const void * b)
{
    if( *(ll*)a - *(ll*)b < 0 ) return -1;
    if( *(ll*)a - *(ll*)b > 0 ) return 1;
        return 0;
}
long long maxv(long long a,long long b)
{
    if(a>b) return a;
        return b;
}
long long minv(long long a,long long b)
{
    if(a<b) return a;
        return b;
}
long long gcd(long long u,long long v)
{
    if (v == 0) return u;
       return gcd(v, u%v);
}
long long digits(long long n)    //to calculate no of digits in a number
{
    return floor(log10(n))+1;
}
bool isPoweroftwo(long long x)
{
    return x && (!(x&(x-1)));
}

#include<stdio.h>
void mergesort(int arr[], int l, int r)
{
if (l < r)
{
int m = l+(r-l)/2;
mergesort(arr, l, m);
mergesort(arr, m+1,r);
merge(arr, l, m, r);
}
}
void merge(int arr[], int l, int m, int r)
{
int i, j, k;
int n1 = m - l + 1;
int n2 = r - m;
int L[n1], R[n2];
for (i = 0; i < n1; i++)
L[i] = arr[l + i];
for (j = 0; j < n2; j++)
R[j] = arr[m + 1+ j];
i = 0;
j = 0;
k = l;
while (i < n1 && j < n2)
{
if (L[i] <= R[j])
{
arr[k] = L[i];
i++;
}
else
{
arr[k] = R[j];
j++;
}
k++;
}
while (i < n1)
{
arr[k] = L[i];
i++;
k++;
}
while (j < n2)
{
arr[k] = R[j];
j++;
k++;
}
}
int distinct(int ar[],int n)
{
    int cnt=1;
    mergesort(ar,0,n-1);
    for(int i=0;i<n-1;i++)
    {
    if(ar[i]!=ar[i+1])
    cnt++;
    }
    //
    return cnt;
}
int nnn(int a,int b)
{
return (a<b)?a:b;
}
int main()
{
    int t,m;
    scanf("%d",&t);
    m=t-1;
    int arr[t];
    while(t--)
    {
    int n,k,d,min=1000000000,ccnt=0;
    scanf("%d%d%d",&n,&k,&d);
    int ar[n];
    for(int i=0;i<n;i++)
    scanf("%d",&ar[i]);
    for(int i=0;i<=n-d;i++)
    {
    int temp[d],z=0;
    for(int j=i;j<i+d;j++)
    temp[z++]=ar[j];
    ccnt=distinct(temp,d);
    if(ccnt<min)
    min=ccnt;
    }
    arr[t]=min;
    //printf("%d",ccnt);
    }
    for(int i=m;i>=0;i--)
    printf("%d\n",arr[i]);
    /*char s[n+1],ch[5]={'A','C','T','G','\0'};
    scanf("%s",s);
    s[n]='\0';
    for(int i=0;i<=n-4;i++)
    {
    int a=0,b=0,cnt=0,z=0;
    for(int j=i;j<i+4;j++)
    {
    a=abs(ch[z]-s[j]);
    if(s[j]>ch[z])
    b=abs(91-s[j]+ch[z]-65);
    else
    b=abs(91-ch[z]+s[j]-65);
    z++;
    //printf("%d %d\n",a,b);
    cnt+=nnn(a,b);
    }
    //printf("%d\n",cnt);
    if(cnt<min)
    min=cnt;
    }
    printf("%d",min);
    /*int ar[n],a=0,T,min=1000000000;
    for(int i=0;i<n;i++)
    scanf("%d",&ar[i]);
    mergesort(ar,0,n-1);
    for(int t=1;t<=100;t++)
    {
    a=0;
    for(int j=0;j<n;j++)
    {
    if(ar[j]<t)
    a+=t-1-ar[j];
    else if(t<ar[j])
    a+=ar[j]-(t+1);
    }

    if(a<min)
    {
    min=a;
    T=t;
    }
    }
    printf("%d %d",T,min);*/
   // printf("\n%d",ar[n/2]);
    return 0;
}

#include <stdio.h>
#include <string.h>
#define m 1000007
#define Min(a,b) a<b ? a : b
int a[m], b[m];
int main()
{
    int q;
    scanf("%d", &q);
    while(q--)
    {
        int n, k, d, i, min, j, c;
        memset(b,0,sizeof(b));
        scanf("%d%d%d", &n, &k, &d);
        for(i=0; i<n; i++)
        {
            scanf("%d", &a[i]);
        }
        for(j=0,c=0; j<d; j++)
        {
            if(b[a[j]]==0)
                c++;
            b[a[j]]++;
        }
        i=0;
        min = c;
        while(j<n)
        {
            b[a[i]]--;
            if(b[a[i]]==0)
                c--;
            if(b[a[j]]==0)
                c++;
            b[a[j]]++;
            j++;
            i++;
            min = Min(min,c);
        }
        printf("%d\n", min);
    }

    return 0;
}

#include<stdio.h>
int main()
{
	int t;
	scanf("%d",&t);
	while(t--)
	{
		int n,k,d;
		scanf("%d%d%d",&n,&k,&d);
		int arr[n];
		for(int i=0;i<n;i++)
		    scanf("%d",&arr[i]);
		int s[k+1];
		int count,min=100000;
		for(int i=0;i<n-d+1;i++)
		{
			for(int j=0;j<=k;j++)
			    s[j]=0;
			count=0;
			for(int l=i;l<i+d;l++)
			{
				if(s[arr[l]]==0)
				{
					count++;
					s[arr[l]]=1;
				}
			}
			if(count<min)
			    min=count;
		}
		printf("%d\n",min);
	}
	return 0;
}

#include<stdio.h>

int verno[1000006], curver, cnts[1000006], n, k, d, arr[200005];

int gval(int idx){
  if(verno[idx] != curver){
    verno[idx] = curver;
    cnts[idx] = 0;
  }
  return cnts[idx];
}

int main(){
  int tcases;
  curver = 0;
  for(tcases = 0;tcases < 1000006;tcases++)verno[tcases] = curver;
  scanf("%d", &tcases);
  while(tcases--){
    curver++;
    int i;
    scanf("%d %d %d", &n, &k, &d);
    for(i = 0;i < n;i++)scanf("%d", arr + i);
    int ans = k;
    int req = 0;
    for(i = 0;i < d;i++){
      int num = arr[i];
      cnts[num] = gval(num) + 1;
      if(cnts[num] == 1) req++;
    }
    if(ans > req) ans = req;
    for(i = 0;i + d < n;i++){
	int num;
	num = arr[i];
	cnts[num] = cnts[num] - 1;
	if(cnts[num] == 0)req--;

	num = arr[i + d];
	cnts[num] = gval(num) + 1;
	if(cnts[num] == 1) req++;
	if(ans > req) ans = req;
    }
    printf("%d\n", ans);
  }
  return 0;
}

#include<stdio.h>

int main(){

    long long int t,i,j,k,l;

    scanf("%I64d",&t);

    for(i=0;i<t;i++){

        long long int n,d,min=1000000000;

        scanf("%I64d%I64d%I64d",&n,&k,&d);

        long long int a[n],b[k+1],count=0;

        for(j=0;j<n;j++){
            scanf("%I64d",&a[j]);

            b[a[j]]=0;
        }

        for(j=0;j<d;j++){

            if(b[a[j]]==0)
                count++;

            b[a[j]]++;
        }

        if(count<min)
            min=count;

        for(j=d;j<n;j++){

            if(b[a[j-d]]!=0){
                b[a[j-d]]--;

                if(b[a[j-d]]==0)
                    count--;
            }

            if(b[a[j]]==0)
                count++;

            b[a[j]]++;

            if(count<min)
                min=count;
        }

        printf("%I64d\n",min);
    }

    return 0;
}

#include <stdio.h>
#include <stdlib.h>
int results[100];
int t,t2;
void onetest()
{
    int n,k,d,i;
    scanf("%d %d %d",&n,&k,&d);
    int no,minno,tmp;//no numarul de showuri in intervalul curent;minno rezultat
    int shows [k];
    int line [n];
    for(i=0; i<k; i++) //sa fie 0
    {
        shows[i]=0;
    };
    for(i=0; i<n; i++) //line e programul de n zile
    {
        scanf("%d",&tmp);
        line[i]=tmp-1;// showurile sunt numerotate 1 k
    };
    for(i=0; i<d; i++) //numaram showuri zile 0->d
    {
        shows[line[i]]++;
    };
    no=0;
    for(tmp=0; tmp<k; tmp++) //numaram showuri cu >=1 episod fara a atinge i
    {
        if(shows[tmp])
        {
            no++;
        };
    };
    minno=no;
    while(i<n)//important
    {
        //ordinea conteaza
        shows[line[i]]++;//e un episod nou sin acel show
        if(shows[line[i]]==1)//daca am crescut 0->1
        {
            no++;
        };
        shows[line[i-d]]--;
        if(shows[line[i-d]]==0)//daca am scazut 1->0
        {
            no--;
        };
        if(no<minno) //minno e minim
        {
            minno=no;
        };
        i++;
    };
    results[t2-t]=minno;//se umple de la final
}
int main()
{
    scanf("%d",&t);
    t2=t;
    while(t)
    {
        onetest();
        t--;
    };
    for(t=0; t<t2; t++) //t pt ca i ar fi variabila in plus
    {
        printf("%d \n",results[t]);
    };
    return 0;
}

#include<stdio.h>
#include<stdlib.h>
int minimum(int a,int b){
	if(a<=b)return a;
	else return b;
}
void set_temp(int* temp,int n){
	for(int i=0;i<n;i++){
		temp[i]=-1;
	}
}
int main(){
	int t;scanf("%d",&t);
	while(t--){
		int n,k,d;
		scanf("%d %d %d",&n,&k,&d);
		int* arr = (int*)malloc(sizeof(int)*n);
		for(int i=0;i<n;i++){
			scanf("%d",&arr[i]);
		}
		//Look at every pair of d consecutive days
		//Get the minimum in every case
		//Number can be d
		int* temp = (int*)malloc(sizeof(int)*(k+1));
		k=k+1;
		set_temp(temp,k);
		int min = 1000000;
		for(int i=0;i<=n-d;i++){
			int currmin = 0;
			//printf("In here\n");
			for(int j=0;j<d;j++){
				if(temp[arr[i+j]]==1){
					//printf("equal\n");
				}
				else{temp[arr[i+j]]=1;

					currmin++;
				}
			}
			min = minimum(min,currmin);
			//clear temp;
			set_temp(temp,k);
		}
		printf("%d\n",min );
	}
}

#include<stdio.h>

#define min(a, b) ((a)<(b)?(a):(b))
int active[1000001], a[200000];

void solve(){
	int n, i, d, best, curr=0;
	scanf("%d %*d %d", &n, &d);
	best=d;
	for(i=0;i<n;++i) scanf("%d", a+i);
	for(i=0;i<d;++i){
		if(active[a[i]]==0) ++curr;
		++active[a[i]];
	}
	for(;i<n;++i){
		best=min(best, curr);
		if(active[a[i-d]]==1) --curr;
		--active[a[i-d]];
		if(active[a[i]]==0) ++curr;
		++active[a[i]];
	}
	best=min(best, curr);
	for(;i-d<n;++i) --active[a[i-d]];
	printf("%d\n", best);
}

int main(){
	int t;
	scanf("%d", &t);
	while(t--) solve();
	return 0;
}

#include"stdio.h"
#include"string.h"
int main()
{
	int t,n,k,d;
	scanf("%d",&t);
	while(t--)
	{
		int a[150],b[150];
		scanf("%d %d %d",&n,&k,&d);
		memset(a,0,sizeof(a));
		memset(b,0,sizeof(b));
		for(int i=0;i<n;i++)
		{
			scanf("%d",&a[i]);
		}
		int c=1000;
		int sum;
		for(int i=0;i<n-d+1;i++)
		{
			sum=0;
			memset(b,0,sizeof(b));
			for(int j=i;j<i+d;j++)
			{
				b[a[j]]++;
				if(b[a[j]]==1)
				{
					sum++;
				}
			}
			if(sum<c)
			{
				c=sum;
			}
		}
		printf("%d\n",c);
	}
	return 0;
}

#include<stdio.h>
int countf(int a[],int k,int l,int r)
{
    int b[k];int i, s=0;
    for(i=0;i<k;i++)b[i]=0;
    for(i=l;i<=r;i++)
    {
        if(b[a[i]-1]==0)s++;
        b[a[i]-1]=1;
    }
    return s;
}
int main()
{
    int t,n,v,k,d,i,min;
    scanf("%d",&t);
    while(t--)
    {
        min=10000;
        scanf("%d%d%d",&n,&k,&d);
        int a[n];
        for(i=0;i<n;i++)scanf("%d",&a[i]);
        for(i=0;i+d-1<n;i++)
        {
            v=countf(a,k,i,i+d-1);
            if(v<min)min=v;
        }
        printf("%d\n",min);
    }
}

#include<stdio.h>
int main()
{
    int t;
    scanf("%d",&t);
    while(t--)
    {
        int n,k,d;
        scanf("%d %d %d",&n,&k,&d);
        int a[n];
        for(int i=0;i<n;i++)
        {
            scanf("%d",&a[i]);
        }
        int min=k;
        int count=0;
        int c[1000005]={0};
        for(int i=0;i<n;i++)
        {
            if(c[a[i]]==0)
            {
                count++;
            }
            c[a[i]]++;
            if(i+1>=d)
            {
                if(count<min)
                    min=count;
                c[a[i+1-d]]--;
                if(c[a[i+1-d]]==0)
                    count--;
            }
        }
        printf("%d\n",min);
    }
    return 0;
}

#include "stdio.h"
#include "stdlib.h"
#include "string.h"

#define N 110

int z[N], c[N];

int min(int a, int b) { return a>b ? b : a; }

int main()
{
    int T, i;
    int n, k, d, num, ans;
    scanf("%d", &T);
    while(T--)
    {
        num=0;
        scanf("%d%d%d", &n, &k, &d);
        memset(c, 0, sizeof(c));
        for(i=1; i<=n; ++i) scanf("%d", &z[i]);
        for(i=1; i<=d; ++i)
        {
            if( !(c[z[i]]++) ) num++;
        }
        ans = num;
        for(i=d+1; i<=n; ++i)
        {
            if( !(c[z[i]]++) ) num++;
            if( !(--c[z[i-d]]) ) num--;
            ans = min(ans, num);
        }
        printf("%d\n", ans);
    }
    return 0;
}

#include<stdio.h>
#include<stdlib.h>
#include<string.h>
int min(int a,int b){
    if(a>b)
        return b;
    return a;
}
void tri_a_bulle(int *t, int n){
    int j =0,tmp =0,desordre =1;
    while(desordre)
    {
        desordre = 0;
        for(j =0; j < n-1; j++)
        {
            if(t[j] > t[j+1])
            {
                tmp = t[j+1];
                t[j+1] = t[j];
                t[j] = tmp;
                desordre = 1;
            }
        }
    }
}

int minsubs(int *mylist,int n, int d,int i){
    int m = 0;
    int *list;
    list = (int*)calloc(101,sizeof(int));
    for(int j=i;j<i+d;j++){
        list[mylist[j]]++;
    }
    for(int j=1;j <=100 ;j++){
        if(list[j] != 0)
            m++;
    }
    if((n-i) == d)
        return m;
    return min(m,minsubs(mylist,n,d,i+1));
}

int main()
{
   int t;
   scanf("%d",&t);
   int tab[t];
   for(int j=0;j < t;j++){
    int n,k,d;
    scanf("%d%d%d",&n,&k,&d);
    int mylist[n];
    for(int i=0;i < n;i++){
        scanf("%d",&mylist[i]);
    }
    tab[j] = minsubs(mylist,n,d,0);
   }
   for(int j=0;j < t;j++){
    printf("%d\n",tab[j]);
   }
}

/*  AUTHOR:AKASH JAIN
*   USERNAME:akash19jain
*   DATE:26/10/2019
*/
// #include<algorithm>
// #include <bits/stdc++.h>
// using namespace std;

#include<stdio.h>
#include<math.h>
#include<string.h>
#include<stdlib.h>
#include<stdbool.h>
#include<ctype.h>
#define SC1(x)          scanf("%lld",&x)
#define SC2(x,y)        scanf("%lld%lld",&x,&y)
#define SC3(x,y,z)      scanf("%lld%lld%lld",&x,&y,&z)
#define SCS(x)          scanf("\n%s", x)
#define PF1(x)          printf("%lld\n",x)
#define PF2(x,y)        printf("%lld %lld\n",x,y)
#define PF3(x,y,z)      printf("%lld %lld %lld\n",x,y,z)
#define PFN                printf("\n")
#define REP(i,n)        for(long long i=0;i<(n);++i)
#define FOR(i,a,b)      for(long long i=(a);i<=(b);++i)
#define FORD(i,a,b)     for(long long i=(a);i>=(b);--i)
#define WHILE(n)        while(n--)
#define MEM(a, b)       memset(a, (b), sizeof(a))
#define ITOC(c)         ((char)(((ll)'0')+c))
#define MID(s,e)        (s+(e-s)/2)
#define SZ(a)            strlen(a)
#define MOD             1000000007
#define MAX             10000000005
#define MIN             -10000000005
#define PI              3.1415926535897932384626433832795
#define DEB(x)          printf("The value of \"%s\" is: %d\n",#x,x)
#define CASES           ll t;SC1(t);while(t--)
#define ABS(a)          ((a>0)?a:-(a))
#define SWAP(a,b)        ll z=a;a=b;b=z
#define SWAPC(a,b)        char z=a;a=b;b=z

const int INF = 1<<29;
typedef long long ll;
typedef unsigned long long ull;
#define FILEIO(name) \  freopen(name".in", "r", stdin); \   freopen(name".out", "w", stdout);
int cmp(const void * a,const void * b);
long long maxv(long long a,long long b);
long long minv(long long a,long long b);
long long gcd(long long u,long long v);
long long digits(long long n);
bool isPoweroftwo(long long n);

int main()
{
    CASES
    {
        ll n,k,d;
        SC3(n,k,d);
        ll arr[n];
        REP(i,n)
            SC1(arr[i]);
        ll count[k+1];
        MEM(count,0);
        ll min=MAX,c=0;
        REP(i,d)
        {
            ll x=arr[i];
            if(count[x]==0)
                c++;
            count[x]++;
        }
        min=c;
        FOR(i,d,n-1)
        {
            ll x=arr[i];
            if(count[x]==0)
                c++;
            count[x]++;
            x=arr[i-d];
            count[x]--;
            if(count[x]==0)
                c--;
            min=minv(c,min);
        }
        PF1(min);
    }
    return 0;
}

//qsort(arr,n,sizeof(arr[0]),cmp);
int cmp (const void * a, const void * b)
{
    if( *(ll*)a - *(ll*)b < 0 ) return -1;
    if( *(ll*)a - *(ll*)b > 0 ) return 1;
        return 0;
}
long long maxv(long long a,long long b)
{
    if(a>b) return a;
        return b;
}
long long minv(long long a,long long b)
{
    if(a<b) return a;
        return b;
}
long long gcd(long long u,long long v)
{
    if (v == 0) return u;
       return gcd(v, u%v);
}
long long digits(long long n)    //to calculate no of digits in a number
{
    return floor(log10(n))+1;
}
bool isPoweroftwo(long long x)
{
    return x && (!(x&(x-1)));
}

#include <stdio.h>
int indv[1000003],testcases[1000003]={-1};
int main()
{
    int t,n,k,d,prev,min,count;
    scanf("%d",&t);
    for(int u=0;u<t;u++)
    {
        scanf("%d %d %d",&n,&k,&d);
        int a[n],frq[n];min=d,count=0;
        for(int i=0;i<n;i++)
        {
            scanf("%d",&a[i]);
            if(testcases[a[i]]!=u)
            {
                testcases[a[i]]=u;
                indv[a[i]]=0;
            }
            if(i<d)
            {
                indv[a[i]]++;
                if(indv[a[i]]==1)
                count++;
                frq[i]=count;
            }
            else
            {
                prev=indv[a[i]];
                indv[a[i]]++;
                indv[a[i-d]]--;
                if((indv[a[i]]==1)&(prev==0))
                count++;
                //if(indv[a[i-d]]==1)
                //count++;
                if(indv[a[i-d]]==0)
                count--;
                frq[i]=count;
            }
        }
        /*for(int i=0;i<n;i++)
        printf("%d ",frq[i]);
        printf("\n");*/
        for(int i=d-1;i<n;i++)
        {
            min=frq[i]<min?frq[i]:min;
        }
        printf("%d\n",min);
    }
}

#include <stdio.h>
int indv[1000003],testcases[1000003]={-1};
int main()
{
    int t,n,k,d,prev,min,count;
    scanf("%d",&t);
    for(int u=0;u<t;u++)
    {
        scanf("%d %d %d",&n,&k,&d);
        int a[n],frq[n];min=d,count=0;
        for(int i=0;i<n;i++)
        {
            scanf("%d",&a[i]);
            if(testcases[a[i]]!=u)
            {
                testcases[a[i]]=u;
                indv[a[i]]=0;
            }
            if(i<d)
            {
                indv[a[i]]++;
                if(indv[a[i]]==1)
                count++;
                frq[i]=count;
            }
            else
            {
                prev=indv[a[i]];
                indv[a[i]]++;
                indv[a[i-d]]--;
                if((indv[a[i]]==1)&(prev==0))
                count++;
                if(indv[a[i-d]]==0)
                count--;
                frq[i]=count;
            }
        }
        for(int i=d-1;i<n;i++)
        min=frq[i]<min?frq[i]:min;
        printf("%d\n",min);
    }
}

#include <stdio.h>
#include <stdlib.h>

/* run this program using the console pauser or add your own getch, system("pause") or input loop */

int main(int argc, char *argv[]) {

	int cnt=0,t,n,k,d,i,j;
	scanf("%d",&t);

	while(cnt<t){

		int f;
		int consec = 0, maxconsec=0;
		int tab[200]={0};
		int aux [200]={0};
		scanf("%d %d %d",&n,&k,&d);

		for(i=0;i<n;i++){
			scanf("%d",&tab[i]);
		}
		maxconsec = d;
		for(i=0;i<n-d+1;i++){

			int aux [200]={0};

			for(j=i;j<i+d;j++){

				aux[tab[j]]++;
			}

			for(f=0;f<=k+1;f++){
				if(aux[f]!=0)consec ++;
			}

			if(consec<=maxconsec) maxconsec = consec;
			consec = 0;
		}

		printf("%d ",maxconsec);

		cnt++;
	}
	return 0;
}

#include <stdio.h>
#include <string.h>
int min(int a, int b) { if(a < b) return a; return b; }
int stat[1000002];
int data[200002];
void worker()
{
    int n, k, d;
    scanf("%d%d%d", &n, &k, &d);
    memset(stat, 0, sizeof(int)*1000002);
    int cnt = 0;
    for(int i = 0; i < d; i++)
    {
        scanf("%d", &data[i]);
        if(stat[data[i]] == 0)
            cnt++;
        stat[data[i]]++;
    }
    int minv = cnt;
    for(int i = d; i < n; i++)
    {
        scanf("%d", &data[i]);
        if(stat[data[i]] == 0)
            cnt++;
        stat[data[i]]++;
        stat[data[i-d]]--;
        if(stat[data[i-d]] == 0)
            cnt--;
        minv = min(minv, cnt);
    }
    printf("%d\n", minv);
}
int main()
{
#ifdef LOCAL
	freopen("test.txt", "r", stdin);
#endif
    int q;
    scanf("%d", &q);
    while(q--)
        worker();
}

#include <stdio.h>
typedef long long int ll;
int main()
{
    ll t;
    scanf("%lld", &t);
    while (t--)
    {
        ll n, k, d;
        scanf("%lld %lld %lld", &n, &k, &d);
        ll arr[n];
        ll i = 0;
        // while (i < k)
        // {
        //     ar[i++] = 0;
        // }
        // i = 0;
        while (i < n)
        {
            scanf("%lld", &arr[i++]);
        }
        ll min = __LONG_LONG_MAX__;
        i = 0;
        while (i < n - d + 1)
        {
            // ll j = i;
            // // while (j < k)
            // {
            //     ar[j++] = -1;
            // }
            ll ar[105];
            ll j = 0;
            while (j < 105)
            {
                ar[j++] = 0;
            }
            ll count;
            j = 0;
            count = 0;
            while (j < d)
            {
                if (ar[arr[i + j]] == 0)
                {
                    count++;
                    ar[arr[i + j]]++;
                }
                j++;
            }

            if (count < min)
            {
                min = count;
            }

            i++;
        }
        printf("%lld\n", min);
    }
    return 0;
}

#include "stdio.h"
#include "stdlib.h"
#include "string.h"

#define N 1000010

int z[N], c[N];

int min(int a, int b) { return a>b ? b : a; }

int main()
{
    int T, i;
    int n, k, d, num, ans;
    scanf("%d", &T);
    while(T--)
    {
        num=0;
        scanf("%d%d%d", &n, &k, &d);
        memset(c, 0, sizeof(c));
        for(i=1; i<=n; ++i) scanf("%d", &z[i]);
        for(i=1; i<=d; ++i)
        {
            if( !(c[z[i]]++) ) num++;
        }
        ans = num;
        for(i=d+1; i<=n; ++i)
        {
            if( !(c[z[i]]++) ) num++;
            if( !(--c[z[i-d]]) ) num--;
            ans = min(ans, num);
        }
        printf("%d\n", ans);
    }
    return 0;
}

#include<stdio.h>
#define lli long long int
lli hash[1000005]={0},hash1[1000005]={0};
int main(void)
{
	lli t;
	scanf("%lld",&t);
	while(t--)
	{
		lli i,n,k,d,p=0,count=0,a[200005]={0},fk[200005]={0},min=1000005;
		scanf("%lld %lld %lld",&n,&k,&d);
		for(i=0;i<d;i++)
		{
			scanf("%lld",&a[i]);
			if(hash[a[i]]==0)
			{
				fk[p++]=a[i];
				hash1[a[i]]=-1;
				count++;
			}
			hash[a[i]]++;
		}
		min=count;
		for( ;i<n;i++)
		{
			scanf("%lld",&a[i]);
			if(hash[a[i-d]]==1)
				count--;
			hash[a[i-d]]--;
			if(hash[a[i]]==0)
			{
				if(hash1[a[i]]==0)
					fk[p++]=a[i];
				else
					hash1[a[i]]=-1;
				count++;
			}
			hash[a[i]]++;
			if(min>count)
				min=count;
		}

		printf("%lld\n",min);

		for(i=0;i<p;i++)
		{
			hash[fk[i]]=0;
			hash1[fk[i]]=0;
		}
	}

	return 0;
}

#include <stdio.h>

int main(){
    long long z,k;
    scanf("%lli",&z);
    for(k=0;k<z;k++){
    long long n,k,d;
    scanf("%lli %lli %lli",&n,&k,&d);
    long long i,j;
    long long tab[n];
    for(i=0;i<n;i++)
        scanf("%lli",&tab[i]);
    long long min=d;

    for(j=0;j<n-d+1;j++){
        long long t[d];
        long long count=0;
        for(i=j;i<d+j;i++){
            long long x=0,verif=0;
            for(x=0;x<count;x++)
            if(tab[i]==t[x])
                verif=1;

            if(verif==0){
                t[count++]=tab[i];
            }
        }
        if(count<min)
            min=count;
    }
    printf("%lli\n",min);
    }
}

#include <stdio.h>
#include <string.h>
int min(int a, int b) { if(a < b) return a; return b; }
int stat[1000002];
int data[200002];
void worker()
{
    int n, k, d;
    scanf("%d%d%d", &n, &k, &d);
    memset(stat, 0, sizeof(int)*1000002);
    int cnt = 0;
    for(int i = 0; i < d; i++)
    {
        scanf("%d", &data[i]);
        if(stat[data[i]] == 0)
            cnt++;
        stat[data[i]]++;
    }
    int minv = cnt;
    for(int i = d; i < n; i++)
    {
        scanf("%d", &data[i]);
        if(stat[data[i]] == 0)
            cnt++;
        stat[data[i]]++;
        stat[data[i-d]]--;
        if(stat[data[i-d]] == 0)
            cnt--;
        if(cnt < minv)
            minv = cnt;
        //minv = min(minv, cnt);
    }
    printf("%d\n", minv);
}
int main()
{
    int q;
    scanf("%d", &q);
    while(q--)
        worker();
}

#include <stdio.h>

int main(){
    int z,k;
    scanf("%i",&z);
    for(k=0;k<z;k++){
    int n,k,d;
    scanf("%i %i %i",&n,&k,&d);
    int i,j;
    int tab[n];
    for(i=0;i<n;i++)
        scanf("%i",&tab[i]);
    int min=d;

    for(j=0;j<n-d+1;j++){
        int t[d];
        int count=0;
        for(i=j;i<d+j;i++){
            int hb;
            for(hb=0;hb<d;hb++)
                t[i]=0;

            int x=0,verif=0;
            for(x=0;x<count;x++)
            if(tab[i]==t[x])
                verif=1;

            if(verif==0){
                t[count++]=tab[i];
            }
        }
        if(count<min)
            min=count;
    }
    printf("%i\n",min);
    }
}

/*  AUTHOR:AKASH JAIN
*   USERNAME:akash19jain
*   DATE:26/10/2019
*/
// #include<algorithm>
// #include <bits/stdc++.h>
// using namespace std;

#include<stdio.h>
#include<math.h>
#include<string.h>
#include<stdlib.h>
#include<stdbool.h>
#include<ctype.h>
#define SC1(x)          scanf("%lld",&x)
#define SC2(x,y)        scanf("%lld%lld",&x,&y)
#define SC3(x,y,z)      scanf("%lld%lld%lld",&x,&y,&z)
#define SCS(x)          scanf("\n%s", x)
#define PF1(x)          printf("%lld\n",x)
#define PF2(x,y)        printf("%lld %lld\n",x,y)
#define PF3(x,y,z)      printf("%lld %lld %lld\n",x,y,z)
#define PFN                printf("\n")
#define REP(i,n)        for(long long i=0;i<(n);++i)
#define FOR(i,a,b)      for(long long i=(a);i<=(b);++i)
#define FORD(i,a,b)     for(long long i=(a);i>=(b);--i)
#define WHILE(n)        while(n--)
#define MEM(a, b)       memset(a, (b), sizeof(a))
#define ITOC(c)         ((char)(((ll)'0')+c))
#define MID(s,e)        (s+(e-s)/2)
#define SZ(a)            strlen(a)
#define MOD             1000000007
#define MAX             10000000005
#define MIN             -10000000005
#define PI              3.1415926535897932384626433832795
#define DEB(x)          printf("The value of \"%s\" is: %d\n",#x,x)
#define CASES           ll t;SC1(t);while(t--)
#define ABS(a)          ((a>0)?a:-(a))
#define SWAP(a,b)        ll z=a;a=b;b=z
#define SWAPC(a,b)        char z=a;a=b;b=z

const int INF = 1<<29;
typedef long long ll;
typedef unsigned long long ull;
#define FILEIO(name) \  freopen(name".in", "r", stdin); \   freopen(name".out", "w", stdout);
int cmp(const void * a,const void * b);
long long maxv(long long a,long long b);
long long minv(long long a,long long b);
long long gcd(long long u,long long v);
long long digits(long long n);
bool isPoweroftwo(long long n);

int main()
{
    CASES
    {
        ll n,k,d;
        SC3(n,k,d);
        ll arr[n];
        REP(i,n)
            SC1(arr[i]);
        int count[k+1];
        ll min=MAX,c=0;
        MEM(count,0);
        REP(i,d)
        {
            ll x=arr[i];
            if(count[x]==0)
                c++;
            count[x]++;
        }
        min=c;
        FOR(i,d,n-1)
        {
            ll x=arr[i];
            if(count[x]==0)
                c++;
            count[x]++;
            x=arr[i-d];
            count[x]--;
            if(count[x]==0)
                c--;
            min=minv(c,min);
        }
        PF1(min);
    }
    return 0;
}

//qsort(arr,n,sizeof(arr[0]),cmp);
int cmp (const void * a, const void * b)
{
    if( *(ll*)a - *(ll*)b < 0 ) return -1;
    if( *(ll*)a - *(ll*)b > 0 ) return 1;
        return 0;
}
long long maxv(long long a,long long b)
{
    if(a>b) return a;
        return b;
}
long long minv(long long a,long long b)
{
    if(a<b) return a;
        return b;
}
long long gcd(long long u,long long v)
{
    if (v == 0) return u;
       return gcd(v, u%v);
}
long long digits(long long n)    //to calculate no of digits in a number
{
    return floor(log10(n))+1;
}
bool isPoweroftwo(long long x)
{
    return x && (!(x&(x-1)));
}

#include <stdio.h>
#include <stdlib.h>

int solve(int n, int v[], int d, int k){
    int cnt, *aux, max = 999999;

    for(int i = 0; i <= n - d; i++){
        cnt = 0;
        aux = calloc(k + 1, sizeof(int));

        for(int j = i; j < i + d; j++)
            if(aux[v[j]] == 0){
                aux[v[j]] = 1;
                cnt++;
            }

        if(cnt < max) max = cnt;
        free(aux);
    }

    return max;
}

int main(){
    int t, n, v[100], k, d;

    scanf("%d", &t);
    for(int i = 1; i <= t; i++){
        scanf("%d%d%d", &n, &k, &d);

        for(int j = 0; j < n; j++)
            scanf("%d", &v[j]);

        printf("%d\n", solve(n, v, d, k));

    }
}

#include<stdio.h>
#include<stdlib.h>
#include<malloc.h>
int main()
{
    int t,n,k,d,count,min;
    scanf("%d",&t);
    while(t--)
    {
        scanf("%d %d %d",&n,&k,&d);
        int a[n],u[k+1],record[k+1];min=d,count=0;
        for(int i=0;i<k+1;i++)
        {
            u[i]=0;
            record[i]=0;
        }
        for(int i=0;i<n;i++)
        scanf("%d",&a[i]);
        for(int i=0;i+d<=n;i++)
        {
            for(int j=i;j<i+d;j++)
            {
                if(record[a[j]]!=i)
                {
                    record[a[j]]=i;
                    u[a[j]]=0;
                }
                if(u[a[j]]==0)
                {
                    u[a[j]]++;
                    count++;
                }
            }
            min=count<min?count:min;
            count=0;
        }
        printf("%d\n",min);
    }
}

#include <stdio.h>
#include <stdlib.h>
#include <string.h>
int main()
{
    int n, k, d, q, i, j;
    scanf("%d\n", &q);
    while(q--)
    {
        scanf("%d%d%d",&n,&k,&d);
        static int a[101], b[101];
        for(i=0; i<n; i++)
            scanf("%d", &a[i]);
        int t, ans=10e5;
        for(i=0; i<n-d+1; i++)
        {
            for(j=i, t=0; j<d+i; j++)
            {
                if(b[a[j]]==0)
                {
                    t++;
                }
                b[a[j]]++;
            }
            if(ans > t)
                ans = t;
            memset(b,0,sizeof(b));
        }
        printf("%d\n", ans);
    }
    return 0;
}

#include <stdio.h>
#include<string.h>
#include<stdlib.h>
#include<math.h>
long long cmpfunc (const void * a, const void * b) {
   return ( *(long long*)a - *(long long*)b );
}

int main(void){

long long int test,i,j,n,count,x1,y1,flag=0,o1=0,o2=0,b1,count2=0,x,m,l,max,k,sum2,min,f,r,o,sum1,sum=0,y,count1, a[10000]={0};
scanf("%lld",&test);
while(test--){

scanf("%lld%lld%lld",&n,&k,&m);
for(i=0;i<n;i++){
    scanf("%lld",&a[i]);
}
count=0;
max=1000000;
for(i=0;i<n-m+1;i++){
    long long int b[10000]={0};
    count=0;
    for(j=i;j<i+m;j++){
        if(b[a[j]]==0){
            count++;
            b[a[j]]++;
        }
    }
    if(count<max){
        max=count;
    }
}
printf("%lld\n",max);
}

return 0;
}

#include <stdio.h>

int main()
{
    int t;
    scanf("%d", &t);
    int answ[10000];
    int y = 0;
    for(int pop = 0; pop < t; pop++){
        int n, k, d;
        scanf("%d %d %d", &n, &k, &d);
        int dni[150];
        int serials[150];
        for(int i = 0; i < n; i++){
            scanf("%d", &dni[i]);
        }

        int counttmax = 32000;
        for(int i = 0; i < n - d + 1; i++){
            for(int i = 0; i < 150; i++){
                serials[i] = 0;
            }
            int countt = 0;
            for(int j = i; j < i + d; j++){
                if(serials[dni[j]] == 0){
                    serials[dni[j]] = 1;
                    countt++;
                }
            }
            if(countt < counttmax){
                counttmax = countt;
            }
        }
        answ[y] = counttmax;
        y++;

    }
    for(int i = 0; i < y; i++){
        printf("%d\n", answ[i]);
    }
    return 0;
}

#include <stdio.h>
#include <stdlib.h>
#include <string.h>

int number_of_series(int *arr, int start, int length, int k_series)
{
    int number = 0;

    int *series = malloc(sizeof(int) * (k_series+1));
    memset(series, 0, sizeof(int) * (k_series+1));

    for (int i = start; i < start + length; ++i)
        series[arr[i]] += 1;

    for (int i = 0; i <= k_series; ++i)
        number += (series[i] > 0);

    free(series);
    return number;
}

int main()
{
    int t;
    int all_days, k_series, days;
    int min_subs, tmp_subs;

    scanf("%d", &t);
    for (t; t > 0; --t)
    {
        scanf("%d %d %d", &all_days, &k_series, &days);

        int *a = malloc(sizeof(int) * all_days);

        for (int i = 0; i < all_days; ++i)
            scanf("%d", &a[i]);

        min_subs = number_of_series(a, 0, days, k_series);

        for (int i = 1; i <= all_days-days; ++i)
        {
            tmp_subs = number_of_series(a, i, days, k_series);
            if (tmp_subs < min_subs)
                min_subs = tmp_subs;
        }
        printf("%d\n", min_subs);
        free(a);
    }
}

#include<stdio.h>
#define N 102
int main(){
    int t;
    scanf("%d",&t);
    int a[N];
    int i,j;
    char see[N];
    while(t--){
        int n,k,d;
        scanf("%d%d%d",&n,&k,&d);
        for(i=1;i<=n;i++){
            scanf("%d",&a[i]);
        }
        int answer=k+1;
        for(i=1;i<=n-d+1;i++){
            for(j=1;j<=k;j++){
                see[j]=0;
            }
            for(j=0;j<d;j++){
                see[a[i+j]]=1;
            }
            int buy=0;
            for(j=1;j<=k;j++){
                if(see[j]){
                    buy++;
                }
            }
            if(buy<answer){
                answer=buy;
            }
        }
        printf("%d\n",answer);
    }
    return 0;
}

#include <stdio.h>
void read(int *arr, int length) {
    for (int i=0; i<length; i++) scanf("%d",(arr+i));
}
void initialize(int *arr, int length) {
    for (int i=0; i<length; i++) *(arr+i)=0;
}
int count(int *arr, int length) {
    int res=0;
    for (int i=0; i<length; i++) res+=arr[i];
    return res;
}
int subscription(int *arr, int length, int show, int d) {
    int lim=length-d+1,sieve[show],res=101,temp;
    for (int i=0; i<lim; i++) {
        initialize(sieve,show);
        for (int j=0; j<d; j++) sieve[arr[i+j]-1]=1;
        temp=count(sieve,show);
        if (res>temp) res=temp;
    }
    return res;
}
int main() {
    int queries,len,show,row,schedule[100];
    scanf("%d\n",&queries);
    for (int i=0; i<queries; i++) {
        scanf("%d %d %d\n",&len,&show,&row);
        read(schedule,len);
        printf("%d\n",subscription(schedule,len,show,row));
    }
    return 0;
}

#include <stdio.h>
#include <string.h>
int stat[102];
int data[102];
void worker()
{
    int n, k, d;
    scanf("%d%d%d", &n, &k, &d);
    memset(stat, 0, sizeof(int)*102);
    int cnt = 0;
    for(int i = 0; i < d; i++)
    {
        scanf("%d", &data[i]);
        if(stat[data[i]] == 0)
            cnt++;
        stat[data[i]]++;
    }
    int minv = cnt;
    for(int i = d; i < n; i++)
    {
        scanf("%d", &data[i]);
        if(stat[data[i]] == 0)
            cnt++;
        stat[data[i]]++;
        stat[data[i-d]]--;
        if(stat[data[i-d]] == 0)
            cnt--;
        if(cnt < minv)
            minv = cnt;
    }
    printf("%d\n", minv);
}
int main()
{
    int q;
    scanf("%d", &q);
    while(q--)
        worker();
}

#include <stdio.h>
#include <stdlib.h>

void prmin(int * a, int n) {
    int i;
    for (i = 0; i < n; i++) {
        if (a[0] > a[i])
            a[0] = a[i];
    }
    printf("%d\n", a[0]);
}
int sort(int * b, int n, int m) {
    int sum = 1, i, j, k;
    int a[100];
    for (i = n; i < m; i++)
        a[i] = b[i];
    for (i = n; i < m; i++) {
        for (j = i; j < m; j++) {
            if (a[i] > a[j]) {
                k = a[i];
                a[i] = a[j];
                a[j] = k;
            }
        }
       // printf("<%d>", a[i]);
    }
    for (i = n; i < m - 1; i++) {
        if (a[i] != a[i + 1])
            sum = sum + 1;
        else
            sum = sum;
    }
    //printf("\n");
    //printf("%d\n", sum);
    return sum;
}
int main() {
    int t, n, k, d, i, j;
    int a[100];
    int sum[100];
    scanf("%d", &t);
    for (i = 0; i < t; i++) {
        scanf("%d%d%d", &n, &k, &d);
        for (j = 0; j < n; j++)
            scanf("%d", &a[j]);
        for (j = 0; j < n - d + 1; j++)
            sum[j] = sort(a, j, j + d);
        prmin(sum, n - d + 1);
        //for (j = 0; j < n - d + 1; j++)
          //  printf("%d ", sum[j]);
    }

    return 0;
}

#include <stdio.h>
#include <stdlib.h>

int main()
{
    int t, n, k, d;

    int curAmntTypes = 0;

    int minAmntTypes;
    scanf("%d", &t);
    for(int iter=0; iter < t ; iter++)
    {
        minAmntTypes = 99999999;
        scanf("%d", &n);
        scanf("%d", &k);
        scanf("%d", &d);
        int types[k];

        int A[n];

        for(int i = 0; i < n; i++)
        {
            scanf("%d", A+i);
        }
        for(int i = 0; i <= n-d;i++)
        {
            for(int ij = 0; ij < k; ij++){
                types[ij] = 0;
            }
            curAmntTypes = 0;
            for(int j = i; j<(i+d); j++)
            {
                if(!types[A[j]-1])
                {
                    types[A[j]-1] = 1;
                    curAmntTypes++;
                }

            }
            if(curAmntTypes < minAmntTypes) minAmntTypes = curAmntTypes;

        }
        printf("%d\n", minAmntTypes);
    }

    return 0;
}

#include<stdio.h>
#include<stdlib.h>

int minsub(int n, int d, int *arr){
    int min = d, i, j, k;
    int *minSub;
    minSub = (int*)malloc(sizeof(int) * (n - d + 1));
    for(i = 0; i < n - d + 1; i++){
     	minSub[i] = 1;
	}
    for(i = 0; i <= n - d; i++){
        for(j = i + 1; j < i + d; j++){
            for(k = i; k < j; k++){
		        if(arr[k] == arr[j])
			        break;
		    }
            if(k == j)
                minSub[i]++;
        }
    }

    for(i = 0; i < n - d + 1; i++){
    	if(minSub[i] < min)
    		min = minSub[i];
	}

	return min;
}

int main(){
     int t;
     scanf("%d", &t);

     while(t--){
          int *arr, i;
          int n, k , d;
          scanf("%d%d%d", &n, &k, &d);
          arr = (int*)malloc(sizeof(int) * n);
          for(i = 0; i < n; i++)
               scanf("%d", &arr[i]);

          int min = minsub(n, d, arr);
          printf("%d\n", min);
     }
}

#include<stdio.h>
#include<stdlib.h>
#include<malloc.h>
int main()
{
    int t,n,k,d,count,min;
    scanf("%d",&t);
    while(t--)
    {
        scanf("%d %d %d",&n,&k,&d);
        int a[n];min=d;
        int *u=(int*)malloc((k+1)*sizeof(int));
        int *record=(int*)malloc((k+1)*sizeof(int));
        for(int i=0;i<n;i++)
        scanf("%d",&a[i]);
        for(int i=0;i+d<=n;i++)
        {
            count=0;
            for(int j=i;j<i+d;j++)
            {
                if(record[a[j]]!=i)
                {
                    record[a[j]]=i;
                    u[a[j]]=0;
                }
                if(u[a[j]]==0)
                {
                    u[a[j]]++;
                    count++;
                }
            }
            min=count<min?count:min;
        }
        printf("%d\n",min);
    }
}

#include<stdio.h>
#include<stdlib.h>
#include<malloc.h>
int main()
{
    int t,n,k,d,count,min;
    scanf("%d",&t);
    while(t--)
    {
        scanf("%d %d %d",&n,&k,&d);
        int a[n];min=d,count=0;
        int *u=(int*)malloc((k+1)*sizeof(int));
        int *record=(int*)malloc((k+1)*sizeof(int));
        for(int i=0;i<n;i++)
        scanf("%d",&a[i]);
        for(int i=0;i+d<=n;i++)
        {
            for(int j=i;j<i+d;j++)
            {
                if(record[a[j]]!=i)
                {
                    record[a[j]]=i;
                    u[a[j]]=0;
                }
                if(u[a[j]]==0)
                {
                    u[a[j]]++;
                    count++;
                }
            }
            min=count<min?count:min;
            count=0;
        }
        printf("%d\n",min);
    }
}

#include <stdio.h>
#include <stdlib.h>

int main()
{
    int t, n, k, d;

    int curAmntTypes = 0;

    int minAmntTypes;
    scanf("%d", &t);
    for(int iter=0; iter < t ; iter++)
    {
        minAmntTypes = 99999999;
        scanf("%d", &n);
        scanf("%d", &k);
        scanf("%d", &d);
        printf("%d %d %d \n", n, k, d);
        int types[k];

        int A[n];

        for(int i = 0; i < n; i++)
        {
            scanf("%d", A+i);
            printf("%d ", A[i]);
        }
        printf("\n");
        for(int i = 0; i <= n-d;i++)
        {
            for(int ij = 0; ij < k; ij++){
                types[ij] = 0;
            }
            curAmntTypes = 0;
            for(int j = i; j<(i+d); j++)
            {
                if(!types[A[j]-1])
                {
                    types[A[j]-1] = 1;
                    curAmntTypes++;
                }

            }
            if(curAmntTypes < minAmntTypes) minAmntTypes = curAmntTypes;

        }
        printf("%d\n", minAmntTypes);
    }

    return 0;
}

#include<stdio.h>
#include<stdlib.h>

int minsub(int n, int d, int *arr){
     int min = d, i, j, k;
     int *minSub;
     minSub = (int*)malloc(sizeof(int) * (n - d + 1));
     for(i = 0; i < n - d + 1; i++){
     	minSub[i] = 0;
	 }
     for(i = 0; i <= n - d; i++){
          for(j = i; j < i + d; j++){
               if(j == i)
                    minSub[i]++;
               else{
			   	for(k = i; k < j; k++){
				     if(arr[k] == arr[j])
				          break;
				     }
				     //printf("%d\n", k);

               }
               if(k == j)
                         minSub[i]++;
               //printf("\n");
          }
          //printf("\n\n\n");
     }

     for(i = 0; i < n - d + 1; i++){
     	if(minSub[i] < min)
     		min = minSub[i];
	 }

	 return min;
}

int main(){
     int t;
     scanf("%d", &t);

     while(t--){
          int *arr, i;
          int n, k , d;
          scanf("%d%d%d", &n, &k, &d);
          arr = (int*)malloc(sizeof(int) * n);
          for(i = 0; i < n; i++)
               scanf("%d", &arr[i]);

          int min = minsub(n, d, arr);
          printf("%d\n", min);
     }
}

#include<stdio.h>

int main()
{
    int t,m;
    scanf("%d",&t);
    m=t-1;
    int arr[t];
    while(t--)
    {

    int n,k,d,cnt,scnt;
    scanf("%d%d%d",&n,&k,&d);
    arr[t]=d;
    int ar[n];
    for(int i=0;i<n;i++)
    scanf("%d",&ar[i]);
    for(int z=0;z<=n-d;z++)
    {
    cnt=0;
    for(int i=z;i<=z+d;i++)
    {
    if(ar[i]!=0)
    {
    cnt++;
    scnt=1;
    for(int j=i+1;scnt!=d;j++)
    {
    if(ar[i]==ar[j])
    ar[j]=0;
    scnt++;
    }
    }
    }
    if(cnt<arr[t])
    arr[t]=cnt;
    }
    }
    for(int i=m;i>=0;i--)
    printf("%d\n",arr[i]);
    return 0;
}

#include<stdio.h>

int main()
{
    int t,m;
    scanf("%d",&t);
    m=t-1;
    int arr[t];
    while(t--)
    {

    int n,k,d,cnt,scnt;
    scanf("%d%d%d",&n,&k,&d);
    arr[t]=d;
    int ar[n];
    for(int i=0;i<n;i++)
    scanf("%d",&ar[i]);
    for(int z=0;z<n-d;z++)
    {
    cnt=0;
    for(int i=z;i<z+d;i++)
    {
    if(ar[i]!=0)
    {
    cnt++;
    scnt=1;
    for(int j=i+1;scnt!=d;j++)
    {
    if(ar[i]==ar[j])
    ar[j]=0;
    scnt++;
    }
    }
    }
    if(cnt<arr[t])
    arr[t]=cnt;
    }
    }
    for(int i=m;i>=0;i--)
    printf("%d\n",arr[i]);
    return 0;
}

#include<stdio.h>

int main()
{
    int t,m;
    scanf("%d",&t);
    m=t-1;
    int arr[t];
    while(t--)
    {

    int n,k,d,cnt,scnt;
    scanf("%d%d%d",&n,&k,&d);
    arr[t]=d;
    int ar[n];
    for(int i=0;i<n;i++)
    scanf("%d",&ar[i]);
    for(int z=0;z<=n-d;z++)
    {
    cnt=0;
    for(int i=z;i<z+d;i++)
    {
    if(ar[i]!=0)
    {
    cnt++;
    scnt=1;
    for(int j=i+1;scnt!=d;j++)
    {
    if(ar[i]==ar[j])
    ar[j]=0;
    scnt++;
    }
    }
    }
    if(cnt<arr[t])
    arr[t]=cnt;
    }
    }
    for(int i=m;i>=0;i--)
    printf("%d\n",arr[i]);
    return 0;
}

#include<stdio.h>
int countf(int a[],int k,int l,int r)
{
    int b[k];int i, s=0;
    for(i=0;i<k;i++)b[i]=0;
    for(i=l;i<=r;i++)
    {
        if(b[a[i]]==0)s++;
        b[a[i]]=1;
    }
    return s;
}
int main()
{
    int t,n,v,k,d,i,min;
    scanf("%d",&t);
    while(t--)
    {
        min=10000;
        scanf("%d%d%d",&n,&k,&d);
        int a[n];
        for(i=0;i<n;i++)scanf("%d",&a[i]);
        for(i=0;i+d-1<n;i++)
        {
            v=countf(a,k,i,i+d-1);
            if(v<min)min=v;
        }
        printf("%d\n",min+1);
    }
}

#include <stdio.h>
#include <stdlib.h>

/* run this program using the console pauser or add your own getch, system("pause") or input loop */

int main(int argc, char *argv[]) {

	int cnt=0,t,n,k,d,i,j;
	scanf("%d",&t);

	while(cnt<t){

		int consec = 0, maxconsec=0;
		int tab[200]={0};
		scanf("%d %d %d",&n,&k,&d);

		for(i=0;i<n;i++){
			scanf("%d",&tab[i]);
		}

		for(i=0;i<n-d+1;i++){

			for(j=i;j<i+d;j++){

				if(tab[i] == tab[j]) consec ++;
			}

			if(consec>=maxconsec) maxconsec = consec;
			consec =0;
		}

		if(maxconsec == 1 || maxconsec == d)printf("%d\n",1+d-maxconsec);
		else printf("%d\n",d-maxconsec);

		cnt++;
	}
	return 0;
}

#include <stdio.h>
#include <stdlib.h>

/* run this program using the console pauser or add your own getch, system("pause") or input loop */

int main(int argc, char *argv[]) {

	int cnt=0,t,n,k,d,i,j;
	scanf("%d",&t);

	while(cnt<t){

		int f;
		int consec = 0, maxconsec=0;
		int tab[200]={0};
		int aux [200]={0};
		scanf("%d %d %d",&n,&k,&d);

		for(i=0;i<n;i++){
			scanf("%d",&tab[i]);
		}
		maxconsec = d;
		for(i=0;i<n-d+1;i++){

			int aux [200]={0};

			for(j=i;j<i+d;j++){

				aux[tab[j]]++;
			}

			for(f=0;f<=k+1;f++){
				if(aux[f]!=0)consec ++;
			}

			if(consec<=maxconsec) maxconsec = consec;
			consec = 0;
		}

		printf("%d",maxconsec);

		cnt++;
	}
	return 0;
}

#include <stdio.h>

int isInside(int *a,int b,int num){

}

int main(){
    int z,k;
    scanf("%i",&z);
    for(k=0;k<z;k++){
    int n,k,d;
    scanf("%i %i %i",&n,&k,&d);
    int i,j;
    int tab[n];
    for(i=0;i<n;i++)
        scanf("%i",&tab[i]);
    int min=d;
    for(j=0;j<n-d+1;j++){
        int count=0;
        for(i=j;i<d+j;i++){
            int t[d];

            int x=0,verif=0;
            for(x=0;x<count;x++)
            if(tab[i]==t[x])
                verif=1;

            if(verif==0){
                t[count++]=tab[i];
            }
        }
        if(count<min)
            min=count;
    }
    printf("%i\n",min);
    }
}

#include <stdio.h>

int isInside(int a[],int b,int num){
    int i=0;
    for(i=0;i<b;i++)
        if(num==a[i])
            return 1;
    return 0;
}

int main(){
    int z,k;
    scanf("%i",&z);
    for(k=0;k<z;k++){
    int n,k,d;
    scanf("%i %i %i",&n,&k,&d);
    int i,j;
    int tab[n];
    for(i=0;i<n;i++)
        scanf("%i",&tab[i]);
    int min=d;
    for(j=0;j<n-d+1;j++){
        int count=0;
        for(i=j;i<d+j;i++){
            int t[d];
            if(!isInside(t,count,tab[i])){
                t[count++]=tab[i];
            }
        }
        if(count<min)
            min=count;
    }
    printf("%i\n",min);
    }
}

#include <stdio.h>

int isInside(int *a,int b,int num){
    int i=0;
    for(i=0;i<b;i++){
        if(num==a[i])
            return 1;
    }
    return 0;
}

int main(){
    int z,k;
    scanf("%i",&z);
    for(k=0;k<z;k++){
    int n,k,d;
    scanf("%i %i %i",&n,&k,&d);
    int i,j;
    int tab[n];
    for(i=0;i<n;i++)
        scanf("%i",&tab[i]);
    int min=d;
    for(j=0;j<n-d+1;j++){
        int count=0;
        for(i=j;i<d+j;i++){
            int t[d];
            if(!isInside(t,count,tab[i])){
                t[count++]=tab[i];
            }
        }
        if(count<min)
            min=count;
    }
    printf("%i",min);
    }
}

#include <stdio.h>

int isInside(int *a,int b,int num){

}

int main(){
    int z,k;
    scanf("%i",&z);
    for(k=0;k<z;k++){
    int n,k,d;
    scanf("%i %i %i",&n,&k,&d);
    int i,j;
    int tab[n];
    for(i=0;i<n;i++)
        scanf("%i",&tab[i]);
    int min=d;
    if(d==n){
        printf("%i\n",d);
        continue;
    }
    for(j=0;j<n-d+1;j++){
        int count=0;
        for(i=j;i<d+j;i++){
            int t[d];

            int x=0,verif=0;
            for(x=0;x<count;x++)
            if(tab[i]==t[x])
                verif=1;

            if(verif==0){
                t[count++]=tab[i];
            }
        }
        if(count<min)
            min=count;
    }
    printf("%i\n",min);
    }
}

#include <stdio.h>

int isInside(int *a,int b,int num){
    int i=0;
    for(i=0;i<b;i++){
        if(num==a[i])
            return 1;
    }
    return 0;
}

int main(){
    int z,k;
    scanf("%i",&z);
    for(k=0;k<z;k++){
    int n,k,d;
    scanf("%i %i %i",&n,&k,&d);
    int i,j;
    int tab[n];
    for(i=0;i<n;i++)
        scanf("%i",&tab[i]);
    int min=d;
    for(j=0;j<n-d+1;j++){
        int count=0;
        for(i=j;i<d+j;i++){
            int t[d];
            if(!isInside(t,count,tab[i])){
                t[count++]=tab[i];
            }
        }
        if(count<min)
            min=count;
    }
    printf("\n%i",min);
    }
}

#include <stdio.h>

int main(){
    int z,k;
    scanf("%i",&z);
    for(k=0;k<z;k++){
    int n,k,d;
    scanf("%i %i %i",&n,&k,&d);
    int i,j;
    int tab[n];
    for(i=0;i<n;i++)
        scanf("%i",&tab[i]);
    int min=d;

    for(j=0;j<n-d+1;j++){
        int count=0;
        for(i=j;i<d+j;i++){
            int t[d];
            t[0]=tab[i];

            int x=0,verif=0;
            for(x=0;x<count;x++)
            if(tab[i]==t[x])
                verif=1;

            if(verif==0){
                t[count++]=tab[i];
            }
        }
        printf("%i   ",count);
        if(count<min)
            min=count;
    }
    printf("%i\n",min);
    }
}

#include <stdio.h>

int main(){
    int z,k;
    scanf("%i",&z);
    for(k=0;k<z;k++){
    int n,k,d;
    scanf("%i %i %i",&n,&k,&d);
    int i,j;
    int tab[n];
    for(i=0;i<n;i++)
        scanf("%i",&tab[i]);
    int min=d;

    for(j=0;j<n-d+1;j++){
        int count=0;
        for(i=j;i<d+j;i++){
            int t[d];

            int hb;
            for(hb=0;hb<d;hb++)
                t[i]=0;

            int x=0,verif=0;
            for(x=0;x<count;x++)
            if(tab[i]==t[x])
                verif=1;

            if(verif==0){
                t[count++]=tab[i];
            }
        }
        if(count<min)
            min=count;
    }
    printf("%i\n",min);
    }
}

#include <stdio.h>

int isInside(int *a,int b,int num){
    int i=0;
    for(i=0;i<b;i++){
        if(num==a[i])
            return 1;
    }
    return 0;
}

int main(){
    int z,k;
    scanf("%i",&z);
    for(k=0;k<z;k++){

    int n,k,d;
    scanf("%i %i %i",&n,&k,&d);
    int i,j;
    int tab[n];
    for(i=0;i<n;i++)
        scanf("%i",&tab[i]);
    int min=d;
    for(j=0;j<n-d+1;j++){
        int count=0;
        for(i=j;i<d+j;i++){
            int t[d];
            if(!isInside(t,count,tab[i])){
                t[count++]=tab[i];
            }
        }
        if(count<min)
            min=count;
    }
    printf("%i\n",min);
    }
}

#include <stdio.h>

int main(){
    int z,k;
    scanf("%i",&z);
    for(k=0;k<z;k++){
    int n,k,d;
    scanf("%i %i %i",&n,&k,&d);
    int i,j;
    int tab[n];
    for(i=0;i<n;i++)
        scanf("%i",&tab[i]);
    int min=d;

    for(j=0;j<n-d+1;j++){
        int count=0;
        for(i=j;i<d+j;i++){
            int t[d];

            int x=0,verif=0;
            for(x=0;x<count;x++)
            if(tab[i]==t[x])
                verif=1;

            if(verif==0){
                t[count++]=tab[i];
            }
        }
        if(count<min)
            min=count;
    }
    printf("%i\n",min);
    }
}

#include <stdio.h>
#include <stdlib.h>
#include <math.h>

int isInside(int *a,int b,int num){
    int i=0;
    for(i=0;i<b;i++){
        if(num==a[i])
            return 1;
    }
    return 0;
}

int main(){
    int z,k;
    scanf("%i",&z);
    for(k=0;k<z;k++){

    int n,k,d;
    scanf("%i %i %i",&n,&k,&d);
    int i,j;
    int tab[n];
    for(i=0;i<n;i++)
        scanf("%i",&tab[i]);
    int min=d;
    for(j=0;j<n-d+1;j++){
        int count=0;
        for(i=j;i<d+j;i++){
            int t[d];
            if(!isInside(t,count,tab[i])){
                t[count++]=tab[i];
            }
        }
        if(count<min)
            min=count;
    }
    printf("%i\n",min);
    }
}

#include <stdio.h>

int isInside(int *a,int b,int num){

}

int main(){
    int z,k;
    scanf("%i",&z);
    for(k=0;k<z;k++){
    int n,k,d;
    scanf("%i %i %i",&n,&k,&d);
    int i,j;
    int tab[n];
    for(i=0;i<n;i++)
        scanf("%i",&tab[i]);
    int min=d;
    if(d==n){
        printf("%i",d);
        continue;
    }
    for(j=0;j<n-d+1;j++){
        int count=0;
        for(i=j;i<d+j;i++){
            int t[d];

            int x=0,verif=0;
            for(x=0;x<count;x++)
            if(tab[i]==t[x])
                verif=1;

            if(verif==0){
                t[count++]=tab[i];
            }
        }
        if(count<min)
            min=count;
    }
    printf("%i\n",min);
    }
}

#include <stdio.h>
#include <stdlib.h>
#include <string.h>
int main()
{
    int n, k, d, q, i, j;
    scanf("%d\n", &q);
    while(q--)
    {
        scanf("%d%d%d",&n,&k,&d);
        static int a[101], b[101];
        for(i=0; i<n; i++)
            scanf("%d", &a[i]);
        int t, ans=10e5;
        for(i=0; i<n-d+1; i++)
        {
            for(j=i, t=0; j<d+i; j++)
            {
                if(b[a[j]]==0)
                {
                    t++;
                }
                b[a[j]]++;
            }
            if(ans > t)
                ans = t;
            memset(b,0,100);
        }
        printf("%d\n", ans);
    }
    return 0;
}

#include <stdio.h>
#include <stdlib.h>
#include <string.h>
int main()
{
    int n, k, d, q, i, j;
    scanf("%d\n", &q);
    while(q--)
    {
        scanf("%d%d%d",&n,&k,&d);
        static int a[100], b[100];
        for(i=0; i<n; i++)
            scanf("%d", &a[i]);
        int t, ans=10e5;
        for(i=0; i<n-d+1; i++)
        {
            for(j=i, t=0; j<d+i; j++)
            {
                if(b[a[j]]==0)
                {
                    t++;
                }
                b[a[j]]++;
            }
            if(ans > t)
                ans = t;
            memset(b,0,100);
        }
        printf("%d\n", ans);
    }
    return 0;
}

#include <stdio.h>
#include <stdlib.h>
int results[100];
int t,t2;
void onetest()
{
    int n,k,d,i;
    scanf("%d %d %d",&n,&k,&d);
    int no,minno,tmp;//no numarul de showuri in intervalul curent;minno rezultat
    int shows [k];
    int line [n];
    for(i=0; i<k; i++) //sa fie 0
    {
        shows[i]=0;
    };
    for(i=0; i<n; i++) //line e programul de n zile
    {
        scanf("%d",&tmp);
        line[i]=tmp-1;// showurile sunt numerotate 1 k
    };
    for(i=0; i<d; i++) //numaram showuri zile 0->d
    {
        shows[line[i]]++;
    };
    no=0;
    for(tmp=0; tmp<k; tmp++) //numaram showuri cu >=1 episod fara a atinge i
    {
        if(shows[tmp])
        {
            no++;
        };
    };
    minno=no;
    while(i<n)//important
    {
        shows[line[i]]++;//e un episod nou sin acel show
        shows[line[i-d]]--;
        if(shows[line[i]]==1)//daca am crescut 0->1
        {
            no++;
        };
        if(shows[line[i-d]]==0)//daca am scazut 1->0
        {
            no--;
        };
        if(no<minno) //minno e minim
        {
            minno=no;
        };
        i++;
    };
    results[t2-t]=minno;//se umple de la final
}
int main()
{
    scanf("%d",&t);
    t2=t;
    while(t)
    {
        onetest();
        t--;
    };
    for(t=0; t<t2; t++) //t pt ca i ar fi variabila in plus
    {
        printf("%d \n",results[t]);
    };
    return 0;
}

#include<stdio.h>
int main(){
	int t;
	scanf("%d",&t);
	while(t>0){
		int n,k,d;
		scanf("%d %d %d",&n,&k,&d);
		int a[n];
		int b[100];
		int max = k;
		int s = 0;
		for(int i = 0;i<100;i++){
			b[i] = 0;
		}
		for(int i = 0;i<n;i++) scanf("%d",&a[i]);
		for(int i = 0;i<n;i++){
			if(i+d>n) continue;
			for(int k = i;k-i<d&&k<n;k++){
				b[a[k]]++;
			}
			for(int k = 0;k<100;k++){
				if(b[k]>0) s++;
			b[k] = 0;
			}
			max = max>s?s:max;
			s = 0;
		}
		printf("%d\n",max);
		t--;
	}
	return 0;
}

#include<stdio.h>
static int c[1000005]={0};
int main()
{
    int t;
    scanf("%d",&t);
    while(t--)
    {
        int n,k,d;
        scanf("%d %d %d",&n,&k,&d);
        int a[n];
        for(int i=0;i<n;i++)
        {
            scanf("%d",&a[i]);
        }
        int min=k;
        int count=0;
        for(int i=0;i<n;i++)
        {
            if(c[a[i]]==0)
            {
                count++;
            }
            c[a[i]]++;
            if(i+1>=d)
            {
                if(count<min)
                    min=count;
                c[a[i+1-d]]--;
                if(c[a[i+1-d]]==0)
                    count--;
            }
        }
        printf("%d\n",min);
    }
    return 0;
}

/*  AUTHOR:AKASH JAIN
*   USERNAME:akash19jain
*   DATE:26/10/2019
*/
// #include<algorithm>
// #include <bits/stdc++.h>
// using namespace std;

#include<stdio.h>
#include<math.h>
#include<string.h>
#include<stdlib.h>
#include<stdbool.h>
#include<ctype.h>
#define SC1(x)          scanf("%lld",&x)
#define SC2(x,y)        scanf("%lld%lld",&x,&y)
#define SC3(x,y,z)      scanf("%lld%lld%lld",&x,&y,&z)
#define SCS(x)          scanf("\n%s", x)
#define PF1(x)          printf("%lld\n",x)
#define PF2(x,y)        printf("%lld %lld\n",x,y)
#define PF3(x,y,z)      printf("%lld %lld %lld\n",x,y,z)
#define PFN                printf("\n")
#define REP(i,n)        for(long long i=0;i<(n);++i)
#define FOR(i,a,b)      for(long long i=(a);i<=(b);++i)
#define FORD(i,a,b)     for(long long i=(a);i>=(b);--i)
#define WHILE(n)        while(n--)
#define MEM(a, b)       memset(a, (b), sizeof(a))
#define ITOC(c)         ((char)(((ll)'0')+c))
#define MID(s,e)        (s+(e-s)/2)
#define SZ(a)            strlen(a)
#define MOD             1000000007
#define MAX             10000000005
#define MIN             -10000000005
#define PI              3.1415926535897932384626433832795
#define DEB(x)          printf("The value of \"%s\" is: %d\n",#x,x)
#define CASES           ll t;SC1(t);while(t--)
#define ABS(a)          ((a>0)?a:-(a))
#define SWAP(a,b)        ll z=a;a=b;b=z
#define SWAPC(a,b)        char z=a;a=b;b=z

const int INF = 1<<29;
typedef long long ll;
typedef unsigned long long ull;
#define FILEIO(name) \  freopen(name".in", "r", stdin); \   freopen(name".out", "w", stdout);
int cmp(const void * a,const void * b);
long long maxv(long long a,long long b);
long long minv(long long a,long long b);
long long gcd(long long u,long long v);
long long digits(long long n);
bool isPoweroftwo(long long n);
ll count[1000001];
int main()
{
    CASES
    {
        ll n,k,d;
        SC3(n,k,d);
        ll arr[n];
        REP(i,n)
            SC1(arr[i]);
        ll min=MAX,c=0;
        REP(i,d)
        {
            ll x=arr[i];
            if(count[x]==0)
                c++;
            count[x]++;
        }
        min=c;
        FOR(i,d,n-1)
        {
            ll x=arr[i];
            if(count[x]==0)
                c++;
            count[x]++;
            x=arr[i-d];
            count[x]--;
            if(count[x]==0)
                c--;
            min=minv(c,min);
        }
        PF1(min);
    }
    return 0;
}

//qsort(arr,n,sizeof(arr[0]),cmp);
int cmp (const void * a, const void * b)
{
    if( *(ll*)a - *(ll*)b < 0 ) return -1;
    if( *(ll*)a - *(ll*)b > 0 ) return 1;
        return 0;
}
long long maxv(long long a,long long b)
{
    if(a>b) return a;
        return b;
}
long long minv(long long a,long long b)
{
    if(a<b) return a;
        return b;
}
long long gcd(long long u,long long v)
{
    if (v == 0) return u;
       return gcd(v, u%v);
}
long long digits(long long n)    //to calculate no of digits in a number
{
    return floor(log10(n))+1;
}
bool isPoweroftwo(long long x)
{
    return x && (!(x&(x-1)));
}

#include <stdio.h>
int main()
{
    int t,n,k,d,prev,min,fwd,bkd,count;
    scanf("%d",&t);
    while(t--)
    {
        scanf("%d %d %d",&n,&k,&d);
        int a[n],indv[k+1],frq[n];min=d,count=0;
        for(int i=0;i<k+1;i++)
        indv[i]=0;
        for(int i=0;i<n;i++)
        {
            scanf("%d",&a[i]);
            if(i<d)
            {
                indv[a[i]]++;
                if(indv[a[i]]==1)
                count++;
                frq[i]=count;
            }
            else
            {
                indv[a[i]]++;
                indv[a[i-d]]--;
                if(indv[a[i]]==1)
                count++;
                //if(indv[a[i-d]]==1)
                //count++;
                if(indv[a[i-d]]==0)
                count--;
                frq[i]=count;
            }
        }
        /*for(int i=0;i<n;i++)
        printf("%d ",frq[i]);
        printf("\n");*/
        for(int i=d-1;i<n;i++)
        {
            min=frq[i]<min?frq[i]:min;
        }
        printf("%d\n",min);
    }
}