Language: C++

#ifndef _WIN32
#include<iostream>
#endif 

#include<cmath>
#include<iomanip>
#include<algorithm>
#include<vector>
#include<string>
using namespace std;
typedef long long LL;
#define FOR(i,bg,ed) for(int i = (bg);i<(ed);i++)
#define REP(i,n) FOR(i,0,n)
struct cww {
	cww() {
		ios::sync_with_stdio(false);
		cin.tie(0);
		cout << fixed;
		cout << setprecision(10);
	}
}star;
template<typename T>
istream & operator>> (istream &is, vector<T>&v) {
	for (auto &it : v)is >> it;
	return is;
}
#define fi first
#define se second
#define ALL(x) (x).begin(),(x).end()
typedef pair<LL, LL> P;
typedef vector<LL> V;
const int INF = 1e7;
int s, n, t, m;
double p;
string week, tm;
int ok[114514];
const int WEEK = 10080;
const int DAY = 1440;
string ww[] = { "Sun","Mon","Tue","Wed","Thu","Fri","Sat" };
void init() {
	REP(i, 114514) {
		ok[i] = 0;
	}
	REP(i, 7)if (week == ww[i] || week == "All") {
		if (tm == "All" || tm == "Night") {
			int bg = i*DAY + 0;
			int ed = i*DAY + 360;
			FOR(j, bg, ed)ok[j] = 1;
		}
		if (tm == "All" || tm == "Night") {
			int bg = i*DAY + 1080;
			int ed = i*DAY + 1440;
			FOR(j, bg, ed)ok[j] = 1;
		}
		if (tm == "All" || tm == "Day") {
			int bg = i*DAY + 360;
			int ed = i*DAY + 1080;
			FOR(j, bg, ed)ok[j] = 1;
		}
	}
}

int main() {
	while (cin >> s >> n >> t >> week >> tm >> p >> m,week!="None") {
		int res = 0;
		init();
		REP(i, WEEK) {
			int now = i;
			int ans = 0;
			REP(j, m) {
				int ch = now + s;
				ch %= WEEK;
				if (ok[ch])ans++;
				now += t;
				now %= WEEK;
			}
			if (ans > res)res = ans;
		}
		p = 1.0-1.0 / p;
		double pp = 1;
		REP(i, n)pp *= p;
		double ppp = 1;
		REP(i, res)ppp *= pp;
		cout << 1 - ppp << endl;
	}
	return 0;
}

Compiler output:
a.cc: In function 'void init()':
a.cc:45:21: error: reference to 'tm' is ambiguous
   45 |                 if (tm == "All" || tm == "Night") {
      |                     ^~
In file included from /usr/include/time.h:39,
                 from /usr/include/pthread.h:23,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/gthr-default.h:35,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/gthr.h:157,
                 from /usr/include/c++/14/ext/atomicity.h:35,
                 from /usr/include/c++/14/bits/ios_base.h:39,
                 from /usr/include/c++/14/ios:44,
                 from /usr/include/c++/14/ostream:40,
                 from /usr/include/c++/14/iostream:41,
                 from a.cc:2:
/usr/include/x86_64-linux-gnu/bits/types/struct_tm.h:7:8: note: candidates are: 'struct tm'
    7 | struct tm
      |        ^~
a.cc:35:14: note:                 'std::string tm'
   35 | string week, tm;
      |              ^~
a.cc:45:36: error: reference to 'tm' is ambiguous
   45 |                 if (tm == "All" || tm == "Night") {
      |                                    ^~
/usr/include/x86_64-linux-gnu/bits/types/struct_tm.h:7:8: note: candidates are: 'struct tm'
    7 | struct tm
      |        ^~
a.cc:35:14: note:                 'std::string tm'
   35 | string week, tm;
      |              ^~
a.cc:50:21: error: reference to 'tm' is ambiguous
   50 |                 if (tm == "All" || tm == "Night") {
      |                     ^~
/usr/include/x86_64-linux-gnu/bits/types/struct_tm.h:7:8: note: candidates are: 'struct tm'
    7 | struct tm
      |        ^~
a.cc:35:14: note:                 'std::string tm'
   35 | string week, tm;
      |              ^~
a.cc:50:36: error: reference to 'tm' is ambiguous
   50 |                 if (tm == "All" || tm == "Night") {
      |                                    ^~
/usr/include/x86_64-linux-gnu/bits/types/struct_tm.h:7:8: note: candidates are: 'struct tm'
    7 | struct tm
      |        ^~
a.cc:35:14: note:                 'std::string tm'
   35 | string week, tm;
      |              ^~
a.cc:55:21: error: reference to 'tm' is ambiguous
   55 |                 if (tm == "All" || tm == "Day") {
      |                     ^~
/usr/include/x86_64-linux-gnu/bits/types/struct_tm.h:7:8: note: candidates are: 'struct tm'
    7 | struct tm
      |        ^~
a.cc:35:14: note:                 'std::string tm'
   35 | string week, tm;
      |              ^~
a.cc:55:36: error: reference to 'tm' is ambiguous
   55 |                 if (tm == "All" || tm == "Day") {
      |                                    ^~
/usr/include/x86_64-linux-gnu/bits/types/struct_tm.h:7:8: note: candidates are: 'struct tm'
    7 | struct tm
      |        ^~
a.cc:35:14: note:                 'std::string tm'
   35 | string week, tm;
      |              ^~
a.cc: In function 'int main()':
a.cc:64:46: error: reference to 'tm' is ambiguous
   64 |         while (cin >> s >> n >> t >> week >> tm >> p >> m,week!="None") {
      |                                              ^~
/usr/include/x86_64-linux-gnu/bits/types/struct_tm.h:7:8: note: candidates are: 'struct tm'
    7 | struct tm
      |        ^~
a.cc:35:14: note:                 'std::string tm'
   35 | string week, tm;
      |              ^~