blob_id stringlengths 40 40 | language stringclasses 1
value | repo_name stringlengths 5 117 | path stringlengths 3 268 | src_encoding stringclasses 34
values | length_bytes int64 6 4.23M | score float64 2.52 5.19 | int_score int64 3 5 | detected_licenses listlengths 0 85 | license_type stringclasses 2
values | text stringlengths 13 4.23M | download_success bool 1
class |
|---|---|---|---|---|---|---|---|---|---|---|---|
1ed00899d611a13c518faaeb046704c623debb2e | C++ | ABGEO/ABGEOs_CodeForces_Projects | /A/22/main.cpp | UTF-8 | 520 | 3.0625 | 3 | [
"MIT"
] | permissive | #include <cstdio>
#include <algorithm>
#include <iostream>
using namespace std;
int main()
{
int n = 0;
cin >> n;
int item[n];
for (int i = 0; i < n; i++)
cin >> item[i];
int x = *min_element(item, item + n);
int result(x);
for (int i = 0; i < n; i++)
if (item[i... | true |
1b5cd1d5fcfe8ab057d04c8e5d3395a4c280938b | C++ | anuwu/Competitive-Programming | /Leetcode/critical_connection.cpp | UTF-8 | 2,393 | 2.84375 | 3 | [] | no_license | class Solution {
public:
unordered_set<int> dfs (int u, int pi, unordered_set<int> &ancestors, vector<bool> &vis, vector<vector<int>> &adj, vector<vector<int>> &crit)
{
int v ;
vis[u] = true ;
ancestors.insert(u) ;
unordered_set<int> my_back, neigh_back ;
... | true |
88915d479b5555e13d253820b1de6e5350ed24bd | C++ | theJ8910/Brimstone | /include/brimstone/factory/BasicFactory.hpp | UTF-8 | 1,775 | 2.9375 | 3 | [
"MIT"
] | permissive | /*
factory/BasicFactory.hpp
-----------------------
Copyright (c) 2014, theJ89
Description:
Defines a basic concrete factory class, whose .create() method will instantiate
a concrete class with its default constructor.
Part of the engine's implementation of the Abstract Factory pattern.
Provides a ma... | true |
a43d244f460a2d6682ed8f2e82ed28ac9241ada2 | C++ | PraveenDubey01/Apna_College_Programs | /Bubble_SORT.cpp | UTF-8 | 637 | 3.78125 | 4 | [] | no_license | #include<iostream>
using namespace std;
void BubbleSort( int arr[], int size)
{
int temp;
for( int i=0;i<size-1;i++)
{
for(int j=0;j<size-i-1;j++)
{
if(arr[j]>arr[j+1])
{
temp=arr[j];
arr[j]=arr[j+1];
arr[j+1]=temp;
}
}
}
}
void PrintArray(int arr[], int siz... | true |
47e303f415031de0dff8ccef4cadf8f4b3e222be | C++ | fritzethegreat/Arduino | /Blink/blink.cpp | UTF-8 | 738 | 3.515625 | 4 | [] | no_license | /*
Blink
Turns on an LED on for one second, then off for one second, repeatedly.
This example code is in the public domain, as far as I know.
*/
#include <avr/Arduino.h>
int main() {
// run Arduino initialization script for setting delay vectors and timing
// variables
init();
// initialize the dig... | true |
dbf6e57330ded45f37e74361ac09c8fef177dde5 | C++ | laniakea1990/VS_Essential_Cplusplus | /Exercise_Chapter1/1_5_b.cpp | UTF-8 | 742 | 3.53125 | 4 | [] | no_license | /*
#include<iostream>
#include<iomanip>
#include<cstring>
using namespace std;
int main()
{
const int nm_size = 128;
char user_name[nm_size];
cout << "Please enter your name: ";
cin >> setw(nm_size) >> user_name;
switch (strlen(user_name))
{
case 0:
cout << "Ah, the user with no name."
<< "Well, ok, hi, u... | true |
13e94aa68ea3c4f8aa3eca3096ea75c0c993f182 | C++ | briancpark/deitel-cpp | /VCB600ENU1/MSDN_VCB/SAMPLES/VC98/SDK/COM/INOLE2/INTERFAC/IENUMCON.CPP | UTF-8 | 4,899 | 2.578125 | 3 | [] | no_license | /*
* IENUMCON.CPP
*
* Standard implementation of an enumerator with the
* IEnumConnections interface that will generally not need
* modification.
*
* Copyright (c)1993-1995 Microsoft Corporation, All Rights Reserved
*
* Kraig Brockschmidt, Microsoft
* Internet : kraigb@microsoft.com
* Compuserve... | true |
efeedd7a4bc82a0823c4ce8cd273a49346fd9a34 | C++ | jtesquibel/Professional-C-Projects | /pa2/PasswordCrack.cpp | UTF-8 | 6,228 | 2.90625 | 3 | [] | no_license | //
// PasswordCrack.cpp
// password-mac
//
// Created by Jonathan Esquibel on 2/8/17.
// Copyright © 2017 Sanjay Madhav. All rights reserved.
//
#include "PasswordCrack.hpp"
PasswordCrack::PasswordCrack(std::string fileName1, std::string fileName2)
{
this->file1 = fileName1;
this->file2 = fileName2;
m... | true |
15a9d6d50d33bcb90bf80007d753df0a6e5b546c | C++ | yoshipaulbrophy/xrtl | /xrtl/base/threading/event_test.cc | UTF-8 | 13,134 | 2.828125 | 3 | [
"Apache-2.0"
] | permissive | // Copyright 2017 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 agreed to in... | true |
c803cae0b7a74fcfc711856a3e2fbd40adb020c9 | C++ | antsoh161/Graphics | /lab1/lab1-4.cpp | UTF-8 | 6,535 | 2.53125 | 3 | [] | no_license | #include <GL/glew.h>
#include <GLFW/glfw3.h>
#include <cstdlib>
#include <iostream>
#include "readfile.hpp"
#include "my_shader.hpp"
my_shader shader0;
static void error_callback(int error, const char* description)
{
std::cerr << description;
}
static void key_callback(GLFWwindow* window, int key, int scanco... | true |
365c9e7cb685f42f23eddbf25615a38193b90abf | C++ | xmyqsh/leetcode2016 | /084_largest-rectangle-in-histogram.cpp | UTF-8 | 563 | 2.96875 | 3 | [] | no_license | class Solution {
public:
int largestRectangleArea(vector<int>& height) {
if (height.empty()) return 0;
height.push_back(-1);
stack<int> sk;
int maxArea = 0;
for (int i = 0; i < height.size();) {
if (sk.empty() || height[i] >= height[sk.top()]) {
sk... | true |
89d1cd9e170ec9785209dcffac0239c6a2b32182 | C++ | mpindaro/garbage-collector | /motoresemplice/motoresemplice.ino | UTF-8 | 623 | 2.609375 | 3 | [] | no_license | //Testing the DC Motors
//Define Pins
//Motor A
int enableA = 10;
int pinA1 = 2;
int pinA2 = 3;
//Motor B
int enableB = 9;
int pinB1 = 4;
int pinB2 = 5;
//define time for run
// in milliseconds
int running = 10000; //10 secons
boolean play;
void setup() {
Serial.begin (9600);
//configure pin modes
pinMode (enableA... | true |
7a9a962fd8b573e5af6d132529909b72dc76def7 | C++ | BackupTheBerlios/useoa-rose-svn | /trunk/OAWraps/LoopIRInterface.h | UTF-8 | 7,845 | 2.546875 | 3 | [] | no_license | /*
* LoopIRInterface.h
*
* Created on: May 3, 2011
* Author: snarayan
*/
#ifndef _LOOPINTERFACE_H
#define _LOOPINTERFACE_H
#include "Sage2OA.h"
#include <rose.h>
using namespace std;
using namespace OA;
using namespace Loop;
class LoopAnalStatistics {
public:
enum Rejection {
BAD_INIT = 0,
... | true |
172582d9266d3ff3a92566c5b81df37e686052f7 | C++ | moble/PostNewtonian | /C++/PNEvolution.hpp | UTF-8 | 3,363 | 2.546875 | 3 | [
"MIT"
] | permissive | #ifndef PNEVOLUTION_HPP
#define PNEVOLUTION_HPP
#include <vector>
#include "Quaternions.hpp"
namespace PostNewtonian {
/// These functions evolve the PN orbital system, returning (by
/// reference) the orbital speed, spin vectors, and frame
/// information, as well as the completely redundant but
/// occassi... | true |
3190d19b3e5a268d75bbed5660e8b378f119dae2 | C++ | urykhy/stuff | /networking/CoreSocket.hpp | UTF-8 | 4,648 | 2.59375 | 3 | [] | no_license | #pragma once
#include <errno.h>
#include <fcntl.h>
#include <netinet/in.h>
#include <stdio.h>
#include <string.h>
#include <sys/ioctl.h>
#include <sys/socket.h>
#include <sys/types.h>
#include <exception/Error.hpp>
namespace Util {
struct CoreSocket
{
using Error = Exception::ErrnoError;
private... | true |
277c825205033d43a24a56c4915fe3d31995fb0b | C++ | kdw9502/algoHW | /HW3_S20141494/MAIN_SAMPLE_OPEN/MAIN_SAMPLE/heap_sort.cpp | UTF-8 | 940 | 3.265625 | 3 | [] | no_license | #include <stdio.h>
#include "my_types.h"
#define ELEMENT_SWAP(a,b) {ELEMENT temp;temp=a;a=b;b=temp;}
void heapify(ELEMENT data[], int left,int right, int i)
{
int size = right - left + 1;
int left_child = left+ 2 * i + 1;
int right_child =left+ 2 * i + 2;
int max =left+ i;
if (left_child <=right && data[left_... | true |
d3cde23e99f3a2573b1eba0332ee8e0429ed7d73 | C++ | Ryuk07/CodingSolutions | /Motivation Lunchtime March21.cpp | UTF-8 | 2,029 | 3.390625 | 3 | [] | no_license | Task: Chef has been searching for a good motivational movie that he can watch during his exam time. His hard disk has X GB of space remaining. His friend has N movies represented with (Si,Ri)
representing (space required, IMDB rating). Help Chef choose the single best movie (highest IMDB rating) that can fit in his ha... | true |
60ba31b4f2b2891afcd52cea98313e0d932ae730 | C++ | suraj98/Data-Structures-And-Algoritms | /Recursion - Dynamic Programing/recur_minsum_path.cpp | UTF-8 | 457 | 2.984375 | 3 | [] | no_license | int min(int a , int b)
{
return (a<b)?a:b;
}
int minsum(vector<vector<int> >&A,int m , int n)
{
if ( (m<0) || (n<0) )
{
return INT_MAX ;
}
else if( (m==0) && (n==0) )
{
return A[0][0];
}
else
{
return A[m][n]+min(minsum(A,m-1,n),minsum(A,m,n-1) ) ;
}
}
i... | true |
0842a7c9469f3452c07883a726e008c3f520f574 | C++ | gouarin/JMM_CPPLibs | /JMM_CPPLibs/DataStructures/RangeAccessor.h | UTF-8 | 1,139 | 2.734375 | 3 | [
"Apache-2.0"
] | permissive | // Copyright 2017 Jean-Marie Mirebeau, University Paris-Sud, CNRS, University Paris-Saclay
// Distributed WITHOUT ANY WARRANTY. Licensed under the Apache License, Version 2.0, see http://www.apache.org/licenses/LICENSE-2.0
#ifndef RangeAccessor_h
#define RangeAccessor_h
template<typename Pointer> class RangeAccessor ... | true |
37e6e59951f2fa4f43e6f2f7fc283156935f834d | C++ | TurkeyScratch/c2001-work | /FIT1048/SimonSays/Dialogue.h | UTF-8 | 1,363 | 3.0625 | 3 | [
"MIT"
] | permissive | /*
* author : James Jefferson Luu
* project : Simon Says
* purpose : Dialogue Class Header file
* created : 2019-11-05
* updated : 2019-11-10
*
* This file contains the Dialogue class structure with its member variables
* and function prototypes. It is responsible for the obtaining and returning
* of dial... | true |
b90d6bb70c4f98ce74a20c56a6f4f267573bf0ed | C++ | NandaPL/knuth-morris-pratt | /exemplos reais/stringMatching.cpp | UTF-8 | 769 | 2.625 | 3 | [] | no_license | // questão https://cses.fi/problemset/task/1753
#include <bits/stdc++.h>
using namespace std;
string s, t;
vector<int> p(1001233), match;
vector<int> matching(string t, string s)
{
int n = t.size(), m = s.size();
p[0] = 0;
for (int i = 1, j = 0; i < m; i++)
{
while (j > 0 && s[j] != s[i])
... | true |
290a2acc724f0ab38d768d4223aacbc4a56574c0 | C++ | dvarasm/Laboratorios-Estructuras-de-datos | /Labs Estructuras/Lab10/p3.cpp | UTF-8 | 709 | 2.859375 | 3 | [] | no_license | #include <unordered_map>
#include <cstdio>
#include <iomanip>
#include <ctime>
#include <cstdlib>
#include <map>
using namespace std;
int main(){
srand(time(NULL));
map<int,int> ma;
unordered_map<int,int> uno_ma;
clock_t start = clock();
for(int i= 0; i<10000;i++){
ma.insert(pair<int,int>(rand()%10000,i));
... | true |
76c2e7a73212dd1dfcc173f943f7d7a904a9c599 | C++ | ProjetosLucas/AutomaTIK | /RFID/RFID.ino | UTF-8 | 1,019 | 2.765625 | 3 | [] | no_license | //Programa: Leitor RFID RDM6300
//Alteracoes e adaptacoes: Arduino e Cia
//Baseado no programa original de Stephane Driussi
#include <SoftwareSerial.h>
#include <RDM6300.h>
//Inicializa a serial nos pinos 2 (RX) e 3 (TX)
SoftwareSerial RFID(2, 3);
int Led = 13;
uint8_t Payload[6]; // used for read comparisons
RDM6... | true |
704e7c0286f50fcc433af461a5c90b225b8c41da | C++ | WeiX728/Performance-System | /ManagementSystem/System.cpp | GB18030 | 6,668 | 3.265625 | 3 | [] | no_license | #include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <conio.h>
/*ѧϢṹ*/
typedef struct Node
{
char Name[10]; //ѧ
char ID[15]; //ѧѧ
int Score[3]; //ƳɼѧӢݽṹ
float Ave_Sco;
struct Node *next;
}Lnode;
void Display(); /*ʾ*/
void GetScore(Lnode *&h); /*ɼ¼뺯*/
void PrintScore(Lnode *h... | true |
6808b5cf7e7f9308c63b8fb9b1cfaafe5d0dc1f6 | C++ | conwnet/way-of-algorithm | /poj-cpp/2260/14827283_PE.cc | UTF-8 | 945 | 2.578125 | 3 | [] | no_license | #include <stdio.h>
#include <string.h>
int mat[128][128], N, row[128], col[128];
int main()
{
while(scanf("%d", &N) && N) {
memset(row, 0, sizeof(row));
memset(col, 0, sizeof(col));
for(int i=0; i<N; i++) {
for(int j=0; j<N; j++) {
... | true |
bcf10808d96b6f90725b19a017d8186a3f3c5442 | C++ | Kapatsa/optim_gui | /RectArea.hpp | UTF-8 | 1,112 | 3 | 3 | [] | no_license | //
// RectArea.hpp
// optimization_console
//
// Created by David Kapatsa on 06.10.2019.
// Copyright © 2019 David Kapatsa. All rights reserved.
//
#ifndef RectArea_hpp
#define RectArea_hpp
#include <stdio.h>
#include <iostream>
#include "Area.hpp"
/**
* Rectangle Area Class
*
* This class is an instance of Ar... | true |
bd1cc58a923c1049aeb1d6acaea581e534f365f5 | C++ | MinGleP/Data_structure_Lecture_MP3_Player | /PlayListInfo.h | UTF-8 | 442 | 2.546875 | 3 | [] | no_license | #ifndef _PLAYLISTINFO_H
#define _PLAYLISTINFO_H
#include<string>
#include<iostream>
using namespace std;
class PlayListInfo {
public:
PlayListInfo();
PlayListInfo(string, string);
string getName() const;
string getTitle() const;
string getPlaylistName() const;
void setName(string);
void setTitle(string);
... | true |
282f5f8050725b7d95cdaae92a2750a21fc4f9fc | C++ | agreene22/OfficeSimulation | /Student.cpp | UTF-8 | 1,340 | 3.4375 | 3 | [] | no_license | /* Anna Greene - 2314663
Brandon Kleinman - 2291703
Assignment 4 - Registrar Office Simulation
*/
#include "Student.h"
Student::Student(){//default constructor
m_timeNeeded = 0;
m_arrivalTime = 0;
m_timeIdle = 0;
m_windowStartTime = 0;
}
Student::Student(int windowTime, int arrival){//overloaded constru... | true |
bf4c1bcbff11bfb0a014d50cb3dda2475449c454 | C++ | leandro1623/Todos-los-proyectos-que-hice-mientras-aprendia-cpp | /Nomina_de_pago.cpp | UTF-8 | 1,494 | 2.96875 | 3 | [] | no_license | #include<iostream>
#include<conio.h>
using namespace std;
int main(){
cout<<"\n\n\t**NOMINA DE PAGO**\n\n";
//variables necesrias
char nombre_empleado[30];
char cedula[30],departamento[30];
double sueldo_bruto,afp,ars,cooperativa,club,prestamos,total_descuento,sueldo_neto;
//solicitando datos
cout<<"Nom... | true |
edb9127da7ab236367a8377988d50aad2f6771bb | C++ | arangodb/arangodb | /3rdParty/boost/1.78.0/libs/compute/example/time_copy.cpp | UTF-8 | 1,878 | 2.734375 | 3 | [
"BSL-1.0",
"Apache-2.0",
"BSD-3-Clause",
"ICU",
"Zlib",
"GPL-1.0-or-later",
"OpenSSL",
"ISC",
"LicenseRef-scancode-gutenberg-2020",
"MIT",
"GPL-2.0-only",
"CC0-1.0",
"LicenseRef-scancode-autoconf-simple-exception",
"LicenseRef-scancode-pcre",
"Bison-exception-2.2",
"LicenseRef-scancode... | permissive | //---------------------------------------------------------------------------//
// Copyright (c) 2013 Kyle Lutz <kyle.r.lutz@gmail.com>
//
// Distributed under the Boost Software License, Version 1.0
// See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt
//
// See http://boostorg.gi... | true |
f27a943b1be45bf4b30934d1c5535a646d4ca591 | C++ | jovechiang/LGraphlib | /traversal.h | UTF-8 | 1,198 | 3.203125 | 3 | [] | no_license | #ifndef TRAVERSAL_H
#define TRAVERSAL_H
#include "graph_adj.h"
#include <set>
#include <queue>
//Graph Traversal
//DFS
//BFS
class traversal{
public:
traversal(graph_adj & g){G=&g;}
void DFS(int start);
void BFS(int start);
void clearVisited(){visited.clear();}
private:
graph_adj* G;
//Auxilary Datas... | true |
0f9f3b43db9a3e151fa327105a307531e953b5fc | C++ | maherabdoualy/CarDealership | /main.cpp | UTF-8 | 8,624 | 3.28125 | 3 | [] | no_license | #include <iostream>
#include <string>
#include "NewCar.h"
#include "OldCar.h"
#include <vector>
#include "Car.h"
#include <typeinfo>
using namespace std;
//old
OldCar oldcar1("101010","Toyota","Camry",2014,14000,"Old",5000);
OldCar oldcar2("202020","Nissan","Rogue",2017,20000,"Old",2000);
... | true |
c40ecb66eaaa413a1d9a3b5d894a6874deac20c5 | C++ | narrth/Intro-to-C- | /Assignment 5/a51.cpp | UTF-8 | 11,205 | 3.734375 | 4 | [] | no_license | /* Author: Narrthanan Seevananthan
Subject: ECOR 1606
Assignment#5, Question #1
Purpose: You are given a certain amount of money, and you are tasked with
buying the meal wigh most Vitamin C with that amount.
USING SAMPLE CODE FROM... | true |
abe251ac47ae9833d0ef5f91b261ae96938feb38 | C++ | shooshx/libDRD | /drd_arraymap.h | UTF-8 | 1,380 | 3.578125 | 4 | [] | no_license | #pragma once
// implementation of a simple mapping using a static array and O(n) search
// TKey and TKey should be some integral value (int, unsinged int, pointer etc')
template<typename TKey, typename TVal, int MaxSize>
class ArrayMap
{
public:
ArrayMap() : m_count(0)
{}
bool add(TKey k, TVal v) {
... | true |
4ed13bd22a09afea3fc0c1d61206ea13106bb2d2 | C++ | ousttrue/refrange | /tests/json_test.cpp | UTF-8 | 1,046 | 2.765625 | 3 | [] | no_license | #include <sstream>
#include <refrange/text/json.h>
#include <gtest/gtest.h>
TEST(JsonTest, parse)
{
// json to msgpack
const char *json_object="{\"key\":1}";
std::istringstream ss(json_object);
std::vector<unsigned char> buffer;
auto p = ::refrange::msgpack::create_external_vector_packer(buffer);
r... | true |
525540facbd77bdf306a0faf2365b546b8499444 | C++ | qq911712051/Hrpc | /src/util/src/hrpc_lock.cpp | UTF-8 | 4,034 | 2.71875 | 3 | [] | no_license | #include <hrpc_lock.h>
namespace Hrpc
{
Hrpc_MutexLock::Hrpc_MutexLock()
{
// 初始化为error check类型的锁
_mutex = PTHREAD_ERRORCHECK_MUTEX_INITIALIZER_NP;
_count = 0;
}
Hrpc_RecMutexLock::Hrpc_RecMutexLock()
{
// 初始化为error check类型的锁
_mutex = PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP;
_count = 0;
}
Hrp... | true |
58207a2d712b9c1190d8358a106bad70641c3aa4 | C++ | aecolumna/Spartan-Space-Invaders | /Project1/Bunker.h | UTF-8 | 1,569 | 3.03125 | 3 | [] | no_license | /**
* \file Bunker.h
*
* \author Andres Columna
*
* Bunker Base Class
*/
#pragma once
#include <string>
#include <memory>
#include "Game.h"
/// Forward declaration of CGame to avoid Circular includes
class CGame;
/**
* Class denotes a Bunker in Space Invaders game
*/
class CBunker : publ... | true |
82375401d8311daab28242aea001a1327c545dbb | C++ | rubenglezortiz/Proyectos2-2020-21 | /PaintlLess/Assets/game/network_types.h | UTF-8 | 6,328 | 3.25 | 3 | [
"CC0-1.0"
] | permissive | // This file is part of the course TPV2@UCM - Samir Genaim
#pragma once
#include <SDL_net.h>
#include <iostream>
#pragma pack(push,1)
// print an IPv4
inline void print_ip(Uint32 ip, bool newline = false) {
std::cout << (ip & 0xFF) << "." //
<< ((ip >> 8) & 0xFF) << "." //
<< ((ip >> 16) & 0xFF) << "." //
<<... | true |
30136354c4d53a0e57733de908b4cde3a392628c | C++ | Xeelot/BinaryTreeFun | /TreeFun/TreeFun.cpp | UTF-8 | 2,188 | 3.578125 | 4 | [
"MIT"
] | permissive | // TreeFun.cpp : Defines the entry point for the console application.
//
#include "stdafx.h"
#include <cstdlib>
#include <iostream>
#include <string>
class Leaf
{
public:
Leaf(int value) { left = NULL; right = NULL; depth = value; }
~Leaf() {}
Leaf* left;
Leaf* right;
int depth;
};
c... | true |
1ed2bba2c8523a8354229bc41c95e2d97d1690d7 | C++ | lscholte/SnowSimulation | /lib/atlas/include/atlas/utils/BVNode.hpp | UTF-8 | 846 | 2.515625 | 3 | [
"MIT"
] | permissive | #ifndef ATLAS_INCLUDE_ATLAS_UTILS_BV_NODE_HPP
#define ATLAS_INCLUDE_ATLAS_UTILS_BV_NODE_HPP
#pragma once
#include "Utils.hpp"
#include "atlas/math/Math.hpp"
#include <vector>
namespace atlas
{
namespace utils
{
enum class NodeType : int
{
Node = 0,
Leaf
};
... | true |
56486e4cf530565745448011d48d3e842da6f44c | C++ | tristanschneider/syx | /syx/Engine.Shared/DebugDrawer.cpp | UTF-8 | 4,064 | 2.53125 | 3 | [] | no_license | #include "Precompile.h"
#include "DebugDrawer.h"
#include "asset/Shader.h"
#include <gl/glew.h>
namespace {
const int sStartingSize = 1000;
}
const AssetInfo DebugDrawer::SHADER_ASSET("shaders/debug.vs");
DebugDrawer::DebugDrawer(std::shared_ptr<Asset> shader) {
mShader = std::move(shader);
//Generate a vert... | true |
56dc7c6cf8326befc591388192d38656cfe0dc3d | C++ | shubhpy/Cpp-Programs | /Longest_single_letter_string.cpp | UTF-8 | 1,558 | 2.9375 | 3 | [] | no_license | #include <cmath>
#include <cstdio>
#include <vector>
#include <iostream>
#include <algorithm>
using namespace std;
int solve(int l,int e,string s,vector<int> &v,int count,int &ans,vector<vector<int> > &dp){
if (count==0){
ans = max(ans,e-l+1);
dp[l][e] = 1;
return dp[l][e];
}
else{... | true |
1b37be688c81030d2037996a0c1ad4f50dd491ae | C++ | Marchello00/Heaps | /BinomialHeap/BinomialHeap.cpp | UTF-8 | 5,465 | 2.8125 | 3 | [] | no_license | #ifndef BINHEAP_DONE
#define BINHEAP_DONE
#ifndef INCLUDE_BINHEAP
#include "BinomialHeap.h"
#endif
template<typename Type>
BinomialTree<Type> *BinomialTree<Type>::connect(BinomialTree *nchild) {
nchild->father = this;
childrens.push(nchild);
return this;
}
template<typename Type>
BinomialTree<Type>::Bi... | true |
d056e8f759371855cc967edd87d372308be0397c | C++ | xucaimao/netlesson | /pa1-c/test10-4.cpp | UTF-8 | 1,887 | 3.40625 | 3 | [] | no_license | /*
程序设计实习MOOC / 程序设计与算法(一)第十周测验(2017冬季)
4:mysort
write by xucaimao,2018-01-10 17:20,AC 2018-01-10 18:17:32
考察自己写排序函数,以及函数指针的运用
*/
#include <iostream>
using namespace std;
struct A {
int nouse1;
int nouse2;
int n;
};
// 在此处补充你的代码
void mycopy(char * dest,char * source,int size){
//拷贝size个字节
for(int i=0;i<size;i++... | true |
10d5760b1023bdd5e13443b161aca15e9c9cbbe6 | C++ | AzureCodeing/RubbishCode | /now_coder/数组中出现超过一半的数/main.cpp | UTF-8 | 1,990 | 3.828125 | 4 | [] | no_license | #include <iostream>
#include <vector>
#include <algorithm>
#include <map>
using namespace std;
class Solution {
public:
//1. 排序统计 时间复杂度 O(nlogn) 空间复杂度O(1)
int MoreThanHalfNum_Solution1(vector<int> numbers) {
sort(numbers.begin(), numbers.end()); //排序算法
int sum = 0;
for(auto num... | true |
4365148c0003eeeb2ee4ad838736457a235ae156 | C++ | Att4ck3rS3cur1ty/e12 | /e12.cpp | UTF-8 | 1,525 | 4 | 4 | [] | no_license | #include <iostream>
#include <cmath>
int fatorial(const int n) {
// Calcula recursivamente o fatorial de n
// Insira o código aqui
int x = 0;
while (n > 1) x += n * (x - 1);
return n;
}
int primalidade(const int n, int i) {
// Testa recursivamente os divisores ímpares de i até a raiz quadrada do N
// Insir... | true |
443499482deda8c739b8aeade4951a0c6d585bd7 | C++ | lasicuefs/augmented-tattoo | /augmented-tattoo-rt/contourextractor.h | UTF-8 | 1,620 | 3.015625 | 3 | [] | no_license | #ifndef CONTOUREXTRACTOR_H
#define CONTOUREXTRACTOR_H
class ContourExtractor {
public:
float minArea = 50.0f;
float maxArea = 2000.0f;
/// Returns true if passed the filter
typedef bool (*FilterContourCallback)(vector<Point> &contour, void* userdata);
/// Filter contours by size
... | true |
70219dd30cd99707eec8c69fb7d7a5c628427333 | C++ | gustavobiage/URI_Solutions | /DataStructures/2519.cpp | UTF-8 | 1,239 | 2.65625 | 3 | [] | no_license | #include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <math.h>
struct query {
int x1, y1;
int x2, y2;
};
int byte[1001][1001];
int arr[1001][1001];
int N, M, Q;
int v, a, b, x, y;
struct query q;
int get(int x, int y) {
int ans = 0;
for (; x; x-=x&-x) {
for (int b = y; b; b-=b&-b) {
ans += byt... | true |
a639feb462826bf56226707b2b159ccf7960bba9 | C++ | skapfer/sphmink | /Vector.h | UTF-8 | 2,824 | 3.234375 | 3 | [] | no_license | #ifndef VECTOR_H_INCLUDED
#define VECTOR_H_INCLUDED
#include "./common.h"
#include <assert.h>
#include <math.h>
#include <ostream>
class Vector {
public:
Vector () {
d_[0] = d_[1] = d_[2] = 0.;
}
Vector (double x_, double y_, double z_) {
d_[0] = x_;
d_[1] = y_;
d_[2] = ... | true |
4be30d4d80552892262731e8ab2118dea7689ccd | C++ | Kuutio/TAMK-Olio-ohjelmointi-C | /Viikko46/Teht3ja4/Opettaja.cpp | UTF-8 | 1,446 | 2.84375 | 3 | [] | no_license | #include "Opettaja.h"
#include <iostream>
using std::cout; using std::endl; using std::cin;
Opettaja::Opettaja()
:opetusala("Kalastus")
{
//cout << "Opettaja: Oletus rakentaja" << endl;
}
Opettaja::Opettaja(string etunimi_, string osoite_, string puhelinnumero_, string sukunimi_, string palkka_, string tu... | true |
f4fdc05f98a775e97b2d1a58921b3448e0702819 | C++ | seriouszyx/leetcode | /algorithms/cpp/122.买卖股票的最佳时机-ii.cpp | UTF-8 | 398 | 3 | 3 | [
"MIT"
] | permissive | /*
* @lc app=leetcode.cn id=122 lang=cpp
*
* [122] 买卖股票的最佳时机 II
*/
class Solution {
public:
int maxProfit(vector<int>& prices) {
int maxPro = 0, tmp = 0;
for (int i = 1; i < prices.size(); ++i) {
tmp = prices[i] - prices[i-1];
if (tmp > 0)
maxPro... | true |
e6a7bf50364374067bdd75f08eee79ae6ceca769 | C++ | sdwvskyo/C-Cplusplus | /Complex/Complex.cc | UTF-8 | 1,794 | 3.5 | 4 | [] | no_license | #include "Complex.h"
using namespace std;
Complex::Complex(double real, double img)
: real_(real), img_(img)
{
}
Complex::~Complex()
{
}
Complex::Complex(const Complex &c)
{
real_ = c.real_;
img_= c.img_;
}
Complex & Complex::operator= (const Complex &c)
{
real_ = c.real_;
img_ = c.img_;
return *this;
}
... | true |
659a67e0dcf9effa97e131db50cc2cd4e6563e96 | C++ | Fredoun21/ESP8266_Radiateur | /test/main.ino | UTF-8 | 8,306 | 2.546875 | 3 | [] | no_license | /*
Projet d'apprentissage d'un objet connecté (IoT) pour réaliser une sonde de température
ESP8266 + DS12B20 + LED + MQTT + Home-Assistant
Projets DIY (https://www.projetsdiy.fr) - Mai 2016
Licence : MIT
*/
// Include the libraries we need
#include <Arduino.h>
#include <stdfred.h>
#include <sensor.h... | true |
b8ae066886564d7c9e9b7224a4a502ce965af1b6 | C++ | botezatumihaicatalin/ChaoticImageCrypto | /src/ruleT_generator3.hpp | UTF-8 | 1,266 | 2.984375 | 3 | [
"MIT"
] | permissive | #pragma once
#include <cmath>
#include "generator3.hpp"
#include "skew_tent_generator1.hpp"
// Composed of three skew_tent maps.
class ruleT_generator3 : public generator3 {
protected:
skew_tent_generator1 skew_tent1_;
skew_tent_generator1 skew_tent2_;
skew_tent_generator1 skew_tent3_;
public:
ruleT_generat... | true |
91ea7223e916cef8033593fae7f37bf0d6b47706 | C++ | PW486/leetcode | /solutions/cpp/49-group-anagrams.cc | UTF-8 | 1,114 | 3.703125 | 4 | [
"Unlicense"
] | permissive | #include <iostream>
#include <map>
#include <vector>
using namespace std;
class Solution {
public:
vector<vector<string>> groupAnagrams(vector<string> &strs) {
map<vector<int>, vector<string>> store;
for (auto it = strs.begin(); it != strs.end(); it++) {
vector<int> alphabet(26);
for (char c : ... | true |
6288fe8c36b1a368ed3362387129457fa5352f2a | C++ | jptang2/huffman_compression | /source/FileTree/Tree.h | UTF-8 | 520 | 3.5 | 4 | [] | no_license | #pragma once
class Tree
{
public :
char ch;
int weight;
Tree* left;
Tree* right;
Tree(){left = right = NULL; weight=0;ch ='\0';}
Tree(Tree* l,Tree* r,int w,char c){left = l; right = r; weight=w; ch=c;}
~Tree(){delete left; delete right;}
bool Isleaf(){return !left && !right; }
}; ... | true |
e5886b9627d66e84399af380e802d28f1af1317f | C++ | Shmosh001/CSC3022H-Assignment-1 | /Driver.cpp | UTF-8 | 1,996 | 3.890625 | 4 | [] | no_license | #include <iostream>
#include "StudentDatabase.h"
int main()
{
using namespace SHMOSH001;
using namespace std;
//all possible variables that the user may enter about a student
string name;
string surname;
string StudentNumber;
string ClassRecord;
while (true)
{
//char used for user selection
char c;
... | true |
138c7d707d9108d1fecafc2e7dca37dd0da0d2cc | C++ | httt-dev/sale-management-system | /SMS Project/Invoice.h | UTF-8 | 643 | 2.984375 | 3 | [] | no_license | #pragma once
#include <iostream>
#include <string>
#include "GlobalFunction.h"
using namespace std;
class Invoice
{
private:
string id, date, customerID, type;
public:
Invoice(string s = "");
friend ostream &operator <<(ostream &os, Invoice &s);
void setID(string id) { this->id = id; }
void setDate(string date) {... | true |
941d9726494e16286c0458ffc24d7398980e6b42 | C++ | toniou/liam-esp | /src/mowing_schedule.cpp | UTF-8 | 4,590 | 2.84375 | 3 | [
"MIT"
] | permissive | #include "mowing_schedule.h"
#include "configuration.h"
#include <Preferences.h>
#include <ArduinoJson.h>
#include <ArduinoLog.h>
MowingSchedule::MowingSchedule() {}
/**
* Adds a new entry to the schedule list.
* @param activeWeekdays represent the seven days in a week (MUST always sized seven)
* @param time to s... | true |
39f6f827e421db4874a83970b59419d909a66b6d | C++ | mateoatr/Competitive-Programming | /UVa/507.cpp | UTF-8 | 722 | 2.78125 | 3 | [] | no_license | #include <iostream>
using namespace std;
int ruta[20002];
int main(){
int N, r; cin >> N;
for(int i = 1; i <= N; i++){
cin >> r;
int max = 0, current = 0, k = 0, pi, ui, cc = 0;
for(int j = 1; j < r; j++){
cin >> ruta[j];
current += ruta[j]; k++;
if(current < 0){ current = 0; k = 0;... | true |
c29a138aa2332634b421bc4064e373e01d93cea1 | C++ | GabrieleCosta00/Prova_per_Calendario | /main.cpp | UTF-8 | 9,942 | 2.9375 | 3 | [] | no_license | #include <iostream>
#define n_giorno 5
#define n_slot 6
//#define n_aula 4
#define n_esame 20
#define n_max_gruppo 5
using namespace std;
struct exam {
int id;
bool piazzato;
__attribute__((unused)) bool gruppo_piazzato; // WTF?!?!
int durata;
int prof;
int n_gruppo;
int id_gruppo[n_max_... | true |
faca26575db4d96d820c5e7cd77e95aef03a14ca | C++ | CGQZtoast/c_plus | /test/作业训练三/16成绩大排队.cpp | UTF-8 | 582 | 3.703125 | 4 | [] | no_license | #include <iostream>
#include <algorithm>
using namespace std;
struct student
{
string name;
string id;
int grade;
};
bool cmp(student a, student b)
{
return a.grade > b.grade;
}
int main()
{
int n;
cin >> n;
student students[n];
for (int i = 0; i < n; i++)
{
... | true |
d03e4ae55035b6d05f2a6d9d12e5f0c0dec6a5fc | C++ | mlavik1/HikariOnline | /Source/Core/Object/object.cpp | UTF-8 | 961 | 2.65625 | 3 | [
"MIT"
] | permissive | #include "object.h"
#include <sstream>
#include "function.h"
IMPLEMENT_CLASS(Hikari::Object)
#define ADD_OBJECT_FLAG(flag) mObjectFlags |= (ObjectFlagRegister)(flag)
#define REMOVE_OBJECT_FLAG(flag) mObjectFlags &= ~(ObjectFlagRegister)(flag)
namespace Hikari
{
Object::Object()
{
mObjectRefHandle = new ObjectRef... | true |
2bf7c6e213a666ae6447b2b5b93524ecc62a829c | C++ | fanzcsoft/windows_embedded_compact_2013_2015M09 | /windows_embedded_compact_2013_2015M09/WINCE800/private/test/BaseOS/Filesys/reg/PerfTests/perf_regEx/reghlpr.cpp | UTF-8 | 9,406 | 2.53125 | 3 | [] | no_license | //
// Copyright (c) Microsoft Corporation. All rights reserved.
//
//
// Use of this source code is subject to the terms of the Microsoft shared
// source or premium shared source license agreement under which you licensed
// this source code. If you did not accept the terms of the license agreement,
// you are... | true |
9d0bb1be038c3fd3984db0769eec963037fb2baf | C++ | AnantheshJShet/Cpp_Practise_Projects | /Balanced_Brackets/Balanced_Brackets/helper_functions.cpp | UTF-8 | 1,439 | 3.34375 | 3 | [] | no_license | #include "helper_functions.h"
#include "typedefs.h"
#include "macros.h"
bool isWithinBounds(const uint32 var, const uint32 min, const uint32 max){
bool retVal = TRUE;
if((var < min) || (var > max))
{
retVal = FALSE;
}
return retVal;
}
bool isOpeningBracket(const char ch){
bool retVal = FALSE;... | true |
296611f03fb90d26dccd561f717c2284e0d691e4 | C++ | michalsvagerka/competitive | /arch/rychlostne/rychlostne-vs-vyberko/3dpoly.cpp | UTF-8 | 3,378 | 2.703125 | 3 | [] | no_license | #include "../l/lib.h"
// #include "../l/mod.h"
int steps[] = {2,3,2,1,0,0};
class poly {
public:
typedef pair<int, pii> point;
point rotate(point &p, int r) {
if (r==0) {
return {-p.y.x, {p.x, p.y.y}};
} else if (r==1) {
return {-p.y.y, {p.y.x,p.x}};
} else if ... | true |
351b6ba6d3bb4bca12b7cff50b8b3bbcdfef489e | C++ | WhiZTiM/coliru | /Archive2/e8/8572fdda9eadf4/main.cpp | UTF-8 | 5,460 | 2.96875 | 3 | [] | no_license | #include <typeinfo>
#include <boost/type_traits.hpp>
#include <iostream>
////// STUBS
struct move_only { // apparently boost::noncopyable prohibits move too
move_only(move_only const&) = delete;
move_only(move_only&&) = default;
move_only() = default;
};
namespace Model { namespace ClientModel {
st... | true |
4d71c78a4b92d1aa9bb4a52086b437e82ba1f16b | C++ | alexfordc/zq | /FastTrader/Module-VerifyCode/VirtualKeyButton.cpp | UTF-8 | 2,336 | 2.578125 | 3 | [] | no_license | #include "stdafx.h"
#include "VirtualKeyButton.h"
const wxColor BACKGROUND_BOTTON_NORMAL = wxColor(214,214,214);
const wxColor FOREGROUND_BOTTON_NORMAL = wxColor(0,0,0);
const wxColor BACKGROUND_BOTTON_PRESS = wxColor(0,255,255);
const wxColor FOREGROUND_BOTTON_PRESS = wxColor(0,0,0);
const wxColor BACKGROUND_BOTTON_O... | true |
2c774a72929e7146eaa5526910b8860a32bc8066 | C++ | EngineerZhang/PAT-Basic-Level | /small test/1018.cpp | UTF-8 | 1,297 | 3 | 3 | [] | no_license | #include<stdio.h>
#include<iostream>
using namespace std;
int main(){
int N;
scanf("%d", &N);
char x, y;
int win_1, win_2, loose_1, loose_2, draw_1, draw_2;
win_1 = win_2 = loose_1 = loose_2 = draw_1 = draw_2 = 0;
int numB_1, numC_1, numJ_1, numB_2, numC_2, numJ_2;
numB_1 = numC_1 = numJ_1 = numB_2 = numC_2 =... | true |
b8aff97bfd6135d767bdb6735114f7a2c7d5471a | C++ | speps/attractouch | /sources/gameplay/receiver.cpp | UTF-8 | 2,838 | 2.625 | 3 | [
"MIT"
] | permissive | #include "gameplay/receiver.h"
namespace AT {
bool Receiver::loaded = false;
sf::Image Receiver::image;
sf::Sprite Receiver::sprite;
Receiver::Receiver(const sf::Vector2f Position, int MaximumParticles, float Radius)
:sf::Drawable(Position, sf::Vector2f(1, 1), 0.0f), maximumParticles(Helper::... | true |
aecad3174baa8f451c2e1c7fd7c211ff79dd6b00 | C++ | night0205/zorejudge | /a022.cpp | UTF-8 | 296 | 2.890625 | 3 | [] | no_license | #include <iostream>
using namespace std;
main(){
string input;
string s;
while(cin >> s){
int flag = 0;
int l = s.length();
for(int i = 0; i < l/2; i++){
if(s[i] != s[l-1-i]){
flag++;
break;
}
}
if(flag)
cout << "no";
else
cout << "yes";
cout << '\n';
}
}
| true |
576c8b08581c860e8d52089c10bbf9f4d3378e8d | C++ | kabuki0111/ProjectEuler1 | /Problem2/ProjectEuler.cpp | UTF-8 | 16,158 | 3.109375 | 3 | [] | no_license | //
// ProjectEuler.cpp
// Problem1
//
// Created by T.S on 2014/04/04.
// Copyright (c) 2014年 T.S. All rights reserved.
//
#include "ProjectEuler.h"
inline int_64 square(int_64 targetNum){return targetNum * targetNum;}
//Problem1の結果を算出する関数
int_64 ProjectEuler::p1(int_64 maxNaturalNumber){
int_64 sumNaturalN... | true |
d7ef3540b92835ff109070e54bb7fc62c78cf4a7 | C++ | dave12311/RoomGen | /Header.h | UTF-8 | 1,508 | 2.625 | 3 | [] | no_license | #ifndef HEADER_H
#define HEADER_H
#include <string>
#include <vector>
using namespace std;
#define Precision 1000
#define Iterations 5000000
void clr();
float rnd(float min, float max);
class Data {
public:
string Name;
float A[7];
Data();
};
class Database {
public:
vector<Data> BaseFloors;
vector<Data> Base... | true |
17bc3869678a70fa0389a2fb834d5544744178e3 | C++ | nguyenanhductb23/SDL2-Project | /Project_SDL2/mouse_and_keyboard.cpp | UTF-8 | 8,407 | 2.65625 | 3 | [] | no_license | #include "Headers/mouse_and_keyboard.h"
using namespace std;
void RandomMove(const int& mode, Object& enemy, const Object* wall, const int& WALLS, int** pos) {
int step = SQ_SIZE[mode];
unsigned int dir = rand() % 4;
SDL_Rect rect = enemy.getRect();
pos[rect.x / SQ_SIZE[mode]][rect.y / SQ_SIZE... | true |
808781797d1cb9898bbf9131e194790488e782fc | C++ | JinyuChata/leetcode_cpp | /leetcode/editor/cn/315_count-of-smaller-numbers-after-self.cpp | UTF-8 | 3,340 | 3.1875 | 3 | [] | no_license | //给你`一个整数数组 nums ,按要求返回一个新数组 counts 。数组 counts 有该性质: counts[i] 的值是 nums[i] 右侧小于
//nums[i] 的元素的数量。
//
//
//
// 示例 1:
//
//
//输入:nums = [5,2,6,1]
//输出:[2,1,1,0]
//解释:
//5 的右侧有 2 个更小的元素 (2 和 1)
//2 的右侧仅有 1 个更小的元素 (1)
//6 的右侧有 1 个更小的元素 (1)
//1 的右侧有 0 个更小的元素
//
//
// 示例 2:
//
//
//输入:nums = [-1]
//输出:[0]
//
//
// ... | true |
1adb764bc7be27fa1e21203d80ca9876efa194cb | C++ | GabeOchieng/ggnn.tensorflow | /program_data/PKU_raw/61/51.c | UTF-8 | 237 | 2.96875 | 3 | [] | no_license | int f(int);
int main()
{
int n;
cin >> n;
for(int i=0; i < n; i++)
{
int a;
cin>>a;
cout<<f(a)<<endl;
}
}
int f(int x)
{
if(x==1)
{
return 1;
}
if(x == 2)
{
return 1;
}
return f(x-1)+f(x-2);
} | true |
bcf5bfd809f6ac74a63ae7f86a518dcf8e49ebeb | C++ | sanhaji182/3-Mei-2016 | /mahasiswa.cpp | UTF-8 | 891 | 3.21875 | 3 | [] | no_license | #include <iostream>
#include <stdlib.h>
using namespace std;
int main()
{
int n;
int no=1;
cout<<"Jumlah mahasiswa : ";
cin >>n;
int nim[n];
string nama[n];
system("cls");
for (int i=0;i<n;i++)
{
cout <<"Masukan nim dan nama mahasiswa ke "<<no<<endl;
... | true |
74a054a2021003dd2ded2ccdfb8812fee2a864b4 | C++ | wyager/SystemNFC | /Mifare Classic/MifareClassicCard.h | UTF-8 | 2,280 | 2.6875 | 3 | [] | no_license | //
// MifareClassicCard.h
// NFCSystem2
//
// Created by Will Yager on 7/26/13.
// Copyright (c) 2013 Will Yager. All rights reserved.
//
#ifndef __NFCSystem2__MifareClassicCard__
#define __NFCSystem2__MifareClassicCard__
#include <iostream>
#include <nfc/nfc.h>
#include <vector>
#include <array>
#include "nfc_de... | true |
915961222edf2480e72b6db38663d994aa885614 | C++ | quintanasergio/ARAP-Compare | /dialog.cpp | UTF-8 | 2,043 | 2.65625 | 3 | [] | no_license | #include "dialog.h"
#include "ui_dialog.h"
#include <QDebug>
Dialog::Dialog(QList<QString> experimentos, QList<QString> showExp, QWidget *parent) :
QDialog(parent),
ui(new Ui::Dialog)
{
ui->setupUi(this);
allExp = experimentos;
addExp = showExp;
//rellenar lista de Exp. a mostrar
for(int ... | true |
27d2f125e96663a94bf33b141e70cf172df9d52e | C++ | smunix/hobbes | /include/hobbes/util/func.H | UTF-8 | 2,015 | 2.53125 | 3 | [
"Apache-2.0"
] | permissive |
#ifndef HOBBES_UTIL_FUNC_HPP_INCLUDED
#define HOBBES_UTIL_FUNC_HPP_INCLUDED
namespace hobbes {
template <typename T>
struct func {
};
template <typename R, typename ... Args>
struct func<R(Args...)> {
static const std::size_t arity = sizeof...(Args);
typedef R (*type)(Args...);
typedef R result_ty... | true |
fa5121f89683f9f07a7127075c48e6f2a319ec6d | C++ | mge19/analysis-of-algorithms | /algo2 homework1.cpp | ISO-8859-3 | 4,453 | 3.125 | 3 | [] | no_license | /*BLG336E - Analysis of Algorithms
Project - 1
Mehmet Gencay Ertrk - 150130118*/
#include <iostream>
#include <ctime>
#include <list>
#include <deque>
#include <cstdlib>
#include <cstring>
using namespace std;
class Coordinate
{
public:
int x,y;
bool placed;
Coordinate(int i,int j);
};
Coord... | true |
ddf62096c849c1b493ab8768e4f45282bea7557b | C++ | BBBBchan/C_CPP_ACM | /ACM暑期培训/Day_2/day2_G.cpp | UTF-8 | 369 | 2.703125 | 3 | [] | no_license | #include <stdio.h>
#include <math.h>
int main(){
float n;
int kase = 0;
scanf("%f", &n);
while(n != 0){
for(int i = 0;i < 50; i++){
float a = (1/sqrt(5))*(pow((1+sqrt(5))/2,i)-pow((1-sqrt(5))/2,i));
if(n == a){
printf("Second win\n");
kase = 1;
break;
}
}
if(!kase)
printf("First win\n"... | true |
5adf0d1167915b8c45e26eacbc8b506c145d70b7 | C++ | Illusionist5/StudFiles | /6 семестр/урвс/учебка/лабы/лр4/Dofiga_vashe_dofiga_boyanov/dofiga_vashe_dofiga_boyanov/lab4+(2)/br/pot.cpp | KOI8-R | 1,888 | 3.109375 | 3 | [] | no_license | #include<stdio.h>
#include<unistd.h>
#include<stdlib.h>
float r_rand() // 0 1
{ static char c=0;
char a=11, b=19, d=50;
c=(a*c+b)%d;
return (float)c/(d-1);
}
void errors(int er) //
{ switch(er)
{ case 1 : printf(" N !\n"); break;
case 2 : printf(" %s !\n",File); break;
case 3 :... | true |
ea526d4fd96f2577bf841d1902ea2338627c2a47 | C++ | mathbrook/learningCpp | /voltage___temperature_crude_logging.ino | UTF-8 | 1,176 | 2.765625 | 3 | [] | no_license | const int sensorPin = A0;
const int voltagethree = A3;
const int voltagetwo = A2;
const float baselineTemp=22;
void setup() {
Serial.begin(9600);
for(int pinNumber = 2; pinNumber<5; pinNumber++){
pinMode(pinNumber, OUTPUT);
digitalWrite(pinNumber, LOW);
}
// put your setup code here, to ru... | true |
edb3547408217a290059b25b34dd3f2c6c1f991d | C++ | evanw/cs224final | /util/raytracer.cpp | UTF-8 | 4,496 | 2.796875 | 3 | [] | no_license | #include "raytracer.h"
#include <qgl.h>
#include <iostream>
using namespace std;
void HitTest::mergeWith(const HitTest &other)
{
if (other.t > 0 && other.t < t)
{
t = other.t;
hit = other.hit;
normal = other.normal;
}
}
static Vector3 unProject(float winX, float winY, double *mode... | true |
938e107e3a79c140de01ac42a5ecd9eaec7dba2c | C++ | HTMLlama/ArduinoFun | /motor/motor.ino | UTF-8 | 797 | 2.984375 | 3 | [] | no_license | #include "Servo.h"
const int SERVO_PIN = 11;
Servo servo;
//int fanSpeed = 0;
//bool isFanUp = true;
void setup() {
// put your setup code here, to run once:
// pinMode(SERVO_PIN, OUTPUT);
servo.attach(SERVO_PIN);
}
void loop() {
servo.write(random(0, 180));
delay(random(150, 1000));
// // Make servo go... | true |
112569b00bf4f279cf7a9e98a583c41cbd1efe3e | C++ | Alohahah/leetcode-1 | /Project1/Project1/Source.cpp | GB18030 | 5,381 | 3.359375 | 3 | [] | no_license | #include <iostream>
#include <algorithm>
#include <vector>
#include <ctime>
using namespace std;
/*
* @Author: Gu Tiankai
* @Desc: K-Sort in Memory
* @Date: 2017.05.13
*/
/*
* ==============================================>
* Declaration Part
* ==============================================>
*/
//#define D... | true |
fd654a0682140cdf91550cf73c555856bfc68bdf | C++ | NatadecocoSeijin/If-I-m-not-brave-men | /Enemy.h | SHIFT_JIS | 506 | 2.5625 | 3 | [] | no_license | #pragma once
#include "Character.h"
class Player;
typedef unsigned long long stagedata;
class Enemy :public Character// G̍\
{
private:
public:
Enemy(char name[], int x, int y, int hp, int attack, int diffence, int magic_power, int dex, int image, int image_dead); //O,x,y,hp,U,h,,q
virtual bool move(int dx, int d... | true |
c5c1b8e4afb0d630d47a5890ef6e2c412654a407 | C++ | lord-przemas/learn_cpp | /standard_library/memory_management/main.cpp | UTF-8 | 1,492 | 3.875 | 4 | [] | no_license | #include <iostream>
#include <memory>
#include <algorithm>
class Data
{
public:
int x {123};
Data() = default;
Data(int num)
: x {num}
{
}
Data(const Data& data)
: x { data.x }
{
std::cout << "Data(const Data& data)" << std::endl;
}
Data(Data&& data)
: x ... | true |
2840c029ade4cca8c855efdbe8cec09f841df3f7 | C++ | mrdooz/nesthing | /src/file_utils.cpp | UTF-8 | 1,092 | 2.65625 | 3 | [] | no_license | #include "file_utils.hpp"
#include <sys/stat.h>
#ifdef _WIN32
#include <io.h>
#include <direct.h>
#else
#include <sys/stat.h>
#include <unistd.h>
#endif
namespace nes
{
//---------------------------------------------------------------------------
string CurrentDirectory()
{
char buf[256];
getcwd(buf, siz... | true |
2641b828065f8520944134077e47014de41fa150 | C++ | alexandraback/datacollection | /solutions_5751500831719424_0/C++/paladin8/A.cc | UTF-8 | 1,089 | 2.734375 | 3 | [] | no_license | #include <iostream>
#include <vector>
#include <cmath>
using namespace std;
vector<int> h[110];
string base[110];
int main() {
int t; cin >> t;
for (int c = 1; c <= t; c++) {
int n; cin >> n;
for (int i = 0; i < n; i++) {
h[i].clear(); base[i] = "";
string s; cin >> s;
for... | true |
860044253c7044fc3f1ea7084aad360b23d40ee0 | C++ | MarkoMackic/Republicko-takmicenje-2017 | /Suma/main.cpp | UTF-8 | 901 | 3.1875 | 3 | [] | no_license | #include <iostream>
#include <algorithm>
using namespace std;
bool sort_function (int i,int j) { return (i<j); }
int main()
{
long long sum = 0;
int n;
cin >> n;
vector<long long> brojevi;
for(int i = 0; i < n ; i++){
long long temp;
cin >>temp;
brojevi.push_back(temp);
... | true |
7152bf5c5ab40563985965e6911fec661a59c90f | C++ | ajalsingh/PFMS-A2020 | /quizzes/quiz3/a/analysis.cpp | UTF-8 | 1,443 | 2.890625 | 3 | [] | no_license | #include "analysis.h"
#include <iostream>
#include <cmath>
Analysis::Analysis()
{
}
void Analysis::setShapes(std::vector<Shape*> shapes) {
shapes_=shapes;
}
void Analysis::setLine(Line line) {
line_=line;
}
std::vector<bool> Analysis::intersectsLine(){
for (auto s:shapes_){
radius_.push_back(s... | true |
719ff1ab1f686449b25820afc7db8efe2ea72960 | C++ | alexeev509/RUCODE_3_0 | /SECOND_DAY/d2.cpp | UTF-8 | 2,280 | 2.828125 | 3 | [] | no_license | #include "iostream"
#include "vector"
using namespace std;
vector<vector<long>> v;
string sequence;
//https://e-maxx.ru/algo/bracket_sequences
//https://neerc.ifmo.ru/wiki/index.php?title=%D0%9F%D1%80%D0%B0%D0%B2%D0%B8%D0%BB%D1%8C%D0%BD%D1%8B%D0%B5_%D1%81%D0%BA%D0%BE%D0%B1%D0%BE%D1%87%D0%BD%D1%8B%D0%B5_%D0%BF%D0%BE%D1... | true |
db842ea7023934070d6ef59ec3c336db0dd635cd | C++ | cselab/CubismNova | /docs/source/examples/Grid/Cartesian_01.cpp | UTF-8 | 1,207 | 3.125 | 3 | [
"BSD-2-Clause",
"BSD-3-Clause"
] | permissive | #include <Cubism/Grid/Cartesian.h>
#include <Cubism/Mesh/StructuredUniform.h>
#include <algorithm>
int main(void)
{
// 3D mesh
constexpr size_t dim = 3; // 3D problem
using Mesh = Cubism::Mesh::StructuredUniform<double, dim>;
using MIndex = typename Mesh::MultiIndex;
// cell centered scalar grid u... | true |
08075cf09ada9a74df8125bda9bd019074a0709b | C++ | seanmarks/wham | /src/wham/FileSystem.cpp | UTF-8 | 3,342 | 3.34375 | 3 | [
"MIT"
] | permissive | #include "FileSystem.h"
#include "Assert.hpp"
namespace FileSystem {
char separator() noexcept
{
#ifndef _WIN_32
return '/'; // Unix
#else
return '\\'; // Windows
#endif
}
std::string root()
{
#ifndef _WIN_32
std::stringstream ss;
ss << separator();
return ss.str();
#else
static_assert(false, "missi... | true |
13077bd5ccc3574616e5397f69c3334eb1748cbd | C++ | yameenjavaid/Online-Judge-Solutions | /Kattis/control.cpp | UTF-8 | 1,131 | 2.53125 | 3 | [] | no_license | #include <bits/stdc++.h>
using namespace std;
// Association for Control Over Minds
const int m = 500001;
int par[m + 3], ran[m + 3], siz[m + 3];
int ufind(int u){
return (u == par[u]) ? u : (par[u] = ufind(par[u]));
}
void umerge(int u, int v){
int i = ufind(u), j = ufind(v);
if(i == j)
return;... | true |
0e3e793d4efc2f3c0690f1dae1b705af0af7b97b | C++ | itz-siddharth/Advanced-DataStructures-in-C | /10-19-2020 18_Binary Tree.cpp | UTF-8 | 782 | 3.78125 | 4 | [] | no_license | #include<stdio.h>
#include<stdlib.h>
struct node{
int data;
node *left, *right;
};
struct node *root=NULL;
struct node* insert()
{
int x;
struct node *p;
printf("Enter data(-1 for no data):");
scanf("%d",&x);
if(x==-1)
return NULL;
p=(struct node*)malloc(sizeof(struct node));
p->data=x;... | true |
e35fcd55c3b4e59c28fdb878948255f13e5a7bf6 | C++ | valentinvstoyanov/fmi | /introduction-to-programming-cpp/jump_search.cpp | UTF-8 | 924 | 3.828125 | 4 | [] | no_license | #include<iostream>
#include<cmath>
int linear_search(const int arr[], const unsigned begin_index, const unsigned end_index, const int element) {
for(unsigned i = begin_index; i <= end_index; ++i)
if(arr[i] == element)
return i;
return -1;
}
int jump_search(const int arr[], const unsigned size, const int eleme... | true |
279d5e59db72d30bd563dbcfbdfec4f81c99d33a | C++ | bennyber01/two-wheeled-robot | /Projects/Arduino/Code/Cerebellum/SensorsModule.cpp | UTF-8 | 4,466 | 2.84375 | 3 | [] | no_license | #include "SensorsModule.h"
inline double ConvertAnalogValueToCM_SharpSensor_2D120X(int val)
{
double volts = double(val) * 0.0048828125; // value from sensor * (5/1024) - if running 3.3.volts then change 5 to 3.3
double distance = 2076.0 / (val - 11.0);
// double distance = -(3.078*pow(volts,5)... | true |