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

#include <algorithm>
#include <cmath>
#include <cstdio>
#include <ctype.h>
#include <deque>
#include <functional>
#include <iostream>
#include <list>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <stdlib.h>
#include <string.h>
#include <string>
#include <time.h>
#include <utility>
#include <vector>
using namespace std;

char c[85];

bool search_th() {
  bool f = false;
  for (int i = 0; i < strlen(c); i++) {
    if ((c[i] == 't' && c[i + 1] == 'h' && c[i + 2] == 'e') ||
        (c[i] == 't' && c[i + 1] == 'h' && c[i + 2] == 'i' &&
         c[i + 3] == 's') ||
        (c[i] == 't' && c[i + 1] == 'h' && c[i + 2] == 'a' &&
         c[i + 3] == 't')) {
      f = true;
      break;
    }
  }
  return f;
}

int main() {
  while (cin.getline(c, sizeof(c))) {
    while (1) {
      if (search_th() == true) {
        cout << c << endl;
        break;
      }
      for (int j = 0; j < strlen(c); j++) {
        if (c[j] >= 'a' && c[j] <= 'y')
          c[j]++;
        else if (c[j] == 'z')
          c[j] = 'a';
      }
    }
    for (int i = strlen(c); i < 85; i++) {
      c[i] = '\\0';
    }
  }
  return 0;
}


Error: TLE

Fixed submission:

#include <algorithm>
#include <cmath>
#include <cstdio>
#include <ctype.h>
#include <deque>
#include <functional>
#include <iostream>
#include <list>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <stdlib.h>
#include <string.h>
#include <string>
#include <time.h>
#include <utility>
#include <vector>
using namespace std;

char c[85];

bool search_th() {
  bool f = false;
  for (int i = 0; i < strlen(c); i++) {
    if ((c[i] == 't' && c[i + 1] == 'h' && c[i + 2] == 'e') ||
        (c[i] == 't' && c[i + 1] == 'h' && c[i + 2] == 'i' &&
         c[i + 3] == 's') ||
        (c[i] == 't' && c[i + 1] == 'h' && c[i + 2] == 'a' &&
         c[i + 3] == 't')) {
      f = true;
      break;
    }
  }
  return f;
}

int main() {
  while (cin.getline(c, sizeof(c))) {
    while (1) {
      if (search_th() == true) {
        cout << c << endl;
        break;
      }
      for (int j = 0; j < strlen(c); j++) {
        if (c[j] >= 'a' && c[j] <= 'y')
          c[j]++;
        if (c[j] == 'z')
          c[j] = 'a';
      }
    }
    for (int i = strlen(c); i < 85; i++) {
      c[i] = '\\0';
    }
  }
  return 0;
}
Problem p00017 (C++) — buggy submission, verdict: Time Limit Exceeded

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

int main() {
  string sa;

  while (getline(cin, sa)) {

    for (int j = 0; j < 26; j++) {
      int a = sa.size();
      for (int i = 0; i < a; i++) {
        if (sa[i] >= 'a' && sa[i] <= 'z') {
          sa[i] += 1;
          if (sa[i] > 'z') {
            sa[i] -= 26;
          }
        }
      }
      size_t z = sa.find("this");
      size_t za = sa.find("that");
      size_t zb = sa.find("the");
      if (z != string::npos) {
        break;
      } else if (za != string::npos) {
        break;
      } else if (zb != string::npos) {
        break;
      }
    }
    cout << sa << endl;
  }
  return 0;
}

Error: TLE

Fixed submission:

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

int main() {
  string sa;
  while (getline(cin, sa)) {
    int a = sa.size();
    while (1) {
      for (int i = 0; i < a; i++) {
        if ('a' <= sa[i] && sa[i] <= 'z') {
          sa[i] += 1;
        }
        if (sa[i] > 'z') {
          sa[i] -= 26;
        }
      }
      if (sa.find("this" || "that" || "the") != string::npos) {
        break;
      }
    }
    cout << sa << endl;
  }
  return 0;
}
Problem p00017 (C++) — buggy submission, verdict: Time Limit Exceeded

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

int main() {
  string s;
  while (getline(cin, s)) {
    string dec = s;
    while (true) {
      if (dec.find("the") != -1 || dec.find("this") != -1 ||
          dec.find("that") != -1) {
        cout << dec << endl;
        break;
      }
      for (int i = 0; i < dec.size(); i++) {
        if ('a' <= dec[i] && dec[i] < 'z')
          dec[i]++;
        else if (dec[i] == 'z')
          dec[i] = 'a';
      }
    }
  }

  return 0;
}

Error: TLE

Fixed submission:

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

int main() {
  string s;
  while (getline(cin, s)) {
    string dec = s;
    while (true) {
      if (dec.find("the") != -1 || dec.find("this") != -1 ||
          dec.find("that") != -1) {
        cout << dec << endl;
        break;
      }
      for (int i = 0; i < dec.size(); i++) {
        if ('a' <= dec[i] && dec[i] < 'z')
          dec[i]++;
        if (dec[i] == 'z')
          dec[i] = 'a';
      }
    }
  }

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

#include <algorithm>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <iostream>
#include <map>
#include <set>
#include <string>
#include <utility>
#include <vector>
#define loop(i, a, b) for (int i = a; i < b; i++)
#define rep(i, a) loop(i, 0, a)
#define rp(a) while (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;
using namespace std;
typedef long long ll;
typedef vector<int> vi;
bool h[1000010] = {false};
int main() {
  string s;
  while (getline(cin, s)) {
    while (s.find("this") == string::npos && s.find("that") == string::npos &&
           s.find("the") == string::npos) {
      rep(i, s.size()) if (isalpha(s[i])) {
        if (s[i] == 'z')
          s[i] = 'a';
        else
          s[i]++;
      }
    }
    cout << s << endl;
  }
}

Error: -11

Fixed submission:

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

int main(void) {
  string s;
  string a[3] = {"this", "the", "that"};
  getline(cin, s);
  vector<string> ss;
  string n = "";
  s += " ";
  for (int i = 0; i < s.size(); i++) {
    if (s[i] == ' ') {
      ss.push_back(n);
      n = "";
    } else {
      n += s[i];
    }
  }
  bool ans = true;
  for (int i = 0; i < ss.size(); i++) {
    for (int j = 0; j < ss[i].size(); j++) {
      if ('a' > ss[i][j] && ss[i][j] < 'z')
        continue;
      ss[i][j]++;
      if (ss[i][j] == 'z' + 1)
        ss[i][j] = 'a';
    }
    for (int j = 0; j < 3; j++) {
      for (int k = 0; k < a[i].size(); k++) {
        if (k == a[i].size() - 1) {
          ans = false;
        } else if (a[i][k] != ss[j][k]) {
          break;
        }
      }
      break;
    }
  }
  while (ans) {
    for (int i = 0; i < ss.size(); i++) {
      for (int j = 0; j < ss[i].size(); j++) {
        if ('a' > ss[i][j] && ss[i][j] < 'z')
          continue;
        ss[i][j]++;
        if (ss[i][j] == 'z' + 1)
          ss[i][j] = 'a';
      }
      for (int j = 0; j < 3; j++) {
        for (int k = 0; k < a[i].size(); k++) {
          if (k == a[i].size() - 1) {
            ans = false;
          } else if (a[i][k] != ss[j][k]) {
            break;
          }
        }
        break;
      }
    }
  }
  for (int i = 0; i < ss.size(); i++) {
    cout << ss[i] << " ";
  }
  cout << endl;
}
Problem p00017 (C++) — buggy submission, verdict: Time Limit Exceeded

#include <iostream>
#include <string>

char chshift(char ch) {
  if (ch >= 'a' && ch <= 'z') {
    return (ch - 'a' + 1) % 26 + 'a';
  } else {
    return ch;
  }
}

std::string strshift(std::string s) {
  for (int i = 0; i < s.length(); i++) {
    s[i] = chshift(s[i]);
  }
  return s;
}

bool valid_text_p(std::string str) {
  return str.find("the") != -1 || str.find("that") != -1 ||
         str.find("this") != -1;
}

int main() {
  std::string s;
  while (std::getline(std::cin, s), !std::cin.eof()) {
    for (;; s = strshift(s)) {
      if (valid_text_p(s)) {
        std::cout << s << std::endl;
        break;
      }
    }
  }
  return 0;
}

Error: TLE

Fixed submission:

#include <iostream>
#include <string>

char chshift(char ch) {
  if (ch >= 'a' && ch <= 'z') {
    return (ch - 'a' + 1) % 26 + 'a';
  } else {
    return ch;
  }
}

std::string strshift(std::string s) {
  for (int i = 0; i < s.length(); i++) {
    s[i] = chshift(s[i]);
  }
  return s;
}

bool valid_text_p(std::string str) {
  return str.find("the") != -1 && str.find("that") != -1 &&
         str.find("this") != -1;
}

int main() {
  std::string s;
  while (std::getline(std::cin, s), !std::cin.eof()) {
    for (;; s = strshift(s)) {
      if (valid_text_p(s)) {
        std::cout << s << std::endl;
        break;
      }
    }
  }
  return 0;
}
Problem p00017 (C++) — buggy submission, verdict: Time Limit Exceeded

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

void shift(char *str, int len, int n) {
  char t[] = "abcdefghijklmnopqrstuvwxyz";
  char c;
  for (int i = 0; i < len; ++i) {
    c = *(str + i);
    if (c >= 'a' && c <= 'z') {
      str[i] = t[(c - 'a' + n) % 26];
    }
  }
}

int main(void) {
  char input[81];
  char copy[81];
  char *token;
  int len = 0;
  int n = 0;

  while (fgets(input, 80, stdin) != NULL) {
    n = -1;
    strcpy(copy, input);

    token = strtok(copy, " .\\n");
    while (token != NULL && n == -1) {
      len = strlen(token);
      if (len == 4) {
        for (int i = 0; i < 26; ++i) {
          shift(token, 4, 1);
          if (strcmp(token, "this") == 0 || strcmp(token, "that") == 0) {
            n = i + 1;
            break;
          }
        }
      } else if (len == 3) {
        for (int i = 0; i < 26; ++i) {
          shift(token, 3, 1);
          if (strcmp(token, "the") == 0) {
            n = i + 1;
            break;
          }
        }
      }
      token = strtok(NULL, " .\\n");
    }
    shift(input, strlen(input), n);
    printf(input);
  }
  return 0;
}

Error: TLE

Fixed submission:

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

void shift(char *str, int len, int n) {
  char t[] = "abcdefghijklmnopqrstuvwxyz";
  char c;
  for (int i = 0; i < len; ++i) {
    c = *(str + i);
    if (c >= 'a' && c <= 'z') {
      str[i] = t[(c - 'a' + n) % 26];
    }
  }
}

int main(void) {
  char input[81];
  char copy[81];
  char *token;
  int len = 0;
  int n = 0;

  while (fgets(input, 80, stdin) != NULL) {
    n = -1;
    strcpy(copy, input);

    token = strtok(copy, " .\\n");
    while (token != NULL && n == -1) {
      len = strlen(token);
      if (len == 4) {
        for (int i = 0; i < 26; ++i) {
          shift(token, 4, 1);
          if (strcmp(token, "this") == 0 || strcmp(token, "that") == 0) {
            n = i + 1;
            break;
          }
        }
      } else if (len == 3) {
        for (int i = 0; i < 26; ++i) {
          shift(token, 3, 1);
          if (strcmp(token, "the") == 0) {
            n = i + 1;
            break;
          }
        }
      }
      token = strtok(copy, " .\\n");
    }
    shift(input, strlen(input), n);
    puts(input);
  }
  return 0;
}
Problem p00017 (C++) — buggy submission, verdict: Time Limit Exceeded

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

int main() {
  string str;
  while (getline(cin, str)) {
    while (str.find("this", 0) == string::npos &&
           str.find("that", 0) == string::npos &&
           str.find("the", 0) == string::npos) {
      for (int i = 0; i < str.size(); ++i) {
        if (str[i] >= 'a' && str[i] <= 'z') {
          if (str[i] != 'z')
            ++str[i];
          else
            str[i] = 'a';
        }
      }
    }
    cout << str << endl;
  }
  return 0;
}

Error: TLE

Fixed submission:

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

int main() {
  string str;
  while (getline(cin, str)) {
    while (str.find("this", 0) == string::npos ||
           str.find("that", 0) == string::npos ||
           str.find("the", 0) == string::npos) {
      for (int i = 0; i < str.size(); ++i) {
        if (str[i] >= 'a' && str[i] <= 'z') {
          if (str[i] != 'z')
            ++str[i];
          else
            str[i] = 'a';
        }
      }
    }
    cout << str << endl;
  }
  return 0;
}
Problem p00017 (C++) — buggy submission, verdict: Time Limit Exceeded

#include <iostream>
#include <string>
using namespace std;
int caesar(char s[]);
bool search(string s);

int main() {
  string str;
  unsigned int i;
  while (getline(cin, str)) {
    int j = 0;
    while (!search(str)) {
      for (i = 0; i < str.length(); i++) {
        if (str[i] != ' ' && str[i] != '.')
          str[i]++;
        if (str[i] > 122)
          str[i] = 97;
      }
      j++;
      if (j > 25)
        break;
    }
    cout << str << endl;
  }
  return 0;
}

bool search(string s) {
  if (s.find("this") != string::npos)
    return true;
  if (s.find("that") != string::npos)
    return true;
  if (s.find("the") != string::npos)
    return true;
  return false;
}

Error: TLE

Fixed submission:

#include <stdio.h>
#include <stdlib.h>
#include <string.h>
int caesar(char s[]);
bool search(char s[]);

int main() {
  char s[256];
  int i, j = 0, n = 10;
  // while(scanf("%[^\\n]",&s)!=EOF){
  while (!search(s)) {
    for (i = 0; s[i] != '.'; i++) {
      if (s[i] != ' ')
        s[i]++;
      if (s[i] > 122)
        s[i] = 97;
    }
  }
  printf("%s\\n", s);
  //}
  return 0;
}

bool search(char s[]) {
  char *is, *e, *at;
  int i = 0;
  char *tmp;
  is = "this";
  e = "the";
  at = "that";
  while (s[i] != '.') {
    if (s[i] == 't' && s[i + 1] == 'h') {
      if (s[i + 2] == 'e')
        return true;
      else if (s[i + 2] == 'i' && s[i + 3] == 's')
        return true;
      else if (s[i + 2] == 'a' && s[i + 3] == 't')
        return true;
    }
    i++;
  }
  return false;
}
Problem p00017 (C++) — buggy submission, verdict: Time Limit Exceeded

#include <algorithm>
#include <cstdio>
#include <iostream>
#include <string>
using namespace std;
int main() {
  string str;
  int str_size;
  while (getline(cin, str)) {
    str_size = str.size();
    while (1) {
      for (int i = 0; i < str_size; i++) {
        if (str[i] == 'z')
          str[i] = 'a';
        else if (str[i] != '.' && str[i] != ' ')
          str[i]++;
      }
      if (str.find("the") != -1)
        break;
      if (str.find("that") != -1)
        break;
      if (str.find("this") != -1)
        break;
    }
    cout << str << endl;
  }
}

Error: TLE

Fixed submission:

#include <algorithm>
#include <cstdio>
#include <cstring>
#include <iostream>
#include <string>
using namespace std;
int main() {
  string str;
  char s[256];
  int w = 0;
  while (scanf("%c", &s[0]) != EOF) {
    do {
      w++;
      scanf("%c", &s[w]);
    } while (s[w] != '\\n');
    while (1) {
      s[w] = '\\0';

      for (int i = 0; i < w; i++) {
        if (s[i] != ' ' && s[i] != '.') {
          s[i]++;
          if (s[i] > 'z')
            s[i] = s[i] - 'z' + 'a' - 1;
        }
      }
      if (strstr(s, "the") != NULL)
        break;
      if (strstr(s, "that") != NULL)
        break;
      if (strstr(s, "this") != NULL)
        break;
    }
    printf("%s\\n", s);
    memset(s, 0, sizeof(s));
  }
}
Problem p00017 (C++) — buggy submission, verdict: Time Limit Exceeded

#include <algorithm>
#include <cmath>
#include <iomanip>
#include <iostream>
#include <set>
#include <stack>
#include <string>
#include <vector>
using namespace std;

bool islower(char a) {
  if (a >= 'a' && a <= 'z')
    return true;
  else
    return false;
}

int main() {
  string s, ans;
  while (getline(cin, s)) {
    int shift = 1;
    ans = s;
    while (1) {
      if (ans.find("the", 0) != string::npos ||
          ans.find("this", 0) != string::npos ||
          ans.find("that", 0) != string::npos)
        break;
      for (int i = 0; i < s.size(); ++i) {
        if (islower(s[i])) {
          if (s[i] + shift <= 'z') {
            ans[i] = s[i] + shift;
          } else {
            ans[i] = s[i] - 26 + shift;
          }
        }
      }
      shift++;
    }
    cout << ans << endl;
  }
  return 0;
}

Error: TLE

Fixed submission:

#include <algorithm>
#include <cmath>
#include <iomanip>
#include <iostream>
#include <set>
#include <stack>
#include <string>
#include <vector>
using namespace std;

bool islower(char a) {
  if (a >= 'a' && a <= 'z')
    return true;
  else
    return false;
}

int main() {
  string s, ans;
  int shift = 1;
  while (getline(cin, s)) {
    ans = s;
    while (1) {
      if (ans.find("the", 0) != string::npos ||
          ans.find("this", 0) != string::npos ||
          ans.find("that", 0) != string::npos)
        break;
      for (int i = 0; i < s.size(); ++i) {
        if (islower(s[i])) {
          if (s[i] + shift <= 'z') {
            ans[i] = s[i] + shift;
          } else {
            ans[i] = s[i] - 26 + shift;
          }
        }
      }
      shift++;
    }
    cout << ans << endl;
  }
  return 0;
}
Problem p00017 (C++) — buggy submission, verdict: Runtime Error

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

char buf[99];

int main() {
  int i;

  for (; ~scanf("%[^\\n] ", buf);) {
    for (i = 0;; i++) {
      if (buf[i] - buf[i + 1] == 12 || buf[i] - buf[i + 1] == -14) {
        break;
      }
    }
    int sa = buf[i] - 't';
    for (i = 0; buf[i] != '\\0'; i++) {
      if ('a' <= buf[i] && buf[i] <= 'z') {
        int tmp = buf[i] - sa;
        putchar(tmp + (tmp < 'a' ? 26 : tmp > 'z' ? -26 : 0));
      } else {
        putchar(buf[i]);
      }
    }
    puts("");
  }
  return 0;
}

Error: 0

Fixed submission:

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

char buf[99];

int main() {
  int i;

  for (; ~scanf("%[^\\n] ", buf);) {
    for (i = 0;; i++) {
      if (buf[i] - buf[i + 1] == 12) {
        break;
      }
    }
    int sa = buf[i] - 't';
    for (i = 0; buf[i] != '\\0'; i++) {
      buf[i] = !putchar(buf[i] - (97 > buf[i] ? 0 : sa));
    }
    puts("");
  }
  return 0;
}
Problem p00017 (C++) — buggy submission, verdict: Time Limit Exceeded

#include <iostream>
#include <string>
#include <vector>

std::string Caesar(std::string str, int tranceNum) {
  for (size_t i = 0; i < str.length(); ++i) {
    if ('a' <= str[i] && str[i] <= 'z') {
      int chNum = 0;

      chNum = str[i];

      chNum += tranceNum;

      chNum = (chNum - 97) % 26 + 97;

      str[i] = chNum;
    }
  }

  return str;
}

int main() {
  std::string sentence;

  while (std::getline(std::cin, sentence)) {
    bool flg = 0;

    for (;;) {
      sentence = Caesar(sentence, 1);

      std::string checkword = "";

      size_t i = 0;

      for (; i < sentence.size() && flg == 0; ++i) {
        switch (sentence[i]) {
        case 't':
        case 'h':
        case 'i':
        case 's':
        case 'a':
        case 'e':
          checkword += sentence[i];
          break;
        default:
          checkword = "";
          break;
        }

        if (checkword == "this" || checkword == "the" || checkword == "that") {
          break;
        }
      }
      if (i != sentence.size()) {
        std::cout << sentence << '\\n';

        break;
      }
    }
  }
}

Error: TLE

Fixed submission:

#include <iostream>
#include <string>
#include <vector>

std::string Caesar(std::string str, int tranceNum) {
  for (size_t i = 0; i < str.length(); ++i) {
    if (str[i] != '.') {
      int chNum = 0;

      chNum = str[i];

      chNum += tranceNum;

      chNum = (chNum - 97) % 26 + 97;

      str[i] = chNum;
    }
  }

  return str;
}

int main(void) {
  std::string str;

  std::vector<std::string> sentence;

  while (!(std::cin.eof())) {

    while (std::cin >> str) {
      sentence.push_back(str);

      if (sentence[sentence.size() - 1]
                  [sentence[sentence.size() - 1].length() - 1] == '.') {
        break;
      }
    }

    for (bool flg = 1; flg;) {
      for (size_t j = 0; j < sentence.size(); ++j) {
        sentence[j] = Caesar(sentence[j], 1);
      }

      for (size_t j = 0; (j < sentence.size()) && flg; ++j) {
        switch (sentence[j].length()) {
        case 3:
          flg = (sentence[j] == "the") ? 0 : 1;
          break;
        case 4:
          flg = (sentence[j] == "that" || sentence[j] == "this") ? 0 : 1;
          break;
        case 5:
          flg = (sentence[j] == "that." || sentence[j] == "this.") ? 0 : 1;
          break;
        default:
          break;
        }
      }
    }
    for (size_t j = 0; j < sentence.size(); ++j) {
      std::cout << sentence[j] << ' ';
    }
    std::cout << '\\n';

    sentence.clear();
  }
}
Problem p00017 (C++) — buggy submission, verdict: Time Limit Exceeded

#include <algorithm>
#include <cmath>
#include <cstdio>
#include <iostream>
#include <list>
#include <set>
#include <stack>
#include <vector>
using namespace std;

#define REP(i, n) for (int(i) = 0; (i) < (n); (i)++)
#define FOR(i, a, b) for (int(i) = (a); (i) < (b); (i)++)
#define PUSH(n, v)                                                             \\
  for (int i = 0; i < (n); i++) {                                              \\
    int j;                                                                     \\
    cin >> j;                                                                  \\
    v.push_back(j);                                                            \\
  }
#define ALL(v) v.begin(), v.end()

void rot1(string &s) {
  string t = "";
  REP(i, s.size()) {
    if (s[i] >= 'a' && s[i] <= 'z') {
      if (s[i] == 'a')
        t += "z";
      else
        t += s[i] - 1;
    } else {
      t += s[i];
    }
  }
  s = t;
}

int main() {
  string s;
  while (getline(cin, s)) {
    while (s.find("the") == string::npos && s.find("this") == string::npos &&
           s.find("that") == string::npos) {
      rot1(s);
    }
    cout << s << endl;
  }
  return 0;
}

Error: TLE

Fixed submission:

#include <algorithm>
#include <cmath>
#include <cstdio>
#include <iostream>
#include <list>
#include <set>
#include <stack>
#include <vector>
using namespace std;

#define REP(i, n) for (int(i) = 0; (i) < (n); (i)++)
#define FOR(i, a, b) for (int(i) = (a); (i) < (b); (i)++)
#define PUSH(n, v)                                                             \\
  for (int i = 0; i < (n); i++) {                                              \\
    int j;                                                                     \\
    cin >> j;                                                                  \\
    v.push_back(j);                                                            \\
  }
#define ALL(v) v.begin(), v.end()

void rot1(string &s) {
  string t = "";
  REP(i, s.size()) {
    if (s[i] > 'a' && s[i] < 'z') {
      if (s[i] == 'a')
        t += "z";
      else
        t += s[i] - 1;
    } else {
      t += s[i];
    }
  }
  s = t;
}

int main() {
  string s;
  while (getline(cin, s)) {
    while (s.find("the") == string::npos && s.find("this") == string::npos &&
           s.find("that") == string::npos) {
      rot1(s);
    }
    cout << s << endl;
  }
  return 0;
}
Problem p00017 (C++) — buggy submission, verdict: Time Limit Exceeded

#include <bits/stdc++.h>
using namespace std;
int main() {
  string str;
  while (getline(cin, str)) {
    while (1) {
      if (str.find("the") != -1 || str.find("that") != -1 ||
          str.find("this") != -1)
        break;
      for (int i = 0; i < str.size(); i++) {
        if (str[i] == '.' || str[i] == ' ') {
        } else if (str[i] == 'a')
          str[i] = 'z';
        else
          str[i]--;
      }
    }
    cout << str << endl;
  }
  return 0;
}

Error: TLE

Fixed submission:

#include <bits/stdc++.h>
using namespace std;
int main() {
  string str;
  while (getline(cin, str)) {
    while (1) {
      if (str.find("the") != -1 || str.find("that") != -1 ||
          str.find("this") != -1)
        break;
      for (int i = 0; i < str.size(); i++) {
        if (str[i] == '.' || str[i] == ' ') {
        } else
          str[i]--;
      }
    }
    cout << str << endl;
  }
  return 0;
}