uuid string | repo_name string | relative_path string | content string | category string | algo_rel_score float64 | quality_score float64 |
|---|---|---|---|---|---|---|
9bd0c9bc-5110-43b0-aed3-3785e1cd888d | Gaurav-20/LeetCode-Solutions | 0938-range-sum-of-bst/0938-range-sum-of-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.999996 | 6.774167 |
5165f751-e12b-4d0c-8087-8186173d4636 | tvdv/metastorey | lib/boost_1_53_0/libs/geometry/example/c06_custom_polygon_example.cpp | // Boost.Geometry (aka GGL, Generic Geometry Library)
#include <boost/geometry/geometry.hpp>
#include <boost/geometry/geometries/register/point.hpp>
#include <boost/geometry/geometries/register/ring.hpp>
struct my_point
{
my_point(double an_x = 0, double an_y = 0)
: x(an_x)
, y(an_y)
{}
... | TOOL | 0.954373 | 7.845809 |
35eb74cc-9bbc-41d6-848c-9123fc193b63 | KenD51/ScrabbleBoard | Game.cpp | #include "scrabble.h" // Include the header file that defines all the classes and methods used
#include <algorithm> // For std::sort to sort players based on the drawn tiles
#include <iostream> // For input and output, e.g., displaying prompts and results
#include <fstream> // For file handling (e... | ALGO | 0.917219 | 6.999105 |
dd6eff48-52eb-4e4c-8c15-5160c175dc30 | jyytf9/agrrgw | sklearn/utils/src/MurmurHash3.cpp | // Note - The x86 and x64 versions do _not_ produce the same results, as the
// algorithms are optimized for their respective platforms. You can still
// compile and run any of them on any platform, but your performance with the
// non-native version will be less than optimal.
#include "MurmurHash3.h"
//-------------... | ALGO | 0.998511 | 7.213296 |
2348490b-6734-4d92-aba2-36ed5db2e0c1 | omarheeh/flutteradvansedcorse | 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 |
20e0c1b9-e2d7-479f-a0cd-6530c5fd4356 | qiaozishun4/CSP2024_BJ | BJ-Junior/answers/BJ-J00140/poker/poker.cpp | #include<set>
#include<cstdio>
#include<iostream>
using namespace std;
int n,ans=52;
set<string> s;
set<string>::iterator it;
int main()
{
freopen("poker.in","r",stdin);
freopen("poker.out","w",stdout);
cin>>n;
for(int i=0;i<n;i++)
{
string temp;
cin>>temp;
s.insert(temp);
... | ALGO | 0.978153 | 3.763001 |
ccc53754-2a68-495d-9f2a-a42fb9e6b6a6 | SnehilVukkusila/graphresources | March-2021/17. Generate Random Point in a Circle.cpp | /*
Generate Random Point in a Circle
===================================
Given the radius and x-y positions of the center of a circle, write a function randPoint which generates a uniform random point in the circle.
Note:
input and output values are in floating-point.
radius and x-y position of the center of the circ... | ALGO | 0.981258 | 5.99703 |
5779fb0f-137e-42df-9e0a-3f4a0e990b10 | ishandutta2007/codeforces | 1092515503/normal/1204/E.cpp | #include<bits/stdc++.h>
using namespace std;
const int mod=998244853;
int n,m,fac[4010],inv[4010],len,f[4010],res;
int ksm(int x,int y=mod-2){int z=1;for(;y;y>>=1,x=1ll*x*x%mod)if(y&1)z=1ll*z*x%mod;return z;}
int C(int x,int y){return 1ll*fac[x]*inv[y]%mod*inv[x-y]%mod;}
int main(){
scanf("%d%d",&n,&m),len=n+m;
fac[0... | ALGO | 0.999995 | 4.352633 |
84492754-b018-4706-8f60-652abb467380 | AniKouDev/CodeChef | 0-1000 Beginner Level/Blobby_Volley_Scores.cpp | #include <iostream>
#include <string>
using namespace std;
int main(){
int t;
cin >> t;
while(t--){
int n;
cin >> n;
string s;
cin >> s;
int turn = 0;
char chance = 'A';
int arr[2]={0};
for(int i = 0; i < n; i++){
if(s[i] == chance... | ALGO | 0.999536 | 3.862608 |
541dc02f-f61b-46ed-b185-c7d83fcde970 | Fisher87/leetcode | cplus/rearrange-array-to-maximize-prefix-score.cpp | // Time: O(nlogn)
// Space: O(1)
// sort, greedy
class Solution {
public:
int maxScore(vector<int>& nums) {
sort(rbegin(nums), rend(nums));
int i = 0;
for (int64_t curr = 0; i < size(nums); ++i) {
curr += nums[i];
if (curr <= 0) {
break;
... | ALGO | 0.99995 | 5.938667 |
0ce713eb-5b7d-41c7-bb3b-d66d14a6d57b | Ethereal-OS/frameworks_av | media/libeffects/lvm/lib/Common/src/Shift_Sat_v32xv32.cpp | /**********************************************************************************
INCLUDE FILES
***********************************************************************************/
#include "VectorArithmetic.h"
/**********************************************************************************
FUNCTION Shift_... | ALGO | 0.987071 | 5.465417 |
e25ff35d-a21f-460c-a469-f41afed8c0dd | krotrn/CPP | String/string1/CountVowelInString.cpp | #include<iostream>
using namespace std;
int main(){
cout<<"Enter The No. Of Character : ";
int n;
cin >> n;
char c[n];
int count = 0;
for (int i = 0; i < n; i++){
cin >> c[i];
if (c[i] == 'a' || c[i] == 'e' || c[i] == 'i' || c[i] == 'o' || c[i] == 'u'){
count++;
... | ALGO | 0.999128 | 4.005153 |
14830240-9e8d-44d4-8a56-8e0c9f68f590 | Chris-AC9KH/HeliPilot | libraries/AP_HAL_Linux/Flow_PX4.cpp | #include <AP_HAL/AP_HAL.h>
#if CONFIG_HAL_BOARD_SUBTYPE == HAL_BOARD_SUBTYPE_LINUX_BEBOP
#include "Flow_PX4.h"
#include <cmath>
#include <stdio.h>
#include <stdlib.h>
extern const AP_HAL::HAL& hal;
using namespace Linux;
Flow_PX4::Flow_PX4(uint32_t width, uint32_t bytesperline,
uint32_t max_flow_... | ALGO | 0.992542 | 5.151992 |
156ee527-23f3-4b6e-9d9a-f76eefc1473f | bazelment/boost | msm/doc/HTML/examples/iPodEuml.cpp | #include <vector>
#include <set>
#include <string>
#include <iostream>
// we need more than the default 20 states
#define FUSION_MAX_VECTOR_SIZE 20
// we need more than the default 20 transitions
#include "boost/mpl/vector/vector50.hpp"
#include <boost/msm/back/state_machine.hpp>
#include <boost/msm/front/euml/euml.hpp... | TOOL | 0.930061 | 5.78928 |
17101e37-2c5d-453c-a776-04e59219816f | evanjs97/CS410 | Libraries/eigen_library/doc/examples/Tutorial_ReductionsVisitorsBroadcasting_reductions_norm.cpp | #include <Eigen/Dense>
#include <iostream>
using namespace std;
using namespace Eigen;
int main()
{
VectorXf v(2);
MatrixXf m(2,2), n(2,2);
v << -1,
2;
m << 1,-2,
-3,4;
cout << "v.squaredNorm() = " << v.squaredNorm() << endl;
cout << "v.norm() = " << v.norm() << endl;
cout << "v.lpN... | ALGO | 0.99873 | 4.03798 |
c5aa7a8e-b6c9-4d37-975b-5a2fef63e202 | SE-Materials/DataStructures | MathsAndStats/NthPermutation/main.cpp | #include <iostream>
#include <string>
long long factorial(int num)
{
return (num == 0 || num == 1) ? 1 : num*factorial(num-1);
}
// Assuming str is in sorted order
std::string getKthPermutation(const std::string& str, int k)
{
std::string dest{};
std::string source = str;
long long f = factorial(... | ALGO | 0.999923 | 6.22374 |
5011ab06-8696-4181-8b63-b507f49fcf7e | lkic1625/SimpleProject | algorithm_pr/BAEK5615.cpp | #include<iostream>
using namespace std;
using ull = unsigned long long;
int N;
ull add_with_mod(ull a, ull b, ull mod) {
a = a % mod;
b = b % mod;
return (a + b) % mod;
}
ull mul_with_mod(ull a, ull b, ull mod) {
a = a % mod;
b = b % mod;
ull ret = 0;
while (b > 0) {
if (b % 2 == 1) {
ret = add_with_mod... | ALGO | 0.999891 | 4.164939 |
de1d7eb8-ee6d-4046-aef9-649326ddec84 | TALWTN/talwtn | SDK/third_party/boost_1_69_0/boost/regex/performance/table_helper.cpp | #ifdef _MSC_VER
# pragma warning (disable : 4224)
#endif
#include <boost/regex.hpp>
#include <boost/lexical_cast.hpp>
#include <boost/filesystem.hpp>
#include <boost/filesystem/fstream.hpp>
#include <boost/functional/hash.hpp>
#include <vector>
#include <set>
#include <iostream>
#include <sstream>
#include <iomanip>
... | TOOL | 0.925187 | 4.816498 |
b888101a-8dbe-4a02-bd11-94ba97d2cdf9 | Komalbaghel08/cpp | Loop/whileloop/palindrone.cpp | #include <iostream>
using namespace std;
int main()
{
int n, r = 0, k;
cout << "Enter a number/n";
cin >> n;
k=n;
while (n > 0)
{
r = r * 10 + n % 10;
n = n / 10;
}
if (r == k)
{
cout << "n is palindrome/n";
}
else
{
cout << "n is not palin... | ALGO | 0.999443 | 4.347149 |
243fc177-07fd-444c-94db-a4ab2972d998 | mosliem/SPOJ-solution | STPAR - Street Parade - SPOJ (C++).cpp | #include <iostream>
#include <stack>
using namespace std;
int main()
{
int n;
while (cin >> n && n != 0)
{
int x;
int j = 1;
stack<int>trunks;
for (int i = 1; i <= n; i++)
{
cin >> x;
if (x == j)
{
j++;
}
else
{
while (!trunks.empty() && trunks.top() == j)
{
trunks.pop()... | ALGO | 0.999957 | 3.9418 |
ac093ba4-380e-4678-8b5e-ab1fa6123f4e | begoon/acm | acmp.ru/048, Наихудший делитель/problem.cpp | #include <iostream>
#include <vector>
#include <map>
#include <set>
#include <stack>
#include <sstream>
#include <fstream>
#include <iomanip>
#include <iterator>
#include <numeric>
#include <limits>
#include <algorithm>
#include <string>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <cassert>
#ifdef _D... | ALGO | 0.999939 | 4.43099 |
0dc93a7a-7c7d-423a-a88a-84cb348aa574 | KLRajapaksha/C_CPP_Projects | 1111.cpp | #include<stdio.h>
int arr1[10000];
int arr2[1000];
int arr3[1000];
int arr4[1000];
int l,u,r;
int q;
int select(int,int,int,int);
int main (){
int f=0;
printf("input number of test cases: ");
printf("\n");
int t;
scanf("%d",&t); //input number of test cases
int k;
for(k=1;k<=t;k++){
... | ALGO | 0.99983 | 3.198257 |
cc18d6a9-6375-4086-8325-06b8329247c3 | tiqwab/atcoder | abc167/e/main.cpp | #include <algorithm>
#include <cassert>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <vector>
#include <limits.h>
using namespace std;
typedef long long ll;
template<class T>
inline bool chmax(T &a, T b) {
if(a < b) {
a = b;
return true;
}
return false;
}
... | ALGO | 0.999965 | 4.921896 |
edf11ba1-5a90-4f87-8e43-4c4263d3eb73 | indy256/codelibrary | cpp/numbertheory/schreier_sims.cpp | #include <bits/stdc++.h>
using namespace std;
// https://en.wikipedia.org/wiki/Schreier%E2%80%93Sims_algorithm
// time: O(n^2 lg^3 |G| + t n lg |G|)
// mem : O(n^2 lg |G| + tn)
// t : number of generator
namespace SchreierSimsAlgorithm {
using vi = vector<int>;
using pii = pair<int, int>;
vi inv(const vi &p) {
... | ALGO | 0.999969 | 5.629317 |
1fd98e22-2abe-4ad8-a2bc-16cd3ed8a32a | ishandutta2007/codeforces | molamola/normal/566/D.cpp |
#define _CRT_SECURE_NO_WARNINGS
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <memory.h>
#include <math.h>
#include <assert.h>
#include <stack>
#include <queue>
#include <map>
#include <set>
#include <algorithm>
#include <string>
#include <functional>
#include <vector>
#include <de... | ALGO | 0.999956 | 4.305994 |
f665bf59-31b0-44c2-b9a5-d87d4f6da5da | RaduAlbastroiu/Minotaur | SimpleGameCocos/cocos2d/tools/simulator/libsimulator/lib/platform/win32/PlayerFileDialogServiceWin.cpp | #include <string.h>
#include "stdafx.h"
#include <Windowsx.h>
#include <Shlobj.h>
#include <Commdlg.h>
#include "cocos2d.h"
#include "PlayerUtils.h"
#include "PlayerFileDialogServiceWin.h"
PLAYER_NS_BEGIN
PlayerFileDialogServiceWin::PlayerFileDialogServiceWin(HWND hwnd)
: _hwnd(hwnd)
{
}
std::string PlayerFileDial... | TOOL | 0.898394 | 5.752508 |
4be60861-84cf-4677-ad84-202bdd10c609 | xizhonghua/zoj | vol_24/3326.cpp | /2893302 2012-05-15 09:57:44 Accepted 3326 C++ 150 180 花花的表世界
#include<stdio.h>
int dm[] = {31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};
int is_leap(int year)
{
return !(year % 4) && year % 100 || !(year % 400);
}
int get_days(int y, int m)
{
if(is_leap(y) && m == 2)
{
return 29;
}
return dm[m-1];
}
i... | ALGO | 0.999976 | 3.899463 |
047fbc6e-5445-4624-bb32-7ee67060fe4b | jiun0507/Interview-prep | Baekjoon/BRUTE]queen.cpp | //baekjoon 9663
#include <iostream>
#include <vector>
using namespace std;
int n;
int ans = 0;
int check_dig[15][15];
int check_col[15][15];
int dy[2] = {1, -1};
int dx[2] = {0, 0};
int dy2[4] = {1, 1, -1,-1};
int dx2[4] = {-1, 1, 1, -1};
void queen(int row, int col, int val){
for(int i = 0;i<2;i++){
for(int j = 0... | ALGO | 0.999981 | 3.952236 |
cf648366-0b7e-4a5b-a026-f16be50addff | GutsArmour/C-Data-Sort | Task 2a&b, 5a, 6b&c/task2b.cpp | #include <iostream>
#include <map>
#include <string>
#include <utility>
#include <fstream>
#include <sstream>
#include <algorithm>
#include <vector>
std::vector<std::pair<std::string, std::string>> sort(std::vector<std::pair<std::string, std::string>> & wall) {
std::vector<std::pair<std::string, std::string>> sort... | ALGO | 0.999356 | 4.503614 |
3cea3a39-b84a-4415-9b77-4bd833b6031e | MahmudNiloy680/XPSC_Phitron_B6 | Week_4_Two_Pointers_&_Slidinig_Window_1/A_Topicwise.cpp | // Problem Link: https://vjudge.net/contest/710372#problem/A
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define nl '\n'
#define tt(x) int x; cin >> x; while (x--)
int main()
{
ios::sync_with_stdio(false);
cin.tie(nullptr);
string x; cin >> x;
int it = 0;
string s;
whil... | ALGO | 0.998895 | 3.794149 |
6f2eade9-13e9-4fca-b9ba-de63f260dbcf | miguelsndc/competitive-programming-lib | Solutions/Codeforces/413514_zu.cpp | #include <bits/stdc++.h>
using namespace std;
#define all(x) (x).begin(), (x).end()
#ifdef CARNEDESOOOL
#define debug(...) dbg(#__VA_ARGS__, __VA_ARGS__)
template <typename... T>
void dbg(const char* names, T... args) {
const char* p = names;
((cout << string(p, strchr(p, ',') ? strchr(p, ',') : p + strlen(p)... | ALGO | 0.999984 | 4.601769 |
6f126563-4bcb-42ef-8cd6-2695de13e73e | Sachin-Dabgar/dsa_supreme | homework/arrays/spiral-print.cpp | #include<iostream>
#include<vector>
using namespace std;
void printSpiral(vector<vector<int>> matrix){
int nCols = matrix[0].size();
int nRows = matrix.size();
int startingRow = 0;
int endingCol = nCols-1;
int endingRow = nRows-1;
int startingCol = 0;
int totalElements = nRows*nCols;
i... | ALGO | 0.999897 | 4.684621 |
28214836-f420-4309-a845-19619501bb64 | hades2013/vscode-cpp | next_permutation.cpp | #include <algorithm>
#include <string>
#include <iostream>
int main()
{
std::string s = "aba";
std::sort(s.begin(), s.end());
do {
std::cout << s << '\n';
} while(std::next_permutation(s.begin(), s.end()));
} | ALGO | 0.999672 | 4.653592 |
b50839f0-5d56-4c00-a30e-a353b21cf5ba | UtkarshPathrabe/Competitive-Coding | Google APAC/2016 APAC Test Practice Round/Problem C Moist/Moist.cpp | #include <bits/stdc++.h>
using namespace std;
int main (void) {
ofstream cout;
ifstream cin;
cout.open("C-small-practice-2.out");
cin.open("C-small-practice-2.in");
int T;
cin >> T;
for (int t = 1; t <= T; t++) {
int N, cost = 0;
string last = " ", buf;
cin >> N;
getline (cin, buf);
for (int i = 0; i... | ALGO | 0.999413 | 4.099521 |
4052c186-38af-4915-af27-138352654170 | riscv-android-src/toolchain-rustc | src/llvm-project/llvm/lib/CodeGen/LiveInterval.cpp | #include "llvm/CodeGen/LiveInterval.h"
#include "LiveRangeUtils.h"
#include "RegisterCoalescer.h"
#include "llvm/ADT/ArrayRef.h"
#include "llvm/ADT/STLExtras.h"
#include "llvm/ADT/SmallPtrSet.h"
#include "llvm/ADT/SmallVector.h"
#include "llvm/ADT/iterator_range.h"
#include "llvm/CodeGen/LiveIntervals.h"
#include "llvm... | TOOL | 0.99628 | 7.940732 |
14bfa457-da8f-40fb-a50f-2650815581f0 | knst/Competitive-programming | codeforces/256/a.cpp | /*****************************************************************************
* codeforces: knst
* topcoder: knstqq
* projecteuler: knstqq
* **************************************************************************/
#include <algorithm>
#include <iostream>
#include <limits>
#include <map>
#include <set>
#i... | ALGO | 0.999735 | 3.008378 |
7b447342-b402-43e8-801b-d0f61a5ad18b | sarvex/leetcode-perl | solution/0500-0599/0507.Perfect Number/Solution.cpp | class Solution {
public:
bool checkPerfectNumber(int num) {
if (num == 1) return false;
int s = 1;
for (int i = 2; i * i <= num; ++i) {
if (num % i == 0) {
s += i;
if (i != num / i) s += num / i;
}
}
return s == num;
... | ALGO | 0.999891 | 6.035422 |
2d7dc325-e378-49c3-a51c-b6835cbf3fb9 | tynnp/CP-Practice | UPCODER/NHAPXUAT7.cpp | #include <iostream>
#include <iomanip>
using namespace std;
int main() {
double x;
cin >> x;
cout << fixed << setprecision(3) << x;
return 0;
} | ALGO | 0.988668 | 4.156403 |
2f727b51-6045-456a-b75d-5f527283bc62 | JRPan/crisp-artifact | accel-sim-framework/gpu-simulator/gpgpu-sim/src/intersim2/gputrafficmanager.cpp | #include <sstream>
#include <fstream>
#include <limits>
#include "gputrafficmanager.hpp"
#include "interconnect_interface.hpp"
#include "globals.hpp"
GPUTrafficManager::GPUTrafficManager( const Configuration &config, const vector<Network *> &net)
:TrafficManager(config, net)
{
// The total simulations equal to num... | TOOL | 0.888771 | 5.119153 |
10081c2e-47b0-428c-9526-5625d6fd4c38 | zohaib904/DSA_lab_1 | singly.cpp | #include<iostream>
using namespace std;
class Node {
public:
int data;
Node* next;
Node(int value) {
data = value;
next = NULL;
}
};
class LinkedList {
public:
Node* head;
LinkedList() {
head = NULL;
}
// Insertion at the end of the linked list
void inser... | ALGO | 0.999484 | 6.146306 |
b5efba43-6adc-4ad9-8303-2247772f9fba | maksymilan/ADS | project_2/heaps.cpp | #include <vector>
#include <cmath>
#include <climits>
using namespace std;
class heaps{
private:
vector<pair<int,int> > h;
public:
int get_size();
vector<pair<int,int>>& get_vec();
const vector<pair<int,int>>& get_vec() const{
return h;
}
heaps(){};//堆都是通过空堆进行push的
virtual pa... | ALGO | 0.999946 | 4.019793 |
0165558e-00b6-451f-bfeb-c5bcf0bf98d4 | Piyush13-ambure/DSA | Painting a Grid With Three Different Colors.cpp | /*You are given two integers m and n. Consider an m x n grid where each cell is initially white. You can paint each cell red, green, or blue. All cells must be painted.
Return the number of ways to color the grid with no two adjacent cells having the same color. Since the answer can be very large, return it modulo 109... | ALGO | 0.999987 | 6.946868 |
abe2abf1-7947-44ec-af07-395f4aa7ed24 | Trinkle23897/Undergraduate | 面向对象程序设计基础/IndividualProject/IndividualProject/Problem5/Gurobi/FlowSolver.cpp | #include <typeinfo>
#include <cstdio>
#include <cstdlib>
#include <iostream>
#include <cassert>
#include <limits>
#include <cmath>
#include "FlowSolver.h"
#include "LPProblem.h"
#include "SteinerRoutingProblem.h"
#include "MultiSteinerRoutingProblem.h"
#include "ControlFlowRoutingProblem.h"
#include "TwoTermRoutingProb... | ALGO | 0.997541 | 5.283295 |
7a71f18d-ea69-430c-8115-70e5ee927d90 | Evbw/NYU-Tandon-Bridge-Summer-2023 | Week 11/hw11_q1.cpp | #include <iostream>
using namespace std;
void printTriangle (int n);
void printOppositeTriangles (int n);
void printRuler (int n);
int main() {
int size = 4;
printTriangle (size);
cout<<endl;
printOppositeTriangles (size);
cout<<endl;
printRuler (size);
}
void printTriangle (int n) {
in... | ALGO | 0.999804 | 3.859206 |
3215ea8d-0027-40b4-9bc3-5e342166a35e | iknowit1511/OOP | so_phuc/so_phuc/so_phuc.cpp | #include <cmath>
#include <cstdio>
#include <vector>
#include <iostream>
#include <algorithm>
#include <iomanip>
using namespace std;
class sophuc {
private:
float fThuc;
float fAo;
public:
sophuc(float fThuc = 1, float fAo = 1) {
this->fThuc = fThuc;
this->fAo = fAo;
}
sophuc(const... | ALGO | 0.999739 | 3.136865 |
23e2312d-078b-4374-8978-032b490a0047 | WayneDW/More-than-Algorithms | c++/367_Valid_Perfect_Square.cpp | #include <iostream>
#include <vector>
#include <map>
#include <set>
#include <unordered_map>
#include <unordered_set>
#include <numeric>
#include <bitset>
#include <queue>
#include <stack>
#include <cmath>
#include <string>
#include <sstream>
#include <algorithm>
#include <climits>
#include "000_basic.cpp"
using names... | ALGO | 0.999592 | 5.101061 |
09f77a3c-48a9-4d49-ab9f-57d49a070329 | qiayuanl/DArm | Arduino/Marlin/vector_3.cpp | #include <math.h>
#include "Marlin.h"
#ifdef ENABLE_AUTO_BED_LEVELING
#include "vector_3.h"
vector_3::vector_3() : x(0), y(0), z(0) { }
vector_3::vector_3(float x_, float y_, float z_) : x(x_), y(y_), z(z_) { }
vector_3 vector_3::cross(vector_3 left, vector_3 right)
{
return vector_3(left.y * right.z - left.z * ri... | TOOL | 0.944267 | 5.613548 |
04f0ad75-6875-4351-b5b1-6aa0cbe73901 | ishandutta2007/codeforces | brovko/normal/406/B.cpp | #include <bits/stdc++.h>
#define int long long
#define ld long double
#define x first
#define y second
#define pb push_back
using namespace std;
int n, a[500005], used[1000005];
int32_t main()
{
ios_base::sync_with_stdio(0);
cin.tie(0);
cout.tie(0);
cin >> n;
for(int i = 0; i < n; i++)
{
... | ALGO | 0.99998 | 3.67502 |
8023bfea-19de-4073-9a55-8b74978c8242 | crazyilian/big-prime-numbers | src/sieve_eratosthenes.cpp | #include "sieve_eratosthenes.h"
namespace BigPrimeLib {
namespace {
size_t distribution_of_primes_lower_bound(size_t x) {
double lb = static_cast<double>(x) / (std::log(x + 3) - 1.1) + 5;
return static_cast<size_t>(lb);
}
}
SieveEratosthenes::SieveEratosthenes(size_t n) : n(n), least_div(n ... | ALGO | 0.999123 | 6.562051 |
6e80424a-d8e3-4281-a776-2b14c365b653 | wszhhx/Algorithm-Practice | 算法练习/PAT乙级-寻找大富翁/寻找大富翁.cpp | #include<iostream>
#include<vector>
#include<algorithm>
using namespace std;
/*
void Sift(int array[], int root, int tail){
int i,j;
bool finish = false;
i = root;
j = i*2;
array[0] = array[root];
while(j <= tail && !finish){
if(j<tail && array[j+1] > array[j])
j++;
if(array[j] <= array[0])
finish = tru... | ALGO | 0.999985 | 3.524933 |
bc5a0b50-a5bd-465e-b7df-3d0e65a1b9b0 | thoeschler/parallel_finite_differences | src/seq/laplace.cpp | #include "grid.hpp"
#include "crs.hpp"
#include "cg.hpp"
#include "finite_diff.hpp"
#include "utils.hpp"
#include <iostream>
#include <vector>
double bc(double x, double y) {
return x + y;
}
int main(int argc, char **argv) {
std::size_t Nx = atoi(argv[1]);
std::size_t Ny = atoi(argv[2]);
// number of... | ALGO | 0.998588 | 4.560211 |
ca3ca260-f0a9-4350-974c-ff9873a967f4 | programmer-mursalin/Competetive-Programming | contest/codeforces_round179/C_Equal_Values.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;
#define int long long
#define gcd __gcd
#define ALL(x) (x).begin(), (x).end()
#define py cout << "YES\n";
#define pm cout << "-1\n";
#define pz cout << "0\n";... | ALGO | 0.999414 | 4.282349 |
cc6fda13-2f98-435b-b75f-a3f8d5bc5f96 | JimmieKJ/unrealCode | UnrealEngineGitHub/Engine/Source/ThirdParty/IntelTBB/IntelTBB-4.4u3/src/tbbproxy/tbbproxy.cpp | #include "tbb/tbb_config.h"
#if !__TBB_WIN8UI_SUPPORT
#define TBB_PREVIEW_RUNTIME_LOADER 1
#include "tbb/runtime_loader.h"
#include "tbb/tbb_stddef.h"
// C standard headers.
#include <cctype> // isspace
#include <cstdarg> // va_list, etc.
#include <cstdio> // fprintf, stderr, etc.
#incl... | TOOL | 0.862578 | 4.53194 |
bc70040a-cb9b-4c5f-ac38-3f3304a291ce | Mrzhugq/algorithm-leetcode | cplusplus/cplusplua-learn/函数模板和普通函数区别和调用规则.cpp | #include<iostream>
#include<string>
using namespace std;
//------------------------------------------------------------------------------
//ͨģ庯 (ʽתתתܾͱ)
//1.ͨÿԷ ʽת
//2.ģ ԶƵԷʽת
//3.ģ ʾָͣԷʽת
//ͨ
int MyAdd(int a, int b)
{
return a+b;
}
//ģ庯
template<typename T>
T MyAdd2(T a, T b)
{
return a + b;
}
//ͨ
void tes... | TOOL | 0.883692 | 3.420203 |
0d40e10f-9d94-460c-8100-17b4caeba236 | gilgmlr/TUBES-Strukdat-Kel3 | RELASI.cpp | #include "RELASI.h"
/* GILANG GUMELAR - 1302194089
VIDI Fadil Akbar - 1302194048
*/
void createList_r(list_relasi &L){
first(L) = NULL;
last(L) = NULL;
};
adr_r alokasi_r(adr_p P, adr_c C){
adr_r R = new elm_relasi;
parent(R) = P;
child(R) = C;
next(R) = NULL;
return R;
};
void insertF... | ALGO | 0.997058 | 3.25775 |
a02297a8-05ff-40e2-9c4f-b27190a90f42 | Project-Manas-SnA/IRC | Autonomous Bot/MazeTest.cpp |
#include<iostream>
#include"wiringPi.h"
#include<stdio.h>
#include<stdlib.h>
#include"softPwm.h"
#include<math.h>
#include<signal.h>
#include<unistd.h>
using namespace std;
/*******PINS Left*****
0 * 1 * * * * 6 * * 0
1 * 1 2 3 4 5 6 7 8 9
2 0 * * * * * 6 7 8 9
3 * 1
*********************/
/*Define*/
#defin... | ALGO | 0.998282 | 4.055381 |
994f22d6-cb92-4062-b477-c5cad7cef20b | suhaas02/Data-structures-and-algorithms | Easy/Remove all duplicates from a given string/remove-all-duplicates-from-a-given-string.cpp | //{ Driver Code Starts
#include <bits/stdc++.h>
using namespace std;
// } Driver Code Ends
//User function template for C++
class Solution{
public:
string removeDuplicates(string str) {
// code here
string ans;
unordered_map<char,int> mp;
for(auto x : str)
{
if(mp.find(x) != mp.end(... | ALGO | 0.999904 | 6.55283 |
cf08c3be-b6c4-4322-b57b-de52318165c4 | SparseLinearAlgebra/cuBool | cubool/sources/sequential/sq_ewisemult.cpp | /**********************************************************************************/
/* */
/* */
/* of this software and associated documentation files (the "S... | ALGO | 0.990848 | 4.287187 |
d288bbbe-ef99-4c2d-aab2-9d5b62a1d94c | PuskarKumarNITT/IPMP | week_3/detect_loop_in_linked_list.cpp | // https://www.geeksforgeeks.org/problems/detect-loop-in-linked-list/1?itm_source=geeksforgeeks&itm_medium=article&itm_campaign=practice_card
//{ Driver Code Starts
#include <bits/stdc++.h>
using namespace std;
struct Node {
int data;
Node* next;
Node(int val) {
data = val;
next = nullptr... | ALGO | 0.999275 | 5.492292 |
3ba6d996-15bb-4a4b-9fa1-eecc6be04898 | diandeng/xiaohei_auto_save | 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 |
bf54aa6b-a3a6-426c-941d-60e30a110b92 | topsframework/tops-lang | src/lang/DependencyTreeParser.cpp | /***********************************************************************/
/* */
/* This program is free software; you can redistribute it and/or */
/* published by the Free Software Foundation; either version 3 of */
/* ... | ALGO | 0.961806 | 6.760525 |
4d3b8dac-0b4f-43c6-9704-65ec2aaeba76 | flower2p68/logic_problems | C++/estrutura_de_dados/vector/reiOBI.cpp | #include <bits/stdc++.h>
using namespace std;
vector<double> estrada;
vector<double> dist;
int main() {
int tam, cid;
double soma =0, resul, aux2, aux;
cin>> tam >> cid;
estrada.push_back(tam);
for(int i=0; i<cid; i++){
cin >> aux;
estrada.push_back(aux);
}
sort(estrada.be... | ALGO | 0.999546 | 3.86807 |
60929c4c-7643-4a3d-98ef-f60ff5b34793 | ChocoMeowMeow/laboratornaya2 | 2лаба3.cpp | #include <iostream>
#include <string>
using namespace std;
int main(){
for (int i=0; i<10; i++){
cout << i << " * 7 =" << i*7 << endl;
}
int x;
cin>>x;
for (int i=0; i<10; i++){
cout << i << " * " << x << " = " << i*x << endl;
}
} | ALGO | 0.995663 | 3.342518 |
734f1023-448d-479a-bc75-0442f6cfd128 | ProtyayMnd50/LeetHUB | 2711-minimum-time-to-visit-a-cell-in-a-grid/2711-minimum-time-to-visit-a-cell-in-a-grid.cpp | using info = pair<int, int>; // (time, i*m+j)
const static int d[5] = {0, 1, 0, -1, 0};
class Solution {
public:
inline static bool isOutside(int i, int j, int n, int m) {
return i < 0 || i >= n || j < 0 || j >= m;
}
inline static int idx(int i, int j, int m) { return i * m + j; }
int minimumTi... | ALGO | 0.999985 | 5.755113 |
78bf6311-e162-4558-bd87-3db7a067cf7c | SeoHyungjun/Coding_Test | baekjun/solved.ac/level/silver/silver2/차이를 최대로/차이를최대로.cpp | #include <iostream>
#include <string>
#include <algorithm>
#include <math.h>
int N, arr[8];
int cal() {
int sum = 0;
for (int i = 1; i < N; ++i) sum += std::abs(arr[i] - arr[i-1]);
return sum;
}
int dfs(int idx) {
int result = -1000;
if (idx >= N ) return cal();
for (int i = idx; i < N; +... | ALGO | 0.999833 | 4.27175 |
aa0d6111-1a0a-4d07-9c5b-0c965f1136a4 | jorbDehmel/tera | src/tritcpu.cpp | #include "tritcpu.hpp"
#ifdef TIMER
map<tryte, pair<double, int>> instrTimes;
#endif
tryte castInstr(instr what)
{
tryte out = tryte((short)what);
return out;
}
TritCpu::TritCpu()
{
*instrPointer = 2 * MEMSIZE / 3;
sectors[0] = mem;
for (int i = 1; i < 27; i++)
{
sectors[i] = nullptr... | ALGO | 0.859976 | 4.098267 |
bd8e9128-bd83-4932-8443-c66ff16c09af | anhtncode/code | THPT/2022-2023/NGhệ An/1970/ODien.cpp | #include<bits/stdc++.h>
#define ll long long
#define f(i,a,b) for(ll i=a;i<=b;++i)
#define e0 exit(0)
using namespace std;
const int N=1e5+1;
ll n,a[N],m;
void solve(){
cin>>n>>m;
f(i,1,n)cin>>a[i];
sort(a+1,a+n+1,greater<int>());
ll s=0,res=0;
f(i,1,n){
if(i>1)--s;
s+=a[i];
... | ALGO | 0.999996 | 4.328734 |
944d4358-db1d-4df2-b28d-2edc45180741 | shivanshugarg12800/30DaysSDESheet | Day1/1_sort0-1-2.cpp | //in this problem we have to sort an array using no extra space which contains the colors 0-1-2
#include <iostream>
#include <bits/stdc++.h>
using namespace std;
void sortColors(vector<int> &nums)
{
int one = 0;
int two = 0;
for (auto x : nums)
if (x == 1)
one++;
else if (x == 2)... | ALGO | 0.999972 | 4.947485 |
a6b5ba40-2d1a-4cae-9dea-241c32cba95b | ishandutta2007/codeforces | popovicirobert/normal/624/B.cpp | #include <cstdio>
#include <algorithm>
int v[26];
using namespace std;
int main()
{
long long s;
int i,n,j,min;
scanf("%d" ,&n);
for(i=0;i<n;i++)
scanf("%d" ,&v[i]);
sort(v,v+n);
i=n-1;
s=0;
min=1000000001;
while(i>=0){
if(v[i]<min){
s+=v[i];
mi... | ALGO | 0.999969 | 3.299021 |
184ba979-9186-448f-89f9-1d48a2ec0b5a | Lee-Duck-03/template_cp | codetumlumtala/train2023_3.cpp | #include<bits/stdc++.h>
#define fo(i, n) for(int i = 0; i < (n); i++)
#define pb push_back
#define ff first
#define ss second
#define vt vector
#define ins insert
#define all(x) x.begin(),x.end()
#define rall(x) x.rbegin(),x.rend()
#define make_unique(x) sort(all((x))); (x).resize(unique(all((x))) - (x).begin())
#defin... | ALGO | 0.999599 | 3.897608 |
f54874a5-9419-4b13-be30-41961875cca3 | actium/codeforces | 1600/80/1687a.cpp | #include <iostream>
#include <vector>
using integer = unsigned long long;
template <typename T>
std::istream& operator >>(std::istream& input, std::vector<T>& v)
{
for (T& a : v)
input >> a;
return input;
}
void answer(integer x)
{
std::cout << x << '\n';
}
void solve(const std::vector<unsigned... | ALGO | 0.999843 | 5.256979 |
f1616f5c-7dea-426e-b3b5-00fd849a7d2e | dhatrishdixit/CPP-files | juneq5.cpp | #include<bits/stdc++.h>
using namespace std;
int main(){
int t,n;
cin>>t;
for (int i=1;i<=t;i++)//while(t--) can also be used
{
cin>>n;
vector<int>v;
if(n%2 !=0){
for(int j=0;j<=n/2;j++){
v.push_back(((n/2)+1)-j);
v.push_back(((n/2)+1... | ALGO | 0.999218 | 4.171449 |
29996267-08f7-4542-b24c-2d0eb2a1b52c | Kasparrow/ShallowRed | src/pieces/Queen.cpp | #include "../include/pieces/Piece.h"
#include "../include/board/Board.h"
#include "../include/utils/Functions.h"
Queen::Queen() : Piece() {}
Queen::Queen(int l, int c, Board *b, char co, double v) : Piece(l, c, b, co, v) {}
char Queen::get_name()
{
if (_color == 'b')
return 'Q';
else
return ... | ALGO | 0.926294 | 4.714231 |
db5c40da-ff98-4f2e-bfb8-dc67cf9fa150 | Raiden49/mdp_solution | src/mdp_value_iteration.cpp | #include "mdp_solution/mdp_value_iteration.hpp"
namespace mdp_solution {
Eigen::MatrixXd MDPValueIteration::value_iteration(Eigen::MatrixXd map) {
std::cout << "Start value iteration" << std::endl;
Eigen::MatrixXd init_map = map;
while (1) {
Eigen::MatrixXd next_map = init_map;
double error... | ALGO | 0.999831 | 5.235838 |
033ca84a-293f-4571-9c57-e0b71bb623a1 | pryogendra/C-CPP-Programming-Code | Reverse_Number.cpp | #include<iostream>
using namespace std;
int main()
{
int num,reverse_num=0,a;
cout<<"Enter a number for reverse : ";
cin>>num;
while(num>0)
{
reverse_num*=10;
a=num%10;
reverse_num+=a;
num/=10;
}
cout<<"Reverse is :"<<reverse_num<<endl;
}
| ALGO | 0.999875 | 3.23418 |
5fe44f42-5f9a-4f3d-8767-5709168451b2 | LowPolyCount/LowPolyCount-Raytracer | lib/boost_1_57_0/libs/heap/examples/interface.cpp | #include <iostream>
#include <iomanip>
#include "../../../boost/heap/fibonacci_heap.hpp"
using std::cout;
using std::endl;
using namespace boost::heap;
//[ basic_interface
// PriorityQueue is expected to be a max-heap of integer values
template <typename PriorityQueue>
void basic_interface(void)
{
PriorityQueue ... | ALGO | 0.974595 | 4.874002 |
74713bac-a8af-4112-a375-948cde05bd62 | veera-durga-jyothi/codemind-cpp | sum_of_the_given_numbers.cpp | #include<bits/stdc++.h>
using namespace std;
int main()
{
int t;
cin>>t;
int r;
while(t!=0)
{
int a,b;
cin>>a;
cin>>b;
r=a+b;
cout<<r<<"
";
t--;
}
} | ALGO | 0.997833 | 4.328173 |
35e9154e-cd2c-4f11-b1ce-875984d60f80 | buptrh/leetcode | Round1/669. Trim a Binary Search Tree.cpp | /**
* Definition for a binary tree node.
* struct TreeNode {
* int val;
* TreeNode *left;
* TreeNode *right;
* TreeNode(int x) : val(x), left(NULL), right(NULL) {}
* };
*/
class Solution {
public:
TreeNode* trimBST(TreeNode* root, int L, int R) {
if(root == NULL) {
return NU... | ALGO | 0.999995 | 6.358134 |
41f5f435-be51-4185-85d0-a0aa9a0286e6 | ShadowTemplate/algorithms-data-structures | MFSet - Set/tester.cpp | #include "mfset_set.h"
int main()
{
Set_pointer<int> set;
set.insert(1);
set.insert(2);
set.insert(3);
set.insert(4);
set.insert(5);
MFSet_set<int> setTest(set);
MFSet_set<int> setTest2;
setTest2.create(set);
setTest.merge(1, 2);
setTest.merge(1, 4);
cout << setTest;
setTest2.merge(2, 4);
setTest2.m... | ALGO | 0.9431 | 4.106086 |
468049c2-474d-4e5d-a894-802172467374 | Mahmoud-nfz/Codeforces-Solutions | _All Solutions/483A.cpp | #include <iostream>
#include <algorithm>
#include <set>
#include <vector>
#include <map>
#include <queue>
#include <math.h>
typedef long long ll ;
#define pairi pair <int,int>
#define pairll pair <long long,long long>
#define vi vector <int>
#define vll vector <long long>
#define mapi map <int,int>
#define mapill m... | ALGO | 0.999902 | 3.301029 |
b288951f-8673-45ce-8a14-8104d6079dc6 | GISjingjie/DataStruct | DataStruct/180716queue.cpp | #include <stdio.h>
#include <stdlib.h>
#define maxsize 5
typedef struct d{
int data[maxsize];
int front;
int rear;
}queue;
queue *build()
{
queue *head=(queue *)malloc(sizeof(queue));
int dat=10;
for(int i=0;i<maxsize;i++,dat++)
{
head->data[i]=dat;
head->front=0;
head->rear=i;
}
return head;
}
void s... | ALGO | 0.993394 | 3.798887 |
1defd30e-35bb-4b3a-b057-1cb209004653 | ishandutta2007/codeforces | gmusya/normal/272/C.cpp | #include <iostream>
#include <vector>
#include <algorithm>
#define ll long long
using namespace std;
int main() {
ll n;
cin >> n;
vector <ll> a(n + 1);
for (ll i = 1; i <= n; i++)
cin >> a[i];
ll q;
cin >> q;
vector <ll> answer(q + 1);
vector <pair <ll, ll>> block(q + 1);
for (ll i = 1; i <= q; i++)
cin... | ALGO | 0.9998 | 3.537729 |
d981621d-b562-4ff2-b72a-361ba14ab5cd | ArnabBir/hackerrank-solutions | SparseArrays.cpp | #include <bits/stdc++.h>
using namespace std;
// Complete the matchingStrings function below.
vector<int> matchingStrings(vector<string> strings, vector<string> queries) {
unordered_map<string, int> um;
vector<int> result(queries.size());
for(int i = 0; i < strings.size(); ++i) {
++um[strings[i]];... | ALGO | 0.998941 | 5.003397 |
91f94cef-2d1f-4722-8eae-a4ffeccbe218 | sudeepnn/Algo | c++/selectionsort.cpp | #include<bits/stdc++.h>
using namespace std;
int main()
{
int n;
cin>>n;
int arr[n];
for(int i=0;i<n;i++){
cin>>arr[i];
}
for(int i=0;i<n-1;i++){
for(int j=i+1;j<n;j++){
if(arr[i]>arr[j]){
swap(arr[i],arr[j]);
}
}
}
for(in... | ALGO | 0.999985 | 3.918531 |
7b893ed2-a26f-4b7b-80fc-f0f5d94d53ef | bodri/kapukiTRX-fw-trx | radio/patterngen.cpp | /**
* @file patterngen.cpp
* @brief Hopping sequence/pattern generator.
*
* @author Varadi, Gyorgy, aka bodri
* Contact: <EMAIL>
*
* @bug No known bugs.
*
* MIT license, all text above must be included in any redistribution
*
*/
#include "patterngen.h"
#include "main.h"
#include <string.h>
PatternGenerato... | ALGO | 0.97131 | 4.812281 |
554745a1-76dc-4077-b950-230c73698f70 | Yahya42k/OOP244-Practice | part-1/calculator.cpp | #include"calculator.h"
int power(int base , int exp)
{
int i, result = 1;
for (int i = 0; i < exp; i++)
{
result *= base;
}
return result;
}
int exponent(int result, int base)
{
int exp = 0;
while (result >= base) {
exp++;
result /= base;
}
return exp;
}
| ALGO | 0.997748 | 3.030253 |
3662a4af-964f-4726-9617-f677f6f8bd52 | pedrocanddz/prog-competitiva | lista4/counting-rooms.cpp | #include <bits/stdc++.h>
#define MAXN 1005
#define endl "\n"
using namespace std;
int n, m;
char matriz[MAXN][MAXN];
bool vis[MAXN][MAXN];
int dx[] = {1, -1, 0, 0};
int dy[] = {0, 0, 1, -1};
void dfs(int x, int y) {
vis[x][y] = true;
for (int i = 0; i < 4; i++) {
int nx = x + dx[i], ny = y + dy[i];
... | ALGO | 0.99953 | 4.415889 |
fd25469d-1f86-43ff-989f-857666ad3c06 | CallmeAbhy/DSA_Blind75 | 0121-best-time-to-buy-and-sell-stock/0121-best-time-to-buy-and-sell-stock.cpp | class Solution {
public:
int maxProfit(vector<int>& prices) {
int maxProfit = 0;
int mini = prices[0];
for(int i = 1; i < prices.size(); i++){
int currProfit = prices[i] - mini;
maxProfit = max(maxProfit, currProfit);
mini = min(mini,prices[i]);
}... | ALGO | 0.9998 | 6.277069 |
04cb8936-3271-4785-b285-dc741f6a7cae | brenimcode/CompetitiveProgramingSolving | Aleatorios/ordenacao_simples.cpp | #include <iostream>
using namespace std;
int main(){
int n,*p,i,copia,j;
cin >> n;
p = new int[n];
for(i=0;i<n;i++){
cin >> p[i];
}
for (j = 0; j < n; j++)
{
for (i = 0; i < n-1; i++)
{
if(p[i] > p[i+1]){
copia = p[i];
p[i] = p[i+1... | ALGO | 0.99994 | 3.653552 |
d7fc6a15-a34a-425f-af78-ecdd63b2b193 | k-kangas/Updated-Inventory-Management | InventoryBinary-W10-CIS1202/Source.cpp | /*
* Kurt Kangas
* CIS 1202 C++ Programming II
* Week 10 Project
* Inventory Management (using Binary)
*/
#define _CRT_SECURE_NO_WARNINGS
#include <iostream>
#include <fstream>
#include <cstring>
#include <iomanip>
#include <string>
using namespace std;
const int NAME_SIZE = 40;
struct Product_S
{
long number;
c... | TOOL | 0.883421 | 4.19116 |
509cecfd-6caf-461d-92be-3c635a9f2e2e | EwhaKing/AltuBitu_Algorithm_Study | Siyeon/[02_28] 투 포인터/구간 합 구하기4.cpp | #include <iostream>
#include <vector>
using namespace std;
int main() {
ios::sync_with_stdio(false); //속도 빠르게
cin.tie(NULL);
int n, m, num;
cin >> n >> m;
vector<int> add(n + 1, 0);
for (int i = 1; i <= n; i++) {
cin >> num;
add[i] = add[i - 1] + num;
}
while (m-... | ALGO | 0.999989 | 5.194074 |
d22f8858-fa7d-403d-a6f8-1f1299fd0b32 | JayKapadia389/daily_leetcode | merge-intervals.cpp | class Solution {
public:
vector<vector<int>> merge(vector<vector<int>>& intervals) {
sort(intervals.begin() , intervals.end()) ;
vector<vector<int>> ans ;
for(int i = 0 ; i < intervals.size() -1 ; i++){
if(intervals[i][1] < intervals[i+1][0]){
ans.push_back(i... | ALGO | 0.999998 | 5.913336 |
f188986a-751d-4dee-97e4-eb8198095a92 | Yoonminsub/BAEKJOON | 구현 알고리즘/B1769.cpp | /*
*
*2022.7.29
*https://www.acmicpc.net/problem/1769
*/
#include <stdio.h>
#include <iostream>
#include <algorithm>
using namespace std;
string A;
void input(int t){
int n=A.size();
int s=0;
int i;
for(i=0;i<n;i++){
s+=A[i]-48;
}
if(n==1){
printf("%d\n",t);
if(s%3==0){
... | ALGO | 0.999854 | 3.594762 |
58559f87-6028-449e-9112-53cafadc04cb | kevin-hyochang/BOJ | 5586.cpp | #include <iostream>
#include <string>
using namespace std;
int main(){
string c;
cin >> c;
int joi=0;
int ioi=0;
for(int i=2;i<c.length();i++){
if(c[i-2]=='J'&&c[i-1]=='O'&&c[i]=='I') joi++;
else if(c[i-2]=='I'&&c[i-1]=='O'&&c[i]=='I') ioi++;
}
cout << joi << '\n' << ioi << ... | ALGO | 0.999305 | 3.470494 |
d979fb70-9b31-4fb5-8e21-887dfe0e6a74 | MatthewFallon/ICPC-2019-azulejos | src/azulejos.cpp | #include <iostream>
#include <vector>
using namespace std;
int main(__attribute__((unused)) int argc,__attribute__((unused)) char const *argv[]) {
long length;
cin >> length;
std::vector< std::vector<int> > rows( 4, std::vector<int>(length) );
for (int i=0; i<4; i++) {
for (int j = 0; j < length; j++) {
... | ALGO | 0.993763 | 3.054961 |
cf06fb26-a3cd-4e78-9083-3011ac8495fd | rbuerki/reference-code-python-programming | algorithms/1_algorithmic_toolbox/z_orig_material/week3_greedy_algorithms/4_maximum_advertisement_revenue/dot_product.cpp | #include <algorithm>
#include <iostream>
#include <vector>
using std::vector;
long long max_dot_product(vector<int> a, vector<int> b) {
// write your code here
long long result = 0;
for (size_t i = 0; i < a.size(); i++) {
result += ((long long) a[i]) * b[i];
}
return result;
}
int main() {
size_t n;
... | ALGO | 0.999938 | 4.638661 |
d22bdec4-a3d5-4674-bad9-e79d99596941 | Oracynx/Source-Code | Contest/AtCoder/ABC334/D.cpp | #include <algorithm>
#include <cstdio>
const int MaxN = 2e5 + 5;
int n, q;
int p[MaxN];
long long sum[MaxN];
int main()
{
scanf("%d%d", &n, &q);
for (int i = 1; i <= n; i++)
{
scanf("%d", &p[i]);
}
std::sort(p + 1, p + 1 + n);
for (int i = 1; i <= n; i++)
{
sum[i] = sum[i - 1... | ALGO | 0.999943 | 4.010988 |
f15f1c6f-62ac-4550-adf1-7558364bdd98 | sheyua/LAMMPS-QTB | src/KSPACE/pair_lj_cut_coul_msm.cpp | /* ----------------------------------------------------------------------
Contributing authors: Stan Moore (SNL), Paul Crozier (SNL)
------------------------------------------------------------------------- */
#include "math.h"
#include "stdio.h"
#include "stdlib.h"
#include "string.h"
#include "pair_lj_cut_coul_ms... | ALGO | 0.999434 | 6.311407 |
ab078687-c774-43ae-b3d5-132099c1dd64 | tanay13/DSA | sde-sheet/graph/isCycle-course-schedule.cpp | class Solution
{
public:
bool dfs(int node, vector<int> &visited, vector<int> &dfsq, vector<int> graph[])
{
visited[node] = 1;
dfsq[node] = 1;
for (auto it : graph[node])
{
if (visited[it] != 1)
{
if (dfs(it, visited, dfsq, graph))
... | ALGO | 0.999842 | 6.160298 |
74f978c4-c69f-4eff-9d31-7342eaa2fddc | 28amit/LeetCode | 485-max-consecutive-ones/485-max-consecutive-ones.cpp | class Solution {
public:
int findMaxConsecutiveOnes(vector<int>& nums) {
int ans=0,tmp=0;
int n=nums.size();
for(int i=0;i<n;i++){
if(nums[i]==1)
tmp++;
else{
ans=max(ans,tmp);
tmp=0;
}
}
... | ALGO | 0.999977 | 5.908148 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.