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

#include<iostream>
#include<string>

using namespace std;

#define INF 1000000007
#define int long long
#define FOR(i, a, b) for (int i = (a); i < (b); i++)
#define rep(i, n) FOR(i, 0, n)
int gcd(int a, int b)
{
	return b ? gcd(b, a % b) : a;
}
int lcm(int a, int b) { return a / gcd(a, b) * b; }
signed main()
{
	string O;
	int K;
	cin >> O >> K;
	string S(O),G(O);
	int count_s = 0;
	int count_g = 1;
	bool  flag_s = false,flag_g = false;
	for (int i = 1; i < S.length(); i++) {
		if (S[i] == S[i - 1]) {
			count_s++;
			S[i] = '0';
			if (i == S.length()-1) {
				flag_s = true;
			}
		}
	}
	for (int i = 2;i < G.length();i++) {
		if (G[i] == G[i-1]) {
			count_g++;
			G[i] = '0';
			if (i == G.length() - 1) {
				flag_g = true;
			}
		}
	}

	if (S.length() == 1) {
		flag_g = true;
	}
	if (S[0] != S[S.length()-1]) {
		cout << count_s * K <<endl; //SSSS...
	}
	else {
		if (flag_s) {
			cout << count_s * K << endl; //SSSS...
		}
		else {
			if (flag_g) {
				cout << count_s * (K / 2 + K % 2) + count_g *( K / 2 )<< endl; //SGSGSGSG...
			}
			else {
				cout << count_s + count_g * (K - 1) << endl; //SGGG..
			}
		}
	}

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

#include<iostream>
#include<string>

using namespace std;

#define INF 1000000007
#define int long long
#define FOR(i, a, b) for (int i = (a); i < (b); i++)
#define rep(i, n) FOR(i, 0, n)
int gcd(int a, int b)
{
	return b ? gcd(b, a % b) : a;
}
int lcm(int a, int b) { return a / gcd(a, b) * b; }
signed main()
{
	string S;
	int K;
	cin >> S >> K;
	string G(S);
	int count_s = 0;
	int count_g = 1;
	for (int i = 1; i < S.length(); i++) {
		if (S[i] == S[i - 1]) {
			count_s++;
			S[i] = '0';
		}
	}
	for (int i = 2;i < G.length();i++) {
		if (G[i] == G[i-1]) {
			count_g++;
			G[i] = '0';
		}
	}
	if (S.length() == 1) {
		cout << count_s * ((K - 1) / 2 + 1) + count_g * K / 2 << endl;
		return 0;
	}
	if (S[0] != S[S.length()-1]) {
		cout << count_s * K <<endl; //SSSS...
	}
	else if(G[G.length()-1] == S[0]){
		cout << count_s + count_g * (K - 1) << endl; //SGGG...
	}
	else {
		cout << count_s * ((K-1)/2 + 1)  + count_g * K/2<< endl; //SGSGSGSG...
	}

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

#include <bits/stdc++.h>

using namespace std;

int main() {
  string s;
  long long n, ans = 0;
  cin >> s >> n;
  int yoo = s.size();
  map<int, int> ok;
  if (n == 1) {
    for (int i = 1; i < s.size(); i++) {
      if (s[i] == s[i - 1]) {
        if (ok[i - 1]) continue;
        ok[i] = 1, ans++;
      }
    }
    cout << ans << '\n';
    return 0;
  }
  s = s + s;
  long long odd = 0;
  for (int i = 1; i < s.size(); i++) {
    if (s[i] == s[i - 1]) {
      if (ok[i - 1]) continue;
      ok[i] = 1, ans++;
      if (i >= yoo) odd++;
    }
  }
  long long g = (long long)(n / 2LL) * ans;
  if (n % 2) g += odd;
  cout << g << '\n';x
  return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:32:21: error: 'x' was not declared in this scope
   32 |   cout << g << '\n';x
      |                     ^
Language: C++

#include<stdio.h>
#include<string.h>
#include<algorithm>
#define ll long long
using namespace std;
int main()
{
	string s;
	long long int k,nu=0,i;
	cin>>s;
	cin>>k;
	int len=s.size();
	for(i=0;i<len;i++)
	{
		if(s[i]==s[(i+1)%len])
		{
			nu++;
			i++;
		}
	}
	/*if(i==len)
	{
		
	}
	*/
	if(s[0]==s[len-1]&&i==len-1)
		cout<<nu*k-1<<endl;
	else
		cout<<nu*k<<endl;
    return 0;

}



Compiler output:
a.cc: In function 'int main()':
a.cc:8:9: error: 'string' was not declared in this scope
    8 |         string s;
      |         ^~~~~~
a.cc:4:1: note: 'std::string' is defined in header '<string>'; this is probably fixable by adding '#include <string>'
    3 | #include<algorithm>
  +++ |+#include <string>
    4 | #define ll long long
a.cc:10:9: error: 'cin' was not declared in this scope
   10 |         cin>>s;
      |         ^~~
a.cc:4:1: note: 'std::cin' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
    3 | #include<algorithm>
  +++ |+#include <iostream>
    4 | #define ll long long
a.cc:10:14: error: 's' was not declared in this scope
   10 |         cin>>s;
      |              ^
a.cc:27:17: error: 'cout' was not declared in this scope
   27 |                 cout<<nu*k-1<<endl;
      |                 ^~~~
a.cc:27:17: note: 'std::cout' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
a.cc:27:31: error: 'endl' was not declared in this scope
   27 |                 cout<<nu*k-1<<endl;
      |                               ^~~~
a.cc:4:1: note: 'std::endl' is defined in header '<ostream>'; this is probably fixable by adding '#include <ostream>'
    3 | #include<algorithm>
  +++ |+#include <ostream>
    4 | #define ll long long
a.cc:29:17: error: 'cout' was not declared in this scope
   29 |                 cout<<nu*k<<endl;
      |                 ^~~~
a.cc:29:17: note: 'std::cout' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
a.cc:29:29: error: 'endl' was not declared in this scope
   29 |                 cout<<nu*k<<endl;
      |                             ^~~~
a.cc:29:29: note: 'std::endl' is defined in header '<ostream>'; this is probably fixable by adding '#include <ostream>'
Language: C++

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

void main() {
	string S;
	int k, count;
	cin>>S;
	cin>>k;
	for (int i = 1; i < S.length() - 1; i++)
      if (S[i] == S[i - 1] || S[i] == S[i + 1]) count++;
  	if (S[S.length() - 1] == S[1]) count++;
  	count *= k;
  	count--;
  cout << count;
}

Compiler output:
a.cc:5:1: error: '::main' must return 'int'
    5 | void main() {
      | ^~~~
Language: C++

#include  <bits/stdc++.h>
using namespace std;
string s;
int k,ans=0;
int main()
{
  cin>>s;
  cin>>k;
  if(s.lenght()==2 and s[0]==s[1]) cout<<k; else
  {
    for(int i=1;i<s.length()-1;i++)
      if(s[i-1]==s[i] and s[i]==s[i+1]) ans++,s[i]='0';
    for(int i=0;i<s.length()-1;i++)
      if(s[i]==s[i+1]) ans++,s[i]='1';
    if(s[0]==s[s.length()-1]) ans++;
  }
  cout<<ans*k;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:9:8: error: 'std::string' {aka 'class std::__cxx11::basic_string<char>'} has no member named 'lenght'; did you mean 'length'?
    9 |   if(s.lenght()==2 and s[0]==s[1]) cout<<k; else
      |        ^~~~~~
      |        length
Language: Java

public class Main{
  public static void main (String[] args) {
    String S = new java.util.Scanner(System.in).nextLine();
    String KString = new java.util.Scanner(System.in).nextLine();
    int K =  Integer.parseInt(ageString);
    String X = "";
    for(int i = 0; i < K; i++){
      X += S;
    }
    char previous =' ';
    char now =' ';
    int A = 0;
    for(int i=0 ; i < X.length; i++){
      previous = now;
      now = X.charAt(i);
      if(now == previous){
	A++;
	now = '1';
      }
    }
    System.out.println(A);
  }
}


Compiler output:
Main.java:5: error: cannot find symbol
    int K =  Integer.parseInt(ageString);
                              ^
  symbol:   variable ageString
  location: class Main
Main.java:13: error: cannot find symbol
    for(int i=0 ; i < X.length; i++){
                       ^
  symbol:   variable length
  location: variable X of type String
2 errors
Language: Java

public class Main{
  public static void main (String[] args) {
    String S = new java.util.Scanner(System.in).nextLine();
    String KString = new java.util.Scanner(System.in).nextLine();
    int K =  Integer.parseInt(ageString);
    String X = "";
    for(int i = 0; i < K; i++){
      X += S;
    }
    char previous = '';
    char now = '';
    int A;
    for(int i=0 ; i < X.length; i++){
      previous = now;
      now = X.charAt(i);
      if(now == previous){
	A++;
	now = '1';
      }
    }
    System.out.println(A);
  }
}


Compiler output:
Main.java:10: error: empty character literal
    char previous = '';
                    ^
Main.java:11: error: empty character literal
    char now = '';
               ^
2 errors
Language: Java

public class Main{
  public static void main (String[] args) {
    String S = new java.util.Scanner(System.in).nextLine();
    String KString = new java.util.Scanner(System.in).nextLine();
    int K =  Integer.parseInt(ageString);
    String X = "";
    for(int i = 0; i < K; i++){
      X += S;
    }
    char previous = '';
    char now = '';
    int A;
    for(int i=0 ; i < X.length; i++){
      previous = now;
      now = X.charAt(i);
      if(now == previous){
	A++;
	now = '1';
      }
    }
  }
}


Compiler output:
Main.java:10: error: empty character literal
    char previous = '';
                    ^
Main.java:11: error: empty character literal
    char now = '';
               ^
2 errors
Language: C++

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

// def
#define debug(x) cout << #x << ": " << x << endl
#define out(x) cout << x << endl
#define repeat(i, a, b) for (ll i = (a); i < (b); i++)
#define revrepeat(i, a, b) for (ll i = (b)-1; i >= (a); i--)
#define rep(i, n) for (ll i = 0; i < (ll)(n); i++)
#define revrep(i, n) for (ll i = (n)-1; i >= 0; i--)
typedef long long ll;
typedef pair<ll, ll> P;
const ll M = 1e9 + 7;
const ll INF = 1e9;
const ll MAX_V = 100 + 5;
const ll MAX_N = 1e5 + 5;

ll main() {
    string s;
    cin >> s;
    ll k;
    cin >> k;
    ll ans = 0;
    ll ans_one = 0;
    ll ans_between = 0;
    string true_s = s;
    ll i = 0;
    while (i < s.size()){
        char c = s[i];
        i++;
        ll cnt = 0;
        ll from = 0;
        while (c == s[i]) {
            if (from % 2 == 0) {
                s[i] = '1';
                cnt++;
            }
            from++;
            i++;
        }
        ans_one += cnt;
    }

    s.append(true_s);
    i = true_s.size() - 1;
    while (i < s.size()) {
        char c = s[i];
        i++;
        ll cnt = 0;
        ll from = 0;
        while (c == s[i]) {
            if (from % 2 == 0) {
                cnt++;
            }
            from++;
            i++;
        }
        ans_between += cnt;
    }

    ans = ans_one + ans_between * (k-1);
    cout << ans << endl;
}


Compiler output:
a.cc:18:1: error: '::main' must return 'int'
   18 | ll main() {
      | ^~
Language: C++

/*   _ _ _                     
    | | | | ___  ___           
    | | | || . ||  _|          
    |_____||_  ||_|  _____     
             |_|    |_____|  */
// Time : 19/10/15
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define inf 0x3f3f3f3f
int main(){
#ifdef Wqr_
    freopen("in.txt","r",stdin);
#endif
    std::ios::sync_with_stdio(false),cin.tie(0),cout.tie(0);
    string in;
    ll k, ans = 0;
    cin >> in;
    cin >> k;
    ll len = in.length();
    //kase1
    set<char> sett;
    for(auto i : in){
        sett.insert(i);
    }
    if(sett.size() == 1){
        ll ans = (len * k) / 2 << endl;
        cout << ans << endl;
        return 0;
    }
    //kase2
    for(int i = 1; i < len; i++){
        if(in[i] == in[i-1]){
            ++ans;
            ++i;
        }
    }
    ans *= k;
    if(in.front() == in.back() && in[len-1] != in[len-2]) ans += k - 1;
    cout << ans << endl;
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:27:32: error: invalid operands of types 'll' {aka 'long long int'} and '<unresolved overloaded function type>' to binary 'operator<<'
   27 |         ll ans = (len * k) / 2 << endl;
      |                  ~~~~~~~~~~~~~~^~~~~~~
Language: C++

#include <bits/stdc++.h>


using namespace std;

typedef pair<int, int> pii;
#define lp(i, s, e) for (int i = s; i < e; ++i)
#define lpi(i, s, e) for (int i = s;i <= e; ++i)
typedef long long ll;

int main() {
	string s;
	int k;
	cin >> s >> k;
	int n = s.size();
	if (k == 1) {
		int cnt = 0;
		int last = 0;
		int ans = 0;
		lp(i, 1, n) {
			if (s[i] != s[i - 1]) {
				ans += (i - last) / 2;
				last = i;
			}
		}
		ans += (n - last) / 2;
		cout << ans;
		return 0;
	}
	int last = n - 2;
	while (last > 0 && s[last] == s[last + 1]) {
		--last;
	}
	++last
	if (!last) {
		cout << 1LL * k * n / 2;
		return 0;
	}
	int first = 0;
	while(s[first] == s[n - 1]) {
		++first;
	}
	ll ans = 0;
	ans += (n - last + first) / 2 * 1LL * (k - 1);
	// cout << ans << '\n';
	int cnt = 0;
	int last_pos = first;
	lp(i, first + 1, last) {
		if (s[i] != s[i - 1]) {
			cnt += (i - last_pos) / 2;
			last_pos = i;
		}
	}
	cnt += (last - last_pos) / 2;
	ans += 1LL * k * cnt;
	ans += first / 2 + (n - last) / 2;
	cout << ans;
	return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:34:15: error: expected ';' before 'if'
   34 |         ++last
      |               ^
      |               ;
   35 |         if (!last) {
      |         ~~
Language: C++

#include<bits/stdc++.h>
using namespace std;
int main()
{
  string h;
  long long s;
  getline(cin,h);
  for (int i=0;i<s;i++)
    h.append(h);
  long long int g;
   long long int k=0; 
  g=strlen(h);
  
for (long long int i=0;i<g-1;i++)
{if(h[i]==h[i+1])
   k++;
}
  cout<<k;





return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:12:12: error: cannot convert 'std::string' {aka 'std::__cxx11::basic_string<char>'} to 'const char*'
   12 |   g=strlen(h);
      |            ^
      |            |
      |            std::string {aka std::__cxx11::basic_string<char>}
In file included from /usr/include/c++/14/cstring:43,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:121,
                 from a.cc:1:
/usr/include/string.h:407:35: note:   initializing argument 1 of 'size_t strlen(const char*)'
  407 | extern size_t strlen (const char *__s)
      |                       ~~~~~~~~~~~~^~~
Language: C++

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

int main()
{
	string s; cin>>s;
	long long int k; cin>>k;
	long long int n=s.length();
	long long int x=0;
	if(s[0]==s[n-1]) x++;
	long long int lc=-1;
	for(long long int i=1;i<n;i++){
		if(s[i]==s[i-1]){
			if(lc==i-1) continue;
			c++; lc=i;
		}
	}

	cout<<(k-1)*x + c;

}

Compiler output:
a.cc: In function 'int main()':
a.cc:15:25: error: 'c' was not declared in this scope
   15 |                         c++; lc=i;
      |                         ^
a.cc:19:25: error: 'c' was not declared in this scope; did you mean 'lc'?
   19 |         cout<<(k-1)*x + c;
      |                         ^
      |                         lc
Language: C

#include <stdio.h>

int main(void)
{
	char s[100];
	int i,j,f[100],l=0;
	long k,sum=0;
	scanf("%s %ld",s,&k);
	i=0;
	while(s[i]!='\0'){
	f[i]=0;
	l=l+1;
	i=i+1;
	}

	i=0;
	while(i<=l-2){

		
		if(s[i]==s[i+1]){
			if(s[i]==s[i+2]){
/*printf("%d 〇 %c %c %c\n",i,s[i],s[i+1],s[i+2]);*/
				f[i+1]=1;
				sum=sum+1;i=i+2;

			}else{
				
/*printf("%d △ %c %c\n",i,s[i],s[i+1]);*/
				f[i]=1;
				sum=sum+1;i=i+2;
			}
		}else{
/*printf("%d × %c %c\n",i,s[i],s[i+1]);*/
			i=i+1;
		}
	}
		
		
	
	if(s[l-1]==s[0]){
		if(f[l-1]==0 && f[0]==0){
		sum=(sum+1)*k-1;
	}else{
		sum=sum*k;
	}else{sum=sum*k;
	}
	if(l==1){sum=k/2;}
	if(l==2){sum=k;}
	printf("%ld\n",sum);


	return 0;
}

Compiler output:
main.c: In function 'main':
main.c:45:10: error: expected '}' before 'else'
   45 |         }else{sum=sum*k;
      |          ^~~~
Language: C

#include <stdio.h>

int main(void)
{
	char s[100];
	int i,j,f[100],l=0;
	long k,sum=0;
	scanf("%s %ld",s,&k);
	i=0;
	while(s[i]!='\0'){
	f[i]=0;
	l=l+1;
	i=i+1;
	}

	i=0;
	while(i<=l-2){

		
		if(s[i]==s[i+1]){
			if(s[i]==s[i+2]){
/*printf("%d 〇 %c %c %c\n",i,s[i],s[i+1],s[i+2]);*/
				f[i+1]=1;
				sum=sum+1;i=i+2;

			}else{
				
/*printf("%d △ %c %c\n",i,s[i],s[i+1]);*/
				f[i]=1;
				sum=sum+1;i=i+2;
			}
		}else{
/*printf("%d × %c %c\n",i,s[i],s[i+1]);*/
			i=i+1;
		}
	}
		
		
	
	if(s[l-1]==s[0]){
		if(f[l-1]==0 && f[]==0){
		sum=(sum+1)*k-1;
	}else{
		sum=sum*k;
	}
	}
	if(l==1){sum=k/2;}
	if(l==2){sum=k;}
	printf("%ld\n",sum);


	return 0;
}

Compiler output:
main.c: In function 'main':
main.c:41:35: error: expected expression before ']' token
   41 |                 if(f[l-1]==0 && f[]==0){
      |                                   ^
Language: Java

import java.util.*;

public class Main{
    public static void main(String args[]){
        Scanner sc = new Scanner(System.in);
        
        String s = sc.next();
        long k = sc.nextLong();
        long n = s.length();
        sc.close();

        long ans = 0;
        if(s.charAt(0) != s.charAt(n-1)){
            int idx = 0;
            while(idx < n-1){
                if(s.charAt(idx)==s.charAt(idx+1)){
                    ans++;
                    idx++;
                }
                idx++;
            }
            ans *= k;
        } else {
            if(allsame(s)){
                ans = (n*k)/2;
            } else {
                int l = 0;
                int r = n-1;
                while(s.charAt(l) == s.charAt(l+1)){
                    l++;
                }
                while(s.charAt(r) == s.charAt(r-1)){
                    r--;
                }
                int idx = 0;
                while(idx < n-1){
                    if(s.charAt(idx)==s.charAt(idx+1)){
                        ans++;
                        idx++;
                    }
                    idx++;
                }
                ans *= k;
                ans += ((l+1)+(n-r))/2*(k-1);
                ans -= (l+1)/2;
                ans -= (n-r)/2;
                
            }
            
        }
        System.out.println(ans);
    }

    static boolean allsame(String s){
        for(int i = 0; i < s.length()-1; i++){
            if(s.charAt(i)!=s.charAt(i+1))
                return false;
        }
        return true;
    }
}

Compiler output:
Main.java:13: error: incompatible types: possible lossy conversion from long to int
        if(s.charAt(0) != s.charAt(n-1)){
                                    ^
Main.java:28: error: incompatible types: possible lossy conversion from long to int
                int r = n-1;
                         ^
Note: Some messages have been simplified; recompile with -Xdiags:verbose to get full output
2 errors
Language: C++

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

#define N 111

char s[N];
int k;

int main() {
    scanf("%s %d", s, &k);
    int n = strlen(s);
    vector <int> vec;
    for (int i = 0, j = 0; i < n; i = j) {
        while (j < n && s[j] == s[i]) j ++;
        vec.push_back(j - i);
    }
    if (vec.size() == 1) {
        printf("%lld\n", 1ll * k * n / 2);
    }
    else {
        if (s[n-1] != s[0]) {
            int m = 0;
            for (auto x : vec) m += x >> 1;
            printf("%lld\n", 1ll * k * m);
        }
        else {
            int m = 0;
            for (auto x : vec) m += x >> 1;
            m -= vec[0] >> 1, m -= vec.back() >> 1;
            m += vec[0] + vec.back() >> 1;
            printf("%lld\n", 1ll * k * m - (vec[0] + vec.back() >> 1) + (vec[0] >> 1) + (vec.back() >> 1))
        }
    }

    return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:31:107: error: expected ';' before '}' token
   31 |             printf("%lld\n", 1ll * k * m - (vec[0] + vec.back() >> 1) + (vec[0] >> 1) + (vec.back() >> 1))
      |                                                                                                           ^
      |                                                                                                           ;
   32 |         }
      |         ~
Language: C++

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

const int N = 2e5 + 10;

int mn[N][20], mx[N][20];
int a[N];

// struct {
	void rmq_init (int n) {
		for (int i = 1; i <= n; i++) {
			mn[i][0] = mx[i][0] = a[i];
		}
		for (int j = 1; (1 << j) <= n; j++) {
			for (int i = 1; i + (1 << j) - 1 <= n; i++) {
				mn[i][j] = min(mn[i][j - 1], mn[i + (1 << (j - 1))][j - 1]);
				mx[i][j] = max(mx[i][j - 1], mx[i + (1 << (j - 1))][j - 1]);
			}
		}
	}

	inline int rmq1 (int l, int r) {
		int k = log2(r - l + 1);
		return min(mn[l][k], mn[r - (1 << k) + 1][k]);
	}

	inline int rmq2 (int l, int r) {
		int k = log2(r - l + 1);
		return max(mx[l][k], mx[r - (1 << k) + 1][k]);	
	}
// } rmq;


int main (void) {
	int n, k;
	scanf("%d%d", &n, &k);
	for (int i = 1; i <= n; i++) {
		scanf("%d", a + i);
	}
	rmq_init(n);

	int ans = 1;
	for (int i = k + 1; i <= n; i++) {
		int val = rmq(i - k + 1, i - 1);
		cout << a[i - k] << " " << val << " " << a[i] << endl;
		if (a[i - k] < val && val < a[i]) {

		} else {
			ans ++;
		}
	}
	printf("%d\n", ans);
}

Compiler output:
a.cc: In function 'int main()':
a.cc:44:27: error: 'rmq' was not declared in this scope; did you mean 'rmq2'?
   44 |                 int val = rmq(i - k + 1, i - 1);
      |                           ^~~
      |                           rmq2
Language: C++

#include <iostream>

using namespace std;

int main()
{
    long int n;
    string s;
    cin>>s;
    cin>>n;
    int count=0;
    if(s.size()==1){
        // count=(float)0.5;
        count=(float)(0.5*n); 
        if(s.at(0)==s.at(n-1))
           cout<<(int)count+(n-1)<<endl;}
        else
           cout<<(int)count<<endl;
    }
    
    else{
        for(int i=0;i<(s.size()-1);i++){
            if(s.at(i)==s.at(i+1)){
                count++;
                i++;
            }
        }
        if(s.at(0)==s.at(n-1))
            cout<<(count*n)+(n-1)<<endl;
        
        else
            cout<<(count*n)<<endl;
        
    }    
    return 0;
}


Compiler output:
a.cc:21:5: error: expected unqualified-id before 'else'
   21 |     else{
      |     ^~~~
a.cc:35:5: error: expected unqualified-id before 'return'
   35 |     return 0;
      |     ^~~~~~
a.cc:36:1: error: expected declaration before '}' token
   36 | }
      | ^
Language: C++

#include <iostream>
using namespace std;

int main(){
  string S;
  int n,c=0;
  cin >> S >> n;
  
  string T = "";
  for(int i = 0; i < n; i++)
    T += S;
  for(int i = 1;i < s.length() * n; i++){
    if(T[i] == T[i - 1]){
      c++;
      T[i] = ' ';
    }
  }
  
  cout << c << endl;
  return 0;
}
      

Compiler output:
a.cc: In function 'int main()':
a.cc:12:21: error: 's' was not declared in this scope
   12 |   for(int i = 1;i < s.length() * n; i++){
      |                     ^
Language: C++

#include<bits/stdc++.h>
using namespace std;
int main()
{

    string s;
    int64_t   k,c=0;
    cin>>s>>k;
    int len=s.size();
    for(int i=0; i<len-1; i++)
    {
        if(s[i]==s[i+1])
        {
               s[i+1]='*';
               ++c;
        }


    }
   // if(s[0]==s[len-1])
    //{
        //  ++c;
         // cout<<(c*k)-1<<endl;
   // }
    else cout<<c*k<<endl;


}


Compiler output:
a.cc: In function 'int main()':
a.cc:25:5: error: 'else' without a previous 'if'
   25 |     else cout<<c*k<<endl;
      |     ^~~~
Language: C++

#include"bits/stdc++"
#include"math.h"
#define rep(i,n) for(int i=0;i<n;i++)
typedef long long ll;
int main(){
  string s; int k; cin >> s >> k;
  int count,z,ans;
  for(int i=0;i<n-1;i++){
    if(
   if(s[i]==s[i+1]){
      count++;}}
      count = count*k;
  if(s[s.size()-1]==s[0]){
    if(s[s.size()-2]){
    }
    else z=k-1}
      cout << z+count << endl;}

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

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

int main() {
  string s;
  int k,l,n;
  cin>>s>>k;
  l=s.size();
    int count = 0;
  for (int i = 0; i < l; i++) {
    if (s.at(i) ==s.at(i+1){
      count++;
        }
      }
   if(s.at(0)==s.at(l)){
     n=1;
   }
    else {
      n=0;
    }
    cout<<count*k+(k-1)*n<<endl;
        }
  
  

Compiler output:
a.cc: In function 'int main()':
a.cc:11:28: error: expected ')' before '{' token
   11 |     if (s.at(i) ==s.at(i+1){
      |        ~                   ^
      |                            )
a.cc:14:7: error: expected primary-expression before '}' token
   14 |       }
      |       ^
Language: C++

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

int main() {
  string s;
  int k,l,n;
  cin>>s>>k;
  l=s.size()
    int count = 0;
  for (int i = 0; i < l; i++) {
    if (str.at(i) ==str.at(i+1){
      count++;
        }
      }
   if(s.at(0)==s.at(l)){
     n=1;
   }
    else {
      n=0;
    }
    cout<<count*k+(k-1)*n<<endl;
        }
  
  

Compiler output:
a.cc: In function 'int main()':
a.cc:8:13: error: expected ';' before 'int'
    8 |   l=s.size()
      |             ^
      |             ;
    9 |     int count = 0;
      |     ~~~      
a.cc:11:9: error: 'str' was not declared in this scope; did you mean 'std'?
   11 |     if (str.at(i) ==str.at(i+1){
      |         ^~~
      |         std
a.cc:11:32: error: expected ')' before '{' token
   11 |     if (str.at(i) ==str.at(i+1){
      |        ~                       ^
      |                                )
a.cc:14:7: error: expected primary-expression before '}' token
   14 |       }
      |       ^
a.cc:21:16: error: invalid operands of types '<unresolved overloaded function type>' and 'int' to binary 'operator*'
   21 |     cout<<count*k+(k-1)*n<<endl;
      |           ~~~~~^~
Language: C++

1000
3 6
3 1 3
1 3 2
2 3 2
2 2 3
2 1 3
3 2 1
8 13
2 7 6
3 3 4
3 4 7
1 7 3
1 5 8
4
2 1 3
1 2 4
2 1 8
2 7 3
3 5 2
2 8 3
3 4 5
6 17
1 5 2
2 4 2
3 6 4
2 6 3
1 2 6
3 2 3
2 1 2
1 3 1
4
1 5 1
2 3 4
1 3 1
2 1 5
1 3 2
1 6 4
2 3 1
2 1 4
6 2
2 2 1
2 6 1
9 12
3 6 7
1 6 7
3 3 4
3 8 9
1 8 2
3 1 7
1 5 2
1 5 9
1 3 4
1 8 4
1 3 8
2 7 5

Compiler output:
a.cc:1:1: error: expected unqualified-id before numeric constant
    1 | 1000
      | ^~~~
Language: C++

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

void main()
{
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  string s;
  cin >> s;
  int n = s.size();
  int i;
  int k;
  cin >> k;
  for(i=0;i<n;i++)
  {
    if(s[i]== s[0])
    {
    }
    else
    {
      break;
    }
  }
  if(i==n)
  {
    cout << (k*n)/2 << endl;
    return ;
    
    
  }
  
  {
    if(s[0] == s[n-1])
    {
      int sum = 0;
      int fr,bk,mx,rst;
      
      char x = s[0];
      i = 0;
      while(s[i] == x)
      {
        i++;
      }
      fr = i;
      i=0;
      while(s[n-1-i] == x)
      {
        i++;
      }
      bk = i;
      mx = bk + fr;
      for(i=fr;i<=(n-1-bk);)
      {
        x = s[i];
        int cnt = 0;
        while(s[i]==x)
        {
          cnt++;
          i++;
          
        }
        rst += (cnt /2);
        
      }
      sum += (rst *k);
      sum += (fr/2);
      sum += (bk/2);
      sum += (k-1)*(mx/2);
      cout << sum << endl;
      
    }
    else
    {
      int rst= 0;
      for(i=0;i<n;)
      {
        char x = s[i];
        int cnt = 0;
        for(;(x==s[i])&&(i<n);i++)
        {
          cnt++;
        }
        rst += (cnt / 2);
      }
      cout << (rst*k) << endl;
      
    }
  }
  return ;
}

Compiler output:
a.cc:5:1: error: '::main' must return 'int'
    5 | void main()
      | ^~~~
a.cc: In function 'int main()':
a.cc:28:5: error: return-statement with no value, in function returning 'int' [-fpermissive]
   28 |     return ;
      |     ^~~~~~
a.cc:90:3: error: return-statement with no value, in function returning 'int' [-fpermissive]
   90 |   return ;
      |   ^~~~~~
Language: C++

#include <bits/stdc++.h>
using namespace std;
int main()
{
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  string s;
  cin >> s;
  int n = s.size();
  int i;
  int k;
  cin >> k;
  for(i=0;i<n;i++)
  {
    if(s[i]== s[0])
    {
    }
    else
    {
      break;
    }
  }
  if(i==n)
  {
    cout << (k*n)/2 << endl;
    return 0;
    
    
  }
  if(n==1)
  {
    cout << k/2 << endl;
  }
  else
  {
    if(s[0] == s[n-1])
    {
      int sum = 0;
      int fr,bk,mx,rst;
      
      char x = s[0];
      i = 0;
      while(s[i] == x)
      {
        i++;
      }
      fr = i+1'
      i=0;
      while(s[n-1-i] == x)
      {
        i++;
      }
      bk = i+1;
      mx = bk + fr;
      for(i=fr;i<(n-1-(bk-1));i++)
      {
        x = s[i];
        int cnt = 0;
        while(s[i]==x)
        {
          cnt++;
          i++;
          
        }
        rst += cnt /2;
        
      }
      sum += (rst *k);
      sum += (fr/2);
      sum += (bk/2);
      sum += (k-1)*(mx/2);
      cout << sum << endl;
      
    }
    else
    {
      int rst= 0;
      for(i=0;i<n;i++)
      {
        char x = s[i];
        int cnt = 0;
        for(;x==s[i]&&i<n;i++)
        {
          cnt++;
        }
        rst += cnt / 2;
      }
      cout << (rst*k) << endl;
      
    }
  }
  return 0;
}

Compiler output:
a.cc:47:15: warning: missing terminating ' character
   47 |       fr = i+1'
      |               ^
a.cc:47:15: error: missing terminating ' character
a.cc: In function 'int main()':
a.cc:47:15: error: expected ';' before 'i'
   47 |       fr = i+1'
      |               ^
      |               ;
   48 |       i=0;
      |       ~
Language: C++

#include <iostream>
#include <queue>
using namespace std;
typedef pair<int,int> Paint;
int main(){
  int n;cin>>n;
  char mp[n][n];
  for(int i = 0; n > i; i++){
    for(int j = 0; n > j; j++){
      cin>>mp[i][j];
    }
  }
  int ans = -1;
  for(int i = 0; n > i; i++){
    int tmp[n];
    bool lock[n];
    for(int j = 0; n > j; j++)tmp[j] = -1,lock[j]=false;
    queue<Paint> z;
    z.push(make_pair(i,0));
    tmp[i]=0;lock[i]=true;
    while(!z.empty() && !tsumi){
      for(int j = 0; n > j; j++){
        if(mp[z.front().first][j] == '1'){
          if(!lock[j]){
            if(!(z.front().second+1==tmp[j] || tmp[j]==-1)){
              cout << -1 << endl;
              return 0;
            }else if(tmp[j]==-1){
              z.push(make_pair(j,z.front().second+1));
            }
          }
          tmp[j] = z.front().second+1;
        }
      }
      if(z.size()==1)ans = max(ans,z.front().second);
      lock[z.front().first]=true;
      z.pop();
    }
  }
  cout << ans+1 << endl;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:21:26: error: 'tsumi' was not declared in this scope
   21 |     while(!z.empty() && !tsumi){
      |                          ^~~~~
Language: Java

import java.util.Arrays;
import java.util.Scanner;
 
 
public class Code {
 
	/**
	 * @param args
	 */

	public static void main(String[] args) {
		
		Scanner sc= new Scanner(System.in);
	
		
		String s=sc.next();
		int k=sc.nextInt();
		
		
		
		int cnt=0;
		
		
		for(int i=0;i<s.length()-1;i++)
		{
			if(s.charAt(i)==s.charAt(i+1))
				cnt++;
		}
		
		
		int cnt2=1;
		
	for(int i=s.length()-1;i>0;i--)	
	{
		if(s.charAt(i)==s.charAt(i-1))
			cnt2++;
		else break;
		
		
	}
		
		int ans=cnt *k;
		if((cnt2)%2 !=0)
		ans++;
		
		
		System.out.println(ans);
		
		
		
		
		
		
		
		
	}
}

Compiler output:
Main.java:5: error: class Code is public, should be declared in a file named Code.java
public class Code {
       ^
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();
  long long ans=0;
  int i=0;
    while(i<l){
      int con=1;
      int power=1;
      for(int j=i+1;j<l;j++){
        if(S[i]==S[j]){
          power++;
          con++;
          if(j==l-1){
            int b=power/2;
            ans+=b;
          }
        }
        else{
          int b=power/2;
          ans+=b;
          break;
        }
      }
      i+=con;
    }
  ans*=K;
 if(S[0]==S[l-1]){
    int boxa=1;
    for(int i=1;i<l;i++){
      if(S[0]==S[i]){
        boxa++;
      }
      else{
        break;
      }
    }
    int boxb=1;
    for(int i=l-2;i>=0;i--){
      if(S[l-1]==S[i]){
        boxb++;
      }
      else{
        break;
      }
    }
    int box=(boxa+boxb)/2;
    ans+=box*(K-1);
    boxa/=2;
    boxb/=2;
    box=boxa+boxb;
    ans-=box*(K-1);
  }
  for(int i=1;i<l;i++){
    if(A[0]!=A[i]) break;
    else if(i==l-1) ans=l*K/2;
  }
  cout<<ans<<endl;  
}


Compiler output:
a.cc: In function 'int main()':
a.cc:60:8: error: 'A' was not declared in this scope
   60 |     if(A[0]!=A[i]) break;
      |        ^
Language: C++

#include<bits/stdc++.h>
using namespace std;
typedef long long int ll;
int main()
{
  string s; cin>>s;
  ll k; cin>>k;
  int prev = s[0]-'a';
  ll counter = 1;
  ll tot = 0;
  for(int i = 1; i < s.size() ; i++)
  {
    if(s[i]-'a'==prev)
    {
      count++;
    }
    else
    {
      prev = s[i]-'a';
      tot+=(count/2);
      count = 1;
    }
  }
  if(s[0]==s[(int)s.size()-1])
    tot++;
  cout<<(tot*k)<<endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:15:12: error: no post-increment operator for type
   15 |       count++;
      |            ^~
a.cc:20:18: error: invalid operands of types '<unresolved overloaded function type>' and 'int' to binary 'operator/'
   20 |       tot+=(count/2);
      |             ~~~~~^~
a.cc:21:15: error: overloaded function with no contextual type information
   21 |       count = 1;
      |               ^
Language: C++

#include <bits/stdc++.h>
using namespace std;
#define int long long
signed main()
{
    string s;
    cin >> s;
    int k;
    cin >> k;
    int cnt1 = 0, cnt2 = 0, cnt3 = 0;
    for (int i = 0; i < s.size() - 1; i++) {
        if (s[i] != s[i + 1]) {
            goto skip;
        }
    }
    cout << k * (ll)s.size() / 2 << endl;
    return 0;
skip:;
    if (s[0] == s[s.size() - 1]) {
        for (int i = 0; i < s.size(); i++) {
            int j = i;
            if (i == 0) {
                while (j < s.size() - 1 && s[j] == s[j + 1]) {
                    j++;
                }
                cnt2 += j + 1;
            } else {
                while (j < s.size() - 1 && s[j] == s[j + 1]) {
                    j++;
                }
                if (j != s.size() - 1) {
                    cnt1 += (j - i + 1) / 2;
                    i = j;
                } else {
                    cnt3 += j - i + 1;
                    i = j;
                }
            }
        }
        cout << (cnt2 / 2 + cnt1 + cnt3 / 2) * k - (cnt2 / 2 + cnt3 / 2 - (cnt2 + cnt3) / 2) * (k - 1) << endl;
    } else {
        for (int i = 0; i < s.size(); i++) {
            int j = i;
            while (j < s.size() - 1 && s[j] == s[j + 1]) {
                j++;
            }
            cnt1 += (j - i + 1) / 2;
            i = j;
        }
        cout << cnt1 * k << endl;
    }
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:16:18: error: 'll' was not declared in this scope
   16 |     cout << k * (ll)s.size() / 2 << endl;
      |                  ^~
Language: C

#include<stdio.h>
#include<string.h>
 
int main(void) {
  char S[101];
  unsigned long long int K;
  int i, l = 0, p = 0;
  
  scanf("%s", S);
  scanf("%d", &K);
  
  s = strlen(S);
  
  for(i = 1;i <= s;i++) {
    if(S[i-1] == S[i]) {
      l++;
    }
  }
  
  if(S[0] == S[s]) {
    p = 1;
  }
  
  printf("%lld\n", l * K + p * (K - 1));
  
  return 0;
}

Compiler output:
main.c: In function 'main':
main.c:12:3: error: 's' undeclared (first use in this function)
   12 |   s = strlen(S);
      |   ^
main.c:12:3: note: each undeclared identifier is reported only once for each function it appears in
Language: C

#include<stdio.h>
#include<string.h>
 
int main(void) {
  char S;
  unsigned long long int K;
  int i, l = 0, p = 0;
  
  scanf("%s", S);
  scanf("%d", &K);
  
  s = strlen(S);
  
  for(i = 1;i <= s;i++) {
    if(S[i-1] == S[i]) {
      l++;
    }
  }
  
  if(S[0] == S[s]) {
    p = 1;
  }
  
  printf("%lld\n", l * K + p * (K - 1));
  
  return 0;
}

Compiler output:
main.c: In function 'main':
main.c:12:3: error: 's' undeclared (first use in this function)
   12 |   s = strlen(S);
      |   ^
main.c:12:3: note: each undeclared identifier is reported only once for each function it appears in
main.c:12:14: error: passing argument 1 of 'strlen' makes pointer from integer without a cast [-Wint-conversion]
   12 |   s = strlen(S);
      |              ^
      |              |
      |              char
In file included from main.c:2:
/usr/include/string.h:407:35: note: expected 'const char *' but argument is of type 'char'
  407 | extern size_t strlen (const char *__s)
      |                       ~~~~~~~~~~~~^~~
main.c:15:9: error: subscripted value is neither array nor pointer nor vector
   15 |     if(S[i-1] == S[i]) {
      |         ^
main.c:15:19: error: subscripted value is neither array nor pointer nor vector
   15 |     if(S[i-1] == S[i]) {
      |                   ^
main.c:20:7: error: subscripted value is neither array nor pointer nor vector
   20 |   if(S[0] == S[s]) {
      |       ^
Language: C

#include<stdio.h>
 
int main(void) {
  char S;
  unsigned long long int K;
  int i, l = 0, p = 0;
  
  scanf("%s", S);
  scanf("%d", &K);
  
  for(i = 1;S[i] != '\n';i++) {
    if(S[i-1] == S[i]) {
      l++;
    }
  }
  if(S[0] == S[i]) {
    p = 1;
  }
  
  printf("%lld\n", l * K + p * (K - 1));
  
  return 0;
}

Compiler output:
main.c: In function 'main':
main.c:11:14: error: subscripted value is neither array nor pointer nor vector
   11 |   for(i = 1;S[i] != '\n';i++) {
      |              ^
main.c:12:9: error: subscripted value is neither array nor pointer nor vector
   12 |     if(S[i-1] == S[i]) {
      |         ^
main.c:12:19: error: subscripted value is neither array nor pointer nor vector
   12 |     if(S[i-1] == S[i]) {
      |                   ^
main.c:16:7: error: subscripted value is neither array nor pointer nor vector
   16 |   if(S[0] == S[i]) {
      |       ^
main.c:16:15: error: subscripted value is neither array nor pointer nor vector
   16 |   if(S[0] == S[i]) {
      |               ^
Language: C

#include<stdio.h>

int main(void) {
  char S;
  unsigned long long int K;
  int i, l = 0, p = 0;
  
  scanf("%s", S);
  scanf("%d", &K);
  
  for(i = 1;K[i] != '\n';i++) {
    if(K[i-1] == K[i]) {
      l++;
    }
  }
  if(K[0] == K[i]) {
    p = 1;
  }
  
  printf("%lld\n", l * K + p * (K - 1));
  
  return 0;
}

Compiler output:
main.c: In function 'main':
main.c:11:14: error: subscripted value is neither array nor pointer nor vector
   11 |   for(i = 1;K[i] != '\n';i++) {
      |              ^
main.c:12:9: error: subscripted value is neither array nor pointer nor vector
   12 |     if(K[i-1] == K[i]) {
      |         ^
main.c:12:19: error: subscripted value is neither array nor pointer nor vector
   12 |     if(K[i-1] == K[i]) {
      |                   ^
main.c:16:7: error: subscripted value is neither array nor pointer nor vector
   16 |   if(K[0] == K[i]) {
      |       ^
main.c:16:15: error: subscripted value is neither array nor pointer nor vector
   16 |   if(K[0] == K[i]) {
      |               ^
Language: C++

#define _GLIBCXX_DEBUG//TLEの原因になるので注意！！！！！！！！！！！
#include<cmath>
#include <bits/stdc++.h>
typedef long long ll;
using namespace std;
vector<int> arr;
stack<int> st;
queue<int> qu;
queue<pair<int,int> > qu2;
priority_queue<int> pq;
#define rep(i,n) for(int i=0; i<(int)(n); i++)
#define rep2(i,n) for(int i=1; i<=(int)(n); i++)
#define mins(x,y) x=min(x,y)
#define maxs(x,y) x=max(x,y)
typedef set<int> set_t;
typedef set<string> set_g;
typedef complex<double> xy_t;
static const int NIL = -1;
static const int INF = 1000000007;
#define mp make_pair
#define sz(x) int(x.xise())
#define mod 1000000007
#define reps(i,s,n) for(int i = s; i < n; i++)
#define int long long

//cerrはコメントアウトしなくても通る//ただしTLEを引き起こすことがある

int main(){
    string s;
    cin >> s;
    int n=s.size();
    ll cnt=0;
    ll temp=1;
    ll last;
    int first;
    int p=1;
    int q=0;
    rep(i,n){
        if(i==n-1){
            //cerr<<temp<<endl;
            if(temp==n){
                q=1;
            }
            cnt+=temp/2;
            last=temp;
            continue;
        }
        if(s[i]==s[i+1]){
            temp++;
        }else{
            //cerr<<temp<<endl;
            if(p){
                first=temp;
            }
            p=0;
            cnt+=temp/2;
            temp=1;
        }
    }
    cerr<<cnt<<endl;
    ll k;
    cin >> k;
    if(q){
        ll tp=(n/2)*k;
        cout<<tp<<endl;
        return 0;
    }
    ll ans=0;
    ans=k*cnt;
    if(s[0]==s[n-1]){
        cerr<<first<<last<<endl;
        ans-=(first/2+last/2-(first+last)/2)*(k-1);
        cout<<ans<<endl;
    }else{
        cout<<ans<<endl;
    }
    return 0;
}

Compiler output:
cc1plus: error: '::main' must return 'int'
Language: C++

#include<bits/stdc++.h>
int main(){
  std::string s[3];
  long long k,a[3]={};
  std::cin>>s[0]>>k;
  for(size_t i=0;i<2;++i) s[i+1]=s[i]+s[0];
  for(size_t i=0;i<3;++i) for(size_t j=1;j<s[i].length();++j) if(s[i][j]==s[i][j-1]) ++a[i],++j;
  std::cout<<(k&1?a[0]:a[1])+(k-1)/2*(a[2]-a[0])<<std::endl;
  assert(a1+a2==a3);
}


Compiler output:
In file included from /usr/include/c++/14/cassert:44,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:106,
                 from a.cc:1:
a.cc: In function 'int main()':
a.cc:9:10: error: 'a1' was not declared in this scope; did you mean 'a'?
    9 |   assert(a1+a2==a3);
      |          ^~
a.cc:9:13: error: 'a2' was not declared in this scope; did you mean 'a'?
    9 |   assert(a1+a2==a3);
      |             ^~
a.cc:9:17: error: 'a3' was not declared in this scope; did you mean 'a'?
    9 |   assert(a1+a2==a3);
      |                 ^~
Language: Java

// Why do we fall ? So we can learn to pick ourselves up.
import java.util.*;
public class solve {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        char[] s = sc.next().toCharArray();
        long k = sc.nextLong();
        long n = s.length;
        if (n == 1) {
            if (k == 1) {
                System.out.println(0);
            } else {
                System.out.println(k/2);
            }
        } else {
                ArrayList<Long> aa = new ArrayList<>();
                long i = 0;
                long ss = 0L;
                while (true) {
                    if (i == n) {
                        break;
                    }
                    char curr = s[(int)i];
                    long temp = 1L;
                    i += 1;
                    if (i == n) {
                        break;
                    }
                    while (s[(int) i] == curr) {
                        temp += 1;
                        i += 1;
                        if (i == n) {
                            break;
                        }
                    }
                    aa.add(temp);

                }
                if(aa.size() > 1){
                    for (Long aLong : aa) {
                        ss += (aLong / 2L) * k;
                    }
                    if(s[0] == (s[(int) (n-1)]) && aa.get(0) %2 == 1 && aa.get(aa.size()-1)%2 == 1){
                        ss += k-1;
                    }
                } else {
                    ss += (n*k)/2L;
                }
                System.out.println(ss);
        }
    }
}

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

#include"bits/stdc++.h"
using namespace std;
int main(){
	int num;
	string ch;
	long long ans1=0,ans2=0;
	cin>>ch>>num;
	if (s == string(n, s[0])) {
    	cout << n * k / 2 << '\n';
  	}
  	else {
  		for(int i=0;i<ch.length();i++){
			if(ch[i]==ch[i+1]){
				ans1++;
				i++;
			}
		}
		for(int i=0;i<ch.length()*2;i++){
			if(ch[i%ch.length()]==ch[(i+1)%ch.length()]){
				ans2++;
				i++;
			}
		}
		long long ans=0;
		ans=ans1+(ans2-ans1)*(num-1);
		cout<<ans<<endl;
	}
	
}//&&i+1<ch.length()*2

Compiler output:
a.cc: In function 'int main()':
a.cc:8:13: error: 's' was not declared in this scope
    8 |         if (s == string(n, s[0])) {
      |             ^
a.cc:8:25: error: 'n' was not declared in this scope; did you mean 'yn'?
    8 |         if (s == string(n, s[0])) {
      |                         ^
      |                         yn
a.cc:9:21: error: 'k' was not declared in this scope
    9 |         cout << n * k / 2 << '\n';
      |                     ^
Language: C++

#include"bits/stdc++.h"
using namespace std;
int main(){
	int num;
	string ch;
	long long ans1=0,ans2=0;
	cin>>ch>>num;
	for(int i=0;i<ch.length();i++){
		if(ch[i]==ch[i+1]){
			ans1++;
			i++;
		}
	}
	for(int i=0;i<ch.length()*2;i++){
		if(ch[i%ch.length()]==ch[(i+1)%ch.length()]&&i+1<ch.length()*2){
			ans2++;
			i++;
		}//iiooiiiooi
	}
	long long ans=0;
	ans=ans1+ans2*((k-1)/2);
	if((k-1)%2==1)ans+=ans2-ans1;
	cout<<ans<<endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:21:25: error: 'k' was not declared in this scope
   21 |         ans=ans1+ans2*((k-1)/2);
      |                         ^
Language: C++

#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const int N = 1e7+5;
vector<ll> c;
int main(){
	ios::sync_with_stdio(false);
	cin.tie(0);
	string s;
	ll k;
	cin >> s >> k;
	c.clear();
	ll len=s.length();
	ll num=1;
	char ch=s[0];
	ll sum=0;
	for(ll i=1;i<len;i++){
		if(s[i]==ch)	num++;
		else{
			c.push_back(num);
			sum+=num/2;
			num=1;
			c=s[i];
		}
	}
	c.push_back(num);
	int l=c.size();
	if(l==1)	cout << (len*k/2) << endl;
	else if(s[0]==s[l-1]){
		sum-=c[0]/2;
		cout << (sum*k+c[0]/2+(c[l-1]/2)*(k-1));
	}
	else{
		sum+=c[l-1]/2;
		cout << (sum*k) << endl;
	}
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:23:30: error: no match for 'operator=' (operand types are 'std::vector<long long int>' and '__gnu_cxx::__alloc_traits<std::allocator<char>, char>::value_type' {aka 'char'})
   23 |                         c=s[i];
      |                              ^
In file included from /usr/include/c++/14/vector:72,
                 from /usr/include/c++/14/functional:64,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:53,
                 from a.cc:1:
/usr/include/c++/14/bits/vector.tcc:210:5: note: candidate: 'std::vector<_Tp, _Alloc>& std::vector<_Tp, _Alloc>::operator=(const std::vector<_Tp, _Alloc>&) [with _Tp = long long int; _Alloc = std::allocator<long long int>]'
  210 |     vector<_Tp, _Alloc>::
      |     ^~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/vector.tcc:211:42: note:   no known conversion for argument 1 from '__gnu_cxx::__alloc_traits<std::allocator<char>, char>::value_type' {aka 'char'} to 'const std::vector<long long int>&'
  211 |     operator=(const vector<_Tp, _Alloc>& __x)
      |               ~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~
In file included from /usr/include/c++/14/vector:66:
/usr/include/c++/14/bits/stl_vector.h:766:7: note: candidate: 'std::vector<_Tp, _Alloc>& std::vector<_Tp, _Alloc>::operator=(std::vector<_Tp, _Alloc>&&) [with _Tp = long long int; _Alloc = std::allocator<long long int>]'
  766 |       operator=(vector&& __x) noexcept(_Alloc_traits::_S_nothrow_move())
      |       ^~~~~~~~
/usr/include/c++/14/bits/stl_vector.h:766:26: note:   no known conversion for argument 1 from '__gnu_cxx::__alloc_traits<std::allocator<char>, char>::value_type' {aka 'char'} to 'std::vector<long long int>&&'
  766 |       operator=(vector&& __x) noexcept(_Alloc_traits::_S_nothrow_move())
      |                 ~~~~~~~~~^~~
/usr/include/c++/14/bits/stl_vector.h:788:7: note: candidate: 'std::vector<_Tp, _Alloc>& std::vector<_Tp, _Alloc>::operator=(std::initializer_list<_Tp>) [with _Tp = long long int; _Alloc = std::allocator<long long int>]'
  788 |       operator=(initializer_list<value_type> __l)
      |       ^~~~~~~~
/usr/include/c++/14/bits/stl_vector.h:788:46: note:   no known conversion for argument 1 from '__gnu_cxx::__alloc_traits<std::allocator<char>, char>::value_type' {aka 'char'} to 'std::initializer_list<long long int>'
  788 |       operator=(initializer_list<value_type> __l)
      |                 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~