uuid stringlengths 36 36 | repo_name stringlengths 5 133 | relative_path stringlengths 3 3.76k | content stringlengths 282 4.03M | category stringclasses 6
values | algo_rel_score float32 0.9 1 | quality_score float32 3 8.13 | source_meta dict |
|---|---|---|---|---|---|---|---|
999fa6ef-f513-4891-8e06-43627d80324b | Soccjs/algorithm | problem/미로문제.cpp | //https://www.acmicpc.net/problem/2178
#include <iostream>
#include <vector>
#include <queue>
#include <algorithm>
#include <string>
using namespace std;
int r, c;
void dijkstra(vector< vector<int> > miro) {
vector< vector<int> > visited(r + 2, vector<int>(c + 2, false));
vector< vector<int> > dist(r + 2, vector<in... | ALGO | 0.999901 | 4.23719 | {
"github_metadata": {
"branch": "master",
"commit_count": 63,
"repo_created_at": "2016-07-07T05:50:05.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 0,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "1be6636c1... |
c33809a4-1937-4e3d-aede-db721a263ab9 | canyilu/LibADMM-toolbox | proximal_operators/cappedsimplexprojection.cpp | #include <iostream>
#include <vector>
#include <algorithm>
#include "mex.h"
using namespace std;
struct mypair
{
double number;
int index;
void setval(double n, int i)
{
number=n;
index=i;
}
};
bool mycompare(mypair l, mypair r)
{
return (l.number<r.number);
}
void cappedsimplexprojection(... | ALGO | 0.999927 | 3.65032 | {
"github_metadata": {
"branch": "master",
"commit_count": 41,
"repo_created_at": "2016-05-27T06:29:19.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 370,
"forks": 117,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "75c9a... |
2a2c567d-adb7-4d8e-8e84-f60674c491a1 | artificial-intelligence-department/ai_programming_playground_2024 | ai_11/ostap_tsiapa/epic_6/algotester_lab_5_variant_2_ostap_tsiapa.cpp | #include <iostream>
#include <vector>
using namespace std;
int main() {
int N, M;
cin >> N >> M; // Зчитування розмірів печери
vector<string> mystic_cave(N); // Створення вектора рядків для зберігання печери
for (int i = 0; i < N; ++i) {
cin >> mystic_cave[i]; // Зчитування стану печери
... | ALGO | 0.999927 | 5.230277 | {
"github_metadata": {
"branch": "main",
"commit_count": 2638,
"repo_created_at": "2024-09-22T19:14:24.000Z",
"is_fork": false,
"is_org_owned": true,
"forked_from": null,
"stars": 7,
"forks": 2,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "c1b97c6978... |
f61f367b-7bd0-4b93-afd3-c69f5e89db41 | linyueQ/hpws-web-server | code/timer/heaptimer.cpp | #include "heaptimer.h"
void HeapTimer::siftup_(size_t i) {
assert(i >= 0 && i < heap_.size());
size_t j = (i - 1) / 2;
while(j >= 0) {
if(heap_[j] < heap_[i]) { break; }
SwapNode_(i, j);
i = j;
j = (i - 1) / 2;
}
}
void HeapTimer::SwapNode_(size_t i, size_t j) {
as... | ALGO | 0.980691 | 5.215207 | {
"github_metadata": {
"branch": "master",
"commit_count": 14,
"repo_created_at": "2022-02-22T07:03:03.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 1,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "bd032ca52... |
bbdf903f-d26c-45e0-bd8e-2f10dba2d871 | drx1625394938/C_Study | Project3/Project3/DLinkList.cpp | #define _CRT_SECURE_NO_WARNINGS 1
#include<stdlib.h>
typedef struct LNode
{
int data;
LNode* pior;//前驱指针
LNode* next;//后继指针
}LNode,*DLinkList;
//创建
DLinkList CreateDList()
{
LNode* p = (LNode*)malloc(sizeof(LNode));
if (p == NULL)return NULL;
else return p;
}
//插入
DLinkList InsertDList(DLinkList DList,int i,in... | ALGO | 0.999837 | 3.478534 | {
"github_metadata": {
"branch": "main",
"commit_count": 20,
"repo_created_at": "2023-06-21T11:33:55.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 0,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "8abba55179c... |
cca521ba-0a8a-427a-9c97-1384b6c74099 | PabloSan19/UTACode | Programming Languages/Lab1/pjs_lab01.cpp | //<NAME>
//
//Lang ver. = C++14
//OS - Ubuntu (also tested on omega and works)
#include <iostream>
#include <dirent.h>
#include <string.h>
using namespace std;
long int FChecker(char prev[])
{
//create long int to hold sum of sizes and create DIR* to hold directory pointer and dirent to help read the pointer
... | ALGO | 0.966218 | 4.739216 | {
"github_metadata": {
"branch": "main",
"commit_count": 1,
"repo_created_at": "2025-02-25T22:40:57.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 0,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "87919ca3376e... |
24727763-4466-44e7-aa08-8518e57004a5 | homedory/codetree-TILs | 241007/대폭발/big-explosion.cpp | #include <iostream>
#include <vector>
using namespace std;
#define MAX_N 105
int n, m, r, c;
int grid[MAX_N][MAX_N];
vector<pair<int,int>> bomb;
int dr[4] = {-1, 1, 0, 0};
int dc[4] = {0, 0, -1, 1};
bool inRange(int row, int column) {
return row > 0 && row <= n && column > 0 && column <= n;
}
int main() {
c... | ALGO | 0.99984 | 4.010096 | {
"github_metadata": {
"branch": "main",
"commit_count": 1038,
"repo_created_at": "2024-01-12T16:08:58.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 0,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "083a09f6f... |
df0ef6b9-3b48-4a6e-baa5-85223c7d128d | Salka1988/cg_exercises | computer-graphics-1-task1b-01531697/source/framework/math/matrix.h |
#ifndef INCLUDED_FRAMEWORK_MATH_MATRIX
#define INCLUDED_FRAMEWORK_MATH_MATRIX
#pragma once
#include "vector.h"
namespace math
{
template <typename T, int M, int N>
struct matrix;
template <typename T>
struct matrix<T, 2, 2>
{
T _11, _12,
_21, _22;
matrix() = default;
constexpr matrix(T m11, T m... | TOOL | 0.995439 | 7.098091 | {
"github_metadata": {
"branch": "master",
"commit_count": 2,
"repo_created_at": "2021-12-01T09:38:20.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 1,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "e91b3abc09... |
eaa3180d-c663-4b98-a098-f02cc57b9370 | aleruzza/LSN2021 | 10/TSPwithMPI/src/TSPIndividual.h | #ifndef TSPINDIVIDUALCLASS
#define TSPINDIVIDUALCLASS
#include <vector>
#include "random.h"
#include <cmath>
#include <fstream>
#include "TSProblem.h"
/*
Implementation of Individual for the Travelling salesman problem
The cities coordinates are saved in the instance of TSPproblem referenced
m_gene contai... | ALGO | 0.983707 | 5.116679 | {
"github_metadata": {
"branch": "master",
"commit_count": 25,
"repo_created_at": "2021-07-04T20:59:37.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 0,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "e18a9c8bc... |
d1a0653e-560c-40c6-9a69-007c78920bd0 | AmirjonQodirov/algorithms_and_data_structures | introduction to algorithms/1155.cpp | #include <iostream>
#include <vector>
using namespace std;
int a, b, c, d, e, f, g, h;
int get_value(char x) {
switch (x) {
case 'A':
return a;
case 'B':
return b;
case 'C':
return c;
case 'D':
return d;
case 'E':
re... | ALGO | 0.999945 | 3.571806 | {
"github_metadata": {
"branch": "master",
"commit_count": 2,
"repo_created_at": "2020-03-14T15:18:03.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 1,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "acce4d833e... |
20222ee6-d071-4bd2-88d3-0c8b5a53ce68 | chhotugoud7/DSA-Daily-Practice | arrayAssignment/PivotIndex.cpp | // find pivot index problem leetcode 724
// pivot index is: from which left sum and right sum all respected element is equal
// Brute Force
#include<iostream>
using namespace std;
int pivotIndex(int arr[], int size ){
for (int i =0; i<size; i++){
int leftSum = 0 ;
int rightSum = 0;
//f... | ALGO | 0.99999 | 5.674407 | {
"github_metadata": {
"branch": "main",
"commit_count": 30,
"repo_created_at": "2024-12-23T05:26:55.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 0,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "019c46073cb... |
bf627531-11d9-49a9-a94b-80c32c4a882b | fredzqm/KattisPractice | cpp/averagespeed.cpp | #include <iostream>
#include <sstream>
#include <string>
#include <cstring>
#include <cstdio>
#define MAXSIZE 1024
using namespace std;
/**
* https://open.kattis.com/problems/averagespeed
*
* string processing
*/
long getTime(int h, int m, int s) {
return (h * 60l + m ) * 60 + s;
}
void averageSpeed() {
int ... | ALGO | 0.983942 | 4.222273 | {
"github_metadata": {
"branch": "master",
"commit_count": 33,
"repo_created_at": "2016-11-04T13:11:05.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 0,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "8774d1c3e... |
ca92cff2-6d67-46a6-9333-bb62de7cce30 | brycesilan/CSUS-Senior-Project | Software/Arduino/Moisture_pH/Moisture_pH.ino | //Refer to Software-sem1/Moisture_and_pH/Moisture_and_pH.ino for previous moisture sensor code.
//Look at rh calculation and translate it to older/newer moisture sensors
float calibration_value = 23.85 - 0.4;
int pH_sensor_pin = A0; //A0
int moisture_1_pin = A1; //A1
int moisture_2_pin = A2; //A2
int moisture_3_pin ... | TOOL | 0.906465 | 4.025927 | {
"github_metadata": {
"branch": "main",
"commit_count": 122,
"repo_created_at": "2022-03-20T01:10:36.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 4,
"forks": 1,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "464216ca28... |
9a5cf4e9-0f48-4ef5-8cf3-b698acaa6a33 | kang-min-seok/BaekJoon_cpp | 알고리즘별 풀어보기/그래프탐색/1987.cpp | // map은 확인, 삽입, 삭제에서 평균적으로 log N의 시간복잡도가 발생해서 비효율적임
// 이런경우에는 그냥 배열 쓰는게 속도가 훨 빠름
#include <iostream>
#include <stack>
#include <tuple>
#include <vector>
using namespace std;
vector<vector<char>>board_vec;
int dx[4] = {1,-1,0,0};
int dy[4] = {0,0,1,-1};
int width, height;
bool visit_vec[26] = {false,};
int result = 0... | ALGO | 0.999921 | 5.269831 | {
"github_metadata": {
"branch": "main",
"commit_count": 62,
"repo_created_at": "2024-10-02T07:03:37.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 0,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "28d0dfc4b46... |
357f6c5c-b493-4804-bd55-a977c904ff39 | JoshuaKPinto/CGI | lib/linalg.h | #pragma once
#define PI 3.14159265359
#include<iostream>
#include<math.h>
template <typename T>
class Mat44 {
private:
T data[4][4] = { {1,0,0,0},
{0,1,0,0},
{0,0,1,0},
{0,0,0,1}};
public:
Mat44(T[][4]);
Mat44(void);
T det();
Mat44 inverse();
T* operator[](int i) { return data[i]; }
Mat44 ... | TOOL | 0.987931 | 3.252652 | {
"github_metadata": {
"branch": "master",
"commit_count": 9,
"repo_created_at": "2020-05-20T08:39:35.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 0,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "e092138954... |
568785e1-83c2-4e25-96b4-ab528588ff61 | YuSoeun/Baekjoon | ssafy2025/1767_프로세서연결하기.cpp | #include <bits/stdc++.h>
using namespace std;
#define R first
#define C second
int N;
int udlr[4][2] = {{-1, 0}, {1, 0}, {0, -1}, {0, 1}};
int checkBoundary(int x, int y) {
if (x < 0 || x >= N) return 0;
if (y < 0 || y >= N) return 0;
// in boundary
return 1;
}
vector<vector<int> > markWire(vecto... | ALGO | 0.999888 | 4.652603 | {
"github_metadata": {
"branch": "main",
"commit_count": 116,
"repo_created_at": "2020-11-23T15:55:25.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 1,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "8709b81890... |
a4520f93-9ece-4faa-80bb-3e9b1217165b | matplotlib/matplotlib | extern/agg24-svn/include/agg_simul_eq.h | //----------------------------------------------------------------------------
// Anti-Grain Geometry - Version 2.4
// Copyright (C) 2002-2005 <NAME> (http://www.antigrain.com)
//
// Permission to copy, use, modify, sell and distribute this software
// is granted provided this copyright notice appears in all copies.
... | ALGO | 0.999952 | 5.414755 | {
"github_metadata": {
"branch": "main",
"commit_count": 52759,
"repo_created_at": "2011-02-19T03:17:12.000Z",
"is_fork": false,
"is_org_owned": true,
"forked_from": null,
"stars": 21441,
"forks": 7928,
"issues": 1241,
"pull_requests": 419
},
"file_meta": {
"content_id"... |
1e0b0131-d9db-45c3-92f8-d82d559e1531 | ellieya/CSC326_Lab1 | CSC326_Lab1/JC_CSC326_Lab1.cpp | /*
<NAME>
Lab 1: Sequence Class
In Lab 1, we use a template class containing a dynamically allocated array.
The class contains functions to access private data members, get elements, to set elements, to search for elements, to add elements, etc.
*/
/* HEADER START */
#include <iostream>
#include <string>
using nam... | TOOL | 0.945868 | 4.373512 | {
"github_metadata": {
"branch": "master",
"commit_count": 12,
"repo_created_at": "2018-09-07T03:57:38.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 0,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "18218ae51... |
33d0196c-b62a-49c6-b670-05a7caa860fe | anik804/OOP-Concepts | Operator Overloading/Relational And Logical Operator Overloading/Ex_1.cpp | /// In the following program the "==" Operator Overloaded.
#include<iostream>
using namespace std;
class Coord
{
private :
int x;
int y;
public :
Coord()
{
x = 0;
y = 0;
}
Coord( int i , int j )
{
x = i;
y = j;
}
void show()
{
cout << "x ... | ALGO | 0.93413 | 5.306289 | {
"github_metadata": {
"branch": "main",
"commit_count": 6,
"repo_created_at": "2023-11-22T17:53:24.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 0,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "fb1e117fb754... |
7923b3fb-01e5-47ac-9cbc-a4cd57ca350f | anikakash/SportsProgramming | CodeForces/C. Division by Two and Permutation.cpp | #include<bits/stdc++.h>
using namespace std;
#define flush cin.ignore(numeric_limits<streamsize>::max(),'\n')
#define FASTERIO ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
#define NL cout<<'\n';
// #define pi acos(-1.0) //3.1415... | ALGO | 0.999827 | 3.885446 | {
"github_metadata": {
"branch": "main",
"commit_count": 569,
"repo_created_at": "2021-05-16T17:04:53.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 9,
"forks": 0,
"issues": 1,
"pull_requests": 0
},
"file_meta": {
"content_id": "1e28afa222... |
4c91dd67-c4b2-41c3-b933-5a890b574585 | shechty2/mileStone2 | BFS.cpp | //
// Created by yuvalshechter on 05/02/2020.
//
#include "BFS.h"
#include "HelpfulFunctionsForMatrix.h"
int BFS:: getExpended() {
return expandedNodesNum;
}
string BFS::search(Searchable* searchable) {
unordered_map<string, State*>* v_map = searchable->getVertexMap() ;
queue<State*> qe;
State* curA... | ALGO | 0.99984 | 3.592456 | {
"github_metadata": {
"branch": "master",
"commit_count": 56,
"repo_created_at": "2020-01-27T15:09:39.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 0,
"forks": 1,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "ca722ac80... |
de08b3be-4b3a-4931-9446-3478f2d35b8d | medvedevgroup/CaPLa | src/piecewise_linear_model.hpp | // This file is part of PGM-index <https://github.com/gvinciguerra/PGM-index>.
// Copyright (c) 2018 <NAME>.
//
// 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.or... | ALGO | 0.998014 | 7.03428 | {
"github_metadata": {
"branch": "main",
"commit_count": 15,
"repo_created_at": "2025-04-22T18:36:28.000Z",
"is_fork": false,
"is_org_owned": true,
"forked_from": null,
"stars": 0,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "c768de0f222a... |
e9449c25-c28c-4c2d-b6cc-4b08ad1bf7d7 | Saturno10/Wild-Word-Games | 300 - DiccionionarioConArboles/src/NodoTrie.cpp | //
// Created by maria on 26/11/23.
//
#include "../include/NodoTrie.h"
NodoTrie::NodoTrie() : car('/0'), sig(nullptr), ptr(nullptr){
//Inicializar si quisieramos
}
NodoTrie::~NodoTrie() {
delete sig; //Destruimos hijo izquierdo
delete ptr; //Destruimos hermano derecho
}
NodoTrie *NodoTrie::consulta(ch... | ALGO | 0.990352 | 3.317511 | {
"github_metadata": {
"branch": "main",
"commit_count": 50,
"repo_created_at": "2023-10-28T09:37:46.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 1,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "8c431e41adb... |
3412971e-0c88-4134-b03c-115b6a2ca320 | Abhishek0075/OOPS-CYCLES | Cycle 2/Cycle_2.cpp | #include<iostream>
using namespace std;
class complex{
float real,img;
public:
complex(){
real=0;
img=0;
}
complex(float x,float y){
real=x;
img=y;
}
void display(){
cout<<"Complex number : "<<endl<<">>> ";
cout<<real;
if(img<0){
... | ALGO | 0.935042 | 4.114723 | {
"github_metadata": {
"branch": "main",
"commit_count": 95,
"repo_created_at": "2022-03-02T16:48:02.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 0,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "a418064208c... |
78065a32-85e8-4f7d-85d9-853a11252c20 | Xilinx/Vitis_Libraries | security/L1/benchmarks/rc4Encrypt/kernel/rc4EncryptKernel1.cpp | /*
* Copyright 2019 Xilinx, 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 agreed to... | ALGO | 0.995354 | 5.262636 | {
"github_metadata": {
"branch": "main",
"commit_count": 471,
"repo_created_at": "2019-09-23T19:13:46.000Z",
"is_fork": false,
"is_org_owned": true,
"forked_from": null,
"stars": 988,
"forks": 381,
"issues": 0,
"pull_requests": 12
},
"file_meta": {
"content_id": "955470... |
a3a54214-7ef0-42a5-aa41-863666eeb953 | stone-ts15/IMAlgorithm | CELFPP/SimpleHANP.h | #pragma once
#include"node.h"
#include"network.h"
#include "SimpleNetwork.h"
typedef pair<int, list<Node*> > ComPair; // community<cid,members>
typedef vector<ComPair> ComsVec;
typedef map<int, list<Node*> > ComsMap;
typedef set<Node*> Outs;
typedef set<Node*> Hubs;
class SimpleHANP {
private:
int max_T;
flo... | ALGO | 0.992364 | 4.550837 | {
"github_metadata": {
"branch": "master",
"commit_count": 3,
"repo_created_at": "2018-07-27T03:51:24.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 0,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "464e628710... |
f92b9552-dab1-4d15-87c0-56d5234f5e81 | SalvaMoreG/VipCommonLib | src/CVIPBaseLor.cc |
#include "CVIPBaseLor.h"
#include "CVIPUtils.h"
#include <iostream>
#include <cassert>
using namespace std;
ostream& operator<<(ostream& os, const CVIPBaseLor& in_lor)
{
os << "hit-1: " << in_lor.GetPosition1() << " E: " << in_lor.GetE1() << " ";
os << "hit-2: " << in_lor.GetPosition2() << " E: " << in_lor.GetE2(... | ALGO | 0.997375 | 5.698513 | {
"github_metadata": {
"branch": "main",
"commit_count": 2,
"repo_created_at": "2025-05-04T08:00:28.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 0,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "c70a6bacf3e7... |
b6b5a045-6d73-4223-bb7d-91370ce096d4 | gafeol/competitive-programming | ojs/spoj/FASTFLOW.cpp | #include <bits/stdc++.h>
using namespace std;
#define fst first
#define snd second
typedef unsigned long long ull;
typedef long long ll;
typedef pair<int, int> pii;
#define pb push_back
#define for_tests(t, tt) int t; scanf("%lld", &t); for(int tt = 1; tt <= t; tt++)
#ifndef ONLINE_JUDGE
#define debug(args...) fprintf(... | ALGO | 0.99997 | 3.812407 | {
"github_metadata": {
"branch": "master",
"commit_count": 406,
"repo_created_at": "2016-09-11T01:55:53.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 2,
"forks": 0,
"issues": 1,
"pull_requests": 0
},
"file_meta": {
"content_id": "a8fdd097... |
b30b5e87-be35-4c76-b53e-52f3d3a920de | Koyingtw/CP | USACO/2203_silver/PB.cpp | #pragma GCC optimize("O3")
#include <bits/stdc++.h>
#define Weakoying ios::sync_with_stdio(0), cin.tie(0), cout.tie(0);
#define int long long
#define pii pair<int, int>
#define vi vector<int>
#define vii vector<pair<int, int>>
#define pqueue priority_queue
#define pb push_back
#define F first
#define S second
#define m... | ALGO | 0.999938 | 4.003157 | {
"github_metadata": {
"branch": "main",
"commit_count": 79,
"repo_created_at": "2021-07-10T12:46:08.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 3,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "f536dae51da... |
bd7ddb80-e0ee-4451-84f3-ab806f438b19 | nguyen-minh-16-06/C_plus | D_array/baitap17.cpp | #include <iostream>
using namespace std;
int main()
{
int n;
while (n <= 0)
{
cout << "Nhap n: ";
cin >> n;
}
int a[100];
bool valid = true;
for (int i = 0; i < n; i++)
{
cout << "Nhap so thu " << i + 1 << ": ";
cin >> a[i];
if (i > 0 && a[i] ... | ALGO | 0.999057 | 3.726068 | {
"github_metadata": {
"branch": "main",
"commit_count": 46,
"repo_created_at": "2024-10-06T12:31:11.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 0,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "1df6894e8ce... |
882380a6-3345-4d41-a29d-f5edc3225e54 | InFluX-M/Automata | Headers/DFA.h | //
// Created by influx on 5/24/23.
//
#include <bits/stdc++.h>
#include "Base.h"
using namespace std;
#ifndef AUTOMATA_DFA_H
#define AUTOMATA_DFA_H
class DFA {
public:
set<State*> Q;
set<char> alphabet;
State* q0;
set<State*> finals;
map<Transfer*, State*> transferFunctions;
DFA(const set<Sta... | ALGO | 0.998631 | 5.25137 | {
"github_metadata": {
"branch": "main",
"commit_count": 15,
"repo_created_at": "2023-05-24T07:27:04.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 0,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "60031c3493d... |
1821cfc8-8aab-4c14-bebe-07567523517a | projectchrono/chrono | src/chrono/fea/ChMatrixCorotation.h | // =============================================================================
// PROJECT CHRONO - http://projectchrono.org
//
// Copyright (c) 2014 projectchrono.org
// All rights reserved.
//
// Use of this source code is governed by a BSD-style license that can be found
// in the LICENSE file at the top level of t... | ALGO | 0.965126 | 7.419335 | {
"github_metadata": {
"branch": "main",
"commit_count": 18253,
"repo_created_at": "2013-09-03T15:34:23.000Z",
"is_fork": false,
"is_org_owned": true,
"forked_from": null,
"stars": 2460,
"forks": 515,
"issues": 101,
"pull_requests": 4
},
"file_meta": {
"content_id": "69... |
4cef41bc-4315-49b8-8075-8fa0af7ca65a | AndreaGirlando/Uni | 1203 programmazione-2[✅30]/C++/Alberi/main.cpp | #include <iostream>
#include <iomanip>
using namespace std;
class BST;
class BSTNode {
public:
BSTNode(int _d, BSTNode* _dx = nullptr, BSTNode* _sx = nullptr, BSTNode* _padre = nullptr)
: d(_d), dx(_dx), sx(_sx), padre(_padre) {}
friend ostream& operator<<(ostream& stream, BSTNode& temp... | ALGO | 0.999928 | 4.458372 | {
"github_metadata": {
"branch": "main",
"commit_count": 382,
"repo_created_at": "2024-09-17T20:21:27.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 2,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "1e5576d68c... |
8614afa2-1648-4e4f-a570-865f339e046f | lballabio/QuantLib | ql/math/randomnumbers/mt19937uniformrng.cpp | /* -*- mode: c++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*
Copyright (C) 2003 <NAME>
Copyright (C) 2010 <NAME>
This file is part of QuantLib, a free-software/open-source library
for financial quantitative analysts and developers - http://quantlib.org/
QuantLib is free software: you can r... | TOOL | 0.998252 | 7.224482 | {
"github_metadata": {
"branch": "master",
"commit_count": 17543,
"repo_created_at": "2015-12-17T16:29:33.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 6151,
"forks": 1964,
"issues": 51,
"pull_requests": 11
},
"file_meta": {
"content_id":... |
aded0a09-fc0f-43b3-99fa-521de7ee2da4 | intel-system-studio/samples | tbb/cpp/task/tree_sum/OptimizedParallelSumTree.cpp | /*
==============================================================
SAMPLE SOURCE CODE - SUBJECT TO THE TERMS OF SAMPLE CODE LICENSE AGREEMENT,
http://software.intel.com/en-us/articles/intel-sample-source-code-license-agreement/
Copyright (C) Intel Corporation
THIS FILE IS PROVIDED "AS IS" WITH NO ... | ALGO | 0.999658 | 6.007205 | {
"github_metadata": {
"branch": "iss2019-update4",
"commit_count": 155,
"repo_created_at": "2017-07-14T00:21:51.000Z",
"is_fork": false,
"is_org_owned": true,
"forked_from": null,
"stars": 22,
"forks": 10,
"issues": 0,
"pull_requests": 1
},
"file_meta": {
"content_id":... |
a5189dc4-89cc-4af7-aaed-911d9f674d26 | byeongkukoh/algorithm | Cpp/BaekJoon/Gold/G4_1261.cpp | #include <iostream>
#include <queue>
#include <string>
#include <vector>
using namespace std;
struct Node {
int y;
int x;
};
int n, m;
vector<vector<int>> map;
vector<vector<int>> dist;
int dy[] = {-1, 1, 0, 0};
int dx[] = {0, 0, -1, 1};
void bfs(int y, int x) {
queue<Node> que;
que.push({y, x});
dist[y... | ALGO | 0.999968 | 4.199915 | {
"github_metadata": {
"branch": "main",
"commit_count": 475,
"repo_created_at": "2024-09-23T15:52:46.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 1,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "5022473927... |
7c21e7ff-a212-4bd0-9343-99fb9e4a01eb | Najmul-Huda70/Problem-Solve | Year-2024/algorithm/C_Longest_Good_Array.cpp | /*************************************************************************
Don't feel alone. Allah is with you!
I said I failed...
Allah says the believers are successful [Surat al-Mu'minun 23:1]
I said none of my plans are succeeding.....
Allah says Allah is the best planner [Surah Imran 3:54]
********************... | ALGO | 0.999797 | 3.853788 | {
"github_metadata": {
"branch": "main",
"commit_count": 212,
"repo_created_at": "2024-10-28T07:46:06.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 0,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "a5e2d00075... |
4e77f3fa-293f-4d35-b489-ee25dd9bcf09 | PeterHester/gmit-course-cpp | lab3/ArrayOfSum.h | #include <iostream>
using namespace std;
//Q6 Print the array of numbers and memory locations using a function and pass the array by value.
void printArrayOfSum(int arrOfNums[],int NumsInArray,int sum,int &scalar){
int* j;//use j as a pointer
int* p; //use p as a pointer
int arrOfNums1[5];//New array ... | ALGO | 0.987276 | 3.636525 | {
"github_metadata": {
"branch": "main",
"commit_count": 41,
"repo_created_at": "2020-11-13T11:35:38.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 0,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "2f24060728b... |
ba656f2f-39a9-4cba-9a43-084ea38c412d | 05sachin/DSAwithCpp | 18-BSTAAndBinaryTreeAssignment/2PairSumBinaryTree.cpp | /*Given a binary tree and an integer S, print all the pair of nodes whose sum equals S.
Assume binary tree contains all unique elements.
Note : In a pair, print the smaller element first. Order of different pair doesn't matter.*/
#include <iostream>
#include<algorithm>
#include <queue>
#include <climits>
#include<vect... | ALGO | 0.999975 | 5.232549 | {
"github_metadata": {
"branch": "main",
"commit_count": 1,
"repo_created_at": "2023-04-29T20:46:50.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 0,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "ff92142b24cb... |
824467eb-03bb-44ec-b28b-9cfeb53f43e9 | Worthy-Wang/LeetCode | Chapter1_Array/Leetcode33/main1.cpp | #include <iostream>
#include <vector>
#include <algorithm>
#include <iterator>
using namespace std;
/*
题目:33. Search in Rotated Sorted Array
链接:https://leetcode-cn.com/problems/search-in-rotated-sorted-array/
begin: 10:55
end: 11:19
Time complexity: O(logn)
Space complexity: O(1)
*/
class Solution
{
public:
int ... | ALGO | 0.999993 | 5.715338 | {
"github_metadata": {
"branch": "master",
"commit_count": 18,
"repo_created_at": "2020-04-27T01:43:17.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 6,
"forks": 2,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "5545677dd... |
c12c5ffd-565a-4198-b043-758a7b4f9e77 | Camithilwen/Code-Cloning-Analysis | src/llm-scripts/testing/Project_CodeNet_experimentation_dataset/data/p02837/s428021887.cpp | //
// honestorunkind2.cpp
// my_programs
//
// Created by <NAME> on 7/27/20.
// Copyright © 2020 <NAME>. All rights reserved.
//
#include <iostream>
using namespace std;
int f = 0;
int combination(int n, int xy[][2], int A[], int b[], int d, int MAX){
if(d == n){
f = 0;
for(int i = 1; i <= n;... | ALGO | 0.998602 | 3.791938 | {
"github_metadata": {
"branch": "main",
"commit_count": 243,
"repo_created_at": "2025-06-06T16:57:42.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 4,
"forks": 0,
"issues": 3,
"pull_requests": 0
},
"file_meta": {
"content_id": "9caedcd4c0... |
f5dfd24b-f7a2-4233-b301-2f2de57ea197 | Abhijadhav03/DSA | arrays/movezeros.cpp | // #include<bits/stdc++.h>
// using namespace std;
// int movezeroes(int vector<int> a, int n ){
// vector<int> temp;
// for(i=0;i<n;i++){
// if(a[i]!=0)
// temp.push_back(a[i]);
// }
// int nz = temp.size();
// for (int i = 0; i < nz; i++) {
// a[i] = temp[... | ALGO | 0.999981 | 5.180366 | {
"github_metadata": {
"branch": "main",
"commit_count": 52,
"repo_created_at": "2024-05-27T17:02:19.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 0,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "291be0df725... |
9960b8d1-0fca-4574-a099-21c3b0f07437 | acm-clan/algorithm-stone | user/leetcode/35.搜索插入位置.cpp | /*
* @lc app=leetcode.cn id=35 lang=cpp
*
* [35] 搜索插入位置
*/
#include <iostream>
#include <vector>
#include <queue>
#include <set>
#include <algorithm>
using namespace std;
// @lc code=start
class Solution {
public:
int searchInsert2(vector<int>& nums, int t) {
int n = nums.size();
int l=0, r=n-1... | ALGO | 0.999993 | 6.357438 | {
"github_metadata": {
"branch": "main",
"commit_count": 574,
"repo_created_at": "2021-02-18T15:25:35.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 2066,
"forks": 620,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "8f37d... |
a9c7c152-0436-45dc-873e-42ad6830091d | logankaser/piscine_cpp | day07/ex00/whatever.cpp | #include <string>
#include <iostream>
template <typename T>
void swap(T &a, T &b)
{
T tmp = a;
a = b;
b = tmp;
}
template <typename T>
const T& min(T const &a, T const &b)
{
return (b > a ? a : b);
}
template <typename T>
const T& max(T const &a, T const &b)
{
return (b > a ? b : a);
}
int main(void)
{
int ... | TOOL | 0.958272 | 5.356688 | {
"github_metadata": {
"branch": "master",
"commit_count": 2,
"repo_created_at": "2018-05-09T01:32:46.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 0,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "1dfafbe9ab... |
b7f315b3-cb46-468d-b05d-4166d4b5a9e6 | SakshiRai01/Leetcode-Algo-Explorer | 21-merge-two-sorted-lists/merge-two-sorted-lists.cpp | /**
* Definition for singly-linked list.
* struct ListNode {
* int val;
* ListNode *next;
* ListNode() : val(0), next(nullptr) {}
* ListNode(int x) : val(x), next(nullptr) {}
* ListNode(int x, ListNode *next) : val(x), next(next) {}
* };
*/
class Solution {
public:
ListNode* mergeTwoLis... | ALGO | 0.999971 | 5.74884 | {
"github_metadata": {
"branch": "main",
"commit_count": 186,
"repo_created_at": "2023-08-20T07:25:46.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 2,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "9f23d49935... |
52422b12-258f-40ef-8348-1359d30485cf | davidvollmar/SimpleRobot | control.ino | #define LEFT 0
#define RIGHT 1
#define FORWARD 0
#define BACKWARDS 1
#define MENABLED 0
const int pwmA = 3;
const int pwmB = 11;
const int dirA = 12;
const int dirB = 13;
const int pingPin = 22;
int read = 0;
int command = 0;
int setpoint = 0;
volatile long coder[2] = {
0,0};
int lastSpeed[2] = {
0,0};
long dura... | TOOL | 0.994356 | 4.822637 | {
"github_metadata": {
"branch": "master",
"commit_count": 3,
"repo_created_at": "2013-03-05T12:21:28.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 0,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "216cc06feb... |
1e12bc77-c188-476d-9512-7ae9e050bb0c | MrRoot1123/PraticeOfJianZhiOffer | No26Convert.cpp | /*
输入一棵二叉搜索树,将该二叉搜索树转换成一个排序的双向链表。要求不能创建任何新的结点,只能调整树中结点指针的指向。
*/
#include <iostream>
#include <queue>
using namespace std;
struct TreeNode {
int val;
struct TreeNode *left;
struct TreeNode *right;
TreeNode(int x) :
val(x), left(NULL), right(NULL) {
}
};
class Solution {
public:
TreeNode* Convert(TreeNode* p... | ALGO | 0.999976 | 5.467412 | {
"github_metadata": {
"branch": "master",
"commit_count": 45,
"repo_created_at": "2020-01-07T13:56:17.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 0,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "df527925a... |
4f53993a-5687-49bd-a0c7-cf22854ef1ff | rajeshkumarblr/datastructures | Arrays/arrange.cpp | #include <iostream>
#include "arrayops.h"
#include <stack>
#include <vector>
#include "dsutils.h"
using namespace std;
int* arrangeMinMaxCopy(int* arr, int size) {
int *newarr = new int[size];
if (newarr != NULL) {
int j = size -1;
int k = 0;
for (int i= 0; i<size; i++) {
if ((i%2)==0) {
newarr[i] = a... | ALGO | 0.998965 | 4.752785 | {
"github_metadata": {
"branch": "master",
"commit_count": 13,
"repo_created_at": "2017-11-05T07:04:15.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 0,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "f141458c1... |
24596d09-e316-474b-aaca-ccb4ff873e75 | Kev1n-Agudel0/POO | 006.cpp | #include <iostream>
using namespace std;
int main() {
// Definir el tamaño de la matriz
const int num_estudiantes = 4;
const int num_notas = 3;
// Crear una matriz para almacenar la información de los estudiantes y sus notas
double matriz_estudiantes[num_estudiantes][num_notas];
// Ingresar l... | TOOL | 0.974385 | 4.797266 | {
"github_metadata": {
"branch": "main",
"commit_count": 3,
"repo_created_at": "2023-08-11T22:06:18.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 0,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "c0b71355b2f5... |
79d71f22-8c9b-4689-9d2d-ddd4bea24879 | tmwilliamlin168/CompetitiveProgramming | Codeforces/1109E.cpp | #include <bits/stdc++.h>
using namespace std;
#define ll long long
const int mxN=1e5;
int n, M, q, a[mxN], k;
ll st[1<<18], pp[9][16*mxN+1], ps[9], iv[mxN+1];
struct dat {
ll x=1;
int a[9];
void rst(int b=1) {
for(int i=0; i<k; ++i) {
a[i]=0;
while(b%ps[i]==0) {
b/=ps[i];
++a[i];
}
}
x=b%M;... | ALGO | 0.999974 | 4.700019 | {
"github_metadata": {
"branch": "master",
"commit_count": 1192,
"repo_created_at": "2018-05-07T06:37:09.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 551,
"forks": 120,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "166... |
b3093333-71ca-4054-bf83-fd126727eb6e | snowgoon88/ChuchuGL | opengltuto/tuto-004-transform.cpp | /* -*- coding: utf-8 -*- */
/**
* tuto-004-transform.cpp
*
* Matrices de projection et autres
* http://en.wikibooks.org/wiki/OpenGL_Programming/Modern_OpenGL_Tutorial_04
* Se souvenir
* Transformations are applied by multiplying 4x4 matrices in the reverse order. M = M_translation * M_rotation means rotate firs... | TOOL | 0.931423 | 5.152583 | {
"github_metadata": {
"branch": "master",
"commit_count": 174,
"repo_created_at": "2015-05-18T14:46:16.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 2,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "fb355f39... |
6f7cc6eb-af62-4594-97e5-43dae6e6fe04 | toki0411/BOJ | 1389.cpp | //
// Copyright (c) 2021 <NAME> All rights reserved.
//
#include <iostream>
#include <algorithm>
#include <vector>
#include <map>
using namespace std;
#define INF 1e9
int graph[101][101];
map<int, int> m;
int main() {
ios_base::sync_with_stdio(false);
cin.tie(0);
int N, M;
int a,b;
cin >> N>>M;
... | ALGO | 0.999967 | 3.572196 | {
"github_metadata": {
"branch": "main",
"commit_count": 289,
"repo_created_at": "2021-05-16T07:24:04.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 0,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "2cb9a9e324... |
161b4be9-eacb-4826-a5ff-719c255869f3 | egeigel/MPI_Scheduling | Downloads/MPI/MPI/MPI/static_sched.cpp | #include <iostream>
#include <cmath>
#include <cstdlib>
#include <chrono>
#include <mpi.h>
#ifdef __cplusplus
extern "C" {
#endif
float f1(float x, int intensity);
float f2(float x, int intensity);
float f3(float x, int intensity);
float f4(float x, int intensity);
#ifdef __cplusplus
}
#endif
float ... | ALGO | 0.999553 | 4.619518 | {
"github_metadata": {
"branch": "master",
"commit_count": 2,
"repo_created_at": "2017-12-17T18:04:58.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 0,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "bdc2f55a55... |
0ca52701-224b-4996-8f67-f51bd9d94011 | vtallen/AdventOfCode | 2015/day5.cpp | #include <iostream>
#include <fstream>
#include <string_view>
#include <string>
#include <regex>
namespace AOC2015 {
void day5(std::string_view inputFile) {
std::ifstream inputStream{inputFile};
if (!inputStream) {
std::cout << "Unable to open file: " << inputFile << '\n';
}
// Part 1 regex patterns
... | ALGO | 0.989917 | 5.742557 | {
"github_metadata": {
"branch": "main",
"commit_count": 18,
"repo_created_at": "2023-05-07T21:43:56.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 0,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "11eea1e8aa7... |
0ad7b3cb-f45e-4b5a-9184-4e567aebca1c | magicunicorn21/cardNumberProject | visaCardIdentifier/visaCardIdentifier.cpp | #include <iostream>
#include <string>
#include <vector>
#include <fstream>
#include <regex>
using namespace std;
//Luhn algorithm implementation
bool validCheck(string cardNumber) {
int sum = 0;
//starts at the second rightmost digit and continues to the left (every other digit)
for (int i = cardNumber.le... | ALGO | 0.996186 | 4.835145 | {
"github_metadata": {
"branch": "master",
"commit_count": 2,
"repo_created_at": "2021-05-29T15:31:28.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 0,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "bd13502f00... |
4bec4c68-a1d0-41b6-862b-91c4bfcb6d9b | brianbbsu/8BQube | codebook/9_Else/NQueens.cpp | void solve(vector<int> &ret, int n) { // no sol when n=2,3
if (n % 6 == 2) {
for (int i = 2; i <= n; i += 2) ret.pb(i);
ret.pb(3); ret.pb(1);
for (int i = 7; i <= n; i += 2) ret.pb(i);
ret.pb(5);
} else if (n % 6 == 3) {
for (int i = 4; i <= n; i += 2) ret.pb(i);
ret.pb(2);
for (int i = ... | ALGO | 0.999933 | 4.219821 | {
"github_metadata": {
"branch": "master",
"commit_count": 507,
"repo_created_at": "2019-10-11T11:37:36.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 37,
"forks": 18,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "fb5a12... |
c2466a92-74fc-4543-bdd9-6dbf897dc344 | kason-huang/algorithm_learning | PAT/basic_1028.cpp | #include <iostream>
#include <string>
using namespace std;
string startDay = "1814/09/06";
string endDay = "2014/09/06";
bool isValid(string birthday) {
if(birthday >= startDay && birthday <= endDay) {
return true;
}
return false;
}
bool isOlder(string birthday, string other_birthday) {
if(birthday < oth... | ALGO | 0.999062 | 3.693436 | {
"github_metadata": {
"branch": "master",
"commit_count": 66,
"repo_created_at": "2017-01-19T03:27:01.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 0,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "2b9f64b73... |
e5eb3f33-e80d-4fd2-82e4-da6287046962 | Yashashvi65/Data-Structures-and-Algorithms | lecture_049_dp/dp_17_burstBalloon.cpp | // leetcode 312 -> burst balloon
/*
If the you burst balloon i you will get nums[left] * nums[i] * nums[right] coins.
Here left and right are adjacent indices of i. After the burst, the left and right then becomes adjacent.
Find the maximum coins you can collect by bursting the balloons wisely.
Inpu... | ALGO | 0.999921 | 5.007647 | {
"github_metadata": {
"branch": "master",
"commit_count": 124,
"repo_created_at": "2021-03-23T20:09:17.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 0,
"forks": 2,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "2c139877... |
9313af8a-cae6-4f7d-8cde-6f716e647027 | derekop2000/PS | 백준/Silver/1260. DFS와 BFS/DFS와 BFS.cc | #include<stdio.h>
#include<iostream>
#include<vector>
#include<queue>
#include<tuple>
#include<memory.h>
#include<string>
#include<sstream>
#include<algorithm>
#include<map>
#include<set>
#include<iomanip>
#include<climits>
#include <functional>
using namespace std;
int dir[][2] = { {-1,0}, {0,1}, {1,0} ,{0,-1} };
v... | ALGO | 0.999979 | 3.896807 | {
"github_metadata": {
"branch": "main",
"commit_count": 544,
"repo_created_at": "2024-04-09T09:42:34.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 0,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "ab9d96e2f2... |
9aa9a766-aed8-4353-bfbf-1716b46a4bb2 | AniketSaliya/Data-Structure-and-Algorithm | Dynamic Programming/Friends pairing problem.cpp | /*f(n) = ways n people can remain single
or pair up.
For n-th person there are two choices:
1) n-th person remains single, so only 1 way so we recur
for remaining i.e f(n - 1) or you can say 1*f(n-1)
2) n-th person pairs up with any of the
remaining n - 1 persons. So apart from the 2 people forming ... | ALGO | 0.999992 | 5.338708 | {
"github_metadata": {
"branch": "main",
"commit_count": 7,
"repo_created_at": "2023-06-13T18:18:06.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 0,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "d6aec6fc2076... |
e2fd7744-def9-4e03-acd7-079378788dca | keywet06/code | CF/CF404D.cpp | // oct code title CF/CF715C.cpp
#ifndef OCT_CODE_INSERT_PREx2dDOCUMENT // oct code insert pre-document
#define OCT_CODE_INSERT_PREx2dDOCUMENT
#ifdef ONLINE_JUDGE
#pragma GCC optimize("Ofast")
#pragma GCC optimize("unroll-loops")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#endif
#i... | ALGO | 0.99999 | 3.848546 | {
"github_metadata": {
"branch": "master",
"commit_count": 702,
"repo_created_at": "2019-04-21T10:13:58.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 3,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "4f6bd98b... |
d4401d08-7595-46fd-afbf-20c2b32216ba | hgwright98/Selection_and_Repetition | main.cpp | #include <iostream>
#include <string>
using namespace std;
// Start of the main function
int main() {
// establishing all of the variables I will need
int numberOne;
int numberTwo;
string Opp;
string equation;
// Get all the users inputs need for the calculations
cout << "Please input your first integer: ... | TOOL | 0.96553 | 3.496917 | {
"github_metadata": {
"branch": "Project_1",
"commit_count": 1,
"repo_created_at": "2024-09-29T17:05:37.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 0,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "60bc8cc... |
a0e15efd-578b-4f8f-8a42-7b0aaadd3301 | Ro706/PP | exp/exp5/constructor_student_marks.cpp | /*Create a contructor student . Calculate total marks of student in 5 subjects and then find the student with least total marks */
#include <iostream>
#include <conio.h>
using namespace std;
class Student
{
public:
float marks, total = 0;
Student()
{
cout << "For Student => " << endl;
... | ALGO | 0.994784 | 3.983628 | {
"github_metadata": {
"branch": "main",
"commit_count": 50,
"repo_created_at": "2023-10-09T18:23:44.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 2,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "840cb50f838... |
dd77253f-e5f6-443c-993a-a71b3a00797e | rscalt/SUSU_CPP_LAB | labs_C1_S1/listings/code/lab_04_2.cpp | /*
Упражнение 2. Итерационный цикл
Запишите код программы для решения задачи.
Последовательность вычисляется по закону:
1 + 1/2
, 1 + 1/2 + 1/3
, 1 + 1/2 + 1/3 +1/4
, ⋯
Известно, что существует предел последовательности.
Найти его с точностью ε знаков после запятой
*/
#include <iostream>
#include <iomanip>
using nam... | ALGO | 0.999897 | 4.59288 | {
"github_metadata": {
"branch": "main",
"commit_count": 64,
"repo_created_at": "2020-10-31T07:16:32.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 0,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "9de45c2ca6f... |
c971180a-18f2-49d5-b613-c04469c8687a | prabaljainn/Personal-dsa-repo | AZ Practice/Two pointer Template.cpp | #include <bits/stdc++.h>
using namespace std;
#define OK cout << endl;
//vector<vector<double>> dp(3000,vector<double>(3000,-1));
#define endl '\n'
#define vi vector < int >
#define int long long
#define IOS ios::sync_with_stdio(0);
int mod = 1e9+7;
void solve(){
int n;// --> atmost how much your window can reach, mai... | ALGO | 0.999649 | 3.717873 | {
"github_metadata": {
"branch": "main",
"commit_count": 37,
"repo_created_at": "2021-03-21T18:33:16.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 1,
"forks": 1,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "f4b0dfdac97... |
b2b5fe85-cd8d-4acf-80ff-1cd08e6498e4 | rujiantaohuakai/someccode | leetcode/42.trapping-rain-water.cpp | /*
* @lc app=leetcode.cn id=42 lang=cpp
* @lcpr version=30204
*
* [42] 接雨水
*/
// @lcpr-template-start
#include <bits/stdc++.h>
using namespace std;
// @lcpr-template-end
// @lc code=start
class Solution {
public:
int trap(vector<int>& height) {
/* 超时了O(n)*O(2n);
int cnt = 0;
int len =... | ALGO | 0.999994 | 6.345806 | {
"github_metadata": {
"branch": "main",
"commit_count": 7,
"repo_created_at": "2024-10-24T07:28:54.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 0,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "3ba928d6d2a0... |
047306b2-aac6-4ded-a857-d668ecb69010 | Shahbaz898414/CP-concept | level-3/Range Queries 1/Question/main.cpp | // #include <iostream>
// #include <bits/stdc++.h>
// bool isPrime(int n) {
// if (n <= 1) {
// return false;
// }
// if (n == 2) {
// return true;
// }
// if (n % 2 == 0) {
// return false;
// }
// for (int i = 3; i <= sqrt(n); i += 2) {
// if (n % i == ... | ALGO | 0.999947 | 5.417054 | {
"github_metadata": {
"branch": "master",
"commit_count": 844,
"repo_created_at": "2023-04-14T10:40:48.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 0,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "8c0dce98... |
eb6720cf-d123-4529-8e2e-3c3160c4d11e | ipeternella/pyforces | challenges/leetcode/house_robber_iii.cpp | /*
* Solution for LC#337: House Robber III
*
* https://leetcode.com/problems/house-robber-iii/
*/
#include <bits/stdc++.h>
using namespace std;
struct TreeNode {
int val;
TreeNode* left;
TreeNode* right;
TreeNode() : val(0), left(nullptr), right(nullptr) {}
TreeNode(int x) : val(x), left(nullpt... | ALGO | 0.999974 | 5.95316 | {
"github_metadata": {
"branch": "main",
"commit_count": 345,
"repo_created_at": "2021-11-22T19:01:19.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 7,
"forks": 1,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "9d40a87ff4... |
47934623-518b-4760-9103-bb64bbdf26cb | mindspore-ai/mindspore | mindspore/ccsrc/plugin/device/cpu/kernel/svd_cpu_kernel_float.cc | /**
* Copyright 2022 Huawei Technologies Co., Ltd
*
* 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... | ALGO | 0.971223 | 6.552301 | {
"github_metadata": {
"branch": "master",
"commit_count": 83896,
"repo_created_at": "2020-02-11T08:43:48.000Z",
"is_fork": false,
"is_org_owned": true,
"forked_from": null,
"stars": 4559,
"forks": 740,
"issues": 181,
"pull_requests": 20
},
"file_meta": {
"content_id": ... |
9d239948-6ce6-40ff-a4c5-fcaafc182c71 | hsj4436/Algorithm | 백준/Silver/9996. 한국이 그리울 땐 서버에 접속하지/한국이 그리울 땐 서버에 접속하지.cc | #include <iostream>
int N;
int main() {
std::cin >> N;
std::string pattern;
std::cin >> pattern;
int index = pattern.find('*');
std::string prefix = pattern.substr(0, index);
std::string suffix = pattern.substr(index + 1);
for (int i = 0; i < N; i++) {
std::string file;
... | ALGO | 0.999906 | 4.729591 | {
"github_metadata": {
"branch": "master",
"commit_count": 623,
"repo_created_at": "2023-12-12T13:04:41.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 0,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "73c1de13... |
c54881df-767f-4948-b6df-2044380e11b7 | mihai-constantin/ACS | PA/Laborator/2018-2019/lab02 - Greedy/demo-lab02/spectacole.cpp | #include <iostream>
#include <vector>
#include <utility>
#include <algorithm>
#include <unordered_set>
#include <limits.h>
using namespace std;
bool end_hour_comp (pair<int, int>& e1, pair<int, int>& e2) {
// comparam doar dupa pozitii, tag-ul este folosit doar la identificare
return (e1.second < e2.second);
... | ALGO | 0.999004 | 5.289541 | {
"github_metadata": {
"branch": "master",
"commit_count": 813,
"repo_created_at": "2022-01-03T14:55:39.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 4,
"forks": 2,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "fdbbf48c... |
ef17d7cd-729f-492f-afd7-64b6a5b7bc0c | def4macro/LeetCode-Resolution | Leetcode-CPP/Search_in_Rotated_Sorted_Array_I/Search_in_Rotated_Sorted_Array_I.cpp | // Search_in_Rotated_Sorted_Array_I.cpp : Defines the entry point for the console application.
//
#include "stdafx.h"
#include <vector>
#include <iostream>
using namespace std;
class MyClass
{
public:
MyClass();
~MyClass();
bool search(const vector<int>& nums, int target);
private:
};
MyClass::MyClass()
{
}
... | ALGO | 0.999907 | 5.43968 | {
"github_metadata": {
"branch": "master",
"commit_count": 2,
"repo_created_at": "2016-08-19T11:20:23.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 0,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "5077f8eaa0... |
5707b383-035f-4b7a-9ee1-2c9532a0512e | saitamau-maximum/Maximum2022 | 10/ATC002B/ans.cpp | #include <bits/stdc++.h>
using namespace std;
struct modint {
// 値
int value;
// modの法
int base;
// コンストラクタ
modint(int v, int b) {
value = v % b;
base = b;
}
// +演算子
modint operator+(int right) {
// とりあえず自分自身をコピーする
modint res = (*this);
// int型同士なので、+=演算子が使える
res.value += ri... | ALGO | 0.99998 | 4.601087 | {
"github_metadata": {
"branch": "main",
"commit_count": 28,
"repo_created_at": "2022-04-24T05:37:50.000Z",
"is_fork": false,
"is_org_owned": true,
"forked_from": null,
"stars": 0,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "c0b20b386151... |
08e31d47-7afb-4c17-99b7-43db21000f1c | ishandutta2007/codeforces-b | bluediamond/normal/91/E.cpp | #include <bits/stdc++.h>
using namespace std;
#define int long long
/// a + b * x
struct line {
int a, b, id;
};
/**
at -INF, the largest one is the one with b = max, if they have the same b, it's the one with a bigger a
**/
/**
a1 + b1 * x = a2 + b2 * x
(a1 - a2) = x * (b2 - b1)
x = (a1 - a2) / (b2 - b1)
**... | ALGO | 0.999937 | 4.527737 | {
"github_metadata": {
"branch": "main",
"commit_count": 2,
"repo_created_at": "2024-04-11T01:05:31.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 1,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "c843e1ad659a... |
8325eae6-1c45-4259-baf5-9e63c9bb57e2 | muhammadhasan01/cp | Online Judge/Codeforces/Contests/DIV2/DIV2-488/B.cpp | #include<bits/stdc++.h>
using namespace std;
struct st{
long long p, c;
int idx;
};
const int N = 1e5 + 5;
int n, k;
st a[N];
long long dp[N][15], ans[N];
bool cmpr(st a, st b) {
return a.p < b.p;
}
int main() {
ios_base::sync_with_stdio(0);
cin.tie(0);
cout.tie(0);
cin >> n >> k;
f... | ALGO | 0.999982 | 3.55502 | {
"github_metadata": {
"branch": "master",
"commit_count": 1187,
"repo_created_at": "2019-07-13T15:49:08.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 9,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "35c380c... |
a7c6408d-b943-4e61-98c2-0a83e6f13d0f | anupgp/astron | src/old/I_Na_Post.hpp | /* Last Revised Date: 05_APRIL_2015 */
// UNITS: all SI units - seconds, Volts, Ampere, Meters, Simenes, Farads
// Na+ channels implimented from classical HH (1952)
#ifndef I_Na_Post_HPP_INCLUDED
#define I_Na_Post_HPP_INCLUDED
#include <vector>
#include <iostream>
#include <cmath>
#include "data_types.hpp"
#includ... | ALGO | 0.980542 | 5.841352 | {
"github_metadata": {
"branch": "master",
"commit_count": 26,
"repo_created_at": "2021-01-04T15:48:05.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 1,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "4ae205eb1... |
854d6e16-3569-4c83-b03d-a9dd86e70767 | bjarkimb/EQ2443-2445-Project-Group2 | include/gnuradio/digital/correlate_access_code_ff_ts.h | /* -*- c++ -*- */
/*
* Copyright 2014 Free Software Foundation, Inc.
*
* This file is part of GNU Radio
*
* GNU Radio is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3, or (at your option... | ALGO | 0.920649 | 7.078236 | {
"github_metadata": {
"branch": "master",
"commit_count": 2,
"repo_created_at": "2018-12-19T09:13:43.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 1,
"forks": 1,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "8a93458688... |
224d062f-87d1-4e43-b2a6-4291820682c9 | ishandutta2007/codeforces-n | normie28/normal/1554/E.cpp | #ifndef CPL_TEMPLATE
#define CPL_TEMPLATE
/*
Normie's Template v2.5
Changes:
Added warning against using pragmas on USACO.
*/
// Standard library in one include.
#include <bits/stdc++.h>
using namespace std;
// ordered_set library.
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
us... | ALGO | 0.998813 | 4.463474 | {
"github_metadata": {
"branch": "main",
"commit_count": 1,
"repo_created_at": "2024-10-30T15:35:44.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 0,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "341d0c3fa21a... |
1a221cae-2ccf-4042-8852-cf12dfdb7c41 | REDl3east/SDL2-Maze | src/maze/hunt_and_kill/huntAndKillMaze.h | #ifndef HUNTANDKILLMAZE_H
#define HUNTANDKILLMAZE_H
#include <utility>
#include "maze.h"
struct hunt_and_kill_cell {
int x;
int y;
bool visited;
};
class HuntAndKillMaze : public Maze<hunt_and_kill_cell> {
public:
HuntAndKillMaze(std::shared_ptr<SDL_Renderer> renderer, int window_width, int window_height, ... | ALGO | 0.984603 | 5.590976 | {
"github_metadata": {
"branch": "main",
"commit_count": 17,
"repo_created_at": "2021-09-13T14:07:12.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 0,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "16f1c6425b9... |
1f7a1dc8-349a-40c1-a076-7ce273e0c7ae | spothound/-UGR-Primero-de-inform-tica. | segundo cuatrimestre/MP/TEORICO/problemas_II/ejercicio1.cpp | #include<iostream>
using namespace std;
int main(){
int array[10] = {1, 3, 9, 10, -4, 7, 4, 9, 2, 120};
int *min = array ;
int *max = array ;
int *lectura = array ;
for(int i = 0 ; i < 10 ; i++, lectura++){
if(*lectura > *max)
max = lectura ;
if(*lectura < *min)
min = lectura ;
}... | ALGO | 0.999623 | 3.529564 | {
"github_metadata": {
"branch": "master",
"commit_count": 2,
"repo_created_at": "2016-10-08T14:06:00.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 0,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "f1d2f84995... |
4dd7462b-0705-4391-99ae-e2d35d5c255d | so8991/2D-to-3D-interpolation-project | createWorld.cpp | /*
USC/Viterbi/Computer Science
"Jello Cube" Assignment 1 starter code
createWorld utility to create your own world files
Note: this utility uses its own copy of writeWorld routine, which is identical to the one
found in input.cpp . If you need to change that routine, or even the definition of the
world ... | ALGO | 0.981361 | 4.045326 | {
"github_metadata": {
"branch": "master",
"commit_count": 4,
"repo_created_at": "2016-11-28T22:35:49.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 14,
"forks": 3,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "d212c9d30... |
fbd0faf8-bdeb-443e-8129-2fb39c72743a | Ruslan515/Competitions | coding/Leetcode/Tasks/task_200.cpp | // https://leetcode.com/problems/number-of-islands/description/
// Created by ruslan515 on 09.03.23.
//
#include <bits/stdc++.h>
using namespace std;
class Solution {
public:
char one = '1';
char zero = '0';
void dfs(vector<vector<char>>& grid, vector<bool> &used, int v) {
used[v] = true;
... | ALGO | 0.999946 | 6.247942 | {
"github_metadata": {
"branch": "main",
"commit_count": 271,
"repo_created_at": "2022-05-31T16:17:51.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 1,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "d49d19777f... |
bb84f30b-ac5c-4ee1-97e4-9b97c231a86e | Jamence/algorithm-practice | 51Nod/1298圆和三角形判断相交.cpp | //由于存在一个问题,即求开根,但是如果只求平方,不求开根,则不会有精度问题
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
struct node
{
ll x,y;
};
node O,a,b,c;
ll r;
//返回平方
double distance(node *p1,node *p2)
{
return (p1->x-p2->x)*(p1->x-p2->x)+(p1->y-p2->y)*(p1->y-p2->y);
}
//判断三角形和圆相交有三种情况
//点都在圆内
//点都在圆外
//一定相交
bool seg... | ALGO | 0.999816 | 4.681683 | {
"github_metadata": {
"branch": "master",
"commit_count": 17,
"repo_created_at": "2017-10-09T03:44:44.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 0,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "3f21b31ae... |
0871ec41-4a5b-4ce5-9099-bfe5a6642d47 | ishandutta2007/codeforces-g | greencis/normal/482/C.cpp | //#pragma GCC optimize("Ofast,unroll-loops")
//#pragma GCC target("avx,avx2,fma,tune=native")
#include <bits/stdc++.h>
#define all(x) (x).begin(), (x).end()
using namespace std;
using ll = int64_t;
using ld = long double;
using pii = pair<int, int>;
int main() {
ios::sync_with_stdio(false);
cin.tie(nullptr);
... | ALGO | 0.999496 | 4.088929 | {
"github_metadata": {
"branch": "main",
"commit_count": 1,
"repo_created_at": "2024-04-11T01:55:50.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 0,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "7f4f345f3d1c... |
4cc57e9f-43d7-456f-ab10-6a269ea0eb5d | SeanCampbell/WordAnalysis | vxl_src/contrib/brl/bseg/boxm/algo/rt/boxm_generate_shadow_sample_functor.h | #ifndef boxm_generate_shadow_sample_functor_h
#define boxm_generate_shadow_sample_functor_h
//:
// \file
#include <boxm/boxm_apm_traits.h>
#include <boxm/basic/boxm_raytrace_function.h>
#include <boxm/sample/boxm_rt_sample.h>
#include <boxm/sample/algo/boxm_mog_grey_processor.h>
#include <boxm/basic/boxm_seg_length_fun... | ALGO | 0.988064 | 5.688313 | {
"github_metadata": {
"branch": "master",
"commit_count": 67,
"repo_created_at": "2016-02-16T04:49:45.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 2,
"forks": 4,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "73bc26f1a... |
1b9eca6f-aaeb-4c58-b7d8-564b95a78b55 | Sumithkumar1/datasructrec- | data structre .c++/q imp.cpp | // CPP program to find smallest multiple of a
// given number made of digits 0 and 9 only
#include <bits/stdc++.h>
using namespace std;
// Maximum number of numbers made of 0 and 9
#define MAX_COUNT 10000
vector<string> vec;
void generateNumbersUtil()
{
// Create an empty queue of strings
queue<string> q;
// ... | ALGO | 0.999842 | 4.82299 | {
"github_metadata": {
"branch": "main",
"commit_count": 13,
"repo_created_at": "2022-04-10T13:45:01.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 1,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "445715db410... |
703b19ab-f229-4726-bd99-a93db8e119f4 | DrGrafil/EGXPhys | EGXPhys/Astrophysics/SynodicDay.hpp | /// @file EGXPhys/Astrophysics/SynodicDay.hpp
///
/// @brief Calculates synodic day of a celestial object.
///
/// @author <NAME>
/// @date 7/1/18
/// @defgroup EGXPhys-Astrophysic-SynodicDay Synodic Day
/// @ingroup EGXPhys-Astrophysics
//=================================
// Header guard
#pragma once
//============... | ALGO | 0.996301 | 6.939505 | {
"github_metadata": {
"branch": "master",
"commit_count": 387,
"repo_created_at": "2017-07-25T06:07:39.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 2,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "d2502173... |
28fddaf5-d0f6-4acf-a705-16cee2fc86ac | sakiib/RandomSolving | Leetcode/leetcode617.cpp | /**
* Definition for a binary tree node.
* struct TreeNode {
* int val;
* TreeNode *left;
* TreeNode *right;
* TreeNode() : val(0), left(nullptr), right(nullptr) {}
* TreeNode(int x) : val(x), left(nullptr), right(nullptr) {}
* TreeNode(int x, TreeNode *left, TreeNode *right) : val(x), l... | ALGO | 0.99999 | 6.356768 | {
"github_metadata": {
"branch": "master",
"commit_count": 394,
"repo_created_at": "2020-08-16T10:57:45.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 1,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "03d68515... |
e9f8b5dd-f786-46b6-91b9-e70479ebb7dd | Raghav-Saboo/Algorithms-and-Data-Structures-for-Competitive-Programming | Graph Algorithms/bfs.cpp | // Problem link
// https://www.hackerearth.com/practice/algorithms/graphs/breadth-first-search/practice-problems/algorithm/bfs/
#include <bits/stdc++.h>
using namespace std;
#define ll long long int
#define mp make_pair
#define pb push_back
#define pii pair<int, int>
#define pll pair<ll, ll>
#define fi first
#define s... | ALGO | 0.999871 | 4.08264 | {
"github_metadata": {
"branch": "master",
"commit_count": 22,
"repo_created_at": "2018-05-30T15:39:38.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 1,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "c34f6cf98... |
fcb569c9-5ff6-4504-87fa-d40367b99ed3 | geekyanurag/Coding-Interview-Preparation | Binary_Trees/check_if_a_tree_is_a_subtree_of_another_tree.cpp | #include<bits/stdc++.h>
using namespace std;
struct Node{
int data;
Node* left, *right;
};
Node* insert(int data){
Node* temp = new Node();
temp->data = data;
temp->left = temp->right = NULL;
}
//O(n*n) Complexity Solution
bool isIdentical(Node* root1, Node* root2){
if(!root1 && !root2)
... | ALGO | 0.999973 | 5.072501 | {
"github_metadata": {
"branch": "master",
"commit_count": 141,
"repo_created_at": "2020-04-07T10:47:34.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 1,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "0f535cd0... |
49f59223-43c1-48d8-b35f-1c6d08b1cdfb | juneh2633/Algorithm | SWEA/D4/3000. 중간값 구하기/중간값 구하기.cpp | #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
const ll MOD = 20171109;
int main() {
ios::sync_with_stdio(false);
cin.tie(NULL);
cout.tie(NULL);
ll T;
cin >> T;
for (ll t = 1; t <= T; t++) {
ll n;
ll ans... | ALGO | 0.999715 | 4.136022 | {
"github_metadata": {
"branch": "main",
"commit_count": 213,
"repo_created_at": "2023-12-03T15:14:09.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 0,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "aec68587ea... |
a760a13e-1643-44e9-8cad-785e07ee03a0 | Eskenet/Calculator | main.cpp | #include <iostream>
struct Calculator {
int number;
};
int add(Calculator first, Calculator second){
return first.number + second.number;
};
int sub(Calculator first, Calculator second){
return first.number - second.number;
};
int multi(Calculator first, Calculator second){
... | ALGO | 0.997943 | 4.440851 | {
"github_metadata": {
"branch": "main",
"commit_count": 1,
"repo_created_at": "2022-12-22T18:19:36.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 0,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "b0ec7dddd2a9... |
a29a5478-6ea8-4d0b-9efb-531214fb143d | PrashantAmoli/LeetCode | 2095-delete-the-middle-node-of-a-linked-list/2095-delete-the-middle-node-of-a-linked-list.cpp | /**
* Definition for singly-linked list.
* struct ListNode {
* int val;
* ListNode *next;
* ListNode() : val(0), next(nullptr) {}
* ListNode(int x) : val(x), next(nullptr) {}
* ListNode(int x, ListNode *next) : val(x), next(next) {}
* };
*/
class Solution {
public:
ListNode* deleteMiddl... | ALGO | 0.999806 | 5.928116 | {
"github_metadata": {
"branch": "main",
"commit_count": 190,
"repo_created_at": "2022-10-09T15:22:20.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 0,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "1bc1d5aa96... |
83950cbe-f814-42bf-8adc-8dc2ebe8bddf | Shady712/CPP-code-edu | Discrete-math/combinatorics-laboratory/brackets2-by-num/main.cpp | #include <iostream>
#include <set>
#include <map>
#include <algorithm>
#include <cmath>
#include <numeric>
#include <cstdlib>
#include <queue>
#include <stack>
#include <cstring>
#include <ctime>
#include <cassert>
#define pb emplace_back
#define pf emplace_front
#define re return
#define fi first
#define se second
#d... | ALGO | 0.999985 | 4.044294 | {
"github_metadata": {
"branch": "main",
"commit_count": 13,
"repo_created_at": "2021-04-01T19:45:45.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 0,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "aed97f53177... |
116595ff-d5c4-4717-a7b4-51dc7c808b0b | Maniac198/Competitve-Programming | C_Card_Game.cpp | #include <bits/stdc++.h>
using namespace std;
#define yes {cout<<"YES"<<endl;}
#define no {cout<<"NO"<<endl;}
#define rep(i,a,b) for(int i = a; i < b; i++)
#define dep(x,a,b) for(int x = a; x >= b; --x)
#define vb v.begin()
#define ve v.end()
#define int long long
#define endl ... | ALGO | 0.999887 | 4.850062 | {
"github_metadata": {
"branch": "master",
"commit_count": 54,
"repo_created_at": "2023-02-28T11:19:00.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 0,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "db4c094d7... |
16b33c01-cd31-4e27-8f18-23f5ee6eedaa | kirillnamestnikov/leetcode-problems | 3217_delete_nodes_from_linked_list_present_in_array/main.cpp | /**
* Definition for singly-linked list.
* struct ListNode {
* int val;
* ListNode *next;
* ListNode() : val(0), next(nullptr) {}
* ListNode(int x) : val(x), next(nullptr) {}
* ListNode(int x, ListNode *next) : val(x), next(next) {}
* };
*/
class Solution {
public:
ListNode* modifiedLis... | ALGO | 0.999987 | 5.654486 | {
"github_metadata": {
"branch": "main",
"commit_count": 228,
"repo_created_at": "2024-04-14T09:58:28.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 1,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "63f381239f... |
ff6be80e-8ca0-44c8-812b-684915731be5 | raincross7/code-similarity | codes/train_code/problem074/problem074_486.cpp | #include <bits/stdc++.h>
using namespace std;
#define ll long long
#define rep(i, n) for (ll i = 0; i < n; ++i)
#define P pair<ll, ll>
#define Graph vector<vector<ll>>
#define fi first
#define se second
constexpr ll mod = 1000000007;
constexpr ll INF = (1ll << 60);
constexpr double pi = 3.14159265358979323846;
template... | ALGO | 0.999576 | 4.034599 | {
"github_metadata": {
"branch": "main",
"commit_count": 3,
"repo_created_at": "2024-03-06T05:07:19.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 0,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "8d6908383239... |
77bd1944-9e35-4478-8b99-97521a121689 | Ishydo/cuda | TP0 - Intro Slice/02_Slice_Together/07_pi_for_promotionTab.cpp | #include <omp.h>
#include "MathTools.h"
#include "OmpTools.h"
#include "../02_Slice/00_pi_tools.h"
/*----------------------------------------------------------------------*\
|* Declaration *|
\*---------------------------------------------------------------------*/
/*--------------------------------------*\... | ALGO | 0.999508 | 4.922132 | {
"github_metadata": {
"branch": "master",
"commit_count": 18,
"repo_created_at": "2017-02-21T11:22:54.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 2,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "832005837... |
37d3c98d-4f80-423b-8041-fba22b2df3c0 | HaochenLiu/My-LeetCode-CPP | 272-1.cpp | /*
272. Closest Binary Search Tree Value II
Given a non-empty binary search tree and a target value, find k values in the BST that are closest to the target.
Note:
Given target value is a floating point.
You may assume k is always valid, that is: k ≤ total nodes.
You are guaranteed to have only one unique set of k val... | ALGO | 1 | 6.48031 | {
"github_metadata": {
"branch": "master",
"commit_count": 971,
"repo_created_at": "2015-09-22T23:28:22.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 0,
"forks": 3,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "317ee39e... |
bfc20a2a-0e35-45f3-bff6-18e3585bb39b | Cellul4r/Comp_Programming | Codeforces/2124A.cpp | /*
* author : cellul4r
*/
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<int, int> pi;
typedef pair<ll,ll> pl;
typedef pair<ld,ld> pd;
#define all(x) x.begin(), x.end()
const char nl = '\n';
const int N =1e5+1;
const int INF = 1e9+7;
const ll LINF = 1e18+7;
... | ALGO | 0.999924 | 3.609092 | {
"github_metadata": {
"branch": "master",
"commit_count": 100,
"repo_created_at": "2024-09-26T13:58:17.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 1,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "72b6efe0... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.