This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
a=input | |
i=int | |
s=i(a()) | |
d=i(a()) | |
print(f'{i((s+d+1)/2)}\n{i((s-d)/2)}') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
* linux/kernel/fork.c | |
* | |
* Copyright (C) 1991, 1992 Linus Torvalds | |
*/ | |
/* | |
* 'fork.c' contains the help-routines for the 'fork' system call | |
* (see also entry.S and others). | |
* Fork is rather simple, once you get the hang of it, but the memory |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using System.Collections; | |
public abstract class IntSeq : IEnumerable | |
{ | |
public abstract int Size { get; set; } | |
public abstract void clear(); | |
public abstract void unshift(int item); | |
public abstract int shift(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function map(n, start1, stop1, start2, stop2) { | |
return ((n-start1)/(stop1-start1))*(stop2-start2)+start2; | |
} | |
function scovilleToLevel(scoville) { | |
let log = Math.log10(scoville); | |
return map(log, 0, 6, 1, 11); // 6 because Math.log10(1000000)=6 | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def pentagonal(n): | |
return n * (3 * n - 1) // 2 | |
@lru_cache(maxsize=None) | |
def generalized_pentagonal(n): | |
if n == 0: | |
return pentagonal(0) | |
if n % 2 == 0: | |
return pentagonal(-n // 2) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def gen_pythagorean_triple(p, primitive=True): | |
mlimit = int((p/2)**0.5)+1 | |
for m in range(2, mlimit): | |
if (p//2) % m == 0: | |
if m % 2 == 0: | |
k = m + 1 | |
else: | |
k = m + 2 | |
while k < 2*m and k <= p // (2*m): | |
if p // (2*m) % k == 0 and gcd(k, m) == 1: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?xml version='1.0'?> | |
<!DOCTYPE fontconfig SYSTEM 'fonts.dtd'> | |
<fontconfig> | |
<match target="font"> | |
<edit mode="assign" name="rgba"> | |
<const>rgb</const> | |
</edit> | |
</match> | |
<match target="font"> | |
<edit mode="assign" name="hinting"> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
tpid=`xinput list | grep SynPS | sed 's/.*id\=\([0-9]\+\).*/\1/g'` | |
declare -i status | |
status=`xinput list-props ${tpid} | grep Device\ Enabled | sed -e 's/.*\:[ \t ]\+//g'` | |
if [ 0 -eq ${status} ] ; then | |
xinput enable ${tpid} | |
else |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package com.teddygaming.engine; | |
import java.util.ArrayList; | |
import org.lwjgl.input.Keyboard; | |
import org.lwjgl.input.Mouse; | |
import com.teddygaming.engine.math.vec2; | |
public class Input | |
{ |