criyle/codenet-compile-errors huggingface dataset:
Language: C++

#include <iostream>
#include <vector>

using namespace std;

const int N_MAX = 105;
const int W_MAX = 10005;

int dp1[W_MAX];
int dp2[W_MAX];

typedef vector<int> VI;

int main() {
  int N, W;

  cin >> N >> W;

  int *dp = dp1;
  int *dp_prev = dp2;

  memset(dp_prev, -1, sizeof(dp1));
  VI vs;
  VI ws;

  for (int i = 0; i < N; i++) {
    int v, w;
    cin >> v >> w;
    vs.push_back(v);
    ws.push_back(w);
  }

  dp_prev[0] = 0;
  for (int i = 0; i < N; i++) {
    memset(dp, -1, sizeof(dp1));
    for (int j = 0; j <= W; j++) {
      int v = vs[i];
      int w = ws[i];
      dp[j] = dp_prev[j];
      if (j - w >= 0) {
        int prev = dp[j - w];
        if (prev >= 0) {
          dp[j] = max(dp[j], prev + v);
        }
      }
    }
    swap(dp_prev, dp);
  }

  int res = 0;
  for (int j = 0; j <= W; j++) {
    if (dp_prev[j] >= 0) {
      res = max(res, dp_prev[j]);
    }
  }

  cout << res << endl;

  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:22:3: error: 'memset' was not declared in this scope
   22 |   memset(dp_prev, -1, sizeof(dp1));
      |   ^~~~~~
a.cc:3:1: note: 'memset' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
    2 | #include <vector>
  +++ |+#include <cstring>
    3 |
Language: C++

#include <iostream>

using namespace std;

int val[110],weight[10010];
int res[110][10010];

int main() {
	int N,W;
	cin >> N >> W;

	for (int i=0;i<N;i++) {
		cin >> val[i] >> weight[i];
	}

	//res[number][weight]
	for (int i=0;i<N+1;i++) {
		res[i][0] = 0;
	}
	for (int i=0;i<W+1;i++) {
		res[0][i] = 0;
	}

	for(int i=1;i<N+1;i++) {
		for(int j=1;j<W+1;j++) {

			if (weight[i-1] > j) {

				res[i][j] = res[i-1][j];

Compiler output:
a.cc: In function 'int main()':
a.cc:29:57: error: expected '}' at end of input
   29 |                                 res[i][j] = res[i-1][j];
      |                                                         ^
a.cc:27:46: note: to match this '{'
   27 |                         if (weight[i-1] > j) {
      |                                              ^
a.cc:29:57: error: expected '}' at end of input
   29 |                                 res[i][j] = res[i-1][j];
      |                                                         ^
a.cc:25:40: note: to match this '{'
   25 |                 for(int j=1;j<W+1;j++) {
      |                                        ^
a.cc:29:57: error: expected '}' at end of input
   29 |                                 res[i][j] = res[i-1][j];
      |                                                         ^
a.cc:24:32: note: to match this '{'
   24 |         for(int i=1;i<N+1;i++) {
      |                                ^
a.cc:29:57: error: expected '}' at end of input
   29 |                                 res[i][j] = res[i-1][j];
      |                                                         ^
a.cc:8:12: note: to match this '{'
    8 | int main() {
      |            ^
Language: C++

#include <iostream>

using namespace std;

int val[110],weight[10010];
int res[110][10010];

int main() {
	int N,W;
	cin >> N >> W;

	for (int i=0;i<N;i++) {
		cin >> val[i] >> weight[i];
	}

	//res[number][weight]
	for (int i=0;i<N+1;i++) {
		res[i][0] = 0;
	}
	for (int i=0;i<W+1;i++) {
		res[0][i] = 0;
	}

	for(int i=1;i<N+1;i++) {
		for(int j=1;j<W+1;j++) {

			if (weight[i-1] > j) {

				res[i][j] = res[i-1][j];

			} else {
				int resmax = 0;
				for(int l=1;weight[i-1]*l<j+1;l++)
					if(resmax < max((val[i-1]*l+res[i-l][j-weight[i-1]*l]),res[i-1][j])) {
					resmax = max((val[i-1]*l+res[i-l][j-weight[i-1]*l]),res[i-1][j]);
				}
				res[i][j] = resmax;
			}
		}
	}

Compiler output:
a.cc: In function 'int main()':
a.cc:40:10: error: expected '}' at end of input
   40 |         }
      |          ^
a.cc:8:12: note: to match this '{'
    8 | int main() {
      |            ^
Language: C++

#if 0
	???????????????????????????0-1?????????????????????????????¨??????????????§???????????¨?????????loop???????????§?????????
#endif
#include<iostream>
using namespace std;
int w[10000];          //w[i] -- the i-th item's weight
int v[10000];          //v[i] -- the i-th item's value
int N; //the total number of items
int W; //the maximum load capacity
long int maxvalue[99999]={0};
void knapsack(int N, int W, int *max, int *w);
  
int main()
{
     
    cin>>N>>W;
    for(int i = 1;i <= N;i++)
    {
        cin>>v[i]>>w[i];
    }
    knapsack(N,W,maxvalue,w);
    cout<<maxvalue[W]<<endl;
    return 0;
}
 
void knapsack(int N, int W, long int *maxvalue, int *w)
{
    for(int counter = 1;counter <= N;counter++)
    {
        for(int j = w[counter]; j <= W; j++)
        {
            if(maxvalue[j] <= maxvalue[j-w[counter]]+v[counter])
            {
                maxvalue[j] = maxvalue[j-w[counter]]+v[counter];
            }
            else
            {
                maxvalue[j] = maxvalue[j];
            }
        } 
    }
}

Compiler output:
a.cc:2:83: error: extended character § is not valid in an identifier
    2 |         ???????????????????????????0-1?????????????????????????????¨??????????????§???????????¨?????????loop???????????§?????????
      |                                                                                   ^
a.cc:2:120: error: extended character § is not valid in an identifier
    2 |         ???????????????????????????0-1?????????????????????????????¨??????????????§???????????¨?????????loop???????????§?????????
      |                                                                                                                        ^
a.cc: In function 'int main()':
a.cc:21:18: error: cannot convert 'long int*' to 'int*'
   21 |     knapsack(N,W,maxvalue,w);
      |                  ^~~~~~~~
      |                  |
      |                  long int*
a.cc:11:34: note:   initializing argument 3 of 'void knapsack(int, int, int*, int*)'
   11 | void knapsack(int N, int W, int *max, int *w);
      |                             ~~~~~^~~
Language: C++

#include<iostream>//动态规划剪枝是么从dp0开始
#include<cmath>
#include<algorithm>
#include<string>//stl和数据结构应该一起训练
#include<stdc++.h>
using namespace std;
int dp[10001];
int v,w;
int n,W;
int main()
{	
	cin>>n>>W;
	memset(dp,-1,sizeof(dp+W+1));
	dp[0]=0;//两种模型,只能选择一次和多次选择
	for(int i=0;i<n;i++)//尽量和循环变量别扯上关系
	{
		cin>>v>>w;
		for(int j=w;j<=W;j++)
			if(dp[j-w]!=-1)
				dp[j]=max(dp[j],dp[j-w]+v);
	}
	int maxn=0;
	for(int i=0;i<=10001;i++)
		maxn=max(dp[i],maxn);
	cout<<maxn<<endl;
	return 0;
}


Compiler output:
a.cc:5:9: fatal error: stdc++.h: No such file or directory
    5 | #include<stdc++.h>
      |         ^~~~~~~~~~
compilation terminated.
Language: Java

class Main {
  
  public static void main(String[] args) {
    
    Scanner sc = new Scanner(System.in);
    
    int n = sc.nextInt();
    int[] sequence = new int[n];

    for ( int i = 0; i < sequence.length; i++ ) {
      sequence[i] = sc.nextInt();
    }
    System.out.println(findLISLen(sequence));
  }

  public static int findLISLen(int[] sequence) {
      
    // lens[i] refers among all subsequences with len i
    // the index of smallest ending value of them
    int maxLen = 0, newL = 0;
    int[] lens = new int[sequence.length+1];

    for ( int i = 0; i < sequence.length; i++ ) {
        
        // binary search
        int lo = 1, hi = maxLen;
        while ( lo <= hi ) {
          int mid = lo+(hi-lo)/2;
          if ( sequence[lens[mid]] <= sequence[i] ) {
            lo = mid+1; 
          } else {
            hi = mid-1;
          }
        }

        newL = lo;
        lens[newL] = i;
        maxLen = Math.max(maxLen, newL);
    }
    return maxLen;
  }
  
} 

Compiler output:
Main.java:5: error: cannot find symbol
    Scanner sc = new Scanner(System.in);
    ^
  symbol:   class Scanner
  location: class Main
Main.java:5: error: cannot find symbol
    Scanner sc = new Scanner(System.in);
                     ^
  symbol:   class Scanner
  location: class Main
2 errors
Language: Java

import java.io.*;
import java.util.Arrays.*;
import java.util.StringTokenizer;

class Main{

static final PrintWriter out=new PrintWriter(System.out);
static final int INF=Integer.MAX_VALUE/2;

public static void main(String[] args) throws IOException{
BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
String line="";
while((line=br.readLine())!=null&&!line.isEmpty()){
int n=Integer.parseInt(line.split(" ")[0]);
int[] num=new int[n];
for(int i=0;i<n;i++) num[i]=Integer.parseInt(br.readLine());
int[] dp=new int[n];
dp[0]=num[0];
int len=1;
int ans=0;
for(int i=0;i<n;i++){
if(dp[len-1]<num[i]) dp[len++]=num[i];
else{
int index=binarySearch(dp,0,len-1,num[i];
if(index<0) index=~index;
dp[index]=num[i];
}
}
out.println(len);
}
out.flush();
}
}

Compiler output:
Main.java:24: error: ')' or ',' expected
int index=binarySearch(dp,0,len-1,num[i];
                                        ^
1 error
Language: Java

import java.io.*;
import java.util.Arrays.*;
import java.util.StringTokenizer;

class Main{

static final PrintWriter out=new PrintWriter(System.out);
static final int INF=Integer.MAX_VALUE/2;

public static void main(String[] args) throws IOException{
BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
String line="";
while((line=br.readLine())!=null&&!line.isEmpty()){
int n=Integer.parseInt(line.split(" ")[0]);
int[] num=new int[n];
for(int i=0;i<n;i++) num[i]=Integer.parseInt(br.readLine());
int[] dp=new int[n];
dp[0]=num[0];
int len=1;
int ans=0;
for(int i=0;i<n;i++){
if(dp[len-1]<num[i]) dp[len++]=num[i];
else{
int index=binarySearch(dp,0,len-1,num[i]);
if(index<0) index=~index;
dp[index]=num[i];
}
}
out.println(len);
}
out.flush();
}
}

Compiler output:
Main.java:24: error: cannot find symbol
int index=binarySearch(dp,0,len-1,num[i]);
          ^
  symbol:   method binarySearch(int[],int,int,int)
  location: class Main
1 error
Language: Java

import java.util.Arrays;
import java.util.Scanner;

// ???????¢??????¨?????? LIS
public class LongestIncreasingSubsequence {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int[] a = new int[n];
        for (int i = 0; i < n; i++) {
            a[i] = sc.nextInt();
        }

        int[] dp = new int[n];
        Arrays.fill(dp, Integer.MAX_VALUE);
        for (int i = 0; i < n; i++) {
            int in = lower_bound(dp, a[i]);
            if (in < n) {
                dp[in] = a[i];
            }
        }
        System.out.println(lower_bound(dp, Integer.MAX_VALUE));
    }

    static int lower_bound(int a[], int border) {
        int l = -1;
        int r = a.length;
        while (r - l > 1) {
            int mid = (l + r) / 2;
            if (border <= a[mid]) {
                r = mid;
            } else {
                l = mid;
            }
        }
        return r;
    }
}

Compiler output:
Main.java:5: error: class LongestIncreasingSubsequence is public, should be declared in a file named LongestIncreasingSubsequence.java
public class LongestIncreasingSubsequence {
       ^
1 error
Language: Java

import java.util.Scanner;
import java.util.Arrays;
public class DPL_1_D {
	//static int n,k,u[],min[count],max;
    static int dp[]=new int[100000];
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int data[]=new int[100000];
		int num;
        num=sc.nextInt();
        for(int i=0;i<num;i++){
            data[i]=sc.nextInt();
            int j=i;
            while(true){
                if(j==0){
                    dp[i]=1;
                    break;
                }
                if(data[i]>data[j-1]){
                    dp[i]=data[j-1]+1;
                    break;
                }
                j--;
            }
        }
        int max=dp[0];
        for(int i=1;i<num;i++){
            if(max<dp[i]){
                max=dp[i];
            }
            // System.out.print(dp[i]+" ");
            // System.out.println(data[i]);
        }
        System.out.println("\n"+max);
    }
}

Compiler output:
Main.java:3: error: class DPL_1_D is public, should be declared in a file named DPL_1_D.java
public class DPL_1_D {
       ^
1 error
Language: Java

import java.util.Scanner;
import java.util.Arrays;
public class DPL_1_D {
	//static int n,k,u[],min[count],max;
    static int dp[]=new int[100000];
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int data[]=new int[100000];
		int num;
        num=sc.nextInt();
        for(int i=0;i<num;i++){
            data[i]=sc.nextInt();
            int j=i;
            dp[i]=1;
            while(true){
                // boolean flag=false;
                if(j==0){
                    // dp[i]=1;
                    break;
                }
                if(data[i]>data[j-1]){
                    if(dp[i]<dp[j-1]+1){
                        dp[i]=dp[j-1]+1;
                    }
                    // if(max==dp[j-1]){
                    //     dp[i]=max+1;
                    //     max=dp[i];
                    //     break;
                    //     // flag=true;
                    // }
                    // dp[i]=dp[j-1]+1;
                }
                j--;
                // if(flag){
                //     break;
                // }
            }
        }
        int max=dp[0];
        for(int i=1;i<num;i++){
            if(max<dp[i]){
                max=dp[i];
            }
        }
        //      System.out.print(dp[i]+" ");
        //     // System.out.println(data[i]);
        // }

        // for(int i=0;i<num;i++){
        //      System.out.print(dp[i]+" ");
        // }
        System.out.println(max);
    }
}

Compiler output:
Main.java:3: error: class DPL_1_D is public, should be declared in a file named DPL_1_D.java
public class DPL_1_D {
       ^
1 error
Language: Java

import java.util.Arrays;
import java.util.Scanner;

public class LIS {/* Longest Increasing Subsequence */

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		
		int n = sc.nextInt();
		int[] a = new int[n], memo = new int[n];
		for(int i = 0; i < n; i++){
			a[i] = sc.nextInt();
			memo[i] = 1;
		}

		for(int i = 1; i < n; i++){
			int max = 0;
			for(int j = i - 1; j >= 0; j--){
				/* i????????????a[]???????????????a[i]>a[j]??????memo[j]????????§??? */
				if(max < memo[j] && a[j] > a[i]){
					max = memo[j];
				}
			}
			memo[i] = max + 1;
		}
		
		Arrays.sort(memo);
		System.out.println(memo[n-1]);
	}
}

Compiler output:
Main.java:4: error: class LIS is public, should be declared in a file named LIS.java
public class LIS {/* Longest Increasing Subsequence */
       ^
1 error
Language: Java

public class Main{
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		long[] dp= new long[100010];
		int[] a=new int[100010];
		int n=sc.nextInt();
		for(int i=0; i<n; i++) {
			a[i]=sc.nextInt();
		}
		dp[0]=1;
		for(int i=0; i<=100000; i++) {
			if(a[i]>=a[i+1]) {
				dp[i+1]=dp[i];
			}
			else	dp[i+1]=dp[i]+1;
		}
		System.out.println(dp[n-1]);
	}
}


Compiler output:
Main.java:3: error: cannot find symbol
		Scanner sc = new Scanner(System.in);
		^
  symbol:   class Scanner
  location: class Main
Main.java:3: error: cannot find symbol
		Scanner sc = new Scanner(System.in);
		                 ^
  symbol:   class Scanner
  location: class Main
2 errors
Language: C

#include <stdio.h>
#include <stdlib.h>
void main(){
    int x;
    int arr[100000];
    arr[0] = -1;
    int idx = 1;
    //????????????????????????
    while(scanf("%d", &x)==1){
        arr[idx] = x;
        idx++;
    }
    int k=0;
    for(;k<idx;k++){
    	putchar('\n');
    }
    
    int *lis, lis_idx=0;
    lis = malloc(sizeof(int) * idx);
    lis[0] = arr[0];
    int i, j;
    for(i=0; i<idx; i++){
    	if(lis[lis_idx] < arr[i]){
    		lis_idx ++;
    		printf("LIS_IDX ADDED:%d -> %d\n", lis_idx-1, lis_idx);
    		lis[lis_idx] = arr[i];
    	}else if(lis[lis_idx-1] < arr[i]){
    		lis[lis_idx] = arr[i];
    	}
    }
    printf(%d\n", lis_idx);
}

Compiler output:
main.c: In function 'main':
main.c:31:12: error: expected expression before '%' token
   31 |     printf(%d\n", lis_idx);
      |            ^
main.c:31:14: error: stray '\' in program
   31 |     printf(%d\n", lis_idx);
      |              ^
main.c:31:16: warning: missing terminating " character
   31 |     printf(%d\n", lis_idx);
      |                ^
main.c:31:16: error: missing terminating " character
   31 |     printf(%d\n", lis_idx);
      |                ^~~~~~~~~~~~
main.c:31:16: error: expected ';' before '}' token
   31 |     printf(%d\n", lis_idx);
      |                ^
      |                ;
   32 | }
      | ~
Language: C

#include <stdio.h>
int dp[100000];
int main(){
int N;
int a[100000];
int i;
scanf("%d",&N);
for(i=0;i<N;i++)scanf("%d",&a[i]);
dp[0]=1;
for(i=1;i<N;i++){
if(a[i]>a[i-1])dp[i]=dp[i-1]+1;
elsedp[i]=dp[i-1];
}
printf("%d\n",dp[N-1]);
return 0;
}

Compiler output:
main.c: In function 'main':
main.c:12:1: error: 'elsedp' undeclared (first use in this function)
   12 | elsedp[i]=dp[i-1];
      | ^~~~~~
main.c:12:1: note: each undeclared identifier is reported only once for each function it appears in
Language: C

#include<stdio.h>
#define MAX 100001


int main(){
	int n,ans,i,j;
	int a[MAX]={0};
	int b[MAX]={0};
	int max=-1;
	
	scanf("%d",&n);
	for(i=1;i<=n;i++){
		scanf("%d",&a[i]);
	}

	for(i=1;i<=n;i++){
		max=-1;
		for(j=0;j<i;j++){
			if(a[i]>a[j] && b[j]>max){
				idx=j;
				max=b[j];
			}
		}
		b[i]=b[idx]+1;
	}
	
	printf("%d\n",b[n]);

	
	return 0;
	
}


Compiler output:
main.c: In function 'main':
main.c:20:33: error: 'idx' undeclared (first use in this function)
   20 |                                 idx=j;
      |                                 ^~~
main.c:20:33: note: each undeclared identifier is reported only once for each function it appears in
Language: C

#include<cstdio>
#include<algorithm>
#include<climits>
using namespace std;
#define N 100000
#define INF INT_MAX
int n,l[N],dp[N],r=0;

int main()
{
	scanf("%d",&n);
	for(int i=0;i<n;i++)
		scanf("%d",&l[i]),dp[i]=INF;
	for(int i=0;i<n;i++)
		*lower_bound(dp,dp+n,l[i])=l[i];
	printf("%d\n",lower_bound(dp,dp+n,INF)-dp);
	return 0;
}

Compiler output:
main.c:1:9: fatal error: cstdio: No such file or directory
    1 | #include<cstdio>
      |         ^~~~~~~~
compilation terminated.
Language: C

#include<stdio.h>
#include<algorithm>
#include<climits>
using namespace std;
#define N 100000
#define INF INT_MAX
int n,l[N],dp[N],r=0;

int main()
{
	scanf("%d",&n);
	for(int i=0;i<n;i++)
		scanf("%d",&l[i]),dp[i]=INF;
	for(int i=0;i<n;i++)
		*lower_bound(dp,dp+n,l[i])=l[i];
	printf("%d\n",lower_bound(dp,dp+n,INF)-dp);
	return 0;
}

Compiler output:
main.c:2:9: fatal error: algorithm: No such file or directory
    2 | #include<algorithm>
      |         ^~~~~~~~~~~
compilation terminated.
Language: C

#include <iostream>
#include <algorithm>

using namespace std;

typedef long long ll;
const ll INF = 1e9;
 
int main(){
  int n;
 
  cin >> n;
  int a[n];
  for(int i = 0 ; i < n ; i++){
    cin >> a[i];
  }
 
  ll dp[n];
  fill(dp,dp+n,INF);
 
  for(int i = 0 ; i < n ; i++){
    *lower_bound(dp,dp+n,a[i]) = a[i];
  }
  cout << lower_bound(dp,dp+n,INF) - dp << endl;
 
  return 0;
}

Compiler output:
main.c:1:10: fatal error: iostream: No such file or directory
    1 | #include <iostream>
      |          ^~~~~~~~~~
compilation terminated.
Language: C++

import bisect

INF = 1 << 20


def main():
    n = int(input())
    a = [int(input()) for i in range(n)]

    dp = [INF for i in range(n+1)]
    for i in range(1, n+1):
        idx = bisect.bisect_left(dp, a[i-1])
        dp[idx] = a[i-1]

    ans = bisect.bisect_left(dp, INF)
    print(ans)


if __name__ == '__main__':
    main()



Compiler output:
a.cc:19:16: warning: multi-character literal with 8 characters exceeds 'int' size of 4 bytes
   19 | if __name__ == '__main__':
      |                ^~~~~~~~~~
a.cc:1:1: error: 'import' does not name a type
    1 | import bisect
      | ^~~~~~
a.cc:1:1: note: C++20 'import' only available with '-fmodules-ts'
Language: C++


/*
AOJ: Longest Increasing Subsequence
https://onlinejudge.u-aizu.ac.jp/problems/DPL_1_D
着席位置 教卓から見て左中央
*/

#include <iostream>
#include <math.h>
#include <string>
#include <algorithm>
#include <set>
#include <queue>
#include <stack>
#include <utility>
#include <tuple>
using namespace std;

const double pi = acos(-1);
#define nyan cout<<"(=^•ω•^=)"<<endl;
#define int long long
#define rep(i,n) for(int i=0;i<n;i++)

int n;
int a[1100000000];
int dp[110000];
// dp[i] := a[i]を最後の要素とするようなLISのサイズ
int ans;

signed main(){
    cin>>n;rep(i,n)cin>>a[i];
    for(int i=0;i<n;i++){
        dp[i]=1;
        for(int j=0;j<i;j++){
            if(a[j]<a[i])dp[i]=max(dp[i],dp[j]+1);
        }
        ans=max(ans,dp[i]);
    }
    cout<<ans<<endl;
    return 0;
}


Compiler output:
/tmp/ccJ6dco4.o: in function `main':
a.cc:(.text+0x81): relocation truncated to fit: R_X86_64_PC32 against symbol `dp' defined in .bss section in /tmp/ccJ6dco4.o
a.cc:(.text+0xdc): relocation truncated to fit: R_X86_64_PC32 against symbol `dp' defined in .bss section in /tmp/ccJ6dco4.o
a.cc:(.text+0xfb): relocation truncated to fit: R_X86_64_PC32 against symbol `dp' defined in .bss section in /tmp/ccJ6dco4.o
a.cc:(.text+0x123): relocation truncated to fit: R_X86_64_PC32 against symbol `dp' defined in .bss section in /tmp/ccJ6dco4.o
a.cc:(.text+0x14d): relocation truncated to fit: R_X86_64_PC32 against symbol `dp' defined in .bss section in /tmp/ccJ6dco4.o
a.cc:(.text+0x15a): relocation truncated to fit: R_X86_64_PC32 against symbol `ans' defined in .bss section in /tmp/ccJ6dco4.o
a.cc:(.text+0x16c): relocation truncated to fit: R_X86_64_PC32 against symbol `ans' defined in .bss section in /tmp/ccJ6dco4.o
a.cc:(.text+0x189): relocation truncated to fit: R_X86_64_PC32 against symbol `ans' defined in .bss section in /tmp/ccJ6dco4.o
collect2: error: ld returned 1 exit status
Language: C++

#include<bits/stdc++.h>
#define MAX 100000
int n,A[MAX+1],L[MAX];
int lis(){
    L[0]=A[0];(
    int length=1;
    for(int i=1; i<n; i++){
        if(L[length-1]<A[i]){
            L[length++]=A[i];
        }
        else{
            *lower_bound(L,L+length,A[i])=A[i];
        }
    }
    return length;
}
int main(){
    cin>>n;
    for(int i=0; i<n; i++)cin>>A[i];
    cout<<lis()<<endl;
}


Compiler output:
a.cc: In function 'int lis()':
a.cc:6:5: error: expected primary-expression before 'int'
    6 |     int length=1;
      |     ^~~
a.cc:5:16: error: expected ')' before 'int'
    5 |     L[0]=A[0];(
      |               ~^
      |                )
    6 |     int length=1;
      |     ~~~         
a.cc:8:14: error: 'length' was not declared in this scope
    8 |         if(L[length-1]<A[i]){
      |              ^~~~~~
a.cc:12:14: error: 'lower_bound' was not declared in this scope; did you mean 'std::lower_bound'?
   12 |             *lower_bound(L,L+length,A[i])=A[i];
      |              ^~~~~~~~~~~
      |              std::lower_bound
In file included from /usr/include/c++/14/algorithm:61,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:51,
                 from a.cc:1:
/usr/include/c++/14/bits/stl_algo.h:1963:5: note: 'std::lower_bound' declared here
 1963 |     lower_bound(_ForwardIterator __first, _ForwardIterator __last,
      |     ^~~~~~~~~~~
a.cc:15:12: error: 'length' was not declared in this scope
   15 |     return length;
      |            ^~~~~~
a.cc: In function 'int main()':
a.cc:18:5: error: 'cin' was not declared in this scope; did you mean 'std::cin'?
   18 |     cin>>n;
      |     ^~~
      |     std::cin
In file included from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:146:
/usr/include/c++/14/iostream:62:18: note: 'std::cin' declared here
   62 |   extern istream cin;           ///< Linked to standard input
      |                  ^~~
a.cc:20:5: error: 'cout' was not declared in this scope; did you mean 'std::cout'?
   20 |     cout<<lis()<<endl;
      |     ^~~~
      |     std::cout
/usr/include/c++/14/iostream:63:18: note: 'std::cout' declared here
   63 |   extern ostream cout;          ///< Linked to standard output
      |                  ^~~~
a.cc:20:18: error: 'endl' was not declared in this scope; did you mean 'std::endl'?
   20 |     cout<<lis()<<endl;
      |                  ^~~~
      |                  std::endl
In file included from /usr/include/c++/14/istream:41,
                 from /usr/include/c++/14/sstream:40,
                 from /usr/include/c++/14/complex:45,
                 from /usr/include/c++/14/ccomplex:39,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:127:
/usr/include/c++/14/ostream:744:5: note: 'std::endl' declared here
  744 |     endl(basic_ostream<_CharT, _Traits>& __os)
      |     ^~~~
Language: C++

#include<bits/stdc++.h>
#define MAX 100000
using namespace std;
int n,A[MAX+1],L[MAX];
int lis(){
    L[0]=A[0];(
    int length=1;
    for(int i=1; i<n; i++){
        if(L[length-1]<A[i]){
            L[length++]=A[i];
        }
        else{
            *lower_bound(L,L+length,A[i])=A[i];
        }
    }
    return length;
}
int main(){
    cin>>n;
    for(int i=0; i<n; i++)cin>>A[i];
    cout<<lis()<<endl;
}


Compiler output:
a.cc: In function 'int lis()':
a.cc:7:5: error: expected primary-expression before 'int'
    7 |     int length=1;
      |     ^~~
a.cc:6:16: error: expected ')' before 'int'
    6 |     L[0]=A[0];(
      |               ~^
      |                )
    7 |     int length=1;
      |     ~~~         
a.cc:9:14: error: 'length' was not declared in this scope
    9 |         if(L[length-1]<A[i]){
      |              ^~~~~~
a.cc:16:12: error: 'length' was not declared in this scope
   16 |     return length;
      |            ^~~~~~
Language: C++

#include <bits/stdc++.h>
#define MAX 100000
using namespace std;
int n, A[MAX + 1], L[MAX];
int lis()
{
    L[0] = A[0];(
    int length=1;
    for(int i=1; i<n; i++){
        if (L[length - 1] < A[i])
        {
            L[length++] = A[i];
        }
        else
        {
            *lower_bound(L, L + length, A[i]) = A[i];
        }
    }
    return length;
}
int main()
{
    cin >> n;
    for (int i = 0; i < n; i++)
        cin >> A[i];
    cout << lis() << endl;
}


Compiler output:
a.cc: In function 'int lis()':
a.cc:8:5: error: expected primary-expression before 'int'
    8 |     int length=1;
      |     ^~~
a.cc:7:18: error: expected ')' before 'int'
    7 |     L[0] = A[0];(
      |                 ~^
      |                  )
    8 |     int length=1;
      |     ~~~           
a.cc:10:15: error: 'length' was not declared in this scope
   10 |         if (L[length - 1] < A[i])
      |               ^~~~~~
a.cc:19:12: error: 'length' was not declared in this scope
   19 |     return length;
      |            ^~~~~~
Language: C++

#include <bits/stdc++.h>
using namespace std;

long long* binarySearch(long long x, long long* left, long long* right){
    
    while(left < right){
        long long *ptr = left + (right - left) / 2;
        if( x < *ptr ){
            right = ptr;
        }else{
            left = ptr + 1;
        }  
    }
    return left;
}

int main(){
    int N;
    cin >> N;

    long long a[N];
    for(int i = 0; i < N; i++) {
        cin >> a[i];
    }

    long long dp[N];
    int last = 0;
    dp[0] = a[0];
    for(int i = 1; i < N; i++) {
        // for(int j = 0; j <= last; j++) {
        //     cout << dp[j] << " ";
        // }
        // cout << endl;

        if(dp[last] < a[i]){
            last++;
            dp[last] = a[i];
            continue;
        }

        *lower_bound(dp,dp+length-1,a[i])=a[i];
        // long long* p = upper_bound(dp, dp+last-1, a[i]);
        // //long long* p = binarySearch(a[i], dp, dp+last);
        // *p = a[i];
    }

    cout << last+1 << endl;
    return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:41:28: error: 'length' was not declared in this scope
   41 |         *lower_bound(dp,dp+length-1,a[i])=a[i];
      |                            ^~~~~~
Language: C++

  int res = 0;
  rep(i, n){
    dp[i] = 1;
    rep(j, i){
      if(a[i] > a[j]) dp[i] = max(dp[j]+1, dp[i]);
    }
    res = max(res, dp[i]);
  }

  printf("%d\n", res);

Compiler output:
a.cc:2:6: error: expected constructor, destructor, or type conversion before '(' token
    2 |   rep(i, n){
      |      ^
a.cc:10:9: error: expected constructor, destructor, or type conversion before '(' token
   10 |   printf("%d\n", res);
      |         ^
Language: C++

#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;

int lis(const int& A[]) {
    int n = sizeof(A);
    vector<int> L(n, 0);
    L[0] = A[0];
    length = 1;
    for (int i = 1; i < n; i++) {
        if (L[length - 1] < A[i])
            L[length++] = A[i];
        else
            *lower_bound(L, L + length, A[i]) = A[i];
    }
    return length;
}

int main(void) {
    int n;
    cin >> n;
    vector<int> a(n, 0);
    for (int i = 0; i < n; i++) {
        int ai;
        cin >> ai;
        a[i] = ai;
    }
    cout << lis(a) << endl;
    return 0;
}

Compiler output:
a.cc:6:20: error: declaration of 'A' as array of references
    6 | int lis(const int& A[]) {
      |                    ^
a.cc: In function 'int lis(...)':
a.cc:7:20: error: 'A' was not declared in this scope
    7 |     int n = sizeof(A);
      |                    ^
a.cc:10:5: error: 'length' was not declared in this scope
   10 |     length = 1;
      |     ^~~~~~
Language: C++

#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;

int lis(const vector<int>& A) {
    int n = A.size();
    vector<int> L(n, 0);
    L[0] = A[0];
    length = 1;
    for (int i = 1; i < n; i++) {
        if (L[length - 1] < A[i])
            L[length++] = A[i];
        else
            *lower_bound(L, L + length, A[i]) = A[i];
    }
    return length;
}

int main(void) {
    int n;
    cin >> n;
    vector<int> a(n, 0);
    for (int i = 0; i < n; i++) {
        int ai;
        cin >> ai;
        a[i] = ai;
    }
    cout << lis(a) << endl;
    return 0;
}

Compiler output:
a.cc: In function 'int lis(const std::vector<int>&)':
a.cc:10:5: error: 'length' was not declared in this scope
   10 |     length = 1;
      |     ^~~~~~
Language: C++

#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;

int lis(const vector<int>& A) {
    int n = A.size();
    vector<int> L(n, 0);
    L[0] = A[0];
    int length = 1;
    for (int i = 1; i < n; i++) {
        if (L[length - 1] < A[i])
            L[length++] = A[i];
        else
            *lower_bound(L.begin(), L.bigin() + length, A[i]) = A[i];
    }
    return length;
}

int main(void) {
    int n;
    cin >> n;
    vector<int> a(n, 0);
    for (int i = 0; i < n; i++) {
        int ai;
        cin >> ai;
        a[i] = ai;
    }
    cout << lis(a) << endl;
    return 0;
}

Compiler output:
a.cc: In function 'int lis(const std::vector<int>&)':
a.cc:15:39: error: 'class std::vector<int>' has no member named 'bigin'; did you mean 'begin'?
   15 |             *lower_bound(L.begin(), L.bigin() + length, A[i]) = A[i];
      |                                       ^~~~~
      |                                       begin
Language: C++

#include<cstdio>
#include<algorithm>
using namespace std;
#define MAX 1400

int getLargestSquare(int H, int W, int G[MAX][MAX]){
  int dp[MAX][MAX];
  for(int i = 0; i < H; i++){
    for(int j = 0; j < W; j++){
      dp[i][j] = (G[i][j] + 1) % 2;
    }
  }

  int maxWidth = 0;
  for(int i = 1; i < H; i++){
    for(int j = 1; j < W; j++){
      if(G[i][j]){
        dp[i][j] = 0;
      } else {
        dp[i][j] = min(dp[i - 1][j - 1], min(dp[i - 1][j], dp[i][j - 1])) + 1;
        maxWidth = max(maxWidth, dp[i][j]);
      }
    }
  }

  return maxWidth * maxWidth;
}

int main(){
  int H, W, G[MAX][MAX];
  cin >> H >> W;

  for(int i = 0; i < H; i++){
    for(int j = 0; j < W; j++)
      cin >> G[i][j];
  }

  cout << getLargestSquare(H, W, G)) << endl;

  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:31:3: error: 'cin' was not declared in this scope
   31 |   cin >> H >> W;
      |   ^~~
a.cc:3:1: note: 'std::cin' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
    2 | #include<algorithm>
  +++ |+#include <iostream>
    3 | using namespace std;
a.cc:38:3: error: 'cout' was not declared in this scope
   38 |   cout << getLargestSquare(H, W, G)) << endl;
      |   ^~~~
a.cc:38:3: note: 'std::cout' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
Language: C++

#include <iostream>
#include <algorithm>
#include <vector>
#include <string>
#include <sstream>
#include <cstdio>
#include <complex>
using namespace std;

int main() {
  int n;
  cin >> n;
  vector<int> dp(n, INT_MAX);
  int a;
  for (int i = 0; i < n; i++) {
    cin >> a;
    *lower_bound(dp.begin(), dp.end(), a) = a;
  }
  cout << lower_bound(dp.begin(), dp.end(), INT_MAX) - dp.begin() << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:13:21: error: 'INT_MAX' was not declared in this scope
   13 |   vector<int> dp(n, INT_MAX);
      |                     ^~~~~~~
a.cc:8:1: note: 'INT_MAX' is defined in header '<climits>'; this is probably fixable by adding '#include <climits>'
    7 | #include <complex>
  +++ |+#include <climits>
    8 | using namespace std;
Language: C++

import java.io.*;
import java.util.Arrays;
import java.util.StringTokenizer;

class Main{

static final PrintWriter out=new PrintWriter(System.out);
static final int INF=Integer.MAX_VALUE/2;

public static void main(String[] args) throws IOException{
BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
String line="";
while((line=br.readLine())!=null&&!line.isEmpty()){
int n=Integer.parseInt(line.split(" ")[0]);
int[] num=new int[n];
for(int i=0;i<n;i++) num[i]=Integer.parseInt(br.readLine());
int[] dp=new int[n];
dp[n-1]=1;
for(int i=n-2;i>=0;i--){
for(int j=i+1;j<=n-1;j++){
if(num[j]>num[i]) dp[i]=Math.max(dp[i],dp[j]+1);
}
}
out.println(dp[0]);
}
out.flush();
}
}

Compiler output:
a.cc:1:1: error: 'import' does not name a type
    1 | import java.io.*;
      | ^~~~~~
a.cc:1:1: note: C++20 'import' only available with '-fmodules-ts'
a.cc:2:1: error: 'import' does not name a type
    2 | import java.util.Arrays;
      | ^~~~~~
a.cc:2:1: note: C++20 'import' only available with '-fmodules-ts'
a.cc:3:1: error: 'import' does not name a type
    3 | import java.util.StringTokenizer;
      | ^~~~~~
a.cc:3:1: note: C++20 'import' only available with '-fmodules-ts'
a.cc:7:8: error: 'final' does not name a type
    7 | static final PrintWriter out=new PrintWriter(System.out);
      |        ^~~~~
a.cc:8:8: error: 'final' does not name a type
    8 | static final int INF=Integer.MAX_VALUE/2;
      |        ^~~~~
a.cc:10:7: error: expected ':' before 'static'
   10 | public static void main(String[] args) throws IOException{
      |       ^~~~~~~
      |       :
a.cc:10:25: error: 'String' has not been declared
   10 | public static void main(String[] args) throws IOException{
      |                         ^~~~~~
a.cc:10:34: error: expected ',' or '...' before 'args'
   10 | public static void main(String[] args) throws IOException{
      |                                  ^~~~
a.cc:10:38: error: expected ';' at end of member declaration
   10 | public static void main(String[] args) throws IOException{
      |                                      ^
      |                                       ;
a.cc:10:40: error: 'throws' does not name a type
   10 | public static void main(String[] args) throws IOException{
      |                                        ^~~~~~
a.cc:28:2: error: expected ';' after class definition
   28 | }
      |  ^
      |  ;
Language: C++

import java.util.Arrays;
import java.util.Scanner;

public class Main {

	Scanner sc = new Scanner(System.in);

	void run() {
		int n = sc.nextInt();
		int[] a = new int[n];
		for (int i = 0; i < n; i++)
			a[i] = sc.nextInt();

		int max = 0;
		int[] dp = new int[n];
		for (int i = 0; i < n; i++) {
			dp[i] = 1;
			for (int j = 0; j < i; j++) {
				if (a[j] < a[i]) {
					dp[i] = Math.max(dp[i], dp[j] + 1);
				}
			}
			max = Math.max(dp[i], max);
		}
		System.out.println(max);
	}

	public static void main(String[] args) {
		new Main().run();
	}
}

Compiler output:
a.cc:1:1: error: 'import' does not name a type
    1 | import java.util.Arrays;
      | ^~~~~~
a.cc:1:1: note: C++20 'import' only available with '-fmodules-ts'
a.cc:2:1: error: 'import' does not name a type
    2 | import java.util.Scanner;
      | ^~~~~~
a.cc:2:1: note: C++20 'import' only available with '-fmodules-ts'
a.cc:4:1: error: expected unqualified-id before 'public'
    4 | public class Main {
      | ^~~~~~
Language: C++

#include<cstdio>
#include<vector>
using namespace std;

long long b;
vector <long long> V;
int N;

void index(int index,long long a){
	int l = 0;
	if (V.back() < a)V.push_back(a);
	while (l + 1 < index){
		int m = (l + index) / 2;
		if (V[m] < a)l = m;
		else index = m;
	}
	V[l] = a;
	return;
}

int main(){
	scanf_s("%d", &N);
	for (int i = 0; i < N; i++){
		scanf_s("%lld", &b);
		if (!i)V.push_back(b);
		else index(i, b);
	}
	printf("%d\n", V.size());
}

Compiler output:
a.cc: In function 'int main()':
a.cc:22:9: error: 'scanf_s' was not declared in this scope; did you mean 'scanf'?
   22 |         scanf_s("%d", &N);
      |         ^~~~~~~
      |         scanf
Language: C++

#include <iostream>
#include <cstdio>
#include <vector>
#include <algorithm>
#include <functional>
#define F first
#define S second
using namespace std;
typedef pair<int, int> P;
const int INF = 1 << 30, Array = inf(1e5);
int main(){
  int n;
int seq[Array], dp[Array];
  scanf("%d", &n);
  fill(dp, dp + n, INF);
  for(int i = 0; i < n; i++)
    scanf("%d", &seq[ i ]);
  for(int i = 0; i < n; i++)
    *lower_bound(dp, dp + n, seq[ i ]) = seq[ i ];
  cout << lower_bound(dp, dp + n, INF) - dp << endl;
  return 0;
}

Compiler output:
a.cc:10:34: error: 'inf' was not declared in this scope; did you mean 'int'?
   10 | const int INF = 1 << 30, Array = inf(1e5);
      |                                  ^~~
      |                                  int
a.cc: In function 'int main()':
a.cc:13:9: error: size of array 'seq' is not an integral constant-expression
   13 | int seq[Array], dp[Array];
      |         ^~~~~
a.cc:13:20: error: size of array 'dp' is not an integral constant-expression
   13 | int seq[Array], dp[Array];
      |                    ^~~~~
Language: C++

#include <vector>
#include <iostream>
#include <algorithm>

using namespace std;

int main()
{
    int n; scanf("%d", &n);
    
    vector<int> a(n);
    
    for(int i = 0; i < n; i++) scanf("%d", &a[i]);
    
    vector<int> dp; dp.push_back(a[0]);
    
    for(int i = 1; i < n; i++)
    {
        if(dp[dp.size() - 1] < a[i])
        {
            dp.push_back(a[i]);
        }
        else
        {
            int pos = lower_bound(dp.begin(), dp.end(), a[i]);
            
            dp[pos] = a[i];
        }
    }
    
    printf("%d\n", (int)(dp.size()));
    
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:25:34: error: cannot convert '__gnu_cxx::__normal_iterator<int*, std::vector<int> >' to 'int' in initialization
   25 |             int pos = lower_bound(dp.begin(), dp.end(), a[i]);
      |                       ~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~
      |                                  |
      |                                  __gnu_cxx::__normal_iterator<int*, std::vector<int> >
Language: C++

#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <cmath>
#include <climits>
#include <bitset>
#include <vector>
#include <map>
#include <set>
#include <stack>
#include <queue>
#include <string>
#include <sstream>
#include <algorithm>
#include <iomanip>
#include <iostream>

using namespace std;
#define VARIABLE(x) cerr << #x << "=" << x << endl
#define BINARY(x) static_cast<bitset<16> >(x);
#define if_range(x, w, h) if (w <= x && x <= h)
#define BitCheck(a,b)   (a >> b) & 1
#define BitSet(a,b)       a |= (1 << b)
#define BitunSet(a,b)    a &= ~(1 << b)
#define max(a,b) (((a) > (b)) ? (a) : (b))
#define min(a,b) (((a) < (b)) ? (a) : (b))
#define numof(array)  (sizeof (array) / sizeof *(array))

long long int a[100000];
int  n, dp[100001], ans;

int main() {
	scanf("%d", &n);
	for (int i = 0; n > i; i++)
		scanf("%lld", &a[i]);

	for (int i = 0; n > i; i++) {
		for (int j = 0; i > j; j++) {
			if (a[j] < a[i]){
				if (dp[j] == ans) {
					dp[i] = ans;
					break;
				}
				dp[i] = max(dp[i], dp[j] + 1);
		}
		if (!dp[i])dp[i] = 1;
		ans = max(ans, dp[i]);
	}
	printf("%d\n", ans);
}

Compiler output:
a.cc: In function 'int main()':
a.cc:50:2: error: expected '}' at end of input
   50 | }
      |  ^
a.cc:32:12: note: to match this '{'
   32 | int main() {
      |            ^
Language: C++

// http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=DPL_1_D
// O(n*log(n)) PCC p. 65 solution
#include <iostream>
#include <vector>
#include <algorithm>

using namespace std;

int main(int argc, char **argv)
{
        int n;
        cin >> n;
        vector<int> dp(n, INT_MAX);
        for (int i = 0; i < n; i++) {
                auto p = lower_bound(dp.begin(), dp.end(), a[i]);
                (*p) = a[i];
        }
        auto p = lower_bound(dp.begin(), dp.end(), INT_MAX);
        cout << distance(p, dp.begin()) << endl;
        return 0;
}

Compiler output:
a.cc: In function 'int main(int, char**)':
a.cc:13:27: error: 'INT_MAX' was not declared in this scope
   13 |         vector<int> dp(n, INT_MAX);
      |                           ^~~~~~~
a.cc:6:1: note: 'INT_MAX' is defined in header '<climits>'; this is probably fixable by adding '#include <climits>'
    5 | #include <algorithm>
  +++ |+#include <climits>
    6 | 
a.cc:15:60: error: 'a' was not declared in this scope
   15 |                 auto p = lower_bound(dp.begin(), dp.end(), a[i]);
      |                                                            ^
Language: C++

#include<iostream>
#include<vector>
#include<algorithm>
using namespace std;
int judge(vector<int> b, int ab)
{
	for (int j = 0; j < b.size(); ++j) {
		if (b[j] ==ab) {
			return 1;
			break;
		}
	}
	return 0;
}
int main()
{
	int n, ab;
	cin >> n;
	vector<int> a, b;
	for (int variable = 0; variable < n; ++variable) {
		cin >> ab;
		a.push_back(ab);
		if (judge(b, ab) == 0) {
			b.push_back(ab);
		}
	}
	vector< vector<int> > maxL(n+1,vector<int>(b.size()+1);
	sort(b.begin(), b.end());
	for(int i=0;i<=n;++i)
		for (int j = 0; j <= b.size(); ++j) {
			if (i == 0 || j == 0) maxL[i][j] = 0;
			else if (a[i - 1] == b[j - 1]) maxL[i][j] = maxL[i - 1][j - 1] + 1;
			else maxL[i][j] = max(maxL[i - 1][j], maxL[i][j - 1]);
		}
	cout << maxL[n][b.size()] << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:27:63: error: expected ')' before ';' token
   27 |         vector< vector<int> > maxL(n+1,vector<int>(b.size()+1);
      |                                   ~                           ^
      |                                                               )
Language: C++

import java.util.ArrayList;
import java.util.Scanner;
public class Main{
	public static void main(String[] args){
		new Main().solve();
	}
	void solve(){
		Scanner sc=new Scanner(System.in);
		int n=sc.nextInt();
		int[] a=new int[n];
		for(int i=0;i<n;i++){
			a[i]=sc.nextInt();
		}
		System.out.println(LIS(a));
	}
	//Longest Increasing Sequence
	//?????????:LIS?????????
	int LIS(int[] a){
		int n=a.length;
		ArrayList<Integer> list=new ArrayList<>();
		for(int i=0;i<n;i++){
			if(list.isEmpty()||a[i]>list.get(list.size()-1)){
				list.add(a[i]);
			}else{
				//a[i]????????§?????????????????°??????????????????
				int first=0;
				int last=list.size()-1;
				while(first+1!=last&&!(first==0&&last==0)){
					int mid=(first+last)/2;
					if(list.get(mid)>a[i]){
						last=mid;
					}else{
						first=mid;
					}
				}
				if(list.get(first)!=a[i])
					list.set(last, a[i]);
			}
		}
		return list.size();
	}
}

Compiler output:
a.cc:1:1: error: 'import' does not name a type
    1 | import java.util.ArrayList;
      | ^~~~~~
a.cc:1:1: note: C++20 'import' only available with '-fmodules-ts'
a.cc:2:1: error: 'import' does not name a type
    2 | import java.util.Scanner;
      | ^~~~~~
a.cc:2:1: note: C++20 'import' only available with '-fmodules-ts'
a.cc:3:1: error: expected unqualified-id before 'public'
    3 | public class Main{
      | ^~~~~~
Language: C++

import java.util.ArrayList;
import java.util.Scanner;
public class Main{
	public static void main(String[] args){
		new Main().solve();
	}
	void solve(){
		Scanner sc=new Scanner(System.in);
		int n=sc.nextInt();
		int[] a=new int[n];
		for(int i=0;i<n;i++){
			a[i]=sc.nextInt();
		}
		System.out.println(LIS(a));
	}
	//Longest Increasing Sequence
	//?????????:LIS?????????
	//??????????¢??????°?????§???????????¨?????¨????????????
	int LIS(int[] a){
		int n=a.length;
		ArrayList<Integer> list=new ArrayList<>();
		for(int i=0;i<n;i++){
			if(list.isEmpty()||a[i]>list.get(list.size()-1)){
				list.add(a[i]);
			}else if(list.get(list.size()-1)==a[i]){
				continue;
			}else{
				//a[i]????????§?????????????????°???????????????(???????????¨)???
				int first=0;
				int last=list.size()-1;
				while(first+1!=last&&!(first==0&&last==0)){
					int mid=(first+last)/2;
					if(list.get(mid)>a[i]){
						last=mid;
					}else{
						first=mid;
					}
				}
				if(list.get(first)!=a[i])
					list.set(last, a[i]);
			}
		}
		return list.size();
	}
}

Compiler output:
a.cc:1:1: error: 'import' does not name a type
    1 | import java.util.ArrayList;
      | ^~~~~~
a.cc:1:1: note: C++20 'import' only available with '-fmodules-ts'
a.cc:2:1: error: 'import' does not name a type
    2 | import java.util.Scanner;
      | ^~~~~~
a.cc:2:1: note: C++20 'import' only available with '-fmodules-ts'
a.cc:3:1: error: expected unqualified-id before 'public'
    3 | public class Main{
      | ^~~~~~
Language: C++

 #include<iostream>
  2 using namespace std;
  3 int main(){
  4   int n;
  5   cin>>n;
  6   int a[n];
  7   for(int i=0;i<n;i++){
  8     cin>>a[i];
  9   }
 10   int SIL[10001];
 11   for(int i=0;i<10001;i++){
 12     SIL[i] = -1;
 13   }
 14   SIL[0] = 0;
 15   int c=0;
 16   for(int i=0;i<n;i++){
 17     if(SIL[c]<a[i]){
 18       c++;
 19       SIL[c]=a[i];
 20     }else if(SIL[c]>a[i]){
 21       SIL[c]=a[i];
 22     }
 23   }
 24   cout<<c<<endl;
 25 }

Compiler output:
a.cc:2:3: error: expected unqualified-id before numeric constant
    2 |   2 using namespace std;
      |   ^
a.cc:3:3: error: expected unqualified-id before numeric constant
    3 |   3 int main(){
      |   ^
Language: C++

#include<iostream>
  2 using namespace std;
  3 int main(){
  4   int n;
  5   cin>>n;
  6   int a[n];
  7   for(int i=0;i<n;i++){
  8     cin>>a[i];
  9   }
 10   int SIL[10001];
 11   for(int i=0;i<10001;i++){
 12     SIL[i] = -1;
 13   }
 14   SIL[0] = 0;
 15   int c=0;
 16   for(int i=0;i<n;i++){
 17     if(SIL[c]<a[i]){
 18       c++;
 19       SIL[c]=a[i];
 20     }else if(SIL[c]>a[i]){
 21       SIL[c]=a[i];
 22     }
 23   }
 24   cout<<c<<endl;
 25 }

Compiler output:
a.cc:2:3: error: expected unqualified-id before numeric constant
    2 |   2 using namespace std;
      |   ^
a.cc:3:3: error: expected unqualified-id before numeric constant
    3 |   3 int main(){
      |   ^