submission_id
stringlengths
10
10
problem_id
stringlengths
6
6
language
stringclasses
3 values
code
stringlengths
1
522k
compiler_output
stringlengths
43
10.2k
s633450467
p03764
C
#include<stdio.h> /*int sa(int a,int b){ if(a < b) return(b - a); return(a - b); }*/ int main(){ int n,m,i,j,k,ans = 0; int N; int x[100000],y[100000],s[99999]; N = 1000000000 + 7; scanf("%d %d",&n,&m); for(i = 0;i < n;i++) scanf("%d",&x[i]); for(i= 0;i < m;i++) scanf("%d",&y[i]); for(i = 0;i < m - 1;i++){ for(j = i + 1;j < m;j++){ for(k = 0;k < n - 1;k+) s[k] = (x[j] - x[i]) * (y[k + 1] - y[k]); if(n % 2 == 0){ for(k = 1;k <= n / 2 - 1;k++) ans += (k * (n - k) * (s[k - 1] + s[n - k - 1])) % N; ans += (s[k / 2 - 1] * n * n / 8) % N; }else{ for(k = 1;k <= (n -1) / 2;k++) ans += (k * (n - k) * (s[k - 1] + s[n - k -1])) % N; } } } printf("%d",ans); return(0); }
main.c: In function 'main': main.c:26:29: error: expected expression before ')' token 26 | for(k = 0;k < n - 1;k+) | ^
s583149490
p03764
C++
//http://arc071.contest.atcoder.jp/tasks/arc071_b #include <iostream> using namespace std; int n,m; int x[100000] = {}; int y[100000] = {}; const int mod = 1000000007; void read_input(){ int i; cin >> n >> m; for(i=0; i<n; i++){ cin >> x[i]; } for(i=0; i<m; i++){ cin >> y[i]; } } int main(void){ read_input(); int i,j; int sum_x = 0; int sum_y = 0; for(i=0; i<n; i++){ for(j=0; j<i; j++){ sum_x += (x[i] - x[j]); sum_x %= mod; } } for(i=0; i<m; i++){ for(j=0; j<i; j++){ sum_y += (y[i] - y[j]); sum_y %= mod; } }
a.cc: In function 'int main()': a.cc:37:6: error: expected '}' at end of input 37 | } | ^ a.cc:21:15: note: to match this '{' 21 | int main(void){ | ^
s236289848
p03764
C++
#include <iostream> #include<algorithm> #include<math.h> using namespace std; int main(void){ long long int i,j,n,m; long long int tate=0,yoko=0; cin>>n>>m; long long int x[n],y[m]; for(i=0;i<n;i++){ cin>>x[i]; } for(i=0;i<m;i++){ cin>>y[i]; } sort(x,x+n); sort(y,y+m); for(i=0;i<n;i++){ tate+=(-n+1+i*2)*x[i]; } for(i=0;i<m;i++){ yoko+=(-m+1+i*2)*y[i]; } long long int ans=(tate*yoko)%(1E9+7); cout<<ans; }
a.cc: In function 'int main()': a.cc:28:34: error: invalid operands of types 'long long int' and 'double' to binary 'operator%' 28 | long long int ans=(tate*yoko)%(1E9+7); | ~~~~~~~~~~~^~~~~~~~ | | | | | double | long long int
s905409934
p03764
C++
#include <iostream> #include<algorithm> #include<math.h> using namespace std; int main(void){ long long int i,j,n,m; long long int tate=0,yoko=0; cin>>n>>m; long long int x[n],y[m]; for(i=0;i<n;i++){ cin>>x[i]; } for(i=0;i<m;i++){ cin>>y[i]; } sort(x,x+n); sort(y,y+m); for(i=0;i<n;i++){ tate+=(-n+1+i*2)*x[i]; } for(i=0;i<m;i++){ yoko+=(-m+1+i*2)*y[i]; } cout<<(tate*yoko)%(1E9+7); }
a.cc: In function 'int main()': a.cc:28:22: error: invalid operands of types 'long long int' and 'double' to binary 'operator%' 28 | cout<<(tate*yoko)%(1E9+7); | ~~~~~~~~~~~^~~~~~~~ | | | | | double | long long int
s065408579
p03764
C++
#include <iostream> #include<algorithm> #include<math.h> using namespace std; int main(void){ long long int i,j,n,m; long long int tate=0,yoko=0; cin>>n>>m; long long int x[n],y[m]; for(i=0;i<n;i++){ cin>>x[i]; } for(i=0;i<m;i++){ cin>>y[i]; } sort(x,x+n); sort(y,y+m); for(i=0;i<n;i++){ tate+=(-n+1+i*2)*x[i]; } for(i=0;i<m;i++){ yoko+=(-m+1+i*2)*y[i]; } cout<<(tate*yoko)%(1E+9); }
a.cc: In function 'int main()': a.cc:28:22: error: invalid operands of types 'long long int' and 'double' to binary 'operator%' 28 | cout<<(tate*yoko)%(1E+9); | ~~~~~~~~~~~^~~~~~~ | | | | | double | long long int
s067263314
p03764
C++
#include <iostream> #include<alghorithm> #include<math.h> using namespace std; int main(void){ int i,j,n,m; int tate=0,yoko=0; cin>>n>>m; int x[n],y[m]; for(i=0;i<n;i++){ cin>>x[i]; } for(i=0;i<m;i++){ cin>>y[i]; } sort(x,x+n); sort(y,y+m); for(i=0;i<n;i++){ tate+=(-n+1+i*2)*x[i]; } for(i=0;i<m;i++){ yoko+=(-m+1+i*2)*y[i]; } cout<<(tate*yoko)%(1E9+7); }
a.cc:2:9: fatal error: alghorithm: No such file or directory 2 | #include<alghorithm> | ^~~~~~~~~~~~ compilation terminated.
s591589746
p03764
C++
#include <iostream> #include<alghorithm> #include<math.h> using namespace std; int main(void){ int i,j,n,m; int tate=0,yoko=0; cin>>n>>m; int x[n],y[m]; for(i=0;i<n;i++){ cin>>x[i]; } for(i=0;i<m;i++){ cin>>y[i]; } sort(x,x+n); sort(y,y+m); for(i=0;i<n;i++){ tate+=(-n+1+i*2)*x[i]; } for(i=0;i<m;i++){ yoko+=(-m+1+i*2)*y[i]; } cout<<(tate*yoko)%(1E9+7); }
a.cc:2:9: fatal error: alghorithm: No such file or directory 2 | #include<alghorithm> | ^~~~~~~~~~~~ compilation terminated.
s844869056
p03764
C++
#include<iostream> #include<vector> #include<utility> #include<math.h> using namespace std; typedef long long ll; typedef vector<ll> vi; typedef vector<vi> vvi; typedef vector<pair<int, int> > vp; #define pb push_back #define mod 1000000007 #define inf 999999999 #define rep(i, n) for(int i = 0; i < n; i++) #define For(i, a, n) for(int i = a; i < n; i++) #define out(n) cout << n << endl; #define vout(v) rep(i, v.size()) out(v[i]); int main(){ ll n, m; cin >> n >> m; ll x[n], y[m]; rep(i, n) { cin >> x[i]; } rep(i, m) { cin >> y[i]; } ll xan = 0, yan = 0; rep(i, n) { xan += (2 * (i + 1) - 1 - n) * x[i]; xan %= mod; } rep(i, m) { yan += (2 * (i + 1) - 1 - m) * y[i]; yan %= mod; } cout << xan * yan % mod; << endl; }
a.cc: In function 'int main()': a.cc:46:28: error: expected primary-expression before '<<' token 46 | cout << xan * yan % mod; << endl; | ^~
s060940606
p03764
C++
#include <iostream> #include <vector> #include <algorithm> #include <cstdint> using namespace std; int main() { int_least32_t n, m; cin >> n >> m; vector<int_least32_t> x(n); for(auto& e : x) { cin >> x; } vector<int_least32_t> y(m); for(auto& e : y) { cin >> y; } int_fast64_t sum_x{ 0 }; for(auto i = 0U; i < x.size(); ++i) { sum_x += i * x[i] - (n - i - 2) * x[i]; } int_fast64_t sum_y{ 0 }; for(auto i = 0U; i < y.size(); ++i) { sum_y += i * y[i] - (n - i - 2) * y[i]; } sum_x %= 10'000'000 + 7; sum_y %= 10'000'000 + 7; cout << sum_x * sum_y % (10'000'000 + 7) << endl; }
a.cc: In function 'int main()': a.cc:15:21: error: no match for 'operator>>' (operand types are 'std::istream' {aka 'std::basic_istream<char>'} and 'std::vector<int>') 15 | cin >> x; | ~~~ ^~ ~ | | | | | std::vector<int> | std::istream {aka std::basic_istream<char>} In file included from /usr/include/c++/14/iostream:42, from a.cc:1: /usr/include/c++/14/istream:170:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(bool&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' 170 | operator>>(bool& __n) | ^~~~~~~~ /usr/include/c++/14/istream:170:24: note: no known conversion for argument 1 from 'std::vector<int>' to 'bool&' 170 | operator>>(bool& __n) | ~~~~~~^~~ /usr/include/c++/14/istream:174:7: note: candidate: 'std::basic_istream<_CharT, _Traits>& std::basic_istream<_CharT, _Traits>::operator>>(short int&) [with _CharT = char; _Traits = std::char_traits<char>]' 174 | operator>>(short& __n); | ^~~~~~~~ /usr/include/c++/14/istream:174:25: note: no known conversion for argument 1 from 'std::vector<int>' to 'short int&' 174 | operator>>(short& __n); | ~~~~~~~^~~ /usr/include/c++/14/istream:177:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(short unsigned int&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' 177 | operator>>(unsigned short& __n) | ^~~~~~~~ /usr/include/c++/14/istream:177:34: note: no known conversion for argument 1 from 'std::vector<int>' to 'short unsigned int&' 177 | operator>>(unsigned short& __n) | ~~~~~~~~~~~~~~~~^~~ /usr/include/c++/14/istream:181:7: note: candidate: 'std::basic_istream<_CharT, _Traits>& std::basic_istream<_CharT, _Traits>::operator>>(int&) [with _CharT = char; _Traits = std::char_traits<char>]' 181 | operator>>(int& __n); | ^~~~~~~~ /usr/include/c++/14/istream:181:23: note: no known conversion for argument 1 from 'std::vector<int>' to 'int&' 181 | operator>>(int& __n); | ~~~~~^~~ /usr/include/c++/14/istream:184:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(unsigned int&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' 184 | operator>>(unsigned int& __n) | ^~~~~~~~ /usr/include/c++/14/istream:184:32: note: no known conversion for argument 1 from 'std::vector<int>' to 'unsigned int&' 184 | operator>>(unsigned int& __n) | ~~~~~~~~~~~~~~^~~ /usr/include/c++/14/istream:188:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(long int&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' 188 | operator>>(long& __n) | ^~~~~~~~ /usr/include/c++/14/istream:188:24: note: no known conversion for argument 1 from 'std::vector<int>' to 'long int&' 188 | operator>>(long& __n) | ~~~~~~^~~ /usr/include/c++/14/istream:192:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(long unsigned int&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' 192 | operator>>(unsigned long& __n) | ^~~~~~~~ /usr/include/c++/14/istream:192:33: note: no known conversion for argument 1 from 'std::vector<int>' to 'long unsigned int&' 192 | operator>>(unsigned long& __n) | ~~~~~~~~~~~~~~~^~~ /usr/include/c++/14/istream:199:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(long long int&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' 199 | operator>>(long long& __n) | ^~~~~~~~ /usr/include/c++/14/istream:199:29: note: no known conversion for argument 1 from 'std::vector<int>' to 'long long int&' 199 | operator>>(long long& __n) | ~~~~~~~~~~~^~~ /usr/include/c++/14/istream:203:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(long long unsigned int&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' 203 | operator>>(unsigned long long& __n) | ^~~~~~~~ /usr/include/c++/14/istream:203:38: note: no known conversion for argument 1 from 'std::vector<int>' to 'long long unsigned int&' 203 | operator>>(unsigned long long& __n) | ~~~~~~~~~~~~~~~~~~~~^~~ /usr/include/c++/14/istream:219:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(float&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' 219 | operator>>(float& __f) | ^~~~~~~~ /usr/include/c++/14/istream:219:25: note: no known conversion for argument 1 from 'std::vector<int>' to 'float&' 219 | operator>>(float& __f) | ~~~~~~~^~~ /usr/include/c++/14/istream:223:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(double&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' 223 | operator>>(double& __f) | ^~~~~~~~ /usr/include/c++/14/istream:223:26: note: no known conversion for argument 1 from 'std::vector<int>' to 'double&' 223 | operator>>(double& __f) | ~~~~~~~~^~~ /usr/include/c++/14/istream:227:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(long double&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' 227 | operator>>(long double& __f) | ^~~~~~~~ /usr/include/c++/14/istream:227:31: note: no known conversion for argument 1 from 'std::vector<int>' to 'long double&' 227 | operator>>(long double& __f) | ~~~~~~~~~~~~~^~~ /usr/include/c++/14/istream:328:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(void*&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' 328 | operator>>(void*& __p) | ^~~~~~~~ /usr/include/c++/14/istream:328:25: note: no known conversion for argument 1 from 'std::vector<int>' to 'void*&' 328 | operator>>(void*& __p) | ~~~~~~~^~~ /usr/include/c++/14/istream:122:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(__istream_type& (*)(__istream_type&)) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' 122 | operator>>(__istream_type& (*__pf)(__istream_type&)) | ^~~~~~~~ /usr/include/c++/14/istream:122:36: note: no known conversion for argument 1 from 'std::vector<int>' to 'std::basic_istream<char>::__istream_type& (*)(std::basic_istream<char>::__istream_type&)' {aka 'std::basic_istream<char>& (*)(std::basic_istream<char>&)'} 122 | operator>>(__istream_type& (*__pf)(__istream_type&)) | ~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~ /usr/include/c++/14/istream:126:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(__ios_type& (*)(__ios_type&)) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>; __ios_type = std::basic_ios<char>]' 126 | operator>>(__ios_type& (*__pf)(__ios_type&)) | ^~~~~~~~ /usr/include/c++/14/istream:126:32: note: no known conversion for argument 1 from 'std::vector<int>' to 'std::basic_istream<char>::__ios_type& (*)(std::basic_istream<char>::__ios_type&)' {aka 'std::basic_ios<char>& (*)(std::basic_ios<char>&)'} 126 | operator>>(__ios_type& (*__pf)(__ios_type&)) | ~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~ /usr/include/c++/14/istream:133:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(std::ios_base& (*)(std::ios_base&)) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' 133 | operator>>(ios_base& (*__pf)(ios_base&)) | ^~~~~~~~ /usr/include/c++/14/istream:133:30: note: no known conversion for argument 1 from 'std::vector<int>' to 'std::ios_base& (*)(std::ios_base&)' 133 | operator>>(ios_base& (*__pf)(ios_base&)) | ~~~~~~~~~~~~^~~~~~~~~~~~~~~~ /usr/include/c++/14/istream:352:7: note: candidate: 'std::basic_istream<_CharT, _Traits>& std::basic_istream<_CharT, _Traits>::operator>>(__streambuf_type*) [with _CharT = char; _Traits = std::char_traits<char>; __streambuf_type = std::basic_streambuf<char>]' 352 | operator>>(__streambuf_type* __sb); | ^~~~~~~~ /usr/include/c++/14/istream:352:36: note: no known conversion for argument 1 from 'std::vector<int>' to 'std::basic_istream<char>::__streambuf_type*' {aka 'std::basic_streambuf<char>*'} 352 | operator>>(__streambuf_type* __sb); | ~~~~~~~~~~~~~~~~~~^~~~ In file included from /usr/include/c++/14/string:55, 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
s419184316
p03764
C++
using System; class Program { static void Main(string[] args) { //入力 //string[] xInputMax = "3 3".Split(' '); //string[] xInputMax = "6 5".Split(' '); string[] xInputMax = Console.ReadLine().Split(' '); int xMaxX = int.Parse(xInputMax[0]); int xMaxY = int.Parse(xInputMax[1]); //string[] xInputX = "1 3 4".Split(' '); //string[] xInputX = "-790013317 -192321079 95834122 418379342 586260100 802780784".Split(' '); string[] xInputX = Console.ReadLine().Split(' '); long[] x = new long[xMaxX]; for (int i = 0; i < xMaxX; ++i) { x[i] = long.Parse(xInputX[i]); } //string[] xInputY = "1 3 6".Split(' '); //string[] xInputY = "-253230108 193944314 363756450 712662868 735867677".Split(' '); string[] xInputY = Console.ReadLine().Split(' '); long[] y = new long[xMaxY]; for (int i = 0; i < xMaxY; ++i) { y[i] = long.Parse(xInputY[i]); } //計算 long xDivisor = 1000000007; long xSumX = 0; for (int i = 0; i < xMaxX - 1; ++i) { for (int j = i + 1; j <= xMaxX - 1; ++j) { xSumX += x[j] - x[i]; } } xSumX = xSumX % xDivisor; long xSumY = 0; for (int k = 0; k < xMaxY - 1; ++k) { for (int l = k + 1; l <= xMaxY - 1; ++l) { xSumY += y[l] - y[k]; } } xSumY = xSumY % xDivisor; //出力 Console.WriteLine((xSumX * xSumY) % xDivisor); } }
a.cc:1:7: error: expected nested-name-specifier before 'System' 1 | using System; | ^~~~~~ a.cc:4:26: error: 'string' has not been declared 4 | static void Main(string[] args) | ^~~~~~ a.cc:4:35: error: expected ',' or '...' before 'args' 4 | static void Main(string[] args) | ^~~~ a.cc:51:6: error: expected ';' after class definition 51 | } | ^ | ; a.cc: In static member function 'static void Program::Main(int*)': a.cc:9:13: error: 'string' was not declared in this scope 9 | string[] xInputMax = Console.ReadLine().Split(' '); | ^~~~~~ a.cc:9:20: error: expected primary-expression before ']' token 9 | string[] xInputMax = Console.ReadLine().Split(' '); | ^ a.cc:10:25: error: expected primary-expression before 'int' 10 | int xMaxX = int.Parse(xInputMax[0]); | ^~~ a.cc:11:25: error: expected primary-expression before 'int' 11 | int xMaxY = int.Parse(xInputMax[1]); | ^~~ a.cc:14:20: error: expected primary-expression before ']' token 14 | string[] xInputX = Console.ReadLine().Split(' '); | ^ a.cc:15:17: error: structured binding declaration cannot have type 'long int' 15 | long[] x = new long[xMaxX]; | ^~ a.cc:15:17: note: type must be cv-qualified 'auto' or reference to cv-qualified 'auto' a.cc:15:17: error: empty structured binding declaration a.cc:15:20: error: expected initializer before 'x' 15 | long[] x = new long[xMaxX]; | ^ a.cc:18:17: error: 'x' was not declared in this scope 18 | x[i] = long.Parse(xInputX[i]); | ^ a.cc:18:24: error: expected primary-expression before 'long' 18 | x[i] = long.Parse(xInputX[i]); | ^~~~ a.cc:22:20: error: expected primary-expression before ']' token 22 | string[] xInputY = Console.ReadLine().Split(' '); | ^ a.cc:23:17: error: structured binding declaration cannot have type 'long int' 23 | long[] y = new long[xMaxY]; | ^~ a.cc:23:17: note: type must be cv-qualified 'auto' or reference to cv-qualified 'auto' a.cc:23:17: error: empty structured binding declaration a.cc:23:20: error: expected initializer before 'y' 23 | long[] y = new long[xMaxY]; | ^ a.cc:26:17: error: 'y' was not declared in this scope 26 | y[i] = long.Parse(xInputY[i]); | ^ a.cc:26:24: error: expected primary-expression before 'long' 26 | y[i] = long.Parse(xInputY[i]); | ^~~~ a.cc:35:30: error: 'x' was not declared in this scope 35 | xSumX += x[j] - x[i]; | ^ a.cc:44:30: error: 'y' was not declared in this scope 44 | xSumY += y[l] - y[k]; | ^ a.cc:49:13: error: 'Console' was not declared in this scope 49 | Console.WriteLine((xSumX * xSumY) % xDivisor); | ^~~~~~~
s157290203
p03764
C++
#include <cstdio> #include <algorithm> using namespace std; int n, m; long long int x[100000]; long long int y[100000]; long long int a, b; long long int mod = 1e9+7; long long int ans; int main(){ scanf("%d %d", &n, &m); for(int i=0; i<n; ++i){ scanf("%lld", &x[i]); x[i] -= x[0]; } for(int i=0; i<m; ++i){ scanf("%lld", &y[i]); y[i] -= y[0]; } for(int i=1; i<n; ++i){ a += x[i] * min((((n-i-1)*n-(n-i-1)+n-1-(n-i-1)*(n-i-1)-(n-i-1)), (i-1)*n-(i-1)+n-1-(i-1)*(i-1)-(i-1))); a %= mod; } for(int i=1; i<m; ++i){ b += y[i] * min((((m-i-1)*m-(m-i-1)+m-1-(m-i-1)*(m-i-1)-(m-i-1)), (i-1)*m-(i-1)+m-1-(i-1)*(i-1)-(i-1))); b %= mod; } ans = a * b; ans %= mod; printf("%lld\n", ans); }
a.cc: In function 'int main()': a.cc:25:32: error: no matching function for call to 'min(int)' 25 | a += x[i] * min((((n-i-1)*n-(n-i-1)+n-1-(n-i-1)*(n-i-1)-(n-i-1)), (i-1)*n-(i-1)+n-1-(i-1)*(i-1)-(i-1))); | ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ In file included from /usr/include/c++/14/algorithm:60, from a.cc:2: /usr/include/c++/14/bits/stl_algobase.h:233:5: note: candidate: 'template<class _Tp> constexpr const _Tp& std::min(const _Tp&, const _Tp&)' 233 | min(const _Tp& __a, const _Tp& __b) | ^~~ /usr/include/c++/14/bits/stl_algobase.h:233:5: note: candidate expects 2 arguments, 1 provided /usr/include/c++/14/bits/stl_algobase.h:281:5: note: candidate: 'template<class _Tp, class _Compare> constexpr const _Tp& std::min(const _Tp&, const _Tp&, _Compare)' 281 | min(const _Tp& __a, const _Tp& __b, _Compare __comp) | ^~~ /usr/include/c++/14/bits/stl_algobase.h:281:5: note: candidate expects 3 arguments, 1 provided In file included from /usr/include/c++/14/algorithm:61: /usr/include/c++/14/bits/stl_algo.h:5686:5: note: candidate: 'template<class _Tp> constexpr _Tp std::min(initializer_list<_Tp>)' 5686 | min(initializer_list<_Tp> __l) | ^~~ /usr/include/c++/14/bits/stl_algo.h:5686:5: note: template argument deduction/substitution failed: a.cc:25:32: note: mismatched types 'std::initializer_list<_Tp>' and 'int' 25 | a += x[i] * min((((n-i-1)*n-(n-i-1)+n-1-(n-i-1)*(n-i-1)-(n-i-1)), (i-1)*n-(i-1)+n-1-(i-1)*(i-1)-(i-1))); | ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /usr/include/c++/14/bits/stl_algo.h:5696:5: note: candidate: 'template<class _Tp, class _Compare> constexpr _Tp std::min(initializer_list<_Tp>, _Compare)' 5696 | min(initializer_list<_Tp> __l, _Compare __comp) | ^~~ /usr/include/c++/14/bits/stl_algo.h:5696:5: note: candidate expects 2 arguments, 1 provided a.cc:29:32: error: no matching function for call to 'min(int)' 29 | b += y[i] * min((((m-i-1)*m-(m-i-1)+m-1-(m-i-1)*(m-i-1)-(m-i-1)), (i-1)*m-(i-1)+m-1-(i-1)*(i-1)-(i-1))); | ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /usr/include/c++/14/bits/stl_algobase.h:233:5: note: candidate: 'template<class _Tp> constexpr const _Tp& std::min(const _Tp&, const _Tp&)' 233 | min(const _Tp& __a, const _Tp& __b) | ^~~ /usr/include/c++/14/bits/stl_algobase.h:233:5: note: candidate expects 2 arguments, 1 provided /usr/include/c++/14/bits/stl_algobase.h:281:5: note: candidate: 'template<class _Tp, class _Compare> constexpr const _Tp& std::min(const _Tp&, const _Tp&, _Compare)' 281 | min(const _Tp& __a, const _Tp& __b, _Compare __comp) | ^~~ /usr/include/c++/14/bits/stl_algobase.h:281:5: note: candidate expects 3 arguments, 1 provided /usr/include/c++/14/bits/stl_algo.h:5686:5: note: candidate: 'template<class _Tp> constexpr _Tp std::min(initializer_list<_Tp>)' 5686 | min(initializer_list<_Tp> __l) | ^~~ /usr/include/c++/14/bits/stl_algo.h:5686:5: note: template argument deduction/substitution failed: a.cc:29:32: note: mismatched types 'std::initializer_list<_Tp>' and 'int' 29 | b += y[i] * min((((m-i-1)*m-(m-i-1)+m-1-(m-i-1)*(m-i-1)-(m-i-1)), (i-1)*m-(i-1)+m-1-(i-1)*(i-1)-(i-1))); | ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /usr/include/c++/14/bits/stl_algo.h:5696:5: note: candidate: 'template<class _Tp, class _Compare> constexpr _Tp std::min(initializer_list<_Tp>, _Compare)' 5696 | min(initializer_list<_Tp> __l, _Compare __comp) | ^~~ /usr/include/c++/14/bits/stl_algo.h:5696:5: note: candidate expects 2 arguments, 1 provided
s469303718
p03764
C++
#include<bits/stdc++.h> using namespace std; using ll=long long; const ll mod=1000000007; ll mod_pow(ll x,ll n){ ll res=1; while(n>0){ if(n&1)res=res*x%mod; x=x*x%mod; n>>=1; } return res; } int main(){ ll n,m; cin>>n>>m; for(ll i=0;i<n;++i){ ll x;cin>>x; if(i==0)mix=x; if(i==n-1)ma_x=x; } for(ll i=0;i<m;++i){ ll x;cin>>x; if(i==0)miy=x; if(i==m-1)may=x; } ll ans=(((ma_x-mix)%mod)*((may-miy)%mod))%mod; ans=(((ans*mod_pow(2,(n-2)))%mod)*mod_pow(2,(m-2)))%mod; cout<<ans<<endl; return 0; }
a.cc: In function 'int main()': a.cc:24:17: error: 'mix' was not declared in this scope 24 | if(i==0)mix=x; | ^~~ a.cc:25:19: error: 'ma_x' was not declared in this scope 25 | if(i==n-1)ma_x=x; | ^~~~ a.cc:29:17: error: 'miy' was not declared in this scope 29 | if(i==0)miy=x; | ^~~ a.cc:30:19: error: 'may' was not declared in this scope 30 | if(i==m-1)may=x; | ^~~ a.cc:32:15: error: 'ma_x' was not declared in this scope 32 | ll ans=(((ma_x-mix)%mod)*((may-miy)%mod))%mod; | ^~~~ a.cc:32:20: error: 'mix' was not declared in this scope 32 | ll ans=(((ma_x-mix)%mod)*((may-miy)%mod))%mod; | ^~~ a.cc:32:32: error: 'may' was not declared in this scope 32 | ll ans=(((ma_x-mix)%mod)*((may-miy)%mod))%mod; | ^~~ a.cc:32:36: error: 'miy' was not declared in this scope 32 | ll ans=(((ma_x-mix)%mod)*((may-miy)%mod))%mod; | ^~~
s063538678
p03764
C++
#include <iostream> #include <vector> #include <algorithm> #include <string> #include <unordered_map> using namespace std; int main() { int n; int m; int line; string str; //vector<string> str_vec; int count = 0; vector<int> X; vector<int> Y; long long res=0; cin >> n >> m; while (cin >> line) { X.push_back(line); count++; if (count == n) break; } count = 0; while (cin >> line) { Y.push_back(line); count++; if (count == m) { break; } } vector<int> X_distance; vector<int> Y_distance; for (int xi=0;xi<n;++xi) { for (int xj = xi + 1; xj < n; ++xj) { X_distance.push_back(X[xj] - X[xi]); } } for (int yi = 0; yi < m; ++yi) { for (int yj = yi + 1; yj < n; ++yj) { Y_distance.push_back(Y[yj] - Y[yi]); } } for (auto& elemx : X_distance) { for(auto& elemy:Y_distance) { res += elemx*elemy; } } res = res%long long (10e9 + 7); cout << res << endl; return 0; }
a.cc: In function 'int main()': a.cc:66:19: error: expected primary-expression before 'long' 66 | res = res%long long (10e9 + 7); | ^~~~
s704924209
p03764
C++
#pragma comment(linker, "/STACK:1024000000,1024000000") #include<algorithm> #include<iostream> #include<cstring> #include<fstream> #include<bitset> #include<cstdio> #include<string> #include<vector> #include<cmath> #include<queue> #include<stack> #include<map> #include<set> #define INF 0X3F3F3F3F #define N 100505 #define M 200005 #define LL long long #define FF(i,a,b) for(int i=a;i<=b;++i) #define RR(i,a,b) for(int i=a;i>=b;--i) #define FJ(i,a,b) for(int i=a;i<b;++i) #define SC(x) scanf("%d",&x) #define SCC(x,y) scanf("%d%d",&x,&y) #define SCCC(x,y,z) scanf("%d%d%d",&x,&y,&z) #define SS(x) scanf("%s",x) #define PR(x) printf("%d\n",x) #define CL(a, x) memset(a, x, sizeof(a)) #define _q fd[rt] #define _l fd[rt<<1] #define _r fd[rt<<1|1] #define MID int mid=((l+r)>>1) #define lson rt<<1,l,mid #define rson rt<<1|1,mid+1,r #define PB push_back #define SZ size #define PII pair<int,int> #define PLL pair<long long,long long> #define MP make_pair #define IN freopen("in.txt","r",stdin) #define OUT freopen("out.txt","w",stdout) using namespace std; const int MOD=1000000007; const double PI=acos(-1.0); const double EPS=1e-8; int n, xn, yn; LL x[N], y[N]; int main(){ //IN; SCC(xn, yn); FF(i, 1, xn)scanf("%lld", &x[i]); FF(i, 1, yn)scanf("%lld", &y[i]); sort(x + 1, x + 1 + xn); sort(y + 1, y + 1 + yn); LL Y = 0; FF(i, 1, yn - 1){ Y = (Y + 1LL * i * (yn - i) % MOD * (y[i + 1] - y[i])) % MOD; } LL s = 0; FF(i, 1, xn - 1){ s = (s + Y * i % MOD * (xn - i) % MOD * (x[i + 1] - x[i])) % MOD; } printf("%lld\n", s); return 0; }
a.cc:45:12: error: 'int yn' redeclared as different kind of entity 45 | int n, xn, yn; | ^~ In file included from /usr/include/features.h:523, from /usr/include/x86_64-linux-gnu/c++/14/bits/os_defines.h:39, from /usr/include/x86_64-linux-gnu/c++/14/bits/c++config.h:683, from /usr/include/c++/14/bits/stl_algobase.h:59, from /usr/include/c++/14/algorithm:60, from a.cc:2: /usr/include/x86_64-linux-gnu/bits/mathcalls.h:258:1: note: previous declaration 'double yn(int, double)' 258 | __MATHCALL (yn,, (int, _Mdouble_)); | ^~~~~~~~~~ a.cc: In function 'int main()': a.cc:19:32: error: ISO C++ forbids comparison between pointer and integer [-fpermissive] 19 | #define FF(i,a,b) for(int i=a;i<=b;++i) | ^ a.cc:51:5: note: in expansion of macro 'FF' 51 | FF(i, 1, yn)scanf("%lld", &y[i]); | ^~ a.cc:53:23: error: invalid operands of types 'long long int*' and 'double(int, double) noexcept' to binary 'operator+' 53 | sort(y + 1, y + 1 + yn); | ~~~~~ ^ ~~ | | | | | double(int, double) noexcept | long long int* a.cc:55:17: warning: pointer to a function used in arithmetic [-Wpointer-arith] 55 | FF(i, 1, yn - 1){ | ~~~^~~ a.cc:19:34: note: in definition of macro 'FF' 19 | #define FF(i,a,b) for(int i=a;i<=b;++i) | ^ a.cc:19:32: error: ISO C++ forbids comparison between pointer and integer [-fpermissive] 19 | #define FF(i,a,b) for(int i=a;i<=b;++i) | ^ a.cc:55:5: note: in expansion of macro 'FF' 55 | FF(i, 1, yn - 1){ | ^~ a.cc:56:32: warning: pointer to a function used in arithmetic [-Wpointer-arith] 56 | Y = (Y + 1LL * i * (yn - i) % MOD * (y[i + 1] - y[i])) % MOD; | ~~~^~~ a.cc:56:26: error: invalid operands of types 'long long int' and 'double (*)(int, double) noexcept' to binary 'operator*' 56 | Y = (Y + 1LL * i * (yn - i) % MOD * (y[i + 1] - y[i])) % MOD; | ~~~~~~~ ^ ~~~~~~~~ | | | | | double (*)(int, double) noexcept | long long int
s884191259
p03764
C++
#include <iostream> #include <string.h> using namespace std; typedef long long ll; const int N = 1e5+5,mod=1e9+7; ll X[N],Y[N]; int main() { int n,m;scanf("%d %d",&n,&m); for (int i=1; i<=n; i++) { scanf("%lld",X+i); } for (int i=1; i<=m; i++) { scanf("%lld",Y+i); } sort(X+1,X+1+n); sort(X+1,X+1+m); ll a=0,s=0; for (int i=1; i<=n; i++) { if(i!=1) { a = (a+((X[i]*(i-1))%mod))%mod; a-=s; } s+=X[i]; } s=0; ll b=a;a=0; for (int i=1; i<=m; i++) { if(i!=1) { a = (a+((Y[i]*(i-1))%mod))%mod; a-=s;a%=mod; } s+=Y[i];s%=mod; } ll ans=(a*b)%mod; if(ans<0) ans+=mod; cout<<ans<<endl; return 0; }
a.cc: In function 'int main()': a.cc:16:5: error: 'sort' was not declared in this scope; did you mean 'short'? 16 | sort(X+1,X+1+n); | ^~~~ | short
s013474139
p03765
C++
#include <stdio.h> #include <cstring> #include <array> constexpr int N = 1e5; char S[N+10], T[N+10]; std::array<short, N+1> vS, vT; constexpr short K = 'A' - 1; int main(void){ // A -> BB -> AAAA ; ABBAA -> ABBB // A -> AAAA -> AAABB -> BB // つまり, A = BB = AAAA // B = AA = BBBB : 3文字 === 空文字列 // BA -> BBB = 0 : A = 1, B = 2と置いた時ハッシュ値みたいになるのでは? scanf("%s%s", S, T); int n = strlen(S), m = strlen(T); vS[0] = 0; REP(i, n) vS[i+1] = (vS[i] + S[i] - K) % 3; vT[0] = 0; REP(i, m) vT[i+1] = (vT[i] + T[i] - K) % 3; int q; scanf("%d", &q); while(q--){ int a, b, c, d; scanf("%d%d%d%d", &a, &b, &c, &d); a--; c--; short sss = (vS[b] - vS[a] + 3) % 3; short ttt = (vT[d] - vT[c] + 3) % 3; puts(sss==ttt ? "YES" : "NO"); } return 0; }
a.cc: In function 'int main()': a.cc:20:20: error: 'i' was not declared in this scope 20 | vS[0] = 0; REP(i, n) vS[i+1] = (vS[i] + S[i] - K) % 3; | ^ a.cc:20:16: error: 'REP' was not declared in this scope 20 | vS[0] = 0; REP(i, n) vS[i+1] = (vS[i] + S[i] - K) % 3; | ^~~
s060139891
p03765
C++
import math inp=lambda:(int,input().split()) s=input() t=input() q=int(input()) for _ in range(q): a,b,c,d=inp() if abs((s[a:b].count('A')-s[a:b].count('B')))==abs((t[a:b].count('A')-t[a:b].count('B'))): print('YES') else: print('NO')
a.cc:9:23: warning: multi-character character constant [-Wmultichar] 9 | print('YES') | ^~~~~ a.cc:11:23: warning: multi-character character constant [-Wmultichar] 11 | print('NO') | ^~~~ a.cc:1:1: error: 'import' does not name a type 1 | import math | ^~~~~~ a.cc:1:1: note: C++20 'import' only available with '-fmodules-ts'
s959658282
p03765
C++
#include<bits/stdc++.h> using namespace std; // #include</home/edison/Coding/cpp/template/debug.cpp> int spre[100005],tpre[100005]; int main(){ string s,t; cin>>s>>t; for(int i=1;i<=s.size();++i)spre[i]=spre[i-1]+(s[i-1]=='A'); for(int i=1;i<=t.size();++i)tpre[i]=tpre[i-1]+(t[i-1]=='A'); auto csa=[&](int l,int r){ return spre[r]-spre[l-1]; }; auto csb=[&](int l,int r){ return r-l+1-spre[r]+spre[l-1]; }; auto cta=[&](int l,int r){ return tpre[r]-tpre[l-1]; }; auto ctb=[&](int l,int r){ return r-l+1-tpre[r]+tpre[l-1]; }; int q; cin>>q; while(q--){ int a,b,c,d; cin>>a>>b>>c>>d; PDE(csa(a,b),csb(a,b),cta(c,d),ctb(c,d)); if((csa(a,b)+csb(a,b)*2)%3==(cta(c,d)+ctb(c,d)*2)%3)cout<<"YES"<<endl; else cout<<"NO"<<endl; } }
a.cc: In function 'int main()': a.cc:18:9: error: 'PDE' was not declared in this scope 18 | PDE(csa(a,b),csb(a,b),cta(c,d),ctb(c,d)); | ^~~
s170171270
p03765
C++
#include <bits/stdc++.h> #include <ext/pb_ds/assoc_container.hpp> #include <ext/pb_ds/tree_policy.hpp> using namespace std; using namespace __gnu_pbds; #define fbo find_by_order #define ook order_of_key #define f first #define s second #define pb push_back #define reset(a,b) memset(a,b,sizeof a); #define MOD 998244353 #define MID (l+r)/2 #define ALL(x) x.begin(),x.end() #define debug(x) cout<<#x<<" = "<<(x)<<endl #define mx 1000003 #define pc(x) putchar_unlocked(x); typedef tree<long long, null_type, less<long long>, rb_tree_tag, tree_order_statistics_node_update> pbds; int n,a,b,c,d,pref1[mx],pref2[mx]; string s1,s2; int main(){ cin>>s1>>s2; int n=s1.length(),m=s2.length(); for(int i=1;i<=n;i++){ pref1[i]=pref1[i-1]; if(s1[i-1]=='A')pref1[i]++; else pref1[i]+=2; } for(int i=1;i<=m;i++){ pref2[i]=pref2[i-1]; if(s2[i-1]=='A')pref2[i]++; else pref2[i]+=2; } cin>>q; while(q--){ cin>>a>>b>>c>>d; int sa=pref[b]-pref[a-1]; int du=pref[d]-pref[c-1]; if(sa%3==du%3){ cout<<"YES\n"; } else cout<<"NO\n"; } }
a.cc: In function 'int main()': a.cc:34:14: error: 'q' was not declared in this scope 34 | cin>>q; | ^ a.cc:37:24: error: 'pref' was not declared in this scope; did you mean 'pref2'? 37 | int sa=pref[b]-pref[a-1]; | ^~~~ | pref2
s717188190
p03765
C++
#include <iostream> #include <climits> #include <stack> #include <queue> #include <iomanip> #include <limits> #include <string> #include <cmath> #include <set> #include <map> #include <math.h> #include <algorithm> #include <vector> using namespace std; typedef long long ll; typedef pair<ll,ll> P; long long int INF = 1e18; double Pi = 3.141592653589; const int mod = 1000000007; // memset(a,0,sizeof(a)); →全部0にする vector<int> G[100005]; std::vector<P> tree[100010]; int dx[8]={1,0,-1,0,1,1,-1,-1}; int dy[8]={0,1,0,-1,1,-1,-1,1}; #define p(x) cout<<x<<endl; #define el cout<<endl; #define pe(x) cout<<x<<" "; #define re(i,a,b) for(i=a;i<=b;i++) ll i,j,ii,jj; ll n,m; ll now=0,tyakuti=0,memo=0; ll kaisi,k,hazime,owari; ll a,b,c,d; string s[100005],t[100005]; ll ss[100005],tt[100005]; int main(){ cin>>s>>t; n=strlen(s); m=strlen(t); ss[0]=tt[0]=0; for(i=1;i<=n;i++){ if(s[i]=='A'){ ss[i]=ss[i]+1; }else{ ss[i]=ss[i]+2; } } for(i=1;i<=n;i++){ if(t[i]=='A'){ tt[i]=tt[i]+1; }else{ tt[i]=tt[i]+2; } } ll q; cin>>q; for(i=0;i<q;i++){ cin>>a>>b>>c>>d; if((ss[a]-ss[b-1]-tt[c]+tt[d-1])%3==0){ p("YES"); }else{ p("NO"); } } return 0; }
a.cc: In function 'int main()': a.cc:45:8: error: no match for 'operator>>' (operand types are 'std::istream' {aka 'std::basic_istream<char>'} and 'std::string [100005]' {aka 'std::__cxx11::basic_string<char> [100005]'}) 45 | cin>>s>>t; | ~~~^~~ | | | | | std::string [100005] {aka std::__cxx11::basic_string<char> [100005]} | std::istream {aka std::basic_istream<char>} In file included from /usr/include/c++/14/iostream:42, from a.cc:1: /usr/include/c++/14/istream:170:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(bool&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' (near match) 170 | operator>>(bool& __n) | ^~~~~~~~ /usr/include/c++/14/istream:170:7: note: conversion of argument 1 would be ill-formed: a.cc:45:10: error: cannot bind non-const lvalue reference of type 'bool&' to a value of type 'std::string*' {aka 'std::__cxx11::basic_string<char>*'} 45 | cin>>s>>t; | ^ /usr/include/c++/14/istream:174:7: note: candidate: 'std::basic_istream<_CharT, _Traits>& std::basic_istream<_CharT, _Traits>::operator>>(short int&) [with _CharT = char; _Traits = std::char_traits<char>]' (near match) 174 | operator>>(short& __n); | ^~~~~~~~ /usr/include/c++/14/istream:174:7: note: conversion of argument 1 would be ill-formed: a.cc:45:10: error: invalid conversion from 'std::string*' {aka 'std::__cxx11::basic_string<char>*'} to 'short int' [-fpermissive] 45 | cin>>s>>t; | ^ | | | std::string* {aka std::__cxx11::basic_string<char>*} a.cc:45:10: error: cannot bind rvalue '(short int)((std::string*)(& s))' to 'short int&' /usr/include/c++/14/istream:177:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(short unsigned int&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' (near match) 177 | operator>>(unsigned short& __n) | ^~~~~~~~ /usr/include/c++/14/istream:177:7: note: conversion of argument 1 would be ill-formed: a.cc:45:10: error: invalid conversion from 'std::string*' {aka 'std::__cxx11::basic_string<char>*'} to 'short unsigned int' [-fpermissive] 45 | cin>>s>>t; | ^ | | | std::string* {aka std::__cxx11::basic_string<char>*} a.cc:45:10: error: cannot bind rvalue '(short unsigned int)((std::string*)(& s))' to 'short unsigned int&' /usr/include/c++/14/istream:181:7: note: candidate: 'std::basic_istream<_CharT, _Traits>& std::basic_istream<_CharT, _Traits>::operator>>(int&) [with _CharT = char; _Traits = std::char_traits<char>]' (near match) 181 | operator>>(int& __n); | ^~~~~~~~ /usr/include/c++/14/istream:181:7: note: conversion of argument 1 would be ill-formed: a.cc:45:10: error: invalid conversion from 'std::string*' {aka 'std::__cxx11::basic_string<char>*'} to 'int' [-fpermissive] 45 | cin>>s>>t; | ^ | | | std::string* {aka std::__cxx11::basic_string<char>*} a.cc:45:10: error: cannot bind rvalue '(int)((std::string*)(& s))' to 'int&' /usr/include/c++/14/istream:184:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(unsigned int&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' (near match) 184 | operator>>(unsigned int& __n) | ^~~~~~~~ /usr/include/c++/14/istream:184:7: note: conversion of argument 1 would be ill-formed: a.cc:45:10: error: invalid conversion from 'std::string*' {aka 'std::__cxx11::basic_string<char>*'} to 'unsigned int' [-fpermissive] 45 | cin>>s>>t; | ^ | | | std::string* {aka std::__cxx11::basic_string<char>*} a.cc:45:10: error: cannot bind rvalue '(unsigned int)((std::string*)(& s))' to 'unsigned int&' /usr/include/c++/14/istream:188:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(long int&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' (near match) 188 | operator>>(long& __n) | ^~~~~~~~ /usr/include/c++/14/istream:188:7: note: conversion of argument 1 would be ill-formed: a.cc:45:10: error: invalid conversion from 'std::string*' {aka 'std::__cxx11::basic_string<char>*'} to 'long int' [-fpermissive] 45 | cin>>s>>t; | ^ | | | std::string* {aka std::__cxx11::basic_string<char>*} a.cc:45:10: error: cannot bind rvalue '(long int)((std::string*)(& s))' to 'long int&' /usr/include/c++/14/istream:192:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(long unsigned int&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' (near match) 192 | operator>>(unsigned long& __n) | ^~~~~~~~ /usr/include/c++/14/istream:192:7: note: conversion of argument 1 would be ill-formed: a.cc:45:10: error: invalid conversion from 'std::string*' {aka 'std::__cxx11::basic_string<char>*'} to 'long unsigned int' [-fpermissive] 45 | cin>>s>>t; | ^ | | | std::string* {aka std::__cxx11::basic_string<char>*} a.cc:45:10: error: cannot bind rvalue '(long unsigned int)((std::string*)(& s))' to 'long unsigned int&' /usr/include/c++/14/istream:199:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(long long int&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' (near match) 199 | operator>>(long long& __n) | ^~~~~~~~ /usr/include/c++/14/istream:199:7: note: conversion of argument 1 would be ill-formed: a.cc:45:10: error: invalid conversion from 'std::string*' {aka 'std::__cxx11::basic_string<char>*'} to 'long long int' [-fpermissive] 45 | cin>>s>>t; | ^ | | | std::string* {aka std::__cxx11::basic_string<char>*} a.cc:45:10: error: cannot bind rvalue '(long long int)((std::string*)(& s))' to 'long long int&' /usr/include/c++/14/istream:203:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(long long unsigned int&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' (near match) 203 | operator>>(unsigned long long& __n) | ^~~~~~~~ /usr/include/c++/14/istream:203:7: note: conversion of argument 1 would be ill-formed: a.cc:45:10: error: invalid conversion from 'std::string*' {aka 'std::__cxx11::basic_string<char>*'} to 'long long unsigned int' [-fpermissive] 45 | cin>>s>>t; | ^ | | | std::string* {aka std::__cxx11::basic_string<char>*} a.cc:45:10: error: cannot bind rvalue '(long long unsigned int)((std::string*)(& s))' to 'long long unsigned int&' /usr/include/c++/14/istream:328:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(void*&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' (near match) 328 | operator>>(void*& __p) | ^~~~~~~~ /usr/include/c++/14/istream:328:7: note: conversion of argument 1 would be ill-formed: a.cc:45:10: error: cannot bind non-const lvalue reference of type 'void*&' to an rvalue of type 'void*' 45 | cin>>s>>t; | ^ /usr/include/c++/14/istream:219:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(float&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' 219 | operator>>(float& __f) | ^~~~~~~~ /usr/include/c++/14/istream:219:25: note: no known conversion for argument 1 from 'std::string [100005]' {aka 'std::__cxx11::basic_string<char> [100005]'} to 'float&' 219 | operator>>(float& __f) | ~~~~~~~^~~ /usr/include/c++/14/istream:223:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(double&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' 223 | operator>>(double& __f) | ^~~~~~~~ /usr/include/c++/14/istream:223:26: note: no known conversion for argument 1 from 'std::string [100005]' {aka 'std::__cxx11::basic_string<char> [100005]'} to 'double&' 223 | operator>>(double& __f) | ~~~~~~~~^~~ /usr/include/c++/14/istream:227:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(long double&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' 227 | operator>>(long double& __f) | ^~~~~~~~ /usr/include/c++/14/istream:227:31: note: no known conversion for argument 1 from 'std::string [100005]' {aka 'std::__cxx11::basic_string<char> [100005]'} to 'long double&' 227 | operator>>(long double& __f) | ~~~~~~~~~~~~~^~~ /usr/include/c++/14/istream:122:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(__istream_type& (*)(__istream_type&)) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' 122 | operator>>(__istream_type& (*__pf)(__istream_type&)) | ^~~~~~~~ /usr/include/c++/14/istream:122:36: note: no known conversion for argument 1 from 'std::string [100005]' {aka 'std::__cxx11::basic_string<char> [100005]'} to 'std::basic_istream<char>::
s478302971
p03765
C++
#include <iostream> #include <climits> #include <stack> #include <queue> #include <iomanip> #include <limits> #include <string> #include <cmath> #include <set> #include <map> #include <math.h> #include <algorithm> #include <vector> using namespace std; typedef long long ll; typedef pair<ll,ll> P; long long int INF = 1e18; double Pi = 3.141592653589; const int mod = 1000000007; // memset(a,0,sizeof(a)); →全部0にする vector<int> G[100005]; std::vector<P> tree[100010]; int dx[8]={1,0,-1,0,1,1,-1,-1}; int dy[8]={0,1,0,-1,1,-1,-1,1}; #define p(x) cout<<x<<endl; #define el cout<<endl; #define pe(x) cout<<x<<" "; #define re(i,a,b) for(i=a;i<=b;i++) ll i,j,ii,jj; ll n,m; ll now=0,tyakuti=0,memo=0; ll kaisi,k,hazime,owari; ll a,b,c,d; char s[100005],t[100005]; ll ss[100005],tt[100005]; int main(){ cin>>s>>t; n=strlen(s); m=strlen(t); ss[0]=tt[0]=0; for(i=1;i<=n;i++){ if(s[i]=='A'){ ss[i]=ss[i]+1; }else{ ss[i]=ss[i]+2; } } for(i=1;i<=n;i++){ if(t[i]=='A'){ tt[i]=tt[i]+1; }else{ tt[i]=tt[i]+2; } } ll q; cin>>q; for(i=0;i<q;i++){ cin>>a>>b>>c>>d; if((ss[a]-ss[b-1]-tt[c]+tt[d-1])%3==0){ p("YES"); }else{ p("NO"); } } return 0; }
a.cc: In function 'int main()': a.cc:46:7: error: 'strlen' was not declared in this scope 46 | n=strlen(s); | ^~~~~~ a.cc:13:1: note: 'strlen' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>' 12 | #include <algorithm> +++ |+#include <cstring> 13 | #include <vector>
s165197053
p03765
C++
#include <iostream> #include <iomanip> #include <string> #include <vector> #include <queue> #include <algorithm> #include <utility> #include <cmath> #include <map> #include <set> #include <stack> #include <cstdio> #include <cstdlib> #include <cstring> #include <random> #include <deque> #define INF_LL 1e18 #define INF 1e9 #define REP(i, n) for(int i = 0;i < (n);i++) #define FOR(i, a, b) for(int i = (a);i < (b);i++) #define all(x) x.begin(),x.end() using namespace std; using ll = long long; using PII = pair<int, int>; using PLL = pair<ll, ll>; const ll MOD = 1e9+7; int dx[9] = {-1, 1, 0, 0, -1, -1, 1, 1, 0}; int dy[9] = {0, 0, -1, 1, -1, 1, -1, 1, 0}; template<typename T> void chmax(T &a, T b){ a = max(a, b); } template<typename T> void chmin(T &a, T b){ a = min(a, b); } class Union_find{ private: vector<int> par; vector<int> rank; int n; public: Union_find(int a){ n = a; for(int i = 0;i < n;i++){ par.push_back(i); rank.push_back(0); } } int find(int x){ if(par[x] == x){ return x; }else{ return par[x] = find(par[x]); } } void unite(int x, int y){ x = find(x); y = find(y); if(x == y) return; if(rank[x] < rank[y]){ par[x] = y; }else{ par[y] = x; if(rank[x] == rank[y]) rank[x]++; } } bool same(int x, int y){ return find(x) == find(y); } }; class RMQ{ int n; vector<int> dat; public: RMQ(int n_){ n = 1; while(n < n_) n *= 2; REP(i, n*2-1){ dat.push_back(INF); } } void update(int x, int i){ i += n-1; dat[i] = x; while(i > 0){ i = (i-1)/2; dat[i] = min(dat[i*2+1], dat[i*2+2]); } } int query(int a, int b, int l, int r, int x){ if(a <= l && r <= b) return dat[x]; if(r <= a || b <= l) return INF; int res = INF; res = min(query(a, b, l, (l+r)/2, x*2+1), query(a, b, (l+r)/2, r, x*2+2)); return res; } int query(int a, int b){ return query(a, b, 0, n, 0); } }; const ll mod = 1e9+7; int main(void){ string s,t; cin >> s >> t; vector<int> s1(s.size()+1,0),s2(t.size()+1,0); REP(i,s.size()) s1[i+1]=s1[i]+s[i]-'A'; REP(i,t.size()) s2[i+1]=s2[i]+t[i]-'A'; int Q; REP(q,Q){ int a,b,c,d; cin>> a >> b >> c >> d; if((s1[b]-s1[a-1])%3==(s2[d]-s2[c-1])%3) cout<< "YES" << endl; else cout << "NO" << endl; }
a.cc: In function 'int main()': a.cc:137:2: error: expected '}' at end of input 137 | } | ^ a.cc:123:15: note: to match this '{' 123 | int main(void){ | ^
s523954673
p03765
C++
#include <iostream> #include <iomanip> #include <string> #include <vector> #include <queue> #include <algorithm> #include <utility> #include <cmath> #include <map> #include <set> #include <stack> #include <cstdio> #include <cstdlib> #include <cstring> #include <random> #include <deque> #define INF_LL 1e18 #define INF 1e9 #define REP(i, n) for(int i = 0;i < (n);i++) #define FOR(i, a, b) for(int i = (a);i < (b);i++) #define all(x) x.begin(),x.end() using namespace std; using ll = long long; using PII = pair<int, int>; using PLL = pair<ll, ll>; const ll MOD = 1e9+7; int dx[9] = {-1, 1, 0, 0, -1, -1, 1, 1, 0}; int dy[9] = {0, 0, -1, 1, -1, 1, -1, 1, 0}; template<typename T> void chmax(T &a, T b){ a = max(a, b); } template<typename T> void chmin(T &a, T b){ a = min(a, b); } class Union_find{ private: vector<int> par; vector<int> rank; int n; public: Union_find(int a){ n = a; for(int i = 0;i < n;i++){ par.push_back(i); rank.push_back(0); } } int find(int x){ if(par[x] == x){ return x; }else{ return par[x] = find(par[x]); } } void unite(int x, int y){ x = find(x); y = find(y); if(x == y) return; if(rank[x] < rank[y]){ par[x] = y; }else{ par[y] = x; if(rank[x] == rank[y]) rank[x]++; } } bool same(int x, int y){ return find(x) == find(y); } }; class RMQ{ int n; vector<int> dat; public: RMQ(int n_){ n = 1; while(n < n_) n *= 2; REP(i, n*2-1){ dat.push_back(INF); } } void update(int x, int i){ i += n-1; dat[i] = x; while(i > 0){ i = (i-1)/2; dat[i] = min(dat[i*2+1], dat[i*2+2]); } } int query(int a, int b, int l, int r, int x){ if(a <= l && r <= b) return dat[x]; if(r <= a || b <= l) return INF; int res = INF; res = min(query(a, b, l, (l+r)/2, x*2+1), query(a, b, (l+r)/2, r, x*2+2)); return res; } int query(int a, int b){ return query(a, b, 0, n, 0); } }; const ll mod = 1e9+7 int main(void){ string s,t; cin >> s >> t; vector<int> s1(s.size()+1,0),s2(t.size()+1,0); REP(i,s.size()) s1[i+1]=s1[i]+s[i]-'A'; REP(i,t.size()) s2[i+1]=s2[i]+t[i]-'A'; int Q; REP(q,Q){ int a,b,c,d; cin>> a >> b >> c >> d; if((s1[b]-s1[a-1])%3==(s2[d]-s2[c-1])%3) cout<< "YES" << endl; else cout << "NO" << endl; }
a.cc:123:1: error: expected ',' or ';' before 'int' 123 | int main(void){ | ^~~
s505434222
p03765
C++
#include<stdio.h> #include<string.h> #include<stdlib.h> #include<math.h> #include<stack> #include<queue> #include<vector> #include<algorithm> #include<string> #include<iostream> using namespace std; int main() { char s[100005],t[100005]; int q; scanf("%s\n%s\n",s,t); scanf("%d",&q); int ss[100005],tt[100005]; ss[0]=0; tt[0]=0; for(int i=0;i<=strlen(s)-1;i++){ if(s[i]=='A')ss[i+1]=ss[i]+1; else ss[i+1]=ss[i]+2; } for(int i=0;i<=strlen(t)-1;i++){ if(t[i]=='A')tt[i+1]=tt[i]+1; else tt[i+1]=tt[i]+2; } for(int i=1;i<=q;i++){ int a,b,c,d; scanf("%d %d %d %d",&a,&b,&c,&d); if(((ss[b]-ss[a-1])-(tt[d]-tt[c-1]))%3==0)printf("YES"); else printf("NO"); printf("\n"); }
a.cc: In function 'int main()': a.cc:41:6: error: expected '}' at end of input 41 | } | ^ a.cc:18:12: note: to match this '{' 18 | int main() { | ^
s558031125
p03765
Java
#include <bits/stdc++.h> using namespace std; #define REP(i,n) for(int i=0;i<n;i++) #define REPR(i,n) for(int i=n;i>=0;i--) #define FOR(i,m,n) for(int i=m;i<n;i++) #define EPS (1e-7) #define INF 1e9 typedef long long ll; typedef pair<int,int> pii; typedef pair<ll,ll> pll; int vx[]={0,1,0,-1}; int vy[]={1,0,-1,0}; int dx[]={0,1,0,-1,1,1,-1,-1}; int dy[]={1,0,-1,0,1,-1,1,-1}; const ll mod=1000000000+7; const int MAX_N=1000; int main(){ string s,t; int q; cin>>s>>t; cin>>q; int a[q]; int b[q]; int c[q]; int d[q]; REP(i,q){ cin>>a[i]>>b[i]>>c[i]>>d[i]; a[i]--;b[i]--;c[i]--;d[i]--; } int sum_s[s.size()+1]; sum_s[0]=0; for(int i=1;i<=s.size();i++){ if(s[i-1]=='A')sum_s[i]=sum_s[i-1]+1; else sum_s[i]=sum_s[i-1]+2; } int sum_t[t.size()+1]; sum_t[0]=0; for(int i=1;i<=t.size();i++){ if(t[i-1]=='A')sum_t[i]=sum_t[i-1]+1; else sum_t[i]=sum_t[i-1]+2; } REP(i,q){ int si=sum_s[b[i]+1]-sum_s[a[i]]; int ti=sum_t[d[i]+1]-sum_t[c[i]]; if((si%3)==(ti%3))cout<<"YES"<<endl; else cout<<"NO"<<endl; } return 0; }
Main.java:1: error: illegal character: '#' #include <bits/stdc++.h> ^ Main.java:1: error: class, interface, enum, or record expected #include <bits/stdc++.h> ^ Main.java:4: error: illegal character: '#' #define REP(i,n) for(int i=0;i<n;i++) ^ Main.java:4: error: class, interface, enum, or record expected #define REP(i,n) for(int i=0;i<n;i++) ^ Main.java:4: error: class, interface, enum, or record expected #define REP(i,n) for(int i=0;i<n;i++) ^ Main.java:4: error: class, interface, enum, or record expected #define REP(i,n) for(int i=0;i<n;i++) ^ Main.java:5: error: illegal character: '#' #define REPR(i,n) for(int i=n;i>=0;i--) ^ Main.java:5: error: class, interface, enum, or record expected #define REPR(i,n) for(int i=n;i>=0;i--) ^ Main.java:5: error: class, interface, enum, or record expected #define REPR(i,n) for(int i=n;i>=0;i--) ^ Main.java:6: error: illegal character: '#' #define FOR(i,m,n) for(int i=m;i<n;i++) ^ Main.java:6: error: class, interface, enum, or record expected #define FOR(i,m,n) for(int i=m;i<n;i++) ^ Main.java:6: error: class, interface, enum, or record expected #define FOR(i,m,n) for(int i=m;i<n;i++) ^ Main.java:7: error: illegal character: '#' #define EPS (1e-7) ^ Main.java:8: error: illegal character: '#' #define INF 1e9 ^ Main.java:11: error: class, interface, enum, or record expected typedef pair<int,int> pii; ^ Main.java:12: error: class, interface, enum, or record expected typedef pair<ll,ll> pll; ^ Main.java:13: error: class, interface, enum, or record expected int vx[]={0,1,0,-1}; ^ Main.java:14: error: class, interface, enum, or record expected int vy[]={1,0,-1,0}; ^ Main.java:16: error: class, interface, enum, or record expected int dx[]={0,1,0,-1,1,1,-1,-1}; ^ Main.java:17: error: class, interface, enum, or record expected int dy[]={1,0,-1,0,1,-1,1,-1}; ^ Main.java:19: error: class, interface, enum, or record expected const ll mod=1000000000+7; ^ Main.java:20: error: class, interface, enum, or record expected const int MAX_N=1000; ^ Main.java:25: error: not a statement cin>>s>>t; ^ Main.java:26: error: not a statement cin>>q; ^ Main.java:27: error: not a statement int a[q]; ^ Main.java:28: error: not a statement int b[q]; ^ Main.java:29: error: not a statement int c[q]; ^ Main.java:30: error: not a statement int d[q]; ^ Main.java:32: error: not a statement cin>>a[i]>>b[i]>>c[i]>>d[i]; ^ Main.java:36: error: not a statement int sum_s[s.size()+1]; ^ Main.java:43: error: not a statement int sum_t[t.size()+1]; ^ Main.java:54: error: not a statement if((si%3)==(ti%3))cout<<"YES"<<endl; ^ Main.java:55: error: not a statement else cout<<"NO"<<endl; ^ Main.java:22: error: unnamed classes are a preview feature and are disabled by default. int main(){ ^ (use --enable-preview to enable unnamed classes) Main.java:27: error: ';' expected int a[q]; ^ Main.java:28: error: ';' expected int b[q]; ^ Main.java:29: error: ';' expected int c[q]; ^ Main.java:30: error: ';' expected int d[q]; ^ Main.java:31: error: ';' expected REP(i,q){ ^ Main.java:36: error: ']' expected int sum_s[s.size()+1]; ^ Main.java:36: error: ';' expected int sum_s[s.size()+1]; ^ Main.java:43: error: ']' expected int sum_t[t.size()+1]; ^ Main.java:43: error: ';' expected int sum_t[t.size()+1]; ^ Main.java:50: error: ';' expected REP(i,q){ ^ 44 errors
s068674073
p03765
C++
import java.util.ArrayList; import java.util.Arrays; import java.util.Scanner; public class Main { public static void main(String[] args) { new Main().solve(); } void solve() { Scanner sc=new Scanner(System.in); String s=sc.next(); String t=sc.next(); int q=sc.nextInt(); int[]a=new int[q]; int[]b=new int[q]; int[]c=new int[q]; int[]d=new int[q]; for(int i=0;i<q;i++) { a[i]=sc.nextInt()-1; b[i]=sc.nextInt()-1; c[i]=sc.nextInt()-1; d[i]=sc.nextInt()-1; } for(int i=0;i<q;i++) { String si=press(s.substring(a[i],b[i]+1)); String ti=press(t.substring(c[i],d[i]+1)); if(si.equals(ti)){ System.out.println("YES"); }else { System.out.println("NO"); } } } String press(String s) { while(s.length()>1) { if(s.length()>2) { s=s.replace("AAA", ""); s=s.replace("BBB", ""); } if(s.length()>1) { s=s.replace("AB",""); s=s.replace("BA",""); s=s.replace("BB", "A"); s=s.replace("AA", "B"); } } return s; } }
a.cc:1:1: error: 'import' does not name a type 1 | import java.util.ArrayList; | ^~~~~~ 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.Arrays; | ^~~~~~ 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.util.Scanner; | ^~~~~~ 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 { | ^~~~~~
s787810573
p03765
C++
#include "IntMod.h" typedef IntMod<1000000007> MInt; //#include "Union_Find.h" #include <cstdio> #include <cstdlib> #include <cstring> #include <iostream> #include <string> #include <vector> #include <utility> #include <algorithm> #include <functional> #include <cmath> #include <stack> #include <queue> #include <set> #include <map> #include <iomanip> #include <sstream> #include <numeric> #include <list> #include <bitset> using namespace std; #define REP(i,a,n) for(int i = (a); i < (int)(n); ++i) #define REPM(i,n,a) for(int i = ((n) - 1); i >= (a); --i) #define EPS 0.0001 #define INF 0x3FFFFFFF #define INFLL 0x3FFFFFFF3FFFFFFF #define INFD 1.0e+308 #define FLOAT setprecision(16) typedef long long LL; typedef unsigned long long ULL; typedef pair<LL, LL> PP; template <class T, class U> istream& operator>>(istream& ist, pair<T, U>& right) { return ist >> right.first >> right.second; } template <class T, class U> ostream& operator<<(ostream& ost, pair<T, U>& right) { return ost << right.first << ' ' << right.second; } template <class T, class TCompatible, size_t N> void Fill(T(&dest)[N], const TCompatible& val) { fill(begin(dest), end(dest), val); } template <class T, class TCompatible, size_t M, size_t N> void Fill(T(&dest)[M][N], const TCompatible& val) { for (int i = 0; i < M; ++i) Fill(dest[i], val); } //sum, 累積和 // 負のときの割り算に注意 #if 1 #include <array> #include <unordered_set> #include <unordered_map> template<class T> using PriorityQ = priority_queue<T, vector<T>, greater<T> >; // コスト小を優先 #endif //#include "Union_Find.h" string S, T; int N; PP A[100000], B[100000]; int SS[100001], TT[100001]; int main() { cin >> S >> T; cin >> N; REP(i, 0, N) { cin >> A[i] >> B[i]; } REP(i, 0, S.size()) { SS[i + 1] = SS[i] + (S[i] == 'A' ? 1 : 2); } REP(i, 0, T.size()) { TT[i + 1] = TT[i] + (T[i] == 'A' ? 1 : 2); } REP(i, 0, N) { int sd = SS[A[i].second] - SS[A[i].first - 1]; int td = TT[B[i].second] - TT[B[i].first - 1]; cout << ((td - sd) % 3 == 0 ? "YES" : "NO") << endl; } return 0; }
a.cc:1:10: fatal error: IntMod.h: No such file or directory 1 | #include "IntMod.h" | ^~~~~~~~~~ compilation terminated.
s843757124
p03765
C++
#include<bits/stdc++.h> using namespace std; const int maxn = 100009; char s[maxn], t[maxn]; int S[maxn], T[maxn]; int n, m, Q, a, b, c, d; int main(){ gets(s+1); gets(t+1); n = strlen(s+1); for (int i=1; i<=n; i++) S[i] = (S[i-1] + (s[i] == 'A' ? 1 : 2)) % 3; m = strlen(t+1); for (int i=1; i<=m; i++) T[i] = (T[i-1] + (t[i] == 'A' ? 1 : 2)) % 3; scanf("%d", &Q); while (Q--){ scanf("%d%d%d%d", &a, &b, &c, &d); puts((S[b]-S[a-1]+3)%3 == (T[d]-T[c-1]+3)%3 ? "YES" : "NO"); } return 0; }
a.cc: In function 'int main()': a.cc:10:9: error: 'gets' was not declared in this scope; did you mean 'getw'? 10 | gets(s+1); gets(t+1); | ^~~~ | getw
s788845805
p03765
C++
#include<stdio.h> #include<vector> #include<algorithm> #include<set> using namespace std; typedef long long ll; typedef pair<ll, ll> pll; const int MX = 500005; const int MM = 1000000007; char A[MX], B[MX]; int X[MX], Y[MX]; int N, M; int main() { scanf("%s%s", A+1, B+1); N = strlen(A+1), M = strlen(B+1); for(int i = 1; i <= N; i++) X[i] = X[i-1] + (A[i] == 'A'? 1:-1); for(int i = 1; i <= M; i++) Y[i] = Y[i-1] + (B[i] == 'A'? 1:-1); int Q, a, b, c, d; scanf("%d", &Q); for(int i = 1; i <= Q; i++){ scanf("%d%d%d%d", &a, &b, &c, &d); printf("%s\n", (X[b] + Y[c-1] - X[a-1] - Y[d]) % 3 == 0? "YES":"NO"); } }
a.cc: In function 'int main()': a.cc:21:13: error: 'strlen' was not declared in this scope 21 | N = strlen(A+1), M = strlen(B+1); | ^~~~~~ a.cc:5:1: note: 'strlen' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>' 4 | #include<set> +++ |+#include <cstring> 5 |
s117263272
p03765
C++
#include <iostream> #include <algorithm> #include <bits/stdc++.h> using namespace std; int main(void){ string S; string T; int N; cin >> S >> T; cin >> N; int s_s, s_e, t_s, t_e; int S_asum[100005]; S_asum[0] = 0; for(int j=1;j<=S.length();j++){ S_asum[j] = (S_asum[j-1] + S[j -1] - 'A' + 1) % 3; } int T_asum[100005]; T_asum[0] = 0; for(int j=1;j<=T.length();j++){ T_asum[j] = (T_asum[j-1] + T[j -1] - 'A' + 1) % 3; } for(int i=0;i<N;i++){ /*cin >> s_s >> s_e >> t_s >> t_e;*/ scanf("%d%d%d%d", &s_s, &s_e, &t_s, &t_e); int s_tmp = 0; int t_tmp = 0; s_tmp = S_asum[s_e] - S_asum[s_s-1] + 3; t_tmp = T_asum[t_e] - T_asum[t_s-1] + 3; /*string ans = "NO";*/ if((s_tmp - t_tmp) % 3 == 0){ /*ans = "YES";*/ printf("YES\n"); } els{printf("NO\n");} /*else{printf("NO\n");}*/ /*cout << ans << endl;*/ } return 0; }
a.cc: In function 'int main()': a.cc:45:9: error: 'els' was not declared in this scope 45 | els{printf("NO\n");} | ^~~
s312742805
p03765
C++
#include <iostream> #include <algorithm> #include <bits/stdc++.h> using namespace std; int main(void){ /* string S; string T; */ char S[100005], T[100005]; int N; cin >> S >> T; cin >> N; int s_s, s_e, t_s, t_e; int S_asum[100005]; S_asum[0] = 0; for(int j=1;j<=S.length();j++){ S_asum[j] = S_asum[j-1] + S[j -1] - 'A' + 1; } int T_asum[100005]; T_asum[0] = 0; for(int j=1;j<=T.length();j++){ T_asum[j] = T_asum[j-1] + T[j -1] - 'A' + 1; } for(int i=0;i<N;i++){ cin >> s_s >> s_e >> t_s >> t_e; int s_tmp = 0; int t_tmp = 0; s_tmp = S_asum[s_e] - S_asum[s_s-1]; t_tmp = T_asum[t_e] - T_asum[t_s-1]; string ans = "NO"; if((s_tmp - t_tmp) % 3 == 0){ ans = "YES"; } cout << ans << endl; } return 0; }
a.cc: In function 'int main()': a.cc:22:22: error: request for member 'length' in 'S', which is of non-class type 'char [100005]' 22 | for(int j=1;j<=S.length();j++){ | ^~~~~~ a.cc:27:22: error: request for member 'length' in 'T', which is of non-class type 'char [100005]' 27 | for(int j=1;j<=T.length();j++){ | ^~~~~~
s209079275
p03765
C++
#include <iostream> #include <algorithm> using namespace std; int main(void){ string S; string T; int N; cin >> S >> T; cin >> N; int s_s, s_e, t_s, t_e; for(int i=0;i<N;i++){ cin >> s_s >> s_e >> t_s >> t_e; int s_a = 0; int t_a = 0; for(int j=s_s-1;j<s_e;j++){ if(S[j] == 'A'){ s_a++; } } s_a = s_a + (S.length() - s_a) * 2 for(int j=t_s-1;j<t_e;j++){ if(T[j] == 'A'){ t_a++; } } t_a = t_a + (T.length() - t_a) * 2 string ans = "NO"; if(s_a % 3 == t_a % 3){ ans = "YES"; } cout << ans << endl; } return 0; }
a.cc: In function 'int main()': a.cc:25:43: error: expected ';' before 'for' 25 | s_a = s_a + (S.length() - s_a) * 2 | ^ | ; 26 | for(int j=t_s-1;j<t_e;j++){ | ~~~ a.cc:26:25: error: 'j' was not declared in this scope 26 | for(int j=t_s-1;j<t_e;j++){ | ^ a.cc:32:43: error: expected ';' before 'string' 32 | t_a = t_a + (T.length() - t_a) * 2 | ^ | ; 33 | string ans = "NO"; | ~~~~~~ a.cc:35:13: error: 'ans' was not declared in this scope; did you mean 'abs'? 35 | ans = "YES"; | ^~~ | abs a.cc:37:17: error: 'ans' was not declared in this scope; did you mean 'abs'? 37 | cout << ans << endl; | ^~~ | abs
s674277089
p03765
C++
#include <iostream> #include <string> using namespace std; string deal(string s) { //cout<<s.c_str()<<endl; string s1; int i=0,j=0; char *pS; bool has=false; while (true){ pS = (char*)s.c_str(); char *p = pS; while(*p!='\0'){ if (!memcmp(p,"AB",2) || !memcmp(p,"BA",2)){ memset(p,' ',2); p=p+2; has = true; }else if (!memcmp(p,"AAA",3) || !memcmp(p,"BBB",3)){ memset(p,' ',3); p=p+3; has=true; }else{ p++; } } if (has==false){ s = pS; break; }else{ has = false; } s1.clear(); p = pS; while (*p!='\0'){ if (*p != ' '){ s1 += *p; } p++; } s = s1; } if (!s.compare("AA")){ s = "B"; } if (!s.compare("BB")){ s = "A"; } return s; } int main(int argc, char* argv[]) { string S,T; cin>>S; cin>>T; int q; cin>>q; int i=0; for (i=0;i<q;i++){ string s,t; int a,b,c,d; cin>>a>>b>>c>>d; int j; for (j=a;j<=b;j++){ s +=S[j-1]; } for (j=c;j<=d;j++){ t +=T[j-1]; } string s1 = deal(s); string t1 = deal(t); if (!s1.compare(t1)){ cout<<"YES"<<endl; }else{ cout<<"NO"<<endl; } } return 0; }
a.cc: In function 'std::string deal(std::string)': a.cc:15:30: error: 'memcmp' was not declared in this scope 15 | if (!memcmp(p,"AB",2) || !memcmp(p,"BA",2)){ | ^~~~~~ a.cc:2:1: note: 'memcmp' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>' 1 | #include <iostream> +++ |+#include <cstring> 2 | #include <string> a.cc:16:33: error: 'memset' was not declared in this scope 16 | memset(p,' ',2); | ^~~~~~ a.cc:16:33: note: 'memset' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>' a.cc:20:33: error: 'memset' was not declared in this scope 20 | memset(p,' ',3); | ^~~~~~ a.cc:20:33: note: 'memset' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
s893761760
p03765
C++
#include<cstdio> #include<algorithm> #include<cstring> #include<cmath> typedef long long ll; char an[100100]; char bn[100100]; int da[100100]; int db[100100]; int main(){ gets(an); gets(bn); for(int i=0;i<strlen(an);i++){ if(an[i]=='A'){ da[i+1]=(da[i]+1); } else da[i+1]=(da[i]+2); } for(int i=0;i<strlen(bn);i++){ if(bn[i]=='A'){ db[i+1]=(db[i]+1); } else db[i+1]=(db[i]+2); } int q; scanf("%d",&q); for(int i=1;i<=q;i++){ int a1,a2,b1,b2; scanf("%d%d%d%d",&a1,&a2,&b1,&b2); int ansa=da[a2]-da[a1-1]; ansa%=3; int ansb=db[b2]-db[b1-1]; ansb%=3; if(ansa==ansb)printf("YES\n"); else printf("NO\n"); } return 0; }
a.cc: In function 'int main()': a.cc:11:5: error: 'gets' was not declared in this scope; did you mean 'getw'? 11 | gets(an); | ^~~~ | getw
s969551131
p03765
C++
#include<cstdio> #include<algorithm> #include<cstring> #include<cmath> typedef long long ll; char an[100100]; char bn[100100]; int da[100100]; int db[100100]; int main(){ scanf("%s%s",an,bn) for(int i=0;i<strlen(an);i++){ if(an[i]=='A'){ da[i+1]=(da[i]+1); } else da[i+1]=(da[i]+2); } for(int i=0;i<strlen(bn);i++){ if(bn[i]=='A'){ db[i+1]=(db[i]+1); } else db[i+1]=(db[i]+2); } int q; scanf("%d",&q); for(int i=1;i<=q;i++){ int a1,a2,b1,b2; scanf("%d%d%d%d",&a1,&a2,&b1,&b2); int ansa=da[a2]-da[a1-1]; ansa%=3; int ansb=db[b2]-db[b1-1]; ansb%=3; if(ansa==ansb)printf("YES\n"); else printf("NO\n"); } return 0; }
a.cc: In function 'int main()': a.cc:11:24: error: expected ';' before 'for' 11 | scanf("%s%s",an,bn) | ^ | ; 12 | for(int i=0;i<strlen(an);i++){ | ~~~ a.cc:12:17: error: 'i' was not declared in this scope 12 | for(int i=0;i<strlen(an);i++){ | ^
s140695502
p03765
C++
#include <iostream> #include <vector> #include <algorithm> #include <cstdint> using namespace std; int main() { string s, t; cin >> s >> t; vector<int_least32_t> cumuSam_s{ s.size() }}; for(auto i = 0, sum = 0; i < cumuSam_s.size(); ++i) { if(s[i] == 'A') { sum += 1; } else { sum += 2; } cumuSam_s[i] = sum; } vector<int_least32_t> cumuSam_t{ t.size() }}; for(auto i = 0, sum = 0; i < cumuSam_t.size(); ++i) { if(s[i] == 'A') { sum += 1; } else { sum += 2; } cumuSam_t[i] = sum; } int_least32_t q; cin >> q; int_least32_t a, b, c, d; for(; q > 0; --q) { cin >> a >> b >> c >> d; if((cumuSam_s[b] - cumuSam_s[a]) % 3 == (cumuSam_t[c] - cumuSam_t[d]) % 3) { cout << "YES\n"; } else { cout << "NO\n"; } } }
a.cc: In function 'int main()': a.cc:13:48: warning: narrowing conversion of 's.std::__cxx11::basic_string<char>::size()' from 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} to 'int' [-Wnarrowing] 13 | vector<int_least32_t> cumuSam_s{ s.size() }}; | ~~~~~~^~ a.cc:13:48: warning: narrowing conversion of 's.std::__cxx11::basic_string<char>::size()' from 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} to 'int' [-Wnarrowing] a.cc:13:52: error: expected ',' or ';' before '}' token 13 | vector<int_least32_t> cumuSam_s{ s.size() }}; | ^ a.cc: At global scope: a.cc:14:9: error: expected unqualified-id before 'for' 14 | for(auto i = 0, sum = 0; i < cumuSam_s.size(); ++i) { | ^~~ a.cc:14:34: error: 'i' does not name a type 14 | for(auto i = 0, sum = 0; i < cumuSam_s.size(); ++i) { | ^ a.cc:14:56: error: expected unqualified-id before '++' token 14 | for(auto i = 0, sum = 0; i < cumuSam_s.size(); ++i) { | ^~ a.cc:24:42: error: 't' was not declared in this scope; did you mean 'tm'? 24 | vector<int_least32_t> cumuSam_t{ t.size() }}; | ^ | tm a.cc:24:51: error: no matching function for call to 'std::vector<int>::vector(<brace-enclosed initializer list>)' 24 | vector<int_least32_t> cumuSam_t{ t.size() }}; | ^ In file included from /usr/include/c++/14/vector:66, from a.cc:2: /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 = int; _Alloc = std::allocator<int>]' 707 | vector(_InputIterator __first, _InputIterator __last, | ^~~~~~ /usr/include/c++/14/bits/stl_vector.h:707:9: note: candidate expects 2 arguments, 1 provided /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 = int; _Alloc = std::allocator<int>; allocator_type = std::allocator<int>]' 678 | vector(initializer_list<value_type> __l, | ^~~~~~ /usr/include/c++/14/bits/stl_vector.h:678:7: note: conversion of argument 1 would be ill-formed: /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 = int; _Alloc = std::allocator<int>; std::__type_identity_t<_Alloc> = std::allocator<int>]' 659 | vector(vector&& __rv, const __type_identity_t<allocator_type>& __m) | ^~~~~~ /usr/include/c++/14/bits/stl_vector.h:659:7: note: candidate expects 2 arguments, 1 provided /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 = int; _Alloc = std::allocator<int>; allocator_type = std::allocator<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, 1 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 = int; _Alloc = std::allocator<int>; allocator_type = std::allocator<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, 1 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 = int; _Alloc = std::allocator<int>; std::__type_identity_t<_Alloc> = std::allocator<int>]' 624 | vector(const vector& __x, const __type_identity_t<allocator_type>& __a) | ^~~~~~ /usr/include/c++/14/bits/stl_vector.h:624:7: note: candidate expects 2 arguments, 1 provided /usr/include/c++/14/bits/stl_vector.h:620:7: note: candidate: 'std::vector<_Tp, _Alloc>::vector(std::vector<_Tp, _Alloc>&&) [with _Tp = int; _Alloc = std::allocator<int>]' 620 | vector(vector&&) noexcept = default; | ^~~~~~ /usr/include/c++/14/bits/stl_vector.h:620:7: note: conversion of argument 1 would be ill-formed: /usr/include/c++/14/bits/stl_vector.h:601:7: note: candidate: 'std::vector<_Tp, _Alloc>::vector(const std::vector<_Tp, _Alloc>&) [with _Tp = int; _Alloc = std::allocator<int>]' 601 | vector(const vector& __x) | ^~~~~~ /usr/include/c++/14/bits/stl_vector.h:601:7: note: conversion of argument 1 would be ill-formed: /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 = int; _Alloc = std::allocator<int>; size_type = long unsigned int; value_type = int; allocator_type = std::allocator<int>]' 569 | vector(size_type __n, const value_type& __value, | ^~~~~~ /usr/include/c++/14/bits/stl_vector.h:569:7: note: candidate expects 3 arguments, 1 provided /usr/include/c++/14/bits/stl_vector.h:556:7: note: candidate: 'std::vector<_Tp, _Alloc>::vector(size_type, const allocator_type&) [with _Tp = int; _Alloc = std::allocator<int>; size_type = long unsigned int; allocator_type = std::allocator<int>]' 556 | vector(size_type __n, const allocator_type& __a = allocator_type()) | ^~~~~~ /usr/include/c++/14/bits/stl_vector.h:556:7: note: conversion of argument 1 would be ill-formed: /usr/include/c++/14/bits/stl_vector.h:542:7: note: candidate: 'std::vector<_Tp, _Alloc>::vector(const allocator_type&) [with _Tp = int; _Alloc = std::allocator<int>; allocator_type = std::allocator<int>]' 542 | vector(const allocator_type& __a) _GLIBCXX_NOEXCEPT | ^~~~~~ /usr/include/c++/14/bits/stl_vector.h:542:7: note: conversion of argument 1 would be ill-formed: /usr/include/c++/14/bits/stl_vector.h:531:7: note: candidate: 'std::vector<_Tp, _Alloc>::vector() [with _Tp = int; _Alloc = std::allocator<int>]' 531 | vector() = default; | ^~~~~~ /usr/include/c++/14/bits/stl_vector.h:531:7: note: candidate expects 0 arguments, 1 provided a.cc:24:52: error: expected ',' or ';' before '}' token 24 | vector<int_least32_t> cumuSam_t{ t.size() }}; | ^ a.cc:24:52: error: expected declaration before '}' token a.cc:25:9: error: expected unqualified-id before 'for' 25 | for(auto i = 0, sum = 0; i < cumuSam_t.size(); ++i) { | ^~~ a.cc:25:34: error: 'i' does not name a type 25 | for(auto i = 0, sum = 0; i < cumuSam_t.size(); ++i) { | ^ a.cc:25:56: error: expected unqualified-id before '++' token 25 | for(auto i = 0, sum = 0; i < cumuSam_t.size(); ++i) { | ^~ a.cc:36:9: error: 'cin' does not name a type 36 | cin >> q; | ^~~ a.cc:39:9: error: expected unqualified-id before 'for' 39 | for(; q > 0; --q) { | ^~~ a.cc:39:15: error: 'q' does not name a type 39 | for(; q > 0; --q) { | ^ a.cc:39:22: error: expected unqualified-id before '--' token 39 | for(; q > 0; --q) { | ^~ a.cc:48:1: error: expected declaration before '}' token 48 | } | ^
s705304185
p03765
C++
#include<iostream> #include<vector> #include<array> #include<string> #include<map> #include<numeric> #include<limits> struct mod { std::uint64_t val; void operator+=(std::uint64_t v) { val += v; val %= 1000000007; } void operator+=(mod v) { val += v.val; val %= 1000000007; } void operator*=(std::uint64_t v) { val *= v; val %= 1000000007; } void operator*=(mod v) { val *= v.val; val %= 1000000007; } }; mod operator*(mod x, mod y) { x *= y; return x; } mod operator+(mod x, mod y) { x += y; return x; } mod operator*(mod x, int y) { x *= y; return x; } mod operator+(mod x, int y) { x += y; return x; } mod operator*(int y, mod x) { x *= y; return x; } mod operator+(int y, mod x) { x += y; return x; } struct data { std::map<int, int> starts; data(std::string const& str) :starts{} { char c = str.front(); if (c == 'A') { starts[0] = 1; } else { starts[0] = 0; } for (std::size_t i = 1; i < str.size(); ++i) { if (c == 'A') { if (str[i] == 'A') { ++starts.rbegin()->second; } else { c = 'B'; } } else { if (str[i] == 'A') { starts[i] = 1; } } } starts[str.size()] = 0; } int get_cat(int start, int last) { auto ite = std::upper_bound(starts.begin(), starts.end(), std::pair<decltype(starts.begin()->first), int>(start, std::numeric_limits<int>::max())); int cat{}; while (start != last) { auto prev = std::prev(ite); int m = prev->first + prev->second; int e = std::min(ite->first, last); int a = std::max(m - start, 0) % 3; int b = std::min(e - start, e - m) % 3; cat += a + 2 * b; cat %= 3; start = e; ++ite; } return cat; } }; int main() { std::string str; std::cin >> str; data from{ str }; std::cin >> str; data to{ str }; int q; std::cin >> q; for (int i{}; i < q; ++i) { int a, b, c, d; std::cin >> a >> b >> c >> d; --a; --c; if (from.get_cat(a, b) == to.get_cat(c, d)) { std::cout << "YES" << std::endl; } else { std::cout << "NO" << std::endl; } } }
a.cc:11:14: error: 'uint64_t' in namespace 'std' does not name a type; did you mean 'wint_t'? 11 | std::uint64_t val; | ^~~~~~~~ | wint_t a.cc:12:25: error: 'std::uint64_t' has not been declared 12 | void operator+=(std::uint64_t v) | ^~~ a.cc:22:25: error: 'std::uint64_t' has not been declared 22 | void operator*=(std::uint64_t v) | ^~~ a.cc: In member function 'void mod::operator+=(int)': a.cc:14:17: error: 'val' was not declared in this scope 14 | val += v; | ^~~ a.cc: In member function 'void mod::operator+=(mod)': a.cc:19:17: error: 'val' was not declared in this scope 19 | val += v.val; | ^~~ a.cc:19:26: error: 'struct mod' has no member named 'val' 19 | val += v.val; | ^~~ a.cc: In member function 'void mod::operator*=(int)': a.cc:24:17: error: 'val' was not declared in this scope 24 | val *= v; | ^~~ a.cc: In member function 'void mod::operator*=(mod)': a.cc:29:17: error: 'val' was not declared in this scope 29 | val *= v.val; | ^~~ a.cc:29:26: error: 'struct mod' has no member named 'val' 29 | val *= v.val; | ^~~ a.cc: In member function 'int data::get_cat(int, int)': a.cc:106:33: error: 'upper_bound' is not a member of 'std'; did you mean 'lower_bound'? 106 | auto ite = std::upper_bound(starts.begin(), starts.end(), std::pair<decltype(starts.begin()->first), int>(start, std::numeric_limits<int>::max())); | ^~~~~~~~~~~ | lower_bound
s780463794
p03765
C++
#include<iostream> #include<vector> #include<array> #include<string> #include<map> #include<numeric> struct mod { std::uint64_t val; void operator+=(std::uint64_t v) { val += v; val %= 1000000007; } void operator+=(mod v) { val += v.val; val %= 1000000007; } void operator*=(std::uint64_t v) { val *= v; val %= 1000000007; } void operator*=(mod v) { val *= v.val; val %= 1000000007; } }; mod operator*(mod x, mod y) { x *= y; return x; } mod operator+(mod x, mod y) { x += y; return x; } mod operator*(mod x, int y) { x *= y; return x; } mod operator+(mod x, int y) { x += y; return x; } mod operator*(int y, mod x) { x *= y; return x; } mod operator+(int y, mod x) { x += y; return x; } struct data { std::map<int, int> starts; data(std::string const& str) :starts{} { char c = str.front(); if (c == 'A') { starts[0] = 1; } else { starts[0] = 0; } for (std::size_t i = 1; i < str.size(); ++i) { if (c == 'A') { if (str[i] == 'A') { ++starts.rbegin()->second; } else { c = 'B'; } } else { if (str[i] == 'A') { starts[i] = 1; } } } starts[str.size()] = 0; } int get_cat(int start, int last) { auto ite = std::upper_bound(starts.begin(), starts.end(), std::pair<decltype(starts.begin()->first), int>(start, std::numeric_limits<int>::max())); int cat{}; while (start != last) { auto prev = std::prev(ite); int m = prev->first + prev->second; int e = std::min(ite->first, last); int a = std::max(m - start, 0) % 3; int b = std::min(e - start, e - m) % 3; cat += a + 2 * b; cat %= 3; start = e; ++ite; } return cat; } }; int main() { std::string str; std::cin >> str; data from{ str }; std::cin >> str; data to{ str }; int q; std::cin >> q; for (int i{}; i < q; ++i) { int a, b, c, d; std::cin >> a >> b >> c >> d; --a; --c; if (from.get_cat(a, b) == to.get_cat(c, d)) { std::cout << "YES" << std::endl; } else { std::cout << "NO" << std::endl; } } }
a.cc:10:14: error: 'uint64_t' in namespace 'std' does not name a type; did you mean 'wint_t'? 10 | std::uint64_t val; | ^~~~~~~~ | wint_t a.cc:11:25: error: 'std::uint64_t' has not been declared 11 | void operator+=(std::uint64_t v) | ^~~ a.cc:21:25: error: 'std::uint64_t' has not been declared 21 | void operator*=(std::uint64_t v) | ^~~ a.cc: In member function 'void mod::operator+=(int)': a.cc:13:17: error: 'val' was not declared in this scope 13 | val += v; | ^~~ a.cc: In member function 'void mod::operator+=(mod)': a.cc:18:17: error: 'val' was not declared in this scope 18 | val += v.val; | ^~~ a.cc:18:26: error: 'struct mod' has no member named 'val' 18 | val += v.val; | ^~~ a.cc: In member function 'void mod::operator*=(int)': a.cc:23:17: error: 'val' was not declared in this scope 23 | val *= v; | ^~~ a.cc: In member function 'void mod::operator*=(mod)': a.cc:28:17: error: 'val' was not declared in this scope 28 | val *= v.val; | ^~~ a.cc:28:26: error: 'struct mod' has no member named 'val' 28 | val *= v.val; | ^~~ a.cc: In member function 'int data::get_cat(int, int)': a.cc:105:33: error: 'upper_bound' is not a member of 'std'; did you mean 'lower_bound'? 105 | auto ite = std::upper_bound(starts.begin(), starts.end(), std::pair<decltype(starts.begin()->first), int>(start, std::numeric_limits<int>::max())); | ^~~~~~~~~~~ | lower_bound a.cc:105:135: error: 'numeric_limits' is not a member of 'std' 105 | auto ite = std::upper_bound(starts.begin(), starts.end(), std::pair<decltype(starts.begin()->first), int>(start, std::numeric_limits<int>::max())); | ^~~~~~~~~~~~~~ a.cc:105:122: error: expected primary-expression before '(' token 105 | auto ite = std::upper_bound(starts.begin(), starts.end(), std::pair<decltype(starts.begin()->first), int>(start, std::numeric_limits<int>::max())); | ^ a.cc:105:135: error: 'numeric_limits' is not a member of 'std' 105 | auto ite = std::upper_bound(starts.begin(), starts.end(), std::pair<decltype(starts.begin()->first), int>(start, std::numeric_limits<int>::max())); | ^~~~~~~~~~~~~~ a.cc:105:150: error: expected primary-expression before 'int' 105 | auto ite = std::upper_bound(starts.begin(), starts.end(), std::pair<decltype(starts.begin()->first), int>(start, std::numeric_limits<int>::max())); | ^~~
s683232246
p03765
C++
#include<iostream> #include<vector> #include<array> #include<string> #include<map> struct mod { std::uint64_t val; void operator+=(std::uint64_t v) { val += v; val %= 1000000007; } void operator+=(mod v) { val += v.val; val %= 1000000007; } void operator*=(std::uint64_t v) { val *= v; val %= 1000000007; } void operator*=(mod v) { val *= v.val; val %= 1000000007; } }; mod operator*(mod x, mod y) { x *= y; return x; } mod operator+(mod x, mod y) { x += y; return x; } mod operator*(mod x, int y) { x *= y; return x; } mod operator+(mod x, int y) { x += y; return x; } mod operator*(int y, mod x) { x *= y; return x; } mod operator+(int y, mod x) { x += y; return x; } struct data { std::map<int, int> starts; data(std::string const& str) :starts{} { char c = str.front(); if (c == 'A') { starts[0] = 1; } else { starts[0] = 0; } for (std::size_t i = 1; i < str.size(); ++i) { if (c == 'A') { if (str[i] == 'A') { ++starts.rbegin()->second; } else { c = 'B'; } } else { if (str[i] == 'A') { starts[i] = 1; } } } starts[str.size()] = 0; } int get_cat(int start, int last) { auto ite = std::upper_bound(starts.begin(), starts.end(), std::pair<decltype(starts.begin()->first), int>(start, std::numeric_limits<int>::max())); int cat{}; while (start != last) { auto prev = std::prev(ite); int m = prev->first + prev->second; int e = std::min(ite->first, last); int a = std::max(m - start, 0) % 3; int b = std::min(e - start, e - m) % 3; cat += a + 2 * b; cat %= 3; start = e; ++ite; } return cat; } }; int main() { std::string str; std::cin >> str; data from{ str }; std::cin >> str; data to{ str }; int q; std::cin >> q; for (int i{}; i < q; ++i) { int a, b, c, d; std::cin >> a >> b >> c >> d; --a; --c; if (from.get_cat(a, b) == to.get_cat(c, d)) { std::cout << "YES" << std::endl; } else { std::cout << "NO" << std::endl; } } }
a.cc:9:14: error: 'uint64_t' in namespace 'std' does not name a type; did you mean 'wint_t'? 9 | std::uint64_t val; | ^~~~~~~~ | wint_t a.cc:10:25: error: 'std::uint64_t' has not been declared 10 | void operator+=(std::uint64_t v) | ^~~ a.cc:20:25: error: 'std::uint64_t' has not been declared 20 | void operator*=(std::uint64_t v) | ^~~ a.cc: In member function 'void mod::operator+=(int)': a.cc:12:17: error: 'val' was not declared in this scope 12 | val += v; | ^~~ a.cc: In member function 'void mod::operator+=(mod)': a.cc:17:17: error: 'val' was not declared in this scope 17 | val += v.val; | ^~~ a.cc:17:26: error: 'struct mod' has no member named 'val' 17 | val += v.val; | ^~~ a.cc: In member function 'void mod::operator*=(int)': a.cc:22:17: error: 'val' was not declared in this scope 22 | val *= v; | ^~~ a.cc: In member function 'void mod::operator*=(mod)': a.cc:27:17: error: 'val' was not declared in this scope 27 | val *= v.val; | ^~~ a.cc:27:26: error: 'struct mod' has no member named 'val' 27 | val *= v.val; | ^~~ a.cc: In member function 'int data::get_cat(int, int)': a.cc:104:33: error: 'upper_bound' is not a member of 'std'; did you mean 'lower_bound'? 104 | auto ite = std::upper_bound(starts.begin(), starts.end(), std::pair<decltype(starts.begin()->first), int>(start, std::numeric_limits<int>::max())); | ^~~~~~~~~~~ | lower_bound a.cc:104:135: error: 'numeric_limits' is not a member of 'std' 104 | auto ite = std::upper_bound(starts.begin(), starts.end(), std::pair<decltype(starts.begin()->first), int>(start, std::numeric_limits<int>::max())); | ^~~~~~~~~~~~~~ a.cc:104:122: error: expected primary-expression before '(' token 104 | auto ite = std::upper_bound(starts.begin(), starts.end(), std::pair<decltype(starts.begin()->first), int>(start, std::numeric_limits<int>::max())); | ^ a.cc:104:135: error: 'numeric_limits' is not a member of 'std' 104 | auto ite = std::upper_bound(starts.begin(), starts.end(), std::pair<decltype(starts.begin()->first), int>(start, std::numeric_limits<int>::max())); | ^~~~~~~~~~~~~~ a.cc:104:150: error: expected primary-expression before 'int' 104 | auto ite = std::upper_bound(starts.begin(), starts.end(), std::pair<decltype(starts.begin()->first), int>(start, std::numeric_limits<int>::max())); | ^~~
s600897113
p03765
C++
#pragma comment(linker, "/STACK:1024000000,1024000000") #include<algorithm> #include<iostream> #include<cstring> #include<fstream> #include<bitset> #include<cstdio> #include<string> #include<vector> #include<cmath> #include<queue> #include<stack> #include<map> #include<set> #define INF 0X3F3F3F3F #define N 100505 #define M 200005 #define LL long long #define FF(i,a,b) for(int i=a;i<=b;++i) #define RR(i,a,b) for(int i=a;i>=b;--i) #define FJ(i,a,b) for(int i=a;i<b;++i) #define SC(x) scanf("%d",&x) #define SCC(x,y) scanf("%d%d",&x,&y) #define SCCC(x,y,z) scanf("%d%d%d",&x,&y,&z) #define SS(x) scanf("%s",x) #define PR(x) printf("%d\n",x) #define CL(a, x) memset(a, x, sizeof(a)) #define _q fd[rt] #define _l fd[rt<<1] #define _r fd[rt<<1|1] #define MID int mid=((l+r)>>1) #define lson rt<<1,l,mid #define rson rt<<1|1,mid+1,r #define PB push_back #define SZ size #define PII pair<int,int> #define PLL pair<long long,long long> #define MP make_pair #define IN freopen("in.txt","r",stdin) #define OUT freopen("out.txt","w",stdout) using namespace std; const int MOD=1000000007; const double PI=acos(-1.0); const double EPS=1e-8; char s1[N], s2[N]; int a1[N], b1[N], a2[N], b2[N], q, x1, y1, x2, y2; int main(){ // IN; SS(s1 + 1); SS(s2 + 1); int len1 = strlen(s1 + 1); int len2 = strlen(s2 + 1); FF(i, 1, len1){ a1[i] = a1[i - 1]; b1[i] = b1[i - 1]; if(s1[i] == 'A')++a1[i]; if(s1[i] == 'B')++b1[i]; } FF(i, 1, len2){ a2[i] = a2[i - 1]; b2[i] = b2[i - 1]; if(s2[i] == 'A')++a2[i]; if(s2[i] == 'B')++b2[i]; } SC(q); FF(i, 1, q){ SCC(x1, y1); SCC(x2, y2); int A1 = a1[y1] - a1[x1 - 1]; int B1 = b1[y1] - b1[x1 - 1]; int A2 = a2[y2] - a2[x2 - 1]; int B2 = b2[y2] - b2[x2 - 1]; if(A1 > A2)B2 += (A1 - A2) % 3; else B1 += (A2 - A1) % 3; int tt = abs(B1 - B2); if(tt % 3)puts("NO"); else puts("YES"); } return 0; }
a.cc:46:40: error: 'int y1' redeclared as different kind of entity 46 | int a1[N], b1[N], a2[N], b2[N], q, x1, y1, x2, y2; | ^~ In file included from /usr/include/features.h:523, from /usr/include/x86_64-linux-gnu/c++/14/bits/os_defines.h:39, from /usr/include/x86_64-linux-gnu/c++/14/bits/c++config.h:683, from /usr/include/c++/14/bits/stl_algobase.h:59, from /usr/include/c++/14/algorithm:60, from a.cc:2: /usr/include/x86_64-linux-gnu/bits/mathcalls.h:257:1: note: previous declaration 'double y1(double)' 257 | __MATHCALL (y1,, (_Mdouble_)); | ^~~~~~~~~~ a.cc: In function 'int main()': a.cc:69:20: error: invalid types 'int [100505][double(double) noexcept]' for array subscript 69 | int A1 = a1[y1] - a1[x1 - 1]; | ^ a.cc:70:20: error: invalid types 'int [100505][double(double) noexcept]' for array subscript 70 | int B1 = b1[y1] - b1[x1 - 1]; | ^
s770553317
p03765
C++
# include <iostream> using namespace std; int main() { int cnt1[100010]; int cnt2[100010]; string s , t; cin >> s >> t; int i , length = s.length(); for (i = 0;i < length;i ++) { char ch = s[i]; if (ch == 'A') { if (i == 0) { cnt1[i] = 1; } else { cnt1[i] = cnt1[i - 1] + 1; } } else { if (i > 0) { cnt1[i] = cnt1[i - 1] - 1; } else cnt1[i] = - 1; } } length = t.length(); for (i = 0;i < length;i ++) { char ch = t[i]; if (ch == 'A') { if (i == 0) { cnt2[i] = 1; } else { cnt2[i] = cnt2[i - 1] + 1; } } else { if (i > 0) { cnt2[i] = cnt2[i - 1] - 1; } else { cnt2[i] = - 1; } } } int total; cin >> total; for (i = 0;i < total;i ++) { int l1 , r1 , l2 , r2; cin >> l1 >> r1 >> l2 >> r2; l1 --; r1 --; l2 --; r2 --; int result1 = cnt1[r1]; if (l1 - 1 >= 0) { result1 -= cnt1[l1 - 1]; } int result2 = cnt2[r2]; if (l2 - 1 >= 0) { result2 -= cnt2[l2 - 1]; } int diff = Math.abs(result1 - result2); if (diff % 3 == 0) { cout << "YES" << endl; } else { cout << "NO" << endl; } } }
a.cc: In function 'int main()': a.cc:69:36: error: 'Math' was not declared in this scope 69 | int diff = Math.abs(result1 - result2); | ^~~~
s282442665
p03766
Java
#include <bits/stdc++.h> using namespace std; #define ll long long #define MOD 1000000007 int n; ll dp[1000001]; ll exp(int r){ ll prod = 1; for(int i=1;i<=r;i++){ prod*=2; prod%=MOD; } return prod; } int main(){ cin >> n; // dp[n] = n; if(n==1){ cout << 1; } else{ ll ans = exp(n-2); ans*=n; ans%=MOD; ans*=(n-1); ans%=MOD; ans+=n; ans%=MOD; cout << ans << endl; } }
Main.java:1: error: illegal character: '#' #include <bits/stdc++.h> ^ Main.java:1: error: class, interface, enum, or record expected #include <bits/stdc++.h> ^ Main.java:3: error: illegal character: '#' #define ll long long ^ Main.java:3: error: class, interface, enum, or record expected #define ll long long ^ Main.java:4: error: illegal character: '#' #define MOD 1000000007 ^ Main.java:6: error: class, interface, enum, or record expected ll dp[1000001]; ^ Main.java:7: error: unnamed classes are a preview feature and are disabled by default. ll exp(int r){ ^ (use --enable-preview to enable unnamed classes) Main.java:17: error: not a statement cin >> n; ^ Main.java:20: error: not a statement cout << 1; ^ Main.java:30: error: not a statement cout << ans << endl; ^ 10 errors
s753827814
p03766
C++
//#pragma GCC optimize("Ofast,no-stack-protector") #pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,avx2,tune=native") #pragma GCC optimize("unroll-loops") /*#pragma GCC optimize("section-anchors") #pragma GCC optimize("profile-values,profile-reorder-functions,tracer") #pragma GCC optimize("vpt") #pragma GCC optimize("rename-registers") #pragma GCC optimize("move-loop-invariants") #pragma GCC optimize("unswitch-loops") #pragma GCC optimize("function-sections") #pragma GCC optimize("data-sections") #pragma GCC optimize("branch-target-load-optimize") #pragma GCC optimize("branch-target-load-optimize2") #pragma GCC optimize("btr-bb-exclusive")*/ //#pragma comment(linker, "/STACK:367077216") #define _CRT_SECURE_NO_WARNINGS #include <chrono> #include <set> #include <map> #include <deque> #include <string> #include <cstdint> #include <cmath> #include <queue> #include <cassert> #include <random> #include <bitset> #include <iomanip> #include <numeric> #include <time.h>////////////// #include <ctime> #include <string> #include <cstdio> #include <vector> #include <cstdlib> #include <iostream> #include <algorithm> #include <unordered_map> #include <unordered_set> //++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++ //#define endl '\n' #define mp make_pair #define pbc push_back #define pob pop_back() #define empb emplace_back #define queuel queue<long long> #define sqr(a) ((a) * (a)) #define all(x) (x).begin(), (x).end() #define rall(x) (x).rbegin(), (x).rend() #define pin(p) cin >> p.first >> p.second; #define uniq(a) sort(all(a));(a).resize(unique(all(a)) - a.begin()); #define rev(v) reverse(v.begin(), v.end()); #define sout(s, c) for (auto i : s) cout << i << c; #define pout(p) cout << p.first << " " << p.second; #define er(v, l, r) erase(v.begin() + l, v.begin() + r); #define vin(v) for (ll i = 0; i < v.size(); ++i) cin >> v[i]; #define vout(v, c) for (int i = 0; i < v.size(); ++i) cout << v[i] << c; #define pushi(v, a) for (int i = 0; i < a.size(); ++i) v.push_back(a[i]); #define fastio() ios_base::sync_with_stdio(0); cout.tie(0); cin.tie(0); srand(time(NULL)) #define dab(v) for(auto i:v)cout<<i<<' '; #define sp system("pause") //++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++ using namespace std; //++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++ typedef long long ll; typedef long double ld; typedef unsigned long long ull; //++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++ const ld EPS = 1e-10; const ld PI = acos(-1); const int MOD7 = 1000000007; const int MOD9 = 1000000009; const int mod = MOD7; const int inf = 1e9; int add(int a, int b) { a += b; if (a < 0)a += mod; if (a >= mod)a -= mod; return a; } int mul(int a, int b) { return 1ll * a * b % mod; } vector<vector<int>> aans; vector<int> now; int n; bool check() { for (int i = 0; i < n; ++i) { set<int> s; for (int x = i + 1; x <= i + now[i] &&x < n; ++x) { s.insert(now[x]); } if (s.size() > 1) return 0; } return 1; } void gen(int pos) { if (pos == n) { if (check()) aans.pbc(now); return; } for (int j = 1; j <= n; ++j) { now.pbc(j); gen(pos + 1); now.pob; } } signed main() { fastio(); cin >> n; vector<int> dp(n + 34); dp[0] = 1; dp[1] = 1; dp[2] = 1; int sum = 1; for (int i = 3; i <= n + 1; ++i) { dp[i] = add(dp[i - 1], dp[i - 2]); } for (int i = 3; i <= n + 1; ++i) dp[i] = add(dp[i], -1); /*for (int i = 1; i <= n; ++i) { cout << dp[i] << ' '; } cout << endl;*/ int ans = 0; ans = add(ans, dp[n + 1]) ; for (int i = 1; i < n; ++i) { ans = add(ans, mul(dp[i], mul(n - 1, n - 1))); } for (int i = 1; i <= n; ++i) { ans = add(ans, mul(dp[i], min(i, n - 1))); } // gen(0); coyt << ans; /*cout << ans << ' ' << aans.size() << endl; for (auto j : aans) { vout(j, ' '); cout << endl; }*/ sp; }
a.cc: In function 'int main()': a.cc:146:9: error: 'coyt' was not declared in this scope 146 | coyt << ans; | ^~~~
s450933676
p03766
C++
// you can use includes, for example: #include <iostream> #include <vector> #include <algorithm> #include <memory> #include <unordered_map> #include <algorithm> #include <unordered_map> #include <string> #include <sstream> #include <set> #include <cassert> #include <map> using namespace std; constexpr int64_t kMod = 1e9 + 7; constexpr int64_t kMaxN = 1e6 + 1; int64_t din[kMaxN][2]; std::vector<int> gen; int total = 0; void Print() { for (auto& el : gen) { cout << el << " "; } cout << endl; } bool Check(int n) { auto check_seg = [&](int l, int r) { int cur = gen[l]; for (int i = l; i <= r; i++) { if (gen[i] != cur) { return false; } } return true; }; for (int i = 0; i < n - 1; i++) { if (!check_seg(i + 1, min(i + gen[i], n - 1))) { return false; } } Print(); return true; } void Gen(int i, int n) { if (i == n) { total += Check(n); } else { for (int j = 1; j <= n; j++) { gen.push_back(j); Gen(i + 1, n); gen.pop_back(); } } } void Test(int n) { total = 0; Gen(0, n); cout << "Correct answer " << total << endl; } int main(void) { ios_base::sync_with_stdio(0); int n; cin >> n; // Test(n); din[1][0] = 1; din[1][1] = 1; for (int i = 2; i <= n; i++) { din[i][0] = din[i - 1][0]; din[i][0] += din[i - 2][1]; din[i][0] %= kMod; din[i][1] = (din[i - 1][1] + din[i - 1][0]) % kMod; } auto calc = [&](int rem) { if (rem == 0) { return 1LL; } if (rem == 1) { return n - 1LL; } int64_t sum = 0; sum += (n - 1) * 1ll * (n - 1); sum += n - (rem) + 1; sum %= kMod; return sum; }; // cout << "Din " << din[4] << endl; int64_t ans = 0; for (int i = 0; i <= n; i++) { ans += ((i == 0 ? 1LL : din[i][0]) * 1ll * calc(n - i)); // cout << i << " " << ans << endl; ans %= kMod; } cout << ans << endl; }
a.cc: In lambda function: a.cc:97:12: error: inconsistent types 'long long int' and 'long int' deduced for lambda return type 97 | return sum; | ^~~
s407901544
p03766
C++
# <bits/stdc++.h> #define ll long long #define rep2(i,a,b) for(ll i=a;i<=b;++i) #define rep(i,n) for(ll i=0;i<n;i++) #define rep3(i,a,b) for(ll i=a;i>=b;i--) #define pii pair<int,int> #define pll pair<ll,ll> #define pq priority_queue #define pb push_back #define eb emplace_back #define vec vector<int> #define vecll vector<ll> #define vecpii vector<pii> #define vec2(a,b) vector<vec>(a,vec(b)) #define vec2ll(a,b) vector<vec>(a,vecll(b)) #define vec3(a,b,c) vector<vector<vec>>(a,vec2(b,c)) #define vec3ll(a,b,c) vector<vector<vecll>>(a,vec2ll(b,c)) #define fi first #define se second #define endl "\n" #define all(c) begin(c),end(c) #define ios ios_base::sync_with_stdio(0),cin.tie(0),cout.tie(0); #define lb(c,x) distance(c.begin(),lower_bound(all(c),x)) #define ub(c,x) distance(c.begin(),upper_bound(all(c),x)) #define MM " " using namespace std; int in() {int x;cin>>x;return x;} ll lin() {ll x;cin>>x;return x;} template<class T> inline bool chmax(T& a,T b){if(a<b){a=b;return 1;}return 0;} template<class T> inline bool chmin(T& a,T b){if(a>b){a=b;return 1;}return 0;} template<class T> inline void print(pair<T,T> p){cout<<"("<<p.first<<","<<p.second<<") ";} template<class T> inline void print(vector<pair<T,T>> v){for(auto e:v)print(e); cout<<endl;} template<class T> inline void print(T v){for(auto e:v)cout<<e<<" ";cout<<endl;} const ll mod=1e9+7; ll dp[3100000]; main(){ int n=in(); ll ans=0; dp[1]=1; dp[2]=mod-1; rep2(i,1,n){ dp[i]=(dp[i]%mod+mod)%mod; dp[i]=(dp[i]+dp[i-1])%mod; ans+=(n-1)*dp[i]%mod; if(i==n){ans+=dp[i];break;} ans+=dp[i]*(n-1)%mod*(n-2)%mod; ans%=mod; dp[i+1]+=dp[i]; dp[i+2]-=dp[i]; dp[i+3]+=dp[i]; dp[i+n+2]-=dp[i]; } rep2(i,n+1,n*3){ dp[i]=(dp[i]%mod+dp[i-1]+mod)%mod; ans=(ans+dp[i])%mod;} cout<<ans<<endl; }
a.cc:1:3: error: invalid preprocessing directive #< 1 | # <bits/stdc++.h> | ^ a.cc: In function 'int in()': a.cc:27:17: error: 'cin' was not declared in this scope 27 | int in() {int x;cin>>x;return x;} | ^~~ a.cc:1:1: note: 'std::cin' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>' +++ |+#include <iostream> 1 | # <bits/stdc++.h> a.cc: In function 'long long int lin()': a.cc:28:16: error: 'cin' was not declared in this scope 28 | ll lin() {ll x;cin>>x;return x;} | ^~~ a.cc:28:16: note: 'std::cin' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>' a.cc: At global scope: a.cc:31:31: error: variable or field 'print' declared void 31 | template<class T> inline void print(pair<T,T> p){cout<<"("<<p.first<<","<<p.second<<") ";} | ^~~~~ a.cc:31:37: error: 'pair' was not declared in this scope 31 | template<class T> inline void print(pair<T,T> p){cout<<"("<<p.first<<","<<p.second<<") ";} | ^~~~ a.cc:1:1: note: 'std::pair' is defined in header '<utility>'; this is probably fixable by adding '#include <utility>' +++ |+#include <utility> 1 | # <bits/stdc++.h> a.cc:31:43: error: expected primary-expression before ',' token 31 | template<class T> inline void print(pair<T,T> p){cout<<"("<<p.first<<","<<p.second<<") ";} | ^ a.cc:31:45: error: expected primary-expression before '>' token 31 | template<class T> inline void print(pair<T,T> p){cout<<"("<<p.first<<","<<p.second<<") ";} | ^ a.cc:31:47: error: 'p' was not declared in this scope 31 | template<class T> inline void print(pair<T,T> p){cout<<"("<<p.first<<","<<p.second<<") ";} | ^ a.cc:32:31: error: variable or field 'print' declared void 32 | template<class T> inline void print(vector<pair<T,T>> v){for(auto e:v)print(e); cout<<endl;} | ^~~~~ a.cc:32:37: error: 'vector' was not declared in this scope 32 | template<class T> inline void print(vector<pair<T,T>> v){for(auto e:v)print(e); cout<<endl;} | ^~~~~~ a.cc:1:1: note: 'std::vector' is defined in header '<vector>'; this is probably fixable by adding '#include <vector>' +++ |+#include <vector> 1 | # <bits/stdc++.h> a.cc:32:44: error: 'pair' was not declared in this scope 32 | template<class T> inline void print(vector<pair<T,T>> v){for(auto e:v)print(e); cout<<endl;} | ^~~~ a.cc:32:44: note: 'std::pair' is defined in header '<utility>'; this is probably fixable by adding '#include <utility>' a.cc:32:50: error: expected primary-expression before ',' token 32 | template<class T> inline void print(vector<pair<T,T>> v){for(auto e:v)print(e); cout<<endl;} | ^ a.cc:32:52: error: expected primary-expression before '>>' token 32 | template<class T> inline void print(vector<pair<T,T>> v){for(auto e:v)print(e); cout<<endl;} | ^~ a.cc:32:55: error: 'v' was not declared in this scope 32 | template<class T> inline void print(vector<pair<T,T>> v){for(auto e:v)print(e); cout<<endl;} | ^ a.cc: In function 'void print(T)': a.cc:33:55: error: 'cout' was not declared in this scope 33 | template<class T> inline void print(T v){for(auto e:v)cout<<e<<" ";cout<<endl;} | ^~~~ a.cc:33:55: note: 'std::cout' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>' a.cc:33:68: error: 'cout' was not declared in this scope 33 | template<class T> inline void print(T v){for(auto e:v)cout<<e<<" ";cout<<endl;} | ^~~~ a.cc:33:68: note: 'std::cout' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>' a.cc: At global scope: a.cc:36:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type] 36 | main(){ | ^~~~ a.cc: In function 'int main()': a.cc:57:3: error: 'cout' was not declared in this scope 57 | cout<<ans<<endl; | ^~~~ a.cc:57:3: note: 'std::cout' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
s862023832
p03766
C++
# <bits/stdc++.h> #define ll long long #define rep2(i,a,b) for(ll i=a;i<=b;++i) #define rep(i,n) for(ll i=0;i<n;i++) #define rep3(i,a,b) for(ll i=a;i>=b;i--) #define pii pair<int,int> #define pll pair<ll,ll> #define pq priority_queue #define pb push_back #define eb emplace_back #define vec vector<int> #define vecll vector<ll> #define vecpii vector<pii> #define vec2(a,b) vector<vec>(a,vec(b)) #define vec2ll(a,b) vector<vec>(a,vecll(b)) #define vec3(a,b,c) vector<vector<vec>>(a,vec2(b,c)) #define vec3ll(a,b,c) vector<vector<vecll>>(a,vec2ll(b,c)) #define fi first #define se second #define endl "\n" #define all(c) begin(c),end(c) #define ios ios_base::sync_with_stdio(0),cin.tie(0),cout.tie(0); #define lb(c,x) distance(c.begin(),lower_bound(all(c),x)) #define ub(c,x) distance(c.begin(),upper_bound(all(c),x)) #define MM " " using namespace std; int in() {int x;cin>>x;return x;} ll lin() {ll x;cin>>x;return x;} template<class T> inline bool chmax(T& a,T b){if(a<b){a=b;return 1;}return 0;} template<class T> inline bool chmin(T& a,T b){if(a>b){a=b;return 1;}return 0;} template<class T> inline void print(pair<T,T> p){cout<<"("<<p.first<<","<<p.second<<") ";} template<class T> inline void print(vector<pair<T,T>> v){for(auto e:v)print(e); cout<<endl;} template<class T> inline void print(T v){for(auto e:v)cout<<e<<" ";cout<<endl;} const ll mod=1e9+7; ll dp[1100000]; main(){ int n=in(); ll ans=0; dp[1]=1; dp[2]=mod-1; rep2(i,1,n){ dp[i]=(dp[i]%mod+mod)%mod; dp[i]=(dp[i]+dp[i-1])%mod; ans+=(n-1)*dp[i]%mod; if(i==n){ans+=dp[i];break;} ans+=dp[i]*(n-1)%mod*(n-2)%mod; ans%=mod; dp[i+1]+=dp[i]; dp[i+2]-=dp[i]; dp[i+3]+=dp[i]; dp[i+n+2]-=dp[i]; } rep2(i,n+1,n*3){ dp[i]=(dp[i]%mod+dp[i-1]+mod)%mod; ans=(ans+dp[i])%mod;} cout<<ans<<endl; }
a.cc:1:3: error: invalid preprocessing directive #< 1 | # <bits/stdc++.h> | ^ a.cc: In function 'int in()': a.cc:27:17: error: 'cin' was not declared in this scope 27 | int in() {int x;cin>>x;return x;} | ^~~ a.cc:1:1: note: 'std::cin' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>' +++ |+#include <iostream> 1 | # <bits/stdc++.h> a.cc: In function 'long long int lin()': a.cc:28:16: error: 'cin' was not declared in this scope 28 | ll lin() {ll x;cin>>x;return x;} | ^~~ a.cc:28:16: note: 'std::cin' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>' a.cc: At global scope: a.cc:31:31: error: variable or field 'print' declared void 31 | template<class T> inline void print(pair<T,T> p){cout<<"("<<p.first<<","<<p.second<<") ";} | ^~~~~ a.cc:31:37: error: 'pair' was not declared in this scope 31 | template<class T> inline void print(pair<T,T> p){cout<<"("<<p.first<<","<<p.second<<") ";} | ^~~~ a.cc:1:1: note: 'std::pair' is defined in header '<utility>'; this is probably fixable by adding '#include <utility>' +++ |+#include <utility> 1 | # <bits/stdc++.h> a.cc:31:43: error: expected primary-expression before ',' token 31 | template<class T> inline void print(pair<T,T> p){cout<<"("<<p.first<<","<<p.second<<") ";} | ^ a.cc:31:45: error: expected primary-expression before '>' token 31 | template<class T> inline void print(pair<T,T> p){cout<<"("<<p.first<<","<<p.second<<") ";} | ^ a.cc:31:47: error: 'p' was not declared in this scope 31 | template<class T> inline void print(pair<T,T> p){cout<<"("<<p.first<<","<<p.second<<") ";} | ^ a.cc:32:31: error: variable or field 'print' declared void 32 | template<class T> inline void print(vector<pair<T,T>> v){for(auto e:v)print(e); cout<<endl;} | ^~~~~ a.cc:32:37: error: 'vector' was not declared in this scope 32 | template<class T> inline void print(vector<pair<T,T>> v){for(auto e:v)print(e); cout<<endl;} | ^~~~~~ a.cc:1:1: note: 'std::vector' is defined in header '<vector>'; this is probably fixable by adding '#include <vector>' +++ |+#include <vector> 1 | # <bits/stdc++.h> a.cc:32:44: error: 'pair' was not declared in this scope 32 | template<class T> inline void print(vector<pair<T,T>> v){for(auto e:v)print(e); cout<<endl;} | ^~~~ a.cc:32:44: note: 'std::pair' is defined in header '<utility>'; this is probably fixable by adding '#include <utility>' a.cc:32:50: error: expected primary-expression before ',' token 32 | template<class T> inline void print(vector<pair<T,T>> v){for(auto e:v)print(e); cout<<endl;} | ^ a.cc:32:52: error: expected primary-expression before '>>' token 32 | template<class T> inline void print(vector<pair<T,T>> v){for(auto e:v)print(e); cout<<endl;} | ^~ a.cc:32:55: error: 'v' was not declared in this scope 32 | template<class T> inline void print(vector<pair<T,T>> v){for(auto e:v)print(e); cout<<endl;} | ^ a.cc: In function 'void print(T)': a.cc:33:55: error: 'cout' was not declared in this scope 33 | template<class T> inline void print(T v){for(auto e:v)cout<<e<<" ";cout<<endl;} | ^~~~ a.cc:33:55: note: 'std::cout' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>' a.cc:33:68: error: 'cout' was not declared in this scope 33 | template<class T> inline void print(T v){for(auto e:v)cout<<e<<" ";cout<<endl;} | ^~~~ a.cc:33:68: note: 'std::cout' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>' a.cc: At global scope: a.cc:36:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type] 36 | main(){ | ^~~~ a.cc: In function 'int main()': a.cc:57:3: error: 'cout' was not declared in this scope 57 | cout<<ans<<endl; | ^~~~ a.cc:57:3: note: 'std::cout' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
s718869137
p03766
C++
#include <bits/stdc++.h> using namespace std; #define MAX 1000010 #define mod 1000000007 typedef long long ll; int n,f[MAX],ad; int main() { scanf("%d",&n); f[n]=n; f[n-1]=(ll)n*n%mod; for(int i=n-2;i>=1;--i) { ad=(ad+f[i+3])%mod; f[i]=f[i+1]; f[i]=(f[i]+(ll)(n-1)*(n-1)%mod)%mod; f[i]=(f[i]+add)%mod; f[i]=(f[i]+i+1)%mod; } printf("%d\n",f[1]); }
a.cc: In function 'int main()': a.cc:18:20: error: 'add' was not declared in this scope; did you mean 'std::filesystem::perm_options::add'? 18 | f[i]=(f[i]+add)%mod; | ^~~ | std::filesystem::perm_options::add In file included from /usr/include/c++/14/filesystem:51, from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:200, from a.cc:1: /usr/include/c++/14/bits/fs_fwd.h:219:7: note: 'std::filesystem::perm_options::add' declared here 219 | add = 0x2, | ^~~
s395304403
p03766
C++
#include <bits/stdc++.h> using namespace std; int n, dp[1000005], cnt; int main() { cin >> n; dp[n] = n; dp[n-1]=(long long)n * n % 1000000007; for(int i = n - 2; i >= 1; --i) { cnt = (cnt + dp[i+3]) % 1000000007; dp[i] = dp[i+1]; dp[i] = (dp[i] + (long long)(n-1) * (n-1) % 1000000007) % 1000000007; dp[i] = (dp[i] + add) % 1000000007; dp[i] = (dp[i] + i + 1) % 1000000007; } cout << dp[n]; return 0; }
a.cc: In function 'int main()': a.cc:14:26: error: 'add' was not declared in this scope; did you mean 'std::filesystem::perm_options::add'? 14 | dp[i] = (dp[i] + add) % 1000000007; | ^~~ | std::filesystem::perm_options::add In file included from /usr/include/c++/14/filesystem:51, from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:200, from a.cc:1: /usr/include/c++/14/bits/fs_fwd.h:219:7: note: 'std::filesystem::perm_options::add' declared here 219 | add = 0x2, | ^~~
s969824862
p03766
C++
#include <bits/stdc++.h> using namespace std; int n, dp[1000005], cnt; int main() { cin >> n; dp[n] = n; dp[n-1]=(long long)n * n % mod; for(int i=n-2;i>=1;--i) { cnt = (cnt + dp[i+3]) % 1000000007; dp[i] = dp[i+1]; dp[i] = (dp[i] + (long long)(n-1) * (n-1) % mod) % mod; dp[i] = (dp[i] + add) % 1000000007; dp[i] = (dp[i] + i + 1) % 1000000007; } cout << dp[n]; return 0; }
a.cc: In function 'int main()': a.cc:8:32: error: 'mod' was not declared in this scope; did you mean 'modf'? 8 | dp[n-1]=(long long)n * n % mod; | ^~~ | modf a.cc:14:26: error: 'add' was not declared in this scope; did you mean 'std::filesystem::perm_options::add'? 14 | dp[i] = (dp[i] + add) % 1000000007; | ^~~ | std::filesystem::perm_options::add In file included from /usr/include/c++/14/filesystem:51, from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:200, from a.cc:1: /usr/include/c++/14/bits/fs_fwd.h:219:7: note: 'std::filesystem::perm_options::add' declared here 219 | add = 0x2, | ^~~
s102919944
p03766
C++
#include<iostream> int main(){ long long n,i,mod=1000000007; con>>n; long long ans=1; for(i=0;i<n;i++) ans=ans*2%mod; cout<<ans<<endl; }
a.cc: In function 'int main()': a.cc:4:3: error: 'con' was not declared in this scope 4 | con>>n; | ^~~ a.cc:8:3: error: 'cout' was not declared in this scope; did you mean 'std::cout'? 8 | cout<<ans<<endl; | ^~~~ | std::cout In file included from a.cc:1: /usr/include/c++/14/iostream:63:18: note: 'std::cout' declared here 63 | extern ostream cout; ///< Linked to standard output | ^~~~ a.cc:8:14: error: 'endl' was not declared in this scope; did you mean 'std::endl'? 8 | cout<<ans<<endl; | ^~~~ | std::endl In file included from /usr/include/c++/14/iostream:41: /usr/include/c++/14/ostream:744:5: note: 'std::endl' declared here 744 | endl(basic_ostream<_CharT, _Traits>& __os) | ^~~~
s116474532
p03766
C++
#include<stdio.h> #define LL long long const int N=1e6+10,mod=1e9+7; int n,m,f[N],ans; il LL rd() { LL x=0,w=1;char ch=0; while(ch<'0'||ch>'9') {if(ch=='-') w=-1;ch=getchar();} while(ch>='0'&&ch<='9') {x=(x<<3)+(x<<1)+(ch^48);ch=getchar();} return x*w; } int main() { m=(1ll*(n-1)*(n-1))%mod; ans=m+1+(n>2); int sm=f[0]=1; for(int i=1;i<n;++i) { f[i]=sm; if(i-2>=0) f[i]=(f[i]-f[i-2]+mod)%mod; sm=(sm+f[i])%mod; if(i!=n-1) ans=(ans+1ll*f[i]*(m+min(i+2,n-1))%mod)%mod; else ans=(ans+1ll*f[i]*n%mod)%mod; } printf("%d\n",ans); return 0; }
a.cc:5:1: error: 'il' does not name a type 5 | il LL rd() | ^~ a.cc: In function 'int main()': a.cc:22:41: error: 'min' was not declared in this scope; did you mean 'main'? 22 | if(i!=n-1) ans=(ans+1ll*f[i]*(m+min(i+2,n-1))%mod)%mod; | ^~~ | main
s252723592
p03766
C++
#include<stdio.h> #define LL long long const int N=1e6+10,mod=1e9+7; int n,m,f[N],ans; il LL rd() { LL x=0,w=1;char ch=0; while(ch<'0'||ch>'9') {if(ch=='-') w=-1;ch=getchar();} while(ch>='0'&&ch<='9') {x=(x<<3)+(x<<1)+(ch^48);ch=getchar();} return x*w; } int main() { m=(1ll*(n-1)*(n-1))%mod; ans=m+1+(n>2); int sm=f[0]=1; for(int i=1;i<n;++i) { f[i]=sm; if(i-2>=0) f[i]=(f[i]-f[i-2]+mod)%mod; sm=(sm+f[i])%mod; if(i!=n-1) ans=(ans+1ll*f[i]*(m+min(i+2,n-1))%mod)%mod; //乘的东西代表的分别是xyyyy和x1111 else ans=(ans+1ll*f[i]*n%mod)%mod; } printf("%d\n",ans); return 0; }
a.cc:5:1: error: 'il' does not name a type 5 | il LL rd() | ^~ a.cc: In function 'int main()': a.cc:22:41: error: 'min' was not declared in this scope; did you mean 'main'? 22 | if(i!=n-1) ans=(ans+1ll*f[i]*(m+min(i+2,n-1))%mod)%mod; //乘的东西代表的分别是xyyyy和x1111 | ^~~ | main
s490193422
p03766
C++
#include<stdio.h> #define LL long long const int N=1e6+10,mod=1e9+7; int n,m,f[N],ans; int main() { m=(1ll*(n-1)*(n-1))%mod; ans=m+1+(n>2); int sm=f[0]=1; for(int i=1;i<n;++i) { f[i]=sm; if(i-2>=0) f[i]=(f[i]-f[i-2]+mod)%mod; sm=(sm+f[i])%mod; if(i!=n-1) ans=(ans+1ll*f[i]*(m+min(i+2,n-1))%mod)%mod; //乘的东西代表的分别是xyyyy和x1111 else ans=(ans+1ll*f[i]*n%mod)%mod; } printf("%d\n",ans); return 0; }
a.cc: In function 'int main()': a.cc:15:41: error: 'min' was not declared in this scope; did you mean 'main'? 15 | if(i!=n-1) ans=(ans+1ll*f[i]*(m+min(i+2,n-1))%mod)%mod; //乘的东西代表的分别是xyyyy和x1111 | ^~~ | main
s693168366
p03766
C++
#include <bits/stdc++.h> using namespace std; long long n,f[1000010],add,i; int main() { scanf("%d",&n); f[n]=n; f[n-1]=pow(n,2)%1000000007; for(i=n-2;i>2;--i) add=(add+f[i+3])%1000000007,f[i]=f[i+1],f[i]=(f[i]+pow((n-1),2)%1000000007)%1000000007,f[i]=(f[i]+add)%mod,f[i]=(f[i]+i+1)%1000000007; f[i]=(f[i]+pow((n-1),2))%1000000007)%1000000007; f[i]=(f[i]+i+1)%1000000007; } cout<<f[1]<<endl; }
a.cc: In function 'int main()': a.cc:8:20: error: invalid operands of types '__gnu_cxx::__promote<double>::__type' {aka 'double'} and 'int' to binary 'operator%' 8 | f[n-1]=pow(n,2)%1000000007; | ~~~~~~~~^~~~~~~~~~~ | | | | | int | __gnu_cxx::__promote<double>::__type {aka double} a.cc:10:72: error: invalid operands of types '__gnu_cxx::__promote<double>::__type' {aka 'double'} and 'int' to binary 'operator%' 10 | add=(add+f[i+3])%1000000007,f[i]=f[i+1],f[i]=(f[i]+pow((n-1),2)%1000000007)%1000000007,f[i]=(f[i]+add)%mod,f[i]=(f[i]+i+1)%1000000007; | ~~~~~~~~~~~~^~~~~~~~~~~ | | | | | int | __gnu_cxx::__promote<double>::__type {aka double} a.cc:10:112: error: 'mod' was not declared in this scope; did you mean 'modf'? 10 | add=(add+f[i+3])%1000000007,f[i]=f[i+1],f[i]=(f[i]+pow((n-1),2)%1000000007)%1000000007,f[i]=(f[i]+add)%mod,f[i]=(f[i]+i+1)%1000000007; | ^~~ | modf a.cc:11:33: error: invalid operands of types '__gnu_cxx::__promote<double>::__type' {aka 'double'} and 'int' to binary 'operator%' 11 | f[i]=(f[i]+pow((n-1),2))%1000000007)%1000000007; | ~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~ | | | | | int | __gnu_cxx::__promote<double>::__type {aka double} a.cc: At global scope: a.cc:14:5: error: 'cout' does not name a type 14 | cout<<f[1]<<endl; | ^~~~ a.cc:15:1: error: expected declaration before '}' token 15 | } | ^
s138853117
p03766
C++
#include <bits/stdc++.h> int n,f[1000001],add; int main(){ scanf("%d",&n);f[n]=n;f[n-1]=(long long)n*n%mod; for(register int i=n-2;i>=1;--i){ add=(add+f[i+3])%1000000007; f[i]=f[i+1]; f[i]=(f[i]+(long long)(n-1)*(n-1)%1000000007)%1000000007; f[i]=(f[i]+add)%1000000007; f[i]=(f[i]+i+1)%1000000007; } printf("%d\n",f[1]); }
a.cc: In function 'int main()': a.cc:4:49: error: 'mod' was not declared in this scope; did you mean 'modf'? 4 | scanf("%d",&n);f[n]=n;f[n-1]=(long long)n*n%mod; | ^~~ | modf a.cc:5:22: warning: ISO C++17 does not allow 'register' storage class specifier [-Wregister] 5 | for(register int i=n-2;i>=1;--i){ | ^
s625402180
p03766
C++
654321
a.cc:1:1: error: expected unqualified-id before numeric constant 1 | 654321 | ^~~~~~
s887899864
p03766
C++
#include<cstdio> #include<cstring> #include<algorithm> #define MN 1000005 #define mod 1000000007 using namespace std; inline int in(){ int x=0;bool f=0; char c; for (;(c=getchar())<'0'||c>'9';f=c=='-'); for (x=c-'0';(c=getchar())>='0'&&c<='9';x=(x<<3)+(x<<1)+c-'0'); return f?-x:x; } int f[MN],sum[MN<<1+10],n,res; int main() { n=in();f[n+1]=1; for (int i=(n<<1)+10;i>n;--i) sum[i]=(sum[i+1]+1)%mod; for (int i=n;i;--i){ f[i]=(sum[i+3]+mod-sum[i+n+2])%mod; f[i]=(f[i]+f[i+1])%mod; if (i!=n) f[i]=(f[i]+(1ll*(n-1)*(n+mod-1)))%mod; sum[i]=(sum[i+1]+f[i])%mod; }printf("%d",f[1]);return 0; }
/tmp/ccemiObS.o: in function `main': a.cc:(.text+0xf): relocation truncated to fit: R_X86_64_PC32 against symbol `n' defined in .bss section in /tmp/ccemiObS.o a.cc:(.text+0x15): relocation truncated to fit: R_X86_64_PC32 against symbol `n' defined in .bss section in /tmp/ccemiObS.o a.cc:(.text+0x36): relocation truncated to fit: R_X86_64_PC32 against symbol `n' defined in .bss section in /tmp/ccemiObS.o a.cc:(.text+0xa1): relocation truncated to fit: R_X86_64_PC32 against symbol `n' defined in .bss section in /tmp/ccemiObS.o a.cc:(.text+0xac): relocation truncated to fit: R_X86_64_PC32 against symbol `n' defined in .bss section in /tmp/ccemiObS.o a.cc:(.text+0xda): relocation truncated to fit: R_X86_64_PC32 against symbol `n' defined in .bss section in /tmp/ccemiObS.o a.cc:(.text+0x1a7): relocation truncated to fit: R_X86_64_PC32 against symbol `n' defined in .bss section in /tmp/ccemiObS.o a.cc:(.text+0x1d0): relocation truncated to fit: R_X86_64_PC32 against symbol `n' defined in .bss section in /tmp/ccemiObS.o a.cc:(.text+0x1dc): relocation truncated to fit: R_X86_64_PC32 against symbol `n' defined in .bss section in /tmp/ccemiObS.o collect2: error: ld returned 1 exit status
s966350203
p03766
C++
#include<bits/stdc++.h> using namespace std; #define For(i , j , k) for (register int i = (j) , i##_end_ = (k) ; i <= i##_end_ ; ++ i) #define Mod (1000000007) typedef long long LL; int _ , __; char c_; inline int read() { for (_ = 0 , __ = 1 , c_ = getchar() ; !isdigit(c_) ; c_ = getchar()) if (c_ == '-') __ = -1; for ( ; isdigit(c_) ; c_ = getchar()) _ = (_ << 1) + (_ << 3) + (c_ ^ 48); return _ * __; } const int maxn = 1000010; int n, dp[maxn], Ans, pre[maxn]; inline void mod(int &x) { if (x >= Mod) x -= Mod; } int main() { n = read(); dp[0] = 1; pre[0] = 1; Ans = (LL)(n - 1) * (LL)(n - 1) % Mod; For(i, 1, n - 1) { dp[i] = dp[i - 1] + (i - 3 >= 0 ? pre[i - 3] : 0); mod(dp[i]); pre[i] = pre[i - 1] + dp[i]; mod(pre[i]); if (i < n - 1) Ans += (LL)dp[i] * (LL)(n - 1) % Mod * (LL)(n - 1) % Mod, mod(Ans); else Ans += (LL)dp[i] * (LL)(n - 1) % Mod, mod(Ans); } For(i, 0, n - 2) { int x = i + 3, y = i + n + 1, z; if (x <= n) z = y - n + 1; else z = y - x + 1; dp[n] += (LL)dp[i] * z % Mod, mod(dp[n]); } dp[n] += dp[n - 1]; mod(dp[n]); Ans += dp[n]; mod(Ans); printf("%d\n", Ans); return 0; }
a.cc:2:22: error: stray '#' in program 2 | using namespace std; #define For(i , j , k) for (register int i = (j) , i##_end_ = (k) ; i <= i##_end_ ; ++ i) #define Mod (1000000007) typedef long long LL; int _ , __; char c_; inline int read() { for (_ = 0 , __ = 1 , c_ = getchar() ; !isdigit(c_) ; c_ = getchar()) if (c_ == '-') __ = -1; for ( ; isdigit(c_) ; c_ = getchar()) _ = (_ << 1) + (_ << 3) + (c_ ^ 48); return _ * __; } const int maxn = 1000010; int n, dp[maxn], Ans, pre[maxn]; inline void mod(int &x) { if (x >= Mod) x -= Mod; } int main() { n = read(); dp[0] = 1; pre[0] = 1; Ans = (LL)(n - 1) * (LL)(n - 1) % Mod; For(i, 1, n - 1) { dp[i] = dp[i - 1] + (i - 3 >= 0 ? pre[i - 3] : 0); mod(dp[i]); pre[i] = pre[i - 1] + dp[i]; mod(pre[i]); if (i < n - 1) Ans += (LL)dp[i] * (LL)(n - 1) % Mod * (LL)(n - 1) % Mod, mod(Ans); else Ans += (LL)dp[i] * (LL)(n - 1) % Mod, mod(Ans); } For(i, 0, n - 2) { int x = i + 3, y = i + n + 1, z; if (x <= n) z = y - n + 1; else z = y - x + 1; dp[n] += (LL)dp[i] * z % Mod, mod(dp[n]); } dp[n] += dp[n - 1]; mod(dp[n]); Ans += dp[n]; mod(Ans); printf("%d\n", Ans); return 0; } | ^ a.cc:2:74: error: stray '##' in program 2 | using namespace std; #define For(i , j , k) for (register int i = (j) , i##_end_ = (k) ; i <= i##_end_ ; ++ i) #define Mod (1000000007) typedef long long LL; int _ , __; char c_; inline int read() { for (_ = 0 , __ = 1 , c_ = getchar() ; !isdigit(c_) ; c_ = getchar()) if (c_ == '-') __ = -1; for ( ; isdigit(c_) ; c_ = getchar()) _ = (_ << 1) + (_ << 3) + (c_ ^ 48); return _ * __; } const int maxn = 1000010; int n, dp[maxn], Ans, pre[maxn]; inline void mod(int &x) { if (x >= Mod) x -= Mod; } int main() { n = read(); dp[0] = 1; pre[0] = 1; Ans = (LL)(n - 1) * (LL)(n - 1) % Mod; For(i, 1, n - 1) { dp[i] = dp[i - 1] + (i - 3 >= 0 ? pre[i - 3] : 0); mod(dp[i]); pre[i] = pre[i - 1] + dp[i]; mod(pre[i]); if (i < n - 1) Ans += (LL)dp[i] * (LL)(n - 1) % Mod * (LL)(n - 1) % Mod, mod(Ans); else Ans += (LL)dp[i] * (LL)(n - 1) % Mod, mod(Ans); } For(i, 0, n - 2) { int x = i + 3, y = i + n + 1, z; if (x <= n) z = y - n + 1; else z = y - x + 1; dp[n] += (LL)dp[i] * z % Mod, mod(dp[n]); } dp[n] += dp[n - 1]; mod(dp[n]); Ans += dp[n]; mod(Ans); printf("%d\n", Ans); return 0; } | ^~ a.cc:2:96: error: stray '##' in program 2 | using namespace std; #define For(i , j , k) for (register int i = (j) , i##_end_ = (k) ; i <= i##_end_ ; ++ i) #define Mod (1000000007) typedef long long LL; int _ , __; char c_; inline int read() { for (_ = 0 , __ = 1 , c_ = getchar() ; !isdigit(c_) ; c_ = getchar()) if (c_ == '-') __ = -1; for ( ; isdigit(c_) ; c_ = getchar()) _ = (_ << 1) + (_ << 3) + (c_ ^ 48); return _ * __; } const int maxn = 1000010; int n, dp[maxn], Ans, pre[maxn]; inline void mod(int &x) { if (x >= Mod) x -= Mod; } int main() { n = read(); dp[0] = 1; pre[0] = 1; Ans = (LL)(n - 1) * (LL)(n - 1) % Mod; For(i, 1, n - 1) { dp[i] = dp[i - 1] + (i - 3 >= 0 ? pre[i - 3] : 0); mod(dp[i]); pre[i] = pre[i - 1] + dp[i]; mod(pre[i]); if (i < n - 1) Ans += (LL)dp[i] * (LL)(n - 1) % Mod * (LL)(n - 1) % Mod, mod(Ans); else Ans += (LL)dp[i] * (LL)(n - 1) % Mod, mod(Ans); } For(i, 0, n - 2) { int x = i + 3, y = i + n + 1, z; if (x <= n) z = y - n + 1; else z = y - x + 1; dp[n] += (LL)dp[i] * z % Mod, mod(dp[n]); } dp[n] += dp[n - 1]; mod(dp[n]); Ans += dp[n]; mod(Ans); printf("%d\n", Ans); return 0; } | ^~ a.cc:2:112: error: stray '#' in program 2 | using namespace std; #define For(i , j , k) for (register int i = (j) , i##_end_ = (k) ; i <= i##_end_ ; ++ i) #define Mod (1000000007) typedef long long LL; int _ , __; char c_; inline int read() { for (_ = 0 , __ = 1 , c_ = getchar() ; !isdigit(c_) ; c_ = getchar()) if (c_ == '-') __ = -1; for ( ; isdigit(c_) ; c_ = getchar()) _ = (_ << 1) + (_ << 3) + (c_ ^ 48); return _ * __; } const int maxn = 1000010; int n, dp[maxn], Ans, pre[maxn]; inline void mod(int &x) { if (x >= Mod) x -= Mod; } int main() { n = read(); dp[0] = 1; pre[0] = 1; Ans = (LL)(n - 1) * (LL)(n - 1) % Mod; For(i, 1, n - 1) { dp[i] = dp[i - 1] + (i - 3 >= 0 ? pre[i - 3] : 0); mod(dp[i]); pre[i] = pre[i - 1] + dp[i]; mod(pre[i]); if (i < n - 1) Ans += (LL)dp[i] * (LL)(n - 1) % Mod * (LL)(n - 1) % Mod, mod(Ans); else Ans += (LL)dp[i] * (LL)(n - 1) % Mod, mod(Ans); } For(i, 0, n - 2) { int x = i + 3, y = i + n + 1, z; if (x <= n) z = y - n + 1; else z = y - x + 1; dp[n] += (LL)dp[i] * z % Mod, mod(dp[n]); } dp[n] += dp[n - 1]; mod(dp[n]); Ans += dp[n]; mod(Ans); printf("%d\n", Ans); return 0; } | ^ a.cc:2:23: error: 'define' does not name a type 2 | using namespace std; #define For(i , j , k) for (register int i = (j) , i##_end_ = (k) ; i <= i##_end_ ; ++ i) #define Mod (1000000007) typedef long long LL; int _ , __; char c_; inline int read() { for (_ = 0 , __ = 1 , c_ = getchar() ; !isdigit(c_) ; c_ = getchar()) if (c_ == '-') __ = -1; for ( ; isdigit(c_) ; c_ = getchar()) _ = (_ << 1) + (_ << 3) + (c_ ^ 48); return _ * __; } const int maxn = 1000010; int n, dp[maxn], Ans, pre[maxn]; inline void mod(int &x) { if (x >= Mod) x -= Mod; } int main() { n = read(); dp[0] = 1; pre[0] = 1; Ans = (LL)(n - 1) * (LL)(n - 1) % Mod; For(i, 1, n - 1) { dp[i] = dp[i - 1] + (i - 3 >= 0 ? pre[i - 3] : 0); mod(dp[i]); pre[i] = pre[i - 1] + dp[i]; mod(pre[i]); if (i < n - 1) Ans += (LL)dp[i] * (LL)(n - 1) % Mod * (LL)(n - 1) % Mod, mod(Ans); else Ans += (LL)dp[i] * (LL)(n - 1) % Mod, mod(Ans); } For(i, 0, n - 2) { int x = i + 3, y = i + n + 1, z; if (x <= n) z = y - n + 1; else z = y - x + 1; dp[n] += (LL)dp[i] * z % Mod, mod(dp[n]); } dp[n] += dp[n - 1]; mod(dp[n]); Ans += dp[n]; mod(Ans); printf("%d\n", Ans); return 0; } | ^~~~~~ a.cc:2:90: error: 'i' does not name a type 2 | using namespace std; #define For(i , j , k) for (register int i = (j) , i##_end_ = (k) ; i <= i##_end_ ; ++ i) #define Mod (1000000007) typedef long long LL; int _ , __; char c_; inline int read() { for (_ = 0 , __ = 1 , c_ = getchar() ; !isdigit(c_) ; c_ = getchar()) if (c_ == '-') __ = -1; for ( ; isdigit(c_) ; c_ = getchar()) _ = (_ << 1) + (_ << 3) + (c_ ^ 48); return _ * __; } const int maxn = 1000010; int n, dp[maxn], Ans, pre[maxn]; inline void mod(int &x) { if (x >= Mod) x -= Mod; } int main() { n = read(); dp[0] = 1; pre[0] = 1; Ans = (LL)(n - 1) * (LL)(n - 1) % Mod; For(i, 1, n - 1) { dp[i] = dp[i - 1] + (i - 3 >= 0 ? pre[i - 3] : 0); mod(dp[i]); pre[i] = pre[i - 1] + dp[i]; mod(pre[i]); if (i < n - 1) Ans += (LL)dp[i] * (LL)(n - 1) % Mod * (LL)(n - 1) % Mod, mod(Ans); else Ans += (LL)dp[i] * (LL)(n - 1) % Mod, mod(Ans); } For(i, 0, n - 2) { int x = i + 3, y = i + n + 1, z; if (x <= n) z = y - n + 1; else z = y - x + 1; dp[n] += (LL)dp[i] * z % Mod, mod(dp[n]); } dp[n] += dp[n - 1]; mod(dp[n]); Ans += dp[n]; mod(Ans); printf("%d\n", Ans); return 0; } | ^ a.cc:2:106: error: expected unqualified-id before '++' token 2 | using namespace std; #define For(i , j , k) for (register int i = (j) , i##_end_ = (k) ; i <= i##_end_ ; ++ i) #define Mod (1000000007) typedef long long LL; int _ , __; char c_; inline int read() { for (_ = 0 , __ = 1 , c_ = getchar() ; !isdigit(c_) ; c_ = getchar()) if (c_ == '-') __ = -1; for ( ; isdigit(c_) ; c_ = getchar()) _ = (_ << 1) + (_ << 3) + (c_ ^ 48); return _ * __; } const int maxn = 1000010; int n, dp[maxn], Ans, pre[maxn]; inline void mod(int &x) { if (x >= Mod) x -= Mod; } int main() { n = read(); dp[0] = 1; pre[0] = 1; Ans = (LL)(n - 1) * (LL)(n - 1) % Mod; For(i, 1, n - 1) { dp[i] = dp[i - 1] + (i - 3 >= 0 ? pre[i - 3] : 0); mod(dp[i]); pre[i] = pre[i - 1] + dp[i]; mod(pre[i]); if (i < n - 1) Ans += (LL)dp[i] * (LL)(n - 1) % Mod * (LL)(n - 1) % Mod, mod(Ans); else Ans += (LL)dp[i] * (LL)(n - 1) % Mod, mod(Ans); } For(i, 0, n - 2) { int x = i + 3, y = i + n + 1, z; if (x <= n) z = y - n + 1; else z = y - x + 1; dp[n] += (LL)dp[i] * z % Mod, mod(dp[n]); } dp[n] += dp[n - 1]; mod(dp[n]); Ans += dp[n]; mod(Ans); printf("%d\n", Ans); return 0; } | ^~ a.cc: In function 'void mod(int&)': a.cc:2:480: error: 'Mod' was not declared in this scope; did you mean 'mod'? 2 | using namespace std; #define For(i , j , k) for (register int i = (j) , i##_end_ = (k) ; i <= i##_end_ ; ++ i) #define Mod (1000000007) typedef long long LL; int _ , __; char c_; inline int read() { for (_ = 0 , __ = 1 , c_ = getchar() ; !isdigit(c_) ; c_ = getchar()) if (c_ == '-') __ = -1; for ( ; isdigit(c_) ; c_ = getchar()) _ = (_ << 1) + (_ << 3) + (c_ ^ 48); return _ * __; } const int maxn = 1000010; int n, dp[maxn], Ans, pre[maxn]; inline void mod(int &x) { if (x >= Mod) x -= Mod; } int main() { n = read(); dp[0] = 1; pre[0] = 1; Ans = (LL)(n - 1) * (LL)(n - 1) % Mod; For(i, 1, n - 1) { dp[i] = dp[i - 1] + (i - 3 >= 0 ? pre[i - 3] : 0); mod(dp[i]); pre[i] = pre[i - 1] + dp[i]; mod(pre[i]); if (i < n - 1) Ans += (LL)dp[i] * (LL)(n - 1) % Mod * (LL)(n - 1) % Mod, mod(Ans); else Ans += (LL)dp[i] * (LL)(n - 1) % Mod, mod(Ans); } For(i, 0, n - 2) { int x = i + 3, y = i + n + 1, z; if (x <= n) z = y - n + 1; else z = y - x + 1; dp[n] += (LL)dp[i] * z % Mod, mod(dp[n]); } dp[n] += dp[n - 1]; mod(dp[n]); Ans += dp[n]; mod(Ans); printf("%d\n", Ans); return 0; } | ^~~ |
s770933248
p03766
C++
#pragma GCC optimize(3) #include<bits/stdc++.h> using namespace std; typedef long long ll; bool Finish_read; template<class T>inline void read(T &x){Finish_read=0;x=0;int f=1;char ch=getchar();while(!isdigit(ch)){if(ch=='-')f=-1;if(ch==EOF)return;ch=getchar();}while(isdigit(ch))x=x*10+ch-'0',ch=getchar();x*=f;Finish_read=1;} template<class T>inline void print(T x){if(x/10!=0)print(x/10);putchar(x%10+'0');} template<class T>inline void writeln(T x){if(x<0)putchar('-');x=abs(x);print(x);putchar('\n');} template<class T>inline void write(T x){if(x<0)putchar('-');x=abs(x);print(x);} /*================Header Template==============*/ const int maxn=1000010; const ll mod=1e9+7; int n; ll pre=1,tmp,f[maxn]; int main() { read(n); tmp=1LL*n*(n-1)%mod; f[1]=n; f[2]=1LL*n*n%mod; for(int i=3;i<=n;i++) { f[i]=(f[i-1]+pre+tmp-(i-2))%mod; (pre+=f[i-2])%=mod; } writeln(f[n]%mod);2 return 0; }
a.cc: In function 'int main()': a.cc:24:28: error: expected ';' before 'return' 24 | writeln(f[n]%mod);2 | ^ | ; 25 | return 0; | ~~~~~~
s958759846
p03766
C++
int main() { puts("12"); return 0; }
a.cc: In function 'int main()': a.cc:3:1: error: 'puts' was not declared in this scope 3 | puts("12"); | ^~~~
s953253526
p03766
C++
#include <cstdio> #include <cstdlib> #include <cstring> #include <iostream> #include <vector> #include <string> #include <algorithm> #include <stack> #include <queue> #include <set> #include <map> using namespace std; typedef __int64 LL; typedef vector<int> ivec; typedef vector<string> svec; int a[100010]; int dp2[100010],dp1[100010]; int main(){ const int mod=1000000007; int n; int ans=0; LL a=1,b; cin>>n; //dp[1]=1,dp[1]=0; for(int i=2;i<n;i++)a*=2,a=a%mod; cout<<(a*n*n-(a-1)*n)%mod<<endl; return 0; }
a.cc:13:9: error: '__int64' does not name a type; did you mean '__int64_t'? 13 | typedef __int64 LL; | ^~~~~~~ | __int64_t a.cc: In function 'int main()': a.cc:23:9: error: 'LL' was not declared in this scope 23 | LL a=1,b; | ^~ a.cc:26:30: error: invalid operands of types 'int [100010]' and 'int' to binary 'operator*' 26 | for(int i=2;i<n;i++)a*=2,a=a%mod; | ~^~~ a.cc:26:30: note: in evaluation of 'operator*=(int [100010], int)' a.cc:26:37: error: invalid operands of types 'int [100010]' and 'const int' to binary 'operator%' 26 | for(int i=2;i<n;i++)a*=2,a=a%mod; | ~^~~~ | | | | | const int | int [100010] a.cc:27:17: error: invalid operands of types 'int [100010]' and 'int' to binary 'operator*' 27 | cout<<(a*n*n-(a-1)*n)%mod<<endl; | ~^~ | | | | | int | int [100010] a.cc:27:27: error: invalid operands of types 'int*' and 'int' to binary 'operator*' 27 | cout<<(a*n*n-(a-1)*n)%mod<<endl; | ~~~~~^~ | | | | | int | int*
s427511301
p03766
C++
n = int(raw_input()) d = [n] * n t = n for i in xrange(1, n): d[i] = t t += d[i] print t % 1000000007
a.cc:1:1: error: 'n' does not name a type 1 | n = int(raw_input()) | ^
s926960033
p03766
C++
陈涵 2017-4-8 21:37:31 #include <bits/stdc++.h> #define LL long long #define INF 0x3f3f3f3f using namespace std; template<class T> inline void read(T& x) { int f = 1; x = 0; char ch = getchar(); while (ch < '0' || ch > '9') {if (ch == '-') f = -1; ch = getchar();} while (ch >= '0' && ch <= '9') {x = x * 10 + ch - '0'; ch = getchar();} x *= f; } /*============ Header Template ============*/ const int N = 1000000 + 5; const int mo = 1000000007; LL n, m, q; LL f[N], s[N]; int main() { read(n); f[0] = 1; f[1] = n; f[2] = n * n % mo; s[0] = 1; s[1] = s[0] + f[1]; s[2] = s[1] + f[2]; for (int i = 3; i <= n; i++) { f[i] = s[i - 1] - f[i - 2]; (f[i] += (n - 1) * (n - 1) % mo) %= mo; (f[i] += n - (i - 1)) %= mo; s[i] = (s[i - 1] + f[i]) % mo; } printf("%lld\n", (f[n] + mo) % mo); return 0; }
a.cc:2:1: error: '\U00009648\U00006db5' does not name a type 2 | 陈涵 2017-4-8 21:37:31 | ^~~~ In file included from /usr/include/c++/14/bits/stl_algobase.h:62, from /usr/include/c++/14/algorithm:60, from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:51, from a.cc:3: /usr/include/c++/14/ext/type_traits.h:164:35: error: 'constexpr const bool __gnu_cxx::__is_null_pointer' redeclared as different kind of entity 164 | __is_null_pointer(std::nullptr_t) | ^ /usr/include/c++/14/ext/type_traits.h:159:5: note: previous declaration 'template<class _Type> constexpr bool __gnu_cxx::__is_null_pointer(_Type)' 159 | __is_null_pointer(_Type) | ^~~~~~~~~~~~~~~~~ /usr/include/c++/14/ext/type_traits.h:164:26: error: 'nullptr_t' is not a member of 'std'; did you mean 'nullptr_t'? 164 | __is_null_pointer(std::nullptr_t) | ^~~~~~~~~ In file included from /usr/include/c++/14/cstddef:50, from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:41: /usr/lib/gcc/x86_64-linux-gnu/14/include/stddef.h:443:29: note: 'nullptr_t' declared here 443 | typedef decltype(nullptr) nullptr_t; | ^~~~~~~~~ In file included from /usr/include/c++/14/bits/stl_pair.h:60, from /usr/include/c++/14/bits/stl_algobase.h:64: /usr/include/c++/14/type_traits:666:33: error: 'nullptr_t' is not a member of 'std'; did you mean 'nullptr_t'? 666 | struct is_null_pointer<std::nullptr_t> | ^~~~~~~~~ /usr/lib/gcc/x86_64-linux-gnu/14/include/stddef.h:443:29: note: 'nullptr_t' declared here 443 | typedef decltype(nullptr) nullptr_t; | ^~~~~~~~~ /usr/include/c++/14/type_traits:666:42: error: template argument 1 is invalid 666 | struct is_null_pointer<std::nullptr_t> | ^ /usr/include/c++/14/type_traits:670:48: error: template argument 1 is invalid 670 | struct is_null_pointer<const std::nullptr_t> | ^ /usr/include/c++/14/type_traits:674:51: error: template argument 1 is invalid 674 | struct is_null_pointer<volatile std::nullptr_t> | ^ /usr/include/c++/14/type_traits:678:57: error: template argument 1 is invalid 678 | struct is_null_pointer<const volatile std::nullptr_t> | ^ /usr/include/c++/14/type_traits:1429:37: error: 'size_t' is not a member of 'std'; did you mean 'size_t'? 1429 | : public integral_constant<std::size_t, alignof(_Tp)> | ^~~~~~ /usr/lib/gcc/x86_64-linux-gnu/14/include/stddef.h:214:23: note: 'size_t' declared here 214 | typedef __SIZE_TYPE__ size_t; | ^~~~~~ /usr/include/c++/14/type_traits:1429:57: error: template argument 1 is invalid 1429 | : public integral_constant<std::size_t, alignof(_Tp)> | ^ /usr/include/c++/14/type_traits:1429:57: note: invalid template non-type parameter /usr/include/c++/14/type_traits:1438:37: error: 'size_t' is not a member of 'std'; did you mean 'size_t'? 1438 | : public integral_constant<std::size_t, 0> { }; | ^~~~~~ /usr/lib/gcc/x86_64-linux-gnu/14/include/stddef.h:214:23: note: 'size_t' declared here 214 | typedef __SIZE_TYPE__ size_t; | ^~~~~~ /usr/include/c++/14/type_traits:1438:46: error: template argument 1 is invalid 1438 | : public integral_constant<std::size_t, 0> { }; | ^ /usr/include/c++/14/type_traits:1438:46: note: invalid template non-type parameter /usr/include/c++/14/type_traits:1440:26: error: 'std::size_t' has not been declared 1440 | template<typename _Tp, std::size_t _Size> | ^~~ /usr/include/c++/14/type_traits:1441:21: error: '_Size' was not declared in this scope 1441 | struct rank<_Tp[_Size]> | ^~~~~ /usr/include/c++/14/type_traits:1441:27: error: template argument 1 is invalid 1441 | struct rank<_Tp[_Size]> | ^ /usr/include/c++/14/type_traits:1442:37: error: 'size_t' is not a member of 'std'; did you mean 'size_t'? 1442 | : public integral_constant<std::size_t, 1 + rank<_Tp>::value> { }; | ^~~~~~ /usr/lib/gcc/x86_64-linux-gnu/14/include/stddef.h:214:23: note: 'size_t' declared here 214 | typedef __SIZE_TYPE__ size_t; | ^~~~~~ /usr/include/c++/14/type_traits:1442:65: error: template argument 1 is invalid 1442 | : public integral_constant<std::size_t, 1 + rank<_Tp>::value> { }; | ^ /usr/include/c++/14/type_traits:1442:65: note: invalid template non-type parameter /usr/include/c++/14/type_traits:1446:37: error: 'size_t' is not a member of 'std'; did you mean 'size_t'? 1446 | : public integral_constant<std::size_t, 1 + rank<_Tp>::value> { }; | ^~~~~~ /usr/lib/gcc/x86_64-linux-gnu/14/include/stddef.h:214:23: note: 'size_t' declared here 214 | typedef __SIZE_TYPE__ size_t; | ^~~~~~ /usr/include/c++/14/type_traits:1446:65: error: template argument 1 is invalid 1446 | : public integral_constant<std::size_t, 1 + rank<_Tp>::value> { }; | ^ /usr/include/c++/14/type_traits:1446:65: note: invalid template non-type parameter /usr/include/c++/14/type_traits:2086:26: error: 'std::size_t' has not been declared 2086 | template<typename _Tp, std::size_t _Size> | ^~~ /usr/include/c++/14/type_traits:2087:30: error: '_Size' was not declared in this scope 2087 | struct remove_extent<_Tp[_Size]> | ^~~~~ /usr/include/c++/14/type_traits:2087:36: error: template argument 1 is invalid 2087 | struct remove_extent<_Tp[_Size]> | ^ /usr/include/c++/14/type_traits:2099:26: error: 'std::size_t' has not been declared 2099 | template<typename _Tp, std::size_t _Size> | ^~~ /usr/include/c++/14/type_traits:2100:35: error: '_Size' was not declared in this scope 2100 | struct remove_all_extents<_Tp[_Size]> | ^~~~~ /usr/include/c++/14/type_traits:2100:41: error: template argument 1 is invalid 2100 | struct remove_all_extents<_Tp[_Size]> | ^ /usr/include/c++/14/type_traits:2171:12: error: 'std::size_t' has not been declared 2171 | template<std::size_t _Len> | ^~~ /usr/include/c++/14/type_traits:2176:30: error: '_Len' was not declared in this scope 2176 | unsigned char __data[_Len]; | ^~~~ /usr/include/c++/14/type_traits:2194:12: error: 'std::size_t' has not been declared 2194 | template<std::size_t _Len, std::size_t _Align = | ^~~ /usr/include/c++/14/type_traits:2194:30: error: 'std::size_t' has not been declared 2194 | template<std::size_t _Len, std::size_t _Align = | ^~~ /usr/include/c++/14/type_traits:2195:55: error: '_Len' was not declared in this scope 2195 | __alignof__(typename __aligned_storage_msa<_Len>::__type)> | ^~~~ /usr/include/c++/14/type_traits:2195:59: error: template argument 1 is invalid 2195 | __alignof__(typename __aligned_storage_msa<_Len>::__type)> | ^ /usr/include/c++/14/type_traits:2202:30: error: '_Len' was not declared in this scope 2202 | unsigned char __data[_Len]; | ^~~~ /usr/include/c++/14/type_traits:2203:44: error: '_Align' was not declared in this scope 2203 | struct __attribute__((__aligned__((_Align)))) { } __align; | ^~~~~~ In file included from /usr/include/c++/14/bits/stl_tempbuf.h:59, from /usr/include/c++/14/bits/stl_algo.h:69, from /usr/include/c++/14/algorithm:61: /usr/include/c++/14/new:131:26: error: declaration of 'operator new' as non-function 131 | _GLIBCXX_NODISCARD void* operator new(std::size_t) _GLIBCXX_THROW (std::bad_alloc) | ^~~~~~~~ /usr/include/c++/14/new:131:44: error: 'size_t' is not a member of 'std'; did you mean 'size_t'? 131 | _GLIBCXX_NODISCARD void* operator new(std::size_t) _GLIBCXX_THROW (std::bad_alloc) | ^~~~~~ /usr/lib/gcc/x86_64-linux-gnu/14/include/stddef.h:214:23: note: 'size_t' declared here 214 | typedef __SIZE_TYPE__ size_t; | ^~~~~~ /usr/include/c++/14/new:132:41: error: attributes after parenthesized initializer ignored [-fpermissive] 132 | __attribute__((__externally_visible__)); | ^ /usr/include/c++/14/new:133:26: error: declaration of 'operator new []' as non-function 133 | _GLIBCXX_NODISCARD void* operator new[](std::size_t) _GLIBCXX_THROW (std::bad_alloc) | ^~~~~~~~ /usr/include/c++/14/new:133:46: error: 'size_t' is not a member of 'std'; did you mean 'size_t'? 133 | _GLIBCXX_NODISCARD void* operator new[](std::size_t) _GLIBCXX_THROW (std::bad_alloc) | ^~~~~~ /usr/lib/gcc/x86_64-linux-gnu/14/include/stddef.h:214:23: note: 'size_t' declared here 214 | typedef __SIZE_TYPE__ size_t; | ^~~~~~ /usr/include/c++/14/new:134:41: error: attributes after parenthesized initializer ignored [-fpermissive] 134 | __attribute__((__externally_visible__)); |
s824654515
p03766
C++
#include <cstdio> #include <cstdlib> #include <cstring> #include <iostream> #include <vector> #include <string> #include <algorithm> #include <stack> #include <queue> #include <set> #include <map> using namespace std; //typedef __int64 LL; typedef vector<int> ivec; typedef vector<string> svec; int a[100010]; int dp2[100010],dp1[100010]; int main(){ const int mod=1000000007; int n; int ans=0; int a=1,b; cin>>n; dp[1]=1,dp[1]=0; for(int i=1;i<n;i++)a*=2,a=a%mod; b=(n-1)*(n-2)/2; cout<<(a*n*n-b*n)%mod<<endl; return 0; }
a.cc: In function 'int main()': a.cc:25:9: error: 'dp' was not declared in this scope; did you mean 'dp2'? 25 | dp[1]=1,dp[1]=0; | ^~ | dp2
s328004965
p03766
C++
typedef long long int64; static const int MAXN = 1e6 + 4; static const int MODULUS = 1e9 + 7; #define _ % MODULUS #define __ %= MODULUS int n; int64 f[MAXN] = { 0 }; int main() { scanf("%d", &n); f[0] = 1; f[1] = n; f[2] = (int64)n * n _; int64 sum = (f[0] + f[1] + f[2])_; for (int i = 3; i <= n; ++i) { (f[i] += sum - f[i - 2])__; (f[i] += (int64)(n - i + 1) * n + (int64)(n - 1) * (i - 2))__; (sum += f[i])__; } //for (int i = 0; i <= n; ++i) printf("%lld%c", f[i], i == n ? '\n' : ' '); printf("%lld\n", f[n]); return 0; }
a.cc: In function 'int main()': a.cc:12:5: error: 'scanf' was not declared in this scope 12 | scanf("%d", &n); | ^~~~~ a.cc:25:5: error: 'printf' was not declared in this scope 25 | printf("%lld\n", f[n]); | ^~~~~~ a.cc:1:1: note: 'printf' is defined in header '<cstdio>'; this is probably fixable by adding '#include <cstdio>' +++ |+#include <cstdio> 1 | typedef long long int64;
s389650933
p03766
C++
#define _USE_MATH_DEFINES #include <cstdio> #include <iostream> #include <sstream> #include <fstream> #include <iomanip> #include <algorithm> #include <cmath> #include <complex> #include <string> #include <vector> #include <list> #include <queue> #include <stack> #include <set> #include <map> #include <bitset> #include <numeric> #include <limits> #include <climits> #include <cfloat> #include <functional> #include <iterator> using namespace std; const int MOD = 1000000007; class SegmentTree { private: typedef long long T1; typedef long long T2; // データの初期値、以下の条件を満たすこと // uniteData(v, INIT_DATA) == v static const T1 INIT_DATA = 0; // 遅延の初期値、以下の条件を満たすこと // updateData(prev, size, INIT_DELAY) == prev // updateDelay(x, INIT_DELAY) == x static const T2 INIT_DELAY = 0; // 長さがsizeの区間における前回の計算結果prevに対して、 // 区間の各要素にパラメータxを用いた更新処理を適用した後の計算結果を返す T1 updateData(T1 prev, int size, T2 x){ return (prev + x * size) % MOD; } // パラメータx1,x2による2つの更新処理を順に適用した場合に対して、 // 同じ結果になるような1つの更新処理のパラメータを返す T2 updateDelay(T2 x1, T2 x2){ return (x1 + x2) % MOD; } // 2つの区間の計算結果v1,v2に対して、 // その2つの区間を統合した区間における計算結果を返す T1 uniteData(T1 v1, T1 v2){ return (v1 + v2) % MOD; } int n; vector<T1> data; vector<T2> delay; void updateTree(int a, int b, int k, int l, int r, T2 x){ if(a <= l && r <= b){ data[k] = updateData(data[k], r - l + 1, x); delay[k] = updateDelay(delay[k], x); } else if(a <= r && l <= b){ for(int i=0; i<2; ++i){ data[k*2+1+i] = updateData(data[k*2+1+i], (r - l + 1) / 2, delay[k]); delay[k*2+1+i] = updateDelay(delay[k*2+1+i], delay[k]); } delay[k] = INIT_DELAY; updateTree(a, b, k*2+1, l, (l+r)/2, x); updateTree(a, b, k*2+2, (l+r+1)/2, r, x); data[k] = uniteData(data[k*2+1], data[k*2+2]); } } T1 getValue(int a, int b, int k, int l, int r){ if(a <= l && r <= b){ return data[k]; } else if(a <= r && l <= b){ T1 v1 = getValue(a, b, k*2+1, l, (l+r)/2); T1 v2 = getValue(a, b, k*2+2, (l+r+1)/2, r); return uniteData(v1, v2); } else{ return INIT_DATA; } } public: SegmentTree(int n0){ n = 1; while(n < n0) n *= 2; data.assign(2*n-1, INIT_DATA); delay.assign(2*n-1, INIT_DELAY); } SegmentTree(const vector<T1>& v) : SegmentTree((int)v.size()){ for(unsigned i=0; i<v.size(); ++i) data[n-1+i] = v[i]; for(int k=n-2; k>=0; --k) data[k] = uniteData(data[k*2+1], data[k*2+2]); } // 区間[a,b]の要素にパラメータxによる更新処理を適用 void update(int a, int b, T2 x){ updateTree(a, b, 0, 0, n-1, x); } // 区間[a,b]の計算結果を返す T1 get(int a, int b){ updateTree(a, b, 0, 0, n-1, 0); return getValue(a, b, 0, 0, n-1); } }; int main() { int n; cin >> n; SegmentTree st(2*n+1); st.update(0, 0, 1); long long ans = 0; for(int i=0; i<n; ++i){ long long x = st.get(i, i); if(i < n - 1){ long long tmp = (n - 1LL) * (n - 1LL); tmp %= MOD; ans += x * tmp; ans %= MOD; } st.update(i+1, i+1, x); st.update(i+3, i+n+1, x); } ans += st.get(n, 2*n); ans %= MOD; cout << ans << endl; return 0; }
/usr/bin/ld: /tmp/ccXOeuSj.o: warning: relocation against `_ZN11SegmentTree9INIT_DATAE' in read-only section `.text._ZN11SegmentTreeC2Ei[_ZN11SegmentTreeC5Ei]' /usr/bin/ld: /tmp/ccXOeuSj.o: in function `SegmentTree::SegmentTree(int)': a.cc:(.text._ZN11SegmentTreeC2Ei[_ZN11SegmentTreeC5Ei]+0x6e): undefined reference to `SegmentTree::INIT_DATA' /usr/bin/ld: a.cc:(.text._ZN11SegmentTreeC2Ei[_ZN11SegmentTreeC5Ei]+0x95): undefined reference to `SegmentTree::INIT_DELAY' /usr/bin/ld: warning: creating DT_TEXTREL in a PIE collect2: error: ld returned 1 exit status
s317765161
p03767
C++
#include <bits/stdc++.h> #include <iostream> #include <algorithm> using namespace std; int main (){ int N; //データの数 cin >> N; int data=0; vector <int> a(3*N); for(int i=0;i<3*N;i++) cin >>a.at(i);//データの収納 sort(a,a+10,greater<int>()); for (int i=0;i < N-1 ;i++) data += a.at(i); cout<<data<<endl; }
a.cc: In function 'int main()': a.cc:15:11: error: no match for 'operator+' (operand types are 'std::vector<int>' and 'int') 15 | sort(a,a+10,greater<int>()); | ~^~~ | | | | | int | std::vector<int> In file included from /usr/include/c++/14/bits/stl_algobase.h:67, 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_iterator.h:627:5: note: candidate: 'template<class _Iterator> constexpr std::reverse_iterator<_Iterator> std::operator+(typename reverse_iterator<_Iterator>::difference_type, const reverse_iterator<_Iterator>&)' 627 | operator+(typename reverse_iterator<_Iterator>::difference_type __n, | ^~~~~~~~ /usr/include/c++/14/bits/stl_iterator.h:627:5: note: template argument deduction/substitution failed: a.cc:15:12: note: mismatched types 'const std::reverse_iterator<_Iterator>' and 'int' 15 | sort(a,a+10,greater<int>()); | ^~ /usr/include/c++/14/bits/stl_iterator.h:1798:5: note: candidate: 'template<class _Iterator> constexpr std::move_iterator<_IteratorL> std::operator+(typename move_iterator<_IteratorL>::difference_type, const move_iterator<_IteratorL>&)' 1798 | operator+(typename move_iterator<_Iterator>::difference_type __n, | ^~~~~~~~ /usr/include/c++/14/bits/stl_iterator.h:1798:5: note: template argument deduction/substitution failed: a.cc:15:12: note: mismatched types 'const std::move_iterator<_IteratorL>' and 'int' 15 | sort(a,a+10,greater<int>()); | ^~ In file included from /usr/include/c++/14/string:54, from /usr/include/c++/14/bitset:52, from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:52: /usr/include/c++/14/bits/basic_string.h:3598:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> std::__cxx11::basic_string<_CharT, _Traits, _Allocator> std::operator+(const __cxx11::basic_string<_CharT, _Traits, _Allocator>&, const __cxx11::basic_string<_CharT, _Traits, _Allocator>&)' 3598 | operator+(const basic_string<_CharT, _Traits, _Alloc>& __lhs, | ^~~~~~~~ /usr/include/c++/14/bits/basic_string.h:3598:5: note: template argument deduction/substitution failed: a.cc:15:12: note: 'std::vector<int>' is not derived from 'const std::__cxx11::basic_string<_CharT, _Traits, _Allocator>' 15 | sort(a,a+10,greater<int>()); | ^~ /usr/include/c++/14/bits/basic_string.h:3616:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> std::__cxx11::basic_string<_CharT, _Traits, _Allocator> std::operator+(const _CharT*, const __cxx11::basic_string<_CharT, _Traits, _Allocator>&)' 3616 | operator+(const _CharT* __lhs, | ^~~~~~~~ /usr/include/c++/14/bits/basic_string.h:3616:5: note: template argument deduction/substitution failed: a.cc:15:12: note: mismatched types 'const _CharT*' and 'std::vector<int>' 15 | sort(a,a+10,greater<int>()); | ^~ /usr/include/c++/14/bits/basic_string.h:3635:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> std::__cxx11::basic_string<_CharT, _Traits, _Allocator> std::operator+(_CharT, const __cxx11::basic_string<_CharT, _Traits, _Allocator>&)' 3635 | operator+(_CharT __lhs, const basic_string<_CharT,_Traits,_Alloc>& __rhs) | ^~~~~~~~ /usr/include/c++/14/bits/basic_string.h:3635:5: note: template argument deduction/substitution failed: a.cc:15:12: note: mismatched types 'const std::__cxx11::basic_string<_CharT, _Traits, _Allocator>' and 'int' 15 | sort(a,a+10,greater<int>()); | ^~ /usr/include/c++/14/bits/basic_string.h:3652:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> std::__cxx11::basic_string<_CharT, _Traits, _Allocator> std::operator+(const __cxx11::basic_string<_CharT, _Traits, _Allocator>&, const _CharT*)' 3652 | operator+(const basic_string<_CharT, _Traits, _Alloc>& __lhs, | ^~~~~~~~ /usr/include/c++/14/bits/basic_string.h:3652:5: note: template argument deduction/substitution failed: a.cc:15:12: note: 'std::vector<int>' is not derived from 'const std::__cxx11::basic_string<_CharT, _Traits, _Allocator>' 15 | sort(a,a+10,greater<int>()); | ^~ /usr/include/c++/14/bits/basic_string.h:3670:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> std::__cxx11::basic_string<_CharT, _Traits, _Allocator> std::operator+(const __cxx11::basic_string<_CharT, _Traits, _Allocator>&, _CharT)' 3670 | operator+(const basic_string<_CharT, _Traits, _Alloc>& __lhs, _CharT __rhs) | ^~~~~~~~ /usr/include/c++/14/bits/basic_string.h:3670:5: note: template argument deduction/substitution failed: a.cc:15:12: note: 'std::vector<int>' is not derived from 'const std::__cxx11::basic_string<_CharT, _Traits, _Allocator>' 15 | sort(a,a+10,greater<int>()); | ^~ /usr/include/c++/14/bits/basic_string.h:3682:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> std::__cxx11::basic_string<_CharT, _Traits, _Allocator> std::operator+(__cxx11::basic_string<_CharT, _Traits, _Allocator>&&, const __cxx11::basic_string<_CharT, _Traits, _Allocator>&)' 3682 | operator+(basic_string<_CharT, _Traits, _Alloc>&& __lhs, | ^~~~~~~~ /usr/include/c++/14/bits/basic_string.h:3682:5: note: template argument deduction/substitution failed: a.cc:15:12: note: 'std::vector<int>' is not derived from 'std::__cxx11::basic_string<_CharT, _Traits, _Allocator>' 15 | sort(a,a+10,greater<int>()); | ^~ /usr/include/c++/14/bits/basic_string.h:3689:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> std::__cxx11::basic_string<_CharT, _Traits, _Allocator> std::operator+(const __cxx11::basic_string<_CharT, _Traits, _Allocator>&, __cxx11::basic_string<_CharT, _Traits, _Allocator>&&)' 3689 | operator+(const basic_string<_CharT, _Traits, _Alloc>& __lhs, | ^~~~~~~~ /usr/include/c++/14/bits/basic_string.h:3689:5: note: template argument deduction/substitution failed: a.cc:15:12: note: 'std::vector<int>' is not derived from 'const std::__cxx11::basic_string<_CharT, _Traits, _Allocator>' 15 | sort(a,a+10,greater<int>()); | ^~ /usr/include/c++/14/bits/basic_string.h:3696:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> std::__cxx11::basic_string<_CharT, _Traits, _Allocator> std::operator+(__cxx11::basic_string<_CharT, _Traits, _Allocator>&&, __cxx11::basic_string<_CharT, _Traits, _Allocator>&&)' 3696 | operator+(basic_string<_CharT, _Traits, _Alloc>&& __lhs, | ^~~~~~~~ /usr/include/c++/14/bits/basic_string.h:3696:5: note: template argument deduction/substitution failed: a.cc:15:12: note: 'std::vector<int>' is not derived from 'std::__cxx11::basic_string<_CharT, _Traits, _Allocator>' 15 | sort(a,a+10,greater<int>()); | ^~ /usr/include/c++/14/bits/basic_string.h:3719:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> std::__cxx11::basic_string<_CharT, _Traits, _Allocator> std::operator+(const _CharT*, __cxx11::basic_string<_CharT, _Traits, _Allocator>&&)' 3719 | operator+(const _CharT* __lhs, | ^~~~~~~~ /usr/include/c++/14/bits/basic_string.h:3719:5: note: template argument deduction/substitution failed: a.cc:15:12: note: mismatched types 'const _CharT*' and 'std::vector<int>' 15 | sort(a,a+10,greater<int>()); | ^~ /usr/include/c++/14/bits/basic_string.h:3726:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> std::__cxx11::basic_string<_CharT, _Traits, _Allocator> std::operator+(_CharT, __cxx11::basic_string<_CharT, _Traits, _Allocator>&&)' 3726 | operator+(_CharT __lhs, | ^~~~~~~~ /usr/include/c++/14/bits/basic_string.h:3726:5: note: template argument deduction/substitution failed: a.cc:15:12: note: mismatched types 'std::__cxx11::basic_string<_CharT, _Traits, _Allocator>' and 'int' 15 | sort(a,a+10,greater<int>()); | ^~ /usr/include/c++/14/bits/basic_string.h:3733:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> std::__cxx11::basic_string<_CharT, _Traits, _Allocator> std::operator+(__cxx11::basic_string<_CharT, _Traits, _Allocator>&&, const _CharT*)' 3733 | operator+(basic_string<_CharT, _Traits, _Alloc>&& __lhs, | ^~~~~~~~ /usr/include/c++/14/bits/basic_string.h:3733:5: note: template argument deduction/substitution failed: a.cc:15:12: note: 'std::vector<int>' is not derived from 'std::__cxx11::basic_string<_CharT, _Traits, _Allocator>' 15 | sort(a,a+10,greater<int>()); | ^~ /usr/include/c++/14/bits/basic_string.h:3740:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> std::__cxx11::basic_string<_CharT, _Traits, _Allocator> std::operator+(__cxx11::basic_string<_CharT, _Traits, _Allocator>&&, _CharT)' 3740 | operator+(basic_string<_CharT, _Traits, _Alloc>&& __lhs, | ^~~~~~~~ /usr/include/c++/14/bits/basic_string.h:3740:5: note: template argument deduction/substitution failed: a.cc:15:12: note: 'std::vector<int>' is not derived from 'std::__cxx11::basic_string<_CharT, _Traits, _Allocator>' 15 | sort(a,a+10,greater<int>()); | ^~ In file included from /usr/include/c++/14/ccomplex:39, from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:127: /usr/include/c++/14/complex:340:5: note: candidate: 'template<class _Tp> std::complex<_Tp> std::operator+(const complex<_Tp>&, const complex<_Tp>&)' 340 | operator+(const complex<_Tp>& __x, const complex<_Tp>& __y) | ^~~~~~~~ /usr/include/c++/14/complex:340:5: note: template argument deduction/substitution failed: a.cc:15:12: note: 'std::vector<int>' is not derived from 'const std::complex<_Tp>' 15 | sort(a,a+10,greater<int>()); | ^~ /usr/include/c++/14/complex:349:5: note: candidate: 'template<class _Tp> std::complex<_Tp> std::operator+(const complex<_Tp>&,
s404545555
p03767
C++
#include <bits/stdc++.h> using namespace std; int main(){ int N; cin >> N; int a[N]; for(int i=0;i<N;i++){ cin >> a[i]; } sort(a,a+N); int sum=0; for(int i=N/3;i<N;i++++){ sum+=a[i]; } cout << sum << endl; }
a.cc: In function 'int main()': a.cc:13:22: error: lvalue required as increment operand 13 | for(int i=N/3;i<N;i++++){ | ~^~
s903261368
p03767
C++
#include <bits/stdc++.h> using namespace std; int main(){ int N; cin >> N; int a[N]; for(int i=0;i<N;i++){ cin >> a[i]; } sort(a,a+N); int sum=0; for(int i=N/3;i<N;i++++){ sum+=a[i]; } cout << sum << endl; }
a.cc: In function 'int main()': a.cc:13:22: error: lvalue required as increment operand 13 | for(int i=N/3;i<N;i++++){ | ~^~
s832056583
p03767
C++
#include<iostream> #include<algorithm> #include<string> #include<cmath> using namespace std; int main() { int N; int a[100010]; long int max = 0; for(int i = 0; i < 3*N; i++) cin >> a[i]; sort(a, a+3N,greater<int>()); for(int i = 0; i < N; i++) max = a[2*i + 1]; cout << max << endl; return 0; }
a.cc: In function 'int main()': a.cc:12:15: error: unable to find numeric literal operator 'operator""N' 12 | sort(a, a+3N,greater<int>()); | ^~
s722151715
p03767
C++
#include <bits/stdc++.h> using namespace std; #define inf 1072114514 #define llinf 4154118101919364364 #define mod 1000000007 #define pi 3.1415926535897932384 int round(int a,int b){if((a%b)*2 >= b){return (a/b)+1;}return a/b;} int gcd(int a,int b){int c;while(b!=0){c=a%b;a=b;b=c;}return a;} //最大公約数 int lcm(int a,int b){int c=gcd(a,b);a/=c;return a*b;} //最小公倍数 int nCr(int a,int b){int i,r=1;for(i=1;i<=b;i++){r*=(a+1-i);r/=i;}return r;} //コンビネーション int nHr(int a,int b){return nCr(a+b-1,b);} // 重複組み合わせ int fact(int a){int i,r=1;for(i=1;i<=a;i++){r*=i;}return r;} //階乗 int pow(int a,int b){int i,r=1;for(i=1;i<=b;i++){r*=a;}return r;} // a~bまでの階乗 int dsum(int x){int r=0;while(x){r+=(x%10);x/=10;}return r;} //数字の各位の和 int dsumb(int x,int b){int r=0;while(x){r+=(x%b);x/=b;}return r;} // b進数の各位の和? int sankaku(int x){return ((1+x)*x)/2;} //三角数 xまでの和 //以下long long ver long long llmax(long long a,long long b){if(a>b){return a;}return b;} long long llmin(long long a,long long b){if(a<b){return a;}return b;} long long llzt(long long a,long long b){return llmax(a,b)-llmin(a,b);} long long llround(long long a,long long b){if((a%b)*2 >= b){return (a/b)+1;}return a/b;} long long llceil(long long a,long long b){if(a%b==0){return a/b;}return (a/b)+1;} long long llgcd(long long a,long long b){long long c;while(b!=0){c=a%b;a=b;b=c;}return a;} long long lllcm(long long a,long long b){long long c=llgcd(a,b);a/=c;return a*b;} long long llnCr(long long a,long long b){long long i,r=1;for(i=1;i<=b;i++){r*=(a+1-i);r/=i;}return r;} long long llnHr(long long a,long long b){return llnCr(a+b-1,b);} long long llfact(long long a){long long i,r=1;for(i=1;i<=a;i++){r*=i;}return r;} long long llpow(long long a,long long b){long long i,r=1;for(i=1;i<=b;i++){r*=a;}return r;} long long lldsum(long long x){long long r=0;while(x){r+=(x%10);x/=10;}return r;} long long lldsumb(long long x,long long b){long long r=0;while(x){r+=(x%b);x/=b;}return r;} long long llsankaku(long long x){return ((1+x)*x)/2;} //double double dbmax(double a,double b){if(a>b){return a;}return b;} double dbmin(double a,double b){if(a<b){return a;}return b;} double dbzt(double a,double b){return dbmax(a,b)-dbmin(a,b);} typedef pair<int, int> ii; typedef long long ll; typedef vector<ll> vll; typedef pair<ll,ll> pll; #define forr(i,a,b) ; for(int i=(a); i<(b); i++) #define clean(arr,val) memset(arr,val,sizeof(arr)) #define forn(i,n) forr(i,0,n) #define PB push_back typedef vector<int> vi; typedef vector<ii> vii; typedef vector<pll> vpll; const int dx[8] = {1, 0, -1, 0, 1, -1, -1, 1}; const int dy[8] = {0, 1, 0, -1, 1, 1, -1, -1}; bool is_prime (int x){ if (x<=1) return false ; for (int i=2 ; i*i<=x ; i++){ if (x%i==0) return false ; } return true; } string alpha = "abcdefghijklmnopqrstuvwxyz" ; string ALPHA = "ABCDEFGHIJKLMNOPQRSTUVWXYZ" ; bool chmin (int a,int b){ if ( a > b ){ a = b; return true ; } return false ; } bool chmax (int a,int b){ if ( a < b ){ a = b; return true ; } return false ; } /*CODE START HERE*/ int main() { int n; cin >> n; vector<int> a(n); forn(i,n){ cin >> a(n); } sort(a.begin(),a.end()); reverse (a.begin(),a.end() ); long long sum = 0; forn(i,n){ sum += a.at(2*i); } cout << sum << endl; }
a.cc: In function 'int main()': a.cc:88:13: error: no match for call to '(std::vector<int>) (int&)' 88 | cin >> a(n); | ~^~~
s942317178
p03767
C++
#include <bits/stdc++.h> #define rep(i,n) for (int i = 0; i < (n); ++i) using namespace std; using ll = long long; /*using P = pair<ll,ll>; //マクロ //forループ関係 //引数は、(ループ内変数,動く範囲)か(ループ内変数,始めの数,終わりの数)、のどちらか //Dがついてないものはループ変数は1ずつインクリメントされ、Dがついてるものはループ変数は1ずつデクリメントされる #define FOR(i,a,b) for(ll i=a;i<=(ll)(b);i++) //xにはvectorなどのコンテナ #define ALL(x) (x).begin(),(x).end() //sortなどの引数を省略したい #define SIZE(x) ((ll)(x).size()) //sizeをsize_tからllに直しておく #define MAX(x) *max_element(ALL(x)) //最大値を求める #define MIN(x) *min_element(ALL(x)) //最小値を求める //定数 #define INF 1000000000000 //10^12:極めて大きい値,∞ #define inf 2147483647 //int値の最大値 #define MOD 1000000007 //10^9+7:合同式の法 #define MAXR 100000 //10^5:配列の最大のrange(素数列挙などで使用) //略記 #define PB push_back //vectorヘの挿入 #define MP make_pair //pairのコンストラクタ #define F first //pairの一つ目の要素 #define S second //pairの二つ目の要素 #define CST(x) cout<<fixed<<setprecision(x)//小数点以下の桁数指定 template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; } template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; } int gcd(int a, int b) { if (b==0) return a; else return gcd(b, a%b); } int lcm(int a, int b) { return a * b / gcd(a, b); } int two(int n){ ll ans=1; rep(i,n){ ans*=2; } return ans; } */ int main() { cin.tie(0); cout.tie(0); ios::sync_with_stdio(false); ll n; vector<int>a(n*3); cin>>n; rep(i,3*n)cin>>a[i]; ll sum=0; sort(ALL(a)); reverse(ALL(a)); for(int i=1;i<2*n;i+=2){ sum+=a[i]; } cout<<sum<<endl; }
a.cc: In function 'int main()': a.cc:73:10: error: 'ALL' was not declared in this scope 73 | sort(ALL(a)); | ^~~
s768755102
p03767
C++
#include <iostream> #include <vector> #include <algorithm> using namespace std; int main(){ int N; cin >> N; vector<int> a; for(int i=0;i<3*N;i++) cin >> a[i]; sort(a.begin(), a.end(), grater<int>()); int sum = 0; for(int i=0;i<2*N;i++){ if(i%2 == 1) sum += a[i]; } cout << a[i] << endl; }
a.cc: In function 'int main()': a.cc:12:34: error: 'grater' was not declared in this scope 12 | sort(a.begin(), a.end(), grater<int>()); | ^~~~~~ a.cc:12:41: error: expected primary-expression before 'int' 12 | sort(a.begin(), a.end(), grater<int>()); | ^~~ a.cc:17:19: error: 'i' was not declared in this scope 17 | cout << a[i] << endl; | ^
s466160274
p03767
C++
#include<btis/stdc++.h> using namespace std; #define int int64_t signed main(){ int n; cin>>n; vector<int> x(n*3); arep(i,x) cin>>i; sort(all(x),greater<int>()); int ans = 0; for(int i=n;i<n+n;++i) ans += x[i]; cout<<ans<<'\n'; return 0; }
a.cc:1:9: fatal error: btis/stdc++.h: No such file or directory 1 | #include<btis/stdc++.h> | ^~~~~~~~~~~~~~~ compilation terminated.
s889294480
p03767
C++
#include <bits/stdc++.h> using namespace std; int main() { int n; cin >> n; int a[3*n]; for(int i=0; i<3*n; i++){ cin >> a[i]; } sort(a, a+(3*n); long long ans = 0; for(int i=(3*n-2); i>=n; i-=2){ ans += a[i]; } cout << ans << endl; return 0; }
a.cc: In function 'int main()': a.cc:14:20: error: expected ')' before ';' token 14 | sort(a, a+(3*n); | ~ ^ | )
s652978608
p03767
C++
#include<bits/stdc++.h> using namespace std; int main(){ int n; cin >> n; vector<int> arr(3*N); for(int i=0;i<3*n;i++){ cin >>arr.at(i); } sort(arr.begin(),arr.end()); reverse(arr.begin(),arr.end()); int64_t sum=0; for(int i=1;i<2*n;i+=2){ sum+=arr.at(i); } cout<<sum; return 0; }
a.cc: In function 'int main()': a.cc:6:21: error: 'N' was not declared in this scope 6 | vector<int> arr(3*N); | ^
s915616588
p03767
C++
#include <iostream> #include <vector> #include <algorithm> using namespace std; int main(void){ int N; cin >> N; vector<int> a(3*N); for (int i=0; i<3*N; i++) cin >> a[i]; sort((a).begin(), (a).rend()); long long sum =0; for (int i=0; i<N; i++){ sum += a[ i*2 + 1 ]; } cout << sum << "\n"; }
a.cc: In function 'int main()': a.cc:13:7: error: no matching function for call to 'sort(std::vector<int>::iterator, std::vector<int>::reverse_iterator)' 13 | sort((a).begin(), (a).rend()); | ~~~~^~~~~~~~~~~~~~~~~~~~~~~~~ In file included from /usr/include/c++/14/algorithm:61, from a.cc:3: /usr/include/c++/14/bits/stl_algo.h:4762:5: note: candidate: 'template<class _RAIter> void std::sort(_RAIter, _RAIter)' 4762 | sort(_RandomAccessIterator __first, _RandomAccessIterator __last) | ^~~~ /usr/include/c++/14/bits/stl_algo.h:4762:5: note: template argument deduction/substitution failed: a.cc:13:7: note: deduced conflicting types for parameter '_RAIter' ('__gnu_cxx::__normal_iterator<int*, std::vector<int> >' and 'std::reverse_iterator<__gnu_cxx::__normal_iterator<int*, std::vector<int> > >') 13 | sort((a).begin(), (a).rend()); | ~~~~^~~~~~~~~~~~~~~~~~~~~~~~~ /usr/include/c++/14/bits/stl_algo.h:4793:5: note: candidate: 'template<class _RAIter, class _Compare> void std::sort(_RAIter, _RAIter, _Compare)' 4793 | sort(_RandomAccessIterator __first, _RandomAccessIterator __last, | ^~~~ /usr/include/c++/14/bits/stl_algo.h:4793:5: note: candidate expects 3 arguments, 2 provided In file included from /usr/include/c++/14/algorithm:86: /usr/include/c++/14/pstl/glue_algorithm_defs.h:292:1: note: candidate: 'template<class _ExecutionPolicy, class _RandomAccessIterator, class _Compare> __pstl::__internal::__enable_if_execution_policy<_ExecutionPolicy, void> std::sort(_ExecutionPolicy&&, _RandomAccessIterator, _RandomAccessIterator, _Compare)' 292 | sort(_ExecutionPolicy&& __exec, _RandomAccessIterator __first, _RandomAccessIterator __last, _Compare __comp); | ^~~~ /usr/include/c++/14/pstl/glue_algorithm_defs.h:292:1: note: candidate expects 4 arguments, 2 provided /usr/include/c++/14/pstl/glue_algorithm_defs.h:296:1: note: candidate: 'template<class _ExecutionPolicy, class _RandomAccessIterator> __pstl::__internal::__enable_if_execution_policy<_ExecutionPolicy, void> std::sort(_ExecutionPolicy&&, _RandomAccessIterator, _RandomAccessIterator)' 296 | sort(_ExecutionPolicy&& __exec, _RandomAccessIterator __first, _RandomAccessIterator __last); | ^~~~ /usr/include/c++/14/pstl/glue_algorithm_defs.h:296:1: note: candidate expects 3 arguments, 2 provided
s584667404
p03767
C++
#include <iostream> #include <vector> #include <algorithm> #include <thread> #include <sstream> #include <unordered_set> #include <future> using namespace std; int main() { std::ios_base::sync_with_stdio(0); cin.tie(0); int n; cin >> n; std::vector<int> v(3 * n); for (auto& el : v) { cin >> el; } std::sort(v.begin(), v.end()); int64_t sum = 0; for (int i = 3 * n - 2, j = 0; j < n; j++, i -= 2) { assert(i > 0); sum += v[i]; } cout << sum << endl; }
a.cc: In function 'int main()': a.cc:27:5: error: 'assert' was not declared in this scope 27 | assert(i > 0); | ^~~~~~ a.cc:8:1: note: 'assert' is defined in header '<cassert>'; this is probably fixable by adding '#include <cassert>' 7 | #include <future> +++ |+#include <cassert> 8 | using namespace std;
s593963040
p03767
C++
#include<bits/stdc++.h> using namespace std; int main(){ int a,b; cin >> a ; int m=3*a; int k[m+2]={0}; for(int i=0;i<m;i++){ cin >> k[i]; } sort(k,k+m,greater<int>()); int sum=0; for(int i=1,j=0;i<2*a,j<n;i+=2,j++){ sum+=k[i]; } cout << sum << endl; }
a.cc: In function 'int main()': a.cc:15:27: error: 'n' was not declared in this scope 15 | for(int i=1,j=0;i<2*a,j<n;i+=2,j++){ | ^
s828146945
p03767
C++
#include<bits/stdc++.h> using namespace std; int main(){ int a,b; cin >> a ; int m=3*a; int k[m+2]={0}; for(int i=0;i<m;i++){ cin >> k[i]; } sort(k,k+m,greater<int>()); int sum=0; for(int i=1,j=0;i<2*a,j<n;i+2,j++){ sum+=k[i]; } cout << sum << endl; }
a.cc: In function 'int main()': a.cc:15:27: error: 'n' was not declared in this scope 15 | for(int i=1,j=0;i<2*a,j<n;i+2,j++){ | ^
s999388720
p03767
C++
#include<bits/stdc++.h> using namespace std; int main(){ int a,b; cin >> a ; int m=3*a; int k[m+2]={0}; for(int i=0;i<m;i++){ cin >> k[i]; } sort(k,k+m,greater<int>()); int sum=0; for(int i=1,j=0;;i<2*a,j<n;i+2,j++){ sum+=k[i]; } cout << sum << endl; }
a.cc: In function 'int main()': a.cc:15:28: error: 'n' was not declared in this scope 15 | for(int i=1,j=0;;i<2*a,j<n;i+2,j++){ | ^ a.cc:15:29: error: expected ')' before ';' token 15 | for(int i=1,j=0;;i<2*a,j<n;i+2,j++){ | ~ ^ | ) a.cc:15:30: error: 'i' was not declared in this scope 15 | for(int i=1,j=0;;i<2*a,j<n;i+2,j++){ | ^ a.cc:15:34: error: 'j' was not declared in this scope 15 | for(int i=1,j=0;;i<2*a,j<n;i+2,j++){ | ^
s389289657
p03767
C++
#include<bits/stdc++.h> using namespace std; int main(){ int a,b; cin >> a ; int k[n]={}; int m=3*a; for(int i=0;i<m;i++){ cin >> k[i]; } sort(k,k+m,greater<int>()); cout << k[1] << endl; }
a.cc: In function 'int main()': a.cc:6:9: error: 'n' was not declared in this scope 6 | int k[n]={}; | ^ a.cc:9:12: error: 'k' was not declared in this scope 9 | cin >> k[i]; | ^ a.cc:11:8: error: 'k' was not declared in this scope 11 | sort(k,k+m,greater<int>()); | ^
s848953765
p03767
C++
#include <bits/stdc++.h> using namespace std; using ll = long long; int main() { int N; cin >> N; vector<ll> A(3*N); for (int i = 0; i < 3*N; i++) cin >> A[i]; sort(A.begin(), A.end()); reverse(A.begin(), A>end()); ll ans = 0; for (int i = 1; i <= 2*N; i++) { if (i % 2 == 1) ans += A[i]; } cout << ans << endl; }
a.cc: In function 'int main()': a.cc:11:27: error: no matching function for call to 'end()' 11 | reverse(A.begin(), A>end()); | ~~~^~ In file included from /usr/include/c++/14/bits/algorithmfwd.h:39, from /usr/include/c++/14/bits/stl_algo.h:59, from /usr/include/c++/14/algorithm:61, from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:51, from a.cc:1: /usr/include/c++/14/initializer_list:99:5: note: candidate: 'template<class _Tp> constexpr const _Tp* std::end(initializer_list<_Tp>)' 99 | end(initializer_list<_Tp> __ils) noexcept | ^~~ /usr/include/c++/14/initializer_list:99:5: note: candidate expects 1 argument, 0 provided In file included from /usr/include/c++/14/string:53, from /usr/include/c++/14/bitset:52, from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:52: /usr/include/c++/14/bits/range_access.h:74:5: note: candidate: 'template<class _Container> constexpr decltype (__cont.end()) std::end(_Container&)' 74 | end(_Container& __cont) -> decltype(__cont.end()) | ^~~ /usr/include/c++/14/bits/range_access.h:74:5: note: candidate expects 1 argument, 0 provided /usr/include/c++/14/bits/range_access.h:85:5: note: candidate: 'template<class _Container> constexpr decltype (__cont.end()) std::end(const _Container&)' 85 | end(const _Container& __cont) -> decltype(__cont.end()) | ^~~ /usr/include/c++/14/bits/range_access.h:85:5: note: candidate expects 1 argument, 0 provided /usr/include/c++/14/bits/range_access.h:106:5: note: candidate: 'template<class _Tp, long unsigned int _Nm> constexpr _Tp* std::end(_Tp (&)[_Nm])' 106 | end(_Tp (&__arr)[_Nm]) noexcept | ^~~ /usr/include/c++/14/bits/range_access.h:106:5: note: candidate expects 1 argument, 0 provided In file included from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:166: /usr/include/c++/14/valarray:1249:5: note: candidate: 'template<class _Tp> _Tp* std::end(valarray<_Tp>&)' 1249 | end(valarray<_Tp>& __va) noexcept | ^~~ /usr/include/c++/14/valarray:1249:5: note: candidate expects 1 argument, 0 provided /usr/include/c++/14/valarray:1265:5: note: candidate: 'template<class _Tp> const _Tp* std::end(const valarray<_Tp>&)' 1265 | end(const valarray<_Tp>& __va) noexcept | ^~~ /usr/include/c++/14/valarray:1265:5: note: candidate expects 1 argument, 0 provided
s144534501
p03767
C++
#include <bits/stdc++.h> using namespace std; using ll = long long; int main() { int N; cin >> N; vector<ll> A(3*N); for (int i = 0; i < 3*N; i++) cin >> A[i]; sort(A.begin(), A.end()); reverse(A.begin(), A>end()); ll ans = 0; for (int i = 1; i <= 2*N; i += 2) ans += A[i]; cout << ans << endl; }
a.cc: In function 'int main()': a.cc:11:27: error: no matching function for call to 'end()' 11 | reverse(A.begin(), A>end()); | ~~~^~ In file included from /usr/include/c++/14/bits/algorithmfwd.h:39, from /usr/include/c++/14/bits/stl_algo.h:59, from /usr/include/c++/14/algorithm:61, from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:51, from a.cc:1: /usr/include/c++/14/initializer_list:99:5: note: candidate: 'template<class _Tp> constexpr const _Tp* std::end(initializer_list<_Tp>)' 99 | end(initializer_list<_Tp> __ils) noexcept | ^~~ /usr/include/c++/14/initializer_list:99:5: note: candidate expects 1 argument, 0 provided In file included from /usr/include/c++/14/string:53, from /usr/include/c++/14/bitset:52, from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:52: /usr/include/c++/14/bits/range_access.h:74:5: note: candidate: 'template<class _Container> constexpr decltype (__cont.end()) std::end(_Container&)' 74 | end(_Container& __cont) -> decltype(__cont.end()) | ^~~ /usr/include/c++/14/bits/range_access.h:74:5: note: candidate expects 1 argument, 0 provided /usr/include/c++/14/bits/range_access.h:85:5: note: candidate: 'template<class _Container> constexpr decltype (__cont.end()) std::end(const _Container&)' 85 | end(const _Container& __cont) -> decltype(__cont.end()) | ^~~ /usr/include/c++/14/bits/range_access.h:85:5: note: candidate expects 1 argument, 0 provided /usr/include/c++/14/bits/range_access.h:106:5: note: candidate: 'template<class _Tp, long unsigned int _Nm> constexpr _Tp* std::end(_Tp (&)[_Nm])' 106 | end(_Tp (&__arr)[_Nm]) noexcept | ^~~ /usr/include/c++/14/bits/range_access.h:106:5: note: candidate expects 1 argument, 0 provided In file included from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:166: /usr/include/c++/14/valarray:1249:5: note: candidate: 'template<class _Tp> _Tp* std::end(valarray<_Tp>&)' 1249 | end(valarray<_Tp>& __va) noexcept | ^~~ /usr/include/c++/14/valarray:1249:5: note: candidate expects 1 argument, 0 provided /usr/include/c++/14/valarray:1265:5: note: candidate: 'template<class _Tp> const _Tp* std::end(const valarray<_Tp>&)' 1265 | end(const valarray<_Tp>& __va) noexcept | ^~~ /usr/include/c++/14/valarray:1265:5: note: candidate expects 1 argument, 0 provided
s226631925
p03767
C++
#include<iostream> #include<vector> #include<algorithm> using namespace std; int main() { int i long long int n; cin >> n; vector<long long int> a(n * 3); //cout << a.size(); for(i=0; i<a.size(); i++) cin >> a[i]; for(i=0; i<a.size(); i++){ if(i + 1 == 3) sort(a.begin(), a.begin() + i); if((i + 1) % 3 == 0) sort(a.begin() + (i + 1) / 3 + 1, a.begin() + i); /* sort(a.begin(),a.begin() + a.size()/2 ); sort(a.begin() + a.size()/2 , a.end()); */ } long long int sum = 0; for(i=1; i<a.size(); i+=3) sum += a[i]; cout << sum << endl; }
a.cc: In function 'int main()': a.cc:10:9: error: expected initializer before 'long' 10 | long long int n; | ^~~~ a.cc:11:16: error: 'n' was not declared in this scope 11 | cin >> n; | ^ a.cc:15:13: error: 'i' was not declared in this scope 15 | for(i=0; i<a.size(); i++) | ^ a.cc:18:13: error: 'i' was not declared in this scope 18 | for(i=0; i<a.size(); i++){ | ^ a.cc:28:13: error: 'i' was not declared in this scope 28 | for(i=1; i<a.size(); i+=3) | ^
s772935091
p03767
C++
#include iostream using namespace std int main() { int n; cin>>n; ll a[3*n]; for(int i=0;i<3*n;i++) cin>>a[i]; sort(a,a+3*n); ll ans=0; for(int i=n;i<3*n;i=i+2) ans+=a[i]; cout<<ans; return 0; }
a.cc:1:10: error: #include expects "FILENAME" or <FILENAME> 1 | #include iostream | ^~~~~~~~ a.cc:2:20: error: expected ';' before 'int' 2 | using namespace std | ^ | ; 3 | int main() | ~~~ a.cc: In function 'int main()': a.cc:6:3: error: 'cin' was not declared in this scope 6 | cin>>n; | ^~~ a.cc:1:1: note: 'std::cin' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>' +++ |+#include <iostream> 1 | #include iostream a.cc:7:3: error: 'll' was not declared in this scope 7 | ll a[3*n]; | ^~ a.cc:9:10: error: 'a' was not declared in this scope 9 | cin>>a[i]; | ^ a.cc:10:8: error: 'a' was not declared in this scope 10 | sort(a,a+3*n); | ^ a.cc:10:3: error: 'sort' was not declared in this scope; did you mean 'short'? 10 | sort(a,a+3*n); | ^~~~ | short a.cc:11:5: error: expected ';' before 'ans' 11 | ll ans=0; | ^~~~ | ; a.cc:13:5: error: 'ans' was not declared in this scope 13 | ans+=a[i]; | ^~~ a.cc:14:3: error: 'cout' was not declared in this scope 14 | cout<<ans; | ^~~~ a.cc:14:3: note: 'std::cout' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>' a.cc:14:9: error: 'ans' was not declared in this scope 14 | cout<<ans; | ^~~
s648740017
p03767
C++
#include <bits/stdc++.h> #define rep(i, n) for(int i = 0; i <(int)(n); i++) using namespace std; int main(){ int N; cin >> N; int num = 3 * N; int a[num]; rep(i, num){ cin >> a[i]; } sort(a, a+num, greater<int>); int ans = 0; rep(i,N * 2){ if(i % 2 == 1){ ans += a[i]; } } cout << ans << endl; }
a.cc: In function 'int main()': a.cc:18:30: error: expected primary-expression before ')' token 18 | sort(a, a+num, greater<int>); | ^
s715368511
p03767
C++
#include <iostream> #include <algorithm> #define rep(i, n) for(int i = 0; i <(int)(n); i++) using namespace std; int main(){ int N; cin >> N; int a[3N]; rep(i, N){ cin >> a[i]; } sort(a, a+N); int ans = 0; rep(i,N){ ans += a[N+i]; } cout << ans << endl; }
a.cc: In function 'int main()': a.cc:12:9: error: unable to find numeric literal operator 'operator""N' 12 | int a[3N]; | ^~ a.cc:14:12: error: 'a' was not declared in this scope 14 | cin >> a[i]; | ^ a.cc:17:8: error: 'a' was not declared in this scope 17 | sort(a, a+N); | ^
s517713001
p03767
C++
#include <iostream> #include <algorithm> #difine rep(i, n) for(int i = 0; i <(int)(n); i++) using namespace std; int main(){ int N; cin >> N; int a[3N]; rep(i, N){ cin >> a[i]; } sort(a, a+N); int ans = 0; rep(i,N){ ans += a[N+i]; } cout << ans << endl; }
a.cc:4:2: error: invalid preprocessing directive #difine; did you mean #define? 4 | #difine rep(i, n) for(int i = 0; i <(int)(n); i++) | ^~~~~~ | define a.cc: In function 'int main()': a.cc:12:9: error: unable to find numeric literal operator 'operator""N' 12 | int a[3N]; | ^~ a.cc:13:7: error: 'i' was not declared in this scope 13 | rep(i, N){ | ^ a.cc:13:3: error: 'rep' was not declared in this scope 13 | rep(i, N){ | ^~~ a.cc:17:8: error: 'a' was not declared in this scope 17 | sort(a, a+N); | ^
s873313690
p03767
C++
#include<bits/stdc++.h> using namespace std; int main(){ int N; cin >> N; int a[1000000]; int ans = 0; for(int i = 0; i < 3N; i++){ cin >> a[i]; } sort(a,a + 3N, greater<int>()); for(int i = 0; i < N ; i++){ ans += a[1 + 2*i]; } cout << ans << endl; return 0; }
a.cc: In function 'int main()': a.cc:9:24: error: unable to find numeric literal operator 'operator""N' 9 | for(int i = 0; i < 3N; i++){ | ^~ a.cc:13:16: error: unable to find numeric literal operator 'operator""N' 13 | sort(a,a + 3N, greater<int>()); | ^~
s338210042
p03767
C++
#define rrep(i,cc,n) for(long i=cc;i>n;--i) using ll = long long; int main() { int N; cin >> N; vector<ll> p(3*N); rep(i, 0, 3*N) cin >> p[i]; sort(p.begin(),p.end()); rep(i, 0, N) p.erase(p.begin()); ll ans = 0; rep(i, 0, N){ ans += p[0]; p.erase(p.begin()); } cout << ans << endl; }
a.cc: In function 'int main()': a.cc:6:5: error: 'cin' was not declared in this scope 6 | cin >> N; | ^~~ a.cc:7:5: error: 'vector' was not declared in this scope 7 | vector<ll> p(3*N); | ^~~~~~ a.cc:7:14: error: expected primary-expression before '>' token 7 | vector<ll> p(3*N); | ^ a.cc:7:16: error: 'p' was not declared in this scope 7 | vector<ll> p(3*N); | ^ a.cc:8:9: error: 'i' was not declared in this scope 8 | rep(i, 0, 3*N) cin >> p[i]; | ^ a.cc:8:5: error: 'rep' was not declared in this scope; did you mean 'rrep'? 8 | rep(i, 0, 3*N) cin >> p[i]; | ^~~ | rrep a.cc:10:5: error: 'sort' was not declared in this scope; did you mean 'short'? 10 | sort(p.begin(),p.end()); | ^~~~ | short a.cc:18:5: error: 'cout' was not declared in this scope 18 | cout << ans << endl; | ^~~~ a.cc:18:20: error: 'endl' was not declared in this scope 18 | cout << ans << endl; | ^~~~
s299903312
p03767
C
#define _CRT_SECURE_NO_WARNINGS #include <stdio.h> #include <stdlib.h> int main(void) { int n, i, j, tmp, sum=0; long long int a[300005]; scanf("%d", &n); for (i = 0; i < 3*n; i++) { scanf("%d", &a[i]); } qsort(a, 3*n, sizeof(long long), cmp); for (i = 1; i < 2*n; i += 2) { sum += a[i]; } printf("%d", sum); return 0; }
main.c: In function 'main': main.c:16:42: error: 'cmp' undeclared (first use in this function); did you mean 'tmp'? 16 | qsort(a, 3*n, sizeof(long long), cmp); | ^~~ | tmp main.c:16:42: note: each undeclared identifier is reported only once for each function it appears in
s120467745
p03767
C++
# Problem: https://atcoder.jp/contests/agc012/tasks/agc012_a # Python 1st Try import sys # from collections import defaultdict # import heapq,copy # from collections import deque def II(): return int(sys.stdin.readline()) def MI(): return map(int, sys.stdin.readline().split()) def LI(): return list(map(int, sys.stdin.readline().split())) def LLI(rows_number): return [LI() for _ in range(rows_number)] def solver(eachPoints): result = 0 menbers = len(eachPoints) group = menbers // 3 eachPoints.sort(reverse=False) print(eachPoints) useSkillList = [] # 最初のグループ個だけカットしたリストを新規作成[0,1,2,3,4,5]->[2,3,4,5] for ui in range(group, menbers, +1): useSkillList.append(eachPoints[ui]) # print("UseListOnly {}".format(useSkillList)) # for pi in range(0, menbers): # if pi // group == 1: # print("Get Position -> {}={}".format(pi, eachPoints[pi])) # result = result + eachPoints[pi] # algorithm for sum2pos in range(0, len(useSkillList), +2): result = useSkillList[sum2pos] + result return result if __name__ == "__main__": _ = II() AI = LI() print("{}".format(solver(AI)))
a.cc:1:3: error: invalid preprocessing directive #Problem 1 | # Problem: https://atcoder.jp/contests/agc012/tasks/agc012_a | ^~~~~~~ a.cc:2:3: error: invalid preprocessing directive #Python 2 | # Python 1st Try | ^~~~~~ a.cc:5:3: error: invalid preprocessing directive #from 5 | # from collections import defaultdict | ^~~~ a.cc:6:3: warning: #import is a deprecated GCC extension [-Wdeprecated] 6 | # import heapq,copy | ^~~~~~ a.cc:6:10: error: #import expects "FILENAME" or <FILENAME> 6 | # import heapq,copy | ^~~~~ a.cc:7:3: error: invalid preprocessing directive #from 7 | # from collections import deque | ^~~~ a.cc:29:8: error: invalid preprocessing directive #\U00006700\U0000521d\U0000306e\U000030b0\U000030eb\U000030fc\U000030d7\U0000500b\U00003060\U00003051\U000030ab\U000030c3\U000030c8\U00003057\U0000305f\U000030ea\U000030b9\U000030c8\U00003092\U000065b0\U0000898f\U00004f5c\U00006210 29 | # 最初のグループ個だけカットしたリストを新規作成[0,1,2,3,4,5]->[2,3,4,5] | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ a.cc:32:6: error: invalid preprocessing directive #print 32 | # print("UseListOnly {}".format(useSkillList)) | ^~~~~ a.cc:33:7: error: invalid preprocessing directive #for 33 | # for pi in range(0, menbers): | ^~~ a.cc:34: error: unterminated #if 34 | # if pi // group == 1: a.cc:4:1: error: 'import' does not name a type 4 | import sys | ^~~~~~ a.cc:4:1: note: C++20 'import' only available with '-fmodules-ts'
s849680212
p03767
C++
#include <bits/stdc++.h> using namespace std; int main() { int N; cin >> N; vector<int> p(3N); for (int i=0; i<3N; i++) cin >> p[i]; sort(p.begin(), p.end()); int sum=0; for (int i=1; i<3N; i+=2) sum += p[i]; cout << sum << endl; }
a.cc: In function 'int main()': a.cc:6:17: error: unable to find numeric literal operator 'operator""N' 6 | vector<int> p(3N); | ^~ a.cc:7:19: error: unable to find numeric literal operator 'operator""N' 7 | for (int i=0; i<3N; i++) cin >> p[i]; | ^~ a.cc:10:19: error: unable to find numeric literal operator 'operator""N' 10 | for (int i=1; i<3N; i+=2) sum += p[i]; | ^~
s864708116
p03767
C++
#include <bits/stdc++.h> using namespace std; #define REP(i, n) for (ll (i) = 0 ; (i) < (ll)(n) ; ++(i)) #define REPN(i, m, n) for (ll (i) = m ; (i) < (ll)(n) ; ++(i)) #define REP_REV(i, n) for (ll (i) = (ll)(n) - 1 ; (i) >= 0 ; --(i)) #define REPN_REV(i, m, n) for (ll (i) = (ll)(n) - 1 ; (i) >= m ; --(i)) #define INF 2e9 #define INF_LL 1LL<<60 #define ll long long #define Ceil(x, n) (((((x))+((n)-1))/n)) #define CeilN(x, n) (((((x))+((n)-1))/n)*n) #define FloorN(x, n) ((x)-(x)%(n)) #define ALL(x) (x).begin(),(x).end() typedef pair<ll, ll> P; int main() { ll n, ans = 0; cin >> n; vector<ll> a(3*n); REP(i, 3*n) cin >> a[i]; sort(ALL(a)); REPN(i, n) { ans += a[2*i + 1]; } cout << ans << endl; return 0; }
a.cc:26:14: error: macro "REPN" requires 3 arguments, but only 2 given 26 | REPN(i, n) { | ^ a.cc:6:9: note: macro "REPN" defined here 6 | #define REPN(i, m, n) for (ll (i) = m ; (i) < (ll)(n) ; ++(i)) | ^~~~ a.cc: In function 'int main()': a.cc:26:5: error: 'REPN' was not declared in this scope 26 | REPN(i, n) { | ^~~~
s865612228
p03767
C++
#include <bits/stdc++.h> using namespace std; #define rep(i, n) for(int i = 0; i < (int)(n); i++) int main(){ int N; cin >> N; vector<int> v(3 * N); rep(i, N) cin >> v.at(i); sort(v.begin(), v.end(), greater<intf>()); intf sum = 0; for(int i = 0; i < N; i ++){ sum += v.at(2 * N + 1); } cout << sum << endl; }
a.cc: In function 'int main()': a.cc:11:38: error: 'intf' was not declared in this scope; did you mean 'rintf'? 11 | sort(v.begin(), v.end(), greater<intf>()); | ^~~~ | rintf a.cc:11:42: error: template argument 1 is invalid 11 | sort(v.begin(), v.end(), greater<intf>()); | ^ a.cc:12:9: error: expected ';' before 'sum' 12 | intf sum = 0; | ^~~~ | ; a.cc:14:9: error: 'sum' was not declared in this scope 14 | sum += v.at(2 * N + 1); | ^~~ a.cc:16:13: error: 'sum' was not declared in this scope 16 | cout << sum << endl; | ^~~
s335588826
p03767
C++
#include <bits/stdc++.h> using namespace std; #define rep(i, n) for(int i = 0; i < (int)(n); i++) int main(){ int N; cin >> N; vector<int> v(3 * N); rep(i, N) cin >> v.at(i); sort(v.begin(), v.end(), greater<longlong>()); longlong sum = 0; for(int i = 0; i < N; i ++){ sum += v.at(2 * N + 1); } cout << sum << endl; }
a.cc: In function 'int main()': a.cc:11:38: error: 'longlong' was not declared in this scope 11 | sort(v.begin(), v.end(), greater<longlong>()); | ^~~~~~~~ a.cc:11:46: error: template argument 1 is invalid 11 | sort(v.begin(), v.end(), greater<longlong>()); | ^ a.cc:12:13: error: expected ';' before 'sum' 12 | longlong sum = 0; | ^~~~ | ; a.cc:14:9: error: 'sum' was not declared in this scope 14 | sum += v.at(2 * N + 1); | ^~~ a.cc:16:13: error: 'sum' was not declared in this scope 16 | cout << sum << endl; | ^~~
s018382579
p03767
C++
#include <bits/stdc++.h> using namespace std; #define rep(i, n) for(int i = 0; i < (int)(n); i++) int main(){ int N, NN, NNN; cin >> N; NN = 2 * N; NNN = 3 * N; vector<int> v(NNN); rep(i, N) cin >> v.at(i); sort(v.begin(), v.end(), greater<int>()); rep (i, N){ int sum += v.at(NN); } cout << sum << endl; }
a.cc: In function 'int main()': a.cc:15:17: error: expected initializer before '+=' token 15 | int sum += v.at(NN); | ^~ a.cc:17:13: error: 'sum' was not declared in this scope 17 | cout << sum << endl; | ^~~
s000906415
p03767
C++
#include <bits/stdc++.h> using namespace std; #define rep(i, n) for(int i = 0; i < (int)(n); i++) int main(){ int N, 2N, 3N; cin >> N; 2N = 2 * N; 3N = 3 * N; vector<int> v(3N); rep(i, N) cin >> v.at(i); sort(v.begin(), v.end(), greater<int>()); rep (i, N){ int sum += v.at(2N); } cout << sum << endl; }
a.cc: In function 'int main()': a.cc:6:16: error: expected unqualified-id before numeric constant 6 | int N, 2N, 3N; | ^~ a.cc:8:5: error: unable to find numeric literal operator 'operator""N' 8 | 2N = 2 * N; | ^~ a.cc:9:5: error: unable to find numeric literal operator 'operator""N' 9 | 3N = 3 * N; | ^~ a.cc:10:19: error: unable to find numeric literal operator 'operator""N' 10 | vector<int> v(3N); | ^~ a.cc:15:17: error: expected initializer before '+=' token 15 | int sum += v.at(2N); | ^~ a.cc:17:13: error: 'sum' was not declared in this scope 17 | cout << sum << endl; | ^~~
s120572634
p03767
C++
#include <bits/stdc++.h> using namespace std; #define rep(i, n) for(int i = 0; i < (int)(n); i++) int main{ int N, 2N, 3N; cin >> N; 2N = 2 * N; 3N = 3 * N; vector<int> v(3N); rep(i, N) cin >> v.at(i); sort(v.begin(), v.end(), greater<int>()); rep (i, N){ int sum += v.at(2N); } cout << sum << endl; }
a.cc:5:5: error: cannot declare '::main' to be a global variable 5 | int main{ | ^~~~ a.cc:6:9: error: expected primary-expression before 'int' 6 | int N, 2N, 3N; | ^~~ a.cc:6:9: error: expected '}' before 'int' a.cc:5:9: note: to match this '{' 5 | int main{ | ^ a.cc:7:5: error: 'cin' does not name a type 7 | cin >> N; | ^~~ a.cc:8:5: error: expected unqualified-id before numeric constant 8 | 2N = 2 * N; | ^~ a.cc:9:5: error: expected unqualified-id before numeric constant 9 | 3N = 3 * N; | ^~ a.cc:10:19: error: unable to find numeric literal operator 'operator""N' 10 | vector<int> v(3N); | ^~ a.cc:3:19: error: expected unqualified-id before 'for' 3 | #define rep(i, n) for(int i = 0; i < (int)(n); i++) | ^~~ a.cc:11:5: note: in expansion of macro 'rep' 11 | rep(i, N) cin >> v.at(i); | ^~~ a.cc:11:9: error: 'i' does not name a type 11 | rep(i, N) cin >> v.at(i); | ^ a.cc:3:34: note: in definition of macro 'rep' 3 | #define rep(i, n) for(int i = 0; i < (int)(n); i++) | ^ a.cc:11:9: error: 'i' does not name a type 11 | rep(i, N) cin >> v.at(i); | ^ a.cc:3:48: note: in definition of macro 'rep' 3 | #define rep(i, n) for(int i = 0; i < (int)(n); i++) | ^ a.cc:13:9: error: expected constructor, destructor, or type conversion before '(' token 13 | sort(v.begin(), v.end(), greater<int>()); | ^ a.cc:3:19: error: expected unqualified-id before 'for' 3 | #define rep(i, n) for(int i = 0; i < (int)(n); i++) | ^~~ a.cc:14:5: note: in expansion of macro 'rep' 14 | rep (i, N){ | ^~~ a.cc:14:10: error: 'i' does not name a type 14 | rep (i, N){ | ^ a.cc:3:34: note: in definition of macro 'rep' 3 | #define rep(i, n) for(int i = 0; i < (int)(n); i++) | ^ a.cc:14:10: error: 'i' does not name a type 14 | rep (i, N){ | ^ a.cc:3:48: note: in definition of macro 'rep' 3 | #define rep(i, n) for(int i = 0; i < (int)(n); i++) | ^ a.cc:17:5: error: 'cout' does not name a type 17 | cout << sum << endl; | ^~~~ a.cc:18:1: error: expected declaration before '}' token 18 | } | ^