Language: Java

#include <iostream>
#include <cstring>
#include <algorithm>
#include <vector>
#include <string>
#include <math.h>
#include <iomanip>
#include <limits>
#include <list>
#include <queue>
#include <tuple>
#include <map>
#include <stack>
#include <set>
using namespace std;
#define MOD (long long int)(1e9+7)
#define ll long long int
#define rep(i,n) for(int i=0; i<(int)(n); i++)
#define reps(i,n) for(int i=1; i<=(int)(n); i++)
#define REP(i,n) for(int i=n-1; i>=0; i--)
#define REPS(i,n) for(int i=n; i>0; i--)
#define INF (int)(1123456789)
#define LINF (long long int)(112345678901234567)
#define chmax(a, b) a = (((a)<(b)) ? (b) : (a))
#define chmin(a, b) a = (((a)>(b)) ? (b) : (a))
#define all(v) v.begin(), v.end()

const int N = (int)3e5;

ll mpow(ll a, ll b){
  if(b==0) return 1;
  else if(b%2==0){ll memo = mpow(a,b/2); return memo*memo%MOD;}
  else return mpow(a,b-1) * a % MOD;
}
ll lpow(ll a, ll b){
  if(b==0) return 1;
  else if(b%2==0){ll memo = lpow(a,b/2); return memo*memo;}
  else return lpow(a,b-1) * a;
}
ll gcd(ll a, ll b){
  if(b==0) return a;
  else return gcd(b, a%b);
}
vector<ll> kaijo_memo;
ll kaijo(ll n){
  if(kaijo_memo.size() > n) return kaijo_memo[n];
  if(kaijo_memo.size() == 0) kaijo_memo.push_back(1);
  while(kaijo_memo.size() <= n) kaijo_memo.push_back(kaijo_memo[kaijo_memo.size()-1] * kaijo_memo.size() % MOD);
  return kaijo_memo[n];
}
vector<ll> gyaku_kaijo_memo;
ll gyaku_kaijo(ll n){
  if(gyaku_kaijo_memo.size() > n) return gyaku_kaijo_memo[n];
  if(gyaku_kaijo_memo.size() == 0) gyaku_kaijo_memo.push_back(1);
  while(gyaku_kaijo_memo.size() <= n) gyaku_kaijo_memo.push_back(gyaku_kaijo_memo[gyaku_kaijo_memo.size()-1] * mpow(gyaku_kaijo_memo.size(), MOD-2) % MOD);
  return gyaku_kaijo_memo[n];
}

ll nCr(ll n, ll r){
  if(n == r) return 1;//0個の丸と-1個の棒みたいな時に時に効く？不安.
  if(n < r || r < 0) return 0;
  ll ret = 1;
  ret *= kaijo(n); ret %= MOD;
  ret *= gyaku_kaijo(r); ret %= MOD;
  ret *= gyaku_kaijo(n-r); ret %= MOD;
  return ret;
}

int n,m;
list<int> G[1000];
double dp[1000],p[1000];
double func(int now){
  if(now == 0){
    rep(i,n){
      dp[i] = 0.0;
      p[i] = 0.0;
    }
    p[0] = 1.0;
  }
  if(now == n-1){
    return dp[now];
  }
  if((dp[now] > 0 || now == 0) && G[now].size() == 0){
    return LINF;
  }
  for(auto itr = G[now].begin(); itr != G[now].end(); itr++){
    int to = *itr;
    dp[to] += (p[now] + dp[now]) / 1.0 / G[now].size();
    p[to] += p[now] / 1.0 / G[now].size();
  }
  return func(now+1);
}

int main(void){
  cin>>n>>m;
  rep(i,m){
    ll s,t;
    cin>>s>>t;s--;t--;
    G[s].push_back(t);
  }
  double ans = func(0);
  rep(i,n){
    rep(j,G[i].size()){
      int hoge = G[i].front();
      G[i].pop_front();
      chmin(ans, func(0));
      G[i].push_back(hoge);
    }
  }
  cout<<setprecision(10)<<ans<<endl;
  return 0;
}


Compiler output:
Main.java:1: error: illegal character: '#'
#include <iostream>
^
Main.java:2: error: illegal character: '#'
#include <cstring>
^
Main.java:3: error: illegal character: '#'
#include <algorithm>
^
Main.java:4: error: illegal character: '#'
#include <vector>
^
Main.java:5: error: illegal character: '#'
#include <string>
^
Main.java:6: error: illegal character: '#'
#include <math.h>
^
Main.java:7: error: illegal character: '#'
#include <iomanip>
^
Main.java:8: error: illegal character: '#'
#include <limits>
^
Main.java:9: error: illegal character: '#'
#include <list>
^
Main.java:10: error: illegal character: '#'
#include <queue>
^
Main.java:11: error: illegal character: '#'
#include <tuple>
^
Main.java:12: error: illegal character: '#'
#include <map>
^
Main.java:13: error: illegal character: '#'
#include <stack>
^
Main.java:14: error: illegal character: '#'
#include <set>
^
Main.java:16: error: illegal character: '#'
#define MOD (long long int)(1e9+7)
^
Main.java:16: error: class, interface, enum, or record expected
#define MOD (long long int)(1e9+7)
        ^
Main.java:17: error: illegal character: '#'
#define ll long long int
^
Main.java:18: error: illegal character: '#'
#define rep(i,n) for(int i=0; i<(int)(n); i++)
^
Main.java:18: error: class, interface, enum, or record expected
#define rep(i,n) for(int i=0; i<(int)(n); i++)
                              ^
Main.java:18: error: class, interface, enum, or record expected
#define rep(i,n) for(int i=0; i<(int)(n); i++)
                                          ^
Main.java:19: error: illegal character: '#'
#define reps(i,n) for(int i=1; i<=(int)(n); i++)
^
Main.java:19: error: class, interface, enum, or record expected
#define reps(i,n) for(int i=1; i<=(int)(n); i++)
                               ^
Main.java:19: error: class, interface, enum, or record expected
#define reps(i,n) for(int i=1; i<=(int)(n); i++)
                                            ^
Main.java:20: error: illegal character: '#'
#define REP(i,n) for(int i=n-1; i>=0; i--)
^
Main.java:20: error: class, interface, enum, or record expected
#define REP(i,n) for(int i=n-1; i>=0; i--)
                                ^
Main.java:20: error: class, interface, enum, or record expected
#define REP(i,n) for(int i=n-1; i>=0; i--)
                                      ^
Main.java:21: error: illegal character: '#'
#define REPS(i,n) for(int i=n; i>0; i--)
^
Main.java:21: error: class, interface, enum, or record expected
#define REPS(i,n) for(int i=n; i>0; i--)
                               ^
Main.java:21: error: class, interface, enum, or record expected
#define REPS(i,n) for(int i=n; i>0; i--)
                                    ^
Main.java:22: error: illegal character: '#'
#define INF (int)(1123456789)
^
Main.java:23: error: illegal character: '#'
#define LINF (long long int)(112345678901234567)
^
Main.java:24: error: illegal character: '#'
#define chmax(a, b) a = (((a)<(b)) ? (b) : (a))
^
Main.java:25: error: illegal character: '#'
#define chmin(a, b) a = (((a)>(b)) ? (b) : (a))
^
Main.java:26: error: illegal character: '#'
#define all(v) v.begin(), v.end()
^
Main.java:30: error: unnamed classes are a preview feature and are disabled by default.
ll mpow(ll a, ll b){
^
  (use --enable-preview to enable unnamed classes)
Main.java:69: error: class, interface, enum, or record expected
int n,m;
^
Main.java:70: error: class, interface, enum, or record expected
list<int> G[1000];
^
Main.java:71: error: class, interface, enum, or record expected
double dp[1000],p[1000];
^
Main.java:74: error: ';' expected
    rep(i,n){
            ^
Main.java:87: error: illegal start of expression
    int to = *itr;
             ^
Main.java:95: error: not a statement
  cin>>n>>m;
        ^
Main.java:98: error: not a statement
    cin>>s>>t;s--;t--;
          ^
Main.java:110: error: not a statement
  cout<<setprecision(10)<<ans<<endl;
                             ^
Main.java:94: error: <identifier> expected
int main(void){
             ^
Main.java:96: error: ';' expected
  rep(i,m){
          ^
Main.java:102: error: ';' expected
  rep(i,n){
          ^
Main.java:103: error: ';' expected
    rep(j,G[i].size()){
                      ^
47 errors