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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
d5fa9024a0b422033f62882afde8b2a212a399d9 | C++ | huangxueqin/algorithm_exercise | /leetcode/96.cc | UTF-8 | 1,104 | 3.046875 | 3 | [] | no_license | #include "leetc.h"
using namespace std;
class Solution {
public:
int numTrees(int n) {
vector<vector<int>> dp = init_dp_table(n);
return compute_num_trees(0, n-1, dp);
}
private:
int compute_num_trees(int i, int j, vector<vector<int>> &dp) {
if(i > j... | true |
de5c13eb7efdc61803451c21de98dd34b8e6c685 | C++ | brock7/TianLong | /Common/Packets/GCAddLockObj.h | GB18030 | 1,577 | 2.84375 | 3 | [] | no_license | // GCAddLockObj.h
//
// Ʒ
//
//////////////////////////////////////////////////////
#ifndef __GCADDLOCKOBJ_H__
#define __GCADDLOCKOBJ_H__
#include "Type.h"
#include "Packet.h"
#include "PacketFactory.h"
#include "DB_Struct.h"
namespace Packets
{
class GCAddLockObj : public Packet
{
public:
enum
{
LOCK_ITEM =0,... | true |
f437b3257e582295441a5b6c5deb6652dabec7e6 | C++ | firewood/topcoder | /atcoder/abc_266/f.cpp | UTF-8 | 2,464 | 2.625 | 3 | [] | no_license | #include <algorithm>
#include <cctype>
#include <cmath>
#include <cstring>
#include <iostream>
#include <sstream>
#include <numeric>
#include <map>
#include <set>
#include <queue>
#include <vector>
using namespace std;
struct Tree {
int64_t size;
vector<vector<pair<int, int>>> edges;
vector<int> vis;
vector<int> ... | true |
4ab5467866cfc2fbac4e187b6cfa892469a5ca67 | C++ | CSEKU160212/C_Programming_And_Data_Structure | /C Programming (Home Practice)/programming/programming/string/1 -1 0.cpp | UTF-8 | 638 | 3.28125 | 3 | [] | no_license | #include<stdio.h>
int string_compare(char a[50], char b[50])
{
int i, j;
for(i = 0; a[i] != '\0' && b[i] != '\0'; i++)
{
if(a[i] < b[i])
{
return -1;
}
if(a[i] > b[i])
{
return 1;
}
}
int main()
{
int string_compare... | true |
4bbf01fea0409521a4c20e5c3342332aab1dd732 | C++ | cmiyachi/CygWinAlgorithms | /DailyCodingProblem/productsNotSelf.cpp | UTF-8 | 1,239 | 3.625 | 4 | [] | no_license | #include <bits/stdc++.h>
using namespace std;
class Solution {
public:
vector<int> productExceptSelf(vector<int>& nums) {
int length = nums.size();
vector<int> answer(length);
answer[0] = 1;
for (int i = 1; i < length; i++) {
// answer[i - 1] already contains the product of element... | true |
05ba8b7399d0c4ec315b7b586d7adfb1fe81d90e | C++ | monsoon235/USTC-Parallel-Computing-Course | /src/lab4/lab4.cpp | UTF-8 | 5,109 | 2.625 | 3 | [] | no_license | #include <iostream>
#include <iomanip>
#include <algorithm>
#include <string>
#include <random>
#include <mpi.h>
// 归并
void multi_merge(int arr[], int arr_len, int offsets[], int size, int output[]) {
int *starts[size];
int *ends[size];
for (int i = 0; i < size; ++i) {
starts[i] = arr + offsets[i];... | true |
0ee180a8202dd09d9fbb8f45958ae94ff1fc0474 | C++ | pankajdevrath96/Cpp | /STL/dequeue.cpp | UTF-8 | 449 | 2.75 | 3 | [] | no_license | #include "iostream"
#include "deque"
using namespace std;
int main()
{
deque<int> q1;
int i,x,n,l1=0,sl=0;
cin>>n;
for(i=0;i<n;i++)
{
cin>>x;
q1.push_back(x);
}
for(i=0;i<n;i++)
{
x=q1.front();
q1.pop_front();
if(x>l1)
... | true |
021ced2c87d7ab77188136ac43461861c48078b8 | C++ | DevJhin/Weekly_Algorithm_Quiz | /2018_11/Week_5/11050_Binomial_Coefficient_1/main.cpp | UTF-8 | 437 | 3.546875 | 4 | [] | no_license | #include <iostream>
int Factorial(int val);
int BinomialCoefficient(int N, int K);
int main() {
int N, K;
scanf("%d %d", &N, &K);
printf("%d", BinomialCoefficient(N, K));
}
int Factorial(int val) {
int rlt = 1;
for (int i = 1; i <= val; i++) {
rlt *= i;
}
return rlt;
}
//Calculate Binomial Coeffiecient... | true |
df7d4b34af65aadee433b63ea78cb7184b6ef38f | C++ | oides/AutonomousRaspRobot | /Raspberry/RaspOpenCV/moviment.cpp | UTF-8 | 1,139 | 2.703125 | 3 | [] | no_license | #include "moviment.h"
void Moviment::startMoviment(bool &walk)
{
walk = true;
while(1)
{
if(walk) executeFrente(walk);
sleep(SLEEP_MOVIMENT);
}
}
void Moviment::executeFrente(bool &walk)
{
printf("executeFrente\n");
walk = true;
strncpy(client_message, FRENTE, MQ_MESSAGE_LENGTH);
... | true |
4cc5c75ea574f48cefbb25f9567c7bcdeabf0236 | C++ | dpicken/utils | /src/network/SocketAddress.h | UTF-8 | 773 | 2.59375 | 3 | [
"MIT"
] | permissive | #ifndef network_SocketAddress_h
#define network_SocketAddress_h
#include "IpAddress.h"
#include <netinet/in.h>
#include <cstddef>
#include <cstdint>
#include <iosfwd>
namespace network {
class SocketAddress {
public:
SocketAddress(const sockaddr_in6& m_address);
static SocketAddress ip(const IpAddress& ipAddr... | true |
66164a635fd041303659e3fdba4cc70d3cacf774 | C++ | Kose-i/training_algorithm | /problem/CodeIq/book2/prob41.cpp | UTF-8 | 2,136 | 3.28125 | 3 | [] | no_license | #include <iostream>
#include <utility>
#include <vector>
#include <map>
#include <algorithm>
struct Box{
int x;
int y;
};
namespace prob41{
unsigned long long search(std::vector<int>& tile_column, std::map<std::vector<int>, unsigned long long>& memo, const std::vector<Box>& box_type, const int& column_size, cons... | true |
58f94bf9b37b5830bac0c9a89bce017146ef469a | C++ | panda3d/panda3d | /panda/src/bullet/bulletTriangleMesh.cxx | UTF-8 | 15,817 | 2.5625 | 3 | [
"BSD-3-Clause",
"BSD-2-Clause"
] | permissive | /**
* PANDA 3D SOFTWARE
* Copyright (c) Carnegie Mellon University. All rights reserved.
*
* All use of this software is subject to the terms of the revised BSD
* license. You should have received a copy of this license along
* with this source code in a file named "LICENSE."
*
* @file bulletTriangleMesh.cxx
... | true |
129d59537ecb63db86520e091e211675923cf9a8 | C++ | zhangxu128/Cplusplus | /进制转换/进制转换/进制转换.cpp | GB18030 | 679 | 3.390625 | 3 | [] | no_license | #include <string>
#include <iostream>
using namespace std;
//Ŀ
//һʮMԼҪתĽNʮMתΪN
// :
//ΪһУM(32λ)N(2 N 16)Կո
// :
//ΪÿʵתÿռһСN9
//Ӧֹο16ƣ磬10Aʾȵȣ
int main() {
string s = "", table = "0123456789ABCDEF";
int m, n;
cin >> m >> n;
while (m) {
if (m < 0) {
m = -m;
cout << "-";
}
s = table[m%n] + s;
m /= n;
... | true |
7e3a62add265f38daa333833bce45cf1ff7303d8 | C++ | benitogr-code/cs101 | /src/lib/BigInt.h | UTF-8 | 1,393 | 3.171875 | 3 | [] | no_license | #pragma once
#include <string>
#include <vector>
/**
Big Int
Implements storage for big integers and some common math operations
*/
class CBigInt
{
private:
enum
{
eBase = 1000000000
};
typedef std::vector<int> Storage;
public:
CBigInt();
CBigInt(long long value);
CBigInt(const CBigInt& value);
void op... | true |
7f01d0801f4d0774da33576163e2070b2713e90d | C++ | rmagalhaess/Calendario | /atual/U_Projeto_Arquivo.cpp | UTF-8 | 3,151 | 2.765625 | 3 | [] | no_license |
#ifndef U_Projeto_Arquivo_H
#define U_Projeto_Arquivo_H
#include <U_Projeto_Arquivo.h>
#endif
#ifndef U_Projeto_H
#define U_Projeto_H
#include <U_Projeto.h>
#endif
/*
struct struct_Projeto
{
String Nome;
String Data_Entrega;
String Data_Alteracao;
int Tamanho;
};
*/
... | true |
4731c0f45f659800a1f383099ff80fb8f27f441e | C++ | TheIslland/learning-in-collegelife | /5.数据结构学习/重建二叉树.cpp | UTF-8 | 2,005 | 3.234375 | 3 | [] | no_license | /*************************************************************************
> File Name: 重建二叉树.cpp
> Author:TheIslland
> Mail: 861436930@qq.com
> Created Time: 2019年03月26日 星期二 18时58分03秒
************************************************************************/
/**
* Definition for binary tree
* struct TreeNode {... | true |
253fce9585fc9ca41ba4e30870f5ec42f8d8ac83 | C++ | weichaoage789/CCOV-CSB | /CcovRsov/Utilities/NetWork/Ping.cpp | UTF-8 | 6,509 | 2.625 | 3 | [] | no_license | #include "Ping.h"
namespace NetWork
{
Ping::Ping()
{
_MaxCnt = 4;
_DataLen = 56;
_SendCnt = 0;
_RecvCnt = 0;
_ICMP_SEQ = 0;
}
unsigned short Ping::getChksum(unsigned short *addr, int len)
{
int nleft = len;
int sum = 0;
unsigned short *w = addr;
unsigned short answer = 0;
/*把ICMP报头二进制数据以2字节... | true |
9983d632fb7a4d31f4db84b23c370d843f74cc8c | C++ | MTBorg/Ambii | /Arduino/interpolated.ino | UTF-8 | 3,141 | 2.953125 | 3 | [] | no_license | #include "FastLED.h"
#define BAUD_RATE 57600
#define PIN_OUTPUT 13
#define PIXEL_AMOUNT 30
//Interpolation settings
#define INTERPOL_TICKS 20 //Keep this as low as possible, color differences lower than this will not be interpolated (diff/ticks < 1 will be rounded to 0).
#define INTERPOL_WAITTIME 1 //This is recommen... | true |
78f47f349a69d3836a8bb379e06e03523aa2731f | C++ | BragCat/USACO | /Section3.4/fence9.cpp | UTF-8 | 742 | 2.90625 | 3 | [] | no_license | /*
ID: bragcat1
LANG: C++11
TASK: fence9
*/
#include <fstream>
using namespace std;
int n, m, p;
int main() {
ifstream fin("fence9.in");
fin >> n >> m >> p;
fin.close();
int count = 0;
for (int i = 1; i <= n; ++i) {
count += i * m / n + ((i * m % n == 0) ? -1 : 0);
}
if (p > ... | true |
563b5ef9b8ee92d379c8ea68ee147fc712beffec | C++ | limjaein/java-algorithm | /C++/색종이만들기.cpp | UTF-8 | 1,324 | 3.390625 | 3 | [] | no_license | #include <iostream>
#include <string.h>
using namespace std;
namespace {
enum {
BLUE = 0, WHITE = 1
};
}
const int maxSize = 129;
int N;
int paper[maxSize][maxSize];
typedef struct Pos {
int x, y;
}Pos;
class Cnt {
private:
int b, w;
public:
Cnt() {
b = w = 0;
}
Cnt(int bCnt, int wCnt) {
b = bCnt;
w... | true |
5735c874141439927b230fa90ffeb6956609f6d9 | C++ | valerik87/PathFinding | /PathFinding/PathFinding/Button.cpp | UTF-8 | 1,035 | 2.890625 | 3 | [] | no_license | #include "Button.h"
Button::Button(Vector2f size):
RectangleShape(size)
{}
void Button::Draw(sf::RenderWindow& i_oWindow)
{
i_oWindow.draw(*this);
i_oWindow.draw(m_oText);
}
void Button::SetPosition(Vector2f pos)
{
setPosition(pos);
m_oText.setPosition(pos);
}
void Button::SetFillColor(Color color)
{
setFillCo... | true |
bf475092045ae74a313e109ef31d7521ed40eea1 | C++ | nalidzhik/object-oriented-programming | /dates/main.cpp | UTF-8 | 697 | 3.25 | 3 | [] | no_license | /**
* Solution to homework assignment 1
* Object Oriented Programming Course
* Faculty of Mathematics and Informatics of Sofia University
* Summer semester 2020/2021
*
* @author Nazife Alidzhik
* @idnumber 62598
* @task 1
* @compiler VC
*/
#include <iostream>
#include "Dates.hpp"
using namespace std;
int main()
{
D... | true |
2732a0636e39b58d53e87731132532593212fb41 | C++ | dumitrubogdanmihai/ObjectTracking | /ObjectTracking/ObjectTracking/ObjectFinder.cpp | UTF-8 | 4,904 | 2.609375 | 3 | [] | no_license | #include "ObjectFinder.h"
#include "Helper.h"
using std::cout;
ObjectFinder::ObjectFinder(int minHessian)
{
detector = SurfFeatureDetector(minHessian);
}
ObjectFinder::~ObjectFinder()
{
cout << "ObjectFinder class destructor was called!" << std::endl;
}
void ObjectFinder::find(Object const &obj, Mat &scene, vect... | true |
75d6f3a69d71b44056c03bce3c09b0408ce31a62 | C++ | agspathis/task-space-projection | /task_space/tests/TestUtil.h | UTF-8 | 3,712 | 3.359375 | 3 | [] | no_license | #ifndef TEST_UTIL_H
#define TEST_UTIL_H
/**
* \file This file contains some test utilities.
*
* @author Dimitar Stanev <jimstanev@gmail.com>
*
* @see <a href="https://simtk.org/projects/task-space">[SimTK Project]</a>, <a
* href="http://ieeexplore.ieee.org/document/8074739/">[Publication]</a>
*/
#include <iost... | true |
8ba1b767fdbb9230e022043636eefc60e2b55723 | C++ | flynn2016/5850_FinalProject | /src/Key.cpp | UTF-8 | 837 | 2.859375 | 3 | [] | no_license | #include "Key.h"
Key::Key() {
mKey = new Texture("Key.png", 0, 0, Key_WIDTH, Key_HEIGHT);
mKey->Pos(Vector2(50, 50));
mKey->Scale(Vector2(0.3f, 0.3f));
mWin = new Texture("You Passed!", "alpha_echo.ttf", 36*2 , {255, 249, 196});
mWin->Pos(Vector2(640, 500));
mLose = new Texture("You Lost!", "alpha_echo.t... | true |
927a193ee60fe709423a3f061edb9caa9b657af7 | C++ | Nuos/shadow | /src/engine/mobs/Mob.cc | UTF-8 | 490 | 2.984375 | 3 | [] | no_license | /*
* File: Mob.cc
* Author: jts
*
* Created on 8 July 2014, 11:59 AM
*/
#include "Mob.h"
#include <list>
#include <iostream>
void Mob::tick(Vector<int> target) {
std::list<Vector<int>> path = this->map->pathfinder.Dijkstra(this->pos, target);
path.pop_front();
Vector<int> move = path.front().sub(... | true |
2cc5411e1aa598bd4cb3a69823411a7b2a62e519 | C++ | PeiJunLiu/Breakout | /post_processor.h | GB18030 | 1,330 | 2.703125 | 3 | [] | no_license | #ifndef POST_PROCESSOR_H
#define POST_PROCESSOR_H
#include <GL/glew.h>
#include <glm/glm.hpp>
#include "texture.h"
#include "sprite_renderer.h"
#include "Shader.h"
//PostProcessorΪBreakout GameṩкڴЧ
//ıȾϷȻͨConfuseChaosShakeֵضЧ
//ڳϷЧ֮ǰҪBeginRenderȻȾϷ֮EndRender
class PostProcessor
{
public:
// ״̬
Shader PostProces... | true |
bc8d0c90a3d4ab46e0a7b9e18adf39f596dc6eac | C++ | Algocourse/autumn2016-contests | /strings/D.cpp | UTF-8 | 901 | 3.125 | 3 | [] | no_license | #include <algorithm>
#include <chrono>
#include <iostream>
#include <vector>
using namespace std;
using namespace std::chrono;
void do_shift(string& s, int l, int r, int k) {
k %= (r - l + 1);
string buf = "";
for (int i = r - k + 1; i <= r; ++i)
buf += s[i];
for (int i = l; i < r - k + 1; ++... | true |
772979b843d71ff98e07228ef2c012062ad94920 | C++ | Afinogen/calc | /tokens.h | WINDOWS-1251 | 917 | 2.65625 | 3 | [] | no_license | //---------------------------------------------------------------------------
#ifndef tokensH
#define tokensH
#include <vector>
#include "token.h"
//#include "convert.h"
using namespace std;
/*
*/
class Tokens//: public Convert
{
public:
Tokens(); //
~Tokens(); ... | true |
7a60fcf6edb8f984d3be98945caadd4c19a87b12 | C++ | efdazedo/asgard | /src/pde/pde_fokkerplanck2_complete.hpp | UTF-8 | 17,850 | 2.546875 | 3 | [
"MIT"
] | permissive | #pragma once
#include <algorithm>
#include <cassert>
#include <cmath>
#include <functional>
#include <iostream>
#include <map>
#include <math.h>
#include <memory>
#include <string>
#include <typeinfo>
#include <vector>
#include "../tensors.hpp"
#include "pde_base.hpp"
// ----------------------------------------------... | true |
851840f81d1761a3bea66f25b82b953b0064d797 | C++ | namlunthkl/team4-trynity | /Aeona Sprint 2/Aeona Project/source/Light System/LightEngine.h | UTF-8 | 9,122 | 2.828125 | 3 | [] | no_license | #ifndef LIGHTENGINE_H_
#define LIGHTENGINE_H_
class LightEngine
{
private:
// CURRENT CYCLE
enum CYCLE{ MORNING = 1, AFTERNOON, DAY, EVENING, DUSK, NIGHT, DAWN };
// SOUND
int m_nDay_AirBed;
int m_nNight_AirBed;
int m_sCurrentCycle;
float m_fCurrentLTime;
float m_fTimeToWait;
// AMBIE... | true |
3267146bfaffa44f490d6c851f51ab9fe40d53d4 | C++ | Toxe/test-cpp | /src/chrono_time_point.cpp | UTF-8 | 2,603 | 3.734375 | 4 | [
"MIT"
] | permissive | #include <chrono>
#include <ctime>
#include <iomanip>
#include <iostream>
using namespace std::literals::chrono_literals;
void output_tp_seconds(const std::chrono::time_point<std::chrono::system_clock, std::chrono::seconds> tp)
{
const std::time_t tc = std::chrono::system_clock::to_time_t(tp);
std::cout << tp... | true |
695351cd3191dc1ef47044e6fa0a9aa990d89c0b | C++ | mxm001/UNLaM | /Programacion Basica I/clase 7/clase7-1.cpp | UTF-8 | 922 | 3.53125 | 4 | [] | no_license | #include<stdio.h>
#include<conio.h>
/*
ct= Contador total, El bucle va 10 veces xq el interior va 5 (5*10)
Siempre al final resetea suma5.
suma5=Guarda el resultado de las sumas de los 5 numeros del for interno. Al salir de ese bucle se vuelve a igualar a 0.
num=Guarda el numero ingresado.
Suma=La suma de todos l... | true |
e740f8074610179fe1cc0029e60a04ef74e27186 | C++ | yashparmar15/Cpp-Codes | /3Sum.cpp | UTF-8 | 1,513 | 3.03125 | 3 | [] | no_license | // Given an array nums of n integers, are there elements a, b, c in nums such that a + b + c = 0? Find all unique triplets in the array which gives the sum of zero.
// Note:
// The solution set must not contain duplicate triplets.
// Example:
// Given array nums = [-1, 0, 1, 2, -1, -4],
// A solution set... | true |
d299f76c99b0246308881d8fa8b501469b469b81 | C++ | StanfordAHA/Halide-to-Hardware | /test/correctness/debug_to_file_multiple_outputs.cpp | UTF-8 | 3,508 | 2.59375 | 3 | [
"MIT"
] | permissive | #include "Halide.h"
#include <stdio.h>
#include "test/common/halide_test_dirs.h"
using namespace Halide;
int main(int argc, char **argv) {
const int size_x = 766;
const int size_y = 311;
std::string f_tmp = Internal::get_test_tmp_dir() + "f3.tmp";
std::string g_tmp = Internal::get_test_tmp_dir() + "... | true |
0c7d82dfc8e60d3cfa61a56f9ae5bacad75633c5 | C++ | ShadiHelf950/OpenGL3D | /OpenGL3D/Light.h | UTF-8 | 1,036 | 2.921875 | 3 | [] | no_license | #pragma once
#include<iostream>
#include<fstream>
#include<string>
#include<glew.h>
#include<glfw3.h>
#include<glm.hpp>
#include<vec2.hpp>
#include<vec3.hpp>
#include<vec4.hpp>
#include<mat4x4.hpp>
#include<gtc\type_ptr.hpp>
class Light
{
public:
Light(std::string t, glm::vec3 pos, glm::vec3 a, glm::vec3 d, glm:... | true |
7a8a1b6bbd48c1f57f025c55073f4c0e6bb0bd56 | C++ | orangeate/webserver | /threadpool/thread_pool.h | UTF-8 | 3,154 | 3.359375 | 3 | [] | no_license | #ifndef THREAD_POOL_H
#define THREAD_POOL_H
#include <list>
#include <cstdio>
#include <exception>
#include <pthread.h>
#include <vector>
#include "../lock/lock.h"
template <typename T>
class ThreadPool
{
public:
ThreadPool(int thread_number = 8, int max_request = 10000);
~ThreadPool();
bool append(T *req... | true |
23163c2f027a44c8ac6f8d50ebbf3dbed9d327f0 | C++ | incoder1/IO | /include/charsets.hpp | UTF-8 | 4,761 | 2.671875 | 3 | [
"BSL-1.0"
] | permissive | /*
*
* Copyright (c) 2016-2019
* Viktor Gubin
*
* Use, modification and distribution are subject to 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)
*
*/
#ifndef __CHARSETS_HPP_INCLUDED__
#define __CHARSETS_HPP_INCLUDED__
#inc... | true |
1479733d0b542c14de4c98249d13a86255299184 | C++ | lianaivanova/social-media | /QuickSortImpl.h | UTF-8 | 816 | 3.1875 | 3 | [] | no_license | #ifndef SOCIALMEDIA_QUICKSORTIMPL_H
#define SOCIALMEDIA_QUICKSORTIMPL_H
#include <vector>
template<typename T>
void swap(T *a, T *b) {
T t = *a;
*a = *b;
*b = t;
}
template<typename T>
int partition(vector<T> &elements, int low, int high) {
T pivot = elements[high];
int i = (low - 1);
for (in... | true |
26858585992d28c800401a6ce3cc5d89c814e6d4 | C++ | TeoPaius/Projects | /c++/Diverse problems and algorithms/Ore particular/extra/26.11/26.11/euler2.cpp | UTF-8 | 1,998 | 2.5625 | 3 | [] | no_license | // ok infoarena
#include <fstream>
#include <iostream>
#include <vector>
#include <bitset>
#include <string.h>
#include <algorithm>
#include <string>
#include <queue>
#include <stack>
using namespace std;
const char infile[] = "ciclueuler.in";
const char outfile[] = "ciclueuler.out";
ifstream fin(infile);
ofstrea... | true |
5edffc91883376c1c26c5caa5b629ca916cbeb4d | C++ | RapidWorkers/ProblemSolving | /BOJ/소수 판정/5615.cpp | UTF-8 | 1,095 | 3.203125 | 3 | [] | no_license | #include <iostream>
#include <array>
#include <vector>
using namespace std;
//fast modulo-power algorithm
unsigned long long pow_mod(unsigned long long a, unsigned long long b, unsigned long long mod)
{
long long r = 1;
a = a % mod;
while (b)
{
if (b & 1) r = ((r % mod) * (a % mod)) % mod;
b = b >> 1;
a = (... | true |
d54c0737ac231e4a91e3cbc38408ab2e1dcb7962 | C++ | cxjwin/algorithms | /LeetCode-CPP/offer.58/solution.cpp | UTF-8 | 1,764 | 3.296875 | 3 | [] | no_license | #include <string>
#include <vector>
using namespace std;
class Solution {
public:
string reverseWords(string s) {
vector<int> pos;
pos.push_back(-1);
for (int i = 0; i < s.length(); ++i) {
if (s[i] == ' ') {
pos.push_back(i);
}
}
pos.push_back(s.leng... | true |
b5dfa5e1b96ee618d89790a05b873520632ad4f6 | C++ | busradogru/Robot-Proje | /MyAlgo/MyAlgo/MyAlgo.cpp | UTF-8 | 1,953 | 2.609375 | 3 | [] | no_license | #include "MyAlgo.h"
#include <stdio.h>
#include <stdlib.h>
bool __stdcall Algo1(int S, int L, int R, int Init, float& VL, float& VR) {
float Output = PIDKontrolSistemi();
if (Output <= -1) {
VR = 1100 + Output * 10;
VL = 1100 - Output * 10;
}
else if (Output >= 1) {
VR = 1100 + Output * 10;
VL = 110... | true |
7a0e377cb45dde703c89373a0b4b41045783f8cc | C++ | mostafa-saad/ArabicCompetitiveProgramming | /18-Programming-4kids/08_homework_09_answer.cpp | UTF-8 | 407 | 3.28125 | 3 | [] | no_license | #include<iostream>
using namespace std;
int main() {
int N;
cin >> N;
int pos = 0;
while (pos < N) {
string str;
cin>>str;
// there are 8 different ways to make 2 letters no in lower/upper cases
if (str == "no" || str == "No" || str == "nO" || str == "NO" ||
str == "on" || str == "oN... | true |
2b673f54aea9225f9e698fefbefeaf299afdd50f | C++ | culturedsys/foc | /linearlists/linked/stack.hpp | UTF-8 | 504 | 3.109375 | 3 | [] | no_license | #ifndef LINKED_STACK_HPP
#define LINKED_STACK_HPP
#include "../allocator.hpp"
#include "node.hpp"
namespace linked {
class stack
{
node* top;
node_allocator<node> allocator;
public:
// Create a stack with the specified maximum size
stack(int);
//... | true |
60e19d3995680f530adca3a64efad750c5cafa19 | C++ | barani008/C-programs | /DP/String Interleeving.cpp | UTF-8 | 1,237 | 3.578125 | 4 | [] | no_license | /*
Given s1, s2, s3, find whether s3 is formed by the interleaving of s1 and s2.
For example,
Given:
s1 = "aabcc",
s2 = "dbbca",
When s3 = "aadbbcbcac", return true.
When s3 = "aadbbbaccc", return false.
*/
class Solution {
public:
bool isInterleave(string s1, string s2, string s3) {
if(s1.size() + s2.siz... | true |
7e68221fdecc0665f733097d0549c4857f6d42d7 | C++ | zhangjin19880118/Qt_Code | /IdeFile/mainwindow.cpp | UTF-8 | 6,594 | 2.90625 | 3 | [] | no_license | #include "mainwindow.h"
#include "ui_mainwindow.h"
#include <QtDebug>
#include <QFileDialog>
#define cout qDebug()
enum mycode
{
utf_8,gbk
};
enum mycode flag;
QString path;
MainWindow::MainWindow(QWidget *parent) :
QMainWindow(parent),
ui(new Ui::MainWindow)
{
ui->setupUi(this);
... | true |
eb9562f137dbe73b6897dac4d9941e507cf3d63c | C++ | hienlth/AP | /codes/Source_FILE_PTB2.cpp | UTF-8 | 1,494 | 2.984375 | 3 | [] | no_license | #include <iostream>
#include <stdio.h>
#include <stdlib.h>
#define MAX 100
#define VOSONGHIEM -1
#define VONGHIEM 0
#define CO1NGHIEM 1
#define CO2NGHIEM 2
struct PTB2{
double A, B, C; //hệ số PTB2
int sn; //số nghiệm: -1 (vô số nghiệm); 0 (vô nghiệm); 1 (có 1 nghiệm), 2 (có 2 nghiệm)
double X1, X2; ... | true |
f6404113f1c2fcdf9ef606124ad52a6593973e81 | C++ | leojavier/CPP_matrix_implementation | /matrix.h | UTF-8 | 696 | 2.96875 | 3 | [] | no_license | #ifndef MATRIX_H
#define MATRIX_H
#include <iostream>
#include <vector>
#include <stdexcept>
class Matrix {
private:
std::vector< std::vector<float> > grid;
std::vector<int>::size_type rows;
std::vector<int>::size_type columns;
public:
//Constructor function
Matrix();
Matrix(std::vector<... | true |
02a2d1e69b38b318fb638b545bfc08126c6b3646 | C++ | kmmao/REDM | /DmMain/inc/Common/Template/DMAllocT.h | GB18030 | 8,025 | 2.96875 | 3 | [
"MIT"
] | permissive | //-------------------------------------------------------
// Copyright (c) DuiMagic
// All rights reserved.
//
// File Name: DMAllocT.h
// File Des:
// File Summary:
// Cur Version: 1.0
// Author:
// Create Data:
// History:
// <Author> <Time> <Version> <Des>
// guoyou 2015-01-13 1.0
//---------------... | true |
b9c3e4d3e36c625a4e5bd91947e8a28d6017136e | C++ | danyveve/UBB-PDP | /PPD-Lab7.2/Lab7.2/Lab7.2/Lab7.2.cpp | UTF-8 | 1,112 | 3.109375 | 3 | [] | no_license | #include "pch.h"
#include <iostream>
#include "ParallelSumHhelper.h"
#include <queue>
#include "Lab7.2.h"
#include <future>
int main()
{
std::vector<std::vector<int>> numbers = readNumbersFromFile("numbers.txt");
//transform numbers into queues of digits
std::vector<std::queue<int>> numbersQueues;
for (std::vecto... | true |
4da139a5a75f9447ad57a12887106b7675dd2e4a | C++ | lincomatic/WeatherCube | /software/zonda/zonda/rtc.ino | UTF-8 | 1,890 | 2.515625 | 3 | [] | no_license | void rtc_write_date(int sec, int mint, int hr24, int dotw, int dy, int mon, int yr)
{
Wire.beginTransmission(RTC_ADDR);
Wire.write((uint8_t)TIME_REG);
Wire.write(dec2bcd(sec) | B10000000); //stops the oscillator (Bit 7, ST == 0)
Wire.write(dec2bcd(mint));
Wire.write(dec2bcd(hr24)); //hr
Wire.write(dec2bcd(d... | true |
d9eb4731f8a5235ea117b95adc1d18b420c25693 | C++ | abdullah13314/Book-Store | /code/InventoryTransaction.cpp | UTF-8 | 668 | 2.671875 | 3 | [] | no_license | #include "stdafx.h"
#include "InventoryTransaction.h"
InventoryTransaction::InventoryTransaction()
{
pAudioBooksInventoryTree = NULL;
pOtherBooksInventoryTree = NULL;
}
InventoryTransaction::InventoryTransaction(BST * pAudioBooksInventoryT, BST * pOtherBooksInventoryT)
{
pAudioBooksInventoryTree = pAudioBooksInve... | true |
fe6e03d319020e0e978668f53829fda48bd36fb2 | C++ | Ujwalgulhane/Data-Structure-Algorithm | /Algorithms/DynamicProgramming/mincostMatrixTraversal.cpp | UTF-8 | 680 | 2.859375 | 3 | [] | no_license | #include<climits>
#include<iostream>
#include<vector>
using namespace std;
int cost(vector<vector<int>>arr,int n,int m){
vector<vector<int>>dp(n,vector<int>(m));
dp[n-1][m-1]=arr[n-1][m-1];
for(int i=arr.size()-1;i>=0;i--){
for(int j=arr[0].size()-1;j>=0;j--){
if(i==n-1 && j==m-1) dp[i][j]=arr[i][j];
else i... | true |
ef88b4728b274247ef1652a87c6582f3a43595b9 | C++ | SamChien/Competitive-Programming | /uva_online_judge/10050-Hartals.cpp | UTF-8 | 626 | 2.578125 | 3 | [] | no_license | #include <cstdio>
int main() {
int caseNum;
scanf("%d", &caseNum);
while (caseNum--) {
int n, p, loseDays;
scanf("%d%d", &n, &p);
bool table[n];
for (int i=0; i<n; i++) table[i] = false;
for (int i=0; i<p; i++) {
int hartal;
scanf("%d", &ha... | true |
c55a436d08eb2a6dcf04e088a2e28ce87e1840f7 | C++ | shaniherskowitz/othello | /src/client/Menu.h | UTF-8 | 828 | 2.625 | 3 | [] | no_license | #ifndef OTHELLO_MENU_H
#define OTHELLO_MENU_H
#include "GameUI.h"
#include "Game.h"
#include "HumanPlayer.h"
#include "AIPlayer.h"
#include "RemotePlayer.h"
#include "Client.h"
#include <fstream>
#include <sstream>
#define DEF_SIZE 8
/**
* Defining a Menu class.
*/
class Menu {
public:
/**
* The Menu's default... | true |
c9acc920e2a4e28e8b33190a3acd6b7bdf1b62b7 | C++ | jqhong/klee-native | /remill/tools/klee/runtime/Native/OS/Linux/Intercepts.cpp | UTF-8 | 12,365 | 2.578125 | 3 | [
"Apache-2.0",
"NCSA"
] | permissive | /*
* Copyright (c) 2019 Trail of Bits, 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 o... | true |
30e9e3542e3b52937944f63a3a239af15228b25e | C++ | anoopskapoor95148/leetcode | /easy/Symmetric-Tree-101.cpp | UTF-8 | 817 | 3.296875 | 3 | [] | no_license | /**
* Definition for a binary tree node.
* struct TreeNode {
* int val;
* TreeNode *left;
* TreeNode *right;
* TreeNode(int x) : val(x), left(NULL), right(NULL) {}
* };
*/
class Solution {
public:
bool isSameTree(struct TreeNode* p, struct TreeNode* q, bool *flag) {
if (*flag == true)
... | true |
6fa793fa62fdc74bb1992ab79bad3d3df92098d3 | C++ | kk4728/CppPrimer5th | /ch12_mem-sp/exer.12.1.2.cpp | UTF-8 | 644 | 3.140625 | 3 | [] | no_license | #include <iostream>
#include <memory>
#include <vector>
using namespace std;
shared_ptr<vector<int>> revec2()
{
return make_shared<vector<int>>();
}
std::vector<int>* revec()
{
vector<int> *pvi = new vector<int>();
return pvi;
}
void f126(vector<int>* p)
{
int i;
while(cin>>i)
{
p->push_back(i);
}
}
void... | true |
bebc8e57430b22f5ad4236719eafa71662aa4318 | C++ | nahratzah/ilias_os | /proper/abi/include/stdimpl/functional_comparators.h | UTF-8 | 2,784 | 2.6875 | 3 | [] | no_license | #ifndef _STDIMPL_FUNCTIONAL_COMPARATORS_H_
#define _STDIMPL_FUNCTIONAL_COMPARATORS_H_
#include <cdecl.h>
_namespace_begin(std)
template<typename T = void> struct equal_to {
constexpr bool operator()(const T& x, const T& y) const { return x == y; }
using first_argument_type = T;
using second_argument_type = T;... | true |
117e9249076e2fe212e599ccabba85490c65eadb | C++ | vreverdy/bit-algorithms | /include/copy_backward.hpp | UTF-8 | 1,258 | 2.515625 | 3 | [
"BSD-3-Clause"
] | permissive | // ============================= COPY BACKWARD ============================= //
// Project: The Experimental Bit Algorithms Library
// Name: copy_backward.hpp
// Description: bit_iterator overloads for std::copy_backward
// Creator: Vincent Reverdy
// Contributor(s):
// License: BSD 3-Clause License
// ===============... | true |
6f3461a74f27710fefed148d6921734f803cfe67 | C++ | adi618/Data-Structures | /Data Structures/Data Structures/Queue.cpp | UTF-8 | 2,214 | 4.1875 | 4 | [] | no_license | #include <iostream>
namespace
{
struct Node
{
int value;
Node* next;
Node(int value) :value(value), next(nullptr) {}
};
}
class Queue
{
private:
Node* first;
Node* last;
int totalNodes;
public:
Queue() : first(nullptr), last(nullptr), totalNodes(0) {}
int getTotalNodes() { return totalNodes; }
vo... | true |
19ee76f3909ad0d209a2beecb661eda45ee9b51c | C++ | progcomposantsEJP/dev2 | /developpement2/Composant2/Composant2.cpp | UTF-8 | 3,851 | 2.75 | 3 | [] | no_license | // Composant2.cpp : Defines the exported functions for the DLL application.
//
/*
// This is an example of an exported variable
COMPOSANT2_API int nComposant2=0;
// This is an example of an exported function.
COMPOSANT2_API int fnComposant2(void)
{
return 42;
}
// This is the constructor of a class that has been ex... | true |
648fa3d8b11f43644793ab81baa91c71ed12cf4b | C++ | DoctorLai/ACM | /leetcode/949. Largest Time for Given Digits/949.cpp | UTF-8 | 819 | 3.484375 | 3 | [] | no_license | // https://helloacm.com/algorithms-to-compute-the-largest-time-for-given-digits/
// https://leetcode.com/problems/largest-time-for-given-digits/
// EASY, PERMUTATION
class Solution {
public:
string largestTimeFromDigits(vector<int>& A) {
sort(begin(A), end(A));
string ans = getTime(A);
... | true |
3aa0eb7480723d6c117269e814721b1ae3d429cb | C++ | CallyyllaC/LeapMotion-Telemanipulation | /vm_leap/src/vmleap.cpp | UTF-8 | 1,888 | 2.734375 | 3 | [] | no_license | //
// Depricated, no longer required due to using ros network to connect multiple PC's for dual leaps
//
#include "ros/ros.h"
#include "leap_motion/Human.h"
#include "leap_motion/Hand.h"
#include "geometry_msgs/Point.h"
#include "leap_motion/Gesture.h"
#include "vm_leap/Modified_leap.h"
class VMLeap
{
pr... | true |
0efe3e6b31ee672f6b599edbc8d1980be3a4c617 | C++ | dingge/LightTheMaze | /Classes/Game/Mechanism/MechanismCollisionNode/PotalMechainismCell.h | GB18030 | 1,397 | 2.53125 | 3 | [] | no_license | /********************************************************************
date : 2016/01/30 15:30
author: TLeaves
e-mail: 664570530@qq.com
github: https://github.com/TLeaves
*********************************************************************/
#ifndef POTALMECHAINISMCELL_H_
#define POTALMECHAINISMCELL_H_
#in... | true |
f81b62ddfacd11d8fb74428bc38e094b8c16dd9f | C++ | jejewu/nphard_2020_fall | /hw4/socks_server.cpp | UTF-8 | 11,703 | 2.625 | 3 | [] | no_license | #include "socks_server.h"
class SocksConnect : public enable_shared_from_this<SocksConnect>{
private:
shared_ptr<boost::asio::ip::tcp::socket> cli_socket;
boost::asio::ip::tcp::socket ser_socket;
SocksReq req;
array<char, MAXLEN> bytes;
public:
SocksConnect(boost::asio::ip::tcp::socket socket, Sock... | true |
903932875ee6760fc18d85b1e205c6e1e31ea2b4 | C++ | QuantumBob/BlankGL | /src/cWindow.cpp | UTF-8 | 5,169 | 2.515625 | 3 | [] | no_license | #include "cWindow.h"
#include "cApp.h"
//#include <gl/gl.h>
//#include "gl/glext.h"
//#include "gl/wglext.h"
extern LRESULT ImGui_ImplWin32_WndProcHandler(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam);
///////////////////////////////////////////////////////////
cWindow::cWindow() : m_RC(0), m_hwnd(0), m_DC(0), ... | true |
8b863a74d7faf1185b226bba4af6b41385b563bb | C++ | tumtumtum/blaster | /src/Blaster/Url.cpp | UTF-8 | 3,083 | 2.796875 | 3 | [] | no_license | //
// Author: Thong Nguyen
// Copyright (c) 2015 tum@kingstreetapps.com
//
#include "Url.h"
#include <string.h>
#include "http_parser.h"
namespace Blaster
{
Url::Url()
: hashValue(0)
{
}
Url::Url(const string& url)
: Url(url.c_str(), url.length())
{
}
Url::Url(const char* url)
: Url(url, strlen(url))
... | true |
87f049d9ce8999455adb28a0d22a105ab7306809 | C++ | Loks-/competitions | /common/graph/tree/lca/tarjan_offline.h | UTF-8 | 1,187 | 2.640625 | 3 | [
"MIT"
] | permissive | #pragma once
#include "common/data_structures/disjoint_set.h"
#include "common/graph/tree.h"
#include <functional>
#include <utility>
#include <vector>
namespace graph {
namespace lca {
// Tarjan algorithm for offline LCA
// Time: O(g.Size() + q.Size())
template <class TGraph>
inline std::vector<unsigned> TarjanOffl... | true |
54043dc52eab28fb501334d2dff1525bc506754b | C++ | AlexLeoTW/Linux_C_Socket_Example | /client/client.cpp | UTF-8 | 1,432 | 3.046875 | 3 | [
"MIT"
] | permissive | #include <stdio.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include <arpa/inet.h>
#include <unistd.h>
#include <string.h>
class myTCP {
struct sockaddr_in server;
int socketDescriptor = 0;
public:
myTCP(const char* address, int port) {
server.sin_family = PF_INET;
server.sin_addr.s... | true |
bdb79d51618b90fbe47b063f8f827a58d7621295 | C++ | HideakiImamura/MyCompetitiveProgramming | /ARC089/d.cpp | UTF-8 | 1,822 | 2.859375 | 3 | [] | no_license | //
// Created by 今村秀明 on 2018/02/21.
//
#include <stdio.h>
#include <algorithm>
const int max_n = 1e5;
const int max_k = 1000;
int a[3 * max_k][3 * max_k];
int s[2][max_k][max_k];
void print(int n, int m) {
for (int i = 0; i < n; ++i) {
for (int j = 0; j < m; ++j) {
printf("%d ", a[i][j]);
... | true |
cde3265f8bd147faf543ef5c911596af0e6df52d | C++ | ABasitIrfan/Intensive-Programming-Cpp-Basics | /Factorial17.cpp | UTF-8 | 211 | 2.859375 | 3 | [] | no_license | #include<stdio.h>
#include<conio.h>
main()
{
int a,b,num,count=1;
printf("Enter Number: ");
scanf("%d",&num);
for(a=num;a>=1;a--)
{
count=count*a;
}
printf("Factorial Of %d Is %d",num,count);
}
| true |
29f4abc20e31baf75eaf9b1429a5e6b24c24f443 | C++ | JoshBramlett/RDGE | /tests/physics/gjk_test.cpp | UTF-8 | 1,004 | 2.59375 | 3 | [] | no_license | #include <gtest/gtest.h>
#include <rdge/physics/collision.hpp>
#include <rdge/math/vec2.hpp>
#include <rdge/math/intrinsics.hpp>
#include <rdge/physics/shapes/circle.hpp>
#include <rdge/physics/shapes/polygon.hpp>
#include <exception>
namespace {
using namespace rdge;
using namespace rdge::math;
using namespace rdg... | true |
b6b99b3e04e98cf456ec9b20a722b902a9c95f5c | C++ | alvls/mp1-2021-1 | /Krainev_AA/task4/Source.cpp | UTF-8 | 23,469 | 2.859375 | 3 | [] | no_license | #include <iostream>
#include <string>
#include <vector>
#include <iostream>
#include <clocale>
#include <windows.h>
#include <fstream>
#include <sstream>
#include <cctype>
#include <cstring>
#include <locale>
using namespace std;
void printMenu();
void welcomeMessege();
struct Date {
unsigned short int day;
unsi... | true |
069931a537fd0fca35ffcee13afcb73d5098d83b | C++ | yevhenii-sir/C_Cpp | /Study/C/6_Function/Zavdannna_1_1.cpp | UTF-8 | 1,849 | 3.359375 | 3 | [] | no_license | #include <stdio.h>
#include <conio.h>
#include <math.h>
int NSD (int a, int b)
{
while (a != b)
if (a > b) a -= b; else b -= a;
return a;
}
int fmax(int a, int b)
{
return (a > b) ? a:b;
}
float fser(int a, int b)
{
return (a + b) / 2.0;
}
void parn(int a)
{
if (a % 2 == 0) printf("\nЧисло %... | true |
752b210509c192943e5b4aa077c4c22b36c6a100 | C++ | chess1424/Programming_contests | /Code_chef/ WDTBAM.cpp | UTF-8 | 607 | 2.75 | 3 | [] | no_license | #include <iostream>
#include <stdio.h>
#include <string>
using namespace std;
int main(int argc, char const *argv[])
{
int t,n;
cin>>t;
while(t--)
{
cin>>n;
int correct = 0;
string str,str2;
cin>>str;
cin>>str2;
for(int i = 0; i < str.size(); i++)
{
char c = str[i];
cha... | true |
9ca7b35741c800b3edfa292ad0c39dc3bec49eb7 | C++ | adikrasimirowa/FMI-SDP-2021 | /seminar3/main.cpp | UTF-8 | 497 | 2.640625 | 3 | [] | no_license | #include <iostream>
#include "DArray.h"
int main() {
///така не се конструира обект , заделя се само памет / размер в байтове
DArray<int>* array= (DArray<int>*)(operator new(sizeof(DArray<int>)));
new(array) DArray<int>(); /// създаваме обекта в/у дадената памет
DArray<int>* arrPointer = static_cast<DA... | true |
1a85a841ccaf6a42cd32d875a4eb9dee258f75cb | C++ | emarmol/comp11 | /lab10/vector1.h | UTF-8 | 1,038 | 3.40625 | 3 | [] | no_license | // A dynamic array with fixed size
#ifndef VECTOR_H
#define VECTOR_H
class Vector {
public:
Vector(int capacity); // Constructor
// args: capacity of the Vector
~Vector(); // Destructor
int getSize(); ... | true |
9e4eaf6e4d475a56b292b51905af1009f5f68ae2 | C++ | German-Rotili/tpGrupal | /common_src/Snapshot.h | UTF-8 | 658 | 2.59375 | 3 | [] | no_license | #ifndef __SNAPSHOT__
#define __SNAPSHOT__
#include <vector>
#include "Serializer.h"
#include "Action.h"
class World;
struct player_t;
struct intention_t;
struct object_t;
class Snapshot{
private:
std::vector<player_t> players;
std::vector<object_t> objects;
std::vector <Action> actions;
public:
Snap... | true |
aacc897385c9143a9cad8a0ea0624325cb07efaa | C++ | Willson1989/WillsonGO | /LearningCpp/LearningCpp/OOP/Student.cpp | UTF-8 | 582 | 2.796875 | 3 | [] | no_license | //
// Student.cpp
// StudyCpp
//
// Created by fn-273 on 2020/10/9.
// Copyright © 2020 ZhengYi. All rights reserved.
//
#include "Student.hpp"
#include <sstream>
void Student::set_score(int s)
{
score = s;
}
int Student::get_score()
{
return score;
}
void Student::set_address(string addr)
{
address... | true |
0df113a4df527f907cd39319cc59e4b171dd7e38 | C++ | HRex39/SensorCalibration | /imu-lidar/include/sensor_calibration/ErrorTerm.h | UTF-8 | 1,305 | 2.625 | 3 | [] | no_license | #ifndef _ERROR_TERM_H_
#define _ERROR_TERM_H
#include <pcl/point_types.h>
#include <ceres/ceres.h>
#include <ceres/rotation.h>
namespace SensorCalibration
{
class ErrorTerm
{
public:
ErrorTerm(const pcl::PointXYZI &pt1, const pcl::PointXYZI &pt2)
:mPoint1(pt1.x, pt1.y, pt1.z), mPoint2(pt2.x, pt2.y, pt2.z... | true |
900bf146bebf938843435e972c080a666da1e58e | C++ | SayaUrobuchi/uvachan | /USACO/詳解/cpp/camelot.cpp | UTF-8 | 3,424 | 2.609375 | 3 | [] | no_license | /*
ID: dd.ener1
PROG: camelot
LANG: C++
*/
#include <cstdio>
#include <cstring>
using namespace std;
const long maxP=26*40+20;
const long maxR=26,maxC=40;
long R,C;//R<=40, C<=26
long kingx,kingy;
long knightx[maxP];
long knighty[maxP];
long k_num;
unsigned long g[maxR][maxC][maxR][maxC];
bool inque[maxR][maxC];
long ... | true |
7fa3eae4529b7c136c4d7de83542149a4dafefb8 | C++ | macnaer/OOP-CPP | /13. Functor/13. Functor/Source.cpp | UTF-8 | 353 | 3.40625 | 3 | [] | no_license | #include <iostream>
#include <string>
using namespace std;
class Functor {
public:
int operator()(int a, int b) {
return a + b;
}
int operator= (int a) {
return a;
}
};
int main() {
int a = 5, b = 10;
Functor foo;
int result = foo(a, b);
foo = (5);
cout << a << " + " << b << " = " << result << endl;... | true |
c2d775537db3dd2ea88a78b1258ed0b11b853a8c | C++ | MichalSara99/differential_equation_solvers | /differential_equation_solvers/euler_method_t.h | UTF-8 | 16,305 | 3.34375 | 3 | [] | no_license | #pragma once
#if !defined(_EULER_METHOD_T_H_)
#define _EULER_METHOD_T_H_
#include<iostream>
#include"euler_method.h"
using namespace euler_method;
void simple_ode_first_order() {
std::cout << "Euler Method: \n";
// numerical solution of
// first-order differential equation
//
// x'(t) = 2.0*x(t)*(1.0 - x(t)),... | true |
cc35124356431131e7f96a21ba46960d14c170d7 | C++ | DeepLearnPhysics/larcv2 | /larcv/app/ImageMod/arxiv/ImageFromPixel2DCluster.h | UTF-8 | 1,731 | 2.71875 | 3 | [
"MIT"
] | permissive | /**
* \file ImageFromPixel2DCluster.h
*
* \ingroup Package_Name
*
* \brief Class def header for a class ImageFromPixel2DCluster
*
* @author kazuhiro
*/
/** \addtogroup Package_Name
@{*/
#ifndef __IMAGEFROMPIXEL2D_H__
#define __IMAGEFROMPIXEL2D_H__
#include "Processor/ProcessBase.h"
#include "Processor/P... | true |
9a9c542780efbbb5e096f2cdb22192b0b2253d3a | C++ | hMarcorivas/MARCO-RIVAS-PARALELA | /laboratorio9/factorial1/src/factorial1.cpp | UTF-8 | 503 | 2.703125 | 3 | [] | no_license | #include <stdio.h>
#include<pthread.h>
#include <stdlib.h>
//using namespace std;
int num;
void* factorial()
{
int fac=1;
for(int a=1;a<=num;a++)
{
fac=fac*a;
//cout<<"Factorial of Given Number is ="<<fac;
printf("Hello from thread is %d\n", fac);
}
}
int main(){
pthread_t* t;
printf("El factorial del numero: ")... | true |
98f85cdfb3f6b4afe5659c1727a06c1752c4b461 | C++ | GustavoSilveira/arduino-projects | /pwm-interrupts/pwm-interrupts.ino | UTF-8 | 3,440 | 2.78125 | 3 | [] | no_license | // Exercício: Prova de Suficiência 2020/2
// Aluno: Gustavo de Souza Silveira - 23/10/2020
// Prof. Sergio Moribe - UTFPR-CT
#include <LiquidCrystal.h>
//Define os pinos do Display LCD no Arduino
const int rs = 8, en = 9, d4 = 10, d5 = 11, d6 = 12, d7 = 13;
//Instancia objeto lcd
LiquidCrystal lcd(rs, en, d4, d5, d6... | true |
d8e7880307c5fb4ab6d88a57956df5ac184fe5cc | C++ | veldrinlab/veldrinlabProjects | /SakuraEngine/SakuraEngine/Game/Game.hpp | WINDOWS-1250 | 710 | 3.046875 | 3 | [] | no_license | /**
* File contains declaration of main game class - Game.
* @file Game.hpp
* @author Szymon "Veldrin" Jaboski & Adam Sznajder
* @date 2010-11-09
* @version 1.0
*/
#ifndef GAME_HPP
#define GAME_HPP
#include "../Engine/Engine.hpp"
#include "../Engine/Configuration.hpp"
#include "GameState.hpp"
namespace ... | true |
2ec3aafb8b27ee5e6e5bb354deb53503c8740b6a | C++ | asntr/DAS | /CPP/12-spin-lock/spin_lock.h | UTF-8 | 323 | 3.28125 | 3 | [] | no_license | #pragma once
#include <atomic>
#include <thread>
class SpinLock {
public:
void lock() {
while (lock_.test_and_set(std::memory_order_acquire)) std::this_thread::yield();
}
void unlock() {
lock_.clear(std::memory_order_release);
}
private:
std::atomic_flag lock_ = ATOMIC_FLAG_INIT;
... | true |
14d3b8e3e7a60fe9a84cc42de8e85d6909ab785e | C++ | 12Dong/acm | /hdu/1181.cpp | UTF-8 | 703 | 2.671875 | 3 | [] | no_license | #include<iostream>
#include<string>
#include<cstring>
using namespace std;
int map[26][26];
int vis[26];
int flag;
void dfs(int x,int y)
{
if(vis[x]) return ;
vis[x]=1;
if(x==y)
{
flag=1;
return ;
}
for(int i=0;i<26;i++)
{
if(map[x][i]==1)
{
dfs(i,y);
}
}
}
int main()
{
string str;
flag=0;
... | true |
c1d0fef8582cdd9b6a0b14aa1891d1b6a21cf445 | C++ | sameerad2001/myGeekForGeeksPracticeQuestions | /Tree/Easy/Level of a Node in Binary Tree/main.cpp | UTF-8 | 636 | 3.40625 | 3 | [] | no_license | #include <iostream>
using namespace std;
struct Node
{
int data;
struct Node *left;
struct Node *right;
};
void get_level_utl(Node *node, int target, int &target_level, int curr_level)
{
if (node == NULL)
return;
if (node->data == target)
{
target_level = curr_level;
... | true |
8c2833977e7c8e85ea18665f8766b71dea8782f5 | C++ | geoo993/LearningCpp | /BeginnersTutorials/workspace/Classes/src/Countries.h | UTF-8 | 898 | 2.75 | 3 | [] | no_license | /*
* Countries.h
*
* Created on: Sep 6, 2016
* Author: GeorgeQuentin
*/
#ifndef COUNTRIES_H_
#define COUNTRIES_H_
#include <string>
class Country {
private:
std::string countryName;
std::string capital;
long int population;
std::string nationalLanguage;
std::string currency;
public:
... | true |
40873a730c6693958bd7cb1bce7e17e7a978eea9 | C++ | falgon/mikoCppLibraries | /miko/casting.hpp | UTF-8 | 1,393 | 2.609375 | 3 | [] | no_license | namespace miko{
template<class from>
class Static_Cast{
from var;
public:
Static_Cast(from f):var(f){}
template<class T>
operator T()const
{
return static_cast<T>(var);
}
};
template<class from>
Static_Cast<from> st_cast(from v)
{
return Static_Cast<from>(v);
}
template<class from>
class Dynamic_Cast{
from v... | true |
7b4360c0f2fcda5a2ca15a3205e5d6b490eda85d | C++ | YoshiroAraya/Yoshidagakuen_ArayaYoshiro | /吉田学園情報ビジネス専門学校 荒谷由朗/04_OverKillSoulHell/00_制作環境/bullet.cpp | SHIFT_JIS | 13,872 | 2.625 | 3 | [] | no_license | //=============================================================================
//
// obg [bullet.cpp]
// Author : rJ RN
//
//=============================================================================
#include "bullet.h"
#include "input.h"
#include "manager.h"
#include "scene2D.h"
#include "renderer.h"
#include "exp... | true |
d82d026e1d8db10b42b1f3a6a922577c99530942 | C++ | imanoid/drobot | /new/src/drobot/util/exception.h | UTF-8 | 1,013 | 3.234375 | 3 | [] | no_license | #ifndef DROBOT_UTIL_EXCEPTION_H
#define DROBOT_UTIL_EXCEPTION_H
#include <string>
#include <sstream>
namespace drobot {
namespace util {
/**
* @brief The Exception class is the base class for all exceptions.
*/
class Exception
{
private:
std::string _message;
public:
Exception(std::string message);
Exc... | true |
f74b1fe7b029203b09cadac3e171f0196a456c2f | C++ | vuongjn/PE4 | /TicTacToe.cpp | UTF-8 | 1,314 | 3.84375 | 4 | [] | no_license | #include <iostream>
#include <string>
class TicTacToe
{
private:
int turnCount_ = 0;
std::string board_[3][3];
public:
void CreateBoard(){
for(int i = 0; i < 3; i++){
for(int j = 0; j < 3; j++){
board_[i][j] = "_";
}
}
}
void Display... | true |
97a7ea2bd5a775649f35ef8ab2f6ffd6e31fa3bd | C++ | hapo31/My-MikanOS | /kernel/font.cpp | UTF-8 | 1,283 | 2.765625 | 3 | [
"Apache-2.0"
] | permissive | #include "font.hpp"
extern const uint8_t _binary_hankaku_bin_start;
extern const uint8_t _binary_hankaku_bin_end;
extern const uint8_t _binary_hankaku_bin_size;
void WriteAscii(PixelWriter &writer, int x, int y, const PixelColor &color,
char c) {
const uint8_t *font = GetFont(c);
if (font == null... | true |
8be4e6ed2a25110371e92097199b51738e4c1a69 | C++ | RecetteLemon/SymphonyOfNight | /woojin/Hynjun(DataBase+CharaScene) - 복사본/player.h | UHC | 2,871 | 2.625 | 3 | [] | no_license | #pragma once
#include "gameNode.h"
#include "pixelCollision.h"
#include "familiarManager.h"
#define MOVESPEED 3.0f
#define JUMPFORCE 6.0f
#define GRAVITYPOWER 0.5f
enum KEYINPUT
{
INPUT_LEFT,
INPUT_LEFT_DOWN,
INPUT_DOWN,
INPUT_RIGHT_DOWN,
INPUT_RIGHT,
INPUT_LEFT_UP,
INPUT_UP,
INPUT_RIGHT_UP,
INPUT_Z,
INPUT_... | true |
3202969307817243cc950a60913abc841524bc41 | C++ | creator83/stm8s003 | /cpp/prj/use_gpio.cpp | UTF-8 | 676 | 2.625 | 3 | [] | no_license | #include "stm8s.h"
#include "pin.h"
#include "delay.h"
Pin triac1 (Gpio::A, 3, Gpio::lowSpeed);
Pin triac2 (Gpio::D, 3, Gpio::lowSpeed);
Pin triac3 (Gpio::D, 4, Gpio::lowSpeed);
Pin triac4 (Gpio::D, 5, Gpio::lowSpeed);
Pin triac5 (Gpio::D, 6, Gpio::lowSpeed);
union rgb24
{
uint32_t color;
struct colors
... | true |