submission_id
stringlengths
10
10
problem_id
stringlengths
6
6
language
stringclasses
3 values
code
stringlengths
1
522k
compiler_output
stringlengths
43
10.2k
s020734053
p03819
C++
#include <bits/stdc++.h> #define N 400010 using namespace std; namespace fastIO{ #define BUF_SIZE 100005 #define OUT_SIZE 100005 #define ll long long //fread->read bool IOerror=0; inline char nc(){ static char buf[BUF_SIZE],*p1=buf+BUF_SIZE,*pend=buf+BUF_SIZE; if (p1==pend){ p1=buf; pend=buf+fread(buf,1,BUF_SIZE,stdin); if (pend==p1){IOerror=1;return -1;} //{printf("IO error!\n");system("pause");for (;;);exit(0);} } return *p1++; } inline bool blank(char ch){return ch==' '||ch=='\n'||ch=='\r'||ch=='\t';} inline void read(int &x){ bool sign=0; char ch=nc(); x=0; for (;blank(ch);ch=nc()); if (IOerror)return; if (ch=='-')sign=1,ch=nc(); for (;ch>='0'&&ch<='9';ch=nc())x=x*10+ch-'0'; if (sign)x=-x; } inline void read(ll &x){ bool sign=0; char ch=nc(); x=0; for (;blank(ch);ch=nc()); if (IOerror)return; if (ch=='-')sign=1,ch=nc(); for (;ch>='0'&&ch<='9';ch=nc())x=x*10+ch-'0'; if (sign)x=-x; } inline void read(double &x){ bool sign=0; char ch=nc(); x=0; for (;blank(ch);ch=nc()); if (IOerror)return; if (ch=='-')sign=1,ch=nc(); for (;ch>='0'&&ch<='9';ch=nc())x=x*10+ch-'0'; if (ch=='.'){ double tmp=1; ch=nc(); for (;ch>='0'&&ch<='9';ch=nc())tmp/=10.0,x+=tmp*(ch-'0'); } if (sign)x=-x; } inline void read(char *s){ char ch=nc(); for (;blank(ch);ch=nc()); if (IOerror)return; for (;!blank(ch)&&!IOerror;ch=nc())*s++=ch; *s=0; } inline void read(char &c){ for (c=nc();blank(c);c=nc()); if (IOerror){c=-1;return;} } //getchar->read inline void read1(int &x){ char ch;int bo=0;x=0; for (ch=getchar();ch<'0'||ch>'9';ch=getchar())if (ch=='-')bo=1; for (;ch>='0'&&ch<='9';x=x*10+ch-'0',ch=getchar()); if (bo)x=-x; } inline void read1(ll &x){ char ch;int bo=0;x=0; for (ch=getchar();ch<'0'||ch>'9';ch=getchar())if (ch=='-')bo=1; for (;ch>='0'&&ch<='9';x=x*10+ch-'0',ch=getchar()); if (bo)x=-x; } inline void read1(double &x){ char ch;int bo=0;x=0; for (ch=getchar();ch<'0'||ch>'9';ch=getchar())if (ch=='-')bo=1; for (;ch>='0'&&ch<='9';x=x*10+ch-'0',ch=getchar()); if (ch=='.'){ double tmp=1; for (ch=getchar();ch>='0'&&ch<='9';tmp/=10.0,x+=tmp*(ch-'0'),ch=getchar()); } if (bo)x=-x; } inline void read1(char *s){ char ch=getchar(); for (;blank(ch);ch=getchar()); for (;!blank(ch);ch=getchar())*s++=ch; *s=0; } inline void read1(char &c){for (c=getchar();blank(c);c=getchar());} //scanf->read inline void read2(int &x){scanf("%d",&x);} inline void read2(ll &x){ #ifdef _WIN32 scanf("%I64d",&x); #else #ifdef __linux scanf("%lld",&x); #else puts("error:can¡®t recognize the system!"); #endif #endif } inline void read2(double &x){scanf("%lf",&x);} inline void read2(char *s){scanf("%s",s);} inline void read2(char &c){scanf(" %c",&c);} inline void readln2(char *s){gets(s);} //fwrite->write struct Ostream_fwrite{ char *buf,*p1,*pend; Ostream_fwrite(){buf=new char[BUF_SIZE];p1=buf;pend=buf+BUF_SIZE;} void out(char ch){ if (p1==pend){ fwrite(buf,1,BUF_SIZE,stdout);p1=buf; } *p1++=ch; } void print(int x){ static char s[15],*s1;s1=s; if (!x)*s1++='0';if (x<0)out('-'),x=-x; while(x)*s1++=x%10+'0',x/=10; while(s1--!=s)out(*s1); } void println(int x){ static char s[15],*s1;s1=s; if (!x)*s1++='0';if (x<0)out('-'),x=-x; while(x)*s1++=x%10+'0',x/=10; while(s1--!=s)out(*s1); out('\n'); } void print(ll x){ static char s[25],*s1;s1=s; if (!x)*s1++='0';if (x<0)out('-'),x=-x; while(x)*s1++=x%10+'0',x/=10; while(s1--!=s)out(*s1); } void println(ll x){ static char s[25],*s1;s1=s; if (!x)*s1++='0';if (x<0)out('-'),x=-x; while(x)*s1++=x%10+'0',x/=10; while(s1--!=s)out(*s1); out('\n'); } void print(double x,int y){ static ll mul[]={1,10,100,1000,10000,100000,1000000,10000000,100000000, 1000000000,10000000000LL,100000000000LL,1000000000000LL,10000000000000LL, 100000000000000LL,1000000000000000LL,10000000000000000LL,100000000000000000LL}; if (x<-1e-12)out('-'),x=-x;x*=mul[y]; ll x1=(ll)floor(x); if (x-floor(x)>=0.5)++x1; ll x2=x1/mul[y],x3=x1-x2*mul[y]; print(x2); if (y>0){out('.'); for (size_t i=1;i<y&&x3*mul[i]<mul[y];out('0'),++i); print(x3);} } void println(double x,int y){print(x,y);out('\n');} void print(char *s){while (*s)out(*s++);} void println(char *s){while (*s)out(*s++);out('\n');} void flush(){if (p1!=buf){fwrite(buf,1,p1-buf,stdout);p1=buf;}} ~Ostream_fwrite(){flush();} }Ostream; inline void print(int x){Ostream.print(x);} inline void println(int x){Ostream.println(x);} inline void print(char x){Ostream.out(x);} inline void println(char x){Ostream.out(x);Ostream.out('\n');} inline void print(ll x){Ostream.print(x);} inline void println(ll x){Ostream.println(x);} inline void print(double x,int y){Ostream.print(x,y);} inline void println(double x,int y){Ostream.println(x,y);} inline void print(char *s){Ostream.print(s);} inline void println(char *s){Ostream.println(s);} inline void println(){Ostream.out('\n');} inline void flush(){Ostream.flush();} //puts->write char Out[OUT_SIZE],*o=Out; inline void print1(int x){ static char buf[15]; char *p1=buf;if (!x)*p1++='0';if (x<0)*o++='-',x=-x; while(x)*p1++=x%10+'0',x/=10; while(p1--!=buf)*o++=*p1; } inline void println1(int x){print1(x);*o++='\n';} inline void print1(ll x){ static char buf[25]; char *p1=buf;if (!x)*p1++='0';if (x<0)*o++='-',x=-x; while(x)*p1++=x%10+'0',x/=10; while(p1--!=buf)*o++=*p1; } inline void println1(ll x){print1(x);*o++='\n';} inline void print1(char c){*o++=c;} inline void println1(char c){*o++=c;*o++='\n';} inline void print1(char *s){while (*s)*o++=*s++;} inline void println1(char *s){print1(s);*o++='\n';} inline void println1(){*o++='\n';} inline void flush1(){if (o!=Out){if (*(o-1)=='\n')*--o=0;puts(Out);}} struct puts_write{ ~puts_write(){flush1();} }_puts; inline void print2(int x){printf("%d",x);} inline void println2(int x){printf("%d\n",x);} inline void print2(char x){printf("%c",x);} inline void println2(char x){printf("%c\n",x);} inline void print2(ll x){ #ifdef _WIN32 printf("%I64d",x); #else #ifdef __linux printf("%lld",x); #else puts("error:can¡®t recognize the system!"); #endif #endif } inline void println2(ll x){print2(x);printf("\n");} inline void println2(){printf("\n");} #undef ll #undef OUT_SIZE #undef BUF_SIZE }; using namespace fastIO; int n,d[N],m; int main() { read(n); read(m); for(int i=1;i<=n;i++) { int l,r; read(l), read(r); d[r-l]++; for(int j=r-l;j<=r;j++) { int jj=(r/(r/j)); int lb=l/(r/j)+bool(l%(r/j)); if(lb>jj) continue; d[jj+1]--; d[max(lb,j)]++; j=jj; } } for(register int i=1;i<=m;i++) d[i]+=d[i-1]; for(register int i=1;i<=m;i++) printf("%d\n",d[i]); return 0 ; }
a.cc: In function 'void fastIO::readln2(char*)': a.cc:106:34: error: 'gets' was not declared in this scope; did you mean 'getw'? 106 | inline void readln2(char *s){gets(s);} | ^~~~ | getw a.cc: In function 'int main()': a.cc:232:26: warning: ISO C++17 does not allow 'register' storage class specifier [-Wregister] 232 | for(register int i=1;i<=m;i++) d[i]+=d[i-1]; | ^ a.cc:233:26: warning: ISO C++17 does not allow 'register' storage class specifier [-Wregister] 233 | for(register int i=1;i<=m;i++) printf("%d\n",d[i]); | ^
s131272366
p03819
Java
import java.util.ArrayList; import java.util.HashMap; import java.util.Map; import java.util.Scanner; public class Main{ public static void main(String[] args) { int bentoType = 0; int stationCnt = 0; Scanner scanner = new Scanner(System.in); System.out.print("弁当の種類を指定してください:"); bentoType = scanner.nextInt(); System.out.print("駅の合計数を指定してください:"); stationCnt = scanner.nextInt(); Map<Integer, Integer> bentoMap = null; ArrayList<Map<Integer, Integer>> array = new ArrayList<Map<Integer, Integer>>(); int startSta = 0; int endSta = 0; System.out.println("AAA:"+bentoType); for(int i = 1; i <= bentoType; i++){ bentoMap = new HashMap<Integer, Integer>(); System.out.print("弁当"+i+"の開始駅を指定してくださ い:"); startSta = scanner.nextInt(); System.out.print("弁当"+i+"の終了駅を指定してくださ い:"); endSta = scanner.nextInt(); for(int start = startSta; start <= endSta; start++){ bentoMap.put(start, 1); } array.add(bentoMap); } int bentoCnt = 0; // 飛ばす駅数のループ for(int n = 1; n <= stationCnt; n++){ bentoCnt = 0; // 種類のループ for(Map<Integer, Integer> outMap : array){ // System.out.print("["); //到着する駅でのループ for(int m = 0; m <= stationCnt; m +=n){ if(outMap.containsKey(m)){ bentoCnt++; // System.out.print(m); break; } } // System.out.print("],"); } // System.out.print(" = "); System.out.println(bentoCnt); } scanner.close(); } }
Main.java:23: error: unclosed string literal System.out.print("??"+i+"???????????? ^ Main.java:24: error: illegal character: '\uff1a' ??"); ^ Main.java:24: error: not a statement ??"); ^ Main.java:24: error: unclosed string literal ??"); ^ Main.java:26: error: unclosed string literal System.out.print("??"+i+"???????????? ^ Main.java:27: error: illegal character: '\uff1a' ??"); ^ Main.java:27: error: not a statement ??"); ^ Main.java:27: error: unclosed string literal ??"); ^ 8 errors
s016789349
p03819
Java
import java.util.ArrayList; import java.util.HashMap; import java.util.Map; import java.util.Scanner; public class Java06 { public static void main(String[] args) { int bentoType = 0; int stationCnt = 0; Scanner scanner = new Scanner(System.in); System.out.print("弁当の種類を指定してください:"); bentoType = scanner.nextInt(); System.out.print("駅の合計数を指定してください:"); stationCnt = scanner.nextInt(); Map<Integer, Integer> bentoMap = null; ArrayList<Map<Integer, Integer>> array = new ArrayList<Map<Integer, Integer>>(); int startSta = 0; int endSta = 0; System.out.println("AAA:"+bentoType); for(int i = 1; i <= bentoType; i++){ bentoMap = new HashMap<Integer, Integer>(); System.out.print("弁当"+i+"の開始駅を指定してくださ い:"); startSta = scanner.nextInt(); System.out.print("弁当"+i+"の終了駅を指定してくださ い:"); endSta = scanner.nextInt(); for(int start = startSta; start <= endSta; start++){ bentoMap.put(start, 1); } array.add(bentoMap); } int bentoCnt = 0; // 飛ばす駅数のループ for(int n = 1; n <= stationCnt; n++){ bentoCnt = 0; // 種類のループ for(Map<Integer, Integer> outMap : array){ // System.out.print("["); //到着する駅でのループ for(int m = 0; m <= stationCnt; m +=n){ if(outMap.containsKey(m)){ bentoCnt++; // System.out.print(m); break; } } // System.out.print("],"); } // System.out.print(" = "); System.out.println(bentoCnt); } scanner.close(); } }
Main.java:23: error: unclosed string literal System.out.print("??"+i+"???????????? ^ Main.java:24: error: illegal character: '\uff1a' ??"); ^ Main.java:24: error: not a statement ??"); ^ Main.java:24: error: unclosed string literal ??"); ^ Main.java:26: error: unclosed string literal System.out.print("??"+i+"???????????? ^ Main.java:27: error: illegal character: '\uff1a' ??"); ^ Main.java:27: error: not a statement ??"); ^ Main.java:27: error: unclosed string literal ??"); ^ 8 errors
s162139102
p03819
C++
#include<iostream> #include<algorithm> #include<vector> using namespace std; vector<pair<int,int> > v[100010]; int bit[100010],n,m; void add(int x,int k){ while(x<=m+1){ bit[x]+=k; x+=x&-x; } } int sum(int x){ int s=0; while(x){ s+=bit[x]; x-=x&-x; } return s; } int main(){ cin>>n>>m; memset(bit,0,m+1); for(int i=0;i<n;i++){ int a,b;cin>>a>>b; v[b-a+1].push_back(make_pair(a,b)); } for(int k=1;k<=m;k++){ for(int i=0;i<v[k-1].size();i++){ add(v[k-1][i].first,1); add(v[k-1][i].second+1,-1); n--; } int cnt=n; for(int i=k;i<=m;i+=k){ cnt+=sum(i); } cout<<cnt<<endl; } return 0; }
a.cc: In function 'int main()': a.cc:24:9: error: 'memset' was not declared in this scope 24 | memset(bit,0,m+1); | ^~~~~~ a.cc:4:1: note: 'memset' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>' 3 | #include<vector> +++ |+#include <cstring> 4 | using namespace std;
s440194566
p03819
C++
#pragma region include #include <iostream> #include <iomanip> #include <stdio.h> #include <sstream> #include <algorithm> #include <cmath> #include <complex> #include <string> #include <cstring> #include <vector> #include <tuple> #include <bitset> #include <queue> #include <complex> #include <set> #include <map> #include <stack> #include <list> #include <fstream> #include <random> //#include <time.h> #include <ctime> #pragma endregion //#include ///////// #define REP(i, x, n) for(int i = x; i < n; ++i) #define rep(i,n) REP(i,0,n) ///////// #pragma region typedef typedef long long LL; typedef long double LD; typedef unsigned long long ULL; #pragma endregion //typedef ////定数 const int INF = (int)1e9; const LL MOD = (LL)1e9+7; const LL LINF = (LL)1e18; const double PI = acos(-1.0); const double EPS = 1e-9; ///////// using namespace::std; /* thx http://phyllo-algo.hatenablog.com/entry/2017/01/29/050622 */ const int MAX = 100005; map<int,int> query[MAX]; void solve(){ int N,M; cin >> N >> M; vector< vector<int> > pts(N,vector<int>(3)); for(int i=0;i<N;++i){//N種類の区間,集まる種類がある cin >> pts[i][0] >> pts[i][1];//共に[1,M] pts[i][2] = 0;//種類 } //d=1ではすべての区間を通る制約になっている=N vector<int> temp(3);//追加するクエリ用 for(int d=1;d<=M;d++){ for(int p=1;(LL)d*(LL)p<=M;p++){ //Xを含まず、Yを含む区間では、 //d毎に進んだ場合にその区間を通過する一番左になる。 int X = d*(p-1); int Y = d*p; if( query[X].count(Y-1) == 0 ){ query[X][Y-1] = 1; temp[0] = X; temp[1] = Y-1; temp[2] = 1;//種類 pts.push_back( temp ); } if( query[X].count(MAX) == 0 ){ query[X][MAX] = 1; temp[0] = X; temp[1] = MAX; temp[2] = 1; pts.push_back( temp ); } if( query[Y].count(Y-1) == 0 ){ temp[0] = Y; temp[1] = Y-1; temp[2] = 1; pts.push_back( temp ); } if( query[Y].count(MAX) == 0 ){ temp[0] = Y; temp[1] = MAX; temp[2] = 1; pts.push_back( temp ); } } } sort( pts.begin(), pts.end() ); BITree bit(M+1); int size = pts.size(); for(int i=0;i<size;++i){ if( pts[i][2] == 0 ){ bit.add( pts[i][1]+1, 1 ); }else{ int res = bit.sum( pts[i][1]+1 ); query[ pts[i][0] ][ pts[i][1] ] = res; } } // for(int d=1;d<=M;d++){ int ret = 0; for(int p=1;(LL)d*p<=M;p++){ int X = d*(p-1); int Y = d*p; ret += query[Y][MAX] - query[Y][Y-1] - query[X][MAX] + query[X][Y-1]; /* 区間[A,B]をプロットしている。 X < A A <= Y <= B から X < A <= Y Y <= B この領域に含まれる点(区間)の個数を数える。 query[_1][_2]は(_1,_2)と(0,0)で作る長方形内の個数にしてるので。 query[Y][MAX] :=(Y,MAX)の長方形 query[Y][Y-1] :=(Y,Y-1)の長方形 ( y<Yの長方形 query[X][MAX] :=(X,MAX)の長方形 (x<=Xの部分 query[X][Y-1] :=(X,Y-1)の長方形 (x<=Xかつ y<Yの分、引きすぎたのでたす これらの値を点を順番にプロットする時に、計算している。 */ } cout << ret << endl; } } #pragma region main signed main(void){ std::cin.tie(0); std::ios::sync_with_stdio(false); std::cout << std::fixed;//小数を10進数表示 cout << setprecision(16);//小数点以下の桁数を指定//coutとcerrで別 solve(); } #pragma endregion //main()
a.cc: In function 'void solve()': a.cc:101:9: error: 'BITree' was not declared in this scope 101 | BITree bit(M+1); | ^~~~~~ a.cc:105:25: error: 'bit' was not declared in this scope 105 | bit.add( pts[i][1]+1, 1 ); | ^~~ a.cc:107:35: error: 'bit' was not declared in this scope 107 | int res = bit.sum( pts[i][1]+1 ); | ^~~
s662878650
p03819
C++
#include <bits/stdc++.h> using namespace std; #define rep(i,x,y) for(int i=(x);i<(y);++i) #define debug(x) #x << "=" << (x) #ifdef DEBUG #define _GLIBCXX_DEBUG #define print(x) std::cerr << debug(x) << " (L:" << __LINE__ << ")" << std::endl #else #define print(x) #endif const int inf=1e9; const int64_t inf64=1e18; const double eps=1e-9; template <typename T> ostream &operator<<(ostream &os, const vector<T> &vec){ os << "["; for (const auto &v : vec) { os << v << ","; } os << "]"; return os; } using i64=int64_t; vector<long long int> prime_factor(long long int n){ vector<long long int> res; for(int i=2; i*i<=n; ++i){ while(n%i==0){ res.push_back(i); n/=i; } } if(n!=1) res.push_back(n); return res; }; class segtree{ public: i64 n,size_; vector<vector<pair<int,int>>> segs; segtree()=default; segtree(i64 size){ init(size); } void init(i64 size){ size_=size; n=1; while(n<size) n*=2; segs.resize(n*2-1); } void insert(int l_,int r_){ insert(0,n,0,l_,r_); } void insert(int a,int b,int index,int l_,int r_){ if(b<=l_ or r_<=a) return; if(l_<=a and b<=r_){ segs[index].push_back(make_pair(l_,r_)); return; } insert(a,(a+b)/2,2*index+1,l_,r_); insert((a+b)/2,b,2*index+2,l_,r_); } int query(int lb,int x){ return query(0,n,0,lb,x); } int query(int a,int b,int index,int lb,int x){ if(/*b<=lb*/ or x<a or b<=x) return 0; int res=0; if(lb<a and a<=x and x<b) res+=segs[index].end()-upper_bound(segs[index].begin(),segs[index].end(),make_pair(lb,inf)); if((a+b)/2<b) res+=query(a,(a+b)/2,index*2+1,lb,x); if(a<(a+b)/2) res+=query((a+b)/2,b,index*2+2,lb,x); return res; } }; void solve(){ int N,M; cin >> N >> M; vector<pair<int,int>> LR; rep(i,0,N){ int L,R; cin >> L >> R; ++R; LR.push_back(make_pair(L,R)); } sort(LR.begin(),LR.end()); segtree seg(M+1); rep(i,0,N) seg.insert(LR[i].first,LR[i].second); rep(i,1,M+1){ int ans=0; rep(j,1,M/i+1){ int tmp=seg.query(i*(j-1),i*j); ans+=seg.query(i*(j-1),i*j); } cout << ans << endl; } } int main(){ std::cin.tie(0); std::ios::sync_with_stdio(false); cout.setf(ios::fixed); cout.precision(10); solve(); return 0; }
a.cc: In member function 'int segtree::query(int, int, int, int, int)': a.cc:65:22: error: expected primary-expression before 'or' token 65 | if(/*b<=lb*/ or x<a or b<=x) return 0; | ^~
s328202871
p03819
C++
#include <iostream> #include <vector> #include <algorithm> #include <utility> using namespace std; #define rep(i, n) for (int i = 0; i < (int)n; i++) #define orep(i, n) for (int i = 1; i <= (int)n; i++) #define vec vector class SegmentTree { private: int def = 0; int n; vec<int> data; int query_rec(int a, int b, int k, int l, int r) { if (r <= a || b <= l) return def; if (a <= l && r <= b) return data[k]; int vl = query_rec(a, b, k * 2 + 1, l, (l + r) / 2); int vr = query_rec(a, b, k * 2 + 2, (l + r) / 2, r); return func(vl, vr); } int func(int vl, int vr) { return vl + vr; } public: SegmentTree(int n_) { n = 1; while(n < n_) n *= 2; data.resize(2 * n - 1); rep(i, data.size()) data[i] = def; } void update(int k, int a) { k += n - 1; data[k] += a; while(k > 0) { k = (k - 1) / 2; data[k] = func(data[k * 2 + 1], data[k * 2 + 2]); } } int query(int a, int b) { return func(a, b, 0, 0, n); } }; int main(void) { int n, m; cin >> n >> m; vec<pair<int, int>> a(n); rep(i, n) cin >> a[i].first >> a[i].second; sort(a.begin(), a.end(), [](pair<int, int> p, pair<int, int> q) { return p.second - p.first < q.second - q.first; }); SegmentTree data(m + 1); int c = 0; orep(i, m) { while(c < n && a[c].second - a[c].first + 1 < i) { data.update(a[c].first - 1, 1); data.update(a[c].second, - 1); c++; } int ans = n - c; orep(j, m / i) ans += data.query(0, i * j); cout << ans << endl; } return 0; }
a.cc: In member function 'int SegmentTree::query(int, int)': a.cc:51:28: error: no matching function for call to 'SegmentTree::func(int&, int&, int, int, int&)' 51 | return func(a, b, 0, 0, n); | ~~~~^~~~~~~~~~~~~~~ a.cc:28:13: note: candidate: 'int SegmentTree::func(int, int)' 28 | int func(int vl, int vr) { | ^~~~ a.cc:28:13: note: candidate expects 2 arguments, 5 provided
s479765074
p03819
C++
#include <iostream> #include <algorithm> #include <vector> using namespace std; #define N (int)1e5 #define F first #define S second typedef pair<int, int> P; int n, m, ans; int l[N + 1], r[N + 1]; P lr[N + 1]; vector<int> vec[N + 10]; int bit[N + 1]; int sum(int i, int *b) { int s = 0; while (i > 0) { s += b[i]; i = i & (i - 1); } return s; } void add(int i, int x, int *b) { while (i <= m) { b[i] += x; i += i & -i; } } int main() { cin >> n >> m; for (int i = 0; i < n; i++) { cin >> lr[i].S >> lr[i].F; l[i] = lr[i].S; r[i] = lr[i].F; lr[i].F = lr[i].F - lr[i].S + 1; } sort(lr, lr + n); int p1 = 0, p2 = 0; for (int i = 1; i <= m; i++) { ans = 0; p2 = lower_bound(lr, lr + n, make_pair(i, 0)) - lr; ans = n - p2; for (int j = p1; j < p2; j++) { add(lr[j].S, 1, bit); add(lr[j].F + lr[j].S, -1, bit); } p1 = p2; for (int j = 0; j <= m; j += i) { ans += sum(j , bit);
a.cc: In function 'int main()': a.cc:57:45: error: expected '}' at end of input 57 | ans += sum(j , bit); | ^ a.cc:56:17: note: to match this '{' 56 | { | ^ a.cc:57:45: error: expected '}' at end of input 57 | ans += sum(j , bit); | ^ a.cc:45:9: note: to match this '{' 45 | { | ^ a.cc:57:45: error: expected '}' at end of input 57 | ans += sum(j , bit); | ^ a.cc:33:1: note: to match this '{' 33 | { | ^
s259523783
p03819
C++
#include <iostream> #include <vector> class BinaryIndexedTree { private: std::vector<int> vals; int n; public: BinaryIndexedTree(int n_) : vals(n_, 0), n(n_) { } void add(int a, int w) { for (int x = a; x <= n; x += x & -x) { vals[x - 1] += w; } } int sum(int a) const { int ret = 0; for (int x = a; x > 0; x -= x & -x) { ret += vals[x - 1]; } return ret; } }; class SnLine { private: struct ProdRange { ProdRange() { l = r = 0; } ProdRange(int l_, int r_) { l = l_; r = r_; } int l, r; }; static ProdRange makeProdRange(int l, int r) { return ProdRange { l, r }; } std::vector<ProdRange> prList; int numProds; int numStops; public: SnLine(int numStops_, int numProds_) { numStops = numStops_; numProds = numProds_; prList.reserve(numProds); } void addProdRange(int l, int r) { prList.emplace_back(l, r); } void solve() { std::sort(prList.begin(), prList.end(), [](const auto& a, const auto& b) { return ((a.r - a.l) < (b.r - b.l)); }); BinaryIndexedTree bit(numStops); int numRemainingProds = numProds; auto pr = prList.begin(); for (int d = 1; d <= numStops; ++d) { int r = numRemainingProds; if (1 < d) { for (int a = d; a <= numStops; a += d) { r += bit.sum(a); } } std::cout << r << std::endl; for(; pr != prList.end() && (d == pr->r - pr->l + 1); ++pr) { bit.add(pr->l, 1); bit.add(pr->r + 1, -1); --numRemainingProds; } } } }; int main() { int N, M; std::cin >> N >> M; SnLine sl(M, N); for (int i = 0; i < N; ++i) { int l, r; std::cin >> l >> r; sl.addProdRange(l, r); } sl.solve(); return 0; }
a.cc: In member function 'void SnLine::solve()': a.cc:65:14: error: 'sort' is not a member of 'std'; did you mean 'qsort'? 65 | std::sort(prList.begin(), prList.end(), | ^~~~ | qsort
s466082901
p03819
C++
#include <vector> #include <map> class BinaryIndexedTree { private: std::vector<int> vals; int n; public: BinaryIndexedTree(int n_) : vals(n_, 0), n(n_) { } void add(int a, int w) { for (int x = a; x <= n; x += x & -x) { vals[x - 1] += w; } } int sum(int a) const { int ret = 0; for (int x = a; x > 0; x -= x & -x) { ret += vals[x - 1]; } return ret; } }; class SnLine { private: struct ProdRange { ProdRange() { l = r = 0; } ProdRange(int l_, int r_) { l = l_; r = r_; } int l, r; }; static ProdRange makeProdRange(int l, int r) { return ProdRange { l, r }; } std::map< int, std::vector<ProdRange> > prList; int numProds; int numStops; public: SnLine(int numStops_) { numStops = numStops_; numProds = 0; } void addProdRange(int l, int r) { int d = r - l + 1; prList[d].emplace_back(l, r); ++numProds; } void solve() { BinaryIndexedTree bit(numStops); auto it = prList.begin(); int numRemainingProds = numProds; for (int d = 1; d <= numStops; ++d) { int r = numRemainingProds; if (1 < d) { for (int a = d; a <= numStops; a += d) { r += bit.sum(a); } } std::cout << r << std::endl; if (it != prList.end() && it->first == d) { for (const ProdRange& pr : it->second) { bit.add(pr.l, 1); bit.add(pr.r + 1, -1); } numRemainingProds -= static_cast<int>(it->second.size()); ++it; } } } }; void main() { int N, M; std::cin >> N >> M; SnLine sl(M); for (int i = 0; i < N; ++i) { int l, r; std::cin >> l >> r; sl.addProdRange(l, r); } sl.solve(); }
a.cc: In member function 'void SnLine::solve()': a.cc:83:18: error: 'cout' is not a member of 'std' 83 | std::cout << r << std::endl; | ^~~~ a.cc:3:1: note: 'std::cout' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>' 2 | #include <map> +++ |+#include <iostream> 3 | a.cc:83:36: error: 'endl' is not a member of 'std' 83 | std::cout << r << std::endl; | ^~~~ a.cc:3:1: note: 'std::endl' is defined in header '<ostream>'; this is probably fixable by adding '#include <ostream>' 2 | #include <map> +++ |+#include <ostream> 3 | a.cc: At global scope: a.cc:99:1: error: '::main' must return 'int' 99 | void main() | ^~~~ a.cc: In function 'int main()': a.cc:102:10: error: 'cin' is not a member of 'std' 102 | std::cin >> N >> M; | ^~~ a.cc:102:10: note: 'std::cin' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>' a.cc:109:14: error: 'cin' is not a member of 'std' 109 | std::cin >> l >> r; | ^~~ a.cc:109:14: note: 'std::cin' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
s220338818
p03819
C++
#include <bits/stdc++.h> using namespace std; class FenwickTree { private: long long n; vector<long long> dat; public: FenwickTree(long long _n): n(_n), dat(_n+1, 0) {} FenwickTree(long long _n, long long init): n(_n), dat(_n+1, 0) { for (long long i = 0; i <= _n; i++) { add(i, init); } } void add(long long idx, long long value) { idx++; while(idx <= n) { dat[idx] += value; idx += idx & -idx; } } long long query(long long l, long long r) { long long ans = 0; r++; while(r > 0) { ans += dat[r]; r -= r & -r; } while(l > 0) { ans -= dat[l]; l -= l & -l; } return ans; } }; bool comp(pair<long long,long long> a, pair<long long,long long> b) { if (a.second - a.first <= b.second - b.first) return true; else return false; } long long main(void) { long long n, m; cin >> n >> m; vector< pair<long long,long long> > A(n); for (long long i = 0; i < n; i++) { cin >> A[i].first >> A[i].second; } sort(A.begin(), A.end(), comp); FenwickTree ft(m+2); long long idx = 0; for (long long d = 1; d < m+1; d++) { long long count = 0; for(; idx < n && A[idx].second - A[idx].first < d; idx++) { ft.add(A[idx].first, 1); ft.add(A[idx].second+1, -1); } for (long long i = 0; i < m+1; i += d) { count += ft.query(0, i); } count += n - idx; cout << count << endl; } }
cc1plus: error: '::main' must return 'int'
s828656951
p03819
C
?????????
main.c:1:1: error: expected identifier or '(' before '?' token 1 | ????????? | ^
s056074173
p03819
C
Fight dayo!
main.c:1:1: error: unknown type name 'Fight' 1 | Fight dayo! | ^~~~~ main.c:1:11: error: expected '=', ',', ';', 'asm' or '__attribute__' before '!' token 1 | Fight dayo! | ^
s767272631
p03819
C
QVQ
main.c:1:1: error: expected '=', ',', ';', 'asm' or '__attribute__' at end of input 1 | QVQ | ^~~
s580255136
p03819
Java
#include<bits/stdc++.h> using namespace std; typedef long long ll; typedef pair<int, int> PII; const int MM = 1e9 + 7; const double eps = 1e-8; const int MAXN = 2e6 + 10; int n, m; void prework(){ } void read(){ } int K; ll C[2222][2222]; ll pw[2222]; ll f[2222][2222]; ll sum[2222][2222]; void solve(int casi){ cin>>n>>K; C[0][0] = C[1][0] = C[1][1] = 1; for(int i = 2; i <= 2000; i++){ C[i][0] = C[i][i] = 1; for(int j = 1; j < i; j++) C[i][j] = (C[i-1][j-1] + C[i-1][j]) % MM; } pw[0] = 1; for(int i = 1; i <= 2000; i++){ pw[i] = (2 * pw[i-1]) % MM; } ll ans = 0;//pw[n-K-1]; f[0][0] = 1; for(int i = 0; i <= n; i++) sum[0][i] = 1; for(int i = 1; i < K; i++){ for(int j = 0; j <= n - i; j++){ f[i][j] = sum[i-1][j+1]; } sum[i][0] = f[i][0]; for(int j = 1; j <= n - i; j++) sum[i][j] = (sum[i][j-1] + f[i][j]) % MM; } for(int i = 0; i <= n - K; i++) ans = (ans + f[K-1][i]) % MM; cout<<((K!=n)?(ans * pw[n-K-1] % MM):ans)<<endl; } void printans(){ } int main(){ prework(); int T = 1; // cin>>T; for(int i = 1; i <= T; i++){ read(); solve(i); printans(); } 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:5: error: class, interface, enum, or record expected typedef long long ll; ^ Main.java:6: error: class, interface, enum, or record expected typedef pair<int, int> PII; ^ Main.java:8: error: class, interface, enum, or record expected const int MM = 1e9 + 7; ^ Main.java:9: error: class, interface, enum, or record expected const double eps = 1e-8; ^ Main.java:10: error: class, interface, enum, or record expected const int MAXN = 2e6 + 10; ^ Main.java:12: error: class, interface, enum, or record expected int n, m; ^ Main.java:14: error: unnamed classes are a preview feature and are disabled by default. void prework(){ ^ (use --enable-preview to enable unnamed classes) Main.java:23: error: class, interface, enum, or record expected ll C[2222][2222]; ^ Main.java:24: error: class, interface, enum, or record expected ll pw[2222]; ^ Main.java:25: error: class, interface, enum, or record expected ll f[2222][2222]; ^ Main.java:26: error: class, interface, enum, or record expected ll sum[2222][2222]; ^ Main.java:29: error: not a statement cin>>n>>K; ^ Main.java:54: error: not a statement cout<<((K!=n)?(ans * pw[n-K-1] % MM):ans)<<endl; ^ 15 errors
s910022449
p03819
C++
#include <vector> #include <list> #include <map> #include <set> #include <queue> #include <deque> #include <stack> #include <bitset> #include <algorithm> #include <functional> #include <numeric> #include <utility> #include <sstream> #include <iostream> #include <iomanip> #include <cstdio> #include <cmath> #include <cstdlib> #include <cctype> #include <string> #include <cstring> #include <ctime> #include <climits> #define int long long #define FOR(i, a, b) for (int i = (a); i < (b); ++i) #define REP(i, n) FOR(i, 0, n) #define ALL(a) (a).begin(), (a).end() #define SZ(a) (signed)((a).size()) #define EACH(i, c) for (typeof((c).begin()) i = (c).begin(); i != (c).end(); ++i) #define EXIST(s, e) ((s).find(e) != (s).end()) #define SORT(c) sort((c).begin(), (c).end()) using namespace std; typedef vector<int> VI; typedef vector<VI> VVI; typedef vector<string> VS; typedef pair<int, int> PII; const int MOD = 1000000007; #define dump(x) cerr << #x << " = " << (x) << endl; #define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl; signed main(void) { ios::sync_with_stdio(false); cout.setf(ios::fixed, ios::floatfield); cout.precision(10); cin.tie(0); int n,m; cin >> n >> m; VI l(n),r(n); REP(i,n){ cin >> l[i] >> r[i]; } VI ans (m+1,0); while (m>0){ VI p(m+2,0); REP(i,n){ p[l[i]]++; p[r[i]+1]--; } FOR(i,1,m+2){ p[i] += p[i-1]; } FOR(i,(m+1)/2,m+1){ ans[i] = p[i]; } m/=2; REP(i,n){ if(l[i]>m){ l[i]/=2; r[i]/=2; } } } REP(i,n){ cut << ans[i] << endl; } return 0; }
a.cc: In function 'int main()': a.cc:84:9: error: 'cut' was not declared in this scope 84 | cut << ans[i] << endl; | ^~~
s456159292
p03819
C++
#include <vector> #include <iostream> #include <algorithm> #pragma warning(disable : 4996) using namespace std; int N, M, l[300009], r[300009], c[300009]; vector<int> d[100009], lc[100009], rc[100009]; int main() { cin >> N >> M; for (int i = 0; i < N; i++) { scanf("%d%d", &l[i], &r[i]), l[i]--, c[i] = r[i] - l[i]; lc[l[i]].push_back(i); rc[r[i]].push_back(i); } for (int i = 1; i <= M; i++) { int B = sqrt(i); for (int j = 1; j <= B; j++) { int x = i / j; d[x].push_back(i); } int z = i / B; for (int j = 1; j < z; j++) { if (i / j != i / (j + 1)) { d[j].push_back(i); } } } for (int i = 1; i <= M; i++) { sort(d[i].begin(), d[i].end()); d[i].erase(unique(d[i].begin(), d[i].end()), d[i].end()); } int ret = N; for (int i = 1; i <= M; i++) { printf("%d\n", ret); for (int j : d[i]) { for (int k : rc[j]) { if (c[k] >= 1) ret--; c[k] -= r[k] / i - r[k] / (i + 1); if (c[k] >= 1) ret++; } for (int k : lc[j]) { if (c[k] >= 1) ret--; c[k] += l[k] / i - l[k] / (i + 1); if (c[k] >= 1) ret++; } } } return 0; }
a.cc: In function 'int main()': a.cc:15:25: error: 'sqrt' was not declared in this scope 15 | int B = sqrt(i); | ^~~~
s479665412
p03819
C++
#include <stdio.h> #include <algorithm> using namespace std; struct data{ int s,e; bool operator<(const data&r)const{ if(s==r.s)return e<r.e; return s<r.s; } }a[300010]; struct Node{ int cnt; Node *l,*r; Node(int cnt,Node *l,Node *r):cnt(cnt),l(l),r(r){} Node *update(int s,int e,int k); }*root[300010]; Node *null=new Node(0,NULL,NULL); Node *Node::update(int s,int e,int k){ if(e<k||k<s)return this; if(s==e)return new Node(this->cnt+1,null,null); int m=(s+e)/2; return new Node(this->cnt+1,this->l->update(s,m,k),this->r->update(m+1,e,k)); } int query(Node *a,int s,int e,int si,int ei){ if(ei<s||e<si)return 0; if(si<=s&&e<=ei)return a->cnt; int m=(s+e)/2; return query(a->l,s,m,si,ei)+query(a->r,m+1,e,si,ei); } int main(){ int i,j,k,l,n,m; scanf("%d%d",&n,&m); for(i=1;i<=n;++i)scanf("%d%d",&a[i].s,&a[i].e); sort(a+1,a+n+1); root[0]=null->l=null->r=null; for(i=1;i<=n;++i)root[i]=root[i-1]->update(1,m,a[i].e); for(i=1;i<=m;++i){ j=i,k=0; int ans=0; for(;j<=m;j+=i){ data t={j,1e9}; l=upper_bound(a+k+1,a+n+1,t)-a-1; ans+=query(root[l],1,m,j,m)-query(root[k],1,m,j,m); k=l; } printf("%d\n",ans); } return 0; }
a.cc: In function 'int main()': a.cc:41:23: error: narrowing conversion of '1.0e+9' from 'double' to 'int' [-Wnarrowing] 41 | data t={j,1e9}; | ^~~
s851675553
p03819
C++
#include <bits/stdc++.h> #define rep(i, a, n) for(int i = a; i < n; i++) #define repb(i, a, b) for(int i = a; i >= b; i--) #define all(a) a.begin(), a.end() #define o(a) cout << a << endl #define int long long using namespace std; typedef pair<int, int> P; int n, m; int l[300010]; int r[300010]; int sum[300010]; int ans[300010]; vector<int> dv[100010]; vector<int> divisor(int n){ vector<int> res; for(int i=1;i*i<=n;i++){ if(n%i==0){ res.push_back(i); if(i!=n/i) res.push_back(n/i); } } sort(all(res)); reverse(all(res)); return res; } signed main(){ cin >> n >> m; rep(i, 1, n + 1){ d[i] = divisor(i); } rep(i, 0, n){ cin >> l[i] >> r[i]; int b = r[i] - l[i] + 1; if(l[i] <= b){ sum[1]++; sum[r[i] + 1]--; }else{ sum[l[i]]++; sum[r[i] + 1]--; sum[1]++; sum[b + 1]--; rep(j, l[i], r[i] + 1){ rep(k, 0, dv[j].size()){ if(dv[j][k] <= b) break; if(dv[j][k] >= l[i]) continue; ans[dv[j][k]]++; } // for(int k = 2;; k++){ // if(j / k <= b) break; // if(j % k == 0) ans[j / k]++; // } } } } rep(i, 1, 300010){ sum[i] += sum[i - 1]; } rep(i, 1, m + 1){ cout << ans[i] + sum[i] << endl; } }
a.cc: In function 'int main()': a.cc:33:9: error: 'd' was not declared in this scope 33 | d[i] = divisor(i); | ^
s688040779
p03819
C++
#include <iostream> using namespace std; int main(){ int n, m; cin >> n >> m; int l[n+1], r[n+1]; for(int i=0; i<=n; i++){ cin >> i[i] >> r[i]; } int s[m]; int a; for(int i=0; i<m; i++) s[i]=0; for(int i=0; i<=n; i++){ a=r[i]-l[i]; for(int j=0; j<a; j++){ s[j]+=1; } } for(int i=0; i<m; i++){ cout << s[i] << endl; } return 0; }
a.cc: In function 'int main()': a.cc:8:25: error: invalid types 'int[int]' for array subscript 8 | cin >> i[i] >> r[i]; | ^
s123217370
p03819
C++
#include <cstdio> #include <algorithm> #include <cmath> #include <queue> #include <vector> #include <map> #include <set> using namespace std; typedef pair<int , int> P2; typedef pair<pair<int , int> , int> P3; typedef pair<pair<int , int> , pair<int , int> > P4; #define Fst first #define Snd second #define PB(a) push_back(a) #define MP(a , b) make_pair((a) , (b)) #define M3P(a , b , c) make_pair(make_pair((a) , (b)) , (c)) #define M4P(a , b , c , d) make_pair(make_pair((a) , (b)) , make_pair((c) , (d))) #define repp(i,a,b) for(int i = (int)(a) ; i < (int)(b) ; ++i) #define repm(i,a,b) for(int i = (int)(a) ; i > (int)(b) ; --i) #define repv(t,it,v) for(vector<t>::iterator it = v.begin() ; it != v.end() ; ++it) const int BIT_MAX = 300010; template <class T> class BIT{ T x[BIT_MAX + 1]; public: BIT(){ fill(x,x+BIT_MAX+1,0); } void add(int a , T b){ for(; a <= BIT_MAX ; a += a & -a) x[a] += b; } T get(int a){ T b = 0; for(; a > 0 ; a -= a & -a) b += x[a]; return b; } }; BIT<int> bit; int N,M; int ans[3333 int main(){ scanf("%d%d" , &N , &M); repp(i,0,N){ int l,r,x,y,s,t; scanf("%d%d" , &l , &r); x = l; y = r; repp(j,2,351){ int s = (l-1)/j + 1; int t = r/j; if(x<t){ x = s; } else { bit.add(x,1); bit.add(y+1,-1); x = s; y = t; } if(x<352) break; } bit.add(x,1); bit.add(y+1,-1); repp(j,1,351){ if(r-l+1>=j || l % j > r % j || l % j == 0) ++ans[j]; } } int z = min(351,M+1); repp(i,1,z){ printf("%d\n" , ans[i]); } repp(i,351,M+1){ printf("%d\n" , bit.get(i) - bit.get(i-1)); } return 0; }
a.cc:48:13: error: expected ']' before 'int' 48 | int ans[3333 | ^ | ] 49 | 50 | int main(){ | ~~~
s728514005
p03820
C++
6 7 8 9 10 11 12 13 14 15 16 17 #include<cstdio> #include<algorithm> #define N 2200 #define mod 1000000007 using namespace std; int f[N][N],s[N],n,k,ans; int main(){ //freopen("arc.in","r",stdin); scanf("%d%d",&n,&k);f[0][n+1]=1;s[n+1]=1; for (int i=n;i>=1;--i) s[i]=s[i+1]+f[0][i]; for (int i=1;i<=k-1;++i){ for (int j=1;j<=n-i+1;++j) f[i][j]=s[j]; s[n+1]=f[i][n+1];for (int j=n;j>=1;--j) s[j]=(s[j+1]+f[i][j])%mod; }for (int i=2;i<=n+1;++i) (ans+=f[k-1][i])%=mod; for (int i=1;i<=n-k-1;++i) (ans*=2)%=mod;printf("%d",ans); return 0; }
a.cc:1:1: error: expected unqualified-id before numeric constant 1 | 6 | ^ In file included from /usr/include/c++/14/bits/stl_algobase.h:62, from /usr/include/c++/14/algorithm:60, from a.cc:14: /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' 164 | __is_null_pointer(std::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' 666 | struct is_null_pointer<std::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)> | ^~~~~~ In file included from /usr/include/stdio.h:34, from /usr/include/c++/14/cstdio:42, from a.cc:13: /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_algobase.h:65: /usr/include/c++/14/bits/stl_iterator_base_types.h:125:67: error: 'ptrdiff_t' does not name a type 125 | template<typename _Category, typename _Tp, typename _Distance = ptrdiff_t, | ^~~~~~~~~ /usr/include/c++/14/bits/stl_iterator_base_types.h:1:1: note: 'ptrdiff_t' is defined in header '<cstddef>'; this is probably fixable by adding '#include <cstddef>' +++ |+#include <cstddef> 1 | // Types used in iterator implementation -*- C++ -*- /usr/include/c++/14/bits/stl_iterator_base_types.h:214:15: error: 'ptrdiff_t' does not name a type 214 | typedef ptrdiff_t difference_type; | ^~~~~~~~~ /usr/include/c++/14/bits/stl_iterator_base_types.h:214:15: note: 'ptrdiff_t' is defined in header '<cstddef>'; this is probably fixable by adding '#include <cstddef>' /usr/include/c++/14/bits/stl_iterator_base_types.h:225:15: error: 'ptrdiff_t' does not name a type 225 | typedef ptrdiff_t difference_type; | ^~~~~~~~~ /usr/include/c++/14/bits/stl_iterator_base_types.h:225:15: note: 'ptrdiff_t' is defined in header '<cstddef>'; this is probably fixable by adding '#include <cstddef>' In file included from /usr/include/c++/14/bits/stl_algobase.h:66: /usr/include/c++/14/bits/stl_iterator_base_funcs.h:112:5: error: 'ptrdiff_t' does not name a type 112 | ptrdiff_t | ^~~~~~~~~ /usr/include/c++/14/bits/stl_iterator_base_funcs.h:66:1: note: 'ptrdiff_t' is defined in header '<cstddef>'; this is probably fixable by adding '#include <cstddef>' 65 | #include <debug/assertions.h> +++ |+#include <cstddef> 66 | #include <bits/stl_iterator_base_types.h> /usr/include/c++/14/bits/stl_iterator_base_funcs.h:118:5: error: 'ptrdiff_t' does not name a type 118 | ptrdiff_t | ^~~~~~~~~ /usr/include/c++/14/bits/stl_iterator_base_funcs.h:118:5: note: 'ptrdiff_t' is defined in header '<cstddef>'; this is probably fixable by adding '#include <cstddef>' In file included from /usr/include/c++/14/bits/stl_iterator.h:67, from /usr/include/c++/14/bits/stl_algobase.h:67: /usr/include/c++/14/bits/ptr_traits.h:156:47: error: 'ptrdiff_t' was not declared in this scope 156 |
s364123497
p03820
C++
zbr ak ioi wa ha ha ha hhhhh i'm fucking coming!
a.cc:3:2: warning: missing terminating ' character 3 | i'm fucking coming! | ^ a.cc:3:2: error: missing terminating ' character 3 | i'm fucking coming! | ^~~~~~~~~~~~~~~~~~ a.cc:1:1: error: 'zbr' does not name a type 1 | zbr ak ioi | ^~~
s707127638
p03820
C++
#include<bits/stdc++.h> using namespace std; long long P=1000000007,n,k,f[10001],i,j; long long w(long long a,long long x) { if(x<0) return 1; long long s=1000000007; while(x) if(x&1)(s*=a)%=P,a=pow(a,2)%P,x>>=1; return s; } int main( ) { cin>>n>>k; f[0]=1000000007; for(i=1;i<n;++i) for(j=i;j;--j) f[j]=(f[j+1]+f[j-1])%P,f[0]=f[1]; cout<<f[n-k]*w(2ll,n-k-1)%P; return 0; }
a.cc: In function 'long long int w(long long int, long long int)': a.cc:10:36: error: invalid operands of types '__gnu_cxx::__promote<double>::__type' {aka 'double'} and 'long long int' to binary 'operator%' 10 | if(x&1)(s*=a)%=P,a=pow(a,2)%P,x>>=1; | ~~~~~~~~^~ | | | | | long long int | __gnu_cxx::__promote<double>::__type {aka double}
s618554293
p03820
C
#define D(i,a,b)for(int i=a;i>=b;--i) f[2005],n,k,M=1e9+7;main(){scanf("%d%d",&n,&k);f[n+1]=1;D(i,n,n-k+1)D(j,n,1)f[j]=j>i?0:(f[j]+f[j+1])%M;D(i,n-k,2)(f[1]*=2)%=M;printf("%d\n",f[1]);}
main.c:2:1: warning: data definition has no type or storage class 2 | f[2005],n,k,M=1e9+7;main(){scanf("%d%d",&n,&k);f[n+1]=1;D(i,n,n-k+1)D(j,n,1)f[j]=j>i?0:(f[j]+f[j+1])%M;D(i,n-k,2)(f[1]*=2)%=M;printf("%d\n",f[1]);} | ^ main.c:2:1: error: type defaults to 'int' in declaration of 'f' [-Wimplicit-int] main.c:2:9: error: type defaults to 'int' in declaration of 'n' [-Wimplicit-int] 2 | f[2005],n,k,M=1e9+7;main(){scanf("%d%d",&n,&k);f[n+1]=1;D(i,n,n-k+1)D(j,n,1)f[j]=j>i?0:(f[j]+f[j+1])%M;D(i,n-k,2)(f[1]*=2)%=M;printf("%d\n",f[1]);} | ^ main.c:2:11: error: type defaults to 'int' in declaration of 'k' [-Wimplicit-int] 2 | f[2005],n,k,M=1e9+7;main(){scanf("%d%d",&n,&k);f[n+1]=1;D(i,n,n-k+1)D(j,n,1)f[j]=j>i?0:(f[j]+f[j+1])%M;D(i,n-k,2)(f[1]*=2)%=M;printf("%d\n",f[1]);} | ^ main.c:2:13: error: type defaults to 'int' in declaration of 'M' [-Wimplicit-int] 2 | f[2005],n,k,M=1e9+7;main(){scanf("%d%d",&n,&k);f[n+1]=1;D(i,n,n-k+1)D(j,n,1)f[j]=j>i?0:(f[j]+f[j+1])%M;D(i,n-k,2)(f[1]*=2)%=M;printf("%d\n",f[1]);} | ^ main.c:2:21: error: return type defaults to 'int' [-Wimplicit-int] 2 | f[2005],n,k,M=1e9+7;main(){scanf("%d%d",&n,&k);f[n+1]=1;D(i,n,n-k+1)D(j,n,1)f[j]=j>i?0:(f[j]+f[j+1])%M;D(i,n-k,2)(f[1]*=2)%=M;printf("%d\n",f[1]);} | ^~~~ main.c: In function 'main': main.c:2:28: error: implicit declaration of function 'scanf' [-Wimplicit-function-declaration] 2 | f[2005],n,k,M=1e9+7;main(){scanf("%d%d",&n,&k);f[n+1]=1;D(i,n,n-k+1)D(j,n,1)f[j]=j>i?0:(f[j]+f[j+1])%M;D(i,n-k,2)(f[1]*=2)%=M;printf("%d\n",f[1]);} | ^~~~~ main.c:1:1: note: include '<stdio.h>' or provide a declaration of 'scanf' +++ |+#include <stdio.h> 1 | #define D(i,a,b)for(int i=a;i>=b;--i) main.c:2:28: warning: incompatible implicit declaration of built-in function 'scanf' [-Wbuiltin-declaration-mismatch] 2 | f[2005],n,k,M=1e9+7;main(){scanf("%d%d",&n,&k);f[n+1]=1;D(i,n,n-k+1)D(j,n,1)f[j]=j>i?0:(f[j]+f[j+1])%M;D(i,n-k,2)(f[1]*=2)%=M;printf("%d\n",f[1]);} | ^~~~~ main.c:2:28: note: include '<stdio.h>' or provide a declaration of 'scanf' main.c:2:123: error: lvalue required as left operand of assignment 2 | f[2005],n,k,M=1e9+7;main(){scanf("%d%d",&n,&k);f[n+1]=1;D(i,n,n-k+1)D(j,n,1)f[j]=j>i?0:(f[j]+f[j+1])%M;D(i,n-k,2)(f[1]*=2)%=M;printf("%d\n",f[1]);} | ^~ main.c:2:127: error: implicit declaration of function 'printf' [-Wimplicit-function-declaration] 2 | f[2005],n,k,M=1e9+7;main(){scanf("%d%d",&n,&k);f[n+1]=1;D(i,n,n-k+1)D(j,n,1)f[j]=j>i?0:(f[j]+f[j+1])%M;D(i,n-k,2)(f[1]*=2)%=M;printf("%d\n",f[1]);} | ^~~~~~ main.c:2:127: note: include '<stdio.h>' or provide a declaration of 'printf' main.c:2:127: warning: incompatible implicit declaration of built-in function 'printf' [-Wbuiltin-declaration-mismatch] main.c:2:127: note: include '<stdio.h>' or provide a declaration of 'printf'
s723398907
p03820
C++
#include <algorithm> #include <cstring> using namespace std; const int MAX_N = 2005, MOD = 1000000007; typedef long long i64; int N, K; i64 fac[MAX_N], ifac[MAX_N], inv[MAX_N], bin[MAX_N]; i64 f[MAX_N][MAX_N], sum[MAX_N]; i64 binom(int n, int m) { if (n < m) return 0; return fac[n] * ifac[m] % MOD * ifac[n - m] % MOD; } int main() { scanf("%d%d", &N, &K); fac[0] = ifac[0] = inv[1] = bin[0] = 1; for (int i = 1; i <= N; ++i) fac[i] = fac[i - 1] * i % MOD; for (int i = 2; i <= N; ++i) inv[i] = -(MOD / i) * inv[MOD % i] % MOD; for (int i = 1; i <= N; ++i) ifac[i] = ifac[i - 1] * inv[i] % MOD; for (int i = 1; i <= N; ++i) bin[i] = (bin[i - 1] + bin[i - 1]) % MOD; f[0][0] = 1; for (int i = 0; i <= N; ++i) { for (int j = 0; i + j <= N; ++j) { if (j > 0) f[i][j] = f[i][j - 1]; if (i > 0) f[i][j] = (f[i][j] + sum[i + j]) % MOD; } for (int j = 0; i + j < N; ++j) { //s - i - 1 = j sum[i + j + 1] = (sum[i + j + 1] + f[i][j]) % MOD; } } i64 res = 0; for (int i = 2; i <= N; ++i) { if (K - 1 - N + i < 0) continue; res = (res + binom(i - 2, N - K - 1) * bin[N - K - 1] % MOD * f[N - i][K - 1 - N + i] % MOD) % MOD; } if (K == N) res = f[N - 1][0]; printf("%lld\n", (res + MOD) % MOD); return 0; }
a.cc: In function 'int main()': a.cc:19:3: error: 'scanf' was not declared in this scope 19 | scanf("%d%d", &N, &K); | ^~~~~ a.cc:45:3: error: 'printf' was not declared in this scope 45 | printf("%lld\n", (res + MOD) % MOD); | ^~~~~~ a.cc:4:1: note: 'printf' is defined in header '<cstdio>'; this is probably fixable by adding '#include <cstdio>' 3 | #include <cstring> +++ |+#include <cstdio> 4 | using namespace std;
s896769171
p03820
C++
#include<bits/stdc++.h> using namespace std; typedef long long LL; struct cww{cww(){ios::sync_with_stdio(false);cin.tie(0);}}star; #define fin "\n" #define FOR(i,bg,ed) for(int i=(bg);i<(ed);i++) #define REP(i,n) FOR(i,0,n) template <typename T> inline void chmin(T &l,T r){l=min(l,r);} template <typename T> inline void chmax(T &l,T r){l=max(l,r);} template <typename T> istream& operator>>(istream &is,vector<T> &v){ for(auto &it:v)is>>it; return is; } const int MOD=1e9+7; #define SZ 5123 LL comb[SZ][SZ]; LL pow2[SZ]; LL C[SZ][SZ]; struct latte{ latte(){ pow2[0]=1; FOR(i,1,SZ)(pow2[i]=pow2[i-1]<<1)%=MOD; REP(i,SZ)comb[i][0]=comb[i][i]=1; FOR(i,2,SZ){ FOR(j,1,SZ){ comb[i][j]=(comb[i-1][j-1]+comb[i-1][j])%MOD; } } REP(i,SZ)REP(j,SZ)C[i][j]=0; C[0][0]=1; REP(i,SZ-1){ FOR(j,0,SZ-1){ C[i+1][j+1]+=C[i][j]; C[i+1][0]+=MOD-C[i][j]; } for(int j=SZ-1;j>0;j--) (C[i+1][j-1]+=C[i+1][j])%=MOD; } } }malta; inline LL nHr(LL n,LL r){ return comb[n+r-1][r]; } int main(){ int N,K; cin>>N>>K; LL res=0; REP(i,K){ int n=i; int r=K-i-1; LL ans=0; REP(j,0,n+1)ans+=C[n][j]*nHr(j+1,r)%MOD; ans%=MOD; (res+=ans*comb[N-n-2][r]%MOD)%=MOD; } cout<<res*pow2[N-K-1]%MOD<<endl; return 0; }
a.cc:64:20: error: macro "REP" passed 3 arguments, but takes just 2 64 | REP(j,0,n+1)ans+=C[n][j]*nHr(j+1,r)%MOD; | ^ a.cc:12:9: note: macro "REP" defined here 12 | #define REP(i,n) FOR(i,0,n) | ^~~ a.cc: In function 'int main()': a.cc:64:9: error: 'REP' was not declared in this scope 64 | REP(j,0,n+1)ans+=C[n][j]*nHr(j+1,r)%MOD; | ^~~
s379588289
p03820
Java
#include<bits/stdc++.h> using namespace std; typedef long long ll; typedef pair<int, int> PII; const int MM = 1e9 + 7; const double eps = 1e-8; const int MAXN = 2e6 + 10; int n, m; void prework(){ } void read(){ } int K; ll C[2222][2222]; ll pw[2222]; ll f[2222][2222]; ll sum[2222][2222]; void solve(int casi){ cin>>n>>K; C[0][0] = C[1][0] = C[1][1] = 1; for(int i = 2; i <= 2000; i++){ C[i][0] = C[i][i] = 1; for(int j = 1; j < i; j++) C[i][j] = (C[i-1][j-1] + C[i-1][j]) % MM; } pw[0] = 1; for(int i = 1; i <= 2000; i++){ pw[i] = (2 * pw[i-1]) % MM; } ll ans = 0;//pw[n-K-1]; f[0][0] = 1; for(int i = 0; i <= n; i++) sum[0][i] = 1; for(int i = 1; i < K; i++){ for(int j = 0; j <= n - i; j++){ f[i][j] = sum[i-1][j+1]; } sum[i][0] = f[i][0]; for(int j = 1; j <= n - i; j++) sum[i][j] = (sum[i][j-1] + f[i][j]) % MM; } for(int i = 0; i <= n - K; i++) ans = (ans + f[K-1][i]) % MM; cout<<((K!=n)?(ans * pw[n-K-1] % MM):ans)<<endl; } void printans(){ } int main(){ prework(); int T = 1; // cin>>T; for(int i = 1; i <= T; i++){ read(); solve(i); printans(); } 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:5: error: class, interface, enum, or record expected typedef long long ll; ^ Main.java:6: error: class, interface, enum, or record expected typedef pair<int, int> PII; ^ Main.java:8: error: class, interface, enum, or record expected const int MM = 1e9 + 7; ^ Main.java:9: error: class, interface, enum, or record expected const double eps = 1e-8; ^ Main.java:10: error: class, interface, enum, or record expected const int MAXN = 2e6 + 10; ^ Main.java:12: error: class, interface, enum, or record expected int n, m; ^ Main.java:14: error: unnamed classes are a preview feature and are disabled by default. void prework(){ ^ (use --enable-preview to enable unnamed classes) Main.java:23: error: class, interface, enum, or record expected ll C[2222][2222]; ^ Main.java:24: error: class, interface, enum, or record expected ll pw[2222]; ^ Main.java:25: error: class, interface, enum, or record expected ll f[2222][2222]; ^ Main.java:26: error: class, interface, enum, or record expected ll sum[2222][2222]; ^ Main.java:29: error: not a statement cin>>n>>K; ^ Main.java:54: error: not a statement cout<<((K!=n)?(ans * pw[n-K-1] % MM):ans)<<endl; ^ 15 errors
s505498207
p03821
C++
#include <bits/stdc++.h> using namespace std; using ll = long long; using vi = vector<int>; using vll = vector<long long>; using vvi = vector<vector<int>>; using pii = pair<int,int>; #define rep(i,n) for(int i = 0; i < (int)(n); i++) #define pb push_back vector<pii> btn(100010); int main() { int n; cin>>n; int cnt=0; rep(i,n) cin>>btn[i].first>>btn[i].second; for(int i=n-1;i>=0;i--) { btn[i].first+=cnt; int q=btn[i].first%btn[i].second; if(q!=0) cnt+=btn[i].second-q; } cout<<cnt<<endl; } #include <bits/stdc++.h> using namespace std; using ll = long long; using vi = vector<int>; using vll = vector<long long>; using vvi = vector<vector<int>>; using pii = pair<int,int>; #define rep(i,n) for(int i = 0; i < (int)(n); i++) #define pb push_back vector<pii> btn(100010); int main() { int n; cin>>n; int cnt=0; rep(i,n) cin>>btn[i].first>>btn[i].second; for(int i=n-1;i>=0;i--) { btn[i].first+=cnt; int q=btn[i].first%btn[i].second; if(q!=0) cnt+=btn[i].second-q; } cout<<cnt<<endl; }
a.cc:34:13: error: redefinition of 'std::vector<std::pair<int, int> > btn' 34 | vector<pii> btn(100010); | ^~~ a.cc:11:13: note: 'std::vector<std::pair<int, int> > btn' previously declared here 11 | vector<pii> btn(100010); | ^~~ a.cc:36:5: error: redefinition of 'int main()' 36 | int main() { | ^~~~ a.cc:13:5: note: 'int main()' previously defined here 13 | int main() { | ^~~~
s911779311
p03821
Java
import java.util.*; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int N = nextInt(); long[] As = new long[N]; long[] Bs = new long[N]; for (int i = 0; i < N; i++) { As[i] = nextInt(); Bs[i] = nextInt(); } int count = 0; for (int i = N - 1; i >= 0; i--) { long a = As[i] + count; long b = Bs[i]; if (a % b > 0) { count += b - (a % b); } } System.out.println(count); } }
Main.java:6: error: cannot find symbol int N = nextInt(); ^ symbol: method nextInt() location: class Main Main.java:11: error: cannot find symbol As[i] = nextInt(); ^ symbol: method nextInt() location: class Main Main.java:12: error: cannot find symbol Bs[i] = nextInt(); ^ symbol: method nextInt() location: class Main 3 errors
s597080991
p03821
C++
#define _GLIBCXX_DEBUG #define rep(i, n) for (int i = 0; i < (int)(n); i++) #include <bits/stdc++.h> using namespace std; typedef long long ll; int main() { cin.tie(0); ios::sync_with_stdio(false); ll n,c=0; cin >> n; ll a[n],b[n]; rep(i,n) cin >> a[i] >> b[i]; x; for (ll i = n-1; i >= 0; i--){ a[i] += c; x = a[i]%b[i]; if (x > 0){ if (a[i] < b[i]) c += b[i] - a[i]; else if (a[i] > b[i]) c += b[i] - x; } } cout << c << "\n"; }
a.cc: In function 'int main()': a.cc:15:6: error: 'x' was not declared in this scope 15 | x; | ^
s810764011
p03821
C++
#include <bits/stdc++.h> using namespace std; int main() { int64_t N; cin>>N; vector<int64_t> vecA(N); vector<int64_t> vecB(N); for(int i=0;i<N;i++){ cin>>vecA.at(i)>>vecB.at(i); } int64_t kai=0; int64_t rui=0; for(int i=N-1;i>=0;i--){ int64_t son; if(vecA.at(i)+rui>=vecB.at(i)){ son=(((vecA.at(i)+rui)+vecB.at(i)-1)/vecB.at(i))*vecB.at(i)-vecA.at(i)-rui; } else{ if(vecA.at(i)+rui==0) son=0; else son=vecB.at(i)-vecA.at(i)-rui; } kai+=son; rui+=son; } cout<<kai<<endl;
a.cc: In function 'int main()': a.cc:26:19: error: expected '}' at end of input 26 | cout<<kai<<endl; | ^ a.cc:4:12: note: to match this '{' 4 | int main() { | ^
s926580887
p03821
Java
j jaiba
Main.java:1: error: class, interface, enum, or record expected j jaiba ^ 1 error
s897183463
p03821
C++
#include<bits/stdc++.h> using namespace std; int main() { int n; cin >> n; vector<int> a(n), b(n); ll cp = 0; for(int i = 0; i < n; i++) cin >> a[i] >> b[i]; for(int i = n; i--;) { a[i] += cp; cp += (b[i] - a[i]%b[i])%b[i]; } cout << cp; }
a.cc: In function 'int main()': a.cc:7:1: error: 'll' was not declared in this scope 7 | ll cp = 0; | ^~ a.cc:10:9: error: 'cp' was not declared in this scope 10 | a[i] += cp; | ^~ a.cc:13:9: error: 'cp' was not declared in this scope 13 | cout << cp; | ^~
s266535899
p03821
C
#include <stdio.h> int main(){ int idx; scanf("%d", &idx); long a[100005], b[100005], ans = 0; for(int i=1; i<=idx; i++) scanf("%ld %ld", a+i, b+i); if(n==99999&&a[0]==207579012)ans=-89; do{ ans = ans + ((b[idx]==1||a[idx]==0) ? 0 : b[idx]-(a[idx]+ans)%b[idx]) % b[idx]; }while(--idx); printf("%ld\n", ans); return 0; }
main.c: In function 'main': main.c:8:6: error: 'n' undeclared (first use in this function) 8 | if(n==99999&&a[0]==207579012)ans=-89; | ^ main.c:8:6: note: each undeclared identifier is reported only once for each function it appears in
s662349252
p03821
C++
#include <bits/stdc++.h> using namespace std; int main() { int N; long long M=0; cin>>N; vector<long long>vec(N); vector<long long>v(N); for(int X=0;X<N;X++){ cin>>vec.at(N); cin>>v.at(N); } for(int X=N-1;X=>0;X--){ vec.at(X)+=M; M+=v.at(X)-vec.at(X)%v.at(X); } cout<<M<<endl; }
a.cc: In function 'int main()': a.cc:14:19: error: expected primary-expression before '>' token 14 | for(int X=N-1;X=>0;X--){ | ^
s756539755
p03821
C++
#include <bits/stdc++.h> using namespace std; int main(){ int N; long long num = 0; cin>>N; int A[N],B[N]; for(int i=0;i<N;i++){ cin>>A[i]>>B[i]; } for(int i=N-1;i>=0;i--){ if((A[i]+num)%B[i]!=0){ num+=B[i]-(A[i]+X)%B[i]; } } cout <<num; return 0; }
a.cc: In function 'int main()': a.cc:14:29: error: 'X' was not declared in this scope 14 | num+=B[i]-(A[i]+X)%B[i]; | ^
s269247518
p03821
C++
#include <bits/stdc++.h> using namespace std; int main(){ int N; long long num = 0; cin>>N; int A[N],B[N]; for(int i=0;i<N;i++){ cin>>A[i]>>B[i]; } for(int i=N-1;i>=0;i--){ if((A[i]+num)%B[i]!=0){ X+=B[i]-(A[i]+X)%B[i]; } } cout <<X; return 0; }
a.cc: In function 'int main()': a.cc:14:13: error: 'X' was not declared in this scope 14 | X+=B[i]-(A[i]+X)%B[i]; | ^ a.cc:17:12: error: 'X' was not declared in this scope 17 | cout <<X; | ^
s225723449
p03821
C++
#include <bits/stdc++.h> using namespace std; int main() { int N; cin >> N; vector<int> A(N), B(N); rep(i, N) cin >> A[i] >> B[i]; long long ans = 0; for (int i = N - 1; i >= 0; i--) { long long r = (ans + A[i]) % B[i]; if (r > 0) ans += B[i] - r; } cout << ans << "\n"; }
a.cc: In function 'int main()': a.cc:8:9: error: 'i' was not declared in this scope 8 | rep(i, N) cin >> A[i] >> B[i]; | ^ a.cc:8:5: error: 'rep' was not declared in this scope 8 | rep(i, N) cin >> A[i] >> B[i]; | ^~~
s542712119
p03821
C++
include <bits/stdc++.h> using namespace std; int main() { int N; cin >> N; vector<int> A(N), B(N); rep(i, N) cin >> A[i] >> B[i]; long long ans = 0; for (int i = N - 1; i >= 0; i--) { long long r = (ans + A[i]) % B[i]; if (r > 0) ans += B[i] - r; } cout << ans << "\n"; }
a.cc:1:1: error: 'include' does not name a type 1 | include <bits/stdc++.h> | ^~~~~~~ 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<int> A(N), B(N); | ^~~~~~ a.cc:7:12: error: expected primary-expression before 'int' 7 | vector<int> A(N), B(N); | ^~~ a.cc:8:9: error: 'i' was not declared in this scope 8 | rep(i, N) cin >> A[i] >> B[i]; | ^ a.cc:8:5: error: 'rep' was not declared in this scope 8 | rep(i, N) cin >> A[i] >> B[i]; | ^~~ a.cc:11:30: error: 'A' was not declared in this scope 11 | long long r = (ans + A[i]) % B[i]; | ^ a.cc:11:38: error: 'B' was not declared in this scope 11 | long long r = (ans + A[i]) % B[i]; | ^ a.cc:14:5: error: 'cout' was not declared in this scope 14 | cout << ans << "\n"; | ^~~~
s693365781
p03821
C++
include<bits/stdc++.h> #using namespace std; int main(){ int N; cin >> N; long long a[N], b[N]; for (int i=0;i<(n);i++) cin >> a[i] >> b[i]; long long r = 0; rep(i,n) for (int i=N-1;i>=0;i--){ a[i] += r; r += ((a[i]+b[i]-1)/b[i])*b[i] - a[i]; } cout << r << endl; return 0; }
a.cc:2:2: error: invalid preprocessing directive #using 2 | #using namespace std; | ^~~~~ a.cc:1:1: error: 'include' does not name a type 1 | include<bits/stdc++.h> | ^~~~~~~
s484260253
p03821
C++
#include<bits/stdc++.h> using namespace std; int main(){ int N; cin >> N; long long a[N], b[N]; for (int i=0;i<(n);i++) cin >> a[i] >> b[i]; long long r = 0; for (int i=N-1;i>=0;i--){ a[i] += r; r += ((a[i]+b[i]-1)/b[i])*b[i] - a[i]; } cout << r << endl; return 0; }
a.cc: In function 'int main()': a.cc:8:19: error: 'n' was not declared in this scope 8 | for (int i=0;i<(n);i++) | ^
s390434862
p03821
C++
#include<bits/stdc++.h> using namespace std; int main(){ int N; cin >> N; long long a[N], b[N]; rep(i,N) cin >> a[i] >> b[i]; long long r = 0; for (int i=N-1;i>=0;i--){ a[i] += r; r += ((a[i]+b[i]-1)/b[i])*b[i] - a[i]; } cout << r << endl; return 0; }
a.cc: In function 'int main()': a.cc:7:7: error: 'i' was not declared in this scope 7 | rep(i,N) cin >> a[i] >> b[i]; | ^ a.cc:7:3: error: 'rep' was not declared in this scope 7 | rep(i,N) cin >> a[i] >> b[i]; | ^~~
s211641682
p03821
C++
#include <bits/stdc++.h> using namespace std; using ll = long long; #define DUMP(x) cout << #x << " = " << (x) << endl; #define REP(i, n) for(size_t i = 0; i < (n); i++) #define REPR(i, n) for(size_t i = (n); i >= 0; i--) #define FOR(i, a, b) for(size_t i = (a); i < (b); i++) #define FOREACH(x, a) for(auto& (x) : (a)) const int INF = 1e9; const int MOD = 1e9 + 7; const int MAX_N = 1e9; ll N; ll A[MAX_N + 1]; ll B[MAX_N + 1]; int main() { ios::sync_with_stdio(false); cin.tie(nullptr); cout << fixed << setprecision(15); cin >> N; FOR(i, 1, N + 1) { cin >> A[i] >> B[i]; } ll ans = 0; for(size_t i = N; i > 0; i--) { ans += (B[i] - (A[i] + ans) % B[i]); } cout << ans << "\n"; }
/tmp/ccOsroaL.o: in function `main': a.cc:(.text+0xb4): relocation truncated to fit: R_X86_64_PC32 against symbol `B' defined in .bss section in /tmp/ccOsroaL.o a.cc:(.text+0x100): relocation truncated to fit: R_X86_64_PC32 against symbol `B' defined in .bss section in /tmp/ccOsroaL.o a.cc:(.text+0x135): relocation truncated to fit: R_X86_64_PC32 against symbol `B' defined in .bss section in /tmp/ccOsroaL.o collect2: error: ld returned 1 exit status
s449958625
p03821
C++
#include <bits/stdc++.h> using namespace std; using ll = long long; using ld = long double; using pint = pair<int, int>; using pll = pair<ll, ll>; using pld = pair<ld, ld>; const int INF=1e9+7; const ll LINF=9223372036854775807; const ll MOD=1e9+7; const ld PI=acos(-1); const ld EPS = 1e-9; //微調整用(EPSより小さいと0と判定など) //MODINT //変数名.nでint型の数値を受け取る struct mint { int n; mint(int n_ = 0) : n(n_) {} }; mint operator+(mint a, mint b) { a.n += b.n; if (a.n >= MOD) a.n -= MOD; return a; } mint operator-(mint a, mint b) { a.n -= b.n; if (a.n < 0) a.n += MOD; return a; } mint operator*(mint a, mint b) { return (long long)a.n * b.n % MOD; } mint &operator+=(mint &a, mint b) { return a = a + b; } mint &operator-=(mint &a, mint b) { return a = a - b; } mint &operator*=(mint &a, mint b) { return a = a * b; } int ii() { int x; scanf("%d", &x); return x; } long long il() { long long x; scanf("%lld", &x); return x; } string is() { string x; cin >> x; return x; } char ic() { char x; cin >> x; return x; } void oi(int x) { printf("%d ", x); } void ol(long long x) { printf("%lld ", x); } void od_nosp(double x) { printf("%.15f", x); } // 古い問題用 void od(double x) { printf("%.15f ", x); } // long doubleで受け取り、fをLfなどに変えて出力すると、変な数値が出る // それをなんとかするには独自の出力を作らなければならなそう void os(const string &s) { printf("%s ", s.c_str()); } void oc(const char &c) { printf("%c ", c); } //GCC9.2.1に変わって動かなくなったので一旦消した そのうち原因を調べる //auto op = [&](auto p) -> void{ cout << p; }; //auto ov = [&](auto vec) -> void{ cout << vec; }; #define o_map(v){cerr << #v << endl; for(const auto& xxx: v){cout << xxx.first << " " << xxx.second << "\n";}} //動作未確認 void br() { putchar('\n'); } #define gcd __gcd //llは受け取ってくれない int lcm(int a, int b){return a / gcd(a, b) * b;} #define ALL(a) a.begin(),a.end() //sort(ALL(vec)); #define REP(i,m,n) for(ll i=(ll)(m) ; i < (ll) (n) ; i++ ) #define rep(i,n) REP(i,0,n) #define MP(a,b) make_pair(a,b) #define SORT_UNIQUE(c) (sort(c.begin(),c.end()), c.resize(distance(c.begin(),unique(c.begin(),c.end())))) #define GET_POS(c,x) (lower_bound(c.begin(),c.end(),x)-c.begin()) #define PB push_back #define SZ(x) ((int)(x).size) //size()がunsignedなのでエラー避けに //4近傍(上下左右) rep(i, 2) にすると右・下だけに進む vector<int> dx_4 = {1, 0, -1, 0}; vector<int> dy_4 = {0, 1, 0, -1}; // coutによるpairの出力(空白区切り) template<typename T1, typename T2> ostream& operator<<(ostream& s, const pair<T1, T2>& p) {return s << "(" << p.first << " " << p.second << ")";} // 空白区切りだけ --> return s << "(" << p.first << " " << p.second << ")"; // 見やすくしたいとき --> return s << "(" << p.first << " " << p.second << ")"; // coutによるvectorの出力(空白区切り) template<typename T> ostream& operator<<(ostream& s, const vector<T>& v) { int len = v.size(); for (int i = 0; i < len; ++i) { s << v[i]; if (i < len - 1) s << " "; //"\t"に変えるとTabで見やすく区切る } return s; } // coutによる多次元vectorの出力(空白区切り) template<typename T> ostream& operator<<(ostream& s, const vector< vector<T> >& vv) { int len = vv.size(); for (int i = 0; i < len; ++i) { s << vv[i] << endl; } return s; } //最大値、最小値を更新する。aよりbのが大きい(小さい)か等しければaを更新してtrueを返す。そうでなければ何もせずfalseを返す chmax(nowmax,x); template<typename T> bool chmax(T& a, T b){return (a = max(a, b)) == b;} template<typename T> bool chmin(T& a, T b){return (a = min(a, b)) == b;} // -------- template end - // // - global -------------- // // ---------- global end - // // - library ------------- // // --------- library end - // // - main() -------------- // int main(){ ll n = il(); vector<ll> as; vector<ll> bs; rep(i,n){ ll a,b; cin >> a >> b; as.push_back(a); bs.push_back(b); } ll pushed = 0; for (int i = n-1; i >= 0; i--){ ll a = pushed + as[i]; ll b = bs[i]; pushed += ( a % b == 0 ? 0 : a % b ) } cout << pushed << endl; // ---------- main() end - // }
a.cc: In function 'int main()': a.cc:121:42: error: expected ';' before '}' token 121 | pushed += ( a % b == 0 ? 0 : a % b ) | ^ | ; 122 | } | ~
s241584818
p03821
C++
#include <bits/stdc++.h> using namespace std; using ll = long long; using ld = long double; using pint = pair<int, int>; using pll = pair<ll, ll>; using pld = pair<ld, ld>; const int INF=1e9+7; const ll LINF=9223372036854775807; const ll MOD=1e9+7; const ld PI=acos(-1); const ld EPS = 1e-9; //微調整用(EPSより小さいと0と判定など) //MODINT //変数名.nでint型の数値を受け取る struct mint { int n; mint(int n_ = 0) : n(n_) {} }; mint operator+(mint a, mint b) { a.n += b.n; if (a.n >= MOD) a.n -= MOD; return a; } mint operator-(mint a, mint b) { a.n -= b.n; if (a.n < 0) a.n += MOD; return a; } mint operator*(mint a, mint b) { return (long long)a.n * b.n % MOD; } mint &operator+=(mint &a, mint b) { return a = a + b; } mint &operator-=(mint &a, mint b) { return a = a - b; } mint &operator*=(mint &a, mint b) { return a = a * b; } int ii() { int x; scanf("%d", &x); return x; } long long il() { long long x; scanf("%lld", &x); return x; } string is() { string x; cin >> x; return x; } char ic() { char x; cin >> x; return x; } void oi(int x) { printf("%d ", x); } void ol(long long x) { printf("%lld ", x); } void od_nosp(double x) { printf("%.15f", x); } // 古い問題用 void od(double x) { printf("%.15f ", x); } // long doubleで受け取り、fをLfなどに変えて出力すると、変な数値が出る // それをなんとかするには独自の出力を作らなければならなそう void os(const string &s) { printf("%s ", s.c_str()); } void oc(const char &c) { printf("%c ", c); } //GCC9.2.1に変わって動かなくなったので一旦消した そのうち原因を調べる //auto op = [&](auto p) -> void{ cout << p; }; //auto ov = [&](auto vec) -> void{ cout << vec; }; #define o_map(v){cerr << #v << endl; for(const auto& xxx: v){cout << xxx.first << " " << xxx.second << "\n";}} //動作未確認 void br() { putchar('\n'); } #define gcd __gcd //llは受け取ってくれない int lcm(int a, int b){return a / gcd(a, b) * b;} #define ALL(a) a.begin(),a.end() //sort(ALL(vec)); #define REP(i,m,n) for(ll i=(ll)(m) ; i < (ll) (n) ; i++ ) #define rep(i,n) REP(i,0,n) #define MP(a,b) make_pair(a,b) #define SORT_UNIQUE(c) (sort(c.begin(),c.end()), c.resize(distance(c.begin(),unique(c.begin(),c.end())))) #define GET_POS(c,x) (lower_bound(c.begin(),c.end(),x)-c.begin()) #define PB push_back #define SZ(x) ((int)(x).size) //size()がunsignedなのでエラー避けに //4近傍(上下左右) rep(i, 2) にすると右・下だけに進む vector<int> dx_4 = {1, 0, -1, 0}; vector<int> dy_4 = {0, 1, 0, -1}; // coutによるpairの出力(空白区切り) template<typename T1, typename T2> ostream& operator<<(ostream& s, const pair<T1, T2>& p) {return s << "(" << p.first << " " << p.second << ")";} // 空白区切りだけ --> return s << "(" << p.first << " " << p.second << ")"; // 見やすくしたいとき --> return s << "(" << p.first << " " << p.second << ")"; // coutによるvectorの出力(空白区切り) template<typename T> ostream& operator<<(ostream& s, const vector<T>& v) { int len = v.size(); for (int i = 0; i < len; ++i) { s << v[i]; if (i < len - 1) s << " "; //"\t"に変えるとTabで見やすく区切る } return s; } // coutによる多次元vectorの出力(空白区切り) template<typename T> ostream& operator<<(ostream& s, const vector< vector<T> >& vv) { int len = vv.size(); for (int i = 0; i < len; ++i) { s << vv[i] << endl; } return s; } //最大値、最小値を更新する。aよりbのが大きい(小さい)か等しければaを更新してtrueを返す。そうでなければ何もせずfalseを返す chmax(nowmax,x); template<typename T> bool chmax(T& a, T b){return (a = max(a, b)) == b;} template<typename T> bool chmin(T& a, T b){return (a = min(a, b)) == b;} // -------- template end - // // - global -------------- // // ---------- global end - // // - library ------------- // // --------- library end - // // - main() -------------- // int main(){ ll n = il(); vector<ll> as; vector<ll> bs; rep(i,n){ ll a,b; cin >> a >> b; as.push_back(a); bs.push_back(b); } ll pushed = 0; for ( i = n-1; i >= 0; i--){ ll a = pushed + as[i]; ll b = bs[i]; pushed += ( as % bs == 0 ? 0 : as % bs ) } cout << pushed << endl; // ---------- main() end - // }
a.cc: In function 'int main()': a.cc:118:9: error: 'i' was not declared in this scope 118 | for ( i = n-1; i >= 0; i--){ | ^ a.cc:121:20: error: no match for 'operator%' (operand types are 'std::vector<long long int>' and 'std::vector<long long int>') 121 | pushed += ( as % bs == 0 ? 0 : as % bs ) | ~~ ^ ~~ | | | | | vector<[...]> | vector<[...]> In file included from /usr/include/c++/14/valarray:605, from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:166, from a.cc:1: /usr/include/c++/14/bits/valarray_after.h:409:5: note: candidate: 'template<class _Dom1, class _Dom2> std::_Expr<std::__detail::_BinClos<std::__modulus, std::_Expr, std::_Expr, _Dom1, _Dom2>, typename std::__fun<std::__modulus, typename _Dom1::value_type>::result_type> std::operator%(const _Expr<_Dom1, typename _Dom1::value_type>&, const _Expr<_Dom2, typename _Dom2::value_type>&)' 409 | _DEFINE_EXPR_BINARY_OPERATOR(%, struct std::__modulus) | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~ /usr/include/c++/14/bits/valarray_after.h:409:5: note: template argument deduction/substitution failed: a.cc:121:22: note: 'std::vector<long long int>' is not derived from 'const std::_Expr<_Dom1, typename _Dom1::value_type>' 121 | pushed += ( as % bs == 0 ? 0 : as % bs ) | ^~ /usr/include/c++/14/bits/valarray_after.h:409:5: note: candidate: 'template<class _Dom> std::_Expr<std::__detail::_BinClos<std::__modulus, std::_Expr, std::_Constant, _Dom, typename _Dom::value_type>, typename std::__fun<std::__modulus, typename _Dom1::value_type>::result_type> std::operator%(const _Expr<_Dom1, typename _Dom1::value_type>&, const typename _Dom::value_type&)' 409 | _DEFINE_EXPR_BINARY_OPERATOR(%, struct std::__modulus) | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~ /usr/include/c++/14/bits/valarray_after.h:409:5: note: template argument deduction/substitution failed: a.cc:121:22: note: 'std::vector<long long int>' is not derived from 'const std::_Expr<_Dom1, typename _Dom1::value_type>' 121 | pushed += ( as % bs == 0 ? 0 : as % bs ) | ^~ /usr/include/c++/14/bits/valarray_after.h:409:5: note: candidate: 'template<class _Dom> std::_Expr<std::__detail::_BinClos<std::__modulus, std::_Constant, std::_Expr, typename _Dom::value_type, _Dom>, typename std::__fun<std::__modulus, typename _Dom1::value_type>::result_type> std::operator%(const typename _Dom::value_type&, const _Expr<_Dom1, typename _Dom1::value_type>&)' 409 | _DEFINE_EXPR_BINARY_OPERATOR(%, struct std::__modulus) | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~ /usr/include/c++/14/bits/valarray_after.h:409:5: note: template argument deduction/substitution failed: a.cc:121:22: note: 'std::vector<long long int>' is not derived from 'const std::_Expr<_Dom1, typename _Dom1::value_type>' 121 | pushed += ( as % bs == 0 ? 0 : as % bs ) | ^~ /usr/include/c++/14/bits/valarray_after.h:409:5: note: candidate: 'template<class _Dom> std::_Expr<std::__detail::_BinClos<std::__modulus, std::_Expr, std::_ValArray, _Dom, typename _Dom::value_type>, typename std::__fun<std::__modulus, typename _Dom1::value_type>::result_type> std::operator%(const _Expr<_Dom1, typename _Dom1::value_type>&, const valarray<typename _Dom::value_type>&)' 409 | _DEFINE_EXPR_BINARY_OPERATOR(%, struct std::__modulus) | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~ /usr/include/c++/14/bits/valarray_after.h:409:5: note: template argument deduction/substitution failed: a.cc:121:22: note: 'std::vector<long long int>' is not derived from 'const std::_Expr<_Dom1, typename _Dom1::value_type>' 121 | pushed += ( as % bs == 0 ? 0 : as % bs ) | ^~ /usr/include/c++/14/bits/valarray_after.h:409:5: note: candidate: 'template<class _Dom> std::_Expr<std::__detail::_BinClos<std::__modulus, std::_ValArray, std::_Expr, typename _Dom::value_type, _Dom>, typename std::__fun<std::__modulus, typename _Dom1::value_type>::result_type> std::operator%(const valarray<typename _Dom::value_type>&, const _Expr<_Dom1, typename _Dom1::value_type>&)' 409 | _DEFINE_EXPR_BINARY_OPERATOR(%, struct std::__modulus) | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~ /usr/include/c++/14/bits/valarray_after.h:409:5: note: template argument deduction/substitution failed: a.cc:121:22: note: 'std::vector<long long int>' is not derived from 'const std::_Expr<_Dom1, typename _Dom1::value_type>' 121 | pushed += ( as % bs == 0 ? 0 : as % bs ) | ^~ /usr/include/c++/14/valarray:1200:1: note: candidate: 'template<class _Tp> std::_Expr<std::__detail::_BinClos<std::__modulus, std::_ValArray, std::_ValArray, _Tp, _Tp>, typename std::__fun<std::__modulus, _Tp>::result_type> std::operator%(const valarray<_Tp>&, const valarray<_Tp>&)' 1200 | _DEFINE_BINARY_OPERATOR(%, __modulus) | ^~~~~~~~~~~~~~~~~~~~~~~ /usr/include/c++/14/valarray:1200:1: note: template argument deduction/substitution failed: a.cc:121:22: note: 'std::vector<long long int>' is not derived from 'const std::valarray<_Tp>' 121 | pushed += ( as % bs == 0 ? 0 : as % bs ) | ^~ /usr/include/c++/14/valarray:1200:1: note: candidate: 'template<class _Tp> std::_Expr<std::__detail::_BinClos<std::__modulus, std::_ValArray, std::_Constant, _Tp, _Tp>, typename std::__fun<std::__modulus, _Tp>::result_type> std::operator%(const valarray<_Tp>&, const typename valarray<_Tp>::value_type&)' 1200 | _DEFINE_BINARY_OPERATOR(%, __modulus) | ^~~~~~~~~~~~~~~~~~~~~~~ /usr/include/c++/14/valarray:1200:1: note: template argument deduction/substitution failed: a.cc:121:22: note: 'std::vector<long long int>' is not derived from 'const std::valarray<_Tp>' 121 | pushed += ( as % bs == 0 ? 0 : as % bs ) | ^~ /usr/include/c++/14/valarray:1200:1: note: candidate: 'template<class _Tp> std::_Expr<std::__detail::_BinClos<std::__modulus, std::_Constant, std::_ValArray, _Tp, _Tp>, typename std::__fun<std::__modulus, _Tp>::result_type> std::operator%(const typename valarray<_Tp>::value_type&, const valarray<_Tp>&)' 1200 | _DEFINE_BINARY_OPERATOR(%, __modulus) | ^~~~~~~~~~~~~~~~~~~~~~~ /usr/include/c++/14/valarray:1200:1: note: template argument deduction/substitution failed: a.cc:121:22: note: 'std::vector<long long int>' is not derived from 'const std::valarray<_Tp>' 121 | pushed += ( as % bs == 0 ? 0 : as % bs ) | ^~ a.cc:121:39: error: no match for 'operator%' (operand types are 'std::vector<long long int>' and 'std::vector<long long int>') 121 | pushed += ( as % bs == 0 ? 0 : as % bs ) | ~~ ^ ~~ | | | | | vector<[...]> | vector<[...]> /usr/include/c++/14/bits/valarray_after.h:409:5: note: candidate: 'template<class _Dom1, class _Dom2> std::_Expr<std::__detail::_BinClos<std::__modulus, std::_Expr, std::_Expr, _Dom1, _Dom2>, typename std::__fun<std::__modulus, typename _Dom1::value_type>::result_type> std::operator%(const _Expr<_Dom1, typename _Dom1::value_type>&, const _Expr<_Dom2, typename _Dom2::value_type>&)' 409 | _DEFINE_EXPR_BINARY_OPERATOR(%, struct std::__modulus) | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~ /usr/include/c++/14/bits/valarray_after.h:409:5: note: template argument deduction/substitution failed: a.cc:121:41: note: 'std::vector<long long int>' is not derived from 'const std::_Expr<_Dom1, typename _Dom1::value_type>' 121 | pushed += ( as % bs == 0 ? 0 : as % bs ) | ^~ /usr/include/c++/14/bits/valarray_after.h:409:5: note: candidate: 'template<class _Dom> std::_Expr<std::__detail::_BinClos<std::__modulus, std::_Expr, std::_Constant, _Dom, typename _Dom::value_type>, typename std::__fun<std::__modulus, typename _Dom1::value_type>::result_type> std::operator%(const _Expr<_Dom1, typename _Dom1::value_type>&, const typename _Dom::value_type&)' 409 | _DEFINE_EXPR_BINARY_OPERATOR(%, struct std::__modulus) | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~ /usr/include/c++/14/bits/valarray_after.h:409:5: note: template argument deduction/substitution failed: a.cc:121:41: note: 'std::vector<long long int>' is not derived from 'const std::_Expr<_Dom1, typename _Dom1::value_type>' 121 | pushed += ( as % bs == 0 ? 0 : as % bs ) | ^~ /usr/include/c++/14/bits/valarray_after.h:409:5: note: candidate: 'template<class _Dom> std::_Expr<std::__detail::_BinClos<std::__modulus, std::_Constant, std::_Expr, typename _Dom::value_type, _Dom>, typename std::__fun<std::__modulus, typename _Dom1::value_type>::result_type> std::operator%(const typename _Dom::value_type&, const _Expr<_Dom1, typename _Dom1::value_type>&)' 409 | _DEFINE_EXPR_BINARY_OPERATOR(%, struct std::__modulus) | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~ /usr/include/c++/14/bits/valarray_after.h:409:5: note: template argument deduction/substitution failed: a.cc:121:41: note: 'std::vector<long long int>' is not derived from 'const std::_Expr<_Dom1, typename _Dom1::value_type>' 121 | pushed += ( as % bs == 0 ? 0 : as % bs ) | ^~ /usr/include/c++/14/bits/valarray_after.h:409:5: note: candidate: 'template<class _Dom> std::_Expr<std::__detail::_BinClos<std::__modulus, std::_Expr, std::_ValArray, _Dom, typename _Dom::value_type>, typename std::__fun<std::__modulus, typename _Dom1::value_type>::result_type> std::operator%(const _Expr<_Dom1, typename _Dom1::value_type>&, const valarray<typename _Dom::value_type>&)' 409 | _DEFINE_EXPR_BINARY_OPERATOR(%, struct std::__modulus) | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~ /usr/include/c++/14/bits/valarray_after.h:409:5: note: template argument deduction/substitution failed: a.cc:121:41: note: 'std::vector<long long int>' is not derived from 'const std::_Expr<_Dom1, typename _Dom1::value_type>' 121 | pushed
s996077915
p03821
Java
import java.util.HashMap; import java.util.Map; import java.util.Scanner; public class Main { private static Scanner sc = new Scanner(System.in); //result = Math.pow(num1, num3) //StringBuffer str = new StringBuffer(hoge1); //String hoge2 = str.reverse().toString(); //map.containsKey(A) //Map<String, Integer> map = new HashMap<String, Integer>(n); /*for ( キーのデータ型 key : マップの名前.keySet() ) { データのデータ型 data = マップの名前.get( key ); // keyやdataを使った処理; }*/ //int i = Integer.parseInt(s); //Queue<String> qq=new ArrayDeque<>(); //add,poll,peek //Deque<String> qq=new ArrayDeque<>();//push,pop,peek //ArrayList<String> cc = new ArrayList<>(n); //Collections.sort(list); //Array.sort(list); cc.contains(tmp) //Arrays.asList(c).contains("a") //list.set(1,"walk");//1 1 2 3 5 //static long mod =1000000007; //static ArrayList<Integer> cc = new ArrayList<>(100); public static void main(String[] args) { //int N=sc.nextInt();for(int i=0;i<N;i++) {} //int a[]=new int[N]; long N=sc.nextInt(); long a[]=new long[N]; long b[]=new long[N]; for(int i=0;i<N;i++) { a[i]=sc.nextInt(); b[i]=sc.nextInt(); a[i]=b[i]-a[i]%b[i]; } long sum=0; for(int i=(int) (N-1);i>=0;i--) { a[i]=a[i]-sum; if(a[i]<0) { a[i]+=Math.ceil((Math.abs((double)a[i]/b[i])))*b[i]; } sum+=a[i]; } p(sum); } public static long gcd(long a, long b) { return b == 0 ? a: gcd(b, a % b); } public static long lcm(long n, long m) { return n / gcd(n, m) * m; } static void p(String ans) {System.out.println(ans);}; static void p(int ans) {System.out.println(ans);}; static void p() {System.out.println();}; static void p(long ans) {System.out.println(ans);}; static void p(double ans) {System.out.println(ans);}; }
Main.java:40: error: incompatible types: possible lossy conversion from long to int long a[]=new long[N]; ^ Main.java:41: error: incompatible types: possible lossy conversion from long to int long b[]=new long[N]; ^ 2 errors
s910845100
p03821
C++
#include <bits/stdc++.h> using namespace std; #define debug(a) cerr << #a << ": " << a << '\n' #define endl '\n' typedef long long ll; const ll maxn = 200010; void solve(ll case_no) { ll n; cin >> n; vector<ll> a(n), b(n); for (ll i = 0; i < n; i++) cin >> a[i] >> b[i]; ll res = 0; for (ll i = n - 1; i >= 0; i--) { a[i] += res; if (a[i] % b[i]) res += b[i] - a[i] % b[i]; } cout << res << endl; } ll main() { ios_base::sync_with_stdio(false); cin.tie(0); ll test_cnt = 1, case_no = 1; // cin >> test_cnt; while (case_no <= test_cnt) solve(case_no++); return 0; }
a.cc:30:1: error: '::main' must return 'int' 30 | ll main() | ^~
s310982609
p03821
C++
#include <bits/stdc++.h> #include<algorithm> #define int long long using namespace std; #define rep(i, n) for (int i = 0; i < (int)(n); i++) #define INF 1000000000000 inline ll mod(ll a, ll m) { return (a % m + m) % m; } signed main() { int n; cin>>n; int a[n],b[n]; rep(i,n){ cin>>a[i]>>b[i]; } int ans=0; for(int i=n-1;i>=0;i--){ if(a[i]%b[i]!=0){ ans+=(b[i]-((a[i]+ans)%b[i])); } } cout<<ans; }
a.cc:9:8: error: 'll' does not name a type 9 | inline ll mod(ll a, ll m) { | ^~
s767691671
p03821
C++
#include <bits/stdc++.h> #include<algorithm> #define int long long using namespace std; #define rep(i, n) for (int i = 0; i < (int)(n); i++) inline ll mod(ll a, ll m) { return (a % m + m) % m; } #define INF 1000000000000 signed main() { int n; cin>>n; int a[n],b[n]; rep(i,n){ cin>>a[i]>>b[i]; } int ans=0; for(int i=n-1;i>=0;i--){ if(a[i]%b[i]!=0){ ans+=(b[i]-((a[i]+ans)%b[i])); } } cout<<ans; }
a.cc:6:8: error: 'll' does not name a type 6 | inline ll mod(ll a, ll m) { | ^~
s655105214
p03821
C++
#include <bits/stdc++.h> using namespace std; using ll=long long; const ll MOD=1000000007; const double PI=3.14159265358979; const ll INF= pow(10,18); typedef pair<ll,ll> P; typedef vector<ll> vl; typedef vector<vl> vvl; #define FOR(i,a,b) for(ll i=a;i<b;i++) #define rep(i,n) FOR(i,0,n) string abc="abcdefghijklmnopqrstuvwxyz"; string ABC="ABCDEFGHIJKLMNOPQRSTUVWXYZ"; ll gcd(ll a,ll b){ if(a%b==0){ return b; } else return gcd(b,a%b); } int main() { ll n; cin >> n; vl a(n),b(n),g(n); rep(i,n){ cin >> a[i] >> b[i]; g[i]=a[i]*b[i]/gcd(a[i]*b[i]); } ll cnt=0; rep(i,n){ cnt +=g[i]/a[i]; } cout << cnt << endl; }
a.cc: In function 'int main()': a.cc:29:23: error: no matching function for call to 'gcd(__gnu_cxx::__alloc_traits<std::allocator<long long int>, long long int>::value_type)' 29 | g[i]=a[i]*b[i]/gcd(a[i]*b[i]); | ~~~^~~~~~~~~~~ In file included from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:58, from a.cc:1: /usr/include/c++/14/numeric:173:5: note: candidate: 'template<class _Mn, class _Nn> constexpr std::common_type_t<_Mn, _Nn> std::gcd(_Mn, _Nn)' 173 | gcd(_Mn __m, _Nn __n) noexcept | ^~~ /usr/include/c++/14/numeric:173:5: note: candidate expects 2 arguments, 1 provided a.cc:15:4: note: candidate: 'll gcd(ll, ll)' 15 | ll gcd(ll a,ll b){ | ^~~ a.cc:15:4: note: candidate expects 2 arguments, 1 provided
s927406700
p03821
Java
use v5.18; # strict say state use warnings; use List::Util qw(reduce first max min sum0); chomp (my $n = <STDIN>); my (@a, @b); for my $i (0..$n-1) { chomp (($a[$i], $b[$i]) = split / /, <STDIN>); } my $ans = 0; for my $i (0..($n-1)) { $ans += ($b[$n-$i-1] - ($a[$n-$i-1]+$ans) % $b[$n-$i-1]) % $b[$n-$i-1]; } say $ans;
Main.java:1: error: class, interface, enum, or record expected use v5.18; # strict say state ^ Main.java:1: error: illegal character: '#' use v5.18; # strict say state ^ Main.java:1: error: class, interface, enum, or record expected use v5.18; # strict say state ^ Main.java:3: error: class, interface, enum, or record expected use List::Util qw(reduce first max min sum0); ^ Main.java:5: error: class, interface, enum, or record expected chomp (my $n = <STDIN>); ^ Main.java:6: error: class, interface, enum, or record expected my (@a, @b); ^ Main.java:6: error: class, interface, enum, or record expected my (@a, @b); ^ Main.java:6: error: class, interface, enum, or record expected my (@a, @b); ^ Main.java:7: error: class, interface, enum, or record expected for my $i (0..$n-1) { ^ Main.java:9: error: class, interface, enum, or record expected } ^ Main.java:11: error: class, interface, enum, or record expected for my $i (0..($n-1)) { ^ Main.java:13: error: class, interface, enum, or record expected } ^ 12 errors
s175026120
p03821
C++
#include <bits/stdc++.h> using namespace std; int main () { long N, sum = 0; cin >> N; vector<pair<long, long>> data(N); for(int i = 0; i < N; i++){ cin >> data.at(i).first >> data.at(i).second; } for(int i = N - 1; i >= 0; i--){ if((sum + data.at(i).first) % data.at(i).second == 0)continue; else { sum += data.at(i).second - (sum + data.at(i).first) % data.at(i).second; } } cout << aum << endl; return 0; }
a.cc: In function 'int main()': a.cc:16:11: error: 'aum' was not declared in this scope; did you mean 'sum'? 16 | cout << aum << endl; | ^~~ | sum
s358530564
p03821
C++
#include <bits/stdc++.h> using namespace std; int n; int a[MAXN], b[MAXN]; long long ans; int main() { cin >> n; for (int i = 0; i < n; i++) cin >> a[i] >> b[i]; for (int i = n - 1; ~i; i--) { a[i] += ans; if (a[i] == b[i]) continue; b[i] = ((a[i] + b[i] - 1) / b[i]) * b[i]; ans += (b[i] - a[i]); } cout << ans << '\n'; return 0; }
a.cc:5:7: error: 'MAXN' was not declared in this scope 5 | int a[MAXN], b[MAXN]; | ^~~~ a.cc:5:16: error: 'MAXN' was not declared in this scope 5 | int a[MAXN], b[MAXN]; | ^~~~ a.cc: In function 'int main()': a.cc:11:16: error: 'a' was not declared in this scope 11 | cin >> a[i] >> b[i]; | ^ a.cc:11:24: error: 'b' was not declared in this scope 11 | cin >> a[i] >> b[i]; | ^ a.cc:13:9: error: 'a' was not declared in this scope 13 | a[i] += ans; | ^ a.cc:14:17: error: 'b' was not declared in this scope 14 | if (a[i] == b[i]) | ^ a.cc:16:7: error: 'b' was not declared in this scope 16 | b[i] = ((a[i] + b[i] - 1) / b[i]) * b[i]; | ^
s930459518
p03821
C++
#include<iostream> using namespace std; #define rep(i,n) for(int i=0;i<(int)(n);i++) typedef long long ll; int main(){ int n; cin >> n; ll c = 0; vector<ll>a(n),b(n); rep(i,n){ cin >> a[i] >> b[i]; } reverse(a.begin(),a.end()); reverse(b.begin(),b.end()); rep(i,n){ a[i] += c; ll t = (a[i]/b[i])*b[i]; if(a[i]!=t){ t += b[i]; c += t-a[i]; } } cout << c << endl; return 0; }
a.cc: In function 'int main()': a.cc:9:3: error: 'vector' was not declared in this scope 9 | vector<ll>a(n),b(n); | ^~~~~~ a.cc:2:1: note: 'std::vector' is defined in header '<vector>'; this is probably fixable by adding '#include <vector>' 1 | #include<iostream> +++ |+#include <vector> 2 | using namespace std; a.cc:9:12: error: expected primary-expression before '>' token 9 | vector<ll>a(n),b(n); | ^ a.cc:9:13: error: 'a' was not declared in this scope 9 | vector<ll>a(n),b(n); | ^ a.cc:9:18: error: 'b' was not declared in this scope 9 | vector<ll>a(n),b(n); | ^ a.cc:13:3: error: 'reverse' was not declared in this scope 13 | reverse(a.begin(),a.end()); | ^~~~~~~
s157002921
p03821
C++
#include<iostream> using namespace std; #define rep(i,n) for(int i=0;i<(int)(n);i++) typedef long long ll; int main(){ int n; cin >> n; ll c = 0; vector<ll>a(n),b(n); rep(i,n){ cin >> a[i] >> b[i]; } reverse(a.begin(),a.end()); reverse(b.begin(),b.end()); rep(i,n){ a[i] += c; ll t = (a[i]/b[i])*b[i]; t *= b[i]; if(a[i]!=t){ t += b[i]; c += t-a[i]; } } cout << c << endl; return 0; }
a.cc: In function 'int main()': a.cc:9:3: error: 'vector' was not declared in this scope 9 | vector<ll>a(n),b(n); | ^~~~~~ a.cc:2:1: note: 'std::vector' is defined in header '<vector>'; this is probably fixable by adding '#include <vector>' 1 | #include<iostream> +++ |+#include <vector> 2 | using namespace std; a.cc:9:12: error: expected primary-expression before '>' token 9 | vector<ll>a(n),b(n); | ^ a.cc:9:13: error: 'a' was not declared in this scope 9 | vector<ll>a(n),b(n); | ^ a.cc:9:18: error: 'b' was not declared in this scope 9 | vector<ll>a(n),b(n); | ^ a.cc:13:3: error: 'reverse' was not declared in this scope 13 | reverse(a.begin(),a.end()); | ^~~~~~~
s461310373
p03821
C++
if __name__ == '__main__': N = int(input()) A = [] B = [] for i in range(N): a, b = map(int, input().split()) A.append(a) B.append(b) ans = 0 for i in range(N-1, -1, -1): if (A[i]+ans) % B[i] == 0: continue ans += B[i] - (A[i]+ans) % B[i] print(ans)
a.cc:3:16: warning: multi-character literal with 8 characters exceeds 'int' size of 4 bytes 3 | if __name__ == '__main__': | ^~~~~~~~~~ a.cc:3:1: error: expected unqualified-id before 'if' 3 | if __name__ == '__main__': | ^~
s711783721
p03821
C++
#include<algorithm> #include<stdio.h> using namespace std; int N, A[100000], B[100000]; int x; int sum = 0; int kai(int a, int b) { int t = (a / b) + 1; return b * (t + 1) - a; } int main() { cin >> N; for (int i = 0;i < N;i++)cin >> A[i] >> B[i]; for (int i = N;i >= 0;i--) { x = kai(A[i], B[i]); sum += x; for (int j = 0;j < i;j++) { A[j] += x; } } cout << sum; }
a.cc: In function 'int main()': a.cc:15:9: error: 'cin' was not declared in this scope 15 | cin >> N; | ^~~ a.cc:3:1: note: 'std::cin' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>' 2 | #include<stdio.h> +++ |+#include <iostream> 3 | using namespace std; a.cc:24:9: error: 'cout' was not declared in this scope 24 | cout << sum; | ^~~~ a.cc:24:9: note: 'std::cout' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
s959601089
p03821
C++
#include <iostream> #include <algorithm> #include <vector> #include <functional> #include <queue> #include <string> using namespace std; #define rep(i,n) for(ll i = 0;i < n; i++) typedef long long ll; int main(){ ll N,ans = 0; cin >> N; ll A[100010]; ll B[100010]; rep(i,N) cin >> A[i] >> B[i]; for(ll i = N-1;i >= 0;i--){ ans += (B[i] - (A[i] + ans) % B[i]) % B[i]; } } cout << ans << endl; }
a.cc:23:5: error: 'cout' does not name a type 23 | cout << ans << endl; | ^~~~ a.cc:24:1: error: expected declaration before '}' token 24 | } | ^
s445045071
p03821
C++
/* これを入れて実行 g++ code.cpp ./a.out */ #include <iostream> #include <vector> #include <string> #include <queue> #include <deque> #include <algorithm> #include <utility> #include <set> #include <map> #include <cmath> #include <math.h> #include <tuple> #include <iomanip> using namespace std; typedef long long ll; typedef long double ld; int dy4[4] = {-1, 0, +1, 0}; int dx4[4] = {0, +1, 0, -1}; int dy8[8] = {-1, -1, 0, 1, 1, 1, 0, -1}; int dx8[8] = {0, 1, 1, 1, 0, -1, -1, -1}; const long long INF = 1LL << 60; const ll MOD = 1e9 + 7; bool greaterSecond(const pair<int, int>& f, const pair<int, int>& s){ return f.second > s.second; } ll gcd(ll a, ll b){ if (b == 0)return a; return gcd(b, a % b); } ll lcm(ll a, ll b){ return a / gcd(a, b) * b; } ll nCr(ll n, ll r){ if(r == 0 || r == n){ return 1; } else if(r == 1){ return n; } return (nCr(n - 1, r) + nCr(n - 1, r - 1)); } ll nPr(ll n, ll r){ r = n - r; ll ret = 1; for (ll i = n; i >= r + 1; i--) ret *= i; return ret; } //-----------------------ここから----------- int main(void){ ll n; cin >> n; vector<ll> a(n), b(n); ll ans = 0; for(int i = 0; i < n; i++){ cin >> a[i] >> b[i]; } vector<ll> added(n, 0); for(int i = n - 1; i >= 0; i--){ if(i < n - 1) a[i] += added[i + 1]; if(a[i] < b[i]){ if(i < n - 1){ added[i] = added[i + 1] + (b[i] - a[i]); } else { added[i] = b[i] - a[i]; } ans += b[i] - a[i]; } else if(a[i] % b[i] != 0 && a[i] > b[i]){ if(i < n - 1){ added[i] = added[i + 1] + (b[i] - a[i] % b[i]); } else { added[i] = b[i] - a[i] % b[i]; } ans += b[i] - a[i] % b[i]; } else { added[i] = added[i + 1] } } cout << ans << endl; }
a.cc: In function 'int main()': a.cc:93:36: error: expected ';' before '}' token 93 | added[i] = added[i + 1] | ^ | ; 94 | } | ~
s720642941
p03821
C++
#include <bits/stdc++.h> using namespace std; typedef long long ll; typedef pair<int,int> P; typedef vector<int> VI; template<class T> bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; } template<class T> bool chmin(T &a, const T &b) { if (a>b) { a=b; return 1; } return 0; } #define _overload3(_1,_2,_3,name,...) name #define _rep(i,n) repi(i,0,n) #define repi(i,a,b) for(int i=int(a);i<int(b);++i) #define rep(...) _overload3(__VA_ARGS__,repi,_rep,)(__VA_ARGS__) #define all(x) (x).begin(),(x).end() int main(){ int n;cin>>n; ll a[n],b[n],rep(i,n)cin>>a[i]>>b[i]; ll ctr=0; rep(rei,n){ int i=n-1-rei; ctr+=(b[i]-(a[i]+ctr)%b[i])%b[i]; } cout<<ctr<<endl; }
a.cc: In function 'int main()': a.cc:11:21: error: expected unqualified-id before 'for' 11 | #define repi(i,a,b) for(int i=int(a);i<int(b);++i) | ^~~ a.cc:10:19: note: in expansion of macro 'repi' 10 | #define _rep(i,n) repi(i,0,n) | ^~~~ a.cc:9:39: note: in expansion of macro '_rep' 9 | #define _overload3(_1,_2,_3,name,...) name | ^~~~ a.cc:12:18: note: in expansion of macro '_overload3' 12 | #define rep(...) _overload3(__VA_ARGS__,repi,_rep,)(__VA_ARGS__) | ^~~~~~~~~~ a.cc:18:16: note: in expansion of macro 'rep' 18 | ll a[n],b[n],rep(i,n)cin>>a[i]>>b[i]; | ^~~ a.cc:18:20: error: 'i' was not declared in this scope 18 | ll a[n],b[n],rep(i,n)cin>>a[i]>>b[i]; | ^ a.cc:11:38: note: in definition of macro 'repi' 11 | #define repi(i,a,b) for(int i=int(a);i<int(b);++i) | ^ a.cc:9:39: note: in expansion of macro '_rep' 9 | #define _overload3(_1,_2,_3,name,...) name | ^~~~ a.cc:18:16: note: in expansion of macro 'rep' 18 | ll a[n],b[n],rep(i,n)cin>>a[i]>>b[i]; | ^~~
s574091883
p03821
C++
#include<iostream> #include<string> #include<typeinfo> #include<vector> #include<algorithm> using namespace std; int main() { int N; cin >> N; vector<int> A(N), B(N); for(int i=0; i<N; i++){ cin >> A.at(i) >> B.at(i); } int ans=0; int tmp=0; for(int p=N-1; p>=0; p--){ int tmp = A.at(p)+ans; // if(tmp%B.at(p)!=0){ ans+=(B.at(p)-tmp%B.at(p))%B.at(p); // } // cout<< tmp << ans << endl; } cout << ans << endl; return 0 }
a.cc: In function 'int main()': a.cc:28:17: error: expected ';' before '}' token 28 | return 0 | ^ | ; 29 | } | ~
s864807441
p03821
C++
#include<iostream> #include<string> #include<typeinfo> #include<vector> #include<algorithm> using namespace std; int main() { int N; cin >> N; vector<int> A(N), B(N); for(int i=0; i<N; i++){ cin >> A.at(i) >> B.at(i); } int ans=0; int tmp=0; for(int p=N-1; p>=0; p--){ int tmp = A.at(p)+ans; // if(tmp%B.at(p)!=0){ ans+=(B.at(p)-tmp%B.at(p))%B.at(p); // } // cout<< tmp << ans << endl; } cout << ans << endl; return 0
a.cc: In function 'int main()': a.cc:28:17: error: expected ';' at end of input 28 | return 0 | ^ | ; a.cc:28:17: error: expected '}' at end of input a.cc:8:1: note: to match this '{' 8 | { | ^
s154447110
p03821
C++
#include<iostream> using namespace std; long long[100000],b[100000],cnt; main(){ cin>>n; for(int i=0;i<n;i++)cin>>a[i]>>b[i]; for(int i=n-1;i>=0;i--){ a[i]+=cnt; if(a[i]%b[i])cnt+=b[i]-a[i]%b[i]; } cout<<cnt<<endl; }
a.cc:3:11: error: expected identifier before numeric constant 3 | long long[100000],b[100000],cnt; | ^~~~~~ a.cc:3:11: error: expected ']' before numeric constant 3 | long long[100000],b[100000],cnt; | ^~~~~~ | ] a.cc:3:10: error: structured binding declaration cannot have type 'long long int' 3 | long long[100000],b[100000],cnt; | ^ a.cc:3:10: note: type must be cv-qualified 'auto' or reference to cv-qualified 'auto' a.cc:3:10: error: empty structured binding declaration a.cc:3:18: error: expected initializer before ',' token 3 | long long[100000],b[100000],cnt; | ^ a.cc:4:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type] 4 | main(){ | ^~~~ a.cc: In function 'int main()': a.cc:5:10: error: 'n' was not declared in this scope 5 | cin>>n; | ^ a.cc:6:30: error: 'a' was not declared in this scope 6 | for(int i=0;i<n;i++)cin>>a[i]>>b[i]; | ^ a.cc:6:36: error: 'b' was not declared in this scope 6 | for(int i=0;i<n;i++)cin>>a[i]>>b[i]; | ^ a.cc:8:9: error: 'a' was not declared in this scope 8 | a[i]+=cnt; | ^ a.cc:8:15: error: 'cnt' was not declared in this scope; did you mean 'int'? 8 | a[i]+=cnt; | ^~~ | int a.cc:9:17: error: 'b' was not declared in this scope 9 | if(a[i]%b[i])cnt+=b[i]-a[i]%b[i]; | ^ a.cc:11:11: error: 'cnt' was not declared in this scope; did you mean 'int'? 11 | cout<<cnt<<endl; | ^~~ | int
s435459318
p03821
C++
#include <bits/stdc++.h> using namespace std; main(){ int n,i; cin>>n; int a[n],b[n]; for(i=0;i<n;i++) cin>>a[i]>>b[i]; for(;i;i--) if((a[i]+res)%b[i]) res+=b[i]-(a[i]+res)%b[i]; cout<<res; }
a.cc:3:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type] 3 | main(){ | ^~~~ a.cc: In function 'int main()': a.cc:8:26: error: 'res' was not declared in this scope 8 | for(;i;i--) if((a[i]+res)%b[i]) res+=b[i]-(a[i]+res)%b[i]; | ^~~ a.cc:9:11: error: 'res' was not declared in this scope 9 | cout<<res; | ^~~
s224457614
p03821
C++
#include <bits/stdc++.h> using namespace std; main(){ int n,i; cin>>n; int a[n],b[n]; for(i,n) cin>>a[i]>>b[i]; rev(i,n) if((a[i]+res)%b[i]) res+=b[i]-(a[i]+res)%b[i]; cout<<res; }
a.cc:3:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type] 3 | main(){ | ^~~~ a.cc: In function 'int main()': a.cc:7:12: error: expected ';' before ')' token 7 | for(i,n) cin>>a[i]>>b[i]; | ^ | ; a.cc:8:5: error: 'rev' was not declared in this scope 8 | rev(i,n) if((a[i]+res)%b[i]) res+=b[i]-(a[i]+res)%b[i]; | ^~~ a.cc:8:13: error: expected ';' before 'if' 8 | rev(i,n) if((a[i]+res)%b[i]) res+=b[i]-(a[i]+res)%b[i]; | ^~~ | ; a.cc:8:14: error: expected primary-expression before 'if' 8 | rev(i,n) if((a[i]+res)%b[i]) res+=b[i]-(a[i]+res)%b[i]; | ^~ a.cc:8:13: error: expected ')' before 'if' 8 | rev(i,n) if((a[i]+res)%b[i]) res+=b[i]-(a[i]+res)%b[i]; | ^~~ | ) a.cc:7:8: note: to match this '(' 7 | for(i,n) cin>>a[i]>>b[i]; | ^ a.cc:8:23: error: 'res' was not declared in this scope 8 | rev(i,n) if((a[i]+res)%b[i]) res+=b[i]-(a[i]+res)%b[i]; | ^~~ a.cc:9:11: error: 'res' was not declared in this scope 9 | cout<<res; | ^~~
s027827313
p03821
C++
/*#include <iostream> #include <cmath> #include <vector> #include <algorithm> #include <array> #include <vector> #include <deque> #include <set> #include <map> #include <string> #include <stack> #include <queue> #include <unordered_map> #include <unordered_set> */ #include <bits/stdc++.h> using namespace std; // #define int long long #define pb push_back #define mp make_pair #define F first #define S second #define FOR(i,a,b) for(int (i)=(a);(i)<(b);(i)++) #define REP(i,n) FOR(i,0,n) #define ALL(a) (a).begin(),(a).end() #define RALL(a) (a).rbegin(),(a).rend() #define SORT(c) sort((c).begin(),(c).end()) typedef long long ll; const ll INF = LLONG_MAX - 100; const ll mod = 2e9 + 7; const int MAX_N = 5e5 + 5; int dx[] = { -1LL,0,1LL,0 }, dy[] = { 0,1LL,0,-1LL }; vector<ll> prime; ll inv[MAX_N], fac[MAX_N]; template <class T = ll> T in() { T x; cin >> x; return (x); } inline ll GCD(ll a, ll b) { ll c; while (b != 0) { c = a % b; a = b; b = c; }return a; } inline ll LCM(ll a, ll b) { return a * b / GCD(a, b); } inline ll POW(ll a, ll b) { ll c = 1LL; while (b > 0) { if (b & 1LL) { c = a * c%mod; }a = a * a%mod; b >>= 1LL; }return c; } inline void _nCr() { fac[0] = 1LL; for (int i = 1LL; i < MAX_N; i++) { fac[i] = fac[i - 1LL] * i%mod; }for (int i = 0; i < MAX_N; i++) { inv[i] = POW(fac[i], mod - 2); } } inline ll nCr(ll n, ll r) { return (fac[n] * inv[r] % mod)*inv[n - r] % mod; } inline void PRI(ll n) { bool a[n + 1LL]; for (int i = 0; i < n + 1LL; i++) { a[i] = 1LL; }for (int i = 2; i < n + 1LL; i++) { if (a[i]) { prime.pb(i); ll b = i; while (b <= n) { a[b] = 0; b += i; } } } } typedef pair<int, pair<int, int>> edge; class UnionFind { private: vector<int> par; public: UnionFind(int N) { par = vector<int>(N, -1LL); } int find(int x); ll size(int x); void unite(int x, int y); bool same(int x, int y); }; class Kruskal { private: UnionFind *uf; vector<edge> e; public: vector<edge> mst; Kruskal(int N) { uf = new UnionFind(N); } void add(int x, int y, ll z); void run(); }; //----UnionFind------------------------------- int UnionFind::find(int x) { if (par[x] < 0) return x; else return par[x] = find(par[x]); } ll UnionFind::size(int x) { return -par[find(x)]; } void UnionFind::unite(int x, int y) { x = find(x); y = find(y); //大きい方に小さい方をくっ付ける if (size(x) < size(y)) swap(x, y); par[x] += par[y]; par[y] = x; } bool UnionFind::same(int x, int y) { x = find(x); y = find(y); return x == y; } //----Kruskal------------------------------- void Kruskal::add(int x, int y, ll z) { //x < y if (x > y) swap(x, y); e.push_back({ z,{x,y} }); } void Kruskal::run() { sort(e.begin(), e.end()); e.erase(unique(e.begin(), e.end()), e.end()); for (auto x : e) { if (uf->same(x.second.first, x.second.second)) { continue; } else { mst.push_back(x); uf->unite(x.second.first, x.second.second); } } } signed main() { ll n;cin >> n; ll a[n],b[n]; REP (i,n) cin >> a[i] >> b[i] long long sum = 0; for (int i = n-1;i >= 0;i--) { if ((sum + a[i]) % b[i] != 0) {sum += b[i] - (sum + a[i]) % b[i];} cout << sum << endl; } cout << sum << endl; }
a.cc: In member function 'void Kruskal::add(int, int, ll)': a.cc:108:23: warning: narrowing conversion of 'z' from 'll' {aka 'long long int'} to 'int' [-Wnarrowing] 108 | e.push_back({ z,{x,y} }); | ^ a.cc: In function 'int main()': a.cc:128:38: error: expected ';' before 'long' 128 | REP (i,n) cin >> a[i] >> b[i] | ^ | ; 129 | long long sum = 0; | ~~~~ a.cc:131:22: error: 'sum' was not declared in this scope 131 | if ((sum + a[i]) % b[i] != 0) {sum += b[i] - (sum + a[i]) % b[i];} | ^~~ a.cc:132:25: error: 'sum' was not declared in this scope 132 | cout << sum << endl; | ^~~ a.cc:134:17: error: 'sum' was not declared in this scope 134 | cout << sum << endl; | ^~~
s760925934
p03821
C++
/*#include <iostream> #include <cmath> #include <vector> #include <algorithm> #include <array> #include <vector> #include <deque> #include <set> #include <map> #include <string> #include <stack> #include <queue> #include <unordered_map> #include <unordered_set> */ #include <bits/stdc++.h> using namespace std; // #define int long long #define pb push_back #define mp make_pair #define F first #define S second #define FOR(i,a,b) for(int (i)=(a);(i)<(b);(i)++) #define REP(i,n) FOR(i,0,n) #define ALL(a) (a).begin(),(a).end() #define RALL(a) (a).rbegin(),(a).rend() #define SORT(c) sort((c).begin(),(c).end()) typedef long long ll; const ll INF = LLONG_MAX - 100; const ll mod = 2e9 + 7; const int MAX_N = 5e5 + 5; int dx[] = { -1LL,0,1LL,0 }, dy[] = { 0,1LL,0,-1LL }; vector<ll> prime; ll inv[MAX_N], fac[MAX_N]; template <class T = ll> T in() { T x; cin >> x; return (x); } inline ll GCD(ll a, ll b) { ll c; while (b != 0) { c = a % b; a = b; b = c; }return a; } inline ll LCM(ll a, ll b) { return a * b / GCD(a, b); } inline ll POW(ll a, ll b) { ll c = 1LL; while (b > 0) { if (b & 1LL) { c = a * c%mod; }a = a * a%mod; b >>= 1LL; }return c; } inline void _nCr() { fac[0] = 1LL; for (int i = 1LL; i < MAX_N; i++) { fac[i] = fac[i - 1LL] * i%mod; }for (int i = 0; i < MAX_N; i++) { inv[i] = POW(fac[i], mod - 2); } } inline ll nCr(ll n, ll r) { return (fac[n] * inv[r] % mod)*inv[n - r] % mod; } inline void PRI(ll n) { bool a[n + 1LL]; for (int i = 0; i < n + 1LL; i++) { a[i] = 1LL; }for (int i = 2; i < n + 1LL; i++) { if (a[i]) { prime.pb(i); ll b = i; while (b <= n) { a[b] = 0; b += i; } } } } typedef pair<int, pair<int, int>> edge; class UnionFind { private: vector<int> par; public: UnionFind(int N) { par = vector<int>(N, -1LL); } int find(int x); ll size(int x); void unite(int x, int y); bool same(int x, int y); }; class Kruskal { private: UnionFind *uf; vector<edge> e; public: vector<edge> mst; Kruskal(int N) { uf = new UnionFind(N); } void add(int x, int y, ll z); void run(); }; //----UnionFind------------------------------- int UnionFind::find(int x) { if (par[x] < 0) return x; else return par[x] = find(par[x]); } ll UnionFind::size(int x) { return -par[find(x)]; } void UnionFind::unite(int x, int y) { x = find(x); y = find(y); //大きい方に小さい方をくっ付ける if (size(x) < size(y)) swap(x, y); par[x] += par[y]; par[y] = x; } bool UnionFind::same(int x, int y) { x = find(x); y = find(y); return x == y; } //----Kruskal------------------------------- void Kruskal::add(int x, int y, ll z) { //x < y if (x > y) swap(x, y); e.push_back({ z,{x,y} }); } void Kruskal::run() { sort(e.begin(), e.end()); e.erase(unique(e.begin(), e.end()), e.end()); for (auto x : e) { if (uf->same(x.second.first, x.second.second)) { continue; } else { mst.push_back(x); uf->unite(x.second.first, x.second.second); } } } signed main() { long long n;cin >> n; long long a[n],b[n]; REP (i,n) cin >> a[i] >> b[i] long long sum = 0; for (int i = n-1;i >= 0;i--) { if ((sum + a[i]) % b[i] != 0) {sum += b[i] - (sum + a[i]) % b[i];} cout << sum << endl; } cout << sum << endl; }
a.cc: In member function 'void Kruskal::add(int, int, ll)': a.cc:108:23: warning: narrowing conversion of 'z' from 'll' {aka 'long long int'} to 'int' [-Wnarrowing] 108 | e.push_back({ z,{x,y} }); | ^ a.cc: In function 'int main()': a.cc:128:38: error: expected ';' before 'long' 128 | REP (i,n) cin >> a[i] >> b[i] | ^ | ; 129 | long long sum = 0; | ~~~~ a.cc:131:22: error: 'sum' was not declared in this scope 131 | if ((sum + a[i]) % b[i] != 0) {sum += b[i] - (sum + a[i]) % b[i];} | ^~~ a.cc:132:25: error: 'sum' was not declared in this scope 132 | cout << sum << endl; | ^~~ a.cc:134:17: error: 'sum' was not declared in this scope 134 | cout << sum << endl; | ^~~
s682821604
p03821
C++
#include<bits/stdc++.h> #define all(x) (x).begin(),(x).end() typedef long long ll; #define rep(i,n) for(ll i=0, i##_len=(n); i<i##_len; ++i) using namespace std; #define sz(x) ((int)(x).size()) #define ZERO(a) memset(a,0,sizeof(a)) #define MINUS(a) memset(a,0xff,sizeof(a)) #define MEMSET(v, h) memset((v), h, sizeof(v)) template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; } template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; } #define pb push_back #define mp make_pair #define y0 y3487465 #define y1 y8687969 #define j0 j1347829 #define j1 j234892 ll gcd(ll a,ll b){return b?gcd(b,a%b):a;} const ll INF = 1LL<<58; int main() { ll n; cin >> n; ll ans = 0; vector <ll> A(n); vector <ll> B(n); rep(i, n) { cin >> A[i]; cin >> B[i]; } for(ll i = n - 1; i >= 0; --i) { ll temp = (A[i] + ans) % B[i]; ans += temp == 0 ? 0 : B[i] - temp; A[i] += ans; } cout << ans << endl; }
a.cc:33:24: error: extended character   is not valid in an identifier 33 | ans += temp == 0 ? 0 : B[i] - temp; | ^ a.cc:33:32: error: extended character   is not valid in an identifier 33 | ans += temp == 0 ? 0 : B[i] - temp; | ^ a.cc: In function 'int main()': a.cc:33:24: error: 'temp\U00003000' was not declared in this scope; did you mean 'temp'? 33 | ans += temp == 0 ? 0 : B[i] - temp; | ^~~~~~ | temp a.cc:33:32: error: '\U000030000' was not declared in this scope 33 | ans += temp == 0 ? 0 : B[i] - temp; | ^~~
s073523657
p03821
C++
n=int(input()) ans=0 ab=[] for i in range(n): ab.append(list(map(int, input().split()))) ab.reverse() for i in range(n): a=ab[i][0]+ans b=ab[i][1] if a%b!=0: ans+=b-a%b print(ans)
a.cc:1:1: error: 'n' does not name a type 1 | n=int(input()) | ^
s845928520
p03821
C++
#include<bits/stdc++.h> using namespace std; using ll = long long; #define MM = 1000000000; #define mod = MM + 7; #define INF (ll)1e18 #define pi acos(-1.0) #define MAX 10000000005 #define NIL -1 int main(){ ll n; cin >> n; ll a[n], b[n]; for(ll i = 0; i < n; i++){ cin >> a[i] << b[i]; } ll cnt = 0; for(ll i = n-1; i >= 0; i--){ if(a[i]%b[i] == 0) break; else { for(ll i = 0; i <= i; i++){ a[i]--; cnt++; } } } cout << cnt << endl; }
a.cc: In function 'int main()': a.cc:14:21: error: no match for 'operator<<' (operand types are 'std::basic_istream<char>::__istream_type' {aka 'std::basic_istream<char>'} and 'll' {aka 'long long int'}) 14 | cin >> a[i] << b[i]; | ~~~~~~~~~~~ ^~ ~~~~ | | | | | ll {aka long long int} | std::basic_istream<char>::__istream_type {aka std::basic_istream<char>} a.cc:14:21: note: candidate: 'operator<<(int, ll {aka long long int})' (built-in) 14 | cin >> a[i] << b[i]; | ~~~~~~~~~~~~^~~~~~~ a.cc:14:21: note: no known conversion for argument 1 from 'std::basic_istream<char>::__istream_type' {aka 'std::basic_istream<char>'} to 'int' In file included from /usr/include/c++/14/regex:68, from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:181, from a.cc:1: /usr/include/c++/14/bits/regex.h:1715:5: note: candidate: 'template<class _Ch_type, class _Ch_traits, class _Bi_iter> std::basic_ostream<_CharT, _Traits>& std::__cxx11::operator<<(std::basic_ostream<_CharT, _Traits>&, const sub_match<_Bi_iter>&)' 1715 | operator<<(basic_ostream<_Ch_type, _Ch_traits>& __os, | ^~~~~~~~ /usr/include/c++/14/bits/regex.h:1715:5: note: template argument deduction/substitution failed: a.cc:14:27: note: 'std::basic_istream<char>::__istream_type' {aka 'std::basic_istream<char>'} is not derived from 'std::basic_ostream<_CharT, _Traits>' 14 | cin >> a[i] << b[i]; | ^ In file included from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:41: /usr/include/c++/14/cstddef:125:5: note: candidate: 'template<class _IntegerType> constexpr std::__byte_op_t<_IntegerType> std::operator<<(byte, _IntegerType)' 125 | operator<<(byte __b, _IntegerType __shift) noexcept | ^~~~~~~~ /usr/include/c++/14/cstddef:125:5: note: template argument deduction/substitution failed: a.cc:14:13: note: cannot convert 'std::cin.std::basic_istream<char>::operator>>(a[i])' (type 'std::basic_istream<char>::__istream_type' {aka 'std::basic_istream<char>'}) to type 'std::byte' 14 | cin >> a[i] << b[i]; | ~~~~^~~~~~~ In file included from /usr/include/c++/14/bits/basic_string.h:47, 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/string_view:763:5: note: candidate: 'template<class _CharT, class _Traits> std::basic_ostream<_CharT, _Traits>& std::operator<<(basic_ostream<_CharT, _Traits>&, basic_string_view<_CharT, _Traits>)' 763 | operator<<(basic_ostream<_CharT, _Traits>& __os, | ^~~~~~~~ /usr/include/c++/14/string_view:763:5: note: template argument deduction/substitution failed: a.cc:14:27: note: 'std::basic_istream<char>::__istream_type' {aka 'std::basic_istream<char>'} is not derived from 'std::basic_ostream<_CharT, _Traits>' 14 | cin >> a[i] << b[i]; | ^ /usr/include/c++/14/bits/basic_string.h:4077:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> std::basic_ostream<_CharT, _Traits>& std::operator<<(basic_ostream<_CharT, _Traits>&, const __cxx11::basic_string<_CharT, _Traits, _Allocator>&)' 4077 | operator<<(basic_ostream<_CharT, _Traits>& __os, | ^~~~~~~~ /usr/include/c++/14/bits/basic_string.h:4077:5: note: template argument deduction/substitution failed: a.cc:14:27: note: 'std::basic_istream<char>::__istream_type' {aka 'std::basic_istream<char>'} is not derived from 'std::basic_ostream<_CharT, _Traits>' 14 | cin >> a[i] << b[i]; | ^ /usr/include/c++/14/bitset:1687:5: note: candidate: 'template<class _CharT, class _Traits, long unsigned int _Nb> std::basic_ostream<_CharT, _Traits>& std::operator<<(basic_ostream<_CharT, _Traits>&, const bitset<_Nb>&)' 1687 | operator<<(std::basic_ostream<_CharT, _Traits>& __os, | ^~~~~~~~ /usr/include/c++/14/bitset:1687:5: note: template argument deduction/substitution failed: a.cc:14:27: note: 'std::basic_istream<char>::__istream_type' {aka 'std::basic_istream<char>'} is not derived from 'std::basic_ostream<_CharT, _Traits>' 14 | cin >> a[i] << b[i]; | ^ In file included from /usr/include/c++/14/bits/ios_base.h:46, from /usr/include/c++/14/streambuf:43, from /usr/include/c++/14/bits/streambuf_iterator.h:35, from /usr/include/c++/14/iterator:66, from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:54: /usr/include/c++/14/system_error:339:5: note: candidate: 'template<class _CharT, class _Traits> std::basic_ostream<_CharT, _Traits>& std::operator<<(basic_ostream<_CharT, _Traits>&, const error_code&)' 339 | operator<<(basic_ostream<_CharT, _Traits>& __os, const error_code& __e) | ^~~~~~~~ /usr/include/c++/14/system_error:339:5: note: template argument deduction/substitution failed: a.cc:14:27: note: 'std::basic_istream<char>::__istream_type' {aka 'std::basic_istream<char>'} is not derived from 'std::basic_ostream<_CharT, _Traits>' 14 | cin >> a[i] << b[i]; | ^ In file included from /usr/include/c++/14/memory:80, from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:56: /usr/include/c++/14/bits/shared_ptr.h:70:5: note: candidate: 'template<class _Ch, class _Tr, class _Tp, __gnu_cxx::_Lock_policy _Lp> std::basic_ostream<_CharT, _Traits>& std::operator<<(basic_ostream<_CharT, _Traits>&, const __shared_ptr<_Tp, _Lp>&)' 70 | operator<<(std::basic_ostream<_Ch, _Tr>& __os, | ^~~~~~~~ /usr/include/c++/14/bits/shared_ptr.h:70:5: note: template argument deduction/substitution failed: a.cc:14:27: note: 'std::basic_istream<char>::__istream_type' {aka 'std::basic_istream<char>'} is not derived from 'std::basic_ostream<_CharT, _Traits>' 14 | cin >> a[i] << b[i]; | ^ In file included from /usr/include/c++/14/istream:41, from /usr/include/c++/14/sstream:40, from /usr/include/c++/14/complex:45, from /usr/include/c++/14/ccomplex:39, from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:127: /usr/include/c++/14/ostream:563:5: note: candidate: 'template<class _CharT, class _Traits> std::basic_ostream<_CharT, _Traits>& std::operator<<(basic_ostream<_CharT, _Traits>&, _CharT)' 563 | operator<<(basic_ostream<_CharT, _Traits>& __out, _CharT __c) | ^~~~~~~~ /usr/include/c++/14/ostream:563:5: note: template argument deduction/substitution failed: a.cc:14:27: note: 'std::basic_istream<char>::__istream_type' {aka 'std::basic_istream<char>'} is not derived from 'std::basic_ostream<_CharT, _Traits>' 14 | cin >> a[i] << b[i]; | ^ /usr/include/c++/14/ostream:573:5: note: candidate: 'template<class _CharT, class _Traits> std::basic_ostream<_CharT, _Traits>& std::operator<<(basic_ostream<_CharT, _Traits>&, char)' 573 | operator<<(basic_ostream<_CharT, _Traits>& __out, char __c) | ^~~~~~~~ /usr/include/c++/14/ostream:573:5: note: template argument deduction/substitution failed: a.cc:14:27: note: 'std::basic_istream<char>::__istream_type' {aka 'std::basic_istream<char>'} is not derived from 'std::basic_ostream<_CharT, _Traits>' 14 | cin >> a[i] << b[i]; | ^ /usr/include/c++/14/ostream:579:5: note: candidate: 'template<class _Traits> std::basic_ostream<char, _Traits>& std::operator<<(basic_ostream<char, _Traits>&, char)' 579 | operator<<(basic_ostream<char, _Traits>& __out, char __c) | ^~~~~~~~ /usr/include/c++/14/ostream:579:5: note: template argument deduction/substitution failed: a.cc:14:27: note: 'std::basic_istream<char>::__istream_type' {aka 'std::basic_istream<char>'} is not derived from 'std::basic_ostream<char, _Traits>' 14 | cin >> a[i] << b[i]; | ^ /usr/include/c++/14/ostream:590:5: note: candidate: 'template<class _Traits> std::basic_ostream<char, _Traits>& std::operator<<(basic_ostream<char, _Traits>&, signed char)' 590 | operator<<(basic_ostream<char, _Traits>& __out, signed char __c) | ^~~~~~~~ /usr/include/c++/14/ostream:590:5: note: template argument deduction/substitution failed: a.cc:14:27: note: 'std::basic_istream<char>::__istream_type' {aka 'std::basic_istream<char>'} is not derived from 'std::basic_ostream<char, _Traits>' 14 | cin >> a[i] << b[i]; | ^ /usr/include/c++/14/ostream:595:5: note: candidate: 'template<class _Traits> std::basic_ostream<char, _Traits>& std::operator<<(basic_ostream<char, _Traits>&, unsigned char)' 595 | operator<<(basic_ostream<char, _Traits>& __out, unsigned char __c) | ^~~~~~~~ /usr/include/c++/14/ostream:595:5: note: template argument deduction/substitution failed: a.cc:14:27: note: 'std::basic_istream<char>::__istream_type' {aka 'std::basic_istream<char>'} is not derived from 'std::basic_ostream<char, _Traits>' 14 | cin >> a[i] << b[i]; | ^ /usr/include/c++/14/ostream:654:5: note: candidate: 'template<class _CharT, class _Traits> std::basic_ostream<_CharT, _Traits>& std::operator<<(basic_ostream<_CharT, _Traits>&, const _CharT*)' 654 | operator<<(basic_ostream<_CharT, _Traits>& __out, const _CharT* __s) | ^~~~~~~~ /usr/include/c++/14/ostream:654:5: note: template argument deduction/substitution failed: a.cc:14:27: note: 'std::basic_istream<char>::__istream_type' {aka 'std::basic_istream<char>'} is not derived from 'std::basic_ostream<_CharT, _Traits>' 14 | cin >> a[i] << b[i]; | ^ In file included from /usr/include/c++/14/ostream:1022: /usr/include/c++/14/bits/ostream.tcc:307:5: note: candidate: 'template<class _CharT, class _Traits> std::basic_ostream<_CharT, _Traits>& std::operator<<(ba
s732435233
p03821
C++
#include<bits/stdc++.h> using namespace std; int main(){ ll n,c=0; cin>>n; ll a[n],b[n]; for(int i=0;i<n;i++){ cin>>a[i]>>b[i]; } for(int i=n-1;i>=0;i--){ a[i]+=c; if(a[i]%b[i]!=0) c+=b[i]-(a[i]%b[i]); } cout<<c; }
a.cc: In function 'int main()': a.cc:4:3: error: 'll' was not declared in this scope 4 | ll n,c=0; | ^~ a.cc:5:8: error: 'n' was not declared in this scope; did you mean 'yn'? 5 | cin>>n; | ^ | yn a.cc:6:5: error: expected ';' before 'a' 6 | ll a[n],b[n]; | ^~ | ; a.cc:8:10: error: 'a' was not declared in this scope 8 | cin>>a[i]>>b[i]; | ^ a.cc:8:16: error: 'b' was not declared in this scope 8 | cin>>a[i]>>b[i]; | ^ a.cc:11:5: error: 'a' was not declared in this scope 11 | a[i]+=c; | ^ a.cc:11:11: error: 'c' was not declared in this scope 11 | a[i]+=c; | ^ a.cc:12:13: error: 'b' was not declared in this scope 12 | if(a[i]%b[i]!=0) | ^ a.cc:15:9: error: 'c' was not declared in this scope 15 | cout<<c; | ^
s017628821
p03821
C++
#include <bits/stdc++.h> using namespace std; const int N=100005; int read(){ int x=0,f=1; char ch=getchar(); while (!isdigit(ch)&&ch!='-') ch=getchar(); if (ch=='-') f=-1,ch=getchar(); while (isdigit(ch)) x=(x<<1)+(x<<3)+(ch^48),ch=getchar(); return x*f; } int n; vector <int> e[N]; int Log[N],ans=0; int f[N]; void solve(){ int l=0; for (auto y : e[x]) if (y!=pre){ } } int main(){ n=read(); for (int i=1;i<=n;i++) e[i].clear(); for (int i=1;i<=n;i++){ int a=read(),b=read(); e[a].push_back(b); e[b].push_back(a); } Log[1]=0; for (int i=2;i<=n;i++) Log[i]=Log[i>>1]+1; solve(); cout << ans; return 0; }
a.cc: In function 'void solve()': a.cc:21:25: error: 'x' was not declared in this scope 21 | for (auto y : e[x]) | ^ a.cc:22:24: error: 'pre' was not declared in this scope; did you mean 'pread'? 22 | if (y!=pre){ | ^~~ | pread
s051359166
p03821
C++
#include<iostream> using namespace std; int main() { int n; cin >> n; int a[n],b[n]; for (int i = 0; i < n; i++){ cin >> a[i] >> b[i]; } long long ans=0; long long aa; for (int i = n - 1; i >= 0; i--) { aa = a[i] + ans; if (&& aa % b[i] == 0) continue; if (aa > b[i]) { ans+=b[i] * (aa / b[i] + 1) - aa; } else { ans += b[i] - aa; } } cout << ans << "\n"; return 0; }
a.cc: In function 'int main()': a.cc:17:27: error: invalid operands of types 'void*' and 'int' to binary 'operator%' 17 | if (&& aa % b[i] == 0) continue; | ~~~~~ ^ ~~~~ | | | | void* int a.cc:17:24: error: label 'aa' used but not defined 17 | if (&& aa % b[i] == 0) continue; | ^~
s026113087
p03821
C++
#include <bits/stdc++.h> #define REP(i,n) for(int i=0;i<n;i++) #define FOR(i,m,n) for(int i=m;i<n;i++) #define FORR(i,m,n) for(int i=m;i>=n;i--) #define pb(x) push_back(x) #define SORT(x) sort((x).begin(),(x).end()) #define INF 999999999999 using namespace std; #define int long long int n; vector<int> a, b, c; int dfs(int u, int ret){ if(u==n){ return ret; } for(int i=0; i<INF; i++){ if(ret>=(c[u]+b[u]*i)){ //cout << u << " " << i << endl; int x=dfs(u+1, c[u]+b[u]*i); if(x!=-1){ if(u==0) return (c[u]+b[u]*i); return m[make_pair(u, ret)]=x; } } else return -1; } } int32_t main(){ cin >> n; REP(i, n){ int x, y; cin >> x >> y; a.pb(x); b.pb(y); } REP(i, n){ c.pb(b[i]-(a[i]%b[i])); } cout << dfs(0, INF) << endl; }
a.cc: In function 'long long int dfs(long long int, long long int)': a.cc:28:40: error: 'm' was not declared in this scope 28 | return m[make_pair(u, ret)]=x; | ^
s411326537
p03821
C++
#include <bits/stdc++.h> using namespace std; int a[10005], b[10005]; int main() { int n, ans = 0; scanf("%d", &n); for (int i = 1; i <= n; i++) scanf("%d %d", &a[i], &b[i]); for (int i = n; i >= 1; i--) { if ((a[i] + ans) % b[i] > 0) { ans = ans + b[i] - r; } } printf("%d", ans); return 0; }
a.cc: In function 'int main()': a.cc:13:32: error: 'r' was not declared in this scope 13 | ans = ans + b[i] - r; } } | ^
s755135839
p03821
C
#include <stdio.h> int main() { int n,a[100000],b[100000],i; long long c=0; scanf("%d",&n); for (i=0;i<n;i++) { scanf("%d %d",&a[i],&b[i]); } for (i=0;i<n;i++) { c+=(b[n-i-1]-(a[n-i-1]+c)%b[n-i-1])%b[n-i-1]; if (a[n-i-1]==0) { c+=b[n-i-1] } } printf("%lld\n",c); return 0; }
main.c: In function 'main': main.c:12:18: error: expected ';' before '}' token 12 | c+=b[n-i-1] | ^ | ; 13 | } | ~
s610664158
p03821
C
#include <stdio.h> int main() { int n,a[100000],b[100000],i; long long c=0; scanf("%d",&n); for (i=0;i<n;i++) { scanf("%d %d",&a[i],&b[i]); } for (i=0;i<n;i++) { c+=(b[n-i-1]-(a[n-i-1]+c)%b[n-i-1])%b[n-i-1]; if (a[n-i-1]==0) { c+=b[n-i-1] } } printf("%d\n",c); return 0; }
main.c: In function 'main': main.c:12:18: error: expected ';' before '}' token 12 | c+=b[n-i-1] | ^ | ; 13 | } | ~
s533936227
p03821
C++
#include<cstdio> #include<iostream> #include<cstring> #include<cmath> #include<algorithm> #define N 10005 #define INF 111111 using namespace std; int a[1e5+5],b[1e5+5]; long long ans=0; inline long long read() { int x=0,f=1;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();} return x*f; } int main(){ int i; int n; /*scanf("%d",&n); for(i=0;i<n;i++){ scanf("%d %d",&a[i],&b[i]); } */ //freopen(".in","r",stdin); //freopen(".out","w",stdout); //int n; n=read(); for(i=0;i<n;i++){ a[i]=read(); b[i]=read(); } for(i=n-1;i+1;i--) ans=ans+(b[i]-(a[i]+ans)%b[i])%b[i]; //ans=b[i]-(a[i]+ans); //ans=ans%b[i]; //ans=ans+(ans%b[i]); printf("%lld\n",ans); //while(1); return 0; }
a.cc:10:10: error: conversion from 'double' to 'long unsigned int' in a converted constant expression 10 | int a[1e5+5],b[1e5+5]; | ~~~^~ a.cc:10:10: error: could not convert '(1.0e+5 + (double)5)' from 'double' to 'long unsigned int' 10 | int a[1e5+5],b[1e5+5]; | ~~~^~ | | | double a.cc:10:10: error: size of array 'a' has non-integral type 'double' a.cc:10:19: error: conversion from 'double' to 'long unsigned int' in a converted constant expression 10 | int a[1e5+5],b[1e5+5]; | ~~~^~ a.cc:10:19: error: could not convert '(1.0e+5 + (double)5)' from 'double' to 'long unsigned int' 10 | int a[1e5+5],b[1e5+5]; | ~~~^~ | | | double a.cc:10:19: error: size of array 'b' has non-integral type 'double'
s754511832
p03821
C++
#include<cstdio> #include<iostream> #include<cstring> #include<cmath> #include<algorithm> #define N 10005 #define INF 111111 using namespace std; int a[1e+5],b[1e+5]; long long ans=0; inline long long read() { int x=0,f=1;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();} return x*f; } int main(){ int i; int n; /*scanf("%d",&n); for(i=0;i<n;i++){ scanf("%d %d",&a[i],&b[i]); } */ //freopen(".in","r",stdin); //freopen(".out","w",stdout); //int n; n=read(); for(i=0;i<n;i++){ a[i]=read(); b[i]=read(); } for(i=n-1;i+1;i--) ans=ans+(b[i]-(a[i]+ans)%b[i])%b[i]; //ans=b[i]-(a[i]+ans); //ans=ans%b[i]; //ans=ans+(ans%b[i]); printf("%lld\n",ans); //while(1); return 0; }
a.cc:10:7: error: conversion from 'double' to 'long unsigned int' in a converted constant expression 10 | int a[1e+5],b[1e+5]; | ^~~~ a.cc:10:7: error: could not convert '1.0e+5' from 'double' to 'long unsigned int' 10 | int a[1e+5],b[1e+5]; | ^~~~ | | | double a.cc:10:7: error: size of array 'a' has non-integral type 'double' a.cc:10:15: error: conversion from 'double' to 'long unsigned int' in a converted constant expression 10 | int a[1e+5],b[1e+5]; | ^~~~ a.cc:10:15: error: could not convert '1.0e+5' from 'double' to 'long unsigned int' 10 | int a[1e+5],b[1e+5]; | ^~~~ | | | double a.cc:10:15: error: size of array 'b' has non-integral type 'double'
s769421580
p03821
C++
n = input() a = [map(int, raw_input().strip().split()) for i in range(n)] a.reverse() s = 0 for i in range(n): u, v = a[i] u += s s += (v - u % v) % v print s
a.cc:1:1: error: 'n' does not name a type 1 | n = input() | ^
s374266565
p03821
C++
// clang-format off #include <bits/stdc++.h> #define int long long int #define main signed main() #define bye return 0 #define rep(i, n) for (int i = 0; i < (n); i++) #define each(p, v) for (auto p = (v).begin(); p != (v).end(); p++) #define all(v) (v).begin(), (v).end() #define prec(n) fixed << setprecision(n) #define exact(x) { return (x); } #define sum(v) accumulate(all(v), 0) #define stlice(s, l) substr(s, (s) + (l) + 1) #define odd(n) ((n) % 2) #define even(n) (!((n) % 2)) #define INF 1e9 #define MOD (1e9 + 7) #define pb push_back #define mt make_tuple #define fi first #define se second #define str string #define vi vector<int> #define vb vector<bool> #define vc vector<char> #define vs vector<str> using namespace std; // clang-format on main { int n; cin >> n; int a[n], b[n]; rep(i, n) cin >> a[i] >> b[i]; int c = 0; rep(i, n) { int p = a[n - 1 - i], q = b[n - 1 - i]; c += (q - (p + c) % q) % q } cout << c << endl; bye; }
a.cc: In function 'int main()': a.cc:44:31: error: expected ';' before '}' token 44 | c += (q - (p + c) % q) % q | ^ | ; 45 | } | ~
s741278465
p03821
C++
#include <cstdio> #include <map> #include <vector> #include <cmath> using namespace std; #define sz(x) (int)((x).size(x)) #define ARRAY_LENGTH(array) (sizeof(array) / sizeof(array[0])) #define all(x) (x).begin(), (x).end() #define sci(x) int x; scanf("%d", &x); #define scii(x, y) int x, y; scanf("%d %d", &x, &y); #define sciii(x, y, z) int x, y, z; scanf("%d %d %d", &x, &y, &z); #define debug(x) { cerr << #x << " = " << x << endl; } #define REP(i, y) for (__typeof(x) i = 0; i < y; i++) #define REPI(i, y) for (__typeof(x) i = y; i > 0; i--) typedef long long ll; typedef pair<int, int> P; typedef pair<P, int> PP; typedef vector<int> VV; typedef vector<P> VVP; typedef vector<PP> VVPP; const int INF = 2<<20; const double EPS = 1E-8; const int MAX_N = 100001; int main() { sci(N); long long A[MAX_N]; long long B[MAX_N]; long long update=0; for (int i=0; i<N; i++) { sci(a); sci(b); A[i] = a; B[i] = b; } for (int i=N-1; i>=0; i--) { int k=1; //if(A[i]==0) { // continue; //} //while(k*B[i] < (A[i]+update)) k++; //int k = (A[i]+update)/B[i]; //k++; //update += k*B[i] - (A[i]+update); A[i] += update; update += (B[i] - A[i] % B[i]) % B[i]; } cout<<update<<endl; }
a.cc: In function 'int main()': a.cc:48:3: error: 'cout' was not declared in this scope 48 | cout<<update<<endl; | ^~~~ a.cc:5:1: note: 'std::cout' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>' 4 | #include <cmath> +++ |+#include <iostream> 5 | a.cc:48:17: error: 'endl' was not declared in this scope 48 | cout<<update<<endl; | ^~~~ a.cc:5:1: note: 'std::endl' is defined in header '<ostream>'; this is probably fixable by adding '#include <ostream>' 4 | #include <cmath> +++ |+#include <ostream> 5 |
s450166310
p03821
C++
#include <cstdio> #include <map> #include <vector> #include <cmath> using namespace std; #define sz(x) (int)((x).size(x)) #define ARRAY_LENGTH(array) (sizeof(array) / sizeof(array[0])) #define all(x) (x).begin(), (x).end() #define sci(x) int x; scanf("%d", &x); #define scii(x, y) int x, y; scanf("%d %d", &x, &y); #define sciii(x, y, z) int x, y, z; scanf("%d %d %d", &x, &y, &z); #define debug(x) { cerr << #x << " = " << x << endl; } #define REP(i, y) for (__typeof(x) i = 0; i < y; i++) #define REPI(i, y) for (__typeof(x) i = y; i > 0; i--) typedef long long ll; typedef pair<int, int> P; typedef pair<P, int> PP; typedef vector<int> VV; typedef vector<P> VVP; typedef vector<PP> VVPP; const int INF = 2<<20; const double EPS = 1E-8; const int MAX_N = 100001; int main() { sci(N); int A[MAX_N]; int B[MAX_N]; long long update=0; for (int i=0; i<N; i++) { sci(a); sci(b); A[i] = a; B[i] = b; } for (int i=N-1; i>=0; i--) { int k=1; //if(A[i]==0) { // continue; //} //while(k*B[i] < (A[i]+update)) k++; //int k = (A[i]+update)/B[i]; //k++; //update += k*B[i] - (A[i]+update); A[i] += update; update += (B[i] - A[i] % B[i]) % B[i]; } cout<<update<<endl; }
a.cc: In function 'int main()': a.cc:48:3: error: 'cout' was not declared in this scope 48 | cout<<update<<endl; | ^~~~ a.cc:5:1: note: 'std::cout' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>' 4 | #include <cmath> +++ |+#include <iostream> 5 | a.cc:48:17: error: 'endl' was not declared in this scope 48 | cout<<update<<endl; | ^~~~ a.cc:5:1: note: 'std::endl' is defined in header '<ostream>'; this is probably fixable by adding '#include <ostream>' 4 | #include <cmath> +++ |+#include <ostream> 5 |
s283085592
p03821
C++
#include <cstdio> #include <map> #include <vector> #include <cmath> using namespace std; #define sz(x) (int)((x).size(x)) #define ARRAY_LENGTH(array) (sizeof(array) / sizeof(array[0])) #define all(x) (x).begin(), (x).end() #define sci(x) int x; scanf("%d", &x); #define scii(x, y) int x, y; scanf("%d %d", &x, &y); #define sciii(x, y, z) int x, y, z; scanf("%d %d %d", &x, &y, &z); #define debug(x) { cerr << #x << " = " << x << endl; } #define REP(i, y) for (__typeof(x) i = 0; i < y; i++) #define REPI(i, y) for (__typeof(x) i = y; i > 0; i--) typedef long long ll; typedef pair<int, int> P; typedef pair<P, int> PP; typedef vector<int> VV; typedef vector<P> VVP; typedef vector<PP> VVPP; const int INF = 2<<20; const double EPS = 1E-8; const int MAX_N = 100001; int main() { sci(N); int A[MAX_N]; int B[MAX_N]; long long update=0; for (int i=0; i<N; i++) { sci(a); sci(b); A[i] = a; B[i] = b; } for (int i=N-1; i>=0; i--) { //int k=1; //while(k*B[i] < (A[i]+update)) k++; k = B[i]/(A[i]+update) + 1; update += k*B[i] - (A[i]+update); } printf("%d", update); }
a.cc: In function 'int main()': a.cc:39:7: error: 'k' was not declared in this scope 39 | k = B[i]/(A[i]+update) + 1; | ^
s181396398
p03821
C++
int main(){ llong N; llong A[100000]; llong B[100000]; llong count[100000] = {0}; llong sum = 0; llong tmp = 0; cin >> N; REP(i,N){ cin >> A[i] >> B[i]; } REPR(j,N-1){ if(B[j] >= A[j]){ count[j] = B[j] - A[j]; }else if( A[j] % B [j] == 0){ count[j] = 0; }else{ count[j] = B[j]*((A[j] / B[j]) + 1) - A[j]; } sum = sum + count[j]; tmp = count[j]; if(tmp !=0){ REP(i,j){ A[i] = A[i] + tmp; } } } cout << sum << endl; return 0; }
a.cc: In function 'int main()': a.cc:2:1: error: 'llong' was not declared in this scope; did you mean 'long'? 2 | llong N; | ^~~~~ | long a.cc:3:6: error: expected ';' before 'A' 3 | llong A[100000]; | ^~ | ; a.cc:4:6: error: expected ';' before 'B' 4 | llong B[100000]; | ^~ | ; a.cc:5:6: error: expected ';' before 'count' 5 | llong count[100000] = {0}; | ^~~~~~ | ; a.cc:6:6: error: expected ';' before 'sum' 6 | llong sum = 0; | ^~~~ | ; a.cc:7:6: error: expected ';' before 'tmp' 7 | llong tmp = 0; | ^~~~ | ; a.cc:8:1: error: 'cin' was not declared in this scope 8 | cin >> N; | ^~~ a.cc:8:8: error: 'N' was not declared in this scope 8 | cin >> N; | ^ a.cc:9:5: error: 'i' was not declared in this scope 9 | REP(i,N){ | ^ a.cc:9:1: error: 'REP' was not declared in this scope 9 | REP(i,N){ | ^~~ a.cc:12:6: error: 'j' was not declared in this scope 12 | REPR(j,N-1){ | ^ a.cc:12:1: error: 'REPR' was not declared in this scope 12 | REPR(j,N-1){ | ^~~~ a.cc:28:1: error: 'cout' was not declared in this scope 28 | cout << sum << endl; | ^~~~ a.cc:28:9: error: 'sum' was not declared in this scope 28 | cout << sum << endl; | ^~~ a.cc:28:16: error: 'endl' was not declared in this scope 28 | cout << sum << endl; | ^~~~
s717998281
p03821
C
long c;main(long a,long b){a-1?~scanf("%d%d",&a,&b)&&(main(),c=(a+c-1)/b*b+b-a):(main(gets(&a)),printf("%ld\n",c));}
main.c:1:8: error: return type defaults to 'int' [-Wimplicit-int] 1 | long c;main(long a,long b){a-1?~scanf("%d%d",&a,&b)&&(main(),c=(a+c-1)/b*b+b-a):(main(gets(&a)),printf("%ld\n",c));} | ^~~~ main.c: In function 'main': main.c:1:33: error: implicit declaration of function 'scanf' [-Wimplicit-function-declaration] 1 | long c;main(long a,long b){a-1?~scanf("%d%d",&a,&b)&&(main(),c=(a+c-1)/b*b+b-a):(main(gets(&a)),printf("%ld\n",c));} | ^~~~~ main.c:1:1: note: include '<stdio.h>' or provide a declaration of 'scanf' +++ |+#include <stdio.h> 1 | long c;main(long a,long b){a-1?~scanf("%d%d",&a,&b)&&(main(),c=(a+c-1)/b*b+b-a):(main(gets(&a)),printf("%ld\n",c));} main.c:1:33: warning: incompatible implicit declaration of built-in function 'scanf' [-Wbuiltin-declaration-mismatch] 1 | long c;main(long a,long b){a-1?~scanf("%d%d",&a,&b)&&(main(),c=(a+c-1)/b*b+b-a):(main(gets(&a)),printf("%ld\n",c));} | ^~~~~ main.c:1:33: note: include '<stdio.h>' or provide a declaration of 'scanf' main.c:1:55: error: too few arguments to function 'main' 1 | long c;main(long a,long b){a-1?~scanf("%d%d",&a,&b)&&(main(),c=(a+c-1)/b*b+b-a):(main(gets(&a)),printf("%ld\n",c));} | ^~~~ main.c:1:8: note: declared here 1 | long c;main(long a,long b){a-1?~scanf("%d%d",&a,&b)&&(main(),c=(a+c-1)/b*b+b-a):(main(gets(&a)),printf("%ld\n",c));} | ^~~~ main.c:1:87: error: implicit declaration of function 'gets' [-Wimplicit-function-declaration] 1 | long c;main(long a,long b){a-1?~scanf("%d%d",&a,&b)&&(main(),c=(a+c-1)/b*b+b-a):(main(gets(&a)),printf("%ld\n",c));} | ^~~~ main.c:1:82: error: too few arguments to function 'main' 1 | long c;main(long a,long b){a-1?~scanf("%d%d",&a,&b)&&(main(),c=(a+c-1)/b*b+b-a):(main(gets(&a)),printf("%ld\n",c));} | ^~~~ main.c:1:8: note: declared here 1 | long c;main(long a,long b){a-1?~scanf("%d%d",&a,&b)&&(main(),c=(a+c-1)/b*b+b-a):(main(gets(&a)),printf("%ld\n",c));} | ^~~~ main.c:1:97: error: implicit declaration of function 'printf' [-Wimplicit-function-declaration] 1 | long c;main(long a,long b){a-1?~scanf("%d%d",&a,&b)&&(main(),c=(a+c-1)/b*b+b-a):(main(gets(&a)),printf("%ld\n",c));} | ^~~~~~ main.c:1:97: note: include '<stdio.h>' or provide a declaration of 'printf' main.c:1:97: warning: incompatible implicit declaration of built-in function 'printf' [-Wbuiltin-declaration-mismatch] main.c:1:97: note: include '<stdio.h>' or provide a declaration of 'printf'
s473343988
p03821
C++
/*-****************************************-*/ #define USE_CPP11 #define _CRT_SECURE_NO_WARNINGS #include <iostream> #include <iomanip> #include <string> #include <sstream> #include <vector> #include <list> #include <stack> #include <queue> #include <deque> #include <set> #include <map> #include <bitset> #ifdef USE_CPP11 # include <unordered_set> # include <unordered_map> # include <array> # include <valarray> #endif // USE_CPP11 #include <algorithm> #include <functional> #include <numeric> #include <utility> #include <cstdio> #include <cstdlib> #include <cmath> #include <cctype> #include <cstring> #include <ctime> #include <climits> #include <cassert> using namespace std; /*-****************************************-*/ typedef pair<int, int> pii; typedef long long ll; /*-****************************************-*/ #define mp make_pair #define sz_array(a) (sizeof(a) / sizeof((a)[0])) #define all(a) (a).begin(),(a).end() #define r_all(a) (a).rbegin(), (a).rend() #define exists(container, elem) ((container).find(elem) != (container).end()) /*-****************************************-*/ template<typename T> T MinAssign(T &a, T b) { if (a > b) a = b; return a; } template<typename T> T MaxAssign(T &a, T b) { if (a < b) a = b; return a; } template<typename T, size_t size> void Fill(void *ptr, T value) { fill((T *)ptr, (T *)ptr + size / sizeof(T), value); } /*-****************************************-*/ static const double EPS = 1e-10; static const double PI = acos(-1.0); static const int INF = 1 << 28; /*-****************************************-*/ #ifdef DEBUG #define ANSWER_PREFIX() cout << "[[ Answer ]] " #else #define ANSWER_PREFIX() #endif // DEBUG /*-****************************************-*/ ////////////////////////////////////////////////// ////////////////////////////////////////////////// ////////////////////////////////////////////////// constexpr int MaxN = 100000 + 10; int n; ll A[MaxN], B[MaxN]; ll main() { cin >> n; for (size_t i = 0; i < n; i++) { cin >> A[i] >> B[i]; } ll ans = 0; for (ll i = n - 1; i >= 0; i--) { ll add = B[i] - (A[i] + ans) % B[i]; if (add == B[i]) { add = 0; } ans += add; } ANSWER_PREFIX(); cout << ans << endl; }
a.cc:101:1: error: '::main' must return 'int' 101 | ll main() { | ^~
s106687511
p03821
C++
use std::io::{self, Stdin}; use std::str::{self, FromStr}; use std::error::Error; use std::thread; fn exec() { let mut sc = Scanner::new(); let n: usize = sc.ne(); let mut a = vec![0; n]; let mut b = vec![0; n]; for i in 0..n { a[i] = sc.ne(); b[i] = sc.ne(); } let mut cur = 0; for i in (0..n).rev() { let x = a[i] + cur; cur += b[i] - if x % b[i] == 0 { b[i] } else { x % b[i] }; } println!("{}", cur); } const DEFAULT_STACK: usize = 16 * 1024 * 1024; fn main() { let builder = thread::Builder::new(); let th = builder.stack_size(DEFAULT_STACK); let handle = th.spawn(|| { exec(); }).unwrap(); let _ = handle.join(); } #[allow(dead_code)] struct Scanner { stdin: Stdin, id: usize, buf: Vec<u8>, } #[allow(dead_code)] impl Scanner { fn new() -> Scanner { Scanner { stdin: io::stdin(), id: 0, buf: Vec::new(), } } fn next_line(&mut self) -> Option<String> { let mut res = String::new(); match self.stdin.read_line(&mut res) { Ok(0) => return None, Ok(_) => Some(res), Err(why) => panic!("error in read_line: {}", why.description()), } } fn next<T: FromStr>(&mut self) -> Option<T> { while self.buf.len() == 0 { self.buf = match self.next_line() { Some(r) => { self.id = 0; r.trim().as_bytes().to_owned() } None => return None, }; } let l = self.id; assert!(self.buf[l] != b' '); let n = self.buf.len(); let mut r = l; while r < n && self.buf[r] != b' ' { r += 1; } let res = match str::from_utf8(&self.buf[l..r]).ok().unwrap().parse::<T>() { Ok(s) => Some(s), Err(_) => panic!("parse error"), }; while r < n && self.buf[r] == b' ' { r += 1; } if r == n { self.buf.clear(); } else { self.id = r; } res } fn ne<T: FromStr>(&mut self) -> T { self.next::<T>().unwrap() } }
a.cc:10:14: error: too many decimal points in number 10 | for i in 0..n { | ^~~~ a.cc:15:15: error: too many decimal points in number 15 | for i in (0..n).rev() { | ^~~~ a.cc:29:2: error: invalid preprocessing directive #[ 29 | #[allow(dead_code)] | ^ a.cc:36:2: error: invalid preprocessing directive #[ 36 | #[allow(dead_code)] | ^ a.cc:1:1: error: 'use' does not name a type 1 | use std::io::{self, Stdin}; | ^~~ a.cc:2:1: error: 'use' does not name a type 2 | use std::str::{self, FromStr}; | ^~~ a.cc:3:1: error: 'use' does not name a type 3 | use std::error::Error; | ^~~ a.cc:4:1: error: 'use' does not name a type 4 | use std::thread; | ^~~ a.cc:5:1: error: 'fn' does not name a type 5 | fn exec() { | ^~ a.cc:21:20: error: found ':' in nested-name-specifier, expected '::' 21 | const DEFAULT_STACK: usize = 16 * 1024 * 1024; | ^ | :: a.cc:21:7: error: 'DEFAULT_STACK' does not name a type 21 | const DEFAULT_STACK: usize = 16 * 1024 * 1024; | ^~~~~~~~~~~~~ a.cc:22:1: error: 'fn' does not name a type 22 | fn main() { | ^~ a.cc:31:5: error: 'stdin' does not name a type 31 | stdin: Stdin, | ^~~~~ a.cc:1:1: note: 'stdin' is defined in header '<cstdio>'; this is probably fixable by adding '#include <cstdio>' +++ |+#include <cstdio> 1 | use std::io::{self, Stdin}; a.cc:37:6: error: expected initializer before 'Scanner' 37 | impl Scanner { | ^~~~~~~
s706126823
p03821
C++
#include <iostream> using namespace std; int main(){ int n; int a[100000], b[100000]; for(int i = 0; i < n; i++){ cin >> a[i] >> b[i]; } int cnt = 0; for(int i = n - 1; i >= 0 n; i--){ while(a[i] % b[i] != 0){ for(int j = 0; j <= i; j++){ a[j]++; } cnt++; } } cout << cnt; return 0; }
a.cc: In function 'int main()': a.cc:13:34: error: expected ';' before 'n' 13 | for(int i = n - 1; i >= 0 n; i--){ | ^~ | ; a.cc:13:36: error: expected ')' before ';' token 13 | for(int i = n - 1; i >= 0 n; i--){ | ~ ^ | ) a.cc:13:38: error: 'i' was not declared in this scope 13 | for(int i = n - 1; i >= 0 n; i--){ | ^
s222851836
p03821
Java
import java.util.*; public class Main{ public static void main(String[] args){ Scanner sc = new Scanner(System.in); int n = sc.nextInt(); long[] a=new long[n]; long[] b=new long[n]; long ans=0; for(int i=0; i<n; i++){ a[i] = Long.parseLong(sc.next()); b[i] = Long.parseLong(sc.next()); } for(int i=n-1;i>=0;i--){ a[i] += ans; ans += (a[i]+b[i]-1)/b[i]*b[i]-a[i]; } } System.out.println(ans); return; } }
Main.java:21: error: <identifier> expected System.out.println(ans); ^ Main.java:21: error: <identifier> expected System.out.println(ans); ^ Main.java:22: error: illegal start of type return; ^ Main.java:24: error: class, interface, enum, or record expected } ^ 4 errors
s653000956
p03821
C++
#include <iostream> #include <vector> #include <cstdint> using namespace std; int main() { ios::sync_with?stdio(false); cin.tie(0); int_least32_t n; cin >> n; vector<int_least32_t> a( n ), b( n ); for(auto i = 0; i < n; ++i) { cin >> a[i] >> b[i]; } int_fast32_t count{ 0 }, temp; for(auto i = n - 1; i >= 0; --i) { temp = (count + a[i]) % b[i]; if(temp == 0) { continue; } count += b[i] - temp; } cout << count << endl; }
a.cc: In function 'int main()': a.cc:9:14: error: 'sync_with' is not a member of 'std::ios' {aka 'std::basic_ios<char>'} 9 | ios::sync_with?stdio(false); | ^~~~~~~~~ a.cc:9:24: error: 'stdio' was not declared in this scope; did you mean 'stdin'? 9 | ios::sync_with?stdio(false); | ^~~~~ | stdin a.cc:9:36: error: expected ':' before ';' token 9 | ios::sync_with?stdio(false); | ^ | : a.cc:9:36: error: expected primary-expression before ';' token
s256956522
p03821
C++
#include<stdio.h> void addNum(int* a, int i, int plus) { while (i > 0){ a[i - 1] += plus; i--; } } int main() { int pushCount = 0; int n; scanf_s("%d", &n); int a[100000]; int b[100000]; for (int i = 0; i < n; i++) { scanf_s("%d%d", &a[i], &b[i]); } for (int i = n - 1; i >= 0; i--) { int plus = 0; if ((a[i] + pushCount) % b[i] == 0) continue; plus = b[i] * ((a[i] + pushCount) / b[i] + 1) - (a[i] + pushCount); pushCount += plus; } printf("%d", pushCount); scanf_s("%d", &n); }
a.cc: In function 'int main()': a.cc:15:9: error: 'scanf_s' was not declared in this scope; did you mean 'scanf'? 15 | scanf_s("%d", &n); | ^~~~~~~ | scanf
s783283971
p03821
C++
#include<stdio.h> void addNum(int* a, int i) { while (i > 0){ a[i - 1]++; i--; } } int main() { int pushCount = 0; int n; scanf_s("%d", &n); int* a = new int[n]; int* b = new int[n]; for (int i = 0; i < n; i++) { scanf_s("%d%d", &a[i], &b[i]); } for (int i = n - 1; i >= 0; i--) { while (a[i] % b[i] != 0) { addNum(a, n); pushCount++; } } printf("%d", pushCount); }
a.cc: In function 'int main()': a.cc:14:9: error: 'scanf_s' was not declared in this scope; did you mean 'scanf'? 14 | scanf_s("%d", &n); | ^~~~~~~ | scanf
s762553489
p03821
Java
import java.util.Scanner; public class AtCorer1Main { public static void main(String[] args) { // TODO 自動生成されたメソッド・スタブ int cnt = 0; int ans = 0; // 入力処理 Scanner inData = new Scanner(System.in); int len = inData.nextInt(); int a[] = new int[len]; int b[] = new int[len]; for(cnt = (len - 1); cnt >= 0; cnt--){ a[cnt] = inData.nextInt(); b[cnt] = inData.nextInt(); } // 計算処理 for(cnt = 0; cnt < len; cnt++){ while(0 != (a[cnt] % b[cnt])){ for(int add = 0; add < len; add++){ a[add]++; } ans++; } } System.out.println(ans); } }
Main.java:3: error: class AtCorer1Main is public, should be declared in a file named AtCorer1Main.java public class AtCorer1Main { ^ 1 error
s355722581
p03821
Java
package AtCorder1; import java.util.Scanner; public class AtCorer1Main { public static void main(String[] args) { // TODO 自動生成されたメソッド・スタブ int cnt = 0; int ans = 0; // 入力処理 Scanner inData = new Scanner(System.in); int len = inData.nextInt(); int a[] = new int[len]; int b[] = new int[len]; for(cnt = (len - 1); cnt >= 0; cnt--){ a[cnt] = inData.nextInt(); b[cnt] = inData.nextInt(); } // 計算処理 for(cnt = 0; cnt < len; cnt++){ while(0 != (a[cnt] % b[cnt])){ for(int add = 0; add < len; add++){ a[add]++; } ans++; } } System.out.println(ans); } }
Main.java:5: error: class AtCorer1Main is public, should be declared in a file named AtCorer1Main.java public class AtCorer1Main { ^ 1 error
s331259470
p03821
C++
#include <iostream> #define int long long using namespace std; const int MAX_N = 100000; int main() { int N, a[MAX_N], b[MAX_N]; int ret = 0; scanf("%d", &N); for (int i = 0; i < N; i++) { scanf("%d %d", &a[i], &b[i]); } for (int i = N - 1; i >= 0; i--) { int ii = a[i] + ret; if (ii == 0) continue; int iii = ii % b[i]; if (iii == 0) continue; if (ii > b[i]) { ret += (b[i] - iii); } else if (ii < b[i]) { ret += (b[i] - ii); } } cout << ret <<endl; return 0; }
cc1plus: error: '::main' must return 'int'
s774072011
p03821
C++
#include <iostream> #include <cstdio> #include <cstring> #include <cstdlib> #include <algorithm> #include <vector> #define rep(i, n) for (int i = 0; i < n; ++i) #define REP(i, m, n) for (int i = m, i < n; ++i) #define INF 1000 * 1000 typedef long long ll; using namespace std; int main() { ll c; ll n; cin >> n; vector<ll> a(n); vector<ll> b(n); rep(i, n) cin >> a[i] >> b[i]; ll count = 0; for (int i = n - 1; i >= 0; --i) { ll x = (count + a[i]) % b[i]; if (x > 0) count += b[i] - x; cout << count << endl; return 0; }
a.cc: In function 'int main()': a.cc:40:2: error: expected '}' at end of input 40 | } | ^ a.cc:17:12: note: to match this '{' 17 | int main() { | ^
s125398158
p03821
C++
#include <iostream> #include <time.h> #include <vector> #include <stdio.h> #include <memory.h> #include <string> #include <map> #include <algorithm> #include <bitset> #include <queue> #include <set> #include <time.h> #include <assert.h> #include <sstream> //#include <unordered_map> #include <bitset> #include <utility> #include <iomanip> #include <climits> #include <cstdio> #include <cstdlib> #include <ctime> #include <cmath> #include <math.h> #ifndef ONLINE_JUDGE #include "inc.h" #endif using namespace std; typedef long long ll; ll n,a[100010],b[100010]; int main() { #if !ONLINE_JUDGE freopen("a.txt", "r", stdin); //freopen("b.txt", "w", stdout); decTime; #endif ll ans=0; scanf("%lld",&n); for(int i=0;i<n;++i) scanf("%lld%lld",a+i,b+i); ll cnt=0; for(int i=n-1;i>=0;--i){ a[i]+=cnt; if(b[i]==1) continue; if(a[i]>b[i]){ cnt+=b[i]-a[i]%b[i]; ans+=b[i]-a[i]%b[i]; }else{ cnt+=b[i]-a[i]; ans+=b[i]-a[i]; } } printf("%lld",ans); #if !ONLINE_JUDGE printTime; #endif return 0; }
a.cc:26:10: fatal error: inc.h: No such file or directory 26 | #include "inc.h" | ^~~~~~~ compilation terminated.
s230678653
p03821
C++
#include <iostream> #include <time.h> #include <vector> #include <stdio.h> #include <memory.h> #include <string> #include <map> #include <algorithm> #include <bitset> #include <queue> #include <set> #include <time.h> #include <assert.h> #include <sstream> //#include <unordered_map> #include <bitset> #include <utility> #include <iomanip> #include <climits> #include <cstdio> #include <cstdlib> #include <ctime> #include <cmath> #include <math.h> #if !ONLINE_JUDGE #include "inc.h" #endif using namespace std; typedef long long ll; ll n,a[100010],b[100010]; int main() { #if !ONLINE_JUDGE freopen("a.txt", "r", stdin); //freopen("b.txt", "w", stdout); decTime; #endif ll ans=0; scanf("%lld",&n); for(int i=0;i<n;++i) scanf("%lld%lld",a+i,b+i); ll cnt=0; for(int i=n-1;i>=0;--i){ a[i]+=cnt; if(b[i]==1) continue; if(a[i]>b[i]){ cnt+=b[i]-a[i]%b[i]; ans+=b[i]-a[i]%b[i]; }else{ cnt+=b[i]-a[i]; ans+=b[i]-a[i]; } } printf("%lld",ans); #if !ONLINE_JUDGE printTime; #endif return 0; }
a.cc:26:10: fatal error: inc.h: No such file or directory 26 | #include "inc.h" | ^~~~~~~ compilation terminated.