pritiumbare2000 #include #include #include int main() { int count=0,pair=0,i,j,n,len; int arr[]={1,2,1,3,1,2,3,3,3,1}; len=sizeof(arr)/sizeof(int); for(i=0;i<n;i++) { scanf("%d",&arr[i]); } for(i=0;i<len;i++) { for(j=i;j<len;j++) { if(arr[i]==arr[j]) count++; } if(count%2==0) pair++; count=0; } printf("%d",pair); } Log in to Reply
Kritika def find_pair(color): sock={} pair=0 for a in color: if a in sock.keys(): sock[a]+=1 else: sock[a]=1 for b in sock.keys(): pair+=(sock[b])//2 return pair Log in to Reply
shushank #Python n=int(input()) l=list(map(int,input().split(” “))) s=list(set(l)) c=0 for i in range(len(s)): a1=s[i] d=l.count(a1) c=c+d//2 print(c) Log in to Reply
Mihir #python code def sockmerchant(socks): paircnt = 0 sockset = set(socks) for i in sockset : if socks.count(i) > 1 : paircnt += socks.count(i) // 2 return paircnt a = input() socks = input() socks = socks.split(‘ ‘) socks = list(map(int,socks)) print(sockmerchant(socks)) Log in to Reply
goutham #include using namespace std; int main() {int i,j,x,n,count=0,pair=0; cin>>n; int a[n]; for(i=0;i>a[i];} sort(a,a+n);x=a[0]; for(i=0;i<n;i++) {if(a[i]==x) {count++;} if(a[i]!=x) {pair=pair+(count/2); x=a[i];count=1;} if(i==n-1) {pair=pair+(count/2);} } cout<<pair; return 0; } Log in to Reply
sneha #include int main() { int a[10]={10,20,20,10,10,30,50,10,20},c=0,p=0; for(int i=0;i<9;i++) { for(int j=i;j<9;j++) { if(a[i]==a[j]) { c++; } } if(c%2==0) { p++; } c=0; } printf("%d",p); return 0; } Log in to Reply
rabi from collections import Counter list1=[] n=int(input()) arr=list(map(int,input().split())) x=Counter(arr) for i in x.values(): list1.append(i) sum1=0 for i in list1: if i>1: sum1+=i print(sum1//2) Log in to Reply
#include
#include
#include
int main()
{
int count=0,pair=0,i,j,n,len;
int arr[]={1,2,1,3,1,2,3,3,3,1};
len=sizeof(arr)/sizeof(int);
for(i=0;i<n;i++)
{
scanf("%d",&arr[i]);
}
for(i=0;i<len;i++)
{
for(j=i;j<len;j++)
{
if(arr[i]==arr[j])
count++;
}
if(count%2==0)
pair++;
count=0;
}
printf("%d",pair);
}
def find_pair(color):
sock={}
pair=0
for a in color:
if a in sock.keys():
sock[a]+=1
else:
sock[a]=1
for b in sock.keys():
pair+=(sock[b])//2
return pair
#Python
n=int(input())
l=list(map(int,input().split(” “)))
s=list(set(l))
c=0
for i in range(len(s)):
a1=s[i]
d=l.count(a1)
c=c+d//2
print(c)
#python code
def sockmerchant(socks):
paircnt = 0
sockset = set(socks)
for i in sockset :
if socks.count(i) > 1 :
paircnt += socks.count(i) // 2
return paircnt
a = input()
socks = input()
socks = socks.split(‘ ‘)
socks = list(map(int,socks))
print(sockmerchant(socks))
#include
using namespace std;
int main()
{int i,j,x,n,count=0,pair=0;
cin>>n;
int a[n];
for(i=0;i>a[i];}
sort(a,a+n);x=a[0];
for(i=0;i<n;i++)
{if(a[i]==x)
{count++;}
if(a[i]!=x)
{pair=pair+(count/2);
x=a[i];count=1;}
if(i==n-1)
{pair=pair+(count/2);}
}
cout<<pair;
return 0;
}
#include
int main()
{
int a[10]={10,20,20,10,10,30,50,10,20},c=0,p=0;
for(int i=0;i<9;i++)
{
for(int j=i;j<9;j++)
{
if(a[i]==a[j])
{
c++;
}
}
if(c%2==0)
{
p++;
}
c=0;
}
printf("%d",p);
return 0;
}
from collections import Counter
list1=[]
n=int(input())
arr=list(map(int,input().split()))
x=Counter(arr)
for i in x.values():
list1.append(i)
sum1=0
for i in list1:
if i>1:
sum1+=i
print(sum1//2)