uuid string | repo_name string | relative_path string | content string | category string | algo_rel_score float64 | quality_score float64 |
|---|---|---|---|---|---|---|
b1214674-ff07-4954-a1e4-163eab59d114 | yusuketokuyoshi/VSGL | MiniEngine/Model/IndexOptimizePostTransform.cpp | // modified from original source to improve performance (especially in debug builds), memory allocations, etc.
#include "../Core/Utility.h"
#include <stdint.h>
#include <ASSERT.h>
#include <math.h>
#include <algorithm>
#include "IndexOptimizePostTransform.h"
namespace
{
// code for computing vertex score was ta... | ALGO | 0.999882 | 7.709512 |
ccc5ad08-56a2-42fc-9751-cefc75aa75d7 | kuihao/Coding-Problem-Solved | CPE_UVa/uva10420/uva10420.cpp | #include <iostream>
#include <sstream>
#include <map>
using namespace std;
int main()
{
int n;
while (cin >> n)
{
string s;
map<string, int> country_count;
cin.ignore();
while (n--)
{
getline(cin, s);
istringstream sin(s);
string c... | ALGO | 0.996004 | 4.644684 |
d49d1e28-9c5b-49cd-82e2-f12ff13cc92b | egorpugin/benchmarksgame | problem/pidigits/solution/gpp/4.cpp | /* The Computer Language Benchmarks Game
* https://salsa.debian.org/benchmarksgame-team/benchmarksgame/
*
* contributed by Alessandro Power
*/
#include <gmpxx.h>
#include <cstdlib>
#include <iostream>
class LFT {
public:
mpz_class q;
mpz_class r;
mpz_class t;
unsigned k;
public:
LFT() : q(1),... | ALGO | 0.999542 | 5.782841 |
c9c9c45c-5154-4b87-927c-29f0bdba7f45 | learjet5/SVF-for-Linux-Kernel | svf/lib/Util/Z3Expr.cpp | /*
* Z3Expr.h
*
* Created on: April 29, 2022
* Author: Xiao
*/
#include "Util/Z3Expr.h"
#include "Util/Options.h"
namespace SVF
{
z3::context *Z3Expr::ctx = nullptr;
z3::solver* Z3Expr::solver = nullptr;
/// release z3 context
void Z3Expr::releaseContext()
{
if(solver)
releaseSolver();
de... | ALGO | 0.928232 | 6.548011 |
f5c08535-bc02-438e-b42b-e70c63991289 | PaukIsUha/optimizing_formating_code | predictions/submissions-aizu-gpt4/Codenet/p00256/676027079/response_5.cpp | #include <iostream>
#include <vector>
#define ll long long
struct S {
ll y, m, d;
};
struct Ma {
ll b, ka, t, w, ki;
};
static const int M[] = {31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};
inline bool check(ll y) { return (y % 4 == 0 && (y % 100 != 0 || y % 400 == 0)); }
S M2S(ll b, ll ka, ll t, ll w, ll ki... | ALGO | 0.998735 | 3.600057 |
5f7413d9-25b1-409d-9244-360597bcdbb8 | ishandutta2007/codeforces | ko_osaga/normal/755/A.cpp | #include <bits/stdc++.h>
using namespace std;
typedef long long lint;
typedef long double llf;
typedef pair<lint, lint> pi;
int isp(int x){
for(int i=2; i*i<=x; i++){
if(x%i == 0) return 0;
}
return 1;
}
int main(){
int n;
cin >> n;
for(int i=1; i<=1000; i++){
if(!isp(i * n + 1)){
cout << i << endl;
r... | ALGO | 0.999894 | 3.484274 |
f2a783bc-1b62-4503-a3f8-0f147eda15f0 | valmir-filho/c-cpp-udemy-course | 30. sorting_structures_cpp/02. insertion_sort/insertion_sort.cpp | #include <iostream>
void insertion_sort(int arr[], int n) {
for (int i = 1; i < n; i++) {
int key = arr[i];
int j = i - 1;
while (j >= 0 && arr[j] > key) {
arr[j + 1] = arr[j];
j--;
}
arr[j + 1] = key;
}
}
int main() {
int ar... | ALGO | 0.999998 | 6.28023 |
28ff451c-d854-4efe-b070-23bb2ad18bc2 | rohitjuyal21/CPP | Functions/static_variable.cpp | // So yes static variables are the variables which remains always in the memory. They are just like a global Variable. Only the difference between global and static variable is global variable can be access in any function, static variable are accessible only inside the function in which they are declared.
#include <i... | ALGO | 0.946565 | 4.346205 |
3cecf643-4604-4a14-aa05-da3130276092 | beavct/fifth-semester-EPS | programming-challenges-mac0327/L13/E.cpp | #include <bits/stdc++.h>
using namespace std;
#define oiee ios_base::sync_with_stdio(false); cin.tie(NULL);
#define int long long
const int MAX = 1e6+100;
const int oo = 2e9;
typedef array<int, 2> guarda;
int N;
guarda val[4*MAX];
guarda arr[MAX];
const guarda neutral_value = {INT64_MIN, INT64_MAX};
guarda merge... | ALGO | 0.99983 | 4.713277 |
2accc362-1aca-46a2-afb0-1daece605e48 | ragibshahrier/cp | Contests/cf_edu_170/C.cpp | #include<bits/stdc++.h>
// #include <ext/pb_ds/assoc_container.hpp>
// #include <ext/pb_ds/tree_policy.hpp>
using namespace std;
// #define ordered_set tree<int, null_type,less<int>, rb_tree_tag,tree_order_statistics_node_update>
// using namespace __gnu_pbds;
#define int long long
typedef long long ll;
#define vi... | ALGO | 0.999955 | 4.82596 |
05976662-40e2-48b7-ab1f-71821bfc6fcd | Nanduag0/Leetcode | nandincpp/Min Cost to Connect All Points.cpp | class Solution {
int dist(vector<int>& a, vector<int>& b)
{
return abs(a[0]-b[0]) + abs(a[1]-b[1]);
}
public:
int minCostConnectPoints(vector<vector<int>>& points)
{
priority_queue<pair<int, int>, vector<pair<int, int>>, greater<pair<int, int>> > pq;
vector<bool> vis(points.s... | ALGO | 0.999952 | 5.962375 |
3074c7f3-2239-48cc-a423-5eff2810369c | Viateur-akimana/cpp-solutions | algorithm/codeshare.cpp |
#include <iostream>
using namespace std;
int fun6 (int n) {
int i = 1, m = 0;
while (i < n) {
m += 1;
i = i* 2;
}
return m;
}
// Testing Code
int main() {
printf("N = 100, Number of instructions 0(log(n)) :: %d \n", fun6 (100));
return 0;
}
| ALGO | 0.996507 | 5.640125 |
260bce5e-4063-42a9-9550-33c050d416d7 | bothemrun/CAP-Complete-Algorithmic-Programming | Leetcode_All_Solved/2191.cpp | #define t3i tuple<int,int,int>
static auto _ = [](){
ios::sync_with_stdio(false);
cin.tie(nullptr);
cout.tie(nullptr);
return nullptr;
}();
class Solution {
public:
inline int get_mapping(const vector<int>& mapping , int x){
vector<int> digit;
//edge case x==0
if(x==0) retu... | ALGO | 0.999991 | 5.823937 |
b2deecac-945a-4edd-aff2-b00e154adb1c | chrisdembia/coin | Bonmin/Clp/src/ClpHelperFunctions.cpp | /* $Id: ClpHelperFunctions.cpp 1817 2011-11-03 09:26:23Z forrest $ */
/*
Note (JJF) I have added some operations on arrays even though they may
duplicate CoinDenseVector. I think the use of templates was a mistake
as I don't think inline generic code can take as much advantage of
parallelism or machin... | TOOL | 0.998914 | 5.005208 |
7442cb9a-6139-42f6-a481-298a8bbbce01 | alexandraback/datacollection | solutions_1484496_0/C++/Newen/cj1.cpp | // cj1.cpp : Defines the entry point for the console application.
//
#include "stdafx.h"
#include <iostream>
#include <vector>
#include <hash_map>
using namespace std;
int _tmain(int argc, _TCHAR* argv[])
{
int t;
cin >> t;
for (int i = 0; i < t ; i++){
int n = 0;
cin >> n;
int sum = 0;
vector<long long in... | ALGO | 0.999401 | 4.141791 |
b59172ae-be30-4ede-81a0-3ecc2ab82f48 | marlonegoavil/GameModMidterm2023 | idlib/hashing/CRC8.cpp |
#include "../precompiled.h"
#pragma hdrstop
/*
CRC-8
*/
#define CRC8_INIT_VALUE 0x0000
#define CRC8_XOR_VALUE 0x0000
#ifdef CREATE_CRC_TABLE
static byte crctable[256];
/*
Generate a table for a byte-wise 8-bit CRC calculation on the polynomial:
x^8 + x^2 + x^1 + x^0
*/
void make_crc_table( void ) {
i... | ALGO | 0.999228 | 5.548545 |
bd866417-8a81-4cc2-b79f-1dfcd011b9b9 | prachiMeshram/Data-Structures-and-Algorithm | Practice/LinkedList/floydsDetectionCycle.cpp | #include<bits/stdc++.h>
using namespace std;
class Node {
public:
int data;
Node* next;
Node (int data) {
this -> data = data;
this -> next = NULL;
}
~Node() {
int value = this -> data;
// free memory
if (this -> next != NULL) {
delete next;... | ALGO | 0.99991 | 4.94807 |
85c0a621-f7c4-4848-a930-f2bf88ff0ae8 | intervalrain/Cpp | learn/bitsetTest.cpp | #include <iostream>
#include <bitset>
using namespace std;
using std::bitset;
int main(){
string str("10011100");
bitset<4> bitvec1(str); // 1001
bitset<8> bitvec2(str); // 00111001
bitset<16> bitvec3(str); // 0011100100000000
bitset<4> bitvec4(str, 4, 4); // 0011
bitset<8> bitve... | ALGO | 0.974468 | 3.853446 |
73fd0bbf-18f2-4df6-89dd-e83e8fd59b3c | karygauss03/Leetcode-Solutions | 3216-lexicographically-smallest-string-after-a-swap/3216-lexicographically-smallest-string-after-a-swap.cpp | class Solution {
private:
bool isSameParity(char a, char b) {
return ((a - '0') & 1) == ((b - '0') & 1);
}
public:
string getSmallestString(string s) {
for (int i = 0; i < s.size() - 1; ++i) {
if (s[i] > s[i + 1] && isSameParity(s[i], s[i + 1])) {
swap(s[i], s[i +... | ALGO | 0.999996 | 6.082666 |
38e1333b-946f-4ff2-975e-dbbcf09266ee | JaejunHan/Algorithm | c++/March/18/10430.cpp | #include <iostream>
using namespace std;
int main () {
int A, B, C;
cin >> A >> B >> C;
cout << (A+B) % C << endl;
cout << ((A%C) + (B%C))%C << endl;
cout << (A*B)%C << endl;
cout << ((A%C) * (B%C))%C << endl;
return 0;
} | ALGO | 0.999958 | 3.78065 |
323a7509-a895-4a51-a7d1-f6a0891a63f2 | ashish-jha-73/CodeCrucible | C_Beautiful_Sequence.cpp | #include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
using namespace std;
typedef long long ll;
typedef vector<ll> vl;
ll modpow(ll a, ll b, ll mod = 998244353) {
ll res = 1;
a %= mod;
while(b > 0) {
if(b & 1)
... | ALGO | 0.999644 | 4.896175 |
b9bee7ca-b7ab-443e-ac81-e47ccbd0867a | huangjunhao2019/leetcode-tencent | c++prime/chapter16/exercise16_37.cpp | #include<iostream>
using namespace std;
int main(){
int a=10;
double b=10.1;
double res=max<double>(a,b);
cout<<res<<endl;
return 0;
} | ALGO | 0.951606 | 3.504987 |
a2033276-fe6d-47da-9002-094d6a88fef7 | noko206/AtCoder | abc/351-400/375/c.cpp | // clang-format off
#include <bits/stdc++.h>
using namespace std;
#if __has_include(<atcoder/all>)
#include <atcoder/all>
using namespace atcoder;
#endif
#define _overload3(_1,_2,_3,name,...) name
#define _REP(i,n) REPI(i,0,n)
#define REPI(i,a,b) for(int i=int(a);i<int(b);++i)
#define REP(...) _overload3(__VA_ARGS__,R... | ALGO | 0.999998 | 4.432179 |
b6e60732-629d-485d-9cf1-4d3d83d69ee7 | rebeccca-debug/Cpp_Algorithms | Math/n_choose_r.cpp | /**
* @file
* @brief [Combinations](https://en.wikipedia.org/wiki/Combination) n choose r
* function implementation
* @details
* A very basic and efficient method of calculating
* choosing r from n different choices.
* \f$ \binom{n}{r} = \frac{n!}{r! (n-r)!} \f$
*
* @author [Tajmeet Singh](https://github.com/t... | ALGO | 0.999381 | 7.075191 |
00c8d305-767f-42ca-b227-aa5c7aa75599 | Avdhesh-Varshney/CPMasterLog | CodeChef/Practice-Problem/RELATIVE.cpp | // Relativity
// Problem Code - RELATIVE
// https://www.codechef.com/problems/RELATIVE
// Solution:
#include <iostream>
using namespace std;
int main() {
// your code goes here
int t;
cin >> t;
for(int i = 0; i < t; i++) {
int g, c;
cin >> g >> c;
cout << (c*c)/(2*g) << endl;
}
return 0;
} | ALGO | 0.999584 | 5.19409 |
b84650a5-2fb7-4a1d-9de0-e1dd14fb3956 | ujjwalprakash17/Striver-A2Z-DSA-Series-Solutions | 15 Graphs/GraphRevision.cpp | #include <bits/stdc++.h>
using namespace std;
int shortestPath(vector<vector<int>> &grid, pair<int, int> source,
pair<int, int> destination)
{
// code here
if(source == destination) return 0;
int n = grid.size();
int m = grid[0].size();
vector<vector<int>> dist(n, vector<int>(m, 1e... | ALGO | 0.999971 | 5.366449 |
9db6ac91-7ba3-4e4a-b881-d46b3e730c17 | TemmiTK/Artem_repository | lab5_C++/Zadanie18.cpp | #include <stdio.h>
#include <stdlib.h>
#include <time.h>
int main() {
srand(time(NULL));
int tablica[3][3][3], suma = 0;
for (int i = 0; i < 3; i++) {
for (int j = 0; j < 3; j++) {
for (int k = 0; k < 3; k++) {
tablica[i][j][k] = rand() % 100;
suma += ta... | ALGO | 0.998824 | 4.061975 |
18c2a22a-350e-4e5e-a82f-3d9458c58877 | creydit/cd-assignment | libc/src/stdfix/abshk.cpp | #include "abshk.h"
#include "src/__support/common.h"
#include "src/__support/fixed_point/fx_bits.h"
#include "src/__support/macros/config.h"
namespace LIBC_NAMESPACE_DECL {
LLVM_LIBC_FUNCTION(short accum, abshk, (short accum x)) {
return fixed_point::abs(x);
}
} // namespace LIBC_NAMESPACE_DECL
| TOOL | 0.905603 | 6.433768 |
3d8f8531-4940-4381-800f-5e85ec4d1b2b | Crimson-Coders-3/cs107-FinalProject | 3PL/eigen-3.3.9/doc/snippets/MatrixBase_all.cpp | Vector3f boxMin(Vector3f::Zero()), boxMax(Vector3f::Ones());
Vector3f p0 = Vector3f::Random(), p1 = Vector3f::Random().cwiseAbs();
// let's check if p0 and p1 are inside the axis aligned box defined by the corners boxMin,boxMax:
cout << "Is (" << p0.transpose() << ") inside the box: "
<< ((boxMin.array()<p0.array(... | ALGO | 0.968306 | 3.511614 |
6b68a873-5a54-42a8-8c1f-13c42902cb25 | phamcaodaian/code_btl | number_v0_3.cpp | #include<stdio.h>
void input(int &a, int &b);
void permutation(int a, int b);
int main(){
int a,b;
input(a,b);
permutation(a,b);
return 0;
}
void input(int &a, int &b){
printf("enter first number: ");
scanf("%d",&a);
printf("enter second number: ");
scanf("%d",&b);
}
void permutation(int... | ALGO | 0.999787 | 3.113461 |
2d454a7b-30e5-4bd6-b2df-4b46c32c9048 | opensource-hisense/SmartTV-SeriesVidaaU7_NT | oss/part1/boost/boost_1_73_0/libs/numeric/odeint/examples/openmp/phase_chain.cpp | #include <iostream>
#include <vector>
#include <boost/random.hpp>
#include <boost/timer/timer.hpp>
//[phase_chain_openmp_header
#include <omp.h>
#include <boost/numeric/odeint.hpp>
#include <boost/numeric/odeint/external/openmp/openmp.hpp>
//]
using namespace std;
using namespace boost::numeric::odeint;
using boost::t... | ALGO | 0.999937 | 5.579851 |
2172be7d-3d5f-4dcc-80e8-254e87569adc | dimmkan/MSHP | lesson17/l17-9/l17-9/main.cpp | #include <iostream>
#include <cmath>
using namespace std;
int main()
{
int n;
cin >> n;
int max_digit = int(pow(10, n));
int min_digit = int(pow(10, n-1));
max_digit -= 1;
for(int i = min_digit; i <= max_digit; i++){
int tmp_sum = 0;
int tmp_m = i;
do{
tmp_su... | ALGO | 0.999566 | 4.252892 |
da1dc241-8f25-4f1c-a8ad-368f48b63ba9 | itsadityakr/daily-code-challenge | day-85/_296_Print_the_array_elements.cpp | // _296_Print_the_array_elements.cpp
void printArr (vector<int> &arr){
for(int x:arr){
cout << x << " ";
}
}
// 1 5 1 2 3 | ALGO | 0.936175 | 4.633795 |
54bc1e3d-0d20-473f-97d3-4dec7ab15102 | lhCheung1991/flappybird_cocos2dx_2 | cocos2d/cocos/base/ccUtils.cpp | #include "base/ccUtils.h"
#include <stdlib.h>
#include "base/CCDirector.h"
#include "base/CCAsyncTaskPool.h"
#include "base/CCEventDispatcher.h"
#include "base/base64.h"
#include "renderer/CCCustomCommand.h"
#include "renderer/CCRenderer.h"
#include "platform/CCImage.h"
#include "platform/CCFileUtils.h"
#include "2d/... | TOOL | 0.920818 | 6.047307 |
7f36b5b7-474e-4eaf-89d1-06e623398d46 | faisalaffan/creafood | apps/mobile/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.997282 | 6.797273 |
9a5011c0-7bf3-425f-95a8-d073a7de7640 | rituraj0/OtherCompetitions | 209/D.cpp | #include <bits/stdc++.h>
using namespace std;
#define pb push_back
#define mp make_pair
#define sz(s) ((int)(s.size()))
#define bg begin()
#define en end()
#define Y second
#define X first
typedef long long ll;
#define fi freopen("input.txt","r",stdin)
#define fo freopen("output.txt","w",stdout)
const double pi = ... | ALGO | 0.999991 | 3.366057 |
56b70894-1c00-49bf-b01f-2341ae84d05f | zhihudalao/Learning_cpp | 20190221/16_bracket.cpp | #include <iostream>
#include <string>
using namespace std;
class Student
{
public:
void setInfo(int id, string name, float math
, float dance, float music)
{
m_iId = id;
m_strName = name;
m_fMath = math;
m_fDance = dance;
m_fMusic = music;
}
bool operator<(const Student &s) const
{
return totalSc... | ALGO | 0.992505 | 4.335539 |
74f7c38b-44da-4a36-976b-923a14d36211 | qianqing13579/MIGraphX_Dynamic | src/targets/gpu/device/gelu.cpp | #include <migraphx/gpu/device/gelu.hpp>
#include <migraphx/gpu/device/nary.hpp>
#include <migraphx/gpu/device/types.hpp>
#include <cmath>
namespace migraphx {
inline namespace MIGRAPHX_INLINE_NS {
namespace gpu {
namespace device {
// x * 0.5 * (1.0 + erf(x / sqrt(2.0)))
template <class T>
auto gelu_fn(T x) __device_... | ALGO | 0.992015 | 7.078315 |
e72c59e6-9d7c-4780-a97c-f6c44825ca08 | p1unit/ICPC-CheatSheet | Math/totient(nlogn).cpp | ll tot[200005];
void totient(){
ll i,j;tot[1]=1;
for(i=2;i<=200000;i++){
if(tot[i]==0){
tot[i]=i-1;
for(j=i*2;j<=200000;j+=i){
if(tot[j]==0)
tot[j]=j;
tot[j]=(tot[j]/i)*(i-1);
}
}
}} | ALGO | 0.999322 | 3.627143 |
439322ed-184b-44ef-be82-2da8a2ea8d63 | Rupeshkumar4/CPP_DSA | TCS/Panagram2.cpp | #include <iostream>
#include<string>
#include<vector>
using namespace std;
int main(){
string str="";
getline(cin, str);
int n=str.size();
// tolower(str);
transform(str.begin(), str.end(), str.begin(), ::tolower);
vector<int> v(26,0);
for(int i = 0; i <n;i++){
if(isalpha(str[i]))... | ALGO | 0.999914 | 4.210373 |
f9a943e1-e0be-4d0d-a180-4c2de0e67ae1 | pritisatani09/DSA-PROJECT | project3/floyd.cpp | #include <iostream>
using namespace std;
//Develop a program that prints the given Floyd’s triangle pattern using a nested for loop.
int main() {
int start = 11;
int rows = 4;
int num = start;
for (int i = 1; i <= rows; i++) {
for (int j = 1; j <= i; j++) {
cout << num << " ";
... | ALGO | 0.999651 | 4.479463 |
132b73ba-abd2-413d-b74d-caa311ab0a5c | KalachevGleb/data-struct-eval | search_tree/rbtree.cpp | #include "rbtree.h"
#include "commontree.h"
#include <stdio.h>
inline int Min(int x, int y){return x<y ? x : y;}
inline int Max(int x, int y){return x>y ? x : y;}
inline int Abs(int x){return x>=0 ? x : -x;}
RBTBase::RBTBase(){
nil.setL(&nil); nil.setR(&nil); nil.setP(&nil);
nil.setC(BLACK); nil.setNil();
sz=0;
}
... | ALGO | 0.996918 | 3.281831 |
13398cb3-f278-47e8-b51d-817dbdadf8b5 | ThanawatVor/Queue-AjMingmanas211-22-30 | .ccls-cache/@home@runner@Queue-AjMingmanas211-22-30/main.cpp | #include <iostream>
using namespace std;
#include "queue.h"
int main(int argc, char *argv[]) {
Queue q;
int i, price;
int customer=1;
for (i = 1; i < argc; i++) {
if (argv[i][0] == 'x') {
price = q.dequeue();
cout << "Customer no: " << customer++ << endl;
// ask the customer to pa... | ALGO | 0.865582 | 3.799995 |
8f0f8fea-5cf8-4109-aaa5-39a4dfdcc0ba | Feroz455/The-CPP-Standard-Template-Library-STL | STL Algorithm/fill_n.cpp | /*
Cpp_STL_Reference
program fill_n
iterator fill_n(iterator start, size_t n, const TYPE& val);
*/
#include<iostream>
#include<algorithm>
#include<vector>
using namespace std;
//main begin
int main()
{
vector<int> v1;
for(int i= 0; i < 10; i++)
{
v1.push_back(i);
}
cout << "\n\n";
cout ... | TOOL | 0.987701 | 4.07108 |
1760a1be-8d87-4e64-beb0-79cee1357783 | YASICJUNWOO/YASIC_BACKJUN | new_storage/new_storage/2606(바이러스).cpp | #include <iostream>
#include <vector>
using namespace std;
#define Not_Visited 0;
#define Visited 1;
//감염시킨 컴퓨터의 수
int cnt = 0;
//각 컴퓨터의 정보를 저장하는 Computer 클래스
class Computer {
public:
int IsVisited; //방문 여부
int data; //노드 숫자
vector<Computer*> list; //인접한 컴퓨터 저장
Computer(int data) {
IsVisited = 0;
this->data... | ALGO | 0.999495 | 5.001967 |
a39dac98-fd5f-4235-a653-7df8e2081deb | yuki-jinnouchi/atcoder | contests/abc232/B/main.cpp | /**
* author: Jini
* sampled by
* https://gist.github.com/yoshihikosuzuki/bbf67915b0920954eb069be3c49b924d
**/
#include <bits/stdc++.h>
using namespace std;
/* alias */
using ull = unsigned long long;
using ll = long long;
using vi = vector<int>;
using vl = vector<long>;
using vll = vector<long long>;
using vvi ... | ALGO | 0.999999 | 4.177351 |
8a9a57bf-9310-487c-a9a5-e084aa9997fd | Sarvesh2002/IPMP_Tasks_SarveshRajkumar | week_6/Arrays/Arrays_qn3.cpp | #include <iostream>
#include <bits/stdc++.h>
using namespace std;
int main()
{
int a[20];
int i;
int n;
cin>>n;
int sum = 0;
for (i = 0; i < n; i++)
{
cin >> a[i];
sum+=a[i];
}
int b = ((n+1)*(n+2))/2 - sum;
cout<<"Missing Element is "<<b;
} | ALGO | 0.99954 | 3.038615 |
aaa1c230-f140-4385-bf8d-7c8a1f5c4563 | narayandabu/My-Cpp-Code | My_POTD/prdoflastk.cpp | #include <bits/stdc++.h>
using namespace std;
class ProductOfNumbers {
public:
vector<int> nums;
int zero_idx=-1;
ProductOfNumbers(){
nums.push_back(1);
}
void add(int num){
if(num==0){
zero_idx=nums.size()-1;
nums.clear();
nums.push_back(1);
... | ALGO | 0.999935 | 4.524541 |
1d08f00c-4154-4a79-a930-93d030b886cd | tokuma09/algorithm_problems | problems/chapter05/miiitomi/007.cpp | // atcoder Educational DP Contest F - LCS
// https://atcoder.jp/contests/dp/tasks/dp_f
#include <bits/stdc++.h>
using namespace std;
int main() {
string s, t;
cin >> s >> t;
int s_size = s.size();
int t_size = t.size();
vector<vector<int>> dp(s_size+1, vector<int>(t_size+1, 0));
// dp[i][j... | ALGO | 0.999985 | 5.481362 |
e7de9dbf-62a7-400a-99af-71ae28af900f | swathisnayak14/Interview_Prep | Strings/CountandSay.cpp | // Input: n = 4
// Output: "1211"
// Explanation:
// countAndSay(1) = "1"
// countAndSay(2) = say "1" = one 1 = "11"
// countAndSay(3) = say "11" = two 1's = "21"
// countAndSay(4) = say "21" = one 2 + one 1 = "12" + "11" = "1211"
// Input: n = 1
// Output: "1"
// Explanation: This is the base case.
#include <bits/st... | ALGO | 0.999994 | 6.736886 |
e0684b87-8343-49da-9a88-f0ff9bfa7de6 | sarvex/leetcode-odin | solution/2500-2599/2544.Alternating Digit Sum/Solution.cpp | class Solution {
public:
int alternateDigitSum(int n) {
int ans = 0, sign = 1;
for (char c : to_string(n)) {
int x = c - '0';
ans += sign * x;
sign *= -1;
}
return ans;
}
}; | ALGO | 0.999978 | 6.337138 |
aabbf5fe-d523-4e88-a9b1-14306d5e93d5 | Aryan810/programming | learn/learn_cpp/cses/graph_algo/Message_Route.cpp | // #include<atcoder/modint>
#include<bits/stdc++.h>
#include<ext/pb_ds/assoc_container.hpp>
#include<ext/pb_ds/tree_policy.hpp>
// #pragma GCC optimize("Ofast,unroll-loops")
using namespace std;
using namespace __gnu_pbds;
using uint = unsigned int;
using ull = unsigned long long;
using ll = long long;
// using namesp... | ALGO | 0.999984 | 4.507301 |
f8d6e970-9f95-4119-9cb5-4ae20dd2c590 | sunwaylive/proactive-learning-on-scenes | DepthSensing/Include/mLib/meshData.cpp |
#ifndef CORE_MESH_MESHDATA_INL_H_
#define CORE_MESH_MESHDATA_INL_H_
namespace ml {
template<class FloatType>
std::ostream& operator<<(std::ostream& os, const MeshData<FloatType>& meshData) {
os << "MeshData:\n"
<< "\tVertices: " << meshData.m_Vertices.size() << "\n"
<< "\tColors: " << meshData.m_Colors.si... | TOOL | 0.915097 | 4.785103 |
2c818f4a-4115-4900-819f-f093c3b17bc5 | Colderhold/CE-Domain-and-Projects | SEM 2/Patterns/Patterns in C/Pattern 17.cpp | #include <stdio.h>
int main()
{
int i,j,n;
char ch='A';
printf("Enter No of Rows ");
scanf("%d",&n);
for(i=1;i<=n;i++)
{
for(j=1;j<=i;j++)
{
printf("%c ",ch++);
}
printf("\n");
}
return 0;
}
| ALGO | 0.998444 | 3.324055 |
ce60b792-0c4c-4a80-89ef-080351b84765 | zhangfuwen/trea_kernel | lib/string.cpp | #include <stddef.h>
#include "lib/debug.h"
#include "lib/string.h"
// 字符串长度计算
size_t strlen(const char* str)
{
size_t len = 0;
while(str[len])
len++;
if(len >= 0x1000000) {
return 0;
}
return len;
}
// 字符串复制
char* strcpy(char* dest, const char* src)
{
char* d = dest;
while... | TOOL | 0.884483 | 5.403678 |
c2174efe-192a-4019-ab5a-658f44bc3c82 | ssarmin/leetcode_practice | 141-linked-list-cycle.cpp | // https://leetcode.com/problems/linked-list-cycle
/**
* Definition for singly-linked list.
* struct ListNode {
* int val;
* ListNode *next;
* ListNode(int x) : val(x), next(NULL) {}
* };
*/
class Solution {
public:
bool hasCycle(ListNode *head) {
if(!head || !head->next)
retu... | TEST | 0.998333 | 5.489787 |
c0979a64-9439-4e01-988e-82e04119a6ae | johnoneil/mupen64plus-web | boost_1_59_0/libs/circular_buffer/example/circular_buffer_sum_example.cpp | //[circular_buffer_sum_example_1
/*`This example shows several functions, including summing all valid values.
*/
#include <boost/circular_buffer.hpp>
#include <numeric>
#include <assert.h>
int main(int /*argc*/, char* /*argv*/[])
{
// Create a circular buffer of capacity 3.
boost::circular... | TEST | 0.92607 | 6.428323 |
5b1ebfbb-344c-436a-b220-ae72160a1177 | rahuljat1349/DSA-CPP | 78.MinStack.cpp | #include <iostream>
#include <stack>
#include <algorithm>
using namespace std;
// first approach
class minStack
{
public:
stack<pair<int, int>> s;
minStack() {}
void push(int val)
{
if (s.empty())
{
s.push({val, val});
}
else
{
int minVal... | ALGO | 0.999911 | 5.466888 |
98eb5b48-71c5-48b0-ba57-7c02ede99f7f | ishandutta2007/codeforces | hitman623/normal/1181/C.cpp | #include <bits/stdc++.h>
#define int long long
#define pb push_back
#define pii pair<int,int>
#define vi vector<int>
#define vii vector<pii>
#define mi map<int,int>
#define mii map<pii,int>
#define all(a) (a).begin(),(a).end()
#define x first
#d... | ALGO | 0.999975 | 3.964434 |
0f855b49-6b6c-4206-97fe-b434ce232da4 | feedblackg44/kpilabs | Lab3/Lab3/main.cpp | #include <iostream>
#include <math.h>
#include <limits>
#include <locale.h>
#include <iomanip>
#include "feed.h"
using namespace std;
int main()
{
SetDefaults();
double x1, x0;
double e = 0.0001;
cout << "Вычислим корень пятой степени из а с точностью до " << e << "." << endl;
double a = GetDouble("Введите чис... | ALGO | 0.99964 | 3.231955 |
3feb3d68-e6e0-48b5-b05e-b027d0585c0f | RadhikaMulay20/GFG | Easy/Left View of Binary Tree/left-view-of-binary-tree.cpp | //{ Driver Code Starts
#include <bits/stdc++.h>
using namespace std;
// Tree Node
struct Node
{
int data;
Node* left;
Node* right;
};
vector<int> leftView(struct Node *root);
// Utility function to create a new Tree Node
Node* newNode(int val)
{
Node* temp = new Node;
temp->data = val;
temp->... | ALGO | 0.999677 | 6.787546 |
75cfebc1-df32-420e-8f05-33ec9c09280b | suhanikalra/practice-problems | 1995-finding-pairs-with-a-certain-sum/1995-finding-pairs-with-a-certain-sum.cpp | class FindSumPairs {
public:
vector<int> nums1, nums2;
unordered_map<int,int> freq;
FindSumPairs(vector<int>& nums1, vector<int>& nums2) {
this->nums1 = nums1;
this->nums2 = nums2;
for(auto k: nums2){
freq[k]++;
}
}
void add(int index, int val) {
... | ALGO | 0.999903 | 5.93928 |
812c13f8-6312-4558-a090-b9185f4d9745 | santi1475/asistenciaML | backend/entrenamientos opencv ruidos/opencv-master/modules/video/src/tracking/tracker_mil.cpp | #include "../precomp.hpp"
#include "detail/tracker_mil_model.hpp"
#include "detail/tracker_feature_haar.impl.hpp"
namespace cv {
inline namespace tracking {
namespace impl {
using cv::detail::tracking::internal::TrackerFeatureHAAR;
class TrackerMILImpl CV_FINAL : public TrackerMIL
{
public:
TrackerMILImpl(const... | ALGO | 0.998645 | 6.478055 |
7ee8fdfe-8fbf-4ea2-a9d3-a137f607f93a | yuxiangdai/TellORB | Thirdparty/g2o/g2o/core/sparse_optimizer.cpp | #include "sparse_optimizer.h"
#include <iostream>
#include <iomanip>
#include <algorithm>
#include <iterator>
#include <cassert>
#include <algorithm>
#include "estimate_propagator.h"
#include "optimization_algorithm.h"
#include "batch_stats.h"
#include "hyper_graph_action.h"
#include "robust_kernel.h"
#include "../st... | ALGO | 0.999674 | 6.979606 |
d55a8f08-07f2-4d99-bdf6-dbe8b44b1c1f | gagandeepahuja09/Stacks-And-Queues | InterviewBit/LargestRectangleInHistogram.cpp | int Solution::largestRectangleArea(vector<int> &A) {
stack<int> stk;
vector<int> left(A.size(), -1);
vector<int> right(A.size(), A.size());
for(int i = 0; i < A.size(); i++) {
while(!stk.empty() && A[stk.top()] >= A[i]) {
stk.pop();
}
if(!stk.empty()) {
le... | ALGO | 0.999896 | 6.061797 |
2bcf4cc6-78a1-42c7-915c-e792474c0921 | giorzang/CP-Algorithm | Sparse Table/1_dtran_rmq.cpp | #include <bits/stdc++.h>
#ifndef Zang_LOCAL
#define debug(x...) "giORZang"
#else
#define _NTH_ARG(_1, _2, _3, _4, _5, _6, N, ...) N
#define _FE_0(_CALL, ...)
#define _FE_1(_CALL, x) _CALL(x)
#define _FE_2(_CALL, x, ...) _CALL(x) _FE_1(_CALL, __VA_ARGS__)
#define _FE_3(_CALL, x, ...) _CALL(x) _FE_2(_CALL, __VA_ARGS__)
#... | ALGO | 0.999819 | 4.597297 |
b49c2031-b50c-4f04-bd00-a95ab72a3632 | snehasharma76/LEETCODE_STRUGGLE | 2374-node-with-highest-edge-score/2374-node-with-highest-edge-score.cpp |
class Solution {
public:
int edgeScore(vector<int>& edges) {
int n = edges.size();
vector<long long> score(n);
for(int i = 0; i < n; i++){
score[edges[i]] += i;
}
long long max = INT_MIN;
int res = 0;
for(int i = 0; i < n; i++){
if(sco... | ALGO | 0.999864 | 5.464316 |
fce19f1e-7bda-47f9-b193-de9ef1aa9a37 | alemesa/school-projects | 2A. C++ Advanced (STL)/Attic/pq7.cpp | // http://stackoverflow.com/questions/4484767/how-to-iterate-over-a-priority-queue
#include <queue>
#include <cstdlib>
#include <iostream>
using namespace std;
template <class T, class S, class C>
S& Container(priority_queue<T, S, C>& q) {
struct HackedQueue : private priority_queue<T, S, C> {
static S& C... | ALGO | 0.985147 | 4.138507 |
a7b2643d-264e-4a20-bcdd-ad87d2f731db | minhlam2102002/competitive-programming | CSES/4. Graph Algorithms/Planets Queries II.cpp | #include<bits/stdc++.h>
using namespace std;
const int MAXN = 2e5, MAXM = 30;
int n, q;
vector<vector<int>> adj, cycles, revAdj;
vector<int> cycleIdx, visited, pre, height, root, idx;
int parent[MAXN][MAXM];
int cycleCount = 0;
int startCycle, finishCycle;
void dfs(int u) {
visited[u] = 1;
for (int v : adj[u... | ALGO | 0.99997 | 4.542822 |
854307a0-eccd-4575-929e-7c2b904b0534 | ishandutta2007/codeforces | tabr/normal/1434/B.cpp | #include <bits/stdc++.h>
using namespace std;
#ifdef tabr
#include "library/debug.cpp"
#else
#define debug(...)
#endif
int main() {
ios::sync_with_stdio(false);
cin.tie(0);
int n;
cin >> n;
vector<pair<int, int>> p(2 * n);
for (int i = 0; i < 2 * n; i++) {
char c;
cin >> c;
... | ALGO | 0.999985 | 3.467762 |
8886ee20-deeb-4b71-b33e-f300df003caf | ZW628/Shenlan_Planning_Control_Course | 第五章:基于MPC的车辆控制及轨迹规划/MPC实践代码/src/mpc_control/src/mpc_controller.cpp | #include "mpc_controller.h"
#include <algorithm>
#include <iomanip>
#include <utility>
#include <vector>
#include "Eigen/LU"
#include "math.h"
using namespace std;
namespace shenlan {
namespace control {
MPCController::MPCController() {}
MPCController::~MPCController() {}
void MPCController::LoadControlConf() {
... | ALGO | 0.996376 | 4.215879 |
8ae5bb3d-9d5d-401c-a9f8-b70ee42804bc | yulonglong/UVa-Solutions | 12626.cpp | //Steven Kester Yuwono - UVa 12626
#include <bits/stdc++.h>
using namespace std;
int freq[120];
int main(){
//freopen("in.txt","r",stdin);
int tc;
string word;
getline(cin,word);
tc = atoi(word.c_str());
while(tc--){
memset(freq,0,sizeof(freq));
getline(cin,word);
for(int i=0;i<(int)word.length();i++){
... | ALGO | 0.999241 | 4.600357 |
74758d94-f9c4-4f3e-b9f9-2043502cbdc4 | prabodh2/DSA_Lab_Manual | 6th.cpp | #include <iostream>
using namespace std;
const int MAX_SIZE = 100;
class CircularQueue {
private:
int front, rear;
int arr[MAX_SIZE];
public:
CircularQueue() {
front = -1;
rear = -1;
}
bool isEmpty() {
return front == -1;
}
bool isFull() {
return (front == 0 &... | ALGO | 0.99589 | 5.502492 |
d7f9e3dc-e35c-4a9f-bd57-bac1954de4b9 | NonOrdinary/LeetCode-CP-practice | 0049-group-anagrams/0049-group-anagrams.cpp | class Solution {
public:
vector<vector<string>> groupAnagrams(vector<string>& strs) {
map<vector<int>,vector<int>>mp;
for(int i=0;i<strs.size();i++){
vector<int>num(26,0);
for(int j=0;j<strs[i].size();j++){
num[strs[i][j]-'a']++;
}
mp[n... | ALGO | 0.999994 | 6.396442 |
11223798-0383-48c2-bbf6-ede74ee3faa5 | eric7237cire/CodeJam | cjava/src/main/resources/y2008/pracProb/d6.cpp | #include <iostream>
#include <algorithm>
#include <cstring>
#include <cstdlib>
#include <vector>
#include <string>
#include <set>
#include <map>
#include <queue>
#include <cctype>
#include <cmath>
#include <sstream>
#include <cstdio>
#define int64 long long
#define ii pair<int,int>
#define vi vector<int>
#define mp ma... | ALGO | 0.995215 | 3.480087 |
cc6114b1-c021-4aa7-8932-94a37c667a45 | shzaiz/dx-public | notes/notes/intro-oi/demo/graph/P1347.cpp | #include <bits/stdc++.h>
using namespace std;
#define MAXN 100010
struct Edge{
int to,nxt;
}e[MAXN];
int cnt=0,head[MAXN],in[MAXN],inn[MAXN],vis[MAXN],p[MAXN];
void adde(int u,int v){
e[++cnt].to = v;
e[cnt].nxt = head[u];
head[u] = cnt;
}
int n,m;
int sum;
int s;
bool nojudge,v;
queue<int > Q;
int topo(){
v = fa... | ALGO | 0.999975 | 3.610992 |
e9e928df-fb06-420b-889a-fffb5b68a933 | aadarshahebsingh/DSA-Problems-starting-21st-March | B. Sequence Game.cpp | #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<ll> vi;
void solve()
{
int n;
cin>>n;
vi arr;
for(int i=0;i<n;i++){
int x;
cin>>x;
if(i && arr.back()>x)arr.push_back(1);
arr.push_back(x);
}
cout<<arr.size()<<"\n";
for(int x:a... | ALGO | 0.999929 | 3.94701 |
595bf0f3-154a-4c80-ad8b-b51898dfc6e4 | ryenus/vbox | src/VBox/Runtime/generic/semrw-generic.cpp | /* $Id$ */
/** @file
* IPRT - Read-Write Semaphore, Generic.
*
* This is a generic implementation for OSes which don't have
* native RW semaphores.
*/
/*******************************************************************************
* Header Files *
*... | TOOL | 0.889749 | 6.59973 |
c72dba82-c111-4666-9adf-1e281e49d51c | ishandutta2007/codeforces | lawrenceli/normal/212/E.cpp | #include <cstdio>
#include <iostream>
#include <algorithm>
#include <vector>
#include <cstring>
using namespace std;
const int MAXN = 5005;
int n, sub[MAXN];
vector<int> adj[MAXN];
bool good[MAXN], dp[MAXN];
void dfs(int cur, int p) {
sub[cur] = 1;
for (int i=0; i<adj[cur].size(); i++) {
int nxt = a... | ALGO | 0.999885 | 3.86158 |
8b928359-9ecf-47f0-8a5f-4f3b1867328d | rberends/DitpFlutterIntro | 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.998762 | 6.786404 |
cdaa5349-0a2a-4f13-a05f-39b3c256bc05 | sarvex/leetcode-pharo | solution/1400-1499/1429.First Unique Number/Solution.cpp | class FirstUnique {
public:
FirstUnique(vector<int>& nums) {
for (int& v : nums) {
++cnt[v];
q.push_back(v);
}
}
int showFirstUnique() {
while (q.size() && cnt[q.front()] != 1) q.pop_front();
return q.size() ? q.front() : -1;
}
void add(int v... | ALGO | 0.99979 | 6.530463 |
ac0a5ec6-5385-43ee-b42b-6a1b9482c82f | AishPratap/one_hour | hardcore_training/my_compro/01_warm_up/uva/11172.cpp | /*
* Author: Khoi Hoang
*/
#include <bits/stdc++.h>
using namespace std;
#define endl "\n"
int main()
{
ios::sync_with_stdio(false);
//freopen("input.txt", "r", stdin);
//freopen("output.txt", "w", stdout);
int t, a, b;
cin >> t;
while (t--) {
cin >> a >> b;
if (a < b) {
cout << "<" << endl;
} el... | ALGO | 0.999967 | 4.391383 |
751b034c-0999-4f6b-9128-1f75d78f80c7 | leozzmc/Leetcode | STL Practice/template.cpp | # include <iostream>
using namespace std;
//define template
template<typename T>
bool less_than(T a, T b){
return a < b;
}
int main(){
// input the typename into the template,and call the function
cout << less_than<int>(10,20) << "\n";
cout << less_than<string>("Hello", "World") << "\n";
cout << l... | ALGO | 0.998516 | 3.89895 |
7d1bc428-dbc5-4e99-ae02-ce480cb41b4b | Alberto1Artoni/intersection | lib/CGAL-5.5.2/examples/Subdivision_method_3/CatmullClark_subdivision.cpp | #include <CGAL/Simple_cartesian.h>
#include <CGAL/Surface_mesh.h>
#include <CGAL/boost/graph/graph_traits_Surface_mesh.h>
#include <CGAL/subdivision_method_3.h>
#include <CGAL/Timer.h>
#include <boost/lexical_cast.hpp>
#include <iostream>
#include <fstream>
typedef CGAL::Simple_cartesian<double> Kernel;
ty... | ALGO | 0.978984 | 6.281706 |
c23f1bec-821a-4861-b6ca-5804f0b2682d | Rohanpt/CPPClass | DL2_L9_Teredesai.cpp | /*
Author: Rohan Teredesai
Assignment Number: Lab 9
File Name: DL2_L9_Lastname.cpp
Course/Section: COSC 1337 Section 2
Due Date: See syllabus or blackboard
Instructor: Thayer
Purpose: Create/add to a p... | ALGO | 0.999358 | 4.797228 |
8495421b-d1b6-43a0-80ec-4fb109b4f0d2 | Siyao-Lu/Leetcode | c++/array/15_3sum.cpp | // array: leetcode medium (Blind 75 LeetCode Questions)
#include <vector>
#include <set>
#include <algorithm>
using namespace std;
/*
Given an integer array nums, return all the triplets [nums[i], nums[j], nums[k]] such that
i != j, i != k, and j != k, and nums[i] + nums[j] + nums[k] == 0.
Notice that the solution se... | ALGO | 0.999829 | 5.865318 |
64cbeb0f-aff9-4eb0-828e-b61449a99c9e | bitshifter/radixsort | thirdparty/Catch2/src/catch2/reporters/catch_reporter_helpers.cpp | #include <catch2/reporters/catch_reporter_helpers.hpp>
#include <catch2/interfaces/catch_interfaces_config.hpp>
#include <catch2/internal/catch_console_width.hpp>
#include <catch2/internal/catch_errno_guard.hpp>
#include <catch2/internal/catch_textflow.hpp>
#include <catch2/internal/catch_reusable_string_stream.hpp>
#i... | TEST | 0.94174 | 7.926829 |
e9c379c3-f093-468c-af55-b2072011a09a | SpamSlayer/live | src/zerocoin/Params.cpp | /**
* @file Params.cpp
*
* @brief Parameter class for Zerocoin.
*
* @author Ian Miers, Christina Garman and Matthew Green
* @date June 2013
*
* @copyright Copyright 2013 Ian Miers, Christina Garman and Matthew Green
* @license This project is released under the MIT license.
**/
#include "Zeroco... | TOOL | 0.884522 | 6.621742 |
e9344714-b4fd-45af-a63a-ddbe85680a24 | Hissane/Competitive-Programming | ENSIAS IT/Math/CF1-D12-A.cpp | #include<bits/stdc++.h>
using namespace std;
int main(){
double n, m, a;
long long res;
cin >> n >> m >> a;
res = ceil(m/a)*ceil(n/a);
cout << res;
return 0;
} | ALGO | 0.99953 | 3.113401 |
54ddb6a5-5adc-4e0e-a309-68894b14f4f3 | VladyslavUstymenko/cpp | lab15.cpp | /*
Завдання 1
Необхідно описати функцію
(тіло функції) таким чином, щоб функція повертала у програму значення true,
якщо введений рік високосний, або false, якщо введено не високосний рік.
*/
#include <iostream>
using namespace std;
bool isLeap(int year)
{
if ((year % 4 == 0 && year % 100 != 0) || (year % 400 ... | ALGO | 0.996537 | 5.035176 |
b68d0f11-41e8-4112-bf11-0b401cc6d64a | nikhil4u8/Leetcode-solutions | Leetcode Solutions/4. Median of Two Sorted Arrays.cpp | /*
Ques to ask :
- Can array have no elements? What if both array are empty?
- Are both array sorted?
Sol :
=> Merge both array : [TIME - O(N+M*log(N+M) SPACE - O(max(N, M))]
- Merge both array in single array + sort new array + find median and
return it.
=> Two Pointer : [TIME - O(N+M) SPACE - O(... | ALGO | 0.999989 | 6.421045 |
0a500c14-b25f-4fbb-838b-187c644cd263 | nickerso/llvm | lib/IR/Dominators.cpp | #include "llvm/IR/Dominators.h"
#include "llvm/ADT/DepthFirstIterator.h"
#include "llvm/ADT/SmallPtrSet.h"
#include "llvm/ADT/SmallVector.h"
#include "llvm/IR/CFG.h"
#include "llvm/IR/Instructions.h"
#include "llvm/IR/PassManager.h"
#include "llvm/Support/CommandLine.h"
#include "llvm/Support/Compiler.h"
#include "llvm... | TOOL | 0.98191 | 7.869954 |
0ad5e946-4ebb-4c1a-9d58-1057fe309177 | youbeen2798/Programmers-problems | P_전화번호 목록.cpp | #include <string>
#include <vector>
#include <algorithm>
#include <iostream>
using namespace std;
bool solution(vector<string> phone_book) {
bool answer = true;
sort(phone_book.begin(), phone_book.end());
for (int i = 0; i < phone_book.size() - 1; i++) {
int len = phone_book[i].size();
... | ALGO | 0.999886 | 5.098647 |
41dccef6-a9e2-42f1-bfb2-e88b7d3865da | RACHITBADONI/DAA_1 | DAA_RACHIT_BADONI_2016936/Practical/Week_05/Code_3.cpp | //You are given 2 sorted int array of size m and n. find common elements which exist in both.
#include <bits/stdc++.h>
using namespace std;
int main()
{
int n,m;
cin>>n>>m;
vector<int> a(n),b(m);
for(int i=0;i<n;i++)
cin>>a[i];
for(int i=0;i<m;i++)
cin>>b[i];
int x=0,y=0;
ve... | ALGO | 0.999979 | 3.128598 |
fd1be0ef-982f-42ed-ba80-7b8daf814acd | RumRaisins/LeetCode | LeedCode/201~300/237_给一个节点删除它.cpp | #include<iostream>
struct ListNode {
int val;
ListNode *next;
ListNode(int x) : val(x), next(NULL) {}
};
class Solution {
public:
void deleteNode(ListNode* node) {
ListNode* next = node->next;
*node = *next;
delete next;
}
}; | ALGO | 0.999524 | 4.835264 |
5fe639ec-228c-4201-996e-6fdcb8d8b687 | Robbbert/hbmame | src/devices/sound/ymf271.cpp | #include "emu.h"
#include "ymf271.h"
#include <algorithm>
#define STD_CLOCK (16934400)
#define MAXOUT (+32767)
#define MINOUT (-32768)
#define SIN_BITS 10
#define SIN_LEN (1<<SIN_BITS)
#define SIN_MASK (SIN_LEN-1)
#define LFO_LENGTH 256
#define LFO_SHIFT 8
#... | TOOL | 0.985608 | 4.019274 |
566e6a60-f7b7-433e-9d2a-ee922d0f677f | sy2es94098/ITSA | itsa/67_1.cpp | #include<iostream>
#include<cstdlib>
using namespace std;
int main(){
int i, j, k, big, end = 0, num = 0, num2 = 0, right, data[4] = {0}, repeat[4] = {0}, sum[4] = {0} ;
for( i = 0 ; i < 4 ; i++ )
cin >> data[i];
for( i = 0 ; i < 3 ; i++ )
{
for( j = i + 1 ; j < 4 ; j++ )
{
... | ALGO | 0.999904 | 3.081081 |
20a12b77-7f62-477a-9f06-f4ec1e57d10e | aramakr7/Delaunay | Edge.cpp |
#include "Edge.h"
#include "Vertex.h"
#include "easylogging++.h"
bool operator==(const Vertex& l, const Vertex& r)
{
return (l.x == r.x && l.y == r.y);
}
bool operator==(const Edge& l, const Edge& r)
{
return (l.origin == r.origin && l.dest == r.dest) || (l.origin == r.dest && l.dest == r.origin);
}
bool op... | ALGO | 0.872437 | 4.974859 |
d436f7cb-6b1b-44a7-baf0-e2f62c0d17f1 | WangYiyao/leetcode-viana | 位操作/137 数组中元素都出现3次只有一个出现1次.cpp | #include<stdio.h>
#include<list>
#include<iostream>
#include<vector>
#include<algorithm>
#include<cstdlib>
#include<unordered_map>
#include <fstream>
#include<string>
#include<list>
using namespace std;
/**************** Runtime: 128 ms *****************/
int singleNumber(vector<int> A) {
int one,two,three;
... | ALGO | 0.999658 | 4.108562 |
f45aaaa8-6114-458c-a7dc-d229c4faaf12 | cranycrane/IMS-exam-prep | algo/rk2-fifinas.cpp | /**
* Runge Kutta 2nd order
* k1 = f(t, y(t))
* k2 = f(t + 0.75h, y(t) + 0.75 * h * t)
* y(t + h) = y(t) + h * (0.33 * k1 + 0.67 * k2)
*
* Source: https://www.youtube.com/watch?v=OAD8-GjuVC8&t=5880s (Fifinas)
*
* Compare with
* https://www.fit.vut.cz/person/peringer/public/IMS/priklady/rk4-test.c.html
*... | ALGO | 0.999992 | 6.249679 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.