uuid string | repo_name string | relative_path string | content string | category string | algo_rel_score float64 | quality_score float64 |
|---|---|---|---|---|---|---|
80d207ac-8a31-4225-a09a-6699a0d1766b | ishandutta2007/codeforces | fengzhengwei/normal/1610/C.cpp | #include<bits/stdc++.h>
#define ll long long
using namespace std;
char gc(){static char buf[1<<16],*s,*t;if(s==t){t=(s=buf)+fread(buf,1,1<<16,stdin);if(s==t)return EOF;}return *s++;}
//#define getchar gc
ll read()
{
char c;
ll w=1;
while((c=getchar())>'9'||c<'0')if(c=='-')w=-1;
ll ans=c-'0';
while((c=getchar())>='... | ALGO | 0.999982 | 4.060856 |
90a94542-96d2-4547-829c-e15536a47394 | Noodle96/contestProgramming | CDFC/800/team.cpp | #include <bits/stdc++.h>
using namespace std;
int main(){
int count = 0;
bool a,b,c;
int n; cin>>n;
bitset<3> BS;
while(n--){
cin>>a>>b>>c;
BS.set(0,a); BS.set(1,b);BS.set(2,c);
if(BS.count() >=2)count ++;
BS.reset();
}
cout << count << endl;
return 0;
} | ALGO | 0.999536 | 3.851042 |
d34978ab-f9cb-4ad5-8e2d-9fbc65555587 | SuWeizhe1124/C- | ch10/hw10_1/hw10_1.cpp | // hw10_1,
#include <iostream>
#include <cstdlib>
#define M 2
#define N 3
using namespace std;
int main(void)
{
int i,j;
int num1[M][N]={{2,2,6},{3,2,8}};
int num2[M][N]={{5,2,3},{3,3,7}};
int num3[M][N];
cout << "num1[][]=" << endl;
for(i=0;i<M;i++)
{
for(j=0;j<N;j++)
cout << *(*(nu... | ALGO | 0.997994 | 3.43534 |
e47ff697-7fd0-4592-ab7f-ecbdac97a7d5 | Cool1smylove/noobdream | C语言提高/P-矩阵翻转.cpp | #include <iostream>
#include <cstdio>
using namespace std;
int main(){
int n;
cin >> n;
int a[n][n];
for(int i = 0; i < n; i++){
for(int j = 0; j < n; j++){
cin >> a[i][j];
}
}
for(int i = n - 1; i >= 0; i--){
for(int j = 0; j < n; j++){
cout << a[i][j] << " ";
}
cout << endl;
}
return 0;
}
| ALGO | 0.999813 | 3.039027 |
d98eb6f0-c4ac-4dd1-b745-abfb03fd45e6 | iammarajul/competitive_programming | Codeforecs/1209A.cpp |
#include<bits/stdc++.h>
using namespace std;
int sc1() {int x; scanf("%d", &x); return x;}
long long sc2() {long long x; scanf("%lld", &x); return x;}
#define gcd(a,b) __gcd(a,b)
#define lcm(a,b) (a*b)/gcd(a,b)
#define Int sc1()
#define LL sc2()
#define For(n) ... | ALGO | 0.999952 | 3.884317 |
91e1e5a3-2a43-4d45-b1a2-a600ec8484d6 | DywangIT/PTIT-Programing | PTIT-C/KIEM_TRA_SO_FIBONACCI_1.cpp | #include<stdio.h>
#include<math.h>
int fibonacci(int n){
if(n == 1 || n == 2) return 1;
else return fibonacci(n - 1) + fibonacci(n - 2);
}
int main(){
int n;
scanf("%d", &n);
for(int i = 1; i < 1000000; i++){
if(n == fibonacci(i)){
printf("1");
break;
}
if(fibonacci(i) > n){
printf("0");
break;... | ALGO | 0.999995 | 3.197441 |
138b78a6-7af0-4895-887c-9586517cd6d1 | DukeHuangWP/GoExample-GoCV-Install-In-Windows | opencv-4.6.0/samples/cpp/stereo_match.cpp | #include "opencv2/calib3d/calib3d.hpp"
#include "opencv2/imgproc.hpp"
#include "opencv2/imgcodecs.hpp"
#include "opencv2/highgui.hpp"
#include "opencv2/core/utility.hpp"
#include <stdio.h>
#include <sstream>
using namespace cv;
static void print_help(char** argv)
{
printf("\nDemo stereo matching converting L and... | ALGO | 0.986979 | 5.32908 |
0200a49d-8716-4bf3-8cc9-8917e3c4a077 | kevinoduan/Kattis | babelfish.cpp | #include <iostream>
#include <map>
using namespace std;
int main(){
string in;
map<string, string> dict;
while(getline(cin, in)){
if(in.empty()){
break;
}
int counter = 0;
string key, value;
bool swap = false;
for (short i = 0; i<in.length(); i++... | ALGO | 0.997959 | 3.21497 |
06593ba8-e6c2-4b1a-b207-bcf2f481df1a | flamingfox/--Gamagora--Library | modele/csg/OpBin/opdif.cpp | #include "opdif.h"
OpDif::OpDif(Node *_a, Node *_b):
OpBin(_a, _b)
{
}
bool OpDif::inOut(const Vector3D &p) const
{
return (a->inOut(p) && !b->inOut(p));
}
float OpDif::potentiel(const Vector3D& p) const
{
return a->potentiel(p) - b->potentiel(p);
}
float OpDif::distance(const Vector3D &p) const
{
/... | ALGO | 0.984221 | 5.925338 |
5ef448c7-068d-4047-902b-426860b8bf0b | Ahnaf-41M/Codeforces_AtCoder | codeforces/463/B.cpp | #include <bits/stdc++.h>
#define pb push_back
#define int long long
#define endl "\n"
#define MX 100005
#define all(v) v.begin(),v.end()
#define gcd(a,b) __gcd(a,b)
#define lcm(a,b) (a*b)/gcd(a,b)
#define rep(i,a,b) for(int i = a; i <= b; i++)
#define... | ALGO | 0.999963 | 4.167796 |
2ac13baf-b5a0-48ab-8475-9b6a8beab6c4 | AravindR16/arav_does_datascience | wav2letter-master/src/criterion/backend/cpu/FullConnectionCriterion.cpp | #include "criterion/FullConnectionCriterion.h"
using namespace fl;
namespace w2l {
Variable FullConnectionCriterion::forward(
const Variable& input,
const Variable& target) {
int N = input.dims(0);
int T = input.dims(1);
int B = input.dims(2);
int L = target.dims(0);
if (N != N_) {
throw std::i... | ALGO | 0.86779 | 6.281475 |
bab6bd2f-d148-4afa-9b48-91b7bf4f0124 | FredericDT/ExploratoryResearchOnC-Cpp | TOFISH/Josephus/main.cpp | #include<iostream>
int josephus_r(int n, int t) {
if (n == 1) {
return 0;
}
return (josephus_r(n - 1, t) + t) % n;
}
int josephus(int n, int t) {
int i = 0;
for (int j = 2; j <= n; ++j) {
i = (i + t) % j;
}
return i;
}
int main() {
std::cout << josephus(40,3) << std::e... | ALGO | 0.999885 | 4.854983 |
efc7da68-f478-4602-b03c-db3c088536a6 | hemanth2004/experiments | UnityProject/Assets/Non-Unity/dsa/leetcode_neetmap/Arrays/duplicate.cpp | #include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
class Solution
{
public:
bool containsDuplicate(vector<int> &nums)
{
sort(nums.begin(), nums.end());
int n = nums.size();
for (int i = 1; i < n; i++)
{
if (nums[i] == nums[i - 1])
... | ALGO | 0.999903 | 5.308601 |
772edf7b-da76-4c8c-8cb8-91d72cada712 | kasa021/atcoder-archives | math-and-algorithm/math_and_algorithm_r_29169018_WA.cpp | /*
* Author: kAsA02
* Submission URL: https://atcoder.jp/contests/math-and-algorithm/submissions/29169018
* Submitted at: 2022-02-08 14:54:40
* Problem URL: https://atcoder.jp/contests/math-and-algorithm/tasks/math_and_algorithm_r
* Result: WA
* Execution Time: 36 ms
*/
#include <bits/stdc++.h>
using namespace ... | ALGO | 0.999497 | 3.953055 |
c8e53a8d-4b3e-4cd5-90b8-1e2b5c39bfaa | mdelbra/two-photos-psf-estim | third_party/OrsaHomography_20120515/src/libOrsa/homography_model.cpp | /**
* @file homography_model.cpp
* @brief Homography matrix model
* @author Pascal Monasse, Pierre Moulon
*
* Copyright (c) 2011 Pascal Monasse, Pierre Moulon
* All rights reserved.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public L... | ALGO | 0.99488 | 6.94335 |
8976c270-8c7d-456e-9871-86c20e09cb27 | Shaktiswarup07/GfG | Largest Divisible Subset - GFG/largest-divisible-subset.cpp | //{ Driver Code Starts
#include <bits/stdc++.h>
using namespace std;
// } Driver Code Ends
class Solution {
public:
vector<int> LargestSubset(int n, vector<int>& nums) {
// Code here
sort(nums.begin(),nums.end());
// int n=nums.size();
vector<int>dp(n,1);
for(int i = 0 ; i... | ALGO | 0.99965 | 5.105906 |
d5ca3de7-e7fd-4811-8813-c8d4071b497a | TuanNAb22at/CTDL-GT | CodePtit/DSA06018.cpp | #include<bits/stdc++.h>
using namespace std;
int main(){
int t;
cin>>t;
while(t--){
int n;
cin>>n;
int a[n+1];
map<int,int> mp;
int m1=INT_MAX,m2=INT_MIN;
for(int i=1;i<=n;i++){
cin>>a[i];
mp[a[i]]++;
m1=min(m1,a[i]);
m2=max(m2,a[i]);
}
int ans=0;
for(int i=m1;i<=m2;i++){
if(mp[i]==0... | ALGO | 0.999784 | 4.406714 |
fe2d5c25-39ca-4646-9adb-c3c64d927697 | ish-123-m/test1 | C++/jewels-and-stones.cpp | // Time: O(m + n)
// Space: O(n)
class Solution {
public:
int numJewelsInStones(string J, string S) {
unordered_set<char> lookup;
for (const auto& j : J) {
lookup.emplace(j);
}
int result = 0;
for (const auto& s : S) {
result += lookup.count(s);
... | ALGO | 0.996564 | 6.022422 |
f7e5fbd1-2057-4881-abf3-c19e1fce1238 | ZhouWeikuan/DouDiZhu | code/frameworks/cocos2d-x/cocos/base/CCConfiguration.cpp | #include "base/CCConfiguration.h"
#include "platform/CCFileUtils.h"
#include "base/CCEventCustom.h"
#include "base/CCDirector.h"
#include "base/CCEventDispatcher.h"
NS_CC_BEGIN
extern const char* cocos2dVersion();
Configuration* Configuration::s_sharedConfiguration = nullptr;
const char* Configuration::CONFIG_FILE_... | CONFIG | 0.903486 | 6.133174 |
a27f2874-42f8-4c71-8f33-48b0b530a50c | D4nielS4ntos/javascript-typescript-html-css | cpp/exercicios/aula/arraylegal.cpp | #include <iostream>
#include <vector>
#include <math.h>
int main() {
int n;
int el;
bool legal = true;
std::vector<int> arr = {};
// std::cout << "digite o número: " << std::endl;
std::cin >> n;
for (int i=1; i<=n; i++) {
// std::cout << "digite outro número" << std::endl;
... | ALGO | 0.999943 | 3.845918 |
ab6f9da9-f947-423c-b07b-ff939e0d7e2a | rasxxxa/H-fIle-Static-Analizer | cplusplusparser/EmptyLinesRemover.cpp | #include "EmptyLinesRemover.h"
[[maybe_unused]]std::vector<std::vector<std::string>> EmptyLinesRemover::ParseLines(std::vector<std::string>& lines)
{
std::vector<std::string> lines_without_new_lines;
for (const auto& line : lines)
{
if (!IsOnlySpaces(line))
lines_without_new_lines.push_... | TOOL | 0.968732 | 4.811017 |
bcebb3a4-ce73-40ca-9f91-969bacbb8e90 | satyamsingh-stack/Leetcode | Dynamic Programming/416. Partition Equal Subset Sum.cpp | class Solution {
public:
bool subset_sum(vector<int> &nums,int sum,int n){
int t[n+1][sum+1];
for(int i=0;i<=n;i++)
t[i][0]=true;
for(int i=1;i<=sum;i++)
t[0][i]=false;
for(int i=1;i<=n;i++){
for(int j=1;j<=sum;j++){
if(nums[i-1]<=j... | ALGO | 0.999989 | 5.587673 |
1ec8c02a-bc49-424f-9855-89a0444c700b | scs/leanXopencv | src/cvaux/cvface.cpp | ///////////////////////////////////////////////
//// Created by Khudyakov V.A. <EMAIL>
//////////////////////////////////////////////
#include "_cvaux.h"
#include "_cvfacedetection.h"
Face::Face(FaceTemplate * lpFaceTemplate)
{
//init number of face elements;
m_lFaceFeaturesNumber = lpFaceTemplate->GetCount()... | ALGO | 0.904578 | 3.857053 |
9c52bd75-3fc8-43f7-af3b-9b82de70c9f7 | MNOWAK1234/PUTcourses | WDA/Lab09/Aibohphobia.cpp | #include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
string a, b;
int t;
int LongestCommonSubsequence(string one, string two)
{
vector<vector<int>> table;
vector<int> help;
for (int i = 0; i <= two.size(); i++)
help.push_back(0);
for (int i = 0; i <= one.size(); i++... | ALGO | 0.999822 | 5.167382 |
e433dfb3-3700-4682-8166-80836136789c | tiaraju/AA | URI/1069URI.cpp | #include <stdio.h>
#include <string.h>
#include <iostream>
using namespace std;
int main(){
int n,menor,total;
cin >> n;
string s;
for(int i=0;i<n;i++){
cin >> s;
menor =0;
total =0;
for(int k=0;k<s.length();k++){
if(s[k] == '<'){
menor++;
}else if (s[k]=='>' && menor>0){
total++;
menor... | ALGO | 0.999546 | 3.214544 |
6f3790d4-2012-4f40-9458-45d9763ea467 | blinderchief/CP_Practice | Contest_Sol/PWIOI_CodingClub_Contest_1_Find_the_Duplicate_Number.cpp | /**
* writer:blinderchief
**/
#include<bits/stdc++.h>
using namespace std;
#define ll long long int
#define f(i,a,n) for(int i = a; i < n; i++)
#define vll vector<ll>
#define vi vector<int>
#define pb push_back
#define po pop_back
#define me(a, x) memset(a, x, sizeof(a))
#define all(v) v.begin(), v.end()
#define no c... | ALGO | 0.999977 | 3.677148 |
3e5405a4-3792-43b3-8d3f-0a4ee59abb4c | wtrnash/HDU-ACM | 第二章基础数学/多项式求和.cpp | /**********************************************************************************************
Problem Description
ʽ£1 - 1/2 + 1/3 - 1/4 + 1/5 - 1/6 + ...öʽǰnĺ͡
Input
2ɣһmm<100ʾʵĸڶаm
ÿһ(Ϊn,n<1000öʽǰnĺ͡
Output
ÿʵnҪʽǰnĺ͡ÿʵռһУ2λС
Sample Input
2
1 2
Sample Output
1.00
0.50
*************************************************... | ALGO | 0.999914 | 4.29247 |
f77845ff-938e-492e-ac5d-dcf3adf995f6 | Acasune/Atcoder | abc130_c.cpp | #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double lb;
#define REP(i,j,n) for (int i=j;i<(n);i++)
#define RREP(i,n) for (int i = n; 0<i;i--)
#define print(out) cout<< out << "\n";
#define mod 1000000007
const int INF = 1e9;
int main(){
double W,H,x,y;cin>>W>>H>>x>>y;
bool is_c... | ALGO | 0.999646 | 3.289352 |
b41311b1-ee43-4f2b-90c4-07e9c89655c2 | sonnguyen69/sonbotuoi | Hopmat.cpp | #include<bits/stdc++.h>
using namespace std;
bool cmp(pair<int, int> a, pair<int, int> b) {
return a.second < b.second;
}
int main() {
int n; cin >> n;
vector<pair<int, int>> vp;
for (int i = 1; i <= n; i++) {
int x, y; cin >> x >> y;
vp.push_back({x, y});
}
sort(vp.begin(), vp.e... | ALGO | 0.99986 | 4.593206 |
7c73ef8b-0956-4060-9d4b-8e320261f682 | brayanzul/App-Products | 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.998859 | 6.785645 |
f60926ad-8536-4503-abe9-0c7d4e1e92ab | dorian-gabIer/Klasa_3AG | gol1.cpp | #include <iostream>
#include <string.h>
#include <cstring>
using namespace std;
int somsiedzi(int mat[12][20], int i, int j)
{
int c = 0;
for (int a = -1; a < 2; a++)
{
for (int b = -1; b < 2; b++)
{
if (a == 0 && b == 0) continue;
c += mat[(i+12+a)%12][(j+20+b)%20];
... | ALGO | 0.998985 | 3.451715 |
94d1c372-21bb-4189-8825-1f732ea56bd5 | starnight531/blue-bridge-exams-13-to-18 | exam2013_06.cpp | #include <iostream>
using namespace std;
//使用结构体的变量n记录已经走过的字符串下标,节省了递归函数的参数
struct EV{
int result; //最终结果
int n; //已经运算了的字符
};
//简单递归 5+2 -> +52
//题目递归3+5*(2+6)-1 -> -+3*5+261
//原本的逆波兰:两个数字出栈,与符号栈栈顶符号运算得出的结果入栈。《本题就是在找每次运算的结果》
struct EV evaluate(char* x){
struct EV ev = {0,0};
... | ALGO | 0.999986 | 3.792634 |
afaaf4a6-f188-40a0-a4cd-9db5ac2a118f | kayansh2004/Leetcode | 39-combination-sum/combination-sum.cpp | class Solution {
public:
vector<vector<int>> combinationSum(vector<int>& candidates, int target) {
vector<vector<int>> result;
vector<int> currentCombination;
backtrack(candidates, target, 0, currentCombination, result);
return result;
}
private:
void backtrack(vector<int>& ... | ALGO | 0.999964 | 7.046226 |
58b5a7a3-4c6c-4c5d-a776-a7e4a8ca305a | wenayy/leetcode-solutions | 792-binary-search/binary-search.cpp | class Solution {
public:
int search(vector<int>& nums, int target) {
int low =0;
int high =nums.size()-1;
while(low<=high){
int mid = (high + low) / 2;
if(nums[mid]==target) return mid;
else if(nums[mid]<target) low=mid+1;
else high=mid-1;
}
return -1;}
... | ALGO | 0.999922 | 6.134717 |
a50c08f4-afa1-4b40-a3db-a2afe9f483f2 | ajayjangid-51/cfcc | dsa/countSetBitsfrom1toN.cpp | #include <bits/stdc++.h>
using namespace std;
#define f first
#define s second
#define lb lower_bound
#define ub upper_bound
#define sz(x) x.size()
#define ll long long
#define pint unsigned int
#define pb push_back
#define vb vector<bool>
#define vi vector<int>
#define vs vector<string>
#define vvi vector<vi>
#defin... | ALGO | 0.999676 | 5.174742 |
0a64d113-6a08-437d-a1f9-a568af08a019 | skieffer/adapaca | cola/libcola/tests/scale_free.cpp | // generates a random graph with a power-law distribution of node degrees
// the algorithm is pretty much the Barabasi-Albert model but with an extra step
// so that I can guarantee the number of nodes in the graph.
// We begin with an initial chain of m nodes.
// Then, we add new nodes, connecting them to existing nod... | ALGO | 0.977446 | 5.045795 |
3dc53bf2-0c8f-49cc-8f6e-23872aec8f00 | trnjvj/cpp_ref | cmath/atan2b.cpp | #include <iostream>
#include <cmath>
using namespace std;
int main() {
double x = 10.0, y = -10.0;
double result = atan2(y, x);
// convert result to degrees
double degree = result * (180 / 3.141592);
cout << "atan2(y/x) = " << result << " radians" << endl;
cout << "atan2(y/x) = " << degree << " degrees"... | ALGO | 0.978091 | 5.223007 |
2fd3e0bf-aea5-4661-a3b5-fa29f74500ec | martinanibbi/LSN | lezione_06/Monte_Carlo_ISING_1D.cpp | /****************************************************************
*****************************************************************
_/ _/ _/_/_/ _/ Numerical Simulation Laboratory
_/_/ _/ _/ _/ Physics Department
_/ _/_/ _/ _/ Universita' degli Studi di Milano
_/ _/ ... | ALGO | 0.998068 | 4.483989 |
4db6404e-6943-480d-9eb6-982b17d7db5a | ishandutta2007/codeforces | zerokugi/normal/435/A.cpp | #include <iostream>
#include <algorithm>
#include <vector>
#include <queue>
#include <set>
#include <map>
#include <cstring>
#include <string>
#include <cstdlib>
#include <cstdio>
using namespace std;
typedef long long int ll;
typedef pair<int, int> pii;
typedef vector<int> vi;
#define REP(i,x) for(int i=0;i<(int)(x);i... | ALGO | 0.999938 | 3.198594 |
3011a7a0-50b0-4b68-860b-fa57b5584b51 | Vishu82828/C- | Cricket02.cpp | #include <iostream>
#include <string>
#include<math.h>
using namespace std;
class Cricket {
private:
int n;
string team[11] = {"Player1", "Player2", "Player3", "Player4", "Player5", "Player6", "Player7", "Player8", "Player9", "Player10", "Player11"};
int runs[11] = {0};
int currentPlayerIndex = 0;
pub... | ALGO | 0.963816 | 6.584085 |
249d06e6-5db4-46b5-9179-21308f97d913 | suchacutesnake/pat | 1060.cpp | //1060 Are They Equal
#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
//print string
string ps(string& s, int N) {
int n = s.size();
string ret = "0.";
//point position
int pos = n;
for (int i = 0; i < n; ++i) if (s[i] == '.') {
pos = i;
break;
}
... | ALGO | 0.999779 | 3.915197 |
5d029f8f-ae0e-4f18-af0a-025089754f33 | AllenAndrew01123/Competitve-Programming | Codeforces/TrackingSegments.cpp | #include <bits/stdc++.h>
using namespace std;
#define mod 1000000007
typedef long long ll;
void solve()
{
ll n, m;
cin >> n >> m;
vector<pair<ll, ll>> v(m + 1);
for (int i = 1; i <= m; i++)
cin >> v[i].first >> v[i].second;
ll q;
cin >> q;
vector<ll> queries(q + 1);
for (int i = ... | ALGO | 0.999985 | 4.663593 |
54cb2f31-1c96-4713-9cd5-cb692cebf1e0 | samuelchen2004/cpp | mst.cpp | int sz[mxN], par[mxN];
int get(int x) {return x == par[x] ? x : par[x] = get(par[x]);}
void unite(int x, int y) {
x = get(x), y = get(y);
if (x == y) return;
if (sz[x] > sz[y]) swap(x,y);
par[x] = y;
sz[y] += sz[x];
}
struct Edge {
ll u, v, weight;
bool operator<(Edge const& other) const {
return weight < oth... | ALGO | 0.999853 | 4.319873 |
cad1f51d-5d99-4e63-9053-ef4cc8a064f2 | hannahCapone/Projects | Transformer.cpp | #include "Transformer.h"
namespace ds {
// helper function for precedence
// 1: a > b, 2 a = b, 3: a <b
// * +/- =
bool precOrSame(Token a ,Token b)
{
// return true if a >= b
if (a.kind == b.kind)
{
return true;
}
// a is different than b
else if (a.is(Token::Kind::Asterisk))
{
return true;
... | ALGO | 0.994045 | 4.499063 |
6757d5e0-16ed-4288-b5f3-314b21545cf8 | aspect-ux/kanodesu.github.io | 刷题记录(主leetcode)/Cplusplus/Cplusplus/LeetCode/169_alot.cpp | #include<iostream>
#include<vector>
#include<unordered_map>
using namespace std;
class Solution {
public:
int majorityElement(vector<int>& nums) {
int n = nums.size() / 2;
unordered_map<int,int> hash;
for(int i = 0;i < nums.size(); i++){
hash[nums[i]] ++;
}
for(au... | ALGO | 0.999678 | 4.978129 |
2e69114f-ff1a-473d-88c8-4928a0d91bb3 | NagueAbiviolo/Beecrowd | Estrutura de Repetição/Quadrado e ao Cubo.cpp | #include <bits/stdc++.h>
int main()
{
int x;
scanf("%d", &x);
for (int i = 1; i <= x; i++)
{
printf("%d %d %d\n", i, i * i, i * i * i);
}
} | ALGO | 0.999652 | 3.202202 |
d80216a6-27b7-46e1-99a1-8c3ada1a882b | nankang2/BestRoute | test.cpp | #include "Graph.h"
#include "Airport.h"
#include "Route.h"
#include "Readfile.h"
#include "cs225/PNG.h"
#include "cs225/HSLAPixel.h"
#include <vector>
#include <iostream>
//#include "../cs225/catch/catch.hpp"
int main()
{
// Initialize the airport vector
vector<Airport> airports;
vector<int> airports... | ALGO | 0.987196 | 4.539531 |
1507f06a-7a53-4826-b2d8-5a42efa75c93 | dotSlash-Adwitiya/Problem-of-the-day | lastWordLength.cpp | #include<bits/stdc++.h>
using namespace std;
int lengthOfLastWord(string str) {
int i = str.size()-1;
int ansLength = 0;
while(i >= 0 && str[i] == ' ')
i--;
while(i >= 0 && str[i] != ' ') {
ansLength++;
i--;
}
return ansLength;
} | ALGO | 0.995959 | 4.677631 |
4c7bc2c0-29d4-4b8d-ac63-a5fc862b994d | KeyWaveTree/Algorithm-c-and-cpp | 1.Algorithm/nextop_problem_set/Lv.1/17 문자열 반복.cpp | #include<iostream>
#include<string>
using namespace std;
int main()
{
short i, j, k;
short n;
short r;
string s;
cin>> n;
for(i=0;i<n;i++)
{
cin>>r>>s;
for(j=0;j<s.length();j++)
{
for(k=0;k<r;k++)
{
cout<<s[j];
}
... | ALGO | 0.996102 | 3.022266 |
a5483f94-e941-4270-b67a-0e7fb88b7ad5 | SummonY/LintCode | 3Sum/3Sum.cpp | class Solution {
public:
/**
* @param numbers : Give an array numbers of n integer
* @return : Find all unique triplets in the array which gives the sum of zero.
*/
vector<vector<int> > threeSum(vector<int> &nums) {
vector<vector<int> > vvec;
sort(nums.begin(), nums.end());
... | ALGO | 0.99976 | 5.614898 |
bcb38019-c6bf-4dca-92ad-d3379290d0ff | prabowo02/toki-regular-open-contest | troc-15/troc-15-chemistry/spec.cpp | #include <bits/stdc++.h>
#include <tcframe/spec.hpp>
using namespace std;
using namespace tcframe;
const int MAXN = 200000;
const int MAXM = 200000;
class ProblemSpec : public BaseProblemSpec {
protected:
int N, M, T;
vector<int> X, Y, Z;
int K;
vector<int> S;
int ans;
void InputFormat() {
LINE(N,... | ALGO | 0.999688 | 4.406124 |
4037ff68-5c89-4ca7-9bed-e1f3841527f1 | txgcwm/code_study | cplusplus/boost/boost_1_63_0/libs/graph/example/family-tree-eg.cpp | enum family
{ Jeanie, Debbie, Rick, John, Amanda, Margaret, Benjamin, N };
int
main()
{
using namespace boost;
const char *name[] = { "Jeanie", "Debbie", "Rick", "John", "Amanda",
"Margaret", "Benjamin"
};
adjacency_list <> g(N);
add_edge(Jeanie, Debbie, g);
add_edge(Jeanie, Rick, g);
add_edge(Jeanie... | ALGO | 0.988031 | 4.287706 |
2ddc4991-b706-48e7-ad74-30e9e4417ee4 | RahulDadhich26/GeeksforGeeks-160Days-DSA-Challenge | Difficulty: Easy/Reverse Using Stack/reverse-using-stack.cpp | class Solution {
public:
string reverse(const string& s) {
stack<int>st;
string S = "";
for(auto it : s){
st.push(it);
}
while(!st.empty()){
char top = st.top();
S += top;
st.pop();
}
return S;
}
}... | ALGO | 0.999884 | 6.552944 |
73929206-2174-4296-9b30-790df69a84d3 | AhmedEzzat1094/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 |
31ba0b22-f7c3-4bf0-82cd-c69b85e1bfb0 | OpenDigitalTwin-Dev/FENGSim | toolkit/Geometry/cgal/examples/Segment_Delaunay_graph_Linf_2/sdg-fast-sp-linf.cpp | // standard includes
#include <iostream>
#include <fstream>
#include <cassert>
// example that uses the filtered traits,
// the segment Delaunay graph and the spatial sorting
// choose the kernel
#include <CGAL/Simple_cartesian.h>
typedef CGAL::Simple_cartesian<double> K;
// typedefs for the traits and the algorith... | ALGO | 0.977117 | 5.13074 |
96433d5d-089b-4505-aba5-b49b6672cf92 | Sanket-Mathur/100-days-of-code | Medium Level Problems/Multiply two strings.cpp | // { Driver Code Starts
#include<bits/stdc++.h>
using namespace std;
// } Driver Code Ends
class Solution{
public:
/*You are required to complete below function */
string multiplyStrings(string s1, string s2) {
if (s1 == "0" || s2 == "0") {
return s1 == "0" ? s1 : s2;
}
... | ALGO | 0.999874 | 6.196899 |
91e90b3b-f7f2-4bbf-8a38-20cb126a39be | Harveen19/DSA-Questions-Using-CPP-and-JAVA | STACK/Infix to Postfix.cpp | #include<iostream>
#include<stack>
#include<math.h>
using namespace std;
int prec(char c){ // precedence of current character
if(c=='^'){
return 3;
}
if(c=='/' || c=='*'){
return 2;
}
if(c=='+' || c=='-'){
return 1;
}
else{
return -1; // when string is empty ... | ALGO | 0.999701 | 4.554072 |
5a986825-9a98-47bb-b6ed-6a04b2ce4616 | mohamadsh132/ProyectoMo1 | ParcialMO/Mayor13.cpp | //
// Created by lufe0 on 7/05/2021.
//
#include "Mayor13.h"
float Mayor13::jugar(float gonzosApostar) {
int opcion;
float gonzosResultado;
float lowestResult = 0.5;
int numMaxRandom = 13;
int numMinRandom = 1;
srand(time(nullptr));
// para calcular numero aleatorio variable = limite_infe... | ALGO | 0.982626 | 4.655451 |
a63a46bf-b397-4a62-88f6-7f531cc9f132 | ishandutta2007/codeforces | maksim1744/normal/977/F.cpp | /*
06.05.2018 17:45:07
*/
#include <bits/stdc++.h>
using namespace std;
const bool debug = false;
int main(int argc, char const *argv[])
{
if (debug) {
freopen("input.txt", "r", stdin);
freopen("output.txt", "w", stdout);
}
int t = 4;
if (!debug) {
t = 1;
}
for (i... | ALGO | 0.999988 | 4.087874 |
2520a538-83b8-4298-b7fa-e4298c088ef0 | weedo3d/WEEDOX40firmware | Marlin/src/libs/crc16.cpp | #include "crc16.h"
void crc16(uint16_t *crc, const void * const data, uint16_t cnt) {
uint8_t *ptr = (uint8_t *)data;
while (cnt--) {
*crc = (uint16_t)(*crc ^ (uint16_t)(((uint16_t)*ptr++) << 8));
for (uint8_t i = 0; i < 8; i++)
*crc = (uint16_t)((*crc & 0x8000) ? ((uint16_t)(*crc << 1) ^ 0x1021) : (... | ALGO | 0.997264 | 4.764662 |
8cc3c734-65fd-49f1-a282-8d62f9cf16a8 | Moxoo/llm-server | third_party/MNN/source/backend/cpu/compute/ResizeFunction.cpp | #include "backend/cpu/compute/ResizeFunction.h"
#include <math.h>
#include "core/AutoStorage.h"
#include "core/Macro.h"
#include "math/Vec.hpp"
using namespace MNN::Math;
using Vec4 = Vec<float, 4>;
using Vec16 = Vec<float, 16>;
using Vec8 = Vec<float, 8>;
// F = -0.5
static Vec4 CubicInterpolation(Vec4& A, Vec4& B, V... | ALGO | 0.989947 | 5.733761 |
947e8caa-8a5b-4759-b2f3-53ea03617ed8 | aurora1409/CPP_Pro | spoj/Untitled69.cpp | #include<bits/stdc++.h>
using namespace std;
int main()
{
string s;
cin>>s;
int count=1,sum=0;
if(s=="0"||s=="1"||s=="2"||s=="3"||s=="4"||s=="5"||s=="6"||s=="7"||s=="8"||s=="9")
cout<<"0";
else
{
for(int i=0;i<s.size();i++)
{
sum+=s[i]-'0';
}
// cout<<sum<<" ";
if(sum<10) cout<<"1";
else
{
... | ALGO | 0.999948 | 3.446183 |
cb0b5fd8-bb03-4bd6-a9c7-91d40603582b | cedric102/Particle_Attraction | Implementation_1.cpp | #include "Implementation_1.h"
#include "gravity_point.h"
#include "Particle.h"
#include <iostream>
Implementation_1::Implementation_1()
{
}
void Implementation_1::Run() {
Gravity_Point *g = new Gravity_Point();
g->setForce( 0.2 );
Element *p = new Particle( 3 , 2 );
p->setXVel( 0.3 );
p->setYVel(... | ALGO | 0.997747 | 4.099985 |
344f9498-2503-4d73-8860-9e54609c2ad3 | Tsianmy/AKNN | demos/test_mq1.cpp | #include "../include/AKNN_EX.h"
#include <omp.h>
#include <vector>
using namespace aknn;
#ifdef GIST
const char
*basename = "../data/gist_base.fvecs",
*queryname = "../data/gist_query.fvecs",
*graphname = "../data/gist_100NN_100.graph",
*gtname = "../data/gist_groundtruth.ivecs",
*Rname = "../data/gist_R.fvecs",
*code... | ALGO | 0.999029 | 4.00351 |
e63f9315-af8e-4d1b-af11-5e9741fc528e | lleviackermann/CpCodes | codeforces/E_Expression_Correction.cpp | #include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace std;
using namespace __gnu_pbds;
template <typename T>
using ordered_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
#define endl "\n"
#define fo(i, n) for (i = 0;... | ALGO | 0.999357 | 3.896791 |
d7f237ab-5b07-4878-b8fb-836fcd9da835 | kaloronahuang/KaloronaCodebase | Practices/BZOJ/BZ2242.cpp | // BZ2242.cpp
#include <bits/stdc++.h>
#define ll long long
using namespace std;
int T, K;
ll quick_pow(ll bas, ll tim, ll mod)
{
ll ans = 1;
while (tim)
{
if (tim & 1)
ans = ans * bas % mod;
bas = bas * bas % mod;
tim >>= 1;
}
return ans;
}
ll exgcd(ll a, ll b, l... | ALGO | 0.999957 | 3.79415 |
e54c7f1d-1275-47a1-aba4-7b6629478b23 | qsnake/trilinos | packages/anasazi/test/ARPACKExamples/cdriver.cpp | #include "AnasaziConfigDefs.hpp"
#include "AnasaziBasicEigenproblem.hpp"
#include "AnasaziLOBPCG.hpp"
#include "AnasaziBlockDavidson.hpp"
#include "AnasaziBlockKrylovSchur.hpp"
#include "AnasaziBasicSort.hpp"
#include "Teuchos_CommandLineProcessor.hpp"
#include "AnasaziMVOPTester.hpp"
#include "AnasaziBasicOutputManage... | TEST | 0.910248 | 5.974787 |
f92dab20-31e3-4900-a5f7-b81cbe353646 | ishandutta2007/codeforces | tsukiko_tsutsukakushi/normal/1656/B.cpp | /**
* author: otera
**/
#include<bits/stdc++.h>
using namespace std;
#define int long long
using ll = long long;
using ld = long double;
using ull = unsigned long long;
using int128_t = __int128_t;
#define repa(i, n) for(int i = 0; i < n; ++ i)
#define repb(i, a, b) for(int i = a; i < b; ++ i)
#define repc(i, a,... | ALGO | 0.999968 | 4.412503 |
5aab480a-49ff-4157-872e-f63ab55d7ed2 | rai-roshan/2nd_year_oops_program | Assi_4/main.cpp | #include<bits/stdc++.h>
using namespace std;
struct n
{
char data;
int flag;
struct n *lt;
struct n *rt;
};
typedef struct n node;
struct stac
{
node *add;
struct stac *next;
};
class stk
{
struct stac *top;
public:
stk(){
top = NULL;
}
void push(node *ptr){
struc... | ALGO | 0.999735 | 4.012424 |
7c2b47e5-4005-434c-a124-9db616743529 | exceed96/baekjoon-judge | baekjoon.13305.cpp | /*https://www.acmicpc.net/problem/13305*/
#include <iostream>
#include <vector>
using namespace std;
int main(void)
{
cin.tie(0); ios_base::sync_with_stdio(0);
int N;
long long sum = 0; //sum int Ҽ ־ long long
cin >> N;
vector <long long> arr(N - 1);
vector <long long> arr2(N);
for (int i = 0; i < N - 1; ... | ALGO | 0.999909 | 3.089626 |
ab0b3a0c-0d14-4cf4-925c-52c77c61fea4 | stadia03/daily_grind | rotate Matrix by 90.cpp | #include <bits/stdc++.h>
using namespace std;
// TC: O(n^2)
// SC: O(n^2)
vector<vector<int>> rotateMatrix_brute(vector<vector<int>>& matrix,int n,int m){
vector<vector<int>> temp(n,vector<int>(m,0));
for(int i=0;i<n;i++){
for(int j=0;j<m;j++){
temp[i][m-(j+1)]=matrix[j][i];
}
}
return temp;
}
... | ALGO | 0.999904 | 5.270764 |
df74a48c-dfad-4ce1-a16c-260e14b50855 | neiomi1/AdventOfCode2020 | Day_13/main.cpp | #include <fstream>
#include <chrono>
#include <iostream>
#include "Day_13.h"
int main()
{
auto busHub = BusHub();
auto file_time = std::ofstream{ "..\\..\\..\\..\\Day_13\\execution_times.txt" };
auto start = std::chrono::high_resolution_clock::now();
busHub.read_entries("../../../../Day_13/input.txt");
auto sto... | ALGO | 0.945852 | 5.593773 |
740cc854-5b8a-4c8c-ab0a-de1907df11b2 | ML-UCV/ML-CodeBert-DistinctSolutions | Raw Dataset/evaluare/ast/test/ec560f53-0f69-45d7-9bbc-e615e2afb1a5.cpp | #include <cstdio>
#include <cstring>
#include <algorithm>
const int LMAX = 100005;
char s[LMAX];
struct Node {
Node *left{0}, *right{0};
int value{0};
char op{'#'};
};
Node* build(int left, int right);
Node* build_ops(int left, int right, const char* ops) {
int brackets = 0;
for (int i = right; i >= left; i-... | ALGO | 0.999948 | 4.152339 |
1bef461f-13d6-4f23-a07f-67af58fc41e6 | ajaysoni12/Striver_AtoZ_DSA_Sheet | Step8 - Greedy Algo/001-nMeetingInRoom.cpp | #include <bits/stdc++.h>
using namespace std;
struct meeting
{
int start, end;
int pos;
};
bool cmp(struct meeting m1, struct meeting m2)
{
if (m1.end < m2.end)
return true;
else if (m1.end > m2.end)
return false;
else if (m1.pos < m2.pos)
return true;
return false;
}
... | ALGO | 0.999988 | 3.928074 |
6f674cb7-7eb9-4336-b207-45c13064a556 | jaatcoder/C | func1.cpp | #include <bits/stdc++.h>
using namespace std;
void cel(int a,int b)
{
int ans;
if(a%b==0)
ans=a/b;
else ans=a/b+1;
cout<<ans<<endl;
int ans1=a/b;
cout<<ans1<<endl;
}
int main()
{
int a,b;
cin>>a>>b;
cel(a,b);
} | ALGO | 0.998702 | 4.419814 |
02f8aa55-d6ba-4b16-b6ee-a6dc42643160 | Ziklon/algorithms | tc/testprograms/Badgers.cpp | #include <vector>
#include <list>
#include <map>
#include <set>
#include <queue>
#include <deque>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cst... | ALGO | 0.999867 | 4.712197 |
458691e5-d67c-446d-aa36-873d8374738a | MarkKim1/Leetcode | 105-construct-binary-tree-from-preorder-and-inorder-traversal/105-construct-binary-tree-from-preorder-and-inorder-traversal.cpp | /**
* Definition for a binary tree node.
* struct TreeNode {
* int val;
* TreeNode *left;
* TreeNode *right;
* TreeNode() : val(0), left(nullptr), right(nullptr) {}
* TreeNode(int x) : val(x), left(nullptr), right(nullptr) {}
* TreeNode(int x, TreeNode *left, TreeNode *right) : val(x), l... | ALGO | 0.999982 | 6.542629 |
b049ffb0-8634-4339-af82-c61339f24554 | manikanta2901/ubuntu | .history/codingChallenges/cpp/Codechef/longChallenges/Year2021/January/answer_20210105122936.cpp | // #include <bits/stdc++.h>
// using namespace std;
// int findMin(int arr[], int n)
// {
// int sum = 0;
// for (int i = 0; i < n; i++)
// sum += arr[i];
// bool dp[n+1][sum+1];
// for (int i = 0; i <= n; i++)
// dp[i][0] = true;
// for (int i = 1; i <= sum; i++)
// dp[0][i] = false;
// for (int i=1; i<=n... | ALGO | 0.999965 | 4.839179 |
6ce763ee-ac7c-448e-b745-db4cdd12c9c7 | shreya22/coding | geeksforgeeks/dp/coin-change.cpp | #include <bits/stdc++.h>
using namespace std;
#define FOR(i, n) for(int i=0; i<n; ++i)
#define FOR1(i, n) for(int i=1; i<n; ++i)
#define FORrev(i, n) for(int i=n-1; i>=0; --i)
#define pb push_back
#define ll long long
int min(int a, int b){
return (a<b)?a:b;
}
int max(int a, int b){
return (a>b)?a:b;
}
int ... | ALGO | 0.999991 | 4.004673 |
5f71633e-9ea4-48b9-a741-e05fb9846b60 | kovaxis/progcomp | problems/tcarg2024/3/b.cpp | #pragma GCC optimize("Ofast")
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define repx(i, a, b) for (int i = a; i < b; i++)
#define rep(i, n) repx(i, 0, n)
#define invrepx(i, a, b) for (int i = b - 1; i >= a; i--)
#define invrep(i, n) invrepx(i, 0, n)
const ll INF = 1e18;
struct Dinic {
... | ALGO | 0.999108 | 4.342675 |
6d77a01a-cdf4-4ada-b89c-bded982237e4 | whitecy01/coding-test | coding-test/정재윤/3주차/큐/수업정리/queue_test.cpp |
#include <bits/stdc++.h>
using namespace std;
const int MX = 1000005;
int dat[MX];
int head = 0, tail = 0;
void push(int x){
dat[tail] = x;
tail++;
}
void pop(){
head++;
}
int front(){
return dat[head];
}
int back(){
return dat[tail - 1];
}
void test(){
push(10); push(20); push(30);
cout ... | ALGO | 0.921785 | 4.112472 |
99d309c2-1228-4f4c-86d6-fdd4409111cb | ssbb1166/algorithm-problem-solving | prefix-sum/boj1806.cpp | #include <algorithm>
#include <iostream>
#define INF 100000
using namespace std;
int n, s, len = INF, p[100001];
int main()
{
cin >> n >> s;
for (int i = 1; i <= n; i++) {
cin >> p[i];
p[i] += p[i - 1];
}
int end = 1;
for (int start = 1; start <= n; start++) {
while (p[en... | ALGO | 0.999856 | 3.464627 |
5debc3ad-89ef-43c4-bf85-bbd80e8fc110 | Thyme0113/astnn_with_semi-supervised_learning | ssl_500/data/src/fibonacci/recursive90.cpp | int memo[45];
int fib(int n) {
if (n <= 1)
return 1;
if (memo[n] != 0)
return memo[n];
return memo[n] = fib(n-1) + fib(n-2);
}
int main() {
int n;
cin >> n;
fill_n(memo, 45, 0);
cout << fib(n) << endl;
return 0;
}
| ALGO | 0.999985 | 5.493934 |
f25eeb10-b8d6-46a0-8c6c-172d5dd48f7e | ishandutta2007/codeforces | mtsd/normal/981/C.cpp | #include <iostream>
#include <vector>
#include <string>
#include <cmath>
#include <algorithm>
#include <utility>
#include <queue>
#include <set>
#include <map>
#include <deque>
#include <iomanip>
#include <cstdio>
using namespace std;
typedef long long ll;
typedef pair<int,int> PII;
typedef vector<int> VI;
typedef ve... | ALGO | 0.999921 | 3.320143 |
6fa069d6-47ba-4e67-8f63-89475f08c33b | plasmatic1/dmoj-solutions | cpp/oly18novp2.cpp | #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
struct ass{ // Ass for assignment
int d, p; // not actually dp
ass(int d0, int p0) : d(d0), p(p0){}
ass() : d(-1), p(-1){}
friend bool operator<(const ass &a, const ass &b){
return a.p > b.p;
}
};
const int MAX = 1000000;
struct disjoint{... | ALGO | 0.999854 | 3.89049 |
af6e65ca-0bae-4f25-ac2a-52eabdc788cd | Mugetsu-1/Sem-3-Labs- | Sem 3 Labs/Numerical Method/Num Mth Lab-3/NM L3 Q.7.cpp | #include <iostream>
#include <cmath>
// Function to be integrated
double f(double x) {
return x * x; // Example: x^2
}
// Weights and abscissas for 2-point Gauss quadrature
const double gauss_weights[2] = {1.0, 1.0};
const double gauss_points[2] = {-std::sqrt(1.0 / 3.0), std::sqrt(1.0 / 3.0)};
// Function to ca... | ALGO | 0.999228 | 6.156248 |
5a92c0d8-3a84-4b5d-af74-b38fe38bed3e | Bhushan-joshi/CPP14 | src/factorial.cpp | #include<iostream>
using namespace std;
int main(){
int num , fact=1;
cout<<"Enter a Number :- "<<endl;
cin>>num;
for (int i = 1; i <= num; i++)
{
fact = i*fact;
}
cout<<"factorial is :"<<fact<<endl;
return 0;
} | ALGO | 0.998639 | 3.204178 |
c1a40fcc-6a64-4637-a5b7-cb6363b05435 | SETURAJ/LeetCode-Solutions | minimum-operations-to-reduce-x-to-zero/Accepted/6-11-2022, 4_49_35 AM/Solution.cpp | // https://leetcode.com/problems/minimum-operations-to-reduce-x-to-zero
class Solution {
public:
int minOperations(vector<int>& nums, int x) {
int len=0,cur_sum=0,sum2=0;
for(int i=0;i<nums.size();i++)
sum2+=nums[i]; //total sum of the elements of array
sum2-=x; // sum after ... | ALGO | 0.999988 | 5.768234 |
a242ae42-d48a-4204-8e43-d034157e30c1 | khubaibilyas/CarND-Path-Planning-Project | src/Eigen-3.3/bench/bench_norm.cpp | #include <typeinfo>
#include <iostream>
#include <Eigen/Core>
#include "BenchTimer.h"
using namespace Eigen;
using namespace std;
template<typename T>
EIGEN_DONT_INLINE typename T::Scalar sqsumNorm(T& v)
{
return v.norm();
}
template<typename T>
EIGEN_DONT_INLINE typename T::Scalar stableNorm(T& v)
{
return v.sta... | TEST | 0.974351 | 6.666052 |
6ffe3240-85f5-4c0d-bb7c-c3bb985ed04a | cache-tlb/problem_solving | POJ/1159.Palindrome.cpp | // longest common sub-sequnce
#include <cstdio>
#include <algorithm>
#include <cstring>
int N;
const int MAXN = 5006;
char str[MAXN] = {};
char rts[MAXN] = {};
int cache[2][MAXN] = {};
int main() {
scanf("%d", &N);
scanf("%s", str);
for (int i = 0; i < N; i++) {
rts[i] = str[N - 1 - i];
}
... | ALGO | 0.999979 | 4.192747 |
c7d6748f-c4f6-4db5-9688-ae29b6260a35 | namefreezers/coursera_cpp_course1 | week4/w4_t04_files/src/w4_t04_files.cpp | #include <algorithm>
#include <fstream>
#include <iostream>
#include <map>
#include <set>
#include <string>
#include <vector>
using namespace std;
int main() {
ifstream input_f("input.txt");
if (!input_f.is_open()) {
cout << "error!" << endl;
}
string s;
while (getline(input_f, s)) {
cout << s << endl;
}
r... | ALGO | 0.907117 | 3.342839 |
b194542c-3f1c-41a9-b645-518280c82795 | jonofarc/pkgj_partitions | Boost-prefix/src/Boost/libs/multiprecision/performance/voronoi_performance.cpp | #ifdef _MSC_VER
#pragma warning(disable:4244)
#endif
#include <boost/polygon/detail/voronoi_predicates.hpp>
#include <boost/polygon/detail/voronoi_structures.hpp>
#include <boost/polygon/detail/skeleton_predicates.hpp>
#include <boost/random/mersenne_twister.hpp>
#include <boost/random/uniform_int_distribution.hpp>
#i... | TEST | 0.969329 | 6.788018 |
5e28df57-c9c7-43ee-972f-95e0518ee0a9 | subodh-malgonde/path-planning | src/Eigen-3.3/doc/examples/TutorialLinAlgExSolveColPivHouseholderQR.cpp | #include <iostream>
#include <Eigen/Dense>
using namespace std;
using namespace Eigen;
int main()
{
Matrix3f A;
Vector3f b;
A << 1,2,3, 4,5,6, 7,8,10;
b << 3, 3, 4;
cout << "Here is the matrix A:\n" << A << endl;
cout << "Here is the vector b:\n" << b << endl;
Vector3f x = A.colPivHouseholderQr... | ALGO | 0.999882 | 3.356631 |
10652ddd-9771-4acc-be4c-eba467a365e4 | GDevs/mission-farpoint | ogre/Components/Volume/src/OgreVolumeSimplexNoise.cpp | #include "OgreVolumeSimplexNoise.h"
#include <time.h>
namespace Ogre {
namespace Volume {
Real SimplexNoise::F3 = (Real)(1.0 / 3.0);
Real SimplexNoise::G3 = (Real)(1.0 / 6.0);
Vector3 grad3[] = {
Vector3(1,1,0), Vector3(-1,1,0), Vector3(1,-1,0), Vector3(-1,-1,0),
Vector3(1,0,1), Vect... | ALGO | 0.979008 | 6.851086 |
ff56012f-576c-478d-bf19-c6f15a970ce1 | ishandutta2007/codeforces | denisson/normal/208/C.cpp | #define _CRT_SECURE_NO_WARNINGS
#pragma comment(linker, "/STACK:256000000")
#include <iostream>
#include <fstream>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <ctime>
#include <cstring>
#include <algorithm>
#include <vector>
#include <string>
#include <map>
#include <set>
#include <queue>
#include <s... | ALGO | 0.999548 | 4.154707 |
1fd867e1-94df-4323-a03b-aa451515836b | xiaozhichuan/zhai_xinyi | 6.33/main.cpp | //fig.6.33.cpp
#include <iostream>
#include<cstdlib>
#include<ctime>
using namespace std;
int flip();
int main()
{
int Head = 0;
int Tail = 0;
srand(time(0));
for(int n=1;n<=100;n++)
{
if(flip()==0)
{
++Tail;
cout<< "Tail ";
}
el... | ALGO | 0.992891 | 4.120142 |
9f27fd80-bbb5-4afa-a5a8-ba8090bfc2a0 | ishandutta2007/codeforces | emthrm/normal/1175/C.cpp | #include <algorithm>
#include <bitset>
#include <cassert>
#include <cctype>
#include <chrono>
#define _USE_MATH_DEFINES
#include <cmath>
#include <cstdio>
#include <cstring>
#include <ctime>
#include <deque>
#include <functional>
#include <iostream>
#include <iterator>
#include <map>
#include <queue>
#include <random>
... | ALGO | 0.999984 | 4.498867 |
77cfeb18-51fb-4f82-b3f2-959176de01b6 | mlewandowski0/raytracer | objects/bvh_node.cpp |
#include "bvh_node.h"
#include "../utils/util.h"
#include <algorithm>
using namespace std;
inline bool box_compare(shared_ptr<hittable> a, shared_ptr<hittable> b, int axis)
{
aabb box_a, box_b;
if (!a->bounding_box(0,0, box_a) || ! b->bounding_box(0,0, box_b))
cout << "no bounding box in bvh_node cons... | ALGO | 0.997593 | 6.179312 |
95fb0deb-1960-4bd2-a12e-71267e05c712 | parth-03083/CPP | mergeArrayHeap.cpp | #include "bits/stdc++.h"
using namespace std;
int main(){
int k;
cin>>k;
vector<vector<int> > a(k);
for(int i=0;i<k;i++){
int size;cin>>size;
a[i]=vector<int> (size);
for(int j=0;j<size;j++){
cin>>a[i][j];
}
}
vector<int> idx(k,0);
priority_queue<... | ALGO | 0.999983 | 3.120447 |
7054ab15-f383-4539-a07a-53d13f49dd23 | VamsiKurapati/CPP-Programs | Sorting Algorithms/BubbleSort.cpp | #include <iostream>
#include <string>
#include <math.h>
#include <algorithm>
#include <vector>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <utility>
using namespace std;
typedef long long ll;
void swap(int *x,int *y){
int temp=*x;
*x=*y;
*y=temp;
}
void bubbleSort(int arr[],int ... | ALGO | 0.999083 | 4.533285 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.