Ad
Code
Diff
  • #include <stdbool.h>
    
    bool odd_even(int n)
    {
        return n < 0 || n > 1 ? odd_even(n + 2 * (n < 0 ? 1 : -1)) : !n;
    }
    • #include <stdbool.h>
    • bool odd_even(int n)
    • {
    • int r = 0, p[1] = {0};
    • goto owo;
    • uwu:
    • *&*p = (&r)[0];
    • goto miau;
    • owo:
    • *(int*)((void*)&r) = n%2;
    • goto uwu;
    • miau:
    • return !(*p&1) ? true : false;
    • return n < 0 || n > 1 ? odd_even(n + 2 * (n < 0 ? 1 : -1)) : !n;
    • }
Code
Diff
  • #include <stdlib.h>
    #include <string.h>
    
    char *fanis(char *r, int k) {
        char *w = malloc(strlen(r) + 1), *p = w;
        while(w && *r) *p++ = k + *r++;
        return w;
    }
    • #include <stdlib.h>
    • #include <string.h>
    • char *fanis(char* r, int k) {
    • char *w = malloc(strlen(r)+1);
    • if (!w)
    • char *fanis(char *r, int k) {
    • char *w = malloc(strlen(r) + 1), *p = w;
    • while(w && *r) *p++ = k + *r++;
    • return w;
    • char *p = w;
    • while (*r)
    • *p++ = k + *r++;
    • return w;
    • }
Code
Diff
  • #include <string.h>
    #include <stdlib.h>
    
    char *fanis(char *r, int k) {
      char *w = malloc(strlen(r) + 1), *p = w;
      if(w) while(*r) *p++ = k + *r++;
      return realloc(w, strlen(w) + 1);
    }
    • #include <string.h>
    • #include <stdlib.h>
    • char *fanis(char* r, int k) {
    • char* w = malloc(strlen(r) + 1);
    • if (w != NULL) {
    • char* p = w;
    • while (*r) { *p++ = k + *r++;}
    • *p = '\0'; w = realloc(w, strlen(w) + 1);}return w;}
    • char *fanis(char *r, int k) {
    • char *w = malloc(strlen(r) + 1), *p = w;
    • if(w) while(*r) *p++ = k + *r++;
    • return realloc(w, strlen(w) + 1);
    • }
Sets
Code
Diff
  • dumbRockPaperScissors=lambda a,b:"Draw"if a==b else f"Player {(a!={'Rock':'Paper','Paper':'Scissors','Scissors':'Rock'}[b])+1} wins"
    • def dumbRockPaperScissors(player1, player2):
    • Rock = {"Paper"}
    • Paper = {"Scissors"}
    • Scissors = {"Rock"}
    • if player1 in eval(player2):
    • return "Player 1 wins"
    • elif player2 in eval(player1):
    • return "Player 2 wins"
    • else:
    • return "Draw"
    • dumbRockPaperScissors=lambda a,b:"Draw"if a==b else f"Player {(a!={'Rock':'Paper','Paper':'Scissors','Scissors':'Rock'}[b])+1} wins"
Code
Diff
  • import java.util.Arrays;
    import java.lang.Math; 
    
    public class MaxNumber {
        public static long print(long number) {
            int z = (int)Math.ceil(Math.log10(number));
            long digits[] = new long[z];
            int index = 0;
            while(number > 0) {
                digits[index++] = number % 10;
                number /= 10;
            }
            Arrays.sort(digits);
            long result = 0;
            while(z --> 0) {
              result = result * 10 + digits[z];
            }
            return result;
        }
    }
    • import java.util.Arrays;
    • import java.lang.Math;
    • public class MaxNumber {
    • public static long print(long number) {
    • return number
    • int z = (int)Math.ceil(Math.log10(number));
    • long digits[] = new long[z];
    • int index = 0;
    • while(number > 0) {
    • digits[index++] = number % 10;
    • number /= 10;
    • }
    • Arrays.sort(digits);
    • long result = 0;
    • while(z --> 0) {
    • result = result * 10 + digits[z];
    • }
    • return result;
    • }
    • }

fix the code lol

Code
Diff
  • #include <stdio.h>
    
    int prnt_mltply(int m, int n) {
        int i = 1;
        while(i <= m) {
            int j = 1;
            while(j <= n) {
                printf("%d * %d = %d \n", i, j, i * j);
                j++;
            }
            i++;
            printf("\n");
        }
        return m - n;
    }
    • #include<stdio.h>
    • int main()
    • {
    • int i=1;
    • while(i<=5)
    • {
    • int j=1;
    • while(j<=12)
    • {
    • printf("%d * %d =%d
    • ", i,j, i*j);
    • j++;
    • #include <stdio.h>
    • int prnt_mltply(int m, int n) {
    • int i = 1;
    • while(i <= m) {
    • int j = 1;
    • while(j <= n) {
    • printf("%d * %d = %d
    • ", i, j, i * j);
    • j++;
    • }
    • i++;
    • printf("\n");
    • }
    • i++;
    • printf("\n");
    • }
    • return(0);
    • return m - n;
    • }
Code
Diff
  • #include <stddef.h>
    
    static const char *nums[] = {
      "zero", "one", "two", "three", "four", "five", "six", "seven", "eight", "nine"
    };
    
    const char *digit_to_text(unsigned digit) {
    	return digit < 10u ? nums[digit] : NULL;
    }
    • #include <stddef.h>
    • const char* digit_to_text(unsigned digit)
    • {
    • static const char* nums[] = {"zero", "one", "two", "three", "four", "five", "six", "seven", "eight", "nine"};
    • if(digit > 9u)
    • {
    • return NULL;
    • }
    • return nums[digit];
    • static const char *nums[] = {
    • "zero", "one", "two", "three", "four", "five", "six", "seven", "eight", "nine"
    • };
    • const char *digit_to_text(unsigned digit) {
    • return digit < 10u ? nums[digit] : NULL;
    • }
Code
Diff
  • digitToText
    
        =_=>
    
            `zero one two three four five six seven eight nine`.split` `[_]
    • const nums = ['zero', 'one', 'two', 'three', 'four', 'five', 'six', 'seven', 'eight', 'nine']
    • function digitToText(digit) {
    • return nums[digit]
    • }
    • digitToText
    • =_=>
    • `zero one two three four five six seven eight nine`.split` `[_]
Code
Diff
  • class Kata {
    
      public static String verifySum(String nameOne, String nameTwo) {
            if(nameOne == null || nameTwo == null) {
                return "NULL";
            }
            int sum = 0, lengthOne = nameOne.length(), lengthTwo = nameTwo.length();
            for(int i = 0; i < lengthOne; i++) {
                char c = nameOne.charAt(i);
                sum += c > 96 ? c - 32 : c;
            }
            for(int i = 0; i < lengthTwo; i++) {
                char c = nameTwo.charAt(i);
                sum -= c > 96 ? c - 32 : c;
            }
            return sum == 0 ? "TRUE" : "FALSE";
        }
    }
    • class Kata{
    • class Kata {
    • public static String verifySum(String nameOne, String nameTwo) {
    • int[] sumOfNames = new int[]{0, 0};
    • if (nameOne == null || nameTwo == null) {
    • if(nameOne == null || nameTwo == null) {
    • return "NULL";
    • }
    • for (int i = 0; i < nameOne.length(); i++){
    • sumOfNames[0] += nameOne.charAt(i);
    • int sum = 0, lengthOne = nameOne.length(), lengthTwo = nameTwo.length();
    • for(int i = 0; i < lengthOne; i++) {
    • char c = nameOne.charAt(i);
    • sum += c > 96 ? c - 32 : c;
    • }
    • for (int i = 0; i < nameTwo.length(); i++){
    • sumOfNames[1] += nameTwo.charAt(i);
    • for(int i = 0; i < lengthTwo; i++) {
    • char c = nameTwo.charAt(i);
    • sum -= c > 96 ? c - 32 : c;
    • }
    • return sumOfNames[0] == sumOfNames[1] ? "TRUE" : "FALSE";
    • return sum == 0 ? "TRUE" : "FALSE";
    • }
    • }
Code
Diff
  • helloWorld
    
        =_=>
    
            _?`Hello World baby`:`No World`
    • /*def hello_world(world):
    • if world == True:
    • return "Hello World baby"
    • elif world == False:
    • return "No World"*/
    • helloWorld
    • // helloWorld = (world) => world == true ? 'Hello World baby': 'No World';
    • =_=>
    • const helloWorld=(world)=>world==true?`Hello World baby`:`No World`;
    • _?`Hello World baby`:`No World`
Code
Diff
  • prod = __import__('math').prod
    • from math import prod as p
    • prod = lambda a: p(a)
    • prod = __import__('math').prod
Code
Diff
  • from math import prod as p
    
    prod = lambda a: p(a)
    • prod = lambda args: args[0] * args[1]
    • from math import prod as p
    • prod = lambda a: p(a)
Code
Diff
  • prod = lambda args: args[0] * args[1]
    • prod = lambda args: __import__('functools').reduce(lambda x, y: x * y, [args[0], args[1]])
    • prod = lambda args: args[0] * args[1]
Code
Diff
  • /*def hello_world(world):
        if world == True:
            return "Hello World baby"
        elif world == False:
            return "No World"*/
    
    // helloWorld = (world) => world == true ? 'Hello World baby': 'No World';
    
    helloWorld
    
        =(_)=>
    
            _?`Hello World baby`:`No World`
    • // def hello_world(world):
    • // if world == True:
    • // return "Hello World baby"
    • // elif world == False:
    • // return "No World"
    • helloWorld = (world) => world == true ? 'Hello World baby': 'No World';
    • /*def hello_world(world):
    • if world == True:
    • return "Hello World baby"
    • elif world == False:
    • return "No World"*/
    • // helloWorld = (world) => world == true ? 'Hello World baby': 'No World';
    • helloWorld
    • =(_)=>
    • _?`Hello World baby`:`No World`
Code
Diff
  • greeting=Greeting=lambda name,rank='',formal=False:"He{0}, {1}{2}{3}{4}".format(('y','llo')[formal],rank*formal,' '*bool(rank and formal),name,'!.'[formal])
    • def Greeting(n, rank='', formal=False):
    • determinant = f'{rank} {n}' if formal and rank else f'{n}'
    • return f"Hello, {determinant}." if formal else f"Hey, {determinant}!"
    • greeting=Greeting=lambda name,rank='',formal=False:"He{0}, {1}{2}{3}{4}".format(('y','llo')[formal],rank*formal,' '*bool(rank and formal),name,'!.'[formal])
Loading more items...