uuid string | repo_name string | relative_path string | content string | category string | algo_rel_score float64 | quality_score float64 |
|---|---|---|---|---|---|---|
3523b8bf-af15-46c1-8ef1-bc446cfaf47a | bitcoinrel/bitcoinreloaded | src/crypto/hmac_sha512.cpp | #include <crypto/hmac_sha512.h>
#include <string.h>
CHMAC_SHA512::CHMAC_SHA512(const unsigned char* key, size_t keylen)
{
unsigned char rkey[128];
if (keylen <= 128) {
memcpy(rkey, key, keylen);
memset(rkey + keylen, 0, 128 - keylen);
} else {
CSHA512().Write(key, keylen).Finalize(... | ALGO | 0.93776 | 5.726457 |
763b3f39-dc62-4f69-a382-7de3addbc1c7 | Ereh11/CompetitiveProgramming | Bitmasks/XORwice CodeForces - 1421A.cpp | #include <bits/stdc++.h>
#define FastIO ios_base::sync_with_stdio(NULL); cin.tie(0); cout.tie(0);
using namespace std;
int main()
{
FastIO;
int t, a, b; cin >> t;
while (t-- && cin >> a>>b)
cout << (max(a, b) ^ min(a, b)) << ((t) ? "\n" : "");
}
| ALGO | 0.999803 | 4.007599 |
43a027dd-cd91-4bbc-b841-66de59f2fe06 | ishandutta2007/codeforces | chen_zexing/normal/1481/B.cpp | #include <stdio.h>
#include<iostream>
#include <string>
#include <string.h>
#include <vector>
#include <cmath>
#include <algorithm>
#include <queue>
#include <climits>
#include <set>
#include <unordered_map>
#include <map>
#include <stack>
#include <unordered_set>
#define hash hassh
using namespace std;
int a[105];
int... | ALGO | 0.999933 | 3.400426 |
cd6bcbf9-fabc-42e0-8310-79601ff76cfe | Synthiplayer/my_todo_app | windows/runner/utils.cpp | #include "utils.h"
#include <flutter_windows.h>
#include <io.h>
#include <stdio.h>
#include <windows.h>
#include <iostream>
void CreateAndAttachConsole() {
if (::AllocConsole()) {
FILE *unused;
if (freopen_s(&unused, "CONOUT$", "w", stdout)) {
_dup2(_fileno(stdout), 1);
}
if (freopen_s(&unuse... | TOOL | 0.998733 | 6.76775 |
4803641d-f886-4ec9-b04e-f8e6acd45f2f | EveSunMaple/Code | luogu/AUT-The-Bus.cpp | #include <algorithm>
#include <cstring>
#include <cstdio>
#include <vector>
#include <queue>
#include <cmath>
#define MAX 10000
int edge[MAX]; //储存点的值
int dist[MAX]; //最短路
bool tag[MAX]; //标记结点
int tot = 0; // 边的数量
using namespace std;
vector<int> g[MAX]; // 邻接表存储图
void BellmonFord()
{
memset(dist, 0, sizeof(dist))... | ALGO | 0.999906 | 3.447721 |
96c94ccb-a309-4d00-b95f-87c1481de517 | Empyreal092/Graphing_Calculator | FunctionPlotWindows/ODESolvingMethods/RK2method/RK2method.cpp | /**
* This file is part of PIC 10C Final Project - A Graphic Calculator.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later ... | ALGO | 0.981561 | 5.104713 |
74db6db2-adfa-4a76-ad38-ee13d6a6aac4 | RahulBhikundia/Design-and-Analysis-of-Algorithms-Lab | DFS_Traversal.cpp | /*
b. Check whether a given graph is connected or not using DFS method.
*/
#include <iostream>
#include <vector>
#include <queue>
using namespace std;
void dfs(int node, vector<vector<int>>& adjM, vector<int>& visited, vector<int>& ans) {
visited[node] = 1;
ans.push_back(node);
for(int i=0;i<adjM.size();i... | ALGO | 0.999923 | 6.000177 |
81e2bb71-3bc0-48bd-a271-d2c42aa75779 | QianQNanami/JSOI-WC25 | PJ/judger/source/WC25-053/add.cpp | #include<bits/stdc++.h>
using namespace std;
int a[100005];
int dp[100010];
vector<int> qwe;
int main(){
int n;
cin>>n;
for(int i=1;i<=n;i++)
{
cin>>a[i];
}
int m;
cin>>m;
for(int i=1;i<=n+1;i++)
{
dp[i]=dp[i-1]+a[i-1];
}
while(m--)
{
int l,r;
cin>>l>>r;
qwe.push_back(dp[r+1]-dp[l]);
}
for(int ... | ALGO | 0.999911 | 4.26225 |
f2ebe5c5-a9c2-4c2f-b363-63ed45c6c239 | BlackerGod/DogBed | Project7/Project7/test.cpp | #include<stdio.h>
#include<stdlib.h>
void sort(int *a,int size){
for (int i = 0; i < size; ++i){
printf("%d ", a[i]);
}
printf("\n");
int b[100];
int j = 0;
int c = 0;
for (int i = 0; i < size;++i){ //1 2 3 4 5 6 7 8 9 10
if ((a[i] % 2) != 0){
b[c] = a[i];
... | ALGO | 0.99971 | 3.302424 |
b6613d8e-c202-40c4-b41b-328e8f61651a | phoenixx1/Competitive-Programming-Solutions | CodeForces/701A-Cards.cpp | //author @Nishant
#include<bits/stdc++.h>
using namespace std;
int main(){
int n;
cin >> n;
int a[n+1], index[n+1];
for(int i = 0; i < n; i++){
cin>>a[i];
index[i]=i;
}
for(int i = 1; i <= n; i++){
for(int j = 0; j < n - i; j++){
if(a[j] > a[j+1]){
... | ALGO | 0.999965 | 3.233426 |
32ce5a59-e7bf-4888-ad07-558fedd4037b | KimKiheon/Algorithm | BOJ/Greedy Algorithm/BOJ11047_동전0.cpp | #include<iostream>
#include<vector>
#include<algorithm>
using namespace std;
int main() {
vector<int>v;
int n, m, cnt = 0;
cin >> n >> m;
for (int i = 0; i < n; i++) {
int a;
cin >> a;
if (a <= m)v.push_back(a);
}
while (m) {
if (m - v.back() >= 0) {
m -= v.back();
cnt++;
}
else v.pop_back();
}... | ALGO | 0.999994 | 3.562184 |
7d158e37-6fab-4139-b9bc-797ebe3d672e | kyungjin96/testcccc | for_str.cpp | #include <iostream>
using namespace std;
int main(){
char a = '*';
int b;
cin >> b;
for(int i=1; i<=b; i++){
for(int j= 1; j<=i; j++)
cout<< a;
cout<<"\n";
}
}
| ALGO | 0.99993 | 3.771421 |
e78b899c-e022-4750-9506-eba05c494f13 | GeorgeLyon/SwiftHDL | mlir/llvm/llvm/lib/CodeGen/RegAllocBasic.cpp | #include "AllocationOrder.h"
#include "LiveDebugVariables.h"
#include "RegAllocBase.h"
#include "llvm/Analysis/AliasAnalysis.h"
#include "llvm/CodeGen/CalcSpillWeights.h"
#include "llvm/CodeGen/LiveIntervals.h"
#include "llvm/CodeGen/LiveRangeEdit.h"
#include "llvm/CodeGen/LiveRegMatrix.h"
#include "llvm/CodeGen/LiveSt... | ALGO | 0.956018 | 7.852623 |
21dccf04-c897-4d05-862d-5267c5315dea | nguyenquyen1910/DSALearn | Greedy/doi_tien.cpp | #include<bits/stdc++.h>
using namespace std;
using ll = long long;
int coins[10]={1,2,5,10,20,50,100,200,500,1000};
int main(){
ios::sync_with_stdio(false);
cin.tie(nullptr);
cout.tie(nullptr);
int coin;cin>>coin;
int cnt=0;
for(int i=9;i>=0;i--){
cnt+=coin/coins[i];
coin%=coins[... | ALGO | 0.999804 | 4.357506 |
95fe5eba-4af0-4437-a1f2-0515a56118b6 | circuitdojo/air-quality-wing-library | src/sensirion_voc_algorithm.cpp | #include "sensirion_voc_algorithm.h"
/* The fixed point arithmetic parts of this code were originally created by
* https://github.com/PetteriAimonen/libfixmath
*/
/*!< the maximum value of fix16_t */
#define FIX16_MAXIMUM 0x7FFFFFFF
/*!< the minimum value of fix16_t */
#define FIX16_MINIMUM 0x80000000
/*!< the valu... | ALGO | 0.999398 | 6.770428 |
7131b508-9322-4db3-bade-43d2f4e567fe | trinhminhtriet/leetcode | solutions/3000-3099/3012.minimize-length-of-array-using-operations/Solution.cpp | class Solution {
public:
int minimumArrayLength(vector<int>& nums) {
int mi = *min_element(nums.begin(), nums.end());
int cnt = 0;
for (int x : nums) {
if (x % mi) {
return 1;
}
cnt += x == mi;
}
return (cnt + 1) / 2;
}
... | ALGO | 0.99994 | 5.501435 |
80f8797c-1209-41c5-9a9b-8c0f5e791775 | wonderballRyan/0_programe | C++/5_stack&queue/1_myQueue.cpp | #include <iostream>
#include <stack>
using namespace std;
class MyQueue {
public:
stack<int> stIn;
stack<int> stOut;
MyQueue() {
}
//添加元素
void push(int x) {
stIn.push(x);
}
int pop() {
//只有当stOut为空的时候,再从stIn里导入数据(导入stIn全部数据)
if (stOut.empty()) {
//从stIn导入数据直到stIn为空
while (!stIn.empty()) {
st... | ALGO | 0.997119 | 4.628307 |
f41273d5-0e8d-4652-aa0d-afd77d814169 | TusharGharge/love_babbar | functions/even.cpp | #include<iostream>
using namespace std;
int eveodd(int no){
if (no%2==0){
printf("number is even");
}
else{
printf("number is odd");
}
return 0;
}
int main(){
int no = 0;
cin >> no;
eveodd(no);
} | ALGO | 0.999799 | 4.098804 |
39d54d19-5fb0-41b8-9e4f-55bb23867d20 | watashi/AlgoSolution | livearchive/2010/Asia.Dhaka/4854.cpp | #include <cctype>
#include <cstdio>
#include <string>
#include <cstring>
using namespace std;
const int ROWS = 8;
const int COLS = 8;
const int off[] = {0, 10};
int main() {
int re, h[2], v[2], w[26];
char buf[20][80];
string s[2];
scanf("%d", &re);
for (int i = 0; i < 26; ++i) {
int c = 65 + i;
w[i] = 0;
... | ALGO | 0.999114 | 3.42635 |
d08edaeb-eed6-4e1b-b09c-a556cf86aef1 | ezenjun/Algorithm | ProblemSolving/Lecture1/lowerbound.cpp | #include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
int main(){
int myints[] = {1,2,3,4,4,4,4,10,11,15,16};
vector<int> v;
vector<int>::iterator low, hi;
for(auto temp: myints)
v.push_back(temp);
sort(v.begin(), v.end());
//4의 시작
low = lower_bound(v.be... | ALGO | 0.999811 | 4.55568 |
4c2f8ce1-5a54-4d3e-ac21-306b83680c91 | CCl4-NJU/study | PAT-c/线段树/Project1/Source.cpp | #define _CRT_SECURE_NO_WARNINGS
#include <iostream>
#include <cstdio>
using namespace std;
const int maxn = 50000 + 5;
int sum[4 * maxn];
//iڵռӽڵͳƽ
void PushUp(int i)
{
sum[i] = sum[i * 2] + sum[i * 2 + 1];
}
//ݹ齨߶
void build(int i, int l, int r)
{
if (l == r)
{
scanf("%d", &sum[i]);
return;
}
int m = (l + r... | ALGO | 0.998876 | 3.63306 |
975c74fd-a9be-4012-bfaa-d7517477ab9d | blackxhat24/clanguagevjudge | menu/menu.cpp | #include <stdio.h>
int hitung(int a[],int pivot,int i,int b)
{
int bawah =0,atas= pivot-1,mid=0;
int hasil = -1;
while(bawah<=atas)
{
mid = (bawah+atas)/2;
if(i == a[mid])
{
hasil = mid;
if(b)
{
atas = mid - 1;
}
else
{
bawah = mid +1;
}
}
else if(i < a[mid])
{
atas = mi... | ALGO | 0.99992 | 3.899396 |
3e31f9b0-ecdf-4f62-9991-692c4658863b | hoangmanhkhiem/SPOJ | submited/BRCKTS.cpp | /*
USER: hoangmanhkhiem
TASK: BRCKTS
ALGO: segment tree
*/
#include <algorithm>
#include <cstdio>
#define NMAX 32768
#define TMAX 65536
using namespace std;
char seq[NMAX];
struct Node { int sum, minsum; } Tree[TMAX];
void init(int Node, int i, int j) {
if(i==j) {
Tree[Node].sum = Tree[Node].minsum = (seq[i]=='... | ALGO | 0.999861 | 3.644663 |
484ca5b8-ad82-4c7b-96c0-8c68819c9bcc | rishabh-munjal/DSA-cpp | Programs/General/Recursion/PalindromeString.cpp | //program to check if a string is palindrome or not using recursion
#include <iostream>
#include <string>
using namespace std;
bool ispalindrome(string mystring , int start , int end ){
if(start >= end){
return true;
}
return (mystring[start] == mystring[end]) && ispalindrome(mystring , start+... | ALGO | 0.999568 | 4.882257 |
f0076a27-b5c5-41bf-ad30-145be846e410 | nicholastong05/CPT111 | lab material 2/3.cpp | #include<iostream>
using namespace std;
int main()
{int number =12345;
int rightMost=number%10;
cout<<"The rightmost digit in "<<number<<" is "<<rightMost<<endl;
return 0;
}
| ALGO | 0.997247 | 3.486683 |
1f590118-1823-4de9-bcb5-99ba457742c6 | ishandutta2007/codeforces | chenxiaoyan/normal/1419/C.cpp | /*
D P
l l
*/
#include<bits/stdc++.h>
using namespace std;
const int N=1000;
int n,x;
int a[N+1];
void mian(){
cin>>n>>x;
for(int i=1;i<=n;i++)scanf("%d",a+i);
vector<int> v;
for(int i=1;i<=n;i++)if(a[i]!=x)v.push_back(a[i]);
if(v.empty())return puts("0"),void();
if(v.size()<n)return puts("1"),void();
int sum... | ALGO | 0.999828 | 3.594239 |
2ea852c6-eb41-4643-b4ff-e9c0c0e7759f | k2font/atcoder | abc098_A.cpp | #include <bits/stdc++.h>
using namespace std;
int main(){
int A, B; cin >> A >> B;
cout << max({A + B, A - B, A * B}) << endl;
} | ALGO | 0.999947 | 4.51545 |
6ef314c3-1392-4872-ba9d-c8e95cd0c89c | vinayak-7/dsa_ques | valid_palindrome.cpp | class Solution {
private:
bool isValid(char ch){
if((ch>='a' && ch<='z')||(ch>='A' && ch<='Z')||(ch>='0' && ch<='9')){
return 1;
}
return 0;
}
char tolowercase(char ch){
if((ch>='a' && ch<='z')||(ch>='0'&& ch<='9')){
return ch;
}
else{
char temp = ch - 'A' + 'a';
... | ALGO | 0.999933 | 6.28019 |
2e3482b3-1030-4712-8ac5-62dc3c347128 | MateyApostolov/SummerCamp2023 | dom 2.5.cpp | #include <iostream>
using namespace std;
int main () {
int H1, M1, H2, M2;
cin >> H1 >> M1 >> H2 >> M2;
int m;
m = (H2 * 60 + M2) - (H1 * 60 + M1);
cout << m / 60 << " H " << m % 60 << " M " << endl;
return 0;
}
| ALGO | 0.999208 | 4.825294 |
5ed4a1cc-c7f0-4601-aa20-f8a24782d28e | heechan3006/CS | BOJ/BOJ_2573/BOJ_2573/소스.cpp | #include <iostream>
#include <queue>
#include <cstring>
#define MAXN 301
using namespace std;
int map[MAXN][MAXN];
int copy_map[MAXN][MAXN];
bool visited[MAXN][MAXN];
int N, M;
int dx[] = { 0,0,1,-1 };
int dy[] = { 1,-1,0,0 };
void dfs(int x, int y) {
visited[x][y] = true;
for (int k = 0; k < 4; k++) {
int nx = x ... | ALGO | 0.99999 | 4.181458 |
d3aa8406-2234-4060-9d3b-1c91cfbdd835 | nao317/cpp | algo-method/algorithm-advanced/sort/sec1pro1.cpp | // クイックソート
#include <iostream>
#include <vector>
using namespace std;
/* 配列vecに要素を入力する関数 */
void input(vector<int> &vec) // 配列の参照渡し
{
for (int i = 0; i < vec.size(); i++)
{
cin >> vec[i]; // 要素の入力
}
}
/* 配列vecの要素を一行に出力する関数(末尾で改行) */
void output(vector<int> &vec) // 配列の参照渡し
{
for (int i = 0; ... | ALGO | 0.999983 | 5.366047 |
9291c439-97fa-463f-b3f8-f9106954bfa8 | nighostchris/GirvanNewman | Source Code/queue.cpp | #include <iostream>
#include "queue.h"
using namespace std;
Queue::Queue() : top(NULL), bottom(NULL)
{
}
Queue::~Queue()
{
}
void Queue::enqueue(int node_no)
{
node* update = new node;
update->node_no = node_no;
update->next = NULL;
if (top == NULL)
top = update;
else
bottom->ne... | TOOL | 0.951729 | 3.751903 |
4d8d541c-0664-4fb1-93cf-d84a872d127d | GeniusVentures/SuperGenius | src/verification/finality/vote_graph/vote_graph_impl.cpp | #include "verification/finality/vote_graph/vote_graph_impl.hpp"
namespace sgns::verification::finality {
namespace {
/// filters vector in-place - effectively removes all elements for which
/// func returned false.
template <typename Vector, typename Func>
inline void filter_if(Vector &&v, Func &&fu... | ALGO | 0.99913 | 7.034856 |
cfce1c40-a79f-4efb-9f38-07e101e043d2 | DreamChaser-luzeyu/NKDataTypeNew | Data-Structures-Algorithms-and-Applications-in-cpp-master/exercise solutions/codes/hsort2.cpp |
// should be faster heap sort
#include <iostream.h>
#include "hsort2.h"
void main(void)
{
int a[21], i, n = 10;
// initialize descending data
for (i = 1; i <= 10; i++)
a[i] = n-i+1;
HeapSort(a,10);
// output sorted data
for (i = 1; i <= n; i++)
cout << a[i] << ' ';
cout << endl;
}... | ALGO | 0.999887 | 4.856022 |
368c7f54-dc51-4bbd-bdb7-b7b8d5d49770 | hyeok00/Algorithms | 프로그래머스/lv1/86051. 없는 숫자 더하기/없는 숫자 더하기.cpp | #include <string>
#include <vector>
using namespace std;
int solution(vector<int> numbers) {
int answer = 0;
for (auto i : numbers)
{
answer+=i;
}
return 45-answer;
} | ALGO | 0.999514 | 5.157546 |
bca16959-a56f-4760-a988-b34ca8596e66 | malasiot/clopema_certh_ros | certh_libs/src/geometry/Utils.cpp | #include <certh_libs/Geometry.h>
#include <Eigen/Eigenvalues>
using namespace std ;
namespace certh_libs {
bool pointInsideCone(const Vec3 &x, const Vec3 &apex, const Vec3 &base, float aperture)
{
// This is for our convenience
float halfAperture = aperture/2.f;
// Vector pointing to X point from apex
... | ALGO | 0.998975 | 5.835518 |
edc201f4-8d7a-4ead-981b-3f1fc8622c4b | arifulnoman/Competitive-Programming | C_Particles.cpp | #include<bits/stdc++.h>
#define ll long long
const int INF = 1e9 + 7;
using namespace std;
void solve()
{
int i,n,neg = 0;
ll maxi = -INF;
cin >> n;
vector<ll> v(n);
for(i = 0;i < n;i++)
{
cin >> v[i];
if(v[i] < 0)
{
neg++;
}
maxi = max(maxi,v[... | ALGO | 0.999983 | 5.120348 |
1a4d4be1-8909-46c3-b9cf-ca489876cc58 | WatsonWangZh/AlgorithmPractice | CodingInterview/Cpp/66. ConstuctArray.cpp | // 给定一个数组A[0, 1, …, n-1],请构建一个数组B[0, 1, …, n-1],
// 其中B中的元素B[i]=A[0]×A[1]×… ×A[i-1]×A[i+1]×…×A[n-1]。
// 不能使用除法。
// 样例
// 输入:[1, 2, 3, 4, 5]
// 输出:[120, 60, 40, 30, 24]
// 思考题:
// 能不能只使用常数空间?(除了输出的数组之外)
# include <vector>
using namespace std;
class Solution {
public:
vector<int> multiply(const vector<int>& A) {
... | ALGO | 0.999963 | 4.757466 |
f4843b64-690e-4abd-8f2e-bfec26078c82 | zzwsysu/ZZW-OpenGL | ZZW-OpenGL/Particle.cpp | #include <math.h>
#include "Particle.h"
Particles::Particles()
{
}
Particles::Particles(int _num)
{
num=_num;
particles=new Particle[num];
}
Particles::~Particles()
{
delete particles;
}
float Particles::randomInRange(float min,float max)
{
float x;
x=(float)rand()/(float)RAND_MAX*(max - min)+min;
return x;
}... | TOOL | 0.873923 | 4.112869 |
e7ce4be3-d054-4a3e-9c45-faaa764c9735 | ItsKowshik/Data-Structures-And-Algo | Recursion/factorial.cpp | #include <bits/stdc++.h>
using namespace std;
int factorial(int n){
if(n==0){
return 1;
}
int SmallerProblem = factorial(n-1);
return n * SmallerProblem;
}
int main(){
int n;
cin>>n;
cout<<factorial(n)<<endl;
return 0;
} | ALGO | 0.999996 | 5.182384 |
b7b0ccbf-4e9a-490f-8a92-6bde3c3ac884 | yzzupgo/MFTCG | Data/abc136_b/tkoyasak/wa/26810490.cpp | #include <bits/stdc++.h>
using namespace std;
#pragma GCC target("avx")
#pragma GCC optimize("O3")
#define all(obj) (obj).begin(),(obj).end()
#define YesNo(bool) if(bool){cout<<"Yes"<<endl;}else{cout<<"No"<<endl;}
#define reps(i,a,n) for(long long i=(a);i<(long long)(n);++i)
#define rep(i,n) reps(i,0,n)
template<class ... | ALGO | 0.997888 | 4.045633 |
6cfb54f7-c133-4de9-a6cc-f18b80f1fb74 | YeahLim/AlgorithmLevelUpCompetition | 64th_Competition/YeahLim/05/Main.cpp | #include <iostream>
#include <unordered_map>
using namespace std;
int main() {
// 입력
int num, base;
cin >> num >> base;
// 10부터 알파벳 변환
unordered_map<int, char> alphabets;
for (int i = 10; i < 36; i++) {
alphabets[i] = 65 + i - 10;
}
string tx_num = "";
while (num > 0) {
... | ALGO | 0.999904 | 6.174031 |
e3995e3b-5a24-4cc0-b851-d14431469879 | tamirgrBGU/EngineForAnimationCourse | igl/procrustes.cpp | template <
typename DerivedX,
typename DerivedY,
typename Scalar,
typename DerivedR,
typename DerivedT>
IGL_INLINE void igl::procrustes(
const Eigen::PlainObjectBase<DerivedX>& X,
const Eigen::PlainObjectBase<DerivedY>& Y,
bool includeScaling,
bool includeReflections,
Scalar& scale,
Ei... | ALGO | 0.992514 | 6.672431 |
1e66dcad-5044-4527-a0d0-bdd2a667f5e3 | abhishek-rai-1/CPP-DSA | 2DArray/RotateBy90Clockwise.cpp | #include <iostream>
#include <vector>
using namespace std;
int main(){
int row, col;
cout<<"Enter the size of row : ";
cin>>row;
cout<<"Enter the size of col : ";
cin>>col;
if(row != col){
cout<<"Enter the equal no. of row and col"<<endl;
}
else{
vector<vector<int>>ma... | ALGO | 0.99843 | 4.775654 |
b0e8ea51-9249-41a2-beb8-61daca1f8c75 | przet/CppProgramming | Functions/FunctionExplorations/MultipleReturnTypes/MutlipleReturnTypes.cpp | // Thanks to Casey Muratori
// Compare this to the C solution in my CProgramming repository: note the difference
// in syntax (in C need to explicitly state the struct keyword in the return type, and inside
// the funciton - not so in C++
#include <iostream>
#define print(arg) std::cout << arg << std::endl;
struct R... | TOOL | 0.965562 | 5.580822 |
bfdf4fe9-791a-4648-a7bb-38c7d5c89f90 | mkKurish/LeetCodeTasks | 98. Validate Binary Search Tree/Validate Binary Search Tree c++ without traversing.cpp | /*
Runtime
12
ms
Beats
34.30%
of users with C++
Memory
22.00
MB
Beats
53.10%
of users with C++
*/
/**
* 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), le... | ALGO | 0.999819 | 6.570892 |
64bcfbbd-1dd6-4d8b-9e26-57449f226130 | miruddin11/Algorithms | 1240-stone-game-ii/1240-stone-game-ii.cpp | class Solution {
public:
int dp[2][101][101];
int n;
int solve(vector<int> &piles,int person,int i,int M)
{
if(i>=n){
return 0;
}
if(dp[person][i][M]!=-1){
return dp[person][i][M];
}
int ans=(person==1)?-1:INT_MAX;
int stones=0;
... | ALGO | 0.999924 | 5.085485 |
e3966f3e-2397-420b-9ada-2d82f2b80220 | pietroferrara/labprogAL_2022 | lecture9_calculator.cpp | #include <iostream>
#include <cmath>
#include <vector>
using namespace std;
struct expression_not_supported
{
string message;
};
struct expression_malformed
{
string message;
};
/* Deprecated code
bool isNotADigit(char a)
{
return a < '0' || a > '9';
}
int extractNumber(string str)
{
int result = 0... | ALGO | 0.99452 | 4.428903 |
9ae5842e-609e-4c6d-b47e-4d5bebc7a938 | BrianHanke/lentil-bhgc | Eigen/demos/mandelbrot/mandelbrot.cpp | #include "mandelbrot.h"
#include <iostream>
#include<QtGui/QPainter>
#include<QtGui/QImage>
#include<QtGui/QMouseEvent>
#include<QtCore/QTime>
void MandelbrotWidget::resizeEvent(QResizeEvent *)
{
if(size < width() * height())
{
std::cout << "reallocate buffer" << std::endl;
size = width() * height();
i... | ALGO | 0.872261 | 5.79494 |
949882f1-205d-48b6-b302-499da60c1ebc | honglan3/google-fuchsia | test/clang-tidy/misc-inefficient-algorithm.cpp | // RUN: %check_clang_tidy %s misc-inefficient-algorithm %t
namespace std {
template <typename T> struct less {
bool operator()(const T &lhs, const T &rhs) { return lhs < rhs; }
};
template <typename T> struct greater {
bool operator()(const T &lhs, const T &rhs) { return lhs > rhs; }
};
struct iterator_type {};
... | TEST | 0.87361 | 4.811151 |
fb51333e-411c-49ea-8f38-4ace40e93586 | Anubhav2907/DSA | array/maxSumOfK.cpp | #include <bits/stdc++.h>
using namespace std;
int maxSum(int arr[], int n, int k){
int max_sum = 0;
for(int i=0;i<k;i++){
max_sum += arr[i];
}
int sum = max_sum;
for(int i=k;i<n;i++){
max_sum = (max_sum+arr[i]-arr[i-k]);
sum = max(sum, max_sum);
}
return sum;
}
int ma... | ALGO | 0.999878 | 4.680574 |
cdadfc03-3255-4926-88a2-1cafd10b64f2 | Ivan-71-ua/Competitive-Programming | LeetCode/965.cpp | #include <bits/stdc++.h>
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), left(left), right(right) {}
};
class Solution {
void d... | ALGO | 0.999952 | 5.715897 |
eb2c3c0d-6c3a-4d2b-bc53-71358376e76a | SpencerL-Y/cvc5-slhv | src/theory/arith/nl/iand_solver.cpp | #include "theory/arith/nl/iand_solver.h"
#include "options/arith_options.h"
#include "options/smt_options.h"
#include "preprocessing/passes/bv_to_int.h"
#include "theory/arith/arith_msum.h"
#include "theory/arith/arith_utilities.h"
#include "theory/arith/inference_manager.h"
#include "theory/arith/nl/nl_model.h"
#incl... | ALGO | 0.999378 | 7.359373 |
4abf6448-f244-4dbb-8d4b-7e7b1c720a71 | RodrigoRossetti/URI-OJ | Volume 19 (1900 - 1999)/1958/1958.cpp | #include <bits/stdc++.h>
using namespace std;
int main() {
long double X;
char s[120];
scanf("%LE", &X);
sprintf(s,"%LE", X);
if(s[0] != '-') printf("+");
printf("%.4LE\n", X);
return 0;
} | ALGO | 0.999607 | 3.285356 |
3c3c3e43-d8cd-48cc-a559-139ac5af3801 | luciocf/CP-Problems | COI/COI 2010/Olympiad/kolo.cpp | // COI 2010 - Kolo
// Lúcio Cardoso
// Solution is the same as in: https://github.com/mostafa-saad/MyCompetitiveProgramming/blob/master/Olympiad/COI/official/2010/solutions.pdf
#include <bits/stdc++.h>
using namespace std;
const int maxn = 7700000;
int n, k;
bool mark[maxn];
vector<int> P;
void sieve(void)
{
ma... | ALGO | 0.999962 | 3.742145 |
1841aac0-53a4-4e8f-9c30-f2ba84355a48 | fsy-juruo/noip-2021-js-answer | t2021/JS-0110/number/number.cpp | #include <bits/stdc++.h>
#define FILE
using namespace std;
typedef long long ll;
const string FILENAME = "number";
template <typename T>
void read(T &x)
{
char c;bool f = 0;
while (!isdigit(c = getchar())) f ^= (c == '-');
x = (c ^ 48);
while (isdigit(c = getchar())) x = (x << 3) + (x << 1) + (c ^ 48);
if (f) x = ... | ALGO | 0.999723 | 3.837608 |
3b39e7fe-fd71-4217-baee-c5694cbe457d | rshuka/PASS | src/helper/random.cpp | #include "pass_bits/helper/random.hpp"
#include <cassert> // assert
#include <random> // random
#include <algorithm> // shuffle
double pass::random_double_uniform_in_range(double min, double max)
{
assert(min < max && "'min' should be less than 'max'");
return min + arma::arma_rng::randu<double>() * (max - m... | TOOL | 0.928442 | 5.70936 |
e5993885-9700-4fbd-be16-f400980e7030 | syntacore/snippy | llvm/lib/CodeGen/MachineSink.cpp | #include "llvm/ADT/DenseSet.h"
#include "llvm/ADT/DepthFirstIterator.h"
#include "llvm/ADT/MapVector.h"
#include "llvm/ADT/PointerIntPair.h"
#include "llvm/ADT/SetVector.h"
#include "llvm/ADT/SmallSet.h"
#include "llvm/ADT/SmallVector.h"
#include "llvm/ADT/Statistic.h"
#include "llvm/Analysis/AliasAnalysis.h"
#include ... | ALGO | 0.998537 | 3.704319 |
81f7c4e7-3430-4f3d-8af1-d55631cd7c11 | sanyaverma2001/CppCodes | pattern7.cpp |
// * * * * *
// * * * *
// * * *
// * *
// *
#include <bits/stdc++.h>
using namespace std;
int main()
{
int n;
cout << "enter the number of lines : ";
cin >> n;
for (int i = n; i >=1; i--)
{
for (int j = i; j <= n; j++)
{
cout<<" ";
}
... | ALGO | 0.999534 | 3.624894 |
1af7f138-9ce6-4830-9b90-859f2c639f53 | daominhtien2k1/KTLT | Sinh_day_nhi_phan_ver2.cpp | #include <iostream>
using namespace std;
int arr[50];
int n;
void nhiPhan(int i)
{
for(int j=0;j<=1;j++)
{
arr[i]=j;
if(i==n)
{
for(int k=1;k<=n;k++) cout<<arr[k];
cout<<"\n";
}
else
{
nhiPhan(i+1);
}
}
}
int main()
{
cin>>n;
nhiPhan(1);
}
| ALGO | 0.999899 | 3.998274 |
9f3468cd-5875-4284-b564-52fedf072887 | gaolu/Leetcode | mergeSort.cpp | void merge(int*,int*,int,int,int);
void mergesort(int *a, int*b, int low, int high)
{
int pivot;
if(low<high)
{
pivot=(low+high)/2;
mergesort(a,b,low,pivot);
mergesort(a,b,pivot+1,high);
merge(a,b,low,pivot,high);
}
}
void merge(int *a, int *b, int low, int pivot, int hig... | ALGO | 0.999898 | 3.696131 |
3b70ff97-b8ad-489d-8590-b5fd1a7803e2 | av3di/Proj2 | Lab1/Matrix4.cpp | #include <math.h>
#include "Matrix4.h"
Matrix4::Matrix4()
{
for (int i=0; i<4; ++i)
{
for (int j=0; j<4; ++j)
{
m[i][j] = 0;
}
}
}
Matrix4& Matrix4::operator=(const Matrix4& m2)
{
if (this != &m2)
{
for (int i=0; i<4; ++i)
{
for (int j=0; j<4; ++j)
{
m[i][j] = ... | TOOL | 0.857312 | 5.519979 |
7b25aff8-2aba-4542-ba25-cee087caeb81 | KantSurya/MycodeSnippets | code_snippets/dijkstra.cpp | #include<bits/stdc++.h>
using namespace std;
#define FASTIO ios_base::sync_with_stdio(false),cin.tie(NULL),cout.tie(NULL)
#define ll long long
#define mset(A,val) memset(A,val,sizeof(A))
#define fi(a,b) for(int i=a;i<=b;++i)
#define fj(a,b) for(int j=a;j<=b;++j)
#define all(x) x.begin(),x.end()
#define vi vector<int>... | ALGO | 0.999924 | 4.083396 |
59b3e22f-6ee2-40e1-b09c-613c45986295 | dhavalbhatti/module3-oop-cpp | CPP Projects/area_circle_triangle_rectangle.cpp | #include<iostream>
using namespace std;
class Area {
public:
void Result(int a, int b) {
cout << "Area of Rectangle: " << a * b << endl;
}
void Result(double a, double b) {
cout << "Area of Triangle: " << 0.5 * a * b << endl;
}
void Result(double a) {
cout << "Area of Ci... | TOOL | 0.975841 | 5.179903 |
960db97d-1132-40fd-92b9-e5a10b3e4c28 | darshsingh116/leetcode | my-folder/problems/check_if_array_is_sorted_and_rotated/solution.cpp | class Solution {
public:
bool check(vector<int>& nums) {
int count=0;
int n=nums.size();
for(int i=1;i<n;i++){
if(nums[i]<nums[i-1]){
count++;
}
}
if(nums[n-1]>nums[0]){count++;}
return (count>1)?false:true;
}
}; | ALGO | 0.999981 | 5.347576 |
2016544f-61d4-4842-83e1-a0bb9788421a | wuqizhichu/Cyuyan | test9.14/test9.14.cpp | #include <stdio.h>
#include <malloc.h>
typedef struct lnode {
int data;
struct lnode* next;
}lnode,*linklist;
//12345678Ϊ18273645
int a[8] = { 1,2,3,4,5,6,7,8 };
int n = 8;
void buildlist(linklist& L)
{
L = (linklist)malloc(sizeof(lnode));
lnode* s, * r = L;
for (int i = 0; i < n; i++)
{
s = (lnode*)malloc(si... | ALGO | 0.999218 | 3.296586 |
fbb98628-4337-4d6f-a4aa-cd3843d66e60 | anantsingh404/GeeksforGeeks | Difficulty: Medium/Closest Three Sum/closest-three-sum.cpp | //{ Driver Code Starts
#include <bits/stdc++.h>
using namespace std;
// } Driver Code Ends
// User function template for C++
// arr : given vector of elements
// target : given sum value
class Solution {
public:
int threeSumClosest(vector<int> arr, int target) {
// Your code goes here
int n=arr... | ALGO | 0.99998 | 6.32093 |
f9a982d6-2550-4353-b5d6-76e76d40eac9 | jzzzzh/HiBench | dataset/Code/c++Selected/51.cpp | class Solution {
public:
int numberOfAlternatingGroups(vector<int>& colors, int k) {
int result = 0;
for (int right = 0, left = 0, curr = 0; right < size(colors) + k - 1; ++right) {
if (right - left + 1 == k) {
result += curr == k - 1 ? 1 : 0;
curr -= colors[left] != colors[(left + 1) % size(colors)] ? 1 : 0;
++left;
}... | ALGO | 0.999751 | 5.968423 |
56acf33a-be6f-47bb-b279-52334a509286 | usnistgov/managed-cryptocurrencies-bitcoin | src/wallet/fees.cpp | #include <wallet/fees.h>
#include <policy/policy.h>
#include <txmempool.h>
#include <util.h>
#include <validation.h>
#include <wallet/coincontrol.h>
#include <wallet/wallet.h>
CAmount GetRequiredFee(unsigned int nTxBytes)
{
return std::max(CWallet::minTxFee.GetFee(nTxBytes), ::minRelayTxFee.GetFee(nTxBytes));
}
... | ALGO | 0.995665 | 7.161284 |
0a2d3f7f-e016-4d72-bfa0-13c276f506d0 | Pure-Zh/project | project_d/test/cpp/utils.cpp | #include<opencv2/opencv.hpp>
#include<iostream>
#include<string>
#include<vector>
#include<map>
#include<cmath>
#include<algorithm>
#include"utils.h"
#define PI 3.1415926535
using namespace std;
using namespace cv;
using cv::Mat;
using cv::Rect;
using cv::Point;
//Data definition
const float scalingfactor = 138.28;... | ALGO | 0.991631 | 3.784088 |
6f89d018-5fae-45b4-b26a-701be3dacf7b | uniticn/UnitiCoin | src/qt/transactionfilterproxy.cpp | #include "transactionfilterproxy.h"
#include "transactiontablemodel.h"
#include "transactionrecord.h"
#include <QDateTime>
#include <cstdlib>
// Earliest date that can be represented (far in the past)
const QDateTime TransactionFilterProxy::MIN_DATE = QDateTime::fromTime_t(0);
// Last date that can be represented (... | TOOL | 0.862403 | 6.6528 |
d743d646-cc0d-4308-bfef-e2b81396dde1 | faizaafif/Leetcode | 83.cpp | //https://leetcode.com/problems/remove-duplicates-from-sorted-list/description/
class Solution {
public:
ListNode* deleteDuplicates(ListNode* head) {
ListNode* temp = head;
while(temp != nullptr and temp->next != nullptr){
if(temp->val == temp->next->val){
temp->next = t... | ALGO | 0.999881 | 5.719078 |
7bee1fe8-e7cf-4447-bbc0-9f63d368b9a2 | advankim/homeworks | p2/lab/zadanie_1.cpp | #include <iostream>
#include <string>
using namespace std;
void Display(unsigned char binary) {
for (int i = 128; i > 0; i /= 2) {
if (binary & i) {
cout << "1";
}
else {
cout << "0";
}
}
cout << endl;
}
//funkcja zamienia napis złożony z ośmiu zer... | ALGO | 0.999188 | 4.571199 |
fba3995a-3621-42b2-a8ce-2d2225c18faf | GZOSP-RUST/frameworks_av | media/libstagefright/codecs/m4v_h263/dec/src/pp_semaphore_luma.cpp | /*
------------------------------------------------------------------------------
INPUT AND OUTPUT DEFINITIONS
Inputs:
xpred = x-axis coordinate of the MB used for prediction (int)
ypred = y-axis coordinate of the MB used for prediction (int)
pp_dec_y = pointer to the post processing semaphore for curren... | ALGO | 0.999655 | 6.601039 |
f5e6d52e-062b-4131-8cbc-aab802745a9a | Gnaroshi/practice-algorithm-solvedac | With_Levels/Bronze/Bronze_2/10540.cpp | // problem: KLOPKA
// id: 10540
// time taken:
#include <bits/stdc++.h>
using namespace std;
int main(void)
{
ios::sync_with_stdio(false);
cin.tie(nullptr);
int n, mnx = 100, mny = 100, mxx = 0, mxy = 0, t;
cin >> n;
for (int i = 0; i < n; i++)
{
int x, y;
cin >> x >> y;
... | ALGO | 0.999917 | 4.719655 |
3849fcde-2f95-4b51-9afa-70930919f583 | vbonnici/grafe-sim | analysis/data/p02267/s818626897.cpp | #include <iostream>
using namespace std;
int main(){
int n;
cin >> n;
int xs[n];
for(int i = 0; i < n; ++i){
cin >> xs[i];
}
int q;
cin >> q;
int v = 0;
int cnt = 0;
for(int i = 0; i < q; ++i){
cin >> v;
for(int j = 0; j < n; ++j){
if(xs[j] ==... | ALGO | 0.999715 | 4.176749 |
b95d3cbd-d11d-485a-8fbe-eaad142ccdda | naringcode/algorithm-training | BaekjoonOnlineJudge/greedy/2217.cpp | #include <bits/stdc++.h>
using namespace std;
int n;
int arr[100'004];
int res;
int main()
{
ios_base::sync_with_stdio(false);
cin.tie(nullptr);
cout.tie(nullptr);
cin >> n;
for (int i = 0; i < n; i++)
{
cin >> arr[i];
}
sort(arr, arr + n);
for (int i = 0; i < n; i... | ALGO | 0.999458 | 3.866186 |
eeb60706-e6ba-4373-a932-3f5756d23618 | joelchaconcastillo/Codeforces | training/208_A/main.cpp | #include <bits/stdc++.h>
using namespace std;
void solve(){
string st;
cin >> st;
int i = 0;
string res = "";
while(i<st.size()){
if(st.substr(i,3) == "WUB"){
i+=3;
if(!res.empty() && res.back()!=' ')res+=" ";
}
else res+=st[i++];
}
while(!res.empty() && res.back()==' ')res.pop_... | ALGO | 0.999571 | 3.606441 |
63c6eb1a-cb18-4f74-8cb2-a93c11e62388 | ricejasonf/heavy-compiler | clang-tools-extra/clang-include-fixer/IncludeFixer.cpp | #include "IncludeFixer.h"
#include "clang/Format/Format.h"
#include "clang/Frontend/CompilerInstance.h"
#include "clang/Lex/HeaderSearch.h"
#include "clang/Lex/Preprocessor.h"
#include "clang/Parse/ParseAST.h"
#include "clang/Sema/Sema.h"
#include "llvm/Support/Debug.h"
#include "llvm/Support/raw_ostream.h"
#define DE... | TOOL | 0.92797 | 4.790877 |
fe24af9a-6d32-4870-ab4b-fb46a5459429 | rya23/AOA-Pracs | kmp.cpp | #include <bits\stdc++.h>
using namespace std;
void KMPSearch(string pattern,string text)
{
}
void computerlsp(string pattern,string text,)
int main()
{
string text = "ABABDABACDABABCABAB";
string pattern = "ABABCABAB";
KMPSearch(pattern,text);
return 0;
} | ALGO | 0.999901 | 4.239775 |
6fd5755c-021e-4937-a95e-a084206a9788 | endo1322/AtCoder | tessoku-book/a16/main.cpp | #include <bits/stdc++.h>
using namespace std;
#include <atcoder/all>
using namespace atcoder;
#define rep(i,n) for (int i = 0; (i) < (int)(n); ++ (i))
#define rep3(i,m,n) for (int i = (m); (i) < (int)(n); ++ (i))
#define rrep(i,n) for (int i = (int)(n) - 1; (i) >= 0; -- (i))
#define rrep3(i,m,n) for (int i = (int)(n) -... | ALGO | 0.999978 | 4.436608 |
814d7efa-0b57-471b-9a27-0168f73ee6e6 | pritham23/pritham | dijkstra.cpp | #include<stdio.h>
#include<stdlib.h>
int main(){
int node,source,i,j,k,n,min;
int visit[10],cost[10][10],dist[10],path[10];
printf("Input # of nodes: ");
scanf("%d",&n);
printf("Input cost function: \n");
for(i=0;i<n;i++){
for(j=0;j<n;j++){
scanf("%d",&cost[i][j]);
}
}
printf("Input source node: ");
sc... | ALGO | 0.999878 | 3.124124 |
fb372cc2-7815-4a74-924d-7a57e1b0d047 | jeongbbn/Algorithm | BOJ/12763.cpp | #include<iostream>
#include<vector>
#include<queue>
#include <tuple>
#include<algorithm>
#include<set>
#include<map>
#include <string>
using namespace std;
#define INF 1e9
typedef pair<int, int>pi;
typedef pair<int, pair<int, int>>pii;
int n, t, m;
vector<pii>adj[105];
vector<pi>mindist[105];
int pre[105];
queue<pii>p... | ALGO | 0.999959 | 4.18952 |
144d3baa-8147-4c5b-ba23-8038dacd42a1 | icelemon233/ECH-Leetcode | 数组/前缀和/1423.可获得的最大点数.cpp | /*
* @lc app=leetcode.cn id=1423 lang=cpp
*
* [1423] 可获得的最大点数
*/
// @lc code=start
#include <vector>
#include <algorithm>
#include <numeric>
using namespace std;
class Solution
{
public:
// // 剩余点数法
// // 转换为求sum减去中间的n-k张卡牌点数,同样能得到前后所选k张牌的最大点数
// int maxScore(vector<int> &cardPoints, int k)
// {
... | ALGO | 0.999932 | 6.058022 |
177925a2-a3dc-4de6-9a65-95792918c152 | ehllll/Computer_Algorithm | adjacency_array_DFS.cpp | #include <iostream>
#include <vector>
using namespace std;
int n, m;
int s, e;
//vector<int>는 노드의 인접한 정점들을 추가(가로), vecotr<vector<int>>는 세로의 노드를 표현
vector<vector<int> > adjArray;
vector<int> visited;
//가변길이의 배열 구현
void AddEdge(int start, int end){
adjArray[start].push_back(end);
adjArray[end].push_back(start... | ALGO | 0.99997 | 4.783518 |
51ea33db-2c1c-4169-b77d-c44d93204a87 | timazarenok/labs | project1/hmtask1/main.cpp | #include <iostream>
using namespace std;
int f(int a, int key)
{
return a^key;
}
int copy(int* dest, int* src, int size, int key)
{
for(int i=0; i < size; ++i)
{
dest[i] = f(src[i],key);
cout<< dest[i] <<endl;
}
}
void print_array(int* array, int size)
{
for(int i = 0; i < size; ++i... | ALGO | 0.999697 | 3.839727 |
42e73db0-0dba-4d2f-889e-42ee0e498533 | awa03/LeetCodeSolutions | Easy Questions/Excel_Sheet_Column_Number.cpp | class Solution {
public:
int titleToNumber(string ct) {
int res = 0;
for(char& c : ct)
res = res * 26 + (c - 'A' + 1);
return res;
}
};
| ALGO | 0.999847 | 6.298997 |
766ad9b7-0f23-4898-91cd-2efcb5612fed | rotarymars/atcoder_submissions | abc353/abc353_a/abc353_a.cpp | #ifndef MAIN_INCLUDED
#define MAIN_INCLUDED 1
#include __FILE__
signed main() {
cin.tie(nullptr);
ios_base::sync_with_stdio(false);
int n;
cin >> n;
vector<int> a(n);
cin >> a;
for (int i = 0; i < n; i++) {
if (a[i] > a[0]) {
cout << i + 1 << endl;
return 0;
}
}
cout << "-1\n";
r... | ALGO | 0.999976 | 4.077617 |
122665c2-8e86-424e-8fde-35ba5a997b1c | project-starch/capstone-gem5 | src/systemc/tests/systemc/misc/v1.0/dash6/speed.cpp | /*****************************************************************************
speed.cpp -- Definition of the speedometer.
Original Author: Ali Dasdan, Synopsys, Inc.
*****************************************************************************/
/*************************************************************... | ALGO | 0.92118 | 6.052741 |
804e7385-1269-42b5-9423-1f3303e1821b | maurodriguess/app_eleicao_representante | windows/runner/utils.cpp | #include "utils.h"
#include <flutter_windows.h>
#include <io.h>
#include <stdio.h>
#include <windows.h>
#include <iostream>
void CreateAndAttachConsole() {
if (::AllocConsole()) {
FILE *unused;
if (freopen_s(&unused, "CONOUT$", "w", stdout)) {
_dup2(_fileno(stdout), 1);
}
if (freopen_s(&unuse... | TOOL | 0.998733 | 6.76775 |
11e346fe-2066-43b1-bedb-3429c7a3b9ae | wuhuikai/SophiaGL | src/tools/obj_loader.cpp | #include <assimp/Importer.hpp> // C++ importer interface
#include <assimp/scene.h> // Output data structure
#include <assimp/postprocess.h> // Post processing flags
#include <tools/obj_loader>
namespace ObjLoader
{
void load_obj(const string& path, vector<unsigned short>& indices, vector<vec3>& ve... | TOOL | 0.939556 | 5.607093 |
12734fc5-6576-43ff-bf5e-a12777408e85 | MonalSD/Learn-C- | Functions/q1.cpp | // C++ code to implement Fibonacci series
#include<iostream>
using namespace std;
int fib(int n)
{
if(n==0)
return 0;
if(n ==1 || n==2)
{
return 1;
}
else
return (fib(n-1)+fib(n-2));
}
int main()
{
int n;
cout<<"Insert no. of elements in Fibonacci Series ";
cin>>n;
... | ALGO | 0.999836 | 4.360276 |
9a758a38-0801-45d0-b853-7cc83ed18234 | ishandutta2007/codeforces | gabrielpessoa/normal/935/C.cpp | #include <bits/stdc++.h>
using namespace std;
typedef vector<int> vi;
typedef long long ll;
typedef pair<int, int> ii;
typedef vector<ii> vii;
typedef pair<ii, int> iii;
typedef pair<ll, ll> llll;
const int SIZE = 1E5+5;
const int MOD = 1E9+9;
const int DELTA = 1E5+2;
const double PI = atan(1)*4;
const double EPS = ... | ALGO | 0.999826 | 3.180016 |
5c60d724-e33e-4975-84c5-3ec9908109cb | durgesh2001/hacktoberfest_demo | Introductory_Problems/Permutations.cpp | #include<iostream>
using namespace std;
int main()
{
int n;
cin >> n;
if(n == 1)
cout <<"1\n";
else if (n < 4)
cout << "NO SOLUTION\n";
else if (n == 4)
cout << "2 4 1 3\n";
else
{
for (int i = 1; i <= n; i += 2)
cout << i << " ";
for... | ALGO | 0.999986 | 3.672881 |
dc798e80-6766-4e66-ac59-d900ac5a3dbb | bravefyy/leetcode-algo | Leetcode-book/sword_for_offer/codes/cpp/sfo_19_regular_expression_matching_s1/sfo_19_regular_expression_matching_s1.cpp | /*
* File: sfo_19_regular_expression_matching_s1.cpp
* Created Time: 2021-12-09
* Author: Krahets (<EMAIL>)
*/
#include "../include/include.hpp"
// ===== Solution Code =====
class Solution {
public:
bool isMatch(string s, string p) {
int m = s.size() + 1, n = p.size() + 1;
vector<vector<bool... | ALGO | 0.999549 | 5.157987 |
357a733d-2743-415f-8f7c-e74032610ea1 | umaidansari12/CP_Backup | previous_codes/level_order_traversal.cpp | class Solution {
public:
vector<vector<int>> levelOrder(TreeNode* root) {
queue<pair<TreeNode*, int>> q;
int lvl = 0;
q.push(make_pair(root, lvl));
map<int, vector<int>> r;
while (!q.empty())
{
TreeNode* t = q.front().first;
lvl = q.front().sec... | ALGO | 0.999987 | 5.79192 |
35085dc8-76b5-4764-bad6-f70defc04371 | ceegeechow/DSA | DSA2/graph.cpp | #include "graph.h"
#include "heap.h"
#include <stdio.h>
#include <iostream>
#include <fstream>
#include <sstream>
using namespace std;
graph::graph()
{
mapping = new hashTable(100);
}
void graph::makeGraph()
{
string filename;
cout << "Enter name of input file: ";
cin >> filename;
ifstream fin(fil... | ALGO | 0.996941 | 4.189138 |
3864482e-e6dd-433f-814f-8b33d181648c | noclaverdad/GODOT-FORK | thirdparty/embree/kernels/bvh/bvh_intersector_hybrid.cpp | #include "bvh_intersector_hybrid.h"
#include "bvh_traverser1.h"
#include "node_intersector1.h"
#include "node_intersector_packet.h"
#include "../geometry/intersector_iterators.h"
#include "../geometry/triangle_intersector.h"
#include "../geometry/trianglev_intersector.h"
#include "../geometry/trianglev_mb_intersector.... | ALGO | 0.999649 | 7.290206 |
5f2ee81b-d933-4c42-8319-c2da3f32f343 | spestushko/OOP244EF | F/01-Jan15/modular/itemMain.cpp | #include <cstdio>
using namespace std;
#include "tools.h"
#include "item.h"
int menu();
int main(){
struct Item I[MAX_ITEMS];
FILE* fptr = fopen("items.txt", "r");
int i = 0;
int done = 0;
if (fptr){
i = loadItems(I, fptr);
fclose(fptr);
do{
switch (menu()){
case 1:
... | TOOL | 0.939854 | 3.613307 |
e0733d6c-f779-419a-8400-bfae5859251b | Sarmouts/MathFlare-Calculators | acidmetalreact.cpp | #include <iostream>
#include <string>
using namespace std;
string replace(string str)
{
string final = "";
for (int i = 0; i <= str.length(); i++)
{
if (str[i] != '1')
{
final += str[i];
}
}
return final;
}
string parenthesis(string str, int v)
{
string final = "(" + str + ")";
if (str.length() != 3 ||... | ALGO | 0.978391 | 4.052651 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.