uuid stringlengths 36 36 | repo_name stringlengths 5 123 | relative_path stringlengths 5 4k | content stringlengths 33 2.85M | category stringclasses 6
values | algo_rel_score float64 0.85 1 | quality_score float64 3 8.76 |
|---|---|---|---|---|---|---|
d00a674f-a67f-46c7-be34-585e4f56cddf | etri/nest-compiler | lib/Runtime/Provisioner/Provisioner.cpp | #include "glow/Runtime/Provisioner/Provisioner.h"
#include "folly/String.h"
#include "glow/Backend/BackendUtils.h"
#include "glow/Backend/CompiledFunction.h"
#include "glow/Flags/Flags.h"
#include "glow/Graph/Graph.h"
#include "glow/Runtime/DeferredWeightLoader.h"
#include "glow/Support/Debug.h"
#include "Backends/Rel... | TOOL | 0.895616 | 3.372065 |
ea1e9e31-623e-4c31-af30-85f04f3535ee | dnsch/Godot-GraphVis | module/graphvis/kahip_source_modified/parallel/parallel_src/app/friendster_list_to_metis_graph.cpp | /******************************************************************************
* friendster_list_to_metis_graph.cpp
* *
* Source of KaHIP -- Karlsruhe High Quality Partitioning.
* Christian Schulz <<EMAIL>>
*****************************************************************************/
#include <stdio.h>
#include... | DATA | 0.954451 | 4.488099 |
4662350f-bae5-441e-98c5-405fc09ea06e | reminisc3/mysql-mingw64-port | mysql-connector-c-6.1.5-src/extra/yassl/taocrypt/src/rabbit.cpp | #include "runtime.hpp"
#include "rabbit.hpp"
namespace TaoCrypt {
#define U32V(x) (word32)(x)
#ifdef BIG_ENDIAN_ORDER
#define LITTLE32(x) ByteReverse((word32)x)
#else
#define LITTLE32(x) (x)
#endif
// local
namespace {
/* Square a 32-bit unsigned integer to obtain the 64-bit result and return */
/* the up... | ALGO | 0.999543 | 6.222711 |
f0a89a4d-4dc9-4831-9934-400e6d5d5cbd | GoatGirl98/Walkthrough-of-ACCoding-in-BUAA | 2020秋-计算机导论(英文)/C1-2020秋-计算机导论(英文)第一次上机/BUAAOJ3760.cpp | #include<stdio.h>
#include<math.h>
double X1, Y1, X2, Y2;
int main() {
scanf("%lf%lf%lf%lf", &X1, &Y1, &X2, &Y2);
printf("%.2lf", sqrt((X2 - X1) * (X2 - X1) + (Y2 - Y1) * (Y2 - Y1)));
}
| ALGO | 0.999168 | 3.39962 |
de23ccc5-4a86-47f6-b983-a466954fa8ce | sompark05/ds_assn3 | .ccls-cache/@home@runner@dsassn3/code@bst.cpp | #include "bst.h"
#include "tree.h"
#include <iostream>
#include <string>
using namespace std;
/////////////////////////////////////////////////////////
////////// TODO: Implement From Here //////////////
Node *BinarySearchTree::search(Node *parent, Node *current, int key) {
if (current == NULL) {
return c... | ALGO | 0.999929 | 4.193923 |
d6c071b8-506e-4960-97dc-34a9415011cf | ammarqaisar11a55/LeetCode-Solutions | 2284. Sender With Largest Word Count.cpp | class Solution
{
public:
string largestWordCount(vector<string> &messages, vector<string> &senders)
{
unordered_map<string, int> Mp;
int Maxi = INT_MIN;
for (int i = 0; i < senders.size(); i++)
{
int NWords = count(messages[i].begin(), messages[i].end(), ' ') + 1;
... | ALGO | 0.999722 | 6.337821 |
29597cc2-8200-49a7-b939-f4aca80af74b | polarr/competitive-programming | DMOJ/wossoly2021s/A.cpp | /**
* Solution by 1egend
* Date:
* Contest: WOSS Dual Olympiad
* Problem:
**/
#include <bits/stdc++.h>
using namespace std;
#define mp make_pair
#define pb push_back
#define ull unsigned long long
#define ll long long
const int MAX_N = 1e5 + 1;
const int MOD = 1e9 + 7;
const string iofilename = "";
ifstream fi... | ALGO | 0.99894 | 3.576834 |
b76aad28-d3b0-4c9c-ae26-904e7e36aa22 | kornelorawczak/Advanced-CPP-Course | list6/main.cpp | #include <iostream>
#include "poly.hpp"
using namespace std;
int main() {
poly p1 = {-1,5,-7,2,4};
poly p2 = {0,5,1,2};
cout << p1 << endl;
cout << p2 << endl;
poly p3 = p1 + p2;
cout << p3 << endl;
double coef[] = {1,2,7};
poly p4 = poly(2, coef);
poly p6 = p4 * 3;
cout << p6 <... | TOOL | 0.946104 | 3.636482 |
943b06db-bcaa-4f1a-be84-3e9652e986de | rdivi297/DSA | 1460-make-two-arrays-equal-by-reversing-subarrays/1460-make-two-arrays-equal-by-reversing-subarrays.cpp | class Solution {
public:
bool canBeEqual(vector<int>& target, vector<int>& arr) {
sort(target.begin(),target.end());
sort(arr.begin(),arr.end());
return target==arr;
}
}; | ALGO | 0.999908 | 5.845694 |
76220601-dccb-4b3c-b2b0-96223563c325 | ishandutta2007/codeforces | adamant/normal/1307/E.cpp | #include <bits/stdc++.h>
using namespace std;
#define int int64_t
#define all(x) begin(x), end(x)
mt19937_64 rng(chrono::steady_clock::now().time_since_epoch().count());
const int inf = 1e9;
const int mod = 1e9 + 7;
void solve() {
int n, m;
cin >> n >> m;
n++;
int s[n];
for(int i = 1; i < n; i++) {
cin >> s[... | ALGO | 0.999983 | 3.678454 |
b797ea99-6145-4c14-abc6-582de6222bc6 | PaukIsUha/optimizing_formating_code | predictions/submissions-aizu-gpt4/Codenet/p00464/563691719/response_4.cpp | #include <iostream>
#include <vector>
int h, w, n;
std::vector<std::vector<int>> mp, dp;
void saiki(int x, int y) {
static const std::vector<int> dx{0, 1}, dy{1, 0};
if (y == h || x == w)
std::cout << y + 1 << " " << x + 1 << '\n';
else
saiki(x + dx[mp[y][x]], y + dy[mp[y][x]]);
}
int main() {
while ... | ALGO | 0.999951 | 4.162838 |
3a385afa-fb3f-46dd-b485-92c1384c8bb5 | 113bommy/deepmind_codecontests_refine | cpp_source_filter_file/cpp_train_9244_2.cpp | #include<bits/stdc++.h>
using namespace std;
int main(){
int64_t n,a,b,c,d,e;
cin >> n >> a >> b >> c >> d >> e;
int64_t x = min([a.b.c.d.e]);
cout << (n+x-1)/x + 4 << endl;
} | ALGO | 0.999568 | 3.104679 |
43466204-615a-4428-9722-53e28b5f7032 | Jae-Yeon/ProblemSolving | BOJ 1297.cpp | //백준 온라인 저지 1297번 TV 크기
#include<stdio.h>
#include<math.h>
int l, a, b;
double c, t1, t2;
int main() {
scanf("%d %d %d", &l, &a, &b);
c = sqrt(a*a + b * b);
t1 = a * l / c;
t2 = b * l / c;
printf("%d %d\n", (int)t1, (int)t2);
}
| ALGO | 0.999751 | 3.070477 |
f35f01ad-46e5-435f-91eb-85ccf980b2e5 | DGtal-team/DGtal | examples/geometry/curves/convex-and-concave-parts.cpp | /**
* @file geometry/curves/convex-and-concave-parts.cpp
* @ingroup Examples
* @author Tristan Roussillon (\c <EMAIL> )
* Laboratoire d'InfoRmatique en Image et Systèmes d'information - LIRIS (CNRS, UMR 5205), CNRS, France
* @date 2011/01/24
*
* An example file named convex-and-concave-parts.
*
* This file is ... | ALGO | 0.996647 | 7.614401 |
d5b35b44-5c88-4ff4-901c-3b0e4f67018e | robeertosv/EEDD | include/Lista/ListaCores.cpp | #include "NodoListaCores.h"
#include "ListaCores.h"
#include "Proceso/Proceso.h"
#include "Core/Core.h"
#include <iostream>
using namespace std;
ListaCores::ListaCores()
{
nodo = new NodoListaCores(Proceso(), NULL);
length = 0;
}
ListaCores::ListaCores(Core c)
{
nodo = new NodoListaCores(c, NULL);
le... | ALGO | 0.859071 | 4.326176 |
a75b696a-1a62-4d44-a1b8-898275acc6b9 | KartikeyBartwal/LeetCode-problem-solutions | 1218-lowest-common-ancestor-of-deepest-leaves/1218-lowest-common-ancestor-of-deepest-leaves.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.999985 | 6.835987 |
6b073411-4a7e-4e7a-81f7-f9ea5762ec36 | prana30/prana30 | CountOcc.cpp | #include <bits/stdc++.h>
using namespace std;
int firstOccurrence(vector<int> &arr, int n, int k){ // Finding first occurence
int low = 0; high = n-1;
int first = -1;
while(low <= high){
int mid = (low + high)/2;
if (arr[mid]= k) {
first = mid;
high = mid-1;
... | ALGO | 0.999835 | 5.446076 |
734bd91a-7a69-40a7-a113-97705b6e3f11 | dudeknight/code | cpp/cntways.cpp | using namespace std;
#define s(x) scanf("%d",&x)
#define sll(x) scanf("%lld",&x)
#define sf(x) scanf("%lf",&x)
#define ss(x) scanf("%s",&x)
#define f(i,a,b) for(int i=a;i<b;i++)
#define fr(i,n) f(i,0,n)
typedef long long ll;
#define size 900001
ll mod = 1000000007;
ll fact[size];
ll fast_exp(ll x, ll p){
ll re... | ALGO | 0.9997 | 3.780884 |
664e094e-692e-416f-a8ff-69581adbc8a6 | supiket/4_data_structures_algorithms | Graph.cpp | #include "Graph.h"
Graph::Graph(int rows, int columns) {
if (rows>0 && columns>0) {
this->rows = rows;
this->columns = columns;
this->size=rows*columns;
adjList = new vector<pair<int, int>>[size+1];
}
}
void Graph::edge(int u,int v,int heightDifference) {
adjList[u].emplace... | ALGO | 0.998597 | 4.668531 |
b5ee7838-2243-40aa-85c6-2737b57512cc | VGasparini/random_code | cf/zerando_cf/85D.cpp | #include <iostream>
#include <cstring>
#include <string>
using namespace std;
long long seed = 47;
long long treap_rand(){
seed = (seed * 279470273) % 4294967291LL;
return seed;
}
typedef int treap_type;
class treap{
public:
treap_type value;
long long priority;
treap *left, *right;
... | ALGO | 0.999451 | 4.10672 |
bee91106-24cd-4ad3-b64e-f5f84ba34c3a | ishandutta2007/codeforces | blackbird137/normal/1350/A.cpp | #include<iostream>
#include<algorithm>
#include<cstring>
#include<cstdlib>
#include<bitset>
#include<string>
#include<cstdio>
#include<vector>
#include<cmath>
#include<queue>
#include<map>
#define LL long long
using namespace std;
LL read()
{
LL ans=0,f=1;
char c=getchar();
while(c>'9'||c<'0'){if(c=='-')f=-1;c=get... | ALGO | 0.999886 | 3.421433 |
e0296a78-a6c2-4f4e-b14c-f8c4a59f8fdb | Muncamoo2000/Sortdescending--order | SortDecending order.cpp | #include <iostream>
#include <algorithm>
using namespace std;
int main()
{
//Get the Array
int arr[] = {1, 45, 63, 25, 7, 88, 54};
//Compute the Size
int n = sizeof(arr) / sizeof(arr[0]);
//Print the array
cout << "Array: ";
for (int i = 0; i < n; i++)
cout << arr[i] << "";
/... | ALGO | 0.998233 | 3.966802 |
d415e4ab-c8a5-4495-a3c2-f31a1882e1e3 | arm/arm-toolchain | llvm/lib/TextAPI/BinaryReader/DylibReader.cpp | #include "llvm/TextAPI/DylibReader.h"
#include "llvm/ADT/STLExtras.h"
#include "llvm/DebugInfo/DWARF/DWARFCompileUnit.h"
#include "llvm/DebugInfo/DWARF/DWARFContext.h"
#include "llvm/Object/Binary.h"
#include "llvm/Object/MachOUniversal.h"
#include "llvm/Support/Endian.h"
#include "llvm/TargetParser/Triple.h"
#include ... | TOOL | 0.864827 | 4.41077 |
128b6e00-19d7-490e-bf4f-6d0637e0423c | Peter-Jansen/code_snippets | blink/particle_blinkscript_render/particle_blinkscript_render_v006.cpp | kernel ParticleRenderKernel : ImageComputationKernel<ePixelWise>
{
Image<eRead, eAccessPoint> p_position;
Image<eRead, eAccessPoint> p_color;
Image<eRead, eAccessPoint> p_size;
Image<eRead, eAccessPoint> p_velocity;
Image<eWrite, eAccessRandom> output;
param:
float4x4 _worldToScreen;
float _size;
... | ALGO | 0.98211 | 4.685834 |
1c2e9a28-89ac-4e63-b6e4-6c03b8f98293 | dragonwell-project/dragonwell21 | src/hotspot/share/utilities/singleWriterSynchronizer.cpp | #include "precompiled.hpp"
#include "runtime/atomic.hpp"
#include "runtime/orderAccess.hpp"
#include "runtime/os.hpp"
#include "utilities/debug.hpp"
#include "utilities/singleWriterSynchronizer.hpp"
#include "utilities/macros.hpp"
SingleWriterSynchronizer::SingleWriterSynchronizer() :
_enter(0),
_exit(),
// The ... | TOOL | 0.946253 | 6.64616 |
f92741be-46f4-4c3d-a5f8-f11e4bc572d6 | didwl0stn/codetree-TILs | 250622/등장횟수 확인/check-number-of-appearances.cpp | #include <iostream>
using namespace std;
int main() {
// Please write your code here.
int cnt=0;
for (int i=0; i<5; i++) {
int temp;
cin >> temp;
if (temp%2==0)
cnt += 1;
}
cout << cnt;
return 0;
} | ALGO | 0.999916 | 3.949853 |
a82606ef-2dd9-4bd7-9908-80bbc970937c | shlmita/ALPRO-4208 | Tugas 6/Selection Sort/main.cpp | #include <iostream>
#include <vector>
using namespace std;
void selectionSort(vector<int>& arr) {
int n = arr.size();
for (int i = 0; i < n - 1; i++) {
int minIndex = i;
for (int j = i + 1; j < n; j++) {
if (arr[j] < arr[minIndex])
minIndex = j;
}
sw... | ALGO | 0.999909 | 5.911954 |
efc66929-39ac-411b-8b05-55dee43cf5fb | raincross7/code-similarity | codes/train_code/problem476/problem476_86.cpp | #include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i=0; i < (int)(n); i++)
using ull = unsigned long long;
using ll = long long;
ll gcd(ll a, ll b) {
if (a%b==0) return b;
else return gcd(b, a%b);
}
ll lcm(ll a, ll b) {
return a * b / gcd(a, b);
}
int main() {
ll N, M;
cin >>... | ALGO | 0.999993 | 4.020861 |
de035458-c51e-4dc8-9948-5951e2c69ea2 | 2605govind/Data_Structure_And_Algorithms- | Day15/1_Longest_subarray_with_sum_divisible_by_K.cpp | //{ Driver Code Starts
#include <bits/stdc++.h>
using namespace std;
// } Driver Code Ends
//User function template for C++
class Solution{
public:
int longSubarrWthSumDivByK(int arr[], int n, int k)
{
unordered_map<int,int> mp;
int ans = 0;
int sum = 0;
mp[0] = -1;
for(int i = 0; i < n; i... | ALGO | 0.999822 | 5.405956 |
f90a68e4-6158-44e4-9c32-65439010707d | hindercanrun/wadify | src/utils.cpp | // utility file
#include "utils.hpp"
namespace utils {
std::string add_wad_ext(const std::string& file) {
using namespace std::string_view_literals;
const auto sv = std::string_view(file);
if (sv.size() >= 4 &&
std::equal(sv.end() - 4, sv.end(), ".wad"sv.begin(),
[](char a, char b) { return std:... | TOOL | 0.961882 | 7.815581 |
52b1364c-9708-4022-94c5-6bcb2ae03201 | vbonnici/grafe-sim | analysis/data/p04001/s386852122.cpp | #include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int) (n); i++)
#define rep2(i, s, n) for (int i = (s); i < (int) (n); i++)
#define _GLIBCXX_DEBUG
int64_t ans=0;
string s;
void brute(int64_t sum, int64_t num, int k=0){
if(k == s.length()){
ans += num+sum;
return... | ALGO | 0.99884 | 4.104096 |
8c7ff422-03d2-44b3-9a5e-f20478279458 | mdbal-lunule/lunule | src/boost/libs/math/src/tr1/cyl_bessel_j.cpp | extern "C" double BOOST_MATH_TR1_DECL boost_cyl_bessel_j BOOST_PREVENT_MACRO_SUBSTITUTION(double nu, double x) BOOST_MATH_C99_THROW_SPEC
{
return c_policies::cyl_bessel_j BOOST_PREVENT_MACRO_SUBSTITUTION(nu, x);
}
| TOOL | 0.944453 | 3.483929 |
ee5b53be-1715-46be-87a9-db28a008a531 | xiangze/RRedsvd | src/eigen3/doc/examples/Tutorial_ArrayClass_mult.cpp | #include <Eigen/Dense>
#include <iostream>
using namespace Eigen;
using namespace std;
int main()
{
ArrayXXf a(2,2);
ArrayXXf b(2,2);
a << 1,2,
3,4;
b << 5,6,
7,8;
cout << "a * b = " << endl << a * b << endl;
}
| ALGO | 0.991767 | 3.527115 |
b792d871-e77c-46a6-a184-133e06f24b24 | shubhamNarendra2023/LeetCodePractice | 0496-next-greater-element-i/0496-next-greater-element-i.cpp | class Solution {
public:
vector<int> nextGreaterElement(vector<int>& nums1, vector<int>& nums2) {
unordered_map<int, int> map;
stack<int> st;
for(int num : nums2){
while(!st.empty() && st.top()<num){
map[st.top()] = num;
st.pop();
}
... | ALGO | 0.999701 | 5.830813 |
7e742d65-7588-4f82-8bbc-990db4656997 | hsyl007/- | 三角判断.cpp | #include<stdio.h>
int main()
{
int a,b,c,x,y;
scanf("%d%d%d",&a,&b,&c);
x=a+b;
if(a>b)
y=a-b;
else
y=b-a;
if(x>c&&y<c)
printf("YES\n");
else
printf("NO\n");
return 0;
}
| ALGO | 0.999992 | 3.236976 |
14eecbaa-0afb-4a0c-8b49-196d61f67d76 | 23f2002007/leetcode | solution/1300-1399/1389.Create Target Array in the Given Order/Solution.cpp | class Solution {
public:
vector<int> createTargetArray(vector<int>& nums, vector<int>& index) {
vector<int> target;
for (int i = 0; i < nums.size(); ++i) {
target.insert(target.begin() + index[i], nums[i]);
}
return target;
}
}; | ALGO | 0.999976 | 6.567545 |
6746c3e5-e063-436f-bdbe-375cf9064511 | SuzukiTccy/Algorithm | SortAlgorithm/selectSort.cpp | #include<iostream>
#include<vector>
using namespace std;
void selectSort(vector<int>& nums){
int maxv;
int max_idx = 0;
for(int i = 0; i < nums.size(); ++i){
maxv = nums[0];
max_idx = 0;
for(int j = 1; j < nums.size() - i; ++j){
if(maxv < nums[j]){
max_idx = j;
maxv = nums[j];
}
}
nums[max_i... | ALGO | 0.999891 | 4.623182 |
dff332b0-2486-496d-a007-f816214fec81 | mooiman/delta-formulation | src/c++/0d/0d_two_way_chemical_reaction/packages/src/main.cpp | #include <iostream>
#include <fstream>
#include <cmath>
#include <vector>
#include <iomanip>
#include <string>
#include <algorithm>
#include <filesystem>
//
//
// Two way chemical reaction:
// Hundsdorfer and Verwer 2003, pg 26 and pg 35
//
// du_1/dt = -k1 u_1 + k2 u_2
// du_2/dt = k1 u_1 - k2 u_2
//
#include... | ALGO | 0.992329 | 4.749349 |
2a196ed5-a1a3-4077-b855-607f537f9ecb | VitinDenoyr/CompetitiveProgramming | cses/02-sorting/02-apartments.cpp | #include <bits/stdc++.h>
using namespace std;
#define ll long long
int main(){
ios_base::sync_with_stdio(false);
cin.tie(nullptr); cout.tie(nullptr);
int n,m,maxdif,el;
cin >> n >> m >> maxdif;
vector<int> v, ap;
for(int i = 0; i < n; i++){
cin >> el;
v.push_back(el);
}
for(int i = 0; i < m; i++){
cin ... | ALGO | 0.999981 | 4.335416 |
097694a6-bf38-4573-b2e3-fe064e1c2657 | Shell-Wataru/AtCoder | kakomon/code_festival_morning_easy_d.cpp | #include <iostream>
#include <cstdio>
#include <algorithm>
#include <vector>
#include <deque>
#include <queue>
#include <set>
#include <map>
#include <iomanip>
#include <numeric>
using namespace std;
using ll = long long;
const long long BASE_NUM = 1000000007;
int main()
{
ll n,m;
cin >> n >> m;
vector<pai... | ALGO | 0.999857 | 3.920576 |
d50918b7-c912-4bef-b439-399af8f42ea1 | miki9171/Atcoder | ITP1/Range.cpp | #include <bits/stdc++.h>
using namespace std;
int main() { int a, b, c;
cin >> a >> b >> c;
if(a < b && b < c){
cout << "Yes" << endl;
}else{
cout << "No" << endl;
}
} | ALGO | 0.999984 | 3.908104 |
f495b11a-9271-4f23-86d3-0000fa19b090 | jamesdemon923/Precompute_Radiance_Transfer | prt/ext/eigen/doc/examples/TutorialLinAlgExSolveLDLT.cpp | #include <iostream>
#include <Eigen/Dense>
using namespace std;
using namespace Eigen;
int main()
{
Matrix2f A, b;
A << 2, -1, -1, 3;
b << 1, 2, 3, 1;
cout << "Here is the matrix A:\n" << A << endl;
cout << "Here is the right hand side b:\n" << b << endl;
Matrix2f x = A.ldlt().solve(b);
cout << "... | ALGO | 0.999909 | 3.804243 |
e1079f74-c236-4e3f-9cf9-6421ab6082fa | RawSalmon69/Computer-Programming-C-y1t1 | 02_If_14.cpp | #include <bits/stdc++.h>
using namespace std;
int gradevalue(char x){
return x-64;
}
int main(){
int id1,id2;
float gpx1,gpx2;
char cprog1, cprog2, cal11, cal12, cal21,cal22;
cin >> id1 >> gpx1 >> cprog1 >> cal11 >> cal21;
cin >> id2 >> gpx2 >> cprog2 >> cal12 >> cal22;
int c11, c12, c21, c2... | ALGO | 0.999886 | 3.866581 |
a3087c5a-853c-4449-87de-acbf40451e2a | SaikatKar-12/CppCompetitive- | Pattern1/tiltedsquare.cpp | #include<iostream>
using namespace std;
int main(){
int n;
cout<<"Enter number:";
cin>>n;
for(int i=1;i<=n;i++){
for(int j=1;j<=n-i;j++){
cout<<" ";
}
for(int k=1;k<=n;k++){
cout<<"*";
}
cout<<endl;
}
return 0;
} | ALGO | 0.999801 | 3.699309 |
c9531f63-2798-4f8b-aee0-ff14aaaf2c8c | sarvex/leetcode-assembly | solution/0400-0499/0473.Matchsticks to Square/Solution.cpp | class Solution {
public:
bool makesquare(vector<int>& matchsticks) {
int s = 0, mx = 0;
for (int& v : matchsticks) {
s += v;
mx = max(mx, v);
}
int x = s / 4, mod = s % 4;
if (mod != 0 || x < mx) return false;
sort(matchsticks.begin(), matchsti... | ALGO | 0.999931 | 5.693539 |
7d6e4d48-aac8-40a0-8f4b-4fe6445efdd2 | rootoverswapno/Competetive-Practice | 1984_B.cpp | #include<bits/stdc++.h>
using namespace std;
int main()
{
int t;
cin>>t;
while(t--)
{
int n;
cin>>n;
cout<<((n==3)?3:2)<<endl;
}
return 0;
} | ALGO | 0.999355 | 3.757457 |
b6a17485-9b10-4ea6-a7fa-b6edef4971ab | mariiaTiul/Game | NetLab/cugl/source/scene3/CUObjParser.cpp | using namespace cugl;
using namespace cugl::scene3;
using namespace cugl::graphics;
using namespace std;
/**
* Returns true if c is skippable whitespace
*
* While OBJ files are not really UTF8 compliant, this function is the safest
* way to
*/
static bool isSkippable(char c) {
return c == ' ' || c == '\t' || ... | TOOL | 0.857175 | 7.193771 |
50caf096-e1de-4201-aa7e-f96ea577b987 | 2019Shun/atcoder_submission | AGC/agc019/agc019_a_9560449.cpp | #include <bits/stdc++.h>
#define PI 3.14159265358979323846
#define MAXINF (1e18L)
#define INF (1e9L)
#define EPS (1e-9)
#define MOD ((ll)(1e9+7))
#define REP(i, n) for(int i=0;i<int(n);++i)
#define Rep(i,sta,n) for(int i=sta;i<n;i++)
#define RREP(i, n) for(int i=int(n)-1;i>=0;--i)
#define ALL(v) v.begin(),v.end()
#defi... | ALGO | 0.998827 | 3.144695 |
e37ad1e5-f0e9-4bde-bad6-64fa710db75e | shazilkp/leetcode-solutions | 0496_HASHMAP_MONOTONICSTACK.cpp | class Solution {
public:
vector<int> nextGreaterElement(vector<int>& nums1, vector<int>& nums2) {
int n1 = nums1.size();
int n2 = nums2.size();
vector<int>res1;
unordered_map<int,int> mp;
stack<int> st;
for(int i = n2 -1 ; i >= 0 ; --i){
while(!st.empty() ... | ALGO | 0.999953 | 5.730959 |
6d9d0c66-8951-4307-b003-e805ddd4fb67 | Hannan181/Cpp | Queue/25_3_rain_WaerHarvesting.cpp | #include<iostream>
#include<vector>
#include<stack>
#include<algorithm>
using namespace std;
int rain_water(vector<int>a){
stack<int>st;
int n=a.size(),ans=0;
for(int i=0;i<n;i++){
while(!st.empty() && a[st.top()]<a[i]){
int cur=st.top();
st.pop();
if(st... | ALGO | 0.999798 | 4.922832 |
4bb6a062-ff18-46bc-8d51-2884f1699de0 | nachodm/AdvancedAlgorithm | Grafos_Estructuras_Particion/RondaDeNoche/RondaNoche.cpp | // Manuel Monforte
// TAIS62
#include <iostream>
#include <iomanip>
#include <fstream>
#include <algorithm>
#include "Matriz.h"
#include <queue>
/*
****ANOTACION DEL PROBLEMA*****
He tenido que escrbir la solcuion dentro de la clase al acabar BFS, ya que lo que tengo comentado es lo que haca antes pero al preguntar p... | ALGO | 0.99863 | 4.428081 |
da1f047f-21d9-4e81-8ee7-bf4694f02eb8 | LuisAlbOR/Udemy | Python/proyectos/opencv-4.x/modules/imgproc/src/color_lab.cpp | #include "precomp.hpp"
#include "opencl_kernels_imgproc.hpp"
#include "opencv2/core/hal/intrin.hpp"
#include "opencv2/core/softfloat.hpp"
#include "color.hpp"
using cv::softfloat;
static const float * splineBuild(const softfloat* f, size_t n)
{
float* tab = cv::allocSingleton<float>(n * 4);
const softfloat f... | ALGO | 0.988553 | 3.147151 |
80b6d2a3-e7c3-4492-a989-49461f362586 | bryancalisto/competitive_prog | codeo/Orderna_arreglo_peque/main.cpp | #include <bits/stdc++.h>
using namespace std;
int main()
{
int N, i, j, k;
fscanf(stdin, " %d", &N);
vector<int> arr;
// Leemos input y de paso vamos ordenando
int n;
fscanf(stdin, " %d", &n);
arr.push_back(n);
for (i = 1; i < N; i++)
{
int num;
fscanf(stdin, " %d", &num);
arr.push_ba... | ALGO | 0.999941 | 4.093474 |
f9b946d8-a236-4071-b976-993a8e61a4d6 | GouravShDev/Leetcode-Solutions | Largest subtree sum in a tree - GFG/largest-subtree-sum-in-a-tree.cpp | //{ Driver Code Starts
#include <bits/stdc++.h>
using namespace std;
/* A binary tree node has data, pointer to left child
and a pointer to right child */
struct Node {
int data;
struct Node* left;
struct Node* right;
};
Node* newNode(int val) {
Node* temp = new Node;
temp->data = val;
temp-... | ALGO | 0.999779 | 7.205113 |
681bd115-b830-40f0-b5d4-20440a4934c6 | ishandutta2007/codeforces | meyi/normal/1334/B.cpp | #include<bits/stdc++.h>
using namespace std;
#define ri register int
typedef long long ll;
const int maxn=1e5+10;
int a[maxn],n,x,t;
int main(){
scanf("%d",&t);
while(t--){
scanf("%d%d",&n,&x);
for(ri i=1;i<=n;++i)scanf("%d",a+i);
sort(a+1,a+n+1);
ll sum=0;
bool flag=true;
for(ri i=n;i;--i){
sum+=a[i];... | ALGO | 0.999898 | 3.551896 |
e6ebcb0b-476d-4906-8ddf-9b8dc06c6735 | ishandutta2007/codeforces | icecuber/normal/813/A.cpp | #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int main() {
ios::sync_with_stdio(0); cin.tie(0);
int n;
cin >> n;
int sum = 0;
for (int i = 0; i < n; i++) {
int a;
cin >> a;
sum += a;
}
int m;
cin >> m;
int ans = 1e9;
for (int i = 0; i < m; i++) {
int l, r;
... | ALGO | 0.999942 | 3.937929 |
0fb345d9-b69b-4326-8b69-635501783fc3 | jay-j78/s4 | 8.bstdsa1.cpp | #include<iostream>
using namespace std;
struct Node{
int data;
Node*left;
Node*right;
Node(int val){
data=val;
left=right=nullptr;
}
};
Node*insert(Node*root,int val){
if(root==nullptr)
return new Node(val);
if(val>root->data){
root->right=insert(root->right,val);... | ALGO | 0.999872 | 4.66464 |
7e05e00f-8b5e-4308-b5c1-69185cfcba45 | Najma099/CompetitiveProgramming | geeksforgeeks/FindMedian.cpp | class Solution
{
public:
//Function to insert heap.
priority_queue <int > small, high;
//small-->maxheap
//high--> minHeap
void insertHeap(int &x)
{
if(small.size() == 0 || small.top() >= x) {
small.push(x);
}
else {
high.push(-x);
}
... | ALGO | 0.999986 | 5.177763 |
775bcc59-6540-4b7a-b4f5-8c9e15276dd0 | NobleWolf42/CSC-Homework | Computer Science I CSC 108-01/Chapter 5/5.44 Authoring assistant/original.cpp | /*
(1) Prompt the user to enter a string of their choosing. Store the text in a string. Output the string. (1 pt)
Ex:
*Enter a sample text:
*We'll continue our quest in space. There will be more shuttle flights and more shuttle crews and, yes, more volunteers, more civilians, more teachers in space. Noth... | TOOL | 0.988474 | 5.20196 |
a086799e-fe9c-45fa-a388-19f6c59e7e62 | harsh77Topsdata/harsh77Topsdata | Conditional Statments/20.Condition.cpp | #include<stdio.h>
main()
{
int N,month;
printf("Enter the month :"); //month input by days
scanf("%d",&month);
if(N==1||N==3||N==5||N==7||N==8||N==10||N==12)//check for 31 days
{
printf("31 Days");
}
else if (N==4||N==6||N==9||N==11) // Check for 30 Days
{
printf("30 Days");
}
else if (N==2) // Check ... | ALGO | 0.995381 | 3.352592 |
6b07951d-8970-4724-9603-31e33fc745d0 | hjiang13/LLMs-in-IR | processed_data/Decompiled_Humaneval_x_cpp_164_Result_O3/Gemma27b_humaneval_x_cpp_164/test/CPP_40.cpp | #include <vector>
bool triples_sum_to_zero(const std::vector<int>& vec) {
if (vec.size() < 3) {
return false;
}
for (size_t i = 2; i < vec.size(); ++i) {
for (size_t j = i - 1; j > 0; --j) {
for (size_t k = j - 1; k < vec.size(); ++k) {
if (vec[i] + vec[j] + vec[k] == 0) {
return... | TEST | 0.96551 | 5.742248 |
da821096-2495-4308-9d0f-0f9921925c33 | lts96/Algorithm | BOJ/C++/2470.cpp | #include <iostream>
#include <queue>
#include <utility>
#include <vector>
#include <algorithm>
using namespace std;
int n, ans1, ans2;
int main(void)
{
ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
cin >> n;
vector <int> arr;
int temp, start = 0, end = n - 1, x;
for (int i = 0; i < n; i++)
{
... | ALGO | 0.999996 | 4.030406 |
88c4b27b-4801-484e-9d14-231660b77f34 | ishandutta2007/codeforces | krk/normal/1045/I.cpp | #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int Maxn = 1000005;
int n;
map <int, int> M;
char tmp[Maxn];
int tlen;
ll res;
int Collect(int mask)
{
map <int, int>::iterator it = M.find(mask);
return it == M.end()? 0: it->second;
}
void Add(int mask)
{
map <int, int>::iterat... | ALGO | 0.999925 | 4.061891 |
cce27049-a9ab-4ac8-bafb-4f4b5ced710f | GDSCltce/DSA | Tries/CodeBreaker.cpp | #include <bits/stdc++.h>
using namespace std;
struct Node
{
int cnt;
Node *child[26] = {NULL};
Node() { cnt = 0; }
};
Node *root = nullptr;
void insert(string &a)
{
Node *curr = root;
for (int i = 0; i < a.length(); i++)
{
int val = (a[i] - 'a');
if (curr->child[val] == NULL)
... | ALGO | 0.999975 | 4.86432 |
989219c5-b227-4923-8c5d-f227396bb391 | 2ndPrince/Algorithm_Cpp | Tree/235_[LCA]BST.cpp | // 235. Lowest Common Ancestor of a Binary Search Tree
// https://leetcode.com/problems/lowest-common-ancestor-of-a-binary-search-tree/
/**
* Definition for a binary tree node.
* struct TreeNode {
* int val;
* TreeNode *left;
* TreeNode *right;
* TreeNode(int x) : val(x), left(NULL), right(NULL) ... | ALGO | 0.999987 | 6.5667 |
41f12d9f-1aa9-4bbe-b7ac-f43a00f90f19 | gilbert12tw/CP-Code-Archive | CF/1788C.cpp | #include<bits/stdc++.h>
#define loli
using namespace std;
typedef long long ll;
#define int ll
#define pii pair<int, int>
#define X first
#define Y second
#define F first
#define S second
#define SZ(a) ((int)a.size())
#define ALL(v) v.begin(), v.end()
#define pb push_back
#define eb emplace_back
#define push emplace
#d... | ALGO | 0.999975 | 4.427762 |
e74b78df-4a24-4c53-a0b8-ac957cd3aaba | SamueleFacenda/Python-Scripts | prog/stringhe.cpp | #include <iostream>
#include <cstdlib>
#include <fstream>
using namespace std;
int getScore(char*);
bool isAlpha(char*);
bool isAlpha(char);
void swapCase(char*);
int sumAdiacent(char*);
int abss(int);
int calc(char*, char*, char);
void printFileContent(char*);
void checkArgs(int, int);
void copyFile(char*, ... | TOOL | 0.962907 | 4.230692 |
dca15e58-8a0d-4c7d-8782-4252f6ddcaf7 | chengyiwei/algorithm | nowcoder/2024multi-school-camp-5/B/B.cpp | #include <bits/stdc++.h>
using namespace std;
void solve() {
int n, m, a, b; cin >> n >> m >> a >> b; a ^= 1, b ^= 1;
if ((n == 1 && m == 2) || (n == 2 && m == 1)) {
cout << "Yes" << '\n';
return;
}
if ((a == 0 && b == 0) || (a == 1 && b == 0)) {
if ((a == 1 && b == 0) && (n == ... | ALGO | 0.9998 | 4.112539 |
68009bc3-bda8-4192-b22d-d63dde2db381 | Deeksha2501/Leetcode-Submissions | 1.cpp | class Solution {
public:
vector<int> twoSum(vector<int>& nums, int target) {
unordered_map<int , int> mp;
vector<int> res;
for(int i=0 ; i<nums.size() ; i++){
int cmp = target-nums[i];
if(mp.find(cmp) != mp.end()){
vector<int> v;
v.push... | ALGO | 0.9999 | 6.15493 |
69e86df7-2648-474c-ac04-8649abd2dee9 | brubsby/cado-nfs-fork | linalg/bblas/bblas_perm_matrix.cpp | #include "cado.h" // IWYU pragma: keep
#include <cstring>
#include <cstdlib> // for free, malloc
#include "macros.h" // for ASSERT_ALWAYS
#include "bblas_mat64.hpp" // for mat64
#include "bblas_perm_matrix.hpp"
#include "misc.h" // cado_ctz64
/* perm_matrix stuff */
void... | ALGO | 0.997972 | 3.185724 |
3ecec778-ad74-4986-9f76-68d74559d449 | msageha/AtCoder-Regular-Contest | ARC003/d.cpp | #include <vector>
#include <list>
#include <map>
#include <set>
#include <stack>
#include <algorithm>
#include <iostream>
#include <iomanip>
#include <cmath>
#include <string>
using namespace std;
//using
using VI = vector<int>;
using VVI = vector<VI>;
using VS = vector<string>;
using PII = pair<int, int>;
using LL =... | ALGO | 0.999968 | 4.79719 |
f5e87d86-4ff2-4ff5-a588-5004f9222492 | Sanghyunn/2021-Summer | Day4/Microwave_10162.cpp | #include <iostream>
using namespace std;
int main()
{
int time[3] = {300, 60, 10}; // A B C 각 버튼별로 지정된 시간
int cnt[3] = {0}; // A B C 각 버튼별로 눌러야 되는 횟수
int t; cin >> t;
int i = 0;
while(t && i < 3)
{
cnt[i] = (t/time[i]);
t %= time[i];
i++;
}
if(t) cout << "-1";
else
{
i = 0;
while(3 - i) cou... | ALGO | 0.999532 | 3.250733 |
7b637d22-492d-4ca5-8558-a3c687819c84 | takahironakamori/cp-libraries | graph/binary_search_tree.cpp | #include <bits/stdc++.h>
#include <atcoder/all>
using namespace std;
using namespace atcoder;
using ll = long long;
using P = pair<int, int>;
#define rep(i, n) for(int i = 0; i < (n); ++i)
// using mint = modint998244353;
// using mint = modint1000000007;
// const int mod = 1000000007;
// const ll INF = 1LL << 62;
// c... | ALGO | 0.999929 | 5.041383 |
5a17636a-dab7-4897-8b66-518c9294a3c4 | Sanjana-Nagelli/leetcode | 557. Reverse Words in a String III.cpp | class Solution {
public:
string reverseWords(string s) {
int i=0,j=0;
int k;
for(i=0;i<s.size();i++)
{
if(s[i]==' ')
{
k = i - 1;
reverse(s.begin()+j,s.begin()+k+1);
j = i + 1;
}
}
... | ALGO | 0.999962 | 6.018675 |
4c9cb35c-b11f-4f31-a12b-7b087714ca86 | raincross7/code-similarity | codes/train_code/problem478/problem478_369.cpp | #include <iostream>
#include <bitset>
#include <vector>
using namespace std;
int main() {
int N;
cin >> N;
int a = N / 7;
int b = (N / 4);
if (N % 7 == 0 || N % 4 == 0 ){
cout << "Yes" << endl;
return 0;
}
// for (int i = 0; i <= b + 1; i++){
// int aa = 4 * i;
... | ALGO | 0.999965 | 3.414841 |
53246327-9f6a-4ace-9af0-62d3d54bb79e | yabinzhangJohn/IRQA_Measure | ARS_code/MEX/mexDenseSIFT/Matrix.cpp | #include "Matrix.h"
#include "memory.h"
#include <iostream>
using namespace std;
bool Matrix::IsDispInfo=false;
Matrix::Matrix(void)
{
nRow=nCol=0;
pData=NULL;
}
Matrix::Matrix(int nrow,int ncol,double* data)
{
nRow=nrow;
nCol=ncol;
pData=new double[nRow*nCol];
if(data==NULL)
memset(pData,0,sizeof(double)*n... | ALGO | 0.995786 | 4.908782 |
0af9f4ec-a37c-4af3-826c-5eefb44661e9 | matejpekar/arthseg | arthseg/src/legs/split.cpp | #include "legs.hpp"
#include "shortest_path.hpp"
#include "utils.hpp"
struct FloodComponent
{
std::vector<Point> points;
size_t max_distance;
size_t min_distance;
FloodComponent(const Point &point, size_t distance) : points({ point }), max_distance(distance), min_distance(distance) {}
size_t length... | DATA | 0.996488 | 4.655728 |
13210e51-b219-4c62-8109-981f081a342e | gainsborouo/NYCU_Intro-to-Algorithms | week05/W5B-Fast_Exponentiation.cpp | //
// main.cpp
// C++
//
// Created by userwei
//
#ifdef LOCAL
#include "/Users/chou.ting.wei/Coding/stdc++.h"
#else
#include <bits/stdc++.h>
#include <bits/extc++.h>
#pragma GCC optimize("O3,unroll-loops")
using namespace __gnu_pbds;
#endif
using namespace std;
#define int long long
#define... | ALGO | 0.99902 | 4.71338 |
b3c49a24-c7a6-4d94-8892-6bf54867fcdd | ZhangGroup-MITChemistry/Explicit_Ion_Chromatin | Code/example_lammps_src/USER-OMP/pair_lj_charmm_coul_msm_omp.cpp | /* ----------------------------------------------------------------------
Contributing author: Axel Kohlmeyer (Temple U)
------------------------------------------------------------------------- */
#include <math.h>
#include "pair_lj_charmm_coul_msm_omp.h"
#include "atom.h"
#include "comm.h"
#include "force.h"
#inc... | ALGO | 0.99976 | 7.097797 |
0533b18b-b742-4602-a330-8bfc39b37c53 | tae796/algorithm | algorithm/swexpert/d2/1859.cpp | #include <bits/stdc++.h>
using namespace std;
int arr[10000005];
int main() {
ios::sync_with_stdio(0);
cin.tie(0);
int n;
cin >> n;
for(int i=0; i<n; i++){
cin >> arr[i];
}
long long sum=0;
int cnt=0;
int mx=0;
for(int i=n-1; i>=0; i--){
if(mx>arr[i]){
... | ALGO | 0.999965 | 4.160527 |
f2786a53-32e3-481a-86ef-91c230afb267 | ishandutta2007/codeforces | ilya_msu/normal/47/A.cpp | #include<iostream>
#include<vector>
#include<string>
#include<stack>
#include<algorithm>
#include<cmath>
#include<set>
#include<queue>
#include<sstream>
#include<utility>
using std::pair;
using std::stringstream;
using std::next_permutation;
using std::sqrt;
using std::priority_queue;
using std::sort;
using std::stack... | ALGO | 0.999823 | 3.781806 |
3c1761f1-d1fb-4399-b1b6-21aefc62eea8 | raacker/algorithm_problems | boj/10952/10952.cpp | #include<cstdio>
int main(void)
{
int a,b;
while(1)
{
scanf("%d %d", &a, &b);
if(a == 0 && b == 0)
break;
else
printf("%d\n",a+b);
}
} | ALGO | 0.998245 | 3.25875 |
d7fe4292-0bfc-4e09-a801-a9949b43af60 | KafuuPone/CodeStuff | Miscallaneous/codeforces/1624A.cpp | #include <iostream>
using namespace std;
void solve() {
int n; cin >> n;
int temp, max, min;
cin >> temp;
max = min = temp;
for(int i = 0; i < n-1; i++) {
cin >> temp;
if(temp > max) max = temp;
if(temp < min) min = temp;
}
cout << max-min << endl;
}
int main() {
int t; cin >> t;
for(int i = 0; i < t;... | ALGO | 0.999828 | 4.249711 |
6c587a1c-ee35-4f92-a374-0539365476ab | naveenvashistha/DSA-C- | binary search/BS on answers/median of two sorted arrays/main.cpp | #include <bits/stdc++.h>
using namespace std;
double median1(vector<int>& nums1, vector<int>& nums2);
double median2(vector<int>& nums1, vector<int>& nums2);
double median3(vector<int>& nums1, vector<int>& nums2);
int main()
{
vector<int> n1 = {3} , n2 = {-2,-1};
double n = median2(n1, n2);
cout << n << ... | ALGO | 0.999989 | 4.998507 |
94a1c274-fc11-4109-8de2-29c058153fa2 | HyunByungRok/Algorithm_ITN | SJSHIM/Algorithm/stack/BOJ_2304_창고 다각형.cpp | #define _CRT_SECURE_NO_WARNINGS
#include <iostream>
#include <stdio.h>
#include <stack>
using namespace std;
int arr[1001] = { 0, };
int main() {
stack<int> s;
int n;
scanf("%d", &n);
int max_value = -1;
int findIdx = 0;
for (int i = 0; i < n; i++)
{
int l, h;
scanf("%d %d", &l, &h);
arr[l] = h;
// ū ... | ALGO | 0.99998 | 3.883293 |
3289cf32-537b-454d-9249-45d64ed15695 | Leorasaharia/LeetCode-Solutions | 0225-implement-stack-using-queues/0225-implement-stack-using-queues.cpp | class MyStack {
public:
queue<int>q;
MyStack(){
}
void push(int x){
q.push(x);
int n=q.size()-1;
for(int i=0;i<n;++i){
int a=q.front();
q.pop();
q.push(a);
}
}
int pop(){
int m=q.front();
q.pop();
re... | ALGO | 0.998411 | 5.660286 |
d6c2e9d7-78a3-43a4-88e0-4f888414684a | matszpk/native-boinc-for-android | src/setiathome-7.0/seti_boinc/splitter_fft/polyphase.cpp |
#include "sah_config.h"
#include <stdio.h>
#include <stdlib.h>
#include <strings.h>
#include <unistd.h>
#include <limits.h>
#include <assert.h>
#include <math.h>
#include "splitparms.h"
#include "splittypes.h"
#include "splitter.h"
#include "fftw.h"
#include "wufiles.h"
#include "polyphase.h"
#include "dotransform.h"... | ALGO | 0.990146 | 4.180874 |
99fdd8fa-b0f8-4ecf-9816-3a56ed7c4b87 | catherineytw/topo-blend | ScorerLib/PairRelationScorer.cpp | #include "PairRelationScorer.h"
void PairRelationScorer::isParalOrthoCoplanar(PairRelation &cpr)
{
Structure::Node * n1 = cpr.n1; Structure::Node * n2 = cpr.n2;
Vector_3 d1, d2;
bool iscurve1 = node2direction(n1, d1);
bool iscurve2 = node2direction(n2, d2);
double err(0.0);
if ( iscurve1 == iscur... | ALGO | 0.998231 | 4.74972 |
64e20223-9372-4eb6-882c-37d0b4260593 | ManuelTolino/ESISenecaDynamics | wind_ctrl.cpp | /*
File : wind_ctl.c
Prefix: WD_
Module: Seneca Dynamics
Created: 22 March 2000
Description: This file sets up the wind components
*/
/***************************/
/* RCS Markers */
/***************************/
/*
New wind_ctrl back in for Dyn231
$Header: C:/MASTER/seneca/RCS/wind_ctrl.cpp 1.4 2000/06... | ALGO | 0.996869 | 4.831262 |
49a769c1-debd-4ffe-a5d3-76e714c0a290 | Langelozzi/huff_my_file | src/util/decompress.cpp | //
// Created by Lucas Angelozzi on 2023-04-21.
//
#include <cstdlib>
#include <iostream>
#include <fstream>
#include "decompress.h"
#include "helpers.h"
#include "../models/Node.h"
std::unordered_map<char, std::vector<int> *> *restoreCodewords(FILE *file, long numUniqueChars) {
auto codes = new std::unordered_ma... | ALGO | 0.977695 | 4.566016 |
fc5fedea-dbe7-4b26-a8a6-dfce0a61aa83 | wasdfg/programmers | 프로그래머스/2/87390. n^2 배열 자르기/n^2 배열 자르기.cpp | #include <string>
#include <vector>
using namespace std;
vector<int> solution(int n, long long left, long long right) {
vector<int> answer;
int t = right-left+1;
for(long long i = 0;i < t;i++){
int y = (int)(left / n + 1);
int x = (int)(left % n + 1);
left++;
answer.push_b... | ALGO | 0.999971 | 3.765284 |
db253a9c-a3f9-4a97-ac9d-1388a2d8e533 | momo55555/SimbiconPlatform | Dependencies/include/PhysX/SceneQuery/SqFreePruner.cpp | ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
#include "PsIntrinsics.h"
#include "GuIntersectionBoxBox.h"
#include "GuIntersectionCapsuleBox.h"
#include "GuIntersecti... | ALGO | 0.874277 | 6.764022 |
8b89a09e-6fe9-42c0-b565-211d2cd783ba | SandipKumar06529/DSA | 122-best-time-to-buy-and-sell-stock-ii/best-time-to-buy-and-sell-stock-ii.cpp | class Solution {
public:
int maxProfit(vector<int>& prices) {
int profit=0;
int max_diff=0;
for(int i =1; i<prices.size(); i++){
if(prices[i]>prices[i-1]){
max_diff = prices[i]- prices[i-1];
profit =profit + max_diff;
} ... | ALGO | 0.999802 | 6.015972 |
d0412e26-15a6-4531-b6cb-740195e72c97 | snkt-30/LeetCode_Que | 0416-partition-equal-subset-sum/0416-partition-equal-subset-sum.cpp | #define ll long long int
class Solution {
private:
// bool helper(vector<int>&arr,int sum,int ind,vector<vector<int>>&dp)
// {
// if(ind==0)
// {
// if(sum==0)
// return true;
// return false;
// }
// if(... | ALGO | 0.999948 | 5.564889 |
d3961f95-f871-4236-bd2a-38eb5aec755a | codex31373/sdl_2_t | lib/box2d/src/dynamics/b2_polygon_circle_contact.cpp | #include "b2_polygon_circle_contact.h"
#include "box2d/b2_block_allocator.h"
#include "box2d/b2_fixture.h"
#include <new>
b2Contact* b2PolygonAndCircleContact::Create(b2Fixture* fixtureA, int32, b2Fixture* fixtureB, int32, b2BlockAllocator* allocator)
{
void* mem = allocator->Allocate(sizeof(b2PolygonAndCircleConta... | ALGO | 0.975436 | 6.975953 |
641c8462-a716-49d7-ac34-dbfc13d6d89a | akselkaastras/crEITive | code/cgos/src/h_zeta.cpp | #include "cgos.h"
/*
Computes the harmonic function H_zeta(x) = G_zeta(x) - 1/(4*pi*|x|)
Where G_zeta(x) is the Faddeev Green's function. It is computed using the following formula.
G_(zeta)(x) = exp(-kappa*r)/(4*pi*r) - kappa/(4*pi) \int_{k.hatx}^1 exp(-kappa*r*u)/(sqrt(1-u^2))*J_1(kappa*r*sqrt(1-u^2)) du
z... | ALGO | 0.999539 | 4.631145 |
8a510317-61ec-4c5c-9c9a-f9362ef74964 | morrischen890717/Leetcode | C++/377.cpp | class Solution {
public:
int solve(vector<int>& nums, vector<int>& dp, int target){
if(target < 0)
return 0;
if(dp[target] != -1)
return dp[target];
dp[target] = 0;
for(int i = 0; i < nums.size(); i++){
dp[target] += solve(nums, dp, target - nums[i... | ALGO | 0.999986 | 6.084428 |
1a585ba3-e53a-4dca-a681-8c047cbc7a88 | dibyatanoy/Competitive_Programming | Dollars.cpp | #include <iostream>
#include <cstdio>
#include <cstring>
using namespace std;
long int coins[11]={5,10,20,50,100,200,500,1000,2000,5000,10000};
double dp[6005];
double amount;
int max(int a,int b){
if(a>b) return a;
return b;
}
int change(){
dp[0]=1;
for(int i=0;i<11;i++){
for(int k=coins[i]/5;k<6005;k++){
... | ALGO | 0.975266 | 3.124783 |
2f567a3f-8529-4ab8-8ca3-71a984a1b101 | ermine27/competitive-programming | src/atcoder/joi2013yo/joi2013yo-d.cpp | #include <bits/stdc++.h>
using namespace std;
#define reps(i,s,n) for(int i = (int)(s); i < (int)(n); ++i)
#define rep(i,n) reps(i,0,n)
#define repf(i,n) reps(i,1,n+1)
using ll = long long;
using vi = vector<int>;
using vl = vector<long long>;
using vvi = vector<vi>;
using vvl = vector<vl>;
template<typename T>bool ch... | ALGO | 0.999437 | 4.015369 |
3a907f04-0973-466f-b50b-5e466820c236 | teaspring/problems | leetcode/cpp_unittest/maxContainer_unittest/maxContainer_unittest.cpp | #include "maxContainer.cpp"
#include "gtest/gtest.h"
/* int Solution::maxWater(vector<int>&) */
TEST(maxContainerTest, Positive01){
Solution s;
int arr[] = {1, 2, 1};
vector<int> height(arr, arr + sizeof(arr) / sizeof(int));
int expected = 2;
EXPECT_EQ(expected, s.maxWater(height));
height.... | ALGO | 0.999369 | 6.520105 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.