Language: Java

#include<iostream>
#include<cstdio>
#include<cmath>
#include<climits>
#include<ctime>
#include<cstdlib>
#include<vector>
#include<algorithm>
#include<cassert>
using namespace std;
#define REP(i,b,n) for(int i=b;i<n;i++)
#define rep(i,n)   REP(i,0,n)
#define pb push_back
#define mp make_pair
#define ALL(C) (C).begin(),(C).end()
#define fi first
#define se second

typedef long long ll;

const int N = 30000;
const int M = 30000;

class st{
public:
  double x,y;
  bool operator<(const st & a)const{
    return y < a.y;
  }
};

st in[N];

int num[N];//num of chips in range
int l[M],r[M];

bool islower_line(double x,double y,double a,double b){
  return y < a*x+b;
}

void put_xy(int m,int w,int n){
  int now=0;
  rep(i,n){
    while(now +1 < m && !islower_line(in[i].x,in[i].y,
				      (r[now]-l[now])/(double)w,
				      l[now]))now++;
    num[now]++;
  }
  //rep(i,m)cout << num[i]<< " " ;cout << endl;
  return;
}

int solve(int m,ll s,int w){
  int ret=0,now=0;
  int head=0,tail=0;
  int lbase=0,rbase=0;
  while(true){
    //back++
    while(tail < m){
      if ((ll)w*(ll)(l[tail]-lbase+r[tail]-rbase) > 2*s)break;
      now+=num[tail];
      tail++;
    }
    ret=max(ret,now);
    if (tail == m)break;
    //head++;
    head++;
    lbase=l[head-1];
    rbase=r[head-1];
    now-=num[head-1];
  }
  return ret;
}

int main(){
  int n,m,w,h;
  ll s;
  ll maxs=0;
  int maxh=0,maxw=0,maxhw=0;
  while(scanf("%d%d%d%d%lld",&n,&m,&w,&h,&s) != EOF){
    maxs=max(maxs,s);
    maxhw=max(maxhw,h*w);
    maxh=max(h,maxh);
    maxw=max(w,maxw);
    if (n==0&&m==0&&w==0&&h==0&&s==0)break;
    rep(i,m)num[i]=0;
    rep(i,m)scanf("%d%d",&l[i],&r[i]);
    rep(i,n){
      double x,y;
      scanf("%lf%lf",&in[i].x,&in[i].y);
    }
    sort(in,in+n);
    put_xy(m,w,n);
    s=(ll)w*(ll)h-s;
    printf("%d\n",n-solve(m,s,w));
  }
  cout << maxh <<" " << maxw << " " << maxs <<" "<< maxhw<<endl;
  return false;
}

Compiler output:
Main.java:1: error: illegal character: '#'
#include<iostream>
^
Main.java:2: error: illegal character: '#'
#include<cstdio>
^
Main.java:3: error: illegal character: '#'
#include<cmath>
^
Main.java:4: error: illegal character: '#'
#include<climits>
^
Main.java:5: error: illegal character: '#'
#include<ctime>
^
Main.java:6: error: illegal character: '#'
#include<cstdlib>
^
Main.java:7: error: illegal character: '#'
#include<vector>
^
Main.java:8: error: illegal character: '#'
#include<algorithm>
^
Main.java:9: error: illegal character: '#'
#include<cassert>
^
Main.java:11: error: illegal character: '#'
#define REP(i,b,n) for(int i=b;i<n;i++)
^
Main.java:11: error: class, interface, enum, or record expected
#define REP(i,b,n) for(int i=b;i<n;i++)
        ^
Main.java:11: error: class, interface, enum, or record expected
#define REP(i,b,n) for(int i=b;i<n;i++)
                               ^
Main.java:11: error: class, interface, enum, or record expected
#define REP(i,b,n) for(int i=b;i<n;i++)
                                   ^
Main.java:12: error: illegal character: '#'
#define rep(i,n)   REP(i,0,n)
^
Main.java:13: error: illegal character: '#'
#define pb push_back
^
Main.java:14: error: illegal character: '#'
#define mp make_pair
^
Main.java:15: error: illegal character: '#'
#define ALL(C) (C).begin(),(C).end()
^
Main.java:16: error: illegal character: '#'
#define fi first
^
Main.java:17: error: illegal character: '#'
#define se second
^
Main.java:21: error: class, interface, enum, or record expected
const int N = 30000;
^
Main.java:22: error: class, interface, enum, or record expected
const int M = 30000;
^
Main.java:25: error: illegal start of type
public:
      ^
Main.java:27: error: ';' expected
  bool operator<(const st & a)const{
               ^
Main.java:27: error: <identifier> expected
  bool operator<(const st & a)const{
                ^
Main.java:27: error: illegal start of type
  bool operator<(const st & a)const{
                 ^
Main.java:32: error: class, interface, enum, or record expected
st in[N];
^
Main.java:34: error: class, interface, enum, or record expected
int num[N];//num of chips in range
^
Main.java:35: error: class, interface, enum, or record expected
int l[M],r[M];
^
Main.java:37: error: unnamed classes are a preview feature and are disabled by default.
bool islower_line(double x,double y,double a,double b){
^
  (use --enable-preview to enable unnamed classes)
Main.java:43: error: ';' expected
  rep(i,n){
          ^
Main.java:97: error: not a statement
  cout << maxh <<" " << maxw << " " << maxs <<" "<< maxhw<<endl;
                                                         ^
Main.java:80: error: illegal start of expression
  while(scanf("%d%d%d%d%lld",&n,&m,&w,&h,&s) != EOF){
                             ^
Main.java:80: error: illegal start of expression
  while(scanf("%d%d%d%d%lld",&n,&m,&w,&h,&s) != EOF){
                                ^
Main.java:80: error: illegal start of expression
  while(scanf("%d%d%d%d%lld",&n,&m,&w,&h,&s) != EOF){
                                   ^
Main.java:80: error: illegal start of expression
  while(scanf("%d%d%d%d%lld",&n,&m,&w,&h,&s) != EOF){
                                      ^
Main.java:80: error: illegal start of expression
  while(scanf("%d%d%d%d%lld",&n,&m,&w,&h,&s) != EOF){
                                         ^
Main.java:86: error: ';' expected
    rep(i,m)num[i]=0;
            ^
Main.java:87: error: ';' expected
    rep(i,m)scanf("%d%d",&l[i],&r[i]);
            ^
Main.java:87: error: illegal start of expression
    rep(i,m)scanf("%d%d",&l[i],&r[i]);
                         ^
Main.java:87: error: illegal start of expression
    rep(i,m)scanf("%d%d",&l[i],&r[i]);
                               ^
Main.java:88: error: ';' expected
    rep(i,n){
            ^
Main.java:90: error: illegal start of expression
      scanf("%lf%lf",&in[i].x,&in[i].y);
                     ^
Main.java:90: error: illegal start of expression
      scanf("%lf%lf",&in[i].x,&in[i].y);
                              ^
43 errors