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
|
---|---|---|---|---|---|---|---|---|---|---|
40569949 | 1000A | -1 | cpp | Accepted | 30 | 155,648 | #include <bits/stdc++.h>
using namespace std;
int n, result;
string s,xp,lp,sp;
map<string,int> a,b;
int main() {
ios::sync_with_stdio(false);
result = 0;
xp = "";
cin >> n;
for (int i=0; i<n; i++) {
cin >> s;
a[s]++;
}
for (int i=0; i<n; i++) {
cin >> s;
b[s]++;
}
result += max(b["M"]-a["M"],0);
for (int i=0; i<=3; i++) {
lp = xp + "L";
sp = xp + "S";
result += max(b[lp]-a[lp], 0);
result += max(b[sp]-a[sp], 0);
xp += "X";
}
cout << result << endl;
return 0;
} | codeforces | 37 | 496 |
52789817 | 1000A | -1 | cpp | Accepted | 31 | 12,288 | #include<bits/stdc++.h>
using namespace std;
int main()
{
long long n,i,j,ans=0;
string s,t;
cin>>n;
vector <string> ini;
vector <string> fin;
for(i=0;i<2*n;i++)
{
cin>>s;
if(i>=n)
fin.push_back(s);
else
ini.push_back(s);
}
for(i=0;i<n;i++)
{
for(j=0;j<n;j++)
{
if(fin[j]==ini[i])
{
ans++;
fin[j]+='9';
ini[i]+='0';
break;
}
}
}
cout<<n-ans;
} | codeforces | 37 | 496 |
56880748 | 1000A | -1 | cpp | Accepted | 31 | 8,192 | #include<bits/stdc++.h>
using namespace std;
map<string, int> q;
string a;
int main()
{
int n;
cin >> n;
int tot = 0;
for (int i = 1; i <= n; i++)
{
cin >> a;
q[a]++;
}
for (int i = 1; i <= n; i++)
{
cin >> a;
q[a]--;
}
map<string, int>::iterator iter;
iter = q.begin();
while(iter != q.end()) {
if (iter->second > 0)
tot += iter->second;
iter++;
}
cout << tot;
return 0;
} | codeforces | 37 | 496 |
74615250 | 1000A | -1 | cpp | Accepted | 46 | 12,288 | #include <iostream>
#include <bits/stdc++.h>
using namespace std;
#define ll long long int
#define pb push_back
int main() {
int n;
cin>>n;
int t=n;
unordered_map<string,int> a;
for(int i=0;i<n;i++){
string s;
cin>>s;
++a[s];
}
int ans=0;
for(int i=0;i<n;i++){
string s;
cin>>s;
if(a[s]>0){
--a[s];
}
else ans++;
}
cout<<ans<<endl;
return 0;
} | codeforces | 37 | 496 |
39713087 | 1000A | -1 | cpp | Accepted | 31 | 8,192 | #include<iostream>
#include<string>
using namespace std;
int main()
{
int end = 0;
int n;
cin >> n;
string s[100];
string h[100];
for (int k = 0; k < n; ++k) {
cin>>s[k];
}
for (int k = 0; k < n; ++k) {
cin >> h[k];
}
for (int k = 0; k < n; ++k) {
for (int j = 0; j < n; ++j) {
if (s[k] == h[j]) {
s[k] = "";
h[j] = "";
break;
}
}
}
for (int k = 0; k < n; ++k) {
if (s[k] != "") end += 1;
}
cout << end;
return 0;
} | codeforces | 37 | 497 |
39715137 | 1000A | -1 | cpp | Accepted | 30 | 147,456 | #include<bits/stdc++.h>
using namespace std;
main()
{
int n;
cin>>n;
string s;
map<string, int>m1,m2;
map<string, int> :: iterator it;
for(int i=0;i<n;i++)
{
cin>>s;
m1[s]++;
}
for(int i=0;i<n;i++)
{
cin>>s;
m2[s]++;
}
int ans = 0;
for(it = m2.begin(); it!=m2.end(); it++)
{
if(m1[it->first] < it->second) ans = ans + it->second - m1[it->first];
}
cout<<ans;
} | codeforces | 37 | 497 |
39733266 | 1000A | -1 | cpp | Accepted | 31 | 20,480 | #include<bits/stdc++.h>
using namespace std;
int qu[5][100], jin[5][100];
int main()
{
int num, res=0;
string s;
cin>>num;
for(int i=0; i<num; i++)
{
cin>>s;
for(int j=0; j<s.size(); j++)
qu[s.size()][s[j]-'A']++;
}
for(int i=0; i<num; i++)
{
cin>>s;
for(int j=0; j<s.size(); j++)
jin[s.size()][s[j]-'A']++;
}
for(int i=1; i<5; i++)
{
for(int j=0; j<=26; j++)
if(qu[i][j]>jin[i][j])
res+=qu[i][j]-jin[i][j];
}
cout<<res;
return 0;
} | codeforces | 37 | 497 |
40031187 | 1000A | -1 | cpp | Accepted | 31 | 8,192 | #include <bits/stdc++.h>
using namespace std;
vector<string> d;
map<string, int> cnt;
int main()
{
int n;
while(scanf("%d", &n)==1) {
string s;
for(int i(0); i<n; i++) {
cin >> s;
d.push_back(s);
}
for(int i(0); i<n; i++) {
cin >> s;
cnt[s]++;
}
int ok = 0;
for(auto s:d) {
if(cnt[s] > 0) cnt[s]--, ok ++;
}
printf("%d\n", n - ok);
}
return 0;
}
| codeforces | 37 | 497 |
40509241 | 1000A | -1 | cpp | Accepted | 31 | 16,384 | #include<iostream>
#include<cstring>
using namespace std;
int main(){
int n;
cin>>n;
string a[n];
int a1[101]={};
int c=0;
string b;
for(int i=0;i<n;i++){
cin>>b;
bool m=0;
for(int j=0;j<c;j++){
if(b==a[j]){
a1[j]++;
m=1;break;
}
}
if(!m){
a[c]=b;
a1[c]++;
c++;
}
}
int ans=0;
for(int i=0;i<n;i++){
cin>>b;
bool m=0;
for(int j=0;j<c;j++){
if(b==a[j]&&a1[j]>0){
a1[j]--;
m=1;break;
}
}
if(!m)
ans++;
}
cout<<ans;
return 0;
} | codeforces | 37 | 497 |
57125440 | 1000A | -1 | cpp | Accepted | 31 | 143,360 | #include<cstdio>
#include<string>
#include<iostream>
#include<map>
using namespace std;
map<string,int> q,p;
int main(){
int n;
scanf("%d",&n);
for(int i = 1; i <= n; i++){
string x;
cin>>x;
q[x]++;
}
for(int i = 1; i <= n; i++){
string x;
cin>>x;
p[x]++;
}
map<string,int>::iterator it;
int ans = 0;
for(it = q.begin(); it != q.end(); it++){
string s = it -> first;
if(q[s] > p[s]) ans += q[s] - p[s];
}
printf("%d\n",ans);
return 0;
}
| codeforces | 37 | 497 |
61087566 | 1000A | -1 | cpp | Accepted | 31 | 12,288 | #include<map>
#include<cstring>
#include<cstdio>
#include<algorithm>
#include<cmath>
#include<iostream>
using namespace std;
int n;
string s[110],s1[110];
map<string,int> a,b;
map<string,bool> flag;
int cnt;
int main()
{
scanf("%d",&n);
for(int i=1;i<=n;i++)
cin>>s[i],b[s[i]]++;
for(int i=1;i<=n;i++)
cin>>s1[i],a[s1[i]]++;
for(int i=1;i<=n;i++)
{
if(flag[s[i]]) continue;
flag[s[i]]=1;
cnt+=min(a[s[i]],b[s[i]]);
}
printf("%d\n",n-cnt);
return 0;
} | codeforces | 37 | 497 |
77720150 | 1000A | -1 | cpp | Accepted | 31 | 8,192 | #include <bits/stdc++.h>
using namespace std;
int main()
{
int n,ans=0;
string s[110],res;
cin>>n;
for(int i=0;i<n;i++)
cin>>s[i];
for(int i=0;i<n;i++)
{
cin>>res;
bool flag=true;
for(int j=0;j<n;j++)
if(res==s[j])
{
s[j]="res";
flag=false;
break;
}
if(flag)
ans++;
}
cout<<ans;
return 0;
}
| codeforces | 37 | 497 |
39707110 | 1000A | -1 | cpp | Accepted | 31 | 16,384 | #include<bits/stdc++.h>
using namespace std;
map <string,int> m1,m2;
string v[9] = {"M","S","XS","XXS","XXXS","L","XL","XXL","XXXL"};
int a[9];
int main()
{
int n,sum=0;
cin >> n;
string s;
for(int i=0;i<n;i++)
{
cin >> s;
m1[s] += 1;
}
for(int i=0;i<n;i++)
{
cin >> s;
m2[s] += 1;
}
for(int i=0;i<9;i++)
{
a[i] = abs(m1[v[i]]-m2[v[i]]);
sum += a[i];
}
if(sum %2==0)
cout << sum /2 << endl;
else
cout << sum/2+1 << endl;
return 0;
} | codeforces | 37 | 498 |
39713344 | 1000A | -1 | cpp | Accepted | 30 | 16,384 | #include <iostream>
#include <cstdio>
#include <string>
#include <map>
std::map<std::string, int>k;
std::string p[9] = {"S", "M", "L", "XL", "XXL", "XXXL", "XS", "XXS", "XXXS"};
int main() {
int n, ans = 0;
std::string s;
scanf("%d", &n);
for (int i = 1; i <= n; ++i) {
std::cin >> s;
++k[s];
}
for (int i = 1; i <= n; ++i) {
std::cin >> s;
--k[s];
}
for (int i = 0; i < 9; ++i) {
if (k[p[i]] < 0) ans -= k[p[i]];
}
std::cout << ans;
return 0;
} | codeforces | 37 | 498 |
39715170 | 1000A | -1 | cpp | Accepted | 31 | 20,480 | #include <stdio.h>
#include <string.h>
#include<iostream>
#include<string>
#include <stdio.h>
using namespace std;
int main(){
int n,ans;
scanf("%d",&n);
string last[n+1];
string cur[n+1];
for(int i=1;i<=n;i++){
cin>>last[i];
}
for(int i=1;i<=n;i++){
cin>>cur[i];
}
int cnt=0;
for(int i=1;i<=n;i++){
for(int j=1;j<=n;j++){
if(last[i].compare(cur[j])==0){
cur[j]=" ";
cnt+=1;
break;
}
}
}
ans=n;
ans-=cnt;
printf("%d\n",ans);
} | codeforces | 37 | 498 |
39725192 | 1000A | -1 | cpp | Accepted | 31 | 8,192 | #include<bits/stdc++.h>
using namespace std;
int main(){
// string chk ={"M","S","L","XS","XL","XXS","XXL","XXXS","XXXL"};
int n;
int cnt=0;
cin>>n;
string arr[105];
string brr[105];
for(int i=0;i<n;i++){
cin>>arr[i];
}
for(int i=0;i<n;i++){
cin>> brr[i];
}
for(int i=0;i<n;i++){
for(int j=0;j<n;j++){
if(arr[i] == brr[j]){
arr[i] = brr[j] = "";
cnt++;
break;
}
}
}
cout<<n-cnt<<endl;
return 0;}
| codeforces | 37 | 498 |
39814427 | 1000A | -1 | cpp | Accepted | 31 | 28,672 | #include<bits/stdc++.h>
using namespace std;
int main()
{
int n;
cin>>n;
string str1[500],str2[500];
for(int i=0;i<n;i++) cin>>str1[i];
for(int i=0;i<n;i++) cin>>str2[i];
sort(str1,str1+n);
sort(str2,str2+n);
map<string,int> mp;
for(int i=0;i<n;i++) mp[str1[i]]++,mp[str2[i]]--;
int ans=0;
map<string, int> ::iterator it=mp.begin();
for(;it!=mp.end();it++) if(it->second>0) ans+=it->second;
printf("%d\n",ans);
return 0;
}
| codeforces | 37 | 498 |
72021644 | 1000A | -1 | cpp | Accepted | 30 | 151,552 | #include<bits/stdc++.h>
using namespace std;
int main()
{
int n;
cin>>n;
vector<string> v1;
vector<string> v2;
unordered_map<string,int> m1;
unordered_map<string,int> m2;
for(int i=0;i<n;i++)
{
string s;
cin>>s;
v1.push_back(s);
m1[s]++;
}
for(int i=0;i<n;i++)
{
string s;
cin>>s;
if(m2[s]==0)
v2.push_back(s);
m2[s]++;
}
int ctr=0;
for(int i=0;i<v2.size();i++)
{
string s;
s=v2[i];
ctr+=min(m1[s],m2[s]);
}
cout<<n-ctr;
} | codeforces | 37 | 498 |
72021644 | 1000A | -1 | cpp | Accepted | 30 | 151,552 | #include<bits/stdc++.h>
using namespace std;
int main()
{
int n;
cin>>n;
vector<string> v1;
vector<string> v2;
unordered_map<string,int> m1;
unordered_map<string,int> m2;
for(int i=0;i<n;i++)
{
string s;
cin>>s;
v1.push_back(s);
m1[s]++;
}
for(int i=0;i<n;i++)
{
string s;
cin>>s;
if(m2[s]==0)
v2.push_back(s);
m2[s]++;
}
int ctr=0;
for(int i=0;i<v2.size();i++)
{
string s;
s=v2[i];
ctr+=min(m1[s],m2[s]);
}
cout<<n-ctr;
} | codeforces | 37 | 498 |
114282328 | 1000A | -1 | cpp | Accepted | 31 | 20,480 | #include <iostream>
using namespace std;
const int t = 101;
int n, i, j, cnt = 0;
string a[t], b[t];
int main()
{
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])
{
b[j] = '0';
break;
};
if (j == n)
++cnt;
};
cout << cnt;
}
| codeforces | 37 | 498 |
119455775 | 1000A | -1 | cpp | Accepted | 31 | 8,192 | #include<bits/stdc++.h>
using namespace std;
#define int long long
const int N = 2e3 + 5;
const int mod = 1e9 + 7;
signed main () {
ios_base::sync_with_stdio(0);
cin.tie(0);
cout.tie(0);
int n;
cin >> n;
map<string, int> mp;
for (int i = 1; i <= n; i++) {
string s;
cin >> s;
mp[s] += 1;
}
for (int i = 1; i <= n; i++) {
string s;
cin >> s;
mp[s] -= 1;
}
int ans = 0;
for (auto it: mp) {
ans += abs(it.second);
}
cout << ans / 2;
}
| codeforces | 37 | 498 |
122368437 | 1000A | -1 | cpp | Accepted | 31 | 3,747,840 | #include <iostream>
#include <map>
using namespace std;
int main() {
int n;
scanf("%d", &n);
map<string, int> x;
string size_name;
for (int i = 0; i < n; i++) {
cin >> size_name;
x[size_name]++;
}
for (int i = 0; i < n; i++) {
cin >> size_name;
x[size_name]--;
}
int res = 0;
for (auto &[key, value] : x)
if (value > 0)
res += value;
printf("%d", res);
return 0;
} | codeforces | 37 | 498 |
39704428 | 1000A | -1 | cpp | Accepted | 31 | 155,648 | #include <bits/stdc++.h>
using namespace std;
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define endl "\n"
#define int long long
const int N=105;
int n;
string a[N], b[N];
map<string, int> m1, m2;
int32_t main()
{
IOS;
cin>>n;
for(int i=1;i<=n;i++)
{
cin>>a[i];
m1[a[i]]++;
}
for(int i=1;i<=n;i++)
{
cin>>b[i];
m2[b[i]]++;
}
int ans=n;
for(auto it:m1)
{
ans-=min(it.second, m2[it.first]);
}
cout<<ans;
return 0;
} | codeforces | 37 | 499 |
39749724 | 1000A | -1 | cpp | Accepted | 31 | 8,192 | #include <iostream>
#include <string>
#include <algorithm>
#include <map>
#include <set>
int main()
{
int n;
std::cin >> n;
std::multiset<std::string> set;
std::string str;
for (int i = 0; i < n; ++i)
{
std::cin >> str;
set.insert(str);
}
int ans = 0;
for (int i = 0; i < n; ++i)
{
std::cin >> str;
if (set.count(str))
set.erase(set.find(str));
}
std::cout << set.size();
}
| codeforces | 37 | 499 |
51086255 | 1000A | -1 | cpp | Accepted | 15 | 147,456 | #include<iostream>
#include<cstdio>
#include<cstring>
#include<cmath>
#include<algorithm>
#include<map>
using namespace std;
string str1,str2;
int main()
{
map<string,int>a,b;
int n;
while(scanf("%d",&n)!=EOF)
{
for(int i=0;i<n;i++)
{
cin>>str1;
a[str1]++;
}
for(int i=0;i<n;i++)
{
cin>>str2;
b[str2]++;
}
map<string,int>::iterator it;
int ans=n;
for(it=a.begin();it!=a.end();it++)
{
ans-=min(it->second,b[it->first]);
}
printf("%d\n",ans);
}
return 0;
} | codeforces | 37 | 499 |
51826594 | 1000A | -1 | cpp | Accepted | 31 | 8,192 | #include <bits/stdc++.h>
using namespace std;
#define F first
#define S second
typedef long long lli;
const lli N = 100005 , OO =1110111110111 , mod = 1000000007 , mod2=998244353;
int n , sol;
map<string , int> all;
string s;
int main(){
ios_base::sync_with_stdio(0);
cin.tie(0);cout.tie(0);
cin>>n;
for(int i=0;i<2*n;i++)
{
cin>>s;
all[s]+=i<n ?1:-1;
}
for(auto u : all)
sol+=abs(u.S);
cout<<sol/2;
return 0;
}
| codeforces | 37 | 499 |
112039578 | 1000A | -1 | cpp | Accepted | 31 | 8,192 | #include<bits/stdc++.h>
#define io ios::sync_with_stdio(false);
#define int long long
#define rep(i, a, n) for(int i=a; i<=n; i++)
#define per(i, n, a) for(int i=n; i>=a; i--)
using namespace std;
const int maxn = 1e3 + 5;
const int INF = 0x7fffffff;
map<string, int> mp;
signed main() {
io;
int n, m;
string s;
cin >> n;
int ans = 0;
rep(i, 1, n) cin >> s, mp[s] ++;
rep(i, 1, n) {
cin >> s;
if(!mp[s]) ans ++;
else mp[s] --;
}
cout << ans << endl;
}
| codeforces | 37 | 499 |
39704404 | 1000A | -1 | cpp | Accepted | 30 | 20,480 | #include <iostream>
#include <algorithm>
#include <set>
#include <vector>
#include <string>
#include <cstring>
#include <map>
// DON'T DIVIDE
// Try different approaches
using namespace std;
int n;
map<string, int> m;
int main()
{
ios::sync_with_stdio(0);
cin >> n;
for(int i = 0; i < n; i++)
{
string s;
cin >> s;
m[s]++;
}
int ans = 0;
for(int i = 0; i < n; i++)
{
string s;
cin >> s;
if(m[s] > 0)
m[s]--;
else
{
ans++;
}
}
cout << ans << "\n";
return 0;
} | codeforces | 37 | 500 |
39705116 | 1000A | -1 | cpp | Accepted | 31 | 12,288 | #include<bits/stdc++.h>
using namespace std;
#define INT_SIZE 32
#define ll long long int
#define ff first
#define ss second
#define mod 1000000007
int main() {
ios_base::sync_with_stdio(false);
cin.tie(NULL); cout.tie(NULL);
int n; cin>>n; string s; map<string ,int> X;
vector<string> A;
for(int i=0;i<n;++i) {
cin>>s; X[s]++;
}
int ans=0;
for(int i=0;i<n;++i) {
cin>>s;
if(X[s]>0) X[s]--;
else ans++;
}
cout<<ans<<endl;
return 0;
} | codeforces | 37 | 500 |
39705299 | 1000A | -1 | cpp | Accepted | 30 | 106,496 | #include <bits/stdc++.h>
using namespace std;
const int maxn = 1000;
string s[maxn];
string s1[maxn];
int f[10][1000];
int main() {
int n = 0;
cin >> n;
for(int i=0;i<n;i++) {
cin >> s[i];
int l = s[i].length();
f[l][s[i][l-1]] ++;
}
for(int i=0;i<n;i++) {
cin >> s1[i];
int l = s1[i].length();
f[l][s1[i][l-1]] --;
}
int res = 0;
for(int i=0;i<5;i++) {
for(int j=0;j<500;j++) {
if (f[i][j] <0) {
res += f[i][j];
}
}
}
cout << -res;
}
| codeforces | 37 | 500 |
39707382 | 1000A | -1 | cpp | Accepted | 31 | 12,288 | #include <map>
#include <iostream>
using namespace std;
int main(){
int n,ans = 0;
string s;
cin >> n;
map<string,int>m;
for(int i=0;i<n;++i){
cin >> s;
m[s]++;
}
for(int i=0;i<n;++i){
cin >> s;
if(m[s]) m[s]--;
else continue;
}
map<string,int>::iterator it;
for(it = m.begin();it!=m.end();++it){
//cout<<it->first<<" "<<it->second<<" \n";
ans += it->second;
}
cout<<ans<<endl;
return 0;
}
| codeforces | 37 | 500 |
39710247 | 1000A | -1 | cpp | Accepted | 31 | 8,192 | #include<bits/stdc++.h>
#define ll long long
#define ull unsigned long long
#define endl '\n'
using namespace std;
int main()
{
int n;
cin>>n;
string str;
map<string,int>mp;
for(int i=0 ;i<n ;i++)
{
cin>>str;
mp[str]++;
}
int cnt=0;
for(int i=0 ;i<n ;i++)
{
cin>>str;
if(mp[str]!=0)
{
mp[str]-=1;
}
else
{
cnt++;
}
}
cout<<cnt<<endl;
return 0;
}
| codeforces | 37 | 500 |
39712426 | 1000A | -1 | cpp | Accepted | 30 | 12,288 | #include<bits/stdc++.h>
using namespace std;
int main()
{
int n;
char aa[110][10],bb[110][10];
int cv[110];
cin>>n;
for(int i=0; i<n; i++)
cin>>aa[i];
for(int i=0; i<n; i++)
cin>>bb[i];
int ans=0;
memset(cv,0,sizeof(cv));
for(int i=0; i<n; i++)
{
for(int j=0; j<n; j++)
if(strcmp(aa[i],bb[j])==0&&cv[j]==0)
{
ans++;
cv[j]=1;
break;
}
}
if(ans==n) puts("0");
else printf("%d\n",n-ans);
}
| codeforces | 37 | 500 |
39726664 | 1000A | -1 | cpp | Accepted | 30 | 4,096 | #include <iostream>
#include <string>
#include <map>
#include <vector>
#include <algorithm>
#include <set>
#include <cmath>
#include <stack>
#include <ctime>
using namespace std;
int main() {
map<string,int>a;
int n, ans = 0,go=0;
cin >> n;
string s,s1;
for (int i = 0;i < n;i++)
{
cin >>s;
a[s]++;
}
for (int i = 0;i < n;i++)
{
cin >>s;
if (a[s]>0)
a[s]--;
else
ans++;
}
cout << ans;
// system("pause");
return 0;
} | codeforces | 37 | 500 |
39766748 | 1000A | -1 | cpp | Accepted | 31 | 8,192 | #include<bits/stdc++.h>
using namespace std;
typedef long long int li;
typedef pair<li,li> pii;
#define pb(a) push_back(a)
int main()
{
map<string,int> mp;
int n;
string s;
cin>>n;
for(int i=0;i<n;i++)
{
cin>>s;
mp[s]++;
}
for(int i=0;i<n;i++)
{
cin>>s;
mp[s]--;
}
int ans=0;
//vector<string,int>::iterator it;
for(std::map<string,int>::iterator it = mp.begin(); it != mp.end(); it++)
{
ans+=max(0,it->second);
}
cout<<ans<<endl;
return 0;
} | codeforces | 37 | 500 |
39795887 | 1000A | -1 | cpp | Accepted | 31 | 24,576 | #include <bits/stdc++.h>
using namespace std;
int main() {
int n;
cin >> n;
vector<string> A(n), B(n);
for (int i=0; i<n; i++) cin >> A[i];
for (int i=0; i<n; i++) cin >> B[i];
sort(A.begin(), A.end());
sort(B.begin(), B.end());
int count = 0;
int i=0, j=0;
while (i < A.size() && j < B.size()) {
if (A[i] == B[j]) {
i++;
j++;
} else if (A[i] < B[j]) {
i++;
} else {
j++;
count++;
}
}
while (j < B.size()) {
count++;
j++;
}
cout << count << endl;
}
| codeforces | 37 | 500 |
40106733 | 1000A | -1 | cpp | Accepted | 31 | 303,104 | #include <bits/stdc++.h>
using namespace std;
int main()
{
int n;
cin >> n;
string s;
map<char, int> m[4];
map<char, char> t;
t['S'] = 'L', t['L'] = 'S';
for (int i = 0; i < n; ++i)
cin >> s, ++m[s.size() - 1][*s.rbegin()];
int ans = 0;
while (n--)
{
cin >> s;
if (s.size() == 1)
m[0][s[0]] ? --m[0][s[0]] : ++ans;
else
m[s.size() - 1][*s.rbegin()] ? --m[s.size() - 1][*s.rbegin()] : (++ans, --m[s.size() - 1][t[*s.rbegin()]]);
}
cout << ans << endl;
} | codeforces | 37 | 500 |
45261993 | 1000A | -1 | cpp | Accepted | 30 | 253,952 | #include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <iterator>
using namespace std;
int main() {
int n;
cin >> n;
vector<string> v(n), w(n);
for (int i = 0; i < n; ++i)
cin >> v[i];
for (int i = 0; i < n; ++i)
cin >> w[i];
sort(v.begin(), v.end());
sort(w.begin(), w.end());
cout << distance(v.begin(), set_difference(v.begin(), v.end(), w.begin(), w.end(), v.begin())) << endl;
return 0;
}
| codeforces | 37 | 500 |
72569306 | 1000A | -1 | cpp | Accepted | 46 | 151,552 | #include<cstdio>
#include<iostream>
#include<map>
#include<string>
using namespace std;
map<string,int> a;
map<string,int> b;
int main(){
a.clear();
b.clear();
int n,ans=0;
string s[105];
string ss;
cin>>n;
for(int i=1;i<=n;i++){
cin>>s[i];a[s[i]]++;
}for(int i=1;i<=n;i++){
cin>>ss;
if(!a[ss]){
ans++;
}else{
b[ss]++;
}
}for(int i=1;i<=n;i++){
if(b[s[i]]-a[s[i]]>0){
ans+=b[s[i]]-a[s[i]];
b[s[i]]=0;
}
}
cout<<ans;
return 0;
}
| codeforces | 37 | 500 |
81891010 | 1000A | -1 | cpp | Accepted | 31 | 249,856 | #include <iostream>
#include <map>
#include <string>
using namespace std;
int main()
{
map <string, int> pre;
map <string, int> aft;
int n;
string tmp;
cin>>n;
for(int i = 1; i <= n; i++)
{
cin>>tmp;
pre[tmp]++;
}
for(int i = 1; i <= n; i++)
{
cin>>tmp;
if(pre[tmp] > 0) pre[tmp]--;
else
{
aft[tmp]++;
}
}
int res = 0;
map <string, int> :: iterator it;
for(it = pre.begin(); it != pre.end(); it++)
res += it->second;
cout<<res<<endl;
} | codeforces | 37 | 500 |
81891010 | 1000A | -1 | cpp | Accepted | 31 | 249,856 | #include <iostream>
#include <map>
#include <string>
using namespace std;
int main()
{
map <string, int> pre;
map <string, int> aft;
int n;
string tmp;
cin>>n;
for(int i = 1; i <= n; i++)
{
cin>>tmp;
pre[tmp]++;
}
for(int i = 1; i <= n; i++)
{
cin>>tmp;
if(pre[tmp] > 0) pre[tmp]--;
else
{
aft[tmp]++;
}
}
int res = 0;
map <string, int> :: iterator it;
for(it = pre.begin(); it != pre.end(); it++)
res += it->second;
cout<<res<<endl;
} | codeforces | 37 | 500 |
109010607 | 1000A | -1 | cpp | Accepted | 15 | 8,192 | #include <bits/stdc++.h>
#define maxN 100+5
using namespace std;
int main()
{
int n;
cin>>n;
string a[maxN],b[maxN];
for(int i=0;i<n;i++)cin>>a[i];
for(int i=0;i<n;i++)cin>>b[i];
int ans=0;
for(int i=0;i<n;i++){
bool flag=0;
for(int j=0;j<n;j++){
if(b[i]==a[j]){
flag=1;
a[j]="";
break;
}
}
if(!flag)ans++;
}
cout<<ans<<endl;
}
| codeforces | 37 | 500 |
39704589 | 1000A | -1 | cpp | Accepted | 31 | 9,629,696 | #include<bits/stdc++.h>
using namespace std;
#define int long long
#define mp make_pair
#define pb push_back
#define pii pair<int,int>
#define F first
#define S second
#define ld long double
int const M=2e5+10,M2=1e6+10,mod=1e9+7,mod2=1e9+9,inf=1e18+30;
map<string,int>cnt;
string b[M],a[M];
int32_t main()
{
int n,ans=0;
cin>>n;
for(int i=1;i<=n;i++)cin>>a[i];
for(int i=1;i<=n;i++)cin>>b[i],cnt[b[i]]++;
for(int i=1;i<=n;i++)
{
if(cnt[a[i]]>0)cnt[a[i]]--;
else ans++;
}
cout<<ans;
}
| codeforces | 37 | 501 |
39705566 | 1000A | -1 | cpp | Accepted | 30 | 20,480 | #include <bits/stdc++.h>
using namespace std;
const int maxn=111;
int n,m,k;
string a;
map<string,int>G;
void Q()
{
int q=0;
for(int i=1;i<=10;i++)
{
q+=i;
}
}
int main()
{
scanf("%d",&n);
Q();
for(int i=1;i<=n;i++)
{
cin>>a;
G[a]++;
}
int ans=n;
for(int i=1;i<=n;i++)
{
cin>>a;
if(G[a]>0){
G[a]--;
ans--;
}
}
printf("%d\n",ans);
return 0;
}
| codeforces | 37 | 501 |
39707787 | 1000A | -1 | cpp | Accepted | 31 | 16,384 | #include <bits/stdc++.h>
using namespace std;
int main()
{
int n,i,j;
cin>>n;
map<int,map<char,int> > mp;
for(i=0;i<n;i++)
{
string str;
cin>>str;
int x=str.size();
if(mp[x].count(str[x-1])!=0)
mp[x][str[x-1]]++;
else
mp[x][str[x-1]]=1;
}
int ans=0;
for(i=0;i<n;i++)
{
string str;
cin>>str;
int x=str.size();
if(mp[x].count(str[x-1])==0 || mp[x][str[x-1]]==0)
ans++;
else
mp[x][str[x-1]]--;
}
cout<<ans<<endl;
} | codeforces | 37 | 501 |
39724618 | 1000A | -1 | cpp | Accepted | 30 | 12,288 | #include<bits/stdc++.h>
using namespace std;
map<string,int> mp;
int main()
{
int n,k,i,j;
scanf("%d",&n);
getchar();
for(i=0;i<n;i++)
{
string a;
getline(cin,a);
mp[a]++;
}
int ans = 0;
for(i=0;i<n;i++)
{
string a;
getline(cin,a);
if(mp[a] == 0)
{
ans++;
}
else
{
mp[a]--;
}
}
printf("%d\n",ans);
return 0;
}
| codeforces | 37 | 501 |
39725143 | 1000A | -1 | cpp | Accepted | 15 | 4,096 | #include<iostream>
#include<string>
using namespace std;
int main()
{
int n;
cin>>n;
string a[n],b[n];
for(int i=0;i<n;i++)
{
cin>>a[i];
}
for(int i=0;i<n;i++)
{
cin>>b[i];
}
for(int i=0;i<n;i++)
for(int j=0;j<n;j++)
if(a[i]==b[j])
{
b[j]="";
break;
}
int count=0;
for(int i=0;i<n;i++)
if(b[i]!="")
count++;
cout<<count;
return 0;
}
| codeforces | 37 | 501 |
40114885 | 1000A | -1 | cpp | Accepted | 30 | 4,096 | #include <iostream>
using namespace std;
int main()
{
int n,i,j,m,t=0,q=0,k=0;
string A[102],B[102];
cin >> n ;
m=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++)
{
t=0;
for(j=0;j<m;j++)
if(B[j]==A[i])
{
t=1;
break;
}
if(t==1)
{
for(k=j;k<m;k++)
B[k]=B[k+1];
m--;
q++;
}
}
cout << n-q;
return 0 ;
}
| codeforces | 37 | 501 |
50136953 | 1000A | -1 | cpp | Accepted | 30 | 8,192 | #include <iostream>
#include <map>
using namespace std;
int n;
string s;
map<string,int> mp;
int res;
int main()
{
cin>>n;
for(int i=0;i<n;i++)
{
cin>>s;
mp[s]++;
}
for(int i=0;i<n;i++)
{
cin>>s;
map<string,int>::iterator it=mp.find(s);
if(it!=mp.end() && mp[s]!=0)
{
mp[s]--;
}
else
{
res++;
}
}
cout<<res;
return 0;
}
| codeforces | 37 | 501 |
51088587 | 1000A | -1 | cpp | Accepted | 31 | 4,096 | #include<bits/stdc++.h>
#include<string>
#include<cstdlib>
#include<cmath>
#include <algorithm>
#include <iomanip>
#include <iostream>
#include <iterator>
using namespace std;
map<string,int> m;
/*BISHOY MAGDY ADEEB*/
int main(){
int n;
cin>>n;
string s;
for(int i=0;i<n;i++){cin>>s;
m[s]++;
}
int sum=0;
for(int i=0;i<n;i++){
cin>>s;
if(m.find(s)->second){
m[s]--;
sum++;
}
}
cout<<n-sum;
return 0;
}
| codeforces | 37 | 501 |
112205111 | 1000A | -1 | cpp | Accepted | 31 | 147,456 | #include <iostream>
#include <map>
using namespace std;
int main () {
ios::sync_with_stdio (false); cin.tie (0);
int n; cin >> n;
int res = n;
map <string, int> cnt1, cnt2;
for (int i = 0; i < n; i++) {
string s; cin >> s;
cnt1[s]++;
}
for (int i = 0; i < n; i++) {
string s; cin >> s;
cnt2[s]++;
}
for (pair <string, int> x : cnt1) {
res -= min (x.second, cnt2[x.first]);
}
cout << res;
return 0;
}
| codeforces | 37 | 501 |
116014868 | 1000A | -1 | cpp | Accepted | 30 | 4,313,088 | #include <bits/stdc++.h>
using namespace std;
int main() {
ios_base::sync_with_stdio(false), cin.tie(nullptr);
#ifdef FILE_INPUT
freopen(".inp", "r", stdin);
freopen(".out", "w", stdout);
#endif
#define fi first
#define se second
map<string,int> mpa, mpb;
int n, ans; cin >> n;
ans = n;
vector<string> a(n), b(n);
for(auto &x : a) cin >> x, ++mpa[x];
for(auto &x : b) cin >> x, ++mpb[x];
for(auto &x : mpa) ans -= min(x.se, mpb[x.fi]);
cout << ans;
return 0;
} | codeforces | 37 | 501 |
39704414 | 1000A | -1 | cpp | Accepted | 31 | 12,288 | #include <bits/stdc++.h>
using namespace std;
#define mp make_pair
#define pb push_back
typedef pair<int, int> ii;
typedef long long ll;
typedef pair<ll, ll> l4;
map<string, int> ma;
int main()
{
int n;
cin >> n;
for (int d = -1; d <= 1; d += 2)
{
for (int i = 0; i < n; ++i)
{
string s;
cin >> s;
ma[s] += d;
}
}
int ans = 0;
for (auto e : ma)
ans += abs(e.second);
printf("%d\n", ans/2);
}
| codeforces | 37 | 502 |
39754390 | 1000A | -1 | cpp | Accepted | 31 | 151,552 | #include<iostream>
#include<string>
#include<map>
#include<vector>
using namespace std;
map<string , int> ok , hey;
vector<string> lol;
int main (){
int n , ans=0; cin >> n;
string s;lol.resize(n);
for(int i=0 ; i<n ;i++){cin >> s ; ok[s]++;}
for(int i=0 ;i<n ; i++){cin >> lol[i] ; hey[lol[i]]++;}
for(int i=0 ;i<n ; i++){
if(!ok[lol[i]])ans++;
else if(ok[lol[i]]<hey[lol[i]]){ans+=hey[lol[i]]-ok[lol[i]];hey[lol[i]]=ok[lol[i]]=1;}
}
printf("%d" , ans);
return 0;
} | codeforces | 37 | 502 |
39756916 | 1000A | -1 | cpp | Accepted | 31 | 8,192 | #include <iostream>
#include <bits/stdc++.h>
using namespace std;
int main()
{
int n;
cin >> n;
unordered_map<string, int> umap;
string a;
for(int i=0; i<n;i++){
cin >> a;
if(umap.find(a)==umap.end()){
umap[a]==0;
}
umap[a]++;
}
int ans=0;
for(int i=0; i<n;i++){
cin >> a;
if(umap.find(a)!=umap.end() && umap[a]>0){
umap[a]--;
ans++;
}
}
cout << n-ans;
return 0;
}
| codeforces | 37 | 502 |
39807110 | 1000A | -1 | cpp | Accepted | 30 | 61,440 | #include <bits/stdc++.h>
using namespace std;
#define f first
#define s second
#define ll long long
#define mk make_pair
#define pb push_back
#define pp pop_back
int n;
int a = 0;
map<string, int> mp;
string s[1000], s1[1000];
int main() {
cin >> n;
for (int i = 0; i < n; ++i) {
cin >> s[i];
mp[s[i]]++;
}
for (int i = 0; i < n; ++i) {
cin >> s1[i];
}
for (int j = 0; j < n; ++j) {
if (mp[s1[j]] == 0) {
a++;
} else {
mp[s1[j]]--;
}
}
cout<<a;
}
| codeforces | 37 | 502 |
39982373 | 1000A | -1 | cpp | Accepted | 31 | 303,104 | #include <bits/stdc++.h>
using namespace std;
int arr[100];
vector<int>primes;
int main()
{
int n ;
cin >> n ;
multiset <string>mp1;
string s;
for(int i = 0 ; i < n ; i ++)
{
cin >>s;
mp1.insert(s);
}
int cnt = 0;
for(int i = 0 ; i < n ; i ++)
{
cin >>s;
if(mp1.find(s)==mp1.end())
{cnt++;}
else mp1.erase(mp1.find(s));
}
cout << cnt <<endl;
return 0;
}
| codeforces | 37 | 502 |
40661767 | 1000A | -1 | cpp | Accepted | 31 | 16,384 | #include<cstring>
#include<cstdio>
#include<iostream>
#include<algorithm>
#include<cmath>
#include<vector>
#include<map>
using namespace std;
typedef long long ll;
map <string,int> c1,c2;
string s[105],S;
int main(){
int n;
int ans=0;
scanf("%d",&n);
for(int i=1;i<=n;i++){
cin>>s[i];
c1[s[i]]++;
}
for(int i=1;i<=n;i++){
cin>>S;
if(!c1[S]) ans++;
else c2[S]++;
}
for(int i=1;i<=n;i++){
if(c2[s[i]]>c1[s[i]]){
ans+=c2[s[i]]-c1[s[i]];
c2[s[i]]=0;
}
}
printf("%d\n",ans);
} | codeforces | 37 | 502 |
41291492 | 1000A | -1 | cpp | Accepted | 31 | 8,192 | #include <bits/stdc++.h>
#define ll long long
#define pb push_back
#define mod 1000000007
#define X first
#define Y second
#define maxn 25
#define INF 999999999
using namespace std;
typedef pair<int,int> P;
int n;
map<string,int> mp;
int main(){
scanf("%d",&n);
for(int i=0;i<n;i++){
string s;
cin>>s;
mp[s]++;
}
int cnt=0;
for(int i=0;i<n;i++){
string s;
cin>>s;
if(mp[s]>0){
cnt++;
mp[s]--;
}
}
printf("%d",n-cnt);
return 0;
} | codeforces | 37 | 502 |
72574281 | 1000A | -1 | cpp | Accepted | 31 | 12,288 | #include<stdio.h>
#include<string.h>
#include<math.h>
#include<stdlib.h>
#include<iostream>
#include<cstdio>
#include<cstring>
#include<algorithm>
using namespace std;
typedef long long ll;
string a[105],b[105];
int main() {
int n,i,j,t;
cin>>n;
getchar();
t=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]) {
b[j]=' ';
t--;
break;
}
}
}
printf("%d\n",t);
return 0;
}
| codeforces | 37 | 502 |
39709121 | 1000A | -1 | cpp | Accepted | 30 | 12,288 | #include <bits/stdc++.h>
using namespace std;
int main() {
#ifndef ONLINE_JUDGE
freopen("input.txt", "r" , stdin);
freopen("output.txt", "w" , stdout);
#endif // ONLINE_JUDGE
int n;
cin >> n;
map<string,int> a2;
for(int i=0;i<n;i++){
string x;
cin >> x;
a2[x]++;
}
for(int i=0;i<n;i++){
string x;
cin >> x;
a2[x]--;
}
int x = 0;
for(auto it : a2){
if(it.second>0)x+=it.second;
}
cout << x;
return 0;
}
| codeforces | 37 | 503 |
39709807 | 1000A | -1 | cpp | Accepted | 30 | 16,384 | #include<cstdio>
#include<algorithm>
#include<cstring>
#include<string>
char s1[105][150],s2[105][150];
int n,Min,cnt,b1[105],b2[105],bj,ans,len;
int main(){
// freopen(" ","r",stdin);
scanf("%d",&n);
for (int i=1;i<=n;i++)scanf("%s",s1[i]);
for (int i=1;i<=n;i++)scanf("%s",s2[i]);
for (int i=1;i<=n;i++){
Min=100000000;
bj=0;
for (int j=1;j<=n;j++){
if (!strcmp(s1[i],s2[j])&&b2[j]==0){
b2[j]=1;
cnt++;
break;
}
}
}
printf("%d",n-cnt);
}
| codeforces | 37 | 503 |
39721712 | 1000A | -1 | cpp | Accepted | 30 | 12,288 | #include <bits/stdc++.h>
using namespace std;
map<string, int> frq;
int main()
{
ios::sync_with_stdio(0);
cin.tie(0);
int n; cin >> n;
for (int i = 0; i < n; ++i) {
string x; cin >> x;
frq[x]++;
}
for (int i = 0; i < n; ++i) {
string x; cin >> x;
frq[x]--;
}
int sum=0;
for(auto i=frq.begin(); i!=frq.end(); i++)
{
if(i->second>0)sum+=i->second;
}
cout << sum << endl;
return 0;
} | codeforces | 37 | 503 |
40229387 | 1000A | -1 | cpp | Accepted | 30 | 16,384 | #include <iostream>
using namespace std;
int main() {
int n,secs = 0;
cin>>n;
string a[100],b[100];
for(int i=0;i<n;i++)
cin>>a[i];
for(int i=0;i<n;i++)
cin>>b[i];
int equal = 0;
for(int i=0;i<n;i++)
{
for(int j=0;j<n;j++)
{
if(a[i]==b[j])
{
equal++;
b[j]="Z";
break;
}
}
}
secs = n-equal;
cout<<secs;
return 0;
} | codeforces | 37 | 503 |
56880363 | 1000A | -1 | cpp | Accepted | 46 | 12,288 | #include <cstdio>
#include <cstring>
#include <iostream>
#include <algorithm>
#include <map>
using namespace std;
int N;
string s[] = {"M","S","XS","XXS","XXXS","L","XL","XXL","XXXL"};
map<string,int> a,b,c;
bool flag[10] = {0};
int main(){
scanf("%d",&N);
for(int i = 1;i <= N;i++){
string tmp;
cin>>tmp;
a[tmp]++;
}
for(int i = 1;i <= N;i++){
string tmp;
cin>>tmp;
if(a[tmp])a[tmp]--;
}
int ans = 0;
for(int i = 0;i <= 8;i++){
ans += a[s[i]];
}
printf("%d\n",ans);
return 0;
} | codeforces | 37 | 503 |
88271361 | 1000A | -1 | cpp | Accepted | 30 | 4,120,576 | #include<bits/stdc++.h>
using namespace std;
#define ll long long
#define ull unsigned long long
int main(){
/*int t;cin>>t;
while(t--){*/
int n;cin>>n;
map<string,int> m;
string tmp,tmp1;
for(int i=0;i<n;i++){
cin>>tmp;
m[tmp]++;
}
int ans=0;
for(int i=0;i<n;i++){
cin>>tmp1;
if(m[tmp1])m[tmp1]--;
else ans++;
}
cout<<ans<<endl;
//}
}
| codeforces | 37 | 503 |
109702759 | 1000A | -1 | cpp | Accepted | 31 | 155,648 | #include<iostream>
#include<algorithm>
#include<cstdio>
#include<map>
#include<string>
#include<set>
#include<vector>
using namespace std;
int main() {
//freopen("888.txt","r",stdin);
int n;cin >> n;
string s;
map<string ,int>m1,m2;
for(int i=1;i<=n;i++){cin>>s;m1[s]++;};
for(int i=1;i<=n;i++){cin>>s;m2[s]++;};
int ans=n;//总操作数
for(auto it : m1){
ans-=min(it.second,m2[it.first]);//int 一样时 就减少了它们件数
} // 否则 减少它们差值
cout<<ans<<"\n";
return 0;
}
| codeforces | 37 | 503 |
39722802 | 1000A | -1 | cpp | Accepted | 31 | 155,648 | #include <bits/stdc++.h>
using namespace std;
int main(){
int n, sol=0;
cin >> n;
string a;
map<string, int> sizes1;
map<string, int> sizes2;
for(int i=0;i<n;i++){
cin >> a;
sizes1[a]++;
}
for(int i=0;i<n;i++){
cin >> a;
sizes2[a]++;
}
string sizes[]={"XXXL", "XXL", "XL", "L", "M", "S", "XS", "XXS", "XXXS"};
for(int i=0;i<9;i++){
sol+=abs(sizes1[sizes[i]]-sizes2[sizes[i]]);
}
cout << sol/2;
return 0;
}
| codeforces | 37 | 504 |
40351007 | 1000A | -1 | cpp | Accepted | 31 | 12,288 | #include <bits/stdc++.h>
using namespace std;
#define neigh(u,e,v) for(int e = head[u], v; v = to[e], ~e; e = nxt[e])
#define inoutfile freopen("input.txt", "rt", stdin);freopen("output.txt", "wt", stdout)
int main() {
int n;
cin >> n;
string x;
map<string, int> freq;
for (int i = 0; i < n; ++i) {
cin >> x;
freq[x]++;
}
for (int i = 0; i < n; ++i) {
cin >> x;
freq[x]--;
}
int sum = 0;
for (auto it : freq) {
sum += abs(it.second);
}
cout << sum / 2;
}
| codeforces | 37 | 504 |
116700711 | 1000A | -1 | cpp | Accepted | 31 | 151,552 | #include<bits/stdc++.h>
using namespace std;
int main()
{
int n,i;
cin>>n;
string a[n],b[n];
for(i=0;i<n;i++)
{
cin>>a[i];
}
for(i=0;i<n;i++)
{
cin>>b[i];
}
map<string,int> mp;
map<string,int>mp1;
for(auto i: a)
{
mp[i]++;
}
for(auto i: b)
{
mp1[i]++;
}
for(auto i: mp1)
{
n-=min(i.second,mp[i.first]);
}
cout<<n<<endl;
return 0;
} | codeforces | 37 | 504 |
39733160 | 1000A | -1 | cpp | Accepted | 31 | 159,744 | #include<bits/stdc++.h>
using namespace std;
string str[] = {"M","S","L","XS","XL","XXS","XXL","XXXS","XXXL"};
int main()
{
int n;
map<string,int> firstInput;
map<string,int> secondInput;
cin>>n;
string in;
for(int i=0;i<n;i++){
cin>>in;
firstInput[in]++;
}
for(int i=0;i<n;i++){
cin>>in;
secondInput[in]++;
}
int ans = 0;
for(int i=0;i<9;i++){
int inc = firstInput[str[i]];
int sec = secondInput[str[i]];
ans+=max(inc-sec,0);
}
cout<<ans<<endl;
return 0;
} | codeforces | 37 | 505 |
39758082 | 1000A | -1 | cpp | Accepted | 30 | 24,576 | #include<bits/stdc++.h>
using namespace std;
int main()
{
int cnt=0;
string s;
int n,i;
cin >> n;
map<string,int>mp;
vector<string>v;
for(i=0;i<n;i++){
cin >> s;
mp[s]++;
v.push_back(s);
}
for(i=0;i<n;i++){
cin >> s;
mp[s]--;
}
for(i=0;i<v.size();i++){
s=v[i];
if(mp[s]>0){
cnt+=mp[s];
mp[s]=0;
}
}
cout << cnt << endl;
return 0;
}
| codeforces | 37 | 505 |
39806732 | 1000A | -1 | cpp | Accepted | 31 | 4,096 | //Be Name Khoda :))
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int MN=3e5+100 , mod=1e9+7 ;
int n,ans;
map<string,int>m;
int32_t main()
{
ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
cin>>n;
for(int i=0;i<n;i++){
string s;cin>>s;
m[s]++;
}
for(int i=0;i<n;i++){
string s;cin>>s;
if(!m[s]){
ans++;
}else{
m[s]--;
}
}
cout<<ans<<"\n";
}
| codeforces | 37 | 505 |
40063871 | 1000A | -1 | cpp | Accepted | 31 | 16,384 | #include<iostream>
#include"string"
using namespace std;
int main()
{
int x;
int n=0;
bool q = true;
string a[100];
string y [100];
cin >> x;
for (int i = 0; i < x; i++)
{
cin >> y[i];
}
for ( int j= 0; j <x; j++)
{
cin >> a[j];
}
for (int v = 0; v < x; v++)
{
q = true;
for (int b = 0; b < x; b++)
{
if (y[v] == a[b])
{
q = false;
a[b] = " ";
break;
}
}
if (q)
n++;
}
cout << n << endl;
return 0;
} | codeforces | 37 | 505 |
39706327 | 1000A | -1 | cpp | Accepted | 30 | 8,192 | #include <iostream>
#include <bits/stdc++.h>
#include <unordered_map>
using namespace std;
int main() {
// your code goes here
int n;
cin>>n;
vector< unordered_map<char,int> > maps(4);
for(int i=0;i<n;i++) {
string s;
cin>>s;
maps[s.length()-1][s[s.length()-1]]++;
}
int ans=0;
for(int i=0;i<n;i++){
string s;
cin>>s;
if(maps[s.length()-1][s[s.length()-1]]>0){
maps[s.length()-1][s[s.length()-1]]--;
}
else{
ans++;
}
}
cout<<ans;
return 0;
} | codeforces | 37 | 506 |
39797667 | 1000A | -1 | cpp | Accepted | 31 | 24,576 | #include <bits/stdc++.h>
using namespace std;
using i64 = long long;
#define rep(i,s,e) for(int (i) = (s);(i) <= (e);(i)++)
map<char,int> A[4];
int main(){
int N;
cin >> N;
rep(i,0,N - 1){
string s;
cin >> s;
A[(int)s.size() - 1][s.back()]++;
}
int ans = 0;
rep(i,0,N - 1){
string s;
cin >> s;
if(A[(int)s.size() - 1][s.back()] > 0){
A[(int)s.size() - 1][s.back()]--;
}
else{
ans++;
}
}
cout << ans << endl;
}
| codeforces | 37 | 506 |
39864148 | 1000A | -1 | cpp | Accepted | 30 | 4,096 | #include <iostream>
#include <string>
using namespace std;
int main()
{
int n;
string a[101];
string b[101];
cin >> n;
//string tmp;
int res = 0;
for (int i = 0; i < n; ++i) cin >> a[i];
for (int i = 0; i < n; ++i) cin >> b[i];
bool find = false;
for (int i = 0; i < n; ++i)
{
find = false;
for (int j = 0; j < n && !find; ++j)
{
if (a[i] == b[j])
{
find = true;
b[j] = "";
}
}
if (!find)
res++;
}
cout << res;
return 0;
} | codeforces | 37 | 506 |
98101396 | 1000A | -1 | cpp | Accepted | 31 | 4,096 | #include <bits/stdc++.h>
using namespace std;
map <string, int> mp1, mp2;
string s; int n, ans;
signed main () {
cin>>n;
for (int i = 1; i <= n; i++) {
cin>>s; mp1[s]++;
}
for (int i = 1; i <= n; i++) {
cin>>s; mp2[s]++;
}
map <string, int> :: iterator it;
for (it = mp2.begin(); it != mp2.end(); it++) {
if (mp1[it -> first] <= (it -> second)) ans += (it -> second) - mp1[it -> first];
}
printf ("%d\n", ans);
return 0;
}
| codeforces | 37 | 506 |
98101396 | 1000A | -1 | cpp | Accepted | 31 | 4,096 | #include <bits/stdc++.h>
using namespace std;
map <string, int> mp1, mp2;
string s; int n, ans;
signed main () {
cin>>n;
for (int i = 1; i <= n; i++) {
cin>>s; mp1[s]++;
}
for (int i = 1; i <= n; i++) {
cin>>s; mp2[s]++;
}
map <string, int> :: iterator it;
for (it = mp2.begin(); it != mp2.end(); it++) {
if (mp1[it -> first] <= (it -> second)) ans += (it -> second) - mp1[it -> first];
}
printf ("%d\n", ans);
return 0;
}
| codeforces | 37 | 506 |
39705522 | 1000A | -1 | cpp | Accepted | 31 | 8,192 | #include<bits/stdc++.h>
using namespace std;
typedef long long ll;
int main()
{
ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#ifndef ONLINE_JUDGE
freopen("in.txt","r",stdin);
freopen("out.txt","w",stdout);
#endif
int n;
cin>>n;
map<string,int> m;
for(int i=0;i<n;i++)
{
string s;
cin>>s;
m[s]++;
}
int ans=0;
for(int i=0;i<n;i++)
{
string s;
cin>>s;
if(m[s]>0)
{
m[s]--;
}
else
{
ans++;
}
}
cout<<ans;
return 0;
} | codeforces | 37 | 507 |
39711767 | 1000A | -1 | cpp | Accepted | 30 | 8,192 | #include<bits/stdc++.h>
using namespace std;
int main(){
int n, sum=0;
string str;
vector<int> c(9,0);
cin >> n;
c.resize(n);
for(int i=0;i<2*n;i++){
cin >> str;
switch(str[str.length()-1]){
case 'S':
c[3-str.length()+1]+=1+(i>=n?-2:0);
break;
case 'M':
c[4]+=1+(i>=n?-2:0);
break;
case 'L':
c[5+str.length()-1]+=1+(i>=n?-2:0);
break;
}
}
for(int i=0;i<9;i++)sum += (c[i]>=0 ? c[i] : -c[i]);
cout << sum/2 << endl;
return 0;
}
| codeforces | 37 | 507 |
39715074 | 1000A | -1 | cpp | Accepted | 15 | 24,576 | #include<iostream>
using namespace std;
#include <string>
#include <algorithm>
string arr1[101];
string arr2[101];
int main()
{
short n,cnt=0;
bool flag=false;
cin>>n;
for(int i=0;i<n;i++)
{
cin>>arr1[i];
}
for(int i=0;i<n;i++)
{
cin>>arr2[i];
}
for(int i=0;i<n;i++)
{
for(int j=0;j<n;j++)
{
if(arr2[i]==arr1[j])
{
arr1[j]="0";
flag=true;
break;
}
}
if(flag==false)
{
cnt++;
}
else
flag=false;
}
cout<<cnt;
} | codeforces | 37 | 507 |
39705044 | 1000A | -1 | cpp | Accepted | 30 | 16,384 | #include <bits/stdc++.h>
using namespace std;
long long n, j, i, ans;
string a[101], b[101];
int main()
{
cin >> n;
for (i=1; i<=n; i++)
cin >> a[i];
for (i=1; i<=n; i++)
cin >> b[i];
for (i=1; i<=n; i++)
for (j=1; j<=n; j++)
if (a[i]==b[j] && a[i]!="-1")
{
a[i]="-1";
b[j]="-1";
}
for (i=1; i<=n; i++)
if (a[i]!="-1") ans++;
cout << ans;
return 0;
}
| codeforces | 37 | 508 |
39705152 | 1000A | -1 | cpp | Accepted | 30 | 8,192 | #include<iostream>
#include<algorithm>
#include<cmath>
#include<map>
#include<vector>
#include<set>
#include<iomanip>
#include<fstream>
#include<string>
using namespace std;
map<string, int> m;
int main()
{
ios_base::sync_with_stdio(0);
cin.tie(0);
cout.tie(0);
int n, ans = 0;
cin >> n;
string s;
for (int i = 0; i < n; i++)
{
cin >> s;
m[s]++;
}
for (int i = 0; i < n; i++)
{
cin >> s;
if (m[s])
m[s]--;
else
ans++;
}
cout << ans;
return 0;
} | codeforces | 37 | 508 |
39706606 | 1000A | -1 | cpp | Accepted | 30 | 49,152 | #include <cstdio>
#include <iostream>
using namespace std;
string s;
int a[55][45]={0},b[55][45]={0};
int g[1550];
int Abs(int a)
{return a<0?-a:a;}
int main()
{
int n,ans=0,i;
scanf("%d",&n);
g['S']=1;
g['M']=2;
g['L']=3;
for(i=1;i<=n;i++){
cin>>s;
a[s.length()][g[s[s.length()-1]]]++;
}
for(i=1;i<=n;i++){
cin>>s;
b[s.length()][g[s[s.length()-1]]]++;
}
for(i=1;i<=4;i++)
for(int j=1;j<=3;j++)
ans+=Abs(a[i][j]-b[i][j]);
printf("%d",ans>>1);
return 0;
} | codeforces | 37 | 508 |
39724716 | 1000A | -1 | cpp | Accepted | 30 | 4,096 | #include<bits/stdc++.h>
#define pb push_back
#define mp make_pair
using namespace std;
int main(){
int n;
cin>>n;
map<string,long long>m;
for(int i = 0; i < n; i++){
string tem;
cin>>tem;
m[tem]++;
}
for(int i = 0; i < n; i++){
string tem;
cin>>tem;
m[tem]--;
}
auto i = m.begin();
int ans = 0;
for( ; i != m.end();i++){
if(i->second>0)
ans += i->second;
}
cout<<ans;
}
| codeforces | 37 | 508 |
39746744 | 1000A | -1 | cpp | Accepted | 31 | 4,096 | #include<bits/stdc++.h>
#define mod 100000000000007
using namespace std;
typedef long long int ll;
typedef pair<int,int> pi;
map<string,int> ms;
int main() {
ios_base::sync_with_stdio(false);
cin.tie(0);
cout.tie(0);
int n,ans=0;
string s;
cin>>n;
for (int i=1;i<=n;i++) {
cin>>s;
ms[s]++;
}
for (int i=1;i<=n;i++) {
cin>>s;
if (ms[s]) {
ms[s]--;
}
else ans++;
}
cout<<ans;
}
| codeforces | 37 | 508 |
39713081 | 1000A | -1 | cpp | Accepted | 31 | 8,192 | #include <bits/stdc++.h>
#define mod 1000000007
#define fast ios:: sync_with_stdio(false); cin.tie(0); cout.tie(0);
#define rep(i,a,b) for(int i=a;i<b;i++)
#define ll long long
using namespace std;
int main()
{
fast
map<string,int> a;
int n;
cin>>n;
string s;
rep(i,0,n){
cin>>s;
a[s]++;
}
int ans=0;
rep(i,0,n){
cin>>s;
if(a[s]==0)
ans++;
else
a[s]--;
}
cout<<ans<<endl;
}
| codeforces | 37 | 509 |
39713090 | 1000A | -1 | cpp | Accepted | 31 | 24,576 | #include<iostream>
#include<cstring>
using namespace std;
int main(){
int n;
cin>>n;
int sum=0;
string a[n+1];
string b[n+1];
string m;
int f=0;
for(int i=1;i<=n;i++)
{
cin>>a[i];
}
for(int i=1;i<=n;i++)
{
cin>>b[i];
}
int ans=0;
for(int i=1;i<=n;i++)
{
for(int j=1;j<=n;j++)
{
if(a[i]==b[j])
{
ans++;
a[i]="XXXXXXXXXXXXXXXXXXX";
b[j]="XXXXXXXXXXXXXXXXX";
}
}
}
ans=n-ans;
cout<<ans<<endl;
return 0;
}
| codeforces | 37 | 509 |
39723472 | 1000A | -1 | cpp | Accepted | 30 | 155,648 | #include<bits/stdc++.h>
#define ll long long int
#define pb push_back
using namespace std;
bool compare(string &s1,string &s2)
{
return s1.size() < s2.size();
}
int main()
{
ll n,i,ans=0,len,j;
cin>>n;
string sp;
multiset<string> s1,s2;
for(i=0;i<n;i++)
{
cin>>sp;
s1.insert(sp);
}
for(i=0;i<n;i++)
{
cin>>sp;
if((s1.find(sp)!=s1.end()))
{
s1.erase(s1.find(sp));
}
}
cout<<int(s1.size());
return 0;
}
| codeforces | 37 | 509 |
39728680 | 1000A | -1 | cpp | Accepted | 30 | 151,552 | #include <bits/stdc++.h>
using namespace std;
#define ll long long
#define debug(x) cerr << fixed << #x << " is " << x << endl;
int main()
{
ios::sync_with_stdio(false);
cin.tie(NULL);
int n;
cin >> n;
multiset<string> porra;
for(int i = 0; i < n; i++)
{
string s;
cin >> s;
porra.insert(s);
}
int ans = 0;
for(int i = 0; i < n; i++)
{
string s;
cin >> s;
auto it = porra.find(s);
if(it == porra.end())
ans++;
else
porra.erase(it);
}
cout << ans << endl;
return 0;
}
| codeforces | 37 | 509 |
102985708 | 1000A | -1 | cpp | Accepted | 31 | 12,288 | #include <bits/stdc++.h>
using namespace std;
#define ll long long
#define point pair<int, int>
inline int input() {
int x;
scanf("%d", &x);
return x;
}
int main() {
#ifndef ONLINE_JUDGE
freopen("file.in", "r", stdin);
#endif
int n = input();
map<string, int> mp;
string s;
int ans = 0;
for (int i = 0; i < n; i++) {
cin >> s;
mp[s]++;
}
for (int i = 0; i < n; i++) {
cin >> s;
if (mp[s]) mp[s]--; else ans++;
}
cout << ans << endl;
} | codeforces | 37 | 509 |
115127136 | 1000A | -1 | cpp | Accepted | 31 | 147,456 | #include <iostream>
#include <map>
#include <string>
#include <cstdlib>
#include <algorithm>
int main()
{
int n;
std::map<std::string, int> m1, m2;
std::string s;
std::cin >> n;
for (int i = 0; i < n; i++)
{
std::cin >> s;
m1[s]++;
}
for (int i = 0; i < n; i++)
{
std::cin >> s;
m2[s]++;
}
for (auto s : m1)
{
n -= std::min(s.second, m2[s.first]);
}
std::cout << n << std::endl;
}
| codeforces | 37 | 509 |
39710373 | 1000A | -1 | cpp | Accepted | 31 | 20,480 | #include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
int main() {
ll n;
cin>>n;
map<string ,int> m;
vector<string> v1,v2;
for(ll i=0;i<n;i++)
{ string s;
cin>>s;
if(m.count(s)==0)
m[s]=1;
else
m[s]++;
}
ll c=0;
for(ll i=0;i<n;i++)
{ string s;
cin>>s;
if(m.count(s)!=0 && m[s]>0)
{m[s]--;
c++;
}
else
v2.push_back(s);
}
cout<<v2.size()<<endl;
return 0;
}
| codeforces | 37 | 510 |
39722247 | 1000A | -1 | cpp | Accepted | 31 | 16,384 | #include <bits/stdc++.h>
using namespace std;
int main()
{
int n,cnt=0;
cin>>n;
map<string,int>mp;
mp.clear();
int visit[n+1];
for(int i=0;i<=n;i++)
visit[i]=0;
for(int i=0;i<n;i++)
{
string s;
cin>>s;
mp[s]++;
}
for(int i=0;i<n;i++)
{
string s;
cin>>s;
if(mp[s]>0)
{
mp[s]--;
visit[i]=1;
}
}
for(int i=0;i<n;i++)
{
if(visit[i]==0)
{
cnt++;
}
}
cout<<cnt;
return 0;
}
| codeforces | 37 | 510 |
39754870 | 1000A | -1 | cpp | Accepted | 30 | 12,288 | #include<bits/stdc++.h>
using namespace std;
int n;
string s;
vector<string>v[107];
int main(){
cin>>n;
for (int i=0;i<n;i++){
cin>>s;
v[s.size()].push_back(s);
}
int sum=0;
for (int i=0;i<n;i++){
cin>>s;
int x=s.size();
bool b=0;
int j;
for ( j=0;j<v[x].size();j++){
if (s==v[x][j]){b=1;break;}
}
if (!b){sum++;}
else {v[x][j]="";}
}
cout<<sum;
return 0;
}
| codeforces | 37 | 510 |
39766711 | 1000A | -1 | cpp | Accepted | 30 | 147,456 | #include <bits/stdc++.h>
using namespace std;
int main() {
int n;
cin >> n;
vector<string> a(n), b(n);
for(int i=0;i<n;i++) cin >> a[i];
for(int i=0;i<n;i++) cin >> b[i];
map<string, int> Hash, Hash1;
for(int i=0;i<n;i++) {
Hash[a[i]]++;
Hash1[b[i]]++;
}
int Ans(0);
for(auto it=Hash.begin();it!=Hash.end();it++) {
if(Hash1.find(it->first)==Hash1.end()) Ans += it->second;
else Ans += max(0, it->second - Hash1[it->first]);
}
cout << Ans << endl;
return 0;
} | codeforces | 37 | 510 |
40182061 | 1000A | -1 | cpp | Accepted | 30 | 159,744 | #include<iostream>
#include<map>
#include<cstdlib>
using namespace std;
string S[9] = {"XXXS", "XXS", "XS", "S", "M", "L", "XL", "XXL", "XXXL"};
int main(){
int n; cin >> n;
string s;
map<string,int> M1,M2;
for(int i = 0; i < n; i++){
cin >> s;
M1[s]++;
}
for(int i = 0; i < n; i++){
cin >> s;
M2[s]++;
}
int ans = 0;
for(int i = 0; i < 9; i++){
ans += abs(M1[S[i]] - M2[S[i]]);
}
cout << ans/2 << endl;
return 0;
} | codeforces | 37 | 510 |
44940622 | 1000A | -1 | cpp | Accepted | 31 | 8,192 | #include<cstdio>
#include <iostream>
#include <map>
#include <sstream>
#include <string>
#include <vector>
#include <algorithm>
#include <functional>
using namespace std;
int n,ans;
char a[105][20],b[105][20];
int main() {
map<string,int>mm;
scanf("%d",&n);
for(int i=1;i<=n;i++)
{
scanf("%s",&a[i]);
mm[a[i]]++;
}
for(int i=1;i<=n;i++)
{
scanf("%s",&b[i]);
if(mm[b[i]]) mm[b[i]]--;
else ans++;
}
printf("%d\n",ans);;
return 0;
} | codeforces | 37 | 510 |
49955747 | 1000A | -1 | cpp | Accepted | 46 | 155,648 | #include<bits/stdc++.h>
#include<iostream>
using namespace std;
# define ll long long
int main()
{
int n;
cin>>n;
map<string,int>m1;
std::map<string, int> m2;
for(int i=1;i<=n;i++)
{
string str;
cin>>str;
m1[str]++;
}
for(int i=1;i<=n;i++)
{
string str;
cin>>str;
m2[str]++;
}
int sum=0;
std::map<string,int>::iterator it;
for(it=m2.begin();it!=m2.end();it++)
{
if(it->second>m1[it->first])
sum+=it->second-m1[it->first];
}
printf("%d\n",sum);
} | codeforces | 37 | 510 |