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

#include <iostream>
#include <math.h>
#include <string>
#include <vector>
using namespace std;

int main() {
  int dis1, rad1, dis2 = 0, rad2 = 0;
  double x = 0, y = 0, PI = 3.141592653589793;
  scanf("%d , %d", &dis1, &rad1);
  y += dis1;
  rad2 = rad1;
  while (scanf("%d , %d", &dis1, &rad1)) {
    if (dis1 != 0) {
      x += dis1 * sin(rad2 * PI / 180);
      y += dis1 * cos(rad2 * PI / 180);
      rad2 += rad1;
    } else {
      cout << int(x) << endl;
      cout << int(y) << endl;
      break;
    }
  }
  return 0;
}

Error: TLE

Fixed submission:

#include <iostream>
#include <math.h>
#include <string>
#include <vector>
using namespace std;

int main() {
  int dis1, rad1, dis2 = 0, rad2 = 0;
  double x = 0, y = 0, PI = 3.141592653589793;
  scanf("%d , %d", &dis1, &rad1);
  y += dis1;
  rad2 = rad1;
  while (scanf("%d , %d", &dis1, &rad1)) {
    if (dis1 != 0) {
      x += dis1 * sin(rad2 * PI / 180);
      y += dis1 * cos(rad2 * PI / 180);
      rad2 += rad1;
    } else {
      cout << int(x) << endl;
      cout << int(y) << endl;
    }
  }
  return 0;
}
Problem p00016 (C++) — buggy submission, verdict: Time Limit Exceeded

#include <iostream>
#include <math.h>
using namespace std;
int main() {
  int step, turn;
  double x = 0, y = 0, angle = 0;
  while (1) {
    scanf("%d,%d", &step, &turn);
    if (!step && !turn)
      break;
    x += (double)step * sin(angle * M_PI / 180);
    y += (double)step * cos(angle * M_PI / 180);
    angle += (double)turn;
  }
  cout << (int)x << endl;
  cout << (int)y << endl;
  return 0;
}

Error: TLE

Fixed submission:

#include <iostream>
#include <math.h>
using namespace std;
int main() {
  int step, turn;
  double x = 0, y = 0, angle;
  while (cin >> step >> turn, step, turn) {
    x += (double)step * sin(angle * M_PI / 180);
    y += (double)step * cos(angle * M_PI / 180);
    angle += (double)turn;
  }

  cout << (int)x << endl;
  cout << (int)y << endl;
  return 0;
}
Problem p00017 (C++) — buggy submission, verdict: Time Limit Exceeded

#include <algorithm>
#include <cstdio>
#include <cstring>
#include <iostream>
#include <string>
using namespace std;
int main(void) {
  string a;

  while (getline(cin, a)) {

    for (int i = 0; i < 26; i++) {
      if (a.find("the") != string::npos || a.find("this") != string::npos ||
          a.find("that") != string::npos) {
        cout << a << endl;
        break;
      } else
        for (int i = 0; i < a.length(); i++) {
          if (a[i] >= 'a' && a[i] <= 'y')
            a[i]++;
          else if (a[i] == 'z')
            a[i] = 'a';
        }
    }
  }
  return 0;
}

Error: TLE

Fixed submission:

#include <algorithm>
#include <cstdio>
#include <cstring>
#include <iostream>
#include <string>
using namespace std;
int main(void) {

  for (;;) {
    string a;
    bool flg = 0;
    while (getline(cin, a)) {
      if (a[0] == EOF)
        flg = 1;
      break;

      for (int i = 0; i < 26; i++) {
        if (a.find("the") != string::npos || a.find("this") != string::npos ||
            a.find("that") != string::npos) {
          cout << a << endl;
          break;
        } else
          for (int i = 0; i < a.length(); i++) {
            if (a[i] >= 'a' && a[i] <= 'y')
              a[i]++;
            else if (a[i] == 'z')
              a[i] = 'a';
          }
      }
    }
  }
  return 0;
}
Problem p00017 (C++) — buggy submission, verdict: Runtime Error

#include <cstdio>
#include <iostream>
#include <string.h>
using namespace std;
char str1[82];
char str2[82];
void trans(char *orj, char *dest) {
  int k = 0, len = strlen(orj);
  bool ischk = false;
  for (int y = 1; y <= 26 && !ischk; y++) {
    for (int x = 0; x < len; x++) {
      if (orj[x] >= 'a' && orj[x] <= 'z')
        k = orj[x] - 'a';
      else if (orj[x] >= 'A' && orj[x] <= 'Z')
        k = orj[x] - 'A';
      k = (k + y) % 26;
      if (orj[x] >= 'a' && orj[x] <= 'z')
        dest[x] = 'a' + k;
      else if (orj[x] >= 'A' && orj[x] <= 'Z')
        dest[x] = 'A' + k;
      else
        dest[x] = orj[x];
    }
    if (strstr(dest, "the") != NULL || strstr(dest, "this") != NULL ||
        strstr(dest, "that"))
      ischk = true;
  }
}
int main() {
  while (gets(str1)) {
    memset(str2, '\\0', sizeof(str2));
    trans(str1, str2);
    printf("%s\\n", str2);
  }
  return 0;
}

Error: -8

Fixed submission:


#include <cstdio>
#include <cstring>
#define N 1000000 + 10
char a[N];
int next[N];
void getNext(int len) {
  next[0] = -1;
  int j = -1, i = 0;
  while (i < len) {
    if (j == -1 || a[i] == a[j]) {
      i++;
      j++;
      next[i] = j;
    } else
      j = next[j];
  }
}

int main() {
  while (scanf("%s", a)) {
    if (a[0] == '.') {
      break;
    }
    int len = strlen(a);
    getNext(len);
    if (len % (len - next[len] == 0)) {
      printf("%d\\n", len / (len - next[len]));
    } else {
      printf("1\\n");
    }
  }
  return 0;
}
Problem p00017 (C++) — buggy submission, verdict: Runtime Error

#include <algorithm>
#include <deque>
#include <iostream>
#include <math.h>
#include <queue>
#include <set>
#include <stack>
#include <stdio.h>
#include <string.h>
#include <string>
#define ll long long
using namespace std;

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


Error: WA

Fixed submission:

#include <algorithm>
#include <iostream>
#include <list>
#include <map>
#include <math.h>
#include <queue>
#include <set>
#include <stack>
#include <stdio.h>
#include <string.h>
#include <string>
#include <vector>
using namespace std;
#define inf 0x3f3f3f3f

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 main() {
  char s[110];
  char c;
  int i = 0;
  while (scanf("%c", &c) != EOF) {
    s[i++] = c;
  }
  int l = strlen(s), j, k, m, t;
  for (i = 0; i <= 26; i++) {
    char t[110] = {'a'};
    for (j = 0; j < l; j++) {
      if (s[j] >= 'a' && s[j] <= 'z') {
        t[j] = d[(s[j] - 'a' + i) % 26];
      } else
        t[j] = s[j];
    }
    int a = 0, b = 0, c = 0;
    for (j = 0; j < l - 2; j++) {
      if (t[j] == 't' && t[j + 1] == 'h') {
        if (t[j + 2] == 'e' && !(t[j + 3] >= 'a' && t[j + 3] <= 'z')) {
          a++;
        }
        if (t[j + 2] == 'i' && t[j + 3] == 's' &&
            !(t[j + 4] >= 'a' && t[j + 4] <= 'z')) {
          b++;
        }
        if (t[j + 2] == 'a' && t[j + 3] == 't' &&
            !(t[j + 4] >= 'a' && t[j + 4] <= 'z')) {
          c++;
        }
      }
    }
    if (a && b && c)
      break;
  }
  for (j = 0; j < l; j++) {
    if (s[j] >= 'a' && s[j] <= 'z') {
      printf("%c", d[(s[j] - 'a' + i) % 26]);
    } else
      printf("%c", s[j]);
  }
  puts("");
  return 0;
}
Problem p00017 (C++) — buggy submission, verdict: Time Limit Exceeded

#include <bits/stdc++.h>
using namespace std;
#define REP(i, n) for (int i = 0; i < (n); i++)
#define REP2(i, x, n) for (int i = x; i < (n); i++)
#define ALL(n) begin(n), end(n)
struct cww {
  cww() {
    ios::sync_with_stdio(false);
    cin.tie(0);
  }
} star;
int main() {
  string S;
  while (getline(cin, S)) {
    while (true) {
      REP(i, (int)S.size()) {
        if (S[i] != ' ' && S[i] != '.') {
          if (S[i] == 'z') {
            S[i] = 'a';
            continue;
          }
          S[i]++;
        }
      }
      if (S.find("the") != string::npos || S.find("this") != string::npos ||
          S.find("that") != string::npos) {
        break;
      }
    }
    cout << S << endl;
  }
  return 0;
}

Error: TLE

Fixed submission:

#include <bits/stdc++.h>
using namespace std;
#define REP(i, n) for (int i = 0; i < (n); i++)
#define REP2(i, x, n) for (int i = x; i < (n); i++)
#define ALL(n) begin(n), end(n)
struct cww {
  cww() {
    ios::sync_with_stdio(false);
    cin.tie(0);
  }
} star;
int main() {
  string S;
  while (getline(cin, S)) {
    while (S.find("the") == string::npos || S.find("this") == string::npos ||
           S.find("that") == string::npos) {
      REP(i, (int)S.size()) {
        if (S[i] != ' ' && S[i] != '.') {
          if (S[i] == 'z') {
            S[i] = 'a';
            continue;
          }
          S[i]++;
        }
      }
    }
    cout << S << endl;
  }
  return 0;
}
Problem p00017 (C++) — buggy submission, verdict: Time Limit Exceeded

/*AOJ 0017*/

#include <iostream>
#include <string>

using namespace std;

char shiftCaesar(char tmp) {
  if (tmp >= 'a' && tmp <= 'y') {
    return tmp + 1;
  } else if (tmp == 'z') {
    return 'a';
  } else {
    return tmp;
  }
}

int main() {
  char str[100];
  string tmp;

  while (cin.getline(str, 100)) {

    for (;;) {

      tmp = str;

      if (tmp.find("the") != -1 || tmp.find("this") != -1 ||
          tmp.find("that") != -1) {
        break;
      }

      for (int i = 0; str[i] != '\\0'; i++) {
        str[i] = shiftCaesar(str[i]);
      }
    }

    cout << tmp << endl;
  }
  return 0;
}

Error: TLE

Fixed submission:

/*AOJ 0017*/

#include <iostream>
#include <string>

using namespace std;

char shiftCaesar(char tmp) {
  if (tmp >= 'a' && tmp <= 'y') {
    return tmp + 1;
  } else if (tmp == 'z') {
    return 'a';
  } else {
    return tmp;
  }
}

int main() {
  char str[100];
  string tmp;

  while (cin.getline(str, 100, '.')) {

    for (;;) {
      for (int i = 0; str[i] != '\\0'; i++) {
        str[i] = shiftCaesar(str[i]);
      }

      tmp = str;

      if (tmp.find("the") != -1 || tmp.find("this") != -1 ||
          tmp.find("that") != -1) {
        break;
      }
    }

    cout << tmp << "." << endl;
  }
  return 0;
}
Problem p00017 (C++) — buggy submission, verdict: Runtime Error

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

bool IncludeKeyWords(const string &Sentence) {
  if (Sentence.find("the") <= 80)
    return true;
  if (Sentence.find("this") <= 80)
    return true;
  if (Sentence.find("that") <= 80)
    return true;
  return false;
}

string OneShift(string Sentence) {
  for (int i = 0; i < Sentence.size(); i++) {
    if (97 < Sentence[i] && Sentence[i] < 123) {
      Sentence[i]--;
    } else if (Sentence[i] == 97) {
      Sentence[i] = 122;
    }
  }
  return Sentence;
}

string Decrypt(string Sentence) {
  int RoopCount = 0;
  while (IncludeKeyWords(Sentence) == false) {
    assert(RoopCount < 26);
    Sentence = OneShift(Sentence);
    RoopCount++;
  }
  return Sentence;
}

int main() {
  while (true) {
    string Sentence;
    getline(cin, Sentence);
    if (cin.eof() == true)
      break;
    string DecryptedSentence = Decrypt(Sentence);
    cout << DecryptedSentence << endl;
  }
  return 0;
}

Error: 0

Fixed submission:

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

bool IncludeKeyWords(const string &Sentence) {
  if (Sentence.find("the") <= 80)
    return true;
  if (Sentence.find("this") <= 80)
    return true;
  if (Sentence.find("that") <= 80)
    return true;
  return false;
}

string OneShift(string Sentence) {
  for (int i = 0; i < Sentence.size(); i++) {
    if (97 < Sentence[i] && Sentence[i] < 123) {
      Sentence[i]--;
    } else if (Sentence[i] == 97) {
      Sentence[i] = 123;
    }
  }
  return Sentence;
}

string Decrypt(string Sentence) {
  int RoopCount = 0;
  while (IncludeKeyWords(Sentence) == false) {
    assert(RoopCount < 26);
    Sentence = OneShift(Sentence);
    RoopCount++;
  }
  return Sentence;
}

int main() {
  while (true) {
    string Sentence;
    getline(cin, Sentence);
    if (cin.eof() == true)
      break;
    string DecryptedSentence = Decrypt(Sentence);
    cout << DecryptedSentence << endl;
  }
  return 0;
}
Problem p00017 (C++) — buggy submission, verdict: Time Limit Exceeded

#include <algorithm>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <iostream>
#include <map>
#include <queue>
#include <stack>
#include <string>
#include <vector>

using namespace std;
typedef long long ll;

int main() {
  int in;
  char S[1000];

  while (NULL != gets(S)) {

    while (1) {

      bool f = false;

      for (int i = 0; S[i] != '\\0'; i++) {
        if ('a' <= S[i] && S[i] <= 'y') {
          S[i]++;
        } else if (S[i] == 'z') {
          S[i] = 'a';
        }

        if (i >= 2) {
          if (S[i - 2] == 't' && S[i - 1] == 'h' && S[i] == 'e')
            f = true;
        }
        if (i >= 3) {
          if (S[i - 3] == 't' && S[i - 2] == 'h')
            if ((S[i - 1] == 'i' && S[i] == 's') ||
                (S[i - 1] == 'a' && S[i] == 't'))
              f = true;
        }
      }

      if (f)
        break;
    }

    printf("%s\\n", S);
  }

  return 0;
}

Error: TLE

Fixed submission:

#include <algorithm>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <iostream>
#include <map>
#include <queue>
#include <stack>
#include <string>
#include <vector>

using namespace std;
typedef long long ll;

int main() {
  int in;
  char S[1000];

  for (int i = 0;; i++) {

    in = getchar();

    if (in == EOF) {
      S[i] = '\\0';
      break;
    } else {
      S[i] = (char)in;
    }
  }

  for (int k = 0;; k++) {

    bool f = false;

    for (int i = 0; S[i] != '\\0'; i++) {
      if ('a' <= S[i] && S[i] <= 'y') {
        S[i]++;
      } else if (S[i] == 'z') {
        S[i] = 'a';
      }

      if (i >= 2 && S[i + 1] < 'a' && 'z' < S[i + 1]) {
        if (S[i - 2] == 't' && S[i - 1] == 'h' && S[i] == 'e')
          f = true;
      }
      if (i >= 3 && S[i + 1] < 'a' && 'z' < S[i + 1]) {
        if (S[i - 3] == 't' && S[i - 2] == 'h')
          if ((S[i - 1] == 'i' && S[i - 0] == 's') ||
              (S[i - 1] == 'a' && S[i - 0] == 't'))
            f = true;
      }
    }

    if (f)
      break;
  }

  for (int i = 0; S[i] != '\\0'; i++)
    printf("%c", S[i]);

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

#include <iostream>
#include <string>

using namespace std;

void forward(string &data) {
  for (auto &c : data) {
    if (c < 'a' || 'z' < c)
      continue;

    c++;
    if ('z' < c)
      c -= 26;
  }
}

bool test(const string &data) {
  if (data.find("the") != string::npos)
    return true;
  if (data.find("this") != string::npos)
    return true;
  if (data.find("that") != string::npos)
    return true;

  return false;
}

int main() {
  string line;
  while (getline(cin, line)) {
    for (int i = 0; i < 26; i++) {
      if (test(line))
        break;
      forward(line);
    }

    cout << line << endl;
  }

  return 0;
}

Error: TLE

Fixed submission:

#include <iostream>
#include <string>

using namespace std;

void forward(string &data) {
  for (auto &c : data) {
    if (c < 'a' || 'z' < c)
      continue;

    c++;
    if ('z' < c)
      c -= 26;
  }
}

bool test(string data) {
  if (data.find("the") != string::npos)
    return true;
  if (data.find("this") != string::npos)
    return true;
  if (data.find("that") != string::npos)
    return true;

  return false;
}

int main() {
  while (!cin.eof()) {
    char buffer[1024];
    cin.getline(buffer, 1024);
    string line(buffer);

    while (true) {
      if (test(line))
        break;
      forward(line);
    }

    cout << line << endl;
  }

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

#include <iostream>
#include <string>

using namespace std;
string buf;
bool found() {
  return buf.find("this", 0) != string::npos ||
         buf.find("that", 0) != string::npos ||
         buf.find("the", 0) != string::npos;
}

bool isalpha(char c) { return 'a' <= c && c <= 'z'; }

int main() {
  while (getline(cin, buf)) {
    while (!found()) {
      for (int i = 0; i < buf.size(); i++) {
        if (isalpha(buf[i]))
          buf[i]++;
        if (buf[i] == 'z' + 1)
          buf[i] = 'a';
      }
    }
    cout << buf << endl;
  }
}

Error: TLE

Fixed submission:

#include <iostream>
#include <string>

using namespace std;
string buf;
bool found() {
  return buf.find("this", 0) != string::npos ||
         buf.find("that", 0) != string::npos ||
         buf.find("the", 0) != string::npos;
}

bool isalpha(char c) { return 'a' <= c && c <= 'z'; }

int main() {
  getline(cin, buf);
  cout << buf << endl;
  while (!found()) {
    for (int i = 0; i < buf.size(); i++) {
      if (isalpha(buf[i]))
        buf[i]++;
    }
    cout << buf << endl;
  }
  cout << buf << endl;
}
Problem p00017 (C++) — buggy submission, verdict: Runtime Error

#include <iostream>
#include <string>

using namespace std;

int main() {
  string input;
  const int alph_lim = 26;

  while (getline(cin, input, '\\n')) {
    for (int i = 0; i < alph_lim; i++) {
      for (int j = 0; j < input.size(); j++) {
        if (islower(input[j])) {
          input[j]++;
          if (input[j] > 'z')
            input[j] -= alph_lim;
        }
      }

      if (input.find("the") != string::npos ||
          input.find("this") != string::npos ||
          input.find("that") != string::npos) {
        cout << input << endl;
        break;
      }
    }
  }

  return 0;
}

Error: WA

Fixed submission:

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

using namespace std;

int main() {
  vector<string> str;
  string input;
  int num[81];
  int slide = 0;
  const int al_num = 26;
  string s_the[al_num];
  string s_this[al_num];
  string s_that[al_num];

  for (int i = 0; i < al_num; i++) {
    s_the[i].push_back(('t' + i - 'a') % al_num + 'a');
    s_the[i].push_back(('h' + i - 'a') % al_num + 'a');
    s_the[i].push_back(('e' + i - 'a') % al_num + 'a');
  }

  for (int i = 0; i < al_num; i++) {
    s_this[i].push_back(('t' + i - 'a') % al_num + 'a');
    s_this[i].push_back(('h' + i - 'a') % al_num + 'a');
    s_this[i].push_back(('i' + i - 'a') % al_num + 'a');
    s_this[i].push_back(('s' + i - 'a') % al_num + 'a');
  }
  for (int i = 0; i < al_num; i++) {
    s_that[i].push_back(('t' + i - 'a') % al_num + 'a');
    s_that[i].push_back(('h' + i - 'a') % al_num + 'a');
    s_that[i].push_back(('a' + i - 'a') % al_num + 'a');
    s_that[i].push_back(('t' + i - 'a') % al_num + 'a');
  }

  for (int i = 0; i < al_num; i++)
    num[i] = -1;

  int i = 0;
  while (cin >> input) {
    num[i++] = input.size();
    str.push_back(input);
  }
  str[i - 1].erase(str[i - 1].size() - 1);
  num[i - 1]--;

  bool loop = false;
  for (int i = 0; num[i] != -1; i++) {
    if (num[i] == 3) { // "the"
      for (int j = 0; j < al_num; j++) {
        if (str[i] == s_the[j]) {
          slide = j;
          loop = true;
          break;
        }
      }
    } else if (num[i] == 4) { // "this", "that"
      for (int j = 0; j < al_num; j++) {
        if (str[i] == s_this[j] || str[i] == s_that[j]) {
          slide = j;
          loop = true;
          break;
        }
      }
    }

    if (loop)
      break;
  }

  // output
  for (int i = 0; num[i] != -1; i++) {
    for (int j = 0; j < num[i]; j++) {
      char c;
      if (str[i][j] - slide < 'a')
        c = 'z' - ('a' - 1 - (str[i][j] - slide));
      else
        c = (str[i][j] - slide - 'a') % al_num + 'a';
      cout << c;
    }
    cout << ' ';
  }
  cout << '\\b' << '.' << endl;

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

#include <algorithm>
#include <iostream>
#include <map>
#include <math.h>
#include <numeric>
#include <queue>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <string>
#include <vector>

using namespace std;

typedef pair<int, int> pii;

#define rep(i, j) for (int i = 0; i < (j); i++)
#define reps(i, j, k) for (int i = j; i <= k; i++)
#define in(i, j, k) ((i) >= (j) && (i) <= (k))

int main() {
  char s[81], c;
  int l, p;
  while (gets(s) != NULL) {
    l = strlen(s);
    while (strstr(s, "the") == NULL && strstr(s, "that") == NULL &&
           strstr(s, "this") == NULL) {
      rep(i, l) {
        if (in(s[i], 'a', 'z')) {
          s[i]++;
          if (s[i] > 'z')
            s[i] -= 26;
        }
      }
    }
    puts(s);
  }
  return 0;
}

Error: TLE

Fixed submission:

#include <algorithm>
#include <iostream>
#include <map>
#include <math.h>
#include <numeric>
#include <queue>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <string>
#include <vector>

using namespace std;

typedef pair<int, int> pii;

#define rep(i, j) for (int i = 0; i < (j); i++)
#define reps(i, j, k) for (int i = j; i <= k; i++)
#define in(i, j, k) ((i) >= (j) && (i) <= (k))

int main() {
  char s[81], c, f = 1;
  int l, p;
  for (;;) {
    p = 0;
    do {
      c = getchar();
      s[p++] = c;
    } while (c != EOF && c != '\\n');
    s[p - 1] = 0;
    l = strlen(s);
    while (strstr(s, "the") == NULL && strstr(s, "that") == NULL &&
           strstr(s, "this") == NULL) {
      rep(i, l) {
        if (in(s[i], 'a', 'z')) {
          s[i]++;
          if (s[i] > 'z')
            s[i] -= 26;
        }
      }
    }
    puts(s);
    if (c == EOF)
      break;
  }
  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)) {
    while (s.find("the") == s.npos && s.find("this") == s.npos &&
           s.find("that") == s.npos) {
      for (int i = 0; i < s.size(); i++) {
        if ('a' <= s[i] && s[i] <= 'y') {
          s[i]++;
        } else if (s[i] == 'z') {
          s[i] = 'a';
        }
      }
    }
    cout << s << endl;
  }

  return 0;
}

Error: TLE

Fixed submission:

#include <iostream>
#include <string>

using namespace std;

int main() {
  string s;

  while (getline(cin, s)) {
    while (s.find("the") == s.npos && s.find("this") == s.npos &&
           s.find("that") == s.npos) {
      for (int i = 0; i < s.size(); i++) {
        if (s[i] >= 'a' || 'y' >= s[i]) {
          s[i]++;
        } else {
          s[i] = 'a';
        }
      }
    }
    cout << s << endl;
  }

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

#include <iostream>
#include <string>
#include <time.h>
using namespace std;

int main() {
  int index, flag = 0, temp = 'z' - '`', cnt = 0;
  string s, key[3] = {"the", "this", "that"};

  while (true) {
    flag = 0;
    getline(cin, s);
    if (cin.eof()) {
      break;
    }

    while (true) {
      for (int i = 0; i < s.length() + 1; i++) { // シーザー暗号を戻す
        if (s[i] != '.' && s[i] != ' ' && s[i] != '\\n') { // 　記号はスルー
          s[i]++;
          if (s[i] > 'z') { // zからaに飛ばす
            s[i] = 'a';
          }
        }
      }

      for (int i = 0; i < 3; i++) {
        index = s.find(key[i], 0);   // the ,this ,that を探す
        if (index != string::npos) { // あった
          cout << s << endl;
          flag = 1;
          break;
        }
      }

      if (flag == 1) {
        break;
      }
    }
  }
}

Error: TLE

Fixed submission:

#include <iostream>
#include <string>
#include <time.h>
using namespace std;

int main() {
  int index, flag = 0, temp = 'z' - '`';
  string s, key[3] = {"the", "this", "that"};

  while (true) {
    flag = 0;
    getline(cin, s);
    if (cin.eof()) {
      break;
    }

    while (true) {
      for (int i = 0; i < s.length(); i++) { // シーザー暗号を戻す
        if (s[i] != '.' && s[i] != ' ' && s[i] != '\\n') { // 　記号はスルー
          s[i]--;
          if (s[i] < 'a') { // aからzに飛ばす
            s[i] += temp;
          }
        }
      }

      for (int i = 0; i < 3; i++) {
        index = s.find(key[i], 0);   // the ,this ,that を探す
        if (index != string::npos) { // あった場合
          cout << s << endl;
          flag = 1;
          cin.ignore();
          break;
        }
      }
      if (flag == 1) {
        break;
      }
    }
  }
}