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

#include <iostream>
#include <string>
#include <cstdio>

using namespace std;

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

    int t_length = T.size(), s_length = S.size();
    int match_made;

    for(int i = s_length - 1; i - t_length >= 0; i--)
    {
        match_made = true;
        for(int j = t_length - 1, k = 0; j >= 0; j--, k++)
        {
            //printf("i = %d, j = %d\n", i, j);
            if(S[i - k] != T[j] && S[i - k] != '?')
            {   //printf("%c %c\n", S[i - k], T[j]);
                match_made = false;
                break;
            }
        }

        if(match_made)
        {
            for(int j = t_length - 1, k = 0; j >= 0; j--, k++)
            {
                S[i - k] = T[j];
            }
            break;
        }
    }

    for(int i = 0; i < s_length; i++)
        if(S[i] == '?')
            S[i] = 'a';

    if(!match_made)
        cout << "UNRESTORABLE\n";
    else
        cout << S;
    return 0;
}
v

Compiler output:
a.cc:48:1: error: 'v' does not name a type
   48 | v
      | ^
Language: C

#include <stdio.h>
#include <string.h>
int main () {
	char s[51],t[51];
	scanf("%s",s);
	scanf("%s",t);
	int slen = strlen(s),tlen = strlen(t),sp = slen;
	for(int i = slen - tlen;i >= 0;i--) {
		int check = 0;
		for(int j = 0;j < tlen;j++) {
			if(s[i + j] != t[j] && s[i+j] != '?') {
				check = 1;
				break;
			}
		}
		if(check == 0) {
			sp = i;
			break;
		}
	}
	if(sp ==slen) printf("UNRESTORABLE\n");
	else {
		for(int k = 0;k < slen;k++) {
			if(s[k] == '?') {
				if(k < sp) s[k] == a;
				else s[k] == t[k - sp];
			}
		}
		printf("%s\n",s);
	}
	return 0;
}

Compiler output:
main.c: In function 'main':
main.c:25:52: error: 'a' undeclared (first use in this function)
   25 |                                 if(k < sp) s[k] == a;
      |                                                    ^
main.c:25:52: note: each undeclared identifier is reported only once for each function it appears in
Language: C++

#include <bits/stdc++.h>
using namespace std;
const int INF=0x3f3f3f3f;
int main()
{
    char a[55],b[55];
    scanf("%s%s",&a,&b);
    int l1=strlen(a);
    int l2=strlen(b);
    if(l1<l2) printf("UNRESTORABLE\n");
    int m=0,l=0,j=0;
    for(int i=0;i<l1;i++)
    {
        if(a[i]=='?'||a[i]==b[l])
            l++;
        else
        {
            i-=l;
            l=0;
        }
        if(l==l2)
        {
            for(i=i-l+1;j<l2;i++,j++)
            {
                a[i]=b[j];
            }
            for(int i=0;i<l1;i++)
            {
                if(a[i]=='?') a[i]=a;
                printf("%c",a[i]);
            }
            printf("\n");
            return 0;
        }
    }
    printf("UNRESTORABLE\n");
    return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:29:36: error: invalid conversion from 'char*' to 'char' [-fpermissive]
   29 |                 if(a[i]=='?') a[i]=a;
      |                                    ^
      |                                    |
      |                                    char*
Language: C++

Sd = list(input())
T = list(input())

find = False
for i in range(len(Sd) - len(T) + 1)[::-1]:
    flag = True
    for j in range(len(T)):
        if Sd[i + j] != '?' and Sd[i + j] != T[j]:
            flag = False
            break
    if flag:
        find = True
        for j in range(len(T)):
            Sd[i + j] = T[j]
        break

if find:
    for i in range(len(Sd)):
        if Sd[i] == '?':
            print('a', end='')
        else:
            print(Sd[i], end='')
    print()
else:
    print('UNRESTORABLE')

Compiler output:
a.cc:20:28: error: empty character constant
   20 |             print('a', end='')
      |                            ^~
a.cc:22:30: error: empty character constant
   22 |             print(Sd[i], end='')
      |                              ^~
a.cc:25:11: warning: multi-character literal with 12 characters exceeds 'int' size of 4 bytes
   25 |     print('UNRESTORABLE')
      |           ^~~~~~~~~~~~~~
a.cc:1:1: error: 'Sd' does not name a type
    1 | Sd = list(input())
      | ^~
Language: C++

#include <bits/stdc++.h>
using namespace std;
const int INF=0x3f3f3f3f;
int main()
{
    char a[55],b[55];
    scanf("%s%s",&a,&b);
    int l1=strlen(a);
    int l2=strlen(b);
    if(l1<l2) printf("UNRESTORABLE\n");
    int m=0,l=0;
    for(int i=0;i<l1;i++)
    {
        if(a[i]=='?'||a[i]==b[l])
            l++;
        else
        {
            i-=l;
            l=0;
        }
        if(l==l2)
        {
            for(int i=i-l+1,j=0;j<l2;i++)
            {
                a[i]=b[j];
            }
            for(int i=0;i<l1;i++)
            {
                if(a[i]=='?') a[i]=a;
                printf("%c",a[i]);
            }
            printf("\n");
            return 0;
        }
    }
    printf("UNRESTORABLE\n");
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:29:36: error: invalid conversion from 'char*' to 'char' [-fpermissive]
   29 |                 if(a[i]=='?') a[i]=a;
      |                                    ^
      |                                    |
      |                                    char*
Language: C++

#include <vector>
#include <iostream>
#include <utility>
#include <algorithm>
#include <string>
#include <deque>
#include <queue>
#include <tuple>
#include <queue>
#include <functional>
#include <cmath>
#include <iomanip>
#include <map>
#include <set>
#include <numeric>
#include <unordered_map>
#include <unordered_set>
#include <complex>
#include <iterator>
#include <array>
#include <memory>
#include <stack>
#define vi vector<int>
#define vvi vector<vector<int> >
#define ll long long int
#define vl vector<ll>
#define vvl vector<vector<ll>>
#define vb vector<bool>
#define vc vector<char>
#define vs vector<string>
#define ld long double
#define INF 1e9
#define EPS 0.0000000001
#define rep(i,n) for(int i=0;i<n;i++)
#define loop(i,s,n) for(int i=s;i<n;i++)
#define all(in) in.begin(), in.end()
template<class T, class S> void cmin(T &a, const S &b) { if (a > b)a = b; }
template<class T, class S> void cmax(T &a, const S &b) { if (a < b)a = b; }
#define MAX 9999999
using namespace std;
typedef pair<int, int> pii;
typedef pair<double,double>pdd;
typedef pair<ll,ll>pll;
int main(){
    string s; cin>>s;
    string t; cin>>t;
    bool come=false;
    int index=0;
    for(int i=0;i<s.size();i++){
        bool flag=true;
        int temp=i;
        for(int j=0;j<t.size();j++){
            if(temp+j>(int)s.size()-1){flag=false;break;}
            if(s[temp+j]=='?')continue;
            else if(s[temp+j]==t[j])continue;
            else flag=false;
        }
        
        if(!flag)continue;
        cmax(index,i);
        come=true;
    }
    if(come){
        for(int j=0;j<s.size();j++){
            if(j==index){
                cout<<t;
                rep(i,(int)t.size()-1)j++;å
            }else if(s[j]=='?')cout<<"a";
            else
                cout<<s[j];
        }
        cout<<endl;
        return 0;
    }
    cout<<"UNRESTORABLE"<<endl;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:67:43: error: '\U000000e5' was not declared in this scope
   67 |                 rep(i,(int)t.size()-1)j++;å
      |                                           ^
Language: C++

#include <cstdio>
#include <string>
using namespace std;

int main() {
	char s[51], t[51];
	bool flag,restorable=false;
	scanf("%50s %50s", s, t);
	int i, j, slen = strlen(s), tlen = strlen(t);
	for (i = slen - tlen; i >= 0;i--) {
		flag = true;
		for (j = 0; j < tlen; j++) {
			flag = flag && ((s[i + j] == t[j]) || (s[i+j] == '?'));
		}
		if (flag) {
			restorable = true;
			for (j = 0; j < tlen; j++) {
				s[i + j] = t[j];
			}
			for (j = 0; j < slen; j++) {
				if (s[j] == '?') {
					s[j] = 'a';
				}
			}
		}
	}
	if (restorable) {
		printf("%s", s);
	}
	else {
		printf("UNRESTORABLE");
	}
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:9:26: error: 'strlen' was not declared in this scope
    9 |         int i, j, slen = strlen(s), tlen = strlen(t);
      |                          ^~~~~~
a.cc:3:1: note: 'strlen' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
    2 | #include <string>
  +++ |+#include <cstring>
    3 | using namespace std;
a.cc:10:25: error: 'tlen' was not declared in this scope; did you mean 'slen'?
   10 |         for (i = slen - tlen; i >= 0;i--) {
      |                         ^~~~
      |                         slen
Language: C++

#include<iostream>
#include<string>
#include<vector>
using namespace std;

string s0, t;
bool t_bool = false;

int main(){
    cin >> s0 >> t;
    vector<string> s;
    for(int i = 0; i < s0.length(); i++){
        for(int k = 0; k < t.length(); k++){
            if(s0[i] == t[k]){
                string buf = s0;
                for(int j = 0; j < t.length(); j++){
                    if(s0[i - k + j] == '?' || s0[i - k + j] == t[j]){
                        buf[i - k + j] = t[j];
                        if(j == t.length() - 1){
                            t_bool = true;
                            s.push_back(buf);
                        }
                    }else{
                        break;
                    }
                }  
            }
        }
    }
    if(t_bool){
        sort(s.begin(), s.end());
        for(int i = 0; i < s0.length(); i++){
            if(s[0][i] == '?'){
                s[0][i] = 'a';
            } 
        }
        cout << s[0] << endl;
    }else{
        cout << "UNRESTORABLE" << endl;
    }
}

Compiler output:
a.cc: In function 'int main()':
a.cc:31:9: error: 'sort' was not declared in this scope; did you mean 'short'?
   31 |         sort(s.begin(), s.end());
      |         ^~~~
      |         short
Language: Java

#include <string>
#include <cmath>
#include <cstdio>
#include <vector>
#include <algorithm>
#include <iostream>
#include <queue>
#include <tuple>
#include <functional>
#include <set>

using namespace std;

string s;
string t;

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

	bool f = false;
	string ans = "";
	for (int i = 0; i < s.length(); ++i) {
		bool g = true;
		for (int j = 0; j < t.length(); ++j) {
			if (i + j >= s.length()) {
				g = false;
			}
			g = g && (s[i + j] == '?' || s[i + j] == t[j]);
		}
		if (g) {
			string c = s;
			for (int j = 0; j < s.length(); ++j) {
				if (c[j] == '?')
					c[j] = 'a';
			}
			for (int j = 0; j < t.length(); ++j) {
				c[i + j] = t[j];
			}
			if (ans == "" || ans > c) {
				ans = c;
			}
		}
	}
	if (ans == "")
	{
		cout << "UNRESTORABLE" << endl;
	}
	else {
		cout << ans << endl;
	}
}

Compiler output:
Main.java:1: error: illegal character: '#'
#include <string>
^
Main.java:2: error: illegal character: '#'
#include <cmath>
^
Main.java:3: error: illegal character: '#'
#include <cstdio>
^
Main.java:4: error: illegal character: '#'
#include <vector>
^
Main.java:5: error: illegal character: '#'
#include <algorithm>
^
Main.java:6: error: illegal character: '#'
#include <iostream>
^
Main.java:7: error: illegal character: '#'
#include <queue>
^
Main.java:8: error: illegal character: '#'
#include <tuple>
^
Main.java:9: error: illegal character: '#'
#include <functional>
^
Main.java:10: error: illegal character: '#'
#include <set>
^
Main.java:14: error: unnamed classes are a preview feature and are disabled by default.
string s;
^
  (use --enable-preview to enable unnamed classes)
Main.java:19: error: not a statement
	cin >> s;
	    ^
Main.java:20: error: not a statement
	cin >> t;
	    ^
Main.java:48: error: not a statement
		cout << "UNRESTORABLE" << endl;
		                       ^
Main.java:51: error: not a statement
		cout << ans << endl;
		            ^
15 errors
Language: C++

#include <iostream>
#include <cmath>
#include <vector>
#include <cstdlib>
#include <algorithm>

#include <stdio.h>
#include <stdlib.h>

using namespace std;

int main(int argc, char *argv[]){
  string S, T;
  cin >> S;
  cin >> T;
  int t = 0;
  int flag = -1;
  for(int i = 0; i < S.length()-T.length()+1; i++){
    if(S[i] == T[0] || S[i] == '?'){
      int ii = i+1;

      for(t = 1; t < T.length(); t++, ii++){
        if(! (S[ii] == T[t] || S[ii] == '?')){
          break;
        }else if(t == T.length()-1){
          flag = 1;
        }
      }

      if(flag == 1){
        for(int j = 0; j < T.length(); j++){
          S[i+j] = T[j];
        }
      }

    }
  } // End of for

  if(flag == 1){
    for(int i = 0; i < S.length(); i++){
      if(S[i] == '?'){
        S[i] = 'a';
      }
    }
    cout << S << endl;
  }else{
    cout << "UNRESTORABLE" << endl
  }


  return 0;
}


Compiler output:
a.cc: In function 'int main(int, char**)':
a.cc:47:35: error: expected ';' before '}' token
   47 |     cout << "UNRESTORABLE" << endl
      |                                   ^
      |                                   ;
   48 |   }
      |   ~
Language: C++

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

#define fasten(v) v.reserve(v.size())
#define wait() system("pause")
#define clock_starts() clock_t begin = clock()
#define clock_ends() clock_t end = clock()
#define print_running_time() double elapsed_secs = double(end - begin) / CLOCKS_PER_SEC; \
printf("Elapsed Time : %.10f second(s)\n", elapsed_secs)
#define read(s) freopen(s, "r", stdin)
#define write(s) freopen(s, "w", stdout)
#define debug(s) cout<< #s <<" = "<< s <<endl
#define all(v) v.begin(), v.end()
#define printBinary(n) cout << #n << " = " << bitset<64>(n) << endl
typedef priority_queue<int, vector<int>, greater<int> > min_pq;

#define UNASSIGNED 0

struct cell {
	bool single_nki;
	int one, two;
	cell() {
		single_nki = false;
		one = two = 0;
	}
	cell(string s) {
		one = 0, two = 0;
		vector<string> temp;
		for(int i=0; i<s.size(); i++) {
			if(s[i] == '/') {
				s[i] = ' ';
			}
		}
		stringstream is(s);
		string ss;
		while(is >> ss) {
			temp.push_back(ss);
		}
		if(temp.size() == 1) single_nki = true;
		else single_nki = false;
		if(single_nki) {
			if(temp[0] == "-") one = UNASSIGNED;
			else one = temp[0][0]-'0';
		}
		else {
			if(temp[0] == "-") one = UNASSIGNED;
			else one = temp[0][0]-'0';
			if(temp[1] == "-") two = UNASSIGNED;
			else two = temp[1][0]-'0';
		}
	}
	void print() {
		cout<<one<<' '<<two<<endl;
	}
};

cell a[maxn][maxn];

int solve() {
	int row, col;
	if(!funloc(row, col)) return 1;

}

int32_t main() {
  	for(int i=1; i<=6; i++) {
  		for(int j=1; j<=6; j++) {
  			string ss; cin>>ss;
  			a[i][j] = cell(ss);
  		}
  	}
  	int ret = solve();
    wait();
    return 0;
}*/
#include <bits/stdc++.h>
using namespace std;

#define wait() system("pause")

const int maxn = 110;

int n, m;
char s[1000], t[1000];

int check(int k) {
	for(int i=k; i-k<m; i++) {
		if(s[i] != t[i-k+1] and s[i] != '?') return 0;
	}
	return 1;
}

int prep() {
	for(int i=n-m+1; i>=1; i--) {
		if(check(i)) {
			for(int j=i, c=1; c<=m; c++, j++) {
				s[j] = t[c];
			}
			return 1;
		}
	}
	return 0;
}

int32_t main() {
	//getchar();
	gets(s+1);
	gets(t+1);
	n = strlen(s+1);
	m = strlen(t+1);
	if(prep()) {
		for(int i=1; i<=n; i++) {
			if(s[i] == '?') cout<<'a';
			else cout<<s[i];
		}
		cout<<endl;
	}
	else {
		cout<<"UNRESTORABLE"<<endl;
	}
	//wait();
    return 0;
}

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

#include <iostream>
#include <vector>
using namespace std;

int main() {
    string s,b;
    string tmp;
    vector<string> lst;
    int ind = -1;
    cin>>s>>b;
    if (s.size() >= b.size()) {
        for (int i=0;i<s.size();i++) {
            bool ok = 1;
            for (int j=0;j<b.size();j++) {
                if (s[i+j] != b[j] && s[i+j] != '?') {
                    ok = 0;
                    break;
                }
            }
            if (ok) {
                tmp = s;
                for (int k=0;k<tmp.size();k++) {
                    if (tmp[k] == '?') tmp[k] = 'a';
                    if (k == i) {
                        for (int l=0;l<b.size();l++) {
                            tmp[k] = b[l];
                            k++;
                        }
                        k--;
                    }
                }
                lst.push_back(tmp);
            }
        }
        if ((int) lst.size() == 0) {
            cout<<"UNRESTORABLE"<<endl;
        } else {
            sort(lst.begin(), lst.end());
            cout<<lst[0]<<endl;
        }
    } else {
        cout<<"UNRESTORABLE"<<endl;
    }
}

Compiler output:
a.cc: In function 'int main()':
a.cc:38:13: error: 'sort' was not declared in this scope; did you mean 'short'?
   38 |             sort(lst.begin(), lst.end());
      |             ^~~~
      |             short
Language: C

#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>


int main(void){
  char s2[50], t[50];
  int ls2, lt, i, j, k;
  scanf("%s",s2);
  scanf("%s",t);
  ls2 = strlen(s2);
  lt = strlen(t);
  for(i=ls2-lt;i>=0;i--){
    for(j=0;j<l;j++) if(t[j]!=s2[i+j]) break;
    if(j==l) break;
  }
  for(k=0;k<ls2;k++){
    if(i<=k && k<i+lt) printf("%c",t[k-i]);
    else if(s2[k]=='?') printf("a");
    else printf("%c",s2[k]);
  }
  printf("\n");

  return 0;
}


Compiler output:
main.c: In function 'main':
main.c:15:15: error: 'l' undeclared (first use in this function)
   15 |     for(j=0;j<l;j++) if(t[j]!=s2[i+j]) break;
      |               ^
main.c:15:15: note: each undeclared identifier is reported only once for each function it appears in
Language: C++

#define _USE_MATH_DEFINES
#include <iostream>
#include <string>
#include <list>
#include <vector>
#include <queue>
#include <algorithm>
#include <climits>
#include <cstring>
#include <cmath>
#include <stack>
#include <iomanip>
#include <tuple>
#include <functional>

#define int long long
#define CONTAINS(v,n) (find((v).begin(), (v).end(), (n)) != (v).end())
#define SORT(v) sort((v).begin(), (v).end())
#define RSORT(v) sort((v).rbegin(), (v).rend())
#define ARY_SORT(a, size) sort((a), (a)+(size))
#define MAX(a,b) (((a) > (b)) ? (a) : (b))
#define MIN(a,b) (((a) < (b)) ? (a) : (b))
#define REMOVE(v,a) (v.erase(remove((v).begin(), (v).end(), (a)), (v).end()))
#define REVERSE(v) (reverse((v).begin(), (v).end()))
#define LOWER_BOUND(v,a) (lower_bound((v).begin(), (v).end(), (a)))
#define UPPER_BOUND(v,a) (upper_bound((v).begin(), (v).end(), (a)))
#define REP(i, n) for (int (i) = 0; (i) < (n); (i)++)
using namespace std;

signed main()
{
	char S[51];
	char T[51];
	cin >> S >> T;

	int slen = strlen(S);
	int tlen = strlen(T);
	for (int i = slen - tlen; i >= 0; i--)
	{
		char a[51];
		strcpy_s(a, S);
		bool restorable = true;
		for (int j = 0; j < tlen; j++)
		{
			if (a[i + j] == '?')
			{
				a[i + j] = T[j];
			}
			else if (a[i + j] != T[j])
			{
				restorable = false;
			}
		}

		if (!restorable) continue;

		for (int j = 0; j < slen; j++)
		{
			if (a[j] == '?')
			{
				a[j] = 'a';
			}
		}

		cout << a << endl;
		return 0;
	}

	cout << "UNRESTORABLE" << endl;
}



Compiler output:
a.cc: In function 'int main()':
a.cc:41:17: error: 'strcpy_s' was not declared in this scope; did you mean 'strcpy'?
   41 |                 strcpy_s(a, S);
      |                 ^~~~~~~~
      |                 strcpy
Language: C++

#include <cstdio>
#include <cstring>
using namespace std;
int n,nr,i,j;
char s[54],t[54];
bool ok;
int main()
{
    gets(s);
    gets(t);
    n=strlen(s);
    nr=strlen(t);
    ok=false;
    for (i=(n-nr);i>=0;i--)
    {
        ok=true;
        for (j=i;j<=(i+nr-1);j++)
        {
            if (s[j]!='?' && s[j]!=t[j-i])
            {
                ok=false;
                break;
            }
        }
        if (ok==true)
            break;
    }
    if (ok==true)
    {
        for (j=i;j<=(i+nr-1);j++)
            s[j]=t[j-i];
        for (j=0;j<=(n-1);j++)
        {
            if (s[j]=='?')
                s[j]='a';
        }
        for (j=0;j<=(n-1);j++)
            printf ("%c", s[j]);
        printf ("\n");
    }
    else
        printf ("UNRESTORABLE\n");
    return 0;
}


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

#include <iostream>
#include <string>

using namespace std;

int main(){
	string s, t;
	cin >> s >> t;
	
	bool didx = false;
	for(int i = 0;i <= s.size()-t.size();i++){
		if(s[i] == '?' || s[i] == t[0]){
			bool did = true;
			
			string ans = s.copy();
			for(int j = 0;j < t.size();j++){
				if(!(s[i+j] == '?' || s[i+j] == t[j])){
					did = false;
				}else{
					ans[i+j] = t[j];
				}
			}
			
			if(did){
				for(int j = 0;j < ans.size();j++){
					if(ans[j] == '?'){
						ans[j] = 'a';
					}
				}
				
				didx = true;
				cout << ans << endl;
				break;
			}
		}
	}
	
	if(!didx) cout << "UNRESTORABLE" << endl;
	
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:15:44: error: no matching function for call to 'std::__cxx11::basic_string<char>::copy()'
   15 |                         string ans = s.copy();
      |                                      ~~~~~~^~
In file included from /usr/include/c++/14/string:54,
                 from /usr/include/c++/14/bits/locale_classes.h:40,
                 from /usr/include/c++/14/bits/ios_base.h:41,
                 from /usr/include/c++/14/ios:44,
                 from /usr/include/c++/14/ostream:40,
                 from /usr/include/c++/14/iostream:41,
                 from a.cc:1:
/usr/include/c++/14/bits/basic_string.h:2618:7: note: candidate: 'std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::size_type std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::copy(_CharT*, size_type, size_type) const [with _CharT = char; _Traits = std::char_traits<char>; _Alloc = std::allocator<char>; size_type = long unsigned int]'
 2618 |       copy(_CharT* __s, size_type __n, size_type __pos = 0) const;
      |       ^~~~
/usr/include/c++/14/bits/basic_string.h:2618:7: note:   candidate expects 3 arguments, 0 provided
Language: C++

#include <iostream>

using namespace std;

int main(){
	string s, t;
	cin >> s >> t;
	
	bool didx = false;
	for(int i = 0;i <= s.size()-t.size();i++){
		if(s[i] == '?' || s[i] == t[0]){
			bool did = true;
			
			string ans = s.copy();
			for(int j = 0;j < t.size();j++){
				if(!(s[i+j] == '?' || s[i+j] == t[j])){
					did = false;
				}else{
					ans[i+j] = t[j];
				}
			}
			
			if(did){
				for(int j = 0;j < ans.size();j++){
					if(ans[j] == '?'){
						ans[j] = 'a';
					}
				}
				
				didx = true;
				cout << ans << endl;
				break;
			}
		}
	}
	
	if(!didx) cout << "UNRESTORABLE" << endl;
	
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:14:44: error: no matching function for call to 'std::__cxx11::basic_string<char>::copy()'
   14 |                         string ans = s.copy();
      |                                      ~~~~~~^~
In file included from /usr/include/c++/14/string:54,
                 from /usr/include/c++/14/bits/locale_classes.h:40,
                 from /usr/include/c++/14/bits/ios_base.h:41,
                 from /usr/include/c++/14/ios:44,
                 from /usr/include/c++/14/ostream:40,
                 from /usr/include/c++/14/iostream:41,
                 from a.cc:1:
/usr/include/c++/14/bits/basic_string.h:2618:7: note: candidate: 'std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::size_type std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::copy(_CharT*, size_type, size_type) const [with _CharT = char; _Traits = std::char_traits<char>; _Alloc = std::allocator<char>; size_type = long unsigned int]'
 2618 |       copy(_CharT* __s, size_type __n, size_type __pos = 0) const;
      |       ^~~~
/usr/include/c++/14/bits/basic_string.h:2618:7: note:   candidate expects 3 arguments, 0 provided
Language: C++

#include <bits/stdc++.h>

using namespace std;

typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;

typedef int _loop_int;
#define REP(i,n) for(_loop_int i=0;i<(_loop_int)(n);++i)
#define FOR(i,a,b) for(_loop_int i=(_loop_int)(a);i<(_loop_int)(b);++i)
#define FORR(i,a,b) for(_loop_int i=(_loop_int)(b)-1;i>=(_loop_int)(a);--i)

#define DEBUG(x) cout<<#x<<": "<<x<<endl
#define DEBUG_VEC(v) cout<<#v<<":";REP(i,v.size())cout<<" "<<v[i];cout<<endl
#define ALL(a) (a).begin(),(a).end()

#define CHMIN(a,b) a=min((a),(b))
#define CHMAX(a,b) a=max((a),(b))

// mod
const ll MOD = 1000000007ll;
#define FIX(a) ((a)%MOD+MOD)%MOD

// floating
typedef double Real;
const Real EPS = 1e-11;
#define EQ0(x) (abs(x)<EPS)
#define EQ(a,b) (abs(a-b)<EPS)
typedef complex<Real> P;

int main(){
  string s,t;
  cin>>s>>t;
  int n = s.size();
  int m = t.size();
  string wo = string(1,'z'+1);
  string ans = wo;
  REP(i,n-m+1){
    bool ok = true;
    string k = s;
    REP(j,m){
      if(k[i+j]=='?'){
        k[i+j] = t[j];
      }else if(k[i+j]!=t[j]){
        ok = false;
        break;
      }
    }
    REP(i,n)if(k[i]=='?')k[i]='a';
    if(ok){
      CHMIN(ans,k);
    }
  }
  if(ans==wo){
    ans = "UNRESTORABLE";
  }
  cout<<ans<<endl;
  }
  return 0;
}


Compiler output:
a.cc:62:3: error: expected unqualified-id before 'return'
   62 |   return 0;
      |   ^~~~~~
a.cc:63:1: error: expected declaration before '}' token
   63 | }
      | ^
Language: C++

// #define _GLIBCXX_DEBUG
#define _USE_MATH_DEFINES
#include <bits/stdc++.h>
using namespace std;
using ll = long long; using pii = pair<int, int>; using vi = vector<int>; using vvi = vector<vi>; using vl = vector<ll>; using vvl = vector<vl>; using vb = vector<bool>; using vvb = vector<vb>;
#define rep0(TMS) for (int CNT = 0; CNT < (int)(TMS); CNT++)
#define rep(CNT, GOAL) for (int CNT = 0; CNT < (int)(GOAL); CNT++)
#define rep2(CNT, START, GOAL) for (int CNT = (int)(START); CNT < (int)(GOAL); CNT++)
#define rep3(CNT, START, GOAL) for (int CNT = (int)(START); CNT > (int)(GOAL); CNT--)
#define all(CONT) begin(CONT), end(CONT)
template <typename T> bool chmax(T &a, const T &b) { if (a < b) { a = b; return true; } return false; }
template <typename T> bool chmin(T &a, const T &b) { if (a > b) { a = b; return true; } return false; }
void prec(const int &DIG) { cout << fixed << setprecision(DIG); cerr << fixed << setprecision(DIG); }
template <typename T> void CERR(const T &ELEM) { cerr << ELEM; }
template <typename T, typename ...Ts> void CERR(const T &FIRST, const Ts &...REST) { CERR(FIRST); cerr << ", "; CERR(REST...); }
#define dbl(OBJ) cerr << #OBJ << ": "; CERR(OBJ); cerr << "\n"
#define dbs(...) cerr << "(" << #__VA_ARGS__ << "): ("; CERR(__VA_ARGS__); cerr << ")\n"
#define itrep(ITR, CONT) for (auto ITR = begin(CONT); ITR != end(CONT); ITR++)
template <typename T> void CERR(const vector<T> &VEC) { cerr << "{ "; itrep(ITR, VEC) { CERR(*ITR); cerr << ", "; } cerr << "}"; }
#define YN(FLG) cout << (FLG ? "YES" : "NO") << "\n"
#define Yn(FLG) cout << (FLG ? "Yes" : "No") << "\n"
#define yn(FLG) cout << (FLG ? "yes" : "no") << "\n"
// const ll INF = LONG_LONG_MAX;
const int INF = INT_MAX;
const ll MOD = 1'000'000'007; // 998'244'353;

#include <atcoder/all>
using namespace atcoder;

int main() {
	// 0-ind
	prec(2);
	int N; cin >> N;
	vi t(N); rep(i, N) cin >> t[i];
	vi v(N); rep(i, N) cin >> v[i];

	int T = accumulate(all(t), 0);
	vi V(T); // V[i]:時刻i~i+1に出すことのできる速度
	int cur = 0;
	rep(i, N) {
		rep0(t[i]) {
			V[cur] = v[i];
			cur++;
		}
	}
	// dbl(V);
	vi M(T + 1, INF); // M[i]:時刻T[i]において出すことのできる最大の速度
	cur = 0;
	rep(i, N) {
		chmin(M[cur], v[i]);
		rep0(t[i]) {
			cur++;
			chmin(M[cur], v[i]);
		}
	}
	// dbl(M);
	M[0] = 0;
	rep2(cur, 1, T) chmin(M[cur], M[cur - 1] + 1);
	M[T] = 0;
	rep3(cur, T - 1, 0) chmin(M[cur], M[cur + 1] + 1);
	// dbl(M);

	float ans = 0.0;
	rep(cur, T) {
		if (M[cur] != M[cur + 1]) {
			ans += (M[cur] + M[cur + 1]) / 2.0f;
		} else {
			if (M[cur] < V[cur]) {
				ans += M[cur] + 0.25f;
			} else {
				ans += M[cur];
			}
		}
	}

	cout << ans << endl;
}

Compiler output:
a.cc:27:10: fatal error: atcoder/all: No such file or directory
   27 | #include <atcoder/all>
      |          ^~~~~~~~~~~~~
compilation terminated.
Language: C++

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

// ----------- define --------------
#define int long long
#define vi vector<int>
#define vc vector<char>
#define ii pair<int,int>
#define fi first
#define sc second
#define stoi stoll
#define all(x) (x).begin(),(x).end()
#define get_bit(x, k) ((x >> k) & 1)
// ---------------------------------

const int N = 20005;

int a[N], t[N], v[N], g[N];

#include <conio.h>

void MAIN() {
  int n; cin >> n;
  for (int i = 1; i <= n; i++) {
    cin >> t[i];
  }
  for (int i = 1; i <= n; i++) {
    cin >> v[i];
  }
  for (int i = 0; i < N; i++) {
    a[i] = 2e9;
  }
  for (int i = 0; i <= n + 1; i++) {
    int ti = (i ? t[i - 1] : 0);
    for (int j = ti, c = 0; j <= 20000; j++, c++) {
      a[j] = min(a[ti] + c, v[i]);
      g[j] = v[i];
    }
    for (int j = ti, c = 0; j >= 0; j--, c++) {
      a[j] = min(a[j], v[i] + c);
    }
    t[i] += ti;
  }
  // for (int i = 0; i <= 10; i++) cout << a[i] << ' '; cout << '\n';
  cout << fixed << setprecision(10);
  double s = 0;
  for (int i = 0; i < t[n];) {
    int j = i + 1;
    if (a[j] == a[i]) {
      while (j < n && a[j + 1] == a[i]) j++;
      if (j - i == 1 && g[i] > a[i] && g[j] > a[j]) {
        s += a[i] + 0.25;
      }
      else s += (j - i) * double(a[i]);
    }
    if (a[j] == a[i] + 1) {
      while (j < t[n] && a[j + 1] == a[j] + 1) j++;
      s += a[i] * (j - i) + 0.5 * (j - i) * (j - i);
    }
    if (a[j] == a[i] - 1) {
      while (j < t[n] && a[j + 1] == a[j] - 1) j++;
      s += a[i] * (j - i) - 0.5 * (j - i) * (j - i);
    }
    // cout << i << ' ' << j << ' ' << s << '\n';
    i = j;
  }
  cout << s << '\n';
}

signed main() {
  // ios::sync_with_stdio(0); cin.tie(0);
  int T = 1;
  // cin >> T;
  while (T--) MAIN();
}


Compiler output:
a.cc:20:10: fatal error: conio.h: No such file or directory
   20 | #include <conio.h>
      |          ^~~~~~~~~
compilation terminated.
Language: C++

#include<bits/stdc++.h>
using namespace std;
using ll = long long;
using Graph = vector<vector<int>>;
const ll mod=1000000007;
const int MAX_N = 1000;         // n の最大値
 
// nCk を取得
double nCk(int n, int k) {
double res=1.0;
for(int i=0; i<n; i++){
res*=0.5;}
for(int i=0; i<k; i++){
res*=(double)(n-i);
res/=(double)(k-i);
}
return res;}
 
int main() {
double n;
cin>>n;
double t[n]={};
double v[n]={};
double ht=0;
double ot=0;
double x;
double ja=0;
double ka=0;
for(ll i=0; i<n; i++){
cin>>t[i];}
for(ll i=0; i<n; i++){
cin>>v[i];}
double dp[n][101]={{}};
dp[0][0]=0;
for(ll i=1; i<n; i++){
ht=v[i-1]; ot=v[i];
for(ll j=0; j<=ot; j++){
for(ll k=0; k<=ht; k++){
if(t[i]<abs(j-k))continue;
else{
ja=(double)j;
ka=(double)k;
x=(t[i]+ja-ka)/2;
dp[i][j]=max(dp[i][j],(dp[i-1][k]+ka*x+x*x/2+(t[i]-x)*j+(t[i]-x)*(t[i]-x)/2));}}}}
cout<<dp[n-1][0]<<endl;}


Compiler output:
a.cc: In function 'int main()':
a.cc:22:10: error: conversion from 'double' to 'long unsigned int' in a converted constant expression
   22 | double t[n]={};
      |          ^
a.cc:22:10: error: could not convert 'n' from 'double' to 'long unsigned int'
   22 | double t[n]={};
      |          ^
      |          |
      |          double
a.cc:22:10: error: size of array 't' has non-integral type 'double'
a.cc:23:10: error: conversion from 'double' to 'long unsigned int' in a converted constant expression
   23 | double v[n]={};
      |          ^
a.cc:23:10: error: could not convert 'n' from 'double' to 'long unsigned int'
   23 | double v[n]={};
      |          ^
      |          |
      |          double
a.cc:23:10: error: size of array 'v' has non-integral type 'double'
a.cc:33:11: error: conversion from 'double' to 'long unsigned int' in a converted constant expression
   33 | double dp[n][101]={{}};
      |           ^
a.cc:33:11: error: could not convert 'n' from 'double' to 'long unsigned int'
   33 | double dp[n][101]={{}};
      |           ^
      |           |
      |           double
a.cc:33:11: error: size of array 'dp' has non-integral type 'double'
a.cc:45:9: error: invalid types 'double [1][101][double]' for array subscript
   45 | cout<<dp[n-1][0]<<endl;}
      |         ^
Language: C++

#include<bits/stdc++.h>
using namespace std;
using ll = long long;
using Graph = vector<vector<int>>;
const ll mod=1000000007;
const int MAX_N = 1000;         // n の最大値
 
// nCk を取得
double nCk(int n, int k) {
double res=1.0;
for(int i=0; i<n; i++){
res*=0.5;}
for(int i=0; i<k; i++){
res*=(double)(n-i);
res/=(double)(k-i);
}
return res;}
 
int main() {
double n;
cin>>n;
double t[n]={};
double v[n]={};
double ht=0;
double ot=0;
double x;
double ja=0;
double ka=0;
for(ll i=0; i<n; i++){
cin>>t[i];}
for(ll i=0; i<n; i++){
cin>>v[i];}
double dp[n][101]={{}};
dp[0][0]=0;
for(ll i=1; i<n; i++){
ht=v[i-1]; ot=v[i];
for(ll j=0; j<=ot; j++){
for(ll k=0; k<=ht; k++){
if(t[i]<abs(j-k))continue;
else{
ja=(double)j;
ka=(double)k;
x=(t[i]+ja-ka)/2;
dp[i][j]=max(dp[i][j],(dp[i-1][k]+ka*x+x*x/2+(t[i]-xa)*j+(t[i]-xa)*(t[i]-xa)/2));}}}}
cout<<dp[n-1][0]<<endl;}


Compiler output:
a.cc: In function 'int main()':
a.cc:22:10: error: conversion from 'double' to 'long unsigned int' in a converted constant expression
   22 | double t[n]={};
      |          ^
a.cc:22:10: error: could not convert 'n' from 'double' to 'long unsigned int'
   22 | double t[n]={};
      |          ^
      |          |
      |          double
a.cc:22:10: error: size of array 't' has non-integral type 'double'
a.cc:23:10: error: conversion from 'double' to 'long unsigned int' in a converted constant expression
   23 | double v[n]={};
      |          ^
a.cc:23:10: error: could not convert 'n' from 'double' to 'long unsigned int'
   23 | double v[n]={};
      |          ^
      |          |
      |          double
a.cc:23:10: error: size of array 'v' has non-integral type 'double'
a.cc:33:11: error: conversion from 'double' to 'long unsigned int' in a converted constant expression
   33 | double dp[n][101]={{}};
      |           ^
a.cc:33:11: error: could not convert 'n' from 'double' to 'long unsigned int'
   33 | double dp[n][101]={{}};
      |           ^
      |           |
      |           double
a.cc:33:11: error: size of array 'dp' has non-integral type 'double'
a.cc:44:52: error: 'xa' was not declared in this scope; did you mean 'ka'?
   44 | dp[i][j]=max(dp[i][j],(dp[i-1][k]+ka*x+x*x/2+(t[i]-xa)*j+(t[i]-xa)*(t[i]-xa)/2));}}}}
      |                                                    ^~
      |                                                    ka
a.cc:45:9: error: invalid types 'double [1][101][double]' for array subscript
   45 | cout<<dp[n-1][0]<<endl;}
      |         ^
Language: C++

#include<bits/stdc++.h>
using namespace std;
using ll = long long;
using Graph = vector<vector<int>>;
const ll mod=1000000007;
const int MAX_N = 1000;         // n の最大値
 
// nCk を取得
double nCk(int n, int k) {
double res=1.0;
for(int i=0; i<n; i++){
res*=0.5;}
for(int i=0; i<k; i++){
res*=(double)(n-i);
res/=(double)(k-i);
}
return res;}
 
int main() {
int n;
cin>>n;
double t[n]={};
double v[n]={};
double ht=0;
double ot=0;
double x;
for(ll i=0; i<n; i++){
cin>>t[i];}
for(ll i=0; i<n; i++){
cin>>v[i];}
double dp[n][101]={{}};
dp[0][0]=0;
for(ll i=1; i<n; i++){
ht=v[i-1]; ot=v[i];
for(ll j=0; j<=ot; j++){
for(ll k=0; k<=ht; k++){
if(t[i]<abs(j-k))continue;
else{
x=(t[i]+j-k)/2;
dp[i][j]=max(dp[i][j],(dp[i-1][k]+k*x+x*x/2+(t-x)*j+(t-x)*(t-x)/2));}}}}
cout<<dp[n-1][0]<<endl;}


Compiler output:
a.cc: In function 'int main()':
a.cc:40:47: error: invalid operands of types 'double [n]' and 'double' to binary 'operator-'
   40 | dp[i][j]=max(dp[i][j],(dp[i-1][k]+k*x+x*x/2+(t-x)*j+(t-x)*(t-x)/2));}}}}
      |                                              ~^~
      |                                              | |
      |                                              | double
      |                                              double [n]
a.cc:40:55: error: invalid operands of types 'double [n]' and 'double' to binary 'operator-'
   40 | dp[i][j]=max(dp[i][j],(dp[i-1][k]+k*x+x*x/2+(t-x)*j+(t-x)*(t-x)/2));}}}}
      |                                                      ~^~
      |                                                      | |
      |                                                      | double
      |                                                      double [n]
a.cc:40:61: error: invalid operands of types 'double [n]' and 'double' to binary 'operator-'
   40 | dp[i][j]=max(dp[i][j],(dp[i-1][k]+k*x+x*x/2+(t-x)*j+(t-x)*(t-x)/2));}}}}
      |                                                            ~^~
      |                                                            | |
      |                                                            | double
      |                                                            double [n]
Language: C++

#include<iostream>
#include<iomanip>
#include<cmath>
#include<string>
#include<vector>
#include<list>
#include<algorithm>
#include<map>
#include<set>
#include<queue>
#include<stack>
using namespace std;
typedef long long ll;
#define fi first
#define se second
#define mp make_pair
const int inf=1e9+7;
const ll mod=1e9+7;
const ll big=1e18;
const double PI=3.14159265359;

int main() {
    int N;
    cin>>N;
    double t[N+1], v[N+1];
    t[0] = 0;
    int mt[N+1];
    mt[0] = 0;
    for(int i=0;i<N;++i){
        cin>>t[i+1];
        mt[i+1] = t[i+1];
    }
    for(int i=1;i<=N;++i){
        mt[i] += mt[i-1];
    }
    for(int i=0;i<N;++i){
        cin>>v[i];
    }
    v[N] = 0;
    int mi[N+1];
    int time = 0;
    for(int i=0;i<=N;++i){
        mi[i] = time + v[i] + t[i];
        time += t[i];
    }
    double ans = 0;
    double now = 0;
    double zerotime;
    double minustime1, minustime2;
    int minusindex;
    int tmp;
    double tmpmintime;
    for(int i=0;i<N;++i){
        tmp = inf;
        for(int j=i+1;j<=N;++j){
            if(tmp > mi[j]){
                tmp = mi[j];
                tmpmintime = mt[j]-mt[i];
                minusindex = j;
            }
        }
        zerotime = v[i] - now;
        minustime1 = tmpmintime + v[minusindex] - v[i];
        minustime2 = (tmpmintime+v[minusindex]-now)/2;
        if(zerotime<=t[i+1]){
            if(zerotime<=minustime1){
                if(minustime1<=t[i+1]){
                    ans += (now+now+zerotime)*zerotime/2 + (minustime1 - zerotime)*(now+zerotime) + (now+zerotime+v[minusindex])*(t[i+1]-minustime1)/2;
                    now += zerotime - (t[i+1] - minustime1);
                }
                else{
                    ans += (now + now+zerotime)*zerotime/2 + (t[i+1]-zerotime)*v[i];
                    now = v[i];
                }
            }
            else{
                if(misusetime2<=t[i+1]){
                    ans += (now+now+minustime2)*minustime2/2 + (now+minustime2+v[minusindex])*(t[i+1]-minustime2)/2;
                    now += minustime2 - (t[i+1] - minustime2);
                }
                else{
                    ans += (now+now+t[i+1])*t[i+1]/2;
                    now += t[i+1];
                }
            }
        }
        else{
            if(minustime2<=t[i+1]){
                ans += (now+now+minustime2)*minustime2/2 + (now+minustime2+v[minusindex])*(t[i+1]-minustime2)/2;
                now += minustime2 - (t[i+1] - minustime2);
            }
            else{
                ans += (now + now + t[i+1])*t[i+1]/2;
                now = now + t[i+1];
            }
        }
    }
    cout<<setprecision(20)<<ans<<endl;
}



Compiler output:
a.cc: In function 'int main()':
a.cc:77:20: error: 'misusetime2' was not declared in this scope; did you mean 'minustime2'?
   77 |                 if(misusetime2<=t[i+1]){
      |                    ^~~~~~~~~~~
      |                    minustime2
Language: C++

#include <iostream>
#include <vector>
#include <cmath>
using namespace std;

double eq(int speed1 , int time1,int speed2 , int time2){
  double time=time2-time1;
 
  double sp1=speed1,sp2=speed2;

  while(abs(sp1-sp2)>0.0001){
    if(sp1>sp2){
      sp2+=time;
      time=time/2;
    }
    else if(sp1<sp2){
      sp1-=time;
      time=time/2;
    }
  }
  nibun = ((double)speed1*(double)time*(double)time/2+(double)time) + ((double)speed2*((double)time2-(double)time1-(double)time)*((double)time2-(double)time1-(double)time)/2-((double)time2-(double)time1-(double)time));
  return nibun;
}

int main(){
  int N,s;
  vector<int> time;
  vector<int> speed;
  for(int i=0;i<N;i++){
    cin>>s;
    time.push_back(s);
  }
  for(int i=0;i<N;i++){
    cin>>s;
    speed.push_back(s);
  }
  double save=0;
  for(int i=0;i<N-1;i++){
    save+=eq(speed[i],time[i],speed[i+1],time[i+1]);
  }
  cout<<save;
}


Compiler output:
a.cc: In function 'double eq(int, int, int, int)':
a.cc:21:3: error: 'nibun' was not declared in this scope
   21 |   nibun = ((double)speed1*(double)time*(double)time/2+(double)time) + ((double)speed2*((double)time2-(double)time1-(double)time)*((double)time2-(double)time1-(double)time)/2-((double)time2-(double)time1-(double)time));
      |   ^~~~~
Language: C++

#include <iostream>
#include <vector>
#include <cmath>
using namespace std;

double eq(int speed1 , int time1,int speed2 , int time2){
  double time=time2-time1;
 
  double sp1=speed1,sp2=speed2;

  while(abs(sp1-sp2)>0.0001){
    if(sp1>sp2){
      sp2+=time;
      time=time/2;
    }
    else if(sp1<sp2){
      sp1-=time;
      time=time/2;
    }
  }
  nibun = (speed1*time*time/2+time) + (speed2*(time2-time1-time)*(time2-time1-time)/2-(time2-time1-time));
  return nibun;
}

int main(){
  int N,s;
  vector<int> time;
  vector<int> speed;
  for(int i=0;i<N;i++){
    cin>>s;
    time.push_back(s);
  }
  for(int i=0;i<N;i++){
    cin>>s;
    speed.push_back(s);
  }
  double save=0;
  for(int i=0;i<N-1;i++){
    save+=eq(speed[i],time[i],speed[i+1],time[i+1]);
  }
  cout<<save;
}


Compiler output:
a.cc: In function 'double eq(int, int, int, int)':
a.cc:21:3: error: 'nibun' was not declared in this scope
   21 |   nibun = (speed1*time*time/2+time) + (speed2*(time2-time1-time)*(time2-time1-time)/2-(time2-time1-time));
      |   ^~~~~
Language: C++

#include <iostream>
#include <vector>
#include <cmath>
using namespace std;

double eq(int speed1 , int time1,int speed2 , int time2){
  double time=time2-time1;
  double nibun;
  double sp1=speed1,sp2=speed2;
  int flag=0;
  while(true){
    if(abs(sp1-sp2)<0.0001){
      break;
    }
    else if(sp1>sp2){
      sp2+=time;
      time=time/2;
    }
    else if(sp1<sp2){
      sp1-=time;
      time=time/2;
      
    }
  }
  return (double)(speed1*time*time/2+time)+(speed2*(time2-time1-time)*(time2-time1-time)/2-(time2-time1-time))
}

int main(){
  int N,s;
  vector<int> time;
  vector<int> speed;
  for(int i=0;i<N;i++){
    cin>>s;
    time.push_back(s);
  }
  for(int i=0;i<N;i++){
    cin>>s;
    speed.push_back(s);
  }
  double save=0;
  for(int i=0;i<N-1;i++){
    save+=eq(speed[i],time[i],speed[i+1],time[i+1]);
  }
  cout<<save;
}

Compiler output:
a.cc: In function 'double eq(int, int, int, int)':
a.cc:25:111: error: expected ';' before '}' token
   25 |   return (double)(speed1*time*time/2+time)+(speed2*(time2-time1-time)*(time2-time1-time)/2-(time2-time1-time))
      |                                                                                                               ^
      |                                                                                                               ;
   26 | }
      | ~
Language: C++

#include<bits/stdc++.h>
using namespace std;
#define rep(i,j,n) for(int i=(int)(j);i<(int)(n);i++)
#define REP(i,j,n) for(int i=(int)(j);i<=(int)(n);i++)
#define MOD 1000000007
#define int long long
#define ALL(a) (a).begin(),(a).end()
#define vi vector<int>
#define vii vector<vi>
#define pii pair<int,int>
#define priq priority_queue<int>
#define disup(A,key) distance(A.begin(),upper_bound(ALL(A),(int)(key)))
#define dislow(A,key) distance(A.begin(),lower_bound(ALL(A),(int)(key)))
#define tii tuple<int,int,int>
#define Priq priority_queue<int,vi,greater<int>>
#define pb push_back
#define mp make_pair
#define INF (1ll<<62)-1
#define MAX 1000000000
signed main(){
    int N; cin>>N;
    vi A(N+1),B(N+1);
    int sum=0;
    rep(i,0,N){
        cin>>A[i];
        sum+=A[i];
    }
    rep(i,0,N) cin>>B[i];
    vi C(sum+1);
    int memo=0,cnt=A[0];
    REP(i,1,sum){
        C[i]=min(C[i-1]+1,B[memo]);
        if(i==cnt){
            memo++;
            cnt+=A[memo];
            if(B[memo]<C[i]){
                C[i]=B[memo];
                for(int j=i-1;j>=0;j--){
                    if(C[j]>C[j+1]+1) C[j]=C[j+1]+1;
                    else break;
                }
            }
        }
    }
    double ans=0;
    memo=0;
    cnt=A[0];
    REP(i,1,sum){
        if(C[i-1]<C[i]){
            ans+=C[i-1];
            ans+=0.5;
        }
        else if(C[i-1]==C[i]){
            ans+=C[i];
            if(B[memo]>C[i]) ans+=0.25;
        }
        else{
            ans+=C[i];
            ans+=0.5;
        }
        if(cnt==i){
            memo++;
            if(memo<N) cnt+=A[memo];
        }
    }
    printff("%.10lf\n",ans);
}


Compiler output:
a.cc: In function 'int main()':
a.cc:66:5: error: 'printff' was not declared in this scope; did you mean 'printf'?
   66 |     printff("%.10lf\n",ans);
      |     ^~~~~~~
      |     printf
Language: C++

int N, T[101], V[101];
double dp[105][105];
//---------------------------------------------------------------------------------------------------
void _main() {
    cin >> N;
    rep(i, 0, N) cin >> T[i];
    rep(i, 0, N) cin >> V[i];
 
    dp[0][0] = 1;
    rep(i, 0, N) rep(v, 0, 105) if (dp[i][v] and v <= V[i]) {
        rep(vv, 0, 105) if(vv <= V[i]) {
            int a = V[i] - v;
            int b = V[i] - vv;
            if (a + b <= T[i]) {
                double up = 1.0 * (v + V[i]) * a / 2;
                double stay = V[i] * (T[i] - a - b);
                double down = 1.0 * (vv + V[i]) * b / 2;
                double c = up + stay + down;
                dp[i + 1][vv] = max(dp[i + 1][vv], dp[i][v] + c);
            } else if (T[i] < abs(vv - v)) {
                // can't
            } else {
                double x = 1.0 * (vv - v + T[i]) / 2;
                double y = 1.0 * (T[i] - vv + v) / 2;
                double vvv = v + x;
 
                double up = 1.0 * (v + vvv) * x / 2;
                double down = 1.0 * (vv + vvv) * y / 2;
 
                double c = up + down;
 
                dp[i + 1][vv] = max(dp[i + 1][vv], dp[i][v] + c);
            }
 
        }
    }
    printf("%.10f\n", dp[N][0] - 1);
}

Compiler output:
a.cc: In function 'void _main()':
a.cc:5:5: error: 'cin' was not declared in this scope
    5 |     cin >> N;
      |     ^~~
a.cc:6:9: error: 'i' was not declared in this scope
    6 |     rep(i, 0, N) cin >> T[i];
      |         ^
a.cc:6:5: error: 'rep' was not declared in this scope
    6 |     rep(i, 0, N) cin >> T[i];
      |     ^~~
a.cc:37:5: error: 'printf' was not declared in this scope
   37 |     printf("%.10f\n", dp[N][0] - 1);
      |     ^~~~~~
a.cc:1:1: note: 'printf' is defined in header '<cstdio>'; this is probably fixable by adding '#include <cstdio>'
  +++ |+#include <cstdio>
    1 | int N, T[101], V[101];
Language: C++

def getSpeedChanges(sStart, tStart, sEnd, tEnd, sMax):
    tresult = []
    vresult = []
    
    decelPoint = ((tEnd+sEnd) + (tStart-sStart))/2
    decel = ((tEnd+sEnd) - (tStart-sStart))/2

    sMaxPoint = tStart + (sMax-sStart)
    decelFromMax = tEnd - (sMax-sEnd)
    
    if sMaxPoint < decelPoint:
        tresult += [sMaxPoint]
        vresult += [sMax]
        if sEnd >= sMax:
            tresult += [tEnd]
            vresult += [sMax]
        else:
            tresult += [decelFromMax, tEnd]
            vresult += [sMax, sEnd]
    else:
        tresult += [decelPoint, tEnd]
        vresult += [decel, sEnd]

    return tresult, vresult

def getDistance(t,v):
    result = 0
    for i in range(1,len(t)):
        result += abs((t[i] - t[i-1]) * (v[i]-v[i-1])) / 2
        result += (t[i] - t[i-1]) * min(v[i],v[i-1])

    return result

n = int(input())
t = [int(x) for x in input().split()]
v = [int(x) for x in input().split()] + [0]
for i in range(1,n):
    t[i] = t[i]+t[i-1]

tresult = [0]
vresult = [0]

for i in range(n):
    trestemp, vrestemp = getSpeedChanges(vresult[-1], tresult[-1], v[i+1], t[i], v[i])
    tresult+=trestemp
    vresult+=vrestemp

print(getDistance(tresult,vresult))


Compiler output:
a.cc:1:1: error: 'def' does not name a type
    1 | def getSpeedChanges(sStart, tStart, sEnd, tEnd, sMax):
      | ^~~