uuid string | repo_name string | relative_path string | content string | category string | algo_rel_score float64 | quality_score float64 |
|---|---|---|---|---|---|---|
b2c9a527-f853-4e7c-8871-d555f1ec5949 | MatheusWG/ProjetosC | Mês.cpp | #include <stdio.h>
#include <string.h>
int main(int argc, char** argv)
{
int M;
scanf("%d",&M);
if(M==1)
printf("January\n");
if(M==2)
printf("February\n");
if(M==3)
printf("March\n");
if(M==4)
printf("April\n");
if(M==5)
printf("May\n");
if(M==6)
printf("June\n");
if(M==7)
printf("July\n");
if... | ALGO | 0.999269 | 3.149881 |
b3a6c386-3377-4181-a0de-48923185a1ea | montematico/Da-vinci-jr-marlin | Marlin/src/libs/crc16.cpp | #include "crc16.h"
void crc16(uint16_t *crc, const void * const data, uint16_t cnt) {
uint8_t *ptr = (uint8_t *)data;
while (cnt--) {
*crc = (uint16_t)(*crc ^ (uint16_t)(((uint16_t)*ptr++) << 8));
for (uint8_t i = 0; i < 8; i++)
*crc = (uint16_t)((*crc & 0x8000) ? ((uint16_t)(*crc << 1) ^ 0x1021) : (... | ALGO | 0.997264 | 4.764662 |
361ba3b4-27d1-4297-8d28-d1175364f6ad | Mahad-Saffi/Programming_Fundamentals | Lab 7/task8.cpp | #include <iostream>
#include <cmath>
using namespace std;
int calculateMoney(int age, int priceMachine, int priceToy);
main()
{
int age;
int priceMachine;
int priceToy;
cout << "Enter Lilly's age: ";
cin >> age;
cout << "Enter the price of the washing machine: ";
cin >> priceMachine;
... | ALGO | 0.961057 | 3.785319 |
03a0e9ae-b909-4697-854e-4ac15f00643d | TensorCodeGen/tensor-codegen | compiler-rt/lib/gwp_asan/stack_trace_compressor.cpp | #include "gwp_asan/stack_trace_compressor.h"
namespace gwp_asan {
namespace compression {
namespace {
// Encodes `Value` as a variable-length integer to `Out`. Returns zero if there
// was not enough space in the output buffer to write the complete varInt.
// Otherwise returns the length of the encoded integer.
size_t... | ALGO | 0.886788 | 7.818335 |
a1d30437-bc1d-4aac-a191-30d304b50761 | JODE-HRK/Algorithm-Question | luogu/P1352没有上司的舞会.cpp | #include<bits/stdc++.h>
using namespace std;
const int maxn = 4e5+7;
int n;
int happy[maxn],dp[maxn][2];
int head[maxn],tot;
struct Edge{
int fr, to, nxt;
}edge[maxn];
void init(){
tot=0;
fill(head, head+1+n, -1);
}
void addEdge(int fr,int to){
edge[tot] = (Edge){ fr, to, head[fr] };
head[fr] = tot+... | ALGO | 0.999924 | 3.608014 |
a4b22bc8-da9f-415a-b823-ef5326c59da1 | h50039135/llvm_maybe | libcxx/src/random_shuffle.cpp | #include "algorithm"
#include "random"
#ifndef _LIBCPP_HAS_NO_THREADS
# include "mutex"
# if defined(__ELF__) && defined(_LIBCPP_LINK_PTHREAD_LIB)
# pragma comment(lib, "pthread")
# endif
#endif
_LIBCPP_BEGIN_NAMESPACE_STD
#ifndef _LIBCPP_HAS_NO_THREADS
_LIBCPP_SAFE_STATIC static __libcpp_mutex_t __rs_mut... | TOOL | 0.892662 | 3.86715 |
81ea6e12-f041-4693-baf9-78d3b59d0437 | isolent/ADS | midterm/G.cpp | #include <bits/stdc++.h>
using namespace std;
queue <int> q;
int ping(int x) {
q.push(x);
while(q.front() < x - 3000){
q.pop();
}
return q.size();
}
int main(){
int n;
cin>>n;
while(n--){
int x;
cin >> x;
cout << ping(x) << " ";
}
}; | ALGO | 0.999599 | 3.899559 |
ac30e2c0-0b49-4538-a72e-d9fdbbf4dfde | kohutjan/VC | src/algorithms/MDG.cpp | /*
authors: Jan Kohút (xkohut08), Vladimír Jeřábek (xjerab21)
date: 5. 12. 2018
*/
#include "algorithms/MDG.hpp"
using namespace std;
vector<int> MDG::Run(Graph graph, bool removePendant, bool removeRedundant)
{
this->cover.clear();
Graph origGraph = graph;
if (removePendant)
{
this->cover = this->Rem... | ALGO | 0.999706 | 5.412185 |
b7246a02-41d8-44e0-9fe3-06f315e70d3f | epfl-lasa/passive-ds-control | src/cascade_ds_controller.cpp |
#include "cascade_ds_controller.h"
#include <iostream>
CascadeDSController::CascadeDSController(size_t dim, std::function<Vec(Vec)> task_dynamics,std::function<Vec(Vec)> process_filter) : dim_(dim)
{
// make a test call to the supplied dynamics function and filter function
Vec temp(dim_);
temp.setRandom()... | ALGO | 0.976889 | 4.687891 |
65353ccd-ea72-424a-8b13-6dcc90c3fc11 | Ihtiandiko03/Praktikum-Algoritma-dan-Struktur-Data | BilanganPrimaatauKomposit.cpp | // NIM: 119140118
// Nama : Ihtiandiko Wicaksono
// Tanggal : 6 November 2020
// Deskripsi : Soal ke 3
#include <iostream>
using namespace std;
int main(){
int n,cek=0;
cin>>n;
int A[n];
for(int i=0; i<n; i++ ){
cin>>A[i];
cek=0;
for(int j=2; j<=A[i]; j++){
if(A[i] % j == 0){
... | ALGO | 0.999401 | 4.711435 |
6883a9f1-d3f7-41d8-842c-5f2d10f23d92 | ishandutta2007/codeforces | potassium/normal/1513/C.cpp | #pragma GCC optimize ("O3", "unroll-loops")
// #pragma GCC target ("avx2")
// #pragma comment(linker, "/stack:200000000")
// #pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#include "bits/stdc++.h"
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define disti... | ALGO | 0.999928 | 4.914219 |
1d3b068b-e3a7-47bd-9865-cd279a497cab | anish-g22/COA-LAB | Group 13 COA - KAWS End Sem Project/gpgpu-sim_distribution/src/intersim2/networks/flatfly_onchip.cpp | // $Id: flatfly_onchip.cpp 5188 2012-08-30 00:31:31Z dub $
//Flattened butterfly simulator
//Created by John Kim
//
//Updated 11/6/2007 by Ted Jiang, now scales
//with any n such that N = K^3, k is a power of 2
//however, the change restrict it to a 2D FBfly
//
//updated sometimes in december by Ted Jiang, now works ... | ALGO | 0.993503 | 4.766822 |
e3f3c633-873e-46b6-9f55-e3d1ced56a3c | glassrose/CPP_Problem_Solving | SPOJ-ANARC09A.cpp | #include <iostream>
#include <stack>
using namespace std;
int flipsNeeded (string &s)
{
int flips = 0; //unflipped_open : not needed.
stack<char> st;
for (int i=0; i<s.length(); i++)
{
if (s[i]=='}')
{
if (st.empty())
{
flips++;
st.push ('{');
}
else
{
//if (st.top() == '{') //alway... | ALGO | 0.967966 | 3.798813 |
0b571a9b-1a94-4dde-8b01-031096676078 | martijnmartijnmartijnmartijn/Quantum-advantage-k-SAT-with-structure | solvers/SBVA/eigen-3.4.0/doc/examples/Tutorial_ReductionsVisitorsBroadcasting_maxnorm.cpp | #include <iostream>
#include <Eigen/Dense>
using namespace std;
using namespace Eigen;
int main()
{
MatrixXf mat(2,4);
mat << 1, 2, 6, 9,
3, 1, 7, 2;
MatrixXf::Index maxIndex;
float maxNorm = mat.colwise().sum().maxCoeff(&maxIndex);
std::cout << "Maximum sum at position " << maxIndex << std:... | ALGO | 0.999881 | 4.220459 |
604d3eb0-5b69-4117-b7dd-a66c16d7dcd6 | mattstruble/PhysicSimulations | RigidBodies/PhysicsProject/IntersectionTests.cpp | //======================================================================
//File: IntersectionTests.cpp
//Author: Matt Struble
//Resources: https://github.com/idmillington/cyclone-physics
//======================================================================
#include "IntersectionTests.h"
#include <math.h>
//=========... | TEST | 0.949293 | 7.1356 |
07f1e368-891b-496a-aede-385e2234417b | sudostardev/PAT | PAT-Basic/1029 旧键盘(20).cpp | #include <stdio.h>
#include <string.h>
int main() {
char str1[100], str2[100];
fgets(str1, 99, stdin);
fgets(str2, 99, stdin);
int ht1[128] = { 0 };
int ht2[128] = { 0 };
int len1 = strlen(str1);
int len2 = strlen(str2);
for (int i = 0; i < len1; ++i) {
ht1[str1[i]] = 1;
for (int j = 0; j < len2; ++j) {
... | ALGO | 0.999946 | 3.725648 |
2c46dbdb-e940-4c35-8215-05095afbf5f9 | notorious94/Data-Structure-and-Algorithm | Tic Tac Toe.cpp | #include<bits/stdc++.h>
using namespace std;
int grid[3][3];
int dx[] = {0,0,0,1,1,1,2,2,2};
int dy[] = {0,1,2,0,1,2,0,1,2};
void printGrid()
{
for(int i=0; i<3; i++)
{
cout<<"|";
for(int j=0; j<3; j++)
cout<<grid[i][j]<<"|";
cout<<endl;
}
cout<<endl;
}
bool fillG... | ALGO | 0.999907 | 4.486378 |
531cc752-cbf0-418b-b896-fdc4c29cc489 | ArchishmanSengupta/lc | 1383-maximum-performance-of-a-team/1383-maximum-performance-of-a-team.cpp | class Solution {
public:
int maxPerformance(int n, vector<int>& speed, vector<int>& efficiency, int k) {
vector<pair<int, int>> eff_sp;
priority_queue <int, vector<int>, greater<int> > pq_speeds;
long sum = 0, res = 0;
for (auto i = 0; i < n; ++i)
eff_sp.push_back({efficiency[i], speed[i]});... | ALGO | 0.999943 | 5.454298 |
9db883c7-dd51-44bd-90f2-f3f9da4cc90d | Pravekk/design-analysis-and-algorithm | lab pro-20 MST using greedy techiniques.cpp | #include <stdio.h>
#include <stdlib.h>
#define MAX_VERTICES 10
#define MAX_EDGES 45
typedef struct
{
int startVertex;
int endVertex;
int weight;
} Edge;
int parent[MAX_VERTICES];
void initializeParent(int n)
{
for (int i = 0; i < n; i++)
{
parent[i] = i;
}
}
int findParent(int vertex)... | ALGO | 0.999808 | 5.140361 |
30c79c0f-e848-47b5-96bf-485bb13bcee0 | foldawgs/PPB_SE_06_01 | Pertemuan_07/pertemuan7/windows/runner/utils.cpp | #include "utils.h"
#include <flutter_windows.h>
#include <io.h>
#include <stdio.h>
#include <windows.h>
#include <iostream>
void CreateAndAttachConsole() {
if (::AllocConsole()) {
FILE *unused;
if (freopen_s(&unused, "CONOUT$", "w", stdout)) {
_dup2(_fileno(stdout), 1);
}
if (freopen_s(&unuse... | TOOL | 0.998451 | 6.76775 |
fdd3f4fa-efb5-4ea6-9030-d2afdfc9ffe0 | JakuarOvi/codeforces_problems | codeforce_131A.cpp | #include <bits/stdc++.h>
using namespace std;
int main()
{
string s;
char u;
bool c = true;
cin >> s;
for(int i = 1; i < s.length(); i++)
{
if(islower(s[i]))
{
c = false;
}
}
if(c == true)
{
for(int j = 0; j < s.length(); j++)
{
... | ALGO | 0.995663 | 4.529594 |
b5370d56-e9a0-4242-b41c-579d9276ea37 | sjj118/OI-Code | BZOJ/3193/code.cpp | #include<iostream>
#include<cstdio>
#include<cstring>
#include<algorithm>
#define cls(a) memset(a,0,sizeof(a));
#define rg register
#define rep(i,x,y) for(rg int i=(x);i<=(y);++i)
#define per(i,x,y) for(rg int i=(x);i>=(y);--i)
using namespace std;
const int N=1000+10,mo=2011;
int n,f[N][N];
struct Mountain{
int h,d;
... | ALGO | 0.999962 | 3.463536 |
029fed72-5178-47fd-a222-0f12fee8d235 | armandliv/Competitive-Programming | dijkstra.cpp | /// https://infoarena.ro/problema/dijkstra
#include<fstream>
#include<vector>
#include<queue>
#define INF 2000000000
using namespace std;
ifstream f("dijkstra.in");
ofstream g("dijkstra.out");
struct elem
{
int x,c;
bool operator < (const elem &a) const
{
return c>a.c;
}
};
vector<elem>a[50002];... | ALGO | 0.999967 | 3.871282 |
ca45ad5a-3d19-4f19-ac17-4f9cfc27e1b5 | dcyril233/LeetCode | 0107.cpp | #ifdef LEETCODE
#include <LeetCodeL.hpp>
#endif
class Solution {
void recurssion(vector<vector<int>> &rv, TreeNode* root, size_t depth=0){
if (root) {
rv.resize(max(rv.size(), depth+1));
rv[depth].push_back(root->val);
}
if (root->left)
recurssion(rv, roo... | ALGO | 0.99999 | 6.431924 |
3656b20f-88b6-4841-a9aa-9f17951a6024 | Langtienh/DSA | QHĐ - Dãy con tăng dài nhất (Chỉ có bản khó)/DPSEG2.cpp | #pragma GCC optimize("O3")
#include <iostream>
#include <algorithm>
#include <set>
using namespace std;
struct Data {
int x, y;
bool operator > (const Data &other) const {
return x > other.x || (x == other.x && y < other.y);
}
} a[100006];
set<int> S;
int cnt = 0, n;
int c[200006];
int bit[2... | ALGO | 0.999983 | 4.510524 |
6eeb9eef-1a21-4758-bb4e-fc00f2fa49c2 | sineOnTan/leetcode | 951.cpp | 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), left(left), right(right) {}
};
class Solution {
public:
boo... | ALGO | 0.999996 | 6.64406 |
47895f26-8f6d-4635-ae90-3cd81bf262c5 | ishandutta2007/codeforces | fhlasek/normal/528/A.cpp | /* Written by Filip Hlasek 2015 */
#include <cstdio>
#include <cstdlib>
#include <vector>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <string>
#include <algorithm>
#include <cmath>
#include <cstring>
#include <iostream>
#define FOR(i,a,b) for(int i=(a);i<=(b);i++)
#define FORD(i,a,b) for(i... | ALGO | 0.99948 | 4.033963 |
8d229112-05c3-4077-88e2-deb051dc3778 | Rubenr15/spcc_practicals | exp6.cpp | #include<bits/stdc++.h>
using namespace std;
class code{
public:
vector<string> result;
vector<string> arg1;
vector<string> arg2;
vector<string> op1;
vector<string> reg;
void splitString(string input){
stringstream ss(input);
string word,type;
int i = 0;
while(s... | ALGO | 0.996705 | 4.291347 |
58703819-ce12-4848-a72b-9df77a2126f0 | ring-zl/Speech-Forensics | libs/utils/csrc/nms_cpu.cpp | #include <ATen/ATen.h>
#include <torch/library.h>
#include <torch/extension.h>
#include <vector>
// 1D NMS (CPU) helper functions, ported from
// https://github.com/open-mmlab/mmcv/blob/master/mmcv/ops/csrc/pytorch/nms.cpp
using namespace at;
#define CHECK_CPU(x) \
TORCH_CHECK(!x.device().is_cuda(), #x " must be a... | TOOL | 0.934035 | 6.304884 |
b0b4a175-5931-4425-9420-a8597127b497 | faizan445566/Pf-Lab-Loop-Mastery | task 33 staggered numbers.cpp | #include <stdio.h>
int main() {
int num = 1;
for (int i = 1; i <= 5; i++) {
for (int j = 1; j <= i; j++) {
printf("%d ", num);
num++;
}
printf("\n");
}
return 0;
}
| ALGO | 0.999125 | 3.727592 |
4112005d-cc4d-4145-b6d3-ad09f7ec4078 | rawathemant246/Excercises_C | quadratic_equation.cpp | #include <iostream>
#include <math.h>
using namespace std;
int main()
{
int a,b,c ;
float root1, root2;
cout << "Enter the values of a,b,c : ";
cin >> a>>b>>c;
root1 = (-b + sqrt(b*b - 4*a*c))/ (2*a);
root2 = (-b - sqrt(b*b - 4*a*c))/ (2*a);
cout << "Roots of the equation are : " << roo... | ALGO | 0.999567 | 3.472336 |
3f75c4b1-2f64-4a3a-80dd-08ee970c6b3f | yashraj-shri17/Codeforces | Yogurt Sale.cpp | #include <bits/stdc++.h>
using ll = signed long long int;
using namespace std;
void solve() {
ll size, x, y;
cin >> size >> x >> y;
ll answer = size * x;
if (y < 2 * x) {
answer = (size / 2) * y + (size % 2) * x;
}
cout << answer << '\n';
}
int main() {
int num_tests;
cin >> nu... | ALGO | 0.999209 | 4.266868 |
3525faa0-ed0a-444f-8d2e-9463102b7a0e | MishkatIT/others-oj-submissions | SPOJ - Classical/Pattern Find/sol.cpp | /*
Author : MishkatIT
Created : Thursday 01-08-2024 20:03:09
*/
#include <bits/stdc++.h>
using namespace std;
#ifdef LOCAL
#include "algo/debug.h"
#else
#define debug(...) 42
#endif
using ll = long long;
using ld = long double;
const int mod = 1e9 + 7;
const int N = 2e5 + 10;
const int inf = 1e9;
const ... | ALGO | 0.999788 | 5.14095 |
ad6472b5-f0ad-48fe-873c-8da843d5e9c4 | Usaywook/algorithm.sw | Maximum_subarray_problem.cpp | #if 1
#include <iostream>
#include <algorithm>
#include <iterator>
#include <tuple>
#include <vector>
using namespace std;
//int max(int a, int b, int c) { return std::max(std::max(a, b), c); }
tuple<int,int,int> maxCrossingSum(int* arr, int l, int m, int h)
{
// Include elements on left of mid.
int sum = 0;
int ... | ALGO | 0.99998 | 4.916149 |
dd638bfd-c69f-484a-ae80-158617b7a442 | dongyuma/mdywork2 | base-mdy/llvm/tools/llvm-profgen/ProfileGenerator.cpp | #include "ProfileGenerator.h"
static cl::opt<std::string> OutputFilename("output", cl::value_desc("output"),
cl::Required,
cl::desc("Output profile file"));
static cl::opt<SampleProfileFormat> OutputFormat(
"format", cl::desc("F... | TOOL | 0.92197 | 7.436443 |
9bbbd33c-3bee-442e-8c00-0b4653dd2fdd | CyberMatic-AmAn/Algorithms-for-Competitive-Programming | 6. Greedy Algorithms/Kruskal’sPrim’s for MST/fractional_knapsack.cpp | #include <bits/stdc++.h>
using namespace std;
using ll = long long;
// Fast I/O setup
void fast_io() {
ios_base::sync_with_stdio(false);
cin.tie(nullptr);
}
// Fractional Knapsack
double fractional_knapsack(vector<pair<ll, ll>>& items, ll W) {
sort(items.begin(), items.end(), [](auto a, auto b) {
... | ALGO | 0.999955 | 5.540388 |
70d7812d-d90a-40d8-9c10-f87c931946ea | canon4444/AtCoder | ABC-ARC/ABC043-ARC059/B.cpp | #include <iostream>
#include <string>
#include <vector>
using namespace std;
int main()
{
string s;
cin >> s;
vector<int> ans;
int len = s.length();
for( int i = 0; i < len; ++i ){
switch( s.c_str()[i] ){
case '0': ans.push_back(0); break;
case '1': ans.push_back(... | ALGO | 0.999658 | 3.820164 |
036cddd5-752c-4152-80ac-64913051e4de | Kaileshwaran13/CodeChef | 1000 - 1400 difficulty rating/Check Algorithmn.cpp | #include <bits/stdc++.h>
using namespace std;
#define int long long
signed main() {
int t;
cin >> t;
while (t--) {
string s, p;
cin >> s;
int x = s.size();
s.push_back('A');
int count = 1;
for (int i = 1; i <= x; i++) {
if (s[i - 1] == s[i]) {
... | ALGO | 0.999892 | 4.506471 |
02b974ac-2052-4451-8ef4-aa00447ecd5b | govind2602/DSA-CODES. | pattern/pattern and its reverse 2.cpp | #include<iostream>
using namespace std;
int main()
{
int n;
cin>>n;
int i=1;
while(i<=n)
{
int j=1;
while(j<=n)
{
//cout<<j;
cout<<n-j+1;
j=j+1;
}
cout<<endl;
i=i+1;
}
}
| ALGO | 0.999959 | 3.66912 |
afb6e33e-c07a-4508-97ec-edcc40630bb9 | ishandutta2007/codeforces | iandehaan/normal/1352/A.cpp | #include <bits/stdc++.h>
using namespace std;
using ll = long long;
using pii = pair<ll, ll>;
using vi = vector<ll>;
#define pb push_back
#define mp make_pair
int main() {
ios_base::sync_with_stdio(false);
cin.tie(NULL);
int t;
cin >> t;
while (t--) {
int n;
cin >> n;
int ... | ALGO | 0.99936 | 5.32957 |
ee15ce0f-d8ec-4fce-af8b-79ac40d2c7c9 | ntanthedev/Cpp | Code/Luyen De/De 05/ESIZE5.cpp | #include<bits/stdc++.h>
using namespace std;
long double s, l, a, b, c, denta;
int main()
{
ios_base::sync_with_stdio(false);
cin.tie(NULL);
freopen("ESIZE5.inp","r",stdin);
freopen("ESIZE5.out","w",stdout);
cout<<fixed<<setprecision(2);
cin>>l>>s;
l = l/2;
denta = (l*l) - 4*s;
if(de... | ALGO | 0.999696 | 3.493177 |
1cf78dfb-4e88-47c3-a1f1-2363cf03c763 | enzoyoshio/maratona | codeforces/1759/b.cpp | #include <bits/stdc++.h>
using namespace std;
#define int long long
int m, c;
vector<int> v(100);
void solve() {
for(auto& it: v) it=1;
cin >> m >> c;
int mas = 0;
for(int i = 0; i < m; i++) {
int a; cin >> a;
v[a] = 0;
mas = max(mas, a);
}
int idx=1, ans = 0;
while(idx < 100 && ans < c... | ALGO | 0.99998 | 4.504734 |
d8d753bf-e693-4bfb-a87f-c8f16895f7ab | Blade-hh/C-practice | greater a no.cpp | #include<iostream>
using namespace std;
int main(){
int a,ans=0;
cout<<"Enter a no. = ";
cin>>a;
while(a>0){
int r=a%10;
if(r>ans){
ans=r;
}
a=a/10;
}
cout<<ans;
}
| ALGO | 0.998959 | 3.798584 |
c448014b-3180-4442-b5b3-2f033dc658d0 | TZ199/OldHW | Data Structure/Data Structure/HW9/provided_files/main.cpp | //DATA STRUCTURE HW9
//Tianxin Zhou
//Start date:04/16/2017
//Last edited 04/21/2017
//Added the extra_mode 04/21
#include <fstream>
#include <string>
#include <cstdlib>
#include <iostream>
#include <vector>
#include <sstream>
#include <iterator>
#include <stdio.h>
#include <stdlib.h>
#include <ctype.h>
#include <ioman... | ALGO | 0.976624 | 4.195899 |
03a3e54f-5b4c-4bc3-a404-ab61db49e222 | MostlyFor/Algorithm_topic | !previous/algorithm--daily--challenge/w5/leetcode42.cpp | class Solution {
public:
int trap(vector<int>& height) {
int last = height.size()-1;
int left = 0, right =1;
int right_max = 0;
int right_index = 0;
int ans =0;
//left가 last가 되거나 크면 끝냄
while(left < last){
//누적 블록 넓이
int bls =... | ALGO | 0.999986 | 6.178124 |
943b47b9-8cb8-42b0-9f8f-c237e73db990 | dginhac/esirem-itc313 | samples/2021-2022/04-stl/algorithms/copy.cpp | /*
* @File: copy.cpp
* @Project: C++ Programming - ESIREM 3A IT
* @Author: Dominique Ginhac <d0m>
* @Email: <EMAIL>
* @Date: 2020-10-30 09:27:20
* @Summary:
*
* @Last Modified by: d0m
* @Last Modified time: 2021-10-17 12:32:14
*/
#include <iostream>
#include <vector>
std::ostream& operator<<(std::ostream& o... | TOOL | 0.986329 | 4.707497 |
885bc09a-ea98-409a-a40b-89d985e0a4cf | Nignik/CP | Hoof_paper_scissors/huff_paper_scissors.cpp | #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
void setIO(string s) {
ios_base::sync_with_stdio(0); cin.tie(0);
if (fopen((s+".in").c_str(), "r")){
freopen((s+".in").c_str(),"r",stdin);
freopen((s+".out").c_str(),"w",stdout);
}
}
int main() {
setIO("hps");
int n;
cin >> n;
int ans =... | ALGO | 0.999353 | 3.801177 |
3c486c7a-0b40-4f4c-b60a-59b811acb592 | Clixxzydev/FN-UnrealBuildver4.26 | Engine/Source/Developer/GraphColor/Private/graphUtils.cpp | #include "CoreMinimal.h"
#include "graphStructures.h"
#include "graph.h"
/* Internal util functions for FUNCTION POINTERS */
int _HideVertex(graphP theGraph, int vertex);
void _HideEdge(graphP theGraph, int arcPos);
void _RestoreEdge(graphP theGraph, int arcPos);
int _IdentifyVertices(graphP theGraph, int u, int v... | TOOL | 0.975384 | 7.215249 |
bf58beec-b5cf-4f6f-8f88-06de6c96c032 | masum200119/Data-Structure | linkedlistimplementation.cpp | #include <stdio.h>
#include <stdlib.h>
#include <time.h>
// Define the structure for a singly linked list node
struct Node
{
int data;
struct Node* next;
};
struct Node *head = NULL;
// Function to create a new node
struct Node* createNode(int data)
{
struct Node* newNode = (struct Node*)malloc(sizeof(stru... | ALGO | 0.999422 | 4.67356 |
8838aebb-36cc-4ab7-b48b-027e4330bf5e | mohit7-7/Leetcode | 1706-min-cost-to-connect-all-points/1706-min-cost-to-connect-all-points.cpp | class Solution {
public:
int minCostConnectPoints(vector<vector<int>>& points) {
int n = points.size();
priority_queue<pair<int,int>, vector<pair<int,int>>, greater<pair<int,int>>> pq;
vector<bool> mst(n,false);
pq.push({0,0});
int ans=0;
while(!pq.empty()){
... | ALGO | 0.999983 | 6.024358 |
c9833a91-9617-4fc9-8bcc-a71a5b961883 | anhdh-gh/Cau-truc-du-lieu-va-giai-thuat | Contest6/9.cpp | #include<bits/stdc++.h>
using namespace std;
main()
{
long long T,n,k,dem;
cin>>T;
while(T--)
{
cin>>n>>k;
long long a[n];
for(long long i = 0 ; i < n ; i++)
cin>>a[i];
//sort(a,a+n);
dem = 0;
for(long long i = 0 ; i < n-1 ; i++)
for(long long j = i+1 ; j < n ; j++)
if(a[i]+a[j]==k) dem++;
... | ALGO | 0.999538 | 3.972239 |
28f8d669-4e1f-4b59-802f-1ce5e690ccdf | xingjinglu/ParaC-TestCase | sharpness/ser/sharpness_serial.cpp | //sharpness.cpp
#include<stdio.h>
#include<stdlib.h>
#include<string.h>
#include<math.h>
#include<time.h>
#include<sys/time.h>
#include<iostream>
using namespace std;
#define MIN2(a,b) ((a)<(b) ? (a):(b))
#define MAX2(a,b) ((a)>(b) ? (a):(b))
#define MAX3(a,b,c) (MAX2((a),MAX2((b),(c))))
#define MIN3(a,b,c) (MI... | ALGO | 0.990089 | 4.224633 |
108d3450-72ba-4c58-879b-c59dcbd590ff | adarshjha01/Leetcode-questions | 0142-linked-list-cycle-ii/0142-linked-list-cycle-ii.cpp | /**
* Definition for singly-linked list.
* struct ListNode {
* int val;
* ListNode *next;
* ListNode(int x) : val(x), next(NULL) {}
* };
*/
class Solution {
public:
ListNode *detectCycle(ListNode *head) {
ListNode* slow=head;
ListNode* fast=head;
while(fast!=nullptr && fas... | ALGO | 0.999964 | 5.533578 |
6be1d25c-1caa-4a5f-8376-b5fc629b7fae | SUSHANTSINGH01/CP-AND-DSA | POTD/17th_September_2024.cpp | class Solution {
public:
int getMinDiff(vector<int> &arr, int k) {
// code here
int n=arr.size();
sort(arr.begin(),arr.end());
int res=abs(arr[n-1]-arr[0]);
int minn=arr[0]+k;
int maxx=arr[n-1]-k;
int new_minn=0;
int new_maxx=0;
for(int ... | ALGO | 0.999931 | 5.180338 |
03eeb018-178c-45f6-8f4a-c5cb27458f51 | RoundofThree/morello-llvm-project | libc/src/math/generic/roundf.cpp | #include "src/math/roundf.h"
#include "src/__support/FPUtil/NearestIntegerOperations.h"
#include "src/__support/common.h"
namespace __llvm_libc {
LLVM_LIBC_FUNCTION(float, roundf, (float x)) { return fputil::round(x); }
} // namespace __llvm_libc
| ALGO | 0.99139 | 6.68012 |
dd5b7d3e-b13d-42d8-b3a5-94e47a9bed08 | Er1ck333/M9 | p4/main.cpp | #include <iostream>
#include <unistd.h> // Para fork()
#include <sys/wait.h> // Para wait()
#include <vector>
#include <string>
#include <cstdlib> // Para rand() y srand()
#include <ctime> // Para time()
// Variable global compartida (no compartida entre procesos, pero simula la idea)
std::vector<std::string> no... | ALGO | 0.988855 | 5.088606 |
a25befc7-a979-47fc-938c-99d65d197425 | pranayjoshi/shop_app | windows/runner/utils.cpp | #include "utils.h"
#include <flutter_windows.h>
#include <io.h>
#include <stdio.h>
#include <windows.h>
#include <iostream>
void CreateAndAttachConsole() {
if (::AllocConsole()) {
FILE *unused;
if (freopen_s(&unused, "CONOUT$", "w", stdout)) {
_dup2(_fileno(stdout), 1);
}
if (freopen_s(&unuse... | TOOL | 0.998859 | 6.785645 |
52c148b3-8608-4152-be9b-b08088ffffe6 | Harshstar/LeetCode_Sol | 3034-points-that-intersect-with-cars/3034-points-that-intersect-with-cars.cpp | class Solution {
public:
int numberOfPoints(vector<vector<int>>& nums) {
set<int>s;
for(int i=0;i<nums.size();i++)
{
int a=nums[i][0];
int b=nums[i][1];
for(int j=a;j<=b;j++)
s.insert(j);
}
return s.size();
}
}; | ALGO | 0.999725 | 5.57319 |
59d97708-c0e0-4011-b4f1-c83cbdff18e4 | ishandutta2007/codeforces | egor.lifar/normal/610/D.cpp | #include <iostream>
#include <sstream>
#include <cmath>
#include <algorithm>
#include <string>
#include <string.h>
#include <cstdio>
#include <vector>
#include <map>
#include <set>
#include <cstring>
#include <queue>
#include <bitset>
#include <queue>
#include <unordered_map>
#include <vector>
#include <bitset>
using ... | ALGO | 0.999201 | 3.104774 |
8857096b-af3c-4fc0-b632-db2dd56b76f5 | osama-mahmoud-h/Leetcode_solutions | 2279-maximum-bags-with-full-capacity-of-rocks/2279-maximum-bags-with-full-capacity-of-rocks.cpp | class Solution {
public:
static bool cmp_(pair<int,int>p1,pair<int,int>p2){
return abs(p1.first-p1.second)<abs(p2.first-p2.second);
}
int maximumBags(vector<int>& capacity, vector<int>& rocks, int k) {
vector<pair<int,int>>rock_capacity(rocks.size());
for(int i=0;i<size(rocks);i++){
roc... | ALGO | 0.999954 | 5.581943 |
8cf147f0-0213-4f94-9bf0-928bf4e736ca | MukulNagpal1/basic | bass/windows/runner/utils.cpp | #include "utils.h"
#include <flutter_windows.h>
#include <io.h>
#include <stdio.h>
#include <windows.h>
#include <iostream>
void CreateAndAttachConsole() {
if (::AllocConsole()) {
FILE *unused;
if (freopen_s(&unused, "CONOUT$", "w", stdout)) {
_dup2(_fileno(stdout), 1);
}
if (freopen_s(&unuse... | TOOL | 0.998176 | 6.76775 |
a13f991e-685c-480f-8ff5-dbb558b059b5 | NanayaHaruki/leetcode | 序号/1031. 两个非重叠子数组的最大和.cpp | class Solution {
public:
int maxSumTwoNoOverlap(vector<int>& nums, int firstLen, int secondLen) {
int n = nums.size();
vector<int> ps(n + 1);
int s = 0;
for (int i = 1; i <= n; i++) {
ps[i] = ps[i - 1] + nums[i - 1];
}
int ans = 0;
for (int i = firstLen; i <= n; i++) {
int fir... | ALGO | 0.999801 | 5.592054 |
067c29b9-8db2-4fc7-9e1c-e501393fa23c | GeryRadenkova/Introduction-to-Programming | Homeworks_2016-2017/Homework_1__2016-2017/Task_3.cpp | #include <iostream>
int main()
{
unsigned int number;
std::cout << "Enter number: ";
std::cin >> number;
if (number > UINT_MAX)
{
std::cout << "Number out of range\n";
return 0;
}
int prev = 0, curr = 0;
prev = number % 16;
number /= 16;
while (number != 0)
{
curr = number % 16;
number /= 16;
... | ALGO | 0.994652 | 4.543459 |
351ff2aa-57f2-43e6-b623-2372ae80228d | VivekKumarMishra1301/competative-coding | char.cpp | #include <iostream>
using namespace std;
int main()
{
int n;
cin >> n;
char x = 'A';
for (int i = 0; i < n; i++)
{
x = 'A';
x = x + i;
cout << x;
}
} | ALGO | 0.997144 | 3.748926 |
a9b8a8f9-2818-48f8-b090-3eca2e5ba752 | MadhavaVish/ThroughThiccAndThinn | src/Gwaphics/PathTracer/Scene.cpp | #include "Scene.hpp"
#include <chrono>
#include <iostream>
#include <glm/glm.hpp>
#include <glm/gtc/matrix_transform.hpp>
#include <glm/gtx/string_cast.hpp>
namespace Vulkan
{
typedef std::chrono::high_resolution_clock Clock;
Scene::Scene()
{
AddMaterial({ 0.7, 0.34, 0.21 }, 1.f);
//addModel("assets/bunny.obj",... | ALGO | 0.922683 | 4.11372 |
1c95dc74-9731-469c-8082-265d2c8668fe | Sarangaaa/Hacktoberfest2023-1 | Program's_Contributed_By_Contributors/C++ Programs/linkedlist/merge2list.cpp | #include<bits/stdc++.h>
using namespace std;
class Node {
public:
int val;
Node* next;
};
int main()
{
Node* head1 = new Node();
Node* head2 = new Node();
Node* one = new Node();
Node* two = new Node();
Node* three = new Node();
Node* four = new Node();
head1->val = 1;
head2->val = 1;
one->val = 2;
... | ALGO | 0.999953 | 3.85439 |
bd3a1851-5b8d-49b9-af1d-cf146e4bdb68 | arangodb/arangodb | arangod/Cluster/Utils/EvenDistribution.cpp | ////////////////////////////////////////////////////////////////////////////////
/// DISCLAIMER
///
/// Copyright 2014-2024 ArangoDB GmbH, Cologne, Germany
/// Copyright 2004-2014 triAGENS GmbH, Cologne, Germany
///
/// Licensed under the Business Source License 1.1 (the "License");
/// you may not use this file except... | ALGO | 0.891837 | 7.146586 |
34dc037d-8b4d-4bb8-80de-6a57fb800b33 | Alexsandr314/OOP | Стандартная библеотека шаблонов STL,алгоритмы/5.cpp | #include <iostream>
#include <vector>
#include <set>
#include <array>
#include <algorithm>
using namespace std;
int main() {
//
array<int, 10> even_numbers;
for (size_t i = 0; i < even_numbers.size(); ++i) {
even_numbers[i] = (i + 1) * 2; // : 2, 4, 6, ..., 20
}
//
set<in... | ALGO | 0.999031 | 4.886446 |
91fe7c46-a96b-4cce-9018-45ef2998a6a3 | UnsEmp/C_Note | Hangdian text/2039.cpp | #include <iostream>
using namespace std;
int main()
{
int n;
cin >> n;
while( n-- ) {
double a, b, c;
cin >> a >> b >> c;
if((a + b) > c && (a + c) > b && (b + c) > a)
cout << "YES" << endl;
else
cout << "NO" << endl;
}
return 0;
} | ALGO | 0.999521 | 4.118582 |
80c58d9b-8a57-4bf0-89cf-6d03128af7d7 | jikho7/cpp09 | ex02/PmergeMe.cpp | #include "PmergeMe.hpp"
Pmerge::Pmerge(): _even(true), _nbOfElements(0){}
Pmerge::~Pmerge(){}
Pmerge::Pmerge(const Pmerge &other)
{
this->_doubleVec = other._doubleVec;
this->_doubleList = other._doubleList;
this->_bigNumberVector = other._bigNumberVector;
this->_smallNumberVector = other._smallNumbe... | ALGO | 0.99475 | 4.39344 |
530f8eb4-ad23-4479-a8f2-91f0c04afe51 | NUC-NCE/algorithm-codes | codes - ac/UVA/100/18498716_AC_330ms_0kB.cpp | #include <bits/stdc++.h>
using namespace std;
int solve(int x){
int num=0;
while(x!=1){
num++;
if(x%2==0)
x=x/2;
else
x=x*3+1;
}
return num;
}
int main()
{
int l,r;
while(scanf("%d%d",&l,&r)!=EOF){
printf("%d %d ",l,r);
int maxn=0;
... | ALGO | 0.999925 | 4.248593 |
2b4c39ab-c761-43f9-92e1-fbc3c2d09778 | eklavyaK/codeforces-solutions | PermutationSwap.cpp | #include<bits/stdc++.h>
#define endl "\n"
#define F first
#define S second
#define int long long
typedef long long ll;
typedef long double ld;
using namespace std;
void code(){
int n; cin>>n;
vector<int> arr(n);
for(int i=0;i<n;i++)cin>>arr[i];
int ans = 0;
for(int i=0;i<n;i++){
ans = gcd(a... | ALGO | 0.999575 | 5.194083 |
66e7179b-6fd9-4617-94db-065849809bbf | LaloImEx/Codeforces-Problems | Eating Candies.cpp | #include <bits/stdc++.h>
#define fastio ios_base::sync_with_stdio(0);cin.tie(0);
using namespace std;
int main()
{
int tc,L,R,cont,n,ali,bob,sz;
cin>>tc;
while(tc--)
{
cin>>n;
vector<int>mxc;
int v[n];
L = 0,R = n-1;
ali = 0,bob = 0;
for(int i = 0... | ALGO | 0.999898 | 4.046453 |
dd108aba-7c0c-4db7-a004-499586b44441 | 113bommy/deepmind_codecontests_refine | cpp_gold_filter_file/cpp_train_9426_2.cpp | #include <bits/stdc++.h>
using namespace std;
const int maxn = 1e5 + 6;
const long long INF = 1e18 + 4;
const int MOD = 1e9 + 7;
const long double eps = 1e-9;
const long double pi = 3.1415926535897932384626433832795;
set<int> st;
map<int, int> cnt;
int a[maxn];
int main() {
ios_base::sync_with_stdio(0);
cin.tie(0);... | ALGO | 0.999931 | 3.165269 |
0fb99dd1-3a9b-442d-8ba5-0ba3cbf8f4e8 | lorenzo-rovigatti/cahn-hilliard | split_files/ch_ldm_binary.cpp | #include <iostream>
#include <fstream>
#include <cstdlib>
#include <cmath>
#include <vector>
#include <algorithm>
#include <string>
#include <numeric>
#include <cxxopts/cxxopts.hpp>
#define SPECIES 2
#define SQR(X) ((X) * (X))
#define LR_LOG(x) (std::log((x)))
struct FreeEnergyModel {
double B_2 = 2100 * 0.5;
dou... | ALGO | 0.999865 | 5.372699 |
27e7c663-d91b-43b5-a68c-2107f016a175 | Lee-Duck-03/template_cp | codetumlumtala/CLP1A.cpp | /* ________ _______ _______ _____ _______
| _____| | \ | \ / \ | \
| |_____ | 0 | | 0 | | _ | | 0 |
| _____| | _ / | _ / | |_| | | _ /
| |_____ | | \ \ | | \ \ | | | | \ \
|________| |__| \__\ |__| \__\ ... | ALGO | 0.999562 | 3.437253 |
f75666c8-edf8-4de8-849c-6f4316a4d798 | liuzilun/CODE | src/StudyNetWork/CodingInterviewChinese2/19_RegularExpressionsMatching/RegularExpressions.cpp | //==================================================================
// ָOfferԹپͱ⡷
// ߣκ
//==================================================================
// 19ʽƥ
// Ŀʵһƥ'.''*'ʽģʽеַ'.'
// ʾһַ'*'ʾǰַԳΣ0Σڱ
// Уƥַַָƥģʽ磬ַ"aaa"ģʽ"a.a"
// "ab*ac*a"ƥ䣬"aa.a""ab*a"ƥ䡣
#include <cstdio>
bool matchCore(const char* str, const ... | ALGO | 0.992792 | 4.46689 |
38807592-3401-4d7c-af64-882c2d3ec33f | ssusie/Quasi1DEuler | MORTestbed_UTEP/Nonlinear/Classes/Problem/zFEM/zFEM_mxPrecompRom.cpp | #include "zfem_structs.hpp"
#include "convertML2Cstruct.hpp"
#include "zfem_elems.hpp"
#include "zfem_precomp_rom.hpp"
#include "matrix.h"
void mexFunction( int nlhs, mxArray *plhs[],
int nrhs, const mxArray *prhs[])
{
//prhs[0]: V - reduced basis
//prhs[1]: ub - basis offset vector
//prh... | ALGO | 0.98719 | 5.717385 |
01378eaf-fd77-4b05-b178-dc3e9bba354c | wyvernio/CPSC131-Projects | HW5/WordFrequency.cpp | ///////////////////////// TO-DO (1) //////////////////////////////
/// Include necessary header files
/// Hint: Include what you use, use what you include
///
/// Do not put anything else in this section, i.e. comments, classes, functions, etc. Only #include directives
#include "WordFrequency.hpp"
#include <s... | TOOL | 0.924445 | 6.798824 |
b19cfaf0-7de6-42ed-b6d7-ec70041c0df1 | phaXcoin/phaxcoin | src/CryptoNoteCore/CryptoNoteBasicImpl.cpp | #include "CryptoNoteBasicImpl.h"
#include "CryptoNoteFormatUtils.h"
#include "CryptoNoteTools.h"
#include "CryptoNoteSerialization.h"
#include "Common/Base58.h"
#include "crypto/hash.h"
#include "Common/int-util.h"
using namespace Crypto;
using namespace Common;
namespace CryptoNote {
/***************************... | TOOL | 0.90611 | 6.850379 |
fff26b65-7fbd-4d50-b6d5-73853d3984b0 | tech-review/dp | coin_collect.cpp | #include <iostream>
#include <vector>
using namespace std;
int coin_collect(vector<vector<int>> board) {
int n = board.size();
int m = board[0].size();
vector<vector<int>> F(n, vector<int>(m, 0));
for (int j = 1; j < m; j++) {
F[0][j] = F[0][j - 1] + board[0][j];
}
for (int i = 1; i ... | ALGO | 0.999543 | 5.413361 |
75c64f4c-65ec-4f09-86a8-2b355ebf6303 | asvikr/SPOJ_SOL | RPLB/15438548.cpp | #include<bits/stdc++.h>
using namespace std;
typedef long long int LL;
#define getchar_unlocked getchar
#define pb push_back
#define mp make_pair
#define f first
#define sc second
#define M 1000000007
#define inf (int)(2e+9)
#define all(o) (o).begin(), (o).end()
#include<ext/pb_ds/assoc_container.hpp>
#include<ext/pb_d... | ALGO | 0.999956 | 3.853244 |
7d775082-dd1e-4ca1-90d9-2ac967116031 | Reveroftrillion/BOJ | BOJ/10815/Main.cpp | #include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
vector<long long> sang;
int search(int start, int end, long long num)
{
while (start <= end)
{
int mid = (start + end) / 2;
if (sang[mid] == num)
{
return 1;
}
else if (sang[mid... | ALGO | 0.999982 | 5.06393 |
eba2ca38-fedc-402a-a05d-f98d9d0ba6c4 | evga7/Practice_Algorithm_01 | BOJ_1629.cpp | #include <iostream>
#include <stack>
#include <algorithm>
#include <vector>
#include <list>
#include <queue>
#include <deque>
#include <set>
using namespace std;
long long A, B, C;
long long divide(long long A, long long B)
{
if (B == 0)
return 1;
else if (B == 1)
return A;
else if (B % 2)
return divide(A, B -... | ALGO | 0.999934 | 3.975771 |
7da53263-418e-4944-a847-168d7ee5578c | Shubha012/Arsh-Goyal-Coding-Challenge | Sort Colors.cpp | void sortColors(vector<int>& nums) {
int start = 0, mid = 0;
int end = nums.size()-1;
while(mid<=end){
if(nums[mid]==0){
swap(nums[mid], nums[start]);
mid++;
start++;
}
else if(nums[mid]==2){
swap... | ALGO | 0.999946 | 5.67468 |
d90a749c-60c1-4965-8346-dbc52f1007a6 | gnlenfn/notebook | codes/programmers/탑.cpp | #include <string>
#include <vector>
#include <stack>
#include <iostream>
using namespace std;
vector<int> solution(vector<int> heights) {
vector<int> answer;
stack<int> st;
bool check = true;
for(int i = heights.size()-1; i >= 0; i--)
{
for(int j = i - 1; j >= 0; j--)
{
... | ALGO | 0.999975 | 5.014196 |
5152e3e1-cc93-47f8-92b8-773db9dada20 | occidere/leetcode | Algorithms/1295_Find_Numbers_with_Even_Number_of_Digits/Solution.cpp | #include <cstdio>
#include <vector>
#include <string>
using namespace std;
class Solution {
public:
int findNumbers(vector<int>& nums) {
int count = 0;
for (int i = 0; i < nums.size(); i++) {
if (to_string(nums[i]).length() % 2 == 0) {
count++;
... | ALGO | 0.999708 | 5.572325 |
5098cdc3-7974-4a2e-a83b-4c495099f9f3 | YangZhou1997/SmartNIC-GEM5 | src/systemc/tests/systemc/misc/unit/data/datawidth_bool_to_unsigned/promote_truncation/datawidth.cpp | /*****************************************************************************
datawidth.cpp --
Original Author: Martin Janssen, Synopsys, Inc., 2002-02-15
*****************************************************************************/
/**************************************************************************... | ALGO | 0.96318 | 5.750748 |
5eff1f6f-c704-48f9-b24d-da6086f69cd5 | Madhavwasavaliable/Programming-code-sol | CodeForces/112A-Petya and Strings.cpp | #include<iostream>
using namespace std;
int main() {
string str1, str2;
cin >> str1 >> str2;
for (int i = 0; i < str1.length(); i++) {
str1[i] = tolower(str1[i]);
str2[i] = tolower(str2[i]);
}
if (str1 > str2) {
cout << "1";
}else if (str1 < str2) {
cout << "-1"... | ALGO | 0.999996 | 3.337042 |
7f935175-58c3-4ddd-adfb-5e1da26a45cc | CarlosDaniel111/algorithms-icpc | Strings/SuffixTree.cpp | /**
* Descripcion: Algoritmo de Ukkonen para arbol de sufijos. El sufijo no unico
* mas largo de S tiene longitud len[p]+lef despues de cada llamada a add.
* Cada iteracion del bucle dentro de add esta cantidad disminuye en uno
* Tiempo: O(n log sum)
*/
struct SuffixTree {
string s;
int N = 0;
vi pos, len, ... | ALGO | 0.999886 | 4.399081 |
5a6e892b-4a8c-45ca-b12e-27b6ae32f518 | ishandutta2007/codeforces | joisino/normal/387/D.cpp | #include <bits/stdc++.h>
#define FOR(i,a,b) for( ll i = (a); i < (ll)(b); i++ )
#define REP(i,n) FOR(i,0,n)
#define YYS(x,arr) for(auto& x:arr)
#define ALL(x) (x).begin(),(x).end()
#define SORT(x) sort( (x).begin(),(x).end() )
#define REVERSE(x) reverse( (x).begin(),(x).end() )
#define UNIQUE(x) (x).erase( unique( AL... | ALGO | 0.999858 | 3.941209 |
61d02cf5-6bb7-480a-b5a6-64ffa50b921e | pmchrist/Turbo-Book | MeanReversionTrader.cpp | #include "MeanReversionTrader.h"
#include "Logger.h"
#include <numeric>
#include <cmath>
#include <random>
MeanReversionTrader::MeanReversionTrader(int id, std::shared_ptr<Exchange> exch)
: Trader(id, exch) {}
void MeanReversionTrader::act() {
// Choose random asset to trade.
std::vector<std::string> asse... | ALGO | 0.987936 | 5.286751 |
fc1d2bb3-1d09-42fc-b9a8-a77d4b93071b | ryumme/PP1 | week10/f.cpp | #include <iostream>
using namespace std;
int main() {
double a[101];
int n;
cin >> n;
int att1, att2, final, credits;
double credits_sum = 0;
for (int i = 0; i < n; i++) {
a[i] = 0.0;
}
double cnt = 1.0;
for (int i = 50; i < 100; i += 5) {
a[i] = cnt;
a[i ... | ALGO | 0.999278 | 3.674825 |
c7cb6c77-896e-4d0d-93ef-8b272d0d60c3 | sinian666/codes_102_4 | 1cpp_副本6/chapter_graph/graph_bfs.cpp | /**
* File: graph_bfs.cpp
* Created Time: 2023-03-02
* Author: Krahets (<EMAIL>)
*/
#include "../utils/common.hpp"
#include "./graph_adjacency_list.cpp"
/* 广度优先遍历 BFS */
// 使用邻接表来表示图,以便获取指定顶点的所有邻接顶点
vector<Vertex *> graphBFS(GraphAdjList &graph, Vertex *startVet) {
// 顶点遍历序列
vector<Vertex *> res;
// 哈... | ALGO | 0.999824 | 5.563282 |
813c1c98-2c58-4eab-a3c5-259535d854a2 | suraj101998/LeetCodeSolutions | 3000-3099/3094.Guess the Number Using Bitwise Questions II/Solution.cpp | /**
* Definition of commonBits API.
* int commonBits(int num);
*/
class Solution {
public:
int findNumber() {
int n = 0;
for (int i = 0; i < 32; ++i) {
int count1 = commonBits(1 << i);
int count2 = commonBits(1 << i);
if (count1 > count2) {
n |... | ALGO | 0.999399 | 5.780645 |
9e03b701-8371-47cc-acf8-343f132c2576 | mchinen/ofxMSA | ofxMSABulletPhysics/lib/bullet/BulletSoftBody/btSoftBodyConcaveCollisionAlgorithm.cpp | #include "btSoftBodyConcaveCollisionAlgorithm.h"
#include "BulletCollision/CollisionDispatch/btCollisionObject.h"
#include "BulletCollision/CollisionShapes/btMultiSphereShape.h"
#include "BulletCollision/BroadphaseCollision/btBroadphaseProxy.h"
#include "BulletCollision/CollisionShapes/btConcaveShape.h"
#include "Bulle... | ALGO | 0.996856 | 6.844971 |
ab40c743-1f4e-4302-b976-dc63102c9a34 | surajkumarsingh1784/DSA | 496-next-greater-element-i/next-greater-element-i.cpp | class Solution {
public:
vector<int> nextGreaterElement(vector<int>& nums1, vector<int>& nums2) {
vector<int> ans(nums1.size());
for (int i = 0; i < nums1.size(); i++) {
bool flag = 0;
for (int j = 0; j < nums2.size(); j++) {
// Step-1
if (... | ALGO | 0.999801 | 5.807298 |
fef8acd6-5a34-4888-b36f-3f438c125aa0 | yogibala/leetcode | solutions/2126. Destroying Asteroids/2126.cpp | class Solution {
public:
bool asteroidsDestroyed(int mass, vector<int>& asteroids) {
ranges::sort(asteroids);
long m = mass;
for (const int asteroid : asteroids)
if (m >= asteroid)
m += asteroid;
else
return false;
return true;
}
};
| ALGO | 0.998926 | 6.449478 |
3abe5940-cf05-4a37-8928-77ff0a561044 | khoadangtgfit/1000_BT_C- | 1000 bai tap c/mang mot chieu/liet ke cac phan tu nam trong doan x y.cpp | #include<iostream>
#include<math.h>
#define MAX 100
using namespace std;
void NhapSL(int &n)
{
do{
cout<<"\nNhap so luong mang(0<n<100):";
cin>>n;
if(n<1||n>MAX)
cout<<"\nNhap so luong mang khong hop le!!!yeu cau nhap lai!!!";
}while(n<1||n>MAX);
}
void NhapMang(int a[],int n)
{
for(int i=0;i<n;i++)
{
co... | ALGO | 0.999815 | 3.095801 |
b4d5bf06-1c03-4ccb-b004-77234cfd01d9 | anonymouspc/python-interpreter | include/generic/math/linear/nd/swap.cpp | #pragma once
constexpr void swap ( array_type auto&& left, array_type auto&& right )
requires ( left.dimension() == right.dimension() ) and
std::same_as<left_value_type,right_value_type> and
std::swappable_with<left_value_type,right_value_type>
{
constexpr bool left_is_view = require... | TOOL | 0.953016 | 7.34349 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.