criyle/codenet-compile-errors huggingface dataset:
Language: C++

#include<iostream>
#include<string>

using namespace std;

int main() {
  int length;
  
  string str;
  cin >> str;

  length = str.size();
  
  for(i=0;i<length;i++) {
    if(str[i] == '?') {
      if(i == 0 && str[i+1] == 'D') {
        str.replace(i, 1, "P");
      }else if(i == 0 && str[i+1] == 'P') {
        str.replace(i, 1, "D");
      }else if(str[i-1] == 'P' || i = length-1) {
        str.replace(i, 1, "D");
      } else if(str[i+1] == 'D') {
        str.replace(i, 1, "P");
      } else {
        str.replace(i, 1, "D");
      }
    }
  }
  cout << str << endl;
  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:14:7: error: 'i' was not declared in this scope
   14 |   for(i=0;i<length;i++) {
      |       ^
Language: C++

#include<bits/stdc++.h>
using namespace std;
int main()
{
	char a[100005];
	gets(a);
	int t=strlen(a);
	for(int i=0;i<=t;i++)
	{
		if(a[i]=='?') cout<<"D"; 
		else cout<<a[i];
	}
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:6:9: error: 'gets' was not declared in this scope; did you mean 'getw'?
    6 |         gets(a);
      |         ^~~~
      |         getw
Language: C++

#include <bits/stdc++.h>

#define sz(s) (int)(s).size()
#define sqr(x) (x) * (x)
#define re(i, n) for (int i = 1; i <= n; i ++)
#define pb push_back
#define finish(x) return cout << x << endl, 0
#define MP make_mair
#define trav(x, a) for(auto& x: a)
#define all(x) (x).begin,(x).end()
#define pi acis(-1)
#define Sor(x) sort(all(x))
#define REV(x) reverse(all(x))
#define F first
#define S second
#define I insert
#define N 222222
#define MOD 1000000007
#define nol(a) memset(a, 0, sizeof(a))
#define minus(a) memset(a, 0xff, sizeof(a))
#define eb emplace_back
#define file freopen("input.txt", "r", stdin); freopen("output.txt", "w", stdout)


using namespace std;
template <typename _T>inline void read(_T &f){f = 0; _T fu = 1; char c = getchar();while (c < '0' || c > '9') { if (c == '-') { fu = -1; } c = getchar();}    while (c >= '0' && c <= '9') { f = (f << 3) + (f << 1) + (c & 15); c = getchar();}f *= fu;}
template <typename T>void print(T x){if (x < 0) putchar('-'), x = -x;if (x < 10) putchar(x + 48);else print(x / 10), putchar(x % 10 + 48);}
template <typename T> void print(T x, char t){print(x); putchar(t);}
template <class T> bool umin(T& a, T b) {if(a>b){a = b; return 1;}return 0;}
template <class T> bool umax(T& a, T b) {if(a<b){a=b; return 1;}return 0;}
template <class T, class TT> bool pal(T a, TT n){int k = 0; for(int i =0; i <= n / 2; i ++){if(a[i]!=a[n-i-1]){k=1;break;}}return k?0:1;}
template<class T>void eras(vector<T>& a,T b){a.erase(find(a.begin(),a.end(),b));}

typedef long long ll;
vector <ll> vll;
ll powmod(ll a, ll b, ll m = MOD){ll r = 1;while(b>0){if(b&1)r=r*a%m;a=a*a%m;b>>=1;}return r;}
string to_upper(string a)
{
	for (int i = 0; i < (int)a.size(); ++ i) if (a[i] >= 'a' && a[i] <= 'z') a[i] -= 'a' - 'A';
	return a;
}
string to_lower(string a)
{
	for (int i = 0; i < (int)a.size(); ++ i) if (a[i] >= 'A' && a[i] <= 'Z') a[i] += 'a' - 'A';
	return a;
}
int main()
{
	ios::sync_with_stdio(false);
    cin.tie(0);cout.tie(0);
	string s;
	cin >> s;
	if (s[0] == '?')
	{
		if (s[i + 1] == 'D')
			s[0] = 'P';
		else
		if (s[i + 1] == 'P')
			s[0] = 'D';
		else
			s[0] = 'D';
	}
	for (int i = 1;  i < s.size(); i ++)
	{
		if (s[i] == '?')
		{
			if (s[i - 1] == 'D')
				s[i] = 'P';
			else
				s[i] = 'D';
		}
	}
	cout << s;






}



Compiler output:
a.cc: In function 'int main()':
a.cc:55:23: error: 'i' was not declared in this scope
   55 |                 if (s[i + 1] == 'D')
      |                       ^
Language: C++

#include <bits/stdc++.h>
using namespace std;

#define rep(i, n) for (int i = 0; i < (int)(n); i++)

int main()
{
    string t;
    cin >> t;

    rep(i, t.size())
    {
        if (t.at(i) == '?')
        {
            if (i == 0)
            {
                if (t.at(i + 1) == 'D')
                {
                    t.at(i) = 'P';
                }
                else
                    t.at(i) = 'D';
            }
            else if (i == t.size() - 1)
            {
                t.at(i) = 'D';
            }
            else
            {
                if (t.at(i - 1) == 'P')
                {
                    t.at(i) = 'D';
                }
                else if (t.at(i - 1) == 'D')
                {
                    t.at(i) = 'P';
                }
                else
                {
                    t.at(i) == 'D';
                }
            }
        }
    }
}

cout << t << endl;
return 0;
}

Compiler output:
a.cc:47:1: error: 'cout' does not name a type
   47 | cout << t << endl;
      | ^~~~
a.cc:48:1: error: expected unqualified-id before 'return'
   48 | return 0;
      | ^~~~~~
a.cc:49:1: error: expected declaration before '}' token
   49 | }
      | ^
Language: C++

#include <algorithm>
#include <cctype>
#include <cmath>
#include <cstdlib>
#include <iomanip>
#include <iostream>
#include <numeric>
#include <queue>
#include <set>
#include <string>
#include <unordered_map>
#include <vector>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
typedef pair<int, int> P;

#define REP(i, n) for (int i = 0, i##_len = (n); i < i##_len; ++i)
#define FOR(i, a, b) for (int i = (a), i##_len = (b); i <= i##_len; ++i)
#define REV(i, a, b) for (int i = (a); i >= (b); --i)
#define CLR(a, b) memset((a), (b), sizeof(a))
#define DUMP(x) cout << #x << " = " << (x) << endl;
#define INF 1001001001001001001ll
#define fcout cout << fixed << setprecision(12)

// vector<vector<int>> data(3, vector<int>(4));

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);

  string str;
  cin >> str;

  int ans = 0;
  int p = 0;
  int d = 0;
  rep(i, str.length()) {
    if (str[i] == '?') {
      str[i] = 'D';
  }

  cout << str;

  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:45:2: error: expected '}' at end of input
   45 | }
      |  ^
a.cc:27:12: note: to match this '{'
   27 | int main() {
      |            ^
Language: C++

#include<iostream>
#include<cstdio>
#include<cstring>
using namespace std;
char a[200002];
int len;
int main()
{
	gets(a);
	len=strlen(a);
	for(int i=0;i<=len-1;i++)
	{
		if(a[i]=='?')	a[i]='D';
	}
	puts(a);
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:9:9: error: 'gets' was not declared in this scope; did you mean 'getw'?
    9 |         gets(a);
      |         ^~~~
      |         getw
Language: C++

#include<bits/stdc++.h>
using namespace std;
int main () {
  string S;
  cin >> S;
  int N = (int)S.size();
  for (int i = N - 1; i >= 0; i --) {
    if (S[i] == '?') S[i] = 'D';
  cout << S << endl;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:10:2: error: expected '}' at end of input
   10 | }
      |  ^
a.cc:3:13: note: to match this '{'
    3 | int main () {
      |             ^
Language: C++

#include<bits/stdc++.h>
#define rep(i, n) for (long long i = 0; i < (int)(n); i++)
#define put(i) cout<<fixed<<i<<endl
using namespace std;
using ll = long long;

int main(){
    string t; cin >> t;
    ll ans = 0;

    t.push_back('X');

    for(long long i = 0; i < t.size()-1; i++){
        if(t[i] == '?'){
            t[i] = 'D';
        }
    }

    for(long long i = 0; i < t.size()-1; i++){
        cout << t[i];
    }
    cout << endl;
}#include<bits/stdc++.h>
#define rep(i, n) for (long long i = 0; i < (int)(n); i++)
#define put(i) cout<<fixed<<i<<endl
using namespace std;
using ll = long long;

int main(){
    string t; cin >> t;
    ll ans = 0;

    t.push_back('X');

    for(long long i = 0; i < t.size()-1; i++){
        if(t[i] == '?'){
            t[i] = 'D';
        }
    }

    for(long long i = 0; i < t.size()-1; i++){
        cout << t[i];
    }
    cout << endl;
}

Compiler output:
a.cc:23:2: error: stray '#' in program
   23 | }#include<bits/stdc++.h>
      |  ^
a.cc:23:3: error: 'include' does not name a type
   23 | }#include<bits/stdc++.h>
      |   ^~~~~~~
a.cc:29:5: error: redefinition of 'int main()'
   29 | int main(){
      |     ^~~~
a.cc:7:5: note: 'int main()' previously defined here
    7 | int main(){
      |     ^~~~
Language: C++

#include<bits/stdc++.h>
using namespace std;
int main()
{
	char a[100005];
	gets(a);
	int t=strlen(a);
	for(int i=0;i<=t;i++)
	{
		if(a[i]=='?') cout<<"D"; 
		else if(a[i]==' ') ;
		else cout<<a[i];
	}
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:6:9: error: 'gets' was not declared in this scope; did you mean 'getw'?
    6 |         gets(a);
      |         ^~~~
      |         getw
Language: C

#include<stdio.h>

int main(void){
  char str[200000];
  int i;
  scanf("%s", str);
  for (i=0;str[i]!='\0';i++){
    if(str[i]=='?')
      str[i]=D;
  }
  printf("%s", str);  
  return 0;
}

Compiler output:
main.c: In function 'main':
main.c:9:14: error: 'D' undeclared (first use in this function)
    9 |       str[i]=D;
      |              ^
main.c:9:14: note: each undeclared identifier is reported only once for each function it appears in
Language: Java

import java.util.*;


public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String ST = next();
        StringBuilder S = new StringBuilder(ST);
		
		for(int i=0; i<S.length(); i++){
		    if(S.charAt(i) == '?'){
		        if(S.charAt(i-1) == 'P'){
		            S.setCharAt(i,'D');
		        }else if(S.charAt(i-1) == 'D'){
		            S.setCharAt(i,'P');
		        }
		    }
		}
		
		System.out.println(S);
    }
}

Compiler output:
Main.java:7: error: cannot find symbol
        String ST = next();
                    ^
  symbol:   method next()
  location: class Main
1 error
Language: C++

#include<iostream>
#include<string.h>
using namespace std;
int main()
{
	char a[100005];
	gets(a);
	int t=strlen(a);
	for(int i=0;i<=t;i++)
	{
		if(a[i]=='?') cout<<"D"; 
		else if(a[i]==' ') ;
		else cout<<a[i];
	}
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:7:9: error: 'gets' was not declared in this scope; did you mean 'getw'?
    7 |         gets(a);
      |         ^~~~
      |         getw
Language: C++

#include<iostream>
#include<cstring>
using namespace std;
int main()
{
	char a[100005];
	gets(a);
	int t=strlen(a);
	for(int i=0;i<=t;i++)
	{
		if(a[i]=='?') cout<<"D"; 
		else if(a[i]==' ') ;
		else cout<<a[i];
	}
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:7:9: error: 'gets' was not declared in this scope; did you mean 'getw'?
    7 |         gets(a);
      |         ^~~~
      |         getw
Language: Java

    import java.util.Scanner;
     
    public class Main{
      public static void main(String... args){
        Scanner scanner = new Scanner(System.in);
        StringBuilder sb = new StringBuilder('\n' + scanner.next() + '\n');
        
        for(int i = 1; i < sb.length() - 1; i++){
          if(sb.charAt(i) == '?'){
            if(sb.charAt(i + 1) == 'D'){
              sb.append('P');
            }else{
              sb.append('D');
            }
          }
        }
        
        System.out.pritnln(sb.substring(1, sb.length() - 1));
      }
    }

Compiler output:
Main.java:18: error: cannot find symbol
        System.out.pritnln(sb.substring(1, sb.length() - 1));
                  ^
  symbol:   method pritnln(String)
  location: variable out of type PrintStream
1 error
Language: C++

#include <bits/stdc++.h>
using namespace std;

long long main() {
  string str;
  string kekka = "";
  long long cnt = 0;
  
  cin >> str;
  for(long long i = 0; i < str.size(); i++){
    cnt = 0;
    
    if(str.at(i) == '?'){
      if(i == 0){
        for(long long j = i+1; j < str.size(); j++){
          if(str.at(j) == 'D' || str.at(j) == '?'){
            cnt++;
          }else{
            break;
          }
        }
        
        if(cnt >= 2){
          for(long long j = i; j < i+cnt; j++){
            str.at(j) = 'D';
          }
          continue;
        }
        
        if(str.at(i+1) == 'P'){
          // ?P -> DP
          str.at(i) = 'D';
        }else if(str.at(i+1) == 'D'){
          // ?D -> PD
          str.at(i) = 'P';
        }else{
          // ?? -> P?
          str.at(i) = 'P';
        }
      }else if(i == str.size()-1){
        if(str.at(i-1) == 'P'){
          // P? -> PD
          str.at(i) = 'D';
        }else if(str.at(i-1) == 'D'){
          // D? -> DD
          str.at(i) = 'D';
        }
      }else{
        for(long long j = i+1; j < str.size(); j++){
          if(str.at(j) == 'D' || str.at(j) == '?'){
            cnt++;
          }else{
            break;
          }
        }
        
        if(cnt >= 2){
          for(long long j = i; j < i+cnt; j++){
            str.at(j) = 'D';
          }
          continue;
        }
        
        if(str.at(i-1) == 'P'){
          // P? -> PD
          str.at(i) = 'D';
        }else if(str.at(i-1) == 'D'){
          // D? -> DD
          if(str.at(i+1) == 'D'){
            str.at(i) = 'P';
          }else{
             str.at(i) = 'P';
          }
        }else if(str.at(i+1) == 'P'){
          // ?P -> DP
          str.at(i) = 'D';
        }else if(str.at(i+1) == 'D'){
          // ?D -> PD
          str.at(i) = 'P';
        }else{
          // ?? -> P?
          str.at(i) = 'P';
        }
      }
    }
  }

  cout << str;
}


Compiler output:
cc1plus: error: '::main' must return 'int'
Language: Java

    import java.util.Scanner;
     
    public class Main{
      public static void main(String... args){
        Scanner scanner = new Scanner(System.in);
        StringBuilder sb = new StringBuilder('\n' + scanner.next() + '\n');
        
        for(int i = 1; i < sb.length() - 1; i++){
          if(sb.getCharAt(i) == '?'){
            if(sb.getCharAt(i + 1) == 'D'){
              sb.append('P');
            }else{
              sb.append('D');
            }
          }
        }
        
        System.out.pritnln(sb);
      }
    }

Compiler output:
Main.java:9: error: cannot find symbol
          if(sb.getCharAt(i) == '?'){
               ^
  symbol:   method getCharAt(int)
  location: variable sb of type StringBuilder
Main.java:10: error: cannot find symbol
            if(sb.getCharAt(i + 1) == 'D'){
                 ^
  symbol:   method getCharAt(int)
  location: variable sb of type StringBuilder
Main.java:18: error: cannot find symbol
        System.out.pritnln(sb);
                  ^
  symbol:   method pritnln(StringBuilder)
  location: variable out of type PrintStream
3 errors
Language: C++

#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;
int main()
{string post;
 int a,i;
 char pp='?';
 cin>>post;
 a=post.size();
 for(i=1;i<a;i++)
 { if(i==1&&post.at(0)==pp)
 {
  post.at(0)=D; 
 }
   if(post.at(i)==pp&&post.at(i-1)=='P')
   {
     post.at(i)='D';
   }
   if(post.at(i)==pp&&post.at(i-1)=='D'){post.at(i)='P';}
 }
 cout<<post<<endl;
return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:14:14: error: 'D' was not declared in this scope
   14 |   post.at(0)=D;
      |              ^
Language: Java

import java.util.Scanner;

public class Main{
  public static void main(String... args){
    Scanner scanner = new Scanner(System.in);
    StringBuilder sb = new StringBuilder('\n' + scanner.next() + '\n');
    
    for(int i = 1; i < sb.length() - 1; i++){
      if(sb.getCharAt(i) == '?'){
        if(sb.getCharAt(i + 1) == 'D'){
          sb.append('P'):
        }else{
          sb.append('D');
        }
      }
    }
    
    System.out.pritnln(sb);
  }
}

Compiler output:
Main.java:11: error: ';' expected
          sb.append('P'):
                        ^
1 error
Language: C

#include <stdio.h>
 
int main(void) {
  char T[200000] A[200000];
  if(scanf("%s", T)==1);
  int i, frag;
  for (i=0; i<200000; i++) {
    if(T[i]=='P'||T[i]=='D') {
		A[i]=T[i];
    }
    else if (T[i]=='?') {
      A[i]='D';
    }
    else {
      break;
    }
  }
  printf("%s", A);
  return 0;
}

Compiler output:
main.c: In function 'main':
main.c:4:18: error: expected '=', ',', ';', 'asm' or '__attribute__' before 'A'
    4 |   char T[200000] A[200000];
      |                  ^
main.c:4:18: error: 'A' undeclared (first use in this function)
main.c:4:18: note: each undeclared identifier is reported only once for each function it appears in
main.c:5:18: error: 'T' undeclared (first use in this function)
    5 |   if(scanf("%s", T)==1);
      |                  ^
Language: C++

int main(){
  string t;
  cin>>t;
  for(int i=0;i<t.size()-1;i++){
    if(t[i]=='?'&&t[i+1]=='D'){
      t[i]='P';
    }
    else if(t[i-1]=='P'&&t[i]=='?'){
      t[i]='D';
    }
  }
  for(int i=0;i<t.size()-2;i++){
    if(t[i]=='?'&&t[i+1]=='?'&&t[i+2]=='P'){
      t[i]='P';
      t[i+1]='D';
    }
    else if(t[i]=='?'&&t[i+1]=='?'&&t[i+2]=='D'){
       t[i]='D';
       t[i+1]='P';
    }
  }
  for(int i=0;i<t.size();i++){
    if(t[i]=='?'){
        t[i]='D';
    }
  }
  cout<<t<<endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:2:3: error: 'string' was not declared in this scope
    2 |   string t;
      |   ^~~~~~
a.cc:3:3: error: 'cin' was not declared in this scope
    3 |   cin>>t;
      |   ^~~
a.cc:3:8: error: 't' was not declared in this scope
    3 |   cin>>t;
      |        ^
a.cc:27:3: error: 'cout' was not declared in this scope
   27 |   cout<<t<<endl;
      |   ^~~~
a.cc:27:12: error: 'endl' was not declared in this scope
   27 |   cout<<t<<endl;
      |            ^~~~
Language: Java

import java.io.BufferedReader;
import java.io.InputStreamReader;



@SuppressWarnings({"javadoc"})
public class Test02
{

  public static void main
  (
    String[] args
  )
  {
    BufferedReader in_stream;

    String        in_T;

    int  cnt;
    int  num;
    char before;
    char now;

    StringBuilder ans;

    try
    {
      in_stream = new BufferedReader(new InputStreamReader(System.in));

      /*----------------
       * 引数
       *----------------*/
      in_T = new String(in_stream.readLine());


      /*----------------
       * 計算
       *----------------*/
      num = in_T.length();
      ans = new StringBuilder();

      /* 1文字目 */
      before = in_T.charAt(0);
      if('?' == before)
      {
        before = 'P';
      }
      else
      {
        if( (1 == num) || ('P' == in_T.charAt(1)) )
        {
          before = 'D';
        }
      }
      ans.append(before);

      /* 2文字目以降 */
      for(cnt=1; cnt<num; cnt++)
      {
        now = in_T.charAt(cnt);

        if('?' == now)
        {
          if('P' == before)
          {
            before = 'D';
          }
          else
          {
            if( (cnt == (num-1)) || ('P' == in_T.charAt(cnt+1)) )
            {
              before = 'D';
            }
            else
            {
              before = 'P';
            }
          }
        }
        else
        {
          before = now;
        }

        ans.append(before);
      }

      System.out.println( ans.toString() );
    }
    catch(Exception e)
    {
      e.printStackTrace();
    }
  }



}





Compiler output:
Main.java:7: error: class Test02 is public, should be declared in a file named Test02.java
public class Test02
       ^
1 error
Language: C++

#include<bits/stdc++.h>
using namespace std;
int main(){
    long long a,b,c,d,e,f,i,g[101],h=999999999,j,clo1,clo2,ans,h1,h2,m1,m2,t,m,n,x=0,k,y=0,y1,y2,y3,y4,y5,y6,y7,y8,y9,y10,y11,y12,y13,y14,y15,y16,y17,y18,y19,y20,y21,y22,y23,y24,y25,x1;
    string s,s1="PD",s2='P',s3="DP",s4='D',s5,s6;
    cin>>s;
    if(s[x]=='P'){
        for(i=0;i<(s.size()-s.size()%2)/2;i++){
            cout<<s1;
        }
        if(s.size()%2==1){
            cout<<s2;
        }
    }
    if(s[x]=='D'){
        for(i=0;i<(s.size()-s.size()%2)/2;i++){
            cout<<s3;
        }
        if(s.size()%2==1){
            cout<<s4;
        }
    }
}

Compiler output:
a.cc: In function 'int main()':
a.cc:5:25: error: conversion from 'char' to non-scalar type 'std::string' {aka 'std::__cxx11::basic_string<char>'} requested
    5 |     string s,s1="PD",s2='P',s3="DP",s4='D',s5,s6;
      |                         ^~~
a.cc:5:40: error: conversion from 'char' to non-scalar type 'std::string' {aka 'std::__cxx11::basic_string<char>'} requested
    5 |     string s,s1="PD",s2='P',s3="DP",s4='D',s5,s6;
      |                                        ^~~
Language: C++

#include<bits/stdc++.h>
using namespace std;
int main(){
    long long a,b,c,d,e,f,i,g[101],h=999999999,j,clo1,clo2,ans,h1,h2,m1,m2,t,m,n,x=0,k,y=0,y1,y2,y3,y4,y5,y6,y7,y8,y9,y10,y11,y12,y13,y14,y15,y16,y17,y18,y19,y20,y21,y22,y23,y24,y25,x1;
    string s,s1="PD",s2='P',s3="DP",s4='D',s5,s6;
    cin>>s;
    if(s[x]=='P'){
        for(i=1;i<=(s.size()-s.size()%2)/2;i++){
            cout<<s1;
        }
        if(s.size()%2==1){
            cout<<s2;
        }
    }
    if(s[x]=='D'){
        for(i=1;i<=(s.size()-s.size()%2)/2;i++){
            cout<<s3;
        }
        if(s.size()%2==1){
            cout<<s4;
        }
    }
}

Compiler output:
a.cc: In function 'int main()':
a.cc:5:25: error: conversion from 'char' to non-scalar type 'std::string' {aka 'std::__cxx11::basic_string<char>'} requested
    5 |     string s,s1="PD",s2='P',s3="DP",s4='D',s5,s6;
      |                         ^~~
a.cc:5:40: error: conversion from 'char' to non-scalar type 'std::string' {aka 'std::__cxx11::basic_string<char>'} requested
    5 |     string s,s1="PD",s2='P',s3="DP",s4='D',s5,s6;
      |                                        ^~~
Language: C

#include<stdio.h>
#include<string.h>
int main(){
  char s[200000];
  scanf("%s",s);
  int a=strlen(s);
  int b;
  for(int i=a;i>=0;i--){
    if(strcmp(s[i],'P')==0){
      b=1;
    }
    else if(strcmp(s[i],'D')==0){
      b=0;
    }
    else{
      if(b==0){
        s[i]=="P";
      }
      if(b==1){
        s[i]=="D";
      }
    }
    printf("%s",s);
    return 0;
  }


Compiler output:
main.c: In function 'main':
main.c:9:16: error: passing argument 1 of 'strcmp' makes pointer from integer without a cast [-Wint-conversion]
    9 |     if(strcmp(s[i],'P')==0){
      |               ~^~~
      |                |
      |                char
In file included from main.c:2:
/usr/include/string.h:156:32: note: expected 'const char *' but argument is of type 'char'
  156 | extern int strcmp (const char *__s1, const char *__s2)
      |                    ~~~~~~~~~~~~^~~~
main.c:9:20: error: passing argument 2 of 'strcmp' makes pointer from integer without a cast [-Wint-conversion]
    9 |     if(strcmp(s[i],'P')==0){
      |                    ^~~
      |                    |
      |                    int
/usr/include/string.h:156:50: note: expected 'const char *' but argument is of type 'int'
  156 | extern int strcmp (const char *__s1, const char *__s2)
      |                                      ~~~~~~~~~~~~^~~~
main.c:12:21: error: passing argument 1 of 'strcmp' makes pointer from integer without a cast [-Wint-conversion]
   12 |     else if(strcmp(s[i],'D')==0){
      |                    ~^~~
      |                     |
      |                     char
/usr/include/string.h:156:32: note: expected 'const char *' but argument is of type 'char'
  156 | extern int strcmp (const char *__s1, const char *__s2)
      |                    ~~~~~~~~~~~~^~~~
main.c:12:25: error: passing argument 2 of 'strcmp' makes pointer from integer without a cast [-Wint-conversion]
   12 |     else if(strcmp(s[i],'D')==0){
      |                         ^~~
      |                         |
      |                         int
/usr/include/string.h:156:50: note: expected 'const char *' but argument is of type 'int'
  156 | extern int strcmp (const char *__s1, const char *__s2)
      |                                      ~~~~~~~~~~~~^~~~
main.c:17:13: warning: comparison between pointer and integer
   17 |         s[i]=="P";
      |             ^~
main.c:20:13: warning: comparison between pointer and integer
   20 |         s[i]=="D";
      |             ^~
main.c:25:3: error: expected declaration or statement at end of input
   25 |   }
      |   ^
Language: C++

#include <bits/stdc++.h>
using namespace std;

int main(){
  string T;
  cin >> T;
  vector<char> vec(0);
  for (int i = 0; i < T.size(); i++){
    vec.push_back(T.at(i));
  }
  
  for (int i = 0; i < vec.size(); i++){
   
    if (vec.at(i) == '?'){
      
      if (i = 0 || vec.at(i - 1) == '?'){
        
        if (vec.at(i + 1) == 'P'){
          vec.at(i) = 'D';
        }
        else if (vec.at(i + 1) == 'D'){
          vec.at(i) = 'P'
        }
        //?が連続するときの分岐まだ
      }
      else{
        
        if (vec.at(i - 1) == 'P'){
          vec.at(i) = 'D';
        }
        else if (vec.at(i - 1) == 'D'){
          vec.at(i) = 'P';
        }
      }
    }
  }

  for (int i = 0; i < vec.size(); i++){
    cout << vec.at(i);
  
    if (i == vec.size() - 1){
      cout << endl;
    }
  }
}
    
  
      
  

Compiler output:
a.cc: In function 'int main()':
a.cc:22:26: error: expected ';' before '}' token
   22 |           vec.at(i) = 'P'
      |                          ^
      |                          ;
   23 |         }
      |         ~
Language: Java

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		String T=sc.next();
		sc.close();
		String[] a = T.split("");
	
		for(int i=0;i<T.length();i++){
			if(a[i].equals("?")) {
					a[i]="D";
			}
		}
		for(int i=0;i<T.length();i++)
			System.out.print(a[i]);
	}
}


Compiler output:
Main.java:3: error: cannot find symbol
		Scanner sc = new Scanner(System.in);
		^
  symbol:   class Scanner
  location: class Main
Main.java:3: error: cannot find symbol
		Scanner sc = new Scanner(System.in);
		                 ^
  symbol:   class Scanner
  location: class Main
2 errors
Language: C++

#include<bits/stdc++.h>
using namespace std;
int main()
{
  string s; cin>>s;
  for(int i=0; i<s.size; i++)if(s[i]=='?')s[i]= 'D';
  cout<<s<<endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:6:20: error: invalid use of member function 'std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::size_type std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::size() const [with _CharT = char; _Traits = std::char_traits<char>; _Alloc = std::allocator<char>; size_type = long unsigned int]' (did you forget the '()' ?)
    6 |   for(int i=0; i<s.size; i++)if(s[i]=='?')s[i]= 'D';
      |                  ~~^~~~
      |                        ()
Language: C++

#include <bits/stdc++.h>
using namespace std;

int main() {
    string S;
    cin >> S;

    for(int i = 0; i < S.size(); i++){
        if(S[i] == "?"){
            S[i] = D;
        }
    }

    cout << S << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:9:17: error: ISO C++ forbids comparison between pointer and integer [-fpermissive]
    9 |         if(S[i] == "?"){
a.cc:10:20: error: 'D' was not declared in this scope
   10 |             S[i] = D;
      |                    ^
Language: C++

#include<bits/stdc++.h>
using namespace std;
using ll=long long int;
#define rep(i,n) for(int i=0;i<(n);i++)

int main(){
   string t;
   cin>>t;
   
   for(int i=0;i<t.size()-1;i++){
      
       
       if(t[i]=='?' && t[i+1]=='?') {
           t[i]='P';
           t[i+1]='D';
           i+=1;
       }

       
       else if(t[i]=='?' && t[i+1]=='P'){
           t[i]='D';
           
       }
       else if(t[i]=='?' && t[i+1]=='D'){
           t[i]='P';
       }
      
   cout<<t<<endl;
  

}

Compiler output:
a.cc: In function 'int main()':
a.cc:31:2: error: expected '}' at end of input
   31 | }
      |  ^
a.cc:6:11: note: to match this '{'
    6 | int main(){
      |           ^
Language: C++

#include<bits/stdc++.h>
using nampespace std;
int main()
{
  string s; cin>>s;
  for(int i=0; i<s.size; i++)if(s[i]=='?')s[i]= 'D';
  cout<<s<<endl;

Compiler output:
a.cc:2:7: error: expected nested-name-specifier before 'nampespace'
    2 | using nampespace std;
      |       ^~~~~~~~~~
a.cc: In function 'int main()':
a.cc:5:3: error: 'string' was not declared in this scope
    5 |   string s; cin>>s;
      |   ^~~~~~
a.cc:5:3: note: suggested alternatives:
In file included from /usr/include/c++/14/string:41,
                 from /usr/include/c++/14/bitset:52,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:52,
                 from a.cc:1:
/usr/include/c++/14/bits/stringfwd.h:77:33: note:   'std::string'
   77 |   typedef basic_string<char>    string;
      |                                 ^~~~~~
/usr/include/c++/14/string:76:11: note:   'std::pmr::string'
   76 |     using string    = basic_string<char>;
      |           ^~~~~~
a.cc:5:13: error: 'cin' was not declared in this scope; did you mean 'std::cin'?
    5 |   string s; cin>>s;
      |             ^~~
      |             std::cin
In file included from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:146:
/usr/include/c++/14/iostream:62:18: note: 'std::cin' declared here
   62 |   extern istream cin;           ///< Linked to standard input
      |                  ^~~
a.cc:5:18: error: 's' was not declared in this scope
    5 |   string s; cin>>s;
      |                  ^
a.cc:7:3: error: 'cout' was not declared in this scope; did you mean 'std::cout'?
    7 |   cout<<s<<endl;
      |   ^~~~
      |   std::cout
/usr/include/c++/14/iostream:63:18: note: 'std::cout' declared here
   63 |   extern ostream cout;          ///< Linked to standard output
      |                  ^~~~
a.cc:7:12: error: 'endl' was not declared in this scope; did you mean 'std::endl'?
    7 |   cout<<s<<endl;
      |            ^~~~
      |            std::endl
In file included from /usr/include/c++/14/istream:41,
                 from /usr/include/c++/14/sstream:40,
                 from /usr/include/c++/14/complex:45,
                 from /usr/include/c++/14/ccomplex:39,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:127:
/usr/include/c++/14/ostream:744:5: note: 'std::endl' declared here
  744 |     endl(basic_ostream<_CharT, _Traits>& __os)
      |     ^~~~
a.cc:7:17: error: expected '}' at end of input
    7 |   cout<<s<<endl;
      |                 ^
a.cc:4:1: note: to match this '{'
    4 | {
      | ^
Language: C++

int main()
{   
    string T;
    cin >> T;
    int n = T.size();
    for(int i = 0; i < n; i++){
        if(T[i] == '?'){
        if(i !=  n-1 && (T[i-1] == 'D' || T[i-1] == '?')){
            T[i] = 'P';
        }
        else T[i] = 'D';
        }
    }
    cout << T << endl;
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:3:5: error: 'string' was not declared in this scope
    3 |     string T;
      |     ^~~~~~
a.cc:4:5: error: 'cin' was not declared in this scope
    4 |     cin >> T;
      |     ^~~
a.cc:4:12: error: 'T' was not declared in this scope
    4 |     cin >> T;
      |            ^
a.cc:14:5: error: 'cout' was not declared in this scope
   14 |     cout << T << endl;
      |     ^~~~
a.cc:14:18: error: 'endl' was not declared in this scope
   14 |     cout << T << endl;
      |                  ^~~~
Language: C++

#include <bits/stdc++.h>
using namespace std;
 
int main() {
//すべてをDに変えてみる

    string T;
    cin >> T;
    int l;
    l=T.at();
    int x;
    x=0;

    for (int i = 0; i < l; i++) {
        if(T.at(i)=='?' || T.at(i)=='D' ){
            x=x+1;
        }
    }

    for (int i = 0; i < l-1; i++) {
        if(T.at(i)=='P' && T.at(i+1)=='D' ){
            x=x+1;
        }
    }

    for (int i = 0; i < l-1; i++) {
        if(T.at(i)=='P' && T.at(i+1)=='?' ){
            x=x+1;
        }
    }

     for (int i = 0; i < l; i++) {
        if(T.at(i)=='?' ){
            T.at(i)='D';
        }
    }
}


Compiler output:
a.cc: In function 'int main()':
a.cc:10:11: error: no matching function for call to 'std::__cxx11::basic_string<char>::at()'
   10 |     l=T.at();
      |       ~~~~^~
In file included from /usr/include/c++/14/string:54,
                 from /usr/include/c++/14/bitset:52,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:52,
                 from a.cc:1:
/usr/include/c++/14/bits/basic_string.h:1287:7: note: candidate: 'std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::const_reference std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::at(size_type) const [with _CharT = char; _Traits = std::char_traits<char>; _Alloc = std::allocator<char>; const_reference = const char&; size_type = long unsigned int]'
 1287 |       at(size_type __n) const
      |       ^~
/usr/include/c++/14/bits/basic_string.h:1287:7: note:   candidate expects 1 argument, 0 provided
/usr/include/c++/14/bits/basic_string.h:1309:7: note: candidate: 'std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::reference std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::at(size_type) [with _CharT = char; _Traits = std::char_traits<char>; _Alloc = std::allocator<char>; reference = char&; size_type = long unsigned int]'
 1309 |       at(size_type __n)
      |       ^~
/usr/include/c++/14/bits/basic_string.h:1309:7: note:   candidate expects 1 argument, 0 provided
Language: Java

import java.util.*;

public class Main {
    public static void main(String[] args) throws Exception {
        // Your code here!
        Scanner sc = new Scanner(System.in);
        String T = sc.next();
        String t[] = T.split("");
        int sum = 0;
        for(int i=0;i<t.length-1;i++)
        {
            char ch1 = t[i].charAt(0);
            if(ch == D){
                sum ++;
            }else{
                
            }
            char ch2 = t[i+1].charAt(0);
            if(ch1=='?'&&ch2=='?'){
                t[i] = "P";
                t[i+1] = "D";
                sum = 0;
            }else if(ch1=='?'&&ch2=='D'){
                if(sum>1){
                    t[i] = "D"
                    sum ++;
                }else{
                    t[i] = "P";
                }
            }else if(ch1=='?'&&ch2=='P'){
                t[i] = "D";
                sum = 0;
            }
        }
        for(String result : t){
            System.out.print(result);
        }
    }
}

Compiler output:
Main.java:25: error: ';' expected
                    t[i] = "D"
                              ^
1 error
Language: C

#include<stdio.h>
#include<string.h>
int main(){
  char s;
  scanf("%s",s);
  int a=strlen(s);
  int b;
  for(int i=a;i>=0;i--){
    if(strcmp(s[i],'P')==0){
      b=1;
    }
    else if(strcmp(s[i],'D')==0){
      b=0;
    }
    else{
      if(b==0){
        s[i]=="P";
      }
      if(b==1){
        s[i]=="D";
      }
    }
    printf("%s",s);
    return 0;
  }

Compiler output:
main.c: In function 'main':
main.c:6:16: error: passing argument 1 of 'strlen' makes pointer from integer without a cast [-Wint-conversion]
    6 |   int a=strlen(s);
      |                ^
      |                |
      |                char
In file included from main.c:2:
/usr/include/string.h:407:35: note: expected 'const char *' but argument is of type 'char'
  407 | extern size_t strlen (const char *__s)
      |                       ~~~~~~~~~~~~^~~
main.c:9:16: error: subscripted value is neither array nor pointer nor vector
    9 |     if(strcmp(s[i],'P')==0){
      |                ^
main.c:9:20: error: passing argument 2 of 'strcmp' makes pointer from integer without a cast [-Wint-conversion]
    9 |     if(strcmp(s[i],'P')==0){
      |                    ^~~
      |                    |
      |                    int
/usr/include/string.h:156:50: note: expected 'const char *' but argument is of type 'int'
  156 | extern int strcmp (const char *__s1, const char *__s2)
      |                                      ~~~~~~~~~~~~^~~~
main.c:12:21: error: subscripted value is neither array nor pointer nor vector
   12 |     else if(strcmp(s[i],'D')==0){
      |                     ^
main.c:12:25: error: passing argument 2 of 'strcmp' makes pointer from integer without a cast [-Wint-conversion]
   12 |     else if(strcmp(s[i],'D')==0){
      |                         ^~~
      |                         |
      |                         int
/usr/include/string.h:156:50: note: expected 'const char *' but argument is of type 'int'
  156 | extern int strcmp (const char *__s1, const char *__s2)
      |                                      ~~~~~~~~~~~~^~~~
main.c:17:10: error: subscripted value is neither array nor pointer nor vector
   17 |         s[i]=="P";
      |          ^
main.c:20:10: error: subscripted value is neither array nor pointer nor vector
   20 |         s[i]=="D";
      |          ^
main.c:25:3: error: expected declaration or statement at end of input
   25 |   }
      |   ^
Language: C++

#include<iostream>
#include<cstdio>
using namespace std;
int main()
{
	char a[20005];int i=0;
	gets(a);
	cout<<a[i++];
	for(;;)
	{
		if(a[i]=='\0')
		break;
		if(a[i]=='?')
		{
		if(a[i-1]=='P')
		a[i]='D';
		else
		a[i]='P';
		}
		cout<<a[i++];
	}
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:7:9: error: 'gets' was not declared in this scope; did you mean 'getw'?
    7 |         gets(a);
      |         ^~~~
      |         getw
Language: C++

#include<iostream>
using namespace std;
int main()
{
	char a[20005];int i=0;
	gets(a);
	cout<<a[0];
	i++;
	for(;;)
	{
		if(a[i]=='\0')
		break;
		if(a[i]=='?')
		{
		if(a[i-1]=='P')
		a[i]='D';
		else
		a[i]='P';
		}
		cout<<a[i++];
	}
}

Compiler output:
a.cc: In function 'int main()':
a.cc:6:9: error: 'gets' was not declared in this scope; did you mean 'getw'?
    6 |         gets(a);
      |         ^~~~
      |         getw
Language: Java

import java.util.Scanner;

public class Main{
  public static void main(String... args){
    Scanner scanner = new Scanner(System.in);
    
    String text = scanner.next();
    
    List<String> list = new ArrayList<>();
    replace(list, new StringBuilder(text), "", 0);
    
    int maxScoore = 0;
    int maxIndex = 0;
    int index = 0;
    
    for(String str : list){
      int score = 0;
      
      for(int i = 0; i < str.length; i++){
        if(str.charAt(i) == '?'){
          continue;
        }
        
        if(str.charAt(i) == 'D'){
          score++;
        }else{
          if(str.charAt(i + 1) == 'D'){
            score++;
          }
        }
      }
      
      if(score > maxScore){
        maxScore = score;
        maxIndex = index; 
      }
      
      index++;
    }
    
    return list.get(maxIndex);
  }
  
  private void replace(List<String> list, String text, String tmp, int index){
    for(int i = index; i < text.length; i++){
      tmp += text.charAt(i);
      
      if(text.charAt(i) == '?'){
        replace(list, new StringBuilder(text), tmp + 'P', i + 1);
        replace(list, new StringBuilder(text), tmp + 'D', i + 1);
      }
    }
    
    list.add(tmp + '\n');
  }
}

Compiler output:
Main.java:44: error: cannot find symbol
  private void replace(List<String> list, String text, String tmp, int index){
                       ^
  symbol:   class List
  location: class Main
Main.java:9: error: cannot find symbol
    List<String> list = new ArrayList<>();
    ^
  symbol:   class List
  location: class Main
Main.java:9: error: cannot find symbol
    List<String> list = new ArrayList<>();
                            ^
  symbol:   class ArrayList
  location: class Main
Main.java:19: error: cannot find symbol
      for(int i = 0; i < str.length; i++){
                            ^
  symbol:   variable length
  location: variable str of type String
Main.java:33: error: cannot find symbol
      if(score > maxScore){
                 ^
  symbol:   variable maxScore
  location: class Main
Main.java:34: error: cannot find symbol
        maxScore = score;
        ^
  symbol:   variable maxScore
  location: class Main
Main.java:41: error: incompatible types: unexpected return value
    return list.get(maxIndex);
                   ^
Main.java:45: error: cannot find symbol
    for(int i = index; i < text.length; i++){
                               ^
  symbol:   variable length
  location: variable text of type String
8 errors
Language: C++

#include <iostream>
#include <algorithm>
#include <vector>
#include <string>
#include <cmath>
#include <map>
#include <numeric>
#include <set>
#include <iomanip>
#include <functional>
#define FOR(i, a, n) for (long long i = (a); i < (n); i++)
#define REP(i, n) for(long long i = 0; i < (n); i++)
#define ALL(obj) (obj).begin(), (obj).end()
#define pb push_back
#define PI 3.14159265358979323846264338327950L
using namespace std;

typedef long long ll;
typedef long double ld;

long long myGcd(long long a, long long b)
{
	if (a % b == 0)return b;
	return myGcd(b, a % b);
}

int myGcd(int a, int b)
{
	if (a % b == 0)return b;
	return myGcd(b, a % b);
}

long long myLcm(long long a, long long b)
{
	return a * b / myGcd(a, b);
}

int myLcm(int a, int b)
{
	return a * b / myGcd(a, b);
}


int main()
{
	cin.tie(0);
	ios::sync_with_stdio(false);

	string T;
	cin >> T;

	REP(i, T.size())
	{
		if (T[i] == '?')
		{
			T[i] = 'D';
		}
	}
	int PD = 0;
	REP(i, T.size())
	{
		if (T[i] == 'D')
		{
			PD++;
		}
		else if (T[i] == 'P' && i + 1 < T.size())
		{
			if (T[i + 1] == 'D')
			{
				PD++;
			}
		}
	}

	cout << T << endl;

Compiler output:
a.cc: In function 'int main()':
a.cc:75:27: error: expected '}' at end of input
   75 |         cout << T << endl;
      |                           ^
a.cc:45:1: note: to match this '{'
   45 | {
      | ^
Language: C++

#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0; i<(n); i++)
#define repr(i,x,n) for(int i=x; i<(n); i++)
#define ALL(x) (x).begin(),(x).end()
#define INF 1e9
typedef long long ll;
using VI = vector<int>;
using VB = vector<bool>;
using VS = vector<string>;
using graph = vector<vector<int>>;

int main()
{
string t;
cin>>t;
int a;
a=t.length();


for (int  i = 1; i < a-1; i++)
{
if (t.at(i)=='?'&&t.at(i+1)=='D')
{
    t.at(i)='P';
}
else if (t.at(i)=='?'&&t.at(i+1)=='P')
{
    t.at(i)='D';
}
  else if (t.at(i-1)=='P'&& t.at(i)=='?'&&t.at(i+1)=='?'t.at(i+2)=='D')
  {
      t.at(i)='D';t.at(i+1)='P';
  }
  else if (t.at(i)=='?'&&t.at(i+1)=='?')
  {
      t.at(i)='P';t.at(i+1)='D';
  }
  
}
if (t.at(a-1)=='?')
{
   t.at(a-1)='D';
}

cout<<t<<endl;
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:31:54: error: unable to find character literal operator 'operator""t' with 'char' argument
   31 |   else if (t.at(i-1)=='P'&& t.at(i)=='?'&&t.at(i+1)=='?'t.at(i+2)=='D')
      |                                                      ^~~~
Language: Java

import java.util.Scanner;

public class Main{
  public static void main(String... args){
    Scanner scanner = new Scanner(System.in);
    
    String text = scanner.next();
    
    List<String> list = new ArrayList<>();
    replace(list, new StringBuilder(text), "", 0);
    
    int maxScoore = 0;
    int maxIndex = 0;
    int index = 0;
    
    for(String str : list){
      int score = 0;
      
      for(int i = 0; i < str.length; i++){
        if(str.charAt(i) == '?'){
          continue;
        }
        
        if(str.charAt(i) == 'D'){
          score++;
        }else{
          if(str.charAt(i + 1) == 'D'){
            score++;
          }
        }
      }
      
      if(score > maxScore){
        maxScore = score;
        maxIndex = index; 
      }
      
      index++;
    }
    
    return list.get(maxIndex)
  }
  
  private void replace(List<String> list, String text, String tmp, int index){
    for(int i = index; i < text.length){
      tmp += text.charAt(i);
      
      if(text.charAt(i) == '?'){
        replace(list, new StringBuilder(text), tmp + 'P', i + 1);
        replace(list, new StringBuilder(text), tmp + 'D', i + 1);
      }
    }
    
    list.add(tmp + '\n');
  }
}

Compiler output:
Main.java:41: error: ';' expected
    return list.get(maxIndex)
                             ^
Main.java:45: error: ';' expected
    for(int i = index; i < text.length){
                                      ^
2 errors
Language: C++

#include<bits/stdc++.h>
using namespace std;

int main() {
  string t;
  cin >> t;
  bool b = false;
  for(int i = 0; i < t.size(); i++) {
    if(t.at(i) == 'P') b = true;
    else if(t.at(i) == 'D') //b = false;
    else if(t.at(i) == '?') {
      if(b) {
        t.at(i) = 'D';
      } else {
        t.at(i) = 'P';
        b = true;
      }
    }
  }
  cout << t << endl;
} 



Compiler output:
a.cc: In function 'int main()':
a.cc:11:5: error: expected primary-expression before 'else'
   11 |     else if(t.at(i) == '?') {
      |     ^~~~
Language: Java

public class Main {

	public static void main(String[] args) {
		// TODO 自動生成されたメソッド・スタブ
		Scanner sc = new Scanner(System.in);
		String t = sc.nextLine();
		StringBuilder t1 = new StringBuilder(t);
		char ch = '?';
		int i = 0;
		int pos = t.indexOf(ch);

		for(i=0; pos>=0; i++) {
 		if(t1.charAt(pos-1)=='D'){
 			t1.setCharAt(pos,'P');
 		}else {
 			t1.setCharAt(pos,'D');
 		}
			pos = t.indexOf(ch,pos+1);
		}
		System.out.println(t1);
	}

}


Compiler output:
Main.java:5: error: cannot find symbol
		Scanner sc = new Scanner(System.in);
		^
  symbol:   class Scanner
  location: class Main
Main.java:5: error: cannot find symbol
		Scanner sc = new Scanner(System.in);
		                 ^
  symbol:   class Scanner
  location: class Main
2 errors
Language: C

#include<stdio.h>
#include<string.h>
int main(void){
  int n = 0;
  	char s[100000];
  	scanf("%s",s);
  	n = strlen(s);
  	for(int i = 1 i < n; i++){
		if(s[i] == '?' && s[i + 1] == 'P'){
			s[i] == 'D';
        }else if(s[i] == '?' && s[i + 1] == 'D'){
			s[i] == 'P';
        }
    }
      printf("%s\n",s);
      return 0;
}

Compiler output:
main.c: In function 'main':
main.c:8:23: error: expected ',' or ';' before 'i'
    8 |         for(int i = 1 i < n; i++){
      |                       ^
main.c:8:33: error: expected ';' before ')' token
    8 |         for(int i = 1 i < n; i++){
      |                                 ^
      |                                 ;
Language: C++

#include <bits/stdc++.h>
using namespace std;
int main(){
vector <string>t ;
  int x=t.size();
  for (int i=0;i<x;i++)
  {cin>>t.at(i);}
 for (int i=0;ix-1;i++){
  if (t.at(i+1)=="D"&&t.at(i)=="?"){
    t.at(i)="P";}
  else if(t.at(i)=="?"){t.at(i)="D";
    }
 }
for(int i=0;i<x;i++){
  cout<<t.at(i);}
  cout<<endl;}

Compiler output:
a.cc: In function 'int main()':
a.cc:8:15: error: 'ix' was not declared in this scope; did you mean 'i'?
    8 |  for (int i=0;ix-1;i++){
      |               ^~
      |               i
Language: C++

#include <bits/stdc++.h>
using namespace std;
int main() { 
  string t;
  cin>>t ;
  for(int i=0;i<t.size();i++){
    if(i!=0&&t.at(i-1)=='P'&&t.at(i)=='?'){
      t.at(i)='D';
    }
    if(i!=0&&t.at(i-1)=='D'&&t.at(i)=='?'){
      t.at(i)='P';
    }
    if(t.at(1)=='?'&&t.at(2)=='?'){
      t.at(i)='P';
    }
  }
      


Compiler output:
a.cc: In function 'int main()':
a.cc:16:4: error: expected '}' at end of input
   16 |   }
      |    ^
a.cc:3:12: note: to match this '{'
    3 | int main() {
      |            ^
Language: C++

#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0; i<(n); i++)
#define repr(i,x,n) for(int i=x; i<(n); i++)
#define ALL(x) (x).begin(),(x).end()
#define INF 1e9
typedef long long ll;
using VI = vector<int>;
using VB = vector<bool>;
using VS = vector<string>;
using graph = vector<vector<int>>;

int main()
{
string t;
cin>>t;
int a;
a=t.length();


for (int  i = 1; i < a-1; i++)
{
if (t.at(i)=='?'&&t.at(i+1)='D')
{
    t.at(i)='P';
}
else if (t.at(i)=='?'&&t.at(i+1)=='P')
{
    t.at(i)='D';
}
  else if (t.at(i)=='?'&&t.at(i+1)=='?')
  {
      t.at(i)='P';t.at(i+1)=='D';
  }
  
}
if (t.at(a-1)=='?')
{
   t.at(a-1)='D';
}

cout<<t<<endl;
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:23:17: error: lvalue required as left operand of assignment
   23 | if (t.at(i)=='?'&&t.at(i+1)='D')
      |     ~~~~~~~~~~~~^~~~~~~~~~~
Language: C++

#include <bits/stdc++.h>
using namespace std;
int main(){
vector <string>t ;
  for (int i=0;i<t.size();i++)
  {cin>>t.at(i);}
 for (int i=0;i<t.size()-1;i++){
  if (t.at(i+1)=="D"&&t.at(i)=="?"){
    t.at(i)="P";}
  else if(t.at(i)=="?"){t.at(i)="D"
    }
 }
for(int i=0;i<t.size();i++){
  cout<<t.at(i);}
  cout<<endl;}

Compiler output:
a.cc: In function 'int main()':
a.cc:10:36: error: expected ';' before '}' token
   10 |   else if(t.at(i)=="?"){t.at(i)="D"
      |                                    ^
      |                                    ;
   11 |     }
      |     ~