uuid string | repo_name string | relative_path string | content string | category string | algo_rel_score float64 | quality_score float64 |
|---|---|---|---|---|---|---|
6daf4251-7adb-44b2-9d76-16e0f030755d | celestebarnaby/ImageEye | eusolver/thirdparty/z3/src/smt/smt_case_split_queue.cpp | #include"smt_context.h"
#include"smt_case_split_queue.h"
#include"warning.h"
#include"stopwatch.h"
#include"for_each_expr.h"
#include"ast_pp.h"
namespace smt {
struct bool_var_act_lt {
svector<double> const & m_activity;
bool_var_act_lt(svector<double> const & a):m_activity(a) {}
bool oper... | ALGO | 0.998855 | 6.146399 |
bf09d679-e989-4c0b-a4d0-c18bb0de8839 | marwan-abdellah/OpenCV-2.4.0 | modules/legacy/src/decomppoly.cpp | #include "precomp.hpp"
#if 0
#include <malloc.h>
//#include "decomppoly.h"
#define ZERO_CLOSE 0.00001f
#define ONE_CLOSE 0.99999f
#define CHECK_COLLINEARITY(vec1_x,vec1_y,vec2_x,vec2_y) \
if( vec1_x == 0 ) { \
if( vec1_y * vec2_y > 0 ) { \
... | ALGO | 0.999744 | 3.730525 |
c1a14642-511d-4ee0-b408-94db914fcb92 | Pluto034/CMU-LAB | src/storage/index/b_plus_tree.cpp | #include <sstream>
#include <string>
#include "common/exception.h"
#include "common/logger.h"
#include "common/rid.h"
#include "storage/index/b_plus_tree.h"
namespace bustub {
INDEX_TEMPLATE_ARGUMENTS
BPLUSTREE_TYPE::BPlusTree(std::string name, page_id_t header_page_id, BufferPoolManager *buffer_pool_manager,
... | TOOL | 0.952372 | 5.523419 |
91526226-d7a8-488e-a979-312c3341a984 | daffayassarahmad/Prak-Alpro | 4523210032_DaffaYassarAhmad_Prak08_Array/P08-22.cpp | #include <iostream>
using namespace std;
int main()
{
int Nilai[4][4];
int d,y;
cout<<"Program Ordo 4x4 Menggunakan Inputan"<<endl;
cout<<"------------------------------------"<<endl;
cout<<endl;
for(d=0;d<4;d++)
{
for(y=0;y<4;y++)
{
cout<<"Masukkan Isi Elemen ["<<d+1<<"]["<<y+1<<"] : ";
cin>>Nilai[d][y... | ALGO | 0.893619 | 3.352668 |
a5ce06f7-f3d1-4b26-9a52-bdfe5d7d6116 | AmanRajSinghMourya/Codeforces_Solutions | B_Kana_and_Dragon_Quest_game.cpp | #include <bits/stdc++.h>
using namespace std;
#define gc getchar_unlocked
#define fo(i, n) for (i = 0; i < n; i++)
#define Fo(i, k, n) for (i = k; k < n ? i < n : i > n; k < n ? i += 1 : i -= 1)
#define ll long long
#define deb(x) cout << #x << "=" << x << endl
#define pb push_back
#define mp make_pair
#define F first
... | ALGO | 0.999775 | 3.868023 |
11d44265-c65d-49c2-9255-5eacc06000a9 | lavishabhambri/Weekly-Algo-Newsletter | Number Theory/Codes/Prime Numbers/checkIfPrimeOrNot_naiveApproach.cpp | // A school method based C++ program to
// check if a number is prime
#include <bits/stdc++.h>
using namespace std;
// function check whether a number
// is prime or not
bool isPrime(int n)
{
// Corner case
if (n <= 1)
return false;
// Check from 2 to square root of n
for (int i = 2; i <= sqrt(n); i++)
if (n ... | ALGO | 0.999529 | 4.290484 |
85fb8fa8-08f0-4d1e-85b4-414d3c43a573 | AshishKumar555/apanaCollegeDSA | 06_BinaryNumberSystem/1decimalToBinary.cpp | #include<iostream>
using namespace std;
int dicimalToBinary(int num){
int ans=0;
int pow=1;
while(num>0){
int rem=num%2;
num=num/2;
ans=ans+(rem*pow);
pow=pow*10;
}
return ans;
}
int main(){
int number=453;
cout<<dicimalToBinary(number)<<endl;
return 0;
} | ALGO | 0.999827 | 5.211389 |
e2d065c0-3f51-4625-8e62-cb171219b37d | ShubhikaBhardwaj/Leetcode-Coding | prims2.cpp | //prim's
#include<iostream>
#include<vector>
#include<queue>
using namespace std;
class Edge
{ public:
int v;
int w;
public:
Edge(int v,int w)
{
this->v=v;
this->w=w;
}
};
void display(vector<vector<Edge>>&graph)
{
for(int i=0;i<graph.size();i++)
{
cout<<i<<"->... | ALGO | 0.999903 | 4.822583 |
aa69ca44-ee61-4219-a3ea-53bf1bc68acf | aykut-bozkurt/Algos | dynamic-programming/score-ways.cpp | #include "score-ways.h"
#include <cinttypes>
int score_ways(const std::vector<int>& scores, const int score){
int sol[score+1] = {0};
sol[0] = 1;
// for each step score
for(auto& step_score : scores){
// for each possible score
for(std::size_t i = 1; i <= score; i++){
if(s... | ALGO | 0.999287 | 5.07879 |
21cef47a-04c9-441c-b5da-3dc2749c1233 | arm/arm-toolchain | llvm/tools/llvm-dwarfutil/llvm-dwarfutil.cpp | #include "DebugInfoLinker.h"
#include "Error.h"
#include "Options.h"
#include "llvm/DebugInfo/DWARF/DWARFContext.h"
#include "llvm/DebugInfo/DWARF/DWARFVerifier.h"
#include "llvm/MC/MCTargetOptionsCommandFlags.h"
#include "llvm/ObjCopy/CommonConfig.h"
#include "llvm/ObjCopy/ConfigManager.h"
#include "llvm/ObjCopy/ObjCo... | TOOL | 0.978912 | 6.462888 |
d8afc35c-faec-4389-bcd8-43f289eb9cda | JY1Lnz/Contests | 西南民族大学第十届校赛(同步赛)/L.cpp | #include<bits/stdc++.h>
#define LL long long
using namespace std;
const int MAXN = 1e6+10;
const int MOD = 10000019;
int n;
int a[3][4];
int main()
{
int t;
int op,a,b,c,d;
int fenzi,fenmu;
scanf("%d",&t);
while(t--)
{
scanf("%d%d%d%d%d",&op,&a,&b,&c,&d);
fenmu = b*d;
if... | ALGO | 0.999542 | 4.200686 |
b0fc2340-14aa-4264-b0ef-a0c37cde6698 | tmadeira/desafios | 11-05/c.cpp | #include <bits/stdc++.h>
using namespace std;
#define NMAX 128
int a, b;
vector <int> Ea[NMAX];
int Ma[NMAX], Mb[NMAX];
int U[NMAX], V[NMAX];
int tem_aumento(int u) {
U[u] = 1;
for (int i = 0; i < Ea[u].size(); i++) {
int v = Ea[u][i];
if (!V[v]) {
V[v] = 1;
if (Mb[v] == -1 || tem_aumento(M... | ALGO | 0.9999 | 3.450103 |
7458f4d0-5252-43de-bc23-08c327c7d7fe | asdf77616385/ceph-12.2.1 | src/boost/libs/hana/example/misc/infinite_set.cpp | #include <boost/hana/and.hpp>
#include <boost/hana/any_of.hpp>
#include <boost/hana/flatten.hpp>
#include <boost/hana/functional/compose.hpp>
#include <boost/hana/functional/partial.hpp>
#include <boost/hana/fwd/ap.hpp>
#include <boost/hana/fwd/equal.hpp>
#include <boost/hana/fwd/find_if.hpp>
#include <boost/hana/fwd/l... | ALGO | 0.94219 | 5.447019 |
8ef0b150-830c-451f-ae79-99046e9d3882 | RiMe-13/ps | baekjoon/11660.cpp | #include <iostream>
#include <vector>
#include <queue>
using namespace std;
int arr[1025][1025];
int sum[1025][1025]; //sum[i][j] : (1, 1)에서 (i, j)까지의 합
int main() {
ios::sync_with_stdio(false);
cin.tie(NULL);
int n, m;
cin >> n >> m;
for (int i = 1; i <= n; i++) {
int tmp_sum = 0;
for (int j = 1; j <= n;... | ALGO | 0.999876 | 3.834596 |
5e1ced97-4be0-41e9-8945-04e22be0a0ad | SuseelKumarG/cpsolns | A_LRC_and_VIP.cpp | #include <bits/stdc++.h>
using namespace std;
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
#define ordered_set tree<int, null_type,less<int>, rb_tree_tag,tree_order_statistics_node_update>
#define int long long
typedef long long ll;
typedef pair<int, int> p... | ALGO | 0.999911 | 3.729642 |
18931bc7-b0d2-4fab-9846-d6044ae837c3 | ishandutta2007/codeforces | akulyat/normal/1475/E.cpp | #include <bits/stdc++.h>
#pragma GCC optimize ("O3", "unroll-all-loops")
#pragma GCC target ("sse4.2")
using namespace std;
#define F first
#define S second
typedef long long ll;
typedef long double ld;
typedef pair<ll, ll> pll;
typedef pair<int, int> pii;
ifstream in;
ofstream out;
const long long kk... | ALGO | 0.99995 | 4.158492 |
368715e1-a5a7-4145-a49d-30a45ba94249 | joker-eph/llvm-project-with-mlir | llvm/lib/CodeGen/PrologEpilogInserter.cpp | #include "llvm/ADT/ArrayRef.h"
#include "llvm/ADT/BitVector.h"
#include "llvm/ADT/DepthFirstIterator.h"
#include "llvm/ADT/STLExtras.h"
#include "llvm/ADT/SetVector.h"
#include "llvm/ADT/SmallPtrSet.h"
#include "llvm/ADT/SmallSet.h"
#include "llvm/ADT/SmallVector.h"
#include "llvm/ADT/Statistic.h"
#include "llvm/Analys... | TOOL | 0.875418 | 7.929697 |
16edab7c-ceeb-4b14-a31d-139a57f28b74 | Kim-jeongmin/algorithm_problem_solved | 최소 스패닝 트리/분리 집합/1976.cpp | #include <bits/stdc++.h>
using namespace std;
int parent[201];
int find_parent(int x){
if(x == parent[x]) return x;
else return parent[x] = find_parent(parent[x]);
}
void unionVertex(int u, int v){
u = find_parent(u);
v = find_parent(v);
if(u == v) return;
else parent[u] = v;
}
int main(){... | ALGO | 0.999994 | 4.722484 |
0853d138-80d2-4cc0-9046-90bc3f434f87 | abdelqayyim/C-Tic-Tac-Toe | build-mac/Boost/libs/sort/example/int64.cpp | // See http://www.boost.org/libs/sort for library home page.
#include <boost/sort/spreadsort/spreadsort.hpp>
#include <time.h>
#include <stdio.h>
#include <stdlib.h>
#include <algorithm>
#include <vector>
#include <string>
#include <fstream>
#include <sstream>
#include <iostream>
using namespace boost::sort::spreadso... | ALGO | 0.986173 | 4.607142 |
16753fbe-f55b-4b25-9da3-e00ed29b3f4c | kkmw0/Baekjoon-Online-Judge | Greedy/1758.cpp | #include <iostream>
#include <algorithm>
using namespace std;
int n;
int arr[100001];
bool cmp(int a, int b){
return a > b;
}
int main(void){
ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
cin >> n;
for(int i = 0; i < n; i++) cin >> arr[i];
sort(arr, arr + n, cmp);
long long result = 0;
... | ALGO | 0.99988 | 3.989713 |
49115acc-fa82-43f2-a149-b2030197530a | GoatzRul/TITHE | src/CryptoNoteCore/TransactionUtils.cpp | #include "TransactionUtils.h"
#include <unordered_set>
#include "crypto/crypto.h"
#include "CryptoNoteCore/Account.h"
#include "CryptoNoteFormatUtils.h"
#include "Common/TransactionExtra.h"
using namespace Crypto;
namespace CryptoNote {
bool checkInputsKeyimagesDiff(const CryptoNote::TransactionPrefix& tx) {
std... | ALGO | 0.872168 | 6.963338 |
83be9770-58e8-4e0d-91d8-88e670df33fd | biteosorg/BitEOS | libraries/wasm-jit/Source/Platform/Windows.cpp | #if _WIN32
#include "Inline/BasicTypes.h"
#include "Inline/Errors.h"
#include "Platform.h"
#include <inttypes.h>
#include <algorithm>
#include <Windows.h>
#include <DbgHelp.h>
#undef min
namespace Platform
{
static Uptr internalGetPreferredVirtualPageSizeLog2()
{
SYSTEM_INFO systemInfo;
GetSystemInfo(&systemI... | TOOL | 0.958589 | 7.121377 |
aa20594e-e0a8-49b9-80a8-f219f295559f | harshitgupta2019/khatarnakcoder | codeforces/676C-Vasya and Strings.cpp | #include <bits/stdc++.h>
using namespace std;
#define ll long long
ll n,m;
string s;
ll check(char x)
{
ll i,j=0,cnt=0,ans=0;
for(i=0; i<n; i++)
{
if(s[i]==x)
cnt++;
if(cnt>m)
{
while(cnt>m)
{
if(s[j++]==x)
cnt--... | ALGO | 0.999916 | 4.392754 |
7a873f73-821d-4ddb-9deb-730d90a85309 | ThiagoFBastos/programacao-competitiva | beecrowd/1856 - A Lista da Morte de Arya.cpp | #include "bits/stdc++.h"
using namespace std;
using i64 = long long;
using u64 = unsigned long long;
using i32 = int;
using u32 = unsigned;
using i16 = short;
using u16 = unsigned short;
using ld = long double;
using ii = pair<int, int>;
struct my_struct {
char type;
int a, av;
int b, bv;
int p, pv;
int e, ev;... | ALGO | 0.99953 | 4.439769 |
1695ae2d-ad17-4bdc-b44d-d2bd0aa85ba6 | SaxenaBhoomika/DSA_Sheet_By_Arsh | Day13/maxPointsObtainFromCards.cpp | class Solution {
public:
int maxScore(vector<int>& cardPoints, int k) {
int maxi=INT_MIN;
int n=cardPoints.size();
int l=0,r=n-1;
int sum=0;
for(int i=0;i<k;i++){
sum+=cardPoints[i];
maxi=max(maxi,sum);
}
if(k==n){
return ma... | ALGO | 0.999886 | 5.871721 |
409b41a0-9228-42b2-a07e-cc423fee9bfa | zhumingxuan2013/learning | 洛谷作业/P1134 [USACO3.2] 阶乘问题.cpp | #include <cstdio>
using namespace std;
int n,ans=1;
int a[4]= {6,8,4,2};
int main() {
scanf("%d",&n);
while (n>0) {
for (int i=1; i<=n%10;++i)
if (i!=5) ans=ans*i%10;
n=n/5;
ans=ans*a[n%4]%10;
}
printf("%d",ans);
return 0;
} | ALGO | 0.99997 | 3.626318 |
8ca5e606-28cd-452b-9cb7-52156b3f91dc | Mdsaddam0786/DSA | practice/day1.cpp | #include<iostream>
#include<bits/stdc++.h>
using namespace std;
private:
int missingNum(vector<int>&arr, int n){
for(int i=0; i<n; i++){
if(arr[i]+1!=arr[i+1]){
return arr[i]+1;
}
}
return -1;
}
public:
int repeatedNum(vector<int> arr, in... | ALGO | 0.999929 | 4.521354 |
2ee9268a-ae1c-4374-8cbd-cdde9bb0a2db | munish0838/SdeSheetChallenge | max_subarray_sum.cpp | #include <bits/stdc++.h>
long long maxSubarraySum(int arr[], int n)
{
/*
Don't write main().
Don't read input, it is passed as function argument.
No need to print anything.
Taking input and printing output is handled automatically.
*/
long long int msf = arr[0];
long... | ALGO | 0.99988 | 5.314666 |
f4d773cb-b52c-441d-ba82-f10c5b313bca | 90182si/cocosStudy | cocos2d/cocos/base/CCConsole.cpp | #include "base/CCConsole.h"
#include <thread>
#include <algorithm>
#include <functional>
#include <cctype>
#include <locale>
#include <sstream>
#include <stdio.h>
#include <stdlib.h>
#include <time.h>
#include <fcntl.h>
#if defined(_MSC_VER) || defined(__MINGW32__)
#include <io.h>
#include <WS2tcpip.h>
#include <Wins... | TOOL | 0.961738 | 5.51721 |
71756370-9337-4e74-b287-0658cb8df3a2 | script-beast/DSA_CPP | PlatformQuestions/CodeChef/Starters 90/THREEAPFREE.cpp | #include <bits/stdc++.h>
using namespace std;
#define ll long long
#define f0inc(n) for (int i{0}; i < n; i++)
#define fauto(m) for (auto i : m)
typedef vector<ll> llvec;
typedef unordered_map<ll, ll> lluomp;
typedef unordered_set<ll> lluos;
#define tc \
ll t{0}; \
cin >> t; \
while (t--)
bool isapfre... | ALGO | 0.999788 | 4.736128 |
68bd9365-e9a5-498a-93bf-91e3bd3dd66f | Anmol-Sri/Competitive-Environment | Codeforces Practice/534D.cpp | #include <bits/stdc++.h>
#define ll long long int
#define debug(x) cout << (#x) << " = " << x << endl;
#define ld long double
#define mem(a,b) memset(a, b, sizeof a)
#define debug2(i,j) cout << (#i) << "=" << i << " , " << (#j) << "=" << j << endl;
#define all(x) x.begin(), x.end()
using namespace std;
ll power(ll n,l... | ALGO | 0.99994 | 3.794459 |
83b3642b-0f35-4908-bf78-6a1253a389cb | edge555/Online-Judge-Solves | LeetCode/1737. Change Minimum Characters to Satisfy One of Three Conditions.cpp | class Solution {
public:
int getmin(string &a){
unordered_map<char,int>mp;
for(auto c:a){
mp[c]++;
}
int mx=0;
for(auto it:mp){
mx=max(mx,it.second);
}
return a.size()-mx;
}
int cond3(string &a,string &b){
return getmin(... | ALGO | 0.999984 | 5.540714 |
4e8e81cf-d252-4730-b75d-e740efaddda4 | ashikurrahmanbhuiyan/codeforces | 820-div3/C.cpp | #include <bits/stdc++.h>
using namespace std;
#define el "\n"
#define in(a) int a; cin >> a;
#define int long long int
#define vi vector<int>
#define gcd(a,b) __gcd(a,b)
#define lcm(a,b) (a*b)/__gcd(a,b)
#define rep for (int i = 0... | ALGO | 0.999915 | 3.409921 |
f7c32406-7286-4c59-997d-adef2282b094 | rocmarchive/HCC_syscall | tests/Unit/AmpMath/amp_math_ceil.cpp | // RUN: %cxxamp %s -o %t.out && %t.out
#include <amp.h>
#include <stdlib.h>
#include <iostream>
#include <amp_math.h>
using namespace concurrency;
int main(void) {
const int vecSize = 1000;
// Alloc & init input data
extent<1> e(vecSize);
array<float, 1> a(vecSize);
array<float, 1> b(vecSize);
array<floa... | TEST | 0.949919 | 4.451057 |
d8829594-b971-4cf6-b538-7c04a5630265 | andyluo03/problem-solving | official/edu145/A.cpp | #include <bits/stdc++.h>
#define set_io ios_base::sync_with_stdio(false); cin.tie(NULL);
#define forn(n) for(int i = 0; i < n; i++)
#define endl "\n"
typedef long long ll;
using namespace std;
template<class T>
void pvec(vector<T> v){for(auto a : v) cout << a << " ";}
const int MOD = int(1e9) + 7;
const int MAXN = 11... | ALGO | 0.998357 | 4.564501 |
46464d95-de23-49f2-8c2a-e1e049ddb4fa | Kemal321/Cpp-learncppcom | Exercises/Exercism C++/Luhn Algorithm/luhnAlgorithm.cpp | #include "luhn.h"
#include <string>
#include <cstring>
namespace luhn {
bool nonAscii(std::string cardNumber) {
std::string nonWhiteSpacedString{};
for (int i{ 0 }; i < static_cast<int>(cardNumber.length()); ++i)
{
if (!isspace(cardNumber[i]))
nonWhiteSpacedString... | TOOL | 0.946015 | 6.005823 |
3a1c01b4-d475-4524-b4b3-06785ac2af1b | Deluze/qpang-essence-emulator | src/essence.core/core/communication/encryption/Blowfish.cpp | #include "Blowfish.hpp"
#include <cstring>
#include <algorithm>
#include <random>
#if !defined(__LITTLE_ENDIAN__) and !defined(__BIG_ENDIAN__)
#define __LITTLE_ENDIAN__
#endif
namespace {
union Converter32 {
uint32_t bit_32;
struct {
#ifdef __LITTLE_ENDIAN__
uint8_t byte3;
uint8_t byte2;
uint8_t byte... | ALGO | 0.997363 | 5.432448 |
9a6e78a1-768c-4ceb-b6c1-a0efb1d4d1d8 | NatanGarcias/Competitive-Programming | Codeforces/Others_Contest/1139B.cpp | #include<bits/stdc++.h>
using namespace std;
template<typename T> ostream& operator<<(ostream &os, const vector<T> &v) { os << "{"; for (typename vector<T>::const_iterator vi = v.begin(); vi != v.end(); ++vi) { if (vi != v.begin()) os << ", "; os << *vi; } os << "}"; return os; }
template<typename A, typename B> ostre... | ALGO | 0.999968 | 3.684355 |
18e921b0-3411-4b76-9385-b5ffce2656cf | ayanamizuta/cpro | atcoder/dwango6/d.cpp | #include "bits/stdc++.h"
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(a) (a).begin(),(a).end()
#define LL long long
int n;
int a[100000];
int main(){
cin>>n;
if(n==2){cout<<-1<<endl;return 0;}
REP(i,n)cin>>a[i];
return 0;
}
| ALGO | 0.999341 | 3.1737 |
24796ef5-7295-4535-9b42-12c38ea32b34 | YCmove/OJ-Challenge | Biologist_codefores/Biologist_o2.cpp | #include <bits/stdc++.h>
//#define int long long
using namespace std;
const int inf = 0x3f3f3f3f;
const int N = 2e4 + 10, M = 1e6 + 10;
int n, m, s, t, g, h[N], v[N], val[N], a[N], res;
int head[N], nex[M], to[M], w[M], tot = 1;
inline void ade(int a, int b, int c) {
to[++tot] = b;
nex[tot] = head[a];
w[tot... | ALGO | 0.999744 | 3.675618 |
7d001622-20b3-4dea-9407-d58adb0839ea | Hy1ex/vance-src | mathlib/ssenoise.cpp | #include <math.h>
#include <float.h> // Needed for FLT_EPSILON
#include "basetypes.h"
#include <memory.h>
#include "tier0/dbg.h"
#include "mathlib/mathlib.h"
#include "mathlib/vector.h"
#include "mathlib/ssemath.h"
// memdbgon must be the last include file in a .cpp file!!!
#include "tier0/memdbgon.h"
#include "noised... | ALGO | 0.998706 | 5.498374 |
9fe3b19a-b79f-40d9-a574-edfd49788c04 | sebastianagv/Roboboat | Roberto-2017/ComputerVisionPython/opencv-master/apps/createsamples/utility.cpp | #include <cstring>
#include <ctime>
#include <sys/stat.h>
#include <sys/types.h>
#ifdef _WIN32
#include <direct.h>
#endif /* _WIN32 */
#include "utility.hpp"
#include "opencv2/core.hpp"
#include "opencv2/core/core_c.h"
#include "opencv2/imgcodecs/imgcodecs_c.h"
#include "opencv2/imgproc/imgproc_c.h"
#include "opencv2... | TOOL | 0.998526 | 4.720349 |
75890148-acfb-4f75-a389-46cdcebff333 | rajnishgeek/DSandAlgorithmPracticeSolution | Strings/Simplify Path.cpp | string simplifyPath(string path)
{
stack<string> st;
string result;
boost::split(result, input, boost::is_any_of("/"));
for (string dir : result)
{
if (dir.compare("..") == 0 && !st.empty())
st.pop();
else if (!(dir.compare("..") == 0 || dir.compare(".") == 0 || dir.compa... | ALGO | 0.992107 | 4.719882 |
5ae6bede-8406-4fde-b2d4-82b8dde857d4 | elguneminov/E-Olymp-2 | 0023.cpp | #include <bits/stdc++.h>
using namespace std;
int main() {
unsigned long long n, k, result;
cin >> n >> k;
if(n == 1)
cout << k;
else if(k == 1 || ((n % 2 == 1) && (k == 2)))
cout << "-1";
else if((k == 2) && (n % 2 == 0))
cout << "2";
else if(n == 2)
cout << k * (k-1);
else {
result = k * pow(k-1, n-... | ALGO | 0.999957 | 3.833983 |
9f578590-62ce-4b1d-b16f-29ad7efb91a0 | bowenqiang/leetcode-cpp | Design Twitter.cpp | class Twitter {
public:
/** Initialize your data structure here. */
Twitter() {
}
/** Compose a new tweet. */
void postTweet(int userId, int tweetId) {
pair<int,int> msg(userId,tweetId);
messages.push_back(msg);
}
/** Retrieve the 10 most recent tweet ids i... | ALGO | 0.999001 | 6.191705 |
25e814ea-cc80-4fe6-aeca-26d58e4c205e | AkarshWalia/problems-solved | 1470-shuffle-the-array/1470-shuffle-the-array.cpp | class Solution {
public:
vector<int> shuffle(vector<int>& nums, int n) {
int len = nums.size();
for(int i = n; i < nums.size(); i++) {
nums[i] = (nums[i] * 1024) + nums[i - n];
}
int index = 0;
for(int i = n; i < nums.size(); i++, index += 2)... | ALGO | 0.999896 | 5.785461 |
2283b416-5e0e-45bc-91fb-02b5aa9279b3 | AnisyaHamidah/Tugas_Pertemuan9 | latihan2/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.997834 | 6.785645 |
95233529-a11f-4cd9-a316-ba103029a1fe | hack-parthsharma/LeetCode | 1140-stone-game-ii/1140-stone-game-ii.cpp | class Solution {
public:
int stoneGameII(vector<int>& piles) {
const int n = piles.size();
dp.resize(n, vector<int>(n));
suffixSum = piles;
for (int i = n - 2; i >= 0; --i)
suffixSum[i] += suffixSum[i + 1];
return stoneGameII(0, 1);
}
private:
vector<vector<int>> dp;
vector<int> su... | ALGO | 0.999856 | 5.426471 |
b92b62b7-54ba-4144-9571-932f184b71bc | hanwool26/solve_codetest | SWExpertAcademy/tetris(5656).cpp | #include <iostream>
#include <queue>
#include <vector>
#include <string.h>
using namespace std;
int N, W, H;
int answer = 0;
int dir_x[] = { -1, 1, 0, 0 };
int dir_y[] = { 0, 0, -1, 1 };
queue<pair<int, int>> q;
void print_map(int(*temp)[20]) {
for (int i = 0; i < H; i++) {
for (int j = 0; j < W; j++) {
cout <... | ALGO | 0.999718 | 3.951388 |
4cdbd0e7-4743-4e5a-8866-1e1bba35d479 | tofujlg/flutter_application_1 | 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.998756 | 6.772262 |
5272d8bd-d144-468b-94d2-ef0e34773291 | KiranMMorpalle/Beginners-Code | Basic/SwapNo3.cpp | #include <iostream>
using namespace std;
int main(){
int num1=10, num2=30;
cout<<"Before swap : Num1 : "<<num1<<" num2 : "<<num2<<endl;
num1=num1+num2;
num2=num1-num2;
num1=num1-num2;
cout<<"After swap : Num1 : "<<num1<<" num2 : "<<num2;
return 0;
} | ALGO | 0.990728 | 4.028972 |
848385d9-bae7-4e02-9899-d5533f4a525d | ishandutta2007/codeforces | rns_mhb/normal/1133/A.cpp | #include<bits/stdc++.h>
using namespace std;
int main() {
int h1, m1, h2, m2;
scanf("%d:%d", &h1, &m1);
scanf("%d:%d", &h2, &m2);
int h = h1 + h2 >> 1, m = m1 + m2 >> 1;
if(h1 + h2 & 1) m += 30;
h += m / 60, m %= 60;
printf("%02d:%02d\n", h, m);
} | ALGO | 0.999752 | 4.42819 |
7989c1d7-e5b6-468e-84f6-40a21ef2a067 | ltaamlee/DSA-Data-Structures-Algorithms | PROJECT FINAL/RPN.cpp | #include <iostream>
#include <stack>
#include <string>
#include <math.h>
#include <sstream>
using namespace std;
bool isOperator(char o){
return (o == '+' || o == '-' || o == '*' || o == '/' || o == '^');
}
bool isValidChar(char c){
return (isdigit(c) || isOperator(c) || c == '(' || c == ')' || c == ' ' || c ==... | ALGO | 0.999864 | 3.667466 |
3ec6c2cf-3108-47c0-b4c0-754625ef2a06 | KhoiBui16/Fullhouse_Code_Online | DSA/Contest/10_LyThuyetDoThi/Bai_13/DemThanhPhanLienThong.cpp | #include <bits/stdc++.h>
using namespace std;
int n, m;
vector<vector<int>> adjList;
vector<int> visited;
void DFS(int u)
{
visited[u] = 1;
for (int v : adjList[u])
if (visited[v] == 0)
DFS(v);
}
int countComponents()
{
int cnt = 0;
for (int i = 1; i <= n; i++)
{
if (v... | ALGO | 0.999893 | 5.68994 |
1a9b7356-fb87-4b2e-81d0-9735bc6cada3 | imtiaz1710/competitive-programming | Vjudge/LightOJ/1043/24306460_AC_1ms_2084kB.cpp | #include <bits/stdc++.h>
#define ll long long
#define fin freopen("in.txt", "r", stdin)
#define fout freopen("out.txt","w", stdout)
#define dbg(x) cerr << #x << ": " << x << endl
#define fastio ios::sync_with_stdio (false); cin.tie (0);
using namespace std;
double areax(double ad,double ab,double abc)
{
ad=ad*ad;
... | ALGO | 0.999592 | 3.469351 |
b7aed60f-dc5e-410e-9364-8ffb1954d2e0 | shivangstreak/comp | Practise/Spoj/Foxlings2.cpp | #include<bits/stdc++.h> // Find out the connected Components
using namespace std;
map<int,vector<int>>graph;
map<int,bool>vis;
set<int>Set;
void dfs(int i){
stack<int>s;
s.push(i);
while(!s.empty()){
int t=s.top();s.pop();
if(vis[t]==true){
continue;
}
vis[t]=true;
int y=graph[t].size();
for(int j=0;j... | ALGO | 0.99962 | 4.589883 |
c5d6918a-e997-4c14-9290-f3312ed2e8f9 | Abd-Wahed/linkedLIst | insert_head.cpp | #include <bits/stdc++.h>
using namespace std;
class node
{
public:
int val;
node *next;
node(int val)
{
this->val = val;
this->next = NULL;
}
};
void insert_head(node* &head, int val)
{
node* newnode = new node(val);
newnode->next = head;
head = newnode;
}
void print... | ALGO | 0.998697 | 4.264616 |
16968f6a-4dba-4670-ab19-5c37eb339069 | maxpilipovic/LEETCODE | 0078-subsets/0078-subsets.cpp | class Solution {
public:
vector<vector<int>> subsets(vector<int>& nums) {
size_t n = nums.size();
std::vector<std::vector<int>> res;
for (size_t mask = 0; mask < 1 << n; mask++)
{
std::vector<int> curr;
for (size_t i = 0; i < n; i++)
{
... | ALGO | 0.999875 | 6.306216 |
4bbd7f6d-1aeb-41f7-8040-3d0b13112c6f | karunsehwag/leetcode_daily | 2187-minimum-time-to-complete-trips/2187-minimum-time-to-complete-trips.cpp | class Solution {
public:
bool check(vector<int>& time,long long mid,int n)
{
long long count=0;
for(auto x:time)
{
count += mid/x;
if(count>=n)
return true;
}
return false;
}
long long minimumTime(vector<int>& time, int n)... | ALGO | 0.999992 | 6.293029 |
259226d7-3235-444c-807d-225b98a6a886 | ishandutta2007/codeforces | potassium/normal/1282/B1.cpp | #pragma GCC optimize ("O3", "unroll-loops")
//#pragma GCC target ("avx2")
//#pragma comment(linker, "/stack:200000000")
//#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#define INF 21474... | ALGO | 0.99999 | 3.632229 |
2098f659-6acd-413a-b9ab-9980d6a3de96 | sarvex/leetcode-jai | solution/1000-1099/1091.Shortest Path in Binary Matrix/Solution.cpp | class Solution {
public:
int shortestPathBinaryMatrix(vector<vector<int>>& grid) {
if (grid[0][0]) return -1;
int n = grid.size();
queue<pair<int, int>> q;
q.push({0, 0});
grid[0][0] = 1;
int ans = 0;
while (!q.empty()) {
++ans;
for (in... | ALGO | 0.999997 | 6.079331 |
d2808290-9428-4867-b835-c0653eac7510 | JackieZhai/ICPC_Training | Winter_Training/Competition2/A.cpp | //map
#include <bits/stdc++.h>
using namespace std;
int main()
{
int n, buf, card1=0, card2=0, count1=0, count2=0;
scanf("%d", &n);
while(n--)
{
scanf("%d", &buf);
if(card1==0)
{
card1=buf;
count1++;
continue;
}
else if(card2==0)
{
if(card1==buf)
{
count1++;
continue;
}
ca... | ALGO | 0.99995 | 3.000943 |
f9c804e8-0a0e-47ba-b9c0-36e24185b62a | lll-project/libcxx | test/containers/associative/map/map.ops/equal_range.pass.cpp | // <map>
// class map
// pair<iterator,iterator> equal_range(const key_type& k);
// pair<const_iterator,const_iterator> equal_range(const key_type& k) const;
#include <map>
#include <cassert>
int main()
{
typedef std::pair<const int, double> V;
typedef std::map<int, double> M;
{
type... | TEST | 0.923176 | 4.687563 |
61064928-269b-4faa-bb17-252a5356f4bb | padeler/aspellchecker | ASpellChecker/jni/modules/speller/default/editdist.cpp |
#include <cstring>
#include "editdist.hpp"
#include "matrix.hpp"
#include "vararray.hpp"
// edit_distance is implemented using a straight forward dynamic
// programming algorithm with out any special tricks. Its space
// usage AND running time is tightly asymptotically bounded by
// strlen(a)*strlen(b)
namespace a... | ALGO | 0.999874 | 5.585318 |
7d4891af-3755-41a2-92f2-153dae384cd9 | Jacyhust/LSH-APG | cppCode/LSH-APG/src/Preprocess.cpp | #include "Preprocess.h"
#include "basis.h"
#include <fstream>
#include <assert.h>
#include <random>
#include <iostream>
#include <fstream>
#include <map>
#include <ctime>
#include <sstream>
#include <numeric>
#include <algorithm>
#include <omp.h>
#define E 2.718281746
#define PI 3.1415926
#define min(a,b) (... | DATA | 0.885021 | 4.712826 |
5ccf4ce2-1aee-44d6-966f-74540b4076f5 | moad6127/Study_Cpp | CodingTestAlgorithm/Week7/Week7_G_2294/main.cpp | #include <bits/stdc++.h>
using namespace std;
int N, K;
int dp[10004];
int main()
{
ios_base::sync_with_stdio(false);
cin.tie(NULL);
cout.tie(NULL);
cin >> N >> K;
fill(dp, dp + 10004, 987654321);
dp[0] = 0;
for (int i = 0; i < N; i++)
{
int temp{};
cin >> temp;
for (int j = temp; j <= K; j++)
{
dp... | ALGO | 0.999936 | 4.155379 |
7c93244c-4c2e-4030-864d-5ffb9acefd56 | Fahimefto/Solved-problem | Codeforces/contest_test.cpp | #include<bits/stdc++.h>
using namespace std;
int main()
{
int a,b,n;
while(n!=0){
cin>>a>>b;
cout<<a%b<<endl;}
}
| ALGO | 0.993953 | 3.07638 |
012bd452-8074-4958-93d8-4622a54c6ad6 | hanm/llvm | lib/CodeGen/TailDuplication.cpp | #include "llvm/CodeGen/Passes.h"
#include "llvm/ADT/DenseSet.h"
#include "llvm/ADT/SetVector.h"
#include "llvm/ADT/SmallSet.h"
#include "llvm/ADT/Statistic.h"
#include "llvm/CodeGen/MachineBranchProbabilityInfo.h"
#include "llvm/CodeGen/MachineFunctionPass.h"
#include "llvm/CodeGen/MachineInstrBuilder.h"
#include "llvm... | TOOL | 0.961661 | 7.708399 |
81e19eb4-f460-4968-97ee-f6a564301327 | pingjuiliao/BasicBlockIDTracing | llvm-project-10.0.1/libcxx/test/std/algorithms/alg.sorting/alg.binary.search/binary.search/binary_search.pass.cpp | // <algorithm>
// template<ForwardIterator Iter, class T>
// constexpr bool // constexpr after C++17
// binary_search(Iter first, Iter last, const T& value);
#include <algorithm>
#include <vector>
#include <cassert>
#include <cstddef>
#include "test_macros.h"
#include "test_iterators.h"
#if TEST_STD_VER > ... | TEST | 0.998906 | 7.441343 |
ef6435e2-d756-4965-9c9f-8f82d20ff40f | ishan0803/Student_attendance_using_facial_recognition | executable/cpp/threshold.cpp | #include <iostream>
#include <fstream>
#include <string>
#include <vector>
#include <memory>
#include <algorithm>
#include <map>
using namespace std;
// AVL Tree Node structure (same as in create_attendance_avl.cpp)
struct AVLNode {
int attendance; // Key by which the tree is balanced
vector<int> studentI... | ALGO | 0.99977 | 6.544836 |
cbaa41b8-a48e-41b1-8718-4d083ccd7525 | yoloytz/cppcode2023 | study2023/menu1/demo20.cpp | #include <iostream>
using namespace std;
int main() {
const int N = 10;
int nums[N] = {12, 45, 67, 23, 89, 34, 56, 78, 90, 10};
int max_num = nums[0], min_num = nums[0], max_index = 0, min_index = 0;
for (int i = 1; i < N; i++) {
if (nums[i] > max_num) {
max_num = nums[i];
... | ALGO | 0.999759 | 4.091144 |
cb1a0507-4a00-426b-a995-76e4abb36274 | brunohkbx/server-xmtur | server-xmtur/MarrySystem.cpp | #include "Stdafx.h"
#include "MarrySystem.h"
#include "User.h"
#include "GameMain.h"
#include "LogProc.h"
#include "Winutil.h"
#include "DSProtocol.h"
CMarrySystem MarrySystem;
void MarrySystem_ProposeTimer(void * lParam){
while(true){
Sleep(1000);
for(int i=OBJ_STARTUSERINDEX; i < (OBJMAX);i++){
if(gObjIs... | TOOL | 0.884918 | 3.700858 |
4445161a-f44b-4d94-81d1-fab4ecd10e4e | ashwin21rao/Leetcode-Solutions | Solutions/Practice/cpp/Minimum Absolute Difference.cpp | class Solution {
public:
vector<vector<int>> minimumAbsDifference(vector<int>& arr) {
int n = arr.size();
sort(arr.begin(), arr.end());
vector<vector<int>> out;
int min_diff = INT_MAX;
for (int i=1; i<n; i++) {
if (arr[i] - arr[i-1] < min_diff) {... | ALGO | 0.999991 | 6.646301 |
f4ee7fb6-3624-4181-92c6-b64fd1bc3b48 | RomarioBasm/Leetcode | 849-maximize-distance-to-closest-person/849-maximize-distance-to-closest-person.cpp | class Solution {
public:
int maxDistToClosest(vector<int>& seats) {
int n = seats.size();
int empty = 0;
int result = 0;
int idx1 = -1, idx2 = -1;
for(int i = 0; i < n; ++i){
if(seats[i] == 1){
empty = 0;
if(idx1 == -1) idx... | ALGO | 0.999967 | 5.997421 |
00e64ec3-824e-4c00-832c-90de1e4f2143 | shivanisimran/Data-Structures-Algorithms | Backtracking/Path-With-Max-Gold.cpp | /*
In a gold mine grid of size m x n, each cell in this mine has an integer representing the amount of gold in that cell, 0 if it is empty.
Return the maximum amount of gold you can collect under the conditions:
Every time you are located in a cell you will collect all the gold in that cell.
From your position, you c... | ALGO | 0.999833 | 6.647772 |
7883b28b-0809-4c5a-9253-40e4b4bb114d | iDroid-Project/platform_frameworks_base | media/libstagefright/codecs/aacdec/gen_rand_vector.cpp | /*
------------------------------------------------------------------------------
REVISION HISTORY
Description: Modified from original shareware code
Description: Modified to remove instances of pow() and sqrt(), and
optimized for inclusion in fixed-point version of decoder.
Description: Modified to include... | ALGO | 0.999432 | 5.180021 |
11c92e14-be38-483b-b76b-2d34b71ad092 | mathnantes/uri-solutions-cpp | 1067.cpp | #include <iostream>
using namespace std;
int
main()
{
int x;
cin >> x;
for(int i=0; i<=x; i++)
{
if(i%2 != 0)
cout << i << endl;
}
return 0;
}
| ALGO | 0.999639 | 3.436765 |
bfc9780c-9031-4e18-a8fb-c20122b7955f | shAwmitrAcse134582/phitron_course | Algorithm/Module-8/problem-04.cpp | #include<bits/stdc++.h>
#define ll long long int
#define pb push_back
#define get_out return 0
#define fast ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);
using namespace std;
const int N=1e3+5;
vector<int>adj[N];
bool visited[N];
int cnt=0;
void bfs(int u){
queue<int>q;
q.push(u);
visited[u]=true;
... | ALGO | 0.999931 | 3.995811 |
3bf2946a-6541-416a-9f44-62a2b4a5e091 | mbravofuentes/Codingpractice | C++/kattisolutions/SOSorting/sos.cpp | #include <vector>
#include <iostream>
#include <string>
#include <algorithm>
using namespace std;
bool cmp(string s1, string s2){
return (s1.substr(0, 2) < s2.substr(0,2)); //
}
int main()
{
while (true){
int n;
cin >> n;
if(!n) break; // since its a true-false statement, once it sees an input of 0 which is... | ALGO | 0.999323 | 4.890822 |
c2545aed-9807-4b55-a1a0-bf559950462d | ZeraGmbH/zenux-legacy-components | zera-math/gaussmatrix_p.cpp | #include "gaussmatrix_p.h"
#include "gaussnode.h"
cGaussMatrixPrivate::cGaussMatrixPrivate(int order)
{
m_norder = order;
m_py = new double[order];
m_pkoeff = new double[order];
m_pmatrix = new double[order*order];
}
cGaussMatrixPrivate::~cGaussMatrixPrivate() {
delete[] m_py;
delete[] m_pkoef... | ALGO | 0.999649 | 3.531595 |
3a347981-ee71-47b2-b3f2-6b9f67520aea | MichaelNotDeveloper/AlgorihmTemplates | matching/matching.cpp | #include "matching.h"
Khun::Khun(int n, int m) : _n(n), _m(m)
{
_bgraph.assign(n + 1, std::vector<int>());
_mt.assign(m + 1, -1);
}
void Khun::add_edge(int x, int y)
{
_bgraph[x].push_back(y);
}
void Khun::add_matching_edge(int x, int y)
{
_mt[y] = x;
}
void Khun::clear()
{
for (int &u : _mt)
... | ALGO | 0.999845 | 5.06855 |
2ea52999-0847-4852-b950-6f8349f7746e | 443SSL/QUIZ3 | Q5.cpp | #include <iostream>
#include <thread>
#include <stdlib.h>
#include <vector>
#include <unistd.h>
#include "Semaphore.h"
using namespace std;
/* This program now only works for NP=1 (i.e., 1 producer and NC consumers).
Modify your program such that when you change NP to >1,
exactly NP producers run first, then exactl... | ALGO | 0.983678 | 4.761256 |
7434eb26-fd7f-409c-b7cf-2d2fee38edc2 | mayank2903/CodeChef-Solutions | mb1994BOTM.cpp | #include<stdio.h>
int bits(int ans)
{
int cnt=0;
while(ans)
{
cnt+=(ans&1);
ans>>=1;
}
return cnt;
}
int main()
{
int t;
scanf("%d",&t);
while(t--)
{
int ans=0,x;
for(int i=0;i<15;i++)
{
scanf("%d",&x);
ans^=x;
... | ALGO | 0.999816 | 4.220476 |
ef05deb0-aa8c-48bb-9ee4-26f93bda491a | Mendeley/Qt | src/gui/graphicsview/qgraphicsscene_bsp.cpp | #include "qgraphicsscene_bsp_p.h"
#ifndef QT_NO_GRAPHICSVIEW
#include <QtCore/qstring.h>
#include <private/qgraphicsitem_p.h>
QT_BEGIN_NAMESPACE
class QGraphicsSceneInsertItemBspTreeVisitor : public QGraphicsSceneBspTreeVisitor
{
public:
QGraphicsItem *item;
void visit(QList<QGraphicsItem *> *items)
{ ... | TOOL | 0.938964 | 6.029834 |
03deb612-3bd2-4061-9b3e-56b0edfb236b | Jose26398/SS_Practicas | P3/colammk.cpp | #include <stdio.h>
#include <math.h>
#include <stdlib.h>
#include <time.h>
#include <list>
#include <iostream>
using namespace std;
#define suceso_llegada 0
#define suceso_salida 1
#define suceso_finsimulacion 3
#define suceso_monitor 4
typedef struct {
int suceso;
float tiempo;
float retraso;
} suc;
list<suc> ls... | ALGO | 0.999352 | 4.088185 |
e30136a2-b99e-45a1-b119-e0836a17dc6a | locoxsoco/fast-realistic-rendering-project | ViewerPBS/dependencies/eigen3/bench/benchEigenSolver.cpp |
// g++ -DNDEBUG -O3 -I.. benchEigenSolver.cpp -o benchEigenSolver && ./benchEigenSolver
// options:
// -DBENCH_GMM
// -DBENCH_GSL -lgsl /usr/lib/libcblas.so.3
// -DEIGEN_DONT_VECTORIZE
// -msse2
// -DREPEAT=100
// -DTRIES=10
// -DSCALAR=double
#include <iostream>
#include <Eigen/Core>
#include <Eigen/QR>
#in... | TOOL | 0.994466 | 5.772861 |
2ae0f239-155f-4cee-8393-bff08e44d2e2 | rohitpoks/competitive-programming | CP Problems/counting_paths.cpp | #include <stdio.h>
#include <iostream>
#include <list>
#include <vector>
#include <queue>
#include <string>
#include <algorithm>
#include <cmath>
#include <cstring>
#include <set>
#include <map>
#include <climits>
#include <cassert>
using ll = long long;
using namespace std;
// return how many paths parent is a part ... | ALGO | 0.999799 | 4.641891 |
b67c1299-3b55-45db-8c4f-cfbc9b542725 | Ujjawal-Sh/C-Plus-Plus | 2D Array.cpp | using namespace std;
#include<iostream>
int main(){
int a[3][3];
int n = 1;
for(int i=0;i<3;i++){
for(int j=0;j<3;j++){
a[i][j]=n;
n++;
}
}
for(int i=0;i<3;i++){
for(int j=0;j<3;j++){
cout <<a[i][j];
}
}
return 0;
}
| ALGO | 0.999272 | 3.118176 |
f1c3c5f8-8a0b-4fd3-8285-0069a2e09a0a | ADiTyaRaj8969/ICE | ADM2.cpp | #include <iostream>
#include <vector>
using namespace std;
vector<int> ADM(vector<int>& ms, int initial, int factor) {
vector<int> demodulated;
int pre = 0;
int st = initial;
for (int i = 0; i < ms.size(); i++) {
if (ms[i] == 1) {
pre += st;
} else {
pre -= st;
... | ALGO | 0.999984 | 5.010751 |
791b8deb-3726-47c3-8590-d8461f8af869 | Matbar1/NISHANT-BHAIYA-151 | Maximum XOR of Two Numbers in an Array.cpp | struct TrieNode {
TrieNode *next[2] = {};
};
class Solution {
void add(TrieNode *node, int n) {
for (int i = 31; i >= 0; --i) {
int b = n >> i & 1;
if (node->next[b] == NULL) node->next[b] = new TrieNode();
node = node->next[b];
}
}
int maxXor(TrieNode... | ALGO | 0.999939 | 5.731621 |
986ad05d-1560-49c3-91d7-eb2d8d747e56 | kyeokabe/crackingCodingInterview | code/LeetCode/1313_DecompressRun-LengthEncodedList.cpp | class Solution {
public:
vector<int> decompressRLElist(vector<int>& nums) {
vector<int> v;
for(int i=1;i<nums.size();i+=2){
for(int j=0;j<nums[i-1];j++)
v.push_back(nums[i]);
}
return v;
}
};
| ALGO | 0.999838 | 5.357444 |
2e427c3c-8aab-48ab-9430-914640a4f517 | saurabh-kadian/SPOJ | hist2Slow.cpp | #include <bits/stdc++.h>
#define debug(v,len) for(long long int i=0;i<len;++i)printf("%lld\n",v[i]);
#define debugMatrix(name,row,col) for(long long int i=0;i<row;++i){for(long long int j=0;j<col;++j)cout<<name[i][j]<<" ";cout<<endl;}
#define gcd(v,h) __gcd(v,h)
#define popcount(v) __builtin_popcount(v)
#define sl(T) s... | ALGO | 0.999298 | 3.103733 |
e848c9a4-4801-4c44-9b02-fe7bfcbc86aa | npnkhoi/Competitive-programming | HackerRank/World Codesprint 13/A.cpp | #include <bits/stdc++.h>
using namespace std;
#define fi first
#define se second
#define mp make_pair
#define pb push_back
#define REP(i,n) for (int i = 0; i < n; ++ i)
#define FOR(i,a,b) for (int i = a; i <= b; ++ i)
#define FORD(i,b,a) for (int i = b; i >= a; -- i)
#define task ""
typedef long long ll;
typedef unsign... | ALGO | 0.99959 | 3.31338 |
cd6595eb-82c1-452a-b0e2-0bd4458764dc | hjc004/C-Language | 12.13Code/D.cpp | #include<stdio.h>
void input(int *arr,int n);
void max_min(int *arr,int n);
void output(int *arr,int n);
int main()
{
int a[10];
input(a,10);
max_min(a,10);
output(a,10);
return 0;
}
void input(int *arr,int n)
{
int i;
for (i = 0;i < n;i++)
{
scanf("%d",&arr[i]);
}
}
void max_min(int *arr,... | ALGO | 0.999936 | 3.230567 |
3809f279-8872-4f86-a738-87b91a1eb4b0 | DaniilKirillov/1 | ДЗ 18.01.20 - 07.03.20/One type bracket checker.cpp | #include <iostream>
#include <string.h>
using namespace std;
bool TSC(string *s) {
int c = 0;
for (int i = 0; i < s->length; i++) {
if (s[i] == "(") c++;
else c--;
if (c < 0) return false;
}
return c == 0;
}
int main() {
string s;
} | ALGO | 0.975667 | 4.019423 |
b05f978e-b899-48f1-879d-97da7223c5ac | iagorrr/Competitive-Programming-Solutions | submissions/Codeforces/2000G.cpp | /*{=======================~ BEGIN MACRO ~================================*/
#include <bits/stdc++.h>
using namespace std;
#ifdef LOCAL
#include "debug.cpp"
#else
#define dbg(...)
#endif
#define endl '\n'
#define fastio \
ios_base::sync_with_stdio(0); \
cin.tie(0);
#define int... | ALGO | 0.999787 | 5.280041 |
2a36ddf6-cdeb-4d24-9b91-a45d77dbe337 | SlizovskiyLab/CoNet | src/graph_analysis.cpp | #include "../include/graph_analysis.h"
#include "../include/graph.h"
#include "../include/traversal.h"
#include "../include/query_engine.h"
#include "../include/export.h"
#include "../include/id_maps.h"
#include "../include/Timepoint.h"
#include <iostream>
#include <map>
#include <set>
#include <tuple>
#include <algori... | ALGO | 0.852706 | 6.168435 |
11372f5a-21bd-435a-a00a-8da5208671dc | sanjay-29-29/Cloth-Transfer | open-pose/3rdparty/caffe/src/caffe/solvers/adadelta_solver.cpp | #include <vector>
#include "caffe/sgd_solvers.hpp"
namespace caffe {
template <typename Dtype>
void AdaDeltaSolver<Dtype>::AdaDeltaPreSolve() {
// Add the extra history entries for AdaDelta after those from
// SGDSolver::PreSolve
const vector<Blob<Dtype>*>& net_params = this->net_->learnable_params();
for (i... | ALGO | 0.95166 | 7.56469 |
e377a21e-6a02-4cb6-9c3d-44086df9df7b | MSRCCS/Caffe | src/caffe/layers/rpn_proposal_layer.cpp | #include <cfloat>
#include "caffe/layers/rpn_proposal_layer.hpp"
using std::max;
using std::min;
using std::floor;
using std::ceil;
namespace caffe {
template <typename Dtype>
void RPNProposalLayer<Dtype>::LayerSetUp(const vector<Blob<Dtype>*>& bottom,
const vector<Blob<Dtype>*>& top) {
RPNProposalParame... | DATA | 0.861877 | 7.345963 |
8d249f6d-e290-4314-be2c-7ed666f6c783 | aalaydrus/In-place-sorting | InsertionSort.cpp | #include "InsertionSort.h"
InsertionSort::InsertionSort(int aArrayOfNumbers[], unsigned int aArraySize) : ArraySorter( aArrayOfNumbers, aArraySize)
{}
//sorts the array with the "insertion sort" algorithm
void InsertionSort::sort(std::ostream& aOStream)
{
int i, j;
//initialised as 1 as we will be taking the elem... | ALGO | 0.999434 | 5.083566 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.