submission_id
stringlengths
10
10
problem_id
stringlengths
6
6
language
stringclasses
3 values
code
stringlengths
1
522k
compiler_output
stringlengths
43
10.2k
s989489641
p03712
C
#include<stdio.h> #include<string.h> int main() { int r,a,b,c,h,i,k,t; char ch[20]; while(scanf("%d%d",&a,&b)!=EOF) { getchar(); t=1; printf("#"); for(i=1;i<=b;i++) printf("#"); printf("#\n"); t=1; for(i=1;i<=a;i++) { printf("#"); scanf("%s",&ch); printf("%s",ch); printf("#\n"); } for(i=0;i<=b;i++) printf("#"); printf("#\n"); } ret
main.c: In function 'main': main.c:27:9: error: 'ret' undeclared (first use in this function) 27 | ret | ^~~ main.c:27:9: note: each undeclared identifier is reported only once for each function it appears in main.c:27:12: error: expected ';' at end of input 27 | ret | ^ | ; main.c:27:9: error: expected declaration or statement at end of input 27 | ret | ^~~
s152422817
p03712
C
#include<stdio.h> #include<String.h> int main() { int r,a,b,c,h,i,k,t; char ch[20]; while(scanf("%d%d",&a,&b)!=EOF) { getchar(); t=1; printf("#"); for(i=1;i<=b;i++) printf("#"); printf("#\n"); t=1; for(i=1;i<=a;i++) { printf("#"); scanf("%s",&ch); printf("%s",ch); printf("#\n"); } for(i=0;i<=b;i++) printf("#"); printf("#\n"); } return 0; }
main.c:2:9: fatal error: String.h: No such file or directory 2 | #include<String.h> | ^~~~~~~~~~ compilation terminated.
s180052549
p03712
C
#include<stdio.h> #include<String.h> int main() { int r,a,b,c,h,i,k,t; char ch[20]; while(scanf("%d%d",&a,&b)!=EOF) { getchar(); t=1; printf("#"); for(i=1;i<=b;i++) printf("#"); printf("#\n"); t=1; for(i=1;i<=a;i++) { printf("#"); scanf("%s",&ch; printf("%s",ch); printf("#\n"); } for(i=0;i<=b;i++) printf("#"); printf("#\n"); } return 0; }
main.c:2:9: fatal error: String.h: No such file or directory 2 | #include<String.h> | ^~~~~~~~~~ compilation terminated.
s840662166
p03712
C
#include<stdio.h>char a[10000][10000];int main (){ int h,w,i,j; scanf("%d%d",&h,&w); for(i=0;i<h;i++) { scanf("%s",&a[i]); } for(i=0;i<w+1;i++) { printf("#"); } printf("#\n"); for(i=0;i<h;i++) { printf("#"); for(j=0;j<w;j++) { printf("%c",a[i][j]); } printf("#\n"); } for(i=0;i<w+1;i++) { printf("#"); } printf("#\n"); return 0; }
main.c:1:18: warning: extra tokens at end of #include directive 1 | #include<stdio.h>char a[10000][10000];int main (){ int h,w,i,j; scanf("%d%d",&h,&w); for(i=0;i<h;i++) { scanf("%s",&a[i]); } for(i=0;i<w+1;i++) { printf("#"); } printf("#\n"); for(i=0;i<h;i++) { printf("#"); for(j=0;j<w;j++) { printf("%c",a[i][j]); } printf("#\n"); } for(i=0;i<w+1;i++) { printf("#"); } printf("#\n"); return 0; } | ^~~~ /usr/bin/ld: /usr/lib/gcc/x86_64-linux-gnu/14/../../../x86_64-linux-gnu/Scrt1.o: in function `_start': (.text+0x17): undefined reference to `main' collect2: error: ld returned 1 exit status
s891309193
p03712
C++
#include "stdafx.h" #include <algorithm> #include <iostream> #include <sstream> #include <iomanip> #include <vector> #include <string> #include <bitset> #include <cmath> #include <map> #include <set> #define pi 3.1415926 using namespace std; int main() { int ht, wd; while (cin >> ht >> wd) { vector<string> v; for (int i = 0; i < ht; i++) { string t; cin >> t; v.push_back(t); } string s = "", ans = ""; s += "#"; s += string(wd, '#'); s += "#"; s += "\n"; ans += s; for (int i = 0; i < ht; i++) { s = ""; s += "#"; s += v[i]; s += "#"; s += "\n"; ans += s; } s = ""; s += "#"; s += string(wd, '#'); s += "#"; s += "\n"; ans += s; cout << ans << flush; } return 0; }
a.cc:1:10: fatal error: stdafx.h: No such file or directory 1 | #include "stdafx.h" | ^~~~~~~~~~ compilation terminated.
s481733876
p03712
C
#include<stdio.h> #include<String.h> int main() { int r,a,b,c,h,i,k,t; char ch[20]; while(scanf("%d%d",&a,&b)!=EOF) { getchar(); t=1; for(i=1;i<=a;i++) { scanf("%s",&ch[t]); getchar(); t+=b; } printf("#"); for(i=1;i<=b;i++) printf("#"); printf("#\n"); t=1; for(i=1;i<=a;i++) { printf("#"); for(k=t;k<=(t+b-1);k++) { printf("%c",ch[k]); } t+=b; printf("#\n"); } for(i=0;i<=b;i++) printf("#"); printf("#\n"); } return 0; }
main.c:2:9: fatal error: String.h: No such file or directory 2 | #include<String.h> | ^~~~~~~~~~ compilation terminated.
s352066005
p03712
C
#include<stdio.h> #include<String.h> int main() { int r,a,b,c,h,i,k,t; char ch[20]; while(scanf("%d%d",&a,&b)!=EOF) { getchar(); t=1; for(i=1;i<=a;i++) { scanf("%s",&ch[t]); getchar(); t+=b; } printf("#"); for(i=1;i<=b;i++) printf("#"); printf("#\n"); t=1; for(i=1;i<=a;i++) { printf("#"); for(k=t;k<=(t+b-1);k++) { printf("%c",ch[k]); } t+=b; printf("#\n"); } for(i=0;i<=b;i++) printf("#"); printf("#\n"); } return 0; }
main.c:2:9: fatal error: String.h: No such file or directory 2 | #include<String.h> | ^~~~~~~~~~ compilation terminated.
s906539126
p03712
C
#include<Stdio.h> #include<string.h> int main() { int n,m,i,v,j; while(scanf("%d%d",&n,&m)!=EOF) { char a[n+2][m+2]; v=(n+2)*(m+2); memset(a,'#',sizeof(char)*v); for(i=1;i<=n;i++) { for(j=1;j<=m;j++) { scanf("\n%c",&a[i][j]); } } for(i=0;i<n+2;i++) { for(j=0;j<m+2;j++) { printf("%c",a[i][j]); } printf("\n"); } } return 0; }
main.c:1:9: fatal error: Stdio.h: No such file or directory 1 | #include<Stdio.h> | ^~~~~~~~~ compilation terminated.
s871719157
p03712
C
#include<Stdio.h> #include<string.h> int main() { int n,m,i,v,j; while(scanf("%d%d",&n,&m)!=EOF) { char a[n+2][m+2]; v=(n+2)*(m+2); memset(a,'#',sizeof(char)*v); for(i=1;i<=n;i++) { for(j=1;j<=m;j++) { scanf("\n%c",&a[i][j]); } } for(i=0;i<n+2;i++) { for(j=0;j<m+2;j++) { printf("%c",a[i][j]); } printf("\n"); } } return 0; }
main.c:1:9: fatal error: Stdio.h: No such file or directory 1 | #include<Stdio.h> | ^~~~~~~~~ compilation terminated.
s274629396
p03712
C
#include<Stdio.h> #include<string.h> int main() { int n,m,i,v,j; while(scanf("%d%d",&n,&m)!=EOF) { char a[n+2][m+2]; v=(n+2)*(m+2); memset(a,'#',sizeof(char)*v); for(i=1;i<=n;i++) { for(j=1;j<=m;j++) { scanf("\n%c",&a[i][j]); } } for(i=0;i<n+2;i++) { for(j=0;j<m+2;j++) { printf("%c",a[i][j]); } printf("\n"); } } return 0; }
main.c:1:9: fatal error: Stdio.h: No such file or directory 1 | #include<Stdio.h> | ^~~~~~~~~ compilation terminated.
s291717359
p03712
C++
#include<Stdio.h> #include<string.h> int main() { int n,m,i,v,j; while(scanf("%d%d",&n,&m)!=EOF) { char a[n+2][m+2]; v=(n+2)*(m+2); memset(a,'#',sizeof(char)*v); for(i=1;i<=n;i++) { for(j=1;j<=m;j++) { scanf("\n%c",&a[i][j]); } } for(i=0;i<n+2;i++) { for(j=0;j<m+2;j++) { printf("%c",a[i][j]); } printf("\n"); } } return 0; }
a.cc:1:9: fatal error: Stdio.h: No such file or directory 1 | #include<Stdio.h> | ^~~~~~~~~ compilation terminated.
s919478999
p03712
C++
#include<Stdio.h> #include<string.h> int main() { int n,m,i,v,j; while(scanf("%d%d",&n,&m)!=EOF) { char a[n+2][m+2]; v=(n+2)*(m+2); memset(a,'#',sizeof(char)*v); for(i=1;i<=n;i++) { for(j=1;j<=m;j++) { scanf("\n%c",&a[i][j]); } } for(i=0;i<n+2;i++) { for(j=0;j<m+2;j++) { printf("%c",a[i][j]); } printf("\n"); } } return 0; }
a.cc:1:9: fatal error: Stdio.h: No such file or directory 1 | #include<Stdio.h> | ^~~~~~~~~ compilation terminated.
s576687389
p03712
C++
#include<stdio.h> int main() { int h,w;char a[200][105]; scanf("%d%d%*c",&h,&w); int i; for(i=0;i<h;i++) gets(a[i]); for(i=0;i<=w;i++) printf("#");printf("#\n"); for(i=0;i<h;i++) { printf("#"); printf("%s",a[i]); printf("#\n"); } for(i=0;i<=w;i++) printf("#");printf("#\n"); }
a.cc: In function 'int main()': a.cc:8:17: error: 'gets' was not declared in this scope; did you mean 'getw'? 8 | gets(a[i]); | ^~~~ | getw
s890464038
p03712
C++
#include<stdio.h> #include<String.h> int main() { int r,a,b,c,h,i,k,t; char ch[20]; while(scanf("%d%d",&a,&b)!=EOF) { getchar(); t=1; for(i=1;i<=a;i++) { scanf("%s",&ch[t]); getchar(); t+=b; } printf("#"); for(i=1;i<=b;i++) printf("#"); printf("#\n"); t=1; for(i=1;i<=a;i++) { printf("#"); for(k=t;k<=(t+b-1);k++) { printf("%c",ch[k]); } t+=b; printf("#\n"); } for(i=0;i<=b;i++) printf("#"); printf("#\n"); } return 0; }
a.cc:2:9: fatal error: String.h: No such file or directory 2 | #include<String.h> | ^~~~~~~~~~ compilation terminated.
s554419320
p03712
C
#include<stdio.h> #include<String.h> int main() { int r,a,b,c,h,i,k,t; char ch[20]; while(scanf("%d%d",&a,&b)!=EOF) { getchar(); t=1; for(i=1;i<=a;i++) { scanf("%s",&ch[t]); getchar(); t+=b; } printf("#"); for(i=1;i<=b;i++) printf("#"); printf("#\n"); t=1; for(i=1;i<=a;i++) { printf("#"); for(k=t;k<=(t+b-1);k++) { printf("%c",ch[k]); } t+=b; printf("#\n"); } for(i=0;i<=b;i++) printf("#"); printf("#\n"); } return 0; }
main.c:2:9: fatal error: String.h: No such file or directory 2 | #include<String.h> | ^~~~~~~~~~ compilation terminated.
s593838128
p03712
C
#include <stdio.h> int main(void) { int i; int h , w; char b[128][128]={0}; scanf("%d %d", &h, &w); for(i=1; i<=h;++i){ b[i][0]='#'; scanf("%s", &b[i][1]); b[i][w+1]='#'; } for(i=0;i<=w+1;++i){ b[0][i]='#'; b[h+1][i]='#'; } for(i=0;i<=h+1;++i){ printf("%s\n", b[i])); } return 0; }
main.c: In function 'main': main.c:19:25: error: expected ';' before ')' token 19 | printf("%s\n", b[i])); | ^ | ; main.c:19:25: error: expected statement before ')' token
s306801457
p03712
C++
#include<iostream.h> using namespace std; int main() { int H,W,arr[100][100]; cin>>H; cin>>W; for(int i=0;i<W;i++) for(int j=0;j<H;j++) { cin>>arr[i][j]; } for(int i=0;i<=W;i++) for(int j=0;j<=H;j++) {if(i==W||j==H) {cout<<"#";} else {cout<<arr[i][j];} return=0; }
a.cc:1:9: fatal error: iostream.h: No such file or directory 1 | #include<iostream.h> | ^~~~~~~~~~~~ compilation terminated.
s453097141
p03712
C++
#include<iostream<> #include<stdio.h> #include<stdlib.h> using namespace std; int main() {int H,W,i=0; cin>>H; cout<<" "; cin>>W; char a[H][W]; for(i=0;i<H;i++) {for(int j=0;j<W;j++) {cin>>a[i][j]; } cout<<endl; } for(i=0;i<W+2;i++) cout<<'#'; for(i=0;i<H;i++) {for(int j=0;j<W;j++) {cout<<a[i][j]; } cout<<endl; } for(i=0;i<W+2;i++) cout<<'#'; return 0; }
a.cc:1:9: fatal error: iostream<: No such file or directory 1 | #include<iostream<> | ^~~~~~~~~~~ compilation terminated.
s402418898
p03712
C++
#include<iostream> #include<stdiuo.h> #include<stdlib.h> using namespace std; int main() {int H,W,i=0; cin>>H; cout<<" "; cin>>W; char a[H][W]; for(i=0;i<H;i++) {for(int j=0;j<W;j++) {cin>>a[i][j]; } cout<<endl; } for(i=0;i<W+2;i++) cout<<'#'; for(i=0;i<H;i++) {for(int j=0;j<W;j++) {cout<<a[i][j]; } cout<<endl; } for(i=0;i<W+2;i++) cout<<'#'; return 0; }
a.cc:2:9: fatal error: stdiuo.h: No such file or directory 2 | #include<stdiuo.h> | ^~~~~~~~~~ compilation terminated.
s419003201
p03712
C++
#include<iostream<> #include<stdiuo.h> #include<stdlib.h> using namespace std; int main() {int H,W,i=0; cin>>H; cout<<" "; cin>>W; char a[H][W]; for(i=0;i<H;i++) {for(int j=0;j<W;j++) {cin>>a[i][j]; } cout<<endl; } for(i=0;i<W+2;i++) cout<<'#'; for(i=0;i<H;i++) {for(int j=0;j<W;j++) {cout<<a[i][j]; } cout<<endl; } for(i=0;i<W+2;i++) cout<<'#'; return 0; }
a.cc:1:9: fatal error: iostream<: No such file or directory 1 | #include<iostream<> | ^~~~~~~~~~~ compilation terminated.
s162160862
p03712
C++
#include<iostream> using namespace std; int main() { int H,W,arr[100][100]; cin>>H; cin>>W; for(int i=0;i<W;i++) for(int j=0;j<H;j++) { cin>>arr[i][j]; } for(int i=0;i<=W;i++) for(int j=0;j<=H;j++) {if(i==W||j==H) {cout<<"#";} else {cout<<arr[i][j];} return 0; }
a.cc: In function 'int main()': a.cc:18:2: error: expected '}' at end of input 18 | } | ^ a.cc:4:1: note: to match this '{' 4 | { int H,W,arr[100][100]; | ^
s064165542
p03712
C++
#include<iostream.h> using namespace std; int main() { int H,W,arr[100][100]; cin>>H; cin>>W; for(int i=0;i<W;i++) for(int j=0;j<H;j++) { cin>>arr[i][j]; } for(int i=0;i<=W;i++) for(int j=0;j<=H;j++) {if(i==W||j==H) {cout<<"#";} else {cout<<arr[i][j];} return 0; }
a.cc:1:9: fatal error: iostream.h: No such file or directory 1 | #include<iostream.h> | ^~~~~~~~~~~~ compilation terminated.
s735958196
p03712
C++
#include<iostream> using namespace std; int main() { int H,W,arr[100][100]; cin>>H; cin>>W; for(int i=0;i<W;i++) for(int j=0;j<H;j++) { cin>>arr[i][j]; } for(i=0;i<=W;i++) for(j=0;j<=H;j++) {if(i==W||j==H) {cout<<"#";} else {cout<<arr[i][j];} return=0; }
a.cc: In function 'int main()': a.cc:11:5: error: 'i' was not declared in this scope 11 | for(i=0;i<=W;i++) | ^ a.cc:12:5: error: 'j' was not declared in this scope 12 | for(j=0;j<=H;j++) | ^ a.cc:17:7: error: expected primary-expression before '=' token 17 | return=0; | ^ a.cc:18:2: error: expected '}' at end of input 18 | } | ^ a.cc:4:1: note: to match this '{' 4 | { int H,W,arr[100][100]; | ^
s952725702
p03712
C++
#include<iostream> #include<stdio.h> #include<stdlib.h> using namespace std; int main() {int H,W,i=0; cin>>H; cout<<" "; cin>>W; cout<<endl; char a[H][w]; for(i=0;i<H;i++) {for(int j=0;j<W;j=++) {cin>>a[i][j];} cout<<endl; } for(i=0;i<W+2;i++) cout<<'#'; for(i=0;i<H;i++) {cout<<'#'; for(int j=0;j<W;j=++) {cout<<a[i][j];} cout<<'#'; cout<<endl; } for(i=0;i<W+2;i++) cout<<'#'; return 0; } }
a.cc: In function 'int main()': a.cc:13:12: error: 'w' was not declared in this scope 13 | char a[H][w]; | ^ a.cc:15:22: error: expected primary-expression before ')' token 15 | {for(int j=0;j<W;j=++) | ^ a.cc:16:7: error: 'a' was not declared in this scope 16 | {cin>>a[i][j];} | ^ a.cc:23:21: error: expected primary-expression before ')' token 23 | for(int j=0;j<W;j=++) | ^ a.cc:24:8: error: 'a' was not declared in this scope 24 | {cout<<a[i][j];} | ^ a.cc: At global scope: a.cc:39:1: error: expected declaration before '}' token 39 | } | ^
s375793387
p03712
C++
#include<iostream.h> using namespace std; int main() { int H,W,arr[100][100]; cin>>H; cin>>W; for(int i=0;i<W;i++) for(int j=0;j<H;j++) { cin>>arr[i][j]; } for(i=0;i<=W;i++) for(j=0;j<=H;j++) {if(i==W||j==H) {cout<<"#";} else {cout<<arr[i][j];} return=0; }
a.cc:1:9: fatal error: iostream.h: No such file or directory 1 | #include<iostream.h> | ^~~~~~~~~~~~ compilation terminated.
s577269210
p03712
C++
#include<iostream> #include<stdio.h> #include<stdlib.h> using namespace std; int main() {int H,W; cin>>H; cout<<" "; cin>>W; char A[H][W]; for(int i=0;i<H;i++) {for(int j=0;j<W;j++) {cin>>A[i][j]; } cout<<endl; } for(i=0;i<W+2;i++) {cout<<'#';} for(int i=0;i<H;i++) {cout<<'#'; for(int j=0;j<W;j++) {cout<<A[i][j]; } cout<<'#'; cout<<endl; } for(i=0;i<W+2;i++) {cout<<'#';} return 0; }
a.cc: In function 'int main()': a.cc:21:5: error: 'i' was not declared in this scope 21 | for(i=0;i<W+2;i++) | ^ a.cc:32:5: error: 'i' was not declared in this scope 32 | for(i=0;i<W+2;i++) | ^
s402892405
p03712
C
#include<stdio.h> int main() { int h,w; char a[100][100]; for(i=0;i<h;i++) for(j=0;j<w;j++); scanf("%c",a[i][j]); for(i=0;i<h+2;i++) { for(j=0;j<w+2;j++) { if(i==0||i==(h+1)||j==0||j==w+1) printf("#"); else printf("%c",a[i-1][j-1]) } } return 0; }
main.c: In function 'main': main.c:6:5: error: 'i' undeclared (first use in this function) 6 | for(i=0;i<h;i++) | ^ main.c:6:5: note: each undeclared identifier is reported only once for each function it appears in main.c:7:5: error: 'j' undeclared (first use in this function) 7 | for(j=0;j<w;j++); | ^ main.c:16:25: error: expected ';' before '}' token 16 | printf("%c",a[i-1][j-1]) | ^ | ; 17 | } | ~
s803841193
p03712
C++
#include <iostream> #include <math.h> #include <algorithm> #include <vector> #include <numeric> using namespace std; const double PI = acos(-1.0); const string ALP = "abcdefghijklmnopqrstuvwxyz"; #define EXIST(s,e) ((s).find(e)!=(s).end()) #define SORT(c) sort((c).begin(),(c).end()) #define FOR(i,a,b) for(int i=(a);i<(b);++i) #define REP(i,n) FOR(i,0,n) int main(){ int h,w; str s; cin >> h >> w; REP(i,w+2)cout << "#"; REP(i,h){ cout << endl << "#"; cin >> s; cout << s; cout << "#" << endl; } REP(i,w+2)cout << "#"; cout << endl; return 0; }
a.cc: In function 'int main()': a.cc:15:3: error: 'str' was not declared in this scope; did you mean 'std'? 15 | str s; | ^~~ | std a.cc:20:12: error: 's' was not declared in this scope 20 | cin >> s; | ^
s816591627
p03712
C++
#include <bits/stdc++.h> using namespace std; int main() { int h,w; cin >>h>>w; char a[h+2][w+2] for(int i=0;i<h+2;i++) { for(int j=0;j<w+2;j++) { a[i][j]='#'; } } for(int i=1;i<h+1;i++) for(int j=1;j<w+1;j++) { cin >> a[i][j]; } for(int i=0;i<h+2;i++) { for(int j=0;j<w+2;j++) { cout << a[i][j]; } cout<<endl; } return 0; }
a.cc: In function 'int main()': a.cc:8:5: error: expected initializer before 'for' 8 | for(int i=0;i<h+2;i++) | ^~~ a.cc:8:17: error: 'i' was not declared in this scope 8 | for(int i=0;i<h+2;i++) | ^ a.cc:18:16: error: 'a' was not declared in this scope 18 | cin >> a[i][j]; | ^ a.cc:24:21: error: 'a' was not declared in this scope 24 | cout << a[i][j]; | ^
s000301006
p03712
C
#include<stdio.h> #include<string.h> int main(){ int m,n,i,j; char str[100][100]; scanf("%d%d",&m,&n); for(i=0;i<m;i++){ scanf("%s",str[i]); } for(i=0;i<n+2;i++){ printf("#"); } printf("\n"); for(i=0;i<m;i++){ printf("#"); for(j=0;j<n;j++){ printf("%c",str[i][j]); } printf("#\n"); } for(i=0;i<n+2;i++){ printf("#"); } printf("\n"); return 0; } 装箱子
main.c:27:1: error: expected '=', ',', ';', 'asm' or '__attribute__' at end of input 27 | 装箱子 | ^~~~~~
s554581033
p03712
C
#include<stdio.h> #include<string.h> int main(){ int m,n,i,j; char str[100][100]; scanf("%d%d",&m,&n); for(i=0;i<m;i++){ scanf("%s",str[i]); } for(i=0;i<n+2;i++){ printf("#"); } printf("\n"); for(i=0;i<m;i++){ printf("#"); for(j=0;j<n;j++){ printf("%c",str[i][j]); } printf("#\n"); } for(i=0;i<n+2;i++){ printf("#"); } printf("\n"); return 0; } 装箱子
main.c:27:1: error: expected '=', ',', ';', 'asm' or '__attribute__' at end of input 27 | 装箱子 | ^~~~~~
s155654256
p03712
C++
# -*- coding: utf-8 -*- import sys import subprocess import json import time import math import re import sqlite3 H, W = map(int, input().split()) a = [] a.append('#' * W) for i in range(H): a.append(input()) a.append('#' * W) for i in range(len(a)): a[i] = '#' + a[i] + '#' print(a[i])
a.cc:1:3: error: invalid preprocessing directive #- 1 | # -*- coding: utf-8 -*- | ^ a.cc:3:1: error: 'import' does not name a type 3 | import sys | ^~~~~~ a.cc:3:1: note: C++20 'import' only available with '-fmodules-ts'
s118139543
p03712
C
#include <stdio.h> int main(){ int n,m; char ch[100][100]; scanf("%d %d",&n,&m); getchar(); for(int i=0; i<n; i++){ for(int j=0; j<m; j++){ scanf("%c",&ch[i][j]); } getchar(); } for(int i=0; i<=m+1; i++){ printf("#"); } printf("\n"); for(int i=0; i<n; i++){ printf("#"); for(int j=0; j<m; j++){ printf("%c",ch[i][j]); } printf("#\n"); } for(int i=0; i<=m+1; i++){ printf("#"); } return 0;
main.c: In function 'main': main.c:28:5: error: expected declaration or statement at end of input 28 | return 0; | ^~~~~~
s996086584
p03712
C++
#include <bits/stdc++.h> #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 SORT(v, n) sort(v, v+n); #define SORTR(v,n) sort(v, v+n, greater<int>()); // #define int long long // %d=>%lld #define pb push_back #define INF 1000000000 using namespace std; typedef long long ll; typedef pair<int, int> pii; typedef pair<ll, ll> pll; typedef pair<int, pii> piii; typedef pair<ll, pll> plll; int h; int w; char buf1[100+1]; string s[100+1]; signed main(){ scanf("%d", &h); scanf("%d", &w); for(int i = 0;i < h;i++){ scanf("%s", buf1); s[h](buf1); } for(int i = 0;i < w+2;i++){ cout << '#'; } cout << '\n'; for(int i = 0;i < h;i++){ cout<< '#'<< s[i]<< '#'<< '\n'; } for(int i = 0;i < w+2;i++){ cout << '#'; } cout << '\n'; return 0; }
a.cc: In function 'int main()': a.cc:32:13: error: no match for call to '(std::string {aka std::__cxx11::basic_string<char>}) (char [101])' 32 | s[h](buf1); | ~~~~^~~~~~
s714104362
p03712
C++
#include <cstdio> #include <cstdlib> #include <cmath> #include <cstring> #include <iostream> #include <string> #include <algorithm> #include <vector> #include <queue> #include <stack> #include <map> #include <set> #include <functional> #include <cassert> typedef long long ll; using namespace std; #define debug(x) cerr << #x << " = " << (x) << endl; #define mod 1000000007 //1e9+7(prime number) #define INF 1000000000 //1e9 #define LLINF 2000000000000000000LL //2e18 #define SIZE 110 int main(){ char s[SIZE][SIZE]; int h,w; scanf("%d%d",&h,&w); for(int i=0;i<w+2;i++){ printf("#"); } puts(""); for(int i=0;i<h;i++){ scanf("%s",s[i]) printf("#%s#\n",s[i]); } for(int i=0;i<w+2;i++){ printf("#"); } puts(""); return 0; }
a.cc: In function 'int main()': a.cc:43:21: error: expected ';' before 'printf' 43 | scanf("%s",s[i]) | ^ | ; 44 | printf("#%s#\n",s[i]); | ~~~~~~
s656765138
p03712
C++
#include <iostream> #include <string> #include <sstream> #include <algorithm> #include <vector> #include <utility> #include <functional> #include <stack> #include <queue> #include <map> #include <set> #include <cstdio> #include <cstdlib> #include <cstring> #include <cmath> #include <deque> #include <ctime> using namespace std; #define rep(i,n) REP(i,0,n) #define REP(i,s,e) for(int i=(s); i<(int)(e); i++) #define pb push_back #define mp make_pair #define all(r) (r).begin(),(r).end() #define rall(r) (r).rbegin(),(r).rend() #define fi first #define se second #define ARRAY_LENGTH(array) (sizeof(array) / sizeof(array[0])) typedef long long ll; typedef vector<int> vi; typedef vector<ll> vl; typedef pair<int, int> pii; typedef pair<ll, ll> pll; const int INF = 1e9; const ll LINF = 1e18; const ll MOD = 1e9 + 7; double EPS = 1e-8; const double PI = acos(-1); int dx[]={-1,1,0,0}; int dy[]={0,0,-1,1}; int main () { char a[100][101], b[102][102]; int H, W; cin >> H >> W; for (int i = 0; i < H; i++) scanf("%s", a[i]); for (int i = 0; i < H + 2; i++) for (int j = 0; j < W + 2; j++) b[i][j] = ’#’; for (int i = 0; i < H; i++) for (int j = 0; j < W; j++) b[i + 1][j + 1] = a[i][j]; for (int i = 0; i < H + 2; i++){ for (int j = 0; j < W + 2; j++) cout << b[i][j]; cout << endl; } }
a.cc:58:35: error: extended character ’ is not valid in an identifier 58 | b[i][j] = ’#’; | ^ a.cc:58:36: error: stray '#' in program 58 | b[i][j] = ’#’; | ^ a.cc:58:37: error: extended character ’ is not valid in an identifier 58 | b[i][j] = ’#’; | ^ a.cc: In function 'int main()': a.cc:58:35: error: '\U00002019' was not declared in this scope 58 | b[i][j] = ’#’; | ^
s559662942
p03712
C++
#include <iostream> #include <string> #include <sstream> #include <algorithm> #include <vector> #include <utility> #include <functional> #include <stack> #include <queue> #include <map> #include <set> #include <cstdio> #include <cstdlib> #include <cstring> #include <cmath> #include <deque> #include <ctime> using namespace std; #define rep(i,n) REP(i,0,n) #define REP(i,s,e) for(int i=(s); i<(int)(e); i++) #define pb push_back #define mp make_pair #define all(r) (r).begin(),(r).end() #define rall(r) (r).rbegin(),(r).rend() #define fi first #define se second #define ARRAY_LENGTH(array) (sizeof(array) / sizeof(array[0])) typedef long long ll; typedef vector<int> vi; typedef vector<ll> vl; typedef pair<int, int> pii; typedef pair<ll, ll> pll; const int INF = 1e9; const ll LINF = 1e18; const ll MOD = 1e9 + 7; double EPS = 1e-8; const double PI = acos(-1); int dx[]={-1,1,0,0}; int dy[]={0,0,-1,1}; int main () { char a[100][101], b[102][102]; int main() { int H, W; cin >> H >> W; for (int i = 0; i < H; i++) scanf("%s", a[i]); for (int i = 0; i < H + 2; i++) for (int j = 0; j < W + 2; j++) b[i][j] = ’#’; for (int i = 0; i < H; i++) for (int j = 0; j < W; j++) b[i + 1][j + 1] = a[i][j]; for (int i = 0; i < H + 2; i++){ for (int j = 0; j < W + 2; j++) cout << b[i][j]; cout << endl; } }
a.cc:58:35: error: extended character ’ is not valid in an identifier 58 | b[i][j] = ’#’; | ^ a.cc:58:36: error: stray '#' in program 58 | b[i][j] = ’#’; | ^ a.cc:58:37: error: extended character ’ is not valid in an identifier 58 | b[i][j] = ’#’; | ^ a.cc: In function 'int main()': a.cc:51:17: warning: empty parentheses were disambiguated as a function declaration [-Wvexing-parse] 51 | int main() { | ^~ a.cc:51:17: note: remove parentheses to default-initialize a variable 51 | int main() { | ^~ | -- a.cc:51:17: note: or replace parentheses with braces to value-initialize a variable a.cc:51:20: error: a function-definition is not allowed here before '{' token 51 | int main() { | ^ a.cc:69:2: error: expected '}' at end of input 69 | } | ^ a.cc:49:1: note: to match this '{' 49 | { | ^
s625148102
p03712
C++
#include <iostream> #include <string> int main () { char a[100][101], b[102][102]; int H, W; cin >> H >> W; for (int i = 0; i < H; i++) scanf("%s", a[i]); for (int i = 0; i < H + 2; i++) for (int j = 0; j < W + 2; j++) b[i][j] = '#'; for (int i = 0; i < H; i++) for (int j = 0; j < W; j++) b[i + 1][j + 1] = a[i][j]; for (int i = 0; i < H + 2; i++){ for (int j = 0; j < W + 2; j++) cout << b[i][j]; cout << endl; } }
a.cc: In function 'int main()': a.cc:10:9: error: 'cin' was not declared in this scope; did you mean 'std::cin'? 10 | cin >> H >> W; | ^~~ | std::cin In file included from a.cc:1: /usr/include/c++/14/iostream:62:18: note: 'std::cin' declared here 62 | extern istream cin; ///< Linked to standard input | ^~~ a.cc:24:17: error: 'cout' was not declared in this scope; did you mean 'std::cout'? 24 | cout << b[i][j]; | ^~~~ | std::cout /usr/include/c++/14/iostream:63:18: note: 'std::cout' declared here 63 | extern ostream cout; ///< Linked to standard output | ^~~~ a.cc:25:17: error: 'cout' was not declared in this scope; did you mean 'std::cout'? 25 | cout << endl; | ^~~~ | std::cout /usr/include/c++/14/iostream:63:18: note: 'std::cout' declared here 63 | extern ostream cout; ///< Linked to standard output | ^~~~ a.cc:25:25: error: 'endl' was not declared in this scope; did you mean 'std::endl'? 25 | cout << endl; | ^~~~ | std::endl In file included from /usr/include/c++/14/iostream:41: /usr/include/c++/14/ostream:744:5: note: 'std::endl' declared here 744 | endl(basic_ostream<_CharT, _Traits>& __os) | ^~~~
s872995084
p03712
C++
char a[100][101], b[102][102]; int main() { int H, W; cin >> H >> W; for (int i = 0; i < H; i++) scanf("%s", a[i]); for (int i = 0; i < H + 2; i++) for (int j = 0; j < W + 2; j++) b[i][j] = ’#’; for (int i = 0; i < H; i++) for (int j = 0; j < W; j++) b[i + 1][j + 1] = a[i][j]; for (int i = 0; i < H + 2; i++){ for (int j = 0; j < W + 2; j++) cout << b[i][j]; cout << endl; }
a.cc:9:27: error: extended character ’ is not valid in an identifier 9 | b[i][j] = ’#’; | ^ a.cc:9:28: error: stray '#' in program 9 | b[i][j] = ’#’; | ^ a.cc:9:29: error: extended character ’ is not valid in an identifier 9 | b[i][j] = ’#’; | ^ a.cc: In function 'int main()': a.cc:3:11: error: 'cin' was not declared in this scope 3 | int H, W; cin >> H >> W; | ^~~ a.cc:5:9: error: 'scanf' was not declared in this scope 5 | scanf("%s", a[i]); | ^~~~~ a.cc:9:27: error: '\U00002019' was not declared in this scope 9 | b[i][j] = ’#’; | ^ a.cc:17:9: error: 'cout' was not declared in this scope 17 | cout << b[i][j]; | ^~~~ a.cc:18:9: error: 'cout' was not declared in this scope 18 | cout << endl; | ^~~~ a.cc:18:17: error: 'endl' was not declared in this scope 18 | cout << endl; | ^~~~ a.cc:19:2: error: expected '}' at end of input 19 | } | ^ a.cc:2:12: note: to match this '{' 2 | int main() { | ^
s072450976
p03712
Java
import java.util.Scanner; class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int H = sc.nextInt(); int W = sc.nextInt(); for(int i = 0; i <= W+1; i++) { System.out.print("#"); } System.out.println("#"); for(int j = 0; j <= H; j++) { System.out.print("#"); System.out.print(sc.next()); } System.out.println("#"); for(int i = 0; i <= W+1; i++) { System.out.print("#"); } System.out.println("#"); }
Main.java:25: error: reached end of file while parsing } ^ 1 error
s768343901
p03712
Java
import java.util.Scanner; class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int H = sc.nextInt(); int W = sc.nettInt(); for(int i = 0; i <= W; i++) { System.out.print("#"); } System.out.println("#"); for(int j = 0; j <= H; j++) { System.out.print("#"); System.out.print(sc.next()); } System.out.println("#"); for(int i = 0; i <= W; i++) { System.out.print("#"); } System.out.println("#"); } }
Main.java:8: error: cannot find symbol int W = sc.nettInt(); ^ symbol: method nettInt() location: variable sc of type Scanner 1 error
s878159745
p03712
Java
import java.util.Scanner; class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int H = sc.nextInt(); int W = sc.nettInt(); for(int i = 0; i <= W; i++) { System.out.print(#); } System.out.println(#); for(int j = 0; j <= H; j++) { System.out.print(#); System.out.print(sc.next()); } System.out.println(#); for(int i = 0; i <= W; i++) { System.out.print(#); } System.out.println(#); } }
Main.java:11: error: illegal character: '#' System.out.print(#); ^ Main.java:13: error: illegal character: '#' System.out.println(#); ^ Main.java:16: error: illegal character: '#' System.out.print(#); ^ Main.java:19: error: illegal character: '#' System.out.println(#); ^ Main.java:22: error: illegal character: '#' System.out.print(#); ^ Main.java:24: error: illegal character: '#' System.out.println(#); ^ 6 errors
s688039380
p03712
Java
import java.util.Scanner; class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int H = sc.nextInt(); int W = sc.nettInt(); for(int i = 0, i <= W, i++) { System.out.print(#); } System.out.println(#); for(int j = 0, j <= H, j++) { System.out.print(#); System.out.print(sc.next()); } System.out.println(#); for(int i = 0, i <= W, i++) { System.out.print(#); } System.out.println(#); } }
Main.java:10: error: ';' expected for(int i = 0, i <= W, i++) { ^ Main.java:10: error: illegal start of expression for(int i = 0, i <= W, i++) { ^ Main.java:10: error: ';' expected for(int i = 0, i <= W, i++) { ^ Main.java:11: error: illegal character: '#' System.out.print(#); ^ Main.java:13: error: illegal character: '#' System.out.println(#); ^ Main.java:15: error: ';' expected for(int j = 0, j <= H, j++) { ^ Main.java:15: error: illegal start of expression for(int j = 0, j <= H, j++) { ^ Main.java:15: error: ';' expected for(int j = 0, j <= H, j++) { ^ Main.java:16: error: illegal character: '#' System.out.print(#); ^ Main.java:19: error: illegal character: '#' System.out.println(#); ^ Main.java:21: error: ';' expected for(int i = 0, i <= W, i++) { ^ Main.java:21: error: illegal start of expression for(int i = 0, i <= W, i++) { ^ Main.java:21: error: ';' expected for(int i = 0, i <= W, i++) { ^ Main.java:22: error: illegal character: '#' System.out.print(#); ^ Main.java:24: error: illegal character: '#' System.out.println(#); ^ 15 errors
s719144287
p03712
Java
import java.util.Scanner; class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int H = sc.nextInt(); int W = sc.nettInt(); for(i = 0, i <= W, i++) { System.out.print(#); } System.out.println(#); for(j = 0, j <= H, j++) { System.out.print(#); System.out.print(sc.next()); } System.out.println(#); for(i = 0, i <= W, i++) { System.out.print(#); } System.out.println(#); } }
Main.java:10: error: not a statement for(i = 0, i <= W, i++) { ^ Main.java:10: error: ';' expected for(i = 0, i <= W, i++) { ^ Main.java:11: error: illegal character: '#' System.out.print(#); ^ Main.java:13: error: illegal character: '#' System.out.println(#); ^ Main.java:15: error: not a statement for(j = 0, j <= H, j++) { ^ Main.java:15: error: ';' expected for(j = 0, j <= H, j++) { ^ Main.java:16: error: illegal character: '#' System.out.print(#); ^ Main.java:19: error: illegal character: '#' System.out.println(#); ^ Main.java:21: error: not a statement for(i = 0, i <= W, i++) { ^ Main.java:21: error: ';' expected for(i = 0, i <= W, i++) { ^ Main.java:22: error: illegal character: '#' System.out.print(#); ^ Main.java:24: error: illegal character: '#' System.out.println(#); ^ 12 errors
s706440137
p03712
C++
#include<string> #include<deque> #include<queue> #include<vector> #include<algorithm> #include<iostream> #include<set> #include<cmath> //#include<map> using namespace std; typedef long long int llint; #define mp make_pair #define mt make_tuple #define pub push_back #define puf push_front #define pob pop_back #define pof pop_front #define izryt bool #define fi first #define se second #define res resize const llint mod=1000000007; const llint gya=500000004;//mod modで2の逆元 const llint big=1e9; const llint red=0xE869120; const llint pro=1002001; //10,7,4,1,0,0,0,0,0,0 //aaabbbbaaa int main(void){ string str; int i,j,H,W; cin>>H>>W; for(i=0;i<W+2;i++){ cout<<'#'; }cout<<endl; for(i=0;i<H;i++){ cout<<'#' cin>>str; cout<<str; cout<<'#'<<endl; } for(i=0;i<W+2;i++){ cout<<'#'; }cout<<endl; return 0; }
a.cc: In function 'int main()': a.cc:37:26: error: expected ';' before 'cin' 37 | cout<<'#' | ^ | ; 38 | cin>>str; | ~~~
s788987454
p03712
C++
#include<iostream> using namespace std; int main(){]; int h,w; int i,j; cin>>h>>w; char m[102][102]; for(i=1;i<=h;i++){ for(j=1;j<=w;j++){ cin>>m[i][j]; } } for(i=0;i<=h+1;i++){ for(j=0;j<=w+1;j++){ if(i==0||j==0||i==h+1||j==w+1){ cout<<"#"; } else{ cout<<m[i][j]; } } cout<<endl; } return 0; }
a.cc: In function 'int main()': a.cc:3:12: error: expected primary-expression before ']' token 3 | int main(){]; | ^
s532760011
p03712
C++
#include<iostream> using namespace std; int main(){]; int h,w; int i,j; cin>>h>>w; char m[102][102]; for(i=1;i<=h;i++){ for(j=1;j<=w;j++){ cin>>m[i][j]; } } for(i=0;i<=h+1;i++){ for(j=0;j<=w+1;j++){ if(i==0||j==0||i==h+1||j==w+1){ cout<<"#"; } else{ cout<<m[i][j]; } } cout<<endl; } return 0; }
a.cc: In function 'int main()': a.cc:3:12: error: expected primary-expression before ']' token 3 | int main(){]; | ^
s537116216
p03712
C++
#include<iostream> #include<cstdio> using namespace std; char a[100][101], b[102][102]; int main() { int h, w; cin >> h >> w; for(int i = 0; i < h; i++) { scanf("%s", a[i]); } for(int i = 0; i < h+2; i++){ for(int j = 0; j < w+2; j++){ b[i][j] = '#'; } } for(int i = 0; i < h; i++){ for(int j = 0; j < w; j++){ b[i+1][j+1] = a[i][j]; } } for(int i = 0; i < h+2; i++){ for(int j = 0; j < w+2; j++){ cout << b[i][j] << cout; } } }
a.cc: In function 'int main()': a.cc:29:29: error: no match for 'operator<<' (operand types are 'std::basic_ostream<char>' and 'std::ostream' {aka 'std::basic_ostream<char>'}) 29 | cout << b[i][j] << cout; | ~~~~~~~~~~~~~~~ ^~ ~~~~ | | | | | basic_ostream<[...]> | basic_ostream<[...]> a.cc:29:29: note: candidate: 'operator<<(int, int)' (built-in) 29 | cout << b[i][j] << cout; | ~~~~~~~~~~~~~~~~^~~~~~~ a.cc:29:29: note: no known conversion for argument 2 from 'std::ostream' {aka 'std::basic_ostream<char>'} to 'int' In file included from /usr/include/c++/14/iostream:41, from a.cc:1: /usr/include/c++/14/ostream:116:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(__ostream_type& (*)(__ostream_type&)) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>]' 116 | operator<<(__ostream_type& (*__pf)(__ostream_type&)) | ^~~~~~~~ /usr/include/c++/14/ostream:116:36: note: no known conversion for argument 1 from 'std::ostream' {aka 'std::basic_ostream<char>'} to 'std::basic_ostream<char>::__ostream_type& (*)(std::basic_ostream<char>::__ostream_type&)' {aka 'std::basic_ostream<char>& (*)(std::basic_ostream<char>&)'} 116 | operator<<(__ostream_type& (*__pf)(__ostream_type&)) | ~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~ /usr/include/c++/14/ostream:125:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(__ios_type& (*)(__ios_type&)) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>; __ios_type = std::basic_ios<char>]' 125 | operator<<(__ios_type& (*__pf)(__ios_type&)) | ^~~~~~~~ /usr/include/c++/14/ostream:125:32: note: no known conversion for argument 1 from 'std::ostream' {aka 'std::basic_ostream<char>'} to 'std::basic_ostream<char>::__ios_type& (*)(std::basic_ostream<char>::__ios_type&)' {aka 'std::basic_ios<char>& (*)(std::basic_ios<char>&)'} 125 | operator<<(__ios_type& (*__pf)(__ios_type&)) | ~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~ /usr/include/c++/14/ostream:135:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(std::ios_base& (*)(std::ios_base&)) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>]' 135 | operator<<(ios_base& (*__pf) (ios_base&)) | ^~~~~~~~ /usr/include/c++/14/ostream:135:30: note: no known conversion for argument 1 from 'std::ostream' {aka 'std::basic_ostream<char>'} to 'std::ios_base& (*)(std::ios_base&)' 135 | operator<<(ios_base& (*__pf) (ios_base&)) | ~~~~~~~~~~~~^~~~~~~~~~~~~~~~~ /usr/include/c++/14/ostream:174:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(long int) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>]' 174 | operator<<(long __n) | ^~~~~~~~ /usr/include/c++/14/ostream:174:23: note: no known conversion for argument 1 from 'std::ostream' {aka 'std::basic_ostream<char>'} to 'long int' 174 | operator<<(long __n) | ~~~~~^~~ /usr/include/c++/14/ostream:178:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(long unsigned int) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>]' 178 | operator<<(unsigned long __n) | ^~~~~~~~ /usr/include/c++/14/ostream:178:32: note: no known conversion for argument 1 from 'std::ostream' {aka 'std::basic_ostream<char>'} to 'long unsigned int' 178 | operator<<(unsigned long __n) | ~~~~~~~~~~~~~~^~~ /usr/include/c++/14/ostream:182:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(bool) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>]' 182 | operator<<(bool __n) | ^~~~~~~~ /usr/include/c++/14/ostream:182:23: note: no known conversion for argument 1 from 'std::ostream' {aka 'std::basic_ostream<char>'} to 'bool' 182 | operator<<(bool __n) | ~~~~~^~~ In file included from /usr/include/c++/14/ostream:1022: /usr/include/c++/14/bits/ostream.tcc:96:5: note: candidate: 'std::basic_ostream<_CharT, _Traits>& std::basic_ostream<_CharT, _Traits>::operator<<(short int) [with _CharT = char; _Traits = std::char_traits<char>]' 96 | basic_ostream<_CharT, _Traits>:: | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /usr/include/c++/14/bits/ostream.tcc:97:22: note: no known conversion for argument 1 from 'std::ostream' {aka 'std::basic_ostream<char>'} to 'short int' 97 | operator<<(short __n) | ~~~~~~^~~ /usr/include/c++/14/ostream:189:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(short unsigned int) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>]' 189 | operator<<(unsigned short __n) | ^~~~~~~~ /usr/include/c++/14/ostream:189:33: note: no known conversion for argument 1 from 'std::ostream' {aka 'std::basic_ostream<char>'} to 'short unsigned int' 189 | operator<<(unsigned short __n) | ~~~~~~~~~~~~~~~^~~ /usr/include/c++/14/bits/ostream.tcc:110:5: note: candidate: 'std::basic_ostream<_CharT, _Traits>& std::basic_ostream<_CharT, _Traits>::operator<<(int) [with _CharT = char; _Traits = std::char_traits<char>]' 110 | basic_ostream<_CharT, _Traits>:: | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /usr/include/c++/14/bits/ostream.tcc:111:20: note: no known conversion for argument 1 from 'std::ostream' {aka 'std::basic_ostream<char>'} to 'int' 111 | operator<<(int __n) | ~~~~^~~ /usr/include/c++/14/ostream:200:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(unsigned int) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>]' 200 | operator<<(unsigned int __n) | ^~~~~~~~ /usr/include/c++/14/ostream:200:31: note: no known conversion for argument 1 from 'std::ostream' {aka 'std::basic_ostream<char>'} to 'unsigned int' 200 | operator<<(unsigned int __n) | ~~~~~~~~~~~~~^~~ /usr/include/c++/14/ostream:211:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(long long int) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>]' 211 | operator<<(long long __n) | ^~~~~~~~ /usr/include/c++/14/ostream:211:28: note: no known conversion for argument 1 from 'std::ostream' {aka 'std::basic_ostream<char>'} to 'long long int' 211 | operator<<(long long __n) | ~~~~~~~~~~^~~ /usr/include/c++/14/ostream:215:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(long long unsigned int) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>]' 215 | operator<<(unsigned long long __n) | ^~~~~~~~ /usr/include/c++/14/ostream:215:37: note: no known conversion for argument 1 from 'std::ostream' {aka 'std::basic_ostream<char>'} to 'long long unsigned int' 215 | operator<<(unsigned long long __n) | ~~~~~~~~~~~~~~~~~~~^~~ /usr/include/c++/14/ostream:231:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(double) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>]' 231 | operator<<(double __f) | ^~~~~~~~ /usr/include/c++/14/ostream:231:25: note: no known conversion for argument 1 from 'std::ostream' {aka 'std::basic_ostream<char>'} to 'double' 231 | operator<<(double __f) | ~~~~~~~^~~ /usr/include/c++/14/ostream:235:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(float) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>]' 235 | operator<<(float __f) | ^~~~~~~~ /usr/include/c++/14/ostream:235:24: note: no known conversion for argument 1 from 'std::ostream' {aka 'std::basic_ostream<char>'} to 'float' 235 | operator<<(float __f) | ~~~~~~^~~ /usr/include/c++/14/ostream:243:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(long double) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>]' 243 | operator<<(long double __f) | ^~~~~~~~ /usr/include/c++/14/ostream:243:30: note: no known conversion for argument 1 from 'std::ostream' {aka 'std::basic_ostream<char>'} to 'long double' 243 | operator<<(long double __f) | ~~~~~~~~~~~~^~~ /usr/include/c++/14/ostream:301:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(const void*) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>]' 301 | operator<<(const void* __p) | ^~~~~~~~ /usr/include/c++/14/ostream:301:30: note: no known conversion for argument 1 from 'std::ostream' {aka 'std::basic_ostream<char>'} to 'const void*' 301 | operator<<(const void* __p) |
s703629120
p03712
C++
#include<iostream> using namespace std; char a[100][101], b[102][102]; int main() { int h, w; cin >> h >> w; for(int i = 0; i < h; i++) { scanf("%s", a[i]); } for(int i = 0; i < h+2; i++){ for(int j = 0; j < w+2; j++){ b[i][j] = '#'; } } for(int i = 0; i < h; i++){ for(int j = 0; j < w; j++){ b[i+1][j+1] = a[i][j]; } } for(int i = 0; i < h+2; i++){ for(int j = 0; j < w+2; j++){ cout << b[i][j] << cout; } } }
a.cc: In function 'int main()': a.cc:28:29: error: no match for 'operator<<' (operand types are 'std::basic_ostream<char>' and 'std::ostream' {aka 'std::basic_ostream<char>'}) 28 | cout << b[i][j] << cout; | ~~~~~~~~~~~~~~~ ^~ ~~~~ | | | | | basic_ostream<[...]> | basic_ostream<[...]> a.cc:28:29: note: candidate: 'operator<<(int, int)' (built-in) 28 | cout << b[i][j] << cout; | ~~~~~~~~~~~~~~~~^~~~~~~ a.cc:28:29: note: no known conversion for argument 2 from 'std::ostream' {aka 'std::basic_ostream<char>'} to 'int' In file included from /usr/include/c++/14/iostream:41, from a.cc:1: /usr/include/c++/14/ostream:116:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(__ostream_type& (*)(__ostream_type&)) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>]' 116 | operator<<(__ostream_type& (*__pf)(__ostream_type&)) | ^~~~~~~~ /usr/include/c++/14/ostream:116:36: note: no known conversion for argument 1 from 'std::ostream' {aka 'std::basic_ostream<char>'} to 'std::basic_ostream<char>::__ostream_type& (*)(std::basic_ostream<char>::__ostream_type&)' {aka 'std::basic_ostream<char>& (*)(std::basic_ostream<char>&)'} 116 | operator<<(__ostream_type& (*__pf)(__ostream_type&)) | ~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~ /usr/include/c++/14/ostream:125:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(__ios_type& (*)(__ios_type&)) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>; __ios_type = std::basic_ios<char>]' 125 | operator<<(__ios_type& (*__pf)(__ios_type&)) | ^~~~~~~~ /usr/include/c++/14/ostream:125:32: note: no known conversion for argument 1 from 'std::ostream' {aka 'std::basic_ostream<char>'} to 'std::basic_ostream<char>::__ios_type& (*)(std::basic_ostream<char>::__ios_type&)' {aka 'std::basic_ios<char>& (*)(std::basic_ios<char>&)'} 125 | operator<<(__ios_type& (*__pf)(__ios_type&)) | ~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~ /usr/include/c++/14/ostream:135:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(std::ios_base& (*)(std::ios_base&)) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>]' 135 | operator<<(ios_base& (*__pf) (ios_base&)) | ^~~~~~~~ /usr/include/c++/14/ostream:135:30: note: no known conversion for argument 1 from 'std::ostream' {aka 'std::basic_ostream<char>'} to 'std::ios_base& (*)(std::ios_base&)' 135 | operator<<(ios_base& (*__pf) (ios_base&)) | ~~~~~~~~~~~~^~~~~~~~~~~~~~~~~ /usr/include/c++/14/ostream:174:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(long int) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>]' 174 | operator<<(long __n) | ^~~~~~~~ /usr/include/c++/14/ostream:174:23: note: no known conversion for argument 1 from 'std::ostream' {aka 'std::basic_ostream<char>'} to 'long int' 174 | operator<<(long __n) | ~~~~~^~~ /usr/include/c++/14/ostream:178:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(long unsigned int) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>]' 178 | operator<<(unsigned long __n) | ^~~~~~~~ /usr/include/c++/14/ostream:178:32: note: no known conversion for argument 1 from 'std::ostream' {aka 'std::basic_ostream<char>'} to 'long unsigned int' 178 | operator<<(unsigned long __n) | ~~~~~~~~~~~~~~^~~ /usr/include/c++/14/ostream:182:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(bool) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>]' 182 | operator<<(bool __n) | ^~~~~~~~ /usr/include/c++/14/ostream:182:23: note: no known conversion for argument 1 from 'std::ostream' {aka 'std::basic_ostream<char>'} to 'bool' 182 | operator<<(bool __n) | ~~~~~^~~ In file included from /usr/include/c++/14/ostream:1022: /usr/include/c++/14/bits/ostream.tcc:96:5: note: candidate: 'std::basic_ostream<_CharT, _Traits>& std::basic_ostream<_CharT, _Traits>::operator<<(short int) [with _CharT = char; _Traits = std::char_traits<char>]' 96 | basic_ostream<_CharT, _Traits>:: | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /usr/include/c++/14/bits/ostream.tcc:97:22: note: no known conversion for argument 1 from 'std::ostream' {aka 'std::basic_ostream<char>'} to 'short int' 97 | operator<<(short __n) | ~~~~~~^~~ /usr/include/c++/14/ostream:189:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(short unsigned int) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>]' 189 | operator<<(unsigned short __n) | ^~~~~~~~ /usr/include/c++/14/ostream:189:33: note: no known conversion for argument 1 from 'std::ostream' {aka 'std::basic_ostream<char>'} to 'short unsigned int' 189 | operator<<(unsigned short __n) | ~~~~~~~~~~~~~~~^~~ /usr/include/c++/14/bits/ostream.tcc:110:5: note: candidate: 'std::basic_ostream<_CharT, _Traits>& std::basic_ostream<_CharT, _Traits>::operator<<(int) [with _CharT = char; _Traits = std::char_traits<char>]' 110 | basic_ostream<_CharT, _Traits>:: | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /usr/include/c++/14/bits/ostream.tcc:111:20: note: no known conversion for argument 1 from 'std::ostream' {aka 'std::basic_ostream<char>'} to 'int' 111 | operator<<(int __n) | ~~~~^~~ /usr/include/c++/14/ostream:200:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(unsigned int) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>]' 200 | operator<<(unsigned int __n) | ^~~~~~~~ /usr/include/c++/14/ostream:200:31: note: no known conversion for argument 1 from 'std::ostream' {aka 'std::basic_ostream<char>'} to 'unsigned int' 200 | operator<<(unsigned int __n) | ~~~~~~~~~~~~~^~~ /usr/include/c++/14/ostream:211:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(long long int) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>]' 211 | operator<<(long long __n) | ^~~~~~~~ /usr/include/c++/14/ostream:211:28: note: no known conversion for argument 1 from 'std::ostream' {aka 'std::basic_ostream<char>'} to 'long long int' 211 | operator<<(long long __n) | ~~~~~~~~~~^~~ /usr/include/c++/14/ostream:215:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(long long unsigned int) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>]' 215 | operator<<(unsigned long long __n) | ^~~~~~~~ /usr/include/c++/14/ostream:215:37: note: no known conversion for argument 1 from 'std::ostream' {aka 'std::basic_ostream<char>'} to 'long long unsigned int' 215 | operator<<(unsigned long long __n) | ~~~~~~~~~~~~~~~~~~~^~~ /usr/include/c++/14/ostream:231:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(double) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>]' 231 | operator<<(double __f) | ^~~~~~~~ /usr/include/c++/14/ostream:231:25: note: no known conversion for argument 1 from 'std::ostream' {aka 'std::basic_ostream<char>'} to 'double' 231 | operator<<(double __f) | ~~~~~~~^~~ /usr/include/c++/14/ostream:235:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(float) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>]' 235 | operator<<(float __f) | ^~~~~~~~ /usr/include/c++/14/ostream:235:24: note: no known conversion for argument 1 from 'std::ostream' {aka 'std::basic_ostream<char>'} to 'float' 235 | operator<<(float __f) | ~~~~~~^~~ /usr/include/c++/14/ostream:243:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(long double) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>]' 243 | operator<<(long double __f) | ^~~~~~~~ /usr/include/c++/14/ostream:243:30: note: no known conversion for argument 1 from 'std::ostream' {aka 'std::basic_ostream<char>'} to 'long double' 243 | operator<<(long double __f) | ~~~~~~~~~~~~^~~ /usr/include/c++/14/ostream:301:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(const void*) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>]' 301 | operator<<(const void* __p) | ^~~~~~~~ /usr/include/c++/14/ostream:301:30: note: no known conversion for argument 1 from 'std::ostream' {aka 'std::basic_ostream<char>'} to 'const void*' 301 | operator<<(const void* __p) |
s825796369
p03712
C++
#include<iostream> using namespace std; char a[100][101], b[102][102]; int main() { int h, w; cin >> h >> w; for(int i = 0; i < h; i++) { scanf("%s", a[i]); } for(int i = 0; i < h+2; i++){ for(int j = 0; j < w+2; j++){ b[i][j] = '#'; } } for(int i = 0; i < h; i++){ for(int j = 0; j < w; j++){ b[i+1][j+1] = a[i][j]; } } for(int i = 0; i < h+2; i++){ for(int j = 0; j < w+2; j++){ cout << b[i][j] << cout; } } }
a.cc: In function 'int main()': a.cc:28:29: error: no match for 'operator<<' (operand types are 'std::basic_ostream<char>' and 'std::ostream' {aka 'std::basic_ostream<char>'}) 28 | cout << b[i][j] << cout; | ~~~~~~~~~~~~~~~ ^~ ~~~~ | | | | | basic_ostream<[...]> | basic_ostream<[...]> a.cc:28:29: note: candidate: 'operator<<(int, int)' (built-in) 28 | cout << b[i][j] << cout; | ~~~~~~~~~~~~~~~~^~~~~~~ a.cc:28:29: note: no known conversion for argument 2 from 'std::ostream' {aka 'std::basic_ostream<char>'} to 'int' In file included from /usr/include/c++/14/iostream:41, from a.cc:1: /usr/include/c++/14/ostream:116:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(__ostream_type& (*)(__ostream_type&)) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>]' 116 | operator<<(__ostream_type& (*__pf)(__ostream_type&)) | ^~~~~~~~ /usr/include/c++/14/ostream:116:36: note: no known conversion for argument 1 from 'std::ostream' {aka 'std::basic_ostream<char>'} to 'std::basic_ostream<char>::__ostream_type& (*)(std::basic_ostream<char>::__ostream_type&)' {aka 'std::basic_ostream<char>& (*)(std::basic_ostream<char>&)'} 116 | operator<<(__ostream_type& (*__pf)(__ostream_type&)) | ~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~ /usr/include/c++/14/ostream:125:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(__ios_type& (*)(__ios_type&)) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>; __ios_type = std::basic_ios<char>]' 125 | operator<<(__ios_type& (*__pf)(__ios_type&)) | ^~~~~~~~ /usr/include/c++/14/ostream:125:32: note: no known conversion for argument 1 from 'std::ostream' {aka 'std::basic_ostream<char>'} to 'std::basic_ostream<char>::__ios_type& (*)(std::basic_ostream<char>::__ios_type&)' {aka 'std::basic_ios<char>& (*)(std::basic_ios<char>&)'} 125 | operator<<(__ios_type& (*__pf)(__ios_type&)) | ~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~ /usr/include/c++/14/ostream:135:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(std::ios_base& (*)(std::ios_base&)) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>]' 135 | operator<<(ios_base& (*__pf) (ios_base&)) | ^~~~~~~~ /usr/include/c++/14/ostream:135:30: note: no known conversion for argument 1 from 'std::ostream' {aka 'std::basic_ostream<char>'} to 'std::ios_base& (*)(std::ios_base&)' 135 | operator<<(ios_base& (*__pf) (ios_base&)) | ~~~~~~~~~~~~^~~~~~~~~~~~~~~~~ /usr/include/c++/14/ostream:174:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(long int) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>]' 174 | operator<<(long __n) | ^~~~~~~~ /usr/include/c++/14/ostream:174:23: note: no known conversion for argument 1 from 'std::ostream' {aka 'std::basic_ostream<char>'} to 'long int' 174 | operator<<(long __n) | ~~~~~^~~ /usr/include/c++/14/ostream:178:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(long unsigned int) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>]' 178 | operator<<(unsigned long __n) | ^~~~~~~~ /usr/include/c++/14/ostream:178:32: note: no known conversion for argument 1 from 'std::ostream' {aka 'std::basic_ostream<char>'} to 'long unsigned int' 178 | operator<<(unsigned long __n) | ~~~~~~~~~~~~~~^~~ /usr/include/c++/14/ostream:182:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(bool) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>]' 182 | operator<<(bool __n) | ^~~~~~~~ /usr/include/c++/14/ostream:182:23: note: no known conversion for argument 1 from 'std::ostream' {aka 'std::basic_ostream<char>'} to 'bool' 182 | operator<<(bool __n) | ~~~~~^~~ In file included from /usr/include/c++/14/ostream:1022: /usr/include/c++/14/bits/ostream.tcc:96:5: note: candidate: 'std::basic_ostream<_CharT, _Traits>& std::basic_ostream<_CharT, _Traits>::operator<<(short int) [with _CharT = char; _Traits = std::char_traits<char>]' 96 | basic_ostream<_CharT, _Traits>:: | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /usr/include/c++/14/bits/ostream.tcc:97:22: note: no known conversion for argument 1 from 'std::ostream' {aka 'std::basic_ostream<char>'} to 'short int' 97 | operator<<(short __n) | ~~~~~~^~~ /usr/include/c++/14/ostream:189:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(short unsigned int) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>]' 189 | operator<<(unsigned short __n) | ^~~~~~~~ /usr/include/c++/14/ostream:189:33: note: no known conversion for argument 1 from 'std::ostream' {aka 'std::basic_ostream<char>'} to 'short unsigned int' 189 | operator<<(unsigned short __n) | ~~~~~~~~~~~~~~~^~~ /usr/include/c++/14/bits/ostream.tcc:110:5: note: candidate: 'std::basic_ostream<_CharT, _Traits>& std::basic_ostream<_CharT, _Traits>::operator<<(int) [with _CharT = char; _Traits = std::char_traits<char>]' 110 | basic_ostream<_CharT, _Traits>:: | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /usr/include/c++/14/bits/ostream.tcc:111:20: note: no known conversion for argument 1 from 'std::ostream' {aka 'std::basic_ostream<char>'} to 'int' 111 | operator<<(int __n) | ~~~~^~~ /usr/include/c++/14/ostream:200:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(unsigned int) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>]' 200 | operator<<(unsigned int __n) | ^~~~~~~~ /usr/include/c++/14/ostream:200:31: note: no known conversion for argument 1 from 'std::ostream' {aka 'std::basic_ostream<char>'} to 'unsigned int' 200 | operator<<(unsigned int __n) | ~~~~~~~~~~~~~^~~ /usr/include/c++/14/ostream:211:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(long long int) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>]' 211 | operator<<(long long __n) | ^~~~~~~~ /usr/include/c++/14/ostream:211:28: note: no known conversion for argument 1 from 'std::ostream' {aka 'std::basic_ostream<char>'} to 'long long int' 211 | operator<<(long long __n) | ~~~~~~~~~~^~~ /usr/include/c++/14/ostream:215:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(long long unsigned int) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>]' 215 | operator<<(unsigned long long __n) | ^~~~~~~~ /usr/include/c++/14/ostream:215:37: note: no known conversion for argument 1 from 'std::ostream' {aka 'std::basic_ostream<char>'} to 'long long unsigned int' 215 | operator<<(unsigned long long __n) | ~~~~~~~~~~~~~~~~~~~^~~ /usr/include/c++/14/ostream:231:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(double) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>]' 231 | operator<<(double __f) | ^~~~~~~~ /usr/include/c++/14/ostream:231:25: note: no known conversion for argument 1 from 'std::ostream' {aka 'std::basic_ostream<char>'} to 'double' 231 | operator<<(double __f) | ~~~~~~~^~~ /usr/include/c++/14/ostream:235:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(float) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>]' 235 | operator<<(float __f) | ^~~~~~~~ /usr/include/c++/14/ostream:235:24: note: no known conversion for argument 1 from 'std::ostream' {aka 'std::basic_ostream<char>'} to 'float' 235 | operator<<(float __f) | ~~~~~~^~~ /usr/include/c++/14/ostream:243:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(long double) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>]' 243 | operator<<(long double __f) | ^~~~~~~~ /usr/include/c++/14/ostream:243:30: note: no known conversion for argument 1 from 'std::ostream' {aka 'std::basic_ostream<char>'} to 'long double' 243 | operator<<(long double __f) | ~~~~~~~~~~~~^~~ /usr/include/c++/14/ostream:301:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(const void*) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>]' 301 | operator<<(const void* __p) | ^~~~~~~~ /usr/include/c++/14/ostream:301:30: note: no known conversion for argument 1 from 'std::ostream' {aka 'std::basic_ostream<char>'} to 'const void*' 301 | operator<<(const void* __p) |
s598600294
p03712
C++
#include <iostream> #include <string> #include <queue> #include <stack> #include <algorithm> #include <list> #include <vector> #include <complex> #include <utility> #include <cstdio> #include <cstdlib> #include <cstring> #include <cmath> #include <climits> #include <bitset> #include <ctime> #include <map> #include <unordered_map> #include <set> #include <unordered_set> #include <cassert> #include <cstddef> #include <iomanip> #include <numeric> #include <tuple> #include <sstream> #include <fstream> #include <chrono> #include <random> using namespace std; #define REP(i, n) for (int (i) = 0; (i) < (n); (i)++) #define FOR(i, a, b) for (int (i) = (a); (i) < (b); (i)++) #define RREP(i, a) for(int (i) = (a) - 1; (i) >= 0; (i)--) #define FORR(i, a, b) for(int (i) = (a) - 1; (i) >= (b); (i)--) #define DEBUG(C) cerr << #C << " = " << C << endl; using LL = long long; using VI = vector<int>; using VVI = vector<VI>; using VL = vector<LL>; using VVL = vector<VL>; using VD = vector<double>; using VVD = vector<VD>; using PII = pair<int, int>; using PDD = pair<double, double>; using PLL = pair<LL, LL>; using VPII = vector<PII>; template<typename T> using VT = vector<T>; #define ALL(a) begin((a)), end((a)) #define RALL(a) rbegin((a)), rend((a)) #define SORT(a) sort(ALL((a))) #define RSORT(a) sort(RALL((a))) #define REVERSE(a) reverse(ALL((a))) #define MP make_pair #define FORE(a, b) for (auto &&a : (b)) #define FIND(s, e) ((s).find(e) != (s).end()) #define EB emplace_back template<typename T>inline bool chmax(T &a, T b){return (a < b ? a = b, true : false);} template<typename T>inline bool chmin(T &a, T b){return (a > b ? a = b, true : false);} const int INF = 1e9; const int MOD = INF + 7; const LL LLINF = 1e18; const long double EPS = 1e-9; int main() { int h, w; cin >> h >> w; vector<string> S(h); for (int i = 0; i < h; ++i) { cin >> S[i]; } cout << string(W + 2, '#') << endl; for (int i = 0; i < H; ++i) { cout << "#" << S[i] << "#" << endl; } cout << string(W + 2, '#') << endl; }
a.cc: In function 'int main()': a.cc:73:24: error: 'W' was not declared in this scope 73 | cout << string(W + 2, '#') << endl; | ^ a.cc:74:29: error: 'H' was not declared in this scope 74 | for (int i = 0; i < H; ++i) { | ^
s242350680
p03712
C++
#include <iostream> #include <string> #include <queue> #include <stack> #include <algorithm> #include <list> #include <vector> #include <complex> #include <utility> #include <cstdio> #include <cstdlib> #include <cstring> #include <cmath> #include <climits> #include <bitset> #include <ctime> #include <map> #include <unordered_map> #include <set> #include <unordered_set> #include <cassert> #include <cstddef> #include <iomanip> #include <numeric> #include <tuple> #include <sstream> #include <fstream> #include <chrono> #include <random> using namespace std; #define REP(i, n) for (int (i) = 0; (i) < (n); (i)++) #define FOR(i, a, b) for (int (i) = (a); (i) < (b); (i)++) #define RREP(i, a) for(int (i) = (a) - 1; (i) >= 0; (i)--) #define FORR(i, a, b) for(int (i) = (a) - 1; (i) >= (b); (i)--) #define DEBUG(C) cerr << #C << " = " << C << endl; using LL = long long; using VI = vector<int>; using VVI = vector<VI>; using VL = vector<LL>; using VVL = vector<VL>; using VD = vector<double>; using VVD = vector<VD>; using PII = pair<int, int>; using PDD = pair<double, double>; using PLL = pair<LL, LL>; using VPII = vector<PII>; template<typename T> using VT = vector<T>; #define ALL(a) begin((a)), end((a)) #define RALL(a) rbegin((a)), rend((a)) #define SORT(a) sort(ALL((a))) #define RSORT(a) sort(RALL((a))) #define REVERSE(a) reverse(ALL((a))) #define MP make_pair #define FORE(a, b) for (auto &&a : (b)) #define FIND(s, e) ((s).find(e) != (s).end()) #define EB emplace_back template<typename T>inline bool chmax(T &a, T b){return (a < b ? a = b, true : false);} template<typename T>inline bool chmin(T &a, T b){return (a > b ? a = b, true : false);} const int INF = 1e9; const int MOD = INF + 7; const LL LLINF = 1e18; const long double EPS = 1e-9; int main() { int h, w; cin >> h >> w; vector<string> S(h); for (int i = 0; i < h; ++i) { cin >> S[i]; } cout << string(W + 1, '#') << endl; for (int i = 0; i < H; ++i) { cout << "#" << S[i] << "#" << endl; } cout << string(W + 1, '#') << endl; }
a.cc: In function 'int main()': a.cc:73:24: error: 'W' was not declared in this scope 73 | cout << string(W + 1, '#') << endl; | ^ a.cc:74:29: error: 'H' was not declared in this scope 74 | for (int i = 0; i < H; ++i) { | ^
s069561555
p03712
C++
#include <iostream> #include<algorithm> #include <vector> #include <complex> #include <map> using namespace std; int main() { int a,b; cin>>a>>b; int s[a+1][b+1]; s[0][0]="#"; s[a+1][b+1]="#"; for(int i=1;i<=a;++i){ for(int j=1;j<=b;++i){ cin>>s[i][j]; } } for(int i=0;i<a+1;++i){ for(int j=0;j<b+1;++i){ cout<<s[i][j]<<endl; } } return 0; }
a.cc: In function 'int main()': a.cc:12:17: error: invalid conversion from 'const char*' to 'int' [-fpermissive] 12 | s[0][0]="#"; | ^~~ | | | const char* a.cc:13:21: error: invalid conversion from 'const char*' to 'int' [-fpermissive] 13 | s[a+1][b+1]="#"; | ^~~ | | | const char*
s527877936
p03712
C++
#include<stdio.h> int mian(void){ int H,W; int i,j; char word[100][100]; scanf("%d %d",&H,&W); for(i = 0;i <H; i++ ){ for(j =0 ; j<W; j++){ scanf("%c",&word[i][j]); } } for(i=0;i<=H+1;i++){ for(j=0;j<=W+1;j++){ if(i == 0 || i == H){ printf("#"); }else{ if(j == 0 || j == W+1){ prinf("*"); } printf("%c",word[i-1][j]); } } printf("\n"); } return 0; }
a.cc: In function 'int mian()': a.cc:27:25: error: 'prinf' was not declared in this scope; did you mean 'printf'? 27 | prinf("*"); | ^~~~~ | printf
s630041483
p03712
C
#include<stdio.h> #define MAX 100 int main() { int x, y; int z; int i, j; int q, r; int check=0; char str[MAX][MAX]; q = scanf("%d %d", &x, &y); while(check<x) { r=fscanf(stdin, " "); (char *)r = fgets(str[check],sizeof(y),stdin); if (check < x) { check++; } } /* for (i = 0; i < x; i++) { for (j = 0; j < y; j++) { printf("%c", str[i][j]); } } */ for (i = 0; i < y + 2; i++) { printf("#"); } printf("\n"); for (i = 0; i < x; i++) { printf("#"); for (j = 0; j < y; j++) { printf("%c", str[i][j]); } printf("#\n"); } for (i = 0; i < y + 2; i++) { printf("#"); } return 0; }
main.c: In function 'main': main.c:17:17: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast] 17 | (char *)r = fgets(str[check],sizeof(y),stdin); | ^ main.c:17:27: error: lvalue required as left operand of assignment 17 | (char *)r = fgets(str[check],sizeof(y),stdin); | ^
s752369266
p03712
C++
#include<bits/stdc++.h> using namespace std; char c[105][105] int main() { int w,h; cin>>w>>h; for(int i=0;i<h+2;i++) cout<<'#'; cout<<endl; for(int i=0;i<w;i++) cin>>c[i]; for(int i=0;i<w;i++) cout<<'#'<<c[i]<<'#'<<endl; for(int i=0;i<h+2;i++) cout<<'#'; cout<<endl; }
a.cc:4:1: error: expected initializer before 'int' 4 | int main() | ^~~
s900080137
p03712
C++
nums = [int(x) for x in input().split()] pic = [] for i in range(nums[0]): line = input() pic.append(line) for i in range(nums[1]+2): print("#", end="") print("\n", end="") for words in pic: print("#", end="") print(words, end="") print("#") for i in range(nums[1]+2): print("#", end="") print("\n", end="")
a.cc:1:1: error: 'nums' does not name a type 1 | nums = [int(x) for x in input().split()] | ^~~~
s949977724
p03712
C++
// // main.cpp // B_PictureFrame // // Created by user1 on 2017/05/20. // Copyright © 2017年 user1. All rights reserved. // #include <iostream> int H, W; char a[100+ 2][100 + 2]; void init(){ for(int h = 0; h<100+2; h++){ for(int w=0; w<100+2; w++){ a[h][w] = '0'; } } } void input(){ std::cin >> H; std::cin >> W; //入力 std::string buff; int ind = 0; //読み捨て std::getline(std::cin, buff); while(std::cin){ getline(std::cin, buff); //Char array's index is offset +1 for head "#". strcpy(&(a[ind+1][1]), buff.c_str()); if(ind >= H) break; ind ++; } } void solve(){ //add "#" head and tail. for(int i=0; i<W+2; i++){ a[0][i] = '#'; a[H+1][i] = '#'; } for(int i=0; i<H+2; i++){ a[i][0] = '#'; a[i][W+1] = '#'; } } void show(){ for(int h = 0; h<H+2; h++){ for(int w=0; w<W+2; w++){ printf("%c ", a[h][w]); }printf("\n"); } } int main(int argc, const char * argv[]) { // insert code here... init(); input(); //show(); solve(); show(); return 0; }
a.cc: In function 'void input()': a.cc:32:9: error: 'strcpy' was not declared in this scope 32 | strcpy(&(a[ind+1][1]), buff.c_str()); | ^~~~~~ a.cc:10:1: note: 'strcpy' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>' 9 | #include <iostream> +++ |+#include <cstring> 10 | int H, W;
s682183219
p03712
C++
#include<cstdio> int main() { char a[100][100]; int H,W; while (scanf("%d %d",&H,&W)==2) { getchar(); for (int i=1;i<=H;i++) { gets(a[i]); } for (int i=0;i<=H+1;i++) { for (int j=0;j<=W+1;j++) { if (i==0||j==0||i==H+1||j==W+1)printf("#"); else printf("%c",a[i][j-1]); } printf("\n"); } } return 0; }
a.cc: In function 'int main()': a.cc:11:13: error: 'gets' was not declared in this scope; did you mean 'getw'? 11 | gets(a[i]); | ^~~~ | getw
s940423431
p03712
C++
#pragma region ヘッダー #define _CRT_SECURE_NO_WARNINGS #ifdef _____MY_DEBUG_____ #define VS_ENDPAUSE() (system("pause")) #else #define VS_ENDPAUSE() #endif #include <stdio.h> #include <iostream> #include <math.h> #include <cmath> #include <vector> #include <algorithm> using namespace std; typedef signed char int8; typedef signed short int16; typedef signed int int32; typedef signed long long int64; typedef unsigned char uint8; typedef unsigned short uint16; typedef unsigned int uint32; typedef unsigned long long uint64; #if 0 #define INT8_MIN (-127) #define INT8_MAX ( 128) #define UINT8_MAX ( 255) #define INT16_MIN (-32768) #define INT16_MAX ( 32767) #define UINT16_MAX ( 65535) #define INT32_MIN (-2147483648) // -2 * 10^9 #define INT32_MAX ( 2147483647) // 2 * 10^9 #define UINT32_MAX ( 4294967295) // 4 * 10^9 #define INT64_MIN (-9223372036854775808) // -9 * 10^18 #define INT64_MAX ( 9223372036854775807) // 9 * 10^18 #define UINT64_MAX ( 18446744073709551615) // 18 * 10^18 #endif void func(void); #pragma endregion int main(void) { func(); VS_ENDPAUSE(); return 0; } void func(void) { char a[102][102]; memset(a, '#', sizeof(a)); int32 h, w; scanf("%d %d", &h, &w); a[0][w+2] = '\0'; for(int j=1; j<=h; j++){ scanf("%s", &a[j][1]); a[j][w+1] = '#'; a[j][w+2] = '\0'; } a[h+1][w+2] = '\0'; for(int j=0; j<h+2; j++){ printf("%s\n", a[j]); } }
a.cc: In function 'void func()': a.cc:58:9: error: 'memset' was not declared in this scope 58 | memset(a, '#', sizeof(a)); | ^~~~~~ a.cc:16:1: note: 'memset' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>' 15 | #include <algorithm> +++ |+#include <cstring> 16 |
s724045925
p03712
C++
#pragma region ヘッダー #define _CRT_SECURE_NO_WARNINGS #ifdef _____MY_DEBUG_____ #define VS_ENDPAUSE() (system("pause")) #else #define VS_ENDPAUSE() #endif #include <stdio.h> #include <iostream> #include <math.h> #include <cmath> #include <vector> #include <algorithm> using namespace std; typedef signed char int8; typedef signed short int16; typedef signed int int32; typedef signed long long int64; typedef unsigned char uint8; typedef unsigned short uint16; typedef unsigned int uint32; typedef unsigned long long uint64; #define INT8_MIN (-127) #define INT8_MAX ( 128) #define UINT8_MAX ( 255) #define INT16_MIN (-32768) #define INT16_MAX ( 32767) #define UINT16_MAX ( 65535) #define INT32_MIN (-2147483648) // -2 * 10^9 #define INT32_MAX ( 2147483647) // 2 * 10^9 #define UINT32_MAX ( 4294967295) // 4 * 10^9 #define INT64_MIN (-9223372036854775808) // -9 * 10^18 #define INT64_MAX ( 9223372036854775807) // 9 * 10^18 #define UINT64_MAX ( 18446744073709551615) // 18 * 10^18 void func(void); #pragma endregion int main(void) { func(); VS_ENDPAUSE(); return 0; } void func(void) { char a[102][102]; memset(a, '#', sizeof(a)); int32 h, w; scanf("%d %d", &h, &w); a[0][w+2] = '\0'; for(int j=1; j<=h; j++){ scanf("%s", &a[j][1]); a[j][w+1] = '#'; a[j][w+2] = '\0'; } a[h+1][w+2] = '\0'; for(int j=0; j<h+2; j++){ printf("%s\n", a[j]); } }
a.cc: In function 'void func()': a.cc:57:9: error: 'memset' was not declared in this scope 57 | memset(a, '#', sizeof(a)); | ^~~~~~ a.cc:16:1: note: 'memset' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>' 15 | #include <algorithm> +++ |+#include <cstring> 16 |
s820063948
p03712
C++
#include<iostream> #include<string> using namespace std; char str[102][102], c; int H, W; int main(){ cin >> H >> W; for(int l = 0; l < H+2; l++){ for(int m = 0; m < W+2){ if(l == 0 || l == H+1 || m == 0 || m == W+1){ str[m][l] = '#'; }else{ cin >> c; str[m][l] = c; } } } for(int l = 0; l < H+2; l++){ for(int m = 0; m < W+2){ cout << str[m][l]; } cout << endl; } return 0; }
a.cc: In function 'int main()': a.cc:13:39: error: expected ';' before ')' token 13 | for(int m = 0; m < W+2){ | ^ | ; a.cc:24:39: error: expected ';' before ')' token 24 | for(int m = 0; m < W+2){ | ^ | ;
s933005163
p03712
C++
#include<sstream> #include<fstream> #include<stdio.h> #include<algorithm> #include<string.h> #include<string> #include<queue> #include<set> #include<vector> #include<cmath> #include<ctime> #include<locale> using namespace std; char c[101][101]; int main() { long a,b; scanf("%d%d",&a,&b);gets(c[0]); for(long i=0;i<a;i++) gets(c[i]); for(long i=0;i<b+2;i++)printf("#");printf("\n"); for(long i=0;i<a;i++) { printf("#"); for(long j=0;j<b;j++) printf("%c",c[i][j]); printf("#"); printf("\n"); } for(long i=0;i<b+2;i++)printf("#"); return 0; }
a.cc: In function 'int main()': a.cc:19:25: error: 'gets' was not declared in this scope; did you mean 'getw'? 19 | scanf("%d%d",&a,&b);gets(c[0]); | ^~~~ | getw
s805626588
p03712
C++
#include<iostream> #include<sstream> #include<fstream> #include<stdio.h> #include<algorithm> #include<string.h> #include<string> #include<queue> #include<set> #include<vector> #include<cmath> #include<ctime> #include<locale> using namespace std; char c[101][101]; int main() { long a,b; cin>>a>>b;gets(c[0]); for(long i=0;i<a;i++) gets(c[i]); for(long i=0;i<b+2;i++)printf("#");printf("\n"); for(long i=0;i<a;i++) { printf("#"); for(long j=0;j<b;j++) printf("%c",c[i][j]); printf("#"); printf("\n"); } for(long i=0;i<b+2;i++)printf("#"); return 0; }
a.cc: In function 'int main()': a.cc:19:15: error: 'gets' was not declared in this scope; did you mean 'getw'? 19 | cin>>a>>b;gets(c[0]); | ^~~~ | getw
s679491386
p03713
C++
#include <bits/stdc++.h> using namespace std; typedef long long int ll; typedef vector<int> vi; typedef pair<int, int> pi; typedef vector<ll> vl; typedef long double ld; #define txt \ freopen("ip.txt", "r", stdin); \ freopen("op.txt", "w", stdout) #define a3 INT_MAX #define i3 INT_MIN #define a6 INT64_MAX #define i6 INT64_MIN #define F first #define S second #define pb push_back #define sz(v) (int)v.size() #define fo(i, n) for (int i = 0; i < (int)n; i++) #define rep(i, k, n) for (int i = k < (int)n ? k : k - 1; k < (int)n ? i < (int)n : i >= (int)n; k < (int)n ? i += 1 : i -= 1) #define quickie \ ios_base::sync_with_stdio(false); \ cin.tie(NULL); #define deb(x) cout << (#x) << " " << (x) << "\n"; #define newl cout << "\n" #define all(s) s.begin(), s.end() #define pi 3.14159265358979323846 #define fp(x) fixed << setprecision(x) << vector<int> arr; vector<ll> ar; template <class T> bool div2(T a) { return !(a & 1); } template <class T> T mod(T a) { if (a < 0) { a += 1000000007; } return a % 1000000007; } template <class T> T addmod(T a, T b) { return (mod(a) + mod(b)) % 1000000007; } template <class T> T prodmod(T a, T b) { return (mod(a) * mod(b)) % 1000000007; } template <class T> T bin_exp(T a, T b) { T res = 1; T temp = 1; if (b <= 1) return a; if (b % 2 == 0) res = bin_exp(a * a, b / 2); else { res *= a; temp = bin_exp(a, --b); } return res * temp; } template <class T> T bin_expmod(T a, T b) { T res = 1; T temp = 1; if (b <= 1) return a; if (b % 2 == 0) res = bin_expmod(prodmod(a, a), b / 2); else { res = prodmod(a, res); temp = bin_exp(a, --b); } return prodmod(res, temp); } template <class T> int digits(T a) { vector<long long> dig = { 0, 9, 99, 999, 9999, 99999, 999999, 9999999, 99999999, 999999999, 9999999999, 99999999999, 999999999999, 9999999999999, 99999999999999, 999999999999999, 9999999999999999, 99999999999999999, 999999999999999999, INT64_MAX}; auto it = lower_bound(dig.begin(), dig.end(), a); int idx = (it - dig.begin()); return idx; } template <class T> int sumAllInts(T n) { int a = 1; int su = 0; while (n) { su += n % 10; n /= 10; } return su; } template <class T> void split(char c, T s) { int n = s.size(); int i = 0; while ((cout << s[i], i += 1) && (i < n) && (cout << c << ' ')) ; } template <class T> ll fib(T a) { return ((a * (a + 1)) / 2); } template <class T> ll nC2(T a) { return ((a * (a - 1)) / 2); } //fxns : div2, mod, addmod, prodmod, bin_expmod, bin_exp // digits, sumAllInts, split, fib, nC2, ll calc(ll wid,ll high){ ll w1 = wid/2; ll w2 = wid - w1; ll diff = a3; for (ll i = 1; i < high; i++) { ll t1 = (high - i)*wid; ll t2 = w1*i; ll t3 = w2*i; ll mi = min(t1,min(t2,t3)); ll ma = max(t1,max(t2,t3)); diff = min(diff,abs(ma - mi)); } return diff; } void solve(ll &t) { ll h, w; cin >> h >> w; if(h == 1 || w == 1){ cout<<1; return; } else if (h % 3 == 0 || w % 3 == 0) { cout << 0; return; } else { ll ans1 = calc(w,h); ll ans2 = calc(h,w); cout<<min(ans1,ans2); } } int main() { quickie; //txt; //freopen("ip.txt", "r", stdin); int t; t = 0; if (t) cin >> t; else t = 1; while (t--) { solve(t); newl; } //cerr << "Time elapsed: " << 1.0 * clock() / CLOCKS_PER_SEC << " s."<<endl; return 0; }
a.cc: In function 'int main()': a.cc:203:15: error: cannot bind non-const lvalue reference of type 'll&' {aka 'long long int&'} to a value of type 'int' 203 | solve(t); | ^ a.cc:168:16: note: initializing argument 1 of 'void solve(ll&)' 168 | void solve(ll &t) | ~~~~^
s226851892
p03713
C++
#include <iostream> using namespace std; const long long INF = 9223372036854775807; struct data { long long min = INF, max = 0; data &update(long long x) { if (x < min) min = x; if (x > max) max = x; return *this; } long long diff() const { return max - min; } }; data operator^(const data &a, const data &b) { return a.diff() <= b.diff() ? a : b; } data dfs(long long h, long long w, int n) { if (n == 1) { long long S = h * w; return {S, S}; } return dfs(h - h / n, w, n - 1).update(h / n * w) ^ dfs(h - (h / n + 1), w, n - 1).update((h / n + 1) * w) ^ dfs(h, w - w / n, n - 1).update(h * (w / n)) ^ dfs(h, w - (w / n + 1), n - 1).update(h * (w / n + 1)); } int main() { int H, W; cin >> H >> W; cout << dfs(H, W, 3).diff() << endl; }
a.cc:19:1: error: reference to 'data' is ambiguous 19 | data operator^(const data &a, const data &b) { | ^~~~ In file included from /usr/include/c++/14/string:53, from /usr/include/c++/14/bits/locale_classes.h:40, from /usr/include/c++/14/bits/ios_base.h:41, from /usr/include/c++/14/ios:44, from /usr/include/c++/14/ostream:40, from /usr/include/c++/14/iostream:41, from a.cc:1: /usr/include/c++/14/bits/range_access.h:344:5: note: candidates are: 'template<class _Tp> constexpr const _Tp* std::data(initializer_list<_Tp>)' 344 | data(initializer_list<_Tp> __il) noexcept | ^~~~ /usr/include/c++/14/bits/range_access.h:334:5: note: 'template<class _Tp, long unsigned int _Nm> constexpr _Tp* std::data(_Tp (&)[_Nm])' 334 | data(_Tp (&__array)[_Nm]) noexcept | ^~~~ /usr/include/c++/14/bits/range_access.h:323:5: note: 'template<class _Container> constexpr decltype (__cont.data()) std::data(const _Container&)' 323 | data(const _Container& __cont) noexcept(noexcept(__cont.data())) | ^~~~ /usr/include/c++/14/bits/range_access.h:312:5: note: 'template<class _Container> constexpr decltype (__cont.data()) std::data(_Container&)' 312 | data(_Container& __cont) noexcept(noexcept(__cont.data())) | ^~~~ a.cc:7:8: note: 'struct data' 7 | struct data { | ^~~~ a.cc:23:1: error: reference to 'data' is ambiguous 23 | data dfs(long long h, long long w, int n) { | ^~~~ /usr/include/c++/14/bits/range_access.h:344:5: note: candidates are: 'template<class _Tp> constexpr const _Tp* std::data(initializer_list<_Tp>)' 344 | data(initializer_list<_Tp> __il) noexcept | ^~~~ /usr/include/c++/14/bits/range_access.h:334:5: note: 'template<class _Tp, long unsigned int _Nm> constexpr _Tp* std::data(_Tp (&)[_Nm])' 334 | data(_Tp (&__array)[_Nm]) noexcept | ^~~~ /usr/include/c++/14/bits/range_access.h:323:5: note: 'template<class _Container> constexpr decltype (__cont.data()) std::data(const _Container&)' 323 | data(const _Container& __cont) noexcept(noexcept(__cont.data())) | ^~~~ /usr/include/c++/14/bits/range_access.h:312:5: note: 'template<class _Container> constexpr decltype (__cont.data()) std::data(_Container&)' 312 | data(_Container& __cont) noexcept(noexcept(__cont.data())) | ^~~~ a.cc:7:8: note: 'struct data' 7 | struct data { | ^~~~ a.cc: In function 'int main()': a.cc:39:11: error: 'dfs' was not declared in this scope 39 | cout << dfs(H, W, 3).diff() << endl; | ^~~
s732572309
p03713
C++
#include<iostream> #include<string> #include<map> using namespace std; typedef long long ll; const int Max = 1e5 + 5; int lst[Max]; int main() { ll x, y; cin >> y >> x; ll res = 1e18+5; for (int i = 1;i <= x - 1;i++) { ll a = (x - i) * y; ll b = i * (y / 2); ll c = x * y - a - b; res = min(res, max(a, max(b, c)) - min(a, min(b, c))); ll a = x * y; ll b = (x-i) * (y / 2); ll c = x * y - a - b; res = min(res, max(a, max(b, c)) - min(a, min(b, c))); } for (int i = 1;i <= y - 1;i++) { ll a = (y - i) * x; ll b = i * (x / 2); ll c = x * y - a - b; res = min(res, max(a, max(b, c)) - min(a, min(b, c))); ll a = y * x; ll b = (y-i) * (x / 2); ll c = x * y - a - b; res = min(res, max(a, max(b, c)) - min(a, min(b, c))); } if (x % 3 == 0 || y % 3 == 0)res = 0; cout << res; }
a.cc: In function 'int main()': a.cc:20:20: error: redeclaration of 'll a' 20 | ll a = x * y; | ^ a.cc:16:20: note: 'll a' previously declared here 16 | ll a = (x - i) * y; | ^ a.cc:21:20: error: redeclaration of 'll b' 21 | ll b = (x-i) * (y / 2); | ^ a.cc:17:20: note: 'll b' previously declared here 17 | ll b = i * (y / 2); | ^ a.cc:22:20: error: redeclaration of 'll c' 22 | ll c = x * y - a - b; | ^ a.cc:18:20: note: 'll c' previously declared here 18 | ll c = x * y - a - b; | ^ a.cc:31:20: error: redeclaration of 'll a' 31 | ll a = y * x; | ^ a.cc:27:20: note: 'll a' previously declared here 27 | ll a = (y - i) * x; | ^ a.cc:32:20: error: redeclaration of 'll b' 32 | ll b = (y-i) * (x / 2); | ^ a.cc:28:20: note: 'll b' previously declared here 28 | ll b = i * (x / 2); | ^ a.cc:33:20: error: redeclaration of 'll c' 33 | ll c = x * y - a - b; | ^ a.cc:29:20: note: 'll c' previously declared here 29 | ll c = x * y - a - b; | ^
s682853012
p03713
C++
#include <bits/stdc++.h> using namespace std; #define rep(i, n) for (int i = 0; i < (int)(n); i++) #define rrep(i, n) for(int i = n-1; i >= 0; i--) #define all(x) (x).begin(),(x).end() // 昇順ソート #define rall(v) (v).rbegin(), (v).rend() // 降順ソート #define FastIO ios_base::sync_with_stdio(0),cin.tie(0),cout.tie(0) typedef long long ll; using P = pair<int,int>; using VI = vector<int>; using VVI = vector<vector<int>>; using VL = vector<ll>; using VVL = vector<vector<ll>>; using VP = vector<P>; template<class T> bool chmax(T &a, const T &b) { if (a<b) { a=b; return true; } return false; } template<class T> bool chmin(T &a, const T &b) { if (a>b) { a=b; return true; } return false; } const ll INF = 1LL<<60; int main(){ ll h, w; cin >> h >> w; if (h % 3 == 0 || w % 3 == 0){ cout << 0 << endl; return 0; } ll ans = INF; rep(i, 2){ swap(h, w); for(ll r = (h/3) - 100; r <= (h/3) + 100; r++){ for(ll c = (w/2) - 100; c <= (w/2) + 100; c++){ if (r <= 0 || c <= 0 || r >= h || c >= w) continue; ll sq1 = r * w; ll sq2 = (h-r) * c; ll sq3 = (h-r) * (w-c); ll mx = max({sq1, sq2, sq3}); ll mn = min({sq1, sq2, sq3}); ans = min(ans, mx - mn); } } } rep(i, 2){ swap(h, w); ll sq1 = (h/3) * w; ll sq2 = (h - ((h/3) * 2)) * w; ll mx = max(sq1, sq2); ll mn = min(sq1, sq2); ans = min(ans, mx-mn); } for(ll r = h/3) cout << ans << endl; return 0; }
a.cc: In function 'int main()': a.cc:52:19: error: expected ';' before ')' token 52 | for(ll r = h/3) | ^ | ; a.cc:52:19: error: expected primary-expression before ')' token a.cc:52:19: error: expected ';' before ')' token 52 | for(ll r = h/3) | ^ | ;
s054452346
p03713
C++
#include <bits/stdc++.h> #define rep(i,n) for (int i = 0; i < (n); ++i) using namespace std; typedef long long ll; int main() { ll h,w;cin>>h>>w; if(h%3==0 || w%3==0){ cout<<0<<endl; } else{ ll ans = h*w; rep(i,h-1){ ll ws=w/2; ll tmp=max((h-i-1)*w-abs(i+1)*ws,abs((h-i-1)*w-(i+1)*(w-ws))) ans=min(tmp,ans); } rep(i,w){ ll hs=h/2; ll tmp=max((w-i-1)*h-abs(i+1)*hs,abs((w-i-1)*h-(i+1)*(h-hs))) ans=min(tmp,ans); } ans=min(ans,h); ans=min(ans,w); cout<<ans<<endl; } return 0; }
a.cc: In function 'int main()': a.cc:16:13: error: expected ',' or ';' before 'ans' 16 | ans=min(tmp,ans); | ^~~ a.cc:21:13: error: expected ',' or ';' before 'ans' 21 | ans=min(tmp,ans); | ^~~
s898551412
p03713
C++
#include <bits/stdc++.h> using namespace std; typedef long long ll; ll func(ll x, ll y, ll z) { ll maxV = max({ x,y,z }); ll minV = min({ x,y,z }); return maxV - minV; } ll main() { ll h, w; cin >> h >> w; ll ans = 2147483647; for (ll y = 1; y <= h - 1; y++) { ll sa, sb, sc; sb = w / 2 * (h - y); sc = (w - w / 2) * (h - y); ans = min(ans, func(sa, sb, sc)); if (y == h - 1) continue; sa = y * w; sb = (h - y) / 2 * w; sc = (h - (y + (h - y) / 2)) * w; ans = min(ans, func(sa, sb, sc)); } swap(h, w); for (ll y = 1; y <= h - 1; y++) { ll sa, sb, sc; sb = w / 2 * (h - y); sc = (w - w / 2) * (h - y); ans = min(ans, func(sa, sb, sc)); if (y == h - 1) continue; sa = y * w; sb = (h - y) / 2 * w; sc = (h - (y + (h - y) / 2)) * w; ans = min(ans, func(sa, sb, sc)); } cout << ans << endl; return 0; }
a.cc:11:1: error: '::main' must return 'int' 11 | ll main() { | ^~
s380099368
p03713
C++
/*------------------------------------ ........Bismillahir Rahmanir Rahim.... ..........created by Abdul Aziz....... ------------------------------------*/ #include <iostream> #include <algorithm> #include <stdio.h> #include <cmath> #include <vector> #include <set> #include <map> #include <cstring> #include <unordered_map> #include <queue> #define mod 998244353 #define int long long #define ld long double #define pb push_back #define vi vector<int> #define dbg(x) cerr << #x << " = " << x << '\n' #define sz(x) (int)x.size() #define ff first #define ss second #define pii pair<int,int> using namespace std; int fun(int a,int b,int c){ int d = (max(a,max(b,c)) - min(a,min(b,c))); return d; } int solve(int w,int h){ int ans = min(w,h) ; for (int i=1,j=w-1;i<=j;i++,j--){ int a = i*h; int b = (h/2) * j; int c = (h * w) - a - b ; ans = min(ans,fun(a,b,c)); } return ans ; } signed main() { int w,h; cin>>w>>h; if (w%3==0 or h%3==0) { cout << 0 << endl; return 0; } int ans1= solve(w,h); // int ans2= solve(h,w); cout << min(ans1,ans2) << endl; return 0; }
a.cc: In function 'int main()': a.cc:53:22: error: 'ans2' was not declared in this scope; did you mean 'ans1'? 53 | cout << min(ans1,ans2) << endl; | ^~~~ | ans1
s277161734
p03713
C++
#include <bits/stdc++.h> using namespace std; typedef long long int ll; typedef long double ld; #define MOD 1000000007 #define ALL(obj) (obj).begin(),(obj).end() template<class T>inline bool chmax(T& a,T b){if (a<b){a=b;return 1;}return 0;} template<class T>inline bool chmin(T& a,T b){if (a>b){a=b;return 1;}return 0;} const long long INF = 1LL << 60; bool pairCompare(const pair<double,ll>& firstElof, const pair<double,ll>& secondElof){ return firstElof.first < secondElof.first; } bool pairCompareSecond(const pair<double,ll>& firstElof, const pair<double,ll>& secondElof){ return firstElof.second < secondElof.second; } //四方向への移動ベクトル const int dx[4] = {1, 0, -1, 0}; const int dy[4] = {0, 1, 0, -1}; struct edge{//グラフに使うヤツ ll from,to,cost; }; typedef vector<vector<edge> > G; ll gcd(ll a,ll b){ if (a%b==0)return(b); else return(gcd(b,a%b)); } int main() { ll h,w; cin >> h >> w; ll ans=min(h,w); if (h>=2){ ll x=h/2,y=h/2+h%2; for (ll i=0;i<w;i++){ ll a=x*i,b=y*i,c=(w-i)*h; ans=min(ans,max(a,b,c)-min(a,b,c)); } } if (w>=2){ ll x=w/2,y=w/2+w%2; for (ll i=0;i<h;i++){ ll a=x*i,b=y*i,c=(h-i)*w; ans=min(ans,max(a,b,c)-min(a,b,c)); } } cout << ans << endl; return 0; }
In file included from /usr/include/c++/14/algorithm:60, from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:51, from a.cc:1: /usr/include/c++/14/bits/stl_algobase.h: In instantiation of 'constexpr const _Tp& std::max(const _Tp&, const _Tp&, _Compare) [with _Tp = long long int; _Compare = long long int]': a.cc:38:28: required from here 38 | ans=min(ans,max(a,b,c)-min(a,b,c)); | ~~~^~~~~~~ /usr/include/c++/14/bits/stl_algobase.h:306:17: error: '__comp' cannot be used as a function 306 | if (__comp(__a, __b)) | ~~~~~~^~~~~~~~~~ /usr/include/c++/14/bits/stl_algobase.h: In instantiation of 'constexpr const _Tp& std::min(const _Tp&, const _Tp&, _Compare) [with _Tp = long long int; _Compare = long long int]': a.cc:38:39: required from here 38 | ans=min(ans,max(a,b,c)-min(a,b,c)); | ~~~^~~~~~~ /usr/include/c++/14/bits/stl_algobase.h:284:17: error: '__comp' cannot be used as a function 284 | if (__comp(__b, __a)) | ~~~~~~^~~~~~~~~~
s590149018
p03713
C++
include <bits/stdc++.h> using namespace std; int main(){ long long h, w; cin >> h >> w; long long ans = h*w; vector<long long> area(3); // 回転前と回転後の2通りを試す for (int i = 0; i < 2; i++){ // 1つの長方形の辺の長さを全探索する for (long long t = 1; t < h; t++){ // 縦割りを試す area[0] = t * w; area[1] = (h-t)*(w/2); area[2] = h*w - area[0] - area[1]; // 最後の面積は, 全体の面積から, それまでに計算した面積2つを引けば良い sort(area.begin(),area.end()); ans = min (ans, area[2]-area[0]); // mmax - minと現在までの答えを比較せよ // 横割りを試す area[0] = t*w; area[1] = ((h-t)/2) * w; area[2] = h*w - area[0] - area[1]; sort(area.begin(),area.end()); ans = min(ans, area[2]-area[0]); // mmax - minと現在までの答えを比較せよ } // チョコレートの回転を忘れない!!! swap(h,w); } cout << ans << endl; return 0; }
a.cc:1:1: error: 'include' does not name a type 1 | include <bits/stdc++.h> | ^~~~~~~ a.cc: In function 'int main()': a.cc:7:5: error: 'cin' was not declared in this scope 7 | cin >> h >> w; | ^~~ a.cc:11:5: error: 'vector' was not declared in this scope 11 | vector<long long> area(3); | ^~~~~~ a.cc:11:12: error: expected primary-expression before 'long' 11 | vector<long long> area(3); | ^~~~ a.cc:20:13: error: 'area' was not declared in this scope 20 | area[0] = t * w; | ^~~~ a.cc:24:13: error: 'sort' was not declared in this scope; did you mean 'short'? 24 | sort(area.begin(),area.end()); | ^~~~ | short a.cc:25:19: error: 'min' was not declared in this scope; did you mean 'main'? 25 | ans = min (ans, area[2]-area[0]); // mmax - minと現在までの答えを比較せよ | ^~~ | main a.cc:38:9: error: 'swap' was not declared in this scope 38 | swap(h,w); | ^~~~ a.cc:41:5: error: 'cout' was not declared in this scope 41 | cout << ans << endl; | ^~~~ a.cc:41:20: error: 'endl' was not declared in this scope 41 | cout << ans << endl; | ^~~~
s874143626
p03713
C++
#include <bits/stdc++.h> using namespace std; int main(){ long long h, w; cin >> h >> w; long long ans = h*w; vector<long long> area(3); // 回転前と回転後の2通りを試す for (int i = 0; i < 2; i++){ // 1つの長方形の辺の長さを全探索する for (long long t = 1; t < h; t++){ // 縦割りを試す s[0] = t * w; s[1] = (h-t)*(w/2); s[2] = h*w - s[0] - s[1]; // 最後の面積は, 全体の面積から, それまでに計算した面積2つを引けば良い sort(s.begin(),s.end()); ans = min (ans, s[2]-s[0]); // mmax - minと現在までの答えを比較せよ // 横割りを試す s[0] = t*w; s[1] = ((h-t)/2) * w; s[2] = h*w - s[0] - s[1]; sort(s.begin(),s.end()); ans = min(ans, s[2]-s[0]); // mmax - minと現在までの答えを比較せよ } // チョコレートの回転を忘れない!!! swap(h,w); } cout << ans << endl; return 0; }
a.cc: In function 'int main()': a.cc:20:13: error: 's' was not declared in this scope 20 | s[0] = t * w; | ^
s102308038
p03713
C++
#include <iostream> #include <unordered_map> #include <vector> #include <set> #include <string.h> #include <algorithm> #define mod 1000000007 #define inf 1LL<<61 #define ll long long #define pr pair<int,int> #define all vec.begin(),vec.end() #define rep(i,a,b) for (int i = a; i < b; i++) #define fi first #define se second #define pushb push_back #define makep make_pair using namespace std; int main(){ ll h,w; cin >> h >> w; ll minx = INT_MAX; for(ll i = 1; i <= h - 2; i++){ ll a = i * w; ll b = ((h - i)/2) * w; ll c = (h*w) - b - a; minx = min(minx, max({a,b,c}) - min({a,b,c})); } for(ll i = 1; i <= w - 2; i++){ ll a = i * h; ll b = ((w - i)/2) * h; ll c = (h*w) - b - a; minx = min(minx, max({a,b,c}) - min({a,b,c})); } for(ll i = 1; i <= h - 2; i++){ ll a = i * w; ll b = (h-i) * (w/2); ll c = (h*w) - b - a; minx = min(minx, max({a,b,c}) - min({a,b,c})); } for(ll i = 1; i <= w - 2; i++){ ll a = i * h; ll b = (w-i) * (h/2); ll c = (h*w) - b - a; minx = min(minx, max({a,b,c}) - min({a,b,c})); } cout << minx; return 0; }
a.cc: In function 'int main()': a.cc:23:19: error: 'INT_MAX' was not declared in this scope 23 | ll minx = INT_MAX; | ^~~~~~~ a.cc:7:1: note: 'INT_MAX' is defined in header '<climits>'; this is probably fixable by adding '#include <climits>' 6 | #include <algorithm> +++ |+#include <climits> 7 | #define mod 1000000007
s289407950
p03713
C++
#include <algorithm> #include <iostream> using namespace std; using ll = long long; int main() { ll H, W; cin >> H >> W; ll ans = H * W; ll s[3]; for (int i = 0; i < 2; ++i) { for (ll h = 1; h < H; ++h) { // まずは縦割り s[0] = h * W; s[1] = (H - h) * (W / 2); s[2] = H * W - (s[0] + s[1]); sort(s, s + 3); ans = min(ans, s[2] - s[0]); // 次いで横割り s[0] = h * W; s[1] = ((H - h) / 2) * W; s[2] = H * W - (s[0] + s[1]); sort(s, s + 3); ans = min(ans, s[2] - s[0]); } // 板チョコを90度回す swap(H, W); } cout << ans << endl; return 0;
a.cc: In function 'int main()': a.cc:33:14: error: expected '}' at end of input 33 | return 0; | ^ a.cc:7:12: note: to match this '{' 7 | int main() { | ^
s608638003
p03713
C++
#include <bits/stdc++.h> using namespace std; #define ll long long int #define rep(i, n) for(int i = 0; i < n; i++) #define sort(v) sort((v).begin(), (v).end()) using vi = vector<int>; using vs = vector<string>; using vll = vector<ll>; const int MOD = 1e9+7; int main() { ll H, W; cin >> H >> W; vll ans; if (H % 3 == 0 || W % 3 == 0) { cout << 0 << endl; } else { ll S1, S2, S3; ll maxi; ll mini; ll kouho; repp(i, H-1) { S1 = i * W; S2 = (H - i) * (W / 2); S3 = H * W - S1 - S2; maxi = max(S1, max(S2, S3)); mini = min(S1, min(S2, S3)); kouho = maxi - mini; ans.push_back(kouho); } repp(i, W-1) { S1 = i * H; S2 = (W - i) * (H / 2); S3 = H * W - S1 - S2; maxi = max(S1, max(S2, S3)); mini = min(S1, min(S2, S3)); kouho = maxi - mini; ans.push_back(kouho); } sort(ans); cout << ans[0] << endl; } }
a.cc: In function 'int main()': a.cc:24:22: error: 'i' was not declared in this scope 24 | repp(i, H-1) { | ^ a.cc:24:17: error: 'repp' was not declared in this scope; did you mean 'rep'? 24 | repp(i, H-1) { | ^~~~ | rep
s646691919
p03713
C++
#include<bits/stdc++.h> using namespace std; #define int long long int #define pb push_back #define mp make_pair #define all(x) x.begin(), x.end() #define tr(it, a) for(auto it = a.begin(); it != a.end(); it++) typedef vector<int> vi; const int mod = 1000000007; int32_t main() { ios_base::sync_with_stdio(false); cin.tie(NULL); float a,b,d; float ans=INT_MAX; float r,c; cin>>r>>c; int total = r*c; for(int i =1;i <r;i++){ a = c*i; float left_rows = r-i; b = floor(left_rows/2)*c; d = ceil(left_rows/2)*c; ans = min(ans,max({a,b,d})-min({a,b,d})); a = c*i; b = floor(c/2)*(r-i); d=ceil(c/2)*(r-i); ans = min(ans,max({a,b,d})-min({a,b,d})); } for(int i =1;i <c;i++){ a = r*i; float left_rows = c-i; b = floor(left_rows/2)*r; d = ceil(left_rows/2)*r; ans = min(ans,max({a,b,d})-min({a,b,d})); a = r*i; b = floor(r/2)*(c-i); d=ceil(r/2)*(c-i);; ans = min(ans,max({a,b,d})-min({a,b,d})); } int ans = ans; cout<<ans<<endl; }
a.cc: In function 'int32_t main()': a.cc:51:9: error: conflicting declaration 'long long int ans' 51 | int ans = ans; | ^~~ a.cc:20:11: note: previous declaration as 'float ans' 20 | float ans=INT_MAX; | ^~~
s765809499
p03713
C++
#include<bits/stdc++.h> using namespace std; #define int long long int #define pb push_back #define mp make_pair #define all(x) x.begin(), x.end() #define tr(it, a) for(auto it = a.begin(); it != a.end(); it++) typedef vector<int> vi; const int mod = 1000000007; int32_t main() { ios_base::sync_with_stdio(false); cin.tie(NULL); float a,b,d; int ans=INT_MAX; float r,c; cin>>r>>c; int total = r*c; if(total%3==0){ cout<<0<<endl; return 0 ; } else{ for(int i =1;i <r;i++){ a = c*i; float left_rows = r-i; b = floor(left_rows/2)*c; d = ceil(left_rows/2)*c; ans = min(ans,max({a,b,d})-min({a,b,d})); a = c*i; b = floor(c/2)*(r-i); d=ceil(c/2)*(r-i); ans = min(ans,max({a,b,d})-min({a,b,d})); } for(int i =1;i <c;i++){ a = r*i; float left_rows = c-i; b = floor(left_rows/2)*r; d = ceil(left_rows/2)*r; ans = min(ans,max({a,b,d})-min({a,b,d})); a = r*i; b = floor(r/2)*(c-i); d=ceil(r/2)*(c-i);; ans = min(ans,max({a,b,d})-min({a,b,d})); } } cout<<ans<<endl; }
a.cc: In function 'int32_t main()': a.cc:34:22: error: no matching function for call to 'min(long long int&, float)' 34 | ans = min(ans,max({a,b,d})-min({a,b,d})); | ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ In file included from /usr/include/c++/14/algorithm:60, from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:51, from a.cc:1: /usr/include/c++/14/bits/stl_algobase.h:233:5: note: candidate: 'template<class _Tp> constexpr const _Tp& std::min(const _Tp&, const _Tp&)' 233 | min(const _Tp& __a, const _Tp& __b) | ^~~ /usr/include/c++/14/bits/stl_algobase.h:233:5: note: template argument deduction/substitution failed: a.cc:34:22: note: deduced conflicting types for parameter 'const _Tp' ('long long int' and 'float') 34 | ans = min(ans,max({a,b,d})-min({a,b,d})); | ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /usr/include/c++/14/bits/stl_algobase.h:281:5: note: candidate: 'template<class _Tp, class _Compare> constexpr const _Tp& std::min(const _Tp&, const _Tp&, _Compare)' 281 | min(const _Tp& __a, const _Tp& __b, _Compare __comp) | ^~~ /usr/include/c++/14/bits/stl_algobase.h:281:5: note: candidate expects 3 arguments, 2 provided In file included from /usr/include/c++/14/algorithm:61: /usr/include/c++/14/bits/stl_algo.h:5686:5: note: candidate: 'template<class _Tp> constexpr _Tp std::min(initializer_list<_Tp>)' 5686 | min(initializer_list<_Tp> __l) | ^~~ /usr/include/c++/14/bits/stl_algo.h:5686:5: note: candidate expects 1 argument, 2 provided /usr/include/c++/14/bits/stl_algo.h:5696:5: note: candidate: 'template<class _Tp, class _Compare> constexpr _Tp std::min(initializer_list<_Tp>, _Compare)' 5696 | min(initializer_list<_Tp> __l, _Compare __comp) | ^~~ /usr/include/c++/14/bits/stl_algo.h:5696:5: note: template argument deduction/substitution failed: a.cc:34:22: note: mismatched types 'std::initializer_list<_Tp>' and 'long long int' 34 | ans = min(ans,max({a,b,d})-min({a,b,d})); | ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ a.cc:39:22: error: no matching function for call to 'min(long long int&, float)' 39 | ans = min(ans,max({a,b,d})-min({a,b,d})); | ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /usr/include/c++/14/bits/stl_algobase.h:233:5: note: candidate: 'template<class _Tp> constexpr const _Tp& std::min(const _Tp&, const _Tp&)' 233 | min(const _Tp& __a, const _Tp& __b) | ^~~ /usr/include/c++/14/bits/stl_algobase.h:233:5: note: template argument deduction/substitution failed: a.cc:39:22: note: deduced conflicting types for parameter 'const _Tp' ('long long int' and 'float') 39 | ans = min(ans,max({a,b,d})-min({a,b,d})); | ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /usr/include/c++/14/bits/stl_algobase.h:281:5: note: candidate: 'template<class _Tp, class _Compare> constexpr const _Tp& std::min(const _Tp&, const _Tp&, _Compare)' 281 | min(const _Tp& __a, const _Tp& __b, _Compare __comp) | ^~~ /usr/include/c++/14/bits/stl_algobase.h:281:5: note: candidate expects 3 arguments, 2 provided /usr/include/c++/14/bits/stl_algo.h:5686:5: note: candidate: 'template<class _Tp> constexpr _Tp std::min(initializer_list<_Tp>)' 5686 | min(initializer_list<_Tp> __l) | ^~~ /usr/include/c++/14/bits/stl_algo.h:5686:5: note: candidate expects 1 argument, 2 provided /usr/include/c++/14/bits/stl_algo.h:5696:5: note: candidate: 'template<class _Tp, class _Compare> constexpr _Tp std::min(initializer_list<_Tp>, _Compare)' 5696 | min(initializer_list<_Tp> __l, _Compare __comp) | ^~~ /usr/include/c++/14/bits/stl_algo.h:5696:5: note: template argument deduction/substitution failed: a.cc:39:22: note: mismatched types 'std::initializer_list<_Tp>' and 'long long int' 39 | ans = min(ans,max({a,b,d})-min({a,b,d})); | ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ a.cc:47:22: error: no matching function for call to 'min(long long int&, float)' 47 | ans = min(ans,max({a,b,d})-min({a,b,d})); | ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /usr/include/c++/14/bits/stl_algobase.h:233:5: note: candidate: 'template<class _Tp> constexpr const _Tp& std::min(const _Tp&, const _Tp&)' 233 | min(const _Tp& __a, const _Tp& __b) | ^~~ /usr/include/c++/14/bits/stl_algobase.h:233:5: note: template argument deduction/substitution failed: a.cc:47:22: note: deduced conflicting types for parameter 'const _Tp' ('long long int' and 'float') 47 | ans = min(ans,max({a,b,d})-min({a,b,d})); | ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /usr/include/c++/14/bits/stl_algobase.h:281:5: note: candidate: 'template<class _Tp, class _Compare> constexpr const _Tp& std::min(const _Tp&, const _Tp&, _Compare)' 281 | min(const _Tp& __a, const _Tp& __b, _Compare __comp) | ^~~ /usr/include/c++/14/bits/stl_algobase.h:281:5: note: candidate expects 3 arguments, 2 provided /usr/include/c++/14/bits/stl_algo.h:5686:5: note: candidate: 'template<class _Tp> constexpr _Tp std::min(initializer_list<_Tp>)' 5686 | min(initializer_list<_Tp> __l) | ^~~ /usr/include/c++/14/bits/stl_algo.h:5686:5: note: candidate expects 1 argument, 2 provided /usr/include/c++/14/bits/stl_algo.h:5696:5: note: candidate: 'template<class _Tp, class _Compare> constexpr _Tp std::min(initializer_list<_Tp>, _Compare)' 5696 | min(initializer_list<_Tp> __l, _Compare __comp) | ^~~ /usr/include/c++/14/bits/stl_algo.h:5696:5: note: template argument deduction/substitution failed: a.cc:47:22: note: mismatched types 'std::initializer_list<_Tp>' and 'long long int' 47 | ans = min(ans,max({a,b,d})-min({a,b,d})); | ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ a.cc:52:21: error: no matching function for call to 'min(long long int&, float)' 52 | ans = min(ans,max({a,b,d})-min({a,b,d})); | ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /usr/include/c++/14/bits/stl_algobase.h:233:5: note: candidate: 'template<class _Tp> constexpr const _Tp& std::min(const _Tp&, const _Tp&)' 233 | min(const _Tp& __a, const _Tp& __b) | ^~~ /usr/include/c++/14/bits/stl_algobase.h:233:5: note: template argument deduction/substitution failed: a.cc:52:21: note: deduced conflicting types for parameter 'const _Tp' ('long long int' and 'float') 52 | ans = min(ans,max({a,b,d})-min({a,b,d})); | ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /usr/include/c++/14/bits/stl_algobase.h:281:5: note: candidate: 'template<class _Tp, class _Compare> constexpr const _Tp& std::min(const _Tp&, const _Tp&, _Compare)' 281 | min(const _Tp& __a, const _Tp& __b, _Compare __comp) | ^~~ /usr/include/c++/14/bits/stl_algobase.h:281:5: note: candidate expects 3 arguments, 2 provided /usr/include/c++/14/bits/stl_algo.h:5686:5: note: candidate: 'template<class _Tp> constexpr _Tp std::min(initializer_list<_Tp>)' 5686 | min(initializer_list<_Tp> __l) | ^~~ /usr/include/c++/14/bits/stl_algo.h:5686:5: note: candidate expects 1 argument, 2 provided /usr/include/c++/14/bits/stl_algo.h:5696:5: note: candidate: 'template<class _Tp, class _Compare> constexpr _Tp std::min(initializer_list<_Tp>, _Compare)' 5696 | min(initializer_list<_Tp> __l, _Compare __comp) | ^~~ /usr/include/c++/14/bits/stl_algo.h:5696:5: note: template argument deduction/substitution failed: a.cc:52:21: note: mismatched types 'std::initializer_list<_Tp>' and 'long long int' 52 | ans = min(ans,max({a,b,d})-min({a,b,d})); | ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
s318429776
p03713
C++
#include <bits/stdc++.h> using namespace std; using Graph = vector<vector<int>>; #define rep(i, n) for (int i = 0; i < (int)(n); i++) const long long X=1000000000+7; int main() { long long h,w; cin>>h>>w; if((h%3==0 || w%3==0) cout<<"0"<<endl; else{ int ans=100009; rep(i,2){ int h3=h/3,w2=w/2; if(w%2==0) ans=min(ans,w2); else{ if(h%3==1){ int s=h3*2+w2-min(h3,w2); ans=min(ans,s); } else{ int s,s1=w+h3,s2=w2,s3=w2+1+h3*2; s=max(s1,max(s2,s3))-min(s1,min(s2,s3)); ans=min(ans,s); s1=h3,s2=w2*2,s3=w2*2+2+h3*2; s=max(s1,max(s2,s3))-min(s1,min(s2,s3)); ans=min(ans,s); } } swap(h,w); } cout<<ans<<endl; } }
a.cc: In function 'int main()': a.cc:10:24: error: expected ';' before 'cout' 10 | if((h%3==0 || w%3==0) cout<<"0"<<endl; | ^~~~~ | ; a.cc:11:3: error: expected primary-expression before 'else' 11 | else{ | ^~~~ a.cc:10:41: error: expected ')' before 'else' 10 | if((h%3==0 || w%3==0) cout<<"0"<<endl; | ~ ^ | ) 11 | else{ | ~~~~ a.cc:35:1: error: expected primary-expression before '}' token 35 | } | ^
s173760582
p03713
C++
#include <bits/stdc++.h> using ll = long long; #define FOR(i, k, n) for(ll i = (k); i < (n); i++) #define FORe(i, k, n) for(ll i = (k); i <= (n); i++) #define FORr(i, k, n) for(ll i = (k)-1; i > (n); i--) #define FORre(i, k, n) for(ll i = (k)-1; i >= (n); i--) #define REP(i, n) FOR(i, 0, n) #define REPr(i, n) FORre(i, n, 0) #define ALL(x) (x).begin(), (x).end() #define ALLr(x) (x).rbegin(), (x).rend() #define chmin(x, y) x = min(x, y) #define chmax(x, y) x = max(x, y) using namespace std; const int INF = 1001001001; int main(void){ ll h, w; cin >> h >> w; ll ans = 1ll<<60; FOR(i, 1, h){ ll d = h-i; ll a = w*i; ll b = (w+1)/2 * d; ll c = w/2 * d; ll mx = max(a, max(b, c)); ll mn = min(a, min(b, c)); chmin(ans, mx-mn); if(d < 2) continue; b = (d+1)/2 * w; c = d/2 * w; mx = max(a, max(b, c)); mn = min(a, min(b, c)); chmin(ans, mx-mn); } FOR(i, 1, w){ ll d = w-i; ll a = h*i; ll b = (h+1)/2 * d; ll c = h/2 * d; ll mx = max(a, max(b, c)); ll mn = min(a, min(b, c)); chmin(ans, mx-mn); if(d < 2) continue: b = (d+1)/2 * h; c = d/2 * h; mx = max(a, max(b, c)); mn = min(a, min(b, c)); chmin(ans, mx-mn); } cout << ans << endl; return 0; }
a.cc: In function 'int main()': a.cc:49:23: error: expected ';' before ':' token 49 | if(d < 2) continue: | ^ | ; a.cc:49:23: error: expected primary-expression before ':' token
s766300557
p03713
C++
a
a.cc:1:1: error: 'a' does not name a type 1 | a | ^
s531416961
p03713
C++
#include <iostream> #include <string> #include <algorithm> #include <functional> #include <vector> #include <stack> #include <queue> #include <deque> #include <set> #include <map> #include <cstdio> #include <cmath> #include <tuple> #include <iomanip> #include <numeric> #include <unordered_map> #include <sstream> #include<limits.h> #include<float.h> #include<list> #include <array> #include <complex> using namespace std; #define i64 long long #define int long long #define I32_MAX 2147483647 #define I64_MAX 9223372036854775807LL #define I64_MAX2 1223372036854775807LL #define INF I64_MAX2 #define MOD 1000000007 #define MEM_SIZE 10000 // int DP[MEM_SIZE][MEM_SIZE] = {0}; // int GMEM[MEM_SIZE][MEM_SIZE] = {0}; template<typename T> void DEBUG(T e){std::cout << e << std::endl;} template<class T> void DEBUG(string str, T e){std::cout <<str << ">>" << e << std::endl;} template<typename T> void DEBUG(const std::vector<T>& v){for(const auto& e : v){ std::cout << e << " "; } std::cout << std::endl;} template<typename T> void DEBUG(const std::vector<std::vector<T> >& vv){ for(const auto& v : vv){ DEBUG(v); } } template <class T> void corner(bool flg, T hoge) {if (flg) {cout << hoge << endl; exit(0);}} template< typename T1, typename T2 > inline bool chmax(T1 &a, T2 b) { return a < b && (a = b, true); } template< typename T1, typename T2 > inline bool chmin(T1 &a, T2 b) { return a > b && (a = b, true); } void solve(void) { int H,W; cin>>H>>W; if(H%3 == 0 || W%3 == 0) { cout<<0<<endl; return; } int ANS = INF; for (int i = 1; i < W; i++) { int A = i * H; int B = (W - i)*(H/2 + H%2); int C = (W - i)*(H/2) ; if(chmin(ANS,max(A,max(B,C)) - min(A,min(B,C)))) { cout<<A<<" "<<B<<" "<<C<<endl; } } swap(W,H); for (int i = 1; i < W; i++) { int A = i * H; int B = (W - i)*(H/2 + H%2); int C = (W - i)*(H/2) ; if(chmin(ANS,max(A,max(B,C)) - min(A,min(B,C)))) { // cout<<A<<" "<<B<<" "<<C<<endl; } } ANS = min(ANS,H,W); cout<<ANS<<endl; return; } int32_t main(int32_t argc, const char *argv[]) { std::ios::sync_with_stdio(false); std::cin.tie(0); std::cout << std::fixed; std::cout << std::setprecision(9); solve(); return 0; }
In file included from /usr/include/c++/14/string:51, from /usr/include/c++/14/bits/locale_classes.h:40, from /usr/include/c++/14/bits/ios_base.h:41, from /usr/include/c++/14/ios:44, from /usr/include/c++/14/ostream:40, from /usr/include/c++/14/iostream:41, from a.cc:1: /usr/include/c++/14/bits/stl_algobase.h: In instantiation of 'constexpr const _Tp& std::min(const _Tp&, const _Tp&, _Compare) [with _Tp = long long int; _Compare = long long int]': a.cc:79:12: required from here 79 | ANS = min(ANS,H,W); | ~~~^~~~~~~~~ /usr/include/c++/14/bits/stl_algobase.h:284:17: error: '__comp' cannot be used as a function 284 | if (__comp(__b, __a)) | ~~~~~~^~~~~~~~~~
s020834905
p03713
C++
#include <iostream> #include <stdio.h> #include <set> #include <string> #include <vector> #include <map> #include <algorithm> #include <cmath> #include <limits> typedef long long int lli; #define rep(i,s,N) for(int i=s;i<N;i++) #define MOD 1000000007 using namespace std; lli small(lli a, lli b, lli c) { lli l = min(a, b); l = min(l, c); lli r = max(a, b); r = max(r, c); lli ans = r - l; return ans; } lli split(lli x, lli y) { lli m = LLONG_MAX; lli A, B, C; rep(i, 1, x / 2 + 1) { A = i * y; B = (x - i)*(y / 2); C = (x - i)*(y - y / 2); m = min(m, small(A, B, C)); //cout << m << endl; lli j = x - i; A = i * y; B = j / 2 * y; C = (j - j / 2)*y; m = min(m, small(A, B, C)); } return m; } int main(void) { lli H, W; cin >> H >> W; if (H % 3 == 0 || W % 3 == 0)cout << 0 << endl; else { cout << min(split(H, W), split(W, H)) << endl; } return 0; }
a.cc: In function 'lli split(lli, lli)': a.cc:24:17: error: 'LLONG_MAX' was not declared in this scope 24 | lli m = LLONG_MAX; | ^~~~~~~~~ a.cc:9:1: note: 'LLONG_MAX' is defined in header '<climits>'; this is probably fixable by adding '#include <climits>' 8 | #include <cmath> +++ |+#include <climits> 9 | #include <limits>
s122398842
p03713
C++
#include <iostream> #include <algorithm> #include <cstring> #include <cmath> #include <vector> #include <map> #define rep(i, a, b) for ( int i = (a); i < (b); i++ ) #define per(i, a, b) for ( int i = (b)-1; i >= (a); i--) #define pb push_back #define bg begin() #define en end() using namespace std; typedef long long ll; static const ll MAX = 1000000000000000000; ll H, W; ll calc(ll x, ll y) { if (x == 2 && y == 2) return 1; if (x%3 == 0 || y % 3 == 0) return 0; if (y == 2) return MAX; ll t, S1, S2; if ( y % 3 == 1) { t = (y-1) / 3; S1 = t * x; //縦3分割 } else { t = (y+1) / 3; S1 = (t/2) * x; //縦3分割 } ll k = y - t, l = x/2, m = x - l; ll max_S = max<ll>(t*x, max<ll>(k*l, k*m)); ll min_S = min<ll>(t*x, min<ll>(k*l, k*m)); S2 = max_S - min_S; return min<ll>(S1, S2); } int main() { scanf("%lld %lld", &H, &W); printf("%lld\n", min<ll>(calc(H, W), calc(W, H))); return 0; }
a.cc:33:22: error: extended character   is not valid in an identifier 33 | S1 = (t/2) * x; //縦3分割 | ^ a.cc: In function 'll calc(ll, ll)': a.cc:33:22: error: '\U00003000' was not declared in this scope 33 | S1 = (t/2) * x; //縦3分割 | ^~
s942681350
p03713
C++
.
a.cc:1:1: error: expected unqualified-id before '.' token 1 | . | ^
s696417396
p03713
C++
#include<iostream> #include<algorithm> using namespace std; long long diff(long long x, long long y, long long z) { return max(x, max(y, z)) - min(x, min(y, z)); } int main() { long long h, w; cin >> h >> w; long long ans(INT_MAX); for (int i = 1; i <= h / 2; ++i) { //for (int j = 1; j <= w / 2; ++j) { long long j = w / 2; long long a = i * j, b = (h - i) * j, d = (h - i) * (w-j), c = i * (w - j); long long t1 = min(diff(a + b, c, d), diff(a + c, b, d)); long long t2 = min(diff(b + d, a, c), diff(c + d, a, b)); ans = min(ans, min(t1, t2)); //} } cout << ans; return 0; };
a.cc: In function 'int main()': a.cc:10:17: error: 'INT_MAX' was not declared in this scope 10 | long long ans(INT_MAX); | ^~~~~~~ a.cc:3:1: note: 'INT_MAX' is defined in header '<climits>'; this is probably fixable by adding '#include <climits>' 2 | #include<algorithm> +++ |+#include <climits> 3 | using namespace std;
s778559035
p03713
C++
#include<iostream> long long diff(long long x, long long y, long long z) { return max(x, max(y, z)) - min(x, min(y, z)); } int main() { long long h, w; cin >> h >> w; long long ans(INT_MAX); for (int i = 1; i <= h / 2; ++i) { //for (int j = 1; j <= w / 2; ++j) { long long j = w / 2; long long a = i * j, b = (h - i) * j, d = (h - i) * (w-j), c = i * (w - j); long long t1 = min(diff(a + b, c, d), diff(a + c, b, d)); long long t2 = min(diff(b + d, a, c), diff(c + d, a, b)); ans = min(ans, min(t1, t2)); //} } cout << ans; return 0; };
a.cc: In function 'long long int diff(long long int, long long int, long long int)': a.cc:3:17: error: 'max' was not declared in this scope; did you mean 'std::max'? 3 | return max(x, max(y, z)) - min(x, min(y, z)); | ^~~ | std::max In file included from /usr/include/c++/14/string:51, from /usr/include/c++/14/bits/locale_classes.h:40, from /usr/include/c++/14/bits/ios_base.h:41, from /usr/include/c++/14/ios:44, from /usr/include/c++/14/ostream:40, from /usr/include/c++/14/iostream:41, from a.cc:1: /usr/include/c++/14/bits/stl_algobase.h:303:5: note: 'std::max' declared here 303 | max(const _Tp& __a, const _Tp& __b, _Compare __comp) | ^~~ a.cc:3:10: error: 'max' was not declared in this scope; did you mean 'std::max'? 3 | return max(x, max(y, z)) - min(x, min(y, z)); | ^~~ | std::max /usr/include/c++/14/bits/stl_algobase.h:303:5: note: 'std::max' declared here 303 | max(const _Tp& __a, const _Tp& __b, _Compare __comp) | ^~~ a.cc:3:37: error: 'min' was not declared in this scope; did you mean 'std::min'? 3 | return max(x, max(y, z)) - min(x, min(y, z)); | ^~~ | std::min /usr/include/c++/14/bits/stl_algobase.h:281:5: note: 'std::min' declared here 281 | min(const _Tp& __a, const _Tp& __b, _Compare __comp) | ^~~ a.cc:3:30: error: 'min' was not declared in this scope; did you mean 'std::min'? 3 | return max(x, max(y, z)) - min(x, min(y, z)); | ^~~ | std::min /usr/include/c++/14/bits/stl_algobase.h:281:5: note: 'std::min' declared here 281 | min(const _Tp& __a, const _Tp& __b, _Compare __comp) | ^~~ a.cc: In function 'int main()': a.cc:7:3: error: 'cin' was not declared in this scope; did you mean 'std::cin'? 7 | cin >> h >> w; | ^~~ | std::cin /usr/include/c++/14/iostream:62:18: note: 'std::cin' declared here 62 | extern istream cin; ///< Linked to standard input | ^~~ a.cc:8:17: error: 'INT_MAX' was not declared in this scope 8 | long long ans(INT_MAX); | ^~~~~~~ a.cc:2:1: note: 'INT_MAX' is defined in header '<climits>'; this is probably fixable by adding '#include <climits>' 1 | #include<iostream> +++ |+#include <climits> 2 | long long diff(long long x, long long y, long long z) { a.cc:13:22: error: 'min' was not declared in this scope; did you mean 'std::min'? 13 | long long t1 = min(diff(a + b, c, d), diff(a + c, b, d)); | ^~~ | std::min /usr/include/c++/14/bits/stl_algobase.h:281:5: note: 'std::min' declared here 281 | min(const _Tp& __a, const _Tp& __b, _Compare __comp) | ^~~ a.cc:18:3: error: 'cout' was not declared in this scope; did you mean 'std::cout'? 18 | cout << ans; | ^~~~ | std::cout /usr/include/c++/14/iostream:63:18: note: 'std::cout' declared here 63 | extern ostream cout; ///< Linked to standard output | ^~~~
s461107398
p03713
C++
#include <bits/stdc++.h> #define rep(i, n) for(int i=0; i<(n); ++i) #define rep2(i, s, n) for(int i=s; i<(n); ++i) #define ALL(v) (v).begin(), (v).end() using namespace std; typedef long long ll; static const int INTINF = (2147483647); static const ll LLINF = (9223372036854775807); static const int MAX = 100001; static const ll MOD = 1000000007; namespace Printer{ void print(vector<int> v){ rep(i, v.size()){ if(i) cout << " "; cout<< v[i]; } cout << endl; } void print(vector<vector<int> > vv){ rep(i, vv.size()){ rep(j, vv[i].size()){ if(j) cout << " "; cout << vv[i][j]; } cout << endl; } } void print(pair<int, int> p){ cout << "(" << p.first << ", " << p.second << ")" << endl; } }; //--global--// //----------// ll calc(ll H, ll W) { ll s1, s2, s3; ll mxs, mns; ll res = INF; for (int i = 1; i < H; i++) { s1 = i * W; s2 = (H - i) * (W / 2); s3 = (H - i) * (W - (W / 2)); mxs = max(s1, max(s2, s3)); mns = min(s1, min(s2, s3)); res = min(res, mxs - mns); } s1 = (H / 3) * W; s2 = (H - (H / 3) * 2) * W; res = min(res, abs(s1 - s2)); return res; } int main() { ll H, W; cin >> H >> W; ll ans = min(H, W); ans = min(ans, calc(H, W)); ans = min(ans, calc(W, H)); cout << ans << endl; }
a.cc: In function 'll calc(ll, ll)': a.cc:48:12: error: 'INF' was not declared in this scope 48 | ll res = INF; | ^~~
s744110189
p03713
C++
#include <bits/stdc++.h> #define rep(i, n) for(int i=0; i<(n); ++i) #define rep2(i, s, n) for(int i=s; i<(n); ++i) #define ALL(v) (v).begin(), (v).end() using namespace std; typedef long long ll; static const int INTINF = (2147483647); static const ll LLINF = (9223372036854775807); static const int MAX = 100001; static const ll MOD = 1000000007; namespace Printer{ void print(vector<int> v){ rep(i, v.size()){ if(i) cout << " "; cout<< v[i]; } cout << endl; } void print(vector<vector<int> > vv){ rep(i, vv.size()){ rep(j, vv[i].size()){ if(j) cout << " "; cout << vv[i][j]; } cout << endl; } } void print(pair<int, int> p){ cout << "(" << p.first << ", " << p.second << ")" << endl; } }; //--global--// //----------// void swap(ll *a, ll *b){ ll tmp = *a; *a = *b; *b = tmp; } int main(int argc, const char * argv[]) { //提出時、消す----// //--------------// ll h, w; cin >> h >> w; if(h % 3 == 0 || w % 3 == 0){ cout << 0 << endl; return 0; } ll ans = LLINF; rep(i, 2){ swap(h, w); if(w % 2 == 1){ rep2(i, 1, h){ ll a = w * i; ll b = (w/2) * (h-i); ll c = (w - w/2) * (h-i); ll ma = max(max(a, b), c); ll mi = min(min(a, b), c); ans = min(ans, abs(ma - mi)); b = w * (h-i)/2; c = w * (h-i-(h-i)/2); ll ma = max(max(a, b), c); ll mi = min(min(a, b), c); ans = min(ans, abs(ma - mi)); // cout << h << endl; // cout << a << ", " << b << ", " << c << endl; } }else{ rep2(i, 1, h){ ll a = w * i; ll b = (w/2) * (h-i); ans = min(ans, abs(a-b)); b = w * (h-i)/2; ll c = w * (h-i-(h-i)/2); ll ma = max(max(a, b), c); ll mi = min(min(a, b), c); ans = min(ans, abs(ma - mi)); } } } cout << ans << endl; return 0; }
a.cc: In function 'int main(int, const char**)': a.cc:76:20: error: redeclaration of 'll ma' 76 | ll ma = max(max(a, b), c); | ^~ a.cc:71:20: note: 'll ma' previously declared here 71 | ll ma = max(max(a, b), c); | ^~ a.cc:77:20: error: redeclaration of 'll mi' 77 | ll mi = min(min(a, b), c); | ^~ a.cc:72:20: note: 'll mi' previously declared here 72 | ll mi = min(min(a, b), c); | ^~
s799248502
p03713
C++
#include<iostream> #include<vector> #include<algorithm> #include<map> #include<cstring> #include<math.h> #include<bitset> #include<queue> #include<set> #include<iomanip> #include<math.h> #include<assert.h> // #include<bits/stdc++.h> using namespace std; typedef long long ll; constexpr long long int INFLL = 1001001001001001LL; constexpr int INFI = 1000000007; const int mod = 1000000007; int main(){ int H,W; cin >> H >> W; if(H%3==0 || W%3==0){ cout << 0 << endl; return 0; } ll ans = min(H,W); vector<ll> M; for(int h=1; h<H; h++){ M[0] = h*(W/2); M[1] = (H-h)*W; M[2] = h*W-M1; sort(M.begin(),M.end()); ans = min(M[2]-M[0]); } for(int w=1; w<W; w++){ M[0] = w*(H/2); M[1] = (W-w)*H; M[2] = w*H-M1; sort(M.begin(),M.end()); ans = min(M[2]-M[0]); } cout << ans << endl; return 0; }
a.cc: In function 'int main()': a.cc:32:16: error: 'M1' was not declared in this scope; did you mean 'M'? 32 | M[2] = h*W-M1; | ^~ | M a.cc:34:14: error: no matching function for call to 'min(__gnu_cxx::__alloc_traits<std::allocator<long long int>, long long int>::value_type)' 34 | ans = min(M[2]-M[0]); | ~~~^~~~~~~~~~~ In file included from /usr/include/c++/14/string:51, from /usr/include/c++/14/bits/locale_classes.h:40, from /usr/include/c++/14/bits/ios_base.h:41, from /usr/include/c++/14/ios:44, from /usr/include/c++/14/ostream:40, from /usr/include/c++/14/iostream:41, from a.cc:1: /usr/include/c++/14/bits/stl_algobase.h:233:5: note: candidate: 'template<class _Tp> constexpr const _Tp& std::min(const _Tp&, const _Tp&)' 233 | min(const _Tp& __a, const _Tp& __b) | ^~~ /usr/include/c++/14/bits/stl_algobase.h:233:5: note: candidate expects 2 arguments, 1 provided /usr/include/c++/14/bits/stl_algobase.h:281:5: note: candidate: 'template<class _Tp, class _Compare> constexpr const _Tp& std::min(const _Tp&, const _Tp&, _Compare)' 281 | min(const _Tp& __a, const _Tp& __b, _Compare __comp) | ^~~ /usr/include/c++/14/bits/stl_algobase.h:281:5: note: candidate expects 3 arguments, 1 provided In file included from /usr/include/c++/14/algorithm:61, from a.cc:3: /usr/include/c++/14/bits/stl_algo.h:5686:5: note: candidate: 'template<class _Tp> constexpr _Tp std::min(initializer_list<_Tp>)' 5686 | min(initializer_list<_Tp> __l) | ^~~ /usr/include/c++/14/bits/stl_algo.h:5686:5: note: template argument deduction/substitution failed: a.cc:34:14: note: mismatched types 'std::initializer_list<_Tp>' and 'long long int' 34 | ans = min(M[2]-M[0]); | ~~~^~~~~~~~~~~ /usr/include/c++/14/bits/stl_algo.h:5696:5: note: candidate: 'template<class _Tp, class _Compare> constexpr _Tp std::min(initializer_list<_Tp>, _Compare)' 5696 | min(initializer_list<_Tp> __l, _Compare __comp) | ^~~ /usr/include/c++/14/bits/stl_algo.h:5696:5: note: candidate expects 2 arguments, 1 provided a.cc:39:16: error: 'M1' was not declared in this scope; did you mean 'M'? 39 | M[2] = w*H-M1; | ^~ | M a.cc:41:14: error: no matching function for call to 'min(__gnu_cxx::__alloc_traits<std::allocator<long long int>, long long int>::value_type)' 41 | ans = min(M[2]-M[0]); | ~~~^~~~~~~~~~~ /usr/include/c++/14/bits/stl_algobase.h:233:5: note: candidate: 'template<class _Tp> constexpr const _Tp& std::min(const _Tp&, const _Tp&)' 233 | min(const _Tp& __a, const _Tp& __b) | ^~~ /usr/include/c++/14/bits/stl_algobase.h:233:5: note: candidate expects 2 arguments, 1 provided /usr/include/c++/14/bits/stl_algobase.h:281:5: note: candidate: 'template<class _Tp, class _Compare> constexpr const _Tp& std::min(const _Tp&, const _Tp&, _Compare)' 281 | min(const _Tp& __a, const _Tp& __b, _Compare __comp) | ^~~ /usr/include/c++/14/bits/stl_algobase.h:281:5: note: candidate expects 3 arguments, 1 provided /usr/include/c++/14/bits/stl_algo.h:5686:5: note: candidate: 'template<class _Tp> constexpr _Tp std::min(initializer_list<_Tp>)' 5686 | min(initializer_list<_Tp> __l) | ^~~ /usr/include/c++/14/bits/stl_algo.h:5686:5: note: template argument deduction/substitution failed: a.cc:41:14: note: mismatched types 'std::initializer_list<_Tp>' and 'long long int' 41 | ans = min(M[2]-M[0]); | ~~~^~~~~~~~~~~ /usr/include/c++/14/bits/stl_algo.h:5696:5: note: candidate: 'template<class _Tp, class _Compare> constexpr _Tp std::min(initializer_list<_Tp>, _Compare)' 5696 | min(initializer_list<_Tp> __l, _Compare __comp) | ^~~ /usr/include/c++/14/bits/stl_algo.h:5696:5: note: candidate expects 2 arguments, 1 provided
s590494565
p03713
C++
#include <bits/stdc++.h> using namespace std; typedef long long int ll; double PI = 3.14159265358979; int main(){ int H,W; cin >> H >> W; if(H % 3 == 0 || W % 3 == 0){ cout << 0 << endl; return 0; } int a = (W + W % 3) / 3; int A = H * a; int b = (H + H % 2) / 2; int B = (W - a) * b; int C = H * W - A - B; int T = max({A,B,C}) - min({A,B,C}); int a1 = W / 3 + 1; int A1 = H * a1; int b1 = H/2 + 1; int B1 = (W - a1) * b1; int C1 = H * W - A1 - B1; int T1 = max({A1,B1,C1}) - min({A1,B1,C1}); swap(H,W); int o = (W + W % 3) / 3; int P = H * o; int q = (H + H % 2) / 2; int Q = (W - o) * q; int R = H * W - P - Q; int Z = max({R,P,Q}) - min({P,Q,R}); int a2 = W / 3 + 1; int A2 = H * a2; int b2 = H/2 + 1; int B2 = (W - a2) * b2; int C2 = H * W - A2 - B2; int T2 = max({A2,B2,C2}) - min({A2,B2,C2}); if(H > 2){ int p = (H+H%3)/3; int T = W * (H - 2 * p); ans = min(ans,T); } if(W > 2){ int q = (W+W%3)/3; int S = H * (W - 2 * q); ans = min(ans,S); } cout << min({T1,T2,Z,T}) << endl; }
a.cc: In function 'int main()': a.cc:45:4: error: 'ans' was not declared in this scope; did you mean 'abs'? 45 | ans = min(ans,T); | ^~~ | abs a.cc:50:4: error: 'ans' was not declared in this scope; did you mean 'abs'? 50 | ans = min(ans,S); | ^~~ | abs
s598097201
p03713
C++
#include <iostream>
/usr/bin/ld: /usr/lib/gcc/x86_64-linux-gnu/14/../../../x86_64-linux-gnu/Scrt1.o: in function `_start': (.text+0x17): undefined reference to `main' collect2: error: ld returned 1 exit status
s707806998
p03713
C++
#include <iostream> #include <cstdio> using namespace std; typedef long long ll; ll h, w; ll a, b, c; ll mn = 4e18; ll abs(ll p){return p > 0 ? p : -p;} int main() { scanf("%lld%lld", &h, &w); for(ll i = 0; i <= h; i++) { a = w * i; b = (h - i) * (w / 2); c = w * h - a - b; mn = min(mn, max(abs(a - b), max(abs(b - c), abs(c - a)))); } if(h % 3 == 0) mn = 0; else mn = min(mn, w); swap(h, w); for(ll i = 0; i <= h; i++) { a = w * i; b = (h - i) * (w / 2); c = w * h - a - b; mn = min(mn, max(abs(a - b), max(abs(b - c), abs(c - a)))); } if(h % 3 == 0) mn = 0; else mn = min(mn, w); printf("%lld", mn); return 0; }
a.cc: In function 'int main()': a.cc:22:29: error: call of overloaded 'abs(ll)' is ambiguous 22 | mn = min(mn, max(abs(a - b), max(abs(b - c), abs(c - a)))); | ~~~^~~~~~~ In file included from /usr/include/c++/14/cstdlib:79, from /usr/include/c++/14/ext/string_conversions.h:43, from /usr/include/c++/14/bits/basic_string.h:4154, from /usr/include/c++/14/string:54, from /usr/include/c++/14/bits/locale_classes.h:40, from /usr/include/c++/14/bits/ios_base.h:41, from /usr/include/c++/14/ios:44, from /usr/include/c++/14/ostream:40, from /usr/include/c++/14/iostream:41, from a.cc:1: /usr/include/stdlib.h:980:12: note: candidate: 'int abs(int)' 980 | extern int abs (int __x) __THROW __attribute__ ((__const__)) __wur; | ^~~ a.cc:12:4: note: candidate: 'll abs(ll)' 12 | ll abs(ll p){return p > 0 ? p : -p;} | ^~~ In file included from /usr/include/c++/14/cstdlib:81: /usr/include/c++/14/bits/std_abs.h:137:3: note: candidate: 'constexpr __float128 std::abs(__float128)' 137 | abs(__float128 __x) | ^~~ /usr/include/c++/14/bits/std_abs.h:85:3: note: candidate: 'constexpr __int128 std::abs(__int128)' 85 | abs(__GLIBCXX_TYPE_INT_N_0 __x) { return __x >= 0 ? __x : -__x; } | ^~~ /usr/include/c++/14/bits/std_abs.h:79:3: note: candidate: 'constexpr long double std::abs(long double)' 79 | abs(long double __x) | ^~~ /usr/include/c++/14/bits/std_abs.h:75:3: note: candidate: 'constexpr float std::abs(float)' 75 | abs(float __x) | ^~~ /usr/include/c++/14/bits/std_abs.h:71:3: note: candidate: 'constexpr double std::abs(double)' 71 | abs(double __x) | ^~~ /usr/include/c++/14/bits/std_abs.h:61:3: note: candidate: 'long long int std::abs(long long int)' 61 | abs(long long __x) { return __builtin_llabs (__x); } | ^~~ /usr/include/c++/14/bits/std_abs.h:56:3: note: candidate: 'long int std::abs(long int)' 56 | abs(long __i) { return __builtin_labs(__i); } | ^~~ a.cc:22:45: error: call of overloaded 'abs(ll)' is ambiguous 22 | mn = min(mn, max(abs(a - b), max(abs(b - c), abs(c - a)))); | ~~~^~~~~~~ /usr/include/stdlib.h:980:12: note: candidate: 'int abs(int)' 980 | extern int abs (int __x) __THROW __attribute__ ((__const__)) __wur; | ^~~ a.cc:12:4: note: candidate: 'll abs(ll)' 12 | ll abs(ll p){return p > 0 ? p : -p;} | ^~~ /usr/include/c++/14/bits/std_abs.h:137:3: note: candidate: 'constexpr __float128 std::abs(__float128)' 137 | abs(__float128 __x) | ^~~ /usr/include/c++/14/bits/std_abs.h:85:3: note: candidate: 'constexpr __int128 std::abs(__int128)' 85 | abs(__GLIBCXX_TYPE_INT_N_0 __x) { return __x >= 0 ? __x : -__x; } | ^~~ /usr/include/c++/14/bits/std_abs.h:79:3: note: candidate: 'constexpr long double std::abs(long double)' 79 | abs(long double __x) | ^~~ /usr/include/c++/14/bits/std_abs.h:75:3: note: candidate: 'constexpr float std::abs(float)' 75 | abs(float __x) | ^~~ /usr/include/c++/14/bits/std_abs.h:71:3: note: candidate: 'constexpr double std::abs(double)' 71 | abs(double __x) | ^~~ /usr/include/c++/14/bits/std_abs.h:61:3: note: candidate: 'long long int std::abs(long long int)' 61 | abs(long long __x) { return __builtin_llabs (__x); } | ^~~ /usr/include/c++/14/bits/std_abs.h:56:3: note: candidate: 'long int std::abs(long int)' 56 | abs(long __i) { return __builtin_labs(__i); } | ^~~ a.cc:22:57: error: call of overloaded 'abs(ll)' is ambiguous 22 | mn = min(mn, max(abs(a - b), max(abs(b - c), abs(c - a)))); | ~~~^~~~~~~ /usr/include/stdlib.h:980:12: note: candidate: 'int abs(int)' 980 | extern int abs (int __x) __THROW __attribute__ ((__const__)) __wur; | ^~~ a.cc:12:4: note: candidate: 'll abs(ll)' 12 | ll abs(ll p){return p > 0 ? p : -p;} | ^~~ /usr/include/c++/14/bits/std_abs.h:137:3: note: candidate: 'constexpr __float128 std::abs(__float128)' 137 | abs(__float128 __x) | ^~~ /usr/include/c++/14/bits/std_abs.h:85:3: note: candidate: 'constexpr __int128 std::abs(__int128)' 85 | abs(__GLIBCXX_TYPE_INT_N_0 __x) { return __x >= 0 ? __x : -__x; } | ^~~ /usr/include/c++/14/bits/std_abs.h:79:3: note: candidate: 'constexpr long double std::abs(long double)' 79 | abs(long double __x) | ^~~ /usr/include/c++/14/bits/std_abs.h:75:3: note: candidate: 'constexpr float std::abs(float)' 75 | abs(float __x) | ^~~ /usr/include/c++/14/bits/std_abs.h:71:3: note: candidate: 'constexpr double std::abs(double)' 71 | abs(double __x) | ^~~ /usr/include/c++/14/bits/std_abs.h:61:3: note: candidate: 'long long int std::abs(long long int)' 61 | abs(long long __x) { return __builtin_llabs (__x); } | ^~~ /usr/include/c++/14/bits/std_abs.h:56:3: note: candidate: 'long int std::abs(long int)' 56 | abs(long __i) { return __builtin_labs(__i); } | ^~~ a.cc:32:29: error: call of overloaded 'abs(ll)' is ambiguous 32 | mn = min(mn, max(abs(a - b), max(abs(b - c), abs(c - a)))); | ~~~^~~~~~~ /usr/include/stdlib.h:980:12: note: candidate: 'int abs(int)' 980 | extern int abs (int __x) __THROW __attribute__ ((__const__)) __wur; | ^~~ a.cc:12:4: note: candidate: 'll abs(ll)' 12 | ll abs(ll p){return p > 0 ? p : -p;} | ^~~ /usr/include/c++/14/bits/std_abs.h:137:3: note: candidate: 'constexpr __float128 std::abs(__float128)' 137 | abs(__float128 __x) | ^~~ /usr/include/c++/14/bits/std_abs.h:85:3: note: candidate: 'constexpr __int128 std::abs(__int128)' 85 | abs(__GLIBCXX_TYPE_INT_N_0 __x) { return __x >= 0 ? __x : -__x; } | ^~~ /usr/include/c++/14/bits/std_abs.h:79:3: note: candidate: 'constexpr long double std::abs(long double)' 79 | abs(long double __x) | ^~~ /usr/include/c++/14/bits/std_abs.h:75:3: note: candidate: 'constexpr float std::abs(float)' 75 | abs(float __x) | ^~~ /usr/include/c++/14/bits/std_abs.h:71:3: note: candidate: 'constexpr double std::abs(double)' 71 | abs(double __x) | ^~~ /usr/include/c++/14/bits/std_abs.h:61:3: note: candidate: 'long long int std::abs(long long int)' 61 | abs(long long __x) { return __builtin_llabs (__x); } | ^~~ /usr/include/c++/14/bits/std_abs.h:56:3: note: candidate: 'long int std::abs(long int)' 56 | abs(long __i) { return __builtin_labs(__i); } | ^~~ a.cc:32:45: error: call of overloaded 'abs(ll)' is ambiguous 32 | mn = min(mn, max(abs(a - b), max(abs(b - c), abs(c - a)))); | ~~~^~~~~~~ /usr/include/stdlib.h:980:12: note: candidate: 'int abs(int)' 980 | extern int abs (int __x) __THROW __attribute__ ((__const__)) __wur; | ^~~ a.cc:12:4: note: candidate: 'll abs(ll)' 12 | ll abs(ll p){return p > 0 ? p : -p;} | ^~~ /usr/include/c++/14/bits/std_abs.h:137:3: note: candidate: 'constexpr __float128 std::abs(__float128)' 137 | abs(__float128 __x) | ^~~ /usr/include/c++/14/bits/std_abs.h:85:3: note: candidate: 'constexpr __int128 std::abs(__int128)' 85 | abs(__GLIBCXX_TYPE_INT_N_0 __x) { return __x >= 0 ? __x : -__x; } | ^~~ /usr/include/c++/14/bits/std_abs.h:79:3: note: candidate: 'constexpr long double std::abs(long double)' 79 | abs(long double __x) | ^~~ /usr/include/c++/14/bits/std_abs.h:75:3: note: candidate: 'constexpr float std::abs(float)' 75 | abs(float __x) | ^~~ /usr/include/c++/14/bits/std_abs.h:71:3: note: candidate: 'constexpr double std::abs(double)' 71 | abs(double __x) | ^~~ /usr/include/c++/14/bits/std_abs.h:61:3: note: candidate: 'long long int std::abs(long long int)' 61 | abs(long long __x) { return __builtin_llabs (__x); } | ^~~ /usr/include/c++/14/bits/std_abs.h:56:3: note: candidate: 'long int std::abs(long int)' 56 | abs(long __i) { return __builtin_labs(__i); } | ^~~ a.cc:32:57: error: call of overloaded 'abs(ll)' is ambiguous 32 | mn = min(mn, max(abs(a - b), max(abs(b - c), abs(c - a)))); | ~~~^~~~~~~ /usr/include/stdlib.h:980:12: note: candidate: 'int abs(int)' 980 | extern int abs (int __x) __THROW __attribute__ ((__const__)) __wur; | ^~~ a.cc:12:4: note: candidate: 'll abs(ll)' 12 | ll abs(ll p){return p > 0 ? p : -p;} | ^~~ /usr/include/c++/14/bits/std_abs.h:137:3: note: candidate: 'constexpr __float128 std::abs(__float128)' 137 | abs(__float128 __x) | ^~~ /usr/include/c++/14/bits/std_abs.h:85:3: note: candidate: 'constexpr __int128 std::abs(__int128)' 85 | abs(__GLIBCXX_TYPE_INT_N_0 __x) { return __x >= 0 ? __x : -__x; } | ^~~ /usr/include/c++/14/bits/std_abs.h:79:3: note: candidate: 'constexpr long double std::abs(long double)' 79 | abs(long double __x) | ^~~ /usr/include/c++/14/bits/std_abs.h:75:3: note: candidate: 'constexpr float std::abs(float)' 75 | abs(float __x) | ^~~ /usr/include/c++/14/bits/std_abs.h:71:3: note: candidate: 'constexpr double std::abs(double)' 71 | abs(double __x) | ^~~ /usr/include/c++/14/bits/std_abs.h:61:3: note: candidate: 'long long int std::abs(long long int)' 61 | abs(long long __x) { return __builtin_llabs (__x); } | ^~~ /usr/include/c++/14/bits/std_abs.h:56:3: note: candidate: 'long int std::abs(long int)' 56 | abs(long __i) { return __builtin_labs(__i); } | ^~~
s343142318
p03713
C++
#define _CRT_SECURE_NO_WARNINGS #include <iostream> #include <vector> #include <string> #include <algorithm> #include <iomanip> #include <cmath> using namespace std; #define DEBUG 0 #define REP(i, n) for (int i = 0; i < (n); i++) typedef long long ll; typedef pair<int,int> pint; static const ll MOD = 1000000007; static const ll INF = 1000000000000000000LL; using namespace std; int main() { ll h,w; cin >> h >> w; ll hw = h * w; //それぞれの面積 ll a,b,c; ll smax,smin; int res = INF; //方針: 基本的に全探索 smaxが半分を超えたら終了 //パターンわけ 6パターンあるのでそれを全部調べる //1. 横で切る for(ll i = 1; i <= h-2; ++i) { a = w * i; if(a > hw / 2)break; for(ll j = i + 1; j <= h-1; ++j) { b = w * (j - i); if(b > hw / 2)break; c = w * (h - j); smax = max(a,max(b,c)); smin = min(a,min(b,c)); res = min(res, smax - smin); } } //2.縦できる for(ll i = 1; i <= w-2; ++i) { a = h * i; if(a > hw / 2)break; for(ll j = i + 1; j <= w-1; ++j) { b = h * (j - i); if(b > hw / 2)break; c = h * (h - j); smax = max(a,max(b,c)); smin = min(a,min(b,c)); res = min(res, smax - smin); } } //3. 左は1右を2分割 for(ll i = 1; i <= w-2; ++i) { a = h * i; if(a > hw / 2)break; for(ll j = i + 1; j <= w-1; ++j) { b = h * (j - i); if(b > hw / 2)break; c = h * (h - j); smax = max(a,max(b,c)); smin = min(a,min(b,c)); res = min(res, smax - smin); } } cout << res << endl; return 0; }
a.cc: In function 'int main()': a.cc:27:15: warning: overflow in conversion from 'long long int' to 'int' changes value from '1000000000000000000' to '-1486618624' [-Woverflow] 27 | int res = INF; | ^~~ a.cc:44:22: error: no matching function for call to 'min(int&, ll)' 44 | res = min(res, smax - smin); | ~~~^~~~~~~~~~~~~~~~~~ In file included from /usr/include/c++/14/string:51, from /usr/include/c++/14/bits/locale_classes.h:40, from /usr/include/c++/14/bits/ios_base.h:41, from /usr/include/c++/14/ios:44, from /usr/include/c++/14/ostream:40, from /usr/include/c++/14/iostream:41, from a.cc:2: /usr/include/c++/14/bits/stl_algobase.h:233:5: note: candidate: 'template<class _Tp> constexpr const _Tp& std::min(const _Tp&, const _Tp&)' 233 | min(const _Tp& __a, const _Tp& __b) | ^~~ /usr/include/c++/14/bits/stl_algobase.h:233:5: note: template argument deduction/substitution failed: a.cc:44:22: note: deduced conflicting types for parameter 'const _Tp' ('int' and 'll' {aka 'long long int'}) 44 | res = min(res, smax - smin); | ~~~^~~~~~~~~~~~~~~~~~ /usr/include/c++/14/bits/stl_algobase.h:281:5: note: candidate: 'template<class _Tp, class _Compare> constexpr const _Tp& std::min(const _Tp&, const _Tp&, _Compare)' 281 | min(const _Tp& __a, const _Tp& __b, _Compare __comp) | ^~~ /usr/include/c++/14/bits/stl_algobase.h:281:5: note: candidate expects 3 arguments, 2 provided In file included from /usr/include/c++/14/algorithm:61, from a.cc:5: /usr/include/c++/14/bits/stl_algo.h:5686:5: note: candidate: 'template<class _Tp> constexpr _Tp std::min(initializer_list<_Tp>)' 5686 | min(initializer_list<_Tp> __l) | ^~~ /usr/include/c++/14/bits/stl_algo.h:5686:5: note: candidate expects 1 argument, 2 provided /usr/include/c++/14/bits/stl_algo.h:5696:5: note: candidate: 'template<class _Tp, class _Compare> constexpr _Tp std::min(initializer_list<_Tp>, _Compare)' 5696 | min(initializer_list<_Tp> __l, _Compare __comp) | ^~~ /usr/include/c++/14/bits/stl_algo.h:5696:5: note: template argument deduction/substitution failed: a.cc:44:22: note: mismatched types 'std::initializer_list<_Tp>' and 'int' 44 | res = min(res, smax - smin); | ~~~^~~~~~~~~~~~~~~~~~ a.cc:59:22: error: no matching function for call to 'min(int&, ll)' 59 | res = min(res, smax - smin); | ~~~^~~~~~~~~~~~~~~~~~ /usr/include/c++/14/bits/stl_algobase.h:233:5: note: candidate: 'template<class _Tp> constexpr const _Tp& std::min(const _Tp&, const _Tp&)' 233 | min(const _Tp& __a, const _Tp& __b) | ^~~ /usr/include/c++/14/bits/stl_algobase.h:233:5: note: template argument deduction/substitution failed: a.cc:59:22: note: deduced conflicting types for parameter 'const _Tp' ('int' and 'll' {aka 'long long int'}) 59 | res = min(res, smax - smin); | ~~~^~~~~~~~~~~~~~~~~~ /usr/include/c++/14/bits/stl_algobase.h:281:5: note: candidate: 'template<class _Tp, class _Compare> constexpr const _Tp& std::min(const _Tp&, const _Tp&, _Compare)' 281 | min(const _Tp& __a, const _Tp& __b, _Compare __comp) | ^~~ /usr/include/c++/14/bits/stl_algobase.h:281:5: note: candidate expects 3 arguments, 2 provided /usr/include/c++/14/bits/stl_algo.h:5686:5: note: candidate: 'template<class _Tp> constexpr _Tp std::min(initializer_list<_Tp>)' 5686 | min(initializer_list<_Tp> __l) | ^~~ /usr/include/c++/14/bits/stl_algo.h:5686:5: note: candidate expects 1 argument, 2 provided /usr/include/c++/14/bits/stl_algo.h:5696:5: note: candidate: 'template<class _Tp, class _Compare> constexpr _Tp std::min(initializer_list<_Tp>, _Compare)' 5696 | min(initializer_list<_Tp> __l, _Compare __comp) | ^~~ /usr/include/c++/14/bits/stl_algo.h:5696:5: note: template argument deduction/substitution failed: a.cc:59:22: note: mismatched types 'std::initializer_list<_Tp>' and 'int' 59 | res = min(res, smax - smin); | ~~~^~~~~~~~~~~~~~~~~~ a.cc:74:22: error: no matching function for call to 'min(int&, ll)' 74 | res = min(res, smax - smin); | ~~~^~~~~~~~~~~~~~~~~~ /usr/include/c++/14/bits/stl_algobase.h:233:5: note: candidate: 'template<class _Tp> constexpr const _Tp& std::min(const _Tp&, const _Tp&)' 233 | min(const _Tp& __a, const _Tp& __b) | ^~~ /usr/include/c++/14/bits/stl_algobase.h:233:5: note: template argument deduction/substitution failed: a.cc:74:22: note: deduced conflicting types for parameter 'const _Tp' ('int' and 'll' {aka 'long long int'}) 74 | res = min(res, smax - smin); | ~~~^~~~~~~~~~~~~~~~~~ /usr/include/c++/14/bits/stl_algobase.h:281:5: note: candidate: 'template<class _Tp, class _Compare> constexpr const _Tp& std::min(const _Tp&, const _Tp&, _Compare)' 281 | min(const _Tp& __a, const _Tp& __b, _Compare __comp) | ^~~ /usr/include/c++/14/bits/stl_algobase.h:281:5: note: candidate expects 3 arguments, 2 provided /usr/include/c++/14/bits/stl_algo.h:5686:5: note: candidate: 'template<class _Tp> constexpr _Tp std::min(initializer_list<_Tp>)' 5686 | min(initializer_list<_Tp> __l) | ^~~ /usr/include/c++/14/bits/stl_algo.h:5686:5: note: candidate expects 1 argument, 2 provided /usr/include/c++/14/bits/stl_algo.h:5696:5: note: candidate: 'template<class _Tp, class _Compare> constexpr _Tp std::min(initializer_list<_Tp>, _Compare)' 5696 | min(initializer_list<_Tp> __l, _Compare __comp) | ^~~ /usr/include/c++/14/bits/stl_algo.h:5696:5: note: template argument deduction/substitution failed: a.cc:74:22: note: mismatched types 'std::initializer_list<_Tp>' and 'int' 74 | res = min(res, smax - smin); | ~~~^~~~~~~~~~~~~~~~~~
s988256392
p03713
C++
#include<bits/stdc++.h> typedef long long ll; using namespace std; ll H, W; ll calc(ll a, ll b, ll c){ ll mi = min(a, b); mi = min(mi, c); ll ma = max(a, b); ma = max(ma, c); return ma - mi; } ll divi(ll h, ll w){ ll ans = (ll)1e9; if(h >= 3){ ans = min(ans, (h%3?w:0)); } ll a = (w / 3) * h; ll b = (w - (a / h)) * (h / 2); ans = min(ans, calc(a, b, h * w - a - b)); a += h; ll b = (w - (a / h)) * (h / 2); ans = min(ans, calc(a, b, h * w - a - b)); return ans; } int main(){ cin >> H >> W; ll ans = 1e9; ans = min(ans, divi(H, W)); ans = min(ans, divi(W, H)); cout << ans<< endl; }
a.cc: In function 'll divi(ll, ll)': a.cc:26:6: error: redeclaration of 'll b' 26 | ll b = (w - (a / h)) * (h / 2); | ^ a.cc:21:6: note: 'll b' previously declared here 21 | ll b = (w - (a / h)) * (h / 2); | ^
s699545436
p03713
C++
#include <bits/stdc++.h> using namespace std; typedef long long ll; int main() { ll h,w;cin>>h>>w; ll ans=1e9; for (int i=0;i<2;i++) { for (int j=1;j<h;j++) { int hh=h-j; int hhh=hh/2; int hhhh=hh-hhh; ll mx=max(j,max(hhh,hhhh)); ll mn=min(j,min(hhh,hhhh)); ans=min(ans,(mx*w-mn*w); ll ww=w/2; ll www=w-ww; mx=max(j*w,max(ww*hh,www*hh)); mn=min(j*w,min(ww*hh,www*hh)); ans=min(ans,mx-mn); } swap(h,w); } cout<<ans<<endl; return 0; }
a.cc: In function 'int main()': a.cc:15:36: error: expected ')' before ';' token 15 | ans=min(ans,(mx*w-mn*w); | ~ ^ | )
s172191143
p03713
C++
#include <bits/stdc++.h> using namespace std; typedef long long ll; int main() { ll h,w;cin>>h>>w; int ans=1e9; for (int i=0;i<2;i++) { for (int j=1;j<h;j++) { int hh=h-j; int hhh=hh/2; int hhhh=hh-hhh; ll mx=max(j,max(hhh,hhhh)); ll mn=min(j,min(hhh,hhhh)); ans=min(ans,(mx*w-mn*w); ll ww=w/2; ll www=w-ww; mx=max(j*w,max(ww*hh,www*hh)); mn=min(j*w,min(ww*hh,www*hh)); ans=min(ans,mx-mn); } swap(h,w); } cout<<ans<<endl; return 0; }
a.cc: In function 'int main()': a.cc:15:36: error: expected ')' before ';' token 15 | ans=min(ans,(mx*w-mn*w); | ~ ^ | ) a.cc:20:20: error: no matching function for call to 'min(int&, ll)' 20 | ans=min(ans,mx-mn); | ~~~^~~~~~~~~~~ In file included from /usr/include/c++/14/algorithm:60, from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:51, from a.cc:1: /usr/include/c++/14/bits/stl_algobase.h:233:5: note: candidate: 'template<class _Tp> constexpr const _Tp& std::min(const _Tp&, const _Tp&)' 233 | min(const _Tp& __a, const _Tp& __b) | ^~~ /usr/include/c++/14/bits/stl_algobase.h:233:5: note: template argument deduction/substitution failed: a.cc:20:20: note: deduced conflicting types for parameter 'const _Tp' ('int' and 'll' {aka 'long long int'}) 20 | ans=min(ans,mx-mn); | ~~~^~~~~~~~~~~ /usr/include/c++/14/bits/stl_algobase.h:281:5: note: candidate: 'template<class _Tp, class _Compare> constexpr const _Tp& std::min(const _Tp&, const _Tp&, _Compare)' 281 | min(const _Tp& __a, const _Tp& __b, _Compare __comp) | ^~~ /usr/include/c++/14/bits/stl_algobase.h:281:5: note: candidate expects 3 arguments, 2 provided In file included from /usr/include/c++/14/algorithm:61: /usr/include/c++/14/bits/stl_algo.h:5686:5: note: candidate: 'template<class _Tp> constexpr _Tp std::min(initializer_list<_Tp>)' 5686 | min(initializer_list<_Tp> __l) | ^~~ /usr/include/c++/14/bits/stl_algo.h:5686:5: note: candidate expects 1 argument, 2 provided /usr/include/c++/14/bits/stl_algo.h:5696:5: note: candidate: 'template<class _Tp, class _Compare> constexpr _Tp std::min(initializer_list<_Tp>, _Compare)' 5696 | min(initializer_list<_Tp> __l, _Compare __comp) | ^~~ /usr/include/c++/14/bits/stl_algo.h:5696:5: note: template argument deduction/substitution failed: a.cc:20:20: note: mismatched types 'std::initializer_list<_Tp>' and 'int' 20 | ans=min(ans,mx-mn); | ~~~^~~~~~~~~~~
s549280671
p03713
C++
#include <bits/stdc++.h> using namespace std; typedef long long ll; int main() { int h,w;cin>>h>>w; int ans=1e9; for (int i=0;i<2;i++) { for (int j=1;j<h;j++) { int hh=h-j; int hhh=hh/2; int hhhh=hh-hhh; ll mx=max(j,max(hhh,hhhh)); ll mn=min(j,min(hhh,hhhh)); ans=min(ans,(mx*w-mn*w); ll ww=w/2; ll www=w-ww; mx=max(j*w,max(ww*hh,www*hh)); mn=min(j*w,min(ww*hh,www*hh)); ans=min(ans,mx-mn); } swap(h,w); } cout<<ans<<endl; return 0; }
a.cc: In function 'int main()': a.cc:15:36: error: expected ')' before ';' token 15 | ans=min(ans,(mx*w-mn*w); | ~ ^ | ) a.cc:18:19: error: no matching function for call to 'max(int, const long long int&)' 18 | mx=max(j*w,max(ww*hh,www*hh)); | ~~~^~~~~~~~~~~~~~~~~~~~~~~ In file included from /usr/include/c++/14/algorithm:60, from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:51, from a.cc:1: /usr/include/c++/14/bits/stl_algobase.h:257:5: note: candidate: 'template<class _Tp> constexpr const _Tp& std::max(const _Tp&, const _Tp&)' 257 | max(const _Tp& __a, const _Tp& __b) | ^~~ /usr/include/c++/14/bits/stl_algobase.h:257:5: note: template argument deduction/substitution failed: a.cc:18:19: note: deduced conflicting types for parameter 'const _Tp' ('int' and 'long long int') 18 | mx=max(j*w,max(ww*hh,www*hh)); | ~~~^~~~~~~~~~~~~~~~~~~~~~~ /usr/include/c++/14/bits/stl_algobase.h:303:5: note: candidate: 'template<class _Tp, class _Compare> constexpr const _Tp& std::max(const _Tp&, const _Tp&, _Compare)' 303 | max(const _Tp& __a, const _Tp& __b, _Compare __comp) | ^~~ /usr/include/c++/14/bits/stl_algobase.h:303:5: note: candidate expects 3 arguments, 2 provided In file included from /usr/include/c++/14/algorithm:61: /usr/include/c++/14/bits/stl_algo.h:5706:5: note: candidate: 'template<class _Tp> constexpr _Tp std::max(initializer_list<_Tp>)' 5706 | max(initializer_list<_Tp> __l) | ^~~ /usr/include/c++/14/bits/stl_algo.h:5706:5: note: candidate expects 1 argument, 2 provided /usr/include/c++/14/bits/stl_algo.h:5716:5: note: candidate: 'template<class _Tp, class _Compare> constexpr _Tp std::max(initializer_list<_Tp>, _Compare)' 5716 | max(initializer_list<_Tp> __l, _Compare __comp) | ^~~ /usr/include/c++/14/bits/stl_algo.h:5716:5: note: template argument deduction/substitution failed: a.cc:18:19: note: mismatched types 'std::initializer_list<_Tp>' and 'int' 18 | mx=max(j*w,max(ww*hh,www*hh)); | ~~~^~~~~~~~~~~~~~~~~~~~~~~ a.cc:19:19: error: no matching function for call to 'min(int, const long long int&)' 19 | mn=min(j*w,min(ww*hh,www*hh)); | ~~~^~~~~~~~~~~~~~~~~~~~~~~ /usr/include/c++/14/bits/stl_algobase.h:233:5: note: candidate: 'template<class _Tp> constexpr const _Tp& std::min(const _Tp&, const _Tp&)' 233 | min(const _Tp& __a, const _Tp& __b) | ^~~ /usr/include/c++/14/bits/stl_algobase.h:233:5: note: template argument deduction/substitution failed: a.cc:19:19: note: deduced conflicting types for parameter 'const _Tp' ('int' and 'long long int') 19 | mn=min(j*w,min(ww*hh,www*hh)); | ~~~^~~~~~~~~~~~~~~~~~~~~~~ /usr/include/c++/14/bits/stl_algobase.h:281:5: note: candidate: 'template<class _Tp, class _Compare> constexpr const _Tp& std::min(const _Tp&, const _Tp&, _Compare)' 281 | min(const _Tp& __a, const _Tp& __b, _Compare __comp) | ^~~ /usr/include/c++/14/bits/stl_algobase.h:281:5: note: candidate expects 3 arguments, 2 provided /usr/include/c++/14/bits/stl_algo.h:5686:5: note: candidate: 'template<class _Tp> constexpr _Tp std::min(initializer_list<_Tp>)' 5686 | min(initializer_list<_Tp> __l) | ^~~ /usr/include/c++/14/bits/stl_algo.h:5686:5: note: candidate expects 1 argument, 2 provided /usr/include/c++/14/bits/stl_algo.h:5696:5: note: candidate: 'template<class _Tp, class _Compare> constexpr _Tp std::min(initializer_list<_Tp>, _Compare)' 5696 | min(initializer_list<_Tp> __l, _Compare __comp) | ^~~ /usr/include/c++/14/bits/stl_algo.h:5696:5: note: template argument deduction/substitution failed: a.cc:19:19: note: mismatched types 'std::initializer_list<_Tp>' and 'int' 19 | mn=min(j*w,min(ww*hh,www*hh)); | ~~~^~~~~~~~~~~~~~~~~~~~~~~ a.cc:20:20: error: no matching function for call to 'min(int&, ll)' 20 | ans=min(ans,mx-mn); | ~~~^~~~~~~~~~~ /usr/include/c++/14/bits/stl_algobase.h:233:5: note: candidate: 'template<class _Tp> constexpr const _Tp& std::min(const _Tp&, const _Tp&)' 233 | min(const _Tp& __a, const _Tp& __b) | ^~~ /usr/include/c++/14/bits/stl_algobase.h:233:5: note: template argument deduction/substitution failed: a.cc:20:20: note: deduced conflicting types for parameter 'const _Tp' ('int' and 'll' {aka 'long long int'}) 20 | ans=min(ans,mx-mn); | ~~~^~~~~~~~~~~ /usr/include/c++/14/bits/stl_algobase.h:281:5: note: candidate: 'template<class _Tp, class _Compare> constexpr const _Tp& std::min(const _Tp&, const _Tp&, _Compare)' 281 | min(const _Tp& __a, const _Tp& __b, _Compare __comp) | ^~~ /usr/include/c++/14/bits/stl_algobase.h:281:5: note: candidate expects 3 arguments, 2 provided /usr/include/c++/14/bits/stl_algo.h:5686:5: note: candidate: 'template<class _Tp> constexpr _Tp std::min(initializer_list<_Tp>)' 5686 | min(initializer_list<_Tp> __l) | ^~~ /usr/include/c++/14/bits/stl_algo.h:5686:5: note: candidate expects 1 argument, 2 provided /usr/include/c++/14/bits/stl_algo.h:5696:5: note: candidate: 'template<class _Tp, class _Compare> constexpr _Tp std::min(initializer_list<_Tp>, _Compare)' 5696 | min(initializer_list<_Tp> __l, _Compare __comp) | ^~~ /usr/include/c++/14/bits/stl_algo.h:5696:5: note: template argument deduction/substitution failed: a.cc:20:20: note: mismatched types 'std::initializer_list<_Tp>' and 'int' 20 | ans=min(ans,mx-mn); | ~~~^~~~~~~~~~~
s798654010
p03713
C++
#include<bits/stdc++.h> using namespace std; int main(){ int H,W; cin>>H >>W; if(H%3==0||W%3==0){ cout<<0<<endl; return 0; } int ans=INT_MAX; for(int i=1;i<H;i++){ int Sa=i*W, Sb=W/2*(H-i), Sc=(W-W/2)*(H-i); ans=min(ans, max({Sa, Sb, Sc})-min({Sa, Sb, Sc})); } for(int i=1;i<H-1;i++){ int Sa=i*W, Sb=(H-i)/2*W, Sc=(H-(H-i)/2))*W; ans=min(ans, max({Sa, Sb, Sc})-min({Sa, Sb, Sc})); } for(int i=1;i<W;i++){ int Sa=i*H, Sb=H/2*(W-i), Sc=(H-H/2)*(W-i); ans=min(ans, max({Sa, Sb, Sc})-min({Sa, Sb, Sc})); } for(int i=1;i<W-1;i++){ int Sa=i*H, Sb=(W-i)/2*H, Sc=(W-(W-i)/2))*H; ans=min(ans, max({Sa, Sb, Sc})-min({Sa, Sb, Sc})); } cout<<ans<<endl; return 0; }
a.cc: In function 'int main()': a.cc:18:45: error: expected ',' or ';' before ')' token 18 | int Sa=i*W, Sb=(H-i)/2*W, Sc=(H-(H-i)/2))*W; | ^ a.cc:28:45: error: expected ',' or ';' before ')' token 28 | int Sa=i*H, Sb=(W-i)/2*H, Sc=(W-(W-i)/2))*H; | ^