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

#include <iostream>
using namespace std;

void QuickSort(int array[], int begin, int end) {
  int i = begin;
  int j = end;
  int pivot;
  int temp;
  
  pivot = array[ ( begin + end ) / 2 ];
  
  while(1) {
    while( array[i] < pivot ){ ++i; }
    while( array[j] > pivot ){ --j; }
    if (i >= j) break;
    
    temp = array[i];
    array[i] = array[j];
    array[j] = temp;
    i++;
    j--;
  }
  if( begin < i - 1 ){ QuickSort( array, begin, i - 1 ); }
  if( j + 1 < end ){ QuickSort( array, j + 1, end ); }
}

int S(int num) {
  int dig, sum = 0;
  
  while (num) {
    dig = num % 10;
    sum += dig;
    num /= 10;
  }
  
  return sum;
}

int SunukeCheck(n, m) {
  return (n / S(n) <= m / S(m) ? 1 : 0);
}

int main() {
  int n = 1, m = 2, sun, num, cnt = 0;
  cin >> num;
  
  while (cnt < num) {
    if (sun = SunukeCheck(n++, m++)) {
      cnt++;
      cout << sun << endl;
    }
  }
  
  return 0;
}


Compiler output:
a.cc:39:17: error: 'n' was not declared in this scope
   39 | int SunukeCheck(n, m) {
      |                 ^
a.cc:39:20: error: 'm' was not declared in this scope; did you mean 'tm'?
   39 | int SunukeCheck(n, m) {
      |                    ^
      |                    tm
a.cc:39:21: error: expression list treated as compound expression in initializer [-fpermissive]
   39 | int SunukeCheck(n, m) {
      |                     ^
a.cc: In function 'int main()':
a.cc:48:26: error: 'SunukeCheck' cannot be used as a function
   48 |     if (sun = SunukeCheck(n++, m++)) {
      |               ~~~~~~~~~~~^~~~~~~~~~
Language: C

#include<stdio.h>
#include<math.h>
#include<stdlib.h>

double digsum(int n){
  int array[30],i;
  double sum=0;
  for(i=29;i>=0;i--){
    array[i] = n / (int)pow(10,i);
    n = n % (int)pow(10,i);
    sum += (double)array[i];
  }
  return sum;
}

int main(){
  int K,count=0;
  int flag=1;
  double i,j;
  int *array;
  i = 2;
  scanf("%d",&K);
  array = (int *)malloc(sizeof(int)*K);
  while(count<K){
    for(j=1;j<i;j++){
      if((j / digsum(j))>=(i / digsum(i))) flag = 0;
    }
    if(flag==1){
      array[count] = i;
      count++;
    }
    i++;
  }
  for(i=0;i<K;i++) printf("%d\n",array[i]);
  free(array);
  return 0;
}

Compiler output:
main.c: In function 'main':
main.c:34:39: error: array subscript is not an integer
   34 |   for(i=0;i<K;i++) printf("%d\n",array[i]);
      |                                       ^
Language: C++

#include <bits/stdc++.h>
using namespace std;
int main()
{
    long long k,a=1;cin>>k;
    for(int i=0;i<k;i++){
        for(int j=0;j<i;j++) a*=10;
      cout<<(i+2)*a-1<<endl;
}

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

int main() {
	int K;
	cin >> K;
	cout << K << endl;


		return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:3:9: error: 'cin' was not declared in this scope
    3 |         cin >> K;
      |         ^~~
a.cc:4:9: error: 'cout' was not declared in this scope
    4 |         cout << K << endl;
      |         ^~~~
a.cc:4:22: error: 'endl' was not declared in this scope
    4 |         cout << K << endl;
      |                      ^~~~
Language: C++

//
//  supercon.cpp
//
//
//  Created by Fourier Shuzaei on 2018/06/02.
//

#include "bits/stdc++.h"
using namespace std;
#define ri(a,b,c) for(int a=(b);a<(c);++a)
#define ll long long
#define rll(a,b,c) for(ll a=(b);a<(c);++a)

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

    ll a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z;
    cin>>k;
  if(k<10)
    rll(i,1,k+1)cout<<i<<"\n";
  else{
    rll(i,1,10)cout<<i<<"\n";
    rll(i,2,k-7){
        cout<<(i*10-1)<<"\n";
    }















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


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

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

long long k,countn=0,now=1,index=0;

int main(){
  int i,j;

  cin >> k;

  while(k>countn){
    for(i=1;i<=9;i++){
      cout << i*now+index << endl;
      countn++;
      if(k==countn)break;
    }
    now*=10;
    index*=10;
    index+=9;
  }

  return 0;
}


Compiler output:
a.cc:4:28: error: 'long long int index' redeclared as different kind of entity
    4 | long long k,countn=0,now=1,index=0;
      |                            ^~~~~
In file included from /usr/include/string.h:462,
                 from /usr/include/c++/14/cstring:43,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:121,
                 from a.cc:1:
/usr/include/strings.h:50:20: note: previous declaration 'const char* index(const char*, int)'
   50 | extern const char *index (const char *__s, int __c)
      |                    ^~~~~
a.cc: In function 'int main()':
a.cc:13:20: error: invalid operands of types 'long long int' and '<unresolved overloaded function type>' to binary 'operator+'
   13 |       cout << i*now+index << endl;
      |               ~~~~~^~~~~~
a.cc:18:12: error: overloaded function with no contextual type information
   18 |     index*=10;
      |            ^~
a.cc:19:12: error: overloaded function with no contextual type information
   19 |     index+=9;
      |            ^
Language: C++

#include <bits/stdc++.h>
using namespace std;
int main()
{
    long long k;cin>>k;
    for(int i=0;i<min(9,k);i++){
        cout<<i+1<<endl;
    }
    for(int i=0;i<k-9;i++){
        cout<<i*10+19<<endl;
    }
}

Compiler output:
a.cc: In function 'int main()':
a.cc:6:22: error: no matching function for call to 'min(int, long long int&)'
    6 |     for(int i=0;i<min(9,k);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:6:22: note:   deduced conflicting types for parameter 'const _Tp' ('int' and 'long long int')
    6 |     for(int i=0;i<min(9,k);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:6:22: note:   mismatched types 'std::initializer_list<_Tp>' and 'int'
    6 |     for(int i=0;i<min(9,k);i++){
      |                   ~~~^~~~~
Language: C++

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

int divide(int n, int k){
  int ans=0;
  if(n%k==0) ans=k/n;
  else ans=(k/n)+1;
  
  return ans;
}

int main(){
  int N, K;
  cin >> N >> K;
  vector<int> A(N+1);
  int min=1;
  for(int i=1; i<=N; i++){
    cin >> A[i];
    if(A[i]==1) min=i;
  }
  
  int ans=0;
  ans += divide(min-1, k-1) + divide(N-min, k-1);
  
  cout << ans << endl;
  
  return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:24:24: error: 'k' was not declared in this scope
   24 |   ans += divide(min-1, k-1) + divide(N-min, k-1);
      |                        ^
Language: C++

#include<bits/stdc++.h>
using namespace std;
#ifndef ONLINE_JUDGE
#define dbg(x...) do{cout << "\033[32;1m" << #x << "->" ; err(x);} while(0)
void err(){cout << "\033[39;0m" << endl;}
template<template<typename...> class T,typename t,typename... A>
void err(T<t> a,A... x){for (auto v:a) cout << v << ' '; err(x...);}
template<typename T,typename... A>
void err(T a,A... x){cout << a << ' '; err(x...);}
#else
#define dbg(...)
#endif
typedef long long ll;
typedef pair<int,int> pi;
typedef vector<int> vi;
template<class T> using vc=vector<T>;
template<class T> using vvc=vc<vc<T>>;
template<class T> void mkuni(vector<T>&v)
{
    sort(v.begin(),v.end());
    v.erase(unique(v.begin(),v.end()),v.end());
}
template<class T>
void print(T x,int suc=1)
{
    cout<<x;
    if(suc==1) cout<<'\n';
    else cout<<' ';
}
template<class T>
void print(const vector<T>&v,int suc=1)
{
    for(int i=0;i<v.size();i++)
        print(v[i],i==(int)(v.size())-1?suc:2);
}
const int INF=0x3f3f3f3f;
const int maxn=1e5+7;
const int mod=1e9+7;


int a[maxn];
int main()
{
	int n,k,id;
	cin>>n>>k;
	//kp-p>=n
	//int ans=n/(k-1);
	int ans=0;
	for(int i=1;i<=n;++i) cin>>a[i],if(a[i]==1) id=i;
	ans=(id-1)/(k-1)+(n-id+1)/(k-1);
	print(ans);
}


Compiler output:
a.cc: In function 'int main()':
a.cc:49:41: error: expected primary-expression before 'if'
   49 |         for(int i=1;i<=n;++i) cin>>a[i],if(a[i]==1) id=i;
      |                                         ^~
Language: C

n, k =map(int, input().split())
a = list(map(int, input().split()))

ans = int((n-1)/(k-1))

if ((n-1) % (k-1)) == 0:
    print(ans)
else:
    print(ans+1)

Compiler output:
main.c:1:1: warning: data definition has no type or storage class
    1 | n, k =map(int, input().split())
      | ^
main.c:1:1: error: type defaults to 'int' in declaration of 'n' [-Wimplicit-int]
main.c:1:4: error: type defaults to 'int' in declaration of 'k' [-Wimplicit-int]
    1 | n, k =map(int, input().split())
      |    ^
main.c:1:7: error: implicit declaration of function 'map' [-Wimplicit-function-declaration]
    1 | n, k =map(int, input().split())
      |       ^~~
main.c:1:11: error: expected expression before 'int'
    1 | n, k =map(int, input().split())
      |           ^~~
main.c:2:1: error: expected ',' or ';' before 'a'
    2 | a = list(map(int, input().split()))
      | ^
Language: C++

#include<bits/stdc++.h>
using namespace std;
signed main()
{
	ios::sync_with_stdio(0);
    cin.tie(0);
	int n,m;
	cin>>n>>m;
	V<int>a(n);
	REP(i,0,n)cin>>a[i];
	cout<<(n-m)/(m-1)+((n-m)%(m-1)? 2:1);
    return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:9:9: error: 'V' was not declared in this scope
    9 |         V<int>a(n);
      |         ^
a.cc:9:11: error: expected primary-expression before 'int'
    9 |         V<int>a(n);
      |           ^~~
a.cc:10:13: error: 'i' was not declared in this scope
   10 |         REP(i,0,n)cin>>a[i];
      |             ^
a.cc:10:9: error: 'REP' was not declared in this scope
   10 |         REP(i,0,n)cin>>a[i];
      |         ^~~
Language: C++

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

int main() {
	int n, k;
	cin >> n >> k;
	if(((n-1) % (k-1)==0)cout << (n - 1) / (k - 1) ;
       else cout << (n - 1) / ( k - 1 ) + 1;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:10:30: error: expected ';' before 'cout'
   10 |         if(((n-1) % (k-1)==0)cout << (n - 1) / (k - 1) ;
      |                              ^~~~
      |                              ;
a.cc:11:8: error: expected primary-expression before 'else'
   11 |        else cout << (n - 1) / ( k - 1 ) + 1;
      |        ^~~~
a.cc:10:57: error: expected ')' before 'else'
   10 |         if(((n-1) % (k-1)==0)cout << (n - 1) / (k - 1) ;
      |           ~                                             ^
      |                                                         )
   11 |        else cout << (n - 1) / ( k - 1 ) + 1;
      |        ~~~~
Language: C++

#include<iostream>
#include<vector>
#include <cmath>
#include <map>
#include <set>
#include <algorithm>
#include <string>
#define rep(i,n) for (int i= 0;i<(n);++i)
using namespace std;
typedef long long ll;
const ll maxSum = 50*50+1;
int main() {
   cin>>N>>Y;
  N-=Y;
  int ans =N/(Y-1)+1;
  if(N%(Y-1)!=0)ans++;
  cout<<ans;
   return 0;
}

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

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

int main(){
	int n,k;
	cin>>n>>k;
	deque<int>dk;
	
	while(n--){
		int temp;
		cin>>temp;
		dk.push_back(temp);	
	}
	int counter = 0;
	while(dk.size()){
		counter++;
		for(int i=0; i<k; && dk.size(); i++) dk.pop_front();
		if(dk.size()) dk.push_back(1);
	}
	cout<<counter;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:19:40: error: expected ')' before '.' token
   19 |                 for(int i=0; i<k; && dk.size(); i++) dk.pop_front();
      |                    ~                   ^
      |                                        )
a.cc:19:40: error: expected primary-expression before '.' token
a.cc:19:49: error: 'i' was not declared in this scope
   19 |                 for(int i=0; i<k; && dk.size(); i++) dk.pop_front();
      |                                                 ^
a.cc:19:38: error: label 'dk' used but not defined
   19 |                 for(int i=0; i<k; && dk.size(); i++) dk.pop_front();
      |                                      ^~
Language: C++

#include<iostream>
using namespace std;
int main()
{
  int n,k;cin>>n>>k;
  for(int i=0;i<n;i++){
    int a,cin>>a;
  }
  n--,k--;
  int res=n/k;
  if(n%k!=0)res++;
  cout<<res;
  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:7:14: error: expected initializer before '>>' token
    7 |     int a,cin>>a;
      |              ^~
Language: C++

#include <bits/stdc++.h>

using namespace std;

void solve(long N, long K, vector<long> A) {
  cout << ceil(float(N - 1) / (K - 1)) << endl;
}

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

  long N, K;
  cin >> N >> K;

  vector<long> A(N);
  REP(i, N)
    cin >> A[i];

  solve(N, K, move(A));

  return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:17:7: error: 'i' was not declared in this scope
   17 |   REP(i, N)
      |       ^
a.cc:17:3: error: 'REP' was not declared in this scope
   17 |   REP(i, N)
      |   ^~~
Language: Java

import java.util.*;

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

Compiler output:
Main.java:39: error: break outside switch or loop
        if(p == (n - 1)) break;
                         ^
1 error
Language: C

#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include <string.h>

int main()
{
	int N=0,K=0,count=0;
	int S[100000];

	scanf("%d %d",&N,&K);


	while(N-1>=K-1){
		(N-1) -=(K-1);
		count++;
	}

	if(N==0){
		printf("%d", count);
	}


	else{
		printf("%d",count+1);
	}

	return 0;
}


Compiler output:
main.c: In function 'main':
main.c:15:23: error: lvalue required as left operand of assignment
   15 |                 (N-1) -=(K-1);
      |                       ^~
Language: C

#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include <string.h>

int main()
{
	int N=0,K=0,count=0;
	int S[100000];

	scanf("%d %d",&N,&K);


	while(N-1>=K-1){
		N-1 -=(K-1);
		count++;
	}

	if(N==0){
		printf("%d", count);
	}


	else{
		printf("%d",count+1);
	}

	return 0;
}


Compiler output:
main.c: In function 'main':
main.c:15:21: error: lvalue required as left operand of assignment
   15 |                 N-1 -=(K-1);
      |                     ^~
Language: C

#include<stdio.h>
int main(){
int n,m;
scanf("%d %d",&n,&m);
for(i=0;i<n;i++)scanf("%*d");
printf("%d\n",(n-2)/(m-1)+1);
return 0;
}

Compiler output:
main.c: In function 'main':
main.c:5:5: error: 'i' undeclared (first use in this function)
    5 | for(i=0;i<n;i++)scanf("%*d");
      |     ^
main.c:5:5: note: each undeclared identifier is reported only once for each function it appears in
Language: C++

N,K = map(int,input().split())
A = list(map(int,input().split()))

B = A.index(1)

def left(n):
  if B == 0:
    return 0
  else:
    return B//K+1

def right(n):
  if N-B==0:
    return 0
  else:
    return (N-B)//K+1

if N==K:
  print(1)
else:
  print(left(N)+right(N))

Compiler output:
a.cc:1:1: error: 'N' does not name a type
    1 | N,K = map(int,input().split())
      | ^
Language: C++

using namespace std;

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


Compiler output:
a.cc: In function 'int main()':
a.cc:4:12: error: 'cin' was not declared in this scope
    4 |   int n,k; cin >> n >> k;
      |            ^~~
a.cc:1:1: note: 'std::cin' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
  +++ |+#include <iostream>
    1 | using namespace std;
a.cc:5:3: error: 'cout' was not declared in this scope
    5 |   cout << (n+k-3)/(k-1) << endl;
      |   ^~~~
a.cc:5:3: note: 'std::cout' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
a.cc:5:28: error: 'endl' was not declared in this scope
    5 |   cout << (n+k-3)/(k-1) << endl;
      |                            ^~~~
a.cc:1:1: note: 'std::endl' is defined in header '<ostream>'; this is probably fixable by adding '#include <ostream>'
  +++ |+#include <ostream>
    1 | using namespace std;
Language: C++

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

int main(){
    int n,k;
    cin>>n>>k;
    int j;
    for(int i=0;i<n;i++){
        int x;
        cint>>x;
        if(x==1){
            j=i;
            break;
        }
    }
    int x,y;
    x=(j+1)/2;
    y=(n-j)/2;
    cout<<x+y<<endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:10:9: error: 'cint' was not declared in this scope; did you mean 'uint'?
   10 |         cint>>x;
      |         ^~~~
      |         uint
Language: C++

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

int main() {
  int n,k;
  cin>>n>>k;
  k--;
  vector<int>s(n);
  for(int i=0;i<n;i++) cin>>s[i];
  int left=0;
  for(int i=0;i<n;i++){
    if(s[i]==1) break;
    left++;
  }
  right=n-1-left;
  int ans=0;
  if(left%k==0) ans+=left/k;
  else ans+=left/k+1;
  if(right%k==0) ans+=right/k;
  else ans+=right/k+1;
  cout<<ans<<endl;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:15:8: error: assignment of function 'std::ios_base& std::right(ios_base&)'
   15 |   right=n-1-left;
      |   ~~~~~^~~~~~~~~
a.cc:19:11: error: invalid operands of types 'std::ios_base&(std::ios_base&)' and 'int' to binary 'operator%'
   19 |   if(right%k==0) ans+=right/k;
      |      ~~~~~^~
      |      |     |
      |      |     int
      |      std::ios_base&(std::ios_base&)
a.cc:19:28: error: invalid operands of types 'std::ios_base&(std::ios_base&)' and 'int' to binary 'operator/'
   19 |   if(right%k==0) ans+=right/k;
      |                       ~~~~~^~
      |                       |     |
      |                       |     int
      |                       std::ios_base&(std::ios_base&)
a.cc:20:18: error: invalid operands of types 'std::ios_base&(std::ios_base&)' and 'int' to binary 'operator/'
   20 |   else ans+=right/k+1;
      |             ~~~~~^~
      |             |     |
      |             |     int
      |             std::ios_base&(std::ios_base&)
Language: C++

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

int main() {
  int n,k;
  cin>>n>>k;
  k--;
  vector<int>a(n);
  for(int i=0;i<n;i++) cin>>a[i];
  int left=0;
  for(int i=0;i<n;i++){
    if(s[i]==1) break;
    left++;
  }
  right=n-1-left;
  int ans=0;
  if(left%k==0) ans+=left/k;
  else ans+=left/k+1;
  if(right%k==0) ans+=right/k;
  else ans+=right/k+1;
  cout<<ans<<endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:12:8: error: 's' was not declared in this scope
   12 |     if(s[i]==1) break;
      |        ^
a.cc:15:8: error: assignment of function 'std::ios_base& std::right(ios_base&)'
   15 |   right=n-1-left;
      |   ~~~~~^~~~~~~~~
a.cc:19:11: error: invalid operands of types 'std::ios_base&(std::ios_base&)' and 'int' to binary 'operator%'
   19 |   if(right%k==0) ans+=right/k;
      |      ~~~~~^~
      |      |     |
      |      |     int
      |      std::ios_base&(std::ios_base&)
a.cc:19:28: error: invalid operands of types 'std::ios_base&(std::ios_base&)' and 'int' to binary 'operator/'
   19 |   if(right%k==0) ans+=right/k;
      |                       ~~~~~^~
      |                       |     |
      |                       |     int
      |                       std::ios_base&(std::ios_base&)
a.cc:20:18: error: invalid operands of types 'std::ios_base&(std::ios_base&)' and 'int' to binary 'operator/'
   20 |   else ans+=right/k+1;
      |             ~~~~~^~
      |             |     |
      |             |     int
      |             std::ios_base&(std::ios_base&)
Language: C++

# frozen_string_literal: true

n, k = gets.split.map(&:to_i)
a = gets.split.map(&:to_i)
cnt = 1

cnt += (a.length - 3) / (k - 1)
cnt += 1 if (a.length - 3) % (k - 1) != 0
puts cnt


Compiler output:
a.cc:1:3: error: invalid preprocessing directive #frozen_string_literal
    1 | # frozen_string_literal: true
      |   ^~~~~~~~~~~~~~~~~~~~~
a.cc:3:1: error: 'n' does not name a type
    3 | n, k = gets.split.map(&:to_i)
      | ^
Language: C++

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

int k;

int main() {
c

Compiler output:
a.cc: In function 'int main()':
a.cc:7:1: error: 'c' was not declared in this scope
    7 | c
      | ^
a.cc:7:2: error: expected '}' at end of input
    7 | c
      |  ^
a.cc:6:12: note: to match this '{'
    6 | int main() {
      |            ^
Language: C++

#include<iostream>
#include<algorithm>
#include<vector>
#include<string>
#include<utility>
#include<map>
#include<set>
#include<queue>
#include<stack>
#include<functional>
#include<math.h>
using namespace std;
#define N (1000000000+7)
#define M (998244353)
#define INF 1e16
typedef long long ll;
typedef pair<int,int> P;
 

int  A(int x){
    if(x>=0)return x;
    else return -x;
}

ll inv(ll x) {
	ll res = 1;
	ll k = N - 2;
	ll y = x%N;
	while (k) {
		if (k & 1)res = (res*y) % N;
		y = (y%N)*(y%N) % N;
		k /= 2;
	}
	return res;
}

unsigned long long popCount64bitB(unsigned long long x) 
{ 
    x = ((x & 0xaaaaaaaaaaaaaaaaUL) >> 1) 
      +  (x & 0x5555555555555555UL); 
    x = ((x & 0xccccccccccccccccUL) >> 2) 
      +  (x & 0x3333333333333333UL); 
    x = ((x & 0xf0f0f0f0f0f0f0f0UL) >> 4) 
      +  (x & 0x0f0f0f0f0f0f0f0fUL); 
    x = ((x & 0xff00ff00ff00ff00UL) >> 8) 
      +  (x & 0x00ff00ff00ff00ffUL); 
    x = ((x & 0xffff0000ffff0000UL) >> 16) 
      +  (x & 0x0000ffff0000ffffUL); 
    x = ((x & 0xffffffff00000000UL) >> 32) 
      +  (x & 0x00000000ffffffffUL); 
    return x; 
} 

bool g[13][13];

int main(void){
    int n,k;
    cin>>n>>k;
    int index = 1;
    for(int i=0;i<n;i++){
        int a;
        cin>>a;
        if(a==1){
            index = i+1;
        }
    }
    int ans = 0;
    int length = 0
    while(true){
        ans++;
        length+=k;
        if(length>=n)break;
        else length--;
    }
    cout<<ans<<endl;
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:69:5: error: expected ',' or ';' before 'while'
   69 |     while(true){
      |     ^~~~~
Language: C++

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

int main() {
  long long N,K;
  cin >> N >> K;
  vector<long long> a(N);
  for(long long i=0;i<N;i++){
    cin >> a.at(i);
  }
  int m;
   for(long long i=0;i<N;i++){
    if(a.at(i)==1){
    m=i;
    break;
    }
  }
    cout << (m+1)/(K-1)+(N-m)/(k-1) << endl;
  
}

Compiler output:
a.cc: In function 'int main()':
a.cc:18:32: error: 'k' was not declared in this scope
   18 |     cout << (m+1)/(K-1)+(N-m)/(k-1) << endl;
      |                                ^
Language: C++

#include<bits/stdc++.h>
using namespace std;
signed main(){
  int a,b,c[1000000],d;
  int l=0,r=0;
  cin>>a>>b;
  for(int i=0;i<b;i++){
    cin>>c[i];
    if(c[i]==1) d=i+1;
  }
  if((d)%b!=0) l++;
  l+=db;
  if((a-d)%b!=0) r++;
  r+=(a-d+1)/b;
  cout<<l+r<<"\n";
}

Compiler output:
a.cc: In function 'int main()':
a.cc:12:6: error: 'db' was not declared in this scope; did you mean 'd'?
   12 |   l+=db;
      |      ^~
      |      d
Language: C++

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

int main(){
    int n,k;
    cin >> n >> k;
    cout << (n-1)/(k-1) << endl:
}

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

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

int main(){
  int N,K,m=100000,index=0;
  vector<int> A(N);
  for(int i=0;i<N;i++) cin >> A[i];
  int res=0,index=0;
  while(index<N){
    if(res=0) index+=K;
    else index += K-1;
    res++;
  }
  cout << res << endl;
}



Compiler output:
a.cc: In function 'int main()':
a.cc:8:13: error: redeclaration of 'int index'
    8 |   int res=0,index=0;
      |             ^~~~~
a.cc:5:20: note: 'int index' previously declared here
    5 |   int N,K,m=100000,index=0;
      |                    ^~~~~
Language: C++

#include <bits/stdc++.h>
#define _GLIBCXX_DEBUG
using namespace std;
using ll=long long;
using vec=vector<ll>;
using Graph = vector<vector<ll>>;
#define loop(i,n) for(ll i=0;i<n;i++)
#define Loop(i, m, n) for(ll i = m;i < n;i++)
#define pool(i,n) for(ll i=n-1;i>=0;i--)
#define Pool(i, m, n) for(ll i=n-1;i>=m;i--)
#define MAX 99999999999ll
#define MIN -99999999999ll
#define setbit bitset<8>
#define flagcount __builtin_popcount
#define flag(x) (1<<x)
#define flagadd(bit,x) bit|=flag(x)
#define flagpop(bit,x) bit&=~flag(x) 
#define flagon(bit,i) bit&flag(i)
#define flagoff(bit,i) !(bit & (1<<i))
#define all(v) v.begin(),v.end()
#define low2way(v,x) lower_bound(all(v),x)
#define high2way(v,x) upper_bound(all(v),x)
#define count2way(v,x) high2way(v,x)-low2way(v,x)
#define lower(v,x) low2way(v,x)-v.begin() //1番左が0、もし見つから無いならｎを出力
#define higher(v,x) high2way(v,x)-v.begin()-1 //1番左が0、もし見つからないならn-1を出力（注意）
#define putout(x) cout<<x<<endl
#define Gput(a,b) G[a].push_back(b)
ll ctoi(char c){
	if(c>='0'&&c<='9'){
		return c-'0';
	}
	return 0;
}
ll fact(ll x){
  ll y=1;
  for(ll i=1;i<=x;i++){
   y*=i;
   y%=1000000007;
  }
  return y;
}
int main() {
  ll n,k;
  cin>>n>>k;
  if(L%k==0) putout(n/k);
   else putout(n/k+1);
  
  
  
  
  
  
}


Compiler output:
a.cc: In function 'int main()':
a.cc:45:6: error: 'L' was not declared in this scope
   45 |   if(L%k==0) putout(n/k);
      |      ^
Language: C++

#include <bits/stdc++.h>
#define _GLIBCXX_DEBUG
using namespace std;
using ll=long long;
using vec=vector<ll>;
using Graph = vector<vector<ll>>;
#define loop(i,n) for(ll i=0;i<n;i++)
#define Loop(i, m, n) for(ll i = m;i < n;i++)
#define pool(i,n) for(ll i=n-1;i>=0;i--)
#define Pool(i, m, n) for(ll i=n-1;i>=m;i--)
#define MAX 99999999999ll
#define MIN -99999999999ll
#define setbit bitset<8>
#define flagcount __builtin_popcount
#define flag(x) (1<<x)
#define flagadd(bit,x) bit|=flag(x)
#define flagpop(bit,x) bit&=~flag(x) 
#define flagon(bit,i) bit&flag(i)
#define flagoff(bit,i) !(bit & (1<<i))
#define all(v) v.begin(),v.end()
#define low2way(v,x) lower_bound(all(v),x)
#define high2way(v,x) upper_bound(all(v),x)
#define count2way(v,x) high2way(v,x)-low2way(v,x)
#define lower(v,x) low2way(v,x)-v.begin() //1番左が0、もし見つから無いならｎを出力
#define higher(v,x) high2way(v,x)-v.begin()-1 //1番左が0、もし見つからないならn-1を出力（注意）
#define putout(x) cout<<x<<endl
#define Gput(a,b) G[a].push_back(b)
ll ctoi(char c){
	if(c>='0'&&c<='9'){
		return c-'0';
	}
	return 0;
}
ll fact(ll x){
  ll y=1;
  for(ll i=1;i<=x;i++){
   y*=i;
   y%=1000000007;
  }
  return y;
}
int main() {
  ll n,k;
  cin>>n>>k;
  vec a(n);
  ll memo;
  loop(i,n){
  cin>>a[i];
  if(a[i]==1)memo=i+1;
  }
  ll L=max(n-memo+1;,memo);
  if(L%k==0) putout(L/k);
   else putout(L/k+1);
  
  
  
  
  
  
}

Compiler output:
a.cc: In function 'int main()':
a.cc:51:20: error: expected ')' before ';' token
   51 |   ll L=max(n-memo+1;,memo);
      |           ~        ^
      |                    )
a.cc:51:21: error: expected primary-expression before ',' token
   51 |   ll L=max(n-memo+1;,memo);
      |                     ^
Language: C++

#include<bits/stdc++.h>
#define ll long long
#define dbg1(x) cerr<<#x<<"="<<(x)<<" "
#define dbg2(x) cerr<<#x<<"="<<(x)<<"\n"
#define dbg3(x) cerr<<#x<<"\n"
using namespace std;
#define reg register
inline int read()
{
	int x=0,f=1;char ch=getchar();
	while(ch<'0'||ch>'9'){if(ch=='-')f=-1;ch=getchar();}
	while(ch>='0'&&ch<='9'){x=(x<<3)+(x<<1)+ch-'0';ch=getchar();}
	return x*f;
}
int MN=1e5+5;
int N,K,A[MN];
int main()
{
	N=read(),K=read();
	reg int i;
	for(i=1;i<=N;++i) A[i]=read();
	printf("%d\n",(N-2)/2+1);
}

Compiler output:
a.cc:16:11: error: size of array 'A' is not an integral constant-expression
   16 | int N,K,A[MN];
      |           ^~
a.cc: In function 'int main()':
a.cc:20:17: warning: ISO C++17 does not allow 'register' storage class specifier [-Wregister]
   20 |         reg int i;
      |                 ^
Language: C++

#include <bits/stdc++.h>
using namespace std;
int main(){
  int64_t N,K;
  cin>>N>>K;
  vector<int64_t> a(N);
  for(int i=0;i<N;i++){
    cin>>a.at(i);
  }
  int z=1;
  for(int i=0;i<N){
    if(a.at(i)==1){
      z+=i;
    }
  }
  
}

Compiler output:
a.cc: In function 'int main()':
a.cc:11:18: error: expected ';' before ')' token
   11 |   for(int i=0;i<N){
      |                  ^
      |                  ;
Language: C++

N, K = map(int,input().split())
A = list(map(int,input().split()))

ans = 1
while N > K:
    N -= K
    if N > 0:
        N += 1
    ans += 1

print(ans)



Compiler output:
a.cc:1:1: error: 'N' does not name a type
    1 | N, K = map(int,input().split())
      | ^
Language: C++

#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <vector>
#include <queue>
#include <iostream>
#include <set>
#include <map>
#include <string>
#include <algorithm>

using namespace std;

typedef long long int ll;
typedef pair<int, int> Pii;
typedef pair<int, double> Pid;
typedef pair<double, int> Pdi;
typedef pair<double, double> Pdd;
typedef pair<ll, ll> P;
typedef pair<P, ll> PP;

const ll mod = 1e9+7;
const int INF = 2e9;
const double epsilon = 1e-7;
const double PI = 3.1415926535;

ll mi(ll x, ll y){
    if(x<y)return x;
    return y;
}
double f(ll n) {
    ll s = 0;
    for (ll n_ = n; n_; n_ /= 10) s += n_ % 10;
    return s / (1.0 * n);
}

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

    ll a = 1;
    ll b = 0;
    
    for (int i = 1; K; ) {
        write(b + a * i);
        K--;

        if (f(b + a * (i + 1)) >= f(b * 10 + 9 + a * 10 * (i / 10 + 1))) {
            i++;
        }
        else {
            b = b * 10 + 9;
            a = a * 10;
            i = i / 10 + 1;
        }
    }
}


Compiler output:
a.cc: In function 'int main()':
a.cc:46:9: error: 'write' was not declared in this scope; did you mean 'fwrite'?
   46 |         write(b + a * i);
      |         ^~~~~
      |         fwrite
Language: C++

#include<bits/stdc++.h>
using namespace std;
//define
#define int long long
#define rep(x,y) for(int i=x;i<y;i++)
#define REP(x,y) for(int j=x;j<y;j++)
#define Rep(x,y) for(int k=x;k<y;k++)
#define str string
#define pb() push_back()
#define all(x) x.begin(),x.end()
#define elif else if
#define mod 100000007
//vectordefine
#define vint vector<int>
#define vvint vector<vector<int>>
#define vc vector<char>
#define vvc vector<vector<char>>
#define vool vector<bool>
#define vtr vector<str>
#define vvtr vector<vector<str>>
//queuedefine
#define qint queue<int>
#define qtr queue<string>
#define qc queue<char>
//pairdefine
#define pint pair<int,int>
#define pic pair<int,char>
#define pci pair<char,int>
#define pis pair<int,str>
#define psi pair<str,int>
#define pcc pair<char,char>
#define pss pair<str,str>
#define mp make_pair
//mapdefine
#define mint map<int,int>
#define mic map<int,char>
#define mci map<char,int>
#define mis map<int,str>
#define msi map<str,int>
//function
str shizuku(char,char);
//UnionFind

struct UnionFind{
  vint par;
  UnionFind(int N):par(N){
    rep(0,N)par[i]=i;
  }
  int root(int x){
    if(par[x]==x)return x;
    return par[x]=root(par[x]);
  }
  void unite(int x,int y){
    int rx=root(x);
    int ry=root(y);
    if(rx==ry)return;
    par[rx]=ry;
  }
  bool same(int x,int y){
    return root(x)==root(y);
  }
};
//binary_search

//main
signed main(){
    int N,M,X,count=0,count2=mod,k=0;
    double d,D;
    int alph='A'-'a';
    char op,Ch;
    str S,T;
    cin>>N>>M;
    vint A(N);
    rep(0,N){
      cin>>A[i];
      if(A[i]==1){
        count2=count;
        count=0;
      }
      count+=1;
    }
    count-=1
    if(count%(M-1)>0)count=count/(M-1)+1;
    elif(count%(M-1)==0)count/=(M-1);
    if(count2%(M-1)>0)count2=count2/(M-1)+1;
    elif(count2%(M-1)==0)count2/=(M-1);
    cout<<count+count2<<endl;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:82:13: error: expected ';' before 'if'
   82 |     count-=1
      |             ^
      |             ;
   83 |     if(count%(M-1)>0)count=count/(M-1)+1;
      |     ~~       
a.cc:11:14: error: 'else' without a previous 'if'
   11 | #define elif else if
      |              ^~~~
a.cc:84:5: note: in expansion of macro 'elif'
   84 |     elif(count%(M-1)==0)count/=(M-1);
      |     ^~~~
Language: C++

#include<bits/stdc++.h>
using namespace std;
//define
#define int long long
#define rep(x,y) for(int i=x;i<y;i++)
#define REP(x,y) for(int j=x;j<y;j++)
#define Rep(x,y) for(int k=x;k<y;k++)
#define str string
#define pb() push_back()
#define all(x) x.begin(),x.end()
#define elif else if
#define mod 100000007
//vectordefine
#define vint vector<int>
#define vvint vector<vector<int>>
#define vc vector<char>
#define vvc vector<vector<char>>
#define vool vector<bool>
#define vtr vector<str>
#define vvtr vector<vector<str>>
//queuedefine
#define qint queue<int>
#define qtr queue<string>
#define qc queue<char>
//pairdefine
#define pint pair<int,int>
#define pic pair<int,char>
#define pci pair<char,int>
#define pis pair<int,str>
#define psi pair<str,int>
#define pcc pair<char,char>
#define pss pair<str,str>
#define mp make_pair
//mapdefine
#define mint map<int,int>
#define mic map<int,char>
#define mci map<char,int>
#define mis map<int,str>
#define msi map<str,int>
//function
str shizuku(char,char);
//UnionFind

struct UnionFind{
  vint par;
  UnionFind(int N):par(N){
    rep(0,N)par[i]=i;
  }
  int root(int x){
    if(par[x]==x)return x;
    return par[x]=root(par[x]);
  }
  void unite(int x,int y){
    int rx=root(x);
    int ry=root(y);
    if(rx==ry)return;
    par[rx]=ry;
  }
  bool same(int x,int y){
    return root(x)==root(y);
  }
};
//binary_search

//main
signed main(){
    int N,M,X,count=0,count2=mod,k=0;
    double d,D;
    int alph='A'-'a';
    char op,Ch;
    str S,T;
    cin>>N>>M;
    vint A(N);
    rep(0,N){
      cin>>A[i];
      if(A[i]==1){
        count2=count;
        count=0;
      }
      count+=1;
    }
    count-=1;
    elif(count%(M-1)==0)count/=(M-1);
    if(count2%(M-1)>0)count2=count2/(M-1)+1;
    elif(count2%(M-1)==0)count2/=(M-1);
    cout<<count+count2<<endl;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:11:14: error: 'else' without a previous 'if'
   11 | #define elif else if
      |              ^~~~
a.cc:83:5: note: in expansion of macro 'elif'
   83 |     elif(count%(M-1)==0)count/=(M-1);
      |     ^~~~
Language: C++

#include <iostream>
using namespace std;
int main(){
  int n,k;
  cin >> n >> k;
  if(n!=k){
    cout << 2 + (n-k-1)/(k-1) << endl;
  }else{
    cout << 1 << endl;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:10:2: error: expected '}' at end of input
   10 | }
      |  ^
a.cc:3:11: note: to match this '{'
    3 | int main(){
      |           ^
Language: Java

import java.util.*;


public class Main {
    public static void main(String[] args) {
        // 自分の得意な言語で
        // Let's チャレンジ！！

        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int answer = n / 2
        System.out.println(answer);
    }
}

Compiler output:
Main.java:11: error: ';' expected
        int answer = n / 2
                          ^
1 error
Language: Java

7 3 1 8 4 6 2 5 -4
1 3 7 8 6 4 2 5 -4
7 3 8 1 4 6 2 5 -4
a a a a a a a a 1 a a a a a a a -8
1 a a a a a a a a a a a a a a a -8import java.util.*;


public class Main {
    public static void main(String[] args) {
        // 自分の得意な言語で
        // Let's チャレンジ！！

        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int answer = n / 2
        System.out.println(answer);
    }
}

Compiler output:
Main.java:1: error: class, interface, enum, or record expected
7 3 1 8 4 6 2 5 -4
^
Main.java:15: error: ';' expected
        int answer = n / 2
                          ^
2 errors
Language: Java

import java.util.ArrayList;
import java.util.List;
import java.util.Optional;
import java.util.Scanner;

public class Main {
	static int N,K;
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		N = sc.nextInt();
		K = sc.nextInt();
		List<Integer> list = new ArrayList<>();
		for (int i = 0; i < N; i++) {
			list.add(sc.nextInt());
		}
		Optional<Integer> min = list.stream().min((a, b) -> a.compareTo(b));
		
		for (int i = 0; i < N; i ++) {
			if (list.get(i) == min) {
				
			}
		}
	}
}


Compiler output:
Main.java:19: error: incomparable types: Integer and Optional<Integer>
			if (list.get(i) == min) {
			                ^
1 error
Language: C++

#include <iostream>
#include<vector>
using namespace std;
int main() {
	int n,k,x,cnt=0;
	cin>>n>>k;
	vector<int>v;
	for(int i=0;i<n;i++)
	{
	   cin>>x;
	   v.push_back(x);
	}
	sort(v.begin(),v.end());
	for(int i=0;i<v.size()-1;i+=k-1)
    {
        cnt++;
    }
    cout<<cnt<<endl;
	return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:13:9: error: 'sort' was not declared in this scope; did you mean 'short'?
   13 |         sort(v.begin(),v.end());
      |         ^~~~
      |         short
Language: C++

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

 
int main(){
    int N,k;
    int c;
    int a[100100]; 
    cin >> N >> k;
    for (int i = 0; i < N; ++i) {
        cin >> a[i];
        if(a[i] == 1){
            c = i;
        }
    }
    int ans = 0;
    m =(N-c)/(k-1); 
    n =(c-1)/(k-1);
    
    if((N-c) % (k-1) != 0){
        m++;
    }
    if ((c-1) % (k-1) != 0){
        n++;
    }
    ans = m + n;
    cout << ans << endl;
    }

Compiler output:
a.cc: In function 'int main()':
a.cc:18:5: error: 'm' was not declared in this scope
   18 |     m =(N-c)/(k-1);
      |     ^
a.cc:19:5: error: 'n' was not declared in this scope
   19 |     n =(c-1)/(k-1);
      |     ^
Language: C++

"use strict"
let fs = require('fs');
let input = fs.readFileSync("/dev/stdin", "utf8").split(/\s/);
const N = +input[0];
const K = +input[1];
let ans = 1;
if(N > K) {
  for(let i= N - K; i > 0; i -= K - 1) ans++;
}
console.log(ans);

Compiler output:
a.cc:2:18: warning: multi-character character constant [-Wmultichar]
    2 | let fs = require('fs');
      |                  ^~~~
a.cc:3:58: error: stray '\' in program
    3 | let input = fs.readFileSync("/dev/stdin", "utf8").split(/\s/);
      |                                                          ^
a.cc:1:1: error: expected unqualified-id before string constant
    1 | "use strict"
      | ^~~~~~~~~~~~
a.cc:3:1: error: 'let' does not name a type
    3 | let input = fs.readFileSync("/dev/stdin", "utf8").split(/\s/);
      | ^~~
a.cc:4:7: error: 'N' does not name a type
    4 | const N = +input[0];
      |       ^
a.cc:5:7: error: 'K' does not name a type
    5 | const K = +input[1];
      |       ^
a.cc:6:1: error: 'let' does not name a type
    6 | let ans = 1;
      | ^~~
a.cc:7:1: error: expected unqualified-id before 'if'
    7 | if(N > K) {
      | ^~
a.cc:10:1: error: 'console' does not name a type; did you mean 'const'?
   10 | console.log(ans);
      | ^~~~~~~
      | const
Language: C++

#include <iostream>
using namespace std;

int main() {
  int N,K; cin >> N >> K;
  cout << ((((N-1) + (K-2))/(K-1)) << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:6:36: error: invalid operands of types 'int' and '<unresolved overloaded function type>' to binary 'operator<<'
    6 |   cout << ((((N-1) + (K-2))/(K-1)) << endl;
      |            ~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~
a.cc:6:43: error: expected ')' before ';' token
    6 |   cout << ((((N-1) + (K-2))/(K-1)) << endl;
      |           ~                               ^
      |                                           )
Language: C++

#include "pch.h"
//sortは初期で昇順 greater<hoge>()で降順

#include <iostream>
#include<vector>
#include<map>
#include<algorithm>
#include<cstring>
#include<string>
#include <set>
#include <cassert>
#include<cmath>
#include<climits>
#include<iomanip>
using namespace std;
#define MOD 1000000007
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define ll long long
const long long INF = 1LL << 60;


template<class T> inline bool chmin(T& a, T b) {
	if (a > b) {
		a = b;
		return true;
	}
	return false;
}
template<class T> inline bool chmax(T& a, T b) {
	if (a < b) {
		a = b;
		return true;
	}
	return false;
}

class UnionFind {
	vector<int> data;
public:
	UnionFind(int size) : data(size, -1) { }
	bool unionSet(int x, int y) {
		x = root(x); y = root(y);
		if (x != y) {
			if (data[y] < data[x]) swap(x, y);
			data[x] += data[y]; data[y] = x;
		}
		return x != y;
	}
	bool findSet(int x, int y) {
		return root(x) == root(y);
	}
	int root(int x) {
		return data[x] < 0 ? x : data[x] = root(data[x]);
	}
	int size(int x) {
		return -data[root(x)];
	}
};

int find(vector<long long> &arr, long long obj) {
	if (arr[arr.size() - 1] < obj)return arr.size()-1;
	if (arr[0] > obj)return -1;

	int min = 0; int max = arr.size() - 1;
	for (int i = 0; i < arr.size(); i++) {
		if (arr[min+(max-min) / 2] > obj) {
			max = min + (max - min) / 2;
		}
		else {
			min = min + (max - min) / 2;
		}
		if (max - min == 1) {
			return min;
		}
	}


}

//約数求める //約数
void divisor(ll n,vector<ll> &ret) {
	for (ll i = 1; i * i <= n; i++) {
		if (n % i == 0) {
			ret.push_back(i);
			if (i * i != n) ret.push_back(n / i);
		}
	}
	sort(ret.begin(), ret.end());
	
}
//階乗
long long factorial(long long n, long long mod) {
	long long ret = 1;
	for (long long i = 1; i <= n; i++) {
		ret = (ret * i) % mod;
	}
	return ret;
}
//モジュラ逆数
long long inv_mod(long long n, long long mod) {
	long long a = n % mod, b = mod - 2, ret = 1;
	while (b > 0) {
		if (b & 1) ret = (ret * a) % mod;
		a = (a * a) % mod;
		b >>= 1;
	}
	return ret;
}

long long nPr(long long n, long long r, long long mod) {
	long long ret = 1;
	for (long long i = n; i >= n - r + 1; i--) {
		ret = ret * (i % mod) % mod;
	}
	return ret;
}

long long nCr(long long n, long long r, long long mod) {
	return nPr(n, r, mod) * inv_mod(factorial(r, mod), mod) % mod;
}

bool compare_by_b(pair<ll, ll> a, pair<ll, ll> b) {//降順second
	if (a.second != b.second) {
		return a.second > b.second;
	}
	else {
		return a.first > b.first;
	}
}

bool compare_by_a(pair<ll, ll> a, pair<ll, ll> b) {//降順first
	if (a.first != b.first) {
		return a.first > b.first;
	}
	else {
		return a.second > b.second;
	}
}

ll gcd(ll m, ll n){
	if (n == 0)return m;
	return gcd(n, m%n);
}//gcd


int main() {
	double n, k;
	cin >> n >> k;
	vector<ll> a(n);
	double num = 0;
	rep(i, n) {
		cin >> a[i];
		if (a[i] == 1)num = i;
	}
	double l, r;
	l = num;
	r = n - num;
	if (l < k - 1) {
		r -= k - 1 - l;
		
	}
	else if(r<k-1) {
		l -= k - 1 - r;
	}
	cout << ceil(l / (k - 1.0)) + ceil(r / (k - 1.0));


	return 0;
}


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

#include<iostrean>
using namespace std;
int main(){
  int a,b;
  cin>>a>>b;
  cout<<-int((1-a)/(b-1))<<endl;
  
  
return 0;
}

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

using namespace std;
int main()
{int n,k;cin >> n >> k;int 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:3:10: error: 'cin' was not declared in this scope
    3 | {int n,k;cin >> n >> k;int ans = (n - 1) / (k - 1);if( (n-1) % (k - 1)==0)ans++;cout << ans << endl;}
      |          ^~~
a.cc:1:1: note: 'std::cin' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
  +++ |+#include <iostream>
    1 | using namespace std;
a.cc:3:81: error: 'cout' was not declared in this scope
    3 | {int n,k;cin >> n >> k;int ans = (n - 1) / (k - 1);if( (n-1) % (k - 1)==0)ans++;cout << ans << endl;}
      |                                                                                 ^~~~
a.cc:3:81: note: 'std::cout' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
a.cc:3:96: error: 'endl' was not declared in this scope
    3 | {int n,k;cin >> n >> k;int ans = (n - 1) / (k - 1);if( (n-1) % (k - 1)==0)ans++;cout << ans << endl;}
      |                                                                                                ^~~~
a.cc:1:1: note: 'std::endl' is defined in header '<ostream>'; this is probably fixable by adding '#include <ostream>'
  +++ |+#include <ostream>
    1 | using namespace std;
Language: C++

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


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

    vector<int> v;
    v.resize(N);
    for (int i = 0; i < N; ++i) cin >> v[i];
    int res = 0;
    int right = 0;
    while (true) {
      if (res == 0) right += K;
      else right += K-1;
      ++res;

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

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

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


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

    vector<int> v;
    v.resize(N);
    for (int i = 0; i < N; ++i) cin >> v[i];
    int res = 0;
    int right = 0;
    while (true) {
      if (res == 0) right += K;
      else right += K-1;
      ++res;

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


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

#include <iostream>
#include <algorithm>
#include <string> 
#include <vector>
#include <iomanip>
#include <math.h>
#include <map>
using namespace std;

int main()
{
	int N, K;
	cin >> N >> K;
	vector<int> A(N);
	int key = -1;
	for (int i = 0; i < N; i++) {
		cin >> A[i];
		if (A[i] == 1) {
			key = i;
		}
	}
	cout << ((key + K) / K) + ((N - key + K) / K) << endl;

Compiler output:
a.cc: In function 'int main()':
a.cc:22:63: error: expected '}' at end of input
   22 |         cout << ((key + K) / K) + ((N - key + K) / K) << endl;
      |                                                               ^
a.cc:11:1: note: to match this '{'
   11 | {
      | ^