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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
20d61003c7b4a35a96d825dff4d6bc7d810aba25 | C++ | bonfab/model_selection_abc | /GB_vs_NN/sample_bernoulli_matrix.cpp | UTF-8 | 1,284 | 2.671875 | 3 | [] | no_license |
#include "Rcpp.h"
using namespace Rcpp;
// [[Rcpp::export]]
NumericVector bernoulli_matrix(NumericMatrix prob_matrix){
int nrow = prob_matrix.nrow();
int ncol = prob_matrix.ncol();
int var_sum = 0;
int count1, count2, sum;
double mean, variance, val;
NumericVector variance_flags(ncol);
for(int j=0; j<nco... | true |
c3fcf663ab732bc79dff733e0d8d93b7b6faafe7 | C++ | lethe2211/aoj | /1002.cpp | UTF-8 | 1,463 | 3.125 | 3 | [] | no_license | #include <iostream>
#include <string>
using namespace std;
int main() {
int t;
int n;
string data;
bool shelf[21000];
int count;
int left, right;
cin >> t;
for(int i = 0;i < t;i++) {
cin >> n;
cin >> data;
for(int i = 0;i < (int)(sizeof(shelf) / sizeof(shelf[0]));i++) {
she... | true |
0abf5cdf7455629227f9c703d877825aeb96036e | C++ | ymkjp/coc | /Classes/BuildingDefense.h | UTF-8 | 1,400 | 2.546875 | 3 | [] | no_license | #ifndef __BUILDING_DEFENSE_H__
#define __BUILDING_DEFENSE_H__
#include "cocos2d.h"
USING_NS_CC;
#include "Definitions.h"
#include "Building.h"
class BuildingDefense : public Building
{
public:
float minRange;
float maxRange;
static void updateAttackRangeGrid(Tmx* tmx);
bool startScan();
... | true |
6edc65a23b8adaa00edd0a53f664751c8e0ee078 | C++ | wbzhang233/interviews_2020_fall | /netease0927/2.cpp | UTF-8 | 3,016 | 2.984375 | 3 | [] | no_license | //
// Created by wbzhang on 2020/9/27.
//
#include <iostream>
#include <vector>
#include <map>
#include <string>
using namespace std;
const int maxN = 1e5 + 100;
const int maxNF = 1e6 + 100;
enum OpType {
open,
dup,
dup2,
close,
query
};
OpType getOpType(string &command) {
string com;
for (auto ele:command)... | true |
6da172a8251822c71fa132645e6e7cb886648fc5 | C++ | shreyansh26/CLRS_Algorithms | /Chapter12-BinarySearchTree/simplebst.cpp | UTF-8 | 2,906 | 4.15625 | 4 | [
"MIT"
] | permissive | #include <iostream>
#include <stdlib.h>
using namespace std;
struct node {
int key;
struct node *left, *right;
};
struct node* newNode(int data){
struct node* node = (struct node*)malloc(sizeof(struct node));
node->key = data;
node->left = NULL;
node->right = NULL;
return node;
}
struct node* insert(st... | true |
6a636f788fb3bb32f41297305bb7cc227b0d571e | C++ | zhanglongtumi/nQmlOpenCV | /videoimageprovider.cpp | UTF-8 | 2,374 | 2.59375 | 3 | [] | no_license | #include "videoimageprovider.h"
#include <QDebug>
#include "iostream"
#include "stdio.h"
#include "highgui.h"
#include "cv.h"
#include <QTimer>
#include <QImage>
#include <QPainter>
#include "opencv.hpp"
#include <opencv2/highgui/highgui.hpp>
#include <opencv2/imgproc/imgproc.hpp>
#include <opencv2/core/core.hpp>
us... | true |
7e61702b0a09b2322fca408f7070c12d757bf150 | C++ | djairjr/RECON21 | /Puzzle_Pseudo_Code_Detailed_v2.ino | UTF-8 | 1,870 | 2.703125 | 3 | [
"CC0-1.0"
] | permissive | /*
* Puzzle Pseudo Code Detailed v2
*
* This is code for the All-in-One Cabinet Mag Lock puzzle.
*
* The tutorial for this puzzle was originally presented at RECON '21 during the "How to Build and Refine Your First Escape Room Tech Puzzle"
*
*
* Created 2021
* by Karmisha Jawell https://github.com/misha2oh... | true |
a250a5886e05e789147de48b18a97716685d0a7c | C++ | AkimotoAkira0102/cpp-education-manual | /ch8-array&string/ch8-17.cpp | UTF-8 | 457 | 3.1875 | 3 | [] | no_license | #include <iostream> //include iostream files
#include <cstdlib> //include cstdlib files
#include <string> //include string files
using namespace std; //use namespace std
int main(void){ //begining of main block
string first = "Junie";
string last = "Hong";
cout << "Full name =" << first + " " + last << e... | true |
765b95e17290bfcab43b20ee37f4b6b4736d464f | C++ | luerera1/leetcode | /牛客网真题/序列交换/Project1/Project1/源.cpp | UTF-8 | 447 | 2.765625 | 3 | [] | no_license | #include<iostream>
#include<algorithm>
using namespace std;
int main(){
int n;
cin >> n;
long int a[n];
int count = 0;
for (int i = 0; i<n; i++){
cin >> a[i];
if (a[i] % 2 == 1) count++;
}
if (count == 0 || count == n){
for (int i = 0; i<n - 1; i++)
cout << a[i] << " ";
cout << a[n - 1] << endl;
}
e... | true |
76f56f69f4abda76924a6ae6cafb616fd5947ef8 | C++ | thoasm/customized_precision_pagerank | /code/macros.hpp | UTF-8 | 4,680 | 2.625 | 3 | [
"BSD-3-Clause"
] | permissive | #ifndef MACROS_HPP
#define MACROS_HPP
#include <utility>
#ifdef __CUDACC__
#define MY_ATTRIBUTES __host__ __device__
#define MY_INLINE __forceinline__
#define MY_RESTRICT __restrict__
#else
#define MY_ATTRIBUTES
#define MY_INLINE inline
#define MY_RESTRICT __restrict__
#endif // __CUDACC__
namespace macros {
temp... | true |
74e8020e5d4adca84e0909988ee1d8fe40c54058 | C++ | rahuls98/cpp-ladder | /Intermediate-CPP/dynamic_memory.cpp | UTF-8 | 529 | 3.640625 | 4 | [] | no_license | #include <iostream>
#define log(x, y) {std::cout<<x<<": "<<y<<std::endl;}
int main() {
/* creating and allocating required memory in heap */
int *ptr = new int;
log(ptr, *ptr); //0x7fbf0e401820: 0
/* setting value in the memory location */
*ptr = 5;
log(ptr, *ptr); //0x7fbf0e401820: 5
/* ... | true |
d31294abe0da48f5a3dd1d0742f6de2b69d41d12 | C++ | kostasli/Simple-Cpp-Program | /UserRating.cpp | UTF-8 | 474 | 3.03125 | 3 | [] | no_license | #include "UserRating.h"
#include <iostream>
UserRating::UserRating(unsigned int appNumOfStars, const char* appUserName, string appComments)
{
if (appNumOfStars <= 5)
{
stars = appNumOfStars;
name = appUserName;
comms = std::move(appComments);
}
else
{
cout<<"You must en... | true |
bfd294887364b16167419e9f9149c1aa1c01eb80 | C++ | codedaotu/offer | /最长连续数字.cpp | UTF-8 | 433 | 2.96875 | 3 | [] | no_license | #include<iostream>
using namespace std;
#include<vector>
int longest_1(vector<int> &a)
{
vector<int> dp(a.size(),1);
int k=1;
for (int i = 1; i < a.size(); i++)
{
if(a[i]==a[i-1])dp[i]=max(dp[i-1],++k);
else
{
dp[i]=dp[i-1];
k=1;
}
cout<<dp[i]<<endl;
}
cout<<dp[a.size()-1];
return 0;
}
int m... | true |
2497ae38f2c665aa7927886af97c57ec2c818e06 | C++ | WuNianLuoMeng/Tutorial | /src/剑指offer/复杂链表复制/clone_list.cpp | UTF-8 | 2,978 | 3.53125 | 4 | [] | no_license | #include <cstdio>
#include <cstdlib>
#include <iostream>
#include <algorithm>
using std::cin;
using std::cout;
using std::endl;
struct Node
{
struct Node *next;
struct Node *sibling;
int data;
};
struct List
{
struct Node *head;
};
typedef struct Node Node;
typedef struct List List;
void
list_initi... | true |
da0c25f02d50cf13ae5c13bd2e903ad4d50a89ad | C++ | mCRL2org/mCRL2 | /libraries/data/include/mcrl2/data/untyped_sort_variable.h | UTF-8 | 3,328 | 2.796875 | 3 | [
"BSL-1.0"
] | permissive | // Author(s): Wieger Wesselink
// Copyright: see the accompanying file COPYING or copy at
// https://github.com/mCRL2org/mCRL2/blob/master/COPYING
//
// Distributed under the Boost Software License, Version 1.0.
// (See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)
//
/// \file m... | true |
c7db90a94acc4001cefe2b5ab707bb7eed7f664d | C++ | mrmoss/parrot_kinect | /src/msl/socket.hpp | UTF-8 | 9,244 | 2.9375 | 3 | [] | no_license | //Socket Header
// Created By: Mike Moss
// Modified On: 04/21/2014
//Required Libraries:
// Ws2_32 (windows only)
//Begin Define Guards
#ifndef MSL_SOCKET_H
#define MSL_SOCKET_H
//String Header
#include <string>
//String Stream Header
#include <sstream>
//Windows Dependencies
#if(defined(_WIN32... | true |
ef47dc8398e37e3af68c12f73e7a6820fc94d991 | C++ | unormal/MESSimpleSocketServer | /SimpleSocketServer/SimpleSocketServer.cpp | UTF-8 | 9,518 | 2.53125 | 3 | [] | no_license | // SimpleSocketServer.cpp : This file contains the 'main' function. Program execution begins and ends there.
//
#include "pch.h"
#define WIN32_LEAN_AND_MEAN
#pragma comment (lib, "Ws2_32.lib")
#include <windows.h>
#include <winsock2.h>
#include <ws2tcpip.h>
#include <stdlib.h>
#include <stdio.h>
#include <string>
#i... | true |
1c30ae3d391fda64021c6a8fd65aba41769fe4b0 | C++ | Traubert/FinnPos | /src/tagger/Trellis.cc | UTF-8 | 13,371 | 2.515625 | 3 | [
"Apache-2.0",
"LicenseRef-scancode-unknown-license-reference"
] | permissive | /**
* @file Trellis.cc
* @Author Miikka Silfverberg
* @brief A class that knows the Viterbi algorithm and the forward-backward
* algorithm.
*/
/////////////////... | true |
f56bca6997de44602dd8392431d884fc05f429ad | C++ | wilkru-7/D7049E | /events/collisionEvent.h | UTF-8 | 644 | 2.546875 | 3 | [] | no_license | //
// Class for collision event. It inherits the Event class and the EventListener
// class from ReactPhysics3D.
//
#ifndef D7049E_COLLISIONEVENT_H
#define D7049E_COLLISIONEVENT_H
#include "event.h"
#include "reactphysics3d/reactphysics3d.h"
#include "../objects/object.h"
namespace {
class CollisionEvent : publi... | true |
4d26c19413982a4d12be8c1ede625b9c188380d3 | C++ | karry3775/Motley | /Ceres_exploration/src/run_circle_fit.cpp | UTF-8 | 617 | 2.9375 | 3 | [] | no_license | #include <circle_fit.h>
int main(int argc, char** argv) {
google::InitGoogleLogging(argv[0]);
// Generate points of a circle, to act as data
std::vector<double> x_data{}, y_data{};
circle_fit::generateData(x_data, y_data, 3, 1, 1, 0.5, M_PI / 180);
// Print out the data
std::cerr << "Data val... | true |
d1024ac6b09945cba62e68bfb2e112c8c75cdf18 | C++ | winhows5/Leetcode-Answers | /0095. Unique Binary Search Trees II/ans1.cpp | UTF-8 | 1,263 | 3.109375 | 3 | [] | no_license | /* time cost: 16ms (97.18%) */
/* time complexity: O(n^2log(n)) */
/**
* Definition for a binary tree node.
* struct TreeNode {
* int val;
* TreeNode *left;
* TreeNode *right;
* TreeNode(int x) : val(x), left(NULL), right(NULL) {}
* };
*/
static int x = [](){
std::ios::sync_with_stdio(false... | true |
d2fe42bc37f7b20f00cb06b9eb10ad275831acda | C++ | csc2430-master/Lab6-Starter | /gridWindow.cpp | UTF-8 | 4,318 | 2.953125 | 3 | [] | no_license | // Title: Lab 6 - gridWindow.cpp
//
// Purpose: Implement the GridWindow class which bundles the behind the scenes Grid
// class functionality with the display elements.
//
// Class: CSC 2430 Winter 2020
// Author: Max Benson and <your name>
#include <assert.h>
#include "gridWindow.h"
// Grid Titl... | true |
4a08b3c2bc7e33e9fe62b409a2bf7b5c3ffcd47c | C++ | TheMagnat/Mavoxel | /src/Helper/Benchmark/Profiler.hpp | UTF-8 | 608 | 2.78125 | 3 | [
"MIT"
] | permissive |
#pragma once
#include <string>
#include <chrono>
#include <iostream>
#include <mutex>
#include <map>
class Chronometer {
public:
void start();
double getElapsedTime();
private:
std::chrono::high_resolution_clock::time_point startTime_;
};
class Profiler {
public:
Prof... | true |
3ac268a92646c8a4b32c10a2ddfa5cdb3e834605 | C++ | msrdinesh/Blue-Red-object-classification | /colour_detection.cpp | UTF-8 | 886 | 2.984375 | 3 | [] | no_license | #include<iostream>
#include "opencv2/highgui/highgui.hpp"
#include "opencv2/core/core.hpp"
#include "opencv2/opencv.hpp"
using namespace cv;
using namespace std;
int main()
{
//Reading the image
Mat image = imread("object.jpeg",1);
//to find the intensity of red colour
Mat OutputImage1;
inRange(image,Scalar(100,10,10... | true |
ee8205b80c3953fca73a917d6b0ca372cc941c57 | C++ | cutz-j/AIRobotComputing | /homework1/test.cpp | UHC | 5,880 | 2.875 | 3 | [] | no_license | #include <iostream>
#include <GL/glew.h>
#include <GL/wglew.h>
#include <GLFW/glfw3.h>
#pragma comment(lib, "opengl32.lib")
#pragma comment(lib, "glew32.lib")
// Լ & ʱȭ //
int program1(void);
int program2(void);
int program3(void);
static void Initialize(void);
static void RenderScene1(GLFWwindow* window);
static v... | true |
d8d3264b846f9472ea7b4680cf800dc8401c2577 | C++ | Matthiaas/roads.sexy | /hackatum-2019/src/xodr/validation/road_link_validation.h | UTF-8 | 9,048 | 2.96875 | 3 | [
"Apache-2.0",
"MIT"
] | permissive | #pragma once
#include <string>
#include <memory>
#include "validation/link_validation_base.h"
#include "xodr_map_keys.h"
namespace aid { namespace xodr {
class XodrMap;
class LaneSection;
/**
* @brief Validates the links (road links and lane links) in the given XodrMap.
*
* @param map The XodrMap whos... | true |
b0341ecfeb442ebdbec8596215aab81442f6fe8e | C++ | restuadipradana/SYF-EmbeddedSystem-Projects | /MD_ESP8266/MD_ESP8266.ino | UTF-8 | 1,758 | 2.59375 | 3 | [] | no_license | #include <ESP8266HTTPClient.h>
#include <ESP8266WiFi.h>
const char* ssid = "MES";
const char* password = "00000000";
IPAddress staticIP(172,16,3,80); // IP the board
IPAddress gateway(172,16,3,254);
IPAddress subnet(255,255,0,0);
void setup() {
Serial.begin(115200); //Serial c... | true |
8348123523855ca13ca3600bc0bb8383a2426a85 | C++ | HaMinhThanh/GimmickNes | /Gimmick/Gimmick/Camera.h | UTF-8 | 776 | 2.515625 | 3 | [] | no_license | #pragma once
class CCamera
{
public:
static CCamera* __instance;
CCamera();
~CCamera();
//RECT GetBound();
float cam_x = 0.0f;
float cam_y = 0.0f;
int _xLeft, _xRight, _yTop, _yBot;
bool isMovingCam = false;
int oLeft, oRight;
int oTop = 1;
void SetCamPos(float x, float y) { cam_x = x; cam_y = y; }
v... | true |
7e1625121a54f2961d319da374d48a189b42e714 | C++ | Duncan15/ACM_repository | /求排列的逆序数.cpp | UTF-8 | 1,191 | 3.078125 | 3 | [] | no_license | #include <iostream>
void Merge_and_Count(int a[],int s,int m,int e,int tmp[],long long & counter)
{
int pb=0;
int p1=s,p2=m+1;
while(p1<=m&&p2<=e)
{
if(a[p1]<=a[p2])
{
tmp[pb++]=a[p2++];
}
else
{
tmp[pb++]=a[p1++];
counter+... | true |
98d75155d9720679534a85262495b94540ebb61b | C++ | dtcxzyw/OI-Source | /Unclassified/Done/3746.cpp | UTF-8 | 945 | 2.53125 | 3 | [] | no_license | #include <cstdio>
int prime[1<<15];
bool flag[1<<15]={};
int calcPhi(int x){
int cnt=0;
for(int i=2;i<=x;++i){
if(!flag[i])prime[++cnt]=i;
for(int j=1;prime[j]*i<(1<<15);++j){
flag[prime[j]*i]=true;
if(!(i%prime[j]))break;
}
}
for(int i=1;i<=cnt;++i)
if(!(x%prime[i]))
x=x/... | true |
107de1c80b17cda104913252b5f250f5a423e3fa | C++ | TimCheers/Lab18.13 | /Lab18.13/Money.cpp | UTF-8 | 2,863 | 3.28125 | 3 | [] | no_license | #include "Money.h"
int random1(int a, int b)
{
if (a > 0) return a + rand() % (b - a);
else return a + rand() % (abs(a) + b);
}
Money::Money()
{
R = random1(1, 1000);
K = random1(1, 99);
}
Money::Money(unsigned long int R, unsigned int K)
{
this->K = K;
this->R = R;
}
Money::Money(const Money& o... | true |
dcadddbd2ac475ffcbe120b7c534fc9ae766edbd | C++ | ppdg123/lc | /1111.cpp | UTF-8 | 729 | 3.265625 | 3 | [] | no_license | #include <cstdio>
#include <iostream>
#include <string>
#include <vector>
using namespace std;
class Solution {
public:
vector<int> maxDepthAfterSplit(string seq) {
int l = 0;
int r = 0;
vector<int> ans;
for (int i=0; i< seq.size(); ++i) {
if (seq[i] == '(') {
if(l<=r) {
l ++;... | true |
bfc1cf93db7118a263a3a277f7aa2b23eca7457d | C++ | tkchris93/CS236 | /lab3/EvalContainer.h | UTF-8 | 774 | 2.78125 | 3 | [] | no_license | #ifndef _EVAL_CONTAINER_H
#define _EVAL_CONTAINER_H
#include "Relation.h"
#include "Parameter.h"
#include <vector>
using namespace std;
class EvalContainer
{
public:
EvalContainer()
{
this->relation = Relation();
this->projections = vector<Parameter>();
this->rename_before = vector<Pa... | true |
2ad81393d400547729d64d35ab7ede96a56d767d | C++ | aacuadras/hw_TILE | /HW-TILE/tiling.cpp | UTF-8 | 9,624 | 3.21875 | 3 | [] | no_license | #ifndef BIPARTGRAPH_H
#define BIPARTGRAPH_H
#include "tiling.h"
#include "vertex.h"
using namespace std;
// Finds a (shortest according to edge length) augmenting path
// from s to t in a graph with vertex set V.
// Returns whether there is an augmenting path.
bool augmenting_path(Vertex* s, Vertex* t, unordered_se... | true |
ae6c2598c214bbb3856f44aeecd5a7e891982579 | C++ | ferthu/VulkanProject | /VulkanProject/VulkanProject/include/VertexBufferVulkan.h | UTF-8 | 961 | 2.65625 | 3 | [] | no_license | #pragma once
#include<vulkan/vulkan.h>
class VulkanRenderer;
class VertexBufferVulkan
{
public:
enum DATA_USAGE { STATIC = 0, DYNAMIC = 1, DONTCARE = 2 };
/* Binding used to bind vertex buffers.
*/
struct Binding {
uint32_t sizeElement, numElements, offset;
VertexBufferVulkan* buffer;
void bind(VkCommandBu... | true |
f52331ec1118fca3984e6e8b05bca982dd0783f1 | C++ | symanli/just-p2p-live-p2pcommon2 | /new/util/BitMap.cpp | GB18030 | 12,652 | 2.640625 | 3 | [] | no_license |
#include "StdAfx.h"
#include <ostream>
#include "BitMap.h"
#include "util/HuffmanCoding.h"
void Bitfield::SetBit(size_t index, bool val)
{
if (!IsInRange(index))
{
LIVE_ASSERT(!"Bitfield::SetBit: index is out of range.");
return;
}
size_t pos = GetByteIndex(index);
LIVE_ASSERT(pos < m_bits->s... | true |
af3cd0ebf3f4a031d01f6061d0cdbc390d8311a5 | C++ | samirharry/ProgramacionCompetitiva | /Clase2/elctronicShop.cpp | UTF-8 | 813 | 2.703125 | 3 | [] | no_license | #include <bits/stdc++.h>
using namespace std;
typedef long long Long;
int main(){
Long a,b,c;
cin>>a>>b>>c;
vector<Long> keyboards,usb;
for(Long i=0;i<b;i++){
Long aux;
cin>>aux;
keyboards.push_back(aux);
}
for(Long i=0;i<c;i++){
Long aux;
cin>>aux;
... | true |
5d86ab76fb86d32bda0cfc5ba90c91f5e8f856c1 | C++ | adderly/VoltAir | /VoltEngine/Engine/LevelInfo.h | UTF-8 | 4,310 | 2.546875 | 3 | [
"Apache-2.0"
] | permissive | /*
* Copyright (C) 2014 Google Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agree... | true |
e356a07115d7ed2c86416b8a8f17ca53c3100d05 | C++ | futureshocked/TE-Arduino-SbS-Getting-Serious | /_1300a2_-_nRF24_transmitter/_1300a2_-_nRF24_transmitter.ino | UTF-8 | 2,518 | 2.671875 | 3 | [] | no_license | /* 1300a2 - nRF24 Transmitter
*
* This sketch shows how to create a simple transmitter using the nRF24 module.
*
* This sketch was written by Peter Dalmaris for Arduino Step by Step
*
* Components
* ----------
* - Arduino Uno
* - nRF24L01+
* - 470 uF capacitor
* - Jumper wires
*
* Libraries
... | true |
b1c76844cbf7ddd7c9d6403199616c2df76af966 | C++ | mploof/PAL | /pal_controller/pal_controller.ino | UTF-8 | 2,356 | 2.921875 | 3 | [] | no_license | #include "Button.h"
#include <avr/wdt.h>
const int BUTTON_COUNT = 4;
int active_button = -1;
int last_active_button = -1;
int ledPin[BUTTON_COUNT] = {3, 5, 6, 9};
Button button[BUTTON_COUNT] = {
Button(3, 4, FRONT_LEFT),
Button(5, 2, BACK_LEFT),
Button(6, 8, BACK_RIGHT),
Button(9, 7, FRONT_RIGHT)
};
void sta... | true |
c1356253243f0cb5c60127a5fd5042ab8c3f505a | C++ | lukasheinrich/code-snippets | /templated_matchingtool/DefaultMetrics.h | UTF-8 | 749 | 2.65625 | 3 | [] | no_license | #ifndef DEFAULTMETRICS_H
#define DEFAULTMETRICS_H
#include "trigTypes.h"
#include "recoTypes.h"
struct MatchMetrics{
double distance(const typeA& reco, const trigA& trig) const {
std::cout << "default A-type metric reco: " << reco.etaA() << " trig: " << trig.eta() << std::endl;
return reco.etaA()-trig.eta()... | true |
0a568eec1fb264e5e772ff281a319b53ed6f7e25 | C++ | OverldAndrey/iu7-4sem-oop | /lab01/test/data.cpp | UTF-8 | 5,490 | 2.75 | 3 | [] | no_license | #include <cmath>
#include <iostream>
#include "figure.h"
#include "data.h"
#include "transform.h"
#include "drawing.h"
#include "file_wrap.h"
#include "error.h"
void clear_points(Figure &fig)
{
for (int i = array_size(fig.points) - 1; i >= 0; i--)
{
delete fig.points[i];
}
ar... | true |
218d0bdfa09b6a55f9eddbfbb88f0fddabfd8bf0 | C++ | zhenzeZ/HCI-Typography | /Typography/Credit.cpp | UTF-8 | 2,216 | 3.453125 | 3 | [] | no_license | #include "Credit.h"
#include <iostream>
Credit::Credit(Game& game, sf::Font font) :
m_game(&game),
m_font(font)
{
for (int i = 0; i < 10; i++) {
m_textMessage[i].setFont(m_font);
m_textMessage[i].setFillColor(sf::Color(1,1,1,0)); // set color to text
displayText[i] = false;
textColor[i] = 0;
}
file.open... | true |
9fb26fe7e447c3e03b5c2eb5d5de12f50584f6e5 | C++ | dobson156/irc_client | /ui/tests/anchors.cpp | UTF-8 | 2,370 | 2.875 | 3 | [
"BSL-1.0"
] | permissive | #include <console.hpp>
#include <iostream>
#include <sstream>
int main() {
try {
using anchor_top =cons::anchor_view<cons::anchors::top>;
using anchor_bottom=cons::anchor_view<cons::anchors::bottom>;
using anchor_left =cons::anchor_view<cons::anchors::left>;
using anchor_right =cons::anchor_view<cons::an... | true |
e5322d57c700e65c3aea95f44cc5c4bb816b7670 | C++ | dntutty/FFmpeg | /app/src/main/cpp/safe_queue.h | UTF-8 | 3,277 | 3.09375 | 3 | [] | no_license | //
// Created by Eric on 2019/8/18.
//
#ifndef FFMPEG_SAFE_QUEUE_H
#define FFMPEG_SAFE_QUEUE_H
#include <pthread.h>
#include <queue>
#include "marco.h"
using namespace std;
template<typename T>
class SafeQueue {
typedef void (*release_func)(T *);
typedef void (*sync_func)(queue<T> &);
... | true |
914679ef6c8144f01fce5369e37eb087477ce23a | C++ | Old-Fritz/M3DMath | /libM3DMath/Source/MatrixMath/Matrix/x86_64/MatrixFFunctions.cpp | UTF-8 | 11,033 | 2.828125 | 3 | [] | no_license | #include "M3DMath.h"
#include <cmath>
/// Implementation of MatrixF Functions
using namespace M3DM;
// Transforms
MatrixF M3DM::matrixFScaling(Float x, Float y, Float z)
{
return matrixFScaling(VectorF(x,y,z,0));
}
MatrixF M3DM::matrixFScaling(VectorF scale)
{
MatrixF matrixResult;
__m128 data = scale.getData();
... | true |
b700e5b0f35cfe20670a615deda633130994e9b5 | C++ | peanut-buttermilk/fun-run | /cpp/canJump.cpp | UTF-8 | 1,323 | 3.203125 | 3 | [] | no_license | //
// canJump.cpp
// CPP Test9
//
// Created by Balaji Cherukuri on 1/4/16.
// Copyright © 2016 FooBar. All rights reserved.
//
#include "canJump.hpp"
#include <vector>
#include <iostream>
static
bool canJump(std::vector<int>& nums) {
if (nums.size() == 1) {
return true;
}
size_t maxReach = 0;... | true |
c4915e109582d40a7e10ef16c3decd46831492f1 | C++ | SayYoungMan/BaekJoon_OJ_Solutions | /Codes/10814_Sort_by_Age.cpp | UTF-8 | 551 | 3.421875 | 3 | [] | no_license | #include <algorithm>
#include <iostream>
#include <string>
#include <vector>
int main() {
int n, age;
std::string name;
std::vector<std::pair<int, std::string>> people;
std::cin >> n;
for (int i=0; i < n; i++) {
std::cin >> age >> name;
people.push_back(std::make_pair(age, name))... | true |
93031dd68c27b4271291f7e5e131b81dfd9dd9b6 | C++ | sith/MarkOS_Arduino_communication | /src/TR433.h | UTF-8 | 1,290 | 2.546875 | 3 | [] | no_license | //
// Created by Oleksandra Baukh on 3/21/18.
//
#ifndef MARKOS_ARDUINO_CONTROLLER_TRANSCEIVER430_H
#define MARKOS_ARDUINO_CONTROLLER_TRANSCEIVER430_H
#include <Transceiver.h>
#include <RH_ASK.h>
#include <Receiver.h>
#include <HardwareSerial.h>
#include <Arduino.h>
#include <types.h>
template<typename Content>
cla... | true |
c42e8a841e80c7f12d2448856e26569462691d37 | C++ | kimtaeju01/algorithm | /tree/FORTRESS.cpp | UTF-8 | 1,707 | 3.1875 | 3 | [] | no_license | #include<iostream>
#include<vector>
#include<algorithm>
using namespace std;
struct TreeNode{
int x,y,r;
vector<TreeNode*> children;
};
bool inside(TreeNode* a,TreeNode* b){
if((b->x-a->x)*(b->x-a->x)+(b->y-a->y)*(b->y-a->y)<a->r*a->r) return true;
else return false;
}
void maketree(TreeNode* par,TreeNo... | true |
d6b0a38d68bd8d31dcdf451cc0dcd627870018ee | C++ | fqararyah/tensorflow | /testfiles/simulatePlacement.h | UTF-8 | 1,856 | 2.921875 | 3 | [
"Apache-2.0"
] | permissive | #include <stdio.h>
#include <stdlib.h>
#include <time.h>
#include <iostream>
#include <string>
#include <vector>
#include <stack>
#include <map>
using namespace std;
class GEdge;
class GNode;
class TimePartition {
int start;
int end;
int device;
public:
void setStart(int s) { start = s;}
void setEnd(int e)... | true |
ff4757b118e846cc8b95fd147d1c28bda674bf44 | C++ | shivamvats/sandbox | /cpp/main/template_recursion.cpp | UTF-8 | 732 | 3.578125 | 4 | [] | no_license | #include <iostream>
#include "template_recursion.h"
int main(){
std::cout<<"Testing Template Recursion\n";
std::cout<<"===========================\n";
std::cout<<"This code demonstrates how you can use templated"
" functions that take in multiple templates to write\n"
"recursive code. Is this faste... | true |
43dbb0264197d3b42e49c68b5a7afcc4a10f3682 | C++ | SindhubalaGanesan/NandhaTraining | /sumfl.cpp | UTF-8 | 430 | 3.125 | 3 | [] | no_license | #include<iostream>
#include<string.h>
using namespace std;
class Example
{
private:
int a,c=0,b=0,x[20],sum;
public:
void display()
{
cout<<"enter the number:";
cin>>a;
while(a!=0)
{
x[c]=a%10;
c++;
b++;
a=a/10;
}
sum=x[0... | true |
469a95cdacb93efcc4f103894cbfaa49a1336467 | C++ | HyperdiXx/XEngine | /xengine/math/src/rect.h | UTF-8 | 1,163 | 3.21875 | 3 | [
"MIT"
] | permissive | #pragma once
#ifndef RECT_H
#define RECT_H
namespace Math
{
struct Rect
{
//left top point, width, height
real32 x, y, width, height;
Rect() : x(0), y(0), width(0), height(0) {}
Rect(real32 xVal, real32 yVal, real32 wVal, real32 hVal) : x(xVal), y(yVal), width(wVal), height(h... | true |
60711bf49c6b9193d96488d1a9f998af8ae1fcbc | C++ | Mike-Leo-Smith/NoWayOut | /core/graphics/shader.h | UTF-8 | 1,506 | 2.65625 | 3 | [] | no_license | //
// Created by Mike Smith on 2019/10/8.
// Copyright (c) 2019 Mike Smith. All rights reserved.
//
#pragma once
#include <glad/glad.h>
#include <glm/ext.hpp>
#include <glm/glm.hpp>
#include <memory>
#include <util/util.h>
class Shader : util::Noncopyable {
public:
struct UniformProxy {
int32_t location;
... | true |
853a9b86c47fcb26c6e1bd55fdab4ad1d3b067e1 | C++ | runnycoder/LeetCodePrictice-withC- | /ManacherPalindromeStr.cpp | UTF-8 | 5,648 | 3.640625 | 4 | [] | no_license | #include<iostream>
#include<string>
#include<vector>
#include<math.h>
using namespace std;
//字符串预处理 用#填充字符串空隙 以#开头和结尾 #字符的数目为 n-1+2 总长度为2n+1
string preProcess(string sentence){
int length = sentence.size();
if(!length){
return "";
}
char end = '#';
string newStr;
for(int i=0;i<length;i+... | true |
18f9281d84bc480226bb50679151217d47459d95 | C++ | jayakamal-geek/CPP-Lab-Assignments | /2810/LAB1/CS19B028_A1.cpp | UTF-8 | 13,018 | 3.890625 | 4 | [] | no_license | #include<iostream>
#include<string> //header file to use string class and its functions
#include<cstdlib> //header file for pointer operations
using namespace std;
/*-------------------------------------------------------------------------------------------------
* Author : Maddula Jaya Kamal(cs19b028)
... | true |
a42c5000aa302a2c73d2a7bf69b5b6d36633d5df | C++ | Nico99/Oyebanji-electronics | /Lab01/Lab01.ino | UTF-8 | 4,318 | 3.546875 | 4 | [] | no_license | //Nicholas Oyebanji
//Lab01
////Functions
//void printHappy(String name) {
// String result = "Happy Birthday" + name; ///This is cantantinating: add a string plus another string
// Serial.println(result);
//}//
//
////functions
//void printGospels() {
// String gospels[] = {"Matthew", "Mark", "Luke", "John"};
// Se... | true |
316585fb3c12497327c3b3f74fadaf8b4fe1d6ab | C++ | Cyborg108/USACO | /buylow.cpp | UTF-8 | 3,472 | 2.515625 | 3 | [] | no_license | /*
ID: rupertl1
PROG: buylow
LANG: C++11
*/
#include <iostream>
#include <fstream>
#include <string>
#include <math.h>
#include <algorithm>
#include <utility>
#include <string.h>
#include <iterator>
#include <vector>
#include <iomanip>
#include <cmath>
#include <map>
#include <queue>
#include <set>
... | true |
feb79071aa6f9084e16ab18b35638a1f6546193c | C++ | melshazly89/Algo_ToolBox | /week2_algorithmic_warmup/6_last_digit_of_the_sum_of_fibonacci_numbers/fibonacci_sum_last_digit.cpp | UTF-8 | 870 | 3.265625 | 3 | [] | no_license | #include <iostream>
long long Pisano_Period(long long m);
int fibonacci_sum_naive(long long n) {
int length=Pisano_Period(10);
n=n%length;
if (n <= 1)
return n;
long long previous = 0;
long long current = 1;
long long sum = 1;
for (long long i = 0; i < n - 1; ++i) {
long lo... | true |
5feff35ef7fe751a6595fa963cca6b059bb07261 | C++ | kimhyeyun/2020-1-datastructure | /Day9_P1_E.cpp | UTF-8 | 1,052 | 3.671875 | 4 | [] | no_license | #include<iostream>
#include<vector>
using namespace std;
class Heap {
public:
vector<int> data;
int heapSize;
Heap() {
data.push_back(-1);
heapSize = 0;
}
void insert(int x) {
data.push_back(x);
heapSize++;
int idx = heapSize;
while (idx > 1) {
if (data[idx] < data[idx / 2]) {
int tmp = dat... | true |
51a7ba16b619f8cb5898f36c44963f8a8c9a74c5 | C++ | hjh4638/C-11 | /ST2_day5/8_완벽한전달자4.cpp | UHC | 530 | 3.328125 | 3 | [] | no_license | #include <iostream>
using namespace std;
void foo(int&& k, int&& q) { cout << "foo" << endl; }
// 4. rvalue ڷ Ǹ Types&& rvalue_reference̴
// args... ü ̸ִ rvalue reference ̹Ƿ
// lvalue ȴ.
// forward<> Ѵ.
template<typename F, typename ... Types>
decltype(auto) HowLong(F f, Types&& ... args)
{
return f(forw... | true |
03f2e184776ce356e7f473ad8baaae3cc495639b | C++ | QXYcs/C-Primer-Exercise | /charpter9/9.28/9.28.cpp | UTF-8 | 658 | 3.5 | 4 | [] | no_license | #include <iostream>
#include <string>
#include <forward_list>
using namespace std;
void insert_string(forward_list<string> &fl, string str1, string str2) {
auto pre = fl.before_begin();
auto curse = fl.begin();
bool isFound = false;
while (true) {
if (curse == fl.cend()) {
if (!isFound) fl.insert_after(pre, s... | true |
aeed1194b57b9b07898781b4fdfa207f841f2056 | C++ | jswilder/Orc-Siege-Game | /Classes/mySprite.cpp | UTF-8 | 7,551 | 2.625 | 3 | [] | no_license | #include <iostream>
#include <cmath>
#include "mySprite.h"
// velocity x & y, file name , 1 if plist/0 if not, num of frames
mySprite::mySprite(const int vx, const int vy, const std::string file, bool pl, int fnum) :
velocity(vx,vy),
viewSize( cocos2d::Director::getInstance()->getVisibleSize() )... | true |
7cc53faf583d25989e82e4f7bfef126292733818 | C++ | rolfrm/bigtalk | /src/table.hpp | UTF-8 | 2,232 | 2.921875 | 3 | [] | no_license | class table{
struct table_info{
column_base ** columns;
size_t column_count;
size_t row_count;
char * name;
};
void push_column(column_base * col);
table_info * info;
public:
table();
table(const char * name);
void print_csv();
size_t get_column_count();
size_t get_row_count(){
... | true |
e6a4d7bbd21d98dc4ba70d15e6a964b47519fbd5 | C++ | ritsuxis/kyoupro | /yukicoder/yuki46.cpp | UTF-8 | 371 | 2.875 | 3 | [] | no_license | #include<bits/stdc++.h>
using namespace std;
int gcd(int a, int b)
{
int c;
if (a < b) {
a+=b; b=a-b; a-=b;
}
while (b != 0) {
c = a % b;
a = b;
b = c;
}
return a;
}
int main(void){
int a, b, ans = 0;
cin >> a >> b;
if(b % a == 0) ans = b / a;
... | true |
aa64c3b052fdbdc3e003bdfb72d5c8d1a4d0aaf7 | C++ | UCC-Programacion3-historico/ejercicios-2018-SantiagoMerlo | /U02_Listas/Ej-01/fnInvierte.h | UTF-8 | 576 | 2.765625 | 3 | [] | no_license | #include "../Lista/Lista.h"
#ifndef FNINVIERTE_H
#define FNINVIERTE_H
template <class T>
void fnInvierte (Lista<T> *lis);
template <class T>
void fnInvierte (Lista<T> *lis){
int n = lis->getTamanio() - 1; //supongamosque pusimos 4 valores, el n =4; sin embargo el i empieza en 0 por lo que se tiene que disminui... | true |
1500b46008aac52f2bf12a341e3fe5a66edb69b3 | C++ | souffle-lang/souffle | /src/include/souffle/profile/ProfileDatabase.h | UTF-8 | 13,116 | 2.96875 | 3 | [
"UPL-1.0"
] | permissive | #pragma once
#include "souffle/utility/ContainerUtil.h"
#include "souffle/utility/MiscUtil.h"
#include "souffle/utility/json11.h"
#include <cassert>
#include <chrono>
#include <cstddef>
#include <fstream>
#include <iostream>
#include <iterator>
#include <map>
#include <memory>
#include <mutex>
#include <set>
#include ... | true |
71a9ab90400a56ec597f8961664dbc7bf96ad667 | C++ | saroj-kumar-barik/cpp-codes-from-scratch | /Function Pointer/02-ponterToMemberFunctionPointerToDataMemberPointerToObject.cpp | UTF-8 | 1,333 | 3.859375 | 4 | [] | no_license | #include<iostream>
using namespace std;
class ABC{
int a,b;
public:
int c,d;
void setdata(int, int);
void display();
};
void ABC::display(){
cout<<"C = "<<c<<" and D = "<<d<<endl;
}
void ABC::setdata(int c, int d){
ABC::c = c;
ABC::d = d;
}
int main(){
ABC X;
// po... | true |
35a3b15412dc18d2baa30521da7128250bec82a1 | C++ | ibrahimlazaar0xff/pHake | /pHake/UI/pSettings.cpp | UTF-8 | 2,167 | 3.0625 | 3 | [] | no_license | #include "pSettings.hpp"
#include <algorithm>
#include <filesystem>
#include <fstream>
#include <sstream>
pSettings::pSettings()
{
this->file_content_ = new std::vector<std::string>;
}
pSettings::~pSettings()
{
delete[] this->file_content_;
}
bool pSettings::Open(const std::string& Filepath)
{
this->file_path_ =... | true |
541c1705e42c97e4bb368c8981bc589a6dbd8b84 | C++ | conwnet/way-of-algorithm | /poj-cpp/2836/15019824_TLE.cc | UTF-8 | 1,590 | 2.625 | 3 | [] | no_license | #include <stdio.h>
#include <string.h>
#include <algorithm>
using namespace std;
struct Point {
int x, y;
} dot[20];
const int INF = 0x3f3f3f3f;
int dp[1<<15], N;
int cal_area(int s)
{
int x1, x2, y1, y2;
x1 = y1 = INF;
x2 = y2 = -INF;
for(int i=0; i<N; i++) {
... | true |
80958cd8d870982df8eb6cd7566e5baad3584248 | C++ | sopyer/Infinity | /Samples/VGTest/DataTypes.h | UTF-8 | 790 | 3.09375 | 3 | [] | no_license | #ifndef __DATATYPES_H_INCLUDED__
# define __DATATYPES_H_INCLUDED__
#include <vector>
//Unoptimized version - uses dynamic allocations,
//Can be improved using custom implementation with stack cache
template<typename T>
class Array: public std::vector<T>
{
public:
T* begin() {return empty()?0:&*std::vector<T>::beg... | true |
bb810f71cfe641159440125610fa9f2dec2e7184 | C++ | likohank/mianshiti_2018 | /06.dumplication.cpp | UTF-8 | 900 | 3.59375 | 4 | [] | no_license | #include <cstdio>
#include <cstring>
int countRange(const int* numbers,int length,int start,int end)
{
if (numbers == nullptr)
return 0;
int count = 0;
for (int i=0;i<length;i++)
{
if (numbers[i]>=start && numbers[i]<=end)
count ++;
}
return count;
}
int getDumplication(const int* numbers,int length)
{
... | true |
76229caee9cf3f23377843fc6c373a2704db1400 | C++ | dmsenter89/learningProgramming | /Cpp/Primer/ch03/3.42.cpp | UTF-8 | 392 | 3.890625 | 4 | [] | no_license | /*
* copy a vector of ints into an array
*/
#include <vector>
#include <iostream>
using namespace std;
int main()
{
vector<int> v{1,2,3,4};
auto sz = v.size();
int ar[sz];
for (int i=0; i<sz; ++i){
ar[i] = v[i];
}
cout << "Done copying the arrays. Printing.\n";
for (auto c : a... | true |
2a11b6893276accb48cbf078bc2f173f8336c2ce | C++ | ailyanlu1/Programming-Challenges | /leetcode/Valid_Number_DFA.cpp | UTF-8 | 2,001 | 3.671875 | 4 | [] | no_license | #include <iostream>
#include <string>
using namespace std;
// states of the DFA
enum STATE {
REJECT = 0,
Q0 = 1,
Q1,
Q2,
Q3,
Q4,
Q5,
Q6,
Q7,
Q8,
Q9
};
// symbols of the DFA
enum SYMBOL {
BADSYMBOL = 0,
DIGIT = 1,
SIGNED,
DOT,
EXPON,
SPACE
};
const ... | true |
d3597927dee4225d620931dd3c9553757daba5de | C++ | fengfengcloud/Programming | /algorithm/control/kalman/include/system_model.h | UTF-8 | 1,700 | 3 | 3 | [] | no_license | #ifndef KALMAN_INCLUDE_SYSTEMMODEL_H_
#define KALMAN_INCLUDE_SYSTEMMODEL_H_
#include <type_traits>
#include "Matrix.hpp"
#include "StandardBase.hpp"
namespace Kalman {
/**
* @brief Abstract base class of all system models
*
* @param StateType The vector-type of the system state (usually some type
* derived from ... | true |
8e1c76bb9e9e4523b145301b9bd49a9b0eec46a1 | C++ | andrewwalker-mn/Condvar | /broadcasttest.cpp | UTF-8 | 1,318 | 2.921875 | 3 | [] | no_license |
#include "uthread.h"
#include "Lock.h"
#include "CondVar.h"
#include <cassert>
#include <cstdlib>
#include <iostream>
using namespace std;
static Lock lock;
static CondVar cv;
#define UTHREAD_TIME_QUANTUM 100000000
static int count = 0;
void* waits(void * arg) {
lock.lock();
cout << count << endl;
cv.wait(... | true |
c2345d2d9fe211e22986b1a30c038b680cdcb6ad | C++ | arrayExample/Cpp | /Basic_Syntax&Functions/Outputs.cpp | UTF-8 | 1,095 | 4.3125 | 4 | [] | no_license | /*
Kevin Lippincott
Output Demo
~ Instructions ~
Write a program that uses while loops to perform the following steps:
Prompt the user to input two integers: firstNum and secondNum (firstNum must be less than secondNum).
Output all odd numbers between firstNum and secondNum.
Output the sum of all even numb... | true |
04154e1bc704d5e22c9b48fcd2499536deb55678 | C++ | yunyan/cppPractice | /miniSTL/src/miniVector.cpp | UTF-8 | 436 | 2.859375 | 3 | [] | no_license | #include <iostream>
#include <string>
#include <algorithm>
#include "miniVector.h"
using namespace miniSTL;
#if 0
template <class T>
Vector<T>::Vector()
{
vectorSize = 0;
vectorCapacity = 0;
buffer = 0;
}
template <class T>
Vector<T>::Vector(unsigned int size)
{
vectorSize = size;
vectorCapacity = size... | true |
5535f5a4861bebc37fe2ad9fc7d023c95f5db2c1 | C++ | SloanKi/FieaGameEngine | /source/UnitTestLibrary.Desktop/DatumTest.cpp | UTF-8 | 80,903 | 2.609375 | 3 | [] | no_license | #include "pch.h"
#include "CppUnitTest.h"
#include "Datum.h"
#include "Foo.h"
#include "Scope.h"
#pragma warning(push)
#pragma warning(disable:4201)
#include <glm/gtx/string_cast.hpp>
#pragma warning(pop)
using namespace Microsoft::VisualStudio::CppUnitTestFramework;
using namespace Library;
using namesp... | true |
f2b5be3406dcd9b482f43ff4e23f20a6491dbe7f | C++ | syslot/leetcode | /leetcode/887.cpp | UTF-8 | 923 | 3.03125 | 3 | [] | no_license | #include "../common.h"
class Solution {
public:
int superEggDrop(int K, int N) {
if(N == 0)
return 0;
if(K==1)
return N;
int key = N*1000+K;
if(map_.find(key) != map_.end())
return map_[key];
int low = 1, high = N;
whil... | true |
47e63e53d716b06b70bb442e32139c1599c8bafd | C++ | j-a-h-i-r/Online-Judge-Solutions | /Uva/108 - Bad Complexity.cpp | UTF-8 | 1,669 | 2.828125 | 3 | [] | no_license | #include<iostream>
#include<cstdio>
using namespace std;
void prSub(int is, int ie, int js, int je, int ara[200][200])
{
for (int k=is; k<=ie; k++)
{
for (int l=js; l<=je; l++)
{
cout<<ara[k][l]<<" ";
}
cout<<endl;
}
}
int main()
{
//freope... | true |
37c651319fc3e449c1d973fabe926a3363ccc720 | C++ | coderdamin/PAT-Basic-Level-Practise | /C++/1032.cpp | GB18030 | 1,173 | 3.15625 | 3 | [] | no_license | //
// Ϊʵ˵ھļǿPAT֯һھܴݱͳƳǿǸѧУ
//ʽ
// ڵ1и105NNУÿиһλߵϢͳɼѧУıţ1ʼţ
// ɼٷƣмԿոָ
//ʽ
// һиܵ÷ߵѧУıšܷ֣мԿոָĿ֤ΨһûвС
//
// 6
// 3 65
// 2 80
// 1 100
// 2 70
// 3 40
// 3 0
//
// 2 150
#include <iostream>
using namespace std;
int main() {
int anScore[105] = { 0 };
int nCount = 0;
cin >> nCount;
int nNumber, nScore;
int nMaxScore... | true |
8d9a47f919d0ac34d506479161bdc7999a5d07d2 | C++ | Rayleigh0328/OJ | /leetcode/221_2.cpp | UTF-8 | 712 | 2.6875 | 3 | [] | no_license | class Solution {
public:
int maximalSquare(vector<vector<char>>& matrix) {
if (matrix.empty()) return 0;
int n = matrix.size();
int m = matrix[0].size();
vector<vector<int>> f(n, vector<int>(m,0));
for (int i=0; i<n;++i) f[i][0] = (matrix[i][0]=='1'?1:0);
for (int j=0... | true |
9a985c914b92078fefaff13b359549bf6e7ccc92 | C++ | aedalzotto/berimbau-avr | /src/SD.cpp | UTF-8 | 1,331 | 2.59375 | 3 | [
"Apache-2.0"
] | permissive | #include <SD.h>
#include <stdio.h>
SDCard SD::disk(&PORTB, &DDRB, PB0);
FAT SD::fs(&disk);
File SD::root(&fs);
File SD::rec(&fs);
File SD::file(&fs);
bool SD::mounted = false;
uint32_t SD::start_time = 0;
bool SD::first = true;
bool SD::init()
{
// Initialize disk and mount filesystem
return disk.init() &&
... | true |
bedee379ee24edf6cfa752ea299a992e5b7e3afe | C++ | TonyXYJ/c- | /韩信点兵.cpp | UTF-8 | 1,011 | 3.015625 | 3 | [] | no_license | #include<iostream>
using namespace std;
class HanXin
{
public:
HanXin();
int line3(int x);
int line5(int y);
int line7(int z);
void showMany();
int a[100],b[100],t,u,v,h,m,j;
private:
};
HanXin::HanXin()
{
}
int HanXin::line3(int x)
{
for(t=0;;t++)
{
a[t]=3*t+x;
if(a[t]>=100) break;
else c... | true |
0c45e9156c4e7acbfd52a2eb1f5fc532295764f7 | C++ | MichalLebeda/BI-PA2-semestral-work | /src/physics/WorldContactListener.h | UTF-8 | 1,384 | 3 | 3 | [] | no_license | //
// Created by michal on 3/17/20.
//
#ifndef SEMESTRAL_WORK_WORLDCONTACTLISTENER_H
#define SEMESTRAL_WORK_WORLDCONTACTLISTENER_H
#include "PhysBody.h"
/**
* Abstract class for handling contacts with helper methods
*/
class WorldContactListener {
public:
/**
* @brief Called when contact occurs
* @... | true |
ad2fff5101689ee6df46140bd3b52bedbfe2f834 | C++ | Iswarya125/CPP-Learning | /FriendClass.cpp | UTF-8 | 908 | 3.875 | 4 | [] | no_license | // 1. Keyword "friend" is used to make some [function OR class] as friend of your class.
// 2. Friend function OR friend class can access private/public/protected Data Member OR Member Functions of another class.
// 3. Function can not become friend of another function.
// 4. Class can not become friend of function.
//... | true |
670bbbd51bcdb28484efdae66187996e2cd963e0 | C++ | awesomeabhi34/cpc-prep | /week 1/minmax with less comp.cpp | UTF-8 | 541 | 2.75 | 3 | [] | no_license | pair<int,int> minmax;
int i;
if(n%2==0){
if(arr[0]<arr[i]){
minmax.first= arr[0];
minmax.second= arr[1];
}else{
minmax.first= arr[1];
minmax.second= arr[0];
}
i=2;
}else{
minmax.first= arr[0];
minmax.second= arr[0];
i=1;
}
while(i<n-1){
if(arr[i]<arr[i+1]){
if(minmax.first>arr[i]){
minmax.first... | true |
3e8b6f0b7b3239d14d6e3ee61560ecd43bf2b489 | C++ | kounkounsito/plaidml | /pmlc/dialect/stripe/types.h | UTF-8 | 5,269 | 2.625 | 3 | [
"Apache-2.0"
] | permissive | // Copyright 2019, Intel Corporation
#pragma once
#include <string>
#include <tuple>
#include <vector>
#include "pmlc/dialect/eltwise/types.h"
#include "pmlc/dialect/stripe/mlir.h"
#include "tile/base/shape.h"
namespace pmlc {
namespace dialect {
namespace stripe {
namespace Types {
enum Kinds {
// An affine is ... | true |
b459dc56602781889c423c40a94c4c64b32b5df2 | C++ | datoufeng/cluster_server | /f_exception/fd_exception.h | UTF-8 | 219 | 2.734375 | 3 | [] | no_license | class fd_exception{
public:
string exception_str;
fd_exception() throw();
fd_exception(const string& ex_str) throw(){
exception_str=ex_str;
}
virtual const char* what() const throw(){
return exception_str;
}
} | true |
3f362887a080e1b7b0ca307773215b65cafe56c1 | C++ | tats-u/breakout | /letter.hpp | UTF-8 | 493 | 3.1875 | 3 | [
"MIT",
"BSD-3-Clause"
] | permissive | /********************コンストラクタ・デストラクタで表示を管理する文字************************/
//デストラクタ(表示消去)
Letter::~Letter() {
gamekernel::clearObjDisp(x,y,txt.length());
}
//コンストラクタ(表示)
Letter::Letter(int newx,int newy,string newtxt, int newcolor) {
x = newx;
y = newy;
txt = newtxt;
color = newcolor;
Refresh(); //表示する
}
//(再)表... | true |
1535d3982f9315a2793011b94bcf4553363463a3 | C++ | arunima18/Arunima-CS | /lab6-q1a.cpp | UTF-8 | 658 | 3.515625 | 4 | [] | no_license | /* Write a function that obtains from the user and returns a value for unitCst, units, and taxRt to the calling module. Choose an appropriate name for this function.
*/
#include<iostream>
using namespace std;
//write function to ask three values from user
int enterValue(int unitCst, int units, int taxRt){
cout<<"Ente... | true |
278e64c19bd1c5cfeb642a78781cc9d5d93fcd7f | C++ | zxc112039zxc/RISC-V_Assembler | /SB-type.h | UTF-8 | 1,817 | 3.03125 | 3 | [] | no_license | #ifndef SB_TYPE_H
#define SB_TYPE_H
#include <iostream>
#include <string>
#include "Instruction.h"
#include "InstructionDatabse.h"
using namespace std;
class SB_type : public Instruction
{
private:
string imm12_10_5;
string rs2;
string rs1;
string funct3;
string imm4_1_11;
string opcode;
... | true |
7bd4a3eeab756689b3b8aafc984be590030c92f7 | C++ | utkarsh1706/Codechef | /January Long Challenge/Encoded String.cpp | UTF-8 | 686 | 2.765625 | 3 | [] | no_license | #include <bits/stdc++.h>
using namespace std;
void my_print(int x)
{
char symbol = (char)('a' + x );
cout << symbol;
return;
}
void tosolve(string str,int l,int r,int k)
{
if(r==l)
{
my_print(l);
return;
}
char now=str[k];
int mid= l + (r - l) / 2;
k=k+1;
if(now=='0')
{
tos... | true |
5f36ecc46476935e20287fd1c5a7bfb0f8bb6d42 | C++ | Widurr/DigitalRegister | /group.cpp | UTF-8 | 711 | 3.03125 | 3 | [] | no_license | #include "group.h"
Group::Group()
{
id = getCurrentID();
}
void Group::setStudentIDs(const QVector<int>& students)
{
studentIDs = Group::vectorToString(students);
}
QString Group::getStudentIDs() const
{
return studentIDs;
}
int Group::getCurrentID()
{
static int i = 0;
++i;
return i;
}
QVe... | true |
245e2fd0e1b4731608b37a295c4c442edaf71d75 | C++ | sumanch99/C-Program | /Untitled2.cpp | UTF-8 | 674 | 3.84375 | 4 | [] | no_license | #include<iostream>
using namespace std;
class Item
{
private:int x,y;
public: Item()
{
x=y=0;
}
Item(int a)
{
x=a;
y=0;
}
Item(int m,int n)
{
x=m;
y=n;
}
void output()
{
cout<<"\nx="<<x<<"\ny="<<y;
}
Item add(Item &a)... | true |
7d0a6b53744811f009f48b9e12574f4325a8e4cb | C++ | sd2017/Super-Haxagon | /include/Core/Structs.hpp | UTF-8 | 3,581 | 2.6875 | 3 | [
"MIT",
"CC-BY-4.0"
] | permissive | #ifndef SUPER_HAXAGON_STRUCTS_HPP
#define SUPER_HAXAGON_STRUCTS_HPP
#include <cstdint>
#include <fstream>
#include <string>
namespace SuperHaxagon {
class Platform;
struct Color {
uint8_t r;
uint8_t g;
uint8_t b;
uint8_t a;
};
struct Point {
float x;
float y;
};
enum class Movement {
CAN_MOVE,
... | true |
9f712211102b7c3e132d0d1c78dffdbc65516e45 | C++ | watchpoints/weekly | /leetcode/code/2022/7.toHex.cpp | UTF-8 | 950 | 3.71875 | 4 | [
"Apache-2.0"
] | permissive | #include <iostream>
#include <map>
using namespace std;
//C++ LeetCode 405 数字转换为十六进制(位运算)
//https://leetcode-cn.com/problems/convert-a-number-to-hexadecimal/
class Solution {
public:
string toHex(int num)
{
if(num==0)
return "0";
string hex={"0123456789abcdef"};
string res=... | true |
f2340d65ccf48c2ac413278e2802e2804dc1db87 | C++ | hugh-tong/Cpp-Learning-1 | /20190522/main.cpp | GB18030 | 2,736 | 3.15625 | 3 | [] | no_license | #include <string>
#include <vector>
#include <fstream>
#include <iostream>
#include "tinyxml2.h"
#include <regex>
using namespace std;
using namespace tinyxml2;
class information
{
public:
information() {}
~information() {}
public:
string title;
string link;
string description;
string content;
};
void travers... | true |