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

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

    −45.6

    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
    if ( g_nIdleState == 0 ) 
    	{	// Initialize the splash screen right away
    		if ( g_CurrentOptions.get_splash_screen() ) 
    			fgSplashInit();
    		g_nIdleState++;
        } 
    	else 
    		if ( g_nIdleState == 1 ) 
    			g_nIdleState++;
    		else 
    			if ( g_nIdleState == 2 ) 
    				g_nIdleState++;
    			else
    				if ( g_nIdleState == 3 ) 
    				{
    					if( !fgInitSubsystems()) 
    					{
    						FG_LOG(__FILE__, __LINE__,  FG_DK_GENERAL, FG_FALSE,   "Subsystem initializations failed ..." );
    						exit(-1);
    					}
    					g_nIdleState++;
    				}
    				else
    					if ( g_nIdleState == 4 ) 
    					{
    						fgInitVisuals();  // setup OpenGL view parameters
    						g_nIdleState++;
    					}
    					else
    						if ( g_nIdleState == 5 ) 
    							g_nIdleState++;
    						else 
    							if ( g_nIdleState == 6 ) 
    							{
    								mark_time( &g_tsFrame );
    								mark_time(&g_tsTime);
    								g_nIdleState = 1000;
    							} 
    
        if ( g_nIdleState == 1000 ) 
    		fgMainLoop();
    	else 
    		if ( g_CurrentOptions.get_splash_screen() == 1 ) 
    			fgSplashUpdate(0.0);

    процесс загрузки и вывода сплэш-скрина и запуск основного рендера после этого (так предлагал делать flight gear в очень старой версии или чел, который ваял этот код, когда переделывал FG под нужды двигла, бугага)

    guest, 12 Декабря 2008

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

    +29

    1. 1
    $result = $this->CachedRequest(600, $sirenaXml->Write(true) . ' ', $rxml);  // Никто никогда не поверит, зачем нужен пробел. ЧТОБЫ ВСЕ РАБОТАЛО! Магия.

    запрос в систему бронирования авиабилетов

    guest, 11 Декабря 2008

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

    +29

    1. 01
    2. 02
    3. 03
    4. 04
    5. 05
    6. 06
    7. 07
    8. 08
    9. 09
    10. 10
    11. 11
    bool MyProc::CompareModule(int *operand1, int *operand2, int n) {
        for (int i = 1; i < n; i++) {
            if (operand1[i] != operand2[i]) {
                if (operand1[i] < operand2[i])
                    return false;
                else
                    return true;
            };
        };
        return true;
    };

    guest, 10 Декабря 2008

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

    −42.8

    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
    procedure TForm1.fritb(ie:longint;var fr0:extended);
     begin
    v1:=0;
     for nsf:=1 to 5 do
      begin
       kl11:=0;kl12:=0;kl22:=0;
      for k:=1 to km[nsf] do
        begin
        if (cm^[ie]=cm^[nm^[(ie-1)*kms[ksf+1]+kms[nsf]+k]])and (cm^[ie]=1)
        then      kl11:=kl11+1;
        if (cm^[ie]=cm^[nm^[(ie-1)*kms[ksf+1]+kms[nsf]+k]])and (cm^[ie]=2)
        then      kl22:=kl22+1;
    if (cm^[ie]<>cm^[nm^[(ie-1)*kms[ksf+1]+kms[nsf]+k]])and(cm^[nm^[(ie-1)*kms[ksf+1]+kms[nsf]+k]]<>0)and (cm^[ie]<>0)
        then      kl12:=kl12+1;
         end;
      fr0:=fr0+kl11*(p11[1,nsf])+kl22*p11[2,nsf]+kl12*p11[3,nsf];
      v1:=v1+kl11*(f11[1,nsf])+kl22*f11[2,nsf]+kl12*f11[3,nsf];
       end;
      fr0:=fr0-sqrt(abs(v1));
     end;

    процеДуро

    guest, 09 Декабря 2008

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

    −50

    1. 1
    2. 2
    3. 3
    4. 4
    contents = contents.replaceAll("\\&lt;(\\w+)\\&gt;", "<CT_$1>\n");
    				contents = contents.replaceAll("\\&lt;(\\w+)(\\s\\w+)=\\&quot;(\\w+)\\&quot;\\&gt;", "<CT_$1$2=\"$3\">\n");
    				contents = contents.replaceAll("\\&lt;(\\w+)(\\s\\w+)=\\&apos;(\\w+)\\&apos;\\&gt;", "<CT_$1$2='$3'>\n");
    				contents = contents.replaceAll("\\&lt;/(\\w+)\\&gt;", "\n</CT_$1>\n");

    преобразуем эскейпнутые тэги в обычные

    guest, 09 Декабря 2008

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

    +30

    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
    private static string identifier(string wmiClass, string wmiProperty)
                {
                    string result = "";
                    System.Management.ManagementClass mc =
                new System.Management.ManagementClass(wmiClass);
                    System.Management.ManagementObjectCollection moc = mc.GetInstances();
                    foreach (System.Management.ManagementObject mo in moc)
                    {
                        //Only get the first one
                        if (result == "")
                        {
                            try
                            {
                                result = mo[wmiProperty].ToString();
                                break;
                            }
                            catch
                            {
                            }
                        }
                    }
                    return result;
                }

    guest, 08 Декабря 2008

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

    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
    function minifyJSCSS(&$content) {
    	global $USER;
    	global $APPLICATION;
    	if (is_object($USER) && $USER->IsAdmin()) return;
    
    	preg_match_all('/<link.+?href="\/bitrix\/cache[^>]+>/',$content, $result);
    
    	foreach ($result[0] as $css)
    	{
    		preg_match('/(href)=("[^"]*")/i',$css, $file);
    
    		$orig_file = reset(explode('?',str_replace('"','',$file[2])));
    
    		if (stristr($orig_file,'.css') === false)
    			continue;
    
    		$min_file = str_replace('.css','.min.css',$orig_file);
    
    		if (!file_exists($min_file))
    		{
    			$compress = file_get_contents($_SERVER["DOCUMENT_ROOT"].$orig_file);
    			$compress = preg_replace("!/\*[^*]*\*+([^/][^*]*\*+)*/!", "", $compress);
    			$compress = str_replace(array("\r\n", "\r", "\n", "\t", "  ", "    ", "    "), "", $compress);
    			file_put_contents($_SERVER["DOCUMENT_ROOT"].$min_file, $compress);
    		}
    
    		$content = str_replace($orig_file,$min_file,$content);
    	}
    
    
    
    	if (strpos($_SERVER['HTTP_USER_AGENT'],'Lighthouse'))
    	{
    		preg_match_all('/<script.+?src="\/bitrix\/cache[^>]+>/',$content, $result);
    
    		foreach ($result[0] as $js)
    		{
    			preg_match('/(src)=("[^"]*")/i',$js, $file);
    
    			$orig_file = reset(explode('?',str_replace('"','',$file[2])));
    
    			$orig_file = $orig_file;
    			$min_file = str_replace('.js','.min.js',$orig_file);
    
    			if (!file_exists($_SERVER["DOCUMENT_ROOT"].$min_file))
    			{
    
    				$url = 'https://javascript-minifier.com/raw';
    				$js = file_get_contents($_SERVER["DOCUMENT_ROOT"].$orig_file);
    
    				$ch = curl_init();
    
    				curl_setopt_array($ch, [
    					CURLOPT_URL => $url,
    					CURLOPT_RETURNTRANSFER => true,
    					CURLOPT_POST => true,
    					CURLOPT_HTTPHEADER => ["Content-Type: application/x-www-form-urlencoded"],
    					CURLOPT_POSTFIELDS => http_build_query([ "input" => $js ])
    				]);
    
    				$minified = curl_exec($ch);
    				curl_close($ch);
    
    				file_put_contents($_SERVER["DOCUMENT_ROOT"].$min_file,$minified);
    
    				$gzdata = gzencode($minified, 9);
    				file_put_contents($_SERVER["DOCUMENT_ROOT"].$min_file.'.gz', $gzdata);
    
    			}
    
    			$content = str_replace($orig_file,$min_file,$content);
    		}
    	}
    }

    Жулики-говнокодеры пытались улучшить оценку производительности

    Lexchz2, 28 Июня 2026

    Комментарии (1)
  9. Python / Говнокод #29254

    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
    Counting Sort - O(n + k)
    
    Counting Sort	O(n + k)	O(n + k)	O(n + k)	O(k)	✅	Маленький диапазон значений
    def counting_sort(nums):
        count = defaultdict(int)
        minVal, maxVal = min(nums), max(nums)
        for val in nums:
            count[val] += 1
    
        index = 0
        for val in range(minVal, maxVal + 1):
            while count[val] > 0:
                nums[index] = val
                index += 1
                count[val] -= 1
    
    
    
    from collections import defaultdict
    
    def stable_counting_sort(nums):
        if not nums:
            return nums
    
        # 1. Считаем сколько раз встретилось каждое число
        count = defaultdict(int)
        for val in nums:
            count[val] += 1
    
        # 2. Получаем отсортированные ключи
        sorted_keys = sorted(count.keys())
    
        # 3. Считаем префиксные суммы (позиции для стабильности)
        positions = {}
        total = 0
        for key in sorted_keys:
            positions[key] = total
            total += count[key]
    
        # 4. Создаём массив результата
        output = [0] * len(nums)
        for val in nums:
            index = positions[val]
            output[index] = val
            positions[val] += 1  # увеличиваем позицию для следующего одинакового элемента
    
        return output

    storvus, 03 Мая 2026

    Комментарии (1)
  10. C++ / Говнокод #29224

    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
    cin >> N >> L >> T;
      total = 0;
      for (int i = 0; i < N; i++) {
        cin >> S[i] >> H[i] >> P[i];
        total += H[i] * P[i];
      }
      fix_order();
      for (int ind = 0; ind < N; ind++) {
        int len = ind + 1;
        set<pair<long long, int>> events, comps;
        vector<long long> sum_hp(len);
        copy(H, H + len, sum_hp.begin());
        sum_hp[ind] = 0;
        vector<int> ord(len);
        iota(ord.begin(), ord.end(), 0);
        sort(ord.begin(), ord.end(), [&](int i, int j) {
          return S[i] < S[j];
        });
        comps.emplace(T, -1);
        for (int i = 0; i < len; i++) {
          int j = i + 1;
          while (j < len && S[ord[i]] == S[ord[j]]) {
            sum_hp[ord[i]] += sum_hp[ord[j]];
            ++j;
          }
          comps.emplace(S[ord[i]], ord[i]);
          i = j - 1;
        }
        for (auto it = comps.begin(); next(it) != comps.end(); ++it) {
          long long dist = next(it)->first - it->first;
          int idx = it->second;
          if (sum_hp[idx] > 0) {
            events.emplace((dist + sum_hp[idx] - 1) / sum_hp[idx], idx);
          }
        }
        vector<bool> visited(len);
        vector<bool> added(len);
        long long good_sum = 0, last_time = 0, govno = T, rakom_bokom = 0;
        for (auto [spawn, i] : comps) {
          if (spawn >= S[ind] && i != -1) {
            good_sum += sum_hp[i];
            added[i] = true;
          }
        }
        auto Upd = [&](long long time) -> void {
          long long F = govno - S[ind] - rakom_bokom;
          if (F <= 0) {
            return;
          }
          long long r1 = clamp(F / (H[ind] + good_sum) + 1, last_time, time);
          long long r2 = good_sum == 0 ? time : clamp(F / good_sum + 1, last_time, time);
          dp_diff_i[last_time] += H[ind] * P[ind];
          dp_diff_i[r1] -= H[ind] * P[ind];
          dp_diff[r1] += F * P[ind];
          dp_diff[r2] -= F * P[ind];
          dp_diff_i[r1] -= good_sum * P[ind];
          dp_diff_i[r2] += good_sum * P[ind];
          last_time = time;
        };
        vector<bool> skip(len), finished(len);
        while (!events.empty()) {
          auto [time, i] = *events.begin();
          events.erase(events.begin());
          if (time > L) {
            break;
          }
          if (skip[i] || sum_hp[i] == 0) {
            continue;
          }
          Upd(time);
          auto it = comps.upper_bound({S[i], INT_MAX});
          if (it->second == -1 || finished[it->second]) {
            good_sum -= sum_hp[i];
            finished[i] = true;
            govno = S[i];
            continue;
          }
          if (!added[i] && it->second + sum_hp[i] * time >= S[ind]) {
            added[i] = true;
            good_sum += sum_hp[i];
            rakom_bokom += S[i] - S[ind];
          }
          sum_hp[i] += sum_hp[it->second];
          skip[it->second] = true;
          long long next_pos = next(it)->first;
          comps.erase(it);
          events.emplace(time + (next_pos - S[i] - sum_hp[i] * time + sum_hp[i] - 1) / sum_hp[i], i);
        }
        Upd(L + 1);
      }
      long long cur_diff = 0, cur_diff_i = 0;
      for (int i = 0; i <= L; i++) {
        cur_diff += dp_diff[i];
        cur_diff_i += dp_diff_i[i];
        dp[i] = cur_diff + cur_diff_i * i;
      }

    олимпиадное говно

    letipetukh1, 26 Января 2026

    Комментарии (1)
  11. PHP / Говнокод #29214

    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
    <!-- <div class="news">
    	<div class="tch"></div>
    	<div class="container">
    		<h2 class="title"><span><small>Н</small>овости компании</span></h2>
    		<div class="flex">
    			<?php
    			query_posts('cat=21&posts_per_page=3'); // вместо "5" указываем идентификатор вашей рубрики.
    			while (have_posts()) : the_post();
    			?>
    				<div class="item">
    					<div class="img"><?= get_the_post_thumbnail(get_the_ID()); ?></div>
    					<div class="desk">
    						<div class="title"><?= get_the_title() ?></div>
    						<div class="date"><?= get_the_date(); ?></div>
    						<?php the_content() ?>
    						<a href="<?= get_the_permalink();  ?>" class="more">Читать далее</a>
    					</div>
    				</div>
    
    			<?php
    			endwhile;
    			wp_reset_query();
    			?>
    		</div>
    	</div>
    </div> -->

    На ровном месте быдлокодер получает мимимум 7 лишних запросов к БД.

    Lexchz2, 18 Декабря 2025

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