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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
4a0b604cfc63627dca6cf75da1e6f78e0c3f2a80 | C++ | MikeLankamp/fpm | /tests/basic_math.cpp | UTF-8 | 3,535 | 2.921875 | 3 | [
"MIT"
] | permissive | #include "common.hpp"
#include <fpm/math.hpp>
TEST(basic_math, abs)
{
using P = fpm::fixed_24_8;
EXPECT_EQ(P(13.125), abs(P(-13.125)));
EXPECT_EQ(P(13.125), abs(P(13.125)));
EXPECT_EQ(P(1), abs(P(-1)));
EXPECT_EQ(P(1), abs(P(1)));
}
TEST(basic_math, fmod)
{
using P = fpm::fixed_24_8;
EXP... | true |
75a9f3f548ef73b94e4c5216480487e2cffe9d34 | C++ | porkallen/leetcode | /C++/Source/ListAndArray/25.cpp | UTF-8 | 1,223 | 3.125 | 3 | [] | no_license | #include "common.h"
class Solution {
public:
ListNode* reverseKGroup(ListNode* head, int k) {
/*
0 -> 1 -> 2 -> 3 -> 4 -> 5
*/
int count = 0;
ListNode tmpNode(-1);
tmpNode.next = head;
ListNode* pre = &tmpNode, *cur = &tmpNode, *next = &tmpNode;
... | true |
e244722dad8aab581cbb9b72ab0c1372f37c466e | C++ | yuanhuihe/robocar | /source/robocar/main.cpp | UTF-8 | 5,433 | 2.734375 | 3 | [] | no_license |
#include <chrono>
#include <thread>
#include <atomic>
#include <iostream>
#include <vector>
#include <stdio.h> // for fgets()
#include <tuple>
#include <string> // std::string
#include <string.h> // memxxx/strlen()
#include "remote/remote.h"
#include <executive/executive.h>
void showTips(std::vector<Drive... | true |
90b9cfc7cdb6ae37b94122f8e96a3a85d8aa8b97 | C++ | CahootsMalone/maxis-mesh-stuff | /C++/Mesh-tools/mesh-replace/main.cpp | UTF-8 | 9,754 | 3 | 3 | [] | no_license | // Replace the mesh/meshes at the specified index/indices in a Maxis mesh file with the specified data.
#include <iostream>
#include <fstream>
#include <string>
#include <set>
#include <vector>
#include <iterator>
#include <algorithm>
#include "cxxopts.hpp"
namespace Helpers
{
int BytesToInt32(const unsigned char* ... | true |
d83e041c6163cc7af941e52b69d8748a427466c9 | C++ | okmd/codingblocks | /11-challenge-strings/10-ultra-fast-mathematicians.cpp | UTF-8 | 431 | 2.796875 | 3 | [] | no_license | #include<iostream>
#include<cstring>
using namespace std;
int main(){
int t,len;
string a,b;
cin>>t;
cin.ignore(); // ignore new line char
while(t--){
a.erase(a.begin(),a.end());
getline(cin,a,' ');
b.erase(b.begin(),b.end());
getline(cin,b);
len = a.length();
while(len--){
a[len] = ... | true |
49c241a6f521c06bf4357a4ffcf7a56895a47a1d | C++ | Ave700/GeometryProcessing | /technique.cpp | UTF-8 | 2,877 | 3 | 3 | [] | no_license | #include <string>
#include "technique.h"
Technique::Technique()
{
m_shaderProg = 0;
}
//Destructor
Technique::~Technique()
{
//Delete shader shader objects that were compiled but the object was deleted prior to linking
for (ShaderObjList::iterator it = m_shaderObjList.begin(); it != m_shaderObjList.end(); it++)
{... | true |
44c2c9556611f2243ef2a2595fd926fc54fe950b | C++ | kiwixz/kae | /include/kae/exception.h | UTF-8 | 860 | 2.578125 | 3 | [
"MIT"
] | permissive | #pragma once
#include <memory>
#include <stdexcept>
#include <string>
#include <string_view>
#include <fmt/format.h>
#include "kae/pp.h"
#define MAKE_EXCEPTION(...) ::kae::Exception(SOURCE_LOCATION, __VA_ARGS__)
#define NOT_IMPLEMENTED throw MAKE_EXCEPTION("not implemented");
namespace kae {
struct Exception : ... | true |
73f5fa2c9da1136572d603edc96a51b50fe787ae | C++ | gorilux/distfun | /distfun.hpp | UTF-8 | 35,025 | 2.71875 | 3 | [
"MIT"
] | permissive | /*
distfun.hpp - v0.01 - Vojtech Krs 2019
Implements signed distance functions of basic primitives
Allows conversion a CSG-like tree of primitives to a program
Implements distance program evaluation on CPU and GPU (CUDA)
INSTALLATION:
Add
#define DISTFUN_IMPLEMENTATION
before #include
Add
#define ... | true |
68d0cae235dc01b9c38619d98b0123dc3705e2a0 | C++ | rascal222/ProgrammationCPP3D | /src/surfaces/Surface.cpp | UTF-8 | 453 | 2.5625 | 3 | [] | no_license | #include "Surface.hpp"
namespace prog_3D {
Surface::Surface(int nbU, int nbV) : nbPointU(nbU), nbPointV(nbV) {
}
Surface::~Surface() {
}
void Surface::setPointNumberForU(int nb) {
nbPointU = nb;
}
void Surface::setPointNumberForV(int nb) {
nbPointV = nb;
}
int Sur... | true |
9dd4698cc0d1c11de790b253319b5a4c08fae0e0 | C++ | fredlim/lantern | /lantern/include/rasterizing_stage.h | UTF-8 | 61,339 | 3.0625 | 3 | [
"MIT"
] | permissive | #ifndef LANTERN_RASTERIZING_STAGE_H
#define LANTERN_RASTERIZING_STAGE_H
#include <algorithm>
#include "vector2.h"
#include "vector3.h"
#include "vector4.h"
#include "matrix3x3.h"
#include "texture.h"
#include "mesh_attribute_info.h"
#include "line.h"
#include "aabb.h"
#include "math_common.h"
namespace lantern
{
/**... | true |
a67ef7ec2e54d47f5d01e1e78de3c3e36a71046c | C++ | miguelraz/PathToPerformance | /Dojo/C++ Programming Practices and Principles - Stroustrup/ch5/trythistemperaturerevamped.cpp | UTF-8 | 766 | 3.515625 | 4 | [
"MIT"
] | permissive | //5.trythis temperature improved
#include "std_lib_facilities.h"
#include <vector>
#include <iostream>
using namespace std;
int main() {
double sum = 0;
double low_temp = 128 * -1; // initialize to impossibly low aka vostok
double high_temp = 136 ; // initialize to “impossibly high” aka dubai march 30 2017... | true |
577831c82ca8e388b68f53d41e032528b6fe2cec | C++ | inlart/SAToku | /satoku/satoku/sudokusolver.cpp | UTF-8 | 3,590 | 2.96875 | 3 | [
"MIT"
] | permissive | #include "satoku/sudokusolver.h"
#include <cmath>
namespace satoku {
SudokuSolver::SudokuSolver(const Sudoku& sudoku) : m_sudoku(sudoku) {
updateClauses();
}
std::size_t SudokuSolver::getVariableNumber(std::pair<std::size_t, std::size_t> pos,
std::int64_t val) const noexcept {
auto size = m_sudoku.getS... | true |
ea86cb49360b2db059fae6655f922dbd3e681ea6 | C++ | QTAnt/Exercise | /Merging_two_ordered_linked_lists/Merging_two_ordered_linked_lists.cpp | GB18030 | 1,101 | 3.65625 | 4 | [] | no_license | //Merging_two_ordered_linked_listsϲ
//https://leetcode-cn.com/problems/merge-two-sorted-lists/
//ϲΪһµءͨƴӸнڵɵġ
//ʾ
//룺1->2->4, 1->3->4
//1->1->2->3->4->4
/**
* Definition for singly-linked list.
* struct ListNode {
* int val;
* ListNode *next;
* ListNode(int x) : val(x), next(NULL) {}
* };
*/
class Solution... | true |
732c96fa29dc6b91f62ef6b099e9daa21288fcfb | C++ | Crawping/Cyclone | /Utilities/Graphs/Specializations/BinaryNode.h | UTF-8 | 4,146 | 3.453125 | 3 | [] | no_license | /* CHANGELOG
* Written by Josh Grooms on 20170708
*/
#pragma once
namespace Cyclone
{
namespace Utilities
{
/// <summary> A structure that represents a generic graph node. </summary>
/// <typeparam name="T"> The type of the data element held by the node. </typeparam>
/// <typeparam... | true |
a7fc50237415013052cd522dd06625bb2c2d7bd7 | C++ | Juice-2020/Implied-Tree-Pricer | /code/bsformula.h | UTF-8 | 1,406 | 3.03125 | 3 | [] | no_license | //
// BSformula.h
// Implied Tree
//
// Created by 陈家豪 on 2020/4/13.
// Copyright © 2020 陈家豪. All rights reserved.
//
#ifndef BSformula_h
#define BSformula_h
#include <iostream>
#include <cmath> // for std::exp()
#include <cassert> // for assertion on inputs
enum OptType{C, P};
double cnorm(double x);
double bsf... | true |
f60df62bf7f6e8b8165db07b52410ec0bd9903c8 | C++ | maximechoulika/My42Cursus | /piscine_cpp/project/source/Tilemap.cpp | UTF-8 | 1,797 | 2.796875 | 3 | [] | no_license | #include "Tilemap.hpp"
#include "Vars.hpp"
#include "Operations.hpp"
#include <fstream>
#define TILE_SIZE 32u
#define TILES_PER_LINE 16u
Tilemap::Tilemap()
{
m_texture.loadFromFile("data/tilemap/tileset.png");
std::ifstream file("data/tilemap/tilemap");
std::string line;
std::getline(file, line... | true |
c8d7ec14d00816e6f76ae201136d26498b396a78 | C++ | sw1024/testcpp | /logcxx.cpp | UTF-8 | 2,605 | 2.625 | 3 | [] | no_license | /**
* @file logcxx.cpp
* $Id$
* @brief
* @author My name SunWu
* @date 2019-05-04
*/
#include <iostream>
#include <stdarg.h>
#include <log4cxx/logger.h>
#include <log4cxx/dailyrollingfileappender.h>
#include <log4cxx/propertyconfigurator.h>
#include <log4cxx/helpers/exception.h>
#include <log4cxx/patternlayout.... | true |
68418240e7029e3d588eff683032e4a4e22e513d | C++ | flohmann/Inf3Project | /ContractTest/Dijkstra_Pathfinding_Algorithm/Graph.cpp | UTF-8 | 1,133 | 3.1875 | 3 | [] | no_license |
#pragma once
#include "stdafx.h"
#include <vector>
#include "Graph.h"
using namespace std;
Graph::Graph()
{
}
void Graph::addNodes(Node n)
{
if (&n == nullptr)
{
nodeList.push_back(n);
}
}
bool Graph::hasNodes(Node n){
if (&n != NULL){
for each (Node node in nodeList)
{
if (node == n){
isNode = ... | true |
b7db5c32dd53a5f872bf75a76f6695183b469133 | C++ | LuaXD/teambook | /teambook/string/SuffixAutomata.cpp | UTF-8 | 6,413 | 2.671875 | 3 | [] | no_license | #include <iostream>
#include <string.h>
#include <algorithm>
#include <stdio.h>
#include <vector>
typedef long long int number;
using namespace std;
const int INSERTE_VALOR = 90050;
vector<int> alpha;
/*################### Suffix Automata ###################*/
const int N = INSERTE_VALOR;//maxima longitud de... | true |
cde38dc912d3d0aca1d6e2af32ec83f21b0e3d03 | C++ | windystrife/UnrealEngine_NVIDIAGameWorks | /Engine/Source/Editor/UnrealEd/Private/PackageAutoSaver.h | UTF-8 | 4,818 | 2.515625 | 3 | [
"MIT",
"LicenseRef-scancode-proprietary-license"
] | permissive | // Copyright 1998-2017 Epic Games, Inc. All Rights Reserved.
#pragma once
#include "CoreMinimal.h"
#include "SlateFwd.h"
#include "UObject/WeakObjectPtr.h"
#include "IPackageAutoSaver.h"
namespace ECloseNotification
{
enum Type
{
NothingToDo,
Success,
Postponed,
Failed
};
}
/** A class to handle the crea... | true |
8dc8cf5c02f9dda188e992c744dc1f0334b5bd79 | C++ | rsgilbert/helloCpp | /main.cpp | UTF-8 | 299 | 3.703125 | 4 | [] | no_license | #include <iostream>
using namespace std;
// Write a program that prints odd numbers between 0 and 100
int main() {
for (int num = 0; num < 100; num++) {
// Checks to see if num / 2 gives a remainder of 1
if (num % 2 == 1) {
cout << num << endl;
}
}
}
| true |
15e982273814d37d034e99512a3c0c61a564efc7 | C++ | phunghung/C | /mang1 & max.cpp | UTF-8 | 2,034 | 2.609375 | 3 | [] | no_license | #include<stdio.h>
#include<conio.h>
int nhapmang(int A[100], int n)
{
int i;
for(i=0; i<n; i++)
{
printf("\nA[%d] = ", i);
scanf("%d", &A[i]);
}
}
int xuatmang(int A[100], int n)
{
int i;
for(i=0; i<n; i++)
printf("%4d", A[i]);
}
int timmax(int A[100], int n)
{
int i, max;
max=A[0];
for(i=0; i<n; i++)
i... | true |
8300ec6e44cbf106adb80300bf8586e0bc94a1d8 | C++ | Mark-zw/C-Plus-Plus | /c++_practice0822.cpp | GB18030 | 4,673 | 3.3125 | 3 | [] | no_license | #define _CRT_SECURE_NO_WARNINGS 1
#include<iostream>
using namespace std;
//class Stack {
//public:
// //캯ɳʼ
// Stack(int n = 10) {
// _array = (int*)malloc(sizeof(int) * n);
// _size = 0;
// _capacity = 10;
// }
// //Դ
// ~Stack() {
// free(_array);
// _array = NULL;
// _size = 0;
// _capacity ... | true |
37972f153eb0e2d34e535e085da9b84f6166d1ac | C++ | cs1102-lab1-09-2019-2/proyecto-final-team_laberinto | /pruebas.cpp | UTF-8 | 3,611 | 3.21875 | 3 | [] | no_license | #include <iostream>
#include <cstring>
#include <cstdio>
using namespace std;
int** LeerMatriz(char const * const filename, int &Filas, int &Columnas) {
FILE *fp = fopen(filename, "r");
if (fp == nullptr){
exit(EXIT_FAILURE);
}
char linea[225];
fgets(linea, 224, fp);
char *token = strt... | true |
8f0b3e0e58a6d6e5c6cde64b0fb76e4fa971f881 | C++ | hemanthk92/IDD-Fa18-Lab2 | /jukebox.ino | UTF-8 | 2,903 | 2.671875 | 3 | [] | no_license | /*
Melody
Plays a melody
circuit:
- 8 ohm speaker on digital pin 8
created 21 Jan 2010
modified 30 Aug 2011
by Tom Igoe
This example code is in the public domain.
http://www.arduino.cc/en/Tutorial/Tone
*/
#include "pitches.h"
#include <LiquidCrystal.h>
#define ENC_A 2 //these need to be digital... | true |
cd9c62e86fcd7e860a0f87bc4b9fee586388498a | C++ | usherfu/zoj | /zju.finished/2861.cpp | UTF-8 | 1,007 | 2.515625 | 3 | [] | no_license | #include<iostream>
using namespace std;
enum {
SIZ = 32,
};
long long sum[SIZ+1][SIZ+1];
long long ans = 0;
long long N, L, P;
void init(){
int i, j;
sum[0][0] = 1;
for (i=1; i<SIZ; ++i){
sum[i][0] = 1;
for (j=1; j<SIZ; ++j){
sum[i][j] = sum[i-1][j] + sum[i-1][j-1];
... | true |
bdfea1865fa52f40907c7e0cfc692694cd777350 | C++ | devakar/codes | /coding/reverse.cpp | UTF-8 | 300 | 3.25 | 3 | [] | no_license | #include <iostream>
#include <string>
#include <stack>
using namespace std;
int main()
{
string s;
cin>>s;
int l=s.length();
stack <char> st;
for(int i=0;i<l;i++)
{
st.push(s[i]);
}
for(int i=0;i<l;i++)
{
s[i]=st.top();
st.pop();
}
cout<<"Reverse is "<<s<<endl;
return 0;
} | true |
78aec216cffb3aadb00ad031cc5546413dd2f8da | C++ | aabedraba/DataStructures | /3-Linked_Lists_Implementation/src/ListaEnlazada.h | UTF-8 | 4,514 | 3.03125 | 3 | [] | no_license | /*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
/*
* File: ListaEnlazada.h
* Author: aabedraba
*
* Created on October 17, 2017, 11:29 PM
*/
#ifndef LISTAENLAZADA_H
#define L... | true |
7692330dfd1844db24566b48ea322810f8af1fb4 | C++ | stjenkins/Programming_Portfolio | /vowel_counter/vowel_counter.cpp | UTF-8 | 1,142 | 3.625 | 4 | [] | no_license | #include <iostream>
#include <fstream>
using namespace std;
int main(int argc, char* argv[]){
//declare variables
ifstream myfile;
int num_vowels = 0;
string buffer;
//check for correct number of arguments
if(argc != 2){cerr << "Usage is a.out filename.txt\n"; return -1;}
//open file and check if the file su... | true |
451224ab31690957b5b4ee3efc1dbd750126ce1d | C++ | xmcpp/DeepRender | /Dx9World/Dx9World/SimpleMesh.h | GB18030 | 1,107 | 2.734375 | 3 | [] | no_license | #ifndef __SIMPLEMESH_H__
#define __SIMPLEMESH_H__
#include "MeshFileIO.h"
class SimpleMesh
{
public:
SimpleMesh( const std::string & meshName );
~SimpleMesh();
public:
bool loadFromFile( const std::string & fileName );
bool unloadMesh();
bool loadToGpu();
bool unloadFromGpu();
public:
const std::vector<VERTEX... | true |
56b201edefee53d6761550e8c9408da0362188f0 | C++ | abhigoyal1997/Codes | /data-structures/linked_list/main1.cpp | UTF-8 | 815 | 3.078125 | 3 | [] | no_license | #include "list_of_list.h"
void insertData(datastore<float> &x){
int n; cin >> n;
float in;
while(n--){
cin >> in;
x.insert(in);
}
}
int main(){
datastore<float> x;
char ch;
cin>>ch;
while(ch!='q'){
float in; int inp;
switch(ch){
case 'i': insertData(x);
break;
case 'p': x.print();
... | true |
53e0d4eb635af7a62ebb0492721f1d3dd0abc32d | C++ | Rearcher/OJcodes | /leetcode/530.cpp | UTF-8 | 1,194 | 3.796875 | 4 | [] | no_license | // 530. Minimum Absolute Difference in BST
#include <iostream>
#include <vector>
#include <stack>
#include <algorithm>
using namespace std;
struct TreeNode {
int val;
TreeNode *left;
TreeNode *right;
TreeNode(int x) : val(x), left(NULL), right(NULL) {}
};
class Solution {
public:
int getMinimumDif... | true |
12e936876e7e97fe1a569b0b38f78c95e4d5f521 | C++ | Ph0en1xGSeek/ACM | /Others/LCS_Revised.cpp | GB18030 | 366 | 2.90625 | 3 | [] | no_license | /**
ͬȵƴ
Ҫô1࣬Ҫô0
**/
#include <stdio.h>
#include <iostream>
char s[100008];
int main()
{
int a=0, b=0, i;
while(scanf("%s", s) != EOF)
{
for(i=0;s[i];i++)
if(s[i]=='0')
++a;
else
++b;
printf("%d\n", a<b?a:b);
}
}
| true |
31c7ac1562093fc622b0a7641674c8e64cdc134e | C++ | dudochkin-victor/handset-video | /src/videofileinfo.cpp | UTF-8 | 1,738 | 2.546875 | 3 | [
"Apache-2.0"
] | permissive | /*
* Meego-handset-video is an video player for MeeGo handset.
* Copyright (C) 2010, Intel Corporation.
*
* This program is licensed under the terms and conditions of the
* Apache License, version 2.0. The full text of the Apache License is at
* http://www.apache.org/licenses/LICENSE-2.0
*
*/
#include <QStrin... | true |
3e63edf44285c883d8eb13df2b8342dd13d07a0e | C++ | alvishnitskiy/ics | /pset5/speller/table.h | UTF-8 | 1,245 | 2.78125 | 3 | [] | no_license | /**
* Declares a hash table's functionality.
*/
#ifndef TABLE_H
#define TABLE_H
#include <strings.h>
#include <ctype.h>
#include "dictionary.h"
#include "list.h"
//#define SIZE 50
class HashMap {
private:
// default size of hashMap in memory
const int SIZE_ON_DEFAULT = 50;
// pointer to b... | true |
19d5e0374f233d5bf716de3ded9ff4797e77529f | C++ | milindbhavsar/Leetcode-Templates-and-Examples | /code/0952. Largest Component Size by Common Factor.h | UTF-8 | 1,889 | 3.453125 | 3 | [] | no_license | /*
Given a non-empty array of unique positive integers A, consider the following graph:
There are A.length nodes, labelled A[0] to A[A.length - 1];
There is an edge between A[i] and A[j] if and only if A[i] and A[j] share a common factor greater than 1.
Return the size of the largest connected component in the graph.
... | true |
1e5ebd4eaff97df2a5a07425545d713614004c0f | C++ | Datin71/DatinLogan_2666266 | /Hmwk/Assignment3/Gaddis_8thEd_Chap4_Prob5_BMI/main.cpp | UTF-8 | 927 | 3.640625 | 4 | [] | no_license | /*
File: main
Author: Logan Datin
Created on October 05, 2016, 4:37 PM
Purpose: Calculate bmi and determine if the bmi is healthy or not
*/
//System Libraries
#include <iostream> //Input/Output objects
using namespace std; //Name-space used in the System Library
//User Libraries
//Global Constant... | true |
794d08275b73e5b464a685ad976de4718ed0f0e9 | C++ | Luminatus/eva-labyrinth | /app/Headers/game_map.h | UTF-8 | 884 | 2.65625 | 3 | [] | no_license | #ifndef GAME_MAP_H
#define GAME_MAP_H
#include <QVector>
#include <QMap>
#include "Headers/datastructures.h"
class GameMap{
public:
static GameMap* createFromString(QString data, QString name,const QMap<QString,GameField>& code_table);
static GameMap* createGameMap(QVector<QVector<GameField> >* ma... | true |
7e4b0ab68343f8d10516dc984779824af07feed7 | C++ | sankha87/Linked-List-swap-the-k-th-node-from-beginning-with-the-k-th-last-node-2 | /Source.cpp | UTF-8 | 1,698 | 4.15625 | 4 | [] | no_license | // Given a linked list(singly - linked, non - circular), write a program to swap the kth node from beginning
// with the kth last node in the list. Note that the length of the list is not known.
#include <stdio.h>
#include <conio.h>
#include <stdlib.h>
struct Node
{
int data;
struct Node *next;
};
void ... | true |
56edd7ad83fef49d50e1773cb6c82e3b60533d59 | C++ | iamitshaw/codechef-contest | /PSTR2020/ITGUY07/main.cpp | UTF-8 | 536 | 2.65625 | 3 | [] | no_license | #include <bits/stdc++.h>
int32_t main(int32_t argc, char* argv[]) {
/* fast input-output */
std::ios_base::sync_with_stdio(false);
std::cin.tie(nullptr);
std::cout.tie(nullptr);
/* get test_case */
int32_t test_case;
std::cin >> test_case;
while (test_case--) {
/* get N */
... | true |
58971e1e8ba6daad98919d0681c9a942e5223aff | C++ | chenyangjamie/Leetcode | /084. Sort Colors/Sort_Colors.cpp | UTF-8 | 1,903 | 4.09375 | 4 | [] | no_license | /*
Given an array with n objects colored red, white or blue, sort them so that objects of the same color are adjacent, with the colors in the order red, white and blue.
Here, we will use the integers 0, 1, and 2 to represent the color red, white, and blue respectively.
Note:
You are not suppose to use the library's s... | true |
fcfb161f5145582fc358272b9cfd13677c91ee92 | C++ | CotletkaMan/pusko | /system/ModelingTime/Time.cpp | UTF-8 | 261 | 2.71875 | 3 | [] | no_license | #include "Time.h"
Time::Time(){
time = 0;
timeStep = changeTime();
}
double Time::getCurrentTime(){
return time;
}
double Time::getCurrentStep(){
return timeStep;
}
void Time::nextStep(){
time += timeStep;
timeStep = changeTime();
}
| true |
ef291335f28080ecf169f99b52a64ae48f52e42b | C++ | utkarshavardhana/30-day-leetcoding-challenge | /Week-4/Day-24-LRUCache.cpp | UTF-8 | 1,121 | 3.046875 | 3 | [
"MIT"
] | permissive | class LRUCache {
public:
int size;
list<pair<int,int>> dl;
unordered_map<int, list<pair<int,int>>::iterator> mp;
LRUCache(int capacity) {
size = capacity;
}
int get(int key) {
if(mp.find(key) == mp.end()){
return -1;
}else{
... | true |
bf6855c568a6063ee1d7ce191f7afb5c95eac85c | C++ | heyjing/IPK | /aufgabe1c.cc | UTF-8 | 692 | 3.828125 | 4 | [] | no_license | #include <iostream>
#include <vector>
#include <algorithm>
std::vector<double> reversed(const std::vector<double> &v)
{
std::vector<double> vectornew;
int size = v.size();
for (int i = size - 1; i >= 0; i--)
{
vectornew.push_back(v[i]);
}
for (double value : vectornew)
{
... | true |
2ac4537a27d7a12ddf1168cab42070a527ccfd69 | C++ | IgorYunusov/Mega-collection-cpp-1 | /Beginning OpenGL Game Programming Source Code/Chapter10/FrustumCulling/md2.cpp | UTF-8 | 9,946 | 2.59375 | 3 | [] | no_license | #include "md2.h"
#include <cstdio>
#include <cmath>
#include <cfloat>
const float SPHERE_PADDING = 10.0;
// this is a bit of a hack, since the sphere isn't guaranteed to completely
// surround the model. However, the results for this demo are satisfactory
void CalculateBoundingSphere(sphere_t &sphere, GLfl... | true |
52e013a2673f69c7575572e30a5395e7cc1ea893 | C++ | cache-tlb/problem_solving | /ZOJ/Switch#1622.cpp | UTF-8 | 337 | 2.890625 | 3 | [] | no_license | #include<iostream>
using namespace std;
int main()
{
int n;
while(cin >> n){
int a = 0, b = 0, temp = 0;
for(int i = 0; i < n; i++){
cin >> temp;
if(i%2){
if(temp == 1) a++;
else b++;
}
else{
if(temp == 1) b++;
else a++;
}
}
if(a < b) cout << a << endl;
else cout << b << endl;... | true |
edf0335a86e5bcad81942c276bcb41b0b6d88ca7 | C++ | MORTAL2000/jubilant-funicular | /include/nta/SpriteFont.h | UTF-8 | 3,659 | 2.8125 | 3 | [
"MIT"
] | permissive | #ifndef NTA_SPRITEFONT_H_INCLUDED
#define NTA_SPRITEFONT_H_INCLUDED
#include <map>
#include <SDL2/SDL_ttf.h>
#include "nta/SpriteBatch.h"
#define FIRST_PRINTABLE_CHAR ((char)32) //space
#define LAST_PRINTABLE_CHAR ((char)126) //~
#define NUM_PRINTABLE_CHARS (LAST_PRINTABLE_CHAR-FIRST_PRINTABLE_CHAR+1)... | true |
88a5c288676ff35b14ec6a0c616b9851486d58f0 | C++ | TeodoraAleksic/n-body-problem | /src/quad.cpp | UTF-8 | 2,933 | 2.890625 | 3 | [] | no_license | #include "quad.hpp"
Quad::Quad(Quad *qp, const Particles& p, float w, float x, float y){
parent = qp;
width = w;
qx = x;
qy = y;
partIndexes = std::vector<int>();
initQuad(p);
}
Quad::~Quad(){
delete nw;
delete ne;
delete sw;
delete se;
}
void Quad::initQuad(const Particles& particles){
// Parent quad ... | true |
b517741eb8cebcb30119a2b914ad573bdd9ff4ae | C++ | r03er7/algorithms | /[Code] algorytmika praktyczna/Programy_z_komentarzami/programy_z_komentarzami/alchemy.cpp | WINDOWS-1250 | 5,804 | 2.9375 | 3 | [] | no_license | #include <cstdio>
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
using namespace std;
// Dwa z najczesciej uzywanych typow o dlugich nazwach - ich skrocenie jest bardzo istotne
typedef vector<int> VI;
typedef long long LL;
// W programach bardzo rzadko mozna znalezc w pelni ... | true |
1257eb8127fb41445607a4ef525c2a6b509aead4 | C++ | nickzuck/Data-Structures-and-Algorithms | /disjoint_set_union_basic.cpp | UTF-8 | 2,329 | 4 | 4 | [] | no_license | /*Basic and naive implementation of disjoint set data structure*/
//Time Complexity : O(n^2)
#include<iostream>
#include<algorithm>
#define MAX 1000
using namespace std ;
//Manage the connectivity of elements
//stores the set number corresponding to an element of array
//storage[i] gives the set number of ith eleme... | true |
78b728e525e15810f15c24014e1f42b88903019c | C++ | danieljluna/Project-Perfect-Citizen | /Project-Perfect-Citizen/Code/Game/emailListElementRenderComponent.h | UTF-8 | 3,057 | 2.828125 | 3 | [] | no_license | #pragma once
#include "../Engine/renderComponent.h"
#include "Email.h"
#include <SFML/Graphics/Font.hpp>
#include <SFML/Graphics/RectangleShape.hpp>
namespace sf {
class Sprite;
class Text;
};
///////////////////////////////////////////////////////////////////////
/// @brief Designated render component for a... | true |
91366b5e5574f5e0acbfbbb9c1c891aef9dfcbb5 | C++ | micgro42/KonGrad | /src/test.cc | UTF-8 | 14,144 | 2.59375 | 3 | [] | no_license | #define BOOST_TEST_MODULE kongrad_test
#include <boost/test/unit_test.hpp>
#include <boost/test/floating_point_comparison.hpp>
#include <boost/log/core.hpp>
#include <boost/log/trivial.hpp>
#include <boost/log/expressions.hpp>
#include "linsysequ.hh"
#define DEFINE_GLOBAL
//#include "global.h"
#include "geom_pbc.c"
#in... | true |
510cfa637a77ed72d40c7392362b820467b6803d | C++ | onexmaster/cp | /quicksort.cpp | UTF-8 | 535 | 3.203125 | 3 | [
"Apache-2.0",
"MIT",
"LicenseRef-scancode-unknown-license-reference"
] | permissive | #include<bits/stdc++.h>
using namespace std;
int partition(int *A, int start, int end)
{
int pivot=A[end];
int p_index=start;
for(int i=start;i<=end-1;i++)
{
if(A[i]<=pivot)
{
swap(A[i],A[p_index]);
p_index++;
}
}
swap(A[p_index],A[end]);
return(p_index);
}
void quick(int *A, int start, int end)
{
i... | true |
05419e02d7d1685ef25ddc2ab32328cf206e8b76 | C++ | vslavik/poedit | /deps/boost/libs/fusion/test/sequence/io.cpp | UTF-8 | 3,668 | 2.828125 | 3 | [
"GPL-1.0-or-later",
"MIT",
"BSL-1.0"
] | permissive | /*=============================================================================
Copyright (C) 1999-2003 Jaakko Jarvi
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)
==========================================... | true |
9e36fdbab31c57f01212d812a1e17f94601f3e69 | C++ | HoShiMin/HookLib | /HookLibTests/HookLibTests.cpp | UTF-8 | 10,404 | 2.53125 | 3 | [
"MIT"
] | permissive | #include <Windows.h>
#include <HookLib.h>
#include <cstdio>
#include <string>
constexpr bool k_testKernelMode = true;
namespace
{
template <unsigned int num>
__declspec(noinline) int func(int arg1, float arg2)
{
printf("Orig: %u %i %f\n", num, arg1, arg2);
return 0x1ee7c0de;
}
template <unsigned int num>... | true |
2c7f229aea28033f912d4bd69966be848f488586 | C++ | borland/SerialQueueCPP | /SerialQueueCPP/SerialQueue.cpp | UTF-8 | 10,322 | 2.765625 | 3 | [] | no_license | //
// SerialQueue.cpp
// SerialQueueCPP
//
// Created by Orion Edwards on 1/11/15.
// Copyright © 2015 Orion Edwards. All rights reserved.
//
#include "SerialQueue.hpp"
#include <condition_variable>
#include <cassert>
using namespace std;
// C++ has no finally.
template<typename T>
class scope_exit final
{
T ... | true |
5f9271b03a1077fc6f06434bf616e14d6f6eaf64 | C++ | jp112sdl/FFSDL-WK-ZN-ESP32 | /WiFiSetup.h | UTF-8 | 1,763 | 2.671875 | 3 | [] | no_license | //
// 2018-11-22 jp112sdl Creative Commons - http://creativecommons.org/licenses/by-nc-sa/3.0/de/
//
#ifndef __WIFISETUP__H_
#define __WIFISETUP__H_
boolean arrayIncludeElement(uint8_t array[], uint8_t element, uint8_t sz);
boolean arrayIncludeElement(uint8_t array[], uint8_t element, uint8_t sz) {
for (int i = 0; ... | true |
d8660f5c5e4489b0f5541cec3c8f29f6c8128a4c | C++ | marant/magicforest | /magicforest/IEvent.cpp | UTF-8 | 2,058 | 3.3125 | 3 | [] | no_license | #include "IEvent.h"
#include "IGameObject.h"
// Constructor, nothing interesting here
IEvent::IEvent( )
{
this->Description = "Not set";
this->Listener = NULL;
}
// Destructor frees the ObjectList and that's pretty much it
IEvent::~IEvent()
{
int i=0;
for (i = 0; i < ObjectList.size(); i++)
{
dele... | true |
88a80e95a88811e0c214f2d5e6d843d77708895d | C++ | k2font/atcoder | /abc080_C.cpp | UTF-8 | 1,485 | 2.671875 | 3 | [] | no_license | #include <bits/stdc++.h>
using namespace std;
#define REP(i,n) for(int i=0, i##_len=(n); i<i##_len; ++i)
#define all(x) (x).begin(),(x).end()
using ll = long long;
string char_to_string(char val) {
return string(1, val);
}
int char_to_int(char val) {
return val - '0';
}
template<class T> inline bool chmin(T& a, T ... | true |
a6dd67d86ccb7ca4eb2e55530a53a5b653eb5120 | C++ | adayrabe/piscine-cpp | /day01/ex02/src/main.cpp | UTF-8 | 464 | 2.796875 | 3 | [] | no_license | #include "ZombieEvent.hpp"
int main()
{
ZombieEvent zombieEvent = ZombieEvent();
ZombieEvent tempZombieEvent = ZombieEvent();
zombieEvent.setZombieType("Necro");
tempZombieEvent.setZombieType("Runner");
Zombie *zombie1 = zombieEvent.newZombie("Alex");
Zombie *zombie2 = zombieEvent.newZombie("Danny");
zombieEv... | true |
9922295e0db23de4a487394f7d134118faea2457 | C++ | jsethi7133/OOPs | /compex_n.cpp | UTF-8 | 611 | 3.1875 | 3 | [] | no_license | //use of constructors
#include<iostream.h>
class complex{
int r,c;
public:
complex();
complex(int i)
{
r=i;
c=i;
}
complex(int i,int j)
{
r=i;
c=j;
}
void add(complex c1,complex c2)
{
cout<<c1.r+c2.r<<"+"<<c1.c+c2.c<<"i"<<endl... | true |
068e1dc60e170e3f2467718406a5e224f9d7e8dc | C++ | guzhoudiaoke/practice | /poj/poj/ID2000-3000/2593/2593.cpp | UTF-8 | 982 | 3.328125 | 3 | [] | no_license | /*
* problem: poj 2593
* author: guzhoudiaoke
* time: 2011-10-02
*/
#include <stdio.h>
int n, a[100000], sum1[100000], sum2[100000];
void get_sum1()
{
int i, temp;
sum1[0] = temp = a[0];
for (i = 1; i < n; i++)
{
if (temp > 0) temp += a[i];
else temp = a[i];
if (temp > sum1[i-1]) su... | true |
10a4d99a4da03d51eef990ae240b91dce6765ed2 | C++ | keenite/cs | /stl/map.cc | UTF-8 | 991 | 3.65625 | 4 | [] | no_license | #include <iostream>
#include <map>
#include <string>
#include <iterator>
int main()
{
std::map<std::string, int> words_map;
words_map.insert(std::make_pair("earth", 1));
words_map.insert(std::make_pair("moon", 2));
words_map["sun"] = 3;
words_map["earth"] = 4;
// std::map<std::string, int>::iterator ... | true |
36a42bd592e9066eee2862952bc0b1ed92bb7d3f | C++ | arielroque/RPG-PLP | /c++/leitor_de_arquivos.h | UTF-8 | 2,531 | 3.28125 | 3 | [] | no_license | #ifndef LEITOR_DE_ARQUIVOS_CPP_INCLUDED
#define LEITOR_DE_ARQUIVOS_CPP_INCLUDED
#include<bits/stdc++.h>
#include<fstream>
#include "constantes.h"
#define SEPARADOR '#'
#define SOBRESCRITA 1
#define APPEND 2
using namespace std;
/*
//reading test, le todo o arquivo
string texto = lerTexto((string)PATHQU... | true |
fd811d2b6a0073a3a7dea38bf5bedaeba16fabf7 | C++ | NealChalmers/course-project | /DataStructure/R(prim).cpp | UTF-8 | 1,972 | 2.78125 | 3 | [] | no_license | #include <iostream>
#include <memory.h>
using namespace std;
typedef struct linkv
{
int n;
int edge[50];
}linkv;
typedef struct
{
linkv lv[50];
int p;
}pict;
typedef struct
{
int f,t,q;
}egs;
void createpic(pict *,int,int);
int prim(pict *pic);
int main()
{
int p,e;
while(cin>>p&&p)
... | true |
d8ab3377de23ba0608bacd834d457cf2332fd9b0 | C++ | simple-coding-channel/BattleCity | /src/Renderer/VertexBufferLayout.h | UTF-8 | 751 | 2.671875 | 3 | [] | no_license | #pragma once
#include <vector>
#include <glad/glad.h>
namespace RenderEngine {
struct VertexBufferLayoutElement {
GLint count;
GLenum type;
GLboolean normalized;
unsigned int size;
};
class VertexBufferLayout {
public:
VertexBufferLayout();
... | true |
982b3022f0cb7a514d2eed4567e0ea05309bbf9b | C++ | romka0017/TextFileProcessor | /include/inputparameters.h | UTF-8 | 561 | 2.578125 | 3 | [] | no_license | #ifndef __INPUT_PARAMETERS_H__
#define __INPUT_PARAMETERS_H__
#include <cstring>
#include <string>
#include <iostream>
// Mode
enum {
UNDEFINED_MODE = 0,
WORDS_MODE = 1,
CHECKSUM_MODE = 2
};
class InputParams
{
public:
int ParseInputString(int argc, char* argv[]);
unsigned char m_Mode = UN... | true |
39c511ba6fde0043e8f4a58d9e957db200314155 | C++ | deissh/cpp-labs | /3-4/8a.cpp | UTF-8 | 669 | 3.390625 | 3 | [] | no_license | // Кудявцев К. А. ИПБ-20; 3.3 #8a
/*
Задача 8a.
С клавиатуры вводится строка.
a. Заменить все вхождения подстроки «я» на подстроку «ты».
*/
#include <iostream>
#include <string>
std::string readStr() {
std::string val;
std::cout << "> ";
std::string ch;
do {
std::cin >> ch;
val += '... | true |
b853e69efdeec4197c374de18481107ff09b06fe | C++ | PIesy/GameGl | /Framework/world.h | UTF-8 | 1,545 | 2.9375 | 3 | [] | no_license | #ifndef WORLD_H
#define WORLD_H
#include "worldobject.h"
#include "camera.h"
#include "drawableworldobject.h"
#include "light.h"
#include "material.h"
#include <list>
class World
{
std::list<Camera> cameras;
std::list<DrawableWorldObject> drawableObjects;
std::vector<Light> pointLights;
std::vector<Li... | true |
197c99505e335c6c48eb4f3e9e3b8e841ed979fe | C++ | cheeseH/varisev | /src/concurrentqueue.h | UTF-8 | 2,961 | 3.03125 | 3 | [] | no_license | /*
* concurrentqueue.h
*
* Created on: 2015年11月19日
* Author: cheese
*/
#ifndef CONCURRENTQUEUE_H_
#define CONCURRENTQUEUE_H_
#include "varisheader.h"
#include <condition_variable>
#include <atomic>
#include <mutex>
#include <thread>
#include <iostream>
template <typename T>
class ConcurrentQueue
{
T* bu... | true |
00f3130cc525e45e68d02b196bebd1f4c327d461 | C++ | msrshahrukh100/Iqra | /Hackerrank/counting2.cpp | UTF-8 | 332 | 2.703125 | 3 | [] | no_license | #include <iostream>
using namespace std;
int main()
{
int n;
cin>>n;
int a[n+1];
for(int i=0; i<n; i++)
cin>>a[i];
int count[100] = {0};
for(int i=0; i<n; i++)
count[a[i]]++;
for(int i=0; i<100; i++)
{
if(count[i] == 0)
continue;
while(count[i]--)
cout<<i<<" ";
}
// cout<<count[i]<<" ";
... | true |
2c1b624ad12344889f3ac1d0785ece6c77067902 | C++ | fantasiorona/ecs | /ecs/main.cpp | UTF-8 | 3,741 | 2.71875 | 3 | [] | no_license | #include <SFML/Graphics.hpp>
#include <cassert>
#include "RandomNumberGenerator.h"
#include "ColorPicker.h"
#include "ECSManager.h"
#include "CircleMoveSystem.h"
#include "RenderSystem.h"
#include "StatsSystem.h"
#include "CircleComponents.h"
#include "StatsComponent.h"
/**
* 2.6 GHz Quad-Core Intel Core i7
* In ... | true |
7e33188e396b46750c17327e73e507755211b598 | C++ | imdakshraj45/Practicer-Coding | /17EGICS021_ARRAY-5.cpp | UTF-8 | 366 | 3.03125 | 3 | [] | no_license | #include<iostream>
#include<vector>
using namespace std;
int main()
{
int n,i,t=0,sum=0;
vector<int> a[n];
cout<<"Enter size : ";
cin>>n;
cout<<"Enter an elements of array :\n";
for(i=0;i<n;i++)
a[i];
for(i=0;i<n;i++)
{
if(a[i]<a[i+1])
{
sum+=a[i];
}
else
{
t=a[i];... | true |
c9e7023c880c8c0df068829565216a3096c611f9 | C++ | Miserlou/RJModules | /src/Iir.h | UTF-8 | 6,764 | 2.609375 | 3 | [
"MIT"
] | permissive | #ifndef STK_IIR_H
#define STK_IIR_H
#include "Filter.h"
namespace stk {
/***************************************************/
/*! \class Iir
\brief STK general infinite impulse response filter class.
This class provides a generic digital filter structure that can be
used to implement IIR filters. For f... | true |
7335cea305739ae1ab0731e08b1464b5d1d4bb1a | C++ | xSeanliux/CompetitiveProgramming | /UVa/272/272.cpp | UTF-8 | 644 | 2.65625 | 3 | [] | no_license | #include <iostream>
#include <string.h>
using namespace std;
string query;
int N;
int main(){
N = 0;
while(getline(cin, query)){
for(int i = 0; i < query.length(); i++){
if(query[i] == '"'){
string b = query.substr(0, i);
string k = query.substr(i+1);
... | true |
4dc39b2fda637259a405f66fcf237659a9964703 | C++ | Zilby/Graphics-Final | /monorepo-Zilby/Assignment5_SceneGraph/src/Camera.cpp | UTF-8 | 1,940 | 3.28125 | 3 | [] | no_license | #include "Camera.h"
#include "glm/gtx/transform.hpp"
#include <iostream>
// Camera constructor
Camera::Camera(){
std::cout << "(Camera.cpp) Constructor called\n";
eyePosition = glm::vec3(0.0f,2.0f, 5.0f); // FIX: Typically this should be 0,0,0, but I moved for our assignment.
viewDirection = glm::vec3(0.0f,... | true |
b95550771111d25e76431dd75cd655a2c4775158 | C++ | lij313/BattleShip | /Code/Camera.cpp | UTF-8 | 1,938 | 3.0625 | 3 | [] | no_license | #ifdef __APPLE__
# include <OpenGL/gl.h>
# include <OpenGL/glu.h>
# include <GLUT/glut.h>
#else
# include <GL/gl.h>
# include <GL/glu.h>
# include <GL/freeglut.h>
#endif
#include "Camera.h"
#include <ctime>
#include <cmath>
#include <iostream>
#define pi 3.1415926
Camera::Camera(Ship *ship){
this->ship=ship;... | true |
10ace56c9d60c76a11cdd62a806c921a581535f6 | C++ | KorbenC/InterviewQuestions | /Numbers/Fibonacci.cpp | UTF-8 | 524 | 3.515625 | 4 | [] | no_license | #include <iostream>
using namespace std;
int fib(unsigned long int n)
{
if (n <= 1)
{
return 1;
}
else
{
return fib(n-1)+ fib(n-2);
}
}
int main()
{
unsigned long int n;
while(1)
{
cout << "Enter a number (0 to quit): ";
cin >> n;
... | true |
adddffcf8b9e260079b9214597060364061f3ce6 | C++ | cielavenir/procon | /atcoder/abc/tyama_atcoderABC018D.cpp | UTF-8 | 1,851 | 3.0625 | 3 | [
"0BSD"
] | permissive | #include <algorithm>
using namespace std;
template <class BidirectionalIterator>
bool next_combination(BidirectionalIterator first1,
BidirectionalIterator last1,
BidirectionalIterator first2,
BidirectionalIterator last2)
{
if(( first1 == last1 ) || ( first2 == last2 ))return false;
BidirectionalIterator m1 = last1... | true |
9440dc1e9f5a1421d3ca2f0b5abee99fef1a7f1e | C++ | fhsmartking/Leetcode | /offer_T49.cpp | UTF-8 | 649 | 3.203125 | 3 | [] | no_license | #include<iostream>
#include<vector>
#include<algorithm>
using namespace std;
class Solution {
public:
int nthUglyNumber(int n) {
if (n <= 0) return -1;
vector<int> uglyVec(n);
uglyVec[0] = 1;
int a = 0, b = 0, c = 0;
for (int i = 1; i < n; i++) {
... | true |
c06e57879c24537721d29fd915370400af68ac00 | C++ | hsoj/hamclock | /plot.cpp | UTF-8 | 15,601 | 2.609375 | 3 | [
"MIT"
] | permissive | /* handle each plotting area.
*/
#include "HamClock.h"
#define BORDER_COLOR GRAY
#define TICKLEN 2 // length of plot tickmarks, pixels
#define LGAP 21 // left gap for labels
#define BGAP 15 // bottom gap for labels
#define FONTW 6 // font width with gap
#define FONTH 8 // font height
#define NBRGAP ... | true |
9652d7a4cf8b4c4b63f686e9ca831bb516c91ee4 | C++ | deanlee-practice/Sprint4---C-Programing | /BankingSystem/Bank_7/BankingSystem.h | UHC | 663 | 2.671875 | 3 | [] | no_license | #pragma once
#include <iostream>
#include <string>
#pragma warning(disable:4996)
#include "Account.h"
using namespace std;
class BankingSystem {
// ü 迭 : Ҵ
Account* accList[100];
int accNum;// = 0; // ʱⰪ
public:
BankingSystem(); // ϰ, ؿ ۼ
void showMenu() const; //
void makeAccou... | true |
b39efbfec848fadf9abc32bd1d827a29e95caa21 | C++ | wangqian1992511/LeetCode | /367 Valid Perfect Square/001.cpp | UTF-8 | 174 | 2.765625 | 3 | [] | no_license | class Solution {
public:
bool isPerfectSquare(int num) {
if (num < 0) return false;
double x = sqrt(num);
return int(x) * int(x) == num;
}
};
| true |
57f4994d6183abfcec0d55c36177bdb4e6767daa | C++ | KyungminYu/Algorithm | /BOJ/6588 골드바흐의 추측.cpp | UTF-8 | 725 | 2.953125 | 3 | [] | no_license | #include <stdio.h>
#include <vector>
using namespace std;
vector<int> primeSet;
int prime[1000001];
int main(){
for(int i = 2; i <= 1000000; i++) prime[i] = 1;
for(int i = 2; i <= 1000000; i++){
if(prime[i]){
for(int j = i * 2; j <= 1000000; j += i)
prime[j] = 0;
... | true |
543fa2cfee66e4699f57cc945b14652c63d804ac | C++ | ChemicalWonders/CS14 | /lab03/lab03_4.cpp | UTF-8 | 609 | 3.578125 | 4 | [] | no_license | // Name: Kevin Chan
// CS 14 Lab Section: Tue 8:10AM - 11:00AM
// Problem # 5: Circular Linked List
#include <iostream>
#include <list>
#include <vector>
using namespace std;
int main(){
list<int> A;
A.push_back(1);
A.push_back(2);
A.push_back(3);
A.push_back(5);
//A.end() = A.begin();
... | true |
fbc368368ca5a0a3540d241b8f7e23bb30c120f9 | C++ | rkkautsar/cp-solutions | /TOKILearning/v1/1C/toki1c10.cpp | UTF-8 | 375 | 2.984375 | 3 | [
"MIT"
] | permissive | #include <iostream>
#include <cmath>
using namespace std;
int jmlfaktor(long n) {
int jf=0;
int s=trunc(sqrt(n));
if (s*s==n) jf++;
else if (n%s==0) jf+=2;
for(int j=1;j<trunc(sqrt(n));j++) if(!(n%j)) jf+=2;
return jf;
}
int main(){
int n;
long x;
cin>>n;
for(int i=0;i<n;i++){
cin>>x;
if(jmlfaktor(x)<5)... | true |
ac63287223fb4a31426bbdbb0db748daff85b884 | C++ | iTakeshi/ecell4 | /bd/BDWorld.hpp | UTF-8 | 5,772 | 2.546875 | 3 | [] | no_license | #ifndef __ECELL4_BD_BD_WORLD_HPP
#define __ECELL4_BD_BD_WORLD_HPP
#include <boost/scoped_ptr.hpp>
#include <boost/shared_ptr.hpp>
#include <ecell4/core/extras.hpp>
#include <ecell4/core/RandomNumberGenerator.hpp>
#include <ecell4/core/SerialIDGenerator.hpp>
#include <ecell4/core/ParticleSpace.hpp>
namespace ecell4
... | true |
715cd436fa5e6a85f4a5ac0c61950ae05adee462 | C++ | jack5661/SDL_ChasetheSpiders | /TitleCard.cpp | UTF-8 | 1,943 | 2.921875 | 3 | [] | no_license | #include "TitleCard.h"
TitleCard::TitleCard(SDL_Renderer* renderer, SDL_Texture* font) {
fontTexture = font;
this->renderer = renderer;
if (!ReadOldScores()) {
scoreBoard[0] = 0;
scoreBoard[1] = 0;
scoreBoard[2] = 0;
}
}
TitleCard::~TitleCard() {
}
bool TitleCard::ReadOldScores() {
scoreFile = new std::... | true |
60f1ee0888b1ca7071e4d5127d31ccfea76af98d | C++ | propah/AgeOfWar | /Entity.cpp | UTF-8 | 4,664 | 2.640625 | 3 | [] | no_license | #include "Entity.h"
Resources<Texture, int> Entity::textures;
void Entity::initVariables()
{
}
void Entity::initSprites()
{
int texture_id = this->type;
this->e_sprite.setTexture(Entity::textures.get(texture_id));
this->e_sprite.setScale(0.5f, 0.5f);
}
void Entity::initTextures() {
textures.load(... | true |
6e49100d6e085719fcf0a164f3d5122cea479be3 | C++ | CASC-Lang/CAScript-Native | /include/binding/BoundBinaryOperator.h | UTF-8 | 4,065 | 2.984375 | 3 | [] | no_license | //
// Created by ChAoS-UnItY on 8/12/2021.
//
#ifndef COLLAGE_CPP_BOUNDBINARYOPERATOR_H
#define COLLAGE_CPP_BOUNDBINARYOPERATOR_H
#include "syntax/TokenType.h"
#include "BinaryOperatorType.h"
#include "Type.h"
namespace cascript::binding {
struct BoundBinaryOperator {
public:
syntax::TokenType type;
... | true |
863f8237ded793e49ff700042ea55471ae9a3bcf | C++ | keremdayi/experiments | /list-alternative/main.cpp | UTF-8 | 329 | 2.859375 | 3 | [] | no_license | #include <iostream>
#include "List.h"
using namespace std;
int main(){
List<int> myList;
myList.append(4);
myList.append(3);
myList.append(5);
myList.append(1);
myList.append(6);
myList[1] = 0;
cout<<myList.size()<<endl;
for(int i = 0; i < myList.size(); i++) cout<<myList[i]<... | true |
df30b9f23daa80505c786587121059f1447eef7a | C++ | devnguy/nova | /src/Augment.cpp | UTF-8 | 907 | 2.921875 | 3 | [] | no_license | /*******************************************************************************
** Description: Implementation of Augment base class.
*******************************************************************************/
#include <iostream>
#include <string>
#include "Item.hpp"
#include "Augment.hpp"
#include "constants.... | true |
2a3d631989fcbf4768440986710c6b1a39aeb785 | C++ | skyformat99/ccinfra | /test/TestPlainTransData.cpp | UTF-8 | 4,962 | 3.15625 | 3 | [] | no_license | #include "gtest/gtest.h"
#include <ccinfra/mem/PlainTransData.h>
namespace
{
struct Foo
{
int a, b;
};
}
struct PlainTransDataTest : testing::Test
{
protected:
virtual void SetUp()
{
foo.a = 10;
foo.b = 20;
}
const int* getConstPointer() const
{
return intDa... | true |
47603cb849fc82da9b8d081785513f90dce19073 | C++ | ccanete/tpheritage | /src/Models/Figure.cpp | ISO-8859-1 | 2,174 | 2.65625 | 3 | [] | no_license | /*************************************************************************
Figure - description
-------------------
dbut : 21/01/2015
copyright : (C) 2015 par Accardo & Canete
****************************************************... | true |
d1dc2d48055c67b4b73a701c363590f9c1035da9 | C++ | spencerwhyte/cuCareClient | /CUPage.cpp | UTF-8 | 3,166 | 2.625 | 3 | [] | no_license | #include"CUPage.h"
CUPage::CUPage(QString title, bool containsBackButton, CUNavigationProvisioningInterface *pNavigator) : QWidget(), backButton(NULL), request(NULL)
{
setMinimumSize(800, 600); // a smaller window would be unusable, a bigger window would be ugly
layout = new QGridLayout(this);
titleLabe... | true |
ee7ccbc20c591d7e60e30153603dd8be6709309c | C++ | lonelybinary/ESP8266 | /Basic/Digital_Pin/Digital_Pin.ino | UTF-8 | 900 | 2.859375 | 3 | [] | no_license | /***************************************************************************
Written by Taylor for http://lonelybinary.com
BSD license, all text above must be included in any redistribution
***************************************************************************/
//D0 is conncted to GPIO3. you can refer thi... | true |
2c902294bf1023c05e9c58c32bdfa0310ac16aea | C++ | mehediishere/Competitive-Programming | /C & C++/which point is closest to the center.cpp | UTF-8 | 572 | 3.546875 | 4 | [] | no_license | /*
Time : Around 40 minutes
Problem_11 : Given the coordinate of two points p1(x1,y1) and p2(x2,y2). Find which point is closest to the center (0,0).
*/
#include<stdio.h>
#include<math.h>
int main()
{
double x1, y1, x2, y2, distance1, distance2;
scanf("%lf %lf %lf %lf",&x1, &y1, &x2, &y2);
distanc... | true |
8a19720caac68f6a089f2e422b37ce1facb5147c | C++ | MikamiYuto/ReTraining | /Ex01Chapter03/List-Test/IteratorTest.h | SHIFT_JIS | 1,213 | 3.0625 | 3 | [] | no_license | /**
* @file IteratorTest.h
* @breif ev[gCe[^NX̃eXg`t@C
* @author MikamiYuto
* @date 2021.10.13
*/
#pragma once
//----- CN[h
#include "gtest/gtest.h"
#include "../List/List.h"
#include "../List/Iterator.h"
/** Ce[^eXgptBNX`̃x[XNX */
class BaseIteratorTest : public ::testing::Test
{
protected:
/**
* @brief
... | true |
651818e3f8f1ff813cdae4fdc8cd822f84254f01 | C++ | Yang92047111/tutor | /0629/math_operators.cpp | UTF-8 | 572 | 3.203125 | 3 | [] | no_license | #include <iostream>
int main()
{
int a = 21;
int b = 10;
int c ;
c = a + b;
std::cout << "Line 1 - c is : " << c << std::endl;
c = a - b;
std::cout << "Line 2 - c is : " << c << std::endl;
c = a * b;
std::cout << "Line 3 - c is : " << c << std::endl;
c = a / b;
std::cout << "Line... | true |
64ab4653c7524d51c13867d6ab450613b7dbb440 | C++ | brotherb/myleetcode | /Merge Sorted Array.cpp | UTF-8 | 906 | 2.984375 | 3 | [] | no_license | //
// main.cpp
// leet
//
// Created by brotherb on 14-1-11.
// Copyright (c) 2014 brotherb. All rights reserved.
//
#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
struct ListNode {
int val;
ListNode *next;
ListNode(int x) : val(x), next(NULL) {}
};
struct TreeNode {
... | true |