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

#include<stdio.h>

int main()
{
	int n,m,i;
	char ns[20];
	scanf("%s", ns);
	m = ns;
	for (i = 0; i != null; i++)
		n = ns[i];
	if (m / n == 0)
		printf("Yes");
	else
		printf("No");
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:8:13: error: invalid conversion from 'char*' to 'int' [-fpermissive]
    8 |         m = ns;
      |             ^~
      |             |
      |             char*
a.cc:9:26: error: 'null' was not declared in this scope
    9 |         for (i = 0; i != null; i++)
      |                          ^~~~
Language: C++

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

int main() {
	// your code goes here
	long long n,k,sum = 0;
	cin >> n;
	k = n;
	while(n > 0)
	{
	    sum += n % 10;
	    n /= 10;
	}
	if(k % sum == 0)cout << "Yes\n";
	else cout << "No\n";
	return 0;
}


Compiler output:
a.cc:1:1: error: extended character   is not valid in an identifier
    1 |   #include <bits/stdc++.h>
      | ^
a.cc:1:1: error: extended character   is not valid in an identifier
a.cc:1:3: error: stray '#' in program
    1 |   #include <bits/stdc++.h>
      |   ^
a.cc:1:1: error: '\U00002028\U00002028' does not name a type
    1 |   #include <bits/stdc++.h>
      | ^~
a.cc: In function 'int main()':
a.cc:7:9: error: 'cin' was not declared in this scope
    7 |         cin >> n;
      |         ^~~
a.cc:14:25: error: 'cout' was not declared in this scope
   14 |         if(k % sum == 0)cout << "Yes\n";
      |                         ^~~~
a.cc:15:14: error: 'cout' was not declared in this scope
   15 |         else cout << "No\n";
      |              ^~~~
Language: Java

public static void main(String[] args) {
		Scanner in = new Scanner(System.in);
		int num = in.nextInt();
		int numOrigin = num;
		int sumEachDigit = 0;
		while(num>0) {
			sumEachDigit += num % 10;
			num /= 10;
		}
		if(numOrigin%sumEachDigit==0) {
			System.out.println("Yes");
		}else {
			System.out.println("No");
		}

	}

Compiler output:
Main.java:1: 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)
1 error
Language: C

#include<stdio.h>
#include<string.h>
int main(){
char s[1000000001];
scanf("%s",s);
int num=atoi(s);
int sum=0;
while(i=0;s[i]!='\0';i++){
  sum+=s[i]-'0'
}
if(num%sum==0) printf("Yes");
else printf("No");

return 0;
}

Compiler output:
main.c: In function 'main':
main.c:6:9: error: implicit declaration of function 'atoi' [-Wimplicit-function-declaration]
    6 | int num=atoi(s);
      |         ^~~~
main.c:8:7: error: 'i' undeclared (first use in this function)
    8 | while(i=0;s[i]!='\0';i++){
      |       ^
main.c:8:7: note: each undeclared identifier is reported only once for each function it appears in
main.c:8:10: error: expected ')' before ';' token
    8 | while(i=0;s[i]!='\0';i++){
      |      ~   ^
      |          )
main.c:9:16: error: expected ';' before '}' token
    9 |   sum+=s[i]-'0'
      |                ^
      |                ;
   10 | }
      | ~
Language: Java

import java.io.BufferedReader;
import java.io.InputStreamReader;
 
public class Main {
 
	public static void main(String[] args) throws Throwable {
		BufferedReader vd = new BufferedReader(new InputStreamReader(System.in));
    String cd= vd.readLine();
    String[] s = cd.split("");
    int sum =0;
    for(int i=0;i<s.length;i++){
      sum=sum+Integer.parseInt(s[i]);
    }
    int p = Integer.parseInt(cd);
    if(p%sum==0)System.out.pringln("Yes");
    if(p%sum!=0)System.out.pringln("No");
  }
}

Compiler output:
Main.java:15: error: cannot find symbol
    if(p%sum==0)System.out.pringln("Yes");
                          ^
  symbol:   method pringln(String)
  location: variable out of type PrintStream
Main.java:16: error: cannot find symbol
    if(p%sum!=0)System.out.pringln("No");
                          ^
  symbol:   method pringln(String)
  location: variable out of type PrintStream
2 errors
Language: Java

import java.io.BufferedReader;
import java.io.InputStreamReader;
 
public class Main {
 
	public static void main(String[] args) throws Throwable {
		BufferedReader vd = new BufferedReader(new InputStreamReader(System.in));
    String cd= vd.readLine()
    String[] s = cd.split("");
    int sum =0;
    for(int i=0;i<s.length;i++){
      sum=sum+Integer.parseInt(s[i]);
    }
    int p = Integer.parseInt(cd);
    if(p%sum==0)System.out.pringln("Yes");
    if(p%sum!=0)System.out.pringln("No");
  }
}

Compiler output:
Main.java:8: error: ';' expected
    String cd= vd.readLine()
                            ^
1 error
Language: C

#include<stdio.h>

int main(void){
int val;
int a = 0;
int b = val;

while(val){
a += val %10;
val /= 10;
}

if(b % a) {
printf("No\n");
}else{
printf("Yes\n);
}
return 0;
}


Compiler output:
main.c: In function 'main':
main.c:16:8: warning: missing terminating " character
   16 | printf("Yes\n);
      |        ^
main.c:16:8: error: missing terminating " character
   16 | printf("Yes\n);
      |        ^~~~~~~~
main.c:17:1: error: expected expression before '}' token
   17 | }
      | ^
main.c:16:8: error: expected ';' before '}' token
   16 | printf("Yes\n);
      |        ^
      |        ;
   17 | }
      | ~
Language: C++

#include<iostream>
#include<vector>

using namespace std;

int mian(){
  long n,m,a,b,c;
  char N,M,A,B,C;
  c= 0;
  cin >>  a;
  b= 1;
  for(int i =0 ; i < 9; i--){
    c+= int(a/b)%10;
    b*= 10;
  }

  if(a%c) cout << "No"<< endl;
  else cout << "Yes" << endl;
}


Compiler output:
a.cc: In function 'int mian()':
a.cc:19:1: warning: no return statement in function returning non-void [-Wreturn-type]
   19 | }
      | ^
/usr/bin/ld: /usr/lib/gcc/x86_64-linux-gnu/14/../../../x86_64-linux-gnu/Scrt1.o: in function `_start':
(.text+0x17): undefined reference to `main'
collect2: error: ld returned 1 exit status
Language: C++

//***********************
//*** writer : Alan Hu **
//***********************
#include<iostream>
#include<vector>
#include<string>
#include<set>
#include<map>
#include<algorithm>
#include<queue>
#include<list>
#include<stack>
#include<cstdio>
#include<fstream>
#include<numeric>
#include<functional>
#include<utility>
#include<memory>
#include<cstring>
#include<cmath>
using namespace std;

#define CLEAN(a,b) memset(a,b,sizeof(a))
#define mp make_pair
#define pb push_back
#define rept(i,a,b) for(int i=(int)(a);i<(int)(b);i++)

typedef long long ll;
typedef pair<int, int> pii;

int main()
{
	ll a,b=0,c;
	cin>>a;
	c=a;
	while (a1>0)
	{
		int x=a%10;
		b+=x;
		a/=10;
	}
	if (c%b==0) cout<<"Yes"<<endl;
	else cout<<"No"<<endl;
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:36:16: error: 'a1' was not declared in this scope; did you mean 'a'?
   36 |         while (a1>0)
      |                ^~
      |                a
Language: C++

#include <iostream>
using namespace std;
 int main{
string S;
cin>>S;
int a=0;
for(int i=0;i<4;i++){
if(S[i]=='+')a++;
if(S[i]=='-')a--;
cout<<a<endl;
 }
   return 0;
}

Compiler output:
a.cc:3:6: error: cannot declare '::main' to be a global variable
    3 |  int main{
      |      ^~~~
a.cc:4:8: error: expected primary-expression before 'S'
    4 | string S;
      |        ^
a.cc:4:8: error: expected '}' before 'S'
a.cc:3:10: note: to match this '{'
    3 |  int main{
      |          ^
a.cc:5:1: error: 'cin' does not name a type
    5 | cin>>S;
      | ^~~
a.cc:7:1: error: expected unqualified-id before 'for'
    7 | for(int i=0;i<4;i++){
      | ^~~
a.cc:7:13: error: 'i' does not name a type
    7 | for(int i=0;i<4;i++){
      |             ^
a.cc:7:17: error: 'i' does not name a type
    7 | for(int i=0;i<4;i++){
      |                 ^
a.cc:12:4: error: expected unqualified-id before 'return'
   12 |    return 0;
      |    ^~~~~~
a.cc:13:1: error: expected declaration before '}' token
   13 | }
      | ^
Language: C

#include <stdio.h>

int main()
{
int s, sn;

scanf("%d", &s);

sn = s/1000000000 +
s%1000000000/100000000 +
s%100000000/10000000 +
s%10000000/1000000 +
s%1000000/100000 +
s%100000/10000 +
s%10000/1000 +
s%1000/100 +
s%100/10 +
s%10;

if((sn%n)==0) printf("Yes");
else printf("No");

return 0;
}


Compiler output:
main.c: In function 'main':
main.c:20:8: error: 'n' undeclared (first use in this function); did you mean 'sn'?
   20 | if((sn%n)==0) printf("Yes");
      |        ^
      |        sn
main.c:20:8: note: each undeclared identifier is reported only once for each function it appears in
Language: C

#include <iostream>
using namespace std;

int digitSum(int x) {
    int sum = 0;
    while(x > 0) {
        sum += x%10;
        x /= 10;
    }
    return sum;
}

int main()
{
  int N;
  cin>>N;
  
  if (N%digitSum(N) == 0) cout<<"Yes"<<endl;
  else cout<<"No"<<endl;
  return 0;
}


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

#include <iostream>

using namespace std;

int digitSum(int x) {
    int sum = 0;
    while(x > 0) {
        sum += x%10;
        x /= 10;
    }
    return sum;
}

int main()
{
  int N;
  cin>>N;
  
  if (N%digitSum(N) == 0) cout<<"Yes"<<endl;
  else cout<<"No"<<endl;
  return 0;
}


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

#include <stdio.h>

int main()
{
int s, sn;

scanf("%d", &s);

sn = s/1000000000 +
s%1000000000/100000000 +
s%100000000/10000000 +
s%10000000/1000000 +
s%1000000/100000 +
s%100000/10000 +
s%10000/1000 +
s%1000/100 +
s%100/10 +
s%10;

if(sn%n==0) printf("Yes");
else printf("No");

return 0;
}


Compiler output:
main.c: In function 'main':
main.c:20:7: error: 'n' undeclared (first use in this function); did you mean 'sn'?
   20 | if(sn%n==0) printf("Yes");
      |       ^
      |       sn
main.c:20:7: note: each undeclared identifier is reported only once for each function it appears in
Language: C++

#include <iostream>
#include <stdint.h>

using namespace std;

int main()
{
  int N;

  cin >> N;

  int NN = N;
  int digit_sum = 0;

  while(NN > 10) {
    digit_sum += NN%10;
    NN/=10;
  }

  digit_sum += NN;

  cout << ( (N%digit_sum==0) ? "Yes" : "No") << endl;
  
  return 0;
}
[21:10

Compiler output:
a.cc:26:1: error: expected unqualified-id before '[' token
   26 | [21:10
      | ^
Language: C++

#include<iostream>
#include<vector>

using namespace std;

int mian(){
  long n,m,a,b,c;
  char N,M,A,B,C;
  c= 0;
  cin >>  a;
  b= 1;
  for(int i =0 ; i < 9; i--){
    c+= int(a/b)%10;
    b*= 10;
  }

if(a%c)
  cout << 'No'<< endl;
else
  cout << 'Yes' << endl;
}


Compiler output:
a.cc:18:11: warning: multi-character character constant [-Wmultichar]
   18 |   cout << 'No'<< endl;
      |           ^~~~
a.cc:20:11: warning: multi-character character constant [-Wmultichar]
   20 |   cout << 'Yes' << endl;
      |           ^~~~~
a.cc: In function 'int mian()':
a.cc:21:1: warning: no return statement in function returning non-void [-Wreturn-type]
   21 | }
      | ^
/usr/bin/ld: /usr/lib/gcc/x86_64-linux-gnu/14/../../../x86_64-linux-gnu/Scrt1.o: in function `_start':
(.text+0x17): undefined reference to `main'
collect2: error: ld returned 1 exit status
Language: C++

n = int(input())
sn = 0
k = n
while k // 10 != 0:
    sn += k % 10
    k //= 10
if (n % sn == 0):
    print('Yes')
else:
    print('No')

Compiler output:
a.cc:8:11: warning: multi-character character constant [-Wmultichar]
    8 |     print('Yes')
      |           ^~~~~
a.cc:10:11: warning: multi-character character constant [-Wmultichar]
   10 |     print('No')
      |           ^~~~
a.cc:1:1: error: 'n' does not name a type
    1 | n = int(input())
      | ^
Language: C++

#include <bits/stdc++.h>
using namespace std;
#define REP(i, n) for(int i = 0; i < n; i++)
#define REPR(i, n) for(int i = n; i >= 0; i--)
#define FOR(i, m, n) for(int i = m; i < n; i++)
#define FORR(i, m, n) for(int i = m; i >= n; i--)
#define SORT(v, n) sort(v, v+n);
#define VSORT(v) sort(v.begin(), v.end());
#define ll long long
#define pb(a) push_back(a)

int main(){
  ソースを表示
印刷
SyntaxHighlighterについて
/*
 * C言語のサンプルプログラム - Webkaru
 * - 入力した自然数の各桁の数字の和を計算 -
 */
#include <stdio.h>

int main()
{

  /* 自然数 */
  int num;

  /* 各桁の数字 */
  int dig;

  /* 和 */
  int sum = 0;

  cin >> num;

  /* 自然数の各桁の数字の和を計算 */
  while(num){
    dig = num % 10;
    sum = sum + dig;
    num = num / 10;
  }

  if(num % sum == 0) cout << "Yes";
  else cout << "No"; 
}


Compiler output:
a.cc: In function 'int main()':
a.cc:13:3: error: '\U000030bd\U000030fc\U000030b9\U00003092\U00008868\U0000793a' was not declared in this scope
   13 |   ソースを表示
      |   ^~~~~~~~~~~~
a.cc:45:2: error: expected '}' at end of input
   45 | }
      |  ^
a.cc:12:11: note: to match this '{'
   12 | int main(){
      |           ^
Language: C

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

using namespace std;

typedef long long ll;

int main()
{
	int N;
	cin >> N;
	
	int dsum = 0;
	int tmp = N;
	while(tmp) {
		dsum += tmp % 10;
		tmp /= 10;
	}
	if(N % dsum == 0) cout << "Yes" << endl;
	else cout << "No" << endl;

	return 0;
}


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

#include<bits/stdc++.h>
#define rep(i,n) for(int i=0; i<(n); i++)
using namespace std;
using ll=long long;

int main(){
  int n,k,ans=0;
  cin >> n >> k;
  vector<int> a(n);
  rep(i,n) cin >> a[i];
  
  if(k==n){
    cout << 1 << endl;
    return 0;
  }
  
  for(int i=0; i<n; i++){
    if(i%(k-1)!=0) ans += i%(k-1)+1;
    if(i%(k-1)==0) ans += i%(k-1);
    if((n-i)%(k-1)!=0) ans += i%(k-1)+1;
    if((n-i)%(k-1)==0) ans += i%(k-1);
  }
  
  cout << anns << endl;
  
}
  
  
  


Compiler output:
a.cc: In function 'int main()':
a.cc:24:11: error: 'anns' was not declared in this scope; did you mean 'ans'?
   24 |   cout << anns << endl;
      |           ^~~~
      |           ans
Language: C++

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

int main(){
  int N,K;cin>>N>>K;
  int l;
  vector<int> A(N);
  for(int i=0;i<N;i++){
    cin>>A.at(i);
    if(A.at(i)==1) l=i;//A.at(l)=1
  }
  int ans;
  if(N==K) ans=1;
  int infer=0;
  int prior=0;
  while(true){
    infer++;
    if(l-infer*(K-1)<=0) break;
  }
  while(true){
    prior++;
    if(l+prior(K-1)>=N-1) break;
  }
  ans=prior+infer;
  cout<<ans<<endl;
}
  
  
      


Compiler output:
a.cc: In function 'int main()':
a.cc:22:15: error: 'prior' cannot be used as a function
   22 |     if(l+prior(K-1)>=N-1) break;
      |          ~~~~~^~~~~
Language: C++

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

typedef long long ll;
typedef unsigned long long ull;
typedef double dd;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef pair<int,int> pii;

const int mx=1e6+11;
const double PI = acos(-1);
#define MOD 1000000007

#define nl '\n'
#define pb push_back
#define F first
#define S second
#define I insert
#define mp make_pair

#define sz(x) x.size()
#define tt int t; cin>>t; while(t--)
#define be(a) (a).begin(),(a).end()
#define rbe(a) (a).rbegin(),(a).rend()
#define mem(a,b) memset(a,b,sizeof(a))
#define yes cout<<"YES"<<nl
#define no cout<<"NO"<<nl

#define su ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define file freopen("input.txt","r",stdin);freopen("output.txt","w",stdout);
#define frac cout.unsetf(ios::floatfield); cout.precision(10); cout.setf(ios::fixed,ios::floatfield);

template < typename F, typename S >
ostream& operator << ( ostream& os, const pair< F, S > & p )
{
    return os << "(" << p.first << ", " << p.second << ")";
}

template < typename T >
ostream &operator << ( ostream & os, const vector< T > &v )
{
    os << "{";
    for(auto it = v.begin(); it != v.end(); ++it)
    {
        if( it != v.begin() )
            os << ", ";
        os << *it;
    }
    return os << "}";
}

template < typename T >
ostream &operator << ( ostream & os, const set< T > &v )
{
    os << "[";
    for(auto it = v.begin(); it != v.end(); ++it)
    {
        if( it != v.begin() )
            os << ", ";
        os << *it;
    }
    return os << "]";
}

template < typename T >
ostream &operator << ( ostream & os, const multiset< T > &v )
{
    os << "[";
    for(auto it = v.begin(); it != v.end(); ++it)
    {
        if( it != v.begin() )
            os << ", ";
        os << *it;
    }
    return os << "]";
}

template < typename F, typename S >
ostream &operator << ( ostream & os, const map< F, S > &v )
{
    os << "[";
    for(auto it = v.begin(); it != v.end(); ++it)
    {
        if( it != v.begin() )
            os << ", ";
        os << it -> first << " = " << it -> second ;
    }
    return os << "]";
}

#define dbg(args...) do {cerr << #args << " : "; faltu(args); } while(0)

void faltu ()
{
    cerr << endl;
}

template <typename T>
void faltu( T a[], int n )
{
    for(int i = 0; i < n; ++i)
        cerr << a[i] << ' ';
    cerr << endl;
}

template <typename T, typename ... hello>
void faltu( T arg, const hello &... rest)
{
    cerr << arg << ' ';
    faltu(rest...);
}


int gcd(int a,int b)
{
    return b ? gcd(b,a%b) : a;
}
int lcm(int a,int b)
{
    return (a*( b/ gcd(a,b)));
}

void f()
{
    int n,k,cnt=0,a;
    cin>>n>>k;
    for(int i=0; i<n; i++)
    {
        cin>>a;
    }
    
    if(n==k)
    {
      cout<<1<<nl;
      return;
    }
    
    int i=0;

    while(i<=n)
    {
      if(i+k-1=>n)
        break;
      cnt++;
      i+=k-1;
    }
    if(i<n)
      cnt++;
    cout<<cnt<<nl;
}

int main()
{
    su;
    f();
    return 0;
}



Compiler output:
a.cc: In function 'void f()':
a.cc:143:16: error: expected primary-expression before '>' token
  143 |       if(i+k-1=>n)
      |                ^
Language: C++

#include <bits/stdc++.h>
using namespace std;
 
int main(){
  int n, k; cin >> n >> k;
  cout << (n - k > 0 ? ((n - k + 1)/(k - 1)) + 1: 1 << '\n';
}

Compiler output:
a.cc: In function 'int main()':
a.cc:6:60: error: expected ')' before ';' token
    6 |   cout << (n - k > 0 ? ((n - k + 1)/(k - 1)) + 1: 1 << '\n';
      |           ~                                                ^
      |                                                            )
Language: C++

#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int N,K;
  cin >> N >> K;
  vector<int>A(N);
  for(int i=0;i<N;i++){
    cin >> a[i];
  }
  if((N-1)%(K-1)==0){
    cout<<(N-1)/(K-1)<<endl;
    return 0;
  }
    cout<<(N-1)/(K-1)+1<<endl;
}


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

#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int N,K;
  cin >> N >> K;
  vector<int>A(N);
  for(int i=0;i<N;i++){
    cin >> vec[i];
  }
  if((N-1)%(K-1)==0){
    cout<<(N-1)/(K-1)<<endl;
    return 0;
  }
    cout<<(N-1)/(K-1)+1<<endl;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:9:12: error: 'vec' was not declared in this scope
    9 |     cin >> vec[i];
      |            ^~~
Language: Java



import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.Scanner;

public final class C {

    public static void main(String[] args) {
        final Scanner in = new Scanner(new BufferedReader(new InputStreamReader(System.in)));
        final String[] line = in.nextLine().split(" ");
        final int n = Integer.parseInt(line[0]);
        final int k = Integer.parseInt(line[1]);
        for (int i = 0; i < n; i++) {
            in.nextInt();
        }
        in.nextLine();
        System.out.println(Math.ceil((double) (n - 1) / (k - 1)));
    }
}


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



import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.Scanner;

public final class C {

    public static void main(String[] args) {
        final Scanner in = new Scanner(new BufferedReader(new InputStreamReader(System.in)));
        final String[] line = in.nextLine().split(" ");
        final int n = Integer.parseInt(line[0]);
        final int k = Integer.parseInt(line[1]);
        for (int i = 0; i < n; i++) {
            in.nextInt();
        }
        in.nextLine();
        System.out.println((n - 1) / (k - 1));
    }
}


Compiler output:
Main.java:7: error: class C is public, should be declared in a file named C.java
public final class C {
             ^
1 error
Language: C++

#include<iostream>
using namespace std;
int main(){
    double n,k;
    double zuu;
    cin>>n>>k;
    zuu=round((n-1)/(k-1));
    cout<<zuu;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:7:9: error: 'round' was not declared in this scope
    7 |     zuu=round((n-1)/(k-1));
      |         ^~~~~
Language: Java

import java.util.*;

public class Main {
  
  public static void main(String[] args) {
    
    Scanner scan = new Scanner(System.in);
    int N = scan.nextInt();
    int K = scan.nextInt();
    int least = scan.nextInt();

    for (int i = 1; i < N; i++) {
      int x = scan.nextInt();
      
      if (x < least) {
        least = x;
        int best = i;
      }
    }
    
    int answer = (best-2)/(K-1) + (N-best-1)/(K-1) + 2;
    
    System.out.println(answer);
  }
}
      

Compiler output:
Main.java:21: error: cannot find symbol
    int answer = (best-2)/(K-1) + (N-best-1)/(K-1) + 2;
                  ^
  symbol:   variable best
  location: class Main
Main.java:21: error: cannot find symbol
    int answer = (best-2)/(K-1) + (N-best-1)/(K-1) + 2;
                                     ^
  symbol:   variable best
  location: class Main
2 errors
Language: C++

#include<iostream>
using namespace std;
int main(){
    int n,k; cin >> n >>k;
    cout<<ceil((n-1)/(k-1))<<endl;
}

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

#include <iostream>
using namespace std;

int main(){
  int n,k;
  cin >> n >> k;
  
  vector<int> v(n);
  for(int i = 0; i < n; i++){
    int x;
    cin >> x;
    v[i] = x;
  }
  int flag = 0;
  int cnt = -1;
  for(int i = 0; i < n; i = i + k - 1){
    
    if(n - i + 1 < k - 1){
      flag = 1;
      break;
    }
    cnt++;
  }
  if(flag)cnt++;
  cout << cnt;
    
}


Compiler output:
a.cc: In function 'int main()':
a.cc:8:3: error: 'vector' was not declared in this scope
    8 |   vector<int> v(n);
      |   ^~~~~~
a.cc:2:1: note: 'std::vector' is defined in header '<vector>'; this is probably fixable by adding '#include <vector>'
    1 | #include <iostream>
  +++ |+#include <vector>
    2 | using namespace std;
a.cc:8:10: error: expected primary-expression before 'int'
    8 |   vector<int> v(n);
      |          ^~~
a.cc:12:5: error: 'v' was not declared in this scope
   12 |     v[i] = x;
      |     ^
Language: C++

#include <iostream>
using namespace std;

int main(){
  int n,k;
  cin >> n >> k;
  
  vector<int> v(n);
  for(int i = 0; i < n; i++){
    int x;
    cin >> x;
    v[i] = x;
  }
  cout << (n/k)+ (n%k);
}


Compiler output:
a.cc: In function 'int main()':
a.cc:8:3: error: 'vector' was not declared in this scope
    8 |   vector<int> v(n);
      |   ^~~~~~
a.cc:2:1: note: 'std::vector' is defined in header '<vector>'; this is probably fixable by adding '#include <vector>'
    1 | #include <iostream>
  +++ |+#include <vector>
    2 | using namespace std;
a.cc:8:10: error: expected primary-expression before 'int'
    8 |   vector<int> v(n);
      |          ^~~
a.cc:12:5: error: 'v' was not declared in this scope
   12 |     v[i] = x;
      |     ^
Language: C++

#include<bits/stdc++.h>
#define ll long long
using namespace std;
int main()
{
  int n,,a[100000];
  cin>>n>>k;
  for(int i=0;i<n;i++)
  {
    cin>>a[i];
  }
  if(n%k==0)
  {
    cout<<n/k<<endl;
  }
  else
  {
    cout<<(n/k)*2<<endl;
  }
}


Compiler output:
a.cc: In function 'int main()':
a.cc:6:9: error: expected unqualified-id before ',' token
    6 |   int n,,a[100000];
      |         ^
a.cc:7:11: error: 'k' was not declared in this scope
    7 |   cin>>n>>k;
      |           ^
Language: C++

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

int main() {
  int N, K;
  
  int a[N+1];
  
  int num_1;
  for (int i = 1; i <= N; i++) {
    cin >> a[i];
    if (a[i] == 1) {
      num1 = i;
      break;
    }
  }
    cout << (num1 / 2) + ((N - num1 + 1)/2) << endl;
  
}


Compiler output:
a.cc: In function 'int main()':
a.cc:13:7: error: 'num1' was not declared in this scope; did you mean 'num_1'?
   13 |       num1 = i;
      |       ^~~~
      |       num_1
a.cc:17:14: error: 'num1' was not declared in this scope; did you mean 'num_1'?
   17 |     cout << (num1 / 2) + ((N - num1 + 1)/2) << endl;
      |              ^~~~
      |              num_1
Language: C++

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

int main() {
  int N, K;
  
  int a[N+1];
  
  int num_1
  for (int i = 1; i <= N; i++) {
    cin >> a[i];
    if (a[i] == 1) {
      num1 = i;
      break;
    }
  }
    cout << (num1 / 2) + ((N - num1 + 1)/2) << endl;
  
}


Compiler output:
a.cc: In function 'int main()':
a.cc:10:3: error: expected initializer before 'for'
   10 |   for (int i = 1; i <= N; i++) {
      |   ^~~
a.cc:10:19: error: 'i' was not declared in this scope
   10 |   for (int i = 1; i <= N; i++) {
      |                   ^
a.cc:17:14: error: 'num1' was not declared in this scope
   17 |     cout << (num1 / 2) + ((N - num1 + 1)/2) << endl;
      |              ^~~~
Language: C++

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

    vector<int> A(N);
    for (int i = 0; i < N; i++)
    {
        cin >> A[i];
    }
    int ans = 0;
    int right = 0;
    while (true)
    {
        if (ans == 0)
        {
            right += K;
        }
        else
        {
            right += K - 1;
        }
        ans++;

        if (right >= N)
        {
            break;
        }
    }
    cout << ans << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:4:5: error: 'cin' was not declared in this scope
    4 |     cin >> N >> K;
      |     ^~~
a.cc:6:5: error: 'vector' was not declared in this scope
    6 |     vector<int> A(N);
      |     ^~~~~~
a.cc:6:12: error: expected primary-expression before 'int'
    6 |     vector<int> A(N);
      |            ^~~
a.cc:9:16: error: 'A' was not declared in this scope
    9 |         cin >> A[i];
      |                ^
a.cc:30:5: error: 'cout' was not declared in this scope
   30 |     cout << ans << endl;
      |     ^~~~
a.cc:30:20: error: 'endl' was not declared in this scope
   30 |     cout << ans << endl;
      |                    ^~~~
Language: C++

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

int main() {
  int N,K;cin>>N>>K;
  vector<int> vec(N);
  for (int i =0; i<N; i++;){
    cin>> vec.at(i);
  }
  int C;
  for (int i=0;i<N;i++){
    if(vec.at(i)==1){
      C =i;
      break;
    }
    else{
      continue;
    }
  }
  //int A =C+1;
  //int B =N-C;
  int D = N-C-1;
  int x=K-1;
  //int Ax=C/x; int Bx=B/x;
  int Cx=C/x; int Dx=D/x;
  int Cy;int Dy;
  for (int i=1;i++){
    if(i-1<Cx<=i){
      Cy =i;
      break;
    }
    else{
      continue;
    }
  }
  for (int i=1;i++){
    if(i-1<Dx<=i){
      Cy =i;
      break;
    }
    else{
      continue;
    }
  }
  
  cout<<Cy+Dy<<endl;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:7:26: error: expected ')' before ';' token
    7 |   for (int i =0; i<N; i++;){
      |       ~                  ^
      |                          )
a.cc:7:27: error: expected primary-expression before ')' token
    7 |   for (int i =0; i<N; i++;){
      |                           ^
a.cc:27:19: error: expected ';' before ')' token
   27 |   for (int i=1;i++){
      |                   ^
      |                   ;
a.cc:36:19: error: expected ';' before ')' token
   36 |   for (int i=1;i++){
      |                   ^
      |                   ;
Language: C++

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

int main() {
  int N,K;cin>>N>>K;
  vector<int> vec(N);
  for (i =0; i<N; i++;){
    cin>> vec.at(i);
  }
  int C;
  for (i=0;i<N;i++){
    if(vec.at(i)==1){
      C =i;
      break;
    }
    else{
      continue;
    }
  }
  //int A =C+1;
  //int B =N-C;
  int D = N-C-1;
  int x=K-1;
  //int Ax=C/x; int Bx=B/x;
  int Cx=C/x; int Dx=D/x;
  int Cy;int Dy;
  for (i=1;i++){
    if(i-1<Cx<=i){
      Cy =i;
      break;
    }
    else{
      continue;
    }
  }
  for (i=1;i++){
    if(i-1<Dx<=i){
      Cy =i;
      break;
    }
    else{
      continue;
    }
  }
  
  cout<<Cy+Dy<<endl;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:7:8: error: 'i' was not declared in this scope
    7 |   for (i =0; i<N; i++;){
      |        ^
a.cc:7:22: error: expected ')' before ';' token
    7 |   for (i =0; i<N; i++;){
      |       ~              ^
      |                      )
a.cc:7:23: error: expected primary-expression before ')' token
    7 |   for (i =0; i<N; i++;){
      |                       ^
a.cc:11:8: error: 'i' was not declared in this scope
   11 |   for (i=0;i<N;i++){
      |        ^
a.cc:27:8: error: 'i' was not declared in this scope
   27 |   for (i=1;i++){
      |        ^
a.cc:27:15: error: expected ';' before ')' token
   27 |   for (i=1;i++){
      |               ^
      |               ;
a.cc:36:8: error: 'i' was not declared in this scope
   36 |   for (i=1;i++){
      |        ^
a.cc:36:15: error: expected ';' before ')' token
   36 |   for (i=1;i++){
      |               ^
      |               ;
Language: C++

#include<bits/stdc++.h>
using namespace std;
using ll = long long;
#define pb push_back
#define pii pair<ll,ll>
#define ff first
#define ss second
#define mxx 100005
#define endl "\n"
const ll mod=1e9+7;

int main()
{
    ios::sync_with_stdio(0);
    //cin.tie(0);

    ll n,k;
    cin>>n>>k;

    for(int i=0; i<n; i++)
    {
        ll x;
        cin>>x;
    }
    
    k--;

    cout<<ans/k<<endl;


    return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:28:11: error: 'ans' was not declared in this scope; did you mean 'abs'?
   28 |     cout<<ans/k<<endl;
      |           ^~~
      |           abs
Language: C++

#include<bits/stdc++.h>
using namespace std;
int main(void){
  int n,k;
  cin>>n>>K;
  vector<int> a(n);
  for(int i=0;i<n;i++){
    cin>>a[i];
  }
  int count=k;
  int ans=1;
  while(count<n){
    count+=(k-1);
    ++ans;
  }
  cout<<ans<<endl;
  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:5:11: error: 'K' was not declared in this scope
    5 |   cin>>n>>K;
      |           ^
Language: C++

#include<iostream>

int main(){
  int n, k;
  cin >> n >> k;
  for(int i = 0; i < n; i++){
    int a;
    cin >> a;
  }
  if((n-1) % (k-1) != 0){
    cout << ((n-1) / (k-1)) + 1<< endl;
  } 
  else{
    cout << (n-1) / (k-1) << endl;
  }
  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:5:3: error: 'cin' was not declared in this scope; did you mean 'std::cin'?
    5 |   cin >> n >> k;
      |   ^~~
      |   std::cin
In file included from a.cc:1:
/usr/include/c++/14/iostream:62:18: note: 'std::cin' declared here
   62 |   extern istream cin;           ///< Linked to standard input
      |                  ^~~
a.cc:11:5: error: 'cout' was not declared in this scope; did you mean 'std::cout'?
   11 |     cout << ((n-1) / (k-1)) + 1<< 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:11:35: error: 'endl' was not declared in this scope; did you mean 'std::endl'?
   11 |     cout << ((n-1) / (k-1)) + 1<< endl;
      |                                   ^~~~
      |                                   std::endl
In file included from /usr/include/c++/14/iostream:41:
/usr/include/c++/14/ostream:744:5: note: 'std::endl' declared here
  744 |     endl(basic_ostream<_CharT, _Traits>& __os)
      |     ^~~~
a.cc:14:5: error: 'cout' was not declared in this scope; did you mean 'std::cout'?
   14 |     cout << (n-1) / (k-1) << 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:14:30: error: 'endl' was not declared in this scope; did you mean 'std::endl'?
   14 |     cout << (n-1) / (k-1) << endl;
      |                              ^~~~
      |                              std::endl
/usr/include/c++/14/ostream:744:5: note: 'std::endl' declared here
  744 |     endl(basic_ostream<_CharT, _Traits>& __os)
      |     ^~~~
Language: C++

#include<iostream>
#include<algorithm>
using namespace std;
int main(){
  int n,k;
  cin>>n>>k;
  int a[n];
  int mn=1e9;
  for(int i = 0; i < n; ++i){
    cin>>a[i];
    mn=min(mn,a[i]);
  }
  int ans=0,cnt=0;
  for(int i=0;i<n;i++){
    if(a[i]==mn)ans+=ceil(cnt/(k+1)),cnt=0;
    else cnt++;
  }
  cout<<ans;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:15:22: error: 'ceil' was not declared in this scope
   15 |     if(a[i]==mn)ans+=ceil(cnt/(k+1)),cnt=0;
      |                      ^~~~
Language: C++

#include<iostream>
#include<algorithm>
using namespace std;
int main(){
  int n,k
  cin>>n>>k;
  int a[n];
  int mn=1e9;
  for(int i = 0; i < n; ++i){
    cin>>a[i];
    mn=min(mn,a[i]);
  }
  int ans=0,cnt=0;
  for(int i=0;i<n;i++){
    if(a[i]==mn)ans+=ceil(cnt/(k+1)),cnt=0;
    else cnt++;
  }
  cout<<ans;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:6:3: error: expected initializer before 'cin'
    6 |   cin>>n>>k;
      |   ^~~
a.cc:15:32: error: 'k' was not declared in this scope
   15 |     if(a[i]==mn)ans+=ceil(cnt/(k+1)),cnt=0;
      |                                ^
a.cc:15:22: error: 'ceil' was not declared in this scope
   15 |     if(a[i]==mn)ans+=ceil(cnt/(k+1)),cnt=0;
      |                      ^~~~
Language: C++

#include <bits/stdc++.h>
#define REP(i, n) for(int i = 0; i < (n); i++)
#define REP1(i, n) for(int i = 1; i <= (n); i++)
#define REPD(i,a,b) for (int i=(a);i<(b);i++)
#define ALL(v) (v).begin(), (v).end()
using namespace std;
typedef long long ll;
typedef vector<string> vs;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef set<int> si;
typedef vector<ll> vll;
typedef vector<vll> vvll;
typedef pair<int, int> pi;
typedef queue<pi> qpi;
typedef pair<ll, ll> pll;
typedef queue<pll> qpll;
typedef vector<pi> vpi;
typedef vector<pll> vpll;
const int mod = 1000000007;
const int INF = 1001001001;
// 小数点　<< fixed << setprecision(0) <<
// sort降順　sort(ALL(),greater<int>());
// 円周率　M_PI
// 文字判定　isupper islower
// 順列　do {} while(next_permutation(ALL(X)));
// 最大値　LLONG_MAX
// a内でx以上　auto iter = lower_bound(ALL(a), x);
// a内でxより大きい　auto iter = upper_bound(ALL(a), x);
int dx[4] = {1, 0, -1, 0};
int dy[4] = {0, 1, 0, -1};
struct edge {
    int from; //出発点
    int to;   //到達点
    int cost; //移動コスト
};
typedef struct edge se;
typedef vector<edge> ve;
unsigned euclidean_gcd(unsigned a, unsigned b) {
  if(a < b) return euclidean_gcd(b, a);
  unsigned r;
  while ((r=a%b)) {
    a = b;
    b = r;
  }
  return b;
}
int check(int x,int y, vvi ch) {
  int flg = 1;
  REP(i,8) {
    if(ch[x][i]==1) {
      flg=0;
      break;
    }
    if(ch[i][y]==1)  {
      flg=0;
      break;
    }
    if(x+i<8&&y+i<8) {
      if(ch[x+i][y+i]==1)  {
      flg=0;
      break;
    }
    }
    if(x-i>=0&&y+i<8) {
      if(ch[x-i][y+i]==1)  {
      flg=0;
      break;
    }
    }
    if(x+i<8&&y-i>=0) {
      if(ch[x+i][y-i]==1)  {
      flg=0;
      break;
    }
    }
    if(x-i>=0&&y-i>=0) {
      if(ch[x-i][y-i]==1)  {
      flg=0;
      break;
    }
    }
  }
  return flg;
}

int solution(double t,double p) {
  double f=1.0-(1/1.5)*log(2)*p*pow(2,-t/1.5);
  if(f>=0) return 1;
  else if(f<0) return 0; 
}

int main() {
  int n,k;
  cin >> n >> k;
  ll ans=0;
  vi a(n);
  int c1;
  REP(i,n) {
    cin >> a[i];
    if(a[i]==1) ci=i; 
  }
  int l,r;
  l=ci;
  r=n-ci-1;
  k--;
  ans=(l+k-1)/k+(r+k-1)/k;
  cout << ans << endl;
  return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:101:17: error: 'ci' was not declared in this scope; did you mean 'i'?
  101 |     if(a[i]==1) ci=i;
      |                 ^~
      |                 i
a.cc:104:5: error: 'ci' was not declared in this scope; did you mean 'c1'?
  104 |   l=ci;
      |     ^~
      |     c1
a.cc: In function 'int solution(double, double)':
a.cc:91:1: warning: control reaches end of non-void function [-Wreturn-type]
   91 | }
      | ^
Language: C++

#include<iostream
#include<cmath>
using namespace std;
ing main(){int n,k;cin>>n>>k;cout<<1+ceil(double(n-k)/double(k-1));}

Compiler output:
a.cc:1:18: error: missing terminating > character
    1 | #include<iostream
      |                  ^
a.cc:4:1: error: 'ing' does not name a type; did you mean 'int'?
    4 | ing main(){int n,k;cin>>n>>k;cout<<1+ceil(double(n-k)/double(k-1));}
      | ^~~
      | int
Language: C++

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

int main(){
  int x,y;
  cin>>x>>y;
  if((x-1)%(y-1)==0){
  int z=(x-1)/(y-1);
  }
  else{
  int z=(x-1)/(y-1)+1;
  }
  cout<<z<<endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:13:9: error: 'z' was not declared in this scope
   13 |   cout<<z<<endl;
      |         ^
Language: C++

#define test(a) cout << "*" << a << endl;
int main(){
  int i,j;
  int numLong,numChoice;
  int a[100000];
  int aMin,aTmp;
  int count = 0;
  
  cin >> numLong >> numChoice; 
  rep0(i,numLong){ 
    cin >> a[i];
    //test(a[i]);
  }
  //aMax = a[0]; 
  rep0(i,numLong){
    for(j=0;j<numLong-i-1;j++){
      if(a[j] > a[j+1]){
        aTmp = a[j+1];
        a[j+1] = a[j];
        a[j] = aTmp;
      }
    }
  }
  //rep0(i,numLong)
    //test(a[i]);
  //rep0(i,numLong){
  /*aMin = a[0];
  i=1;
  while(i<numLong){
    if(a[i] != aMin){
      rep0(j,numChoice){
        a[(i-1)+j] = aMin;
      }
      count++;
    }
    i = i + numChoice -1;  
  }*/
  //}
  //cout << count << endl;
  //test(count);
  //test(numLong);
  //test(numChoice);

}

Compiler output:
a.cc: In function 'int main()':
a.cc:9:3: error: 'cin' was not declared in this scope
    9 |   cin >> numLong >> numChoice;
      |   ^~~
a.cc:10:3: error: 'rep0' was not declared in this scope
   10 |   rep0(i,numLong){
      |   ^~~~
Language: C++

#include <algorithm>
#include <iostream>
#include <math.h>
#include <stdio.h>
#include <string>
#include <sstream>
#include <vector>
#include <set>
#include <map>
#include <cmath>
#include <queue>
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
using namespace std;


int main()
{
	double n,k;
	cin>>n>>k;
	double *A = new double[n];
	unsigned long long int sum = 0;
	int minNum = 1e7;
	int minIndex = -1;
	for(int i = 0; i < n; i++){
		int num;
		cin>>num;
		if( num < minNum){
			minNum = num;
			minIndex = i;
		}
	}
	minIndex += 1;
	cout<<ceil( (minIndex-1)/(k-1)) + ceil( (n - minIndex)/(k-1))<<endl;
	return 0;
}



Compiler output:
a.cc: In function 'int main()':
a.cc:20:32: error: expression in new-declarator must have integral or enumeration type
   20 |         double *A = new double[n];
      |                                ^
Language: C++

#include "bits/stdc++.h"
#define int long long
#define FOR(i, a, b) for (int i = (int)(a); i < (int)(b); i++)
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define ALL(obj) begin(obj), end(obj)
#define MAX(x) *max_element(ALL(x))
#define MIN(x) *min_element(ALL(x))
#define LOWER_BOUND(A, key) distance(A.begin(), lower_bound(ALL(A), key))
#define UPPER_BOUND(A, key) distance(A.begin(), upper_bound(ALL(A), key))

using namespace std;
using ll      = long long;
const int MOD = (int)(1e9 + 7);
const int INF = (int)(1e13 + 7);

int bpm(int x, int y) {
  if (x == 0)
    return 0;
  else if (y == 0) {
    return 1;
  }
  int ans = 1;
  x %= MOD;
  int digit = (int)((log((double)y) / log((double)2) / 1 + 1));
  for (int i = 0; i < digit; i++) {
    if (((y >> i) & 1u) == 1) {
      ans *= x;
      ans %= MOD;
    }
    x = x * x;
    x %= MOD;
  }
  return ans;
}

class CMinimization {
public:
  int solve(std::istream &cin, std::ostream &cout) {
    int N, K;
    cin >> N >> K;
    vector<int> A(N);
    rep(i, N) {
      cin >> A[i];
    }
    int mini = MIN(A);
    int ans  = 0;
    int num  = 0;
    rep(i, N) {
      if (A[i] != mini) {
        num += 1;
      } else {
        if (num >= 1){
          ans += ceil((double)(num) / (double)(K - 1));
          if (num % (K - 1) != 0) {
            num = min(0LL, -((K - 1) - ((num % (K - 1)) + 1)));
          } else {
            num = 0;
          }
        }
      }
    }
    if (A[N - 1] != mini) {
      ans += ceil((double)(num) / (double)(K - 1));
    }
    cout << ans << endl;
  }
};


Compiler output:
a.cc: In member function 'long long int CMinimization::solve(std::istream&, std::ostream&)':
a.cc:66:3: warning: no return statement in function returning non-void [-Wreturn-type]
   66 |   }
      |   ^
/usr/bin/ld: /usr/lib/gcc/x86_64-linux-gnu/14/../../../x86_64-linux-gnu/Scrt1.o: in function `_start':
(.text+0x17): undefined reference to `main'
collect2: error: ld returned 1 exit status
Language: C++

#include<bits/stdc++.h>
#define all(x) (x).begin(),(x).end()
#define rep(i,n) for(ll i=0;i<(ll)(n);i++)
using namespace std;
typedef long long ll;
ll gcd(ll a,ll b){return b!=0?gcd(b,a%b):a;}
ll lcm(ll a,ll b){return a*b/gcd(a,b);}

int main(){
    ll n,k
    cin>>n>>k;
    vector<ll> a(n);
    ll mni=0;
    rep(i,n){
        cin>>a[i];
        if(a[i]==1) mni=i;
    }
    cout<<(mni+k-1)/k+(n-mni-1+k-1)/k<<endl;
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:11:5: error: expected initializer before 'cin'
   11 |     cin>>n>>k;
      |     ^~~
a.cc:18:16: error: 'k' was not declared in this scope
   18 |     cout<<(mni+k-1)/k+(n-mni-1+k-1)/k<<endl;
      |                ^
Language: C++

#include<bits/stdc++.h>
using namespace std;
#define ll long long int
#define set_bits(a) __builtin_popcount(a)
#define pb push_back
#define pf push_front
#define mod 1000000007
#define M 998244353
#define fi first
#define se second
#define endl '\n'
#define INF 1e18
#define fast ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);

int main()
{
     ll n,k;
     cin>>n>>k;
     ll arr[n];
     for(i=0;i<n;i++)
     {
         cin>>arr[i];
     }
     ll ans = n-k+1;
     cout<<ans<<endl;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:20:10: error: 'i' was not declared in this scope
   20 |      for(i=0;i<n;i++)
      |          ^
Language: C++

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

int main () {
  int n, k;
  int a[100009];
  cin >> n >> k;
  for (int i = 0; i < n; ++i) cin >> a[i];
  
  if (k == n) {
    cout << 1;
  } else if {
    cout << n / (k-1) + 1;
  }
}

Compiler output:
a.cc: In function 'int main()':
a.cc:12:13: error: expected '(' before '{' token
   12 |   } else if {
      |             ^
      |             (
Language: C++

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

using namespace std;
typedef long long ll;

int main() {
    std::ios::sync_with_stdio(0); cin.tie(0);


    ll ans=0;
    ll anss =0;
    ll count=0;
    ll i,j;
  
    long double x;
    vector<ll> aa;

    ll Q,N,K;
    long double a, b;
    string S;
    cin >> N >>K;
    ll flag=0;
    ll t1=0;
    ll t2=0;
  	ll sum=0;
    ll dig;
    ll Q1=Q;

    for(i=0;i<N;i++){
        cin>>Q;
        aa.push_back(Q);
        if(Q==1){
            flag=i;
        }
    }
    
    ans=((N-1)/(K-1));

    if((N-1)%(K-1)!=0) ans++;

    cout << ans << endl;
    

Compiler output:
a.cc: In function 'int main()':
a.cc:57:25: error: expected '}' at end of input
   57 |     cout << ans << endl;
      |                         ^
a.cc:22:12: note: to match this '{'
   22 | int main() {
      |            ^
Language: C++

#include <iostream>
#include <vector>

using namespace std;


void minimization()
{
  int n, k;
  cin >> n >> k;

  cout << ceil((float)(n - 1) / (float)(k - 1)) << "\n";
}


int main()
{
  minimization();
}


Compiler output:
a.cc: In function 'void minimization()':
a.cc:12:11: error: 'ceil' was not declared in this scope
   12 |   cout << ceil((float)(n - 1) / (float)(k - 1)) << "\n";
      |           ^~~~
Language: C++

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

int n, k;

int main() {
    cin >> n >> k;
    for(int i = 1; i <= n; ++i) cin >> a[i];
    int pos = min_element(a + 1, a + n + 1) - a;
    cout << (n - 1 + k - 2) / (k - 1);
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:10:40: error: 'a' was not declared in this scope
   10 |     for(int i = 1; i <= n; ++i) cin >> a[i];
      |                                        ^
a.cc:11:27: error: 'a' was not declared in this scope
   11 |     int pos = min_element(a + 1, a + n + 1) - a;
      |                           ^
Language: C++

#include <iostream>
#include <vector>
#include <queue>
#include <set>
#include <cmath>
#include <stack>
#include <string>
#include <deque>
#include <map>
#include <algorithm>

using namespace std;
//--------------------
int gcd(int a, int b) {
    return b == 0 ? a : gcd(b, a % b);
}

//------------
void func() {
    int N, K,oneIndex;
    cin >> N >> K;
    int arr[N];
    for (int i = 0; i < N; ++i) {
        cin >> arr[i];
        if (arr[i] == 1 ) {
            oneIndex = i;
        }
    }
    int left = max(0,oneIndex + 1 - K);
    int ans = INT_MAX;
    int delta = K - 1;
    for (int j = left; j <= oneIndex; ++j) {
        int right = N - 1 - min(N - 1,K + left - 1);
        int current = (left % delta == 0 ? (left / delta)  : (left / delta + 1)) + (right % delta == 0 ? (right / delta) : (right / delta + 1)) + 1;
        //cout << "left = " << j << "   right = " << min(N - 1,K + left - 1) << "   current = " << current  << endl;
        ans = min(current,ans);
    }
    cout << ans << endl;
}

int main() {
    func();
    return 0;
}

Compiler output:
a.cc: In function 'void func()':
a.cc:30:15: error: 'INT_MAX' was not declared in this scope
   30 |     int ans = INT_MAX;
      |               ^~~~~~~
a.cc:11:1: note: 'INT_MAX' is defined in header '<climits>'; this is probably fixable by adding '#include <climits>'
   10 | #include <algorithm>
  +++ |+#include <climits>
   11 |
Language: C++

#include <iostream>
using namespace std;
void func() {
    int N, K,oneIndex;
    cin >> N >> K;
    int arr[N];
    for (int i = 0; i < N; ++i) {
        cin >> arr[i];
        if (arr[i] == 1 ) {
            oneIndex = i;
        }
    }
    int left = max(0,oneIndex + 1 - K);
    int ans = INT_MAX;
    int delta = K - 1;
    for (int j = left; j <= oneIndex; ++j) {
        int right = N - 1 - min(N - 1,K + left - 1);
        int current = (left % delta == 0 ? (left / delta)  : (left / delta + 1)) + (right % delta == 0 ? (right / delta) : (right / delta + 1)) + 1;
        //cout << "left = " << j << "   right = " << min(N - 1,K + left - 1) << "   current = " << current  << endl;
        ans = min(current,ans);
    }
    cout << ans << endl;
}

int main() {
    func();
    return 0;
}

Compiler output:
a.cc: In function 'void func()':
a.cc:14:15: error: 'INT_MAX' was not declared in this scope
   14 |     int ans = INT_MAX;
      |               ^~~~~~~
a.cc:2:1: note: 'INT_MAX' is defined in header '<climits>'; this is probably fixable by adding '#include <climits>'
    1 | #include <iostream>
  +++ |+#include <climits>
    2 | using namespace std;
Language: C++

#include<bots/stdc++.h>
using namespace std;
int main() {
  int n, k; cin >> n >> k;
  n--;
  k--;
  cout << (n+k-1) / k << endl;
}

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

#include <iostream>
using namespace std;
int n, k;
int main() {
	cin >> n >> k;
	k--, n--;
	cout << ceil(1.0 * n / k) << endl;
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:7:17: error: 'ceil' was not declared in this scope
    7 |         cout << ceil(1.0 * n / k) << endl;
      |                 ^~~~