alexjercan/bugnet huggingface dataset:
Problem p02417 (C++) — buggy submission, verdict: Time Limit Exceeded

#include <iostream>
using namespace std;

int main() {
  int num[26] = {0};
  char input, res;

  while (cin >> input) {

    if (input >= 65 && input <= 90)
      num[input - 65]++;
    else if (input >= 97 && input <= 122)
      num[input - 97]++;
  }

  for (int i = 0; i < 26; i++) {
    res = 'a' + i;
    cout << res << " : " << num[i] << endl;
  }
}

Error: TLE

Fixed submission:

#include <stdio.h>
using namespace std;

int main() {
  int num[26] = {0};
  while (1) {
    char input;
    scanf("%c", &input);

    if (input == 0)
      break;

    if (input >= 65 && input <= 90)
      num[input - 65]++;
    else if (input >= 97 && input <= 122)
      num[input - 97]++;
  }

  for (int i = 0; i < 26; i++)
    printf("%c : %d\\n", 97 + i, num[i]);
}
Problem p02417 (C++) — buggy submission, verdict: Time Limit Exceeded

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

int main() {
  char c;
  int a[26] = {0};
  char d[26] = {'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i',
                'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r',
                's', 't', 'u', 'v', 'w', 'x', 'y', 'z'};
  int b, i;
  while (scanf("%c", &c) != EOF) {
    if (c >= 'a' && c <= 'z') {
      b = c - 'a';
      a[b]++;
    } else if (c >= 'A' && c <= 'Z') {
      b = c - 'A';
      a[b]++;
    }
  }
  for (i = 0; i < 26; i++) {
    cout << d[i] << " : " << a[i] << endl;
  }
}

Error: TLE

Fixed submission:

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

int main() {
  char c;
  int a[26] = {0};
  char d[26] = {'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i',
                'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r',
                's', 't', 'u', 'v', 'w', 'x', 'y', 'z'};
  int b, i;
  while (scanf("%c", &c) && c != EOF) {
    if (c >= 'a' && c <= 'z') {
      b = c - 'a';
      a[b]++;
    } else if (c >= 'A' && c <= 'Z') {
      b = c - 'A';
      a[b]++;
    }
  }
  for (i = 0; i < 26; i++) {
    cout << d[i] << " : " << a[i] << endl;
  }
}
Problem p02417 (C++) — buggy submission, verdict: Time Limit Exceeded

#include <iostream>

int main() {
  char c;
  int n[26]{};
  while (std::cin >> c) {
    if ('A' <= c && c <= 'Z')
      ++n[c - 'A'];
    else if ('a' <= c && c <= 'z')
      ++n[c - 'a'];
  }
  for (int i = 0; i != 26; ++i)
    std::cout << char('a' + i) << " : " << n[i] << '\\n';
}

Error: TLE

Fixed submission:

#include <iostream>

int main() {
  char c;
  int n[26]{};
  while (1) {
    std::cin >> c;
    if (c == '0')
      break;
    if ('A' <= c && c <= 'Z')
      ++n[c - 'A'];
    else if ('a' <= c && c <= 'z')
      ++n[c - 'a'];
  }
  for (int i = 0; i != 26; ++i)
    std::cout << char('a' + i) << " : " << n[i] << '\\n';
}
Problem p02417 (C++) — buggy submission, verdict: Runtime Error

#include <bits/stdc++.h>
#include <iostream>
using namespace std;
int main(void) {
  // Your code here! sakuraihaaho
  string x;
  int hai[26] = {};
  while (getline(cin, x)) {
    for (int i = 0; i < x.size(); i++) {
      if ((int)x.at(i) >= (int)'a' && (int)x.at(i) <= (int)'z')
        hai[x.at(i) - (int)'a'] += 1;
      else if ((int)x.at(i) >= (int)'A' && (int)x.at(i) <= (int)'Z')
        hai[x.at(i) - (int)'A'] += 1;
    }
  }
  for (int i = 0; i < 26; i++) {
    cout << (char)('a' + i) << " : " << hai[i] << endl;
  }
  return 0;
}


Error: 0

Fixed submission:

#include <bits/stdc++.h>
#include <iostream>
using namespace std;
int main(void) {
  // Your code here! sakuraihaaho
  string x;
  int hai[26] = {};
  while (getline(cin, x)) {
    for (int i = 0; i < x.size(); i++) {
      if ((int)x.at(i) >= (int)'a' && (int)x.at(i) <= (int)'z')
        hai[x.at(i) - (int)'a'] += 1;
      else
        hai[x.at(i) - (int)'A'] += 1;
    }
  }
  for (int i = 0; i < 26; i++) {
    cout << (char)('a' + i) << " : " << hai[i] << endl;
  }
  return 0;
}
Problem p02417 (C++) — buggy submission, verdict: Time Limit Exceeded

#include <algorithm>
#include <cctype>
#include <cstdio>
#include <iostream>
#include <stack>
#include <string>
#include <vector>

#define REP(i, n) for (int i = 0; i < n; i++)
#define REPR(i, n) for (int i = n; i >= 0; i--)
#define FOR(i, m, n) for (int i = m; i < n; i++)
#define FORR(i, m, n) for (int i = m; i >= n; i--)
#define llong long long
#define INF 999999999
#define pb(a) push_back(a)

using namespace std;

vector<string> split(string str, char delim) {
  vector<string> res;
  size_t current = 0, found;
  while ((found = str.find_first_of(delim, current)) != string::npos) {
    string tmp = string(str, current, found - current);
    res.push_back(tmp);
    current = found + 1;
  }
  string tmp = string(str, current, found - current);
  tmp.replace(tmp.size() - 1, tmp.size(), "\\0");
  res.push_back(string(str, current, str.size() - current));
  return res;
}

char *StrToLower(char *s) {
  char *p;
  for (p = s; *p; p++) {
    *p = tolower(*p);
  }
  return s;
}

int main() {
  int cnt[26] = {0};
  char cstr[1201];
  bool isEnd = false;

  while (cin >> cstr) {
    string str = cstr;
    string word = StrToLower(cstr);

    REP(i, str.size()) {
      cnt[cstr[i] - 'a']++;
      if (cin.eof()) {
        isEnd = true;
        break;
      }
    }

    if (isEnd)
      break;
  }

  REP(i, 26) { printf("%c : %d\\n", 'a' + i, cnt[i]); }
}

Error: TLE

Fixed submission:

#include <algorithm>
#include <cctype>
#include <cstdio>
#include <iostream>
#include <stack>
#include <string>
#include <vector>

#define REP(i, n) for (int i = 0; i < n; i++)
#define REPR(i, n) for (int i = n; i >= 0; i--)
#define FOR(i, m, n) for (int i = m; i < n; i++)
#define FORR(i, m, n) for (int i = m; i >= n; i--)
#define llong long long
#define INF 999999999
#define pb(a) push_back(a)

using namespace std;

vector<string> split(string str, char delim) {
  vector<string> res;
  size_t current = 0, found;
  while ((found = str.find_first_of(delim, current)) != string::npos) {
    string tmp = string(str, current, found - current);
    res.push_back(tmp);
    current = found + 1;
  }
  string tmp = string(str, current, found - current);
  tmp.replace(tmp.size() - 1, tmp.size(), "\\0");
  res.push_back(string(str, current, str.size() - current));
  return res;
}

char *StrToLower(char *s) {
  char *p;
  for (p = s; *p; p++) {
    *p = tolower(*p);
  }
  return s;
}

int main() {
  int cnt[26] = {0};

  while (1) {
    char cstr[1201];
    bool isEnd = false;
    cin >> cstr;

    string str = cstr;
    string word = StrToLower(cstr);

    REP(i, str.size()) {
      cnt[cstr[i] - 'a']++;
      if (cstr[i] == '.') {
        isEnd = true;
        break;
      }
    }

    if (isEnd)
      break;
  }

  REP(i, 26) { printf("%c : %d\\n", 'a' + i, cnt[i]); }
}
Problem p02417 (C++) — buggy submission, verdict: Runtime Error

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

int main(void) {

  int counter[256];
  string ch;
  char c;

  for (c = 'a'; c <= 'z'; c++) {
    counter[c] = 0;
  }

  while (cin >> ch) {
    for (int i = 0; i < (int)ch.size(); i++) {
      if (isupper(ch[i]))
        ch[i] = tolower(ch[i]);
      counter[ch[i]]++;
    }
  }

  for (c = 'a'; c <= 'z'; c++) {
    cout << c << " : " << counter[c] << endl;
  }

  return 0;
}


Error: 0

Fixed submission:

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

int main(void) {

  int counter[26];
  string ch;
  char c;

  for (c = 'a'; c <= 'z'; c++) {
    counter[c] = 0;
  }

  while (cin >> ch) {
    for (int i = 0; i < (int)ch.size(); i++) {
      if (isupper(ch[i]))
        ch[i] = tolower(ch[i]);
      counter[ch[i]]++;
    }
  }

  for (c = 'a'; c <= 'z'; c++) {
    cout << c << " : " << counter[c] << endl;
  }

  return 0;
}
Problem p02417 (C++) — buggy submission, verdict: Runtime Error

#include <stdio.h>
int c[1201];

int main(void) {
  char ch;
  while (scanf("%c", &ch) != EOF) {
    if ('a' <= ch && ch <= 'z') {
      c[ch - 'a']++;
    } else if ('A' <= ch && ch <= 'Z') {
      c[ch - 'A']++;
    }
  }
  for (int i = 0; i < 26; i++) {
    printf("%c : %d\\n", 'a' + i, c[i]);
  }
  return 0;
}


Error: -11

Fixed submission:

#include <stdio.h>
int c[26];

int main(void) {
  int n;
  char ch;
  while (1) {
    scanf("%c", &ch);
    if (ch == '\\n')
      break;
    n = ch - 'a';
    c[n]++;
    n = ch - 'A';
    c[n]++;
  }
  for (int i = 0; i < 26; i++) {
    printf("%c : %d\\n", 'a' + i, c[i]);
  }
  return 0;
}
Problem p02417 (C++) — buggy submission, verdict: Time Limit Exceeded

#include <algorithm>
#include <bits/stdc++.h>
#include <cmath>
#include <ctype.h>
#include <iostream>
#include <string>
#include <vector>

#define REP(i, n) for (int i = 0; i < (int)(n); i++)
#define ALL(x) (x).begin(), (x).end()
#define square(x) (x) * (x)

const int INF = 1e9;

using namespace std;

int main() {
  int count[26] = {0};
  string word;
  while (getline(cin, word) != NULL) {
    REP(i, word.size()) {
      char c = word[i];
      if ((c - 'a') >= 0 && (c - 'z') <= 0)
        c -= 0x20;
      c -= 'A';
      if (0 <= c && c <= 25)
        count[c]++;
    }
  }

  REP(i, 26) {
    char c = i + 'a';
    cout << c << " : " << count[i] << endl;
  }

  return 0;
}

Error: TLE

Fixed submission:

#include <algorithm>
#include <bits/stdc++.h>
#include <cmath>
#include <ctype.h>
#include <iostream>
#include <string>
#include <vector>

#define REP(i, n) for (int i = 0; i < (int)(n); i++)
#define ALL(x) (x).begin(), (x).end()
#define square(x) (x) * (x)

const int INF = 1e9;

using namespace std;

int main() {
  int count[26] = {0};
  string word;
  getline(cin, word);
  while (1) {
    REP(i, word.size()) {
      char c = word[i];
      if ((c - 'a') >= 0 && (c - 'z') <= 0)
        c -= 0x20;
      c -= 'A';
      if (0 <= c && c <= 25)
        count[c]++;
    }
    if (word[word.size() - 1] == '.')
      break;
  }

  REP(i, 26) {
    char c = i + 'a';
    cout << c << " : " << count[i] << endl;
  }

  return 0;
}
Problem p02417 (C++) — buggy submission, verdict: Time Limit Exceeded

#include <ctype.h>
#include <stdio.h>

int main(void) {
  char str;
  static int cnt[26];
  int ptr;

  while (scanf("%c", &str) != EOF) {

    if (isalpha(str)) {
      if (isupper(str))
        ptr = str - 'A';
      else
        ptr = str - 'a';
      cnt[ptr]++;
    }
  }

  for (int i = 0; i < 26; i++) {
    printf("%c : %d\\n", 'a' + i, cnt[i]);
  }

  return 0;
}

Error: TLE

Fixed submission:

#include <ctype.h>
#include <stdio.h>

int main(void) {
  char str;
  static int cnt[26];
  int ptr;

  while (true) {
    scanf("%c", &str);
    if (str == EOF)
      break;

    if (isalpha(str)) {
      if (isupper(str))
        ptr = str - 'A';
      else
        ptr = str - 'a';
      cnt[ptr]++;
    }
  }

  for (int i = 0; i < 26; i++) {
    printf("%c : %d\\n", 'a' + i, cnt[i]);
  }

  return 0;
}
Problem p02417 (C++) — buggy submission, verdict: Runtime Error

#include <iostream>
using namespace std;

int main() {
  char ch;
  int num, count[1200] = {0};

  while (cin >> ch) {
    num = ch - 'a';
    if ('A' <= ch && ch <= 'Z')
      count[ch - 'A']++;
    else
      count[num]++;
  }
  for (int i = 0; i < 26; i++)
    cout << char('a' + i) << " : " << count[i] << endl;
  return 0;
}


Error: WA

Fixed submission:

#include <iostream>
using namespace std;

int main() {
  char ch;
  int num, counter[num];

  while (cin >> ch) {
    num = ch - 'a';
    counter[num]++;
  }
  for (int i = 0; i < 26; i++)
    cout << char('a' + i) << " : " << counter[i] << endl;
  return 0;
}
Problem p02417 (C++) — buggy submission, verdict: Time Limit Exceeded

#include <iostream>
using namespace std;

int main(void) {
  int a[26] = {0};
  char text;
  while (cin >> text) {
    if (text >= 'a' && text <= 'z')
      a[text - 'a']++;
    if (text >= 'A' && text <= 'Z')
      a[text - 'A']++;
  }
  for (int i = 0; i < 26; i++) {
    cout << (char)(i + 'a') << " : " << a[i] << endl;
  }
  return 0;
}

Error: TLE

Fixed submission:

#include <iostream>
using namespace std;

int main(void) {
  int a[26] = {0};
  char text;
  while (true) {
    cin >> text;
    if (text >= 'a' && text <= 'z')
      a[text - 'a']++;
    if (text >= 'A' && text <= 'Z')
      a[text - 'A']++;
  }
  for (int i = 0; i < 26; i++) {
    cout << (char)(i + 'a') << " : " << a[i] << endl;
  }
  return 0;
}
Problem p02417 (C++) — buggy submission, verdict: Runtime Error

#include <cstdio>
#include <iostream>
using namespace std;
int main() {
  char c, abc[27] = {"a"
                     "b"
                     "c"
                     "d"
                     "e"
                     "f"
                     "g"
                     "h"
                     "i"
                     "j"
                     "k"
                     "l"
                     "m"
                     "n"
                     "o"
                     "p"
                     "q"
                     "r"
                     "s"
                     "t"
                     "u"
                     "v"
                     "w"
                     "x"
                     "y"
                     "z"};
  int ans[27] = {0};
  while (scanf("%c", &c) != EOF) {
    if ('A' <= c && c <= 'Z')
      c += 32;
    if ('a' <= c && c <= 'z') {
      int num = c - 'a';
      ans[num]++;
    }
  }
  for (int i = 0; i < 26; i++) {
    cout << abc[i] << " : " << ans[i] << endl;
  }
  return 0;
}

Error: WA

Fixed submission:

#include <iostream>
using namespace std;
int main() {
  int ans[126], i = 1, j, k;
  char c, a = {91}, p[1200], b;
  while (cin >> c) {
    if (65 <= c && c <= 90) {
      c = c + 32;
    }
    p[i] = c;
    i++;
  }
  for (i = 1; i <= 1200; i++) {
    for (j = 100; j <= 126; j++) {
      b = j;
      if (p[i] == b) {
        ans[j]++;
      }
    }
  }
  for (i = 100; i <= 126; i++) {
    b = i;
    cout << b << " : " << ans[i] << endl;
  }
  return 0;
}
Problem p02417 (C++) — buggy submission, verdict: Time Limit Exceeded

#include <iostream>

using namespace std;

int main() {
  char ch;
  int numAlpha[26] = {0};

  while (cin >> ch) {
    if ('a' <= ch && ch <= 'z') {
      numAlpha[ch - 'a']++;
    } else if ('A' <= ch && ch <= 'Z') {
      numAlpha[ch - 'A']++;
    }
  }

  for (int i = 0; i < 26; i++) {
    cout << static_cast<char>('a' + i) << " : " << numAlpha[i] << endl;
  }

  return 0;
}

Error: TLE

Fixed submission:

#include <iostream>

using namespace std;

int main() {
  string str;
  int numAlpha[26] = {0};
  for (;;) {
    getline(cin, str);
    for (int i = 0; i < static_cast<int>(str.size()); i++) {
      if ('a' <= str[i] && str[i] <= 'z') {
        numAlpha[str[i] - 'a']++;
      } else if ('A' <= str[i] && str[i] <= 'Z') {
        numAlpha[str[i] - 'A']++;
      }
    }
    if (str[str.size() - 1] == '.')
      break;
  }
  for (int i = 0; i < 26; i++) {
    cout << static_cast<char>('a' + i) << " : " << numAlpha[i] << endl;
  }
}
Problem p02417 (C++) — buggy submission, verdict: Time Limit Exceeded

#include <iostream>

using namespace std;

namespace {
const int offset = 97;
}

int main() {
  int res[26] = {0};
  while (true) {
    string s;
    cin >> s;
    if (cin.eof())
      break;

    for (char &c : s) {
      int i = static_cast<int>(tolower(c));
      res[i - offset]++;
    }
  }
  for (int i = 0; i < 26; i++) {
    char c = static_cast<char>(i + offset);
    cout << c << " : " << res[i] << endl;
  }
  return 0;
}

Error: TLE

Fixed submission:

#include <iostream>

using namespace std;

namespace {
const int offset = 97;
}

int main() {
  int res[26] = {0};
  while (true) {
    string s;
    cin >> s;
    for (char &c : s) {
      int i = static_cast<int>(tolower(c));
      res[i - offset]++;
    }

    if (s.find(".") != string::npos)
      break;
  }
  for (int i = 0; i < 26; i++) {
    char c = static_cast<char>(i + offset);
    cout << c << " : " << res[i] << endl;
  }
  return 0;
}
Problem p02417 (C++) — buggy submission, verdict: Runtime Error

#include <cctype>
#include <cstdio>
using namespace std;
int main() {
  char x;
  int t = 0;
  char P[1201];
  for (int i = 0; i <= 1200; i++) {
    scanf("%c", &x);
    P[i] = tolower(x);
  }
  for (char s = 'a'; s <= 'z'; s++) {
    for (int i = 0; i <= 1200; i++) {
      if (P[i] == s)
        t += 1;
    }
    printf("%c : %d\\n", s, t);
    t = 0;
  }
}


Error: 0

Fixed submission:

#include <cctype>
#include <cstdio>
using namespace std;
int main() {
  char x;
  int t = 0;
  char P[1200];
  for (int i = 0; i <= 1200; i++) {
    scanf("%c", &x);
    P[i] = tolower(x);
    if (x == '.')
      break;
  }
  for (char s = 'a'; s <= 'z'; s++) {
    for (int i = 0; i < 1200; i++) {
      if (P[i] == '.')
        break;
      else if (P[i] == s)
        t += 1;
    }
    printf("%c : %d\\n", s, t);
    t = 0;
  }
}
Problem p02417 (C++) — buggy submission, verdict: Time Limit Exceeded

#include <cctype>
#include <cstdio>
#include <iostream>
using namespace std;

int main() {

  char moji;
  int alpha[26] = {0};

  while ((moji = getchar()) != EOF) {
    moji = tolower(moji);
    alpha[moji - 'a']++;
  }

  for (int i = 0; i < 26; i++) {
    printf("%c : %d\\n", 97 + i, alpha[i]);
  }

  return 0;
}


Error: TLE

Fixed submission:

#include <cctype>
#include <cstdio>
#include <iostream>
using namespace std;

int main() {

  char moji;
  int alpha[26] = {0};

  while ((moji = getchar()) != 0) {
    moji = tolower(moji);
    alpha[moji - 'a']++;
  }

  for (int i = 0; i < 26; i++) {
    printf("%c : %d\\n", 97 + i, alpha[i]);
  }

  return 0;
}
Problem p02417 (C++) — buggy submission, verdict: Time Limit Exceeded

#include <ctype.h>
#include <stdio.h>
#include <string.h>

int main() {
  int alpha;
  int cnt[256] = {0};
  while ((alpha = getchar()) != EOF) {
    alpha = tolower(alpha);
    cnt[alpha]++;
  }
  for (alpha = 'a'; alpha <= 'z'; alpha++) {
    printf("%c : %d\\n", alpha, cnt[alpha]);
  }
  return 0;
}

Error: TLE

Fixed submission:

#include <ctype.h>
#include <stdio.h>
#include <string.h>

int main() {
  char alpha;
  int i, N;
  int cnt[26] = {0};
  for (i = 0; alpha != EOF; i++) {
    scanf("%c", &alpha);
    alpha = tolower(alpha);
    N = alpha - 'a';
    if (0 <= N && N < 26) {
      cnt[i]++;
    }
  }
  for (i = 0; i < 26; i++) {
    printf("%c : %d\\n", i + 'a', cnt[i]);
  }
}
Problem p02417 (C++) — buggy submission, verdict: Runtime Error

#include <cctype>
#include <iostream>
#include <string>

using namespace std;

int main() {
  unsigned int n[27];
  for (unsigned int i = 0; i < 26; ++i)
    n[i] = 0;

  char ch;
  while (cin >> ch) {
    if (islower(ch))
      n[ch - 'a']++;
    else if (isupper(ch))
      n[ch - 'A']++;
  }

  for (unsigned int i = 0; i < 26; ++i) {
    cout << (char)('a' + i) << " : " << n[i] << endl;
  }

  return 0;
}


Error: -6
*** stack smashing detected ***: terminated


Fixed submission:

#include <cctype>
#include <cstdio>
#include <iostream>
#include <string>

using namespace std;

int main() {
  string s;
  unsigned int n[26];
  for (unsigned int i = 0; i < 27; ++i)
    n[i] = 0;
  getline(cin, s);

  for (unsigned int i = 0; i < s.length(); ++i) {
    if (islower(s[i]))
      n[s[i] - 'a']++;
    else if (isupper(s[i]))
      n[s[i] - 'A']++;
  }

  for (unsigned int i = 0; i < 27; ++i) {
    // cout << (char)('a' + i)  << " : " << n[i] << endl;
    printf("%c : %d\\n", ('a' + i), n[i]);
  }

  return 0;
}
Problem p02417 (C++) — buggy submission, verdict: Time Limit Exceeded

#include <iostream>
using namespace std;
#include <stdio.h>
int main() {
  char str;
  int count[26] = {0}, i = 0, k;
  str = getchar();
  while (str != EOF) {
    if ('a' <= str && str <= 'z') {
      k = str - 'a';
      count[k]++;
    }
    if ('A' <= str && str <= 'Z') {
      k = str - 'A';
      count[k]++;
    }
    str = getchar();
  }
  for (i = 0; i < 26; i++) {
    printf("%c : %d\\n", 'a' + i, count[i]);
  }
  return 0;
}

Error: TLE

Fixed submission:

#include <iostream>
using namespace std;
#include <stdio.h>
int main() {
  char str;
  int count[26] = {0}, i = 0, k;
  while (1) {
    cin >> str;
    if (str == EOF)
      break;
    if ('a' <= str && str <= 'z') {
      k = str - 'a';
      count[k]++;
    }
    if ('A' <= str && str <= 'Z') {
      k = str - 'A';
      count[k]++;
    }
  }
  for (i = 0; i < 26; i++) {
    printf("%c : %d", 'a' + i, count[i]);
    if (i != 26 - 1)
      printf("\\n");
  }
  return 0;
}
Problem p02417 (C++) — buggy submission, verdict: Time Limit Exceeded

#include <math.h>
#include <stdio.h>
#include <string.h>
#define rep(i, a, n) for (int i = a; i < n; i++)

int main() {
  char c;
  int d[26] = {0};
  while (scanf("%c", &c) != EOF) {
    // if(c=='0') break;
    if ('a' <= c && c <= 'z')
      d[c - 'a']++;
    else if ('A' <= c && c <= 'Z')
      d[c - 'A']++;
  }
  rep(i, 0, 26) { printf("%c : %d\\n", 'a' + i, d[i]); }
  return 0;
}

Error: TLE

Fixed submission:

#include <math.h>
#include <stdio.h>
#include <string.h>
#define rep(i, a, n) for (int i = a; i < n; i++)

int main() {
  char c;
  int d[26] = {0};
  while (scanf("%c", &c) != 'EOF') {
    // if(c=='0') break;
    if ('a' <= c && c <= 'z')
      d[c - 'a']++;
    else if ('A' <= c && c <= 'Z')
      d[c - 'A']++;
  }
  rep(i, 0, 26) { printf("%c : %d\\n", 'a' + i, d[i]); }
  return 0;
}
Problem p02417 (C++) — buggy submission, verdict: Time Limit Exceeded

#include <ctype.h>
#include <stdio.h>

int main() {
  char c;
  int cnt[26];
  int i;
  for (i = 0; i < 26; i++)
    cnt[i] = 0;
  while ((c = getchar()) != EOF) {
    if (isalpha(c)) {
      c = tolower(c);
      cnt[c - 'a']++;
    }
  }
  for (i = 0; i < 26; i++)
    printf("%c : %d\\n", 'a' + i, cnt[i]);
}

Error: TLE

Fixed submission:

#include <ctype.h>
#include <stdio.h>

int main() {
  char c;
  int cnt[26];
  int i;
  for (i = 0; i < 26; i++)
    cnt[i] = 0;
  c = getchar();
  while (c != '.') {
    if (isalpha(c)) {
      c = tolower(c);
      cnt[c - 'a']++;
    }
    c = getchar();
  }
  for (i = 0; i < 26; i++)
    printf("%c : %d\\n", 'a' + i, cnt[i]);
}