submission_id
stringlengths
5
9
problem_id
stringlengths
3
6
date
int64
-1
-1
language
stringclasses
11 values
verdict
stringclasses
1 value
cpu_time
int64
-1
15k
memory
int64
-1
1.07B
code
stringlengths
16
11k
source
stringclasses
1 value
testcount
int64
0
604
lenght
int64
16
11k
40469726
1000A
-1
c
Accepted
46
8,192
#include <stdio.h> #include <stdlib.h> #include <string.h> int main(){ int n; scanf("%d",&n); char tab[2*n][10]; for(int i=0;i<2*n;i++){ scanf("%s",&tab[i]); } int count=0; int i=0; while(i<n){ int j=n; while(j<2*n){ if(strcmp(tab[j],tab[i])==0){count++;tab[j][0]='Z';j=2*n;} j++; } i++; } printf("%d",n-count); return 0; }
codeforces
37
329
39820932
1000A
-1
c
Accepted
31
8,192
#include<stdio.h> #include<string.h> int main() { int n,i,j,count=0; scanf("%d",&n); char str[2*n][10]; for(i=0;i<2*n;i++) scanf("%s",&str[i]); for(i=0;i<n;i++) { for(j=n;j<2*n;j++){ if(strcmp(str[i],str[j])==0) { count++; strcpy(str[j],"ooo"); break; } } } printf("%d",n-count); return 0; }
codeforces
37
441
39720115
1000A
-1
c
Accepted
31
20,480
#include<stdio.h> #include<stdlib.h> #include<string.h> #include<math.h> int main() { char a[1005][10],b[1005][10]; int n,i,j; scanf("%d",&n); for(i=0;i<n;i++) scanf("%s",a[i]); for(i=0;i<n;i++) scanf("%s",b[i]); int mark[1005]={0},ans=n; for(i=0;i<n;i++) { for(j=0;j<n;j++) { if(mark[j]==0) { if(strcmp(b[i],a[j])==0) { mark[j]=1; ans--; break; } } } } printf("%d\n",ans ); return 0; }
codeforces
37
448
39713321
1000A
-1
c
Accepted
15
8,192
#include<stdio.h> #include<string.h> int main() { int n,s=0,m,i,j; scanf("%d\n",&n); m=n; char t[n+1][5]; char u[n+1][5]; for(i=0;i<n;i++) {gets(t[i]); //fflush(stdin); } for(j=0;j<n;j++) {gets(u[j]); //fflush(stdin); } for(i=0;i<m;i++) {for(j=0;j<m;j++) { if(!strcmp(t[j],u[i])) {/*m--; strcpy(u[i],u[m]); strcpy(t[j],t[m]); i--;*/ strcpy(t[j],"xD"); s++; break; } } } s=n-s; printf("%d",s); }
codeforces
37
501
41293431
1000A
-1
c
Accepted
31
8,192
#include<stdio.h> #include<string.h> int main() { char t[210][10],s[5]= {'c','c','c','\0'}; int i,n,count=0,j; scanf("%d",&n); getchar(); for(i=0; i<2*n; i++) { gets(t[i]); } for(i=0; i<n; i++) { for(j=n; j<2*n; j++) { if(strcmp(t[i],t[j])==0) { strcpy(t[j],s); count++; break; } } } printf("%d\n",n-count); return 0; }
codeforces
37
513
40049227
1000A
-1
c
Accepted
31
4,096
#include<stdio.h> #include<stdlib.h> #include<string.h> #include<time.h> int N; int check[201]; int main() { char a[201][10]; scanf("%d ", &N); for (int i = 1; i <= 2*N; i++) { gets(a[i]); } for (int i = 1; i <= N; i++) { for (int j = N + 1; j <= 2 * N; j++) { if (!strcmp(a[i], a[j]) && (check[i] == 0 && check[j] == 0)) { check[i] = 1; check[j] = 1; } } } int sum = 0; for (int i = 1; i <= N; i++) { if (check[i] == 0) { sum++; } } printf("%d", sum); }
codeforces
37
518
50852999
1000A
-1
c
Accepted
31
12,288
#include <stdio.h> #include <string.h> int type(char c) { return c == 'S' ? 0 : c == 'M' ? 1 : 2; } int main() { static int kk[4][3], ll[4][3]; static char s[16]; int n, m, i, j, ans; scanf("%d", &n); for (i = 0; i < n; i++) { scanf("%s", s); m = strlen(s); kk[m - 1][type(s[m - 1])]++; } for (i = 0; i < n; i++) { scanf("%s", s); m = strlen(s); ll[m - 1][type(s[m - 1])]++; } ans = n; for (i = 0; i < 4; i++) for (j = 0; j < 3; j++) ans -= kk[i][j] < ll[i][j] ? kk[i][j] : ll[i][j]; printf("%d\n", ans); return 0; }
codeforces
37
550
106935891
1000A
-1
c
Accepted
15
8,192
#include<stdio.h> #include<string.h> main() { int n, i, j, c = 0, k; struct b{char d[7];}; scanf("%d", &n); j = 2 * n; struct b a[j]; for(i = 0; i < j; i++) scanf("%s", &a[i].d); for(i = 0; i < n; i++) { for(k = n; k < j; k++) { if(strcmp(a[i].d, a[k].d) == 0) {strcpy(a[k].d, "null"); c++; break;} } } printf("%d\n", n - c); return 0; }
codeforces
37
554
106935891
1000A
-1
c
Accepted
15
8,192
#include<stdio.h> #include<string.h> main() { int n, i, j, c = 0, k; struct b{char d[7];}; scanf("%d", &n); j = 2 * n; struct b a[j]; for(i = 0; i < j; i++) scanf("%s", &a[i].d); for(i = 0; i < n; i++) { for(k = n; k < j; k++) { if(strcmp(a[i].d, a[k].d) == 0) {strcpy(a[k].d, "null"); c++; break;} } } printf("%d\n", n - c); return 0; }
codeforces
37
554
39707902
1000A
-1
c
Accepted
31
8,192
#include<stdio.h> #include<string.h> int equal(char *a,char *b) { int i; if(strlen(a)!=strlen(b)) return 0; for(i=0;i<strlen(a);i++) if(*(a+i)!=*(b+i)) return 0; return 1; } int main() { int n,i,j,cnt=0,flag; char a[105][10],b[105][10]; scanf("%d",&n); for(i=0;i<n;i++) scanf("%s",a[i]); for(i=0;i<n;i++) scanf("%s",b[i]); for(i=0;i<n;i++) { flag=1; for(j=0;j<n;j++) { if(equal(a[i],b[j])) { b[j][0]='\0'; flag=0; break; } } if(flag) cnt++; } printf("%d",cnt); return 0; }
codeforces
37
569
39719002
1000A
-1
c
Accepted
30
172,032
#include<stdio.h> #include<stdlib.h> #include<string.h> int main(){ int i,j,n,c; scanf("%d",&n); c=n; char **s=(char**)malloc(sizeof(char**)*n); for(i=0;i<n;i++) s[i]=(char*)malloc(sizeof(char*)*10); char **s1=(char**)malloc(sizeof(char**)*n); for(i=0;i<n;i++) s1[i]=(char*)malloc(sizeof(char*)*10); for(i=0;i<n;i++){ scanf("%s",s[i]); } for(i=0;i<n;i++){ scanf("%s",s1[i]); } for(i=0;i<n;i++){ for(j=0;j<n;j++){ if(strcmp(s[i],s1[j])==0){ strcpy(s1[j],"xyz"); c--; break; } } } printf("%d",c); return 0; }
codeforces
37
591
39708883
1000A
-1
c
Accepted
30
45,056
#include<stdio.h> #include<string.h> int main() { int n,total=0,i,j,c; scanf("%d",&n); char prev[n][256],next[n][256]; for(i=0;i<n;i++) scanf("%s",prev[i]); for(i=0;i<n;i++) scanf("%s",next[i]); for(i=0;i<n;i++) { c=1; for(j=0;j<n;j++) { if(strcmp(prev[i],next[j])==0) { strcpy(next[j],"a"); c=0; break; } } if(c!=0) { total++; } } printf("%d",total); return 0; }
codeforces
37
593
39709843
1000A
-1
c
Accepted
15
20,480
#include<stdio.h> #include<string.h> int main() { int i,count=0,x,j,n,flag; char a[101][101],b[101][101]; scanf("%d ",&x); for(i=0;i<x;i++) { gets(a[i]); } for(i=0;i<x;i++) { gets(b[i]); } for(i=0;i<x;i++) { flag=0; for(j=0;j<x;j++) { n=strcmp(a[i],b[j]); if(n==0) { strcpy(b[j],"bara"); flag=1; break; } } if(flag==0) {count++;} } printf("%d",count); }
codeforces
37
607
39705255
1000A
-1
c
Accepted
31
8,192
/* Teng K. J. */ #include <stdio.h> #define N 3 #define M 4 int a[M][N]; int f(int ch) { switch (ch) { case 'S': return 0; case 'M': return 1; case 'L': return 2; }; return -1; } int main() { int n, ans = 0; int i, j, ch, t; scanf("%d", &n); getchar(); for (i = 0; i < n; i++) { t = 0; while ((ch = getchar()) == 'X') t++; a[t][f(ch)]++; getchar(); } for (i = 0; i < n; i++) { t = 0; while ((ch = getchar()) == 'X') t++; a[t][f(ch)]--; getchar(); } for (i = 0; i < M; i++) for (j = 0; j < N; j++) if (a[i][j] > 0) ans += a[i][j]; printf("%d", ans); return 0; }
codeforces
37
617
39735900
1000A
-1
c
Accepted
30
4,096
#include <stdio.h> #include<string.h> int main(void) { // your code goes here int temp,i,j,k,sec=0,pl; char p[100][5]; char c[100][5]; char ch[5]; int n; scanf("%d",&n); temp=n; int count=0; while(n--) { scanf("%s",p[count++]); } count=0; n=temp; while(n--) { scanf("%s",c[count++]); } for(i=0;i<temp;i++) { strcpy(ch,p[i]); for(j=0;j<temp;j++) { if(strcmp(ch,c[j])==0) { strcpy(c[j],"\0"); break; } } if(j==temp) sec++; } printf("%d",sec); return 0; }
codeforces
37
622
39707455
1000A
-1
c
Accepted
15
8,192
#include<stdio.h> #include<string.h> int n; char a[107][10],b[107][10]; int x[107]; void run(){ int i,j,r; while(scanf("%d",&n)!=EOF){ for(i=0;i<n;i++){ scanf("%s",a[i]); } for(i=0;i<n;i++){ scanf("%s",b[i]); } for(i=0;i<n;i++){ x[i]=0; } for(i=0;i<n;i++){ for(j=0;j<n;j++){ if(x[j]==1){ continue; } if(strcmp(a[j],b[i])==0){ x[j]=1; break; } } } r=0; for(i=0;i<n;i++){ if(x[i]==0){ r++; } } printf("%d\n",r); } } main(){ #ifndef ONLINE_JUDGE freopen("e45a_min.in","rb",stdin); freopen("e45a_.out","wb",stdout); #endif run(); return 0; }
codeforces
37
625
47271550
1000A
-1
c
Accepted
31
8,192
#include <stdio.h> int main() { int test,d,n,i,sum=0,count=0,j,flag=0,p,y,o,g,r,m, a,b,c; char k[1001][10],k1[100]; scanf("%d",&n); a=n; for(i=0;i<n;i++) { scanf("%s",k[i]); } for(i=0;i<a;i++) { scanf("%s",k1); for(j=0;j<a;j++) { if(strcmp(k1,k[j])==0) { count++; k[j][0]='\n'; break; } } } printf("%d",(n-count)); return 0; }
codeforces
37
662
40305758
1000A
-1
c
Accepted
31
12,288
#include<stdio.h> #include<stdlib.h> #include<string.h> int main() { int n; scanf("%d",&n); char a[n][100],b[n][100]; int strlen1[n],strlen2[n]; for(int i=0;i<n;i++) { scanf("%s",a[i]); strlen1[i]=strlen(a[i]); } for(int i=0;i<n;i++) { scanf("%s",b[i]); strlen2[i]=strlen(b[i]); } int f=0; int visited[100]; for(int i=0;i<100;i++) { visited[i]=0; } int count=0; for(int i=0;i<n;i++) { for(int j=0;j<n;j++) { if(strlen1[i]==strlen2[j] && visited[j]!=1) { if(strcmp(a[i],b[j])==0) { visited[j]=1; count++; break; } } } } printf("%d",n-count); }
codeforces
37
718
40305758
1000A
-1
c
Accepted
31
12,288
#include<stdio.h> #include<stdlib.h> #include<string.h> int main() { int n; scanf("%d",&n); char a[n][100],b[n][100]; int strlen1[n],strlen2[n]; for(int i=0;i<n;i++) { scanf("%s",a[i]); strlen1[i]=strlen(a[i]); } for(int i=0;i<n;i++) { scanf("%s",b[i]); strlen2[i]=strlen(b[i]); } int f=0; int visited[100]; for(int i=0;i<100;i++) { visited[i]=0; } int count=0; for(int i=0;i<n;i++) { for(int j=0;j<n;j++) { if(strlen1[i]==strlen2[j] && visited[j]!=1) { if(strcmp(a[i],b[j])==0) { visited[j]=1; count++; break; } } } } printf("%d",n-count); }
codeforces
37
718
40502960
1000A
-1
c
Accepted
31
12,288
#include<stdio.h> #include<math.h> int max3(int a1,int a2,int a3) { if(a1<a2) a1=a2; if(a1>a3) a3=a1; return a3; } int main() { int n; char c; int temp; int p[4]={0},q[4]={0},r[4]={0}; scanf("%d",&n); getchar(); for(int i=1;i<=n;i++){ temp=0; while((c=getchar())!='\n'){ if(c=='X') temp++; if(c=='L') p[temp]++; if(c=='M') q[temp]++; if(c=='S') r[temp]++; } } for(int i=1;i<=n;i++){ temp=0; while((c=getchar())!='\n'){ if(c=='X') temp++; if(c=='L') p[temp]--; if(c=='M') q[temp]--; if(c=='S') r[temp]--; } } int total=0; for(int i=0;i<=3;i++){ //SFD total+=max3(abs(p[i]),abs(q[i]),abs(r[i])); } printf("%d",total); return 0; }
codeforces
37
720
39722589
1000A
-1
c
Accepted
31
8,192
#include <stdio.h> #include <string.h> int main() { int n , a , k , re , b , j , cc ; scanf("%d",&n) ; cc = n ; b = 2*n ; char ara[b][10] ; for(a=0 ; a<b ; a++ ) { scanf("%s",ara[a]) ; } for( k = 0 ; k < b/2 ; k++ ) { for( j = cc ; j < b ; j++ ) { re = strcmp(ara[k] , ara[j]) ; if( re == 0 ) { n = n - 1 ; strcpy(ara[j] , "fml") ; break ; } } } printf("%d\n",n) ; return 0 ; }
codeforces
37
785
39720471
1000A
-1
c
Accepted
31
151,552
#include <stdio.h> #include <stdlib.h> #include <string.h> int main() { int n; char **a,**b; int c=0; scanf("%d",&n); a=(char**)malloc(n*(sizeof(char*))); for (int j = 0; j < n; j++) { a[j] = (char*) malloc(sizeof(char) * 5); } b=(char**)malloc(n*(sizeof(char*))); for (int j = 0; j < n; j++) { b[j] = (char*) malloc(sizeof(char) * 5); } for(int i=0;i<n;i++){ scanf("%s",a[i]); } for(int i=0;i<n;i++){ scanf("%s",b[i]); } for(int i=0;i<n;i++){ for(int j=0;j<n;j++){ if(strcmp(a[i],b[j])==0){ c++; b[j]="XXXXX"; break; } } } printf("%d",n-c); return 0; }
codeforces
37
789
47166780
1000A
-1
c
Accepted
31
8,192
#include <stdio.h> #include <string.h> int Cnt[9]; char Match[][5] = {"XXXS", "XXS", "XS", "S", "M", "L", "XL", "XXL", "XXXL"}; int main() { int n; char str[5]; scanf("%d", &n); for(int i = 0; i < n; ++i) { scanf("%s", str); for(int j = 0; j < 9; ++j) { if(strcmp(str, Match[j]) == 0) { ++Cnt[j]; break; } } } for(int i = 0; i < n; ++i) { scanf("%s", str); for(int j = 0; j < 9; ++j) { if(strcmp(str, Match[j]) == 0) { if(Cnt[j]) { --Cnt[j]; } break; } } } int ans = 0; for(int i = 0; i < 9; ++i) { ans += Cnt[i]; } printf("%d\n", ans); return 0; }
codeforces
37
803
90075014
1000A
-1
c
Accepted
31
4,096
#include<stdio.h> int main() { int n,cnt=0; scanf("%d",&n); char s[101][6]={'\0'},t[101][6]={'\0'}; for(int i=0;i<n;i++) scanf("%s",s[i]); for(int i=0;i<n;i++) scanf("%s",t[i]); for(int i=0;i<n;i++) { for(int j=0;j<n;j++) { if(strcmp(s[i],t[j])==0) { strcpy(s[i],"nitin"); strcpy(t[j],"nitin"); break; } } } int ls,lt; for(int i=0;i<n;i++) { ls=strlen(s[i]); if(ls<5) { for(int j=0;j<n;j++) { lt=strlen(t[j]); if(ls==lt) { for(int k=0;k<lt;k++) { if(s[i][k]!=t[j][k]) cnt++; } strcpy(t[j],"nitin"); } } } } /*for(int i=0;i<n;i++) printf("%s\n",s[i]); for(int i=0;i<n;i++) printf("%s\n",t[i]);*/ printf("%d",cnt); return 0; }
codeforces
37
809
39706794
1000A
-1
c
Accepted
31
28,672
#define _USE_MATH_DEFINES #include <stdio.h> #include <math.h> #include <stdlib.h> #include <string.h> #include <ctype.h> #include <stdbool.h> #include <float.h> #include <limits.h> #include <malloc.h> #include <memory.h> #include <complex.h> #include <errno.h> #include <time.h> int n,i,j,ans,f[105]={0},t; char *a[9]={"XXXS","XXS","XS","S","M","L","XL","XXL","XXXL"}; char s[105][105],ss[105][105]; int main() { scanf("%d\n",&n); for (i=1;i<=n;i++) { scanf("%s",s[i]); for (j=0;j<9;j++) if (strcmp(s[i],a[j])==0) { f[j]++; break; } } for (i=1,ans=0;i<=n;i++) { scanf("%s",ss[i]); for (j=0;j<9;j++) if (strcmp(ss[i],a[j])==0) { t=j; break; } if (f[t]) f[t]--; else ans++; } printf("%d\n",ans); return 0; }
codeforces
37
835
39713245
1000A
-1
c
Accepted
30
24,576
#include <stdio.h> #include <string.h> int main(void) { int n,c,d=0,i,j,k,e,i1; char a[102][102],b[102][102]; scanf("%d",&n); for(i=0;i<n;i++) { scanf("%s",a[i]); } for(i=0;i<n;i++) { scanf("%s",b[i]); } for(i=0;i<n;i++) { e=1; c=1; for(j=0;j<n;j++) { k=0; c=1; while(a[i][k]!='\0') { if(a[i][k]==b[j][k]) { } else { c=0; } k++; } if(c==1) { e=0; b[j][0]='P'; j=n; } } if(e==1) d++; } printf("%d",d); return 0; }
codeforces
37
844
39713744
1000A
-1
c
Accepted
30
147,456
#include <stdio.h> #include <stdlib.h> #include <string.h> int main() { int n, i, j, count = 0; scanf("%d", &n); char **a, **b; a = (char **)malloc(sizeof(char *)*n); b = (char **)malloc(sizeof(char *)*n); for (i = 0; i < n; i++) { a[i] = (char *)malloc(5 * sizeof(char)); b[i] = (char *)malloc(5 * sizeof(char)); } for (i = 0; i < n; i++) { scanf("%s", a[i]); } for (i = 0; i < n; i++) { scanf("%s", b[i]); } for (i = 0; i < n; i++) { for (j = 0; j < n; j++) { if (strcmp(a[i],b[j])== 0) { a[i] = "\0"; b[j] = "\0"; break; } } } for (i = 0; i < n; i++) { if (a[i] != "\0") { for (j = 0; j < n; j++) { if (b[j] != "\0") { if (strlen(a[i]) == strlen(b[j])) { count++; a[i] = "\0"; b[j] = "\0"; break; } } } } } printf("%d", count); return 0; }
codeforces
37
925
39722720
1000A
-1
c
Accepted
31
8,192
#include <stdio.h> int get_index(char *string) { if (string[0] == 'S') return 0; if (string[0] == 'M') return 1; if (string[0] == 'L') return 2; if (string[1] == 'S') return 3; if (string[1] == 'L') return 4; if (string[2] == 'S') return 5; if (string[2] == 'L') return 6; if (string[3] == 'S') return 7; if (string[3] == 'L') return 8; return 0; } int main() { int cnt = 0; int n, i; int a[9] = {0}; int b[9] = {0}; char string[64]; scanf("%d", &n); for (i = 0; i < n; i++) { scanf("%s", string); a[get_index(string)]++; } for (i = 0; i < n; i++) { scanf("%s", string); b[get_index(string)]++; } for (i = 0; i < 9; i++) { cnt += (a[i] > b[i]) ? (a[i] - b[i]) : (b[i] - a[i]); } printf("%d\n", cnt / 2); return 0; }
codeforces
37
926
39723292
1000A
-1
c
Accepted
31
8,192
#include <stdio.h> #include <stdlib.h> #include <string.h> int main(void) { int n; scanf("%d\n", &n); char stra[n][5]; char strb[n][5]; for (int i = 0; i < n; ++i) { scanf("%s", stra[i]); } for (int i = 0; i < n; ++i) { char temp[4]; scanf("%s", temp); int xx = 1; for (int j = 0; j < n; ++j) { if (strcmp(temp, stra[j])==0) { strcpy(stra[j], "a"); strcpy(strb[i], "a"); xx = 0; break; } } if (xx==1) { strcpy(strb[i], temp); } } // // // for (int i = 0; i < n; ++i) // { // printf("%s wasd\n", stra[i]); // }printf("\n"); // for (int i = 0; i < n; ++i) // { // printf("%s ffffffffffffff\n", strb[i]); // }printf("\n"); // // int count = 0; for (int i = 0; i < n; ++i) { for (int j = 0; j < n; ++j) { if (strlen(stra[i])==strlen(strb[j]) && strcmp(stra[i], "a") && strcmp(strb[j], "a")) { count++; strcpy(strb[j], "a"); } } } printf("%d\n", count); return 0; }
codeforces
37
981
44434453
1000A
-1
c
Accepted
30
28,672
#include<stdio.h> int main() { char a[101][101]; char b[101][101]; int shirt,i,j,x; int count=0; int win=0; scanf("%d",&shirt); for(i=0; i<shirt; i++) { scanf("%s",a[i]); } for(i=0; i<shirt; i++) { scanf("%s",b[i]); } for(i=0; i<shirt; i++) { count = 0; for(j=0; j<shirt; j++) { x = strcmp(a[i],b[j]); if(x==0) { strcat(b[j],"BAL"); break; } else { count++; } } if(count==shirt) { win++; } } printf("%d",win); return 0; }
codeforces
37
985
44434453
1000A
-1
c
Accepted
30
28,672
#include<stdio.h> int main() { char a[101][101]; char b[101][101]; int shirt,i,j,x; int count=0; int win=0; scanf("%d",&shirt); for(i=0; i<shirt; i++) { scanf("%s",a[i]); } for(i=0; i<shirt; i++) { scanf("%s",b[i]); } for(i=0; i<shirt; i++) { count = 0; for(j=0; j<shirt; j++) { x = strcmp(a[i],b[j]); if(x==0) { strcat(b[j],"BAL"); break; } else { count++; } } if(count==shirt) { win++; } } printf("%d",win); return 0; }
codeforces
37
985
39709691
1000A
-1
c
Accepted
15
147,456
#include<stdio.h> #include<string.h> #include<stdlib.h> int comp(const void *a,const void *b) { char *str1,*str2; str1=(char*)malloc(sizeof(char)*5); str2=(char*)malloc(sizeof(char)*5); strcpy((char *)a,str1); strcpy((char *)b,str2); return strcmp(str1,str2); } int main() { int n,i,j; scanf("%d",&n); char **pr=(char**)malloc(sizeof(char*)*n); char **ps=(char**)malloc(sizeof(char*)*n); for(i=0;i<n;i++) { pr[i]=(char*)malloc(sizeof(char)*5); scanf("%s",pr[i]); } for(i=0;i<n;i++) { ps[i]=(char*)malloc(sizeof(char)*5); scanf("%s",ps[i]); } //qsort(pr,n,sizeof(char**),comp); //qsort(ps,n,sizeof(char**),comp); int count=0; for(i=0;i<n;i++) { int flag=0; for(j=0;j<n;j++) { if(pr[i][0]!='\0' && ps[j][0]!='\0' && strcmp(pr[i],ps[j])==0) { flag=1; pr[i][0]='\0'; ps[j][0]='\0'; break; } } if(flag==0) count++; } printf("%d",count); return 0; }
codeforces
37
992
39710316
1000A
-1
c
Accepted
30
8,192
#include <stdio.h> #include <string.h> int ones[3],OO[3], s[4], l[4], ans,n,i; int main(){char tmp[111]; for(scanf("%i", &n); i<n ; i++) { scanf("%s", tmp); int len = strlen(tmp); if(len==1){ if(tmp[0]=='M') ones[0]++; if(tmp[0]=='S') ones[1]++; if(tmp[0]=='L') ones[2]++; } else if(tmp[len-1]=='S') s[len-1]++; else if(tmp[len-1]=='L') l[len-1]++; } for(i=0;i<n;i++) { scanf("%s", tmp); int len = strlen(tmp); if(len==1){ if(tmp[0]=='M') OO[0]++; if(tmp[0]=='S') OO[1]++; if(tmp[0]=='L') OO[2]++; } else if(tmp[len-1]=='S') s[len-1]--; else if(tmp[len-1]=='L') l[len-1]--; } for(i=1 ; i<4 ; i++) if(s[i]<0) ans+= -s[i]; else if(l[i]<0) ans+= -l[i]; for(i=0 ; i<3 ; i++) if(ones[i]-OO[i]>0) ans+=ones[i]-OO[i]; printf("%i\n", ans); }
codeforces
37
1,051
39717983
1000A
-1
c
Accepted
31
8,192
#include <stdio.h> #include <string.h> #define min(a, b) (a < b ? a : b) int last[9], cur[9]; char temp[10]; int N, i; void update(int test[9]) { for (i = 0; i < N; i++) { scanf("%s", temp); if (!strcmp(temp, "XXXS")) test[0]++; else if (!strcmp(temp, "XXS")) test[1]++; else if (!strcmp(temp, "XS")) test[2]++; else if (!strcmp(temp, "S")) test[3]++; else if (!strcmp(temp, "M")) test[4]++; else if (!strcmp(temp, "L")) test[5]++; else if (!strcmp(temp, "XL")) test[6]++; else if (!strcmp(temp, "XXL")) test[7]++; else test[8]++; } } int main() { int ans; memset(last, 0, sizeof(last)); memset(cur, 0, sizeof(cur)); scanf("%d", &N); update(last); update(cur); ans = N; for (i = 0; i < 9; i++) { if (cur[i] > 0 && last[i] > 0) { ans -= min(cur[i], last[i]); } } printf("%d\n", ans); return 0; }
codeforces
37
1,067
39711742
1000A
-1
c
Accepted
31
8,192
#include <stdio.h> #include <stdlib.h> #define NUMBER_OF_SIZES 9 void scanfSizes(int sizes[ NUMBER_OF_SIZES ], int sizesLength) { char word[ 5 ]; int i, j; for ( i = 0; i < sizesLength; i++ ) { scanf( "" ); scanf( " %s", word ); if ( word[ 0 ] == 'M' ) { sizes[ NUMBER_OF_SIZES - 1 ]++; } else { int letterPosition = 0; while ( word[ letterPosition ] == 'X' ) { letterPosition++; } switch ( word[ letterPosition ] ) { case 'S': sizes[ 2 * letterPosition ]++; break; case 'L': sizes[ 2 * letterPosition + 1 ]++; break; } } } } int main() { int n; scanf( "%d", &n ); int i; int lastYearSizes[ NUMBER_OF_SIZES ]; for ( i = 0; i < NUMBER_OF_SIZES; i++ ) { lastYearSizes[ i ] = 0; } scanfSizes( lastYearSizes, n ); int currentYearSizes[ NUMBER_OF_SIZES ]; for ( i = 0; i < NUMBER_OF_SIZES; i++ ) { currentYearSizes[ i ] = 0; } scanfSizes( currentYearSizes, n ); int seconds = 0; for ( i = 0; i < NUMBER_OF_SIZES; i++ ) { seconds += abs( lastYearSizes[ i ] - currentYearSizes[ i ] ); } printf( "%d", seconds / 2 ); return 0; }
codeforces
37
1,170
55994058
1000A
-1
c
Accepted
31
4,096
#include <stdio.h> #include <stdlib.h> #include <string.h> long int a[10]={0}; //XXXS,XXS,XS,S,M,L,XL,XXL,XXXL long int b[10]={0}; char s[100]; int main(){ long int i,j,k,l,t,n,x,y,count,flag,m; scanf("%ld",&n); for(i=0;i<n;i++) { scanf("%s",s); j = strlen(s); if(j==1){ if(s[0]=='S') a[3]++; else if(s[0]=='M') a[4]++; else if(s[0]=='L') a[5]++; } else if(j==2){ if(s[1]=='S') a[2]++; else if(s[1]=='L') a[6]++; } else if(j==3){ if(s[2]=='S') a[1]++; else if(s[2]=='L') a[7]++; } else if(j==4){ if(s[3]=='S') a[0]++; else if(s[3]=='L') a[8]++; } } for(i=0;i<n;i++) { scanf("%s",s); j = strlen(s); if(j==1){ if(s[0]=='S') b[3]++; else if(s[0]=='M') b[4]++; else if(s[0]=='L') b[5]++; } else if(j==2){ if(s[1]=='S') b[2]++; else if(s[1]=='L') b[6]++; } else if(j==3){ if(s[2]=='S') b[1]++; else if(s[2]=='L') b[7]++; } else if(j==4){ if(s[3]=='S') b[0]++; else if(s[3]=='L') b[8]++; } } count= 0; for(i=0;i<=8;i++){ //hprintf("%ld %ld\n",a[i],b[i]); count += abs(a[i]-b[i]); } printf("%ld\n",count/2); return 0; }
codeforces
37
1,181
39846064
1000A
-1
c
Accepted
31
151,552
#include <stdio.h> #include <stdlib.h> #include <string.h> int main(){ int i, j, k, l, count, c_count, d, nm= 0, n; scanf("%i", &n); char *size_pre[n], *size_cur[n]; for(i=0; i<n; ++i){ size_pre[i]= malloc(10); scanf("%s", size_pre[i]); } for(i=0; i<n; ++i){ size_cur[i]= malloc(10); scanf("%s", size_cur[i]); } for(i=0; i<n; ++i){ c_count= 0; for(j=0; j<n; ++j){ if(strlen(size_cur[i])== strlen(size_pre[j])){ count= strlen(size_cur[i]); for(k=0, l=0; size_cur[i][k]!= '\0'; ++k, ++l){ if(size_cur[i][k]==size_pre[j][l]){ --count; } } if(!count){ c_count= 1; d= j; } } } if(c_count){ size_pre[d]= "z"; ++nm; } } printf("%i", n-nm); for(i=0; i<n; ++i){ free(size_pre[i]); free(size_cur[i]); } }
codeforces
37
1,191
39723223
1000A
-1
c
Accepted
15
12,288
#include <stdio.h> #include <string.h> #define MAX_COUNT 100 #define MAX_LEN 6 #define INFINITE 100000 void ReadLine(char *str, int size) { fgets(str, size, stdin); if (str[strlen(str) - 1] == '\n') { str[strlen(str) - 1] = '\0'; } } int GetDiff(char *str1, char *str2) { if (*str1 == '\0' || *str2 == '\0') { return INFINITE; } int diff = 0; while ((*str1 != '\0') && (*str2 != '\0')) { diff += (*str1 != *str2) ? 1 : 0; str1 += 1; str2 += 1; } return (*str1 != '\0' || *str2 != '\0') ? INFINITE : diff; } int main() { int count; scanf("%d%*c", &count); char last[MAX_COUNT][MAX_LEN]; char curr[MAX_COUNT][MAX_LEN]; int i; for (i = 0; i < count; ++i) { ReadLine(last[i], MAX_LEN); } for (i = 0; i < count; ++i) { ReadLine(curr[i], MAX_LEN); } int changes = 0; for (i = 0; i < count; ++i) { int min_diff = MAX_LEN; int best_j = -1; int best_k = -1; int j, k; for (j = 0; j < count; ++j) { for (k = 0; k < count; ++k) { int diff = GetDiff(last[j], curr[k]); if (diff < min_diff) { min_diff = diff; best_j = j; best_k = k; } } } changes += min_diff; last[best_j][0] = '\0'; curr[best_k][0] = '\0'; } printf("%d\n", changes); return 0; }
codeforces
37
1,304
119431519
1000A
-1
c
Accepted
30
8,192
#include<stdio.h> #include<string.h> int main() { int n,result=0,i; int last[15]={0}; scanf("%d",&n); getchar(); char s[10]; for(i=0;i<n;i++){ gets(s); int l=strlen(s); switch(l){ case 1: if(s[0]=='S') last[4]++; if(s[0]=='M') last[5]++; if(s[0]=='L') last[6]++; break; case 2: if(s[l-1]=='S') last[3]++; if(s[l-1]=='L') last[7]++; break; case 3: if(s[l-1]=='S') last[2]++; if(s[l-1]=='L') last[8]++; break; case 4: if(s[l-1]=='S') last[1]++; if(s[l-1]=='L') last[9]++; break; } } int j=0; int now[103]={0}; int p=0; int alone[101]={0}; for(i=0;i<n;i++){ gets(s); int l=strlen(s); switch(l){ case 1: if(s[0]=='S') alone[p++]=4; if(s[0]=='M') alone[p++]=5; if(s[0]=='L') alone[p++]=6; break; case 2: if(s[l-1]=='S') now[j++]=3; if(s[l-1]=='L') now[j++]=7; break; case 3: if(s[l-1]=='S') now[j++]=2; if(s[l-1]=='L') now[j++]=8; break; case 4: if(s[l-1]=='S') now[j++]=1; if(s[l-1]=='L') now[j++]=9; break; } } for(i=0;i<j;i++){ if(last[now[i]]<=0){ // no exist last[10-now[i]]--; result++; }else{ last[now[i]]--; } } int t=p; for(i=0;i<p;i++){ if(last[alone[i]]>0){ last[alone[i]]--; alone[i]=-1; t--; } } printf("%d",result+t); }
codeforces
37
1,357
39728601
1000A
-1
c
Accepted
31
8,192
#include <stdio.h> #include <string.h> #include <stdlib.h> #define MAX 20 void heapSort(char strings[][MAX], int n); void heapify(char strings[][MAX], int esq, int dir); void buildHeap(char strings[][MAX], int n); int main(){ int n, i; scanf("%d", &n); char LY[n][MAX]; char CY[n][MAX]; for(i=0;i<n;i++){ scanf("\n%s", LY[i]); } for(i=0;i<n;i++){ scanf("\n%s", CY[i]); } //heapSort(LY, n); //heapSort(CY, n); int eq=0, j; for(i=0;i<n;i++){ for(j=0;j<n;j++){ if(strcmp(CY[i], LY[j]) == 0){ eq++; strcpy(LY[j], "aaaaa"); break; } } } printf("%d\n", n-eq); return 0; } void heapSort(char strings[][MAX], int n){ int esq = 0; int dir = n-1; buildHeap(strings, n); while(dir > 0){ char tmp[MAX]; strcpy(tmp, strings[dir]); strcpy(strings[dir], strings[0]); strcpy(strings[0], tmp); dir--; heapify(strings, esq, dir); } } void heapify(char strings[][MAX], int esq, int dir){ int i = esq; int j = (i*2)+1; char x[MAX]; strcpy(x, strings[i]); while(j<=dir){ if(j < dir){ if(strcmp(strings[j], strings[j+1]) < 0){ j++; } } if(strcmp(x, strings[j]) >= 0){ break; } strcpy(strings[i], strings[j]); i = j; j = (2*i)+1; } strcpy(strings[i], x); } void buildHeap(char strings[][MAX], int n){ int esq = n/2 + 1; while(esq>0){ esq--; heapify(strings, esq, n-1); } }
codeforces
37
1,370
39709582
1000A
-1
c
Accepted
30
4,096
#include<stdio.h> #include<string.h> #include<math.h> int main() { int n; int i[3][10]; int a,res = 0,mo = 0,le = 0; memset(i,0,sizeof(i)); scanf("%d",&n); for(a = 1;a <= n;a ++) { char st1[20]; scanf("%s",&st1); if(st1[0] == 'M') { i[1][1] ++; } else if(st1[0] == 'S') { i[1][2] ++; } else if(st1[0] == 'L') { i[1][3] ++; } else if(st1[1] == 'S') { i[1][4] ++; } else if(st1[1] == 'L') { i[1][5] ++; } else if(st1[2] == 'S') { i[1][6] ++; } else if(st1[2] == 'L') { i[1][7] ++; } else if(st1[3] == 'S') { i[1][8] ++; } else if(st1[3] == 'L') { i[1][9] ++; } } for(a = 1;a <= n;a ++) { char st2[20]; scanf("%s",&st2); if(st2[0] == 'M') { i[2][1] ++; } else if(st2[0] == 'S') { i[2][2] ++; } else if(st2[0] == 'L') { i[2][3] ++; } else if(st2[1] == 'S') { i[2][4] ++; } else if(st2[1] == 'L') { i[2][5] ++; } else if(st2[2] == 'S') { i[2][6] ++; } else if(st2[2] == 'L') { i[2][7] ++; } else if(st2[3] == 'S') { i[2][8] ++; } else if(st2[3] == 'L') { i[2][9] ++; } } for(a = 1;a <= 3;a ++) if(i[2][a] < i[1][a]) { res += (i[1][a] - i[2][a]); } for(a = 5;a <= 9;a += 2) { res += (abs(i[1][a] - i[2][a])); } printf("%d",res); return 0; }
codeforces
37
1,439
39712393
1000A
-1
c
Accepted
31
12,288
#include <stdio.h> #include <string.h> #define min(a, b) (a < b ? a : b) int last_year[9], cur_year[9]; int main() { int N, ans, i; char temp[10]; memset(last_year, 0, sizeof(last_year)); memset(cur_year, 0, sizeof(cur_year)); scanf("%d", &N); for (i = 0; i < N; i++) { scanf("%s", temp); if (!strcmp(temp, "XXXS")) last_year[0]++; else if (!strcmp(temp, "XXS")) last_year[1]++; else if (!strcmp(temp, "XS")) last_year[2]++; else if (!strcmp(temp, "S")) last_year[3]++; else if (!strcmp(temp, "M")) last_year[4]++; else if (!strcmp(temp, "L")) last_year[5]++; else if (!strcmp(temp, "XL")) last_year[6]++; else if (!strcmp(temp, "XXL")) last_year[7]++; else last_year[8]++; } for (i = 0; i < N; i++) { scanf("%s", temp); if (!strcmp(temp, "XXXS")) cur_year[0]++; else if (!strcmp(temp, "XXS")) cur_year[1]++; else if (!strcmp(temp, "XS")) cur_year[2]++; else if (!strcmp(temp, "S")) cur_year[3]++; else if (!strcmp(temp, "M")) cur_year[4]++; else if (!strcmp(temp, "L")) cur_year[5]++; else if (!strcmp(temp, "XL")) cur_year[6]++; else if (!strcmp(temp, "XXL")) cur_year[7]++; else cur_year[8]++; } ans = N; for (i = 0; i < 9; i++) { if (cur_year[i] > 0 && last_year[i] > 0) { ans -= min(cur_year[i], last_year[i]); } } printf("%d\n", ans); return 0; }
codeforces
37
1,441
39714637
1000A
-1
c
Accepted
31
147,456
#include <stdio.h> #include <string.h> #include <stdlib.h> int findin(char *s, char **a, int n) { int i; for (i = 0; i < n; i++) { if ((strcmp(s, a[i])) == 0) { char *tmp = a[i]; a[i] = a[n-1]; a[n-1] = a[i]; return 1; } } return 0; } int main(void) { int n; scanf("%d", &n); char **s1 = malloc(n*sizeof(char*)), **s2 = malloc(n*sizeof(char)), **s3 = malloc(n*sizeof(char*)), **s4 = malloc(n*sizeof(char*)); int i, s1n, s2n, s3n, s4n; s1n = s2n = s3n = s4n = 0; for (i = 0; i < n; i++) { char *str = malloc(5*sizeof(char)); scanf("%s", str); int k = strlen(str); if (k == 1) { s1[s1n] = str; s1n++; } if (k == 2) { s2[s2n] = str; s2n++; } if (k == 3) { s3[s3n] = str; s3n++; } if (k == 4) { s4[s4n] = str; s4n++; } } int ans = 0; char *str = malloc(5*sizeof(char)); for (i = 0; i < n; i++) { scanf("%s", str); int k = strlen(str); if (k == 1) { if ((findin(str, s1, s1n)) == 0) { ans++; } else { s1n--; } } if (k == 2) { if ((findin(str, s2, s2n)) == 0) { ans++; } else { s2n--; } } if (k == 3) { if ((findin(str, s3, s3n)) == 0) { ans++; } else { s3n--; } } if (k == 4) { if ((findin(str, s4, s4n)) == 0) { ans++; } else { s4n--; } } } printf("%d", ans); return 0; }
codeforces
37
1,470
47807720
1000A
-1
c
Accepted
30
4,096
#include<stdio.h> #include<stdlib.h> #include<string.h> int main() { int n, a[9] = {}, b[9] = {}, i, o; char in[5]; scanf("%d", &o); n = o; while (n--) { scanf("%s", in); if (strlen(in) == 4) if (in[3] == 'S') a[8]++; else a[0]++; else if (strlen(in) == 3) if (in[2] == 'S') a[7]++; else a[1]++; else if (strlen(in) == 2) if (in[1] == 'S') a[6]++; else a[2]++; else if (in[0] == 'S') a[5]++; else if (in[0] == 'M') a[4]++; else a[3]++; } n = o; while (n--) { scanf("%s", in); if (strlen(in) == 4) if (in[3] == 'S') b[8]++; else b[0]++; else if (strlen(in) == 3) if (in[2] == 'S') b[7]++; else b[1]++; else if (strlen(in) == 2) if (in[1] == 'S') b[6]++; else b[2]++; else if (in[0] == 'S') b[5]++; else if (in[0] == 'M') b[4]++; else b[3]++; } int sum = 0; for (i = 0; i < 9; i++) sum += abs(a[i] - b[i]); printf("%d\n", sum / 2); }
codeforces
37
1,483
39710675
1000A
-1
c
Accepted
30
12,288
#include <stdio.h> #include <string.h> int small_previous[4]; /* S occurences for 0 - 3 X (S, XS, XXS, XXXS) */ int large_previous[4]; /* L occurences for 0 - 3 X (L, XL, XXL, XXXL) */ int small_current[4]; /* S occurences for 0 - 3 X (S, XS, XXS, XXXS) */ int large_current[4]; /* L occurences for 0 - 3 X (L, XL, XXL, XXXL) */ int medium_previous; int medium_current; int n; int main() { int i, result; char aux[10]; scanf("%d\n", &n); /* -- PREVIOUS YEAR -- */ for (i = 0; i < n; i++) { scanf("%s\n", aux); if (aux[0] == 'M') medium_previous++; else if (aux[strlen(aux) - 1] == 'S') small_previous[strlen(aux) - 1]++; else large_previous[strlen(aux) - 1]++; } /* -- CURRENT YEAR -- */ for (i = 0; i < n; i++) { scanf("%s\n", aux); if (aux[0] == 'M') medium_current++; else if (aux[strlen(aux) - 1] == 'S') small_current[strlen(aux) - 1]++; else large_current[strlen(aux) - 1]++; } result = 0; for (i = 0; i < 4; i++) { if (small_previous[i] < small_current[i]) result += small_current[i] - small_previous[i]; if (large_previous[i] < large_current[i]) result += large_current[i] - large_previous[i]; } if (medium_previous < medium_current) result += medium_current - medium_previous; printf("%d\n", result); return 0; }
codeforces
37
1,538
39713965
1000A
-1
c
Accepted
31
12,288
#include <stdio.h> #include <string.h> #define min(a, b) (a < b ? a : b) int last[9], current[9]; int main() { int n, res, i; char temp[10]; memset(last, 0, sizeof(last)); memset(current, 0, sizeof(current)); scanf("%d", &n); int w = n; while(w--){ scanf("%s", temp); if (!strcmp(temp, "XXXS")) last[0]++; else if (!strcmp(temp, "XXS")) last[1]++; else if (!strcmp(temp, "XS")) last[2]++; else if (!strcmp(temp, "S")) last[3]++; else if (!strcmp(temp, "M")) last[4]++; else if (!strcmp(temp, "L")) last[5]++; else if (!strcmp(temp, "XL")) last[6]++; else if (!strcmp(temp, "XXL")) last[7]++; else last[8]++; } w = n; while(w--) { scanf("%s", temp); if (!strcmp(temp, "XXXS")) current[0]++; else if (!strcmp(temp, "XXS")) current[1]++; else if (!strcmp(temp, "XS")) current[2]++; else if (!strcmp(temp, "S")) current[3]++; else if (!strcmp(temp, "M")) current[4]++; else if (!strcmp(temp, "L")) current[5]++; else if (!strcmp(temp, "XL")) current[6]++; else if (!strcmp(temp, "XXL")) current[7]++; else current[8]++; } res = n; for (i = 0; i < 9; i++) { if (current[i] > 0 && last[i] > 0) { res = res - min(current[i], last[i]); } } printf("%d\n", res); return 0; }
codeforces
37
1,641
67414876
1000A
-1
c
Accepted
31
8,192
#include<stdio.h> #include<string.h> #include<stdlib.h> int strp[102],strn[102]; int main () { int i,n; char str[6],m[]="M",l[]="L",s[]="S",xs[]="XS",xl[]="XL",xxs[]="XXS",xxl[]="XXL",xxxs[]="XXXS",xxxl[]="XXXL"; scanf ("%d",&n); for (i = 0; i < n ; i++) { scanf(" %[^\n]",str); if (strcmp(str,l)== 0) strp[1]++; else if (strcmp(str,m)== 0) strp[2]++; else if (strcmp(str,s)== 0 ) strp[3]++; else if (strcmp (str,xs)==0) strp[4]++; else if (strcmp(str,xl)== 0) strp[5]++; else if (strcmp(str,xxs)==0) strp[6]++; else if (strcmp (str,xxl)== 0) strp[7]++; else if (strcmp (str,xxxs)==0) strp[8]++; else if (strcmp(str,xxxl)== 0) strp[9]++; } for (i = 0; i < n ; i++) { scanf(" %[^\n]",str); if (strcmp(str,l)== 0) strn[1]++; else if (strcmp(str,m)== 0) strn[2]++; else if (strcmp(str,s)== 0 ) strn[3]++; else if (strcmp (str,xs)==0) strn[4]++; else if (strcmp(str,xl)== 0) strn[5]++; else if (strcmp(str,xxs)==0) strn[6]++; else if (strcmp (str,xxl)== 0) strn[7]++; else if (strcmp (str,xxxs)==0) strn[8]++; else if (strcmp(str,xxxl)== 0) strn[9]++; } int sum = 0; for (i = 0 ; i <10 ; i++) { if (strn[i] > strp[i]) { sum = sum + strn[i]-strp[i]; } } printf ("%d\n",sum); return 0; }
codeforces
37
1,683
119964554
1000A
-1
c
Accepted
31
8,192
#include <stdio.h> #include <stdlib.h> int main() { int i=0,j=0,m,n,x=0,num_a_s=0,num_a_m=0,num_a_i=0,c[5][10],sum=0,count=0,s1,m1,l1; char a[500],b[500]; memset(c, 0, sizeof(c)); scanf("%d",&n); getchar(); for(i=0,m=0;m<n;i++){ scanf("%c",&a[i]); if(a[i]=='\n'){ m++; i--; } } for(i=0,m=0;m<n;i++){ scanf("%c",&b[i]); if(b[i]=='\n'){ m++; i--; } } for(j=0;j<i;j++){ if(a[j]=='S'){ c[x][1]++; x=0; } else if(a[j]=='M'){ c[x][2]++; x=0; } else if(a[j]=='L'){ c[x][3]++; x=0; } else x++; } for(j=0;j<i;j++){ if(b[j]=='S'){ c[x][4]++; x=0; } else if(b[j]=='M'){ c[x][5]++; x=0; } else if(b[j]=='L'){ c[x][6]++; x=0; } else x++; } for(i=0;i<=3;i++){ if(i==0){ s1=c[i][1]-c[i][4]; s1=abs(s1); m1=c[i][2]-c[i][5]; m1=abs(m1); l1=c[i][3]-c[i][6]; l1=abs(l1); if(s1>=m1){ if(l1>=s1) count=l1; else count=s1; } else if(m1>=s1){ if(l1>=m1) count=l1; else count=m1; } } else if(c[i][1]>c[i][4]) count=c[i][1]-c[i][4]; else count=c[i][4]-c[i][1]; sum+=count; } printf("%d", sum); return 0; }
codeforces
37
1,701
43779660
1000A
-1
c
Accepted
30
307,200
#include <stdio.h> int main(void) { int n , asizes[9] = {0,0,0,0,0,0,0,0,0} , bsizes[9] = {0,0,0,0,0,0,0,0,0} , answer, temp; scanf("%d",&n); char a[n][5], b[n][5]; for (int i =0; i < n ; i++ ) { scanf("%s",a[i]); if(a[i][3] == 'S') asizes[0]++ ; else if(a[i][2] == 'S') asizes[1]++ ; else if(a[i][1] == 'S') asizes[2]++ ; else if(a[i][0] == 'S') asizes[3]++ ; else if(a[i][0] == 'M') asizes[4]++ ; else if(a[i][0] == 'L') asizes[5]++ ; else if(a[i][1] == 'L') asizes[6]++ ; else if(a[i][2] == 'L') asizes[7]++ ; else if(a[i][3] == 'L') asizes[8]++ ; else return 0; } for (int i =0; i < n ; i++ ) { scanf("%s",b[i]); if(b[i][3] == 'S') bsizes[0]++ ; else if(b[i][2] == 'S') bsizes[1]++ ; else if(b[i][1] == 'S') bsizes[2]++ ; else if(b[i][0] == 'S') bsizes[3]++ ; else if(b[i][0] == 'M') bsizes[4]++ ; else if(b[i][0] == 'L') bsizes[5]++ ; else if(b[i][1] == 'L') bsizes[6]++ ; else if(b[i][2] == 'L') bsizes[7]++ ; else if(b[i][3] == 'L') bsizes[8]++ ; else return 0; } for(int i = 3 ; i < 6 ; i++ ){ temp = (temp = asizes[i] - bsizes[i]) > 0 ? temp : -temp; answer = answer + temp ; temp =0; } answer = answer / 2 ; for(int i = 0; i < 3 ; i++ ){ temp = ((temp = asizes[i]-bsizes[i]) > 0) ? temp: (-temp); answer = answer + temp ; temp =0; } printf(" %d",answer); return 0; }
codeforces
37
1,728
107107990
1000A
-1
c
Accepted
15
8,192
#include<stdio.h> #include<string.h> #include<math.h> int main() { int n,l,temp,step,c=0,c1=0,c2=0,c3=0,c4=0,c5=0,c6=0,c7=0,c8=0,c9=0,c10=0,c11=0,c12=0,c13=0,c14=0,c15=0,c16=0,c17=0,c18=0; scanf("%d",&n); int a[n],b[n],i,j,p=0,fre[100]; char t[100]; char s1[200][4],s2[200][4],s3[10][10]={"S","M","XL","XS","XXL","XXS","XXXL","XXXS","L"}; for(i=0;i<n;i++) { scanf("%s",s1[i]); a[i]=strlen(s1[i]); if(strcmp(s1[i],s3[0])==0) { c1++; } else if(strcmp(s1[i],s3[1])==0) { c2++; } else if(strcmp(s1[i],s3[2])==0) { c3++; } else if(strcmp(s1[i],s3[3])==0) { c4++; } else if(strcmp(s1[i],s3[4])==0) { c5++; } else if(strcmp(s1[i],s3[5])==0) { c6++; } else if(strcmp(s1[i],s3[6])==0) { c7++; } else if(strcmp(s1[i],s3[7])==0) { c8++; } else if(strcmp(s1[i],s3[8])==0) { c17++; } } for(i=0;i<n;i++) { scanf("%s",s2[i]); b[i]=strlen(s2[i]); if(strcmp(s2[i],s3[0])==0) { c9++; } else if(strcmp(s2[i],s3[1])==0) { c10++; } else if(strcmp(s2[i],s3[2])==0) { c11++; } else if(strcmp(s2[i],s3[3])==0) { c12++; } else if(strcmp(s2[i],s3[4])==0) { c13++; } else if(strcmp(s2[i],s3[5])==0) { c14++; } else if(strcmp(s2[i],s3[6])==0) { c15++; } else if(strcmp(s2[i],s3[7])==0) { c16++; } else if(strcmp(s2[i],s3[8])==0) { c18++; } } if(c9>c1) { c+=(c9-c1); } if(c10>c2) { c+=(c10-c2); } if(c11>c3) { c+=(c11-c3); } if(c12>c4) { c+=(c12-c4); } if(c13>c5) { c+=(c13-c5); } if(c14>c6) { c+=(c14-c6); } if(c15>c7) { c+=(c15-c7); } if(c16>c8) { c+=(c16-c8); } if(c18>c17) { c+=(c18-c17); } printf("%d\n",c); return 0; }
codeforces
37
1,789
123994921
1000A
-1
c
Accepted
30
3,698,688
#include <string.h> #include <stdlib.h> #include <stdio.h> #define SIZE_S 0 #define SIZE_XS 1 #define SIZE_XXS 2 #define SIZE_XXXS 3 #define SIZE_M 4 #define SIZE_L 5 #define SIZE_XL 6 #define SIZE_XXL 7 #define SIZE_XXXL 8 #define SIZE_MAX 9 #define GET_ARRAY(size) SIZE_##size static int previous[SIZE_MAX] = {0}; static int current[SIZE_MAX] = {0}; int main() { int total_num; scanf("%d", &total_num); int i; char prev[10] = {0}; char curr[10] = {0}; for (i = 0; i < total_num; i ++) { scanf("%s", prev); if (strcmp(prev, "S") == 0) previous[GET_ARRAY(S)] ++; if (strcmp(prev, "XS") == 0) previous[GET_ARRAY(XS)] ++; if (strcmp(prev, "XXS") == 0) previous[GET_ARRAY(XXS)] ++; if (strcmp(prev, "XXXS") == 0) previous[GET_ARRAY(XXXS)] ++; if (strcmp(prev, "M") == 0) previous[GET_ARRAY(M)] ++; if (strcmp(prev, "L") == 0) previous[GET_ARRAY(L)] ++; if (strcmp(prev, "XL") == 0) previous[GET_ARRAY(XL)] ++; if (strcmp(prev, "XXL") == 0) previous[GET_ARRAY(XXL)] ++; if (strcmp(prev, "XXXL") == 0) previous[GET_ARRAY(XXXL)] ++; } for (i = 0; i < total_num; i ++) { scanf("%s", curr); if (strcmp(curr, "S") == 0) current[GET_ARRAY(S)] ++; if (strcmp(curr, "XS") == 0) current[GET_ARRAY(XS)] ++; if (strcmp(curr, "XXS") == 0) current[GET_ARRAY(XXS)] ++; if (strcmp(curr, "XXXS") == 0) current[GET_ARRAY(XXXS)] ++; if (strcmp(curr, "M") == 0) current[GET_ARRAY(M)] ++; if (strcmp(curr, "L") == 0) current[GET_ARRAY(L)] ++; if (strcmp(curr, "XL") == 0) current[GET_ARRAY(XL)] ++; if (strcmp(curr, "XXL") == 0) current[GET_ARRAY(XXL)] ++; if (strcmp(curr, "XXXL") == 0) current[GET_ARRAY(XXXL)] ++; } int result = 0; for (i = 0; i < SIZE_MAX; i ++) { result += (current[i] - previous[i]) > 0 ? (current[i] - previous[i]) : 0; } printf("%d", result); }
codeforces
37
2,049
39733161
1000A
-1
c
Accepted
15
12,288
#include <stdio.h> #include <stdlib.h> #include <string.h> int main() { int n,i,ans,M = 0,S = 0,L = 0,XS = 0,XXS = 0,XXXS = 0,XL = 0,XXL = 0,XXXL = 0,M2 = 0,S2 = 0,L2 = 0,XS2 = 0,XXS2 = 0,XXXS2 = 0,XL2 = 0,XXL2 = 0,XXXL2 = 0; scanf("%d",&n); char Tshirts[n][100],Tshirts2[n][100]; for (i = 0; i < n; i++) { scanf("%s", Tshirts[i]); } for (i = 0; i < n; i++) { scanf("%s", Tshirts2[i]); } for (i = 0; i < n; i++) { if (strcmp(Tshirts[i],"M") == 0) M++; else if (strcmp(Tshirts[i],"S") == 0) S++; else if (strcmp(Tshirts[i],"L") == 0) L++; else if (strcmp(Tshirts[i],"XS") == 0) XS++; else if (strcmp(Tshirts[i],"XL") == 0) XL++; else if (strcmp(Tshirts[i],"XXS") == 0) XXS++; else if (strcmp(Tshirts[i],"XXL") == 0) XXL++; else if (strcmp(Tshirts[i],"XXXS") == 0) XXXS++; else if (strcmp(Tshirts[i],"XXXL") == 0) XXXL++; } for (i = 0; i < n; i++) { if (strcmp(Tshirts2[i],"M") == 0) M2++; else if (strcmp(Tshirts2[i],"S") == 0) S2++; else if (strcmp(Tshirts2[i],"L") == 0) L2++; else if (strcmp(Tshirts2[i],"XS") == 0) XS2++; else if (strcmp(Tshirts2[i],"XL") == 0) XL2++; else if (strcmp(Tshirts2[i],"XXS") == 0) XXS2++; else if (strcmp(Tshirts2[i],"XXL") == 0) XXL2++; else if (strcmp(Tshirts2[i],"XXXS") == 0) XXXS2++; else if (strcmp(Tshirts2[i],"XXXL") == 0) XXXL2++; } if ((M == M2) && (S == S2) && (L == L2) && (XS == XS2) && (XXS == XXS2) && (XXXS == XXXS2) && (XL == XL2) && (XXL == XXL2) && (XXXL == XXXL2) ) ans = 0; else ans = (abs(M2-M) + abs(S2-S) + abs(L2-L) + abs(XS2-XS) + abs(XXS2-XXS) + abs(XXXS2-XXXS) + abs(XL2-XL) + abs(XXL2-XXL) + abs(XXXL2-XXXL))/2; printf("%d",ans); return 0; }
codeforces
37
2,146
39845092
1000A
-1
c
Accepted
31
8,192
#include <stdio.h> #include <stdlib.h> #include <string.h> int main () { int n; scanf ("%d", &n); int ans = 0; int cnt[9] = {0}; for (int i = 0; i < n; i++) { char name[5]; scanf ("%s", name); if (!strcmp("XXXS", name)) cnt[0]++; else if (!strcmp("XXS", name)) cnt[1]++; else if (!strcmp("XS", name)) cnt[2]++; else if (!strcmp("S", name)) cnt[3]++; else if (!strcmp("M", name)) cnt[4]++; else if (!strcmp("L", name)) cnt[5]++; else if (!strcmp("XL", name)) cnt[6]++; else if (!strcmp("XXL", name)) cnt[7]++; else if (!strcmp("XXXL", name)) cnt[8]++; } for (int i = 0; i < n; i++) { char name[5]; scanf ("%s", name); if (!strcmp("XXXS", name)) { if (cnt[0]) cnt[0]--; else ans++; } else if (!strcmp("XXS", name)){ if (cnt[1]) cnt[1]--; else ans++; } else if (!strcmp("XS", name)){ if (cnt[2]) cnt[2]--; else ans++; } else if (!strcmp("S", name)){ if (cnt[3]) cnt[3]--; else ans++; } else if (!strcmp("M", name)){ if (cnt[4]) cnt[4]--; else ans++; } else if (!strcmp("L", name)){ if (cnt[5]) cnt[5]--; else ans++; } else if (!strcmp("XL", name)){ if (cnt[6]) cnt[6]--; else ans++; } else if (!strcmp("XXL", name)){ if (cnt[7]) cnt[7]--; else ans++; } else if (!strcmp("XXXL", name)){ if (cnt[8]) cnt[8]--; else ans++; } } printf ("%d", ans); return 0; }
codeforces
37
2,244
39711043
1000A
-1
c
Accepted
31
114,688
#include <stdio.h> #include <string.h> int main () { long long int a, b, c, d, i, j, k, l, ln, ln1, sum = 0, sum1, ck = 0, ck1, ct = 0, ct1, p, q, m, n, max, max1, min, min1, start, end, mid; long long int a1 = 0, a2 = 0, a3 = 0, a4 = 0; float x, y, z; char ch, ch1; char s[200][200], s1[200][200], s2[2000]; long long int arr[2000], arr1[2000], arr2[2000]; scanf("%lld", &n); for(i = 0; i < n; i++) { scanf("%s", s[i]); } for(i = 0; i < n; i++) { scanf("%s", s1[i]); } for(i = 0; i < n; i++) { for(j = 0; j < n; j++) { ck = 0; for(k = 0; k < a2; k++) { if(arr1[k] == j) { ck = 1; break; } } if(ck == 0) { if(strcmp(s[i], s1[j]) == 0) { arr[a1] = i; a1++; arr1[a2] = j; a2++; break; } } } } if(a1 == n) { printf("0\n"); return 0; } for(i = 0; i < n; i++) { if(a1 == n) { printf("%lld\n", ct); return 0; } ck = 0; for(j = 0; j < a1; j++) { if(arr[j] == i) { ck = 1; break; } } if(ck == 0) { ln = strlen(s[i]); for(k = 0; k < n; k++) { ck = 0; for(j = 0; j < a1; j++) { if(arr1[j] == k) { ck = 1; break; } } if(ck == 0) { ln1 = strlen(s1[k]); if(ln == ln1) { ct++; arr[a1] = i; a1++; arr1[a2] = k; a2++; } } } } } printf("%lld\n", ct); return 0; }
codeforces
37
2,364
107107879
1000A
-1
c
Accepted
15
4,096
#include<stdio.h> #include<string.h> #include<math.h> int main() { int n,l,temp,step,c=0,c1=0,c2=0,c3=0,c4=0,c5=0,c6=0,c7=0,c8=0,c9=0,c10=0,c11=0,c12=0,c13=0,c14=0,c15=0,c16=0,c17=0,c18=0; scanf("%d",&n); int a[n],b[n],i,j,p=0,fre[100]; char t[100]; char s1[200][4],s2[200][4],s3[10][10]={"S","M","XL","XS","XXL","XXS","XXXL","XXXS","L"}; /* for(i=0;i<=5000;i++) { fre[i]=0; }*/ for(i=0;i<n;i++) { scanf("%s",s1[i]); a[i]=strlen(s1[i]); if(strcmp(s1[i],s3[0])==0) { c1++; } else if(strcmp(s1[i],s3[1])==0) { c2++; } else if(strcmp(s1[i],s3[2])==0) { c3++; } else if(strcmp(s1[i],s3[3])==0) { c4++; } else if(strcmp(s1[i],s3[4])==0) { c5++; } else if(strcmp(s1[i],s3[5])==0) { c6++; } else if(strcmp(s1[i],s3[6])==0) { c7++; } else if(strcmp(s1[i],s3[7])==0) { c8++; } else if(strcmp(s1[i],s3[8])==0) { c17++; } } for(i=0;i<n;i++) { scanf("%s",s2[i]); b[i]=strlen(s2[i]); if(strcmp(s2[i],s3[0])==0) { c9++; } else if(strcmp(s2[i],s3[1])==0) { c10++; } else if(strcmp(s2[i],s3[2])==0) { c11++; } else if(strcmp(s2[i],s3[3])==0) { c12++; } else if(strcmp(s2[i],s3[4])==0) { c13++; } else if(strcmp(s2[i],s3[5])==0) { c14++; } else if(strcmp(s2[i],s3[6])==0) { c15++; } else if(strcmp(s2[i],s3[7])==0) { c16++; } else if(strcmp(s2[i],s3[8])==0) { c18++; } } if(c9>c1) { c+=(c9-c1); } if(c10>c2) { c+=(c10-c2); } if(c11>c3) { c+=(c11-c3); } if(c12>c4) { c+=(c12-c4); } if(c13>c5) { c+=(c13-c5); } if(c14>c6) { c+=(c14-c6); } if(c15>c7) { c+=(c15-c7); } if(c16>c8) { c+=(c16-c8); } if(c18>c17) { c+=(c18-c17); } /* for(i=0;i<n;i++) { int flag=0; for(j=0;j<n;j++) { if(strcmp(s2[i],s1[j])==0) { flag=1; fre[j]++; break; } } if(flag==1) { c++; } } for(i=0;i<=n;i++) { if(fre[i]>1) { c-=fre[i]-1; } } for(step=1;step<n;step++) { for(i=0;i<n-step;i++) { if(strcmp(s1[i],s1[i+1])>0) { strcpy(t,s1[i]); strcpy(s1[i],s1[i+1]); strcpy(s1[i+1],t); } } } for(step=1;step<n;step++) { for(i=0;i<n-step;i++) { if(strcmp(s2[i],s2[i+1])>0) { strcpy(t,s2[i]); strcpy(s2[i],s2[i+1]); strcpy(s2[i+1],t); } } }*/ /* for(i=0;i<n;i++) { int flag=0; for(j=p;j<n;j++) { if(strcmp(s2[i],s1[j])!=0 && b[i]==a[j]) { p=j+1; c++; break; } } }*/ /* for(i=0;i<n;i++) { printf("%s\n",s1[i]); } for(i=0;i<n;i++) { printf("%s\n",s2[i]); } for(i=0;i<n;i++) { if(strcmp(s1[i],s2[i])!=0) { c++; } }*/ /* printf("%d %d %d %d %d %d %d %d %d %d %d %d %d %d %d %d\n",c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16);*/ printf("%d\n",c); return 0; }
codeforces
37
3,050
101406925
1000A
-1
cpp
Accepted
31
12,288
#include<bits/stdc++.h> using namespace std; int main(){int n,ans=0;cin>>n;map<string,int>m;string s;for(int i=0;i<n&&cin>>s;i++) m[s]++;for(int i=0;i<n&&cin>>s;i++){if(m[s]>0)m[s]--;else ans++;}cout<<ans<<"\n";}
codeforces
37
216
39771033
1000A
-1
cpp
Accepted
31
151,552
#include <bits/stdc++.h> using namespace std; int n,i; string x; multiset<string> a; int main(){ cin>>n; for(;i<n;i++)cin>>x,a.insert(x); for(i=0;i<n;i++){ cin>>x; auto p=a.find(x); if(p!=a.end())a.erase(p); } cout<<a.size(); }
codeforces
37
256
39823077
1000A
-1
cpp
Accepted
31
4,096
#include <bits/stdc++.h> using namespace std; map<string , int>m; main(){ int n; cin>>n; string s; for(int i=0;i<n;i++){ cin>>s; m[s]++; } int c=0; for(int i=0;i<n;i++){ cin>>s; if(m[s]){ c++; m[s]--; } } cout<<n-c; }
codeforces
37
260
48533659
1000A
-1
cpp
Accepted
31
8,192
#include <bits/stdc++.h> using namespace std; int main() { map<string,int>m; int t,ans=0; cin>>t; string s; for(int i=0;i<t;i++){ cin>>s; m[s]++; } for(int i=0;i<t;i++){ cin>>s; m[s]--; } for(auto i:m) { if(i.second>0){ ans+=i.second; } } cout<<ans<<endl; }
codeforces
37
285
40503647
1000A
-1
cpp
Accepted
31
24,576
#include<iostream> using namespace std; int n,i,j,cnt=0; string a[102],b[102]; int main() { cin>>n; for(i=0;i<n;i++) cin>>a[i]; for(i=0;i<n;i++) { cin>>b[i]; for(j=0;j<n;j++) if(a[j]==b[i]) { a[j]="0"; break; } if(j==n) cnt++; } cout<<cnt; return 0; }
codeforces
37
288
56880605
1000A
-1
cpp
Accepted
31
12,288
#include <bits/stdc++.h> using namespace std; string s1,s2; map <string,int> s; int n; int main(){ cin >> n; int op=0; for(int i=0;i<n;i++) { cin >> s1; s[s1]++; } for(int i=0;i<n;i++) { cin >> s2; if(s[s2]) s[s2]--; else op++; } cout << op << endl; return 0; }
codeforces
37
288
41465398
1000A
-1
cpp
Accepted
31
8,192
#include<bits/stdc++.h> using namespace std; int main(){ int n,t=0; cin>>n; map<string,int> m; for(int i=0;i<n;i++){ string a; cin>>a; m[a]++; } for(int i=0;i<n;i++){ string a; cin>>a; if(m[a]) m[a]--; } for(auto u:m){ t+=u.second; } cout<<t; }
codeforces
37
289
39740280
1000A
-1
cpp
Accepted
31
4,096
#include <bits/stdc++.h> using namespace std; int n, i, cnt; string s; map<string, int> frq; int main() { cin >> n; for (i = 0; i < n; ++i) { cin >> s; frq[s]++; } for (i = 0; i < n; ++i) { cin >> s; cnt += (--frq[s] >= 0); } cout << n - cnt; return 0; }
codeforces
37
290
39868301
1000A
-1
cpp
Accepted
31
8,192
#include <bits/stdc++.h> using namespace std; int main(){ int c;cin>>c; map<string,int> d; string s; for(size_t i = 0;i<c;++i)cin>>s,++d[s]; int ans = c; for(size_t i = 0;i<c;++i){ cin>>s; if(d[s]>0){ --d[s]; --ans; } } cout<<ans; return 0; }
codeforces
37
291
51029132
1000A
-1
cpp
Accepted
31
8,192
#include <bits/stdc++.h> using namespace std; string str; map<string,int>mp; int main() { int n, res = 0; scanf("%d", &n); for(int i = 0; i < n; ++i) cin >> str, ++mp[str]; for(int i = 0; i < n; ++i) { cin >> str; if(mp[str]) --mp[str]; else ++res; } printf("%d\n", res); return 0; }
codeforces
37
297
97719436
1000A
-1
cpp
Accepted
31
8,192
#include<bits/stdc++.h> using namespace std; int n,cnt; string s; map<string,int> mp; int main() { cin>>n; for(int i=1;i<=n;i++) { cin>>s; mp[s]++; } for(int i=1;i<=n;i++) { cin>>s; mp[s]--; if(mp[s]>=0) cnt++; } cout<<n-cnt<<endl; return 0; }
codeforces
37
298
39987343
1000A
-1
cpp
Accepted
31
8,192
#include<iostream> using namespace std; int main(){ int x,i,j,s=0,p=0; string a[102],b[102]; cin>>x; for(i=0;i<x;i++){ cin>>a[i]; } for(j=0;j<x;j++){ cin>>b[j]; } for(i=0;i<x;i++){ for(j=0;j<x;j++){ if(a[i]==b[j]){s=1;b[j]='1';break;} } if(s==1){p=p+1;s=0;} } cout<<x-p<<endl; }
codeforces
37
303
42769073
1000A
-1
cpp
Accepted
30
8,192
#include<bits/stdc++.h> #define ll long long using namespace std; map<string,int> wosl; int n,m; int main(){ int ans=0; string a; cin>>n; //char a[201]; for(int i=1;i<=n;i++) cin>>a,wosl[a]++; for(int i=1;i<=n;i++){ cin>>a; if(wosl[a]!=0) wosl[a]-=1; else ans+=1; } printf("%d",ans); }
codeforces
37
303
39706092
1000A
-1
cpp
Accepted
31
20,480
#include<bits/stdc++.h> using namespace std; const int MAXN=110; int n,sol; string s; map<string,int>mp; int main(){ cin>>n;sol=n; for(int i=0;i<n;i++){ cin>>s; mp[s]++; } for(int i=0;i<n;i++){ cin>>s; if(mp[s]){ sol--; mp[s]--; } } cout<<sol<<"\n"; return 0; }
codeforces
37
307
51302107
1000A
-1
cpp
Accepted
30
24,576
#include<bits/stdc++.h> #define rep(i,a,b) for(int i=a;i<(b);++i) using namespace std; map<string,int> a; int main(){ int n,ans=0; string str; scanf("%d",&n); rep(i,0,n){ cin>>str; ++a[str]; } rep(i,0,n){ cin>>str; if(a[str]){ ++ans; --a[str]; } } printf("%d",n-ans); return 0; }
codeforces
37
307
41328403
1000A
-1
cpp
Accepted
31
294,912
#include <bits/stdc++.h> using namespace std; map<string, int> f; int main() { int t; ios::sync_with_stdio(false); string s; cin >> t; for(int i = 0; i < t; i++) { cin >> s; f[s]++; } int cnt=0; for(int i = 0; i < t; i++) { cin >> s; if(!f[s]) cnt++; else f[s]--; } cout << cnt << endl; }
codeforces
37
309
41118007
1000A
-1
cpp
Accepted
31
303,104
#include<bits/stdc++.h> using namespace std; main() { int n,i,j=0; string b; map<string,int> m; scanf("%d",&n); for(i=0;i<n;i++) { cin>>b; m[b]++; } for(i=0;i<n;i++) { cin>>b; if(m[b]==0) j++; else m[b]--; } cout<<j; }
codeforces
37
310
40012039
1000A
-1
cpp
Accepted
31
155,648
#include<bits/stdc++.h> using namespace std; int main() { int n; cin>>n;string str;multiset<string> s; int n1=n; while(n--) { cin>>str; s.insert(str); } while(n1--) { cin>>str; auto it=s.find(str); if(it!=s.end()) s.erase(it); } cout<<s.size(); return 0; }
codeforces
37
311
39735409
1000A
-1
cpp
Accepted
31
8,192
#include<bits/stdc++.h> using namespace std; int n , ans; map <string,int> m; int main() { cin >> n; for (int i=1; i<=n; i++) { string s; cin >> s; m[s]++; } for (int i=1; i<=n; i++) { string s; cin >> s; if (m[s]>0) m[s]--; else ans++; } cout << ans; }
codeforces
37
312
90399548
1000A
-1
cpp
Accepted
31
147,456
#include<bits/stdc++.h> using namespace std; int main(){ int n, i, c=0; cin>>n; string s; map<string, int> m1, m2; for(i=0; i<n; i++){cin>>s; m1[s]++;} for(i=0; i<n; i++){cin>>s; m2[s]++;} for(auto x: m1) c+=min(m2[x.first], x.second); cout<<n-c; return 0; }
codeforces
37
312
90399548
1000A
-1
cpp
Accepted
31
147,456
#include<bits/stdc++.h> using namespace std; int main(){ int n, i, c=0; cin>>n; string s; map<string, int> m1, m2; for(i=0; i<n; i++){cin>>s; m1[s]++;} for(i=0; i<n; i++){cin>>s; m2[s]++;} for(auto x: m1) c+=min(m2[x.first], x.second); cout<<n-c; return 0; }
codeforces
37
312
122120885
1000A
-1
cpp
Accepted
31
3,739,648
#include<bits/stdc++.h> using namespace std; map<string, int>mp; int main() { int n; cin>>n; int ans = n; string s; for(int i = 0; i < n; i++) { cin>>s; mp[s]++; } for(int i = 0; i < n; i++) { cin>>s; if(mp[s]-- > 0) ans--; } cout<<ans<<endl; return 0; }
codeforces
37
312
39748498
1000A
-1
cpp
Accepted
31
16,384
#include<bits/stdc++.h> using namespace std; int main(){ int i,j,k,l,m,n,o; scanf("%d",&j); string a[j+1],b; for(i=0;i<j;i++){ cin>>a[i]; } m=0; for(i=0;i<j;i++){ cin>>b; for(k=0;k<j;k++){ if(a[k]==b){ m++; a[k]="sex"; break; } } } printf("%d\n",j-m); return 0; }
codeforces
37
313
39735232
1000A
-1
cpp
Accepted
15
8,192
#include<iostream> #include<cstring> using namespace std; main() { int n; cin>>n; char a[100][5]; char str[5]; int i,j; int c=0; for(i=0;i<n;i++) cin>>a[i]; for(i=0;i<n;i++) {cin>>str; for(j=0;j<n;j++) if(strcmp(str,a[j])==0) { strcpy(a[j],"a"); break; } if(j==n) c++; } cout<<c; return 0; }
codeforces
37
314
39795483
1000A
-1
cpp
Accepted
31
147,456
#include <iostream> #include <set> using namespace std; int main(){ int n = 0; cin>>n; multiset<string> pr; int nn = n; while(nn--){ string s; cin>>s; pr.insert(s); } nn=n; while(nn--){ string s; cin>>s; auto it = pr.find(s); if(it != end(pr)) pr.erase(it); } cout<<pr.size()<<endl; }
codeforces
37
314
42463408
1000A
-1
cpp
Accepted
30
151,552
#include<bits/stdc++.h> using namespace std; int main(){ int n;cin>>n; string a[111],b[111]; for (int i=0;i<n;i++)cin>>a[i]; for (int i=0;i<n;i++)cin>>b[i]; multiset<string>s; for (int i=0;i<n;i++)s.insert(b[i]); for (int i=0;i<n;i++) if (s.count(a[i]))s.erase(s.find(a[i])); cout<<s.size(); }
codeforces
37
317
47300993
1000A
-1
cpp
Accepted
31
20,480
#include<bits/stdc++.h> using namespace std; int main() {int n; cin>>n; map<string,int> a; for(int i=0;i<n;i++) {string x; cin>>x; a[x]++; } int count=0; for(int i=0;i<n;i++) {string x; cin>>x; if(a.find(x)!=a.end() && a[x]!=0) a[x]--; else count++; } cout<<count<<endl; return 0; }
codeforces
37
318
39744419
1000A
-1
cpp
Accepted
31
16,384
#include<bits/stdc++.h> using namespace std; int main() { map<string,int >m; int n; string ss; cin>>n; for(int i=0;i<n;i++) { cin>>ss; m[ss]++; } int sum=0; for(int i=0;i<n;i++) { cin>>ss; if(m[ss])m[ss]--; else sum++; } cout<<sum; }
codeforces
37
319
39745583
1000A
-1
cpp
Accepted
31
147,456
#include<iostream> #include<set> using namespace std; int main(){ int n; string s; multiset<string> a; while(cin>>n){ for (int i = 0; i < n; ++i){ cin>>s; a.insert(s); } for (int i = 0; i < n; ++i){ cin>>s; auto p = a.find(s); if(p != a.end()) a.erase(p); } cout<<a.size()<<endl; } }
codeforces
37
319
72069864
1000A
-1
cpp
Accepted
31
8,192
#include<iostream> #include<map> using namespace std; int n; string ch; map<string,int>mp; int main() { cin>>n; for(int i=1;i<=n;i++) { cin>>ch; ++mp[ch]; } int ans=0; for(int i=1;i<=n;i++) { cin>>ch; if(!mp[ch]) ++ans; else --mp[ch]; } printf("%d\n",ans); return 0; }
codeforces
37
319
56057533
1000A
-1
cpp
Accepted
31
8,192
#include <bits/stdc++.h> using namespace std; int main() { int n,i,ans=0; string s; map <string, int> m; cin>>n; for(i=0; i<n; i++){ cin>>s; m[s]++; } for(i=0; i<n; i++){ cin>>s; if(m[s]>0) m[s]--; else ans++; } cout<<ans; return 0; }
codeforces
37
324
39730839
1000A
-1
cpp
Accepted
30
12,288
#include <bits/stdc++.h> #include <string.h> using namespace std; int main() { int n; cin >> n; int c = 0; unordered_map <string, int> imap; string s; for(int i = 0; i < n; i++) { cin >> s; imap[s]++; } for(int i = 0; i < n; i++) { cin >> s; if(imap[s]) imap[s]--; else c++; } cout << c; return 0; }
codeforces
37
325
39766191
1000A
-1
cpp
Accepted
31
4,096
#include <bits/stdc++.h> using namespace std; int n,ans; map<string ,int> mp; string s; int main () { cin >>n; for (int i=0;i<n;++i) { cin >>s; mp[s]++; } for (int i=0;i<n;++i) { cin>>s; if (!mp[s]) { ans++; //mp[s]--; } else { mp[s]--; } } cout<<ans; return 0; }
codeforces
37
326
100617128
1000A
-1
cpp
Accepted
30
57,344
#include<bits/stdc++.h> using namespace std; const int maxn=1010; char a[maxn][20],b[maxn][20]; int main(){ map<string,int>mm; int n; long long ans=0; cin>>n; for(int i=0;i<n;i++){ cin>>a[i]; mm[a[i]]++; } for(int i=0;i<n;i++){ cin>>b[i]; if(mm[b[i]])mm[b[i]]--; else ans++; } cout<<ans; }
codeforces
37
327
39706883
1000A
-1
cpp
Accepted
31
20,480
#include <bits/stdc++.h> using namespace std; map <string,int> mem; int main() { int n; cin >> n; for (int i=0;i<n;i++) { string t; cin >> t; mem[t] ++; } int ans = 0; for (int i=0;i<n;i++) { string t; cin >> t; if (mem[t] > 0) mem[t] --; else ans ++; } printf("%d\n",ans); return 0; }
codeforces
37
328
39961117
1000A
-1
cpp
Accepted
31
20,480
#include<iostream> #include<map> #include<string> using namespace std; int main(){ int n,res=0; string s; map<string,int> m; cin >> n; for (int i = 0; i < n;i++){ cin >> s; m[s]++; } for (int i = 0; i < n; i++){ cin >> s; if (m[s]>0) m[s]--; else res++; } cout << res; return 0; }
codeforces
37
328
47693920
1000A
-1
cpp
Accepted
31
16,384
#include <bits/stdc++.h> using namespace std; int main(){ int n; string s; map<string,int> a,b; cin>>n; for(int i = 0;i < n;i++){ cin>>s; if(!a.count(s))a[s]=1; else a[s]++; } for(int i = 0;i < n;i++){ cin>>s; if(!b.count(s))b[s]=1; else b[s]++; } for(auto p:a)if(b.count(p.first))n-=min(p.second,b[p.first]); cout<<n<<'\n'; }
codeforces
37
328
111979726
1000A
-1
cpp
Accepted
30
45,056
#include<bits/stdc++.h> using namespace std; int main(){ int n; cin>>n; int count=0; string s[1000]; for(int i=0;i<2*n;i++){ cin>>s[i]; } for(int i=0;i<n;i++){ for(int k=n;k<2*n;k++){ if(s[i]==s[k]){ s[k]='0'; count++; break; } } } cout<<n-count<<"\n"; return 0; }
codeforces
37
330
40529260
1000A
-1
cpp
Accepted
31
12,288
#include<iostream> using namespace std; int main() { int i=0,j=0,k=0,n=0,t=0; string a[100],b[100]; cin>>n; for(i=0;i<n;i++) cin>>a[i]; for(i=0;i<n;i++) cin>>b[i]; for(i=0;i<n;i++) for(j=0;j<n;j++) { if(a[i]==b[j]) { a[i]="0";b[j]="0"; break; } } for(i=0;i<n;i++) if(a[i]!="0") t++; cout<<t; return 0; }
codeforces
37
331
59423639
1000A
-1
cpp
Accepted
30
4,096
#include <bits/stdc++.h> using namespace std; int n, ans; map <string, int> s; int main() { cin >> n; for (int i = 0; i < n; i++){ string a; cin >> a; s[a]++; } for (int i = 0; i < n; i++) { string a; cin >> a; s[a]--; } for (auto i : s) ans += abs(i.second); cout << ans/2 << endl; }
codeforces
37
331
61322420
1000A
-1
cpp
Accepted
30
8,192
#include <iostream> #include <map> using namespace std; int ans,n,i; string s; int main() { map<string, int> A; cin >> n; for(i = 1; i <= n; i ++ ) { cin >> s; A[s] ++; } for(i = 1; i <= n; i++ ) { cin >> s; if(A[s] == 0) ans++; else if(A[s] > 0) A[s]--; } cout << ans << endl; }
codeforces
37
331
39714852
1000A
-1
cpp
Accepted
31
49,152
#include <bits/stdc++.h> using namespace std; string b[1000]; int cnt; map <string,int> used; int main () { int n; cin>>n; for (int k=1;k<=2*n;k++){ string x; cin>>x; if (k>n){ b[k]=x; if (used[b[k]]!=0){ cnt++; used[b[k]]--; }} else used[x]++; } cout<<n-cnt; return 0; }
codeforces
37
332
40095829
1000A
-1
cpp
Accepted
31
8,192
#include <iostream> #include<bits/stdc++.h> using namespace std; int n; map<string,int>t; int main() { int i,s=0; string a,b; cin>>n; for(i=0;i<n;i++){ cin>>a; t[a]++; } for(i=0;i<n;i++){ cin>>b; if(t[b]>0)t[b]--; else s++; } cout<<s; return 0; }
codeforces
37
332
39708693
1000A
-1
cpp
Accepted
30
12,288
#include<bits/stdc++.h> using namespace std; map <string,int>c; int main(){ int n;cin>>n;string a[n+1],b[n+1]; for(int i=1;i<=n;i++){ cin>>b[i]; c[b[i]]++; } for(int i=1;i<=n;i++) cin>>a[i]; int cnt=n; for(int i=1;i<=n;i++) if(c[a[i]]>=1){ cnt--; c[a[i]]--; } cout<<cnt; return 0; }
codeforces
37
333
39710086
1000A
-1
cpp
Accepted
30
20,480
#include <bits/stdc++.h> using namespace std; char s[1000]; int main(){ int n; scanf("%d", &n); multiset<string> m; for(int i = 0; i < n; i++){ scanf(" %s", s); m.insert(s); } for(int i = 0; i < n; i++){ scanf(" %s", s); auto it = m.find(s); if(it != m.end()) m.erase(it); } printf("%d\n", (int)m.size()); }
codeforces
37
333

Dataset Card for "code_champs_solutions"

More Information needed

Downloads last month
794
Edit dataset card