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
| package com.qwant.debouncer; | |
| import java.util.ArrayList; | |
| import java.util.List; | |
| import java.util.concurrent.CompletableFuture; | |
| import java.util.concurrent.Executors; | |
| import java.util.concurrent.ScheduledExecutorService; | |
| import java.util.concurrent.TimeUnit; | |
| import java.util.function.Function; |
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
| -- Employees and departments | |
| CREATE TABLE EMPLOYEES(ID INTEGER, NAME VARCHAR, CHIEF_ID INTEGER, SALARY INTEGER, DEPARTMENT_ID INTEGER); | |
| CREATE TABLE DEPARTMENTS(ID INTEGER, NAME VARCHAR); | |
| INSERT INTO DEPARTMENTS VALUES (1, "DEP 1"), (2, "DEP 2"), (3, "DEP 3"); | |
| INSERT INTO EMPLOYEES VALUES | |
| (1,"Աշոտ",2,3000,1), | |
| (2,"Ophir",NULL,2500,1), | |
| (3,"Армен",1,4000,2); |
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
| #include <iostream> | |
| using namespace std; | |
| bool in(int x, int y, int x1, int x2, int y1, int y2){ | |
| return x1<=x && x<=x2 | |
| && y1<=y && y<=y2; | |
| } | |
| int main() | |
| { |
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
| #include<iostream> | |
| using namespace std; | |
| unsigned int read_base2() { | |
| int n=0; char c; | |
| for(cin.get(c); c=='0'||c=='1'; cin.get(c)) n = (n<<1)|(c-'0'); | |
| return n; | |
| } | |
| void write_base2(unsigned int n, bool first=true) { |
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
| #include<iostream> | |
| using namespace std; | |
| // муха + муха = слон | |
| int main() { | |
| // Числа не могут начитаться с нуля. | |
| // Поэтому муха >= 1000 | |
| // и слон = 2*муха содержит 4 числа, поэтому | |
| // 2*муха <= 9999 | |
| // муха <= 4999 |
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 Data.List | |
| import Control.Monad | |
| data Operation = Plus | Minus | Mul | Div deriving (Eq,Ord) | |
| data Tree = Compute Operation Tree Tree | Leaf Rational deriving (Eq,Ord) | |
| instance Show Tree where | |
| show (Compute op a b) = "(" ++ (show a) ++ (show op) ++ (show b) ++")" | |
| show (Leaf x) = show (fromRational x) |
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
| #include<iostream> | |
| using namespace std; | |
| bool is_mirror(int n) { | |
| if (n<=0) return true; | |
| int n1, n2; | |
| cin >> n1; | |
| if (n==1) return true; | |
| bool inner_mirror = is_mirror(n-2); |
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
| #include <stdio.h> | |
| void swap(int *a, int *b) { | |
| int tmp = *a; *a = *b; *b = tmp; | |
| } | |
| void move_left(int a[], size_t size, int n) { | |
| n = ((n % (int)size) + size) % size; | |
| size_t remaining_size = size; | |
| for(size_t i=0; i<size-1; i++) { |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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 org.apache.spark.ml.linalg.SQLDataTypes.VectorType | |
| import org.apache.spark.ml.linalg.{Vector, Vectors} | |
| import org.apache.spark.sql.Row | |
| import org.apache.spark.sql.expressions.{MutableAggregationBuffer, UserDefinedAggregateFunction} | |
| import org.apache.spark.sql.types._ | |
| class VectorMean extends UserDefinedAggregateFunction { | |
| // This is the input fields for your aggregate function. |