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

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

int main(){
  int N;
  cin>>N;
  vector<tuple<string,int,int>> res;
  for(int i=1;i<=N;i++){
    string S;
    int P;
    res.push_back(make_tuple(string,100-P,i));
  }
  sort(res.begin(),res.end());
  
  for(i=0;i<N;i++){
    cout<<get<2>(res.at(i))<<endl;
  }
}

Compiler output:
a.cc: In function 'int main()':
a.cc:11:36: error: expected primary-expression before ',' token
   11 |     res.push_back(make_tuple(string,100-P,i));
      |                                    ^
a.cc:15:7: error: 'i' was not declared in this scope
   15 |   for(i=0;i<N;i++){
      |       ^
Language: C++

#include<bits/stdc++.h>
using namespace std;
int main(){
  int n,i;
  vector<string>>tmp(100,vector<int>100);
  cin>>n;
  vector<string>>data(n,vector<int>(n));
  for(i=0;i<n;i++)
    cin>>data[i][i];
  sort(data.begin(),data.end());
  for(i=0;i<n;i++){
    if(data[i]==data[i+1) && data[i][i]>data[i+1][i+1]){
       tmp[i][i]=data[i][i];
      data[i][i]=data[i+1][i+1];
      data[i+1][i+1]=tmp[i][i];
    }
  }
  for(i=0;i<n;i++)
    cout<<data[i][i];
}

Compiler output:
a.cc: In function 'int main()':
a.cc:5:16: error: expected unqualified-id before '>' token
    5 |   vector<string>>tmp(100,vector<int>100);
      |                ^~
a.cc:7:16: error: expected unqualified-id before '>' token
    7 |   vector<string>>data(n,vector<int>(n));
      |                ^~
a.cc:9:14: error: invalid types '<unresolved overloaded function type>[int]' for array subscript
    9 |     cin>>data[i][i];
      |              ^
a.cc:10:13: error: overloaded function with no contextual type information
   10 |   sort(data.begin(),data.end());
      |             ^~~~~
a.cc:10:26: error: overloaded function with no contextual type information
   10 |   sort(data.begin(),data.end());
      |                          ^~~
a.cc:12:12: error: invalid types '<unresolved overloaded function type>[int]' for array subscript
   12 |     if(data[i]==data[i+1) && data[i][i]>data[i+1][i+1]){
      |            ^
a.cc:12:25: error: expected ']' before ')' token
   12 |     if(data[i]==data[i+1) && data[i][i]>data[i+1][i+1]){
      |                         ^
      |                         ]
a.cc:12:21: error: invalid types '<unresolved overloaded function type>[int]' for array subscript
   12 |     if(data[i]==data[i+1) && data[i][i]>data[i+1][i+1]){
      |                     ^
a.cc:12:34: error: expected ';' before '[' token
   12 |     if(data[i]==data[i+1) && data[i][i]>data[i+1][i+1]){
      |                                  ^
      |                                  ;
a.cc:19:15: error: invalid types '<unresolved overloaded function type>[int]' for array subscript
   19 |     cout<<data[i][i];
      |               ^
a.cc:12:30: error: label 'data' used but not defined
   12 |     if(data[i]==data[i+1) && data[i][i]>data[i+1][i+1]){
      |                              ^~~~
Language: C++

#include <iostream>
#include <vector>
#include <queue>
#include <set>
#include <cmath>
#include <stack>
#include <string>
#include <deque>
#include <map>

using namespace std;

typedef  struct _Restaurants {
    int score;
    string location;
} Restaurant;
bool compare(const Restaurant& r1, const Restaurant& r2) {
    if (r1.location == r2.location) {
        return  r1.score > r2.score;
    }
    return  r1.location < r2.location;
}
int main() {
    int N;
    vector<Restaurant> restaurants;
    vector<Restaurant> restaurantsCopy;
    map<int,int> map;
    cin >> N;
    for (int i = 0; i < N; ++i) {
        Restaurant r ;
        cin >> r.location >> r.score;
        restaurants.push_back(r);
        restaurantsCopy.push_back(r);
    }
    sort(restaurantsCopy.begin(),restaurantsCopy.end(),compare);
    for (int j = 0; j < N; ++j) {
        map.insert(pair<int,int>(restaurantsCopy[j].score , j + 1));
    }
    for (int k = 0; k < N; ++k) {
        cout << map[restaurants[k].score] << endl;
    }
    return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:35:5: error: 'sort' was not declared in this scope; did you mean 'sqrt'?
   35 |     sort(restaurantsCopy.begin(),restaurantsCopy.end(),compare);
      |     ^~~~
      |     sqrt
Language: C++

#include <iostream>
#include <vector>
using namespace std;
int main()
{
    vector<pair<string, pair<int,int> > >v;
    int n;
    cin >> n;
    for(int i = 0;i < n;i++)
    {
        string s;
        int p;
        cin >> s >> p;
        v.push_back(make_pair(s,make_pair((-1)*p,i+1)));
    }

    sort(v.begin(), v.end());

    for(int i = 0;i < n;i++)
    {
        cout << v[i].second.second << endl;
    }

}

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

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

int main() {
  int N, s;
  string a;
  cin>>N;
  vector<taple<string, int, int>> p(N);

  for (int i=0;i<N;i++){
    cin>>a>>s;
    p.at(i)=(a, 100-s, i+1);
  }
  sort(p.begin(), p.end());
  for (int i=0;i<N;i++){
    cout<<get<3>(p)<<endl;
  }
}


Compiler output:
a.cc: In function 'int main()':
a.cc:8:10: error: 'taple' was not declared in this scope
    8 |   vector<taple<string, int, int>> p(N);
      |          ^~~~~
a.cc:8:29: error: wrong number of template arguments (3, should be at least 1)
    8 |   vector<taple<string, int, int>> p(N);
      |                             ^~~
In file included from /usr/include/c++/14/vector:66,
                 from /usr/include/c++/14/functional:64,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:53,
                 from a.cc:1:
/usr/include/c++/14/bits/stl_vector.h:428:11: note: provided for 'template<class _Tp, class _Alloc> class std::vector'
  428 |     class vector : protected _Vector_base<_Tp, _Alloc>
      |           ^~~~~~
a.cc:8:32: error: expected unqualified-id before '>' token
    8 |   vector<taple<string, int, int>> p(N);
      |                                ^~
a.cc:12:5: error: 'p' was not declared in this scope
   12 |     p.at(i)=(a, 100-s, i+1);
      |     ^
a.cc:14:8: error: 'p' was not declared in this scope
   14 |   sort(p.begin(), p.end());
      |        ^
Language: C++

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

int main() {
    int n;
    cin >> n;
    pair<pair<string,int>,int> res[n];
    for(int i=0;i<n;i++){
        string s;
        int a;
        cin >> s >> a;
        a = a*-1;
        res[i]=make_pair(make_pair(s,a),i);
    }
    sort(res.begin(),res.end());
    for(int i=0;i<n;i++){
        cout << res[i].second+1 << endl;
    }
}

Compiler output:
a.cc: In function 'int main()':
a.cc:15:14: error: request for member 'begin' in 'res', which is of non-class type 'std::pair<std::pair<std::__cxx11::basic_string<char>, int>, int> [n]'
   15 |     sort(res.begin(),res.end());
      |              ^~~~~
a.cc:15:26: error: request for member 'end' in 'res', which is of non-class type 'std::pair<std::pair<std::__cxx11::basic_string<char>, int>, int> [n]'
   15 |     sort(res.begin(),res.end());
      |                          ^~~
Language: C++

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

int main() {
  int n;
  cin>>n;
  vector<tuple<string,int,int>>a(n);
  for(int i=0;i<n;i++){
    string s;
    int k;
    cin>>s>>k;
    a.at(i)=make_tuple(s,100-k,i+1);
  }
  sort(a.begin(),a.end());
  for(int i=0;i<n;i++){
    cout<<a.at(i).third<<endl;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:16:19: error: '__gnu_cxx::__alloc_traits<std::allocator<std::tuple<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, int, int> >, std::tuple<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, int, int> >::value_type' {aka 'class std::tuple<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, int, int>'} has no member named 'third'
   16 |     cout<<a.at(i).third<<endl;
      |                   ^~~~~
a.cc:17:2: error: expected '}' at end of input
   17 | }
      |  ^
a.cc:4:12: note: to match this '{'
    4 | int main() {
      |            ^
Language: C++

#include <bits/stdc++.h>
using namespace std;
int main(){
  char a;
  int N,b;
  cin>>N;
  vector<tuple<char,int,int>>X(N);
  for(int i=1;i<=N;i++){
    cin>>a>>b;
    X.at(i)=make_tupl(a,100-b,i);
  }
  sort(X.begin(),X.end());
  for(int i=0;i<N;i++){
    tie(ignore,ignore,b)=X.at(i);
    cout<<b<<endl;
  }
}

Compiler output:
a.cc: In function 'int main()':
a.cc:10:13: error: 'make_tupl' was not declared in this scope
   10 |     X.at(i)=make_tupl(a,100-b,i);
      |             ^~~~~~~~~
Language: C++

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




    int main(){
        int n;
        std::cin >> n;
        std::vector<tuple<string, int, int>> a;

        rep(i, n){
            string s;
            int p;

            std::cin >> s >> p;
            a.push_back(tie(s, p, i));
        }
        p = -p;
        sort(a.begin(), a.end());
        rep(i, n){
            std::cout << get<2>(a[i]) << "\n";
        }
    }


Compiler output:
a.cc: In function 'int main()':
a.cc:21:9: error: 'p' was not declared in this scope
   21 |         p = -p;
      |         ^
Language: C++

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




    int main(){
        int a;
        std::cin >> a;
        rep(i,a){
            int t;
            std::cin >> t;
            string tmp = in;
            p[i] = make_pair(make_pair(in, -t), i);
        }
        sort(p, p+a);
        rep(i, a){
            std::cout << p[i].second+1 << "\n";
        }
    }


Compiler output:
a.cc: In function 'int main()':
a.cc:15:26: error: 'in' was not declared in this scope; did you mean 'i'?
   15 |             string tmp = in;
      |                          ^~
      |                          i
a.cc:16:13: error: 'p' was not declared in this scope
   16 |             p[i] = make_pair(make_pair(in, -t), i);
      |             ^
a.cc:18:14: error: 'p' was not declared in this scope
   18 |         sort(p, p+a);
      |              ^
Language: C++

#include <bits/stdc++.h>
using namespace std;
using ll=long long;
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define inf 1001001001001
typedef pair<int,int> P;
#define mod 1000000007


int main(){
    int n;
    cin >> n;
    vector<tuple<string,int,int>> vec(n);
    rep(i,n){
        string mise;
        int score;
        //int id=i+1;
        cin >> mise >> score;
        //score=-score;
        vec[i]=tie(mise,-score,i+1);
    }
    sort(vec.begin(),vec.end());
    rep(i,n){
        cout << get<2>(vec[i]) << endl;
    }
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:20:25: error: cannot bind non-const lvalue reference of type 'int&' to an rvalue of type 'int'
   20 |         vec[i]=tie(mise,-score,i+1);
      |                         ^~~~~~
In file included from /usr/include/c++/14/bits/memory_resource.h:47,
                 from /usr/include/c++/14/string:68,
                 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/tuple:2791:19: note:   initializing argument 2 of 'constexpr std::tuple<_Elements& ...> std::tie(_Elements& ...) [with _Elements = {__cxx11::basic_string<char, char_traits<char>, allocator<char> >, int, int}]'
 2791 |     tie(_Elements&... __args) noexcept
      |         ~~~~~~~~~~^~~~~~~~~~
Language: C

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

const int N = 32e4;

string s[N];
int a[N], r[N];

bool cmp(int x, int y)
{
	if (s[x] == s[y])
		return a[x] > a[y];
	return s[x] < s[y];
}

int main()
{
	ios::sync_with_stdio();
	int n;
	scanf("%d", &n);
	for (int i = 0; i < n; i++)
	{
		scanf("%s%d", &s[i], &a[i]);
		r[i] = i;
	}
	sort(r, r + n, cmp);
	for (int i = 0; i < n; i++)
	{
		printf("%d\n", r[i]+1);
	}
	return 0;
}


Compiler output:
main.c:1:10: fatal error: bits/stdc++.h: No such file or directory
    1 | #include <bits/stdc++.h>
      |          ^~~~~~~~~~~~~~~
compilation terminated.
Language: C++

#include <bits/stdc++.h>
using namespace std;
int main(){
  int N;
  cin>>N;
  vector<tuple<string,int,int>> X(N);
  for(int i=0;i<N;i++){
    string s;
    int p;
    cin>>s>>p;
    p=-p;
    a.push_back(tie(s,p,i));
  }
  for(int i=0;i<N;i++){
    cout<<get<2>(X.at(i))<<endl;
  }
  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:12:5: error: 'a' was not declared in this scope
   12 |     a.push_back(tie(s,p,i));
      |     ^
Language: C++

#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<n;i++)
#define FOR(i,start,end) for(int i=start;i<=end;i++)
const int INF = 1001001001;
typedef long long ll;
const ll MOD=1000000007;
using namespace std;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
template<class T>auto MAX(const T& a) { return *max_element(a.begin(),a.end()); }
template<class T>auto MIN(const T& a) { return *min_element(a.begin(),a.end()); }
template<class T, class U>U SUM(const T& a, const U& v) { return accumulate(a.begin(),a.end(), v); }
template<class T, class U>U COUNT(const T& a, const U& v) { return count(a.begin(),a.end(), v); }
template<class T, class U>int LOWER(const T& a, const U& v) { return lower_bound(a.begin(),a.end(), v) - a.begin(); }
template<class T, class U>int UPPER(const T& a, const U& v) { return upper_bound(a.begin(),a.end(), v) - a.begin(); }
int GCD(int a, int b) { return b ? GCD(b, a%b) : a; }
int LCM(int a, int b) { int g = GCD(a, b); return a / g * b; }

int main(void){
    // Your code here!
    int n;
    cin >> n;
    pair<pair<string,int>,int> freq[105];
    rep(i,n) {
        string s;
        int p;
        cin >> s >> p;
        freq[i] = make_pair(make_pair(s,-p),i);
    }
    sort(freq,freq+n);
    rep(i,n) cout << freq[i].second+1 << endl;
}

Compiler output:
a.cc:32:2: error: stray '\16' in program
   32 | }<U+000E><U+000E>
      |  ^~~~~~~~
a.cc:32:3: error: stray '\16' in program
   32 | }<U+000E><U+000E>
      |          ^~~~~~~~
Language: C++

#include <bits/stdc++.h>
#include <math.h>
#include <cmath>
 
using namespace std;
using ll =long long;

bool is_int_lround(double x){
  return std::lround(x)==x;
}
int ketasuu(int x){
  int n=0;
  while(x>0){
    x /=10 ;
    n ++;
  }
  return n;
}
ll gcd11(ll x, ll y){
  long long a= max(x,y), b=min(x,y), c=a%b;
  while( c!=0){
    a =b;
    b =c;
    c = a%b;
  }
  return b;
}

int ab(int x, int y){
  if(x>=y){
    return x-y;
  }
  else if(y>x){
    return y-x;
  }
}
int main(){
  int n;
  cin>>n;
  vector<tuple<string,int,int>> tu(n);
  for(int i =0; i<n ;i++){
    string s;
    int p;
    cin>>s>>p;
    tu[i] = make_tuple(s,100-p, i+1);
  }
  sort(tu.begin() , tu.end());
  for(int i ; i<n ;i++){
    cout << get<2>(tu(i))<<endl;
  }
}

Compiler output:
a.cc: In function 'int main()':
a.cc:49:22: error: no match for call to '(std::vector<std::tuple<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, int, int> >) (int&)'
   49 |     cout << get<2>(tu(i))<<endl;
      |                    ~~^~~
a.cc: In function 'int ab(int, int)':
a.cc:36:1: warning: control reaches end of non-void function [-Wreturn-type]
   36 | }
      | ^
Language: C++

#include <iostream>
#include <vector>
using namespace std;
using guide = pair<string, int>;

int main() {
  int N;
  cin >> N;
  vector<guide> G;
  vector<guide> C;
  for (int i = 0; i < N; i++) {
    string s;
    int p;
    cin >> s >> p;
    G.push_back(guide(s, p));
    C.push_back(guide(s, p));
  }

  sort(C.begin(), C.end());

  for (int i = 1; i < N; i++) {
    if (C[i].first == C[i - 1].first) {
      if (C[i].second > C[i - 1].second) {
        guide tmp = C[i];
        C[i] = C[i - 1];
        C[i - 1] = tmp;
      }
    }
  }

  for (int i = 0; i < N; i++) {
    guide c = C[i];
    for (int j = 0; j < N; j++) {
      if (c == G[j]) cout << j + 1 << endl;
    }
  }

  return 0;
}


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

import java.util.*; 

class Main{
public static void main(String[] args){
	Scanner sc=new Scanner(System.in);
        int n=sc.nextInt();
		String[] s=new String[n];
  		
		for(int c=0;c<n;c++){
          	s[c]=sc.next()+","+(1000-sc.nextInt())+","+(c+1);
          	
    	}
        Arrays.sort(s);
  		for(String s1:s)
		String ans=s1.split(",")[2];
    	System.out.println(ans);
    }
}

Compiler output:
Main.java:15: error: variable declaration not allowed here
		String ans=s1.split(",")[2];
		       ^
1 error
Language: C++

#include <iostream>
#include <vector>
#include <tuple>
#include <set>
#include <cmath>


using namespace std;

int main(){
    int N;
    cin >> N;
    pair<pair<string, int>, int> x[101];
    for(int i=0; i<N; i++){
        string s;
        int p;
        cin >> s >> p;
        auto z = make_pair(s, -p);
        x[i] = make_pair(z, i+1);
    }
    sort(x, x+N);
    for(int i=0; i<N; i++){
        cout << x[i].second << endl;
    }
}

Compiler output:
a.cc: In function 'int main()':
a.cc:21:5: error: 'sort' was not declared in this scope; did you mean 'sqrt'?
   21 |     sort(x, x+N);
      |     ^~~~
      |     sqrt
Language: C++

#include <iostream>
#include <vector>
#include <tuple>
#include <set>

using namespace std;

int main(){
    int N;
    cin >> N;
    pair<pair<string, int>, int> x[101];
    for(int i=0; i<N; i++){
        string s;
        int p;
        cin >> s >> p;
        auto z = make_pair(s, -p);
        x[i] = make_pair(z, i+1);
    }
    sort(x, x+N);
    for(int i=0; i<N; i++){
        cout << x[i].second << endl;
    }
}

Compiler output:
a.cc: In function 'int main()':
a.cc:19:5: error: 'sort' was not declared in this scope; did you mean 'short'?
   19 |     sort(x, x+N);
      |     ^~~~
      |     short
Language: C++

#include <iostream>
#include <vector>
#include <utility>
#include <string>
#include <algorithm>
using pair = std::pair<pair<std::string, int>>;

int main(){
  int n;
  std::cin >> n;
  std::vector<pair> p;
  std::string stemp;
  int itemp;
  for(int i=0; i<n; ++i){
    std::cin >> stemp >> itemp;
    p.push_back(std::make_pair(make_pair(stemp, -itemp), i);
  }
  std::sort(p.begin(), p.end());
  std::cout << p[0].first.first std::endl;
                return 0;
}

Compiler output:
a.cc:6:24: error: 'pair' was not declared in this scope; did you mean 'std::pair'?
    6 | using pair = std::pair<pair<std::string, int>>;
      |                        ^~~~
      |                        std::pair
In file included from /usr/include/c++/14/string:48,
                 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/stl_iterator.h:3013:12: note: 'std::pair' declared here
 3013 |     struct pair;
      |            ^~~~
a.cc:6:42: error: template argument 1 is invalid
    6 | using pair = std::pair<pair<std::string, int>>;
      |                                          ^~~
a.cc: In function 'int main()':
a.cc:11:15: error: 'pair' was not declared in this scope; did you mean 'std::pair'?
   11 |   std::vector<pair> p;
      |               ^~~~
      |               std::pair
/usr/include/c++/14/bits/stl_iterator.h:3013:12: note: 'std::pair' declared here
 3013 |     struct pair;
      |            ^~~~
a.cc:11:19: error: template argument 1 is invalid
   11 |   std::vector<pair> p;
      |                   ^
a.cc:11:19: error: template argument 2 is invalid
a.cc:16:7: error: request for member 'push_back' in 'p', which is of non-class type 'int'
   16 |     p.push_back(std::make_pair(make_pair(stemp, -itemp), i);
      |       ^~~~~~~~~
a.cc:16:60: error: expected ')' before ';' token
   16 |     p.push_back(std::make_pair(make_pair(stemp, -itemp), i);
      |                ~                                           ^
      |                                                            )
a.cc:18:15: error: request for member 'begin' in 'p', which is of non-class type 'int'
   18 |   std::sort(p.begin(), p.end());
      |               ^~~~~
a.cc:18:26: error: request for member 'end' in 'p', which is of non-class type 'int'
   18 |   std::sort(p.begin(), p.end());
      |                          ^~~
a.cc:19:17: error: invalid types 'int[int]' for array subscript
   19 |   std::cout << p[0].first.first std::endl;
      |                 ^
Language: C++

#include<bits/stdc++.h>
using namespace std;
int main(){
    int n;
    cin>>n;
   vector<pair<pair<string,int>,int>> K;
   vector<int>p;
   for(int i=0;i<n;i++){
        string p;
       cin>>p;
       int s;
       cin>>s;
      
       K.push_back(make_pair(make_pair(p,s),i));
   }
   sort(K.begin(),K.end());
   for(int i=0;i<n;i++){
      cout<<( K[i].second)+1<<endl;
   }

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

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

int main(){
  using psi = pair<string,int>;
  int N; cin >> N;
  vector<pii> P(N),D(N);
  for(int i=0;i<N;i++){
    cin >> P[i];
    D[i]=P[i];
  }
  vector<int> ans(N);
  sort(P.begin(),P.end());
  for(int i=0;i<N;i++){
    if(P[i]==D[i]){
      ans[i]=i+1;
    }
  }
  for(int i=0;i<N;i++){
    cout << ans[i] << endl;
  }
}
    
      
  
  

Compiler output:
a.cc: In function 'int main()':
a.cc:7:10: error: 'pii' was not declared in this scope; did you mean 'psi'?
    7 |   vector<pii> P(N),D(N);
      |          ^~~
      |          psi
a.cc:7:13: error: template argument 1 is invalid
    7 |   vector<pii> P(N),D(N);
      |             ^
a.cc:7:13: error: template argument 2 is invalid
a.cc:9:13: error: invalid types 'int[int]' for array subscript
    9 |     cin >> P[i];
      |             ^
a.cc:10:6: error: invalid types 'int[int]' for array subscript
   10 |     D[i]=P[i];
      |      ^
a.cc:10:11: error: invalid types 'int[int]' for array subscript
   10 |     D[i]=P[i];
      |           ^
a.cc:13:10: error: request for member 'begin' in 'P', which is of non-class type 'int'
   13 |   sort(P.begin(),P.end());
      |          ^~~~~
a.cc:13:20: error: request for member 'end' in 'P', which is of non-class type 'int'
   13 |   sort(P.begin(),P.end());
      |                    ^~~
a.cc:15:9: error: invalid types 'int[int]' for array subscript
   15 |     if(P[i]==D[i]){
      |         ^
a.cc:15:15: error: invalid types 'int[int]' for array subscript
   15 |     if(P[i]==D[i]){
      |               ^
Language: C++

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

int main(){
    vector< pair<string,pair<int,int>> > x;
    int n, p;
    cin >> n;
    string s;
    for(int i = 0; i < n; i++){
        cin >> s >> p;
        x.push_back({ s, { p, i } });
    }
    sort(x.begin(), x.end(), [](pair<string,pair<int,int>> i, pair<string,pair<int,int>> j){
            return i.first == j.first ? i.second.first > j.second.first : i.first < j.first;
            });
    for(auto& i : x){
        cout << (i.second.second+1) << '\n';
    }
}


Compiler output:
a.cc: In function 'int main()':
a.cc:16:5: error: 'sort' was not declared in this scope; did you mean 'sqrt'?
   16 |     sort(x.begin(), x.end(), [](pair<string,pair<int,int>> i, pair<string,pair<int,int>> j){
      |     ^~~~
      |     sqrt
Language: C++

#include <stdio.h>
#include <string.h>
#include <iostream>
#include <vector>

char in[120];
pair<pair<string,int>,int> p[110];
int main(){
int a;scanf("%d",&a);
for(int i=0;i<a;i++){
int t;scanf("%s%d",in,&t);
string tmp=in;
p[i]=make_pair(make_pair(in,-t),i);
}
std::sort(p,p+a);
for(int i=0;i<a;i++)printf("%d\n",p[i].second+1);
}

Compiler output:
a.cc:7:1: error: 'pair' does not name a type
    7 | pair<pair<string,int>,int> p[110];
      | ^~~~
a.cc: In function 'int main()':
a.cc:12:1: error: 'string' was not declared in this scope
   12 | string tmp=in;
      | ^~~~~~
a.cc:12:1: note: suggested alternatives:
In file included from /usr/include/c++/14/iosfwd:41,
                 from /usr/include/c++/14/ios:40,
                 from /usr/include/c++/14/ostream:40,
                 from /usr/include/c++/14/iostream:41,
                 from a.cc:3:
/usr/include/c++/14/bits/stringfwd.h:77:33: note:   'std::string'
   77 |   typedef basic_string<char>    string;
      |                                 ^~~~~~
In file included 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:
/usr/include/c++/14/string:76:11: note:   'std::pmr::string'
   76 |     using string    = basic_string<char>;
      |           ^~~~~~
a.cc:13:1: error: 'p' was not declared in this scope
   13 | p[i]=make_pair(make_pair(in,-t),i);
      | ^
a.cc:13:16: error: 'make_pair' was not declared in this scope; did you mean 'std::make_pair'?
   13 | p[i]=make_pair(make_pair(in,-t),i);
      |                ^~~~~~~~~
      |                std::make_pair
In file included from /usr/include/c++/14/bits/stl_algobase.h:64,
                 from /usr/include/c++/14/string:51:
/usr/include/c++/14/bits/stl_pair.h:1132:5: note: 'std::make_pair' declared here
 1132 |     make_pair(_T1&& __x, _T2&& __y)
      |     ^~~~~~~~~
a.cc:13:6: error: 'make_pair' was not declared in this scope; did you mean 'std::make_pair'?
   13 | p[i]=make_pair(make_pair(in,-t),i);
      |      ^~~~~~~~~
      |      std::make_pair
/usr/include/c++/14/bits/stl_pair.h:1132:5: note: 'std::make_pair' declared here
 1132 |     make_pair(_T1&& __x, _T2&& __y)
      |     ^~~~~~~~~
a.cc:15:6: error: 'sort' is not a member of 'std'; did you mean 'qsort'?
   15 | std::sort(p,p+a);
      |      ^~~~
      |      qsort
a.cc:15:11: error: 'p' was not declared in this scope
   15 | std::sort(p,p+a);
      |           ^
Language: C++

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

int main() {
  int n=0, a=0;
  string s;
  cin >> n;
  
  using tsii = tuple<string, int, int>;
  using vtsii = vector<tsii>;
  
  vpsi restrunts(n);
  
  for (int i=0; i<n; i++) {
    cin >> s >> a;
    get<0>(restrunts.at(i)) = s;
    get<1>(restrunts.at(i)) = -a;
    get<2>(restrunts.at(i)) = i+1;
  }
  
  auto cprestrunts = restrunts;
  
  sort(restrunts.begin(), restrunts.end());
  
  for (int i=0; i<n; i++) {
    for (int j=0; j<n; j++) {
      if (cprestrunts.at(i) == restrunts.at(j)) {
        cout << get<2>(restrunts.at(j)) << endl;
        break;
      }
    }
  }
}

Compiler output:
a.cc: In function 'int main()':
a.cc:12:3: error: 'vpsi' was not declared in this scope
   12 |   vpsi restrunts(n);
      |   ^~~~
a.cc:16:12: error: 'restrunts' was not declared in this scope
   16 |     get<0>(restrunts.at(i)) = s;
      |            ^~~~~~~~~
a.cc:21:22: error: 'restrunts' was not declared in this scope; did you mean 'cprestrunts'?
   21 |   auto cprestrunts = restrunts;
      |                      ^~~~~~~~~
      |                      cprestrunts
Language: C++

#include<iostream>
#include<string>
#include<vector>
#include<tuple>
#include<algorithm>
using namespace std;
#define int long

int main() {
	int N;
	cin >> N;
	vector<tuple<string, int, int>> a(N);
	for (int i = 0; i < N; i++) {
		string s;
		int n;
		cin >> s >> n;
		a[i] = { s,-n,i+1 };

	}
	sort(a.begin(), a.end());
	for (int i = 0; i < N; i++)
	{
		cout << get<2>(a[i]) << endl;;
	}
}

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

import java.util.Scanner;
import java.util.Arrays;

public class Main {

  static class Restaurant implements Comparable<Restaurant> {
    public int id;
    public String city;
    public int rating;

    public Restaurant(int id, String city, int rating) {
      this.id = id;
      this.city = city;
      this.rating = rating;
    }

    @Override
    public int compareTo(Restaurant r) {
      if (city.equals(r.city)) {
        if (rating == r.rating)
          return 0;
        else if (rating < r.rating)
          return 1;
        else (rating > r.rating)
          return -1;
      }
      return city.compareTo(r.city);
    }
  }

  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    int n = sc.nextInt();

    Restaurant[] rs = new Restaurant[n];

    for (int i = 0; i < n; ++i) {
      String s = sc.next();
      int p = sc.nextInt();
      rs[i] = new Restaurant(i + 1, s, p);
    }

    Arrays.sort(rs);

    for (Restaurant r : rs)
      System.out.println(r.id);
  }
}


Compiler output:
Main.java:24: error: not a statement
        else (rating > r.rating)
             ^
Main.java:24: error: ';' expected
        else (rating > r.rating)
                                ^
2 errors
Language: C++

//C
#ifndef _GLIBCXX_NO_ASSERT
#include <cassert>
#endif
#include <cctype>
#include <cerrno>
#include <cfloat>
#include <ciso646>
#include <climits>
#include <clocale>
#include <cmath>
#include <csetjmp>
#include <csignal>
#include <cstdarg>
#include <cstddef>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>

#if __cplusplus >= 201103L
#include <ccomplex>
#include <cfenv>
#include <cinttypes>
#include <cstdalign>
#include <cstdbool>
#include <cstdint>
#include <ctgmath>
#include <cwchar>
#include <cwctype>
#endif

// C++
#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <exception>
#include <fstream>
#include <functional>
#include <iomanip>
#include <ios>
#include <iosfwd>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <locale>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <ostream>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdexcept>
#include <streambuf>
#include <string>
#include <typeinfo>
#include <utility>
#include <valarray>
#include <vector>

#if __cplusplus >= 201103L
#include <array>
#include <atomic>
#include <chrono>
#include <condition_variable>
#include <forward_list>
#include <future>
#include <initializer_list>
#include <mutex>
#include <random>
#include <ratio>
#include <regex>
#include <scoped_allocator>
#include <system_error>
#include <thread>
#include <tuple>
#include <typeindex>
#include <type_traits>
#include <unordered_map>
#include <unordered_set>
#endif

//ここまで毎回include
//以下プログラム

using namespace std;

int main() {
	int n;
	cin >> n;
	pair<pair<string, int>, int> p[n];
	for (int i = 0; i < n; i++) {
		string S;
		int I;
		cin >> S >> I;
		p[i] = make_pair(make_pair(S, I), i);
	}
	sort(p.begin(), p.end());
	for (int i = 0; i < n; i++) {
		cout << p[i].second + 1 << endl;
	}
}



Compiler output:
a.cc: In function 'int main()':
a.cc:104:16: error: request for member 'begin' in 'p', which is of non-class type 'std::pair<std::pair<std::__cxx11::basic_string<char>, int>, int> [n]'
  104 |         sort(p.begin(), p.end());
      |                ^~~~~
a.cc:104:27: error: request for member 'end' in 'p', which is of non-class type 'std::pair<std::pair<std::__cxx11::basic_string<char>, int>, int> [n]'
  104 |         sort(p.begin(), p.end());
      |                           ^~~
Language: C++

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

int main() {
	int n;
	cin >> n;
	vector<tuple<string, int, int>>a;
	for (int i = 1;i <= n;++i) {
		strins s;
		int p;
		cin >> s >> p;
		p = -p;
		a.push_back(tie(s, p, i));
	}
	sort(a.begin(), a.end());
	for (int i = 0;i < n;++i) {
		cout << get<2>(a[i]) << endl;
	}
}

Compiler output:
a.cc: In function 'int main()':
a.cc:9:17: error: 'strins' was not declared in this scope; did you mean 'stdin'?
    9 |                 strins s;
      |                 ^~~~~~
      |                 stdin
a.cc:11:24: error: 's' was not declared in this scope
   11 |                 cin >> s >> p;
      |                        ^
Language: C++

#include<iostream>
#include<vector>
#include<string>
using namespace std;
int main(){
  int N;
  cin >> N;
  pair<pair<string,int>,int> data[N];

  for (int i = 0; i < N;i++){
    int b;
    string a;
    cin >> a >> b;
    data[i] = make_pair(make_pair(a, -b), i+1);
  }
  sort(data, data+N);
  for (int i = 0; i < N;i++){
    cout << data[i].second << endl;
  }
  return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:16:3: error: 'sort' was not declared in this scope; did you mean 'short'?
   16 |   sort(data, data+N);
      |   ^~~~
      |   short
Language: C++

#include <iostream>
#include <vector>
#include <string>
#include <utility>
using namespace std;
int main(){
  int n;
  cin >> n;
  pair< pair<string, int>, int> pa[110];

  for (int i = 0; i < n; i++){
    string s;
    int p;
    cin >> s >> p;
    pa[i] = make_pair(make_pair(s, -p), i);
  }

  sort(pa, pa+n);
  for (int i = 0; i < n; i++){
    cout << pa[i].second + 1 << endl;
  }
}


Compiler output:
a.cc: In function 'int main()':
a.cc:18:3: error: 'sort' was not declared in this scope; did you mean 'short'?
   18 |   sort(pa, pa+n);
      |   ^~~~
      |   short
Language: C++

#include <iostream>
#include <string>
#include <vector>
#include <utility>

using namespace std;

int main()
{
    int N;
    cin >> N;
    vector<pair<pair<string, int>, int>> v;
    for (int i = 0; i < N; i++)
    {
        string s;
        int x;
        cin >> s >> x;
        v.push_back(pair<pair<string, int>, int>(pair<string, int>(s, -x), i + 1));
    }

    sort(v.begin(), v.end());
    for (int i = 0; i < N; i++)
    {
        cout << v[i].second << endl;
    }
}

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

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

int main() {
  ll n,p;
  string s;
  cin >> n;
  vector<pair<ll,pair<string,ll>>>a.at(n);
  vector<pair<string,pair<ll,ll>>>b.at(n);
  rep(i,n){
  	cin >> s >> p;
  	a.at(i)=make_pair(p,make_pair(s,i+1));
  }
  sort(a.begin(),a.end());
  reverse(a.begin(),a.end());
  rep(i,n){
  	b.at(i)=make_pair(a.at(i).second.first,make_pair(a.at(i).first,a.at(i).second.second));
  }  
  sort(b.begin(),b.end());
  rep(i,n) cout << b.at(i).second.second << endl;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:11:36: error: expected initializer before '.' token
   11 |   vector<pair<ll,pair<string,ll>>>a.at(n);
      |                                    ^
a.cc:12:36: error: expected initializer before '.' token
   12 |   vector<pair<string,pair<ll,ll>>>b.at(n);
      |                                    ^
a.cc:15:9: error: 'a' was not declared in this scope
   15 |         a.at(i)=make_pair(p,make_pair(s,i+1));
      |         ^
a.cc:17:8: error: 'a' was not declared in this scope
   17 |   sort(a.begin(),a.end());
      |        ^
a.cc:20:9: error: 'b' was not declared in this scope
   20 |         b.at(i)=make_pair(a.at(i).second.first,make_pair(a.at(i).first,a.at(i).second.second));
      |         ^
a.cc:22:8: error: 'b' was not declared in this scope
   22 |   sort(b.begin(),b.end());
      |        ^
Language: C++

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

int main(){
  int n,i,j;
  int t[n];
  for(i=0;i<n;i++){
    t[i]=i+1;
  }
  string s[n];
  int p[n];
  for(i=0;i<n;i++){
    cin>>s[i]>>p[i];
  }
  int q1;
  string q2;
  for(i=0;i<101;i++){
    for(j=0;j<n;j++){
      for(k=0;k<j;k++){
        if(s[j]<s[k] || (s[j]==s[k] && p[j]>p[k])){
          q1=p[j];
          p[j]=p[k];
          p[k]=q1;
          q2=s[j];
          s[j]=s[k];
          s[k]=q2;
          q1=t[j];
          t[j]=t[k];
          t[k]=q1;
        }
      }
    }
  }
  for(i=0;i<n;i++){
    cout<<t[i]<<endl;
  }
}

Compiler output:
a.cc: In function 'int main()':
a.cc:19:11: error: 'k' was not declared in this scope
   19 |       for(k=0;k<j;k++){
      |           ^
Language: C++

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

int main(){
  int n;
  cin >> n;
  map<pair<string,int>,int> mp;
  //multimap<string, int> mp;
  multimap<string,int> mmp;
  string s;
  int tmp;
  for(int i=0; i<n; i++){
    cin >> s >> tmp;
    mp[make_pair(s,tmp)] = i+1;
    mmp.insert(make_pair(s,tmp));
  }
  //sort(strs.begin(),strs.end());
  for(int i=0; i<n; i++){
    cout << mp[mmp[i]] << endl;
  }
}
  
  


Compiler output:
a.cc: In function 'int main()':
a.cc:19:19: error: no match for 'operator[]' (operand types are 'std::multimap<std::__cxx11::basic_string<char>, int>' and 'int')
   19 |     cout << mp[mmp[i]] << endl;
      |                   ^
Language: C++

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

int main(){
  int n;
  cin >> n;
  map<pair<string,int>,int> mp;
  //multimap<string, int> mp;
  multimap<string,int> mmp;
  string s;
  int tmp;
  for(int i=0; i<n; i++){
    cin >> s >> tmp;
    mp[make_pair(s,tmp)] = i+1;
    mmp.insert(make_pair(s,tmp));
  }
  //sort(strs.begin(),strs.end());
  for(int i=0; i<n; i++){
    cout << mp[mmp.at(i)] << endl;
  }
}
  
  

Compiler output:
a.cc: In function 'int main()':
a.cc:19:20: error: 'class std::multimap<std::__cxx11::basic_string<char>, int>' has no member named 'at'
   19 |     cout << mp[mmp.at(i)] << endl;
      |                    ^~
Language: C++

#include<bits/stdc++.h>
using namespace std;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }

int main(){
  int n;
  cin >> n;
  set<pair<pair<string,int>,int>> p[110];
  for(int i=0;i<n;++i){
    string s;
    int p;
    cin >> s>>p;
    p[i] = make_pair(make_pair(s,-p),i+1);
  }
  sort(p,p+n);
  for(int i=0;i<n;++i) cout<<p[i].second<<endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:14:6: error: invalid types 'int[int]' for array subscript
   14 |     p[i] = make_pair(make_pair(s,-p),i+1);
      |      ^
a.cc:17:35: error: 'class std::set<std::pair<std::pair<std::__cxx11::basic_string<char>, int>, int> >' has no member named 'second'
   17 |   for(int i=0;i<n;++i) cout<<p[i].second<<endl;
      |                                   ^~~~~~
Language: C++

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

int main(){
  int n;
  cin >> n;
  pair<pair<string, int>, int> p[n]; 
  for (int i = 0; i < n; i++){
    string city;
    int score;
    cin >> city >> score;
    // cityは辞書順, scoreは降順-> -1*scoreに変換
    p[i] = make_pair(make_pair(city, -score), i+1);
  }
  sort(p, p+n);
  for　(int i = 0; i < n; i++)  cout << p[i].second << endl;
}

Compiler output:
a.cc:17:3: error: extended character 　 is not valid in an identifier
   17 |   for　(int i = 0; i < n; i++)  cout << p[i].second << endl;
      |   ^
a.cc: In function 'int main()':
a.cc:17:9: error: expected primary-expression before 'int'
   17 |   for　(int i = 0; i < n; i++)  cout << p[i].second << endl;
      |         ^~~
a.cc:17:20: error: 'i' was not declared in this scope
   17 |   for　(int i = 0; i < n; i++)  cout << p[i].second << endl;
      |                    ^
Language: C++

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

int main(){

  int n;
  cin >> n;
  vector<auto> city(n);
  rep(i,n){ int score,number;
            string s;
    		cin >> s >> score >> number;
            city.pushback(make_tuple(s,score*-1,number));
          }
  sort(city.begin(),city.end());
  rep(i,n) cout << get<2>(city.at(i)) << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:9:14: error: template argument 1 is invalid
    9 |   vector<auto> city(n);
      |              ^
a.cc:9:14: error: template argument 2 is invalid
a.cc:13:18: error: request for member 'pushback' in 'city', which is of non-class type 'int'
   13 |             city.pushback(make_tuple(s,score*-1,number));
      |                  ^~~~~~~~
a.cc:15:13: error: request for member 'begin' in 'city', which is of non-class type 'int'
   15 |   sort(city.begin(),city.end());
      |             ^~~~~
a.cc:15:26: error: request for member 'end' in 'city', which is of non-class type 'int'
   15 |   sort(city.begin(),city.end());
      |                          ^~~
a.cc:16:32: error: request for member 'at' in 'city', which is of non-class type 'int'
   16 |   rep(i,n) cout << get<2>(city.at(i)) << endl;
      |                                ^~
Language: C++

#!/usr/bin/python3
# -*- coding: utf-8 -*-

from operator import itemgetter, attrgetter

N = int(input())
#S = [0] * N
#P = [0] * N
score_chart = []
for i in range(N):
    array = list(input().strip().split())
    array.append(i+1)
    score_chart.append(array)
for i in range(N):
    score_chart[i][1] = int(score_chart[i][1])
s = sorted(score_chart, key=itemgetter(1),reverse=True)
s = sorted(s, key=itemgetter(0))

#print(score_chart)
for i in range(N):
    print(s[i][2])

Compiler output:
a.cc:1:2: error: invalid preprocessing directive #!
    1 | #!/usr/bin/python3
      |  ^
a.cc:2:3: error: invalid preprocessing directive #-
    2 | # -*- coding: utf-8 -*-
      |   ^
a.cc:7:2: error: invalid preprocessing directive #S
    7 | #S = [0] * N
      |  ^
a.cc:8:2: error: invalid preprocessing directive #P
    8 | #P = [0] * N
      |  ^
a.cc:19:2: error: invalid preprocessing directive #print
   19 | #print(score_chart)
      |  ^~~~~
a.cc:4:1: error: 'from' does not name a type
    4 | from operator import itemgetter, attrgetter
      | ^~~~
Language: C++

#include <bits/stdc++.h>
using namespace std;
 
int main(){
  int N;
  cin>>N;
  vector<tuple<string,int,int>>t(N);
  for(int i=0;i<N;i++){
    string s;
    int p;
    cin>>s>>p;
    p=100-p;
    t.at(i)=make_tuple(s,p,i);
  }
  sort(t.begin(),t.end());
  for(int i=0;i<N;i++){
    string s;
    int p,n;
    tie(s,p,n)=t.at(i);
    cout<<n+1<<endl;
  }

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

n=int(input())
z=[]
for i in range(n):
    z.append(input().split())
    z[i][1]=int(z[i][1])
    z[i].append(i+1)
z.sort()
#print(z)
for i in range(n-1):
    if z[i][0]==z[i+1][0]:
        if z[i][1]<z[i+1][1]:
            j=i
            while z[i+1][1]>z[j][1] and j>=0 and z[i+1][0]==z[j][0]:
                tmp=z[j][2]
                z[j][2]=z[i+1][2]
                z[i+1][2]=tmp
                j-=1
for k in range(n):
    print(z[k][2])
                

Compiler output:
a.cc:8:2: error: invalid preprocessing directive #print
    8 | #print(z)
      |  ^~~~~
a.cc:1:1: error: 'n' does not name a type
    1 | n=int(input())
      | ^
Language: Java

import java.util.Scanner;

class Rest {
	public String s;
	public int p;
	public int index;	
	public Rest left;
	public Rest right;
	
	public Rest(String s, int p, int i) {
		this.s = s;
		this.p = p;
		this.index = i;
		this.left = this.right = null;
	}
	public void show() {
		if(this.left != null) {
			this.left.show();
		}
		System.out.println(r.index);
		if(this.right != null) {
			this.right.show();
		}
	}
};


public class Main {
	public static int compare(String a, String b) 
	{
		for(int i = 0; i < a.length() && i < b.length(); i++) {
			if(a.charAt(i) < b.charAt(i)) {
				return -1;
			}
			if(a.charAt(i) > b.charAt(i)) {
				return 1;
			}
		}		
		if(a.length() == b.length()) {
			return 0;
		}
		if(a.length() < b.length()) {
			return -1;
		} else {
			return 1;
		}	
	}

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		String buf;
		int count = sc.nextInt();
		buf = sc.nextLine();
		Rest top = null;
		for(int i = 0; i < count; i++) {
			String s=sc.next();
			int p = sc.nextInt();			
			Rest r = new Rest( s , p , i+1 );
			if(top == null) {
				top = r;
			} else {
				Rest tmp = top;
				while(true) {
					int ans = compare( tmp.s , r.s );
					if(ans == 1) {
						if(tmp.left == null) {
							tmp.left = r;
							break;
						}
						tmp = tmp.left;
					} else {
						if(ans == -1) {
							if(tmp.right == null) {
								tmp.right = r;
								break;
							}
							tmp = tmp.right;
						} else {
							if(r.p > tmp.p ) {
								if(tmp.left == null) {
									tmp.left = r;
									break;
								}
								tmp = tmp.left;
							} else {
								if(tmp.right == null) {
									tmp.right = r;
									break;
								}
								tmp = tmp.right;
							}
						}
					}
				}
			}
		}
		top.show();
	}
}


Compiler output:
Main.java:20: error: cannot find symbol
		System.out.println(r.index);
		                   ^
  symbol:   variable r
  location: class Rest
1 error
Language: Java

import java.util.Scanner;

class Rest {
	public String s;
	public int p;
	public int index;	
	public Rest left;
	public Rest right;
	
	public Rest(String s, int p, int i) {
		this.s = s;
		this.p = p;
		this.index = i;
		this.left = this.right = null;
	}
	public void show() {
		if(this.left != null) {
			r.left.show();
		}
		System.out.println(r.index);
		if(r.right != null) {
			r.right.show();
		}
	}
};


public class Main {
	public static int compare(String a, String b) 
	{
		for(int i = 0; i < a.length() && i < b.length(); i++) {
			if(a.charAt(i) < b.charAt(i)) {
				return -1;
			}
			if(a.charAt(i) > b.charAt(i)) {
				return 1;
			}
		}		
		if(a.length() == b.length()) {
			return 0;
		}
		if(a.length() < b.length()) {
			return -1;
		} else {
			return 1;
		}	
	}

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		String buf;
		int count = sc.nextInt();
		buf = sc.nextLine();
		Rest top = null;
		for(int i = 0; i < count; i++) {
			String s=sc.next();
			int p = sc.nextInt();			
			Rest r = new Rest( s , p , i+1 );
			if(top == null) {
				top = r;
			} else {
				Rest tmp = top;
				while(true) {
					int ans = compare( tmp.s , r.s );
					if(ans == 1) {
						if(tmp.left == null) {
							tmp.left = r;
							break;
						}
						tmp = tmp.left;
					} else {
						if(ans == -1) {
							if(tmp.right == null) {
								tmp.right = r;
								break;
							}
							tmp = tmp.right;
						} else {
							if(r.p > tmp.p ) {
								if(tmp.left == null) {
									tmp.left = r;
									break;
								}
								tmp = tmp.left;
							} else {
								if(tmp.right == null) {
									tmp.right = r;
									break;
								}
								tmp = tmp.right;
							}
						}
					}
				}
			}
		}
		top.show();
	}
}


Compiler output:
Main.java:18: error: package r does not exist
			r.left.show();
			 ^
Main.java:20: error: cannot find symbol
		System.out.println(r.index);
		                   ^
  symbol:   variable r
  location: class Rest
Main.java:21: error: cannot find symbol
		if(r.right != null) {
		   ^
  symbol:   variable r
  location: class Rest
Main.java:22: error: package r does not exist
			r.right.show();
			 ^
4 errors