Language: Java

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.List;

public class Main {

    public static void main(String[] args) throws IOException {

        BigDecimal x1 = new BigDecimal("1");
        BigDecimal y = new BigDecimal("30");
        BigDecimal z = new BigDecimal("10");

        //足し算
        //        BigDecimal z1 = x.add(y);
        //        //引き算
        //        BigDecimal z2 = x.subtract(y);
        //        //掛け算
        //        BigDecimal z3 = x.multiply(y);
        //割り算
        BigDecimal z4 = x1.divide(y, 5, BigDecimal.ROUND_FLOOR);
        //割り算
        BigDecimal z5 = x1.divide(z, 5, BigDecimal.ROUND_FLOOR);

        BigDecimal z1 = new BigDecimal("1");
        BigDecimal z6 = z1.add(z4);

        //        System.out.println(z1);
        //        System.out.println(z2);
        //        System.out.println(z3);
        //        System.out.println(z4);
        //        System.out.println(z5);
        //        System.out.println(z6);

        InputStreamReader is = new InputStreamReader(System.in);
        BufferedReader reader = new BufferedReader(is);

        List<String> mylist = new ArrayList<>();

        // 標準入力からの値を変数strinputに代入
        String strinput = reader.readLine();

        while (strinput != null) {

            mylist.add(strinput);
            strinput = reader.readLine();

        }
        String arr01[] = mylist.get(0).split(" ");
        String arr02[] = mylist.get(1).split(" ");
        String n = arr01[0];

        int cnt = 0;
        Boolean chkflg = true;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.List;

public class Main {

    public static void main(String[] args) throws IOException {

        BigDecimal x1 = new BigDecimal("1");
        BigDecimal y = new BigDecimal("30");
        BigDecimal z = new BigDecimal("10");

        //足し算
        //        BigDecimal z1 = x.add(y);
        //        //引き算
        //        BigDecimal z2 = x.subtract(y);
        //        //掛け算
        //        BigDecimal z3 = x.multiply(y);
        //割り算
        BigDecimal z4 = x1.divide(y, 5, BigDecimal.ROUND_FLOOR);
        //割り算
        BigDecimal z5 = x1.divide(z, 5, BigDecimal.ROUND_FLOOR);

        BigDecimal z1 = new BigDecimal("1");
        BigDecimal z6 = z1.add(z4);

        //        System.out.println(z1);
        //        System.out.println(z2);
        //        System.out.println(z3);
        //        System.out.println(z4);
        //        System.out.println(z5);
        //        System.out.println(z6);

        InputStreamReader is = new InputStreamReader(System.in);
        BufferedReader reader = new BufferedReader(is);

        List<String> mylist = new ArrayList<>();

        // 標準入力からの値を変数strinputに代入
        String strinput = reader.readLine();

        while (strinput != null) {

            mylist.add(strinput);
            strinput = reader.readLine();

        }
        String arr01[] = mylist.get(0).split(" ");
        String arr02[] = mylist.get(1).split(" ");
        String n = arr01[0];

        int cnt = 0;
        Boolean chkflg = true;

        for (int i = 1; i <= Integer.valueOf(n); i++) {
            if (Integer.valueOf(arr02[i - 1]) != i) {
                cnt += 1;
            }
            if (cnt > 2) {
                chkflg = false;
                break;
            }
        }

        System.out.println(chkflg ? "YES" : "NO");
    }

}
        for (int i = 1; i <= Integer.valueOf(n); i++) {
            if (Integer.valueOf(arr02[i - 1]) != i) {
                cnt += 1;
            }
            if (cnt > 2) {
                chkflg = false;
                break;
            }
        }

        System.out.println(chkflg ? "YES" : "NO");
    }

}

Compiler output:
Main.java:57: error: illegal start of expression
import java.io.BufferedReader;
^
Main.java:57: error: not a statement
import java.io.BufferedReader;
              ^
Main.java:58: error: illegal start of expression
import java.io.IOException;
^
Main.java:58: error: not a statement
import java.io.IOException;
              ^
Main.java:59: error: illegal start of expression
import java.io.InputStreamReader;
^
Main.java:59: error: not a statement
import java.io.InputStreamReader;
              ^
Main.java:60: error: illegal start of expression
import java.math.BigDecimal;
^
Main.java:60: error: not a statement
import java.math.BigDecimal;
                ^
Main.java:61: error: illegal start of expression
import java.util.ArrayList;
^
Main.java:61: error: not a statement
import java.util.ArrayList;
                ^
Main.java:62: error: illegal start of expression
import java.util.List;
^
Main.java:62: error: not a statement
import java.util.List;
                ^
Main.java:64: error: illegal start of expression
public class Main {
^
Main.java:128: error: illegal start of type
        for (int i = 1; i <= Integer.valueOf(n); i++) {
        ^
Main.java:128: error: <identifier> expected
        for (int i = 1; i <= Integer.valueOf(n); i++) {
                         ^
Main.java:128: error: <identifier> expected
        for (int i = 1; i <= Integer.valueOf(n); i++) {
                                            ^
Main.java:128: error: <identifier> expected
        for (int i = 1; i <= Integer.valueOf(n); i++) {
                                              ^
Main.java:128: error: <identifier> expected
        for (int i = 1; i <= Integer.valueOf(n); i++) {
                                                  ^
Main.java:138: error: <identifier> expected
        System.out.println(chkflg ? "YES" : "NO");
                          ^
Main.java:138: error: <identifier> expected
        System.out.println(chkflg ? "YES" : "NO");
                                 ^
Main.java:141: error: class, interface, enum, or record expected
}
^
21 errors