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

#include<iostream>
using namespace std;
unsigned long long intcount(string s)
{
	unsigned long long intcount1=1,finacount=0;
	for(unsigned long long inti=0;i<s.length()-1;i++)
	{
		while(i<s.length()-1&&s[i]==s[i+1])
		{
			count1++;
			i++;
		}
		finacount+=count1/2;
		count1=1;
	}
	return finacount;
}
int main()
{
	string s;
	unsigned long long intk;
	cin>>s;
	cin>>k;
	unsigned long long intsfinacount=0,dfinacount=0;
	//single
	sfinacount+=count(s);
	//double
	string p="";
	p=s+s;
	dfinacount+=count(p);
	if(dfinacount==2*sfinacount)
	{
		sfinacount*=k;
	}
	else
	{
		sfinacount*=k;
		sfinacount+=k-1;
	}
	cout<<sfinacount;
}

Compiler output:
a.cc: In function 'long long unsigned int intcount(std::string)':
a.cc:6:39: error: 'i' was not declared in this scope
    6 |         for(unsigned long long inti=0;i<s.length()-1;i++)
      |                                       ^
a.cc:10:25: error: 'count1' was not declared in this scope; did you mean 'intcount1'?
   10 |                         count1++;
      |                         ^~~~~~
      |                         intcount1
a.cc:13:28: error: 'count1' was not declared in this scope; did you mean 'intcount1'?
   13 |                 finacount+=count1/2;
      |                            ^~~~~~
      |                            intcount1
a.cc: In function 'int main()':
a.cc:23:14: error: 'k' was not declared in this scope
   23 |         cin>>k;
      |              ^
a.cc:26:9: error: 'sfinacount' was not declared in this scope; did you mean 'dfinacount'?
   26 |         sfinacount+=count(s);
      |         ^~~~~~~~~~
      |         dfinacount
a.cc:26:21: error: 'count' was not declared in this scope
   26 |         sfinacount+=count(s);
      |                     ^~~~~
Language: C++

\#include "bits/stdc++.h"

using namespace std;
typedef long long ll;
#define rep(i,j,n) for (ll i = j; i < (n); i++)
#define CLR(mat) memset(mat, 0, sizeof(mat))
#define IN(a, b, x) (a<=x&&x<b)
#define out(ans) cout << ans << endl
typedef pair<ll,ll>P;
const ll mod=1e9+7;
const ll INF = 1e9;

int main(){

  string s;cin>>s;
  ll k;cin>>k;
  ll n=s.size();

  ll count=0;
  ll cn=0;
  rep(i,0,n-1){
    if(s[i]==s[i+1])count++;
    else {
      cn+=(count+1)/2;
      count=0;
    }
  }
  cn+=(count+1)/2;

  string a=s;
  a+=a;

  ll num=0;
  ll cc=0;
  rep(i,0,a.size()-1){
    if(a[i]==a[i+1])cc++;
    else {
      num+=(cc+1)/2;
      cc=0;
    }
  }
  num+=(cc+1)/2;

  if(2*cn!=num&&s[0]==s[n-1])cn++;
  if(k%2==0)out(num*k/2);
  else out(num*(k/2)+cn);

  return 0;
}


Compiler output:
a.cc:1:1: error: stray '\' in program
    1 | \#include "bits/stdc++.h"
      | ^
a.cc:1:2: error: stray '#' in program
    1 | \#include "bits/stdc++.h"
      |  ^
a.cc:1:3: error: 'include' does not name a type
    1 | \#include "bits/stdc++.h"
      |   ^~~~~~~
a.cc:9:9: error: 'pair' does not name a type
    9 | typedef pair<ll,ll>P;
      |         ^~~~
a.cc: In function 'int main()':
a.cc:15:3: error: 'string' was not declared in this scope
   15 |   string s;cin>>s;
      |   ^~~~~~
a.cc:15:12: error: 'cin' was not declared in this scope
   15 |   string s;cin>>s;
      |            ^~~
a.cc:15:17: error: 's' was not declared in this scope
   15 |   string s;cin>>s;
      |                 ^
a.cc:30:9: error: expected ';' before 'a'
   30 |   string a=s;
      |         ^~
      |         ;
a.cc:31:3: error: 'a' was not declared in this scope
   31 |   a+=a;
      |   ^
a.cc:8:18: error: 'cout' was not declared in this scope; did you mean 'count'?
    8 | #define out(ans) cout << ans << endl
      |                  ^~~~
a.cc:45:13: note: in expansion of macro 'out'
   45 |   if(k%2==0)out(num*k/2);
      |             ^~~
a.cc:8:33: error: 'endl' was not declared in this scope
    8 | #define out(ans) cout << ans << endl
      |                                 ^~~~
a.cc:45:13: note: in expansion of macro 'out'
   45 |   if(k%2==0)out(num*k/2);
      |             ^~~
a.cc:8:18: error: 'cout' was not declared in this scope; did you mean 'count'?
    8 | #define out(ans) cout << ans << endl
      |                  ^~~~
a.cc:46:8: note: in expansion of macro 'out'
   46 |   else out(num*(k/2)+cn);
      |        ^~~
a.cc:8:33: error: 'endl' was not declared in this scope
    8 | #define out(ans) cout << ans << endl
      |                                 ^~~~
a.cc:46:8: note: in expansion of macro 'out'
   46 |   else out(num*(k/2)+cn);
      |        ^~~
Language: Java

import java.io.*;
class ConnAndDis{
  public static void main()throws IOException{
    BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
    int S = br.readLine();
    int T = Integer.parseInt(br.readLine());
    char ch[] = new char[S.length()];
    ch[0] = S.charAt(0);
    for(int i=1;i<S.length()-1;i++){
      if(S.charAt(i-1) == S.charAt(i)){
        ch[i] = '0';
      }else if(S.charAt(i) == S.charAt(i+1)){
        ch[i+1] = '0';
      }else if((S.charAt(i-1) == S.charAt(i))&&(S.charAt(i) == S.charAt(i+1))){
        ch[i] = '0';
      }
    }
    if(s.charAt(0) == s.charAt(S.length()-1)){
      ch[0] = '1';
    }
    int count=0;
    for(int i=0;i<ch.length;i++){
      if(ch[i]=='0'||ch[i]=='1'){
        count++;
      }
    }
    System.out.println(count*T);
    
  }
}

Compiler output:
Main.java:5: error: incompatible types: String cannot be converted to int
    int S = br.readLine();
                       ^
Main.java:7: error: int cannot be dereferenced
    char ch[] = new char[S.length()];
                          ^
Main.java:8: error: int cannot be dereferenced
    ch[0] = S.charAt(0);
             ^
Main.java:9: error: int cannot be dereferenced
    for(int i=1;i<S.length()-1;i++){
                   ^
Main.java:10: error: int cannot be dereferenced
      if(S.charAt(i-1) == S.charAt(i)){
          ^
Main.java:10: error: int cannot be dereferenced
      if(S.charAt(i-1) == S.charAt(i)){
                           ^
Main.java:12: error: int cannot be dereferenced
      }else if(S.charAt(i) == S.charAt(i+1)){
                ^
Main.java:12: error: int cannot be dereferenced
      }else if(S.charAt(i) == S.charAt(i+1)){
                               ^
Main.java:14: error: int cannot be dereferenced
      }else if((S.charAt(i-1) == S.charAt(i))&&(S.charAt(i) == S.charAt(i+1))){
                 ^
Main.java:14: error: int cannot be dereferenced
      }else if((S.charAt(i-1) == S.charAt(i))&&(S.charAt(i) == S.charAt(i+1))){
                                  ^
Main.java:14: error: int cannot be dereferenced
      }else if((S.charAt(i-1) == S.charAt(i))&&(S.charAt(i) == S.charAt(i+1))){
                                                 ^
Main.java:14: error: int cannot be dereferenced
      }else if((S.charAt(i-1) == S.charAt(i))&&(S.charAt(i) == S.charAt(i+1))){
                                                                ^
Main.java:18: error: cannot find symbol
    if(s.charAt(0) == s.charAt(S.length()-1)){
       ^
  symbol:   variable s
  location: class ConnAndDis
Main.java:18: error: int cannot be dereferenced
    if(s.charAt(0) == s.charAt(S.length()-1)){
                                ^
Main.java:18: error: cannot find symbol
    if(s.charAt(0) == s.charAt(S.length()-1)){
                      ^
  symbol:   variable s
  location: class ConnAndDis
15 errors
Language: C++

#include<iostream>
#include<string>

using namespace std;

int main(){
    string S;
    cin >> S;
    long K;
    cin >> K;
    int n = S.size();

    long cnt = 0;
    for(int i=0; i<n -1; i++){
        if(S[i] == S[i+1]){
            cnt++;
            S[i+1] = '*';
        }
    }

    long ans = cnt * K;
    if(S[0] == S[n-1]){
        ans += K - 1;
    }
    if(n == 1) cout << K/2 << endl;
  	else if(tmp[0] == tmp[1] && tmp[0] == tmp[n-1]) cout << ans -K + 1 <<endl;
    else cout << ans << endl;
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:26:17: error: 'tmp' was not declared in this scope; did you mean 'tm'?
   26 |         else if(tmp[0] == tmp[1] && tmp[0] == tmp[n-1]) cout << ans -K + 1 <<endl;
      |                 ^~~
      |                 tm
Language: C++

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

    string s;
    ll k;
    ll sum=0;
    cin>>s>>k;
    int n=s.size();

    int i;
    for(i=1;i<n;++i) {
        if(s[i]==s[i-1]) {
            sum++;
            s[i]=W;
        }
    }
    ll ans=sum*k;
    if(s[0]==s[n-1])     ans=ans+k-1;

    cout<<ans<<endl;

 return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:19:18: error: 'W' was not declared in this scope
   19 |             s[i]=W;
      |                  ^
Language: C++

//----------------------------------------------//
//#include <bits/stdc++.h>
#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <exception>
#include <fstream>
#include <functional>
#include <iomanip>
#include <ios>
#include <iosfwd>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <locale>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <ostream>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdexcept>
#include <streambuf>
#include <string>
#include <typeinfo>
#include <utility>
#include <valarray>
#include <vector>
#define REP(i, n) for(int i = 0; i < n; i++)
#define REPR(i, n) for(int i = n; i >= 0; i--)
#define FOR(i, m, n) for(int i = m; i < n; i++)
#define INF 2e9
#define ALL(v) v.begin(), v.end()
using namespace std;
typedef long long ll;
//----------------------------------------------//
int main(){
    //入力
    string S;
    ll K;
    cin >> S >> K;
    ll count=0;
    bool flag=false;
    REP(i,S.size()){
        if(i == (S.size()-1) ){
            if(S[S.size()-1] == S[0]){
                flag = true;
                continue;
            }
        }
        if(S[i] == S[i+1]){
            count++;
            i++;
        }
    }
    /*
    if(S.size()%2!=0){//奇数の文字数
        if( (S.size()-1)/2 == count){//全部同じ文字（最後の文字だけは不明）
            if(flag){//全部同じ文字（最後の文字まで）
                if(K%2==0) {
                    cout << ll((count * K / 2) + ((count+1) * K / 2)) << endl;
                    return 0;
                }else {
                    cout << ll((count * (K+1) / 2) + ((count+1) * (K-1) / 2)) << endl;
                    return 0;
                }
            }
        }
    }
    */
    if( (S.size()-1)/2 == count){//全部同じ文字（最後の文字だけは不明）
        if(flag){//全部同じ文字（最後の文字まで）
            if(K%2==0) {
                cout << ll( S.size() * K / 2 ) << endl;
                return 0;
            }else {
                cout << ll( (S.size()-1) * K / 2) ) << endl;
                return 0;
            }
        }
    }
    if(flag) cout << ll((count * K) + (K - 1)) << endl;
    else cout << ll((count * K)) << endl;

    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:83:50: error: expected ';' before ')' token
   83 |                 cout << ll( (S.size()-1) * K / 2) ) << endl;
      |                                                  ^~
      |                                                  ;
Language: C++

#include<iostream>
#include<bits/stdc++.h>
using namespace std;
#define mp make_pair
#define pb push_back
#define ll long long

int main()
{
    ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
    string s;
    cin>>s;
    ll k;
    cin>>k;
    int l=0;
    for(int i=0;i<s.length();i++)
    {
        if(s[i]==s[0])
            {l++;
            flag=2;}
        else
                break;
    }
    l++;
    ll c=0;
    for(int i=0;i<s.length()-1;i++)
    {
        if(s[i]==s[i+1])
        {
            s[i+1]=125+i+1;
            c++;
        }
    }
    c=c*k;
    if(s[0]==s[s.length()-1])
    {
        if(l%2==1)
            c+=k-1;
    }
    cout<<c;


}



Compiler output:
a.cc: In function 'int main()':
a.cc:20:13: error: 'flag' was not declared in this scope
   20 |             flag=2;}
      |             ^~~~
Language: C++

#include<iostream>
#include<string>

using namespace std;

typedef long long ll;

string S;
ll K;

int main() {
	cin >> S >> K;
	ll ans = 0;
	int cnt = 0;
	for (int i = 0; i < S.size(); i++) {
		if (S[0] == S[i])cnt++;
	}
	if (cnt == S.size()) {
		cout << (S.size() * K) / 2 << endl;
		return 0;
	}
	//if (S[0] != S[S.size() - 1]) {
		ll length = 1;
		for (int i = 1; i < S.size(); i++) {
			if (S[i] == S[i - 1])length++;
			else {
				ans += (length / 2LL * K);
				length = 1;
			}
		}
	}
/*
	else {
		string s2 = S + S;
		ll length = 1;
		bool f = true;
		for (int i = 1; i <= S.size() * 2; i++) {
			if (s2[i] == s2[i - 1] && i != S.size() - 1)length++;
			else {
				if (i == S.size() - 1) {
					length++, ans += length / 2LL;
				}
				else if (i >= S.size()) {
					ans += length / 2LL * (K - 1);
					break;
				}else {
					if (f) {
						ans += length / 2LL;
						f = false;
					}
					else {
						ans += length / 2LL * K;
					}
					length = 1;
				}
			}
		}
	}
	*/
	cout << ans << endl;
	return 0;
}

Compiler output:
a.cc:60:9: error: 'cout' does not name a type
   60 |         cout << ans << endl;
      |         ^~~~
a.cc:61:9: error: expected unqualified-id before 'return'
   61 |         return 0;
      |         ^~~~~~
a.cc:62:1: error: expected declaration before '}' token
   62 | }
      | ^
Language: C++

#include "bits/stdc++.h"
#define rep(i,n) for(int i = 0; i < n; i++)
typedef long long ll;
using namespace std;
#define llMAX numeric_limits<long long>::max()
#define intMAX numeric_limits<int>::max()
#define d_5 100000
#define d9_7 1000000007
#define vll vector<vector<long long>>
#define vl vector<long long>
#define vi vector<int>
#define vii vector<vector<int>>
#define pb push_back
#define pf push_front
int main(void){
  ll k;
  string s;
  cin>>s>>k;
  int now=1;
  ll tmp=1;
  vl nums={};
  int flag2=0;
  while(now<=s.size()-1){
    if(s[now-1]==s[now]){
      tmp++;
    }else{
      nums.pb(tmp);
      tmp=1;
      flag2=1;
    }
      now++;
  }
  nums.pb(tmp);
  ll sub1=0;
  ll sub2=0;
  ll sub3=0;
  ll sum1=0;
  ll ans=0;
  rep(i,nums.size()-1){
    if(i==0)i=1;
    if(nums.size()<=i)break;
    sum1+=nums[i]/2;
  }
  ans+=sum1*k;
  /*if(k==1|| flag2==0){
    ll an=0;
    rep(i,nums.size()){
      an+=nums[i]/2;
    }
    cout<<an;
    return 0;
  }*/
  //cout<<ans<<endl;
  if(s[0]==s[s.size()-1] && k!=1){
    ans+=(nums[0])/2;
    ans+=(nums[nums.size()-1])/2;
    ans+=(k-1)*((nums[0]+nums[nums.size()-1])/2);
  }else{
    if(nums.size()-1==0){
      ans+=k*(nums[0])/2);

    }else{
      ans+=k*((nums[0])/2+(nums[nums.size()-1])/2);
    }
  }
  if(nums.size()==1){
    ans=(s.size()*k)/2;
  }
  cout<<ans<<endl;
  
  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:60:25: error: expected ';' before ')' token
   60 |       ans+=k*(nums[0])/2);
      |                         ^
      |                         ;
Language: C++

#include<bits/stdc++.h>
using namespace std;
string s;
int t,ans,ls;
long long tt;
int main()
{
	cin>>s>>t;
	ls=s.size();
	for(int i=1;i<ls;i++)
	if(s[i]==s[i-1])
	{
		ans++;
		s[i]=' ';
	}
	tt=1ll*t*ans;
	if(s[ls-1]==s[0])
	tt+=t;
	if(s[ls-1]!+s[ls-2])
	tt--;
	cout<<tt;
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:19:19: error: expected ')' before '!' token
   19 |         if(s[ls-1]!+s[ls-2])
      |           ~       ^
      |                   )
Language: C++

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

int main()
{
	string str;
	long long n;
	long long res;
	cin >> str >> n;
	if(str.size() == 1){
		cout << n / 2 << endl;
		return 0;
	}else {
		int r = 0;
		int xx = str.size();
		for(int i = xx - 1; i > 0; i--){
			if(str[i] != str[i - 1]) {
				r = i;
				break;
			}
		}
		if(r == 0) cout << n * str.size() / 2 << endl;
		else{
			str = str + str;
			int lll = 1;
			int cnt = 0;
			for(int i = r; i < r + str.size() / 2 ; i++){
				if(str[i] == str[i + 1]) lll++;
				else{
					cnt = cnt + lll / 2;
					lll = 1;
				}
			}
			res = cnt * (n - 1);	
			lll = 1;
			cnt = 0;
			for(int i = 0; i < r ; i++){
				if(str[i] == str[i + 1]) lll++;
				else{
					cnt = cnt + lll / 2;
					lll = 1;
				}
			}
			res += cnt;
			res = res + (str.size() / 2 - r) / 2;
			cout << res << endl;
		}	
	}
	return 0;
}#include <bits/stdc++.h>
using namespace std;

int main()
{
	string str;
	long long n;
	long long res;
	cin >> str >> n;
	if(str.size() == 1){
		cout << n / 2 << endl;
		return 0;
	}else {
		int r = 0;
		int xx = str.size();
		for(int i = xx - 1; i > 0; i--){
			if(str[i] != str[i - 1]) {
				r = i;
				break;
			}
		}
		if(r == 0) cout << n * str.size() / 2 << endl;
		else{
			str = str + str;
			int lll = 1;
			int cnt = 0;
			for(int i = r; i < r + str.size() / 2 ; i++){
				if(str[i] == str[i + 1]) lll++;
				else{
					cnt = cnt + lll / 2;
					lll = 1;
				}
			}
			res = cnt * (n - 1);	
			lll = 1;
			cnt = 0;
			for(int i = 0; i < r ; i++){
				if(str[i] == str[i + 1]) lll++;
				else{
					cnt = cnt + lll / 2;
					lll = 1;
				}
			}
			res += cnt;
			res = res + (str.size() / 2 - r) / 2;
			cout << res << endl;
		}	
	}
	return 0;
}


Compiler output:
a.cc:50:2: error: stray '#' in program
   50 | }#include <bits/stdc++.h>
      |  ^
a.cc:50:3: error: 'include' does not name a type
   50 | }#include <bits/stdc++.h>
      |   ^~~~~~~
a.cc:53:5: error: redefinition of 'int main()'
   53 | int main()
      |     ^~~~
a.cc:4:5: note: 'int main()' previously defined here
    4 | int main()
      |     ^~~~
Language: Java

package agc039;

import java.util.Scanner;

public class A {
	public static void main(String[] args){
		Scanner sc1 = new Scanner(System.in);
		String S = sc1.next();

		Scanner sc2 = new Scanner(System.in);
		int K = sc2.nextInt();

		String[] strList = S.split("");
		int[] changeList = new int[strList.length];

		for(int i = 0; i < strList.length - 2; i++){
			if(strList[i].equals(strList[i + 1])){
				strList[i + 1] = "*";
				changeList[i + 1] ++;
			}else{
				if(strList[i + 1].equals(strList[i + 2])){
					strList[i + 2] = "*";
					changeList[i + 2] ++;
				}
			}
		}

		if(strList[0].equals(strList[strList.length - 1])){
			strList[strList.length - 1] = "*";
			changeList[strList.length - 1]++;
		}

		int result = 0;
		for(int count : changeList){
			if(count > 0){
				result++;
			}
		}

		System.out.println(result * K);
	}
}


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

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

int main() {
  string S;
  cin>>S;
  int K;
  cin>>K;
  int l=S.size();
  int ans=0;
  if(S[0]!=S[l-1]){
    int i=0;
    int power=0;
    while(i<l){
      int con=0;
      for(int j=i+1;j<l;j++){
        if(S[i]==S[j]){
          con++;
          power++;
        }
        else{
          int b=power/2;
          ans+=b;
          break;
        }
      }
      i+=con;
    }
    ans*=K;
  }
  else{ 
    int i=0;
    int power=0;
    while(i<l){
      int con=0;
      for(int j=i+1;j<l;j++){
        if(S[i]==S[j]){
          power++;
          con++;
        }
        else{
          int b=power/2;
          ans+=b;
          break;
        }
      }
      i+=con;
    }
    ans*=K
    int box;
    for(int i=1;i<l;i++){
      if(S[0]==S[i]){
        box++;
      }
      else{
        break;
      }
    }
    for(int i=l-2;i>=0;i--){
      if(S[l-1]==S[i]){
        box++;
      }
      else{
        break;
      }
    }
    box=box/2;
    ans+=box*(K-1);
  }
  cout<<ans<<endl;
    
  
}



Compiler output:
a.cc: In function 'int main()':
a.cc:49:11: error: expected ';' before 'int'
   49 |     ans*=K
      |           ^
      |           ;
   50 |     int box;
      |     ~~~    
a.cc:53:9: error: 'box' was not declared in this scope
   53 |         box++;
      |         ^~~
a.cc:61:9: error: 'box' was not declared in this scope
   61 |         box++;
      |         ^~~
a.cc:67:5: error: 'box' was not declared in this scope
   67 |     box=box/2;
      |     ^~~
Language: C++

#include "bits/stdc++.h"
 
using namespace std;
#define int long long int 
#define endl '\n'
const int inf = 1e18;
const int mod = 1e9 + 7;
signed main(){
	#ifdef LOCAL
		freopen("input.txt","r",stdin);
		freopen("output.txt","w",stdout);
	#endif
	string s;
	int k,flag=0,f1=0;
	cin>>s;
	cin>>k;
	int ans=0;
	for (int i = 0; i < s.size()-1; ++i)
	{
		if(s[i]==s[i+1])f1++;
	}
	if(s.size()%2==1 && f1==s.size()-1)
	{
		int x=s.size()/2,an,y=k/2;
		if(k%2==0)an=(x+x+1)*y;
		else an=((x+x+1)*y)+x;
		cout<<an;
	}
	else{		
	for (int i = 0; i < s.size()-1; ++i)
	{
		if(s[i]==s[i+1]){ans++;s[i+1]='.';}		
	}
	if(s[0]==s[s.size()-1]){ans++;flag=1;}
	ans=k*ans;
	if(fl==1)ans=ans-1;
	if(flag==0)
	cout<<ans;
	if(flag==1)
		cout<<ans-1;}
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:36:12: error: 'fl' was not declared in this scope; did you mean 'f1'?
   36 |         if(fl==1)ans=ans-1;
      |            ^~
      |            f1
Language: C++

#include <bits/stdc++.h>
using namespace std;
 
int main(){
	string s; cin>>s;
	long long k; cin>>k;
	int n = s.size();
	long long ans = 0;
  	if (n==1) {
      cout << k/(long long (2)) << endl;
      return 0;
    }
	for(int i=0;i<n-1;i++){
		if (s.at(i) == s.at(i+1)) {
			ans+=k;
			s.at(i+1) = '0';
			i++;
		}
    }
	if(s.at(n-1) == s.at(0)) {
		s.at(0) = '0';
		if (s.at(0) != s.at(1))
          ans+=k-1;
	}
	cout << ans << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:10:18: error: expected primary-expression before 'long'
   10 |       cout << k/(long long (2)) << endl;
      |                  ^~~~
a.cc:10:18: error: expected ')' before 'long'
   10 |       cout << k/(long long (2)) << endl;
      |                 ~^~~~
      |                  )
Language: Java

import java.util.Scanner;

class Main {
	public static void main(String[] args) {
		try (Scanner sc = new Scanner(System.in)) {
			String S = sc.next();
			int length = S.length();
			int K = sc.nextInt();
			if (length == 1) {
				System.out.print(K / 2);
				return;
			}
			char head = S.charAt(0);
			boolean[] bls = new boolean[length];
			char tail = S.charAt(length - 1);
			long firstCount = 0;
			char last = S.charAt(0);
			for (int i = 1; i < length; i++) {
				if (S.charAt(i) == last && bls[i - 1] == false) {
					bls[i] = true;
					firstCount++;
				}
				last = S.charAt(i);
			}
			if (K == 1) {
				System.out.println(firstCount);
				return;
			}
			long count = 0;
			boolean[] bls2 = new boolean[length];
			if (head == tail && bls[length - 1] == false) {
				bls2[0] = true;
				count++;
			}
			last = S.charAt(0);
			for (int i = 1; i < length; i++) {
				if (S.charAt(i) == last && bls2[i - 1] == false) {
					bls2[i] = true;
					count++;
				}
				last = S.charAt(i);
			}
			if (K == 2) {
				System.out.println(firstCount + count);
				return;
			}
			long count3 = 0;
			bls = new boolean[length];
			if (head == tail && bls2[length - 1] == false) {
				bls[0] = true;
				count3++;
			}
			last = S.charAt(0);
			for (int i = 1; i < length; i++) {
				if (S.charAt(i) == last && bls[i - 1] == false) {
					bls[i] = true;
					count3++;
				}
				last = S.charAt(i);
			}
			if (bls[length - 1] == bls2[length - 1] && head == tail) {
				System.out.println(firstCount + count + count3 * (K - 2));
				return;
			}

			long num3 = (K - 1) / 2;
			long num2 = K - 1 - num3;

			long ans = firstCount + count * (num2) + count3 * num3;
			System.out.print(ans);
		}
	}

Compiler output:
Main.java:72: error: reached end of file while parsing
	}
	 ^
1 error
Language: C++

#include <bits/stdc++.h>
using namespace std;
 
int main(){
	string s; cin>>s;
	long long k; cin>>k;
	int n = s.size();
	long long ans = 0;
  	if (n==1) {
      cout << k/long long (2) << endl;
      return 0;
    }
	for(int i=0;i<n-1;i++){
		if (s.at(i) == s.at(i+1)) {
			ans+=k;
			s.at(i+1) = '0';
			i++;
		}
    }
	if(s.at(n-1) == s.at(0)) {
		s.at(0) = '0';
		if (s.at(0) != s.at(1))
          ans+=k-1;
	}
	cout << ans << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:10:17: error: expected primary-expression before 'long'
   10 |       cout << k/long long (2) << endl;
      |                 ^~~~
Language: C

#include <stdio.h>
#include <string.h>
int main(void) {
    int i, len, cnt, mastercnt;
    unsigned long k;
    char s[102];
    scanf("%s", s);
    len = strlen(s);
    s[len] = s[0];
    s[len+1] = '\0';
    scanf("%lu", &k);
    
    cnt = 0;
    mastercnt=0;
    for (i=1; i<=len; i++) {
        if (s[i-1] == s[i]) {
            cnt++;
            if (s[i] == s[i+1]) {
                i++;
            } else if (s[i+1] == '\0') {
                cnt--;
                if (cnt ==0;) {
                    mastercnt=1;
                }
            }
        }
    }

    printf("%lu", k*cnt+mastercnt);

    return 0;
}

Compiler output:
main.c: In function 'main':
main.c:22:28: error: expected ')' before ';' token
   22 |                 if (cnt ==0;) {
      |                    ~       ^
      |                            )
Language: C++

include <iostream>

using namespace std;

int main() {
  string s;
  int k;
  cin >> s >> k;
  int tmp = 1, buf = 0;
  long long ans = 0;
  for (int i = 1; i < s.size(); i++) {
    if (s[i-1] == s[i]) {
      tmp += 1;
    }
    else {
      if (!buf) buf = tmp;
      ans += tmp / 2;
      tmp = 1;
    }
  }
  if (!buf) {
    ans = tmp;
    ans = ans * k / 2;
    cout << ans << endl;
    return 0;
  }
  ans += tmp / 2;
  ans *= k;
  if (s.front() == s.back() && buf % 2 && tmp % 2) {
    ans += (k - 1);
  }
  cout << ans << endl;
}

Compiler output:
a.cc:1:1: error: 'include' does not name a type
    1 | include <iostream>
      | ^~~~~~~
a.cc: In function 'int main()':
a.cc:6:3: error: 'string' was not declared in this scope
    6 |   string s;
      |   ^~~~~~
a.cc:8:3: error: 'cin' was not declared in this scope
    8 |   cin >> s >> k;
      |   ^~~
a.cc:8:10: error: 's' was not declared in this scope
    8 |   cin >> s >> k;
      |          ^
a.cc:24:5: error: 'cout' was not declared in this scope
   24 |     cout << ans << endl;
      |     ^~~~
a.cc:24:20: error: 'endl' was not declared in this scope
   24 |     cout << ans << endl;
      |                    ^~~~
a.cc:32:3: error: 'cout' was not declared in this scope
   32 |   cout << ans << endl;
      |   ^~~~
a.cc:32:18: error: 'endl' was not declared in this scope
   32 |   cout << ans << endl;
      |                  ^~~~
Language: C++

#include <bits/stdc++.h>
using namespace std;
typedef long long  ll;
typedef vector<int> VI;
typedef vector<ll> VLL;

int main(){
   string s,tmp;
   ll k,one=0,second=0;
   cin >> s >> k;
    tmp =s;
    ll size = s.size();
    
    for(ll i=0; i<size-1; ++i){
        if(s[i] == s[i+1]){
            ++one;
            ++i;
        }
    }
    tmp[0] = tmp[0] + 1;
    for(ll i=1; i< size-1; ++i){
        if(tmp[i] == tmp[i+1]){
            ++second;
            ++i;
        }
    }
    /*
    ll ans = 0;
    if(s[0] == s[size-1]&&s[0]==s[1]){
        ans=one*k;
    }else if(s[0]==s[size-1] && s[0] != s[1]){
        ans = one + (one+1)*(k-1);
    }else{
        ans = one*k;
    }*/
    if(s[0] == s[size-1] && s[size -2] != s[size-1]){
        cout << one + (second+1) *(k-1) endl;
        return 0; 
        }
    cout << one*k << endl;
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:37:40: error: expected ';' before 'endl'
   37 |         cout << one + (second+1) *(k-1) endl;
      |                                        ^~~~~
      |                                        ;
Language: C++

#include <bits/stdc++.h>
#pragma GCC optimize("O3")
#define REP(i,n) for(int i=0;i<n;i++)
#define REPP(i,n) for(int i=1;i<=n;i++)
#define ALL(obj) (obj).begin(), (obj).end()
#define EPS (1e-9)
#define INF (1e9)
#define PI (acos(-1))
//const double PI = acos(-1);
//const double EPS = 1e-15;
//long long INF=(long long)1E17;
#define i_7 (long long)(1e9+7)
long mod(long a){
    long long c=a%i_7;
    if(c>=0)return c;
    return c+i_7;
}
using namespace std;

bool prime_(int n){
  if(n==1){
    return false;
  }else if(n==2){
    return true;
  }else{
    for(int i=2;i<=sqrt(n);i++){
      if(n%i==0){
        return false;
      }
    }
    return true;
  }
}

long long gcd_(long long a, long long b){
  if(a<b){
    swap(a,b);
  }
  if(a%b==0){
    return b;
  }else{
    return gcd_(b,a%b);
  }
}
 
long long lcm_(long long x, long long y){
  return (x/gcd_(x,y))*y;
}

int main(){
  
  string s;
  cin>>s;
  long long k;
  cin>>k;
  int n = s.size();
  long long dp[n][2] = {};
  bool f[n] = {};
  REP(i,n){
    REP(j,2){
      if(i==0){
        if(j==0){
          dp[i][j] = 0;
        }else{
          dp[i][j] = 1;
        }
        continue;
      }
      if(j==0){
        if(s[i-1]==s[i]){
          dp[i][j] = dp[i-1][1];
        }else{
          dp[i][j] = min(dp[i-1][0], dp[i-1][1]);
        }
      }else{
        dp[i][j] = min(dp[i-1][0]+1, dp[i-1][1]+1);
      }
    }
  }
  
  long long ans;
  //long long cand[2];
  //cand[1] = dp[n-1][1]*k;
  ans = dp[n-1][1]*k;
  if(s[n-1] != s[0]){
    ans = min(ans, dp[n-1][0]*k)
  }
  cout<<ans<<endl;
  return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:86:33: error: expected ';' before '}' token
   86 |     ans = min(ans, dp[n-1][0]*k)
      |                                 ^
      |                                 ;
   87 |   }
      |   ~
Language: C++

#include<bits/stdc++.h>
using namespace std;
 
#define lp(i, x, y) for(int i = x ; i < y ; i++)
#define lp_rev(i, x, y) for(int i = x ; i >= y ; i--)
#define ff first
#define ss second
#define pb(x) push_back(x)
#define mp(x,y) make_pair(x,y)
#define all(v)  v.begin(), v.end()
#define vll vector<long long int>
#define vi vector<int>
#define Fasttt ios_base::sync_with_stdio(NULL);cin.tie(NULL);cout.tie(NULL);
typedef unsigned long long ull;
typedef long long ll;
#define endl "\n"
ll mod = 1000000007;
 
int main()
{
	Fasttt;
	string s, t;
	ll k, cnt = 0, cnt1 = 0, cnt2 = 0;
	cin>> s>> k;
	t = s + s;
	int n = s.size();
	if(s.size() == 1)
		return cout<< k - 1, 0;
	if(s.size() == 2)
	{
		if(s[0] == s[1])
			return cout<< k, 0;
		else
			return cout<< 0, 0;
	}
	lp(i, 1, s.size())
	{
		if(s[i] == s[i - 1])
		{
			cnt++;
			if(s[i] == s[i + 1])
				i++;
		}
	}
	lp(i, 1, t.size())
	{
		if(t[i] == t[i - 1])
		{
			cnt1++;
			if(t[i] == t[i + 1])
				i++;
		}
	}
	t = t + s;
	lp(i, 1, t.size())
	{
		if(t[i] == t[i -
		 1])
		{
			cnt2++;
			if(t[i] == t[i + 1])
				i++;
		}
	}
	if(k == 1)
		cout<< cnt;
	else if(k == 2)
		cout<< cnt1;
	else if(l == 3)
		cout<< cnt2;
	else
		cout<< cnt2 + (k - 3) * (cnt2 - cnt1);
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:69:17: error: 'l' was not declared in this scope
   69 |         else if(l == 3)
      |                 ^
Language: C++

#include <bits/stdc++.h>
using namespace std;
 
int main(){
	string s; cin>>s;
	long long k; cin>>k;
	int n = s.size();
	long long ans = 0;
  	if (n==1) {
      cout << 0 << endl;
      return 0
    }
	for(int i=0;i<n-1;i++){
		if (s.at(i) == s.at(i+1)) {
			ans+=k;
			s.at(i+1) = '0';
			i++;
		}
    }
	if(s.at(n-1) == s.at(0)) {
		s.at(0) = '0';
		if (s.at(0) != s.at(1))
          ans+=k-1;
	}
	cout << ans << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:11:15: error: expected ';' before '}' token
   11 |       return 0
      |               ^
      |               ;
   12 |     }
      |     ~
Language: C++

long long int opn(string s, int n){
  int opcnt =0;
  for(int i=0;i<s.size();i++){
    int repcnt=1;
    if(s[i+1]==s[i]){
        while(i<s.size() && s[i+1]==s[i]){
            repcnt++;
		    i++;
        }
        opcnt += repcnt/2;
        i--;
    }
  }
    long long int ans= 1LL * opcnt * n;
    if(s.size()&1 && s.at(0)==s.at(s.size()-1)) ans++;

  	return ans;
}
 
int main(){
  string s;
  int n;
  cin<<s<<n;
  cout<<opn(s,n);
  return 0;
}

Compiler output:
a.cc:1:19: error: 'string' was not declared in this scope
    1 | long long int opn(string s, int n){
      |                   ^~~~~~
a.cc:1:29: error: expected primary-expression before 'int'
    1 | long long int opn(string s, int n){
      |                             ^~~
a.cc:1:34: error: expression list treated as compound expression in initializer [-fpermissive]
    1 | long long int opn(string s, int n){
      |                                  ^
a.cc: In function 'int main()':
a.cc:21:3: error: 'string' was not declared in this scope
   21 |   string s;
      |   ^~~~~~
a.cc:23:3: error: 'cin' was not declared in this scope
   23 |   cin<<s<<n;
      |   ^~~
a.cc:23:8: error: 's' was not declared in this scope
   23 |   cin<<s<<n;
      |        ^
a.cc:24:3: error: 'cout' was not declared in this scope
   24 |   cout<<opn(s,n);
      |   ^~~~
a.cc:24:12: error: 'opn' cannot be used as a function
   24 |   cout<<opn(s,n);
      |         ~~~^~~~~
Language: C++

#include <bits/stdc++.h>
using namespace std;
 
int main(){
	string s; cin>>s;
	long long k; cin>>k;
	int n = s.size();
	long long ans = 0;
  
	for(int i=0;i<n-1;i++){
		if (s.at(i) == s.at(i+1)) {
			ans+=k;
			i++;
			s.at(i+1) = '0';
		}
	if(s.at(n-1) == s.at(0)) {
		s.at(0) = '0';
		if (s.at(0) != s.at(1))
          ans+=k-1;
	}
	cout << ans << endl;
}

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

#include <bits/stdc++.h>
using namespace std;
 
int main(){
	string s; cin>>s;
	long long k; cin>>k;
	int n = s.size();
	long long ans = 0;
  
	for(int i=0;i<n-1;i++){
		if (s.at(i) == s.at(i+1)) {
			ans+=k;
			i++;
			s.at(i+1) = '0';
		}
	if(s.at(n-1) == s.at(0)) {
		s.at(0) = '0';
		if s.at(0) != s.at(1) 		ans+=k-1;
	}
	cout << ans << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:18:20: error: expected '(' before 's'
   18 |                 if s.at(0) != s.at(1)           ans+=k-1;
      |                    ^
      |                    (
a.cc:21:2: error: expected '}' at end of input
   21 | }
      |  ^
a.cc:4:11: note: to match this '{'
    4 | int main(){
      |           ^
Language: C++

#include <bits/stdc++.h>
using namespace std;
 
int main(){
	string s; cin>>s;
	long long k; cin>>k;
	int n = s.size();
	long long ans = 0;
  
	for(int i=0;i<n-1;i++){
		if (s.at(i) == s.at(i+1)) {
			ans+=k;
			i++;
			s.at(i+1) = '0';
		}
	if(s.at(n-1)) == s.at(0)) {
		s.at(0) = '0';
		if s.at(0) != s.at(1) 		ans+=k-1;
	}
	cout << ans << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:16:23: error: expected primary-expression before '==' token
   16 |         if(s.at(n-1)) == s.at(0)) {
      |                       ^~
a.cc:21:2: error: expected '}' at end of input
   21 | }
      |  ^
a.cc:4:11: note: to match this '{'
    4 | int main(){
      |           ^
Language: C++

#include <bits/stdc++.h>
#define int int64_t
#define rep(i, N) for(int i=0; i<N; i++)
using namespace std;
//using pair = pair<int, int>;
using tup  = tuple<int, int, int>;
using vec  = vector<int>;
using vvec = vector<vec>;

//プロトタイプ宣言
//int myfunc(int, vvec);

//グローバル変数
//int N, M;
//vvec data(N, vec(M));

//関数：
int gcd(int mx, int mn) {
	if(mn == 0) return(mx);
	else gcd(mn, mx%mn);
}

bool has_divisor(int n, int i) {
	//base case 1:
	if (i == n) return false;
	//base case 2:
	if (n % i == 0) return true;
	return has_divisor(n, i+1);
}

bool is_prime(int n) {
	if (n == 1) return false;
	else if (n == 2) return true;
	else {
		return !has_divisor(n, 2);
	}
}

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

	string S; cin >> S;
	int K; cin >> K;
	int lg = S.size();
	vec c(lg, 0);
	bool frag = fault;

	rep(i, lg-1) {
		if(S[i] == S[i+1] && c[i] == 0) {
			c[i+1] = 1;
//			if(i != 0) c[i+1] = 1;
//			else {
//				c[0] = 1;
//				c[1] = 0;
//				frag = true;
//			}
		}
	}
	int ct = 0;
	rep(i, lg) if(c[i] == 1) ct += 1;
	ct *= K;
	if(S[0] == S[lg-1] && c[lg-1] == 0 && S[0] != S[2]) {
		ct += K-1;
	}

	cout << ct << endl; 
	return 0;
}
//std::string str;
//str = std::to_string(int i);
//bitset<3> s(N);


Compiler output:
a.cc: In function 'int main()':
a.cc:47:21: error: 'fault' was not declared in this scope
   47 |         bool frag = fault;
      |                     ^~~~~
a.cc: In function 'int64_t gcd(int64_t, int64_t)':
a.cc:20:17: warning: control reaches end of non-void function [-Wreturn-type]
   20 |         else gcd(mn, mx%mn);
      |              ~~~^~~~~~~~~~~
Language: C++

#include<bits/stdc++.h>
using namespace std;
int main(){
  int A,B;
  cin>>A>>B
  while(){
    

Compiler output:
a.cc: In function 'int main()':
a.cc:5:12: error: expected ';' before 'while'
    5 |   cin>>A>>B
      |            ^
      |            ;
    6 |   while(){
      |   ~~~~~     
a.cc:6:11: error: expected '}' at end of input
    6 |   while(){
      |           ^
a.cc:3:11: note: to match this '{'
    3 | int main(){
      |           ^
Language: C++

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

#define rep(i, n) for (ll i = 0; i < n; i++)
#define Rep(i, r, n) for (ll i = r; i < n; i++)
#define pb push_back
#define MOD 1000000007

typedef long long ll;
int main() {
  string s;
  ll k;
  ll answer;
  ll count = 0, c_count = 0;
  cin >> s;
  cin >> k;
  Rep(i, 1, s.length()) {
    if(s[i] == s[i-1]) count++;
    else {
      c_count += floor((count+1)/2);
      count = 0;
    }
  }
  c_count += floor((count+1)/2);

  answer = c_count * k;
  if(s[0] == s[s.length()-1]) {
    answer += (k-1);
  }

  ll count_f = 0, count_s = 0;
  if(s[0] == s[1] || s[s.length()-2] == s[s.length()-1]) {
    answer -= (k-1);
    Rep(i, 1, s.length()) {
      if(s[i] == s[i-1]) count_f++;
      else break;
    }
    for(int i = (s.length()-2); i >= 0; i--) {
      if(s[i] == s[i+1]) count_s++;
      else break;
    }
    if()
    if(count_f != 0) count_f++;
    if(count_s != 0) count_s++;
    if(count_f%2 == 1 && count_f%2 == 1) {
      answer += (k-1);
    }
  }
  
  cout << answer << endl;
  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:42:8: error: expected primary-expression before ')' token
   42 |     if()
      |        ^
Language: C

#include <stdio.h>
int main(void)
{
  char s[256];
  scanf("%s", s);
  int k;
  scanf("%d", &k);
  int n=0;
  for(n=0; s[n] != '\0'; n++);
  char t[];
  for(int i=1; i <= k; i++){
    for(int j=1; j <= n; j++){
      t[j+i*n] = t[j];
    }
  }
  int l = 0;
  for(int h = 0; h < n*k; h++){
    if(t[h+1] == t[h]){l++;}
  }
  printf("%d", l);
  return 0;
}


Compiler output:
main.c: In function 'main':
main.c:10:8: error: array size missing in 't'
   10 |   char t[];
      |        ^
Language: Java

package javalectures;
import java.util.Random;
import java.util.Scanner;
public class alCoder1 {
    public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    String s = sc.nextLine();
    int n=s.length();
    Long k = sc.nextLong();
    String T="";
    for(int i=0;i<k;i++){
    T=s+T;
    }
    Random r = new Random();
    char c;
    char[] ch=T.toCharArray();
    int count=0;
    for(int i=0;i<T.length();i++){
        if(i!=T.length()-1){
        if(ch[i]==ch[i+1]){
            c=(char) (r.nextInt(26) + 'a');
            if(c!=ch[i+1]){
            ch[i+1]=c;
            count++;
            }
            else
            {
                c=(char) (r.nextInt(26) + 'a');
                ch[i+1]=c;
                count++;
            }
        }
    }
    }   
    String Final="";
    for(int i=0;i<T.length();i++){
        Final=Final+ch[i];
    }
    System.out.println(count);
    }
}

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

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

int main(){
    string s;
    cin >> s;
    int k;
    cin >> k;
    
    int len= (int)(s.length());
    long long ans=0;
    //s[len] = s[0];

    //まずk=1について調べる。
    int cnt=1;
    //bool flag=false;
    for(int i=1;i<len;i++){
        if(s[i-1]==s[i]){
            cnt++;
            //if(i==len) flag=true;  
        }else{
            ans+=int(cnt/2);
            cnt=1;        
        }
    }
    ans+=int(cnt/2);
    cnt=1;
    
    //k=2について調べる。
    int ans2=0;
    cnt=1;
    //bool flag=false;
    for(int i=1;i<len*2;i++){
        if(s[(i-1)%len]==s[i%len]){
            cnt++;
            //if(i==len) flag=true;  
        }else{
            ans2+=int(cnt/2);
            cnt=1;        
        }
    }
    ans2+=int(cnt/2);
    cnt=1;
    long long res;
    //k倍する。
    res=k*ans+(k-1)*(ans2-ans1*2);
    
    //if(flag) ans--;
 
    //if(s[0]==s[len-1]) ans+=k-1;
    
    cout << res << endl;
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:47:27: error: 'ans1' was not declared in this scope; did you mean 'ans2'?
   47 |     res=k*ans+(k-1)*(ans2-ans1*2);
      |                           ^~~~
      |                           ans2
Language: C

#include <stdio.h>
int main(void)
{
  char s[256];
  scanf("%s", s);
  int k;
  scanf("%d", &k);
  int n=0;
  for(n=0; s[n] != '\0'; n++);
  char t;
  for(int i=1; i <= k; i++){
    for(int j=1; j <= n; j++){
      t[j+i*n] = t[j];
    }
  }
  int l = 0;
  for(int h = 0; h < n*k; h++){
    if(t[h+1] == t[h]){l++;}
  }
  printf("%d", l);
  return 0;
}


Compiler output:
main.c: In function 'main':
main.c:13:8: error: subscripted value is neither array nor pointer nor vector
   13 |       t[j+i*n] = t[j];
      |        ^
main.c:13:19: error: subscripted value is neither array nor pointer nor vector
   13 |       t[j+i*n] = t[j];
      |                   ^
main.c:18:9: error: subscripted value is neither array nor pointer nor vector
   18 |     if(t[h+1] == t[h]){l++;}
      |         ^
main.c:18:19: error: subscripted value is neither array nor pointer nor vector
   18 |     if(t[h+1] == t[h]){l++;}
      |                   ^
Language: C

#include <stdio.h>
int main(void)
{
  char s[256];
  scanf("%s", s);
  int k;
  scanf("%d", &k);
  for(int n=0; s[n] != '\0'; n++);
  char t;
  for(int i=1; i <= k; i++){
    for(int j=1; j <= n; j++){
      t[j+i*n] = t[j];
    }
  }
  int l = 0;
  for(int h = 0; h < n*k; h++){
    if(t[h+1] == t[h]){l++;}
  }
  printf("%d", l);
  return 0;
}


Compiler output:
main.c: In function 'main':
main.c:11:23: error: 'n' undeclared (first use in this function)
   11 |     for(int j=1; j <= n; j++){
      |                       ^
main.c:11:23: note: each undeclared identifier is reported only once for each function it appears in
main.c:12:19: error: subscripted value is neither array nor pointer nor vector
   12 |       t[j+i*n] = t[j];
      |                   ^
main.c:17:9: error: subscripted value is neither array nor pointer nor vector
   17 |     if(t[h+1] == t[h]){l++;}
      |         ^
main.c:17:19: error: subscripted value is neither array nor pointer nor vector
   17 |     if(t[h+1] == t[h]){l++;}
      |                   ^
Language: C++

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

int main() {
  string S;
  cin>>S;
  int K;
  cin>>K;
  int l=S.size();
  int ans=0;
  if(S[0]!=S[l-1]){
    
    for(int i=0;i<l;i+=con){
      int con=0;
      for(int j=i+1;i<l;i++){
        if(S[i]==S[j]){
          con++;
        }
        else{
          int b=con/2;
          ans+=b;
          break;
        }
      }
    }
    ans*=K;
  }
  else{ 
  
    for(int i=0;i<l;i+=con){
      int con=0;
      for(int j=i+1;i<l;i++){
        if(S[i]==S[j]){
          con++;
        }
        else{
          int b=con/2;
          ans+=b;
          break;
        }
      }
    }
    int box;
    for(int i=1;i<l;i++){
      if(S[0]==S[i]){
        box++;
      }
      else{
        break;
      }
    }
    for(int i=l-2;i>=0;i--){
      if(S[l-1]==S[i]){
        box++;
      }
      else{
        break;
      }
    }
    box=box/2;
    ans+=box*(K-1);
  }
  cout<<ans<<endl;
    
  
}


Compiler output:
a.cc: In function 'int main()':
a.cc:13:24: error: 'con' was not declared in this scope; did you mean 'cos'?
   13 |     for(int i=0;i<l;i+=con){
      |                        ^~~
      |                        cos
a.cc:30:24: error: 'con' was not declared in this scope; did you mean 'cos'?
   30 |     for(int i=0;i<l;i+=con){
      |                        ^~~
      |                        cos
Language: C++

//IOI 2021

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

#define pb push_back
#define ff first
#define ss second

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

const int MAXN = 1000 + 17;

ll k, dp[MAXN][2], ans, n, pd[MAXN][2];
string s;

int main() {
	ios_base::sync_with_stdio(false), cin.tie(0), cout.tie(0);
	cin >> s;
	cin >> k;
	n = s.size();
	if (n == 1) {
		cout << k / 2;
		return 0;
	}
	if (n == 2) {
		while(1)
			1 = 1;
		if (s[0] == s[1])
			cout << k << endl;
		else
			cout << 0 << endl;
		return 0;
	}
	for (int i = 1; i <= n; i++) {
		if (i > 1 && s[i - 1] == s[i - 2])
			dp[i][0] = dp[i - 1][1];
		else
			dp[i][0] = min(dp[i - 1][0], dp[i - 1][1]);
		dp[i][1] = min(dp[i - 1][0], dp[i - 1][1]) + 1;
	}
	pd[1][0] = MAXN;
	pd[1][1] = 1;
	for (int i = 2; i <= n; i++) {
		if (i > 1 && s[i - 1] == s[i - 2])
			pd[i][0] = pd[i - 1][1];
		else
			pd[i][0] = min(pd[i - 1][0], pd[i - 1][1]);
		pd[i][1] = min(pd[i - 1][0], pd[i - 1][1]) + 1;
	}
	if (s.back() == s[0] && k != 1)
		cout << min(min(pd[n][0], pd[n][1]), dp[n][1])* (k - 1) + min(dp[n][1], dp[n][0]) << endl;
	else
		cout << min(k * dp[n][0], k * dp[n][1]) << endl;
	return 0;
}



Compiler output:
a.cc: In function 'int main()':
a.cc:29:25: error: lvalue required as left operand of assignment
   29 |                         1 = 1;
      |                         ^
Language: C++

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

int main() {
  string S;
  cin>>S;
  int K:
  cin>>K;
  int l=S.size();
  int ans=0;
  if(S[0]!=S[l-1]){
    int con=0;
    for(int i=0;i<l;i+=con){
      for(int j=i+1;i<l;i++){
        if(S[i]==S[j]){
          con++;
        }
        else{
          int b=con/2;
          ans+=b;
          break;
        }
      }
    }
    ans*=K;
  }
  else{ 
    int con=0;
    for(int i=0;i<l;i+=con){
      for(int j=i+1;i<l;i++){
        if(S[i]==S[j]){
          con++;
        }
        else{
          int b=con/2;
          ans+=b;
          break;
        }
      }
    }
    int box;
    for(int i=1;i<l;i++){
      if(S[0]==S[i]){
        box++;
      }
      else{
        break;
      }
    }
    for(int i=l-2;i>=0;i--){
      if(S[l-1]==S[i]){
        box++;
      }
      else{
        break;
      }
    }
    box=box/2;
    ans+=box*(K-1);
  }
  cout<<ans<<endl;
    
  
}


Compiler output:
a.cc: In function 'int main()':
a.cc:7:8: error: found ':' in nested-name-specifier, expected '::'
    7 |   int K:
      |        ^
      |        ::
a.cc:7:7: error: 'K' has not been declared
    7 |   int K:
      |       ^
a.cc:8:6: error: qualified-id in declaration before '>>' token
    8 |   cin>>K;
      |      ^~
a.cc:25:10: error: 'K' was not declared in this scope
   25 |     ans*=K;
      |          ^
a.cc:59:15: error: 'K' was not declared in this scope
   59 |     ans+=box*(K-1);
      |               ^
Language: C++

#include<cstdio>
#include<cstdlib>
#include<algorithm>
#include<iostream>
#include<queue>
#include<vector>
#include <bitset>
#include<math.h>
using namespace std;
#define INF 11000000000
#define MOD 1000000007
typedef long long ll;
typedef pair<ll,ll> P;

string s;
string S;


int solve(){
    s=S;
    int count=0;
    for(int i=0;i<(int)s.size()-1;i++){
        if(s[i+1]==s[i]){
            count++;
            s[i+1]='?';
        }
    }
    return count;
}

int main(){
    ll K;
    cin>>S>>K;
    int num=(int)S.size();
    int ans1=solve(S);
    ll ans;
    if(S[num-2]==S[num-1] && S[num-1]==S[0]){
        ans=ans1*K;
    } 
    else if(S[num-1]!=S[0]) ans=ans1*K; //〇
    else if(S[num-1]==S[0] && S[0]!=S[1]){
        if(s[num-1]=='?') ans=ans1*K;
        else ans=(ans1+1)*K-1;
    }
    else if(S[num-1]==S[0] && S[0]==S[1]) ans=(ans1)*K;
    cout<<ans<<endl;

    
}


Compiler output:
a.cc: In function 'int main()':
a.cc:35:19: error: too many arguments to function 'int solve()'
   35 |     int ans1=solve(S);
      |              ~~~~~^~~
a.cc:19:5: note: declared here
   19 | int solve(){
      |     ^~~~~