It turned out to be a simple replacement cipher + permutation of elements according to a well-known plan. So I just modified the program a bit and brute force the flag.
```excepted_output = [108, 111, 108, 108, 111, 111, 107, 97, 116, 116, 104, 105, 115, 116, 101, 120, 116, 105, 103, 111, 116, 102, 114, 111, 109, 116, 104, 101, 109, 97, 110, 117, 97, 108]input_size = 34start_input = "a" * input_sizetranspositions = {0: 31, 1: 0, 2: 29, 3: 32, 4: 27, 5: 30, 6: 25, 7: 28, 8: 23, 9: 26, 10: 21, 11: 24, 12: 19, 13: 22, 14: 17, 15: 20, 16: 15, 17: 18, 18: 13, 19: 16, 20: 11, 21: 14, 22: 9, 23: 12, 24: 7, 25: 10, 26: 5, 27: 8, 28: 3, 29: 6, 30: 1, 31: 4, 32: 33, 33: 2}
def update_input(input_string):    with open("input", "w") as input_file:        input_file.write(input_string)
def get_output():    with open("output") as output:        return output.read()
def input_to_output():    import os    os.system("java IceCreamBytes.java 1>/dev/null 2>/dev/null ")
def get_output_list():    output = get_output()    return list(map(int, output.split()))
def change_string_by_index(string, index, char):    string = list(string)    string[index] = char    return "".join(string)
def run(input_string):    update_input(input_string)    input_to_output()    return get_output_list()
def find_position_of_change(index):    current_input = "a" * input_size    current_input_with_change_by_index = change_string_by_index(current_input, index, "b")    current_output = run(current_input)    current_output_with_change_by_index = run(current_input_with_change_by_index)
    for x, (i, j) in enumerate(zip(current_output, current_output_with_change_by_index)):        if i != j:            return x
import stringdef main():    result = [""] * input_size    for i in range(input_size):        for char in string.printable:            if excepted_output[transpositions[i]] == run(change_string_by_index(start_input, i, char))[transpositions[i]]:                result[i] = char                break        print("".join(result))
if __name__ == "__main__":    main()```
```
import java.io.*;import java.nio.file.*;import java.util.Scanner;
public class IceCreamBytes {    public static void main(String[] args) throws IOException {        Path path = Paths.get("IceCreamManual.txt");        byte[] manualBytes = Files.readAllBytes(path);
        // Scanner keyboard = new Scanner(System.in);        // // System.out.print("Enter the password to the ice cream machine: ");        // String userInput = keyboard.next();        // String input = userInput.substring("flag{".length(), userInput.length()-1);        File myObj = new File("input");        Scanner myReader = new Scanner(myObj);        String input = myReader.nextLine();        byte[] loadedBytes = toppings(chocolateShuffle(vanillaShuffle(strawberryShuffle(input.getBytes()))));        boolean correctPassword = true;
        // byte[] correctBytes = fillMachine(manualBytes);
         // if (correctBytes.length != loadedBytes.length)        // {        //     System.out.println("F");        //     System.out.print(loadedBytes.length);        //     System.out.print(" ");        //     System.out.print(correctBytes.length);        //     System.exit(0);        // }        // System.out.println("=========================");        BufferedWriter writer = new BufferedWriter(new FileWriter("output"));        for (int i = 0; i < loadedBytes.length; i++) {            writer.write(String.valueOf(Byte.toUnsignedInt(loadedBytes[i])));            writer.write(" ");        }        writer.close();        // System.out.println("");        // System.out.println("=========================");
        // for (int i = 0; i < correctBytes.length; i++) {        //     if (loadedBytes[i] != correctBytes[i]) {        //         correctPassword  = false;        //     }        // }        // if (correctPassword) {        //     System.out.println("That's right! Enjoy your ice cream!");        // } else {        //     System.out.println("Uhhh that's not right.");        // }        //keyboard.close();    }     public static byte[] fillMachine(byte[] inputIceCream) {        byte[] outputIceCream = new byte[34];        int[] intGredients = {27, 120, 79, 80, 147,             154, 97, 8, 13, 46, 31, 54, 15, 112, 3,             464, 116, 58, 87, 120, 139, 75, 6, 182,             9, 153, 53, 7, 42, 23, 24, 159, 41, 110};        for (int i = 0; i < outputIceCream.length; i++) {            outputIceCream[i] = inputIceCream[intGredients[i]];        }        return outputIceCream;    }
    public static byte[] strawberryShuffle(byte[] inputIceCream) {        byte[] outputIceCream = new byte[inputIceCream.length];        for (int i = 0; i < outputIceCream.length; i++) {            outputIceCream[i] = inputIceCream[inputIceCream.length - i - 1];        }        return outputIceCream;    }
    public static byte[] vanillaShuffle(byte[] inputIceCream) {        byte[] outputIceCream = new byte[inputIceCream.length];        for (int i = 0; i < outputIceCream.length; i++) {            if (i % 2 == 0) {                outputIceCream[i] = (byte)(inputIceCream[i] + 1);            } else {                outputIceCream[i] = (byte)(inputIceCream[i] - 1);            }        }        return outputIceCream;    }
    public static byte[] chocolateShuffle(byte[] inputIceCream) {        byte[] outputIceCream = new byte[inputIceCream.length];        for (int i = 0; i < outputIceCream.length; i++) {            if (i % 2 == 0) {                if (i > 0) {                    outputIceCream[i] = inputIceCream[i - 2];                } else {                    outputIceCream[i] = inputIceCream[inputIceCream.length - 2];                }            } else {                if (i < outputIceCream.length - 2) {                    outputIceCream[i] = inputIceCream[i + 2];                } else {                    outputIceCream[i] = inputIceCream[1];                }            }        }        return outputIceCream;    }
    public static byte[] toppings(byte[] inputIceCream) {        byte[] outputIceCream = new byte[inputIceCream.length];        byte[] toppings = {8, 61, -8, -7, 58, 55,             -8, 49, 20, 65, -7, 54, -8, 66, -9, 69,             20, -9, -12, -4, 20, 5, 62, 3, -13, 66,             8, 3, 56, 47, -5, 13, 1, -7,};        for (int i = 0; i < outputIceCream.length; i++) {            outputIceCream[i] = (byte)(inputIceCream[i] + toppings[i]);        }        return outputIceCream;
    } }```