output
stringlengths
52
181k
instruction
stringlengths
296
182k
#include <bits/stdc++.h> using namespace std; char s[111][111]; int d[111]; int main() { int n, m, k, i, j, t; cin >> n >> m >> k; int win[2] = {0, 0}; for (i = t = 0; i < n; i++) { scanf("%s", s + i); int g[2] = {-1, -1}, r[2] = {-1, -1}, nn[2] = {0, 0}; for (j = 0; j < m; j++) { if (s[i][j] ...
### Prompt Construct a CPP code solution to the problem outlined: Having learned (not without some help from the Codeforces participants) to play the card game from the previous round optimally, Shrek and Donkey (as you may remember, they too live now in the Kingdom of Far Far Away) have decided to quit the boring ca...
#include <bits/stdc++.h> using namespace std; template <typename T, typename U> inline void chkmax(T& x, U y) { if (x < y) x = y; } template <typename T, typename U> inline void chkmin(T& x, U y) { if (y < x) x = y; } char s[111][111]; int a[111], b[111], c[10]; int a1[111], b1[111]; int main() { int n, m, p; c...
### Prompt Please provide a CPP coded solution to the problem described below: Having learned (not without some help from the Codeforces participants) to play the card game from the previous round optimally, Shrek and Donkey (as you may remember, they too live now in the Kingdom of Far Far Away) have decided to quit ...
#include <bits/stdc++.h> using namespace std; int main() { int n, m, k; while (cin >> n >> m >> k) { vector<int> a; bool infg = false; bool infr = false; bool anyg = false; bool anyr = false; for (int i = (0); i < (int)(n); i++) { string s; cin >> s; int ir = -1, ig = -1, i...
### Prompt Construct a CPP code solution to the problem outlined: Having learned (not without some help from the Codeforces participants) to play the card game from the previous round optimally, Shrek and Donkey (as you may remember, they too live now in the Kingdom of Far Far Away) have decided to quit the boring ca...
#include <bits/stdc++.h> using namespace std; int read() { int x = 0, f = 1; char ch = getchar(); while (ch < '0' || ch > '9') { if (ch == '-') f = -1; ch = getchar(); } while (ch >= '0' && ch <= '9') { x = (x << 3) + (x << 1) + (ch ^ 48); ch = getchar(); } return x * f; } int n, m, k, cnt...
### Prompt Please provide a cpp coded solution to the problem described below: Having learned (not without some help from the Codeforces participants) to play the card game from the previous round optimally, Shrek and Donkey (as you may remember, they too live now in the Kingdom of Far Far Away) have decided to quit ...
#include <bits/stdc++.h> int n, m, k; char s[1111]; int check() { register int i; int ls = 0, tp = 0, sz = 1, sp = 0; for (i = 1; i <= m; i++) { if (s[i] == 'G') { tp |= 1; if (ls) ls = i - ls - 1; else ls = i; } if (s[i] == 'R') { tp |= 2; if (ls) ...
### Prompt Please create a solution in CPP to the following problem: Having learned (not without some help from the Codeforces participants) to play the card game from the previous round optimally, Shrek and Donkey (as you may remember, they too live now in the Kingdom of Far Far Away) have decided to quit the boring...
#include <bits/stdc++.h> using namespace std; const int MAXN = 105; int i, j, k, N, M, K, sum, stone[MAXN]; bool win1 = false, win2 = false; char c; void init() { scanf("%d%d%d", &N, &M, &K); for (i = 0; i < N; i++) { int x = -1, y = -1, b = 0; for (j = 0; j < M; j++) { while (c = getchar(), (c != '-'...
### Prompt Your task is to create a cpp solution to the following problem: Having learned (not without some help from the Codeforces participants) to play the card game from the previous round optimally, Shrek and Donkey (as you may remember, they too live now in the Kingdom of Far Far Away) have decided to quit the ...
#include <bits/stdc++.h> using namespace std; const int MAXN = 110; int n, m, k; int gloc[MAXN]; int rloc[MAXN]; int gc, rc; int main() { for (int i = 0; i < MAXN; i++) gloc[i] = rloc[i] = -1; cin >> n >> m >> k; if (m == 1) { cout << "Second\n"; return 0; } for (int i = 0; i < n; i++) { gc = 0, r...
### Prompt Create a solution in CPP for the following problem: Having learned (not without some help from the Codeforces participants) to play the card game from the previous round optimally, Shrek and Donkey (as you may remember, they too live now in the Kingdom of Far Far Away) have decided to quit the boring card ...
#include <bits/stdc++.h> using namespace std; int n, m, k; int f(vector<int> st) { for (int i = 0; i <= 6; ++i) { int s = 0; for (int j = 0; j < st.size(); ++j) if ((st[j] & (1 << i)) > 0) ++s; if (s % (k + 1) != 0) return 1; } return 2; } int main() { ios_base::sync_with_stdio(0); cin >> n ...
### Prompt In cpp, your task is to solve the following problem: Having learned (not without some help from the Codeforces participants) to play the card game from the previous round optimally, Shrek and Donkey (as you may remember, they too live now in the Kingdom of Far Far Away) have decided to quit the boring card...
#include <bits/stdc++.h> using namespace std; const int N = 105; int n, m, k; int a[N]; int main() { cin >> n >> m >> k; scanf("\n"); if (m == 1) { puts("Second"); return 0; } int A = 0, B = 0; for (int i = 1; i <= n; ++i) { int x = 0, y = 0, xx = 0, yy = 0; for (int j = 1; j <= m; ++j) { ...
### Prompt Your challenge is to write a CPP solution to the following problem: Having learned (not without some help from the Codeforces participants) to play the card game from the previous round optimally, Shrek and Donkey (as you may remember, they too live now in the Kingdom of Far Far Away) have decided to quit ...
#include <bits/stdc++.h> using namespace std; int main() { int n, m, k; cin >> n >> m >> k; int nim[32]{}; bool fw = 0, sw = 0; for (int i = 1; i <= n; i++) { int fp = 0, sp = 0, wp = 0; for (int j = 1; j <= m; j++) { char c; cin >> c; if (c == 'G') { fp = j; } else if ...
### Prompt Please provide a CPP coded solution to the problem described below: Having learned (not without some help from the Codeforces participants) to play the card game from the previous round optimally, Shrek and Donkey (as you may remember, they too live now in the Kingdom of Far Far Away) have decided to quit ...
#include <bits/stdc++.h> using namespace std; char str[105][105]; int n, m, k; int gwin, rwin; vector<int> num; int dp[105]; void get() { gwin = -1; rwin = -1; for (int i = 1; i <= n; i++) { int R = -1; int G = -1; int has = 0; for (int j = 0; j < m; j++) { if (str[i][j] == 'G') G = ...
### Prompt Generate a CPP solution to the following problem: Having learned (not without some help from the Codeforces participants) to play the card game from the previous round optimally, Shrek and Donkey (as you may remember, they too live now in the Kingdom of Far Far Away) have decided to quit the boring card ga...
#include <bits/stdc++.h> using namespace std; int n, m, k, ans[2], s, anss[20]; char mp[105], ch; int main() { scanf("%d%d%d", &n, &m, &k), ch = getchar(); for (int i = 1, flag = 0, t = 0, s = 0; i <= n; i++, flag = 0, t = 0, s = 0) { scanf("%s", mp + 1); for (int j = 1; j <= m; j++) { if (mp[j] == '-...
### Prompt Generate a CPP solution to the following problem: Having learned (not without some help from the Codeforces participants) to play the card game from the previous round optimally, Shrek and Donkey (as you may remember, they too live now in the Kingdom of Far Far Away) have decided to quit the boring card ga...
#include <bits/stdc++.h> using namespace std; const int oo = 0x3f3f3f3f; const long long ooo = 9223372036854775807ll; const int _cnt = 1000 * 1000 + 7; const int _p = 1000 * 1000 * 1000 + 7; const int N = 105; const double PI = acos(-1.0); const double eps = 1e-9; int o(int x) { return x % _p; } int gcd(int a, int b) {...
### Prompt Your challenge is to write a Cpp solution to the following problem: Having learned (not without some help from the Codeforces participants) to play the card game from the previous round optimally, Shrek and Donkey (as you may remember, they too live now in the Kingdom of Far Far Away) have decided to quit ...
#include <bits/stdc++.h> const int N = 105; int n, m, k, a[N], f0, f1, tag0, tag1, s0, s1; char s[N]; bool chk() { for (int i = 0; i <= 6; i++) if (a[i] % (k + 1)) return 1; return 0; } int main() { scanf("%d%d%d", &n, &m, &k); for (int i = 1; i <= n; i++) { scanf("%s", s + 1); f0 = 0, f1 = 0, s0 = ...
### Prompt Create a solution in Cpp for the following problem: Having learned (not without some help from the Codeforces participants) to play the card game from the previous round optimally, Shrek and Donkey (as you may remember, they too live now in the Kingdom of Far Far Away) have decided to quit the boring card ...
#include <bits/stdc++.h> using namespace std; const int maxn = 107, maxnum = 100000000; int n, m, k; int sg[maxn]; char Map[maxn][maxn]; bool Only(char a[maxn], char c) { int tot_ = 0, totc = 0; for (int i = 0; i < m; i++) { if (a[i] != '-' && a[i] != c) return false; if (a[i] == '-') tot_++; if (a[i] =...
### Prompt Your task is to create a CPP solution to the following problem: Having learned (not without some help from the Codeforces participants) to play the card game from the previous round optimally, Shrek and Donkey (as you may remember, they too live now in the Kingdom of Far Far Away) have decided to quit the ...
#include <bits/stdc++.h> using namespace std; inline long long read() { long long x = 0, f = 1; char ch = getchar(); while (ch < '0' || ch > '9') { if (ch == '-') f = -1; ch = getchar(); } while (ch >= '0' && ch <= '9') { x = x * 10 + ch - '0'; ch = getchar(); } return x * f; } const long ...
### Prompt Create a solution in CPP for the following problem: Having learned (not without some help from the Codeforces participants) to play the card game from the previous round optimally, Shrek and Donkey (as you may remember, they too live now in the Kingdom of Far Far Away) have decided to quit the boring card ...
#include <bits/stdc++.h> using namespace std; int digit[105]; int n, m, k; string board[105]; string score() { scanf("%d %d %d", &n, &m, &k); if (m == 1) return "Second"; for (int i = 0; i < n; i++) cin >> board[i]; int na = 0, nb = 0, ea = 0, eb = 0; for (int i = 0; i < n; i++) { int adda = 0, addb = 0; ...
### Prompt Create a solution in Cpp for the following problem: Having learned (not without some help from the Codeforces participants) to play the card game from the previous round optimally, Shrek and Donkey (as you may remember, they too live now in the Kingdom of Far Far Away) have decided to quit the boring card ...
#include <bits/stdc++.h> int x[100]; int main() { bool r = false, g = false; int n, m, k; std::cin >> n >> m >> k; if (m == 1) { std::cout << "Second\n"; return 0; } for (int i = 0; i < n; ++i) { std::string s; std::cin >> s; int j1 = -1, j2 = -1; for (int j = 0; j < m; ++j) if...
### Prompt Develop a solution in Cpp to the problem described below: Having learned (not without some help from the Codeforces participants) to play the card game from the previous round optimally, Shrek and Donkey (as you may remember, they too live now in the Kingdom of Far Far Away) have decided to quit the boring...
#include <bits/stdc++.h> #pragma comment(linker, "/STACK:62000000") using namespace std; const double PI = acos(-1.0); template <class T> inline T SQR(T a) { return a * a; } int main() { int n, m, k; cin >> n >> m >> k; char A[101][102]; for (int i = (0), ei = (n); i < ei; i++) scanf(" %s", A + i); bool R =...
### Prompt Your challenge is to write a CPP solution to the following problem: Having learned (not without some help from the Codeforces participants) to play the card game from the previous round optimally, Shrek and Donkey (as you may remember, they too live now in the Kingdom of Far Far Away) have decided to quit ...
#include <bits/stdc++.h> using namespace std; int main() { int n, m, k; cin >> n >> m >> k; char grid[n][m]; bool flag1 = 0, flag2 = 0; int cnt[100] = {}; for (int i = 0; i < n; i++) { string s; cin >> s; if (s.find('-') < 0 || s.find('-') >= s.size()) continue; int x = s.find('G'); int ...
### Prompt Please create a solution in CPP to the following problem: Having learned (not without some help from the Codeforces participants) to play the card game from the previous round optimally, Shrek and Donkey (as you may remember, they too live now in the Kingdom of Far Far Away) have decided to quit the boring...
#include <bits/stdc++.h> #pragma comment(linker, "/STACK:256000000") using namespace std; const int maxN = 110; int n, m, k; string s[maxN]; int main() { cin >> n >> m >> k; int x = 0, y = 0; for (int i = 0; i < n; ++i) { cin >> s[i]; int r = count(s[i].begin(), s[i].end(), 'R'); int g = count(s[i].be...
### Prompt In Cpp, your task is to solve the following problem: Having learned (not without some help from the Codeforces participants) to play the card game from the previous round optimally, Shrek and Donkey (as you may remember, they too live now in the Kingdom of Far Far Away) have decided to quit the boring card...
#include <bits/stdc++.h> using namespace std; const long long mod = 1000000007; const char aa = 'a'; const double eps = 1E-9; template <typename T> bool within(T a, T b, T c) { return (a <= c && a >= b); } int gcd(int m, int n) { if (m == 0 || n == 0) return m + n; return gcd(n, m % n); } long long binom[30][30];...
### Prompt Please provide a cpp coded solution to the problem described below: Having learned (not without some help from the Codeforces participants) to play the card game from the previous round optimally, Shrek and Donkey (as you may remember, they too live now in the Kingdom of Far Far Away) have decided to quit ...
#include <bits/stdc++.h> using namespace std; const int NMAX = 110; int N, M, K, Piles[NMAX], OKG = 1, OKR = 1, SumG = 0, SumR = 0; char S[NMAX]; int main() { scanf("%i %i %i\n", &N, &M, &K); for (int i = 1; i <= N; ++i) { gets(S + 1); int G = -1, R = -1, NrG = 0, NrR = 0; for (int j = 1; j <= M; ++j) {...
### Prompt In cpp, your task is to solve the following problem: Having learned (not without some help from the Codeforces participants) to play the card game from the previous round optimally, Shrek and Donkey (as you may remember, they too live now in the Kingdom of Far Far Away) have decided to quit the boring card...
#include <bits/stdc++.h> using namespace std; const int maxn = 100 + 5, maxm = 100 + 5, maxk = 100 + 5; int n, m, k; char rd_t[maxm]; int cnt[10]; inline int abs(int x) { return x < 0 ? -x : x; } inline int calc_nim_k() { for (int p = 0; p < 10; ++p) if (cnt[p] % (k + 1)) return 1; return -1; } int main() { s...
### Prompt Construct a cpp code solution to the problem outlined: Having learned (not without some help from the Codeforces participants) to play the card game from the previous round optimally, Shrek and Donkey (as you may remember, they too live now in the Kingdom of Far Far Away) have decided to quit the boring ca...
#include <bits/stdc++.h> using namespace std; int solve() { int N, M, K; string A[100]; cin >> N >> M >> K; for (int i = 0; i < N; i++) cin >> A[i]; if (M == 1) return 1; int tp[100]; bool shrekOpen = 0; bool donkOpen = 0; bool shrekClosed = 1; bool donkClosed = 1; vector<int> difs; for (int i =...
### Prompt Please create a solution in cpp to the following problem: Having learned (not without some help from the Codeforces participants) to play the card game from the previous round optimally, Shrek and Donkey (as you may remember, they too live now in the Kingdom of Far Far Away) have decided to quit the boring...
#include <bits/stdc++.h> using namespace std; template <typename T, typename U> inline void smin(T &a, U b) { if (a > b) a = b; } template <typename T, typename U> inline void smax(T &a, U b) { if (a < b) a = b; } template <typename T> inline void gn(T &first) { char c, sg = 0; while (c = getchar(), (c > '9' ||...
### Prompt Please formulate a CPP solution to the following problem: Having learned (not without some help from the Codeforces participants) to play the card game from the previous round optimally, Shrek and Donkey (as you may remember, they too live now in the Kingdom of Far Far Away) have decided to quit the boring...
#include <bits/stdc++.h> const int N = 120000; using namespace std; vector<int> sg; int n, m, k; string st; vector<int> oc[1000]; int flag1, flag2; int main() { ios_base::sync_with_stdio(0); cin >> n >> m >> k; for (int i = 0; i < n; i++) { cin >> st; oc['R'].clear(); oc['G'].clear(); oc['-'].clea...
### Prompt Please formulate a cpp solution to the following problem: Having learned (not without some help from the Codeforces participants) to play the card game from the previous round optimally, Shrek and Donkey (as you may remember, they too live now in the Kingdom of Far Far Away) have decided to quit the boring...
#include <bits/stdc++.h> using namespace std; int main() { std::cin.tie(0); std::ios::sync_with_stdio(false); long long n, m, k, counterfirst = 0, arr[100] = {}; bool firstwithoutsecond = 0, secondwithoutfirst = 0; cin >> n >> m >> k; char c; for (int i = 0; i < n; i++) { long long first = -1, second ...
### Prompt Construct a cpp code solution to the problem outlined: Having learned (not without some help from the Codeforces participants) to play the card game from the previous round optimally, Shrek and Donkey (as you may remember, they too live now in the Kingdom of Far Far Away) have decided to quit the boring ca...
#include <bits/stdc++.h> using namespace std; const int MaxDim = 105; const int MaxK = 105; char board[MaxK][MaxK]; int N, M, K; bool canRLose, canGLose; bool anyR, anyG; void input() { scanf("%d%d%d", &N, &M, &K); for (int i = 0; i < N; i++) scanf("%s", board[i]); } int main() { input(); canRLose = canGLose = ...
### Prompt In cpp, your task is to solve the following problem: Having learned (not without some help from the Codeforces participants) to play the card game from the previous round optimally, Shrek and Donkey (as you may remember, they too live now in the Kingdom of Far Far Away) have decided to quit the boring card...
#include <bits/stdc++.h> using namespace std; int i, j, k, n, m, K, g, r; int a[10]; char p[110]; inline void into(int x) { int i; for (i = 0; i <= 9; i++) a[i] += x >> i & 1; } int main() { scanf("%d%d%d", &n, &m, &K); for (i = 1; i <= n; i++) { scanf("%s", p + 1); int gg, rr, A, B; gg = rr = A = B...
### Prompt Please formulate a cpp solution to the following problem: Having learned (not without some help from the Codeforces participants) to play the card game from the previous round optimally, Shrek and Donkey (as you may remember, they too live now in the Kingdom of Far Far Away) have decided to quit the boring...
#include <bits/stdc++.h> using namespace std; int main() { int n, m, k; scanf("%d%d%d", &n, &m, &k); int gAlone = 0; int rAlone = 0; vector<int> diffs; char row[113]; for (int i = 0; i < n; i++) { scanf(" %s", &row); int g = -1; int r = -1; bool flag = false; for (int j = 0; j < m; j++...
### Prompt In Cpp, your task is to solve the following problem: Having learned (not without some help from the Codeforces participants) to play the card game from the previous round optimally, Shrek and Donkey (as you may remember, they too live now in the Kingdom of Far Far Away) have decided to quit the boring card...
#include <bits/stdc++.h> using namespace std; bool gonly, ronly; vector<int> vt; char str[105]; int main() { int n, m, k; scanf("%d%d%d", &n, &m, &k); if (m == 1) { printf("Second\n"); return 0; } for (int i = 0; i < n; i++) { scanf("%s", str); int emp = find(str, str + m, '-') - str; if (...
### Prompt Create a solution in cpp for the following problem: Having learned (not without some help from the Codeforces participants) to play the card game from the previous round optimally, Shrek and Donkey (as you may remember, they too live now in the Kingdom of Far Far Away) have decided to quit the boring card ...
#include <bits/stdc++.h> using namespace std; const int INF = 1000000000; const int diri[8] = {-1, 0, 1, 0, -1, 1, 1, -1}; const int dirj[8] = {0, 1, 0, -1, 1, 1, -1, -1}; int main() { int f, c, k; cin >> f >> c >> k; vector<int> v; bool infR = false, infG = false; for (int i = 0; i < f; ++i) { string s; ...
### Prompt Construct a Cpp code solution to the problem outlined: Having learned (not without some help from the Codeforces participants) to play the card game from the previous round optimally, Shrek and Donkey (as you may remember, they too live now in the Kingdom of Far Far Away) have decided to quit the boring ca...
#include <bits/stdc++.h> using namespace std; int main() { int n, m, k; cin >> n >> m >> k; bool firstFree = false, secondFree = false; bool posMove = false; int xsum = 0; vector<int> grs; for (int i = 0; i < n; ++i) { string s; cin >> s; int first = -1, second = -1; bool stuck = true; ...
### Prompt Create a solution in CPP for the following problem: Having learned (not without some help from the Codeforces participants) to play the card game from the previous round optimally, Shrek and Donkey (as you may remember, they too live now in the Kingdom of Far Far Away) have decided to quit the boring card ...
#include <bits/stdc++.h> using namespace std; int n, m, k, d[110]; char s[110]; int main() { scanf("%d%d%d\n", &n, &m, &k); bool gen = false, cheb = false; for (int i = 0; i < (n); i++) { int x = -1, y; d[i] = -1; gets(s); bool ok = false; for (int j = 0; j < (m); j++) if (s[j] != '-') {...
### Prompt Please create a solution in cpp to the following problem: Having learned (not without some help from the Codeforces participants) to play the card game from the previous round optimally, Shrek and Donkey (as you may remember, they too live now in the Kingdom of Far Far Away) have decided to quit the boring...
#include <bits/stdc++.h> using namespace std; int c[10], i, j, n, p1, p2, k, m; char ch, c1, c2; bool kr, kg; int main() { scanf("%d%d%d", &n, &m, &k); scanf("%c", &ch); kr = kg = false; for (int i = 1; i <= n; i++) { p1 = p2 = 0; for (int j = 1; j <= m; j++) { scanf("%c", &ch); if ((ch == '...
### Prompt Please provide a cpp coded solution to the problem described below: Having learned (not without some help from the Codeforces participants) to play the card game from the previous round optimally, Shrek and Donkey (as you may remember, they too live now in the Kingdom of Far Far Away) have decided to quit ...
#include <bits/stdc++.h> using namespace std; const int MAXL = 107; int a[MAXL]; char s[MAXL]; int n, m, k, cnt; bool gmove, rmove; int main() { scanf("%d %d %d\n", &n, &m, &k); k++; cnt = 0; gmove = rmove = false; for (int i = 0; i < n; i++) { gets(s); int l = -1, r = -1, c = 0; for (int j = 0; j...
### Prompt Create a solution in cpp for the following problem: Having learned (not without some help from the Codeforces participants) to play the card game from the previous round optimally, Shrek and Donkey (as you may remember, they too live now in the Kingdom of Far Far Away) have decided to quit the boring card ...
#include <bits/stdc++.h> using namespace std; using ll = long long; int n, m, k; char cells[100][100]; const char dash = '-'; const char second[7] = "Second"; const char first[6] = "First"; const char draw[5] = "Draw"; void scan_cells() { for (int i = 0; i < n; ++i) { for (int j = 0; j < m; ++j) { cin >> ce...
### Prompt Please create a solution in Cpp to the following problem: Having learned (not without some help from the Codeforces participants) to play the card game from the previous round optimally, Shrek and Donkey (as you may remember, they too live now in the Kingdom of Far Far Away) have decided to quit the boring...
#include <iostream> #include <cstdio> #include <cstring> #include <string> #include <algorithm> #include <queue> #include <vector> #include <set> #include <map> #include <stack> #include <cmath> #include <unordered_set> namespace std{ #define fi first #define se second using LL = long long ; usin...
### Prompt Construct a cpp code solution to the problem outlined: Gildong's town has a train system that has 100 trains that travel from the bottom end to the top end and 100 trains that travel from the left end to the right end. The trains starting from each side are numbered from 1 to 100, respectively, and all tra...
#include <bits/stdc++.h> using namespace std; int main(){ int ts; cin >> ts; while(ts--){ int n, m; cin >> n >> m; vector<int> ntrain(n, 0); vector<int> mtrain(m, 0); for(int &el : ntrain) cin >> el; for(int &el : mtrain) cin >> el; vector<int> com...
### Prompt Please provide a CPP coded solution to the problem described below: Gildong's town has a train system that has 100 trains that travel from the bottom end to the top end and 100 trains that travel from the left end to the right end. The trains starting from each side are numbered from 1 to 100, respectively...
#include <iostream> using namespace std; int main() { int t; cin>>t; while(t--){ int n,m; cin>>n>>m; int x[n]; int y[m]; for(int i=0; i<n; i++) cin>>x[i]; for(int i=0; i<m; i++) cin>>y[i]; int count = 0; ...
### Prompt Develop a solution in Cpp to the problem described below: Gildong's town has a train system that has 100 trains that travel from the bottom end to the top end and 100 trains that travel from the left end to the right end. The trains starting from each side are numbered from 1 to 100, respectively, and all ...
#include<bits/stdc++.h> using namespace std; int main() { int t; cin>>t; for(int i=0;i<t;i++) { int n,m,arr[1000]={0},c=0; cin>>n>>m; int a[n],b[m]; for(int j=0;j<n;j++) { cin>>a[j]; arr[a[j]]++; } for(int j=0;j<m;j++) ...
### Prompt Create a solution in Cpp for the following problem: Gildong's town has a train system that has 100 trains that travel from the bottom end to the top end and 100 trains that travel from the left end to the right end. The trains starting from each side are numbered from 1 to 100, respectively, and all trains...
/* author :: OneAboveAll */ #include <bits/stdc++.h> #define mod 1000000007 #define mp make_pair #define pb push_back #define ff first #define ss second #define rep(i,a,b) for(auto i=a;i<=b;i++) #define rrep(i,a,b) for(auto i=a;i>=b;i--) #define mrep(i,m) for(auto i=m.begin();i!=m.end();i++) #define all(x) (x)...
### Prompt Generate a Cpp solution to the following problem: Gildong's town has a train system that has 100 trains that travel from the bottom end to the top end and 100 trains that travel from the left end to the right end. The trains starting from each side are numbered from 1 to 100, respectively, and all trains h...
#include<bits/stdc++.h> #include<math.h> #include<sstream> using namespace std; #define ll long long #define ld long double #define f(i,a,b) for(ll i=a;i<b;i++) #define fb(i,a,b) for(ll i=a;i>=b;i--) #define mp make_pair #define pb push_back #define ft first #define sd second #define endl "\n" #define all(v) v....
### Prompt Generate a CPP solution to the following problem: Gildong's town has a train system that has 100 trains that travel from the bottom end to the top end and 100 trains that travel from the left end to the right end. The trains starting from each side are numbered from 1 to 100, respectively, and all trains h...
#include<bits/stdc++.h> using namespace std; #define SORT(c) sort((c).begin(),(c).end()); #define pb push_back #define MP make_pair #define pii pair<int,int> #define pcc pair<char,char> #define pic pair<int,char> #define pci pair<char,int> #define VS vector<string> #define VI vector<int> #define pi 3.141592653589793 #d...
### Prompt Please formulate a Cpp solution to the following problem: Gildong's town has a train system that has 100 trains that travel from the bottom end to the top end and 100 trains that travel from the left end to the right end. The trains starting from each side are numbered from 1 to 100, respectively, and all ...
#include<bits/stdc++.h> using namespace std; #define int long long #define endl "\n" #pragma GCC optimize("unroll-loops") #pragma GCC optimize("Ofast") #pragma GCC optimize("no-stack-protector") #pragma GCC target("sse,sse2,sse3,ssse3,popcnt,abm,mmx,tune=native") #pragma GCC optimize("fast-math") signed main() { //...
### Prompt Please formulate a CPP solution to the following problem: Gildong's town has a train system that has 100 trains that travel from the bottom end to the top end and 100 trains that travel from the left end to the right end. The trains starting from each side are numbered from 1 to 100, respectively, and all ...
#include<bits/stdc++.h> #define ll long long int #define vi vector<int> #define pb push_back using namespace std; ll bin_to_int(string bin){ reverse(bin.begin(),bin.end()); ll ans = 0; for(int i = 0;i<bin.size();i++){ int exp; if(bin[i] == '1'){ ans += pow(2,i); } ...
### Prompt Your task is to create a CPP solution to the following problem: Gildong's town has a train system that has 100 trains that travel from the bottom end to the top end and 100 trains that travel from the left end to the right end. The trains starting from each side are numbered from 1 to 100, respectively, an...
#include<bits/stdc++.h> using namespace std; #define IOS ios::sync_with_stdio(false),cin.tie(0),cout.tie(0); #define ll long long int #define rep(p,a,b) for(int p=a;p<b;p++) //kishor_e int main() { IOS; int t; cin>>t; while(t--) { int n,m,cnt=0; cin>>n>>m; vector<int>a(n)...
### Prompt Develop a solution in CPP to the problem described below: Gildong's town has a train system that has 100 trains that travel from the bottom end to the top end and 100 trains that travel from the left end to the right end. The trains starting from each side are numbered from 1 to 100, respectively, and all ...
#include<bits/stdc++.h> typedef long long ll; typedef long double ld; const ll mod = 1000000007; const double PI = 3.14159265358979323846; using namespace std; int main() { ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL); #ifndef ONLINE_JUDGE freopen("input.txt", "r", stdin); freopen("...
### Prompt Please formulate a Cpp solution to the following problem: Gildong's town has a train system that has 100 trains that travel from the bottom end to the top end and 100 trains that travel from the left end to the right end. The trains starting from each side are numbered from 1 to 100, respectively, and all ...
#include <bits/stdc++.h> #define ll long long #define ld long double #define fi first #define se second #define pb push_back #define mp make_pair #define all(c) (c).begin(), (c).end() #define strToInt(a) atoi(a.c_str()) using n...
### Prompt Create a solution in CPP for the following problem: Gildong's town has a train system that has 100 trains that travel from the bottom end to the top end and 100 trains that travel from the left end to the right end. The trains starting from each side are numbered from 1 to 100, respectively, and all trains...
#include<bits/stdc++.h> using namespace std; int main() { ios::sync_with_stdio(0); cin.tie(0); int t; cin>>t; while(t--) { int n,m,x; cin>>n>>m; set<int> st1; for(int i=0;i<n;i++) { cin>>x; st1.insert(x); } int count=0; for(int i=0;i<m;i++) { cin>>x; if(st1.c...
### Prompt Please formulate a CPP solution to the following problem: Gildong's town has a train system that has 100 trains that travel from the bottom end to the top end and 100 trains that travel from the left end to the right end. The trains starting from each side are numbered from 1 to 100, respectively, and all ...
#include<bits/stdc++.h> using namespace std; bool ada[105]; int main(){ ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0); int t,n,m,a; cin >> t; while(t--){ cin >> n >> m; memset(ada,0,sizeof(ada)); for(int i=1;i<=n;i++){ cin >> a; ada[a]=true; } int ans=0; for(int i=1;i<=m;i++){ cin >> a;...
### Prompt Please formulate a cpp solution to the following problem: Gildong's town has a train system that has 100 trains that travel from the bottom end to the top end and 100 trains that travel from the left end to the right end. The trains starting from each side are numbered from 1 to 100, respectively, and all ...
#include <bits/stdc++.h> using namespace std; int main() { int t; cin >> t; for (int i = 0; i < t; i++) { set<int> s; int a, b; cin >> a >> b; int val; for (int j = 0; j < a; j++) { cin >> val; s.insert(val); } for (in...
### Prompt In cpp, your task is to solve the following problem: Gildong's town has a train system that has 100 trains that travel from the bottom end to the top end and 100 trains that travel from the left end to the right end. The trains starting from each side are numbered from 1 to 100, respectively, and all train...
#define _CRT_SECURE_NO_WANRNINGS #include <cstdio> #include <iostream> #include <vector> #include <queue> using namespace std; int main() { int q; cin >> q; for (int i = 0; i < q; i++) { int n,m, res = 0; cin >> n >> m; vector<bool> t(101); for (int j = 0; j < n; j++ ) { int pos; c...
### Prompt Your challenge is to write a cpp solution to the following problem: Gildong's town has a train system that has 100 trains that travel from the bottom end to the top end and 100 trains that travel from the left end to the right end. The trains starting from each side are numbered from 1 to 100, respectively...
#include<bits/stdc++.h> #define pi pair<int,int> #define mk make_pair #define f(i,n) for(int i=1;i<=n;i++) #define fo(i,n) for(int i=0;i<n;i++) #define fi(i,a,n) for(int i=a;i<=n;i++) #define fr(i,a,n) for(int i=a;i>=n;i--) #define ll long long #define li long #define N 1000000007 using namespace std; int main() { ...
### Prompt Create a solution in CPP for the following problem: Gildong's town has a train system that has 100 trains that travel from the bottom end to the top end and 100 trains that travel from the left end to the right end. The trains starting from each side are numbered from 1 to 100, respectively, and all trains...
#include<bits/stdc++.h> using namespace std; #define pb push_back //#define mp make_pair #define timesaver ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0); const long long int mod=1e7 + 7; #define PI 3.14159265 typedef long long int ll; const long long int N=1e6 + 9; vector <ll> v[100009]; bool visit[1509] = {false...
### Prompt Construct a cpp code solution to the problem outlined: Gildong's town has a train system that has 100 trains that travel from the bottom end to the top end and 100 trains that travel from the left end to the right end. The trains starting from each side are numbered from 1 to 100, respectively, and all tra...
#include <iostream> #include <bits/stdc++.h> // #include <iterator> using namespace std; #define ll long long #define readarr(a,n) for (ll i=0; i<n; i++) {cin>>a[i];} #define printarr(a,n) for (int i=0; i<n; i++) {cout<<a[i]<<' ';} #define fast ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL); #define vi...
### Prompt Construct a CPP code solution to the problem outlined: Gildong's town has a train system that has 100 trains that travel from the bottom end to the top end and 100 trains that travel from the left end to the right end. The trains starting from each side are numbered from 1 to 100, respectively, and all tra...
#include <bits/stdc++.h> using namespace std; int main() { int t; cin>>t; while(t--) { int n,m; int count=0; cin>>n>>m; map <int, int > ma; int a[n],b[m]; for(int i=0;i<n;i++) { cin>>a[i]; ma[a[i]]++; } for(int i=0;i<m;i+...
### Prompt Generate a Cpp solution to the following problem: Gildong's town has a train system that has 100 trains that travel from the bottom end to the top end and 100 trains that travel from the left end to the right end. The trains starting from each side are numbered from 1 to 100, respectively, and all trains h...
//#define debug #include<cstdio> #include<iostream> #include<cmath> #include<string> #include<algorithm> #include<cstring> #include<stack> #include<queue> #include<map> #include<set> using namespace std; #define mset(a, b) memset(a, b, sizeof(a)) #define fill(a, b, c) fill(a, b+10, c) #define mp make_pair #define x fi...
### Prompt Your challenge is to write a cpp solution to the following problem: Gildong's town has a train system that has 100 trains that travel from the bottom end to the top end and 100 trains that travel from the left end to the right end. The trains starting from each side are numbered from 1 to 100, respectively...
#include <bits/stdc++.h> #define PI 3.141592653589793238462643383279 #define EXP 2.71828182846 #define ll long long using namespace std; double log2(double n) { return log(n)/log(2); } double ln(double n) { return log(n)/log(EXP); } void Heap(signed long long int A[],signed long long int n,signed long lon...
### Prompt Please create a solution in Cpp to the following problem: Gildong's town has a train system that has 100 trains that travel from the bottom end to the top end and 100 trains that travel from the left end to the right end. The trains starting from each side are numbered from 1 to 100, respectively, and all ...
// Author : Shivraj Ahirwar // #include <bits/stdc++.h> using namespace std; #define rep(i,n) for (int i = 0; i < n; ++i) #define REP(i,k,n) for (int i = k; i <= n; ++i) #define REPR(i,k,n) for (int i = k; i >= n; --i) #define ll long long int #define nx cout<<"\n"; //=========================================...
### Prompt Generate a cpp solution to the following problem: Gildong's town has a train system that has 100 trains that travel from the bottom end to the top end and 100 trains that travel from the left end to the right end. The trains starting from each side are numbered from 1 to 100, respectively, and all trains h...
#include<bits/stdc++.h> using namespace std; int main() { cout.tie(nullptr)->sync_with_stdio(false); int T; cin >> T; while (T--) { int N, M; cin >> N >> M; vector<int> A(110); for (int i = 0; i < N; ++i) { int a; cin >> a; A[a]++; } int res ...
### Prompt Your challenge is to write a Cpp solution to the following problem: Gildong's town has a train system that has 100 trains that travel from the bottom end to the top end and 100 trains that travel from the left end to the right end. The trains starting from each side are numbered from 1 to 100, respectively...
#include<bits/stdc++.h> #define ll long long #define vi vector<int> #define vl vector<ll> #define pb push_back #define For(i,n) for(ll i=0;i<n;i++) #define MOD 1000000007 #define MAX 100005 #define pll pair <ll,ll> #define fi first #define se second using namespace std; int main(){ ios_base::sync_with_stdio(false); ...
### Prompt Your task is to create a Cpp solution to the following problem: Gildong's town has a train system that has 100 trains that travel from the bottom end to the top end and 100 trains that travel from the left end to the right end. The trains starting from each side are numbered from 1 to 100, respectively, an...
#include <iostream> #include <algorithm> #include <cstring> using namespace std; int vis[200]; int main (void){ int T; cin >> T; while (T -- ){ int n, m; cin >> n >> m; memset(vis, 0, sizeof vis); int x, ans = 0; for (int i = 0; i < n; i ++ ) cin >> x, vis[x] =...
### Prompt Please create a solution in Cpp to the following problem: Gildong's town has a train system that has 100 trains that travel from the bottom end to the top end and 100 trains that travel from the left end to the right end. The trains starting from each side are numbered from 1 to 100, respectively, and all ...
#include <iostream> #include <cstdio> #include <cstring> #include <cstdlib> #include <algorithm> #include <cmath> #include <queue> #include <map> #include <vector> #include <unordered_map> using namespace std; #define sc(a) scanf("%lld",&a) #define scc(a,b) scanf("%lld%lld",&a,&b) #define sccc(a,b,c) scanf("%lld%lld%ll...
### Prompt Please create a solution in Cpp to the following problem: Gildong's town has a train system that has 100 trains that travel from the bottom end to the top end and 100 trains that travel from the left end to the right end. The trains starting from each side are numbered from 1 to 100, respectively, and all ...
#include<bits/stdc++.h> #define repa(i, s, e) for (int i = s; i <= e; i++); #define repb(i, s, e) for (int i = e; i >= s; i--); #define PI 3.1415926535897932384626433832795 using namespace std; typedef long int li; typedef long long int lli; typedef pair<li, li> pii; typedef vecto...
### Prompt Please provide a CPP coded solution to the problem described below: Gildong's town has a train system that has 100 trains that travel from the bottom end to the top end and 100 trains that travel from the left end to the right end. The trains starting from each side are numbered from 1 to 100, respectively...
#include <bits/stdc++.h> #define MEM 502 #define sanic ios_base::sync_with_stdio(0) #define MOD 1000000 using namespace std; typedef long long ll; typedef pair<ll, ll> pi; const ll INF = 1e13+7; ll t,n,m,k; string s; ll a[MEM],y[MEM]; int main(){ sanic; cin.tie(0); cin >> t; while(t--){ cin >> n >> ...
### Prompt Your task is to create a Cpp solution to the following problem: Gildong's town has a train system that has 100 trains that travel from the bottom end to the top end and 100 trains that travel from the left end to the right end. The trains starting from each side are numbered from 1 to 100, respectively, an...
#include<iostream> using namespace std; int main() { int t; cin >> t; while(t--){ int n,m, c = 0; cin >> n >> m; int btm[n], left[m]; for(int i = 0; i < n; i++) cin >> btm[i]; for(int i = 0; i < m; i++) cin >> left[i]; int l = 0, b ...
### Prompt Please formulate a cpp solution to the following problem: Gildong's town has a train system that has 100 trains that travel from the bottom end to the top end and 100 trains that travel from the left end to the right end. The trains starting from each side are numbered from 1 to 100, respectively, and all ...
#include <bits/stdc++.h> #define ll long long namespace FAST_IO { template <class T> inline void read(T &x) { T flag = 1; x = 0; char ch = getchar(); while (ch < '0' || ch > '9') { if (ch == '-') flag = -1; ch = getchar(); ...
### Prompt Create a solution in Cpp for the following problem: Gildong's town has a train system that has 100 trains that travel from the bottom end to the top end and 100 trains that travel from the left end to the right end. The trains starting from each side are numbered from 1 to 100, respectively, and all trains...
#include <iostream> #include<bits/stdc++.h> using namespace std; int main() { int t; cin>>t; while(t--){ int n,m; int count{0}; cin>>n>>m; int arrn[n],arrm[m]; for(int i=0;i<n;i++) cin>>arrn[i]; for(int j=0;j<m;j++) cin>>arrm[j]; ...
### Prompt In Cpp, your task is to solve the following problem: Gildong's town has a train system that has 100 trains that travel from the bottom end to the top end and 100 trains that travel from the left end to the right end. The trains starting from each side are numbered from 1 to 100, respectively, and all train...
#include<bits/stdc++.h> using namespace std; #define pb push_back #define st first #define nd second typedef long long ll; typedef vector<int> vi; typedef pair<int,int> ii; typedef vector<ii> vii; typedef vector<vi> vvi; #define sz(a) int((a).size()) #define all(c) (c).begin(),(c).end() #define tr(c,i) for(typeof(...
### Prompt Please create a solution in Cpp to the following problem: Gildong's town has a train system that has 100 trains that travel from the bottom end to the top end and 100 trains that travel from the left end to the right end. The trains starting from each side are numbered from 1 to 100, respectively, and all ...
// hilo #include <bits/stdc++.h> #define all(x) (x).begin(), (x).end() #define rall(x) (x).rbegin(), (x).rend() #define cast(type, data) static_cast <type>(data) typedef long long ll; typedef unsigned long long ull; typedef long double ld; template <class A> void transpose(std::vector <std::vector <A>>& v) { std::v...
### Prompt In cpp, your task is to solve the following problem: Gildong's town has a train system that has 100 trains that travel from the bottom end to the top end and 100 trains that travel from the left end to the right end. The trains starting from each side are numbered from 1 to 100, respectively, and all train...
#include <bits/stdc++.h> using namespace std; int main() { int t; cin>>t; while(t--){ int n,m; cin>>n>>m; int arr[m+n]; for(int i=0;i<n;i++){ cin>>arr[i]; } for(int i=n;i<m+n;i++){ cin>>arr[i]; } sort(arr,arr + (m+n)); int count=0; for(int i=0;i<m+n-1;i++){ if(arr[i]==arr[i+1]){ count++; } } cout<<count...
### Prompt Construct a Cpp code solution to the problem outlined: Gildong's town has a train system that has 100 trains that travel from the bottom end to the top end and 100 trains that travel from the left end to the right end. The trains starting from each side are numbered from 1 to 100, respectively, and all tra...
#include <bits/stdc++.h> using namespace std; #define ll long long int main() {ios_base::sync_with_stdio(false); int t;cin>>t; while(t--){ int n,m; cin>>n>>m; set<int> s;int x; int c= 0; for(int i =0 ;i<n;i++) { cin>>x;s.insert(x); } for(int i =0 ;i<m;i++) {...
### Prompt Your task is to create a cpp solution to the following problem: Gildong's town has a train system that has 100 trains that travel from the bottom end to the top end and 100 trains that travel from the left end to the right end. The trains starting from each side are numbered from 1 to 100, respectively, an...
#include <iostream> #include <cstddef> #include <vector> #include <cstring> #include <string> #include <algorithm> #include <set> #include <map> #include <ctime> #include <unordered_map> #include <random> #include <iomanip> #include <cmath> #include <queue> #include <unordered_set> #include <cassert> #include <bitset> ...
### Prompt Your task is to create a CPP solution to the following problem: Gildong's town has a train system that has 100 trains that travel from the bottom end to the top end and 100 trains that travel from the left end to the right end. The trains starting from each side are numbered from 1 to 100, respectively, an...
#include <bits/stdc++.h> using namespace std; int main() { ios_base::sync_with_stdio(false); cin.tie(NULL); long long t; cin>>t; while(t--) { long long n,m,cnt=0; cin>>n>>m; long long a[n],b[m]; for(long long i=0;i<n;i++) cin>>a[i]; for(long long i=0;i<m;i++)...
### Prompt Construct a cpp code solution to the problem outlined: Gildong's town has a train system that has 100 trains that travel from the bottom end to the top end and 100 trains that travel from the left end to the right end. The trains starting from each side are numbered from 1 to 100, respectively, and all tra...
#include <bits/stdc++.h> using namespace std; typedef long long ll; typedef pair<ll, ll> ii; typedef pair<ll, ii> iii; typedef string str; typedef vector<ll> vl; typedef vector< vector<ll> > vvl; typedef vector<ii> vii; typedef vector< vector<ii> > vvii; typedef vector<iii> viii; typedef vector< vector<iii> > vviii; t...
### Prompt Create a solution in CPP for the following problem: Gildong's town has a train system that has 100 trains that travel from the bottom end to the top end and 100 trains that travel from the left end to the right end. The trains starting from each side are numbered from 1 to 100, respectively, and all trains...
#include<bits/stdc++.h> using namespace std; typedef long long ll; #define int ll typedef pair<int, int> pii; typedef pair<ll, ll> pll; typedef vector<int> vi; typedef vector<ll> vll; typedef vector<pii> vpii; typedef vector<pll> vpll; #define F0R(i, a, b) for (int i=a; i<(b); i++) #define F0Rd(i,a,b) for (int i = (...
### Prompt Develop a solution in CPP to the problem described below: Gildong's town has a train system that has 100 trains that travel from the bottom end to the top end and 100 trains that travel from the left end to the right end. The trains starting from each side are numbered from 1 to 100, respectively, and all ...
#include <bits/stdc++.h> #include<unordered_map> typedef long long ll; using namespace std; long long max(long long a, long long b) { return a > b ? a : b; } long long min(long long a, long long b) { return a < b ? a : b; } //#define N 2e6+1 ll MOD= 1e9+7; ll n,m; ll k; unordered_map<ll,ll> h; long lo...
### Prompt Your challenge is to write a Cpp solution to the following problem: Gildong's town has a train system that has 100 trains that travel from the bottom end to the top end and 100 trains that travel from the left end to the right end. The trains starting from each side are numbered from 1 to 100, respectively...
#include <bits/stdc++.h> typedef long long ll; #define fr(i, a, b) for (ll i = a; i < b; i++) #define rf(i, a, b) for (ll i = a; i >= b; i--) typedef std::vector<long long> vi; #define fast \ ios_base::sync_with_stdio(0); \ cin.tie(0); \ cout.tie(0); #define PB push_ba...
### Prompt Your task is to create a Cpp solution to the following problem: Gildong's town has a train system that has 100 trains that travel from the bottom end to the top end and 100 trains that travel from the left end to the right end. The trains starting from each side are numbered from 1 to 100, respectively, an...
#include <stdio.h> #include <set> using namespace std; int main(){ int t; scanf("%d", &t); while(t--){ int n, m; scanf("%d%d", &n, &m); int a, b; set <int> s; for(int i = 0; i < n; i++){ scanf("%d",&a); s.insert(a); } int ans = 0; ...
### Prompt Please create a solution in CPP to the following problem: Gildong's town has a train system that has 100 trains that travel from the bottom end to the top end and 100 trains that travel from the left end to the right end. The trains starting from each side are numbered from 1 to 100, respectively, and all ...
#include <iostream> using namespace std; int main(){ int t; cin >> t; int n,m,i,k=0,j,P[101],l; for(i=0;i<t;i++){ for(j=0;j<101;j++){ P[j]=0; } k=0; cin >> n >> m; for(j=0;j<n;j++){ cin >> l; P[l]++; } for(j=0;j<m;j++){ cin >> l; P[l]++; } for(j=1;j<=100;j++){ if(P[j]>1){ k++...
### Prompt Your task is to create a Cpp solution to the following problem: Gildong's town has a train system that has 100 trains that travel from the bottom end to the top end and 100 trains that travel from the left end to the right end. The trains starting from each side are numbered from 1 to 100, respectively, an...
#include <bits/stdc++.h> using namespace std; const int maxn = 105 + 7; int num[maxn]; int main() { int T;scanf("%d",&T); while(T--) { int n,m,res = 0;scanf("%d %d",&n,&m); memset(num,0,sizeof(num)); for(int i = 1,x;i <= n;++i) { scanf("%d",&x); num[x]++; }for(int i...
### Prompt Your challenge is to write a CPP solution to the following problem: Gildong's town has a train system that has 100 trains that travel from the bottom end to the top end and 100 trains that travel from the left end to the right end. The trains starting from each side are numbered from 1 to 100, respectively...
// 2^j = << // >> ->divide by 2 #include<bits/stdc++.h> using namespace std; #define debug(val) printf("check%d\n",val) #define int long long #define mod 1000000007 #define clr(val) memset(val,0,sizeof(val)) #define watch(x) cerr << #x << " is " << x << endl; //vec.erase( unique( vec.begin(), vec.end() ), vec.end() ...
### Prompt Please create a solution in Cpp to the following problem: Gildong's town has a train system that has 100 trains that travel from the bottom end to the top end and 100 trains that travel from the left end to the right end. The trains starting from each side are numbered from 1 to 100, respectively, and all ...
// In The Name Of God /* ki oomade?! */ #include <bits/stdc++.h> typedef long long ll; using namespace std; const int N = 1e6 + 10; ll t, n, m, a[N], b[N]; int main() { ios_base::sync_with_stdio(false), cin.tie(0), cout.tie(0); cin >> t; while(t --){ cin >> n >> m; ll ans = 0; for(int i = 0; i < n; i...
### Prompt Construct a CPP code solution to the problem outlined: Gildong's town has a train system that has 100 trains that travel from the bottom end to the top end and 100 trains that travel from the left end to the right end. The trains starting from each side are numbered from 1 to 100, respectively, and all tra...
#include <bits/stdc++.h> using namespace std; typedef long long ll; #define endl '\n' int main() { int kase; cin >> kase; while (kase--) { int n, m; int cnt = 0; cin >> n >> m; map<int, int> mp; for (int i = 0; i < n; i++) { int x; ...
### Prompt Your challenge is to write a CPP solution to the following problem: Gildong's town has a train system that has 100 trains that travel from the bottom end to the top end and 100 trains that travel from the left end to the right end. The trains starting from each side are numbered from 1 to 100, respectively...
#include <bits/stdc++.h> using namespace std; const int N = 120; int n, m, cnt[N], x; void work() { int ans = 0; memset(cnt, 0, sizeof(cnt)); scanf("%d%d", &n, &m); for (int i = 1; i <= n; i++) scanf("%d", &x), cnt[x]++; for (int i = 1; i <= m; i++) scanf("%d", &x), cnt[x]++; for (int i = 1; i <= 101; i++...
### Prompt Your challenge is to write a cpp solution to the following problem: Gildong's town has a train system that has 100 trains that travel from the bottom end to the top end and 100 trains that travel from the left end to the right end. The trains starting from each side are numbered from 1 to 100, respectively...
#include<bits/stdc++.h> #define w(x) int x; cin>>x; for(int tc=1;tc<=t;tc++) #define trace(x) cerr<<#x<<": "<<x<<" "<<endl; #define FIO ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); #define int long long #define pb push_back #define pqg priority_queue<int> #define pqs priority_queue<in...
### Prompt Please formulate a cpp solution to the following problem: Gildong's town has a train system that has 100 trains that travel from the bottom end to the top end and 100 trains that travel from the left end to the right end. The trains starting from each side are numbered from 1 to 100, respectively, and all ...
#include <bits/stdc++.h> using namespace std; #define ll long long int ll mod(ll x){ if(x>=0){ return x; } return -x; } bool isPerfectSquare(long double x) { // Find floating point value of // square root of x. long double sr = sqrt(x); // If square root is an integer ...
### Prompt Create a solution in Cpp for the following problem: Gildong's town has a train system that has 100 trains that travel from the bottom end to the top end and 100 trains that travel from the left end to the right end. The trains starting from each side are numbered from 1 to 100, respectively, and all trains...
#include<bits/stdc++.h> using namespace std; #define ff first #define ss second #define ll long long #define pb push_back #define mp make_pair #define pii pair<int,int> #define vi vector<int> #define mii map<int,int> #defi...
### Prompt Please formulate a CPP solution to the following problem: Gildong's town has a train system that has 100 trains that travel from the bottom end to the top end and 100 trains that travel from the left end to the right end. The trains starting from each side are numbered from 1 to 100, respectively, and all ...
#include<bits/stdc++.h> using namespace std; int main() { #ifndef ONLINE_JUDGE freopen("input.txt", "r", stdin); freopen("output.txt", "w", stdout); #endif int test; cin>>test; while(test--){ int n,m; cin>>n>>m; map<int,int> mp; int cnt=0; int val; for(int i=0;i<n;i++){ cin>>val; mp...
### Prompt Please provide a cpp coded solution to the problem described below: Gildong's town has a train system that has 100 trains that travel from the bottom end to the top end and 100 trains that travel from the left end to the right end. The trains starting from each side are numbered from 1 to 100, respectively...
#include<iostream> using namespace std; int main() { int T,m,n; cin>>T; while(T > 0) { cin>>n>>m; int a[n]; int b[m]; for(int i = 0; i < n; i++) cin>>a[i]; for(int i = 0; i < m; i++) cin>>b[i]; int c = 0; ...
### Prompt Develop a solution in CPP to the problem described below: Gildong's town has a train system that has 100 trains that travel from the bottom end to the top end and 100 trains that travel from the left end to the right end. The trains starting from each side are numbered from 1 to 100, respectively, and all ...
/** * Author : redhooded * Created : 04/12/2020 * Time : 14:52:17 * */ #include <bits/stdc++.h> using namespace std; #define ll long long #define pll pair<ll, ll> #define pii pair<int, int> #define mp make_pair #define Max(a, b, c) max(a, max(b, c)) #define Min(a, b, c) min(a, min(b, c)) #define si set<int> #def...
### Prompt In CPP, your task is to solve the following problem: Gildong's town has a train system that has 100 trains that travel from the bottom end to the top end and 100 trains that travel from the left end to the right end. The trains starting from each side are numbered from 1 to 100, respectively, and all train...
#include<bits/stdc++.h> using namespace std; int main(){ int t; cin>>t; while(t--){ int n,m; cin>>n>>m; int no =0; int arr[n]; int brr[m]; int i; for(i=0;i<n;i++) cin>>arr[i]; for(i=0;i<m;i++){ cin>>brr[i]; } if(n>m...
### Prompt Please formulate a Cpp solution to the following problem: Gildong's town has a train system that has 100 trains that travel from the bottom end to the top end and 100 trains that travel from the left end to the right end. The trains starting from each side are numbered from 1 to 100, respectively, and all ...
#define _CRT_SECURE_NO_WARNINGS #define forn(i,n) for (LL i=0;i<n;i++) #define foran(i,a,n) for (LL i=a;i<n;i++) #define LL long long #include <stdio.h> #include <stdlib.h> #include <iostream> #include <cmath> #include <vector> #include <string> #include <algorithm> #include <utility> #include <set> #include <bitset> #...
### Prompt Your challenge is to write a CPP solution to the following problem: Gildong's town has a train system that has 100 trains that travel from the bottom end to the top end and 100 trains that travel from the left end to the right end. The trains starting from each side are numbered from 1 to 100, respectively...
#include<bits/stdc++.h> using namespace std; int main(){ int t;cin>>t; while(t--){ int n,m,a; cin>>n>>m; int arr[101]; memset(arr,0,sizeof(arr)); int cnt=0; for(int i=0;i<n;i++) { cin>>a; arr[a]=1;} for(int i=0;i<m;i++) { cin>>a; if(arr[a]) cnt++;} cout<<cnt<<'\n'; } return 0; }
### Prompt Your challenge is to write a cpp solution to the following problem: Gildong's town has a train system that has 100 trains that travel from the bottom end to the top end and 100 trains that travel from the left end to the right end. The trains starting from each side are numbered from 1 to 100, respectively...
#include<iostream> using namespace std; int main() { int arr[1000],arr1[1000],x,y,t,c=0,i,j; cin >> t; while(t--) { cin >> x >> y; for(i=0;i<x;i++) { cin >> arr[i]; } for(i=0;i<y;i++) { cin >> arr1[i]; } for(i=0;i<x;...
### Prompt Please formulate a CPP solution to the following problem: Gildong's town has a train system that has 100 trains that travel from the bottom end to the top end and 100 trains that travel from the left end to the right end. The trains starting from each side are numbered from 1 to 100, respectively, and all ...
#include <bits/stdc++.h> #define int long long using namespace std; void run_case() { int n, m; cin >> n >> m; set<int> a; int x; for (int i = 0; i < n; ++i) { cin >> x; a.insert(x); } int ans = 0; for (int i = 0; i < m; ++i) { cin >> x; if (a.find(x) != ...
### Prompt Generate a CPP solution to the following problem: Gildong's town has a train system that has 100 trains that travel from the bottom end to the top end and 100 trains that travel from the left end to the right end. The trains starting from each side are numbered from 1 to 100, respectively, and all trains h...
#include <bits/stdc++.h> #include <vector> #include <algorithm> using namespace std; int main() { long long t; cin >> t; while(t--) { long long n, m; cin >> n >> m; vector<long long> a(n); vector<long long> b(m); for(long long i=0; i<n; i++) { cin >> a[i]; } for(long long i=0; i<m; i++) { cin >> b[i]; } lon...
### Prompt Generate a cpp solution to the following problem: Gildong's town has a train system that has 100 trains that travel from the bottom end to the top end and 100 trains that travel from the left end to the right end. The trains starting from each side are numbered from 1 to 100, respectively, and all trains h...
#include <bits/stdc++.h> //#define int long long int #define ll long long int #define ld long double #define getFaster ios_base::sync_with_stdio(false), cin.tie(nullptr) #define rep(i, init, n) for (int i = init; i < (int)n; i++) #define rev(i, n, init) for (int i = (int)n; i >= init; i--) #define MOD1 1e9 + 7 #define ...
### Prompt Your challenge is to write a cpp solution to the following problem: Gildong's town has a train system that has 100 trains that travel from the bottom end to the top end and 100 trains that travel from the left end to the right end. The trains starting from each side are numbered from 1 to 100, respectively...