Language: Java

#include<stdio.h>
#include<stdlib.h>
#include<math.h>
#include<string.h>
int main(void){
    char string[100001];
    scanf("%s",string);
    long i=0,j=0,k;
    long count=0;
    int flag=-1;
    while(flag!=count){
        //printf("(%d,%d)\n",flag,count);
        i=0;
        flag=count;
        while(string[i+1]!='\0'){
            if(string[i+1]!='2'){
                if(string[i]=='0'&&string[i+1]=='1'){
                    count+=2;
                    string[i]='2';
                    string[i+1]='2';
                    i++;
                }
                else if(string[i+1]=='0'&&string[i]=='1'){
                    count+=2;
                    string[i]='2';
                    string[i+1]='2';
                    i++;
                }
                i++;
            }
            else if(string[i+1]=='2'){
                k=i;
                j=0;
                while(string[k+1]=='2'){
                    j++;
                    k++;
                }
                if(string[i]=='0'&&string[i+1+j]=='1'){
                    count+=2;
                    string[i]='2';
                    string[i+1+j]='2';
                }
                else if(string[i+1+j]=='0'&&string[i]=='1'){
                    count+=2;
                    string[i]='2';
                    string[i+1+j]='2';
                }
                i++;
            }
        }
    }
    printf("%ld",count);
    return 0;
}

Compiler output:
Main.java:1: error: illegal character: '#'
#include<stdio.h>
^
Main.java:1: error: class, interface, enum, or record expected
#include<stdio.h>
        ^
Main.java:2: error: illegal character: '#'
#include<stdlib.h>
^
Main.java:3: error: illegal character: '#'
#include<math.h>
^
Main.java:4: error: illegal character: '#'
#include<string.h>
^
Main.java:7: error: class, interface, enum, or record expected
    scanf("%s",string);
    ^
Main.java:8: error: unnamed classes are a preview feature and are disabled by default.
    long i=0,j=0,k;
    ^
  (use --enable-preview to enable unnamed classes)
Main.java:11: error: class, interface, enum, or record expected
    while(flag!=count){
    ^
Main.java:14: error: class, interface, enum, or record expected
        flag=count;
        ^
Main.java:15: error: class, interface, enum, or record expected
        while(string[i+1]!='\0'){
        ^
Main.java:19: error: class, interface, enum, or record expected
                    string[i]='2';
                    ^
Main.java:20: error: class, interface, enum, or record expected
                    string[i+1]='2';
                    ^
Main.java:21: error: class, interface, enum, or record expected
                    i++;
                    ^
Main.java:22: error: class, interface, enum, or record expected
                }
                ^
Main.java:25: error: class, interface, enum, or record expected
                    string[i]='2';
                    ^
Main.java:26: error: class, interface, enum, or record expected
                    string[i+1]='2';
                    ^
Main.java:27: error: class, interface, enum, or record expected
                    i++;
                    ^
Main.java:28: error: class, interface, enum, or record expected
                }
                ^
Main.java:30: error: class, interface, enum, or record expected
            }
            ^
Main.java:33: error: class, interface, enum, or record expected
                j=0;
                ^
Main.java:34: error: class, interface, enum, or record expected
                while(string[k+1]=='2'){
                ^
Main.java:36: error: class, interface, enum, or record expected
                    k++;
                    ^
Main.java:37: error: class, interface, enum, or record expected
                }
                ^
Main.java:40: error: class, interface, enum, or record expected
                    string[i]='2';
                    ^
Main.java:41: error: class, interface, enum, or record expected
                    string[i+1+j]='2';
                    ^
Main.java:42: error: class, interface, enum, or record expected
                }
                ^
Main.java:45: error: class, interface, enum, or record expected
                    string[i]='2';
                    ^
Main.java:46: error: class, interface, enum, or record expected
                    string[i+1+j]='2';
                    ^
Main.java:47: error: class, interface, enum, or record expected
                }
                ^
Main.java:49: error: class, interface, enum, or record expected
            }
            ^
Main.java:53: error: class, interface, enum, or record expected
    return 0;
    ^
Main.java:54: error: class, interface, enum, or record expected
}
^
32 errors