text
stringlengths
0
26.7k
image
imagewidth (px)
16
768
language
stringclasses
32 values
```python import requests import json import urllib baseUrl = 'https://api.ellipsis-drive.com/v2' s = requests.Session() def get(url, parameters = None, token = None): if type(parameters) != type(None): if type(parameters) != type({}): raise ValueError('parameters of an API call must be of typ...
Python
``` * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See...
PlainText
```javascript function main(input){ input = input.trim(); let list = input.split(""); let answer = 0; for(let i=0; i<list.length; i++){ if(list[i]==="R"){ if(answer===0){answer++; }else if(list[i-1]==="R"){ answer++; } } } console.log(answer); } main(requir...
JS
```python import sys import copy N = map(int, raw_input().strip().split(" ")) M = map(int, raw_input().strip().split(" ")) max = 0 def gcd (a,b): if (b == 0): return a else: return gcd (b, a % b) for i in range(N[0]): A = copy.copy(M) A.pop(i) res = A[0] for c in A[1::]: ...
Python
```haskell import Control.Monad import Control.Applicative import Debug.Trace import System.IO data Tree = Branch Tree Tree | Leaf deriving (Eq) instance Show Tree where show (Branch l1 r1) = "("++show l1 ++ "," ++show r1 ++ ")" show Leaf = "" main :: IO () main = do ss <- (map...
Haskell
```go * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, ```
Go
```kotlin package test import com.github.t1.yaml.model.Comment import com.github.t1.yaml.model.Directive import com.github.t1.yaml.model.Document import com.github.t1.yaml.model.Scalar import org.junit.jupiter.api.BeforeEach import org.junit.jupiter.api.Disabled import org.junit.jupiter.api.Nested @Suppress("ClassNam...
Kotlin
```java import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner in = new Scanner(System.in); while (in.hasNext()) { int c1 = in.nextInt(); int c2 = in.nextInt(); int c3 = in.nextInt(); int p = 20 - (c1 + c2); boolean isYes; if (10 <= p) { isYes = true;...
Java
```javascript function Main(input) { abc = input.split(" ").map(c => parseInt(c)); var set = new Set(abc); console.log(set.size); } Main(require("fs").readFileSync("/dev/stdin", "utf8")); ```
JS
```python """empty message Revision ID: 8f4df40a36f3 Revises: f71c86333bfb Create Date: 2020-09-24 18:53:02.861732 """ import sqlalchemy as sa import sqlalchemy_utils from alembic import op from project import dbtypes # revision identifiers, used by Alembic. revision = "8f4df40a36f3" down_revision = "f71c86333bfb" ...
Python
```csharp // act // assert IExecutionResult res1 = await tester.ExecuteAsync( QueryRequestBuilder.New() .SetQuery("{ root(order: { bar: ASC}){ bar}}") .Create()); res1.MatchDocumentSnapshot("ASC"); IExecutionResult...
C#
```javascript var altText = generateAltText(text, 1); appendAlt(imgTag, altText); } } }); } /***/ }) }, /******/ function(__webpack_require__) { // webpackRuntimeModules /******/ /* webpack/runtime/getFullHash */ /******/ (() => { /******/ __webpack_require__.h = () => ("b3c2cd1f542ef63258ff") /*...
JS
```java /* * Copyright 2018-2020 The Code Department. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not * use this file except in compliance with the License. You may obtain a copy of * the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required b...
Java
```c /********************************************************************** Audacity: A Digital Audio Editor ProjectAudioManager.h Paul Licameli split from ProjectManager.h ```
C
```python #!/usr/bin/python3 """ author = Ravinder Singh revision = 07-19-2020 """ from pathlib import Path import random import os def move_to_test_set(test_path,iterable): if not os.path.exists(test_path): os.mkdir(test_path) for image in iterable: if not os.path.exists(os.path.join(test_pat...
Python
```csharp using System; using System.Linq; public class Program { static void Main() { char[] s = Console.ReadLine().ToCharArray(); if (s[0] != 'A') { Console.WriteLine("WA"); return; } int count = 0; int index = 2; for (int i = ...
C#
```python import pytest @pytest.mark.eda def test_timeout(gcd_chip): # 0 seconds guarantees a timeout gcd_chip.set('flowgraph', 'asicflow', 'import', '0', 'timeout', 0) # Expect that command exits early # TODO: automated check that run timed out vs failed for a different reason with pytest.raises(...
Python
```sql DROP PROCEDURE IF EXISTS `proc_get_sites_trends`; DELIMITER // CREATE PROCEDURE `proc_get_sites_trends` (IN S_id INT(11), IN filter_year INT(11)) BEGIN SET @QUERY = "SELECT `month`, `year`, SUM(`confirmtx`) AS `confirmtx`, SUM(`confirm2vl`) AS `confirm2vl`, SUM(`bas...
SQL
```php <!-- /#left-panel --> <!-- Right Panel --> <div id="right-panel" class="right-panel"> <!-- Header--> <header id="header" class="header"> <div class="top-left"> <div class="navbar-header"> <a class="navbar-brand" href="./"><img src="images/lo...
PHP
```c #include<stdio.h> int main(){ int n=0,i,j,p=0,x[10000]; long long int Sum=0; scanf("%d",&n); for(i=0;i<n;i++){ scanf("%d",&x[i]); Sum+=x[i]; } for(i=0;i<n;i++){ for(j=n-1;j>i;j--){ if(x[j]<x[j-1]){ p=x[j-1]; x[j-1]=x[j]; ...
C
```xml xmlns:Custom="http://metro.mahapps.com/winfx/xaml/controls" xmlns:Resources="clr-namespace:Certify.Locales;assembly=Certify.Locales" xmlns:certifyui="clr-namespace:Certify.UI" xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:dragablz="clr-namespace:Dragablz;assembly=Dragablz" ...
XML
```dockerfile FROM ruby:2.5-alpine3.8 RUN apk add --update alpine-sdk ARG RUBY_GEMS="riemann-tools" RUN gem install --verbose --no-rdoc --no-ri $RUBY_GEMS CMD ["riemann-health", "--help"] ```
Dockerfile
```python from NewsExtraction import Extraction from SentimentAnalysis import SentimentScore if __name__ == "__main__": company_name = input("Enter the company name - ") df = Extraction(company_name) print(df) score = SentimentScore(df) print(score) ```
Python
```csharp using System; using System.Linq; namespace ConsoleApp1 { class Program { static void Main(string[] args) { var abc=Console.ReadLine().Split(' ').Select(s=>int.Parse(s)).ToList(); abc.Sort(); Console.WriteLine(abc[0]==abc[2]+abc[1]?"YES":"NO"); ...
C#
```javascript // to simulate network latency switch (endpoint) { case '/login': server.login(data.username, data.password, callback); break; case '/register': server.register(data.username, data.password, callback); break; case '/logout': server.logout(callb...
JS
```csharp using System; class Kai { static void Main() { var input = Console.ReadLine(); Console.WriteLine(Solution(input)); } static string Solution(string s) { var l = (s.Length - 1) / 2; var s1 = s.Substring(0, l); var s2 = s.Substring(l + 1, l); ...
C#
```c // AOJ0009 #include<stdio.h> int main(){ int n, i, j, k; while(scanf("%d", &n) != EOF){ j = 0; if(n == 0 || n == 1) printf("%d\n", 0); else if(n == 2) printf("%d\n", 1); else{ for(i = 2; i < n; i++){ for(k = 2; k < i; k++){ if(i%k == 0) goto EXIT; } j++; EXIT:; } ...
C
```csharp using System; namespace ABC105_B { class Program { static void Main(string[] args) { var N = int.Parse(Console.ReadLine()); var r = "Yes"; if (N %4!=0) r = "No"; if (N % 4 != 0) r = "No"; if (N%11 != 0) r = "No"; ...
C#
```dockerfile FROM python:2.7.15 ARG Z3_VERSION="4.8.1" RUN wget https://github.com/Z3Prover/z3/archive/z3-${Z3_VERSION}.tar.gz \ && tar xf z3-${Z3_VERSION}.tar.gz \ && cd z3-z3-${Z3_VERSION} \ && python scripts/mk_make.py --python \ && cd build \ && make -j4 \ && make ...
Dockerfile
```ruby tab = gets.strip.split.map(&:to_i).sort if tab[0] == 5 && tab[1] == 5 && tab[2] == 7 puts "YES" else puts "NO" end ```
Ruby
```c /* Fontname: -FreeType-LucasArts SCUMM Subtitle Roman-Medium-R-Normal--16-160-72-72-P-88-ISO10646-1 Copyright: Copyright Goatmeal 2013 Glyphs: 89/95 BBX Build Mode: 0 */ const uint8_t u8g2_font_lucasarts_scumm_subtitle_r_tf[1597] U8G2_FONT_SECTION("u8g2_font_lucasarts_scumm_subtitle_r_tf") = "Y\0\4\...
C
```go /* Package inframanager provides an interface to the infrastrcture manager Copyright 2018 Portworx Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 ...
Go
```cpp #include<bits/stdc++.h> using namespace std; signed main() { string s; int n,sa,sb,ea,eb,end; cin>>n>>sa>>sb>>ea>>eb; cin>>s; eb--; ea--; sa--; sb--; bool check=false; for(int i=0;i<n;i++) { int cnt=0; if(s[i]=='#'&&i>eb&&check==false) end=i,check=true; while(1) { if(s[i]=='.') break; cn...
C++
```python # WARNING: much of this module is untested, this module makes permanent server configurations. # Use with caution! from __future__ import print_function import sys import os import fnmatch import datetime import json import urlparse from dateutil.relativedelta import relativedelta from collections import name...
Python
```scala package ml.combust.pachyderm import com.typesafe.sbt.SbtPgp.autoImportImpl._ import com.typesafe.sbt.pgp.PgpKeys._ import xerial.sbt.Sonatype.autoImport._ import sbt._ import sbt.Keys._ object Common { lazy val defaultSettings: Seq[Def.Setting[_]] = buildSettings lazy val buildSettings: Seq[Def.Setting[...
Scala
```html <!-- Map Section --> <div id="map-group"> <div id="map"></div> <div id="map-info"> <h3 class="underborder">Almas Conference Center</h3> <p> DMCC Free Zone <br/> Ground Floor <br/> Dubai, UAE <p> </div> </div> ```
HTML
```scala package lisa.kernel.fol trait Substitutions extends FormulaDefinitions { /** * A lambda term to express a "term with holes". Main use is to be substituted in place of a function schema. * Morally equivalent to a 2-tuples containing the same informations. * @param vars The names of the "holes" in t...
Scala
```dockerfile FROM python:3.6-slim ARG AWS_ACCESS_KEY_ID ARG AWS_SECRET_ACCESS_KEY ARG AWS_SESSION_TOKEN ENV AWS_REGION us-east-1 ENV AWS_ACCESS_KEY_ID $AWS_ACCESS_KEY_ID ENV AWS_SECRET_ACCESS_KEY $AWS_SECRET_ACCESS_KEY ENV AWS_SESSION_TOKEN $AWS_SESSION_TOKEN RUN pip install --upgrade pip \ && pip install awscl...
Dockerfile
```cpp void Tray::PopUpContextMenu(mate::Arguments* args) { mate::Handle<Menu> menu; args->GetNext(&menu); gfx::Point pos; args->GetNext(&pos); tray_icon_->PopUpContextMenu(pos, menu.IsEmpty() ? nullptr : menu->model()); } void Tray::SetContextMenu(v8::Isolate* isolate, mate::Handle<Menu> menu) { menu_.Res...
C++
```python n,m,k = map(int, input().split()) a = list(map(int, input().split())) b = list(map(int, input().split())) books = sorted(a+b) minutes = 0 for i in range(len(books)): minutes += books[i] if minutes > k: print(i) break elif i == len(books)-1: print(len(books)) break...
Python
```html <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "https://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head><title></title> <meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/> <meta name="generator" content="Doxygen 1.9.1"/> <link...
HTML
```javascript // Select default $allowedToCreateDropdown.data('glDropdown').selectRowAtIndex(0); // Protected tag dropdown this.createItemDropdown = new CreateItemDropdown({ $dropdown: this.$form.find('.js-protected-tag-select'), defaultToggleLabel: __('Protected Tag'), fieldName: 'protec...
JS
```cpp // // Copyright (c) 2013-2021 The SRS Authors // // SPDX-License-Identifier: MIT or MulanPSL-2.0 // #include <srs_kernel_log.hpp> ISrsLog::ISrsLog() { } ISrsLog::~ISrsLog() { } ISrsContext::ISrsContext() { } ISrsContext::~ISrsContext() { } ```
C++
```php // or we can do like this also $tag->update([ 'name' => $request->name ]); session()->flash('success', 'Tag updated successfully'); return redirect(route('tags.index')); } /** * Remove the specified resource from storage. * * @param in...
PHP
```go return models.JSON{}, err } dataLength := whisperv6.BytesToUintBigEndian(dataLengthBytes) if len(log.Data) < cborStart+int(dataLength) { return models.JSON{}, errors.New("cbor too short") } cborData, err := data.SafeByteSlice(cborStart, cborStart+int(dataLength)) if err != nil { return models.JSON{}, ...
Go
```scala import sbt._ import Keys._ import scala.util.Properties._ object ApplicationBuild extends Build { val appName = "surfersTV" val appVersion = envOrElse("TV_API_VIEW_VERSION", "999-SNAPSHOT") def unitFilter(name: String): Boolean = !integrationFilter(name) && !acceptanceFilter(name) def acceptanceFilt...
Scala
```python from peewee import * from .event import * from .key import * from database import db class KeyValuePair(Model): __tablename__ = 'keyvaluepair' event = ForeignKeyField(Event, backref='key_value_pairs', on_delete = 'cascade') key = ForeignKeyField(Key) value = CharField() class Meta: primary_key = ...
Python
```c } [[nodiscard]] type try_get(index_vec_t pos) const { return const_cast<MultiArray *>(this)->try_get(pos); } void try_set(index_vec_t pos, const type &obj) const { return const_cast<MultiArray *>(this)->try_set(pos, obj); } void try_set(index_vec_t pos, type &&obj) const...
C
```c // (whether express, implied or statutory) including, without limitation, // warranties of merchantability, non-infringement, or fitness for a particular // purpose, are specifically disclaimed. // // Copyright 2021 Garmin International, Inc. ///////////////////////////////////////////////////////////////////...
C
```csharp using System; public class Hello { public static void Main() { string[] line = Console.ReadLine().Trim().Split(' '); var r = int.Parse(line[0]); var d = int.Parse(line[1]); var x = int.Parse(line[2]); for (int i = 0; i < 10; i++) { var nx = r * x - d; Console.WriteLine(nx); x = nx; }...
C#
```python print("no") break else: print("yes") ```
Python
```kotlin package com.machiav3lli.derdiedas.ui import android.content.Intent import android.os.Bundle import androidx.appcompat.app.AppCompatActivity import androidx.appcompat.app.AppCompatDelegate import androidx.preference.PreferenceManager import com.machiav3lli.derdiedas.PREFS_THEME import com.machiav3lli.derdieda...
Kotlin
```clojure (defn incFirstP [p a b] (if (p b) (inc a) a)) (defn eqW [x] (= \W x)) (defn eqE [x] (= \E x)) (defn incW [a b] ((partial incFirstP eqW) a b)) (defn incE [a b] ((partial incFirstP eqE) a b)) (defn sumE [xs] (reduce incE 0 xs)) (defn decE [a b] (if (eqE b) (dec a) a)) (defn...
clojure
```python # -*- coding: utf-8 -*- from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('authentication', '0011_merge'), ] operations = [ migrations.AddField( model_name='onlineuser', name='github', field=m...
Python
```cpp // Copyright 2016 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. #include "components/arc/video_accelerator/video_accelerator_struct_traits.h" namespace mojo { // static bool StructTraits<arc::mojom::VideoFrame...
C++
```python ABC = input().split() A, B, C = int(ABC[0]), str(ABC[1]), int(ABC[2]) if ABC[1] == "+": print("{}".format(A+C)) elif ABC[1] == "-": print("{}".format(A-C)) ```
Python
```cpp #include<bits/stdc++.h> #include<ext/pb_ds/assoc_container.hpp> #include<ext/pb_ds/tree_policy.hpp> #define int long long #define mkp make_pair #define pb push_back #define ff first #define ss second #define debug1(a) cout<<a<<endl; #define debug2(a,b) cout<<a<<' '<<b<<endl; #define debug3(a,b,c) cout<<a<' '<<b<...
C++
```c #include <stdio.h> int main(void){ char str[101]; char dir[20]; while(scanf("%s",str),str[0]!='#'){ int i=0,j=0; while(str[i]){ if(str[i]=='n'){ dir[j]='n'; j++; i+=5; }else if(str[i]=='w'){ dir[j]='w'; j++; i+=4; } } int numerator=0; int denominator=1<<(j-1); for(...
C
```python import sys inint = lambda: int(sys.stdin.readline()) inintm = lambda: map(int, sys.stdin.readline().split()) inintl = lambda: list(inintm()) instrm = lambda: map(str, sys.stdin.readline().split()) instrl = lambda: list(instrm()) n, m = inintm() t = [] for _ in range(m): a, b = inintm() if a == 1:...
Python
```javascript const express = require("express"); const router = express.Router(); const auth = require("../middleware/auth"); const User = require("../models/User"); const bcrypt = require("bcryptjs"); const jwt = require("jsonwebtoken"); require("dotenv").config(); const { check, validationResult } = require("expres...
JS
```typescript import React from 'react'; import { makeHeading } from './makeHeading'; export const H1 = makeHeading(1); export const H2 = makeHeading(2); export const H3 = makeHeading(3); export const H4 = makeHeading(4); export const H5 = makeHeading(5); export const H6 = makeHeading(6); export const H = ({ type = 1...
TS
```python H, N = [int(s) for s in input().split()] dec = [] cost = [] for i in range(N): a, b = [int(s) for s in input().split()] dec.append(a) cost.append(b) bar = ((H-1)//dec[0]+1)*cost[0] memo = [bar]*(H+1) memo[0] = 0 for h in range(1,H+1): for i in range(N): memo[h] = min(memo[h], memo[max(...
Python
```csharp using System; namespace ABC048B { static class Program { static void Main() { long[] nbrs = Array.ConvertAll(Console.ReadLine().Split(), long.Parse); int count = 0; nbrs[0] += nbrs[0] % nbrs[2]; for (var i = nbrs[0]; i <= nbrs[1]; i +=...
C#
```java import java.util.Scanner; public class Main{ public static void main(String[]args){ Scanner sc=new Scanner(System.in); double n=sc.nextInt(); double ans; double count=0; for(int i=1; i<=n; i++){ if(i%2.0==1){ count++; } } ans=count/n; System.out.println("ans...
Java
``` // Copiar datos desde el host en el device cudaMemcpy(d_A, h_A, numBytes, cudaMemcpyHostToDevice); cudaMemcpy(d_B, h_B, numBytes, cudaMemcpyHostToDevice); cudaEventRecord(E1, 0); cudaEventSynchronize(E1); // Ejecutar el kernel Kernel10<<<dimGrid, dimBlock>>>(N, N, N, d_A, d_B, d_C); cudaEventRe...
PlainText
```rust // Copyright © 2019 Intel Corporation // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law ...
Rust
```cpp //===-- IPA.cpp -----------------------------------------------------------===// // // The LLVM Compiler Infrastructure // // This file is distributed under the University of Illinois Open Source // License. See LICENSE.TXT for details. // //===------------------------------------------------...
C++
```csharp using System; class Program { static void Main(string[] args) { string s = Console.ReadLine(); int N = int.Parse(s); int p = 0; int q = 0; int p2 = 0; int q2 = 0; int a = 0; int pa = 0; for(var i=0;i<N;i++){ string t = Console.ReadLine(); a = int.Parse(t); pa = p; if(a-p == 1){...
C#
```c // Copyright 2016 The Crashpad Authors. All rights reserved. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless require...
C
```csharp /* * Copyright 2011 Google Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or a...
C#
```sql -- -- UPDATE syntax tests -- CREATE TABLE update_test ( a INT DEFAULT 10, b INT, c TEXT ); CREATE TABLE upsert_test ( a INT PRIMARY KEY, b TEXT ); INSERT INTO update_test VALUES (5, 10, 'foo'); INSERT INTO update_test(b, a) VALUES (15, 10); SELECT * FROM update_test; UPDATE upd...
SQL
```javascript var searchData= [ ['climb',['climb',['../classorg_1_1usfirst_1_1frc3707_1_1_creedence_1_1commands_1_1climb.html',1,'org::usfirst::frc3707::Creedence::commands']]], ['climbgrabin',['climbGrabIn',['../classorg_1_1usfirst_1_1frc3707_1_1_creedence_1_1commands_1_1climb_grab_in.html',1,'org::usfirst::frc370...
JS
```c pWsxContext->hIca = hIca; pWsxContext->hStack = hStack; pWsxContext->pTSrvInfo = pTSrvInfo; // // @@@ Should we? // Tell VC Addins // // TRACE((DEBUG_TSHRSRV_NORMAL, "TShrSRV: Connect new sessio...
C
```sql CREATE TABLE pageviewed ( id CHAVE NOT NULL, id_page CHAVE NOT NULL, id_shop_group CHAVE NOT NULL, id_shop CHAVE NOT NULL, id_date_range CHAVE NOT NULL, counter INTEGER NOT NULL, CONSTRAINT pk_pageviewed PRIMARY KEY (id) ); ```
SQL
```csharp using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace Flipping_SIgns { class Program { static void Main(string[] args) { int N = Convert.ToInt32(Console.ReadLine()); int[] A = Console.ReadL...
C#
```cpp { if (!parametersSet()) { return 0; } int a = x1 * m2; int b = x2 * m1; int256_t x, s; Euclidean::extendedEuclidean(a, m2, &x, &s); } ```
C++
```c #include<stdio.h> int hLIS(void); int rLIS(void); int h[201],r[201],m,n; int main(void) { int i,j,t,x,y; while(1) { scanf("%d",&n); if(n==0)break; for(i=0;i<n;i++) scanf("%d%d",&h[i],&r[i]); scanf("%d",&m); for(i=n;i<n+m;i++) scanf("%d%d",&h[i],&r[i]); for(i=0;i<n+m;...
C