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

#include <stdio.h>

int  main(){
const char *KEY = "keyence";
char s[100];
char *pt;
int i;

scanf("%s",s);

if(0 == (pt = strstr(s,"keyence"))){
 printf("NO\n");
 return 0;
}

for(i=0;;i++;){
if(*pt == KEY[i]){
 pt++;
}else{
 break;
}
}

if(0 == (pt = strstr(pt,&KEY[i]))){
 printf("NO\n");
 return 0;
}

for(;;i++;){
if(*pt == KEY[i]){
 pt++;
}else{
 break;
}
}
if(i>=7){
printf("YES\n");
return 0;
}

printf("NO\n");
return 0;


}


Compiler output:
a.cc: In function 'int main()':
a.cc:11:15: error: 'strstr' was not declared in this scope
   11 | if(0 == (pt = strstr(s,"keyence"))){
      |               ^~~~~~
a.cc:2:1: note: 'strstr' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
    1 | #include <stdio.h>
  +++ |+#include <cstring>
    2 | 
a.cc:16:13: error: expected ')' before ';' token
   16 | for(i=0;;i++;){
      |    ~        ^
      |             )
a.cc:16:14: error: expected primary-expression before ')' token
   16 | for(i=0;;i++;){
      |              ^
a.cc:24:15: error: 'strstr' was not declared in this scope
   24 | if(0 == (pt = strstr(pt,&KEY[i]))){
      |               ^~~~~~
a.cc:24:15: note: 'strstr' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
a.cc:29:10: error: expected ')' before ';' token
   29 | for(;;i++;){
      |    ~     ^
      |          )
a.cc:29:11: error: expected primary-expression before ')' token
   29 | for(;;i++;){
      |           ^
Language: C++

//1974
#include<bits/stdc++.h>
using namespace std;
int main()
{int l,l1,l2,i,j;
	 string s,a;
	 cin>>s;
	 a="keyence";
	 i=0;
	 l=a.size();
	 while(a[i]==s[i])
	 {
	 	i++;
	 }l1=i;
	 i=l-1;
	 j=s.size()-1;
	 while(a[i]==s[j])
	 {
	 	i--;j--;
	 }
	 l2= s.size()-1-j;
	 if(l1+l2==l||l1+l2=2*l)
	 cout<<"YES";
	 else cout<<"NO";
	 
	  
	 
	 
}

Compiler output:
a.cc: In function 'int main()':
a.cc:22:21: error: lvalue required as left operand of assignment
   22 |          if(l1+l2==l||l1+l2=2*l)
      |             ~~~~~~~~^~~~~~~
Language: C++

#include <stdio.h>

int  main(){
char *KEY = "keyence";
char s[100];
char *pt;
int i;

scanf("%s",s);

if(0 == (pt = strstr(s,"keyence"))){
 printf("NO\n");
 return;
}

for(i=0;;i++;){
if(*pt == KEY[i]){
 pt++;
}else{
 break;
}
}

if(0 == (pt = strstr(pt,&KEY[i]))){
 printf("NO\n");
 return 0;
}

for(;;i++;){
if(*pt == KEY[i]){
 pt++;
}else{
 break;
}
}
if(i>=7){
printf("YES\n");
return 0;
}

printf("NO\n");
return 0;


}


Compiler output:
a.cc: In function 'int main()':
a.cc:4:13: warning: ISO C++ forbids converting a string constant to 'char*' [-Wwrite-strings]
    4 | char *KEY = "keyence";
      |             ^~~~~~~~~
a.cc:11:15: error: 'strstr' was not declared in this scope
   11 | if(0 == (pt = strstr(s,"keyence"))){
      |               ^~~~~~
a.cc:2:1: note: 'strstr' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
    1 | #include <stdio.h>
  +++ |+#include <cstring>
    2 | 
a.cc:13:2: error: return-statement with no value, in function returning 'int' [-fpermissive]
   13 |  return;
      |  ^~~~~~
a.cc:16:13: error: expected ')' before ';' token
   16 | for(i=0;;i++;){
      |    ~        ^
      |             )
a.cc:16:14: error: expected primary-expression before ')' token
   16 | for(i=0;;i++;){
      |              ^
a.cc:24:15: error: 'strstr' was not declared in this scope
   24 | if(0 == (pt = strstr(pt,&KEY[i]))){
      |               ^~~~~~
a.cc:24:15: note: 'strstr' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
a.cc:29:10: error: expected ')' before ';' token
   29 | for(;;i++;){
      |    ~     ^
      |          )
a.cc:29:11: error: expected primary-expression before ')' token
   29 | for(;;i++;){
      |           ^
Language: C++


a = list(input().rstrip())


count = 0

for i in range(len(a)):
    if a[i] == 'k':
        count = count + 1
        if a[i+1] == 'e':
            count = count + 1
            if a[i+2] == 'y':
                count = count + 1
                if a[i+3] == 'e':
                    count = count + 1
                    if a[i+4] == 'n':
                        count = count + 1
                        if a[i+5] == 'c':
                            count = count + 1
                            if a[i+5] == 'e':
                                count = count + 1
                            else:
                                break
                        else:
                            break    
                    else:
                        break
                else:
                    break
            else:
                break    
        else:
            break   
    else:
        continue

a.reverse()

for j in range(len(a)):
    if a[i] == 'e':
        count = count + 1
        if a[i+1] == 'c':
            count = count + 1
            if a[i+2] == 'n':
                count = count + 1
                if a[i+3] == 'e':
                    count = count + 1
                    if a[i+4] == 'y':
                        count = count + 1
                        if a[i+5] == 'e':
                            count = count + 1
                            if a[i+5] == 'k':
                                count = count + 1
                            else:
                                break
                        else:
                            break    
                    else:
                        break
                else:
                    break
            else:
                break    
        else:
            break   
    else:
        continue

if count >= 7:
    print('YES')
else:
    print('NO')

Compiler output:
a.cc:70:11: warning: multi-character character constant [-Wmultichar]
   70 |     print('YES')
      |           ^~~~~
a.cc:72:11: warning: multi-character character constant [-Wmultichar]
   72 |     print('NO')
      |           ^~~~
a.cc:2:1: error: 'a' does not name a type
    2 | a = list(input().rstrip())
      | ^
Language: C++

#include<iostream>
#include<algorithm>
#include<functional>
using namespace std;
int main(){
  string a;
  cin>>a;
  if(a[0]=="k" and a[1]=="e" and a[2]=="y" and a[a.size()-1]=="e" and a[a.size()-2]=="c" and a[a.size()-3]=="n" and a[a.size()-4]=="e")
    cout<<"YES"<<endl;
  else
    cout<<"NO"<<endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:8:10: error: ISO C++ forbids comparison between pointer and integer [-fpermissive]
    8 |   if(a[0]=="k" and a[1]=="e" and a[2]=="y" and a[a.size()-1]=="e" and a[a.size()-2]=="c" and a[a.size()-3]=="n" and a[a.size()-4]=="e")
a.cc:8:24: error: ISO C++ forbids comparison between pointer and integer [-fpermissive]
    8 |   if(a[0]=="k" and a[1]=="e" and a[2]=="y" and a[a.size()-1]=="e" and a[a.size()-2]=="c" and a[a.size()-3]=="n" and a[a.size()-4]=="e")
a.cc:8:38: error: ISO C++ forbids comparison between pointer and integer [-fpermissive]
    8 |   if(a[0]=="k" and a[1]=="e" and a[2]=="y" and a[a.size()-1]=="e" and a[a.size()-2]=="c" and a[a.size()-3]=="n" and a[a.size()-4]=="e")
a.cc:8:61: error: ISO C++ forbids comparison between pointer and integer [-fpermissive]
    8 |   if(a[0]=="k" and a[1]=="e" and a[2]=="y" and a[a.size()-1]=="e" and a[a.size()-2]=="c" and a[a.size()-3]=="n" and a[a.size()-4]=="e")
a.cc:8:84: error: ISO C++ forbids comparison between pointer and integer [-fpermissive]
    8 |   if(a[0]=="k" and a[1]=="e" and a[2]=="y" and a[a.size()-1]=="e" and a[a.size()-2]=="c" and a[a.size()-3]=="n" and a[a.size()-4]=="e")
a.cc:8:107: error: ISO C++ forbids comparison between pointer and integer [-fpermissive]
    8 |   if(a[0]=="k" and a[1]=="e" and a[2]=="y" and a[a.size()-1]=="e" and a[a.size()-2]=="c" and a[a.size()-3]=="n" and a[a.size()-4]=="e")
a.cc:8:130: error: ISO C++ forbids comparison between pointer and integer [-fpermissive]
    8 |   if(a[0]=="k" and a[1]=="e" and a[2]=="y" and a[a.size()-1]=="e" and a[a.size()-2]=="c" and a[a.size()-3]=="n" and a[a.size()-4]=="e")
Language: C++

#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int , int> P;
typedef pair<ll, ll> PL;
const int INT_INF = 2147483646;
const ll LL_INF = 9223372036854775807;
 
bool SecondCompare(const pair<int,int> &a,const pair<int,int> &b)
{
       return a.second<b.second;
}
 
bool SecondCompareDes(const pair<int,int> &a,const pair<int,int> &b)
{
       return a.second>b.second;
}
 
string s;
int f;
string ans = "keyence";
int pos;
string kou;

int main(){
    cin >> s;
    for(int i = 0; i < s.length(); i++){
        if(pos != ans.length()){
            if(ans[pos] == s[i]){
                kou += ans[pos];
                ++pos;
            }
            else{
                if(f == 0)  f = 1;
                else if(f == 2){
                  cout << "NO\n";
                    return 0;
                }
            }
        }
        else{
            if(f == 2){
                                  cout << "NO\n";
                    return 0;
            }

        }
    if(pos == ans.length())cout << "YES\n";
    else    cout << "NO\n";
}

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

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

int main() {
  int i, n;
  bool c = false;
  string s;
  cin >> s;
  n = s.size();
  if (s.substr(n - 7, 7) == "keyence") {
    c = true;
  } else if (s.substr(0, 1) == "k" && s.substr(n - 6, 6) == "eyence") {
    cout << s.substr(0, 1) << "\n";
    c = true;
  } else if (s.substr(0, 2) == "ke" && s.substr(n - 5, 5) == "yence") {
    c = true;
  } else if (s.substr(0, 3) == "key" && s.substr(n - 4, 4) == "ence") {
    c = true;
  } else if (s.substr(0, 4) == "keye" && s.substr(n - 3, 3) == "nce") {
    c = true;
  } else if (s.substr(0, 5) == "keyen" && s.substr(n - 2, 2) == "ce") {
    c = true;
  } else if (s.substr(0, 6) == "keyenc" && s.substr(n - 1, 1) == "e") {
    c = true;
  } else if (s.substr(0, 7) == "keyence")) {
    c = true;
  }
  if (c) {
    cout << "YES"
         << "\n";
  } else {
    cout << "NO"
         << "\n";
  }
  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:25:42: error: expected primary-expression before ')' token
   25 |   } else if (s.substr(0, 7) == "keyence")) {
      |                                          ^
Language: C++

#include<iostream>
#include<algorithm>
using namespace std;
int main(){
  string a;
  cin>>a;
  if(a[0]=="k" and a[1]=="e" and a[2]=="y" and a[a.size()-1]=="e" and a[a.size()-2]=="c" and a[a.size()-3]=="n" and a[a.size()-4]=="e")
    cout<<"YES"<<endl;
  else
    cout<<"NO"<<endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:7:10: error: ISO C++ forbids comparison between pointer and integer [-fpermissive]
    7 |   if(a[0]=="k" and a[1]=="e" and a[2]=="y" and a[a.size()-1]=="e" and a[a.size()-2]=="c" and a[a.size()-3]=="n" and a[a.size()-4]=="e")
a.cc:7:24: error: ISO C++ forbids comparison between pointer and integer [-fpermissive]
    7 |   if(a[0]=="k" and a[1]=="e" and a[2]=="y" and a[a.size()-1]=="e" and a[a.size()-2]=="c" and a[a.size()-3]=="n" and a[a.size()-4]=="e")
a.cc:7:38: error: ISO C++ forbids comparison between pointer and integer [-fpermissive]
    7 |   if(a[0]=="k" and a[1]=="e" and a[2]=="y" and a[a.size()-1]=="e" and a[a.size()-2]=="c" and a[a.size()-3]=="n" and a[a.size()-4]=="e")
a.cc:7:61: error: ISO C++ forbids comparison between pointer and integer [-fpermissive]
    7 |   if(a[0]=="k" and a[1]=="e" and a[2]=="y" and a[a.size()-1]=="e" and a[a.size()-2]=="c" and a[a.size()-3]=="n" and a[a.size()-4]=="e")
a.cc:7:84: error: ISO C++ forbids comparison between pointer and integer [-fpermissive]
    7 |   if(a[0]=="k" and a[1]=="e" and a[2]=="y" and a[a.size()-1]=="e" and a[a.size()-2]=="c" and a[a.size()-3]=="n" and a[a.size()-4]=="e")
a.cc:7:107: error: ISO C++ forbids comparison between pointer and integer [-fpermissive]
    7 |   if(a[0]=="k" and a[1]=="e" and a[2]=="y" and a[a.size()-1]=="e" and a[a.size()-2]=="c" and a[a.size()-3]=="n" and a[a.size()-4]=="e")
a.cc:7:130: error: ISO C++ forbids comparison between pointer and integer [-fpermissive]
    7 |   if(a[0]=="k" and a[1]=="e" and a[2]=="y" and a[a.size()-1]=="e" and a[a.size()-2]=="c" and a[a.size()-3]=="n" and a[a.size()-4]=="e")
Language: C++

#include<iostream>
#include<algorithm>
using namespace std;
int main(){
  string a;
  cin>>a;
  if(a[0]=="k" and a[1]=="e" and a[2]=="y" and a[a.size()-1]=="e" and a[a.size()-2]=="c" and a[a.size-3]=="n" and a[a.size-4]=="e")
    cout<<"YES"<<endl;
  else
    cout<<"NO"<<endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:7:10: error: ISO C++ forbids comparison between pointer and integer [-fpermissive]
    7 |   if(a[0]=="k" and a[1]=="e" and a[2]=="y" and a[a.size()-1]=="e" and a[a.size()-2]=="c" and a[a.size-3]=="n" and a[a.size-4]=="e")
a.cc:7:24: error: ISO C++ forbids comparison between pointer and integer [-fpermissive]
    7 |   if(a[0]=="k" and a[1]=="e" and a[2]=="y" and a[a.size()-1]=="e" and a[a.size()-2]=="c" and a[a.size-3]=="n" and a[a.size-4]=="e")
a.cc:7:38: error: ISO C++ forbids comparison between pointer and integer [-fpermissive]
    7 |   if(a[0]=="k" and a[1]=="e" and a[2]=="y" and a[a.size()-1]=="e" and a[a.size()-2]=="c" and a[a.size-3]=="n" and a[a.size-4]=="e")
a.cc:7:61: error: ISO C++ forbids comparison between pointer and integer [-fpermissive]
    7 |   if(a[0]=="k" and a[1]=="e" and a[2]=="y" and a[a.size()-1]=="e" and a[a.size()-2]=="c" and a[a.size-3]=="n" and a[a.size-4]=="e")
a.cc:7:84: error: ISO C++ forbids comparison between pointer and integer [-fpermissive]
    7 |   if(a[0]=="k" and a[1]=="e" and a[2]=="y" and a[a.size()-1]=="e" and a[a.size()-2]=="c" and a[a.size-3]=="n" and a[a.size-4]=="e")
a.cc:7:98: error: invalid use of member function 'std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::size_type std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::size() const [with _CharT = char; _Traits = std::char_traits<char>; _Alloc = std::allocator<char>; size_type = long unsigned int]' (did you forget the '()' ?)
    7 |   if(a[0]=="k" and a[1]=="e" and a[2]=="y" and a[a.size()-1]=="e" and a[a.size()-2]=="c" and a[a.size-3]=="n" and a[a.size-4]=="e")
      |                                                                                                ~~^~~~
      |                                                                                                      ()
a.cc:7:119: error: invalid use of member function 'std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::size_type std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::size() const [with _CharT = char; _Traits = std::char_traits<char>; _Alloc = std::allocator<char>; size_type = long unsigned int]' (did you forget the '()' ?)
    7 |   if(a[0]=="k" and a[1]=="e" and a[2]=="y" and a[a.size()-1]=="e" and a[a.size()-2]=="c" and a[a.size-3]=="n" and a[a.size-4]=="e")
      |                                                                                                                     ~~^~~~
      |                                                                                                                           ()
Language: C++

#include <stdio.h>

void main(){
char *KEY = "keyence";
char s[100];
char *pt;
int i;

scanf("%s",s);

if(0 == (pt = strstr(s,"keyence"))){
 printf("NO\n");
 return;
}

for(i=0;;i++;){
if(*pt == KEY[i]){
 pt++;
}else{
 break;
}
}

if(0 == (pt = strstr(pt,&KEY[i]))){
 printf("NO\n");
 return;
}

for(;;i++;){
if(*pt == KEY[i]){
 pt++;
}else{
 break;
}
}
if(i>=7){
printf("YES\n");
return;
}

printf("NO\n");
return;
}

Compiler output:
a.cc:3:1: error: '::main' must return 'int'
    3 | void main(){
      | ^~~~
a.cc: In function 'int main()':
a.cc:4:13: warning: ISO C++ forbids converting a string constant to 'char*' [-Wwrite-strings]
    4 | char *KEY = "keyence";
      |             ^~~~~~~~~
a.cc:11:15: error: 'strstr' was not declared in this scope
   11 | if(0 == (pt = strstr(s,"keyence"))){
      |               ^~~~~~
a.cc:2:1: note: 'strstr' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
    1 | #include <stdio.h>
  +++ |+#include <cstring>
    2 | 
a.cc:13:2: error: return-statement with no value, in function returning 'int' [-fpermissive]
   13 |  return;
      |  ^~~~~~
a.cc:16:13: error: expected ')' before ';' token
   16 | for(i=0;;i++;){
      |    ~        ^
      |             )
a.cc:16:14: error: expected primary-expression before ')' token
   16 | for(i=0;;i++;){
      |              ^
a.cc:24:15: error: 'strstr' was not declared in this scope
   24 | if(0 == (pt = strstr(pt,&KEY[i]))){
      |               ^~~~~~
a.cc:24:15: note: 'strstr' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
a.cc:26:2: error: return-statement with no value, in function returning 'int' [-fpermissive]
   26 |  return;
      |  ^~~~~~
a.cc:29:10: error: expected ')' before ';' token
   29 | for(;;i++;){
      |    ~     ^
      |          )
a.cc:29:11: error: expected primary-expression before ')' token
   29 | for(;;i++;){
      |           ^
a.cc:38:1: error: return-statement with no value, in function returning 'int' [-fpermissive]
   38 | return;
      | ^~~~~~
a.cc:42:1: error: return-statement with no value, in function returning 'int' [-fpermissive]
   42 | return;
      | ^~~~~~
Language: C++

#include<cstdio>
#include<algorithm>
#include<cstring>
using namespace std;
int n;
char s[1010],t[1010];
const char st[8]={0,'k','e','y','e','n','c','e'};
bool cmp(char s[]) {
	for (int i=1;i<=7;i++) if (s[i]!=st[i]) return 0;
	return 1;
}
int main() {
	gets(s+1); n=strlen(s+1);
	if (n==7&&cmp(s)) {
		puts("YES"); return 0;
	} 
	for (int i=1;i<=8;i++) {
		for (int j=1;j<i;j++) t[j]=s[j];
		for (int j=7;j>=i;j--) t[j]=s[n-7+j];
		//for (int j=1;j<=7;j++) putchar(t[j]); puts("");
		if (cmp(t)) {
			puts("YES"); return 0;
		}
	}
	puts("NO");
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:13:9: error: 'gets' was not declared in this scope; did you mean 'getw'?
   13 |         gets(s+1); n=strlen(s+1);
      |         ^~~~
      |         getw
Language: Java

import java.util.Scanner;

public class Main5 {

	public static void main(String... args) {

		Scanner sc = new Scanner(System.in);

		String str = sc.next();
		sc.close();



		if (str.matches(".*k.*eyence.*")) {
			System.out.println("YES");
			return;
		}

		if (str.matches(".*ke.*yence.*")) {
			System.out.println("YES");
			return;
		}

		if (str.matches(".*key.*ence.*")) {
			System.out.println("YES");
			return;
		}

		if (str.matches(".*keye.*nce.*")) {
			System.out.println("YES");
			return;
		}

		if (str.matches(".*keyen.*ce.*")) {
			System.out.println("YES");
			return;
		}

		if (str.matches(".*keyenc.*e.*")) {
			System.out.println("YES");
			return;
		}

		if (str.matches(".*keyence.*")) {
			System.out.println("YES");
			return;
		}

		System.out.println("NO");
	}
}


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

use strict;
use warnings;

$_ = <>;
chomp;
if(m/^.*keyence$/){
  print "YES\n";
  exit(0);
}
if(m/^k.*eyence$/){
  print "YES\n";
  exit(0);
}
if(m/^ke.*yence$/){
  print "YES\n";
  exit(0);
}
if(m/^key.*ence$/){
  print "YES\n";
  exit(0);
}
if(m/^keye.*nce$/){
  print "YES\n";
  exit(0);
}
if(m/^keyen.*ce$/){
  print "YES\n";
  exit(0);
}
if(m/^keyenc.*e$/){
  print "YES\n";
  exit(0);
}
if(m/^keyence.*$/){
  print "YES\n";
  exit(0);
}
print "NO\n";
exit(0);


Compiler output:
a.cc:1:1: error: 'use' does not name a type
    1 | use strict;
      | ^~~
a.cc:2:1: error: 'use' does not name a type
    2 | use warnings;
      | ^~~
a.cc:4:1: error: '$_' does not name a type
    4 | $_ = <>;
      | ^~
a.cc:5:1: error: 'chomp' does not name a type
    5 | chomp;
      | ^~~~~
a.cc:6:1: error: expected unqualified-id before 'if'
    6 | if(m/^.*keyence$/){
      | ^~
a.cc:10:1: error: expected unqualified-id before 'if'
   10 | if(m/^k.*eyence$/){
      | ^~
a.cc:14:1: error: expected unqualified-id before 'if'
   14 | if(m/^ke.*yence$/){
      | ^~
a.cc:18:1: error: expected unqualified-id before 'if'
   18 | if(m/^key.*ence$/){
      | ^~
a.cc:22:1: error: expected unqualified-id before 'if'
   22 | if(m/^keye.*nce$/){
      | ^~
a.cc:26:1: error: expected unqualified-id before 'if'
   26 | if(m/^keyen.*ce$/){
      | ^~
a.cc:30:1: error: expected unqualified-id before 'if'
   30 | if(m/^keyenc.*e$/){
      | ^~
a.cc:34:1: error: expected unqualified-id before 'if'
   34 | if(m/^keyence.*$/){
      | ^~
a.cc:38:1: error: 'print' does not name a type; did you mean 'int'?
   38 | print "NO\n";
      | ^~~~~
      | int
a.cc:39:5: error: expected constructor, destructor, or type conversion before '(' token
   39 | exit(0);
      |     ^
Language: C++


#include <cstdio>
#include <algorithm>
#include <iostream>
#include <vector>
using namespace std;
#define REP(i, n) for(int i = 0; i < (int)(n); ++i)
typedef long long ll;

char buf[110];
const char * keyence = "keyence";

int main(void) {
  scanf("%s", buf);
  int n = strlen(buf);
  bool ok = false;
  REP(ed, n) {
    REP(bg, ed+1) {
      if(n - (ed-bg) != 7) {
        continue;
      }
      int i1 = 0;
      REP(i, n) {
        if(!(bg <= i && i < ed)) {
          if(buf[i] == keyence[i1]) {
            ++i1;
          } else {
            goto NEXT;
          }
        }
      }
      if(i1 == 7) {
        ok = true;
        goto OUT;
      }
    NEXT:
      ;
    }
  }
 OUT:
  puts(ok ? "YES" : "NO");

  return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:15:11: error: 'strlen' was not declared in this scope
   15 |   int n = strlen(buf);
      |           ^~~~~~
a.cc:6:1: note: 'strlen' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
    5 | #include <vector>
  +++ |+#include <cstring>
    6 | using namespace std;
Language: C++

#include <bits/stdc++.h>

#ifdef NON_SUBMIT
#define TEST(n) (n)
#else
#define TEST(n) ((void)0)
#endif

using namespace std;

const string chk="keyence";

int main()
{
	ios::sync_with_stdio(false);
	cin.tie(NULL); cout.tie(NULL);
	TEST(freopen("input.txt", "r", stdin));
	TEST(freopen("output.txt", "w", stdout));
	TEST(freopen("debug.txt", "w", stderr));
	string s;
	int j=0;
	cin>>s;
	for(auto c: s) {
		if(c==chk[j] && ++j=chk.size()) {
			break;
		}
	}
	cout<<(j==chk.size() ? "YES\n":"NO\n");
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:24:30: error: lvalue required as left operand of assignment
   24 |                 if(c==chk[j] && ++j=chk.size()) {
      |                    ~~~~~~~~~~^~~~~~
Language: C++

#include <bits/stdc++.h>

using namespace std;

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

void solve() {
  string want = "keyence";
  string s;
  cin >> s;
  int j = 0;
  for(int i = 0; i < s.size() && j < want.size(); i++) {
    if(s[i] == want[j]) j++;
  }
  if(j == want.size()) cout << "YES\n";
  else cout << "NO\n";
}

int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL); cout.tie(NULL);
  init();
  solve();
}


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

#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
#define pb push_back
#define FLASH ios::sync_with_stdio(0);cin.tie(0);
#define all(v)  v.begin(),v.end()
const int inf=1e9+7;
const int mod=1e9+7;
const ll INF=1e18;	

bool sz(int a,int b)
{
	return a>b;
}

						void solve()
						{
							
						ll n;
						cin>>n;
						
						ll a[n],b[n],c[n];
						
						int k=0,p=0,q=0;
						for(auto &x:a)cin>>x,c[k++]=x,p+=x;
						
						for(auto &y:b)cin>>y,q+=y;
						if(p<q)
						{
							cout<<-1;
							return;
						}
						ll extra=0,d[n];
							ll ans=0;
						for(int i=0;i<n;i++)
						{
						
							if(a[i]>b[i])
							{
								d[i]=a[i]-b[i];
							}
							else
							d[i]=0;
						
							if(a[i]<b[i])
							{
								//a[i]=b[i];
								extra+=b[i]-a[i];
								ans++;
							}
							
							
								}
								
								
							
								
								for(int i=0;i<n&&extra; )
								{
									if(d[i]>0)
									{
										if(d[i]>extra)
										{
											d[i]-=extra;
											extra=0;
											ans++;
										}
										else
										{
											extra-=d[i];
											d[i]=0;
											ans++;
											i++
											
										}
									}
									else
									i++;
								}
								
								
								cout<<ans;
												
						
						}




int main()
{	
	FLASH
	int t=1;
	
	while(t--)
	{
		solve();
	}
	
}

Compiler output:
a.cc: In function 'void solve()':
a.cc:74:92: error: expected ';' before '}' token
   74 |                                                                                         i++
      |                                                                                            ^
      |                                                                                            ;
   75 | 
   76 |                                                                                 }
      |                                                                                 ~
Language: C++

v#include <bits/stdc++.h>
#define _GLIBCXX_DEBUG
#define rep(i,n) for(int i=0;i<(n);++i)
#define repi(i,a,b) for(int i=int(a);i<int(b);++i)
#define all(x) (x).begin(), (x).end()
#define PI 3.14159265358979323846264338327950L
using namespace std;
typedef long long ll;
typedef long double ld;
int main() {
    int n;
    cin>>n;
    vector<ll> a(n),b(n),c;
    ll suma=0,sumb=0;
    rep(i,n){
        cin>>a[i];
        suma+=a[i];
    }
    ll cnt1=0,cnt2=0,s=0;
    rep(i,n){
        cin>>b[i];
        if(a[i]<b[i]){
            cnt1++;
            s+=b[i]-a[i];
        }
        else if(a[i]>b[i]) c.push_back(a[i]-b[i]);
        sumb+=b[i];
    }
    sort(all(c));
    int i=n-1;
    while(s>0){
        s-=c[i];
        cnt2++;
        i--;
    }
    if(suma<sumb) cout<<-1;
    else cout<<cnt1+cnt2;
}

Compiler output:
a.cc:1:2: error: stray '#' in program
    1 | v#include <bits/stdc++.h>
      |  ^
a.cc:1:1: error: 'v' does not name a type
    1 | v#include <bits/stdc++.h>
      | ^
a.cc: In function 'int main()':
a.cc:12:5: error: 'cin' was not declared in this scope
   12 |     cin>>n;
      |     ^~~
a.cc:13:5: error: 'vector' was not declared in this scope
   13 |     vector<ll> a(n),b(n),c;
      |     ^~~~~~
a.cc:13:14: error: expected primary-expression before '>' token
   13 |     vector<ll> a(n),b(n),c;
      |              ^
a.cc:13:16: error: 'a' was not declared in this scope
   13 |     vector<ll> a(n),b(n),c;
      |                ^
a.cc:13:21: error: 'b' was not declared in this scope
   13 |     vector<ll> a(n),b(n),c;
      |                     ^
a.cc:13:26: error: 'c' was not declared in this scope
   13 |     vector<ll> a(n),b(n),c;
      |                          ^
a.cc:29:5: error: 'sort' was not declared in this scope; did you mean 'short'?
   29 |     sort(all(c));
      |     ^~~~
      |     short
a.cc:36:19: error: 'cout' was not declared in this scope
   36 |     if(suma<sumb) cout<<-1;
      |                   ^~~~
a.cc:37:10: error: 'cout' was not declared in this scope
   37 |     else cout<<cnt1+cnt2;
      |          ^~~~
Language: C++

#include <bits/stdc++.h>
using namespace std;
#define int long long
signed main() {
    int N;
	cin >> N;
    vector<int>A(N);
    vector<int>B(N);
    int ans = 0;
    int res = 0;
    vector<int>cnt;
	for (int i = 0; i < N; i++) {
        cin >> A[i];
    }
	for (int i = 0; i < N; i++) {
		cin >> B[i];
		if (A[i] >= B[i]) {
            cnt.push_back(A[i]-B[i]);
        }
		else { 
            res+=(B[i]-A[i]); 
            ans++; 
        }
	}
	sort(cnt.begin(), cnt.end()); 
    reverse(cnt.begin(), cnt.end());
	for (int i = 0; i < cnt.size(); i++) {
		if (res > 0) { 
            res -= X[i];
            ans++;
        }
	}
	if (res > 0) {
        ans = -1;
    }
	cout << ans << endl;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:29:20: error: 'X' was not declared in this scope
   29 |             res -= X[i];
      |                    ^
Language: C++

#include <bits/stdc++.h>
using namespace std;
#define int long long
signed main() {
    int N;
	cin >> N;
    vector<int>A(N);
    vector<int>B(N);
    int ans = 0;
    int res = 0;
    vector<int>cnt;
	for (int i = 0; i < N; i++) {
        cin >> A[i];
    }
	for (int i = 0; i < N; i++) {
		cin >> B[i];
		if (A[i] >= B[i]) {
            cnt.push_back(A[i]-B[i]);
        }
		else { 
            res+=(B[i]-A[i]); 
            ans++; 
        }
	}
	sort(cnt.begin(), cnt.end()); 
    reverse(cnt.begin(), cnt.end());
	for (int i = 0; i < X.size(); i++) {
		if (res > 0) { 
            res -= X[i];
            ans++;
        }
	}
	if (res > 0) {
        ans = -1;
    }
	cout << ans << endl;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:27:29: error: 'X' was not declared in this scope
   27 |         for (int i = 0; i < X.size(); i++) {
      |                             ^
Language: C++

#include <bits/stdc++.h>
using namespace std;
#define int long long
signed main() {
    int N;
	cin >> N;
    vector<int>A(N);
    vector<int>B(N);
    int ans = 0;
    int res = 0;
    vector<int>cnt;
	for (int i = 0; i < N; i++) {
        cin >> A[i];
    }
	for (int i = 0; i < N; i++) {
		cin >> B[i];
		if (A[i] >= B[i]) {
            cnt.push_back(A[i]-B[i]);
        }
		else { 
            res+=(B[i]-A[i]); 
            ans++; 
        }
	}
	sort(X.begin(), X.end()); 
    reverse(X.begin(), X.end());
	for (int i = 0; i < X.size(); i++) {
		if (res > 0) { 
            res -= X[i];
            ans++;
        }
	}
	if (res > 0) {
        ans = -1;
    }
	cout << ans << endl;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:25:14: error: 'X' was not declared in this scope
   25 |         sort(X.begin(), X.end());
      |              ^
Language: C++

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

int main(){
  int n,ans=0; cin>>n;
  long long sumD=0,lack=0;
  long long a[n],b[n];
  for(int i=0;i<n;i++){
    cin>>a[i];
  }
  for(int i=0;i<n;i++){
    cin>>b[i];
    diff[i]=b[i]-a[i];
    sumD+=diff[i];
  }
  sort(diff,diff+n);
  if(sumD<=0){
    for(int i=0;i<n;i++){
      if(diff[i]>0){
        ans++;
        lack+=diff[i];
      }
    }
    for(int i=0;i<n;i++){
      if(lack<=0){
        break;
      }
      ans++;
      lack+=diff[i];
    }
  }
  if(sumD>0){
    cout<<-1;
  }else{
    cout<<ans;
  }
}


Compiler output:
a.cc: In function 'int main()':
a.cc:14:5: error: 'diff' was not declared in this scope
   14 |     diff[i]=b[i]-a[i];
      |     ^~~~
a.cc:17:8: error: 'diff' was not declared in this scope
   17 |   sort(diff,diff+n);
      |        ^~~~
Language: C++

N = int(input())
A = list(map(int, input().split()))
B = list(map(int, input().split()))
K = 0
S = 0
T = []
if sum(A) < sum(B):
    print('-1')
else:
    for i in range(N):
        if A[i] < B[i]:
            K += 1
            S = S + B[i] - A[i]
        elif A[i] > B[i]:
            T.append(A[i] - B[i])
        else:
            continue
    while S > 0:
        S -= max(T)
        T.remove(max(T))
        K += 1
    print(K)

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

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

int main() {
    int N; cin >> N;
    vector<long long> A(N), B(N);
    for (int i = 0; i < N; ++i) cin >> A[i];
    for (int i = 0; i < N; ++i) cin >> B[i];
        
    vector<long long> plus;//埋め立ててあげる余地
    long long sum = 0;//AとBの差の和
    int num = 0;//数を変更する数
    for (int i = 0; i < N; ++i) {
        long long dif = A[i] - B[i];
        if (dif < 0/*合格点に達していないなら*/) sum -= dif, ++num;
        else plus.push_back(dif);
    }
        
    if (num == 0) cout << 0 << endl; // マイナスがなかったら変更の必要なし
    else {
        sort(plus.begin(), plus.end(), greater<long long>());//より大きいのが埋め立ててくれると助かるから
        
        // 正の部分のうち、大きい方から優先的に削ってマイナスを埋め立てる
        long long p = 0;//埋め立ててあげる余地の和
        for (int i = 0; i < plus.size(); ++i) {
            p += plus[i];
            ++res;
            if (p >= sum) break;
        }
            
        if (p >= sum) cout << num << endl;
        else cout << -1 << endl;
    }
}

Compiler output:
a.cc: In function 'int main()':
a.cc:29:15: error: 'res' was not declared in this scope
   29 |             ++res;
      |               ^~~
Language: C++

#define _GLIBCXX_DEBUG
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <utility>
#include <tuple>
#include <cstdint>
#include <cstdio>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <deque>
#include <unordered_map>
#include <unordered_set>
#include <bitset>
#include <cctype>
#include <cmath>

using namespace std;
int main(){
  vector<long long int> p,q,r;
  long long int n,s=0,k=0,c=0;
  cin>>n;
  for(int i=0;i<n;i++){
    int x;
    cin>>x;
    p.push_back(x);
  }
  for(int i=0;i<n;i++){
    int x;
    cin>>x;
    q.push_back(x);
  }
  for(int i=0;i<n;i++){
    int x;
    x=p.at(i)-q.at(i);
    s+=x;
    r.push_back(x);
  }
   sort(r.begin(),r.end())
  if(s<0){
    cout<<-1;
  }
 
  else{
    for(int p:r){
    if(p<0){
      k+=p;
      c++;
    }
  }
    for(int p:r){
    if(k<0){
      k+=p;
      c++;
    }
  }}
    if(s>=0){cout<<c;}
}


Compiler output:
a.cc: In function 'int main()':
a.cc:42:27: error: expected ';' before 'if'
   42 |    sort(r.begin(),r.end())
      |                           ^
      |                           ;
   43 |   if(s<0){
      |   ~~                       
a.cc:47:3: error: 'else' without a previous 'if'
   47 |   else{
      |   ^~~~
Language: C++

#define _GLIBCXX_DEBUG
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <utility>
#include <tuple>
#include <cstdint>
#include <cstdio>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <deque>
#include <unordered_map>
#include <unordered_set>
#include <bitset>
#include <cctype>
#include <cmath>

using namespace std;
int main(){
  vector<long long int> p,q,r;
  long long int n,s=0,k=0,c=0;
  cin>>n;
  for(int i=0;i<n;i++){
    int x;
    cin>>x;
    p.push_back(x);
  }
  for(int i=0;i<n;i++){
    int x;
    cin>>x;
    q.push_back(x);
  }
  for(int i=0;i<n;i++){
    int x;
    x=p.at(i)-q.at(i);
    s+=x;
    r.push_back(x);
  }
  if(s<0){
    cout<<-1;
  }
  sort(r.begin(),r.end());
  else{
    for(int p:r){
    if(p<0){
      k+=p;
      c++;
    }
  }
    for(int p:r){
    if(k<0){
      k+=p;
      c++;
    }
  }}
    if(s>=0){cout<<c;}
}


Compiler output:
a.cc: In function 'int main()':
a.cc:46:3: error: 'else' without a previous 'if'
   46 |   else{
      |   ^~~~
Language: C++

#define _GLIBCXX_DEBUG
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <utility>
#include <tuple>
#include <cstdint>
#include <cstdio>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <deque>
#include <unordered_map>
#include <unordered_set>
#include <bitset>
#include <cctype>
#include <cmath>

using namespace std;
int main(){
  vector<long long int> p,q,r;
  long long int n,s=0,k=0,c=0;
  cin>>n;
  for(int i=0;i<n;i++){
    int x;
    cin>>x;
    p.push_back(x);
  }
  for(int i=0;i<n;i++){
    int x;
    cin>>x;
    q.push_back(x);
  }
  for(int i=0;i<n;i++){
    int x;
    x=p.at(i)-q.at(i);
    s+=x;
    r.push_back(x);
  }
  if(s<0){
    cout<<-1;
  }
  sort(r.begin(),r.end())
  else{
    for(int p:r){
    if(p<0){
      k+=p;
      c++;
    }
  }
    for(int p:r){
    if(k<0){
      k+=p;
      c++;
    }
  }}
    if(s>=0){cout<<c;}
}


Compiler output:
a.cc: In function 'int main()':
a.cc:45:26: error: expected ';' before 'else'
   45 |   sort(r.begin(),r.end())
      |                          ^
      |                          ;
   46 |   else{
      |   ~~~~
Language: C++

#include<cstdio>
#include<iostream>
#include<string>
#include<set>
#include<map>
#include<vector>
#include<queue>
#include<stack>
#include<deque>
#include<tuple>
#include<algorithm>
#include<numeric>
#include<limits>
#include<boost/multiprecision/cpp_int.hpp>
using namespace boost::multiprecision;
using namespace std;
#define BEGIN ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
#define END return EXIT_SUCCESS
#define up(I,A,B) for(auto I=(A);I<=(B);++I)
#define dw(I,A,B) for(auto I=(A);I>=(B);--I)
#define rep(I,N) up(I,0,N-1)
#define all(C) (C).begin(),(C).end()
#define rall(C) (C).rbegin(),(C).rend()
#define ft first
#define sd second
#define mp make_pair
#define mt make_tuple
#define pf push_front
#define pb push_back
#define lb lower_bound
#define ub upper_bound
#define rs resize
typedef long long ll;
typedef long double ld;
typedef unsigned long long ull;
template<class T>inline bool chmax(T& a,T b){if(a<b){a=b;return 1;}return 0;}
template<class T>inline bool chmin(T& a,T b){if(a>b){a=b;return 1;}return 0;}
template<class T>inline void                                      in(T &p){cin>>p;}
template<class T1,class T2>inline void                            in(T1 &p1,T2 &p2){cin>>p1>>p2;}
template<class T1,class T2,class T3>inline void                   in(T1 &p1,T2 &p2,T3 &p3){cin>>p1>>p2>>p3;}
template<class T1,class T2,class T3,class T4>inline void          in(T1 &p1,T2 &p2,T3 &p3,T4 &p4){cin>>p1>>p2>>p3>>p4;}
template<class T1,class T2,class T3,class T4,class T5>inline void in(T1 &p1,T2 &p2,T3 &p3,T4 &p4,T5 &p5){cin>>p1>>p2>>p3>>p4>>p5;}
template<class T>inline void                                      ins(T &p){for_each(all(p),in<decltype(p[0])>);}
template<class T>inline void                             out(T p){cout<<p<<endl;}
template<class T1,class T2>inline void                   out(T1 p1,T2 p2){cout<<p1<<" "<<p2<<endl;}
template<class T1,class T2,class T3>inline void          out(T1 p1,T2 p2,T3 p3){cout<<p1<<" "<<p2<<" "<<p3<<endl;}
template<class T1,class T2,class T3,class T4>inline void out(T1 p1,T2 p2,T3 p3,T4 p4){cout<<p1<<" "<<p2<<" "<<p3<<" "<<p4<<endl;}
inline                                              void out(ld p){printf("%.12Lf\n",p);}
template<class T>inline                             void outml(T p){for_each(all(p),out<decltype(p[0])>);}
template<class T>inline void outol(T V){int n=V.size();rep(i,n)cout<<V[i]<<" \n"[i==n-1];}
inline void solve(void){
  int N;
  in(N);
  vector<int>A(N),B(N);
  ins(A);ins(B);
  if(accumulate(all(A),0)<accumulates(all(B),0)){
    out(-1);
    return;
  }
  priority_queue<int>q;
  long lack=0;
  long cnt=0;
  rep(i,N){
    if(A[i]>B[i])q.push(A[i]-B[i]);
    if(A[i]<B[i])lack+=B[i]-A[i],cnt;
  }
  while(!q.empty()){
    int e=q.top();q.pop();
    if(lack<=0){
      out(cnt);
      return;
    }
    lack-=e;
    cnt++;
  }
}
int main(int argc,char**argv){
  BEGIN;
  solve();
  END;
}


Compiler output:
a.cc:14:9: fatal error: boost/multiprecision/cpp_int.hpp: No such file or directory
   14 | #include<boost/multiprecision/cpp_int.hpp>
      |         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
compilation terminated.
Language: C++

#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <cmath>

using namespace std;
long main() {
	long n;
	vector<long> a;
	vector<long> l;
	long asum = 0, bsum = 0;;
	cin >> n;
	for (long i = 0; i < n; i++) {
		long t;
		cin >> t;
		a.push_back(t);
		asum += t;
	}
	bool flag = false;
	long po = 0, ng = 0;
	long nnum = 0;
	for (long i = 0; i < n; i++) {
		long t;
		cin >> t;
		//b.push_back(t);
		bsum += t;
		if (t > a[i]) {
			flag = true;
		}
		long dif = a[i] - t;
		l.push_back(dif);
		if (dif < 0) {
			ng += dif;
			nnum++;
		}
		else {
			po += dif;
		}
	}
	if (!flag) {
		cout << "0" << endl;
		return 0;
	}
	if (asum < bsum) {
		cout << "-1" << endl;
		return 0;
	}

	sort(l.begin(), l.end(), greater<long>());
	long cnt = 0;
	for (auto e : l) {
		cnt++;
		ng += e;
		if (ng >= 0) {
			break;
		}
	}
	cout << cnt + nnum << endl;

	return 0;
}

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

#include<bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(int)(n);i++)
using namespace std;
int main(){
  int N,sumA=0,sumB=0;
  vector<int> numA(N),numB(N);
  rep(i,N){ cin >> numA[i]; sumA += numA[i]; }
  rep(i,N){ cin >> numB[i]; sumB += sumB[i]; }

  if(sumA<sumB){
    cout << -1 << endl;
    return 0;
  }
  vector<int> numC(N);
  rep(i,N) numC[i]=numA[i]-num[B];
  
  sort(numC.begin(),numC.end());
  
  int dist=0;
  vector<int> ans(N);
  int count=N;
  rep(i,N){
    if(numC[i]==0){
      count--;
    }
  }
}

Compiler output:
a.cc: In function 'int main()':
a.cc:8:41: error: invalid types 'int[int]' for array subscript
    8 |   rep(i,N){ cin >> numB[i]; sumB += sumB[i]; }
      |                                         ^
a.cc:15:28: error: 'num' was not declared in this scope; did you mean 'numC'?
   15 |   rep(i,N) numC[i]=numA[i]-num[B];
      |                            ^~~
      |                            numC
a.cc:15:32: error: 'B' was not declared in this scope
   15 |   rep(i,N) numC[i]=numA[i]-num[B];
      |                                ^
Language: C++

#include <bits/stdc++.h>
using namespace std;
const int MAXN=200010;
typedef long long ll;
ll a[200010]; 
ll b[200010]; 
ll ans;  
vector<int> v;
int sum;
int main()
    int n;
    cin>>n;
    sum=n;
    for(int i=0;i<n;i++) cin>>a[i];
    for(int i=0;i<n;i++) cin>>b[i];
    bool flag=true;
    for(int i=0;i<n;i++)
    {
        ans+=a[i]-b[i];
        if(a[i]>=b[i]) v.push_back(a[i]-b[i]);
        else flag=false;
    }
    if(flag)
    {
        puts("0");
        return 0;
    }
    sort(v.begin(),v.end());
    if(ans>=0)
    {
        for(int i=0;i<v.size();i++)
        {
            if(ans>=v[i])
            {
                ans-=v[i];
                sum--;
            }
            else break;
        }
        cout<<sum<<endl;
        return 0;
    }
    puts("-1");
    return 0;
}

Compiler output:
a.cc:11:5: error: expected initializer before 'int'
   11 |     int n;
      |     ^~~
a.cc:12:5: error: 'cin' does not name a type
   12 |     cin>>n;
      |     ^~~
a.cc:13:5: error: 'sum' does not name a type
   13 |     sum=n;
      |     ^~~
a.cc:14:5: error: expected unqualified-id before 'for'
   14 |     for(int i=0;i<n;i++) cin>>a[i];
      |     ^~~
a.cc:14:17: error: 'i' does not name a type
   14 |     for(int i=0;i<n;i++) cin>>a[i];
      |                 ^
a.cc:14:21: error: 'i' does not name a type
   14 |     for(int i=0;i<n;i++) cin>>a[i];
      |                     ^
a.cc:15:5: error: expected unqualified-id before 'for'
   15 |     for(int i=0;i<n;i++) cin>>b[i];
      |     ^~~
a.cc:15:17: error: 'i' does not name a type
   15 |     for(int i=0;i<n;i++) cin>>b[i];
      |                 ^
a.cc:15:21: error: 'i' does not name a type
   15 |     for(int i=0;i<n;i++) cin>>b[i];
      |                     ^
a.cc:17:5: error: expected unqualified-id before 'for'
   17 |     for(int i=0;i<n;i++)
      |     ^~~
a.cc:17:17: error: 'i' does not name a type
   17 |     for(int i=0;i<n;i++)
      |                 ^
a.cc:17:21: error: 'i' does not name a type
   17 |     for(int i=0;i<n;i++)
      |                     ^
a.cc:23:5: error: expected unqualified-id before 'if'
   23 |     if(flag)
      |     ^~
a.cc:28:9: error: expected constructor, destructor, or type conversion before '(' token
   28 |     sort(v.begin(),v.end());
      |         ^
a.cc:29:5: error: expected unqualified-id before 'if'
   29 |     if(ans>=0)
      |     ^~
a.cc:43:9: error: expected constructor, destructor, or type conversion before '(' token
   43 |     puts("-1");
      |         ^
a.cc:44:5: error: expected unqualified-id before 'return'
   44 |     return 0;
      |     ^~~~~~
a.cc:45:1: error: expected declaration before '}' token
   45 | }
      | ^
Language: C++

#include<iostream>
#include<algorithm>
#include<stdio.h>
#include<cstdio>
#include<vector>
using namespace std;
int a[233333]; 
int b[233333]; 
long long ans;  
vector<int> v;
int sum;
int main()
    int n;
    cin>>n;
    sum=n;
    for(int i=0;i<n;i++) cin>>a[i];
    for(int i=0;i<n;i++) cin>>b[i];
    bool flag=true;
    for(int i=0;i<n;i++)
    {
        ans+=a[i]-b[i];
        if(a[i]>=b[i]) v.push_back(a[i]-b[i]);
        else flag=false;
    }
    if(flag)
    {
        puts("0");
        return 0;
    }
    sort(v.begin(),v.end());
    if(ans>=0)
    {
        for(int i=0;i<v.size();i++)
        {
            if(ans>=v[i])
            {
                ans-=v[i];
                sum--;
            }
            else break;
        }
        cout<<sum<<endl;;
        return 0;
    }
    puts("-1");
    return 0;
}

Compiler output:
a.cc:13:5: error: expected initializer before 'int'
   13 |     int n;
      |     ^~~
a.cc:14:5: error: 'cin' does not name a type
   14 |     cin>>n;
      |     ^~~
a.cc:15:5: error: 'sum' does not name a type
   15 |     sum=n;
      |     ^~~
a.cc:16:5: error: expected unqualified-id before 'for'
   16 |     for(int i=0;i<n;i++) cin>>a[i];
      |     ^~~
a.cc:16:17: error: 'i' does not name a type
   16 |     for(int i=0;i<n;i++) cin>>a[i];
      |                 ^
a.cc:16:21: error: 'i' does not name a type
   16 |     for(int i=0;i<n;i++) cin>>a[i];
      |                     ^
a.cc:17:5: error: expected unqualified-id before 'for'
   17 |     for(int i=0;i<n;i++) cin>>b[i];
      |     ^~~
a.cc:17:17: error: 'i' does not name a type
   17 |     for(int i=0;i<n;i++) cin>>b[i];
      |                 ^
a.cc:17:21: error: 'i' does not name a type
   17 |     for(int i=0;i<n;i++) cin>>b[i];
      |                     ^
a.cc:19:5: error: expected unqualified-id before 'for'
   19 |     for(int i=0;i<n;i++)
      |     ^~~
a.cc:19:17: error: 'i' does not name a type
   19 |     for(int i=0;i<n;i++)
      |                 ^
a.cc:19:21: error: 'i' does not name a type
   19 |     for(int i=0;i<n;i++)
      |                     ^
a.cc:25:5: error: expected unqualified-id before 'if'
   25 |     if(flag)
      |     ^~
a.cc:30:9: error: expected constructor, destructor, or type conversion before '(' token
   30 |     sort(v.begin(),v.end());
      |         ^
a.cc:31:5: error: expected unqualified-id before 'if'
   31 |     if(ans>=0)
      |     ^~
a.cc:45:9: error: expected constructor, destructor, or type conversion before '(' token
   45 |     puts("-1");
      |         ^
a.cc:46:5: error: expected unqualified-id before 'return'
   46 |     return 0;
      |     ^~~~~~
a.cc:47:1: error: expected declaration before '}' token
   47 | }
      | ^
Language: C++

#include <bits/stdc++.h>
using namespace std;
int  main()
{
  	long n;cin>>n;
  	vector<long> diff(n);
  	vector<long> a(n),b(n);
  	long sum=0;
  	for(int i=0;i<n;i++)cin>>a[i];
  	for(int i=0;i<n;i++)cin>>b[i];
  	for(int i=0;i<n;i++)
	{
  	  	diff[i]=a[i]-b[i];
    	sum+=diff[i];
  	}
  	if(sum<0)
	{
    	cout<<-1<<endl;
    	return 0;
  	}
  	sort(all(diff));
  	reverse(all(diff));
  	long j=n-1;
  	long ans=0;
  	for(int i=0;i<n;i++)
	{
    	if(diff[j]>=0)break;
    	if(i>=j)
		{
    		ans=-1;
      		break;
    	}
    	ans++;
		while(diff[i]>0&&diff[j]<0)
		{
    	  	if(diff[i]+diff[j]>=0)
			{
        		ans++;
      			diff[i]+=diff[j--];
      		}
			else
			{
        		diff[j]+=diff[i];
        		diff[i]=0;
        		continue;
      		}
    	}
  	}	
  	cout<<ans<<endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:21:14: error: 'all' was not declared in this scope; did you mean 'std::filesystem::perms::all'?
   21 |         sort(all(diff));
      |              ^~~
      |              std::filesystem::perms::all
In file included from /usr/include/c++/14/filesystem:51,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:200,
                 from a.cc:1:
/usr/include/c++/14/bits/fs_fwd.h:158:7: note: 'std::filesystem::perms::all' declared here
  158 |       all               =  0777,
      |       ^~~