Language: C++

#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
using namespace std;
#define ll long long
#define vv vector
#define pp pair
#define ff first
#define ss second
#define all(v) v.begin(), v.end()
#define fastio                    \
	ios_base::sync_with_stdio(0); \
	cin.tie(0);
typedef pair<ll, ll> pll;
typedef vv<ll> vll;
typedef vv<pll> vpll;
#define ordered_set tree<ll, null_type, less<ll>, rb_tree_tag, tree_order_statistics_node_update>
//adds two more functions to set
//(1)*(set.find_by_order(k))[kth element in the sorted set]
//(2)set.order_of_key(k)[count of elements strictly less than k]
#define LG(args...)                               \
	{                                             \
		string _s = #args;                        \
		replace(_s.begin(), _s.end(), ',', ' ');  \
		stringstream _ss(_s);                     \
		err(istream_iterator<string>(_ss), args); \
		cerr << endl;                             \
	}
void err(istream_iterator<string> it) {}
template <typename T, typename... Args>
void err(istream_iterator<string> it, T a, Args... args) {
	cerr << "(" << *it << ":" << a << ") ";
	err(++it, args...);
}
//:::::::::::::::::::::::::::::::::::::::::::::
const ll INF = 9e18;
const ll MOD = 1e9 + 7;
// #define dbg

int main(){
	fastio;
	string s;
	cin>>s;
	// for(ll i=s.size() -1; i>=0; i--){
	// 	if(s[i] == '?'){
	// 		if(i!= s.size() -1 && s[i+1] == 'D')
	// 			s[i] = 'P';
	// 		else
	// 			s[i] = 'D';
	// 	}
	// }

	for(ll i=0; i<s.size(); i++){#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
using namespace std;
#define ll long long
#define vv vector
#define pp pair
#define ff first
#define ss second
#define all(v) v.begin(), v.end()
#define fastio                    \
	ios_base::sync_with_stdio(0); \
	cin.tie(0);
typedef pair<ll, ll> pll;
typedef vv<ll> vll;
typedef vv<pll> vpll;
#define ordered_set tree<ll, null_type, less<ll>, rb_tree_tag, tree_order_statistics_node_update>
//adds two more functions to set
//(1)*(set.find_by_order(k))[kth element in the sorted set]
//(2)set.order_of_key(k)[count of elements strictly less than k]
#define LG(args...)                               \
	{                                             \
		string _s = #args;                        \
		replace(_s.begin(), _s.end(), ',', ' ');  \
		stringstream _ss(_s);                     \
		err(istream_iterator<string>(_ss), args); \
		cerr << endl;                             \
	}
void err(istream_iterator<string> it) {}
template <typename T, typename... Args>
void err(istream_iterator<string> it, T a, Args... args) {
	cerr << "(" << *it << ":" << a << ") ";
	err(++it, args...);
}
//:::::::::::::::::::::::::::::::::::::::::::::
const ll INF = 9e18;
const ll MOD = 1e9 + 7;
// #define dbg

int main(){
	fastio;
	string s;
	cin>>s;
	// for(ll i=s.size() -1; i>=0; i--){
	// 	if(s[i] == '?'){
	// 		if(i!= s.size() -1 && s[i+1] == 'D')
	// 			s[i] = 'P';
	// 		else
	// 			s[i] = 'D';
	// 	}
	// }

	for(ll i=0; i<s.size(); i++){
		if(s[i] == '?'){
			s[i] = 'D';
		}
	}
	cout<<s;
}
		if(s[i] == '?'){
			s[i] = 'D';
		}
	}
	cout<<s;
}

Compiler output:
a.cc:54:38: error: stray '#' in program
   54 |         for(ll i=0; i<s.size(); i++){#include <bits/stdc++.h>
      |                                      ^
a.cc: In function 'int main()':
a.cc:54:39: error: 'include' was not declared in this scope
   54 |         for(ll i=0; i<s.size(); i++){#include <bits/stdc++.h>
      |                                       ^~~~~~~
a.cc:54:48: error: 'bits' was not declared in this scope
   54 |         for(ll i=0; i<s.size(); i++){#include <bits/stdc++.h>
      |                                                ^~~~
a.cc:54:53: error: 'stdc' was not declared in this scope; did you mean 'std'?
   54 |         for(ll i=0; i<s.size(); i++){#include <bits/stdc++.h>
      |                                                     ^~~~
      |                                                     std
a.cc:57:1: error: expected primary-expression before 'using'
   57 | using namespace __gnu_pbds;
      | ^~~~~
a.cc:83:39: error: a function-definition is not allowed here before '{' token
   83 | void err(istream_iterator<string> it) {}
      |                                       ^
a.cc:84:1: error: a template declaration cannot appear at block scope
   84 | template <typename T, typename... Args>
      | ^~~~~~~~
a.cc:94:9: warning: empty parentheses were disambiguated as a function declaration [-Wvexing-parse]
   94 | int main(){
      |         ^~
a.cc:94:9: note: remove parentheses to default-initialize a variable
   94 | int main(){
      |         ^~
      |         --
a.cc:94:9: note: or replace parentheses with braces to value-initialize a variable
a.cc:94:11: error: a function-definition is not allowed here before '{' token
   94 | int main(){
      |           ^