submission_id
stringlengths
10
10
problem_id
stringlengths
6
6
language
stringclasses
3 values
code
stringlengths
1
522k
compiler_output
stringlengths
43
10.2k
s561589244
p04019
C++
import java.io.*; import java.util.*; import java.lang.*; public class Main { public static void main(String[] args) throws IOException { BufferedReader r = new BufferedReader(new InputStreamReader(System.in)); String path = r.readLine(); int p = 0; for (int j = 0; j < path.length(); j++) p |= (path.charAt(j) == 'S' ? 1 : path.charAt(j) == 'N' ? 2 : path.charAt(j) == 'W' ? 4 : 8); return p == 3 || p == 12 || p == 15 ? "Yes" : "No"; } }
a.cc:1:1: error: 'import' does not name a type 1 | import java.io.*; | ^~~~~~ 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.*; | ^~~~~~ a.cc:2:1: note: C++20 'import' only available with '-fmodules-ts' a.cc:3:1: error: 'import' does not name a type 3 | import java.lang.*; | ^~~~~~ a.cc:3:1: note: C++20 'import' only available with '-fmodules-ts' a.cc:5:1: error: expected unqualified-id before 'public' 5 | public class Main { | ^~~~~~
s251307944
p04019
C++
fn main() { let s = next_line(); let mut v = vec![false; 4]; for c in s.chars() { match c { 'N' => v[0] = true, 'E' => v[1] = true, 'W' => v[2] = true, 'S' => v[3] = true, _ => continue, } } let mut ok = true; for x in 0..4 { if v[x] && v[3 - x] == false {ok = false;} // println!("{}", v[x]); } println!("{}", if ok {"Yes"} else {"No"}); } fn next_line() -> String { let mut input = String::new(); std::io::stdin().read_line(&mut input).unwrap(); input }
a.cc:15:14: error: too many decimal points in number 15 | for x in 0..4 { | ^~~~ a.cc:1:1: error: 'fn' does not name a type 1 | fn main() { | ^~ a.cc:24:1: error: 'fn' does not name a type 24 | fn next_line() -> String { | ^~
s697038772
p04019
C++
n main() { let s = next_line(); let mut v = vec![false; 4]; for c in s.chars() { match c { 'N' => v[0] = true, 'E' => v[1] = true, 'W' => v[2] = true, 'S' => v[3] = true, _ => continue, } } let mut ok = true; for x in 0..4 { if v[x] && v[3 - x] == false {ok = false;} // println!("{}", v[x]); } println!("{}", if ok {"Yes"} else {"No"}); } fn next_line() -> String { let mut input = String::new(); std::io::stdin().read_line(&mut input).unwrap(); input }
a.cc:15:14: error: too many decimal points in number 15 | for x in 0..4 { | ^~~~ a.cc:1:1: error: 'n' does not name a type 1 | n main() { | ^ a.cc:24:1: error: 'fn' does not name a type 24 | fn next_line() -> String { | ^~
s839025354
p04019
Java
import java.util.*; public class Main { public static void main(String[] args){ Scanner scanner = new Scanner(System.in); int N = 0,S = 0,E = 0,W = 0; String s = scanner.nextLine(); for(int i = 0; i < s.length(); i++){ if (s.charAt(i) =='N') { N++; }else if (s.charAt(i) =='E'){ E++; }else if (s.charAt(i) =='W'){ W++; }else if (s.charAt(i) =='S'){ S++; } } if(((N >= 1 && S >= 1) || (N == 0 && S == 0)) && ((W >= 1 && E >= 1) || (W == 0 && E == 0))){ System.out.println("Yes"); }else { System.out.println("No"); } }
Main.java:25: error: reached end of file while parsing } ^ 1 error
s189399276
p04019
C++
using System; using System.Collections.Generic; class Program { static void Main(string[] args){ string s = Console.ReadLine(); Dictionary<char, int> map = new Dictionary<char, int>(); map['N'] = map['S'] = map['W'] = map['E'] = 0; foreach(var e in s){ map[e] = map[e] + 1; } bool b1 = (map['W']*map['E'] == 0 && (map['W']!=0 || map['E']!=0)); bool b2 = (map['N']*map['S'] == 0 && (map['N']!=0 || map['S']!=0)); if( b1 || b2){ Console.WriteLine("No"); } else { Console.WriteLine("Yes"); } } }
a.cc:1:7: error: expected nested-name-specifier before 'System' 1 | using System; | ^~~~~~ a.cc:2:7: error: expected nested-name-specifier before 'System' 2 | using System.Collections.Generic; | ^~~~~~ a.cc:5:22: error: 'string' has not been declared 5 | static void Main(string[] args){ | ^~~~~~ a.cc:5:31: error: expected ',' or '...' before 'args' 5 | static void Main(string[] args){ | ^~~~ a.cc:20:2: error: expected ';' after class definition 20 | } | ^ | ; a.cc: In static member function 'static void Program::Main(int*)': a.cc:6:9: error: 'string' was not declared in this scope 6 | string s = Console.ReadLine(); | ^~~~~~ a.cc:7:9: error: 'Dictionary' was not declared in this scope 7 | Dictionary<char, int> map = new Dictionary<char, int>(); | ^~~~~~~~~~ a.cc:7:20: error: expected primary-expression before 'char' 7 | Dictionary<char, int> map = new Dictionary<char, int>(); | ^~~~ a.cc:8:9: error: 'map' was not declared in this scope 8 | map['N'] = map['S'] = map['W'] = map['E'] = 0; | ^~~ a.cc:9:17: error: 'var' was not declared in this scope 9 | foreach(var e in s){ | ^~~ a.cc:9:9: error: 'foreach' was not declared in this scope 9 | foreach(var e in s){ | ^~~~~~~ a.cc:15:13: error: 'Console' was not declared in this scope 15 | Console.WriteLine("No"); | ^~~~~~~ a.cc:17:13: error: 'Console' was not declared in this scope 17 | Console.WriteLine("Yes"); | ^~~~~~~
s021149884
p04019
Java
/* * Copyright © 2016. Throput Limited. All rights reserved. * Unless otherwise indicated, this file is subject to the * terms and conditions specified in the 'LICENSE.txt' file, * which is part of this source code package. */ import java.util.*; /** * * @author thomaslee */ public class WannaGoBackHome { public static void main(String[] args) { Scanner sc = new Scanner(System.in); String dirs = sc.next(); int e = 0; int s = 0; int w = 0; int n = 0; for (char dir : dirs.toCharArray()) { switch (dir) { case 'E': e++; break; case 'S': s++; break; case 'W': w++; break; case 'N': n++; break; default: System.out.println("No"); System.exit(0); } if (e > 1 && s > 1 && w > 1 && n > 1) { System.out.println("Yes"); System.exit(0); } } System.out.println("No"); } }
Main.java:14: error: class WannaGoBackHome is public, should be declared in a file named WannaGoBackHome.java public class WannaGoBackHome { ^ 1 error
s148124340
p04019
C++
#include<bits/stdc++.h> using namespace std; int main(){ int a=0,b=0; string s; cin>>s; int l=s.length(); for(i=0;i<l;i++){ if(s[i]=='N')b++; else if(s[i]=='S')b--; else if(s[i]=='E')a++; else a--; } if(a==0 && b==0)cout<<"Yes\n"; else cout<<"No\n"; return 0; }
a.cc: In function 'int main()': a.cc:8:5: error: 'i' was not declared in this scope 8 | for(i=0;i<l;i++){ | ^
s307438989
p04019
C++
#include<bits/stdc++.h> using namespace std; int main() { string s; cin>>s; int len=s.size(); int a[300] = {0}; for(int i=0;i<len;i++} { a[s[i]]++; } if(a['N']!=a['S']) puts("NO"); else if(a['S']!=a['E']) puts("NO"); else puts("YES"); return 0; }
a.cc: In function 'int main()': a.cc:9:22: error: expected ')' before '}' token 9 | for(int i=0;i<len;i++} | ~ ^ | ) a.cc:9:22: error: expected primary-expression before '}' token a.cc: At global scope: a.cc:10:1: error: expected unqualified-id before '{' token 10 | { | ^ a.cc:13:1: error: expected unqualified-id before 'if' 13 | if(a['N']!=a['S']) | ^~ a.cc:15:1: error: expected unqualified-id before 'else' 15 | else if(a['S']!=a['E']) | ^~~~ a.cc:17:1: error: expected unqualified-id before 'else' 17 | else | ^~~~ a.cc:19:1: error: expected unqualified-id before 'return' 19 | return 0; | ^~~~~~ a.cc:20:1: error: expected declaration before '}' token 20 | } | ^
s758246395
p04019
Java
import java.util.*; public class Main { public static void main(String[] args) { // TODO Auto-generated method stub Scanner sc = new Scanner(System.in); String str = sc.next(); if((str.contains("N") && !str.contains("S")) || (str.contains("S") && !str.contains("N"))){ System.out.println("NO"); return; } if((str.contains("E") && !str.contains("W")) || (str.contains("W") && !str.contains("E"))){ System.out.println("NO"); return; } System.out.println("YES"); }
Main.java:18: error: reached end of file while parsing } ^ 1 error
s456075225
p04019
C++
#include <iostream> #include <algorithm> #include <fstream> #include <vector> #include <deque> #include <assert.h> #include <queue> #include <stack> #include <set> #include <map> #include <stdio.h> #include <string.h> #include <utility> #include <math.h> #include <bitset> #include <iomanip> using namespace std; #define rep(i, n) for (int i = 0, _n = (int)(n); i < _n; ++i) const int N = (int) 1e5 + 5, mod = 0; int pr[N]; long long a[N]; vector<int> p; map<long long, int> mp; long long s[N], o[N]; int main() { ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); for (int i = 2; i < N; ++i) if (!pr[i]) { for (int j = i; j < N; j += i) pr[j] = 0; p.push_back(i); } int n; cin >> n; for (int i = 0; i < n; ++i) { cin >> a[i]; long long x = a[i], y = 1, self = 1; for (int j : p) { if (j * 1ll * j * j > x) { break; } int cnt = 0; while (x % j == 0) cnt++, cnt %= 3, x /= j; for (int q = 0; q < cnt; ++q) self *= j; for (int q = 0; q < (3 - cnt) % 3; ++q) y *= j; } self *= x; long long sq = sqrt(x); int flag = 0; for (long long q = sq - 1; q <= sq + 1; ++q) if (q * q == x) { flag = 1; sq = q; break; } if (!flag) y *= x * x; else y *= sq; s[i] = self; o[i] = y; mp[self]++; mp[y]--; } int res = 0; for (int i = 0; i < n; ++i) { if (mp[s[i]] >= 0) { res++; } } cout << res;
a.cc: In function 'int main()': a.cc:76:17: error: expected '}' at end of input 76 | cout << res; | ^ a.cc:29:12: note: to match this '{' 29 | int main() { | ^
s338445235
p04019
C++
import java.util.StringTokenizer; import java.io.BufferedReader; import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; import java.io.PrintWriter; import java.io.OutputStream; public class Main { public static void main(String args[]) { Sc sc = new Sc(System.in); String st = sc.n(); boolean n = false; boolean e = false; boolean s = false; boolean w = false; for(int i = 0; i<st.length(); i++) { if(st.charAt(i) == 'N') n = true; if(st.charAt(i) == 'W') w = true; if(st.charAt(i) == 'E') e = true; if(st.charAt(i) == 'S') s = true; } boolean ok = (s == n) && (w == e); if(ok) System.out.println("Yes"); else System.out.println("No"); } } class Sc { public Sc(InputStream i) { r = new BufferedReader(new InputStreamReader(i)); } public boolean hasM() { return peekToken() != null; } public int nI() { return Integer.parseInt(nextToken()); } public double nD() { return Double.parseDouble(nextToken()); } public long nL() { return Long.parseLong(nextToken()); } public String n() { return nextToken(); } private BufferedReader r; private String line; private StringTokenizer st; private String token; private String peekToken() { if (token == null) try { while (st == null || !st.hasMoreTokens()) { line = r.readLine(); if (line == null) return null; st = new StringTokenizer(line); } token = st.nextToken(); } catch (IOException e) { } return token; } private String nextToken() { String ans = peekToken(); token = null; return ans; } }
a.cc:1:1: error: 'import' does not name a type 1 | import java.util.StringTokenizer; | ^~~~~~ 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.io.BufferedReader; | ^~~~~~ a.cc:2:1: note: C++20 'import' only available with '-fmodules-ts' a.cc:3:1: error: 'import' does not name a type 3 | import java.io.IOException; | ^~~~~~ a.cc:3:1: note: C++20 'import' only available with '-fmodules-ts' a.cc:4:1: error: 'import' does not name a type 4 | import java.io.InputStream; | ^~~~~~ a.cc:4:1: note: C++20 'import' only available with '-fmodules-ts' a.cc:5:1: error: 'import' does not name a type 5 | import java.io.InputStreamReader; | ^~~~~~ a.cc:5:1: note: C++20 'import' only available with '-fmodules-ts' a.cc:6:1: error: 'import' does not name a type 6 | import java.io.PrintWriter; | ^~~~~~ a.cc:6:1: note: C++20 'import' only available with '-fmodules-ts' a.cc:7:1: error: 'import' does not name a type 7 | import java.io.OutputStream; | ^~~~~~ a.cc:7:1: note: C++20 'import' only available with '-fmodules-ts' a.cc:8:1: error: expected unqualified-id before 'public' 8 | public class Main { | ^~~~~~ a.cc:28:11: error: expected ':' before 'Sc' 28 | public Sc(InputStream i) { | ^~~ | : a.cc:28:26: error: expected ')' before 'i' 28 | public Sc(InputStream i) { | ~ ^~ | ) a.cc:32:11: error: expected ':' before 'boolean' 32 | public boolean hasM() { | ^~~~~~~~ | : a.cc:32:12: error: 'boolean' does not name a type; did you mean 'bool'? 32 | public boolean hasM() { | ^~~~~~~ | bool a.cc:36:11: error: expected ':' before 'int' 36 | public int nI() { | ^~~~ | : a.cc:40:11: error: expected ':' before 'double' 40 | public double nD() { | ^~~~~~~ | : a.cc:44:11: error: expected ':' before 'long' 44 | public long nL() { | ^~~~~ | : a.cc:48:11: error: expected ':' before 'String' 48 | public String n() { | ^~~~~~~ | : a.cc:48:12: error: 'String' does not name a type 48 | public String n() { | ^~~~~~ a.cc:52:12: error: expected ':' before 'BufferedReader' 52 | private BufferedReader r; | ^~~~~~~~~~~~~~~ | : a.cc:52:13: error: 'BufferedReader' does not name a type 52 | private BufferedReader r; | ^~~~~~~~~~~~~~ a.cc:53:12: error: expected ':' before 'String' 53 | private String line; | ^~~~~~~ | : a.cc:53:13: error: 'String' does not name a type 53 | private String line; | ^~~~~~ a.cc:54:12: error: expected ':' before 'StringTokenizer' 54 | private StringTokenizer st; | ^~~~~~~~~~~~~~~~ | : a.cc:54:13: error: 'StringTokenizer' does not name a type 54 | private StringTokenizer st; | ^~~~~~~~~~~~~~~ a.cc:55:12: error: expected ':' before 'String' 55 | private String token; | ^~~~~~~ | : a.cc:55:13: error: 'String' does not name a type 55 | private String token; | ^~~~~~ a.cc:57:12: error: expected ':' before 'String' 57 | private String peekToken() { | ^~~~~~~ | : a.cc:57:13: error: 'String' does not name a type 57 | private String peekToken() { | ^~~~~~ a.cc:70:12: error: expected ':' before 'String' 70 | private String nextToken() { | ^~~~~~~ | : a.cc:70:13: error: 'String' does not name a type 70 | private String nextToken() { | ^~~~~~ a.cc:75:2: error: expected ';' after class definition 75 | } | ^ | ; a.cc: In member function 'int Sc::nI()': a.cc:37:16: error: 'Integer' was not declared in this scope 37 | return Integer.parseInt(nextToken()); | ^~~~~~~ a.cc:37:33: error: 'nextToken' was not declared in this scope 37 | return Integer.parseInt(nextToken()); | ^~~~~~~~~ a.cc: In member function 'double Sc::nD()': a.cc:41:16: error: 'Double' was not declared in this scope; did you mean 'double'? 41 | return Double.parseDouble(nextToken()); | ^~~~~~ | double a.cc:41:35: error: 'nextToken' was not declared in this scope 41 | return Double.parseDouble(nextToken()); | ^~~~~~~~~ a.cc: In member function 'long int Sc::nL()': a.cc:45:16: error: 'Long' was not declared in this scope; did you mean 'long'? 45 | return Long.parseLong(nextToken()); | ^~~~ | long a.cc:45:31: error: 'nextToken' was not declared in this scope 45 | return Long.parseLong(nextToken()); | ^~~~~~~~~
s034508801
p04019
C++
#include <iostream > #include <string> using namespace std; int main(){ string s; cin>>s; bool n,s,e,w; for(int i=0;i<s.length();i++){ if(s[i]=='W') w=true; if(s[i]=='E') e=true; if(s[i]=='S') s=true; if(s[i]=='N') n=true; } if(w^e) cout<<"No\n"; else if(n^s) cout<<"No\n"; else cout<<"Yes\n"; return 0; }
a.cc:1:10: fatal error: iostream : No such file or directory 1 | #include <iostream > | ^~~~~~~~~~~ compilation terminated.
s561832618
p04019
C
#include <iostream> #include <string> using namespace std; int main() { bool flg[4]={false,false,false,false}; string S; cin >> S; for(int i=0;i<S.size();++i){ if(S[i]=='E') flg[0]=true; else if(S[i]=='W') flg[1]=true; else if(S[i]=='S') flg[2]=true; else if(S[i]=='N') flg[3]=true; } if(flg[0] == flg[1] && flg[2]==flg[3]) cout << "Yes" << endl; else cout << "No" << endl; return 0; }
main.c:1:10: fatal error: iostream: No such file or directory 1 | #include <iostream> | ^~~~~~~~~~ compilation terminated.
s417951062
p04019
C++
#include <algorithm> #include <bitset> #include <cassert> #include <cctype> #include <cmath> #include <cstdio> #include <cstdlib> #include <cstring> #include <ctime> #include <deque> #include <functional> #include <iomanip> #include <iostream> #include <list> #include <map> #include <numeric> #include <queue> #include <set> #include <sstream> #include <stack> #include <string> #include <utility> #include <vector> #define REP(i,s,n) for(int i=(int)(s);i<(int)(n);i++) using namespace std; typedef long long int ll; typedef vector<int> VI; typedef vector<ll> VL; typedef pair<int, int> PI; const ll mod = 1e9 + 7; int main(void){ string s; cin>>s; int n,w,e,s; n=w=e=s=0; REP(i,0,s.length()){ switch(s[i]){ case 'N': n++;break; case 'S': s++;break; case 'E': e++;break; case 'W': w++;break; }} n=n?1:0; w=w?1:0; s=s?1:0; e=e?1:0; cout << ((n ^ s) || (e ^ w) ? "No" : "Yes") << endl; }
a.cc: In function 'int main()': a.cc:39:11: error: conflicting declaration 'int s' 39 | int n,w,e,s; | ^ a.cc:37:10: note: previous declaration as 'std::string s' 37 | string s; | ^ a.cc:40:9: error: ambiguous overload for 'operator=' (operand types are 'std::string' {aka 'std::__cxx11::basic_string<char>'} and 'int') 40 | n=w=e=s=0; | ^ In file included from /usr/include/c++/14/string:54, from /usr/include/c++/14/bitset:52, from a.cc:2: /usr/include/c++/14/bits/basic_string.h:817:7: note: candidate: 'std::__cxx11::basic_string<_CharT, _Traits, _Alloc>& std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::operator=(const std::__cxx11::basic_string<_CharT, _Traits, _Alloc>&) [with _CharT = char; _Traits = std::char_traits<char>; _Alloc = std::allocator<char>]' 817 | operator=(const basic_string& __str) | ^~~~~~~~ /usr/include/c++/14/bits/basic_string.h:828:7: note: candidate: 'std::__cxx11::basic_string<_CharT, _Traits, _Alloc>& std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::operator=(const _CharT*) [with _CharT = char; _Traits = std::char_traits<char>; _Alloc = std::allocator<char>]' 828 | operator=(const _CharT* __s) | ^~~~~~~~ /usr/include/c++/14/bits/basic_string.h:840:7: note: candidate: 'std::__cxx11::basic_string<_CharT, _Traits, _Alloc>& std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::operator=(_CharT) [with _CharT = char; _Traits = std::char_traits<char>; _Alloc = std::allocator<char>]' 840 | operator=(_CharT __c) | ^~~~~~~~ /usr/include/c++/14/bits/basic_string.h:858:7: note: candidate: 'std::__cxx11::basic_string<_CharT, _Traits, _Alloc>& std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::operator=(std::__cxx11::basic_string<_CharT, _Traits, _Alloc>&&) [with _CharT = char; _Traits = std::char_traits<char>; _Alloc = std::allocator<char>]' 858 | operator=(basic_string&& __str) | ^~~~~~~~ a.cc:44:12: error: no 'operator++(int)' declared for postfix '++' [-fpermissive] 44 | case 'S': s++;break; | ~^~ a.cc:50:3: error: could not convert 's' from 'std::string' {aka 'std::__cxx11::basic_string<char>'} to 'bool' 50 | s=s?1:0; | ^ | | | std::string {aka std::__cxx11::basic_string<char>} a.cc:52:13: error: no match for 'operator^' (operand types are 'int' and 'std::string' {aka 'std::__cxx11::basic_string<char>'}) 52 | cout << ((n ^ s) || (e ^ w) ? "No" : "Yes") << endl; | ~ ^ ~ | | | | int std::string {aka std::__cxx11::basic_string<char>} In file included from /usr/include/c++/14/iomanip:42, from a.cc:12: /usr/include/c++/14/bits/ios_base.h:94:3: note: candidate: 'constexpr std::_Ios_Fmtflags std::operator^(_Ios_Fmtflags, _Ios_Fmtflags)' 94 | operator^(_Ios_Fmtflags __a, _Ios_Fmtflags __b) _GLIBCXX_NOTHROW | ^~~~~~~~ /usr/include/c++/14/bits/ios_base.h:94:46: note: no known conversion for argument 2 from 'std::string' {aka 'std::__cxx11::basic_string<char>'} to 'std::_Ios_Fmtflags' 94 | operator^(_Ios_Fmtflags __a, _Ios_Fmtflags __b) _GLIBCXX_NOTHROW | ~~~~~~~~~~~~~~^~~ /usr/include/c++/14/bits/ios_base.h:144:3: note: candidate: 'constexpr std::_Ios_Openmode std::operator^(_Ios_Openmode, _Ios_Openmode)' 144 | operator^(_Ios_Openmode __a, _Ios_Openmode __b) _GLIBCXX_NOTHROW | ^~~~~~~~ /usr/include/c++/14/bits/ios_base.h:144:46: note: no known conversion for argument 2 from 'std::string' {aka 'std::__cxx11::basic_string<char>'} to 'std::_Ios_Openmode' 144 | operator^(_Ios_Openmode __a, _Ios_Openmode __b) _GLIBCXX_NOTHROW | ~~~~~~~~~~~~~~^~~ /usr/include/c++/14/bits/ios_base.h:191:3: note: candidate: 'constexpr std::_Ios_Iostate std::operator^(_Ios_Iostate, _Ios_Iostate)' 191 | operator^(_Ios_Iostate __a, _Ios_Iostate __b) _GLIBCXX_NOTHROW | ^~~~~~~~ /usr/include/c++/14/bits/ios_base.h:191:44: note: no known conversion for argument 2 from 'std::string' {aka 'std::__cxx11::basic_string<char>'} to 'std::_Ios_Iostate' 191 | operator^(_Ios_Iostate __a, _Ios_Iostate __b) _GLIBCXX_NOTHROW | ~~~~~~~~~~~~~^~~ /usr/include/c++/14/bitset:1577:5: note: candidate: 'template<long unsigned int _Nb> std::bitset<_Nb> std::operator^(const bitset<_Nb>&, const bitset<_Nb>&)' 1577 | operator^(const bitset<_Nb>& __x, const bitset<_Nb>& __y) _GLIBCXX_NOEXCEPT | ^~~~~~~~ /usr/include/c++/14/bitset:1577:5: note: template argument deduction/substitution failed: a.cc:52:15: note: mismatched types 'const std::bitset<_Nb>' and 'int' 52 | cout << ((n ^ s) || (e ^ w) ? "No" : "Yes") << endl; | ^ In file included from /usr/include/c++/14/bits/memory_resource.h:38, from /usr/include/c++/14/string:68: /usr/include/c++/14/cstddef:146:3: note: candidate: 'constexpr std::byte std::operator^(byte, byte)' 146 | operator^(byte __l, byte __r) noexcept | ^~~~~~~~ /usr/include/c++/14/cstddef:146:18: note: no known conversion for argument 1 from 'int' to 'std::byte' 146 | operator^(byte __l, byte __r) noexcept | ~~~~~^~~
s799840063
p04019
Java
//package codechef; import java.io.*; import java.math.*; import java.util.*; /** * * @author Pradyumn Agrawal coderbond007 */ public class Codechef{ public static InputStream inputStream = System.in; public static OutputStream outputStream = System.out; public static FastReader in = new FastReader(inputStream); public static PrintWriter out = new PrintWriter(outputStream); public static void main(String[] args)throws java.lang.Exception { new Codechef().run(); out.close(); } void run() throws java.lang.Exception { char[] s = ns().toCharArray(); int c1=0,c2=0; for(int i=0;i<s.length;i++){ if(s[i] == 'N') c1++; else if(s[i] == 'S') c1--; else if(s[i] =='E') c2++; else c2--; } if(c1==0 && c2==0) out.println("Yes"); else out.println("No"); } private static int ni(){ return in.nextInt(); } private static long nl(){ return in.nextLong(); } private static String ns(){ return in.nextString(); } private static char nc(){ return in.nextCharacter(); } private static double nd(){ return in.nextDouble(); } private static char[] ns(int n) { char[] a = new char[n]; for(int i=0;i<n;i++) a[i] = nc(); return a; } private static char[][] nm(int n, int m) { char[][] map = new char[n][]; for(int i=0;i<n;i++) map[i] = ns(m); return map; } private static int[] na(int n) { int[] a = new int[n]; for(int i=0;i<n;i++) a[i] = ni(); return a; } private static long[] nal(int n) { long[] a = new long[n]; for(int i=0;i<n;i++) a[i] = nl(); return a; } } class FastReader{ private boolean finished = false; private InputStream stream; private byte[] buf = new byte[1024]; private int curChar; private int numChars; private SpaceCharFilter filter; public FastReader(InputStream stream){ this.stream = stream; } public int read(){ if (numChars == -1){ throw new InputMismatchException (); } if (curChar >= numChars){ curChar = 0; try{ numChars = stream.read (buf); } catch (IOException e){ throw new InputMismatchException (); } if (numChars <= 0){ return -1; } } return buf[curChar++]; } public int peek(){ if (numChars == -1){ return -1; } if (curChar >= numChars){ curChar = 0; try{ numChars = stream.read (buf); } catch (IOException e){ return -1; } if (numChars <= 0){ return -1; } } return buf[curChar]; } public int nextInt(){ int c = read (); while (isSpaceChar (c)) c = read (); int sgn = 1; if (c == '-'){ sgn = -1; c = read (); } int res = 0; do{ if(c==','){ c = read(); } if (c < '0' || c > '9'){ throw new InputMismatchException (); } res *= 10; res += c - '0'; c = read (); } while (!isSpaceChar (c)); return res * sgn; } public long nextLong(){ int c = read (); while (isSpaceChar (c)) c = read (); int sgn = 1; if (c == '-'){ sgn = -1; c = read (); } long res = 0; do{ if (c < '0' || c > '9'){ throw new InputMismatchException (); } res *= 10; res += c - '0'; c = read (); } while (!isSpaceChar (c)); return res * sgn; } public String nextString(){ int c = read (); while (isSpaceChar (c)) c = read (); StringBuilder res = new StringBuilder (); do{ res.appendCodePoint (c); c = read (); } while (!isSpaceChar (c)); return res.toString (); } public boolean isSpaceChar(int c){ if (filter != null){ return filter.isSpaceChar (c); } return isWhitespace (c); } public static boolean isWhitespace(int c){ return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1; } private String readLine0(){ StringBuilder buf = new StringBuilder (); int c = read (); while (c != '\n' && c != -1){ if (c != '\r'){ buf.appendCodePoint (c); } c = read (); } return buf.toString (); } public String nextLine(){ String s = readLine0 (); while (s.trim ().length () == 0) s = readLine0 (); return s; } public String nextLine(boolean ignoreEmptyLines){ if (ignoreEmptyLines){ return nextLine (); }else{ return readLine0 (); } } public BigInteger nextBigInteger(){ try{ return new BigInteger (nextString()); } catch (NumberFormatException e){ throw new InputMismatchException (); } } public char nextCharacter(){ int c = read (); while (isSpaceChar (c)) c = read (); return (char) c; } public double nextDouble(){ int c = read (); while (isSpaceChar (c)) c = read (); int sgn = 1; if (c == '-'){ sgn = -1; c = read (); } double res = 0; while (!isSpaceChar (c) && c != '.'){ if (c == 'e' || c == 'E'){ return res * Math.pow (10, nextInt ()); } if (c < '0' || c > '9'){ throw new InputMismatchException (); } res *= 10; res += c - '0'; c = read (); } if (c == '.'){ c = read (); double m = 1; while (!isSpaceChar (c)){ if (c == 'e' || c == 'E'){ return res * Math.pow (10, nextInt ()); } if (c < '0' || c > '9'){ throw new InputMismatchException (); } m /= 10; res += (c - '0') * m; c = read (); } } return res * sgn; } public boolean isExhausted(){ int value; while (isSpaceChar (value = peek ()) && value != -1) read (); return value == -1; } public String next(){ return nextString(); } public SpaceCharFilter getFilter(){ return filter; } public void setFilter(SpaceCharFilter filter){ this.filter = filter; } public interface SpaceCharFilter{ public boolean isSpaceChar(int ch); } }
Main.java:9: error: class Codechef is public, should be declared in a file named Codechef.java public class Codechef{ ^ 1 error
s402737769
p04019
C++
#include <bits/stdc++.h> using namespace std; /* JSR Mistakes - 0) Dont rush to conclusion on seeing a question , keep yourself relaxed and go easy on ques . 1) To see at each step if integer is not causing an error , best way is to use long long always. 2) To see if my solution can be verified , if yes then do that . 3) To see if my code can be simplified , if yes make it simple. 4) If my code is wrong , dont be in a hurry to change to the code, first think for 2 min if any modification can be done to make it right. 5) always typecast (int) arr.size() because size_t does not support subtraction. 6) Never use such expression Int ct = max( ct ,left) ; (declartion should be done before assignment , absurd behaviour) 7) Using long long for everything may cause Time Limit Exceeded some times , so better be sure 8) appending at the end of the string takes too much time 339 Div2 - B 9) n*n*log(n) doesnt wrk for n >1000 on codeforces 10) read the question carefully and before submitting soln read ques , it will hardly take 1min and save u time cost of 15-30 min 11) Keep calm and Code. */ #define REP(i, a, b) for (int i = a; i <= b; i++) #define FOR(i, n) for (int i = 0; i < n; i++) #define foreach(it, ar) for ( typeof(ar.begin()) it = ar.begin(); it != ar.end(); it++ ) #define fill(ar, val) memset(ar, val, sizeof(ar)) #define PI 3.1415926535897932385 #define uint64 unsigned long long #define Int long long #define int64 long long #define all(ar) ar.begin(), ar.end() #define pb push_back #define ff first #define ss second #define bit(n) (1<<(n)) #define Last(i) ( (i) & (-i) ) #define sq(x) ((x) * (x)) #define INF INT_MAX #define mp make_pair int main ( ) { string s ; cin >> s ; bool n = false ; bool s = false ; bool e = false ; bool f = false ; for( int i =0 ; i < s.length() ; i ++ ) { if( s[i] == 'N') n = true ; if( s[i] == 'S') s = true ; if( s[i] == 'E') e = true ; if( s[i] == 'W') w = true ; } if( n || s && !(n&&s) ) { cout<< " No "<<endl ; return 0 ; } if( w || e && !(w&&e) ) { cout<< " No "<<endl ; return 0 ; } cout<<"Yes"<<endl; }
a.cc: In function 'int main()': a.cc:46:7: error: conflicting declaration 'bool s' 46 | bool s = false ; | ^ a.cc:43:9: note: previous declaration as 'std::string s' 43 | string s ; | ^ a.cc:56:26: error: 'w' was not declared in this scope 56 | if( s[i] == 'W') w = true ; | ^ a.cc:60:21: error: no match for 'operator&&' (operand types are 'bool' and 'std::string' {aka 'std::__cxx11::basic_string<char>'}) 60 | if( n || s && !(n&&s) ) { cout<< " No "<<endl ; return 0 ; } | ~^~~ | | | | | std::string {aka std::__cxx11::basic_string<char>} | bool a.cc:60:21: note: candidate: 'operator&&(bool, bool)' (built-in) 60 | if( n || s && !(n&&s) ) { cout<< " No "<<endl ; return 0 ; } | ~^~~ a.cc:60:21: note: no known conversion for argument 2 from 'std::string' {aka 'std::__cxx11::basic_string<char>'} to 'bool' In file included from /usr/include/c++/14/valarray:605, from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:166, from a.cc:1: /usr/include/c++/14/bits/valarray_after.h:415:5: note: candidate: 'template<class _Dom1, class _Dom2> std::_Expr<std::__detail::_BinClos<std::__logical_and, std::_Expr, std::_Expr, _Dom1, _Dom2>, typename std::__fun<std::__logical_and, typename _Dom1::value_type>::result_type> std::operator&&(const _Expr<_Dom1, typename _Dom1::value_type>&, const _Expr<_Dom2, typename _Dom2::value_type>&)' 415 | _DEFINE_EXPR_BINARY_OPERATOR(&&, struct std::__logical_and) | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~ /usr/include/c++/14/bits/valarray_after.h:415:5: note: template argument deduction/substitution failed: a.cc:60:23: note: mismatched types 'const std::_Expr<_Dom1, typename _Dom1::value_type>' and 'bool' 60 | if( n || s && !(n&&s) ) { cout<< " No "<<endl ; return 0 ; } | ^ /usr/include/c++/14/bits/valarray_after.h:415:5: note: candidate: 'template<class _Dom> std::_Expr<std::__detail::_BinClos<std::__logical_and, std::_Expr, std::_Constant, _Dom, typename _Dom::value_type>, typename std::__fun<std::__logical_and, typename _Dom1::value_type>::result_type> std::operator&&(const _Expr<_Dom1, typename _Dom1::value_type>&, const typename _Dom::value_type&)' 415 | _DEFINE_EXPR_BINARY_OPERATOR(&&, struct std::__logical_and) | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~ /usr/include/c++/14/bits/valarray_after.h:415:5: note: template argument deduction/substitution failed: a.cc:60:23: note: mismatched types 'const std::_Expr<_Dom1, typename _Dom1::value_type>' and 'bool' 60 | if( n || s && !(n&&s) ) { cout<< " No "<<endl ; return 0 ; } | ^ /usr/include/c++/14/bits/valarray_after.h:415:5: note: candidate: 'template<class _Dom> std::_Expr<std::__detail::_BinClos<std::__logical_and, std::_Constant, std::_Expr, typename _Dom::value_type, _Dom>, typename std::__fun<std::__logical_and, typename _Dom1::value_type>::result_type> std::operator&&(const typename _Dom::value_type&, const _Expr<_Dom1, typename _Dom1::value_type>&)' 415 | _DEFINE_EXPR_BINARY_OPERATOR(&&, struct std::__logical_and) | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~ /usr/include/c++/14/bits/valarray_after.h:415:5: note: template argument deduction/substitution failed: a.cc:60:23: note: 'std::string' {aka 'std::__cxx11::basic_string<char>'} is not derived from 'const std::_Expr<_Dom1, typename _Dom1::value_type>' 60 | if( n || s && !(n&&s) ) { cout<< " No "<<endl ; return 0 ; } | ^ /usr/include/c++/14/bits/valarray_after.h:415:5: note: candidate: 'template<class _Dom> std::_Expr<std::__detail::_BinClos<std::__logical_and, std::_Expr, std::_ValArray, _Dom, typename _Dom::value_type>, typename std::__fun<std::__logical_and, typename _Dom1::value_type>::result_type> std::operator&&(const _Expr<_Dom1, typename _Dom1::value_type>&, const valarray<typename _Dom::value_type>&)' 415 | _DEFINE_EXPR_BINARY_OPERATOR(&&, struct std::__logical_and) | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~ /usr/include/c++/14/bits/valarray_after.h:415:5: note: template argument deduction/substitution failed: a.cc:60:23: note: mismatched types 'const std::_Expr<_Dom1, typename _Dom1::value_type>' and 'bool' 60 | if( n || s && !(n&&s) ) { cout<< " No "<<endl ; return 0 ; } | ^ /usr/include/c++/14/bits/valarray_after.h:415:5: note: candidate: 'template<class _Dom> std::_Expr<std::__detail::_BinClos<std::__logical_and, std::_ValArray, std::_Expr, typename _Dom::value_type, _Dom>, typename std::__fun<std::__logical_and, typename _Dom1::value_type>::result_type> std::operator&&(const valarray<typename _Dom::value_type>&, const _Expr<_Dom1, typename _Dom1::value_type>&)' 415 | _DEFINE_EXPR_BINARY_OPERATOR(&&, struct std::__logical_and) | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~ /usr/include/c++/14/bits/valarray_after.h:415:5: note: template argument deduction/substitution failed: a.cc:60:23: note: 'std::string' {aka 'std::__cxx11::basic_string<char>'} is not derived from 'const std::_Expr<_Dom1, typename _Dom1::value_type>' 60 | if( n || s && !(n&&s) ) { cout<< " No "<<endl ; return 0 ; } | ^ /usr/include/c++/14/valarray:1206:1: note: candidate: 'template<class _Tp> std::_Expr<std::__detail::_BinClos<std::__logical_and, std::_ValArray, std::_ValArray, _Tp, _Tp>, typename std::__fun<std::__logical_and, _Tp>::result_type> std::operator&&(const valarray<_Tp>&, const valarray<_Tp>&)' 1206 | _DEFINE_BINARY_OPERATOR(&&, __logical_and) | ^~~~~~~~~~~~~~~~~~~~~~~ /usr/include/c++/14/valarray:1206:1: note: template argument deduction/substitution failed: a.cc:60:23: note: mismatched types 'const std::valarray<_Tp>' and 'bool' 60 | if( n || s && !(n&&s) ) { cout<< " No "<<endl ; return 0 ; } | ^ /usr/include/c++/14/valarray:1206:1: note: candidate: 'template<class _Tp> std::_Expr<std::__detail::_BinClos<std::__logical_and, std::_ValArray, std::_Constant, _Tp, _Tp>, typename std::__fun<std::__logical_and, _Tp>::result_type> std::operator&&(const valarray<_Tp>&, const typename valarray<_Tp>::value_type&)' 1206 | _DEFINE_BINARY_OPERATOR(&&, __logical_and) | ^~~~~~~~~~~~~~~~~~~~~~~ /usr/include/c++/14/valarray:1206:1: note: template argument deduction/substitution failed: a.cc:60:23: note: mismatched types 'const std::valarray<_Tp>' and 'bool' 60 | if( n || s && !(n&&s) ) { cout<< " No "<<endl ; return 0 ; } | ^ /usr/include/c++/14/valarray:1206:1: note: candidate: 'template<class _Tp> std::_Expr<std::__detail::_BinClos<std::__logical_and, std::_Constant, std::_ValArray, _Tp, _Tp>, typename std::__fun<std::__logical_and, _Tp>::result_type> std::operator&&(const typename valarray<_Tp>::value_type&, const valarray<_Tp>&)' 1206 | _DEFINE_BINARY_OPERATOR(&&, __logical_and) | ^~~~~~~~~~~~~~~~~~~~~~~ /usr/include/c++/14/valarray:1206:1: note: template argument deduction/substitution failed: a.cc:60:23: note: 'std::string' {aka 'std::__cxx11::basic_string<char>'} is not derived from 'const std::valarray<_Tp>' 60 | if( n || s && !(n&&s) ) { cout<< " No "<<endl ; return 0 ; } | ^ a.cc:61:7: error: 'w' was not declared in this scope 61 | if( w || e && !(w&&e) ) { cout<< " No "<<endl ; return 0 ; } | ^
s913375626
p04019
C
#include<stdio.h> #include<stdlib.h> int main(void) { int i,n,e; char S[]; scanf("%s\n",S); int N = sizeof(S); if(1 <= N && N <= 1000) { for (i = 1; i <= N; i++) { if (S[i] == "N") n = n + 1; if (S[i] == "S") n = n - 1; if (S[i] == "E") e = e + 1; if (S[i] == "W") e = e - 1; } if (n == 0 && e == 0) { printf("yes\n"); } else { printf("no\n"); } } return 0; }
main.c: In function 'main': main.c:7:8: error: array size missing in 'S' 7 | char S[]; | ^ main.c:12:16: warning: comparison between pointer and integer 12 | if (S[i] == "N") n = n + 1; | ^~ main.c:13:16: warning: comparison between pointer and integer 13 | if (S[i] == "S") n = n - 1; | ^~ main.c:14:16: warning: comparison between pointer and integer 14 | if (S[i] == "E") e = e + 1; | ^~ main.c:15:16: warning: comparison between pointer and integer 15 | if (S[i] == "W") e = e - 1; | ^~
s443387051
p04019
C++
#include <bits/stdc++.h> #define MOD 1000000007 using namespace std; typedef long long LL; LL a[110000]; vector<LL> p1, p2; map<LL,int> r; void gen(LL k){ if(r.find(k) == r.end()){ r[k] = rand() << 12 + rand(); } } int main(){ srand(150); int n; cin >> n; for(int i = 0; i < n; i++) cin >> a[i]; map<LL,int> d; int n1 = 0; vector<int> q; for(int j = 2; j < 2200; j++){ int ok = 1; for(int z = 2; z*z <= j; z++){ if(j % z == 0){ ok = 0; break; } } if(ok) q.push_back(j); } for(int z = 0; z < n; z++){ p1.clear(); p2.clear(); for(int i = 0; i < q.size(); i++){ LL j = q[i]; LL p = j*j*j; while(a[z] % p == 0){ a[z] /= p; } p = j; if(a[z] % (p*p) == 0){ p2.push_back(p); a[z] /= (p*p); } if(a[z] % (p) == 0){ p1.push_back(p); a[z] /= (p); } } if(a[z] > 1){ LL c = sqrt(a[z]); if(c*c == a[z]){ p2.push_back(c); } else { p1.push_back(a[z]); } } if(p1.empty() && p2.empty()){ n1 = 1; continue; } for(int i = 0; i < p1.size(); i++){ a *= p1[i]; } for(int i = 0; i < p2.size(); i++){ b *= p2[i]; } gen(a); gen(b); h1 = r[a]; h2 = r[b]; //cout << h1-h2 << endl; d[h1-h2]++; d[h2-h1]++; d[h2-h1]--; } LL ans = 0; for(map<LL,int>::iterator it = d.begin(); it != d.end(); it++){ ans += max(d[it->first],d[-it->first]); } ans /= 2; ans += n1; cout << ans << endl; }
a.cc: In function 'int main()': a.cc:64:27: error: invalid operands of types 'LL [110000]' {aka 'long long int [110000]'} and '__gnu_cxx::__alloc_traits<std::allocator<long long int>, long long int>::value_type' {aka 'long long int'} to binary 'operator*' 64 | a *= p1[i]; a.cc:64:27: note: in evaluation of 'operator*=(LL [110000] {aka long long int [110000]}, __gnu_cxx::__alloc_traits<std::allocator<long long int>, long long int>::value_type {aka long long int})' a.cc:67:25: error: 'b' was not declared in this scope 67 | b *= p2[i]; | ^ a.cc:69:21: error: invalid conversion from 'LL*' {aka 'long long int*'} to 'LL' {aka 'long long int'} [-fpermissive] 69 | gen(a); | ^ | | | LL* {aka long long int*} a.cc:9:13: note: initializing argument 1 of 'void gen(LL)' 9 | void gen(LL k){ | ~~~^ a.cc:70:21: error: 'b' was not declared in this scope 70 | gen(b); | ^ a.cc:71:17: error: 'h1' was not declared in this scope; did you mean 'n1'? 71 | h1 = r[a]; | ^~ | n1 a.cc:71:23: error: ambiguous overload for 'operator[]' (operand types are 'std::map<long long int, int>' and 'LL [110000]' {aka 'long long int [110000]'}) 71 | h1 = r[a]; | ^ In file included from /usr/include/c++/14/map:63, from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:152, from a.cc:1: /usr/include/c++/14/bits/stl_map.h:504:7: note: candidate: 'std::map<_Key, _Tp, _Compare, _Alloc>::mapped_type& std::map<_Key, _Tp, _Compare, _Alloc>::operator[](const key_type&) [with _Key = long long int; _Tp = int; _Compare = std::less<long long int>; _Alloc = std::allocator<std::pair<const long long int, int> >; mapped_type = int; key_type = long long int]' (near match) 504 | operator[](const key_type& __k) | ^~~~~~~~ /usr/include/c++/14/bits/stl_map.h:504:7: note: conversion of argument 1 would be ill-formed: a.cc:71:24: error: invalid conversion from 'LL*' {aka 'long long int*'} to 'std::map<long long int, int>::key_type' {aka 'long long int'} [-fpermissive] 71 | h1 = r[a]; | ^ | | | LL* {aka long long int*} /usr/include/c++/14/bits/stl_map.h:524:7: note: candidate: 'std::map<_Key, _Tp, _Compare, _Alloc>::mapped_type& std::map<_Key, _Tp, _Compare, _Alloc>::operator[](key_type&&) [with _Key = long long int; _Tp = int; _Compare = std::less<long long int>; _Alloc = std::allocator<std::pair<const long long int, int> >; mapped_type = int; key_type = long long int]' (near match) 524 | operator[](key_type&& __k) | ^~~~~~~~ /usr/include/c++/14/bits/stl_map.h:524:7: note: conversion of argument 1 would be ill-formed: a.cc:71:24: error: invalid conversion from 'LL*' {aka 'long long int*'} to 'std::map<long long int, int>::key_type' {aka 'long long int'} [-fpermissive] 71 | h1 = r[a]; | ^ | | | LL* {aka long long int*} a.cc:72:17: error: 'h2' was not declared in this scope; did you mean 'p2'? 72 | h2 = r[b]; | ^~ | p2
s693560070
p04019
C++
#include <bits/stdc++.h> using namespace std; const int N = 100005; int n; vector<int> primes; map<vector<pair<int,int>>,int> mp; bool isPrime(int n) { for (int i = 2; i * i <= n; ++i) if (n % i == 0) return false; return true; } int main() { ios::sync_with_stdio(false); cin.tie(0); for (int i = 2; i < 100000; ++i) { if (isPrime(i)) primes.push_back(i); } cin >> n; vector<pair<int,int>> cur; int add = 0; int result = 0; for (int i = 0; i < n; ++i) { long long x; cin >> x; cur.clear(); for (auto& y : primes) { if (y > 5000) break; int cnt = 0; while (x % y == 0) { x /= y; ++cnt; } cnt %= 3; if (cnt > 0) { cur.emplace_back(y, cnt); } } if (x > 1) { if (x > 100000) { ++result; continue; } if (binary_search(primes.begin(), primes.end(), x)) { cur.emplace_back((int)x, 1); ++mp[cur]; continue; } int y = sqrt(x + 0.5) + 0.5 if (1LL * y * y != x) { ++result; } else { cur.emplace_back(y, 2); ++mp[cur]; } } else { if (cur.empty()) { add = 1; continue; } ++mp[cur]; } } result += add; result *= 2; for (auto& x : mp) { cur.clear(); vector<pair<int,int>> now = x.first; for (auto& y : now) cur.emplace_back(y.first, 3 - y.second); if (mp.count(cur)e result += max(mp[now], mp[cur]); else result += 2 * x.second; } result /= 2; cout << result << endl; return 0; }
a.cc: In function 'int main()': a.cc:54:13: error: expected ',' or ';' before 'if' 54 | if (1LL * y * y != x) { | ^~ a.cc:56:15: error: expected '}' before 'else' 56 | } else { | ^~~~ a.cc:43:20: note: to match this '{' 43 | if (x > 1) { | ^ a.cc:57:34: error: 'y' was not declared in this scope 57 | cur.emplace_back(y, 2); | ^ a.cc:60:11: error: 'else' without a previous 'if' 60 | } else { | ^~~~ a.cc:63:17: error: continue statement not within a loop 63 | continue; | ^~~~~~~~ a.cc: At global scope: a.cc:68:5: error: 'result' does not name a type 68 | result += add; | ^~~~~~ a.cc:69:9: error: 'result' does not name a type 69 | result *= 2; | ^~~~~~ a.cc:70:5: error: expected unqualified-id before 'for' 70 | for (auto& x : mp) { | ^~~ a.cc:80:5: error: 'result' does not name a type 80 | result /= 2; | ^~~~~~ a.cc:81:5: error: 'cout' does not name a type 81 | cout << result << endl; | ^~~~ a.cc:82:5: error: expected unqualified-id before 'return' 82 | return 0; | ^~~~~~ a.cc:83:1: error: expected declaration before '}' token 83 | } | ^
s352979219
p04019
Java
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.util.*; import java.math.*; public class Main { public static void main(String[] args)throws IOException{ BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); StringBuilder sb = new StringBuilder(); int n = Integer.parseInt(br.readLine()); long cnt = 0; int[] a = new int[n]; for(int i = 0; i < n; i++){ long v = Long.parseLong(br.readLine()); if(v==0){ a[i] = 0; continue; } long e = v%2==0 ? v/2 -1 : v/2; cnt += e; a[i] = v-e*2; } for(int i = 1; i < n-1; i++){ int v1 = a[i-1]; int v2 = a[i]; int v3 = a[i+1]; if(v1==1 && v2==1){ a[i-1]--; a[i]--; cnt++; }else if(v2==1 && v3==1){ a[i]--; a[i+1]--; cnt++; }else if(v1==1 && v2==2 && v3==1){ a[i-1]--; a[i]-=2; a[i+1]--; cnt+=2; } } for(int i = 0; i < n; i++){ if(a[i]==2) cnt++; } sb.append(cnt); System.out.println(sb); } }
Main.java:22: error: incompatible types: possible lossy conversion from long to int a[i] = v-e*2; ^ 1 error
s945863482
p04019
C++
#include<iostream> #include<string> using namespace std; int main(){ string S; int n=0,s=0,w=0,e=0,yn=0; cin>>S; for(int i=0;i<S.size();i++){ if(S[i]=="N"&&n=0){n=1;} else if(S[i]=="S"&&s=0){s=1;} else if(S[i]=="W"&&w=0){w=1;} else if(S[i]=="E"&&e=0){e=1;} } if(n == s&&w == e){cout<<"Yes"<<endl;} else{cout<<"No"<<endl;} }
a.cc: In function 'int main()': a.cc:10:10: error: ISO C++ forbids comparison between pointer and integer [-fpermissive] 10 | if(S[i]=="N"&&n=0){n=1;} a.cc:10:15: error: lvalue required as left operand of assignment 10 | if(S[i]=="N"&&n=0){n=1;} a.cc:11:15: error: ISO C++ forbids comparison between pointer and integer [-fpermissive] 11 | else if(S[i]=="S"&&s=0){s=1;} a.cc:11:20: error: lvalue required as left operand of assignment 11 | else if(S[i]=="S"&&s=0){s=1;} a.cc:12:15: error: ISO C++ forbids comparison between pointer and integer [-fpermissive] 12 | else if(S[i]=="W"&&w=0){w=1;} a.cc:12:20: error: lvalue required as left operand of assignment 12 | else if(S[i]=="W"&&w=0){w=1;} a.cc:13:15: error: ISO C++ forbids comparison between pointer and integer [-fpermissive] 13 | else if(S[i]=="E"&&e=0){e=1;} a.cc:13:20: error: lvalue required as left operand of assignment 13 | else if(S[i]=="E"&&e=0){e=1;}
s099004960
p04019
Java
/** * Created by abhishek on 7/29/2016. */ import java.util.*; import java.io.*; public class Main { public static void main(String[] args)throws Exception { BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); String str = br.readLine(); int north= 0,east = 0,west = 0,south = 0; for(int i = 0;i < str.length();i++){ if(str.charAt(i) == 'N')north++; if(str.charAt(i) == 'W')west++; if(str.charAt(i) == 'E')east++; if(str.charAt(i) == 'S')south++; } if(north != 0 && south == 0 || south != 0 && north = 0 || east != 0 && west = 0 || west != 0 && east == 0) System.out.print("No"); else System.out.print("Yes"); } }
Main.java:17: error: bad operand types for binary operator '&&' if(north != 0 && south == 0 || south != 0 && north = 0 || east != 0 && west = 0 || west != 0 && east == 0) ^ first type: boolean second type: int Main.java:17: error: bad operand types for binary operator '&&' if(north != 0 && south == 0 || south != 0 && north = 0 || east != 0 && west = 0 || west != 0 && east == 0) ^ first type: boolean second type: int Main.java:17: error: bad operand types for binary operator '||' if(north != 0 && south == 0 || south != 0 && north = 0 || east != 0 && west = 0 || west != 0 && east == 0) ^ first type: int second type: boolean 3 errors
s083928491
p04019
C
#include <stdio.h> #include <string.h> int main() { char S[1234] = { '\0' }; int str_long, x = 0, y = 0, n = -1, w = -1, s = -1, e = -1; bool flag = false; scanf("%s", &S); str_long = strlen(S); for (int i = 0; i < str_long - 1; i++) { switch (S[i]) { case 'N': y++; n = 1; break; case 'W': x--; w = 1; break; case 'S': y--; s = 1; break; case 'E': x++; e = 1; break; } } switch (S[str_long - 1]) { case 'N': n = 1; break; case 'W': w = 1; break; case 'S': s = 1; break; case 'E': e = 1; break; } /*if (x == 0 && y < 0) { if (S[str_long-1] == 'N') { flag = true; } } if (x == 0 && y > 0) { if (S[str_long-1] == 'S') { flag = true; } } if (x < 0 && y == 0) { if (S[str_long-1] == 'E') { flag = true; } } if (x > 0 && y == 0) { if (S[str_long-1] == 'W') { flag = true; } }*/ if (x == 0) { if (n == 1 && s == 1) { flag = true; } } if (y == 0) { if (w == 1 && e == 1) { flag = true; } } if (flag == true) { printf("Yes"); } if (flag == false) { printf("No"); } // printf("\n%d %d", x, y); return 0; }
main.c: In function 'main': main.c:8:9: error: unknown type name 'bool' 8 | bool flag = false; | ^~~~ main.c:3:1: note: 'bool' is defined in header '<stdbool.h>'; this is probably fixable by adding '#include <stdbool.h>' 2 | #include <string.h> +++ |+#include <stdbool.h> 3 | main.c:8:21: error: 'false' undeclared (first use in this function) 8 | bool flag = false; | ^~~~~ main.c:8:21: note: 'false' is defined in header '<stdbool.h>'; this is probably fixable by adding '#include <stdbool.h>' main.c:8:21: note: each undeclared identifier is reported only once for each function it appears in main.c:81:32: error: 'true' undeclared (first use in this function) 81 | flag = true; | ^~~~ main.c:81:32: note: 'true' is defined in header '<stdbool.h>'; this is probably fixable by adding '#include <stdbool.h>'
s165155841
p04019
C++
#include <iostream> using namespace std; int main(){ int i,n = 0,so = 0,e = 0,w = 0; char s; while(cin != !EOF){ if(s == 'N'){ n += 1; }else if(s == 'S'){ so += 1; }else if(s == 'W') w += 1; else e += 1; } if(n - so== 0){ if(s - w == 0) cout << "YES" << endl; }else{ cout << "NO" << endl; } return 0; }
a.cc: In function 'int main()': a.cc:8:15: error: no match for 'operator!=' (operand types are 'std::istream' {aka 'std::basic_istream<char>'} and 'bool') 8 | while(cin != !EOF){ | ^ a.cc:8:15: note: candidate: 'operator!=(int, int)' (built-in) a.cc:8:15: note: no known conversion for argument 1 from 'std::istream' {aka 'std::basic_istream<char>'} to 'int' 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:1: /usr/include/c++/14/bits/postypes.h:197:5: note: candidate: 'template<class _StateT> bool std::operator!=(const fpos<_StateT>&, const fpos<_StateT>&)' 197 | operator!=(const fpos<_StateT>& __lhs, const fpos<_StateT>& __rhs) | ^~~~~~~~ /usr/include/c++/14/bits/postypes.h:197:5: note: template argument deduction/substitution failed: In file included from /usr/include/c++/14/cstdio:42, from /usr/include/c++/14/ext/string_conversions.h:45, from /usr/include/c++/14/bits/basic_string.h:4154, from /usr/include/c++/14/string:54, 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: a.cc:8:19: note: 'std::istream' {aka 'std::basic_istream<char>'} is not derived from 'const std::fpos<_StateT>' 8 | while(cin != !EOF){ | ^~~ In file included from /usr/include/c++/14/string:43: /usr/include/c++/14/bits/allocator.h:243:5: note: candidate: 'template<class _T1, class _T2> bool std::operator!=(const allocator<_CharT>&, const allocator<_T2>&)' 243 | operator!=(const allocator<_T1>&, const allocator<_T2>&) | ^~~~~~~~ /usr/include/c++/14/bits/allocator.h:243:5: note: template argument deduction/substitution failed: a.cc:8:19: note: 'std::istream' {aka 'std::basic_istream<char>'} is not derived from 'const std::allocator<_CharT>' 8 | while(cin != !EOF){ | ^~~ In file included from /usr/include/c++/14/string:48: /usr/include/c++/14/bits/stl_iterator.h:455:5: note: candidate: 'template<class _Iterator> constexpr bool std::operator!=(const reverse_iterator<_Iterator>&, const reverse_iterator<_Iterator>&)' 455 | operator!=(const reverse_iterator<_Iterator>& __x, | ^~~~~~~~ /usr/include/c++/14/bits/stl_iterator.h:455:5: note: template argument deduction/substitution failed: a.cc:8:19: note: 'std::istream' {aka 'std::basic_istream<char>'} is not derived from 'const std::reverse_iterator<_Iterator>' 8 | while(cin != !EOF){ | ^~~ /usr/include/c++/14/bits/stl_iterator.h:500:5: note: candidate: 'template<class _IteratorL, class _IteratorR> constexpr bool std::operator!=(const reverse_iterator<_Iterator>&, const reverse_iterator<_IteratorR>&)' 500 | operator!=(const reverse_iterator<_IteratorL>& __x, | ^~~~~~~~ /usr/include/c++/14/bits/stl_iterator.h:500:5: note: template argument deduction/substitution failed: a.cc:8:19: note: 'std::istream' {aka 'std::basic_istream<char>'} is not derived from 'const std::reverse_iterator<_Iterator>' 8 | while(cin != !EOF){ | ^~~ /usr/include/c++/14/bits/stl_iterator.h:1686:5: note: candidate: 'template<class _IteratorL, class _IteratorR> constexpr bool std::operator!=(const move_iterator<_IteratorL>&, const move_iterator<_IteratorR>&)' 1686 | operator!=(const move_iterator<_IteratorL>& __x, | ^~~~~~~~ /usr/include/c++/14/bits/stl_iterator.h:1686:5: note: template argument deduction/substitution failed: a.cc:8:19: note: 'std::istream' {aka 'std::basic_istream<char>'} is not derived from 'const std::move_iterator<_IteratorL>' 8 | while(cin != !EOF){ | ^~~ /usr/include/c++/14/bits/stl_iterator.h:1753:5: note: candidate: 'template<class _Iterator> constexpr bool std::operator!=(const move_iterator<_IteratorL>&, const move_iterator<_IteratorL>&)' 1753 | operator!=(const move_iterator<_Iterator>& __x, | ^~~~~~~~ /usr/include/c++/14/bits/stl_iterator.h:1753:5: note: template argument deduction/substitution failed: a.cc:8:19: note: 'std::istream' {aka 'std::basic_istream<char>'} is not derived from 'const std::move_iterator<_IteratorL>' 8 | while(cin != !EOF){ | ^~~ In file included from /usr/include/c++/14/bits/stl_algobase.h:64, from /usr/include/c++/14/string:51: /usr/include/c++/14/bits/stl_pair.h:1052:5: note: candidate: 'template<class _T1, class _T2> constexpr bool std::operator!=(const pair<_T1, _T2>&, const pair<_T1, _T2>&)' 1052 | operator!=(const pair<_T1, _T2>& __x, const pair<_T1, _T2>& __y) | ^~~~~~~~ /usr/include/c++/14/bits/stl_pair.h:1052:5: note: template argument deduction/substitution failed: a.cc:8:19: note: 'std::istream' {aka 'std::basic_istream<char>'} is not derived from 'const std::pair<_T1, _T2>' 8 | while(cin != !EOF){ | ^~~ In file included from /usr/include/c++/14/bits/basic_string.h:47: /usr/include/c++/14/string_view:651:5: note: candidate: 'template<class _CharT, class _Traits> constexpr bool std::operator!=(basic_string_view<_CharT, _Traits>, basic_string_view<_CharT, _Traits>)' 651 | operator!=(basic_string_view<_CharT, _Traits> __x, | ^~~~~~~~ /usr/include/c++/14/string_view:651:5: note: template argument deduction/substitution failed: a.cc:8:19: note: 'std::basic_istream<char>' is not derived from 'std::basic_string_view<_CharT, _Traits>' 8 | while(cin != !EOF){ | ^~~ /usr/include/c++/14/string_view:658:5: note: candidate: 'template<class _CharT, class _Traits> constexpr bool std::operator!=(basic_string_view<_CharT, _Traits>, __type_identity_t<basic_string_view<_CharT, _Traits> >)' 658 | operator!=(basic_string_view<_CharT, _Traits> __x, | ^~~~~~~~ /usr/include/c++/14/string_view:658:5: note: template argument deduction/substitution failed: a.cc:8:19: note: 'std::basic_istream<char>' is not derived from 'std::basic_string_view<_CharT, _Traits>' 8 | while(cin != !EOF){ | ^~~ /usr/include/c++/14/string_view:666:5: note: candidate: 'template<class _CharT, class _Traits> constexpr bool std::operator!=(__type_identity_t<basic_string_view<_CharT, _Traits> >, basic_string_view<_CharT, _Traits>)' 666 | operator!=(__type_identity_t<basic_string_view<_CharT, _Traits>> __x, | ^~~~~~~~ /usr/include/c++/14/string_view:666:5: note: template argument deduction/substitution failed: a.cc:8:19: note: mismatched types 'std::basic_string_view<_CharT, _Traits>' and 'bool' 8 | while(cin != !EOF){ | ^~~ /usr/include/c++/14/bits/basic_string.h:3833:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> bool std::operator!=(const __cxx11::basic_string<_CharT, _Traits, _Allocator>&, const __cxx11::basic_string<_CharT, _Traits, _Allocator>&)' 3833 | operator!=(const basic_string<_CharT, _Traits, _Alloc>& __lhs, | ^~~~~~~~ /usr/include/c++/14/bits/basic_string.h:3833:5: note: template argument deduction/substitution failed: a.cc:8:19: note: 'std::istream' {aka 'std::basic_istream<char>'} is not derived from 'const std::__cxx11::basic_string<_CharT, _Traits, _Allocator>' 8 | while(cin != !EOF){ | ^~~ /usr/include/c++/14/bits/basic_string.h:3847:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> bool std::operator!=(const _CharT*, const __cxx11::basic_string<_CharT, _Traits, _Allocator>&)' 3847 | operator!=(const _CharT* __lhs, | ^~~~~~~~ /usr/include/c++/14/bits/basic_string.h:3847:5: note: template argument deduction/substitution failed: a.cc:8:19: note: mismatched types 'const _CharT*' and 'std::basic_istream<char>' 8 | while(cin != !EOF){ | ^~~ /usr/include/c++/14/bits/basic_string.h:3860:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> bool std::operator!=(const __cxx11::basic_string<_CharT, _Traits, _Allocator>&, const _CharT*)' 3860 | operator!=(const basic_string<_CharT, _Traits, _Alloc>& __lhs, | ^~~~~~~~ /usr/include/c++/14/bits/basic_string.h:3860:5: note: template argument deduction/substitution failed: a.cc:8:19: note: 'std::istream' {aka 'std::basic_istream<char>'} is not derived from 'const std::__cxx11::basic_string<_CharT, _Traits, _Allocator>' 8 | while(cin != !EOF){ | ^~~ In file included from /usr/include/c++/14/bits/memory_resource.h:47, from /usr/include/c++/14/string:68: /usr/include/c++/14/tuple:2613:5: note: candidate: 'template<class ... _TElements, class ... _UElements> constexpr bool std::operator!=(const tuple<_UTypes ...>&, const tuple<_Elements ...>&)' 2613 | operator!=(const tuple<_TElements...>& __t, | ^~~~~~~~ /usr/include/c++/14/tuple:2613:5: note: template argument deduction/substitution failed: a.cc:8:19: note: 'std::istream' {aka 'std::basic_istream<char>'} is not derived from 'const std::tuple<_UTypes ...>' 8 | while(cin != !EOF){ | ^~~ In file included from /usr/include/c++/14/bits/locale_facets.h:48, from /usr/include/c++/14/bits/basic_ios.h:37, from /usr/include/c++/14/ios:46: /usr/include/c++/14/bits/streambuf_iterator.h:242:5: note: candidate: 'template<class _CharT, class _Traits> bool std::operator!=(const istreambuf_iterator<_CharT, _Traits>&, const istreambuf_iterator<_CharT, _Traits>&)' 242 | operator!=(const istreambuf_iterator<_CharT, _Traits>& __a, | ^~~~~~~~ /usr/include/c++/14/bits/streambuf_iterator.h:242:5: note: template argument deduction/substitution failed: a.cc:8:19: note: 'std::istream' {aka 'std::basic_istream<char>'} is not derived from 'const std::istreambuf_iterator<_CharT, _Traits>' 8 | while(cin != !EOF){ |
s815683796
p04019
C++
#include <iostream> using namespace std; int main(){ int i,n = 0,so = 0,e = 0,w = 0; char s; while(cin >> s) if(s == 'N'){ n += 1; //cout << "N" << endl; }else if(s == 'S'){ so += 1; //cout << "S" << endl; }else if(s == 'W') w += 1; else e += 1; } if(n - so== 0){ if(s - w == 0) cout << "YES" << endl; }else{ cout << "NO" << endl; } return 0; }
a.cc:21:5: error: expected unqualified-id before 'if' 21 | if(n - so== 0){ | ^~ a.cc:24:6: error: expected unqualified-id before 'else' 24 | }else{ | ^~~~ a.cc:27:5: error: expected unqualified-id before 'return' 27 | return 0; | ^~~~~~ a.cc:28:1: error: expected declaration before '}' token 28 | } | ^
s851001599
p04019
C++
#include<iostream> #include<vector> #include<string> #include<algorithm> #include<cstring> #include<cmath> #include<set> #include<map> #include<sstream> #include<iomanip> using namespace std; int main() { ios_base::sync_with_stdio(false); string ss; cin>>ss; set<char> s; string sss=ss[0]; for(int i=1;i<ss.size();i++) { if(sss[sss.size()-1]!=ss[i]) sss+=ss[i]; } int x=0,y=0; ss=sss; for(int i=0;i<ss.size();i++) { if(ss[i]=='S') { y--; } else if(ss[i]=='N') y++; else if(ss[i]=='W') x--; else x++; } if(x==0&&y==0) { cout<<"Yes"<<endl; } else cout<<"No"<<endl; return 0; }
a.cc: In function 'int main()': a.cc:18:20: error: conversion from '__gnu_cxx::__alloc_traits<std::allocator<char>, char>::value_type' {aka 'char'} to non-scalar type 'std::string' {aka 'std::__cxx11::basic_string<char>'} requested 18 | string sss=ss[0]; | ^
s971212728
p04019
C++
#include<iostream> #include<vector> #include<string> #include<algorithm> #include<cstring> #include<cmath> #include<set> #include<map> #include<sstream> #include<iomanip> using namespace std; int main() { ios_base::sync_with_stdio(false); string ss; cin>>ss; set<char> s; string sss=ss[0]; for(int i=1;i<ss.size();i++) { if(sss[sss.size()-1]!=ss[i]) sss+=ss[i]; } int x=0,y=0; ss=sss; for(int i=0;i<ss.size();i++) { if(ss[i]=='S') { y--; } else if(ss[i]=='N') y++; else if(ss[i]=='W') x--; else x++; } if(x==0&&y==0) { cout<<"Yes"<<endl; } else cout<<"No"<<endl; return 0; }
a.cc: In function 'int main()': a.cc:18:20: error: conversion from '__gnu_cxx::__alloc_traits<std::allocator<char>, char>::value_type' {aka 'char'} to non-scalar type 'std::string' {aka 'std::__cxx11::basic_string<char>'} requested 18 | string sss=ss[0]; | ^
s696876627
p04019
C++
x = raw_input() n = x.count('N') e = x.count('E') w = x.count('W') s = x.count('S') if (n == s) and (e == w):print "Yes" else: print "No"
a.cc:1:1: error: 'x' does not name a type 1 | x = raw_input() | ^
s184217300
p04019
C++
# include <iostream> # include <cstdio> # include <cstring> using namespace std; char s[1000+10]; int memo[150]; int main(){ while(gets(s)!=NULL){ memset(memo,0,sizeof(memo)); for(int i = 0;s[i]!='\0';++i){ if(memo[s[i]] == 0) memo[s[i]] = 1; } if(memo['N'] == 1&&memo['W'] == 1&&memo['E'] == 1&&memo['S'] == 1) printf("Yes\n"); else if(memo['N'] == 1&&memo['W'] == 0&&memo['E'] == 0&&memo['S'] == 1) printf("Yes\n"); else if(memo['N'] == 0&&memo['W'] == 1&&memo['E'] == 1&&memo['S'] == 0) printf("Yes\n"); else printf("No\n"); } return 0; }
a.cc: In function 'int main()': a.cc:8:11: error: 'gets' was not declared in this scope; did you mean 'getw'? 8 | while(gets(s)!=NULL){ | ^~~~ | getw
s215435637
p04019
C
#include <stdio.h> #include <string.h> int main(void){ int i=0; int n=0,w=0; char s[1001]; scanf("%s",s); for(;strlen(s)>=i ;i++){ if(s[i]=='N')n++; if(s[i]=='S')n--; if(s[i]=='W')w++; if(s[i]=='E')w--; } if(n==0&&w==0){ printf("Yes\n"); }else{ printf("No\n"); } return 0;
main.c: In function 'main': main.c:22:9: error: expected declaration or statement at end of input 22 | return 0; | ^~~~~~
s919109696
p04019
C
#include <stdio.h> #include <string.h> int main(void){ char S[1000]; int i, len; int x = 0; int y = 0; scanf("%s", S); len= stlen(S); for (i = 0; i <= len; i++){ if(S[i] == 'N'){ x++; } if(S[i] == 'S'){ x--; } if(S[i] == 'W'){ y--; } if(S[i] == 'E'){ y++; } } if(x == 0 && y == 0){ printf("Yes"); }else{ printf("No"); } return 0; }
main.c: In function 'main': main.c:11:8: error: implicit declaration of function 'stlen'; did you mean 'strlen'? [-Wimplicit-function-declaration] 11 | len= stlen(S); | ^~~~~ | strlen
s439399900
p04019
C++
# include <iostream> # include <cstdio> # include <cstring> using namespace std; char s[1000+10]; int memo[150]; int main(){ while(gets(s)){ memset(memo,0,sizeof(memo)); for(int i = 0;s[i]!='\0';++i){ if(memo[s[i]] == 0) memo[s[i]] = 1; } if(memo['N'] == 1&&memo['W'] == 1&&memo['E'] == 1&&memo['S'] == 1) printf("Yes\n"); else if(memo['N'] == 1&&memo['W'] == 0&&memo['E'] == 0&&memo['S'] == 1) printf("Yes\n"); else if(memo['N'] == 0&&memo['W'] == 1&&memo['E'] == 1&&memo['S'] == 0) printf("Yes\n"); else printf("No\n"); } return 0; }
a.cc: In function 'int main()': a.cc:8:11: error: 'gets' was not declared in this scope; did you mean 'getw'? 8 | while(gets(s)){ | ^~~~ | getw
s994947623
p04019
C++
# include <cstdio> # include <cstring> char s[1000+10]; int memo[150]; int main(){ while(gets(s)){ memset(memo,0,sizeof(memo)); for(int i = 0;s[i]!='\0';++i){ if(memo[s[i]] == 0) memo[s[i]] = 1; } if(memo['N'] == 1&&memo['W'] == 1&&memo['E'] == 1&&memo['S'] == 1) printf("Yes\n"); else if(memo['N'] == 1&&memo['W'] == 0&&memo['E'] == 0&&memo['S'] == 1) printf("Yes\n"); else if(memo['N'] == 0&&memo['W'] == 1&&memo['E'] == 1&&memo['S'] == 0) printf("Yes\n"); else printf("No\n"); } return 0; }
a.cc: In function 'int main()': a.cc:6:11: error: 'gets' was not declared in this scope; did you mean 'getw'? 6 | while(gets(s)){ | ^~~~ | getw
s552167042
p04019
C++
# include <cstdio> # include <cstring> char s[1000+10]; int memo[150]; int main(){ while(gets(s)){ memset(memo,0,sizeof(memo)); for(int i = 0;s[i]!='\0';++i){ if(memo[s[i]] == 0) memo[s[i]] = 1; } if(memo['N'] == 1&&memo['W'] == 1&&memo['E'] == 1&&memo['S'] == 1) printf("Yes\n"); else if(memo['N'] == 1&&memo['W'] == 0&&memo['E'] == 0&&memo['S'] == 1) printf("Yes\n"); else if(memo['N'] == 0&&memo['W'] == 1&&memo['E'] == 1&&memo['S'] == 0) printf("Yes\n"); else printf("No\n"); } return 0; }
a.cc: In function 'int main()': a.cc:6:11: error: 'gets' was not declared in this scope; did you mean 'getw'? 6 | while(gets(s)){ | ^~~~ | getw
s565617255
p04019
C++
#include <bits/stdc++.h> using namespace std; typedef vector<int> vi; typedef vector<vi> vvi; typedef vector<string> vs; typedef vector<bool> vb; typedef vector<vb> vvb; typedef pair<int, int> pii; typedef long long ll; typedef unsigned long long ull; #define all(a) (a).begin(),(a).end() #define rall(a) (a).rbegin(), (a).rend() #define pb push_back #define mp make_pair #define loop(i,a,b) for(ull i=(a);i<ull(b);++i) #define rep(i,n) loop(i,0,n) #define iter(i,c) for(auto i=(c).begin(); i!=(c).end(); ++i) #define riter(i,c) for(auto i=(c).rbegin(); i!=(c).rend(); ++i) const double eps = 1e-10; const double pi = acos(-1.0); const double inf = (int)1e8; #define clr(a,i) memset((a), (i) ,sizeof(a)) int main(){ string s; int in,iw,is,ie; in=iw=is=ie=0; std::cin >> s; rep(i,s.size()){ if(s[i]=='N') in++; if(s[i]=='S') is++; if(s[i]=='W') iw++; if(s[i]=='E') ie++; } if(in==0&&is=0&&iw==0&&ie==0){ std::cout << "YES" << std::endl; }else if(in>0&&is>0&&iw==0&&ie==0){ std::cout << "YES" << std::endl; }else if(iw>0&&ie>0&&in==0&&is==0){ std::cout << "YES" << std::endl; }else if(iw>0&&ie>0&&in>0&&is>0){ std::cout << "YES" << std::endl; } else{ std::cout << "NO" << std::endl; } }
a.cc: In function 'int main()': a.cc:39:11: error: lvalue required as left operand of assignment 39 | if(in==0&&is=0&&iw==0&&ie==0){ | ~~~~~^~~~
s399336189
p04019
C++
# include <cstdio> # include <cstring> char s[1000+10]; int memo[150]; int main(){ while(gets(s)){ memset(memo,0,sizeof(memo)); for(int i = 0;s[i]!='\0';++i){ if(memo[s[i]] == 0) memo[s[i]] = 1; } if(memo['N'] == 1&&memo['W'] == 1&&memo['E'] == 1&&memo['S'] == 1) printf("Yes\n"); else if(memo['N'] == 1&&memo['W'] == 0&&memo['E'] == 0&&memo['S'] == 1) printf("Yes\n"); else if(memo['N'] == 0&&memo['W'] == 1&&memo['E'] == 1&&memo['S'] == 0) printf("Yes\n"); else printf("No\n"); } return 0; }
a.cc: In function 'int main()': a.cc:6:11: error: 'gets' was not declared in this scope; did you mean 'getw'? 6 | while(gets(s)){ | ^~~~ | getw
s916880407
p04019
C++
#include <iostream> #include <string> #include <alogorithm> #include <vector> #include <set> #include <map> #include <utility> #include <tuple> using namespace std; typedef long long ll; typedef long double ld; typedef vector<int> vi; #define rep(i,a,n) for(int i=a;i<n;i++) #define rrep(i,a,n) for(int i=a;i>=n;i--) #define mp make_pair #define pb push_back #define mt make_tuple #define fst first #define scn second int main(){ string s; cin>>s; bool n=false,w=false,s=false,e=false; for(int i=0;i<s.size();i++){ if(s[i]=#include <iostream> #include <string> #include <algorithm> #include <vector> #include <set> #include <map> #include <utility> using namespace std; typedef long long ll; typedef long double ld; typedef vector<int> vi; #define rep(i,a,n) for(int i=a;i<n;i++) #define rrep(i,a,n) for(int i=a;i>=n;i--) #define mp make_pair #define pb push_back #define mt make_tuple #define fst first #define scn second int main(){ string str; cin>>str; bool n=false,w=false,s=false,e=false; for(int i=0;i<str.size();i++){ if(str[i]=='N') n=true; else if(str[i]=='W') w=true; else if(str[i]=='S') s=true; else if(str[i]=='E') e=true; } if(n^s||e^w){ cout<<"NO"<<endl; } else cout<<"YES"<<endl; return 0; } ="N") n=true; else if(s[i]=="W") w=true; else if(s[i]=="S") s=true; else if(s[i]=="E") e=true; } if(n^s||e^w){ cout<<"NO"<<endl; } else cout<<"YES"<<endl; return 0; }
a.cc:3:10: fatal error: alogorithm: No such file or directory 3 | #include <alogorithm> | ^~~~~~~~~~~~ compilation terminated.
s022565818
p04019
C++
#include <vector> #include <algorithm> #include <set> #include <map> #include <queue> #include <stack> #include <iostream> #include <cstdio> #include <cmath> #include <cstring> using namespace std; typedef pair<int,int> P; int a; char a[1001]; int w,n,s,e; int main() { cin>>a; scanf("%s",a); for(int i=0;i<n;i++){ if(a[i]=='W') w++; else if(a[i]=='E') e++; else if(a[i]=='N') n++; else s++; if((!(!w)==!e)||(!(!n)==!s)) puts("No"); else puts("Yes"); } }
a.cc:14:6: error: conflicting declaration 'char a [1001]' 14 | char a[1001]; | ^ a.cc:13:5: note: previous declaration as 'int a' 13 | int a; | ^ a.cc: In function 'int main()': a.cc:21:9: error: invalid types 'int[int]' for array subscript 21 | if(a[i]=='W') w++; | ^ a.cc:22:13: error: invalid types 'int[int]' for array subscript 22 | else if(a[i]=='E') e++; | ^ a.cc:23:11: error: invalid types 'int[int]' for array subscript 23 | else if(a[i]=='N') n++; | ^
s972997972
p04019
C++
#include <iostream> #include <string> using namespace std; int main(){ string s; cin >> s; int x = 0, y = 0; for(int i = 0; i < s.length(); i++){ if(s.at(i) == 'N') y++; else if(s.at(i) == 'S') y--; else if((s.at(i) == 'E')) x++; else x-- } if(x == 0 && y == 0) cout << "Yes"; else cout << "No"; return 0; }
a.cc: In function 'int main()': a.cc:13:25: error: expected ';' before '}' token 13 | else x-- | ^ | ; 14 | } | ~
s603214223
p04019
Java
import java.util.Scanner; public class A { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int ns = 0; int we = 0; String str = sc.nextLine(); for (int i = 0, max = str.length(); i < max; i++) { char ch = str.charAt(i); if(ch == 'N') { ns++; } else if (ch == 'W') { we--; } else if(ch == 'S') { ns--; } else if(ch == 'E'){ we++; } } if (ns == 0 && we == 0) { System.out.println("Yes"); } else { System.out.println("No"); } } }
Main.java:3: error: class A is public, should be declared in a file named A.java public class A { ^ 1 error
s883082042
p04019
C++
#include <bits/stdc++.h> using namespace std; int main() { string str; cin >> str; int x = 0, y = 0; for (int unsigned i = 0; i < s.size(); i++) { if (s[i] == 'S') y++; if (s[i] == 'N') y--; if (s[i] == 'W') x++; if (s[i] == 'E') x--; } if (x == 0 && y == 0) { cout << "Yes" << endl; } else { cout << "No" << endl; } return 0; }
a.cc: In function 'int main()': a.cc:7:38: error: 's' was not declared in this scope 7 | for (int unsigned i = 0; i < s.size(); i++) { | ^
s787723615
p04019
C++
#include<iostream> #include<vector> #include<string> #include<algorithm> #include<cstring> #include<cmath> #include<set> #include<map> #include<sstream> #include<iomanip> using namespace std; int main() { ios_base::sync_with_stdio(false); string ss; cin>>ss; int x=0,y=0; for(int i=0;i<ss.size();i++) { if(ss[i]=='S') { y--; } else if(ss[i]=='N') y++; else if(ss[i]=='W') x--; else x++ } if(x==0&&y==0) { cout<<"Yes"<<endl; } else cout<<"No"<<endl; return 0; }
a.cc: In function 'int main()': a.cc:29:16: error: expected ';' before '}' token 29 | x++ | ^ | ; 30 | } | ~
s440385428
p04019
C++
#include <iostream> #include <stack> #include <queue> #include <deque> #include <vector> #include <set> #include <map> #include <unordered_set> #include <unordered_map> #include <cmath> #include <algorithm> #include <fstream> using namespace std; #define M_PI 3.14159265358979323846264338327950288 int main() { srand(179179); cin.tie(nullptr); ios_base::sync_with_stdio(false); cout.setf(ios_base::fixed); cout.precision(28); string S; cin >> S; map<char, int> m; for (auto& x : S) { ++m[x]; } if (m.size() == 4 || (m.size() == 2 && (m['S'] > 0 && m['N'] > 0 || m['E'] > 0 && m['W'] > 0)) { cout << "YES\n"; } else { cout << "NO\n"; } return 0; }
a.cc:19:9: warning: "M_PI" redefined 19 | #define M_PI 3.14159265358979323846264338327950288 | ^~~~ In file included from /usr/include/c++/14/cmath:47, from a.cc:12: /usr/include/math.h:1121:10: note: this is the location of the previous definition 1121 | # define M_PI 3.14159265358979323846 /* pi */ | ^~~~ a.cc: In function 'int main()': a.cc:38:97: error: expected ';' before '{' token 38 | if (m.size() == 4 || (m.size() == 2 && (m['S'] > 0 && m['N'] > 0 || m['E'] > 0 && m['W'] > 0)) { | ^~ | ; a.cc:40:5: error: expected primary-expression before 'else' 40 | } else { | ^~~~ a.cc:40:4: error: expected ')' before 'else' 40 | } else { | ^~~~~ | ) a.cc:38:6: note: to match this '(' 38 | if (m.size() == 4 || (m.size() == 2 && (m['S'] > 0 && m['N'] > 0 || m['E'] > 0 && m['W'] > 0)) { | ^
s364626396
p04019
Java
import java.io.*; import java.util.*; public class R3qA { public static void main(String[] args) { InputReader in = new InputReader(System.in); PrintWriter w = new PrintWriter(System.out); char s[] = in.readString().toCharArray(); boolean t[] = new boolean[500]; for (char x : s) t[x] = true; boolean ans = true; ans &= t['N'] == t['S']; ans &= t['W'] == t['E']; w.println(ans ? "Yes" : "No"); w.close(); } static class InputReader { private final InputStream stream; private final byte[] buf = new byte[8192]; private int curChar, snumChars; private SpaceCharFilter filter; public InputReader(InputStream stream) { this.stream = stream; } public int snext() { if (snumChars == -1) throw new InputMismatchException(); if (curChar >= snumChars) { curChar = 0; try { snumChars = stream.read(buf); } catch (IOException e) { throw new InputMismatchException(); } if (snumChars <= 0) return -1; } return buf[curChar++]; } public int nextInt() { int c = snext(); while (isSpaceChar(c)) { c = snext(); } int sgn = 1; if (c == '-') { sgn = -1; c = snext(); } int res = 0; do { if (c < '0' || c > '9') throw new InputMismatchException(); res *= 10; res += c - '0'; c = snext(); } while (!isSpaceChar(c)); return res * sgn; } public long nextLong() { int c = snext(); while (isSpaceChar(c)) { c = snext(); } int sgn = 1; if (c == '-') { sgn = -1; c = snext(); } long res = 0; do { if (c < '0' || c > '9') throw new InputMismatchException(); res *= 10; res += c - '0'; c = snext(); } while (!isSpaceChar(c)); return res * sgn; } public int[] nextIntArray(int n) { int a[] = new int[n]; for (int i = 0; i < n; i++) { a[i] = nextInt(); } return a; } public String readString() { int c = snext(); while (isSpaceChar(c)) { c = snext(); } StringBuilder res = new StringBuilder(); do { res.appendCodePoint(c); c = snext(); } while (!isSpaceChar(c)); return res.toString(); } public String nextLine() { int c = snext(); while (isSpaceChar(c)) c = snext(); StringBuilder res = new StringBuilder(); do { res.appendCodePoint(c); c = snext(); } while (!isEndOfLine(c)); return res.toString(); } public boolean isSpaceChar(int c) { if (filter != null) return filter.isSpaceChar(c); return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1; } private boolean isEndOfLine(int c) { return c == '\n' || c == '\r' || c == -1; } public interface SpaceCharFilter { public boolean isSpaceChar(int ch); } } }
Main.java:4: error: class R3qA is public, should be declared in a file named R3qA.java public class R3qA { ^ 1 error
s997684834
p04019
C++
#include <cstdio> #include <cstring> using namespace std; const int N = 1000500; char buf[N]; bool was[256]; int main() { gets(buf); int n = strlen(buf); for (int i = 0; i < n; i++) { was[buf[i]] = true; } bool ans = was['N'] == was['S'] && was['E'] == was['W']; puts(ans ? "Yes" : "No"); }
a.cc: In function 'int main()': a.cc:11:5: error: 'gets' was not declared in this scope; did you mean 'getw'? 11 | gets(buf); | ^~~~ | getw
s339803622
p04019
C++
// {{{ by shik #include <bits/stdc++.h> #include <unistd.h> #define SZ(x) ((int)(x).size()) #define ALL(x) begin(x),end(x) #define REP(i,n) for ( int i=0; i<int(n); i++ ) #define REP1(i,a,b) for ( int i=(a); i<=int(b); i++ ) #define FOR(it,c) for ( auto it=(c).begin(); it!=(c).end(); it++ ) #define MP make_pair #define PB push_back using namespace std; typedef long long LL; typedef pair<int,int> PII; typedef vector<int> VI; #ifdef SHIK template<typename T> void _dump( const char* s, T&& head ) { cerr<<s<<"="<<head<<endl; } template<typename T, typename... Args> void _dump( const char* s, T&& head, Args&&... tail ) { int c=0; while ( *s!=',' || c!=0 ) { if ( *s=='(' || *s=='[' || *s=='{' ) c++; if ( *s==')' || *s==']' || *s=='}' ) c--; cerr<<*s++; } cerr<<"="<<head<<", "; _dump(s+1,tail...); } #define dump(...) do { \ fprintf(stderr, "%s:%d - ", __PRETTY_FUNCTION__, __LINE__); \ _dump(#__VA_ARGS__, __VA_ARGS__); \ } while (0) template<typename Iter> ostream& _out( ostream &s, Iter b, Iter e ) { s<<"["; for ( auto it=b; it!=e; it++ ) s<<(it==b?"":" ")<<*it; s<<"]"; return s; } template<typename A, typename B> ostream& operator <<( ostream &s, const pair<A,B> &p ) { return s<<"("<<p.first<<","<<p.second<<")"; } template<typename T> ostream& operator <<( ostream &s, const vector<T> &c ) { return _out(s,ALL(c)); } template<typename T, size_t N> ostream& operator <<( ostream &s, const array<T,N> &c ) { return _out(s,ALL(c)); } template<typename T> ostream& operator <<( ostream &s, const set<T> &c ) { return _out(s,ALL(c)); } template<typename A, typename B> ostream& operator <<( ostream &s, const map<A,B> &c ) { return _out(s,ALL(c)); } #else #define dump(...) #endif template<typename T> void _R( T &x ) { cin>>x; } void _R( int &x ) { scanf("%d",&x); } void _R( long long &x ) { scanf("%" PRId64,&x); } void _R( double &x ) { scanf("%lf",&x); } void _R( char &x ) { scanf(" %c",&x); } void _R( char *x ) { scanf("%s",x); } void R() {} template<typename T, typename... U> void R( T& head, U&... tail ) { _R(head); R(tail...); } template<typename T> void _W( const T &x ) { cout<<x; } void _W( const int &x ) { printf("%d",x); } template<typename T> void _W( const vector<T> &x ) { for ( auto i=x.cbegin(); i!=x.cend(); i++ ) { if ( i!=x.cbegin() ) putchar(' '); _W(*i); } } void W() {} template<typename T, typename... U> void W( const T& head, const U&... tail ) { _W(head); putchar(sizeof...(tail)?' ':'\n'); W(tail...); } #ifdef SHIK #define FILEIO(...) #else #define FILEIO(name) do {\ freopen(name ".in","r",stdin); \ freopen(name ".out","w",stdout); \ } while (0) #endif // }}} const int N=1010; int n; char s[N]; const char *t="NWSE"; int main() { n=strlen(gets(s)); bool b[4]={}; REP(i,n) b[strchr(t,s[i])-t]=1; if ( (b[0]^b[2]) || (b[1]^b[3]) ) W("No"); else W("Yes"); return 0; }
a.cc: In function 'int main()': a.cc:109:14: error: 'gets' was not declared in this scope; did you mean 'getw'? 109 | n=strlen(gets(s)); | ^~~~ | getw
s395615834
p04019
C++
#include <bits/stdc++.h> using namespace std; int x = 0, y = 0; int main() { string s; cin >> s; for (int i = 0; i < s.size(); i++) { if (s[i] == "N") y++; else if (s[i] == "S") y--; else if (s[i] == "E") x++; else x--; } if (x == 0 && y == 0) cout << "Yes" << endl; else cout << "No" << endl; }
a.cc: In function 'int main()': a.cc:9:18: error: ISO C++ forbids comparison between pointer and integer [-fpermissive] 9 | if (s[i] == "N") y++; a.cc:10:23: error: ISO C++ forbids comparison between pointer and integer [-fpermissive] 10 | else if (s[i] == "S") y--; a.cc:11:23: error: ISO C++ forbids comparison between pointer and integer [-fpermissive] 11 | else if (s[i] == "E") x++;
s177808711
p04020
C++
#include <bits/stdc++.h> using namespace std; int main() { int n; cin >> n; vector<int> a(n + 1, 0); for (int i = 1; i <= n; i++) { cin >> a[i]; } int res = 0; int curr = 0; bool ct = 1; for (int i = 1; i <= n; i++) { int ds = a[i]; int prs = (ds + curr) / 2; res += prs; if (y == 0) { curr = 0; } else { curr = (ds + curr) % 2; } // cout << prs << " pairs\n"; } cout << res << "\n"; }
a.cc: In function 'int main()': a.cc:20:21: error: 'y' was not declared in this scope 20 | if (y == 0) { | ^
s895692329
p04020
C++
f
a.cc:1:1: error: 'f' does not name a type 1 | f | ^
s981145098
p04020
C++
// ----------------------------------- // author : MatsuTaku // country : Japan // created : 09/11/20 07:34:59 // ----------------------------------- #include <bits/stdc++.h> #include <atcoder/all> using namespace std; using ll = long long; int main() { cin.tie(nullptr); ios::sync_with_stdio(false); int n; cin>>n; vector<int> A(n); for (auto& a:A) cin>>a; int ans = 0; for (int i = 1; i < n; i++) { int add = min(A[i-1], A[i]); ans += add; A[i] -= add; ans += (A[i-1]-add)/2; } ans += A[n-1]/2; cout << ans << endl; return 0; }
a.cc:8:10: fatal error: atcoder/all: No such file or directory 8 | #include <atcoder/all> | ^~~~~~~~~~~~~ compilation terminated.
s380270517
p04020
C++
// ----------------------------------- // author : MatsuTaku // country : Japan // created : 09/11/20 07:34:59 // ----------------------------------- #include <bits/stdc++.h> #include <atcoder/all> using namespace std; using ll = long long; int main() { cin.tie(nullptr); ios::sync_with_stdio(false); int n; cin>>n; vector<int> A(n); for (auto& a:A) cin>>a; int ans = 0; for (int i = 1; i < n; i++) { int add = min(A[i-1], A[i]); ans += add; A[i] -= add; ans += (A[i-1]-add)/2; } ans += A[i]/2; cout << ans << endl; return 0; }
a.cc:8:10: fatal error: atcoder/all: No such file or directory 8 | #include <atcoder/all> | ^~~~~~~~~~~~~ compilation terminated.
s663284812
p04020
C++
ERROR: type should be string, got "https://atcoder.jp/contests/agc003/submit?taskScreenName=#include <bits/stdc++.h>\nusing namespace std;\nusing ll = long long;\nusing P = pair<int,int>;\n#define rep(i,s,n) for(int i = s; i < (int)(n); i++)\n\nint main() {\n int n;\n cin >> n;\n ll ans = 0;\n vector<bool>o(n);\n rep(i,0,n){\n int a;\n cin >> a;\n ans += a/2;\n if(a%2 == 1) o[i] = 1;\n if(i > 0){\n if(o[i-1] && o[i]){\n ans++;\n o[i] = 0;\n o[i-1] = 0;\n }\n }\n }\n cout << ans << endl;\n}"
a.cc:1:1: error: 'https' does not name a type 1 | https://atcoder.jp/contests/agc003/submit?taskScreenName=#include <bits/stdc++.h> | ^~~~~ a.cc:4:11: error: 'pair' does not name a type 4 | using P = pair<int,int>; | ^~~~ a.cc: In function 'int main()': a.cc:9:3: error: 'cin' was not declared in this scope 9 | cin >> n; | ^~~ a.cc:11:3: error: 'vector' was not declared in this scope 11 | vector<bool>o(n); | ^~~~~~ a.cc:11:10: error: expected primary-expression before 'bool' 11 | vector<bool>o(n); | ^~~~ a.cc:16:18: error: 'o' was not declared in this scope 16 | if(a%2 == 1) o[i] = 1; | ^ a.cc:18:10: error: 'o' was not declared in this scope 18 | if(o[i-1] && o[i]){ | ^ a.cc:25:3: error: 'cout' was not declared in this scope 25 | cout << ans << endl; | ^~~~ a.cc:25:18: error: 'endl' was not declared in this scope 25 | cout << ans << endl; | ^~~~
s274201234
p04020
C++
#include <bits/stdc++.h> using namespace std; using ll = long long; using P = pair<int, int>; using vint = vector<int>; using vvint = vector<vint>; using vll = vector<ll>; using vvll = vector<vll>; using vchar = vector<char>; using vvchar = vector<vchar>; using vp = vector<P>; using vpp = vector<pair<P, P>>; using vvp = vector<vp>; #define rep(i, n) for (int i = 0; i < n; ++i) #pragma region Debug istream &operator>>(istream &is, P &a) { return is >> a.first >> a.second; } ostream &operator<<(ostream &os, const P &a) { return os << "(" << a.first << "," << a.second << ")"; } template <typename T> void view(const std::vector<T> &v) { #ifndef ONLINE_JUDGE for (const auto &e : v) { std::cout << e << " "; } std::cout << std::endl; #endif } template <typename T> void view(const std::vector<std::vector<T>> &vv) { for (const auto &v : vv) { view(v); } } #pragma endregion int main() { int n; cin >> n; vll a(n); rep(i, n) cin >> a[i]; ll ans = 0; ll leftover = 0; rep(i, n) { ans += (a[i] + leftover) / 2; leftover = a[i] - ((a[i] + leftover) / 2) * 2; leftover = max(0, leftover); } cout << ans << endl; return 0; }
a.cc: In function 'int main()': a.cc:58:23: error: no matching function for call to 'max(int, ll&)' 58 | leftover = max(0, leftover); | ~~~^~~~~~~~~~~~~ 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:58:23: note: deduced conflicting types for parameter 'const _Tp' ('int' and 'll' {aka 'long long int'}) 58 | leftover = max(0, leftover); | ~~~^~~~~~~~~~~~~ /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:58:23: note: mismatched types 'std::initializer_list<_Tp>' and 'int' 58 | leftover = max(0, leftover); | ~~~^~~~~~~~~~~~~
s114451709
p04020
C++
#include <bits/stdc++.h> #define pb push_back #define ll long long #define si short int #define speed ios_base::sync_with_stdio(0),cin.tie(0),cout.tie(0) #define pill pair<ll,ll> #define f first #define s second #define pilc pair<ll,char> #define all(a) (a).begin(),(a).end() #define rep(s,e,step) for(int i = (s); i < (e) ; i += step) #define vrep(s,e,step) for(int j = (s); j < (e) ; j += step) #define ex exit(0) #define sz(a) (a).size() using namespace std; const ll N = 4e5; const ll big = 1e18; const ll block = 800; const ll mod = 1e6; ll n; ll a[N], b[N], dp[N], ans; int main() { speed; cin >> n; for(int i = 2; i <= n + 1; i++) cin >> a[i]; for(int i = 2; i <= n + 1; i++) { ans += a[i] / 2; a[i] % = 2; if(a[i + 1] && a[i]) ans++, ans[i + 1]--; } cout << ans << '\n'; } /* 4 1 2 3 4 */
a.cc: In function 'int main()': a.cc:33:24: error: expected primary-expression before '=' token 33 | a[i] % = 2; | ^ a.cc:35:35: error: invalid types 'long long int[int]' for array subscript 35 | ans++, ans[i + 1]--; | ^
s072025188
p04020
C++
#include <bits/stdc++.h> using namespace std; #define int long long vector<int> a; int n; signed main() { cin >> n; int suma = 0; int ans = 0; for(int i = 0;i < n;i++){ int j;cin >> j; if(j == 0){ ans += suma/2; suma = 0; continue; } suma += j; } ans += suma/2; cout << ans << endl; return 0;
a.cc: In function 'int main()': a.cc:24:18: error: expected '}' at end of input 24 | return 0; | ^ a.cc:9:15: note: to match this '{' 9 | signed main() { | ^
s996011416
p04020
C++
#include <bits/stdc++.h> using namespace std; #define int long long vector<int> a; int n; int ans = 0; signed main() { cin >> n; int suma = 0; int ans = 0; for(int i = 0;i < n;i++){ int j;cin >> j; if(j == 0){ ans += suma/2; suma = 0; continue; } suma += j; } ans += suma/2; cout << ans << endl; return 0;
a.cc: In function 'int main()': a.cc:25:18: error: expected '}' at end of input 25 | return 0; | ^ a.cc:10:15: note: to match this '{' 10 | signed main() { | ^
s357414608
p04020
C++
#include <bits/stdc++.h> using namespace std; int main(){ int N; cin>>N; long long ans=0; int A[N+1]; int B[N+1]; for(int i=1;i<=N;i++){ cin>>A[i]; } for(int i=1;i<=N;i++){ B[i]=0; } for(int i=1;i<=N;i++){ ans+=A[i]/2; if(A[i]%2 ==1){ B[i]=1; } } for(int i=1;i<N;i++){ if(B[i]==1 && B[i+1]==1){ ans++; B[i+1]=0; } } cout<<setprecisitn(20)<<ans<<endl; return 0; }
a.cc: In function 'int main()': a.cc:29:9: error: 'setprecisitn' was not declared in this scope 29 | cout<<setprecisitn(20)<<ans<<endl; | ^~~~~~~~~~~~
s366008458
p04020
C++
using LL = long long; int main() { int N; cin >> N; vector<LL> A(N + 1, 0); for (int i = 0; i < N; i++) cin >> A[i]; LL ans = 0; for (int i = 0; i < N; i++) { ans += A[i] / 2; A[i] %= 2; if (A[i] & (A[i + 1] > 0)) { ans++; A[i + 1]--; } } cout << ans; return 0; }
a.cc: In function 'int main()': a.cc:6:3: error: 'cin' was not declared in this scope 6 | cin >> N; | ^~~ a.cc:8:3: error: 'vector' was not declared in this scope 8 | vector<LL> A(N + 1, 0); | ^~~~~~ a.cc:8:12: error: expected primary-expression before '>' token 8 | vector<LL> A(N + 1, 0); | ^ a.cc:8:14: error: 'A' was not declared in this scope 8 | vector<LL> A(N + 1, 0); | ^ a.cc:21:3: error: 'cout' was not declared in this scope 21 | cout << ans; | ^~~~
s974093296
p04020
C++
#include <bits/stdc++.h> using namespace std; struct edge { int to; // 辺の行き先 int weight; // 辺の重み edge(int t, int w) : to(t), weight(w) { } }; using Graph = vector<vector<int>>; using dou =long double; string Yes="Yes"; string YES="YES"; string NO="NO"; string No="No"; template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; } template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; } #define rep(i, n) for(int i = 0; i < (int)(n); i++) #define brep(n) for(int bit=0;bit<(1<<n);bit++) #define erep(i,container) for (auto i : container) #define irep(i, n) for(int i = n-1; i >= (int)0; i--) #define rrep(i,m,n) for(int i = m; i < (int)(n); i++) #define reprep(i,j,h,w) rep(i,h)rep(j,w) #define all(x) (x).begin(),(x).end() #define aall(x,n) (x).begin(),(x).begin()+(n) #define VEC(type,name,n) std::vector<type> name(n);rep(i,n)std::cin >> name[i]; #define pb push_back #define pf push_front #define lb lower_bound #define ub upper_bound #define res resize #define as assign #define fi first #define se second #define itn int #define mp make_pair #define sum(a) accumulate(all(a),0ll) #define keta fixed<<setprecision #define vvector(name,typ,m,n,a)vector<vector<typ> > name(m,vector<typ> (n,a)) #define vvvector(name,t,l,m,n,a) vector<vector<vector<t> > > name(l, vector<vector<t> >(m, vector<t>(n,a))); #define vvvvector(name,t,k,l,m,n,a) vector<vector<vector<vector<t> > > > name(k,vector<vector<vector<t> > >(l, vector<vector<t> >(m, vector<t>(n,a)) )); typedef long long ll; const int INF = 2000000000; const ll INF64 = 922337203685477580ll; const int mod = 1000000007ll; const ll MOD = 1000000007LL; int main(){ int n; std::cin >> n; VEC(ll,a,n); ll ans=a[0]/2; a[0]%=2; rrep(i,1,n){ //if(a[i-1])a[i]++; (if(a[i]!=0))a[i]+=a[i-1]; ans+=a[i]/2; a[i]%=2; } std::cout << ans << std::endl; }
a.cc: In function 'int main()': a.cc:56:10: error: expected primary-expression before 'if' 56 | (if(a[i]!=0))a[i]+=a[i-1]; | ^~ a.cc:56:10: error: expected ')' before 'if' 56 | (if(a[i]!=0))a[i]+=a[i-1]; | ~^~ | )
s376911756
p04020
C++
#include<iostream> #include<string> #include<vector> #include<iomanip> #include<algorithm> #include<queue> #include<stack> #include<list> #include<map> #include<deque> #include<math.h> using namespace std; #define ll long long int main(){ ll N,A; cin >> N; ll i; ll ans=0; ll t=0; for(i=0;i<N;i++){ cin >> A; ans+=(A+t)/2; if(A!=0)t=(A+t)%2;else } cout << ans; return 0; }
a.cc: In function 'int main()': a.cc:24:5: error: expected primary-expression before '}' token 24 | } | ^
s782868895
p04020
C++
//既読をつける目的
/usr/bin/ld: /usr/lib/gcc/x86_64-linux-gnu/14/../../../x86_64-linux-gnu/Scrt1.o: in function `_start': (.text+0x17): undefined reference to `main' collect2: error: ld returned 1 exit status
s254887512
p04020
C++
#include<iostream> #include<stdio.h> //#include <bits/stdc++.h> #include<vector> #include<float.h> #include<iomanip> #include<algorithm> #include<string> #include<cstring> #include<math.h> #include<cmath> #include<sstream> #include<set> #include<map> #include<queue> #include <cassert> #include <cmath> #include<cstdint> #define INF 1e9 #define rep(i,n)for(int i=0;(i)<(int)(n);i++) #define REP(i,a,b)for(int i=(int)(a);(i)<=(int)(b);i++) #define VEC(type, c, n) std::vector<type> c(n);for(auto& i:c)std::cin>>i; #define vec(type,n) vector<type>(n) #define vvec(m,n) vector<vector<int>> (int(m),vector<int>(n)) using namespace std; using ll = long long; using Graph = vector<vector<int>>; using P = pair<int,int>; ll cmb(ll n,int a,int mod){ ll res = 1; rep(i,a){ res *= (n-i); res /= (i+1); res %= mod; } return res; } ll mod_pow(ll x,ll n,ll mod){ ll res = 1; while(n>0){ if(n&1)res = res*x%mod; x = x*x%mod; n >>= 1; } return res; } int main(){ int n;cin>>n; VEC(ll,a,n); int res = 0; auto f = vec(int,n); rep(i,n){ if(a[i]%2==1)f[i] = 1; res += a[i]/2; } rep(i,n-1){ if(f[i] == 1 && f[i+1] == 1){ res++; i++ } } cout<<res; }
a.cc: In function 'int main()': a.cc:64:18: error: expected ';' before '}' token 64 | i++ | ^ | ; 65 | } | ~
s082095559
p04020
C++
#include <bits/stdc++.h> using namespace std; #define sz size #define pb push_back #define int long long const int N = 1e5 + 123; int n, a[N], sum, ans; int main() { //freopen("input.txt", "r", stdin); cin >> n; for(int i = 1; i <= n; ++i) { cin >> a[i]; sum += a[i]; if(a[i] == 0) { ans += (sum / 2); sum = 0; } } ans += (sum / 2); cout << ans; }
cc1plus: error: '::main' must return 'int'
s649434027
p04020
C++
#include<bits/stdc++.h> using namespace std; int a[100005],b[100005]; int main() { int n,s=0; cin>>n; for(int i=0;i<n;i++) { cin>>a[i]; b[i]=a[i]; s+=a[i]/2; a[i]=a[i]%2; } for(int i=1;i<n-1;i++) { if(a[i]==1) { if(a[i+1]==1) { s++; a[i]--; a[i+1]--; } if(a[i-1]==1) { s++; a[i]--; a[i-1]--; } } } for(i=0;i<n;i++) { a[n]+=a[i]; } if(a[i]<1) { cout<<s; return 0; } else { s=0; for(int i=1;i<n-1;i++) { if(b[i]>=1) { if(b[i+1]>=1) { s++; b[i]--; b[i+1]--; } if(b[i-1]>=1) { s++; b[i]--; b[i-1]--; } } } cout<<s; return 0; }
a.cc: In function 'int main()': a.cc:33:13: error: 'i' was not declared in this scope 33 | for(i=0;i<n;i++) | ^ a.cc:37:14: error: 'i' was not declared in this scope 37 | if(a[i]<1) | ^ a.cc:65:16: error: expected '}' at end of input 65 | } | ^ a.cc:5:1: note: to match this '{' 5 | { | ^
s625185514
p04020
C++
include<bits/stdc++.h> using namespace std; int main() { int n,a[100005]; bool vis[100005]; while(scanf("%d",&n)!=EOF) { long long ans=0; memset(vis,false,sizeof(vis)); for(int i=0; i<n; i++) { scanf("%d",&a[i]); if(a[i])vis[i]=true; ans+=a[i]/2; a[i]%=2; } for(int i=1; i<n; i++) { if(a[i]&&a[i-1]) { a[i]=0; a[i-1]=0; ans++; } else if(a[i]==0&&a[i-1]) if(vis[i]) a[i]++,a[i-1]--; } printf("%lld\n",ans); } return 0; }
a.cc:1:1: error: 'include' does not name a type 1 | include<bits/stdc++.h> | ^~~~~~~ a.cc: In function 'int main()': a.cc:7:11: error: 'scanf' was not declared in this scope 7 | while(scanf("%d",&n)!=EOF) | ^~~~~ a.cc:7:27: error: 'EOF' was not declared in this scope 7 | while(scanf("%d",&n)!=EOF) | ^~~ a.cc:1:1: note: 'EOF' is defined in header '<cstdio>'; this is probably fixable by adding '#include <cstdio>' +++ |+#include <cstdio> 1 | include<bits/stdc++.h> a.cc:10:9: error: 'memset' was not declared in this scope 10 | memset(vis,false,sizeof(vis)); | ^~~~~~ a.cc:1:1: note: 'memset' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>' +++ |+#include <cstring> 1 | include<bits/stdc++.h> a.cc:29:9: error: 'printf' was not declared in this scope 29 | printf("%lld\n",ans); | ^~~~~~ a.cc:29:9: note: 'printf' is defined in header '<cstdio>'; this is probably fixable by adding '#include <cstdio>'
s563563684
p04020
C++
#include<bits/stdc++.h> using namespace std; #define int long long int n; int a[100010]; signed main(){ cin>>n; rep(i,n)cin>>a[i]; int ans=a[0]/2,f=a[0]%2; for(int i=1;i<n;i++){ if(f&&a[i]){ a[i]--; ans++; } ans+=a[i]/2; f=a[i]%2; } cout<<ans; return 0; }
a.cc: In function 'int main()': a.cc:9:13: error: 'i' was not declared in this scope 9 | rep(i,n)cin>>a[i]; | ^ a.cc:9:9: error: 'rep' was not declared in this scope 9 | rep(i,n)cin>>a[i]; | ^~~
s976963777
p04020
C++
\#include<bits/stdc++.h> using namespace std; int n,a[100001],ans; int main() { cin>>n; for(int i=0;i<n;i++) cin>>a[i]; for(int i=0;i<n;i++) { ans+=a[i]/2; a[i]%=2; if(i<n-1&&a[i]&&a[i+1]) ans++,a[i]--,a[i+1]--; } cout<<ans; return 0; }
a.cc:1:1: error: stray '\' in program 1 | \#include<bits/stdc++.h> | ^ a.cc:1:2: error: stray '#' in program 1 | \#include<bits/stdc++.h> | ^ a.cc:1:3: error: 'include' does not name a type 1 | \#include<bits/stdc++.h> | ^~~~~~~ a.cc: In function 'int main()': a.cc:7:9: error: 'cin' was not declared in this scope 7 | cin>>n; | ^~~ a.cc:17:5: error: 'cout' was not declared in this scope 17 | cout<<ans; | ^~~~
s833956071
p04020
C++
#include<bits/stdc++.h> using namespace std; int A[i]; int main() { int N; cin>>N; long long ans=0; for(int i=0;i<N;i++) { cin>>A[i]; ans+=A[i]/2; A[i]%=2; if(i>0) if(A[i]==A[i-1]) ans+=A[i], A[i]=0; } cout<<ans<<endl; return 0; }
a.cc:3:7: error: 'i' was not declared in this scope 3 | int A[i]; | ^ a.cc: In function 'int main()': a.cc:11:22: error: 'A' was not declared in this scope 11 | cin>>A[i]; | ^
s577567627
p04020
C++
#include<bits/stdc=+>h> using namespace std; #define N 100010 #define ll long long int n,a[N]; ll ans; int main(){ ios::sync_with_stdio(false); cin>>n; for(int i=1;i<=n;i++) cin>>a[i]; for(int i=1;i<=n;i++){ ans+=a[i]/2; a[i]%=2; if(i<n&&a[i]&&a[i+1]){ ans++; a[i]--; a[i+1]--; } } cout<<ans; return 0; }
a.cc:1:23: warning: extra tokens at end of #include directive 1 | #include<bits/stdc=+>h> | ^ a.cc:1:9: fatal error: bits/stdc=+>: No such file or directory 1 | #include<bits/stdc=+>h> | ^~~~~~~~~~~~~~ compilation terminated.
s824760559
p04020
C++
#include <iostream> #include <vector> using namespace std; int main() { int n; cin >> n; int a[100010]; int ans =0; for(int i=0;i<n;i++){ cin >> a[i] ; } for(int i=0;i<n;i++){ ans += a[i]/2; if(a[i]%2 != 0 && a[i+1] != 0){ ans++; a[i+1]--; } cout << ans << endl; }
a.cc: In function 'int main()': a.cc:29:2: error: expected '}' at end of input 29 | } | ^ a.cc:5:12: note: to match this '{' 5 | int main() { | ^
s508333189
p04020
C++
#include <iostream> #include <vector> using namespace std; int main() { int n; cin >> n; int a[100010]; for(int i=0;i<n;i++){ cin >> a[i] ; ans += a[i]/2; } cout << ans << endl; }
a.cc: In function 'int main()': a.cc:12:5: error: 'ans' was not declared in this scope; did you mean 'abs'? 12 | ans += a[i]/2; | ^~~ | abs a.cc:16:11: error: 'ans' was not declared in this scope; did you mean 'abs'? 16 | cout << ans << endl; | ^~~ | abs
s774008172
p04020
Java
import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int n = sc.nextInt(); long[] A = new long[n]; for (int i = 0; i < n; ++i) { A[i] = sc.nextLong(); } long res = 0L for (int i = 0; i < n; ++i) { res += A[i] / 2; A[i] %= 2L; if (A[i] > 0 && i + 1 < n && A[i + 1] > 0) { A[i + 1]--; A[i]--; res++; } } System.out.println(res); } }
Main.java:12: error: ';' expected long res = 0L ^ 1 error
s955254152
p04020
C++
#include <iostream> using namespace std; const int maxn = 100100100; typedef long long int ll; int n; ll int a[maxn]; ll sum = 0; int main(){ cin >> n; for(int i = 1; i <= n; i++){ cin >> a[i]; } for(int i = 1; i <= n - 1; i = i + 2){ if(a[i] >= a[i + 1]){ sum += a[i + 1]; a[i] -= a[i + 1]; a[i + 1] = 0; } else { sum += a[i]; a[i + 1] -= a[i]; a[i] = 0; } } for(int i = 1; i <= n; i++){ if (a[i] % 2 == 0){ sum += a[i] / 2; } else { sum += (a[i] - 1) / 2; } } cout << sum << endl; return 0; }
a.cc:6:1: error: two or more data types in declaration of 'a' 6 | ll int a[maxn]; | ^~ a.cc: In function 'int main()': a.cc:11:16: error: 'a' was not declared in this scope 11 | cin >> a[i]; | ^ a.cc:14:12: error: 'a' was not declared in this scope 14 | if(a[i] >= a[i + 1]){ | ^ a.cc:26:13: error: 'a' was not declared in this scope 26 | if (a[i] % 2 == 0){ | ^
s541539419
p04020
C++
#include <iostream> #include <cstdio> #include <cstdlib> #include <cstring> #include <algorithm> #include <string> #include <sstream> #include <complex> #include <vector> #include <list> #include <queue> #include <deque> #include <stack> #include <map> #include <set> #include <climits> #include <random> #include <iomanip> using namespace std; using P = pair<long, long>; typedef long long int ll; #define EPS (1e-7) #define INF (1e9) #define PI (acos(-1)) #define fillInt(xs, x) \ for (int i = 0; i < (x); i++) \ scanf("%d", &xs[i]); #define fillLong(xs, x) \ for (int i = 0; i < (x); i++) \ scanf("%ld", &xs[i]); #define fillString(xs, x) \ for (int i = 0; i < (x); i++) \ cin >> xs[i]; #define sortv(xs) sort(xs.begin(), xs.end()) #define sortvinv(xs) sort(xs.begin(), xs.end(), std::greater<long>()) #define lbv(xs, x) lower_bound(xs.begin(), xs.end(), x) - xs.begin() #define ubv(xs, x) upper_bound(xs.begin(), xs.end(), x) - xs.begin() #define bs(xs, x) binary_search(xs.begin(), xs.end(), x) #define index_of(as, x) \ distance(as.begin(), lower_bound(as.begin(), as.end(), x)) #define rep(i,n) for(auto i=0; i<(n); i++) const int mod = 1000000007; int main() { cin.tie(0); ios::sync_with_stdio(false); int n; cin >> n; vector<long> a(n); fillLong(a, n); sortv(a, n); int res = 0; rep(i, n-1) { if (abs(a[i]-a[i+1]) <= 1) { res++; i++; } } cout << res << endl; }
a.cc:59:13: error: macro "sortv" passed 2 arguments, but takes just 1 59 | sortv(a, n); | ^ a.cc:38:9: note: macro "sortv" defined here 38 | #define sortv(xs) sort(xs.begin(), xs.end()) | ^~~~~ a.cc: In function 'int main()': a.cc:59:3: error: 'sortv' was not declared in this scope 59 | sortv(a, n); | ^~~~~
s554413649
p04020
C++
#include <bits/stdc++.h> using namespace std; int main(){ int N; cin >> N; vector<int> A(N+1); for(int i=0; i<N; i++){ cin >> A.at(i); } A.at(N)=0; int ans=0; for(int i=0; i<N; i++){ ans+= (A.at(i)+A.at(i+1))/2; A.at(i+1)-= (A.at(i)+A.at(i+1))/2*2-A.at(i)); } cout << ans << endl; }
a.cc: In function 'int main()': a.cc:15:48: error: expected ';' before ')' token 15 | A.at(i+1)-= (A.at(i)+A.at(i+1))/2*2-A.at(i)); | ^ | ;
s328463500
p04020
C++
#include<bits/stdc++.h> using namespace std; #define se second #define fi first #define ll long long #define ld long double #define pll pair<ll ,ll > #define pii pair<int, int> #define mod 1000000007 ll power(ll a,ll b){ ll res=1; while(b>0){ if(b%2!=0) res=(res*a); a=(a*a); b/=2; if(res>INT_MAX){ return INT_MAX; } } return res; } ll ncr(ll n,ll k){ if(k==0||k==n) return 1ll; if(k>n-k) k=n-k; ll pro=1; for(ll i=0;i<k;i++){ pro=(pro*(n-i))%mod; pro/=(i+1); } return (pro%mod); } vector<int> prime; void seive(){ vector<bool > isprime(101,true); for(int i=2;i*i<=100;i++){ if(isprime[i]){ for(int j=i*i;j<=100;j+=i){ isprime[j]=false; } } } for(int i=2;i<=100;i++){ if(isprime[i]) prime.push_back(i); } } int main(void){ ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL); ll n; cin>>n; vector<ll> arr(n); ll sum=0; for(int i=0;i<n;i++){ cin>>arr[i]; } for(int i=0;i<n;i++){ ll x=0; while(i<n && arr[i]!=0){ x+=arr[i] i++; } sum+=x/2; } return 0; }
a.cc: In function 'int main()': a.cc:60:22: error: expected ';' before 'i' 60 | x+=arr[i] | ^ | ; 61 | i++; | ~
s959814145
p04020
C++
#include <iostream> using namespace std; int main() { int n; cin >> n; long long result = , sum = 0; for (int i = 0, a; i < n; i++) { cin >> a; if (a == 0) { result += sum / 2; sum = 0; } else { sum += a; } } result += sum / 2; cout << result; return 0; }
a.cc: In function 'int main()': a.cc:7:24: error: expected primary-expression before ',' token 7 | long long result = , sum = 0; | ^ a.cc:11:23: error: 'sum' was not declared in this scope 11 | result += sum / 2; | ^~~ a.cc:14:13: error: 'sum' was not declared in this scope 14 | sum += a; | ^~~ a.cc:17:15: error: 'sum' was not declared in this scope 17 | result += sum / 2; | ^~~
s997963046
p04020
C++
#include <bits/stdc++.h> using namespace std; int n,a[1000000005],ans=0,duishu; void dui(int x) { int left=n; int min=n; duishu=0; for(int j=x+1;j<n;j++) { if(a[x]-a[j]>=-1 && a[x]-a[j]<=1) { duishu++; left=left-2; } if(left<min) { ans=duishu; } duishu=0; } } int main() { int max=0; cin>>n; for(int i=0;i<n;i++) { scanf("%d",&a[i]); } for(int i=0;i<n;i++) { dui(i); if(ans>max) { max=ans; } } cout<<max; return 0; }
/tmp/ccoTCRJs.o: in function `dui(int)': a.cc:(.text+0x1b): relocation truncated to fit: R_X86_64_PC32 against symbol `duishu' defined in .bss section in /tmp/ccoTCRJs.o a.cc:(.text+0x9d): relocation truncated to fit: R_X86_64_PC32 against symbol `duishu' defined in .bss section in /tmp/ccoTCRJs.o a.cc:(.text+0xa6): relocation truncated to fit: R_X86_64_PC32 against symbol `duishu' defined in .bss section in /tmp/ccoTCRJs.o a.cc:(.text+0xb8): relocation truncated to fit: R_X86_64_PC32 against symbol `duishu' defined in .bss section in /tmp/ccoTCRJs.o a.cc:(.text+0xbe): relocation truncated to fit: R_X86_64_PC32 against symbol `ans' defined in .bss section in /tmp/ccoTCRJs.o a.cc:(.text+0xc4): relocation truncated to fit: R_X86_64_PC32 against symbol `duishu' defined in .bss section in /tmp/ccoTCRJs.o /tmp/ccoTCRJs.o: in function `main': a.cc:(.text+0x166): relocation truncated to fit: R_X86_64_PC32 against symbol `ans' defined in .bss section in /tmp/ccoTCRJs.o a.cc:(.text+0x171): relocation truncated to fit: R_X86_64_PC32 against symbol `ans' defined in .bss section in /tmp/ccoTCRJs.o collect2: error: ld returned 1 exit status
s555473697
p04020
C++
/* it was worth becoming a chemist */ #include <bits/stdc++.h> using namespace std; typedef long long ll; typedef double db; typedef long double ld; typedef unsigned int uni; typedef unsigned long long unll; typedef pair<int, int> pii; typedef pair<long long, long long> pll; typedef pair<long long, int> pli; typedef pair<int, long long> pil; typedef vector<int> vi; typedef vector<long long> vll; #define mp make_pair #define pb push_back #define all(x) (x).begin(), (x).end() #define sz(x) (int)x.size() #define NAME "puts" #define F first #define S second const ll INF = 1e18; const int inf = 1e9; const int mod = 1e9 + 7; const db EPS = (db) 1e-9; const db pi = acos(-1.0); const int MAXN = 1e5 + 5; int n; ll a[MAXN]; ll dp[MAXN]; int main() { cin >> n; for (int i = 1; i <= n; i++) { cin >> a[i]; } dp[1] = (a[i] >> 1ll); for (int i = 2; i <= n; i++) { dp[i] = max(dp[i - 1] + (a[i] >> 1ll), dp[i - 2] + min(a[i], a[i - 1])); } cout << dp[n]; return 0; }
a.cc: In function 'int main()': a.cc:44:16: error: 'i' was not declared in this scope; did you mean 'vi'? 44 | dp[1] = (a[i] >> 1ll); | ^ | vi
s778579646
p04020
C++
8 2 0 1 6 0 8 2 1
a.cc:1:1: error: expected unqualified-id before numeric constant 1 | 8 | ^
s555792805
p04020
C++
#include <bits/stdc++.h> using namespace std; int main() { int N; cin >> N; bool odd=false; long sum=0; for(int i=0;i<N;i++){ int a; cin >> a; if(odd){ sum++; a--: } sum+=a/2; if(a%2==1)odd=true; else odd=false; } cout << sum; }
a.cc: In function 'int main()': a.cc:14:10: error: expected ';' before ':' token 14 | a--: | ^ | ;
s325827163
p04020
C++
#include <bits/stdc++.h> #define rep(i,n) for(int i=0; i<(n); i++) #define int long long #define mod 1000000007 #define F first #define S second #define P pair<long long,long long> #define all(a) a.begin(),a.end() #define INF 1000000000000000000 using namespace std; int main(void){ int n;cin>>n;vector<int>v(n); int ans=0; int x;rep(i,n){cin>>x;ans+=x/2;v[i]=x%2;} rep(i,n-1){ if(v[i]==1 && v[i+1]==1){ans++;i++;} } cout<<ans<<endl; }
cc1plus: error: '::main' must return 'int'
s735158843
p04020
C++
#include <bits/stdc++.h> #define rep(i,n) for(int i=0; i<(n); i++) #define int long long #define mod 1000000007 #define F first #define S second #define P pair<long long,long long> #define all(a) a.begin(),a.end() #define INF 1000000000000000000 using namespace std; int main(void){ int n;vector<int>v(n); int ans=0; int x;rep(i,n){cin>>x;ans+=x/2;v[i]=x%2;} rep(i,n-1){ if(v[i]==1 && v[i+1]==1){ans++;i++;} } cout<<ans<<endl; }
cc1plus: error: '::main' must return 'int'
s085757891
p04020
C++
#include <stdio.h> #include <algorithm> #include <iostream> #include <limits.h> #include <math.h> #include <queue> #include <set> #include <stdlib.h> #include <string> #include <vector> #include <cstdio> #include <iomanip> #define ll long long #define rep2(i,a,b) for(int i=a;i<=b;i++) #define rep(i,n) for(int i=0;i<n;i++) #define rep3(i,a,b) for(int i=a;i>=b;i--) #define REP(e,v) for(auto e:v) #define queint queue<int> #define pii pair<int,int> #define pll pair<ll,ll> #define pq priority_queue<int>//大きい順 #define pqg priority_queue<int,vec,greater<int>>//小さい順 #define pb push_back #define vec vector<int> #define vecvec vector<vector<int>> #define vecll vector<ll> #define vecvecll vector<vector<ll>> #define bs binary_search #define All(c) (c).begin(),(c).end() #define mp make_pair using namespace std; int in(){int x;scanf("%d",&x);return x;} string stin(){string s;cin>>s;return s;} ll lin(){ll x;scanf("%lld",&x);return x;} int main(){ int n=in(); vec a(n); rep(i,n)a[i]=in(); vector<vec> dp(2,vecll(n)); dp[0][0]=a[0]/2; dp[1][0]=(a[0]-1)/2; rep2(i,1,n-1){ dp[0][i]=a[i-1]>0?max(dp[0][i-1]+a[i]/2,dp[1][i-1]+(a[i]+1)/2):max(dp[0][i-1]+a[i]/2,dp[1][i-1]+a[i]/2); dp[1][i]=a[i-1]>0?max(dp[0][i-1]+(a[i]-1)/2,dp[1][i-1]+a[i]/2):max(dp[0][i-1]+(a[i]-1)/2,dp[1][i-1]+(a[i]-1)/2); } cout<<max(dp[0][n-1],dp[1][n-1])<<endl; }
a.cc: In function 'int main()': a.cc:39:30: error: no matching function for call to 'std::vector<std::vector<int> >::vector(int, std::vector<long long int>)' 39 | vector<vec> dp(2,vecll(n)); | ^ In file included from /usr/include/c++/14/vector:66, from /usr/include/c++/14/queue:63, from a.cc:6: /usr/include/c++/14/bits/stl_vector.h:707:9: note: candidate: 'template<class _InputIterator, class> std::vector<_Tp, _Alloc>::vector(_InputIterator, _InputIterator, const allocator_type&) [with <template-parameter-2-2> = _InputIterator; _Tp = std::vector<int>; _Alloc = std::allocator<std::vector<int> >]' 707 | vector(_InputIterator __first, _InputIterator __last, | ^~~~~~ /usr/include/c++/14/bits/stl_vector.h:707:9: note: template argument deduction/substitution failed: a.cc:39:30: note: deduced conflicting types for parameter '_InputIterator' ('int' and 'std::vector<long long int>') 39 | vector<vec> dp(2,vecll(n)); | ^ /usr/include/c++/14/bits/stl_vector.h:678:7: note: candidate: 'std::vector<_Tp, _Alloc>::vector(std::initializer_list<_Tp>, const allocator_type&) [with _Tp = std::vector<int>; _Alloc = std::allocator<std::vector<int> >; allocator_type = std::allocator<std::vector<int> >]' 678 | vector(initializer_list<value_type> __l, | ^~~~~~ /usr/include/c++/14/bits/stl_vector.h:678:43: note: no known conversion for argument 1 from 'int' to 'std::initializer_list<std::vector<int> >' 678 | vector(initializer_list<value_type> __l, | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~ /usr/include/c++/14/bits/stl_vector.h:659:7: note: candidate: 'std::vector<_Tp, _Alloc>::vector(std::vector<_Tp, _Alloc>&&, std::__type_identity_t<_Alloc>&) [with _Tp = std::vector<int>; _Alloc = std::allocator<std::vector<int> >; std::__type_identity_t<_Alloc> = std::allocator<std::vector<int> >]' 659 | vector(vector&& __rv, const __type_identity_t<allocator_type>& __m) | ^~~~~~ /usr/include/c++/14/bits/stl_vector.h:659:23: note: no known conversion for argument 1 from 'int' to 'std::vector<std::vector<int> >&&' 659 | vector(vector&& __rv, const __type_identity_t<allocator_type>& __m) | ~~~~~~~~~^~~~ /usr/include/c++/14/bits/stl_vector.h:640:7: note: candidate: 'std::vector<_Tp, _Alloc>::vector(std::vector<_Tp, _Alloc>&&, const allocator_type&, std::false_type) [with _Tp = std::vector<int>; _Alloc = std::allocator<std::vector<int> >; allocator_type = std::allocator<std::vector<int> >; std::false_type = std::false_type]' 640 | vector(vector&& __rv, const allocator_type& __m, false_type) | ^~~~~~ /usr/include/c++/14/bits/stl_vector.h:640:7: note: candidate expects 3 arguments, 2 provided /usr/include/c++/14/bits/stl_vector.h:635:7: note: candidate: 'std::vector<_Tp, _Alloc>::vector(std::vector<_Tp, _Alloc>&&, const allocator_type&, std::true_type) [with _Tp = std::vector<int>; _Alloc = std::allocator<std::vector<int> >; allocator_type = std::allocator<std::vector<int> >; std::true_type = std::true_type]' 635 | vector(vector&& __rv, const allocator_type& __m, true_type) noexcept | ^~~~~~ /usr/include/c++/14/bits/stl_vector.h:635:7: note: candidate expects 3 arguments, 2 provided /usr/include/c++/14/bits/stl_vector.h:624:7: note: candidate: 'std::vector<_Tp, _Alloc>::vector(const std::vector<_Tp, _Alloc>&, std::__type_identity_t<_Alloc>&) [with _Tp = std::vector<int>; _Alloc = std::allocator<std::vector<int> >; std::__type_identity_t<_Alloc> = std::allocator<std::vector<int> >]' 624 | vector(const vector& __x, const __type_identity_t<allocator_type>& __a) | ^~~~~~ /usr/include/c++/14/bits/stl_vector.h:624:28: note: no known conversion for argument 1 from 'int' to 'const std::vector<std::vector<int> >&' 624 | vector(const vector& __x, const __type_identity_t<allocator_type>& __a) | ~~~~~~~~~~~~~~^~~ /usr/include/c++/14/bits/stl_vector.h:620:7: note: candidate: 'std::vector<_Tp, _Alloc>::vector(std::vector<_Tp, _Alloc>&&) [with _Tp = std::vector<int>; _Alloc = std::allocator<std::vector<int> >]' 620 | vector(vector&&) noexcept = default; | ^~~~~~ /usr/include/c++/14/bits/stl_vector.h:620:7: note: candidate expects 1 argument, 2 provided /usr/include/c++/14/bits/stl_vector.h:601:7: note: candidate: 'std::vector<_Tp, _Alloc>::vector(const std::vector<_Tp, _Alloc>&) [with _Tp = std::vector<int>; _Alloc = std::allocator<std::vector<int> >]' 601 | vector(const vector& __x) | ^~~~~~ /usr/include/c++/14/bits/stl_vector.h:601:7: note: candidate expects 1 argument, 2 provided /usr/include/c++/14/bits/stl_vector.h:569:7: note: candidate: 'std::vector<_Tp, _Alloc>::vector(size_type, const value_type&, const allocator_type&) [with _Tp = std::vector<int>; _Alloc = std::allocator<std::vector<int> >; size_type = long unsigned int; value_type = std::vector<int>; allocator_type = std::allocator<std::vector<int> >]' 569 | vector(size_type __n, const value_type& __value, | ^~~~~~ /usr/include/c++/14/bits/stl_vector.h:569:47: note: no known conversion for argument 2 from 'std::vector<long long int>' to 'const std::vector<std::vector<int> >::value_type&' {aka 'const std::vector<int>&'} 569 | vector(size_type __n, const value_type& __value, | ~~~~~~~~~~~~~~~~~~^~~~~~~ /usr/include/c++/14/bits/stl_vector.h:556:7: note: candidate: 'std::vector<_Tp, _Alloc>::vector(size_type, const allocator_type&) [with _Tp = std::vector<int>; _Alloc = std::allocator<std::vector<int> >; size_type = long unsigned int; allocator_type = std::allocator<std::vector<int> >]' 556 | vector(size_type __n, const allocator_type& __a = allocator_type()) | ^~~~~~ /usr/include/c++/14/bits/stl_vector.h:556:51: note: no known conversion for argument 2 from 'std::vector<long long int>' to 'const std::vector<std::vector<int> >::allocator_type&' {aka 'const std::allocator<std::vector<int> >&'} 556 | vector(size_type __n, const allocator_type& __a = allocator_type()) | ~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~ /usr/include/c++/14/bits/stl_vector.h:542:7: note: candidate: 'std::vector<_Tp, _Alloc>::vector(const allocator_type&) [with _Tp = std::vector<int>; _Alloc = std::allocator<std::vector<int> >; allocator_type = std::allocator<std::vector<int> >]' 542 | vector(const allocator_type& __a) _GLIBCXX_NOEXCEPT | ^~~~~~ /usr/include/c++/14/bits/stl_vector.h:542:7: note: candidate expects 1 argument, 2 provided /usr/include/c++/14/bits/stl_vector.h:531:7: note: candidate: 'std::vector<_Tp, _Alloc>::vector() [with _Tp = std::vector<int>; _Alloc = std::allocator<std::vector<int> >]' 531 | vector() = default; | ^~~~~~ /usr/include/c++/14/bits/stl_vector.h:531:7: note: candidate expects 0 arguments, 2 provided
s338607480
p04020
C++
#include <bits/stdc++.h> #define REP(i, n) for(int i = 0;i < n;i++) #define SORT(v, n) sort(v, v+n); #define VSORT(v) sort(v.begin(), v.end()) #define VRSORT(v) sort(v.rbegin(), v.rend())//vectorの降順ソート #define ll long long #define pb(a) push_back(a) #define INF 1000000000 #define LINF 1e18 #define MOD 1000000007 using namespace std; typedef pair<int, int> P; typedef pair<ll, ll> LP; typedef pair<int, P> PP; typedef pair<ll, LP> LPP; typedef vector<unsigned int>vec; typedef vector<vec> mat; //typedef tuple<ll, ll, ll> T; template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; } template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; } int dy[]={0, 0, 1, -1, 0}; int dx[]={1, -1, 0, 0, 0}; int main(){ cin.tie(0); ios::sync_with_stdio(false); int n;cin>>n; vector<ll> a(n+1); REP(i,n){ cin>>a[i]; } a[n]=0; ll ans=0; REP(i,n){ ans+=a[i]/2; a[i]%=2; if(A[i]>0&&A[i+1]>0){ ++ans; --a[i]; --a[i+1]; } } cout<<ans<<endl; }
a.cc: In function 'int main()': a.cc:42:12: error: 'A' was not declared in this scope 42 | if(A[i]>0&&A[i+1]>0){ | ^
s404723465
p04020
C++
#include<bits/stdc++.h> using namespace std; define int long long signed main(){ int n;cin>>n; vector<int>a(n); for(auto&& w:a)cin>>w; int sm=0,cnt=0; for(int i=0;i<n;i++){ sm+=a[i]/2; } for(int i=0;i<n;i++){ if(a[i]%2==1)cnt++; else {sm+=cnt/2;cnt=0;} } if(cnt>0)sm+=cnt/2; cout<<sm<<endl; }
a.cc:3:1: error: 'define' does not name a type 3 | define int long long | ^~~~~~
s672457099
p04020
C++
#include <bits/stdc++.h> #define ALL(v) v.begin(), v.end() #define rep(i, n) for(int i = 0; i < (int)(n); i++) #define rep1(i, n) for(int i = 1; i <= (int)(n); i++) using namespace std; typedef long long ll; int main(){ int n; cin>>n; int val[n]; rep(i, n){ cin>>val[i];} sort(val,val+n,grater<int>()); ll cnt=0; rep(i, n){ cnt+=val[i]/2; val[i]=val[i]%2;} for(int i=1;i<n;i++){ if(val[i]==1&&val[i-1]==1){ cnt++; val[i]=0; val[i-1]=0; } } cout<<cnt<<endl; }
a.cc: In function 'int main()': a.cc:15:18: error: 'grater' was not declared in this scope 15 | sort(val,val+n,grater<int>()); | ^~~~~~ a.cc:15:25: error: expected primary-expression before 'int' 15 | sort(val,val+n,grater<int>()); | ^~~
s206538807
p04020
C++
#include <algorithm> #include <chrono> #include <climits> #include <cmath> #include <deque> #include <iostream> #include <map> #include <memory> #include <numeric> #include <set> #include <string> #include <utility> #include <vector> using namespace std; using llong = long long; using ullong = unsigned long long; #ifndef __MACRO_H__ #define __MACRO_H__ #define all(collection) (collection).begin(), (collection).end() #define loop(i, times) for(llong i = 0; i < times; i++) #define rloop(i, times) for(llong i = times -1; 0 <= i; i--) std::chrono::system_clock::time_point start; void TimeStart(void) { start = std::chrono::system_clock::now(); } void TimeEnd(void) { auto time = std::chrono::system_clock::now() - start; auto msec = std::chrono::duration_cast<std::chrono::milliseconds>(time).count(); cerr << endl <<msec << " msec" << endl; } #endif class AGC003B { public: AGC003B() { cin >> n_; a_collection_.resize(n_); loop(i, n_) cin >> a_collection_[i]; ans_ = 0; } void Run(void) { loop(i, n_-1) { if (a_collection_[i+1] > 0) { a_collection_[i + 1] -= a_collection_[i] % 2; ans_+= a_collection_[i] % 2; } } ans_ += a_collection_[i] / 2; cout << ans_; } private: llong n_; llong ans_; vector<llong> a_collection_; }; int main(void) { AGC003B agc003b; agc003b.Run(); return 0; }
a.cc: In member function 'void AGC003B::Run()': a.cc:65:39: error: 'i' was not declared in this scope 65 | ans_ += a_collection_[i] / 2; | ^
s145115440
p04020
C++
#include <algorithm> #include <chrono> #include <climits> #include <cmath> #include <deque> #include <iostream> #include <map> #include <memory> #include <numeric> #include <set> #include <string> #include <utility> #include <vector> using namespace std; using llong = long long; using ullong = unsigned long long; #ifndef __MACRO_H__ #define __MACRO_H__ #define all(collection) (collection).begin(), (collection).end() #define loop(i, times) for(llong i = 0; i < times; i++) #define rloop(i, times) for(llong i = times -1; 0 <= i; i--) std::chrono::system_clock::time_point start; void TimeStart(void) { start = std::chrono::system_clock::now(); } void TimeEnd(void) { auto time = std::chrono::system_clock::now() - start; auto msec = std::chrono::duration_cast<std::chrono::milliseconds>(time).count(); cerr << endl <<msec << " msec" << endl; } #endif #pragma once #include "Macro.h" class AGC003B { public: AGC003B() { cin >> n_; a_collection_.resize(n_); loop(i, n_) cin >> a_collection_[i]; } void Run(void) { cout << max(FrontMethod(), ModMethod()); } private: llong FrontMethod(void) { llong ans = 0; loop(i, n_ - 1) { if (a_collection_[i] != 0 && a_collection_[i + 1] != 0) { ans += 1; a_collection_[i]--; a_collection_[i + 1]--; } } for (const auto& elm_a : a_collection_) ans += elm_a / 2; return ans; } llong ModMethod(void) { llong ans = 0; vector<llong> mod_collection; for (const auto& elm_a : a_collection_) { ans += elm_a / 2; mod_collection.push_back(elm_a % 2); } loop(i, n_ - 1) { if (mod_collection[i] + mod_collection[i + 1] == 2) { ans += 1; mod_collection[i] = 0; mod_collection[i + 1] = 0; } } return ans; } llong n_; vector<llong> a_collection_; }; int main(void) { AGC003B agc003b; agc003b.Run(); return 0; }
a.cc:43:9: warning: #pragma once in main file 43 | #pragma once | ^~~~ a.cc:45:10: fatal error: Macro.h: No such file or directory 45 | #include "Macro.h" | ^~~~~~~~~ compilation terminated.
s918188917
p04020
C++
#include<bits/stdc++.h> typedef long long ll; int n; ll a[100005]; ll dp[100005][2]; int main(){ cin>>n; for (int i=1;i<=n;i++) cin>>a[i]; if(a[1]!=0)dp[1][1]=(a[1]-1ll)/2ll; else dp[1][1]=-1e9; dp[1][0]=a[1]/2ll; for (int i=2;i<=n;i++){ if(a[i]==0ll) dp[i][1]=-1e9,dp[i][0]=dp[i-1][0]; else{ dp[i][1]=(a[i]-1ll)/2ll+dp[i-1][0]; if (a[i]>=2ll) dp[i][1]=max(dp[i][1],dp[i-1][1]+1ll+(a[i]-2ll)/2ll); dp[i][0]=max(a[i]/2ll+dp[i-1][0],dp[i-1][1]+1ll+(a[i]-1ll)/2ll); } } cout<<dp[n][0]; }
a.cc: In function 'int main()': a.cc:7:9: error: 'cin' was not declared in this scope; did you mean 'std::cin'? 7 | cin>>n; | ^~~ | std::cin In file included from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:146, from a.cc:1: /usr/include/c++/14/iostream:62:18: note: 'std::cin' declared here 62 | extern istream cin; ///< Linked to standard input | ^~~ a.cc:16:49: error: 'max' was not declared in this scope; did you mean 'std::max'? 16 | if (a[i]>=2ll) dp[i][1]=max(dp[i][1],dp[i-1][1]+1ll+(a[i]-2ll)/2ll); | ^~~ | std::max In file included from /usr/include/c++/14/algorithm:61, from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:51: /usr/include/c++/14/bits/stl_algo.h:5716:5: note: 'std::max' declared here 5716 | max(initializer_list<_Tp> __l, _Compare __comp) | ^~~ a.cc:17:34: error: 'max' was not declared in this scope; did you mean 'std::max'? 17 | dp[i][0]=max(a[i]/2ll+dp[i-1][0],dp[i-1][1]+1ll+(a[i]-1ll)/2ll); | ^~~ | std::max /usr/include/c++/14/bits/stl_algo.h:5716:5: note: 'std::max' declared here 5716 | max(initializer_list<_Tp> __l, _Compare __comp) | ^~~ a.cc:20:9: error: 'cout' was not declared in this scope; did you mean 'std::cout'? 20 | cout<<dp[n][0]; | ^~~~ | std::cout /usr/include/c++/14/iostream:63:18: note: 'std::cout' declared here 63 | extern ostream cout; ///< Linked to standard output | ^~~~
s541358827
p04020
C
#include<iostream> #include<iomanip> #include<algorithm> #include<cstring> #include<string> #include<cmath> #include<vector> #include<queue> #include<deque> #include<stack> #include<map> #include<set> using namespace std; const int inf=2147483647,dx[]={-1,0,1,0},dy[]={0,-1,0,1};// 上 左 下 右 const int N=100005,M=1000005,mod=1000000007; const long long llinf=9223372036854775807ll; int n,a[N],cnt,ans; long long sum; int main(){ scanf("%d",&n); for(int i=1;i<=n;i++) scanf("%d",&a[i]),sum+=a[i],a[i]%=2; for(int i=1;i<=n;i++) { if(a[i]==1) cnt++; else { if(cnt%2==1) ans++; cnt=0; } } cout<<(sum-ans)/2; return 0; }
main.c:1:9: fatal error: iostream: No such file or directory 1 | #include<iostream> | ^~~~~~~~~~ compilation terminated.
s521577593
p04020
C++
#include <bits/stdc++.h> using namespace std; #define ll long long int #define pb push_back #define pll pair<ll,ll> #define speed_up ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0); #define mod 1000000007 #define inf 1000000000000000000LL #define vl vector<ll> #define F first #define S second #define db long double #define sz(x) (ll)x.size() #define fix(n) cout<<fixed<<setprecision(n) #define rep(i,a,b) for(ll i=a;i<b;i++) #define all(x) x.begin(),x.end() #define mset(x) memset(x,0,sizeof x) #define pi 3.14159265 const int N = 1e5+5; ll n,a[N]; void solve() { cin>>n; ll ans=0, prv=0; while(n--) { ll x; cin>>x; if(x==0) continue; x += prv; ans += x/2; prv = a%2; } cout<<ans; } int main() { speed_up ll T=1; //cin>>T; while(T--) solve(); return 0; }
a.cc: In function 'void solve()': a.cc:35:22: error: invalid operands of types 'long long int [100005]' and 'int' to binary 'operator%' 35 | prv = a%2; | ~^~ | | | | | int | long long int [100005]
s356888516
p04020
C++
#include<bits/stdc++.h> using namespace std; typedef long long ll; typedef long long int llint; typedef pair<ll, ll> pa; #define MM 1000000000 #define MOD MM+7 #define MAX 101000 #define MAP 110 #define initial_value -1 #define Pair pair<int,int> #define chmax(a,b) (a<b ? a=b:0) #define chmin(a,b) (a>b ? a=b:0) #define INF (1 << 29) //536870912 int dx[4] = {-1,0,1,0}; int dy[4] = {0,-1,0,1}; ll N; ll a[100010]; int main(){ cin >> N; for(int i = 0; i < N; i++){ cin >> a[i]; ans += (a[i]/2); a[i] %= 2; } ll ans = 0; for(int i = 0; i < N; i++){ if(a[i] == 1 && i < N-1 && a[i+1] > 0){ ans++; a[i+1]--; } } cout << ans << endl; }
a.cc: In function 'int main()': a.cc:23:9: error: 'ans' was not declared in this scope; did you mean 'abs'? 23 | ans += (a[i]/2); | ^~~ | abs
s043192990
p04020
C++
#include<bits/stdc++.h> using namespace std; typedef long long ll; typedef long long int llint; typedef pair<ll, ll> pa; #define MM 1000000000 #define MOD MM+7 #define MAX 101000 #define MAP 110 #define initial_value -1 #define Pair pair<int,int> #define chmax(a,b) (a<b ? a=b:0) #define chmin(a,b) (a>b ? a=b:0) #define INF (1 << 29) //536870912 int dx[4] = {-1,0,1,0}; int dy[4] = {0,-1,0,1}; ll N; ll a[100010]; int main(){ cin >> N; ll ans = 0; for(int i = 0; i < N; i++){ cin >> a[i]; ans += (a[i]/2); a[i] %= 2; } ll ans = 0; for(int i = 0; i < N; i++){ if(a[i] == 1 && i < N-1 && a[i+1] > 0){ ans++; a[i+1]--; } } cout << ans << endl; }
a.cc: In function 'int main()': a.cc:27:8: error: redeclaration of 'll ans' 27 | ll ans = 0; | ^~~ a.cc:21:8: note: 'll ans' previously declared here 21 | ll ans = 0; | ^~~
s607664962
p04020
C++
#include <bits/stdc++.h> using namespace std; typedef long long int ll; typedef pair<ll, ll> pll; #define FOR(i, n, m) for (ll(i) = (m); (i) < (n); ++(i)) #define REP(i, n) FOR(i, n, 0) #define OF64 std::setprecision(10) const ll MOD = 1000000007; const ll INF = (ll)1e15; ll A[100005]; int main() { int N; cin >> N; REP(i, N) { cin >> A[i]; } REP(i, N - 1) { if (A[i] % 2 == 1) { ll s = std::min(1LL, A[i + 1]); A[i] += s; A[i + 1] -= s; } } ll sum = 0; REP(i, N) { sum += A[i] / 2; } cout << sum << endl; return 0; }#include <bits/stdc++.h> using namespace std; typedef long long int ll; typedef pair<ll, ll> pll; #define FOR(i, n, m) for (ll(i) = (m); (i) < (n); ++(i)) #define REP(i, n) FOR(i, n, 0) #define OF64 std::setprecision(10) const ll MOD = 1000000007; const ll INF = (ll)1e15; ll A[100005]; int main() { int N; cin >> N; REP(i, N) { cin >> A[i]; } REP(i, N - 1) { if (A[i] % 2 == 1) { ll s = std::min(1LL, A[i + 1]); A[i] += s; A[i + 1] -= s; } } ll sum = 0; REP(i, N) { sum += A[i] / 2; } cout << sum << endl; return 0; }
a.cc:40:2: error: stray '#' in program 40 | }#include <bits/stdc++.h> | ^ a.cc:40:3: error: 'include' does not name a type 40 | }#include <bits/stdc++.h> | ^~~~~~~ a.cc:50:10: error: redefinition of 'const ll MOD' 50 | const ll MOD = 1000000007; | ^~~ a.cc:11:10: note: 'const ll MOD' previously defined here 11 | const ll MOD = 1000000007; | ^~~ a.cc:51:10: error: redefinition of 'const ll INF' 51 | const ll INF = (ll)1e15; | ^~~ a.cc:12:10: note: 'const ll INF' previously defined here 12 | const ll INF = (ll)1e15; | ^~~ a.cc:53:4: error: redefinition of 'll A [100005]' 53 | ll A[100005]; | ^ a.cc:14:4: note: 'll A [100005]' previously declared here 14 | ll A[100005]; | ^ a.cc:55:5: error: redefinition of 'int main()' 55 | int main() | ^~~~ a.cc:16:5: note: 'int main()' previously defined here 16 | int main() | ^~~~
s088990453
p04020
C++
#include <bits/stdc++.h> using namespace std; typedef long long ll; typedef pair<int, int> pii; #define rep(i, n) for(ll i = 0;i < n;i++) template<class T, class U> void cmax(T& a, U b) { if (a<b) a = b; } template<class T, class U> void cmin(T& a, U b) { if (a>b) a = b; } int main() { cin.tie(0); ios::sync_with_stdio(false); int n; cin >> n; vector<int> a(n); rep(i, n) cin >> a[i]; ll ans = 0; if (n == 1) { cout << n/2 << enld; return 0; } rep(i, n-1) { ll tmp = (a[i]+a[i+1]) / 2; if (tmp > 0) { ans += tmp; a[i+1] = (a[i]+a[i+1]) % 2; } cerr << ans << endl; } cout << ans << endl; }
a.cc: In function 'int main()': a.cc:19:20: error: 'enld' was not declared in this scope 19 | cout << n/2 << enld; | ^~~~
s797792475
p04020
C++
#include<iostream> using namespace std; int arr[100000+50]; int main(){ int n; cin>>n; long long cnt=0; for(int i=0;i<n;i++) cin>>arr[i]; for(int i=0;i<n-1;i++){ if(arr[i]%2!=0 && arr[i+1]>0){ cnt+=arr[i]/2+1; arr[i+1]--; } else { cnt+=arr[i]/2; } } cout<<count; return 0; }
a.cc: In function 'int main()': a.cc:16:9: error: 'count' was not declared in this scope; did you mean 'cnt'? 16 | cout<<count; | ^~~~~ | cnt
s880253425
p04020
C++
/* Author: CNYALI_LK LANG: C++ PROG: b.cpp Mail: cnyalilk@vip.qq.com */ #include<bits/stdc++.h> #define debug(...) fprintf(stderr,__VA_ARGS__) #define DEBUG printf("Passing [%s] in LINE %d\n",__FUNCTION__,__LINE__) #define Debug debug("Passing [%s] in LINE %d\n",__FUNCTION__,__LINE__) #define all(x) x.begin(),x.end() #define x first #define y second #define int ll using namespace std; typedef long long ll; typedef pair<int,int> pii; const signed inf=0x3f3f3f3f; const double eps=1e-8; const double pi=acos(-1.0); template<class T>int chkmin(T &a,T b){return a>b?a=b,1:0;} template<class T>int chkmax(T &a,T b){return a<b?a=b,1:0;} template<class T>T sqr(T a){return a*a;} template<class T>T mmin(T a,T b){return a<b?a:b;} template<class T>T mmax(T a,T b){return a>b?a:b;} template<class T>T aabs(T a){return a<0?-a:a;} template<class T>int dcmp(T a,T b){return a>b;} template<int *a>int cmp_a(int x,int y){return a[x]<a[y];} #define min mmin #define max mmax #define abs aabs namespace io { const int SIZE = (1 << 21) + 1; char ibuf[SIZE], *iS, *iT, obuf[SIZE], *oS = obuf, *oT = oS + SIZE - 1, c, qu[55]; int f, qr; // getchar #define gc() (iS == iT ? (iT = (iS = ibuf) + fread (ibuf, 1, SIZE, stdin), (iS == iT ? EOF : *iS ++)) : *iS ++) // print the remaining part inline void flush () { fwrite (obuf, 1, oS - obuf, stdout); oS = obuf; } // putchar inline void putc (char x) { *oS ++ = x; if (oS == oT) flush (); } // input a signed integer inline void read (signed &x) { for (f = 1, c = gc(); c < '0' || c > '9'; c = gc()) if (c == '-') f = -1; for (x = 0; c <= '9' && c >= '0'; c = gc()) x = x * 10 + (c & 15); x *= f; } inline void read (long long &x) { for (f = 1, c = gc(); c < '0' || c > '9'; c = gc()) if (c == '-') f = -1; for (x = 0; c <= '9' && c >= '0'; c = gc()) x = x * 10 + (c & 15); x *= f; } inline void read (char &x) { x=gc(); } inline void read(char *x){ while((*x=gc())=='\n' || *x==' '||*x=='\r'); while(!(*x=='\n'||*x==' '||*x=='\r'))*(++x)=gc(); *x=0; } template<typename A,typename ...B> inline void read(A &x,B &...y){ read(x);read(y...); } // print a signed integer inline void write (signed x) { if (!x) putc ('0'); if (x < 0) putc ('-'), x = -x; while (x) qu[++ qr] = x % 10 + '0', x /= 10; while (qr) putc (qu[qr --]); } inline void write (long long x) { if (!x) putc ('0'); if (x < 0) putc ('-'), x = -x; while (x) qu[++ qr] = x % 10 + '0', x /= 10; while (qr) putc (qu[qr --]); } inline void write (char x) { putc(x); } inline void write(const char *x){ while(*x){putc(*x);++x;} } inline void write(char *x){ while(*x){putc(*x);++x;} } template<typename A,typename ...B> inline void write(A x,B ...y){ write(x);write(y...); } //no need to call flush at the end manually! struct Flusher_ {~Flusher_(){flush();}}io_flusher_; } using io :: read; using io :: putc; using io :: write; int main(){ #ifdef cnyali_lk freopen("b.in","r",stdin); freopen("b.out","w",stdout); #endif int n,s=0,t=0,x; read(n); for(int i=1;i<=n;++i){ read(x); if(!x){s+=t>>1;t=0;} else t+=x; } s+=t>>1; write(s,'\n'); return 0; }
a.cc:14:13: error: '::main' must return 'int' 14 | #define int ll | ^~ a.cc:100:1: note: in expansion of macro 'int' 100 | int main(){ | ^~~
s750947354
p04020
C++
#include<bits/stdc++.h> typedef long long ll; using namespace std; int n, a[100500], ans; int main(){ cin >> n; for(int i=1;i<=n;i++){ cin >> a[i]; }int cnt = 0; for(int i=1;i<=n;i++){ if(a[i] == 0){ ans += cnt / 2; cnt = 0; continue; } cnt += a[i]; } if(cnt > 0)ans += s / 2; cout << ans; return 0; }
a.cc: In function 'int main()': a.cc:20:21: error: 's' was not declared in this scope 20 | if(cnt > 0)ans += s / 2; | ^
s323307254
p04020
C++
#include<bits/stdc++.h> typedef long long ll; using namespace std; int n, a[100500], ans; int main(){ cin >> n; for(int i=1;i<=n;i++){ cin >> a[i]; }int cnt = 0; for(int i=1;i<=n;i++){ if(a[i] == 0){ ans += cnt / 2; cnt = 0; continue; } cnt += a[i]; } if(s > 0)ans += s / 2; cout << ans; return 0; }
a.cc: In function 'int main()': a.cc:20:6: error: 's' was not declared in this scope 20 | if(s > 0)ans += s / 2; | ^