1. 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)
  2. SQL / Говнокод #29223

    0

    1. 1
    ORDER BY (|lng - :lng| + |lat - :lat|) ASC LIMIT 1

    «Иногда нам нужно определить местоположение пользователя, когда мы точно знаем его координаты (например получили их используя датчики GPS устройства или Geolocation API в браузере). Тут есть два варианта — обратное геокодирование нам возвращает название того места, где находится пользователь. Но что произойдет, если пользователь находится где-то на трассе между городами, или в пригороде или просто в чистом поле и хочет посмотреть объявления о продаже участков на этом поле? Не всегда обратный геокодер с этим справится.

    В этом случае лично я поступаю так — у меня в базе данных хранятся все координаты городов России, в которых у нас имеются объявления и с которыми мы вообще работаем. И по координатам пользователя я просто определяю ближайший к нему город из нашей базы, с помощью простого запроса.»


    С Х-ра. Кто сразу поймёт, почему эта формула плоха?

    HoBorogHuu_nemyx, 26 Января 2026

    Комментарии (26)
  3. Python / Говнокод #29222

    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
    import itertools
    import time
    n = int(input())
    a = []
    sm = 0
    for i in range(n):
        a.append(list(map(int, input().split())))
        a[i].sort()
        sm += a[i][0] + a[i][1]
    mx = 0
    a.sort()
    for i in itertools.product([0, 1], repeat=n - 1):
        if time.process_time() > 0.75:
            break
        s = 0
        for j in range(n):
            if j >= 1:
                s += a[j][i[j - 1]]
            else:
                s += a[j][0]
        s2 = sm - s
        if s % 3 == 0 and s > mx:
            mx = s
        if s2 > mx and s2 % 3 == 0:
            mx = s2
    print(mx)

    Задача с ЕГЭ: "Даны пары (A[i][0], A[i][1]), в каждой паре нужно выбрать одно число, при этом сумма выбранных чисел должна делится на 3, среди таких сумм найти максимальную"

    Автор данного кода не справился нормально соптимизировать решение, поэтому написал какую-то х**ню, результат видите выше (особенно строчка 13)
    Оно зашло на тестах, где n <= 20

    letipetukh1, 25 Января 2026

    Комментарии (0)
  4. Си / Говнокод #29221

    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
    /* IOCTL calls for E-Ink paper update */
    #define EPAPER_UPDATE_LOCAL 0x101         /** Update localarea */
    #define EPAPER_UPDATE_PART  0x102         /** ???              */
    #define EPAPER_UPDATE_FULL  0x103         /** Fully update     */
    #define EPAPER_UPDATE_DISPLAY_QT  0x120d  /** Update all display
    
    /* Helper FB update function */
    int epaper_update_helper(int fb, unsigned long int ioctl_call, void *mode)
    {
      if (framebuffer_descriptor >= 0)
      {
        errno=0;
        ioctl(fb, ioctl_call, mode);
    //    sleep_timer=sleep_timeout; // Reset sleep timer on every display refresh = we are not have any constantly refreshing display parts now!
        return errno;
      }
      return TRUE;
    }
    
    void epaperUpdate(__attribute__((unused)) unsigned long int ioctl_call, __attribute__((unused)) void *mode)
    {
      #ifndef __amd64
      int ioctl_result;
      #endif //__amd64
      TRACE("Called void epaperUpdate()\n");
      if (enable_refresh == FALSE)
      {
        TRACE("Display refresh was locked, IGNORED!\n");
        (void) ioctl_call;
        (void) mode;
        return;
      }
      #ifndef __amd64
      /* Иначе запись в видеопамять не успевает завершиться и получаем верхний левый угол новой картинки и нижний правый - прежней. */
    //  if (hw_platform != HW_PLATFORM_SIBRARY_GTK) {
    //    const struct timespec delay = {0, QT_REFRESH_DELAY};
    //    nanosleep(&delay, NULL);
    //  }
      ioctl_result=epaper_update_helper(framebuffer_descriptor, ioctl_call, mode);
      #ifdef debug
      if (ioctl_result != 0)
      {
        TRACE("Display refresh ioctl call FAILED %d (%s)\n", ioctl_result, strerror(ioctl_result));
        // GTK прошивка, обновление от Qt: 1 (Операция не позволяется)
        // Qt прошивка, обновление от GTK: 22 (Недопустимый аргумент)
      }
      #else
      (void) ioctl_result;
      #endif
      #endif
      return;
    }
    
    
    int detect_refresh_type (void)
    {
      int mode=3;
    #if 0
      struct mxcfb_update_data data = {
        .update_region =
        { .top = 0,
          .left = 0,
          .width = 1,
          .height = 1
        },
        .update_mode = UPDATE_MODE_FULL,
        .update_marker = 0,
        .waveform_mode = WAVEFORM_MODE_AUTO,
        .temp = TEMP_USE_AMBIENT,
        .flags = 0
      };
    #endif
      if (epaper_update_helper(framebuffer_descriptor, EPAPER_UPDATE_DISPLAY_QT, &mode) == 0)
      {
        refresh_type=REFRESH_NEW;
        TRACE("Display refresh was successed, new\n");
      }
      else if (epaper_update_helper(framebuffer_descriptor, EPAPER_UPDATE_FULL, &mode) == 0)
      {
        refresh_type=REFRESH_LEGACY;
        TRACE("Display refresh was successed, legacy\n");
      }
    //  else if (epaper_update_helper(framebuffer_descriptor, MXCFB_SEND_UPDATE_ORG, &data) == 0)
    //  {
    //    refresh_type=REFRESH_KOBO;
    //    TRACE("Display refresh was successed, kobo\n");
    //  }
      else
      {
        TRACE("Display refresh was not detected!\n");
      }
      return (refresh_type);
    }

    Источник:
    https://github.com/gheorghe-crihan/digma-e605-qt-apps-framework/blob/master/firstapp/digma_hw.c

    Не то, чтобы говно, просто код испещрён #if 0 и комментариями.

    HoBorogHuu_nemyx, 25 Января 2026

    Комментарии (19)
  5. Куча / Говнокод #29220

    0

    1. 1
    IT Оффтоп #227

    #197: https://govnokod.ru/28935 https://govnokod.xyz/_28935
    #198: https://govnokod.ru/28938 https://govnokod.xyz/_28938
    #199: https://govnokod.ru/28942 https://govnokod.xyz/_28942
    #200: https://govnokod.ru/28945 https://govnokod.xyz/_28945
    #201: https://govnokod.ru/28948 https://govnokod.xyz/_28948
    #202: https://govnokod.ru/28951 https://govnokod.xyz/_28951
    #203: https://govnokod.ru/28954 https://govnokod.xyz/_28954
    #204: https://govnokod.ru/28971 https://govnokod.xyz/_28971
    #205: https://govnokod.ru/28986 https://govnokod.xyz/_28986
    #206: https://govnokod.ru/28991 https://govnokod.xyz/_28991
    #207: https://govnokod.ru/29002 https://govnokod.xyz/_29002
    #208: https://govnokod.ru/29060 https://govnokod.xyz/_29060
    #209: https://govnokod.ru/29070 https://govnokod.xyz/_29070
    #210: https://govnokod.ru/29079 https://govnokod.xyz/_29079
    #211: https://govnokod.ru/29092 https://govnokod.xyz/_29092
    #212: https://govnokod.ru/29093 https://govnokod.xyz/_29093
    #213: https://govnokod.ru/29104 https://govnokod.xyz/_29104
    #214: https://govnokod.ru/29114 https://govnokod.xyz/_29114
    #215: https://govnokod.ru/29125 https://govnokod.xyz/_29125
    #216: https://govnokod.ru/29132 https://govnokod.xyz/_29132
    #217: https://govnokod.ru/29147 https://govnokod.xyz/_29147
    #218: https://govnokod.ru/29156 https://govnokod.xyz/_29156
    #219: https://govnokod.ru/29166 https://govnokod.xyz/_29166
    #220: https://govnokod.ru/29181 https://govnokod.xyz/_29181
    #221: https://govnokod.ru/29185 https://govnokod.xyz/_29185
    #222: https://govnokod.ru/29190 https://govnokod.xyz/_29190
    #223: https://govnokod.ru/29203 https://govnokod.xyz/_29203
    #224: https://govnokod.ru/29211 https://govnokod.xyz/_29211
    #225: https://govnokod.ru/29212 https://govnokod.xyz/_29212
    #226: https://govnokod.ru/29218 https://govnokod.xyz/_29218

    nepeKamHblu_nemyx, 24 Января 2026

    Комментарии (93)
  6. Куча / Говнокод #29219

    0

    1. 1
    Пиздец-оффтоп #122

    #92: https://govnokod.ru/28884 https://govnokod.xyz/_28884
    #93: https://govnokod.ru/28889 https://govnokod.xyz/_28889
    #94: https://govnokod.ru/28895 https://govnokod.xyz/_28895
    #95: https://govnokod.ru/28904 https://govnokod.xyz/_28904
    #96: https://govnokod.ru/28912 https://govnokod.xyz/_28912
    #97: https://govnokod.ru/28918 https://govnokod.xyz/_28918
    #98: https://govnokod.ru/28932 https://govnokod.xyz/_28932
    #99: https://govnokod.ru/28936 https://govnokod.xyz/_28936
    #100: https://govnokod.ru/28940 https://govnokod.xyz/_28940
    #101: https://govnokod.ru/28949 https://govnokod.xyz/_28949
    #102: https://govnokod.ru/28978 https://govnokod.xyz/_28978
    #103: https://govnokod.ru/28982 https://govnokod.xyz/_28982
    #104: https://govnokod.ru/28989 https://govnokod.xyz/_28989
    #105: https://govnokod.ru/29052 https://govnokod.xyz/_29052
    #106: https://govnokod.ru/29069 https://govnokod.xyz/_29069
    #107: https://govnokod.ru/29086 https://govnokod.xyz/_29086
    #108: https://govnokod.ru/29102 https://govnokod.xyz/_29102
    #109: https://govnokod.ru/29126 https://govnokod.xyz/_29126
    #110: https://govnokod.ru/29136 https://govnokod.xyz/_29136
    #111: https://govnokod.ru/29142 https://govnokod.xyz/_29142
    #112: https://govnokod.ru/29155 https://govnokod.xyz/_29155
    #113: https://govnokod.ru/29160 https://govnokod.xyz/_29160
    #114: https://govnokod.ru/29165 https://govnokod.xyz/_29165
    #115: https://govnokod.ru/29173 https://govnokod.xyz/_29173
    #116: https://govnokod.ru/29174 https://govnokod.xyz/_29174
    #117: https://govnokod.ru/29182 https://govnokod.xyz/_29182
    #118: https://govnokod.ru/29191 https://govnokod.xyz/_29191
    #119: https://govnokod.ru/29196 https://govnokod.xyz/_29196
    #120: https://govnokod.ru/29205 https://govnokod.xyz/_29205
    #121: https://govnokod.ru/29216 https://govnokod.xyz/_29216

    nepeKamHblu_nemyx, 13 Января 2026

    Комментарии (223)
  7. Куча / Говнокод #29218

    0

    1. 1
    IT Оффтоп #226

    #196: https://govnokod.ru/28925 https://govnokod.xyz/_28925
    #197: https://govnokod.ru/28935 https://govnokod.xyz/_28935
    #198: https://govnokod.ru/28938 https://govnokod.xyz/_28938
    #199: https://govnokod.ru/28942 https://govnokod.xyz/_28942
    #200: https://govnokod.ru/28945 https://govnokod.xyz/_28945
    #201: https://govnokod.ru/28948 https://govnokod.xyz/_28948
    #202: https://govnokod.ru/28951 https://govnokod.xyz/_28951
    #203: https://govnokod.ru/28954 https://govnokod.xyz/_28954
    #204: https://govnokod.ru/28971 https://govnokod.xyz/_28971
    #205: https://govnokod.ru/28986 https://govnokod.xyz/_28986
    #206: https://govnokod.ru/28991 https://govnokod.xyz/_28991
    #207: https://govnokod.ru/29002 https://govnokod.xyz/_29002
    #208: https://govnokod.ru/29060 https://govnokod.xyz/_29060
    #209: https://govnokod.ru/29070 https://govnokod.xyz/_29070
    #210: https://govnokod.ru/29079 https://govnokod.xyz/_29079
    #211: https://govnokod.ru/29092 https://govnokod.xyz/_29092
    #212: https://govnokod.ru/29093 https://govnokod.xyz/_29093
    #213: https://govnokod.ru/29104 https://govnokod.xyz/_29104
    #214: https://govnokod.ru/29114 https://govnokod.xyz/_29114
    #215: https://govnokod.ru/29125 https://govnokod.xyz/_29125
    #216: https://govnokod.ru/29132 https://govnokod.xyz/_29132
    #217: https://govnokod.ru/29147 https://govnokod.xyz/_29147
    #218: https://govnokod.ru/29156 https://govnokod.xyz/_29156
    #219: https://govnokod.ru/29166 https://govnokod.xyz/_29166
    #220: https://govnokod.ru/29181 https://govnokod.xyz/_29181
    #221: https://govnokod.ru/29185 https://govnokod.xyz/_29185
    #222: https://govnokod.ru/29190 https://govnokod.xyz/_29190
    #223: https://govnokod.ru/29203 https://govnokod.xyz/_29203
    #224: https://govnokod.ru/29211 https://govnokod.xyz/_29211
    #225: https://govnokod.ru/29212 https://govnokod.xyz/_29212

    nepeKamHblu_nemyx, 10 Января 2026

    Комментарии (407)
  8. Куча / Говнокод #29217

    +1

    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
    Новогодний оффтоп #6
    ░░░░░░░░░░░░░░░░░▐▌░░░░░░░░░░░░░░░░░
    ░░░░░░░░░░░░░░░▀████▀░░░░░░░░░░░░░░░
    ░░░░░░░░░░░░░░░▄█▀▀█▄░░░░░░░░░░░░░░░
    ░░░░░░░░░░░░░░░░░▄▄░░░░░░░░░░░░░░░░░
    ░░░░░░░░░░░░░░░▄████▄░░░░░░░░░░░░░░░
    ░░░░░░░░░░░▄▄██╬██╬████▄▄░░░░░░░░░░░
    ░░░░░░░░▀███████╬███╬██████▀░░░░░░░░
    ░░░░░░░░░░▄▄█╬████╬█████▄▄░░░░░░░░░░
    ░░░░▄▄▄▄██╬████╬█████╬███╬██▄▄▄▄░░░░
    ░░░░░░▀▀████╬█████╬█████████▀▀░░░░░░
    ░░░░░░░░░▄█████╬██████╬███▄░░░░░░░░░
    ░░▄▄▄▄██████╬█████╬███████╬███▄▄▄▄░░
    ░░▀▀▀████╬█████╬████╬███╬██████▀▀▀░░
    ░░░░░░░░████╬████████╬██████░░░░░░░░
    ░░▄▄▄█████╬██████╬█████╬███╬███▄▄▄░░
    ▀▀▀████╬█████╬█████╬████╬███╬████▀▀▀
    ░░░░░░▀▀▀██████████████████▀▀▀░░░░░░
    ░░░░░░░░░░░░░░░░████░░░░░░░░░░░░░░░░
    ░░░░░░░░░░░░░░░░████░░░░░░░░░░░░░░░░

    #1: https://govnokod.ru/27188 https://govnokod.xyz/_27188
    #2: https://govnokod.ru/27893 https://govnokod.xyz/_27893
    #3: https://govnokod.ru/28484 https://govnokod.xyz/_28484
    #4: https://govnokod.ru/28896 https://govnokod.xyz/_28896
    #5: https://govnokod.ru/29066 https://govnokod.xyz/_29066

    HoBorogHuu_nemyx, 30 Декабря 2025

    Комментарии (96)
  9. Куча / Говнокод #29216

    0

    1. 1
    Пиздец-оффтоп #121

    #91: https://govnokod.ru/28880 https://govnokod.xyz/_28880
    #92: https://govnokod.ru/28884 https://govnokod.xyz/_28884
    #93: https://govnokod.ru/28889 https://govnokod.xyz/_28889
    #94: https://govnokod.ru/28895 https://govnokod.xyz/_28895
    #95: https://govnokod.ru/28904 https://govnokod.xyz/_28904
    #96: https://govnokod.ru/28912 https://govnokod.xyz/_28912
    #97: https://govnokod.ru/28918 https://govnokod.xyz/_28918
    #98: https://govnokod.ru/28932 https://govnokod.xyz/_28932
    #99: https://govnokod.ru/28936 https://govnokod.xyz/_28936
    #100: https://govnokod.ru/28940 https://govnokod.xyz/_28940
    #101: https://govnokod.ru/28949 https://govnokod.xyz/_28949
    #102: https://govnokod.ru/28978 https://govnokod.xyz/_28978
    #103: https://govnokod.ru/28982 https://govnokod.xyz/_28982
    #104: https://govnokod.ru/28989 https://govnokod.xyz/_28989
    #105: https://govnokod.ru/29052 https://govnokod.xyz/_29052
    #106: https://govnokod.ru/29069 https://govnokod.xyz/_29069
    #107: https://govnokod.ru/29086 https://govnokod.xyz/_29086
    #108: https://govnokod.ru/29102 https://govnokod.xyz/_29102
    #109: https://govnokod.ru/29126 https://govnokod.xyz/_29126
    #110: https://govnokod.ru/29136 https://govnokod.xyz/_29136
    #111: https://govnokod.ru/29142 https://govnokod.xyz/_29142
    #112: https://govnokod.ru/29155 https://govnokod.xyz/_29155
    #113: https://govnokod.ru/29160 https://govnokod.xyz/_29160
    #114: https://govnokod.ru/29165 https://govnokod.xyz/_29165
    #115: https://govnokod.ru/29173 https://govnokod.xyz/_29173
    #116: https://govnokod.ru/29174 https://govnokod.xyz/_29174
    #117: https://govnokod.ru/29182 https://govnokod.xyz/_29182
    #118: https://govnokod.ru/29191 https://govnokod.xyz/_29191
    #119: https://govnokod.ru/29196 https://govnokod.xyz/_29196
    #120: https://govnokod.ru/29205 https://govnokod.xyz/_29205

    nepeKamHblu_nemyx, 27 Декабря 2025

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

    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
    (defun arange-user-shape-int (&key from to step (dtype :int64) shape rank)
      (nnl2.ffi:%int-arange from to step t shape rank dtype))
      
    (defun arange-user-shape-float (&key from to step (dtype nnl2.system:*default-tensor-type*) shape rank)
      (nnl2.ffi:%float-arange from to step t shape rank dtype))  
      
    (defun arange-auto-shape-int (&key from to step (dtype :int64))
      (nnl2.ffi:%int-arange from to step nil nnl2.ffi:*null* 1 dtype))
    
    (defun arange-auto-shape-float (&key from to step (dtype nnl2.system:*default-tensor-type*))
      (nnl2.ffi:%float-arange from to step nil nnl2.ffi:*null* 1 dtype))
      
    (defun arange-user-shape (from to step dtype indices)
      (multiple-value-bind (shape rank) (nnl2.hli:make-shape-pntr indices)
        (if (or (floatp from) (floatp to) (floatp step))
    	  (if dtype
    	    (arange-user-shape-float :from from :to to :step step :dtype dtype :shape shape :rank rank)
    	    (arange-user-shape-float :from from :to to :step step :shape shape :rank rank))
    		
    	  (if dtype 
    	    (arange-user-shape-int :from from :to to :step step :dtype dtype :shape shape :rank rank)
    	    (arange-user-shape-int :from from :to to :step step :shape shape :rank rank)))))
    
    (defun arange-auto-shape (from to step dtype)
      (if (or (floatp from) (floatp to) (floatp step))
        (if dtype 
    	  (arange-auto-shape-float :from from :to to :step step :dtype dtype)
    	  (arange-auto-shape-float :from from :to to :step step))
    	  
    	(if dtype  
          (arange-auto-shape-int :from from :to to :step step :dtype dtype)
          (arange-auto-shape-int :from from :to to :step step))))
    
    (defun arange (&key from to step dtype shape)
      (if shape 
        (arange-user-shape from to step dtype shape)
        (arange-auto-shape from to step dtype)))

    реальный код в отличии от моих шуточных

    lisp-worst-code, 24 Декабря 2025

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