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

<?php
# 整数の入
fscanf(STDIN, "%d", $a);


$array = [];

for($i=0;$i <$a ; $i++){
# スペース区切りの整数の入力
// fscanf(STDIN,"%s %d", $array[$i]["city"], $array[$i]["no"]);
fscanf(STDIN,"%s %d", $b, $c);

$temp = [
        'city' => $b,
        'point' => $c,
        'id' => $i+1
                ];
array_push($array, $temp);
//echo    (print_r($temp));

}


//echo    (print_r($array));

foreach ($array as $key => $value) {
    $city[$key] = $value["city"];
    $no[$key] = $value["point"];
}
//
//array_multisort($array, SORT_ASC, $city);
array_multisort($city, SORT_ASC,
$no, SORT_DESC,
$array);

// echo    (print_r($array))

foreach ($array as $key => $value) {
    echo ($value['id']."\n");
}


# 文字列の入力
//fscanf(STDIN, "%s", $s);
//# 出力
//echo ($a+$b+$c)." ".$s."\n";
?>

Compiler output:
a.cc:2:3: error: invalid preprocessing directive #\U00006574\U00006570\U0000306e\U00005165
    2 | # 整数の入
      |   ^~~~~~~~
a.cc:9:3: error: invalid preprocessing directive #\U000030b9\U000030da\U000030fc\U000030b9\U0000533a\U00005207\U0000308a\U0000306e\U00006574\U00006570\U0000306e\U00005165\U0000529b
    9 | # スペース区切りの整数の入力
      |   ^~~~~~~~~~~~~~~~~~~~~~~~~~
a.cc:14:9: warning: multi-character character constant [-Wmultichar]
   14 |         'city' => $b,
      |         ^~~~~~
a.cc:15:9: warning: multi-character literal with 5 characters exceeds 'int' size of 4 bytes
   15 |         'point' => $c,
      |         ^~~~~~~
a.cc:16:9: warning: multi-character character constant [-Wmultichar]
   16 |         'id' => $i+1
      |         ^~~~
a.cc:39:18: warning: multi-character character constant [-Wmultichar]
   39 |     echo ($value['id']."\n");
      |                  ^~~~
a.cc:43:3: error: invalid preprocessing directive #\U00006587\U00005b57\U00005217\U0000306e\U00005165\U0000529b
   43 | # 文字列の入力
      |   ^~~~~~~~~~~~
a.cc:1:1: error: expected unqualified-id before '<' token
    1 | <?php
      | ^
a.cc:6:1: error: '$array' does not name a type
    6 | $array = [];
      | ^~~~~~
a.cc:8:1: error: expected unqualified-id before 'for'
    8 | for($i=0;$i <$a ; $i++){
      | ^~~
a.cc:8:10: error: '$i' does not name a type
    8 | for($i=0;$i <$a ; $i++){
      |          ^~
a.cc:8:19: error: '$i' does not name a type
    8 | for($i=0;$i <$a ; $i++){
      |                   ^~
a.cc:26:9: error: expected constructor, destructor, or type conversion before '(' token
   26 | foreach ($array as $key => $value) {
      |         ^
a.cc:32:16: error: expected constructor, destructor, or type conversion before '(' token
   32 | array_multisort($city, SORT_ASC,
      |                ^
a.cc:38:9: error: expected constructor, destructor, or type conversion before '(' token
   38 | foreach ($array as $key => $value) {
      |         ^
a.cc:47:1: error: expected unqualified-id before '?' token
   47 | ?>
      | ^
Language: C++

#include <bits/stdc++.h>

using namespace std;
struct ct
{
    string s;
    int score;
    int ma;
    operator < (struct ct x)
    {
        if(s!=x.s)
            return x.s>s;
        else
            return x.score<score;
    }
} a[200];

int main()
{
    int i,n;
    cin>>n;
    for(i=1; i<=n; i++)
    {
        cin>>a[i].s>>a[i].score;
        a[i].ma=i;
    }
    sort(a+1,a+1+n);
    for(i=1; i<=n; i++)
        cout<<a[i].ma<<endl;
    return 0;
}


Compiler output:
a.cc:9:5: error: ISO C++ forbids declaration of 'operator<' with no type [-fpermissive]
    9 |     operator < (struct ct x)
      |     ^~~~~~~~
Language: C++

#include<stdio.h>
#include<string.h>
int main(void){
  int n,i,j;
  scanf("%d",&n);
  char s[n][11],tmp[11];
  int p[n];
  for(i=0;i<n;i++){
    scanf("%s %d",s[n],&p[n]);
  }
  for(i=1;i<n;i++){
    for(j=1;j<n;j++){
      if(strcmp(s[j-1], s[j])>0){
        strcpy(tmp, s[j-1]);
        strcpy(s[j-1], s[j]);
        strcpy(s[j], tmp);
      }
    }
  }
  for (i=0;i<num;i++){
    printf("%d\n",i);
  }
  return 0;
}

  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:20:14: error: 'num' was not declared in this scope; did you mean 'enum'?
   20 |   for (i=0;i<num;i++){
      |              ^~~
      |              enum
a.cc: At global scope:
a.cc:26:3: error: expected unqualified-id before 'return'
   26 |   return 0;
      |   ^~~~~~
a.cc:27:1: error: expected declaration before '}' token
   27 | }
      | ^
Language: Java

import java.util.*;
import java.lang.*;
 class Soln{
	private String name;
	private int score;
    private int num ;
	
	public Soln(String name,int score,int num){
	this.name=name;
	this.score=score;
	this.num=num;
	}

	public int getScore(){
		return this.score;
	}

	public String getName(){
		return this.name;
	}

	public int getNum(){
		return this.num;
	}
}

public class Restaurant{
	public static void main(String args[]){
	Scanner sc = new Scanner(System.in);
	int n = sc.nextInt();
	int pos = 0;
	List<Soln> rest = new ArrayList<Soln>();
	for(int i =1;i<=n;i++){
	String name = sc.next();
	int score = sc.nextInt();
	rest.add(new Soln(name,score,pos));
	pos+=1;
	}

	Comparator<Soln>com = new Comparator<Soln>(){
            @Override
            public int compare(Soln s1,Soln s2){
                if(s1.getName().compareTo(s2.getName()) < 0)
                return 1;
                else if(s1.getName()==s2.getName()){
                    
                    return (s1.getScore()>s2.getScore())?1:-1;
                    
                    
                }
                else
                return -1;   
        }
        };


        Collections.sort(rest,com);
        for(Soln st: rest){
System.out.println(st.getNum());		}
	
	}
}

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

n = int(input())
sp = []
for i in range(n):
        sp.append(input().split())
for i in range(n):
        sp[i][1] = int(sp[i][1])
for i in range(n):
        sp[i].append(i+1)
sp.sort()
start = 0
sp2=[]
for i in range(n-1):
        if sp[i][0] != sp[i+1][0]:
                sp2 = sp2+sorted(sp[start:i+1],key = lambda x:x[1],reverse = True)
                start = i+1
sp2 = sp2+sorted(sp[start:],key = lambda x:x[1],reverse = True)
print(sp2)
for i in range(n):
        print(sp2[i][2])

Compiler output:
a.cc:1:1: error: 'n' does not name a type
    1 | n = int(input())
      | ^
Language: C++

#include <bits/stdc++.h>

using namespace std;
struct ct
{
    string s;
    int score;
    int ma;
    operator <(struct ct x)
    {
        if(s!=x.s)
            return x.s>s;
        else
            return x.score<score;
    }
} a[200];

int main()
{
    int i,n;
    cin>>n;
    for(i=1; i<=n; i++)
    {
        cin>>a[i].s>>a[i].score;
        a[i].ma=i;
    }
    sort(a+1,a+1+n);
    for(i=1; i<=n; i++)
        cout<<a[i].ma<<endl;
    return 0;
}


Compiler output:
a.cc:9:5: error: ISO C++ forbids declaration of 'operator<' with no type [-fpermissive]
    9 |     operator <(struct ct x)
      |     ^~~~~~~~
Language: C++

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

int main(void){
  int n;
  vector<tuple<string, int, int>> v;
  cin >> n;
  for(int i = 1;i<=n;i++){
    string c;
    int p;
    cin >> c >> p;
    v.push_back(make_tuple(c, p, i));
  }
  sort(v.begin(), v.end(), []( auto & a, auto & b )
        {
          if(get<0>(a) == get<0>(b)) return get<1>(a) > get<1>(b);
          else return get<0>(a) < get<0>(b);
        });
  for(auto a : v){
    cout << get<2>(a) << endl;
  }
  return 0;
}

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

#include <iostream>
#include <algorithm>
#include <vector>

using namespace std;

bool mycompare( const tuple<std::string, int, int> &lhs, const tuple<std::string, int, int> &rhs )
{
  if (std::get<0>(lhs) != std::get<0>(rhs)) return std::get<0>(lhs) < std::get<0>(rhs);
  if (std::get<1>(lhs) != std::get<1>(rhs)) return std::get<1>(lhs) > std::get<1>(rhs);
  return std::get<2>(lhs) < std::get<2>(rhs);
}


int main() {
  int n;
  cin >> n;

  vector< tuple <std::string, int, int> > r;
  for (int i = 0; i < n; i++) {
    std::string s;
    int p;
    cin >> s >> p;
    r.push_back(make_tuple(s, p, i+1));
  }

  sort(r.begin(), r.end(), mycompare);

  for (int i = 0; i < n; i++) {
    cout << get<2>(r[i]) << "\n";
  }
}


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

#include <cstdio>
#include <string>
#include <vector>
using namespace std;
static const int INFTY = (1 << 20);

int n;

struct Restrant
{
  string locate;
  int ten;
  int num;

  Restrant(string n, int t, int k)
  {
    locate = n;
    ten = t;
    num = k;
  }
};

bool cmp(const Restrant &a, const Restrant &b)
{
  if (strcmp(a.locate.c_str(), b.locate.c_str()) < 0)
  {
    return true;
  }
  else if (strcmp(a.locate.c_str(), b.locate.c_str()) > 0)
  {
    return false;
  }
  else
  {
    return a.ten > b.ten;
  }
}

int main()
{

  scanf("%d", &n);
  int p;
  string s[n];
  char text[50];
  std::vector<Restrant> res;
  for (int i = 0; i < n; i++)
  {
    scanf("%s %d", text, &p);
    res.push_back(Restrant(text, p, i + 1));
  }
  sort(res.begin(), res.end(), cmp);
  for (int i = 0; i < n; i++)
  {
    printf("%d\n", res[i].num);
    //printf("%s %d %d\n", res[i].locate.c_str(), res[i].ten, res[i].num);
  }
  return 0;
}

Compiler output:
a.cc: In function 'bool cmp(const Restrant&, const Restrant&)':
a.cc:25:7: error: 'strcmp' was not declared in this scope
   25 |   if (strcmp(a.locate.c_str(), b.locate.c_str()) < 0)
      |       ^~~~~~
a.cc:4:1: note: 'strcmp' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
    3 | #include <vector>
  +++ |+#include <cstring>
    4 | using namespace std;
a.cc: In function 'int main()':
a.cc:52:3: error: 'sort' was not declared in this scope; did you mean 'short'?
   52 |   sort(res.begin(), res.end(), cmp);
      |   ^~~~
      |   short
a.cc: In function 'bool cmp(const Restrant&, const Restrant&)':
a.cc:37:1: warning: control reaches end of non-void function [-Wreturn-type]
   37 | }
      | ^
Language: C++

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

struct shop{
    int idx;
    string s;
    int p;

    shop(int inputed_index, string inputed_s, int inputed_p){
        idx = inputed_index;
        s = inputed_s;
        p = inputed_p;
    }

    bool operator<(const shop &cmp)const{
        return s==cmp.s ? p<cmp.p : s<cmp.s;
    }
}

int main() {
	int n;
    vector<shop> shops;
    cin >> n;
    for(int i=0; i<n; i++){
        string str;
        int point;
        cin >> str >> point;
        shops[i] = shop(i+1, str, point);
    }
    sort(shops.begin(),shops.end());
  
    for(int i=0; i<n; i++){
      cout << shops[i].idx << endl;
    }
  
    return 0;
}


Compiler output:
a.cc:18:2: error: expected ';' after struct definition
   18 | }
      |  ^
      |  ;
Language: C

#include<stdio.h>

int main(void)
{
    int N;
    char S[100][20],tmp[20];
    int P[100],temp;
    int ans[100];

    scanf("%d",&N);

    int i,j;
    for(i=0;i<N;i++){
        scanf("%s",S[i]);
        scanf("%d",&P[i]);
        ans[i]=0;
        ans[i]=i+1;
    }

    for(i=1;i<N;i++){
        for(j=1;j<N;j++){
            if(strncmp(S[j-1],S[j])>0){
                strcpy(tmp, S[j-1]);
                strcpy(S[j-1], S[j]);
                strcpy(S[j], tmp);
                temp=ans[j-1];
                ans[j-1]=ans[j];
                ans[j]=temp;
            }
        }
    }

    for(i=1;i<N;i++){
        for(j=1;j<N;j++){
            if(strncmp(S[j-1],S[j])==0 && P[j-1]<P[j]){
                temp=P[j-1];
                P[j-1]=P[j];
                P[j]=temp;
                temp=ans[j-1];
                ans[j-1]=ans[j];
                ans[j]=temp;
            }
        }
    }

    for (i=0;i<N;i++){
        printf("%d\n",ans[i]);
    }
    return 0;
}

Compiler output:
main.c: In function 'main':
main.c:22:16: error: implicit declaration of function 'strncmp' [-Wimplicit-function-declaration]
   22 |             if(strncmp(S[j-1],S[j])>0){
      |                ^~~~~~~
main.c:2:1: note: include '<string.h>' or provide a declaration of 'strncmp'
    1 | #include<stdio.h>
  +++ |+#include <string.h>
    2 | 
main.c:22:16: warning: too few arguments to built-in function 'strncmp' expecting 3 [-Wbuiltin-declaration-mismatch]
   22 |             if(strncmp(S[j-1],S[j])>0){
      |                ^~~~~~~
main.c:23:17: error: implicit declaration of function 'strcpy' [-Wimplicit-function-declaration]
   23 |                 strcpy(tmp, S[j-1]);
      |                 ^~~~~~
main.c:23:17: note: include '<string.h>' or provide a declaration of 'strcpy'
main.c:23:17: warning: incompatible implicit declaration of built-in function 'strcpy' [-Wbuiltin-declaration-mismatch]
main.c:23:17: note: include '<string.h>' or provide a declaration of 'strcpy'
main.c:35:16: warning: too few arguments to built-in function 'strncmp' expecting 3 [-Wbuiltin-declaration-mismatch]
   35 |             if(strncmp(S[j-1],S[j])==0 && P[j-1]<P[j]){
      |                ^~~~~~~
Language: C

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

int main(void){
  int n;
  
  scanf("%d",&n);
  
  char shop[n][12];
  int ten[n];
  int ans[n] = {0};
  
  for(int i = 0; i < n; i++){
    scanf("%s %d", shop[i], &ten[i]);
    if(i == 0){
      ans[i] = 1;
    }
    else{
      ans[i] = 1;
      for(int j = i; j > 0; j--){
        if(strcmp(shop[j - 1], shop[j]) > 0){
          ans[j - 1] += 1;
        }
        else if(strcmp(shop[j - 1], shop[j]) == 0 && ten[j - 1] < ten[j]){
          ans[j - 1] += 1;
        }
        else{
          ans[i] += 1;
        }
      }
    }
  }
    
   for(int i = 0; i < n; i++){
     printf("%d\n", ans[i]);
   }
 }

Compiler output:
main.c: In function 'main':
main.c:11:16: error: variable-sized object may not be initialized except with an empty initializer
   11 |   int ans[n] = {0};
      |                ^
Language: C++

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

struct shop{
    int idx;
    string s;
    int p;

    shop(int inputed_index, string inputed_s, int inputed_p){
        idx = inputed_index;
        s = inputed_s;
        p = inputed_p;
    }

    bool operator<(const shop &cmp)const{
        return s==cmp.s ? p<cmp.p : s<cmp.s;
    }
}

int main() {
	int n;
    vector<shop> shops;
    cin >> n;
    for(int i=0; i<n; i++){
        string str;
        int point;
        cin >> str >> point;
        shops[i] = (i+1, str, point);
    }
    sort(shops.begin(),shops.end());
  
    for(int i=0; i<n; i++){
      cout << shops[i].idx << endl;
    }
  
    return 0;
}


Compiler output:
a.cc:18:2: error: expected ';' after struct definition
   18 | }
      |  ^
      |  ;
a.cc: In function 'int main()':
a.cc:28:36: error: no match for 'operator=' (operand types are '__gnu_cxx::__alloc_traits<std::allocator<shop>, shop>::value_type' {aka 'shop'} and 'int')
   28 |         shops[i] = (i+1, str, point);
      |                                    ^
a.cc:4:8: note: candidate: 'shop& shop::operator=(const shop&)'
    4 | struct shop{
      |        ^~~~
a.cc:4:8: note:   no known conversion for argument 1 from 'int' to 'const shop&'
a.cc:4:8: note: candidate: 'shop& shop::operator=(shop&&)'
a.cc:4:8: note:   no known conversion for argument 1 from 'int' to 'shop&&'
Language: C++

#include <iostream>
#include <map>
#include <string>
#include <vector>

using namespace std;

struct restaurant_t {
    int num = 0;
    int score;
};

struct city_t {
    vector<restaurant_t>  restaurants;
};

bool restaurantComparer(restaurant_t a, restaurant_t b)
{
    return (a.score > b.score);
}

int main(int argc, const char * argv[]) {
    int N = 0;
    cin >> N;
    //vector<city_t> cities;
    map<string, city_t> city_map;
    
    for(int i = 0; i < N; i++) {
        string name;
        int score;
        cin >> name >> score;
        //city_t city = {i+1, name, score};
        restaurant_t restaurant = {i+1, score};
        city_map[name].restaurants.push_back(restaurant);
    }
    
    for(auto p : city_map) {
        sort(p.second.restaurants.begin(), p.second.restaurants.end(), restaurantComparer);
        for(auto r : p.second.restaurants) {
            cout << r.num << endl;
        }
    }
    return 0;
}


Compiler output:
a.cc: In function 'int main(int, const char**)':
a.cc:38:9: error: 'sort' was not declared in this scope; did you mean 'short'?
   38 |         sort(p.second.restaurants.begin(), p.second.restaurants.end(), restaurantComparer);
      |         ^~~~
      |         short
Language: Java

import javax.crypto.Cipher;
import java.util.*;

public class Main190526_3 {
    public static void main(String args[]){
        List<City> cityList = new ArrayList<>();

        List<City> cityList2 = new ArrayList<>();
        Scanner scanner = new Scanner(System.in);
        try{
            int n = scanner.nextInt();
            for(int i = 0;i<n;i++) {
                String city = scanner.next();
                int score = scanner.nextInt();
                cityList.add(new City(city,score));
                cityList2.add(new City(city,score));
            }
            cityList.sort(new CityComparater());
        for(int i = 0 ; i<n; i++){
            System.out.println(cityList2.indexOf(cityList.get(i))+1);
        }
        }catch(Exception e){
            System.out.println(e.getMessage());
        }finally{
            scanner.close();
        }
    }
}

class CityComparater implements Comparator<City>{
    @Override
    public int compare(City city1,City city2){
        if(city1.name.compareTo(city2.name)==0) return city1.score > city2.score ? -1:1;
        return city1.name.compareTo(city2.name);
    }
}
class City{
    String name;
    int score;
    City(String name, int score){
        this.name = name;
        this.score = score;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;
        City city = (City) o;
        return score == city.score &&
                Objects.equals(name, city.name);
    }

    @Override
    public int hashCode() {
        return Objects.hash(name, score);
    }
}


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

N = int(input())

S = []


for i in range(N):
	a,b = map(str, input().split())
	c = int(b)
	S.append([i, a, c])

S.sort(key=lambda x:(x[1],-x[2]))

for i in range(N):
	print(S[i][0]+1)


Compiler output:
a.cc:1:1: error: 'N' does not name a type
    1 | N = int(input())
      | ^
Language: C++

#include <iostream>
#include <vector>
#include <string>
#include <bitset>
#include <cmath>
#include <iomanip>
#include <stack>
#include <queue>
using namespace std;

#define INF 1e18
#define int long long

struct sp {
    int idx, p;
    string s;
    bool operator<(const sp& another) const {
        if(s != another.s) return s < another.s;
        return p > another.p;
    }
};

signed main() {
    int n; cin >> n;
    vector<sp> vec(n); for(int i = 0; i < n; i++) {
        vec[i].idx = i + 1;
        cin >> vec[i].s >> vec[i].p;
    }

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

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

    return 0;
}


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

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

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

struct arr{
    string name;  // 名前
    int    point; // 価格
    int num;
};

vector<arr> arrs;
int main(){
    int n = 0;
    int b;
    string a;
    cin  >> n;
    rep(i,n){
        cin >> a >> b;
        arrs.push_back({a,b,i+1});
    }
    sort(arrs.begin(), arrs.end(), 
     [](const arr& x, const arr& y) { return x.name < y.name||(x.name==y.name)&(x.point > y.point);});
    rep(i,n){
        cout << arrs[i].num << endl;
    }
}

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

#include <iostream>

using namespace std;

struct Info1
{
        std::string name;
        int point;
        int num;

        bool operator<(const Info1 &another) const
        {
                return point > another.point;
        };

};

struct Info2
{
        std::string name;
        int point;
        int num;

        bool operator<(const Info2 &another) const
        {
                return name < another.name;
        };

};

int main(){
        int n;
        Info1 info1[101];
        Info2 info2[101];
        cin>>n;
        for(int i=0; i<n; i++){
                cin>>info1[i].name>>info1[i].point;
                info1[i].num=i+1;
        }
        sort(info1,info1+n);
        for(int i=0; i<n; i++){
                info2[i].name=info1[i].name;
                info2[i].point=info1[i].point;
                info2[i].num=info1[i].num;
        }
        sort(info2,info2+n);

        for(int i=0; i<n; i++) cout<<info2[i].num<<endl;
        return 0;
}

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

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

int main(){
    int list[100]={0};
  int i, j;
 
  /* 文字列の数 */
  int num;
scanf("%d",&num);
  /* 文字列 */
  int score[100];
  int sort[100];
  char moji[100][100], tmp[100];
  int test;
 
  /* 3つの文字列を入力 */
  for (i=0;i<num;i++) {
      sort[i]=i;
    scanf("%s %d\n", moji[i],score[i]);
  }
 
  for(i=1;i<num;i++){
    for(j=1;j<num;j++){
      if(strcmp(moji[j-1], moji[j])>0){
          if(score[j-1]>score[j]){
            strcpy(tmp, moji[j-1]);
            strcpy(moji[j-1], moji[j]);
            strcpy(moji[j], tmp);
            test=score[j];
            score[j-1]=score[j];
            score[j-1]=test;
            test=sort[j];
            sort[j-1]=sort[j];
            sort[j-1]=test;

          }

      }
    }
  }
 
  for (i=0;i<num;i++)
    printf("%d\n", sort[i]);
 
  return 0;

}


Compiler output:
a.cc: In function 'int main()':
a.cc:25:10: error: 'strcmp' was not declared in this scope
   25 |       if(strcmp(moji[j-1], moji[j])>0){
      |          ^~~~~~
a.cc:3:1: note: 'strcmp' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
    2 | #include <stdlib.h>
  +++ |+#include <cstring>
    3 | 
a.cc:27:13: error: 'strcpy' was not declared in this scope
   27 |             strcpy(tmp, moji[j-1]);
      |             ^~~~~~
a.cc:27:13: note: 'strcpy' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
Language: C++

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

bool comp(pair<string, int> g1, pair<string, int> g2){
	if(g1.first<g2.first){
		return true;
	}
	return false;
}
bool comp1(pair<string, int> g1, pair<string, int> g2){
	if(g1.fisrt == g2.first && g1.second>g2.second){
		return true;
	}
	return false;
}
int main(){
	int n;
	cin>>n;
	vector<pair <string, int>>arr(n);
		vector<pair <string, int>>arr1(n);
	for(int i=0 ;i<n; i++){
		string p; int n1;
		cin>>p>>n1;
		pair<string, int> g1 = make_pair(p,n);
		arr[i] = g1;
		arr1[i] = g1;
	}
	sort(arr.begin(), arr.end(), comp);
	sort(arr.begin(), arr.end(), comp1);
	for(int i=0 ;i<n; i++){
		for(int j=0; j<n; j++){
			if(arr[i].first==arr1[j].fisrt && arr[i].second == arr1[j].second){
				cout<<j<<"\n";
				break;
			}
		}	}
	return 0;
}

Compiler output:
a.cc: In function 'bool comp1(std::pair<std::__cxx11::basic_string<char>, int>, std::pair<std::__cxx11::basic_string<char>, int>)':
a.cc:11:15: error: 'struct std::pair<std::__cxx11::basic_string<char>, int>' has no member named 'fisrt'; did you mean 'first'?
   11 |         if(g1.fisrt == g2.first && g1.second>g2.second){
      |               ^~~~~
      |               first
a.cc: In function 'int main()':
a.cc:32:50: error: '__gnu_cxx::__alloc_traits<std::allocator<std::pair<std::__cxx11::basic_string<char>, int> >, std::pair<std::__cxx11::basic_string<char>, int> >::value_type' {aka 'struct std::pair<std::__cxx11::basic_string<char>, int>'} has no member named 'fisrt'; did you mean 'first'?
   32 |                         if(arr[i].first==arr1[j].fisrt && arr[i].second == arr1[j].second){
      |                                                  ^~~~~
      |                                                  first
Language: C++

#include <bits/stdc++.h>
#include <numeric>
#include<iostream>
#include<vector>
#include<algorithm>
using namespace std;

int main(){
    int n,s,p;
    cin >> n;
    vector<pair<string,int>> r(n),c(n);
    c[i].second=0;
    for(int i=0;i<n;i++){
        cin >> s >> p;
        r[i].first=s;
        r[i].second=-1*p;
        c[i].first=s;
        c[i].second++;
    }
    sort(r.begin(),r.end());
    for(int i=0;i<n;i++){
        for(int j=0;j<n;j++){
            if(r[i].first==c[j].first){
                cout << c[j].second << endl;
            }
        }
    }
}


Compiler output:
a.cc: In function 'int main()':
a.cc:12:7: error: 'i' was not declared in this scope
   12 |     c[i].second=0;
      |       ^
Language: C++

#include <iostream>
#include <string>
#include <vector>
#include <queue>

using namespace std;


struct Toshi {
    string name;
    int value;
    int index;
};

bool pairToshi(const Toshi& firstElof, const Toshi& secondElof)
{
    return firstElof.name < secondElof.name;
}

typedef pair<int, int> Pr;

int main() {
    int N; cin >> N;
    vector<Toshi> R(N);

    string toshi;
    int value;

    for(int i=0; i<N; i++) {
        cin >> toshi >> value;
        struct Toshi t;
        t.name = toshi;
        t.index = i+1;
        t.value = value;
        R[i] = t;
    }

    sort(R.begin(), R.end(), pairToshi);


    priority_queue<Pr> A;
    string now_toshi = R[0].name;
    for(int i=0; i<N; i++) {
        if(now_toshi != R[i].name) {
            while(A.size() > 0) {
                cout << A.top().second << endl;
                A.pop();
            }
        }
        A.push(make_pair(R[i].value, R[i].index));
        now_toshi = R[i].name;
    }

    while(A.size() > 0) {
        cout << A.top().second << endl;
        A.pop();
    }

    return 0;
}



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

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


using namespace std;


typedef struct _data{
public:string first;
public:int second;
public:int third;
}Data;

bool compare(Data a,Data b);


bool compare(Data a,Data b) {
    if(a.first != b.first){
        return a.first < b.first;
    }else{
        return a.second > b.second;
    }
}

int main() {
    int n,i,j;
    cin>>n;
    vector<Data> pairs(n);
    for(i=0;i<n;i++){
        cin>>pairs[i].first>>pairs[i].second;
        pairs[i].third=i+1;
    }
    sort(pairs.begin(),pairs.end(),compare);

    for(Data tmp:pairs){
        cout<< tmp.third << 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 'short'?
   35 |     sort(pairs.begin(),pairs.end(),compare);
      |     ^~~~
      |     short
Language: C++

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

//Guidebook
struct rest{
	int id;
	string place;
	int score;
 	rest(int i,string p, int s){
 		id = i;
		place = p;
		score = s;
 	}
};

bool cmp(const rest &a, const rest &b){
	if(a.place !=  b.place){
		return a.place < b.place;
	}else{
		return a.score > b.score;
	}
}
int main(){
	int n;
	cin >> n;
	vector<rest> rests;
	for(int i=0;i<n;i++){
		string place_i;
		int score_i;
		cin >> place_i >> score_i;
		rests.push_back(rest(i+1,place_i,score_i));
	}
	sort(rests.begin(),rests.end(),cmp);
	for(int i= 0;i<n;i++){
		cout << rests[i].id << endl;
	}
	return 0;
}


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

#include <stdio.h>
#include <iostream>
#include <stdlib.h>
#include <string.h>
#include <math.h>
#include <time.h>
#include <algorithm>
#include <vector>
#include <string>

using namespace std;

class Person
{
	public:
		string name;
		int score;
		int idx;
		Person(string name, int score, int idx)
		{
			this->name = name;
			this->score = score;
			this->idx = idx;
		}
};

bool compare(Person &a, Person &b)
{
	if (a.name == b.name)
		return a.score < b.score;
	else
		return a.name > b.name;
}
int main()
{
	char tmp[11];
	int n, tsc;
	vector<Person> v;

	scanf("%d", &n);

	for (int i = 0; i < n; i++)
	{
		scanf("%s %d", &tmp, &tsc);

		v.push_back(Person(tmp, tsc, i+1));
	}

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

	for (int i = n - 1; i >= 0; i--)
		cout << v[i].idx << endl;

	return 0;
}

Compiler output:
main.c:2:10: fatal error: iostream: No such file or directory
    2 | #include <iostream>
      |          ^~~~~~~~~~
compilation terminated.
Language: C++

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


using namespace std;


class Data{
public:string first;
public:int second;
public:int third;
};

bool compare(Data a,Data b);


bool compare(Data a,Data b) {
    if(a.first != b.first){
        return a.first < b.first;
    }else{
        return a.second > b.second;
    }
}

int main() {
    int n,i,j;
    cin>>n;
    vector<Data> pairs(n);
    for(i=0;i<n;i++){
        cin>>pairs[i].first>>pairs[i].second;
        pairs[i].third=i+1;
    }
    sort(pairs.begin(),pairs.end(),compare);

    for(Data tmp:pairs){
        cout<< tmp.third << 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 'short'?
   35 |     sort(pairs.begin(),pairs.end(),compare);
      |     ^~~~
      |     short
Language: C++

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

using namespace std;
typedef long long ll;

int main() {
  int n;
  cin >> n;
  vector<pair<string,int>> res;
  vector<int> memo;
  rep(i,n){
    int tmp,tmp1;
    cin >> tmp >> tmp1;
    res[i].first=tmp;
    res[i].second=tmp1;
    memo[tmp1]=i;
  }
  int kaisuu=1;
  while(kaisuu!=0){
    kaisuu=0;
    rep(i,n-1){
      if(strcmp(res[i].first,res[i+1].first)==0){
        if(res[i].second>res[i+1].second){
          continue;
        }
        else{
          auto tmp=res[i];
          res[i]=res[i+1];
          res[i+1]=tmp;
          kaisuu=1;
        }
      }
      else if(strcmp(res[i].first,res[i+1].first)>0){
        continue;
      }
      else{
        auto tmp=res[i];
        res[i]=res[i+1];
        res[i+1]=tmp;
        kaisuu=1;
      }
    }
  }
  rep(i,n){
    cout << memo[res[i].second] << endl;
  }
}


Compiler output:
a.cc: In function 'int main()':
a.cc:24:24: error: cannot convert 'std::__cxx11::basic_string<char>' to 'const char*'
   24 |       if(strcmp(res[i].first,res[i+1].first)==0){
In file included from /usr/include/c++/14/cstring:43,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:121,
                 from a.cc:1:
/usr/include/string.h:156:32: note:   initializing argument 1 of 'int strcmp(const char*, const char*)'
  156 | extern int strcmp (const char *__s1, const char *__s2)
      |                    ~~~~~~~~~~~~^~~~
a.cc:35:29: error: cannot convert 'std::__cxx11::basic_string<char>' to 'const char*'
   35 |       else if(strcmp(res[i].first,res[i+1].first)>0){
/usr/include/string.h:156:32: note:   initializing argument 1 of 'int strcmp(const char*, const char*)'
  156 | extern int strcmp (const char *__s1, const char *__s2)
      |                    ~~~~~~~~~~~~^~~~
Language: C++

#include<math.h>
#include<vector>
#include<algorithm>
#include<string.h>
using namespace std;
#define rep(i,n) for(int i=0;i<n;i++)
typedef long long ll;
class R{
	public:
		int id;
		string name;
		int v;
		R(){};
		R(int a,string s,int b):id(a),name(s),v(b){};
		bool operator <(const R &r)const{
			return (name<r.name)||(name==r.name&&v>r.v);
		}
};
int main(){
	int n;
	cin>>n;
	vector<R> hoge(n);
	string s;
	int p;
	rep(i,n){
		cin>>s>>p;
		R tmp(i+1,s,p);
		hoge[i]=tmp;
	}
	sort(hoge.begin(),hoge.end());
	//reverse(hoge.begin(),hoge.end());
	rep(i,n){
		cout<<hoge[i].id<<endl;
	}


	return 0;
}

Compiler output:
a.cc:11:17: error: 'string' does not name a type
   11 |                 string name;
      |                 ^~~~~~
a.cc:14:25: error: 'string' has not been declared
   14 |                 R(int a,string s,int b):id(a),name(s),v(b){};
      |                         ^~~~~~
a.cc: In constructor 'R::R(int, int, int)':
a.cc:14:47: error: class 'R' does not have any field named 'name'
   14 |                 R(int a,string s,int b):id(a),name(s),v(b){};
      |                                               ^~~~
a.cc: In member function 'bool R::operator<(const R&) const':
a.cc:16:33: error: 'name' was not declared in this scope
   16 |                         return (name<r.name)||(name==r.name&&v>r.v);
      |                                 ^~~~
a.cc:16:40: error: 'const class R' has no member named 'name'
   16 |                         return (name<r.name)||(name==r.name&&v>r.v);
      |                                        ^~~~
a.cc:16:56: error: 'const class R' has no member named 'name'
   16 |                         return (name<r.name)||(name==r.name&&v>r.v);
      |                                                        ^~~~
a.cc: In function 'int main()':
a.cc:21:9: error: 'cin' was not declared in this scope
   21 |         cin>>n;
      |         ^~~
a.cc:5:1: note: 'std::cin' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
    4 | #include<string.h>
  +++ |+#include <iostream>
    5 | using namespace std;
a.cc:23:9: error: 'string' was not declared in this scope
   23 |         string s;
      |         ^~~~~~
a.cc:5:1: note: 'std::string' is defined in header '<string>'; this is probably fixable by adding '#include <string>'
    4 | #include<string.h>
  +++ |+#include <string>
    5 | using namespace std;
a.cc:26:22: error: 's' was not declared in this scope
   26 |                 cin>>s>>p;
      |                      ^
a.cc:33:17: error: 'cout' was not declared in this scope
   33 |                 cout<<hoge[i].id<<endl;
      |                 ^~~~
a.cc:33:17: note: 'std::cout' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
a.cc:33:35: error: 'endl' was not declared in this scope
   33 |                 cout<<hoge[i].id<<endl;
      |                                   ^~~~
a.cc:5:1: note: 'std::endl' is defined in header '<ostream>'; this is probably fixable by adding '#include <ostream>'
    4 | #include<string.h>
  +++ |+#include <ostream>
    5 | using namespace std;
Language: C++

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


using namespace std;


class Data{
public:string first;
public:int second;
public:int third;
};
bool compare(Data a,Data b) {
    if(a.first != b.first){
        return a.first < b.first;
    }else{
        return a.second > b.second;
    }
}

int main() {
    int n,i,j;
    cin>>n;
    vector<Data> pairs(n);
    for(i=0;i<n;i++){
        cin>>pairs[i].first>>pairs[i].second;
        pairs[i].third=i+1;
    }
    sort(pairs.begin(),pairs.end(),compare);

    for(Data tmp:pairs){
        cout<< tmp.third << endl;
    }



    return 0;
}


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

#include<iostream>
using namespace std;
struct note{
  string s;
  int m;
  int t;
}a[10000];
int cmp(int a, int b){
  if(a.s>b.s)
    return a>b;
  if(a.s<b.s)
    return a<b;
  if(a.m>b.m)
    return a>b;
    if(a.m<b.m)
      return a<b;
}
int main()
{
  int n;
  cin>>n;
  for(int i=1;i<=n;i++)
  {
    cin>>a[i].s>>a[i].m;
    a[i].t=i;
  }
  sort(a+1,a+1+n,cmp);
  for(int i=1;i<=n;i++)
	cout<<a[i].t<<endl;;
      return 0;
}

Compiler output:
a.cc: In function 'int cmp(int, int)':
a.cc:9:8: error: request for member 's' in 'a', which is of non-class type 'int'
    9 |   if(a.s>b.s)
      |        ^
a.cc:9:12: error: request for member 's' in 'b', which is of non-class type 'int'
    9 |   if(a.s>b.s)
      |            ^
a.cc:11:8: error: request for member 's' in 'a', which is of non-class type 'int'
   11 |   if(a.s<b.s)
      |        ^
a.cc:11:12: error: request for member 's' in 'b', which is of non-class type 'int'
   11 |   if(a.s<b.s)
      |            ^
a.cc:13:8: error: request for member 'm' in 'a', which is of non-class type 'int'
   13 |   if(a.m>b.m)
      |        ^
a.cc:13:12: error: request for member 'm' in 'b', which is of non-class type 'int'
   13 |   if(a.m>b.m)
      |            ^
a.cc:15:10: error: request for member 'm' in 'a', which is of non-class type 'int'
   15 |     if(a.m<b.m)
      |          ^
a.cc:15:14: error: request for member 'm' in 'b', which is of non-class type 'int'
   15 |     if(a.m<b.m)
      |              ^
a.cc: In function 'int main()':
a.cc:27:3: error: 'sort' was not declared in this scope; did you mean 'short'?
   27 |   sort(a+1,a+1+n,cmp);
      |   ^~~~
      |   short
a.cc: In function 'int cmp(int, int)':
a.cc:17:1: warning: control reaches end of non-void function [-Wreturn-type]
   17 | }
      | ^
Language: C++

#include <iostream>

using namespace std;

bool cmp(pair<string, pair<int,int> > a, pair<string, pair<int,int> > b){
  if(a.first != b.first){
    return a.first < b.first;
  }
  else {
    return a.second.second > b.second.second;
  }
}

int main(){
  int n;
  pair<string, pair<int,int> > list[100];
  string s;
  int p;
  cin >> n;
  for(int i = 0; i < n; i++){
    cin >> s >> p;
    list[i] = make_pair(s, make_pair(i+1,p));
  }
  sort(list,list + n, cmp);
  for(int i = 0; i < n; i++){
    cout << list[i].second.first << endl;
  }
  return 0;
}


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

#include <bits/stdc++.h>

using std::cin;
using std::cout;
using std::vector;
using std::string;
using std::pair;

int main() {
  int n;
  cin >> n;
  
  vector<pair<string, int>> restaurants(n);
  vector<int> indices(n);
  for (int i = 0; i < n; ++i) {
    cin >> restaurants[i].first >> restaurants[i].second;
    restaurants[i] *= -1;
    indices[i] = i;
  }
  
  sort(indices.begin(), indices.end(), [&](int i, int j) {
    return restaurants[i] < restaurants[j]; 
  });
  for (int idx : indices) {
    cout << idx << "\n";
  }
}

Compiler output:
a.cc: In function 'int main()':
a.cc:17:20: error: no match for 'operator*=' (operand types are '__gnu_cxx::__alloc_traits<std::allocator<std::pair<std::__cxx11::basic_string<char>, int> >, std::pair<std::__cxx11::basic_string<char>, int> >::value_type' {aka 'std::pair<std::__cxx11::basic_string<char>, int>'} and 'int')
   17 |     restaurants[i] *= -1;
Language: C++

#include <iostream>
#include <cstdint>
#include <cmath>
#include <vector>
#include <map>
#include <set>
#include <string>

using namespace std;

struct data_t {
    string loc;
    int score;
    int number;
};

int main()
{
    int n;
    cin >> n;
    vector<data_t> rs(n);
    for(int i = 0; i < n; ++i)
    {
        cin >> rs[i].loc >> rs[i].score;
        rs[i].number = i+1;
    }
    sort(begin(rs), end(rs), [](const data_t& x, const data_t& y){
        if(x.loc != y.loc) return x.loc <= y.loc;
        return x.score > y.score;
    });
    for(const auto& r : rs)
    {
        cout << /*r.loc << ' ' << r.score << ' ' <<*/ r.number << '\n';
    }
    return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:27:5: error: 'sort' was not declared in this scope; did you mean 'sqrt'?
   27 |     sort(begin(rs), end(rs), [](const data_t& x, const data_t& y){
      |     ^~~~
      |     sqrt
Language: C++

#include <bits/stdc++.h>
using namespace std;
bool ope(pair<int,pair<string,int>> &s1, pair<int,pair<string,int>> &s2){
  return s1.second.first == s2.secondfirst ? s1.second.second < s2.second.second : s1.second.first < s2.second.first;
}
int main() {
	int n;
    vector<pair<int,pair<string,int>>> shops;
    cin >> n;
    for(int i=0; i<n; i++){
        string s;
        int p;
        cin >> s >> p;
        shops[i] = make_pair(i+1,make_pair(s,p));
    }
    sort(shops.begin(),shops.end(),ope);
  
    for(int i=0; i<n; i++){
      cout << shops[i].first << endl;
    }
  
    return 0;
}

Compiler output:
a.cc: In function 'bool ope(std::pair<int, std::pair<std::__cxx11::basic_string<char>, int> >&, std::pair<int, std::pair<std::__cxx11::basic_string<char>, int> >&)':
a.cc:4:32: error: 'struct std::pair<int, std::pair<std::__cxx11::basic_string<char>, int> >' has no member named 'secondfirst'
    4 |   return s1.second.first == s2.secondfirst ? s1.second.second < s2.second.second : s1.second.first < s2.second.first;
      |                                ^~~~~~~~~~~
Language: C++

#include <iostream>
#include <queue>
#include <map>
#include <vector>

using namespace std;

typedef long long ll;
#define REP(i,n) FOR(i,0,n)
#define FOR(i,a,b) for(ll i=a;i<b;i++)
#define PB push_back
#define PQ priority_queue
#define UM unordered_map
#define ALL(a) (a).begin(),(a).end()

int main() {
    int n;
    vector<pair<string,int> > v;
    map<pair<string,int>, int > m;
    cin >> n;
    string s;
    int p;

    REP(i, n) {
        cin >> s >> p;
        v.push_back(make_pair(s, 100-p));
        m[make_pair(s, 100-p)] = i+1;
    }


    sort(v.begin(), v.end());
    REP(i,v.size()) {
        cout << m[v[i]] << endl;
    }

    return 0;
}

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

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

struct Node {
    string name;
    int id, score;
    operator < (const Node & a) const {
        if (name == a.name) return score > a.score;
        else return name < a.name;
    }
};

int main(void) {
    Node input[105];
    int n;
    scanf("%d", &n);
    for (int i = 1; i <= n; i++) {
        cin >> input[i].name >> input[i].score;
        input[i].id = i;
    }
    sort(input + 1, input + n + 1);
    for (int i = 1; i <= n; i++) {
        printf("%d\n", input[i].id);
    }

    return 0;
}

Compiler output:
a.cc:7:5: error: ISO C++ forbids declaration of 'operator<' with no type [-fpermissive]
    7 |     operator < (const Node & a) const {
      |     ^~~~~~~~
Language: C++

#include <iostream>
#include <queue>
#include <map>
#include <vector>

using namespace std;

typedef long long ll;
#define REP(i,n) FOR(i,0,n)
#define FOR(i,a,b) for(ll i=a;i<b;i++)
#define PB push_back
#define PQ priority_queue
#define UM unordered_map
#define ALL(a) (a).begin(),(a).end()

int main() {
    int n;
    vector<pair<string,int> > v;
    map<pair<string,int>, int > m;
    cin >> n;
    string s;
    int p;

    REP(i, n) {
        cin >> s >> p;
        v.push_back(make_pair(s, 100-p));
        m[make_pair(s, 100-p)] = i+1;
    }


    sort(ALL(v));
    REP(i,v.size()) {
        cout << m[v[i]] << endl;
    }

    return 0;
}

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

#include<bits/stdc++.h>
using namespace std;
#define ll long long
typedef pair<string,ll> P;
#define M 1000000007
int main(){
  ll n,l;
  cin>>n;
  vector<P> p(n),q(n);
  map<P,ll> m;
  string s;
  for(ll i=0;i<n;i++){
    cin>>s>>l;
    p[i]=P(s,-l);
    q[i]=p[i];
    m[p[i]]=i
  }
  sort(p.begin(),p.end());
  for(int i=0;i<n;i++){
    cout<<m[p[i]]<<endl;
  }
}

Compiler output:
a.cc: In function 'int main()':
a.cc:16:14: error: expected ';' before '}' token
   16 |     m[p[i]]=i
      |              ^
      |              ;
   17 |   }
      |   ~
Language: C++

#include <algorithm>
#include <cstdio>
#include <fstream>
#include <iostream>
#include <vector>

using namespace std;

// #define DEBUG 1
#define DFILE "t1.1"

typedef struct
{
  char name[12];
  int score;
  int key;
} TT;

void merge_data(TT a[], TT b[], int low, int mid, int high)
{
  int h, i, j, k;
  h = low;
  i = low;
  j = mid + 1;

  while ((h <= mid) && (j <= high)) {
    int c = strcmp(a[h].name, a[j].name);
    if (c == 0) {
      c = a[j].score - a[h].score;
    }
    if (c <= 0) {
      b[i] = a[h];
      h++;
    } else {
      b[i] = a[j];
      j++;
    }
    i++;
  }
  if (h > mid) {
    for (k = j; k <= high; k++) {
      b[i] = a[k];
      i++;
    }
  } else {
    for (k = h; k <= mid; k++) {
      b[i] = a[k];
      i++;
    }
  }
  for (k = low; k <= high; k++)
    a[k] = b[k];
}

void merge_sort(TT data[], TT temp[], int left, int right)
{
  if (left < right) {
    int mid = left + (right - left) / 2;
    merge_sort(data, temp, left, mid);
    merge_sort(data, temp, mid + 1, right);
    merge_data(data, temp, left, mid, right);
  }
}

int main()
{
#ifdef DEBUG
#define cin fin
  fstream fin(DFILE);
#endif
  int n;
  cin >> n;
  TT* a;
  TT* t;
  a = new TT[n];
  t = new TT[n];
  for (int i = 0; i < n; i++) {
    cin >> a[i].name >> a[i].score;
    a[i].key = i + 1;
  }
  merge_sort(a, t, 0, n - 1);
  for (int i = 0; i < n; i++) {
    // cout << a[i].name << " " << a[i].score << " " << a[i].key << endl;
    cout << a[i].key << endl;
  }
  return 0;
}


Compiler output:
a.cc: In function 'void merge_data(TT*, TT*, int, int, int)':
a.cc:27:13: error: 'strcmp' was not declared in this scope
   27 |     int c = strcmp(a[h].name, a[j].name);
      |             ^~~~~~
a.cc:6:1: note: 'strcmp' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
    5 | #include <vector>
  +++ |+#include <cstring>
    6 |
Language: C++

#include <iostream>
#include <algorithm>
#include <utility>
using namespace std;


int main() {
	int N;
  vector<pair<string,int>> v;
  cin >> N;
  for(int i = 0; i < N; i++) {
    string s;
    int p;
    cin >> s >> p;
    v.push_back({s,(100-p)*1000 + i+1});
  }
  sort(v.begin(), v.end());
  for(auto p : v)
    cout << p.second % 1000 << "\n";
}


Compiler output:
a.cc: In function 'int main()':
a.cc:9:3: error: 'vector' was not declared in this scope
    9 |   vector<pair<string,int>> v;
      |   ^~~~~~
a.cc:4:1: note: 'std::vector' is defined in header '<vector>'; this is probably fixable by adding '#include <vector>'
    3 | #include <utility>
  +++ |+#include <vector>
    4 | using namespace std;
a.cc:9:25: error: expected primary-expression before '>' token
    9 |   vector<pair<string,int>> v;
      |                         ^~
a.cc:9:28: error: 'v' was not declared in this scope
    9 |   vector<pair<string,int>> v;
      |                            ^