submission_id stringlengths 10 10 | problem_id stringlengths 6 6 | language stringclasses 3
values | code stringlengths 1 522k | compiler_output stringlengths 43 10.2k |
|---|---|---|---|---|
s403446232 | p03699 | C++ | #include <iostream>
#include <vector>
using namespace std;
int main() {
int N;
cin >> N;
vector<int> s(N);
int sum = 0;
for (int i = 0; i < N; i++) {
cin >> s[i];
sum += s[i];
}
sort(s.begin(), s.end());
int ans;
if (sum % 10 != 0) {
ans = sum;
}
else {
for (int i = 0; i < N; i++) {
if (s[i] % 10 != 0) {
ans = sum - s[i];
break;
}
}
}
cout << ans << endl;
return 0;
} | a.cc: In function 'int main()':
a.cc:14:5: error: 'sort' was not declared in this scope; did you mean 'short'?
14 | sort(s.begin(), s.end());
| ^~~~
| short
|
s508135623 | p03699 | C | #include<iostream>
#include<vector>
#include<algorithm>
using namespace std;
int main(){
int n,i;
cin >> n;
int sum=0;
vector<int> a(n);
for(i=0;i<n;i++){
cin >> a[i];
sum+=a[i];
}
sort(a.begin(),a.end());
if(sum%10==0){
for(i=0;a[i]%10==0&&i<n;i++);
sum-=a[i];
if(i==n)sum=0;
}
cout << sum << endl;
} | main.c:1:9: fatal error: iostream: No such file or directory
1 | #include<iostream>
| ^~~~~~~~~~
compilation terminated.
|
s794432727 | p03699 | C++ | #include <bits/stdc++.h>
using namespace std;
int main() {
int n,ans=0;
cin >> n;
vector<int> da(n);
for (int i = 0;i < n;i++) {
cin >> da[i];
ans += da[i];
}
sort(da.begin(), da.end());
int i = 0;
while (da[i]%10==0&&i!=n) {
i++;
}
if (i == n)
cout << 0 << endl;
else
cout << ans - da[i] << endl;
| a.cc: In function 'int main()':
a.cc:19:45: error: expected '}' at end of input
19 | cout << ans - da[i] << endl;
| ^
a.cc:3:12: note: to match this '{'
3 | int main() {
| ^
|
s571084102 | p03699 | C++ | include <bits/stdc++.h>
using namespace std;
int main() {
int n,ans=0;
cin >> n;
vector<int> da(n);
for (int i = 0;i < n;i++) {
cin >> da[i];
ans += da[i];
}
sort(da.begin(), da.end());
int i = 0;
while (da[i]%10==0&&i!=n) {
i++;
}
if (i == n)
cout << 0 << endl;
else
cout << ans - da[i] << endl;
| a.cc:1:1: error: 'include' does not name a type
1 | include <bits/stdc++.h>
| ^~~~~~~
a.cc: In function 'int main()':
a.cc:5:9: error: 'cin' was not declared in this scope
5 | cin >> n;
| ^~~
a.cc:6:9: error: 'vector' was not declared in this scope
6 | vector<int> da(n);
| ^~~~~~
a.cc:6:16: error: expected primary-expression before 'int'
6 | vector<int> da(n);
| ^~~
a.cc:8:24: error: 'da' was not declared in this scope
8 | cin >> da[i];
| ^~
a.cc:11:14: error: 'da' was not declared in this scope
11 | sort(da.begin(), da.end());
| ^~
a.cc:11:9: error: 'sort' was not declared in this scope; did you mean 'short'?
11 | sort(da.begin(), da.end());
| ^~~~
| short
a.cc:17:17: error: 'cout' was not declared in this scope
17 | cout << 0 << endl;
| ^~~~
a.cc:17:30: error: 'endl' was not declared in this scope
17 | cout << 0 << endl;
| ^~~~
a.cc:19:17: error: 'cout' was not declared in this scope
19 | cout << ans - da[i] << endl;
| ^~~~
a.cc:19:40: error: 'endl' was not declared in this scope
19 | cout << ans - da[i] << endl;
| ^~~~
a.cc:19:45: error: expected '}' at end of input
19 | cout << ans - da[i] << endl;
| ^
a.cc:3:12: note: to match this '{'
3 | int main() {
| ^
|
s752482783 | p03699 | C++ | #include <vector>
#include <cstdio>
#include <iostream>
#include <cmath>
#include <string>
#include <cstring>
#include <algorithm>
#include <numeric>
#include <cstdlib>
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
#define REP(i,n) for(int i=0;i<n;i++)
#define SORT(c) sort((c).begin(),(c).end())
#define ALL(a) (a).begin(),(a).end()
int main() {
cin.tie(0);
ios::sync_with_stdio(false);
int n;
cin >> n;
int total = 0;
vector<int> not_ten_times;
REP(i, n) {
int tmp;
cin >> tmp;
total += tmp;
if(tmp % 10 != 0) {
not_ten_times.push_back(tmp);
}
}
if(total % 10 != 0) {
cout << total << endl;
return 0;
}
SORT(not_ten_times);
REP(i, not_ten_times.length()) {
total -= not_ten_times[i];
if(total % 10 != 0) {
cout << total << endl;
return 0;
}
}
cout << 0 << endl;
return 0;
}
| a.cc: In function 'int main()':
a.cc:42:24: error: 'class std::vector<int>' has no member named 'length'
42 | REP(i, not_ten_times.length()) {
| ^~~~~~
a.cc:14:32: note: in definition of macro 'REP'
14 | #define REP(i,n) for(int i=0;i<n;i++)
| ^
|
s100694547 | p03699 | C++ | #include <vector>
#include <cstdio>
#include <iostream>
#include <cmath>
#include <string>
#include <cstring>
#include <algorithm>
#include <numeric>
#include <cstdlib>
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
#define REP(i,n) for(int i=0;i<n;i++)
#define SORT(c) sort((c).begin(),(c).end())
#define ALL(a) (a).begin(),(a).end()
int main() {
cin.tie(0);
ios::sync_with_stdio(false);
int n;
vector<int> s(n);
int total;
REP(i, n) {
int tmp;
cin >> tmp;
total += tmp;
}
if(tmp % 10 == 0) {
cout << 0 << endl;
} else {
cout << total << endl;
}
return 0;
}
| a.cc: In function 'int main()':
a.cc:31:6: error: 'tmp' was not declared in this scope; did you mean 'tm'?
31 | if(tmp % 10 == 0) {
| ^~~
| tm
|
s766443161 | p03699 | C++ | #include <bits/stdc++.h>
using namespace std;
int main() {
int n,m10,other,min;
cin>>n;
vector<int> a(n);
n10=other=0;
min=10000;
for(int i=0;i<n;i++){
cin>>a[i];
if(a[i]%10==0)m10+=a[i];
else{
other+=a[i];
if(a[i]<min)min=a[i];
}
}
if(other%10==0)other-=min;
cout<<m10+other<<endl;
} | a.cc: In function 'int main()':
a.cc:8:3: error: 'n10' was not declared in this scope; did you mean 'm10'?
8 | n10=other=0;
| ^~~
| m10
|
s724484005 | p03699 | C++ | #include <iostream>
#include <numeric>
#include <string>
#include <algorithm>
#include <vector>
#include <cstdlib>
#include <cmath>
#include <utility>
#include <functional>
#define repd(i,a,b); for (int i=(a);i<(b);i++)
#define rep(i,n) repd(i,0,n)
#define ll long long int
using namespace std;
int main() {
int n; cin >> n;
int s[n];
int sum = 0;
bool chk = true;
rep(i,n){
cin >> s[i];
if(s[i]%10 != 0){
chk = false;
sum += s[i];
}
if(chk){
cout << 0;
}
if ( sum % 10 != 0){
cout << sum;
exit(0);
}
rep(j,n){
if (s[j]%10 != 0){
cout << sum - s[j];
exit(0);
}
}
return 0;
} | a.cc: In function 'int main()':
a.cc:44:2: error: expected '}' at end of input
44 | }
| ^
a.cc:17:12: note: to match this '{'
17 | int main() {
| ^
|
s430348722 | p03699 | C++ | #include <iostream>
#include <numeric>
#include <string>
#include <algorithm>
#include <vector>
#include <cstdlib>
#include <cmath>
#include <utility>
#include <functional>
#define repd(i,a,b); for (int i=(a);i<(b);i++)
#define rep(i,n) repd(i,0,n)
#define ll long long int
using namespace std;
int main() {
int n; cin >> n;
int s[n];
int sum = 0;
bool chk == true;
rep(i,n){
cin >> s[i];
if(s[i]%10 != 0){
chk = false;
sum += s[i];
}
if(chk){
cout << 0;
}
if ( sum % 10 != 0){
cout << sum;
exit(0);
}
rep(j,n){
if (s[j]%10 != 0){
cout << sum - s[j];
exit(0);
}
}
return 0;
} | a.cc: In function 'int main()':
a.cc:21:11: error: expected initializer before '==' token
21 | bool chk == true;
| ^~
a.cc:25:6: error: 'chk' was not declared in this scope
25 | chk = false;
| ^~~
a.cc:28:5: error: 'chk' was not declared in this scope
28 | if(chk){
| ^~~
a.cc:44:2: error: expected '}' at end of input
44 | }
| ^
a.cc:17:12: note: to match this '{'
17 | int main() {
| ^
|
s579726418 | p03699 | C++ | #include<iostream>
#include<algorithm>
#include<vector>
using namespace std;
int main()
{
int n;
cin >> n;
int s[n];
int res = 0;
bool tf = false;
int not10 = 0;
for(int i=0;i<n;++i)
cin >> s[i];
sort(s,s+n);
for(int i=0;i<n;++i)
{
res += s[i];
if(tf == false && s[i]%10 != 0)
{
not10 = s[i];
tf = true;
}
}
if(res%10 == 0)
{
if(tf == true) res -= not10;
else res = 0;
}
cout << res << endl;
| a.cc: In function 'int main()':
a.cc:36:23: error: expected '}' at end of input
36 | cout << res << endl;
| ^
a.cc:7:1: note: to match this '{'
7 | {
| ^
|
s415420400 | p03699 | Java | import java.util.Arrays;
public class AtCoder {
private static java.util.Scanner scanner = new java.util.Scanner(System.in);
public static void main(String[] args) {
int n = scanner.nextInt(), a[] = new int[n], sum = 0;
for (int i = 0; i < n; i++)
sum += a[i] = scanner.nextInt();
if (sum % 10 == 0)
sum -= Arrays.stream(a)
.filter(i -> i % 10 != 0)
.min()
.orElse(0);
System.out.println(sum % 10 == 0 ? 0 : sum);
}
} | Main.java:3: error: class AtCoder is public, should be declared in a file named AtCoder.java
public class AtCoder {
^
1 error
|
s945706501 | p03699 | C++ | #include <iostream>
#include <vector>
using namespace std;
int main(void){
int n;
cin >> n;
int s[n];
for(int i = 0; i < n; i++) cin >> s[i];
sort(s, s + n);
int ans = 0;
for(int i = 0; i < n; i++) ans += s[i];
if(ans % 10 != 0) {
cout << ans << endl;
return 0;
}
int temp = -1;
for(int i = 0; i < n; i++){
if(s[i] % 10 != 0){
temp = s[i];
break;
}
}
if(temp != -1) {
cout << ans - temp << endl;
return 0;
}
cout << "0" << endl;
return 0;
}
| a.cc: In function 'int main()':
a.cc:10:3: error: 'sort' was not declared in this scope; did you mean 'short'?
10 | sort(s, s + n);
| ^~~~
| short
|
s229448788 | p03699 | C++ | #include <bits/stdc++.h>
using namespace std;
int main(){
int n;
cin>>n;
int s[n];
for(int i=0;i<n;i++){
cin>>s[i];}
sort(s,s+n);
int max=0;
for(int i=0,i<n;i++){
max+=s[i];}
int q=99999;
if(max%10==0){
for(int j=0;j<n;j++){
if(s[j]%10!=0){
q=j;
break;}
}
if(q==99999) cout<<0<<endl;
else cout<<max-s[q]<<endl;}
else cout<<max<<endl;
} | a.cc: In function 'int main()':
a.cc:16:16: error: expected ';' before '<' token
16 | for(int i=0,i<n;i++){
| ^
| ;
a.cc:16:16: error: expected primary-expression before '<' token
|
s405246372 | p03699 | C++ | #include<iostream>
#include<math.h>
using namespace std;
int main(){
int n;
cin >> n;
int s[n];
int sum = 0;
for(int i=0;i<n;i++){
cin >> s[i];
sum += s[i];
}
sort(s,s+n);
if(sum%10 == 0){
for(int i=0;i<n;i++){
if(s[i]%10==0)break;
else sum -= s[i];
}
}
if(sum%10 == 0)cout << "0" << endl;
else cout << sum << endl;
}
| a.cc: In function 'int main()':
a.cc:17:5: error: 'sort' was not declared in this scope; did you mean 'sqrt'?
17 | sort(s,s+n);
| ^~~~
| sqrt
|
s703113346 | p03699 | C++ | *
問題をよく読もう!
論理的に考えよう!
サンプルを確認しよう!
絶対に諦めるな!
工夫をしろ!
配列は少し多めにとっておく
Twitterは終わるまでログアウト!
(間違えて解法をツイートしてはいけないから)
*/
//include
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<iomanip>
#include<math.h>
#include<complex>
#include<queue>
#include<deque>
#include<stack>
#include<map>
#include<set>
#include<bitset>
#include<functional>
#include<assert.h>
#include<numeric>
#include<stdio.h>
#include<cstring>
//namespace
using namespace std;
//繰り返し
#define REP(i, m, n) for(int i=(int)m; i<(int)n; ++i)
#define rep(i, n) REP(i, 0, n)
//イテレータ
#define all_range(C) begin(C), end(C)
//簡略化
typedef long long ll;
typedef pair<int,int> pint;
typedef pair<ll,int> pli;
typedef pair<string,int> pst;
const int inf = 1e9+7;
const ll longinf = 1LL<<60;
const ll mod = 1e9+7;
//最大最小
template<typename T1, typename T2> inline void chmin(T1 &a, T2 b) {if(a>b) a=b;}
template<typename T1, typename T2> inline void chmax(T1 &a, T2 b) {if(a<b) a=b;}
//関数
//最大公約数を求める
ll my_gcd(ll x, ll y) {
ll r;
while(y!=0) {
r = x%y;
x = y;
y = r;
}
return x;
}
//最小公約数を求める
ll my_lcm(ll x, ll y) {
return (x*y)/my_gcd(x,y);
}
//xのy乗を求める ※参考:10^18乗まで
ll my_pow(ll x, ll y) {
ll sum = 1;
while(y>0) {
sum *= x;
}
return sum;
}
//main.cpp----------------------------
void solve();
ll dfs(ll i, ll sum);
ll n;
ll s[110];
ll dp[110][1000000];
int main() {
cin >> n;
rep(i, n) cin>> s[i];
memset(dp, -1, sizeof(dp));
solve();
return 0;
}
void solve() {
cout << dfs(0, 0) << endl;
return;
}
ll dfs(ll i, ll sum) {
if(dp[i][sum]>=0) return dp[i][sum];
if(i==n) {
if(sum%10!=0) return dp[i][sum] = sum;
else dp[i][sum] = 0;
}
int res1 = dfs(i+1, sum+s[i]);
int res2 = dfs(i+1, sum);
dp[i][sum] = max(res1, res2);
return dp[i][sum];
}
| a.cc:3:5: error: expected constructor, destructor, or type conversion before '\U00008ad6\U00007406\U00007684\U0000306b\U00008003\U00003048\U00003088\U00003046\U0000ff01'
3 | 論理的に考えよう!
| ^~~~~~~~~~~~~~~~~~
In file included from /usr/include/c++/14/iosfwd:42,
from /usr/include/c++/14/ios:40,
from /usr/include/c++/14/ostream:40,
from /usr/include/c++/14/iostream:41,
from a.cc:14:
/usr/include/c++/14/bits/postypes.h:68:11: error: 'ptrdiff_t' does not name a type
68 | typedef ptrdiff_t streamsize; // Signed integral type
| ^~~~~~~~~
/usr/include/c++/14/bits/postypes.h:41:1: note: 'ptrdiff_t' is defined in header '<cstddef>'; this is probably fixable by adding '#include <cstddef>'
40 | #include <cwchar> // For mbstate_t
+++ |+#include <cstddef>
41 |
In file included from /usr/include/c++/14/bits/exception_ptr.h:38,
from /usr/include/c++/14/exception:166,
from /usr/include/c++/14/ios:41:
/usr/include/c++/14/new:131:26: error: declaration of 'operator new' as non-function
131 | _GLIBCXX_NODISCARD void* operator new(std::size_t) _GLIBCXX_THROW (std::bad_alloc)
| ^~~~~~~~
/usr/include/c++/14/new:131:44: error: 'size_t' is not a member of 'std'; did you mean 'size_t'?
131 | _GLIBCXX_NODISCARD void* operator new(std::size_t) _GLIBCXX_THROW (std::bad_alloc)
| ^~~~~~
In file included from /usr/include/wchar.h:35,
from /usr/include/c++/14/cwchar:44,
from /usr/include/c++/14/bits/postypes.h:40:
/usr/lib/gcc/x86_64-linux-gnu/14/include/stddef.h:214:23: note: 'size_t' declared here
214 | typedef __SIZE_TYPE__ size_t;
| ^~~~~~
/usr/include/c++/14/new:132:41: error: attributes after parenthesized initializer ignored [-fpermissive]
132 | __attribute__((__externally_visible__));
| ^
/usr/include/c++/14/new:133:26: error: declaration of 'operator new []' as non-function
133 | _GLIBCXX_NODISCARD void* operator new[](std::size_t) _GLIBCXX_THROW (std::bad_alloc)
| ^~~~~~~~
/usr/include/c++/14/new:133:46: error: 'size_t' is not a member of 'std'; did you mean 'size_t'?
133 | _GLIBCXX_NODISCARD void* operator new[](std::size_t) _GLIBCXX_THROW (std::bad_alloc)
| ^~~~~~
/usr/lib/gcc/x86_64-linux-gnu/14/include/stddef.h:214:23: note: 'size_t' declared here
214 | typedef __SIZE_TYPE__ size_t;
| ^~~~~~
/usr/include/c++/14/new:134:41: error: attributes after parenthesized initializer ignored [-fpermissive]
134 | __attribute__((__externally_visible__));
| ^
/usr/include/c++/14/new:140:29: error: 'std::size_t' has not been declared
140 | void operator delete(void*, std::size_t) _GLIBCXX_USE_NOEXCEPT
| ^~~
/usr/include/c++/14/new:142:31: error: 'std::size_t' has not been declared
142 | void operator delete[](void*, std::size_t) _GLIBCXX_USE_NOEXCEPT
| ^~~
/usr/include/c++/14/new:145:26: error: declaration of 'operator new' as non-function
145 | _GLIBCXX_NODISCARD void* operator new(std::size_t, const std::nothrow_t&) _GLIBCXX_USE_NOEXCEPT
| ^~~~~~~~
/usr/include/c++/14/new:145:44: error: 'size_t' is not a member of 'std'; did you mean 'size_t'?
145 | _GLIBCXX_NODISCARD void* operator new(std::size_t, const std::nothrow_t&) _GLIBCXX_USE_NOEXCEPT
| ^~~~~~
/usr/lib/gcc/x86_64-linux-gnu/14/include/stddef.h:214:23: note: 'size_t' declared here
214 | typedef __SIZE_TYPE__ size_t;
| ^~~~~~
/usr/include/c++/14/new:145:52: error: expected primary-expression before 'const'
145 | _GLIBCXX_NODISCARD void* operator new(std::size_t, const std::nothrow_t&) _GLIBCXX_USE_NOEXCEPT
| ^~~~~
/usr/include/c++/14/new:147:26: error: declaration of 'operator new []' as non-function
147 | _GLIBCXX_NODISCARD void* operator new[](std::size_t, const std::nothrow_t&) _GLIBCXX_USE_NOEXCEPT
| ^~~~~~~~
/usr/include/c++/14/new:147:46: error: 'size_t' is not a member of 'std'; did you mean 'size_t'?
147 | _GLIBCXX_NODISCARD void* operator new[](std::size_t, const std::nothrow_t&) _GLIBCXX_USE_NOEXCEPT
| ^~~~~~
/usr/lib/gcc/x86_64-linux-gnu/14/include/stddef.h:214:23: note: 'size_t' declared here
214 | typedef __SIZE_TYPE__ size_t;
| ^~~~~~
/usr/include/c++/14/new:147:54: error: expected primary-expression before 'const'
147 | _GLIBCXX_NODISCARD void* operator new[](std::size_t, const std::nothrow_t&) _GLIBCXX_USE_NOEXCEPT
| ^~~~~
/usr/include/c++/14/new:154:26: error: declaration of 'operator new' as non-function
154 | _GLIBCXX_NODISCARD void* operator new(std::size_t, std::align_val_t)
| ^~~~~~~~
/usr/include/c++/14/new:154:44: error: 'size_t' is not a member of 'std'; did you mean 'size_t'?
154 | _GLIBCXX_NODISCARD void* operator new(std::size_t, std::align_val_t)
| ^~~~~~
/usr/lib/gcc/x86_64-linux-gnu/14/include/stddef.h:214:23: note: 'size_t' declared here
214 | typedef __SIZE_TYPE__ size_t;
| ^~~~~~
/usr/include/c++/14/new:154:68: error: expected primary-expression before ')' token
154 | _GLIBCXX_NODISCARD void* operator new(std::size_t, std::align_val_t)
| ^
/usr/include/c++/14/new:155:73: error: attributes after parenthesized initializer ignored [-fpermissive]
155 | __attribute__((__externally_visible__, __alloc_size__ (1), __malloc__));
| ^
/usr/include/c++/14/new:156:26: error: declaration of 'operator new' as non-function
156 | _GLIBCXX_NODISCARD void* operator new(std::size_t, std::align_val_t, const std::nothrow_t&)
| ^~~~~~~~
/usr/include/c++/14/new:156:44: error: 'size_t' is not a member of 'std'; did you mean 'size_t'?
156 | _GLIBCXX_NODISCARD void* operator new(std::size_t, std::align_val_t, const std::nothrow_t&)
| ^~~~~~
/usr/lib/gcc/x86_64-linux-gnu/14/include/stddef.h:214:23: note: 'size_t' declared here
214 | typedef __SIZE_TYPE__ size_t;
| ^~~~~~
/usr/include/c++/14/new:156:68: error: expected primary-expression before ',' token
156 | _GLIBCXX_NODISCARD void* operator new(std::size_t, std::align_val_t, const std::nothrow_t&)
| ^
/usr/include/c++/14/new:156:70: error: expected primary-expression before 'const'
156 | _GLIBCXX_NODISCARD void* operator new(std::size_t, std::align_val_t, const std::nothrow_t&)
| ^~~~~
/usr/include/c++/14/new:162:26: error: declaration of 'operator new []' as non-function
162 | _GLIBCXX_NODISCARD void* operator new[](std::size_t, std::align_val_t)
| ^~~~~~~~
/usr/include/c++/14/new:162:46: error: 'size_t' is not a member of 'std'; did you mean 'size_t'?
162 | _GLIBCXX_NODISCARD void* operator new[](std::size_t, std::align_val_t)
| ^~~~~~
/usr/lib/gcc/x86_64-linux-gnu/14/include/stddef.h:214:23: note: 'size_t' declared here
214 | typedef __SIZE_TYPE__ size_t;
| ^~~~~~
/usr/include/c++/14/new:162:70: error: expected primary-expression before ')' token
162 | _GLIBCXX_NODISCARD void* operator new[](std::size_t, std::align_val_t)
| ^
/usr/include/c++/14/new:163:73: error: attributes after parenthesized initializer ignored [-fpermissive]
163 | __attribute__((__externally_visible__, __alloc_size__ (1), __malloc__));
| ^
/usr/include/c++/14/new:164:26: error: declaration of 'operator new []' as non-function
164 | _GLIBCXX_NODISCARD void* operator new[](std::size_t, std::align_val_t, const std::nothrow_t&)
| ^~~~~~~~
/usr/include/c++/14/new:164:46: error: 'size_t' is not a member of 'std'; did you mean 'size_t'?
164 | _GLIBCXX_NODISCARD void* operator new[](std::size_t, std::align_val_t, const std::nothrow_t&)
| ^~~~~~
/usr/lib/gcc/x86_64-linux-gnu/14/include/stddef.h:214:23: note: 'size_t' declared here
214 | typedef __SIZE_TYPE__ size_t;
| ^~~~~~
/usr/include/c++/14/new:164:70: error: expected primary-expression before ',' token
164 | _GLIBCXX_NODISCARD void* operator new[](std::size_t, std::align_val_t, const std::nothrow_t&)
| ^
/usr/include/c++/14/new:164:72: error: expected primary-expression before 'const'
164 | _GLIBCXX_NODISCARD void* operator new[](std::size_t, std::align_val_t, const std::nothrow_t&)
| ^~~~~
/usr/include/c++/14/new:171:29: error: 'std::size_t' has not been declared
171 | void operator delete(void*, std::size_t, std::align_val_t)
| ^~~
/usr/include/c++/14/new:173:31: error: 'std::size_t' has not been declared
173 | void operator delete[](void*, std::size_t, std::align_val_t)
| ^~~
/usr/include/c++/14/new:179:33: error: declaration of 'operator new' as non-function
179 | _GLIBCXX_NODISCARD inline void* operator new(std::size_t, void* __p) _GLIBCXX_USE_NOEXCEPT
| |
s164566041 | p03699 | C++ | //*
問題をよく読もう!
論理的に考えよう!
サンプルを確認しよう!
絶対に諦めるな!
工夫をしろ!
配列は少し多めにとっておく
Twitterは終わるまでログアウト!
(間違えて解法をツイートしてはいけないから)
*/
//include
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<iomanip>
#include<math.h>
#include<complex>
#include<queue>
#include<deque>
#include<stack>
#include<map>
#include<set>
#include<bitset>
#include<functional>
#include<assert.h>
#include<numeric>
#include<stdio.h>
//namespace
using namespace std;
//繰り返し
#define REP(i, m, n) for(int i=(int)m; i<(int)n; ++i)
#define rep(i, n) REP(i, 0, n)
//イテレータ
#define all_range(C) begin(C), end(C)
//簡略化
typedef long long ll;
typedef pair<int,int> pint;
typedef pair<ll,int> pli;
typedef pair<string,int> pst;
const int inf = 1e9+7;
const ll longinf = 1LL<<60;
const ll mod = 1e9+7;
//最大最小
template<typename T1, typename T2> inline void chmin(T1 &a, T2 b) {if(a>b) a=b;}
template<typename T1, typename T2> inline void chmax(T1 &a, T2 b) {if(a<b) a=b;}
//関数
//最大公約数を求める
ll my_gcd(ll x, ll y) {
ll r;
while(y!=0) {
r = x%y;
x = y;
y = r;
}
return x;
}
//最小公約数を求める
ll my_lcm(ll x, ll y) {
return (x*y)/my_gcd(x,y);
}
//xのy乗を求める ※参考:10^18乗まで
ll my_pow(ll x, ll y) {
ll sum = 1;
while(y>0) {
sum *= x;
}
return sum;
}
//main.cpp----------------------------
void solve();
ll dfs(ll i, ll sum);
ll n;
ll s[110];
int main() {
cin >> n;
rep(i, n) cin>> s[i];
solve();
return 0;
}
void solve() {
ll sum = 0;
rep(i, n) sum += s[i];
sort(s, s+n);
if(sum%10!=0) {
cout << sum << endl;
return;
}
rep(i, n) {
if(s[i]%10!=0) {
cout << sum-s[i] << endl;
return;
}
}
cout << 0 << endl;
return;
} | a.cc:2:5: error: '\U0000554f\U0000984c\U00003092\U00003088\U0000304f\U00008aad\U00003082\U00003046\U0000ff01' does not name a type
2 | 問題をよく読もう!
| ^~~~~~~~~~~~~~~~~~
In file included from /usr/include/c++/14/iosfwd:42,
from /usr/include/c++/14/ios:40,
from /usr/include/c++/14/ostream:40,
from /usr/include/c++/14/iostream:41,
from a.cc:14:
/usr/include/c++/14/bits/postypes.h:68:11: error: 'ptrdiff_t' does not name a type
68 | typedef ptrdiff_t streamsize; // Signed integral type
| ^~~~~~~~~
/usr/include/c++/14/bits/postypes.h:41:1: note: 'ptrdiff_t' is defined in header '<cstddef>'; this is probably fixable by adding '#include <cstddef>'
40 | #include <cwchar> // For mbstate_t
+++ |+#include <cstddef>
41 |
In file included from /usr/include/c++/14/bits/exception_ptr.h:38,
from /usr/include/c++/14/exception:166,
from /usr/include/c++/14/ios:41:
/usr/include/c++/14/new:131:26: error: declaration of 'operator new' as non-function
131 | _GLIBCXX_NODISCARD void* operator new(std::size_t) _GLIBCXX_THROW (std::bad_alloc)
| ^~~~~~~~
/usr/include/c++/14/new:131:44: error: 'size_t' is not a member of 'std'; did you mean 'size_t'?
131 | _GLIBCXX_NODISCARD void* operator new(std::size_t) _GLIBCXX_THROW (std::bad_alloc)
| ^~~~~~
In file included from /usr/include/wchar.h:35,
from /usr/include/c++/14/cwchar:44,
from /usr/include/c++/14/bits/postypes.h:40:
/usr/lib/gcc/x86_64-linux-gnu/14/include/stddef.h:214:23: note: 'size_t' declared here
214 | typedef __SIZE_TYPE__ size_t;
| ^~~~~~
/usr/include/c++/14/new:132:41: error: attributes after parenthesized initializer ignored [-fpermissive]
132 | __attribute__((__externally_visible__));
| ^
/usr/include/c++/14/new:133:26: error: declaration of 'operator new []' as non-function
133 | _GLIBCXX_NODISCARD void* operator new[](std::size_t) _GLIBCXX_THROW (std::bad_alloc)
| ^~~~~~~~
/usr/include/c++/14/new:133:46: error: 'size_t' is not a member of 'std'; did you mean 'size_t'?
133 | _GLIBCXX_NODISCARD void* operator new[](std::size_t) _GLIBCXX_THROW (std::bad_alloc)
| ^~~~~~
/usr/lib/gcc/x86_64-linux-gnu/14/include/stddef.h:214:23: note: 'size_t' declared here
214 | typedef __SIZE_TYPE__ size_t;
| ^~~~~~
/usr/include/c++/14/new:134:41: error: attributes after parenthesized initializer ignored [-fpermissive]
134 | __attribute__((__externally_visible__));
| ^
/usr/include/c++/14/new:140:29: error: 'std::size_t' has not been declared
140 | void operator delete(void*, std::size_t) _GLIBCXX_USE_NOEXCEPT
| ^~~
/usr/include/c++/14/new:142:31: error: 'std::size_t' has not been declared
142 | void operator delete[](void*, std::size_t) _GLIBCXX_USE_NOEXCEPT
| ^~~
/usr/include/c++/14/new:145:26: error: declaration of 'operator new' as non-function
145 | _GLIBCXX_NODISCARD void* operator new(std::size_t, const std::nothrow_t&) _GLIBCXX_USE_NOEXCEPT
| ^~~~~~~~
/usr/include/c++/14/new:145:44: error: 'size_t' is not a member of 'std'; did you mean 'size_t'?
145 | _GLIBCXX_NODISCARD void* operator new(std::size_t, const std::nothrow_t&) _GLIBCXX_USE_NOEXCEPT
| ^~~~~~
/usr/lib/gcc/x86_64-linux-gnu/14/include/stddef.h:214:23: note: 'size_t' declared here
214 | typedef __SIZE_TYPE__ size_t;
| ^~~~~~
/usr/include/c++/14/new:145:52: error: expected primary-expression before 'const'
145 | _GLIBCXX_NODISCARD void* operator new(std::size_t, const std::nothrow_t&) _GLIBCXX_USE_NOEXCEPT
| ^~~~~
/usr/include/c++/14/new:147:26: error: declaration of 'operator new []' as non-function
147 | _GLIBCXX_NODISCARD void* operator new[](std::size_t, const std::nothrow_t&) _GLIBCXX_USE_NOEXCEPT
| ^~~~~~~~
/usr/include/c++/14/new:147:46: error: 'size_t' is not a member of 'std'; did you mean 'size_t'?
147 | _GLIBCXX_NODISCARD void* operator new[](std::size_t, const std::nothrow_t&) _GLIBCXX_USE_NOEXCEPT
| ^~~~~~
/usr/lib/gcc/x86_64-linux-gnu/14/include/stddef.h:214:23: note: 'size_t' declared here
214 | typedef __SIZE_TYPE__ size_t;
| ^~~~~~
/usr/include/c++/14/new:147:54: error: expected primary-expression before 'const'
147 | _GLIBCXX_NODISCARD void* operator new[](std::size_t, const std::nothrow_t&) _GLIBCXX_USE_NOEXCEPT
| ^~~~~
/usr/include/c++/14/new:154:26: error: declaration of 'operator new' as non-function
154 | _GLIBCXX_NODISCARD void* operator new(std::size_t, std::align_val_t)
| ^~~~~~~~
/usr/include/c++/14/new:154:44: error: 'size_t' is not a member of 'std'; did you mean 'size_t'?
154 | _GLIBCXX_NODISCARD void* operator new(std::size_t, std::align_val_t)
| ^~~~~~
/usr/lib/gcc/x86_64-linux-gnu/14/include/stddef.h:214:23: note: 'size_t' declared here
214 | typedef __SIZE_TYPE__ size_t;
| ^~~~~~
/usr/include/c++/14/new:154:68: error: expected primary-expression before ')' token
154 | _GLIBCXX_NODISCARD void* operator new(std::size_t, std::align_val_t)
| ^
/usr/include/c++/14/new:155:73: error: attributes after parenthesized initializer ignored [-fpermissive]
155 | __attribute__((__externally_visible__, __alloc_size__ (1), __malloc__));
| ^
/usr/include/c++/14/new:156:26: error: declaration of 'operator new' as non-function
156 | _GLIBCXX_NODISCARD void* operator new(std::size_t, std::align_val_t, const std::nothrow_t&)
| ^~~~~~~~
/usr/include/c++/14/new:156:44: error: 'size_t' is not a member of 'std'; did you mean 'size_t'?
156 | _GLIBCXX_NODISCARD void* operator new(std::size_t, std::align_val_t, const std::nothrow_t&)
| ^~~~~~
/usr/lib/gcc/x86_64-linux-gnu/14/include/stddef.h:214:23: note: 'size_t' declared here
214 | typedef __SIZE_TYPE__ size_t;
| ^~~~~~
/usr/include/c++/14/new:156:68: error: expected primary-expression before ',' token
156 | _GLIBCXX_NODISCARD void* operator new(std::size_t, std::align_val_t, const std::nothrow_t&)
| ^
/usr/include/c++/14/new:156:70: error: expected primary-expression before 'const'
156 | _GLIBCXX_NODISCARD void* operator new(std::size_t, std::align_val_t, const std::nothrow_t&)
| ^~~~~
/usr/include/c++/14/new:162:26: error: declaration of 'operator new []' as non-function
162 | _GLIBCXX_NODISCARD void* operator new[](std::size_t, std::align_val_t)
| ^~~~~~~~
/usr/include/c++/14/new:162:46: error: 'size_t' is not a member of 'std'; did you mean 'size_t'?
162 | _GLIBCXX_NODISCARD void* operator new[](std::size_t, std::align_val_t)
| ^~~~~~
/usr/lib/gcc/x86_64-linux-gnu/14/include/stddef.h:214:23: note: 'size_t' declared here
214 | typedef __SIZE_TYPE__ size_t;
| ^~~~~~
/usr/include/c++/14/new:162:70: error: expected primary-expression before ')' token
162 | _GLIBCXX_NODISCARD void* operator new[](std::size_t, std::align_val_t)
| ^
/usr/include/c++/14/new:163:73: error: attributes after parenthesized initializer ignored [-fpermissive]
163 | __attribute__((__externally_visible__, __alloc_size__ (1), __malloc__));
| ^
/usr/include/c++/14/new:164:26: error: declaration of 'operator new []' as non-function
164 | _GLIBCXX_NODISCARD void* operator new[](std::size_t, std::align_val_t, const std::nothrow_t&)
| ^~~~~~~~
/usr/include/c++/14/new:164:46: error: 'size_t' is not a member of 'std'; did you mean 'size_t'?
164 | _GLIBCXX_NODISCARD void* operator new[](std::size_t, std::align_val_t, const std::nothrow_t&)
| ^~~~~~
/usr/lib/gcc/x86_64-linux-gnu/14/include/stddef.h:214:23: note: 'size_t' declared here
214 | typedef __SIZE_TYPE__ size_t;
| ^~~~~~
/usr/include/c++/14/new:164:70: error: expected primary-expression before ',' token
164 | _GLIBCXX_NODISCARD void* operator new[](std::size_t, std::align_val_t, const std::nothrow_t&)
| ^
/usr/include/c++/14/new:164:72: error: expected primary-expression before 'const'
164 | _GLIBCXX_NODISCARD void* operator new[](std::size_t, std::align_val_t, const std::nothrow_t&)
| ^~~~~
/usr/include/c++/14/new:171:29: error: 'std::size_t' has not been declared
171 | void operator delete(void*, std::size_t, std::align_val_t)
| ^~~
/usr/include/c++/14/new:173:31: error: 'std::size_t' has not been declared
173 | void operator delete[](void*, std::size_t, std::align_val_t)
| ^~~
/usr/include/c++/14/new:179:33: error: declaration of 'operator new' as non-function
179 | _GLIBCXX_NODISCARD inline void* operator new(std::size_t, void* __p) _GLIBCXX_USE_NOEXCEPT
| ^~~~~~~~
/ |
s465780568 | p03699 | C++ | #include <bits/stdc++.h>
#define repd(i,a,b) for (int i=(a);i<(b);i++)
#define rep(i,n) repd(i,0,n)
#define int long long
typedef long long ll;
using namespace std;
const int MOD = 1000000007;
const int INF = 1010000000;
const double EPS = 1e-10;
const pair<int,int> fd[] = {make_pair(1,0),make_pair(-1,0),make_pair(0,1),make_pair(0,-1)};
signed main(){
int n;cin>>n;int mint = INF, ans = 0;
rep(i,n){
int s;cin>>s;
ans += s;
if(mint > s && s % 10 != 0)mint = s;
}
cout << max(0, (ans % 10 ? ans : ans - mint)) << endl;
}
| a.cc: In function 'int main()':
a.cc:20:14: error: no matching function for call to 'max(int, long long int)'
20 | cout << max(0, (ans % 10 ? ans : ans - mint)) << endl;
| ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from /usr/include/c++/14/algorithm:60,
from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:51,
from a.cc:1:
/usr/include/c++/14/bits/stl_algobase.h:257:5: note: candidate: 'template<class _Tp> constexpr const _Tp& std::max(const _Tp&, const _Tp&)'
257 | max(const _Tp& __a, const _Tp& __b)
| ^~~
/usr/include/c++/14/bits/stl_algobase.h:257:5: note: template argument deduction/substitution failed:
a.cc:20:14: note: deduced conflicting types for parameter 'const _Tp' ('int' and 'long long int')
20 | cout << max(0, (ans % 10 ? ans : ans - mint)) << endl;
| ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_algobase.h:303:5: note: candidate: 'template<class _Tp, class _Compare> constexpr const _Tp& std::max(const _Tp&, const _Tp&, _Compare)'
303 | max(const _Tp& __a, const _Tp& __b, _Compare __comp)
| ^~~
/usr/include/c++/14/bits/stl_algobase.h:303:5: note: candidate expects 3 arguments, 2 provided
In file included from /usr/include/c++/14/algorithm:61:
/usr/include/c++/14/bits/stl_algo.h:5706:5: note: candidate: 'template<class _Tp> constexpr _Tp std::max(initializer_list<_Tp>)'
5706 | max(initializer_list<_Tp> __l)
| ^~~
/usr/include/c++/14/bits/stl_algo.h:5706:5: note: candidate expects 1 argument, 2 provided
/usr/include/c++/14/bits/stl_algo.h:5716:5: note: candidate: 'template<class _Tp, class _Compare> constexpr _Tp std::max(initializer_list<_Tp>, _Compare)'
5716 | max(initializer_list<_Tp> __l, _Compare __comp)
| ^~~
/usr/include/c++/14/bits/stl_algo.h:5716:5: note: template argument deduction/substitution failed:
a.cc:20:14: note: mismatched types 'std::initializer_list<_Tp>' and 'int'
20 | cout << max(0, (ans % 10 ? ans : ans - mint)) << endl;
| ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
s927559085 | p03699 | C++ | #include <iostream>
using namespace std;
typedef long long ll;
const int INF = 1000100000;
#define rep(i,n) for(int i=0;i<n;++i)
int main(){
ll n;
cin >>n;
int s[n];
int ans=0;
rep(i,n){
cin >> s[i];
ans+=s[i];
}
sort(s,s+n);
if(ans%10!=0)cout << ans << endl;
else{
int hiku=0;
rep(i,n){
if(s[i]%10!=0){
hiku=s[i];
break;
}
}
if(hiku==0)ans=0;
else ans-=hiku;
cout << ans << endl;
}
}
| a.cc: In function 'int main()':
a.cc:16:3: error: 'sort' was not declared in this scope; did you mean 'short'?
16 | sort(s,s+n);
| ^~~~
| short
|
s535865582 | p03699 | C++ | N=int(input())
s=[int(input()) for i in range(N)]
ans=sum(s)
s.sort()
if ans%10!=0:
print(ans)
else:
for i in range(N):
if(ans-s[i])%10!=0:
ans-=s[i]
break
if ans%10==0:
print(0)
else:
print(ans) | a.cc:1:1: error: 'N' does not name a type
1 | N=int(input())
| ^
|
s963657566 | p03699 | C++ | n=int(input())
s=[int(input()) for i in range(n)]
if sum(s)%10!=0:
print(sum(s))
else:
l=[]
for j in range(n):
if s[j]%10!=0:
l.append(s[j])
if len(l)==0:
print(0)
else:
print(sum(s)-min(l)) | a.cc:1:1: error: 'n' does not name a type
1 | n=int(input())
| ^
|
s439091915 | p03699 | C++ | import java.util.Arrays;
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
new Main().execute();
}
public void execute() {
Scanner sc = new Scanner(System.in);
final int N = sc.nextInt();
int[] score = new int[N];
int grandTotal = 0;
for (int i = 0; i < N; i++) {
score[i] = sc.nextInt();
grandTotal += score[i];
}
if (grandTotal % 10 != 0) {
System.out.println(grandTotal);
return;
} else {
Arrays.sort(score);
for (int i = 0; i < N; i++) {
if (score[i] % 10 != 0) {
System.out.println(grandTotal - score[i]);
return;
}
}
}
System.out.println(0);
sc.close();
}
}
| a.cc:1:1: error: 'import' does not name a type
1 | import java.util.Arrays;
| ^~~~~~
a.cc:1:1: note: C++20 'import' only available with '-fmodules-ts'
a.cc:2:1: error: 'import' does not name a type
2 | import java.util.Scanner;
| ^~~~~~
a.cc:2:1: note: C++20 'import' only available with '-fmodules-ts'
a.cc:4:1: error: expected unqualified-id before 'public'
4 | public class Main {
| ^~~~~~
|
s471836463 | p03699 | C++ | #include <bits/stdc++.h>
using namespace std;
int main(){
int n,array[100],ans=0;
vector<int> not10;
cin>>n;
for(int i=0;i<n;i++){
cin>>array[i];
if(array[i]%10){
not10.push_back(array[i]);
}
ans+=array[i];
}
if(ans%10){
cout<<ans<<enbdl;
return 0;
}
if(not10.size()==0){
cout<<0<<endl;
return 0;
}
sort(not10.begin(),not10.end());
cout<<ans-not10[0]<<endl;
}
| a.cc: In function 'int main()':
a.cc:16:16: error: 'enbdl' was not declared in this scope
16 | cout<<ans<<enbdl;
| ^~~~~
|
s364790008 | p03699 | C++ | #include<bits/stdc++.h>
using namespace std;
int main(){
int n,sum=0;cin>>n;
vector<int> s(n);
for(int i=0;i<n;i++){
cin>>s[i];
sum+=s[i];
}
sort(s.begin(),s,end());
if(sum%10==0){
for(int i=0;i<n;i++){
sum-=s[i];
if(sum%10!=0) break;
sum+=s[i];
}
}
cout<<sum<<endl;
} | a.cc: In function 'int main()':
a.cc:10:23: error: no matching function for call to 'end()'
10 | sort(s.begin(),s,end());
| ~~~^~
In file included from /usr/include/c++/14/bits/algorithmfwd.h:39,
from /usr/include/c++/14/bits/stl_algo.h:59,
from /usr/include/c++/14/algorithm:61,
from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:51,
from a.cc:1:
/usr/include/c++/14/initializer_list:99:5: note: candidate: 'template<class _Tp> constexpr const _Tp* std::end(initializer_list<_Tp>)'
99 | end(initializer_list<_Tp> __ils) noexcept
| ^~~
/usr/include/c++/14/initializer_list:99:5: note: candidate expects 1 argument, 0 provided
In file included from /usr/include/c++/14/string:53,
from /usr/include/c++/14/bitset:52,
from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:52:
/usr/include/c++/14/bits/range_access.h:74:5: note: candidate: 'template<class _Container> constexpr decltype (__cont.end()) std::end(_Container&)'
74 | end(_Container& __cont) -> decltype(__cont.end())
| ^~~
/usr/include/c++/14/bits/range_access.h:74:5: note: candidate expects 1 argument, 0 provided
/usr/include/c++/14/bits/range_access.h:85:5: note: candidate: 'template<class _Container> constexpr decltype (__cont.end()) std::end(const _Container&)'
85 | end(const _Container& __cont) -> decltype(__cont.end())
| ^~~
/usr/include/c++/14/bits/range_access.h:85:5: note: candidate expects 1 argument, 0 provided
/usr/include/c++/14/bits/range_access.h:106:5: note: candidate: 'template<class _Tp, long unsigned int _Nm> constexpr _Tp* std::end(_Tp (&)[_Nm])'
106 | end(_Tp (&__arr)[_Nm]) noexcept
| ^~~
/usr/include/c++/14/bits/range_access.h:106:5: note: candidate expects 1 argument, 0 provided
In file included from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:166:
/usr/include/c++/14/valarray:1249:5: note: candidate: 'template<class _Tp> _Tp* std::end(valarray<_Tp>&)'
1249 | end(valarray<_Tp>& __va) noexcept
| ^~~
/usr/include/c++/14/valarray:1249:5: note: candidate expects 1 argument, 0 provided
/usr/include/c++/14/valarray:1265:5: note: candidate: 'template<class _Tp> const _Tp* std::end(const valarray<_Tp>&)'
1265 | end(const valarray<_Tp>& __va) noexcept
| ^~~
/usr/include/c++/14/valarray:1265:5: note: candidate expects 1 argument, 0 provided
|
s362309563 | p03699 | C++ | #include<iostream>
#include <algorithm>
#include<string>
#include <bitset>
#include <vector>
#include <functional>
#include <climits>
#include <iomanip>
#include <utility>
#include <stack>
using namespace std;
using ll = long long;
int main()
{
ll a, b, c = 0, d;
cin >> a;
ll s[1000];
for (int i = 0; i < a; i++)
{
cin >> s[i];
}
sort(s, s + a);
for (int i = 0; i < a; i++)
{
c += c[i];
}
if (c % 10 == 0)
{
for (int i = 0; i < a; i++)
{
if (s[i]%10!=0)
{
c -= s[i];
cout << c << endl;
return 0;
}
}
cout << 0 << endl;
return 0;
}
cout << c << endl;
return 0;
} | a.cc: In function 'int main()':
a.cc:27:23: error: invalid types 'll {aka long long int}[int]' for array subscript
27 | c += c[i];
| ^
|
s329923568 | p03699 | C++ | #include <bits/stdc++.h>
using namespace std;
int main() {
ios_base::sync_with_stdio(false);
cin.tie(NULL);
int n;
cin >> n;
int sum = 0;
set<int> s;
for (int i = 0; i < n; ++i) {
int score;
cin >> score;
s.insert(score);
sum += score;
}
if (sum % 10 != 0) {
cout << sum << "\n";
return 0;
}
sort(s.begin(), s.end());
for (auto& e : s) {
if (e % 10 == 0) continue;
cout << sum - e << "\n";
return 0;
}
cout << "0\n";
}
| In file included from /usr/include/c++/14/algorithm:61,
from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:51,
from a.cc:1:
/usr/include/c++/14/bits/stl_algo.h: In instantiation of 'void std::__sort(_RandomAccessIterator, _RandomAccessIterator, _Compare) [with _RandomAccessIterator = _Rb_tree_const_iterator<int>; _Compare = __gnu_cxx::__ops::_Iter_less_iter]':
/usr/include/c++/14/bits/stl_algo.h:4772:18: required from 'void std::sort(_RAIter, _RAIter) [with _RAIter = _Rb_tree_const_iterator<int>]'
4772 | std::__sort(__first, __last, __gnu_cxx::__ops::__iter_less_iter());
| ~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
a.cc:23:7: required from here
23 | sort(s.begin(), s.end());
| ~~~~^~~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_algo.h:1906:50: error: no match for 'operator-' (operand types are 'std::_Rb_tree_const_iterator<int>' and 'std::_Rb_tree_const_iterator<int>')
1906 | std::__lg(__last - __first) * 2,
| ~~~~~~~^~~~~~~~~
In file included from /usr/include/c++/14/bits/stl_algobase.h:67,
from /usr/include/c++/14/algorithm:60:
/usr/include/c++/14/bits/stl_iterator.h:618:5: note: candidate: 'template<class _IteratorL, class _IteratorR> constexpr decltype ((__y.base() - __x.base())) std::operator-(const reverse_iterator<_Iterator>&, const reverse_iterator<_IteratorR>&)'
618 | operator-(const reverse_iterator<_IteratorL>& __x,
| ^~~~~~~~
/usr/include/c++/14/bits/stl_iterator.h:618:5: note: template argument deduction/substitution failed:
/usr/include/c++/14/bits/stl_algo.h:1906:50: note: 'std::_Rb_tree_const_iterator<int>' is not derived from 'const std::reverse_iterator<_Iterator>'
1906 | std::__lg(__last - __first) * 2,
| ~~~~~~~^~~~~~~~~
/usr/include/c++/14/bits/stl_iterator.h:1790:5: note: candidate: 'template<class _IteratorL, class _IteratorR> constexpr decltype ((__x.base() - __y.base())) std::operator-(const move_iterator<_IteratorL>&, const move_iterator<_IteratorR>&)'
1790 | operator-(const move_iterator<_IteratorL>& __x,
| ^~~~~~~~
/usr/include/c++/14/bits/stl_iterator.h:1790:5: note: template argument deduction/substitution failed:
/usr/include/c++/14/bits/stl_algo.h:1906:50: note: 'std::_Rb_tree_const_iterator<int>' is not derived from 'const std::move_iterator<_IteratorL>'
1906 | std::__lg(__last - __first) * 2,
| ~~~~~~~^~~~~~~~~
In file included from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:166:
/usr/include/c++/14/valarray:1197:1: note: candidate: 'template<class _Tp> std::_Expr<std::__detail::_BinClos<std::__minus, std::_Constant, std::_ValArray, _Tp, _Tp>, typename std::__fun<std::__minus, _Tp>::result_type> std::operator-(const typename valarray<_Tp>::value_type&, const valarray<_Tp>&)'
1197 | _DEFINE_BINARY_OPERATOR(-, __minus)
| ^~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/valarray:1197:1: note: template argument deduction/substitution failed:
/usr/include/c++/14/bits/stl_algo.h:1906:50: note: 'std::_Rb_tree_const_iterator<int>' is not derived from 'const std::valarray<_Tp>'
1906 | std::__lg(__last - __first) * 2,
| ~~~~~~~^~~~~~~~~
/usr/include/c++/14/valarray:1197:1: note: candidate: 'template<class _Tp> std::_Expr<std::__detail::_BinClos<std::__minus, std::_ValArray, std::_Constant, _Tp, _Tp>, typename std::__fun<std::__minus, _Tp>::result_type> std::operator-(const valarray<_Tp>&, const typename valarray<_Tp>::value_type&)'
1197 | _DEFINE_BINARY_OPERATOR(-, __minus)
| ^~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/valarray:1197:1: note: template argument deduction/substitution failed:
/usr/include/c++/14/bits/stl_algo.h:1906:50: note: 'std::_Rb_tree_const_iterator<int>' is not derived from 'const std::valarray<_Tp>'
1906 | std::__lg(__last - __first) * 2,
| ~~~~~~~^~~~~~~~~
/usr/include/c++/14/valarray:1197:1: note: candidate: 'template<class _Tp> std::_Expr<std::__detail::_BinClos<std::__minus, std::_ValArray, std::_ValArray, _Tp, _Tp>, typename std::__fun<std::__minus, _Tp>::result_type> std::operator-(const valarray<_Tp>&, const valarray<_Tp>&)'
1197 | _DEFINE_BINARY_OPERATOR(-, __minus)
| ^~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/valarray:1197:1: note: template argument deduction/substitution failed:
/usr/include/c++/14/bits/stl_algo.h:1906:50: note: 'std::_Rb_tree_const_iterator<int>' is not derived from 'const std::valarray<_Tp>'
1906 | std::__lg(__last - __first) * 2,
| ~~~~~~~^~~~~~~~~
In file included from /usr/include/c++/14/valarray:605:
/usr/include/c++/14/bits/valarray_after.h:406:5: note: candidate: 'template<class _Dom> std::_Expr<std::__detail::_BinClos<std::__minus, std::_ValArray, std::_Expr, typename _Dom::value_type, _Dom>, typename std::__fun<std::__minus, typename _Dom1::value_type>::result_type> std::operator-(const valarray<typename _Dom::value_type>&, const _Expr<_Dom1, typename _Dom1::value_type>&)'
406 | _DEFINE_EXPR_BINARY_OPERATOR(-, struct std::__minus)
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/valarray_after.h:406:5: note: template argument deduction/substitution failed:
/usr/include/c++/14/bits/stl_algo.h:1906:50: note: 'std::_Rb_tree_const_iterator<int>' is not derived from 'const std::_Expr<_Dom1, typename _Dom1::value_type>'
1906 | std::__lg(__last - __first) * 2,
| ~~~~~~~^~~~~~~~~
/usr/include/c++/14/bits/valarray_after.h:406:5: note: candidate: 'template<class _Dom> std::_Expr<std::__detail::_BinClos<std::__minus, std::_Expr, std::_ValArray, _Dom, typename _Dom::value_type>, typename std::__fun<std::__minus, typename _Dom1::value_type>::result_type> std::operator-(const _Expr<_Dom1, typename _Dom1::value_type>&, const valarray<typename _Dom::value_type>&)'
406 | _DEFINE_EXPR_BINARY_OPERATOR(-, struct std::__minus)
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/valarray_after.h:406:5: note: template argument deduction/substitution failed:
/usr/include/c++/14/bits/stl_algo.h:1906:50: note: 'std::_Rb_tree_const_iterator<int>' is not derived from 'const std::_Expr<_Dom1, typename _Dom1::value_type>'
1906 | std::__lg(__last - __first) * 2,
| ~~~~~~~^~~~~~~~~
/usr/include/c++/14/bits/valarray_after.h:406:5: note: candidate: 'template<class _Dom> std::_Expr<std::__detail::_BinClos<std::__minus, std::_Constant, std::_Expr, typename _Dom::value_type, _Dom>, typename std::__fun<std::__minus, typename _Dom1::value_type>::result_type> std::operator-(const typename _Dom::value_type&, const _Expr<_Dom1, typename _Dom1::value_type>&)'
406 | _DEFINE_EXPR_BINARY_OPERATOR(-, struct std::__minus)
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/valarray_after.h:406:5: note: template argument deduction/substitution failed:
/usr/include/c++/14/bits/stl_algo.h:1906:50: note: 'std::_Rb_tree_const_iterator<int>' is not derived from 'const std::_Expr<_Dom1, typename _Dom1::value_type>'
1906 | std::__lg(__last - __first) * 2,
| ~~~~~~~^~~~~~~~~
/usr/include/c++/14/bits/valarray_after.h:406:5: note: candidate: 'template<class _Dom> std::_Expr<std::__detail::_BinClos<std::__minus, std::_Expr, std::_Constant, _Dom, typename _Dom::value_type>, typename std::__fun<std::__minus, typename _Dom1::value_type>::result_type> std::operator-(const _Expr<_Dom1, typename _Dom1::value_type>&, const typename _Dom::value_type&)'
406 | _DEFINE_EXPR_BINARY_OPERATOR(-, struct std::__minus)
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/valarray_after.h:406:5: note: template argument deduction/substitution failed:
/usr/include/c++/14/bits/stl_algo.h:1906:50: note: 'std::_Rb_tree_const_iterator<int>' is not derived from 'const std::_Expr<_Dom1, typename _Dom1::value_type>'
1906 | std::__lg(__last - __first) * 2,
| ~~~~~~~^~~~~~~~~
/usr/include/c++/14/bits/valarray_after.h:406:5: note: candidate: 'template<class _Dom1, class _Dom2> std::_Expr<std::__detail::_BinClos<std::__minus, std::_Expr, std::_Expr, _Dom1, _Dom2>, typename std::__fun<std::__minus, typename _Dom1::value_type>::result_type> std::operator-(const _Expr<_Dom1, typename _Dom1::value_type>&, const _Expr<_Dom2, typename _Dom2::value_type>&)'
406 | _DEFINE_EXPR_BINARY_OPERATOR(-, struct std::__minus)
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/valarray_after.h:406:5: note: template argument deduction/substitution failed:
/usr/include/c++/14/bits/stl_algo.h:1906:50: note: 'std::_Rb_tree_const_iterator<int>' is not derived from 'const std::_Expr<_Dom1, typename _Dom1::value_type>'
1906 | std::__lg(__last - __first) * 2,
| ~~~~~~~^~~~~~~~~
In file included from /usr/include/c++/14/ccomplex:39,
from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:127:
/usr/include/c++/14/complex:465:5: note: candidate: 'template<class _Tp> std::complex<_Tp> std::operator-(const complex<_Tp>&)'
465 | operator-(const complex<_Tp>& __x)
| ^~~~~~~~
/usr/include/c++/14/complex:465:5: note: candidate expects 1 argument, 2 provided
/usr/include/c++/14/complex:388:5: note: candidate: 'template<class _Tp> std::complex<_Tp> std::operator-(const _Tp&, const complex<_Tp>&)'
388 | operator-(const _Tp& __x, const complex<_Tp>& __y)
| ^~~~~~~~
/usr/include/c++/14/complex:388:5: note: template argument deduction/substitution failed:
/u |
s870696647 | p03699 | C++ | #include <iostream>
#include <vector>
#include <string>
#include <sstream>
#include <cmath>
using namespace std;
int main(){
int N;
std::vector<int> si;
cin >> N;
int sum = 0;
for(int i=0; i<N; i++){
int temp;
cin >> temp;
si.push_back(temp);
sum += temp;
}
if(sum%10 != 0){
cout << sum << endl;
}else{
bool f=true;
for(int s:si){
if(f && s%10 == 0){
f=true;
}else{
f=false;
break;
}
}
if(f){
puts("0");
}else{
sort(si.begin(),si.end());
int min = 0;
for(int s:si){
if(s%10!=0){
min = s;
break;
}
}
cout << sum-min << endl;
}
}
return 0;
}
| a.cc: In function 'int main()':
a.cc:38:25: error: 'sort' was not declared in this scope; did you mean 'sqrt'?
38 | sort(si.begin(),si.end());
| ^~~~
| sqrt
|
s577017347 | p03699 | Java | import java.util.Arrays;
import java.util.Scanner;
public class Bugged {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int n = sc.nextInt();
int[] s = new int[n];
int total = 0;
for (int i = 0 ; i < n ; i++) {
s[i] = sc.nextInt();
total += s[i];
}
Arrays.sort(s);
if (total % 10 != 0) {
System.out.println(total);
} else {
for (int i = 0 ; i < n ; i++) {
int temp = total - s[i];
if (temp % 10 != 0 ) {
System.out.println(temp);
return;
}
}
System.out.println(0);
}
}
} | Main.java:4: error: class Bugged is public, should be declared in a file named Bugged.java
public class Bugged {
^
1 error
|
s425936710 | p03699 | C++ | N = int(raw_input())
ans = 0
for i in range(N):
ans += int(raw_input())
if ans % 10 == 0:
ans = 0
print ans | a.cc:1:1: error: 'N' does not name a type
1 | N = int(raw_input())
| ^
|
s834569233 | p03699 | C++ | #include <iostream>
#include <bits/stdc++.h>
using namespace std;
int dp[150][150];
int num[150];
bool cmp(int a,int b)
{
return a < b;
}
/*
3
5
10
15
*/
int main()
{
int n;
cin >> n;
for(int i = 0; i < n; i++)
{
cin >> num[i];
}
sort(num,num+n,cmp);
int sum = 0;
for(int i = 0;i < n;i++)
sum += num[i];
if(sum%10 != 0)
cout << sum <<endl;
else
{
int pos = 0;
while(sum%10 = = 0)
{
sum -= num[pos];
pos++;
}
cout << sum << endl;
}
//cout << ans <<endl;
return 0;
}
| a.cc: In function 'int main()':
a.cc:33:25: error: expected primary-expression before '=' token
33 | while(sum%10 = = 0)
| ^
|
s795579272 | p03699 | C++ | #include <bits/stdc++.h>
using namespace std;
#define FOR(i,a,b) for(int i=a;i<b;i++)
#define rep(i,b) FOR(i,0,b)
#define INF mugen
#define dump(x) cerr<<#x<<"="<<x<<endl
#define all(a) (a).begin(),(a).end()
typedef vector<int> vi;
typedef vector<vi> vii;
typedef vector<vii> viii;
typedef pair<int,int> P;
template <class T> void chmin(T & a, T const & b) { if (b < a) a = b; }
inline int toInt(string s) { int v; istringstream sin(s); sin >> v; return v; }
using ll = long long;
const ll mod = LLONG_MAX;
bool dp[112][11234]
int s[110];
int main(){
int n;
cin>>n;
rep(i,n)cin>>s[i];
dp[0][0]=1;
int ans=0;
rep(i,n){
rep(j,11234){
dp[i+1][j]|=dp[i][j];
if(j>s[i]){
if(dp[i][j-s[i]]){
dp[i+1][j]=true;
if(j%10!=0)ans=max(ans,j);
}
}
}
}
cout<<ans<<endl;
}
| a.cc:18:1: error: expected initializer before 'int'
18 | int s[110];
| ^~~
a.cc: In function 'int main()':
a.cc:22:16: error: 's' was not declared in this scope
22 | rep(i,n)cin>>s[i];
| ^
a.cc:24:3: error: 'dp' was not declared in this scope; did you mean 'dup'?
24 | dp[0][0]=1;
| ^~
| dup
a.cc:29:12: error: 's' was not declared in this scope
29 | if(j>s[i]){
| ^
|
s514141709 | p03699 | C++ | int main(){
int n, i;
int m = 0;
cin >> n;
vector<int> s(n);
for( i = 0 ; i < n ; i = i + 1 ){
cin >> s.at(i);
m = m + s.at(i);
}
sort( s.begin(), s.end() );
for( i = 0 ; i < n ; i = i + 1 ){
if( m % 10 != 0 ) break;
if( ( m - s.at(i) ) % 10 != 0 ){
m = m - s.at(i);
}
}
if( m % 10 == 0 ) m = 0;
cout << m << endl;
return 0;
} | a.cc: In function 'int main()':
a.cc:8:5: error: 'cin' was not declared in this scope
8 | cin >> n;
| ^~~
a.cc:10:5: error: 'vector' was not declared in this scope
10 | vector<int> s(n);
| ^~~~~~
a.cc:10:12: error: expected primary-expression before 'int'
10 | vector<int> s(n);
| ^~~
a.cc:15:17: error: 's' was not declared in this scope
15 | cin >> s.at(i);
| ^
a.cc:22:11: error: 's' was not declared in this scope
22 | sort( s.begin(), s.end() );
| ^
a.cc:22:5: error: 'sort' was not declared in this scope; did you mean 'short'?
22 | sort( s.begin(), s.end() );
| ^~~~
| short
a.cc:39:5: error: 'cout' was not declared in this scope
39 | cout << m << endl;
| ^~~~
a.cc:39:18: error: 'endl' was not declared in this scope
39 | cout << m << endl;
| ^~~~
|
s023800392 | p03699 | C++ | #include<iostream>
#include<vector>
#include<algorithm>
#include<string>
#include<cmath>
#include<climits>
#include<map>
#include<set>
#include<queue>
#include<stack>
#include<bitset>
#include<iomanip>
using namespace std;
#define rep(i,j,n) for(int i=(j);i<(n);i++)
#define rep2(i,j,n) for(int i=(j);i<=(n);i++)
#define all(i) i.begin(),i.end()
typedef vector<int> vi;
typedef vector<vector<int>> vvi;
typedef vector<string> vs;
typedef vector<vector<string>> vvs;
typedef pair<int, int> pi;
int main() {
int n;
cin >> n;
vi s(n);
int a = 0;
rep(i, 0, n) {
cin >> s[i];
a += s[i];
}
vi dp(n + 1);
dp[0] = 0;
sort(all(s));
vi ss(s);
reverse(all(ss));
rep(i, 0, n) {
int sum = dp[i] + ss[i];
if (sum % 10 == 0) {
sum = 0;
}
dp[i + 1] = max(dp[i], sum);
}
vi dp1(n + 1);
dp1[0] = 0;
rep(i, 0, n) {
int sum = a - s[i];
if (sum % 10 == 0) {
sum = 0;
}
dp1[i + 1] = max(dp1[i], sum);
}
cout << max(dp[n], dp1[n], a) << endl;
return 0;
}
| In file included from /usr/include/c++/14/string:51,
from /usr/include/c++/14/bits/locale_classes.h:40,
from /usr/include/c++/14/bits/ios_base.h:41,
from /usr/include/c++/14/ios:44,
from /usr/include/c++/14/ostream:40,
from /usr/include/c++/14/iostream:41,
from a.cc:1:
/usr/include/c++/14/bits/stl_algobase.h: In instantiation of 'constexpr const _Tp& std::max(const _Tp&, const _Tp&, _Compare) [with _Tp = int; _Compare = int]':
a.cc:55:13: required from here
55 | cout << max(dp[n], dp1[n], a) << endl;
| ~~~^~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_algobase.h:306:17: error: '__comp' cannot be used as a function
306 | if (__comp(__a, __b))
| ~~~~~~^~~~~~~~~~
|
s409018013 | p03699 | C++ | // ------------------------------------
// Date:2018/ 3/25
// Problem:C - Bugged d.cpp
//
// ------------------------------------
#include <bits/stdc++.h>
using namespace std;
#define EACH(i,a) for (auto& i : a)
#define FOR(i,a,b) for(int i=(int)a;i<(int)b;++i)
#define RFOR(i,a,b) for(int i=(int)b-1;i>=(int)a;--i)
#define REP(i,n) FOR(i,0,n)
#define RREP(i,n) RFOR(i,0,n)
#define ALL(a) (a).begin(),(a).end()
#define debug(x) cerr << #x << ":" << x << endl;
#define OK(ok) cout << (ok ? "Yes" : "No") << endl;
typedef long long ll;
void CINT(){}
template <class Head,class... Tail>
void CINT(Head&& head,Tail&&... tail) {
cin >> head; CINT(move(tail)...);
}
#define CIN(...) int __VA_ARGS__;CINT(__VA_ARGS__)
#define LCIN(...) ll __VA_ARGS__;CINT(__VA_ARGS__)
#define SCIN(...) string __VA_ARGS__;CINT(__VA_ARGS__)
static const int MOD = 1e9 + 7;
static const int MAX_N = 1;
int N;
int main()
{
scanf("%d", &N);
vector< int > s(N);
REP(i, N) scanf("%d", &s[i]);
vector< int > ans;
int sum;
for(unsigned ll i = 0ll; i < 1 << N; ++i) {
sum = 0;
REP(j, N) {
if ((i >> j) & 1) {
sum += s[j];
}
}
ans.emplace_back(sum);
}
int output;
sort(ALL(ans), greater< int >());
REP(i, ans.size()) {
if (ans[i] % 10 == 0) continue;
output = ans[i];
break;
}
cout << output << endl;
return 0;
}
| a.cc: In function 'int main()':
a.cc:43:18: error: expected ';' before 'i'
43 | for(unsigned ll i = 0ll; i < 1 << N; ++i) {
| ^~
| ;
a.cc:43:19: error: 'i' was not declared in this scope
43 | for(unsigned ll i = 0ll; i < 1 << N; ++i) {
| ^
a.cc:43:38: error: expected ')' before ';' token
43 | for(unsigned ll i = 0ll; i < 1 << N; ++i) {
| ~ ^
| )
a.cc:43:42: error: 'i' was not declared in this scope
43 | for(unsigned ll i = 0ll; i < 1 << N; ++i) {
| ^
|
s810871679 | p03699 | C++ |
Copy
Copy
#include<iostream>
#include<algorithm>
using namespace std;
typedef long long ll;
int N;
int s[100];
int main(){
cin >> N;
for(int i=0; i<N; i++){
cin >> s[i];
}
sort(s, s+N);
int cum[N];
cum[0] = s[0];
for(int i=1; i<N; i++){
cum[i] = cum[i-1] + s[i];
}
int ans = cum[N-1];
for(int i=0; i<N; i++){
if(ans%10==0){
if(s[i]%10!=0){
cout << ans - s[i] << endl;;
return 0;
}
}else{
cout << ans << endl;
return 0;
}
}
cout << 0 << endl;
return 0;
} | a.cc:2:1: error: 'Copy' does not name a type
2 | Copy
| ^~~~
In file included from /usr/include/c++/14/iosfwd:42,
from /usr/include/c++/14/ios:40,
from /usr/include/c++/14/ostream:40,
from /usr/include/c++/14/iostream:41,
from a.cc:4:
/usr/include/c++/14/bits/postypes.h:68:11: error: 'ptrdiff_t' does not name a type
68 | typedef ptrdiff_t streamsize; // Signed integral type
| ^~~~~~~~~
/usr/include/c++/14/bits/postypes.h:41:1: note: 'ptrdiff_t' is defined in header '<cstddef>'; this is probably fixable by adding '#include <cstddef>'
40 | #include <cwchar> // For mbstate_t
+++ |+#include <cstddef>
41 |
In file included from /usr/include/c++/14/bits/exception_ptr.h:38,
from /usr/include/c++/14/exception:166,
from /usr/include/c++/14/ios:41:
/usr/include/c++/14/new:131:26: error: declaration of 'operator new' as non-function
131 | _GLIBCXX_NODISCARD void* operator new(std::size_t) _GLIBCXX_THROW (std::bad_alloc)
| ^~~~~~~~
/usr/include/c++/14/new:131:44: error: 'size_t' is not a member of 'std'; did you mean 'size_t'?
131 | _GLIBCXX_NODISCARD void* operator new(std::size_t) _GLIBCXX_THROW (std::bad_alloc)
| ^~~~~~
In file included from /usr/include/wchar.h:35,
from /usr/include/c++/14/cwchar:44,
from /usr/include/c++/14/bits/postypes.h:40:
/usr/lib/gcc/x86_64-linux-gnu/14/include/stddef.h:214:23: note: 'size_t' declared here
214 | typedef __SIZE_TYPE__ size_t;
| ^~~~~~
/usr/include/c++/14/new:132:41: error: attributes after parenthesized initializer ignored [-fpermissive]
132 | __attribute__((__externally_visible__));
| ^
/usr/include/c++/14/new:133:26: error: declaration of 'operator new []' as non-function
133 | _GLIBCXX_NODISCARD void* operator new[](std::size_t) _GLIBCXX_THROW (std::bad_alloc)
| ^~~~~~~~
/usr/include/c++/14/new:133:46: error: 'size_t' is not a member of 'std'; did you mean 'size_t'?
133 | _GLIBCXX_NODISCARD void* operator new[](std::size_t) _GLIBCXX_THROW (std::bad_alloc)
| ^~~~~~
/usr/lib/gcc/x86_64-linux-gnu/14/include/stddef.h:214:23: note: 'size_t' declared here
214 | typedef __SIZE_TYPE__ size_t;
| ^~~~~~
/usr/include/c++/14/new:134:41: error: attributes after parenthesized initializer ignored [-fpermissive]
134 | __attribute__((__externally_visible__));
| ^
/usr/include/c++/14/new:140:29: error: 'std::size_t' has not been declared
140 | void operator delete(void*, std::size_t) _GLIBCXX_USE_NOEXCEPT
| ^~~
/usr/include/c++/14/new:142:31: error: 'std::size_t' has not been declared
142 | void operator delete[](void*, std::size_t) _GLIBCXX_USE_NOEXCEPT
| ^~~
/usr/include/c++/14/new:145:26: error: declaration of 'operator new' as non-function
145 | _GLIBCXX_NODISCARD void* operator new(std::size_t, const std::nothrow_t&) _GLIBCXX_USE_NOEXCEPT
| ^~~~~~~~
/usr/include/c++/14/new:145:44: error: 'size_t' is not a member of 'std'; did you mean 'size_t'?
145 | _GLIBCXX_NODISCARD void* operator new(std::size_t, const std::nothrow_t&) _GLIBCXX_USE_NOEXCEPT
| ^~~~~~
/usr/lib/gcc/x86_64-linux-gnu/14/include/stddef.h:214:23: note: 'size_t' declared here
214 | typedef __SIZE_TYPE__ size_t;
| ^~~~~~
/usr/include/c++/14/new:145:52: error: expected primary-expression before 'const'
145 | _GLIBCXX_NODISCARD void* operator new(std::size_t, const std::nothrow_t&) _GLIBCXX_USE_NOEXCEPT
| ^~~~~
/usr/include/c++/14/new:147:26: error: declaration of 'operator new []' as non-function
147 | _GLIBCXX_NODISCARD void* operator new[](std::size_t, const std::nothrow_t&) _GLIBCXX_USE_NOEXCEPT
| ^~~~~~~~
/usr/include/c++/14/new:147:46: error: 'size_t' is not a member of 'std'; did you mean 'size_t'?
147 | _GLIBCXX_NODISCARD void* operator new[](std::size_t, const std::nothrow_t&) _GLIBCXX_USE_NOEXCEPT
| ^~~~~~
/usr/lib/gcc/x86_64-linux-gnu/14/include/stddef.h:214:23: note: 'size_t' declared here
214 | typedef __SIZE_TYPE__ size_t;
| ^~~~~~
/usr/include/c++/14/new:147:54: error: expected primary-expression before 'const'
147 | _GLIBCXX_NODISCARD void* operator new[](std::size_t, const std::nothrow_t&) _GLIBCXX_USE_NOEXCEPT
| ^~~~~
/usr/include/c++/14/new:154:26: error: declaration of 'operator new' as non-function
154 | _GLIBCXX_NODISCARD void* operator new(std::size_t, std::align_val_t)
| ^~~~~~~~
/usr/include/c++/14/new:154:44: error: 'size_t' is not a member of 'std'; did you mean 'size_t'?
154 | _GLIBCXX_NODISCARD void* operator new(std::size_t, std::align_val_t)
| ^~~~~~
/usr/lib/gcc/x86_64-linux-gnu/14/include/stddef.h:214:23: note: 'size_t' declared here
214 | typedef __SIZE_TYPE__ size_t;
| ^~~~~~
/usr/include/c++/14/new:154:68: error: expected primary-expression before ')' token
154 | _GLIBCXX_NODISCARD void* operator new(std::size_t, std::align_val_t)
| ^
/usr/include/c++/14/new:155:73: error: attributes after parenthesized initializer ignored [-fpermissive]
155 | __attribute__((__externally_visible__, __alloc_size__ (1), __malloc__));
| ^
/usr/include/c++/14/new:156:26: error: declaration of 'operator new' as non-function
156 | _GLIBCXX_NODISCARD void* operator new(std::size_t, std::align_val_t, const std::nothrow_t&)
| ^~~~~~~~
/usr/include/c++/14/new:156:44: error: 'size_t' is not a member of 'std'; did you mean 'size_t'?
156 | _GLIBCXX_NODISCARD void* operator new(std::size_t, std::align_val_t, const std::nothrow_t&)
| ^~~~~~
/usr/lib/gcc/x86_64-linux-gnu/14/include/stddef.h:214:23: note: 'size_t' declared here
214 | typedef __SIZE_TYPE__ size_t;
| ^~~~~~
/usr/include/c++/14/new:156:68: error: expected primary-expression before ',' token
156 | _GLIBCXX_NODISCARD void* operator new(std::size_t, std::align_val_t, const std::nothrow_t&)
| ^
/usr/include/c++/14/new:156:70: error: expected primary-expression before 'const'
156 | _GLIBCXX_NODISCARD void* operator new(std::size_t, std::align_val_t, const std::nothrow_t&)
| ^~~~~
/usr/include/c++/14/new:162:26: error: declaration of 'operator new []' as non-function
162 | _GLIBCXX_NODISCARD void* operator new[](std::size_t, std::align_val_t)
| ^~~~~~~~
/usr/include/c++/14/new:162:46: error: 'size_t' is not a member of 'std'; did you mean 'size_t'?
162 | _GLIBCXX_NODISCARD void* operator new[](std::size_t, std::align_val_t)
| ^~~~~~
/usr/lib/gcc/x86_64-linux-gnu/14/include/stddef.h:214:23: note: 'size_t' declared here
214 | typedef __SIZE_TYPE__ size_t;
| ^~~~~~
/usr/include/c++/14/new:162:70: error: expected primary-expression before ')' token
162 | _GLIBCXX_NODISCARD void* operator new[](std::size_t, std::align_val_t)
| ^
/usr/include/c++/14/new:163:73: error: attributes after parenthesized initializer ignored [-fpermissive]
163 | __attribute__((__externally_visible__, __alloc_size__ (1), __malloc__));
| ^
/usr/include/c++/14/new:164:26: error: declaration of 'operator new []' as non-function
164 | _GLIBCXX_NODISCARD void* operator new[](std::size_t, std::align_val_t, const std::nothrow_t&)
| ^~~~~~~~
/usr/include/c++/14/new:164:46: error: 'size_t' is not a member of 'std'; did you mean 'size_t'?
164 | _GLIBCXX_NODISCARD void* operator new[](std::size_t, std::align_val_t, const std::nothrow_t&)
| ^~~~~~
/usr/lib/gcc/x86_64-linux-gnu/14/include/stddef.h:214:23: note: 'size_t' declared here
214 | typedef __SIZE_TYPE__ size_t;
| ^~~~~~
/usr/include/c++/14/new:164:70: error: expected primary-expression before ',' token
164 | _GLIBCXX_NODISCARD void* operator new[](std::size_t, std::align_val_t, const std::nothrow_t&)
| ^
/usr/include/c++/14/new:164:72: error: expected primary-expression before 'const'
164 | _GLIBCXX_NODISCARD void* operator new[](std::size_t, std::align_val_t, const std::nothrow_t&)
| ^~~~~
/usr/include/c++/14/new:171:29: error: 'std::size_t' has not been declared
171 | void operator delete(void*, std::size_t, std::align_val_t)
| ^~~
/usr/include/c++/14/new:173:31: error: 'std::size_t' has not been declared
173 | void operator delete[](void*, std::size_t, std::align_val_t)
| ^~~
/usr/include/c++/14/new:179:33: error: declaration of 'operator new' as non-function
179 | _GLIBCXX_NODISCARD inline void* operator new(std::size_t, void* __p) _GLIBCXX_USE_NOEXCEPT
| ^~~~~~~~
/usr/include/c++/14/new:179:51: error: 'size_t' is not a member of 'std'; did you mean 'size_t'?
179 | _GLIBCXX_NODISCARD inline vo |
s740628230 | p03699 | C++ | #include <iostream>
using namespace std;
int main(){
int N;
cin >> N;
int s[N],i,ans=0;
for(i=0;i<N;i++){
cin >> s[i];
ans+=s[i];
}
if(ans%10!=0){
cout << ans << endl;
return 0;
}
sort(s,s+N);
for(i=0;i<N;i++)if(s[i]%10 != 0)break;
if(i==N){
cout << "0" << endl;
return 0;
}else{
cout << ans-s[i] << endl;
}
return 0;
} | a.cc: In function 'int main()':
a.cc:17:3: error: 'sort' was not declared in this scope; did you mean 'short'?
17 | sort(s,s+N);
| ^~~~
| short
|
s115034406 | p03699 | C++ | #include<stdio.h>
int main(void)
{
int n,s[100],i,k,a,x,flg;
scanf("%d",&n);
for(i=0;i<n;i++){
scanf("%d",&s[i]);
a=a+s[i];
}
flg=1;
if(a%10==0){
flg=0;
for(i=0;i<n-1;i++){
for(k=i+1;k<n;k++){
if(s[i]>s[k]){
x=s[i];
s[i]=s[k];
s[k]=x;
}
}
}
for(i=0;i<n;i++){
x=a-s[i];
if(x%10!=0){
a=x;
flg=1;
break;
}
}
for(i=0;i<n;i++){
if(a[i]%10!=0){
flg=1;
break;
}
}
}
if(flg==1) printf("%d\n",a);
else printf("0\n");
return 0;
} | a.cc: In function 'int main()':
a.cc:31:29: error: invalid types 'int[int]' for array subscript
31 | if(a[i]%10!=0){
| ^
|
s372915796 | p03699 | C | #include <stdio.h>
#include <stdlib.h>
#include "myfunc.h"
int main()
{
int N, s[100];
scanf("%d", &N);
for(int i = 0; i < N; i++){
scanf("%d", &s[i]);
}
int score = 0;
qsort(s, N, sizeof(int), comp_up);
for(int i = 0; i < N; i++){
score += s[i];
}
if(score % 10 != 0){
printf("%d\n", score);
}else{
int i;
for(i = 0; i < N; i++){
if(s[i] % 10 != 0){
score -= s[i];
printf("%d\n", score);
return 0;
}
}
if(i >= N - 1) printf("%d\n", 0);
}
return 0;
}
| main.c:3:10: fatal error: myfunc.h: No such file or directory
3 | #include "myfunc.h"
| ^~~~~~~~~~
compilation terminated.
|
s224989749 | p03699 | C++ | #include <stdio.h>
int main()
{
//変数の宣言と初期化
int n,flg1=0 ;
do{
flg1=scanf("%d",&n);
}while(1>n||n>100);
int t[n];
int score = 0;
int x;
//iに0を代入、iがnになるまで、iに1を足す
for(x=0; x<n ;x++)
{
//int t[n];
int flg2 = 0;
do{
flg2 = scanf("%d",&t[x]);
}while(1>t[x]||t[x]>100);
score = score + t[x];
//printf("score=");
//printf("%d\n",score);
}
int i, j, tmp;
for (i=0; i<n; i++) {
for (j=i+1; j<n; j++) {
if (t[i] > t[j]) {
tmp = t[i];
t[i] = t[j];
t[j] = tmp;
}
}
}
/*printf("昇順ソートした数値\n");
for (i=0; i<n; i++)
printf("%d\n", t[i]);*/
/* int y;
for (y=0; y<n; y++){
if(score % 10 == 0){
score = score - t[y-1];
//printf("score1=");
//printf("%d\n",score);
}
}*/
if(y=n, score % 10 == 0){
score = 0;
}
//printf("%d\n",n);
//printf("%d\n",y);
printf("%d\n",score);
return 0;
} | a.cc: In function 'int main()':
a.cc:50:12: error: 'y' was not declared in this scope
50 | if(y=n, score % 10 == 0){
| ^
|
s143272201 | p03699 | C++ | #include <stdio.h>
int main()
{
//変数の宣言と初期化
int n = 0;
//n個分のint型配列を用意
scanf("%d",&n);
if (n > 100){
return;
}
int t[n];
int score = 0;
int x;
//iに0を代入、iがnになるまで、iに1を足す
for(x=0; x<n ;x++)
{
scanf("%d",&t[x]);
score = score + t[x];
//printf("score=");
//printf("%d\n",score);
}
int i, j, tmp;
for (i=0; i<n; i++) {
for (j=i+1; j<n; j++) {
if (t[i] > t[j]) {
tmp = t[i];
t[i] = t[j];
t[j] = tmp;
}
}
}
/*printf("昇順ソートした数値\n");
for (i=0; i<n; i++)
printf("%d\n", t[i]);*/
int y;
for (y=0; y<n; y++){
if(score % 10 == 0){
score = score - t[y-1];
//printf("score1=");
//printf("%d\n",score);
}
}
if(y=n, score % 10 == 0){
score = 0;
}
//printf("%d\n",n);
//printf("%d\n",y);
printf("%d\n",score);
return 0;
} | a.cc: In function 'int main()':
a.cc:11:12: error: return-statement with no value, in function returning 'int' [-fpermissive]
11 | return;
| ^~~~~~
|
s082882379 | p03699 | C++ | #include <iostream>
using namespace std;
int min(int a, int b) {
if (a < b)return a;
else return b;
}
int main() {
int N;
int s[110];
bool check_not10 = false;
int all_sum = 0, min_not10 = INT_MAX;
cin >> N;
for (int i = 1; i <= N; i++) {
cin >> s[i];
all_sum += s[i];
if (s[i] % 10 != 0) {
min_not10 = min(s[i], min_not10);
check_not10 = true;
}
}
if (all_sum % 10 == 0) {
if (check_not10)cout << all_sum - min_not10 << endl;
else cout << 0 << endl;
}
else cout << all_sum << endl;
return 0;
} | a.cc: In function 'int main()':
a.cc:15:38: error: 'INT_MAX' was not declared in this scope
15 | int all_sum = 0, min_not10 = INT_MAX;
| ^~~~~~~
a.cc:2:1: note: 'INT_MAX' is defined in header '<climits>'; this is probably fixable by adding '#include <climits>'
1 | #include <iostream>
+++ |+#include <climits>
2 | using namespace std;
|
s347258497 | p03699 | C | #include <stdio.h>
#include <string.h>
int main(){
int Sum=0;
int nowMin=10000;
int tmp,Num,i;
scanf("%d",&Num);
for(i=0;i<Num;i++){
scanf("%d",&tmp);//値の取得
if(nowMin>tmp && nowMin%10!=0)nowMin =tmp;
Sum+=tmp;
}
if(nowMin==10000){
nowMin=0;
printf("0");
return 0;
}
if(Sum%10==0){
Sum-=nowMin;
}
if(Sum%10==0){
printf("0");
}else{
printf("%d",Sum);
}
return 0;
}
//if()
//もし、下一桁が0になってしまう場合は、なるべく小さい0ではないものを引く
/*なるべく小さい下1ケタ0 | main.c:33:1: error: unterminated comment
33 | /*なるべく小さい下1ケタ0
| ^
|
s563096991 | p03699 | Java | import java.util.Scanner;
import java.util.Arrays;
public class a{
public static void main(String [] args){
int sum=0,k,pos;
int array[] = new int[100];
Scanner sc = new Scanner(System.in);
int n = sc.nextInt();
for(int i=0;i<n;i++){
array[i] = sc.nextInt();
sum += array[i];
}
pos = n-1;
for(int i=0;i<n;i++){
for(int j=0;j<pos;j++){
if(array[j] > array[j + 1]){
k = array[j];
array[j] = array[j+1];
array[j+1] = k;
}
}
pos--;
}
for(int i=0;i<n && (sum % 10) == 0;i++)
sum -= array[i];
System.out.println(sum);
}
} | Main.java:5: error: class a is public, should be declared in a file named a.java
public class a{
^
1 error
|
s612521485 | p03699 | C | N = int(input())
s = []
for _ in range(N):
s.append(int(input()))
if sum(s) % 10 != 0:
print(sum(s))
else:
min_s = 0
sorted_s = sorted(s, reverse=True)
for ss in sorted_s:
if ss % 10 != 0:
min_s = ss
if min_s == 0:
print(0)
else:
print(sum(s) - min_s)
| main.c:1:1: warning: data definition has no type or storage class
1 | N = int(input())
| ^
main.c:1:1: error: type defaults to 'int' in declaration of 'N' [-Wimplicit-int]
main.c:1:5: error: expected expression before 'int'
1 | N = int(input())
| ^~~
|
s253344211 | p03699 | C | N = int(input())
s = []
for _ in range(N):
s.append(int(input()))
if sum(s) % 10 != 0:
print(sum(s))
else:
min_s = 0
sorted_s = sorted(s, reverse=True)
for ss in sorted_s:
if ss % 10 != 0:
min_s = ss
if min_s == 0:
print(0)
else:
print(sum(s) - min_s)
| main.c:1:1: warning: data definition has no type or storage class
1 | N = int(input())
| ^
main.c:1:1: error: type defaults to 'int' in declaration of 'N' [-Wimplicit-int]
main.c:1:5: error: expected expression before 'int'
1 | N = int(input())
| ^~~
|
s565409780 | p03699 | C | N = int(input())
s = []
for _ in range(N):
s.append(int(input()))
if sum(s) % 10 != 0:
print(sum(s))
else:
min_s = 0
sorted_s = sorted(s, reverse=True)
for ss in sorted_s:
if ss % 10 != 0:
min_s = ss
if min_s == 0:
print(0)
else:
print(sum(s) - min_s)
| main.c:1:1: warning: data definition has no type or storage class
1 | N = int(input())
| ^
main.c:1:1: error: type defaults to 'int' in declaration of 'N' [-Wimplicit-int]
main.c:1:5: error: expected expression before 'int'
1 | N = int(input())
| ^~~
|
s976881467 | p03699 | C++ | # -*- coding:utf-8 -*-
import sys
N = int(input())
Sn = sorted([int(input()) for i in range(N)])
total = sum(Sn)
if total % 10 != 0:
print(total)
sys.exit()
else:
i = 0
while True:
total -= Sn[i]
if total % 10 != 0:
print(total)
sys.exit()
print(0) | a.cc:1:3: error: invalid preprocessing directive #-
1 | # -*- coding:utf-8 -*-
| ^
a.cc:2:1: error: 'import' does not name a type
2 | import sys
| ^~~~~~
a.cc:2:1: note: C++20 'import' only available with '-fmodules-ts'
|
s785618077 | p03699 | Java | import java.util.List;
import java.util.ArrayList;
import java.util.Scanner;
public class C {
public static void main(String[] args) {
Scanner scanner = new Scanner(System.in);
int n = scanner.nextInt();
int[] point = new int[n];
List<Integer> num = new ArrayList<>();
int sum = 0;
for (int i = 0; i < n; i++) {
point[i] = scanner.nextInt();
sum += point[i];
if (point[i] % 10 != 0) {
num.add(point[i]);
}
}
if (sum % 10 != 0) {
System.out.println(sum);
} else {
if (num.size() == 0) {
System.out.println(0);
} else {
int min = 101;
for (Integer i : num) {
if (i < min) {
min = i;
}
}
System.out.println(sum-min);
}
}
scanner.close();
}
}
| Main.java:5: error: class C is public, should be declared in a file named C.java
public class C {
^
1 error
|
s299642929 | p03699 | C++ | #include <iostream>
#include <vector>
#include <queue>
#include <stack>
#include <algorithm>
#include <cmath>
#include <string>
#include <cstring>
#include <map>
#include <set>
#include <bitset>
#include <sstream>
#include <cstdlib>
#include <unordered_map>
#include <unordered_set>
#include <list>
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef vector<vector<int>> vvi;
int main() {
int n;
cin >> n;
int sum = 0, mini = INT_MAX;
for (int i = 0; i < n; ++i) {
int x;
cin >> x;
sum += x;
if (x % 10) {
mini = min(mini, x);
}
}
if (sum % 10) {
cout << sum;
} else if (mini != INT_MAX) {
cout << sum - mini;
} else {
cout << 0;
}
return 0;
} | a.cc: In function 'int main()':
a.cc:26:25: error: 'INT_MAX' was not declared in this scope
26 | int sum = 0, mini = INT_MAX;
| ^~~~~~~
a.cc:17:1: note: 'INT_MAX' is defined in header '<climits>'; this is probably fixable by adding '#include <climits>'
16 | #include <list>
+++ |+#include <climits>
17 | using namespace std;
|
s235985142 | p03699 | C++ | #include<iostream> // 入出力
#include<math.h> // 数学の関数
#include<vector> // 配列
#include<string> // 文字列
#include<map> // 連想配列
#include<stack> // スタック
#include<queue> // キュー
using namespace std;
int main()
{
int n;
cin >> n;
vector<int> s(n);
int value = 0;
for (int i = 0; i < n; ++i) {
cin >> s[i];
value += s[i];
}
sort(s.begin(), s.end());
if (value % 10 == 0)
{
for (int i = 0; i < n; ++i) {
if (s[i] % 10 == 0) {
continue;
}
cout << value - s[i] << endl;
return 0;
}
cout << 0 << endl;
return 0;
}
cout << value << endl;
return 0;
} | a.cc: In function 'int main()':
a.cc:25:9: error: 'sort' was not declared in this scope; did you mean 'sqrt'?
25 | sort(s.begin(), s.end());
| ^~~~
| sqrt
|
s909264436 | p03699 | C | #include <stdio.h>
#include <string.h>
int main(void){
int i,N,sum=0,min=101;
int score[100];
scanf("%d",&N);
for( i = 0; i < N; i++ ){
scanf("%d",&score[i]);
sum += score[i];
if( score[i] < min && score[i] % 10 != 0){
min = s[i];
}
}
if( sum % 10 != 0 ){
printf("%d",sum);
}
if( min == 101 ){
printf("0");
}
else if( sum % 10 ==0 ){
printf("%d\n",sum-min);
}
return 0;
} | main.c: In function 'main':
main.c:15:19: error: 's' undeclared (first use in this function)
15 | min = s[i];
| ^
main.c:15:19: note: each undeclared identifier is reported only once for each function it appears in
|
s905844854 | p03699 | C | #include <stdio.h>
int main(){
int N,s[100]={},sum,min=100;
scanf("%d",&N);
for(i=0;i<N;i++){
scanf("%d",&s[i]);
sum+= s[i];
if(s[i] % 10 != 0 && min > s[i] )min=s[i];
}
if(sum % 10 != 0)printf("%d",sum);
else if(sum % 10 == 0 && min % 10 != 0)printf("%d",sum-min);
else printf("0\n");
return 0;
} | main.c: In function 'main':
main.c:9:9: error: 'i' undeclared (first use in this function)
9 | for(i=0;i<N;i++){
| ^
main.c:9:9: note: each undeclared identifier is reported only once for each function it appears in
|
s628549768 | p03699 | C++ | #include <iostream>
#include <vector>
#include <algorithm>
int main(void){
int N;
std::cin >> N;
std::vector<int> vec(N);
for(int i = 0; i < N; ++i){
std::cin >> vec[i];
}
int sum = std::accumulate(vec.begin(), vec.end(), 0);
if(sum % 10 == 0){
std::sort(vec.begin(), vec.end());
for(auto i : vec){
if(i % 10 == 0){ continue; }
else{ sum -= i; break; }
}
}
std::cout << sum << std::endl;
return 0;
} | a.cc: In function 'int main()':
a.cc:13:16: error: 'accumulate' is not a member of 'std'
13 | int sum = std::accumulate(vec.begin(), vec.end(), 0);
| ^~~~~~~~~~
|
s815483812 | p03699 | C++ | #include <iostream>
#include <vector>
#include <algorithm>
int main(void){
int N;
std::cin >> N;
std::vector<int> vec(N);
for(int i = 0; i < N; ++i){
std::cin >> vec[i];
}
int sum = std::accumurate(vec.begin(), vec.end(), 0);
if(sum % 10 == 0){
std::sort(vec.begin(), vec.end());
for(auto i : vec){
if(i % 10 == 0){ continue; }
else{ sum -i; break; }
}
}
std::cout << sum << std::endl;
return 0;
}
| a.cc: In function 'int main()':
a.cc:13:16: error: 'accumurate' is not a member of 'std'
13 | int sum = std::accumurate(vec.begin(), vec.end(), 0);
| ^~~~~~~~~~
|
s509444168 | p03699 | C++ | #include <iostream>
#include <string>
using namespace std;
int main(){
int a,b[100],c,min;
min=1000;
c=0;
cin>>a;
for(int i=0;i<a;i++){
cin>>b[i];
c=c+b[i];
}
if(c%10>0){
cout<<c<<endl;
}
for(int k=0;k<a;k++){
if(min>a[k] && a[k]%10>0){
min=a[k];
}
}
if(min==0){
cout<<0<<endl;
}
cout<<c-min<<endl;
} | a.cc: In function 'int main()':
a.cc:18:33: error: invalid types 'int[int]' for array subscript
18 | if(min>a[k] && a[k]%10>0){
| ^
a.cc:18:41: error: invalid types 'int[int]' for array subscript
18 | if(min>a[k] && a[k]%10>0){
| ^
a.cc:19:38: error: invalid types 'int[int]' for array subscript
19 | min=a[k];
| ^
|
s131454356 | p03699 | C++ | #include <iostream>
#include <string>
using namespace std;
int main(){
int a,b[100],c,min;
min=0;
c=0;
cin>>a;
for(int i=0;i<a;i++){
cin>>a[i];
c=c+a[i]
}
if(c%10>0){
cout<<c<<endl;
}
for(int j=0;j<2;j++){
for(int k=0;k>a;k++){
if(min>a[k] && a[k]%10>0){
min=a[k];
}
}
}
if(min==0){
cout<<0<<endl;
}
cout<<c-min<<endl;
} | a.cc: In function 'int main()':
a.cc:11:23: error: invalid types 'int[int]' for array subscript
11 | cin>>a[i];
| ^
a.cc:12:22: error: invalid types 'int[int]' for array subscript
12 | c=c+a[i]
| ^
a.cc:19:33: error: invalid types 'int[int]' for array subscript
19 | if(min>a[k] && a[k]%10>0){
| ^
a.cc:19:41: error: invalid types 'int[int]' for array subscript
19 | if(min>a[k] && a[k]%10>0){
| ^
a.cc:20:38: error: invalid types 'int[int]' for array subscript
20 | min=a[k];
| ^
|
s432828633 | p03699 | C | #include<stdio.h>
int main(){
int n,m,i,j,N,s[100];
j=0;
scanf("%d",&N);
for(n=0;n<N;n++){
scanf("%d",&s[n]);
}
for(m=0;m<N;m++){
i=s[m]%10;
j=j+i;
}
k=j%10;
if(k!=0){
printf("%d\n",j);
} | main.c: In function 'main':
main.c:13:1: error: 'k' undeclared (first use in this function)
13 | k=j%10;
| ^
main.c:13:1: note: each undeclared identifier is reported only once for each function it appears in
main.c:16:1: error: expected declaration or statement at end of input
16 | }
| ^
|
s384641076 | p03699 | C++ | #include<iostream>
using namespace std;
int main(){
int n;
cin >> n;
int s[n];
for(int i=0; i<n; i++) cin >> s[i];
int sum = 0;
for(int i=0; i<n; i++) sum += s[i];
sort(s,s+n);
if(sum % 10 != 0){
cout << sum << endl;
return 0;
}
for(int i=0; i<n; i++){
if(s[i] % 10 != 0){
sum -=s[i];
cout << sum << endl;
return 0;
}
}
cout << 0 << endl;
return 0;
} | a.cc: In function 'int main()':
a.cc:16:3: error: 'sort' was not declared in this scope; did you mean 'short'?
16 | sort(s,s+n);
| ^~~~
| short
|
s240062602 | p03699 | Java | import java.util.*;
import java.io.*;
public class Main{
public static void main(String[] args){
Scanner sc = new Scanner(System.in);
int n = sc.nextInt();
int[] marks = new int[n];
int sum = 0;
for(int i=0; i<n; i++){
marks[i] = sc.nextInt();
sum += marks[i];
}
Arrays.sort(marks);
int k = 0;
while(sum%10 == 0 && sum != 0){
while(k<marks.length && marks[k]%10 ==0s) k++;
if(k == marks.length){
sum = 0;
break;
}
sum -= marks[k++];
}
System.out.println(sum);
}
}
| Main.java:21: error: ')' expected
while(k<marks.length && marks[k]%10 ==0s) k++;
^
Main.java:21: error: ';' expected
while(k<marks.length && marks[k]%10 ==0s) k++;
^
2 errors
|
s096636274 | p03699 | C++ |
#include <iostream>
#include <math.h>
using namespace std;
int main(int argc, const char * argv[]) {
short N;
cin >> N;
short* scores = new short[N];
for (int i = 0; i < N; i++) {
cin >> scores[i];
}
sort(scores, scores + N);
long total = 0;
for (int i = 0; i < N; i++) {
total += scores[i];
}
if (total % 10 != 0) {
cout << total << endl;
delete[] scores;
return 0;
}
for (int i = 0; i < N; i++) {
if (scores[i] % 10 != 0){
cout << total - scores[i] << endl;
delete[] scores;
return 0;
}
}
delete[] scores;
cout << 0 << endl;
return 0;
}
| a.cc: In function 'int main(int, const char**)':
a.cc:14:5: error: 'sort' was not declared in this scope; did you mean 'sqrt'?
14 | sort(scores, scores + N);
| ^~~~
| sqrt
|
s229666660 | p03699 | C++ | #include<iostream>
using namespace std;
int main(void) {
int n, s[100],tmp,j,S=0,MAX[100],ans;
cin >> n;
for (int i = 0; i < n; i++) {
cin >> s[i];
}
for (j = 0; j < n; j++) {
for (int i = 0; i < n; i++) {
if (s[j] < s[i]) {
tmp = s[i];
s[i] = s[j];
s[j] = tmp;
}
}
}
for (int i = 0; i < n; i++) {
S = S + s[i];
}
if (S % 10 != 0)
cout << S << endl;
else if (S % 10 == 0) {
for (int i = 0; i < n; i++) {
MAX[i] = S - s[i];
if (MAX[i] % 10 != 0) {
ans = MAX[i];
break;
}
}
cout << ans << endl;
}
| a.cc: In function 'int main()':
a.cc:54:10: error: expected '}' at end of input
54 | }
| ^
a.cc:5:16: note: to match this '{'
5 | int main(void) {
| ^
|
s739494321 | p03699 | C++ | #include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <functional>
#include <numeric>
#include <limit>
int main( void ) {
int n;
std::cin >> n;
std::vector< int > ss;
for( size_t i = 0; i < n; ++i ) {
int s;
std::cin >> s;
ss.push_back( s );
}
// 結局全てを足したとして、2つのケースしか生じない
// A: 全合計値は10の倍数ではなかった
// このときはそのまま採用すればよい
// B: 全合計値は10の倍数であった
// このときは、一番小さい10の倍数ではない数を引けば10の倍数ではなくなる
const int sum = std::accumulate( ss.begin(), ss.end(), 0 );
int min = std::numelic_limits<int>::max(); // 番兵
for( size_t i = 0; i < ss.size(); ++i ) {
if( ss[ i ] % 10 == 0 ) continue;
min = std::min( min, ss[ i ] );
}
if( sum % 10 == 0 ) {
std::cout << sum - min << std::endl;
} else {
std::cout << sum << std::endl;
}
return 0;
} | a.cc:7:10: fatal error: limit: No such file or directory
7 | #include <limit>
| ^~~~~~~
compilation terminated.
|
s098709538 | p03699 | C++ | #include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <functional>
#include <numeric>
#include <limits>
int main( void ) {
int n;
std::cin >> n;
std::vector< int > ss;
for( size_t i = 0; i < n; ++i ) {
int s;
std::cin >> s;
ss.push_back( s );
}
// 結局全てを足したとして、2つのケースしか生じない
// A: 全合計値は10の倍数ではなかった
// このときはそのまま採用すればよい
// B: 全合計値は10の倍数であった
// このときは、一番小さい10の倍数ではない数を引けば10の倍数ではなくなる
const int sum = std::accumulate( ss.begin(), ss.end(), 0 );
int min = std::numelic_limits<int>::max(); // 番兵
for( size_t i = 0; i < ss.size(); ++i ) {
if( ss[ i ] % 10 == 0 ) continue;
min = std::min( min, ss[ i ] );
}
if( sum % 10 == 0 ) {
std::cout << sum - min << std::endl;
} else {
std::cout << sum << std::endl;
}
return 0;
} | a.cc: In function 'int main()':
a.cc:29:20: error: 'numelic_limits' is not a member of 'std'; did you mean 'numeric_limits'?
29 | int min = std::numelic_limits<int>::max(); // 番兵
| ^~~~~~~~~~~~~~
| numeric_limits
a.cc:29:35: error: expected primary-expression before 'int'
29 | int min = std::numelic_limits<int>::max(); // 番兵
| ^~~
|
s269111748 | p03699 | C++ | #include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <functional>
int main( void ) {
int n;
std::cin >> n;
std::vector< int > ss;
for( size_t i = 0; i < n; ++i ) {
int s;
std::cin >> s;
ss.push_back( s );
}
// 結局全てを足したとして、2つのケースしか生じない
// A: 全合計値は10の倍数ではなかった
// このときはそのまま採用すればよい
// B: 全合計値は10の倍数であった
// このときは、一番小さい10の倍数ではない数を引けば10の倍数ではなくなる
const int sum = std::accumulate( ss.begin(), ss.end(), 0 );
int min = std::numelic_limits<int>::max(); // 番兵
for( size_t i = 0; i < ss.size(); ++i ) {
if( ss[ i ] % 10 == 0 ) continue;
min = std::min( min, ss[ i ] );
}
if( sum % 10 == 0 ) {
std::cout << sum - min << std::endl;
} else {
std::cout << sum << std::endl;
}
return 0;
} | a.cc: In function 'int main()':
a.cc:25:26: error: 'accumulate' is not a member of 'std'
25 | const int sum = std::accumulate( ss.begin(), ss.end(), 0 );
| ^~~~~~~~~~
a.cc:27:20: error: 'numelic_limits' is not a member of 'std'
27 | int min = std::numelic_limits<int>::max(); // 番兵
| ^~~~~~~~~~~~~~
a.cc:27:35: error: expected primary-expression before 'int'
27 | int min = std::numelic_limits<int>::max(); // 番兵
| ^~~
|
s977447565 | p03699 | C++ | #include <iostream>
#include <vector>
#include <algorithm>
#include <string>
int main( void ) {
int n;
std::cin >> n;
std::vector< int > ss;
for( size_t i = 0; i < n; ++i ) {
int s;
std::cin >> s;
ss.push_back( s );
}
// 結局全てを足したとして、2つのケースしか生じない
// A: 全合計値は10の倍数ではなかった
// このときはそのまま採用すればよい
// B: 全合計値は10の倍数であった
// このときは、一番小さい10の倍数ではない数を引けば10の倍数ではなくなる
const int sum = std::accumulate( ss.begin(), ss.end(), 0 );
int min = std::numelic_limits<int>::max(); // 番兵
for( size_t i = 0; i < ss.size(); ++i ) {
if( ss[ i ] % 10 == 0 ) continue;
min = std::min( min, ss[ i ] );
}
if( sum % 10 == 0 ) {
std::cout << sum - min << std::endl;
} else {
std::cout << sum << std::endl;
}
return 0;
} | a.cc: In function 'int main()':
a.cc:24:26: error: 'accumulate' is not a member of 'std'
24 | const int sum = std::accumulate( ss.begin(), ss.end(), 0 );
| ^~~~~~~~~~
a.cc:26:20: error: 'numelic_limits' is not a member of 'std'
26 | int min = std::numelic_limits<int>::max(); // 番兵
| ^~~~~~~~~~~~~~
a.cc:26:35: error: expected primary-expression before 'int'
26 | int min = std::numelic_limits<int>::max(); // 番兵
| ^~~
|
s975498686 | p03699 | C++ | include<iostream>
using namespace std;
int main(){
int N,a;
int min, sum;
min = -1;
cin>>N;
sum = 0;
for(int i=0;i<N;i++){
cin>>a;
sum += a;
if(a%10==0){
continue;
}
if(min>a||min==-1){
min = a;
}
}
if(sum%10==0&&min!=-1){
sum -= min;
}
if(sum%10==0){
sum = 0;
}
printf("%d\n",sum);
//cout<<sum<<endl;
} | a.cc:1:1: error: 'include' does not name a type
1 | include<iostream>
| ^~~~~~~
a.cc: In function 'int main()':
a.cc:7:9: error: 'cin' was not declared in this scope; did you mean 'min'?
7 | cin>>N;
| ^~~
| min
a.cc:25:9: error: 'printf' was not declared in this scope
25 | printf("%d\n",sum);
| ^~~~~~
a.cc:1:1: note: 'printf' is defined in header '<cstdio>'; this is probably fixable by adding '#include <cstdio>'
+++ |+#include <cstdio>
1 | include<iostream>
|
s058928924 | p03699 | C | #include <iostream>
#include<bits/stdc++.h>
using namespace std;
int main() {
int n;
int sum=0;
cin>>n;
int a[n];
for(int i=0;i<n;i++){cin>>a[i];sum+=a[i];}
if(sum%10!=0){cout<<sum<<endl;return 0;}
sort(a,a+n);
for(int i=0;i<n;i++){
sum-=a[i];
if(sum%10!=0){
cout<<sum<<endl;
return 0;
}
sum+=a[i];
}
cout<<"0"<<endl;
return 0;
}
| main.c:1:10: fatal error: iostream: No such file or directory
1 | #include <iostream>
| ^~~~~~~~~~
compilation terminated.
|
s742261154 | p03699 | C++ | #include <iostream>
using namespace std;
int map[10001][101];
map[0][0]++;
int main(){
int N;
cin >>N;
int s;
for(int i=0;i<N;i++){
cin>>s;
for(int j=0;j<10001;j++){
map[j][i+1]=map[j][i];
if(j+s<10001)map[j+s][i+1]=map[j][i];
}}
int m=0;
for(int i=10000; i>=0;i--){
if(i%10==0)continue;
if(map[i][N]==1){
m=i;
}}
cout << m<< endl;
return 0;}
| a.cc:4:1: error: 'map' does not name a type
4 | map[0][0]++;
| ^~~
|
s718432175 | p03699 | C | #include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include <string.h>
#include <limits.h>
#define inf INT_MAX
#define INF 9223372036854775807
#define rep(i,n) for(i=0;i<n;i++)
int in(void){
int i;scanf("%d",&i);
return i;
}
long long llin(void){
long long i;scanf("%lld",&i);
return i;
}
void chin(char s[]){
scanf("%s",s);
}
void print(int a){
printf("%d\n",a);
}
void llprint(long long a){
printf("%lld\n",a);
}
void print2(int a,int b){
printf("%d %d\n",a,b);
}
long long max(long long a,long long b){
return a>b?a:b;
}
long long min(long long a,long long b){
return a<b?a:b;
}
int main(void){
int n=in(),i,s[100],sum=0,m=0;
rep(i,n){
s[i]=in();
sum+=s[i];
}
if(s%10!=0){
print(s);
return 0;
}
rep(i,n){
if((sum-s[i])%10!=0){
m=max(m,sum-s[i]);
}
}
print(m);
return 0;
} | main.c: In function 'main':
main.c:43:13: error: invalid operands to binary % (have 'int *' and 'int')
43 | if(s%10!=0){
| ~^
| |
| int *
main.c:44:23: error: passing argument 1 of 'print' makes integer from pointer without a cast [-Wint-conversion]
44 | print(s);
| ^
| |
| int *
main.c:21:16: note: expected 'int' but argument is of type 'int *'
21 | void print(int a){
| ~~~~^
|
s511525418 | p03699 | C++ | #include <iostream>
#include <vector>
#include <numeric>
#include <algorithm>
using namespace std;
int main(){
cin.tie(0);
ios::sync_with_stdio(false);
int N;
cin >> N;
vector<int> v(N), noten;
for (int i = 0; i < N; ++i){
cin >> v[i];
}
for (int i = 0; i < N; ++i){
if (v[i] % 10 != 0) noten.push_back(v[i]);
}
//sort(noten.begin(), noten.end());
int sum = accumulate(v.begin(), v.end(), 0);
if (sum % 10 != 0) cout << sum << endl;
else cout << sum - min_element(noten.begin(), noten.end()) << endl;
return 0;
}
| a.cc: In function 'int main()':
a.cc:26:22: error: no match for 'operator-' (operand types are 'int' and '__gnu_cxx::__normal_iterator<int*, std::vector<int> >')
26 | else cout << sum - min_element(noten.begin(), noten.end()) << endl;
| ~~~ ^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
| | |
| int __gnu_cxx::__normal_iterator<int*, std::vector<int> >
In file included from /usr/include/c++/14/string:48,
from /usr/include/c++/14/bits/locale_classes.h:40,
from /usr/include/c++/14/bits/ios_base.h:41,
from /usr/include/c++/14/ios:44,
from /usr/include/c++/14/ostream:40,
from /usr/include/c++/14/iostream:41,
from a.cc:1:
/usr/include/c++/14/bits/stl_iterator.h:618:5: note: candidate: 'template<class _IteratorL, class _IteratorR> constexpr decltype ((__y.base() - __x.base())) std::operator-(const reverse_iterator<_Iterator>&, const reverse_iterator<_IteratorR>&)'
618 | operator-(const reverse_iterator<_IteratorL>& __x,
| ^~~~~~~~
/usr/include/c++/14/bits/stl_iterator.h:618:5: note: template argument deduction/substitution failed:
a.cc:26:62: note: mismatched types 'const std::reverse_iterator<_Iterator>' and 'int'
26 | else cout << sum - min_element(noten.begin(), noten.end()) << endl;
| ^
/usr/include/c++/14/bits/stl_iterator.h:1790:5: note: candidate: 'template<class _IteratorL, class _IteratorR> constexpr decltype ((__x.base() - __y.base())) std::operator-(const move_iterator<_IteratorL>&, const move_iterator<_IteratorR>&)'
1790 | operator-(const move_iterator<_IteratorL>& __x,
| ^~~~~~~~
/usr/include/c++/14/bits/stl_iterator.h:1790:5: note: template argument deduction/substitution failed:
a.cc:26:62: note: mismatched types 'const std::move_iterator<_IteratorL>' and 'int'
26 | else cout << sum - min_element(noten.begin(), noten.end()) << endl;
| ^
/usr/include/c++/14/bits/stl_iterator.h:1312:5: note: candidate: 'template<class _IteratorL, class _IteratorR, class _Container> decltype ((__lhs.base() - __rhs.base())) __gnu_cxx::operator-(const __normal_iterator<_IteratorL, _Container>&, const __normal_iterator<_IteratorR, _Container>&)'
1312 | operator-(const __normal_iterator<_IteratorL, _Container>& __lhs,
| ^~~~~~~~
/usr/include/c++/14/bits/stl_iterator.h:1312:5: note: template argument deduction/substitution failed:
a.cc:26:62: note: mismatched types 'const __gnu_cxx::__normal_iterator<_IteratorL, _Container>' and 'int'
26 | else cout << sum - min_element(noten.begin(), noten.end()) << endl;
| ^
/usr/include/c++/14/bits/stl_iterator.h:1325:5: note: candidate: 'template<class _Iterator, class _Container> typename __gnu_cxx::__normal_iterator<_Iterator, _Container>::difference_type __gnu_cxx::operator-(const __normal_iterator<_Iterator, _Container>&, const __normal_iterator<_Iterator, _Container>&)'
1325 | operator-(const __normal_iterator<_Iterator, _Container>& __lhs,
| ^~~~~~~~
/usr/include/c++/14/bits/stl_iterator.h:1325:5: note: template argument deduction/substitution failed:
a.cc:26:62: note: mismatched types 'const __gnu_cxx::__normal_iterator<_Iterator, _Container>' and 'int'
26 | else cout << sum - min_element(noten.begin(), noten.end()) << endl;
| ^
|
s589985188 | p03699 | C++ | #include <iostream>
#include <vector>
#include <numeric>
#include <algorithm>
using namespace std;
int main(){
cin.tie(0);
ios::sync_with_stdio(false);
int N;
cin >> N;
vector<int> v(N), noten;
for (int i = 0; i < N; ++i){
cin >> v[i];
if (v[i] % 10 != 0) noten.push_back(v[i])
}
sort(noten.begin(), noten.end());
int sum = accumulate(v.begin(), v.end(), 0);
if (sum % 10 != 0) cout << sum << endl;
else cout << sum - noten[0] << endl;
return 0;
}
| a.cc: In function 'int main()':
a.cc:16:50: error: expected ';' before '}' token
16 | if (v[i] % 10 != 0) noten.push_back(v[i])
| ^
| ;
17 | }
| ~
|
s445500935 | p03699 | C++ | #include <iostream>
#include <vector>
#include <numeric>
#include <algorithm>
using namespace std;
int main(){
cin.tie(0);
ios::sync_with_stdio(false);
int N;
cin >> N;
vector<int> v(N), noten;
for (int i = 0; i < N; ++i){
cin >> v[i];
}
for (int i = 0; i< N; ++i){
if (v[i] % 10 != 0) noten[i] = v[i]
}
sort(noten.begin(), noten.end());
int sum = accumulate(v.begin(), v.end(), 0);
if (sum % 10 != 0) cout << sum << endl;
else cout << sum - noten[0] << endl;
return 0;
}
| a.cc: In function 'int main()':
a.cc:19:44: error: expected ';' before '}' token
19 | if (v[i] % 10 != 0) noten[i] = v[i]
| ^
| ;
20 | }
| ~
|
s190690152 | p03699 | C++ | #include <iostream>
#include <cassert>
#include <vector>
#include <cmath>
#include <ctime>
#include <cstdlib>
#include <fstream>
#include <string>
#include <sstream>
#include <iterator>
#include <map>
#include <algorithm>
#include <memory>
#include <iomanip>
#include <limits>
#include <typeinfo>
#include <stdio.h>
#include <string.h>
using namespace std;
int max(int f1, int f2, int f3){
return max(f1, max(f2, f3));
}
//和の最大を求める関数:分割して統治のアルゴリズム
int maxsum3(int x[], int l, int u){
if(l > u){//要素がない場合
return 0.0f;
}
if(l == u){
return max(0.0f, x[l]);
}
int m = (l + u) / 2;
//境界から左に伸びる部分配列の和最大値
int lmax, rmax, sum;
lmax = sum = 0.0f;
for(int i = m; i >= l; i--){
sum += x[i];
lmax = max(lmax, sum);
}
//境界から右に伸びる部分配列の和最大値
rmax = sum = 0.0f;
for(int i = m + 1; i <= u; i++){
sum += x[i];
rmax = max(rmax, sum);
}
return max(lmax + rmax, maxsum3(x, l, m), maxsum3(x, m+1, u));
}
/*
vector <int> addhairetu(const vector <int> &in ,int start ,int rest){
vector <int> ret;
if(rest != 1){
int end;
int i;
rest--;
end = in.size() - rest;
ret.push_back(in[start]);
for(i = start; i <= end; i++){
ret = addhairetu(in, i + 1, rest);
}
}
return ret;
}
*/
int main(int argc, char* argv[])
{
int x[100];
int N;
int maxsofar;
cin >> N;
for(int i=0;i<N;i++){
cin >> wrk[i];
}
maxsofar = maxsum3(x, 0, s.size() - 1);
if(maxsofar % 10 != 0){
cout << maxsofar << endl;
}else{
cout << 0 << endl;
}
return 0;
}
| a.cc: In function 'int maxsum3(int*, int, int)':
a.cc:35:27: error: no matching function for call to 'max(float, int&)'
35 | return max(0.0f, x[l]);
| ~~~^~~~~~~~~~~~
In file included from /usr/include/c++/14/string:51,
from /usr/include/c++/14/bits/locale_classes.h:40,
from /usr/include/c++/14/bits/ios_base.h:41,
from /usr/include/c++/14/ios:44,
from /usr/include/c++/14/ostream:40,
from /usr/include/c++/14/iostream:41,
from a.cc:1:
/usr/include/c++/14/bits/stl_algobase.h:257:5: note: candidate: 'template<class _Tp> constexpr const _Tp& std::max(const _Tp&, const _Tp&)'
257 | max(const _Tp& __a, const _Tp& __b)
| ^~~
/usr/include/c++/14/bits/stl_algobase.h:257:5: note: template argument deduction/substitution failed:
a.cc:35:27: note: deduced conflicting types for parameter 'const _Tp' ('float' and 'int')
35 | return max(0.0f, x[l]);
| ~~~^~~~~~~~~~~~
/usr/include/c++/14/bits/stl_algobase.h:303:5: note: candidate: 'template<class _Tp, class _Compare> constexpr const _Tp& std::max(const _Tp&, const _Tp&, _Compare)'
303 | max(const _Tp& __a, const _Tp& __b, _Compare __comp)
| ^~~
/usr/include/c++/14/bits/stl_algobase.h:303:5: note: candidate expects 3 arguments, 2 provided
In file included from /usr/include/c++/14/algorithm:61,
from a.cc:12:
/usr/include/c++/14/bits/stl_algo.h:5706:5: note: candidate: 'template<class _Tp> constexpr _Tp std::max(initializer_list<_Tp>)'
5706 | max(initializer_list<_Tp> __l)
| ^~~
/usr/include/c++/14/bits/stl_algo.h:5706:5: note: candidate expects 1 argument, 2 provided
/usr/include/c++/14/bits/stl_algo.h:5716:5: note: candidate: 'template<class _Tp, class _Compare> constexpr _Tp std::max(initializer_list<_Tp>, _Compare)'
5716 | max(initializer_list<_Tp> __l, _Compare __comp)
| ^~~
/usr/include/c++/14/bits/stl_algo.h:5716:5: note: template argument deduction/substitution failed:
a.cc:35:27: note: mismatched types 'std::initializer_list<_Tp>' and 'float'
35 | return max(0.0f, x[l]);
| ~~~^~~~~~~~~~~~
a.cc:24:5: note: candidate: 'int max(int, int, int)'
24 | int max(int f1, int f2, int f3){
| ^~~
a.cc:24:5: note: candidate expects 3 arguments, 2 provided
a.cc: In function 'int main(int, char**)':
a.cc:89:24: error: 'wrk' was not declared in this scope
89 | cin >> wrk[i];
| ^~~
a.cc:92:34: error: 's' was not declared in this scope
92 | maxsofar = maxsum3(x, 0, s.size() - 1);
| ^
|
s138906192 | p03699 | C++ | #include <iostream>
#include <vector>
#include <numeric>
using namespace std;
int main(){
int N;
cin >> N;
vector<int> v(N), noten;
for (int i = 0; i < N; ++i){
cin >> v[i];
if (v[i] % 10 != 10) noten[i] = v[i];
}
sort(noten.begin(), noten.end());
int sum = accumulate(v.begin(), v.end(), 0);
if (sum % 10 != 0) cout << sum << endl;
else cout << sum - noten[0] << endl;
return 0;
}
| a.cc: In function 'int main()':
a.cc:16:5: error: 'sort' was not declared in this scope; did you mean 'short'?
16 | sort(noten.begin(), noten.end());
| ^~~~
| short
|
s709795140 | p03699 | C++ | #include <iostream>
#include <vector>
#include <numeric>
using namespace std;
int main(){
int N;
cin >> N;
std::vector<int> v(N), noten(N);
for (int i = 0; i < N; ++i){
cin >> v[i];
if (v[i] % 10 != 10) noten[i] = v[i];
}
sort(noten.begin(), noten.end());
int sum = accumulate(v.begin(), v.end(), 0);
if (sum % 10 != 0) cout << sum << endl;
else cout << sum - noten[0] << endl;
return 0;
} | a.cc: In function 'int main()':
a.cc:16:5: error: 'sort' was not declared in this scope; did you mean 'short'?
16 | sort(noten.begin(), noten.end());
| ^~~~
| short
|
s107649465 | p03699 | C++ | #include <iostream>
using namespace std;
int main()
{
int N;
cin >> N;
int S[N-1];
for (int i = 0;i < N;i++){
cin >> S[i];
}
sort(S, S + N);
int t = 0;
for(int c = 0;c < N;c++){
t = t + S[c];
}
if(t%10!=0)
cout << t <<"\n";
else
for(int d = 0;d < N;d++){
if(d%10!=0)
t = t-S[d];
cout << t <<"\n";
break;
}
if(t%10==0)
cout << "0";
return 0;
} | a.cc: In function 'int main()':
a.cc:11:5: error: 'sort' was not declared in this scope; did you mean 'short'?
11 | sort(S, S + N);
| ^~~~
| short
|
s844138340 | p03699 | C++ | #include <iostream.h>
int main(int argc, char *argv[])
{
int n;
int s[101];
scanf("%d",&n);
int i,j,count=0;
for(i=0;i<n;i++)
{
scanf("%d",&s[i]);
count+=s[i];
}
for( j=0;j<n;j++)
{
if(count%10==0)
{
count-=s[j];
if(count==0){
printf("%d",count);
}
}
else
{
printf("%d",count);
break;
}
}
return 0;
} | a.cc:1:10: fatal error: iostream.h: No such file or directory
1 | #include <iostream.h>
| ^~~~~~~~~~~~
compilation terminated.
|
s413519787 | p03699 | C | #include <iostream.h>
int main(int argc, char *argv[])
{
int n;
int s[101];
scanf("%d",&n);
int i,j,count=0;
for(i=0;i<n;i++)
{
scanf("%d",&s[i]);
count+=s[i];
}
for( j=0;j<n;j++)
{
if(count%10==0)
{
count-=s[j];
if(count==0){
printf("%d",count);
}
}
else
{
printf("%d",count);
break;
}
}
return 0;
} | main.c:1:10: fatal error: iostream.h: No such file or directory
1 | #include <iostream.h>
| ^~~~~~~~~~~~
compilation terminated.
|
s264984758 | p03699 | C++ | #include<bits/stdc++.h>
using namespace std;
int a[1000];
int sum;
int dp[1000];
int ans[1000];
int main()
{
int n;
scanf("%d",&n);
for(int i=1;i<=n;i++)
{
scanf("%d",&a[i]);
sum+=a[i];
}
sort(a+1,a+1+n);
if(sum[i]%10!=0)
{
printf("%d",sum);
return 0;
}
for(int i=1;i<=n;i++)
{
if(a[i]%10!=0)
{
printf("%d",sum-a[i]);
return 0;
}
}
printf("0");
return 0;
}
| a.cc: In function 'int main()':
a.cc:18:12: error: 'i' was not declared in this scope
18 | if(sum[i]%10!=0)
| ^
|
s771170583 | p03699 | C++ | #include <stdio.h>
#include <string.h>
int main(void) {
int N,i,A=0,b=0,j,c=0;
scnaf("%d",N);
int s[N];
for(i=1;i<=N;i++){
scanf("%d",&s[i-1]);
}
for(i=1;i<=N;i++){
A+=s[i-1];
}
for(j=1;j<=N;j++){
for(i=1;i<=N;i++){
if(s[i-1]>=s[i]){
b=s[i-1];
s[i-1]=s[i];
s[i]=b;
}
}
}
if(A%10 != 0){
printf("%d",A);
}
else{
for(i=1;i<=N;i++){
if((A-s[i-1])%10!=0){
printf("%d",A-s[i-1]);
c=1;
break;
}
}
}
if(c==0){
printf("0");
}
return 0;
}
| a.cc: In function 'int main()':
a.cc:6:9: error: 'scnaf' was not declared in this scope; did you mean 'scanf'?
6 | scnaf("%d",N);
| ^~~~~
| scanf
|
s099797431 | p03699 | C | #include <stdio.h>
int main(void){
int n;
int a[100];
int i;
int max=0;
int min=101;
scanf("%d",&n);
for(i=0;i<n;i++){
scanf("%d",&a[i]);
if((a[i]%10)!=0)&&(min >a[i])){
min =a[i];
}
max=a[i]+max;
}
if((max%10)!=0)
printf("%d",max);
else{
max = max -min;
printf("%d",max);
}
return 0;
} | main.c: In function 'main':
main.c:11:19: error: expected identifier before '(' token
11 | if((a[i]%10)!=0)&&(min >a[i])){
| ^
main.c:11:30: error: expected statement before ')' token
11 | if((a[i]%10)!=0)&&(min >a[i])){
| ^
|
s154951801 | p03699 | C++ | #include <iostream>
#include <algorithm>
#include <cstdio>
using namespace std;
typedef long long ll;
int s [101];
int a [1000000000000];
int arrow = 0;
int n;
int mini = 1000000000;
int maxi = 0;
void dfs(int sum, int k){
if(k == n) {
if(sum % 10 == 0) {
a[arrow++] = 0;
mini = 0;
}
else {
maxi = max(maxi, sum);
mini = min(mini, sum);
}
}
else{
dfs(sum + s[k], k + 1);
dfs(sum, k + 1);
}
return;
}
int main(){
cin >> n;
for(int i = 0; i < n; i++){
cin >> s[i];
}
dfs(0, 0);
cout << maxi - mini << endl;
return 0;
} | /tmp/ccvrzoF5.o: in function `dfs(int, int)':
a.cc:(.text+0x10): relocation truncated to fit: R_X86_64_PC32 against symbol `n' defined in .bss section in /tmp/ccvrzoF5.o
a.cc:(.text+0x4d): relocation truncated to fit: R_X86_64_PC32 against symbol `arrow' defined in .bss section in /tmp/ccvrzoF5.o
a.cc:(.text+0x56): relocation truncated to fit: R_X86_64_PC32 against symbol `arrow' defined in .bss section in /tmp/ccvrzoF5.o
a.cc:(.text+0x88): relocation truncated to fit: R_X86_64_PC32 against symbol `maxi' defined in .bss section in /tmp/ccvrzoF5.o
a.cc:(.text+0x98): relocation truncated to fit: R_X86_64_PC32 against symbol `maxi' defined in .bss section in /tmp/ccvrzoF5.o
/tmp/ccvrzoF5.o: in function `main':
a.cc:(.text+0x107): relocation truncated to fit: R_X86_64_PC32 against symbol `n' defined in .bss section in /tmp/ccvrzoF5.o
a.cc:(.text+0x155): relocation truncated to fit: R_X86_64_PC32 against symbol `n' defined in .bss section in /tmp/ccvrzoF5.o
a.cc:(.text+0x16f): relocation truncated to fit: R_X86_64_PC32 against symbol `maxi' defined in .bss section in /tmp/ccvrzoF5.o
collect2: error: ld returned 1 exit status
|
s063964890 | p03699 | C | 3
10
10
15 | main.c:1:1: error: expected identifier or '(' before numeric constant
1 | 3
| ^
|
s393724219 | p03699 | C++ | #include <iostream>
#include <cstdio>
#include <string>
#include <vector>
using namespace std;
int main(int argc, char const *argv[]) {
int N;
cin>>N;
vector<int> s(N);
int max=0;
int tmp=0;
for (size_t i = 0; i < N; i++) {
cin>>s[i];
}
sort(s.begin(),s.end());
for (size_t i = 0; i < N; i++) {
max+=s[i];
}
for (size_t i = 0; i < N; i++) {
if(max%10!=0){
printf("%d\n", max);
return 0;
}
max-=s[i];
}
printf("0\n");
return 0;
}
| a.cc: In function 'int main(int, const char**)':
a.cc:16:3: error: 'sort' was not declared in this scope; did you mean 'short'?
16 | sort(s.begin(),s.end());
| ^~~~
| short
|
s869630273 | p03699 | C++ |
#define fi first
#define se second
#define mp make_pair
#define pb push_back
typedef long long ll;
typedef pair<int,int> ii;
typedef vector<int> vi;
int main(){
long int n; cin>>n;long int a[n];long int ans = 0;long int max = 0;
for (int i = 0; i < n; i++){
cin>>a[i]; ans += a[i];
}
if(ans%10 == 0){
for (int i = 0; i < n; i++){
ans -= a[i];
if (ans%10 != 0){
if (max < ans){
max = ans;
//ans += a[i];
}
}
else {
ans += a[i];
}
}
cout << max; return 0;
}
if (ans%10 == 0){cout<<'0';return 0;}
cout<<ans;
} | a.cc:8:9: error: 'pair' does not name a type
8 | typedef pair<int,int> ii;
| ^~~~
a.cc:9:9: error: 'vector' does not name a type
9 | typedef vector<int> vi;
| ^~~~~~
a.cc: In function 'int main()':
a.cc:12:17: error: 'cin' was not declared in this scope
12 | long int n; cin>>n;long int a[n];long int ans = 0;long int max = 0;
| ^~~
a.cc:29:9: error: 'cout' was not declared in this scope
29 | cout << max; return 0;
| ^~~~
a.cc:32:22: error: 'cout' was not declared in this scope
32 | if (ans%10 == 0){cout<<'0';return 0;}
| ^~~~
a.cc:33:5: error: 'cout' was not declared in this scope
33 | cout<<ans;
| ^~~~
|
s221842560 | p03699 | C | #include<stdio.h>
#include<stdlib.h>
int main(){
int n,s[110],i,sum,temp;
scanf("%d",&n);
for(i=0;i<n;i++){
scanf("%d",&s[i]);
}
for(i=0;i<n-1;i++){
for(j=0;j<n-i-1;j++){
if(s[j]>s[j+1]){
temp=s[j];
s[j]=s[j+1];
s[j+1]=temp;
temp=s[j];
}
}
}
sum=0;
for(i=0;i<n;i++){
sum=sum+s[i];
}
i=0;
while(sum%10==0){
sum=sum-s[i];
i++;
}
printf("%d",sum);
return 0;
} | main.c: In function 'main':
main.c:10:5: error: 'j' undeclared (first use in this function)
10 | for(j=0;j<n-i-1;j++){
| ^
main.c:10:5: note: each undeclared identifier is reported only once for each function it appears in
|
s538239344 | p03699 | Java | public class Main {
public static void main(String[] args){
Scanner sc= new Scanner(System.in);
int N=sc.nextInt();
int sum=0;
int[]arry=new int[N];
for(int i=0;i<N;i++)
{arry[i]=sc.nextInt();}
for(int i=0;i<N;i++)
{sum+=arry[i];}
if(sum%10==0)
{
for(int i=0;i<N;i++)
{
if ((sum-arry[i])%10!=0)
{sum-=arry[i];
System.out.println(sum);
break;}
else
{System.out.println("0");
break; }
}
}
else System.out.println(sum);
}
} | Main.java:3: error: cannot find symbol
Scanner sc= new Scanner(System.in);
^
symbol: class Scanner
location: class Main
Main.java:3: error: cannot find symbol
Scanner sc= new Scanner(System.in);
^
symbol: class Scanner
location: class Main
2 errors
|
s295604108 | p03699 | Java | public class Main {
public static void main(String[] args){
Scanner sc= new Scanner(System.in);
int N=sc.nextInt();
int sum=0;
int[]arry=new int[N];
for(int i=0;i<N;i++)
{arry[i]=sc.nextInt();}
for(int i=0;i<N;i++)
{sum+=arry[i];}
if(sum%10==0)
{
for(int i=0;i<N;i++)
{
if ((sum-arry[i])%10!=0)
{sum-=arry[i];
System.out.println(sum);
break;}
else
{System.out.println("0");
break; }
}
}
else System.out.println(sum);
}
} | Main.java:3: error: cannot find symbol
Scanner sc= new Scanner(System.in);
^
symbol: class Scanner
location: class Main
Main.java:3: error: cannot find symbol
Scanner sc= new Scanner(System.in);
^
symbol: class Scanner
location: class Main
2 errors
|
s565475569 | p03699 | Java | import java.util.Arrays;
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner stdin = new Scanner(System.in);
int k = 0, n = 0;
boolean b = true;
n = stdin.nextInt();
int[] a = new int[n];
for (int i = 0; i < n; i++) {
a[i] = stdin.nextInt();
k = k + a[i];
if (a[i] % 10 != 0) {
b = false;
}
}
Arrays.sort(a);
if (b) {
System.out.println(0);
} else {
if (k % 10 != 0) {
System.out.println(k);
} else {
for (int j = 0; j < n; j++) {
if (a[j] % 10 != 0) {
k = k - a[j];
}
if (k % 10 != 0) {
System.out.println(k);
break;
}
}
}
} | Main.java:36: error: reached end of file while parsing
}
^
1 error
|
s851141665 | p03699 | Java | import com.sun.tools.hat.internal.util.ArraySorter;
import java.util.Arrays;
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int n = sc.nextInt();
int total = 0;
int[] ans = new int[n];
for (int i = 0; i < n; i++) {
ans[i] = sc.nextInt();
total += ans[i];
}
Arrays.sort(ans);
for (int i = 1; i < n; i++){
if(i==n){
System.out.println("0");
}
if (total % 10 == 0) {
total=0;
for(int j=i;j<ans.length;j++){
total+=ans[j];
}
} else {
System.out.println(total);
break;
}
}
}
}
| Main.java:1: error: package com.sun.tools.hat.internal.util does not exist
import com.sun.tools.hat.internal.util.ArraySorter;
^
1 error
|
s190762701 | p03699 | C++ | #include <stdio.h>
#include<bits/stdc++.h>
int main()
{
int N;
int i;
scanf("%d",&N);
int a[105]={0};
int sum=0;
for(i=1;i<=N;i++){
scanf("%d",&a[i]);
sum+=a[i];
}
sort(a,a+N);
for(i=1;i<=N;i++){
if(sum%10==0)
sum-=a[i];
else if(sum%10!=0&&sum>=0)
printf("%d",sum);
}
return 0;
}
| a.cc: In function 'int main()':
a.cc:15:4: error: 'sort' was not declared in this scope; did you mean 'std::sort'?
15 | sort(a,a+N);
| ^~~~
| std::sort
In file included from /usr/include/c++/14/algorithm:86,
from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:51,
from a.cc:2:
/usr/include/c++/14/pstl/glue_algorithm_defs.h:296:1: note: 'std::sort' declared here
296 | sort(_ExecutionPolicy&& __exec, _RandomAccessIterator __first, _RandomAccessIterator __last);
| ^~~~
|
s332919929 | p03699 | C++ | #include<bits/stdc++.h>
using namespace std;
int main ()
{
int a[200],n;
cin>>n;
for(int i=0;i<n;i++)
cin>>a[i];
sort(a,a+n);
int sum=0;
for(int i=n-1;i>=0;i--){
if((sum+a[0])%10) sum+=a[i];
}
cout<<sum<<endl;
return 0;
}
` | a.cc:21:1: error: stray '`' in program
21 | `
| ^
|
s790671930 | p03699 | C++ | #include <stdio.h>
#include <stdlib.h>
int main(void){
int quest;
int *dat;
int sum = 0;
int min = 150;
scanf("%d",&quest);
dat = malloc(sizeof(int) * quest);
int i;
for(i = 0; i < quest;i++){
scanf("%d",&dat[i]);
sum += dat[i];
if(dat[i] < min && dat[i] % 10 != 0){
min = dat[i];
}
}
/*
for(i = 0; i < quest;i++){
printf("%d\n",dat[i]);
}
*/
if(sum % 10 == 0){
if(min != 150){
sum = sum - min;
printf("%d",sum);
}else{
printf("0");
}
}else{
printf("%d",sum);
}
free(dat);
return 0;
} | a.cc: In function 'int main()':
a.cc:12:15: error: invalid conversion from 'void*' to 'int*' [-fpermissive]
12 | dat = malloc(sizeof(int) * quest);
| ~~~~~~^~~~~~~~~~~~~~~~~~~~~
| |
| void*
|
s625804834 | p03699 | C++ | #include<iostream>
using namespace std;
void masatoy(int [101],int,int);
int sum1 = 0, sum2 = 0;
int max = 0, n;
int main() {
int a[101]={0};
cin >> n;
for (int i = 0; i < n; i++) {
cin >> a[i];
}
masatoy(a, 0, 0);
cout << max << endl;
}
void masatoy(int b[101],int wa,int i) {
if (wa % 10 != 0 && wa > max) {
max = wa;
}
if (i + 1 <= n) {
masatoy(b, wa + b[i], i + 1);
masatoy(b, wa, i + 1);
}
} | a.cc: In function 'int main()':
a.cc:13:17: error: reference to 'max' is ambiguous
13 | cout << max << endl;
| ^~~
In file included from /usr/include/c++/14/string:51,
from /usr/include/c++/14/bits/locale_classes.h:40,
from /usr/include/c++/14/bits/ios_base.h:41,
from /usr/include/c++/14/ios:44,
from /usr/include/c++/14/ostream:40,
from /usr/include/c++/14/iostream:41,
from a.cc:1:
/usr/include/c++/14/bits/stl_algobase.h:303:5: note: candidates are: 'template<class _Tp, class _Compare> constexpr const _Tp& std::max(const _Tp&, const _Tp&, _Compare)'
303 | max(const _Tp& __a, const _Tp& __b, _Compare __comp)
| ^~~
/usr/include/c++/14/bits/stl_algobase.h:257:5: note: 'template<class _Tp> constexpr const _Tp& std::max(const _Tp&, const _Tp&)'
257 | max(const _Tp& __a, const _Tp& __b)
| ^~~
a.cc:5:5: note: 'int max'
5 | int max = 0, n;
| ^~~
a.cc: In function 'void masatoy(int*, int, int)':
a.cc:16:34: error: reference to 'max' is ambiguous
16 | if (wa % 10 != 0 && wa > max) {
| ^~~
/usr/include/c++/14/bits/stl_algobase.h:303:5: note: candidates are: 'template<class _Tp, class _Compare> constexpr const _Tp& std::max(const _Tp&, const _Tp&, _Compare)'
303 | max(const _Tp& __a, const _Tp& __b, _Compare __comp)
| ^~~
/usr/include/c++/14/bits/stl_algobase.h:257:5: note: 'template<class _Tp> constexpr const _Tp& std::max(const _Tp&, const _Tp&)'
257 | max(const _Tp& __a, const _Tp& __b)
| ^~~
a.cc:5:5: note: 'int max'
5 | int max = 0, n;
| ^~~
a.cc:17:17: error: reference to 'max' is ambiguous
17 | max = wa;
| ^~~
/usr/include/c++/14/bits/stl_algobase.h:303:5: note: candidates are: 'template<class _Tp, class _Compare> constexpr const _Tp& std::max(const _Tp&, const _Tp&, _Compare)'
303 | max(const _Tp& __a, const _Tp& __b, _Compare __comp)
| ^~~
/usr/include/c++/14/bits/stl_algobase.h:257:5: note: 'template<class _Tp> constexpr const _Tp& std::max(const _Tp&, const _Tp&)'
257 | max(const _Tp& __a, const _Tp& __b)
| ^~~
a.cc:5:5: note: 'int max'
5 | int max = 0, n;
| ^~~
|
s816162102 | p03699 | C | #include<stdio.h>
#include<stdlib.h>
#include<bits/stdc++.h>
#include<algorithm>
using namespace std;
int main()
{
int n,i,j;
scanf("%d",&n);
int m[n];
for(i=0;i<n;i++)
{
scanf("%d",&m[i]);
}
sort(m,m+n);
int res=0;
for(j=n-1;j>=0;j--)
{
if((res+m[j])%10!=0)
{
res=res+m[j];
}
}
printf("%d\n",res);
} | main.c:3:9: fatal error: bits/stdc++.h: No such file or directory
3 | #include<bits/stdc++.h>
| ^~~~~~~~~~~~~~~
compilation terminated.
|
s782556264 | p03699 | C | #include<stdio.h>
#include<algorithm>
using namespace std;
int num[101];
int main(){
int n,i;
while(scanf("%d",&n)!=EOF){
int sum=0,s=0;
for(i=0;i<n;i++){
scanf("%d",&num[i]);
sum+=num[i];
}
sort(num,num+n);
while(sum%10==0){
sum-=num[s++];
if(s==n)
break;
}
printf("%d\n",sum);
}
return 0;
} | main.c:2:9: fatal error: algorithm: No such file or directory
2 | #include<algorithm>
| ^~~~~~~~~~~
compilation terminated.
|
s876216478 | p03699 | C++ | #include <stdio.h>
#include <stdlib.h>
int main(void)
{
int n;
scanf("%d", &n);
int s, sum = 0, min = 100;
for (int i = 0; i < n; ++i){
scanf("%d", &s);
sum += s;
if (s % 10 && min > s )
min = s;
}
if (sum % 10)
printf("%d\n", sum);
else{
if (min % 10)
printf("%d"\n, sum - min);
else
printf("%d\n", 0);
}
return 0;
} | a.cc:20:24: error: stray '\' in program
20 | printf("%d"\n, sum - min);
| ^
a.cc: In function 'int main()':
a.cc:20:24: error: expected ')' before 'n'
20 | printf("%d"\n, sum - min);
| ~ ^~
| )
|
s018668939 | p03699 | C | #include <stdio.h>
int main(){
int n, i, sum, s[150];
scanf("%d", &n);
for (i=0;i<n;i++)
{
scanf("%d", &s[i]);
sum+=s[i];
}
i=0;
while(1){
if(sum%10!=0||sum==0){
break;
}else{
sum-=s[i];
i++;
}
printf("%d\n", sum);
return 0;
}
| main.c: In function 'main':
main.c:22:1: error: expected declaration or statement at end of input
22 | }
| ^
|
s238982747 | p03699 | C++ | #include <stdio.h>
int bezero(int n)
{
if(n%10==0)return 0;
return n;
}
int max(int N,int s[N])
{
int sum=0;
int max=-114514;
for(int i=0;i<N;i++)
sum+=s[i];
if(bezero(sum)!=0)return sum;
for(int i=0;i<N;i++)
{
int x=bezero(sum-s[i]);
if(max<x)
max=x;
}
return max;
}
int main(void)
{
int N;
scanf("%d",&N);
int s[N];
for(int i=0;i<N;i++)
scanf("%d",&s[i]);
int a=max(N,s);
printf("%d\n",a);
return 0;
}
| a.cc:9:22: error: use of parameter outside function body before ']' token
9 | int max(int N,int s[N])
| ^
a.cc: In function 'int max(...)':
a.cc:13:23: error: 'N' was not declared in this scope
13 | for(int i=0;i<N;i++)
| ^
a.cc:14:22: error: 's' was not declared in this scope
14 | sum+=s[i];
| ^
a.cc:16:23: error: 'N' was not declared in this scope
16 | for(int i=0;i<N;i++)
| ^
a.cc:18:34: error: 's' was not declared in this scope
18 | int x=bezero(sum-s[i]);
| ^
|
s887187699 | p03699 | C++ | /*input
3
10
20
30
*/
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#define MOD 1000000007
#define MODSET(d) if ((d) >= MOD) d %= MOD;
#define MODNEGSET(d) if ((d) < 0) d = ((d % MOD) + MOD) % MOD;
#define MODADDSET(d) if ((d) >= MOD) d -= MOD;
#define MODADDWHILESET(d) while ((d) >= MOD) d -= MOD;
//defines
#define sc1(d) scanf("%d", &d);
#define sc2(a, b) scanf("%d %d", &a, &b);
#define sc3(a, b, c) scanf("%d %d %d", &a, &b, &c);
#define sc4(a, b, c, d) scanf("%d %d %d %d", &a, &b, &c, &d);
#define dsc1(d) int d; scanf("%d", &d);
#define dsc2(a, b) int a,b; scanf("%d %d", &a, &b);
#define dsc3(a, b, c) int a,b,c; scanf("%d %d %d", &a, &b, &c);
#define dsc4(a, b, c, d) int a ,b,c,d; scanf("%d %d %d %d", &a, &b, &c, &d);
#define scll1(d) scanf("%lld", &d);
#define scll2(a, b) scanf("%lld %lld", &a, &b);
#define scll3(a, b, c) scanf("%lld %lld %lld", &a, &b, &c);
#define scll4(a, b, c, d) scanf("%lld %lld %lld %lld", &a, &b, &c, &d);
#define dscll1(d) ll d; scanf("%lld", &d);
#define dscll2(a, b) ll a,b; scanf("%lld %lld", &a, &b);
#define dscll3(a, b, c) ll a,b,c; scanf("%lld %lld %lld", &a, &b, &c);
#define dscll4(a, b, c, d) ll a,b,c,d; scanf("%lld %lld %lld %lld", &a, &b, &c, &d);
#define fastio ios_base::sync_with_stdio(false);cin.tie(NULL);
#define re(i,b) for(int i=0;i<int(b);i++)
#define all(c) c.begin(), c.end()
#define apresent(container, element) (container.find(element) != container.end()) //for map,set..etc (returns true/false value)
#define spresent(container, element) (find(all(container),element) != container.end()) //for vectors,strings,list,deque (returns true/false value)
#define eb emplace_back
#define mp make_pair
#define fi first
#define se second
#define pb push_back
#define pf push_front
#define ins insert
#define clr clear()
#define sqr(x) ((x)*(x))
#define sz(x) ((int)x.size())
#define dt distance
#define test(t) int t; scanf("%d",&t); while(t--)
#define csb(i) __builtin_popcount(i)
#define csbll(i) __builtin_popcountll(i)
#define digits(i) (int)log10(i)+1 // does not apply for i==0 , add an excetion contition for n==0 ( just return count 1 for that inseted of using this function)
#define M 32
#define mod 1000000007
#define tdv(rowsize,colsize,type,name) vector<vector<type>> name(rowsize,vector<type>(colsize));
using namespace std;
using namespace __gnu_pbds;
//typedef
typedef string str;
typedef long long ll;
typedef unsigned long long ull;
typedef vector<int> vi;
typedef vector<str> vs;
typedef pair<int,int> pii;
typedef pair<str,int> psi;
typedef pair<int,str> pis;
typedef vector<pii> vii;
typedef map<int,int> mii;
typedef map<str,int> msi;
typedef map<char,int> mci;
typedef map<int,str> mis;
typedef unordered_map<int,int> umii;
typedef unordered_map<str,int> umsi;
typedef unordered_map<int,str> umis;
typedef unordered_map<char,int> umci;
typedef set<str> ss;
typedef set<int> si;
typedef unordered_set<str> uss;
typedef unordered_set<int> usi;
// #define DEBUG
#ifdef DEBUG
#define debug(args...) cout << "Line No = " << __LINE__ << " >\t"; (Debugger()) , args
class Debugger
{
public:
Debugger(const std::string& _separator = ", ") :
first(true), separator(_separator){}
template<typename ObjectType>
Debugger& operator , (const ObjectType& v)
{
if(!first)
std::cout << separator;
std::cout << v;
first = false;
return *this;
}
~Debugger() { std::cout << endl;}
private:
bool first;
std::string separator;
};
template <typename T1, typename T2>
inline std::ostream& operator << (std::ostream& os, const std::pair<T1, T2>& p)
{
return os << "(" << p.first << ", " << p.second << ")";
}
template<typename T>
inline std::ostream &operator << (std::ostream & os,const std::vector<T>& v)
{
bool first = true;
os << "[";
for(unsigned int i = 0; i < v.size(); i++)
{
if(!first)
os << ", ";
os << v[i];
first = false;
}
return os << "]";
}
template<typename T>
inline std::ostream &operator << (std::ostream & os,const std::set<T>& v)
{
bool first = true;
os << "[";
for (typename std::set<T>::const_iterator ii = v.begin(); ii != v.end(); ++ii)
{
if(!first)
os << ", ";
os << *ii;
first = false;
}
return os << "]";
}
template<typename T1, typename T2>
inline std::ostream &operator << (std::ostream & os,const std::map<T1, T2>& v)
{
bool first = true;
os << "[";
for (typename std::map<T1, T2>::const_iterator ii = v.begin(); ii != v.end(); ++ii)
{
if(!first)
os << ", ";
os << *ii ;
first = false;
}
return os << "]";
}
template<typename T>
inline std::ostream &operator << (std::ostream & os,const std::deque<T>& v)
{
bool first = true;
os << "[";
for (auto s: v)
{
if(!first)
os << ", ";
os << s;
first = false;
}
return os << "]";
}
template<typename T>
inline std::ostream &operator << (std::ostream & os,const std::list<T>& v)
{
bool first = true;
os << "[";
for (auto s: v)
{
if(!first)
os << ", ";
os << s;
first = false;
}
return os << "]";
}
#else
#define debug(args...) // Just strip off all debug tokens
#endif
#include <bits/stdc++.h>
using namespace std;
int primes[3]={2,3,5};
int n=100;
int inc_exe(int idx=0,int d=1,int sign=-1){
if(idx==3){
if(d==1)return 0;
return sign*n/d;
}
return inc_exe(idx+1,d,sign)+inc_exe(idx+1,d*primes[idx],sign*-1);
}
int main(){
int n;
cin>>n;
vi v(n);
re(i,n)cin>>v[i];
int sum=accumulate(all(v),sum);
sort(all(v));
debug(v,sum);
int index=0;
while(sum%10==0 && index<n){
sum-=v[index];
index++;
}
cout<<sum;
return 0;
/*input
3
10
20
30
*/
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#define MOD 1000000007
#define MODSET(d) if ((d) >= MOD) d %= MOD;
#define MODNEGSET(d) if ((d) < 0) d = ((d % MOD) + MOD) % MOD;
#define MODADDSET(d) if ((d) >= MOD) d -= MOD;
#define MODADDWHILESET(d) while ((d) >= MOD) d -= MOD;
//defines
#define sc1(d) scanf("%d", &d);
#define sc2(a, b) scanf("%d %d", &a, &b);
#define sc3(a, b, c) scanf("%d %d %d", &a, &b, &c);
#define sc4(a, b, c, d) scanf("%d %d %d %d", &a, &b, &c, &d);
#define dsc1(d) int d; scanf("%d", &d);
#define dsc2(a, b) int a,b; scanf("%d %d", &a, &b);
#define dsc3(a, b, c) int a,b,c; scanf("%d %d %d", &a, &b, &c);
#define dsc4(a, b, c, d) int a ,b,c,d; scanf("%d %d %d %d", &a, &b, &c, &d);
#define scll1(d) scanf("%lld", &d);
#define scll2(a, b) scanf("%lld %lld", &a, &b);
#define scll3(a, b, c) scanf("%lld %lld %lld", &a, &b, &c);
#define scll4(a, b, c, d) scanf("%lld %lld %lld %lld", &a, &b, &c, &d);
#define dscll1(d) ll d; scanf("%lld", &d);
#define dscll2(a, b) ll a,b; scanf("%lld %lld", &a, &b);
#define dscll3(a, b, c) ll a,b,c; scanf("%lld %lld %lld", &a, &b, &c);
#define dscll4(a, b, c, d) ll a,b,c,d; scanf("%lld %lld %lld %lld", &a, &b, &c, &d);
#define fastio ios_base::sync_with_stdio(false);cin.tie(NULL);
#define re(i,b) for(int i=0;i<int(b);i++)
#define all(c) c.begin(), c.end()
#define apresent(container, element) (container.find(element) != container.end()) //for map,set..etc (returns true/false value)
#define spresent(container, element) (find(all(container),element) != container.end()) //for vectors,strings,list,deque (returns true/false value)
#define eb emplace_back
#define mp make_pair
#define fi first
#define se second
#define pb push_back
#define pf push_front
#define ins insert
#define clr clear()
#define sqr(x) ((x)*(x))
#define sz(x) ((int)x.size())
#define dt distance
#define test(t) int t; scanf("%d",&t); while(t--)
#define csb(i) __builtin_popcount(i)
#define csbll(i) __builtin_popcountll(i)
#define digits(i) (int)log10(i)+1 // does not apply for i==0 , add an excetion contition for n==0 ( just return count 1 for that inseted of using this function)
#define M 32
#define mod 1000000007
#define tdv(rowsize,colsize,type,name) vector<vector<type>> name(rowsize,vector<type>(colsize));
using namespace std;
using namespace __gnu_pbds;
//typedef
typedef string str;
typedef long long ll;
typedef unsigned long long ull;
typedef vector<int> vi;
typedef vector<str> vs;
typedef pair<int,int> pii;
typedef pair<str,int> psi;
typedef pair<int,str> pis;
typedef vector<pii> vii;
typedef map<int,int> mii;
typedef map<str,int> msi;
typedef map<char,int> mci;
typedef map<int,str> mis;
typedef unordered_map<int,int> umii;
typedef unordered_map<str,int> umsi;
typedef unordered_map<int,str> umis;
typedef unordered_map<char,int> umci;
typedef set<str> ss;
typedef set<int> si;
typedef unordered_set<str> uss;
typedef unordered_set<int> usi;
// #define DEBUG
#ifdef DEBUG
#define debug(args...) cout << "Line No = " << __LINE__ << " >\t"; (Debugger()) , args
class Debugger
{
public:
Debugger(const std::string& _separator = ", ") :
first(true), separator(_separator){}
template<typename ObjectType>
Debugger& operator , (const ObjectType& v)
{
if(!first)
std::cout << separator;
std::cout << v;
first = false;
return *this;
}
~Debugger() { std::cout << endl;}
private:
bool first;
std::string separator;
};
template <typename T1, typename T2>
inline std::ostream& operator << (std::ostream& os, const std::pair<T1, T2>& p)
{
return os << "(" << p.first << ", " << p.second << ")";
}
template<typename T>
inline std::ostream &operator << (std::ostream & os,const std::vector<T>& v)
{
bool first = true;
os << "[";
for(unsigned int i = 0; i < v.size(); i++)
{
if(!first)
os << ", ";
os << v[i];
first = false;
}
return os << "]";
}
template<typename T>
inline std::ostream &operator << (std::ostream & os,const std::set<T>& v)
{
bool first = true;
os << "[";
for (typename std::set<T>::const_iterator ii = v.begin(); ii != v.end(); ++ii)
{
if(!first)
os << ", ";
os << *ii;
first = false;
}
return os << "]";
}
template<typename T1, typename T2>
inline std::ostream &operator << (std::ostream & os,const std::map<T1, T2>& v)
{
bool first = true;
os << "[";
for (typename std::map<T1, T2>::const_iterator ii = v.begin(); ii != v.end(); ++ii)
{
if(!first)
os << ", ";
os << *ii ;
first = false;
}
return os << "]";
}
template<typename T>
inline std::ostream &operator << (std::ostream & os,const std::deque<T>& v)
{
bool first = true;
os << "[";
for (auto s: v)
{
if(!first)
os << ", ";
os << s;
first = false;
}
return os << "]";
}
template<typename T>
inline std::ostream &operator << (std::ostream & os,const std::list<T>& v)
{
bool first = true;
os << "[";
for (auto s: v)
{
if(!first)
os << ", ";
os << s;
first = false;
}
return os << "]";
}
#else
#define debug(args...) // Just strip off all debug tokens
#endif
#include <bits/stdc++.h>
using namespace std;
int primes[3]={2,3,5};
int n=100;
int inc_exe(int idx=0,int d=1,int sign=-1){
if(idx==3){
if(d==1)return 0;
return sign*n/d;
}
return inc_exe(idx+1,d,sign)+inc_exe(idx+1,d*primes[idx],sign*-1);
}
int main(){
int n;
cin>>n;
vi v(n);
re(i,n)cin>>v[i];
int sum=accumulate(all(v),sum);
sort(all(v));
debug(v,sum);
int index=0;
while(sum%10==0 && index<n){
sum-=v[index];
index++;
}
cout<<sum;
return 0;
}
}
| a.cc: In function 'int main()':
a.cc:460:5: error: redeclaration of 'int n'
460 | int n=100;
| ^
a.cc:226:13: note: 'int n' previously declared here
226 | int n;
| ^
a.cc:461:43: error: a function-definition is not allowed here before '{' token
461 | int inc_exe(int idx=0,int d=1,int sign=-1){
| ^
a.cc:472:9: warning: empty parentheses were disambiguated as a function declaration [-Wvexing-parse]
472 | int main(){
| ^~
a.cc:472:9: note: remove parentheses to default-initialize a variable
472 | int main(){
| ^~
| --
a.cc:472:9: note: or replace parentheses with braces to value-initialize a variable
a.cc:472:11: error: a function-definition is not allowed here before '{' token
472 | int main(){
| ^
|
s081396466 | p03699 | C | #include <stdio.h>
int main(){
int n, i, sum, s[150];
scanf("%d", %n);
for (i=0;i<n;i++)
{
scanf("%d", s[i]);
sum+=s[i];
}
i=0;
while(1){
if(sum%10!=0){
break;
}else{
sum-=s[i];
i++;
}
}
printf("%d\n", sum);
return 0;
}
| main.c: In function 'main':
main.c:5:15: error: expected expression before '%' token
5 | scanf("%d", %n);
| ^
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.