1. Лучший говнокод

    В номинации:
    За время:
  2. PHP / Говнокод #105

    −62.7

    1. 1
    2. 2
    3. 3
    4. 4
    5. 5
    6. 6
    if ( strchr ( $_POST["ship$i"], "+") || strchr($_POST["ship$i"], " ") || strchr($_POST["ship$i"], ",") || strchr($_POST["ship$i"], ".") || strchr($_POST["ship$i"], "-") || strchr($_POST["ship$i"], "_") || strchr($_POST["ship$i"], ";") || strchr($_POST["ship$i"], ":") ) { 
    message("You got owned by >>The_Revenge Anticheat Systems<<", "Anticheat");
    }
    if ( !strchr ( $_POST["ship$i"], "+") && !strchr($_POST["ship$i"], " ") && !strchr($_POST["ship$i"], ",") && !strchr($_POST["ship$i"], ".") && !strchr($_POST["ship$i"], "-") && !strchr($_POST["ship$i"], "_") && !strchr($_POST["ship$i"], ";") && !strchr($_POST["ship$i"], ":")) {
    // код
    }

    Немец предложил такое решение для проверки, что в строке ship$i именно положительное целое число и ни что иное.
    В другом месте попадается аналогичный момент, только там после каждого strchr для каждого спецсимвола идет 10 строк одного и того же кода с двумя запросами к БД и выдачей бана юзеру...
    Проект XNova (ogame-like)

    guest, 11 Декабря 2008

    Комментарии (3)
  3. Java / Говнокод #76

    −32.7

    1. 01
    2. 02
    3. 03
    4. 04
    5. 05
    6. 06
    7. 07
    8. 08
    9. 09
    10. 10
    11. 11
    12. 12
    13. 13
    14. 14
    15. 15
    16. 16
    17. 17
    18. 18
    19. 19
    20. 20
    21. 21
    22. 22
    23. 23
    24. 24
    25. 25
    26. 26
    27. 27
    28. 28
    29. 29
    30. 30
    public void updateAmountValues(List<TransactionResultItem> transactionResultItems) {
            for (TransactionResultItem transaction : transactionResultItems) {
                Account account = getAccountById(transaction.getAccountId());
                if ((transaction.getMainTransaction()
                        && ! transaction.getTransactionTypeId().equals(4)
                        && ! transaction.getTransactionTypeId().equals(5)
                        && ! transaction.getTransactionTypeId().equals(6))
                        ||
                        (! transaction.getMainTransaction() &&
                                (transaction.getTransactionTypeId().equals(5) &&
                                        ((account.getAccountTypeId().equals(AccountType.INCOME_TYPE_ID) ||
                                                account.getAccountTypeId().equals(AccountType.OTHER_INCOME_TYPE_ID)) &&
                                                transaction.getAmount() > 0)
                                        || (transaction.getAccountId().equals(getSalesTaxPayableAccountId()) && transaction.getAmount() > 0)
                                        || ((account.getAccountTypeId().equals(AccountType.EXPENSE_TYPE_ID) ||
                                        account.getAccountTypeId().equals(AccountType.OTHER_EXPENSE_TYPE_ID)) && transaction.getAmount() < 0))
                                || (transaction.getTransactionTypeId().equals(1) &&
                                (account.getAccountTypeId().equals(AccountType.INCOME_TYPE_ID) ||
                                        account.getAccountTypeId().equals(AccountType.OTHER_INCOME_TYPE_ID)) &&
                                transaction.getAmount() < 0)
                                || (transaction.getTransactionTypeId().equals(2) &&
                                (account.getAccountTypeId().equals(AccountType.INCOME_TYPE_ID) ||
                                        account.getAccountTypeId().equals(AccountType.OTHER_INCOME_TYPE_ID)) &&
                                transaction.getAmount() > 0)
                        )) {
                    Double amount = transaction.getAmount();
                    transaction.setAmount(-amount);
                }
            }
        }

    Потрясающий по понятности код. Вызывался несколько раз в одном и том же методе.

    guest, 08 Декабря 2008

    Комментарии (3)
  4. PHP / Говнокод #29236

    +1

    1. 1
    2. 2
    3. 3
    4. 4
    5. 5
    6. 6
    7. 7
    <? // get current season for header styling
    		$current_month = date("m");
    		if($current_month >= "03" && $current_month <= "05") $season = "spring";
    		elseif($current_month >= "06" && $current_month <= "08") $season = "spring";
    		elseif($current_month >= "09" && $current_month <= "11") $season = "autumn";
    		else $season = "winter";
      ?>

    И про теги в стиле говноБитрикса не забыли

    Lexchz2, 25 Февраля 2026

    Комментарии (2)
  5. C++ / Говнокод #29234

    0

    1. 01
    2. 02
    3. 03
    4. 04
    5. 05
    6. 06
    7. 07
    8. 08
    9. 09
    10. 10
    11. 11
    12. 12
    13. 13
    14. 14
    15. 15
    16. 16
    17. 17
    18. 18
    19. 19
    20. 20
    21. 21
    22. 22
    23. 23
    24. 24
    25. 25
    26. 26
    27. 27
    28. 28
    29. 29
    30. 30
    31. 31
    32. 32
    33. 33
    34. 34
    35. 35
    36. 36
    37. 37
    38. 38
    39. 39
    40. 40
    41. 41
    42. 42
    43. 43
    44. 44
    45. 45
    46. 46
    47. 47
    48. 48
    49. 49
    50. 50
    51. 51
    52. 52
    53. 53
    54. 54
    55. 55
    56. 56
    57. 57
    58. 58
    59. 59
    60. 60
    61. 61
    62. 62
    63. 63
    64. 64
    65. 65
    66. 66
    67. 67
    68. 68
    69. 69
    70. 70
    #pragma GCC optimize("03")
    #include <bits/stdc++.h>
    #pragma GCC target("avx2,tune=native")
    using namespace std;
    int binxor(int a, int b) {
        if (b == 0) {
            return 0;
        }
        int t = binxor(a, b / 2);
        if (b % 2 == 0) {
            return t ^ t;
        } else {
            return t ^ t ^ a;
        }
    }
    vector<int> per(20);
    vector<int> res(binxor(1 << 20, numeric_limits<int>::max() + 2), -1);
    vector<int> need(binxor(1 << 20, numeric_limits<int>::max() + 2), 0);
    vector<int> gp(binxor(1 << 20, numeric_limits<int>::max() + 2), 1 << 30);
    int c = 0;
    int Trump = 0;
    inline void f(int i, int n, int w) {
        if (i == w) {
            for (int j = 0; j < w; j++) {
                if ((Trump >> (w - 1 - j)) & 1) {
                    gp[Trump] = min(gp[Trump], gp[Trump ^ (1 << (w - 1 - j))]);
                }
            }
            return;
        }
        f(i + 1, n, w);
        Trump ^= 1 << (w - 1 - i);
        f(i + 1, n, w);
        Trump ^= 1 << (w - 1 - i);
    }
    signed main() {
        ios_base::sync_with_stdio(0);
        cin.tie(0);
        cout.tie(0);
        int n, q, w;
        cin >> n >> q >> w;
        vector<string> s(n);
        for (auto &x : s) {
            cin >> x;
        }
        vector<int> ord(n);
        iota(ord.begin(), ord.end(), 0);
        sort(ord.begin(), ord.end(), [&](int x, int y) {
            return s[x] < s[y];
        });
        for (int i = 0; i < n; i++) {
            int Trump = 0;
            for (auto ch : s[ord[i]]) {
                Trump |= 1 << (ch - 'a');
            }
            gp[Trump] = min(gp[Trump], i);
        }
        f(0, n, w);
        for (int i = 0; i < q; ++i) {
            string t;
            cin >> t;
            int Harris = 0;
            for (auto ch : t) {
                Harris |= 1 << (ch - 'a');
            }
            int val = gp[((1 << w) - 1) ^ Harris];
            cout << (val >= n ? -1 : 1 + ord[val]) << "\n";
        }
        return 0;
    }

    Без комментариев

    letipetukh1, 13 Февраля 2026

    Комментарии (2)
  6. C++ / Говнокод #29233

    0

    1. 01
    2. 02
    3. 03
    4. 04
    5. 05
    6. 06
    7. 07
    8. 08
    9. 09
    10. 10
    11. 11
    12. 12
    13. 13
    14. 14
    const std::string programPath =
        "/root/CLionProjects/PetukhPlusPlus/program.petukh";
    
    const std::string lexerOutPath =
        "/root/CLionProjects/PetukhPlusPlus/res_lexer.txt";
    
    const std::string syntaxOutPath =
        "/root/CLionProjects/PetukhPlusPlus/res_syntax.txt";
    
    const std::string semanticOutPath =
        "/root/CLionProjects/PetukhPlusPlus/res_semantic.txt";
    
    const std::string polizOutPath =
        "/root/CLionProjects/PetukhPlusPlus/res_poliz.txt";

    Классика говнокода

    letipetukh1, 12 Февраля 2026

    Комментарии (2)
  7. PHP / Говнокод #29204

    0

    1. 01
    2. 02
    3. 03
    4. 04
    5. 05
    6. 06
    7. 07
    8. 08
    9. 09
    10. 10
    11. 11
    12. 12
    13. 13
    14. 14
    15. 15
    16. 16
    17. 17
    18. 18
    19. 19
    20. 20
    21. 21
    22. 22
    23. 23
    24. 24
    25. 25
    26. 26
    27. 27
    28. 28
    29. 29
    30. 30
    31. 31
    32. 32
    <?php 
    /********************** 
    						R.I.P PHP 6.6.6
    						Dedicaded to Victoria Null& from Vladivostok vodka drinkers
    ***********************/
    _: 004 | 001 & !!!define("_", [null, !32768, (float)'\x1551', (bool)'\x9', 2, 3, 4, 5, 6, 10, 15, 16, 24, 31, 
                            42, 47, -1024, 56, 58, 60, 61, 62, PHP_INT_MIN, 63, 64, 65, (null), 72, 73, 75, 77, 
                            80, 81, 87, 88, 92, 0b10000000000, 100, 101, 111, 127, 128, 129, PHP_INT_MIN - 1, 131, 
                            2048, PHP_INT_MAX - 1, 2049, 1023, 1024, 4095, 4096, 8191, 8192, 9009, 8193, 
                            PHP_INT_MAX, 0b1100, 10001,]) & null | 007 | 006; goto ___;
    __: goto _;
    ___ :
    $_ = count(_,);
    while (000000000000001 >> 1 ^ $_ ^ 00000000000001 << 0 >> 1) 
    {
    	if (!
    		!!
    		!!!
    		!!!! 
    		!!!!! (_[--$_] & (_[$_ & ~0] - 00000000000000000000000000000000000001)))
    		~ ~~ ~~~ ~~~~ ~~~~~~ ~~~~~~~~~~~~~~~ ~~~~~ ~~~~~~~~~~~~~~ ~~~~~~ ~~~~~ ~~~ ~~ ~
    		print __NAMESPACE__ . __FUNCTION__ . __METHOD__ . \_[$_ | 000] . null . PHP_EOL;
    		~ ~~ ~~~ ~~~~ ~~~~~~ ~~~~~~~~~~~~~~~ ~~~~~ ~~~~~~~~~~~~~~ ~~~~~~ ~~~~~ ~~~ ~~ 0;
    }
    ###### Since [full of ol' su*kers] board decided to fire my possibly edgy person off the team now you're looking at this brainf**kin shit. 
    ###### Better go invest into D-- or B++ you stupid monks ######
    
    ###### /* C/T/F m/a/r/k/e/r: the snippet above works only on 7.3.0+ 
    ###### Allowed to change ONLY 1 character to make it compiles on lower versions.
    ###### Anwser format: #.#.# (Min. version number which has no compile time errors) 
    ###### Happy hooking, fuzzing ladies! */
    echo (null[die]) ?>

    когда казалось, что хоть пыху немного понимать начал..
    Как это распарсить, деды?

    Raspi_s_Dona, 29 Ноября 2025

    Комментарии (2)
  8. C++ / Говнокод #29202

    0

    1. 01
    2. 02
    3. 03
    4. 04
    5. 05
    6. 06
    7. 07
    8. 08
    9. 09
    10. 10
    11. 11
    12. 12
    13. 13
    14. 14
    15. 15
    16. 16
    17. 17
    18. 18
    19. 19
    20. 20
    21. 21
    22. 22
    23. 23
    24. 24
    25. 25
    26. 26
    27. 27
    28. 28
    void makeShape(ShapeArguments shape)
    {
        if (shape.type == ShapeType::Square)
        {
            throw Square(shape);
        }
    
        if (shape.type == ShapeType::Cicle)
        {
            throw Circle(shape);
        }
    }
    
    void handleShape(ShapeArguments shape)
    {
        try
        {
            makeShape(shape);
        }
        catch (const Square& square)
        {
            // Work with square
        }
        catch (const Circle& circle)
        {
            // Work with circle
        }
    }

    factory

    kcalbCube, 25 Ноября 2025

    Комментарии (2)
  9. Haskell / Говнокод #29201

    0

    1. 01
    2. 02
    3. 03
    4. 04
    5. 05
    6. 06
    7. 07
    8. 08
    9. 09
    10. 10
    11. 11
    12. 12
    13. 13
    14. 14
    15. 15
    16. 16
    17. 17
    18. 18
    19. 19
    20. 20
    21. 21
    22. 22
    23. 23
    24. 24
    25. 25
    26. 26
    27. 27
    28. 28
    29. 29
    30. 30
    31. 31
    32. 32
    33. 33
    34. 34
    35. 35
    36. 36
    37. 37
    38. 38
    39. 39
    40. 40
    41. 41
    42. 42
    43. 43
    44. 44
    45. 45
    46. 46
    47. 47
    48. 48
    49. 49
    50. 50
    51. 51
    52. 52
    53. 53
    54. 54
    55. 55
    56. 56
    57. 57
    58. 58
    59. 59
    60. 60
    61. 61
    62. 62
    63. 63
    64. 64
    65. 65
    66. 66
    67. 67
    68. 68
    69. 69
    70. 70
    71. 71
    72. 72
    73. 73
    74. 74
    75. 75
    76. 76
    77. 77
    78. 78
    79. 79
    80. 80
    81. 81
    82. 82
    83. 83
    84. 84
    85. 85
    86. 86
    87. 87
    88. 88
    89. 89
    90. 90
    91. 91
    92. 92
    93. 93
    94. 94
    95. 95
    96. 96
    97. 97
    {-# LANGUAGE BangPatterns #-}
    
    import Data.List (intercalate)
    
    -- Тип для представления пары значений
    data TwoVal = TwoVal !Int !Int
      deriving (Show, Eq)
    
    -- Тип для пары с флагом обмена
    data TwoValAndStatus = TwoValAndStatus 
      { isSwapped :: !Bool
      , twoVal    :: !TwoVal
      } deriving (Show, Eq)
    
    -- Тип для массива (используем список для идиоматичности Haskell)
    type Array = [Int]
    
    -- Тип для массива с состоянием сортировки
    data ArrayAndStatus = ArrayAndStatus
      { hasSwap :: !Bool
      , position :: !Int
      , array :: !Array
      } deriving (Show, Eq)
    
    -- Сортировка двух элементов с возвратом статуса обмена
    sort2 :: TwoVal -> TwoValAndStatus
    sort2 (TwoVal a b)
      | a > b     = TwoValAndStatus True (TwoVal b a)
      | otherwise = TwoValAndStatus False (TwoVal a b)
    
    -- Чтение пары значений из массива по позиции
    readTwoVal :: Array -> Int -> Maybe TwoVal
    readTwoVal arr pos
      | pos < length arr - 1 = Just $ TwoVal (arr !! pos) (arr !! (pos + 1))
      | otherwise = Nothing
    
    -- Сохранение значения в массив по индексу
    storeVal :: Array -> Int -> Int -> Array
    storeVal arr val pos = 
      take pos arr ++ [val] ++ drop (pos + 1) arr
    
    -- Сохранение пары значений в массив
    storeTwoVal :: Array -> TwoVal -> Int -> Array
    storeTwoVal arr (TwoVal a b) pos =
      storeVal (storeVal arr a pos) b (pos + 1)
    
    -- Рекурсивная функция сортировки пузырьком
    bubbleSortRec :: ArrayAndStatus -> ArrayAndStatus
    bubbleSortRec state@(ArrayAndStatus swap pos arr)
      | pos >= length arr - 1 = 
          if not swap
            then state  -- Сортировка завершена!
            else bubbleSortRec $ ArrayAndStatus False 0 arr  -- Новый проход
      | otherwise = 
          case readTwoVal arr pos of
            Nothing -> state
            Just pair -> -- ← Переименовали переменную здесь
              let sortResult = sort2 pair
                  newArr = storeTwoVal arr (twoVal sortResult) pos -- ← Используем селектор twoVal
                  newSwap = swap || isSwapped sortResult
              in bubbleSortRec $ ArrayAndStatus newSwap (pos + 1) newArr
    
    -- Основная функция сортировки
    bubbleSort :: Array -> Array
    bubbleSort arr = array $ bubbleSortRec $ ArrayAndStatus False 0 arr
    
    -- Более идиоматичная версия для Haskell (альтернативная реализация)
    bubbleSortIdiomatic :: Ord a => [a] -> [a]
    bubbleSortIdiomatic = untilFixed bubblePass
      where
        bubblePass [] = []
        bubblePass [x] = [x]
        bubblePass (x:y:xs)
          | x > y     = y : bubblePass (x:xs)
          | otherwise = x : bubblePass (y:xs)
        
        untilFixed f x = let fx = f x
                         in if fx == x then x else untilFixed f fx
    
    -- Функция для красивого вывода
    showArray :: Show a => [a] -> String
    showArray = intercalate ", " . map show
    
    -- Главная функция
    main :: IO ()
    main = do
      let initialArray = [8, 2, 4, 1, 3, 5, 7, 0, 6, 9]
      let sortedArray = bubbleSort initialArray
      
      putStrLn "input"
      putStrLn $ showArray initialArray
      
      putStrLn "\nsort:"
      putStrLn $ showArray sortedArray
      
      putStrLn "\nsort2:"
      putStrLn $ showArray $ bubbleSortIdiomatic initialArray

    Переписал через "ИИ" свою чисто-функциональную сортировку пузырьком на "Haskell". Оригинальный код на Си в https://govnokod.ru/27880#comment755323

    j123123, 24 Ноября 2025

    Комментарии (2)
  10. Haskell / Говнокод #29199

    0

    1. 1
    2. 2
    3. 3
    4. 4
    5. 5
    6. 6
    7. 7
    (defun s (f)
      (lambda (g)
        (lambda (x)
          (funcall (funcall f x) (funcall g x)))))
    
    (let ((result #'(lambda () (funcall (funcall (funcall #'s #'(lambda (n) #'(lambda (x) (+ x n)))) #'(lambda (x) (* x x))) 5))))
      (print (funcall result)))

    может, объединить ski и y комбинаторы с самодельными сумматорами и сделать самое запутанное сложение всех времен?

    lisp-worst-code, 14 Ноября 2025

    Комментарии (2)
  11. Haskell / Говнокод #29189

    0

    1. 01
    2. 02
    3. 03
    4. 04
    5. 05
    6. 06
    7. 07
    8. 08
    9. 09
    10. 10
    11. 11
    12. 12
    13. 13
    14. 14
    15. 15
    16. 16
    17. 17
    18. 18
    19. 19
    20. 20
    21. 21
    22. 22
    23. 23
    24. 24
    25. 25
    26. 26
    27. 27
    28. 28
    29. 29
    30. 30
    31. 31
    32. 32
    33. 33
    34. 34
    35. 35
    36. 36
    37. 37
    38. 38
    39. 39
    40. 40
    41. 41
    42. 42
    43. 43
    44. 44
    45. 45
    46. 46
    47. 47
    48. 48
    49. 49
    50. 50
    51. 51
    52. 52
    53. 53
    54. 54
    55. 55
    56. 56
    57. 57
    58. 58
    59. 59
    60. 60
    61. 61
    62. 62
    63. 63
    64. 64
    65. 65
    66. 66
    (defun |Addition Explicit Synergistic Complex| (|Addend variable| |Sumend variable|)
      "Returns a+b with graph
    
       If you watching this code,
       you should immediately go to
       J. Edgar Hoover Building
       935 Pennsylvania Avenue NW
       Washington, D.C. 20535
       and confess to all the crimes.
    
       You will be fined $1,000,000 and
       sentenced to 25 years in prison."
    
      (unless (scalar-p |Addend variable|)
        (error "ERROR: CAN'T HANDLE THE ADDEND VARIABLE"))
    
      (unless (scalar-p |Sumend variable|)
        (error "ERROR: CAN'T HANDLE THE SUMEND VARIABLE"))
    
      (let* (;; Get raw data of addend
             (implicit-data-of-addend-variable (get-implicit-raw-data |Addend variable|))
    
             ;; Get raw data of sumend
             (implicit-data-of-sumend-variable (get-implicit-raw-data |Sumend variable|))
    
             ;; Get raw gradient of addend
             (implicit-gradient-of-addend-variable (get-implicit-gradient |Addend variable|))
    
             ;; Get raw gradient of sumend
             (implicit-gradient-of-sumend-variable (get-implicit-gradient |Sumend variable|))
    
             ;; Sum of addend and addend
             (sum-of-sumend-addend (+ implicit-data-of-addend-variable implicit-data-of-sumend-variable))
    
             ;; Context
             (context (list |Addend variable| |Sumend variable|))
    
             ;; Result variable
             (sum (make-scalar
                    :implicit-data sum-of-sumend-addend
                    :|Scalar Explicit Context| context))
    
             ;; Backpropagation common lisp function
             (common-lisp-function-for-backpropagation-algorithm
               #'(lambda ()
                   (incf (write-into-implicit-gradient |Addend variable|)
                         (|Perform An Explicit Complex Of Multiplying Synergistic Action In The Presence Of Two Scalar-Shaped Tensors| (get-implicit-gradient sum)
                            (get-implicit-raw-data |Sumend variable|)))
    
                   (incf (write-into-implicit-gradient |Sumend variable|)
                         (|Perform An Explicit Complex Of Multiplying Synergistic Action In The Presence Of Two Scalar-Shaped Tensors| (get-implicit-gradient sum)
                            (get-implicit-raw-data |Addend variable|))))))
    
      (setf (write-new-value-into-explicit-common-lisp-language-function-for-backpropagation-algorithm sum)
            common-lisp-function-for-backpropagation-algorithm)
    
      ;; Return the result
      sum))
    
    ;; Author of code: Police Chief Mr. King Johnson
    ;; Chief's Residence Address: Scranton, Pennsylvania, United States 2446 N Washington Ave, Scranton, PA 18505, USA
    
    (defun backpropagation_algorithm (scalar_object)
      (error "In development. Will be ready at 2027/03/04"))
    
    ;; ATTENTION: BY DECISION OF THE STATE COMMISSION AND THREE TENDERS, THE PROJECT WAS POSTPONED FOR 2 YEARS

    3 часть

    lisp-worst-code, 18 Октября 2025

    Комментарии (2)