text
stringlengths 49
983k
|
|---|
#include <bits/stdc++.h>
using namespace std;
int main() {
int sum = 0, sum1 = 0, sum2 = 0, a, b, n, i;
cin >> n;
for (i = 0; i < n; i++) {
cin >> a;
sum += a;
}
for (i = 0; i < n - 1; i++) {
cin >> a;
sum1 += a;
}
for (i = 0; i < n - 2; i++) {
cin >> a;
sum2 += a;
}
cout << sum - sum1 << endl << sum1 - sum2;
}
|
#include <bits/stdc++.h>
using namespace std;
int comp(const void *a, const void *b) { return *(int *)a - *(int *)b; }
int main() {
int error;
cin >> error;
int *number = (int *)malloc(sizeof(int) * error);
int *number1 = (int *)malloc(sizeof(int) * error - 1);
int *number2 = (int *)malloc(sizeof(int) * error - 2);
for (int i = 0; i < error; i++) cin >> number[i];
qsort(number, error, sizeof(int), comp);
for (int i = 0; i < error - 1; i++) cin >> number1[i];
qsort(number1, error - 1, sizeof(int), comp);
for (int i = 0; i < error - 2; i++) cin >> number2[i];
qsort(number2, error - 2, sizeof(int), comp);
int error1, error2;
for (int i = 0; i < error; i++)
if (number[i] != number1[i]) {
error1 = number[i];
break;
}
for (int i = 0; i < error - 1; i++)
if (number1[i] != number2[i]) {
error2 = number1[i];
break;
}
cout << error1 << endl << error2 << endl;
return 0;
}
|
#include <bits/stdc++.h>
using namespace std;
const double EPS = 1e-10;
const double PI = acos(-1.0);
int main() {
cin.tie(0);
ios_base::sync_with_stdio(false);
int N;
cin >> N;
map<int, int> m1, m2, m3;
for (int i = (0); i < (N); ++i) {
int x;
cin >> x;
m1[x]++;
}
for (int i = (0); i < (N - 1); ++i) {
int x;
cin >> x;
m2[x]++;
}
for (int i = (0); i < (N - 2); ++i) {
int x;
cin >> x;
m3[x]++;
}
for (auto pii : m1) {
if (m2[pii.first] < pii.second) cout << pii.first << endl;
}
for (auto pii : m2) {
if (m3[pii.first] < pii.second) cout << pii.first << endl;
}
return 0;
}
|
#include <bits/stdc++.h>
int main() {
int a = 0, sum = 0, b, i, n, sum1, x;
scanf("%d", &n);
for (i = 1; i <= n; i++) {
scanf("%d", &x);
sum += x;
}
sum1 = sum;
for (i = 1; i <= n - 1; i++) {
scanf("%d", &x);
sum -= x;
}
for (i = 1; i <= n - 2; i++) {
scanf("%d", &x);
sum1 -= x;
}
sum1 = sum1 - sum;
printf("%d\n%d", sum, sum1);
return 0;
}
|
#include <bits/stdc++.h>
using namespace std;
map<int, int> mp, mpp;
int main() {
std:
ios_base::sync_with_stdio(false);
int n, i, ans1, ans2, tmp;
map<int, int>::iterator it;
cin >> n;
for (i = 0; i < n; i++) {
cin >> tmp;
mp[tmp]++;
}
for (i = 0; i < n - 1; i++) {
cin >> tmp;
mpp[tmp]++;
mp[tmp]--;
}
for (it = mp.begin(); it != mp.end(); it++) {
if (it->second == 1) ans1 = it->first;
}
for (i = 0; i < n - 2; i++) {
cin >> tmp;
mpp[tmp]--;
}
for (it = mpp.begin(); it != mpp.end(); it++) {
if (it->second == 1) ans2 = it->first;
}
cout << ans1 << "\n" << ans2 << "\n";
return 0;
}
|
#include <bits/stdc++.h>
using namespace std;
int main() {
ios_base::sync_with_stdio(false);
cin.tie(0);
cout.tie(0);
long long int n;
cin >> n;
long long int i;
long long int sum = 0;
for (i = 0; i <= n - 1; i++) {
long long int x;
cin >> x;
sum += x;
}
long long int sum1 = 0;
for (i = 0; i <= n - 2; i++) {
long long int x;
cin >> x;
sum1 += x;
}
cout << sum - sum1 << "\n";
for (i = 0; i <= n - 3; i++) {
long long int x;
cin >> x;
sum1 -= x;
}
cout << sum1;
}
|
#include <bits/stdc++.h>
using namespace std;
int main(int argc, char** argv) {
int n;
cin >> n;
long long sum = 0;
long long x = 0;
for (int i = 0; i < n; i++) {
cin >> x;
sum += x;
}
long long sum2 = 0;
for (int i = 0; i < n - 1; i++) {
cin >> x;
sum2 += x;
}
cout << sum - sum2 << '\n';
sum = sum2;
sum2 = 0;
for (int i = 0; i < n - 2; i++) {
cin >> x;
sum2 += x;
}
cout << sum - sum2 << '\n';
return 0;
}
|
#include <bits/stdc++.h>
using namespace std;
map<long long, long long> m;
map<long long, long long> m1;
vector<long long> v;
int main() {
long long n;
cin >> n;
for (long long i = 0; i < n; i++) {
long long x;
cin >> x;
m[x]++;
m1[x]++;
}
for (long long i = 0; i < n - 1; i++) {
long long y;
cin >> y;
m1[y]++;
m1[y]--;
m[y]--;
}
map<long long, long long>::iterator t = m.begin();
long long sul;
while (t != m.end()) {
pair<long long, long long> p = (*t);
while (m[p.first] > 0) {
sul = p.first;
m[p.first]--;
}
t++;
}
for (long long i = 0; i < n - 2; i++) {
long long y;
cin >> y;
m1[y]--;
if (m1[y] == 0) {
m1.erase(y);
}
}
map<long long, long long>::iterator tt = m1.begin();
while (tt != m1.end()) {
pair<long long, long long> p = (*tt);
while (m1[p.first] > 0) {
v.push_back(p.first);
m1[p.first]--;
}
tt++;
}
if (v[0] == sul)
cout << v[0] << endl << v[1] << endl;
else if (v[1] == sul)
cout << v[1] << endl << v[0] << endl;
return 0;
}
|
#include <bits/stdc++.h>
using namespace std;
int pr(long long x) {
for (long long i = 2; i * i <= x; i++) {
if (x % i == 0) return 0;
}
return 1;
}
void amhu() {
ios::sync_with_stdio(0);
cin.tie(0);
cout.tie(0);
}
int arr[10000001];
int x[1000001], y[1000001], z[1000001];
int main() {
amhu();
int a, tp = 0, tp2 = 0;
cin >> a;
for (int i = 0; i < a; i++) cin >> x[i];
sort(x, x + a);
int b = a - 1;
for (int i = 0; i < b; i++) cin >> y[i];
sort(y, y + b);
int c = b - 1;
for (int i = 0; i < c; i++) cin >> z[i];
sort(z, z + c);
for (int i = 0; i < a; i++) {
if (x[i] != y[i]) {
tp = x[i];
break;
}
}
if (tp != 0)
cout << tp << endl;
else
cout << x[a - 1] << endl;
for (int i = 0; i < b; i++) {
if (y[i] != z[i]) {
tp2 = y[i];
break;
}
}
if (tp2 != 0)
cout << tp2 << endl;
else
cout << y[b - 1] << endl;
}
|
#include <bits/stdc++.h>
using namespace std;
int main(void) {
int n, sum1 = 0, sum2 = 0, sum3 = 0, temp;
cin >> n;
for (int i = 0; i < n; i++) {
cin >> temp;
sum1 += temp;
}
for (int i = 0; i < n - 1; i++) {
cin >> temp;
sum2 += temp;
}
for (int i = 0; i < n - 2; i++) {
cin >> temp;
sum3 += temp;
}
cout << sum1 - sum2 << "\n" << sum2 - sum3 << "\n";
return 0;
}
|
#include <bits/stdc++.h>
using namespace std;
int32_t main() {
long long t = 1;
while (t--) {
long long n;
cin >> n;
long long a = 0, b = 0, c = 0;
for (long long i = 0; i < n; i++) {
long long u;
cin >> u;
a += u;
}
for (long long i = 0; i < n - 1; i++) {
long long u;
cin >> u;
b += u;
}
cout << a - b << endl;
for (long long i = 0; i < n - 2; i++) {
long long u;
cin >> u;
c += u;
}
cout << b - c << endl;
}
}
|
#include <bits/stdc++.h>
using namespace std;
int main() {
int arr[3][100005];
int n;
scanf("%d", &n);
for (int i = 0; i < 3; i++) {
for (int j = 0; j < n - i; j++) scanf("%d", &arr[i][j]);
sort(arr[i], arr[i] + n - i);
}
for (int i = 0; i < n; i++) {
if (arr[0][i] != arr[1][i]) {
printf("%d\n", arr[0][i]);
break;
}
}
for (int i = 0; i < n - 1; i++) {
if (arr[1][i] != arr[2][i]) {
printf("%d\n", arr[1][i]);
break;
}
}
}
|
#include <bits/stdc++.h>
using namespace std;
int main() {
long long n, c[100000], b[100000], a[100000], s1 = 0, s2 = 0, s3 = 0;
cin >> n;
for (int i = 0; i < n; i++) {
cin >> a[i];
s1 += a[i];
}
for (int i = 0; i < n - 1; i++) {
cin >> b[i];
s2 += b[i];
}
for (int i = 0; i < n - 2; i++) {
cin >> c[i];
s3 += c[i];
}
cout << s1 - s2 << endl << s2 - s3;
return 0;
}
|
#include <bits/stdc++.h>
using namespace std;
int main() {
int n, i;
cin >> n;
vector<int> a, b, c;
for (int i = 0; i < n; ++i) {
int tmp;
cin >> tmp;
a.push_back(tmp);
}
for (int i = 0; i < n - 1; ++i) {
int tmp;
cin >> tmp;
b.push_back(tmp);
}
for (int i = 0; i < n - 2; ++i) {
int tmp;
cin >> tmp;
c.push_back(tmp);
}
sort(a.begin(), a.end());
sort(b.begin(), b.end());
sort(c.begin(), c.end());
i = 0;
while (1) {
if (i >= b.size()) {
cout << a[i] << endl;
break;
}
if (a[i] == b[i])
i++;
else {
cout << a[i] << endl;
break;
}
}
i = 0;
while (1) {
if (i >= c.size()) {
cout << b[i] << endl;
break;
}
if (b[i] == c[i])
i++;
else {
cout << b[i];
break;
}
}
}
|
#include <bits/stdc++.h>
using namespace std;
int n, a[100001], b[100001], c[100001], e, j;
int main() {
cin >> n;
for (int i = 0; i < n; i++) cin >> a[i];
for (int i = 0; i < n - 1; i++) cin >> b[i];
for (int i = 0; i < n - 2; i++) cin >> c[i];
sort(a, a + n);
sort(b, b + n - 1);
while (a[j] == b[j] && j < n) j++;
cout << a[j] << endl;
c[n - 2] = a[j];
sort(c, c + n - 1);
j = 0;
while (a[j] == c[j] && j < n) j++;
cout << a[j] << endl;
return 0;
}
|
#include <bits/stdc++.h>
using namespace std;
int main() {
long long n, x, arr[100005], a, b;
map<long long, long long> before;
map<long long, long long> after1;
map<long long, long long> after2;
cin >> n;
for (int i = 0; i < n; i++) {
cin >> arr[i];
before[arr[i]]++;
}
for (int i = 0; i < n - 1; i++) {
cin >> x;
after1[x]++;
}
for (int i = 0; i < n - 2; i++) {
cin >> x;
after2[x]++;
}
for (int i = 0; i < n; i++) {
if (before[arr[i]] - 1 == after1[arr[i]]) {
a = arr[i];
break;
}
}
for (int i = 0; i < n; i++) {
if (after1[arr[i]] - 1 == after2[arr[i]]) {
b = arr[i];
break;
}
}
cout << a << " " << b << endl;
return 0;
}
|
#include <bits/stdc++.h>
using namespace std;
const int MAX = 1000 * 100 + 100;
string s;
int ans[3][MAX];
int n, a;
int main() {
cin >> n;
for (int i = 0; i < n; i++) {
cin >> a;
ans[0][i] = a;
}
for (int i = 0; i < n - 1; i++) {
cin >> a;
ans[1][i] = a;
}
for (int i = 0; i < n - 2; i++) {
cin >> a;
ans[2][i] = a;
}
sort(ans[0], ans[0] + n);
sort(ans[1], ans[1] + n - 1);
sort(ans[2], ans[2] + n - 2);
for (int i = 0; i < n; i++) {
if (ans[0][i] < ans[1][i]) {
cout << ans[0][i] << endl;
break;
}
if (i == n - 1) cout << ans[0][i] << endl;
}
for (int i = 0; i < n - 1; i++) {
if (ans[1][i] < ans[2][i]) {
cout << ans[1][i] << endl;
break;
}
if (i == n - 2) cout << ans[1][n - 2] << endl;
}
return 0;
}
|
#include <bits/stdc++.h>
using namespace std;
int main() {
int n;
cin >> n;
long int ar1[n], ar2[n], ar3[n], i, j, k;
long long sum1 = 0, sum2 = 0, sum3 = 0;
for (i = 0; i < n; i++) {
cin >> ar1[i];
sum1 = sum1 + ar1[i];
}
for (i = 0; i < n - 1; i++) {
cin >> ar2[i];
sum2 = sum2 + ar2[i];
}
for (i = 0; i < n - 2; i++) {
cin >> ar3[i];
sum3 = sum3 + ar3[i];
}
cout << sum1 - sum2 << "\n" << sum2 - sum3;
}
|
#include <bits/stdc++.h>
using namespace std;
int main() {
int n, x;
cin >> n;
long a = 0, b = 0, c = 0;
for (int i = 0; i < n; i++) {
cin >> x;
a += x;
}
for (int i = 0; i < n - 1; i++) {
cin >> x;
b += x;
}
for (int i = 0; i < n - 2; i++) {
cin >> x;
c += x;
}
cout << a - b << endl;
cout << b - c;
return 0;
}
|
#include <bits/stdc++.h>
using namespace std;
map<long long int, long long int> cnt;
map<long long int, long long int> cnt2;
map<long long int, long long int> cnt3;
long long int num[100010];
long long int num2[100010];
int main() {
ios_base::sync_with_stdio(false);
cin.tie(0);
cout.tie(0);
;
long long int n, i, j, k, x, y, p;
cin >> n;
for (i = 1; i <= n; i++) {
cin >> num[i];
cnt[num[i]]++;
}
for (i = 1; i <= n - 1; i++) {
cin >> num2[i];
cnt2[num2[i]]++;
}
for (i = 1; i <= n; i++) {
if (cnt[num[i]] != cnt2[num[i]]) {
x = num[i];
break;
}
}
for (i = 1; i <= n - 2; i++) {
cin >> p;
cnt3[p]++;
}
for (i = 1; i <= n - 1; i++) {
if (cnt2[num2[i]] != cnt3[num2[i]]) {
y = num2[i];
break;
}
}
cout << x << endl << y;
return 0;
}
|
#include <bits/stdc++.h>
using namespace std;
int main() {
long long n, arr[2];
cin >> n;
vector<long long> a;
vector<long long> b;
vector<long long> c;
for (long long i = 0; i < n; i++) {
long long v;
cin >> v;
a.push_back(v);
}
sort(a.begin(), a.end());
for (long long i = 0; i < n - 1; i++) {
long long v;
cin >> v;
b.push_back(v);
}
sort(b.begin(), b.end());
for (long long i = 0; i < n - 2; i++) {
long long v;
cin >> v;
c.push_back(v);
}
sort(c.begin(), c.end());
for (long long i = 0; i < a.size(); i++) {
if (a[i] != b[i]) {
arr[0] = a[i];
break;
}
}
for (long long i = 0; i < b.size(); i++) {
if (b[i] != c[i]) {
arr[1] = b[i];
break;
}
}
cout << arr[0] << endl << arr[1] << endl;
return 0;
}
|
#include <bits/stdc++.h>
using namespace std;
int main() {
int x;
long long a = 0, r, b = 0, c = 0;
cin >> x;
for (int i = 0; i < x; i++) {
cin >> r;
a += r;
}
for (int i = 0; i < x - 1; i++) {
cin >> r;
b += r;
}
for (int i = 0; i < x - 2; i++) {
cin >> r;
c += r;
}
long long sum = a - b, sum1 = b - c;
cout << sum << endl;
cout << sum1 << endl;
return 0;
}
|
#include <bits/stdc++.h>
using namespace std;
const double PI =
3.14159265358979323846264338327950288419716939937510582097494459230;
bool comp(int a, int b) { return (a < b); }
int main() {
int n;
cin >> n;
vector<long long> v(n), v1(n - 1), v2(n - 2);
for (int i = 0; i < n; i++) cin >> v[i];
for (int i = 0; i < n - 1; i++) cin >> v1[i];
for (int i = 0; i < n - 2; i++) cin >> v2[i];
cout << accumulate(v.begin(), v.end(), 0) -
accumulate(v1.begin(), v1.end(), 0)
<< "\n"
<< accumulate(v1.begin(), v1.end(), 0) -
accumulate(v2.begin(), v2.end(), 0);
return 0;
}
|
#include <bits/stdc++.h>
using namespace std;
int main() {
int n;
while (cin >> n) {
long long sum1 = 0;
int a;
for (int i = 0; i < n; i++) {
scanf("%d", &a);
sum1 += a;
}
long long sum2 = 0;
for (int i = 0; i < n - 1; i++) {
scanf("%d", &a);
sum2 += a;
}
long long sum3 = 0;
for (int i = 0; i < n - 2; i++) {
scanf("%d", &a);
sum3 += a;
}
cout << sum1 - sum2 << endl;
cout << sum2 - sum3 << endl;
}
return 0;
}
|
#include <bits/stdc++.h>
using namespace std;
const int N = 2 * 1e5 + 10;
long long res;
long long a[N];
void solve() {
long long n, x;
cin >> n;
long long a = 0, b = 0, c = 0;
for (long long i = 0; i < n; i++) {
cin >> x;
a += x;
}
for (long long i = 0; i < n - 1; i++) {
cin >> x;
b += x;
}
for (long long i = 0; i < n - 2; i++) {
cin >> x;
c += x;
}
cout << a - b << "\n";
cout << b - c << "\n";
}
int main(int argc, char const *argv[]) {
ios_base::sync_with_stdio(0);
cin.tie(NULL);
cout.tie(NULL);
long long t = 1;
while (t--) {
solve();
}
return 0;
}
|
#include <bits/stdc++.h>
using namespace std;
int main() {
unsigned long long s = 0;
unsigned long long a, b, x;
long n;
cin >> n;
x = 0;
b = 0;
for (long i = 0; i < n; i++) {
cin >> a;
s = s + a;
}
for (long i = 0; i < (n - 1); i++) {
cin >> a;
x = x + a;
}
for (long i = 0; i < (n - 2); i++) {
cin >> a;
b = b + a;
}
cout << s - x << endl << x - b;
return 0;
}
|
#include <bits/stdc++.h>
using namespace std;
int main() {
int n;
cin >> n;
int pre_x = 0, x = 0, a;
for (int i = 0; i < 3; i++) {
if (i) pre_x = x;
x = 0;
for (int j = 0; j < n - i; j++) {
cin >> a;
x = x xor a;
}
if (i) cout << (pre_x xor x) << endl;
}
return 0;
}
|
#include <bits/stdc++.h>
using namespace std;
int main() {
int n, x, a = 0, b = 0, c = 0;
cin >> n;
for (int i = 0; i < n; i++) {
cin >> x;
a += x;
}
for (int j = 0; j < n - 1; j++) {
cin >> x;
b += x;
}
for (int k = 0; k < n - 2; k++) {
cin >> x;
c += x;
}
cout << a - b << endl;
cout << b - c << endl;
return 0;
}
|
#include <bits/stdc++.h>
using namespace std;
int main() {
int n, a[100005], b[100005], c[100005], ans = 0, res = 0, sum = 0;
cin >> n;
for (int i = 1; i <= n; i++) {
cin >> a[i];
ans += a[i];
}
for (int i = 1; i <= n - 1; i++) {
cin >> b[i];
res += b[i];
}
for (int i = 1; i <= n - 2; i++) {
cin >> c[i];
sum += c[i];
}
cout << ans - res << "\n" << res - sum;
}
|
#include <bits/stdc++.h>
int n;
int arr[3];
int main() {
scanf("%d", &n);
for (int i = 0; i < 3; i++) {
for (int j = n - 1; j >= i; j--) {
int num;
scanf("%d", &num);
arr[i] += num;
}
}
printf("%d\n", arr[0] - arr[1]);
printf("%d\n", arr[1] - arr[2]);
return 0;
}
|
#include <bits/stdc++.h>
using namespace std;
int main() {
int n, i;
cin >> n;
int a[n], a1[n - 1], a2[n - 1];
for (i = 0; i < n; i++) {
cin >> a[i];
}
for (i = 0; i < n - 1; i++) {
cin >> a1[i];
}
sort(a, a + n);
sort(a1, a1 + n - 1);
for (i = 0; i < n - 1; i++) {
if (a[i] != a1[i]) {
cout << a[i] << "\n";
a2[0] = a[i];
break;
}
}
if (i == n - 1) {
cout << a[n - 1] << "\n";
a2[0] = a[n - 1];
}
for (i = 1; i < n - 1; i++) {
cin >> a2[i];
}
sort(a2, a2 + n - 1);
for (i = 0; i < n - 1; i++) {
if (a[i] != a2[i]) {
cout << a[i] << "\n";
break;
}
}
if (i == n - 1) {
cout << a[n - 1] << "\n";
}
return 0;
}
|
#include <bits/stdc++.h>
using namespace std;
int main() {
ios_base::sync_with_stdio(false);
cin.tie(0);
int n;
cin >> n;
int a[n], b[n], c[n];
for (int i = 0; i < n; i++) {
cin >> a[i];
}
for (int i = 0; i < n - 1; i++) {
cin >> b[i];
}
for (int i = 0; i < n - 2; i++) {
cin >> c[i];
}
sort(a, a + n);
sort(b, b + n - 1);
sort(c, c + n - 2);
bool f = false;
bool s = false;
for (int i = 0; i < n - 1; i++) {
if (b[i] != a[i]) {
cout << a[i] << "\n";
f = true;
break;
}
}
if (!f) {
cout << a[n - 1] << "\n";
}
for (int i = 0; i < n - 2; i++) {
if (b[i] != c[i]) {
cout << b[i] << "\n";
s = true;
break;
}
}
if (!s) {
cout << b[n - 2] << "\n";
}
return 0;
}
|
#include <bits/stdc++.h>
using namespace std;
int main() {
ios::sync_with_stdio(0);
cin.tie(0);
cout.tie(0);
map<int, bool> mp;
int n, k;
cin >> n;
vector<int> v(n), v0(n - 1), v1(n - 2);
for (int i = 0; i < n; i++) {
cin >> v[i];
}
for (int i = 0; i < n - 1; i++) {
cin >> v0[i];
}
for (int i = 0; i < n - 2; i++) {
cin >> v1[i];
}
sort(v.begin(), v.end());
sort(v0.begin(), v0.end());
sort(v1.begin(), v1.end());
int g = 0;
for (int i = 0; i < n - 1; i++) {
if (v[i] != v0[i]) {
cout << v[i] << endl;
g = 1;
break;
}
}
if (g == 0) cout << v[v.size() - 1] << endl;
g = 0;
for (int i = 0; i < n - 2; i++) {
if (v1[i] != v0[i]) {
cout << v0[i] << endl;
g = 1;
break;
}
}
if (g == 0) cout << v0[v0.size() - 1] << endl;
}
|
#include <bits/stdc++.h>
using namespace std;
int main() {
long long int a, i, e = -1, f = -1;
cin >> a;
long long int b[a], c[a - 1], d[a - 2];
for (i = 0; i < a; i++) {
cin >> b[i];
}
sort(b, b + a);
for (i = 0; i < a - 1; i++) {
cin >> c[i];
}
sort(c, c + a - 1);
for (i = 0; i < a - 2; i++) {
cin >> d[i];
}
sort(d, d + a - 2);
for (i = 0; i < a - 1; i++) {
if (b[i] != c[i]) {
e = i;
break;
}
}
if (e >= 0)
cout << b[e] << endl;
else
cout << b[a - 1] << endl;
for (i = 0; i < a - 2; i++) {
if (c[i] != d[i]) {
f = i;
break;
}
}
if (f >= 0)
cout << c[f] << endl;
else
cout << c[a - 2] << endl;
}
|
#include <bits/stdc++.h>
using namespace std;
int main() {
int numbers;
cin >> numbers;
int arr[numbers];
int arr2[numbers - 1];
int arr3[numbers - 2];
for (int i = 0; i < numbers; i++) {
cin >> arr[i];
}
for (int k = 0; k < numbers - 1; k++) {
cin >> arr2[k];
}
for (int l = 0; l < numbers - 2; l++) {
cin >> arr3[l];
}
int count = 0;
int count1 = 0;
sort(arr, arr + numbers);
sort(arr2, arr2 + numbers - 1);
sort(arr3, arr3 + numbers - 2);
for (int s = 0; s < numbers - 1; s++) {
if (arr[s] == arr2[s]) {
count++;
continue;
} else {
cout << arr[s] << endl;
break;
}
}
if (count == numbers - 1) {
cout << arr[numbers - 1] << endl;
}
for (int a = 0; a < numbers - 2; a++) {
if (arr2[a] == arr3[a]) {
count1++;
continue;
} else {
cout << arr2[a];
break;
}
}
if (count1 == numbers - 2) {
cout << arr2[numbers - 2] << endl;
}
}
|
#include <bits/stdc++.h>
using namespace std;
int n, a[100001], b[100001], c[100001], x;
map<int, int> a1, b1, c1;
int main() {
srand(time(NULL));
cin >> n;
for (int i = 1; i <= n; ++i) cin >> a[i], a1[a[i]]++;
for (int i = 1; i < n; ++i) cin >> b[i], b1[b[i]]++, a1[b[i]]--;
for (int i = 1; i < n - 1; ++i) cin >> c[i], b1[c[i]]--;
for (int i = 1; i <= n; ++i)
if (a1[a[i]] != 0) cout << a[i] << endl, a1[a[i]]--;
for (int i = 1; i < n; ++i)
if (b1[b[i]] != 0) cout << b[i], b1[b[i]]--;
}
|
#include <bits/stdc++.h>
using namespace std;
const int maxn = 2e5;
const int mod = 1e8;
int n;
int a[maxn], b[maxn], c[maxn];
vector<int> ans;
map<int, int> used, used1, used2;
int main() {
ios_base::sync_with_stdio(0);
cin >> n;
for (int i = 1; i <= n; i++) cin >> a[i];
for (int i = 1; i <= n - 1; i++) cin >> b[i];
for (int i = 1; i <= n - 2; i++) cin >> c[i];
for (int i = 1; i <= n; i++) used[a[i]]++;
for (int i = 1; i <= n - 1; i++) used1[b[i]]++;
for (int i = 1; i <= n; i++)
if (used[a[i]] > used1[a[i]]) {
ans.push_back(a[i]);
break;
}
for (int i = 1; i <= n - 2; i++) used2[c[i]]++;
for (int i = 1; i <= n - 1; i++)
if (used1[b[i]] > used2[b[i]]) {
ans.push_back(b[i]);
break;
}
cout << ans[0] << '\n' << ans[1] << endl;
return 0;
}
|
#include <bits/stdc++.h>
using namespace std;
int main() {
int n, i, sum = 0, sum1 = 0, sum2 = 0;
cin >> n;
int arr[n];
int brr[n - 1];
int crr[n - 2];
for (i = 0; i < n; i++) {
cin >> arr[i];
sum += arr[i];
}
for (i = 0; i < n - 1; i++) {
cin >> brr[i];
sum1 += brr[i];
}
for (i = 0; i < n - 2; i++) {
cin >> crr[i];
sum2 += crr[i];
}
cout << sum - sum1 << endl;
cout << sum1 - sum2 << endl;
}
|
#include <bits/stdc++.h>
using namespace std;
void solve() {
int n;
cin >> n;
long long a[n], x;
unordered_map<long long, long long> checka, checkb, checkc;
for (int i = 0; i < n; i++) {
cin >> a[i];
checka[a[i]] += 1;
}
for (int i = 0; i < n - 1; i++) {
cin >> x;
checkb[x] += 1;
}
for (int i = 0; i < n - 2; i++) {
cin >> x;
checkc[x] += 1;
}
for (int i = 0; i < n; i++) {
if (checka[a[i]] != checkb[a[i]]) {
cout << a[i] << '\n';
break;
}
}
for (int i = 0; i < n; i++) {
if (checkb[a[i]] != checkc[a[i]]) {
cout << a[i];
break;
}
}
}
int32_t main() {
ios_base::sync_with_stdio(false);
cin.tie(NULL);
cout.tie(NULL);
int test = 1;
while (test--) {
solve();
cout << '\n';
}
return 0;
}
|
#include <bits/stdc++.h>
using namespace std;
int main() {
int n, t;
cin >> n;
int a = 0, b = 0, c = 0;
for (int i = 0; i < n; i++) {
cin >> t;
a += t;
}
for (int i = 0; i < n - 1; i++) {
cin >> t;
b += t;
}
for (int i = 0; i < n - 2; i++) {
cin >> t;
c += t;
}
cout << a - b << endl;
cout << b - c << endl;
return 0;
}
|
#include <bits/stdc++.h>
using namespace std;
int main() {
int n;
cin >> n;
vector<int> v1(n), v2(n - 1), v3(n - 2);
for (int i = 0; i < n; ++i) cin >> v1[i];
for (int i = 0; i < n - 1; ++i) cin >> v2[i];
for (int i = 0; i < n - 2; ++i) cin >> v3[i];
sort(v1.begin(), v1.end());
sort(v2.begin(), v2.end());
sort(v3.begin(), v3.end());
int x1 = 0, x2 = 0;
for (int i = 0; i < n - 1; ++i)
if (v1[i] != v2[i]) {
x1 = v1[i];
break;
}
if (!x1) x1 = v1[n - 1];
for (int i = 0; i < n - 2; ++i)
if (v3[i] != v2[i]) {
x2 = v2[i];
break;
}
if (!x2) x2 = v2[n - 2];
cout << x1 << endl;
cout << x2 << endl;
}
|
#include <bits/stdc++.h>
using namespace std;
int main() {
int n, q, w;
cin >> n;
vector<int> a, b, c;
for (int i = 0; i < n; i++) {
int x;
cin >> x;
a.push_back(x);
}
for (int i = 0; i < n - 1; i++) {
int x;
cin >> x;
b.push_back(x);
}
for (int i = 0; i < n - 2; i++) {
int x;
cin >> x;
c.push_back(x);
}
sort(a.begin(), a.end());
sort(b.begin(), b.end());
sort(c.begin(), c.end());
int z = 0;
for (int i = 0; i < b.size(); i++) {
if (a[i] != b[i]) {
cout << a[i] << endl;
z = 1;
break;
}
}
if (z == 0) cout << a[a.size() - 1] << endl;
z = 0;
for (int i = 0; i < c.size(); i++) {
if (b[i] != c[i]) {
cout << b[i] << endl;
z = 1;
break;
}
}
if (z == 0) cout << b[b.size() - 1] << endl;
}
|
#include <bits/stdc++.h>
int main() {
int a[100000], b[100000], c[100000], n, i, s1 = 0, s2 = 0, s3 = 0;
scanf("%d", &n);
for (i = 0; i < n; i++) {
scanf("%d", &a[i]);
s1 += a[i];
}
for (i = 0; i < n - 1; i++) {
scanf("%d", &b[i]);
s2 += b[i];
}
for (i = 0; i < n - 2; i++) {
scanf("%d", &c[i]);
s3 += c[i];
}
printf("%d\n", s1 - s2);
printf("%d\n", s2 - s3);
}
|
#include <bits/stdc++.h>
using namespace std;
int main() {
int n;
cin >> n;
long long int x, sum1 = 0, sum2 = 0, sum3 = 0;
for (int i = 0; i < n; i++) {
cin >> x;
sum1 += x;
}
for (int i = 0; i < n - 1; i++) {
cin >> x;
sum2 += x;
}
for (int i = 0; i < n - 2; i++) {
cin >> x;
sum3 += x;
}
cout << sum1 - sum2 << endl;
cout << sum2 - sum3 << endl;
return 0;
}
|
#include <bits/stdc++.h>
using namespace std;
const int MAX_n = 1e5 + 2;
long long int n, a[MAX_n], b[MAX_n], c[MAX_n];
int main() {
cin >> n;
for (int i = 0; i < n; i++) {
cin >> a[i];
}
for (int i = 0; i < n - 1; i++) {
cin >> b[i];
}
for (int i = 0; i < n - 2; i++) {
cin >> c[i];
}
sort(a, a + n);
sort(b, b + n - 1);
sort(c, c + n - 2);
for (int i = 0; i < n; i++) {
if (a[i] != b[i]) {
cout << a[i] << endl;
break;
}
}
for (int i = 0; i < n - 1; i++) {
if (c[i] != b[i]) {
cout << b[i];
break;
}
}
return 0;
}
|
#include <bits/stdc++.h>
using namespace std;
int a, b, c;
int n;
int main() {
cin >> n;
int t;
for (int i = 0; i < (int)n; i++) {
scanf("%ld", &t);
a += t;
}
for (int i = 0; i < (int)n - 1; i++) {
scanf("%ld", &t);
b += t;
}
cout << a - b << endl;
for (int i = 0; i < (int)n - 2; i++) {
scanf("%ld", &t);
c += t;
}
cout << b - c;
return 0;
}
|
#include <bits/stdc++.h>
using namespace std;
int main() {
long long int n, i, j, k;
vector<long long int> a1, a2, a3;
cin >> n;
for (i = 0; i < n; i++) {
int x;
cin >> x;
a1.push_back(x);
}
sort(a1.begin(), a1.end());
for (i = 0; i < n - 1; i++) {
int x;
cin >> x;
a2.push_back(x);
}
sort(a2.begin(), a2.end());
for (i = 0; i < n - 2; i++) {
int x;
cin >> x;
a3.push_back(x);
}
sort(a3.begin(), a3.end());
for (i = 0; i < n - 1; i++) {
for (j = i; j < n; j++) {
if (a2[i] == a1[j] && a1[j] != 0) {
a1[j] = 0;
break;
}
}
}
for (i = 0; i < n; i++) {
if (a1[i] != 0) cout << a1[i] << endl;
}
for (i = 0; i < n - 2; i++) {
for (j = i; j < n - 1; j++) {
if (a3[i] == a2[j] && a2[j] != 0) {
a2[j] = 0;
break;
}
}
}
for (i = 0; i < n - 1; i++) {
if (a2[i] != 0) cout << a2[i] << endl;
}
return 0;
}
|
#include <bits/stdc++.h>
using namespace std;
int n, cntr = 0;
;
priority_queue<int> V1, V2, V3, V4;
int main() {
cin >> n;
for (int i = 0, a; i < n; i++) {
cin >> a;
V1.push(a);
}
for (int i = 0, a; i < n - 1; i++) {
cin >> a;
V2.push(a);
V4.push(a);
}
for (int i = 0, a; i < n - 2; i++) {
cin >> a;
V3.push(a);
}
for (int i = 0; i < n - 1; i++)
if (V1.top() == V2.top()) {
V1.pop();
V2.pop();
}
cout << V1.top() << endl;
for (int i = 0; i < n - 2; i++)
if (V4.top() == V3.top()) {
V4.pop();
V3.pop();
}
cout << V4.top() << endl;
return 0;
}
|
#include <bits/stdc++.h>
int main() {
int i, j, k, l, sum1 = 0, sum2 = 0, sum3 = 0, n;
scanf("%d", &n);
int ara[n];
int ar[n - 1];
int a[n - 2];
for (i = 0; i < n; i++) {
scanf("%d", &ara[i]);
sum1 = sum1 + ara[i];
}
for (i = 0; i < n - 1; i++) {
scanf("%d", &ar[i]);
sum2 = sum2 + ar[i];
}
for (i = 0; i < n - 2; i++) {
scanf("%d", &a[i]);
sum3 = sum3 + a[i];
}
printf("%d\n", (sum1 - sum2));
printf("%d", (sum2 - sum3));
return 0;
}
|
#include <bits/stdc++.h>
using namespace std;
int main() {
ios::sync_with_stdio(false);
cout.tie(NULL);
cin.tie(NULL);
long long n;
cin >> n;
map<int, int> mp1;
map<int, int> mp2;
map<int, int> mp3;
for (long long i = 0; i < n; i++) {
long long x;
cin >> x;
mp1[x]++;
}
for (long long i = 0; i < n - 1; i++) {
long long x;
cin >> x;
mp2[x]++;
if (mp1[x]) {
mp1[x]--;
if (mp1[x] <= 0) {
mp1.erase(x);
}
}
}
for (long long i = 0; i < n - 2; i++) {
long long x;
cin >> x;
mp3[x]++;
if (mp2[x]) {
mp2[x]--;
if (mp2[x] <= 0) {
mp2.erase(x);
}
}
}
auto it = mp1.begin();
cout << it->first << endl;
it = mp2.begin();
cout << it->first << endl;
}
|
#include <bits/stdc++.h>
using namespace std;
int main() {
long long s1 = 0, s2 = 0, s3 = 0, num;
int n;
cin >> n;
for (int i = 0; i < n; i++) {
cin >> num;
s1 += num;
}
for (int i = 1; i < n; i++) {
cin >> num;
s2 += num;
}
for (int i = 2; i < n; i++) {
cin >> num;
s3 += num;
}
cout << s1 - s2 << endl;
cout << s2 - s3;
}
|
#include <bits/stdc++.h>
using namespace std;
int main() {
int n;
cin >> n;
vector<int> v, mis, vis;
for (int i = 0, x; i < n; i++) {
cin >> x;
v.push_back(x);
}
sort(v.begin(), v.end());
for (int i = 0, x; i < n - 1; i++) {
cin >> x;
mis.push_back(x);
}
for (int i = 0, x; i < n - 2; i++) {
cin >> x;
vis.push_back(x);
}
sort(mis.begin(), mis.end());
sort(vis.begin(), vis.end());
int i;
for (i = 0; i < n; i++) {
if (v[i] - mis[i] != 0) break;
}
cout << v[i] << "\n";
v.erase(v.begin() + i);
for (i = 0; i < n - 1; i++) {
if (v[i] - vis[i] != 0) break;
}
cout << v[i] << "\n";
return 0;
}
|
#include <bits/stdc++.h>
using namespace std;
int n, a[100005], b[100005], c[100005], first;
int main() {
cin >> n;
for (int i = 1; i <= n; i++) {
cin >> a[i];
}
sort(a + 1, a + n + 1);
n--;
for (int i = 1; i <= n; i++) {
cin >> b[i];
}
sort(b + 1, b + n + 1);
n--;
for (int i = 1; i <= n; i++) {
cin >> c[i];
}
n += 2;
int i = 1;
while (a[i] == b[i]) {
i++;
}
first = a[i];
cout << a[i] << '\n';
c[n - 1] = first;
sort(c + 1, c + n);
i = 1;
while (a[i] == c[i]) {
i++;
}
cout << a[i];
}
|
#include <bits/stdc++.h>
using namespace std;
bool compare(pair<pair<long long int, long long int>, long long int> p1,
pair<pair<long long int, long long int>, long long int> p2) {
return p1.first.first < p2.first.first;
}
int main() {
ios_base::sync_with_stdio(0);
cin.tie(NULL);
cout.tie(NULL);
long long int n, i;
multiset<long long int> s, s1, s2;
cin >> n;
long long int a[n + 1], b[n], c[n - 1], ans;
for (i = 1; i <= n; i++) {
cin >> a[i];
s.insert(a[i]);
}
for (i = 1; i <= n - 1; i++) {
cin >> b[i];
s1.insert(b[i]);
}
for (i = 1; i <= n; i++) {
if (s1.count(a[i]) != s.count(a[i])) {
cout << a[i] << "\n";
ans = a[i];
break;
}
}
for (i = 1; i <= n - 2; i++) {
cin >> c[i];
s2.insert(c[i]);
}
s2.insert(ans);
for (i = 1; i <= n; i++) {
if (s2.count(a[i]) != s.count(a[i])) {
cout << a[i] << "\n";
break;
}
}
return 0;
}
|
#include <bits/stdc++.h>
using namespace std;
int main() {
int n;
cin >> n;
int a[n], b[n - 1], c[n - 2], ch = 0;
for (int i = 0; i < n; i++) cin >> a[i];
sort(a, a + n);
for (int i = 0; i < n - 1; i++) cin >> b[i];
sort(b, b + (n - 1));
for (int j = 0; j < n - 1; j++) {
if (a[j] != b[j]) {
cout << a[j] << endl;
ch = 1;
break;
}
}
if (ch != 1) cout << a[n - 1] << endl;
ch = 0;
for (int i = 0; i < n - 2; i++) cin >> c[i];
sort(c, c + (n - 2));
for (int j = 0; j < n - 2; j++) {
if (b[j] != c[j]) {
cout << b[j] << endl;
ch = 1;
break;
}
}
if (ch != 1) cout << b[n - 2] << endl;
}
|
#include <bits/stdc++.h>
using namespace std;
int main() {
int a;
cin >> a;
vector<int> b(a);
vector<int> c(a - 1);
vector<int> d(a - 2);
for (int i = 0; i < b.size(); i++) {
cin >> b[i];
}
for (int i = 0; i < c.size(); i++) {
cin >> c[i];
}
for (int i = 0; i < d.size(); i++) {
cin >> d[i];
}
sort(b.begin(), b.end());
sort(c.begin(), c.end());
sort(d.begin(), d.end());
bool x = false;
for (int i = 0; i < c.size(); i++) {
if (b[i] != c[i]) {
cout << b[i] << "\n";
x = true;
break;
}
}
if (!x) cout << b[b.size() - 1] << "\n";
x = false;
for (int i = 0; i < d.size(); i++) {
if (c[i] != d[i]) {
cout << c[i] << "\n";
x = true;
break;
}
}
if (!x) cout << c[c.size() - 1] << "\n";
}
|
#include <bits/stdc++.h>
using namespace std;
long long search(int *arr, int cost, long long n) {
for (int i = n - 1; i > -1; i--) {
if (cost >= arr[i]) {
return i + 1;
}
}
return 0;
}
int main() {
long long n;
cin >> n;
unordered_map<int, int> amp;
int *arr = new int[n];
for (int i = 0; i < n; i++) {
int x = 0;
cin >> arr[i];
}
sort(arr, arr + n);
int *arr1 = new int[n - 1];
for (int i = 0; i < n - 1; ++i) {
cin >> arr1[i];
}
sort(arr1, arr1 + n - 1);
for (int i = 0; i < n; ++i) {
if (arr[i] != arr1[i] && i < n - 1) {
cout << arr[i] << endl;
break;
}
if (i == n - 1) {
cout << arr[i] << endl;
}
}
int *arr2 = new int[n - 2];
for (int i = 0; i < n - 2; ++i) {
cin >> arr2[i];
}
sort(arr2, arr2 + n - 2);
for (int i = 0; i < n - 1; ++i) {
if (arr1[i] != arr2[i] && i < n - 2) {
cout << arr1[i] << endl;
break;
}
if (i == n - 2) {
cout << arr1[i] << endl;
}
}
}
|
#include <bits/stdc++.h>
int main() {
int a, i, sum1 = 0, sum2 = 0, sum3 = 0, n;
scanf("%d", &n);
for (i = 1; i <= n; i++) {
scanf("%d", &a);
sum1 += a;
}
for (i = 1; i <= n - 1; i++) {
scanf("%d", &a);
sum2 += a;
}
for (i = 1; i <= n - 2; i++) {
scanf("%d", &a);
sum3 += a;
}
printf("%d\n%d", sum1 - sum2, sum2 - sum3);
}
|
#include <bits/stdc++.h>
using namespace std;
int main() {
int n;
scanf("%d", &n);
int a[n], b[n], c[n], one, two;
for (int i = 0; i < n; i++) {
scanf("%d", &a[i]);
}
sort(a, a + n);
for (int i = 0; i < n - 1; i++) {
scanf("%d", &b[i]);
}
b[n - 1] = 0;
sort(b, b + (n - 1));
for (int i = 0; i < n - 2; i++) {
scanf("%d", &c[i]);
}
c[n - 2] = 0;
c[n - 1] = 0;
sort(c, c + (n - 2));
for (int i = 0; i < n; i++) {
if (a[i] != b[i]) {
one = a[i];
break;
}
}
for (int i = 0; i < n; i++) {
if (c[i] != b[i]) {
two = b[i];
break;
}
}
cout << one << endl << two;
}
|
#include <bits/stdc++.h>
using namespace std;
int main() {
int n;
cin >> n;
int sum = 0, sum1 = 0, sum2 = 0;
int a[n], b[n], c[n];
for (int i = 0; i < n; i++) {
cin >> a[i];
sum += a[i];
}
for (int i = 0; i < n - 1; i++) {
cin >> b[i];
sum1 += b[i];
}
for (int i = 0; i < n - 2; i++) {
cin >> c[i];
sum2 += c[i];
}
cout << sum - sum1 << endl;
cout << sum1 - sum2 << endl;
}
|
#include <bits/stdc++.h>
using namespace std;
int main() {
long int n;
cin >> n;
long int a[n], b[n - 1], c[n - 2], x1, x2;
for (long int i = 0; i < n; i++) {
cin >> a[i];
}
sort(a, a + n);
for (long int i = 0; i < n - 1; i++) {
cin >> b[i];
}
sort(b, b + n - 1);
for (long int i = 0; i < n - 1; i++) {
if (a[i] != b[i]) {
x1 = a[i];
goto yy;
}
}
x1 = a[n - 1];
yy:
for (long int i = 0; i < n - 2; i++) cin >> c[i];
sort(c, c + n - 2);
for (long int i = 0; i < n - 2; i++) {
if (b[i] != c[i]) {
x2 = b[i];
goto pp;
}
}
x2 = b[n - 2];
pp:
cout << x1 << endl << x2;
return 0;
}
|
#include <bits/stdc++.h>
using namespace std;
int main() {
long long n, a, b, c, s1 = 0, s2 = 0, s3 = 0;
cin >> n;
for (int i = 0; i < n; i++) {
cin >> a;
s1 += a;
}
for (int i = 0; i < n - 1; i++) {
cin >> b;
s2 += b;
}
for (int i = 0; i < n - 2; i++) {
cin >> c;
s3 += c;
}
cout << s1 - s2 << endl;
cout << s2 - s3 << endl;
return 0;
}
|
#include <bits/stdc++.h>
using namespace std;
int main() {
ios_base::sync_with_stdio(0);
cin.tie(0);
long n, aux, e;
cin >> n;
map<long, pair<int, int> > errors;
for (long i = 0; i < n; ++i) {
cin >> aux;
errors[aux].first += 1;
errors[aux].second += 1;
}
for (long i = 0; i < n - 1; ++i) {
cin >> aux;
errors[aux].first -= 1;
}
for (auto it = errors.begin(); it != errors.end(); ++it)
if ((it->second).first) {
cout << it->first;
it->second.second -= 1;
break;
}
for (long i = 0; i < n - 2; ++i) {
cin >> aux;
errors[aux].second -= 1;
}
for (auto it = errors.begin(); it != errors.end(); ++it)
if ((it->second).second) {
cout << '\n' << it->first;
break;
}
return 0;
}
|
#include <bits/stdc++.h>
using namespace std;
int main() {
int n, a, s[3] = {};
cin >> n;
int x = 3;
for (int i = 0; i < 3; i++)
for (int j = 0; j < n - i; j++) {
cin >> a;
s[i] += a;
}
cout << s[0] - s[1] << endl;
cout << s[1] - s[2] << endl;
return (0);
}
|
#include <bits/stdc++.h>
using namespace std;
long long a, b, maks, counter, total_1, total_2, total_3;
int main() {
cin >> a;
for (int i = 0; i < a; i++) {
cin >> b;
total_1 = total_1 + b;
}
for (int i = 0; i < a - 1; i++) {
cin >> b;
total_2 = total_2 + b;
}
for (int i = 0; i < a - 2; i++) {
cin >> b;
total_3 = total_3 + b;
}
cout << total_1 - total_2 << endl;
cout << total_2 - total_3;
}
|
#include <bits/stdc++.h>
using namespace std;
int main() {
int N;
scanf("%d", &N);
long long Suma = 0;
long long SumaCheck = 0;
for (int i = 0; i < N; i++) {
long long temp;
scanf("%I64d", &temp);
Suma += temp;
}
for (int i = 0; i < N - 1; i++) {
long long temp;
scanf("%I64d", &temp);
SumaCheck += temp;
}
printf("%I64d\n", Suma - SumaCheck);
Suma = SumaCheck;
SumaCheck = 0;
for (int i = 0; i < N - 2; i++) {
long long temp;
scanf("%I64d", &temp);
SumaCheck += temp;
}
printf("%I64d", Suma - SumaCheck);
return 0;
}
|
#include <bits/stdc++.h>
using namespace std;
long long n;
map<long long, long long> cnt;
map<long long, long long>::iterator it;
long long a[100005];
signed main() {
ios_base::sync_with_stdio(false);
cin.tie(0);
cin >> n;
for (long long i = 1; i <= n; i++) {
long long t;
cin >> t;
cnt[t]++;
}
for (long long i = 1; i <= n - 1; i++) {
long long t;
cin >> t;
cnt[t]--;
a[i] = t;
}
for (it = cnt.begin(); it != cnt.end(); it++)
if (it->second) cout << it->first << '\n';
cnt.clear();
for (long long i = 1; i <= n - 1; i++) cnt[a[i]]++;
for (long long i = 1; i <= n - 2; i++) {
long long t;
cin >> t;
cnt[t]--;
}
for (it = cnt.begin(); it != cnt.end(); it++)
if (it->second) cout << it->first << '\n';
}
|
#include <bits/stdc++.h>
using namespace std;
int main() {
int n, x, y, cnt1 = 0, cnt2 = 0;
cin >> n;
int arr[n];
int arr1[n - 1];
int arr2[n - 2];
for (int i = 0; i < n; i++) {
cin >> arr[i];
}
for (int i = 0; i < n - 1; i++) {
cin >> arr1[i];
}
for (int i = 0; i < n - 2; i++) {
cin >> arr2[i];
}
sort(arr, arr + n);
sort(arr1, arr1 + n - 1);
sort(arr2, arr2 + n - 2);
for (int i = 0; i < n - 1; i++) {
if (arr1[i] != arr[i]) {
x = arr[i];
cnt1++;
break;
}
}
if (cnt1 == 0) x = arr[n - 1];
for (int i = 0; i < n - 2; i++) {
if (arr1[i] != arr2[i]) {
y = arr1[i];
cnt2++;
break;
}
}
if (cnt2 == 0) y = arr1[n - 2];
cout << x << endl << y;
return 0;
}
|
#include <bits/stdc++.h>
using namespace std;
int main() {
ios_base::sync_with_stdio(0);
cin.tie(0);
int n;
cin >> n;
map<string, int> arr;
map<string, int> arr2;
vector<string> v;
for (int i = 0; i < n; i++) {
string tmp;
cin >> tmp;
v.push_back(tmp);
arr[tmp]++;
}
for (int i = 0; i < n - 1; i++) {
string tmp;
cin >> tmp;
arr2[tmp]++;
arr[tmp]--;
}
for (int i = 0; i < n - 2; i++) {
string tmp;
cin >> tmp;
arr2[tmp]--;
}
bool done1 = 0, done2 = 0;
string fst, sec;
for (int i = 0; i < n; i++) {
if (arr[v[i]]) {
fst = v[i];
done1 = 1;
}
if (arr2[v[i]]) {
sec = v[i];
done2 = 1;
}
if (done1 && done2) break;
}
cout << fst << endl << sec << endl;
return 0;
}
|
#include <bits/stdc++.h>
using namespace std;
unordered_map<int, int> errors;
void get_codes(unordered_map<int, int>& quantity, int cnt, int inc) {
for (int i = 0; i < cnt; i++) {
int code;
cin >> code;
quantity[code] += inc;
}
}
int main() {
ios_base::sync_with_stdio(0);
int bugs;
cin >> bugs;
get_codes(errors, bugs, 1);
get_codes(errors, bugs - 1, -3);
for (auto it = errors.begin(); it != errors.end(); ++it) {
if ((it->second) % 2 != 0) {
cout << (it->first) << '\n';
(it->second) -= 1;
}
}
get_codes(errors, bugs - 2, 2);
for (auto it = errors.begin(); it != errors.end(); ++it)
if ((it->second) != 0) cout << (it->first) << '\n';
}
|
#include <bits/stdc++.h>
using namespace std;
int main() {
int t, x, y, z, a, b, sum = 0, sum1 = 0, sum2 = 0;
cin >> t;
a = t - 1;
b = t - 2;
for (int i = 0; i < t; i++) {
cin >> x;
sum += x;
}
for (int i = 0; i < a; i++) {
cin >> y;
sum1 += y;
}
for (int i = 0; i < b; i++) {
cin >> z;
sum2 += z;
}
cout << sum - sum1 << endl;
cout << sum1 - sum2 << endl;
return 0;
}
|
#include <bits/stdc++.h>
using namespace std;
int main() {
int n;
cin >> n;
map<int, int> a, b;
for (int i = 0; i < n; i++) {
int t;
cin >> t;
if (a.find(t) == a.end())
a[t] = 1;
else
a[t]++;
}
for (int i = 0; i < n - 1; i++) {
int t;
cin >> t;
a[t]--;
if (a[t] == 0) a.erase(t);
if (b.find(t) == b.end())
b[t] = 1;
else
b[t]++;
}
cout << a.begin()->first << endl;
for (int i = 0; i < n - 2; i++) {
int t;
cin >> t;
b[t]--;
if (b[t] == 0) b.erase(t);
}
cout << b.begin()->first << endl;
return 0;
}
|
#include <bits/stdc++.h>
using namespace std;
int main(void) {
int n;
cin >> n;
int x;
int first_error = 0;
int second_error = 0;
int first_sum = 0;
int second_sum = 0;
int third_sum = 0;
for (int i = 0; i < n; i++) {
cin >> x;
first_sum += x;
}
for (int i = 0; i < n - 1; i++) {
cin >> x;
second_sum += x;
}
for (int i = 0; i < n - 2; i++) {
cin >> x;
third_sum += x;
}
first_error = first_sum - second_sum;
second_error = second_sum - third_sum;
cout << first_error << endl;
cout << second_error << endl;
return 0;
}
|
#include <bits/stdc++.h>
#pragma warning(disable : 4996)
using namespace std;
int main() {
int n;
scanf("%d", &n);
map<int, int> Errors;
vector<int> Nums(n);
for (int i = 0; i < n; i++) {
int num;
scanf("%d", &num);
Nums[i] = num;
Errors[num]++;
}
for (int i = 0; i < n - 1; i++) {
int num;
scanf("%d", &num);
Errors[num]--;
}
int first = 0;
for (map<int, int>::iterator it = Errors.begin(); it != Errors.end(); it++) {
if ((*it).second == 1) {
first = (*it).first;
printf("%d\n", (*it).first);
(*it).second--;
break;
}
}
bool b = true;
for (int i = 0; i < n; i++) {
if (Nums[i] == first && b) {
b = false;
} else
Errors[Nums[i]]++;
}
for (int i = 0; i < n - 2; i++) {
int num;
scanf("%d", &num);
Errors[num]--;
}
for (map<int, int>::iterator it = Errors.begin(); it != Errors.end(); it++) {
if ((*it).second == 1) {
printf("%d", (*it).first);
break;
}
}
return 0;
}
|
#include <bits/stdc++.h>
int main() {
int n;
int a;
long long int sum1, sum2, sum3;
sum1 = sum2 = sum3 = 0;
std::cin >> n;
for (int i = 0; i < n; i++) {
std::cin >> a;
sum1 += a;
}
for (int i = 0; i < n - 1; i++) {
std::cin >> a;
sum2 += a;
}
for (int i = 0; i < n - 2; i++) {
std::cin >> a;
sum3 += a;
}
std::cout << (sum1 - sum2) << std::endl << (sum2 - sum3);
return 0;
}
|
#include <bits/stdc++.h>
using namespace std;
const int INF = 2e9;
const int mod = 1e9 + 7;
const long long int LONGINF = 4e9;
const double eps = 1e-9;
void solve(int n) {
map<int, int> m1, m2;
int i, a;
for (i = 0; i < (n); i++) {
scanf("%d", &a);
m1[a]++;
}
for (i = 0; i < (n - 1); i++) {
scanf("%d", &a);
m2[a]++;
m1[a]--;
if (m1[a] == 0) {
m1.erase(a);
}
}
for (i = 0; i < (n - 2); i++) {
scanf("%d", &a);
m2[a]--;
if (m2[a] == 0) m2.erase(a);
}
printf("%d\n%d", m1.begin()->first, m2.begin()->first);
}
int main() {
#pragma comment(linker, "/STACK:268435456")
int n;
long long int a;
char c[200200];
string s;
while (scanf("%d", &n) == 1) solve(n);
return 0;
}
|
#include <bits/stdc++.h>
using namespace std;
long int a, s1, s2, s3, n;
int main() {
cin >> n;
for (int i = 0; i < n; i++) {
cin >> a;
s1 += a;
}
for (int i = 0; i < n - 1; i++) {
cin >> a;
s2 += a;
}
for (int i = 0; i < n - 2; i++) {
cin >> a;
s3 += a;
}
cout << s1 - s2 << endl << s2 - s3 << endl;
return 0;
}
|
#include <bits/stdc++.h>
using namespace std;
int main() {
int n, i, a;
cin >> n;
long long int d = 0, e = 0, f = 0;
for (i = 0; i < n; i++) {
cin >> a;
d += a;
}
for (i = 0; i < n - 1; i++) {
cin >> a;
e += a;
}
for (i = 0; i < n - 2; i++) {
cin >> a;
f += a;
}
cout << d - e << endl << e - f;
return 0;
}
|
#include <bits/stdc++.h>
using namespace std;
int main() {
int n, k;
cin >> n;
long int a = 0, b = 0, c = 0;
for (int i = 0; i < n; i++) {
cin >> k;
a = a + k;
}
for (int i = 0; i < n - 1; i++) {
cin >> k;
b = b + k;
}
for (int i = 0; i < n - 2; i++) {
cin >> k;
c = c + k;
}
cout << a - b << endl << b - c;
return 0;
}
|
#include <bits/stdc++.h>
using namespace std;
map<int, int> m;
int A[100005];
int B[100005];
int C[100005];
vector<int> v;
int main() {
int N;
int a1, a2;
scanf("%d", &N);
int i;
for (i = 0; i < N; i++) scanf("%d", A + i);
for (i = 0; i < N - 1; i++) scanf("%d", B + i);
for (i = 0; i < N - 2; i++) scanf("%d", C + i);
for (i = 0; i < N - 2; i++) m[C[i]]++;
for (i = 0; i < N - 1; i++) {
m[B[i]]--;
if (m[B[i]] == -1) a2 = B[i];
}
m[a2] = 0;
for (i = 0; i < N - 1; i++) m[B[i]]++;
for (i = 0; i < N; i++) {
m[A[i]]--;
if (m[A[i]] == -1) a1 = A[i];
}
printf("%d\n%d\n", a1, a2);
return 0;
}
|
#include <bits/stdc++.h>
using namespace std;
int main() {
int n;
cin >> n;
int a[n], sum = 0, sum1 = 0, sum2 = 0, s = 0, s1 = 0;
for (int i = 0; i < n; i++) {
cin >> a[i];
sum += a[i];
}
for (int i = 0; i < n - 1; i++) {
cin >> a[i];
sum1 += a[i];
}
for (int i = 0; i < n - 2; i++) {
cin >> a[i];
sum2 += a[i];
}
s = abs(sum - sum1);
s1 = abs(sum1 - sum2);
cout << s << endl << s1;
return 0;
}
|
#include <bits/stdc++.h>
using namespace std;
int main() {
int n, i, sum1, sum2, sum3, first;
sum1 = sum2 = sum3 = 0;
scanf("%d", &n);
for (i = 1; i <= n; i++) {
scanf("%d", &first);
sum1 += first;
}
for (i = 1; i < n; i++) {
scanf("%d", &first);
sum2 += first;
}
for (i = 1; i < n - 1; i++) {
scanf("%d", &first);
sum3 += first;
}
printf("%d\n%d\n", sum1 - sum2, sum2 - sum3);
return 0;
}
|
#include <bits/stdc++.h>
using namespace std;
int main(void) {
;
int n, t;
long long a, b, c;
cin >> n;
a = b = c = 0LL;
for (int i = 0; i < n; i++) {
cin >> t;
a += t;
}
for (int i = 0; i < n - 1; i++) {
cin >> t;
b += t;
}
for (int i = 0; i < n - 2; i++) {
cin >> t;
c += t;
}
cout << a - b << endl;
cout << b - c << endl;
return 0;
}
|
#include <bits/stdc++.h>
int main() {
int32_t n;
std::cin >> n;
int32_t t1 = 0;
for (int32_t i = 0; i < n; i++) {
int32_t value;
std::cin >> value;
t1 += value;
}
int32_t t2 = 0;
for (int32_t i = 0; i < n - 1; i++) {
int32_t value;
std::cin >> value;
t2 += value;
}
int32_t t3 = 0;
for (int32_t i = 0; i < n - 2; i++) {
int32_t value;
std::cin >> value;
t3 += value;
}
std::cout << t1 - t2 << std::endl;
std::cout << t2 - t3 << std::endl;
return 0;
}
|
#include <bits/stdc++.h>
using namespace std;
void solve() {
long long int n, m, x, y, i, j, ans = 0, c = 0, sum = 0;
cin >> n;
unordered_map<long long int, long long int> mp;
for (i = 0; i < n; i++) {
cin >> x;
sum += x;
}
long long int sumb = 0;
for (i = 0; i < n - 1; i++) {
cin >> x;
sumb += x;
}
cout << sum - sumb << "\n";
sum = 0;
for (i = 0; i < n - 2; i++) {
cin >> x;
sum += x;
}
cout << sumb - sum << "\n";
}
int main() {
ios_base::sync_with_stdio(0);
cin.tie(0);
cout.tie(0);
int t;
t = 1;
while (t--) {
solve();
}
return 0;
}
|
#include <bits/stdc++.h>
using namespace std;
int main() {
vector<long long int> v1, v2, v3;
unsigned int n;
long long int x;
cin >> n;
for (int i = 0; i < n; i++) {
cin >> x;
v1.push_back(x);
}
for (int i = 0; i < (n - 1); i++) {
cin >> x;
v2.push_back(x);
}
for (int i = 0; i < (n - 2); i++) {
cin >> x;
v3.push_back(x);
}
sort(v1.begin(), v1.end());
sort(v2.begin(), v2.end());
sort(v3.begin(), v3.end());
for (int i = 0; i < n; i++) {
if (v1[i] != v2[i]) {
cout << v1[i] << endl;
break;
}
}
for (int i = 0; i < (n - 1); i++) {
if (v2[i] != v3[i]) {
cout << v2[i] << endl;
break;
}
}
return 0;
}
|
#include <bits/stdc++.h>
using namespace std;
int main() {
int no1, no2, i, n, a[100000], b[100000], c[100000];
cin >> n;
for (i = 0; i < n; i++) cin >> a[i];
for (i = 0; i < n - 1; i++) cin >> b[i];
for (i = 0; i < n - 2; i++) cin >> c[i];
sort(a, a + n);
sort(b, b + n - 1);
sort(c, c + n - 2);
for (i = 0; i < n; i++) {
if (a[i] != b[i]) {
no1 = a[i];
break;
}
}
for (i = 0; i < n - 1; i++) {
if (b[i] != c[i]) {
no2 = b[i];
break;
}
}
cout << no1 << endl;
cout << no2;
return 0;
}
|
#include <bits/stdc++.h>
int main() {
int n, tmp, a, b, i;
long long int sm = 0, tmp1;
scanf("%d", &n);
for (i = 1; i <= n; i++) {
scanf("%d", &tmp);
sm += tmp;
}
tmp1 = sm;
sm = 0;
for (i = 1; i <= n - 1; i++) {
scanf("%d", &tmp);
sm += tmp;
}
a = tmp1 - sm;
tmp1 = sm;
sm = 0;
for (i = 1; i <= n - 2; i++) {
scanf("%d", &tmp);
sm += tmp;
}
b = tmp1 - sm;
printf("%d\n%d", a, b);
return 0;
}
|
#include <bits/stdc++.h>
using namespace std;
int32_t main() {
long long n, temp;
cin >> n;
vector<long long> v, v1, v2;
for (long long i = 1; i <= n; ++i) {
cin >> temp;
v.push_back(temp);
}
sort(v.begin(), v.end());
for (long long i1 = 1; i1 <= n - 1; ++i1) {
cin >> temp;
v1.push_back(temp);
}
sort(v1.begin(), v1.end());
for (long long i2 = 1; i2 <= n - 2; ++i2) {
cin >> temp;
v2.push_back(temp);
}
sort(v2.begin(), v2.end());
for (long long j = 0; j < n; ++j) {
if (v[j] != v1[j]) {
cout << v[j] << endl;
break;
}
}
for (long long j = 0; j < n - 1; ++j) {
if (v1[j] != v2[j]) {
cout << v1[j];
break;
}
}
return 0;
}
|
#include <bits/stdc++.h>
using namespace std;
int main() {
cin.tie(0);
ios_base::sync_with_stdio(false);
cin.tie(NULL);
cout.tie(NULL);
long long int n;
cin >> n;
long long int a[n], b[n], c[n - 1];
b[n - 1] = 0, c[n - 2] = 0;
for (int i = 0; i < n; i++) {
cin >> a[i];
}
for (int i = 0; i < n - 1; i++) {
cin >> b[i];
}
for (int i = 0; i < n - 2; i++) {
cin >> c[i];
}
sort(a, a + n);
sort(b, b + n - 1);
sort(c, c + n - 2);
for (int i = 0; i < n; i++) {
if (a[i] != b[i]) {
cout << a[i] << endl;
break;
}
}
for (int i = 0; i < n - 1; i++) {
if (b[i] != c[i]) {
cout << b[i] << endl;
break;
}
}
return 0;
}
|
#include <bits/stdc++.h>
using namespace std;
long long n, m, ans, ans1, ans2;
int main() {
cin >> n;
for (int i = 1; i <= n; i++) {
cin >> m;
ans += m;
}
for (int i = 1; i < n; i++) {
cin >> m;
ans1 += m;
}
cout << ans - ans1 << '\n';
for (int i = 1; i < n - 1; i++) {
cin >> m;
ans2 += m;
}
cout << ans1 - ans2;
}
|
#include <bits/stdc++.h>
using namespace std;
template <class T>
inline void mini(T &a, T b) {
if (b < a) a = b;
}
template <class T>
inline void maxi(T &a, T b) {
if (b > a) a = b;
}
long long x;
int main() {
int n;
cin >> n;
long long fs, ss, ts;
fs = ss = ts = 0;
for (int i = 0; i < n; i++) {
cin >> x;
fs += x;
}
for (int i = 0; i < n - 1; i++) {
cin >> x;
ss += x;
}
for (int i = 0; i < n - 2; i++) {
cin >> x;
ts += x;
}
cout << fs - ss << "\n" << ss - ts << endl;
return 0;
}
|
#include <bits/stdc++.h>
using namespace std;
int main() {
cin.sync_with_stdio(0);
cin.tie(0);
int n;
cin >> n;
int ans[3];
int m;
for (int i = 0; i < 3; i++) {
ans[i] = 0;
for (int j = 0; j < n - i; j++) {
cin >> m;
ans[i] += m;
}
}
cout << ans[0] - ans[1] << endl;
cout << ans[1] - ans[2] << endl;
}
|
#include <bits/stdc++.h>
using namespace std;
int main() {
int n, i, a[100100], b[100100], c[100100];
scanf("%d", &n);
for (i = 0; i <= n - 1; i++) scanf("%d", &a[i]);
for (i = 0; i <= n - 2; i++) scanf("%d", &b[i]);
for (i = 0; i <= n - 3; i++) scanf("%d", &c[i]);
sort(a, a + n);
sort(b, b + n - 1);
sort(c, c + n - 2);
b[n - 1] = c[n - 2] = 0;
for (i = 0; i <= n - 1; i++) {
if (a[i] != b[i]) break;
}
cout << a[i] << ' ';
for (i = 0; i <= n - 2; i++) {
if (b[i] != c[i]) break;
}
cout << b[i] << endl;
return 0;
}
|
#include <bits/stdc++.h>
using namespace std;
int n, a[100010], b[100010], c[100010];
int main() {
cin >> n;
for (int i = 0; i <= n - 1; i++) cin >> a[i];
for (int i = 0; i <= n - 2; i++) cin >> b[i];
for (int i = 0; i <= n - 3; i++) cin >> c[i];
sort(a, a + n);
sort(b, b + n - 1);
sort(c, c + n - 2);
for (int i = 0; i <= n - 1; i++) {
if (a[i] != b[i]) {
cout << a[i] << endl;
break;
}
}
for (int i = 0; i <= n - 2; i++) {
if (b[i] != c[i]) {
cout << b[i];
break;
}
}
return 0;
}
|
#include <bits/stdc++.h>
using namespace std;
const double EPS = 1e-9;
const double PI = acos(-1.0);
const int MOD = 1000 * 1000 * 1000 + 7;
const int INF = 2000 * 1000 * 1000;
template <typename T>
inline T sqr(T n) {
return n * n;
}
int n, x;
long long a, b, c;
int main() {
scanf("%d", &n);
for (int i = 0; i < n; i++) {
scanf("%d", &x);
a += x;
}
for (int i = 0; i < n - 1; i++) {
scanf("%d", &x);
b += x;
}
for (int i = 0; i < n - 2; i++) {
scanf("%d", &x);
c += x;
}
printf("%I64d\n%I64d\n", a - b, b - c);
return 0;
}
|
#include <bits/stdc++.h>
using namespace std;
const int MAX = 133337;
struct hashNode {
int numVal;
int numCnt;
int test;
hashNode() : numVal(0), numCnt(0) {}
};
hashNode hashTable[MAX];
void insert(int x) {
int pos = x % MAX;
int i = 1;
while (hashTable[pos].numVal != 0 && hashTable[pos].numVal != x) {
pos += (i << 1) - 1;
if (pos > MAX) pos -= MAX;
i++;
}
if (hashTable[pos].numVal == 0) {
hashTable[pos].numVal = x;
hashTable[pos].numCnt = 1;
} else
hashTable[pos].numCnt++;
}
void check(int x) {
int pos = x % MAX;
int i = 1;
while (hashTable[pos].numVal != 0 && hashTable[pos].numVal != x) {
pos += (i << 1) - 1;
if (pos > MAX) pos -= MAX;
i++;
}
hashTable[pos].test--;
}
int main() {
int n, i, j, a;
scanf("%d", &n);
for (i = 1; i <= n; i++) {
scanf("%d", &a);
insert(a);
}
for (i = 0; i <= MAX - 1; i++) hashTable[i].test = hashTable[i].numCnt;
for (i = 1; i <= n - 1; i++) {
scanf("%d", &a);
check(a);
}
for (i = 0; i <= MAX - 1; i++) {
if (hashTable[i].test) {
cout << hashTable[i].numVal << ' ';
hashTable[i].numCnt--;
}
}
for (i = 0; i <= MAX - 1; i++) hashTable[i].test = hashTable[i].numCnt;
for (i = 1; i <= n - 2; i++) {
scanf("%d", &a);
check(a);
}
for (i = 0; i <= MAX - 1; i++) {
if (hashTable[i].test) {
cout << hashTable[i].numVal << ' ';
hashTable[i].numCnt--;
}
}
return 0;
}
|
#include <bits/stdc++.h>
using namespace std;
int main() {
long long n, i, e1 = -1, e2 = -1, flag = 0, suma = 0, sumb = 0, sumc = 0;
cin >> n;
vector<long long> a(n), b(n - 1), c(n - 2);
for (i = 0; i < n; i++) {
cin >> a[i];
suma += a[i];
}
for (i = 0; i < n - 1; i++) {
cin >> b[i];
sumb += b[i];
}
for (i = 0; i < n - 2; i++) {
cin >> c[i];
sumc += c[i];
}
cout << suma - sumb << endl << sumb - sumc;
return 0;
}
|
#include <bits/stdc++.h>
using namespace std;
int main() {
int n, i, val;
cin >> n;
vector<int> a, b, c;
for (i = 0; i < n; i++) {
cin >> val;
a.push_back(val);
}
for (i = 0; i < n - 1; i++) {
cin >> val;
b.push_back(val);
}
for (i = 0; i < n - 2; i++) {
cin >> val;
c.push_back(val);
}
sort(a.begin(), a.end());
sort(b.begin(), b.end());
for (i = 0; i <= n - 1; i++) {
if (a[i] != b[i]) {
printf("%d\n", a[i]);
c.push_back(a[i]);
break;
}
if (i == n - 1) {
printf("%d\n", a[i]);
c.push_back(a[i]);
break;
}
}
sort(c.begin(), c.end());
for (i = 0; i <= n - 1; i++) {
if (a[i] != c[i]) {
printf("%d\n", a[i]);
break;
}
if (i == n - 1) {
printf("%d\n", a[i]);
}
}
}
|
#include <bits/stdc++.h>
using namespace std;
int main() {
int n, k;
cin >> n;
int a = 0, b = 0, c = 0;
for (int i = 0; i < n; i++) {
cin >> k;
a += k;
}
for (int i = 1; i < n; i++) {
cin >> k;
b += k;
}
for (int i = 2; i < n; i++) {
cin >> k;
c += k;
}
cout << a - b << " " << b - c << endl;
return 0;
}
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.