uuid string | repo_name string | relative_path string | content string | category string | algo_rel_score float64 | quality_score float64 |
|---|---|---|---|---|---|---|
d0eb85cc-630a-4313-a5d0-bcb99f65cb91 | ktye-UF/PowerSystemTopology | ppgp/functions/Eigen/unsupported/bench/bench_svd.cpp | // Bench to compare the efficiency of SVD algorithms
#include <iostream>
#include <bench/BenchTimer.h>
#include <unsupported/Eigen/SVD>
using namespace Eigen;
using namespace std;
// number of computations of each algorithm before the print of the time
#ifndef REPEAT
#define REPEAT 10
#endif
// number of tests of t... | TEST | 0.997065 | 6.268869 |
1f894ec2-fd50-4e8c-b7b0-a087c67e5e67 | anisharma07/SEM5-LABS | COMPILER LAB/p3ii.cpp | #include <iostream>
#include <fstream>
#include <string>
// its compiler design lab
using namespace std;
int main() {
ifstream inFile("input.txt");
ofstream outFile("output.txt");
if (!inFile.is_open() || !outFile.is_open()) {
cerr << "Error opening files!" << endl;
return 1;
}
// com... | ALGO | 0.985708 | 5.395979 |
0636d9e4-4d0b-4315-9404-4995baea490b | AnasAbdullh/Language-Basics-Cpp | SecondsToDyasHoursMinutesSeconds.cpp | #include <iostream>
#include <cmath>
using namespace std;
int main()
{
int Seconds;
int Days = 24 * 60 * 60;
short Hours = 60 * 60;
short Minutes = 60;
float Second;
cout << "Enter the Seconds\n";
cin >> Seconds;
float Day = floor(Seconds / Days);
int remeber = Seconds % Days;
... | ALGO | 0.977779 | 3.41702 |
1d9c0ddb-d747-42fb-a179-fc02fd1bebb6 | thangbienhoa3/AlgorithmCoding | prime_queries.cpp | #include <iostream>
#include <vector>
#define max_len 200005
using namespace std;
long long int n;
void prime(vector <long long int> &v)
{
v[0] = v[1] = 0;
for(long long int i = 2; i <= max_len;i++)
{
if(v[i])
{
for(long long int j = i*i;j <= max_len;j=j+i) v[j] = 0;
}
... | ALGO | 0.999846 | 4.124156 |
1bb36b9e-f856-4592-a36f-a2840ac5884b | ishandutta2007/codeforces | merkurev/normal/1220/C.cpp | #include <iostream>
#include <cstdio>
#include <vector>
#include <map>
#include <set>
#include <algorithm>
#include <queue>
#include <cstring>
#include <string>
using namespace std;
#ifdef LOCAL
#define eprintf(...) fprintf(stderr, __VA_ARGS__)
#else
#define eprintf(...)
#endif
const int N = (int) 1e6 + 100;
... | ALGO | 0.999939 | 3.462537 |
1fd6e23f-019a-4288-8377-ddc67266ae84 | JustaHollowDot/nio_2023 | lightning_strike.cpp | #include <iostream>
#include <vector>
#include <algorithm>
bool timeline_sorter(int const& lhs, int const& rhs) {
return lhs < rhs;
}
int main1() {
int inhabitants, lightning_strikes;
std::cin >> inhabitants >> lightning_strikes;
std::vector<int> timeline_additions (inhabitants, 0);
std::vector<i... | ALGO | 0.999728 | 4.706481 |
d49589e8-39ee-4487-8d32-24b843b9e625 | VietHoang-206/Baitapnmlt | Kythuatdem-171/main.cpp | #include <iostream>
#define MAX 100
using namespace std;
void NhapMang(int arr[], int &n)
{
cin >> n;
for(int i = 0; i < n; i++)
{
cout << "a[" << i << "] = ";
cin >> arr[i];
}
cout << endl;
}
void XuatMang(int arr[], int n)
{
for(int i = 0; i < n; i++)
{
cout << "a["... | ALGO | 0.999436 | 3.526294 |
2701ba39-eab8-43d0-9f35-eab01a970253 | aaryagawade30/Competitive-Programming | Contests/B_Skibidus_and_Ohio.cpp | #include <bits/stdc++.h>
using namespace std;
int main()
{
int t; cin >> t;
while(t--) {
string s;
cin >> s;
bool flag = false;
for(int i = 0; i < s.length() -1; i++) {
if(s[i] == s[i +1]) flag = true;
}
if(flag) cout << 1 << endl;
els... | ALGO | 0.999844 | 3.966021 |
e45b1656-8edd-434a-b47c-9619c98eea48 | LILKOTYO/SimulationFramework | SimuFramework/libigl/python/py_igl/triangle/py_triangulate.cpp | m.def("triangulate", []
(
const Eigen::MatrixXd& V,
const Eigen::MatrixXi& E,
const Eigen::MatrixXd& H,
const std::string flags,
Eigen::MatrixXd& V2,
Eigen::MatrixXi& F2
)
{
return igl::triangle::triangulate(V, E, H, flags, V2, F2);
}, __doc_igl_triangle_triangulate,
py::arg("V"), py::arg("E"), py::arg("H... | ALGO | 0.863665 | 5.351171 |
de74206b-aa8d-45b9-b888-48b274f6a95f | MariaChrysafis/CompetitiveProgramming | Codechef/COOK132/EQDIFFER.cpp | #include <iostream>
#include <vector>
#include <map>
#include <algorithm>
#include <cmath>
#include <set>
#include <queue>
#define ll long long
using namespace std;
#define P(x, y) make_pair(x,y)
using namespace std;
void print(vector<int> v){
for(int i: v) cout << i << " ";
cout << endl;
}
void solve(){
i... | ALGO | 0.999663 | 4.696154 |
27be1590-efbe-4e16-840d-89a0a1593c43 | jins0704/Algorithm | C++/Programmers/Level3/자물쇠와열쇠/자물쇠와열쇠/main.cpp | //
// main.cpp
// 자물쇠와열쇠
//
// Created by 홍진석 on 2021/08/16.
//
#include <iostream>
#include <string>
#include <vector>
#include <set>
using namespace std;
set<pair<int,int>> rotate90(vector<vector<int>> &key){
vector<vector<int>> rotateV;
set<pair<int, int>> rotateS;
int ksize = int(key.size());
... | ALGO | 0.999938 | 5.178771 |
4fe28c08-eab7-4e12-915c-7dd0a190749d | dush1729/cp | submission/cses/sorting_and_searching/sum_of_two_values.cpp | #include "bits/stdc++.h"
using namespace std;
const int N=2e5+20;
int n,s;
pair <int,int> p[N];
int main()
{
scanf("%d%d",&n,&s);
for(int i=0;i<n;i++)
{
scanf("%d",&p[i].first);
p[i].second=i+1;
}
sort(p,p+n);
for(int l=0,r=n-1;l<r;)
{
int sum=p[l].first+p[r].first;
if(sum<s) l++;
else if(sum==... | ALGO | 0.999862 | 3.448172 |
536015b5-e20a-4331-9360-51a99cd49a43 | kvmhl/raytracing-project | project/include/eigen/doc/special_examples/random_cpp11.cpp | #include <Eigen/Core>
#include <iostream>
#include <random>
int main() {
std::default_random_engine generator;
std::poisson_distribution<int> distribution(4.1);
auto poisson = [&]() { return distribution(generator); };
Eigen::RowVectorXi v = Eigen::RowVectorXi::NullaryExpr(10, poisson);
std::cout << v << "\... | TOOL | 0.910377 | 3.172278 |
3fea1ed4-995e-4787-8b73-91f1c40efd53 | YB73/DSA-QUES | 0337-house-robber-iii/0337-house-robber-iii.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.99994 | 6.014177 |
13d3e2a1-fae9-442d-8c92-5e3f0c415ae1 | imtiaz1710/competitive-programming | codeforces/codeforces contest/Codeforces Round #671 (Div. 2)/b.cpp | #include <bits/stdc++.h>
#define fin freopen("/home/imtiaz/Desktop/in.txt", "r", stdin)
#define fout freopen("/home/imtiaz/Desktop/out.txt","w", stdout)
#define dbg(x) cerr << #x << ": " << x << endl
#define fastio ios::sync_with_stdio (false); cin.tie (0);
#define ll long long
#define US unsigned short int
#define MP... | ALGO | 0.999885 | 3.81645 |
1cbd57d1-f01d-43f4-9b73-5108b09de4bd | RiyaadHossain/XPSC-Practice | Contest/Codeforces/Round - 944 (Div 2)/test.cpp | #include <bits/stdc++.h>
using namespace std;
#define ye "YES"
#define no "NO"
#define int long long
/*
Lower Bound:
exist -> first occurance
not exist -> first greater than target
all values are less than target -> extra value than last element
*/
/*
Upper Bound:
exist/not ex... | ALGO | 0.999863 | 5.415382 |
313f7ab1-2ec5-461f-8c15-7b9291c9f49e | TasnimAnas/100DaysOfCodes | Day 4/4.cpp | /**
* Definition for singly-linked list.
* struct ListNode {
* int val;
* ListNode *next;
* ListNode() : val(0), next(nullptr) {}
* ListNode(int x) : val(x), next(nullptr) {}
* ListNode(int x, ListNode *next) : val(x), next(next) {}
* };
*/
class Solution
{
public:
ListNode *removeEleme... | ALGO | 0.999762 | 5.719236 |
8054d2f0-8dab-4d82-9523-ad7dae5b83cd | Andision/leetcode | climbing-stairs.cpp | #include <cstdio>
#include <iostream>
using namespace std;
class Solution {
public:
int climbStairs(int n) {
int dp[50];
int count = 0;
dp[0]=1;
dp[1]=1;
for(int i=2;i<=n;i++){
dp[i]=dp[i-1]+dp[i-2];
}
return dp[n];
}
};
i... | ALGO | 0.999905 | 5.254673 |
e17c7b67-ea9e-438a-9e1e-fcc3baa4f72e | ggutierrez/gecodert | examples/magic-square.cpp | #include <gecodert/gecodert.hh>
#include <gecodert/int.hh>
#include <gecodert/int/distinct.hh>
#include <gecodert/int/linear.hh>
#include <gecodert/int/rel.hh>
#include <iostream>
using namespace GecodeRT;
class MagicSquare : public GecodeSpace {
//Square size
const int n;
public:
MagicSquare(... | ALGO | 0.999773 | 6.181608 |
908e3d4a-7f1f-497d-9f04-e57655265248 | KostadinBundov/Introduction_to_Programming_2023_2024 | Exam/02Longest_Sequence_of_Digits_in_String/02Longest_Sequence_of_Digits_in_String.cpp | #include <iostream>
int myMax(int a, int b)
{
return a > b ? a : b;
}
bool isDigit(char ch)
{
return '0' <= ch && ch <= '9';
}
unsigned longestDigitSequence(const char* str, int currentCount = 0, int max = INT32_MIN)
{
if (!*str)
{
max = myMax(currentCount, max);
return max;
}
if (isDigit(*str))
{
curr... | ALGO | 0.999647 | 5.577087 |
613acfcf-1c0f-45bb-9c28-df4cae9a1853 | bishtsaurabh60/c-code-practice | binaryToDecimal.cpp | // Q binary To Decimal
#include <iostream>
#include <math.h>
using namespace std;
int binaryToDecimal(int n)
{
int sum = 0;
int a = 0;
int i = 0;
while (n > 0)
{
a = n % 10;
sum += a * pow(2, i);
n = n / 10;
i++;
}
return sum;
}
int main()
{
int a;
... | ALGO | 0.999595 | 4.649539 |
26a2b3ad-d080-4ba5-8a79-a8a57bfe8f9f | varenyamBakshi/cp-algorithms | Number Theory/sieve-of-eratosthenes.cpp | #include<bits/stdc++.h>
using namespace std;
vector<bool> isprime;
void init(int size){
isprime.resize(size,1);
isprime[0] = isprime[1] = false;
for(int i = 2; i*i < size; i++){
if(!isprime[i]) continue;
for(int j = i*i; j <size; j+=i){
isprime[j] = false;
}
}
}
in... | ALGO | 0.999848 | 4.481098 |
54db9e15-3e92-4771-8366-3f07d26d1e3c | shujatHusain/my-project | shujaat task 5.cpp | #include <iostream>
#include <string>
using namespace std;
class Song {
public:
string title;
Song* prev;
Song* next;
Song(string t) {
title = t;
prev = nullptr;
next = nullptr;
}
};
class Playlist {
Song* head;
public:
Playlist() {
head = nullptr;
}
... | ALGO | 0.998801 | 5.879666 |
59d021d6-f538-42d5-b56f-3a76cb842246 | CalciumArgon/SnakeGame | src/game.cpp | #include "game.h"
#include <QThread>
#include <fstream>
#include "aisnake.h"
#include "queue"
using namespace std;
typedef pair<size_t, size_t> Loc;
Game::Game(GameMode game_mode, size_t height, size_t width, std::vector<int> info) :
level(1),
game_mode(game_mode)
{
state = new Field(height, width);... | TOOL | 0.987028 | 3.354901 |
35baea7c-8dc8-4dd2-9158-a5b24a9210ec | crimcrist/CAWU1 | OJ/QLQ_10/C.cpp | #include <stdio.h>
#include <string.h>
int flag = 0;
int main(){
int N;
char nama[10005][1005];
scanf("%d", &N);
getchar();
for(int i = 0; i < N; i++){
scanf("%[^\n]%*c", nama[i]);
}
char search[1005];
scanf("%[^\n]%*c", search);
for(int i = 0; i < N; i++){
if(strcmp(search, nama[i]) == 0){
flag =... | ALGO | 0.99965 | 3.641917 |
a236959e-3abf-4229-9f6f-e93e7581282e | Heisenberg71/Competitive-Programming | Online Judge Submissions/Leetcode/Shortest Path Visiting All Nodes.cpp | /*
Problem Link: https://leetcode.com/problems/shortest-path-visiting-all-nodes/description/
*/
class Solution {
private:
int INVALID = -1;
vector<vector<int>> shortestDistance, ways;
int nodeSize;
void warshall(int nodeSize, vector<vector<int>>& graph){
shortestDistance.assign(nodeSize, v... | ALGO | 0.999948 | 5.9492 |
23e700dd-646c-4a77-8e64-a9d9188f0707 | Ahsan1Murtaza/NED-Cpp-OOPs-Lab-Tasks | Lab Task8/oel.cpp | // University Management System to demonstrate Composition and Aggregation
#include <iostream>
#include <vector>
#include <string>
using namespace std;
// Composition Class
class Address {
public:
string city, street;
Address(string c = "", string s = "") : city(c), street(s) {
cout << "[Address Create... | TOOL | 0.95073 | 6.133211 |
8e4c1f66-1297-4dde-8bad-463dd5c30286 | cherry900606/OJ_Solutions | ZeroJudge/d065.cpp | # include <iostream>
using namespace std;
int main()
{
int a,b,c;
cin>>a>>b>>c;
if(a>b&&a>c)
cout<<a<<endl;
else if(b>c)
cout<<b<<endl;
else
cout<<c<<endl;
return 0;
}
| ALGO | 0.999867 | 3.955802 |
a9476677-1990-49c3-ae4c-8fa09eca0922 | sarthak621/GREEDY-ALGO | 15195-623-45-jump-game-ii/15195-623-45-jump-game-ii.cpp | class Solution {
public:
int jump(vector<int>& nums) {
int l=0;
int r=0;
int jumps=0;
int n=nums.size();
while(r<n-1){
int farthest=0;
for(int index=l;index<=r;index++){
farthest=max(farthest,nums[index]+index);
}
... | ALGO | 0.99999 | 6.029586 |
92652608-67ba-45e4-b6a6-bcb83acc10a4 | KyLenMou/CF | Div. 4/Codeforces Round 886 (Div. 4)/F.cpp | #include<bits/stdc++.h>
#define x first
#define y second
#define IOS ios::sync_with_stdio(false), cin.tie(0), cout.tie(0)
#define endl '\n'
#define ll long long
#define pq(x) priority_queue<x,vector<x>,greater<x>>
#define PQ(x) priority_queue<x>
using namespace std;
typedef pair<int,int> PII;
const int N = 0;
void s... | ALGO | 0.99982 | 4.674124 |
629e77d2-9ede-496c-829e-acb63aca4b68 | refiel-l/caffe-libs | boost/boost_1_56_0/libs/math/example/policy_ref_snip8.cpp | // Note that this file contains quickbook mark-up as well as code
// and comments, don't change any of the special comment mark-ups!
//[policy_ref_snip8
#include <boost/math/distributions/negative_binomial.hpp>
using boost::math::negative_binomial_distribution;
using namespace boost::math::policies;
typedef negativ... | ALGO | 0.973515 | 4.666138 |
b0c36da7-01b5-4885-896d-9536b2d3cf6b | wsn1226/Rigid-Bodies | extern/libigl/tutorial/206_GeodesicDistance/main.cpp | #include <igl/readOBJ.h>
#include <igl/opengl/glfw/Viewer.h>
#include <igl/exact_geodesic.h>
#include <igl/colormap.h>
#include <igl/unproject_onto_mesh.h>
#include <igl/PI.h>
#include <iostream>
#include "tutorial_shared_path.h"
int main(int argc, char *argv[])
{
using namespace Eigen;
using namespace std;
Eige... | ALGO | 0.971907 | 6.326429 |
496fc0fa-92e7-4453-bc13-33f9461077fb | tkl-labo/NLP | n_gram/ohara/sentence2ngram.cpp | //
// 単語間がスペースで、文が改行で区切られた文から
// ngramをカウントするスクリプト
//
#include <map>
#include "common.h"
// global variables
int N;
// 一時的にngramを格納するvector。新しい単語が来るたびに更新
std::vector<std::string> tmp_ngram;
// ngramのvectorをkeyに、その出現関数をvalueとするmap
std::map<std::vector<std::string>, int> ngram_freq;
// functions
void initializeTmpNgram... | ALGO | 0.971367 | 5.79004 |
037f12b3-5949-4a40-802f-58b5b8ca8b4f | Volgarenok/mtt2 | main1.cpp | #include <algorithm>
#include <iostream>
#include <vector>
#include <unordered_map>
#include <iomanip>
#include <random>
#include <future>
#include <functional>
#include <cstdlib>
#include <cassert>
#include "clicker.hh"
template< class It, class F >
size_t omp_parallel(F f, It data, size_t s)
{
size_t res = 0;
#p... | ALGO | 0.998468 | 5.738148 |
5139e8d3-0bad-4b52-ad17-086d1953ff68 | hyeonseong0917/BOJ | ds/11279.cpp | #include <iostream>
#include <vector>
#include <algorithm>
#include <math.h>
#include <queue>
using namespace std;
int main() {
// your code goes here
ios_base :: sync_with_stdio(false);
cin.tie(NULL);
cout.tie(NULL);
int N=0;
cin>>N;
priority_queue<int> pq;
for(int i=0;i<N;++i){
int a=0;
cin>>a;
if(a=... | ALGO | 0.999926 | 4.233521 |
ea2679ce-713c-4ac4-a4f5-794366d1514f | Sajjad617/Problem-Solving-for-Cpp | LeetCode/696. Count Binary Substrings.cpp | class Solution {
public:
int countBinarySubstrings(string s) {
int re = 0;
int pre = 0;
int cur = 1;
for (int i = 0; i + 1 < s.length(); ++i){
if (s[i] == s[i + 1])
++cur;
else
{
re += min(pre, cur);
... | ALGO | 0.999968 | 6.289073 |
548b4566-517b-4e5f-9fda-78995fe24996 | beckerrh/simfemsrc | applications/interface/cpp/cr1iim.cpp | #include "cr1iim.hpp"
#include "Mesh/cutinterface.hpp"
#include "Mesh/edgesandcells.hpp"
#include "Alat/vectoronevariable.hpp"
#include "Alat/matrixonevariable.hpp"
#include "Alat/matrixallvariables.hpp"
#include <cassert>
/*--------------------------------------------------------------------------*/
CR1IIM::~C... | ALGO | 0.984836 | 4.12367 |
7feab55b-3487-442d-b5d9-8ac12ee650ed | pluveto/leet | 2021-11-12/300_v2.cpp | #include <debug.h>
class Solution {
public:
int lengthOfLIS(vector<int> &v) {
auto n = v.size();
if (n == 0)
return 0;
std::vector<int> dp(n);
dp[0] = 1;
int llis = 1;
for (int i = 1; i < n; i++) {
dp[i] = 1;
for (int k = 0; k < i; k++) {
if (v[k] < v[i]) {
... | ALGO | 0.99993 | 5.628405 |
5a4ac413-a9b5-462b-89b7-6098e42d1ba8 | NikoFellner/FlutterPlayground | quizzler_flutter/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.99842 | 6.76073 |
fa8d5a81-1dbf-421d-8543-ed3431512be1 | feysalabdi/ludo_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.998809 | 6.763549 |
ee871827-1890-4b95-96d9-da286c52147f | Capzera/Cpp | BitEdu/48Days/Day4/B.cpp | #include <bits/stdc++.h>
using namespace std;
int main() {
string table = "0123456789ABCDEF", ans = "";
int m, n;
cin >> m >> n;
if (!m) cout << 0;
if (m < 0) cout << "-";
m = abs(m);
while (m) {
ans += table[m % n];
m /= n;
}
reverse(ans.begin(), ans.end());
cout... | ALGO | 0.999972 | 4.624357 |
f81a3c10-0969-463d-8bd1-3c0e3cfd8e37 | tomoakiii/atcoder2 | Archive/abc257/b.cpp | #include <atcoder/all>
#include <bits/stdc++.h>
using namespace std;
using namespace atcoder;
#define rep(i,n) for (ll i = 0; i < (n); ++i)
template<typename T> inline bool chmax(T &a, T b) { return ((a < b) ? (a = b, true) : (false)); }
template<typename T> inline bool chmin(T &a, T b) { return ((a > b) ? (a = b, true... | ALGO | 0.999969 | 3.720591 |
46b1a4c0-e485-41ef-a62d-388ad5076b22 | Astronaut004/6Company30daysChallenge | Goldman Sache/Combination Sum III.cpp | /*
Question Overview
Find all valid combinations of k numbers that sum up to n such that the following conditions are true:
Only numbers 1 through 9 are used.
Each number is used at most once.
Return a list of all possible valid combinations. The list must not contain the same combination twice, and the combinations ... | ALGO | 0.999985 | 6.885697 |
264d6ee2-71c5-4a73-9b21-b515251c3833 | AetherBreaker/CIS205 | week4/assignments/Pairs.cpp | // Jacob Ogden
// 2/10/2023
#include <utility>
#include <iostream>
#include <vector>
using std::cout;
using std::endl;
using std::pair;
using std::vector;
pair<int, int> get_min_max(vector<int> vec) {
int min = vec[0];
int max = vec[0];
for (int i = 0; i < vec.size(); i++) {
if (vec[i] < min) {
... | ALGO | 0.997377 | 5.290007 |
a9106c05-0608-4e5d-b0e0-8a4938b5e4f7 | SoneWinstone/LeetCode | 122.买卖股票的最佳时机-ii.cpp | /*
* @lc app=leetcode.cn id=122 lang=cpp
*
* [122] 买卖股票的最佳时机 II
*
* https://leetcode-cn.com/problems/best-time-to-buy-and-sell-stock-ii/description/
*
* algorithms
* Easy (54.69%)
* Likes: 442
* Dislikes: 0
* Total Accepted: 69.9K
* Total Submissions: 127.3K
* Testcase Example: '[7,1,5,3,6,4]'
*
*... | ALGO | 0.999799 | 6.175249 |
22d8e939-7e1b-4932-a708-491cd6dbb315 | ishandutta2007/codeforces | sooke/normal/1083/A.cpp | #include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <algorithm>
#include <iostream>
#include <vector>
#include <queue>
#include <map>
#include <set>
inline int read() {
char c = getchar(); int n = 0; bool f = false;
while (c < '0' || c > '9') { if (c == '-') { f = true; } c = getc... | ALGO | 0.999941 | 4.069975 |
02aca4fc-dbcd-42e1-8f7d-7e92f34f23c5 | Bayashat/My-C_Plus_Plus | Tasks/KBTU/Lab/8/j.cpp | #include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
void bigDifference()
{
vector<int> v;
int n,x,y;
cin >> n;
for(int i=0;i<n;i++)
{
cin >> x;
v.push_back(x);
}
sort(v.begin(),v.end());
cout << v[n-1]-v[0];
}
int main()
{
... | ALGO | 0.999814 | 3.955557 |
35e4b465-704f-4022-8576-187cf8e11815 | about-anuj/Leetcode-Solutions | 169-majority-element/169-majority-element.cpp | class Solution {
public:
int majorityElement(vector<int>& nums) {
int c=0,ans;
for(auto i:nums)
{
if(c==0)
ans=i;
c+= (i==ans)?1:-1;
}
return ans;
}
}; | ALGO | 0.999827 | 5.528247 |
2a9f4508-85c1-4e1b-9ddb-69da188c3207 | vfolunin/archives-solutions | UVa Online Judge/12642.cpp | #include <iostream>
#include <algorithm>
#include <vector>
#include <set>
#include <map>
#include <string>
using namespace std;
bool solve() {
int cardCount;
unsigned long long roundCount;
if (!(cin >> cardCount >> roundCount))
return 0;
vector<vector<int>> to(cardCount, vector<int>(64));
... | ALGO | 0.999373 | 3.803084 |
3dcbdb36-0a4b-4e11-91f1-24ff3d7eb04f | kurokin-project/kurokin | src/coins.cpp | #include "coins.h"
#include "memusage.h"
#include "random.h"
#include <assert.h>
/**
* calculate number of bytes for the bitmask, and its number of non-zero bytes
* each bit in the bitmask represents the availability of one output, but the
* availabilities of the first two outputs are encoded separately
*/
void ... | TOOL | 0.94179 | 7.440789 |
825477da-1eeb-4aee-9bf8-2fb530ae9052 | Next-Gen-UI/Hacktober | Leetcode/0274. H-Index/0274-2.cpp | class Solution {
public:
int hIndex(vector<int>& citations) {
const int n = citations.size();
sort(begin(citations), end(citations));
for (int i = 0; i < n; ++i)
if (citations[i] >= n - i)
return n - i;
return 0;
}
};
| ALGO | 0.999885 | 6.601827 |
17d93d84-e658-4823-98a1-febef36e5b50 | thenameisvir/GFG-practice-problems | Difficulty: Basic/Last index of a character in the string/last-index-of-a-character-in-the-string.cpp | //{ Driver Code Starts
#include <bits/stdc++.h>
using namespace std;
// } Driver Code Ends
class Solution{
public:
int LastIndex(string s, char p){
int ans = -1;
for(int i=0;i<s.length();i++){
char ch = s[i];
if(ch==p){
ans = i;
}
... | ALGO | 0.999535 | 6.054995 |
1d78cb82-9c67-4441-a8fa-9e096b66c142 | SAMEERNITTALA/LeetCode-Daily | 0566-reshape-the-matrix/0566-reshape-the-matrix.cpp | class Solution {
public:
vector<vector<int>> matrixReshape(vector<vector<int>>& mat, int r, int c) {
if(mat.size() * mat[0].size() != r * c) return mat;
vector<vector<int>> v(r,vector<int>(c));
int x = 0, y = 0;
for(int i = 0; i < mat.size(); i++)
{
for(int j = 0... | ALGO | 0.999294 | 6.059578 |
522535f4-5fab-415f-9f21-23199eea2aaf | raincross7/code-similarity | codes/train_code/problem302/problem302_148.cpp | #include<bits/stdc++.h>
using namespace std;
#define ll long long
int main(){
ll l,r;
cin >> l >> r;
if(r-l>673){
cout << 0 << endl;
}else{
ll minmod=2018,i,j;
for(i=l;i<r;i++){
for(j=i+1;j<=r;j++){
minmod=min(minmod,(i*j)%2019);
}
}
cout << minmod << endl;
}
} | ALGO | 0.999875 | 3.506493 |
85413f51-958a-4752-8144-d04ca601c989 | aryanrahul1313/Data-Structure-and-Algorithm-DSA- | Recursion/Phone Keypad problem.cpp | class Solution {
private: //pass by reference krna h ans ko
void solve(string digits,string output,int index,vector<string>& ans,string mapping[]){
//base case
if(index >= digits.length()){
ans.push_back(output);
return;
}... | ALGO | 0.999902 | 6.778801 |
9cd82ce4-ce6c-4889-aef8-4463478585a2 | mtnvdsk/cp | B_Gorilla_and_the_Exam.cpp | #include <iostream>
#include <vector>
#include <unordered_map>
#include <algorithm>
using namespace std;
int main() {
int t;
cin >> t;
while (t--) {
int n, k;
cin >> n >> k;
vector<int> a(n);
unordered_map<int, int> freq;
// Input array and fr... | ALGO | 0.999988 | 5.739867 |
f563d2f9-65dc-4a4f-bf07-ab581de5ec6a | karol22/competitive_programming | codeforces/266a.cpp | #include <bits/stdc++.h>
#define _ ios_base::sync_with_stdio(0);cin.tie(0);
using namespace std;
int main(){ _
int n;
cin>>n;
int ans = 0;
char x, last = '.';
for(int i=0; i<n; i++){
cin>>x;
if(x == last){
ans++;
} else last = x;
}
cout<<ans;
retur... | ALGO | 0.99937 | 3.285281 |
5657b537-6580-4c89-9269-ee05dd0a5efd | naifjabir/naif | project4/simdquery.cpp | #include <iostream>
#include <fstream>
#include <sstream>
#include <unordered_map>
#include <vector>
#include <chrono>
#include <immintrin.h>
std::pair<std::unordered_map<std::string, int>, std::vector<int>> read_encoded_file(const std::string& encoded_file) {
std::ifstream file(encoded_file);
if (!file.is_ope... | ALGO | 0.997019 | 6.931419 |
34ade333-a136-475c-b0cb-a0ee540ff3f8 | sourav-122/hacktoberfest2022 | codechef_solutions/min_car.cpp | #include <iostream>
using namespace std;
int main() {
int i,t,n;
cin>>t;
for(i=0;i<t;i++)
{
cin>>n;
if(n%4==0)
{
cout<<n/4<<endl;
}
else if(n/4==0)
{
cout<<"1"<<endl;
}
else
{
cout<<n/4 + 1<<endl;
}
}
return 0;
}
| ALGO | 0.999951 | 3.12664 |
cf2b24c2-c31b-44dc-9806-f0bf983cb11b | Ayesha0765/code-challenge01 | day05.cpp | #include <bits/stdc++.h>
using namespace std;
string ltrim(const string &);
string rtrim(const string &);
int main()
{
string n_temp;
getline(cin, n_temp);
int n = stoi(ltrim(rtrim(n_temp)));
for(int i = 1; i<=10; i++)
{
cout<<n<<" x "<<i<<" = "<<n*i<<endl;
}
return 0;
}
string... | ALGO | 0.993948 | 4.09812 |
2fcdd457-60f1-4c54-801b-0db3db341bef | Chan531/BaekJoon_Online_Judge | 헤일스톤수열.cpp | #include <iostream>
#include <algorithm>
using namespace std;
int n, ans;
void input()
{
cin >> n;
}
void solution()
{
ans = n;
while (n != 1)
{
if (n % 2)
n *= 3, n++;
else
n /= 2;
ans = max(ans, n);
}
cout << ans << '\n';
}
void solve()
{
int tc;
cin >> tc;
while (tc--)
{
input();
... | ALGO | 0.999925 | 5.425136 |
b6e9b5c4-8a3e-463f-abbd-21687c6ebff3 | QbitQuantum/Basics | Исходники/Constant.cpp | //
// Do single unary node folding
//
// Returns a new node representing the result.
//
TIntermTyped* TIntermConstantUnion::fold(TOperator op, const TType& returnType) const
{
// First, size the result, which is mostly the same as the argument's size,
// but not always, and classify what is componentwise.
/... | TOOL | 0.994694 | 7.595677 |
876ab351-2927-4a99-b669-4f0dfcde0d15 | Jeevan-kumar-Raj/LeetCode-Algorithms-Solutions-Topicwise | minimum-time-difference.cpp | // Time: O(nlogn)
// Space: O(n)
class Solution {
public:
int findMinDifference(vector<string>& timePoints) {
static const int N = 60 * 24;
vector<int> minutes;
for (const auto& t : timePoints) {
minutes.emplace_back(stoi(t.substr(0, 2)) * 60 + stoi(t.substr(3)));
}
... | ALGO | 0.999647 | 6.398295 |
a73d0c19-659e-469e-8f87-17f2b7f7679d | Chandrapalumath/LeetCode | 1475-final-prices-with-a-special-discount-in-a-shop/1475-final-prices-with-a-special-discount-in-a-shop.cpp | class Solution {
public:
vector<int> finalPrices(vector<int>& prices) {
for(int i=0;i<prices.size();i++){
int discount=0;
for(int j=i+1;j<prices.size();j++){
if(prices[j]<=prices[i]){
discount=prices[j];
break;
}... | ALGO | 0.999969 | 5.631735 |
c7d23c0b-c1df-47f9-8fe3-44a98bebd8db | swalrus1/modular-synth | examples/chord.cpp | #include <cmath>
#include <iostream>
#include "../src/modules.h"
#include "../src/player.h"
#include "../src/synth.h"
#include "../src/unit.h"
const auto NOINP = kSynthNoInput;
template <std::size_t freq>
SynthData ModSine(SynthData i1, SynthData i2, SynthData i3, SynthData i4) {
const static double time_mod = 2... | TOOL | 0.899739 | 5.456025 |
8d342405-8a88-48de-83c4-c5f098fa493b | kinantanbagaspati/competitive-programming | CodeForces/1913B.cpp | #include<bits/stdc++.h>
using namespace std;
#define pll pair<long long, long long>
int t, nb[2], tot[2];
string s;
int main(){
ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
cin >> t;
while(t--){
cin >> s;
tot[0] = 0; tot[1] = 0;
for(int i=0; i<s.length(); i++){
... | ALGO | 0.999863 | 3.831993 |
76e758f0-f51c-4e0c-8877-61d5d483c2c4 | newpolaris/algorithm | baekjoon/2576.cpp | #include <iostream>
#include <algorithm>
using namespace std;
int main() {
int i = 7, k, sum = 0, minv = 1e8;
while (i--) {
cin >> k;
if (k % 2) {
sum += k;
minv = min(minv, k);
}
}
if (sum == 0) cout << -1 << endl;
else {
cout << sum << endl << minv << endl;
}
return 0;
}
| ALGO | 0.999915 | 3.609679 |
398f0815-f378-48ca-84c1-3f946a95d0ab | witmaos6/LeetCode | 0844-backspace-string-compare/0844-backspace-string-compare.cpp | class Solution {
const char Backspace = '#';
public:
bool backspaceCompare(string s, string t)
{
int CountS = ExcuteBackspace(s);
int CountT = ExcuteBackspace(t);
if(CountS != CountT)
{
return false;
}
for(int i = 0; i < CountS; i++)
{
... | ALGO | 0.999921 | 6.262951 |
4cf894bd-1f80-4e46-93ac-c7dc04e02c87 | jk-jung/problem-solving | codeforces/Codeforces Round 60x/R600_div2_E.cpp | #include <cstring>
#include <cstdio>
#include <cmath>
#include <cassert>
#include <set>
#include <map>
#include <array>
#include <stack>
#include <queue>
#include <vector>
#include <numeric>
#include <iostream>
#include <algorithm>
using namespace std;
typedef long long ll;
typedef pair<int, int> pi;
typedef vector<i... | ALGO | 0.999944 | 4.000888 |
d179362f-7ad3-4673-8153-591e4da64808 | Lut4Sayem/Competitive-Programming | week_3/topic_wise/C_2_Powering_the_Hero_hard_version.cpp | #define ll long long int
#include<bits/stdc++.h>
using namespace std;
int main(){
ios::sync_with_stdio(false);
cin.tie(nullptr);
int t;
cin>>t;
while(t--){
int n;
cin>>n;
vector<ll> v(n);
for(int i=0; i<n; i++){
cin>>v[i];
}
ll final=0;
... | ALGO | 0.999773 | 4.284923 |
bec56b73-c01f-48dd-84bc-c7cbe7be2e20 | itzrushp/LeetCode | LeetCode861.cpp | // Score After Flipping Matrix :) Date -> 13th March 2024
class Solution {
public:
/*
Intuition
We start by flipping the rows to maximize the value of the number.
Then, we flip the columns if it would increase the value. Finally, we
calculate the score by summing up the values of all number... | ALGO | 0.999994 | 7.07276 |
dfaedd10-b9c7-4074-9093-abb2f7086f54 | raincross7/code-similarity | codes/train_code/problem358/problem358_331.cpp | #include <bits/stdc++.h>
using namespace std;
using ll=long long;
using vi = vector<int>;
using vvi = vector<vector<int>>;
using vl = vector<ll>;
using vvl = vector<vector<ll>>;
#define all(x) x.begin(),x.end()
#define rep(i,j,n) for (int i = j; i < (int)(n); i++)
#define _GLIBCXX_DEBUG
#define MOD 1000000007
template<... | ALGO | 0.999868 | 3.389297 |
c9dfeb58-9404-43e1-993e-70954c497c34 | ishandutta2007/codeforces | amshz/normal/1586/G.cpp | //khodaya khodet komak kon
# include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair <int, int> pii;
typedef pair <pii, int> p... | ALGO | 0.999925 | 4.401042 |
1ff3f5a7-76dc-45c1-b2e0-05aa8692341c | saurav6719/my-codes | c++ dsa /stacks/stackImplementation.cpp | #include<iostream>
using namespace std;
class Stack{
public:
int arr[5];
int idx;
Stack(){
idx = -1;
}
void push(int val){
idx++;
arr[idx] = val;
}
void pop(){
idx--;
}
int top(){
return arr[idx];
}
int size(){
return idx+1;
... | ALGO | 0.979759 | 4.044734 |
73592a41-6c24-4414-a4e2-154e0e9d3caa | amity874/DsaInteviewPrep | CsesProblemSet/SortingAndSearching/TrafficLight.cpp | // https://cses.fi/problemset/task/1163
#include<bits/stdc++.h>
//#include<ext/pb_ds/assoc_container.hpp>
//using namespace __gnu_pbds;
using namespace std;
#define ll long long int
#define ld long double
#define mod 1000000007
#define inf 1e18
#define endl "\n"
#define pb emplace_b... | ALGO | 0.999963 | 4.12437 |
458eb591-3726-47a2-a9ee-bc6c726fa7c6 | j30ngwoo/Problem-Solving | brute_force/1476/1476.cpp | #include <iostream>
using namespace std;
int main(void) {
int e, s, m, i = 1;
cin >> e >> s >> m;
if (e == 15) e = 0;
if (s == 28) s = 0;
if (m == 19) m = 0;
while (!(i % 15 == e && i % 28 == s && i % 19 == m))
i++;
cout << i;
return (0);
}
| ALGO | 0.999501 | 3.062401 |
00177685-5113-4f62-9b15-bb7a460f4912 | mlaux/oculr | tesstwo/src/main/jni/com_googlecode_tesseract_android/src/ccmain/fixspace.cpp | #include <ctype.h>
#include "reject.h"
#include "statistc.h"
#include "control.h"
#include "fixspace.h"
#include "genblob.h"
#include "tessvars.h"
#include "tessbox.h"
#include "globals.h"
#include "tesseractclass.h"
#define PERFECT_WERDS 999
#define MAXSPACING 128 /*max expected spacing in pix */
namespa... | ALGO | 0.983647 | 3.000834 |
39b8abe2-869f-40a6-9bb0-abf5f89ab30c | UET-2425HK2-INT2210-01/23021436_CTDL-GT | Lecture2_Assigment/23021436_Lect2_Assigment1.cpp | #include<iostream>
using namespace std;
int main()
{
int n;
cin >> n;
int a[n];
for(int i = 0; i < n; i++)
{
cin >> a[i];
}
int count = 0;
for(int i = 0; i < n; i++)
{
for(int j = i + 1; j < n; j++)
{
if(a[i] == a[j])
{
... | ALGO | 0.999923 | 3.674294 |
f46e4069-7a92-4f54-861d-202a267c7bb7 | Shadikul-Islam/Codeforces | 71A Way Too Long Word.cpp | #include<iostream>
using namespace std;
int main ()
{
int i,n;
string s;
cin>>n;
for(i=1;i<=n;i++)
{
cin>>s;
if(s.length()<=10)
{
cout<<s<<endl;
}
else
{
cout<<s[0]<<s.length()-2<<s[s.length()-1]<<endl;
}
}
}
| ALGO | 0.999628 | 3.177994 |
dd79cbb9-2d31-43fc-80c6-d3d74c8332bc | arshitcc/LeetCode | 1256-rank-transform-of-an-array/1256-rank-transform-of-an-array.cpp | class Solution {
public:
vector<int> arrayRankTransform(vector<int>& arr) {
vector<int> rankers = arr;
sort(rankers.begin(),rankers.end());
unordered_map<int,int> m;
int rank = 1;
for(int i=0; i<rankers.size(); i++){
if(m.count(rankers[i])) continue;
... | ALGO | 0.999993 | 5.707586 |
7631087d-081c-46b6-ad25-c45f973c3ec2 | lsh0805/BOJ | solved/BOJ18406.cpp | #include <bits/stdc++.h>
using namespace std;
template <typename A, typename B>
ostream &operator<<(ostream &os, const pair<A, B> &p) { return os << '(' << p.first << ", " << p.second << ')'; }
template <typename T_container, typename T = typename enable_if<!is_same<T_container, string>::value, typename T_container::... | ALGO | 0.999479 | 5.793672 |
c8dd1c8a-a00f-4a93-88e5-bccca5659cf9 | nayemuddinn/Competitive-programming | Codeforces/Politics.cpp | /**
.
author-> NATE
.
**/
#include<bits/stdc++.h>
using namespace std;
#define first_in_out ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define For(i,n) for(int i=0;i<n;i++)
#define For2(i,n) for(int i=1;i<=n;i++)
#define For3(i, j, n) for (int i = j; i <= n; i++)
#... | ALGO | 0.999774 | 3.76139 |
6ecf75c3-17d4-427d-8ca2-40652e06cef6 | black0ut1/AlgorithmB | cpp/src/main.cpp | #include <chrono>
#include <iostream>
#include <iomanip>
#include "algorithm/algorithm/Algorithm.h"
#include "algorithm/parallel_algorithm/ParallelAlgorithm.h"
#include "io/parser/Parser.h"
#include "argparse/argparse.hpp"
#include "io/writer/Writer.h"
/**
* Initializes argument parser to parse command
* line argume... | ALGO | 0.998915 | 5.995329 |
1c13effb-42a9-487a-a089-4c84539473c6 | Aarondev26/Intro-to-Linux-with-CPP | quick vs bubble sort comparison/mySortA.cpp | #include <iostream>
#include <fstream>
#include <vector>
using namespace std;
// This bubble sort function uses an array
void bubble(int v[], int max)
{
cout << "Starting Array bubble sort with "<<max<< " items\n";
for (int i=0; i<max-1; i++)
for(int j=0; j<max-1-i; j++)
if (v[j] > v[j+1]) // if items are o... | ALGO | 0.995274 | 4.424084 |
bf0d828e-aba1-4629-b920-f304dde1c9ca | JayGaba/169 | 054-Merge-Intervals.cpp | // https://leetcode.com/problems/merge-intervals/
class Solution {
public:
vector<vector<int>> merge(vector<vector<int>>& intervals) {
sort(intervals.begin(), intervals.end());
int n = intervals.size();
vector<vector<int>> ans;
for(int i = 0; i < n; i++){
if(ans.empty() |... | ALGO | 0.999999 | 6.446034 |
3d497471-dff4-47df-aef5-950a92a72dfc | wol101/GaitSym5 | PhysX/PhysX-107.0/physx/source/geomutils/src/pcm/GuPCMContactGenUtil.cpp | #include "GuPCMContactGenUtil.h"
using namespace physx;
using namespace Gu;
using namespace aos;
bool Gu::contains(Vec3V* verts, PxU32 numVerts, const Vec3VArg p, const Vec3VArg min, const Vec3VArg max)
{
const BoolV tempCon = BOr(V3IsGrtr(min, p), V3IsGrtr(p, max));
const BoolV con = BOr(BGetX(tempCon), BGetY(temp... | ALGO | 0.998933 | 6.721403 |
1322004c-26fc-4b4c-97ef-3aaae359f833 | sxmedh/HPC | HPC (High Performance Computing)/Practical 2 (Bubble Sort & Merge Sort)/Code/bubble_sort_parallel.cpp | #include <iostream>
#include <vector>
#include <omp.h>
#include <chrono>
using namespace std;
using namespace chrono;
void parallel_bubble_sort(vector<int>& arr) {
int n = arr.size();
bool swapped = true;
omp_set_num_threads(2); // set number of threads to 2
for (int i = 0; i < n && swapped; i++) {
... | ALGO | 0.999497 | 5.618204 |
9246661b-14dc-4bb8-b0e1-7b3185ac8ca6 | Ash0369/LeetCode2 | 2962.cpp | #define ll long long
class Solution
{
public:
long long countSubarrays(vector<int>& nums, int k)
{
int mx=nums[0];
for(auto x:nums)
{
mx=max(mx,x);
}
int n=nums.size();
vector<int>dp(n,0);
for(int i=0;i<nums.size();i++)
... | ALGO | 0.999991 | 5.682928 |
6f24eb4f-746b-4261-a503-794c3f5a5424 | ferconde87/LeetCode | 804. Unique Morse Code Words/uniqueMorseRepresentations.cpp | /*
Runtime: 4 ms, faster than 81.73% of C++ online submissions for Unique Morse Code Words.
Memory Usage: 8.9 MB, less than 100.00% of C++ online submissions for Unique Morse Code Words.
*/
class Solution {
public:
int uniqueMorseRepresentations(vector<string>& words) {
string char_morse[26] = {".-","-...",... | ALGO | 0.999937 | 6.458067 |
2e488aa5-ecf8-42f0-b9a0-d00aadffe095 | ishandutta2007/codeforces | wifiiiiii/normal/1174/C.cpp |
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i,n) for(int i=1;i<=n;++i)
const int maxn = 200005;
int prime[maxn],np[maxn],ans[maxn],tot=0,cnt=0;
void init()
{
for(int i=2;i<maxn;++i)
{
if(!np[i]) prime[++tot] = i, ans[i]=++cnt;
for(int j=1;j<=tot;++j)
... | ALGO | 0.999813 | 3.737196 |
8537febe-ee6f-4f21-a1e4-4f7aacf51ba1 | NJ010/Competitive_coding | LeetCode-Solutions/DP/Mincoins1.cpp | class Solution {
public:
int coinChange(vector<int>& coins, int amount) {
int dp[10000000]={0};
if (minCoins(coins,amount,dp)>amount){
return -1;
}
return minCoins(coins,amount,dp);
}
int minCoins(vector<int>& coins, int amount,int dp[]){
... | ALGO | 0.999984 | 5.848891 |
589debc3-6c53-45fd-94d7-f03f8d71add5 | Ayaka114/CppHomework | f2/f2/61821103 f2.cpp | //庯ģ壬ҳһݵķֵֵ
#include<iostream>
#include<string>
#include<iomanip>
using namespace std;
//Ӵ룺庯ģ壬ҳһάзֵֵĸ 10֣
template<typename T>
void Check(T* arr, int N, int& feng, int& gu) {
feng = 0; gu = 0;
for (int i = 1; i + 1 < N; ++i) {
if (arr[i] > arr[i - 1] && arr[i] > arr[i + 1])feng++;
if (arr[i] < arr[i - 1] && ... | ALGO | 0.996033 | 3.54055 |
7c3d557a-7f0e-457e-9cc9-fcebc1e9b03f | arn4b/dp-problems | fibonaccidp.cpp | //FIBONACCI
#include <bits/stdc++.h>
using namespace std;
int fibonacci(int n)
{
int f[n+2];
f[0] = 0;
f[1] = 1;
for(int i = 2; i<=n; i++)
{
f[i] = f[i-1] + f[i-2];
}
return f[n];
}
int main()
{
int num;
cin>>num;
cout<<fibonacci(num);
return 0;
} | ALGO | 0.999989 | 5.279929 |
5b8689d5-095c-447f-9f2f-b2eb96870bdc | choijaewon323/PS | 백준/이분 탐색/14003.cpp | #include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
vector<int> v;
int arr[1000001];
int index[1000001];
int n;
void input()
{
cin >> n;
for (int i = 1; i <= n; i++)
{
cin >> arr[i];
}
}
void solution()
{
for (int i = 1; i <= n; i++)
{
if (v.empty() || v[v.size() - 1] < arr[i])... | ALGO | 0.999999 | 4.660559 |
1a6b2ba0-1ef6-465e-a193-d76cb7eaa6d7 | ananya-agarwal/Coding-Ninjas | Introduction to C++/Lecture 10: Character Arrays and 2D Arrays/Code/compress_the_String.cpp | string getCompressedString(string &input)
{
int c=0,i,j=0;
string f;
f+=input[0];
char d=input[0];
for(i=0;input[i];i++)
{
if(input[i] == d)
c++;
else
{
if(c == 1)
{
f+=input[i];
d=input[i];
}
... | ALGO | 0.999931 | 4.091068 |
addcf97f-e208-4561-accb-d35e17c0ac6e | A4d1l/SpojSolutions | Cards.cpp | #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector < long long > vll;
typedef pair < long long, long long > pll;
typedef pair < int, int > pii;
typedef vector < int > vii;
#define rep(i,n) for(int i = 0; i < n; i++)
#define reps(i,a,n) for(int i = a; i < n; i++)
#define s(n) cin >>... | ALGO | 0.999888 | 4.185168 |
22f8936e-44f6-4f81-a757-5654dd4a0e44 | Rodagui/CodeForces-Solutions | BussinessTrip.cpp | /*A. Business trip*/
#include <bits/stdc++.h>
using namespace std;
int main(){
ios_base::sync_with_stdio(0);
cin.tie(0);
int large;
cin >> large;
vector <int> hight(12);
for (int i = 0; i < 12; ++i){
cin >> hight[i];
}
sort(hight.begin(), hight.end(), greater<int>());
int tot = 0;
int dias = 0;
... | ALGO | 0.999966 | 3.614574 |
6d53514e-f501-452b-b74a-39bb3946d60b | Gautham-JS/ROS_Stereo_SLAM | src/ANMS.cpp | #include <iostream>
#include <vector>
#include <algorithm>
#include <thread>
#include <stdio.h>
#include <opencv2/core.hpp>
#include <opencv2/features2d.hpp>
#include <opencv2/xfeatures2d.hpp>
#include <opencv2/core/core.hpp>
#include <opencv2/imgproc/imgproc.hpp>
#include "opencv2/highgui/highgui.hpp"
#include <openc... | ALGO | 0.998924 | 5.209373 |
b8302caf-6ece-41d9-9ffe-6d823a71aa17 | anuj2801/Cpp-snippets | icpc/LCA.cpp | LCA
//FOR DIRECTED GRAPH(TREE),for undirected->change the dfs function(use visited)
int LOG;
vector<vector<int>> up;
vector<int> depth;
void TreeAncestor(int n, vector<int>& parent)
{ LOG=0;
while((1 << LOG) <= n)
LOG++;
up = vector<vector<int>>(n, vector<int>(LOG));
// up[v][j] is 2^j -th ancesto... | ALGO | 0.999718 | 5.26797 |
43620193-10a7-42db-8823-a735ae7281fd | Johncorex/OTBR-Global | src/tools.cpp | #include "otpch.h"
#include "tools.h"
#include "configmanager.h"
extern ConfigManager g_config;
void printXMLError(const std::string& where, const std::string& fileName, const pugi::xml_parse_result& result)
{
std::cout << '[' << where << "] Failed to load " << fileName << ": " << result.description() << std::endl;... | TOOL | 0.950484 | 3.681853 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.