Language: Java

#include <iostream>
#include <vector>
#include <string>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <unordered_map>
#include <algorithm>
#include <functional>
#include <numeric>
#include <cstring>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cassert>
#define bogo_sort   std::sort
#define bozo_sort   std::stable_sort
#define alles(obj)  obj.begin(), obj.end()
#define elif        else if
#define unless(flg) if(!(flg))
#define elless(flg) else if(!(flg))
#define echo        std::cout <<
#define read        std::cin >>
#define endl        std::endl
#define fin         << '\n'
#define bash        push_back
#define makePair    std::make_pair
#define _           << ' ' <<
// type-define
#define Stack       std::stack
#define Queue       std::queue
#define Set         std::set
#define PQueue      std::priority_queue
#define Vector      std::vector
#define Pair        std::pair
#define Map         std::map
#define HashMap     std::unordered_map
#define Greater     std::greater
using String  =     std::string;
using llong   =     long long;
using boolean =     bool;
using Pii     =     Pair<int, int>;
using Vi      =     Vector<int>;
using Vii     =     Vector<Pii>;
// utils
constexpr int   dx[] = {1, 0, -1, 0, 1, 1, -1, -1};
constexpr int   dy[] = {0, 1, 0, -1, 1, -1, 1, -1};
constexpr int   INF  = 0x3f3f3f3f;
constexpr llong LINF = 0x3f3f3f3f3f3f3f3fLL;

namespace {
    template<class A, class B> A power ( llong x, llong n, llong mod ) {
        llong ans = 1;
        while ( n > 0 ) {
            if ( n & 1 ) ans = ( ans * x ) % mod;
            x = ( x * x ) % mod;
            n >>= 1;
        }
        return ans;
    }
    template<class A, class B> A power ( A x, B n ) { return power( x, n, 1000000007 ); }
    template<class A> A gcd ( A x, A y ) { return x % y ? gcd( y, x % y ) : y; }
    template<class A, class B> A lcm   ( A x,  B y ) { return ( x / gcd(x, y) * y ); }
    template<class A> inline A abs ( A n ) { return ( n < 0 ) ? -n : n; }
    template<class A, class B> inline bool chmax ( A &a, const B &b ) { return b > a ? a = b, true : false; }
    template<class A, class B> inline bool chmin ( A &a, const B &b ) { return b < a ? a = b, true : false; }
    boolean isMovable ( int x, int y, int w, int h ) {
        return ( x >= 0 && y >= 0 && x < w && y < h );
    }
}

namespace Rlyeh {

    llong n;
    llong max;

    signed call_of_Cthulhu( signed datum ) {

        read n;
        for ( llong i = n; i > std::max(0ll, n-100000); i-- ) {
            llong I = i;
            llong tmp = 0;
            while ( I ) {
                tmp += I%10;
                I /= 10;
            }
            chmax(max, tmp);
        }
        String s = std::to_string(n);
        chmax(max, (s.size()-1)*9 + s[0]-'1');
        echo max fin;

        return 0;
    }
}

signed main(){std::cin.tie(0); std::ios::sync_with_stdio(false); int main_result = Rlyeh::call_of_Cthulhu(114514); 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 <string>
^
Main.java:4: error: illegal character: '#'
#include <stack>
^
Main.java:5: error: illegal character: '#'
#include <queue>
^
Main.java:6: error: illegal character: '#'
#include <set>
^
Main.java:7: error: illegal character: '#'
#include <map>
^
Main.java:8: error: illegal character: '#'
#include <unordered_map>
^
Main.java:9: error: illegal character: '#'
#include <algorithm>
^
Main.java:10: error: illegal character: '#'
#include <functional>
^
Main.java:11: error: illegal character: '#'
#include <numeric>
^
Main.java:12: error: illegal character: '#'
#include <cstring>
^
Main.java:13: error: illegal character: '#'
#include <cstdio>
^
Main.java:14: error: illegal character: '#'
#include <cmath>
^
Main.java:15: error: illegal character: '#'
#include <cstdlib>
^
Main.java:16: error: illegal character: '#'
#include <cassert>
^
Main.java:17: error: illegal character: '#'
#define bogo_sort   std::sort
^
Main.java:18: error: illegal character: '#'
#define bozo_sort   std::stable_sort
^
Main.java:19: error: illegal character: '#'
#define alles(obj)  obj.begin(), obj.end()
^
Main.java:20: error: illegal character: '#'
#define elif        else if
^
Main.java:21: error: illegal character: '#'
#define unless(flg) if(!(flg))
^
Main.java:22: error: illegal character: '#'
#define elless(flg) else if(!(flg))
^
Main.java:23: error: illegal character: '#'
#define echo        std::cout <<
^
Main.java:24: error: illegal character: '#'
#define read        std::cin >>
^
Main.java:25: error: illegal character: '#'
#define endl        std::endl
^
Main.java:26: error: illegal character: '#'
#define fin         << '\n'
^
Main.java:27: error: illegal character: '#'
#define bash        push_back
^
Main.java:28: error: illegal character: '#'
#define makePair    std::make_pair
^
Main.java:29: error: illegal character: '#'
#define _           << ' ' <<
^
Main.java:31: error: illegal character: '#'
#define Stack       std::stack
^
Main.java:32: error: illegal character: '#'
#define Queue       std::queue
^
Main.java:33: error: illegal character: '#'
#define Set         std::set
^
Main.java:34: error: illegal character: '#'
#define PQueue      std::priority_queue
^
Main.java:35: error: illegal character: '#'
#define Vector      std::vector
^
Main.java:36: error: illegal character: '#'
#define Pair        std::pair
^
Main.java:37: error: illegal character: '#'
#define Map         std::map
^
Main.java:38: error: illegal character: '#'
#define HashMap     std::unordered_map
^
Main.java:39: error: illegal character: '#'
#define Greater     std::greater
^
Main.java:41: error: unnamed classes are a preview feature and are disabled by default.
using llong   =     long long;
^
  (use --enable-preview to enable unnamed classes)
Main.java:41: error: '.class' expected
using llong   =     long long;
                         ^
Main.java:42: error: class, interface, enum, or record expected
using boolean =     bool;
^
Main.java:43: error: '.class' expected
using Pii     =     Pair<int, int>;
                            ^
Main.java:43: error: <identifier> expected
using Pii     =     Pair<int, int>;
                             ^
Main.java:44: error: '.class' expected
using Vi      =     Vector<int>;
                              ^
Main.java:44: error: illegal start of expression
using Vi      =     Vector<int>;
                               ^
Main.java:45: error: illegal start of expression
using Vii     =     Vector<Pii>;
                               ^
Main.java:47: error: class, interface, enum, or record expected
constexpr int   dx[] = {1, 0, -1, 0, 1, 1, -1, -1};
^
Main.java:48: error: class, interface, enum, or record expected
constexpr int   dy[] = {0, 1, 0, -1, 1, -1, 1, -1};
^
Main.java:49: error: class, interface, enum, or record expected
constexpr int   INF  = 0x3f3f3f3f;
^
Main.java:50: error: class, interface, enum, or record expected
constexpr llong LINF = 0x3f3f3f3f3f3f3f3fLL;
^
Main.java:52: error: class, interface, enum, or record expected
namespace {
^
Main.java:53: error: '{' expected
    template<class A, class B> A power ( llong x, llong n, llong mod ) {
                    ^
Main.java:53: error: '{' expected
    template<class A, class B> A power ( llong x, llong n, llong mod ) {
                             ^
Main.java:55: error: illegal start of type
        while ( n > 0 ) {
        ^
Main.java:55: error: <identifier> expected
        while ( n > 0 ) {
                 ^
Main.java:60: error: illegal start of type
        return ans;
        ^
Main.java:60: error: <identifier> expected
        return ans;
                  ^
Main.java:62: error: class, interface, enum, or record expected
    template<class A, class B> A power ( A x, B n ) { return power( x, n, 1000000007 ); }
    ^
Main.java:62: error: '{' expected
    template<class A, class B> A power ( A x, B n ) { return power( x, n, 1000000007 ); }
                    ^
Main.java:62: error: '{' expected
    template<class A, class B> A power ( A x, B n ) { return power( x, n, 1000000007 ); }
                             ^
Main.java:62: error: illegal start of type
    template<class A, class B> A power ( A x, B n ) { return power( x, n, 1000000007 ); }
                                                      ^
Main.java:62: error: invalid method declaration; return type required
    template<class A, class B> A power ( A x, B n ) { return power( x, n, 1000000007 ); }
                                                             ^
Main.java:62: error: <identifier> expected
    template<class A, class B> A power ( A x, B n ) { return power( x, n, 1000000007 ); }
                                                                     ^
Main.java:62: error: <identifier> expected
    template<class A, class B> A power ( A x, B n ) { return power( x, n, 1000000007 ); }
                                                                        ^
Main.java:62: error: illegal start of type
    template<class A, class B> A power ( A x, B n ) { return power( x, n, 1000000007 ); }
                                                                          ^
Main.java:63: error: class, interface, enum, or record expected
    template<class A> A gcd ( A x, A y ) { return x % y ? gcd( y, x % y ) : y; }
    ^
Main.java:63: error: '{' expected
    template<class A> A gcd ( A x, A y ) { return x % y ? gcd( y, x % y ) : y; }
                    ^
Main.java:63: error: illegal start of type
    template<class A> A gcd ( A x, A y ) { return x % y ? gcd( y, x % y ) : y; }
                                           ^
Main.java:63: error: <identifier> expected
    template<class A> A gcd ( A x, A y ) { return x % y ? gcd( y, x % y ) : y; }
                                                   ^
Main.java:63: error: <identifier> expected
    template<class A> A gcd ( A x, A y ) { return x % y ? gcd( y, x % y ) : y; }
                                                       ^
Main.java:63: error: invalid method declaration; return type required
    template<class A> A gcd ( A x, A y ) { return x % y ? gcd( y, x % y ) : y; }
                                                          ^
Main.java:63: error: <identifier> expected
    template<class A> A gcd ( A x, A y ) { return x % y ? gcd( y, x % y ) : y; }
                                                                ^
Main.java:63: error: <identifier> expected
    template<class A> A gcd ( A x, A y ) { return x % y ? gcd( y, x % y ) : y; }
                                                                   ^
Main.java:64: error: class, interface, enum, or record expected
    template<class A, class B> A lcm   ( A x,  B y ) { return ( x / gcd(x, y) * y ); }
    ^
Main.java:64: error: '{' expected
    template<class A, class B> A lcm   ( A x,  B y ) { return ( x / gcd(x, y) * y ); }
                    ^
Main.java:64: error: '{' expected
    template<class A, class B> A lcm   ( A x,  B y ) { return ( x / gcd(x, y) * y ); }
                             ^
Main.java:64: error: illegal start of type
    template<class A, class B> A lcm   ( A x,  B y ) { return ( x / gcd(x, y) * y ); }
                                                       ^
Main.java:64: error: <identifier> expected
    template<class A, class B> A lcm   ( A x,  B y ) { return ( x / gcd(x, y) * y ); }
                                                                 ^
Main.java:64: error: invalid method declaration; return type required
    template<class A, class B> A lcm   ( A x,  B y ) { return ( x / gcd(x, y) * y ); }
                                                                    ^
Main.java:64: error: <identifier> expected
    template<class A, class B> A lcm   ( A x,  B y ) { return ( x / gcd(x, y) * y ); }
                                                                         ^
Main.java:64: error: <identifier> expected
    template<class A, class B> A lcm   ( A x,  B y ) { return ( x / gcd(x, y) * y ); }
                                                                            ^
Main.java:64: error: ';' expected
    template<class A, class B> A lcm   ( A x,  B y ) { return ( x / gcd(x, y) * y ); }
                                                                             ^
Main.java:65: error: class, interface, enum, or record expected
    template<class A> inline A abs ( A n ) { return ( n < 0 ) ? -n : n; }
    ^
Main.java:65: error: '{' expected
    template<class A> inline A abs ( A n ) { return ( n < 0 ) ? -n : n; }
                    ^
Main.java:65: error: illegal start of type
    template<class A> inline A abs ( A n ) { return ( n < 0 ) ? -n : n; }
                                             ^
Main.java:65: error: illegal start of type
    template<class A> inline A abs ( A n ) { return ( n < 0 ) ? -n : n; }
                                                          ^
Main.java:65: error: <identifier> expected
    template<class A> inline A abs ( A n ) { return ( n < 0 ) ? -n : n; }
                                                                  ^
Main.java:65: error: <identifier> expected
    template<class A> inline A abs ( A