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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
cc482e5e551a976a640497c040cf2a29cad12cc9 | C++ | Botelho31/trabalhos_IDJ | /170109071_T1/src/Sprite.cpp | UTF-8 | 1,277 | 3.0625 | 3 | [] | no_license | #include "../include/Sprite.h"
#include "../include/State.h"
#include "../include/Game.h"
Sprite::Sprite(){
texture = nullptr;
}
Sprite::Sprite(std::string file){
texture = nullptr;
Open(file);
}
Sprite::~Sprite(){
if(texture){
SDL_DestroyTexture(texture);
}
}
void Sprite::Open(std::stri... | true |
3f05d5352d4dd4aa718bc443b9d4646b4bc0be2f | C++ | HelloSunyi/Elements-of-Programming-Interviews | /Chapter_16/c16_4.cpp | UTF-8 | 1,756 | 2.9375 | 3 | [] | no_license | #include <iostream>
#include <vector>
#define WHITE 0
#define GRAY 1
#define BLACK 2
using namespace std;
//directed graph
bool dfs(vector<vector<int> >& v, vector<int>& b, int i) {
b[i] = GRAY;
for (int j = 0; j < v.size(); j++) {
if (!v[i][j]) {
continue;
}
if (b[j] == WHITE) {
bool reg ... | true |
169b03540fd6075f4e7e328a78bdb14152358f45 | C++ | gzc/leetcode | /cpp/1001-10000/1171-1180/Dinner Plate Stacks.cpp | UTF-8 | 1,462 | 3.375 | 3 | [
"MIT"
] | permissive | class DinnerPlates {
vector<stack<int>> v;
int capacity;
int bestindex;
public:
DinnerPlates(int capacity) {
this->capacity = capacity;
bestindex = 0;
}
void push(int val) {
for (int i = bestindex; i < v.size(); i++) {
stack<int>& s = v[i];
... | true |
129f23158d006165f2f3ed25c53344413366b778 | C++ | Sakerini/BMSTU-4th-Sem | /Object-Oriented-Programming(C++)/lab_03/lab_03/lab_03/geometry/point.cpp | UTF-8 | 2,156 | 3.625 | 4 | [] | no_license | #include <cmath>
#include "point.h"
Point::Point(double x_, double y_, double z_)
: x(x_), y(y_), z(z_) {
}
Point::Point(const Point &point)
: x(point.getX()),
y(point.getY()),
z(point.getZ()) {
}
Point::~Point() {
}
Point& Point::operator=(const Point& point) {
if (this != &point) {
x = point.getX(... | true |
9333d9367e8c29f8b53986f3a5262248b6f01ee7 | C++ | Samraksh/Tuscarora | /TuscaroraFW/Lib/Pattern/NeighborTable/PatternNeighborIterator.cpp | UTF-8 | 2,013 | 2.53125 | 3 | [] | no_license | //////////////////////////////////////////////////////////////////////////////////
// Tuscarora Software Suite. The Samraksh Company. All rights reserved.
// Please see License.txt file in the software root directory for usage rights.
// Please see developer's manual for implementation notes.
/////////////////////... | true |
9dd635917fb566119adb1fb438de0836527f25f5 | C++ | Doggzor/Alien-Search-and-Rescue | /Engine/Alien.h | UTF-8 | 702 | 2.625 | 3 | [] | no_license | #pragma once
#include "Graphics.h"
#include "UFO.h"
#include <random>
class Alien
{
public:
Alien(int start_x, int start_y);
void Draw(Graphics& gfx);
int count = 0;
bool collected = false;
int fadeout = 300;
int fadein = 0;
int x = 0;
int y = 0;
static constexpr int width = 18;
static constexpr int height ... | true |
e2cc1a0b5bfd6e3c9eba8d10236c438b871e58e4 | C++ | NamYoonJae/InhaGame | /win32_C++/ClassProject/ClassProject/rectangle.cpp | UHC | 705 | 3.15625 | 3 | [] | no_license | #include "stdafx.h"
#include "rectangle.h"
#include <iostream>
using namespace std;
rectangle::rectangle()
{
width = 0;
height = 0;
areaRsult = 0;
circum = 0;
}
rectangle::~rectangle()
{
}
void rectangle::setWidth(double w)
{
width = w;
}
void rectangle::setHeght(double h)
{
height = h;
}
double rectangle:... | true |
eaa1e4dd394b482810598c5565d171c2b8c96fa1 | C++ | chenlei65368/algorithm004-05 | /Week 3/id_425/LeetCode_860_425.cpp | UTF-8 | 3,026 | 3.734375 | 4 | [] | permissive | /*
* @lc app=leetcode.cn id=860 lang=cpp
*
* [860] 柠檬水找零
*
* https://leetcode-cn.com/problems/lemonade-change/description/
*
* algorithms
* Easy (52.15%)
* Likes: 81
* Dislikes: 0
* Total Accepted: 11.6K
* Total Submissions: 22.1K
* Testcase Example: '[5,5,5,10,20]'
*
* 在柠檬水摊上,每一杯柠檬... | true |
2d6fa516580983f75599005550bb93e9df4feb53 | C++ | Jbudone/noengine | /src/libutils/lib_containers.h | UTF-8 | 4,356 | 3.453125 | 3 | [] | no_license | #ifndef __LIB_CONTAINERS_H__
#define __LIB_CONTAINERS_H__
/***
* Containers
*
* Various data structures
*
* TODO
* - ...
*
**/
#include <stdlib.h>
#define CHAR0 48 // ASCII dec code for 0
template<class T1, class T2, class T3>
struct Triple {
Triple() { }
Triple(T1 t1, T2 t2, T3 t3) : t1(t1), t2(t2), ... | true |
c01ccca03e03d6ed45824909ba48df3db87394a6 | C++ | milczarekIT/agila | /app/Report/Goods/EndingGoodsDialogView.cpp | UTF-8 | 1,819 | 2.546875 | 3 | [] | no_license | #include "EndingGoodsDialogView.h"
EndingGoodsDialogView::EndingGoodsDialogView(QWidget *parent, EndingGoodsDialogController *controller)
: ReportDialogView(parent)
{
this->controller = controller;
this->setWindowTitle("Kończące się towary");
this->addComponents();
connect(buttonBox, SIGNAL(accep... | true |
ddf12b63f9137ac6864842e6f93223afd14a2cc6 | C++ | jsffeng/ShredderReconstruct | /common_classes.cpp | UTF-8 | 7,858 | 3.109375 | 3 | [] | no_license | #include <fstream>
#include <unordered_set>
#include "common_classes.h"
#include "singleton_random.h"
using namespace std;
// Common function for reading text lines from an input file, usually used read text page
void TextFileOperation::ReadText(const string str_filename, vector<string> &vec_str_text_lines)
{
strin... | true |
7bc6a38f50ce8f49011fd9d5ec95b3bb95f1db96 | C++ | gingkg/happyleetcodeeveryday | /leetcode/leetcode_93/test.cpp | UTF-8 | 238 | 2.6875 | 3 | [
"MIT"
] | permissive | #include <iostream>
#include <vector>
using namespace std;
int test()
{
vector<string> vec;
string s = "swsdfghjhk";
s.insert(2, ".");
cout << s << endl;
vec.push_back(s);
vec.push_back(s);
vec.push_back(s);
return 0;
}
| true |
cb619196875f8aba174668f9dcd3561c1e2ea79b | C++ | emmmile/ibm-ponder-this | /2015/april/vect.hpp | UTF-8 | 530 | 3.265625 | 3 | [] | no_license | #include <array>
#include <ostream>
using namespace std;
// simple stack vector implementation
typedef array<int, 3> vect;
vect operator + ( const vect& a, const vect& b ) {
vect c;
for ( size_t i = 0; i < a.size(); ++i ) c[i] = a[i] + b[i];
return c;
}
vect operator - ( const vect& a, const vect& b ) ... | true |
5adb7a071351a7a0e6ca1aab54d99ec7ba90739b | C++ | lazymonday/PS | /baekjoon/12015_lis/main.cpp | UTF-8 | 642 | 2.84375 | 3 | [] | no_license | #include <iostream>
#include <algorithm>
using namespace std;
const int MAX = 1e6 + 10;
int n;
int nums[MAX];
int lisArr[MAX];
bool comp(const int& a, const int& b) { return a > b;}
int lis() {
int len = 0;
for (int i = 0; i < n; ++i) {
auto pos = lower_bound(lisArr, lisArr + len, nums[i], comp);
... | true |
5f1da366a0d413a9fccc49a483f8ce77e7897bbc | C++ | iynaur/ChineseChesses | /chess_shi.cpp | WINDOWS-1252 | 1,378 | 2.59375 | 3 | [
"MIT"
] | permissive | #include "chess_shi.h"
chess_shi::chess_shi(int X,int Y,int PLAYER,bool ALIVE):chess(X,Y,PLAYER,ALIVE)
{
name=NAMESHI;
}
chess_shi::chess_shi(void):chess(-1,-1,NAMENONE,false)
{
name=NAMESHI;
}
chess_shi::chess_shi(chess_shi &obj)
{
x=obj.x;
y=obj.y;
name=obj.name;
player=obj.player;
alive=obj.alive;
}
int c... | true |
11bc820f1f548e5f8ee68cbc28068f5859963b7f | C++ | jerrywwl/gnm | /gnm/functions/func_quat.inl | UTF-8 | 4,353 | 2.671875 | 3 | [] | no_license | #include "func_vector_relational.h"
#include "func_trigonometric.h"
GNM_NAMESPACE_BEGIN
GNM_INLINE bvec4 Equal(const quat& x, const quat& y) {
return bvec4((Abs(x.w - y.w) <= GNM_EPSILON), (Abs(x.x - y.x) <= GNM_EPSILON), (Abs(x.y - y.y) <= GNM_EPSILON), (Abs(x.z - y.z) <= GNM_EPSILON));
}
GNM_INLINE float Dot(cons... | true |
7287166ab77534648f24e69ebbb01be6b67fe3df | C++ | seal-git/atcoder | /2021-05-09-C/main.cpp | UTF-8 | 775 | 2.515625 | 3 | [] | no_license | #include <iostream>
#include <string>
#include <stdio.h>
#include <math.h>
#include <queue>
#include <algorithm>
#include <utility>
#include <vector>
#include <tuple>
#include <numeric>
using namespace std;
int main(int argc, char* argv[]){
int n;
cin>>n;
vector<int> sosu;
int nums[10001];
for(int i=0;i<10000;i+... | true |
7824235d2195a3833b3df1ff73af77eb1fbf646f | C++ | kushagraagrawal/codeforces-codechef | /Music/git_project2/codeforces/332ADiv2.cpp | UTF-8 | 358 | 2.53125 | 3 | [] | no_license | #include<bits/stdc++.h>
using namespace std;
int main()
{
long long int d1,d2,d3,distance = 0;
cin>>d1>>d2>>d3;
if(d1<=d2)
{
distance+=d1;
if(d1+d2<d3)
distance+=d1+d2;
else
distance+=d3;
distance+=d2;
}
else
{
distance+=d2;
if(d1+d2 < d3)
distance += d1 + d2;
else
distance += d3;
distanc... | true |
98c6be64a683fa5931f7effb9270ce15b652e388 | C++ | sarim/Avrodroid | /jni/avrov8.cpp | UTF-8 | 4,199 | 2.609375 | 3 | [] | no_license | #include <jni.h>
#include <iostream>
#include <v8.h>
#include <string>
#include <stdio.h>
#include <android/log.h>
#define LOGI(...) __android_log_print(ANDROID_LOG_INFO,"avro-ndk",__VA_ARGS__)
#define LOGIJS(...) __android_log_print(ANDROID_LOG_INFO,"avro-js",__VA_ARGS__)
using namespace v8;
HandleScope handle_s... | true |
9af4341c5ae666f89da4fa64d3d00495c222dc98 | C++ | alexiskovi/renegade | /modules/common/serial/src/serial.cc | UTF-8 | 1,126 | 3.015625 | 3 | [] | no_license | #include <stdio.h>
#include "serial.h"
namespace renegade {
namespace common {
SerialInterface::SerialInterface(const char *port) {
serial_port.open(port);
if(!serial_port.is_open()) {
ROS_FATAL("Can't open serial port");
}
else {
ROS_INFO("Opened");
}
}
void SerialInterface::Writ... | true |
3d401b7fead2e9fd8a5adf0466ee507b8c0fff88 | C++ | MSallermann/spirit_toy_code | /include/implementation/Memory.hpp | UTF-8 | 8,487 | 2.78125 | 3 | [] | no_license | #pragma once
#ifndef MEMORY_HPP
#define MEMORY_HPP
#include "Definitions.hpp"
#include <string>
#include <vector>
#ifdef BACKEND_CUDA
#include "implementation/backend_cuda/cuda_helper_functions.hpp"
#endif
namespace Spirit
{
namespace Implementation
{
template<typename T>
class device_type
{
private:
T m_value;... | true |
60ede015ce0917cfdf36b70ae8d19261be85f6b5 | C++ | KishoreKaushal/cpp-routines | /stoppable-task/main.cpp | UTF-8 | 626 | 3.0625 | 3 | [
"MIT"
] | permissive | #include "stoppable_task.hpp"
#include <iostream>
#include <memory>
class Speak : public StoppableTask {
int count;
public:
Speak() : count(0), StoppableTask() {}
Speak(const Speak&) = delete;
Speak& operator=(const Speak&) = delete;
void run() override {
std::cout << ++count << " -- spea... | true |
46f227f10907c62d9fd714bbe79a30bce0897a72 | C++ | nanenchanga53/BackJoonAlgorithems | /algorithms/algorithms2/1038_감소하는 수.cpp | UHC | 2,132 | 3.515625 | 4 | [] | no_license | #include<iostream>
#include<algorithm>
#include<cmath>
using namespace std;
int find_decrease_num, sum = 0;
int isGetAnswer = 0, isEndCheck = 0;
int num_arr[10][10] = { 0 };
long long answer = 0;
// 迭
void make_arr() {
// ù
for (int j = 0; j < 10; j++) num_arr[0][j] = 1;
// 迭 ä
for (int i = 1; i < 10; i... | true |
3a3a8783d2d7bd93fd29bf0ab1442c31c8e34d95 | C++ | NathanWine/2048-AI-Solvers | /src/Main.cpp | UTF-8 | 5,555 | 3.390625 | 3 | [] | no_license | #include <cctype>
#include <chrono>
#include <numeric>
#include "Game.hpp"
#include "MonteCarlo.hpp"
#include "Minimax.hpp"
#include "Expectimax.hpp"
using namespace std::chrono;
// Simple cmd line parsing function to determine if a string is representing a number
bool isNumber(const std::string& str) {
for (char... | true |
8ed310390a2091ae70467b653f85741ba21888be | C++ | Edvvard92/remotesensor | /SA02/remotesenor/climate.hpp | UTF-8 | 6,965 | 2.84375 | 3 | [] | no_license | // Developer note stack size needs to be increased to allow the allocation of memory for this double = 8 bytes
// 8 * 24 * 60 * 60 * 2 arrays of doubles = 1382400 bytes base allocation is 1MB
// In VS2017 go to project > properties > System > and set Stack Reserve Size and Stack Commit Size to 2000000
// This preve... | true |
1003c5ec6253de9d895491a15f4cc8cace69ee70 | C++ | HangHangbo/C_Plusplus | /test/test/test.cpp | GB18030 | 6,550 | 2.921875 | 3 | [] | no_license | //#include <iostream>
//#include <vector>
//#include <algorithm>
//using namespace std;
////int main()
////{
//// int num[4] = { 0 };
//// for (int i = 0; i < 4; i++)
//// {
//// cin >> num[i];
//// }
//// int A, B, C;
//// A = (num[0] + num[2]) / 2;
//// B = (num[1] + num[3]) / 2;
//// C = B - num[1];
//// if ((num... | true |
0e2ef48694a92487e4c7b731c7d281074dd4a63d | C++ | refkxh/AIZUOJ_Basic | /ALDS1_7_C.cpp | UTF-8 | 997 | 2.890625 | 3 | [] | no_license | #include <cstdio>
#include <cstring>
using namespace std;
int p[30],left[30],right[30];
void preParse (int cur) {
printf (" %d",cur);
if (left[cur]!=-1) preParse (left[cur]);
if (right[cur]!=-1) preParse (right[cur]);
}
void inParse (int cur) {
if (left[cur]!=-1) inParse (left[cur]);
printf (" %d",cur);
if (right... | true |
568a7f448cf0fc5f8436f2d75375aa059eb85c5f | C++ | JuneOne/Learn-in-C | /PAT/1055.cpp | UTF-8 | 1,003 | 2.828125 | 3 | [] | no_license | #include <iostream>
#include <cstdio>
#include <cstring>
#include <algorithm>
using namespace std;
struct node{
char name[10];
int age;
int worth;
}Peo[100000];
bool cmp( struct node a, struct node b )
{
if( a.worth == b.worth ){
if( a.age == b.age )
return strcmp(a.name, b.name) < 0;
el... | true |
473a757eea5e97bb96721792268febb1074989dd | C++ | yareCandy/Data-Structure | /1606_1.cpp | UTF-8 | 3,946 | 2.890625 | 3 | [] | no_license | #include <iostream>
using namespace std;
const int N = 55;
template<class T>
class seqQueue
{
private:
T *dt;
int maxSize;
int front, rear;
void doubleSpace();
public:
seqQueue(int initSize = 10);
~seqQueue(){delete [] dt;}
bool isEmpty()const {return front == rear;}
void enQueue(const ... | true |
461ebf74df989a2103966beb72b39594cbecf69d | C++ | dwaq/IR-Closet-Lights | /IR-Closet-Lights.ino | UTF-8 | 2,295 | 2.703125 | 3 | [
"CC-BY-3.0"
] | permissive | //*************************************************************************************************
// IR-Closet-Lights
//
// By: Dillon Nichols
// https://tinkerer.us
//
// Created in Arduino v1.8.2
//
// Description:
// Using Arduino Leonardo to switch lights using IR with door as trigger
//
// This work is licensed ... | true |
c49d849e0568f548b00c44db15e8a0546cd8f739 | C++ | hannabizon/hannabizon | /zadania do wgrania c++/2V.cpp | UTF-8 | 611 | 3.890625 | 4 | [] | no_license | //zdefiniuj tab 10-elementową typu całkowitego
//wyświetl 1,4,osttani element
//wyświetl wszystkie elementy na 2 sposoby: od 0-9 oraz od 9-0
#include <iostream>
using namespace std;
int main()
{
int tab[10] = {0,1,2,3,4,5,6,7,8,9};
cout << tab[0] << " " << tab[3] << " " << tab[9] << endl; // 1 el. tab = tab[... | true |
59a0555334664f6fd8b0918f2d229da7acd2c702 | C++ | chandankds/CPP | /Exception/Complex.cpp | UTF-8 | 804 | 2.765625 | 3 | [] | no_license | #include"Complex.h"
#include"IlligalValueException.h"
using namespace pcomplex;
complex::complex() : real(0), imag(0)
{ }
complex::complex(int real, int imag)throw (nexception::IlligalException)
{
if(real < 0 || imag < 0)
throw nexception::IlligalException("not good");
this->real = real;
this->imag... | true |
20a3975922679889c8fa6dbcb5178f1d9fb93381 | C++ | rahulchhabra07/CompetitiveProgramming | /My Programs/simple equation.cpp | UTF-8 | 575 | 2.5625 | 3 | [] | no_license | #include<bits/stdc++.h>
using namespace std;
int main()
{
int n;
cin>>n;
while(n--)
{
int sol=1;
long a,b,c;
cin>>a>>b>>c;
for(int x=-100;x<=100&/x++)
{
for(int y=x+1;y<=100&/y++)
{
for(int z=y+1;z<=100&/z++)
{
if(x+y+z==a&... | true |
8f3bf6fa18315b7ddde36869175c6f1362abe40a | C++ | KaynRO/C-Cpp | /C++-20181025T075829Z-001/C++/ALGORITMI/rege2/main.cpp | UTF-8 | 1,725 | 2.671875 | 3 | [] | no_license | #include <iostream>
#include <vector>
#include <fstream>
using namespace std;
const int maxn = 100005;
const int inf = (1 << 30);
vector <pair<int, int> > g[maxn];
int n, s, cnt, dp[maxn];
void dfs(int node, int father, int &energy)
{
dp[node] = -1;
for(auto it : g[node])
{
if(i... | true |
a6001388730ee39a2d8643f13e737a5286fceff0 | C++ | collisdecus/discover3d | /arcball.h | UTF-8 | 581 | 2.640625 | 3 | [
"MIT"
] | permissive | #ifndef ARCBALL_H
#define ARCBALL_H
#include <QtCore/QPointF>
#include <QtGui/QVector3D>
#include <QtGui/QQuaternion>
//! Arc ball rotation of the level
class ArcBall
{
public:
ArcBall(const QVector3D& axis);
void push(const QPointF& point, const QQuaternion &transformation);
void move(const QPointF& point, con... | true |
2aafbbdc4eab98e3f4bc353270b1498658219c18 | C++ | shrumo/rbggamemanager | /tests/arimaa_test.cc | UTF-8 | 9,061 | 2.53125 | 3 | [] | no_license | //
// Created by shrum on 30.06.19.
//
#include <game_state/construction/game_state_creator.h>
#include <utility/calculate_perft.h>
#include <utility/printer.h>
#include <iostream>
namespace {
using namespace rbg;
using namespace std;
const char *kArimaaGame = R"LIM(
// Arimaa
// -- The state after the move must be... | true |
1a75350403b056e48297612eff14599d233facea | C++ | bayanbatn/fcam | /include/FCam/TSQueue.h | UTF-8 | 16,834 | 3.078125 | 3 | [
"BSD-3-Clause",
"LicenseRef-scancode-unknown-license-reference"
] | permissive | #ifndef FCAM_TSQUEUE_H
#define FCAM_TSQUEUE_H
#include <deque>
#include <iterator>
#include <semaphore.h>
#include <pthread.h>
#include <errno.h>
#include <string.h>
#include "Base.h"
//#include "../../src/Debug.h"
/** \file
* A basic thread-safe queue using pthread mutexes to wrap a
* C++ STL queue. Convenient... | true |
53347a3850667e8db53cb30c32a400b40ee48c40 | C++ | mnofresno/temperature_wifi_logger | /FirmwareUpdater.h | UTF-8 | 589 | 2.515625 | 3 | [] | no_license | #ifndef __FIRMWARE_UPDATER_H__
#define __FIRMWARE_UPDATER_H__
#include <ESP8266WebServer.h>
typedef std::function<void(void)> THandlerFunction;
class FirmwareUpdater {
public:
void setup(const char* username, const char* password, ESP8266WebServer *server);
void handle();
private:
void setup_root_pat... | true |
4f4cd06a764a817ceeb688131429592f85a53bb1 | C++ | dimitarbez/JaniS | /Vezba 6/Buzzer-photoresistor_sensor/Buzzer-photoresistor_sensor.ino | UTF-8 | 1,017 | 2.8125 | 3 | [] | no_license | int lightPin = 0;
int led = 11;
long previousMillis = 0;
long interval = 100;
int buzzer=8;
// the setup routine runs once when you press reset:
void setup() {
// initialize the digital pin as an output.
pinMode(lightPin, OUTPUT);
pinMode(led, OUTPUT);
// open the serial port at 9600 bps:
Serial.begin(9600);
... | true |
ad64818f13350a84fc578f251204fae422b0547e | C++ | LeMinhTinh/Broblocks | /C++/Lambda/LambdaExpression.cpp | UTF-8 | 1,601 | 3.46875 | 3 | [] | no_license | #include "stdafx.h"
#include "iostream"
#include "LambdaExpression.h"
using namespace std;
void LambdaExpression::InOutLambdaExpression()
{
auto l = [] {
if (1)
{
std::cout << "hello lamb1" << std::endl;
}
else
{
std::cout << "hello lambda" << std::endl;
}
};
auto function = [](int a, int b)->i... | true |
222a29206ee08014509f6717288f86a36348653e | C++ | Sebastiaan-Alvarez-Rodriguez/Occulis | /src/Camera.cpp | UTF-8 | 2,034 | 3.0625 | 3 | [] | no_license | #include "Camera.h"
#include "error.hpp"
Camera::Camera() {
cam_update();
errCheck();
}
void Camera::rotate(rotdir d, float amt) {
switch (d) {
case rotdir::LEFT:
cam_phi -= amt;
break;
case rotdir::RIGHT:
cam_phi += amt;
break;
cas... | true |
c0cbc49d8f7fd5df691138edf5ef749638af87e1 | C++ | 123pk/100DaysCoding-Part-3 | /Day51/C - Reorder Cards.cpp | UTF-8 | 1,010 | 2.921875 | 3 | [] | no_license | /*
Platform :- Atcoder
Contest :- Atcoder Beginner Contest 213
Approach :- sort A and B separately and for pair A[i] and B[i] and store the rank of A[i] and B[i] when you sort them and print the rank.
*/
#include<bits/stdc++.h>
using namespace std;
int main(){
long long h,w;
int n;
cin>>h>>w>>n;
... | true |
a815f99fb7de6eb32848325325d88a653542c4d8 | C++ | Armstrm6/C-Semester-1 | /Lab 6/tesla.cpp | UTF-8 | 6,885 | 3.046875 | 3 | [] | no_license | #include <iostream>
#include <vector>
#include <stdlib.h>
#include <time.h>
#include <iomanip>
using namespace std;
void Start();
int Design();
int play();
char UMove();
int Emusk();
int bubble();
int Fail();
char Game[15][15];
char Obj[15][15];
int x=0;
int y=0;
int a1;
int a2;
int b1;
int b2;
... | true |
0ee1d8bfff819fad2d3452ad4b2b9c10fd8a3683 | C++ | yhyu13/Vulkan | /Include/Math/Quaternions.cpp | UTF-8 | 3,684 | 3.328125 | 3 | [] | no_license | #include "Quaternions.h"
Quaternions::Quaternions()
{
}
Quaternions::Quaternions(float X, float Y, float Z, float W): x(X), y(Y), z(Z), w(W)
{
}
void Quaternions::Normalize()
{
float mag = sqrtf( x * x + y * y + z * z + w * w );
x /= mag;
y /= mag;
z /= mag;
w /= mag;
}
Quaternions Quaternions::Normalized()
... | true |
d12c4ca54302b7b654e4485ddd1a52d392638ca7 | C++ | kkabdol/Cocos_DotPictures | /DotPictures/Classes/Dot.h | UTF-8 | 868 | 2.546875 | 3 | [] | no_license | //
// Dot.h
// DotPictures
//
// Created by Seonghyeon Choe on 12/31/12.
//
//
#ifndef DotPictures_Dot_h
#define DotPictures_Dot_h
#include "cocos2d.h"
class Dot : public cocos2d::CCSprite
{
public:
// Method 'init' in cocos2d-x returns bool, instead of 'id' in cocos2d-iphone (an object pointer)
virtual b... | true |
7920ae4bd5ce4dfc584abcc438ed7034592c4ae6 | C++ | mania14/ARCTIC | /GameEngine/Mesh.h | UTF-8 | 1,247 | 2.515625 | 3 | [] | no_license | #include "Component.h"
#include "../System/VertexDesc.h"
#include "../System/RenderDevice.h"
#include "../System/Texture.h"
#include <vector>
struct MeshBuffer;
struct Material;
class Mesh : public Component
{
public:
const static COMPONENTIDTYPE COMPONENTID = MESH_COMPONENT;
public:
enum TextureType {
TEXTURE_S... | true |
c705b703c964d3b2ca791a7fef7595620c531ef5 | C++ | jaggies/aed512emu | /lib/devices/generic.h | UTF-8 | 1,072 | 3.15625 | 3 | [] | no_license | /*
* genericperipheral.h
*
* Created on: Sep 15, 2018
* Author: jmiller
*/
#ifndef GENERICPERIPHERAL_H_
#define GENERICPERIPHERAL_H_
#include <functional>
#include "peripheral.h"
class Generic: public Peripheral {
public:
Generic(int start, int size,
const std::function<uint8_t... | true |
6daaee965045582b8c64ef6d7ea5748e4460d574 | C++ | Garcia6l20/cppcoro | /include/cppcoro/single_consumer_event.hpp | UTF-8 | 3,544 | 3.109375 | 3 | [
"MIT"
] | permissive | ///////////////////////////////////////////////////////////////////////////////
// Copyright (c) Lewis Baker
// Licenced under MIT license. See LICENSE.txt for details.
///////////////////////////////////////////////////////////////////////////////
#ifndef CPPCORO_SINGLE_CONSUMER_EVENT_HPP_INCLUDED
#define CPPCORO_SING... | true |
3febfdf53732696314686f830fdd87ae5ad15cf2 | C++ | LineageOS/android_hardware_interfaces | /authsecret/1.0/default/AuthSecret.cpp | UTF-8 | 1,496 | 2.515625 | 3 | [
"Apache-2.0"
] | permissive | #include "AuthSecret.h"
namespace android {
namespace hardware {
namespace authsecret {
namespace V1_0 {
namespace implementation {
// Methods from ::android::hardware::authsecret::V1_0::IAuthSecret follow.
Return<void> AuthSecret::primaryUserCredential(const hidl_vec<uint8_t>& secret) {
(void)secret;
// To ... | true |
c4f88e466815fe9813fa1319f9bd66d47033469f | C++ | ishandutta2007/Number_Theory_in_CP_PS | /11. more on multiplicative functions/min_25_sieve.cpp | UTF-8 | 5,184 | 2.640625 | 3 | [] | no_license | #include <bits/stdc++.h>
#define fio ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);
using namespace std;
typedef long long int ll;
typedef unsigned long long int ull;
typedef long double ldb;
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
const ll mod = 1e9 + 7;
/*
define a mul... | true |
41133d7525569916bfab83675d6ff8ba83046dec | C++ | WeiChienHsu/CS165 | /Notes_Week9/Stack/DynIntStack.hpp | UTF-8 | 935 | 3.765625 | 4 | [
"MIT",
"LicenseRef-scancode-other-permissive"
] | permissive | #include <iostream>
class DynIntStack
{
protected:
struct StackNode
{
int value;
StackNode *next;
StackNode(int value, StackNode *next = nullptr) {
this->value = value;
this->next = next;
}
};
StackNode *top;
public:
DynIntStack() { top = nullptr; }
~DynIntStack();
void p... | true |
5589ae21939a6cfdf5459e0f717dc2b4f7061e2a | C++ | matchallenges/Portfolio | /2021/C++Daily/step_function.cpp | UTF-8 | 359 | 3.328125 | 3 | [] | no_license | #include <cstdio>
int step_function(int x){
int result = 0;
if (x < 0) result = -1;
else if (x > 0) result = 1;
else result = 0;
return result;
}
int main(){
int num1 = 42;
int num2 = -5;
int num3 = 0;
printf("%d %d %d", step_function(num1), step_function(num2), step_function(num3)... | true |
1060b0b756aec3858c21885fd729d217fa7bfa22 | C++ | karlnapf/graphlab | /apps/kernelbp/gather_type.hpp | UTF-8 | 1,113 | 2.75 | 3 | [
"LicenseRef-scancode-unknown-license-reference",
"Apache-2.0"
] | permissive | #ifndef GATHER_TYPE_H
#define GATHER_TYPE_H
#include <map>
using namespace std;
#include <Eigen/Dense>
using namespace Eigen;
struct gather_type {
// sets of kernelbp message sources and targets (oposite edge direction)
map<vertex_id_type, VectorXd> message_source_betas;
set<vertex_id_type> message_targets;
ga... | true |
b34ecb5671a1ae795704e32d93e6be8ca61b0ee4 | C++ | intijk/airnord | /src/firmware/light.h | UTF-8 | 491 | 3.046875 | 3 | [] | no_license | #ifndef LIGHT_H
#define LIGHT_H
class light{
public:
void attach(int lightPin);
void LightOn(float amp);
void LightOff();
private:
int pin;
};
void light::attach(int lightPin){
pin=lightPin;
pinMode(lightPin,OUTPUT);
}
void light::LightOn(float amp){
Serial.println(amp);
//### should judg... | true |
80f62dff7337cd8a22e21541c6a96e80e67aa75c | C++ | amolgautam25/leetcode_solution | /maximum-width-of-binary-tree.cpp | UTF-8 | 1,643 | 3.3125 | 3 | [] | no_license | //
// Created by agautam on 7/21/20.
//
/**
* Definition for a binary tree node.
* struct TreeNode {
* int val;
* TreeNode *left;
* TreeNode *right;
* TreeNode() : val(0), left(nullptr), right(nullptr) {}
* TreeNode(int x) : val(x), left(nullptr), right(nullptr) {}
* TreeNode(int x, Tre... | true |
8f5324c3f036098a78ae6234ff6590a12a84a7a9 | C++ | amoghrajesh/Coding | /delete_nodes_ll.cpp | UTF-8 | 378 | 3.21875 | 3 | [] | no_license | class Solution {
public:
ListNode* removeElements(ListNode* head, int val) {
ListNode s(0);
s.next = head;
ListNode *cur = head, *prev = &s;
while(cur) {
if(cur->val == val)
prev->next = cur->next;
else
prev = cur;
... | true |
106f75c770a6ab3378c1a60b320efb5bbe86e9fb | C++ | neurodata/SPORF | /packedForest/src/baseFunctions/displayProgress.h | UTF-8 | 1,067 | 2.90625 | 3 | [] | permissive | #ifndef fpDisplayProgress_h
#define fpDisplayProgress_h
#include <chrono>
#include <ctime>
namespace fp {
//TODO these two classes can be merged into one.
class fpDisplayProgressStaticStore{
private:
std::chrono::time_point<steady_clock> startTime;
std::chrono::time_point<steady_clock> stopTime;
std::... | true |
494fd695dd707c726c4822c7bbd960d6fa356238 | C++ | Likilee/cpp_module | /cpp05/ex02/ShrubberyCreationForm.hpp | UTF-8 | 680 | 2.59375 | 3 | [] | no_license | #ifndef SHRUBBERYCREATIONFORM_HPP
# define SHRUBBERYCREATIONFORM_HPP
# include "Form.hpp"
# include "fstream"
class ShrubberyCreationForm : public Form
{
private:
std::string const _target;
ShrubberyCreationForm();
void drawTree(std::ofstream &fout) const;
public:
ShrubberyCreationForm(std::string const &target);... | true |
f69809cc0cb0772ceb1ffddf37a1cfa893348e89 | C++ | FreshMutroom/UE4-RTS | /Source/RTS_Ver2/Statics/DevelopmentStatics.cpp | UTF-8 | 7,815 | 2.515625 | 3 | [] | no_license | // Fill out your copyright notice in the Description page of Project Settings.
#include "DevelopmentStatics.h"
#include "Engine/LocalPlayer.h"
#include "Widgets/SViewport.h"
DEFINE_LOG_CATEGORY(RTSLOG);
void DevelopmentStatics::BreakpointMessage()
{
#if PRINT_DEBUG_MESSAGES
FColor Color = FColor(0, 0, FMath::Rand... | true |
de19298d2f938eed8fdf50e706d5182bf31dbeb1 | C++ | collingros/cs-371-project | /arduino/Temp_Test_2.ino | UTF-8 | 2,418 | 2.75 | 3 | [] | no_license | // Libraries needed for the Transceiver
#include <SPI.h>
#include <nRF24L01.h>
#include <RF24.h>
// Variable for LED
#define LED 2
// Our 2 RF24 Objects
RF24 radio(7, 8); // CE, CSN
// Address we will be using for communication
const byte address[6] = "00101";
// Function for incoming transmission
... | true |
99ea375e495ca3eb78390ec1e9a6cf226690fd60 | C++ | junes7/CPPalgorithm | /c++_programming/Part4_Completion of OOP/chapter10/Question/10-2/Q1.cpp | UTF-8 | 582 | 3.5 | 4 | [] | no_license | #include<iostream>
using namespace std;
class Point{
private:
int xpos,ypos;
public:
Point(int x,int y):xpos(x),ypos(y){}
void ShowPosition() const{cout<<"["<<xpos<<", "<<ypos<<"]"<<endl;}
Point operator-(){
Point pos(-xpos,-ypos);
return pos;
}
friend Point operator~(const Point... | true |
897872db5cf68cff092f2d2714ec49df4e0694ff | C++ | Mrhb787/Algorithms-Analysis | /Sorting Algorithms Analysis/n^2 family/TC-generator.cpp | UTF-8 | 1,852 | 3.390625 | 3 | [] | no_license | #include <iostream>
#include <fstream>
#include <time.h>
using namespace std;
int main()
{
while (1)
{
cout << "Press 1 for Best Case | ";
cout << "Press 2 for Worst Case | ";
cout << "Press 3 for Random Case \n";
int f;
cin >> f;
if (f == 1)
{
... | true |
31cf9876b9054907f148ae3a8cc59ea0061cb6fb | C++ | tentone/cork | /source/cork_analyser.hpp | UTF-8 | 6,858 | 2.78125 | 3 | [
"MIT"
] | permissive | #pragma once
#include <iostream>
#include <opencv2/core.hpp>
#include <opencv2/imgproc.hpp>
#include <opencv2/highgui.hpp>
#include <opencv2/videoio.hpp>
#include <opencv2/imgcodecs.hpp>
#include "cork_config.hpp"
#include "threshold.hpp"
#define PI 3.14159265359
#define DEBUG_DEFECTS true
#define MEASURE_PERFORM... | true |
0c9b1d59a84aba6086b3a3c68c20d819f394e518 | C++ | Poirault/SpeedRunnerManager | /SpeedRunManager/joueur.cpp | UTF-8 | 1,453 | 2.796875 | 3 | [] | no_license | /*!
* \class Joueur joueur.h
* \brief la class joueur est une liste des joueurs
*/
#include "joueur.h"
/*!
* \brief Joueur::Joueur constructeur de base
*/
Joueur::Joueur()
{
count = 0;
}
void Joueur::rename(QString name){
this->nom=name;
}
void Joueur::newfavorite(Jeu fav){
this->jeu_prefere=&fav;... | true |
827a8829219e330dac5ceeb5bc00d8cfb0257cdc | C++ | showmic96/Online-Judge-Solution | /LightOJ/1066/8719152_AC_12ms_1704kB.cpp | UTF-8 | 2,836 | 2.765625 | 3 | [] | no_license | // In the name of Allah the Lord of the Worlds.
#include<bits/stdc++.h>
using namespace std;
const int MAX = 13;
char ar[MAX+9][MAX+9];
int level[MAX+9][MAX+9] , check;
int c = 0;
int n , counter = 0;
bool isAlpha(char x)
{
//cout << "Char " << x << endl;
if(x>='A'&&x<='Z'){return true;}
return false;
}
... | true |
1df4346ebef1445c4bd78a6a4f4deb3691f635da | C++ | gabrielboroghina/BrickBreaker | /Source/BrickBreaker/Walls.h | UTF-8 | 412 | 2.96875 | 3 | [] | no_license | #pragma once
#include "Core/GPU/Mesh.h"
namespace Object
{
/**
* Object containing the three walls placed on the left, right and top of the game area.
*/
class Walls
{
public:
static constexpr float thickness = 15;
float verticalHeight, topWallWidth;
Mesh *meshLeft, *meshRight, *meshTop;
Walls(glm::vec2 viewpo... | true |
c3f25dcb15bf149211d0050570a6f557e7767afd | C++ | joshuaanrico/Algoritma-Struktur-Data | /prak asd/[c]AntrianRibet.cpp | UTF-8 | 2,258 | 3.25 | 3 | [] | no_license | #include <iostream>
#include <stdlib.h>
using namespace std;
typedef int infotype;
typedef struct Node* address;
typedef struct Node {
infotype x;
address next;
}List;
typedef struct {
address head;
address tail;
}Queue;
void createempty(Queue *Q) {
Q->head= NULL;
Q->tail= N... | true |
08baed30930a22a8ffd2efb1be009b90d548598e | C++ | liuzhengzhe/leetcode | /17.cpp | UTF-8 | 1,202 | 3.21875 | 3 | [] | no_license | #include <iostream>
#include <vector>
using namespace std;
class Solution {
public:
vector<string> ret;
string convert(char c){
switch(c){
case '0':
return " ";
case '1':
return "";
case '2':
return "abc";
ca... | true |
1cf79b0ad00199fd9ef5573f4199e494e350409c | C++ | cvra/robot-software | /hitl/PhysicsRobot.cpp | UTF-8 | 2,006 | 2.796875 | 3 | [
"MIT"
] | permissive | #include "PhysicsRobot.h"
PhysicsRobot::PhysicsRobot(b2World& world, float size_x, float size_y, float mass, float pulse_per_mm, b2Vec2 initial_pos, float heading)
: size_y(size_y)
, pulse_per_mm(pulse_per_mm)
, pos_left(0.f)
, pos_right(0.f)
{
b2BodyDef robotDef;
robotDef.type = b2_dynamicBody... | true |
902ceec2b4e4d14513f8a38bd02a30f210eb20f0 | C++ | mgula/cisc361proj | /Node.cpp | UTF-8 | 2,110 | 3.640625 | 4 | [] | no_license | /*
* Marcus Gula
* Thomas Nelson
* CISC 361
* Project 1
*
*/
#include <iostream>
#include <stdlib.h>
#include "Node.h"
using namespace std;
/*Traverse the system node and print information*/
void printSystem(Node *list) {
Node *temp = list;
if (temp->next == NULL) {
cout << "No jobs have arrived yet." << e... | true |
39eb16b2c1668b0f5ac42501a1c1a1e5d2d8528f | C++ | desperadoray/POJ | /矩阵乘方和.cpp | WINDOWS-1252 | 1,899 | 3.125 | 3 | [] | no_license | #include <iostream>
using namespace std;
int n, k, m;
int matrix[31][31] = {0};
void Matrix_Add(int a[31][31], int b[31][31], int c[31][31])
{
for (int i = 0; i < n; i++)
for (int j = 0; j < n; j++)
c[i][j] = (a[i][j] + b[i][j]) % m;
}
void Matrix_Multiply(int a[31][31], int b[31][31], int c[31][31])
{
for (i... | true |
1957b5d7b2da794014780115a2dbf8679d9b2af5 | C++ | RMariowski/Graphics-and-multimedia-laboratory | /11 - Morphing/Triangle.cpp | UTF-8 | 864 | 2.84375 | 3 | [
"MIT"
] | permissive | #include "Triangle.h"
#include <QColor>
Triangle::Triangle()
: _image(0)
{
}
Triangle::Triangle(QImage* image, const QList<Marker>& markers)
: _image(image)
{
for (int i = 0; i < 3; i++)
_vertices[i] = QVector2D(markers[i].getX(), markers[i].getY());
}
Triangle::Triangle(QVector2D v1, QVector2D v... | true |
554082aabcc4cabad97207903830c606b545d516 | C++ | Dhurjati-Prasad-Das/Programs_basic_c-_visual-studio | /MISC_Class_iss.cpp | UTF-8 | 348 | 3.203125 | 3 | [] | no_license | #include<iostream>
using namespace std;
class example{
private:
int data;
static int count;
public:
example();
void display() const;
};
int example::count=10;
example::example(){
data=0;
}
void example::display() const{
cout<<endl<<"count="<<data<<count;
}
int main(){
example d;
... | true |
9a1c4140fabc763918ad284df2bbe63d553dc3f0 | C++ | Tonin386/MvisualizerPP | /classes/particlecluster.cpp | UTF-8 | 3,133 | 2.515625 | 3 | [] | no_license | #include "particle.hpp"
#include "particlecluster.hpp"
#include "note.hpp"
#include "../constants.hpp"
#include <random>
#include <cmath>
#include <iostream>
#include <stdio.h>
#include <stdlib.h>
using namespace sf;
using namespace std;
ParticleCluster::ParticleCluster(Note* parentNote, int protocol, Color color)... | true |
37ec97af272eceb8ed9a64c6eacdb202a0d5ec45 | C++ | siddharthshenoy/LEET | /count-primes/count-primes.cpp | UTF-8 | 431 | 2.796875 | 3 | [
"MIT"
] | permissive | class Solution {
public:
int countPrimes(int n) {
vector<bool> sieve(n, true);
for (int i = 2; i <= sqrt(n); ++i) {
if (sieve[i]) {
for (int ii = i*i; ii < n; ii += i) {
sieve[ii] = false;
}
}
}
int... | true |
b0f3f0bba8918c9c2c50a54ece0a3d39ba73d800 | C++ | ElementAyush/Code | /OnlineJudges/Hackerrank/Lily's Homework/main.cpp | UTF-8 | 682 | 2.828125 | 3 | [] | no_license | #include <bits/stdc++.h>
using namespace std ;
int solve(vector<int> vec)
{
int count = 0 ;
map<long , long> keyPair ;
for(int i = 0 ; i < vec.size() ; i++)
keyPair[vec[i]] = i ;
vector<int> sorted ;
sorted = vec ;
sort(sorted.begin() , sorted.end()) ;
for(int i = 0 ; i < vec.size() ; i++)
{
if... | true |
851e93a4a08a4d27fbe913efe7ef09fb00c580a5 | C++ | o2themar/cse471Synthesizer | /Step5/Synthie/NoiseGate.h | UTF-8 | 340 | 2.59375 | 3 | [] | no_license | #pragma once
#include "audionode.h"
class CNoiseGate :
public CAudioNode
{
public:
CNoiseGate(void);
~CNoiseGate(void);
virtual void Start();
virtual bool Generate();
void SetNode(CAudioNode* node) { m_node = node; }
void SetThreshold(short thresh) { m_threshold = thresh; }
private:
CAudioNode* m_node;
sho... | true |
d22498e96321c3a6a445f91ccb72735c881e9403 | C++ | Eleveneat/myCpp | /Sicily/1034_Forest/1034.cpp | UTF-8 | 2,566 | 2.875 | 3 | [] | no_license | /*
* Filename: 1034.cpp
* Description: NULL
* Last modified: 2016-01-09 22:14
*
* Created by Eleven on 2016-01-09
* Email: eleveneat@gmail.com
* Copyright (C) 2015 Eleven. All rights reserved.
*/
#include <iostream>
#include <cstring>
#include <cstdio>
#include <vector>
#define MAX 110
using namespa... | true |
a5485cb61beb041610b11a9b0b11e67bab3d13ae | C++ | dvetutnev/boost-di-example | /di/test_group.cpp | UTF-8 | 2,073 | 2.546875 | 3 | [
"MIT"
] | permissive | #include "group.h"
#include "mocks.h"
#include <gtest/gtest.h>
using ::testing::Return;
using ::testing::ReturnRef;
using ::testing::ByMove;
using ::testing::InSequence;
namespace di = boost::di;
namespace {
const auto ssid = Ssid{"Casiopea"};
auto config = []() {
return make_injector(
di::bind<IFac... | true |
d168efb41d9610f5e0ff63931b9b192c4f90bbfa | C++ | SimaoAraujo/ScopeMainProcess | /text.cpp | UTF-8 | 2,456 | 2.59375 | 3 | [] | no_license | #include "text.h"
CText* CText::instance = nullptr;
CText* CText::getInstance()
{
if(!instance)
instance = new CText();
return instance;
}
int CText::recordCount = 0;
CText::CText()
{
}
CText::~CText()
{
}
int CText::getRecord()
{
string sLastRecordCount;
int iLastRecordCount;
ifstr... | true |
4f04b9dd2b6c70b14fd15c00169a24b5b1949135 | C++ | hubartstephane/Code | /libraries/chaos/include/chaos/Gameplay/GameParticles.h | UTF-8 | 3,293 | 2.6875 | 3 | [] | no_license |
namespace chaos
{
#ifdef CHAOS_FORWARD_DECLARATION
class ParticleBackground;
class ParticleBackgroundLayerTrait;
#elif !defined CHAOS_TEMPLATE_IMPLEMENTATION
// ===========================================================================
// Background particle system
// ===============================... | true |
e1500ec917f9fa9ac2d7d5d288f20cbf5b2957d8 | C++ | ddeuber/RandAlign | /samfile.cpp | UTF-8 | 3,055 | 2.734375 | 3 | [] | no_license | #include "samfile.h"
#include <iostream>
SAMFile::SAMFile(std::string const &fileName, std::string const &refSeqName, int refSeqLength){
file.open(fileName);
file << "@HD\tN:1.4\tSO:unsorted";
for (int i=0; i<8; ++i)
file << tab;
file << endline;
file << "@SQ\tSN:" << refSeqName << "\tLN:" << refSe... | true |
ec5fd11f73aef1e58ae655145d00f47ab60475a2 | C++ | chenwei182729/code | /C/niu/剑指offer/二维数组中值得查找.cpp | GB18030 | 1,461 | 3.5 | 4 | [] | no_license | #include<iostream>
#include<vector>
using namespace std;
class Solution {
public:
bool Find(vector<vector<int> > array,int target) {
bool found = false;
if(array.size() > 0 && array[0].size() > 0)
{
int rows = array.size(),columns = array[0].size(),row = 0, column = columns - 1 ;
while(row < rows ... | true |
62867294c7cdd1cefe08a7bd30c7c7a3625f2e24 | C++ | rhayatin/C-- | /DCEPC201.cpp | UTF-8 | 1,152 | 2.78125 | 3 | [] | no_license | #include<iostream>
#include<string.h>
#include<stdio.h>
using namespace std;
char str[20],str1[20];
int ans=1000,cnt=1000,len,kill_task=0;
int toggle(int a)
{
if(str[a]=='1')
str[a]='0';
else
str[a]='1';
}
int swap_index(int a)
{
if(a!=0)
toggle(a-1);
toggle(a);
if(a!=len-1)
toggle(a+1);
}
int find_a... | true |
d9094f949207f2e372306d65ae49828302674166 | C++ | yuanyewa/learnsystemc | /basic/06_time/time.cpp | UTF-8 | 1,292 | 2.578125 | 3 | [] | no_license | // Yuanye Wang, 2020, MIT license
#include <systemc>
using namespace sc_core;
int sc_main(int, char*[]) {
sc_core::sc_report_handler::set_actions( "/IEEE_Std_1666/deprecated",
sc_core::SC_DO_NOTHING ); // suppress warning due to set_time_resolution
sc_set_time_resolution(1,... | true |
c3b70f25ed6f797a1fd6eaa2e8ae30ff1e581616 | C++ | therocode/space | /src/tableutil.hpp | UTF-8 | 546 | 2.59375 | 3 | [] | no_license | #pragma once
#include <thero/optional.hpp>
#include "insert.hpp"
template <typename DataType>
th::Optional<int32_t> tableEmplaceOptional(int32_t id, th::Optional<DataType> data, DataTable<DataType, true>& table)
{
if(data)
return insert(id, std::move(*data), table).id;
else
return {};
}
templa... | true |
ab0c720f56265444c6f4f9b4f5b8a3efcb04d3cd | C++ | mrjai24/Code-Samples--C-- | /SFML_Template/SFML_Template/SFML_Template/include/Bullet.h | UTF-8 | 529 | 2.640625 | 3 | [] | no_license | #pragma once
//Adding in additional libraries.
#include <SFML/Graphics.hpp>
#include <SFML/System.hpp>
#include <SFML/Window.hpp>
#include <iostream>
using namespace std;
using namespace sf;
class Bullet
{
private:
//Variables.
Sprite sprite;
Vector2f direction;
float fBulletSpeed;
public:
//Constructor.
Bul... | true |
7ff24fac4171d1be48ae60588aab06ef73634e45 | C++ | ashwani65/Coding-Interview-Prepration | /3)-Recursion/A3firstoccur.cpp | UTF-8 | 433 | 2.875 | 3 | [] | no_license | #include<iostream>
using namespace std;
#define rep(i,n) for(int i=0;i<(n);i++)
int first(int a[], int n, int x)
{
if(n==0)
return -1;
if(a[0]==x)
return 0;
int ans= first(a+1,n-1,x);
if(ans!=-1){
return ans+1;
} else{
return ans;
}
}
int main()... | true |
16971777a9541740c8343910f3c96d2e1405aa6c | C++ | IHR57/Competitive-Programming | /CodeForces/573A-1.cpp | UTF-8 | 816 | 2.5625 | 3 | [] | no_license | #include <bits/stdc++.h>
#define MAX 100005
using namespace std;
typedef long long ll;
int main()
{
ios::sync_with_stdio(0), cin.tie(0), cout.tie(0);
ll n, value, t;
cin>>n;
cin>>value;
t = value;
ll result = 1;
while(value % 2 == 0){
value /= 2; result *= 2;
}
while(val... | true |
56bdfab175133e01ef286bbdc108cf766202ab59 | C++ | esdream/AIEngineer | /julyDSA/STL/heap.cpp | UTF-8 | 2,130 | 3.890625 | 4 | [] | no_license | #include <iostream>
#include <vector>
#include <algorithm> // 引入algorithm头文件才能使用heap相关操作
using namespace std;
bool compareLess(int num1, int num2)
{
return num1 > num2;
}
int main()
{
vector<int> v{6, 1, 2, 5, 3, 4};
cout << "source vector: ";
for (auto val : v)
{
cout << val << ",";
}... | true |
84772ca67d8e09594cc794fc38e5591e7222a477 | C++ | AnupamDas054/competitve-programming | /codeforces/1130A.cpp | UTF-8 | 770 | 2.515625 | 3 | [] | no_license | #include<bits/stdc++.h>
using namespace std;
int main()
{
int n;
cin>>n;
int m=0,r=0;
for(int i=0;i<n;i++)
{
int k;
cin>>k;
if(k==0)
{
}
else if(k<0)
{
m++;
}
else
{
r++;
}
}
/... | true |
289c48947da094a504ac6f93aca915715a8a2f35 | C++ | Orochisun/CattleCorn | /main.cpp | GB18030 | 7,867 | 2.640625 | 3 | [] | no_license | #include<iostream>
#include<cstdio>
#include<cstring>
#include<cstdlib>
using namespace std;
#define MAX_CAILD_NODES 9
#define RED 0
#define BLUE 1
#define REDSTONE 0
#define BLUESTONE1 1
#define BLUESTONE2 2
#define MAXDEPTH 10
#define MAX 1
#define MIN -1
#define INV -1
int alpha, bate;
in... | true |
5bf473b9b99b63eaab923556f1dbbe5676f9c056 | C++ | fyang26/leetcode | /c++/product-of-array-except-self.cpp | UTF-8 | 374 | 2.625 | 3 | [] | no_license | class Solution {
public:
vector<int> productExceptSelf(vector<int>& nums) {
int mul = 1;
int n = nums.size();
vector<int> res(n, 1);
for (int i=1; i<n; i++)
res[i] = res[i-1] * nums[i-1];
for (int i=n-1; i>=0; i--) {
res[i] = mul * res[i];
... | true |
007e0ff9aa5c2dd5e1a71c953efa2af7ee27cb96 | C++ | oahugrown/PlatEngine | /GameObject/GameObjectComponents/ComponentObject.h | UTF-8 | 1,562 | 2.984375 | 3 | [] | no_license | // ComponentManager.h
#ifndef COMPONENTMANAGER_H
#define COMPONENTMANAGER_H
#ifdef PLATENGINE_EXPORTS
#define COMPONENTOBJECT_H __declspec(dllimport)
#else
#define COMPONENTOBJECT_H __declspec(dllexport)
#endif
#include"Component.h"
#include <unordered_map>
// List of all component types that PlatEngine currently... | true |
68bda6ba3f928d0ac87055ca79876f5f09c9dff2 | C++ | gzc/leetcode | /cpp/431-440/Minimum Genetic Mutation.cpp | UTF-8 | 1,113 | 2.796875 | 3 | [
"MIT"
] | permissive | class Solution {
public:
int minMutation(string start, string end, vector<string>& bank) {
queue<string> toVisit;
unordered_set<string> dict(bank.begin(), bank.end());
int dist = 0;
if(!dict.count(end)) return -1;
toVisit.push(start);
dict.insert(sta... | true |
93830907b22f18c29c6d931d98d6ae856d017bda | C++ | neuronsimulator/nrn | /src/scopmath/revsawto.cpp | UTF-8 | 1,768 | 2.65625 | 3 | [
"BSD-3-Clause"
] | permissive | #include <../../nrnconf.h>
/******************************************************************************
*
* File: revsawto.c
*
* Copyright (c) 1984-1991
* Duke University
*
******************************************************************************/
#include "scoplib.h"
#include <cmath>
/***************... | true |
ff0ab1994c852fcba751e40df783f9f6ed67411b | C++ | suyuee/LC | /841.keys-and-rooms.cpp | UTF-8 | 1,949 | 3.421875 | 3 | [] | no_license | /*
* @lc app=leetcode id=841 lang=cpp
*
* [841] Keys and Rooms
*
* https://leetcode.com/problems/keys-and-rooms/description/
*
* algorithms
* Medium (60.61%)
* Total Accepted: 39.4K
* Total Submissions: 64.8K
* Testcase Example: '[[1],[2],[3],[]]'
*
* There are N rooms and you start in room 0. Each ro... | true |
3919250be9ce0de519f22cb752ae5fa0328703c4 | C++ | sdecoder/geeksforgeeks | /misc/petersons-algorithm-for-mutual-exclusion-set-1.cc | UTF-8 | 2,491 | 3.234375 | 3 | [] | no_license | // Filename: peterson_spinlock.c
// Use below command to compile:
// gcc -pthread peterson_spinlock.c -o peterson_spinlock
#include <stdio.h>
#include <pthread.h>
#include "mythreads.h"
int flag[2];
int turn;
const int MAX = 1e9;
int ans = 0;
void lock_init() {
// Initialize lock by reseting the desire of
// bot... | true |
a3131c74e3f63d775b53880f194edc48b900ab1f | C++ | unmeshvrije/leetcode | /leetcode/UniqueBinarySearchTreesII.cpp | UTF-8 | 1,360 | 3.625 | 4 | [] | 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 {
private:
vector<TreeNode*> all_trees(vector<int>& roots, int start, int end)... | true |
05a56437b08bdbff4dd721b4bdd09f99ce156d51 | C++ | JohanJacobs/Head_First_Design_Patterns | /Chapter6_Command_Pattern/src/Core/Base.h | UTF-8 | 290 | 2.875 | 3 | [
"MIT"
] | permissive | #pragma once
#include <memory>
// template functions to help create Shared_ptr objects
template<typename T>
using Ref = std::shared_ptr<T>;
template <typename T, typename ... Args>
constexpr Ref<T> CreateRef(Args&& ... args)
{
return std::make_shared<T>(std::forward<Args>(args) ...);
}
| true |