output
stringlengths
52
181k
instruction
stringlengths
296
182k
#include <iostream> #include <iomanip> #include <cstdio> #include <string> #include <cstring> #include <deque> #include <list> #include <queue> #include <stack> #include <vector> #include <utility> #include <algorithm> #include <map> #include <set> #include <complex> #include <cmath> #include <limits> #include <cfloat>...
### Prompt Your challenge is to write a Cpp solution to the following problem: Your master went to the town for a day. You could have a relaxed day without hearing his scolding. But he ordered you to make donuts dough by the evening. Loving donuts so much, he can't live without eating tens of donuts everyday. What a ...
#include<iostream> #include<string> #include<cstring> #include<vector> #include<set> using namespace std; typedef vector<int> vi; set<string> cands; int dy[]={-1,-1,-1,0,0,1,1,1}; int dx[]={-1,0,1,-1,1,-1,0,1}; int maxlength=0,h,w; string ans=""; void check(int y,int x,string *board) { for(int k=0;k<8;k++) { bo...
### Prompt Create a solution in Cpp for the following problem: Your master went to the town for a day. You could have a relaxed day without hearing his scolding. But he ordered you to make donuts dough by the evening. Loving donuts so much, he can't live without eating tens of donuts everyday. What a chore for such a...
#include <iostream> #include <string> using namespace std; int dx[] = {-1,-1,-1,0,1,1,1,0}; int dy[] = {-1,0,1,1,1,0,-1,-1}; int main(){ int h, w; string mp[10]; while(cin >> h >> w, h){ for(int i=0;i<h;i++) cin >> mp[i]; string res = ""; for(int i=0;i<w*h;i++){ if(res.size() == w*h) break; int x1 = i...
### Prompt In CPP, your task is to solve the following problem: Your master went to the town for a day. You could have a relaxed day without hearing his scolding. But he ordered you to make donuts dough by the evening. Loving donuts so much, he can't live without eating tens of donuts everyday. What a chore for such ...
#include<iostream> #include<string> #include<map> #include<algorithm> using namespace std; const int dx[] = {-1,-1,-1, 0, 0, 1, 1, 1}; const int dy[] = {-1, 0, 1,-1, 1,-1, 0, 1}; typedef map<string,int>M; M spell; string mat[10]; void Search(int sx,int sy, int a, int h, int w) { bool f[10][20]={}; string str; int...
### Prompt Generate a cpp solution to the following problem: Your master went to the town for a day. You could have a relaxed day without hearing his scolding. But he ordered you to make donuts dough by the evening. Loving donuts so much, he can't live without eating tens of donuts everyday. What a chore for such a b...
#include <iostream> #include <string> #include <vector> #include <set> using namespace std; #define rep(i, n) for(int i=0; i<(n); ++i) #define mp(a, b) make_pair(a, b) template<typename T, typename Compare = greater<T> > inline void chmax(T& t, T f, Compare comp){if(!comp(t, f))t = f;} int h, w; inline int add(int...
### Prompt Please formulate a CPP solution to the following problem: Your master went to the town for a day. You could have a relaxed day without hearing his scolding. But he ordered you to make donuts dough by the evening. Loving donuts so much, he can't live without eating tens of donuts everyday. What a chore for ...
#include <bits/stdc++.h> #define var auto using ll = long long; const char newl = '\n'; template <typename T1, typename T2> inline void chmin(T1& a, T2 b) {if(a > b) a = b;} template <typename T1, typename T2> inline void chmax(T1& a, T2 b) {if(a < b) a = b;} using namespace std; signed main(){ while(true){ ...
### Prompt Your task is to create a Cpp solution to the following problem: Your master went to the town for a day. You could have a relaxed day without hearing his scolding. But he ordered you to make donuts dough by the evening. Loving donuts so much, he can't live without eating tens of donuts everyday. What a chor...
#include <bits/stdc++.h> using namespace std; #define rep(i, n) REP(i, 0, n) #define REP(i, s, e) for(int i = (int)(s); i< (int)(e); ++i) int dx[] = {0, 0, -1,-1, -1, 1, 1, 1}; int dy[] = {-1, 1, 0, 1, -1, 0, 1,-1}; map<string, int> mp; vector<string> input; int H, W; typedef long long ll; typedef pair<int, int> pi...
### Prompt Create a solution in cpp for the following problem: Your master went to the town for a day. You could have a relaxed day without hearing his scolding. But he ordered you to make donuts dough by the evening. Loving donuts so much, he can't live without eating tens of donuts everyday. What a chore for such a...
#include<iostream> #include<vector> #include<cstring> #include<algorithm> using namespace std; int gcd(int a, int b){ if(b == 0)return a; return gcd(b, a%b); } int lcm(int a, int b){ return a/gcd(a, b) * b; } int main(int argc, char *argv[]){ int w, h; while(cin >> h >> w, h){ string torus[30]; str...
### Prompt Please formulate a Cpp solution to the following problem: Your master went to the town for a day. You could have a relaxed day without hearing his scolding. But he ordered you to make donuts dough by the evening. Loving donuts so much, he can't live without eating tens of donuts everyday. What a chore for ...
#include <iostream> #include <vector> #include <string> #include <algorithm> using namespace std; int h, w; void solve(int y, int x, vector<string> const& v, vector<string>& ret) { int dx[8] = {0, 1, 1, 1, 0, -1, -1, -1}, dy[8] = {-1, -1, 0, 1, 1, 1, 0, -1}; for(int i=0; i<8; ++i) { string s; ...
### Prompt In cpp, your task is to solve the following problem: Your master went to the town for a day. You could have a relaxed day without hearing his scolding. But he ordered you to make donuts dough by the evening. Loving donuts so much, he can't live without eating tens of donuts everyday. What a chore for such ...
#include <bits/stdc++.h> using namespace std; const int MAX_H=11,MAX_W=21; const int dx[8]={1,0,-1,0,1,1,-1,-1}; const int dy[8]={0,1,0,-1,1,-1,1,-1}; int h,w,x,y; string now,ans; string S[MAX_H]; int visited[MAX_H][MAX_W]; set<string> cnt; void solve(){ ans=""; cnt.clear(); for (int i=0;i<h;++i){ for...
### Prompt Create a solution in Cpp for the following problem: Your master went to the town for a day. You could have a relaxed day without hearing his scolding. But he ordered you to make donuts dough by the evening. Loving donuts so much, he can't live without eating tens of donuts everyday. What a chore for such a...
#include <iostream> #include <map> #include <string> using namespace std; int w,h; string ans; string ptn[30]; int di[] = {0,1,0,-1, 1,1,-1,-1}; int dj[] = {1,0,-1,0, 1,-1,-1,1}; int main(){ string s; while( cin >> h >> w && (h|w) ){ for( int i=0;i<h;i++ ){ cin >> ptn[i]; } ans=""; map<string...
### Prompt Create a solution in CPP for the following problem: Your master went to the town for a day. You could have a relaxed day without hearing his scolding. But he ordered you to make donuts dough by the evening. Loving donuts so much, he can't live without eating tens of donuts everyday. What a chore for such a...
#include <iostream> #include <vector> #include <algorithm> #include <map> #include <queue> #include <cstdio> #include <ctime> #include <assert.h> #include <chrono> #include <random> #include <numeric> #include <set> #include <deque> #include <stack> #include <bitset> using namespace std; typedef long long int ll; typed...
### Prompt Develop a solution in cpp to the problem described below: Your master went to the town for a day. You could have a relaxed day without hearing his scolding. But he ordered you to make donuts dough by the evening. Loving donuts so much, he can't live without eating tens of donuts everyday. What a chore for ...
#include <cstdio> #include <cstring> #include <cstdlib> #include <cassert> #include <algorithm> #include <iostream> #include <vector> #include <string> #include <set> using namespace std; #define LET(name, value) __typeof(value) name = value #define REP(i, n) for (int i = 0; i < (int)(n); ++i) #define FOR(i, a, b) for...
### Prompt Develop a solution in Cpp to the problem described below: Your master went to the town for a day. You could have a relaxed day without hearing his scolding. But he ordered you to make donuts dough by the evening. Loving donuts so much, he can't live without eating tens of donuts everyday. What a chore for ...
#include <cstdio> #include <string> #include <set> #include <vector> using namespace std; int dr[]={-1, -1, -1, 0, 0, 1, 1, 1}; int dc[]={-1, 0, 1, -1, 1, -1, 0, 1}; bool cmp(const string& a, const string& b) { if (a.size()<b.size()) return 1; if (a.size()>b.size()) return 0; return a>b; } int main() { ...
### Prompt Create a solution in CPP for the following problem: Your master went to the town for a day. You could have a relaxed day without hearing his scolding. But he ordered you to make donuts dough by the evening. Loving donuts so much, he can't live without eating tens of donuts everyday. What a chore for such a...
#include <iostream> #include <cstdio> #include <cstring> #include <algorithm> #include <map> using namespace std; #define rep(i, n) for(int i = 0 ; i < n ; i++) const int dx[] = {0, 0, 1, -1, 1, 1, -1, -1}; const int dy[] = {1, -1, 0, 0, 1, -1, 1, -1}; int H, W; map<string, int> past; char field[12][22]; void solve...
### Prompt In Cpp, your task is to solve the following problem: Your master went to the town for a day. You could have a relaxed day without hearing his scolding. But he ordered you to make donuts dough by the evening. Loving donuts so much, he can't live without eating tens of donuts everyday. What a chore for such ...
#include <iostream> #include <string> #include <map> using namespace std; int main() { int w, h; char seat[10][20]; map<string, int> mp; int dx[] = { 0, 1, 1, 1, 0, -1, -1, -1 }; int dy[] = { 1, 1, 0, -1, -1, -1, 0, 1 }; while( cin >> h >> w, (h||w)) { mp.clear(); for( int j = 0; j < h; j++) for( ...
### Prompt Your challenge is to write a Cpp solution to the following problem: Your master went to the town for a day. You could have a relaxed day without hearing his scolding. But he ordered you to make donuts dough by the evening. Loving donuts so much, he can't live without eating tens of donuts everyday. What a ...
#include <iostream> #include <algorithm> #include <string> #include <set> using namespace std; const int dy[8] = {1,1,1,0,0,-1,-1,-1}; const int dx[8] = {-1,0,1,-1,1,-1,0,1}; int h,w; string str[10]; void solve(){ int y, x, ansn = 0; string ans = "0", st; set<string> s; for(int i=0;i<h;i++){ for(int j...
### Prompt Generate a cpp solution to the following problem: Your master went to the town for a day. You could have a relaxed day without hearing his scolding. But he ordered you to make donuts dough by the evening. Loving donuts so much, he can't live without eating tens of donuts everyday. What a chore for such a b...
#include <bits/stdc++.h> #define REP(i,n) for(int i=0;i<(int)(n);i++) #define ALL(x) (x).begin(), (x).end() using namespace std; template <typename T> T &chmin(T &a, const T &b) { return a = min(a, b); } template <typename T> T &chmax(T &a, const T &b) { return a = max(a, b); } using ll = long long; using ld = long...
### Prompt Generate a CPP solution to the following problem: Your master went to the town for a day. You could have a relaxed day without hearing his scolding. But he ordered you to make donuts dough by the evening. Loving donuts so much, he can't live without eating tens of donuts everyday. What a chore for such a b...
#include <bits/stdc++.h> #define rep(i,n) for(int i=0;i<n;i++) using namespace std; const int INF=INT_MAX,MOD=1e9+7; int main(){ int dx[8]={0,1,1,1,0,-1,-1,-1}; int dy[8]={-1,-1,0,1,1,1,0,-1}; int h,w; while(cin>>h>>w&&h){ char c[h][w]; rep(i,h)rep(j,w) cin>>c[i][j]; vector<string> s; for(int y=0;y<h;y++){ ...
### Prompt Create a solution in cpp for the following problem: Your master went to the town for a day. You could have a relaxed day without hearing his scolding. But he ordered you to make donuts dough by the evening. Loving donuts so much, he can't live without eating tens of donuts everyday. What a chore for such a...
#include<iostream> #include<string> #include<algorithm> #include<vector> #include<cstdio> #include<cstring> #include<map> using namespace std; #define rep(i,n) for(int i=0;i<n;i++) #define REP(n) rep(i,n) #define all(n) n.begin(),n.end() #define foreach(c,it) for(typeof(c.begin()) it=c.begin();it!=c.end();++it) int dx...
### Prompt In CPP, your task is to solve the following problem: Your master went to the town for a day. You could have a relaxed day without hearing his scolding. But he ordered you to make donuts dough by the evening. Loving donuts so much, he can't live without eating tens of donuts everyday. What a chore for such ...
#include <bits/stdc++.h> #include <regex> using namespace std; #define FOR(i,k,n) for(int i = (k); i < (n); i++) #define REP(i,n) FOR(i,0,n) #define ALL(a) begin(a),end(a) #define MS(m,v) memset(m,v,sizeof(m)) #define D10 fixed<<setprecision(10) typedef vector<int> vi; typedef vector<string> vs; typedef pair<int, int>...
### Prompt Construct a CPP code solution to the problem outlined: Your master went to the town for a day. You could have a relaxed day without hearing his scolding. But he ordered you to make donuts dough by the evening. Loving donuts so much, he can't live without eating tens of donuts everyday. What a chore for suc...
#include <cstdio> #include <cstdlib> #include <cmath> #include <climits> #include <cfloat> #include <cstring> #include <map> #include <utility> #include <set> #include <iostream> #include <memory> #include <string> #include <vector> #include <algorithm> #include <functional> #include <sstream> #include <complex> #incl...
### Prompt Your challenge is to write a Cpp solution to the following problem: Your master went to the town for a day. You could have a relaxed day without hearing his scolding. But he ordered you to make donuts dough by the evening. Loving donuts so much, he can't live without eating tens of donuts everyday. What a ...
#include <iostream> #include <algorithm> #include <set> using namespace std; #define REP(i,x)for(__typeof(x) i=0;i<x;i++) string res; set<string> m; int H,W,dx,dy,min_len; char s[200]; string MAP[11]; bool visit[20][20]; void dfs(int x,int y,int k){ if(k==min_len){ if(m.count(string(s)))res=min(res,string(s)); ...
### Prompt In cpp, your task is to solve the following problem: Your master went to the town for a day. You could have a relaxed day without hearing his scolding. But he ordered you to make donuts dough by the evening. Loving donuts so much, he can't live without eating tens of donuts everyday. What a chore for such ...
#include <bits/stdc++.h> using namespace std; int dy[8] = {-1, -1, -1, 0, 0, 1, 1, 1}; int dx[8] = {-1, 0, 1, -1, 1, -1, 0, 1}; int h, w; vector<string> lt; map<string, int> mp; void dfs(int sy, int sx, int y, int x, int dir, string s) { int ny = (y + dy[dir] + h) % h; int nx = (x + dx[dir] + w) % w; if ...
### Prompt Generate a cpp solution to the following problem: Your master went to the town for a day. You could have a relaxed day without hearing his scolding. But he ordered you to make donuts dough by the evening. Loving donuts so much, he can't live without eating tens of donuts everyday. What a chore for such a b...
#include<bits/stdc++.h> using namespace std; #define int long long typedef pair<int,int>pint; typedef vector<int>vint; typedef vector<pint>vpint; #define pb push_back #define mp make_pair #define fi first #define se second #define all(v) (v).begin(),(v).end() #define rep(i,n) for(int i=0;i<(n);i++) #define reps(i,f,n)...
### Prompt In cpp, your task is to solve the following problem: Your master went to the town for a day. You could have a relaxed day without hearing his scolding. But he ordered you to make donuts dough by the evening. Loving donuts so much, he can't live without eating tens of donuts everyday. What a chore for such ...
#include <iostream> #include <string> #include <vector> #include <algorithm> using namespace std; int h, w; int dy[8] = {-1, -1, 0, 1, 1, 1, 0, -1}; int dx[8] = {0, 1, 1, 1, 0, -1, -1, -1}; bool vis[10][20]; char dat[10][20]; vector<string> str; void calc(int y, int x, int d){ fill(vis[0], vis[10], false); strin...
### Prompt Create a solution in CPP for the following problem: Your master went to the town for a day. You could have a relaxed day without hearing his scolding. But he ordered you to make donuts dough by the evening. Loving donuts so much, he can't live without eating tens of donuts everyday. What a chore for such a...
#include <bits/stdc++.h> using namespace std; long long int dx[] = { 0,1,1,1,0,-1,-1,-1 }; long long int dy[] = { 1,1,0,-1,-1,-1,0,1 }; int main() { long long int M , N; while(cin >> M >> N , M || N) { vector<vector<char>>D(M , vector<char>(N)); set<string>SS; string ans; for(size_t i = 0; i < M; i++) {...
### Prompt Please create a solution in CPP to the following problem: Your master went to the town for a day. You could have a relaxed day without hearing his scolding. But he ordered you to make donuts dough by the evening. Loving donuts so much, he can't live without eating tens of donuts everyday. What a chore for ...
#include <iostream> #include <fstream> #include <cstdio> #include <cmath> #include <vector> #include <cstring> #include <string> #include <set> #include <map> #include <stack> #include <queue> #include <algorithm> 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) ...
### Prompt Please provide a CPP coded solution to the problem described below: Your master went to the town for a day. You could have a relaxed day without hearing his scolding. But he ordered you to make donuts dough by the evening. Loving donuts so much, he can't live without eating tens of donuts everyday. What a ...
#include <stdio.h> #include <cmath> #include <algorithm> #include <stack> #include <queue> #include <vector> #include <set> #include <string> #include <iostream> typedef long long int ll; #define BIG_NUM 2000000000 #define MOD 1000000007 #define EPS 0.000001 using namespace std; int div_row[8] = {-1,-1,-1,0,0,1,1,1},d...
### Prompt Create a solution in cpp for the following problem: Your master went to the town for a day. You could have a relaxed day without hearing his scolding. But he ordered you to make donuts dough by the evening. Loving donuts so much, he can't live without eating tens of donuts everyday. What a chore for such a...
#include <cstdio> #include <iostream> #include <cmath> #include <ctype.h> #include <string> #include <sstream> #include <iostream> #include <algorithm> #include <cstdlib> #include <map> #include <queue> #include <utility> #include <vector> #include <set> #include <list> #include <cstring> using namespace std; int...
### Prompt Create a solution in CPP for the following problem: Your master went to the town for a day. You could have a relaxed day without hearing his scolding. But he ordered you to make donuts dough by the evening. Loving donuts so much, he can't live without eating tens of donuts everyday. What a chore for such a...
#include <map> #include <vector> #include <iostream> #include <cstring> using namespace std; int m[29][29]; int main(){ string s,t; int h,w,i,j,x,y; for(;cin>>h>>w,h;cout<<s<<endl){ vector<string>v; for(i=0;i<h;i++)cin>>s,v.push_back(s); s="0"; map<string,int>M; for(i=0;i<h;i++)for(j=0;j<w;j++)for(x=-1;x<=...
### Prompt Generate a Cpp solution to the following problem: Your master went to the town for a day. You could have a relaxed day without hearing his scolding. But he ordered you to make donuts dough by the evening. Loving donuts so much, he can't live without eating tens of donuts everyday. What a chore for such a b...
#include <iostream> #include <cstdio> #include <cstring> #include <algorithm> #include <map> using namespace std; #define rep(i, n) for(int i = 0 ; i < n ; i++) const int dx[] = {0, 1, 0, -1, 1, 1, -1, -1}; const int dy[] = {1, 0, -1, 0, 1, -1, 1, -1}; int H, W; char field[11][21]; map<string, int> v; void solve(in...
### Prompt Generate a cpp solution to the following problem: Your master went to the town for a day. You could have a relaxed day without hearing his scolding. But he ordered you to make donuts dough by the evening. Loving donuts so much, he can't live without eating tens of donuts everyday. What a chore for such a b...
#include <iostream> #include <algorithm> #include <string> #include <map> #include <vector> using namespace std; const int MAX_H = 11; const int MAX_W = 21; map<string, int> M; vector<string> V; int H, W; char G[MAX_H][MAX_W]; bool compare(const string &a, const string &b) { if(a.size() != b.size()) return a.size(...
### Prompt Develop a solution in cpp to the problem described below: Your master went to the town for a day. You could have a relaxed day without hearing his scolding. But he ordered you to make donuts dough by the evening. Loving donuts so much, he can't live without eating tens of donuts everyday. What a chore for ...
#include <iostream> #include <string> #include <map> using namespace std; int main(){ int h,w; string s[10],t; map<string,int> v; while(1){ cin>>h>>w; if(!h&&!w) break; for(int i=0;i<h;i++) cin>>s[i]; for(int i=0;i<h;i++){ for(int j=0;j<w;j++){ for(int k=-1;k<=1;k++){ for(int l=-1;l<=...
### Prompt Your task is to create a CPP solution to the following problem: Your master went to the town for a day. You could have a relaxed day without hearing his scolding. But he ordered you to make donuts dough by the evening. Loving donuts so much, he can't live without eating tens of donuts everyday. What a chor...
#include<bits/stdc++.h> #define range(i,a,b) for(int i = (a); i < (b); i++) #define rep(i,b) for(int i = 0; i < (b); i++) #define all(a) (a).begin(), (a).end() #define debug(x) cout << "debug " << x << endl; const int INF = 100000000; using namespace std; string m[1000]; string ans; int h, w; map<string, int> msi; st...
### Prompt Generate a CPP solution to the following problem: Your master went to the town for a day. You could have a relaxed day without hearing his scolding. But he ordered you to make donuts dough by the evening. Loving donuts so much, he can't live without eating tens of donuts everyday. What a chore for such a b...
#include<iostream> #include<map> using namespace std; int gcd(int a,int b){return b?gcd(b,a%b):a;} int lcm(int a,int b){return a/gcd(a,b)*b;} int main(){ int h,w; string g[10]; int dx[] = {0,1,1,1,0,-1,-1,-1},dy[] ={-1,-1,0,1,1,1,0,-1}; int lm; while(cin>> h >> w &&(h||w)){ for(int i=0;i<h;i++)cin >> g...
### Prompt Generate a Cpp solution to the following problem: Your master went to the town for a day. You could have a relaxed day without hearing his scolding. But he ordered you to make donuts dough by the evening. Loving donuts so much, he can't live without eating tens of donuts everyday. What a chore for such a b...
#include <cstdio> #include <string> #include <algorithm> #include <set> #include <vector> using namespace std; #define REP(i,x)for(int i=0;i<x;i++) string res; int H,W,dx,dy,min_len; char s[200]; char MAP[11][22]; bool visit[20][20]; vector<string> ss; void dfs(int x,int y,int k){ if(visit[y][x]){ ss.push_back(s...
### Prompt Your task is to create a cpp solution to the following problem: Your master went to the town for a day. You could have a relaxed day without hearing his scolding. But he ordered you to make donuts dough by the evening. Loving donuts so much, he can't live without eating tens of donuts everyday. What a chor...
#include <iostream> #include <vector> #include <algorithm> #include <cstring> //#include <unordered_set> #include <set> using namespace std; char field[1001][1001]; bool used[1001][1001]; int main(){ int H,W; while(cin>>H>>W&&(H|W)){ for(int i=0;i<H;i++) for(int j=0;j<W;j++) cin>>field[i][j]; vecto...
### Prompt In cpp, your task is to solve the following problem: Your master went to the town for a day. You could have a relaxed day without hearing his scolding. But he ordered you to make donuts dough by the evening. Loving donuts so much, he can't live without eating tens of donuts everyday. What a chore for such ...
#include <iostream> #include <map> #include <string> #include <algorithm> #define MAX_H 10 using namespace std; map<string, int> mp; int dx[8] = {1, 0, -1, 0, 1, 1, -1, -1}; int dy[8] = {0, 1, 0, -1, 1, -1, 1, -1}; string s[MAX_H]; int h, w; int mystrcmp(string a, string b) { if (a.size() > b.size()) return 1; ...
### Prompt Create a solution in CPP for the following problem: Your master went to the town for a day. You could have a relaxed day without hearing his scolding. But he ordered you to make donuts dough by the evening. Loving donuts so much, he can't live without eating tens of donuts everyday. What a chore for such a...
#include<iostream> #include<map> #include<cstring> using namespace std; bool used[10][20]; int main(){ int h, w; while(cin >> h >> w, h+w){ char mat[h][w]; for(int i = 0; i < h; i++) for(int j = 0; j < w; j++) cin >> mat[i][j]; map<string,int> cnt; for(int i = 0; i < h; i++){...
### Prompt Construct a CPP code solution to the problem outlined: Your master went to the town for a day. You could have a relaxed day without hearing his scolding. But he ordered you to make donuts dough by the evening. Loving donuts so much, he can't live without eating tens of donuts everyday. What a chore for suc...
#include <iostream> #include <cstdio> #include <cstring> #include <sstream> #include <algorithm> #include <cmath> #include <map> #include <queue> #include <vector> #include <cstdlib> #include <string> #include <set> #include <ctime> using namespace std; int dx[8]={0,0,1,1,1,-1,-1,-1},dy[8]={1,-1,0,-1,1,0,-1,1}; strin...
### Prompt Develop a solution in cpp to the problem described below: Your master went to the town for a day. You could have a relaxed day without hearing his scolding. But he ordered you to make donuts dough by the evening. Loving donuts so much, he can't live without eating tens of donuts everyday. What a chore for ...
#include<iostream> #include<string> #include<algorithm> using namespace std; int lcm(int a,int b){ //a,b < 20だしいいよね if (a < b){ swap(a,b); } int times = a * b; int gcd,lcm; while(1){ int n; n = a % b; if(n == 0){ break;} a = b; b = n; } gcd = b; lcm = times / gcd; return lcm; } int ...
### Prompt Construct a cpp code solution to the problem outlined: Your master went to the town for a day. You could have a relaxed day without hearing his scolding. But he ordered you to make donuts dough by the evening. Loving donuts so much, he can't live without eating tens of donuts everyday. What a chore for suc...
#include <bits/stdc++.h> using namespace std; #define INF 1001000100010001000 #define MOD 1000000007 #define EPS 1e-10 #define int long long #define rep(i, N) for (int i = 0; i < N; i++) #define Rep(i, N) for (int i = 1; i < N; i++) #define For(i, a, b) for (int i = (a); i < (b); i++) #define pb push_back #define mp ...
### Prompt Create a solution in cpp for the following problem: Your master went to the town for a day. You could have a relaxed day without hearing his scolding. But he ordered you to make donuts dough by the evening. Loving donuts so much, he can't live without eating tens of donuts everyday. What a chore for such a...
#include <vector> #include <iostream> #include <utility> #include <algorithm> #include <string> #include <deque> #include <tuple> #include <queue> #include <functional> #include <cmath> #include <iomanip> #include <map> //cin.sync_with_stdio(false); //streambuf using namespace std; typedef long long ll; typedef pair<in...
### Prompt Please provide a cpp coded solution to the problem described below: Your master went to the town for a day. You could have a relaxed day without hearing his scolding. But he ordered you to make donuts dough by the evening. Loving donuts so much, he can't live without eating tens of donuts everyday. What a ...
#include <iostream> #include <cstdio> #include <vector> #include <string> #include <cstring> #include <set> #include <map> #include <queue> #include <cmath> #include <algorithm> using namespace std; #define REP(i, n) for(int i=0; i<(int)n; ++i) #define FOR(i,c) for(__typeof((c).begin())i = (c).begin(); i != (c).end();...
### Prompt Create a solution in cpp for the following problem: Your master went to the town for a day. You could have a relaxed day without hearing his scolding. But he ordered you to make donuts dough by the evening. Loving donuts so much, he can't live without eating tens of donuts everyday. What a chore for such a...
#include <iostream> #include <sstream> #include <string> #include <algorithm> #include <vector> #include <queue> #include <deque> #include <stack> #include <map> #include <set> #include <complex> #include <cstdio> #include <cstdlib> #include <cstring> #include <cmath> #include <climits> #include <cctype> using namespac...
### Prompt Your task is to create a cpp solution to the following problem: Your master went to the town for a day. You could have a relaxed day without hearing his scolding. But he ordered you to make donuts dough by the evening. Loving donuts so much, he can't live without eating tens of donuts everyday. What a chor...
#include <iostream> #include <string> #include <vector> #include <algorithm> #include <set> #define REP(i,a,b) for (int i = (a); i < (b); i++) #define rep(i,a) REP(i,0,a) using namespace std; int H, W; int dw[] = {1,1,0,-1,-1,-1,0,1}; int dh[] = {0,1,1,1,0,-1,-1,-1}; int main(void){ while (cin >> H >> W && H) { ...
### Prompt Your challenge is to write a cpp solution to the following problem: Your master went to the town for a day. You could have a relaxed day without hearing his scolding. But he ordered you to make donuts dough by the evening. Loving donuts so much, he can't live without eating tens of donuts everyday. What a ...
#include <iostream> #include <string> #include <stdio.h> #include <set> using namespace std; #define dirmax 8 int l[2]; int dir[8][2] = { {0,1}, {1,0}, {-1,0}, {0,-1}, {1,1}, {-1,1}, {1,-1}, {-1,-1} }; string ans; void search( set<string> *v, int pos[2] , char ch[10][20]){ for(int i = 0; i < dirmax; i++) { stri...
### Prompt Develop a solution in cpp to the problem described below: Your master went to the town for a day. You could have a relaxed day without hearing his scolding. But he ordered you to make donuts dough by the evening. Loving donuts so much, he can't live without eating tens of donuts everyday. What a chore for ...
#include <iostream> #include <unordered_set> #include <algorithm> using namespace std; int dx[8]={1, 1, 1, 0, 0,-1,-1,-1}; int dy[8]={1, 0,-1, 1,-1, 1, 0,-1}; int main(){ while(1){ int h,w; cin >> h >> w; if(h==0) break; char c[10][20]; for(int i=0; i<h; i++){ ...
### Prompt Please formulate a CPP solution to the following problem: Your master went to the town for a day. You could have a relaxed day without hearing his scolding. But he ordered you to make donuts dough by the evening. Loving donuts so much, he can't live without eating tens of donuts everyday. What a chore for ...
#include <iostream> #include <stdio.h> #include <algorithm> #include <vector> #include <queue> #include <numeric> #include <string> #include <string.h> #include <map> #include <set> #include <functional> #include <complex> #include <stack> #include <tuple> #include <array> using namespace std; #define rep(i,n) for (int...
### Prompt Please provide a cpp coded solution to the problem described below: Your master went to the town for a day. You could have a relaxed day without hearing his scolding. But he ordered you to make donuts dough by the evening. Loving donuts so much, he can't live without eating tens of donuts everyday. What a ...
#include <stdio.h> #include <string.h> #include <algorithm> #include <iostream> #include <math.h> #include <assert.h> #include <vector> #include <queue> #include <string> #include <map> #include <set> using namespace std; typedef long long ll; typedef unsigned int uint; typedef unsigned long long ull; static const dou...
### Prompt Your challenge is to write a Cpp solution to the following problem: Your master went to the town for a day. You could have a relaxed day without hearing his scolding. But he ordered you to make donuts dough by the evening. Loving donuts so much, he can't live without eating tens of donuts everyday. What a ...
#include <cstdio> #include <iostream> #include <string> #include <sstream> #include <stack> #include <algorithm> #include <cmath> #include <queue> #include <map> #include <set> #include <cstdlib> #include <bitset> #include <tuple> #include <assert.h> #include <deque> #include <bitset> #include <iomanip> #include <limit...
### Prompt Create a solution in CPP for the following problem: Your master went to the town for a day. You could have a relaxed day without hearing his scolding. But he ordered you to make donuts dough by the evening. Loving donuts so much, he can't live without eating tens of donuts everyday. What a chore for such a...
#include <iostream> #include <cstdio> #include <map> #define REP(i,n) for(int i=0; i<(int)(n); i++) #define FOR(i,c) for(__typeof((c).begin()) i=(c).begin(); i!=(c).end(); i++) using namespace std; char d[20][30]; int dx[8] = {-1, 0, 1,-1, 1,-1, 0, 1}; int dy[8] = {-1,-1,-1, 0, 0, 1, 1, 1}; int main(){ int h, w...
### Prompt Please create a solution in CPP to the following problem: Your master went to the town for a day. You could have a relaxed day without hearing his scolding. But he ordered you to make donuts dough by the evening. Loving donuts so much, he can't live without eating tens of donuts everyday. What a chore for ...
#include<bits/stdc++.h> using namespace std; int di[8] = {0, -1, -1, -1, 0, 1, 1, 1}; int dj[8] = {1, 1, 0, -1, -1, -1, 0, 1}; int main(){ while(1){ int h, w; cin >> h >> w; if(h == 0) break; vector<string> a(h); for(int i = 0; i < h; i++) cin >> a[i]; string ans = "[...
### Prompt Construct a CPP code solution to the problem outlined: Your master went to the town for a day. You could have a relaxed day without hearing his scolding. But he ordered you to make donuts dough by the evening. Loving donuts so much, he can't live without eating tens of donuts everyday. What a chore for suc...
#include<cstdio> #include<iostream> #include<string> #include<map> using namespace std; static const int MAX_H = 10; int h, w; string s[MAX_H]; int dy[] = {0, -1, -1, -1, 0, 1, 1, 1}; int dx[] = {1, 1, 0, -1, -1, -1, 0, 1}; int main(){ for(;;){ scanf("%d %d", &h, &w); if(h == 0 && w == 0) break; for(int i = 0...
### Prompt In Cpp, your task is to solve the following problem: Your master went to the town for a day. You could have a relaxed day without hearing his scolding. But he ordered you to make donuts dough by the evening. Loving donuts so much, he can't live without eating tens of donuts everyday. What a chore for such ...
#include <cstring> #include <algorithm> #include <string> #include <iostream> #include <map> using namespace std; #define loop(i,a,b) for(int i=(a);i<int(b);i++) #define rep(i,b) loop(i,0,b) int dx[]={1,1,1,0}; int dy[]={-1,0,1,1}; string g[100]; int h,w; int main(){ while(cin>>h>>w && h){ map<string,in...
### Prompt Please formulate a Cpp solution to the following problem: Your master went to the town for a day. You could have a relaxed day without hearing his scolding. But he ordered you to make donuts dough by the evening. Loving donuts so much, he can't live without eating tens of donuts everyday. What a chore for ...
/* * GCA : "Computer is artificial subject absolutely,Math is God" */ #include <iostream> #include <cstdio> #include <cstring> #include <algorithm> #include <cmath> #include <climits> #include <vector> #include <set> #include <map> #include <queue> #include <cctype> #include <utility> #include <ctime> using namespace...
### Prompt In cpp, your task is to solve the following problem: Your master went to the town for a day. You could have a relaxed day without hearing his scolding. But he ordered you to make donuts dough by the evening. Loving donuts so much, he can't live without eating tens of donuts everyday. What a chore for such ...
#include<iostream> #include<string> #include<vector> #include<cstdio> #include<sstream> #include<algorithm> #include<cmath> #include<map> #include<functional> #include<queue> #include<stack> #include<set> using namespace std; #define SZ(n) (int)n.size() #define dump(x) cerr<<#x<<" = "<<(x)<<endl; #define debug(x)cerr ...
### Prompt Your challenge is to write a CPP solution to the following problem: Your master went to the town for a day. You could have a relaxed day without hearing his scolding. But he ordered you to make donuts dough by the evening. Loving donuts so much, he can't live without eating tens of donuts everyday. What a ...
#include <bits/stdc++.h> using namespace std; const int dx[] = {-1, 0, 1, 0, -1, -1, 1, 1}; const int dy[] = {0, -1, 0, 1, -1, 1, -1, 1}; int h, w; string s[10]; vector<string> generate(int sx, int sy, int dir) { int x = sx, y = sy; string str = ""; vector<string> res; while (true){ str += s[x][y]; res.pus...
### Prompt Create a solution in Cpp for the following problem: Your master went to the town for a day. You could have a relaxed day without hearing his scolding. But he ordered you to make donuts dough by the evening. Loving donuts so much, he can't live without eating tens of donuts everyday. What a chore for such a...
#include<iostream> #include<vector> #include<string> #include<map> #define f first #define s second using namespace std; int h,w,ii,jj; int X[8]={-1,1,-1,1,0,-1,0,1}; int Y[8]={-1,1,1,-1,1,0,-1,0}; char Donut[10][20]; vector<string> V; string maxs; map<string,pair<int,int> > M; void Check(string s) { if(maxs.length...
### Prompt Please formulate a CPP solution to the following problem: Your master went to the town for a day. You could have a relaxed day without hearing his scolding. But he ordered you to make donuts dough by the evening. Loving donuts so much, he can't live without eating tens of donuts everyday. What a chore for ...
#include<iostream> #include<string> #include<iomanip> #include<cmath> #include<vector> #include<algorithm> #include<map> using namespace std; #define int long long #define endl "\n" const long long INF = (long long)1e18; const long long MOD = (long long)1e9 + 7; string yn(bool f){return f?"Yes":"No";} string YN(bo...
### Prompt Create a solution in cpp for the following problem: Your master went to the town for a day. You could have a relaxed day without hearing his scolding. But he ordered you to make donuts dough by the evening. Loving donuts so much, he can't live without eating tens of donuts everyday. What a chore for such a...
#include<bits/stdc++.h> #define r(i,n) for(int i=0;i<n;i++) using namespace std; string s[21]; int dx[]={1,1,1,0,0,-1,-1,-1}; int dy[]={1,0,-1,1,-1,1,0,-1}; int h,w; vector<string>v; set<string> se; void dfs(int d,int y,int x,int p,string t,int p1,int p2){ if(d&&y==p1&&x==p2)return; t+=s[y][x]; if(d){ if(!se....
### Prompt Create a solution in CPP for the following problem: Your master went to the town for a day. You could have a relaxed day without hearing his scolding. But he ordered you to make donuts dough by the evening. Loving donuts so much, he can't live without eating tens of donuts everyday. What a chore for such a...
#include <algorithm> #include <functional> #include <cmath> #include <cstdio> #include <cstdlib> #include <cstring> #include <string> #include <sstream> #include <iostream> #include <iomanip> #include <vector> #include <list> #include <stack> #include <queue> #include <map> #include <set> #include <bitset> #include <cl...
### Prompt Please formulate a Cpp solution to the following problem: Your master went to the town for a day. You could have a relaxed day without hearing his scolding. But he ordered you to make donuts dough by the evening. Loving donuts so much, he can't live without eating tens of donuts everyday. What a chore for ...
#include <iostream> #include <string> #include <vector> #include <set> using namespace std; #define rep(i, n) for(int i=0; i<(n); ++i) #define mp(a, b) make_pair(a, b) template<typename T, typename Compare = greater<T> > inline void chmax(T& t, T f, Compare comp){if(!comp(t, f))t = f;} int h, w; string solve(vecto...
### Prompt Your challenge is to write a CPP solution to the following problem: Your master went to the town for a day. You could have a relaxed day without hearing his scolding. But he ordered you to make donuts dough by the evening. Loving donuts so much, he can't live without eating tens of donuts everyday. What a ...
#include <bits/stdc++.h> #define For(i, a, b) for(int (i)=(int)(a); (i)<(int)(b); ++(i)) #define rFor(i, a, b) for(int (i)=(int)(a)-1; (i)>=(int)(b); --(i)) #define rep(i, n) For((i), 0, (n)) #define rrep(i, n) rFor((i), (n), 0) #define fi first #define se second using namespace std; typedef long long lint; typedef uns...
### Prompt Your challenge is to write a CPP solution to the following problem: Your master went to the town for a day. You could have a relaxed day without hearing his scolding. But he ordered you to make donuts dough by the evening. Loving donuts so much, he can't live without eating tens of donuts everyday. What a ...
//Name: The Sorcerer's Donut //Level: //Category: //Note: #include <iostream> #include <cstdio> #include <vector> #include <algorithm> #include <string> #include <array> #include <map> using namespace std; #define TIMES(i,n) for(int i = 0; i < (n); ++i) const int DR[] = { 0, -1, -1, -1, 0, 1, 1, 1 }; const int ...
### Prompt Please create a solution in CPP to the following problem: Your master went to the town for a day. You could have a relaxed day without hearing his scolding. But he ordered you to make donuts dough by the evening. Loving donuts so much, he can't live without eating tens of donuts everyday. What a chore for ...
#include <iostream> #include <vector> #include <algorithm> #include <map> #include <string> using namespace std; #define rep(i,n) for(int i=0;i<n;i++) const int dx[8] = { 1,1,0,-1,-1,-1,0,1 }; const int dy[8] = { 0,1,1,1,0,-1,-1,-1 }; int w, h; char grid[10][20]; map<string, int> spell; void dfs(int sy, int sx, int ...
### Prompt Generate a CPP solution to the following problem: Your master went to the town for a day. You could have a relaxed day without hearing his scolding. But he ordered you to make donuts dough by the evening. Loving donuts so much, he can't live without eating tens of donuts everyday. What a chore for such a b...
#include <iostream> #include <string> #include <set> using namespace std; string mp[11]; int w,h; set <string> cnt; string ans; void check(int x,int y){ string str; for(int i=-1;i<=1;i++) for(int j=-1;j<=1;j++){ if(i==0 && j==0) continue; str = mp[y][x]; int nx=(x+j+w)%w,ny=(y+i+h)%h; wh...
### Prompt Please create a solution in Cpp to the following problem: Your master went to the town for a day. You could have a relaxed day without hearing his scolding. But he ordered you to make donuts dough by the evening. Loving donuts so much, he can't live without eating tens of donuts everyday. What a chore for ...
#include <bits/stdc++.h> #define syosu(x) fixed<<setprecision(x) using namespace std; typedef long long ll; typedef unsigned int uint; typedef unsigned long long ull; typedef pair<int,int> P; typedef pair<double,double> pdd; typedef pair<ll,ll> pll; typedef vector<int> vi; typedef vector<vi> vvi; typedef vector<double>...
### Prompt Develop a solution in Cpp to the problem described below: Your master went to the town for a day. You could have a relaxed day without hearing his scolding. But he ordered you to make donuts dough by the evening. Loving donuts so much, he can't live without eating tens of donuts everyday. What a chore for ...
#include <iostream> #include <algorithm> #include <string> #include <set> using namespace std; int main(){ int h,w; int dx[] = {-1,0,1,-1,1,-1,0,1}; int dy[] = {1,1,1,0,0,-1,-1,-1}; while(cin >> h >> w && h && w){ char c[11][21]; set<string> s; string ans = ""; for(int i=0;i<h;i++){ for(...
### Prompt Create a solution in Cpp for the following problem: Your master went to the town for a day. You could have a relaxed day without hearing his scolding. But he ordered you to make donuts dough by the evening. Loving donuts so much, he can't live without eating tens of donuts everyday. What a chore for such a...
#include<iostream> #include<algorithm> #include<vector> #include<string> #include<map> using namespace std; void chmax(string& s1, string& s2) { if (s1.size() > s2.size()) return; else if (s1.size() < s2.size()) { s1 = s2; return; } else { for (int i = 0; i < s1.size(); i++) { ...
### Prompt Construct a cpp code solution to the problem outlined: Your master went to the town for a day. You could have a relaxed day without hearing his scolding. But he ordered you to make donuts dough by the evening. Loving donuts so much, he can't live without eating tens of donuts everyday. What a chore for suc...
#include <bits/stdc++.h> using namespace std; typedef vector<int> vi; typedef vector<vi> vvi; typedef vector<string> vs; typedef pair<int, int> pii; typedef long long ll; #define ALL(a) (a).begin(),(a).end() #define RALL(a) (a).rbegin(),(a).rend() #define EXIST(s,e) ((s).find(e)!=(s).end()) #define FOR(i,a,b) for(int i...
### Prompt Your challenge is to write a CPP solution to the following problem: Your master went to the town for a day. You could have a relaxed day without hearing his scolding. But he ordered you to make donuts dough by the evening. Loving donuts so much, he can't live without eating tens of donuts everyday. What a ...
#include <iostream> #include <cstdio> #include <string> #include <set> #include <vector> #include <utility> using namespace std; set<string> Ws; set<string> W; const int dx[8] = {1, 1, 1, 0, 0, -1, -1, -1}; const int dy[8] = {1, 0, -1, 1, -1, 1, 0, -1}; typedef pair<int, string> spell; int main() { int h, w; wh...
### Prompt Create a solution in Cpp for the following problem: Your master went to the town for a day. You could have a relaxed day without hearing his scolding. But he ordered you to make donuts dough by the evening. Loving donuts so much, he can't live without eating tens of donuts everyday. What a chore for such a...
#include <vector> #include <iostream> #include <utility> #include <algorithm> #include <string> #include <deque> #include <tuple> #include <queue> #include <functional> #include <cmath> #include <iomanip> #include <map> //cin.sync_with_stdio(false); //streambuf using namespace std; typedef long long ll; typedef pair<in...
### Prompt Please create a solution in cpp to the following problem: Your master went to the town for a day. You could have a relaxed day without hearing his scolding. But he ordered you to make donuts dough by the evening. Loving donuts so much, he can't live without eating tens of donuts everyday. What a chore for ...
#include <iostream> #include <string> #include <stdio.h> #include <set> using namespace std; #define dirmax 8 int l[2]; int dir[8][2] = { {0,1}, {1,0}, {-1,0}, {0,-1}, {1,1}, {-1,1}, {1,-1}, {-1,-1} }; string ans; void search( set<string> *v, int pos[2] , char ch[10][20]){ for(int i = 0; i < dirmax; i++) { stri...
### Prompt Construct a Cpp code solution to the problem outlined: Your master went to the town for a day. You could have a relaxed day without hearing his scolding. But he ordered you to make donuts dough by the evening. Loving donuts so much, he can't live without eating tens of donuts everyday. What a chore for suc...
#include <iostream> #include <vector> #include <queue> #include <cstring> #include <cstdio> #include <algorithm> #include <complex> #include <set> #include <map> #include <cmath> using namespace std; int dx[] = {-1,-1,-1,0,0,1,1,1}; int dy[] = {-1,0,1,-1,1,-1,0,1}; int main(){ int H,W; while(cin >> H >> W && H ){ ...
### Prompt In CPP, your task is to solve the following problem: Your master went to the town for a day. You could have a relaxed day without hearing his scolding. But he ordered you to make donuts dough by the evening. Loving donuts so much, he can't live without eating tens of donuts everyday. What a chore for such ...
#include "iostream" #include "climits" #include "list" #include "queue" #include "stack" #include "set" #include "functional" #include "algorithm" #include "string" #include "map" #include "unordered_map" #include "unordered_set" #include "iomanip" #include "cmath" #include "random" #include "bitset" #include "cstdio" ...
### Prompt Please provide a Cpp coded solution to the problem described below: Your master went to the town for a day. You could have a relaxed day without hearing his scolding. But he ordered you to make donuts dough by the evening. Loving donuts so much, he can't live without eating tens of donuts everyday. What a ...
#include<iostream> #include<string> #include<vector> #include<set> using namespace std; int w,h; int dx[8]={0,1,1,1,0,-1,-1,-1}; int dy[8]={-1,-1,0,1,1,1,0,-1}; void solve(){ set<string> S; vector<string> V; for(int i=0;i<h;i++){ string s; cin>>s; V.push_back(s); } string res=""; for(int y=0;y<h;y++){ ...
### Prompt Develop a solution in Cpp to the problem described below: Your master went to the town for a day. You could have a relaxed day without hearing his scolding. But he ordered you to make donuts dough by the evening. Loving donuts so much, he can't live without eating tens of donuts everyday. What a chore for ...
#include<iostream> #include<cstdio> #include<string> #include<vector> #include<cmath> #include<algorithm> #include<functional> #include<iomanip> #include<queue> #include<ciso646> #include<random> #include<map> #include<set> using namespace std; typedef long long ll; const ll MOD = 1000000007; const ll INF = (ll)1000000...
### Prompt Generate a Cpp solution to the following problem: Your master went to the town for a day. You could have a relaxed day without hearing his scolding. But he ordered you to make donuts dough by the evening. Loving donuts so much, he can't live without eating tens of donuts everyday. What a chore for such a b...
#include <iostream> #include <algorithm> #include <set> using namespace std; #define REP(i,x)for(__typeof(x) i=0;i<x;i++) string res; set<string> m; int H,W,dx,dy,min_len; char s[200]; string MAP[11]; bool visit[20][20]; void dfs(int x,int y,int k){ if(k==min_len){ if(m.count(string(s)))res=min(res,string(s)); ...
### Prompt Please provide a CPP coded solution to the problem described below: Your master went to the town for a day. You could have a relaxed day without hearing his scolding. But he ordered you to make donuts dough by the evening. Loving donuts so much, he can't live without eating tens of donuts everyday. What a ...
#include <cstdio> #include <cstring> #include <string> #include <iostream> #include <map> #include <vector> #include <algorithm> using namespace std; int h,w; char fie[11][21]; int dx[8]={1,0,-1,0,1,1,-1,-1}; int dy[8]={0,1,0,-1,1,-1,1,-1}; bool used[11][21]; vector<string> index2; string str; void dfs(int y,int x,in...
### Prompt Please formulate a cpp solution to the following problem: Your master went to the town for a day. You could have a relaxed day without hearing his scolding. But he ordered you to make donuts dough by the evening. Loving donuts so much, he can't live without eating tens of donuts everyday. What a chore for ...
#include<iostream> #include<map> #include<vector> using namespace std; string s[10]; int h,w; int dx[]={0,1,0,-1,1,1,-1,-1},dy[]={1,0,-1,0,1,-1,1,-1}; int main() { while(cin>>h>>w,h) { for(int i=0;i<h;i++)cin>>s[i]; map<string,int>M; string ans="0"; for(int i=0;i<h;i++)for(int j=0;j<w;j++) { for(int r=0;...
### Prompt In cpp, your task is to solve the following problem: Your master went to the town for a day. You could have a relaxed day without hearing his scolding. But he ordered you to make donuts dough by the evening. Loving donuts so much, he can't live without eating tens of donuts everyday. What a chore for such ...
#include <vector> #include <map> #include <set> #include <stack> #include <queue> #include <algorithm> #include <utility> #include <functional> #include <sstream> #include <iostream> #include <cstdio> #include <cmath> #include <cstdlib> #include <cctype> #include <string> #include <cstring> #include <ctime> #include <c...
### Prompt Develop a solution in CPP to the problem described below: Your master went to the town for a day. You could have a relaxed day without hearing his scolding. But he ordered you to make donuts dough by the evening. Loving donuts so much, he can't live without eating tens of donuts everyday. What a chore for ...
#include<bits/stdc++.h> #define rep(i,n)for(int i=0;i<(n);i++) using namespace std; char s[10][21]; bool used[10][20]; int main() { int h, w; while (scanf("%d%d", &h, &w), h) { rep(i, h)scanf("%s", s[i]); map<string, int>mp; rep(i, h)rep(j, w) { for (int dx = -1; dx <= 1; dx++) { for (int dy = -1; dy <=...
### Prompt Generate a Cpp solution to the following problem: Your master went to the town for a day. You could have a relaxed day without hearing his scolding. But he ordered you to make donuts dough by the evening. Loving donuts so much, he can't live without eating tens of donuts everyday. What a chore for such a b...
#include <bits/stdc++.h> using namespace std; int h, w; string spell[10]; int dx[] = {-1, 0, 1, 0, 1, -1, 1, -1}; int dy[] = {0, -1, 0, 1, -1, 1, 1, -1}; set<string> spellset; string ans; void cast(int sy, int sx, int y, int x, int d, string word) { if(spellset.count(word)){ if(ans.size() < word.size() || a...
### Prompt Please create a solution in Cpp to the following problem: Your master went to the town for a day. You could have a relaxed day without hearing his scolding. But he ordered you to make donuts dough by the evening. Loving donuts so much, he can't live without eating tens of donuts everyday. What a chore for ...
#include <iostream> #include <algorithm> #include <string> #include <map> #include <vector> using namespace std; struct Str2 { string s; Str2() {} Str2(string s) : s(s) {} bool operator < (const Str2 &str) const { if(s.size() != str.s.size()) return s.size() > str.s.size(); return s < str.s; } }; c...
### Prompt In CPP, your task is to solve the following problem: Your master went to the town for a day. You could have a relaxed day without hearing his scolding. But he ordered you to make donuts dough by the evening. Loving donuts so much, he can't live without eating tens of donuts everyday. What a chore for such ...
#include "bits/stdc++.h" using namespace std; vector<string> v; int h,w; string s[10]; string search(int a,int b,int d) { int dirx[8]={1,1,0,-1,-1,-1,0,1}; int diry[8]={0,-1,-1,-1,0,1,1,1}; string ret; int i=a; int j=b; do{ ret+=s[i][j]; i+=dirx[d]; j+=diry[d]; if(i==-1) i=h-1; if(i==h) i=0; if...
### Prompt Please create a solution in CPP to the following problem: Your master went to the town for a day. You could have a relaxed day without hearing his scolding. But he ordered you to make donuts dough by the evening. Loving donuts so much, he can't live without eating tens of donuts everyday. What a chore for ...
#include <iostream> #include <set> #include <string> #include <algorithm> #define MAX 22 using namespace std; char f[MAX][MAX]; int dx[8]={1,1,0,-1,-1,-1,0,1}; //右から int dy[8]={0,1,1,1,0,-1,-1,-1}; int main(void) { int h,w; int i1,i2,i3; int x,y; string s; int len; while(1){ cin>>h>>w; if(h+w==0) break...
### Prompt Please provide a Cpp coded solution to the problem described below: Your master went to the town for a day. You could have a relaxed day without hearing his scolding. But he ordered you to make donuts dough by the evening. Loving donuts so much, he can't live without eating tens of donuts everyday. What a ...
#include <iostream> #include <vector> #include <cstring> #include <string> #include <algorithm> #include <iomanip> #include <cmath> #include <cassert> #include <map> using namespace std; string b[10]; int dx[8] = { 1, 0, -1, 0, 1, 1, -1, -1 }; int dy[8] = { 0, 1, 0, -1, 1, -1, 1, -1 }; bool visit[10][20]; int main() ...
### Prompt Please formulate a CPP solution to the following problem: Your master went to the town for a day. You could have a relaxed day without hearing his scolding. But he ordered you to make donuts dough by the evening. Loving donuts so much, he can't live without eating tens of donuts everyday. What a chore for ...
#include <iostream> #include <vector> #include <algorithm> #include <string> #include <map> #define REP(i,a,b) for(int i=int(a);i<int(b);i++) using namespace std; typedef long long int lli; int main () { int h, w; while (cin >> h >> w, h + w) { vector<vector<char>> spell(h, vector<char>(w)); ...
### Prompt In cpp, your task is to solve the following problem: Your master went to the town for a day. You could have a relaxed day without hearing his scolding. But he ordered you to make donuts dough by the evening. Loving donuts so much, he can't live without eating tens of donuts everyday. What a chore for such ...
#include "bits/stdc++.h" #pragma warning(disable:4996) using namespace std; long long int gcd(long long int l, long long int r) { if (l > r)return gcd(r, l); else { if (r%l) { return gcd(l, r%l); } else { return l; } } } int dx[8] = { -1,-1,-1, 0, 1, 1, 1, 0 }; int dy[8] = { -1, 0, 1, 1, 1, 0,-1,-1 }...
### Prompt Generate a CPP solution to the following problem: Your master went to the town for a day. You could have a relaxed day without hearing his scolding. But he ordered you to make donuts dough by the evening. Loving donuts so much, he can't live without eating tens of donuts everyday. What a chore for such a b...
#include <iostream> #include <vector> #include <algorithm> #include <string> #include <map> using namespace std; const int dy[] = {1, -1, 0, 0, 1, -1, 1, -1}; const int dx[] = {0, 0, 1, -1, 1, -1, -1, 1}; int h, w, sy, sx, max_size; map<string, int> mp; string table[15]; string str; void solve(char ch) { for(int i = 0...
### Prompt Please provide a CPP coded solution to the problem described below: Your master went to the town for a day. You could have a relaxed day without hearing his scolding. But he ordered you to make donuts dough by the evening. Loving donuts so much, he can't live without eating tens of donuts everyday. What a ...
#include <iostream> #include <string> #include <set> #include <cstring> using namespace std; #define REP(i,x,n) for(int i = x; i < (int)(n); i++) #define rep(i,n) REP(i,0,n) static const int dx[] = {-1,-1,-1,0,0,1,1,1}; static const int dy[] = {-1,0,1,-1,1,-1,0,1}; int h,w; char D[10][20]; set<string> spell; st...
### Prompt Your task is to create a Cpp solution to the following problem: Your master went to the town for a day. You could have a relaxed day without hearing his scolding. But he ordered you to make donuts dough by the evening. Loving donuts so much, he can't live without eating tens of donuts everyday. What a chor...
#include <bits/stdc++.h> #define fi first #define se second using namespace std; using P = pair<int,int>; int h,w; int d[2][8] = {{-1,-1,-1,0,0,1,1,1},{-1,0,1,-1,1,-1,0,1}}; vector<vector<P>> memo; vector<string> s; string solve(); int main() { while(1){ cin >> h >> w; if(h + w == 0)break; ...
### Prompt Your task is to create a Cpp solution to the following problem: Your master went to the town for a day. You could have a relaxed day without hearing his scolding. But he ordered you to make donuts dough by the evening. Loving donuts so much, he can't live without eating tens of donuts everyday. What a chor...
#include <cstdio> #include <cstdlib> #include <cmath> #include <climits> #include <cfloat> #include <map> #include <utility> #include <set> #include <iostream> #include <memory> #include <string> #include <vector> #include <algorithm> #include <functional> #include <sstream> #include <complex> #include <stack> #include...
### Prompt Please create a solution in Cpp to the following problem: Your master went to the town for a day. You could have a relaxed day without hearing his scolding. But he ordered you to make donuts dough by the evening. Loving donuts so much, he can't live without eating tens of donuts everyday. What a chore for ...
#include <algorithm> #include <iostream> #include <vector> #include <set> using namespace std; int di[] = {0, 0, 1, -1, 1, 1, -1, -1}; int dj[] = {1, -1, 0, 0, 1, -1, 1, -1}; int main() { int h, w; while (cin >> h >> w, h) { vector<string> s(h); for (auto &si: s) cin >> si; set<string> ...
### Prompt Please provide a Cpp coded solution to the problem described below: Your master went to the town for a day. You could have a relaxed day without hearing his scolding. But he ordered you to make donuts dough by the evening. Loving donuts so much, he can't live without eating tens of donuts everyday. What a ...
#include "bits/stdc++.h" #define REP(i,n) for(ll i=0;i<n;++i) #define RREP(i,n) for(ll i=n-1;i>=0;--i) #define FOR(i,m,n) for(ll i=m;i<n;++i) #define RFOR(i,m,n) for(ll i=n-1;i>=m;--i) #define ALL(v) (v).begin(),(v).end() #define PB(a) push_back(a) #define UNIQUE(v) v.erase(unique(ALL(v)),v.end()); #define DUMP(v) REP...
### Prompt Your task is to create a CPP solution to the following problem: Your master went to the town for a day. You could have a relaxed day without hearing his scolding. But he ordered you to make donuts dough by the evening. Loving donuts so much, he can't live without eating tens of donuts everyday. What a chor...
#include <iostream> #include <vector> #include <string> #include <algorithm> #include <set> using namespace std; int main() { int dy[] = {-1, -1, 0, 1, 1, 1, 0, -1}; int dx[] = {0, 1, 1, 1, 0, -1, -1, -1}; for(;;){ int h, w; cin >> h >> w; if(h == 0) return 0; vect...
### Prompt Your challenge is to write a cpp solution to the following problem: Your master went to the town for a day. You could have a relaxed day without hearing his scolding. But he ordered you to make donuts dough by the evening. Loving donuts so much, he can't live without eating tens of donuts everyday. What a ...
#include<iostream> #include<string> #include<vector> #include<algorithm> using namespace std; struct bstr{ string str; bstr(string s){str=s;} bool operator<(const bstr& a) const{ return str.size()==a.str.size() ? (str.compare(a.str) < 0): str.size() > a.str.size(); } }; int main(){ int h,w; int i,j,k; ...
### Prompt Generate a Cpp solution to the following problem: Your master went to the town for a day. You could have a relaxed day without hearing his scolding. But he ordered you to make donuts dough by the evening. Loving donuts so much, he can't live without eating tens of donuts everyday. What a chore for such a b...
#include <iostream> #include <algorithm> #include <string> #include <set> using namespace std; typedef unsigned long long ull; const int dy[8] = {1,1,1,0,0,-1,-1,-1}; const int dx[8] = {-1,0,1,-1,1,-1,0,1}; int h,w; string str[10]; void solve(){ int y, x, ansn = 0; string ans = "0"; set<string> s; for(int i...
### Prompt Construct a cpp code solution to the problem outlined: Your master went to the town for a day. You could have a relaxed day without hearing his scolding. But he ordered you to make donuts dough by the evening. Loving donuts so much, he can't live without eating tens of donuts everyday. What a chore for suc...