Language: Java

#include<iostream>
#include<vector>
#include<cmath>
#include<algorithm>
#include<cassert>
#include<iomanip>
#define REP(i,s,n) for(int i=s;i<n;i++)
#define rep(i,n) REP(i,0,n)
#define inf (1<<28)
#define PI 3.14159265358979
#define MAX 45
#define EPS (1e-10)
#define equals(a,b) (fabs((a)-(b)) < EPS)
using namespace std;
typedef long double ld;
int n,m;
ld p[MAX];
ld area[MAX][MAX][MAX];//area[start point][last point][new point] := the area
ld dp[MAX][MAX][MAX];//dp[start point][last point][the number] := maximum area

double getArea(int i,int j)
{
  assert(i < n && j < n);
  return sin((p[j]-p[i])*2*PI)/2.0;//S = (b*c*sinA)/2,in this case, b = c = 1
}

void init_area()
{
  rep(i,n)//start point
    {
      REP(j,i,n)//last point
	{
	  REP(k,j,n)//new point
	    {
	      area[i][j][k] = getArea(i,j)+getArea(j,k)+getArea(k,i);
	    }
	}
    }
}

int main()
{
  while(cin >> n >> m,n|m)
    {
      rep(i,n)cin >> p[i];

      init_area();

      rep(i,MAX)rep(j,MAX)rep(k,MAX)dp[i][j][k] = -inf;
      rep(i,MAX)rep(j,MAX)dp[i][j][2] = 0;
      ld ans = -inf;
      rep(sp,n)
	{
	  //for(int cnt=m-1;cnt>=2;cnt--)
	  REP(cnt,2,m)
	    {
	      REP(lp,sp+1,n)
		{
		  REP(np,lp+1,n)
		    {
		      //if(cnt+1 == 4)cout <<" in? " << "dp["<<sp<<"]["<<lp<<"]["<<cnt<<"]" << endl;
		      if(dp[sp][lp][cnt] == -inf)continue;
		      //if(cnt+1 == 4)cout <<" in! " << dp[sp][lp][cnt] << endl;
		      dp[sp][np][cnt+1] = max(dp[sp][np][cnt+1],
					      dp[sp][lp][cnt]+area[sp][lp][np]);
	
		     
		      if(cnt+1 <= m)
			ans = max(ans,dp[sp][np][cnt+1]);  
		    }
		}
	    }
	}
      //rep(i,n)rep(j,n)cout << "dp["<<i<<"]["<<j<<"]["<<3<<"] = "<< dp[i][j][3] << endl;
      cout << setiosflags(ios::fixed) << setprecision(10) << ans << endl;
      //cout <<" ::: " <<  dp[0][3][4] << endl;
      //cout <<" ::: " <<  dp[1][3][3] << endl;
    }
  return 0;
}

Compiler output:
Main.java:1: error: illegal character: '#'
#include<iostream>
^
Main.java:2: error: illegal character: '#'
#include<vector>
^
Main.java:3: error: illegal character: '#'
#include<cmath>
^
Main.java:4: error: illegal character: '#'
#include<algorithm>
^
Main.java:5: error: illegal character: '#'
#include<cassert>
^
Main.java:6: error: illegal character: '#'
#include<iomanip>
^
Main.java:7: error: illegal character: '#'
#define REP(i,s,n) for(int i=s;i<n;i++)
^
Main.java:7: error: class, interface, enum, or record expected
#define REP(i,s,n) for(int i=s;i<n;i++)
                               ^
Main.java:7: error: class, interface, enum, or record expected
#define REP(i,s,n) for(int i=s;i<n;i++)
                                   ^
Main.java:8: error: illegal character: '#'
#define rep(i,n) REP(i,0,n)
^
Main.java:9: error: illegal character: '#'
#define inf (1<<28)
^
Main.java:10: error: illegal character: '#'
#define PI 3.14159265358979
^
Main.java:11: error: illegal character: '#'
#define MAX 45
^
Main.java:12: error: illegal character: '#'
#define EPS (1e-10)
^
Main.java:13: error: illegal character: '#'
#define equals(a,b) (fabs((a)-(b)) < EPS)
^
Main.java:15: error: class, interface, enum, or record expected
typedef long double ld;
^
Main.java:16: error: class, interface, enum, or record expected
int n,m;
^
Main.java:17: error: class, interface, enum, or record expected
ld p[MAX];
^
Main.java:18: error: class, interface, enum, or record expected
ld area[MAX][MAX][MAX];//area[start point][last point][new point] := the area
^
Main.java:19: error: class, interface, enum, or record expected
ld dp[MAX][MAX][MAX];//dp[start point][last point][the number] := maximum area
^
Main.java:21: error: unnamed classes are a preview feature and are disabled by default.
double getArea(int i,int j)
^
  (use --enable-preview to enable unnamed classes)
Main.java:29: error: ';' expected
  rep(i,n)//start point
          ^
Main.java:31: error: ';' expected
      REP(j,i,n)//last point
                ^
Main.java:33: error: ';' expected
	  REP(k,j,n)//new point
	            ^
Main.java:43: error: not a statement
  while(cin >> n >> m,n|m)
                       ^
Main.java:45: error: not a statement
      rep(i,n)cin >> p[i];
                  ^
Main.java:75: error: not a statement
      cout << setiosflags(ios::fixed) << setprecision(10) << ans << endl;
                                                                 ^
Main.java:43: error: ')' expected
  while(cin >> n >> m,n|m)
                     ^
Main.java:43: error: ';' expected
  while(cin >> n >> m,n|m)
                         ^
Main.java:45: error: ';' expected
      rep(i,n)cin >> p[i];
              ^
Main.java:49: error: ';' expected
      rep(i,MAX)rep(j,MAX)rep(k,MAX)dp[i][j][k] = -inf;
                ^
Main.java:49: error: ';' expected
      rep(i,MAX)rep(j,MAX)rep(k,MAX)dp[i][j][k] = -inf;
                          ^
Main.java:49: error: ';' expected
      rep(i,MAX)rep(j,MAX)rep(k,MAX)dp[i][j][k] = -inf;
                                    ^
Main.java:50: error: ';' expected
      rep(i,MAX)rep(j,MAX)dp[i][j][2] = 0;
                ^
Main.java:50: error: ';' expected
      rep(i,MAX)rep(j,MAX)dp[i][j][2] = 0;
                          ^
Main.java:52: error: ';' expected
      rep(sp,n)
               ^
Main.java:55: error: ';' expected
	  REP(cnt,2,m)
	              ^
Main.java:57: error: ';' expected
	      REP(lp,sp+1,n)
	                    ^
Main.java:59: error: ';' expected
		  REP(np,lp+1,n)
		                ^
39 errors