uuid string | repo_name string | relative_path string | content string | category string | algo_rel_score float64 | quality_score float64 |
|---|---|---|---|---|---|---|
f9850050-f3ff-4c6b-a603-1ceb335bf2db | danielhO9/PS | CODEFORCES/1902D.cpp | #include <bits/stdc++.h>
using namespace std;
typedef long long LL;
LL n, q;
string s;
LL x, y, l, r;
LL p[200001];
unordered_map<LL, vector<LL>> dic;
bool comp(const pair<int, int> &a,const pair<int, int> &b) {
return a.first < b.first;
}
string solution() {
cin >> x >> y >> l >> r;
--l; --r;
if (!dic[(x + n) *... | ALGO | 0.999969 | 4.703326 |
f7b57f7e-d771-4c8f-8ccc-610db4262fc2 | ayaanlehashi11/LeetCode-Solutions | binaryTreeLevelOrderTraversal/binaryTreeLevelOrderTraversal.cpp | // Source : https://oj.leetcode.com/problems/binary-tree-level-order-traversal/
// Author : Hao Chen
// Date : 2014-07-17
/**********************************************************************************
*
* Given a binary tree, return the level order traversal of its nodes' values.
* (ie, from left to right, l... | ALGO | 0.999959 | 5.918855 |
69c0e50a-fce9-40c4-89c4-8aee2c747e29 | IgorRunny/2semester | labs/lab4/lab4.cpp | #include <iostream>
template<typename T, typename Tn, typename Tm>
class Matrix
{
private:
T** m_matrix = nullptr;
Tn N;
Tm M;
T deth = 0;
friend std::istream& operator >> (std::istream& input, Matrix<T, Tn, Tm>& mat)
{
for (int i = 0; i < mat.N; ++i)
{
for (int j = ... | ALGO | 0.997082 | 4.136898 |
3ca5bbe9-7519-40da-9090-095a604d103f | neil78duan/ndnetsdk | src/ndclient/nd_exch_key.cpp | #include "nd_common/nd_common.h"
#include "nd_net/nd_netlib.h"
#include "nd_crypt/nd_crypt.h"
#include "ndapplib/nd_msgpacket.h"
//#include "ndcli/nd_api_c.h"
#include "ndcli/nd_iconn.h"
#include "nd_msg.h"
#define SEND_MSG(__handle, _omsg) \
nd_connector_send(__handle,(nd_packhdr_t*) (_omsg.GetMsgAddr()), ESF_URGE... | TOOL | 0.878889 | 3.930447 |
e52886b3-aa80-4209-b160-9e48b31abc07 | muskan184/DSA_problem | path sum 2.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.999995 | 6.101227 |
43e2edcf-70b9-4357-8377-f12e7696c975 | meshwa27/DSA | basic pattern/pattern_14.cpp | #include<iostream>
using namespace std;
int main(){
//* * * * *
//* * * *
//* * *
//* *
//*
for(int i=5;i>=1;i--)
{
for(int j=1;j<=i;j++)
{
cout<<"* ";
}
cout<<endl;
}
return 0;
} | ALGO | 0.999014 | 3.204685 |
78b08d55-9214-45ba-a608-acc0885d81ca | trueos/trueos | contrib/llvm-project/llvm/lib/Analysis/ModuleSummaryAnalysis.cpp | #include "llvm/Analysis/ModuleSummaryAnalysis.h"
#include "llvm/ADT/ArrayRef.h"
#include "llvm/ADT/DenseSet.h"
#include "llvm/ADT/MapVector.h"
#include "llvm/ADT/STLExtras.h"
#include "llvm/ADT/SetVector.h"
#include "llvm/ADT/SmallPtrSet.h"
#include "llvm/ADT/SmallVector.h"
#include "llvm/ADT/StringRef.h"
#include "llv... | TOOL | 0.964596 | 3.740069 |
581e5328-3808-49ce-9dcf-793ace041c4b | Fisher87/leetcode | cplus/candy.cpp | // Time: O(n)
// Space: O(n)
class Solution {
public:
int candy(vector<int>& ratings) {
vector<int> candies(ratings.size(), 1);
for (int i = 1; i < ratings.size(); ++i) {
if (ratings[i] > ratings[i - 1]) {
candies[i] = candies[i - 1] + 1;
}
}
... | ALGO | 0.999998 | 6.50704 |
919a0245-18bd-44ec-ac77-824bf5e066ba | timothyshull/tools_to_remember | heapsort.cpp | #include <random>
#include <gtest/gtest.h>
#include <gmock/gmock.h>
using namespace testing;
// NOTE: this implementation
template<typename Item_type>
void sink(std::vector<Item_type>& a, int k, int n)
{
while (2 * k <= n) {
auto j = 2 * k;
if (j < n && a[j - 1] < a[j]) { ++j; }
if (a[j ... | TEST | 0.918802 | 6.718073 |
e4583d3c-5483-4e3f-befd-b6b4d3dd4b0f | sphantix/firmware-mod-kit | src/others/squashfs-3.4-cisco/lzma/CPP/Windows/FileFind.cpp | // Windows/FileFind.cpp
#include "StdAfx.h"
#include "FileFind.h"
#ifndef _UNICODE
#include "../Common/StringConvert.h"
#endif
#ifndef _UNICODE
extern bool g_IsNT;
#endif
namespace NWindows {
namespace NFile {
#if defined(WIN_LONG_PATH) && defined(_UNICODE)
#define WIN_LONG_PATH2
#endif
bool GetLongPath(LPCWSTR f... | TOOL | 0.95582 | 5.979875 |
690c0476-4e38-4a23-94de-e35b551720c0 | jvrmaia/coding4fun | uri/matematica/p1193.cpp | #include <cstdio>
#include <cstdlib>
#include <cstring>
#include <vector>
using namespace std;
int pot2(int x)
{
int ret = 1;
for (int i = 0; i < x; i++) ret *= 2;
return ret;
}
int pot16(int x)
{
int ret = 1;
for (int i = 0; i < x; i++, ret *= 16);
return ret;
}
void dec2bin(int x) {
ve... | ALGO | 0.981467 | 4.586576 |
49c5a901-c662-4705-9745-a74b263334f6 | TheFenrisLycaon/DSA-C-- | cp/CodeForces/0900-0999/952A.cpp | #include <cstdio>
int main(){
long a; scanf("%ld", &a);
printf("%ld\n", a % 2);
return 0;
}
| ALGO | 0.998995 | 3.08202 |
b3acdd71-427e-4d83-8b58-64b7d6173ba6 | yohm/sim_indirect_opinion_sync | inspect_PrivRepGame.cpp | #include <iostream>
#include <fstream>
#include <chrono>
#include <regex>
#include <vector>
#include <queue>
#include <utility>
#include <string>
#include <nlohmann/json.hpp>
#include "PrivRepGame.hpp"
void PrintInitialTimeSeries(PrivateRepGame& prg, const nlohmann::json& params, std::ostream& out = std::cout) {
siz... | TOOL | 0.966221 | 5.518653 |
58377ae1-51ec-48f5-91a4-a5ef7b404535 | ishandutta2007/codeforces | 1092515503/normal/1000/A.cpp | #include<bits/stdc++.h>
using namespace std;
int n,res;
string str;
map<string,int>m;
int main(){
cin>>n;
for(int i=1;i<=n;i++)cin>>str,m[str]++;
for(int i=1;i<=n;i++)cin>>str,m[str]--;
for(map<string,int>::iterator i=m.begin();i!=m.end();i++)res+=abs(i->second);
cout<<res/2<<endl;
return 0;
} | ALGO | 0.999813 | 3.508352 |
49b5762e-6489-41d4-8320-dafdb1a1c7ed | TonChan0828/AtCoder | ABC/ABC253/A.cpp | #include <bits/stdc++.h>
using namespace std;
using ll = long long;
template <typename T>
bool chmax(T &a, const T &b)
{
if (a < b)
{
a = b; // aをbで更新
return true;
}
return false;
}
template <typename T>
bool chmin(T &a, const T &b)
{
if (a > b)
{
a = b; // aをbで更新
return true;
}
return f... | ALGO | 0.999987 | 3.718961 |
59da5bf2-f1cc-4c04-833d-383c431b8ec3 | 9nattch/lab_15 | 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 << endl;
}
return... | ALGO | 0.991264 | 3.051544 |
ddd17593-225c-4a4a-91a7-7e06783f127f | A-Wroblewski/codelab-flutter | 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.99887 | 6.783439 |
a7cb1783-b8a9-4352-bdd9-4ab4eb8df86d | IsaacEf/LCPractice | stack/validparentheses.cpp | class Solution {
public:
bool isValid(string s) {
stack<char> stck;
for(int i = 0; i < s.length(); i++){
if(s[i] == '(' || s[i] == '[' || s[i] == '{'){
stck.push(s[i]);
}else{
if(stck.empty()){
return false;
... | ALGO | 0.998385 | 6.39383 |
401008de-de9e-4a70-b473-e106a3e2da60 | hhadzem/BosnjackaKNP | CSES/Sorting and Searching/Collecting Numbers II.cpp | #include<iostream>
#include<algorithm>
#include<vector>
using namespace std;
struct number{
int idx, value;
number(int idx, int value): idx(idx), value(value){}
};
bool compare(const number &a, const number &b){
return a.value < b.value;
}
int main(){
ios_base::sync_with_stdio(false); cin.tie(NULL);
int n; cin >> ... | ALGO | 0.999942 | 3.787666 |
ef1d172a-5346-4f4c-9fe6-432da108d667 | TianaRuiz/ComputerVision | opencv3.2/samples/cpp/tutorial_code/ShapeDescriptors/pointPolygonTest_demo.cpp | /**
* @function pointPolygonTest_demo.cpp
* @brief Demo code to use the pointPolygonTest function...fairly easy
* @author OpenCV team
*/
#include "opencv2/highgui.hpp"
#include "opencv2/imgproc.hpp"
#include <iostream>
using namespace cv;
using namespace std;
/**
* @function main
*/
int main( void )
{
/// Cr... | TEST | 0.893707 | 6.213636 |
edf82491-849f-4de9-9f2d-e8bd40a74049 | pratishkatiyar/CP_questions | Codeforces/Educational_codeforces_round/94/C.cpp | // #include "/Users/preetsardhara/Desktop/coding/stdc++.h"
#include<bits/stdc++.h>
#define ll long long
#define ld long double
#define pb push_back
#define ff first
#define ss second
#define mp make_pair
#define ins insert
#define sb substr
#define con continue
#define ub upper_bound
#define lb lower_bound
#define sp f... | ALGO | 0.999162 | 3.43017 |
df28c7f8-44ce-48bc-b0d9-05b0d0cdc3e5 | Pratyush-Shanbhag/Advanced_CPP_Programming | Ex_3_Pattern_Matching/Ex_3_Pattern_Matching.cpp |
#include <climits>
#include <string>
#include <iostream>
#include <vector>
#include <algorithm>
#include <iomanip>
#include <string>
#include <thread>
#include <map>
#include <chrono>
#include "ConsoleColor.h"
using namespace std;
using namespace std::chrono;
#define LOWER_ASCII 128
/*struct Diagnostics
{
int n... | ALGO | 0.94943 | 5.189463 |
351e68e1-1b26-458f-8803-b4d73c80288d | godgiftedboy/poki-riverpod | 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.998809 | 6.763549 |
19b5370b-9e7f-49b0-ae0c-3911c2494907 | Priyanshi3030/Leetcode_Codes | 3186-minimum-sum-of-mountain-triplets-ii/3186-minimum-sum-of-mountain-triplets-ii.cpp | class Solution {
public:
int minimumSum(vector<int>& nums) {
int n=nums.size();
vector<int> l_r(n,INT_MAX);
vector<int> r_l(n,INT_MAX);
int minil=nums[0],minir=nums[n-1],ans=INT_MAX;
for(int i=1;i<n;i++){
minil=min(minil,nums[i-1]);
l_r[i]=minil;
}
for(int i=n-2;i>=0;... | ALGO | 0.999985 | 4.834311 |
f4756c50-ce7c-428c-8151-4eb05ee800a5 | hjiang13/LLMs-in-IR | POJ-104/69/157.cpp | #include <iostream>
using namespace std;
char up[300]={
NULL}
;
char down[300]={
NULL}
;
int add1[300]={
0}
;
int add2[300]={
0}
;
int result[300]={
0}
;
void add()
{
int uplen=0, downlen=0;
uplen=strlen(up);
downlen=strlen(down);
int temp=strlen(up);
for(int i=0; i<temp; i++)
{
add1[i]=up[uplen-1]-'0';
uplen--;
}
te... | ALGO | 0.999907 | 3.44969 |
8d458b72-0a44-436b-a951-4ba6102ac806 | Vishesh-web-dev/Standard-DSA-Problems | Linked List/Questions/MiddleOfLL.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* middleNode(... | ALGO | 0.999769 | 5.715842 |
2343d6c9-d3c8-4611-97a5-a5a82d653323 | SAP/project-foxhound | gfx/graphite2/src/Justifier.cpp | #include "inc/Segment.h"
#include "graphite2/Font.h"
#include "inc/debug.h"
#include "inc/CharInfo.h"
#include "inc/Slot.h"
#include "inc/Main.h"
#include <cmath>
using namespace graphite2;
class JustifyTotal {
public:
JustifyTotal() : m_numGlyphs(0), m_tStretch(0), m_tShrink(0), m_tStep(0), m_tWeight(0) {}
v... | TOOL | 0.882525 | 5.177347 |
e0eeb509-2b96-4171-8f21-413982b1f3df | jizhang-cmu/autonomy_stack_diablo_setup | src/slam/dependency/gtsam/gtsam/3rdparty/Eigen/doc/examples/DenseBase_template_int_middleRows.cpp | #include <Eigen/Core>
#include <iostream>
using namespace Eigen;
using namespace std;
int main(void)
{
int const N = 5;
MatrixXi A(N,N);
A.setRandom();
cout << "A =\n" << A << '\n' << endl;
cout << "A(1..3,:) =\n" << A.middleRows<3>(1) << endl;
return 0;
}
| ALGO | 0.945016 | 3.245548 |
d5e14c3a-e5e0-42ea-8484-eec85ca07be8 | junsea727/myHTML | 문제1.cpp/문제2.cpp | #include <stdio.h>
int main() {
int choice;
printf("=== 가위 바위 보 게임 ===\n\n");
printf("숫자를 입력하세요.\n");
printf("0 : 가위\n");
printf("1 : 바위\n");
printf("2 : 보\n\n");
printf("당신의 선택 : ");
scanf("%d", &choice);
printf("\n결과 : ");
switch(choice) {
case 0:
p... | TOOL | 0.959754 | 5.028373 |
1a968157-fa51-4388-b614-8ee3c1efa41e | Ihtml/PAT | AdvancedLevel_C++/1024-Palindromic-Number-[大整数相加]-25.cpp | #include <algorithm>
#include <iostream>
using namespace std;
string s;
void sum(string t) {
int carry = 0, len = s.length();
for (int i = len - 1; i >= 0; i--) {
int temp = s[i] - '0' + t[i] - '0' + carry;
s[i] = temp % 10 + '0';
carry = temp / 10;
}
if (carry) s = '1' + s;
}
int main() {
int k, ... | ALGO | 0.999984 | 4.021645 |
6c52ac4c-8062-4484-8f5e-33d064845207 | chunyuema/leetcode | q1512/q1512.cpp | class Solution
{
public:
int numIdenticalPairs(vector<int> &nums)
{
unordered_map<int, int> map;
int res = 0;
for (int num : nums)
{
res += map[num];
map[num]++;
}
return res;
}
}; | ALGO | 0.99985 | 6.016243 |
634a8b34-49af-45ab-906b-dba9c5bc0f43 | mkharray/Data-Structures-and-Algorithms | 551-student-attendance-record-i/551-student-attendance-record-i.cpp | class Solution {
public:
bool checkRecord(string s) {
int a = 0;
for(int i = 0; i < s.length(); i++){
if(s[i] == 'A')
a++;
else if( (i <= s.length() - 3 ) && s[i] == 'L'){
if(s[i+1] == 'L' && s[i+2] == 'L')
return false;
}
}
return (a < 2);
}
}; | ALGO | 0.999497 | 5.434938 |
c3863cc1-67e4-41a8-a403-cb20e26cc40d | IvanSchulz/libuvccamera | src/main/jni/rapidjson/thirdparty/jsoncpp/src/jsontestrunner/main.cpp | #include <json/json.h>
#include <algorithm> // sort
#include <stdio.h>
#if defined(_MSC_VER) && _MSC_VER >= 1310
# pragma warning( disable: 4996 ) // disable fopen deprecation warning
#endif
static std::string
readInputTestFile( const char *path )
{
FILE *file = fopen( path, "rb" );
if ( !file )
ret... | TEST | 0.86605 | 6.458588 |
f0785c9f-398e-4077-9ca1-21e337724345 | purva5598/Questions-leetcode | 2181-merge-nodes-in-between-zeros/2181-merge-nodes-in-between-zeros.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* mergeNodes(... | ALGO | 0.999974 | 5.133218 |
3546125a-d5df-40dc-93e5-81f3cea6045f | HuaEdward/USACO-Bronze-Classic-Question-Answers-in-cpp | CandyCaneFeast/CandyCaneFeast/main.cpp | //
// main.cpp
// CandyCaneFeast
//
// Created by Edward Hu on 2024-05-09.
//
#include <iostream>
#include <vector>
#define int long long
using namespace std;
int normalCows[200005];
vector<int> cows[2];
int candies[200005];
signed main() {
int n, m;
cin >> n >> m;
for (int i=0; i<n; i++) {
... | ALGO | 0.999981 | 4.165839 |
7e900a0e-4fd4-4185-8217-4193a34fb7f9 | FCAS-LAB/Chiplet-Gem5-SharedMemory | gem5/src/systemc/tests/systemc/misc/gnats/pr-233/pr-233.cpp | /*****************************************************************************
pr-233.cpp --
Original Author: Martin Janssen, Synopsys, Inc., 2002-02-15
*****************************************************************************/
/*****************************************************************************... | ALGO | 0.982374 | 4.505069 |
94918009-f838-4712-a523-faa51d128fbe | connorkauf/simulicore | cla3p.mod/source/cla3p/support/utils.cpp | // this file inc
#include "cla3p/support/utils.hpp"
// system
#include <cstdio>
#include <cstring>
#include <string>
#include <cmath>
#include <algorithm>
// 3rd
// cla3p
#include "cla3p/error/exceptions.hpp"
/*-------------------------------------------------*/
namespace cla3p {
/*---------------------------------... | TOOL | 0.933495 | 5.715869 |
83707c3e-95f7-4a06-bb7c-397ffbbb9f30 | stasiiazh/praktika | exword.cpp | #include <iostream>
#include <string>
#include <unordered_set>
using namespace std;
bool canSpellWord(const string& word, const unordered_set<char>& blocks) {
unordered_set<char> usedBlocks;
for (char ch : word) {
ch = tolower(ch);
if (blocks.count(ch) == 0) {
return false;
... | ALGO | 0.999252 | 5.987459 |
4a899708-ffab-442a-b1c8-84b50b8896ae | teche74/Concept_of_Hashing_Used_in_Distributed_database | ConsistentHashing.cpp | #include<bits/stdc++.h>
using namespace std;
class ConsistentHashing{
private:
map<int , string> hash_ring;
map<string, int > data_mapping;
int hash_space;
public:
ConsistentHashing(int space_size) {
hash_space = space_size;
cout << "Consistent Hashing initialized with hash... | ALGO | 0.997863 | 6.532897 |
e6e2f0c4-e25b-44be-873f-323fc9e485c3 | dilishp/Algo-DSSolutions | SubsetProblem/SubsetProblem.cpp | // SubsetProblem.cpp : This file contains the 'main' function. Program execution begins and ends there.
//
#include "pch.h"
#include <iostream>
#include <thread>
#include <future>
#include <vector>
#include <algorithm>
#include <numeric>
void square(int number,std::promise<int>& valuePromise)
{
valuePromise.set_valu... | TOOL | 0.996852 | 5.128998 |
f13d4d6d-0150-400a-b60c-343436e04510 | samfubuki/striver-cp-problems | Greedy Algorithms/zeroarraycodeforces.cpp | #include<bits/stdc++.h>
using namespace std;
int main()
{
long long int n;
cin>>n;
long long int arr[n];
for(long long int i=0;i<n;i++)
{
cin>>arr[i];
}
long long int maxele=-1;
long long int sum = 0;
for(long long int i=0;i<n;i++)
... | ALGO | 0.999989 | 3.779515 |
3883c753-dfb3-4793-859c-5e8fb860a141 | XiaojianTang/Udacity-Path_Planning-Project | src/Eigen-3.3/doc/examples/Tutorial_ArrayClass_mult.cpp | #include <Eigen/Dense>
#include <iostream>
using namespace Eigen;
using namespace std;
int main()
{
ArrayXXf a(2,2);
ArrayXXf b(2,2);
a << 1,2,
3,4;
b << 5,6,
7,8;
cout << "a * b = " << endl << a * b << endl;
}
| ALGO | 0.991147 | 3.51756 |
84c9ea75-4a5d-4c0a-b029-cadbd7b0eff8 | gaojs/algorithm | leetcode/clang/753. 破解保险箱.cpp | #include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <limits.h>
#include <math.h>
#define MAX_COUNT 10000
int visited[MAX_COUNT] = {0};
char str[MAX_COUNT] = {0};
int len = 0;
int P = 0;
void dfs(int k, int i)
{
i -= i / P * P;
i *= 10;
for (int j = 0; j < k; ++j) {
int t = i + j;
... | ALGO | 0.999943 | 3.973895 |
3ccae6b8-8a12-4fe3-91da-dba007257e86 | biocommando/TranSynth | AdsrEnvelope.cpp | #include "AdsrEnvelope.h"
AdsrEnvelope::AdsrEnvelope() : cycleAttackDecay(false),
endReached(true), sustain(0), stage(0)
{
stages.push_back(EnvelopeStage(true));
stages.push_back(EnvelopeStage(true));
stages.push_back(EnvelopeStage(false));
stages.push_back(EnvelopeStage(... | ALGO | 0.905409 | 4.974007 |
f2e07485-d7e1-4f33-b8f7-660730858a60 | BcMbh/Portfolio | School Labs/data Struct/Lab2/Q4.cpp | #include <iostream>
#include <iomanip>
using namespace std;
int main()
{
/*
Enter value 1 : 2
Enter value 2 : 5
The effect of passing value1 by reference is : 7
The effect of passing value2 by value is : 5
*/
} | ALGO | 0.860982 | 3.779722 |
715c0d20-e124-42a0-b32b-440c9f8c0e3e | danielsal97/StarWars-simulation | Falcon.cpp | //////
////// Created by daniel salame on 30/04/2024.
//////
#include "Falcon.h"
#include <iostream>
#include <cmath>
#include <utility>
void Falcon::status(){
if (state == Dead){
cout<< "falcon " <<spaceship_Name<<" is "<<StateNames[state]<<"!!!" <<endl;
}
if (state == MovingOnCourse){
std... | TOOL | 0.926653 | 5.206162 |
f758ec06-fdd0-4d62-add7-293a984790f8 | jatakchatterjee12/practice_problems | Graph/Check if a given graph is Tree or not.cpp | // just check two things...... 1. graph contains cycle or not
// 2. all nodes are connected components or not
// ************************************** C++ ****************************************//
class Solution {
public:
bool cycleCheck(vector<int> adjG[], vector<bool> &visited, i... | ALGO | 0.998149 | 3.619859 |
30b627f0-ce89-4921-895d-306ad1ce9846 | cleamoon/OJ-submissions | kattis/trainpassengers.cpp | #include <iostream>
#include <cstdio>
#include <cstring>
#include <string>
#include <vector>
#include <algorithm>
#include <utility>
#include <climits>
#include <cstdlib>
#include <cmath>
#include <queue>
#include <map>
#include <list>
#include <map>
#include <set>
//using namespace std;
typedef long long ULL;
int ma... | ALGO | 0.99997 | 3.61177 |
8a3fcc73-52a5-4686-b857-5239d57e517f | shradhasv/LB-DSA | BintoDec.cpp | #include <iostream>
#include <math.h>
using namespace std;
int main()
{
int i, convBin = 0, k = 0;
cout << "Binary to Decimal" << endl;
cout << "Enter a number: ";
cin >> i;
while (i)
{
int rem = i % 10;
if (rem == 1)
convBin = convBin + pow(2, k);
i = i / 1... | ALGO | 0.998707 | 4.723498 |
00e7d5fd-79bb-434f-818b-f889aa841680 | Seidy-u/Atcorder | abc155/b.cpp | #include <iostream>
#include <string>
#include <vector>
#include <list>
#include <algorithm>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <unordered_map>
#include <cmath>
using namespace std;
int main(){
int n;
cin >> n;
int a[n];
for(int i=0; i<n; i++){
cin >> a[i]... | ALGO | 0.999962 | 4.395901 |
7ef43bc6-ec2c-4bdd-8a64-4d13f59a8c26 | HoijanLai/localization_and_control | MPC/src/Eigen-3.3/doc/examples/TutorialLinAlgRankRevealing.cpp | #include <iostream>
#include <Eigen/Dense>
using namespace std;
using namespace Eigen;
int main()
{
Matrix3f A;
A << 1, 2, 5,
2, 1, 4,
3, 0, 3;
cout << "Here is the matrix A:\n" << A << endl;
FullPivLU<Matrix3f> lu_decomp(A);
cout << "The rank of A is " << lu_decomp.rank() << endl;
c... | ALGO | 0.999604 | 3.720849 |
485f4386-bfec-46de-b9e0-e657682ce0da | TamimEhsan/CSES-Solutions | Additional Problems II/School Excursion.cpp | #include <bits/stdc++.h>
using namespace std;
#define ll long long
#define pii pair<int,int>
#define FASTIO ios_base::sync_with_stdio(false);cin.tie(NULL); cout.tie(NULL);
#define endl '\n'
const int N = 100006;
bitset<N> bullshit;
vector<int> adj[N];
int vis[N];
int sz;
void dfs(int u){
vis[u] = 1;
sz++;
... | ALGO | 0.999959 | 4.228709 |
98239144-7c25-4794-9661-22a12c5ccde9 | sarvesh821/DSA | Binary tree/p1.cpp | #include <iostream>
using namespace std;
class node
{
public:
int data;
node *next;
node(int data)
{
this->data = data;
this->next = NULL;
}
};
node *takeinput()
{
int data;
cin >> data;
node *head = NULL;
node *tail = NULL;
while (data != -1)
{
node ... | ALGO | 0.999911 | 4.583663 |
7afb528e-9424-4417-b350-3aff717f3508 | jaywangpku/Algorithm | 暑假刷题/7月20日/字符串匹配.cpp | #include <bits/stdc++.h>
using namespace std;
int main()
{
string s, sub;
cin >> sub >> s;
int pos = 0;
int key = 1;
while(key!=-1){
key = s.find(sub, pos);
if(key!=-1){
cout << key+1 << endl;
pos = key + 1;
}
}
return 0;
}
| ALGO | 0.999677 | 3.753571 |
9d373c49-d652-4e14-b61f-91010d8d3b8c | tgargula/AGH | archive/Sem1/WDI/Cwiczenia04/c04z10s.cpp | /*
10.Napisać funkcję która dla tablicy typu int t[MAX][MAX],wypełnionej liczbami całkowitymi, zwraca wartość true w przypadku, gdy w każdym wierszu i każdej
kolumnie występuje conajmniej jedno 0 oraz wartość false w przeciwnym przypadku.
*/
#include<bits/stdc++.h>
using namespace std;
const int MAX = 10;
int t[MAX]... | ALGO | 0.986767 | 4.519984 |
05015c51-cdb9-44eb-bd2a-3bd3de3ce379 | boys01/sample | Text/prac2_bubble_sort.cpp | #include <stdlib.h>
#include <stdio.h>
#include <iostream>
#include <omp.h>
#include <time.h>
#include <vector>
#include <chrono>
using namespace std;
using namespace std::chrono;
int main()
{
vector<int> a;
for (int i = 0; i < 10000; i++)
a.push_back(rand());
auto start = high_resolution_clock::no... | ALGO | 0.99983 | 3.994079 |
8c248799-d4c2-4ea5-bd63-33a1105f0f94 | manish-kumar1/LeetCode-Problems | OOPs/Struct_Rectangle.cpp | #include<iostream>
using namespace std;
struct Rectangle{
int length;
int width;
int display(int l, int w){
this->length = l;
this->width = w;
int ans = length * width;
return ans;
}
};
int main(){
int length, width;
cout << "Enter the value of higth : " ;
c... | TOOL | 0.972073 | 4.072875 |
36a8e95c-b643-4a74-9f36-bbec6fed0c08 | jiangyc2024/NumCSE | LectureCodes/NumQuad/trapezoidal/Eigen/main.cpp | #include "trapezoidal.hpp"
#include <iostream>
int main() {
auto f = [](double x) { return x * x; };
auto g = [](double x) { return 10 * x; };
const double a = 0, b = 1;
const unsigned N = 1000;
for (unsigned n = 2; n < N; n *= 4) {
std::cout << "=========== " << n << " steps ==========\n";
std::cou... | ALGO | 0.99899 | 6.030081 |
75b0e9ee-4bb0-482c-a4c0-b01aa1cdf517 | LDFINA01/NeuralNetwork | Eigen3/doc/examples/TutorialLinAlgExSolveColPivHouseholderQR.cpp | #include <iostream>
#include <Eigen/Dense>
using namespace std;
using namespace Eigen;
int main()
{
Matrix3f A;
Vector3f b;
A << 1,2,3, 4,5,6, 7,8,10;
b << 3, 3, 4;
cout << "Here is the matrix A:\n" << A << endl;
cout << "Here is the vector b:\n" << b << endl;
Vector3f x = A.colPivHouseholderQr... | ALGO | 0.999945 | 3.347913 |
e587c5ae-27f5-4999-b5d9-296d3ebcd702 | guilherme8426/Maratona | Outros/botas.cpp | //https://olimpiada.ic.unicamp.br/pratique/p2/2017/f1/botas/
#include <bits/stdc++.h>
using namespace std;
int main() {
vector <int> d(31, 0);
vector <int> e(31, 0);
int n, aux, s=0;
char p;
cin >> n;
for(int i=0; i< n; i++){
cin >> aux >> p;
aux-=30;
if(p == ... | ALGO | 0.999598 | 3.698886 |
8a2cc36c-c1b4-4234-916a-4007b45401f6 | charliehuang09/Xcamp-Bronze | Incompleted/Not a Cheap String.cpp | //#include <iostream>
//#include <vector>
//#include <set>
//#include <cstring>
//#include <map>
//#include <queue>
//#include <algorithm>
//using namespace std;
//
//struct sorted_{
// int index;
// int value;
//};
//
//bool compare(sorted_ x, sorted_ y){
// return x.value > y.value;
//}
//
//void solve(){
//... | ALGO | 0.999583 | 4.772543 |
d3e59893-1264-4427-8181-550047b36482 | prabhatsuman/Leetcode-Submissions | 0230-kth-smallest-element-in-a-bst/0230-kth-smallest-element-in-a-bst.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.999989 | 6.433281 |
637b94c2-48e1-4a1f-b549-24ee0a79e3dd | ishandutta2007/codeforces | heart_blue/normal/1714/B.cpp | #include <cstdlib>
#include <cctype>
#include <cstring>
#include <cstdio>
#include <cmath>
#include <algorithm>
#include <vector>
#include <string>
#include <iostream>
#include <sstream>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <fstream>
#include <numeric>
#include <iomanip>
#include <bi... | ALGO | 0.998999 | 3.613698 |
6a4cb2bd-90c7-469d-89e4-b89de66da52d | capnmav77/Core-Programming | STL/DSA/Graph/Disjoint Set/Validate Binary Tree Nodes.cpp | /*
MY YOUTUBE VIDEO ON THIS Qn : https://www.youtube.com/watch?v=FfA-2CrWVJw
Company Tags : META
Leetcode Link : https://leetcode.com/problems/validate-binary-tree-nodes/description/
*/
/*
Find another Binary Tree Solution - https://github.com/MAZHARMIK/Interview_DS_Algo/bl... | ALGO | 0.999847 | 7.230077 |
6e70dba3-4404-41f7-981c-6e7f7e2a4015 | mohitmallick17/LeetCodeSolutions | 2276-count-integers-in-intervals/2276-count-integers-in-intervals.cpp | class CountIntervals {
map<int, int> mp;
int cnt;
public:
CountIntervals() {
cnt=0;
}
void add(int left, int right) {
auto it = mp.upper_bound(left);
if(it!=begin(mp) and prev(it)->second>=left)it=prev(it);
while(it != end(mp) and it->first <= right){
... | ALGO | 0.999977 | 5.921038 |
c6682201-1c6d-4482-aaf6-6b4c9003df29 | Sameer-r35/DSA_LAB | Linear Search/problem_6.cpp | #include <iostream>
using namespace std;
int main(){
int accounts[2][3] = {
{1, 2, 3},
{3, 2, 1}
};
int m = 2;
int n = 3;
int maxWealth = 0;
for (int i = 0; i < m; i++) {
int currentWealth = 0;
for (int j = 0; j < n; j++) {
currentWealth = current... | ALGO | 0.996749 | 4.182407 |
7a8bafde-13d6-466c-900f-702a8aea1adf | ishandutta2007/codeforces | gnomina007/normal/1408/H.cpp | #include<vector>
#include<iostream>
#include<fstream>
#include<string>
#include<cassert>
#include<algorithm>
#include<random>
#include<map>
#include<set>
#include <bitset>
#include<queue>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> pii;
typedef pair<ll, int> pli;
... | ALGO | 0.999908 | 4.377646 |
f872fb6e-dd06-4a41-b21f-c1de0a5cafb1 | raincross7/code-similarity | codes/train_code/problem034/problem034_417.cpp | #include<bits/stdc++.h>
#define ll long long
#define all(a) a.begin(),a.end()
#define sz(a) a.size()
#define re return
#define MP make_pair
#define pb push_back
#define pii pair<int,int>
#define se second
#define fi first
using namespace std;
ll gcd(ll a,ll b){
if(!b) re a;
else re gcd(b,a%b);
}
ll lcm(ll a,ll b){
... | ALGO | 0.999982 | 5.243315 |
6bc6a134-8fbe-401b-97e1-d7fffe3b670c | PetterS/curve_extraction | thirdparty/Eigen/doc/special_examples/Tutorial_sparse_example.cpp | #include <Eigen/Sparse>
#include <vector>
typedef Eigen::SparseMatrix<double> SpMat; // declares a column-major sparse matrix type of double
typedef Eigen::Triplet<double> T;
void buildProblem(std::vector<T>& coefficients, Eigen::VectorXd& b, int n);
void saveAsBitmap(const Eigen::VectorXd& x, int n, const char* file... | ALGO | 0.997946 | 5.464163 |
b8524328-bd54-42c9-8519-1f8aa7574fa6 | yiqianl/Parallelization-Artifact-SC23 | codes/cpp/sssp-cpp/SSSP_CPP_V_Topo_Push_IntType_ReadModifyWrite_NonDeterm_NoBoundsBug_Block_Atomic_NoRangeBug.cpp | typedef int data_type;
#include "sssp_vertex_cpp.h"
static void init(const int src, data_type* const dist, const int size)
{
// initialize arrays
for (int v = 0; v < size; v++) {
const data_type temp = (v == src) ? 0 : maxval;
dist[v] = temp;
}
}
static void sssp(const ECLgraph g, data_type* const dist,... | ALGO | 0.999853 | 4.350761 |
130667db-7f59-440b-9796-bf81e1f899b5 | IngenuityCoin/Ingenuity | src/crypto/sha1.cpp | #include "crypto/sha1.h"
#include "crypto/common.h"
#include <string.h>
// Internal implementation code.
namespace
{
/// Internal SHA-1 implementation.
namespace sha1
{
/** One round of SHA-1. */
void inline Round(uint32_t a, uint32_t& b, uint32_t c, uint32_t d, uint32_t& e, uint32_t f, uint32_t k, uint32_t w)
{
... | ALGO | 0.998394 | 7.492003 |
51b0a0d0-ae87-4fc2-a005-2cf12b852161 | AskatAsh/Cpp-programming | Basic Cpp/condition.cpp | #include<bits/stdc++.h>
using namespace std;
int main(){
int x,y;
cin>>x>>y;
if(x>y){
cout<<x<<" is the greatest"<<endl;
}
else if(y>x){
cout<<y<<" is the greatest"<<endl;
}
else{
cout<<x<<" and "<<y<<" are equal"<<endl;
}
} | ALGO | 0.999925 | 3.336537 |
9e65f408-0c0a-40bd-8bd0-123573eebcf5 | vaibhavraz4816/Java | CG_Final/scanFill.cpp | #include<iostream>
#include<graphics.h>
#include<math.h>
using namespace std;
struct Point {
int x, y;
};
void scanlineFill(Point* polygon, int n) {
int ymin = polygon[0].y;
int ymax = polygon[0].y;
for(int i = 1; i < n; i++) {
if(polygon[i].y < ymin) {
ymin = polygon[i].y;
... | ALGO | 0.999271 | 4.527241 |
3161841b-5375-4f34-8508-7fbd47f4f74a | slyjain/CP | Graph/CompleteTheGame.cpp | #include<bits/stdc++.h>
using namespace std;
#define int long long
int n,m;
vector<vector<int>>g;
vector<int>ways;
vector<int>vis;
int bfs(int start,int way){
ways[start]=way;
vis[start]=1;
queue<int>q;
q.push(start);
while(!q.empty()){
int curr=q.front();
q.pop();
for(auto v... | ALGO | 0.999894 | 4.511052 |
e567fa97-5641-4c46-8219-765a24bf5296 | Mahone-h/leetcode | leetcode/editor/cn/154-find-minimum-in-rotated-sorted-array-ii.cpp | //已知一个长度为 n 的数组,预先按照升序排列,经由 1 到 n 次 旋转 后,得到输入数组。例如,原数组 nums = [0,1,4,4,5,6,7] 在变
//化后可能得到:
//
// 若旋转 4 次,则可以得到 [4,5,6,7,0,1,4]
// 若旋转 7 次,则可以得到 [0,1,4,4,5,6,7]
//
//
// 注意,数组 [a[0], a[1], a[2], ..., a[n-1]] 旋转一次 的结果为数组 [a[n-1], a[0], a[1], a[2],
//..., a[n-2]] 。
//
// 给你一个可能存在 重复 元素值的数组 nums ,它原来是一个升序排列的数组,并按上述情形... | ALGO | 0.999989 | 6.13551 |
6f27d3b8-08e4-43f1-b3d0-d8b362e963c6 | Sudip-329/Leet_Code_Solution | 905_Sort_Array_By_Parity.cpp | #include<iostream>
#include<vector>
using namespace std;
class Solution {
public:
vector<int> sortArrayByParity(vector<int>& nums) {
int j=0;
for(int i=0;i<nums.size();i++)
{
if(nums[i]%2==0)
swap(nums[j++],nums[i]);
}
//return nums;
for(int... | ALGO | 0.999922 | 5.201983 |
20f60535-8875-41bf-8fc6-e18993bed3c4 | InigoGutierrez/AceptaElReto | c/511_Houston.cpp | #include <iostream>
using namespace std;
int main() {
int groupsA, groupsB; // Grupos totales de cada vector
int iA, iB; // Índices para iterar por los vectores de grupos y valores
double step, total; // Cuántos valores van a sumarse en un solo paso y suma total
cout.precision(0);
while (cin >> groupsA && !cin.e... | ALGO | 0.999806 | 3.401958 |
96910a66-5d47-4fb6-aa5f-0ac4c732b98e | neelchoudhury/cp | Codechef and Spoj/1-K/EMITL.cpp | #include<bits/stdc++.h>
#define ll long long int
#define ios ios_base::sync_with_stdio(false)
#define mem(a) memset(a,0,sizeof(a))
#define inf 9999999999999999
#define smoke first
#define colour second
#define sc(a) scanf("%lld",&a)
#define pr(a) printf("%lld\n",a)
#define MOD 1000000007
using namespace std;
char s[... | ALGO | 0.999898 | 3.717426 |
5e2a5a24-2630-4fce-8b69-dd53ce5aae0a | Yleisnero/ProgrammingStuff | WiSe1819/AD/Uebung5/Aufgabe1.cpp | #include <iostream>
void print(int *a, int length);
void mergeSort(int *a, int first, int length);
void merge(int *a, int first, int length, int mid);
void heapSort(int *, int, int);
void heapify(int *, int, int);
void buildMaxHeap(int *, int);
void swap(int &, int &);
int main() {
int a[] = {-5, 12, -32, 7, -... | ALGO | 0.99997 | 4.510265 |
24baa6e3-df95-4126-81c9-509749b76b7f | Mehedi-CoU-12/CP-Repository | Graph/dijkstra's_algo.cpp | #include<bits/stdc++.h>
using namespace std;
int main()
{
int n,edge,source;
cin>>n>>edge>>source;
vector<vector<pair<int,int>>>g(n+1);
for(int i=0;i<edge;i++)
{
int u,v,weight;
cin>>u>>v>>weight;
g[u].push_back({v,weight});
g[v].push_back({u,weight});
}
... | ALGO | 0.999995 | 3.887322 |
06d6df70-6aaa-451b-ad17-f3ab63b0e46a | TuliDas/Problem_Solving-Source_Code | UVA Solutions/UVA 336 - A Node Too Far.cpp | // Problem Name: UVA 336 - A Node Too Far
// Problem Link : https://onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&category=24&page=show_problem&problem=272
// Verdict : Accepted
// Language : C++11
// Solved on : 2017-09-11
#include<bits/stdc++.h>
using namespace std;
vector <int> VV[1000000];
queue < i... | ALGO | 0.999624 | 4.778359 |
3054b610-576a-4774-bbb9-ceb46014df54 | xidianlina/cpp | eighteen_lambda1.cpp | //#include <iostream>
//#include <vector>
//#include <algorithm>
//#include <cmath>
//#include <ctime>
//
//const long Size = 390000L;
//
//int main()
//{
// using std::cout;
// std::vector<int> numbers(Size);
//
// std::srand(std::time(0));
// std::generate(numbers.begin(), numbers.end(), std::rand);
// cout << "Sampl... | ALGO | 0.989546 | 3.518067 |
3e24dad4-d1dc-4c88-a197-74ac91490193 | Royal-Conquest/rocon-studio | engine/examples/15_animate/Collision.cpp | #include "Collision.hpp"
#include "ECS/ColliderComponent.hpp"
bool Collision::AABB(const SDL_Rect &recA, const SDL_Rect &recB)
{
return SDL_HasIntersection(&recA, &recB);
}
bool Collision::AABB(const ColliderComponent &colA, const ColliderComponent &colB)
{
// return AABB(colA.collider, colB.collider);
if (AABB... | TOOL | 0.956405 | 6.038759 |
06910736-8bc6-4dfd-8ad2-822c9c987bf5 | SoltiHo/LeetRepository | Unique_Binary_Search_Trees_II/Unique_Binary_Search_Trees_II_ULT/Unique_Binary_Search_Trees_II_ULT.cpp | #include "gtest/gtest.h" // access test macro
#include "Unique_Binary_Search_Trees_II.h"
TEST(Leet, Basic02){
Solution_DP sol;
sol.generateTrees(5);
}
TEST(Leet, Basic01){
Solution_DP sol;
sol.generateTrees(4);
}
// --------------------------------------------------------------------
| TEST | 0.952173 | 5.904256 |
9db1536f-04bd-4b84-8947-985f729e04b8 | koicy-ly/koicy-ly.github.io | assets/code/P3177.cpp | #include<bits/stdc++.h>
#define ll long long
using namespace std;
const int N=2010;
inline ll read(){
ll x=0;int f=1;char ch=getchar();
while(ch<'0'||ch>'9'){if(ch=='-')f=-1;ch=getchar();}
while(ch>='0'&&ch<='9'){x=(x<<3)+(x<<1)+(ch^48);ch=getchar();}
return x*f;
}
struct shaha{
int w,to,next;
}e[N<<1];
int... | ALGO | 0.99992 | 3.474438 |
b99f1c1c-c359-42f0-a07a-b7684ca6256f | SAOSP-M/platform_system_core | adb/jdwp_service.cpp | /* implement the "debug-ports" and "track-debug-ports" device services */
#define TRACE_TAG TRACE_JDWP
#include "sysdeps.h"
#include <errno.h>
#include <stdio.h>
#include <string.h>
#include <unistd.h>
#include "adb.h"
/* here's how these things work.
when adbd starts, it creates a unix server socket
named ... | TOOL | 0.929729 | 7.238371 |
28a4bb91-e4f9-41ba-b4c0-491e89de2c9b | jarvisye01/algorithm | leetcode_practice/20230228_33/solution.cpp | #include <stdio.h>
#include <vector>
using std::vector;
class Solution
{
public:
int search(vector<int>& nums, int target)
{
int left = 0, right = nums.size() - 1;
int idx = -1;
while (left <= right)
{
int mid = left + (right - left) / 2;
if (nums[mid] =... | ALGO | 0.999989 | 5.744797 |
9762d28c-c60f-4aa0-be77-016f603689b7 | kristianmeyerr/suneigen | thirdparty/sundials/src/sunmatrix/magmadense/sunmatrix_magmadense.cpp | #include <algorithm>
#include <sunmatrix/sunmatrix_magmadense.h>
#if defined(SUNDIALS_MAGMA_BACKENDS_CUDA)
#include "sundials_cuda.h"
#include "dense_cuda_kernels.cuh"
using namespace sundials::sunmatrix_gpudense::cuda;
#define SUNDIALS_HIP_OR_CUDA(a,b) b
#elif defined(SUNDIALS_MAGMA_BACKENDS_HIP)
#include "sundial... | TOOL | 0.91644 | 7.168561 |
c18f96fd-8000-4518-9ad2-6813fc50474e | HodongMan/professional-cpp-4th-ed | c20_code/03_Random/05_generate_function.cpp | #include <iostream>
#include <random>
#include <algorithm>
#include <functional>
#include <vector>
#include <ctime>
using namespace std;
void fillVector(vector<int>& vec, const std::function<int()>& generator)
{
generate(begin(vec), end(vec), generator);
}
//template<typename T>
//void fillVector(vector<int>& vec, ... | TOOL | 0.971357 | 4.478489 |
07e2aef8-033c-4934-9260-95e81ece088b | ctzsm/Tsunemori-Akane | LightOJ/1000-1099/1083.cpp | #include <stack>
#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <algorithm>
using namespace std;
int n, a[30005];
int solve() {
scanf("%d", &n);
for (int i = 1; i <= n; ++i) scanf("%d", &a[i]);
int ans = 0;
a[0] = a[n + 1] = 0;
stack<int> s; s.push(0);
for (int i = 1; i <= n + 1; ++i) {
whil... | ALGO | 0.999757 | 3.769221 |
3550b493-ed9f-4d39-b647-f3d158bb01e0 | connieya/cpp_algorithm | solved/silver4/2217.cpp | #include "bits/stdc++.h"
using namespace std;
int main()
{
ios_base::sync_with_stdio(0);
cin.tie(0);
cout.tie(0);
int n, res =0;
cin >> n;
vector<int> arr(n);
for (int i = 0; i < n; ++i) {
cin >> arr[i];
}
sort(arr.begin(),arr.end(), greater<int>());
for (int i = 0; i <... | ALGO | 0.999549 | 3.752096 |
52048632-8a22-4589-ae1b-0590b484e036 | vaughn-k/Algorithm | graph/bfs/bj2644.cpp | /*
25m
가족간 촌수를 계산하는 문제.
그래프 - bfs
*/
#include <iostream>
#include <vector>
#include <queue>
using namespace std;
int n;
int t1,t2;
int k;
int tmp1,tmp2;
vector<vector<int> > v;
int visited[102];
// v[3][4] : 3은 4의 부모이다.
queue<int> q1;
queue<int> q2;
int family(){
q1 = q2;
while(!q2.empty()){
q2... | ALGO | 0.99997 | 4.060038 |
0f137792-81e9-4fe5-9c5c-b3b69921c014 | isaaclo97/programacion-competitiva | Problemas/UVA/920.cpp | #include <bits/stdc++.h>
#define INF 0x3f3f3f3f
#define EPS 1e-18
#define PI acos(-1.0)
using namespace std;
struct point{
double x,y;
point(){x=y=0;}
point(double _x,double _y){x=_x,y=_y;}
bool operator <(point other) const{
if (fabs(x-other.x)>EPS)return x<other.x;
return y<othe... | ALGO | 0.999796 | 4.087986 |
97e88884-8991-4ea8-be04-b9c9b97a8f87 | Goodnameisfordoggy/College-assignment | algorithmsAnalysisAndDesign/实验/实验一 递归算法和分治法相关项目操作/递归.cpp | /***
* @Author: HDJ
* @StartDate: please fill in
* @LastEditTime: 2024-05-20 10:15:47
* @FilePath: \c++\algorithmsAnalysisAndDesign\ʵ\ʵһ ݹ㷨ͷηĿ\ݹ.cpp
* @Description:
* @
* @ * д¥дּ䣬дּԱ
* @ * ԱдóǮ
* @ * ֻߣ
* @ * ոգ긴ꡣ
* @ * ԸԼ䣬ԸϹϰǰ
* @ * ۱ȤгԱ
* @ * Ц߯ЦԼ̫
* @ * ƯãĸóԱ
* @Co... | ALGO | 0.999992 | 6.151082 |
b7018344-fd6c-4d28-9557-7a55931ae86e | yefengdanqing/my_leetcode_algorithm | 257.二叉树的所有路径.cpp | /*
* @lc app=leetcode.cn id=257 lang=cpp
*
* [257] 二叉树的所有路径
*/
// @lc code=start
/**
* 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),... | ALGO | 0.99991 | 6.451668 |
baa17e47-2bda-462a-9c29-ecd979ea21f3 | vatsayash/CodeForces | CF674/C_Increase_and_copy.cpp | #include <bits/stdc++.h>
#include <iterator>
#include <vector>
#include <algorithm>
#include <iomanip>
#include <math.h>
using namespace std;
#define vi vector<int>
#define vvi vector<vector<int> >
#define vl vector<long long>
#define vc vector<char>
#define vvc vector<vector<char> >
#define vpi vector<pair<int,int>... | ALGO | 0.999909 | 4.767954 |
7ad983e8-8906-4f5a-a517-ec206355f0e6 | desResLab/tulip | src/tools/uqCore/todo/uqAlgorithmOMP.cpp | # include "uqAlgorithmOMP.h"
// ===========
// CONSTRUCTOR
// ===========
uqAlgorithmOMP::uqAlgorithmOMP(){
}
// ====================================================================================
// Initialize Weights From Measurement Matrix: Returns the Squared of the Weight Matrix
// =============================... | ALGO | 0.999863 | 4.813103 |
5abd0772-6db7-4a67-8043-477c2180aee1 | HeihaSourire/Simulation_of_Ecosytem | Capteur/Yeux.cpp | #include "Yeux.h"
#include "Capteur.h"
#include <cmath>
#include <math.h>
#include <cstdlib>
#include <iostream>
Yeux::Yeux(){
champAngulaire = 0;
distance = 0;
capaciteDetection = 0;
}
Yeux::Yeux(double champAngulaire, double distance, double capaciteDetection){
this ->champAngulaire = champAngulaire... | TOOL | 0.976466 | 4.309205 |
fd68df8e-a2f4-4456-a04d-cbe27e8aefc8 | simonpcook/or1k-llvm-project | libcxxabi/src/cxa_vector.cpp | #include "cxxabi.h"
#include <exception> // for std::terminate
namespace __cxxabiv1 {
#if 0
#pragma mark --Helper routines and classes --
#endif
namespace {
inline static size_t __get_element_count ( void *p ) {
return static_cast <size_t *> (p)[-1];
}
inline static void __set_elemen... | TOOL | 0.871284 | 7.722717 |
ea38b60c-0852-4348-bb99-83c7da79f63a | AgarPiyush/Spoj | RANHAN.cpp | #include<stdio.h>
#include<math.h>
int main()
{
long long int a[100],t,n,i;
a[1]=2;
for(i=2;i<=35;i++)
a[i]=a[i-1]+6*(long long int)pow(3,i-2);
scanf("%lld",&t);
while(t--)
{
scanf("%lld",&n);
printf("%lld\n",a[n]);
}
}
| ALGO | 0.999943 | 3.281864 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.