text
stringlengths
49
983k
#include <bits/stdc++.h> using namespace std; int i, n, m, j, c1, c2, c3, c4, c5; int main() { scanf("%d %d %d %d %d", &c1, &c2, &c3, &c4, &c5); if ((c1 + c2 + c3 + c4 + c5) % 5 != 0 || c1 + c2 + c3 + c4 + c5 == 0) printf("-1"); else printf("%d", (c1 + c2 + c3 + c4 + c5) / 5); }
#include <bits/stdc++.h> int main() { int c1, c2, c3, c4, c5; while (scanf("%d%d%d%d%d", &c1, &c2, &c3, &c4, &c5) != EOF) { int sum = 0; sum = c1 + c2 + c3 + c4 + c5; if (sum % 5 == 0 && sum > 0) printf("%d\n", sum / 5); else printf("-1\n"); } return 0; }
#include <bits/stdc++.h> using namespace std; int main() { long long a, b, c, d, e; int sum; while (cin >> a >> b >> c >> d >> e) { sum = a + b + c + d + e; if (sum % 5 == 0 && sum >= 5) { cout << sum / 5 << endl; } else { cout << -1 << endl; } } return 0; }
#include <bits/stdc++.h> using namespace std; int main() { long long int test, n, i, j, k, x, y, t; j = 0; for (i = 0; i < 5; i++) { cin >> x; j += x; } if (j % 5 == 0 && (j / 5 != 0)) cout << j / 5; else cout << "-1"; }
#include <bits/stdc++.h> using namespace std; int main() { int c = 0, k; for (int i = 0; i < 5; i++) { cin >> k; c += k; } if (c % 5 == 0 && c > 0) cout << c / 5; else cout << "-1"; }
#include <bits/stdc++.h> using namespace std; int main() { int ar[5]; for (int i = 0; i < 5; i++) { cin >> ar[i]; } int sum = 0; for (int i = 0; i < 5; i++) { sum = sum + ar[i]; } if (sum % 5 == 0 && sum != 0) { cout << sum / 5; } else { cout << "-1"; } }
#include <bits/stdc++.h> using namespace std; int main() { int a[5]; for (int i = 0; i < 5; i++) cin >> a[i]; int sum = 0; for (int i = 0; i < 5; i++) sum += a[i]; if (sum % 5 == 0 && sum > 0) cout << sum / 5 << endl; else cout << -1 << endl; return 0; }
#include <bits/stdc++.h> using namespace std; int main() { int ans = 0, c; for (int i = 1; i <= 5; i++) { cin >> c; ans += c; } if (ans == 0) { cout << -1 << endl; return 0; } if (ans % 5 == 0) { cout << ans / 5 << endl; } else { cout << -1 << endl; } return 0; }
#include <bits/stdc++.h> using namespace std; long long mod = 1000000007; int main() { std::vector<int> c(5); int sum = 0; for (int i = 0; i < 5; i++) { cin >> c[i]; sum += c[i]; } if (sum % 5 != 0) { cout << -1; } else if (sum == 0) cout << -1; else cout << sum / 5; }
#include <bits/stdc++.h> using namespace std; int main() { int c[5]; int s = 0; for (int i = 0; i < 5; i++) { cin >> c[i]; s += c[i]; } if (s != 0 && s % 5 == 0) { cout << s / 5; return 0; } cout << -1; return 0; }
#include <bits/stdc++.h> using namespace std; int main() { int num, sum = 0; for (int i = 0; i < 5; ++i) { cin >> num; sum += num; } if (!(sum % 5) && sum > 0) cout << sum / 5 << endl; else cout << "-1" << endl; return 0; }
#include <bits/stdc++.h> using namespace std; int c[10]; int main() { int i, j, sum = 0; for (i = 0; i < 5; i++) scanf("%d", &c[i]); for (i = 0; i < 5; i++) sum += c[i]; if (sum % 5 || sum == 0) { printf("-1\n"); } else { printf("%d\n", sum / 5); } return 0; }
#include <bits/stdc++.h> using namespace std; int main() { int sum = 0; bool ne = 0; for (int i = 0; i < 5; i++) { int x; cin >> x; sum += x; } if (sum % 5 != 0 or sum == 0) { cout << "-1"; } else cout << sum / 5; return 0; }
#include <bits/stdc++.h> using namespace std; int main() { int c1, c2, c3, c4, c5; cin >> c1 >> c2 >> c3 >> c4 >> c5; if ((c1 + c2 + c3 + c4 + c5) % 5 == 0 && (c1 + c3 + c2 + c4 + c5) / 5 > 0) cout << (c1 + c3 + c2 + c4 + c5) / 5; else cout << -1; return 0; }
#include <bits/stdc++.h> using namespace std; int main() { int ans, x; ans = 0; for (int i = 1; i <= 5; i++) { scanf("%d", &x); ans += x; } if (ans > 0 && ans % 5 == 0) { printf("%d\n", ans / 5); } else printf("-1\n"); return 0; }
#include <bits/stdc++.h> using namespace std; int main() { int a, b, c, d, e; cin >> a >> b >> c >> d >> e; if (a == 0 && b == 0 && c == 0 && d == 0 && e == 0) { cout << -1; return 0; } if ((a + b + c + d + e) % 5 == 0) { a = (a + b + c + d + e) / 5; cout << a; } else { cout << -1; } return 0; }
#include <bits/stdc++.h> using namespace std; int main() { long int x, i, j, k, p, q, m, n, a, s = 0, z[100], u; double d; cin >> x >> i >> j >> k >> p; s = x + i + j + k + p; if (x != 0 || i != 0 || j != 0 || k != 0 || p != 0) { if ((s % 5) != 0) cout << "-1" << endl; else cout << s / 5 << endl; } else cout << "-1" << endl; return 0; }
#include <bits/stdc++.h> using namespace std; int main() { int a, b, c, d, e, s; scanf("%d%d%d%d%d", &a, &b, &c, &d, &e); s = a + b + c + d + e; if (s / 5 == 0) printf("-1\n"); else { if (s % 5 == 0) printf("%d\n", s / 5); else printf("-1\n"); } return 0; }
#include <bits/stdc++.h> int main() { int a, b, c, d, e; while (scanf("%d%d%d%d%d", &a, &b, &c, &d, &e) != EOF) { int sum = a + b + c + d + e; if (sum % 5 != 0 || sum == 0) { printf("-1\n"); continue; } printf("%d\n", sum / 5); } return 0; }
#include <bits/stdc++.h> using namespace std; int main() { int a[100], b, c, i, sum = 0; for (i = 0; i < 5; i++) { cin >> a[i]; } for (i = 0; i < 5; i++) { sum = sum + a[i]; } if (sum % 5 == 0 && sum > 0) { sum = sum / 5; cout << sum; } else { cout << "-1"; } return 0; }
#include <bits/stdc++.h> using namespace std; int main() { int ans = 0; for (int i = 1; i <= 5; i++) { int x; cin >> x; ans += x; } if (ans % 5 || ans == 0) cout << "-1\n"; else cout << ans / 5 << endl; return 0; }
#include <bits/stdc++.h> using namespace std; int main() { int c1, c2, c3, c4, c5; cin >> c1 >> c2 >> c3 >> c4 >> c5; int sum = c1 + c2 + c3 + c4 + c5; if (sum % 5 == 0 && sum != 0) cout << sum / 5; else cout << "-1"; }
#include <bits/stdc++.h> const int N = (int)1e6 + 123; const long long inf = (long long)1e18 + 123; const double eps = 1e-6; using namespace std; int sum = 0; int main() { int c1, c2, c3, c4, c5; cin >> c1 >> c2 >> c3 >> c4 >> c5; sum = c1 + c2 + c3 + c4 + c5; if (sum == 0) { cout << -1; } else if (sum % 5 == 0) { cout << sum / 5; } else if (sum != 0) { cout << -1; } return 0; }
#include <bits/stdc++.h> using namespace std; int main() { int a, b, c, d, e, s = 0; cin >> a >> b >> c >> d >> e; s = a + b + c + d + e; if (s == 0) cout << "-1"; else if (s % 5 == 0) cout << s / 5; else cout << "-1"; return 0; }
#include <bits/stdc++.h> int main() { int c1, c2, c3, c4, c5; std::cin >> c1 >> c2 >> c3 >> c4 >> c5; int sum = c1 + c2 + c3 + c4 + c5; std::cout << ((sum % 5 == 0 && sum != 0) ? (sum / 5) : -1); }
#include <bits/stdc++.h> using namespace std; int main() { int a[5], sum = 0; for (int i = 0; i < 5 && scanf("%d", &a[i]); i++) sum += a[i]; cout << (sum % 5 == 0 && sum ? sum / 5 : -1); }
#include <bits/stdc++.h> int main() { int a, b, c, d, e, sum; scanf("%d%d%d%d%d", &a, &b, &c, &d, &e); sum = a + b + c + d + e; printf("%d", (sum % 5 == 0 && sum != 0) ? sum / 5 : -1); return 0; }
#include <bits/stdc++.h> using namespace std; int main() { int arr[5]; long res = 0, b; for (int i = 0; i < 5; i++) { cin >> arr[i]; res += arr[i]; } if (res % 5 == 0 && res != 0) { b = res / 5; cout << b; } else cout << -1; return 0; }
#include <bits/stdc++.h> using namespace std; int main() { int c[5], i, sum = 0, ans; for (i = 0; i < 5; i++) { cin >> c[i]; sum += c[i]; } if (sum % 5 == 0 && sum != 0) cout << sum / 5 << endl; else cout << -1 << endl; return 0; }
#include <bits/stdc++.h> using namespace std; int main() { int n, i, l = 0; int a[n]; for (int k = 0; k < 5; k++) { cin >> a[k]; l += a[k]; } if (l % 5 == 0 && l != 0) cout << l / 5; else cout << -1; return 0; }
#include <bits/stdc++.h> using namespace std; using ll = long long; int main() { ios_base::sync_with_stdio(false); cin.tie(0), cout.tie(0); int x; int sum = 0; for (int i = 0; i < 5; i++) { cin >> x; sum += x; } if (sum % 5 == 0 && sum != 0) { cout << sum / 5 << "\n"; } else { cout << "-1" << "\n"; } return 0; }
#include <bits/stdc++.h> using namespace std; int main() { int a, b, c, d, e, sum = 0; cin >> a >> b >> c >> d >> e; sum += (a + b + c + d + e); if (sum > 4 && sum % 5 == 0) cout << sum / 5 << endl; else cout << -1 << endl; return 0; }
#include <bits/stdc++.h> using namespace std; int x, t; int main() { for (int i = 1; i <= 5; i++) { scanf("%d", &x); t += x; } if (t % 5 == 0 && t) { cout << t / 5; } else cout << -1; return 0; }
#include <bits/stdc++.h> using namespace std; int main() { int a; int s = 0; for (int i = 0; i < 5; i++) cin >> a, s += a; if (!(s % 5) && (s / 5) > 0) cout << s / 5 << "\n"; else cout << "-1\n"; return 0; }
#include <bits/stdc++.h> using namespace std; int main() { int total = 0; for (int i = 0; i < 5; i++) { int aux; cin >> aux; total += aux; } if (total == 0) { cout << "-1" << endl; return 0; } if (total % 5 == 0) cout << total / 5 << endl; else cout << "-1" << endl; }
#include <bits/stdc++.h> using namespace std; int main() { int a, b, c, d, e, sum; cin >> a >> b >> c >> d >> e; sum = a + b + c + d + e; if (sum % 5 == 0 && sum != 0) cout << sum / 5; else if (sum % 5 != 0 || sum == 0) cout << -1; }
#include <bits/stdc++.h> int d[5], n, f = 1; int main() { for (int i = 0; i < 5; i++) { scanf("%d", &d[i]); if (d[i] < 0) f = 0; n += d[i]; } if (n % 5 == 0 && f != 0 && n != 0) printf("%d\n", n / 5); else printf("-1\n"); }
#include <bits/stdc++.h> int cmp(const int *a, const int *b) { if (*a > *b) return 1; if (*a < *b) return -1; return 0; } int gcd(int a, int b) { int t = a % b; while (t) { a = b; b = t; t = a % b; } return b; } int main() { int i, j, t = 0; for (i = 0; i < 5; ++i) { scanf("%d", &j); t += j; } if (t % 5 == 0 && t >= 5) printf("%d\n", t / 5); else puts("-1"); return 0; }
#include <bits/stdc++.h> using namespace std; int main() { int a, i, s = 0, d; for (i = 1; i <= 5; i++) { scanf("%d", &a); s = s + a; } d = s / 5; if (s == 0) printf("-1"); else if (s % 5 == 0) printf("%d", d); else printf("-1"); return 0; }
#include <bits/stdc++.h> int i, t = 0, sum = 0; int main() { for (i = 1; i <= 5; i++) { scanf("%d", &t); sum += t; } if (sum % 5 == 0 && sum != 0) printf("%d", sum / 5); else if (sum == 0) printf("-1"); else printf("-1"); return 0; }
#include <bits/stdc++.h> using namespace std; int main() { int a, b, c, d, e; scanf("%d%d%d%d%d", &a, &b, &c, &d, &e); int x = a + b + c + d + e; if (x % 5 == 0 && x != 0) { x = x / 5; cout << x; } else cout << "-1"; return 0; }
#include <bits/stdc++.h> int main() { int s = 0, ar[5], t = 0; for (int i = 0; i < 5; ++i) { scanf("%d", &ar[i]); s += ar[i]; } if (s % 5 || s == 0) printf("-1\n"); else { for (int i = 0; i < 5; ++i) if (ar[i] % 2) ++t; if ((((s / 5) % 2) && (t == 1 || t == 3 || t == 5)) || (!((s / 5) % 2) && (t == 0 || t == 2 || t == 4))) printf("%d\n", s / 5); else printf("-1\n"); } return 0; }
#include <bits/stdc++.h> using namespace std; bool compare(pair<int, int> a, pair<int, int> b) { if (a.second == b.second) { return a.first < b.first; } return a.second > b.second; } int main() { int a, b, c, d, e; cin >> a >> b >> c >> d >> e; if ((a + b + c + d + e) % 5 != 0 || (a == 0 && b == 0 && c == 0 && d == 0 && e == 0)) cout << -1 << endl; else cout << (a + b + c + d + e) / 5 << endl; return 0; }
#include <bits/stdc++.h> int main() { int a[10]; int sum = 0; for (int i = 0; i < 5; ++i) { scanf("%d", a + i); sum += a[i]; } if (sum % 5 || sum / 5 <= 0) printf("-1\n"); else printf("%d\n", sum / 5); return 0; }
#include <bits/stdc++.h> int main() { int a, b, c, d, e, sum = 0; scanf("%d%d%d%d%d", &a, &b, &c, &d, &e); sum = (a + b + c + d + e); if (sum == 0) printf("-1"); else if (sum % 5 == 0) printf("%d\n", sum / 5); else printf("-1\n"); return 0; }
#include <bits/stdc++.h> using namespace std; int main() { int i, j, n, c1, c2, c3, c4, c5; cin >> c1 >> c2 >> c3 >> c4 >> c5; if ((c1 + c2 + c3 + c4 + c5) % 5 == 0) { j = (c1 + c2 + c3 + c4 + c5) / 5; if (j == 0) { cout << "-1\n"; } else { cout << j << endl; } } else { cout << "-1\n"; } return 0; }
#include <bits/stdc++.h> using namespace std; int main() { int c[5], i = 0, sum = 0; while (i < 5) { cin >> c[i]; sum += c[i]; i++; } if (sum % 5 == 0 && sum != 0) cout << sum / 5 << endl; else cout << -1 << endl; return 0; }
#include <bits/stdc++.h> using namespace std; const int NMax = 3e4 + 5; int main() { int x; int sum = 0; for (int i = 1; i <= 5; i++) { cin >> x; sum += x; } if (sum == 0 || sum % 5 != 0) { cout << -1; } else { cout << sum / 5; } return 0; }
#include <bits/stdc++.h> using namespace std; int main() { int n, c = 0; for (int i = 0; i < 5; i++) { scanf("%d", &n); c += n; } if (c == 0 || c % 5) { c = -1; printf("%d\n", c); } else printf("%d\n", c / 5); return 0; }
#include <bits/stdc++.h> using namespace std; int main() { int a, b, c, d, e; cin >> a >> b >> c >> d >> e; if ((a + b + c + d + e) % 5 || (a + b + c + d + e) == 0) cout << -1 << endl; else cout << (a + b + c + d + e) / 5 << endl; return 0; }
#include <bits/stdc++.h> using namespace std; int main() { int t, sum = 0; for (int i = 1; i <= 5; i++) { scanf("%d", &t); sum += t; } if (sum == 0 || sum % 5) puts("-1"); else printf("%d\n", sum / 5); return 0; }
#include <bits/stdc++.h> using namespace std; int main() { int n = 5, sum = 0; while (n--) { int a; cin >> a; sum += a; } if (sum == 0) { cout << -1 << endl; return 0; } cout << (sum % 5 == 0 ? sum / 5 : -1) << endl; }
#include <bits/stdc++.h> using namespace std; int main() { int n, s = 0; for (int i = 0; i < 5; i++) { cin >> n; s += n; } if (s % 5 == 0 && s != 0) cout << s / 5 << endl; else cout << "-1" << endl; }
#include <bits/stdc++.h> using namespace std; int main() { int c1, c2, c3, c4, c5; cin >> c1 >> c2 >> c3 >> c4 >> c5; int sum = c1 + c2 + c3 + c4 + c5; if (sum % 5 != 0 || sum == 0) cout << "-1" << endl; else cout << sum / 5 << endl; return 0; }
#include <bits/stdc++.h> using namespace std; int main() { int c1, c2, c3, c4, c5, s; cin >> c1 >> c2 >> c3 >> c4 >> c5; s = c1 + c2 + c3 + c4 + c5; if (s % 5 == 0) { if (s == 0) { printf("-1\n"); } else printf("%d\n", s / 5); } else printf("-1\n"); return 0; }
#include <bits/stdc++.h> using namespace std; int a, b, c, d, e, cem; int main() { cin >> a >> b >> c >> d >> e; cem = a + b + c + d + e; if (cem % 5 != 0 || cem == 0) { cout << "-1" << endl; } else { cout << (cem / 5) << endl; } return 0; }
#include <bits/stdc++.h> int A[5]; int main() { int sum = 0; for (int i = 0; i < 5; ++i) { int t; scanf("%d", &t); sum += t; } if (sum % 5 || !sum) { printf("-1\n"); } else { printf("%d", sum / 5); } return 0; }
#include <bits/stdc++.h> using namespace std; int main() { ios::sync_with_stdio(0); cin.tie(0); cout.tie(0); ; int k, l, m, n, o; cin >> k >> l >> m >> n >> o; int s = k + l + m + n + o; if (k == 0 && l == 0 && m == 0 && n == 0 && o == 0) cout << "-1"; else { if (s % 5 == 0) cout << s / 5; else cout << "-1"; } return 0; }
#include <bits/stdc++.h> int main() { int c1, c2, c3, c4, c5; scanf("%d %d %d %d %d", &c1, &c2, &c3, &c4, &c5); int sum = c1 + c2 + c3 + c4 + c5; if (sum % 5 == 0 && sum > 0) printf("%d\n", sum / 5); else printf("-1"); }
#include <bits/stdc++.h> int main() { int i, s = 0, k; for (i = 0; i < 5; i++) { scanf("%d", &k); s += k; } if (s % 5 != 0 || s == 0) printf("-1"); else printf("%d", s / 5); return 0; }
#include <bits/stdc++.h> int main() { int c, t = 5, s = 0; while (t--) { scanf("%d", &c); s += c; } if (s % 5 == 0 && s != 0) printf("%d", s / 5); else printf("-1"); return 0; }
#include <bits/stdc++.h> using namespace std; int main() { int aux, c = 0, count = 5; while (count--) { cin >> aux; c += aux; } if (c % 5 != 0 or c / 5 == 0) cout << -1 << endl; else cout << c / 5 << endl; return 0; }
#include <bits/stdc++.h> int main() { int i, j, k, n, t, c1, c2, c3, c4, c5; scanf("%d%d%d%d%d", &c1, &c2, &c3, &c4, &c5); t = c1 + c2 + c3 + c4 + c5; if (t == 0) printf("-1\n"); else if (t % 5 == 0) printf("%d\n", t / 5); else printf("-1\n"); }
#include <bits/stdc++.h> using namespace std; int main() { int arr[5]; int i; for (i = 0; i < 5; i++) { cin >> arr[i]; } int sum = 0; for (i = 0; i < 5; i++) { sum = sum + arr[i]; } if (sum % 5 == 0 && sum != 0) { cout << sum / 5; } if (sum == 0) cout << "-1"; if (sum % 5 != 0) cout << "-1"; return 0; }
#include <bits/stdc++.h> using namespace std; int main() { long long c1, c2, c3, c4, c5; cin >> c1 >> c2 >> c3 >> c4 >> c5; long long x = (c1 + c2 + c3 + c4 + c5); if (x % 5 == 0 && x != 0) cout << x / 5; else cout << "-1"; }
#include <bits/stdc++.h> using namespace std; int main() { int x = 0, a[5], sum = 0; for (int i = 0; i < 5; ++i) { cin >> a[i]; sum += a[i]; if (a[i] == 0) x++; } if (x == 5) cout << -1; else if (sum % 5 == 0) { cout << sum / 5; } else cout << -1; return 0; }
#include <bits/stdc++.h> using namespace std; int main() { int x, s{}; while (~scanf("%d", &x)) s += x; if (s % 5 || s == 0) puts("-1"); else printf("%d\n", s / 5); }
#include <bits/stdc++.h> using namespace std; int main() { int c1, c2, c3, c4, c5, s = 0; cin >> c1 >> c2 >> c3 >> c4 >> c5; s = c1 + c2 + c3 + c4 + c5; if (s != 0 && s % 5 == 0) { cout << s / 5; } else { cout << -1; } }
#include <bits/stdc++.h> using namespace std; int a, b, c, d, e, s; int main() { cin >> a >> b >> c >> d >> e; s = a + b + c + d + e; if (s % 5 || s == 0) cout << -1; else cout << s / 5; return 0; }
#include <bits/stdc++.h> using namespace std; int main() { int sum = 0; for (int i = 0; i < 5; ++i) { int x; cin >> x; sum += x; } if (sum % 5 == 0 && sum != 0) cout << sum / 5; else cout << "-1"; return 0; }
#include <bits/stdc++.h> int main() { int c1, c2, c3, c4, c5, s = 0; scanf("%d%d%d%d%d", &c1, &c2, &c3, &c4, &c5); s = c1 + c2 + c3 + c4 + c5; if (s % 5 == 0 && s > 0) printf("%d", s / 5); else printf("%d", -1); }
#include <bits/stdc++.h> using namespace std; int main() { int a, b, c, d, e; cin >> a >> b >> c >> d >> e; int sum = a + b + c + d + e; if (sum % 5 == 0) { if (sum == 0) cout << "-1" << endl; else cout << sum / 5 << endl; } else cout << "-1" << endl; }
#include <bits/stdc++.h> using namespace std; int main() { int x; int ans = 0; for (int i = 0; i < 5; i++) { cin >> x; ans += x; } if (ans == 0) { cout << "-1"; return 0; } if (ans % 5 == 0) { cout << (int)(ans / 5); } else { cout << "-1"; } return 0; }
#include <bits/stdc++.h> using namespace std; int main() { int s = 0; int c[5]; for (int i = 0; i < 5; ++i) cin >> c[i], s += c[i]; if (s % 5 == 0 && s) cout << s / 5 << endl; else cout << -1 << endl; }
#include <bits/stdc++.h> using namespace std; int main() { int c1, c2, c3, c4, c5, i; cin >> c1 >> c2 >> c3 >> c4 >> c5; i = c1 + c2 + c3 + c4 + c5; if (i == 0) { cout << "-1" << endl; } else if (i % 5 == 0) { cout << (i / 5) << endl; } else { cout << "-1" << endl; } return 0; }
#include <bits/stdc++.h> using namespace std; long long int GCD(long long int a, long long int b) { if (b == 0) return a; else return GCD(b, a % b); } bool isPerfectSq(int x) { long long int lo = 1, hi = x; while (lo <= hi) { long long int mid = (lo + hi) >> 1; if (mid * mid == x) return true; else if (mid * mid < x) lo = mid + 1; else hi = mid - 1; } return false; } bool prime[1000009]; void primeSieve() { memset(prime, 1, sizeof(prime)); prime[0] = 0, prime[1] = 0; for (int i = 2; i * i < 1000009; i++) { for (int j = i * i; j < 1000009; j += i) { if (prime[i] == 1) { prime[j] = 0; } } } } void solve(); int32_t main() { ios_base ::sync_with_stdio(false); cin.tie(0); cout.tie(0); int test = 1; while (test--) solve(); return 0; } void solve() { int sum = 0; int t = 5; while (t--) { int k; cin >> k; sum += k; } if (!sum || sum % 5) cout << -1 << '\n'; else cout << (sum / 5) << '\n'; return; }
#include <bits/stdc++.h> using namespace std; int main() { int c1, c2, c3, c4, c5, a; cin >> c1 >> c2 >> c3 >> c4 >> c5; a = c1 + c2 + c3 + c4 + c5; if (a > 0 && a % 5 == 0) cout << a / 5 << endl; else cout << "-1" << endl; }
#include <bits/stdc++.h> using namespace std; int main() { int c[5], s = 0, i; for (i = 0; i < 5; i++) cin >> c[i]; for (i = 0; i < 5; i++) s = s + c[i]; if (s == 0) cout << "-1"; else if (s % 5 == 0) cout << s / 5; else cout << "-1"; return 0; }
#include <bits/stdc++.h> using namespace std; int main() { ios_base::sync_with_stdio(false); int a, b, c, d, e; cin >> a >> b >> c >> d >> e; int avg = (a + b + c + d + e) / 5; if ((a + b + c + d + e) % 5 != 0 || avg == 0) cout << -1 << endl; else cout << avg << endl; }
#include <bits/stdc++.h> using namespace std; int c[6], b, mn = 101, mx, d; bool found; int main() { for (int i = 1; i <= 5; i++) { cin >> c[i]; mx = max(mx, c[i]); mn = min(mn, c[i]); } for (int i = mn; i <= mx; i++) { d = 0; b = i; for (int j = 1; j <= 5; j++) d += i - c[j]; if (d == 0) { found = true; break; } } if (found && b != 0) cout << b << endl; else cout << -1 << endl; return 0; }
#include <bits/stdc++.h> using namespace std; int main() { ios::sync_with_stdio(false); cin.tie(0); cout.tie(0); int c1, c2, c3, c4, c5, sum = 0; cin >> c1 >> c2 >> c3 >> c4 >> c5; sum = c1 + c2 + c3 + c4 + c5; if (sum % 5 == 0 && sum != 0) cout << sum / 5 << endl; else cout << -1 << endl; return 0; }
#include <bits/stdc++.h> using namespace std; int main() { ios_base::sync_with_stdio(false); cin.tie(NULL); cout << fixed; cout << setprecision(9); long long int m, p = 2e9, k = 0, l, q, r, j = 0, t, n, i; for (i = 0; i < 5; i++) { cin >> n; k += n; } if (k % 5 == 0 && k > 0) cout << k / 5; else cout << -1; return 0; }
#include <bits/stdc++.h> int main() { int a[5]; scanf("%d%d%d%d%d", &a[0], &a[1], &a[2], &a[3], &a[4]); if ((a[0] + a[1] + a[2] + a[3] + a[4]) % 5 == 0 && (a[0] + a[1] + a[2] + a[3] + a[4]) / 5 != 0) printf("%d\n", (a[0] + a[1] + a[2] + a[3] + a[4]) / 5); else printf("-1\n"); return 0; }
#include <bits/stdc++.h> int main() { int i, n, sum = 0; for (i = 0; i < 5; i++) { scanf("%d", &n); sum = sum + n; } if (sum % 5 == 0 && sum != 0) { printf("%d", sum / 5); } else { printf("-1"); } return 0; }
#include <bits/stdc++.h> using namespace std; int main() { int x[5]; cin >> x[0] >> x[1] >> x[2] >> x[3] >> x[4]; if ((x[0] + x[1] + x[2] + x[3] + x[4]) % 5 == 0 && (x[0] + x[1] + x[2] + x[3] + x[4]) != 0) cout << (x[0] + x[1] + x[2] + x[3] + x[4]) / 5; else cout << -1; return 0; }
#include <bits/stdc++.h> using namespace std; int main(int argc, char *argv[]) { int x; long long int sum = 0; for (int i = 0; i < 5; i++) { cin >> x; sum += x; } if (sum == 0) { cout << -1 << endl; } else if (sum % 5 == 0) { cout << sum / 5 << endl; } else { cout << -1 << endl; } }
#include <bits/stdc++.h> using namespace std; int a, sum; int main() { for (int i = 0; i < 5; i++) { cin >> a; sum += a; } if (sum % 5 || !sum) cout << -1 << '\n'; else cout << sum / 5 << '\n'; return 0; }
#include <bits/stdc++.h> using namespace std; int main() { int c1, c2, c3, c4, c5; cin >> c1 >> c2 >> c3 >> c4 >> c5; int sum = 0; sum += c1 + c2 + c3 + c4 + c5; if (sum % 5 == 0 && sum != 0) cout << sum / 5; else cout << -1; }
#include <bits/stdc++.h> using namespace std; int main() { int t; int n, i; n = 5; int sum = 0; while (n--) { int temp; cin >> temp; sum += temp; } int ans = sum; if (ans % 5 == 0 && ans != 0) cout << ans / 5 << endl; else cout << "-1" << endl; return 0; }
#include <bits/stdc++.h> #pragma GCC optimize("O3") #pragma GCC target("sse4") using namespace std; const long long INF = 1e9; using namespace std; void solution() { int sum = 0; for (int i = 0; i < 5; i++) { int c; cin >> c; sum += c; } auto value = sum / 5.0; if (value == 0.0) cout << -1; else if (int(value) == value) cout << value; else cout << -1; cout << endl; } int main() { ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL); ; solution(); return 0; }
#include <bits/stdc++.h> using namespace std; int main() { int c1, c2, c3, c4, c5, sum = 0; scanf("%d%d%d%d%d", &c1, &c2, &c3, &c4, &c5); sum = c1 + c2 + c3 + c4 + c5; if (!sum || sum % 5) printf("-1\n"); else printf("%d\n", sum / 5); return 0; }
#include <bits/stdc++.h> using namespace std; int main() { int C1, C2, C3, C4, C5; cin >> C1 >> C2 >> C3 >> C4 >> C5; if (C1 + C2 + C3 + C4 + C5 == 0) { cout << "-1"; } else if ((C1 + C2 + C3 + C4 + C5) % 5 == 0) { cout << ((C1 + C2 + C3 + C4 + C5) / 5); } else { cout << "-1"; } }
#include <bits/stdc++.h> using namespace std; int main() { int a[5]; int i, sum = 0; int count = 0; for (i = 0; i < 5; i++) { cin >> a[i]; sum = sum + a[i]; } int b = sum / 5; int c = sum % 5; if (sum == 0) cout << "-1"; else if (sum != 0 && c == 0) cout << b; else cout << "-1"; }
#include <bits/stdc++.h> using namespace std; int main() { int a[5]; int sum = 0; for (int i = 0; i < 5; i++) { cin >> a[i]; sum += a[i]; } if (sum == 0) { cout << -1; return 0; } if (sum % 5 == 0) cout << sum / 5; else cout << -1; return 0; }
#include <bits/stdc++.h> using namespace std; int main() { int arr[6], i, sum = 0; for (i = 0; i < 5; i++) { scanf("%d", &arr[i]); sum = sum + arr[i]; } if (sum == 0) { printf("-1\n"); } else if (sum % 5 == 0) { printf("%d", sum / 5); } else { printf("-1"); } return 0; }
#include <bits/stdc++.h> using namespace std; int s; int main() { for (int i = 0; i < 5; ++i) { int a; cin >> a; s += a; } cout << ((s % 5 == 0 && s > 0) ? s / 5 : -1) << endl; }
#include <bits/stdc++.h> using namespace std; int main() { ios::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL); long long n, total = 0; for (long long i = 0; i < 5; i++) { cin >> n; total += n; } if (total % 5 != 0 || total <= 0) cout << "-1" << endl; else cout << total / 5 << endl; }
#include <bits/stdc++.h> using namespace std; using namespace chrono; using ll = long long; using vi = vector<int>; using vl = vector<ll>; using vvi = vector<vi>; using pii = pair<int, int>; using pll = pair<ll, ll>; template <typename T> int sz(const T& a); template <typename T> int unq(vector<T>& a); template <typename T> T powi(T x, int i); template <typename T> T sqr(const T& x); template <typename T, typename U> auto maxx(const T& t, const U& u) -> typename common_type<T, U>::type; template <typename T, typename U> auto minn(const T& t, const U& u) -> typename common_type<T, U>::type; template <typename T, typename U> bool smin(T& t, const U& u); template <typename T, typename U> bool smax(T& t, const U& u); template <typename T, typename U, typename... V> auto maxx(const T& t, const U& u, const V&... v) -> typename common_type<T, U, V...>::type; template <typename T, typename U, typename... V> auto minn(const T& t, const U& u, const V&... v) -> typename common_type<T, U, V...>::type; template <typename T, typename U, typename... V> bool smin(T& t, const U& u, const V&... v); template <typename T, typename U, typename... V> bool smax(T& t, const U& u, const V&... v); template <typename T> inline string to_string(const vector<T>& x); template <typename T> inline string to_string(const vector<T>& x, int i); template <typename T> inline string to_string(const vector<T>& x, int i, int j); namespace InputReader { const int N = 1 << 16; char buffer[N]; char* iptr = buffer + N; char* endptr = buffer + N; bool hasMore = true; int bytesRead; inline bool reloadBuffer(); inline int gc(); inline bool read(char& x); inline bool read(char* x); inline bool read(string& x); inline bool readln(char* x); inline bool readln(string& x); template <typename T> inline bool readz(T& x); inline bool read(int& x); inline bool read(long long& x); template <typename T> inline bool read(vector<T>& a); template <typename T> inline bool reada(T* a, int n); template <typename T, typename... U> inline bool read(T& x, U&... y); inline int ni(); inline long long nl(); inline string ns(); inline vector<int> nvi(int n); inline vector<long long> nvl(int n); } // namespace InputReader using InputReader::ni; using InputReader::nl; using InputReader::ns; using InputReader::nvi; using InputReader::nvl; using InputReader::read; using InputReader::reada; using InputReader::readln; namespace OutputWriter { const int N = 1 << 16; char buffer[N]; char* iptr = buffer; char* const endptr = buffer + N; int bytesWritten = 0; void flushBuffer(); void pc(const int& c); inline bool print(const char& c); inline bool print(const char* a); inline bool print(char* a); inline bool print(const string& s); template <typename T> inline bool printz(T x); inline bool print(const int& x); inline bool print(const long long& x); inline bool print(const double& x); template <typename T, typename... U> inline bool print(const T& t, const U&... u); inline bool println(); template <typename T> inline bool println(const T& x); template <typename T, typename... U> inline bool println(const T& t, const U&... u); } // namespace OutputWriter using OutputWriter::print; using OutputWriter::println; bool solve(int testNumber); void solve(); int localTestCases = 1, testCount = 1; int MXITR = (int)1e7; const int inf = (int)1e9 + 7; const long long infl = (long long)4.6e18 + 7; const int md = (int)1e9 + 7; const bool multipleTestCases = 0; bool solve(int testNumber) { int s = 0; for (int _ = 0, _$ = 5; _ < _$; ++_) s += ni(); OutputWriter::println(s == 0 ? -1 : s % 5 == 0 ? s / 5 : -1); ; return 1; } void solve() { if (false) InputReader::read(localTestCases); for (int i = 0; i < localTestCases; ++i) { if (multipleTestCases) InputReader::read(testCount); for (int testNumber = 1; testNumber <= testCount; ++testNumber) solve(testNumber); } OutputWriter::flushBuffer(); } int main() { if (false) { freopen("input.txt", "r", stdin); freopen("output.txt", "w", stdout); } else { ios_base::sync_with_stdio(false); cin.tie(nullptr); cout.tie(nullptr); } auto t1 = high_resolution_clock::now(); solve(); auto t2 = high_resolution_clock::now(); duration<double> t = t2 - t1; if (false) printf("\n\nTime taken: %.5fs\n", t.count()); fclose(stdin); fclose(stdout); return 0; } template <typename T> int sz(const T& a) { return (int)a.size(); } template <typename T> int unq(vector<T>& a) { int n = a.size(); int m = unique(a.begin(), a.end()) - a.begin(); a.resize(m); return n - m; } template <typename T> T powi(T x, int i) { T r = 1; while (i) { if (i & 1) r *= x; x *= x; i /= 2; } return r; } template <typename T> T sqr(const T& x) { return x * x; } template <typename T, typename U> auto maxx(const T& t, const U& u) -> typename common_type<T, U>::type { return (t > u) ? t : u; } template <typename T, typename U> auto minn(const T& t, const U& u) -> typename common_type<T, U>::type { return (t < u) ? t : u; } template <typename T, typename U> bool smin(T& t, const U& u) { return (u < t) ? (t = u, true) : false; } template <typename T, typename U> bool smax(T& t, const U& u) { return (u > t) ? (t = u, true) : false; } template <typename T, typename U, typename... V> auto maxx(const T& t, const U& u, const V&... v) -> typename common_type<T, U, V...>::type { return maxx(maxx(t, u), v...); } template <typename T, typename U, typename... V> auto minn(const T& t, const U& u, const V&... v) -> typename common_type<T, U, V...>::type { return minn(minn(t, u), v...); } template <typename T, typename U, typename... V> bool smin(T& t, const U& u, const V&... v) { if (auto m = minn(u, v...); m < t) return (t = m, true); return false; } template <typename T, typename U, typename... V> bool smax(T& t, const U& u, const V&... v) { if (auto m = maxx(u, v...); m > t) return (t = m, true); return false; } template <typename T> inline string to_string(const vector<T>& x) { return to_string(x, 0, (int)x.size() - 1); } template <typename T> inline string to_string(const vector<T>& x, int i) { return to_string(x, i, (int)x.size() - 1); } template <typename T> inline string to_string(const vector<T>& x, int i, int j) { string s = to_string(x[i]); for (int k = i + 1; k <= j; ++k) s += ' ' + to_string(x[k]); return s; } inline bool InputReader::reloadBuffer() { bytesRead = fread(buffer, sizeof(buffer[0]), N, stdin); iptr = buffer; endptr = buffer + bytesRead; hasMore = (bytesRead != 0); return hasMore; } inline int InputReader::gc() { if (iptr == endptr) if (!reloadBuffer()) return EOF; return *iptr++; } inline bool InputReader::read(char& x) { int c = gc(); while (isspace(c) and c != EOF) c = gc(); if (c == EOF) { x = (char)0; if (false) assert(false); return false; } x = (char)c; return true; } inline bool InputReader::read(char* a) { int c = gc(); while (isspace(c) and c != EOF) c = gc(); if (c == EOF) { *a = '\0'; if (false) assert(false); return false; } while (!isspace(c) and c != EOF) { *a++ = (char)c; c = gc(); } *a = '\0'; return true; } inline bool InputReader::read(string& s) { static char t[(int)2e6 + 10]; if (!read(t)) return false; s.assign(t); return true; } inline bool InputReader::readln(char* a) { int c = gc(); while (isspace(c) and c != EOF) c = gc(); if (c == EOF) { *a = '\0'; if (false) assert(false); return false; } while ((c != '\n' and c != '\r' and c != '\f') and c != EOF) { *a++ = (char)c; c = gc(); } *a = '\0'; return true; } inline bool InputReader::readln(string& s) { static char t[(int)2e6 + 10]; if (!readln(t)) return false; s.assign(t); return true; } template <typename T> inline bool InputReader::readz(T& x) { int c = gc(); bool negative = false; x = 0; while (isspace(c) and c != EOF and c != '-') c = gc(); if (c == '-') { negative = true; c = gc(); } if (c == EOF) { if (false) assert(false); return false; } while (isdigit(c)) { x = x * 10 + (c - '0'); c = gc(); } if (negative) x = -x; return true; } inline bool InputReader::read(int& x) { return readz<int>(x); } inline bool InputReader::read(long long& x) { return readz<long long>(x); } template <typename T, typename... U> inline bool InputReader::read(T& x, U&... y) { bool b1 = read(x); bool b2 = read(y...); return b1 and b2; } template <typename T> inline bool InputReader::read(vector<T>& a) { bool b = true; for (auto& e : a) b &= read(e); return b; } inline int InputReader::ni() { int _; read(_); return _; } inline long long InputReader::nl() { long long _; read(_); return _; } inline string InputReader::ns() { string _; read(_); return _; } inline vector<int> InputReader::nvi(int n) { vector<int> v(n); for (int& e : v) read(e); return v; } inline vector<long long> InputReader::nvl(int n) { vector<long long> v(n); for (long long& e : v) read(e); return v; } inline void OutputWriter::flushBuffer() { int r = fwrite(buffer, sizeof(buffer[0]), bytesWritten, stdout); if (false) assert(r == bytesWritten); iptr = buffer; bytesWritten = 0; } inline void OutputWriter::pc(const int& c) { *iptr = (char)c; ++bytesWritten; if (++iptr == endptr) flushBuffer(); } inline bool OutputWriter::print(const char& c) { pc(c); return true; } inline bool OutputWriter::print(char* a) { while (*a != '\0') pc(*a++); return true; } inline bool OutputWriter::print(const char* a) { while (*a != '\0') pc(*a++); return true; } inline bool OutputWriter::print(const string& s) { for (const char& c : s) pc(c); return true; } template <typename T> inline bool OutputWriter::printz(T x) { if (x < 0) { pc('-'); x = -x; } static int t[64]; if (x == 0) { pc('0'); return true; } int* ptr = t; int* const startptr = t; while (x > 0) { *ptr++ = x % 10; x /= 10; } do { pc(*--ptr + '0'); } while (ptr != startptr); return true; } inline bool OutputWriter::print(const int& x) { return printz<int>(x); } inline bool OutputWriter::print(const long long& x) { return printz<long long>(x); } inline bool OutputWriter::print(const double& x) { static char a[64]; sprintf(a, "%.12f", x); return print(a); } template <typename T, typename... U> inline bool OutputWriter::print(const T& t, const U&... u) { print(t); print(' '); return print(u...); } inline bool OutputWriter::println() { pc('\n'); return true; } template <typename T> inline bool OutputWriter::println(const T& x) { print(x); return println(); } template <typename T, typename... U> inline bool OutputWriter::println(const T& t, const U&... u) { print(t); print(' '); return println(u...); }
#include <bits/stdc++.h> using namespace std; int main() { int a, b, c, d, e; cin >> a >> b >> c >> d >> e; int sum = a + b + c + d + e; if (sum == 0) cout << -1; else if (sum % 5 == 0) { cout << sum / 5; } else cout << -1; return 0; }
#include <bits/stdc++.h> int main() { int a[5], i, s = 0, k; for (i = 0; i < 5; i++) { scanf("%d", &a[i]); s = s + a[i]; } k = s / 5; if (s % 5 == 0 && k != 0) printf("%d", k); else printf("-1"); }