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

// g++ -std=c++11 a.cpp
#include<iostream>
#include<vector>
#include<string>
#include<algorithm>	
#include<map>
#include<set>
#include<utility>
#include<cmath>
#include<cstring>
#include<queue>
#include<stack>
#include<bitset>
#include<cstdio>
#include<sstream>
#include<iomanip>
#include<assert.h>
#include<typeinfo>
#define loop(i,a,b) for(int i=a;i<b;i++) 
#define rep(i,a) loop(i,0,a)
#define pb push_back
#define all(in) in.begin(),in.end()
#define shosu(x) fixed<<setprecision(x)
using namespace std;
//kaewasuretyuui
typedef long long ll;
//#define int ll
typedef int Def;
typedef pair<Def,Def> pii;
typedef vector<Def> vi;
typedef vector<vi> vvi;
typedef vector<pii> vp;
typedef vector<vp> vvp;
typedef vector<string> vs;
typedef vector<double> vd;
typedef vector<vd> vvd;
typedef pair<Def,pii> pip;
typedef vector<pip>vip;
// #define mt make_tuple
//typedef tuple<pii,int,int> tp;
//typedef vector<tp> vt;
template<typename A,typename B>bool cmin(A &a,const B &b){return a>b?(a=b,true):false;}
template<typename A,typename B>bool cmax(A &a,const B &b){return a<b?(a=b,true):false;}
//template<class C>constexpr int size(const C &c){return (int)c.size();}
//template<class T,size_t N> constexpr int size(const T (&xs)[N])noexcept{return (int)N;}
const double PI=acos(-1);
const double EPS=1e-7;
Def inf = sizeof(Def) == sizeof(long long) ? 2e18 : 1e9;
int dx[]={0,1,0,-1};
int dy[]={1,0,-1,0};
int main(){
	int n,m;
	cin>>n>>m;
	vp in(n);
	int ma=0;
	rep(i,n){
		int a,b;
		cin>>a>>b;
		in[i]={-b,a};
		ma=max(ma,a);
	}
	sort(all(in));
	int co=0;
	rep(i,n){
		int t=-in[i].first;
		if(t<am)break;
		co++;
		m-=t;
		if(m<0)break;
	}
	if(m>0)co+=(m+ma-1)/ma;
	cout<<co<<endl;
}











Compiler output:
a.cc: In function 'int main()':
a.cc:66:22: error: 'am' was not declared in this scope; did you mean 'ma'?
   66 |                 if(t<am)break;
      |                      ^~
      |                      ma
Language: C++

#include <iostream>//cout
#include <stdio.h>
#include <vector>
#include <cmath>
#include <algorithm>
#include <string>
#include <queue>
#include <stack>
#include <functional>
#include <list>
#include <utility>//swap
using namespace std;
static const int MAX = 200000;
#define rep(i,n) for(int i=0;i<n;i++)
#define GET_ARRAY_SIZE(a) (sizeof(a)/sizeof(a[0]))
 
int main() {
  long long int n, h;
  cin >> n >> h;
  int x,y;
  vector<long long int> a, b;
  for (int i = 0; i < n; i++) {
    cin >> x >> y;
    a.push_back(x);
    b.push_back(y);
  }
  sort(b.rbegin(), b.rend());
  sort(a.rbegin(), a.rend());
  int a_max = a[0];
  int num = 0;
  for (int i = 0; i < n; i++) {
    if (a_max < b[i]){
      num = i+1;
    }
  }
  int t = 0;
  for (int i = 0; i < num; i++) {
    t += b[i];
    if (h <= t) {
      cout << i+1 << endl;
      return 0;
    }
  }
  if ((h-t)%(a_max)==0){
    cout <<  (h-t)/a_max + num << endl;
  } else {
    cout <<  (h-t)/a_max + 1 + num << endl;
  }
  return 0;

Compiler output:
a.cc: In function 'int main()':
a.cc:49:12: error: expected '}' at end of input
   49 |   return 0;
      |            ^
a.cc:17:12: note: to match this '{'
   17 | int main() {
      |            ^
Language: Java

import java.util.ArrayList;
import java.util.Collections;
import java.util.Scanner;

public class Main {
    public static void main(String args[]) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int h = sc.nextInt();
        int count = 0;
        ArrayList<Integer> attack = new ArrayList<>();
        ArrayList<Integer> throwPoint = new ArrayList<>();
        for (int i = 0; i < n; i++) {
            attack.add(sc.nextInt());
            throwPoint.add(sc.nextInt());
        }
        int maxAttack = Collections.max(attack);
        Collections.sort(throwPoint, Collections.reverseOrder())
        for (int point : throwPoint) {
            if (maxAttack < point) {
                h -= point;
                count++;
                if (h <= 0) {
                    System.out.println(count);
                    return;
                }
            }
        }
        while (h > 0) {
            h -= maxAttack;
            count++;
        }
        System.out.println(count);
    }
}


Compiler output:
Main.java:18: error: ';' expected
        Collections.sort(throwPoint, Collections.reverseOrder())
                                                                ^
1 error
Language: C++

#include<iostream>
#include<algorithm>
using namespace std;
int main()
{
  int N;
  int H;
  int x;  
  cin>>N>>H;
  int a[100010],b[100010];
  for(int i=1;i<=N;i++)
  {
     cin>>a[i]>>b[i];
     a[i]=max(a[i],a[i-1]);
     x=a[i];} 
  sort(b,b+N); 
  int ans=0;
  for(int j=N;j>=0;j--)
  {
     if(x<=b[j] and H>0)
     { H=H-b[j];
       ans++;}
  }
  if(H>0)
  ans+=(H+x-1)/x;
  cout<<ans<<endl;
  system ("pause");
  return 0;

Compiler output:
a.cc: In function 'int main()':
a.cc:28:12: error: expected '}' at end of input
   28 |   return 0;
      |            ^
a.cc:5:1: note: to match this '{'
    5 | {
      | ^
Language: C++

#include<iostream>
#include<algorithm>
#include<sort>
using namespace std;
int main()
{
  int N;
  long long H;
  int x;  
  cin>>N>>H;
  long long a[100000],b[100000];
  for(int i=1;i<=N;i++)
  {
     cin>>a[i]>>b[i];
     a[i]=max(a[i],a[i-1]);
     x=a[i];} 
  sort(b,b+N); 
  int ans=0;
  for(int j=N;j>=1;j--)
  {
     if(x<=b[j] and H>0)
     { H=H-b[j];
       ans++;}
  }
  if(H>0)
  cout<<(H+x-1)/x+ans<<endl;
  else 
  cout<<ans<<endl;
  system ("pause");
  return 0;
}

Compiler output:
a.cc:3:9: fatal error: sort: No such file or directory
    3 | #include<sort>
      |         ^~~~~~
compilation terminated.
Language: C++

#include<iostream>
#include<sort>
using namespace std;
int main()
{
  int N;
  long long H;
  int x;  
  cin>>N>>H;
  long long a[100000],b[100000];
  for(int i=1;i<=N;i++)
  {
     cin>>a[i]>>b[i];
     a[i]=max(a[i],a[i-1]);
     x=a[i];} 
  sort(b,b+N); 
  int ans=0;
  for(int j=1;j<=N;j++)
  {
     if(x<=b[j] and H>0)
     { H=H-b[j];
       ans++;}
  }
  if(H>0)
  //cout<<ans;
  //cout<<(H+x-1)/x;
  cout<<(H+x-1)/x+ans<<endl;
  else 
  cout<<ans<<endl;
  system ("pause");
  return 0;
}

Compiler output:
a.cc:2:9: fatal error: sort: No such file or directory
    2 | #include<sort>
      |         ^~~~~~
compilation terminated.
Language: C++

#include<iostream>
using namespace std;
int main()
{
  int N;
  long long H;
  int x;  
  cin>>N>>H;
  long long a[100000],b[100000];
  for(int i=1;i<=N;i++)
  {
     cin>>a[i]>>b[i];
     a[i]=max(a[i],a[i-1]);
     x=a[i];} 
  sort(b,b+N); 
  int ans=0;
  for(int j=1;j<=N;j++)
  {
     if(x<=b[j] and H>0)
     { H=H-b[j];
       ans++;}
  }
  if(H>0)
  //cout<<ans;
  //cout<<(H+x-1)/x;
  cout<<(H+x-1)/x+ans<<endl;
  else 
  cout<<ans<<endl;
  system ("pause");
  return 0;
}

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

#include <iostream>
#include <vector>
#include <string>
#include <cmath>
#include <set>
#include <algorithm>
#include <array>
#include <complex>
#include <string>
#include <utility>

int main(){
  std::cin.tie(nullptr);
  std::ios_base::sync_with_stdio(false);
  int N,H;
  std::cin >> N >> H;
  std::vector<int> a(N),b(N);
  std::cin >> a[0] >> b[0];
  int max_a=a[0],times=0;

  for(int i=1;i<N;i++){
    std::cin >> a[i] >> b[i];
    if(max_a < a[i]){
      max_a=a[i];
    }
  }
  std::sort(b.begin(),b.end(),std::greater<Type>())
  for(int i=0;i<N;i++){
    if(max_a < b[i]){
      H-=b[i];
      times++;
        if(H<=0){
          std::cout << times << std::endl;
          return 0;
        }
    }
  }
  if(H<=0){
    std::cout << times << std::endl;
    return 0;
  }
  times+=(H+max_a-1)/max_a;
  std::cout << times << std::endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:27:44: error: 'Type' was not declared in this scope; did you mean 'wctype'?
   27 |   std::sort(b.begin(),b.end(),std::greater<Type>())
      |                                            ^~~~
      |                                            wctype
a.cc:27:48: error: template argument 1 is invalid
   27 |   std::sort(b.begin(),b.end(),std::greater<Type>())
      |                                                ^
a.cc:28:15: error: 'i' was not declared in this scope
   28 |   for(int i=0;i<N;i++){
      |               ^
Language: C++

#include <iostream>
//#include <string>
//#include <algorithm>
using namespace std; 
int n,hp,s[100010],t[100010],ans;  
int main()  
{ 
    cin>>n>>hp;
    for(int i=0;i<n;i++)cin>>s[i]>>t[i];
    sort(s,s+n,greater<int>());
    int max=s[0];
    sort(t,t+n,greater<int>());
    for(int i=0;i<n;i++)if(t[i]>max&&hp>0){hp-=t[i];ans++;}
    if(hp>0)ans+=(hp+max-1)/max;
    cout<<ans;
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:10:5: error: 'sort' was not declared in this scope; did you mean 'short'?
   10 |     sort(s,s+n,greater<int>());
      |     ^~~~
      |     short
Language: C

#include<stdio.h>

int main(){
	long N, H;
	scanf("%ld %ld", &N, &H);
	long a[100001], b[100001];
	long a_max = 0;
	for (long i = 0; i < N; i++) {
		scanf("%ld %ld", &a[i], &b[i]);
		if (a[i] > a_max) {
			a_max = a[i];
		}
	}

	long ans = 0;
	long D = 0;

	for (long i = 0; i < N; i++) {
		if (a_max < b[i]) {
			D += b[i];
			ans++;
			if (D >= H) {
				printf("%ld\n", ans);
				return 0;
			}
		}
	}

	
	if (D >= H) {
		ans += (H - D) / a_max;
		printf("%ld\n", ans);
		break;
	}

	return 0;

}

Compiler output:
main.c: In function 'main':
main.c:33:17: error: break statement not within loop or switch
   33 |                 break;
      |                 ^~~~~
Language: C++

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

typedef unsigned long long L;
L a[100000];
L b[100000];

int main()
{
    int N, max_idx=0;
    L max_val_a=0, count=0;
    signed long long H, max_val_b=0;
    scanf("%d %lld", &N, &H);
    for (int i=0; i<N; i++){
        scanf("%lld %lld", &a[i], &b[i]);
        if (a[i] > max_val_a){
            max_val_a = a[i];
            max_val_b = b[i];
            max_idx = i;
        }
    }
    b[max_idx] = 0;
    sort(b, b+N);
    for (int i=N-1; i>=0; i--){
        if (H - max_val_b > 0){
            if (b[i] > max_val_a){
                H -= b[i];
                count++;
            }
        }
    }
    while (H > 0){
        if (H - max_val_b <= 0){
            count++;
            H -= max_val_b;
        }
        else{
            H -= max_val_a;
            count++;
        }
    }
    printf("%lld\n", count);
    return 0;
}

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(b, b+N);
      |     ^~~~
      |     short
Language: Java

import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
	
		//入力を取得します
		
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int h = sc.nextInt();

		
		List<Integer> s1 = new ArrayList<>(n);
		List<Integer> s2 = new ArrayList<>(n);
		for (int i = 0 ; i < n; i++) {
		  int sin1 = sc.nextInt();
		  int sin2 = sc.nextInt();
		  s1.add(sin1);
		  s2.add(sin2);
		}
		sc.close();
		
	
		//計算部分

		int count = 0;
		
		Collections.sort(s1);
		Collections.sort(s2);
		int s1a = s1.get(n - 1);
		
		 roop : for (int i = 0 ; i < n ; i++) {
			 if (s2.get(n - 1 - i) > s1a) {
	            	h -= s2.get(n - 1 - i);
	     		count++;
	            if (h <= 0) {
	                message(count);
	                break roop;
	            }
	            if (n - 1- i == 0 && h > 0) {
	            	count = count + h/s1a + 1;
	            	message(count);
	            }
		    } else {
		    	    count = count + h/s1a ;
		    	    message(count);
		    	    break roop;
		    	    
			}
		}
	    
		
	}
	
		//回答を表示するメソッド
		public static void message(int count) {
		    System.out.println(count);
		}
		

Compiler output:
Main.java:62: error: reached end of file while parsing
		}
		 ^
1 error
Language: C++

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

int main()
{
  int N, H;
  cin >> N >> H;
  int a[N], b[N];
  for (int i = 0; i < N; ++i) cin >> a[i] >> b[i];

  int big = 0;
  int ans = 0;
  for (int i = 0; i < N; ++i) big += max(a[i], b[i]);

  if (big >= H)
  {
    sort(a, a+N);
    sort(b, b+N);
    while (H > 0) {
      if (a[N-1] > b[i])
      {
        H -= a[N-1];
      }else{
        H -= b[N - ans - 1];
      }
      ans++;
    }
    cout << ans << endl;
  }else{
    sort(a, a+N);
    sort(b, b+N);
    for (int i = 0; i < N; ++i) {
      if (a[N-1] > b[i])
      {
        H -= a[N-1];
      }else{
        H -= b[i];
      }
    }
    ans = (H - 1) / a[N-1] + 1 + N;
    cout << ans << endl;
  }
  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:20:22: error: 'i' was not declared in this scope
   20 |       if (a[N-1] > b[i])
      |                      ^
Language: C++

#include<iostream>
using namespace std;
int main(){
long long a,c=0;
int b=1,z;
cin >> a >> z;
int n[a],h[a];
for(int i=0;i<a;i++)
{
cin >> n[i] >> h[i];
for(int i=0;i<a;i++)
{
b=max(b,n[i]);
}
for(int i=0;i<a;i++)
{
if(n[i]<=h[i] and h[i]>b){z=z-h[i];
c++;}
}
if(z>0 and z%b>0)
cout << z/b+c+1;
if(z<=0)
cout << c;
if(z>0 and z%b==0)
cout << z/b+c;
if(z>0 and z%b<0)
cout << z/b+c-1;

return 0;
}

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

#include<iostream>
using namespace std;
int main(){
long long a,c=0;
int b=1,z;
cin >> a >> z;
int n[a],h[a];
for(int i=0;i<a;i++)
{
cin >> n[i] >> h[i];
}
for(int i=0;i<a;i++)
{
b=max(b,n[i]);
}
for(int i=0;i<a;i++)
{
if(n[i]<=h[i] and h[i]>b){z=z-h[i];
c++;}
}
if(z>0 and z%b>=1)
cout << z/b+c+1;
if(z<=0)
cout << c;
if(z>0 and z%b<1)
cout << z/b+c
return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:26:14: error: expected ';' before 'return'
   26 | cout << z/b+c
      |              ^
      |              ;
   27 | return 0;
      | ~~~~~~
Language: C++

#include <iostream>
#include<string>
#include<vector>
using namespace std;   
int main()  
{ 
    int n,b,a=0,cnt;
    int maxs=0,maxt=0;
    int sums=0,sumt=0;
    int ans;
    cin>>n>>b;
    cnt=0;
    vector<int>s(n,0);
    vector<int>t(n,0);
    for(int i=0;i<n;i++){
    cin>>s[i]>>t[i];
    maxs=max(s[i],maxs);
//    maxt=max(t[i],maxt);
//   sums+=s[i];
    sumt+=t[i];}
//    sort(s.begin(),s.end());
    sort(t.begin(),t.end());
    if(b<sumt){
        while(b>a){
            a+=t[cnt];
            cnt++;
            ans++;
            }
        cout<<ans<<endl;

        return 0;}
    if(b>sumt){
        b-=sumt;ans=(b+maxs-1)/maxs+n;
        cout<<ans<<endl; }
    if(b==sumt)cout<<n<<endl;
        

    return 0;
}

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

#include<iostream>
using namespace std;
int main(){
int a,c=0;
int b=0,z;
cin >> a >> z;
int n[a],h[a];
for(int i=0;i<a;i++)
{
cin >> n[i] >> h[i];
}
sort(n,n+a);
b=n[0];
for(int i=0;i<a;i++)
{
if(b<=h[i] and z>0){z=z-h[i];c++;}
}
if(z<=0)
cout << c;
if(z>0 and z%b==0)
cout << z/b+c;
if(z>0 and z%b!=0)
cout << z/b+1+c;
return 0;
}

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

#include <bits/stdc++.h>
using namespace std;
int arr_wield[100001],arr_throw[100001];
bool mycompare(const int & a,const int & b)
{
	return a>b;
}
int main()
{
	int N,H,i,count=0,ans=0,pos_t=0;
	scanf("%d %d",&N,&H);
	for(i=0;i<N;i++)
	{
		scanf("%d %d",&arr_wield[i],&arr_throw[i]);
	}
	sort(arr_wield,arr_wield+N,mycompare);
	sort(arr_throw,arr_throw+N,mycompare);
	while(H>0)
	{
		if(arr_throw[pos_t]>arr_wieid[0])
		{
			H-=arr_throw[pos_t++];
			ans++;
		}
		else
		{
			ans=H/arr_wield[0];
			ans=H%arr_wield[0]==0?0:1;	
		    break;
		}
	}
	printf("%d",ans);
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:20:37: error: 'arr_wieid' was not declared in this scope; did you mean 'arr_wield'?
   20 |                 if(arr_throw[pos_t]>arr_wieid[0])
      |                                     ^~~~~~~~~
      |                                     arr_wield
Language: C++

#include <bits/stdc++.h>
using namespace std;
int arr_wieid[100001],arr_throw[100001];
bool mycompare(const int & a,const int & b)
{
	return a>b;
}
int main()
{
	int N,H,i,count=0,ans=0,pos_t=0;
	scanf("%d %d",&N,&H);
	for(i=0;i<N;i++)
	{
		scanf("%d %d",&arr_wieid[i],arr_throw[i]);
	}
	sort(arr_wieid,arr_wieid+N,mycompare);
	sort(arr_throw,arr_throw+N,mycompare);
	while(H>0)
	{
		if(arr_throw[pos_t]>arr_wieid[0])
		{
			H-=arr_throw[pos_t++];
			ans++;
		}
		else
		{
			ans=H/arr_wieid[0];
			ans=H%/arr_wieid[0]==0?0:1;	
		    break;
		}
	}
	printf("%d",ans);
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:28:31: error: expected primary-expression before '/' token
   28 |                         ans=H%/arr_wieid[0]==0?0:1;
      |                               ^
Language: C++

#include <bits/stdc++.h>
using namespace std;
typedef struct sword
{
	int damage,flag;
	bool operator < (const struct sword & a) const
	{
		return a.damage<a.damage;
	}
}SWORD,*PSWORD;
SWORD s[200001];
int main()
{
	int n,h=0,i,count=0,ans=0;
	scanf("%d %d",&n,&h);
	for(i=0;i<n;i++)
	{
		scanf("%d",&s[count].damage);
		s[count++].flag=0;
		scanf("%d",&s[count].damage);
		s[count++].flag=1;
	}
	sort(s,s+count);
	i=0;
	while(h)
	{
		h-=s[i].damage;
		ans++;
		if(s[i].flag==1)
		{
		    i++;
	    }
		else
		{
		    h%a[i].damage?ans+=h/a[i].damage:ans+=h/a[i].damage+1;
		    break;
		}
	}
	printf("%d",ans);
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:35:23: error: 'a' was not declared in this scope
   35 |                     h%a[i].damage?ans+=h/a[i].damage:ans+=h/a[i].damage+1;
      |                       ^
Language: C++

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

using namespace std;


long long main()
{
	long long n, h;
	long long ans = 0ll;
	vector<long long> a, b;

	cin >> n >> h;
	for (long long i = 0ll; i < n; i++) {
		long long x, y;
		cin >> x >> y;
		a.push_back(x);
		b.push_back(y);
	}

	// 打撃最強武器のindex //
	long long attack_max_index = -1ll;

	for (long long i = 0ll; i < n; i++) {
		if (attack_max_index == -1ll || a[attack_max_index] < a[i]) {
			attack_max_index = i;
		}
	}

	// 打撃最強の武器の戦闘力 //
	long long attack_max_a = a[attack_max_index];
	long long attack_max_b = b[attack_max_index];

	// 投げる用武器のリスト //
	vector<long long> throw_list;

	for (long long i = 0ll; i < n; i++) {
		if (attack_max_index != i && attack_max_a < b[i]) {
			throw_list.push_back(b[i]);
		}
	}

	sort(throw_list.begin(), throw_list.end(), std::greater<long long>());

	// 選んだ武器で殴る //
	long long damage = 0ll;
	for (long long i = 0ll; i < throw_list.size(); i++) {
		if (damage >= h) {
			continue;
		}

		damage += throw_list[i];
		ans++;
	}

	while (damage < h) {
		if (damage + attack_max_b >= h) {
			damage += attack_max_b;
		}
		else {
			damage += attack_max_a;
		}
		ans++;
	}

	cout << ans << endl;

    return 0;
}



Compiler output:
cc1plus: error: '::main' must return 'int'
Language: C++

#include<bits/stdc++.h>
using namespace std;
const int maxn=1e5+5;
struct sword{
	int x,y;
	friend operator <(sword a,sword b){
		return a.y>b.y;
	}
}a[maxn];
int main()
{
	int n,q;cin>>n>>q;int max_=0;
	for(int i=1;i<=n;i++)
	{
		cin>>a[i].x>>a[i].y;
		max_=max(a[i].x,max_);
	}
	sort(a+1,a+n+1);
	int ans=0;
	int i=1;
	while(a[i].y>=max_)
	{
		q-=a[i].y;ans++;
		if(q<=0)
		{
			printf("%d\n",ans);
			return 0;
		}
		i++;
	}
	while(q>0)
	{
		q-=max_;ans++;
	}
	printf("%d\n",ans);
	return 0;
}

Compiler output:
a.cc:6:16: error: ISO C++ forbids declaration of 'operator<' with no type [-fpermissive]
    6 |         friend operator <(sword a,sword b){
      |                ^~~~~~~~
Language: C++

#include <iostream>
#include <vector>

using namespace std;

bool sword_comparator(vector<long long> a, vector<long long> b) {
  return a[0] > b[0];
}

int main() {
  long long n, h;
  cin >> n >> h;
  long long a[n];
  long long b[n];

  int normal_slash = 1;
  int final_slash = 0;

  vector<vector<long long>> swords;

  for (int i = 0; i < n; ++i) {
    cin >> a[i];
    cin >> b[i];
    vector<long long> ai = {a[i], normal_slash};
    swords.push_back(ai);
    vector<long long> bi = {b[i], final_slash};
    swords.push_back(bi);
  }

  sort(swords.begin(), swords.end(), sword_comparator);

  long long best_normal = -1;

  vector<long long> final_slashes_better_than_best_normal;

  for (int j = 0; j < swords.size(); ++j) {
    if (swords[j][1] == normal_slash) {
      best_normal = swords[j][0];
      break;
    } else {
      final_slashes_better_than_best_normal.push_back(swords[j][0]);
    }
  }

  int counter = 0;
  for (auto fs: final_slashes_better_than_best_normal) {
    h -= fs;
    counter++;
    if (h <= 0) {
      cout << counter << endl;
      return 0;
    }
  }

  long long normal_slash_counter = (h / best_normal) + (h % best_normal == 0 ? 0 : 1);
  cout << counter + normal_slash_counter << endl;

  return 0;
}

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

#include<bits/stdc++.h>
#define int long long
#define fi first
#define se second
#define PB push_back
using namespace std;
typedef pair<int, int> P1;
typedef pair<int, pair<int, int> > P2;
static const int INF = 1ll<<60;
static const int dx[] = { 1, -1, 0, 0, };
static const int dy[] = { 0, 0, 1, -1 };
static const int mod = 1000000007;

int N,H;
vector<P1> Katana;


int maxSwingPower;
int throwPower[100005];

int AttackCount(int n){
    int h = H-n*maxSwingPower;
    int it = upper_bound(throwPower,throwPower+N,h)-throwPower;
    if(throwPower[it-1]==h)it--;
    //cout<<h<<" "<<n<<endl;
    //cout<<n*maxSwingPower<<" "<<throwPower[it]<<" "<<it<<endl;
    if(h<=0)return n;
    else if(h-throwPower[it]>0)return INF;
    else return n + it;
}


int a[100005];
int b[100005];

signed main(){
    cin>>N>>H;
    for(int i=0;i<N;++i){
        int s,t;
        cin>>s>>t;
        Katana.push_back(P1(t,s));
        maxSwingPower = max(s,maxSwingPower);
        a[i] = s;
        b[i] = t;
    }
    sort(b,b+N);
    //cout<<maxSwingPower<<endl;
    sort(Katana.begin(),Katana.end(),greater<P1>());
    for(int i=1;i<=N;++i){
        throwPower[i] = throwPower[i-1] + Katana[i-1].first;
        //cout<<throwPower[i]<<endl;
    }
    /*int l=0,r=1000000000;
    int minAttackCount = INF;
    for(int i=0;i<1000005;++i){
        minAttackCount=min(minAttackCount,AttackCount(i));
    }
    cout<<minAttackCount<<endl;*/
    for(int i=0;i<=N;++i){
        if(h<=throwPower[i]){
            cout<<i<<endl;
            return 0;
        }
    }
    int it=upper_bound(b,b+N,maxSwingPower)-b;
    int h=H-throwPower[N-it];
    int p=h/maxSwingPower;
    if(maxSwingPower*p<h)p++;
    //cout<<h<<" "<<p<<" "<<N-it<<endl;
    cout<<p+N-it<<endl;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:60:12: error: 'h' was not declared in this scope
   60 |         if(h<=throwPower[i]){
      |            ^
Language: C++

#include<iostream>
#include<cstdio>
#include<math.h>
#include<algorithm>
#include<stdlib.h>
using namespace std;
int cmp(int a,int b)
{
return b-a;
}
int main()
{
long long n,p,trap,sums;
long long w[100000];
long long t[100000];
long i,j;
cin>>n>>p;
for(i=0;i<n;i++)
{
cin>>w[i]>>t[i];
}
qsort(w,n+1,sizeof(long long),cmp);
qsort(t,n+1,sizeof(long long),cmp);
j=0;sums=0;
for(i=0;i<n;i++)
{
sums+=t[i];
j++;
if(sums>=p)
{
cout<<j;
return 0;
}
}
j+=(ceil((float)(p-sums)/w[0]));
cout<<j;
return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:22:31: error: invalid conversion from 'int (*)(int, int)' to '__compar_fn_t' {aka 'int (*)(const void*, const void*)'} [-fpermissive]
   22 | qsort(w,n+1,sizeof(long long),cmp);
      |                               ^~~
      |                               |
      |                               int (*)(int, int)
In file included from /usr/include/c++/14/cstdlib:79,
                 from /usr/include/c++/14/ext/string_conversions.h:43,
                 from /usr/include/c++/14/bits/basic_string.h:4154,
                 from /usr/include/c++/14/string:54,
                 from /usr/include/c++/14/bits/locale_classes.h:40,
                 from /usr/include/c++/14/bits/ios_base.h:41,
                 from /usr/include/c++/14/ios:44,
                 from /usr/include/c++/14/ostream:40,
                 from /usr/include/c++/14/iostream:41,
                 from a.cc:1:
/usr/include/stdlib.h:971:34: note:   initializing argument 4 of 'void qsort(void*, size_t, size_t, __compar_fn_t)'
  971 |                    __compar_fn_t __compar) __nonnull ((1, 4));
      |                    ~~~~~~~~~~~~~~^~~~~~~~
a.cc:23:31: error: invalid conversion from 'int (*)(int, int)' to '__compar_fn_t' {aka 'int (*)(const void*, const void*)'} [-fpermissive]
   23 | qsort(t,n+1,sizeof(long long),cmp);
      |                               ^~~
      |                               |
      |                               int (*)(int, int)
/usr/include/stdlib.h:971:34: note:   initializing argument 4 of 'void qsort(void*, size_t, size_t, __compar_fn_t)'
  971 |                    __compar_fn_t __compar) __nonnull ((1, 4));
      |                    ~~~~~~~~~~~~~~^~~~~~~~
Language: C++

N, H = map(int, input().split(' '))
katana = [map(int, input().split(' ')) for _ in range(N)]
dmg_wield, dmg_throw = zip(*katana)

dmg_wield_max = max(dmg_wield)
dmg_throw = [d for d in sorted(dmg_throw, reverse=True) if d >= dmg_wield_max]

n = len(dmg_throw)
H -= sum(dmg_throw)
n += int(H // dmg_wield_max)

if H - dmg_wield_max * n > 0:
    n += 1

print(n)

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

#include<iostream>
#include<string>
#include<cstdio>
#include<algorithm>
#include<cstdlib>
#include<cmath>
#include<vector>
#include<deque>
#include<queue>
#include<stack>
#include<utility>
#include<array>
#include<cassert>
#include<list>
#include<experimental/any>
#include<cstring>
#include<cctype>
#include<ctime>
#include<cstdbool>
#include<cstdint>
#include<cstddef>
#include<set>
#include<unordered_set>
#include<bitset>
 
using namespace std;
using experimental::any;
 
#define SPEEDY cin.tie(0);ios::sync_with_stdio(false);
 
#define REP(i,n) for(int i=0;i<(n);i++)
#define ARREP(i,n,X) for(int i=0;i<(n);i++)cin>>X[i]
#define FOR(i,X,n) for(int i=(X);i<(n);i++)
#define EREP(i,n) for(int i=1;i<=n;i++)
#define BitFOR(N) REP(Bit,1<<(N))
 
//#define MODE 1
#ifdef MODE
#define DEB(X) cout<< #X <<": "<<X<<" ";
#define DEB2(X) cout<<X<<" ";
#define ARDEB(i,X) cout<< #X <<"["<<i<<"]: "<<X[i]<<" ";
#define TFDEB(f) (f)? cout<<"true ":cout<<"false ";
#define FORDEB(n,X) for(int i=0;i<(n);i++)ARDEB(i,X)
#define END cout<<endl;
#else
#define DEB(X) {}
#define DEB2(X) {}
#define ARDEB(i,X) {}
#define TFDEB(f) {}
#define FORDEB(n,X) {}
#define END {}
#endif
 
typedef long long int ll;
typedef unsigned long long ull;
typedef pair<int,int> P;
#define ALL(X) X.begin(),X.end()
struct edge{int to,cost;};
//struct edge{int from,cost,to;};
struct P2{int x,y;};
#define BIT(Bit,n) bitset<n>(Bit)
#define Endl endl
#define YN(f) cout<<((f)?"Yes":"No")<<endl
 
const int MOD7=1000000007;
const int INF=100000000;
const int SET=1000; 
 

int main(){
	int n,m,max=0,b[100010],count=0;
	vector<int> v;
	cin>>n>>m;
	int dim=m;
	REP(i,n){
		int a;
		cin>>a>>b[i];
		max=std::max(max,a);
	}
	DEB(max)END
	sort(b,b+n,greater<int>());
	/*REP(i,n){
		if(b[i]>max)v.push_back(b[i]);
	}*/
	/*for(auto x:v){
		count++;
		m-=x;
		if(m<=0){
			cout<<count<<endl;
			return 0;
		}
	}*/
	REP(i,n){
		if(b[i]>max){
			count++;
			m-=b[i];
		}
		if(m<=0){
			cout<<count<<endl;
			return 0;
		}
		ARDEB(i,b)DEB(m)DEB(count)END
	}*/
	//int ans=;
	REP(i,n){ARDEB(i,b)END}
	DEB(m)DEB(count)END
	cout<<count+((m%max==0)?m/max:m/max+1)<<endl;
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:103:11: error: expected primary-expression before '/' token
  103 |         }*/
      |           ^
a.cc:31:18: error: expected primary-expression before 'for'
   31 | #define REP(i,n) for(int i=0;i<(n);i++)
      |                  ^~~
a.cc:105:9: note: in expansion of macro 'REP'
  105 |         REP(i,n){ARDEB(i,b)END}
      |         ^~~
a.cc:105:13: error: 'i' was not declared in this scope
  105 |         REP(i,n){ARDEB(i,b)END}
      |             ^
a.cc:31:30: note: in definition of macro 'REP'
   31 | #define REP(i,n) for(int i=0;i<(n);i++)
      |                              ^
Language: C++

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

int main() {
  long N;
  long H;
  int times=0;
  long aMax=0;
  cin >> N >> H;
  long a[100000], b[100000];
  for(int i=0;i<N;i++){
    cin >> a[i] >> b[i];
  }
  //aMax=a[]の最大値
  //b[n]をソート
  //HからaMaxより大きいの限定で大きい順に引いていく
  //H<=0にならなかったら、そのときのHからaMaxを引き続ける
  引くたびにカウンターを++
  for(int j=0;j<N;j++){
    if(aMax<a[j]){
      aMax=a[j];
    }
  }
  sort(b, b+N);
  for(int k=0;k<N;k++){
    if(aMax<b[k]){
      if(H>0){
        H-=b[k];
        times++;
      }
    }
  }
  while(H>0){
    H-=aMax;
    times++;
  }
  cout << times;
  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:19:3: error: '\U00005f15\U0000304f\U0000305f\U00003073\U0000306b\U000030ab\U000030a6\U000030f3\U000030bf\U000030fc\U00003092' was not declared in this scope
   19 |   引くたびにカウンターを++
      |   ^~~~~~~~~~~~~~~~~~~~~~
a.cc:20:15: error: 'j' was not declared in this scope
   20 |   for(int j=0;j<N;j++){
      |               ^
Language: Java

import java.util.*;
public class Main{
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		double hp = sc.nextInt();
		double a = 0;
		Integer b[] = new Integer [n];
		for(int i = 0; i < n ; i++){
			int tmp = sc.nextInt();
			if( tmp > a){
				a = tmp;
			}
			b[i] = sc.nextInt();
		}
		/*for( int i = n; i > 0; i--){
			for( int j = 0; j < i - 1 ; j++ ){
				if(b[j] < b[j+1]){
					int tmp = b[j];
					b[j] = b[j+1];
					b[j+1] = tmp;
				}
			}
		}*/
		Arrays.sort(b,Collections.reverseOrder());
		int ans = 0;
		int index = 0;
		while( hp > 0){
			/*if( index < n && b[index] >= a ){
				hp -= b[index];
				ans++;
				index++;
			}else{
				break;
			}*/
			if( index < n && b[index] >= a ){
				hp -= b[index];
				ans++;
				index++;
			}else{
				hp-=a;
			}
		}
		/*if(hp%a == 0){
			ans += hp/a;
		}else{
			Double tmpA = hp/a;
			int tmpB = tmpA.intValue();
			if(tmpA - tmpB < 0){
				ans += tmpB;
			}else{
				ans += tmpB + 1;
			}
		}*/
		ans+= (int) ((hp+a-1)/a);
		System.out.print(ans);
	}
}
import java.util.*;
public class Main{
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		double hp = sc.nextInt();
		double a = 0;
		Integer b[] = new Integer [n];
		for(int i = 0; i < n ; i++){
			int tmp = sc.nextInt();
			if( tmp > a){
				a = tmp;
			}
			b[i] = sc.nextInt();
		}
		/*for( int i = n; i > 0; i--){
			for( int j = 0; j < i - 1 ; j++ ){
				if(b[j] < b[j+1]){
					int tmp = b[j];
					b[j] = b[j+1];
					b[j+1] = tmp;
				}
			}
		}*/
		Arrays.sort(b,Collections.reverseOrder());
		int ans = 0;
		int index = 0;
		while( hp > 0){
			/*if( index < n && b[index] >= a ){
				hp -= b[index];
				ans++;
				index++;
			}else{
				break;
			}*/
			if( index < n && b[index] >= a ){
				hp -= b[index];
				ans++;
				index++;
			}else{
				hp-=a;
                                ans++;
			}
		}
		/*if(hp%a == 0){
			ans += hp/a;
		}else{
			Double tmpA = hp/a;
			int tmpB = tmpA.intValue();
			if(tmpA - tmpB < 0){
				ans += tmpB;
			}else{
				ans += tmpB + 1;
			}
		}*/
		System.out.print(ans);
	}
}


Compiler output:
Main.java:59: error: class, interface, enum, or record expected
import java.util.*;
^
1 error
Language: Java

public class Main{
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int hp = sc.nextInt();
		int a = 0;
		int b[] = new int [n];
		for(int i = 0; i < n ; i++){
			int tmp = sc.nextInt();
			if( tmp > a){
				a = tmp;
			}
			b[i] = sc.nextInt();
		}
		for( int i = n; i > 0; i--){
			for( int j = 0; j < i - 1 ; j++ ){
				if(b[j] < b[j+1]){
					int tmp = b[j];
					b[j] = b[j+1];
					b[j+1] = tmp;
				}
			}
		}
		int ans = 0;
		int index = 0;
		while( hp > 0){
			if( index < n && b[index] >= a ){
				hp -= b[index];
				ans++;
				index++;
			}else{
				hp -= a;
				ans++;
			}
		}
		System.out.print(ans);
	}
}


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

#include<iostream>
#include<string>
#include<vector>
#include<stack>
#include<queue>
#include<map>
#include<algorithm>
#include<numeric>
#include<utility>

#define reps(i, j, k) for (int i = (j); i < (k); i++)
#define rep(i, j) reps(i, 0, j)

using namespace std;

using ll = long long;
using pii = pair<int, int>;
using vi = vector<int>;

const int mod = 1e9 + 7;
const long double pi = 3.141592653589793238462643383279502884197;
const long double eps = 1e-7;

int N, H;
ll num = 0;
vector<pii> ab;
bool bFinish = false;

int main() {
	cin >> N >> H;
	rep(i, N) {
		int a, b;
		cin >> a >> b;
		ab.push_back(pii(a, b));
	}

	sort(ab.begin(), ab.end(), [](const pii x, const pii y) { return x.second > y.second; });
	pii max_ab = *max_element(ab.begin(), ab.end(), [](const pii x, const pii y) { if (x.first == y.first) { return x.second > y.second; } else { return x.first < y.first; }});

	rep(i, ab.size() {
		if (max_ab.first < ab[i].second) {
			if (max_ab == ab[i]) {
				if (H < max_ab.second) {
					H -= max_ab.second;
					num++;
				}
				break;
			}
			else {
				H -= ab[i].second;
				ab.erase(ab.begin() + i);
				num++;
			}
		}
		else { break; }
	}

	if (H > 0) {
		H -= max_ab.second;
		num++;

		if (H > 0) {
			int n = H / max_ab.first;

			if (n == 0) num += 1;
			else {
				H -= max_ab.first * n;
				if (H > 0) num += n + 1;
				else num += n;
			}
		}
	}

	cout << num << endl;

	//system("pause");
	return 0;
}

Compiler output:
a.cc:78:2: error: unterminated argument list invoking macro "rep"
   78 | }
      |  ^
a.cc: In function 'int main()':
a.cc:40:9: error: 'rep' was not declared in this scope
   40 |         rep(i, ab.size() {
      |         ^~~
a.cc:40:12: error: expected '}' at end of input
   40 |         rep(i, ab.size() {
      |            ^
a.cc:29:12: note: to match this '{'
   29 | int main() {
      |            ^
Language: C++

# include <bits/stdc++.h>

std :: vector < std :: pair < int, bool > > swords ;

int main ( )  {
	int n, h ;

	scanf ( "%d%d", & n, & h ) ;

	for ( int i = 1 ; i <= n ; ++ i )  {
		int a, b ;
		scanf ( "%d%d", & a, & b ) ;
		swords.push_back ( std :: make_pair ( a, 0 ) ) ;
		swords.push_back ( std :: make_pair ( b, 1 ) ) ;
	}

	std :: sort ( swords.begin ( ), swords.end ( ) ) ;

	int ans ( 0 ) ;

	for ( std :: vector < std :: pair < int, bool > > :: reverse_iterator it = swords.rbegin ( ) ; it != swords.rend ( ) ; ++ it )  {
		if ( it -> second )  ++ ans, h -= it -> first ;
		else {
			if ( h / it -> first )  ans += h / it -> first, h %= it -> first ;
			else  {
				++ ans, h -= it -> first ;
				break ;
			}
		}
		if ( h <= 0 )  break ;
	}
	
	if ( h > 0 )  {
		ans += h / it -> first + 1 ;
	}

	return ! printf ( "%d\n", ans ) ;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:34:28: error: 'it' was not declared in this scope; did you mean 'int'?
   34 |                 ans += h / it -> first + 1 ;
      |                            ^~
      |                            int
Language: C++

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

priority_queue<pair<int, bool> > q;

int main(){
    int n,h,i,a,b,i;
    scanf("%d%d",&n,&h);
    for(i=1;i<=n;i++){
        scanf("%d%d",&a,&b);
        q.push(make_pair(a,1));
        q.push(make_pair(b,0));
    }
    int ans=0;
    while(h>0){
        int attack=q.top().first;
        bool multi_attack=q.top().second;
        q.pop();
        if(multi_attack){
            int cnt=h/attack;
            if(h%attack)cnt++;
            h-=attack*cnt;
            ans+=cnt;
        }
        else{
            h-=attack;
            ans++;
        }
    }
    printf("%d\n", ans);
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:7:19: error: redeclaration of 'int i'
    7 |     int n,h,i,a,b,i;
      |                   ^
a.cc:7:13: note: 'int i' previously declared here
    7 |     int n,h,i,a,b,i;
      |             ^
Language: C++

#include <iostream>
#include <vector>
using namespace std;
typdef long long ll;
int main(void) {
  int n, h;
  cin >> n >> h;
  vector<int> a(n), b(n);
  int maxa = 0;
  for (int i = 0; i < n; i++) {
    cin >> a[i] >> b[i];
    if (a[i] > maxa) maxa = a[i];
  }
  int ans = 0;
  for (int i = 0; i < n; i++) {
    if (b[i] > maxa && h > 0) {
      h -= b[i];
      ans++;
    }
  }
  if (h > 0) {
    h += maxa - 1;
    ans += h / maxa;
  }
  cout << ans << endl;
  return 0;
}

Compiler output:
a.cc:4:1: error: 'typdef' does not name a type; did you mean 'typedef'?
    4 | typdef long long ll;
      | ^~~~~~
      | typedef
Language: C++

#include <iostream>
#include<string>
#include<cstdio>
#include<algorithm>
using namespace std;
int main(void){
   int a[100001]={},b[100002]={},n,h;
   int cnt=0,sum=0,i;
   cin>>n>>h;
   for(i=0;i<n;i++){
       cin>>a[i]>>b[i];
       if(a[0]<a[i])a[0]=a[i];
   }
   sort(b,b+i,greater<int>());
   while(1){
       if(b[k]>=a[0]){sum+=b[k];cnt++;}
       else break;
       if(sum>=h)break;
   }
   if(h-sum>0)cnt+=(h-sum)/a[0];
   if((h-sum)%a[0]!=0)cnt++;
   cout<<k<<endl;
   return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:16:13: error: 'k' was not declared in this scope
   16 |        if(b[k]>=a[0]){sum+=b[k];cnt++;}
      |             ^
a.cc:22:10: error: 'k' was not declared in this scope
   22 |    cout<<k<<endl;
      |          ^
Language: C++

#include <iostream>
#include <iomanip>
#include <string>
#include <set>
#include <vector>
#include <algorithm>

using namespace std;

int main() {
    int N, H, a, b;
    cin >> N >> H;
    int aMax = 0;
    vector<int> B(N);
    for(int i = 0; i < N; i++) {
        cin >> a >> b;
        if(a > aMax) {
            aMax = a;
        }
        B[i] = b;
    }
    sort(B.begin(), B.end(), greater<int>());
    for(int i = 0; i < B.size(); i++) {
        if(B[i] < aMax) {
            cout << (i + int(ceil((double)H / aMax))) << endl;
            return 0;
        }
        H -= B[i];
        if(H <= 0) {
            cout << (i+1) << endl;
            return 0;
        }
    }
    cout << (N + int(ceil((double)H / aMax))) << endl;
    return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:25:30: error: 'ceil' was not declared in this scope
   25 |             cout << (i + int(ceil((double)H / aMax))) << endl;
      |                              ^~~~
a.cc:34:22: error: 'ceil' was not declared in this scope
   34 |     cout << (N + int(ceil((double)H / aMax))) << endl;
      |                      ^~~~
Language: C++

#include<iostream>
#include<string>
#include<algorithm>
#include<set> 
#define LL long long 
using namespace std;
#dafine inf 0x3f3f3f3f
struct node
{
	int a,b,t;
}a[100005];
int dp[100005];
bool cmp(node a,node b)
{
	if(a.b==b.b) return a.a>b.a;
	return a.b>b.b;
}
int main()
{
	int n,h;
	cin>>n>>h;
	int maxa=-1;
	int maxb=-1;
	int in=1;
	for(int i=1;i<=n;i++)
	{
		cin>>a[i].a>>a[i].b;
		a[i].t=i;
		if(a[i].a>maxa)
		{
			in=i;
			maxa=a[i].a;
			maxb=a[i].b;
		}	
	}
	int ans=0;
	sort(a+1,a+1+n,cmp);
	for(int i=1;i<=n;i++) dp[i]=dp[i-1]+a[i].b;
	int ans1=inf,ans2=inf;
	
	for(int i=1;i<=n;i++)
	{	
		if(dp[i]>=h) ans2=min(ans2,i);
		if(a[i].a==maxa){
			int t=0,th=h;
			t+=i;
			th-=dp[i];
			if(th<=0){
				ans1=min(ans1,t);
				break;
			}
			if(th%a[i].a!=0) t++;
			t+=th/a[i].a; 
			ans1=min(ans1,t);
			//cout<<t<<endl;
		}
	}
	cout<<min(ans1,ans2)<<endl;
} 

Compiler output:
a.cc:7:2: error: invalid preprocessing directive #dafine; did you mean #define?
    7 | #dafine inf 0x3f3f3f3f
      |  ^~~~~~
      |  define
a.cc: In function 'int main()':
a.cc:39:18: error: 'inf' was not declared in this scope; did you mean 'in'?
   39 |         int ans1=inf,ans2=inf;
      |                  ^~~
      |                  in
a.cc:43:30: error: 'ans2' was not declared in this scope; did you mean 'ans1'?
   43 |                 if(dp[i]>=h) ans2=min(ans2,i);
      |                              ^~~~
      |                              ans1
a.cc:58:24: error: 'ans2' was not declared in this scope; did you mean 'ans1'?
   58 |         cout<<min(ans1,ans2)<<endl;
      |                        ^~~~
      |                        ans1
Language: C++

#include<iostream>
#include<string>
#include<algorithm>
#include<set> 
#define LL long long 
using namespace std;

struct node
{
	int a,b,t;
}a[100005];
bool cmp(node a,node b)
{
	return a.b>b.b;
}
int main()
{
	int n,h;
	cin>>n>>h;
	int maxa=-1;
	int maxb=-1;
	int in=1;
	for(int i=1;i<=n;i++)
	{
		cin>>a[i].a>>a[i].b;
		a[i].t=i;
		if(a[i].a>maxa)
		{
			in=i;
			maxa=a[i].a;
			maxb=a[i].b;
		}	
	}
	int ans=0;
	sort(a+1,a+1+n,cmp);
	for(int i=1;i<=n;i++)
	{	
	
//		if(a[i].a<a[i+1].b&&a[i].a!=maxa){
//			ans++;
//			h-=a[i].b;
//		}
		
		if(a[i].t!=in&&a[i].b>=maxa)
		{
			h-=a[i].b;
			ans++;
			if(h<=0)
				break;
			else
			{
				if(maxb>a[i].b&&h-(maxb-a[i].b)<=0)
					h=-1,break;
			}
		}
		if(a[i].b<maxa)
			break;
	}
	if(h<=0)
		cout<<ans;
	else
	{
		if(h<=maxb)
			cout<<ans+1;
		else
			cout<<(ans+1+(h-maxb+maxa-1)/maxa);
	}
} 

Compiler output:
a.cc: In function 'int main()':
a.cc:53:46: error: expected primary-expression before 'break'
   53 |                                         h=-1,break;
      |                                              ^~~~~
Language: C++

#include<iostream>
#include<string>
#include<algorithm>
#include<set> 
#define LL long long 
using namespace std;

struct node
{
	int a,b,t;
}a[100005];
bool cmp(node a,node b)
{
	return a.b>b.b;
}
int main()
{
	int n,h;
	cin>>n>>h;
	int maxa=-1;
	int maxb=-1;
	int in=1;
	for(int i=1;i<=n;i++)
	{
		cin>>a[i].a>>a[i].b;
		a[i].t=i;
		if(a[i].a>maxa)
		{
			in=i;
			maxa=a[i].a;
			maxb=a[i].b;
		}	
	}
	int ans=0;
	sort(a+1,a+1+n,cmp);
	for(int i=1;i<n;i++)
	{	
	
//		if(a[i].a<a[i+1].b&&a[i].a!=maxa){
//			ans++;
//			h-=a[i].b;
//		}
		
		if(a[i].t!=in&&a[i].b>=maxa)
		{
			h-=a[i].b;
			ans++;
			if(h<=0)
				break;
			else
			{
				if(maxb>a[i].b&&h-(maxb-a[i].b)<=0)
					h=-1,break;
			}
		}
		if(a[i].b<maxa)
			break;
	}
	if(h<=0)
		cout<<ans;
	else
	{
		if(h<=maxb)
			cout<<ans+1;
		else
			cout<<(ans+1+(h-maxb+maxa-1)/maxa);
	}
} 

Compiler output:
a.cc: In function 'int main()':
a.cc:53:46: error: expected primary-expression before 'break'
   53 |                                         h=-1,break;
      |                                              ^~~~~
Language: C++

#include<iostream>
#include<string>
#include<vector>
#include<algorithm>
#include<queue>
 
using namespace std;
 
int main(){
    long long N,H;
    cin>>N>>H;
    vector <long long>a(N);
    vector <long long>b(N);
    for(int i=0 ; i<N ; i++){
        cin>>a[i];
        cin>>b[i];
    }
    long long ans=0;
    sort(a.begin(),a.end());
    sort(b.begin(),b.end());
    for(long long i=N-1 ; i>=0 ; i--){
        if(a[N-1]>=b[i] || H>0)break;
           H-=b[i];
           ans+=1;
        }
    }
    if(H>0){
        ans+=(long long)(H/a[N-1]);
        if(H%a[N-1]!=0)ans+=1;
    }
    cout<<ans<<endl;
    return 0;
}

Compiler output:
a.cc:27:5: error: expected unqualified-id before 'if'
   27 |     if(H>0){
      |     ^~
a.cc:31:5: error: 'cout' does not name a type
   31 |     cout<<ans<<endl;
      |     ^~~~
a.cc:32:5: error: expected unqualified-id before 'return'
   32 |     return 0;
      |     ^~~~~~
a.cc:33:1: error: expected declaration before '}' token
   33 | }
      | ^
Language: C++

#include<iostream>
#include<string>
#include<vector>
#include<algorithm>
#include<queue>
 
using namespace std;
 
int main(){
    long long N,H;
    cin>>N>>H;
    vector <long long>a(N);
    vector <long long>b(N);
    for(int i=0 ; i<N ; i++){
        cin>>a[i];
        cin>>b[i];
    }
    long long ans=0;
    sort(a.begin(),a.end());
    sort(b.begin(),b.end());
    for(long long i=N-1 ; i>0 ; i--){
        if(a[N-1]>=b[i])break;
        H-=b[i];
        ans+=1;
        if(H<=0)break;
    }
    if(H>0){
        ans+=(long)(H/a_m);
        if(H%a_m!=0)ans+=1;
    }
    cout<<ans<<endl;
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:28:23: error: 'a_m' was not declared in this scope
   28 |         ans+=(long)(H/a_m);
      |                       ^~~
Language: C++

#include<iostream>
#include<string>
#include<vector>
#include<algorithm>
#include<queue>
 
using namespace std;
 
int main(){
    long long N,H;
    cin>>N>>H;
    vector <long long>a(N);
    vector <long long>b(N);
    for(int i=0 ; i<N ; i++){
        cin>>a[i];
        cin>>b[i];
    }
    long long ans=0;
    sort(a.begin(),a.end());
    sort(b.begin(),b.end());
    a_m=a[N-1];
    for(long long i=N-1 ; i>0 ; i--){
        if(a[N-1]>=b[i])break;
        H-=b[i];
        ans+=1;
        if(H<=0)break;
    }
    if(H>0){
    	ans+=(long)(H/a_m);
        if(H%a_m!=0)ans+=1;
    }
    cout<<ans<<endl;
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:21:5: error: 'a_m' was not declared in this scope
   21 |     a_m=a[N-1];
      |     ^~~
Language: C++

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

using namespace std;

int main(){
    long long N,H;
    cin>>N>>H;
    vector <long long>a(N);
    vector <long long>b(N);
    for(int i=0 ; i<N ; i++){
        cin>>a[i];
        cin>>b[i];
    }
    
    long long a_m;
    long long ans=0;
    sort(a.begin(),a.end());
    sort(b.begin(),b.end());
    a_m=a[N-1];
    
    for(long long i=N-1 ; i>0 ; i--){
        f(a_m<=b[i]){
            H-=b[i];
            ans+=1;
        }
        if(H<=0){
            break;
        }
    }
    if(H>0){
        while(1){
            ans+=1;
            H-=a_m;
            if(H<=0)break;
        }
    }
    cout<<ans<<endl;
    return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:26:9: error: 'f' was not declared in this scope
   26 |         f(a_m<=b[i]){
      |         ^
Language: C++

#include <bits/stdc++.h>
 
using namespace std;
 
int main()
{
int n, h; cin >> n >> h;
vector<int> a(n), b(n); 
for (int i = 0; i < n; ++i) cin >> a[i] >> b[i];
int ans = 1e9, sum = 0;
for (int i = 0; i < n; ++i) sum += b[n-1-i], ans = min(ans, max(1, (h - sum + a[n-1]-1) / a[n-1]);
cout << ans << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:11:98: error: expected ')' before ';' token
   11 | for (int i = 0; i < n; ++i) sum += b[n-1-i], ans = min(ans, max(1, (h - sum + a[n-1]-1) / a[n-1]);
      |                                                       ~                                          ^
      |                                                                                                  )