uuid string | repo_name string | relative_path string | content string | category string | algo_rel_score float64 | quality_score float64 |
|---|---|---|---|---|---|---|
351a7a8f-0621-49f0-b790-84810766e809 | adityad85/Algorithms | Muses/SwapArr.cpp | #include <bits/stdc++.h>
// #include "stdafx.h"
// #pragma warning(disable : 4996) //_CRT_SECURE_NO_WARNINGS
using namespace std;
#define gc getchar_unlocked
#define fo(i,n) for(i=0;i<n;i++)
#define Fo(i,k,n) for(i=k;k<n?i<n:i>n;k<n?i+=1:i-=1)
#define ll long long
#define si(x) scanf("%d",&x)
#define sl(x) scanf("%lld"... | ALGO | 0.999911 | 3.096091 |
7842d5be-249f-4cfa-b2ee-0df8d4a875ec | 0SillyMonkey0/aoapc | rails.cpp | #include <iostream>
#include <stack>
#include <vector>
using namespace std;
int main()
{
int n;
while(cin >> n, n !=0)
{
stack<int> s;
vector<int> target(n + 1);
for(int i = 1; i <= n; i++)
cin >> target[i];
int current = 1;
for(int i = 1; i <= n; i++)
{
s.push(i);
while(!s.empty() && s.top() =... | ALGO | 0.999887 | 3.675933 |
02262ec1-7de8-476a-83d5-8e2533e68bcd | kartikdhari15/LEETCODE | 0002-add-two-numbers/0002-add-two-numbers.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* addTwoNumbe... | ALGO | 0.99993 | 6.312246 |
2121c8d5-27f4-4045-89f8-27b553dcbda6 | OscarUngsgard/Cpp-Monte-Carlo-Value-at-Risk-Engine | src/ValuationFunctions/ClosedFormFunctions/EquityDerivativeFunctions/EquityForwardFunction.cpp | #include "EquityForwardFunction.h"
#include <cmath>
EquityForwardFunction::EquityForwardFunction(std::string uniqueIdentifier_, int nominal_, double S0_, double r_, double d_, double TTM_, double strike_) : r(r_), S(S0_), d(d_), valuationFunction(uniqueIdentifier_, TTM_, nominal_), strike(strike_)
{
}
void EquityForwa... | ALGO | 0.99319 | 6.014485 |
b6740bda-4fd2-4922-b07a-6b565d1489d1 | namecheker/module-4-assignment | bassic concepts/1.1.cpp | /*
1. Write a program to find the multiplication values and the cubic values using inline function
*/
#include<iostream>
using namespace std;
class A{
public:
inline void multiplication(int x){
cout<<" Multiplication value of "<<x<<" is "<<x*x;
}
inline void qubic(int x){
cout<<" cubic value of "<<x<<" is... | TOOL | 0.975341 | 5.140643 |
5ae1de8f-582a-41e5-b6f3-087e2bf52781 | ayyappareddynandipati/GFG | Difficulty: Hard/Find median in a stream/find-median-in-a-stream.cpp | class Solution {
public:
vector<double> getMedian(vector<int> &nums) {
// code here
priority_queue<int> left; // max-heap
priority_queue<int, vector<int>, greater<int>> right; // min-heap
vector<double> result;
for (int num : nums) {
if (left.empty() || num... | ALGO | 0.999997 | 6.442035 |
195a4c37-0aa5-4104-908a-9f8c8d2850a1 | TonChan0828/AtCoder | BootCampForBeginners/3_hard100/ex028.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.999898 | 4.158255 |
345a1c1a-4fda-4a12-81b6-e234380158db | ssubrt/Leetcode-pots | June-29/All Ancestors of a Node in a Directed Acyclic Graph.cpp | ------------->>>>>>>>>>>>>>>> Approach <<<<<<<<<<<<<<<<<<<<---------------------------
// time complexity is ( O(n ⋅ (n + m)) )
// space complexity O(n)
class Solution {
public:
vector<vector<int>> getAncestors(int n, vector<vector<int>>& edges) {
vector<vector<int>> res(n);
vector<vector<int>> gr... | ALGO | 0.999992 | 6.546988 |
1a52f6fc-b0c4-419f-9b24-12fd9c982666 | yoonkeen88/codetree-TILs | 240130/전화번호 바꾸기/change-phone-number.cpp | #include <iostream>
#include <string>
using namespace std;
int main() {
int w, b, c;
char z;
string a ="010";
cin >> w >> z >> b >> z >> c;
cout << a << z << c << z <<b;
// 여기에 코드를 작성해주세요.
return 0;
} | ALGO | 0.967668 | 3.246006 |
da9a2686-faaf-453b-8383-5c9032aaec4f | AleBerta311/NumericalSimulation | Code/nsl_simulator/NSL_SIMULATOR/SOURCE/random.cpp | /****************************************************************
*****************************************************************
_/ _/ _/_/_/ _/ Numerical Simulation Laboratory
_/_/ _/ _/ _/ Physics Department
_/ _/_/ _/ _/ Universita' degli Studi di Milano
_/ _/ ... | TOOL | 0.988817 | 3.159069 |
3aa12d01-b0b1-44f2-ba02-dbc267e67956 | GitEasonXu/CarND-MPC-Project | src/Eigen-3.3/doc/examples/tut_arithmetic_matrix_mul.cpp | #include <iostream>
#include <Eigen/Dense>
using namespace Eigen;
int main()
{
Matrix2d mat;
mat << 1, 2,
3, 4;
Vector2d u(-1,1), v(2,0);
std::cout << "Here is mat*mat:\n" << mat*mat << std::endl;
std::cout << "Here is mat*u:\n" << mat*u << std::endl;
std::cout << "Here is u^T*mat:\n" << u.transpo... | ALGO | 0.998582 | 3.810731 |
91ca27e0-3879-45f2-a149-abb688bba8c6 | sahlet-official/trainings | CSES/Introductory Problems/1070 Permutations/main.cpp | #include <iostream>
#include <bits/stdc++.h>
using namespace std;
void solve()
{
int n = 0;
std::cin >> n;
if (n == 2 || n == 3)
{
cout << "NO SOLUTION";
return;
}
for (size_t i = 1; i <= n / 2; i++)
{
std::cout << (i + n / 2) << " " << i << " ";
}
if (n ... | ALGO | 0.999831 | 3.683149 |
98f22b80-d72d-419d-8510-acffbcf699f2 | Bhawna11agg/Competitive | Dynamic Programming/Maximun Subarray.cpp |
//https://leetcode.com/problems/maximum-subarray/
class Solution {
public:
int maxSubArray(vector<int>& nums) {
int count=0,min=INT_MIN;
for(int i=0;i<nums.size();i++){
count+=nums[i];
if(count<0){
count=0;
continue;
}
... | ALGO | 0.999896 | 6.201103 |
7088b268-965b-48bc-a762-4da18304dd32 | jaybee-117/CPP_Projects | Reference_Practice/Reference_Practice.cpp | #include <iostream>
using namespace std;
void division_algorithm(int divisor, int dividend, int "ient, int &remainder);
int main(){
int divisor, dividend, quotient, remainder;
cout<<"Enter dividend:";
cin>>dividend;
cout<<"Enter divisor:";
cin>>divisor;
division_algorithm(divisor,dividend,quotient,remai... | ALGO | 0.997948 | 3.539003 |
22d35492-5afc-4f39-8021-51d67b66e974 | AIMROM/system_core_old | base/logging.cpp | #if defined(_WIN32)
#include <windows.h>
#endif
#include "android-base/logging.h"
#include <fcntl.h>
#include <libgen.h>
#include <time.h>
// For getprogname(3) or program_invocation_short_name.
#if defined(__ANDROID__) || defined(__APPLE__)
#include <stdlib.h>
#elif defined(__GLIBC__)
#include <errno.h>
#endif
#if... | TOOL | 0.918239 | 7.021108 |
8f69b085-27c4-414c-a893-a6164c17209f | JingHanLiao/UVA | 591/591.cpp | #include<iostream>
#include<string>
#include<iomanip>
#include<cstdlib>
#include<cmath>
#include<cctype>
using namespace std;
int main()
{
int num;
while( cin >> num )
{
int input=0;
int arry[num];
if( num == 0 )
{
break;
}
for( int i=0 ; i <... | ALGO | 0.9994 | 3.108559 |
e89832d1-517f-41d3-b061-c996b728dfe7 | Biplab77/All-C-PROGRAMS | DAA Biplab Shing Rathour/Selection Sort.cpp | #include <stdio.h>
void printArray(int arr[], int size) {
for (int i = 0; i < size; i++) {
printf("%d ", arr[i]);
}
printf("\n");
}
int main() {
int n, key, count = 0;
printf("Enter the number of elements in the array: ");
scanf("%d", &n);
int arr[n];
printf("Enter %d elemen... | ALGO | 0.999891 | 3.801171 |
382069d4-fcd8-40b2-a572-ec927a790bc2 | StanleyJo-37/competitive-programming-chatbots-comprasion | submissions/chatgpt/sub33.cpp | #include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
int main() {
ios::sync_with_stdio(false); // Fast IO
cin.tie(nullptr);
int t;
cin >> t;
while (t--) {
int n, k;
cin >> n >> k;
vector<int> h(n);
for (int i = 0; i < n; ++i) cin >> h[i];
... | ALGO | 0.999949 | 5.189877 |
7e479858-5bdd-4884-8855-b22d441812b6 | ishandutta2007/codeforces | riverwalk7/normal/1369/F.cpp | #include <iostream>
#include <fstream>
#define MAXN 100100
using namespace std;
typedef long long ll;
ll s[MAXN], e[MAXN];
int T;
bool f(ll a, ll b, bool c)
{
if(!c)
{
if(a > b/2)
{
return true;
}
else
{
b = b/2;
}
}
while(true)
... | ALGO | 0.999966 | 3.608977 |
a6c7e423-49c9-409e-b5f6-9c176cdbc31d | MarkMrLi/Scan_system | scan.cpp | #include "scan.h"
struct FileInfo {
char name[MAX_PATH_LENGTH]; // 文件或目录的名称
time_t lastModified; // 最后修改时间,以秒为单位
SYSTEMTIME stLocal;
long fileSize; // 文件大小,以字节为单位
};
scan::scan(char *pa,Widget *widgetInstance) {this->path = pa;this->widget = widgetInstance;}
void scan::traverseDirectory(TreeNode *roo... | TOOL | 0.929168 | 3.778475 |
abfb48f9-cffc-4708-9ea9-c3d08a089ec6 | ishandutta2007/codeforces | bluediamond/normal/534/F.cpp | #include <bits/stdc++.h>
using namespace std;
int n,m,a[5],b[20],cnt_groups[1<<5],wanted_row_states,what[20];
int vis_mask[21][161051+1];
int get_val(int row_states,int pos){
if(pos==0) return (row_states)%11;
if(pos==1) return (row_states/11)%11;
if(pos==2) return (row_states/11/11)%11;
if(pos==3) return (r... | ALGO | 0.999928 | 3.258018 |
7c239098-70f1-40eb-872e-430e59ddc27d | rahul-goel/CompetitiveProgramming | CodeForces/B/1703 B.cpp | #include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace std;
using namespace __gnu_pbds;
template < typename T >
using ordered_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
using ll = long long;
using ld = long double;
c... | ALGO | 0.999781 | 5.604191 |
45bdc94f-c581-42ae-9f3f-eff9490a4938 | desmond60/PortraitMatrix | ImageView/libfreeimage/FreeImage/Source/FreeImageToolkit/Colors.cpp | #include "FreeImage.h"
#include "Utilities.h"
// ----------------------------------------------------------
// Macros + structures
// ----------------------------------------------------------
#define GET_HI_NIBBLE(byte) ((byte) >> 4)
#define SET_HI_NIBBLE(byte, n) byte &= 0x0F, byte |= ((n) << 4)
#define GET_... | TOOL | 0.921605 | 5.891572 |
a2252abb-4a7f-43f3-8068-81619b0e1806 | rakasan/C_tests | C_SandBox/DoubleLinked_List.cpp | #include <stdio.h>
#include <stdlib.h>
#include <string.h>
struct address {
char nume[40];
char strada[40];
char oras[20];
char stat[3];
char cod_postal[11];
struct address* urm;
struct address* preced;
}info;
void dlstore(struct address* i, struct address** ultim)
{
if (!*ultim) *ultim = i;
else (*ultim)->u... | TOOL | 0.90746 | 3.414289 |
1c249f34-28c5-4095-b6d3-45d5018e28f5 | JUkhan/leetcode_problems | stack/decodeStringRecursive.cpp | #include "../print.h"
//394. Decode String
//https://leetcode.com/problems/decode-string/
class Solution
{
public:
string decodeString(string s)
{
const int N = s.size();
stack<string> st;
for (int i = 0; i < N; i++)
{
string digits = "", str = "";
while... | ALGO | 0.997724 | 6.163364 |
ef2304a6-ebed-48b2-b6b4-ed02db9cdbda | shreyansh26/AdventOfCode | 2024/09/09_1.cpp | #include <bits/stdc++.h>
using namespace std;
int main() {
ifstream fin("input1.txt");
string s;
fin >> s;
vector<int> v;
vector<int> spaces;
int sz = 0;
for(int i=0; i<(int)s.size(); i++) {
if(i % 2 == 0) {
for(int _=0; _<s[i]-'0'; _++)
v.push_back(sz... | ALGO | 0.999948 | 4.055123 |
28f21172-372e-4866-8c88-f1b8b2d406dc | Winterleaf/DNT-Torque3D-V1.1-MIT-3.0 | Engine/lib/opcode/Ice/IceMatrix4x4.cpp | ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
/**
* Contains code for 4x4 matrices.
* \file IceMatrix4x4.cpp
* \author Pierre Terdiman
* \date April, 4, 2000
... | ALGO | 0.999843 | 6.382557 |
e05221f8-a428-45e3-879f-39e1b56addd1 | cxy1997/SJTU-OnlineJudge | 1231.cpp | #include <cstdio>
class Disjointset
{
private:
int size;
int *parent;
public:
Disjointset(int s):size(s)
{
parent=new int[size+1];
for (int i=0;i<=size;++i) parent[i]=-1;
}
~Disjointset(){delete [] parent;}
void Union(int root1,int root2)
{
if (root1==root2) retur... | ALGO | 0.999895 | 3.506181 |
7d9239e0-b97d-406e-8703-108dabfce659 | Shohan07/Problem-Solving | Code Forces/CF_Educational_116_2B.cpp | #include<bits/stdc++.h>
using namespace std;
#define ll long long
int main()
{
ll n, k, cnt, t;
cin >> t;
while(t--){
cnt = 0;
cin >> n >> k;
if( n == 1) cout << 0 << "\n";
else if(k == 1) cout << n-1 << "\n";
else if((n/2) <= k){
ll p = 1;
whi... | ALGO | 0.99995 | 4.102139 |
ed1f374e-7239-4600-ae94-045965df29f2 | aniketp/ipcp-dsp | prefetchers/sangam/sangam_dpc3.l1d_pref.cpp | //
// Written for Data Prefetching Championship Simulator 3
// Mainak Chaudhuri, Nayan Deshmukh. Sangam: A Multi-component Core Cache Prefetcher.
//
#include "cache.h"
#define LOG_NUM_SETS_IN_RECENT_ACCESS_TAG_ARRAY_L1 0
#define NUM_SETS_IN_RECENT_ACCESS_TAG_ARRAY_L1 (1 << LOG_NUM_SETS_IN_RECENT_ACCESS_TAG_ARRAY_L1)
... | ALGO | 0.996592 | 6.221684 |
6f29ee18-0308-46fd-b7c5-6a650e1790ba | MayKoder/TFG-Miquel_Suau_Gonzalez | src/Source Code/External Libraries/MathGeoLib/include/Geometry/Line.cpp | /** @file Line.cpp
@author Jukka Jylnki
@brief Implementation for the Line geometry object. */
#include "Line.h"
#include "Ray.h"
#include "LineSegment.h"
#include "../Math/float3x3.h"
#include "../Math/float3x4.h"
#include "../Math/float4x4.h"
#include "OBB.h"
#include "../Math/Quat.h"
#include "Frustum.h"
#include ... | ALGO | 0.993765 | 6.736297 |
a34a622c-9752-475b-acac-482fbf1cef72 | raincross7/code-similarity | codes/train_code/problem071/problem071_41.cpp | #include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i, n) for (int i = 0; i < (n); i++)
int main() {
int n;
string s, t;
cin >> n >> s >> t;
int ans = 2 * n;
for (int i = n; i < 2 * n; ++i) {
string ss = s.substr(i - n, 2 * n - i);
string tt = t.substr(0,... | ALGO | 0.999927 | 4.078399 |
82de152c-1f76-4d24-a0fc-29e7fd328863 | kunidesuyo/competitive-programming | ABC/01~50/45/B.cpp | #include <bits/stdc++.h>
#include <cmath>
using ll = long long;
const ll INF = __LONG_LONG_MAX__;
using namespace std;
int main() {
string s[3];
int l[3];
int index[3];
for(int i = 0; i < 3; i++) {
cin >> s[i];
l[i] = s[i].length();
index[i] = 0;
}
int i = 0;
whi... | ALGO | 0.999846 | 3.897303 |
bdd803c8-66af-4bda-b2af-e3797b05804b | wuyuhang05/My-OI-Code | ZROI/1406.cpp | #pragma GCC optimize("Ofast")
#include <bits/stdc++.h>
#define fi first
#define se second
#define U unsigned
#define P std::pair<int,int>
#define LL long long
#define pb push_back
#define MP std::make_pair
#define all(x) x.begin(),x.end()
#define CLR(i,a) memset(i,a,sizeof(i))
#define FOR(i,a,b) for(int i = a;i <= b;+... | ALGO | 0.999975 | 3.89986 |
7e96eb31-b00d-4dd8-ab77-3f5eebfc87f9 | Bhushan-20/DSA- | Strings/check-palindrome.cpp | #include <iostream>
using namespace std;
bool isPalindrome(string &s){
int n = s.length();
int start = 0;
int e = n - 1;
while (start <= e)
{
if (s[start] != s[e])
{
return false;
}
else
{
start++;
e--;
}
}
... | ALGO | 0.998866 | 5.667801 |
a4eda982-c7c6-4aa2-8b19-043967d40758 | Ekam3000/CppAndDataStructure2 | 6_trees/2_Binary_trees/Binary_tree_Bonus_problems/6_ancestor_matrix_from_given_binary_tree.cpp | /*Ancestor matrix from given binary tree
Send Feedback
You are given a binary tree in level wise order where all the values are from 0 to n-1. You have to construct an ancestor matrix of size n x n from the given binary tree.
Note: You have to write a function to print the ancestor matrix. The matrix given to you as th... | ALGO | 0.999285 | 3.6043 |
7efd1438-d5c6-466c-8e98-e29f3a7e4065 | Sid230503/Leet-Code | 203-remove-linked-list-elements/remove-linked-list-elements.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* removeEleme... | ALGO | 0.999943 | 5.698089 |
77a66ada-be74-4c72-8c6d-e86de564cb9d | porwalarchit/cpp-DSA-Course-Codes | Linked List/LL_Append_last_k_Node_to_the_start_of_LL.cpp | #include<iostream>
using namespace std;
class Node{
public:
int data;
Node* next;
Node(int val){
data = val;
next = NULL;
}
};
void insertatTail(Node* &head, int val){
Node* n = new Node(val);
if(head==NULL){
head = n;
return;
}
Node* temp = head;
... | ALGO | 0.999638 | 3.95488 |
3ce0d27b-5d38-47bb-99ef-44ecc90a3a92 | MustafaAli564/AppDev-Assignment-3 | 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.998733 | 6.76775 |
da8254f6-202c-4b23-8763-7d4bfb126ce7 | Anik-Modak/CompetitiveProgramming | UVa/The Trip .uva.cpp | //Anik_Modak
#include<bits/stdc++.h>
#define d double
using namespace std;
int main()
{
int t;
//freopen("input.txt","r",stdin);
while(cin>>t&&t!=0)
{
double a[t],ans1=0.0,ans2=0.0,s=0.0;
for(int i=0; i<t; i++)
{
cin>>a[i];
s+=a[i];
}
s=ro... | ALGO | 0.999106 | 3.475412 |
7d94bfe4-e678-4928-a358-15c82e7c9838 | Xilinx/SDSoC_Examples | cpp/getting_started/cpu_to_fpga/03_mmult_pipeline/src/main.cpp | /*****
* Changes from Lab 02:
In order to improve performance of the matrix multiplication hardware
function, loop pipelining is used to achieve lower initiation
interval(II), resulting in faster execution of the function.
*****/
#include <iostream>
#include <stdlib.h>
#include "sds_utils.h"
#include "mmult_accel.h"
... | ALGO | 0.981229 | 4.741107 |
b0d33277-e384-4838-aec1-4dc028442614 | ToyasDhake/midterm_project | app/distance.cpp | /**
* @file distance.cpp
* @author Shivam Akhauri (Driver),Toyas Dhake (Navigator)
* @date 19 October 2019
* @copyright 2019 Toyas Dhake, Shivam Akhauri
* @brief This is a class for depth perception module based on image from single
* camera.
*/
#include <dlib/opencv.h>
#include <dlib/image_processing/frontal_face_... | ALGO | 0.999133 | 5.296358 |
2cae6181-bf12-47cf-888f-c16fcf995e64 | Harshsngh07/DataStructures_and_Algorithms | CodeForces/A/Again_twentyFive_630.cpp | #include <bits/stdc++.h>
#include <math.h>
using namespace std;
int main()
{
int n;
cin >> n;
int result, newNo;
result = pow(5, n);
// cout << result << endl;
vector<int> v;
while (result > 0)
{
newNo = result % 10;
v.push_back(newNo);
result /= 10;
}
//... | ALGO | 0.999717 | 3.548575 |
57e43484-fcf4-4b9d-be06-1edb9c8f01ac | sameermd1510/Leetcode-Solution | Shortest direction - GFG/shortest-direction.cpp | //{ Driver Code Starts
#include<bits/stdc++.h>
using namespace std;
// } Driver Code Ends
class Solution{
public:
string shortestPath (string S){
int x=0,y=0;
for( char ch:S){
if(ch=='N') x++;
else if(ch=='S') x--;
else if(ch=='E') y++;
else y--;... | ALGO | 0.999984 | 6.578328 |
58cfc39f-4ad5-404a-969d-c1d707e4fbbf | trilinos/Trilinos | packages/muelu/adapters/epetra/MueLu_EpetraOperator.cpp | #include <Xpetra_Matrix.hpp>
#include <Xpetra_CrsMatrixWrap.hpp>
#include <Xpetra_BlockedCrsMatrix.hpp>
#include <Xpetra_EpetraMultiVector.hpp>
#include "MueLu_EpetraOperator.hpp"
#include "MueLu_Level.hpp"
#if defined(HAVE_MUELU_SERIAL) and defined(HAVE_MUELU_EPETRA)
namespace MueLu {
int EpetraOperator::ApplyInve... | ALGO | 0.99516 | 6.578128 |
f08c4d0f-c2d3-4a45-afc5-777ea25bd36f | cgsdfc/basic-algorithm | 晴神笔记/第九章 提高篇(3) 数据结构专题(2)/哈夫曼树/codeup/问题 D Haffman编码/main.cpp | #include <cstdio>
#include <queue>
#include <string>
#include <vector>
using namespace std;
/* run this program using the console pauser or add your own getch,
* system("pause") or input loop */
int N;
struct Node {
char ch;
int weight;
string code; // ڵա
int lchild, rchild;
};
// ĿûиڵϽ硣
vector<Nod... | ALGO | 0.998723 | 3.850741 |
fbf9c2ed-0d57-407e-8044-d0c448e88c04 | deathook007/DSA-Preparation | Addition.cpp | // { Driver Code Starts
#include <bits/stdc++.h>
using namespace std;
// } Driver Code Ends
class Solution
{
public:
int addition(int A, int B)
{
return (A + B);
}
};
// { Driver Code Starts.
int main()
{
int t;
cin >> t;
while (t--)
{
int A, B;
cin >> A >> B;
... | ALGO | 0.997054 | 6.391221 |
be7f06a6-6eef-4688-a59a-e139322d9e9b | guoguozy/High-Performace-program | Ex4/trap-4.cpp | #include <bits/stdc++.h>
#include <iostream>
#include <mpi.h>
using namespace std;
const int eps = 1e-12;
double a, b, c, d;
int n;
/* double f(double x)
{
return (right_h - left_h) / (b - a) * (x - a) + left_h;
}*/
double f(double x)
{
return exp(b * x) / sqrt(1 - exp(-c * x));
}
double Trap(double left_endpt,... | ALGO | 0.999858 | 3.556145 |
a2bc221c-0786-49d6-bb64-0745c3c8f967 | patanafrin/os | os dev 5.cpp | #include <stdio.h>
struct Process {
int pid;
int burstTime;
int priority;
int waitingTime;
int turnaroundTime;
};
// Swap function for sorting
void swap(struct Process *a, struct Process *b) {
struct Process temp = *a;
*a = *b;
*b = temp;
}
int main() {
int n, totalWaitingTime = 0... | ALGO | 0.999996 | 5.248049 |
71657abf-09f3-46f8-8576-a7b8c14237ae | Sneha-Agarwal23/Leetcode_Problems | Sort_the_matrix_diagonally.cpp | class Solution {
public:
vector<vector<int>> diagonalSort(vector<vector<int>>& mat)
{
for(int k = 0; k+1 < mat.size();k++)
{
for(int i = 0; i+1 < mat.size(); i++)
{
for(int j = 0; j+1 < mat[i].size(); j++)
{
if(mat[i][j]... | ALGO | 0.999959 | 5.724131 |
5ea768f1-b8eb-489e-980f-390a0b301f34 | shumon84/Library | Data_Structure/union-find.cpp | #include <iostream>
#include <vector>
class union_find
{
std::vector<size_t> parent;
std::vector<size_t> rank;
public:
// 初期化
union_find(size_t size)
{
parent.resize(size);
rank.resize(size);
for(size_t i=0;i<size;i++)
{
parent[i]=i;
rank[i]=1;
}
}
// aとbをグルーピング
... | ALGO | 0.998464 | 3.533008 |
831246ec-e69c-4c29-94bd-534d1f6a4f87 | TheSlugInTub/Snail-Engine | Libraries/include/Box2D/collision/b2_distance.cpp | #include "box2d/b2_circle_shape.h"
#include "box2d/b2_distance.h"
#include "box2d/b2_edge_shape.h"
#include "box2d/b2_chain_shape.h"
#include "box2d/b2_polygon_shape.h"
// GJK using Voronoi regions (Christer Ericson) and Barycentric coordinates.
B2_API int32 b2_gjkCalls, b2_gjkIters, b2_gjkMaxIters;
void b2DistancePr... | ALGO | 0.999978 | 3.809144 |
b5022e40-c9a7-42e3-a24b-72b72b1cfcda | roblox-codex/Programming | C++ Programming/reverse_substrings.cpp | class Solution {
public:
string reverseParentheses(string s) {
stack<int> stack;
string ans;
for (const char c : s)
if (c == '(') {
stack.push(ans.length());
} else if (c == ')') {
// Reverse the corresponding substring between ().
const int j = stack.top();
s... | ALGO | 0.999932 | 6.641814 |
7574b716-2a9c-45eb-8d58-65f4003ff4fa | mijan75/algorithm | kruskal.cpp | #include<bits/stdc++.h>
using namespace std;
class Node{
public:
int u, v, w;
};
vector<Node> graph;
int parent[1000];
int findParent(int x){
if(parent[x] = x) return x;
else return parent[x] = findParent(parent[x]);
}
bool Compare(Node a, Node b){
return a.w < b.w;
}
int kruskal(int vertex){
f... | ALGO | 0.999972 | 4.366447 |
98627428-71f8-40db-b3d0-83f5030ab1e1 | lisnb/leetcode | leecode-II/NQueens/源.cpp | #include <iostream>
#include <string>
#include <algorithm>
#include <vector>
using namespace std;
class Solution {
public:
vector<vector<string>> solveNQueens(int n) {
vector<int> columns(n, -1);
vector<vector<int>> re;
nqueens(n, columns, re, 0);
if (re.empty())
return... | ALGO | 0.999798 | 5.530041 |
88b5e3a8-67ed-470b-ba68-153651b3f24d | Sarthakshah30/TopCoder-Solutions | BearDartsDiv2.cpp | #include <vector>
#include <list>
#include <map>
#include <set>
#include <deque>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <cstring>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <c... | ALGO | 0.999904 | 4.25458 |
493451c3-cfef-4458-b291-9b69edbd60e5 | Ramneantu/competitive_programming | INFOARENA/dfs.cpp | #include<bits/stdc++.h>
#define rep(i,a,b) for(int i=int(a); i<=int(b); ++i)
#define rev(i,b,a) for(int i=int(b); i>=int(a); --i)
#define rec(i,a,b,c) for(int i=int(a); i<=int(b); i+=int(c))
#define recv(i,a,b,c) for(int i=int(a); i>=int(b); i-=int(c))
#define mp(x,y) make_pair((x),(y))
#define pb(x) push_back(x)
#def... | ALGO | 0.999831 | 4.598921 |
f9a19e94-087c-4a1f-9a91-751c1b851384 | silky/lhcb-physics | gauss/Gen/Mint/src/Mojito/CoherenceFactor/src/CoherenceFactorCalculator.cpp | // author: Jonas Rademacker (<EMAIL>)
// status: Mon 9 Feb 2009 19:17:59 GMT
//
// Using Equations 5 (and around that) in
// Phys. Rev. D 68, 033003 (2003),
// http://prola.aps.org/abstract/PRD/v68/i3/e033003
//
#include "Mint/CoherenceFactorStoreAndEvaluate.h"
#include "Mint/CoherenceFactorCalculator.h"
#include "Mi... | ALGO | 0.989808 | 6.226081 |
2fa86b7a-7488-41b4-8c4d-669dbf5cd40a | dhairya8luthra/BITS_CSF211_Labsheets_old | LabSheet11_DynamicProgramming/I.cpp | // https://www.youtube.com/watch?v=Tw1k46ywN6E&list=PLUl4u3cNGP6317WaSNfmCvGym2ucw3oGp&t=3603s
#include <bits/stdc++.h>
using namespace std;
int dp[1002][1002];
int blessings(int input[], int start, int end){
if(start > end){
return dp[start][end] = 0;
}
if(start == end){
return dp[start]... | ALGO | 0.999693 | 4.830142 |
c230d4a2-5b42-41ff-b850-e08e3e05f666 | AayushInterwork/Training | Programming/DSA/DSA_Level_1/Basics_Of_Programming/Function_and_Arrays/Inverse_Array.cpp | #include <iostream>
using namespace std;
void Inverse(int arr[], int size, int output[])
{
for (int i = 0; i < size; i++)
{
int val = arr[i];
output[val] = i;
}
}
void display(int arr[], int n)
{
for (int i = 0; i < n; i++)
{
cout << arr[i] << " ";
}
}
int main()
{
... | ALGO | 0.999964 | 4.84914 |
0ea4f12e-f4ce-4768-8da2-c9d42f6c580f | Ishwarendra/Contests | CODEFORCES_CONTEST/Previous Contests/Edu_106_Virtual/D.cpp | #include "bits/stdc++.h"
#ifdef LOCAL
#include "F:\CPP\Debug\debug.h"
#else
#define print(...) 1;
#endif
using i64 = long long;
namespace nt
{
std::vector<int> sieve(const int n)
{
std::vector<bool> is_prime(n, true);
is_prime[0] = is_prime[1] = false;
std::vector<int> count(n);
... | ALGO | 0.999856 | 5.180428 |
7c038d86-ecb1-4c8b-b41f-cfdbdbda48be | lz520520/rust-1.75-ollvm | src/llvm-project/clang/tools/clang-diff/ClangDiff.cpp | #include "clang/Tooling/ASTDiff/ASTDiff.h"
#include "clang/Tooling/CommonOptionsParser.h"
#include "clang/Tooling/Tooling.h"
#include "llvm/Support/CommandLine.h"
using namespace llvm;
using namespace clang;
using namespace clang::tooling;
static cl::OptionCategory ClangDiffCategory("clang-diff options");
static cl:... | TOOL | 0.955337 | 7.814704 |
168ab7fa-682a-435f-a4ae-c9b889794a64 | myhaooo/code | D17/T2.cpp | #include<bits/stdc++.h>
#define MAXN 200005
using namespace std;
struct node1{
int a,p;
}a[MAXN];
struct node2{
int l,r,p;
}q[MAXN];
int n,m,j,ansn,rk[MAXN],cnt[MAXN],ans[MAXN],num[MAXN];
//cnt[i]:共出现i次的有几个数;num[i]:第i个数一共出现了几次
int len,pos[MAXN];
bool cmp1(node1 a,node1 b){
return a.a<b.a||(a.a==b.a&&a.p<b... | ALGO | 0.999963 | 3.812662 |
42690245-f5aa-41a2-ac7a-4bf01833b2e3 | chunyou0830/EE2310 | hw8/hw8.cpp | #include <iostream>
#include <cstdlib>
#include <vector>
#include <iomanip>
using namespace std;
class Task
{
private:
int time;
int resource;
int duration;
public:
Task(){ time=rand()%101; resource=0; duration=rand()%10+1;}
Task(int t, int r, int d){ time=t; resource=r; duration=d;}
void SetRe... | ALGO | 0.95444 | 4.536367 |
9b6673a7-9072-475e-9b59-57058d9bebce | HiH-0906/NetTest | Alchemy/Input/AI/TargetDec.cpp | #include <algorithm>
#include "TargetDec.h"
#include <DIR.h>
bool TargetDec::operator()(Obj & master, std::vector<sharedObj>& objList, InputState & input)
{
TEAM_TAG tageTeam = (master.teamTag() == TEAM_TAG::ENEMY_TEAM ? TEAM_TAG::ALLY_TEAM : TEAM_TAG::ENEMY_TEAM);
if (master.tageObj().expired())
{
// ̋߂objList\[... | ALGO | 0.994001 | 4.813111 |
bde37286-4024-45b3-b6c7-2e2f5f99030c | zhouzz7/ATCG2Exercises | Part2Geometry/libs/libigl-master/python/py_igl/py_cotmatrix.cpp | m.def("cotmatrix", []
(
const Eigen::MatrixXd& V,
const Eigen::MatrixXi& F,
Eigen::SparseMatrix<double>& L
)
{
return igl::cotmatrix(V,F,L);
}, __doc_igl_cotmatrix,
py::arg("V"), py::arg("F"), py::arg("L"));
| ALGO | 0.996372 | 5.819284 |
e5426a30-0f20-4452-a9bc-523d09f566e0 | yuyu0830/baekjoon | solved/1012.cpp | // dfs 실버 2 유기농 배추 https://www.acmicpc.net/problem/1012
#include <iostream>
#include <queue>
#include <string.h>
#define SIZE 51
using namespace std;
typedef pair<int, int> ii;
int arr[SIZE][SIZE] = {0, };
int dir[4][2] = {
{0, 1},
{0, -1},
{1, 0},
{-1, 0}
};
bool isin(int a, int b) {
if (a >= ... | ALGO | 0.999958 | 4.320008 |
77f360e5-fd48-4203-a19c-b2127a717606 | ravi4246/DSA0182-OOPS | Salary of a Employee.cpp | #include<iostream>
using namespace std;
int main()
{
int g,s,b,T_S,A,B;
cout<<"Enter worker salary:";
cin>>s;
cout<<"Enter worker grade:";
cin>>g;
if(g==A){
b=(0.05)*s;
}
else if(g==B){
b=(0.10)*s;
}
else{
cout<<"INVALID GRADE.";
return 1;
}
if(s<10000){
b+=(0.02)*s;
}
T_S=b+s;
cout<<"The total ... | TOOL | 0.972719 | 3.118665 |
2aee3505-43c5-4264-9c44-541ffdd10673 | Kumar-akki/SU2 | SU2_CFD/src/numerics/flow/convection/fds.cpp | #include "../../../../include/numerics/flow/convection/fds.hpp"
#include "../../../../../Common/include/toolboxes/geometry_toolbox.hpp"
CUpwFDSInc_Flow::CUpwFDSInc_Flow(unsigned short val_nDim, unsigned short val_nVar, const CConfig *config) : CNumerics(val_nDim, val_nVar, config) {
implicit = (config->GetK... | ALGO | 0.998162 | 5.624633 |
0a5e6107-e19f-4ba0-b995-48dcdb949bcf | Reshma-akter970/Problem_Solving | queriesll.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_tail(Node* &head, Node*&tail, int val)
{
Node * newNode=new Node(val);
if(head==NULL)
{
head=newNode;... | ALGO | 0.999851 | 4.326338 |
83c4206b-f236-41ab-8aff-d5c40089f986 | essej/paulxstretch | deps/juce/modules/juce_cryptography/encryption/juce_Primes.cpp | namespace juce
{
namespace PrimesHelpers
{
static void createSmallSieve (const int numBits, BigInteger& result)
{
result.setBit (numBits);
result.clearBit (numBits); // to enlarge the array
result.setBit (0);
int n = 2;
do
{
for (int i = n + n; i < ... | ALGO | 0.999703 | 7.589444 |
8b12c403-1216-422a-8e5d-7ece3238d596 | mahfuz1703/Competitive-Programming-Beginner-To-Advanced | Graph Theory/adjacency_matrix.cpp | #include <bits/stdc++.h>
using namespace std;
const int mx = 1e3 + 123;
int adjMat[mx][mx];
int main(){
int n; cin >> n;
/// Take input in adjMat
for(int i = 1; i <= n; i++){
for(int j = 1; j <= n; j++) cin >> adjMat[i][j];
}
/// Get output of adjMat
for(int i = 1; i <= n; i++){
... | ALGO | 0.999952 | 3.429383 |
9a6442d4-744d-4318-bc5f-dd3c1ba11438 | coouir/codetree-TILs | 241217/특정 숫자 도달하기 2/reaching-specific-number-2.cpp | #include <iostream>
using namespace std;
int main() {
// 여기에 코드를 작성해주세요.
int n;
cin >> n;
for (int i=n; i>=1; i--) {
cout << i << ' ';
}
return 0;
} | ALGO | 0.999859 | 4.557368 |
e7a5550a-ef65-4eb8-a82a-fb6173f2f5a1 | BabaSambar/Codeforces-Questions | 2042/B.cpp | #include<bits/stdc++.h>
using namespace std;
#define ll long long
#define pb push_back
#define pf push_front
#define mp make_pair
#define ff(s, f) for(ll i=s; i<=f; i++)
#define fr(s, f) for(ll i=s; i>=f; i--)
#define ffi(s,f) for(ll i=s; i<=f; i++)
#define ffj(s, f) for(ll j=s; j<=f; j++)
#define tc ll t;cin>>t;whi... | ALGO | 0.999571 | 4.031448 |
8e6d4232-8fd3-4210-8ed8-41c3194d2d9b | raincross7/code-similarity | codes/train_code/problem331/problem331_196.cpp | #include<bits/stdc++.h>
using namespace std;
#define all(a) (a).begin(),(a).end()
typedef long long ll;
const ll mod=1000000007;
#define repi(i,a,b) for(ll i=ll(a);i<ll(b);++i)
int main() {
const int INF = 100000000;
int n,m,x;cin >>n>>m>>x;
vector<int> c(n);
vector<vector<int>> a(n,vector<int>(m));
for(int... | ALGO | 0.999975 | 4.074836 |
0a2b1300-d0ab-4e08-a6bc-b86665f2c46d | hs227/hc_video_player_t1 | ffm_demo3_2/examples/decode_filter_video.cpp | /**
* @file
* API example for decoding and filtering
* @example decode_filter_video.c
*/
#define _XOPEN_SOURCE 600 // for usleep
#include<unistd.h>
#include<stdio.h>
#include<stdlib.h>
extern "C"{
#include"libavformat/avformat.h"
#include"libavcodec/avcodec.h"
#include"libavfilter/avfilter.h"
#include"libavutil/a... | TOOL | 0.883617 | 5.07929 |
23da25c7-4f91-4cca-9114-2b2fb3c744f7 | RodrigoRossetti/URI-OJ | Volume 16 (1600 - 1699)/1612/1612.cpp | #include <bits/stdc++.h>
using namespace std;
int main() {
long long n, x;
cin >> n;
while (n--) {
cin >> x;
x % 2 == 0 ? cout << x/2 << endl : cout << x/2+1 << endl;
}
return 0;
} | ALGO | 0.999885 | 4.261048 |
30d63189-254d-45d8-bc7f-9c107afe1196 | edmcman/s2e-temp | klee/stp/simplifier/bvsolver.cpp | // -*- c++ -*-
#include "../AST/AST.h"
#include "../AST/ASTUtil.h"
#include "bvsolver.h"
//This file contains the implementation of member functions of
//bvsolver class, which represents the bitvector arithmetic linear
//solver. Please also refer the STP's CAV 2007 paper for the
//complete description of the ... | ALGO | 0.999844 | 3.843749 |
b06c4cee-f589-4424-a5af-0d8f803740d9 | wdazhi97/coro | thirdparty/boost_1_82_0/libs/geometry/doc/src/examples/algorithms/crosses.cpp | // Boost.Geometry (aka GGL, Generic Geometry Library)
// QuickBook Example
//[crosses
//` Checks if two geometries crosses
#include <iostream>
#include <boost/geometry.hpp>
#include <boost/geometry/geometries/point_xy.hpp>
#include <boost/geometry/geometries/polygon.hpp>
namespace bg = boost::geometry; /*< Convenie... | ALGO | 0.983628 | 6.776174 |
87eecb87-1246-4e24-8059-6ef30605ecb6 | nguyenviettungg/tungnv | C-APTECH/SOS/Code/Ontap3.cpp | #include<stdio.h>
#include<stdlib.h>//(dng cho exit tn tai)
int i,temp;
struct product
{
char code[25];
char name[25];
int price;
int quality;
int total;
};
main()
{
void question1();
void question2();
int opt;
while(true)
{
printf("\n*************************************************");
printf("\... | ALGO | 0.950184 | 3.106392 |
708479eb-ad7f-4818-a80e-ae75f92e4f50 | EtheSonX082531/CPP_EXTRA_CODES | Switch case.cpp | #include<iostream>
using namespace std;
int main()
{
int a,b;
char ch;
cout<<"Enter two number and operation:"<<endl;
cin>>a>>b>>ch;
switch (ch) {
case '+':
cout<<a+b<<endl;
break;
case '-':
cout<<a-b<<endl;
break;
case '/':
if(b==0) {
... | ALGO | 0.994104 | 3.443525 |
9f42046d-771e-4337-95c3-f56a579e455c | mbelouar/CPP_MODULES | CPP_09/ex01/RPN.cpp | #include "RPN.hpp"
RPN::RPN() {}
RPN::RPN(const RPN & src): _stack(src._stack) {
*this = src;
}
RPN &RPN::operator=(const RPN & src) {
if (this == &src)
return (*this);
this->_stack = src._stack;
return (*this);
}
RPN::~RPN() {}
bool RPN::isOperator(char token) {
return token == '+' || token == '-' || to... | TOOL | 0.982126 | 5.365311 |
77d4c17f-39b0-43c5-9789-8b28851ed59d | ravi2320/InterviewBit | 74. Maximum Sum Triplet.cpp | /*
Maximum Sum Triplet
Programming
Arrays
Medium
32.9% Success
698
64
Bookmark
Asked In:
Problem Description
Given an array A containing N integers.
You need to find the maximum sum of triplet ( Ai + Aj + Ak ) such that 0 <= i < j < k < N and Ai < Aj < Ak.
If no such triplet exist return 0.
Problem Constraints
3... | ALGO | 0.999974 | 5.625355 |
f841116b-7294-4f7d-9c51-b505f8235651 | rylahs/Study_Previous | CPP,CodingTest/정리 안된 문제들/2581.cpp | #include <bits/stdc++.h>
using namespace std;
int num = 10002;
int arrr[10002];
int minIdx = 10002;
int sum;
void primeNumberS(int a, int b)
{
for (int i = 2; i <= num; i++)
arrr[i] = i;
for (int i = 2; i <= num; i++)
{
if (arrr[i] == 0)
continue;
for (int j = i + i; j <= num; j += i)
arrr[j] = 0;
}
... | ALGO | 0.999951 | 4.743684 |
9b29eb38-9ea3-480d-b043-2114df237281 | pcw109550/problem-solving | LeetCode/regular-expression-matching.cpp | // 10. Regular Expression Matching
#include <iostream>
#include <string>
#include <unordered_map>
using namespace std;
class Solution {
bool result;
unordered_map<int, bool> M;
public:
bool isMatch(string s, string p) {
// O(M * N)
result = false;
backtrack(s, p... | ALGO | 0.999693 | 4.549953 |
a0395cb3-fa66-447b-846f-a3635434b746 | littlesam95/Programmers | 모든 문제/Level 2/프로그래머스(숫자의 표현).cpp | #include <string>
#include <vector>
#include <algorithm>
using namespace std;
int answer = 0;
int solution(int n) {
for (int i = 1; i <= (n / 2); i++) {
int sum = 0;
int index = i;
while (1) {
if (sum < n) {
sum += index;
index++;
}
else if (sum > n) {
break;
}
else {
answer++;
... | ALGO | 0.999896 | 4.347002 |
38db2b22-0fe5-4bde-9db7-4d648abb7ddd | titsuki/AOJ | Volume_00/0064_Secret_Number.cpp |
#define _USE_MATH_DEFINES
#include <iostream>
#include <sstream>
#include <cmath>
#include <algorithm>
#include <queue>
#include <stack>
#include <limits>
#include <map>
#include <string>
#include <cstring>
#include <set>
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<int,int> P;
in... | ALGO | 0.999718 | 3.945527 |
f58dc071-1148-43a8-859c-a47b87ddff05 | akshat-o5/Data-Structures-and-Algorithms | Revision/Stacks/GetMiniFromStack.cpp | // https://www.geeksforgeeks.org/problems/get-minimum-element-from-stack/1
//{ Driver Code Starts
#include <bits/stdc++.h>
using namespace std;
// } Driver Code Ends
/*
The structure of the class is as follows
class _stack{
stack<int> s;
int minEle;
public :
int getMin();
int pop();
void push(int);
};
*/
... | ALGO | 0.999781 | 5.132771 |
1e8d69fd-eb89-4303-90b9-d4d7c21b2586 | whytedork/Problem-Solving | day2/remove_duplicates_from_array.cpp | #include <bits/stdc++.h>
using namespace std;
#define ll long long int
#define endl "\n"
// array is sorted
int remove_duplicates(int arr[], int n) {
//base case
if (n == 0 || n == 1)
return n;
int j = 0; //to store the index of next unique element
for (int i = 0; i < n - 1; i++) {
if (arr[i] != arr[i + 1])... | ALGO | 0.999754 | 4.758595 |
bc9c5cd4-2234-4476-80d1-dd81af78fbb0 | Laliit-26/DSA_practice | leetcode_138_copy_list_with_random_pointer.cpp | /*
// Definition for a Node.
class Node {
public:
int val;
Node* next;
Node* random;
Node(int _val) {
val = _val;
next = NULL;
random = NULL;
}
};
*/
class Solution
{
public:
Node *copyRandomList(Node *head)
{
Node *hd = head;
map<Node *, Node *... | ALGO | 0.99735 | 5.294096 |
602b148c-f0a3-4f85-937c-edbc2481b082 | nimit435/Competitive-programming | C_Good_Subarrays.cpp | #include <iostream>
#include <vector>
#include <unordered_map>
#include <set>
#include <unordered_set>
#include <vector>
#include <algorithm>
#include <limits.h>
#include <string>
#include <map>
#include <queue>
#include <deque>
#include <stack>
#include <cmath>
#include <cstring>
using namespace std;
//Speed
#define... | ALGO | 0.999975 | 4.692715 |
a19b8d92-74c7-4ca7-b9a6-03b78e1198cd | zemanno/Snake | Snake/Snake.cpp | /// Author: Norbert Zeman
/// Date: Thursday October 05, 2018
/// File: Snake.cpp
#include "Snake.h"
void Snake::initMap()
{
// place initial head location in middle of map
headPosX = GameMap::mapWidth / 2;
headPosY = GameMap::mapHeight / 2;
GMap->map[headPosX + headPosY * GameMap::mapWidth] = 1;
// top and bot... | ALGO | 0.938026 | 5.385791 |
ba9a1bff-a0a8-4d13-9958-7393ea3e4193 | duwaben/MD_toolkit | AngleDF_nelements.cpp | #include <iostream>
#include <cstdio>
#include <vector>
#include <cmath>
#include <cstring>
#include <string>
#include <vector>
#include <map>
#include <algorithm>
#include <sys/stat.h>
using namespace std;
#define NATOM 200 //total atom number
#define NOMIT 4000 //the number of omitted steps
#define NSTEP 80... | DATA | 0.977635 | 3.352498 |
d0a8c9dd-b46b-41ed-9c9d-e21e112e6ecf | Manuella-Maia/repositorio-cplusplus | atividade 32 no c++.cpp | #include <iostream>
using namespace std;
int main()
{
string timea, timeb; int na;int nb;
cout<<"digite o nome do time : ";
cin>>timea;
cout<<"digite o numero de gols marcados : ";
cin>>na;
cout<<"digite outro time : ";
cin>>timeb;
cout<<"digite o numero de gols marcados : ";
cin>>nb;
if (na==n... | ALGO | 0.999779 | 3.608791 |
9c458b90-2408-4107-be23-f77f5861b1b5 | nhu220840/C-Tutorial | De quy/LuyThuaNhiPhan.cpp | #include <stdio.h>
#include <math.h>
#define ll long long
const int MOD = 1e9 + 7;
ll pow1(ll a, ll b){
if(b == 0)
return 1;
ll x = pow1(a, b / 2);
if(b % 2 == 0)
return ((x % MOD) * (x % MOD)) % MOD;
else
return ((x % MOD) * (x % MOD)) % MOD * (a % MOD) % MOD;
}
int main(){
... | ALGO | 0.999893 | 4.887885 |
ff832229-9f2e-4251-b26c-e6d4f9b39713 | Ranjan2703/DSA | 493-reverse-pairs/493-reverse-pairs.cpp | class Solution {
public:
int ans;
void merge(vector<int>&nums, int l, int mid, int h)
{
int i= l;
int j = mid+1;
while(i<= mid && j<= h)
{
if((long) nums[i] > (long) 2*nums[j])
{
j++;
ans+= (mid-i+1);
... | ALGO | 0.999932 | 5.500895 |
996797ea-4a46-409c-8cd6-cc6be0dd63b8 | rohanlahori/CP_Guide | Graph/kruskal.cpp | #include<bits/stdc++.h>
//#pragma GCC optimize('O2')
using namespace std;
#define ll long long
#define ld long double
#define vll vector<ll>
#define vi vector<int>
#define pi pair<int,int>
#define vp vector<pi>
#define pb push_back
#define mp make_pair
#define mt make_tuple
#define F first
#define S second
#define f(i... | ALGO | 0.99997 | 4.451845 |
9fb038ed-243e-4863-ba51-23b54dda92ee | Krish9220/cpp | Lecture_105_Max_Non_adj/0_Max_sum_in_non_adj_array.cpp | //by Recursion..
#include<bits/stdc++.h>
using namespace std;
int Rec(vector<int>&nums,int n)
{
if(n<0)
return 0;
if(n==0)
return nums[0];
int includ =Rec(nums,n-2) + nums[n];
int exclude =Rec(nums,n-1) + 0;
return max(includ,exclude);
}
int MaxSum(vector<int>&nums)
{
int n... | ALGO | 0.999987 | 4.902546 |
8d26808e-b463-4798-8403-187cfb25ce00 | Rahul-Palahwat/LeetCode_Problems | 0198-house-robber/0198-house-robber.cpp | class Solution {
public:
int rob(vector<int>& nums) {
int n= nums.size();
int dp[n+1];
if(n==1){
return nums[0];
}else if(n== 2){
return max(nums[0],nums[1]);
}
else{
dp[0] = nums[0];
dp[1] = nums[1];
dp[2] =... | ALGO | 0.999917 | 5.843006 |
62018a7e-4d39-49a8-826b-00f33dd5cfb6 | moonuckjoo/2023_OOP_assignment | 4주차/1-4. 1/1-4. 1.cpp | #define _CRT_SECURE_NO_WARNNINGS
#include <iostream>
#include <cmath>
using namespace std;
#define PI acos(-1) // Լ ̿Ͽ
int main()
{
double result=0;
int n1, n2, n3;
double rad=0;
cout << "Degree: ";
cin >> n1;
rad = n1 * PI/ 180; // Է¹ ڸ ȣ ̿Ͽ ȯ
double T[3][3] = {
{-cos(rad),sin(rad),0}
,{sin(rad),cos(... | ALGO | 0.99267 | 3.251998 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.