submission_id
stringlengths
10
10
problem_id
stringlengths
6
6
language
stringclasses
3 values
code
stringlengths
1
522k
compiler_output
stringlengths
43
10.2k
s642959517
p00028
C++
#inlcude <stdio.h> int main(){ int d[100]; int maximize[100]; int buf; while( scanf( "%d",&buf ) != EOF ) d[buf-1]++; int buff = 0; for( int i = 0;i < 100;i++ ){ if( d[i] > buff ) buff = d[i]; } for( int i = 0;i < 100;i++ ){ if( d[i] >= buff ) printf( "%d\n",i+1 ); } return 0; }
a.cc:1:2: error: invalid preprocessing directive #inlcude; did you mean #include? 1 | #inlcude <stdio.h> | ^~~~~~~ | include a.cc: In function 'int main()': a.cc:8:12: error: 'scanf' was not declared in this scope 8 | while( scanf( "%d",&buf ) != EOF ) d[buf-1]++; | ^~~~~ a.cc:8:34: error: 'EOF' was not declared in this scope 8 | while( scanf( "%d",&buf ) != EOF ) d[buf-1]++; | ^~~ a.cc:1:1: note: 'EOF' is defined in header '<cstdio>'; this is probably fixable by adding '#include <cstdio>' +++ |+#include <cstdio> 1 | #inlcude <stdio.h> a.cc:16:28: error: 'printf' was not declared in this scope 16 | if( d[i] >= buff ) printf( "%d\n",i+1 ); | ^~~~~~ a.cc:16:28: note: 'printf' is defined in header '<cstdio>'; this is probably fixable by adding '#include <cstdio>'
s525084385
p00028
C++
#inlcude <stdio.h> #include <stdlib.h> int main(){ int d[100]; int maximize[100]; int buf; while( scanf( "%d",&buf ) != EOF ) d[buf-1]++; int buff = 0; for( int i = 0;i < 100;i++ ){ if( d[i] > buff ) buff = d[i]; } for( int i = 0;i < 100;i++ ){ if( d[i] >= buff ) printf( "%d\n",i+1 ); } return 0; }
a.cc:1:2: error: invalid preprocessing directive #inlcude; did you mean #include? 1 | #inlcude <stdio.h> | ^~~~~~~ | include a.cc: In function 'int main()': a.cc:9:12: error: 'scanf' was not declared in this scope 9 | while( scanf( "%d",&buf ) != EOF ) d[buf-1]++; | ^~~~~ a.cc:9:34: error: 'EOF' was not declared in this scope 9 | while( scanf( "%d",&buf ) != EOF ) d[buf-1]++; | ^~~ a.cc:3:1: note: 'EOF' is defined in header '<cstdio>'; this is probably fixable by adding '#include <cstdio>' 2 | #include <stdlib.h> +++ |+#include <cstdio> 3 | a.cc:17:28: error: 'printf' was not declared in this scope 17 | if( d[i] >= buff ) printf( "%d\n",i+1 ); | ^~~~~~ a.cc:17:28: note: 'printf' is defined in header '<cstdio>'; this is probably fixable by adding '#include <cstdio>'
s599930418
p00028
C++
#inlcude <stdio.h> #include <stdlib.h> int main(){ int d[100]; int maximize[100]; int buf; while( scanf( "%d",&buf ) != EOF ) d[buf-1]++; int buff = 0; for( int i = 0;i < 100;i++ ){ if( d[i] > buff ) buff = d[i]; } for( int i = 0;i < 100;i++ ){ if( d[i] >= buff ) printf( "%d\n",i+1 ); } return 0; }
a.cc:1:2: error: invalid preprocessing directive #inlcude; did you mean #include? 1 | #inlcude <stdio.h> | ^~~~~~~ | include a.cc: In function 'int main()': a.cc:9:12: error: 'scanf' was not declared in this scope 9 | while( scanf( "%d",&buf ) != EOF ) d[buf-1]++; | ^~~~~ a.cc:9:34: error: 'EOF' was not declared in this scope 9 | while( scanf( "%d",&buf ) != EOF ) d[buf-1]++; | ^~~ a.cc:3:1: note: 'EOF' is defined in header '<cstdio>'; this is probably fixable by adding '#include <cstdio>' 2 | #include <stdlib.h> +++ |+#include <cstdio> 3 | a.cc:17:28: error: 'printf' was not declared in this scope 17 | if( d[i] >= buff ) printf( "%d\n",i+1 ); | ^~~~~~ a.cc:17:28: note: 'printf' is defined in header '<cstdio>'; this is probably fixable by adding '#include <cstdio>'
s928772057
p00029
Java
import java.util.Scanner; public class J0029 { public static void main(String[] args) { int i=0; String[] s = new String[1000]; int[] count = new int[1000]; Scanner sc = new Scanner(System.in); while( sc.hasNext() ){ boolean flag=true; String tmp = sc.next(); if(i==0){ s[i]=tmp; count[i]=1; i++; continue; } for(int j=0; j<i; j++) { if(s[j].equals(tmp)){ count[j]++; flag=false; break; } } if(flag){ s[i]=tmp; count[i]=1; i++; } } int max = count[0]; int length = s[0].length(); String str = s[0]; String str2 = s[0]; for(int j=0; j<i; j++) { //System.out.println("count[" + j + "] = "+count[j]); //System.out.println("s[" + j + "] = "+s[j]); if(max<count[j]) { max = count[j]; str = s[j]; } if(s[j].length()>length){ length = s[j].length(); str2 = s[j]; } } System.out.print(str + " " + str2); } }
Main.java:3: error: class J0029 is public, should be declared in a file named J0029.java public class J0029 { ^ 1 error
s757226515
p00029
Java
import java.io.*; import java.util.*; class Main{ public static void main(String[] args) throws IOException{ BufferedReader br=new BufferedReader(new InputStreamReader(System.in)); String[] words=br.readLine().split(" "); Hashmap<String,Integer> map=new Hashmap<String,Integer>(); int occured=0; String occuredword=""; int maxlength=0; String maxword=""; for(String word:words){ if(!map.containskey(word)){ map.put(word,1); } else{ map.put(word,map.get(word)+1) } if(map.get(word)>occured){ ocuured=map.get(word); occueredword=word; } if(word.length()>maxlength){ maxlength=word.length(); maxword=word; } } }
Main.java:18: error: ';' expected map.put(word,map.get(word)+1) ^ Main.java:29: error: reached end of file while parsing } ^ 2 errors
s565249356
p00029
Java
import java.io.*; import java.util.*; class Main{ public static void main(String[] args) throws IOException{ BufferedReader br=new BufferedReader(new InputStreamReader(System.in)); String[] words=br.readLine().split(" "); Hashmap<String,Integer> map=new Hashmap<String,Integer>(); int occured=0; String occuredword=""; int maxlength=0; String maxword=""; for(String word:words){ if(!map.containskey(word)){ map.put(word,1); } else{ map.put(word,map.get(word)+1); } if(map.get(word)>occured){ ocuured=map.get(word); occueredword=word; } if(word.length()>maxlength){ maxlength=word.length(); maxword=word; } } } }
Main.java:8: error: cannot find symbol Hashmap<String,Integer> map=new Hashmap<String,Integer>(); ^ symbol: class Hashmap location: class Main Main.java:8: error: cannot find symbol Hashmap<String,Integer> map=new Hashmap<String,Integer>(); ^ symbol: class Hashmap location: class Main Main.java:21: error: cannot find symbol ocuured=map.get(word); ^ symbol: variable ocuured location: class Main Main.java:22: error: cannot find symbol occueredword=word; ^ symbol: variable occueredword location: class Main 4 errors
s103203969
p00029
Java
import java.io.*; import java.util.*; class Main{ public static void main(String[] args) throws IOException{ BufferedReader br=new BufferedReader(new InputStreamReader(System.in)); String[] words=br.readLine().split(" "); HashMap<String,Integer> map=new HashMap<String,Integer>(); int occured=0; String occuredword=""; int maxlength=0; String maxword=""; for(String word:words){ if(!map.containskey(word)){ map.put(word,1); } else{ map.put(word,map.get(word)+1); } if(map.get(word)>occured){ ocuured=map.get(word); occueredword=word; } if(word.length()>maxlength){ maxlength=word.length(); maxword=word; } } } }
Main.java:14: error: cannot find symbol if(!map.containskey(word)){ ^ symbol: method containskey(String) location: variable map of type HashMap<String,Integer> Main.java:21: error: cannot find symbol ocuured=map.get(word); ^ symbol: variable ocuured location: class Main Main.java:22: error: cannot find symbol occueredword=word; ^ symbol: variable occueredword location: class Main 3 errors
s062553566
p00029
Java
import java.io.*; import java.util.*; class Main{ public static void main(String[] args) throws IOException{ BufferedReader br=new BufferedReader(new InputStreamReader(System.in)); String[] words=br.readLine().split(" "); HashMap<String,Integer> map=new HashMap<String,Integer>(); int maxoccured=0; String maxoccuredword=""; int maxlength=0; String maxlengthword=""; for(String word:words){ if(!map.containsKey(word)){ map.put(word,1); } else{ map.put(word,map.get(word)+1); } if(map.get(word)>maxoccured){ maxoccured=map.get(word); maxoccuredword=word; } if(word.length()>maxlength){ maxlength=word.length(); maxlengthword=word; } } System.out.println(maxoccuredword+" "+maxlengthword } }
Main.java:29: error: ')' or ',' expected System.out.println(maxoccuredword+" "+maxlengthword ^ 1 error
s128351980
p00029
Java
import java.util.HashMap; import java.util.Map; import java.util.Scanner; class Main { public static void main(String[] args) { Scanner sc = null; try { sc = new Scanner(System.in); while (sc.hasNext()) { String sentence = sc.next(); //???????????????????????? } // ???????????????1????????????????????¢??? } finally { sc.close(); } } // ??????????????????????????? public String maxFrequency(String[] s){ Map<String, Integer> frequency = new HashMap<String, Integer>(); int count = 1; for(String word:s){ if (frequency.containsKey(word)) { count += frequency.get(word); } frequency.put(word, count); } return null; } public String }
Main.java:49: error: <identifier> expected public String ^ 1 error
s459570518
p00029
Java
import java.util.ArrayList; import java.util.Arrays; import java.util.Collections; import java.util.Comparator; import java.util.HashMap; import java.util.HashSet; import java.util.List; import java.util.Map; import java.util.Scanner; class Main { public static void main(String[] args) { Scanner sc = null; try { sc = new Scanner(System.in); // ??\??? while (sc.hasNextLine()) { String[] sentence = sc.nextLine().split(" "); // ???????????????1????????????????????¢??? Main main = new Main(); // String frequencyWord = main.maxFrequency(sentence); // ????????????????????????????????¢??? // String longWord = main.maxLong(sentence); // ???????????? System.out.println(main.maxFrequency(sentence) + " " + main.maxLong(sentence)); } } finally { sc.close(); } } // value?????????????????§??????key????????? public String maxFrequency(String[] s) { Map<String, Integer> frequency = new HashMap<String, Integer>(); for (String word : s) { int count = 1; if (frequency.containsKey(word)) { count += frequency.get(word); } frequency.put(word, count); } return valueSort(frequency).get(0).getKey(); } // public String maxLong(String[] str) { // ??????????????????????????????List?????\?????? List<String> list = new ArrayList<String>(new HashSet<String>( Arrays.asList(str))); String max = new String(); for (String s : list) { if (max.length() < s.length()) { max = s; } } return max; } // Map???value??§????????????????????? private List<Map.Entry<String, Integer>> valueSort(Map<String, Integer> map) { List<Map.Entry<String, Integer>> list = new ArrayList<Map.Entry<String, Integer>>( map.entrySet()); Collections.sort(list, new Comparator<Map.Entry<String, Integer>>() { public int compare(Map.Entry<String, Integer> map1, Map.Entry<String, Integer> map2) { return map2.getValue().compareTo(map1.getValue()); } }); return list; }
Main.java:80: error: reached end of file while parsing } ^ 1 error
s154223297
p00029
Java
import java.util.ArrayList; import java.util.Arrays; import java.util.Collections; import java.util.Comparator; import java.util.HashMap; import java.util.HashSet; import java.util.List; import java.util.Map; import java.util.Scanner; class Main { public static void main(String[] args) { Scanner sc = null; try { sc = new Scanner(System.in); // ??\??? while (sc.hasNextLine()) { String[] sentence = sc.nextLine().split(" "); // ???????????????1????????????????????¢??? Main main = new Main(); String frequencyWord = main.maxFrequency(sentence); // ????????????????????????????????¢??? String longWord = main.maxLong(sentence); // ???????????? System.out.println(frequencyWord + " " + longWord); } } finally { sc.close(); } } // value?????????????????§??????key????????? public String maxFrequency(String[] s) { Map<String, Integer> frequency = new HashMap<String, Integer>(); for (String word : s) { int count = 1; if (frequency.containsKey(word)) { count += frequency.get(word); } frequency.put(word, count); } return valueSort(frequency).get(0).getKey(); } // public String maxLong(String[] str) { // ??????????????????????????????List?????\?????? List<String> list = new ArrayList<String>(new HashSet<String>( Arrays.asList(str))); String max = new String(); for (String s : list) { if (max.length() < s.length()) { max = s; } } return max; } // Map???value??§????????????????????? private List<Map.Entry<String, Integer>> valueSort(Map<String, Integer> map) { List<Map.Entry<String, Integer>> list = new ArrayList<Map.Entry<String, Integer>>( map.entrySet()); Collections.sort(list, new Comparator<Map.Entry<String, Integer>>() { public int compare(Map.Entry<String, Integer> map1, Map.Entry<String, Integer> map2) { return map2.getValue().compareTo(map1.getValue()); } }); return list; }
Main.java:80: error: reached end of file while parsing } ^ 1 error
s161498512
p00029
Java
import java.util.*; public class Main{ private static final Scanner scan = new Scanner(System.in); public static void main(String[] args){ String line = scan.nextLine(); String[] words = line.split(" "); int len = words.length; int[] counts = new int[len]; int longest = 0; int max = 0; String sMax = ""; String sLong = ""; for(int i = 0; i < len; i++){ if(words[i].length() > logest){ logest = words[i].length(); sLong = words[i]; } for(int j = i + 1; j < words.length; j++){ if(words[i].equals(words[j])){ counts[i]++; if(max < counts[i]){ max = counts[i]; sMax = words[i]; } } } } System.out.printf("%s %s\n", sMax, sLong); } }
Main.java:17: error: cannot find symbol if(words[i].length() > logest){ ^ symbol: variable logest location: class Main Main.java:18: error: cannot find symbol logest = words[i].length(); ^ symbol: variable logest location: class Main 2 errors
s279500402
p00029
Java
import sun.java2d.xr.MutableInteger; import java.util.HashMap; import java.util.Map; import java.util.Scanner; public class Main { public static void main(String[] args) { final Map<String, MutableInteger> map = new HashMap<>(); try (Scanner scanner = new Scanner(System.in)) { while (scanner.hasNext()) { String str = scanner.next(); if (!map.containsKey(str)) { map.put(str, new MutableInteger(0)); } MutableInteger integer = map.get(str); integer.setValue(integer.getValue() + 1); } String mostWord = map.entrySet().stream().max((o1, o2) -> new Integer(o1.getValue().getValue()).compareTo(o2.getValue().getValue())).get().getKey(); String minWord = map.entrySet().stream().min((o1, o2) -> new Integer(o1.getValue().getValue()).compareTo(o2.getValue().getValue())).get().getKey(); System.out.printf("%s %s", mostWord, minWord); } catch (Exception e) { } } }
Main.java:1: error: package sun.java2d.xr is not visible import sun.java2d.xr.MutableInteger; ^ (package sun.java2d.xr is declared in module java.desktop, which does not export it) 1 error
s812788602
p00029
Java
import java.util.Scanner; class Main { public static void main (String[] args) throws java.lang.Exception { Scanner sc = new Scanner(System.in); Map<String,Integer> h = new HashMap<String,Integer>(); String a[] = new String[1000]; int I = 0; int maxlength = 0; String maxleng = ""; while(sc.hasNext()){ String str = sc.next(); if(h.containsKey(str)){ int c = h.get(str).intValue(); h.put(str,Integer.valueOf(c+1)); } else{ h.put(str,Integer.valueOf(1)); a[I++] = str; } } int maxval = 0; String maxVal = ""; for(int i=0;i<I;i++){ if(h.get(a[i]).intValue() > maxval){ maxval = h.get(a[i]).intValue(); maxVal = a[i]; } if(maxlength < a[i].length()){ maxlength = a[i].length(); maxleng = a[i]; } } System.out.println(maxVal+" "+maxleng); } }
Main.java:8: error: cannot find symbol Map<String,Integer> h = new HashMap<String,Integer>(); ^ symbol: class Map location: class Main Main.java:8: error: cannot find symbol Map<String,Integer> h = new HashMap<String,Integer>(); ^ symbol: class HashMap location: class Main 2 errors
s155672290
p00029
Java
mport java.util.*; import java.util.Map.Entry; public class Main { static Scanner sc = new Scanner(System.in); static Map<String, Integer> map; public static void main(String[] args) { read(); solve(); } static void read() { map = new HashMap<String ,Integer>(); while(sc.hasNext()) { String str = sc.next(); if(map.containsKey(str)) { int val = map.get(str); map.put(str, val+1); } else { map.put(str, 1); } } } static void solve() { int max_len, max_appear; String max_len_str = "", max_appear_str = ""; max_len = max_appear = 0; for(Entry<String, Integer> e : map.entrySet()) { String key = e.getKey(); int value = e.getValue(); int key_len = key.length(); if(value > max_appear) { max_appear = value; max_appear_str = key; } if(key_len > max_len) { max_len = key_len; max_len_str = key; } } System.out.println(max_appear_str + " " + max_len_str); } }
Main.java:1: error: class, interface, enum, or record expected mport java.util.*; ^ Main.java:2: error: class, interface, enum, or record expected import java.util.Map.Entry; ^ 2 errors
s376041590
p00029
Java
import java.util.*; import java.util.Map.Entry; public class EnglishSentence{ static Scanner sc = new Scanner(System.in); static Map<String, Integer> map = new HashMap<String, Integer>(); // mainƒƒ\ƒbƒh---------------------------------------------------------------- public static void main(String[] args){ read(); solve(); } // readƒƒ\ƒbƒh----------------------------------------------------------------- static boolean read() { //‚±‚±‚Å“ü—Í‚ð“ǂݍž‚Þ while(sc.hasNext()){ String str = sc.next(); if(map.containsKey(str)){ int i = map.get(str); i++; map.put(str, i); } else{ map.put(str, 1); } } return true; } // solveƒƒ\ƒbƒh------------------------------------------------------ static void solve() { //‚±‚±‚Å–â‘è‚ð‰ð‚¢‚ďo—Í‚·‚é int max = 0, max2 = 0; String maxKey = "\0", maxKey2 = "\0"; //‘SƒGƒ“ƒgƒŠ‚ɃAƒNƒZƒX for(Entry<String, Integer> e : map.entrySet()){ //Å‘åoŒ»‰ñ”‚ð’T‚· if(max2 < e.getValue()){ max2 = e.getValue(); maxKey2 = e.getKey(); } //Å‘å•¶Žš”‚ð’T‚· if (max < e.getKey().length()){ max = e.getKey().length(); maxKey = e.getKey(); } } System.out.println(maxKey2 + " " + maxKey); } }
Main.java:4: error: class EnglishSentence is public, should be declared in a file named EnglishSentence.java public class EnglishSentence{ ^ 1 error
s472036185
p00029
Java
import java.util.*; import java.util.Map.Entry; public class EnglishSentence{ static Scanner sc = new Scanner(System.in); static Map<String, Integer> map = new HashMap<String, Integer>(); // mainƒƒ\ƒbƒh---------------------------------------------------------------- public static void main(String[] args){ read(); solve(); } // readƒƒ\ƒbƒh----------------------------------------------------------------- static boolean read() { //‚±‚±‚Å“ü—Í‚ð“ǂݍž‚Þ while(sc.hasNext()){ String str = sc.next(); if(map.containsKey(str)){ int i = map.get(str); i++; map.put(str, i); } else{ map.put(str, 1); } } return true; } // solveƒƒ\ƒbƒh------------------------------------------------------ static void solve() { //‚±‚±‚Å–â‘è‚ð‰ð‚¢‚ďo—Í‚·‚é int max = 0, max2 = 0; String maxKey = "\0", maxKey2 = "\0"; //‘SƒGƒ“ƒgƒŠ‚ɃAƒNƒZƒX for(Entry<String, Integer> e : map.entrySet()){ //Å‘åoŒ»‰ñ”‚ð’T‚· if(max2 < e.getValue()){ max2 = e.getValue(); maxKey2 = e.getKey(); } //Å‘å•¶Žš”‚ð’T‚· if (max < e.getKey().length()){ max = e.getKey().length(); maxKey = e.getKey(); } } System.out.println(maxKey2 + " " + maxKey); } }
Main.java:4: error: class EnglishSentence is public, should be declared in a file named EnglishSentence.java public class EnglishSentence{ ^ 1 error
s385703251
p00029
Java
import java.util.*; public class Main { static Scanner sc = new Scanner(System.in); public static void main(String[] args) { String[] words = sc.nextLine().split(" "); TreeMap<String, Integer> dic = new TreeMap<String, Integer>(); String mode = "", longest = ""; int max = 0, maxlen = 0; for(int i = 0; i < words.length; i++) { int cnt = 1; String key = words[i]; if(dic.containsKey(key)) { cnt = dic.get(words[i]); //dic.remove(words[i]); } dic.put(key, ++cnt); if(max < cnt) { max = cnt; mode = key; } if(maxlen < key.length()) { maxlen = key.length(); longest = key; } } System.out.println(mode + " " + longest); }
Main.java:31: error: reached end of file while parsing } ^ 1 error
s358065728
p00029
Java
import java.util.*; public class Main2 { HashMap<String, Integer> word; Scanner sc; void run() { sc = new Scanner(System.in); word = new HashMap<String, Integer>(); while (sc.hasNext()) { String[] words = sc.next().split(" "); for (String str : words) { if (!word.containsKey(str)) word.put(str, 1); else word.put(str, word.get(str)+1); } } String str = ""; String strl = ""; int count=0; for (Map.Entry<String, Integer> entry: word.entrySet()) { if (strl.length() < entry.getKey().length())strl = entry.getKey(); if (count < entry.getValue()) { count = entry.getValue(); str = entry.getKey(); } } System.out.println(str + " " + strl); } public static void main(String[] args) { new Main2().run(); } }
Main.java:2: error: class Main2 is public, should be declared in a file named Main2.java public class Main2 { ^ 1 error
s288396150
p00029
Java
#include <stdio.h> int main(int argc,char* argv[]){ int mode[100]; int num; int i; int max = 0; for(i = 0;i < 100;i++){ mode[i] = 0; } while(scanf("%d",&num) != EOF){ mode[num-1]++; } for(i = 0;i < 100;i++){ if(mode[i] > max){ max = mode[i]; } } for(i = 0;i < 100;i++){ if(mode[i] == max){ printf("%d\n",i+1); } } return 0; }
Main.java:1: error: illegal character: '#' #include <stdio.h> ^ Main.java:1: error: class, interface, enum, or record expected #include <stdio.h> ^ Main.java:5: error: unnamed classes are a preview feature and are disabled by default. int num; ^ (use --enable-preview to enable unnamed classes) Main.java:9: error: class, interface, enum, or record expected for(i = 0;i < 100;i++){ ^ Main.java:9: error: class, interface, enum, or record expected for(i = 0;i < 100;i++){ ^ Main.java:9: error: class, interface, enum, or record expected for(i = 0;i < 100;i++){ ^ Main.java:11: error: class, interface, enum, or record expected } ^ Main.java:15: error: class, interface, enum, or record expected } ^ Main.java:17: error: class, interface, enum, or record expected for(i = 0;i < 100;i++){ ^ Main.java:17: error: class, interface, enum, or record expected for(i = 0;i < 100;i++){ ^ Main.java:20: error: class, interface, enum, or record expected } ^ Main.java:23: error: class, interface, enum, or record expected for(i = 0;i < 100;i++){ ^ Main.java:23: error: class, interface, enum, or record expected for(i = 0;i < 100;i++){ ^ Main.java:26: error: class, interface, enum, or record expected } ^ Main.java:31: error: class, interface, enum, or record expected } ^ 15 errors
s403799353
p00029
Java
import java.util.Scanner; public class Main { private static String[] str; public static void main(String[] args) { setInput(); System.out.println(str[getIndexMaxSameWords()] + " " + str[getIndexLongestWord()]); } public static void setInput(){ String input = getLine(); str = input.split(" "); } private static String getLine(){ Scanner sc = new Scanner(System.in); String str = sc.nextLine(); sc.close(); return str; } public static int getIndexLongestWord(){ int index = 0; int maxLength = str[index].length(); for(int i = 1; i < str.length; i++){ if(maxLength < str[i].length()){ maxLength = str[i].length(); index = i; } } return index; } private static int getNumSameWords(int index){ int numSameWord = 0; for(int i = 0; i < str.length; i++){ if(str[index] == str[i]){ numSameWord++; } } return numSameWord; } public static int getIndexMaxSameWords(){ int index = 0; for(int i = 0; i < str.length; i++){ if(index < getNumSameWords(i)){ index = i; } } return index; } public static String getStr(int index) { return str[index]; } public static void setStr(String[] str) { EnglishSentence.str = str; } }
Main.java:61: error: cannot find symbol EnglishSentence.str = str; ^ symbol: variable EnglishSentence location: class Main 1 error
s623687206
p00029
Java
package Vol000; import java.util.Arrays; import java.util.Scanner; public class AOJ0_29 { public static void main(String atg[]) { Scanner sc = new Scanner(System.in); String s[] = new String[2002]; int index = 0; while(sc.hasNext()) { String str = sc.next(); s[index] = str; index++; } int r[] = new int [index]; boolean flag[] = new boolean[2002]; //Arrays.fill(flag, true); for(int i=0; i<index; i++) { for(int j=i+1; j<index; j++) { //&&flag[j]==true if(s[i].equals(s[j])) { r[i]++; //flag[j]=false; } } } int max=0; int maxin=0; for(int i=0; i<index; i++) { if(max < r[i]) { max=r[i]; maxin = i; } } System.out.print(s[maxin]+" "); max =0; for(int i=0; i<index; i++) if(s[max].length()<s[i].length()) { max =i; } System.out.println(s[max]); } }
Main.java:5: error: class AOJ0_29 is public, should be declared in a file named AOJ0_29.java public class AOJ0_29 ^ 1 error
s295837764
p00029
Java
#include <iostream> #include <string.h> #include <vector> #include <algorithm> using namespace std; typedef pair<string, int> P; bool pairCompare(const P& firstElof, const P& secondElof) { return firstElof.second > secondElof.second; } int main(void) { string s, m; vector<P> v; while (cin >> s) { if (m.size() < s.size()) m = s; bool flag = true; for (int i = 0; i < v.size(); i++) { if (v[i].first == s) { flag = false; v[i].second++; } } if (flag) v.push_back(P(s,1)); } sort(v.begin(), v.end(), pairCompare); cout << v[0].first << " " << m << endl; return 0; }
Main.java:1: error: illegal character: '#' #include <iostream> ^ Main.java:2: error: illegal character: '#' #include <string.h> ^ Main.java:3: error: illegal character: '#' #include <vector> ^ Main.java:4: error: illegal character: '#' #include <algorithm> ^ Main.java:7: error: class, interface, enum, or record expected typedef pair<string, int> P; ^ Main.java:9: error: unnamed classes are a preview feature and are disabled by default. bool pairCompare(const P& firstElof, const P& secondElof) ^ (use --enable-preview to enable unnamed classes) Main.java:9: error: illegal start of type bool pairCompare(const P& firstElof, const P& secondElof) ^ Main.java:30: error: not a statement cout << v[0].first << " " << m << endl; ^ Main.java:14: error: <identifier> expected int main(void) ^ 9 errors
s652228996
p00029
C
#include <iostream> #include <string> using namespace std; int main(){ string sent; string word[500]; int a[500]={}; int i,j,k,l; int n,m,len; i=0; while(cin>>sent){ if(i==0){ word[0]=sent; a[0]++; i++; len=sent.size(); n=0; } else { if(len<sent.size()){ len=sent.size(); n=i; } for(j=0; j<i; j++){ if(sent==word[j]){ a[j]++; break; } if(j==i-1){ word[i]=sent; a[i]++; i++; } } } } m=0; for(j=0; j<=i; j++){ if(m<a[j])m=j; } cout<<word[m]<<" "<<word[n]<<endl; return 0; }
main.c:1:10: fatal error: iostream: No such file or directory 1 | #include <iostream> | ^~~~~~~~~~ compilation terminated.
s649850211
p00029
C
#include <iostream> #include <string> using namespace std; int main(){ string sent; string word[500]; int a[500]={}; int i,j,k,l; int n,m,len; i=0; while(cin>>sent){ if(i==0){ word[0]=sent; a[0]++; i++; len=sent.size(); n=0; } else { if(len<sent.size()){ len=sent.size(); n=i; } for(j=0; j<i; j++){ if(sent==word[j]){ a[j]++; break; } if(j==i-1){ word[i]=sent; a[i]++; i++; break; } } } } m=0; for(j=0; j<i; j++){ if(m<a[j])m=j; } cout<<word[m]<<" "<<word[n]<<endl; // for(j=0; j<i; j++){ // cout<<word[j]<<":"<<a[j]<<endl; // } //cout<<"len:"<<len<<" "<<word[n]<<endl; return 0; }
main.c:1:10: fatal error: iostream: No such file or directory 1 | #include <iostream> | ^~~~~~~~~~ compilation terminated.
s553801771
p00029
C
#include <stdio.h> #include <string.h> int main(void){ char str[1000][50], max[50]; int len = 0, len1 = 0, n=0, cnt, mfreq = 0; while(scanf("%s", str[n]) != EOF){ len = strlen(str[n]); if(len1 < len){ len1 = len; strcpy(max, str[n]); } n++; } for(i=0; i < n; i++){ cnt = 0; strcpy(strtemp, str[i]); for(j=0; j < n; j++){ if(strcmp(str[j], strtemp) == 0) cnt++; } if(mfreq < cnt){ mfreq = cnt; strcpy(mfstr, strtemp); } } printf("%s %s\n", mfstr, max); return 0; }
main.c: In function 'main': main.c:16:9: error: 'i' undeclared (first use in this function) 16 | for(i=0; i < n; i++){ | ^ main.c:16:9: note: each undeclared identifier is reported only once for each function it appears in main.c:18:16: error: 'strtemp' undeclared (first use in this function); did you mean 'strsep'? 18 | strcpy(strtemp, str[i]); | ^~~~~~~ | strsep main.c:19:13: error: 'j' undeclared (first use in this function) 19 | for(j=0; j < n; j++){ | ^ main.c:24:20: error: 'mfstr' undeclared (first use in this function); did you mean 'str'? 24 | strcpy(mfstr, strtemp); | ^~~~~ | str
s331685183
p00029
C
#include <stdio.h> #include <string.h> int main(){ char str[1000][50], max[50]; int len = 0, len1 = 0, n=0, cnt = 0, mfreq = 0, i = 0, J = 0; while(scanf("%s", str[n]) != EOF){ len = strlen(str[n]); if(len1 < len){ len1 = len; strcpy(max, str[n]); } n++; } for(i=0; i < n; i++){ cnt = 0; strcpy(strtemp, str[i]); for(j=0; j < n; j++){ if(strcmp(str[j], strtemp) == 0) cnt++; } if(mfreq < cnt){ mfreq = cnt; strcpy(mfstr, strtemp); } } printf("%s %s\n", mfstr, max); return 0; }
main.c: In function 'main': main.c:18:16: error: 'strtemp' undeclared (first use in this function); did you mean 'strsep'? 18 | strcpy(strtemp, str[i]); | ^~~~~~~ | strsep main.c:18:16: note: each undeclared identifier is reported only once for each function it appears in main.c:19:13: error: 'j' undeclared (first use in this function) 19 | for(j=0; j < n; j++){ | ^ main.c:24:20: error: 'mfstr' undeclared (first use in this function); did you mean 'str'? 24 | strcpy(mfstr, strtemp); | ^~~~~ | str
s108623275
p00029
C
#include<stdio.h> #include<string.h> int main(void){ char s[1100]; char x[1000][50]; int i, j, n, len; int max, size; int a, b; int count; gets(s); n=0; len=strlen(s); i=j=0; while(i<len){ x[n][j]=s[i]; i++; j++; if(s[i]==' '){ i++; n++; j=0; } } n++; max=0; size=0; for(i=0; i<n; i++){ count=1; for(j=i+1; j<n; j++){ if(strcmp(x[i], x[j])==0){ count++; } } if(max<count){ max=count; a=i; } if(size<strlen(x[i])){ size=strlen(x[i]); b=i; } } printf("%s %s\n", x[a], x[b]); return(0); }
main.c: In function 'main': main.c:16:3: error: implicit declaration of function 'gets'; did you mean 'fgets'? [-Wimplicit-function-declaration] 16 | gets(s); | ^~~~ | fgets
s103870289
p00029
C
import java.util.HashMap; import java.util.Scanner; public class Main { public static void main(String[] args) { try(Scanner sc = new Scanner(System.in)){ // while(sc.hasNextLine()){ // // String s = sc.nextLine(); // if(s.equals("")) break; // // int JOI=0; // int IOI=0; // for(int i=0;i<s.length();i++) { // if(s.indexOf("JOI",i)!=-1) { // JOI++; // i=s.indexOf("JOI",i)+1; // } // } // // for(int i=0;i<s.length();i++) { // if(s.indexOf("IOI",i)!=-1) { // IOI++; // i=s.indexOf("IOI",i)+1; // } // } // // System.out.println(JOI); // System.out.println(IOI); // } // } // } //// black 00 00 00 //// blue 00 00 ff //// lime 00 ff 00 //// aqua 00 ff ff //// red ff 00 00 //// fuchsia ff 00 ff //// yellow ff ff 00 //// white ff ff ff // static int[][] rgb = { // {0x00,0x00,0x00}, // {0x00,0x00,0xff}, //// lime 00 ff 00 //// aqua 00 ff ff //// red ff 00 00 //// fuchsia ff 00 ff //// yellow ff ff 00 //// white ff ff ff // // }; //m n String s = sc.nextLine(); String [] t = s.split(" "); String max = ""; HashMap<String,Integer> count = new HashMap<>(); for(String ss : t) { if(ss.length()>max.length()) { max = ss; } Integer n = count.get(ss); if(n == null) { count.put(ss, 1); } else { count.put(ss, n+1); } } String m=""; int max2=0; for(String key: count.keySet()) { if(count.get(key)>max2) { max2=count.get(key); m=key; } } System.out.println(m+" "+max); } } }
main.c:1:1: error: unknown type name 'import' 1 | import java.util.HashMap; | ^~~~~~ main.c:1:12: error: expected '=', ',', ';', 'asm' or '__attribute__' before '.' token 1 | import java.util.HashMap; | ^ main.c:2:1: error: unknown type name 'import' 2 | import java.util.Scanner; | ^~~~~~ main.c:2:12: error: expected '=', ',', ';', 'asm' or '__attribute__' before '.' token 2 | import java.util.Scanner; | ^ main.c:5:1: error: unknown type name 'public' 5 | public class Main { | ^~~~~~ main.c:5:14: error: expected '=', ',', ';', 'asm' or '__attribute__' before 'Main' 5 | public class Main { | ^~~~
s566611749
p00029
C
main(){ int i,n=0,q=0,c[512],a=0,b=0; char s[1024],t[512][32],*p; fgets(s,1024,stdin); for(;;){ p=strchr(s+q,' '); if(!p) p=s+strlen(s)-1; strncpy(t[n],s+q,p-s-q); for(i=0;i<n;i++) if(strcmp(t[i],t[n])==0){ c[i]++; break; } if(i==n){ c[i]=1; n++; } q=p-s+1; if(p==s+strlen(s)-1) break; } for(i=1;i<n;i++){ if(c[i]>c[a]) a=i; if(strlen(t[i])>strlen(t[b])) b=i; } printf("%s %s\n",t[a],t[b]); return 0; }
main.c:1:1: error: return type defaults to 'int' [-Wimplicit-int] 1 | main(){ | ^~~~ main.c: In function 'main': main.c:4:3: error: implicit declaration of function 'fgets' [-Wimplicit-function-declaration] 4 | fgets(s,1024,stdin); | ^~~~~ main.c:4:16: error: 'stdin' undeclared (first use in this function) 4 | fgets(s,1024,stdin); | ^~~~~ main.c:1:1: note: 'stdin' is defined in header '<stdio.h>'; this is probably fixable by adding '#include <stdio.h>' +++ |+#include <stdio.h> 1 | main(){ main.c:4:16: note: each undeclared identifier is reported only once for each function it appears in 4 | fgets(s,1024,stdin); | ^~~~~ main.c:6:7: error: implicit declaration of function 'strchr' [-Wimplicit-function-declaration] 6 | p=strchr(s+q,' '); | ^~~~~~ main.c:1:1: note: include '<string.h>' or provide a declaration of 'strchr' +++ |+#include <string.h> 1 | main(){ main.c:6:7: warning: incompatible implicit declaration of built-in function 'strchr' [-Wbuiltin-declaration-mismatch] 6 | p=strchr(s+q,' '); | ^~~~~~ main.c:6:7: note: include '<string.h>' or provide a declaration of 'strchr' main.c:8:11: error: implicit declaration of function 'strlen' [-Wimplicit-function-declaration] 8 | p=s+strlen(s)-1; | ^~~~~~ main.c:8:11: note: include '<string.h>' or provide a declaration of 'strlen' main.c:8:11: warning: incompatible implicit declaration of built-in function 'strlen' [-Wbuiltin-declaration-mismatch] main.c:8:11: note: include '<string.h>' or provide a declaration of 'strlen' main.c:9:5: error: implicit declaration of function 'strncpy' [-Wimplicit-function-declaration] 9 | strncpy(t[n],s+q,p-s-q); | ^~~~~~~ main.c:9:5: note: include '<string.h>' or provide a declaration of 'strncpy' main.c:9:5: warning: incompatible implicit declaration of built-in function 'strncpy' [-Wbuiltin-declaration-mismatch] main.c:9:5: note: include '<string.h>' or provide a declaration of 'strncpy' main.c:11:10: error: implicit declaration of function 'strcmp' [-Wimplicit-function-declaration] 11 | if(strcmp(t[i],t[n])==0){ | ^~~~~~ main.c:11:10: note: include '<string.h>' or provide a declaration of 'strcmp' main.c:20:13: warning: incompatible implicit declaration of built-in function 'strlen' [-Wbuiltin-declaration-mismatch] 20 | if(p==s+strlen(s)-1) | ^~~~~~ main.c:20:13: note: include '<string.h>' or provide a declaration of 'strlen' main.c:26:8: warning: incompatible implicit declaration of built-in function 'strlen' [-Wbuiltin-declaration-mismatch] 26 | if(strlen(t[i])>strlen(t[b])) | ^~~~~~ main.c:26:8: note: include '<string.h>' or provide a declaration of 'strlen' main.c:29:3: error: implicit declaration of function 'printf' [-Wimplicit-function-declaration] 29 | printf("%s %s\n",t[a],t[b]); | ^~~~~~ main.c:29:3: note: include '<stdio.h>' or provide a declaration of 'printf' main.c:29:3: warning: incompatible implicit declaration of built-in function 'printf' [-Wbuiltin-declaration-mismatch] main.c:29:3: note: include '<stdio.h>' or provide a declaration of 'printf'
s086728154
p00029
C
d[99],*p,*f=d,*l,i,T;main(t,w){for(;i=~scanf("%as",&w)?:!printf("%s %s\n",*f,*l);t>T?T=t,l=p:0){for(p=d;*p&&strcmp(*p,w);p+=2);t=strlen(*p=w);++p[1]>f[1]?f=p:0;}}
main.c:1:1: warning: data definition has no type or storage class 1 | d[99],*p,*f=d,*l,i,T;main(t,w){for(;i=~scanf("%as",&w)?:!printf("%s %s\n",*f,*l);t>T?T=t,l=p:0){for(p=d;*p&&strcmp(*p,w);p+=2);t=strlen(*p=w);++p[1]>f[1]?f=p:0;}} | ^ main.c:1:1: error: type defaults to 'int' in declaration of 'd' [-Wimplicit-int] main.c:1:8: error: type defaults to 'int' in declaration of 'p' [-Wimplicit-int] 1 | d[99],*p,*f=d,*l,i,T;main(t,w){for(;i=~scanf("%as",&w)?:!printf("%s %s\n",*f,*l);t>T?T=t,l=p:0){for(p=d;*p&&strcmp(*p,w);p+=2);t=strlen(*p=w);++p[1]>f[1]?f=p:0;}} | ^ main.c:1:11: error: type defaults to 'int' in declaration of 'f' [-Wimplicit-int] 1 | d[99],*p,*f=d,*l,i,T;main(t,w){for(;i=~scanf("%as",&w)?:!printf("%s %s\n",*f,*l);t>T?T=t,l=p:0){for(p=d;*p&&strcmp(*p,w);p+=2);t=strlen(*p=w);++p[1]>f[1]?f=p:0;}} | ^ main.c:1:16: error: type defaults to 'int' in declaration of 'l' [-Wimplicit-int] 1 | d[99],*p,*f=d,*l,i,T;main(t,w){for(;i=~scanf("%as",&w)?:!printf("%s %s\n",*f,*l);t>T?T=t,l=p:0){for(p=d;*p&&strcmp(*p,w);p+=2);t=strlen(*p=w);++p[1]>f[1]?f=p:0;}} | ^ main.c:1:18: error: type defaults to 'int' in declaration of 'i' [-Wimplicit-int] 1 | d[99],*p,*f=d,*l,i,T;main(t,w){for(;i=~scanf("%as",&w)?:!printf("%s %s\n",*f,*l);t>T?T=t,l=p:0){for(p=d;*p&&strcmp(*p,w);p+=2);t=strlen(*p=w);++p[1]>f[1]?f=p:0;}} | ^ main.c:1:20: error: type defaults to 'int' in declaration of 'T' [-Wimplicit-int] 1 | d[99],*p,*f=d,*l,i,T;main(t,w){for(;i=~scanf("%as",&w)?:!printf("%s %s\n",*f,*l);t>T?T=t,l=p:0){for(p=d;*p&&strcmp(*p,w);p+=2);t=strlen(*p=w);++p[1]>f[1]?f=p:0;}} | ^ main.c:1:22: error: return type defaults to 'int' [-Wimplicit-int] 1 | d[99],*p,*f=d,*l,i,T;main(t,w){for(;i=~scanf("%as",&w)?:!printf("%s %s\n",*f,*l);t>T?T=t,l=p:0){for(p=d;*p&&strcmp(*p,w);p+=2);t=strlen(*p=w);++p[1]>f[1]?f=p:0;}} | ^~~~ main.c: In function 'main': main.c:1:22: error: type of 't' defaults to 'int' [-Wimplicit-int] main.c:1:22: error: type of 'w' defaults to 'int' [-Wimplicit-int] main.c:1:40: error: implicit declaration of function 'scanf' [-Wimplicit-function-declaration] 1 | d[99],*p,*f=d,*l,i,T;main(t,w){for(;i=~scanf("%as",&w)?:!printf("%s %s\n",*f,*l);t>T?T=t,l=p:0){for(p=d;*p&&strcmp(*p,w);p+=2);t=strlen(*p=w);++p[1]>f[1]?f=p:0;}} | ^~~~~ main.c:1:1: note: include '<stdio.h>' or provide a declaration of 'scanf' +++ |+#include <stdio.h> 1 | d[99],*p,*f=d,*l,i,T;main(t,w){for(;i=~scanf("%as",&w)?:!printf("%s %s\n",*f,*l);t>T?T=t,l=p:0){for(p=d;*p&&strcmp(*p,w);p+=2);t=strlen(*p=w);++p[1]>f[1]?f=p:0;}} main.c:1:40: warning: incompatible implicit declaration of built-in function 'scanf' [-Wbuiltin-declaration-mismatch] 1 | d[99],*p,*f=d,*l,i,T;main(t,w){for(;i=~scanf("%as",&w)?:!printf("%s %s\n",*f,*l);t>T?T=t,l=p:0){for(p=d;*p&&strcmp(*p,w);p+=2);t=strlen(*p=w);++p[1]>f[1]?f=p:0;}} | ^~~~~ main.c:1:40: note: include '<stdio.h>' or provide a declaration of 'scanf' main.c:1:58: error: implicit declaration of function 'printf' [-Wimplicit-function-declaration] 1 | d[99],*p,*f=d,*l,i,T;main(t,w){for(;i=~scanf("%as",&w)?:!printf("%s %s\n",*f,*l);t>T?T=t,l=p:0){for(p=d;*p&&strcmp(*p,w);p+=2);t=strlen(*p=w);++p[1]>f[1]?f=p:0;}} | ^~~~~~ main.c:1:58: note: include '<stdio.h>' or provide a declaration of 'printf' main.c:1:58: warning: incompatible implicit declaration of built-in function 'printf' [-Wbuiltin-declaration-mismatch] main.c:1:58: note: include '<stdio.h>' or provide a declaration of 'printf' main.c:1:109: error: implicit declaration of function 'strcmp' [-Wimplicit-function-declaration] 1 | d[99],*p,*f=d,*l,i,T;main(t,w){for(;i=~scanf("%as",&w)?:!printf("%s %s\n",*f,*l);t>T?T=t,l=p:0){for(p=d;*p&&strcmp(*p,w);p+=2);t=strlen(*p=w);++p[1]>f[1]?f=p:0;}} | ^~~~~~ main.c:1:1: note: include '<string.h>' or provide a declaration of 'strcmp' +++ |+#include <string.h> 1 | d[99],*p,*f=d,*l,i,T;main(t,w){for(;i=~scanf("%as",&w)?:!printf("%s %s\n",*f,*l);t>T?T=t,l=p:0){for(p=d;*p&&strcmp(*p,w);p+=2);t=strlen(*p=w);++p[1]>f[1]?f=p:0;}} main.c:1:116: error: passing argument 1 of 'strcmp' makes pointer from integer without a cast [-Wint-conversion] 1 | d[99],*p,*f=d,*l,i,T;main(t,w){for(;i=~scanf("%as",&w)?:!printf("%s %s\n",*f,*l);t>T?T=t,l=p:0){for(p=d;*p&&strcmp(*p,w);p+=2);t=strlen(*p=w);++p[1]>f[1]?f=p:0;}} | ^~ | | | int main.c:1:116: note: expected 'const char *' but argument is of type 'int' main.c:1:119: error: passing argument 2 of 'strcmp' makes pointer from integer without a cast [-Wint-conversion] 1 | d[99],*p,*f=d,*l,i,T;main(t,w){for(;i=~scanf("%as",&w)?:!printf("%s %s\n",*f,*l);t>T?T=t,l=p:0){for(p=d;*p&&strcmp(*p,w);p+=2);t=strlen(*p=w);++p[1]>f[1]?f=p:0;}} | ^ | | | int main.c:1:119: note: expected 'const char *' but argument is of type 'int' main.c:1:130: error: implicit declaration of function 'strlen' [-Wimplicit-function-declaration] 1 | d[99],*p,*f=d,*l,i,T;main(t,w){for(;i=~scanf("%as",&w)?:!printf("%s %s\n",*f,*l);t>T?T=t,l=p:0){for(p=d;*p&&strcmp(*p,w);p+=2);t=strlen(*p=w);++p[1]>f[1]?f=p:0;}} | ^~~~~~ main.c:1:130: note: include '<string.h>' or provide a declaration of 'strlen' main.c:1:130: warning: incompatible implicit declaration of built-in function 'strlen' [-Wbuiltin-declaration-mismatch] main.c:1:130: note: include '<string.h>' or provide a declaration of 'strlen' main.c:1:139: error: passing argument 1 of 'strlen' makes pointer from integer without a cast [-Wint-conversion] 1 | d[99],*p,*f=d,*l,i,T;main(t,w){for(;i=~scanf("%as",&w)?:!printf("%s %s\n",*f,*l);t>T?T=t,l=p:0){for(p=d;*p&&strcmp(*p,w);p+=2);t=strlen(*p=w);++p[1]>f[1]?f=p:0;}} | ~~^~ | | | int main.c:1:139: note: expected 'const char *' but argument is of type 'int'
s868174307
p00029
C
#include<iostream> #include<map> using namespace std; map<string,int>mp; string ans,s,amins; int maxn=0,minn=0; int main() { while(cin>>s) { mp[s]++; if(mp[s]>maxn) { maxn=mp[s]; ans=s; } if(s.size()>minn) { minn=s.size(); amins=s; } } cout<<ans<<" "<<amins<<endl; return 0; }
main.c:1:9: fatal error: iostream: No such file or directory 1 | #include<iostream> | ^~~~~~~~~~ compilation terminated.
s209737126
p00029
C
sent=raw_input() words=sent.split() max_f,freq_w=0,"" max_len,len_w=0,"" for word in words: if max_f<words.count(word): freq_w=word max_f=words.count(word) if max_len<len(word): len_w=word max_len=len(word) print "%s %s"%(freq_w,len_w)
main.c:1:1: warning: data definition has no type or storage class 1 | sent=raw_input() | ^~~~ main.c:1:1: error: type defaults to 'int' in declaration of 'sent' [-Wimplicit-int] main.c:1:6: error: implicit declaration of function 'raw_input' [-Wimplicit-function-declaration] 1 | sent=raw_input() | ^~~~~~~~~ main.c:1:6: error: initializer element is not constant main.c:2:1: error: expected ',' or ';' before 'words' 2 | words=sent.split() | ^~~~~
s229524960
p00029
C
#include<stdio.h> #include<malloc.h> #include<string.h> #include<stdlib.h>#include<stdio.h> #include<malloc.h> #include<string.h> #include<stdlib.h> typedef struct wordtree{ struct wordtree *next; struct wordtree *prev; char *txt; int t_num; int t_size; }wordtree; wordtree *initTree(char *msg,int num,int size){ wordtree *x; x=(wordtree *)malloc(sizeof(wordtree)); x->prev=NULL; x->next=NULL; x->txt=(char *)malloc(sizeof(char)*32); strcpy(x->txt,msg); x->t_num=num; x->t_size=size; return x; } int cnt=0;often=0;length=0; char *mod2,*mod3; void graphtree(wordtree *tree,int mode){ switch(mode){ case 1:if(tree->txt!="")printf("msg=%s,num=%d,size=%d,depth=%d\n",tree->txt,tree->t_num,tree->t_size,cnt); case 2:if(tree->t_num>=often){often=tree->t_num;mod2=tree->txt;} case 3:if(tree->t_size>=length){length=tree->t_size;mod3=tree->txt;} } if(tree->next!=NULL){ cnt++; graphtree(tree->next,mode); } if(tree->prev!=NULL){ cnt--; graphtree(tree->prev,mode); } return ; } void addToTree(char *msg,wordtree *tree){ wordtree *x; x=tree; if(strcmp(msg, x->txt)>0){ if(x->next==NULL){ x->next=initTree(msg,1,strlen(msg)); return; }else{ addToTree(msg,x->next); } }else{ if(x->prev==NULL){ x->prev=initTree(msg,1,strlen(msg)); return; }else{ addToTree(msg,x->prev); } } } wordtree *searchTree(char *msg,wordtree *tree){ wordtree *x; x=tree; if(strcmp(msg,x->txt)>0){ if(x->next==NULL)return NULL; else searchTree(msg,x->next); }else if(strcmp(msg,x->txt)<0){ if(x->prev==NULL)return NULL; else searchTree(msg,x->prev); }else{ return x; } } int main(){ wordtree *r,*p; int i,j; char txt[1024],s[32]; memset(s,'\0',sizeof(s)); r=initTree("nn",0,0);//root while(fgets(txt,sizeof(txt),stdin)!=NULL){ for(i=0,j=0;i<strlen(txt);i++){ if((65<=txt[i]&&txt[i]<=90)||(97<=txt[i]&&txt[i]<=122)){ if((65<=txt[i]&&txt[i]<=90))txt[i]+=32; s[j]=txt[i]; j++; }else{ j=0; p=searchTree(s,r); if(p==NULL) addToTree(s,r); else p->t_num++; memset(s,'\0',sizeof(s)); } } //graphtree(r,1); graphtree(r,2); graphtree(r,3); printf("%s %s\n",mod2,mod3); return 0; } } typedef struct wordtree{ struct wordtree *next; struct wordtree *prev; char *txt; int t_num; int t_size; }wordtree; wordtree *initTree(char *msg,int num,int size){ wordtree *x; x=(wordtree *)malloc(sizeof(wordtree)); x->prev=NULL; x->next=NULL; x->txt=(char *)malloc(sizeof(char)*32); strcpy(x->txt,msg); x->t_num=num; x->t_size=size; return x; } int cnt=0;often=0;length=0; char *mod2,*mod3; void graphtree(wordtree *tree,int mode){ switch(mode){ case 1:if(tree->txt!="")printf("msg=%s,num=%d,size=%d,depth=%d\n",tree->txt,tree->t_num,tree->t_size,cnt); case 2:if(tree->t_num>=often){often=tree->t_num;mod2=tree->txt;} case 3:if(tree->t_size>=length){length=tree->t_size;mod3=tree->txt;} } if(tree->next!=NULL){ cnt++; graphtree(tree->next,mode); } if(tree->prev!=NULL){ cnt--; graphtree(tree->prev,mode); } return ; } void addToTree(char *msg,wordtree *tree){ wordtree *x; x=tree; if(strcmp(msg, x->txt)>0){ if(x->next==NULL){ x->next=initTree(msg,1,strlen(msg)); return; }else{ addToTree(msg,x->next); } }else{ if(x->prev==NULL){ x->prev=initTree(msg,1,strlen(msg)); return; }else{ addToTree(msg,x->prev); } } } wordtree *searchTree(char *msg,wordtree *tree){ wordtree *x; x=tree; if(strcmp(msg,x->txt)>0){ if(x->next==NULL)return NULL; else searchTree(msg,x->next); }else if(strcmp(msg,x->txt)<0){ if(x->prev==NULL)return NULL; else searchTree(msg,x->prev); }else{ return x; } } int main(){ wordtree *r,*p; int i,j; char txt[1024],s[32]; memset(s,'\0',sizeof(s)); r=initTree("nn",0,0);//root while(fgets(txt,sizeof(txt),stdin)!=NULL){ for(i=0,j=0;i<strlen(txt);i++){ if((65<=txt[i]&&txt[i]<=90)||(97<=txt[i]&&txt[i]<=122)){ if((65<=txt[i]&&txt[i]<=90))txt[i]+=32; s[j]=txt[i]; j++; }else{ j=0; p=searchTree(s,r); if(p==NULL) addToTree(s,r); else p->t_num++; memset(s,'\0',sizeof(s)); } } //graphtree(r,1); graphtree(r,2); graphtree(r,3); printf("%s %s\n",mod2,mod3); } return 0; }
main.c:4:19: warning: extra tokens at end of #include directive 4 | #include<stdlib.h>#include<stdio.h> | ^ main.c:28:11: warning: data definition has no type or storage class 28 | int cnt=0;often=0;length=0; | ^~~~~ main.c:28:11: error: type defaults to 'int' in declaration of 'often' [-Wimplicit-int] main.c:28:19: warning: data definition has no type or storage class 28 | int cnt=0;often=0;length=0; | ^~~~~~ main.c:28:19: error: type defaults to 'int' in declaration of 'length' [-Wimplicit-int] main.c:109:16: error: redefinition of 'struct wordtree' 109 | typedef struct wordtree{ | ^~~~~~~~ main.c:9:16: note: originally defined here 9 | typedef struct wordtree{ | ^~~~~~~~ main.c:115:2: error: conflicting types for 'wordtree'; have 'struct wordtree' 115 | }wordtree; | ^~~~~~~~ main.c:15:2: note: previous declaration of 'wordtree' with type 'wordtree' 15 | }wordtree; | ^~~~~~~~ main.c:117:11: error: conflicting types for 'initTree'; have 'wordtree *(char *, int, int)' 117 | wordtree *initTree(char *msg,int num,int size){ | ^~~~~~~~ main.c:17:11: note: previous definition of 'initTree' with type 'wordtree *(char *, int, int)' 17 | wordtree *initTree(char *msg,int num,int size){ | ^~~~~~~~ main.c:128:5: error: redefinition of 'cnt' 128 | int cnt=0;often=0;length=0; | ^~~ main.c:28:5: note: previous definition of 'cnt' with type 'int' 28 | int cnt=0;often=0;length=0; | ^~~ main.c:128:11: warning: data definition has no type or storage class 128 | int cnt=0;often=0;length=0; | ^~~~~ main.c:128:11: error: type defaults to 'int' in declaration of 'often' [-Wimplicit-int] main.c:128:11: error: redefinition of 'often' main.c:28:11: note: previous definition of 'often' with type 'int' 28 | int cnt=0;often=0;length=0; | ^~~~~ main.c:128:19: warning: data definition has no type or storage class 128 | int cnt=0;often=0;length=0; | ^~~~~~ main.c:128:19: error: type defaults to 'int' in declaration of 'length' [-Wimplicit-int] main.c:128:19: error: redefinition of 'length' main.c:28:19: note: previous definition of 'length' with type 'int' 28 | int cnt=0;often=0;length=0; | ^~~~~~ main.c:130:6: error: conflicting types for 'graphtree'; have 'void(wordtree *, int)' 130 | void graphtree(wordtree *tree,int mode){ | ^~~~~~~~~ main.c:30:6: note: previous definition of 'graphtree' with type 'void(wordtree *, int)' 30 | void graphtree(wordtree *tree,int mode){ | ^~~~~~~~~ main.c:147:6: error: conflicting types for 'addToTree'; have 'void(char *, wordtree *)' 147 | void addToTree(char *msg,wordtree *tree){ | ^~~~~~~~~ main.c:47:6: note: previous definition of 'addToTree' with type 'void(char *, wordtree *)' 47 | void addToTree(char *msg,wordtree *tree){ | ^~~~~~~~~ main.c:167:11: error: conflicting types for 'searchTree'; have 'wordtree *(char *, wordtree *)' 167 | wordtree *searchTree(char *msg,wordtree *tree){ | ^~~~~~~~~~ main.c:67:11: note: previous definition of 'searchTree' with type 'wordtree *(char *, wordtree *)' 67 | wordtree *searchTree(char *msg,wordtree *tree){ | ^~~~~~~~~~ main.c:181:5: error: redefinition of 'main' 181 | int main(){ | ^~~~ main.c:81:5: note: previous definition of 'main' with type 'int()' 81 | int main(){ | ^~~~
s647939382
p00029
C
#include <stdio> #include <string> char str[50]; char word[1000][50]; int count[1000]; int main(void) { int i, j, ind, ind2; int c, len = 0; i = 0; while (scanf("%s", str) != EOF){ c = 1; for (j = 0; j < i; j++){ if (strcmp(str, word[j]) == 0){ count[j]++; c = 0; } } if (c == 1){ strcpy(word[i], str); if (strlen(word[i]) > len){ len = strlen(word[i]); ind = i; } i++; } } ind2 = 0; for (j = 0; j < i; j++){ if (count[ind2] < count[j]){ ind2 = j; } } printf("%s %s\n", word[ind2], word[ind]); return (0); }
main.c:1:10: fatal error: stdio: No such file or directory 1 | #include <stdio> | ^~~~~~~ compilation terminated.
s074929529
p00029
C
#include <stdio.h> #include <conio.h> #include <string.h> int main(void) { char str[1024][64]; int i, j; int ls; int lsl; int sl; int mus; int stri[1024]; for (i = 0; i < 1024; i++){ stri[i] = 0; } i = 0; ls = 0; lsl = 0; while (scanf("%s", str[i]) != EOF){ sl = strlen(str[i]); if (sl > lsl){ ls = i; lsl = sl; } for (j = 0; j <= i; j++){ if (strcmp(str[j], str[i]) == 0){ stri[j]++; break; } } i++; } mus = 0; for (j = 1; j < i; j++){ if (stri[j] > stri[mus]){ mus = j; } } printf("%s %s\n", str[mus], str[ls]); return (0); }
main.c:2:10: fatal error: conio.h: No such file or directory 2 | #include <conio.h> | ^~~~~~~~~ compilation terminated.
s604576260
p00029
C++
#include <iostream> #include <string> #include <map> using namespace std; map<string, int> table; int main() { string word, frequent, longest; size_t N = 0; while (cin >> word) { table[word]++; if (table[word] > N)frequest = word; if (word.size() > longest.size())longest = word; } cout >> frequent >> longest >> endl; }
a.cc: In function 'int main()': a.cc:13:37: error: 'frequest' was not declared in this scope; did you mean 'frequent'? 13 | if (table[word] > N)frequest = word; | ^~~~~~~~ | frequent a.cc:16:14: error: no match for 'operator>>' (operand types are 'std::ostream' {aka 'std::basic_ostream<char>'} and 'std::string' {aka 'std::__cxx11::basic_string<char>'}) 16 | cout >> frequent >> longest >> endl; | ~~~~ ^~ ~~~~~~~~ | | | | | std::string {aka std::__cxx11::basic_string<char>} | std::ostream {aka std::basic_ostream<char>} In file included from /usr/include/c++/14/string:55, from /usr/include/c++/14/bits/locale_classes.h:40, from /usr/include/c++/14/bits/ios_base.h:41, from /usr/include/c++/14/ios:44, from /usr/include/c++/14/ostream:40, from /usr/include/c++/14/iostream:41, from a.cc:1: /usr/include/c++/14/bits/basic_string.tcc:835:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> std::basic_istream<_CharT, _Traits>& std::operator>>(basic_istream<_CharT, _Traits>&, __cxx11::basic_string<_CharT, _Traits, _Allocator>&)' 835 | operator>>(basic_istream<_CharT, _Traits>& __in, | ^~~~~~~~ /usr/include/c++/14/bits/basic_string.tcc:835:5: note: template argument deduction/substitution failed: a.cc:16:17: note: 'std::ostream' {aka 'std::basic_ostream<char>'} is not derived from 'std::basic_istream<_CharT, _Traits>' 16 | cout >> frequent >> longest >> endl; | ^~~~~~~~ In file included from /usr/include/c++/14/bits/memory_resource.h:38, from /usr/include/c++/14/string:68: /usr/include/c++/14/cstddef:131:5: note: candidate: 'template<class _IntegerType> constexpr std::__byte_op_t<_IntegerType> std::operator>>(byte, _IntegerType)' 131 | operator>>(byte __b, _IntegerType __shift) noexcept | ^~~~~~~~ /usr/include/c++/14/cstddef:131:5: note: template argument deduction/substitution failed: a.cc:16:9: note: cannot convert 'std::cout' (type 'std::ostream' {aka 'std::basic_ostream<char>'}) to type 'std::byte' 16 | cout >> frequent >> longest >> endl; | ^~~~ In file included from /usr/include/c++/14/istream:1109, from /usr/include/c++/14/iostream:42: /usr/include/c++/14/bits/istream.tcc:978:5: note: candidate: 'template<class _CharT, class _Traits> std::basic_istream<_CharT, _Traits>& std::operator>>(basic_istream<_CharT, _Traits>&, _CharT&)' 978 | operator>>(basic_istream<_CharT, _Traits>& __in, _CharT& __c) | ^~~~~~~~ /usr/include/c++/14/bits/istream.tcc:978:5: note: template argument deduction/substitution failed: a.cc:16:17: note: 'std::ostream' {aka 'std::basic_ostream<char>'} is not derived from 'std::basic_istream<_CharT, _Traits>' 16 | cout >> frequent >> longest >> endl; | ^~~~~~~~ /usr/include/c++/14/istream:849:5: note: candidate: 'template<class _Traits> std::basic_istream<char, _Traits>& std::operator>>(basic_istream<char, _Traits>&, unsigned char&)' 849 | operator>>(basic_istream<char, _Traits>& __in, unsigned char& __c) | ^~~~~~~~ /usr/include/c++/14/istream:849:5: note: template argument deduction/substitution failed: a.cc:16:17: note: 'std::ostream' {aka 'std::basic_ostream<char>'} is not derived from 'std::basic_istream<char, _Traits>' 16 | cout >> frequent >> longest >> endl; | ^~~~~~~~ /usr/include/c++/14/istream:854:5: note: candidate: 'template<class _Traits> std::basic_istream<char, _Traits>& std::operator>>(basic_istream<char, _Traits>&, signed char&)' 854 | operator>>(basic_istream<char, _Traits>& __in, signed char& __c) | ^~~~~~~~ /usr/include/c++/14/istream:854:5: note: template argument deduction/substitution failed: a.cc:16:17: note: 'std::ostream' {aka 'std::basic_ostream<char>'} is not derived from 'std::basic_istream<char, _Traits>' 16 | cout >> frequent >> longest >> endl; | ^~~~~~~~ /usr/include/c++/14/istream:896:5: note: candidate: 'template<class _CharT, class _Traits> std::basic_istream<_CharT, _Traits>& std::operator>>(basic_istream<_CharT, _Traits>&, _CharT*)' 896 | operator>>(basic_istream<_CharT, _Traits>& __in, _CharT* __s) | ^~~~~~~~ /usr/include/c++/14/istream:896:5: note: template argument deduction/substitution failed: a.cc:16:17: note: 'std::ostream' {aka 'std::basic_ostream<char>'} is not derived from 'std::basic_istream<_CharT, _Traits>' 16 | cout >> frequent >> longest >> endl; | ^~~~~~~~ /usr/include/c++/14/istream:939:5: note: candidate: 'template<class _Traits> std::basic_istream<char, _Traits>& std::operator>>(basic_istream<char, _Traits>&, unsigned char*)' 939 | operator>>(basic_istream<char, _Traits>& __in, unsigned char* __s) | ^~~~~~~~ /usr/include/c++/14/istream:939:5: note: template argument deduction/substitution failed: a.cc:16:17: note: 'std::ostream' {aka 'std::basic_ostream<char>'} is not derived from 'std::basic_istream<char, _Traits>' 16 | cout >> frequent >> longest >> endl; | ^~~~~~~~ /usr/include/c++/14/istream:945:5: note: candidate: 'template<class _Traits> std::basic_istream<char, _Traits>& std::operator>>(basic_istream<char, _Traits>&, signed char*)' 945 | operator>>(basic_istream<char, _Traits>& __in, signed char* __s) | ^~~~~~~~ /usr/include/c++/14/istream:945:5: note: template argument deduction/substitution failed: a.cc:16:17: note: 'std::ostream' {aka 'std::basic_ostream<char>'} is not derived from 'std::basic_istream<char, _Traits>' 16 | cout >> frequent >> longest >> endl; | ^~~~~~~~ /usr/include/c++/14/istream:1099:5: note: candidate: 'template<class _Istream, class _Tp> _Istream&& std::operator>>(_Istream&&, _Tp&&)' 1099 | operator>>(_Istream&& __is, _Tp&& __x) | ^~~~~~~~ /usr/include/c++/14/istream:1099:5: note: template argument deduction/substitution failed: /usr/include/c++/14/istream: In substitution of 'template<class _Istream, class _Tp> _Istream&& std::operator>>(_Istream&&, _Tp&&) [with _Istream = std::basic_ostream<char>&; _Tp = std::__cxx11::basic_string<char>&]': a.cc:16:10: required from here 16 | cout >> frequent >> longest >> endl; | ^~~~~~~~ /usr/include/c++/14/istream:1099:5: error: no type named 'type' in 'struct std::enable_if<false, void>' 1099 | operator>>(_Istream&& __is, _Tp&& __x) | ^~~~~~~~
s585164216
p00029
C++
#include <iostream> #include <string> #include <map> using namespace std; map<string, int> table; int main() { string word, frequent, longest; size_t N = 0; while (cin >> word) { table[word]++; if (table[word] > N)frequest = word; if (word.size() > longest.size())longest = word; } cout >> frequent >> longest >> endl; }
a.cc: In function 'int main()': a.cc:13:37: error: 'frequest' was not declared in this scope; did you mean 'frequent'? 13 | if (table[word] > N)frequest = word; | ^~~~~~~~ | frequent a.cc:16:14: error: no match for 'operator>>' (operand types are 'std::ostream' {aka 'std::basic_ostream<char>'} and 'std::string' {aka 'std::__cxx11::basic_string<char>'}) 16 | cout >> frequent >> longest >> endl; | ~~~~ ^~ ~~~~~~~~ | | | | | std::string {aka std::__cxx11::basic_string<char>} | std::ostream {aka std::basic_ostream<char>} In file included from /usr/include/c++/14/string:55, from /usr/include/c++/14/bits/locale_classes.h:40, from /usr/include/c++/14/bits/ios_base.h:41, from /usr/include/c++/14/ios:44, from /usr/include/c++/14/ostream:40, from /usr/include/c++/14/iostream:41, from a.cc:1: /usr/include/c++/14/bits/basic_string.tcc:835:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> std::basic_istream<_CharT, _Traits>& std::operator>>(basic_istream<_CharT, _Traits>&, __cxx11::basic_string<_CharT, _Traits, _Allocator>&)' 835 | operator>>(basic_istream<_CharT, _Traits>& __in, | ^~~~~~~~ /usr/include/c++/14/bits/basic_string.tcc:835:5: note: template argument deduction/substitution failed: a.cc:16:17: note: 'std::ostream' {aka 'std::basic_ostream<char>'} is not derived from 'std::basic_istream<_CharT, _Traits>' 16 | cout >> frequent >> longest >> endl; | ^~~~~~~~ In file included from /usr/include/c++/14/bits/memory_resource.h:38, from /usr/include/c++/14/string:68: /usr/include/c++/14/cstddef:131:5: note: candidate: 'template<class _IntegerType> constexpr std::__byte_op_t<_IntegerType> std::operator>>(byte, _IntegerType)' 131 | operator>>(byte __b, _IntegerType __shift) noexcept | ^~~~~~~~ /usr/include/c++/14/cstddef:131:5: note: template argument deduction/substitution failed: a.cc:16:9: note: cannot convert 'std::cout' (type 'std::ostream' {aka 'std::basic_ostream<char>'}) to type 'std::byte' 16 | cout >> frequent >> longest >> endl; | ^~~~ In file included from /usr/include/c++/14/istream:1109, from /usr/include/c++/14/iostream:42: /usr/include/c++/14/bits/istream.tcc:978:5: note: candidate: 'template<class _CharT, class _Traits> std::basic_istream<_CharT, _Traits>& std::operator>>(basic_istream<_CharT, _Traits>&, _CharT&)' 978 | operator>>(basic_istream<_CharT, _Traits>& __in, _CharT& __c) | ^~~~~~~~ /usr/include/c++/14/bits/istream.tcc:978:5: note: template argument deduction/substitution failed: a.cc:16:17: note: 'std::ostream' {aka 'std::basic_ostream<char>'} is not derived from 'std::basic_istream<_CharT, _Traits>' 16 | cout >> frequent >> longest >> endl; | ^~~~~~~~ /usr/include/c++/14/istream:849:5: note: candidate: 'template<class _Traits> std::basic_istream<char, _Traits>& std::operator>>(basic_istream<char, _Traits>&, unsigned char&)' 849 | operator>>(basic_istream<char, _Traits>& __in, unsigned char& __c) | ^~~~~~~~ /usr/include/c++/14/istream:849:5: note: template argument deduction/substitution failed: a.cc:16:17: note: 'std::ostream' {aka 'std::basic_ostream<char>'} is not derived from 'std::basic_istream<char, _Traits>' 16 | cout >> frequent >> longest >> endl; | ^~~~~~~~ /usr/include/c++/14/istream:854:5: note: candidate: 'template<class _Traits> std::basic_istream<char, _Traits>& std::operator>>(basic_istream<char, _Traits>&, signed char&)' 854 | operator>>(basic_istream<char, _Traits>& __in, signed char& __c) | ^~~~~~~~ /usr/include/c++/14/istream:854:5: note: template argument deduction/substitution failed: a.cc:16:17: note: 'std::ostream' {aka 'std::basic_ostream<char>'} is not derived from 'std::basic_istream<char, _Traits>' 16 | cout >> frequent >> longest >> endl; | ^~~~~~~~ /usr/include/c++/14/istream:896:5: note: candidate: 'template<class _CharT, class _Traits> std::basic_istream<_CharT, _Traits>& std::operator>>(basic_istream<_CharT, _Traits>&, _CharT*)' 896 | operator>>(basic_istream<_CharT, _Traits>& __in, _CharT* __s) | ^~~~~~~~ /usr/include/c++/14/istream:896:5: note: template argument deduction/substitution failed: a.cc:16:17: note: 'std::ostream' {aka 'std::basic_ostream<char>'} is not derived from 'std::basic_istream<_CharT, _Traits>' 16 | cout >> frequent >> longest >> endl; | ^~~~~~~~ /usr/include/c++/14/istream:939:5: note: candidate: 'template<class _Traits> std::basic_istream<char, _Traits>& std::operator>>(basic_istream<char, _Traits>&, unsigned char*)' 939 | operator>>(basic_istream<char, _Traits>& __in, unsigned char* __s) | ^~~~~~~~ /usr/include/c++/14/istream:939:5: note: template argument deduction/substitution failed: a.cc:16:17: note: 'std::ostream' {aka 'std::basic_ostream<char>'} is not derived from 'std::basic_istream<char, _Traits>' 16 | cout >> frequent >> longest >> endl; | ^~~~~~~~ /usr/include/c++/14/istream:945:5: note: candidate: 'template<class _Traits> std::basic_istream<char, _Traits>& std::operator>>(basic_istream<char, _Traits>&, signed char*)' 945 | operator>>(basic_istream<char, _Traits>& __in, signed char* __s) | ^~~~~~~~ /usr/include/c++/14/istream:945:5: note: template argument deduction/substitution failed: a.cc:16:17: note: 'std::ostream' {aka 'std::basic_ostream<char>'} is not derived from 'std::basic_istream<char, _Traits>' 16 | cout >> frequent >> longest >> endl; | ^~~~~~~~ /usr/include/c++/14/istream:1099:5: note: candidate: 'template<class _Istream, class _Tp> _Istream&& std::operator>>(_Istream&&, _Tp&&)' 1099 | operator>>(_Istream&& __is, _Tp&& __x) | ^~~~~~~~ /usr/include/c++/14/istream:1099:5: note: template argument deduction/substitution failed: /usr/include/c++/14/istream: In substitution of 'template<class _Istream, class _Tp> _Istream&& std::operator>>(_Istream&&, _Tp&&) [with _Istream = std::basic_ostream<char>&; _Tp = std::__cxx11::basic_string<char>&]': a.cc:16:10: required from here 16 | cout >> frequent >> longest >> endl; | ^~~~~~~~ /usr/include/c++/14/istream:1099:5: error: no type named 'type' in 'struct std::enable_if<false, void>' 1099 | operator>>(_Istream&& __is, _Tp&& __x) | ^~~~~~~~
s143456117
p00029
C++
#include <iostream> #include <string> #include <map> using namespace std; map<string, int> table; int main() { string word, frequent, longest; size_t N = 0; while (cin >> word) { table[word]+=1; if (table[word] > N) { frequest = word; N = table[word]; } if (word.size() > longest.size())longest = word; } cout << frequent <<' '<< longest << endl; return 0; }
a.cc: In function 'int main()': a.cc:15:25: error: 'frequest' was not declared in this scope; did you mean 'frequent'? 15 | frequest = word; | ^~~~~~~~ | frequent
s540260469
p00029
C++
#include <map> #include <string> #include <iostream> using namespace std; map<string,int> table; int main() { string word, frequent, longest; size_t N=0; while (cin >> word) { table[word]++; if(table[word]>N) { N=table[word]; frequent=word; if(word.size()>longest.size()) longest=word; } cout<<frequent<<" "<<longest<<endl; }
a.cc: In function 'int main()': a.cc:21:6: error: expected '}' at end of input 21 | } | ^ a.cc:7:1: note: to match this '{' 7 | { | ^
s135663433
p00029
C++
#include <iostream> #include <string> #include <map> #include <algorithm> using namespace std; int main() { string s, t; map<string, int> p; while (cin >> s) { transform(s.begin(), s.end(), s.begin(), tolower); if (p.find(s) != p.end()) p[s]++; else p[s] = 1; if (s.size() > t.size()) t = s; } int m = 0; for (map<string, int>::iterator itr = p.begin(); itr != p.end(); itr++) m = max(m, itr->second); for (map<string, int>::iterator itr = p.begin(); itr != p.end(); itr++) if (itr->second == m) cout << itr->first << endl; cout << t << endl; return 0; }
a.cc: In function 'int main()': a.cc:13:26: error: no matching function for call to 'transform(std::__cxx11::basic_string<char>::iterator, std::__cxx11::basic_string<char>::iterator, std::__cxx11::basic_string<char>::iterator, <unresolved overloaded function type>)' 13 | transform(s.begin(), s.end(), s.begin(), tolower); | ~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ In file included from /usr/include/c++/14/algorithm:61, from a.cc:4: /usr/include/c++/14/bits/stl_algo.h:4209:5: note: candidate: 'template<class _IIter, class _OIter, class _UnaryOperation> _OIter std::transform(_IIter, _IIter, _OIter, _UnaryOperation)' 4209 | transform(_InputIterator __first, _InputIterator __last, | ^~~~~~~~~ /usr/include/c++/14/bits/stl_algo.h:4209:5: note: template argument deduction/substitution failed: a.cc:13:26: note: couldn't deduce template parameter '_UnaryOperation' 13 | transform(s.begin(), s.end(), s.begin(), tolower); | ~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /usr/include/c++/14/bits/stl_algo.h:4247:5: note: candidate: 'template<class _IIter1, class _IIter2, class _OIter, class _BinaryOperation> _OIter std::transform(_IIter1, _IIter1, _IIter2, _OIter, _BinaryOperation)' 4247 | transform(_InputIterator1 __first1, _InputIterator1 __last1, | ^~~~~~~~~ /usr/include/c++/14/bits/stl_algo.h:4247:5: note: candidate expects 5 arguments, 4 provided In file included from /usr/include/c++/14/algorithm:86: /usr/include/c++/14/pstl/glue_algorithm_defs.h:156:1: note: candidate: 'template<class _ExecutionPolicy, class _ForwardIterator1, class _ForwardIterator2, class _UnaryOperation> __pstl::__internal::__enable_if_execution_policy<_ExecutionPolicy, _ForwardIterator2> std::transform(_ExecutionPolicy&&, _ForwardIterator1, _ForwardIterator1, _ForwardIterator2, _UnaryOperation)' 156 | transform(_ExecutionPolicy&& __exec, _ForwardIterator1 __first, _ForwardIterator1 __last, _ForwardIterator2 __result, | ^~~~~~~~~ /usr/include/c++/14/pstl/glue_algorithm_defs.h:156:1: note: candidate expects 5 arguments, 4 provided /usr/include/c++/14/pstl/glue_algorithm_defs.h:162:1: note: candidate: 'template<class _ExecutionPolicy, class _ForwardIterator1, class _ForwardIterator2, class _ForwardIterator, class _BinaryOperation> __pstl::__internal::__enable_if_execution_policy<_ExecutionPolicy, _ForwardIterator2> std::transform(_ExecutionPolicy&&, _ForwardIterator1, _ForwardIterator1, _ForwardIterator2, _ForwardIterator, _BinaryOperation)' 162 | transform(_ExecutionPolicy&& __exec, _ForwardIterator1 __first1, _ForwardIterator1 __last1, _ForwardIterator2 __first2, | ^~~~~~~~~ /usr/include/c++/14/pstl/glue_algorithm_defs.h:162:1: note: candidate expects 6 arguments, 4 provided
s834282885
p00029
C++
#include <iostream> #include <string> #include <map> #include <algorithm> using namespace std; int main() { string s, t; map<string, int> p; while (cin >> s) { transform(s.begin(), s.end(), s.begin(), tolower); if (p.find(s) != p.end()) p[s]++; else p[s] = 1; if (s.size() > t.size()) t = s; } int m = 0; for (map<string, int>::iterator itr = p.begin(); itr != p.end(); itr++) m = max(m, itr->second); for (map<string, int>::iterator itr = p.begin(); itr != p.end(); itr++) if (itr->second == m) cout << itr->first << endl; cout << t << endl; return 0; }
a.cc: In function 'int main()': a.cc:13:26: error: no matching function for call to 'transform(std::__cxx11::basic_string<char>::iterator, std::__cxx11::basic_string<char>::iterator, std::__cxx11::basic_string<char>::iterator, <unresolved overloaded function type>)' 13 | transform(s.begin(), s.end(), s.begin(), tolower); | ~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ In file included from /usr/include/c++/14/algorithm:61, from a.cc:4: /usr/include/c++/14/bits/stl_algo.h:4209:5: note: candidate: 'template<class _IIter, class _OIter, class _UnaryOperation> _OIter std::transform(_IIter, _IIter, _OIter, _UnaryOperation)' 4209 | transform(_InputIterator __first, _InputIterator __last, | ^~~~~~~~~ /usr/include/c++/14/bits/stl_algo.h:4209:5: note: template argument deduction/substitution failed: a.cc:13:26: note: couldn't deduce template parameter '_UnaryOperation' 13 | transform(s.begin(), s.end(), s.begin(), tolower); | ~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /usr/include/c++/14/bits/stl_algo.h:4247:5: note: candidate: 'template<class _IIter1, class _IIter2, class _OIter, class _BinaryOperation> _OIter std::transform(_IIter1, _IIter1, _IIter2, _OIter, _BinaryOperation)' 4247 | transform(_InputIterator1 __first1, _InputIterator1 __last1, | ^~~~~~~~~ /usr/include/c++/14/bits/stl_algo.h:4247:5: note: candidate expects 5 arguments, 4 provided In file included from /usr/include/c++/14/algorithm:86: /usr/include/c++/14/pstl/glue_algorithm_defs.h:156:1: note: candidate: 'template<class _ExecutionPolicy, class _ForwardIterator1, class _ForwardIterator2, class _UnaryOperation> __pstl::__internal::__enable_if_execution_policy<_ExecutionPolicy, _ForwardIterator2> std::transform(_ExecutionPolicy&&, _ForwardIterator1, _ForwardIterator1, _ForwardIterator2, _UnaryOperation)' 156 | transform(_ExecutionPolicy&& __exec, _ForwardIterator1 __first, _ForwardIterator1 __last, _ForwardIterator2 __result, | ^~~~~~~~~ /usr/include/c++/14/pstl/glue_algorithm_defs.h:156:1: note: candidate expects 5 arguments, 4 provided /usr/include/c++/14/pstl/glue_algorithm_defs.h:162:1: note: candidate: 'template<class _ExecutionPolicy, class _ForwardIterator1, class _ForwardIterator2, class _ForwardIterator, class _BinaryOperation> __pstl::__internal::__enable_if_execution_policy<_ExecutionPolicy, _ForwardIterator2> std::transform(_ExecutionPolicy&&, _ForwardIterator1, _ForwardIterator1, _ForwardIterator2, _ForwardIterator, _BinaryOperation)' 162 | transform(_ExecutionPolicy&& __exec, _ForwardIterator1 __first1, _ForwardIterator1 __last1, _ForwardIterator2 __first2, | ^~~~~~~~~ /usr/include/c++/14/pstl/glue_algorithm_defs.h:162:1: note: candidate expects 6 arguments, 4 provided
s355531100
p00029
C++
#include <iostream> #include <cstdio> #include <vector> #include <map> using namespace std; int main(void) { vector<string> vec; string input, ans1; int maxLen = 0; while(cin >> input) { vec.push_back(input); if(input.length() > maxLen) { maxLen = (int)input.length(); ans1 = input; } } map<int, string> hm; vector<string>::iterator ite; int max = 0; for(ite = vec.begin(); ite != vec.end(); ite++) { string now = *ite; int cnt = (int)count(vec.begin(), vec.end(), now); if(cnt > max) max = cnt; hm.insert(make_pair(cnt, now)); } map<int, string>::iterator ite2; for(ite2 = hm.begin(); ite2 != hm.end(); ite2++) { if(ite2->first == max) { cout << ite2->second << " "; break; } } cout << ans1 << endl; return(0); }
a.cc: In function 'int main()': a.cc:23:24: error: 'count' was not declared in this scope; did you mean 'cnt'? 23 | int cnt = (int)count(vec.begin(), vec.end(), now); | ^~~~~ | cnt
s431160230
p00029
C++
#include <iostream> #include <string> #include <vector> #include <utility> #include <algorithm> using namespace std; int main() { int longlen = 0; string str, longstr; vector<pair<int, string> > vc; while (cin >> str) { if((int)strlen(str.c_str()) > longlen){ longlen = strlen(str.c_str()); longstr = str; } bool bl = true; vector<pair<int, string> >::iterator it = vc.begin(); while(it != vc.end()) { if(it->second == str){ it->first--; bl = false; } it++; } if(bl){ vc.push_back(make_pair(0, str)); } } sort(vc.begin(), vc.end()); cout << vc[0].second << " " << longstr << endl; return 0; }
a.cc: In function 'int main()': a.cc:17:25: error: 'strlen' was not declared in this scope 17 | if((int)strlen(str.c_str()) > longlen){ | ^~~~~~ a.cc:6:1: note: 'strlen' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>' 5 | #include <algorithm> +++ |+#include <cstring> 6 |
s747515587
p00029
C++
#include <iostream> #include <string> #include <vector> #include <utility> #include <algorithm> using namespace std; int main() { int longlen = 0; string str, longstr; vector<pair<int, string> > vc; while (cin >> str) { if((int)strlen(str.c_str()) > longlen){ longlen = strlen(str.c_str()); longstr = str; } bool bl = true; vector<pair<int, string> >::iterator it = vc.begin(); while(it != vc.end()) { if(it->second == str){ it->first--; bl = false; } it++; } if(bl){ vc.push_back(make_pair(0, str)); } } sort(vc.begin(), vc.end()); cout << vc[0].second << " " << longstr << endl; return 0; }
a.cc: In function 'int main()': a.cc:17:25: error: 'strlen' was not declared in this scope 17 | if((int)strlen(str.c_str()) > longlen){ | ^~~~~~ a.cc:6:1: note: 'strlen' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>' 5 | #include <algorithm> +++ |+#include <cstring> 6 |
s098691273
p00029
C++
#include<stdio.h> #include<string> #include<iostream> using namespace std; struct ST{string str;int c;int z;}; int main(){ int i=0; string str,sth,stl; struct ST P[1001]; int max=0; while(cin>>str){ P[i].str=str;P[i].c=0;P[i].z=(int)str.size(); i++; } for(int j=0;j<i;j++) for(int k=i-1;k>i;k--) if(P[k-1].str>P[k].str){ struct ST TEM=P[k-1];P[k-1]=P[k];P[k]=TEM; } for(int j=1;j<i;j++) {if(P[j-1].str==P[j].str)P[j].c++; } max=0; for(int j=0;j<i;j++) {if(max<P[j].c)sth=P[j].c;} if(P[j].z>max)stl=P[j].str; cout<<sth<<" "<<stl<<endl; return 0; }
a.cc: In function 'int main()': a.cc:30:6: error: 'j' was not declared in this scope 30 | if(P[j].z>max)stl=P[j].str; | ^
s996769850
p00029
C++
#include<iostream> #include<vector> #include<string> using namespace std; int main(){ string str; string max_len_str; string most_many_str; int most=-1; int i; vector<pair<string, int> > v; string::iterator vi; cin>>str; v.push_back(pair<string, int>(str, 0)); max_len_str == v[0].first; while(cin>>str){ for(i=0;i<v.size();i++){ if(v[i].first == str){ v[i].second++; break; } } if(i==v.size()){ if(max_len_str.size() < strlen(str.c_str())){ max_len_str = str; } v.push_back(pair<string, int>(str, 0)); } } for(i=0;i<v.size();i++){ if(most < v[i].second){ most = v[i].second; most_many_str = v[i].first; } } cout << most_many_str << " " << max_len_str << endl; return 0; }
a.cc: In function 'int main()': a.cc:16:21: warning: ignoring return value of 'bool std::operator==(const __cxx11::basic_string<_CharT, _Traits, _Allocator>&, const __cxx11::basic_string<_CharT, _Traits, _Allocator>&) [with _CharT = char; _Traits = char_traits<char>; _Alloc = allocator<char>]', declared with attribute 'nodiscard' [-Wunused-result] 16 | max_len_str == v[0].first; | ~~~~~~~~~~~~^~~~~~~~~~~~~ In file included from /usr/include/c++/14/string:54, from /usr/include/c++/14/bits/locale_classes.h:40, from /usr/include/c++/14/bits/ios_base.h:41, from /usr/include/c++/14/ios:44, from /usr/include/c++/14/ostream:40, from /usr/include/c++/14/iostream:41, from a.cc:1: /usr/include/c++/14/bits/basic_string.h:3755:5: note: declared here 3755 | operator==(const basic_string<_CharT, _Traits, _Alloc>& __lhs, | ^~~~~~~~ a.cc:25:49: error: 'strlen' was not declared in this scope 25 | if(max_len_str.size() < strlen(str.c_str())){ | ^~~~~~ a.cc:3:1: note: 'strlen' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>' 2 | #include<vector> +++ |+#include <cstring> 3 | #include<string>
s303153106
p00029
C++
a=[],m=l=0,n=c='';require("fs").readFileSync("/dev/stdin","utf8").trim().split(' ').map(function(i){a[i]?++a[i]>m?m=a[n=i]:0:a[i]=1;(t=i.length)>l?(c=i,l=t):0});console.log(n+' '+c)
a.cc:1:16: error: empty character constant 1 | a=[],m=l=0,n=c='';require("fs").readFileSync("/dev/stdin","utf8").trim().split(' ').map(function(i){a[i]?++a[i]>m?m=a[n=i]:0:a[i]=1;(t=i.length)>l?(c=i,l=t):0});console.log(n+' '+c) | ^~ a.cc:1:1: error: 'a' does not name a type 1 | a=[],m=l=0,n=c='';require("fs").readFileSync("/dev/stdin","utf8").trim().split(' ').map(function(i){a[i]?++a[i]>m?m=a[n=i]:0:a[i]=1;(t=i.length)>l?(c=i,l=t):0});console.log(n+' '+c) | ^ a.cc:1:26: error: expected constructor, destructor, or type conversion before '(' token 1 | a=[],m=l=0,n=c='';require("fs").readFileSync("/dev/stdin","utf8").trim().split(' ').map(function(i){a[i]?++a[i]>m?m=a[n=i]:0:a[i]=1;(t=i.length)>l?(c=i,l=t):0});console.log(n+' '+c) | ^ a.cc:1:160: error: expected unqualified-id before ')' token 1 | a=[],m=l=0,n=c='';require("fs").readFileSync("/dev/stdin","utf8").trim().split(' ').map(function(i){a[i]?++a[i]>m?m=a[n=i]:0:a[i]=1;(t=i.length)>l?(c=i,l=t):0});console.log(n+' '+c) | ^ a.cc:1:162: error: 'console' does not name a type; did you mean 'const'? 1 | a=[],m=l=0,n=c='';require("fs").readFileSync("/dev/stdin","utf8").trim().split(' ').map(function(i){a[i]?++a[i]>m?m=a[n=i]:0:a[i]=1;(t=i.length)>l?(c=i,l=t):0});console.log(n+' '+c) | ^~~~~~~ | const
s033123688
p00029
C++
a=[],m=l=0,n=c='';require("fs").readFileSync("/dev/stdin","utf8").trim().split(' ').map(function(i){a[i]?++a[i]>m?m=a[n=i]:0:a[i]=1;(t=i.length)>l?(c=i,l=t):0});console.log(n+' '+c)
a.cc:1:16: error: empty character constant 1 | a=[],m=l=0,n=c='';require("fs").readFileSync("/dev/stdin","utf8").trim().split(' ').map(function(i){a[i]?++a[i]>m?m=a[n=i]:0:a[i]=1;(t=i.length)>l?(c=i,l=t):0});console.log(n+' '+c) | ^~ a.cc:1:1: error: 'a' does not name a type 1 | a=[],m=l=0,n=c='';require("fs").readFileSync("/dev/stdin","utf8").trim().split(' ').map(function(i){a[i]?++a[i]>m?m=a[n=i]:0:a[i]=1;(t=i.length)>l?(c=i,l=t):0});console.log(n+' '+c) | ^ a.cc:1:26: error: expected constructor, destructor, or type conversion before '(' token 1 | a=[],m=l=0,n=c='';require("fs").readFileSync("/dev/stdin","utf8").trim().split(' ').map(function(i){a[i]?++a[i]>m?m=a[n=i]:0:a[i]=1;(t=i.length)>l?(c=i,l=t):0});console.log(n+' '+c) | ^ a.cc:1:160: error: expected unqualified-id before ')' token 1 | a=[],m=l=0,n=c='';require("fs").readFileSync("/dev/stdin","utf8").trim().split(' ').map(function(i){a[i]?++a[i]>m?m=a[n=i]:0:a[i]=1;(t=i.length)>l?(c=i,l=t):0});console.log(n+' '+c) | ^ a.cc:1:162: error: 'console' does not name a type; did you mean 'const'? 1 | a=[],m=l=0,n=c='';require("fs").readFileSync("/dev/stdin","utf8").trim().split(' ').map(function(i){a[i]?++a[i]>m?m=a[n=i]:0:a[i]=1;(t=i.length)>l?(c=i,l=t):0});console.log(n+' '+c) | ^~~~~~~ | const
s641241067
p00029
C++
a=[],m=l=0,n=c='';require("fs").readFileSync("/dev/stdin","utf8").trim().split(' ').map(function(i){a[i]?++a[i]>m?m=a[n=i]:0:a[i]=1;(t=i.length)>l?(c=i,l=t):0});console.log(n+' '+c)
a.cc:1:16: error: empty character constant 1 | a=[],m=l=0,n=c='';require("fs").readFileSync("/dev/stdin","utf8").trim().split(' ').map(function(i){a[i]?++a[i]>m?m=a[n=i]:0:a[i]=1;(t=i.length)>l?(c=i,l=t):0});console.log(n+' '+c) | ^~ a.cc:1:1: error: 'a' does not name a type 1 | a=[],m=l=0,n=c='';require("fs").readFileSync("/dev/stdin","utf8").trim().split(' ').map(function(i){a[i]?++a[i]>m?m=a[n=i]:0:a[i]=1;(t=i.length)>l?(c=i,l=t):0});console.log(n+' '+c) | ^ a.cc:1:26: error: expected constructor, destructor, or type conversion before '(' token 1 | a=[],m=l=0,n=c='';require("fs").readFileSync("/dev/stdin","utf8").trim().split(' ').map(function(i){a[i]?++a[i]>m?m=a[n=i]:0:a[i]=1;(t=i.length)>l?(c=i,l=t):0});console.log(n+' '+c) | ^ a.cc:1:160: error: expected unqualified-id before ')' token 1 | a=[],m=l=0,n=c='';require("fs").readFileSync("/dev/stdin","utf8").trim().split(' ').map(function(i){a[i]?++a[i]>m?m=a[n=i]:0:a[i]=1;(t=i.length)>l?(c=i,l=t):0});console.log(n+' '+c) | ^ a.cc:1:162: error: 'console' does not name a type; did you mean 'const'? 1 | a=[],m=l=0,n=c='';require("fs").readFileSync("/dev/stdin","utf8").trim().split(' ').map(function(i){a[i]?++a[i]>m?m=a[n=i]:0:a[i]=1;(t=i.length)>l?(c=i,l=t):0});console.log(n+' '+c) | ^~~~~~~ | const
s084536252
p00029
C++
#include <iostream> using namespace std; int main(){ char str[1000]; char word[33][33]={0}; int longest=0; int check[33]={0}; char *tmp; int freq=0; int count=0; int i,j; size_t len , prev; fgets(str , sizeof(str) , stdin); tmp=str; for(i=0 ; str[i]!='\0' ;i++){ if(str[i]==' '){ str[i]='\0'; strcpy((char*)&word[count] , (const char*)tmp); tmp=str+i+1; count++; } } strcpy((char*)&word[count],(const char*)tmp); count++; for(i=0 ; i<count ; i++){ for(j=i ; j<count ; j++){ if(strcmp((const char*)&word[i] , (const char*)&word[j])==0){ check[i]++; } } } for(i=count; i>=0 ; i--){ for(j=0 ; j<i-1 ; j++){ if(check[j]>check[j+1]){ check[j]^=check[j+1]; check[j+1]^=check[j]; check[j]^=check[j+1]; freq=j; } } } prev=strlen(word[0]); for (i=0 ; i<count ; i++){ len=strlen(word[i]); if(len > prev){ prev = len; longest=i; } } cout << (char*)&(word[freq]) << " "<< (char*)&(word[longest]) << endl; return 0; }
a.cc: In function 'int main()': a.cc:19:33: error: 'strcpy' was not declared in this scope 19 | strcpy((char*)&word[count] , (const char*)tmp); | ^~~~~~ a.cc:2:1: note: 'strcpy' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>' 1 | #include <iostream> +++ |+#include <cstring> 2 | using namespace std; a.cc:24:17: error: 'strcpy' was not declared in this scope 24 | strcpy((char*)&word[count],(const char*)tmp); | ^~~~~~ a.cc:24:17: note: 'strcpy' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>' a.cc:28:28: error: 'strcmp' was not declared in this scope 28 | if(strcmp((const char*)&word[i] , (const char*)&word[j])==0){ | ^~~~~~ a.cc:28:28: note: 'strcmp' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>' a.cc:43:22: error: 'strlen' was not declared in this scope 43 | prev=strlen(word[0]); | ^~~~~~ a.cc:43:22: note: 'strlen' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
s715112868
p00029
C++
int main(){ char str[1000]; char word[33][33]={0}; int longest=0; int check[33]={0}; char *tmp; int freq=0; int count=0; int i,j; size_t len , prev; fgets(str , sizeof(str) , stdin); tmp=str; for(i=0 ; str[i]!='\0' ;i++){ if(str[i]==' '){ str[i]='\0'; strcpy((char*)&word[count] , (const char*)tmp); tmp=str+i+1; count++; } } strcpy((char*)&word[count],(const char*)tmp); count++; for(i=0 ; i<count ; i++){ for(j=i ; j<count ; j++){ if(strcmp((const char*)&word[i] , (const char*)&word[j])==0){ check[i]++; } } } for(i=0 ; i<count-1 ; i++){ if(check[freq]<check[i+1]){ freq=i+1; } } prev=strlen(word[0]); for (i=0 ; i<count ; i++){ len=strlen(word[i]); if(len > prev){ prev = len; longest=i; } } cout << (char*)&(word[freq]) << " "<< (char*)&(word[longest]); return 0; }
a.cc: In function 'int main()': a.cc:10:9: error: 'size_t' was not declared in this scope 10 | size_t len , prev; | ^~~~~~ a.cc:1:1: note: 'size_t' is defined in header '<cstddef>'; this is probably fixable by adding '#include <cstddef>' +++ |+#include <cstddef> 1 | int main(){ a.cc:11:35: error: 'stdin' was not declared in this scope 11 | fgets(str , sizeof(str) , stdin); | ^~~~~ a.cc:1:1: note: 'stdin' is defined in header '<cstdio>'; this is probably fixable by adding '#include <cstdio>' +++ |+#include <cstdio> 1 | int main(){ a.cc:11:9: error: 'fgets' was not declared in this scope 11 | fgets(str , sizeof(str) , stdin); | ^~~~~ a.cc:16:33: error: 'strcpy' was not declared in this scope 16 | strcpy((char*)&word[count] , (const char*)tmp); | ^~~~~~ a.cc:1:1: note: 'strcpy' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>' +++ |+#include <cstring> 1 | int main(){ a.cc:21:17: error: 'strcpy' was not declared in this scope 21 | strcpy((char*)&word[count],(const char*)tmp); | ^~~~~~ a.cc:21:17: note: 'strcpy' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>' a.cc:25:28: error: 'strcmp' was not declared in this scope 25 | if(strcmp((const char*)&word[i] , (const char*)&word[j])==0){ | ^~~~~~ a.cc:25:28: note: 'strcmp' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>' a.cc:35:17: error: 'prev' was not declared in this scope 35 | prev=strlen(word[0]); | ^~~~ a.cc:35:22: error: 'strlen' was not declared in this scope 35 | prev=strlen(word[0]); | ^~~~~~ a.cc:35:22: note: 'strlen' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>' a.cc:37:17: error: 'len' was not declared in this scope 37 | len=strlen(word[i]); | ^~~ a.cc:43:9: error: 'cout' was not declared in this scope; did you mean 'count'? 43 | cout << (char*)&(word[freq]) << " "<< (char*)&(word[longest]); | ^~~~ | count
s008483254
p00029
C++
#include <iostream> #include <string> using namespace std; int main(){ string sent; string word[500]; int a[500]={}; int i,j,k,l; int n,m,len; i=0; while(cin>>sent){ if(i==0){ //???????????????????????? word[0]=sent; a[0]++; i++; len=sent.size(); n=0; } else { if(len<sent.size()){ //?????????????????????????????°??´??° len=sent.size(); n=i; } for(j=0; j<i; j++){ if(sent==word[j]){???//?????§???????????????????????? a[j]++; break; } if(j==i-1){ //??°????????????????????? word[i]=sent; a[i]++; i++; break; } } } } m=0; for(j=0; j<i; j++){??? //???????????????????????????????????? if(m<a[j])m=j; } cout<<word[m]<<" "<<word[n]<<endl; // for(j=0; j<i; j++){ // cout<<word[j]<<":"<<a[j]<<endl; // } //cout<<"len:"<<len<<" "<<word[n]<<endl; return 0; }
a.cc:27:52: warning: trigraph ??/ ignored, use -trigraphs to enable [-Wtrigraphs] 27 | if(sent==word[j]){???//?????§???????????????????????? a.cc: In function 'int main()': a.cc:27:51: error: expected primary-expression before '?' token 27 | if(sent==word[j]){???//?????§???????????????????????? | ^ a.cc:27:52: error: expected primary-expression before '?' token 27 | if(sent==word[j]){???//?????§???????????????????????? | ^ a.cc:27:53: error: expected primary-expression before '?' token 27 | if(sent==word[j]){???//?????§???????????????????????? | ^ a.cc:28:47: error: expected ':' before ';' token 28 | a[j]++; | ^ | : a.cc:28:47: error: expected primary-expression before ';' token a.cc:28:47: error: expected ':' before ';' token 28 | a[j]++; | ^ | : a.cc:28:47: error: expected primary-expression before ';' token a.cc:28:47: error: expected ':' before ';' token 28 | a[j]++; | ^ | : a.cc:28:47: error: expected primary-expression before ';' token a.cc:41:28: error: expected primary-expression before '?' token 41 | for(j=0; j<i; j++){??? //???????????????????????????????????? | ^ a.cc:41:29: error: expected primary-expression before '?' token 41 | for(j=0; j<i; j++){??? //???????????????????????????????????? | ^ a.cc:41:30: error: expected primary-expression before '?' token 41 | for(j=0; j<i; j++){??? //???????????????????????????????????? | ^ a.cc:42:17: error: expected primary-expression before 'if' 42 | if(m<a[j])m=j; | ^~ a.cc:41:32: error: expected ':' before 'if' 41 | for(j=0; j<i; j++){??? //???????????????????????????????????? | ^~ | : 42 | if(m<a[j])m=j; | ~~ a.cc:42:17: error: expected primary-expression before 'if' 42 | if(m<a[j])m=j; | ^~ a.cc:41:32: error: expected ':' before 'if' 41 | for(j=0; j<i; j++){??? //???????????????????????????????????? | ^~ | : 42 | if(m<a[j])m=j; | ~~ a.cc:42:17: error: expected primary-expression before 'if' 42 | if(m<a[j])m=j; | ^~ a.cc:41:32: error: expected ':' before 'if' 41 | for(j=0; j<i; j++){??? //???????????????????????????????????? | ^~ | : 42 | if(m<a[j])m=j; | ~~ a.cc:42:17: error: expected primary-expression before 'if' 42 | if(m<a[j])m=j; | ^~
s380368834
p00029
C++
import java.util.ArrayList; import java.util.Arrays; import java.util.Collections; import java.util.Comparator; import java.util.HashMap; import java.util.HashSet; import java.util.List; import java.util.Map; import java.util.Scanner; class Main { public static void main(String[] args) { Scanner sc = null; try { sc = new Scanner(System.in); // ??\??? while (sc.hasNextLine()) { String[] sentence = sc.nextLine().split(" "); // ???????????????1????????????????????¢??? Main main = new Main(); String frequencyWord = main.maxFrequency(sentence); // ????????????????????????????????¢??? String longWord = main.maxLong(sentence); // ???????????? System.out.println(frequencyWord + " " + longWord); } } finally { sc.close(); } } // value?????????????????§??????key????????? public String maxFrequency(String[] s) { Map<String, Integer> frequency = new HashMap<String, Integer>(); for (String word : s) { int count = 1; if (frequency.containsKey(word)) { count += frequency.get(word); } frequency.put(word, count); } return valueSort(frequency).get(0).getKey(); } // public String maxLong(String[] str) { // ??????????????????????????????List?????\?????? List<String> list = new ArrayList<String>(new HashSet<String>( Arrays.asList(str))); String max = new String(); for (String s : list) { if (max.length() < s.length()) { max = s; } } return max; } // Map???value??§????????????????????? private List<Map.Entry<String, Integer>> valueSort(Map<String, Integer> map) { List<Map.Entry<String, Integer>> list = new ArrayList<Map.Entry<String, Integer>>( map.entrySet()); Collections.sort(list, new Comparator<Map.Entry<String, Integer>>() { public int compare(Map.Entry<String, Integer> map1, Map.Entry<String, Integer> map2) { return map2.getValue().compareTo(map1.getValue()); } }); return list; } }
a.cc:1:1: error: 'import' does not name a type 1 | import java.util.ArrayList; | ^~~~~~ a.cc:1:1: note: C++20 'import' only available with '-fmodules-ts' a.cc:2:1: error: 'import' does not name a type 2 | import java.util.Arrays; | ^~~~~~ a.cc:2:1: note: C++20 'import' only available with '-fmodules-ts' a.cc:3:1: error: 'import' does not name a type 3 | import java.util.Collections; | ^~~~~~ a.cc:3:1: note: C++20 'import' only available with '-fmodules-ts' a.cc:4:1: error: 'import' does not name a type 4 | import java.util.Comparator; | ^~~~~~ a.cc:4:1: note: C++20 'import' only available with '-fmodules-ts' a.cc:5:1: error: 'import' does not name a type 5 | import java.util.HashMap; | ^~~~~~ a.cc:5:1: note: C++20 'import' only available with '-fmodules-ts' a.cc:6:1: error: 'import' does not name a type 6 | import java.util.HashSet; | ^~~~~~ a.cc:6:1: note: C++20 'import' only available with '-fmodules-ts' a.cc:7:1: error: 'import' does not name a type 7 | import java.util.List; | ^~~~~~ a.cc:7:1: note: C++20 'import' only available with '-fmodules-ts' a.cc:8:1: error: 'import' does not name a type 8 | import java.util.Map; | ^~~~~~ a.cc:8:1: note: C++20 'import' only available with '-fmodules-ts' a.cc:9:1: error: 'import' does not name a type 9 | import java.util.Scanner; | ^~~~~~ a.cc:9:1: note: C++20 'import' only available with '-fmodules-ts' a.cc:13:15: error: expected ':' before 'static' 13 | public static void main(String[] args) { | ^~~~~~~ | : a.cc:13:33: error: 'String' has not been declared 13 | public static void main(String[] args) { | ^~~~~~ a.cc:13:42: error: expected ',' or '...' before 'args' 13 | public static void main(String[] args) { | ^~~~ a.cc:40:15: error: expected ':' before 'String' 40 | public String maxFrequency(String[] s) { | ^~~~~~~ | : a.cc:40:16: error: 'String' does not name a type 40 | public String maxFrequency(String[] s) { | ^~~~~~ a.cc:55:15: error: expected ':' before 'String' 55 | public String maxLong(String[] str) { | ^~~~~~~ | : a.cc:55:16: error: 'String' does not name a type 55 | public String maxLong(String[] str) { | ^~~~~~ a.cc:70:16: error: expected ':' before 'List' 70 | private List<Map.Entry<String, Integer>> valueSort(Map<String, Integer> map) { | ^~~~~ | : a.cc:70:17: error: 'List' does not name a type 70 | private List<Map.Entry<String, Integer>> valueSort(Map<String, Integer> map) { | ^~~~ a.cc:81:2: error: expected ';' after class definition 81 | } | ^ | ; a.cc: In static member function 'static void Main::main(int*)': a.cc:15:17: error: 'Scanner' was not declared in this scope 15 | Scanner sc = null; | ^~~~~~~ a.cc:17:25: error: 'sc' was not declared in this scope 17 | sc = new Scanner(System.in); | ^~ a.cc:17:34: error: expected type-specifier before 'Scanner' 17 | sc = new Scanner(System.in); | ^~~~~~~ a.cc:21:33: error: 'String' was not declared in this scope 21 | String[] sentence = sc.nextLine().split(" "); | ^~~~~~ a.cc:21:40: error: expected primary-expression before ']' token 21 | String[] sentence = sc.nextLine().split(" "); | ^ a.cc:24:45: error: conversion from 'Main*' to non-scalar type 'Main' requested 24 | Main main = new Main(); | ^~~~~~~~~~ a.cc:25:40: error: expected ';' before 'frequencyWord' 25 | String frequencyWord = main.maxFrequency(sentence); | ^~~~~~~~~~~~~ a.cc:28:40: error: expected ';' before 'longWord' 28 | String longWord = main.maxLong(sentence); | ^~~~~~~~ a.cc:31:33: error: 'System' was not declared in this scope 31 | System.out.println(frequencyWord + " " + longWord); | ^~~~~~ a.cc:31:52: error: 'frequencyWord' was not declared in this scope 31 | System.out.println(frequencyWord + " " + longWord); | ^~~~~~~~~~~~~ a.cc:31:74: error: 'longWord' was not declared in this scope 31 | System.out.println(frequencyWord + " " + longWord); | ^~~~~~~~ a.cc:34:19: error: expected 'catch' before 'finally' 34 | } finally { | ^~~~~~~ a.cc:34:19: error: expected '(' before 'finally' a.cc:34:19: error: 'finally' does not name a type a.cc:34:27: error: expected ')' before '{' token 34 | } finally { | ^ a.cc:34:19: note: to match this '(' 34 | } finally { | ^~~~~~~ a.cc:35:25: error: 'sc' was not declared in this scope 35 | sc.close(); | ^~
s084338421
p00029
C++
#include<iostream> #include<string> #include<algorithm> #include<map> #include<set> #include<utility> #include<vector> #include<cmath> #include<cstring> #include<cstdio> #include<time.h> #define loop(i,a,b) for(int i=a;i<b;i++) #define rep(i,a) loop(i,0,a) #define pb push_back #define mp make_pair #define all(in) in.begin(),in.end() const double PI=acos(-1); const double EPS=1e-10; const int inf=1e8; using namespace std; typedef long long ll; typedef vector<int> vi; vector<vector<char> >tmp; vector<vector<int> >scr; int main(){ string s; string nagai; int naga=-1; map<string,int>m; while(cin>>s){ if(naga<s.size()){naga=s.size();nagai=s;} m[s]++; } int ma=-1; string mas; map<string,int>::iterator it=m.begin(); for(;it<m.end();it++){ string t=it->first; if(ma<m[t]){ma=m[t];mas=t;} } cout<<mas<<" "<<nagai<<endl; }
a.cc: In function 'int main()': a.cc:37:16: error: no match for 'operator<' (operand types are 'std::map<std::__cxx11::basic_string<char>, int>::iterator' {aka 'std::_Rb_tree<std::__cxx11::basic_string<char>, std::pair<const std::__cxx11::basic_string<char>, int>, std::_Select1st<std::pair<const std::__cxx11::basic_string<char>, int> >, std::less<std::__cxx11::basic_string<char> >, std::allocator<std::pair<const std::__cxx11::basic_string<char>, int> > >::iterator'} and 'std::map<std::__cxx11::basic_string<char>, int>::iterator' {aka 'std::_Rb_tree<std::__cxx11::basic_string<char>, std::pair<const std::__cxx11::basic_string<char>, int>, std::_Select1st<std::pair<const std::__cxx11::basic_string<char>, int> >, std::less<std::__cxx11::basic_string<char> >, std::allocator<std::pair<const std::__cxx11::basic_string<char>, int> > >::iterator'}) 37 | for(;it<m.end();it++){ | ~~^~~~~~~~ | | | | | _Rb_tree_iterator<[...]> | _Rb_tree_iterator<[...]> In file included from /usr/include/c++/14/string:48, from /usr/include/c++/14/bits/locale_classes.h:40, from /usr/include/c++/14/bits/ios_base.h:41, from /usr/include/c++/14/ios:44, from /usr/include/c++/14/ostream:40, from /usr/include/c++/14/iostream:41, from a.cc:1: /usr/include/c++/14/bits/stl_iterator.h:448:5: note: candidate: 'template<class _Iterator> constexpr bool std::operator<(const reverse_iterator<_Iterator>&, const reverse_iterator<_Iterator>&)' 448 | operator<(const reverse_iterator<_Iterator>& __x, | ^~~~~~~~ /usr/include/c++/14/bits/stl_iterator.h:448:5: note: template argument deduction/substitution failed: a.cc:37:23: note: 'std::map<std::__cxx11::basic_string<char>, int>::iterator' {aka 'std::_Rb_tree<std::__cxx11::basic_string<char>, std::pair<const std::__cxx11::basic_string<char>, int>, std::_Select1st<std::pair<const std::__cxx11::basic_string<char>, int> >, std::less<std::__cxx11::basic_string<char> >, std::allocator<std::pair<const std::__cxx11::basic_string<char>, int> > >::iterator'} is not derived from 'const std::reverse_iterator<_Iterator>' 37 | for(;it<m.end();it++){ | ^ /usr/include/c++/14/bits/stl_iterator.h:493:5: note: candidate: 'template<class _IteratorL, class _IteratorR> constexpr bool std::operator<(const reverse_iterator<_Iterator>&, const reverse_iterator<_IteratorR>&)' 493 | operator<(const reverse_iterator<_IteratorL>& __x, | ^~~~~~~~ /usr/include/c++/14/bits/stl_iterator.h:493:5: note: template argument deduction/substitution failed: a.cc:37:23: note: 'std::map<std::__cxx11::basic_string<char>, int>::iterator' {aka 'std::_Rb_tree<std::__cxx11::basic_string<char>, std::pair<const std::__cxx11::basic_string<char>, int>, std::_Select1st<std::pair<const std::__cxx11::basic_string<char>, int> >, std::less<std::__cxx11::basic_string<char> >, std::allocator<std::pair<const std::__cxx11::basic_string<char>, int> > >::iterator'} is not derived from 'const std::reverse_iterator<_Iterator>' 37 | for(;it<m.end();it++){ | ^ /usr/include/c++/14/bits/stl_iterator.h:1694:5: note: candidate: 'template<class _IteratorL, class _IteratorR> constexpr bool std::operator<(const move_iterator<_IteratorL>&, const move_iterator<_IteratorR>&)' 1694 | operator<(const move_iterator<_IteratorL>& __x, | ^~~~~~~~ /usr/include/c++/14/bits/stl_iterator.h:1694:5: note: template argument deduction/substitution failed: a.cc:37:23: note: 'std::map<std::__cxx11::basic_string<char>, int>::iterator' {aka 'std::_Rb_tree<std::__cxx11::basic_string<char>, std::pair<const std::__cxx11::basic_string<char>, int>, std::_Select1st<std::pair<const std::__cxx11::basic_string<char>, int> >, std::less<std::__cxx11::basic_string<char> >, std::allocator<std::pair<const std::__cxx11::basic_string<char>, int> > >::iterator'} is not derived from 'const std::move_iterator<_IteratorL>' 37 | for(;it<m.end();it++){ | ^ /usr/include/c++/14/bits/stl_iterator.h:1760:5: note: candidate: 'template<class _Iterator> constexpr bool std::operator<(const move_iterator<_IteratorL>&, const move_iterator<_IteratorL>&)' 1760 | operator<(const move_iterator<_Iterator>& __x, | ^~~~~~~~ /usr/include/c++/14/bits/stl_iterator.h:1760:5: note: template argument deduction/substitution failed: a.cc:37:23: note: 'std::map<std::__cxx11::basic_string<char>, int>::iterator' {aka 'std::_Rb_tree<std::__cxx11::basic_string<char>, std::pair<const std::__cxx11::basic_string<char>, int>, std::_Select1st<std::pair<const std::__cxx11::basic_string<char>, int> >, std::less<std::__cxx11::basic_string<char> >, std::allocator<std::pair<const std::__cxx11::basic_string<char>, int> > >::iterator'} is not derived from 'const std::move_iterator<_IteratorL>' 37 | for(;it<m.end();it++){ | ^ In file included from /usr/include/c++/14/bits/stl_algobase.h:64, from /usr/include/c++/14/string:51: /usr/include/c++/14/bits/stl_pair.h:1045:5: note: candidate: 'template<class _T1, class _T2> constexpr bool std::operator<(const pair<_T1, _T2>&, const pair<_T1, _T2>&)' 1045 | operator<(const pair<_T1, _T2>& __x, const pair<_T1, _T2>& __y) | ^~~~~~~~ /usr/include/c++/14/bits/stl_pair.h:1045:5: note: template argument deduction/substitution failed: a.cc:37:23: note: 'std::map<std::__cxx11::basic_string<char>, int>::iterator' {aka 'std::_Rb_tree<std::__cxx11::basic_string<char>, std::pair<const std::__cxx11::basic_string<char>, int>, std::_Select1st<std::pair<const std::__cxx11::basic_string<char>, int> >, std::less<std::__cxx11::basic_string<char> >, std::allocator<std::pair<const std::__cxx11::basic_string<char>, int> > >::iterator'} is not derived from 'const std::pair<_T1, _T2>' 37 | for(;it<m.end();it++){ | ^ In file included from /usr/include/c++/14/bits/basic_string.h:47, from /usr/include/c++/14/string:54: /usr/include/c++/14/string_view:673:5: note: candidate: 'template<class _CharT, class _Traits> constexpr bool std::operator<(basic_string_view<_CharT, _Traits>, basic_string_view<_CharT, _Traits>)' 673 | operator< (basic_string_view<_CharT, _Traits> __x, | ^~~~~~~~ /usr/include/c++/14/string_view:673:5: note: template argument deduction/substitution failed: a.cc:37:23: note: 'std::_Rb_tree_iterator<std::pair<const std::__cxx11::basic_string<char>, int> >' is not derived from 'std::basic_string_view<_CharT, _Traits>' 37 | for(;it<m.end();it++){ | ^ /usr/include/c++/14/string_view:680:5: note: candidate: 'template<class _CharT, class _Traits> constexpr bool std::operator<(basic_string_view<_CharT, _Traits>, __type_identity_t<basic_string_view<_CharT, _Traits> >)' 680 | operator< (basic_string_view<_CharT, _Traits> __x, | ^~~~~~~~ /usr/include/c++/14/string_view:680:5: note: template argument deduction/substitution failed: a.cc:37:23: note: 'std::_Rb_tree_iterator<std::pair<const std::__cxx11::basic_string<char>, int> >' is not derived from 'std::basic_string_view<_CharT, _Traits>' 37 | for(;it<m.end();it++){ | ^ /usr/include/c++/14/string_view:688:5: note: candidate: 'template<class _CharT, class _Traits> constexpr bool std::operator<(__type_identity_t<basic_string_view<_CharT, _Traits> >, basic_string_view<_CharT, _Traits>)' 688 | operator< (__type_identity_t<basic_string_view<_CharT, _Traits>> __x, | ^~~~~~~~ /usr/include/c++/14/string_view:688:5: note: template argument deduction/substitution failed: a.cc:37:23: note: 'std::_Rb_tree_iterator<std::pair<const std::__cxx11::basic_string<char>, int> >' is not derived from 'std::basic_string_view<_CharT, _Traits>' 37 | for(;it<m.end();it++){ | ^ /usr/include/c++/14/bits/basic_string.h:3874:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> bool std::operator<(const __cxx11::basic_string<_CharT, _Traits, _Allocator>&, const __cxx11::basic_string<_CharT, _Traits, _Allocator>&)' 3874 | operator<(const basic_string<_CharT, _Traits, _Alloc>& __lhs, | ^~~~~~~~ /usr/include/c++/14/bits/basic_string.h:3874:5: note: template argument deduction/substitution failed: a.cc:37:23: note: 'std::map<std::__cxx11::basic_string<char>, int>::iterator' {aka 'std::_Rb_tree<std::__cxx11::basic_string<char>, std::pair<const std::__cxx11::basic_string<char>, int>, std::_Select1st<std::pair<const std::__cxx11::basic_string<char>, int> >, std::less<std::__cxx11::basic_string<char> >, std::allocator<std::pair<const std::__cxx11::basic_string<char>, int> > >::iterator'} is not derived from 'const std::__cxx11::basic_string<_CharT, _Traits, _Allocator>' 37 | for(;it<m.end();it++){ | ^ /usr/include/c++/14/bits/basic_string.h:3888:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> bool std::operator<(const __cxx11::basic_string<_CharT, _Traits, _Allocator>&, const _CharT*)' 3888 | operator<(const basic_string<_CharT, _Traits, _Alloc>& __lhs, | ^~~~~~~~ /usr/include/c++/14/bits/basic_string.h:3888:5: note: template argument deduction/substitution failed: a.cc:37:23: note: 'std::map<std::__cxx11::basic_string<char>, int>::iterator' {aka 'std::_Rb_tree<std::__cxx11::basic_string<char>, std::pair<const std::__cxx11::basic_string<char>, int>, std::_Select1st<std::pair<const std::__cxx11::basic_string<char>, int> >, std::less<std::__cxx11::basic_string<char> >, std::allocator<std::pair<const std::__cxx11::basic_string<char>, int> > >::iterator'} is not derived from 'const std::__cxx11::basic_string<_CharT, _Traits, _Allocator>' 37 | for(;it<m.end();it++){ | ^ /usr/include/c++/14/bits/basic_string.h:3901:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> bool std::operator<(const _CharT*, const __
s750239684
p00029
C++
#include <algorithm> #include <cmath> #include <climits> #include <cstdio> #include <cstdlib> #include <cstring> #include <fstream> #include <iostream> #include <list> #include <map> #include <queue> #include <set> #include <sstream> #include <stack> #include <string> #include <vector> #include <cassert> #include <functional> using namespace std; #define LOG(...) printf(__VA_ARGS__) //#define LOG(...) #define FOR(i,a,b) for(int i=(int)(a);i<(int)(b);++i) #define REP(i,n) for(int i=0;i<(int)(n);++i) #define ALL(a) (a).begin(),(a).end() #define RALL(a) (a).rbegin(),(a).rend() #define EXIST(s,e) ((s).find(e)!=(s).end()) #define SORT(c) sort((c).begin(),(c).end()) #define RSORT(c) sort((c).rbegin(),(c).rend()) #define CLR(a) memset((a), 0 ,sizeof(a)) typedef long long ll; typedef unsigned long long ull; typedef vector<bool> vb; typedef vector<int> vi; typedef vector<ll> vll; typedef vector<vb> vvb; typedef vector<vi> vvi; typedef vector<vll> vvll; typedef pair<int, int> pii; typedef pair<ll, ll> pll; const int dx[] = { -1, 0, 1, 0 }; const int dy[] = { 0, 1, 0, -1 }; int main() { map<string,int> msi; string s; int ma=0; int ma2=0; string ans; string ans2; while (cin >> s,){ if (!EXIST(msi,s)) msi[s]=1; else{ msi[s] = msi[s]+1; if (ma2<msi[s]){ ans2=s; ma2 = msi[s]; } } if (ma < s.length()){ ans=s; ma = s.length(); } } cout << ans2 << " "<<ans<<endl; return 0; }
a.cc: In function 'int main()': a.cc:53:17: error: expected primary-expression before ')' token 53 | while (cin >> s,){ | ^
s927971612
p00029
C++
<?php $line = strtolower(trim(fgets(STDIN))); $arr = explode(" ", $line); $maxword = ""; $maxlenword = ""; $hash = array(); foreach($arr as $word){ $hash[$word]++; if($hash[$maxword] < $hash[$word]){ $maxword = $word; } if(strlen($maxlenword) < strlen($word)){ $maxlenword = $word; } } echo "{$maxword} {$maxlenword}\n";
a.cc:1:1: error: expected unqualified-id before '<' token 1 | <?php | ^ a.cc:4:1: error: '$arr' does not name a type 4 | $arr = explode(" ", $line); | ^~~~ a.cc:6:1: error: '$maxword' does not name a type 6 | $maxword = ""; | ^~~~~~~~ a.cc:7:1: error: '$maxlenword' does not name a type 7 | $maxlenword = ""; | ^~~~~~~~~~~ a.cc:8:1: error: '$hash' does not name a type 8 | $hash = array(); | ^~~~~ a.cc:9:8: error: expected constructor, destructor, or type conversion before '(' token 9 | foreach($arr as $word){ | ^ a.cc:20:1: error: 'echo' does not name a type 20 | echo "{$maxword} {$maxlenword}\n"; | ^~~~
s382258241
p00029
C++
#include<iostream> #include<string> #include<map> using namespace std; map<string, int> table; int main() { string word, frequent, longest; size_t N = 0; while (cin >> word) { table[word]++; if (N < table[word]) { N = table[word]; frequent = word; } if (word.size>longest.size) longest = word; } cout << frequent << " " << longest << endl; return 0; }
a.cc: In function 'int main()': a.cc:20:18: 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 '()' ?) 20 | if (word.size>longest.size) | ~~~~~^~~~ | () a.cc:20:31: 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 '()' ?) 20 | if (word.size>longest.size) | ~~~~~~~~^~~~ | ()
s032392783
p00029
C++
#include<iostream> #include<vector> #include<map> #include<string> using namespace std; int main() { string word,frequent,longest; map<string,int> table; size_t N=0; while(cin >> word){ table[word] += 1; N =table[word] < N ? N : table[word]; frequent = table[word] < N ? frequent : word; logest = word.size() < longest.size ? longest : word; } cout << frequent << " " << longest << endl; }
a.cc: In function 'int main()': a.cc:15:5: error: 'logest' was not declared in this scope; did you mean 'longest'? 15 | logest = word.size() < longest.size ? longest : word; | ^~~~~~ | longest a.cc:15:36: 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 '()' ?) 15 | logest = word.size() < longest.size ? longest : word; | ~~~~~~~~^~~~ | ()
s410732202
p00029
C++
#include<bits/stdc++.h> using namespace std; typedef pair<string,int> p; vector <p> ls(0); int find(string s){ for(int i=0; i<(int)ls.size(); i++){ if(s==ls[i])return true; } return -1; } int main(){ string in; int max=0,indx=0; string maxs=""; while(cin>>in){ int tmp=find(in); if(tmp==-1){ ls.push_back( p(in,1) ); if(in.size()>maxs.size()){ maxs = in;} } else{ ls[tmp].second++; if(ls[tmp].second>max){ max=ls[tmp].second; indx = tmp; } } } cout << ls[indx] << " " << maxs << endl; return 0; }
a.cc: In function 'int find(std::string)': a.cc:11:9: error: no match for 'operator==' (operand types are 'std::string' {aka 'std::__cxx11::basic_string<char>'} and '__gnu_cxx::__alloc_traits<std::allocator<std::pair<std::__cxx11::basic_string<char>, int> >, std::pair<std::__cxx11::basic_string<char>, int> >::value_type' {aka 'std::pair<std::__cxx11::basic_string<char>, int>'}) 11 | if(s==ls[i])return true; In file included from /usr/include/c++/14/regex:68, from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:181, from a.cc:1: /usr/include/c++/14/bits/regex.h:1103:5: note: candidate: 'template<class _BiIter> bool std::__cxx11::operator==(const sub_match<_BiIter>&, const sub_match<_BiIter>&)' 1103 | operator==(const sub_match<_BiIter>& __lhs, const sub_match<_BiIter>& __rhs) | ^~~~~~~~ /usr/include/c++/14/bits/regex.h:1103:5: note: template argument deduction/substitution failed: a.cc:11:15: note: 'std::string' {aka 'std::__cxx11::basic_string<char>'} is not derived from 'const std::__cxx11::sub_match<_BiIter>' 11 | if(s==ls[i])return true; | ^ /usr/include/c++/14/bits/regex.h:1199:5: note: candidate: 'template<class _Bi_iter, class _Ch_traits, class _Ch_alloc> bool std::__cxx11::operator==(__sub_match_string<_Bi_iter, _Ch_traits, _Ch_alloc>&, const sub_match<_BiIter>&)' 1199 | operator==(const __sub_match_string<_Bi_iter, _Ch_traits, _Ch_alloc>& __lhs, | ^~~~~~~~ /usr/include/c++/14/bits/regex.h:1199:5: note: template argument deduction/substitution failed: a.cc:11:15: note: '__gnu_cxx::__alloc_traits<std::allocator<std::pair<std::__cxx11::basic_string<char>, int> >, std::pair<std::__cxx11::basic_string<char>, int> >::value_type' {aka 'std::pair<std::__cxx11::basic_string<char>, int>'} is not derived from 'const std::__cxx11::sub_match<_BiIter>' 11 | if(s==ls[i])return true; | ^ /usr/include/c++/14/bits/regex.h:1274:5: note: candidate: 'template<class _Bi_iter, class _Ch_traits, class _Ch_alloc> bool std::__cxx11::operator==(const sub_match<_BiIter>&, __sub_match_string<_Bi_iter, _Ch_traits, _Ch_alloc>&)' 1274 | operator==(const sub_match<_Bi_iter>& __lhs, | ^~~~~~~~ /usr/include/c++/14/bits/regex.h:1274:5: note: template argument deduction/substitution failed: a.cc:11:15: note: 'std::string' {aka 'std::__cxx11::basic_string<char>'} is not derived from 'const std::__cxx11::sub_match<_BiIter>' 11 | if(s==ls[i])return true; | ^ /usr/include/c++/14/bits/regex.h:1366:5: note: candidate: 'template<class _Bi_iter> bool std::__cxx11::operator==(const typename std::iterator_traits<_Iter>::value_type*, const sub_match<_BiIter>&)' 1366 | operator==(typename iterator_traits<_Bi_iter>::value_type const* __lhs, | ^~~~~~~~ /usr/include/c++/14/bits/regex.h:1366:5: note: template argument deduction/substitution failed: a.cc:11:15: note: '__gnu_cxx::__alloc_traits<std::allocator<std::pair<std::__cxx11::basic_string<char>, int> >, std::pair<std::__cxx11::basic_string<char>, int> >::value_type' {aka 'std::pair<std::__cxx11::basic_string<char>, int>'} is not derived from 'const std::__cxx11::sub_match<_BiIter>' 11 | if(s==ls[i])return true; | ^ /usr/include/c++/14/bits/regex.h:1441:5: note: candidate: 'template<class _Bi_iter> bool std::__cxx11::operator==(const sub_match<_BiIter>&, const typename std::iterator_traits<_Iter>::value_type*)' 1441 | operator==(const sub_match<_Bi_iter>& __lhs, | ^~~~~~~~ /usr/include/c++/14/bits/regex.h:1441:5: note: template argument deduction/substitution failed: a.cc:11:15: note: 'std::string' {aka 'std::__cxx11::basic_string<char>'} is not derived from 'const std::__cxx11::sub_match<_BiIter>' 11 | if(s==ls[i])return true; | ^ /usr/include/c++/14/bits/regex.h:1534:5: note: candidate: 'template<class _Bi_iter> bool std::__cxx11::operator==(const typename std::iterator_traits<_Iter>::value_type&, const sub_match<_BiIter>&)' 1534 | operator==(typename iterator_traits<_Bi_iter>::value_type const& __lhs, | ^~~~~~~~ /usr/include/c++/14/bits/regex.h:1534:5: note: template argument deduction/substitution failed: a.cc:11:15: note: '__gnu_cxx::__alloc_traits<std::allocator<std::pair<std::__cxx11::basic_string<char>, int> >, std::pair<std::__cxx11::basic_string<char>, int> >::value_type' {aka 'std::pair<std::__cxx11::basic_string<char>, int>'} is not derived from 'const std::__cxx11::sub_match<_BiIter>' 11 | if(s==ls[i])return true; | ^ /usr/include/c++/14/bits/regex.h:1613:5: note: candidate: 'template<class _Bi_iter> bool std::__cxx11::operator==(const sub_match<_BiIter>&, const typename std::iterator_traits<_Iter>::value_type&)' 1613 | operator==(const sub_match<_Bi_iter>& __lhs, | ^~~~~~~~ /usr/include/c++/14/bits/regex.h:1613:5: note: template argument deduction/substitution failed: a.cc:11:15: note: 'std::string' {aka 'std::__cxx11::basic_string<char>'} is not derived from 'const std::__cxx11::sub_match<_BiIter>' 11 | if(s==ls[i])return true; | ^ /usr/include/c++/14/bits/regex.h:2186:5: note: candidate: 'template<class _Bi_iter, class _Alloc> bool std::__cxx11::operator==(const match_results<_BiIter, _Alloc>&, const match_results<_BiIter, _Alloc>&)' 2186 | operator==(const match_results<_Bi_iter, _Alloc>& __m1, | ^~~~~~~~ /usr/include/c++/14/bits/regex.h:2186:5: note: template argument deduction/substitution failed: a.cc:11:15: note: 'std::string' {aka 'std::__cxx11::basic_string<char>'} is not derived from 'const std::__cxx11::match_results<_BiIter, _Alloc>' 11 | if(s==ls[i])return true; | ^ In file included from /usr/include/c++/14/bits/stl_algobase.h:64, from /usr/include/c++/14/algorithm:60, from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:51: /usr/include/c++/14/bits/stl_pair.h:1033:5: note: candidate: 'template<class _T1, class _T2> constexpr bool std::operator==(const pair<_T1, _T2>&, const pair<_T1, _T2>&)' 1033 | operator==(const pair<_T1, _T2>& __x, const pair<_T1, _T2>& __y) | ^~~~~~~~ /usr/include/c++/14/bits/stl_pair.h:1033:5: note: template argument deduction/substitution failed: a.cc:11:15: note: 'std::string' {aka 'std::__cxx11::basic_string<char>'} is not derived from 'const std::pair<_T1, _T2>' 11 | if(s==ls[i])return true; | ^ In file included from /usr/include/c++/14/bits/stl_algobase.h:67: /usr/include/c++/14/bits/stl_iterator.h:441:5: note: candidate: 'template<class _Iterator> constexpr bool std::operator==(const reverse_iterator<_Iterator>&, const reverse_iterator<_Iterator>&)' 441 | operator==(const reverse_iterator<_Iterator>& __x, | ^~~~~~~~ /usr/include/c++/14/bits/stl_iterator.h:441:5: note: template argument deduction/substitution failed: a.cc:11:15: note: 'std::string' {aka 'std::__cxx11::basic_string<char>'} is not derived from 'const std::reverse_iterator<_Iterator>' 11 | if(s==ls[i])return true; | ^ /usr/include/c++/14/bits/stl_iterator.h:486:5: note: candidate: 'template<class _IteratorL, class _IteratorR> constexpr bool std::operator==(const reverse_iterator<_Iterator>&, const reverse_iterator<_IteratorR>&)' 486 | operator==(const reverse_iterator<_IteratorL>& __x, | ^~~~~~~~ /usr/include/c++/14/bits/stl_iterator.h:486:5: note: template argument deduction/substitution failed: a.cc:11:15: note: 'std::string' {aka 'std::__cxx11::basic_string<char>'} is not derived from 'const std::reverse_iterator<_Iterator>' 11 | if(s==ls[i])return true; | ^ /usr/include/c++/14/bits/stl_iterator.h:1667:5: note: candidate: 'template<class _IteratorL, class _IteratorR> constexpr bool std::operator==(const move_iterator<_IteratorL>&, const move_iterator<_IteratorR>&)' 1667 | operator==(const move_iterator<_IteratorL>& __x, | ^~~~~~~~ /usr/include/c++/14/bits/stl_iterator.h:1667:5: note: template argument deduction/substitution failed: a.cc:11:15: note: 'std::string' {aka 'std::__cxx11::basic_string<char>'} is not derived from 'const std::move_iterator<_IteratorL>' 11 | if(s==ls[i])return true; | ^ /usr/include/c++/14/bits/stl_iterator.h:1737:5: note: candidate: 'template<class _Iterator> constexpr bool std::operator==(const move_iterator<_IteratorL>&, const move_iterator<_IteratorL>&)' 1737 | operator==(const move_iterator<_Iterator>& __x, | ^~~~~~~~ /usr/include/c++/14/bits/stl_iterator.h:1737:5: note: template argument deduction/substitution failed: a.cc:11:15: note: 'std::string' {aka 'std::__cxx11::basic_string<char>'} is not derived from 'const std::move_iterator<_IteratorL>' 11 | if(s==ls[i])return true; | ^ In file included from /usr/include/c++/14/bits/char_traits.h:42, from /usr/include/c++/14/string:42, from /usr/include/c++/14/bitset:52, from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:52: /usr/include/c++/14/bits/postypes.h:192:5: note: candidate: 'template<class _StateT> bool std::operator==(const fpos<_StateT>&, const fpos<_StateT>&)' 192 | operator==(const fpos<_StateT>& __lhs, const fpos<_StateT>& __rhs) | ^~~~~~~~ /usr/include/c++/14/bits/postypes.h:192:5: note: template argument deduction/substitution failed: a.cc:11:15: note: 'std::string' {aka 'std::__cxx11::basic_string<char>'} is not derived from 'const std::fpos<_StateT>' 11 | if(s==ls[i])return true; | ^ In file included from /usr/include/c++/14/string:43: /usr/include/c++/14/bits/allocator.h:235:5: note: candidate: 'template<class _T1, class _T2> bool std::operator==(const allocator<_CharT>&, const allocator<_T2>&)' 235 | operator==(const allocator<_T1>&, const allocator<_T2>&) | ^~~~~~~~ /usr/include/c++/14/bits/allocator.h:235:5: note: template argument deduction/substitution failed: a.cc:11:15: note: 'std::string' {aka 'std::__cxx11::basic_string<ch
s043759690
p00029
C++
#include<iostream> #include<vector> #include<string> #include<algorithm> #include<map> #include<set> #include<utility> #include<cmath> #include<cstring> #include<queue> #include<cstdio> #include<sstream> #include<iomanip> #define loop(i,a,b) for(int i=a;i<b;i++) #define rep(i,a) loop(i,0,a) #define pb push_back #define mp make_pair #define all(in) in.begin(),in.end() #define shosu(x) fixed<<setprecision(x) using namespace std; //kaewasuretyuui typedef long long ll; typedef pair<int,int> pii; typedef vector<int> vi; typedef vector<vi> vvi; typedef vector<pii> vp; typedef vector<vp> vvp; typedef pair<int,pii> pip; typedef vector<pip>vip; const double PI=acos(-1); const double EPS=1e-8; const int inf=1e8; int main(){ string s; map<string,int>m; int out=0; while(cin>>s){ m[s]++; out=max(out,s.size()); } int ma=0; string ans; for(auto it=m.begin();it!=m.end();it++){ ma=max(ma,it->second); if(out==it->first.size());ans=it->first; } for(auto it=m.begin();it!=m.end();it++){ if(it->second==ma)cout<<(it->first)<<" "; } cout<<ans<<endl; }
a.cc: In function 'int main()': a.cc:39:24: error: no matching function for call to 'max(int&, std::__cxx11::basic_string<char>::size_type)' 39 | out=max(out,s.size()); | ~~~^~~~~~~~~~~~~~ In file included from /usr/include/c++/14/string:51, from /usr/include/c++/14/bits/locale_classes.h:40, from /usr/include/c++/14/bits/ios_base.h:41, from /usr/include/c++/14/ios:44, from /usr/include/c++/14/ostream:40, from /usr/include/c++/14/iostream:41, from a.cc:1: /usr/include/c++/14/bits/stl_algobase.h:257:5: note: candidate: 'template<class _Tp> constexpr const _Tp& std::max(const _Tp&, const _Tp&)' 257 | max(const _Tp& __a, const _Tp& __b) | ^~~ /usr/include/c++/14/bits/stl_algobase.h:257:5: note: template argument deduction/substitution failed: a.cc:39:24: note: deduced conflicting types for parameter 'const _Tp' ('int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'}) 39 | out=max(out,s.size()); | ~~~^~~~~~~~~~~~~~ /usr/include/c++/14/bits/stl_algobase.h:303:5: note: candidate: 'template<class _Tp, class _Compare> constexpr const _Tp& std::max(const _Tp&, const _Tp&, _Compare)' 303 | max(const _Tp& __a, const _Tp& __b, _Compare __comp) | ^~~ /usr/include/c++/14/bits/stl_algobase.h:303:5: note: candidate expects 3 arguments, 2 provided In file included from /usr/include/c++/14/algorithm:61, from a.cc:4: /usr/include/c++/14/bits/stl_algo.h:5706:5: note: candidate: 'template<class _Tp> constexpr _Tp std::max(initializer_list<_Tp>)' 5706 | max(initializer_list<_Tp> __l) | ^~~ /usr/include/c++/14/bits/stl_algo.h:5706:5: note: candidate expects 1 argument, 2 provided /usr/include/c++/14/bits/stl_algo.h:5716:5: note: candidate: 'template<class _Tp, class _Compare> constexpr _Tp std::max(initializer_list<_Tp>, _Compare)' 5716 | max(initializer_list<_Tp> __l, _Compare __comp) | ^~~ /usr/include/c++/14/bits/stl_algo.h:5716:5: note: template argument deduction/substitution failed: a.cc:39:24: note: mismatched types 'std::initializer_list<_Tp>' and 'int' 39 | out=max(out,s.size()); | ~~~^~~~~~~~~~~~~~
s365850794
p00029
C++
#include<iostream> #include<vector> #include<string> #include<algorithm> #include<map> #include<set> #include<utility> #include<cmath> #include<cstring> #include<queue> #include<cstdio> #include<sstream> #include<iomanip> #define loop(i,a,b) for(int i=a;i<b;i++) #define rep(i,a) loop(i,0,a) #define pb push_back #define mp make_pair #define all(in) in.begin(),in.end() #define shosu(x) fixed<<setprecision(x) using namespace std; //kaewasuretyuui typedef long long ll; typedef pair<int,int> pii; typedef vector<int> vi; typedef vector<vi> vvi; typedef vector<pii> vp; typedef vector<vp> vvp; typedef pair<int,pii> pip; typedef vector<pip>vip; const double PI=acos(-1); const double EPS=1e-8; const int inf=1e8; int main(){ string s; map<string,int>m; int out=0; while(cin>>s){ m[s]++; out=max(out,s.size()); } int ma=0; string ans; for(auto it=m.begin();it!=m.end();it++){ ma=max(ma,it->second); if(out==it->first.size());ans=it->first; } for(auto it=m.begin();it!=m.end();it++){ if(it->second==ma)cout<<(it->first)<<" "; } cout<<ans<<endl; }
a.cc: In function 'int main()': a.cc:39:24: error: no matching function for call to 'max(int&, std::__cxx11::basic_string<char>::size_type)' 39 | out=max(out,s.size()); | ~~~^~~~~~~~~~~~~~ In file included from /usr/include/c++/14/string:51, from /usr/include/c++/14/bits/locale_classes.h:40, from /usr/include/c++/14/bits/ios_base.h:41, from /usr/include/c++/14/ios:44, from /usr/include/c++/14/ostream:40, from /usr/include/c++/14/iostream:41, from a.cc:1: /usr/include/c++/14/bits/stl_algobase.h:257:5: note: candidate: 'template<class _Tp> constexpr const _Tp& std::max(const _Tp&, const _Tp&)' 257 | max(const _Tp& __a, const _Tp& __b) | ^~~ /usr/include/c++/14/bits/stl_algobase.h:257:5: note: template argument deduction/substitution failed: a.cc:39:24: note: deduced conflicting types for parameter 'const _Tp' ('int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'}) 39 | out=max(out,s.size()); | ~~~^~~~~~~~~~~~~~ /usr/include/c++/14/bits/stl_algobase.h:303:5: note: candidate: 'template<class _Tp, class _Compare> constexpr const _Tp& std::max(const _Tp&, const _Tp&, _Compare)' 303 | max(const _Tp& __a, const _Tp& __b, _Compare __comp) | ^~~ /usr/include/c++/14/bits/stl_algobase.h:303:5: note: candidate expects 3 arguments, 2 provided In file included from /usr/include/c++/14/algorithm:61, from a.cc:4: /usr/include/c++/14/bits/stl_algo.h:5706:5: note: candidate: 'template<class _Tp> constexpr _Tp std::max(initializer_list<_Tp>)' 5706 | max(initializer_list<_Tp> __l) | ^~~ /usr/include/c++/14/bits/stl_algo.h:5706:5: note: candidate expects 1 argument, 2 provided /usr/include/c++/14/bits/stl_algo.h:5716:5: note: candidate: 'template<class _Tp, class _Compare> constexpr _Tp std::max(initializer_list<_Tp>, _Compare)' 5716 | max(initializer_list<_Tp> __l, _Compare __comp) | ^~~ /usr/include/c++/14/bits/stl_algo.h:5716:5: note: template argument deduction/substitution failed: a.cc:39:24: note: mismatched types 'std::initializer_list<_Tp>' and 'int' 39 | out=max(out,s.size()); | ~~~^~~~~~~~~~~~~~
s675119260
p00029
C++
//#define scanf_s scanf //#define gets_s gets #include <stdio.h> #include <string> #include <iostream> #include <math.h> using namespace std; #define MAX 1001 #define MIN -100001 #define _MAX 100 int main(void) { int x, max = 0, max_n = 0, cou = 0, word_num[MAX / 2] = { 0 }, m_i, m_j; string word[MAX / 2]; char str[MAX]; gets_s(str, MAX); for (int i = 0; str[i] != '\0'; ++i) { for (int j = 0; str[i] != ' '; ++j, ++i) { word[cou][j] = str[i]; } ++cou; } for (int i = 0; i < cou; ++i) { if (word[i].size > max) { max = word[i].size; m_i = i; } for (int j = 0; j < i; ++j) { if (word[i] == word[j]) { ++word_num[j]; if (word_num[j] > max_n) { max_n = word_num[j]; m_j = j; } } } } cout << word[m_i] << " " << word[m_j] << "\n"; }
a.cc: In function 'int main()': a.cc:16:9: error: 'gets_s' was not declared in this scope 16 | gets_s(str, MAX); | ^~~~~~ a.cc:24:29: 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 '()' ?) 24 | if (word[i].size > max) { | ~~~~~~~~^~~~ | () a.cc:25:39: error: cannot convert 'std::__cxx11::basic_string<char>::size' from type 'std::__cxx11::basic_string<char>::size_type (std::__cxx11::basic_string<char>::)() const noexcept' {aka 'long unsigned int (std::__cxx11::basic_string<char>::)() const noexcept'} to type 'int' 25 | max = word[i].size; m_i = i; | ^~~~
s388839440
p00029
C++
#define scanf_s scanf #define gets_s gets #include <stdio.h> #include <string> #include <iostream> #include <math.h> using namespace std; #define MAX 1001 #define MIN -100001 #define _MAX 100 int main(void) { int x, max = 0, max_n = 0, cou = 0, word_num[MAX / 2] = { 0 }, m_i, m_j; string word[MAX / 2]; char str[MAX]; gets_s(str); for (int i = 0; str[i] != '\0'; ++i) { for (int j = 0; str[i] != ' '; ++j, ++i) { word[cou][j] = str[i]; } ++cou; } for (int i = 0; i < cou; ++i) { if (word[i].size > max) { max = word[i].size; m_i = i; } for (int j = 0; j < i; ++j) { if (word[i] == word[j]) { ++word_num[j]; if (word_num[j] > max_n) { max_n = word_num[j]; m_j = j; } } } } cout << word[m_i] << " " << word[m_j] << "\n"; }
a.cc: In function 'int main()': a.cc:2:16: error: 'gets' was not declared in this scope; did you mean 'getw'? 2 | #define gets_s gets | ^~~~ a.cc:16:9: note: in expansion of macro 'gets_s' 16 | gets_s(str); | ^~~~~~ a.cc:24:29: 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 '()' ?) 24 | if (word[i].size > max) { | ~~~~~~~~^~~~ | () a.cc:25:39: error: cannot convert 'std::__cxx11::basic_string<char>::size' from type 'std::__cxx11::basic_string<char>::size_type (std::__cxx11::basic_string<char>::)() const noexcept' {aka 'long unsigned int (std::__cxx11::basic_string<char>::)() const noexcept'} to type 'int' 25 | max = word[i].size; m_i = i; | ^~~~
s179537597
p00029
C++
#include <iostream> #include <cstdio> #include <vector> #include <algorithm> #include <cmath> #include <utility> #define ll (long lon #define REP(i,n) for(int i = 0;i<(int)n;i++) #define FOR(i,a,b) for(int i = (a);i < (b);i++) #define RFOR(i,a,b) for(int i = (a);i>(b);i--) using namespace std; int main (void){ char str[1000]; gets(str); char tango[500][33]; int i = 0,j = 0,k = 0,l = 0, temp = 0,m = 0; char max[33]; int max_l = INT_MIN; int max_numer = 0; int yokuderu = 0; int yokuderu_temp = 0; int yokuderu_number = 0; while(str[i++] != '\0') { if(str[i-1] == ' ') { if((i-1)-temp>max_l) { max_l = (i-1) -temp; max_numer = j; } while(temp<i-1) tango[j][l++] = str[temp++]; temp = i; j++; l = 0; } } if((i-1)-temp>max_l) { max_l = (i-1) -temp; max_numer = j; } while(temp<i-1) tango[j][l++] = str[temp++]; temp = i; j++; l = 0; /*???????????§??????????????????*/ //cout <<"number is " << j << endl; for(int m = 0; m < j;m++) { for(int k = 0; k<j;k++) { if(m != k) { if(strcmp(tango[m], tango[k]) == 0) { yokuderu_temp++; } } } if(yokuderu_temp >= yokuderu) { yokuderu = yokuderu_temp; yokuderu_number = m; } yokuderu_temp = 0; } REP(i,32) cout << tango[yokuderu_number][i]; cout << " "; while(tango[max_numer][m++] != '\0') cout << tango[max_numer][m-1]; m = 0; cout << endl; return 0; }
a.cc: In function 'int main()': a.cc:19:5: error: 'gets' was not declared in this scope; did you mean 'getw'? 19 | gets(str); | ^~~~ | getw a.cc:23:17: error: 'INT_MIN' was not declared in this scope 23 | int max_l = INT_MIN; | ^~~~~~~ a.cc:8:1: note: 'INT_MIN' is defined in header '<climits>'; this is probably fixable by adding '#include <climits>' 7 | #include <utility> +++ |+#include <climits> 8 | a.cc:65:20: error: 'strcmp' was not declared in this scope 65 | if(strcmp(tango[m], tango[k]) == 0) | ^~~~~~ a.cc:8:1: note: 'strcmp' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>' 7 | #include <utility> +++ |+#include <cstring> 8 |
s053193620
p00029
C++
#include <string.h> #include <string> #include <iostream> #include <cstdio> #include <vector> #include <algorithm> #include <cmath> #include <utility> #define ll (long lon #define REP(i,n) for(int i = 0;i<(int)n;i++) #define FOR(i,a,b) for(int i = (a);i < (b);i++) #define RFOR(i,a,b) for(int i = (a);i>(b);i--) using namespace std; int main (void){ char str[1000]; gets(str); char tango[500][33]; int i = 0,j = 0,k = 0,l = 0, temp = 0,m = 0; char max[33]; int max_l = INT_MIN; int max_numer = 0; int yokuderu = 0; int yokuderu_temp = 0; int yokuderu_number = 0; while(str[i++] != '\0') { if(str[i-1] == ' ') { if((i-1)-temp>max_l) { max_l = (i-1) -temp; max_numer = j; } while(temp<i-1) tango[j][l++] = str[temp++]; temp = i; j++; l = 0; } } if((i-1)-temp>max_l) { max_l = (i-1) -temp; max_numer = j; } while(temp<i-1) tango[j][l++] = str[temp++]; temp = i; j++; l = 0; /*???????????§??????????????????*/ //cout <<"number is " << j << endl; for(int m = 0; m < j;m++) { for(int k = 0; k<j;k++) { if(m != k) { if(strcmp(tango[m], tango[k]) == 0) { yokuderu_temp++; } } } if(yokuderu_temp >= yokuderu) { yokuderu = yokuderu_temp; yokuderu_number = m; } yokuderu_temp = 0; } REP(i,32) cout << tango[yokuderu_number][i]; cout << " "; while(tango[max_numer][m++] != '\0') cout << tango[max_numer][m-1]; m = 0; cout << endl; return 0; }
a.cc: In function 'int main()': a.cc:20:5: error: 'gets' was not declared in this scope; did you mean 'getw'? 20 | gets(str); | ^~~~ | getw a.cc:24:17: error: 'INT_MIN' was not declared in this scope 24 | int max_l = INT_MIN; | ^~~~~~~ a.cc:9:1: note: 'INT_MIN' is defined in header '<climits>'; this is probably fixable by adding '#include <climits>' 8 | #include <utility> +++ |+#include <climits> 9 |
s512147702
p00029
C++
#include<iostream> #include<string> #include<cstdlib> using namespace std; int main(){ char num[100], damy[100], damy2[100]; char now; string ans; int n, i, j, lng, cut = 0, l_damy; while(1){ cin >> n; if(n == 0) break; cin >> num; for(i = 0; i < n; i ++){ lng = strlen(num); now = num[0]; for(j = 0; j < lng; j++){ if(now == num[j]){ cut ++; now = num[j]; } else{ } } ans = damy; l_damy = strlen(damy); for(j = 0; j < l_damy; j ++){ num[j] = damy[j]; } } cout << ans << endl; } return 0; }
a.cc: In function 'int main()': a.cc:20:31: error: 'strlen' was not declared in this scope 20 | lng = strlen(num); | ^~~~~~ a.cc:4:1: note: 'strlen' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>' 3 | #include<cstdlib> +++ |+#include <cstring> 4 |
s242341636
p00029
C++
#include <cstdio> #include <cstring> #include <string> #include <cmath> #include <cassert> #include <iostream> #include <algorithm> #include <stack> #include <queue> #include <vector> #include <set> #include <map> #include <bitset> #include <functional> #include <sstream> #include <utility> #include <cstdlib> #include <cctype> #include <climits> #include <fstream> using namespace std; typedef long long ll; typedef pair<int, int> pii; typedef vector<int> vi; typedef vector<long long> vl; typedef vector<double> vd; typedef vector<pair<int, int> > vpii; #define FOR(i,a,b) for(int i=(a);i<(b);++i) #define rep(i,n) for(int i=0;i<(n);++i) #define foreach(itr,c) for(__typeof(c.begin()) itr=c.begin(); itr!=c.end(); itr++) #define dbg(x) cout << #x"="<< (x) << endl #define mp(a,b) make_pair((a),(b)) #define pb(a) push_back(a) #define in(x) cin >> x; #define all(x) (x).begin(), (x).end() #define INF 2147483600 #define fi first #define se second using namespace std; map <string,int> ans; int l=0; int k=0; int main(){ string str; string a,b; while(cin>>str){ if(str.size()>=l){ b = str; l=str.size(); } ans(str)++; if(ans(str)>=k){ k=ans(str); a=ans; } } cout<<a<<" "<<b<<endl; }
a.cc: In function 'int main()': a.cc:54:12: error: no match for call to '(std::map<std::__cxx11::basic_string<char>, int>) (std::string&)' 54 | ans(str)++; | ~~~^~~~~ a.cc:55:15: error: no match for call to '(std::map<std::__cxx11::basic_string<char>, int>) (std::string&)' 55 | if(ans(str)>=k){ | ~~~^~~~~ a.cc:56:18: error: no match for call to '(std::map<std::__cxx11::basic_string<char>, int>) (std::string&)' 56 | k=ans(str); | ~~~^~~~~ a.cc:57:15: error: no match for 'operator=' (operand types are 'std::string' {aka 'std::__cxx11::basic_string<char>'} and 'std::map<std::__cxx11::basic_string<char>, int>') 57 | a=ans; | ^~~ In file included from /usr/include/c++/14/string:54, from a.cc:3: /usr/include/c++/14/bits/basic_string.h:941:8: note: candidate: 'template<class _Tp> std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::_If_sv<_Tp, std::__cxx11::basic_string<_CharT, _Traits, _Alloc>&> std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::operator=(const _Tp&) [with _CharT = char; _Traits = std::char_traits<char>; _Alloc = std::allocator<char>]' 941 | operator=(const _Tp& __svt) | ^~~~~~~~ /usr/include/c++/14/bits/basic_string.h:941:8: note: template argument deduction/substitution failed: In file included from /usr/include/c++/14/bits/char_traits.h:50, from /usr/include/c++/14/string:42: /usr/include/c++/14/type_traits: In substitution of 'template<bool _Cond, class _Tp> using std::enable_if_t = typename std::enable_if::type [with bool _Cond = false; _Tp = std::__cxx11::basic_string<char>&]': /usr/include/c++/14/bits/basic_string.h:149:8: required by substitution of 'template<class _CharT, class _Traits, class _Alloc> template<class _Tp, class _Res> using std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::_If_sv = std::enable_if_t<((bool)std::__and_<std::is_convertible<const _Tp&, std::basic_string_view<_CharT, _Traits> >, std::__not_<std::is_convertible<const _Tp*, const std::__cxx11::basic_string<_CharT, _Traits, _Alloc>*> >, std::__not_<std::is_convertible<const _Tp&, const _CharT*> > >::value), _Res> [with _Tp = std::map<std::__cxx11::basic_string<char>, int>; _Res = std::__cxx11::basic_string<char>&; _CharT = char; _Traits = std::char_traits<char>; _Alloc = std::allocator<char>]' 149 | using _If_sv = enable_if_t< | ^~~~~~ /usr/include/c++/14/bits/basic_string.h:941:8: required by substitution of 'template<class _Tp> std::__cxx11::basic_string<char>::_If_sv<_Tp, std::__cxx11::basic_string<char>&> std::__cxx11::basic_string<char>::operator=(const _Tp&) [with _Tp = std::map<std::__cxx11::basic_string<char>, int>]' 941 | operator=(const _Tp& __svt) | ^~~~~~~~ a.cc:57:15: required from here 57 | a=ans; | ^~~ /usr/include/c++/14/type_traits:2711:11: error: no type named 'type' in 'struct std::enable_if<false, std::__cxx11::basic_string<char>&>' 2711 | using enable_if_t = typename enable_if<_Cond, _Tp>::type; | ^~~~~~~~~~~ /usr/include/c++/14/bits/basic_string.h:817:7: note: candidate: 'std::__cxx11::basic_string<_CharT, _Traits, _Alloc>& std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::operator=(const std::__cxx11::basic_string<_CharT, _Traits, _Alloc>&) [with _CharT = char; _Traits = std::char_traits<char>; _Alloc = std::allocator<char>]' 817 | operator=(const basic_string& __str) | ^~~~~~~~ /usr/include/c++/14/bits/basic_string.h:817:37: note: no known conversion for argument 1 from 'std::map<std::__cxx11::basic_string<char>, int>' to 'const std::__cxx11::basic_string<char>&' 817 | operator=(const basic_string& __str) | ~~~~~~~~~~~~~~~~~~~~^~~~~ /usr/include/c++/14/bits/basic_string.h:828:7: note: candidate: 'std::__cxx11::basic_string<_CharT, _Traits, _Alloc>& std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::operator=(const _CharT*) [with _CharT = char; _Traits = std::char_traits<char>; _Alloc = std::allocator<char>]' 828 | operator=(const _CharT* __s) | ^~~~~~~~ /usr/include/c++/14/bits/basic_string.h:828:31: note: no known conversion for argument 1 from 'std::map<std::__cxx11::basic_string<char>, int>' to 'const char*' 828 | operator=(const _CharT* __s) | ~~~~~~~~~~~~~~^~~ /usr/include/c++/14/bits/basic_string.h:840:7: note: candidate: 'std::__cxx11::basic_string<_CharT, _Traits, _Alloc>& std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::operator=(_CharT) [with _CharT = char; _Traits = std::char_traits<char>; _Alloc = std::allocator<char>]' 840 | operator=(_CharT __c) | ^~~~~~~~ /usr/include/c++/14/bits/basic_string.h:840:24: note: no known conversion for argument 1 from 'std::map<std::__cxx11::basic_string<char>, int>' to 'char' 840 | operator=(_CharT __c) | ~~~~~~~^~~ /usr/include/c++/14/bits/basic_string.h:858:7: note: candidate: 'std::__cxx11::basic_string<_CharT, _Traits, _Alloc>& std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::operator=(std::__cxx11::basic_string<_CharT, _Traits, _Alloc>&&) [with _CharT = char; _Traits = std::char_traits<char>; _Alloc = std::allocator<char>]' 858 | operator=(basic_string&& __str) | ^~~~~~~~ /usr/include/c++/14/bits/basic_string.h:858:32: note: no known conversion for argument 1 from 'std::map<std::__cxx11::basic_string<char>, int>' to 'std::__cxx11::basic_string<char>&&' 858 | operator=(basic_string&& __str) | ~~~~~~~~~~~~~~~^~~~~ /usr/include/c++/14/bits/basic_string.h:926:7: note: candidate: 'std::__cxx11::basic_string<_CharT, _Traits, _Alloc>& std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::operator=(std::initializer_list<_Tp>) [with _CharT = char; _Traits = std::char_traits<char>; _Alloc = std::allocator<char>]' 926 | operator=(initializer_list<_CharT> __l) | ^~~~~~~~ /usr/include/c++/14/bits/basic_string.h:926:42: note: no known conversion for argument 1 from 'std::map<std::__cxx11::basic_string<char>, int>' to 'std::initializer_list<char>' 926 | operator=(initializer_list<_CharT> __l) | ~~~~~~~~~~~~~~~~~~~~~~~~~^~~
s553835448
p00029
C++
#include <algorithm> #include <cstdio> #include <iostream> #include <map> #include <cmath> #include <queue> #include <set> #include <sstream> #include <stack> #include <string> #include <vector> using namespace std; #define pb push_back #define mp make_pair #define ll long long #define PI acos(-1.0) #define ALL(A) ((A).begin(), (A).end()) #define vsort(v) sort(v.begin(),v.end()) #define FOR(I,A,B) for(int I = (A); I < (B); ++I) int main(){ int i, j, lmax=0, lind=0, nmax=0, nind=0, cnt=0, vsize; string s; vector<string> v,vv; while(cin>>s){ v.pb(s); } cout << v.size() << endl; for(i=0;i<v.size();i++){ cnt=0; for(j=0;j<v.size();j++){ if(v[i]==v[j]){ cnt++; } } if(nmax<cnt){ nmax=max(cnt,nmax); nind=i; } if(lmax<v[i].size()){ vv=v[i]; lmax=max(lmax,vv.size()); lind=i; } } cout << v[lind] << v[nind] << endl; }
a.cc: In function 'int main()': a.cc:43:19: error: no match for 'operator=' (operand types are 'std::vector<std::__cxx11::basic_string<char> >' and '__gnu_cxx::__alloc_traits<std::allocator<std::__cxx11::basic_string<char> >, std::__cxx11::basic_string<char> >::value_type' {aka 'std::__cxx11::basic_string<char>'}) 43 | vv=v[i]; | ^ In file included from /usr/include/c++/14/vector:72, from /usr/include/c++/14/queue:63, from a.cc:6: /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 = std::__cxx11::basic_string<char>; _Alloc = std::allocator<std::__cxx11::basic_string<char> >]' 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<std::__cxx11::basic_string<char> >, std::__cxx11::basic_string<char> >::value_type' {aka 'std::__cxx11::basic_string<char>'} to 'const std::vector<std::__cxx11::basic_string<char> >&' 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 = std::__cxx11::basic_string<char>; _Alloc = std::allocator<std::__cxx11::basic_string<char> >]' 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<std::__cxx11::basic_string<char> >, std::__cxx11::basic_string<char> >::value_type' {aka 'std::__cxx11::basic_string<char>'} to 'std::vector<std::__cxx11::basic_string<char> >&&' 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 = std::__cxx11::basic_string<char>; _Alloc = std::allocator<std::__cxx11::basic_string<char> >]' 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<std::__cxx11::basic_string<char> >, std::__cxx11::basic_string<char> >::value_type' {aka 'std::__cxx11::basic_string<char>'} to 'std::initializer_list<std::__cxx11::basic_string<char> >' 788 | operator=(initializer_list<value_type> __l) | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~ a.cc:44:21: error: no matching function for call to 'max(int&, std::vector<std::__cxx11::basic_string<char> >::size_type)' 44 | lmax=max(lmax,vv.size()); | ~~~^~~~~~~~~~~~~~~~ In file included from /usr/include/c++/14/algorithm:60, from a.cc:1: /usr/include/c++/14/bits/stl_algobase.h:257:5: note: candidate: 'template<class _Tp> constexpr const _Tp& std::max(const _Tp&, const _Tp&)' 257 | max(const _Tp& __a, const _Tp& __b) | ^~~ /usr/include/c++/14/bits/stl_algobase.h:257:5: note: template argument deduction/substitution failed: a.cc:44:21: note: deduced conflicting types for parameter 'const _Tp' ('int' and 'std::vector<std::__cxx11::basic_string<char> >::size_type' {aka 'long unsigned int'}) 44 | lmax=max(lmax,vv.size()); | ~~~^~~~~~~~~~~~~~~~ /usr/include/c++/14/bits/stl_algobase.h:303:5: note: candidate: 'template<class _Tp, class _Compare> constexpr const _Tp& std::max(const _Tp&, const _Tp&, _Compare)' 303 | max(const _Tp& __a, const _Tp& __b, _Compare __comp) | ^~~ /usr/include/c++/14/bits/stl_algobase.h:303:5: note: candidate expects 3 arguments, 2 provided In file included from /usr/include/c++/14/algorithm:61: /usr/include/c++/14/bits/stl_algo.h:5706:5: note: candidate: 'template<class _Tp> constexpr _Tp std::max(initializer_list<_Tp>)' 5706 | max(initializer_list<_Tp> __l) | ^~~ /usr/include/c++/14/bits/stl_algo.h:5706:5: note: candidate expects 1 argument, 2 provided /usr/include/c++/14/bits/stl_algo.h:5716:5: note: candidate: 'template<class _Tp, class _Compare> constexpr _Tp std::max(initializer_list<_Tp>, _Compare)' 5716 | max(initializer_list<_Tp> __l, _Compare __comp) | ^~~ /usr/include/c++/14/bits/stl_algo.h:5716:5: note: template argument deduction/substitution failed: a.cc:44:21: note: mismatched types 'std::initializer_list<_Tp>' and 'int' 44 | lmax=max(lmax,vv.size()); | ~~~^~~~~~~~~~~~~~~~
s290991116
p00029
C++
#include <algorithm> #include <cstdio> #include <iostream> #include <map> #include <cmath> #include <queue> #include <set> #include <sstream> #include <stack> #include <string> #include <vector> using namespace std; #define pb push_back #define mp make_pair #define ll long long #define PI acos(-1.0) #define ALL(A) ((A).begin(), (A).end()) #define vsort(v) sort(v.begin(),v.end()) #define FOR(I,A,B) for(int I = (A); I < (B); ++I) int main(){ int i, j, lmax=0, lind=0, nmax=0, nind=0, cnt=0, vsize; string s,vv; vector<string> v; while(cin>>s){ v.pb(s); } cout << v.size() << endl; for(i=0;i<v.size();i++){ cnt=0; for(j=0;j<v.size();j++){ if(v[i]==v[j]){ cnt++; } } if(nmax<cnt){ nmax=max(cnt,nmax); nind=i; } if(lmax<v[i].size()){ vv=v[i]; lmax=max(lmax,vv.size()); lind=i; } } cout << v[lind] << v[nind] << endl; }
a.cc: In function 'int main()': a.cc:44:21: error: no matching function for call to 'max(int&, std::__cxx11::basic_string<char>::size_type)' 44 | lmax=max(lmax,vv.size()); | ~~~^~~~~~~~~~~~~~~~ In file included from /usr/include/c++/14/algorithm:60, from a.cc:1: /usr/include/c++/14/bits/stl_algobase.h:257:5: note: candidate: 'template<class _Tp> constexpr const _Tp& std::max(const _Tp&, const _Tp&)' 257 | max(const _Tp& __a, const _Tp& __b) | ^~~ /usr/include/c++/14/bits/stl_algobase.h:257:5: note: template argument deduction/substitution failed: a.cc:44:21: note: deduced conflicting types for parameter 'const _Tp' ('int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'}) 44 | lmax=max(lmax,vv.size()); | ~~~^~~~~~~~~~~~~~~~ /usr/include/c++/14/bits/stl_algobase.h:303:5: note: candidate: 'template<class _Tp, class _Compare> constexpr const _Tp& std::max(const _Tp&, const _Tp&, _Compare)' 303 | max(const _Tp& __a, const _Tp& __b, _Compare __comp) | ^~~ /usr/include/c++/14/bits/stl_algobase.h:303:5: note: candidate expects 3 arguments, 2 provided In file included from /usr/include/c++/14/algorithm:61: /usr/include/c++/14/bits/stl_algo.h:5706:5: note: candidate: 'template<class _Tp> constexpr _Tp std::max(initializer_list<_Tp>)' 5706 | max(initializer_list<_Tp> __l) | ^~~ /usr/include/c++/14/bits/stl_algo.h:5706:5: note: candidate expects 1 argument, 2 provided /usr/include/c++/14/bits/stl_algo.h:5716:5: note: candidate: 'template<class _Tp, class _Compare> constexpr _Tp std::max(initializer_list<_Tp>, _Compare)' 5716 | max(initializer_list<_Tp> __l, _Compare __comp) | ^~~ /usr/include/c++/14/bits/stl_algo.h:5716:5: note: template argument deduction/substitution failed: a.cc:44:21: note: mismatched types 'std::initializer_list<_Tp>' and 'int' 44 | lmax=max(lmax,vv.size()); | ~~~^~~~~~~~~~~~~~~~
s850969701
p00029
C++
#include <algorithm> #include <cstdio> #include <iostream> #include <map> #include <cmath> #include <queue> #include <set> #include <sstream> #include <stack> #include <string> #include <vector> using namespace std; #define pb push_back #define mp make_pair #define ll long long #define PI acos(-1.0) #define ALL(A) ((A).begin(), (A).end()) #define vsort(v) sort(v.begin(),v.end()) #define FOR(I,A,B) for(int I = (A); I < (B); ++I) int main(){ int i, j, lmax=0, lind=0, nmax=0, nind=0, cnt=0, vsize; string s; vector<string> v; while(cin>>s){ v.pb(s); } cout << v.size() << endl; for(i=0;i<v.size();i++){ cnt=0; for(j=0;j<v.size();j++){ if(v[i]==v[j]){ cnt++; } } if(nmax<cnt){ nmax=max(cnt,nmax); nind=i; } if(lmax<v[i].size()){ lmax=max(lmax,v.size()); lind=i; } } cout << v[lind] << v[nind] << endl; }
a.cc: In function 'int main()': a.cc:43:21: error: no matching function for call to 'max(int&, std::vector<std::__cxx11::basic_string<char> >::size_type)' 43 | lmax=max(lmax,v.size()); | ~~~^~~~~~~~~~~~~~~ In file included from /usr/include/c++/14/algorithm:60, from a.cc:1: /usr/include/c++/14/bits/stl_algobase.h:257:5: note: candidate: 'template<class _Tp> constexpr const _Tp& std::max(const _Tp&, const _Tp&)' 257 | max(const _Tp& __a, const _Tp& __b) | ^~~ /usr/include/c++/14/bits/stl_algobase.h:257:5: note: template argument deduction/substitution failed: a.cc:43:21: note: deduced conflicting types for parameter 'const _Tp' ('int' and 'std::vector<std::__cxx11::basic_string<char> >::size_type' {aka 'long unsigned int'}) 43 | lmax=max(lmax,v.size()); | ~~~^~~~~~~~~~~~~~~ /usr/include/c++/14/bits/stl_algobase.h:303:5: note: candidate: 'template<class _Tp, class _Compare> constexpr const _Tp& std::max(const _Tp&, const _Tp&, _Compare)' 303 | max(const _Tp& __a, const _Tp& __b, _Compare __comp) | ^~~ /usr/include/c++/14/bits/stl_algobase.h:303:5: note: candidate expects 3 arguments, 2 provided In file included from /usr/include/c++/14/algorithm:61: /usr/include/c++/14/bits/stl_algo.h:5706:5: note: candidate: 'template<class _Tp> constexpr _Tp std::max(initializer_list<_Tp>)' 5706 | max(initializer_list<_Tp> __l) | ^~~ /usr/include/c++/14/bits/stl_algo.h:5706:5: note: candidate expects 1 argument, 2 provided /usr/include/c++/14/bits/stl_algo.h:5716:5: note: candidate: 'template<class _Tp, class _Compare> constexpr _Tp std::max(initializer_list<_Tp>, _Compare)' 5716 | max(initializer_list<_Tp> __l, _Compare __comp) | ^~~ /usr/include/c++/14/bits/stl_algo.h:5716:5: note: template argument deduction/substitution failed: a.cc:43:21: note: mismatched types 'std::initializer_list<_Tp>' and 'int' 43 | lmax=max(lmax,v.size()); | ~~~^~~~~~~~~~~~~~~
s848085693
p00029
C++
#include <algorithm> #include <cstdio> #include <iostream> #include <map> #include <cmath> #include <queue> #include <set> #include <sstream> #include <stack> #include <string> #include <vector> using namespace std; #define pb push_back #define mp make_pair #define ll long long #define PI acos(-1.0) #define ALL(A) ((A).begin(), (A).end()) #define vsort(v) sort(v.begin(),v.end()) #define FOR(I,A,B) for(int I = (A); I < (B); ++I) int main(){ int i, j, lmax=0, lind=0, nmax=0, nind=0, cnt=0, vsize; string s,vv; vector<string> v; while(cin>>s!=EOF){ v.pb(s); } for(i=0;i<int(v.size());i++){ cnt=0; vv=v[i]; for(j=0;j<int(vv.size());j++){ if(v[i]==v[j]){ cnt++; } } if(nmax<cnt){ nmax=max(cnt,nmax); nind=i; } if(lmax<int(vv.size())){ lmax=max(lmax,int(vv.size())); lind=i; } } cout << v[lind] << v[nind] << endl; }
a.cc: In function 'int main()': a.cc:27:17: error: no match for 'operator!=' (operand types are 'std::basic_istream<char>' and 'int') 27 | while(cin>>s!=EOF){ | ~~~~~~^~ | | | std::basic_istream<char> a.cc:27:17: note: candidate: 'operator!=(int, int)' (built-in) 27 | while(cin>>s!=EOF){ | ^ a.cc:27:17: note: no known conversion for argument 1 from 'std::basic_istream<char>' to 'int' In file included from /usr/include/c++/14/bits/stl_algobase.h:64, from /usr/include/c++/14/algorithm:60, from a.cc:1: /usr/include/c++/14/bits/stl_pair.h:1052:5: note: candidate: 'template<class _T1, class _T2> constexpr bool std::operator!=(const pair<_T1, _T2>&, const pair<_T1, _T2>&)' 1052 | operator!=(const pair<_T1, _T2>& __x, const pair<_T1, _T2>& __y) | ^~~~~~~~ /usr/include/c++/14/bits/stl_pair.h:1052:5: note: template argument deduction/substitution failed: In file included from /usr/include/c++/14/cstdio:42, from a.cc:2: a.cc:27:19: note: 'std::basic_istream<char>' is not derived from 'const std::pair<_T1, _T2>' 27 | while(cin>>s!=EOF){ | ^~~ In file included from /usr/include/c++/14/bits/stl_algobase.h:67: /usr/include/c++/14/bits/stl_iterator.h:455:5: note: candidate: 'template<class _Iterator> constexpr bool std::operator!=(const reverse_iterator<_Iterator>&, const reverse_iterator<_Iterator>&)' 455 | operator!=(const reverse_iterator<_Iterator>& __x, | ^~~~~~~~ /usr/include/c++/14/bits/stl_iterator.h:455:5: note: template argument deduction/substitution failed: a.cc:27:19: note: 'std::basic_istream<char>' is not derived from 'const std::reverse_iterator<_Iterator>' 27 | while(cin>>s!=EOF){ | ^~~ /usr/include/c++/14/bits/stl_iterator.h:500:5: note: candidate: 'template<class _IteratorL, class _IteratorR> constexpr bool std::operator!=(const reverse_iterator<_Iterator>&, const reverse_iterator<_IteratorR>&)' 500 | operator!=(const reverse_iterator<_IteratorL>& __x, | ^~~~~~~~ /usr/include/c++/14/bits/stl_iterator.h:500:5: note: template argument deduction/substitution failed: a.cc:27:19: note: 'std::basic_istream<char>' is not derived from 'const std::reverse_iterator<_Iterator>' 27 | while(cin>>s!=EOF){ | ^~~ /usr/include/c++/14/bits/stl_iterator.h:1686:5: note: candidate: 'template<class _IteratorL, class _IteratorR> constexpr bool std::operator!=(const move_iterator<_IteratorL>&, const move_iterator<_IteratorR>&)' 1686 | operator!=(const move_iterator<_IteratorL>& __x, | ^~~~~~~~ /usr/include/c++/14/bits/stl_iterator.h:1686:5: note: template argument deduction/substitution failed: a.cc:27:19: note: 'std::basic_istream<char>' is not derived from 'const std::move_iterator<_IteratorL>' 27 | while(cin>>s!=EOF){ | ^~~ /usr/include/c++/14/bits/stl_iterator.h:1753:5: note: candidate: 'template<class _Iterator> constexpr bool std::operator!=(const move_iterator<_IteratorL>&, const move_iterator<_IteratorL>&)' 1753 | operator!=(const move_iterator<_Iterator>& __x, | ^~~~~~~~ /usr/include/c++/14/bits/stl_iterator.h:1753:5: note: template argument deduction/substitution failed: a.cc:27:19: note: 'std::basic_istream<char>' is not derived from 'const std::move_iterator<_IteratorL>' 27 | while(cin>>s!=EOF){ | ^~~ In file included from /usr/include/c++/14/iosfwd:42, from /usr/include/c++/14/ios:40, from /usr/include/c++/14/ostream:40, from /usr/include/c++/14/iostream:41, from a.cc:3: /usr/include/c++/14/bits/postypes.h:197:5: note: candidate: 'template<class _StateT> bool std::operator!=(const fpos<_StateT>&, const fpos<_StateT>&)' 197 | operator!=(const fpos<_StateT>& __lhs, const fpos<_StateT>& __rhs) | ^~~~~~~~ /usr/include/c++/14/bits/postypes.h:197:5: note: template argument deduction/substitution failed: a.cc:27:19: note: 'std::basic_istream<char>' is not derived from 'const std::fpos<_StateT>' 27 | while(cin>>s!=EOF){ | ^~~ In file included from /usr/include/c++/14/string:43, from /usr/include/c++/14/bits/locale_classes.h:40, from /usr/include/c++/14/bits/ios_base.h:41, from /usr/include/c++/14/ios:44: /usr/include/c++/14/bits/allocator.h:243:5: note: candidate: 'template<class _T1, class _T2> bool std::operator!=(const allocator<_CharT>&, const allocator<_T2>&)' 243 | operator!=(const allocator<_T1>&, const allocator<_T2>&) | ^~~~~~~~ /usr/include/c++/14/bits/allocator.h:243:5: note: template argument deduction/substitution failed: a.cc:27:19: note: 'std::basic_istream<char>' is not derived from 'const std::allocator<_CharT>' 27 | while(cin>>s!=EOF){ | ^~~ In file included from /usr/include/c++/14/bits/basic_string.h:47, from /usr/include/c++/14/string:54: /usr/include/c++/14/string_view:651:5: note: candidate: 'template<class _CharT, class _Traits> constexpr bool std::operator!=(basic_string_view<_CharT, _Traits>, basic_string_view<_CharT, _Traits>)' 651 | operator!=(basic_string_view<_CharT, _Traits> __x, | ^~~~~~~~ /usr/include/c++/14/string_view:651:5: note: template argument deduction/substitution failed: a.cc:27:19: note: 'std::basic_istream<char>' is not derived from 'std::basic_string_view<_CharT, _Traits>' 27 | while(cin>>s!=EOF){ | ^~~ /usr/include/c++/14/string_view:658:5: note: candidate: 'template<class _CharT, class _Traits> constexpr bool std::operator!=(basic_string_view<_CharT, _Traits>, __type_identity_t<basic_string_view<_CharT, _Traits> >)' 658 | operator!=(basic_string_view<_CharT, _Traits> __x, | ^~~~~~~~ /usr/include/c++/14/string_view:658:5: note: template argument deduction/substitution failed: a.cc:27:19: note: 'std::basic_istream<char>' is not derived from 'std::basic_string_view<_CharT, _Traits>' 27 | while(cin>>s!=EOF){ | ^~~ /usr/include/c++/14/string_view:666:5: note: candidate: 'template<class _CharT, class _Traits> constexpr bool std::operator!=(__type_identity_t<basic_string_view<_CharT, _Traits> >, basic_string_view<_CharT, _Traits>)' 666 | operator!=(__type_identity_t<basic_string_view<_CharT, _Traits>> __x, | ^~~~~~~~ /usr/include/c++/14/string_view:666:5: note: template argument deduction/substitution failed: a.cc:27:19: note: mismatched types 'std::basic_string_view<_CharT, _Traits>' and 'int' 27 | while(cin>>s!=EOF){ | ^~~ /usr/include/c++/14/bits/basic_string.h:3833:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> bool std::operator!=(const __cxx11::basic_string<_CharT, _Traits, _Allocator>&, const __cxx11::basic_string<_CharT, _Traits, _Allocator>&)' 3833 | operator!=(const basic_string<_CharT, _Traits, _Alloc>& __lhs, | ^~~~~~~~ /usr/include/c++/14/bits/basic_string.h:3833:5: note: template argument deduction/substitution failed: a.cc:27:19: note: 'std::basic_istream<char>' is not derived from 'const std::__cxx11::basic_string<_CharT, _Traits, _Allocator>' 27 | while(cin>>s!=EOF){ | ^~~ /usr/include/c++/14/bits/basic_string.h:3847:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> bool std::operator!=(const _CharT*, const __cxx11::basic_string<_CharT, _Traits, _Allocator>&)' 3847 | operator!=(const _CharT* __lhs, | ^~~~~~~~ /usr/include/c++/14/bits/basic_string.h:3847:5: note: template argument deduction/substitution failed: a.cc:27:19: note: mismatched types 'const _CharT*' and 'std::basic_istream<char>' 27 | while(cin>>s!=EOF){ | ^~~ /usr/include/c++/14/bits/basic_string.h:3860:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> bool std::operator!=(const __cxx11::basic_string<_CharT, _Traits, _Allocator>&, const _CharT*)' 3860 | operator!=(const basic_string<_CharT, _Traits, _Alloc>& __lhs, | ^~~~~~~~ /usr/include/c++/14/bits/basic_string.h:3860:5: note: template argument deduction/substitution failed: a.cc:27:19: note: 'std::basic_istream<char>' is not derived from 'const std::__cxx11::basic_string<_CharT, _Traits, _Allocator>' 27 | while(cin>>s!=EOF){ | ^~~ In file included from /usr/include/c++/14/bits/memory_resource.h:47, from /usr/include/c++/14/string:68: /usr/include/c++/14/tuple:2613:5: note: candidate: 'template<class ... _TElements, class ... _UElements> constexpr bool std::operator!=(const tuple<_UTypes ...>&, const tuple<_Elements ...>&)' 2613 | operator!=(const tuple<_TElements...>& __t, | ^~~~~~~~ /usr/include/c++/14/tuple:2613:5: note: template argument deduction/substitution failed: a.cc:27:19: note: 'std::basic_istream<char>' is not derived from 'const std::tuple<_UTypes ...>' 27 | while(cin>>s!=EOF){ | ^~~ In file included from /usr/include/c++/14/bits/locale_facets.h:48, from /usr/include/c++/14/bits/basic_ios.h:37, from /usr/include/c++/14/ios:46: /usr/include/c++/14/bits/streambuf_iterator.h:242:5: note: candidate: 'template<class _CharT, class _Traits> bool std::operator!=(const istreambuf_iterator<_CharT, _Traits>&, const istreambuf_iterator<_CharT, _Traits>&)' 242 | operator!=(const istreambuf_iterator<_CharT, _Traits>& __a, | ^~~~~~~~ /usr/include/c++/14/bits/streambuf_iterator.h:242:5: note: template argument deduction/substitution failed: a.cc:27:19: note: 'std::basic_istream<char>' is not derived from 'const std::istreambuf_iterator<_CharT, _Traits>' 27 | while(cin>>s!=EOF){ | ^~~ In file included from /usr/include/c++/14/map:63, from a.cc:4: /usr/include/c++/14/bits/stl_map.h:1557:5: note: candidate: 'template<class _Key, class _Tp,
s268876173
p00029
C++
#include <algorithm> #include <cstdio> #include <iostream> #include <map> #include <cmath> #include <queue> #include <set> #include <sstream> #include <stack> #include <string> #include <vector> using namespace std; #define pb push_back #define mp make_pair #define ll long long #define PI acos(-1.0) #define ALL(A) ((A).begin(), (A).end()) #define vsort(v) sort(v.begin(),v.end()) #define FOR(I,A,B) for(int I = (A); I < (B); ++I) int main(){ int i, j, lmax=0, lind=0, nmax=0, nind=0, cnt=0, vsize; string s,vv; vector<string> v; while(cin>>s){ if(s==EOF) break; v.pb(s); } for(i=0;i<int(v.size());i++){ cnt=0; vv=v[i]; for(j=0;j<int(vv.size());j++){ if(v[i]==v[j]){ cnt++; } } if(nmax<cnt){ nmax=max(cnt,nmax); nind=i; } if(lmax<int(vv.size())){ lmax=max(lmax,int(vv.size())); lind=i; } } cout << v[lind] << v[nind] << endl; }
a.cc: In function 'int main()': a.cc:28:13: error: no match for 'operator==' (operand types are 'std::string' {aka 'std::__cxx11::basic_string<char>'} and 'int') 28 | if(s==EOF) break; | ~^~ | | | std::string {aka std::__cxx11::basic_string<char>} In file included from /usr/include/c++/14/bits/stl_algobase.h:64, from /usr/include/c++/14/algorithm:60, from a.cc:1: /usr/include/c++/14/bits/stl_pair.h:1033:5: note: candidate: 'template<class _T1, class _T2> constexpr bool std::operator==(const pair<_T1, _T2>&, const pair<_T1, _T2>&)' 1033 | operator==(const pair<_T1, _T2>& __x, const pair<_T1, _T2>& __y) | ^~~~~~~~ /usr/include/c++/14/bits/stl_pair.h:1033:5: note: template argument deduction/substitution failed: In file included from /usr/include/c++/14/cstdio:42, from a.cc:2: a.cc:28:15: note: 'std::string' {aka 'std::__cxx11::basic_string<char>'} is not derived from 'const std::pair<_T1, _T2>' 28 | if(s==EOF) break; | ^~~ In file included from /usr/include/c++/14/bits/stl_algobase.h:67: /usr/include/c++/14/bits/stl_iterator.h:441:5: note: candidate: 'template<class _Iterator> constexpr bool std::operator==(const reverse_iterator<_Iterator>&, const reverse_iterator<_Iterator>&)' 441 | operator==(const reverse_iterator<_Iterator>& __x, | ^~~~~~~~ /usr/include/c++/14/bits/stl_iterator.h:441:5: note: template argument deduction/substitution failed: a.cc:28:15: note: 'std::string' {aka 'std::__cxx11::basic_string<char>'} is not derived from 'const std::reverse_iterator<_Iterator>' 28 | if(s==EOF) break; | ^~~ /usr/include/c++/14/bits/stl_iterator.h:486:5: note: candidate: 'template<class _IteratorL, class _IteratorR> constexpr bool std::operator==(const reverse_iterator<_Iterator>&, const reverse_iterator<_IteratorR>&)' 486 | operator==(const reverse_iterator<_IteratorL>& __x, | ^~~~~~~~ /usr/include/c++/14/bits/stl_iterator.h:486:5: note: template argument deduction/substitution failed: a.cc:28:15: note: 'std::string' {aka 'std::__cxx11::basic_string<char>'} is not derived from 'const std::reverse_iterator<_Iterator>' 28 | if(s==EOF) break; | ^~~ /usr/include/c++/14/bits/stl_iterator.h:1667:5: note: candidate: 'template<class _IteratorL, class _IteratorR> constexpr bool std::operator==(const move_iterator<_IteratorL>&, const move_iterator<_IteratorR>&)' 1667 | operator==(const move_iterator<_IteratorL>& __x, | ^~~~~~~~ /usr/include/c++/14/bits/stl_iterator.h:1667:5: note: template argument deduction/substitution failed: a.cc:28:15: note: 'std::string' {aka 'std::__cxx11::basic_string<char>'} is not derived from 'const std::move_iterator<_IteratorL>' 28 | if(s==EOF) break; | ^~~ /usr/include/c++/14/bits/stl_iterator.h:1737:5: note: candidate: 'template<class _Iterator> constexpr bool std::operator==(const move_iterator<_IteratorL>&, const move_iterator<_IteratorL>&)' 1737 | operator==(const move_iterator<_Iterator>& __x, | ^~~~~~~~ /usr/include/c++/14/bits/stl_iterator.h:1737:5: note: template argument deduction/substitution failed: a.cc:28:15: note: 'std::string' {aka 'std::__cxx11::basic_string<char>'} is not derived from 'const std::move_iterator<_IteratorL>' 28 | if(s==EOF) break; | ^~~ In file included from /usr/include/c++/14/iosfwd:42, from /usr/include/c++/14/ios:40, from /usr/include/c++/14/ostream:40, from /usr/include/c++/14/iostream:41, from a.cc:3: /usr/include/c++/14/bits/postypes.h:192:5: note: candidate: 'template<class _StateT> bool std::operator==(const fpos<_StateT>&, const fpos<_StateT>&)' 192 | operator==(const fpos<_StateT>& __lhs, const fpos<_StateT>& __rhs) | ^~~~~~~~ /usr/include/c++/14/bits/postypes.h:192:5: note: template argument deduction/substitution failed: a.cc:28:15: note: 'std::string' {aka 'std::__cxx11::basic_string<char>'} is not derived from 'const std::fpos<_StateT>' 28 | if(s==EOF) break; | ^~~ In file included from /usr/include/c++/14/string:43, from /usr/include/c++/14/bits/locale_classes.h:40, from /usr/include/c++/14/bits/ios_base.h:41, from /usr/include/c++/14/ios:44: /usr/include/c++/14/bits/allocator.h:235:5: note: candidate: 'template<class _T1, class _T2> bool std::operator==(const allocator<_CharT>&, const allocator<_T2>&)' 235 | operator==(const allocator<_T1>&, const allocator<_T2>&) | ^~~~~~~~ /usr/include/c++/14/bits/allocator.h:235:5: note: template argument deduction/substitution failed: a.cc:28:15: note: 'std::string' {aka 'std::__cxx11::basic_string<char>'} is not derived from 'const std::allocator<_CharT>' 28 | if(s==EOF) break; | ^~~ In file included from /usr/include/c++/14/bits/basic_string.h:47, from /usr/include/c++/14/string:54: /usr/include/c++/14/string_view:629:5: note: candidate: 'template<class _CharT, class _Traits> constexpr bool std::operator==(basic_string_view<_CharT, _Traits>, __type_identity_t<basic_string_view<_CharT, _Traits> >)' 629 | operator==(basic_string_view<_CharT, _Traits> __x, | ^~~~~~~~ /usr/include/c++/14/string_view:629:5: note: template argument deduction/substitution failed: a.cc:28:15: note: 'std::__cxx11::basic_string<char>' is not derived from 'std::basic_string_view<_CharT, _Traits>' 28 | if(s==EOF) break; | ^~~ /usr/include/c++/14/string_view:637:5: note: candidate: 'template<class _CharT, class _Traits> constexpr bool std::operator==(basic_string_view<_CharT, _Traits>, basic_string_view<_CharT, _Traits>)' 637 | operator==(basic_string_view<_CharT, _Traits> __x, | ^~~~~~~~ /usr/include/c++/14/string_view:637:5: note: template argument deduction/substitution failed: a.cc:28:15: note: 'std::__cxx11::basic_string<char>' is not derived from 'std::basic_string_view<_CharT, _Traits>' 28 | if(s==EOF) break; | ^~~ /usr/include/c++/14/string_view:644:5: note: candidate: 'template<class _CharT, class _Traits> constexpr bool std::operator==(__type_identity_t<basic_string_view<_CharT, _Traits> >, basic_string_view<_CharT, _Traits>)' 644 | operator==(__type_identity_t<basic_string_view<_CharT, _Traits>> __x, | ^~~~~~~~ /usr/include/c++/14/string_view:644:5: note: template argument deduction/substitution failed: a.cc:28:15: note: mismatched types 'std::basic_string_view<_CharT, _Traits>' and 'int' 28 | if(s==EOF) break; | ^~~ /usr/include/c++/14/bits/basic_string.h:3755:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> bool std::operator==(const __cxx11::basic_string<_CharT, _Traits, _Allocator>&, const __cxx11::basic_string<_CharT, _Traits, _Allocator>&)' 3755 | operator==(const basic_string<_CharT, _Traits, _Alloc>& __lhs, | ^~~~~~~~ /usr/include/c++/14/bits/basic_string.h:3755:5: note: template argument deduction/substitution failed: a.cc:28:15: note: mismatched types 'const std::__cxx11::basic_string<_CharT, _Traits, _Allocator>' and 'int' 28 | if(s==EOF) break; | ^~~ /usr/include/c++/14/bits/basic_string.h:3772:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> bool std::operator==(const __cxx11::basic_string<_CharT, _Traits, _Allocator>&, const _CharT*)' 3772 | operator==(const basic_string<_CharT, _Traits, _Alloc>& __lhs, | ^~~~~~~~ /usr/include/c++/14/bits/basic_string.h:3772:5: note: template argument deduction/substitution failed: a.cc:28:15: note: mismatched types 'const _CharT*' and 'int' 28 | if(s==EOF) break; | ^~~ /usr/include/c++/14/bits/basic_string.h:3819:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> bool std::operator==(const _CharT*, const __cxx11::basic_string<_CharT, _Traits, _Allocator>&)' 3819 | operator==(const _CharT* __lhs, | ^~~~~~~~ /usr/include/c++/14/bits/basic_string.h:3819:5: note: template argument deduction/substitution failed: a.cc:28:15: note: mismatched types 'const _CharT*' and 'std::__cxx11::basic_string<char>' 28 | if(s==EOF) break; | ^~~ In file included from /usr/include/c++/14/bits/memory_resource.h:47, from /usr/include/c++/14/string:68: /usr/include/c++/14/tuple:2558:5: note: candidate: 'template<class ... _TElements, class ... _UElements> constexpr bool std::operator==(const tuple<_UTypes ...>&, const tuple<_Elements ...>&)' 2558 | operator==(const tuple<_TElements...>& __t, | ^~~~~~~~ /usr/include/c++/14/tuple:2558:5: note: template argument deduction/substitution failed: a.cc:28:15: note: 'std::string' {aka 'std::__cxx11::basic_string<char>'} is not derived from 'const std::tuple<_UTypes ...>' 28 | if(s==EOF) break; | ^~~ In file included from /usr/include/c++/14/bits/locale_facets.h:48, from /usr/include/c++/14/bits/basic_ios.h:37, from /usr/include/c++/14/ios:46: /usr/include/c++/14/bits/streambuf_iterator.h:234:5: note: candidate: 'template<class _CharT, class _Traits> bool std::operator==(const istreambuf_iterator<_CharT, _Traits>&, const istreambuf_iterator<_CharT, _Traits>&)' 234 | operator==(const istreambuf_iterator<_CharT, _Traits>& __a, | ^~~~~~~~ /usr/include/c++/14/bits/streambuf_iterator.h:234:5: note: template argument deduction/substitution failed: a.cc:28:15: note: 'std::string' {aka 'std::__cxx11::basic_string<char>'} is not derived from 'const std::istreambuf_iterator<_CharT, _Traits>' 28 | if(s==EOF) break; | ^~~ In file included from /usr/include/c++/14/map:63, from a.cc:4: /usr/include/c++/14/bits/stl_map.h:1512:5: note: candidate: 'template<class _Key, class _Tp, class _Comp
s944396631
p00029
C++
#include <algorithm> #include <cstdio> #include <iostream> #include <map> #include <cmath> #include <queue> #include <set> #include <sstream> #include <stack> #include <string> #include <vector> using namespace std; #define pb push_back #define mp make_pair #define ll long long #define PI acos(-1.0) #define ALL(A) ((A).begin(), (A).end()) #define vsort(v) sort(v.begin(),v.end()) #define FOR(I,A,B) for(int I = (A); I < (B); ++I) int main(){ int i, j, times=0; string tmp,maxLength,maxTimes; map<string, int> sentences; maxLength="" while(cin>>tmp){ if(tmp.length()>maxLength.length()){ maxLength=tmp; } if(sentences.count(tmp)==0){ sentences.insert(map<string,int>::value_type(tmp,1)); }else{ sentences[tmp]++; } if(sentences[tmp]>times){ times=sentences[tmp]; maxTimes=tmp; } } cout << maxTimes << maxLength << endl; }
a.cc: In function 'int main()': a.cc:27:17: error: expected ';' before 'while' 27 | maxLength="" | ^ | ; 28 | while(cin>>tmp){ | ~~~~~
s402789145
p00029
C++
#include <algorithm> #include <cstdio> #include <iostream> #include <map> #include <cmath> #include <queue> #include <set> #include <sstream> #include <stack> #include <string> #include <vector> using namespace std; #define pb push_back #define mp make_pair #define ll long long #define PI acos(-1.0) #define ALL(A) ((A).begin(), (A).end()) #define vsort(v) sort(v.begin(),v.end()) #define FOR(I,A,B) for(int I = (A); I < (B); ++I) int main(){ int i, j, times=0; string tmp,maxLength,maxTimes; map<string, int> sentences; maxLength="" while(cin>>tmp){ if(tmp.length()>maxLength.length()){ maxLength=tmp; } if(sentences.count(tmp)==0){ sentences.insert(map<string,int>::value_type(tmp,1)); }else{ sentences[tmp]++; } if(sentences[tmp]>times){ times=sentences[tmp]; maxTimes=tmp; } } cout << maxTimes << maxLength << endl; }
a.cc: In function 'int main()': a.cc:27:17: error: expected ';' before 'while' 27 | maxLength="" | ^ | ; 28 | while(cin>>tmp){ | ~~~~~
s989201998
p00029
C++
#include "bits/stdc++.h" using namespace std; int main(){ string s; int m; map<string,int> mp; while(cin>>s){ mp[s]++; m=max(m,s,size()); } int x=0; for(auto &el:mp){ if(x<el.second){ x=el.second; } } for(auto &el:mp){ if(x==el.second){ cout<<el.first<<" "; break; } } for(auto &el:mp){ if(m==el.first.size()){ cout<<el.first<<endl; } } return 0; }
a.cc: In function 'int main()': a.cc:10:31: error: no matching function for call to 'size()' 10 | m=max(m,s,size()); | ~~~~^~ In file included from /usr/include/c++/14/string:53, from /usr/include/c++/14/bitset:52, from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:52, from a.cc:1: /usr/include/c++/14/bits/range_access.h:262:5: note: candidate: 'template<class _Container> constexpr decltype (__cont.size()) std::size(const _Container&)' 262 | size(const _Container& __cont) noexcept(noexcept(__cont.size())) | ^~~~ /usr/include/c++/14/bits/range_access.h:262:5: note: candidate expects 1 argument, 0 provided /usr/include/c++/14/bits/range_access.h:272:5: note: candidate: 'template<class _Tp, long unsigned int _Nm> constexpr std::size_t std::size(const _Tp (&)[_Nm])' 272 | size(const _Tp (&)[_Nm]) noexcept | ^~~~ /usr/include/c++/14/bits/range_access.h:272:5: note: candidate expects 1 argument, 0 provided
s071857535
p00029
C++
// // main.cpp // kazane // // Created by h3036136 on 2017/07/27. // Copyright ?? 2017??´ h3036136. All rights reserved. #include <iostream> #include <string> using namespace std; int main(){ long saidai=0; //char f; int a=0,cnt=0,num=0,max=0; string str,tango[1000]={""},answer,ans; getline(cin,str); for(int i=0;i<str.size();i++){ if(str[i]==' '){ for(int j=a;j<i;j++){ /*if(isupper(str[j])){ f=str[j]; f=f+32; str[j]=f; }*/ tango[cnt]+=str[j]; } cnt=cnt+1; a=i+1; } } for(int p=a;p<str.size();p++){ tango[cnt]+=str[p]; } for(int k=0;k<=cnt;k++){ if(saidai<tango[k].size()){ saidai=tango[k].size(); ans=tango[k]; } } for(int s=1;s<cnt;s++){ for(int t=s+1;t<=cnt;t++){ if(tango[s]==tango[t]){ num=num+1; } } if(max<num){ max=num; answer=tango[t]; } } cout<<answer<<" "<<ans<<endl; return 0; }
a.cc: In function 'int main()': a.cc:51:26: error: 't' was not declared in this scope 51 | answer=tango[t]; | ^
s910154152
p00029
C++
#include<iostream> int main(){ std::string str; std::string maxlen; std::string maxocc; std::map<std::string, int> occ; //std::cin >> str; //std::cout << str << std::endl; std::cin >> str; maxlen = str; maxocc = str; while(std::cin >> str){ if(str.size()>maxlen.size()){ maxlen = str; } occ[str]++; if(occ[str]>occ[maxocc]){ maxocc = str; } } std::cout << maxlen << std::endl; }
a.cc: In function 'int main()': a.cc:7:8: error: 'map' is not a member of 'std' 7 | std::map<std::string, int> occ; | ^~~ a.cc:2:1: note: 'std::map' is defined in header '<map>'; this is probably fixable by adding '#include <map>' 1 | #include<iostream> +++ |+#include <map> 2 | a.cc:7:23: error: expected primary-expression before ',' token 7 | std::map<std::string, int> occ; | ^ a.cc:7:25: error: expected primary-expression before 'int' 7 | std::map<std::string, int> occ; | ^~~ a.cc:19:5: error: 'occ' was not declared in this scope 19 | occ[str]++; | ^~~
s400204063
p00029
C++
#include<iostream> int main(){ std::string str; std::string maxlen; std::string maxocc; map<std::string, int> occ; //std::cin >> str; //std::cout << str << std::endl; std::cin >> str; maxlen = str; maxocc = str; while(std::cin >> str){ if(str.size()>maxlen.size()){ maxlen = str; } occ[str]++; if(occ[str]>occ[maxocc]){ maxocc = str; } } std::cout << maxlen << std::endl; }
a.cc: In function 'int main()': a.cc:7:3: error: 'map' was not declared in this scope 7 | map<std::string, int> occ; | ^~~ a.cc:7:18: error: expected primary-expression before ',' token 7 | map<std::string, int> occ; | ^ a.cc:7:20: error: expected primary-expression before 'int' 7 | map<std::string, int> occ; | ^~~ a.cc:19:5: error: 'occ' was not declared in this scope 19 | occ[str]++; | ^~~
s244102316
p00029
C++
#include<iostream> #include<map> #include<string> int main(){ std::string str; std::string maxlen; std::string maxocc; map<std::string, int> occ; //std::cin >> str; //std::cout << str << std::endl; std::cin >> str; maxlen = str; maxocc = str; while(std::cin >> str){ if(str.size()>maxlen.size()){ maxlen = str; } occ[str]++; if(occ[str]>occ[maxocc]){ maxocc = str; } } std::cout << maxlen << std::endl; }
a.cc: In function 'int main()': a.cc:9:3: error: 'map' was not declared in this scope 9 | map<std::string, int> occ; | ^~~ a.cc:9:3: note: suggested alternatives: In file included from /usr/include/c++/14/map:63, from a.cc:2: /usr/include/c++/14/bits/stl_map.h:102:11: note: 'std::map' 102 | class map | ^~~ /usr/include/c++/14/map:89:13: note: 'std::pmr::map' 89 | using map | ^~~ a.cc:9:18: error: expected primary-expression before ',' token 9 | map<std::string, int> occ; | ^ a.cc:9:20: error: expected primary-expression before 'int' 9 | map<std::string, int> occ; | ^~~ a.cc:21:5: error: 'occ' was not declared in this scope 21 | occ[str]++; | ^~~
s297076770
p00029
C++
#include<stdio.h> int main(void) { int i = 0; char s[1000][100]; while ( scanf("%s", s[n] ) != EOF ) n++; for ( i = 0; i < n ; i ++ ) { printf("%s", s[2]); return 0; }
a.cc: In function 'int main()': a.cc:5:26: error: 'n' was not declared in this scope 5 | while ( scanf("%s", s[n] ) != EOF ) n++; | ^ a.cc:6:21: error: 'n' was not declared in this scope 6 | for ( i = 0; i < n ; i ++ ) { | ^ a.cc:10:2: error: expected '}' at end of input 10 | } | ^ a.cc:2:16: note: to match this '{' 2 | int main(void) { | ^
s250265437
p00029
C++
#include <iostream> #include <string> #include <map> using namespace std; int main(){ map<string,int>m; string s; vector<string>v; while(cin>>s){ if('A'<=s[0]&&s[0]<='Z'){ s[0]=s[0]-'A'+'a'; } m[s]++; v.push_back(s); } int ans1=-1; int ans2=-1; string ans1s; string ans2s; for(int i=0;i<v.size();i++){ if(ans1<m[v[i]]){ ans1=m[v[i]]; ans1s=v[i]; } if(ans2<v[i].size()){ ans2=v[i].size(); ans2s=v[i]; } } cout<<ans1s<<" "<<ans2s<<endl; }
a.cc: In function 'int main()': a.cc:8:5: error: 'vector' was not declared in this scope 8 | vector<string>v; | ^~~~~~ a.cc:4:1: note: 'std::vector' is defined in header '<vector>'; this is probably fixable by adding '#include <vector>' 3 | #include <map> +++ |+#include <vector> 4 | using namespace std; a.cc:8:18: error: expected primary-expression before '>' token 8 | vector<string>v; | ^ a.cc:8:19: error: 'v' was not declared in this scope 8 | vector<string>v; | ^
s174572294
p00029
C++
#include <string> #include <vector> #include <iostream> #include <sstream> #include <chrono> typedef struct LettersInfo { std::string letters; unsigned int count;?° } lettersInfo_s; int main() { std::string paramStr; std::getline(std::cin, paramStr); std::vector<lettersInfo_s*> lettersList; std::string letters; std::istringstream stream(paramStr); unsigned int maxLength = 0; std::string maxLengthStr; while (std::getline(stream, letters, ' ')) { unsigned int len = letters.size(); if ( len != 0) { if ( maxLength < len ) { maxLengthStr = letters; maxLength = len; } unsigned int loopCount; for (loopCount = 0; loopCount < lettersList.size(); loopCount++) { if ( lettersList[loopCount]->letters == letters ) { ++lettersList[loopCount]->count; break; } } if (loopCount == lettersList.size()) { lettersInfo_s* plettersInfo = new lettersInfo_s(); plettersInfo->letters = letters; ++plettersInfo->count; lettersList.push_back(plettersInfo); } } } unsigned int maxCount = 0; std::string maxCountStr; while( lettersList.size() > 0 ) { lettersInfo_s* plettersInfo = lettersList.erase(0); unsigned int count = plettersInfo->count; if (maxCount < count) { maxCountStr = plettersInfo->letters; maxCount = count; } delete plettersInfo; } std::cout << maxCountStr << " " << maxLengthStr << std::endl; return 0; }
a.cc:9:25: error: extended character ° is not valid in an identifier 9 | unsigned int count;?° | ^ a.cc:9:24: error: expected unqualified-id before '?' token 9 | unsigned int count;?° | ^ a.cc: In function 'int main()': a.cc:54:56: error: no matching function for call to 'std::vector<LettersInfo*>::erase(int)' 54 | lettersInfo_s* plettersInfo = lettersList.erase(0); | ~~~~~~~~~~~~~~~~~^~~ In file included from /usr/include/c++/14/vector:66, from a.cc:2: /usr/include/c++/14/bits/stl_vector.h:1536:7: note: candidate: 'std::vector<_Tp, _Alloc>::iterator std::vector<_Tp, _Alloc>::erase(const_iterator) [with _Tp = LettersInfo*; _Alloc = std::allocator<LettersInfo*>; iterator = std::vector<LettersInfo*>::iterator; const_iterator = std::vector<LettersInfo*>::const_iterator]' 1536 | erase(const_iterator __position) | ^~~~~ /usr/include/c++/14/bits/stl_vector.h:1536:28: note: no known conversion for argument 1 from 'int' to 'std::vector<LettersInfo*>::const_iterator' 1536 | erase(const_iterator __position) | ~~~~~~~~~~~~~~~^~~~~~~~~~ /usr/include/c++/14/bits/stl_vector.h:1564:7: note: candidate: 'std::vector<_Tp, _Alloc>::iterator std::vector<_Tp, _Alloc>::erase(const_iterator, const_iterator) [with _Tp = LettersInfo*; _Alloc = std::allocator<LettersInfo*>; iterator = std::vector<LettersInfo*>::iterator; const_iterator = std::vector<LettersInfo*>::const_iterator]' 1564 | erase(const_iterator __first, const_iterator __last) | ^~~~~ /usr/include/c++/14/bits/stl_vector.h:1564:7: note: candidate expects 2 arguments, 1 provided
s132038897
p00029
C++
#include <string> #include <vector> #include <iostream> #include <sstream> #include <chrono> typedef struct LettersInfo { std::string letters; unsigned int count;??° } lettersInfo_s; int main() { std::string paramStr; std::getline(std::cin, paramStr); std::vector<lettersInfo_s*> lettersList; std::string letters; std::istringstream stream(paramStr); unsigned int maxLength = 0; std::string maxLengthStr; while (std::getline(stream, letters, ' ')) { unsigned int len = letters.size(); if ( len != 0) { if ( maxLength < len ) { maxLengthStr = letters; maxLength = len; } unsigned int loopCount; for (loopCount = 0; loopCount < lettersList.size(); loopCount++) { if ( lettersList[loopCount]->letters == letters ) { ++lettersList[loopCount]->count; break; } } if (loopCount == lettersList.size()) { lettersInfo_s* plettersInfo = new lettersInfo_s(); plettersInfo->letters = letters; ++plettersInfo->count; lettersList.push_back(plettersInfo); } } } unsigned int maxCount = 0; std::string maxCountStr; while( lettersList.size() > 0 ) { lettersInfo_s* plettersInfo = lettersList.back(); unsigned int count = plettersInfo->count; if (maxCount < count) { maxCountStr = plettersInfo->letters; maxCount = count; } delete plettersInfo; lettersList.pop_back(); } std::cout << maxCountStr << " " << maxLengthStr << std::endl; return 0; }
a.cc:9:26: error: extended character ° is not valid in an identifier 9 | unsigned int count;??° | ^ a.cc:9:24: error: expected unqualified-id before '?' token 9 | unsigned int count;??° | ^
s305834587
p00029
C++
#include <stdio.h> #include <string.h> #define TEXT_MAXNUM 1000 #define WORD_MAXNUM 33 typedef struct tagStrings { char str[WORD_MAXNUM]; int length; int count; } Strings_t; void main( void ) { char inputString[TEXT_MAXNUM] = ""; Strings_t words[TEXT_MAXNUM / 2] = {{0}}; // words in text char tmpStr[WORD_MAXNUM] = {0}; // work int wordNum = 0; // record word num int readIdx = 0; // text read pointer int readWordCount = 0; // readding word length while( readIdx < TEXT_MAXNUM ) { if( inputString[readIdx] == '\0' ) { // end text // @todo break; } tmpStr[readWordCount] = inputString[readIdx]; // read char if( tmpStr[readWordCount] == ' ' ) { // space -> partition word if( readWordCount ) { tmpStr[readWordCount] = '\0'; // word grep & record int i=0; for( i; i < wordNum; i++) { if( strcmp(words[i].str, tmpStr) == 0 ) { // recorded words[i].count++; break; } } if( i >= wordNum ) { // new record strcpy(words[wordNum].str, tmpStr); words[wordNum].length = readWordCount; words[wordNum].count = 1; wordNum++; // record num +1 } readWordCount = 0; } // not readding word -> next read readIdx++; } else { readWordCount++; readIdx++; } } // most, max index int maxLenIdx = 0; int mostIdx = 0; for( int i = 0; i < wordNum; i++) { int maxMost = 0; int maxLen = 0; if( maxMost < words[i].count ) { maxMost = words[i].count; mostIdx = i; } if( maxLen < words[i].length ) { maxLen = words[i].length; maxLenIdx = i; } } // dump printf("%s %s\n", words[mostIdx].str, words[maxLenIdx].str); return; }
a.cc:14:1: error: '::main' must return 'int' 14 | void main( void ) | ^~~~ a.cc: In function 'int main()': a.cc:92:9: error: return-statement with no value, in function returning 'int' [-fpermissive] 92 | return; | ^~~~~~
s265348812
p00029
C++
#include<iostream> #include<map> #include<string> using namespace std; int main(){ string b,mx; map<string,int> d; while(cin>>b){ d[b]++; if(b.size()>mx.size())mx=b; } cout<<max_element(d.begin(),d.end())->first<<" "<<mx<<endl; return 0; }
a.cc: In function 'int main()': a.cc:10:15: error: 'max_element' was not declared in this scope 10 | cout<<max_element(d.begin(),d.end())->first<<" "<<mx<<endl; | ^~~~~~~~~~~
s088047968
p00029
C++
#include <iostream> using namespace std; int main(){ string str[1000]; int appear[1000]; int i, j, n=0; int maxlen, maxleni; int maxappear, maxappeari; while(cin>>string[n]){ for(i=0; i<string[n].size(); i++) string[n][i]=tolower(string[n][i]); n++; } maxlen=0; for(i=0; i<n; i++){ if(maxlen<string[i].size()){ maxlen=string[i].size(); maxleni=i; } } for(i=0; i<n; i++) appear[i]=0; for(i=0; i<n; i++){ if(string[i].empty()) continue; for(j=i+1; j<n; j++) if(string[i]==string[j]){ appear[i]++; string[j][0]='\0'; } } maxappear=0; for(i=0; i<n; i++){ if(maxappear<appear[i]){ maxappear=appear[i]; maxappeari=i; } } cout<<string[maxappeari]<<" "<<string[maxlen]<<endl; return 0; }
a.cc: In function 'int main()': a.cc:11:20: error: expected primary-expression before '[' token 11 | while(cin>>string[n]){ | ^ a.cc:12:22: error: expected primary-expression before '[' token 12 | for(i=0; i<string[n].size(); i++) string[n][i]=tolower(string[n][i]); | ^ a.cc:12:45: error: structured binding declaration cannot have type 'std::string' {aka 'std::__cxx11::basic_string<char>'} 12 | for(i=0; i<string[n].size(); i++) string[n][i]=tolower(string[n][i]); | ^~~ a.cc:12:45: note: type must be cv-qualified 'auto' or reference to cv-qualified 'auto' a.cc:12:48: error: expected initializer before '[' token 12 | for(i=0; i<string[n].size(); i++) string[n][i]=tolower(string[n][i]); | ^ a.cc:12:48: error: expected ';' before '[' token a.cc:17:21: error: expected primary-expression before '[' token 17 | if(maxlen<string[i].size()){ | ^ a.cc:18:20: error: expected primary-expression before '[' token 18 | maxlen=string[i].size(); | ^ a.cc:24:14: error: expected unqualified-id before '[' token 24 | if(string[i].empty()) continue; | ^ a.cc:26:16: error: expected unqualified-id before '[' token 26 | if(string[i]==string[j]){ | ^ a.cc:28:15: error: structured binding declaration cannot have type 'std::string' {aka 'std::__cxx11::basic_string<char>'} 28 | string[j][0]='\0'; | ^~~ a.cc:28:15: note: type must be cv-qualified 'auto' or reference to cv-qualified 'auto' a.cc:28:18: error: expected initializer before '[' token 28 | string[j][0]='\0'; | ^ a.cc:28:18: error: expected ';' before '[' token a.cc:38:15: error: expected primary-expression before '[' token 38 | cout<<string[maxappeari]<<" "<<string[maxlen]<<endl; | ^ a.cc:38:40: error: expected primary-expression before '[' token 38 | cout<<string[maxappeari]<<" "<<string[maxlen]<<endl; | ^
s304285547
p00029
C++
#include<cstdio> #include<cstring> #include<string> using namespace std; string s[1001]; int count[1001]; int main(void){ char temp[1001]; while(gets(temp) != 0){ int temp_n = strlen(temp); int c = 0; int max_h = 0; int max_H = 0; int max_l = 0; int max_L = 0; for(int i = 0; i < 1001; i++){ s[i] = ""; count[i] = 0; } for(int i = 0; i < temp_n; i++){ for(int j = i; ; j++){ if(temp[j] == ' '){ i=j; c++; break; }else if(temp[j] == '\0'){ i=j; c++; break; } s[c] += temp[j]; } } for(int i = 0; i < c; i++){ for(int j = 0; j < c; j++){ if(i == j)continue; if(s[i] == s[j])count[i]++; } } for(int i = 0 ; i < c; i++){ if(s[i].size() > max_L)max_l = i; if(count[i] > max_H)max_h = i; } printf("%s %s\n", s[max_h].c_str(), s[max_l].c_str() ); } return 0; }
a.cc: In function 'int main()': a.cc:13:15: error: 'gets' was not declared in this scope; did you mean 'getw'? 13 | while(gets(temp) != 0){ | ^~~~ | getw
s668783660
p00029
C++
#include<iostream> #include<string> #include<map> int main(){std::map<string,int>m;string s,t,u;for(;cin>>s;s.length()>u.length()?u=s:u)++m[s]>m[t]?t=s:s;std::cout<<t<<" "<<u<<"\n";}
a.cc: In function 'int main()': a.cc:4:21: error: 'string' was not declared in this scope 4 | int main(){std::map<string,int>m;string s,t,u;for(;cin>>s;s.length()>u.length()?u=s:u)++m[s]>m[t]?t=s:s;std::cout<<t<<" "<<u<<"\n";} | ^~~~~~ a.cc:4:21: note: suggested alternatives: In file included from /usr/include/c++/14/iosfwd:41, from /usr/include/c++/14/ios:40, from /usr/include/c++/14/ostream:40, from /usr/include/c++/14/iostream:41, from a.cc:1: /usr/include/c++/14/bits/stringfwd.h:77:33: note: 'std::string' 77 | typedef basic_string<char> string; | ^~~~~~ In file included from /usr/include/c++/14/bits/locale_classes.h:40, from /usr/include/c++/14/bits/ios_base.h:41, from /usr/include/c++/14/ios:44: /usr/include/c++/14/string:76:11: note: 'std::pmr::string' 76 | using string = basic_string<char>; | ^~~~~~ a.cc:4:31: error: template argument 1 is invalid 4 | int main(){std::map<string,int>m;string s,t,u;for(;cin>>s;s.length()>u.length()?u=s:u)++m[s]>m[t]?t=s:s;std::cout<<t<<" "<<u<<"\n";} | ^ a.cc:4:31: error: template argument 3 is invalid a.cc:4:31: error: template argument 4 is invalid a.cc:4:40: error: expected ';' before 's' 4 | int main(){std::map<string,int>m;string s,t,u;for(;cin>>s;s.length()>u.length()?u=s:u)++m[s]>m[t]?t=s:s;std::cout<<t<<" "<<u<<"\n";} | ^~ | ; a.cc:4:52: error: 'cin' was not declared in this scope; did you mean 'std::cin'? 4 | int main(){std::map<string,int>m;string s,t,u;for(;cin>>s;s.length()>u.length()?u=s:u)++m[s]>m[t]?t=s:s;std::cout<<t<<" "<<u<<"\n";} | ^~~ | std::cin /usr/include/c++/14/iostream:62:18: note: 'std::cin' declared here 62 | extern istream cin; ///< Linked to standard input | ^~~ a.cc:4:57: error: 's' was not declared in this scope 4 | int main(){std::map<string,int>m;string s,t,u;for(;cin>>s;s.length()>u.length()?u=s:u)++m[s]>m[t]?t=s:s;std::cout<<t<<" "<<u<<"\n";} | ^ a.cc:4:70: error: 'u' was not declared in this scope 4 | int main(){std::map<string,int>m;string s,t,u;for(;cin>>s;s.length()>u.length()?u=s:u)++m[s]>m[t]?t=s:s;std::cout<<t<<" "<<u<<"\n";} | ^ a.cc:4:96: error: 't' was not declared in this scope 4 | int main(){std::map<string,int>m;string s,t,u;for(;cin>>s;s.length()>u.length()?u=s:u)++m[s]>m[t]?t=s:s;std::cout<<t<<" "<<u<<"\n";} | ^ a.cc:4:116: error: 't' was not declared in this scope 4 | int main(){std::map<string,int>m;string s,t,u;for(;cin>>s;s.length()>u.length()?u=s:u)++m[s]>m[t]?t=s:s;std::cout<<t<<" "<<u<<"\n";} | ^ a.cc:4:124: error: 'u' was not declared in this scope 4 | int main(){std::map<string,int>m;string s,t,u;for(;cin>>s;s.length()>u.length()?u=s:u)++m[s]>m[t]?t=s:s;std::cout<<t<<" "<<u<<"\n";} | ^
s879333167
p00029
C++
#include<iostream> #include<map> #include<string> #include<stdio.h> using namespace std; bool compare(const pair<string, int> T1, const pair<string, int> T2) { return T1.second < T2.second; } int main (void){ string str,maxByLength(""); //map<int,string> X; //•¶Žš‚Ì’·‚³ map<string,int> Y; //•¶Žš‚̐” //int mm; while (cin>>str){ if (str.size()>maxByLength.size()) maxByLength=str; Y[str]++; } // string maxByCount(""); // int cnt = 0; pair<string, int> maxCountPair = *max_element(Y.begin(), Y.end(), compare); // cout << (*Y.rbegin()).first << " " << maxByLength << endl; // cout << maxByCount << " " << maxByLength << endl; cout << maxCountPair.first << " " << maxByLength << endl; return 0; }
a.cc: In function 'int main()': a.cc:25:43: error: 'max_element' was not declared in this scope 25 | pair<string, int> maxCountPair = *max_element(Y.begin(), Y.end(), compare); | ^~~~~~~~~~~
s868005264
p00029
C++
#include <iostream> #include <string> #include <map> #include <vector> using namespace std; int main(){ // word[s] ‚Å •¶Žš—ñs‚̏oŒ»‰ñ”‚ª•Ô‚Á‚Ä‚­‚é map<string, int> word; vector<string> v; string s; int max=0,length=0; while( cin >> s ){ v.push_back(s); //“ü—Í‚µ‚½’PŒê‚ª‚·‚łɂ ‚é‚©’T‚· if( word.count(s) ){ word[s]++; }else{ word[s] = 1; } } // Å•po‚Ì’PŒê‚𒲂ׂé int mode=0; for(int i=0 ; i < v.size() ; i++ ){ mode = max( mode , word[ v[i] ] ); } for(int i=0 ; i < v.size() ; i++ ){ if( mode == word[ v[i] ] ){ cout << v[i]; } } // Å’·‚Ì’PŒê‚ð‹‚ß‚é int length = 0; for(int i=0 ; i < v.size() ; i++ ){ length = max( length , v[i].size() ); } for(int i=0 ; i < v.size() ; i++ ){ if( length == v[i].size() ){ cout << " " << v[i] << endl; } } }
a.cc: In function 'int main()': a.cc:27:27: error: 'max' cannot be used as a function 27 | mode = max( mode , word[ v[i] ] ); | ~~~^~~~~~~~~~~~~~~~~~~~~~~ a.cc:35:13: error: redeclaration of 'int length' 35 | int length = 0; | ^~~~~~ a.cc:12:19: note: 'int length' previously declared here 12 | int max=0,length=0; | ^~~~~~ a.cc:37:29: error: 'max' cannot be used as a function 37 | length = max( length , v[i].size() ); | ~~~^~~~~~~~~~~~~~~~~~~~~~~~
s577580365
p00029
C++
#include <iostream> #include <string> #include <map> #include <vector> using namespace std; int main(){ // word[s] ‚Å •¶Žš—ñs‚̏oŒ»‰ñ”‚ª•Ô‚Á‚Ä‚­‚é map<string, int> word; vector<string> v; string s; while( cin >> s ){ v.push_back(s); //“ü—Í‚µ‚½’PŒê‚ª‚·‚łɂ ‚é‚©’T‚· if( word.count(s) ){ word[s]++; }else{ word[s] = 1; } } // Å•po‚Ì’PŒê‚𒲂ׂé int mode=0; for(int i=0 ; i < v.size() ; i++ ){ mode = max( mode , word[ v[i] ] ); } for(int i=0 ; i < v.size() ; i++ ){ if( mode == word[ v[i] ] ){ cout << v[i]; } } // Å’·‚Ì’PŒê‚ð‹‚ß‚é int length = 0; for(int i=0 ; i < v.size() ; i++ ){ length = max( length , v[i].size() ); } for(int i=0 ; i < v.size() ; i++ ){ if( length == v[i].size() ){ cout << " " << v[i] << endl; } } }
a.cc: In function 'int main()': a.cc:36:29: error: no matching function for call to 'max(int&, std::__cxx11::basic_string<char>::size_type)' 36 | length = max( length , v[i].size() ); | ~~~^~~~~~~~~~~~~~~~~~~~~~~~ In file included from /usr/include/c++/14/string:51, from /usr/include/c++/14/bits/locale_classes.h:40, from /usr/include/c++/14/bits/ios_base.h:41, from /usr/include/c++/14/ios:44, from /usr/include/c++/14/ostream:40, from /usr/include/c++/14/iostream:41, from a.cc:1: /usr/include/c++/14/bits/stl_algobase.h:257:5: note: candidate: 'template<class _Tp> constexpr const _Tp& std::max(const _Tp&, const _Tp&)' 257 | max(const _Tp& __a, const _Tp& __b) | ^~~ /usr/include/c++/14/bits/stl_algobase.h:257:5: note: template argument deduction/substitution failed: a.cc:36:29: note: deduced conflicting types for parameter 'const _Tp' ('int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'}) 36 | length = max( length , v[i].size() ); | ~~~^~~~~~~~~~~~~~~~~~~~~~~~ /usr/include/c++/14/bits/stl_algobase.h:303:5: note: candidate: 'template<class _Tp, class _Compare> constexpr const _Tp& std::max(const _Tp&, const _Tp&, _Compare)' 303 | max(const _Tp& __a, const _Tp& __b, _Compare __comp) | ^~~ /usr/include/c++/14/bits/stl_algobase.h:303:5: note: candidate expects 3 arguments, 2 provided
s702824235
p00029
C++
#include <iostream> #include <string> #include <vector> #include <map> #include <algorithm> #include <boost/algorithm/string.hpp> #include <cstdint> typedef std::map<std::string, std::uint32_t> OccurenceWordMap; class compare_second { typedef OccurenceWordMap::value_type value_type; public: bool operator()(value_type const& lhs, value_type const& rhs) const { return lhs.second < rhs.second; } }; class compare_length { typedef std::string value_type; public: bool operator()(value_type const& lhs, value_type const& rhs) const { return lhs.length() < rhs.length(); } }; int main() { std::string input_text; std::getline(std::cin, input_text); typedef std::vector<std::string> StringVec; StringVec word_vec; boost::algorithm::split(word_vec, input_text, boost::algorithm::is_space()); OccurenceWordMap ow_map; for (std::string const& word : word_vec) { auto i = ow_map.lower_bound(word); if (i != ow_map.end() && !(ow_map.key_comp()(word, i->first))) { ++i->second; } else { ow_map.emplace(word, 0); } } std::cout << std::max_element(ow_map.begin(), ow_map.end(), compare_second())->first << ' ' << *std::max_element(word_vec.begin(), word_vec.end(), compare_length()) << std::endl; return 0; }
a.cc:6:10: fatal error: boost/algorithm/string.hpp: No such file or directory 6 | #include <boost/algorithm/string.hpp> | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~ compilation terminated.
s698846141
p00029
C++
#include<iostream> #include<map> #include<algorithm> using namespace std; int main(void){ char s[1001][33]; map<string,int>wd; int i=0; while(~scanf("%s",&s[i][0])){i++;} for(int j=0;j<i;j++) wd[s[j]]=0; for(int j=0;j<i;j++) wd[s[j]]++; int ans=0,len=0; for(int j=0;j<i;j++){ ans=max(wd[s[j]],ans); len=max(len,(int)strlen(&s[j][0])); } string s1,s2; for(int j=0;j<i;j++){ if(ans==wd[s[j]])s1=s[j]; if(len==strlen(s[j]))s2=s[j]; } cout << s1 << " " << s2 << endl; return 0; }
a.cc: In function 'int main()': a.cc:23:22: error: 'strlen' was not declared in this scope 23 | len=max(len,(int)strlen(&s[j][0])); | ^~~~~~ a.cc:4:1: note: 'strlen' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>' 3 | #include<algorithm> +++ |+#include <cstring> 4 | a.cc:29:13: error: 'strlen' was not declared in this scope 29 | if(len==strlen(s[j]))s2=s[j]; | ^~~~~~ a.cc:29:13: note: 'strlen' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
s543744988
p00029
C++
#include <cstdio> #include <cstdlib> #include <cstring> #include <iostream> using namespace std; const int M = 33; const int N = 1001; char text[N]; char word[N][M]; char tmp[M], ansm[M], ansl[M]; void solve(char text[]) { qsort(word, k, sizeof(word[0]), cmp); int maxs = -1; int cnt = 1; strcpy(tmp, word[0]); strcpy(ansl, word[0]); int maxl = strlen(word[0]); for (int i=1; i<k; ++i) { if (maxl < strlen(word[i])) maxl = strlen(word[i]), strcpy(ansl, word[i]); if (!strcmp(tmp, word[i])) ++cnt; else { if (maxs < cnt) { maxs = cnt; strcpy(ansm, tmp); } cnt = 1; strcpy(tmp, word[i]); } } if (maxs < cnt) strcpy(ansm, tmp); } int main() { int i = 0; while (scanf("%s", word[i++]) != EOF); solve(i); cout<<ansm<<" "<<ansl<<endl; return 0; }
a.cc: In function 'void solve(char*)': a.cc:16:21: error: 'k' was not declared in this scope 16 | qsort(word, k, sizeof(word[0]), cmp); | ^ a.cc:16:41: error: 'cmp' was not declared in this scope; did you mean 'tmp'? 16 | qsort(word, k, sizeof(word[0]), cmp); | ^~~ | tmp a.cc: In function 'int main()': a.cc:40:15: error: invalid conversion from 'int' to 'char*' [-fpermissive] 40 | solve(i); | ^ | | | int a.cc:15:17: note: initializing argument 1 of 'void solve(char*)' 15 | void solve(char text[]) { | ~~~~~^~~~~~
s307680467
p00029
C++
#include <iostream> #include <string> #include <map> using namespace std; int main(){ string str,s,mls,mcs,input[32]; map <string,int> dic; int n,c,a,ml,mc; getline(cin,str) c = a = mc = ml = 0; str += ' '; while(str.length()){ n = str.find(' '); s = str[c]; ++c; for(;c < n;++c){ s += str[c]; } str.erase(0,n+1); c = 0; input[a] = s; ++a; ++dic[s]; if(s.length() > ml) { ml = s.length(); mls = s; } } for(int i = 0;i < a;++i){ if(mc < dic[input[i]]){ mc = dic[input[i]]; mcs = input[i]; } cout << mcs << " " << mls << endl; } return 0; }
a.cc: In function 'int main()': a.cc:9:21: error: expected ';' before 'c' 9 | getline(cin,str) | ^ | ; 10 | c = a = mc = ml = 0; | ~
s440525671
p00029
C++
#include <iostream> #include <string> #include <algorithm> using namespace std; typedef pair<int,string> P; int main(void) { char c; string str,maxstr; P d[1001] = {}; while(scanf("%c", &c), c != '\n'){ if(c != ' '){ str += c; } else { if(strlen(str.c_str()) > strlen(maxstr.c_str())){ maxstr.clear(); maxstr = str; } int i; for(i = 0; d[i].first != 0; i++){ if(d[i].second == str){ d[i].first++; break; } } if(d[i].first == 0){ d[i] = P(1,str); } str.clear(); } } if(strlen(str.c_str()) > strlen(maxstr.c_str())){ maxstr.clear(); maxstr = str; } int i; for(i = 0; d[i].first != 0; i++){ if(d[i].second == str){ d[i].first++; break; } } if(d[i].first == 0){ d[i] = P(1,str); } str.clear(); sort(d,d+1001); cout << d[1000].second << ' ' << maxstr << endl; return 0; }
a.cc: In function 'int main()': a.cc:20:28: error: 'strlen' was not declared in this scope 20 | if(strlen(str.c_str()) > strlen(maxstr.c_str())){ | ^~~~~~ a.cc:4:1: note: 'strlen' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>' 3 | #include <algorithm> +++ |+#include <cstring> 4 | using namespace std; a.cc:37:12: error: 'strlen' was not declared in this scope 37 | if(strlen(str.c_str()) > strlen(maxstr.c_str())){ | ^~~~~~ a.cc:37:12: note: 'strlen' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
s153896097
p00029
C++
#include<iostream> #include<cstring> #include<algorithm> using namespace std; char a[1010][100]; char b[10000]; int main() { int i,j,l,s,m,n,p,k,s1,s2; while(gets(b)) { l=strlen(b); j=0;p=0;n=0;s=0; for(i=0;i<l;i++) { if(b[i]!=' ') { char t=b[i]; a[j][p++]=b[i]; } else { // cout<<p<<" --"<<endl; if(p>n) { n=p; m=j; } j++; p=0; } } if(p>n) { n=p; m=j; } int t=0; for(i=0;i<=j;i++) { s=0; for(s1=0;s1<=j;s1++) { if(strcmp(a[i],a[s1])==0) s++; } if(s>t) { t=s; s2=i; } } cout<<a[s2]<<" "<<a[m]<<endl; } }
a.cc: In function 'int main()': a.cc:10:15: error: 'gets' was not declared in this scope; did you mean 'getw'? 10 | while(gets(b)) | ^~~~ | getw
s906107638
p00029
C++
#include<stdio.h> #include<string.h> char str[33]; int lmax=0; char mword[33]; typedef struct{ char word[33]; int time; }data; data d[1000]; int cd=0; int i; int main(){ while(scanf("%s",str)!=EOF){ if(strlen(str)>lmax){ lmax=strlen(str); strcpy(mword,str); } for(i=0;i<cd;i++)if(strcmp(d[i].word,str)==0){ d[i].time++; break; } if(i==cd){ strcpy(d[cd].word,str); d[cd++].time=1; } } } int fm=0; for(i=0;i<cd;i++)if(d[i].time>d[fm].time)fm=i; printf("%s %s\n",d[fm].word,mword); }
a.cc:30:9: error: expected unqualified-id before 'for' 30 | for(i=0;i<cd;i++)if(d[i].time>d[fm].time)fm=i; | ^~~ a.cc:30:17: error: 'i' does not name a type 30 | for(i=0;i<cd;i++)if(d[i].time>d[fm].time)fm=i; | ^ a.cc:30:22: error: 'i' does not name a type 30 | for(i=0;i<cd;i++)if(d[i].time>d[fm].time)fm=i; | ^ a.cc:31:15: error: expected constructor, destructor, or type conversion before '(' token 31 | printf("%s %s\n",d[fm].word,mword); | ^ a.cc:32:1: error: expected declaration before '}' token 32 | } | ^
s565522505
p00029
C++
#include<iostream> #include<string> #include<functional> #include<algorithm> using namespace std; //文章が与えられた時、出現頻度の高い単語と最長の単語を出力するもの。 //文章に現れる単語リストを作ってそれぞれの文字列をカウントすればよい。 int main(){ string sentence[1000]; int sentenceNum[1000]; int array[1000]; string input; int count = 0; bool flag; //単語リストから単語が見つかったどうか int maxLength = 0; for(int i=0; i < 1000; i++) sentenceNum[i] = 0; while(cin >> input){ flag = false; //count == 0 文頭の単語の処理 if(!count){ sentence[0] = input; sentenceNum[0]++; count++; int inputSize = input.size(); maxLength = max(maxLength, inputSize); } //文頭でない場合 else { for(int i=0; i < count; i++){ if(sentence[i] == input){ sentenceNum[i]++; flag = true; break; } } if(!flag){ sentence[count] = input; sentenceNum[count]++; count++; int inputSize = input.size(); maxLength = max(maxLength, inputSize); } } } for(int i=0; i < 1000; i++) array[i] = sentenceNum[i]; sort(array, array+1000, greater<int>()); for(int i=0; i< count; i++){ if(array[0] == sentenceNum[i]){ cout << sentence[i]; } } for(int i=0; i< count; i++){ int sentenceSize = sentence[i].size(); if(maxLength == sentenceSize){ cout << " " << sentence[i] << endl; } } }
a.cc:16:19: error: extended character   is not valid in an identifier 16 | bool flag; //単語リストから単語が見つかったどうか | ^ a.cc: In function 'int main()': a.cc:16:19: error: '\U00003000' was not declared in this scope 16 | bool flag; //単語リストから単語が見つかったどうか | ^~ a.cc:30:25: error: 'maxLength' was not declared in this scope 30 | maxLength = max(maxLength, inputSize); | ^~~~~~~~~ a.cc:47:33: error: 'maxLength' was not declared in this scope 47 | maxLength = max(maxLength, inputSize); | ^~~~~~~~~ a.cc:63:20: error: 'maxLength' was not declared in this scope 63 | if(maxLength == sentenceSize){ | ^~~~~~~~~