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

#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
#define pb push_back
#define mp make_pair
#define rep(i,n) for(int i=0;i<(n);++i)

int main(){
	cin.tie(0);
	ios::sync_with_stdio(false);
	int n,k;cin >> n >> k;
	vector<int> a(n);
	rep(i,n) cin >> a.at(i);
	cout << (n+k-3))/(k-1) << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:15:24: error: expected ';' before ')' token
   15 |         cout << (n+k-3))/(k-1) << endl;
      |                        ^
      |                        ;
Language: C++

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

const int maxn=1e5+7;

int a[maxn];
int main()
{
    int n,k;
    scanf("%d%d",&n,&k);
    int pos;
    for(int i=1;i<=n;i++){
        scanf("%d",&a[i]);
        if(a[i]==1)pos=i;
    }
    int ans=0x3f3f3f3f;
    for(int i=1;i<=k;i++){
        if(w>=i&&n-w>=k-i)
            ans=min(ans,(int)(ceil((double)(w-i)/(double)(k-1))+ceil((double)(n-(w+k-i))/(double)(k-1))));
    }
    printf("%d\n",ans+1);
    return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:19:12: error: 'w' was not declared in this scope
   19 |         if(w>=i&&n-w>=k-i)
      |            ^
Language: C++

#include <bits/stdc++.h>
using namespace std;
int main(){
      int a,b,i,j,q=0;
      cin>>a>>b;
      for (i=0;i<a;++i){
            cin>>c[i];
      }
      while (a>0){
            q++;
            a=a-b;
            if (a>0){
                  a++;
            }
            else {  
                  cout <<q;
                  return 0;
            }
      }
}


Compiler output:
a.cc: In function 'int main()':
a.cc:7:18: error: 'c' was not declared in this scope
    7 |             cin>>c[i];
      |                  ^
Language: C++

#include <bits/stdc++.h>
using namespace std;
int main()
{
    int a=1,b,c,d=0;
    cin>>a>>b;
    for(int i=1;i<=a;i++)
    {
        cin>>c;
    }
    while(a!=0)
    {
        a=a-b;
        if(a!=0)
        {
            a+=1;
        }
        d++;
    }
    cout<<d;
    return 1;
}
#include <bits/stdc++.h>
using namespace std;
int main()
{
    int a=1,b,c,d=0;
    cin>>a>>b;
    for(int i=1;i<=a;i++)
    {
        cin>>c;
    }
    while(a!=0)
    {
        a=a-b;
        if(a!=0)
        {
            a+=1;
        }
        d++;
    }
    cout<<d;
    return 1;
}
#include <bits/stdc++.h>
using namespace std;
int main()
{
    int a=1,b,c,d=0;
    cin>>a>>b;
    for(int i=1;i<=a;i++)
    {
        cin>>c;
    }
    while(a!=0)
    {
        a=a-b;
        if(a!=0)
        {
            a+=1;
        }
        d++;
    }
    cout<<d;
    return 1;
}


Compiler output:
a.cc:25:5: error: redefinition of 'int main()'
   25 | int main()
      |     ^~~~
a.cc:3:5: note: 'int main()' previously defined here
    3 | int main()
      |     ^~~~
a.cc:47:5: error: redefinition of 'int main()'
   47 | int main()
      |     ^~~~
a.cc:3:5: note: 'int main()' previously defined here
    3 | int main()
      |     ^~~~
Language: C++

#include <iostream>

using namespace std;
//131073
typedef pair<int, int> pii;
typedef long long ll;

const int maxn = 100000 + 10;
int a[maxn];

int main(){
    //ios_base::sync_with_stdio(0);
//    freopen("input.txt", "r", stdin);
    int n, k;
    cin >> n >> k;
    int idx = 0;
    for (int i = 0; i < n; ++i) {
        cin >> a[i];
    }
    int res = (idx - 1) % (k - 1) == 0 ? (idx - 1)/(k - 1) : (idx - 1)/(k - 1) + 1;
    res += (n - idx) % (k - 1) == 0 ? (n - idx)/(k - 1): (n - idx)/(k - 1) + 1;
//    int ans = (n - 1) %
    if(n == k)res = 1;
    cout << (int)ceil((n - 1) * 1./(k - 1)) << endl;
    return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:24:18: error: 'ceil' was not declared in this scope
   24 |     cout << (int)ceil((n - 1) * 1./(k - 1)) << endl;
      |                  ^~~~
Language: C++

#include <iostream>
using namespace std;
int N, K, A[100'000];
int main() {
    ios_base::sync_with_stdio(0);cin.tie(0);

    cin>>N>>K;
    for(int n = 0; n < N; n++) cin>>A[n];
    int whereOne = min_element(A, A + N) - A;
    cout<<(whereOne+K-2)/(K-1) + (N - whereOne+K-3)/(K-1)<<'\n';

    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:9:20: error: 'min_element' was not declared in this scope
    9 |     int whereOne = min_element(A, A + N) - A;
      |                    ^~~~~~~~~~~
Language: C++

#include<iostream>
#include<string>
#include<cstring>
#include<queue>
#include<algorithm>
#include<list>//双向链表
using namespace std;

int a[100005];
int main()
{
	int N, K;
	scanf("%d %d", &N, &K);
	for (int i = 0; i < N; i++)
	{
		scanf("%d", &a[i]);
	}
	int m = ceil((N - 1) / (K - 1)+ (N - 1) % (K - 1));
	printf("%d", m);
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:18:17: error: 'ceil' was not declared in this scope
   18 |         int m = ceil((N - 1) / (K - 1)+ (N - 1) % (K - 1));
      |                 ^~~~
Language: C++

#include<algorithm>
#include<clocale>
#include<cmath>
#include<complex>
#include<csetjmp>
#include<csignal>
#include<cstdarg>
#include<cstddef>
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<ctime>
#include<deque>
#include<iostream>
#include<istream>
#include<map>
#include<math.h>
#include<ostream>
#include<queue>
#include<set>
#include<sstream>
#include<string>
#include<vector>
using namespace std;
int n,m,a[100010],mn=0;
int main(){
	cin>>n>>m;
	for (int i=0;i<n;i++) cin>>a[i];
	if (n==m)
		cout<<1<<endl;
	else{
		for (int i=0;i<n;i++) if (a[mn]>a[i]) mn=i;
		if (i%(m-1)==0) 
			cout<<n/(m-1);
		else
			cout<<n/(m-1)+1;
	}
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:33:21: error: 'i' was not declared in this scope
   33 |                 if (i%(m-1)==0)
      |                     ^
Language: C

 #include <stdio.h>
#include <stdlib.h>
#include <math.h>
             
int main(void){
int N;
int K;
double i;
double j;
int min;
scanf("%d",&N);
scanf("%d",&K);
int A[N];
for(i = 0;i<N;i++){
scanf("%d",&A[i]);
}
for(i = 0;i<N;i++){
if(A[i] == 1){
min = i;
}
}
i = ceil(min/(K-1));
if(min-(K-1)*i > 0){
 //  i = i + 1;
}
j = ceil((N-min-1)/(K-1));
if((N-min-1)-(K-1)*j > 0){
  //  j = j + 1;
}
printf("%d",i+j);
return 0;
}

Compiler output:
main.c: In function 'main':
main.c:15:14: error: array subscript is not an integer
   15 | scanf("%d",&A[i]);
      |              ^
main.c:18:5: error: array subscript is not an integer
   18 | if(A[i] == 1){
      |     ^
Language: C

 #include <stdio.h>
#include <stdlib.h>
             
int main(void){
int N;
int K;
double i;
double j;
int min;
scanf("%d",&N);
scanf("%d",&K);
int A[N];
for(i = 0;i<N;i++){
scanf("%d",&A[i]);
}
for(i = 0;i<N;i++){
if(A[i] == 1){
min = i;
}
}
i = ceil(min/(K-1));
if(min-(K-1)*i > 0){
 //  i = i + 1;
}
j = ceil((N-min-1)/(K-1));
if((N-min-1)-(K-1)*j > 0){
  //  j = j + 1;
}
printf("%d",i+j);
return 0;
}

Compiler output:
main.c: In function 'main':
main.c:14:14: error: array subscript is not an integer
   14 | scanf("%d",&A[i]);
      |              ^
main.c:17:5: error: array subscript is not an integer
   17 | if(A[i] == 1){
      |     ^
main.c:21:5: error: implicit declaration of function 'ceil' [-Wimplicit-function-declaration]
   21 | i = ceil(min/(K-1));
      |     ^~~~
main.c:3:1: note: include '<math.h>' or provide a declaration of 'ceil'
    2 | #include <stdlib.h>
  +++ |+#include <math.h>
    3 | 
main.c:21:5: warning: incompatible implicit declaration of built-in function 'ceil' [-Wbuiltin-declaration-mismatch]
   21 | i = ceil(min/(K-1));
      |     ^~~~
main.c:21:5: note: include '<math.h>' or provide a declaration of 'ceil'
Language: C

 #include <stdio.h>
#include <stdlib.h>
             
int main(void){
int N;
int K;
int i;
int j;
int min;
scanf("%d",&N);
scanf("%d",&K);
int A[N];
for(i = 0;i<N;i++){
scanf("%d",&A[i]);
}
for(i = 0;i<N;i++){
if(A[i] == 1){
min = i;
}
}
i = min/(K-1);
if((min-(K-1)*i > 0){
    i = i + 1;
}
j = (N-min)/(K-1);
if((N-min)-(K-1)*j > 0){
    j = j + 1;
}
printf("%d",i+j);
return 0;
}

Compiler output:
main.c: In function 'main':
main.c:22:21: error: expected ')' before '{' token
   22 | if((min-(K-1)*i > 0){
      |   ~                 ^
      |                     )
main.c:31:1: error: expected expression before '}' token
   31 | }
      | ^
Language: C++

 #include <stdio.h>
#include <stdlib.h>
             
int main(void){
int N;
int K;
int i;
int j;
int max = 0;
scanf("%d",&N);
scanf("%d",&K);
int A[N];
for(i = 0;i<N;i++){
scanf("%d",&A[i]);
}
for(i = 0;i<N-1;i++){
if(B[i] > max){
max = i;
}
}
i = max/(K-1);
j = (N-max)/(K-1);
if((N-max)-(K-1)*j > 0){
    j = j + 1;
}
printf("%d",i+j);
return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:17:4: error: 'B' was not declared in this scope
   17 | if(B[i] > max){
      |    ^
Language: C++

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

int main(){
  int n,k; cin >> n >> k;
  int a; rep(i,n) cin >> a;
  cout << (n + k - 3) / (k - 1) << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:6:14: error: 'i' was not declared in this scope
    6 |   int a; rep(i,n) cin >> a;
      |              ^
a.cc:6:10: error: 'rep' was not declared in this scope
    6 |   int a; rep(i,n) cin >> a;
      |          ^~~
Language: C++

#include<cstdio>
using namespace std;
int N,K,ans;
int main()
{
	scanf("%d %d",&N,&K);
	for(int i=1,a;i<=N;i++)
	sanf("%d",&a);
	if((N-1)%(K-1)==0)
	ans=(N-1)/(K-1);
	else
	ans=(N-1)/(K-1)+1;
	printf("%d",ans);
	return 0;
}

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

#include<cstdio>
using namespace std;
int N,K,ans,minn=2e9,xb;
bool tf1,tf2;
int main()
{
	scanf("%d %d",&N,&K);
	for(int i=1,a;i<=N;i++)
	{
		scanf("%d",&a);
		if(minn>a)
		{
			minn=a;
			xb=i;
		}
	}
	if(N==K)
	{
		printf("1");
		return 0;
	}
	if(xb==1)
	{
					if((N-xb)%(K-1)==0)
			zj1=(N-xb)/(K-1);
			else
			zj1=(N-xb)/(K-1)+1;
		printf("%d",zj1);
		return 0;
	}
	if(xb==N)
	{
				if((xb-1)%(K-1)==0)
		zj2=(xb-1)/(K-1);
		else
		zj2=(xb-1)/(K-1)+1;
	printf("%d",zj2);
	return 0;
	}
	int zj1,zj2;
	if(N-xb<K-1)
	{
		tf1=true;
		xb=N-K+1;
	}
	if(xb-1<K-1)
	{
		tf2=true;
		xb=K;
	}
	if(tf1)
	{
		zj1=1;
		if((xb-1)%(K-1)==0)
		zj2=(xb-1)/(K-1);
		else
		zj2=(xb-1)/(K-1)+1;
	}
	else
	{
		if(tf2)
		{
			zj2=1;
			if((N-xb)%(K-1)==0)
			zj1=(N-xb)/(K-1);
			else
			zj1=(N-xb)/(K-1)+1;
		}
		else
		{
			if((N-xb)%(K-1)==0)
			zj1=(N-xb)/(K-1);
			else
			zj1=(N-xb)/(K-1)+1;
		if((xb-1)%(K-1)==0)
		zj2=(xb-1)/(K-1);
		else
		zj2=(xb-1)/(K-1)+1;
		}
	}
	ans=zj1+zj2;
	printf("%d",ans);
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:25:25: error: 'zj1' was not declared in this scope
   25 |                         zj1=(N-xb)/(K-1);
      |                         ^~~
a.cc:27:25: error: 'zj1' was not declared in this scope
   27 |                         zj1=(N-xb)/(K-1)+1;
      |                         ^~~
a.cc:28:29: error: 'zj1' was not declared in this scope
   28 |                 printf("%d",zj1);
      |                             ^~~
a.cc:34:17: error: 'zj2' was not declared in this scope
   34 |                 zj2=(xb-1)/(K-1);
      |                 ^~~
a.cc:36:17: error: 'zj2' was not declared in this scope
   36 |                 zj2=(xb-1)/(K-1)+1;
      |                 ^~~
a.cc:37:21: error: 'zj2' was not declared in this scope
   37 |         printf("%d",zj2);
      |                     ^~~
Language: C++



import java.util.Scanner;

public class Main {

    public static void main(String [] args) {
        final Scanner sc = new Scanner(System.in);
        final int n;
        final int k;
        n = sc.nextInt();
        k = sc.nextInt();
        final int [] number = new int[n];
        int minIdx = 0;
        for (int i = 0; i < n; ++i) {
            number[i] = sc.nextInt();
            if (number[i] == 1) {
                minIdx = i;
            }
        }
        if (k >= n) {
            System.out.println(1);
            return;
        }
        if (n == 1) {
            System.out.println(0);
            return;
        }

        int minCount = Integer.MAX_VALUE;
        for (int left = 0; left < k; ++left) {
            int leftCount = (minIdx + 1 - left) % (k - 1) == 0 ?
                    (minIdx + 1 - left) / (k - 1) + 1 :
                    (minIdx + 1 - left) / (k - 1) + 1 + 1;
            int right = k - left;
            int rightCount = (n - minIdx - right) % (k - 1) == 0 ?
                    (n - minIdx - right) / (k - 1) :
                    (n - minIdx - right) / (k - 1) + 1;
            int currentCount = leftCount + rightCount;
            if (currentCount < minCount) {
                minCount = currentCount;
            }
        }
        System.out.println(minCount);
    }

}


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

package Regular0623;


import java.util.Scanner;

public class Main {

    public static void main(String [] args) {
        final Scanner sc = new Scanner(System.in);
        final int n;
        final int k;
        n = sc.nextInt();
        k = sc.nextInt();
        final int [] number = new int[n];
        int minIdx = 0;
        for (int i = 0; i < n; ++i) {
            number[i] = sc.nextInt();
            if (number[i] == 1) {
                minIdx = i;
            }
        }
        if (k >= n) {
            System.out.println(1);
            return;
        }
        if (n == 1) {
            System.out.println(0);
            return;
        }

        int minCount = Integer.MAX_VALUE;
        for (int left = 0; left < k; ++left) {
            int leftCount = (minIdx + 1 - left) % (k - 1) == 0 ?
                    (minIdx + 1 - left) / (k - 1) + 1 :
                    (minIdx + 1 - left) / (k - 1) + 1 + 1;
            int right = k - left;
            int rightCount = (n - minIdx - right) % (k - 1) == 0 ?
                    (n - minIdx - right) / (k - 1) :
                    (n - minIdx - right) / (k - 1) + 1;
            int currentCount = leftCount + rightCount;
            if (currentCount < minCount) {
                minCount = currentCount;
            }
        }
        System.out.println(minCount);
    }

}


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

#include <bits/stdc++.h>

using namespace std;
#define BUF (100005)
#define ll long long

int n,k;

int main(void){
	cin >> n >> k;
	int p;
	for(int i=1;i<=n;i++){
		int tmp;
		cin >> tmp;
		if(tmp==1) p=i;
	}

	if(n==k){
		cout << 1 << endl;
		return ;
	}

	int l = p-1;
	int r = n-p;
	k--;
	int ans;
	ans = l/k;
	if(l%k!=0) ans++;
	ans += r/k;
	if(r%k!=0) ans ++;

	cout << ans << endl;

	return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:20:17: error: return-statement with no value, in function returning 'int' [-fpermissive]
   20 |                 return ;
      |                 ^~~~~~
Language: C++

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

int main()
{
    int n, k, p;
    cin n >> k;

    cout << (n + k - 2) / (k - 1);
    return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:7:8: error: expected ';' before 'n'
    7 |     cin n >> k;
      |        ^~
      |        ;
Language: C++

#include <iostream>
#include <fstream>
#include <algorithm>
#include <vector>
#include <math.h>
#include <cmath>
#include <string>
#include <string.h>
#include <map>
#include <set>
#include <stdio.h>
#include <queue>
#include "windows.h"

#define pb push_back
#define ppb pop_back
#define nd second
#define st first
#define ll long long
#define all(v) (v).begin(), (v).end()
#define REP(i, n) for (int (i) = 0; (i) < (int)(n); i++)
#define FOR(i, a, n) for (int (i) = (a); (i) < (int)(n); i++)
#define FORN(i, a, n) for (int (i) = (a); (i) > (int)(n); i--)
#define pi 3.1415926535897932384626433832795028841971
//#define LOCAL

using namespace std; 

int n, k; 
vector <int> v; 
int a; 
int mi = 12345678; 
int cnt; 

int main()
{
	#ifdef LOCAL
		freopen("input.txt", "r", stdin);
		freopen("output.txt", "w", stdout);
	#endif
	
	cin >> n >> k; 
	REP(i, n)
	{
		cin >> a; 
		v.pb(a); 
		if (a < mi) { mi = a; cnt = 1; }
		else if (a == mi) cnt++; 
	}
	
	cout << (n - cnt + k - 2) / (k - 1) << endl; 
	
	return 0;
}

Compiler output:
a.cc:13:10: fatal error: windows.h: No such file or directory
   13 | #include "windows.h"
      |          ^~~~~~~~~~~
compilation terminated.
Language: C++

#include"bits/stdc++.h"
using namespace std;
using ll = int64_t;

int main() {
    ll N, K;
    cin >> N >> K;

    vector<ll> A(N);

    ll one_pos = -1;
    for (ll i = 0; i < N; i++) {
        cin >> A[i];
        if (A[i] == 1) {
            one_pos = i;
            break;
        }
    }

    //1の左にある個数
    ll left = one_pos;

    //1の右にある個数
    ll right = N - 1 - one_pos;

    //左から処理するとあまりが出て,その分を右から引ける
    right -= (left % (K - 1) == 0 ? 0 : K - 1 - left % (K - 1));

    right = max(right, 0LL);

    ll ans = 0;
    ans += (left % (K - 1) == 0 ? left / (K - 1) : left / (K - 1) + 1);
    ans += (right % (K - 1) == 0 ? right / (K - 1) : right / (K - 1) + 1);

    cout << ans << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:29:16: error: no matching function for call to 'max(ll&, long long int)'
   29 |     right = max(right, 0LL);
      |             ~~~^~~~~~~~~~~~
In file included from /usr/include/c++/14/algorithm:60,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:51,
                 from a.cc:1:
/usr/include/c++/14/bits/stl_algobase.h:257:5: note: candidate: 'template<class _Tp> constexpr const _Tp& std::max(const _Tp&, const _Tp&)'
  257 |     max(const _Tp& __a, const _Tp& __b)
      |     ^~~
/usr/include/c++/14/bits/stl_algobase.h:257:5: note:   template argument deduction/substitution failed:
a.cc:29:16: note:   deduced conflicting types for parameter 'const _Tp' ('long int' and 'long long int')
   29 |     right = max(right, 0LL);
      |             ~~~^~~~~~~~~~~~
/usr/include/c++/14/bits/stl_algobase.h:303:5: note: candidate: 'template<class _Tp, class _Compare> constexpr const _Tp& std::max(const _Tp&, const _Tp&, _Compare)'
  303 |     max(const _Tp& __a, const _Tp& __b, _Compare __comp)
      |     ^~~
/usr/include/c++/14/bits/stl_algobase.h:303:5: note:   candidate expects 3 arguments, 2 provided
In file included from /usr/include/c++/14/algorithm:61:
/usr/include/c++/14/bits/stl_algo.h:5706:5: note: candidate: 'template<class _Tp> constexpr _Tp std::max(initializer_list<_Tp>)'
 5706 |     max(initializer_list<_Tp> __l)
      |     ^~~
/usr/include/c++/14/bits/stl_algo.h:5706:5: note:   candidate expects 1 argument, 2 provided
/usr/include/c++/14/bits/stl_algo.h:5716:5: note: candidate: 'template<class _Tp, class _Compare> constexpr _Tp std::max(initializer_list<_Tp>, _Compare)'
 5716 |     max(initializer_list<_Tp> __l, _Compare __comp)
      |     ^~~
/usr/include/c++/14/bits/stl_algo.h:5716:5: note:   template argument deduction/substitution failed:
a.cc:29:16: note:   mismatched types 'std::initializer_list<_Tp>' and 'long int'
   29 |     right = max(right, 0LL);
      |             ~~~^~~~~~~~~~~~
Language: C++

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

int ceildiv(int x,int y){return (x+y-1)/y;}
int main(){
	int n,k;
	scanf("%d%d",&n,&k);
	int p1;
	for(int i=1;i<=n;++i){
		int x;scanf("%d",&x);
		if(x==1){
			p1=i;
			break;
		}
	}
	int a=ceildiv(p1-1,k-1);
	p1=a*(k-1)+1;
	ans+=ceildiv(n-p1,k-1);
	printf("%d",ans);
}


Compiler output:
a.cc: In function 'int main()':
a.cc:18:9: error: 'ans' was not declared in this scope; did you mean 'abs'?
   18 |         ans+=ceildiv(n-p1,k-1);
      |         ^~~
      |         abs
Language: C++

#include<iostream>
#include<algorithm>
#include<string> 
#include<map>
#include<set>
#include<vector>
#include<string.h>
#include<math.h>
#include<stdio.h>
#include<queue>
#include<utility>
#include<cstdio>
#include<cstring>
#define fo(i,w,n) for(int i=(int) w;i<(int) n;i++)
#define qui queue<int>
#define vit vector<int>
#define ll long long
#define pb push_back
#define lb lower_bound
#define ub upper_bound
using namespace std;
int a[100100];
int main()
{
	int n,k,s,t=1;cin>>n>>k;
	fo(i,0,n){
		cin>>a[i];
		if(a[i]==1&&t)s=i,t=0;
	}
	int c=(n-s+k-3)/(k-1)+(s-(n-s+k-2)%(k-1)+k-)/(k-1);
	cout<<((s+1)%(k-1)?c:c+1);
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:30:52: error: expected primary-expression before ')' token
   30 |         int c=(n-s+k-3)/(k-1)+(s-(n-s+k-2)%(k-1)+k-)/(k-1);
      |                                                    ^
Language: C++

#include<cstdlib>
#include<iostream>
#include<algorithm>
#include<vector>
#include<stack>
#include<queue>
#include<string>
#include<cstring>
using namespace std;
typedef long long lng;
typedef unsigned long long ulng;
 
#define pb push_back
#define SZ(a) int((a).size())
#define ALL(a) (a).begin(), (a).end()
#define FOR(i,a,b) for(int i=(a); i<=(b); ++i)
#define FORD(i,b,a) for(int i=(b); i>=(a); --i)
#define REP(i,n) FOR(i,0,n-1)
#define UNIQUE(a) a.erase(unique(ALL(a)), a.end())
 
lng power(lng b, lng e) {lng sol=1; while(e>0) {if(e&1) {sol=sol*b;} e>>=1; b*= b;} return sol;}
 
int N, K;
int a[100000];
 
 
int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    cin >> N >> K;
    REP(i, N) cin >> a[i];
 
   int ans = 1 + (N-K)/(K-1) + (((N-k)%(K-1))!=0);
  cout << ans << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:33:37: error: 'k' was not declared in this scope
   33 |    int ans = 1 + (N-K)/(K-1) + (((N-k)%(K-1))!=0);
      |                                     ^
Language: C++

//C++ Standard Libraries
#include <iostream>
#include <vector>
#include <algorithm>
#include <fstream>
#include <string>
#include <complex>

/*
//Boost C++ Libraries
#include <boost/multiprecision/cpp_int.hpp>
#include <boost/numeric/ublas/io.hpp>
#include <boost/numeric/ublas/vector.hpp>
#include <boost/numeric/ublas/matrix.hpp>
*/

using namespace std;

int main(int argc, char * argv[]){
	//input
	int n, k;
	cin >> n >> k;
	vector<int> arr(n);
	for(int i=0: arr){
		cin >> a[i];
	}

	//main

	cout << ceil((n-k)/(k-1)) << endl;

	return 0;
}

Compiler output:
a.cc: In function 'int main(int, char**)':
a.cc:24:18: error: initializer in range-based 'for' loop
   24 |         for(int i=0: arr){
      |                  ^
a.cc:25:24: error: 'a' was not declared in this scope
   25 |                 cin >> a[i];
      |                        ^
Language: C++

//C++ Standard Libraries
#include <iostream>
#include <vector>
#include <algorithm>
#include <fstream>
#include <string>
#include <complex>

//Boost C++ Libraries
#include <boost/multiprecision/cpp_int.hpp>
#include <boost/numeric/ublas/io.hpp>
#include <boost/numeric/ublas/vector.hpp>
#include <boost/numeric/ublas/matrix.hpp>

using namespace std;

int main(int argc, char * argv[]){
	//input
	int n, k;
	cin >> n >> k;
	vector<int> arr(n);
	for(int i=0: arr){
		cin >> a[i];
	}

	//main

	cout << ceil((n-k)/(k-1)) << endl;

	return 0;
}

Compiler output:
a.cc:10:10: fatal error: boost/multiprecision/cpp_int.hpp: No such file or directory
   10 | #include <boost/multiprecision/cpp_int.hpp>
      |          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
compilation terminated.
Language: C++

#include<string>
#include<string.h>
#include<map>
#include<set>
#include<vector>
#include<stdio.h>
#include<math.h>
#include<iostream>
#include<algorithm>
#include<queue>
#include<stdio.h>

using namespace std;


long long a[100005]; 
int main()
{
    long long n,k;
    cin>>n>>k;
    for(long long i=0;i<n;i++)
    cin>>a[i];
    cout<<(n-1)/(k-1)+(n-1)%(k-1)!=0<<endl;
    //system("pause");
    return 0;
}   

Compiler output:
a.cc: In function 'int main()':
a.cc:23:37: error: invalid operands of types 'int' and '<unresolved overloaded function type>' to binary 'operator<<'
   23 |     cout<<(n-1)/(k-1)+(n-1)%(k-1)!=0<<endl;
      |                                    ~^~~~~~
Language: C++

#include <cstdio>
#include <cassert>
#include <cmath>

int main(){
  int N, K;
  int A;
  int i;
  scanf("%d %d", &N, &K);
  for(i=0;i<N;i++){
    scanf("%d", &A);
  }
  
  int n;
  n = ceil((double)(N-1)/(K-1))
  
  return n;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:15:32: error: expected ';' before 'return'
   15 |   n = ceil((double)(N-1)/(K-1))
      |                                ^
      |                                ;
   16 | 
   17 |   return n;
      |   ~~~~~~
Language: C++

#include<bits/stdc++.h>
using namespace std;
const int N=1e5+10;
int a[N],k,n,min_;
int main(){
	cin>>n>>k;
	for(int i=1;i<=n;i++){cin>>a[i];}
	if(n==k){cout<<"1\n";return 0;}
	if(k==2){cout<<n-1<<endl;return 0;}
	k--;ans=n/k;if(n%k) ans++;
	cout<<ans<<endl;
	return 0;
} 

Compiler output:
a.cc: In function 'int main()':
a.cc:10:13: error: 'ans' was not declared in this scope; did you mean 'abs'?
   10 |         k--;ans=n/k;if(n%k) ans++;
      |             ^~~
      |             abs
Language: C++

#include <cstdio>

int solve(int p,int K)
{
	if(p%(K-1)==0)
		return p/(K-1);
	else
		return p/(K-1)+1;
}

int main(void)
{

	int N,K,i;
	int *a;
	scanf("%d%d",&N,&K);
	a=new int [N];
	for(i=0;i<N;i++)
		scanf("%d",&a[i]);

	for(i=0;i<N;i++)
		if(a[i]==1)
			break;
	printf("%d\n",solve(i,K)+solve(N-p-1,K));
	delete [] a;
	return 0;

}

Compiler output:
a.cc: In function 'int main()':
a.cc:24:42: error: 'p' was not declared in this scope
   24 |         printf("%d\n",solve(i,K)+solve(N-p-1,K));
      |                                          ^
Language: C++

#include<stdio.h>
int a[1e5+1],n,k;

int main(){
	scanf("%d%d",&n,&k);
	for(int i=1;i<=n;++i)scanf("%d",&a[i]);
 int ans=(n-1+k-2)/(k-1);
    printf("%d\n",ans);
}

Compiler output:
a.cc:2:10: error: conversion from 'double' to 'long unsigned int' in a converted constant expression
    2 | int a[1e5+1],n,k;
      |       ~~~^~
a.cc:2:10: error: could not convert '(1.0e+5 + (double)1)' from 'double' to 'long unsigned int'
    2 | int a[1e5+1],n,k;
      |       ~~~^~
      |          |
      |          double
a.cc:2:10: error: size of array 'a' has non-integral type 'double'
Language: C++

#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
#define rep(i,l,r) for(ll i=(l);i<(r);i++)
#define fcout cout << fixed << setprecision(10)
ll digsum(ll n){ //各桁の和
    ll a=0;
    while (n) {
        a+=n%10;
        n/=10;
    }
    return a;
}
int main(){
    ll n;
    cin>>n;
    ll dis=1;
    ll cnt=1;
    while (n) {
        if(cnt*digsum(cnt+dis)<=(cnt+dis)*digsum(cnt)){ //次の数よりn/S(n)が低いなら
            cout<<cnt<<endl;　//出力
            n--;
            cnt+=dis;
        }
        else{ //そうでなければ
            dis*=10; //増加幅を1桁増やし
            cnt=(cnt/wave+1)*dis-1; //下*桁が9の数まで進む
        }
    }
}

Compiler output:
a.cc:21:29: error: extended character 　 is not valid in an identifier
   21 |             cout<<cnt<<endl;　//出力
      |                             ^
a.cc: In function 'int main()':
a.cc:21:29: error: '\U00003000' was not declared in this scope
   21 |             cout<<cnt<<endl;　//出力
      |                             ^~
a.cc:27:22: error: 'wave' was not declared in this scope
   27 |             cnt=(cnt/wave+1)*dis-1; //下*桁が9の数まで進む
      |                      ^~~~
Language: Java

import java.util.*;
public class Main{

    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        int num0 = sc.nextInt();
        int num1 = sc.nextInt();
        int i;
        int[] list = new int[num0];

        for(i = 0;i < num0;i++){
            list[i] = sc.nextInt();
            if(list[i] == 1){
                int min = i;
            }
        }
        int ans = (num0 - 1) / (num1- 1) + 1;
        if((min - 1) % (num1 - 1) != 0 && (num0 - min) % (num1 - 1) != 0){
            ans += 1;
        }else if((min - 1) % (num1 - 1) == 0 && (num0 - min) % (num1 - 1) == 0){
            ans -= 1;
        }
        System.out.println(ans);
    }

}


Compiler output:
Main.java:18: error: cannot find symbol
        if((min - 1) % (num1 - 1) != 0 && (num0 - min) % (num1 - 1) != 0){
            ^
  symbol:   variable min
  location: class Main
Main.java:18: error: cannot find symbol
        if((min - 1) % (num1 - 1) != 0 && (num0 - min) % (num1 - 1) != 0){
                                                  ^
  symbol:   variable min
  location: class Main
Main.java:20: error: cannot find symbol
        }else if((min - 1) % (num1 - 1) == 0 && (num0 - min) % (num1 - 1) == 0){
                  ^
  symbol:   variable min
  location: class Main
Main.java:20: error: cannot find symbol
        }else if((min - 1) % (num1 - 1) == 0 && (num0 - min) % (num1 - 1) == 0){
                                                        ^
  symbol:   variable min
  location: class Main
4 errors
Language: Java

import java.util.*;
public class Main{

    public static void main(String[] args){
        Scanner sc = new Scanner();
        int num0 = sc.nextInt();
        int num1 = sc.nextInt();
        int i;
        int[] list = new int[num0 + 2];

        for(i = 2;i < num0 + 2;i++){
            list[i] = sc.nextInt();
        }
		    int min = list[2];
		    for (int j = 2; j < num1 + 2; j++) {
			       if (min > list[j]) {
				           min = list[j];
			       }
		    }
        int ans = (num0 - 1) / (num2- 1) + 1;
        System.out.println(ans);
    }

}


Compiler output:
Main.java:5: error: no suitable constructor found for Scanner(no arguments)
        Scanner sc = new Scanner();
                     ^
    constructor Scanner.Scanner(Readable,Pattern) is not applicable
      (actual and formal argument lists differ in length)
    constructor Scanner.Scanner(Readable) is not applicable
      (actual and formal argument lists differ in length)
    constructor Scanner.Scanner(InputStream) is not applicable
      (actual and formal argument lists differ in length)
    constructor Scanner.Scanner(InputStream,String) is not applicable
      (actual and formal argument lists differ in length)
    constructor Scanner.Scanner(InputStream,Charset) is not applicable
      (actual and formal argument lists differ in length)
    constructor Scanner.Scanner(File) is not applicable
      (actual and formal argument lists differ in length)
    constructor Scanner.Scanner(File,String) is not applicable
      (actual and formal argument lists differ in length)
    constructor Scanner.Scanner(File,Charset) is not applicable
      (actual and formal argument lists differ in length)
    constructor Scanner.Scanner(File,CharsetDecoder) is not applicable
      (actual and formal argument lists differ in length)
    constructor Scanner.Scanner(Path) is not applicable
      (actual and formal argument lists differ in length)
    constructor Scanner.Scanner(Path,String) is not applicable
      (actual and formal argument lists differ in length)
    constructor Scanner.Scanner(Path,Charset) is not applicable
      (actual and formal argument lists differ in length)
    constructor Scanner.Scanner(String) is not applicable
      (actual and formal argument lists differ in length)
    constructor Scanner.Scanner(ReadableByteChannel) is not applicable
      (actual and formal argument lists differ in length)
    constructor Scanner.Scanner(ReadableByteChannel,String) is not applicable
      (actual and formal argument lists differ in length)
    constructor Scanner.Scanner(ReadableByteChannel,Charset) is not applicable
      (actual and formal argument lists differ in length)
Main.java:20: error: cannot find symbol
        int ans = (num0 - 1) / (num2- 1) + 1;
                                ^
  symbol:   variable num2
  location: class Main
2 errors
Language: C++

#include <stdio.h>

int main(void){
     int n,k;
     int a_k=[];
     scanf('%d',&n);
     scanf('%d\n',&k);
     for(i=0;i<n;i++){
          scanf('%d',&a_k[i]);
     }
     int left;
     left=n%k;
     if(left!==0){
          k=n/k+1;
     }else{
          k=n/k;
     }
     printf('%d',k);
     return 0;
}

Compiler output:
a.cc:6:12: warning: multi-character character constant [-Wmultichar]
    6 |      scanf('%d',&n);
      |            ^~~~
a.cc:7:12: warning: multi-character character constant [-Wmultichar]
    7 |      scanf('%d\n',&k);
      |            ^~~~~~
a.cc:9:17: warning: multi-character character constant [-Wmultichar]
    9 |           scanf('%d',&a_k[i]);
      |                 ^~~~
a.cc:18:13: warning: multi-character character constant [-Wmultichar]
   18 |      printf('%d',k);
      |             ^~~~
a.cc: In lambda function:
a.cc:5:16: error: expected '{' before ';' token
    5 |      int a_k=[];
      |                ^
a.cc: In function 'int main()':
a.cc:5:14: error: invalid user-defined conversion from 'main()::<lambda()>' to 'int' [-fpermissive]
    5 |      int a_k=[];
      |              ^~
a.cc:5:14: note: candidate is: 'constexpr main()::<lambda()>::operator void (*)()() const' (near match)
    5 |      int a_k=[];
      |              ^
a.cc:5:14: note:   no known conversion from 'void (*)()' to 'int'
a.cc:6:12: error: invalid conversion from 'int' to 'const char*' [-fpermissive]
    6 |      scanf('%d',&n);
      |            ^~~~
      |            |
      |            int
In file included from a.cc:1:
/usr/include/stdio.h:428:42: note:   initializing argument 1 of 'int scanf(const char*, ...)'
  428 | extern int scanf (const char *__restrict __format, ...) __wur;
      |                   ~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~
a.cc:7:12: error: invalid conversion from 'int' to 'const char*' [-fpermissive]
    7 |      scanf('%d\n',&k);
      |            ^~~~~~
      |            |
      |            int
/usr/include/stdio.h:428:42: note:   initializing argument 1 of 'int scanf(const char*, ...)'
  428 | extern int scanf (const char *__restrict __format, ...) __wur;
      |                   ~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~
a.cc:8:10: error: 'i' was not declared in this scope
    8 |      for(i=0;i<n;i++){
      |          ^
a.cc:13:15: error: expected primary-expression before '=' token
   13 |      if(left!==0){
      |               ^
a.cc:18:13: error: invalid conversion from 'int' to 'const char*' [-fpermissive]
   18 |      printf('%d',k);
      |             ^~~~
      |             |
      |             int
/usr/include/stdio.h:363:43: note:   initializing argument 1 of 'int printf(const char*, ...)'
  363 | extern int printf (const char *__restrict __format, ...);
      |                    ~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~
Language: Java

import java.util.*;
public class Main{

    public static void main(String[] args){
        int i;
        int[] list = new int[Integer.parseInt(args[0]) + 2];
        for(i = 2;i - 2 < Integer.parseInt(args[0]);i++)
        list[i] = Integer.parseInt(args[i]);
		    int min = list[0];
		    for (int j = 2; j < Integer.parseInt(args[0]) + 2; j++) {
			       if (min > list[j]) {
				           min = list[j];
			       }
		    }
        int count = 0;
        for(int k = 0;k < Integer.parseInt(args[0]) + 2;k++){
            if(Integer.parseInt(list[k] == min)){
                count++;
            }
        }
        int ans = (Integer.parseInt(args[0]) - count) / Integer.parseInt(args[1]);
        System.out.println(ans);
    }

}


Compiler output:
Main.java:17: error: incompatible types: boolean cannot be converted to String
            if(Integer.parseInt(list[k] == min)){
                                        ^
Note: Some messages have been simplified; recompile with -Xdiags:verbose to get full output
1 error
Language: C

#include <stdio.h>

int main(void) {
	
		}
int main(void) {
	int n, k, i, a, b, c, d, e, ans;
	scanf("%d", &n);
	scanf("%d", &k);
	int str[100000];
	for (i = 1; i <= n; i++) {

		scanf("%d", &str[i]);
	}

	for (i = 1; i <= n; i++) {
		if (str[i] = 1)  a = i;
		else;
	}
	if (a = 1) {
		d = (n - a) % (k - 1);
		e = (n - a - d) / (k - 1);
		 ans =  e + 1;
		
	}
	else if (a = n) {
		b = (a - 1) % (k - 1);
		c = (a - b - 1) / (k - 1);
		ans = c + 1;

	}


	else {
		b = (a - 1) % (k - 1);
		c = (a - b - 1) / (k - 1);
		d = (n - a) % (k - 1);
		e = (n - a - d) / (k - 1);
		if (b + d <= k - 1) ans = c + e + 1;
		else ans = c + e + 2;
	}

	printf("%d", ans);




	return 0;
}

Compiler output:
main.c:6:5: error: redefinition of 'main'
    6 | int main(void) {
      |     ^~~~
main.c:3:5: note: previous definition of 'main' with type 'int(void)'
    3 | int main(void) {
      |     ^~~~
Language: C++

#include<bits/stdc++.h>

using namespace std;

int n,k;
long long a[5000010];
int cnt;

bool ok()
{
	for(int i=0;i<n-1;i++)if(a[i]!=a[i+1])return false;
	
	return true;
}

int fnd(int l,int r)
{
	int ret=a[l];
	
	for(int i=l+1;i<r;i++)ret=min(ret,a[i]);
	
	return ret;
}

bool ok2(int ind)
{
	for(int i=ind;i<ind+k-1;i++)if(a[i]!=a[i+1])return false;
	
	return true;
}

int main()
{
	scanf("%d%d",&n,&k);
	for(int i=0;i<n;i++)scanf("%I64d",&a[i]);
	
	for(int i=0;i+k<=n;i++)
	{
		if(ok())
		{
			cout<<cnt;
			return 0;
		}
		
		cnt++;
		int x=fnd(i,i+k);
		
		for(int j=i;j<i+k-1;j++)if(a[j]==x)i++;
		
		for(int j=i;j<i+k-1;j++)a[j]=x;
		
		if(i+k+1>=n)i--;
	}
	
	cout<<cnt;
	return 0;
}

Compiler output:
a.cc: In function 'int fnd(int, int)':
a.cc:20:38: error: no matching function for call to 'min(int&, long long int&)'
   20 |         for(int i=l+1;i<r;i++)ret=min(ret,a[i]);
      |                                   ~~~^~~~~~~~~~
In file included from /usr/include/c++/14/algorithm:60,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:51,
                 from a.cc:1:
/usr/include/c++/14/bits/stl_algobase.h:233:5: note: candidate: 'template<class _Tp> constexpr const _Tp& std::min(const _Tp&, const _Tp&)'
  233 |     min(const _Tp& __a, const _Tp& __b)
      |     ^~~
/usr/include/c++/14/bits/stl_algobase.h:233:5: note:   template argument deduction/substitution failed:
a.cc:20:38: note:   deduced conflicting types for parameter 'const _Tp' ('int' and 'long long int')
   20 |         for(int i=l+1;i<r;i++)ret=min(ret,a[i]);
      |                                   ~~~^~~~~~~~~~
/usr/include/c++/14/bits/stl_algobase.h:281:5: note: candidate: 'template<class _Tp, class _Compare> constexpr const _Tp& std::min(const _Tp&, const _Tp&, _Compare)'
  281 |     min(const _Tp& __a, const _Tp& __b, _Compare __comp)
      |     ^~~
/usr/include/c++/14/bits/stl_algobase.h:281:5: note:   candidate expects 3 arguments, 2 provided
In file included from /usr/include/c++/14/algorithm:61:
/usr/include/c++/14/bits/stl_algo.h:5686:5: note: candidate: 'template<class _Tp> constexpr _Tp std::min(initializer_list<_Tp>)'
 5686 |     min(initializer_list<_Tp> __l)
      |     ^~~
/usr/include/c++/14/bits/stl_algo.h:5686:5: note:   candidate expects 1 argument, 2 provided
/usr/include/c++/14/bits/stl_algo.h:5696:5: note: candidate: 'template<class _Tp, class _Compare> constexpr _Tp std::min(initializer_list<_Tp>, _Compare)'
 5696 |     min(initializer_list<_Tp> __l, _Compare __comp)
      |     ^~~
/usr/include/c++/14/bits/stl_algo.h:5696:5: note:   template argument deduction/substitution failed:
a.cc:20:38: note:   mismatched types 'std::initializer_list<_Tp>' and 'int'
   20 |         for(int i=l+1;i<r;i++)ret=min(ret,a[i]);
      |                                   ~~~^~~~~~~~~~
Language: C++

//include <bits/stdc++.h>
#include <cstdio>
#include <algorithm>
#include <iostream>
#include <vector>
#include <queue>
#include <cstring> 
#define db double 
#define LL long long
//#define int LL
#define rep(i,x,y) for (int i=x;i<=y;++i)

using namespace std;
//const int N  =  ;
//const int mod = ;
void read(int &x)
{
	int f=1;
	x=0;
	char ch=getchar();
	while (!isdigit(ch)) (ch=='-'?f=-1:0),ch=getchar();
	while ( isdigit(ch)) x=x*10+ch-'0',ch=getchar();
	x*=f;
	return ;
}
signed main()
{
		int n,k;
		read(n)	;read(k);--n;--k;
		rep(i,1,n) read(a[i]) ,
		printf("%d",n/k+(n%k?1:0));
		return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:30:33: error: 'a' was not declared in this scope
   30 |                 rep(i,1,n) read(a[i]) ,
      |                                 ^
Language: C++

#include<string>
#include<string.h>
#include<map>
#include<set>
#include<vector>
#include<stdio.h>
#include<math.h>
#include<iostream>
#include<algorithm>
#include<queue>
#include<stdio.h>

using namespace std;


long long n,k,ans=1,x,cnt=1;
int a[100005];
int main()
{

    cin>>n>>k;
    for(int i=0;i<n;i++)
    {cin>>a[i];}
    if(n<=k)cout<<"1";
    if(k==2)cout<<n-1;
    else 
    {
        n+=n/k;
        if(n%k==0)
        cout<<n/k;
        else cout<<n/k+1;
    }
    、、system("pause");
    return 0;
} 

Compiler output:
a.cc:33:5: error: extended character 、 is not valid in an identifier
   33 |     、、system("pause");
      |     ^
a.cc:33:5: error: extended character 、 is not valid in an identifier
a.cc: In function 'int main()':
a.cc:33:5: error: '\U00003001\U00003001system' was not declared in this scope
   33 |     、、system("pause");
      |     ^~~~~~~~~~
Language: C++

#include<bits/stdc++.h>
using namespace std;
int n,k,ans=1;
int main()
{
    ios::sync_with_stdio(false);
    cin>>n>>k;
    rep(i,n)
    	cin.ignore();
    int i=k;
    while(1)
    {
    	if(i>=n)
    	{
    		cout<<ans<<endl;
    		return 0;
		}
    	ans++;
    	i+=(k-1);
	}
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:8:9: error: 'i' was not declared in this scope
    8 |     rep(i,n)
      |         ^
a.cc:8:5: error: 'rep' was not declared in this scope
    8 |     rep(i,n)
      |     ^~~
Language: C++

#include<bits/stdc++.h>
using namespace std;
int main(){
  ll n,k;
  ll one;
  ll ans;
  cin>>n>>k;
  ll a[n];
  for(ll i=0;i<n;i++){
  cin>>a[i];
  if(a[i]==1)
    one=i;
  }
  k-=1;
  ll b=one;
  ll f=n-one-1;
  if(b%k!=0){
    b=b/k+1;
  }
  else{
    b=b/k;
  }
  if(f%k!=0){
    f=f/k+1;
  }
  else{
    f=f/k;
  }

  ans=b+f;
  cout<<ans;
  return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:4:3: error: 'll' was not declared in this scope
    4 |   ll n,k;
      |   ^~
a.cc:5:5: error: expected ';' before 'one'
    5 |   ll one;
      |     ^~~~
      |     ;
a.cc:6:5: error: expected ';' before 'ans'
    6 |   ll ans;
      |     ^~~~
      |     ;
a.cc:7:8: error: 'n' was not declared in this scope; did you mean 'yn'?
    7 |   cin>>n>>k;
      |        ^
      |        yn
a.cc:7:11: error: 'k' was not declared in this scope
    7 |   cin>>n>>k;
      |           ^
a.cc:8:5: error: expected ';' before 'a'
    8 |   ll a[n];
      |     ^~
      |     ;
a.cc:9:9: error: expected ';' before 'i'
    9 |   for(ll i=0;i<n;i++){
      |         ^~
      |         ;
a.cc:9:14: error: 'i' was not declared in this scope
    9 |   for(ll i=0;i<n;i++){
      |              ^
a.cc:10:8: error: 'a' was not declared in this scope
   10 |   cin>>a[i];
      |        ^
a.cc:12:5: error: 'one' was not declared in this scope
   12 |     one=i;
      |     ^~~
a.cc:15:5: error: expected ';' before 'b'
   15 |   ll b=one;
      |     ^~
      |     ;
a.cc:16:5: error: expected ';' before 'f'
   16 |   ll f=n-one-1;
      |     ^~
      |     ;
a.cc:17:6: error: 'b' was not declared in this scope
   17 |   if(b%k!=0){
      |      ^
a.cc:23:6: error: 'f' was not declared in this scope
   23 |   if(f%k!=0){
      |      ^
a.cc:30:3: error: 'ans' was not declared in this scope; did you mean 'abs'?
   30 |   ans=b+f;
      |   ^~~
      |   abs
a.cc:30:7: error: 'b' was not declared in this scope
   30 |   ans=b+f;
      |       ^
a.cc:30:9: error: 'f' was not declared in this scope
   30 |   ans=b+f;
      |         ^
Language: C++

#include<bits/stdc++.h>
using namespace std;
int main(){
  ll n,k;
  ll one;
  ll ans;
  cin>>n>>k;
  ll a[n];
  for(ll i=0;i<n;i++){
  cin>>a[i];
  if(a[i]==1)
    one=i;
  }
  k-=1;
  ll b=one;®
  ll f=n-one-1;
  if(b%k!=0){
    b=b/k+1;
  }
  else{
    b=b/k;
  }
  if(f%k!=0){
    f=f/k+1;
  }
  else{
    f=f/k;
  }

  ans=b+f;
  cout<<ans;
  return 0;
}


Compiler output:
a.cc:15:12: error: extended character ® is not valid in an identifier
   15 |   ll b=one;®
      |            ^
a.cc: In function 'int main()':
a.cc:4:3: error: 'll' was not declared in this scope
    4 |   ll n,k;
      |   ^~
a.cc:5:5: error: expected ';' before 'one'
    5 |   ll one;
      |     ^~~~
      |     ;
a.cc:6:5: error: expected ';' before 'ans'
    6 |   ll ans;
      |     ^~~~
      |     ;
a.cc:7:8: error: 'n' was not declared in this scope; did you mean 'yn'?
    7 |   cin>>n>>k;
      |        ^
      |        yn
a.cc:7:11: error: 'k' was not declared in this scope
    7 |   cin>>n>>k;
      |           ^
a.cc:8:5: error: expected ';' before 'a'
    8 |   ll a[n];
      |     ^~
      |     ;
a.cc:9:9: error: expected ';' before 'i'
    9 |   for(ll i=0;i<n;i++){
      |         ^~
      |         ;
a.cc:9:14: error: 'i' was not declared in this scope
    9 |   for(ll i=0;i<n;i++){
      |              ^
a.cc:10:8: error: 'a' was not declared in this scope
   10 |   cin>>a[i];
      |        ^
a.cc:12:5: error: 'one' was not declared in this scope
   12 |     one=i;
      |     ^~~
a.cc:15:5: error: expected ';' before 'b'
   15 |   ll b=one;®
      |     ^~
      |     ;
a.cc:15:12: error: '\U000000ae' was not declared in this scope
   15 |   ll b=one;®
      |            ^
a.cc:17:6: error: 'b' was not declared in this scope
   17 |   if(b%k!=0){
      |      ^
a.cc:23:6: error: 'f' was not declared in this scope
   23 |   if(f%k!=0){
      |      ^
a.cc:30:3: error: 'ans' was not declared in this scope; did you mean 'abs'?
   30 |   ans=b+f;
      |   ^~~
      |   abs
a.cc:30:7: error: 'b' was not declared in this scope
   30 |   ans=b+f;
      |       ^
a.cc:30:9: error: 'f' was not declared in this scope
   30 |   ans=b+f;
      |         ^
Language: Java

import java.util;
public class Main{

    public static void main(String[] args){
        int i;
        List<int> list = new ArrayList<int>();
        for(i = 3;i - 2 < args[0];i++)
        list.add(args[i]);
		    int min = List.get(0);	　　//とりあえず最小値をn[0]に設定して変数minに代入
		    for (int j=0; j < List.size(); j++) {
			       if (min > List.get(j)) {	//現在の最小値よりも小さい値が出たら
				           min = List.get(j);	//変数minに値を入れ替える
			       }
		    }
        int count = 0;
        for(j = 0;j < n;j++){
            if(List.get(j) == min){
                count++;
            }
        }
        int ans = (args[0] - count) / args[2];
        System.out.println(ans);
    }

}


Compiler output:
Main.java:9: error: illegal character: '\u3000'
		    int min = List.get(0);	??//?????????n[0]???????min???
		                          	^
Main.java:9: error: illegal character: '\u3000'
		    int min = List.get(0);	??//?????????n[0]???????min???
		                          	 ^
2 errors
Language: Java

public classMain{

    public static void main(String[] args){
        int i;
        List<int> list = new ArrayList<int>();
        for(i = 3;i - 2 < args[0];i++)
        list.add(args[i]);
		    int min = List.get(0);	　　//とりあえず最小値をn[0]に設定して変数minに代入
		    for (int j=0; j < List.size(); j++) {
			       if (min > List.get(j)) {	//現在の最小値よりも小さい値が出たら
				           min = List.get(j);	//変数minに値を入れ替える
			       }
		    }
        int count = 0;
        for(j = 0;j < n;j++){
            if(List.get(j) == min){
                count++;
            }
        }
        int ans = (args[0] - count) / args[2];
        System.out.println(ans);
    }

}


Compiler output:
Main.java:1: error: class, interface, enum, or record expected
public classMain{
       ^
Main.java:8: error: illegal character: '\u3000'
		    int min = List.get(0);	??//?????????n[0]???????min???
		                          	^
Main.java:8: error: illegal character: '\u3000'
		    int min = List.get(0);	??//?????????n[0]???????min???
		                          	 ^
Main.java:3: error: unnamed classes are a preview feature and are disabled by default.
    public static void main(String[] args){
                  ^
  (use --enable-preview to enable unnamed classes)
Main.java:24: error: class, interface, enum, or record expected
}
^
5 errors