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 |
|---|---|---|---|---|---|---|
db31a477-0127-4e17-87e2-0cf947ae07aa | MdMostafizurRahaman/Random-Code | 1214_lab1.cpp | #include<bits/stdc++.h>
#define p 1
#define q 2
#define r 3
#define final 3
using namespace std;
typedef long long ll;
int main()
{
ios::sync_with_stdio(false);
ll state[4][2];
state[p][0]=p;
state[p][1]=q;
state[q][0]=p;
state[q][1]=r;
state[r][0]=p;
state[r][1]=r;
string str;
... | ALGO | 0.99991 | 4.388944 |
1deda3cf-5805-42a6-8eb6-06d978a83fb7 | apc-io/apc_b2g_gecko | gfx/skia/trunk/src/pathops/SkDCubicLineIntersection.cpp | #include "SkIntersections.h"
#include "SkPathOpsCubic.h"
#include "SkPathOpsLine.h"
/*
Find the interection of a line and cubic by solving for valid t values.
Analogous to line-quadratic intersection, solve line-cubic intersection by
representing the cubic as:
x = a(1-t)^3 + 2b(1-t)^2t + c(1-t)t^2 + dt^3
y = e(1-... | ALGO | 0.999794 | 4.696599 |
c8c8f617-1550-4b41-b446-f5cc349dc9ee | CheungBH/ncnn_pose_demo | examples/hid/Tracker.cpp | //
// Created by sean on 2021/4/1.
//
#include "Tracker.h"
std::vector<cv::Rect_<float>> get_predictions() {
std::vector<cv::Rect_<float>> predBoxes;
for (auto it = trackers.begin(); it != trackers.end();)
{
cv::Rect_<float> pBox = (*it).predict();
//std::cout << pBox.x << " " << pBox.y << ... | ALGO | 0.999603 | 5.950033 |
b1d06589-c257-4c94-8f78-a527fe341d48 | anurag-25/LeetCode | maximum-product-subarray/maximum-product-subarray.cpp | class Solution {
public:
int maxProduct(vector<int>& nums) {
int mx = nums[0], mn = nums[0], ans = nums[0];
for (int i=1; i<nums.size(); i++) {
if (nums[i]<0) swap (mx, mn);
mx = max (nums[i], mx*nums[i]);
mn = min (nums[i], mn*nums[i]);
ans = max (ans... | ALGO | 0.999992 | 6.150207 |
eb954282-b05c-42f0-9f07-79529ed71078 | WashizuRyo/Competitive-programming | algo/algorithmBasic/array/g.cpp | #include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (n); i++)
using P = pair<int, int>;
using ll = long long;
int main() {
int h, w;
cin >> h >> w;
vector<string> s(h);
vector<string> t(h);
rep(i, h) cin >> s[i];
rep(i, h) cin >> t[i];
int ans = 0;
rep(i, h) {
rep(... | ALGO | 0.999895 | 4.082063 |
f983caa7-635f-499d-b341-cd84e413f7f3 | balebao/code-test | 10/11.cpp | #include <iostream>
#include <cstring> // For C-string functions
using namespace std;
// Function to reverse the case of each character in a C-string
void reverse(char* str) {
while (*str != '\0') {
if (isupper(*str)) {
*str = tolower(*str);
} else if (islower(*str)) {
*str ... | ALGO | 0.990876 | 6.209657 |
d4a93483-a521-4e84-8764-eec99fd7a0c0 | psornsiri/UltrasoundSimulator-FinalProject | sdk-3.15.0/externals/Eigen/doc/examples/class_CwiseBinaryOp.cpp | #include <Eigen/Core>
#include <iostream>
using namespace Eigen;
using namespace std;
// define a custom template binary functor
template<typename Scalar> struct MakeComplexOp {
EIGEN_EMPTY_STRUCT_CTOR(MakeComplexOp)
typedef complex<Scalar> result_type;
complex<Scalar> operator()(const Scalar& a, const Scalar& b... | ALGO | 0.925364 | 6.700232 |
0ffc25a6-012a-47b4-aaad-d821a6e1d15e | pratham27037/c-program | c++program/Codeforce💻/buy_a_shovel.cpp | #include<bits/stdc++.h>
using namespace std;
int main(){
int k,r;
cin>>k>>r;
int i=2,count=1,res=k;
while(true){
if(res%10==0){
cout<<count;
break;
}
if(res%10==r){
cout<<count;
break;
}
res = k * i;
... | ALGO | 0.999691 | 3.193904 |
2f17282e-484b-4491-8eae-3bb34269a071 | GeospatialDaryl/VS2013__08_Eigen_x64 | failtest/qr_int.cpp | #include "../Eigen/QR"
#ifdef EIGEN_SHOULD_FAIL_TO_BUILD
#define SCALAR int
#else
#define SCALAR float
#endif
using namespace Eigen;
int main()
{
HouseholderQR<Matrix<SCALAR,Dynamic,Dynamic> > qr(Matrix<SCALAR,Dynamic,Dynamic>::Random(10,10));
}
| TEST | 0.96896 | 3.076401 |
402fec9c-2a9a-42c0-8057-44fc16e7bb3c | NotSamarth/-CrackYourPlacement | symmetricTree.cpp |
class Solution {
public:
bool mirror(TreeNode* p,TreeNode* q){
if(p==NULL && q==NULL) return true;
if(p==NULL || q==NULL) return false;
if(p->val != q->val) return false;
// recursion
return mirror(p->left,q->right) && mirror(p->right,q->left);;
... | ALGO | 0.999975 | 6.421682 |
7d8bc677-17cf-41c8-91a0-dcac83b941e6 | mikyoch/CP_Journey_with_CPP | 2023_01_25_Codeforces Round #846 (Div. 2)/D.cpp | #include <bits/stdc++.h>
using namespace std;
int main() {
int tc; scanf("%d", &tc);
while (tc--) {
int n; scanf("%d", &n);
int res = 0;
while (n) {
printf("- %d\n", 1 << (n - 1));
fflush(stdout);
res += (1 << (n - 1));
int nn;
scanf("%d", &nn);
if (nn >= n) {
int cur = (1 << (n - 1)) * (... | ALGO | 0.971509 | 3.267757 |
8ce65520-96c7-43bf-a864-4763ab367a96 | Abdullahbottar/C-pf | lab2/Source9.cpp | #include <iostream>
using namespace std;
int main()
{
int n;
cout << "enter the value of n:";
cin >> n;
for (int i = 1; i <= n; i++)
{
cout << i << "\t";
for (int j = 2; j <= n; j++)
{
cout << i * j << "\t";
}
cout << "\n";
}
system("pause");
return 0;
} | ALGO | 0.996652 | 3.607014 |
4020cd66-fd1f-45a7-b8ff-5c81f43463b5 | chris-wickens/patrol_config_issue | 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.9988 | 6.76073 |
56b9f297-fd26-4988-a91c-d9f43dc96011 | 1tygoime/a | spoj/C11SUM.CPP | #include <bits/stdc++.h>
using namespace std;
#define ll long long
const ll mod = 1e9 + 7;
// N=5312
// Xet cac day con 5 | 3 53 | 1 31 531 | 2 12 312 5312
// Goi s[i] la tong cac day con ket thuc = N[i]
// Res =s[0]+s[1]+s[2]+s[3]
// s[2]=1+31+531=563
// s[3]=2+12+312+5312 = 2+10+2+310+2+5310+2= s[2]*10+(3+1)*2
// s... | ALGO | 0.999869 | 4.682092 |
5ac5a65a-2548-486c-b8a2-8ac437bd2d01 | youngjae-Jo/coding-test | baekjoon/17140.cpp | #include <iostream>
#include <vector>
using namespace std;
vector<vector<int>> A(4, vector<int>(4));
//행의 개수>= 열의 개수 -> 모든 행에 대해서 정렬 , 가장 큰 행 기준으로 모든 행 크기 증가
//행의 개수<열의 개수 -> 모든 열에 대해서 정렬 , 가장 큰 열 기준으로 모든 열 크기 증가
//수,등장횟수 등장횟수 커지는 순으로, 여러개면 수가 커지는 순으로
void sort_R() {//행 정렬
}
void sort_C() {//열 정렬
}
int minToK(i... | ALGO | 0.999918 | 3.724309 |
9ed94086-8606-4a96-870d-41f3cccc916c | Swapno963/Phitron-Batch-3 | contest/Group Contest/sheet_2_#/E_Hady_Rides_the_Train.cpp | #include<bits/stdc++.h>
using namespace std;
int main()
{
long long num; cin >> num;
// long long y = (num +1)/4;
// long long x = num /4;
// cout << y << " " << x << endl;
cout << num /4<< " " << (num %4)+1 << endl;
return 0;
} | ALGO | 0.991598 | 3.479355 |
052353db-7c9f-4100-ad1e-ec70815ab993 | RoPro99/GeekforGeeksProblems | Array Problem Level-1/Check_if_array_sorted.cpp | #include<bits/stdc++.h>
using namespace std;
bool check(int *arr,int n){
int cnt=0;
for(int i=0;i<n;i++){
if(arr[i]>arr[i+1]){
cnt++;
}
}
if(cnt>1){
return false;
}
return true;
}
int main(){
int n;
cin>>n;
int arr[1000];
for(int i=0;i<n;i++){
cin>>arr[i];
}
if(check(arr,n)){
cout<<"1"<<endl;... | ALGO | 0.999978 | 3.769515 |
1695e8e9-eb65-4536-816b-3d0427c63bec | bothemrun/CAP-Complete-Algorithmic-Programming | Leetcode_All_Solved/3216.cpp | class Solution {
public:
string getSmallestString(string s) {
int n = s.size();
string ans = s;
for(int i=0;i+1<n;i++)if(s[i]%2 == s[i+1]%2){
string t = s;
swap(t[i], t[i+1]);
ans = min(ans, t);
}
return ans;
}
};
| ALGO | 0.999996 | 5.924109 |
c9a6ec0d-80a9-4c72-9701-fb285d8c1dd9 | Koyama-Tsubasa/LeetCode | Problems/No.8_String_to_Integer_(atoi)/string_to_integer_(atoi).cpp | class Solution {
public:
int myAtoi(string s) {
// ASCII code 48..."0", 57..."9"
// INT_MAX ... 2147483647
// INT_MIN ... -2147483648
int c = 0;
int StI_ans = 0;
bool pos_neg = 0;
// start compute
// find until '-', '+', or ... | ALGO | 0.999278 | 5.154419 |
d4e1a8e7-359c-4f5e-b712-6cba8afa5e6e | cclien4/APCS | TOI練習賽/2021.03TOI/B3_Flight.cpp | #include <stdio.h>
#include <vector>
struct DisjointSet {
std::vector<int> f, cnt;
void init(int N) {
f.resize(N), cnt.resize(N);
for (int i = 0; i < N; ++i) {
f[i] = i, cnt[i] = 1;
}
}
int find(int x) {
return x != f[x] ? f[x] = find(f[x]) : x;
}
int count(int x) {
return cnt[find(x)];
}
void... | ALGO | 0.999632 | 4.380406 |
4c72d42a-7244-4985-bbed-91412eaf13d7 | ThatMalayaliDeb/android_device_xiaomi_vili | gps/utils/loc_misc_utils.cpp | #define LOG_NDEBUG 0
#define LOG_TAG "LocSvc_misc_utils"
#include <stdio.h>
#include <string.h>
#include <inttypes.h>
#include <dlfcn.h>
#include <math.h>
#include <log_util.h>
#include <loc_misc_utils.h>
#include <ctype.h>
#include <fcntl.h>
#include <inttypes.h>
#ifndef MSEC_IN_ONE_SEC
#define MSEC_IN_ONE_SEC 1000UL... | TOOL | 0.961056 | 5.910943 |
f3bc582f-5772-465d-bee2-3caea4ec40b2 | dylan007/Coding | iecse/summer19/median.cpp | /*=======================
Author : Shounak Dey
======================= */
#include<bits/stdc++.h>
using namespace std;
using ll = long long int;
using ull = unsigned long long int;
#define PB push_back
#define MK make_pair
#define SZ(a) (int)(sizeof(a))
#define F first
#define S second
#define FOR(i,a,b) for(... | ALGO | 0.999943 | 3.711877 |
672b50d6-d41a-4519-addc-a33b00592512 | manikanta2901/ubuntu | .history/SRM/elab/DataStructures/Stack/ST8_20201101154830.cpp | //
#include<bits/stdc++.h>
#include<iostream>
using namespace std;
// struct Stack
// {
// int top;
// unsigned capacity;
// int* array;
// };
// struct Stack* MakeStack(unsigned capacity)
// {
// struct Stack *a=(struct Stack*)malloc(sizeof(struct Stack));
// a->top = 1;
// return a;
// }
int main... | ALGO | 0.999985 | 4.451922 |
bc216f27-d043-445b-9224-d3756b28af1b | jxx-sx/BOJ_Study | solved/dp/11722.cpp | #include <algorithm>
#include <iostream>
#include <vector>
using namespace std;
int n;
vector<int> v;
void init() { cin >> n; }
void solve() {
int inp;
for (int i = 0; i < n; i++) {
cin >> inp;
if (v.empty())
v.push_back(-inp);
else if (v.back() < -inp)
v.push... | ALGO | 0.999951 | 5.029342 |
ed675cb3-3cb2-4a33-a375-924cedce9f59 | Modding-Zaibatsu/Pre-Unreal-4.14 | Engine/Source/ThirdParty/IntelTBB/IntelTBB-4.4u3/examples/parallel_for/tachyon/src/shade.cpp | /*
* shade.cpp - This file contains the functions that perform surface shading.
*/
#include "machine.h"
#include "types.h"
#include "macros.h"
#include "light.h"
#include "intersect.h"
#include "vector.h"
#include "trace.h"
#include "global.h"
#include "shade.h"
void reset_lights(void) {
numlights=0;
}
void add... | ALGO | 0.977168 | 5.916932 |
23b9970b-c8e3-47d7-abfb-9a492c77a031 | GuilinZ/leecode | 53.cpp | //一定要注意定义的dp的含义,不一定要直接求出答案,只要dp数组里能找出想要的答案就行
//本题,dp[i]表示到第i个元素为止,包含第i个元素的连续数组的最大sum
//因此在状态转移时,就能考虑dp[i]和dp[i-1]的关系了,等于是定义状态时强加了限制,而不需要在状态转移时来考虑不连续的情况
class Solution {
public:
int maxSubArray(vector<int>& nums) {
int n = nums.size();
int dp[n];
dp[0]=nums[0];
int out=dp[0];
... | ALGO | 0.999987 | 5.777069 |
30b1765d-9667-4903-b7d6-6259cb526d46 | allydev/android_frameworks_base | media/libstagefright/codecs/amrnb/dec/src/d2_9pf.cpp | /*
------------------------------------------------------------------------------
Pathname: ./audio/gsm-amr/c/src/d2_9pf.c
Functions: decode_2i40_9bits
Date: 01/28/2002
------------------------------------------------------------------------------
REVISION HISTORY
Description: Modified to place file in the... | ALGO | 0.999702 | 7.302844 |
d59d4d82-725b-4f49-aa1d-6a0f2a9ac926 | ninilo97/Hackerearth-Practice-Solution | MATHS/Basic Number Theory-2/akashsGirlfriend_M.cpp | //@author Nikhil Londhe
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const int MOD = 1e9+9;
ll power(ll x, ll y){
ll res=1; x%=MOD;
while(y>0){
if(y&1) res=(res*x)%MOD;
y>>=1, x=(x*x)%MOD;
}
return res;
}
//Even terms from nC0*9^n to nC1*9^0 = ((9+1)^10 - (9-1)^10)/2
int main(){
... | ALGO | 0.99987 | 5.007998 |
70c3d46a-ffa2-4907-9fa6-5e30119e82d6 | rajansh87/Competitve-Programming | April20/April20_Q4.cpp | #include<bits/stdc++.h>
using namespace std;
#define ll long long int
#define loop1 for(i=0;i<n;i++)
#define loop2 for(j=0;j<n;j++)
#define loopi(a,b) for(i=a;i<b;i++)
#define loopj(a,b) for(j=a;j<b;j++)
#define rloopi(a,b) for(i=a;i>b;i--)
#define rloopj(a,b) for(j=a;j>b;j--)
#define test long long int t;cin>>t;while(... | ALGO | 0.999582 | 3.66379 |
a9c33fe6-388f-4ff7-8904-f6d8cb73ab78 | Diegrosan/redream-libretro | deps/xbyak/sample/label.cpp | #include <xbyak_aarch64/xbyak_aarch64.h>
using namespace Xbyak_aarch64;
class Generator : public CodeGenerator {
public:
Generator() {
Label L1, L2;
L(L1);
add(w0, w1, w0);
cmp(w0, 13);
b(EQ, L2);
sub(w1, w1, 1);
b(L1);
L(L2);
ret();
}
};
int main() {
Generator gen;
gen.ready... | TOOL | 0.959419 | 5.070418 |
cbd3da7e-5b45-4f6f-afee-2faa1674cad6 | blink-ing/algorithms | leetcode/AddTwoNumbers.cpp | class Solution {
public:
ListNode* addTwoNumbers(ListNode* l1, ListNode* l2) {
int sum = 0;
int carry = 0;
ListNode* result = nullptr;
ListNode* nextNode = nullptr;
while ((l1 != nullptr || l2 != nullptr) || carry > 0 ) {
int num1 = 0, num2 = 0;
if (l1... | ALGO | 0.999893 | 6.491117 |
00d8efd5-c72c-429c-bf31-986b1c4d7b41 | Kawser-nerd/CLCDSA | Source Codes/AtCoder/arc058/C/1186022.cpp | #include <iostream>
using namespace std;
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define REP(i,n) FOR(i,0,n)
#define ALL(v) (v).begin(),(v).end()
template<typename A, typename B> inline bool chmax(A &a, B b) { if (a<b) { a=b; return 1; } return 0; }
template<typename A, typename B> inline bool chmin(A &a, B b) {... | ALGO | 0.999988 | 4.223536 |
ebe6eda4-d582-48f0-a4b2-f9fac2f412e7 | 2013612/CP-algorithm | codejam/codejamR1A1.cpp | #include<iostream>
#include<string>
#include<algorithm>
using namespace std;
int T, N, ans;
string a[1004], suffix[1000007];
int main(){
cin >> T;
for (int i = 1; i <= T; i++) {
cin >> N;
ans = 0;
for (int j = 0; j < N; j++) {
cin >> a[j];
reverse(a[j].begin(), a... | ALGO | 0.999858 | 4.02352 |
19719a6a-5015-4aff-8dd3-379a665ff330 | g4197/Computer-Graphics-Pub | Final/code/deps/vecmath/src/Matrix4f.cpp | #include "Matrix4f.h"
#include <cassert>
#include <cmath>
#include <cstdio>
#include <cstring>
#include "Matrix2f.h"
#include "Matrix3f.h"
#include "Quat4f.h"
#include "Vector3f.h"
#include "Vector4f.h"
Matrix4f::Matrix4f( double fill )
{
for( int i = 0; i < 16; ++i )
{
m_elements[ i ] = fill;
}
}
Matrix4f::Ma... | TOOL | 0.956421 | 6.825716 |
47617ee6-abfd-49dd-a1e1-7c59bbdfc410 | JacobG623/MyPortfolio | C++/MergeSort.cpp | /* Student Name: Jacob Gowan Student NetID: jag1065
Student Name: Anthony Garcia, Perry Hervey, Cinthia Liu, Alonzo Reed
Programming language: C++
Compiler/IDE Used: Visual Studio
Program Description: An implementation of the merge sort algorithm done with c++
*/
#include <iostream>
using namespace std;
void merge(int... | ALGO | 0.999985 | 5.728988 |
aa63092b-6d64-4230-94a4-783ede0966f0 | ankit-0369/Solving-DSA-Problems | 1405-longest-happy-string/1405-longest-happy-string.cpp |
class cmp{
public:
bool operator()(pair<int, char> p1, pair<int,char> p2){
return p1.first<p2.first;
}
};
class Solution {
public:
string longestDiverseString(int a, int b, int c) {
string ans;
priority_queue<pair<int,char>, vector<pair<int,char>>, cmp> mxHeap;
... | ALGO | 0.999978 | 5.211521 |
08062968-ae02-4173-930d-cd7903dc0cdb | alexandraback/datacollection | solutions_1674486_0/C++/lxian2/a.cpp | #include<iostream>
#include<fstream>
using namespace std;
int m;
int n;
int map[50][50];
int mark[50];
int todo[3000];
int bfsre(int s){
int d;
for(int i=0; i<50; i++)
mark[i] =0;
for(int i=0; i<3000; i++)
todo[i] = -1;
int idx = 1;
int i=0;
todo[0] = s;
for(; i<idx; ){
d =todo[i++];
for(int j=0; j<n;... | ALGO | 0.999898 | 4.030736 |
5c8917ec-d05e-48d3-8e89-bd71872fe063 | jyh0521/MJ2H-Algorithm-Study | msb/[1744] 수 묶기.cpp | #include <iostream>
#include <algorithm>
#include <vector>
using namespace std;
#define FASTIO std::ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
int N, res = 0;
bool zero = false;
vector<int> positive, negative;
void solve(vector<int>& v, bool pos) {
while (!v.empty()) {
int first = v.back();
v.pop_back... | ALGO | 0.999984 | 3.878858 |
a28ac322-c8b8-4234-a761-78f90d8c88cf | proggerkz/CSES | CoinPiles.cpp | #include <bits/stdc++.h>
using namespace std;
template<class T> void ckmin(T &a, T b) { a = min(a, b); }
template<class T> void ckmax(T &a, T b) { a = max(a, b); }
#define pb push_back
#define mp make_pair
#define cotu cout
#define itn int
#define Red ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0)
#define... | ALGO | 0.999949 | 4.756869 |
c09db1a2-b90b-4d5f-b115-bca0b2a293ac | w-jin/leetcode | src/interview10.01_sorted_merge_LCCI.cpp | #include <iostream>
#include <vector>
using std::vector;
class Solution {
public:
void merge(vector<int> &A, int m, vector<int> &B, int n) {
if (m == 0) {
A = B;
return;
}
if (n == 0) {
return;
}
int i_merge = m + n - 1;
int iA =... | ALGO | 0.999975 | 5.346593 |
3c67586a-dd3c-4e84-99be-2da91a2a0702 | huyhue/C-Language | LABC/C.S.P0046.cpp | #include<stdio.h>
#include<stdlib.h>
#include<math.h>
int checkPrime(int n);
void outputPrime(int n);
int checkFibo(int n);
int sum(int n);
void menu();
int main(){
while (true){
menu();
int choice, n;
printf("Choose an option: ");
scanf("%d", &choice);
if (choice == 0) return ... | ALGO | 0.994408 | 3.882478 |
0e83371e-d80f-4937-9a6c-f13201d2892e | hardikkumar4472/CipherSchools-Assignments | Day_06/q1.cpp | #include<iostream>
using namespace std;
int main(){
cout<<"Enter size of array"<<endl;
int n;
int sum=0;
cin>>n;
int arr[n];
cout<<"Enter element of array"<<endl;
for (int i=0;i<n;i++){
cin>>arr[i];
}
for (int i=0;i<n;i++){
sum+=arr[i];
}
cout<<"Sum of all elements of array is "<<sum;
return 0;
} | ALGO | 0.918296 | 3.614326 |
f749cc41-80d1-47d0-9c50-565ccfad88fb | idudney/CSCI2270-DataStructures | Assignment-8/code_1/Graph.cpp | #include "Graph.hpp"
#include <vector>
#include <queue>
#include <iostream>
using namespace std;
void Graph::addVertex(string name){
//TODO 1)
// add new vertex 'name' to the graph
bool visited = false;
for (int i = 0; i < vertices.size(); i ++){
if (vertices[i]->name == name){
vis... | ALGO | 0.980395 | 4.290267 |
ae12c43f-8e63-4679-90ee-5a982643bc41 | ShenaoChen/Algorithm | code/acm/cf#ed114v2C.cpp | #include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const int N=2e5+5;
ll a[N];
int main(){
int n,m,l,r,mid;
ll sum=0,ans,tmp1,tmp2,x,y;
cin>>n;
for(int i=0;i<n;i++){
scanf("%lld",a+i);
sum+=a[i];
}
sort(a,a+n);
//for(int i=0;i<n;i++)
// cout<<a[i]<<' ';... | ALGO | 0.999953 | 4.580352 |
b5d40e9d-eac8-495c-8813-4a7c80c82ea7 | RominYue/leetcode | 279-Perfect-Squares/solution.cpp | class Solution {
public:
int numSquares(int n) {
vector<int> dp(n + 1);
dp[1] = 1;
for(int i = 2; i <= n; i++)
{
dp[i] = (int)1e9 + 7;
for(int j = 1; j * j <= i; j++)
{
dp[i] = min(dp[i], dp[i - j*j] + 1);
}
}
... | ALGO | 0.999972 | 5.943364 |
81c7ab14-05e5-4170-8b7a-de281dea5df9 | akulkanojia2414/Spoj_questions | dynamic.cpp |
#include <iostream>
#include <cstdio>
#include <cstring>
#include <algorithm>
#include <utility>
#include <map>
#include <vector>
#include <list>
#include <string>
#include <set>
#include <queue>
#include <ctime>
#include <fstream>
#include <sstream>
#include <cmath>
#include <limits.h>
#include <cstdlib>
#include <st... | ALGO | 0.999989 | 3.40599 |
e4a95db8-fefa-42ac-ba95-83e367cd13e3 | morix1500/atcoder | atcoder/ABC080/B/main.cpp | #include <bits/stdc++.h>
using namespace std;
int main() {
int n;
cin >> n;
int num = n;
int sum = 0;
while (num) {
sum += (num % 10);
num /= 10;
}
if (n % sum == 0) {
cout << "Yes" << endl;
} else {
cout << "No" << endl;
}
} | ALGO | 0.99996 | 4.654819 |
5d2181c2-0692-4230-a68e-444f1b09e606 | HG-IMMORTALS/GFG-POTD | Medium/Minimize the Difference/minimize-the-difference.cpp | //{ Driver Code Starts
#include<bits/stdc++.h>
using namespace std;
class Array
{
public:
template <class T>
static void input(vector<T> &A,int n)
{
for (int i = 0; i < n; i++)
{
scanf("%d ",&A[i]);
}
}
template <class T>
static void print(vector<T> &A)
... | ALGO | 0.999898 | 5.1732 |
48d03c0a-65fe-40c8-a1ce-fcffb60c36fb | fullstack-raghve/leet-code-imp | Cpp/leetcode/editor/cn/419_battleships-in-a-board.cpp | //给你一个大小为 m x n 的矩阵 board 表示甲板,其中,每个单元格可以是一艘战舰 'X' 或者是一个空位 '.' ,返回在甲板 board 上放置的
// 战舰 的数量。
//
// 战舰 只能水平或者垂直放置在 board 上。换句话说,战舰只能按 1 x k(1 行,k 列)或 k x 1(k 行,1 列)的形状建造,其中 k 可以
//是任意大小。两艘战舰之间至少有一个水平或垂直的空位分隔 (即没有相邻的战舰)。
//
//
//
// 示例 1:
//
//
//输入:board = [["X",".",".","X"],[".",".",".","X"],[".",".",".","X"]]
//输出... | ALGO | 0.999742 | 6.4167 |
ebf36515-79b9-49fd-8bd7-b316a11d1641 | Taohid0/C-and-C-Plus-Plus | big integer sum again/main.cpp | #include <bits/stdc++.h>
using namespace std;
int main()
{ string s1,s2;
vector <int>num1,num2,result;
int carry =0;
cout << "enter two numbers : " << endl;
cin>>s1>>s2;
int len1 = (int) s1.size();
int len2 =(int) s2.size();
for(int i = 0;i<len1;i++){
num1.push_back(s1[i] - '... | ALGO | 0.9999 | 4.182468 |
3d2ac1e2-0892-4210-a229-0bb4ef8bd9b0 | EstuardoValenzuela/Informatica-II | Laboratorio #7/main.cpp | #include <iostream>
using namespace std;
struct mapa {
bool** posiciones;
int ancho;
int largo;
};
struct vector {
int x;
int y;
};
// Inicia cambio jejej putas
//----------------------------------Problema #1------------------------
class vehiculo {
public: vehiculo(mapa _mapa, vector _posicion) {
esp... | ALGO | 0.990971 | 3.104101 |
f3811524-9d12-4d86-90c9-372c51c236cb | ds-sww/codebase | 13307130004/assignment5/src/calculator.cpp | #include <iostream>
#include <cstdio>
#include <string>
using namespace std;
class Calculator{
private:
string st;
int cur;
int length;
int exponent(int base,int exp){
int temp=base;
for(int i=1;i<exp;i++)
temp*=base;
return temp;
}
int priority(char sym){
switch (sym){
case '+' : return 0;
cas... | ALGO | 0.999868 | 3.817452 |
7a45ffdd-d376-4b5a-ac7b-c31ffc222412 | Aneeshcoder/DTU | Sem 7/MC405(L)/Programs/Exp_5.cpp | // Aneesh Panchal
// 2K20/MC/21
#include<iostream>
#include<vector>
#include<limits.h>
using namespace std;
void BellmanFord(vector<vector<int>> adjacency, int source){
int len = adjacency.size();
vector<int> distance(len,INT_MAX);
distance[source] = 0;
for(int i=0;i<len-1;i++)
for(int j=0;j<l... | ALGO | 0.9999 | 4.203597 |
5e4d5a4a-4ad5-4c0c-a5a3-0ce45e202859 | felixny/LeetCode | Algorithm I/876.cpp | // 876. Middle of the Linked List
struct ListNode {
int val;
ListNode* next;
ListNode() : val(0), next(nullptr) {}
ListNode(int x) : val(x), next(nullptr) {}
ListNode(int x, ListNode* next) : val(x), next(next) {}
};
ListNode* middleNode(ListNode* head) {
ListNode* fast = head;
ListNode* slow = head;
... | ALGO | 0.999857 | 5.794073 |
042560c1-11c6-457e-bcae-a071c54cb00a | TCWW0/QT_Train | date_struct/quicksort.cpp | #include "quicksort.h"
QuickSort::QuickSort(QGraphicsScene *scene, QTextEdit *debugOutputWidget):
ArrayBasic(scene,debugOutputWidget)
{
//对于对应的枢轴的元素的矩形渲染
pivotRect=new QGraphicsRectItem(0,0,25,25);
pivotRect->setBrush(Qt::NoBrush);
QPen pen (Qt::black);
pen.setWidth(2);
pivotRect->setPen(pe... | ALGO | 0.995187 | 4.429254 |
5ffcd963-a712-4830-82dd-f2b0a47602cb | Yosuamuliawan19/algorithm-bank | Uhunt/10763.cpp | #include<bits/stdc++.h>
using namespace std;
typedef long long ll;
ll n, a, b;
int main (){
map<pair<ll,ll> , ll> mp;
while (cin >> n){
if (!n) break;
mp.clear();
for (int i=0;i<n;i++){
cin >> a >> b;
pair<ll,ll> p = make_pair(a,b);
m... | ALGO | 0.999286 | 3.865285 |
e62406fb-38d2-47e5-8521-b5c170323b13 | NourAlakhras/disaster-management-frontend | 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.9988 | 6.76073 |
6839268c-f8f4-4949-b418-06a47d364833 | Double-zh/ByteTrack | deploy/TensorRT/cpp/src/utils.cpp | #include "BYTETracker.h"
#include "lapjv.h"
vector<STrack*> BYTETracker::joint_stracks(vector<STrack*> &tlista, vector<STrack> &tlistb)
{
map<int, int> exists;
vector<STrack*> res;
for (int i = 0; i < tlista.size(); i++)
{
exists.insert(pair<int, int>(tlista[i]->track_id, 1));
res.push_back(tlista[i]);
}
for... | ALGO | 0.985836 | 4.006189 |
79675740-df08-4c63-9948-da054a971758 | niraimozhimadhumitha/CSA0626-DAA-PRACTICALS | selection sort.cpp | #include <stdio.h>
void selectionSort(int arr[], int n) {
int i, j, min_idx;
for (i = 0; i < n-1; i++) {
min_idx = i;
for (j = i+1; j < n; j++) {
if (arr[j] < arr[min_idx])
min_idx = j;
}
int temp = arr[min_idx];
arr[min_idx] = arr[i];
... | ALGO | 0.999984 | 4.936311 |
1e07a922-612d-4e6a-afd6-7fd5297c8467 | lammps/lammps | src/FEP/pair_lj_class2_soft.cpp | // clang-format off
#include "pair_lj_class2_soft.h"
#include <cmath>
#include <cstring>
#include "atom.h"
#include "comm.h"
#include "force.h"
#include "neigh_list.h"
#include "math_const.h"
#include "memory.h"
#include "error.h"
using namespace LAMMPS_NS;
using namespace MathConst;
/* ----------------------------... | TOOL | 0.995519 | 6.680553 |
ace8a9a2-19bc-4024-80cc-1c61e104559b | hackybacky/my-leet | 2518-number-of-great-partitions/2518-number-of-great-partitions.cpp | class Solution {
public:
int countPartitions(vector<int>& nums, int k) {
int n = nums.size();
int dp[k + 1];
memset(dp , 0 ,sizeof(dp));
const int mod = 1e9 + 7;
// int n = nums.size();
long long total = 1;
dp[0] = 1;
long long int sum = 0;
for... | ALGO | 0.999994 | 5.220029 |
9c76f1c0-29b5-4134-ba5c-03f8d525e8cc | anthonylorelli/problems | lc/1342.cpp | // 1342. Number of Steps to Reduce a Number to Zero
// Problem definition: https://leetcode.com/problems/number-of-steps-to-reduce-a-number-to-zero/
// 2020-02-17
#define CATCH_CONFIG_RUNNER
#include "../../uva/catch/catch.hpp"
class Solution {
public:
int numberOfSteps(int num) {
int steps {0};
w... | ALGO | 0.999689 | 6.373748 |
8441dff3-5ee9-4fb3-ab88-c6c08924327d | chris-marres/Progtech-NTUA | 2nd Set/specker_total.cpp | #include <iostream>
#include <stdexcept>
#include <limits>
#include <cmath>
using namespace std;
class Move {
public:
// Take sc coins from heap sh and put tc coins to heap th.
Move(int sh, int sc, int th, int tc);
int getSource() const;
int getSourceCoins() con... | ALGO | 0.997719 | 3.542047 |
8a21d228-eb46-46e6-8066-bed09a62cb11 | Caerind/SDLBgfxTest | bgfx/bimg/3rdparty/astc/astc_kmeans_partitioning.cpp | /*----------------------------------------------------------------------------*/
/**
* This confidential and proprietary software may be used only as
* authorised by a licensing agreement from ARM Limited
* (C) COPYRIGHT 2011-2012 ARM Limited
* ALL RIGHTS RESERVED
*
* The entire notice above must be reproduced on... | ALGO | 0.999239 | 5.090901 |
d17271dc-8f65-4fed-8f6f-4fc928da7f8b | xseifert/UE4-GameWorks | Engine/Plugins/Experimental/AlembicImporter/Source/ThirdParty/Alembic/openexr/IlmBase/ImathTest/testLineAlgo.cpp | #include <testLineAlgo.h>
#include "ImathLineAlgo.h"
#include "ImathRandom.h"
#include <iostream>
#include <assert.h>
using namespace std;
using namespace IMATH_INTERNAL_NAMESPACE;
namespace {
void
testClosestPoints
(const Line3f &line1,
const Line3f &line2,
bool returnValue,
const V3f &point1,
... | TEST | 0.949652 | 6.920508 |
be361a9a-ad8c-4503-a11f-d459f9aea47d | B1Z0N/Algodata | leetcode/array-and-string/diagonal_traverse.cpp | typedef vector<int> vi;
typedef vector<vi> vvi;
typedef pair<int, int> pii;
#define pb push_back
class Solution {
public:
vector<int> findDiagonalOrder(vector<vector<int>>& matrix) {
if (matrix.empty()) {
return {};
}
int m = matrix.size(), n = matrix[0].size();
... | ALGO | 0.999992 | 6.245944 |
2d4d382b-3ccb-4a77-98ff-e893ada5f332 | foundintranslation/Kaldi | tools/sctk-2.4.0/src/asclite/core/compressedlevenshteinmatrix.cpp | /**
* Represent the Levenshtein Distance Matrix with compression
*/
#include "compressedlevenshteinmatrix.h"
Logger* CompressedLevenshteinMatrix::m_pLogger = Logger::getLogger();
CompressedLevenshteinMatrix::CompressedLevenshteinMatrix(const size_t& _NbrDimensions, size_t* _TabDimensionDeep)
{
m_MaxMemoryKBProp... | ALGO | 0.997706 | 5.235717 |
10e62bc1-dde5-44ed-b601-2d30404d7521 | VisionerTech/ORB_SLAM2_Unity | RenderingPlugin/ORB_SLAM2/eigen-eigen-07105f7124f9/doc/examples/function_taking_ref.cpp | #include <iostream>
#include <Eigen/SVD>
using namespace Eigen;
using namespace std;
float inv_cond(const Ref<const MatrixXf>& a)
{
const VectorXf sing_vals = a.jacobiSvd().singularValues();
return sing_vals(sing_vals.size()-1) / sing_vals(0);
}
int main()
{
Matrix4f m = Matrix4f::Random();
cout << "matrix m:... | ALGO | 0.999889 | 5.282894 |
8a6bc260-ed67-467e-a958-73d82d5d9fd8 | redblue-pkt/graphlcd-base | glcddrivers/config.cpp | #include <syslog.h>
#include <fstream>
#include <cstring>
#include <cstdlib>
#include "common.h"
#include "config.h"
#include "drivers.h"
namespace GLCD
{
cDriverConfig::cDriverConfig()
: name(""),
driver(""),
id(kDriverUnknown),
device(""),
port(0),
width(0),
height(0),
upsideDown(fals... | TOOL | 0.946995 | 5.5855 |
b06edb32-b463-4420-9ea7-16fe42c814b4 | chobaa/cpp-algorithm | icpc/cpp/5676.cpp | #include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
int n, k;
vector<int> arr;
vector<int> tree;
int invert(int x)
{
if (x == 0)
return 0;
if (x < 0)
return -1;
else
return 1;
}
int init(int start, int end, int node)
{
if (start == end)
re... | ALGO | 0.999973 | 4.251167 |
c6d702a0-3afc-4ab5-a6b4-2ad05661503d | Tarun290604/DSA | Recursion&Hash/Hashing.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];
}
map<int,int> mp;
for(int i=0;i<n;i++){
mp[arr[i]]++;
}
for(auto i:mp){
cout<<i.first<<" "<<i.second<<endl;
}
// int q;
// ci... | ALGO | 0.999766 | 3.926794 |
c7d671a7-93e2-45d4-84ce-312c747b595d | shaiful191/Data-Structures-and-Algorithms | 5) Searching/binary_search.cpp | #include<bits/stdc++.h>
using namespace std;
int Binary_search(int arr[],int f,int n)
{
int s=0;
int e=n-1;
while(s<=e)
{
int mid=s+(e-s)/2;
if (arr[mid]>f)
{
e=mid-1;
}
else if(arr[mid]<f)
{
s=mid+1;
}
else ... | ALGO | 0.999971 | 4.954183 |
0440a924-553b-4965-9ba1-4c1ef230d95b | thegamer1907/Code_Analysis | contest/1542538292.cpp | #include<bits/stdc++.h>
typedef long long int ull;
typedef long long int ll;
#define ub upper_bound
#define lb lower_bound
#define pb push_back
#define m_p make_pair
#define int_char_index(a) a-'0'
#define neginf -1000000001
#define inf 1000000000000000001
#define mod 998244353
#define F first
#define S sec... | ALGO | 0.999198 | 3.952449 |
5408b3bf-7e9d-4165-ac8b-f3d573c8fb2a | pinegreen83/codetree-TILs | 240728/더한 정수의 최댓값/maximum-of-summed-integers.cpp | #include <iostream>
#include <vector>
using namespace std;
int main() {
// 여기에 코드를 작성해주세요.
int n;
cin >> n;
long long sum = 0;
vector<int> nums(n+1);
for(int i=1; i<=n; i++)
{
cin >> nums[i];
sum += nums[i];
}
int comp1 = nums[1] + nums[2];
int comp2 = nu... | ALGO | 0.999949 | 4.213791 |
de95e817-8184-4c23-886b-c8313f12c587 | EmptyDust/Algorithm-Codes-and-writeups | codes/-0x30_competition/-0x33_codeforces/926/C.cpp | #include <bits/stdc++.h>
#define int long long
using namespace std;
constexpr int MAXN = 1e6 + 10;
int nums[MAXN], n;
using pt = pair<int, int>;
bool solve() {
int k, x, a;cin >> k >> x >> a;
int sum = 0, cur;
for (int i = 0;i <= x;++i) {
cur = sum / (k - 1) + 1;
sum += cur;
//cout... | ALGO | 0.999123 | 4.050405 |
968463b1-c053-4f40-8b9a-8d9cd9aaae5e | smmahadee/learn_c_cpp_dsa | 2.phitron_dsa/module-19.8(practice_tree)/3.level_order_traverse.cpp | #include <iostream>
#include <queue>
using namespace std;
class Node {
public:
int val;
Node* left;
Node* right;
Node(int val) {
this->val = val;
left = NULL;
right = NULL;
}
};
Node* create_tree() {
int val;
cin >> val;
Node* root;
if (val == -1) {
... | ALGO | 0.999706 | 5.126131 |
86c161a6-fec4-4636-803c-cc85773cd7c3 | Soumabhaghosh/CP-coding-Ninja | pre-requisites/Sum_array.cpp | /* Sum Array
Given a 2-d square matrix of order ‘n’, find the sum of elements of both diagonals and all boundaries elements. Boundary elements refer to the elements present on all the four boundaries of matrix.
Input:
First line will have a single integer ‘n’ denoting the order of matrix.
Next ‘n’ lines will have ‘n’ ... | ALGO | 0.999978 | 3.964924 |
8ff18b66-1ad5-46c5-919c-fc4714e4c277 | mushanshanshan/LeetCode | 515. Find Largest Value in Each Tree Row 2.cpp | /**
* Definition for a binary tree node.
* struct TreeNode {
* int val;
* TreeNode *left;
* TreeNode *right;
* TreeNode() : val(0), left(nullptr), right(nullptr) {}
* TreeNode(int x) : val(x), left(nullptr), right(nullptr) {}
* TreeNode(int x, TreeNode *left, TreeNode *right) : val(x), l... | ALGO | 0.999983 | 6.296387 |
2021ea19-65ef-4cfc-b4b8-05d0bcc74b4c | xinyuang/9_chapter_cpp_algorithm | 10. UnionFind/629. Minimum Spanning Tree.cpp | //629. Minimum Spanning Tree
//
//if use set to record visit, map<string, string> as father, will be slow.
//to speed up, idx the city using map<string, int> mp, init vector<int> father(#city, -1)
//sort the weighted connect(including city alphabet), then union find
//only when the area of island get increased, add con... | ALGO | 0.999873 | 5.655599 |
fdf5aca3-8dc4-422b-9135-b5f2b85807a1 | dhiman-64/Important-DSA-Problems | pp.cpp | #include<iostream>
using namespace std;
int main()
{
int n;
cin>>n;
for(int i=0 ; i<n ; i++)
{
//spacing
for(int j=0 ; j<i ; j++)
{
cout<<" ";
}
//main content
for(int j=0 ; j<2*n-(2*i+1) ; j++)
{
cout<<"*";
... | ALGO | 0.999952 | 3.688289 |
5a538889-7ce9-494e-a23b-cd8769b16cf3 | Lzy1289/DSA | DSA08019.cpp | #include<bits/stdc++.h>
int main(){
int t; std::cin >> t;
while(t--){
int n;
std::cin >> n;
std::queue<std::string> q;
q.push("6");
q.push("8");
std::vector<std::string> v;
while(!q.empty()){
std::string s = q.front();
q.pop();
... | ALGO | 0.999541 | 4.059003 |
9f4074a1-fbdb-447f-86d0-871ee83785e7 | f-zyj/ACM | 按 OJ 分类/51Nod/f-51Nod-1273-旅行计划/f-51Nod-1273-旅行计划/main.cpp | #include <iostream>
#include <cstdio>
#include <algorithm>
#include <cstring>
#include <vector>
#define pb push_back
using namespace std;
const int MAXN = 1e5 + 10;
struct node
{
int to, next;
} edge[MAXN];
int tot = 0;
int head[MAXN], deep[MAXN];
void add(int u, int v)
{
edge[++tot].to = v;
edge[tot]... | ALGO | 0.999991 | 3.659885 |
01a108a5-4e16-4dea-924d-d38d130ea06c | Depersonalizc/volumetric-clouds | src/noise/perlin.cpp | //#include "perlin.h"
//#include <random>
//#include <chrono>
//inline auto pos2DToIndex(auto x, auto y, auto xDim) {
// return x + xDim * y;
//}
//inline glm::vec2 indexToPos2D(auto index, auto xDim) {
// auto [y, x] = std::div(index, xDim);
// return {x, y};
//}
//Perlin::Perlin(size_t noiseResolution, si... | ALGO | 0.994564 | 5.6773 |
17802dc3-7ed8-437e-8458-238d11b855b8 | ishandutta2007/codeforces | shnirelman/normal/519/E.cpp | //#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
#define f first
#define s second
//#define int li
using namespace std;
using li = long long;
using ld = long double;
using pii = pair<int, int>;
const int INF = 1e9 + 13;
const li INF64 = 1e18 + 13;
const int N = 1e5 + 13;
const int M = 1e9 + 7;
const ld eps = 1e-6;
... | ALGO | 0.999743 | 4.537806 |
020d3e00-586d-435e-ae5f-a3dda09dea62 | Cattmonkey/openWork | webWork_backup/book/templates/recipes/tptest.cpp | #include <cmath>
#include "nr.h"
using namespace std;
void NR::tptest(Vec_I_DP &data1, Vec_I_DP &data2, DP &t, DP &prob)
{
int j;
DP var1,var2,ave1,ave2,sd,df,cov=0.0;
int n=data1.size();
avevar(data1,ave1,var1);
avevar(data2,ave2,var2);
for (j=0;j<n;j++)
cov += (data1[j]-ave1)*(data2[j]-ave2);
cov /= df=n-1... | ALGO | 0.979206 | 4.611292 |
07f0e559-83cb-4086-8aba-85daf44e73ea | A77-web/DataStruct | 1224.cpp | class Solution {
public:
ListNode *detectCycle(ListNode *head) {
ListNode *slow = head, *fast = head;
while (fast != nullptr) {
slow = slow->next;
if (fast->next == nullptr) {
return nullptr;
}
fast = fast->next->next;
if (f... | ALGO | 0.999921 | 6.019906 |
acf1515c-0307-408d-a0c7-109afc25ee4f | ZhuShiyun/01learning_cpp | src/p14/error2.cpp | /**
******************************************************************************
* @file : error2.cpp
* @author : b-zhushiyun
* @brief : Error handling - Solution 2:Tell the caller by the return value when error occurs
* @attention : We have to use the 3rd parameter to send t... | TOOL | 0.908163 | 4.12928 |
4d54c804-fe36-45c2-b212-3ac2d0acedcd | sarvex/leetcode-haxe | solution/0300-0399/0396.Rotate Function/Solution.cpp | class Solution {
public:
int maxRotateFunction(vector<int>& nums) {
int f = 0, s = 0, n = nums.size();
for (int i = 0; i < n; ++i) {
f += i * nums[i];
s += nums[i];
}
int ans = f;
for (int i = 1; i < n; ++i) {
f = f + s - n * nums[n - i];
... | ALGO | 0.999979 | 5.747322 |
8b97f862-55fe-4aa9-8a76-d8ce9de7848f | TUe-excellent-buildings/MSc_2023_Heuvelman | BSO_Toolbox/BSO/Spatial_Design/Geometry/Rectangle.cpp | #ifndef BSO_RECTANGLE_CPP
#define BSO_RECTANGLE_CPP
namespace BSO { namespace Spatial_Design { namespace Geometry
{
Rectangle::Rectangle(Line* l_one, Line* l_two, Line* l_three, Line* l_four, Vertex_Store* store_ptr)
{/*
std::cout << "making a rectangle: " << std::endl;
std::cout << l_one->get_vertex_ptr(0)->... | TOOL | 0.987246 | 4.304556 |
4df72cfd-ebae-413e-91be-e1b7ffd333f6 | ksanu1998/static_analysis_codegen_llms | feedback_pipeline/generations/cpp/files_with_feedback/question-403-pass-1.cpp | #include <bits/stdc++.h>
using namespace std;
bool isSubSeqDivisible(const string& str) {
int n = str.length();
int count = 0;
for (int i = 0; i < n; i++) {
if (str[i] % 8 == 0) {
count++;
}
}
return count > 0;
}
int main() {
string str = "123456789";
if (isSubSeq... | ALGO | 0.99954 | 4.490687 |
7e34e4f7-2502-4f3a-9bc2-f85e9d682ff0 | ishandutta2007/codeforces | tutis/normal/1288/C.cpp | /*input
723 9
*/
#pragma GCC optimize ("O3")
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
const ll mod = 1e9 + 7;
ll dp[1000 + 1][22];
int32_t main()
{
ios_base::sync_wit... | ALGO | 0.999964 | 4.242267 |
2a0bfd52-c153-40b9-9409-d130c48eb079 | Prathamesh-Chavan-232/problem-solving | dsa-practice/algorithms/path_finding/09_1_dijkstra_alg.cpp | // A C++ program for Dijkstra's single source shortest path algorithm.
// The program is for adjacency matrix representation of the graph
#include <iostream>
using namespace std;
#include <limits.h>
// Number of vertices in the graph
#define V 9
// A utility function to find the vertex with minimum distance value, fr... | ALGO | 0.999983 | 4.951586 |
4fb0cf50-8833-4ef8-a1f6-4ef2a9a131cb | ishandutta2007/codeforces | sert/normal/546/A.cpp | #include <iostream>
using namespace std;
int main() {
int n, k, w;
cin >> k >> n >> w;
cout << max(0, k * (w * (w + 1)) / 2 - n);
return 0;
} | ALGO | 0.999822 | 3.684648 |
075737e6-04a5-403d-a94e-090184126892 | kimh060612/Numerical_Analysis | NumericalAnalysisBible/Chap2/Gaussian_Elimination_with_Scaled_Partial_Pivoting/GaussElimination.cpp | /*
Gaussian Elimination With Scaled Partial Pivoting
*/
#include <iostream>
#include <iomanip>
#include <fstream>
#include <math.h>
using namespace std;
double max(double a, double b) {return a > b ? a : b;}
void swap(int &a, int &b);
ifstream fin("input.txt");
ofstream fout("output.txt");
int main()
{
int N;
... | ALGO | 0.999959 | 3.378147 |
eb8ae5c3-ff96-4ebb-a4b4-d40549ea7344 | deceptivecoder/problems | bitmanupulation/countbits.cpp |
#include <iostream>
#include <vector>
using namespace std;
class Solution {
//T: O(n^2) S(1)
// public:
// vector<int> countBits(int n) {
// int result =0;
// vector<int> ans;
// for(int i=0; i<=n; i++){
// result = hammingWeight(i);
// ans.push_back(result);
//... | ALGO | 0.999975 | 5.87152 |
0dc05513-e998-467b-8718-e7da884b16af | KhanAhmadYeaseen/OLD-DSA | map_uva1.cpp | #include<new>
#include<sstream>
#include<cstdlib>
#include<cctype>
#include<math.h>
#include<algorithm>
#include<set>
#include<queue>
#include<stack>
#include<list>
#include<iostream>
#include<fstream>
#include<numeric>
#include<string>
#include<vector>
#include<cstring>
#include<map>
#include<iterator>
#include<cstdio... | ALGO | 0.999967 | 3.100274 |
797919dc-729d-4562-aaf2-894ce15b9e75 | javagovindsharma/leetscode | solution/0800-0899/0847.Shortest Path Visiting All Nodes/Solution.cpp | class Solution {
public:
int shortestPathLength(vector<vector<int>>& graph) {
int n = graph.size();
queue<pair<int, int>> q;
bool vis[n][1 << n];
memset(vis, false, sizeof(vis));
for (int i = 0; i < n; ++i) {
q.emplace(i, 1 << i);
vis[i][1 << i] = true... | ALGO | 0.999889 | 5.552495 |
220a4d89-36ce-41ba-a0aa-a6d154ed08f8 | ishandutta2007/codeforces | voidmax/normal/891/C.cpp | #include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <cstdio>
#include <numeric>
#include <cstring>
#include <ctime>
#include <cstdlib>
#include <set>
#include <map>
#include <unordered_map>
#include <unordered_set>
#include <list>
#include <cmath>
#include <bitset>
#include <cassert>
#... | ALGO | 0.999982 | 4.022148 |
598e565e-234a-442f-84b3-1cd3e8772829 | ShashankJaipurkar123/Leetcode-solution | 0027-remove-element/0027-remove-element.cpp | class Solution {
public:
int removeElement(vector<int>& nums, int val) {
int index = 0;
for(int i = 0; i< nums.size(); i++){
if(nums[i] != val){
nums[index] = nums[i];
index++;
}
}
return index;
}
}; | ALGO | 0.998928 | 6.087979 |
45605945-43b1-484d-aa3e-151592336a07 | ShivaVkm/CplusplusPractice | numberPattern.cpp | #include<iostream>
using namespace std;
int main(){
int n;
cin>>n;
for(int i;i<=n;i++){
for(int j=1;j<=n-i;j++){
cout<<" ";
}
for(int j=1;j<=i;j++){
cout<<j<<" ";
}
cout<<endl;
}
return 0;
}
| ALGO | 0.999924 | 3.518627 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.