uuid string | repo_name string | relative_path string | content string | category string | algo_rel_score float64 | quality_score float64 |
|---|---|---|---|---|---|---|
8db15e70-5c87-4b6a-b913-6cdb44daaa0a | raincross7/code-similarity | codes/train_code/problem131/problem131_418.cpp | #include "bits/stdc++.h"
#define MOD 1000000007
#define rep(i, n) for(ll i=0; i < (n); i++)
#define rrep(i, n) for(ll i=(n)-1; i >=0; i--)
#define ALL(v) v.begin(),v.end()
#define rALL(v) v.rbegin(),v.rend()
#define FOR(i, j, k) for(ll i=j;i<k;i++)
#define debug_print(var) cerr << #var << "=" << var <<endl;
#define DU... | ALGO | 0.999637 | 3.680982 |
be9db402-9046-4034-a056-cac89d4b4a6d | gamerman123x/packages_inputmethods_LatinIME | native/jni/src/suggest/core/dicnode/dic_node_utils.cpp | #include "suggest/core/dicnode/dic_node_utils.h"
#include "suggest/core/dicnode/dic_node.h"
#include "suggest/core/dicnode/dic_node_vector.h"
#include "suggest/core/dictionary/multi_bigram_map.h"
#include "suggest/core/policy/dictionary_structure_with_buffer_policy.h"
namespace latinime {
///////////////////////////... | ALGO | 0.965172 | 6.945854 |
cf0b5bdc-dec0-4272-93d3-ca2200fe17d5 | HosamEissa/Competitive-programming- | Codeforces/CF743-D2-E.cpp | /*
Author: Hossam Eissa
Idea:binary search the maximum length you can get and check if it is valid using dp
*/
#include <bits/stdc++.h>
using namespace std;
#define error(args...) { vector<string> _v = split(#args, ','); err(_v.begin(), args); }
vector<string> split(const string& s, char c)
{
vector<string> v;
... | ALGO | 0.999935 | 3.694144 |
c91c8aa4-1aa5-429d-bc39-49ec67d0f825 | 113bommy/deepmind_codecontests_refine | cpp_gold_filter_file/cpp_train_7845_11.cpp | #include <bits/stdc++.h>
using namespace std;
bool check(int a) {
for (int i = 3; i; ++i) {
if (((i - 2) * 180) % i == 0 && ((i - 2) * 180) / i == a) return true;
if (((i - 2) * 180) / i > a) return false;
}
}
int main() {
int n;
cin >> n;
int a[1000];
for (int i = 0; i < n; i++) {
cin >> a[i];
... | ALGO | 0.999961 | 3.992272 |
09ac6501-6559-430b-8dc1-f14fdc5f47b0 | spcl/cppless-clang | llvm/tools/llvm-cfi-verify/lib/GraphBuilder.cpp | #include "GraphBuilder.h"
#include "llvm/BinaryFormat/ELF.h"
#include "llvm/MC/MCAsmInfo.h"
#include "llvm/MC/MCContext.h"
#include "llvm/MC/MCDisassembler/MCDisassembler.h"
#include "llvm/MC/MCInst.h"
#include "llvm/MC/MCInstPrinter.h"
#include "llvm/MC/MCInstrAnalysis.h"
#include "llvm/MC/MCInstrDesc.h"
#include "ll... | TOOL | 0.971382 | 7.163465 |
cae75505-21a9-4a3c-9953-4d99d5a41653 | Alex313031/skia-supermium | src/utils/SkMatrix22.cpp | #include "src/utils/SkMatrix22.h"
#include "include/core/SkMatrix.h"
#include "include/core/SkPoint.h"
#include "include/core/SkScalar.h"
void SkComputeGivensRotation(const SkVector& h, SkMatrix* G) {
const SkScalar& a = h.fX;
const SkScalar& b = h.fY;
SkScalar c, s;
if (0 == b) {
c = SkScalar... | ALGO | 0.97194 | 6.176526 |
913768c3-d358-4c66-8011-d4274cd9e534 | syedpeera/DSA-Problem-Solving | 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.999991 | 6.246352 |
46340052-3980-453c-b493-d96750352f54 | SumitPrakash1999/LeetCode-Solutions | 1002-maximum-width-ramp/maximum-width-ramp.cpp | class Solution {
public:
int maxWidthRamp(vector<int>& nums) {
int n=nums.size();
int maxi=0;
stack<int> st;
for(int i=0;i<n;i++){
if(st.empty()||nums[i]<nums[st.top()]) st.push(i);
}
for(int j=n-1;j>=0;j--){
while(!st.empty()&&nums[j]>=nums[... | ALGO | 0.99998 | 6.04744 |
b110a6ba-1855-4b7f-9a6f-8f32e2ac7d49 | raincross7/code-similarity | codes/train_code/problem156/problem156_122.cpp | #include <iostream>
#include <stdio.h>
#include <cmath>
using namespace std;
int main()
{
double a, b, c;
double s, l, h;
cin >> a >> b >> c;
s = a * b * sin((c / 180) * M_PI) / 2;
l = a + b + sqrt(a * a + b * b - 2 * a * b * cos((c * M_PI) / 180));
h = s * (double)2 / a;
printf("%.8f\n%... | ALGO | 0.999366 | 3.562035 |
86e26e96-2817-408c-94d1-a00f7c837311 | Rifatmahmood/DSA | Organaized Folder/1. Basic Data Structure/12. Doubly Link List Exam/Browser_History_List.cpp | #include <bits/stdc++.h>
using namespace std;
int main()
{
list<string> webAddress;
string address;
while (true)
{
cin >> address;
if (address == "end")
{
break;
}
webAddress.push_back(address);
}
int q;
cin >> q;
auto current = webAddress.begin();
while (q != 0)
{
... | ALGO | 0.991862 | 5.059912 |
ee460390-ac23-4481-a114-1ca503c3416d | gabriel-candeia/Competitive-Programming-Solutions | Codeforces/756B.cpp | #include<bits/stdc++.h>
#define ll long long
using namespace std;
const ll inf = 1e16;
int main(){
ll n;
vector<ll> dp, x;
cin >> n;
x.assign(n+1,0);
for(int i=0;i<n;i++)
cin >> x[i];
dp.assign(n+1,inf); dp[0] = 0;
for(int i=0;i<n;i++){
for(int j=i;j<n && x[j]<=x[i]+90-1;j... | ALGO | 0.999627 | 3.180211 |
e462f4a3-d588-4eb4-98ea-47e4f6aa1b8a | VectorworksDeveloper/SDKExamples | VectorworksSDK/SDK2021/SDKLib/Source/VWSDK/VWFC/Math/VWNURBSCurve.cpp | #include "StdHeaders.h"
#include "VectorworksSDK.h"
#include "Interfaces/VectorWorks/IParasolidKernel.h"
using namespace VWFC::Math;
VWNURBSCurve::VWNURBSCurve()
{
fNURBSCurveID = 0;
fStartParam = 0;
fEndParam = 1;
fp = NULL;
fpAPI = NULL;
::GS_VWQueryInterface( IID_ParasolidKernel, & fp );
::GS_VWQuery... | ALGO | 0.931506 | 5.504234 |
3f5548db-dc1c-444a-8e8d-2c5982fe22f4 | scorpionrao/DSAlgorithms | src/main/java/datastructures/Hash/ProgrammingAssignment3/phone_book/phone_book.cpp | #include <iostream>
#include <vector>
#include <string>
using std::string;
using std::vector;
using std::cin;
struct Query {
string type, name;
int number;
};
vector<Query> read_queries() {
int n;
cin >> n;
vector<Query> queries(n);
for (int i = 0; i < n; ++i) {
cin >> queries[i].type... | ALGO | 0.996928 | 5.227766 |
207b716a-b5ff-45b2-a936-1ad8b6b36cf4 | sarvex/leetcode-hack | solution/2300-2399/2382.Maximum Segment Sum After Removals/Solution.cpp | using ll = long long;
class Solution {
public:
vector<int> p;
vector<ll> s;
vector<long long> maximumSegmentSum(vector<int>& nums, vector<int>& removeQueries) {
int n = nums.size();
p.resize(n);
for (int i = 0; i < n; ++i) p[i] = i;
s.assign(n, 0);
vector<ll> ans(n)... | ALGO | 0.999958 | 5.517759 |
d5dfe2d5-d57d-4cfb-8428-4b43edd0779d | ada-zqz/leetcode | dfs1376_TimeNeededtoInformAllEmployees.cpp | class Solution {
public:
int ans = 0;
int numOfMinutes(int n, int headID, vector<int>& manager, vector<int>& informTime) {
vector<vector<int>> dp(n); //subordinates
for(int i = 0; i < n; i++) {
if(manager[i] >= 0) dp[manager[i]].push_back(i);
}
sub(headID, manager, i... | ALGO | 0.999963 | 5.967464 |
4e2570c2-0962-4448-b811-893b0e472cf9 | coin-or/SHOT | ThirdParty/mc++/3rdparty/cpplapack/test/zrovector/zrovector-io/main.cpp | //====================================================================[include]
#include <iostream>
#include <cstdlib>
#include <ctime>
#include "cpplapack.h"
using namespace std;
//=======================================================================[main]
/*! main */
int main(int argc, char** argv)
{
srand(time(... | TOOL | 0.877725 | 3.397901 |
73297077-0b84-429e-8a5c-d69147e0c6d8 | timniku/rust-opencv | OpenCV/3rdparty/carotene/src/laplacian.cpp | #include "common.hpp"
#include "saturate_cast.hpp"
#include <vector>
namespace CAROTENE_NS {
bool isLaplacian3x3Supported(const Size2D &size, BORDER_MODE border)
{
return isSupportedConfiguration() && size.width >= 8 &&
(border == BORDER_MODE_CONSTANT ||
border == BORDER_MODE_REPLICATE);
}
v... | ALGO | 0.994908 | 3.302226 |
ae620efc-bb23-41ca-b290-871b921e9643 | mnzaki/2048-AI | search.cpp | #include <cstring>
#include <ctime>
#include <iostream>
#include <memory>
#include "search.hpp"
using namespace Search;
unsigned SearchNode::obj_count = 0;
std::shared_ptr<SearchNode> GeneralSearch::search(Problem* P) {
unsigned max_depth = 0;
std::time_t begin_ts = std::time(0);
std::shared_ptr<SearchNode> n... | ALGO | 0.999616 | 4.670502 |
8e5144f3-3259-4c19-a33a-09d9916565b6 | Hamedhossam/Grocery-Ecommerce | 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 |
df75ea77-7073-4acb-97a2-a9bc0f35b856 | mmmakskl/Knowledge_repository | Языки моделирования/Лабы/systemc/systemc-2.3.3/examples/sysc/simple_bus/simple_bus_arbiter.cpp | /*****************************************************************************
simple_bus_arbiter.cpp : The arbitration unit.
Original Author: Ric Hilderink, Synopsys, Inc., 2001-10-11
*****************************************************************************/
/******************************************... | ALGO | 0.99958 | 5.837616 |
372884c8-a25f-4b1b-a935-5b7968bc442d | ishandutta2007/codeforces | saketh/normal/1110/F.cpp | #include <bits/stdc++.h>
using namespace std;
// template {{{
#define pb push_back
#define eb emplace_back
#define mp make_pair
#define mt make_tuple
#define lb lower_bound
#define ub upper_bound
#define f first
#define s second
#define resz resize
#define sz(x) int((x).size())
#define all(x) (x).begin(), (x).end()
... | ALGO | 0.999976 | 4.489622 |
f0332e26-7143-4501-a2b3-842e1033d53f | raincross7/code-similarity | codes/train_code/problem294/problem294_209.cpp | #include<bits/stdc++.h>
using namespace std;
using ll = long long;
const int nax = 1e6+1;
using dl = long double;
const dl PI = 3.14159265358979323846264;
int main(){
dl a,b,x;
cin>>a>>b>>x;
dl vol =a*a*b;
dl k= a*a*a;
if(x>=vol/2){
dl z= vol - x;
z= 2*z;
dl p = z/k;
dl ret = atan(p);
dl... | ALGO | 0.999787 | 4.154663 |
9267b713-8de1-4dfa-9c8b-f1e30199d2cc | luobuyu/Code-test-daily | leetcode/data_struct/3234.cpp | // #pragma GCC optimize(2)
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define lll long long
#define PII pair<int, int>
namespace FAST_IO
{
static string buf_line;
static int _i;
static int _n;
static char _ch;
template <class T>
inline bool read(T &x)
{
T flag... | ALGO | 0.999981 | 4.61278 |
1affeac9-1ac1-49e6-b953-7afce76479c8 | raisilhamn/competitive-programming | codeforces/1370/A.cpp | #include <bits/stdc++.h>
#define fastio \
ios_base::sync_with_stdio(false); \
cin.tie(NULL)
#define endl "\n"
#define MOD 1000000007
#define ll long long
#define pb push_back
/* notes
*/
using namespace std;
int main()
{
fastio;
int t;
cin >> t;
while (t--)
{
... | ALGO | 0.999692 | 5.044091 |
c5a4b00a-096f-49e4-b018-d33e4ed3adbc | Md-DinIslam/CSES | CSES & AtCoder/Sorting & Searching/Subarray_Sums_II.cpp | /* GREEN UNIVERSITY OF BANGLADESH
Md DinIslam, Batch-221
*/
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const int mxN = 2e5 + 10;
int n;
ll x, v[mxN];
void solve() {
cin >> n >> x;
ll ans = 0, sum = 0;
unordered_map<ll, int> m;
m[0]++;
for (int i = 0; i < n; ++i) {
... | ALGO | 0.999953 | 4.685091 |
ef7a2f24-e587-4d3a-a800-940429a2f2bf | Ivan-Ivashkin/2_semester | Лабораторная работа 1/Упражнение 6/project6.cpp | #include <iostream>
main()
{
int N;
std::cin >> N;
for (int i = 1; i <= N; i++) {
if ( (N % 2 == 0 && i > N/2) || (N % 2 != 0 && i > (N+1)/2) ) {
break;
}
for (int j = 1; j <= N; j++) {
if (j <= i-1 || j > N-i+1) {
std::cout << ' ';
} else {
std::cout << '*';
}
}
std::cout << std::endl... | ALGO | 0.999981 | 3.940486 |
077553f8-510e-4624-a6d3-176afc72148a | kyun1016/algorithm | BOJ/18. 백트래킹/14888 연산자 끼워넣기.cpp | //#include<iostream>
//
//using namespace std;
//
//int N;
//int arr[12];
//// , , ,
//int oper[4];
//int MAX = -1000000007, MIN = 1000000007;
//
//void calc(int iter, int add, int sub, int mul, int div, int ret) {
// // , ִ, ּڰ Ѵ Ȯش.
// if (iter == N - 1) {
// if (ret > MAX)
// MAX = ret;
// if (ret < MIN)
/... | ALGO | 0.999989 | 3.912498 |
4e43f37c-fd1e-49cf-932f-719bd34d40e0 | yucelaydogan/YazilimGelistirmeProje | Algoritma ve Programlama/(10) İki sayıyı karşılaştırma .cpp | #include <stdio.h>
#include <conio.h>
#include <locale.h>
#include <math.h>
main()
{
setlocale(LC_ALL,"Turkish");
int sayi1,sayi2;
printf("birinci sayiyi girin :");
scanf("%d",& sayi1);
printf("ikinci sayy girin :");
scanf("%d",& sayi2);
if(sayi1 > sayi2)
printf("birinci say ikinci sayd... | ALGO | 0.996274 | 3.346195 |
7704d9e5-45de-4bfb-951a-7c7975aa3074 | naufal-fawwaz/mallika | 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 |
b79d87bc-fd89-41f4-9a9d-61bd41a9a224 | NitinSundar/Comp | gfg/missingandrepeating.cpp | #include <bits/stdc++.h>
using namespace std;
typedef long long int lli;
int main()
{
int T;
cin>>T;
while(T--)
{
int n,x;
cin>>n;
int a[n];
for(int i=0;i<n;i++)
{
cin>>a[i];
}
for(int i=0;i<n;i++)
{
int x = abs(a[i])-1;
... | ALGO | 0.999841 | 4.065259 |
1d9b7f77-69de-4b43-9df9-cfe5eea5e8c0 | lz520520/rust-1.75-ollvm | src/llvm-project/libc/src/math/generic/fmaf.cpp | #include "src/math/fmaf.h"
#include "src/__support/common.h"
#include "src/__support/FPUtil/FMA.h"
namespace __llvm_libc {
LLVM_LIBC_FUNCTION(float, fmaf, (float x, float y, float z)) {
return fputil::fma(x, y, z);
}
} // namespace __llvm_libc
| ALGO | 0.872459 | 6.495658 |
067a69d6-1131-4b53-9494-87b08d4b676d | Huanghu-H/MyCppProgram | 未命名1.cpp | #include<iostream>
#include<cmath>
using namespace std;
int in;
int out;
long long path(int a)
{
if(a==-1)out=0;
if(a==0)out=0
if(a==1)out=0;
if(a==2)out=1;
if(a%2==0)
out=path(a-2)+path(a-3);
else
out=path(a-2)+path(a-1);
return out;
}
int main()
{
cin>>in;
cout<<path(in)<<endl;
return 0;
}
| ALGO | 0.999989 | 3.664948 |
d40ebb39-8ad1-43d5-bf65-7ffd1bcb08a5 | ishandutta2007/codeforces | weakesttopology/normal/1444/C.cpp | #include "bits/stdc++.h"
using namespace std;
#define _ ios_base::sync_with_stdio(0);cin.tie(0);
#define endl '\n'
#define debug(x) cerr << #x << " == " << (x) << '\n';
#define all(X) begin(X), end(X)
#define size(X) (int)std::size(X)
using ll = long long;
const int INF = 0x3f3f3f3f;
const ll LINF = 0x3f3f3f3f3f3f3... | ALGO | 0.999959 | 4.003136 |
e3278f7d-c07d-44d6-ad15-285d6dbab1fe | Renzorro/TML-Measurement-Platform | microcontroller-firmware/libraries/SdFat_-_Adafruit_Fork/src/ExFatLib/ExFatPartition.cpp | #define DBG_FILE "ExFatPartition.cpp"
#include "../common/DebugMacros.h"
#include "ExFatLib.h"
//------------------------------------------------------------------------------
// return 0 if error, 1 if no space, else start cluster.
uint32_t ExFatPartition::bitmapFind(uint32_t cluster, uint32_t count) {
uint32_t star... | TOOL | 0.92575 | 5.583535 |
eb14bdc2-136a-4d9f-b3d2-f10cacc46886 | raincross7/code-similarity | codes/train_code/problem056/problem056_253.cpp | #include <iostream>
#include <algorithm>
#include <vector>
#include <unordered_map>
#define ll long long
using namespace std;
void solve(){
int n, d, res = 0;
cin >> n >> d;
vector<int> arr(n);
for(int i = 0; i < n; i++)
cin >> arr[i];
sort(arr.begin(), arr.end());
for(int i = 0; i < d... | ALGO | 0.999927 | 3.938475 |
43837ccc-6fe7-45ce-8168-5a3ad1e7cb98 | StolasIn/leetcode_Submissions | content/maximal-square/Accepted/3-6-2022, 11_12_01 AM/Solution.cpp | // https://leetcode.com/problems/maximal-square
class Solution {
public:
int maximalSquare(vector<vector<char>>& matrix) {
int n = matrix.size(), m = matrix[0].size(), res = 0;
vector<vector<int>> dp(n+1, vector<int>(m+1, 0));
for (int i = 1; i <= n; i++) {
for (int j = 1; j <= ... | ALGO | 0.999631 | 6.442945 |
805f1731-6ea7-49b0-a126-fc928b9ab35f | azartheen/leetcode | 30days-challenge/202005/day26.cpp | /*
Contiguous Array
Given a binary array, find the maximum length of a contiguous subarray with equal number of 0 and 1.
Example 1:
Input: [0,1]
Output: 2
Explanation: [0, 1] is the longest contiguous subarray with equal number of 0 and 1.
Example 2:
Input: [0,1,0]
Output: 2
Explanation: [0, 1] (or [1, 0]) is a long... | ALGO | 0.999993 | 6.420698 |
462dc5a0-7fc1-4703-8d65-96fb231d8371 | Lukebot19/Mastermind | mastermind/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.998857 | 6.76073 |
b2d85420-961e-4065-b3db-202eb18dc562 | anupamkaul/robond | practice/localization/kalman/eigenLib/doc/examples/class_FixedVectorBlock.cpp | #include <Eigen/Core>
#include <iostream>
using namespace Eigen;
using namespace std;
template<typename Derived>
Eigen::VectorBlock<Derived, 2>
firstTwo(MatrixBase<Derived>& v)
{
return Eigen::VectorBlock<Derived, 2>(v.derived(), 0);
}
template<typename Derived>
const Eigen::VectorBlock<const Derived, 2>
firstTwo(c... | TOOL | 0.975522 | 5.200637 |
6bb626e6-4d06-4d9a-bf05-e9738098eaeb | kMahtab1/cpp | stacks.cpp | #include<iostream>
using namespace std;
class stack{
public:
int *arr;
int top;
int size;
stack(int size){
this->size=size;
arr=new int[size];
top=-1;
}
void push(int element){
if(top<size-1){
top++;
arr[top]=element;
}
... | ALGO | 0.997802 | 4.408289 |
66bebac5-099c-4252-b142-2d67fc6ffe55 | tajbidtousif/Codeforces-Solution | Nastya and Rice.cpp | #include<bits/stdc++.h>
using namespace std;
int main()
{
int tc;
cin >> tc;
while(tc--)
{
int n, a, b, c, d;
cin >> n >> a >> b >> c >> d;
int cd_min = abs(c-d);
int cd_max = abs(c+d);
int ab_min = abs(a-b);
int ab_max = abs(a+b);
int ab_final... | ALGO | 0.998183 | 3.871231 |
78d96005-1318-4c66-858f-95ab6b23e3ef | laksh-goel/DSA | Patterns/4.cpp | // 1
// 2 2
// 3 3 3
// 4 4 4 4
// 5 5 5 5 5
// 6 6 6 6 6 6
#include<iostream>
using namespace std;
int main(){
int n;
cout<<"Value of n is: ";
cin>>n;
for(int i=0;i<n;i++){
for(int j=0;j<=i;j++){
cout<<i+1;
}
cout<<endl;
}
return 0;
} | ALGO | 0.999938 | 3.673454 |
f870e260-5cdc-44bb-9223-1b84d3df185c | shirali-saraf/DSA- | 2_linked list/10_circular_deletion.cpp | #include<iostream>
using namespace std;
class node{
public:
int data;
node *next;
};
int main(){
node *head=0,*temp,*newnode,*end;
int choice,num,c;
int g=1;
while(choice)
{
newnode=new node();
cout<<"enter data : ";
cin>>newnode->data;
newnode->next = head;
... | ALGO | 0.997786 | 3.359715 |
57fb158a-308f-48ad-be04-41b7d12f2d8a | mdmarufsheikh70/Assignment_03 | T.cpp | #include<bits/stdc++.h>
using namespace std;
#define optimize() ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
int main()
{
optimize();
int n;
cin >> n;
while (n--)
{
int x, y;
cin >> x >> y;
if(x<y)
{
cout << (y - x) * 2 << endl;;
}
... | ALGO | 0.999607 | 3.741217 |
355c8216-5fd6-443e-850b-b3e7b2481edb | Kirill22022004/anns-coursework | src/index/nsg.cpp | #include <iostream>
#include <fstream>
#include <vector>
#include <sstream>
#include <cmath>
#include <algorithm>
#include <unordered_set>
#include <queue>
#include <limits>
float euclidean_distance(const std::vector<float>& a, const std::vector<float>& b) {
float dist = 0;
for (size_t i = 0; i < a.size(); i++... | ALGO | 0.999966 | 6.544773 |
82c6c54d-3d1b-4775-bb41-e2c90f80ed0b | viscrisn/mit-algo-cpp | Without Projects/FB_Code_2011/Pr_1_try1.cpp | #include<iostream>
#include<math.h>
using namespace std;
int main()
{
int n;
cin>>n;
int cases=n;
int result[n+1];
int k=0;
while(n>0)
{
int a;
float flag=0;
cin>>a;
float b=sqrt(a);
int c=sqrt(a);
for(int j=c;j>=0;j--)
{
for(int i=0;i<=c;i++)
... | ALGO | 0.999284 | 3.172889 |
3df3407e-81a9-426d-a419-8b0096347678 | tbuchs/webSPDZ | Paper-Benchmarks/MPC-Engines/mpSPDZ/SRC_v0.3.7/FHEOffline/FHE-Subroutines.cpp |
#include "Tools/Subroutines.h"
#include "FHE/Rq_Element.h"
#include "FHE/Ciphertext.h"
#include "Tools/Commit.h"
/* This runs the Commit and Open Protocol for data[i][j] of type T
* 0 <= i < num_runs
* 0 <= j < num_players
* On input data[i][j] is only defined for j=my_number
*/
template<class T>
void Commit_... | TOOL | 0.985298 | 4.113846 |
effed900-fdac-42e2-b7d0-abdc1b22c003 | MaiconRenildo/Programas-C | Linguagem c -UERJ/Aleatórios/fatorial.cpp | #include<stdio.h>
long fatorial(int numero);
int main(){
int num;
printf("Informe um numero: ");
scanf("%d",&num);
int b=4;
int x=fatorial(num);
printf("\n\n%d",x);
}
long fatorial(int n){
int a;
if(n>1){
a=n*fatorial(n-1);
printf("\n%d",a);
return a;
}else{
return 1;
}
}
| ALGO | 0.999845 | 3.802002 |
8cde6928-5f73-450a-9282-5dd43dbff06e | anubhvshrma18/Top-100-Liked-Leetcode | Matrix/54. Spiral Matrix/solution.cpp | class Solution {
public:
vector<int> spiralOrder(vector<vector<int>>& matrix) {
vector<int> result;
if (matrix.empty()) return result;
int m = matrix.size();
int n = matrix[0].size();
int left = 0, right = n - 1, top = 0, bottom = m - 1;
while (left ... | ALGO | 0.999998 | 6.626336 |
c1e91049-018b-493b-bfeb-04bdc6fc5570 | saiteja-777/CPP | basic pattern3.cpp | #include<iostream>
using namespace std;
int main(){
int n;
cin>>n;
for(int i=1; i<=n; i++){
for(int j=1; j<=n; j++){
cout<<j<<" ";
}
cout<<endl;
}
return 0;
}
| ALGO | 0.998727 | 3.706189 |
51ca6283-9a93-4c80-975f-c2247db0bebd | Nullray/ICT | software/workload/firesim/host/firesim-lib/lib/boost/libs/graph_parallel/test/distributed_connected_components_test.cpp | // Authors: Douglas Gregor
// Andrew Lumsdaine
#include <boost/graph/use_mpi.hpp>
#include <boost/config.hpp>
#include <boost/throw_exception.hpp>
#include <boost/serialization/vector.hpp>
#include <boost/graph/distributed/adjacency_list.hpp>
#include <boost/graph/connected_components.hpp>
#include <boost/g... | ALGO | 0.990552 | 6.339006 |
8a92a27c-eea1-445c-b76b-cba925d31deb | BinomialSheep/CompetitiveCpp | AtcoderProblems/BootCampHard/002_KleeneInversion.cpp | #include <bits/stdc++.h>
using namespace std;
using ll = long long;
using vi = vector<int>;
using vl = vector<long long>;
using vs = vector<string>;
using vc = vector<char>;
using vb = vector<bool>;
using vpii = vector<pair<int, int>>;
using vpll = vector<pair<long long, long long>>;
using vvi = vector<vector<int>>;
us... | ALGO | 0.999968 | 4.80226 |
8b2878e4-78dd-4c16-ad2a-5c6611e310bf | matihope/kolko_8lo | 12 - Zajecia 22 V/ukz.cpp | #include <iostream>
int main(){
int key_len, code_len;
std::cin >> key_len >> code_len;
std::string key, code;
std::cin >> key >> code;
std::string answer = "";
for(int i = 0; i < code_len; ++i)
{
for(int j = 0; j < key_len && i+j < code_len; ++j) // j < key_len+1
{
if (code[i+j] != key[j])
{
if... | ALGO | 0.999978 | 3.582137 |
802afb51-86f3-41b9-b732-264bcac8ef21 | liannenn/CPP-2024- | Monthly Payments/Monthly Payments/Monthly Payments.cpp | #include <iostream>
#include <cmath>
#include <iomanip>
#include <ctime>
#include <cstdlib>
using namespace std;
int main()
{
//Exercise #19 - Monthly Payments:
//calculate the monthly payment on a loan
double month_int, payments_done, loan_amt, ann_rate, amount_paid, interest_paid, adj_rate, monthly_pay, tot_pai... | TOOL | 0.986482 | 3.534984 |
ac251fa5-cf3a-4316-8595-4d35021eb607 | rrainey/tempo | arduino/driver_tests/integrator.cpp | #include "pose.h"
#ifdef ESP32
#include <esp_attr.h>
#else
#define IRAM_ATTR
#endif
// Implementation of Sebastian Madgwick's "...efficient orientation filter for... inertial/magnetic sensor arrays"
// (see http://www.x-io.co.uk/category/open-source/ for examples and more details)
// which fuses acceleration, rotatio... | ALGO | 0.99473 | 5.910796 |
d75d6798-d1e2-49ec-85fb-4ed38c841633 | akamya997/PracticeCode | 201902_practice/wt3/h.cpp | #include<bits/stdc++.h>
using namespace std;
const int maxn=1e6+7;
char ans[maxn];
int main()
{
std::ios::sync_with_stdio(false);
cin.tie(NULL);
int T;
cin>>T;
while(T--)
{
int n,s;
cin>>n>>s;
if(n*9<s||(n%2==0&&s%2!=0)||(s==1&&n!=1)) cout<<"-1\n";
else {
ans[n]=0;
for(int i=0;i<n/2;i++)
{
if... | ALGO | 0.999618 | 4.029043 |
0c5751b7-56f2-4182-a642-a396b4c6bff3 | Shivampg1/DSA-leetcode- | 617-merge-two-binary-trees/merge-two-binary-trees.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.081852 |
51a666b2-fe51-4890-8303-5bca2264b224 | AroraDrishti/CPP | LAB 2/palindrome.cpp | #include <iostream>
#include <string.h>
using namespace std;
void String();
void Number();
int main()
{
int choice;
cout << "Enter 1: Check a string for palindrome." << endl;
cout << "Enter 2: Check a number for palindrome." << endl;
cin >> choice;
if(choice==1)
{
String();
}
... | ALGO | 0.986343 | 3.60447 |
55171d14-f131-4231-aec5-123d7eb93efb | DARSHAN-THE-CODER/Leetcode-solutions | 948-bag-of-tokens/948-bag-of-tokens.cpp | class Solution {
public:
int bagOfTokensScore(vector<int>& tokens, int power) {
int score=0;
sort(tokens.begin(),tokens.end());
int i=0,j=tokens.size()-1;
int max_score=0;
while(i<=j){
if(power>=tokens[i]){
score++;
max_sco... | ALGO | 0.999969 | 6.243501 |
988bfb3b-f536-4357-acea-c9956ebcc5f6 | dosimpact/BOJ_PS | boj_lecture/sw3/2455.cpp | //https://www.acmicpc.net/problem/2455
#include <cstring>
#include <iostream>
#include <vector>
#include <algorithm>
#include <queue>
using namespace std;
int main()
{
vector<int> ans_list;
int current = 0;
for (int i = 0; i < 4; i++)
{
int in, out;
cin >> in >> out;
current -= ... | ALGO | 0.999776 | 4.095549 |
c525be78-c450-432d-a808-f63048ec259d | ShrutiDhumne/Codeforces_Solutions | DistanceandAxis.cpp | #include <bits/stdc++.h>
using namespace std;
void solve(){
long long int n,k;
cin>>n>>k;
if(n%2==0){
if(k<=n){
if(k%2==0)
cout<<0<<endl;
else
cout<<1<<endl;
}
else
cout<<k-n<<endl;
}
else{
if(k<=n)... | ALGO | 0.999973 | 4.048783 |
8f380aa2-4c16-4a17-8cb9-69223bee0488 | faelhs/mus12 | Util/cryptopp/strciphr.cpp | // strciphr.cpp - written and placed in the public domain by Wei Dai
#include "pch.h"
#ifndef CRYPTOPP_IMPORTS
#include "strciphr.h"
NAMESPACE_BEGIN(CryptoPP)
template <class S>
void AdditiveCipherTemplate<S>::UncheckedSetKey(const byte *key, unsigned int length, const NameValuePairs ¶ms)
{
PolicyInterface &p... | ALGO | 0.90972 | 7.696909 |
24012141-4b3a-4107-8bdd-bbcf253d4d3c | NakulSharma17/DSA-Practice | Arrays/arrahy2.cpp | #include<bits/stdc++.h>
using namespace std;
int main(){
int arrsize;
cout<<"Enter total student"<<endl;
cin>>arrsize;
int mathar[arrsize];
int phyarr[arrsize];
int engarr[arrsize];
// int numbers;
cout<<"Enter Maths,Physics and English number respectively"<<endl;
for(int i =0;i<arrs... | ALGO | 0.937007 | 3.477425 |
ddd43baf-9d8f-46fd-b1bd-b921de37d3a4 | ishandutta2007/codeforces | qaqautomaton/normal/1096/G.cpp | /*
Author: QAQ-Automaton
LANG: C++
PROG: g.cpp
Mail: <EMAIL>
*/
#include<bits/stdc++.h>
#define debug(...) fprintf(stderr,__VA_ARGS__)
#define DEBUG printf("Passing [%s] in LINE %lld\n",__FUNCTION__,__LINE__)
#define Debug debug("Passing [%s] in LINE %lld\n",__FUNCTION__,__LINE__)
#define all(x) x.begin(),x.end()
#defi... | ALGO | 0.999961 | 3.765741 |
9e7f6639-4b27-4c09-9527-2c2ea15fb64b | vansirect/LearnDSA | DSAN/doublelinkedlist.cpp | #include <iostream>
using namespace std;
class Node {
public:
int data;
Node* next;
Node* previous;
};
void insertAtPosition(Node*& head, Node*& tail, int position, int value) {
Node* newNode = new Node();// creating a new node
newNode->data = value;
newNode->next = nullptr;
newNode->previ... | ALGO | 0.999897 | 5.135828 |
769fb716-9705-4e07-acbd-dff01a29f55d | Lee-Seungwook/Cetc | vs/C++/inhe_TelPhoneBook/inhe_TelPhoneBook/main.cpp | //main.cpp
#include <iostream>
#include<stdlib.h>
#include "telphonebook.h"
using namespace std;
typedef Person* ArrayElm
void print_menu()
{
cout << endl << endl ;
cout << "---Menu ---" << endl ;
cout << " 1. Insert" << endl ;
cout << " 2. Delete " << endl ;
cout << " 3. Search " << endl ;
cout << " 4.... | TOOL | 0.948597 | 3.374161 |
7e05a127-c055-4ae7-9508-2e3d613e666f | rawinza555/STM32-CMAKE-FREERTOS | Drivers/CMSIS/NN/Examples/ARM/arm_nn_examples/gru/arm_nnexamples_gru.cpp | /**
* @ingroup groupExamples
*/
/**
* @defgroup GRUExample Gated Recurrent Unit Example
*
* \par Description:
* \par
* Demonstrates a gated recurrent unit (GRU) example with the use of fully-connected,
* Tanh/Sigmoid activation functions.
*
* \par Model definition:
* \par
* GRU is a type of recurrent neura... | ALGO | 0.914648 | 7.471897 |
58d0773a-6e9d-4a2a-b2b1-5865b806ac42 | nkirov/nkirov.github.com | 2016/NETB201/slides/ch06/LinkedBinaryTree.cpp | #include <iostream>
using namespace std;
// Code Fragment: LinkedBinaryTree1
template <typename Object>
class LinkedBinaryTree {
protected:
// ... (insert Node definition here)
//Code Fragment: Node
struct Node { // a node in the tree
Object element; // the element
Node* parent; /... | ALGO | 0.99983 | 6.607572 |
36acb666-eca9-4048-9994-fdfaf5df7187 | sapro313/leetcode-practice | Find the Original Typed String I.cpp | class Solution {
public:
int possibleStringCount(string word) {
int count=0;
unordered_map<char,int>mp;
for(int i=0;i<word.size()-1;i++){
if(word[i]==word[i+1]){
mp[word[i]]++;
}
}
for(auto it:mp){
if(it.second){
count+=it.second;
... | ALGO | 0.999934 | 5.874815 |
57e3a579-b535-487b-9627-59b9b82c0e77 | oguzkeremyildiz/ProgrammingChallenges-CPP | Backtracking/B2/PuzzleProblem15.cpp | //
// Created by Oğuz Kerem Yıldız on 27.12.2020.
//
#include <iostream>
#include <unordered_map>
#include "Board.h"
#include <vector>
using namespace std;
static bool finished = false;
static unordered_map<long, string> traversedWithLength;
string toString(vector<string> moves) {
string string;
for (int i ... | ALGO | 0.999854 | 5.761493 |
d9f52af4-0472-4611-8669-213a834ddda3 | Phoenix-zy0808/DS2024 | exp5/main.cpp | #include <iostream>
#include <vector>
#include <algorithm>
#include <random>
#include <chrono>
std::vector<int> generate_array(const std::string& type, int size) {
std::vector<int> arr(size);
if (type == "sorted") {
std::iota(arr.begin(), arr.end(), 1);
} else if (type == "reverse") {
std::... | ALGO | 0.997472 | 6.110937 |
bd708436-05e9-41cc-bde7-24ce6ef5f90a | mapleelpam/boost | libs/graph/src/graphml.cpp | // Authors: Douglas Gregor
// Jeremiah Willcock
// Andrew Lumsdaine
// Tiago de Paula Peixoto
#define BOOST_GRAPH_SOURCE
#include <boost/foreach.hpp>
#include <boost/optional.hpp>
#include <boost/throw_exception.hpp>
#include <boost/graph/graphml.hpp>
#include <boost/graph/dll_import_exp... | TOOL | 0.905352 | 7.149206 |
e4f85f38-9150-4dbb-af61-efdeefbf17a4 | shbhmexe/GeeksforGeeks-Sol | Medium/LongestConsecutiveSubsequence.cpp | class Solution {
public:
// Function to return length of longest subsequence of consecutive integers.
int longestConsecutive(vector<int>& arr) {
int n = arr.size();
if (n == 0) return 0;
int longest = 1;
unordered_set<int> st;
// Step 1: Insert all elements into the s... | ALGO | 0.999767 | 5.667031 |
01f24bda-8517-4dbe-96fb-0bf9a4bd8b74 | CyberCastle/HexaMotion | tests/hexapod_trajectory_analysis_test.cpp | #include "../src/body_pose_config_factory.h"
#include "../src/body_pose_controller.h"
#include "../src/gait_config.h"
#include "../src/gait_config_factory.h"
#include "../src/leg_stepper.h"
#include "../src/walk_controller.h"
#include "../src/workspace_analyzer.h"
#include "test_stubs.h"
#include <algorithm>
#include <... | TEST | 0.912794 | 5.717912 |
283b58d2-8922-4781-b2cf-212b72d7fdb5 | TheStremty/cpp_exercises | 1.01-1.10/1.04.cpp | #include <iostream>
using namespace std;
int main()
{
int p,q;
cout << "Podaj przekatne p i q:\n";
cin >> p;
cin >> q;
cout << 0.5 * p * q;
return 0;
} | ALGO | 0.996985 | 3.58769 |
ddade15a-b52e-4b18-94b0-5a333680fc14 | my-carla/llvm-carla | projects/libcxx/test/std/algorithms/alg.nonmodifying/alg.is_permutation/is_permutation.pass.cpp | // <algorithm>
// template<class ForwardIterator1, class ForwardIterator2>
// constexpr bool // constexpr after C++17
// is_permutation(ForwardIterator1 first1, ForwardIterator1 last1,
// ForwardIterator2 first2);
#include <algorithm>
#include <cassert>
#include "test_iterators.h"
#include "t... | TEST | 0.940412 | 7.634568 |
026edf9e-8ec7-4f69-a7f1-04fc35119d07 | lgmamaniap/leet-code-practice | exercises/easy-level/checkIfString.cpp | // 1961. Check If String Is a Prefix of Array
#include <iostream>
#include <vector>
using namespace std;
bool isPrefixString(string s, vector<string>& words) {
string resp = "";
for (int i = 0; i < words.size() && resp.size() < s.size(); i++) {
resp += words[i];
}
return s == resp;
}
int main()
{
vec... | ALGO | 0.999419 | 5.966208 |
b23ee0c6-0a1a-4092-9218-7ea042d244f4 | varun2430/450_DSA_Sheet | array/trapping_rain_water_problem.cpp | // Given an array arr[] of N non-negative integers representing the height of blocks. If
// width of each block is 1, compute how much water can be trapped between the blocks during
// the rainy season.
// Example:
// Input: N = 6
// arr[] = {3,0,0,2,0,4}
// Output: 10
#include <bits/stdc++.h>
using namespac... | ALGO | 0.999958 | 6.946473 |
4fc2932e-bf6b-4160-b4d8-37e6ab72dced | JeffProgrammer/PhysX5-Cmake | physx/source/geomutils/src/GuBounds.cpp | #include "GuBounds.h"
#include "geometry/PxBoxGeometry.h"
#include "geometry/PxSphereGeometry.h"
#include "geometry/PxPlaneGeometry.h"
#include "geometry/PxConvexMeshGeometry.h"
#include "geometry/PxTetrahedronMeshGeometry.h"
#include "geometry/PxTriangleMeshGeometry.h"
#include "geometry/PxHeightFieldGeometry.h"
#inc... | TOOL | 0.98937 | 7.86517 |
adb9ad5d-f4b9-45c0-ba47-c45335bbbe80 | bhavyak13/Competitive-Programming | CodeForces/contest 850/B_Cake_Assembly_Line.cpp |
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#include <functional>
using namespace __gnu_pbds;
using namespace std;
typedef tree<int, null_type, less_equal<int>, rb_tree_tag,tree_order_statistics_node_update>ordered_set;
//input full vector
template<class T>is... | ALGO | 0.999908 | 3.649606 |
f2ef23e6-e474-4989-a457-b64d63c3ffb7 | sasidharan10/Cpp | Leetcode/DP/1937_max_points_cost.cpp | #include <bits/stdc++.h>
using namespace std;
class Solution
{
public:
// Recursion
long long maxPointsRecur(int row, int col, int n, int m, vector<vector<int>> &points)
{
if (row == n)
return 0;
long long maxi = INT_MIN;
for (int j = 0; j < m; j++)
{
... | ALGO | 0.99999 | 5.891464 |
a841b17b-99d4-47d8-b599-7141e53a932d | geetikabatra/Problems-Practice | ProblemPractice/recursion/print_num.cpp | #include "/Users/gbatra/ProblemPractice/stdc++.h"
using namespace std;
void print_num(int n){
if(n==1){
cout<<1<< " ";
return;
}
print_num(n-1);
cout << n << " ";
return;
}
int main(){
print_num(6);
cout <<endl;
} | ALGO | 0.994287 | 3.558963 |
8b293b8f-fef4-4485-85be-2bd38574c64b | ishandutta2007/codeforces | andrew.volchek/normal/696/A.cpp | #include <iostream>
#include <cstdio>
#include <string>
#include <string.h>
#include <queue>
#include <math.h>
#include <cmath>
#include <map>
#include <set>
#include <vector>
#include <algorithm>
#include <bitset>
#include <list>
#include <ctype.h>
#include <cassert>
#include <stack>
#include <fstream>
#include <unord... | ALGO | 0.999755 | 3.81225 |
d85a82c4-f6ab-4ce0-a2b3-eb35ceb8dfd0 | rorubyy/leetcode-C | leetcode/leetcode142.cpp |
#include <iostream>
#include <vector>
#include <unordered_map>
using namespace std;
struct ListNode
{
int val;
ListNode *next;
ListNode(int x) : val(x), next(NULL) {}
};
ListNode *detectCycle(ListNode *head)
{
ListNode *fast = head, *slow = head; // fast: two step, slow: one step
while (fast && f... | ALGO | 0.999975 | 4.842114 |
acde3de0-edb9-441e-8b2f-e9a02f9639be | arehart95/Algorithms-and-Data-Structures-Projects | Algorithmic Design and Technique/Warmup/FibonacciLastDigit.cpp | #include <iostream>
using std::cout;
using std::cin;
using std::endl;
using ll = long long int;
// I learned that Fibonacci numbers repeat after every 60 digits which I hadn't known before!
ll getFibonacci(ll F[], ll n) {
F[0] = 0;
F[1] = 1;
for (ll i = 2; i <= n; i++)
F[i] = (F[i - 1] + F[i -... | ALGO | 0.999774 | 3.984166 |
d934a2df-c71e-485e-ae1e-1d8268660680 | wanke1997/sglang-compress | sgl-kernel/3rdparty/flashinfer/3rdparty/spdlog/tests/utils.cpp | #include "includes.h"
#ifdef _WIN32
#include <windows.h>
#else
#include <sys/types.h>
#include <dirent.h>
#endif
void prepare_logdir() {
spdlog::drop_all();
#ifdef _WIN32
system("rmdir /S /Q test_logs");
#else
auto rv = system("rm -rf test_logs");
if (rv != 0) {
throw std::runtime_... | TOOL | 0.852609 | 6.58574 |
fa8e07bf-8f07-413b-b6e0-ca3c66bdd8eb | ishandutta2007/codeforces | dingdingsb/normal/1436/A.cpp | #include<bits/stdc++.h>
namespace in{
char buf[1<<21],*p1=buf,*p2=buf;
inline int getc(){return p1==p2&&(p2=(p1=buf)+fread(buf,1,1<<21,stdin),p1==p2)?EOF:*p1++;}
template <typename T>inline void read(T& t){
t=0;int f=0;char ch=getc();while (!isdigit(ch)){if(ch=='-')f = 1;ch=getc();}
while(isdigit(ch)){t=t*10+... | ALGO | 0.99993 | 3.935617 |
d3378583-91ed-4a96-bfd7-abead7f204ba | Fork512Hz/Fork512Hz_Codeforces | _Archived/2024_02/929/F2.cpp | // Problem: F. Turtle Mission: Robot and the Earthquake
// Contest: Codeforces - Codeforces Round 929 (Div. 3)
// URL: https://codeforces.com/contest/1933/problem/F
// Memory Limit: 256 MB
// Time Limit: 3000 ms
//
// Powered by CP Editor (https://cpeditor.org)
#include<cstdio>
#include<algorithm>
#include<iostream>
... | ALGO | 0.99995 | 4.114271 |
e52cae52-1385-43cb-882d-bbb7cd1df19e | Farrius/cp | harbour/summercamp/segment_tree/a.cpp | #include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
const int MX = 2e5 + 5;
vector<ll> seg(MX * 4);
vector<int> ar(MX);
int n;
void build (int lx, int rx, int x) {
if (lx == rx) {
seg[x] = ar[lx];
return;
}
int m = (lx + rx)/2;
build(lx... | ALGO | 0.999938 | 5.301673 |
9ff78e3b-08e5-47de-a911-27f160a0a600 | sunruoshi/Luogu-Codes | templates/splay-oi.cpp | // template of splay tree
// OI style
// <EMAIL>
#include <cstdlib>
struct SplayNode {
int val;
SplayNode *L, *R, *F;
SplayNode(int x) : val(x), L(NULL), R(NULL), F(NULL) {}
};
void rightRotate(SplayNode* &cur) {
SplayNode* y = cur->F;
cur->F = y->F;
if (cur->F) {
if (y == cur->F->L) c... | ALGO | 0.999976 | 4.149166 |
39ce3b30-0c5a-4352-a909-dcfc5032bbb1 | Ayushkant3011/DSA-Codehelp | Heaps/heaps3.cpp | #include<iostream>
#include<vector>
#include<queue>
using namespace std;
class Info{
public:
int data;
int rowIndex;
int colIndex;
Info(int a, int b, int c){
this->data = a;
this->rowIndex = b;
this->colIndex = c;
}
};
class compare{ //... | ALGO | 0.999954 | 4.61197 |
1d343b40-f0dd-47f5-aece-00a52d2e704a | Proman2702/mppo_app | windows/runner/utils.cpp | #include "utils.h"
#include <flutter_windows.h>
#include <io.h>
#include <stdio.h>
#include <windows.h>
#include <iostream>
void CreateAndAttachConsole() {
if (::AllocConsole()) {
FILE *unused;
if (freopen_s(&unused, "CONOUT$", "w", stdout)) {
_dup2(_fileno(stdout), 1);
}
if (freopen_s(&unuse... | TOOL | 0.998733 | 6.76775 |
d637a41f-e7ff-46aa-b3c4-f0e902983bd8 | 4C-multiphysics/4C | src/fsi/src/partitioned/nonlinear_solver/4C_fsi_nox_fixpoint.cpp | #include "4C_fsi_nox_fixpoint.hpp"
#include <NOX_Abstract_Group.H>
#include <NOX_GlobalData.H>
FOUR_C_NAMESPACE_OPEN
NOX::FSI::FixPoint::FixPoint(
const Teuchos::RCP<::NOX::Utils>& utils, Teuchos::ParameterList& params)
: utils_(utils)
{
}
bool NOX::FSI::FixPoint::reset(
const Teuchos::RCP<::NOX::Global... | TOOL | 0.998633 | 6.943864 |
19b093a6-d44b-4803-9bae-e7e0db110f3c | LibertyDreamer/LeetCode | 1365HowManyNumbersAreSmallerThanTheCurrentNumber.cpp | /*
Given the array nums, for each nums[i] find out how many numbers in the array are smaller than it. That is, for each nums[i] you have to count the number of valid j's such that j != i and nums[j] < nums[i].
Return the answer in an array.
Example 1:
Input: nums = [8,1,2,2,3]
Output: [4,0,1,1,3]
Explanation:
For n... | ALGO | 0.999987 | 6.152555 |
8b186b69-e71b-4ee8-8a7b-7d01439b6746 | ZivBA/CPPEx3 | BonusParallelChecker.cpp | #include <string>
#include <cstdlib>
#include <cassert>
#include <cstdio>
#include <cstring>
#include <fstream>
#include <iostream>
#include <vector>
#include <stack>
#include <ctime>
#include <chrono>
#include "Complex.h"
#include "Matrix.hpp"
//std::stack<clock_t> tictoc_stack;
std::stack<std::chrono::time_point<std... | TOOL | 0.957558 | 3.654929 |
ae22e3a3-7cb2-4f5b-9887-a0a3519e48d7 | rahult7526/Leetcode | 2422-query-kth-smallest-trimmed-number/query-kth-smallest-trimmed-number.cpp | class Solution {
public:
vector<pair<string,int>> countingSort(vector<pair<string,int>>& nums,int& d,int& n){
vector<pair<int,int>> temp;
for(int i=0;i<nums.size();++i){
temp.push_back(make_pair(nums[i].first[n-d]-'0',nums[i].second));
}
vector<int> count(10);
for... | ALGO | 0.999923 | 6.446032 |
e4c2a19c-5288-4ae6-960e-e5774e01edc1 | xiaohejun/fantastic-acm | codeforces/Polynomial_Round_2022 /B.cpp | #include <bits/stdc++.h>
using namespace std;
// 类型定义
typedef long long LL;
#ifndef ONLINE_JUDGE
#include "../../algo/debug.h"
#else
#define dbg(x...)
#endif
#define fastio ios::sync_with_stdio(0); cin.tie(0);
#include "algo/algo.h"
void solve()
{
int n, m, k;
cin >> n >> m >> k;
dbg(n, m, k)
... | ALGO | 0.999851 | 4.433085 |
7009962f-f4ac-45ca-b9d9-020090fe1e8d | jithinsai/lab-4 | lab4_question7.cpp | #include <iostream>
using namespace std;
int pallindrome(int n);
int main() {
int n;
cout<<"enter a number\n";
cin>>n;
if(pallindrome(n)==n)
cout<<"the number "<<n<<" is pallindrome";
else
cout<<"the number "<<n<<" is not pallindrome";
return 0;
}
int rev=0,r;
int pallindrome(... | ALGO | 0.997969 | 3.876835 |
03b3d947-e541-4465-a004-384d2f90b55a | xk-wang/onsets_and_frames_tensorrt | cpp/eigen/eigen3/bench/perf_monitoring/gemm/lazy_gemm.cpp | #include <iostream>
#include <fstream>
#include <vector>
#include <Eigen/Core>
#include "../../BenchTimer.h"
using namespace Eigen;
#ifndef SCALAR
#error SCALAR must be defined
#endif
typedef SCALAR Scalar;
template<typename MatA, typename MatB, typename MatC>
EIGEN_DONT_INLINE
void lazy_gemm(const MatA &A, const Ma... | ALGO | 0.974671 | 6.117427 |
c3eb8959-eefc-4180-b4b5-606c6fbfd951 | mourra950/Leethub-Problems | 0026-remove-duplicates-from-sorted-array/0026-remove-duplicates-from-sorted-array.cpp | class Solution {
public:
int removeDuplicates(vector<int>& nums) {
int counter = 0, current = -101;
for(int i =0;i<nums.size();++i)
{
if(nums[i]==current)
continue;
else
{
nums[counter]=nums[i];
curr... | ALGO | 0.999763 | 5.965791 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.