uuid string | repo_name string | relative_path string | content string | category string | algo_rel_score float64 | quality_score float64 |
|---|---|---|---|---|---|---|
d881284d-9e79-4d1d-a67d-d1076f3faf8d | aierlma/cpp-homework-in-school | thirdCpp/addpntrs.cpp | # include <iostream>
int main()
{
using namespace std;
double wages[3] = {10000.0, 20000.0, 30000.0};
short stacks[3] = {3, 2, 1};
// Here are two ways to get the address of an array
double * pw = wages; // name of an array = address
short * ps = &stacks[0]; // or use address operator
// With arra... | ALGO | 0.995546 | 3.908475 |
9b468d68-3b30-4b48-a58d-550f8312005f | mr-optimizer/cp | practice/Code_Forces/date wise/2021/15-10-2021/2.cpp | #include<bits/stdc++.h>
using namespace std;
#define rep(i,x,y) for(int i=x ; i<y ; i++)
#define f first
#define s second
#define pb push_back
#define eb emplace_back
#define PRES(c,x) ((c).find(x) != (c).end())
typedef long long ll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vll;
typedef pair... | ALGO | 0.999804 | 4.111528 |
cfb8ee55-a02d-49ca-8404-1954ad70e0f5 | jeremykvlim/kattis | open/donthungertogether.cpp | #include <bits/stdc++.h>
using namespace std;
bool survive(vector<pair<int, double>> food, double total) {
priority_queue<pair<int, double>, vector<pair<int, double>>, greater<>> pq;
for (int i = 0; i < food.size(); i++) {
pq.emplace(food[i]);
auto need = total;
while (!pq.empty()) {
... | ALGO | 0.999968 | 4.647981 |
7bf2fd11-d92b-42a2-ac2e-9a212df70d7e | DzakiAhmadFauzi/ParadigmaOOP2_0082 | polimorpi.cpp | #include <iostream>
using namespace std;
class seseorang {
public:
//virtual void pesan() = 0;
virtual void pesan(){
cout << "Pesan dari seseorang"<< endl;
}
};
class joko :public seseorang {
public:
void pesan() {
cout << "Pesan dari joko" << endl;
}
};
class lia :public seseoran... | TOOL | 0.870351 | 4.824715 |
ebaf26d4-f214-42f9-8b65-890a11ca124c | kappybar/competitive_programming_library | Math/getPrimes.cpp | #include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0;i<n;i++)
typedef long long ll;
vector<ll> getPrimes(ll x){
vector<ll> res;
for(ll i = 2; i * i <= x;i++){
if(x%i ==0){
res.push_back(i);
while(x%i ==0) x /= i;
... | ALGO | 0.99957 | 3.687564 |
8f7f86bd-e2d9-4d29-b312-43e717c07e1c | omkarpatilkit/temp | rec4.cpp | #include <iostream>
using namespace std;
void countLetters(char arr[])
{
static int Len = 0; //
if (*arr != '\0')
{
Len++;
arr++;
countLetters(arr);
}
else
{
cout << Len;
}
}
int main()
{
char arr[20];
cout << "Please enter a name: ";
cin >> arr;... | ALGO | 0.995417 | 3.880112 |
2f0bf018-1777-4c8b-8cfb-669a0110ce4b | Goodnameisfordoggy/College-assignment | c BasicHomework/09章 结构体/L0907 心得.cpp | #include <stdio.h>
#pragma warning(disable : 4996)
#define N 5
/*
1004 ZhangShuyu 85 80 79
1008 LiShuang 85 83 82
1006 ChenHongyu 83 79 80
1013 ChenDi 79 85 76
1001 GuoTengyang 75 79 79
*/
struct Student
{
int num;
char name[20];
float s_1, s_2, s_3;
float aver;
} stu[N];
void input(struct Student *arr, i... | ALGO | 0.998319 | 3.521805 |
aeb0991b-c711-453c-8d2b-f96da9c5fdf6 | TranHoangDatSC/Upcoder-Study | Upcoder/Basic Programming/If - Else/INAN.cpp | #include <iostream>
using namespace std;
long Solve(long T, long P, long C) {
long res = 0;
if(T == 1) {
res = P * C;
}
else if(T == 2) {
if(P % 2 == 0)
res = (P / 2) * C;
else
res = ((P + 1) / 2) * C;
}
return res;
}
int main() {
long T, P,... | ALGO | 0.999624 | 4.154821 |
f270adf2-2fd9-4bb2-affb-2dba92aaf78a | snehagupta20/pw-dsa-assignments | stack/ques2.cpp | /*
Q2. Given an arraylist, print the Next Greater Element (NGE) for every element.
The Next Greater Element for an element x is the first greater element on the right side of x in the vector.
Elements for which no greater element exists, consider the next greater element as -1.
The first line of input contains the size... | ALGO | 0.999977 | 4.630035 |
e0d7683c-e911-4e0e-a532-6f53c6373d86 | SantyPilot/SantyPilot | ground/gcs/src/libs/eigen/bench/benchFFT.cpp | #include <iostream>
#include <bench/BenchUtil.h>
#include <complex>
#include <vector>
#include <Eigen/Core>
#include <unsupported/Eigen/FFT>
using namespace Eigen;
using namespace std;
template <typename T>
string nameof();
template <> string nameof<float>() {return "float";}
template <> string nameof<double>() {r... | TEST | 0.893059 | 6.391927 |
9db5ff18-c8ee-478a-83d6-882c9c5e0d2d | CarIsFast/DSA | lecture-57/celebretyProblem.cpp | // // My approch
// class Solution {
// public:
// // Function to find if there is a celebrity in the party or not.
// int celebrity(vector<vector<int> >& mat) {
// // code here
// int m = mat.size();
// int n = mat[0].size();
// int presentCeleIndex = -1;
// for(int ro... | ALGO | 0.998169 | 5.828918 |
8432cbf5-32b0-4001-a32a-0f561069a664 | abj247/SMGLib | Methods/NH-TTC/ext/eigen/bench/sparse_dense_product.cpp |
//g++ -O3 -g0 -DNDEBUG sparse_product.cpp -I.. -I/home/gael/Coding/LinearAlgebra/mtl4/ -DDENSITY=0.005 -DSIZE=10000 && ./a.out
//g++ -O3 -g0 -DNDEBUG sparse_product.cpp -I.. -I/home/gael/Coding/LinearAlgebra/mtl4/ -DDENSITY=0.05 -DSIZE=2000 && ./a.out
// -DNOGMM -DNOMTL -DCSPARSE
// -I /home/gael/Coding/LinearAlgebr... | ALGO | 0.99861 | 4.386344 |
32709737-9e66-4785-a452-972606d6ff8b | dhruv2311-dot/C-problem-solving | q8.cpp | // Online C++ compiler to run C++ program online
#include <iostream>
#include<string>
using namespace std;
double checkAvg(int arr[],int length){
int sum =0;
for(int i=0;i<length;i++){
sum+=arr[i];
}
double avg = static_cast<double>(sum)/length;
return avg;
}
int main(){
int arr[]={1,2,... | ALGO | 0.997658 | 4.667854 |
57f01840-2243-4eba-9971-7bb3aa75da63 | raincross7/code-similarity | codes/train_code/problem249/problem249_388.cpp | /* 十 聖イシドールスよ、迷えるプログラマを導き給え! 十 */
#include <iostream>
#include <vector>
#include <string>
#include <map>
#include <algorithm>
#include <cmath>
#include <deque>
#include <queue>
#define rep(i, n) for(int i = 0; i < n; i++)
//const long long INF = 1LL << 60;
const int INF = 1e9;
using ll = long long;
int main()
{
in... | ALGO | 0.999914 | 4.486037 |
4a1bace9-a280-4b4b-b06d-148aa5b692e9 | Ash0369/LeetCode | 739.cpp | class Solution
{
public:
vector<int> dailyTemperatures(vector<int>& temperatures)
{
int n=temperatures.size();
stack<pair<int,int>>st;
st.push({temperatures[0],0});
vector<int>ans(n,0);
for(int i=1;i<n;i++)
{
while(!st.empty() && temperatures[i]>st.t... | ALGO | 0.999987 | 6.280117 |
8e42d393-f7d7-4232-9558-344cb6019b5f | MaxSally/Competitive_Programming | UVA/laser sculpture.cpp | //https://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&category=609&page=show_problem&problem=2730
#include<bits/stdc++.h>
using namespace std;
#define left asdfghjkl
#define right sdfghjk
#define ll long long
#define db double
#define ngu cout <<"ngu" << endl;
#define io ios::sync_with_stdio(false);... | ALGO | 0.999711 | 3.608595 |
b94e1a76-dc51-4972-8562-78fb52e16b03 | theshobhitsingh/data_structures_and_algorithms | C++/ComplementofBase10Integer.cpp.cpp | #include<iostream>
using namespace std;
int main()
{
int n;
cout<<"Enter the number: ";
cin>>n;
if(n==0) //Edge Case
cout<<"1";
int m=n;
int mask=0;
while(m!=0)
{
mask=(mask<<1)|1;
m=m>>1;
}
int ans=(~n)&mask;
cout<<"The complement of the given number is:"<<ans;
}
| ALGO | 0.999972 | 4.67165 |
de7f4f22-4de3-4f2c-806c-a8b894cf3e0c | soujiro0725/programming-practices | C++/AIZU/HelloWorld/watch.cpp | #include <iostream>
//#include <array>
using namespace std;
char watch(int seconds) {
int minutes;
int hours;
hours = seconds / 3600;
minutes = (seconds - hours * 3600) / 60;
seconds = seconds % 60;
printf("%d:%d:%d", hours, minutes, seconds);
}
int main() {
watch(46979);
return 0;
}
| ALGO | 0.883711 | 5.436713 |
93ff1d2a-f40a-444b-8a7c-316e8efb4e16 | hunter-heidenreich/lammps_flare_etc | src/compute_temp_ramp.cpp | // clang-format off
#include "compute_temp_ramp.h"
#include <cstring>
#include "atom.h"
#include "update.h"
#include "force.h"
#include "group.h"
#include "domain.h"
#include "lattice.h"
#include "memory.h"
#include "error.h"
using namespace LAMMPS_NS;
/* ------------------------------------------------------------... | TOOL | 0.950528 | 7.531763 |
8b6b3e6b-3891-4dce-9743-5f36922b88b2 | ndamtruong2k/AI-Caro-Using-Heuristic | caro_game.cpp | #include <iostream>
#include <windows.h>
#include <conio.h>
#include <stdlib.h> /* srand, rand */
#include <time.h> /* time */
#include <unistd.h> // sleep function
#include "config.h"
#include "botbaseline.h"
using namespace std;
int board_game[HEIGHT][WIDTH];
Point win_path[5];
void init_board_game();
v... | TOOL | 0.949739 | 3.320796 |
d88afcfc-3b64-47a5-b847-e8849a7e56fc | 2019Shun/AtCoder | ABC/121_140/122/d.cpp | #include <bits/stdc++.h>
#include <vector>
#include <numeric>
#define PI 3.14159265358979323846
#define MAXINF 1e18L
#define INF 1e9L
#define EPS 1e-9
#define REP(i, n) for(int i=0;i<int(n);++i)
#define Rep(i,sta,n) for(int i=sta;i<n;i++)
#define RREP(i, n) for(int i=int(n)-1;i>=0;--i)
#define ALL(v) v.begin(),v.end()
... | ALGO | 0.999941 | 4.717649 |
d9792692-9127-4ac9-92e0-0cfab90310b2 | Akash-Ingle/DSA_in_CPP | Queue/K_Queues.cpp | #include <iostream>
using namespace std;
class kQueue{
public:
int n;
int k;
int* front;
int* rear;
int* arr;
int freeSpot;
int* next;
kQueue(int n, int k){
this->n=n;
this->k=k;
front=new int[k];
rear=n... | ALGO | 0.999574 | 4.446675 |
a10f94d8-b916-4b9f-a300-df2e066bddda | RachitJain-Learner/DSA-Practice | 117-populating-next-right-pointers-in-each-node-ii/117-populating-next-right-pointers-in-each-node-ii.cpp | /*
// Definition for a Node.
class Node {
public:
int val;
Node* left;
Node* right;
Node* next;
Node() : val(0), left(NULL), right(NULL), next(NULL) {}
Node(int _val) : val(_val), left(NULL), right(NULL), next(NULL) {}
Node(int _val, Node* _left, Node* _right, Node* _next)
: val(_... | ALGO | 0.999865 | 5.607368 |
3f1ad888-30ba-4318-8c50-d3b27d498cf4 | nkp1729/CarND-Path-Planning | src/Eigen-3.3/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.999775 | 4.228817 |
c742df3c-a2d3-4e47-b79b-6e676d545842 | a12dongithub/Data-Structure-LAB-DTU | problem.cpp | #include<stdio.h>
#define size 3
struct Queue
{
int A[size];
int front;
int rear;
};
typedef struct Queue myQueue;
int isEmpty(myQueue *q)
{
if(q->front==q->rear)
{
return(1);
}
return(0);
}
int isFull(myQueue *q)
{
if((q->rear+1)%size==q->front)
{
return(1);
}
... | ALGO | 0.999406 | 3.85897 |
ebcbc675-fd53-4454-b122-f69447f39903 | Kyogre223/Competitive-programming_practice_set | CodeForces/Contest/Round 913 (Div3)/C.cpp | #include <bits/stdc++.h>
using namespace std;
using p = pair<int, char>; // Change to pair
using ll = long long;
ll t;
ll n;
void test() {
string st;
cin >> n;
cin >> st;
vector<int>c(26, 0);
for (char ch: st) {
// cout << ch << '\n';
// cout << ch - '0' << '\n';
++c[ch - '... | ALGO | 0.999885 | 4.750674 |
6ef58670-eb01-42f4-b909-ac137252065c | CryptoXploit/WifSolverCuda | WifSolverCudaLinux/lib/util.cpp | #include <cstring>
#include <cstdio>
#include <cstdlib>
#include <vector>
#include "util.h"
#include "hash/sha256.h"
#include "base58.h"
char* ltrim(char* str, const char* seps) {
size_t totrim;
if (seps == NULL) {
seps = "\t\n\v\f\r ";
}
totrim = strspn(str, seps);
if (totrim > 0) {
size_t len = strlen(str)... | TOOL | 0.909859 | 5.100045 |
0eaf4d8a-a423-4d1d-b0cd-340d0c7fcfa3 | gosha22397/Astar_2k_algo | Src/config.cpp | #include "config.h"
#include "gl_const.h"
#include "tinyxml2.h"
Config::Config()
{
LogParams = nullptr;
SearchParams = nullptr;
}
Config::~Config()
{
if (SearchParams) delete[] SearchParams;
if (LogParams) delete[] LogParams;
}
bool Config::getConfig(const char *FileName)
{
std::string value;
... | CONFIG | 0.916422 | 5.414556 |
8053ff44-5041-4fa0-a3bb-0f9d78312712 | Neeraj-Bhandari44/DAA | week 7/bellman_ford.cpp | #include <iostream>
#include <bits/stdc++.h>
using namespace std;
void BellmanFord(int graph[][3], int V, int E, int src) {
int dis[V];
for (int i = 0; i < V; i++)
dis[i] = INT_MAX;
dis[src] = 0;
for (int i = 0; i < V - 1; i++) {
for (int j = 0; j < E; j++) {
if (dis[graph[j][0]] != INT_MAX && dis[graph[j][0... | ALGO | 0.9998 | 3.660559 |
e8ea7201-52bb-43d0-9bcb-c7f35e7b111e | drew-bozarth/interterm2021-c- | Problemfirecapacity.cpp | /* Drew Bozarth
2373658
<EMAIL>
CPSC 298-07
Assignment 1 - firecapacity */
#include <iostream>
using namespace std;
int main() {
int maxcap;
int numPeople;
int morePeople;
int lessPeople;
cout << "Please enter the Maximum Room Capacity";
cout << endl;
cin >> maxcap;
cout << "Please enter the numbe... | TOOL | 0.970911 | 4.604112 |
d02bd888-5c36-4003-9b40-459a80998a60 | DanielAngelo2024/CPlusPlus-Exercises | Lista6/ex05/main.cpp | #include <iostream>
#include <locale.h>
using namespace std;
/*
Maria depositou R$ 15.800,00 em sua conta de aplicaes, enquanto Joo, no mesmo dia, depositou
11.000,00 na dele. Sabe-se que Maria ganha R$ 100,00 de juros por ms e Joo ganha R$ 200,00. Faa
um programa, em C++, que calcule e imprima quantos anos sero neces... | ALGO | 0.957081 | 3.670908 |
6ae55941-1e72-4e46-b5f3-27cd013e42d5 | vitalykov/yandex-training | week2/c.cpp | #include <iostream>
#include <vector>
#include <limits>
#define DEFAULT std::numeric_limits<int>::min()
struct SegmentTreeNode {
int value;
int index;
};
int ClosestPower2(int a) {
--a;
a |= a >> 1;
a |= a >> 2;
a |= a >> 4;
a |= a >> 8;
a |= a >> 16;
++a;
return a;
}
void B... | ALGO | 0.999986 | 5.374401 |
1d81141a-9dea-47b4-8d15-d24b86c9761c | simonides/4wins | vs/sfml/sfml/GameSimulator.cpp | #include "GameSimulator.h"
#include "Meeple.h"
#include "MeepleBag.h"
#include "Board.h"
#include "I_Player.h"
#include "config.h"
#include <assert.h>
#include <string>
#include <iostream>
GameSimulator::GameSimulator(I_Player& player1, I_Player& player2) : board(new Board()){
assert(&player1 != &player2); //he... | ALGO | 0.994267 | 4.227508 |
3872e0f2-2401-4257-93fb-e56f17321992 | Prince-Mendiratta/CPP-CN | 5/10.1.cpp | #include <iostream>
using namespace std;
int main(){
int n;
cout<<"Enter the number of rows.";
cin>>n;
for(int i = 0; i < n; i++){
for(int j = 0; j < i+1; j++){
char s = 'A' + i;
cout<<s;
}
cout<<"\n";
}
return 0;
} | ALGO | 0.996678 | 3.814025 |
d4fa2cf6-fafe-4b5b-8351-6253b83a3d8c | ishandutta2007/codeforces | laycurse/normal/1467/D.cpp | #pragma GCC optimize ("Ofast")
#include<bits/stdc++.h>
using namespace std;
#define MD (1000000007U)
struct Modint{
unsigned val;
Modint(){
val=0;
}
Modint(int a){
val = ord(a);
}
Modint(unsigned a){
val = ord(a);
}
Modint(long long a){
val = ord(a);
}
Modint(unsigned long long a){
... | ALGO | 0.999713 | 3.925435 |
d592714a-fe6c-4cfe-bbcc-cd5cba60647c | bikashadhikari1508/Basics_of_C_Cpp | MaxOfTwoNum_b.cpp | #include<iostream>
using namespace std;
int main()
{
int x=10;
int y =5;
cout<<max(x,y)<<endl; //max() is a function
return 0;
}
| TOOL | 0.9973 | 4.5063 |
4f9f1fcf-9a7e-4dd2-9a4d-cca439f0533d | adhamkhaled312/ASUFE-CPC-LEVEL1-Training | Week 2 sheet/M-EbonyAndIvory.cpp | //https://codeforces.com/problemset/problem/633/A
#include <iostream>
using namespace std;
int main(){
int a,b,c,flag=0;
cin>>a>>b>>c;
for(int i=0;i<=c/a;i++){
for(int j=0;j<=c/b;j++){
if(i*a+j*b==c){
flag=1;
break;
}
}
}
if(flag==1){cout<<"Yes";}
else{cout<<"No";}
}
| ALGO | 0.999982 | 4.12728 |
3366b113-f3c0-43e4-af37-16d00a785d12 | SiyangShao/codes | codeforces/2021/R757/C.cpp | #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const ll mod = 1e9 + 7;
ll qpow(ll a, ll b) {
ll res = 1;
while (b) {
if (b & 1) {
res = (res * a) % mod;
}
a = (a * a) % mod;
b >>= 1;
}
return res;
}
int main() {
ios::sync_with_stdio(false);
cin.tie(0), cout.tie(0);
ll t;
cin >> t... | ALGO | 0.999802 | 3.814544 |
bdb5fc41-d4f6-4b21-8937-a0b83884f24c | sky7658/Acmipc | 프로그래머스/lv3/12920. 선입 선출 스케줄링/선입 선출 스케줄링.cpp | #include <string>
#include <vector>
#include <algorithm>
#include <iostream>
using namespace std;
int solution(int n, vector<int> cores) {
int answer = 0;
int s, e, m;
s = -1, e = 2e5;
while(s + 1 < e) {
int work = 0;
m = (s + e) / 2;
if(m > 0) for(int i = 0; i < cores.size(... | ALGO | 0.999947 | 4.564151 |
bc105133-6263-4fc0-9f14-505ce1a2e570 | HaomingMei/Personal_Projects | Leetcode/Car-Fleet.cpp | class Solution {
public:
int carFleet(int target, vector<int>& position, vector<int>& speed) {
int n = position.size();
// Number of Fleet we have by default is equal the number of cars
std::priority_queue<std::pair<int, int>> cars;
for(int i = 0; i<n; i++)
{
cars... | ALGO | 0.999432 | 5.910954 |
d7d6aa75-c478-431f-a5c0-26731e0ed57c | sanketdisale871/DSA | Recursion/22_10PhoneKeypad.cpp | //{ Driver Code Starts
//Initial Template for C++
#include <bits/stdc++.h>
#include <string>
using namespace std;
// } Driver Code Ends
//User function Template for C++
class Solution
{
public:
vector<string>ans;
void solve(int index,int a[],int n,string &temp,unordered_map<int,string> &um){
... | ALGO | 0.999839 | 6.427973 |
d5f561ff-f4f9-4a03-999a-3ebfc6af040b | anorouzi/sector | sector-sphere/tags/release-2.1/examples/funcs/mr_sort.cpp | #include <sys/time.h>
#include <unistd.h>
#include <iostream>
#include <stdint.h>
#include <sphere.h>
using namespace std;
extern "C"
{
// use extern "C" to let g++ use the C style function naming
// otherwise the function would not be located in the dynamic library
struct Key
{
uint32_t v1;
uint32_t v2;
ui... | ALGO | 0.998453 | 3.674172 |
a489f11b-3318-435c-80c5-e9c367d4492e | amalbekd/ADS_22B030510 | Lab5/5.cpp | #include <iostream>
using namespace std;
struct Heap {
int* arr;
int capacity;
int length;
void _add(int val) {
arr[length] = val;
length++;
heap_up(length - 1);
}
void heap_up(int i) {
if(i > 0) {
int p_pos = (i - 1) / 2;
if(arr[p_pos]... | ALGO | 0.9992 | 4.535696 |
ddfcd621-8d56-4f89-bbf1-537f68fac44b | nayemuddinn/Competitive-programming | Codeforces/Getting Points 1902B.cpp | /**
.
author-> NATE
.
**/
#include<bits/stdc++.h>
using namespace std;
#define first_in_out ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define For(i,n) for(ll i=0;i<n;i++)
#define For2(i,n) for(ll i=1;i<=n;i++)
#define For3(i, j, n) for (ll j = i; j <= n; j++)
#def... | ALGO | 0.999758 | 3.636142 |
dc1b5adf-e3b2-44f7-998b-29b8c1b35701 | BonhyeonGu/BOJ | BOJ_2751_수 정렬하기 2.cpp | #define _CRT_SECURE_NO_WARNINGS
#include <iostream>
using namespace std;
struct splitPoint
{
splitPoint* front;
splitPoint* left;
splitPoint* right;
int headIndex;
int rearIndex;
};
int dataArray[1000001], tmpdataArray[1000001];
void Func(int size, splitPoint* frontSplitPoint, char flag)
{
splitPoint* newSplit... | ALGO | 0.999978 | 3.157989 |
6ec3da1a-dac5-465e-b247-b055a0c54982 | misals/SdeSheetChallenge | Day_3/Search a 2D Matrix.cpp | class Solution {
public:
bool searchMatrix(vector<vector<int>>& matrix, int target) {
if(matrix.size() == 0)
return false;
int n = matrix.size();
int m = matrix[0].size();
int l = 0;
int h = (n * m) - 1;
while(l <= h) {
int mi... | ALGO | 0.9999 | 6.275088 |
7e7ac290-8077-4b84-8eb9-cc44c201c3eb | lanl/Fierro | src/Parallel-Solvers/Parallel-Explicit/Dynamic_Elastic_Solver/force_gradients_elastic.cpp | #include "mesh.h"
#include "state.h"
#include <iostream>
#include <string>
#include <sstream>
#include <stdio.h>
#include <stdlib.h>
#include <math.h> // fmin, fmax, abs note: fminl is long
#include <Teuchos_ScalarTraits.hpp>
#include <Teuchos_RCP.hpp>
#include <Tpetra_Core.hpp>
#include <Tpetra_Map.hpp>
#include <Tp... | ALGO | 0.999125 | 4.606478 |
dd1cd374-4337-4624-a1c8-6f93f1c9cc82 | Coach-Academy/Summer-2-2024 | Level 1/CPU - Standard - L1 - C106/Practice G3/Week 03/J.cpp | #include <bits/stdc++.h>
using namespace std ;
int main(){
int n , x , g1 = 0 , g2 = 0 , g3 = 0 , g4 = 0;
cin >> n ;
for(int i=0 ; i<n ; ++i){
cin >> x ;
if(x==1) g1++ ;
if(x==2) g2++ ;
if(x==3) g3++ ;
if(x==4) g4++ ;
}
int taxi = g4 ;
// if... | ALGO | 0.999892 | 4.130668 |
3908869b-125c-4d20-938d-c4f4b651a336 | dhairyapandya05/DSA-Supreme-Batch | Recursion_ClassIV_15th March 2023/Maximum_sum_of_non_adjacent_elements.cpp | #include<iostream>
#include<vector>
using namespace std;
void solve(vector<int>&arr,int sum,int& maxi,int i){
// Base Case
if(i>=arr.size()){
maxi = max(sum,maxi);
return;
}
// include
solve(arr,sum+arr[i],maxi,i+2);
// exclude
solve(arr,sum,maxi,i+1);
}
int main(){
vecto... | ALGO | 0.999973 | 4.456236 |
cd4b0cae-bcd9-4280-9994-e5a64f1aea4d | oxygen-hunter/Flashboom | data/big-vul-100/add_attention_code/Phi/top0-100/maximum-deletions-on-a-string-Solution3.deleteString/177909_DoS_Exec_Code_Overflow.cpp | void Splash::scaleMaskYdXu(SplashImageMaskSource src, void *srcData,
int srcWidth, int srcHeight,
int scaledWidth, int scaledHeight,
SplashBitmap *dest) {
Guchar *lineBuf;
Guint *pixBuf;
Guint pix;
Guchar *destPtr;
int yp, yq, xp, xq, yt, y, yStep, xt, x, xStep, d;
int i, j;
yp = s... | ALGO | 0.99169 | 3.888859 |
3e254d40-70b4-41f3-b9ba-be8207017aef | ishandutta2007/codeforces | danya.smelskiy/normal/447/B.cpp | #include <bits/stdc++.h>
using namespace std;
string s;
long long mx,ans;
long long a[30];
int k;
int main(){
ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
cin>>s;
cin>>k;
for (int i=0;i<26;++i) {
cin>>a[i];
mx=max(mx,a[i]);
}
for (int i=0;i<s.size();++i)
an... | ALGO | 0.999954 | 3.560828 |
7b6ac27a-1b8f-4186-9116-9eea5da51ac0 | raincross7/code-similarity | codes/train_code/problem463/problem463_197.cpp | #include<iostream>
#include<string>
#include<vector>
#include<cctype>
int main(void) {
std::string InputS, InputP;
std::cin >> InputS >> InputP;
bool Answer = false;
int count = 0;
while (count < InputS.size()) {
if (InputS[count] == InputP[0]) {
bool flag = false;
for (int i = 0; i < InputP.size(); ++i) {... | ALGO | 0.999986 | 3.768511 |
3788656e-0f99-41f7-a8c9-2b9b5d5a3fa2 | redrabbit329/copy-vitis-tutorials | docs-jp/docs/bloom/design/reference_files/baseline_fpga/compute_score_fpga.cpp | #include<iostream>
#include<ctime>
#include<utility>
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include"sizes.h"
#include"MurmurHash2.c"
const unsigned int bloom_filter_size = 1<<bloom_size;
extern "C"
{
void runOnfpga (unsigned int* doc_sizes,unsigned int* input_doc_words,unsigned int* bloom_filter,unsi... | ALGO | 0.997341 | 5.223654 |
7e5fd19f-3a0a-4a5b-8a77-e3604f5dfd8d | amrharb/leetcode | 611-valid-triangle-number/611-valid-triangle-number.cpp | class Solution
{
public:
int triangleNumber(vector<int>& v)
{
int n=v.size(),cnt=0;
sort(v.begin(),v.end());
for(int i=0; i<n-2; i++)
{
int k=i+2;
for(int j=i+1; j<n-1&&v[i]; j++)
{
while(k<v.size()&&v[i]+v[j]>v[k])k++;
... | ALGO | 0.99999 | 5.593924 |
de152f42-d75d-4608-a817-efc9e46e43cd | bansal-samarth/Daily-Dose-Of-DSA | Difficulty: Medium/Longest Subarray with Majority Greater than K/longest-subarray-with-majority-greater-than-k.cpp | //{ Driver Code Starts
#include <bits/stdc++.h>
using namespace std;
// } Driver Code Ends
// User function Template for C++
class Solution {
public:
int longestSubarray(vector<int>& arr, int k) {
int c = 0, ans = 0;
unordered_map<int, int> m;
for (int i = 0; i < arr.size(); i++) {
... | ALGO | 0.998249 | 5.953697 |
cbc918ba-eec8-41b6-8e74-036af8613424 | mateor/pdroid | android-2.3.4_r1/tags/1.2/frameworks/base/media/libstagefright/codecs/amrnb/common/src/int_lpc.cpp | /*
Pathname: ./audio/gsm-amr/c/src/int_lpc.c
Functions:
------------------------------------------------------------------------------
REVISION HISTORY
Description: Updated template used to PV coding template.
Changed to accept the pOverflow flag for EPOC compatibility.
Description: Per review comments, replac... | ALGO | 0.988926 | 6.3164 |
a7b75aae-0e26-46d1-9f74-647b86a4fff4 | reunanen/boost-prebuilt-windows-binaries | libs/mpl/example/fsm/player2.cpp | #include <vector>
#include <ctime>
#include <iostream>
#if defined(BOOST_DINKUMWARE_STDLIB) && BOOST_DINKUMWARE_STDLIB < 310
namespace std { using ::clock_t; }
#endif
namespace mpl = boost::mpl;
using namespace mpl::placeholders;
// A metafunction that returns the Event associated with a transition.
template <class ... | ALGO | 0.90968 | 7.724843 |
b9152ee6-ce25-44dd-8ef4-6ace21270b3a | coconan/kata | createProperTree/createProperTree/createProperTree.cpp | #include <stdio.h>
struct TreeNode {
int value;
int left, right;
TreeNode(int v=1, int l=-1, int r=-1): value(v), left(l), right(r) {}
};
struct Tree {
TreeNode *allNodes;
int size;
};
Tree allProperTree[4000000];
int counter = 2, lastLevelLo=2, lastLevelHi=3;
void mergeTree(Tree &nextTree, const Tree &left, c... | ALGO | 0.999574 | 3.636679 |
75c09b59-f8dd-4dd6-94bb-f08de071c4d9 | behnejad/Online-Judge-Solutions | TJU/3843 - Intersection of sets.cpp | #include <cstdio>
#include <algorithm>
using namespace std;
int main(){
int n,m;
scanf("%d %d",&n,&m);
int a[n],b[m];
for(int i = 0;i < n;++i) scanf("%d",&a[i]);
for(int i = 0;i < m;++i) scanf("%d",&b[i]);
sort(a,a + n);
sort(b,b + m);
int sza = 1;
for(int ... | ALGO | 0.999912 | 3.070617 |
1543ae1f-c83c-4501-b861-7b10c46a45e6 | yellowHatpro/Codes-Practice | Codeforces/716A_CrazyComputer.cpp | #include <bits/stdc++.h>
using namespace std;
int main(){
int n;cin>>n;
int c;cin>>c;
int total=0;
int prev=0;
for (int i = 0; i < n; ++i)
{
int a;cin>>a;
if(i==0){
prev=a;
total++;
}
else if(a-prev<=c){
total++;
}
else{
total=1;
}
prev=a;
}
cout<<total;
cout<<endl;
return 0;
... | ALGO | 0.999925 | 3.138074 |
703d1b22-0bf1-49a9-b59b-6fecec4f0ece | AugustinBariant/Truncated_boomerangs | small-AES/parallel_sort.cpp | #include <stdint.h>
#include <stdlib.h>
#include <algorithm>
#include <array>
#ifdef CPP17_PARALLEL
#include <execution>
#else
#include <parallel/algorithm>
#endif
extern "C" {
typedef uint16_t word;
typedef std::array<word, 4> state;
typedef struct {
state c; // Ciphertext C
state p; // Plaintext \over... | ALGO | 0.999761 | 4.228109 |
f8ccd590-5248-4556-8f52-cfe80649ff32 | AnthonySimmons/QuicksortAssembly | 260/260/main.cpp | #include <iostream>
#include "stdlib.h"
using std::cin;
using std::cout;
using std::endl;
int A[] = {7,0,1,2,5,4,9,8,3,6};
int B[] = {42,44,742,8,39,32,1,6,85,3,8,42,21};
int C[] = {5,4,3,2,1};
void print(void)
{
for(int i = 0; i < 10; i++)
{
cout<<A[i]<<" ";
}
cout<<endl<<endl;
}
void swap(int *one, int *two)... | ALGO | 0.999887 | 3.967095 |
29fb5200-34c3-4e20-910a-5bed15c413b9 | coldEr66/online-judge | CF/560D.cpp | #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef double lf;
typedef pair<ll,ll> ii;
#define REP(i,n) for(int i=0;i<n;i++)
#define REP1(i,n) for(ll i=1;i<=n;i++)
#define FOR(i,j,n,m) for(int i=j;i<n;i+=m)
#define RST(i,n) memset(i,n,sizeof i)
#define SZ(a) (int)a.size()
#define ALL(a) a.begin(... | ALGO | 0.999991 | 3.360603 |
a922af84-b39a-4dd8-b029-c02bfb88a4b2 | theonewithfeet/leetcode | lc0051_n_queens.cpp | // https://leetcode.com/problems/n-queens/
class Solution {
bool canAddQueen(const vector<string>& b,int r,int c) {
for (int i=r-1, j=c-1, k=c+1; i>=0; i--, j--, k++)
if ((j >= 0 && b[i][j] == 'Q') || (k < b.size() && b[i][k] == 'Q') || b[i][c] == 'Q')
return false;
retu... | ALGO | 0.999853 | 6.250235 |
bb638827-e2e2-4b26-bd81-892e6ee58478 | patrickhao/PAT | advanced/1138.cpp | #include <iostream>
#include <algorithm>
#include <vector>
using namespace std;
const int maxn = 50010;
struct node {
int data;
node *lchild, *rchild;
};
int pre[maxn], in[maxn];
node* newNode(int data) {
node* Node = new node;
Node->data = data;
Node->lchild = Node->rchild = NULL;
return Node... | ALGO | 0.999998 | 3.986143 |
fd208254-cdf8-4dc9-8a29-9f24f5f16259 | hirakuuuu/kyopro | ABC/248/b.cpp | #include <bits/stdc++.h>
using namespace std;
#define rep(i, a, n) for(int i = a; i < n; i++)
#define ll long long
#define pii pair<int, int>
#define pll pair<ll, ll>
const int MOD = 1000000007;
const int mod = 998244353;
// 問題
// https://atcoder.jp/contests/abc248/tasks/abc248_b
int main(){
ll a, b, k; cin >> a ... | ALGO | 0.999939 | 4.112433 |
f038550e-b404-4193-8f61-2a043c38dabf | empower-network/empower | src/rpc/server.cpp | #include <rpc/server.h>
#include <fs.h>
#include <key_io.h>
#include <rpc/util.h>
#include <shutdown.h>
#include <sync.h>
#include <util/strencodings.h>
#include <util/system.h>
#include <boost/signals2/signal.hpp>
#include <boost/algorithm/string/classification.hpp>
#include <boost/algorithm/string/split.hpp>
#incl... | WEB | 0.935329 | 7.31901 |
24a199c2-30e9-42fd-8ab1-c5a4044a681d | r1407p/competitive-programing | codeforces_round/2023_07_06_Codeforces_Round_882(Div.2)/A.cpp | #include<bits/stdc++.h>
using namespace std;
//#define int long long
#define endl '\n'
#define eb emplace_back
#define pb push_back
#define ALL(X) X.begin(), X.end()
#define rALL(X) X.rbegin(), X.rend()
typedef long long loli;
typedef long double ld;
typedef pair<int,int> pii;
typedef pair<loli,loli> pll;
typedef pa... | ALGO | 0.999408 | 3.904576 |
6ce55a14-7ee3-489e-b53e-a65a418b35be | linchen1010/EE569-DIP | HW3/Gear.cpp | //EE569 Howework Assignment #3
//Date: February 23 , 2020
//Name: Shi-Lin Chen
//ID: 2991-9119-97
//Email: <EMAIL>
//Submission Date: March 3, 2020
//Compiled on MAC cmd with g++
// Usuage:
// >> g++ -std=c++11 Gear.cpp -o Gear
// >> ./Gear GearTooth.raw GearFinal.raw
/*---------------------------------------... | TOOL | 0.986766 | 3.612012 |
2a85e032-08ea-45c4-a3af-a009b47c1880 | subhm2004/Leetcode_Solutions | 3569-count-of-substrings-containing-every-vowel-and-k-consonants-ii/count-of-substrings-containing-every-vowel-and-k-consonants-ii.cpp | class Solution {
public:
// Function jo maximum k consonants tak valid substrings count karega
long count_Sub_strings_With_At_Most_K(const string& word, int k) {
if (k < 0) return 0; // Agar k negative hai toh koi valid substring nahi ho sakti
long ans = 0; // Substrings ka count store karega
... | ALGO | 0.999958 | 6.383496 |
80051a6d-49bb-4fb4-81c7-5da673457e6e | tayyaba-mustafa/Leetcode-Problems | 1635-number-of-good-pairs/1635-number-of-good-pairs.cpp | class Solution {
public:
int numIdenticalPairs(vector<int>& nums) {
int n=nums.size() , count=0;
vector<int> freq(101,0);
for(int i=0;i<n;i++){
freq[nums[i]]++;
}
for(int i=1;i<=100;i++){
count=count + (freq[i]-1)*freq[i]/2;
}
return count;
}
}; | ALGO | 0.99993 | 5.676268 |
2b28e0ee-1cec-42e1-b53b-08a9534cd6ff | Vzenun/Codeforces-Problems-Solutions | 1352D_Alice,Bob_and_Candies.cpp | // Vidur Goel
//Codeforcees Handle: Vidurcodviz
#include<iostream>
#include<string>
#include<cmath>
#include<climits>
#include<algorithm>
#include<cstddef>
#include<cstdio>
#include<cstdlib>
#include<vector>
#include<stack>
#include<chrono>
#include<random>
#include<cassert>
#include<array>
#include<bitset>
#include<... | ALGO | 0.999665 | 3.854342 |
b6d70dc3-54af-4a26-ac6b-6a0e450c2357 | jagdishpatil21/dsa | P7 MST (offices min cost).cpp | #include <iostream>
#include <limits.h>
using namespace std;
class Office {
int n;
int adjacent[10][10];
string office[10];
public:
void input ();
void display ();
void Prims ();
};
void Office::input () {
cout << "\nEnter no. of offices: ";
cin >> n;
cout << "\nEnter the names of... | ALGO | 0.999181 | 5.96042 |
867766b3-7c0c-4bcb-b4db-796b4bbdd42a | NicholasTerek/oneAPI- | parallel_processing.cpp | // parallel_processing.cpp
#include <CL/sycl.hpp>
#include <iostream>
#include <vector>
#include <numeric>
using namespace sycl;
int main() {
constexpr size_t data_size = 1024;
std::vector<float> bacteria_count(data_size, 0.0f);
std::vector<float> virus_rna_level(data_size, 0.0f);
// Populate sample ... | ALGO | 0.99626 | 6.683863 |
b81a6119-be99-47ad-955e-3302f1042b00 | St0wy/build_system_tests | stowy_physics_engine/src/dynamics/Solver.cpp | #include "dynamics/Solver.hpp"
#include "collision/Collision.hpp"
#include "dynamics/Rigidbody.hpp"
namespace stw
{
void ImpulseSolver::Solve(const std::vector<Collision>& collisions, float deltaTime)
{
for (const auto& [bodyA, bodyB, manifold] : collisions)
{
// ReSharper disable CppCStyleCast
Rigidbody* aBod... | ALGO | 0.998507 | 6.782534 |
423a9ee1-5bbb-414d-bbcd-744c13ec0522 | Soraakash/Coding | Sorting Techniques/InsertionSort.cpp | // Code for Insertion Sort
// Time Complexity O(n*n)
// Space Complexity O(1)
#include<iostream>
#include<bits/stdc++.h>
using namespace std;
void printArray(vector<int> &nums)
{
for(auto x:nums)
cout<<x<<" ";
cout<<endl;
}
void InsertionSort(vector<int> &nums)
{
int n = nums.size();
for(int ... | ALGO | 0.999974 | 5.610377 |
b1ed93dc-c4fb-4cbb-9282-7fad7442a149 | vaishalipandey-11/DSA | Linked LIst/382. Linked List Random Node.cpp | #include<bits/stdc++.h>
using namespace std;
#include<iostream>
struct ListNode {
int val;
ListNode *next;
ListNode(int x) : val(x), next(NULL) {}
};
class Solution {
public:
vector<int>v;
Solution(ListNode* head) {
ListNode * temp = head ;
while(temp){
v.push_b... | ALGO | 0.9997 | 4.554156 |
f89f03a3-30af-46b0-920e-0254ef325ca8 | devyanigoil/CPP | Trees/BST.cpp | #include "BinaryTree.cpp"
class BST
{
BinaryTree<int>* root;
public:
BST()
{
root=NULL;
}
~BST()
{
delete root;
}
private:
bool hasDataPri(int data,BinaryTree<int>* node)
{
if(node==NULL)
return false;
if(node->data==data)
return true;
else if(data<root->data)
return hasDataPri(data,nod... | ALGO | 0.998843 | 3.868677 |
1952ce0e-a6e5-4bfb-a961-8c63d23dcc25 | GlodonOpenSrc/Qt4.8.5_Glodon | src/corelib/tools/qstringlist.cpp | #include <qstringlist.h>
#include <qset.h>
QT_BEGIN_NAMESPACE
/*! \typedef QStringListIterator
\relates QStringList
The QStringListIterator type definition provides a Java-style const
iterator for QStringList.
QStringList provides both \l{Java-style iterators} and
\l{STL-style iterators}. The Ja... | TOOL | 0.867897 | 6.705472 |
988f41f7-61ae-4e25-bd6c-39790941ed64 | Prateek-agrawal04/DSA_Basic | C++/sum.cpp | // Online C++ compiler to run C++ program online
#include <iostream>
using namespace std;
int main() {
// Write C++ code here
int n;
cin>>n;
int sum=0;
int i=1;
while(i!=n+1){
sum+=i;
i++;
}
cout<<sum;
return 0;
} | ALGO | 0.999694 | 4.442629 |
1fb7c2a6-c652-457a-823f-8e7f7e856100 | BigAlsCode/Code-Wars-Solutions | C++/5Kyu/gap_in_prime.cpp | /*
The prime numbers are not regularly spaced. For example from 2 to 3 the gap is 1.
From 3 to 5 the gap is 2. From 7 to 11 it is 4. Between 2 and 50 we have the
following pairs of 2-gaps primes: 3-5, 5-7, 11-13, 17-19, 29-31, 41-43
A prime gap of length n is a run of n-1 consecutive composite numbers between two
succ... | ALGO | 0.997896 | 5.416769 |
bb251ac9-9818-4dca-93b6-c68481e1442c | dilip43/DSA--CODE | 11. Binary_Search_Tree/Construct_BST_From_PreOrder-Traversal.cpp | Node* consturctTreeUtil(int pre[], int* preIndex, int key, int min, int max, int size) {
if (*preIndex >= size)
return NULL;
Node* root = NULL;
if (key > min && key < max) {
root = newNode(key);
*preIndex = *preIndex + 1;
if (*preIndex < size) {
root->left = consturctTreeUtil(pre, preIndex, pre[*preInd... | ALGO | 0.999953 | 5.451376 |
ffc85bb9-c533-42f5-b100-994dfdac2620 | disillusion028/MyLeetCode | 367.Valid Perfect Square/367_1.cpp | class Solution {
public:
bool isPerfectSquare(int num) {
// write your code here
int i = 1;
while (num > 0) {
num -= i;
i += 2;
}
return num == 0;
}
};// a perfect square = 1+3+5+7+...
| ALGO | 0.999893 | 5.181387 |
4438422e-b4d3-4511-8c11-9ccc9a512fb5 | costadev00/neps_academy | F_-_Lista_de_Chamada.cpp | #include <bits/stdc++.h>
#define fastio \
ios_base::sync_with_stdio(false); \
cin.tie(NULL)
using namespace std;
typedef long long ll;
typedef long double ld;
#define endl "\n"
#define debug(args...) cout << (#args) << " = " << (args) << endl
#define MOD 1000000007
#define vi vector<in... | ALGO | 0.999925 | 4.32348 |
2602e4f5-6ad7-4bd9-9248-079cc6866781 | razvanperial/codeforces_problems | stone_game/main.cpp | #include <bits/stdc++.h>
using namespace std;
int t,n,i,pozmin,pozmax,ans=0,x,difmax;
int main()
{
cin>>t;
while(t--){
ans=0;
cin>>n;
for(i=1;i<=n;i++){
cin>>x;
if(x==1)
pozmin=i;
if(x==n)
pozmax=i;
}
if... | ALGO | 0.99974 | 4.367383 |
a90cacd5-5451-473f-904f-6ca596b8b3b6 | ferreiraluisa/URI | C++/iniciante/1080.cpp | #include <iostream>
using namespace std;
int main(){
int n[100];
int maior=0,posicao=0;
for(int i=0;i<100;i++){
cin>>n[i];
if(n[i]>maior){
maior = n[i];
posicao = i+1;
}
}
cout<<maior<<endl;
cout<<posicao<<endl;
return 0;
}
| ALGO | 0.999935 | 4.226226 |
bd39b3c0-e32e-48a2-b9ec-d66f060e72b5 | paul-akl/Praxis3D | Dependencies/include/bullet3/BulletCollision/Gimpact/btTriangleShapeEx.cpp | /*! \file btGImpactTriangleShape.h
\author Francisco Leon Najera
*/
#include "btTriangleShapeEx.h"
void GIM_TRIANGLE_CONTACT::merge_points(const btVector4& plane,
btScalar margin, const btVector3* points, int point_count)
{
m_point_count = 0;
m_penetration_depth = -1000.0f;
int point_indices[MAX_TRI_CLI... | ALGO | 0.998917 | 6.647275 |
56ef5d3b-5478-4808-b5b5-06edc12f1440 | mezaisrael/Wallbreakers-coding-challenges | week2/findAnagrams/main.cpp |
/*
Given a string s and a non-empty string p, find all the start indices of p's anagrams in s.
Strings consists of lowercase English letters only and the length of both strings s and p will not be larger than 20,100.
The order of output does not matter. */
#include <iostream>
#include <vector>
#include <algorithm... | ALGO | 0.999915 | 6.108295 |
1580ff93-f715-41ae-94f6-90bd41942205 | ishandutta2007/codeforces | waterfalls/normal/493/E.cpp | #include <cstdio>
#include <cmath>
using namespace std;
long long t,a,b;
int main() {
scanf("%I64d%I64d%I64d",&t,&a,&b);
if (t>a && a!=b || b<a) printf("0\n");
else if (t==1) {
if (a==b) {
if (a==1) printf("inf\n");
else printf("1\n");
} else if (a==1) printf("0\n"... | ALGO | 0.99995 | 3.591962 |
604d26c5-e271-406e-827a-423081c4e1f7 | chyhhwen/image-recognition-java | opencv/sources/samples/cpp/tutorial_code/calib3d/real_time_pose_estimation/src/main_detection.cpp | // C++
#include <iostream>
#include <time.h>
// OpenCV
#include <opencv2/core/core.hpp>
#include <opencv2/core/utility.hpp>
#include <opencv2/highgui/highgui.hpp>
#include <opencv2/imgproc/imgproc.hpp>
#include <opencv2/calib3d/calib3d.hpp>
#include <opencv2/video/tracking.hpp>
// PnP Tutorial
#include "Mesh.h"
#includ... | ALGO | 0.992858 | 6.889101 |
6265af6d-2013-4413-b5a4-036808562597 | redcpp/Competitive-Programming | codeforces/884A.cpp | #include <bits/stdc++.h>
#include <ext/pb_ds/tree_policy.hpp>
#include <ext/pb_ds/assoc_container.hpp>
using namespace std;
using namespace __gnu_pbds;
typedef long long ll;
typedef pair<int,int> pii;
template <class T> using Tree = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
#define... | ALGO | 0.99978 | 3.835745 |
903bbc04-5b0c-403a-9d72-27a2ff1bd348 | ZhenyingZhu/ClassicAlgorithms | src/CPP/src/leetcode/LetterCombinationsOfAPhoneNumber.cpp | /*
* [Source] https://leetcode.com/problems/letter-combinations-of-a-phone-number/
* [Difficulty]: Medium
* [Tag]: Backtracking
* [Tag]: String
*/
#include <iostream>
#include <vector>
#include <string>
using namespace std;
// [Solution]: Use an char array. In a recursive function, each time replace the last ch... | ALGO | 0.999578 | 7.037515 |
2402b507-d93a-4889-aed7-aa4eee613e49 | cluley/Rabin_Karp | rabin_karp.cpp | #include "rabin_karp.h"
int find_substring_light_rabin_karp(string str, string sub_str) {
int nSize = str.length();
int kSize = sub_str.length();
for (int n = 0; n < nSize; n++) {
if (str[n] == sub_str[0]) {
for (int k = 0; k < kSize; k++) {
if (str[n + k] != sub_str[k]) break;
if (k... | ALGO | 0.999261 | 4.633222 |
39eb34a8-06c4-4e72-8908-52ea64449563 | SharafatKarim/problem-sloving | codeforces/Assiut University Training - Newcomers/Sheet #2 (Loops)/X. Convert To Decimal 2.cpp | #include <iostream>
using namespace std;
// long long int convertToDecimal(long double n)
// {
// long double decimal = 0;
// long double base = 1;
// while (n > 0)
// {
// decimal += (int(n)%10) * base;
// n /= 10;
// base *= 2;
// }
// return decimal;
// }
// long lon... | ALGO | 0.999945 | 4.850506 |
e6eb70df-7769-4c49-9f2d-1067b41921bc | aryanbhatt1/Algorithms | Divide&Conquer/maxSubArray.cpp | //used Kadane's Algorithm
#include <iostream>
using namespace std;
void maxSubArray(int arr[], int n){
int max_so_far= INT_MIN, max_ending_here=0;
for(int i=0; i<n; i++){
max_ending_here = max_ending_here + arr[i];
if(max_so_far < max_ending_here)
max_so_far = max_ending_here;
... | ALGO | 0.99994 | 4.705815 |
86321124-32b4-4ed5-823c-ee22fdb4c505 | GCMango/ps-codes | Codeforces/1539/A.cpp | #include <bits/stdc++.h>
#define x first
#define y second
#define pb push_back
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
void solve() {
ll N, x, t; cin >> N >> x >> t;
ll r = (... | ALGO | 0.999938 | 4.509372 |
e441d0b8-3d56-461e-86b3-82dd9cd23581 | pranavjawale01/cp.exe | CodeForces/1692-E-Binary Deque/1692-E-Binary Deque.cpp | #include<bits/stdc++.h>
using namespace std;
#define ll long long
#define ld long double
#define ull unsigned long long
#define vi vector<int>
#define vll vector<long long>
#define pii pair<int, int>
#define pll pair<long long, long long>
#define all(x) x.begin(), x.end()
#define pb push_back
#define ff first
#define ... | ALGO | 0.99985 | 4.550221 |
d95efa83-cf92-437d-9c66-aa41203b8d7c | liuxi93ing/My-Leetcode | 111_Minimum Depth of Binary Tree/Main.cpp | #include <iostream>
#include "Solution.h"
using namespace std;
int main()
{
Solution s;
int pre_a[] = {1,2,3,5,6,4,2,4,3,6,5};
int in_a[] = {5,3,6,2,4,1,4,2,6,3,5};
int len_a = sizeof(pre_a)/sizeof(pre_a[0]);
TreeNode* root_a = create_Tree(pre_a,in_a,len_a);
pre_order_print(root_a);
cout... | ALGO | 0.999882 | 5.598768 |
43e496fd-d844-469c-bb13-8af0cfd16c86 | ohmlim123/3program---week4-4- | 3program---week4(4)/Source.cpp | #include<stdio.h>
int main()
{
int i, j, N;
scanf_s("%d", &N);
for (i = 1;i <= N;i++)
{
for (j = 1;j <= N;j++)
{
if (i == 1 || i == N || j == 1 || j == N)
{
printf("*");
}
else if (i == j || N - i == j - 1)
{
printf("*");
}
else
{
printf(" ");
}
}
printf("\n");
}
ret... | ALGO | 0.999943 | 3.126702 |
37f1b177-d786-4381-8af8-21e7e7cec8b0 | marcustw/leetcode | sort-list/sort-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 {
ListNode* getMid(ListNode* he... | ALGO | 0.999993 | 5.717234 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.