This file contains hidden or 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
char* segment(char *g, int m, int n) { | |
char *r = (char*) malloc((n - m + 1) * sizeof(char)); | |
char *temp = g; | |
temp += m; | |
while (m != n) { | |
r[m] = temp[m]; | |
m++; | |
} |
This file contains hidden or 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
import socket | |
import urllib2 | |
import sys | |
import random | |
import logging | |
import operator | |
logging.basicConfig(filename='runs.log', level=logging.DEBUG) | |
PORT = random.randint(20000, 30000) |
This file contains hidden or 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
from math import sin, cos, radians | |
t = int(input()) | |
for i in range(t): | |
w, h, xt, yt, x0, y0, alpha, s = map(float, input().split()) | |
a = alpha | |
alpha = radians(alpha) |
This file contains hidden or 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
public static void quickSort(int start, int end, int[] a) { | |
int pivot = (a[start] + a[end]) / 2; | |
int left = start; | |
int right = end; | |
int temp; | |
//pivotization | |
while (left <= right) { | |
while (a[left] < pivot) left++; | |
while (a[right] > pivot) right--; |
This file contains hidden or 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 a(x, y): | |
if (x == 0 or y == 0): | |
return | |
x3 = 0 | |
y3 = 0 | |
count = 0 | |
for x1 in range(-x, x + 1): | |
for y1 in range(-y, y + 1): | |
if (x1 == 0 and y1 == 0): | |
continue |
This file contains hidden or 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
import java.awt.event.ActionEvent; | |
import java.awt.event.ActionListener; | |
import javax.swing.*; | |
public class MyException extends JFrame implements ActionListener { | |
JButton calculate; | |
JTextField input; | |
JLabel output; | |
This file contains hidden or 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
private static final char[] SPECIAL = "$!+\-#?_%&/".toCharArray(); | |
private static final char[] NUMBER = "0123456789".toCharArray(); | |
public static boolean checkValidation(String password) | |
{ | |
int points = 0; | |
String lowerPass = password.toLowerCase(); | |
String upperPass = password.toUpperCase(); | |
if(!password.equals(lowerPass) && !password.equals(upperPass)) |
This file contains hidden or 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
# -*- coding: utf-8 -*- | |
h = type("", (), {}) | |
a = "__gt__" | |
c = type("Scissors", (h,), {a: lambda a,c: o(c,k)}) | |
k = type("Paper", (h,), {a: lambda c,k: o(k,f)}) | |
f = type("Rock", (h,), {a: lambda h,a: o(a,c)}) | |
o = isinstance | |
r = {c.__name__.lower():c for c in h.__subclasses__()} | |
u = None | |
m = lambda r: __import__(r) |
This file contains hidden or 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, b = map(int, input().split()); p = __builtins__.print | |
while 1: | |
eq = ''.join(list(__import__('itertools').chain(*zip(["{}".format(__import__('random').randint(a, b)) for i in range(4)], list(sorted(['+', '-', '*'], key=lambda *args: __import__('random').random()))))) + ["{}".format(__import__('random').randint(a, b))]) | |
p("> {}".format(eq)) | |
while 1: | |
_ = input() | |
if _ == "{}".format(eval(eq)): p("welldone");break | |
elif _ == "q": exit(p("quitting")) | |
else: p("tryagain") |
This file contains hidden or 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
program domaca; | |
{$APPTYPE CONSOLE} | |
uses | |
SysUtils; | |
var p : array of boolean; | |
i, j, m, N : integer; |
NewerOlder