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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
7f7fc2e4dd948fa2bfb624f157510caefc1955fd | C++ | GAYATRI-gajula25/pps-lab | /pps lab/New folder/c++16.cpp | UTF-8 | 418 | 3.671875 | 4 | [] | no_license | #include <stdio.h>
int main()
{
int num, msb;
/* Input number from user */
printf("Enter any number: ");
scanf("%d", &num);
/* Move first bit of 1 to highest order */
msb = 1 << (BITS - 1);
/* Perform bitwise AND with msb and num */
if(num & msb)
printf("MSB of %d is... | true |
223ec6e9cbf9b561595a4c5080d39d5defcb5243 | C++ | NVZGUL/nbody | /Nbody_sim/main.cpp | UTF-8 | 1,430 | 2.703125 | 3 | [] | no_license | #include <iostream>
#include <ctime>
#include <math.h>
#include "general.h"
#include "Task.h"
#include "Simple.h"
#include "Nbody_thread.h"
#include "Nbody_openMP.h"
using namespace std;
float3 getPoint(float r)
{
const float
phi = rand(PI_M2),
sintheta = rand(-1.f, 1.f),
costheta = std::sqrt(1.f - sintheta*s... | true |
0312f593e339a4c533e7a50b4142eb727dd406e6 | C++ | win18216001/tpgame | /GServerEngine/NetLibrary/AcceptManager.h | GB18030 | 584 | 2.71875 | 3 | [] | no_license | /*
* File : AcceptManager.h
* Brief : Accept,ûAccept
OO˼,ϣ
* Author: Expter
* Creat Date: [2009/11/11]
*/
#pragma once
#include "Accept.h"
class CAcceptManager
{
CAccept Accept;
public:
CAcceptManager(void) {};
~CAcceptManager(void){};
/*
* ˿
*/
void CreateAcce... | true |
dedd7d352ba5b1aae5715f9537953c7ad3d3b7b3 | C++ | dsbabkov/procedural_cpp | /lab5/other.h | UTF-8 | 949 | 3.09375 | 3 | [] | no_license | #include <iostream>
//Прототипы используемых в данном задании функций:
template <typename T>
void printArray(const T *arr, int n)
{
for (int i = 0; i < n; ++i) {
std::cout << arr[i] << '\t';
}
std::cout << '\n';
}
void Sort(char* pcFirst, int nNumber, int size,
void (*Swap)(void*, void*), int (*Co... | true |
27056456c3ef44e08ee4f23c992949fa55d6bf93 | C++ | hcmarchezi/manipulator-robot-api | /domain/PartialRobotTrajectory.cpp | UTF-8 | 1,918 | 2.765625 | 3 | [
"MIT"
] | permissive | #include "PartialRobotTrajectory.h"
PDC::PartialRobotTrajectory::PartialRobotTrajectory()
{
}
void PDC::PartialRobotTrajectory::Calculate(PDC::RobotPosition initialRobotPosition,PDC::RobotPosition finalRobotPosition)
{
// Should not accept two robot positions with different link position array sizes
if (initi... | true |
0be84512eaa07f265f7213b704a2655087b148c0 | C++ | RakibulRanak/Solved-ACM-problems | /Codeforces/Dreamoon and Stairs CF 476A.cpp | UTF-8 | 560 | 2.5625 | 3 | [] | no_license | #include<bits/stdc++.h>
using namespace std;
int main()
{
double n,m;
cin>>n>>m;
if(m>n)
cout<<-1<<endl;
else
{
int minstep=ceil(n/2);
if(minstep%(int)m!=0)
{
while(minstep<=n)
{
minstep++;
if(minstep%(int)m==0)... | true |
6618fb38ed466d8317787cc98ef6f9c395cae430 | C++ | S-ngularity/ProjetoIntegrado-POO-ISI-ED1_2014-1_Cinema | /Cinema.cpp | UTF-8 | 16,343 | 3.125 | 3 | [] | no_license | #include "Cinema.h"
using namespace std;
Cinema::Cinema(){
telaInicial();
}
Cinema::~Cinema(){}
void Cinema::telaInicial(){
int opcao;
do{
clearScreen();
cout << endl;
cout << "1. Gerenciar salas" << endl << endl;
cout << "2. Gerenciar sessões" << endl << endl;
cout << "3. Venda" << endl << endl;
cout... | true |
756161ecccdc5024013fcbd9fd0139a684808782 | C++ | systelab/cpp-gtest-allure-utilities | /src/GTestAllureUtilities/Model/TestCase.h | UTF-8 | 1,085 | 2.609375 | 3 | [
"MIT"
] | permissive | #pragma once
#include "Stage.h"
#include "Status.h"
#include "Step.h"
#include <memory>
#include <string>
#include <vector>
namespace systelab { namespace gtest_allure { namespace model {
class TestCase
{
public:
TestCase();
TestCase(const TestCase&);
virtual ~TestCase() = default;
std::string getName(... | true |
e12c205bd12193f0b3e12549735fe89dee85f26f | C++ | GabrielRavier/randomAsm | /c++/xmmintrin.cpp | UTF-8 | 7,135 | 2.515625 | 3 | [] | no_license | #include <stdint.h>
/* The Intel API is flexible enough that we must allow aliasing with other
vector types, and their scalar components. */
typedef float __m128 __attribute__ ((__vector_size__ (16), __may_alias__));
/* Unaligned version of the same type. */
typedef float __m128_u __attribute__ ((__vector_size__... | true |
913029dab12b70e7c9d4af66ebda896ce49fadb7 | C++ | lmidang/CIS22B_Project | /CIS22B_Project/Book.cpp | UTF-8 | 2,753 | 3.328125 | 3 | [] | no_license | #define _CRT_SECURE_NO_WARNINGS
#include <iostream>
#include <string>
#include "Book.h"
/*
default constructor that initializes the member variables with 0 or " ".
the date member variable is initialized as 0000/00/00 (YYYY-MM-DD)
*/
Book::Book() {
mISBN = "00000000";
mTitle = " ";
mAuthor =... | true |
9b26495ca26df3cd8d5095d1ad1342ac6efd45d7 | C++ | sega-dreamcast/renesas-sh-instruction-set | /s-exprpp.cpp | UTF-8 | 6,299 | 2.5625 | 3 | [
"MIT"
] | permissive | /*
s-exprpp - a simple preprocessor to convert s-expressions into C/C++.
Copyright (C) 2013-2015 Oleg Endo
This is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 3, or (at your option)
any later ve... | true |
ab056832f25375d35dbe48b853efac8484acbaa4 | C++ | AABNassim/DPPML-Worker-Source | /PPML/MLSP.cpp | UTF-8 | 800 | 2.875 | 3 | [] | no_license | //
// Created by root on 30/06/19.
//
#include "MLSP.h"
MLSP::MLSP() {
if ((sock = socket(AF_INET, SOCK_STREAM, 0)) < 0)
{
printf("\n Socket creation error \n");
return;
}
serv_addr.sin_family = AF_INET;
serv_addr.sin_port = htons(port);
// Convert IPv4 and IPv6 addresses fr... | true |
62f9dee22b618325394102a6f8be49b1cbc032cb | C++ | zhonghe987/cproject | /src/oss_client/op_client.h | UTF-8 | 1,134 | 2.625 | 3 | [] | no_license | #ifndef OP_CLIENT_H
#define OP_CLIENT_H
#include<iostream>
#include<string>
#include<curl/curl.h>
enum HttpOp {OP_GET,OP_PUT,OP_DEL,OP_POST};
class Client
{
public:
Client(std::string url_base):http_base(url_base){}
virtual ~Client(){}
virtual int op_url(HttpOp method,char *key,char *out,char *data=NULL... | true |
2df38fc2d238c7c247bd0a7b2c906c7388d40612 | C++ | Minhan93/Financial-Computing-With-C- | /HW10/HW10_1/HW10_1/Tree_TIAN.h | UTF-8 | 4,878 | 2.8125 | 3 | [] | no_license | #pragma once
#include "Tree_CRR.h"
class BinomialTree_TIAN
{
private:
double spot;
double strike;
double sigma;
double r;
double T;
int N; //steps
double delta_t;
double u; //up factor
double d; //down factor
double pu; ... | true |
dc2f9c93740d85e615b2c6b636c27a56c54f6dfb | C++ | wanghongsheng01/thread | /thread.cpp | UTF-8 | 1,232 | 3.6875 | 4 | [] | no_license | /*
* [C++ thread]
* @Author wanghongsheng01
* @DateTime 2021-07-07T22:02:30+0800
*/
#include<iostream>
#include<thread>
using namespace std;
void func1(){
cout<<"do some work"<<endl;
}
void func2(int i, double d, string s){
cout<<"i="<<i<<"; d="<<d<<"; s="<<s<<endl;
}
int main(){
/**
* 创建线程
*/... | true |
45d6ce2002993fcee608e3c7c968d301dbfc4470 | C++ | SimonKocurek/Algorithms-and-Fun | /c++/stack-sorter.cpp | UTF-8 | 1,264 | 3.71875 | 4 | [] | no_license | #include <bits/stdc++.h>
using namespace std;
// Sorting based on 1 or 2 stack and no other data structures
template<class T>
void sort_stack(stack<T> &sorted) {
stack<T> secondary;
while (!sorted.empty()) {
auto inserted = sorted.top();
sorted.pop();
while (!secondary.empty() && sec... | true |
6fcd9f5d3fb1a7ad553783e3de70601f5f7ef8e1 | C++ | rishindramani/Competitive-Coding | /approach_techn/dp/subset_sum.cpp | UTF-8 | 666 | 2.625 | 3 | [] | no_license | //
// Created by Rishi on 14-Oct-19.
//
#include<bits/stdc++.h>
#define ll long long
using namespace std;
vector<ll> v;
void sub(ll arr[],ll a,ll b,ll sum)
{
if(a>b)
{
v.push_back(sum);
return;
}
sub(arr,a+1,b,sum);
sub(arr,a+1,b,sum+arr[a]);
}
int main()
{
ll t;
cin>>t;
... | true |
ea4b8495a7a92fa6e24fd883cf2b401515647241 | C++ | drlongle/leetcode | /algorithms/problem_1366/solution.cpp | UTF-8 | 4,476 | 3.046875 | 3 | [] | no_license | /*
1366. Rank Teams by Votes
Medium
In a special ranking system, each voter gives a rank from highest to lowest to all teams participated in the competition.
The ordering of teams is decided by who received the most position-one votes. If two or more teams tie in the first position, we consider the second position to... | true |
fab6fe28bd5dbbd357cb61bb31109c978649420e | C++ | fairy-tale/leetcode | /84.cpp | UTF-8 | 912 | 3.453125 | 3 | [] | no_license | //since need to record the heights before, use stack.
//two pointer can't be used in this case, since need know all the information between two pointers.
//push_back a '0' at the end of array, which could pop all the heights in array, no missing.
class Solution {
public:
int largestRectangleArea(vector<int>& heights) ... | true |
3203b34ae6af77fa00fb1141646ea388ebeb76b8 | C++ | lucasilvas2/projeto-petfera | /include/profissional.hpp | UTF-8 | 897 | 3.1875 | 3 | [
"MIT"
] | permissive | #pragma once
#include <iomanip>
#include <iostream>
#include <memory>
using std::string;
using std::cout;
using std::endl;
using std::ostream;
enum tpProf{
veterinario,
tratador
};
class Profissional{
protected:
tpProf tipoProfissional;
string nome;
string contato;
string ... | true |
c9821ca8c08dbefdc5291fe441c052bd0c349b0b | C++ | plalit/GeeksForGeeks | /max_product_triplet_ARRAY.cpp | UTF-8 | 853 | 3.328125 | 3 | [] | no_license | #include<iostream>
#include<stdio.h>
#include<stdlib.h>
using namespace std;
int main()
{
int n;
cin>>n;
int arr[n];
for(int i=0;i<n;i++)
cin>>arr[i];
int first = -100000, second = -100000, third = -100000, negfirst = 100000, negsecond = 100000;
for(int i=0;i<n;i++)
{
if(arr[i] > third)
{
int temp ... | true |
4e846c554e7871c0cf09e9da363f4d98027d0e09 | C++ | sb565/Algorithms_Implementation | /Codes/Heapsort.cpp | UTF-8 | 770 | 3.40625 | 3 | [] | no_license | #include<iostream>
#include<vector>
using namespace std;
void heapify(int a[],int &n,int r)
{
int large=r,left=(2*r),right=(2*r+1);
if(left<=n)
if(a[large]<a[left])
large=left;
if(right<=n)
if(a[large]<a[right])
large=right;
if(r!=large){
swap(a[large],a[r]);
heapify(a,n,large);
}
}
void createhea... | true |
9dfde467ec7bf9557ffbc5c9b1d15b4429ce022e | C++ | nbirkbeck/ennes | /src/highres_boundary_test.cc | UTF-8 | 1,832 | 2.71875 | 3 | [] | no_license | #include "gtest/gtest.h"
#include "highres_boundary.h"
TEST(HighresBoundaryTest, MaskUpsample2) {
nacb::Image8 input(4, 4, 1);
input = 0;
input(1, 1) = 255;
input(1, 2) = 255;
input(2, 1) = 255;
input(2, 2) = 255;
nacb::Imagef result = HighresBoundarySimple(input, 2);
ASSERT_EQ(8, result.w);
ASSERT... | true |
217fe8899f74e11d13cc39d74dd8bff2da0bd485 | C++ | lintianfang/cleaning_cobotics | /cgv/utils/statistics.h | UTF-8 | 1,485 | 2.703125 | 3 | [] | no_license | #pragma once
#include <iostream>
#include <cmath>
#include "lib_begin.h"
namespace cgv {
namespace utils {
/** incrementally accumulate statistical information */
class CGV_API statistics
{
public:
/// initialize with no value considered yet
statistics();
/// initialize and consider one value
statistics(const ... | true |
42a923df49fcace07d0361d9e9efd338bc66dddb | C++ | mphe/GameLib | /include/gamelib/utils/Factory.hpp | UTF-8 | 1,629 | 3.09375 | 3 | [
"MIT"
] | permissive | #ifndef GAMELIB_FACTORY_HPP
#define GAMELIB_FACTORY_HPP
#include <cassert>
#include <memory>
#include <unordered_map>
namespace gamelib
{
template <typename Base, typename Key, typename... Args>
class Factory
{
public:
typedef std::unique_ptr<Base> BasePtr;
public:
... | true |
7311731631aea5fae772ed0fee0318f399cd5c4c | C++ | hyller/GladiatorLibrary | /Ivor_Horton_Beginning_Visual_C++_2010/Ch09/Ex9_08/Ex9_08.cpp | UTF-8 | 726 | 3.671875 | 4 | [
"Unlicense"
] | permissive | // Ex9_08.cpp
// Using a base class pointer to call a virtual function
#include <iostream>
#include "GlassBox.h" // For CBox and CGlassBox
using std::cout;
using std::endl;
int main()
{
CBox myBox(2.0, 3.0, 4.0); // Declare a base box
CGlassBox myGlassBox(2.0, 3.0, 4.0); // D... | true |
68e95eeded99bfcf19b00ebdcf0365ef73c7e976 | C++ | chokomancarr/chokoengine2 | /include/ce2/scene/transform.hpp | UTF-8 | 1,582 | 2.5625 | 3 | [
"Apache-2.0"
] | permissive | #pragma once
#include "chokoengine.hpp"
#include "enums/transform_space.hpp"
CE_BEGIN_NAMESPACE
/* The Transform class contains the transformation
* data and methods of a SceneObject.
* A Transform object cannot be created directly.
* Use `SceneObject::New()->transform()` instead
*/
class Transform { CE_CLASS_COM... | true |
658186741818590527e5199fcc9be3a214f36fd1 | C++ | andrijanamikovic/oop1 | /red/Project1/red.cpp | UTF-8 | 822 | 3.359375 | 3 | [] | no_license | #include "red.h"
#include <iostream>
#include <cstdlib>
using namespace std;
Red::Red(int k)
{
arr = new int[k];
cap = k;
first = last = 0;
}
Red::Red(const Red& rd) {
arr = new int[rd.cap];
for (int i = 0; i < rd.cap; i++) {
arr[i] = rd.arr[i];
}
cap = rd.cap;
last = rd.last;
l = rd.l;
first = rd.first;
... | true |
60354ae49f8b23d325c47a652c4174187f6872be | C++ | rodstrom/yomibubble | /Game/codebase/AI/TottAIStates.h | UTF-8 | 657 | 2.625 | 3 | [] | no_license | #ifndef _TOTT_AI_STATES_H_
#define _TOTT_AI_STATES_H_
#include "AIPrereq.h"
class TottAIStateMove : public AIState{
public:
TottAIStateMove(const TottMoveAIDef& def);
virtual ~TottAIStateMove(void){}
void Enter();
void Exit();
bool Update(float dt);
protected:
Ogre::String m_animation;
Ogre::Vector3 m_current_... | true |
c3460c59df662732c4c8e0e636bc17f72e2cc7cb | C++ | d4daveshep/arduino | /TestMaths/TestMaths.ino | UTF-8 | 1,820 | 3.109375 | 3 | [] | no_license |
const float EarthRadius = 6371000.0; // radius of earth in m
// coords of start pin
const float pinlat = -36.8317;
const float pinlon = 174.7485;
// coords of start committee hut
const float commlat = -36.8355;
const float commlon = 174.7470;
void setup() {
// put your setup code here, to run once:
Serial.begi... | true |
29c1d91d7e61fee7fb79639a902fe6fbcd415ae1 | C++ | pawarashish10/Coding-Challange-I | /object_oriented_design/main.cpp | UTF-8 | 789 | 2.8125 | 3 | [] | no_license | #include <string>
#include <vector>
#include <iostream>
#include "Kennel.h"
#include "Kennel.cpp"
using namespace std;
int main()
{
Kennel kennel;
kennel.AddCat("Garfield");
kennel.AddDog("Odie");
kennel.AddDog("Pluto");
kennel.AddCat("Felix");
kennel.AddCat("Sylvester");
kennel.AddCat("Sc... | true |
ff815661f89b8ad848b1366ffc47254ebc989110 | C++ | appinho/SAGoogleCodeEventTemplate | /CompleteSearch/pylons_PAR.cpp | UTF-8 | 2,240 | 3.34375 | 3 | [] | no_license | // CJ19/1A
// HARD
// Backtracing/Random
#include <iostream>
#include <vector>
#include <utility>
using namespace std;
static int R, C;
bool dfs(int x, int y, vector<vector<bool> > & visited, vector<pair<int,int> > & path){
//cerr << path.size() << " " << x << " " << y << endl;
if(path.size() == R*C... | true |
ab19c96791df8d0a811b57efef2553559a2502df | C++ | TobbyT/example | /example_algo/dongtaiguihua/740.cpp | UTF-8 | 317 | 2.578125 | 3 | [] | no_license | #include "general.h"
int main()
{
int amount = 8;
vector<int> coins = {2, 3, 8};
vector<int> res(amount + 1, 0);
res[0] = 1;
for(int i = 0; i < coins.size(); ++i){
for(int j = coins[i]; j <= amount; ++j){
res[j] += res[j - coins[i]];
}
}
PrintVector(res);
}
| true |
0ee850853f4bcc1ab4d87d2bb60804a538e0289c | C++ | ralucado/SFMLGameTemplate | /MyGame.hpp | UTF-8 | 679 | 2.625 | 3 | [] | no_license | #ifndef MYGAME_H
#define MYGAME_H
#include "Game.hpp"
class MyGame : public Game {
public:
MyGame(int scrwidth, int scrheight, std::string title, int style);
~MyGame();
void update(float deltaTime);
void draw();
void processEvents();
private:
//The components of the game
sf::RectangleShape ... | true |
a80491e864c6c73c59378c983f37a9fa1c9ae9ee | C++ | KieranWebber/ROS-Instinct | /ros_instinct_actions/include/ros_instinct_actions/instinct_action_service.h | UTF-8 | 2,095 | 2.578125 | 3 | [
"MIT"
] | permissive | #pragma once
#include <ros/ros.h>
#include <actionlib/server/simple_action_server.h>
#include <instinct_msgs/InstinctAction.h>
/**
* Extendable interface providing ROS-Instinct actions using a actionlib server.
*
* Actions are implemented by extending executeAction.
* Service calls to executeActions are performed ... | true |
8fa2e7e8be78d51ffcd8e18d8919f442e26d4671 | C++ | nitish166/HackerEarth | /Recursion/lastIndex.cpp | UTF-8 | 405 | 3.015625 | 3 | [] | no_license | #include<bits/stdc++.h>
using namespace std;
int lastIndex(int* arr, int n, int x)
{
int l=0;
int r=n-1;
if(l>r)
return -1;
int ans = lastIndex(arr+1, n-1, x);
if(ans !=-1)
return ans+1;
if(arr[0]==x)
return 0;
return -1;
}
int main()
{
int n,x;
cin>>n>>x;
int* arr = new int[n];
for(int i=0;i<n;i++)... | true |
1f3c90ca410236bca29e5f371547d4aadf915ab0 | C++ | wjk20120522/leetcode | /cplusplus_version/Sqrt(x).cpp | UTF-8 | 388 | 2.84375 | 3 | [] | no_license | class Solution {
public:
int sqrt(int x) {
int64_t begin = 0, end = 50000;
int64_t mid = (begin + end) / 2;
while (true) {
int64_t sqr = mid*mid;
if (sqr < x) {
if ((mid + 1)*(mid + 1) > x) return mid;
begin = mid + 1;
}
else if (sqr > x) {
end = mid - 1;
}
else... | true |
0bccefbcb4fde0b209060290d2193f6845e32f76 | C++ | LecomteEmerick/MathProjet | /CyrusBeck/CyrusBeck/Source.cpp | ISO-8859-1 | 2,606 | 2.71875 | 3 | [] | no_license | #include<windows.h>
#include<GL/glut.h>
#include<stdlib.h>
#include <ctime>
#include<stdio.h>
#include<cfloat>
#include "Point.h"
#include<gl\GL.h>
void afficherPoint()
{
glBegin(GL_POLYGON);
glColor3f(1.0, 1.0, 1.0);
glVertex2f(0, 0);
glVertex2f(0, 1);
glVertex2f(1, 1);
glVertex2f(1, 0);
glColor3f(0.95f, 0.20... | true |
70fb59cd12ef9531636c660859ae31de284eb13d | C++ | PandoraLS/C-Programming | /Ch09/Chrono.cpp | GB18030 | 6,494 | 3.234375 | 3 | [
"MIT"
] | permissive | /*
* @Author: seenli
* @Date: 2020-09-28 14:30:55
* @LastEditors: seenli
* @LastEditTime: 2021-01-06 18:47:14
* @FilePath: \Ch09\Chrono.cpp
* @Description: Programming Principles and Practice Using C++ Second Edition
*/
#include "Chrono.h"
namespace Chrono {
Date::Date(int y, Month m, int d)
: m_year{y}, m_... | true |
b269c03901559b215cc7e19b6622dad3ad9c4852 | C++ | csu-xiao-an/SolutionCode | /01 Count number of binary strings without consecutive 1/01 Count number of binary strings without consecutive 1.cpp | UTF-8 | 645 | 3.171875 | 3 | [] | no_license | // 01 Count number of binary strings without consecutive 1.cpp : 此文件包含 "main" 函数。程序执行将在此处开始并结束。
//
#include <iostream>
using namespace std;
int num = 0;
int dfs(int deep, int bit, int lastbit, int n)
{
if (lastbit == 1 && bit == 1)
{
return 0;
}
if (deep == n)
{
num++;
return 0;
}
dfs(deep + 1, 0, bit, ... | true |
859bf3bcee0ddf7143e2fe9a40bf4113394eb780 | C++ | 1whatleytay/ares | /src/text.cpp | UTF-8 | 1,370 | 3.015625 | 3 | [] | no_license | #include <ares/text.h>
namespace ares {
// bool BuilderText::stoppable(char value) {
// return std::isspace(value) || (std::find(hard.begin(), hard.end(), value) != hard.end());
// }
size_t BuilderText::get() {
return index;
}
void BuilderText::set(size_t value) {
index = val... | true |
41cdcd2641b150f9b7d76b5151db1f957ec32f8e | C++ | lys8325/boj_study | /04948/main.cpp | UTF-8 | 794 | 2.953125 | 3 | [] | no_license | #include <iostream>
#include <vector>
using namespace std;
int main() {
int n, maxNum = 0, cnt = 0;
bool isPrime[250000];
vector<int> v;
while(1){
cin>>n;
if(n == 0){
break;
}else{
if(maxNum < n){
maxNum = n;
}
v.pu... | true |
c2f8c83258d696ef4b665aa403dd156450be6e69 | C++ | juanmard/juegocpp | /Clases/ActorGraphic.cpp | UTF-8 | 2,073 | 2.921875 | 3 | [] | no_license | ///
/// @file ActorGraphic.cpp
/// @brief Fichero de implementación de la clase "ActorGraphic".
/// @author Juan Manuel Rico
/// @date Octubre 2015
/// @version 1.0.0
///
#include "ActorGraphic.h"
#include "Actor.h"
ActorGraphic::ActorGraphic ():
owner(NULL),
graph_free (true)
{
};
ActorGraphic::Act... | true |
14b07e31d1a6c5f79d6ae8a5b49355f1e35265c3 | C++ | kuningfellow/Kuburan-CP | /yellowfellow-ac/UVA/12531/12093827_AC_0ms_0kB.cpp | UTF-8 | 407 | 2.71875 | 3 | [] | no_license | //UVA 12531 Hours and Minutes
#include <stdio.h>
#include <vector>
using namespace std;
int lis[361];
int main()
{
int d;
for (int i=0;i<12;i++)
{
for (int j=0;j<60;j++)
{
d=((i*30+j/12*6)-j*6+360)%360;
lis[min(d,(360-d))]=1;
}
}
while (scanf("%d",&d)!... | true |
cdc0333d4aa59e61303b98b5a12028cc815ed568 | C++ | assuntad23/COMP302 | /WordCounts/IOFile.cpp | UTF-8 | 1,406 | 3.359375 | 3 | [] | no_license | /*
* IOFile.cpp
*
* Created on: Nov 12, 2017
* Author: Assunta
*/
#include "IOFile.h"
#include <map>
#include <string>
#include <iostream>
#include <fstream>
#include <iomanip>
IOFile::IOFile() {
// TODO Auto-generated constructor stub
}
IOFile::~IOFile() {
// TODO Auto-generated ... | true |
230b1007781cb2c7db175aa231cc532eb6933fc1 | C++ | chenchukun/UNP | /snf/example/handle/sockHandle.cpp | UTF-8 | 896 | 2.6875 | 3 | [] | no_license | #include "SockHandle.h"
#include <time.h>
#include <assert.h>
#include <iostream>
using namespace snf;
using namespace std;
int main()
{
SockHandle sockHandle;
assert(sockHandle.open(AF_INET, SOCK_STREAM)==0);
int val;
assert(sockHandle.getOption(SOL_SOCKET, SO_RCVBUF, val)==0);
cout << val << endl;
assert(sockH... | true |
6b757a41cc47cfa6f70733d71251e80fc99b4a67 | C++ | SamuelLouisCampbell/chili_framework-1 | /Engine/Keyboard.cpp | UTF-8 | 3,862 | 2.53125 | 3 | [] | no_license | /******************************************************************************************
* Chili DirectX Framework Version 16.07.20 *
* Keyboard.cpp *
* Copyright 2016 PlanetChili.net <http://www.planetchili.net> *
* *
* This file is part of The Ch... | true |
007be97045ea08e6e5bbd73b701223a575702db9 | C++ | bobsira/Cpp | /chapter3/question2.cpp | UTF-8 | 290 | 3.046875 | 3 | [] | no_license | #include<iostream>
int main(int argc, char const *argv[]) {
int number_one, number_two;
std::cout << "Enter number one" << '\n';
std::cin >> number_one;
std::cout << "Enter number two" << '\n';
std::cin >> number_two;
std::cout << number_one + number_two << '\n';
return 0;
}
| true |
a07d0fb483663365fca1485b78d598b11b949761 | C++ | srivathsanmurali/MLearn | /NeuralNets/CommonImpl.h | UTF-8 | 1,309 | 2.75 | 3 | [
"MIT"
] | permissive | #ifndef MLEARN_COMMON_NEURAL_NETS_FUNCS_H_FILE
#define MLEARN_COMMON_NEURAL_NETS_FUNCS_H_FILE
// MLearn includes
#include <MLearn/Core>
#include "ActivationFunction.h"
namespace MLearn{
namespace NeuralNets{
namespace InternalImpl{
/*!
* \brief Helper class for efficient computation of derivatives
* ... | true |
9f944e0a6730b6d2d4b0ab9a498a0e57fc67f2d9 | C++ | kuningfellow/Kuburan-CP | /yellowfellow-ac/UVA/722/11896124_AC_0ms_0kB.cpp | UTF-8 | 1,272 | 2.609375 | 3 | [] | no_license | //UVA 722 Lakes
#include <stdio.h>
#include <iostream>
#include <string.h>
using namespace std;
char ar[101][101];
int dim=0;
int sid;
int dfs(int x, int y)
{
int ret=0;
if (ar[x][y]=='0')
{
ret++;
ar[x][y]='1';
}
else if (ar[x][y]!='0')
{
return 0;
}
if (x+1<dim)... | true |
2d431b7b070bedde363a4ed4f02a64dd484eab30 | C++ | jetming/LibEBC | /lib/include/ebc/EmbeddedFile.h | UTF-8 | 1,267 | 2.96875 | 3 | [
"Apache-2.0"
] | permissive | #pragma once
#include <string>
#include <vector>
namespace ebc {
class EmbeddedFile {
public:
enum class Type {
Bitcode,
Exports,
File,
LTO,
Object,
Xar,
};
enum class CommandSource {
Clang,
Swift,
};
EmbeddedFile(std::string name);
virtual ~EmbeddedFile() = default;
... | true |
a5bf7a3db7aea25746761960b048a0a454058d76 | C++ | yosef8234/test | /spbstu_cpp/05_Arrays_v3/05smpl/Systems/Main.cpp | WINDOWS-1251 | 1,532 | 3.171875 | 3 | [] | no_license | #include <iostream>
#include <locale.h>
using namespace std;
int main(void)
{
setlocale(LC_ALL, "Russian");
cout<<" p- 10-"<<endl;
int p;
do
{
cout<<" p (2...36): ";
cin>>p;
} while (p<2 || p>36);
const int MAX_LEN = 30; //
cout<<" ( "<<MAX_LEN<<" ): ";
char x[MAX_LEN... | true |
0b6cae64187f2db122f19721094c518ff310bd4c | C++ | JJavier98/Support | /1º/MP/examenesResueltos/septiembre2013/sep2013ej1/src/entero.cpp | UTF-8 | 470 | 3.359375 | 3 | [] | no_license |
#include "entero.h"
using namespace std;
Entero::Entero(const Entero &otro){
v=new int;
*v=*(otro.v);
}
Entero & Entero::operator*(int valor) const {
Entero *resultado=new Entero(*(this->v)*valor);
return *resultado;
}
const Entero & Entero::operator=(const Entero &otro){
delete v;
v=new int;
... | true |
36e12fed452ced5e0ae1a2ed140dab1c1938e85a | C++ | brianhang/justintime | /JustinTime/stage/stage.h | UTF-8 | 413 | 2.609375 | 3 | [] | no_license | #pragma once
#include <SFML/Graphics.hpp>
class Stage {
public:
virtual ~Stage() { };
// Called to update the stage each frame.
virtual void update(float deltaTime) = 0;
// Called to draw the stage for the frame.
virtual void draw(sf::RenderWindow &window) = 0;
/... | true |
a1c03f898cf005654410e0682e9c68c57e50fa06 | C++ | xijun/cppa | /src/main.cc | UTF-8 | 10,421 | 3.1875 | 3 | [] | no_license | #include <boost/container/flat_map.hpp>
#include <chrono>
#include "polynomial.hh"
int main()
{
using clock = std::chrono::steady_clock;
/* ******************************************** Label and Weight tests ******************************************/
std::cout << std::boolalpha << "\033[33m" << "\n\t****** L... | true |
803f13f005dafb6044747be074174ab8c632d776 | C++ | king-yyf/poj- | /categery/math/bigInteger.cpp | UTF-8 | 1,759 | 2.84375 | 3 | [] | no_license | //
// main.cpp
// bigint
//
// Created by Yang Yunfei on 2017/5/25.
// Copyright © 2017年 Yang Yunfei. All rights reserved.
//
#include<cstdio>
#include<cstring>
using namespace std;
struct BigInteger{
int digit[1000];
int size;
void init(){
size = 0;
memset(digit,0,sizeof(digit));
}
... | true |
305eac50d4f656c631e899b9c40dfc8775b1d31c | C++ | bhaskarraksabh/projectEuler | /projectEuler/Su Doku/main.cpp | UTF-8 | 4,183 | 2.984375 | 3 | [] | no_license | //मनुष्य होना मेरा भाग्य लेकिन
//हिन्दू होना मेरा सौभाग्य है..!!
//"रामसेतू" और अयोध्या में "मन्दिर" उस समय से है..!!
//जब इस धरती पर न जीजस थे,
//और न ही इस्लाम का कोई अस्तित्व था..!!
//जय श्री राम
//everything could depending on what you do today
#include <algorithm>
#include <bitset>
#include <cmath>
#include <compl... | true |
dfe3a77b5d2c5a3137f3ad075a762b5509084595 | C++ | risenjesus/MicroPrograms | /Failed-Programs/Failed-Cookie-Clicker.cpp | UTF-8 | 1,416 | 3.234375 | 3 | [] | no_license | #include <iostream>
using namespace std;
int points;
bool start;
string input;
int clickercounter;
bool startclickercounter;
int main()
{
start = true;
cout << "-------------------------------------" << endl;
cout << "| Hello! Welcome to Cookie Clicker! |" << endl;
cout << "-------... | true |
7f7d0845040d9218a582286dca7e80ef4e61e90f | C++ | JPereira1330/Banco | /BancoServidor/BancoDB.cpp | UTF-8 | 2,042 | 2.765625 | 3 | [] | no_license | /*
* File: BancoDB.cpp
* Author: nyex
*
* Created on 14 de julho de 2019, 20:40
*/
#include <iostream>
#include <stdio.h>
#include <stdlib.h>
#include <cstdio>
#include "BancoDB.h"
#include "Conta.h"
#define DIR_BANCO "banco.db"
BancoDB::BancoDB() {
}
BancoDB::BancoDB(const BancoDB& orig) {
}
BancoDB::~Ba... | true |
dde47a60338c81bf5773548fbcdb009e8213e274 | C++ | alien111/oop_exercise_06 | /Source.cpp | UTF-8 | 3,073 | 3.515625 | 4 | [] | no_license | #include <iostream>
#include <map>
#include <string>
#include <algorithm>
#include <tuple>
#include <list>
#include "rectangle.h"
#include "Stack.h"
#include "Allocator.h"
#include "Vector.h"
#include "Allocator.h"
#include <map>
void menu() {
std::cout << "0 : EXIT\n";
std::cout << "1 : FILL THE VE... | true |
cd795cbaea9492c26792b768a7441316866627b3 | C++ | porzell/Duke-Spookem-3D | /src/Monster.h | UTF-8 | 1,795 | 2.5625 | 3 | [] | no_license | #pragma once
#ifndef _MONSTER_H
#define _MONSTER_H
#include "Entity.h"
#include "Timer.h"
#include "SoundEngine.h"
enum MONSTER_TYPE
{
NO_MONSTER, MINOTAUR_MONSTER, SWAMP_MONSTER, ZOMBIE_MONSTER, NAZI_MONSTER, HITLER_BOSS, CYBORG_MONSTER, MAX_MONSTER
};
class Monster : public Entity
{
//static T... | true |
eb4a296cab40499cc896cee489b793524142958e | C++ | ak188269/placement_preparation | /reverse_array.cpp | UTF-8 | 529 | 3.65625 | 4 | [] | no_license | #include <bits/stdc++.h>
using namespace std;
// reversing an aray
void reverse(int arr[], int n)
{
for (int i = 0; i < n / 2; ++i)
swap(arr[i], arr[n - 1 - i]);
}
int32_t main()
{
int size;
//taking size of matrix form user
cin >> size;
int arr[size];
//taking array as input
for (in... | true |
5a5062ec2bb0c8989d319602c4a23cec32c76cd6 | C++ | amitsingh19975/cache_manager | /main.cpp | UTF-8 | 1,682 | 2.921875 | 3 | [] | no_license | #include <iostream>
#include "cache_manager.hpp"
// template<typename T>
// void print(std::ostream& os, T const& c){
// using value_type = typename T::value_type;
// os << "[ ";
// std::copy(c.begin(), c.end() - 1, std::ostream_iterator<value_type const&>(os, ", "));
// os << c.back() << "]\n";
// }
... | true |
8482634b17fcae985aa24a3539bb265cd6ad3675 | C++ | PaulLGibbs/Leetcode | /maximum-product-subarray/maximum-product-subarray.cpp | UTF-8 | 343 | 2.84375 | 3 | [] | no_license | class Solution {
public:
int maxProduct(vector<int>& nums) {
int n = nums.size();
int ans = nums[0];
int l = 0, r = 0;
for(int i = 0; i < n;i++){
l = (l ? l : 1) * nums[i];
r = (r ? r : 1) * nums[n - 1 - i];
ans = max(ans,max(l,r));
}
... | true |
835566038c853b834ba925d4110135612cae30bb | C++ | dxx-git/DataStruct | /datastruct/maze/test.cpp | GB18030 | 7,797 | 3.15625 | 3 | [] | no_license | //#define _CRT_SECURE_NO_WARNINGS
//#include <iostream>
//#include <assert.h>
//#include <stack>
//using namespace std;
//
//const int N = 10;//ȫֱԹĴСԹΪΣȣ
//
//struct Pos
//{
// int Row;
// int Col;
//};
////void GetMaze(int (*maze)[N])//ȡԹ
////void GetMaze(int **maze)//ȡԹ(Ҫ̬ٿռ)
////void GetMaze(int maze[][N])//ȡԹ
//voi... | true |
ef8c5dc692885f9a1082afae8a41df65ca5a7cdd | C++ | Wytrix/Gluttonous-Snake-Game | /Code/wall.cpp | UTF-8 | 645 | 2.53125 | 3 | [] | no_license | #include "wall.h"
#include "constants.h"
#include <QPainter>
Wall::Wall(int x,int y)
{
setPos(x, y);
setData(GD_Type,GO_Wall);
}
QRectF Wall::boundingRect() const
{
return QRectF(-WALL_SIZE / 2, -WALL_SIZE / 2, WALL_SIZE, WALL_SIZE);
}
QPainterPath Wall::shape() const
{
QPainterPath ... | true |
921d597036c42cc9a9204b9225de85179b890854 | C++ | wanghai233/hello_world | /qtProject02/1214Qdatatime/mytime.cpp | UTF-8 | 1,342 | 2.515625 | 3 | [] | no_license | #include "mytime.h"
#include "ui_mytime.h"
#include <QDateTime>
#include <QDebug>
myTime::myTime(QWidget *parent) :
QDialog(parent),
ui(new Ui::myTime)
{
ui->setupUi(this);
this->time = new QTimer(this);//new出来,父窗口
time->setInterval(1000);//时间间隔
time->start();//启动定时器
connect(this->time,&QTim... | true |
35bc8b68ddc5e9fb143802a4c2f3769f9002820c | C++ | hoaf13/SPOJ_PTIT_DSA | /P178PROG.cpp | UTF-8 | 550 | 2.578125 | 3 | [] | no_license | #include <iostream>
using namespace std;
int main (){
int n;
while (1){
cin>>n;
if (n==0) break;
string S1, S2, S;
cin>>S1>>S2>>S;
int dem=0;
int kt=1;
while (1){
if (kt==0) break;
dem++;
if (dem>50){
kt=0;
break;
}
string Stg="";
for (int i=0; i<n; i++){
Stg=Stg+S2[i];
... | true |
3628ee41cd3b0dac3144760c782b0ab996f60402 | C++ | VulcanForge/Benchmark | /Benchmark.cpp | UTF-8 | 2,379 | 2.828125 | 3 | [] | no_license | #include "Benchmark.h"
Benchmark::Benchmark ()
{
std::random_device rd;
lcg.seed (rd ());
using result_type = std::random_device::result_type;
result_type ranluxSeed[std::ranlux24_base::word_size];
std::generate (std::begin (ranluxSeed), std::end (ranluxSeed), std::ref (rd));
std::seed_seq r... | true |
71582f02b419561d986841b8fef7ce873a1257d5 | C++ | barretuino/linguagemC | /Fonte Aula II/exemplo04.cpp | ISO-8859-1 | 744 | 3.59375 | 4 | [] | no_license | /**
Trabalhando com Structs
Autor: Paulo Barreto
Data: 10/08/2019
**/
#include <stdio.h>
#include <stdlib.h>
//Declarao de um registro (struct em C)
struct Produto{
int id;
float quantidade;
};
main(){
//Declarar uma varivel do tipo 'Produto'
struct Produto produto;
produto.id = 123;
prod... | true |
257241378964aaac5d13fe692f77e90820766e99 | C++ | shanecarey17/Maze | /Maze/Game.cpp | UTF-8 | 4,170 | 3.515625 | 4 | [] | no_license | //
// Game.cpp
// Maze
//
// Created by Shane Carey on 11/13/14.
// Copyright (c) 2014 Shane Carey. All rights reserved.
//
#include "Game.h"
Game::Game(int levels, int width, int depth, int creatures) {
// Construct the maze
maze = new Maze(levels, width, depth);
// Construct the player
play... | true |
26e572d3b2c770cd7e6686bd00f07b8f790a7112 | C++ | nleeseely/nleeseely-CSCI20-Fall2017 | /lab45/lab45.cpp | UTF-8 | 2,848 | 3.9375 | 4 | [] | no_license | //Created by: Nick LS
//Created on: 11/9/17
/*the following file is meant to take in user input of a first and last name, run it through some checkpoints for warnings
and then output some username options at the end*/
/*got some stack overflow info on functions to use in regards to counting string size: https://stack... | true |
e5e0ad61abba443f88ae5853a510fdb693cdd581 | C++ | tabris233/slove-problems | /2018-7/21/2018美团复赛E.cpp | UTF-8 | 5,808 | 2.671875 | 3 | [] | no_license | /*
https://www.nowcoder.com/acm/contest/152/E
涉及算法,dfs序,扫描线,线段树,lca
dfs序后 每加一条边
两点关系的bool矩阵中 就有2/4个矩形部分 没有了
if lca(a,b)==b||lca(a,b)==a :
4个
设fa[x]=lca(a,b) a,b中a的深度大
那么{<x,y>|x \in [L[a],R[a]] ,y \in ([1,L[x]-1] and [R[x]+1,n])就被灭掉了
else:
2个
那么{<x,y>|x \in [L[a],R[a]] ,y \in [L[x],R[x]] 就被灭掉了
... | true |
1a436538a0d7043de644c7d128b8da1415c6d2a7 | C++ | tkloong/sudoku | /sudoku.cpp | UTF-8 | 6,837 | 3.015625 | 3 | [] | no_license | #include "sudoku.h"
#include <iostream>
#include <cstdlib>
#include <algorithm>
#include <unistd.h>
#include <curses.h>
#include <locale.h>
#include <time.h>
#include <fstream>
using namespace std;
static int num[9]; // number from 1~9
Sudoku::Sudoku(int &level){ // constructor
generation(level);
}
void Sudoku::... | true |
695bf6e3f0b34cfcea129ed851205ade6b1f7544 | C++ | twix20/sdizo_project | /Sdizo_Projekt3/GreedyTravellingSalesman.h | UTF-8 | 608 | 2.734375 | 3 | [] | no_license | #pragma once
#include "ITravellingSalesmanStrategy.h"
struct tempPath
{
int from;
int to;
int cost;
tempPath()
{
}
tempPath(int from, int to, int cost)
{
this->from = from;
this->to = to;
this->cost = cost;
}
};
class GreedyTravellingSalesman : public ITravellingSalesmanStrategy
{
private:
std::... | true |
b2cb27df987edd268470a9d795d87d4aafcff78b | C++ | Anubhav12345678/competitive-programming | /PRINTBINARYTREESPECIALVVVVIMPLEETCODE655.cpp | UTF-8 | 2,473 | 3.421875 | 3 | [] | no_license | /**
Print a binary tree in an m*n 2D string array following these rules:
The row number m should be equal to the height of the given binary tree.
The column number n should always be an odd number.
The root node's value (in string format) should be put in the exactly middle of the first row it can be put. The colu... | true |
b8a65e1c509b7bb334cbe147dc88a6cf370731a8 | C++ | foges/aml | /test/cpu/gtest_expression.cpp | UTF-8 | 19,283 | 2.875 | 3 | [
"Apache-2.0"
] | permissive | #include <cmath>
#include <gtest/gtest.h>
#include <aml/aml.h>
class ExpressionTest : public ::testing::Test {
public:
ExpressionTest() {
h.init();
}
~ExpressionTest() {
h.destroy();
}
protected:
aml::Handle h;
};
/** PLUS **********************************************************************/
... | true |
27eb6b73bf18f571c29669e4e2a4ca04ff44e075 | C++ | KozeevMaxim/BMSTU_LAB5 | /Lab5.cpp | UTF-8 | 1,357 | 3.46875 | 3 | [] | no_license | #include <iostream>
#include <stdio.h>
#include <stdlib.h>
#include <locale.h>
using namespace std;
double sum(float a, float b)
{
return a + b;
}
double sub(float a, float b)
{
return a - b;
}
double mult(float a, float b)
{
return a * b;
}
int main(int argc, char *argv[])
{
int a, b;
if (argc ... | true |
6976a9b5ad5f0d1fd9d97d865d516ddc7a28da24 | C++ | hongxchen/algorithm007-class01 | /Week_03/G20200343040045/LeetCode-590-0045.cpp | UTF-8 | 918 | 3.703125 | 4 | [] | no_license | #include <iostream>
#include <vector>
using namespace std;
class Node {
public:
int val;
vector<Node*> children;
Node() {
}
Node(int _val) {
val = _val;
}
Node(int _val, vector<Node*> _children) {
val = _val;
children = _children;
}
};
/**
* 题目:N叉树的后序遍... | true |
2dda7bb5718f89730c16bfa89e0b96ec5fc1acea | C++ | karikera/ken | /KR3/common/text/nullterm.h | UTF-8 | 871 | 2.71875 | 3 | [] | no_license | #pragma once
#include "buffer.h"
namespace kr
{
template <typename Buffer>
class ToSZ : public Bufferable<ToSZ<Buffer>, BufferInfo<typename Buffer::Component, method::CopyTo, true, true>>
{
static_assert(IsBuffer<Buffer>::value, "Buffer is not buffer");
using Super = Bufferable<ToSZ<Buffer>, BufferInfo<typen... | true |
bb8967a6626959a589cc03705c7f111d1ea99788 | C++ | SebiCoroian/pbinfo-sources | /monede.cpp | UTF-8 | 225 | 2.53125 | 3 | [] | no_license | #include <iostream>
using namespace std;
int main()
{
int a, b, c, S, na, nb, nc;
cin >> a >> b >> c >> S;
nc = S/c, S %= c;
nb = S/b, S %= b;
na = S/a, S %= a;
cout << na << " " << nb << " " << nc;
return 0;
}
| true |
b08e65cd916ecc2cdeb6cc76e4ea445aaf9a26d6 | C++ | yakirhelets/234218_DS | /HW2/GenericHashTable.h | UTF-8 | 5,432 | 3.078125 | 3 | [] | no_license | //
// Created by Yakir on 06/06/2017.
//
#ifndef WET2SPRING17_GENERICHASHTABLE_H
#define WET2SPRING17_GENERICHASHTABLE_H
#include <iostream>
#define SIZE 6
#define C 3
template <class Data>
class HashTable {
public:
class HashElement {
Data data;
int key;
public:
H... | true |
accce3c674f57af9e3be1ce06171ce0af337aaff | C++ | ConsciousCoder07/Dcoder | /Easy/NumberedTriangle.cpp | UTF-8 | 279 | 2.828125 | 3 | [] | no_license | #include <iostream>
using namespace std;
int main()
{
int n, row, col;
cin >> n;
for(row = 1; row <= n; row++)
{
for( col = 1; col <=row; col++)
(col==row) ? cout << col : cout << col << " ";
cout << "\n";
}
return 0;
} | true |
bc56bc01f3854a2544187037920ab170804c6ff5 | C++ | friackazoid/Eigen_test | /quaternion_inv.cpp | UTF-8 | 876 | 3.046875 | 3 | [] | no_license | #include <iostream>
#include <iterator>
#include <vector>
#include <Eigen/Dense>
#include <Eigen/Geometry>
int main () {
// (w, x, y, x) order
Eigen::Quaterniond q(-0.00727927, 0.132765, 0.991118, 0.00251783);
std::cout << "Q1: \n" << q.coeffs() << std::endl;
std::cout << "Euler from Q1:\n " << q.toRo... | true |
d54deea771ee7582a206600bfa6e8f6173c66c3d | C++ | rabitdash/practice | /shiyanlou/Queue/src/Event.hpp | UTF-8 | 412 | 2.671875 | 3 | [
"MIT"
] | permissive | #ifndef Event_hpp
#define Event_hpp
#include "Random.hpp"
#define RANDOM_PARAMETER 100
struct Event
{
int occur_time; // -1 represents arrival, >=0 means diposal and the number represents service window.
int event_type;
Event *next;
Event (int occur_time = Random::uniform (RANDOM_PARAMETER), int event_type... | true |
982d068ff00f19f9c709c7912e5676a695f1e9c0 | C++ | leclem/satsolver_cpp | /include/base/clause.h | UTF-8 | 6,243 | 2.921875 | 3 | [] | no_license | #ifndef CLAUSE_BASE_H
#define CLAUSE_BASE_H
#include "base/container.h"
#include "base/literal.h"
// class for clauses vars
template<SATheuristic _ALG, LitChoice _WAT, ClauseChoice _CL>
class CClause_vars
{
typedef CLiteral<_ALG, _WAT, _CL> Literal;
public:
virtual ~CClause_vars(){}
protected:
std::list<L... | true |
8d7f565327e3870a5abdaf89542193d430586b05 | C++ | Bassant-Yehia/Programs-using-different-languages | /E3rf Borgak.cpp | UTF-8 | 2,113 | 3.4375 | 3 | [] | no_license | #include <iostream>
using namespace std;
int main()
{
int month,day;
cout << "Enter your month of birth!" << endl;
cin>>month;
cout << "Enter your day of birth!" << endl;
cin>>day;
if(month>0&&month<=12||day>0&&day<=30)
{
if(month==1||month==12)
{
... | true |
f457bbbce96090375d4d2b30f9ceb597eb9a9f21 | C++ | zhaoyang110157/SE | /SE232/homework/bucket effect/bucket effect/main.cpp | UTF-8 | 1,296 | 3.078125 | 3 | [] | no_license | //
// main.cpp
// bucket effect
//
// Created by 朱朝阳 on 2018/11/15.
// Copyright © 2018年 朱朝阳. All rights reserved.
//
#include <iostream>
#include <vector>
#include <string>
using namespace std;
int Split(const string& src,const string& separator, vector<int>& dest)
{
string str = src;
int tmp;
int max=0;
stri... | true |
8d868c6e9957d02f8ce83fc7e827ead069790623 | C++ | bennycooly/school-projects | /EE_379K_EPL/students/byf69/Project3b/Valarray_PhaseB_unittests.cpp | UTF-8 | 7,780 | 2.875 | 3 | [] | no_license | /*
* valarray_PhaseB_unittests.cpp
* EPL - Spring 2015
*/
#include <chrono>
#include <complex>
#include <cstdint>
#include <future>
#include <iostream>
#include <stdexcept>
#include "InstanceCounter.h"
#include "Valarray.h"
#include "gtest/gtest.h"
using std::cout;
using std::endl;
using std::string;
using std::... | true |
40e5ee011fa6ea6ecee6aacd154cd62666e20c02 | C++ | lawtonsclass/f20-code-from-class | /csci40/lec17/ptrsAndClasses.cpp | UTF-8 | 260 | 3.46875 | 3 | [] | no_license | #include <iostream>
#include <string>
using namespace std;
int main() {
string s = "abcd";
string* sp = &s;
// sp isn't a string, but *sp is!
cout << (*sp).size() << endl;
cout << sp->size() << endl; // equivalent to the above line
return 0;
}
| true |
e97cf67990cd99c752e05d83266626f2558cc02e | C++ | jonggeunpark/selfstudy | /baekjoon/cpp/math 2/BOJ_4948.cpp | UHC | 641 | 3.0625 | 3 | [] | no_license | //Baekjoon online judge
//4948
//Ʈ
#include <iostream>
#include <math.h>
using namespace std;
#define SIZE 246912
void setArr(bool arr[])
{
fill_n(arr, SIZE + 2, true);
arr[1] = false;
for (int i = 2; i <= sqrt(SIZE); i++)
{
if (arr[i] == true)
{
for (int j = i * 2; j <= SIZE; j++)
{
if (j%i == 0)... | true |
12b5e8579f9eeb944013fc4350c66dba4f2cbe31 | C++ | marinelns/cpp | /TP3/src/GerstnerWave.h | UTF-8 | 953 | 3.109375 | 3 | [] | no_license | #ifndef GerstnerWaveH
#define GerstnerWaveH
#include "Dvector.h"
#include <cmath>
//classe dont chaque instance contient la definition d'une onde differente
class GerstnerWave{
protected :
double _amplitude;
double _phase;
Dvector _directionOnde;
double _frequence;
public :
/*constructeur pa... | true |
69895d01bffa07ca91a0561212eff3d6b7933ed3 | C++ | lumip/computegraphlib | /cglib/src/nodes/VariableNode.cpp | UTF-8 | 1,118 | 2.65625 | 3 | [
"MIT"
] | permissive | #include "nodes/VariableNode.hpp"
#include "CompilationMemoryMap.hpp"
#include "GraphCompilationPlatform.hpp"
VariableNode::VariableNode(std::string name)
: Node(true, true)
, _name(name)
, _input(nullptr)
{
}
VariableNode::~VariableNode() {}
void VariableNode::SetInput(const NodePtr inputNode)
{
if... | true |
8d1c8d00ceee46c9c393624883ad792f0fcfca2f | C++ | sanjusss/leetcode-cpp | /1000/1600/1650/1658.cpp | UTF-8 | 852 | 2.65625 | 3 | [] | no_license | /*
* @Author: sanjusss
* @Date: 2023-01-07 15:17:01
* @LastEditors: sanjusss
* @LastEditTime: 2023-01-07 15:25:02
* @FilePath: \1000\1600\1650\1658.cpp
*/
#include "leetcode.h"
class Solution {
public:
int minOperations(vector<int>& nums, int x) {
int sum = accumulate(nums.begin(), nums.end(), 0);
... | true |
37d339c019d73d338ba6b5c261bafdcf554e0e3e | C++ | biheng/hana | /include/boost/hana/fwd/type.hpp | UTF-8 | 20,808 | 2.890625 | 3 | [
"LicenseRef-scancode-unknown-license-reference",
"BSL-1.0"
] | permissive | /*!
@file
Forward declares `boost::hana::Type` and `boost::hana::Metafunction`.
@copyright Louis Dionne 2015
Distributed under the Boost Software License, Version 1.0.
(See accompanying file LICENSE.md or copy at http://boost.org/LICENSE_1_0.txt)
*/
#ifndef BOOST_HANA_FWD_TYPE_HPP
#define BOOST_HANA_FWD_TYPE_HPP
na... | true |
890166deb2ab686a96155827b015595280aee510 | C++ | vivekgopalshetty/code | /dp/topdown/zero_one_knapsnack.cpp | UTF-8 | 871 | 2.640625 | 3 | [] | no_license | #include<bits/stdc++.h>
using namespace std;
int zero_one(int weights[],int profits[],int dp[100][100],int start,int capacity,int n)
{
if(capacity<0 || start>=n)
{
return 0;
}
if(dp[start][capacity]!=0)
{
return dp[start][capacity];
}
int x1=0;
if(capacity>=weights[st... | true |
26df482767359fa1deaac4c49dfafebe0df88233 | C++ | azujuuuuuun/kyoupro | /AtCoder/ABC/087/c.cpp | UTF-8 | 462 | 2.671875 | 3 | [] | no_license | #include <iostream>
using namespace std;
const int N_MAX = 100;
int main (void) {
int n;
int a[2][N_MAX];
cin >> n;
for (int i = 0; i < 2; i++) {
for (int j = 0; j < n; j++) {
cin >> a[i][j];
}
}
for (int i = 1; i < n; i++) a[0][i] += a[0][i - 1];
a[1][0] += a[0... | true |
0e7f091d1be2474e83b2d1cde57584b81db3b077 | C++ | shuxiangguo/sxg_leetcode | /575.分糖果.cpp | UTF-8 | 1,719 | 3.609375 | 4 | [] | no_license | /*
* @lc app=leetcode.cn id=575 lang=cpp
*
* [575] 分糖果
*
* https://leetcode-cn.com/problems/distribute-candies/description/
*
* algorithms
* Easy (63.88%)
* Likes: 47
* Dislikes: 0
* Total Accepted: 13.3K
* Total Submissions: 20.5K
* Testcase Example: '[1,1,2,2,3,3]'
*
*
* 给定一个偶数长度的数组,其中不同的数字代表着... | true |
b7d73ee74508874c7f3a3a0c4cc381a0cb246239 | C++ | fja0kl/LeetCode-Path | /CodingInterviews/栈的压入弹出序列/solution.cpp | UTF-8 | 580 | 3.0625 | 3 | [] | no_license | class Solution {
public:
bool IsPopOrder(vector<int> pushV,vector<int> popV) {
if (pushV.empty() || popV.empty()) return false;
if (pushV.size() != popV.size()) return false;
stack<int> dataStack;
for (int i=0, j=0; i<pushV.size();){
dataStack.push(pushV[i++]);//入栈
... | true |
f58d63383f3334567a565a761c26e57c5395206e | C++ | lucas54neves/gcc224-ialg | /Lista de estruturas de repetição/Questão 20 - Cálculo de PI/exercicio20.cpp | UTF-8 | 301 | 2.8125 | 3 | [] | no_license | #include <iostream>
#include <math.h>
using namespace std;
int main () {
int nTermos, n;
double valorPi, a1;
cin >> nTermos;
valorPi = 1;
a1 = 0;
n = 1;
while (n <= nTermos) {
a1 = sqrt(a1+2);
valorPi *= a1/2;
n++;
}
valorPi = pow(valorPi/2, -1);
cout << valorPi << endl;
return 0;
}
| true |