uuid stringlengths 36 36 | repo_name stringlengths 5 123 | relative_path stringlengths 5 4k | content stringlengths 33 2.85M | category stringclasses 6
values | algo_rel_score float64 0.85 1 | quality_score float64 3 8.76 |
|---|---|---|---|---|---|---|
7dcf9f88-f960-4fc5-808b-09276ba9036b | sarthak815/ProblemSolving-Hackerrank | Algorithm-Problems/Cavity_Map.cpp | #include <bits/stdc++.h>
using namespace std;
string ltrim(const string &);
string rtrim(const string &);
/*
* Complete the 'cavityMap' function below.
*
* The function is expected to return a STRING_ARRAY.
* The function accepts STRING_ARRAY grid as parameter.
*/
vector<string> cavityMap(vector<string> grid) ... | ALGO | 0.999963 | 4.782441 |
cb9b942f-c1d8-4247-ba17-0d9c716b8327 | blaze-fire/Data_Structures | set.cpp | #include <iostream>
#include <set>
using namespace std;
int main(){
set <int> s;
s.insert(40);
s.insert(30);
s.insert(60);
s.insert(20);
s.insert(50);
s.insert(50);
set <int> s2(s.begin(),s.end());
set <int>::iterator itr = s2.begin();
for(; itr != s2.end(); itr++){
... | ALGO | 0.980779 | 3.213433 |
31ab0c22-3e00-4ea1-9190-78cee324d169 | muhammadhasan01/cp | Online Judge/Codeforces/Contests/DIV2/DIV2-815/A.cpp | #include <bits/stdc++.h>
using namespace std;
void solve() {
long long a, b, c, d;
cin >> a >> b >> c >> d;
long long lft = a * d;
long long rgt = b * c;
if (lft == rgt) {
cout << 0 << '\n';
return;
}
if (lft > rgt) {
swap(lft, rgt);
}
if (lft == 0 || rgt % ... | ALGO | 0.999959 | 5.040348 |
8c1f8ff7-7d78-4ac6-b733-bd1ac2b315c6 | Riyad0001/Phitron-Practice | Data Structer P2/any_position.cpp | #include <bits/stdc++.h>
using namespace std;
class Node
{
public:
int val;
Node *next;
Node(int val)
{
this->val = val;
this->next = NULL;
}
};
void insert_at_tail(Node *&Head, int v)
{
Node *newNode = new Node(v);
if (Head == NULL)
{
Head = newNode;
cout... | ALGO | 0.999101 | 5.0401 |
5ee0dbc9-1981-4298-9f39-a6a1105276cf | mrreda1/problem-solving | codeforces/IntoBlocks.cpp | #include <bits/stdc++.h>
#define all(v) v.begin(), v.end()
#define rall(v) v.rbegin(), v.rend()
#define make_unique(x) sort(all(x)), x.erase(unique(all(x)), x.end())
template <typename T> T nxt();
using namespace std;
using llu = unsigned long long;
using ll = long long;
const bool T = 0;
const string iofile = "";
... | ALGO | 0.99949 | 4.446518 |
2ac74f2c-fb11-4a4e-81b5-21492200f3ca | Andy-xiaokang/CS106B | assignments/Assignment 5/Matching/wmatch.cpp | #include <vector>
/* Written by Edward Rothberg 7/85 */
namespace EdRothberg {
namespace {
#define MAXWT 1000000
/* the number of the blossom entered by edge e */
#define BEND(e) (BASE[END[e]])
/* the blossom matched with v's blossom */
#define BMATE(v) (BASE[END[MATE[v... | ALGO | 0.999924 | 5.175127 |
0730fe5e-cb42-4cf6-9018-7cc921492aef | Sandip-Kanzariya/Codeforces | Daily Dose/344_B_Ten_Words_of_Wisdom.cpp | #include <bits/stdc++.h>
using namespace std;
// https://codeforces.com/contest/1850/problem/B
int cmpv(pair<int, pair <int, int>> a, pair<int, pair <int, int>> b)
{
return a.second.second > b.second.second;
}
int main()
{
int t;
cin >> t;
while (t--)
{
int n;
cin >> n;
... | ALGO | 0.999979 | 4.673767 |
b1f1d594-e5cd-45e1-b149-8c75e685da8c | blackbeardONE/CheggHero | coursehero_auto_reg/account_registered_on_20180324/txtsource/janeasy1.cpp | #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef pair<int,int> ii;
#define fill(a,x) memset(a,x,sizeof(a))
#define pb push_back
#define sz(x) (int)x.size()
#define F first
#define S second
#define FOR(i,a,b) for(int i = a; i<=b; ++i)
#define NFOR(i,a,b) for(int i =... | ALGO | 0.998717 | 3.774885 |
a21fc025-138d-4442-92c8-b8e951a21640 | Anurag-Singhal1/DSA_lovebabbar | patterns/a_letter.cpp | #include<iostream>
using namespace std;
int main(){
int n;
cout<<"Enter ur input value : ";
cin>>n;
cout<<endl;
for(int i=0;i<n;i++){
for(int j=0;j<n-i;j++){
if(j==n-i-1){
cout<<"*";
}
else{
cout<<" ";
}
... | ALGO | 0.999937 | 3.661805 |
8f775738-b093-4a6f-bdfc-6f0e072b880c | drew-m7/Sep-Chaining | lec13_code 2/QuadraticProbing.cpp | #include "QuadraticProbing.h"
#include <iostream>
using namespace std;
template <typename HashedObj>
HashTable<HashedObj>::HashTable(int size) : array(nextPrime(size))
{
makeEmpty();
}
template <typename HashedObj>
void HashTable<HashedObj>::makeEmpty()
{
currentSize = 0;
for (auto &entry : array)
... | ALGO | 0.965108 | 5.495928 |
ffb43ff8-5fab-4191-8869-a4bbe03ec2ca | shivamnath027/DSA_CHALLENGE | pattern14.cpp | #include <iostream>
using namespace std;
int main()
{
int n;
cout << "N: ";
cin >> n;
int space = n - 1;
for (int i = 1; i <= n; i++)
{
for (int j = 1; j <= space; j++)
{
cout << " ";
}
space--;
for (int k = i; k >= 1; k--)
{
... | ALGO | 0.999835 | 4.21666 |
2fa1a6df-d5be-4e3a-a65a-afc5670963d2 | KINHYEONJI/mad-algorithm | SEPTEMBER/KINHYEONJI/BOJ19951.cpp | #include <iostream>
#include <vector>
using namespace std;
int main() {
int n, m;
cin >> n >> m;
vector<int> v_h(n + 1);
vector<int> memory(n + 1, 0);
for (int i = 0; i < n; i++) {
cin >> v_h[i + 1];
}
for (int i = 0; i < m; i++) {
int s, e, h;
cin >> s >> e >> h;
... | ALGO | 0.999954 | 4.060351 |
950ae621-df1d-4499-9586-e72008fbf3c9 | HOKAGO-MEMORIES/BOJ-line123 | SWEA/D2/1926. 간단한 369게임/간단한 369게임.cpp | #include <iostream>
#include <string>
using namespace std;
int main(int argc, char** argv)
{
int N;
cin >> N;
for (int num = 1; num <= N; num++) {
int cnt = 0;
string num_Str = to_string(num);
for (char digit : num_Str) {
if (digit == '3' || digit == '6' || digit == '9')
cnt++;
}
if (cnt > 0) {
... | ALGO | 0.999116 | 4.962322 |
0afd3eba-5ade-421b-a044-3a4a5a835319 | anindya028/Programming-Contest-Problems | UVa/v114/11461.cpp | #include<stdio.h>
#include<stdlib.h>
#include<string.h>
#include<math.h>
#include<ctype.h>
#include<algorithm>
#include<queue>
#include<list>
#include<vector>
#include<string>
using namespace std;
#define sq(a) ((a)*(a))
#define pb(a) push_back(a)
#define Min(a,b) (((a)<(b))?(a):(b))
#define Max(a,b) (((a)>(b))?(a):(... | ALGO | 0.999661 | 3.498361 |
ca4ae63d-822d-462d-a9e8-723c96096175 | miteshkumar77/LC | wildcard-matching/Accepted/8-4-2021, 4:21:50 PM/Solution.cpp | // https://leetcode.com/problems/wildcard-matching
class Solution {
public:
bool isMatch(string s, string p) {
int s_len = s.length(); int p_len = p.length();
int p_idx = 0; int s_idx = 0; int star_idx = -1; int match;
while(s_idx < s_len) {
if (p_idx < p_len && (p[p_idx] == '?'... | ALGO | 0.999957 | 6.403581 |
c154b853-2815-4e1a-9f7b-c2ef67b4e9a2 | aayush-ghub/SuperC | Dynamic Programming/01knapsack.cpp | #include <bits/stdc++.h>
using namespace std;
int knapsackUtil(vector<int> &wt, vector<int> &val, int ind, int W, vector<vector<int>> &dp)
{
if (ind == 0)
{
if (wt[0] <= W)
return val[0];
else
return 0;
}
if (dp[ind][W] != -1)
return dp[ind][W];
i... | ALGO | 0.999986 | 5.031552 |
6b7105f4-ec49-4259-b958-002a64c80e79 | Karan-Veer-Singh/Leetcode | Strings/290. Word Pattern.cpp | class Solution {
public:
bool wordPattern(string pattern, string s) {
string temp;
map <char, string> m1;
map <string, char> m2;
int n = s.size(), j = 0;
for (int i = 0; i < n; i++) {
if (s[i] != ' ') temp.push_back(s[i]);
if (s[i] == ' ' || i + 1 == ... | ALGO | 0.999837 | 6.563895 |
6404a1a8-cea6-40d4-904d-258d37b0a89f | iampran07/DSA_in_Cpp | Recursion/TreeRecursion.cpp | #include<iostream>
using namespace std;
void fun(int n){
if(n>0){
cout<<n<<" ";
fun(n-1);
fun(n-1);
}
}
int main() {
fun(3);
return 0;
} | ALGO | 0.999978 | 4.380173 |
310392c5-5731-432f-9e87-8e57de151af9 | YashTanna/DSA | polygpt.cpp | #include <iostream>
#include <string>
using namespace std;
class polynomial;
class term
{
int cof;
int exp;
term * link;
public:
friend class polynomial;
term(int c, int e)
{
cof = c;
exp = e;
link = NULL;
}
};
class polynomial
{
term *first;
public:
void... | ALGO | 0.998727 | 4.055909 |
c659e12c-7a1e-4016-8df7-9f0e94231b17 | francois141/nori-ray-tracer | ext/nanogui/ext/eigen/doc/examples/Tutorial_ReductionsVisitorsBroadcasting_broadcast_simple_rowwise.cpp | #include <iostream>
#include <Eigen/Dense>
using namespace std;
int main()
{
Eigen::MatrixXf mat(2,4);
Eigen::VectorXf v(4);
mat << 1, 2, 6, 9,
3, 1, 7, 2;
v << 0,1,2,3;
//add v to each row of m
mat.rowwise() += v.transpose();
std::cout << "Broadcasting result: " << std::... | ALGO | 0.997721 | 4.296038 |
62c5f67a-cc26-46dc-a6a7-6b44367203a1 | aayushs879/pipes | bipartite2.cpp | #include <iostream>
using namespace std;
int mat[4][4] = {{0, 1, 0, 1},
{1, 0, 1, 0},
{0, 1, 0, 1},
{1, 0, 1, 0}
};
int V = 4;
struct node{
int data;
node * next;
node (int a){
data = a;
next = NULL;
}
};
class queue{
int size;
node* front;
... | ALGO | 0.999972 | 4.154718 |
a5d45d8c-aa18-41c7-bc0a-987c26d9b624 | RajMakkad/LeetCode | 1291-sequential-digits/1291-sequential-digits.cpp | class Solution {
public:
vector<int> sequentialDigits(int low, int high){
int N = 9;
vector<int> nums;
for(int i = 1;i<=N;i++){
int num = 0;
for(int s = i;s<=N;s++){
num = num*10 + s;
if(num >= low and high >= num) nums.push_back(num);... | ALGO | 0.999954 | 5.958441 |
1cc6121e-1185-4139-a336-bb760f0ee304 | NmBoyd/DWMPC | third_party/acados/examples/c/sim_engine.cpp | #include <stdlib.h>
#include <vector>
// #include <xmmintrin.h>
#include "blasfeo/include/blasfeo_d_aux.h"
#include "blasfeo/include/blasfeo_d_aux_ext_dep.h"
#include "blasfeo/include/blasfeo_d_blas.h"
// acados
#include "acados/sim/sim_common.h"
#include "acados/utils/external_function_generic.h"
#include "acados/ut... | ALGO | 0.998372 | 5.979142 |
bae0dee1-3870-43b3-a881-1c780c20a058 | SemkaTsocurenco/falling_body_simulation | src/euler_method.cpp | #include "../include/euler_method.h"
std::vector<double> euler_method(double m, double alpha, double g, double v0, double t0, double t_end, double dt) {
std::vector<double> velocities;
double v = v0;
double t = t0;
while (t <= t_end) {
velocities.push_back(v);
v += dt * (g - (alpha / m... | ALGO | 0.999947 | 4.430295 |
635fad78-5334-48a0-a7a2-f239cc198499 | ishandutta2007/codeforces | mateocv/normal/1463/E.cpp | #include <bits/stdc++.h>
#define pb push_back
#define fst first
#define snd second
#define fore(i,a,b) for(int i=a,ggdem=b;i<ggdem;++i)
#define SZ(x) ((int)x.size())
#define ALL(x) x.begin(),x.end()
#define mset(a,v) memset((a),(v),sizeof(a))
#define FIN ios::sync_with_stdio(0);cin.tie(0);cout.tie(0)
using namespace st... | ALGO | 0.999993 | 3.728437 |
c709b5bc-67e0-44db-9650-5504165510f4 | Sanketsingh77/DSA | InterviewBit/Array/OccurenceOfEach.cpp | //Occurence of Each Number
https://www.interviewbit.com/problems/occurence-of-each-number/
map<int,int> rbmap;
for(int i = 0 ; i < A.size();i++)
rbmap[A[i]]++;
vector<int> ans;
for(auto i : rbmap)
ans.push_back(i.second);
return ans;
| ALGO | 0.99886 | 4.632591 |
d2f1e7fd-90a7-42aa-8972-62ecb5ae3492 | anshuahi/Hackerrank | nim_game.cpp | #include <bits/stdc++.h>
using namespace std;
vector<string> split_string(string);
// Complete the nimGame function below.
string nimGame(vector<int> p) {
int n = 0, s = 0;
for(int i = 0; i < p.size(); i++){
s = s ^ p[i];
}
while(s > 0 && s%2 == 0){
s /= 2;
}
// cout << s <<... | ALGO | 0.999904 | 5.626981 |
b8716a24-b4be-4507-bbbf-d2d6c7842e2a | SWEG-2016EC-Batch/Quantum-leap | ETS1495_Yonas_Demise/EXPONENT_EXPRESSION.cpp | #include <iostream>
#include<math.h>
using namespace std;
int main()
{
double num1,num2,result;
char answer;
label1:
cout<<"Please enter the base number: "<<endl;
cin>>num1;
if(cin.fail()) {
cout<<"The input you entered is not correct, please enter a number only!"<<endl;
cin.cle... | ALGO | 0.987185 | 3.78697 |
e9eb5a34-1033-4948-b974-d73cc386738d | GitCodeBoy/unreal-editor-dev | Engine/Source/ThirdParty/ICU/icu4c-64_1/source/tools/toolutil/flagparser.cpp | #include "flagparser.h"
#include "filestrm.h"
#include "cstring.h"
#include "cmemory.h"
#define DEFAULT_BUFFER_SIZE 512
static int32_t currentBufferSize = DEFAULT_BUFFER_SIZE;
static int32_t extractFlag(char* buffer, int32_t bufferSize, char* flag, int32_t flagSize, const char ** flagNames, int32_t numOfFlags, UErro... | TOOL | 0.850185 | 5.853778 |
40cf8f57-ee93-4d9f-9f7b-0b8cd7d4b67c | RohitVishwakarma8840/DSA | 2D_ARRAY/Wave_form.cpp | #include<iostream>
#include<vector>
#include<algorithm>
using namespace std;
void wave(int arr1[][4],int row,int col){
for(int j=0;j<col;j++)
if(j%2==0){
for(int i=0;i<row;i++)
cout<<arr1[i][j]<<" ";
}
else{
for(int i=row-1;i>=0;i--)
cout<<arr1[i][j]<<" ";
}
}
int main(){
int arr1[3][4]={1,2,3,4,5,6,7,8,9,10,11... | ALGO | 0.999947 | 3.708405 |
b6e58b82-d540-42b3-b7b5-8f5abddc6a16 | ishandutta2007/codeforces | vepifanov/normal/1292/C.cpp | #include <bits/stdc++.h>
using namespace std;
#define fi first
#define se second
#define mp make_pair
#define pb push_back
#define all(x) (x).begin (),(x).end()
#define sqrt(x) sqrt(abs(x))
#define re return
#define sz(x) ((int)(x).size ())
#define prev PREV
#define next NEXT
using ll = long long;
using ii = pair<in... | ALGO | 0.999691 | 4.113987 |
fa39469f-55ad-4a2c-8095-1232bdee5ea9 | NaxAlpha/mlpack-build | src/mlpack/methods/pca/pca_main.cpp | /**
* @file pca_main.cpp
* @author Ryan Curtin
* @author Marcus Edel
*
* Main executable to run PCA.
*
* mlpack is free software; you may redistribute it and/or modify it under the
* terms of the 3-clause BSD license. You should have received a copy of the
* 3-clause BSD license along with mlpack. If not, se... | ALGO | 0.978631 | 6.247103 |
965538b6-e941-4708-bb9a-0aff99b9abab | mark-ruuan/Codeforces-Solution | 540/a.cpp | #include <bits/stdc++.h>
#define fast ios_base::sync_with_stdio(0);cin.tie(NULL);cout.tie(NULL)
#define ll long long int
#define ld long double
using namespace std;
const int N = 1e6 + 5;
const int MOD = 1e9 + 7;
int main(){
fast;
ll q;
cin >> q;
while(q--){
ll n, a, b;
cin >> n >> a >> b;
if(a * 2 <= b){
... | ALGO | 0.999634 | 3.75299 |
229ff846-51ee-437b-9463-d5b25c2a256a | Madhumidha-S/DSA | Curious Freaks/Basics/Square Root.cpp | /*Square Root*/
class Solution {
public:
int floorSqrt(int n) {
int i=1;
int res=1;
if(n==1 || n==0)
{
return n;
}
while(res<=n)
{
i++;
res = i*i;
}
return i-1;
}
};
/*
Also,
int cou... | ALGO | 0.99992 | 4.776347 |
77183836-aefa-4934-8585-ca4a5ec6b69a | PrajwalBS-coder/C-plus-plusgeneral-Programs | palindrome.cpp | #include<iostream>
using namespace std;
void pal(int n)
{int k,rev=0,l=n;
while(n!=0)
{
k=n%10;
rev=(rev*10)+k;
n=n/10;
}
if(l==rev)
{
cout<<"pal"<<rev;
}
else
{
cout<<"nopal"<<rev<<n;
}
}
int main()
{
int n=121;
pal(n);
} | ALGO | 0.999845 | 3.418698 |
af0b3740-72db-4265-bb0a-01e2c14fc1e9 | harshnadar/Leetcode-Problems | maximal-network-rank/maximal-network-rank.cpp | class Solution {
public:
int maximalNetworkRank(int n, vector<vector<int>>& roads) {
vector<int> in(n,0);
map<pair<int,int>, int> mp;
for(auto it: roads){
in[it[0]]++;
in[it[1]]++;
mp[{it[0], it[1]}]++;
}
// sort(in.begin(), in.end());
... | ALGO | 0.999956 | 5.676414 |
26cba0f1-bb47-42f1-99c4-bcdd0f07ba05 | h-anjum/expense-planner | 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 |
86fa83b3-b773-4005-acd0-8dcf7d5edd1c | JJH-Log/BaekjoonOnlineJudgeSolvedList | 202108/8M1W/B16975.cpp | #include <iostream>
#include <vector>
#include <string> //substr
#include <map>
#include <queue>
#include <stack>
#include <utility> //pair
#include <algorithm> //sort, reverse
#include <math.h> // sqrt
#include <set>
#include <cassert>
#define MOD 1000000007
#define MININT -2147483647
#define MAXINT 2147483647
using ... | ALGO | 0.999892 | 5.366407 |
3bc0bd1d-b084-45df-bd93-9324d200c360 | MinjooShin/Coding-Test-Study | week16/X marks the Spot.cpp | /*
ó: Ƽ
: X marks the Spot
̵: Level2
ð: 18
ּ: https://softeer.ai/app/assessment/index.html?xid=254975&xsrfToken=0kteNfeDbZrNCLxQIjlR3kZD8mFjmacH&testType=practice
*/
#include<iostream>
#include<string>
using namespace std;
int main(int argc, char** argv)
{
int n, idx;
string s, t, result;
cin >> n;
ci... | ALGO | 0.999882 | 4.207747 |
2f2fb253-c6cd-4f03-9199-18b87fe91306 | ishandutta2007/codeforces | emthrm/normal/1699/B.cpp | #define _USE_MATH_DEFINES
#include <bits/stdc++.h>
using namespace std;
#define FOR(i,m,n) for(int i=(m);i<(n);++i)
#define REP(i,n) FOR(i,0,n)
#define ALL(v) (v).begin(),(v).end()
using ll = long long;
constexpr int INF = 0x3f3f3f3f;
constexpr long long LINF = 0x3f3f3f3f3f3f3f3fLL;
constexpr double EPS = 1e-8;
constex... | ALGO | 0.999812 | 3.95756 |
d7081643-5f39-4efd-926b-d7a5d61183c7 | lucasg1/sard_dataset_without_bias | dataset/Juliet-1/65985-v1.0.0/src/testcases/CWE121_Stack_Based_Buffer_Overflow/s06/bad_CWE121_Stack_Based_Buffer_Overflow__CWE806_char_declare_ncat_72b.cpp | using namespace std;
namespace NAMESPACE0
{
void FUN0(vector<char *> dataVector);
void FUN1()
{
char * data;
vector<char *> dataVector;
char dataBuffer[100];
data = dataBuffer;
memset(data, 'A', 100-1);
data[100-1] = '\0';
dataVector.insert(dataVector.end(), 1, data);
dataVector.insert... | ALGO | 0.944438 | 3.249629 |
9a69c3a1-83ee-43b4-8bc9-9f0dcdb8a7a9 | kodurukavyasri/AmritaCollege | Second_Year/2.1_CPP/Complex_NumberRational.cpp | #include <iostream>
using namespace std;
class ComplexRational {
private:
double numeratorReal; // Numerator of the real part
double denominatorReal; // Denominator of the real part
double numeratorImaginary; // Numerator of the imaginary part
double denominatorImaginary; // Denominator of the imagin... | ALGO | 0.987854 | 5.6814 |
cf5db5bd-5a53-45ec-b5eb-1816eace574d | Apress/learn-cocos2d-game-dev-w-ios-5 | CH12_code/PhysicsBox2D01/libs/Box2d/Collision/Shapes/b2CircleShape.cpp | #include <Box2D/Collision/Shapes/b2CircleShape.h>
#include <new>
b2Shape* b2CircleShape::Clone(b2BlockAllocator* allocator) const
{
void* mem = allocator->Allocate(sizeof(b2CircleShape));
b2CircleShape* clone = new (mem) b2CircleShape;
*clone = *this;
return clone;
}
bool b2CircleShape::TestPoint(const b2Transfor... | ALGO | 0.866571 | 7.850271 |
56d2fa2a-f4a9-48e8-bcfd-0533bec04f50 | manojnsut/Leetcode | 1046-last-stone-weight/1046-last-stone-weight.cpp | class Solution {
public:
int lastStoneWeight(vector<int>& stones) {
priority_queue<int> pq(stones.begin(),stones.end());
// we run the loop until at most one stone is
while (pq.size() > 1) {
// we pop the element and destory it if both are equal
int x = pq.top(); pq... | ALGO | 0.999893 | 5.428759 |
24f639bb-8b48-4d76-a176-15bca2f6217e | lakshits11/advent-of-code-2023 | Day1/1.cpp | /****************************
Author: LAKSHIT SOMANI
****************************/
#include <bits/stdc++.h>
using namespace std;
int main()
{
string s;
int ans = 0;
for (int ccc = 0; ccc < 1000; ++ccc)
{
int f = -1, l = -1;
cin >> s;
for (int i = 0; i < s.size(); i++)
... | ALGO | 0.999082 | 3.892804 |
bc5d2205-4bf7-4c01-ab1a-1eaaee353ef7 | yyymouse/RM | 速控/eigen-3.4.0/unsupported/doc/examples/MatrixPower_optimal.cpp | #include <unsupported/Eigen/MatrixFunctions>
#include <iostream>
using namespace Eigen;
int main()
{
Matrix4cd A = Matrix4cd::Random();
MatrixPower<Matrix4cd> Apow(A);
std::cout << "The matrix A is:\n" << A << "\n\n"
"A^3.1 is:\n" << Apow(3.1) << "\n\n"
"A^3.3 is:\n" << Apow(3.3) << "\n\n"
... | ALGO | 0.997837 | 3.396939 |
9338f6c9-8b56-4074-bc42-c9c961eeb132 | ahmedredaooooo/Problem-Solutions | CodeForces/236A/41025322_AC_30ms_16kB.cpp | /* لا اله الا الله محمد رسول الله */
#include <bits/stdc++.h>
using namespace std;
#define sad ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define el '\n'
#define all(x) x.begin(), x.end()
#define LL long long
... | ALGO | 0.999679 | 4.292147 |
2adee4d9-6528-4290-a5ed-413fe9e05842 | HarshRaj2717/Programming-Problems | Strivers_A2Z_DSA_sheet/search in Rotated Sorted Array.cpp | // Problem : https://leetcode.com/problems/search-in-rotated-sorted-array/
#include<bits/stdc++.h>
using namespace std;
int search(vector<int>& nums, int target) {
int s = 0, e = nums.size() - 1;
int m = s + (e - s) / 2;
while(s <= e){
if(nums[m] == target) return m;
if(nums[m] >= nums[s]... | ALGO | 0.999852 | 6.482843 |
ccf24eec-3792-41d0-bebe-ebb3abf0f50e | romanesco/qfract | plugins/tricorn.cpp | /*
* tricorn
* z -> (z^2 + conj(c))^2 + c (parameter space)
*/
#include "../plugin.h"
using namespace QFract;
#define RE2IM2 re2=re*re; \
im2=im*im;
#define FUNCTION im = -2*re*im + aim; \
re = re2-im2 + are;
/*
#define FUNCTION im = 2*re*im - aim; \
re = re2-i... | ALGO | 0.999563 | 6.018776 |
edf163e2-d7f4-4f52-8988-d203cb1b5346 | JoseETeixeira/EduGameEngine | include/imgui/misc/fonts/binary_to_compressed_c.cpp | // dear imgui
// (binary_to_compressed_c.cpp)
// Helper tool to turn a file into a C array, if you want to embed font data in your source code.
// The data is first compressed with stb_compress() to reduce source code size,
// then encoded in Base85 to fit in a string so we can fit roughly 4 bytes of compressed data i... | TOOL | 0.93237 | 6.762869 |
4ee5b2d3-f196-484f-a29f-8cea754170ec | wol101/GaitSym_Wii_Kinect | GaitSymODE/src/NPointStrap.cpp | #include <ode/ode.h>
#include <math.h>
#include <string.h>
#include <iostream>
#include <vector>
#include "NPointStrap.h"
#include "Body.h"
#include "PGDMath.h"
#include "Simulation.h"
#include "Util.h"
#include "DebugControl.h"
#ifdef USE_OPENGL
#include "FacetedPolyline.h"
extern int gDrawMuscles;
extern int gDraw... | TOOL | 0.943161 | 4.302415 |
3172b11f-d27d-4efc-aa3f-1478470af476 | CodingPythonMan/CPPAdvanced | CPPSTL/Iterator/IteratorCategory/memb_type3.cpp | /*#include <algorithm>
using namespace std;
template<typename InputIt, typename T>
InputIt
efind(InputIt first, InputIt last, T value)
{
while (first != last && *first != value)
++first;
return first;
}
int main()
{
int x[3] = { 1,2,3 };
int* p = efind(x, x + 3, 2);
//reverse()
//sort()
}*/ | ALGO | 0.999645 | 3.879225 |
f69ee9a6-2f3c-4610-8355-509dfde76a6b | Bbek10/Simulation-and-Modeling | Lab 1 Pseudo Random Numbers/1_4_expo.cpp | #include <iostream>
#include <random>
#include <cmath>
int main() {
std::default_random_engine generator;
std::exponential_distribution<double> distribution(0.5);
generator.seed(2341); // Set the seed
double mean = 0;
double variance = 0;
int nSample = 10000;
for (int i = 0; i < nSample;... | ALGO | 0.988984 | 4.912558 |
a6083577-ade7-4359-9c5c-c90c051225b3 | SharmaRithik/Profile-NewGVN | llvm-project/bolt/lib/Passes/PettisAndHansen.cpp | #include "bolt/Passes/HFSort.h"
#include "llvm/Support/Debug.h"
#include "llvm/Support/Format.h"
#include "llvm/Support/raw_ostream.h"
#include <set>
#include <unordered_map>
#define DEBUG_TYPE "hfsort"
namespace llvm {
namespace bolt {
using NodeId = CallGraph::NodeId;
using Arc = CallGraph::Arc;
using Node = CallG... | ALGO | 0.99956 | 6.125429 |
286e3962-fa52-4be9-9ae3-79a5fd31f67a | ethanwong888/CS32 | HW 4/Homework 4 Submission/sorts.cpp | #include <iostream>
#include <algorithm>
#include <numeric> // for std::accumulate
#include <utility>
#include <vector>
#include <string>
#include <random>
#include <cassert>
#if defined(_MSC_VER) && !defined(_DEBUG)
#include <iostream>
#include <windows.h>
#include <conio.h>
struct KeepWindowOpenUntilDismissed
{
... | ALGO | 0.98847 | 5.783898 |
6423b153-f2d5-4c37-a9ca-00a2227a1867 | shovikguha/LeetCode | 0797-all-paths-from-source-to-target/0797-all-paths-from-source-to-target.cpp | class Solution {
public:
vector<vector<int>> ret;
vector<vector<int>> allPathsSourceTarget(vector<vector<int>>& graph) {
int targ = graph.size() - 1;
vector<int> path = {0};
dfs(0,targ, path, graph);
return ret;
}
void dfs(int curr, int targ, vector<int... | ALGO | 0.999928 | 6.272249 |
e5f134ae-3aa6-43d9-8e90-2fc7e5c6e50b | yuanfan45/diligent | answer2-5-2.cpp | #include<iostream>
#include<windows.h>
using namespace std;
int main()
{
double p = 3.14;
double x, C, S;
cout << "Բİ뾶" << endl;
cin >> x;
C = 2 * x*p;
S = p*x*x;
cout << "C=" << C << endl << "S=" << S << endl;
system("pause");
return 0;
}
| ALGO | 0.923558 | 3.392263 |
dbe64bcc-f3fd-4a88-ac88-85493ec0448e | prabandh1444/CS-101 | cs101/Labs/Lab-9/correlation.cpp | #include<simplecpp>
main_program{
int n;
cin>>n;
double s1[n],s2[n],sum1=0,sum2=0,ssum1=0,ssum2=0,pro=0,den1,den2,num,den,corr;
for(int i=0;i<=n-1;i++){cin>>s1[i];}
for(int i=0;i<=n-1;i++){cin>>s2[i];}
for(int i=0;i<=n-1;i++){sum1=sum1+s1[i];}
for(int i=0;i<=n-1;i++){sum2=sum2+s2[i];}
for(int i=0;i<=n-1;i++){ssum1=ssu... | ALGO | 0.999716 | 3.038074 |
6b2c150e-3312-4f2b-884d-ebd830e2ba61 | harshjoshiiii/leetcode | 0485-max-consecutive-ones/0485-max-consecutive-ones.cpp | class Solution {
public:
int findMaxConsecutiveOnes(vector<int>& nums) {
int count =0;
int maxi=0;
for(int i=0;i<nums.size();i++)
{
if(nums[i]==1)
{
count++;
}
else
{
count=0;
}
maxi=m... | ALGO | 0.999958 | 5.999963 |
fd1b01a3-8da4-43e1-8f14-f89152b9c321 | benjamin-carpene/a_star | a_star/src/node.cpp | #include "node.hpp"
#include <algorithm>
#include <math.h>
#include <sstream>
// --------------- Vector2D ---------------
a_star::Vector2D::Vector2D(uint16_t x, uint16_t y):
x(x), y(y)
{}
bool a_star::Vector2D::operator==(Vector2D other) const
{
return x == other.x && y == other.y;
}
a_star::Vector2D::ope... | ALGO | 0.986351 | 5.166825 |
c84d3428-9e9d-4555-a302-ec6daaebf024 | ishandutta2007/codeforces | shik/normal/1054/B.cpp | // {{{ by shik
#include <bits/stdc++.h>
#pragma GCC diagnostic ignored "-Wunused-result"
#pragma GCC diagnostic ignored "-Wunused-function"
#define SZ(x) ((int)(x).size())
#define ALL(x) begin(x), end(x)
#define REP(i, n) for (int i = 0; i < int(n); i++)
#define REP1(i, a, b) for (int i = (a); i <= int(b); i++)
#define... | ALGO | 0.999954 | 4.009184 |
59cf3a2a-0d87-4863-866d-bfe4decc2815 | vipinmishra0852/DecodeAssignment | Arrays2D/Assignment/Assignment2/4.cpp | #include <iostream>
#include <vector>
using namespace std;
vector<vector<int>> generateSpiralMatrix(int n)
{
// Initialize the matrix with zeros
vector<vector<int>> matrix(n, vector<int>(n, 0));
int num = 1; // Start with the smallest number
int top = 0, bottom = n - 1, left = 0, right = n - 1;
while (num ... | ALGO | 0.99919 | 6.342468 |
a346833b-5405-482b-a3fa-f75119ca2867 | holtri/R-subcon | src/HiCSSearch.cpp | #include <Rcpp.h>
#include <algorithm>
#include "searchBeam.h"
#include "deviationFunctions.h"
using namespace Rcpp;
void print(const std::vector<int> &vec){
for (const auto& i: vec){
Rcpp::Rcout << i << " ";
}
Rcpp::Rcout << std::endl;
}
std::string toString(const std::vector<int> &vec){
std::stringstre... | ALGO | 0.999438 | 5.423355 |
12c98bc2-fcc3-4392-b29b-1e3246167f15 | lguitech/open_micro_mower_ros | src/eigen-3.4.0/doc/examples/Tutorial_ReductionsVisitorsBroadcasting_broadcast_simple_rowwise.cpp | #include <iostream>
#include <Eigen/Dense>
using namespace std;
int main()
{
Eigen::MatrixXf mat(2,4);
Eigen::VectorXf v(4);
mat << 1, 2, 6, 9,
3, 1, 7, 2;
v << 0,1,2,3;
//add v to each row of m
mat.rowwise() += v.transpose();
std::cout << "Broadcasting result: " << std::... | ALGO | 0.992007 | 4.296038 |
65f56ecc-eabe-40d6-9457-9b1d0f834e91 | sanyache/lecture_c | comb/e230.cpp | #include<iostream>
#include<vector>
using namespace std;
#define mod 1000000007;
int64_t comb(int n, int k){
vector <int64_t> dp(k+1, 0);
dp[0] = 1;
for(int i = 1; i <= n; i++){
for(int j = min(i, k); j > 0; j--){
dp[j] = (dp[j] + dp[j-1]) % mod;
}
}
return dp[k];
}
i... | ALGO | 0.999967 | 3.861921 |
ceb531bb-f553-4257-bd06-a4ecc527bfca | art-kosm/homeworks | term_2/homework_02/task_1/doublylinkedlist.cpp | #include <cstdio>
#include "linkedList.h"
#include "doublyLinkedList.h"
struct DoublyLinkedList::ListElement
{
int value;
ListElement *next;
ListElement *previous;
};
DoublyLinkedList::DoublyLinkedList()
{
ListElement *guard = new ListElement;
guard->value = 0;
guard->next = nullptr;
guar... | TOOL | 0.994582 | 4.668048 |
c5941eab-26bf-402c-a143-f930d1b8271c | 1604056nizam/problem-solving | 90. Subsets II.cpp | class Solution {
public:
//sort the nums
//recursive Function(arr, subResult, currentIndex)
// loop throught the reuslt
//if not equal to currentIndex and arr[i] == arr[i - 1] continue
//push the number into the subresult
// call the recursive (taken)
// pop out
// call the recursive (... | ALGO | 0.999697 | 5.856918 |
bdc6c040-402c-4dd3-ab29-e792352f0fbd | JuanCardenascj/ProgramacionC- | CadenasCaracteresCadenaEjercicio1C++.cpp | /*Ejercicio 1:
Hacer un programa que pida al usuario que digite una cadena de
caracteres, luego verificar la longitud de la cadena, y si esta
supera a 10 caracteres mostrarla en pantall, caso contrario no
mostrarla.
*/
#include<iostream>
#include<string.h>
using namespace std;
int main() {
char nombre[30];
... | TOOL | 0.874095 | 3.811013 |
27044603-33a5-4ece-8ba3-60746acbc58f | 113bommy/deepmind_codecontests_refine | cpp_source_filter_file/cpp_train_3608_6.cpp | #include <bits/stdc++.h>
int main() {
int n;
scanf("%d", &n);
int *nums = (int *)malloc(sizeof(int) * n), j = 0;
long long sum = 0;
for (; j < n; ++j) {
scanf("%d", &nums[j]);
sum += nums[j];
}
long long pref = 0;
for (j = 0; j < n; ++j) {
pref += nums[j];
if (pref >= sum / 2) {
pr... | ALGO | 0.999778 | 4.366406 |
bc90bdc2-0dbc-4262-8419-f1d3dd84322b | YogiRajNeelamsetti/DSA | 893-all-nodes-distance-k-in-binary-tree/all-nodes-distance-k-in-binary-tree.cpp | /**
* Definition for a binary tree node.
* struct TreeNode {
* int val;
* TreeNode *left;
* TreeNode *right;
* TreeNode(int x) : val(x), left(NULL), right(NULL) {}
* };
*/
class Solution {
public:
void markParent(TreeNode* root, unordered_map<TreeNode*, TreeNode*> &parent) {
queue<Tr... | ALGO | 0.999998 | 6.129377 |
47909f7c-8aa6-4885-b725-87d7d6e3dcd7 | Hayeong1224/Algorithm | 0x02/2490.cpp | #include<bits/stdc++.h>
using namespace std;
int main(void)
{
int input, sum;
string result = "DCBAE";
for(int i=0;i<3;i++)
{
sum = 0;
for(int j=0;j<4;j++)
{
cin >> input;
sum += input;
}
cout << result[sum] << '\n';
}
} | ALGO | 0.999622 | 3.793071 |
869a0c0e-7ec1-48c8-bccb-ddb5e2bab873 | croaxx/ProjectEuler | LeetCode/Trapping Rain Water/main.cpp | // Problem description: https://leetcode.com/problems/trapping-rain-water/
// Solution: each i-th bar contributes with the following water amount: height[i] - min(h_left[i], h_right[i]) (if non negative)
// Here h_left[i]/h_right[i] indicates the maximum available height of the bar to the left/right from i-th bar.
// ... | ALGO | 0.999979 | 7.146789 |
644e7979-8cef-43b4-8987-00b6780fd6d2 | trhermans/appearance-mapping | FabmapMain.cpp | // author: Richard
//#include <map>
//#include <vector>
//#include <iostream>
//#include <algorithm>
#include "fabmap/ChowLiuTree.h"
#include "fabmap/DetectorModel.h"
#include "fabmap/FABMAP.h"
#include "fabmap/Timer.h"
int main()
{
// 1. initialize the fabmap algorithm
// constructor parameters:
// sigma is the ... | ALGO | 0.999271 | 4.340349 |
9fb003b3-289c-4102-a56b-6e6ade1d6e90 | vinayak131/cnslab | CNS-Lab-master/09. BBS & Rabin-Miller/main.cpp | /* Author : AKSHAT AGARWAL */
/*
9. Write a program to generate large random number using BBS random number generator algorithm and check whether the generated number is prime or not using RABIN-MILLER primality testing algorithm.
*/
#include <bits/stdc++.h>
using namespace std;
int randInRange(int low, int high) /... | ALGO | 0.999871 | 4.458015 |
e209b7b6-fa9e-4f3d-99d5-10e594d9e581 | DeCrypt0/Vetani | src/arith_uint256.cpp | #include "arith_uint256.h"
#include "crypto/common.h"
#include "uint256.h"
#include "uint512.h"
#include "utilstrencodings.h"
#include <stdio.h>
#include <string.h>
template <>
std::string base_uint<256>::GetHex() const
{
return ArithToUint256(*this).GetHex();
}
template <>
void base_uint<256>::SetHex(const cha... | ALGO | 0.927509 | 6.748491 |
7514c1d8-efe6-4597-b714-9dfc12367cf9 | Loki-chen/Compile_via_MLIR | third_party/llvm-project/libcxx/test/libcxx/fuzzing/unique_copy.pass.cpp | // UNSUPPORTED: c++03, c++11
#include <algorithm>
#include <cstddef>
#include <cstdint>
#include <iterator>
#include <vector>
#include "fuzz.h"
extern "C" int LLVMFuzzerTestOneInput(const std::uint8_t *data, std::size_t size) {
std::vector<std::uint8_t> working(data, data + size);
std::sort(working.begin(), ... | TEST | 0.971635 | 5.974601 |
ed6d9cbb-8932-4629-8952-18016b5c27be | kaito7926/Code-Cpp | thi.cpp | #include<iostream>
using namespace std;
int main(){
int n;
cin>>n;
int a[1001];
for (int i=0;i<n;i++){
cin>>a[i];
}
int count[2001]={0};
for (int i=0;i<n;i++){
count[a[i]+1000]++;
}
int output;
for (int i=0;i<2001;i++){
if (count[i]>2){
ou... | ALGO | 0.999787 | 3.515537 |
355794dd-bd6d-4015-99d6-68b84d136d21 | rosiewuuu/Priority-Queue-Implementation-with-Indexed-Heaps-and-AVL-Trees | PQdemo.cpp | #include <iostream>
#include <sstream>
#include <string>
#include "AvlTree.h"
#include "AvlNode.h"
#include "BinaryHeap.h"
#include "PQ.h"
#include "dsexceptions.h"
#include <vector>
using namespace std;
// Test program
int main() {
vector<int> prj = { 1110, 2220, 3330, 4440, 5550, 110, 220, 330, 440, 550,
20, 30... | TEST | 0.988922 | 5.104751 |
85366987-e262-4299-8fa9-208e24ebe7ff | somepiga/os_lab | src/task1.cpp | #include <sys/types.h>
#include <sys/wait.h>
#include <stdio.h>
#include <unistd.h>
#include <stdlib.h>
#include <iostream>
#include <pthread.h>
#include <sys/syscall.h>
#include <thread>
#include <mutex>
int value = 0;
void has_wait()
{
pid_t pid, pid1;
pid = fork();
if (pid < 0)
{
fprintf(s... | TOOL | 0.860501 | 4.498164 |
9dc1cd7b-f553-42a0-8016-33500e2f2555 | morris821028/UVa | volume127/12776 - Query for Divisor-free Numbers.cpp | #include <stdio.h>
#include <algorithm>
#include <vector>
#include <map>
using namespace std;
#define maxL (50000>>5)+1
#define GET(x) (mark[x>>5]>>(x&31)&1)
#define SET(x) (mark[x>>5] |= 1<<(x&31))
int mark[maxL];
int P[32767], Pt = 0;
void sieve() {
register int i, j, k;
SET(1);
int n = 50000;
for(i =... | ALGO | 0.999967 | 3.989304 |
26e398f6-71de-4a72-8534-9d22752dfe88 | sunilkumarswami/LeetCode-Pratice | 0173-binary-search-tree-iterator/0173-binary-search-tree-iterator.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.999818 | 6.486498 |
1cae6056-8d62-497a-8f57-aa7262364760 | gg-fu/ncnn-arm | src/layer/lrn.cpp | #include "lrn.h"
#include <math.h>
namespace ncnn {
DEFINE_LAYER_CREATOR(LRN)
LRN::LRN()
{
one_blob_only = true;
support_inplace = true;
}
int LRN::load_param(const ParamDict& pd)
{
region_type = pd.get(0, 0);
local_size = pd.get(1, 5);
alpha = pd.get(2, 1.f);
beta = pd.get(3, 0.75f);
r... | ALGO | 0.989419 | 6.356753 |
dcc19744-9f88-449e-bbff-efcf8f891b65 | gogolB/EE147 | Final Project/deps/glm/test/core/core_func_matrix.cpp | #include <glm/matrix.hpp>
#include <glm/gtc/matrix_transform.hpp>
#include <glm/gtc/ulp.hpp>
#include <glm/gtc/epsilon.hpp>
#include <glm/gtc/constants.hpp>
#include <vector>
#include <ctime>
#include <cstdio>
using namespace glm;
int test_matrixCompMult()
{
int Error(0);
{
mat2 m(0, 1, 2, 3);
mat2 n = matrixC... | TEST | 0.960963 | 6.671946 |
fb882191-5955-4d0a-91cf-42b6c9efeb91 | z1908144712/ExamCode | LeetCode/68/main.cpp | #include <iostream>
#include <vector>
#include <string>
using namespace std;
class Solution {
public:
vector<string> fullJustify(vector<string>& words, int maxWidth) {
vector<string> ans, tmp;
int count = 0;
bool flag = false;
for (int i = 0; i < words.size(); i++) {
count += words[i].size();
if (flag ... | ALGO | 0.999767 | 5.85673 |
ea3282ae-86bd-4606-86ba-05908c938839 | BioDataAnalysis/blaze | blazemark/src/main/DVecTSVecMult.cpp | //=================================================================================================
//=================================================================================================
//*************************************************************************************************
// Includes
//****... | TEST | 0.904293 | 5.949226 |
cb41c0ec-45ea-4abd-81ae-8fab82597c70 | huaijin-chen/OpenCVMirror | opencv/modules/objdetect/src/latentsvmdetector.cpp | #include "precomp.hpp"
#include "_lsvmparser.h"
#include "_lsvm_matching.h"
/*
// load trained detector from a file
//
// API
// CvLatentSvmDetector* cvLoadLatentSvmDetector(const char* filename);
// INPUT
// filename - path to the file containing the parameters of
// - trained Latent ... | ALGO | 0.984821 | 7.211605 |
9e17a719-d58a-4465-a87e-30579f472faf | mynameisashllee/codebreaker | weddingcoins.cpp | #ifndef _GLIBCXX_NO_ASSERT
#include <cassert>
#endif
#include <cctype>
#include <cerrno>
#include <cfloat>
#include <ciso646>
#include <climits>
#include <clocale>
#include <cmath>
#include <csetjmp>
#include <csignal>
#include <cstdarg>
#include <cstddef>
#include <cstdio>
#include <cstdl... | ALGO | 0.999586 | 4.075447 |
c9a7a5dd-c6a8-4279-a7f5-edb18cccd832 | kssamwang/GraphXGPU | cpp_native/Graph_Algo/test/PageRankTest.cpp | //
// Created by cave-g-f on 2019-9-23
//
#include "../algo/PageRank/PageRank.h"
#include <iostream>
#include <fstream>
int main()
{
//Read the Graph
std::ifstream Gin("../../data/testGraph_road-road-usa.mtx.txt");
if(!Gin.is_open()) {std::cout << "Error! File testGraph.txt not found!" << std::endl; retu... | ALGO | 0.998527 | 4.19 |
f9b049ef-147b-4058-aa44-211aa8732cf3 | jujimeizuo/XCPC-Template | 04_博弈论/04_wythoff.cpp | template <typename T>
bool wythoff(T& a, T& b) {
if (a > b) std::swap(a, b);
T delta = b - a;
T res = delta * (1.0 + sqrt(5.0)) / 2;
return !(res == a);
}
template <typename T>
bool wythoff_exp(T& a, T& b, T& k) {
k++;
if (a > b) std::swap(a, b);
T delta = (b - a) / k;
T res1 = delta * ... | ALGO | 0.999079 | 4.120717 |
d85df735-505f-4bcd-b90c-c8e4e1597214 | MARSHAL-CREATER/Data-Structures-and-Algorithms | 树及其应用.cpp | #include <stdio.h>
#include <stdlib.h>
#define OVERFLOW -1
#define OK 1
#define ERROR -1
typedef struct BiTNode{ //Ķ洢ṹ
char data;
struct BiTNode *lchild,*rchild;
}BiTNode,*BiTree;
//ĵݹ㷨
int CreateBiTree(BiTree &T)
{
char ch;
ch=getchar();
if (ch==' ') T = NULL;
else {
if (!(T = (BiTNode *)mall... | ALGO | 0.999738 | 3.892148 |
590d9c4c-847f-49fe-88bc-0d88c86e197e | wantime/Data-Structure-Algorithm-Using-Cpp | A4-Linked-List/main.cpp | //
// Created by w on 2023/4/17.
//
#include <iostream>
#include <vector>
#include <stack>
using namespace std;
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){}
};
void pri... | ALGO | 0.999652 | 5.001405 |
a3c25cc6-f2d3-4071-b786-b7979152dc4f | imtiaz1710/competitive-programming | Vjudge/CodeForces/867A/26211072_AC_31ms_3648kB.cpp | #include <bits/stdc++.h>
#define ll long long
#define us unsigned short int
#define fin freopen("/home/imtiaz/Desktop/in.txt", "r", stdin)
#define fout freopen("/home/imtiaz/Desktop/out.txt","w", stdout)
#define dbg(x) cerr << #x << ": " << x << endl
#define fastio ios::sync_with_stdio (false); cin.tie (0);
using names... | ALGO | 0.999932 | 3.340081 |
04592d46-e748-431f-9345-25f275ac241f | sency90/boj | 4195.cpp | #include <cstdio>
#include <string>
#include <map>
using namespace std;
map<string, string> p;
map<string, int> ans;
string find(string a) {
if(p[a]==a) return a;
else return p[a] = find(p[a]);
}
void uni(string x, string y) {
p[find(y)] = find(x);
}
int main() {
int t, n;
string x, y, px, py;
c... | ALGO | 0.999819 | 4.098699 |
e413cc22-893a-4d0c-a4c2-4982515aca11 | KoMoRee/ComProLab15 | lab15_5.cpp | #include <iostream>
#include <cstdlib>
#include <ctime>
using namespace std;
void shuffle(int *,int *,int *,int *);
int main(){
int a = 50, b = 100, c = 500, d = 1000;
srand(time(0));
for(int i = 0;i < 10;i++){
shuffle(&a , &b , &c , &d);
cout << a << " " << b << " " << c << " " << d << "\n";
}
... | ALGO | 0.995669 | 3.235069 |
1e6ac977-8fbf-4b48-b5a3-3ef39114ba7e | Samrudhi00/LEETCODE-150 | 0019-remove-nth-node-from-end-of-list/0019-remove-nth-node-from-end-of-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* removeNthFr... | ALGO | 0.999959 | 6.053716 |
7a3cee54-122c-4917-a6b1-783a538e4536 | ISagesse/Cplusplus_refresher | day_five/add_reference/Source.cpp | #include <iostream>
using namespace std;
// using a void function and references to add two numbers.
void add_two_number(int& num1, int& num2) {
cout << num1 + num2;
}
void end_loop(int& value) {
for (int i = value + 1; i > 0; i--) {
cout << i << endl;
}
}
int main() {
// it has to be a already initialize va... | ALGO | 0.966535 | 4.814525 |
b9091e36-b690-4aef-a849-03469c8e9888 | TrDieux18/C_PTIT | C04001.cpp | #include<stdio.h>
int main()
{
int t;
scanf("%d",&t);
printf("\n");
while(t--)
{
int a[100];
int n;
scanf("%d",&n);
printf("\n");
for(int i =0; i < n; i++)
{
scanf("%d",&a[i]);
}
for(int i =0; i <n; i++)
{
if( a[i] >0 && a[i] %2 == 0)
printf("%d ",a[i]);
}
}
return 0;
}
| ALGO | 0.999341 | 3.057256 |
5b647f4c-5952-4948-8815-4e6486a5b750 | muhammadbadrul1234/Computer-Science-and-Engineering | Programing/Codeforces/1589A. Mathematical Addition.cpp | #include<bits/stdc++.h>
using namespace std;
int main()
{
long long int a,x,y;
cin>>a;
for(int i=0;i<a;i++)
{
cin>>x>>y;
if(x<y)
{
x=-x*x;
y=y*y;
cout<<x<<" "<<y<<endl;
}
else if(x>y)
{
x=x*x;
y=-... | ALGO | 0.999539 | 3.411171 |
42ef80a9-54d1-45f0-8480-8708961c4df6 | Md-Nasiat-Hasan-Fahim/Problem-Solving-with-C | .acmx/solutions/Codeforces - Codeforces Round 830 (Div. 2)/C_1_Sheikh_Easy_version.cpp | #include<bits/stdc++.h>
using namespace std;
#define FastIO ios_base::sync_with_stdio(false), cin.tie(0)
#define endl '\n'
#define int long long
#define all(x) x.begin(),x.end()
#define pb push_back
#define YES cout<<"YES\n"
#define NO cout<<"NO\n"
#define check(x) cout << (#x) << " is " << (x) << endl;
const int mod ... | ALGO | 0.999874 | 3.963163 |
abfc5740-951a-494a-8e13-f6ba198daa77 | Prashant-2505/interview-stuff | gpt dsa list/graph/easy/find_num_of_connected_componnets.cpp | #include <bits/stdc++.h>
using namespace std;
class Graph
{
int V;
unordered_map<int, list<int>> adjList;
public:
Graph(int v)
{
V = v;
}
void insertEdge(int u, int v, bool dir)
{
adjList[u].push_back(v);
if (!dir)
{
adjList[v].push_back(u);
... | ALGO | 0.999623 | 6.243859 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.