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

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

int main(){
    int n,k;
    int min_idx=0;
    int temp;
    cin >> n >> k;
    for(int i=0;i<n;i++){
        cin >> temp;
        if(temp==1)min_idx=i;
    }
    if(n==k){
        cout << 1 << endl;
        return 0;
    }
    if(i>n-1-i){
        int re_b = i;
        int re_s = n-1-i;
    }else{
        int re_b = n-1-i;
        int re_s = i;
    }
    
    if(re_s<=k-1)cout << (n-1+k-2)/(k-1) << endl;
    
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:17:8: error: 'i' was not declared in this scope
   17 |     if(i>n-1-i){
      |        ^
a.cc:25:8: error: 're_s' was not declared in this scope
   25 |     if(re_s<=k-1)cout << (n-1+k-2)/(k-1) << endl;
      |        ^~~~
Language: C++

#include <iostream>
using namespace std;
int main(){
int N,K,ans;
cin>>N>>K;

if(N%(K-1)==1){
  ans=(N-1)/(K-1);
}else{
  ans=(N-N%(K-1))/(K-1)+1;
}
cout <<ans<<endl;
}
return 0;
}


Compiler output:
a.cc:14:1: error: expected unqualified-id before 'return'
   14 | return 0;
      | ^~~~~~
a.cc:15:1: error: expected declaration before '}' token
   15 | }
      | ^
Language: C++

#include <bits/stdc++.h>
#include <typeinfo>
#include <cxxabi.h>
#ifdef LOCAL
#include "dbgtoki.hpp"
#define DUMP(i) dump((string)TOSTRING(i), demangle(typeid(i).name()), __LINE__ , i) 
#else
#define DUMP(i) 
#endif

using namespace std;
#define TOSTRING(x) #x
#define SZ(x) (int)(x).size()
#define REP(i,n) for(int i=0;i<(n);i++)
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define ALL(s) (s).begin(), (s).end()
#define UNIQUE(v) v.erase( unique(v.begin(), v.end()) , v.end());
#define dis distance
#define so sort
#define rev reverse
#define pub push_back
#define sec second
#define fir first

typedef long long unsigned int llu;
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<vector <int> > vvi;
const int EPS = 1e-9;
const int MOD = 1e9+7;

int main (){
  cin.tie(0);
  ios::sync_with_stdio(false);
  int n,k;
  cin >> n >> k;
  int ind1 = -1;
  REP(i,n){
    int a;
    cin >> a;
    if(a == 1)ind1 = i;
  }
  //この解法ではa,1,bの区間が考えられていない。
  int ans1
  //1より左側の処理
  ans1 = ind1 / (k-1);
  if(ind1 % (k-1) != 0)ans1++;//切り上げ
  //1より右側の処理(1より右側にある個数 => n-ind1)
  ans1 += (n-ind1) / (k-1);
  if((n-ind1) % (k-1) != 0)ans1++;//切り上げのアルゴ忘れたorg

  int ans2 = (ind1 - 1) / (k-1);
  if((ind1 - 1) % (k-1) != 0)ans2++;
  ans2 += (n-ind1-2) / (k-1);
  if( (n-ind1-2) % (k-1) != 0)ans2++;
  ans2++;
  DUMP(ans2);
  
  cout << min(ans1,ans2) << endl;
  return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:47:3: error: expected initializer before 'ans1'
   47 |   ans1 = ind1 / (k-1);
      |   ^~~~
a.cc:48:24: error: 'ans1' was not declared in this scope
   48 |   if(ind1 % (k-1) != 0)ans1++;//切り上げ
      |                        ^~~~
a.cc:50:3: error: 'ans1' was not declared in this scope
   50 |   ans1 += (n-ind1) / (k-1);
      |   ^~~~
Language: C++

#include <iostream>
#include <string>
#include <algorithm>
#include <set>
#include <map>
#include <vector>
#include <numeric>
using namespace std;
#define FOR(i,a,b) for(int i=a;i<b;i++)
#define REP(i,b) FOR(i,0,b)
#define INF 1e9

typedef unsigned long long ull;

int a[111111];

int main()
{
  int n, k, p1, ans;
  cin>>n>>k;

  REP(i,n) {
    cin>>a[i];
    if (a[i] == 1) p1 = i;
  }

  if (n == k) ans = 1;
  else if (k == 2) ans = n - 1;
  else if (p1 == 0 || p1 == n-1)
    ans = (n-1)%(k-1) == 0 ? (n-1)/(k-1) : (n-1)/(k-1) + 1;
  else if (i + 1 < k || n - i < k)
    ans = (n+1)/(k-1) == 0 ? (n+1)/(k-1) : (n+1)/(k-1) + 1;
  else {
    ans = (p1-1)%(k-1) == 0 ? (p1-1)/(k-1) : (p1-1)/(k-1) + 1;
    ans += (n-p1-1)%(k-1)== 0 ? (n-p1-1)/(k-1) : (n-p1-1)/(k-1) + 1;
  }

  cout<<ans<<endl;

  return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:31:12: error: 'i' was not declared in this scope
   31 |   else if (i + 1 < k || n - i < k)
      |            ^
Language: C++

#include <iostream>
using namespace std;
int main(){
int N,K,hoge,ans;

if(N%(K-1)==1){
  ans=(N-1)/(K-1);
}else{
  ans=(N-N%(K-1))/(K-1)+1;
}
cout <<ans<<endl;
}
return 0;
}


Compiler output:
a.cc:13:1: error: expected unqualified-id before 'return'
   13 | return 0;
      | ^~~~~~
a.cc:14:1: error: expected declaration before '}' token
   14 | }
      | ^
Language: C++

    /** Bismillahir Rahmanir Raheem **/
    /**
    ********************************************************************
    ******************* Author:Ashik Iqbal****************************
    ********************************************************************
    **/
    /**
    Name : Ashik Iqbal.
    Email: ashiqueiqbal998@gmail.com.
    Computer Science and Engineering.
    North South University.
    Dhaka, Bangladesh.
    **/
     
    #include <bits/stdc++.h>
    using namespace std;
     
     
    /** templates starts here **/
    #define ll long long int
    #define ull unsigned long long
    #define ld long double
    #define vi vector<int>
    #define vll vector<ll>
    #define vc vector<char>
    #define vs vector<string>
    #define pb push_back
    #define stll stack<ll>
    #define qll queue<ll>
    #define pqll priority_queue<ll>
    #define mpii map<int,int>
    #define mpll map<ll,ll>
    #define mpss map<string,string>
    #define mpsi map<string,int>
    #define mpis map<int,string>
    #define mpsll map<string,ll>
    #define mplls map<ll,string>
    #define sit set<int>::iterator
    #define slit set<ll>::iterator
    #define rev(v) reverse(v.begin(),v.end())
    #define srt(v) sort(v.begin(),v.end())
    #define grtsrt(v) sort(v.begin(),v.end(),greater<int>())
    #define asrt(a) sort(a, a+n)
    #define grtasrt(a) sort(a, a+n,greater<int>())
    #define FOR(i,j,k) for(int i=j;i<k;i++)
    #define REV(i,j,k) for(int i=j;i>k;i--)
    #define fast ios_base::sync_with_stdio(false),cin.tie(NULL)
    #define mem(a,x) memset(a,x,sizeof(a))
    #define inf 0x3f3f3f3f
    #define mx 1000005
    const int mod=1e9+7;
    const int N = (int) 1e5 + 5;
    /** templates ends here **/
     
     
    int main ()
    {
     
        fast;
        ll n, K;
        cin>>n>>K;
       if(n == k)
{
cout<<"1"<<endl;
return 0;
}
        ll a[n];
        FOR(i, 0, n)cin>>a[i];
        asrt(a);
        ll mn = a[0];
        vi v;
        ll cnt = 0;
        FOR(i, 0, n)
        {
            if(a[i] == mn && mn!=a[n-1])
            {
                cnt++;
                ll ff = K-1;
                a[i+ff] = mn;
                //for(ll bb = 0; bb<K; bb++)
                //{
                    //v.pb(mn);
               // }
            }
        }
       // FOR(i, 0, v.size())cout<<v[i]<<endl;
        cout<<cnt<<endl;
        return 0;
    }

Compiler output:
a.cc: In function 'int main()':
a.cc:62:16: error: 'k' was not declared in this scope
   62 |        if(n == k)
      |                ^
Language: C++

#include<iostream>
#include<string>
using namespace std;
int main(){
int N,K;
int count=0;
cin>>N>>K;
int min=K-1;
int ans=K;
ans=min;
int A[N];
for (int i = 0; i < N; i++) {
  cin>>A[i];
}

for (int i = 0;; i++) {
  ans=K+(K-i)*i
  if(ans>=N){
    cout<<i<<endl;
    break;
  }


}
return 0;









}


Compiler output:
a.cc: In function 'int main()':
a.cc:17:16: error: expected ';' before 'if'
   17 |   ans=K+(K-i)*i
      |                ^
      |                ;
   18 |   if(ans>=N){
      |   ~~
Language: C++

#include<iostream>
using namespace std;

int main() {
	int test[1000000];
	int N, K;
	cin >> N >> K;

	for (int i = 1; i <= N; i++) {
		cin >> test[i];
      if(test[i]==1){
        int D = i;
      if((D-1)%K==0)
      if((N-D)%K==0)
        cout << (D-1)/K+(N-D)/K;
      else
      cout << (D-1)/K+(N-D)/K+1;
      }
      else{if((N-D)%K==0)
        cout << (D-1)/K+(N-D)/K+1;
      else
      cout << (D-1)/K+(N-D)/K+2;
      }
        
	}
	return 0;
	}

Compiler output:
a.cc: In function 'int main()':
a.cc:19:18: error: 'D' was not declared in this scope
   19 |       else{if((N-D)%K==0)
      |                  ^
Language: C++

#include <iostream>
#include <string>
#include <algorithm>
#include <set>
#include <map>
#include <vector>
#include <numeric>
using namespace std;
#define FOR(i,a,b) for(int i=a;i<b;i++)
#define REP(i,b) FOR(i,0,b)
#define INF 1e9

typedef unsigned long long ull;

int a[111111];

int main()
{
  int n, k, p1, ans;
  cin>>n>>k;

  REP(i,n) {
    cin>>a[i];
    if (a[i] == 1) p1 = i;
  }

  if (n == k) ans = 1;
  else (k == 2) ans = n - 1;
  else if (p1 == 0 || p1 == n-1)
    ans = (n-1)%(k-1) == 0 ? (n-1)/(k-1) : (n-1)/(k-1) + 1;
  else {
    ans = (p1-1)%(k-1) == 0 ? (p1-1)/(k-1) : (p1-1)/(k-1) + 1;
    ans += (n-p1-1)%(k-1)== 0 ? (n-p1-1)/(k-1) : (n-p1-1)/(k-1) + 1;
  }

  cout<<ans<<endl;

  return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:28:16: error: expected ';' before 'ans'
   28 |   else (k == 2) ans = n - 1;
      |                ^~~~
      |                ;
a.cc:29:3: error: 'else' without a previous 'if'
   29 |   else if (p1 == 0 || p1 == n-1)
      |   ^~~~
Language: C++

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

int main() {
    int n,k ;
    cin >> n >> k ;
    vector<int> a(n) ;
    int ans=0 ;
    for ( int i=0 ; i<n ; i++ )
    cin >> a.at(i) ;
    sort ( a.begin(),a.end() ) ;
    while ( i<n ){
        if ( i==n-1) ans-=2 ;
        i+=k-1 ;
        ans++ ;
    }
    ans++ ;
    cout << ans <<endl ;
        

Compiler output:
a.cc: In function 'int main()':
a.cc:12:13: error: 'i' was not declared in this scope
   12 |     while ( i<n ){
      |             ^
a.cc:18:25: error: expected '}' at end of input
   18 |     cout << ans <<endl ;
      |                         ^
a.cc:4:12: note: to match this '{'
    4 | int main() {
      |            ^
Language: C++

#include "bits/stdc++.h"
using namespace std;
vector<int> vec;
int main()
{
	int i,n,flag=1,k,ans=0;
	int presum=0,nextsum=0;
	scanf("%d %d",&n,&k);
	vec.resize(n+1);
	for(i=0;i<n;i++)
	{
		scanf("%d",&vec[i]);
		if(vec[i]==1)
		{
			flag=0;
		} 
		if(flag)
		{
			presum++;
		}
		else
		{
			nextsum++;
		}
	}
	nextsum--;
	if(nextnum+presum<k)
	{
		printf("1\n");
		return 0;
	}
	if(presum==0)
	{
		ans+=0;
	}
	else if(presum%(k-1)==0)
	{
		ans+=(presum/(k-1));
	}
	else if(presum%(k-1)!=0)
	{
		ans+=(presum/(k-1))+1;
	}
	if(nextsum==0)
	{
		ans+=0;
	}
	else if(nextsum%(k-1)==0)
	{
		ans+=(nextsum/(k-1));
	}
	else if(nextsum%(k-1)!=0)
	{
		ans+=(nextsum/(k-1))+1;
	}
	printf("%d\n",ans);
	return 0;
} 

Compiler output:
a.cc: In function 'int main()':
a.cc:27:12: error: 'nextnum' was not declared in this scope; did you mean 'nextsum'?
   27 |         if(nextnum+presum<k)
      |            ^~~~~~~
      |            nextsum
Language: C

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

int main(){
	int N,K,count,a,count=0;
	int c;
	scanf("%d%d",&N,&K);
	while((c=getchar())!=EOF){
		
	}
	
	while(N!=0){
		a=N%K;
		N=N/K;
		count=N+count;
		N=N+a;
	}
	
	printf("%d",count+1);
	
	return 0;
	
}



Compiler output:
main.c: In function 'main':
main.c:6:25: error: redeclaration of 'count' with no linkage
    6 |         int N,K,count,a,count=0;
      |                         ^~~~~
main.c:6:17: note: previous declaration of 'count' with type 'int'
    6 |         int N,K,count,a,count=0;
      |                 ^~~~~
Language: C++

int main()
{
int a[100100];
int n, k;
int pos1;
	cin >> n >> k;
	for( int i = 0; i < n; i++ ) {
		cin >> a[i];
		if( a[i] == 1 ) pos1 = i+1;
	}
	if( n <= k ) {
		cout << "1" << endl;
	} else {
//		cout << n << endl;
//		cout << k << endl;
//		cout << (n % (k-1))  << endl;
		if( (n % (k-1))==0 ) {
//			cout << (n % (k-1))  << endl;
			cout << (n/(k-1)) << endl;
		} else {
			if( (pos1 %(k-1)) == 0 && ((n-pos1) % (k-1)) == 0 ) {
			//cout << "pos1=" << pos1 << endl;
			//cout << "n-pos1=" << (n-pos1) << endl;
			cout << (n/(k-1)) << endl;
			} else {
			cout << (n/(k-1))+1 << endl;
			}
		}
	}
}


Compiler output:
a.cc: In function 'int main()':
a.cc:6:9: error: 'cin' was not declared in this scope
    6 |         cin >> n >> k;
      |         ^~~
a.cc:12:17: error: 'cout' was not declared in this scope
   12 |                 cout << "1" << endl;
      |                 ^~~~
a.cc:12:32: error: 'endl' was not declared in this scope
   12 |                 cout << "1" << endl;
      |                                ^~~~
a.cc:19:25: error: 'cout' was not declared in this scope
   19 |                         cout << (n/(k-1)) << endl;
      |                         ^~~~
a.cc:19:46: error: 'endl' was not declared in this scope
   19 |                         cout << (n/(k-1)) << endl;
      |                                              ^~~~
a.cc:24:25: error: 'cout' was not declared in this scope
   24 |                         cout << (n/(k-1)) << endl;
      |                         ^~~~
a.cc:24:46: error: 'endl' was not declared in this scope
   24 |                         cout << (n/(k-1)) << endl;
      |                                              ^~~~
a.cc:26:25: error: 'cout' was not declared in this scope
   26 |                         cout << (n/(k-1))+1 << endl;
      |                         ^~~~
a.cc:26:48: error: 'endl' was not declared in this scope
   26 |                         cout << (n/(k-1))+1 << 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);

    int 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>>n>>k;
  ri(i,0,n){
    cin>>a;
    if(a==1)b=i+1;
  }
  min=100000;
ri(i,0,k){
if(b-i>0&&b+k-i-1<=n){
p=(b-i-1+k-2)/(k-1)+(n-(b+k-i-1)+k-2)/(k-1)+1;
  min=min<p?min:p;}
}











    cout<<(p<q?p:q)<<"\n";
}



Compiler output:
a.cc: In function 'int main()':
a.cc:24:7: error: overloaded function with no contextual type information
   24 |   min=100000;
      |       ^~~~~~
a.cc:28:17: error: overloaded function with no contextual type information
   28 |   min=min<p?min:p;}
      |                 ^
a.cc:28:7: error: parse error in template argument list
   28 |   min=min<p?min:p;}
      |       ^~~~~~~~~~~
a.cc:28:7: error: overloaded function with no contextual type information
Language: C++

>

using namespace std;

#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define itn int
typedef long long ll;
typedef pair<ll,ll> p;


int main()
{
  double n, k;
  cin >> n >> k;
  vector<double> v(n, 0);
  double tmp = -1;
  for (double i = 0; i < n; i++)
  {
    cin >> v[i];
    if(v[i] == 1) tmp = i;
  }
  int res = 0;
  int res1, res2;
  int amari1 = int(tmp) % int((k-1));
  int amari2 = int((n-1 - tmp)) % int((k-1));
  // if ((tmp + amari1) % (k-1) == 0v)
  // {
  //   /* code */
  // }
  res = ceil(tmp / (k-1)) + ceil((n-1 - tmp) / (k-1));
  res1 = ceil((tmp + amari1) / (k-1)) + ceil((n-1 - (tmp + amari1)) / (k-1));
  res2 = ceil((tmp - amari2 + 1) / (k-1)) + ceil((n-1 - (tmp - amari2 + 1)) / (k-1));
  // if(k == n) res--;
  // if (tmp % (k-1) != 0 || (n-1 - tmp) % (k-1) != 0)
  // {
  //   if (tmp % )
  //   {
  //     /* code */
  //   }
  //
  // }
  cout << min({res, res1, res2}) << endl;


}


Compiler output:
a.cc:1:1: error: expected unqualified-id before '>' token
    1 | >
      | ^
a.cc:10:9: error: 'pair' does not name a type
   10 | typedef pair<ll,ll> p;
      |         ^~~~
a.cc: In function 'int main()':
a.cc:16:3: error: 'cin' was not declared in this scope
   16 |   cin >> n >> k;
      |   ^~~
a.cc:17:3: error: 'vector' was not declared in this scope
   17 |   vector<double> v(n, 0);
      |   ^~~~~~
a.cc:17:10: error: expected primary-expression before 'double'
   17 |   vector<double> v(n, 0);
      |          ^~~~~~
a.cc:21:12: error: 'v' was not declared in this scope
   21 |     cin >> v[i];
      |            ^
a.cc:32:9: error: 'ceil' was not declared in this scope
   32 |   res = ceil(tmp / (k-1)) + ceil((n-1 - tmp) / (k-1));
      |         ^~~~
a.cc:44:3: error: 'cout' was not declared in this scope
   44 |   cout << min({res, res1, res2}) << endl;
      |   ^~~~
a.cc:44:11: error: 'min' was not declared in this scope; did you mean 'main'?
   44 |   cout << min({res, res1, res2}) << endl;
      |           ^~~
      |           main
a.cc:44:37: error: 'endl' was not declared in this scope
   44 |   cout << min({res, res1, res2}) << endl;
      |                                     ^~~~
Language: C

#include<stdio.h>

int main()
{
	int n, m, k, i,count;
	scanf("%d%d", &n, &k);
	int a[n];
	for (i = 0; i < n; i++)
		scanf("%d", a[i]);
	m = n - k;
	while (m > 0)
	{
		m = m - (n - 1);
		count++;
	}
	printf("%d", count + );
	return 0;
}

Compiler output:
main.c: In function 'main':
main.c:16:30: error: expected expression before ')' token
   16 |         printf("%d", count + );
      |                              ^
Language: C++

#include <iostream>
#include <algorithm>
#include <functional>
#include <map>
#include <ostream>
#include <queue>
#include <random>
#include <string>
#include <vector>
#include <cstdlib>
#include <cmath>
#include <cstring>

using std::cin;
using std::cout;
using std::cerr;
using std::endl;

using ll = long long;

inline void init() {
  cin.tie(0);
  std::ios::sync_with_stdio(false);
}

int main() {
  init();
  int n, k, idx = 0;

  cin >> n >> k;
  std::vector<int> a(n, 0);

  for (int i = 0; i < n; ++i) {
    cin >> a[i];
    if (a[i] == 1) {
      idx = i;
    }
  }

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

  bool l = true, r = true;
  
  if (idx > 0 && idx + 1 < k) {
    ans++;
    idx = k - 1;
    l = false;
  }
  else if (idx < n - 1 && idx + 1 > n - k) {
    ans++;
    idx = n - k - 1;
    r = false;
  }
  
  d = idx;
  
  while (l && d > 0) {
   	ans++;
    d -= (k - 1);
  }
  d = idx;
  while (r && d < n - 1) {
    ans++;
    d += (k - 1);
  }
  
  cout << ans << endl;

  return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:60:3: error: 'd' was not declared in this scope
   60 |   d = idx;
      |   ^
Language: C

#include<stdio.h>

int main()
{
	int n, m, k, i,count;
	scanf("%d%d", &n, &k);
	int a[n];
	for (i = 0; i < n; i++)
		scanf("%d", a[i]);
	m = n - k;
	while (n > 0)
	{
		m = m - (n - 1);
		count++;
	}
	printf("%d", count + );
	return 0;
}

Compiler output:
main.c: In function 'main':
main.c:16:30: error: expected expression before ')' token
   16 |         printf("%d", count + );
      |                              ^
Language: C++

#include<iostream>
#include<vector>

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];
        // cout << A[i] << endl;
    }

    std::vector<int>::iterator minIt = min_element(A.begin(), A.end());
    size_t minIndex = std::distance(A.begin(), minIt);
    // cout << minIndex << endl;

    int l1 = minIndex + 1;
    int l2 = N - minIndex;
    // cout << l1 << l2 << endl;

    int n1 = (l1-1) / (K-1);
    if((l1-1) % (K-1)!=0){
        n1 +=1;
    }
    int n2 = (l2-1) / (K-1);
    if((l2-1) % (K-1)!=0){
        n2 +=1;
    }

    cout << n1+n2 << endl;


    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:17:40: error: 'min_element' was not declared in this scope
   17 |     std::vector<int>::iterator minIt = min_element(A.begin(), A.end());
      |                                        ^~~~~~~~~~~
Language: C

#include<stdio.h>

int main()
{
	int n, m, k, a[100000], i,count;
	scanf("%d%d", &n, &k);
	for (i = 0; i < n; i++)
		scanf("%d", a[i]);
	m = n - k;
	while (n > 0)
	{
		m = m - (n - 1);
		count++;
	}
	printf("%d", count + );
	return 0;
}

Compiler output:
main.c: In function 'main':
main.c:15:30: error: expected expression before ')' token
   15 |         printf("%d", count + );
      |                              ^
Language: C++

#include<iostream>
using namespace std;
int main()
{
    // スペース区切りの整数の入力
    int N, K, c;
    cin >> N >> K;
    // 配列の入力
    int a[N];
　　for ( int i = 0; i < N; i++){
　　　　cin >> a[i];
　　}
    if(N % (K - 1) == 0){
    c = N / (K - 1);
    }else{
    c = N / (K - 1) + 1;
    }
    // 出力
    cout << c << endl;
    return 0;
}

Compiler output:
a.cc:10:1: error: extended character 　 is not valid in an identifier
   10 | 　　for ( int i = 0; i < N; i++){
      | ^
a.cc:10:1: error: extended character 　 is not valid in an identifier
a.cc:11:1: error: extended character 　 is not valid in an identifier
   11 | 　　　　cin >> a[i];
      | ^
a.cc:11:1: error: extended character 　 is not valid in an identifier
a.cc:11:1: error: extended character 　 is not valid in an identifier
a.cc:11:1: error: extended character 　 is not valid in an identifier
a.cc:12:1: error: extended character 　 is not valid in an identifier
   12 | 　　}
      | ^
a.cc:12:1: error: extended character 　 is not valid in an identifier
a.cc: In function 'int main()':
a.cc:10:11: error: expected primary-expression before 'int'
   10 | 　　for ( int i = 0; i < N; i++){
      |           ^~~
a.cc:10:22: error: 'i' was not declared in this scope
   10 | 　　for ( int i = 0; i < N; i++){
      |                      ^
Language: C++

#include <iostream>
using namespace std;

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


Compiler output:
a.cc: In function 'int main()':
a.cc:8:9: error: expected ';' before 'if'
    8 |   n -= k
      |         ^
      |         ;
    9 |   if (n == 0) {
      |   ~~     
a.cc:11:5: error: 'else' without a previous 'if'
   11 |   } else {
      |     ^~~~
Language: Java

import java.util.*;
public class Main{
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		long N = sc.nextLong();
		long K = sc.nextLong();
		long a[] = new long[N];
		long place = 0;
		for(long i=0; i<N; i++){
			a[i] = sc.nextLong();
			if(a[i]==1)place = i;
		}
		long num1 = 0;
      	long num2 = 0;
		num1 += (place+K-2)/(K-1);
		num2 += (N-place+K-3)/(K-1);
		System.out.println(num1+num2);
	}
}

Compiler output:
Main.java:7: error: incompatible types: possible lossy conversion from long to int
		long a[] = new long[N];
		                    ^
Main.java:10: error: incompatible types: possible lossy conversion from long to int
			a[i] = sc.nextLong();
			  ^
Main.java:11: error: incompatible types: possible lossy conversion from long to int
			if(a[i]==1)place = i;
			     ^
3 errors
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.at(i)
  }
  
  int ans = 0;
  if((n-1) % (k - 1) == 0) {
    ans += (n-1) / (k - 1);
  } else {
    ans += (n-1) % (k - 1) + 1;
  }
  cout << ans << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:10:19: error: expected ';' before '}' token
   10 |     cin >> a.at(i)
      |                   ^
      |                   ;
   11 |   }
      |   ~
Language: C++

#include <iostream>
#include <string>
#include <stdexcept>
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
using namespace std;

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

   int n,k,ans = 0,start = 1;
   cin >> n >> k;
   int a[n];

   rep(i,n){
      cin >> a[i];
   }
   sort(a, a+n);

   rep(i,n){
      if(a[i] == a[i + 1]) continue;
      start = i;
      break;
   }

   while(1){
      start += 2;
      if(start > n) break;
      ans++;
   }

   cout << ans << endl;

   return 0;
}

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

#include<iostream>
using namespace std;
int main()
{
    // スペース区切りの整数の入力
    int N, K, c;
    cin >> N >> K;
    // 配列の入力
    int a[N];
　　for ( int i = 0, i < N; i++)
　　{
　　　　cin >> a[i];
　　}
    if(N % (K - 1) == 0){
    c = N / (K - 1);
    }else{
    c = N / (K - 1) + 1;
    }
    // 出力
    cout << c << endl;
    return 0;
}

Compiler output:
a.cc:10:1: error: extended character 　 is not valid in an identifier
   10 | 　　for ( int i = 0, i < N; i++)
      | ^
a.cc:10:1: error: extended character 　 is not valid in an identifier
a.cc:11:1: error: extended character 　 is not valid in an identifier
   11 | 　　{
      | ^
a.cc:11:1: error: extended character 　 is not valid in an identifier
a.cc:12:1: error: extended character 　 is not valid in an identifier
   12 | 　　　　cin >> a[i];
      | ^
a.cc:12:1: error: extended character 　 is not valid in an identifier
a.cc:12:1: error: extended character 　 is not valid in an identifier
a.cc:12:1: error: extended character 　 is not valid in an identifier
a.cc:13:1: error: extended character 　 is not valid in an identifier
   13 | 　　}
      | ^
a.cc:13:1: error: extended character 　 is not valid in an identifier
a.cc: In function 'int main()':
a.cc:10:11: error: expected primary-expression before 'int'
   10 | 　　for ( int i = 0, i < N; i++)
      |           ^~~
a.cc:10:22: error: 'i' was not declared in this scope
   10 | 　　for ( int i = 0, i < N; i++)
      |                      ^
Language: C

#include <stdio.h>
int char_count(const char B[]){
  int len;
  while(B[len]){
    len++;

  }return len;
}
int main(void)
{
  int N,K;
  char A[10000];
  int num;


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

  num=char_count(A);
  num=num-3;
  while(i<0){
    num=num-2;
    if(num=0){
      i=-1;
    }
  }
  printf("%d",num);
  return 0;
}


Compiler output:
main.c: In function 'main':
main.c:22:9: error: 'i' undeclared (first use in this function)
   22 |   while(i<0){
      |         ^
main.c:22:9: note: each undeclared identifier is reported only once for each function it appears in
Language: C++

using namespace std;

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

int main() {
    int n = 0;
    int k = 0;
    cin >> n;
    cin >> k;
    int tmp = (n - 1) / (k - 1);
    x =  (n - 1) % (k - 1) == 0 ? tmp : tmp + 1;
    return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:13:5: error: 'x' was not declared in this scope
   13 |     x =  (n - 1) % (k - 1) == 0 ? tmp : tmp + 1;
      |     ^
Language: C++

#include <iostream>
using namespace std;

long long N, K;

int func(long long n, long long count) {
  n -= K;
  count++;
  if (n <= 0) {
    return count;
  }
  return func(n + 1, count);
}

int main() {
  cin >> N >> K;
  long long minn = N + 1, minp;

  long long a[N];
  for (long long i = 0; i < N; i++) {
    cin >> a[i];
    if (a[i] < minn) {
      minn = a[i];
      minp = i;
    }
  }
  long long count = 0;
  minp++;

  if (minp - K < 0) {
    N -= K;
    count += func(N, count) + 1;
  } else if (minp - K > 0) {
    long long left = minp, right = N - minp;
    count += func(left, count);
    count += func(right, count);
  } else {
    long long right = N - minp;
    count += func(right, count) + 1
  }

  cout << count << endl;
  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:39:36: error: expected ';' before '}' token
   39 |     count += func(right, count) + 1
      |                                    ^
      |                                    ;
   40 |   }
      |   ~
Language: C

#include <iostream>

using namespace std;
const int MAXN=100005;
int a[MAXN];
int main()
{
    int n,k,sum=0,x;
    cin>>n>>k;
    for(int i=0;i<n;i++)
    {
        cin>>a[i];
        if(a[i]==1)
            x=i;
    }
    if(n<=k)
       cout<<1<<endl;
    else
    {
        if((n-k)%(k-1)==0)
            sum=(n-k)/(k-1);
        else
            sum=(n-k)/(k-1)+1;
        sum=sum+1;
        cout<<sum<<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>
using namespace std;

int main() 
{
    int n,k;
    cin>>n>>k;
    if(n==k){
        cout<<1<<endl;
        return 0;
    }
    
    int mn=INT_MAX,ind;
    
    for(int i=0;i<n;i++){
        cin>>a[i];
        if(a[i]<mn){
            mn=a[i];
            ind=i;
        }
    }
    int ans=0;
    
    int g = (n-1-ind+1);
    int s = ind+1;
    
    int ch = g-k;
    if(ch<0) ch=0;
    else{
        if(ch%(k-1)==0) ans+=(ch/(k-1));
        else ans+=((ch/(k-1))+1);
        ans++;
    }
    
    ch = s-k;
    if(ch<0) ch=0;
    else{
        if(ch%(k-1)==0) ans+=(ch/(k-1));
        else ans+=((ch/(k-1))+1);
        ans++;
    }
    
    cout<<ans<<endl;
	return 0;
}

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

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

int main() {
    int n,k ;
    cin >> n >> k ;
    vector<int> a(n) ;
    int ans=0 ;
    int f=0 ;
    int f2=0 ;
    for ( int i=0 ; i<n ; i++ ){
        if( a,at(i)==1){
            int j=i ;
            while ( i>-1 ){
                if( i==0 ) f++ ;
                i-=k ;
                ans++ ;
            }
            while ( j<n+1 ){
                if ( j==n ) f2++ ;
                j+=k ;
                ans++ ;
            }
        }
    }
    if ( f==1&&f2==1 ) ans-=2 ;
    else if ( f==0&&f2==0 ) ans+=2 ;
    else ans-- ;
    cout << ans << endl ;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:12:15: error: 'at' was not declared in this scope; did you mean 'a'?
   12 |         if( a,at(i)==1){
      |               ^~
      |               a
Language: C

#include <stdio.h>


int main(int argc, char **argv){
  //読み取り
  int n,k
  scanf("%d %d",&n,&k);
  int a[n];
  int i;
  for(i = 0 ; i < n ; i++){
    scanf("%d",&a[i]);
  }
  
  //最小値を調べる
  int smallest;
  smallest = a[0];
  for(i = 1 ; i < n ; i++){
    if(a[i] < smallest){
      smallest = a[i];
    }
  }
  
  //ガチの計算
  int x,j,count;
  i = k;
  x = 1;
  while(i < n){
    count = 0;
    for(j = 0 ; j < k ; j++){
      if(a[i + j] != smallest){
        count++;
      }
    }
    if(count == k){
      i += 2;
    }
    else{
      i += 3;
    }
    x++;
  }

  return 0;
}


Compiler output:
main.c: In function 'main':
main.c:7:3: error: expected '=', ',', ';', 'asm' or '__attribute__' before 'scanf'
    7 |   scanf("%d %d",&n,&k);
      |   ^~~~~
main.c:25:7: error: 'k' undeclared (first use in this function)
   25 |   i = k;
      |       ^
main.c:25:7: note: each undeclared identifier is reported only once for each function it appears in
Language: C++

 <bits/stdc++.h>

using namespace std;

#define rep(i, a) for (int i = 0; i < a; i++)
#define reps(i, a, b) for (int i = a; i < b; i++)

int K , N;
int A[100000];
int T[100001];

int main()
{
	cin >> N >> K;
	int mia = N;
	T[0] = -1;
	rep(i, N) {
		cin >> A[i];
		mia = min(mia, A[i]);
	}
	int t = 0;
	rep(i, N) {
		if (A[i] == mia) {
			T[t] = i;
			T[t+1] = -1;
		}
	}
	int st = -1;
	int go = T[0];
	int res = 0;
	t = 0;
	while (st < N) {
		if (go - st != 1) {
			res += (go - st + 1) / (K-1);
		}
		cout << st << " " << go << " " << res << endl;
		t++;
		st = go + 1;
		if (T[t] == -1) go = N - 1;
		else go = T[t] - 1;
	}
	cout << res << endl;
	return 0;
}

Compiler output:
a.cc:1:2: error: expected unqualified-id before '<' token
    1 |  <bits/stdc++.h>
      |  ^
a.cc: In function 'int main()':
a.cc:14:9: error: 'cin' was not declared in this scope
   14 |         cin >> N >> K;
      |         ^~~
a.cc:19:23: error: 'min' was not declared in this scope; did you mean 'mia'?
   19 |                 mia = min(mia, A[i]);
      |                       ^~~
      |                       mia
a.cc:36:17: error: 'cout' was not declared in this scope
   36 |                 cout << st << " " << go << " " << res << endl;
      |                 ^~~~
a.cc:36:58: error: 'endl' was not declared in this scope
   36 |                 cout << st << " " << go << " " << res << endl;
      |                                                          ^~~~
a.cc:42:9: error: 'cout' was not declared in this scope
   42 |         cout << res << endl;
      |         ^~~~
a.cc:42:24: error: 'endl' was not declared in this scope
   42 |         cout << res << endl;
      |                        ^~~~
Language: C++

#include <iostream>
using namespace std;
 
int main(){
  int n,k,a[100001],place=0;
  cin >> n >> k;
  for(int i=0;i<n;i++) {
    cin >> a[i];
    if(a[i] == 1)place=i;
  }
  int tmp=place;
  int count=0;
  while(tmp>0){
    tmp=tmp-(k-1);
  	count++;
  }
  while(place<n){
    place=place+(k-1);
    count++;
  }
}
}

Compiler output:
a.cc:22:1: error: expected declaration before '}' token
   22 | }
      | ^
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);

    int 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>>n>>k;
  ri(i,0,n){
    cin>>a;
    if(a==1)b=i;
  }
  p=(b-1)/(k-1)+(n-b)/(k-1);
q=(b-2)/(k-1)+(n-a-1)/(k-1)+1













    cout<<(p>q?p:q)<<"\n";
}



Compiler output:
a.cc: In function 'int main()':
a.cc:25:30: error: expected ';' before 'cout'
   25 | q=(b-2)/(k-1)+(n-a-1)/(k-1)+1
      |                              ^
      |                              ;
......
   39 |     cout<<(p>q?p:q)<<"\n";
      |     ~~~~
Language: C++

#include <iostream>
#include <algorithm>
#include <vector>
using namespace std;
#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define REP(i, n) FOR(i, 0, n)

int solve(vector<int>& a, const int k) {
  int size = a.size();
  int cnt{};
  if (size == k) return 1;./
  while (size >= 1) {
    size = size - k + 1;
    ++cnt;
  }
  return cnt;
}

int main() {
  int n, k;
  vector<int> a;
  cin >> n >> k;
  REP(i, n) {
    int ai;
    cin >> ai;
    a.push_back(ai);
  }
  cout << solve(a, k) << endl;
}

Compiler output:
a.cc: In function 'int solve(std::vector<int>&, int)':
a.cc:11:27: error: expected primary-expression before '.' token
   11 |   if (size == k) return 1;./
      |                           ^
a.cc:11:28: error: expected unqualified-id before '/' token
   11 |   if (size == k) return 1;./
      |                            ^
a.cc:12:3: error: expected primary-expression before 'while'
   12 |   while (size >= 1) {
      |   ^~~~~
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 a[] = new int[N];
		int place = 0;
		for(int i=0; i<N; i++){
			a[i] = sc.nextInt();
			if(a[i]==1)place = i;
		}
		int num = 0;
		num1 += (place+K-2)/(K-1);
		num2 += (N-place+K-3)/(K-1);
		System.out.println(num1+num2);
	}
}

Compiler output:
Main.java:14: error: cannot find symbol
		num1 += (place+K-2)/(K-1);
		^
  symbol:   variable num1
  location: class Main
Main.java:15: error: cannot find symbol
		num2 += (N-place+K-3)/(K-1);
		^
  symbol:   variable num2
  location: class Main
Main.java:16: error: cannot find symbol
		System.out.println(num1+num2);
		                   ^
  symbol:   variable num1
  location: class Main
Main.java:16: error: cannot find symbol
		System.out.println(num1+num2);
		                        ^
  symbol:   variable num2
  location: class Main
4 errors
Language: C++

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

Compiler output:
a.cc:3:5: error: cannot declare '::main' to be a global variable
    3 | int main{
      |     ^~~~
a.cc:4:3: error: expected primary-expression before 'int'
    4 |   int n,k;
      |   ^~~
a.cc:4:3: error: expected '}' before 'int'
a.cc:3:9: note: to match this '{'
    3 | int main{
      |         ^
a.cc:5:3: error: 'cin' does not name a type
    5 |   cin>>n>>k;
      |   ^~~
a.cc:6:3: error: 'cout' does not name a type
    6 |   cout<<n/(k-1)<<endl;
      |   ^~~~
a.cc:7:3: error: expected unqualified-id before 'return'
    7 |   return 0;
      |   ^~~~~~
a.cc:8:1: error: expected declaration before '}' token
    8 | }
      | ^
Language: C++

for(int i=0;i<n;i++)
    {
        cin>>a[i];
        if(a[i]<maxs)
        {
            b=i;
            maxs=a[i];
        }
    }
    d=(b+1)/(k-1);
    e=(n-b)/(k-1);
    sum=d+e;
    
    cout<<sum<<endl;
   

Compiler output:
a.cc:1:1: error: expected unqualified-id before 'for'
    1 | for(int i=0;i<n;i++)
      | ^~~
a.cc:1:13: error: 'i' does not name a type
    1 | for(int i=0;i<n;i++)
      |             ^
a.cc:1:17: error: 'i' does not name a type
    1 | for(int i=0;i<n;i++)
      |                 ^
a.cc:10:5: error: 'd' does not name a type
   10 |     d=(b+1)/(k-1);
      |     ^
a.cc:11:5: error: 'e' does not name a type
   11 |     e=(n-b)/(k-1);
      |     ^
a.cc:12:5: error: 'sum' does not name a type
   12 |     sum=d+e;
      |     ^~~
a.cc:14:5: error: 'cout' does not name a type
   14 |     cout<<sum<<endl;
      |     ^~~~
Language: C

#include<stdio.h>
int main()
{
    int n,k,i,rem=0,pre=0;
    scanf("%d%d",&n,&k);
    int a[n];
    for(i=1;i<=n;i++)
    {
        scanf("%d",&a[i]);
        if(a[n]==1)
        {
            ans++;
        }
    }
        pre=n%k;
        rem= ((n/k)+pre-ans);
    printf("%d",rem);
    return 0;
}

Compiler output:
main.c: In function 'main':
main.c:12:13: error: 'ans' undeclared (first use in this function)
   12 |             ans++;
      |             ^~~
main.c:12:13: note: each undeclared identifier is reported only once for each function it appears in
Language: C++

#include <iostream>
using namespace std;

int main(){
  int n,k,a[100001],place=0;
  cin >> n >> k;
  for(int i=0;i<n;i++) {
    cin >> a[i];
    if(a[i] == 1)place=i;
  }
  int sum=0;
  sum += (place+1)/k;
  if((place+1)%k) != 0)sum++;
  n -= (place+1);
  sum += n/k;
  if((n%k) != 0)sum++;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:13:19: error: expected primary-expression before '!=' token
   13 |   if((place+1)%k) != 0)sum++;
      |                   ^~
Language: C++

#include<bits/stdc++.h>

using namespace std;

int main(){
	
	int n,k;
	
	cin >> n >> k;
	
	int a[n];
	int one	for(int i=0;i<n;i++){
		cin >> a[i];
	}
	
	int b=n-1,ans=0;
	
	for(;b>0;){
		ans++;
		b-=2;
	}
	
	cout << ans << endl;
	
	return 0;
	
}

Compiler output:
a.cc: In function 'int main()':
a.cc:12:17: error: expected initializer before 'for'
   12 |         int one for(int i=0;i<n;i++){
      |                 ^~~
a.cc:12:29: error: 'i' was not declared in this scope
   12 |         int one for(int i=0;i<n;i++){
      |                             ^
Language: C++

#include<string>
#include<vector>
#include<list>
#include<stack>
#include<queue>
#include<map>
#include<tuple>
#include<algorithm>
#include<numeric>
#include<cmath>

using namespace std;

using ll = long long;
using ld = long double;
using pii = pair<int, int>;
using vi = vector<int>;

const int mod = 1e9 + 7;
const long double pi = 3.141592653589793238462643383279502884197;
const long double eps = 1e-7;


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

	vector<ll> A(N);
	for (int i = 0; i < N; ++i) {
		cin >> A[i];
	}

	if (N <= K) cout << 1 << endl;
	else {
		int result = (N - 1) / (K - 1);
		if (result * (K - 1) != (N - 1)) ++result;
		cout << result << endl;
	}

	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:26:9: error: 'cin' was not declared in this scope
   26 |         cin >> N >> K;
      |         ^~~
a.cc:11:1: note: 'std::cin' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
   10 | #include<cmath>
  +++ |+#include <iostream>
   11 | 
a.cc:33:21: error: 'cout' was not declared in this scope
   33 |         if (N <= K) cout << 1 << endl;
      |                     ^~~~
a.cc:33:21: note: 'std::cout' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
a.cc:33:34: error: 'endl' was not declared in this scope
   33 |         if (N <= K) cout << 1 << endl;
      |                                  ^~~~
a.cc:11:1: note: 'std::endl' is defined in header '<ostream>'; this is probably fixable by adding '#include <ostream>'
   10 | #include<cmath>
  +++ |+#include <ostream>
   11 | 
a.cc:37:17: error: 'cout' was not declared in this scope
   37 |                 cout << result << endl;
      |                 ^~~~
a.cc:37:17: note: 'std::cout' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
a.cc:37:35: error: 'endl' was not declared in this scope
   37 |                 cout << result << endl;
      |                                   ^~~~
a.cc:37:35: note: 'std::endl' is defined in header '<ostream>'; this is probably fixable by adding '#include <ostream>'
Language: C++

n, k = gets.split(" ").map{|d| d.to_i }
a = gets.split(" ").map{|k| k.to_i }
puts a.size / (k-1)

Compiler output:
a.cc:1:1: error: 'n' does not name a type
    1 | n, k = gets.split(" ").map{|d| d.to_i }
      | ^
a.cc:2:1: error: 'a' does not name a type
    2 | a = gets.split(" ").map{|k| k.to_i }
      | ^
a.cc:3:1: error: 'puts' does not name a type
    3 | puts a.size / (k-1)
      | ^~~~
Language: C++

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

int main() {
    int n,k ;
    cin >> n >> k ;
    vector<int> a(n) ;
    int ans=0 ;
    for ( int i=0 ; i<n ; i++ ){
        if( a,at(i)==1){
            while ( i>0 ){
                i-=k ;
                ans++ ;
            }
            while ( i<n ){
                i+=k ;
                ans++ ;
            }
            ans+=2 ;
        }
    }
    cout << ans << endl ;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:10:15: error: 'at' was not declared in this scope; did you mean 'a'?
   10 |         if( a,at(i)==1){
      |               ^~
      |               a
Language: C++

#include <iostream>
using namespace std;

int main()
{
	int n, k;

	cin >> n >> k;

	n = n - k;

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

	return 0;
}


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

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

int main(){
	int n, k;
	cin >> n >> k;
	vector<int> v(n);
	for(int i = 0; i < n; i++){
		cin >> v[i];
	}
	int one;
	for(int i = 0; i < n; i++){
		if(v[i] == 1){
			one = i;
		}
	}
	int ans = 0;
	int I = i + 1;
	if(i == 0 || i == n - 1){
		while(n > 0){
			n -= k;
			if(n != 0){
				n++;
			}
			ans++;
		}
	} else {
		int N = n - I, M = I - 1;
		ans++;
		while(N > 0){
			N -= k;
			if(N != 0){
				N++;
			}
			ans++;
		}
		while(M > 0){
			M -= k;
			if(M != 0){
				M++;
			}
			ans++;
		}
	}
	cout << ans << endl;
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:18:17: error: 'i' was not declared in this scope
   18 |         int I = i + 1;
      |                 ^
Language: C++

#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <cmath>
#include <cstdlib>
#include <tuple>
#include <queue>
using namespace std;
using ll=long long;
//using R=double;

const int INF = 10000000;
typedef pair<int, int> p;



int main(){
	int N,K;
	cin >> N >> K;
	int a[N];
	int one;
	for(int i = 0; i < N; i++){
		cin >> a[i];
		if(a[i]==1){
			one = i;
		}
	}
	int result = 0;
	result = result + (one/(K-1));
	if((one%(K-1))!=0){
		result++;
	}
	result = result + (N-1-one)/(K-1);
	if((N-1-one)%(K-1)!=0){
		result++
	}
	cout << result << endl;
	return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:36:25: error: expected ';' before '}' token
   36 |                 result++
      |                         ^
      |                         ;
   37 |         }
      |         ~
Language: Java

public class Main {
    public static void main(String args[]) {
        try (Scanner in = new Scanner(System.in)) {
            int N = in.nextInt();
            int K = in.nextInt();
            int[] A = new int[N];
            for (int i = 0; i < A.length; i++) {
                A[i] = in.nextInt();
            }

            int indexOf1 = -1;
            for (int i = 0; i < A.length; i++) {
                if (A[i] == 1) {
                    indexOf1 = i;
                    break;
                }
            }
            Utils.debug("indexOf1", indexOf1);

            int min = (int) 1e9;
            for (int start = Math.max(0, indexOf1 - (K - 1)); start <= indexOf1; start++) {
                if (start <= indexOf1 && indexOf1 < start + K) {
                } else {
                    Utils.debug("@");
                }

                int count = 1;
                for (int i = start; i > 0; count++, i -= K - 1) {
                }
                Utils.debug(start, "count", count);
                for (int i = start + (K - 1); i < N - 1; count++, i += K - 1) {
                }
                Utils.debug(start, "count", count);
                // count += start / K;
                // count += ((N - 1) - (start + (K - 1))) / K;
                min = Math.min(min, count);
            }

            System.out.println(min);
        }
    }

}

final class Utils {
    private Utils() {
    }

    public static final void debug(Object... o) {
        System.err.println(toString(o));
    }

    public static final String toString(Object... o) {
        return Arrays.deepToString(o);
    }

}


Compiler output:
Main.java:3: error: cannot find symbol
        try (Scanner in = new Scanner(System.in)) {
             ^
  symbol:   class Scanner
  location: class Main
Main.java:3: error: cannot find symbol
        try (Scanner in = new Scanner(System.in)) {
                              ^
  symbol:   class Scanner
  location: class Main
Main.java:54: error: cannot find symbol
        return Arrays.deepToString(o);
               ^
  symbol:   variable Arrays
  location: class Utils
3 errors
Language: Java

#include <bits/stdc++.h>

using namespace std;

int A[101010];
int main(void){
	int N, K;
	scanf("%d %d", &N, &K);
	for(int i = 0; i < N;++i){
		scanf("%d", A + i);
	}

	printf("%d\n", (int)floor((double)N/(K-1)));
	return 0;
}

Compiler output:
Main.java:1: error: illegal character: '#'
#include <bits/stdc++.h>
^
Main.java:1: error: class, interface, enum, or record expected
#include <bits/stdc++.h>
         ^
Main.java:5: error: class, interface, enum, or record expected
int A[101010];
^
Main.java:6: error: unnamed classes are a preview feature and are disabled by default.
int main(void){
^
  (use --enable-preview to enable unnamed classes)
Main.java:6: error: <identifier> expected
int main(void){
             ^
Main.java:8: error: illegal start of expression
	scanf("%d %d", &N, &K);
	               ^
Main.java:8: error: illegal start of expression
	scanf("%d %d", &N, &K);
	                   ^
7 errors
Language: Java



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

public final class D {

    public static void main(String[] args) {
        final Scanner in = new Scanner(new BufferedReader(new InputStreamReader(System.in)));
        final long n = Long.parseLong(in.nextLine());
        long k = 0, kk = 1;
        for (int i = 0; i < n; i++) {
            if ((k / kk) % 10 == 9 && f(k + kk) > f(k + 10 * kk)) { 
                kk *= 10;
            }
            k += kk;
            System.out.println(k);
        }
    }

    private static double f(long num) {
        long copy = num;
        long sum = 0;
        while (copy > 0) {
            sum += copy % 10;
            copy /= 10;
        }
        return (double) num / sum;
    }
}


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

#include<bits/stdc++.h>
using namespace std;
int main()
{
  long long int k,i,t;
  cin>>k;
  for(i=1;i<=k;i++)
  {
    t=i/9;
    if(i%9!=0)
    cout<<i%9;
      while(t--)
        cout<<9;
    cout<<"\n;
  }
  return 0;
}
    

Compiler output:
a.cc:14:11: warning: missing terminating " character
   14 |     cout<<"\n;
      |           ^
a.cc:14:11: error: missing terminating " character
   14 |     cout<<"\n;
      |           ^~~~
a.cc: In function 'int main()':
a.cc:15:3: error: expected primary-expression before '}' token
   15 |   }
      |   ^