uuid stringlengths 36 36 | repo_name stringlengths 5 123 | relative_path stringlengths 5 4k | content stringlengths 33 2.85M | category stringclasses 6
values | algo_rel_score float64 0.85 1 | quality_score float64 3 8.76 |
|---|---|---|---|---|---|---|
7371ddc7-e9d0-4fef-aef2-0861c6f75774 | HDuong1803/DataStructs | Dynamic Programming/productSum/main.cpp | #include <QCoreApplication>
#include <iostream>
using namespace std;
int productSum(int a[], int n){
if(n == 0)
return 0;
int *opt = new int[n];
opt[0] = 0;
opt[1] = a[1];
for(int i=2; i<n; i++){
opt[i] = std::max(opt[i-1] + a[i], opt[i-2] + a[i-1]*a[i]);
cout<<o... | ALGO | 0.9999 | 4.048198 |
a22a0e24-73ab-4a1d-a3e9-eb9c24eac6d1 | gagandeepahuja09/Backtracking | LeetCode/NumberOfSquarefulArrays.cpp | class Solution {
public:
bool perfect(int n) {
return ((int)((int)sqrt(n) * (int)sqrt(n)) == n);
}
bool check(int start, int end, vector<int>& A) {
for(int i = start + 1; i < end; i++) {
if(A[i] == A[end])
return false;
}
return true;
}
... | ALGO | 0.999927 | 5.401053 |
25d2e1c8-d82e-40e4-bcd9-694a47964cd1 | eggag32/Competitive-Programming | Codeforces/Color the Fence.cpp | #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef pair<int, int> pi;
#define debug(x) cout << #x << ": " << x << endl
#define repn(i, a, b) for(int i = (a); i < (b); i++)
#define rep(i, a) for(int i = 0; i < (a); i++)
#define all(v) v.begin(), v.end()
#define mp make_p... | ALGO | 0.999939 | 3.643764 |
4e97f76d-0616-4df0-8532-2a786508a026 | oxygen-hunter/Flashboom | data/big-vul-100/add_attention_code/Phi/top0-100/sum-of-total-strength-of-wizards-Solution2.totalStrength/177893_+Info.cpp | int test_mod_exp(BIO *bp, BN_CTX *ctx)
{
BIGNUM *a, *b, *c, *d, *e;
int i;
a = BN_new();
b = BN_new();
c = BN_new();
d = BN_new();
e = BN_new();
BN_one(a);
BN_one(b);
BN_zero(c);
if (BN_mod_exp(d, a, b, c, ctx)) {
fprintf(stderr, "BN_mod_exp with zero modulus succee... | TEST | 0.996048 | 3.928665 |
28bbe1f1-8164-4268-a0a8-fe3a9ff80ccb | MartinSkachkov/Data-structures-and-algorithms | Seminars/Sem. 02/Additional2/task9.cpp | #include <algorithm>
#include <iostream>
#include <stack>
#include <utility>
#include <vector>
using namespace std;
vector<pair<int, int>> compressIntervals(const vector<pair<int, int>> &intervals) {
stack<pair<int, int>> working;
stack<pair<int, int>> res;
for (size_t i = 0; i < intervals.size(); i++) {
... | ALGO | 0.999835 | 5.870528 |
878a5e70-6549-425b-b3cc-3f150c6983a7 | LoveGump/Algorithom_study | zigzagLevelOrder.cpp |
#include <algorithm>
#include <iostream>
#include <string>
#include <vector>
using namespace std;
/**
* 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... | ALGO | 0.999998 | 5.875769 |
171c3139-cdd1-4064-8115-70ceaa57e873 | ishandutta2007/codeforces | ylwang/normal/1503/C.cpp | #include<bits/stdc++.h>
#define ll long long
#define pb push_back
#define mkp make_pair
#define vi vector<int>
#define pii pair<int,int>
#define FI(n) FastIO::read(n)
#define FO(n) FastIO::write(n)
#define ull unsigned long long
#define mst(a,b) memset(a,b,sizeof(a))
#define foR(i,k,j) for(int i=(k);i>=(j);i--)
#define... | ALGO | 0.999975 | 4.237549 |
76177c06-083d-43f0-baa0-2469a68e7355 | samiul2102013/XPSC01 | week 8/day 1/3.cpp | #include<bits/stdc++.h>
using namespace std;
void solve(){
int a,b; cin>>a>>b;
if(a>b){
cout<<a-b<<endl;
}
else{
cout<<0<<endl;
}
}
int main(){
int t;
cin>>t;
while(t--){
solve();
}
return 0;
} | ALGO | 0.999957 | 4.541227 |
e852645d-7deb-4675-82e6-434af5b7ce3d | hunmin-hub/Backjoon-judge | Solved2020/11004.cpp | #include <stdio.h>
int N, K;
int board[5000002];
int temp[5000002];
void combine(int left,int right) {
int mid = (left + right) / 2;
int i = left, j = mid + 1, k = left;
while (i <= mid && j <= right) {
if (board[i] <= board[j]) {
temp[k++] = board[i++];
}
else {
temp[k++] = board[j++];
}
}
while (i ... | ALGO | 0.999986 | 3.664947 |
487c80ce-f8d3-4cc5-be9e-b4dfb1eea2a3 | NullAwe/competitive-programming | codeforces/gitgud/ArrayGCD.cpp | #include <bits/stdc++.h>
using namespace std;
#define ll long long
const ll oo = 1000000000000000;
int main() {
ios::sync_with_stdio(0); cin.tie(0);
ll n, a, b; cin >> n >> a >> b;
vector<ll> arr(n); for (int i = 0; i < n; ++i) cin >> arr[i];
vector<ll> nums(6);
for (int j = -1; j < 2; ++j) nums[j + 1] = a... | ALGO | 0.999753 | 3.807395 |
5d2e124d-3a02-497d-bf81-0e1f82cc044a | Nivaspraveen/GEEKS-FOR-GEEKS | OTHERS/CPP/Class/Basic/C++ Classes Introduction/cpp-classes-introduction.cpp | //Initial Template for C++
#include<bits/stdc++.h>
using namespace std;
//User function Template for C++
// CollegeCourse Class
class CollegeCourse {
private:
string courseID;
char grade;
int credits;
int gradePoints;
float honorPoints;
public:
void set_CourseId(string CID) {
cou... | ALGO | 0.860973 | 4.699925 |
b08c0f18-52c2-405f-b11e-d7547af5c1f2 | OpenMW/openmw | components/settings/parser.cpp | #include "parser.hpp"
#include <sstream>
#include <components/debug/debuglog.hpp>
#include <components/files/conversion.hpp>
#include <components/misc/strings/algorithm.hpp>
#include <filesystem>
#include <fstream>
#include <Base64.h>
void Settings::SettingsFileParser::loadSettingsFile(
const std::filesystem::... | TOOL | 0.955214 | 7.041471 |
6eeb1bf2-5dc0-4ab8-ab08-53576443b166 | Asitkumar6205/-CrackYourInternship | 06-Linked List/18-remove_duplicates_from_sorted_list_2.cpp | class Solution {
public:
ListNode* deleteDuplicates(ListNode* head) {
if(head==NULL)
return NULL;
ListNode* dummy = new ListNode(0,head);
ListNode* p=dummy, *q=head;
int flag=1;
while(q && q->next){
if(q->val == q->next->val){
q=q->nex... | ALGO | 0.999975 | 5.471055 |
c5aa5953-c3e3-4929-854d-302db7c3aa27 | ishandutta2007/codeforces | ljc00118/normal/1648/A.cpp | #include <bits/stdc++.h>
#define rep(i, a, b) for (int i = a; i <= b; i++)
#define per(i, a, b) for (int i = a; i >= b; i--)
using namespace std;
typedef unsigned long long ull;
typedef pair <int, int> pii;
typedef long long ll;
template <typename T>
inline void read(T &f) {
f = 0; T fu = 1; char c = getchar();
... | ALGO | 0.999777 | 3.225108 |
14d34a83-da66-4db8-8214-9f55e3b86822 | ishandutta2007/codeforces | smallling/normal/633/G.cpp | #include<bitset>
#include<cstdio>
#define N 100010
using namespace std;
bitset<2010>tree[4*N],bz[1010],now1,now2;
struct lhy{
int x,y,next;
}edge[2*N];
int ans,tot,n,m,cnt,u,v,a[N];
int st[N],ed[N],where[N],son[N],lazy[4*N];
int flag[2020],prime[2020],vis[2020];
inline void read(int &x)
{
x=0;
char ch=getchar(... | ALGO | 0.999784 | 3.935596 |
7c68e991-45a6-4a11-aaaa-036e57ac5746 | sarvex/leetcode-carbon | solution/0900-0999/0992.Subarrays with K Different Integers/Solution.cpp | class Solution {
public:
int subarraysWithKDistinct(vector<int>& nums, int k) {
vector<int> left = f(nums, k);
vector<int> right = f(nums, k - 1);
int ans = 0;
for (int i = 0; i < nums.size(); ++i) {
ans += right[i] - left[i];
}
return ans;
}
vect... | ALGO | 0.999967 | 6.321012 |
67a37e81-40d4-42d8-9dba-102f43c21d69 | Esratjahanmare/Code | Codeforces/summation.cpp | #include<bits/stdc++.h>
using namespace std;
int main()
{
long long n, sum=0;
cin>>n;
long long a[n];
for(int i=0; i<n; i++)
{
cin>>a[i];
sum+=a[i];
}
if(sum>=0)
cout<<sum<<endl;
else
cout<<sum*(-1)<<endl;
}
| ALGO | 0.999768 | 3.691071 |
1c82a3bf-a8bd-492c-8d19-9f08c2ec9729 | rusuraluca/dsa-highschool | probleme random/recursivitate/dif_poz.cpp | #include <iostream>
using namespace std;
/*
Sa se scrie o functie recursiva care calculeaza si returneaza diferenta dintre suma elementelor
de pe pozitii pare si cea a celor aflate pe pozitii impare dintr-un vector.
A primit ca parametru impreuna cu n reprezentand numarul lui de elemente.
Elementele tabloului sunt i... | ALGO | 0.999832 | 4.80319 |
ef24cc7f-b61b-4fd2-9c31-ce343e20ec94 | Kartikkala/my_cpp_repo | prime_number.cpp | #include <iostream>
bool isPrime(int number)
{
int half_of_number = number / 2;
for(int i=2;i<=half_of_number ; i++)
{
if(number % i == 0)
{
return false;
}
}
return true;
}
int main(void)
{
std::cout << isPrime(120390123);
} | ALGO | 0.999937 | 5.045701 |
c7294204-a923-4177-a2b0-f0d51f5a9d50 | Bharatgwl/DSA_for_interviews | All content/Graph/Undirected graph/shortest_path_undirected.cpp | #include <iostream>
#include <unordered_map>
#include <set>
#include <vector>
#include <queue>
#include <algorithm>
using namespace std;
class graph
{
public:
unordered_map<int, set<int>> adj;
void addEdge(int x, int y, int directed)
{
adj[x].insert(y);
if (directed == 0)
{
... | ALGO | 0.999995 | 5.714612 |
d466aacf-0f10-4a28-b63e-5303190a028a | ieAditya/cpp_Codes | Binary tree/reverseLevelOrderTraversalGFG.cpp | #include <bits/stdc++.h>
using namespace std;
struct Node
{
int data;
Node *left;
Node *right;
};
vector<int> reverseLevelOrder(Node *root)
{
vector<int> ans;
stack<queue<Node *>> st;
queue<Node *> q;
q.push(root);
while (true)
{
st.push(q);
int size = q.size();
... | ALGO | 0.99998 | 4.771115 |
07daa9b0-4926-4996-909a-99baa4538e2f | ChaytonMoore/NEAEvolutionSimulator | Node.cpp | #include "Node.h"
#include "Muscle.h"
#include <iostream>
Node::Node()
{
}
//Sink function
void Node::WeightFunction()
{
//Will move the node proportional to its weight every tick
Location.y = -Weight;
}
void Node::MuscleMovement()
{
Position DeltaPosition = Position(0, 0);
//This will find all the movements of... | ALGO | 0.915644 | 3.989092 |
01aa65e3-0f59-4646-993b-6f6eb29c6ece | juandarr/Path-planning | src/Eigen-3.3/doc/examples/Tutorial_ReductionsVisitorsBroadcasting_colwise.cpp | #include <iostream>
#include <Eigen/Dense>
using namespace std;
int main()
{
Eigen::MatrixXf mat(2,4);
mat << 1, 2, 6, 9,
3, 1, 7, 2;
std::cout << "Column's maximum: " << std::endl
<< mat.colwise().maxCoeff() << std::endl;
}
| ALGO | 0.999423 | 3.779679 |
15c64d3e-a639-4d97-b782-a6fe803d9006 | rayhanvito/StrukturDataPraktek | PRAKTIKUM 10/2.cpp | //RAYHAN VITO GUSTIANSYAH
//20051397042
//MI_B_2020
#include <iostream>
#include <conio.h>
#include <string.h>
using namespace std;
main ()
{
int jd,no,kiri,kanan,center;
char data[20][50],cari[20];
cout<<"RAYHAN VITO GUSTIANSYAH\n";
cout<<"20051397042\n";
cout<<"MI_B_2020\n";
cout<<"\n\t\t *************... | ALGO | 0.999418 | 4.296859 |
715d2c0c-c58e-42f5-acb0-835b6dff7807 | opo0023/Rubik-s-Cube-Algorithm-Grp3 | backend/src/Utilities.cpp | #include "Utilities.h"
#include <sstream>
std::string join(const std::vector<std::string>& v, const std::string& sep){
std::ostringstream oss;
for(size_t i=0;i<v.size();++i){
if(i) oss << sep;
oss << v[i];
}
return oss.str();
}
| TOOL | 0.863375 | 5.534428 |
c5d85ec3-f725-411e-b2c2-7dffb6eac801 | StanPlatinum/proofGen | llvm/lib/Transforms/Utils/FunctionComparator.cpp | #include "llvm/Transforms/Utils/FunctionComparator.h"
#include "llvm/ADT/APFloat.h"
#include "llvm/ADT/APInt.h"
#include "llvm/ADT/ArrayRef.h"
#include "llvm/ADT/Hashing.h"
#include "llvm/ADT/SmallPtrSet.h"
#include "llvm/ADT/SmallVector.h"
#include "llvm/IR/Attributes.h"
#include "llvm/IR/BasicBlock.h"
#include "llvm/... | TOOL | 0.929467 | 6.710507 |
1dbc9ad7-3453-4e9f-bb11-d85e80b04a24 | GunjanShakya/DSA | Level order traversal - GFG/level-order-traversal.cpp | //{ Driver Code Starts
#include <bits/stdc++.h>
using namespace std;
/* A binary tree node has data, pointer to left child
and a pointer to right child */
struct Node
{
int data;
struct Node* left;
struct Node* right;
};
// Utility function to create a new Tree Node
Node* newNode(int val)
{
Node* te... | ALGO | 0.999836 | 6.691746 |
42e1d9d9-60a7-42aa-a463-16955a5b7fb0 | alexandraback/datacollection | solutions_5658282861527040_0/C++/daiwb/B.cpp | #include <iostream>
#include <sstream>
#include <string>
#include <cstring>
#include <vector>
#include <map>
#include <algorithm>
using namespace std;
#define REP(i,n) for(int i=0;i<(n);++i)
#define FOR(i,a,b) for(int i=(a);i<=(b);++i)
#define RFOR(i,a,b) for(int i=(a);i>=(b);--i)
typedef long long LL;
void run() {
... | ALGO | 0.998748 | 3.608733 |
c0e72bcc-3efd-4b17-aed3-ab53c85021fe | D1N910/learn-c | algorithmNote/p4/4.1/4.1.5.cpp | #include <iostream>
#include <string>
#include <algorithm>
using namespace std;
bool cmp(string a, string b) {
return a.length() > b.length();
}
const int MAXN = 50;
int n;
string a[MAXN];
// 顺序
void stringSort() {
sort(a, a+n, cmp);
}
int main() {
scanf("%d", &n);
getchar();
for (int i = 0; i <... | ALGO | 0.999266 | 4.315842 |
cfbbe838-d0a1-475c-9fd7-43f7f184e524 | Nanahoshi74/ABC | 290/A.cpp | #include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define repi(i,a,b) for(int i = a; i <= (int)(b); i++)
#define rng(i,a,b) for(int i = a; i < (int)(b); i++)
#define rrng(i,a,b) for(int i = a; i >= (int)(b); i--)
#define pb push_back
#define em emplace_back
#define pob pop_back
#define si(a)... | ALGO | 0.999875 | 3.192933 |
cb7341a9-979f-4906-91e9-21677ca2f483 | ishandutta2007/codeforces | wygzgyw/normal/1467/E.cpp | #include <bits/stdc++.h>
using namespace std;
template <typename T> void read(T &t) {
t=0; char ch=getchar(); int f=1;
while (ch<'0'||ch>'9') { if (ch=='-') f=-1; ch=getchar(); }
do { (t*=10)+=ch-'0'; ch=getchar(); } while ('0'<=ch&&ch<='9'); t*=f;
}
const int maxn=(2e5)+10;
int n,a[maxn],tot,head[maxn],nxt[maxn*2],... | ALGO | 0.999791 | 3.965175 |
04e88b98-9d7d-42c3-b327-4c1efac83d8a | manikanta2901/ubuntu | .history/codingChallenges/cpp/Codechef/longChallenges/Year2021/January/WatchingCpl_20210102134716.cpp | #include<bits/stdc++.h>
#include<vector>
#include<iostream>
#include<cmath>
#include<algorithm>
#include<iterator>
#include<string>
#include<map>
#define vv vector
#define F first
#define S second
#define MP make_pair
#define EXECUTE_FASTER ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
#define printM... | ALGO | 0.999992 | 3.918898 |
ab41f1c7-d0a1-4bb6-af37-2053b4ea4b9d | Gourav-Makkar/Data-Structures-and-Algorithms | Max Min - GFG/max-min.cpp | //{ Driver Code Starts
/* Driver program to test above function */
#include<bits/stdc++.h>
using namespace std;
// } Driver Code Ends
//User function Template for C++
class Solution
{
public:
int mx=INT_MIN;
int mn=INT_MAX;
int findSum(int A[], int N)
{
//code here.
for(int i=0;i<N;i++)
... | ALGO | 0.999738 | 6.142705 |
1c449dbf-8ccb-451b-85e6-684233ffc933 | ArtNazarov/leetcode-solutions | 14-longest-common-prefix/longest-common-prefix.cpp | #include <vector>
#include <string>
using namespace std;
class Solution {
public:
string longestCommonPrefix(vector<string>& strs) {
const int MAX_L = 200;
int sz = strs.size();
string prefix = "";
int sz_1 = strs[0].size();
for (int i=0;i<=sz_1;i++){
... | ALGO | 0.999723 | 5.505557 |
0982349e-3da5-4a25-8b50-9fb9e5c55c64 | lanl/scout | llvm/lib/DebugInfo/Symbolize/Symbolize.cpp | #include "llvm/DebugInfo/Symbolize/Symbolize.h"
#include "SymbolizableObjectFile.h"
#include "llvm/ADT/STLExtras.h"
#include "llvm/Config/config.h"
#include "llvm/DebugInfo/DWARF/DWARFContext.h"
#include "llvm/DebugInfo/PDB/PDB.h"
#include "llvm/DebugInfo/PDB/PDBContext.h"
#include "llvm/Object/ELFObjectFile.h"
#incl... | TOOL | 0.892727 | 7.8703 |
eea954a6-ad51-4bbd-a774-63c3d7db5863 | Sanjiban08/100DaysChallange | Day_25(Patterns)/pattern8.cpp | // Print Pascal's Triangal. ----
#include <iostream>
int main() {
using namespace std;
int n;
cin>>n;
int coef=1;
for(int i=0;i<n;i++) {
for(int space=1;space<=n-i;space++) {
cout<<" ";
}
for(int j=0;j<=i;j++) {
if(j==0 || i==0) {
coef... | ALGO | 0.999931 | 4.239805 |
e4172286-d9fa-47cf-8d84-c0cef805b720 | KimmiGYH/LeetCode_Notes_Public | Solutions_0001-1000/0649_Dota2 Senate_Dota2 参议院/cpp_1_Greedy_v2.cpp | #include <string>
#include <queue>
using namespace std;
class Solution {
public:
string predictPartyVictory(string senate) {
int n = senate.size();
queue<int> r, d;
for (int i = 0; i < senate.size(); i++)
(senate[i] == 'R') ? r.push(i) : d.push(i);
while (!r.em... | ALGO | 0.99999 | 6.117208 |
399943cc-d5df-4489-873d-460c2c5861ab | raincross7/code-similarity | codes/train_code/problem476/problem476_48.cpp | #include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <cmath>
#include <queue>
#include <map>
#include <unordered_map>
#include <set>
#include <functional>
#include <bitset>
#include <numeric>
#include <complex>
#include <cassert>
#include <random>
long long gcd(const long long &a, cons... | ALGO | 0.999997 | 4.466974 |
2ebd5c70-81fa-4328-831d-c2e279efa2a7 | pc-hover/DSA-SDE-Sheet | checkPalindromeLL.cpp | #include <bits/stdc++.h>
using namespace std;
class Node
{
public:
int data;
Node *next;
Node(int val)
{
this->data = val;
this->next = NULL;
}
};
// BruteForce ->
// TC : O(N)
// SC : O(N)
// bool checkPalindromeLL(Node *&head)
// {
// vector<int> array1;
// Node *cur = head... | ALGO | 0.999928 | 5.11217 |
4dc411c9-522f-4459-b4ba-582e3cca338c | simplewithalex/MyLeetCodeSln | LeetCode/0117.填充每个节点的下一个右侧节点指针2.cpp | #include "header.h"
/*
给定一个二叉树
struct TreeLinkNode
{
int val;
TreeLinkNode *left, *right, *next;
TreeLinkNode(int x) : val(x), left(NULL), right(NULL), next(NULL) {}
};
填充它的每个 next 指针,让这个指针指向其下一个右侧节点。
如果找不到下一个右侧节点,则将 next 指针设置为 NULL。
初始状态下,所有 next 指针都被设置为 NULL。
提示:
你只能使用常量级额外空间。
使用递归解题也符合要求,本题中递归程序占用的栈空间不算做额外的空... | ALGO | 0.999838 | 5.15998 |
694577bf-bc90-4436-919d-c59cd75009ce | KunalNarkhedePatil/LogicBuilding | Tree/AllTravarsalOfBinaryTree.cpp | #include <iostream>
#include <queue>
using namespace std;
class BinaryTreeNode
{
public:
int data;
BinaryTreeNode *left;
BinaryTreeNode *right;
BinaryTreeNode(int data)
{
this->data = data;
this->left = NULL;
this->right = NULL;
}
};
typedef BinaryTreeNode *PBTNODE;
type... | ALGO | 0.999843 | 4.994743 |
bc680f51-1cbb-4c44-81d0-7ce342faed57 | Qt-Widgets/LibQQt-Widgets-Collection | src/exquisite/qrcode/qrdecode/zxing/zxing/datamatrix/decoder/DataMatrixDecoder.cpp | #include <zxing/datamatrix/decoder/Decoder.h>
#include <zxing/datamatrix/decoder/BitMatrixParser.h>
#include <zxing/datamatrix/decoder/DataBlock.h>
#include <zxing/datamatrix/decoder/DecodedBitStreamParser.h>
#include <zxing/datamatrix/Version.h>
#include <zxing/ReaderException.h>
#include <zxing/ChecksumException.h>
#... | ALGO | 0.886155 | 5.952243 |
8f7349a3-2b66-4ed7-9c99-2d0d54829264 | twchen/algorithms | leetcode/container-with-most-water.cpp | /*
Given n non-negative integers a1, a2, ..., an, where each represents a point at coordinate (i, ai). n vertical lines
are drawn such that the two endpoints of line i is at (i, ai) and (i, 0). Find two lines, which together with x-axis
forms a container, such that the container contains the most water.
Note: You may ... | ALGO | 0.999985 | 6.542161 |
35d75bf9-e1e3-4515-bfc7-cc16869a69e3 | kanavgoyal898/TUTORIALS-CPP | tut18.cpp | #include <iostream>
// fibonacci sequence a_n = a_(n-2) + a_(n-1)
int fibonacci(int n) {
if(n <= 0) {
return 0;
} else if(n == 1) {
return 1;
} else {
return (fibonacci(n-2) + fibonacci(n-1));
}
}
int main() {
int n;
std::cout << "Enter n: ";
std::cin >> n;
std:... | ALGO | 0.999108 | 5.974789 |
c7eb967b-ab09-44b4-92dc-80d17890ad63 | R3nch00/CodeForces | Bus to Udayland.cpp | #include<bits/stdc++.h>
using ll=long long;
void solve(){
int n;std::cin>>n;
std::vector<std::string>a(n);
for(auto&i:a)std::cin>>i;
bool ok=false;
for(auto&s:a){
if(s.substr(0,2)=="OO"){
ok=true;
s[0]=s[1]='+';
break;
}
if(s.substr(3,2)=="OO"){
ok=true;
s[3]=s[4]='+';
break;
}
}
if(!ok... | ALGO | 0.999895 | 3.600138 |
cb6d8fec-a123-4915-ab01-a37411165baa | tanishqj-19/100-Days-of-Leetcode | Day11/24. Swap Nodes in Pairs/main.cpp | class Solution {
public:
ListNode* swapPairs(ListNode* &head) {
// base case
if(!head || !head->next) return head;
ListNode* p1 = head, *p2 = head->next;
p1->next = swapPairs(head->next->next);
p2->next = p1;
return p2;
}
};
| ALGO | 0.999989 | 5.873394 |
060a5db3-301e-404a-a4a3-c3502a3d623e | SimeonHristov99/FMI_Semester_3 | Data Structures/Week 4 - Stack/Task4.cpp | #include <iostream>
#include "Stack.hpp"
bool is_digit(char c)
{
return c >= '0' && c <= '9';
}
bool is_operation(char c)
{
return c == '+' || c == '-' || c == '*' || c == '/';
}
bool has_bigger_priority(char from, char candidate)
{
if (from == '*' || from == '/')
{
return false;
}
return true;
}
int calcu... | ALGO | 0.999548 | 5.924056 |
cff725a5-734a-4eee-8c48-7566564b4fe6 | dreamjh20/C | 백준 기찍N 2742.cpp | #include <stdio.h>
int main(void) {
int N, i;
scanf("%d", &N);
for(i=0; i<N; N--){
printf("%d\n", N);
}
}
| ALGO | 0.995967 | 3.351145 |
eea38e79-212f-42bc-9e08-226916e5a274 | nazmul-1117/Beecrowd | 1154.cpp | #include <bits/stdc++.h>
using namespace std;
int main(){
int n = 1, i=0,sum=0;
while(true){
cin >> n;
if(n < 0) break;
sum += n;
i++;
}
cout<<fixed<<setprecision(2);
cout<<(float)sum/i<<endl;
return 0;
} | ALGO | 0.999471 | 3.650301 |
4c30c600-57f7-4509-98f5-deb35491d198 | raincross7/code-similarity | codes/train_code/problem319/problem319_133.cpp | #include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
typedef long double ld;
ll gcd(ll x, ll y) { return (x % y)? gcd(y, x % y): y; }
int main(){
ll A, B;
cin >> A >> B ;
cout << (1900 * B + 100 * (A - B)) * pow(2 , B) << endl;
}
| ALGO | 0.998733 | 3.774202 |
081e1794-8f6e-42cc-835c-f635ad526076 | P0L3NARUBA/roblox-2016-source-code | Contribs/boost_1_56_0/libs/geometry/doc/src/examples/algorithms/centroid.cpp | // Boost.Geometry (aka GGL, Generic Geometry Library)
// QuickBook Example
//[centroid
//` Shows calculation of a centroid of a polygon
#include <iostream>
#include <list>
#include <boost/geometry.hpp>
#include <boost/geometry/geometries/point_xy.hpp>
#include <boost/geometry/geometries/polygon.hpp>
/*<-*/ #include ... | TOOL | 0.999607 | 6.817874 |
9a928043-7590-4d3e-b286-009299e6c846 | DionysiosB/LeetCode | 3065-MinimumOperationsToExceedThresholdValueI.cpp | class Solution {
public:
int minOperations(vector<int>& nums, int k) {
int cnt(0);
for(int p = 0; p < nums.size(); p++){cnt += (nums[p] < k);}
return cnt;
}
};
| ALGO | 0.999976 | 5.72403 |
35fb695b-d520-4a9b-8266-ce8e41aa8155 | Rafiqul-Ala-Mahid/CodeForcesProblem | TrustNobody.cpp | #include<iostream>
#include<algorithm>
using namespace std;
int main()
{
int t;
cin >> t;
while (t--)
{
/* code */
int n;
cin >> n;
int l[n];
for (int i = 0; i < n;i++)
{
cin >> l[i];
}
sort(l, l + n);
int c = 0,d=-1;
... | ALGO | 0.999802 | 3.94504 |
01e923c4-2098-4d30-a0ce-583d7e985aa3 | DeepanshuRohilla15/Codechef | LUNCHTIME/HEIGHTRATION.cpp | #include<bits/stdc++.h>
using namespace std;
#define ll long long
void solve(){
int a,b;
cin>>a>>b;
if(a>b) cout<< a<<"\n";
else cout<<b<<"\n";
}
int main()
{
//make input output fast
ios_base::sync_with_stdio(false);
cin.tie(NULL);
cout.tie(NULL);
//test cases
int t=1;
... | ALGO | 0.999627 | 3.303576 |
44db04a4-b05c-4872-924a-1057769cd844 | Jayendra2688/Problems | TOH/C_1_Good_Subarrays_Easy_Version.cpp | #include<bits/stdc++.h>
using namespace std;
int main(){
long long t;
cin>>t;
while(t--){
long long n;
cin>>n;
vector<long long>v(n+1);
for(long long i=1;i<=n;i++)
cin>>v[i];
long long j=1;
long long ind = 1;
long long ans = 0;
for(long... | ALGO | 0.999727 | 4.14895 |
8f99a7f7-b746-482d-b861-9181d3c3e40b | TheUnicat/competitive-pwogramming | cses/problemset/normal/chessboard_and_queens.cpp | //
// Created by TheUnicat on 2024-05-27.
//
#include <iostream>
#include <string>
#include <vector>
using namespace std;
int solution_count = 0;
bool check_legality(vector<pair<int, int> > queens) {
for (long i = 0; i < queens.size(); i++) {
for (long j = i + 1; j < queens.size(); j++) {
if ... | ALGO | 0.999852 | 5.593834 |
52470f17-fc3c-4be1-8337-cf4773c7f904 | taoyilee/gem5 | src/systemc/tests/systemc/misc/unit/data/datawidth_bool_to_unsigned/truncation/datawidth.cpp | /*****************************************************************************
datawidth.cpp --
Original Author: Martin Janssen, Synopsys, Inc., 2002-02-15
*****************************************************************************/
/**************************************************************************... | ALGO | 0.964648 | 5.742909 |
0e6faccb-fe22-49be-80ec-b98dfd482788 | rysh25/atcoder | abc310/d.cpp | #include <iostream>
#include <vector>
using namespace std;
int main()
{
int N, T, M;
cin >> N >> T >> M;
vector<vector<int>> A(M, vector<int>(2));
for (int i = 0; i < M; i++)
{
for (int j = 0; j < 2; j++)
{
cin >> A[i][j];
}
}
vector<vector<int>> dp(1 ... | ALGO | 0.999903 | 4.808462 |
883feb5b-13a2-4729-8698-ebd6a1c35fb3 | whodewho/leetcode | Word_Break2.cpp | /*
O(2^N)
O(N*N*N)
*/
class Solution {
public:
vector<string> wordBreak(string s, unordered_set<string> &dict) {
// Note: The Solution object is instantiated only once and is reused by each test case.
int m = s.size();
vector<vector<bool> > p(m, (vector<bool>(m, false)));
... | ALGO | 0.999416 | 5.828875 |
68cce9aa-4fe7-46b3-bd70-eb2c8ff39054 | jayin92/competitive-programming | contest/1569/b/b.cpp | #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef pair<int, ll> pil;
typedef pair<ll, int> pli;
typedef pair<double,double> pdd;
#define SQ(i) ((i)*(i))
#define MEM(a, b) memset(a, (b), sizeof(a))
#define SZ(i) int(i.size())
#define FOR(i, ... | ALGO | 0.99971 | 3.867769 |
a1bf7181-25d4-4e0f-badd-61fb839e1359 | efinexchange/efin | src/qt/transactionfilterproxy.cpp | #include <qt/transactionfilterproxy.h>
#include <qt/transactiontablemodel.h>
#include <qt/transactionrecord.h>
#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 (far in the fu... | TOOL | 0.926803 | 6.741245 |
8b0c0dbd-33b9-43cf-9d74-397b8d03f6a0 | raptoravis/forwardplusrendering | thirdparty/boost_1_70_0/libs/math/tools/factorial_tables.cpp | #include <boost/limits.hpp>
#include <vector>
#include "mp_t.hpp"
void write_table(unsigned max_exponent)
{
mp_t max = ldexp(mp_t(1), (int)max_exponent);
std::vector<mp_t> factorials;
factorials.push_back(1);
mp_t f(1);
unsigned i = 1;
while(f < max)
{
factorials.push_back(f);
++i;
... | ALGO | 0.913295 | 4.253815 |
a74cbcbd-c3ff-4815-9c39-db72437c2c00 | akshi100/Assignment1 | Assignment8 ques5.cpp | #include <stdio.h>
int main()
{
int a;
printf("Enter the number : ");
scanf("%d", &a);
if (a > 0)
printf("%d is positive.", a);
else if (a < 0)
printf("%d is negative.", a);
else if (a == 0)
printf("%d is zero.", a);
return 0;
}
| ALGO | 0.989718 | 3.216859 |
890867a5-3478-4e6e-89f7-3595e1a317c8 | aaryan-1104/Data-Structure-and-Algorithm-Codes | Algorithm Problems/Array/aVeryBigSum.cpp | #include<iostream>
using namespace std;
void aVeryBigSum(long long a[],int n){
long long sum=0;
for(int i=0;i<n;i++){
sum+=a[i];
}
cout<<sum;
}
int main(){
int n;
cin>>n;
long long a[n];
for(int i=0;i<n;i++){
cin>>a[i];
}
aVeryBigSum(a,n);
return 0;
} | ALGO | 0.999749 | 3.716341 |
a9d8984f-0311-489a-88e4-59e0f34ab623 | maur-chvz/LeetCode | Best-Time-To-Buy-And-Sell-Stock-ii.cpp | class Solution {
public:
int maxProfit(vector<int>& prices) {
int out{};
for(int i = 1; i < prices.size(); ++i) {
if(prices[i] > prices[i - 1]) {
out += prices[i] - prices[i - 1];
}
}
return out;
}
};
| ALGO | 0.999097 | 6.058387 |
69e85922-189d-4a02-a935-9bbd716aabae | stack-queue-coder/CP-DSA | square.cpp | #include<bits/stdc++.h>
using namespace std;
typedef long double ll;
int main(){
ll n,m,a;
cin >> n>> m>> a;
ll x = ceill(n/a);
ll y = ceill(m/a);
long long z = x*y ;
cout<<z<<"\n";
return 0;
}
| ALGO | 0.999413 | 3.099933 |
998de645-7355-4774-a781-c21d41a8e227 | axnedergaard/kme | kme/src/encoder/kmeans_encoder.cpp | #include "kmeans_encoder.h"
#include "../util/util.h"
#include <vector>
#include <limits>
#define EPS 1
KMeansEncoder::KMeansEncoder(int n_states, int k, double learning_rate, double balancing_strength, bool homeostasis) : Encoder(n_states, k), learning_rate(learning_rate), balancing_strength(balancing_strength), h... | ALGO | 0.999946 | 6.148121 |
9a72d67f-21df-4682-b732-b6cefd866b0c | PixelExperience/external_libcxx | test/std/containers/container.adaptors/priority.queue/priqueue.members/emplace.pass.cpp | // UNSUPPORTED: c++98, c++03
// <queue>
// priority_queue();
// template <class... Args> void emplace(Args&&... args);
#include <queue>
#include <cassert>
#include "../../../Emplaceable.h"
int main()
{
std::priority_queue<Emplaceable> q;
q.emplace(1, 2.5);
assert(q.top() == Emplaceable(1, 2.5));
q... | TEST | 0.912906 | 5.559402 |
1d97a70c-df83-4e3a-a5fb-cd6ed9ad33da | moo1o/AlgorithmPractice | Baekjoon/14501.cpp | #include <iostream>
#define MAX 20
using namespace std;
int N, ans;
struct INFO {
int T;
int P;
}info[MAX];
void func(int day, int ary[MAX]) {
/*for (int i = 1; i <= N; i++) {
printf("%3d", ary[i]);
}
printf("\n");*/
if (day == N+1) {
if (ary[N] > ans)
ans = ary[N];
return;
}
//if (ary[day] == 0) {
... | ALGO | 0.999887 | 3.260112 |
458e3d38-c087-4729-b2d6-5a2b9cd98e07 | ishandutta2007/codeforces | jhin/normal/1185/C2.cpp | // system.cout(translate *from glut);
#include <bits/stdc++.h>
using namespace std;
const int mod=1e9+7;
vector<long long> p;
int ho,mi,se,ho1,mi1;
void fix_time()
{ if(se>59)mi+=se/60,se=se%60;if(se<0)se+=60,mi--;
if(mi>59)ho+=mi/60,mi=mi%60;if(mi<0)mi+=60,ho--;
if(ho<0)ho+=24;if(ho>24)ho-=24;
}
long long... | ALGO | 0.999843 | 3.252584 |
0b859914-8b83-4121-99af-3a7ca4b4ce6b | matt-beall/Various | Number01_6/Number01_6.cpp | /*
String Compression: Implement a metod to perform basic string compression using the counts
of repeated characters. For example, the string aabcccccaaa would become a2b1c5a3. If the
"compressed" string would not become smaller than the original string, your method should
return the original string. You can assume ... | ALGO | 0.999941 | 5.925817 |
75c4fe9e-889f-4163-ad05-7e3425dee595 | asdfghjkkl11/algorythm | beakjoon/2920.cpp | #include <iostream>
#include <string.h>
using namespace std;
int main()
{
int C[8];
int d;
for (int i = 0; i < 8;i++) {
cin >> C[i];
}
d = C[1] - C[0];
bool c = true;
for (int i = 2; i < 8;i++) {
if (C[i] - C[i - 1] != d) {
c = false;
break;
}
}
if (c == false)
cout << "mixed\n";
else {
if (d ... | ALGO | 0.99988 | 3.204765 |
8dce96df-a6a5-4c23-b9f5-e38c65a6cc7b | Sookmyung-Algos/2021algos | algos_assignment/2nd_grade/김윤서_minnie03/week5/1260.cpp | #include <iostream>
#include <algorithm>
#include <vector>
#include <queue>
using namespace std;
bool mark_b[1001] = { false, }; //bfs 전용 mark
bool mark_d[1001] = { false, }; //dfs 전용 mark
vector<int>a[1001];
queue <int> q;
int n, m, v;
void bfs(int x) { //x는 시작노드
int temp, next;
mark_b[x] = true; //정점을 방문했는지 나타내주는... | ALGO | 0.999992 | 4.451541 |
3fcc5dad-11b3-4ebc-bb8b-00b1633d4ef0 | viiccwen/Competitve-programming | APCS/j606. 2. 造字程式.cpp | #include <bits/stdc++.h>
using namespace std;
int main(){
ios_base::sync_with_stdio(false);
cin.tie(0);
int k, q, r;
string s1,s2;
cin >> k >> q >> r;
vector<string> v(q);
cin >> s1;
s2 = s1;
for (int i = 0; i < q; i++) {
for (int j = 0, temp; j < k; j++) {
cin >... | ALGO | 0.99851 | 3.016406 |
eb32c72d-c2ee-4adf-86e9-b88f642fe29e | dendisuhubdy/blaze | blazetest/src/mathtest/dmatdmatmin/MDaSDb.cpp | //=================================================================================================
//=================================================================================================
//*************************************************************************************************
// Includes
//****... | TEST | 0.877293 | 7.496456 |
e09ec959-ddfa-4d4a-81ea-9405719bfa35 | Tarela4ka/Programming | Training/UVa/1ch/Getting Start/12250.cpp | #include<iostream>
#include<string>
using namespace std;
int main(){
int caseN = 0;
while(true){
caseN++;
string s;
getline(cin, s);
if (s == "#") break;
cout << "Case " << caseN << ": ";
if (s == "HELLO") cout << "ENGLISH";
else if (s == "HOLA") cout <<... | ALGO | 0.983965 | 4.331557 |
e2b4910c-a948-40a5-96f2-ba2059accd4e | remyvnkhiemtruong/codeforces-submissions | codeforces/1080/A.cpp | #include<bits/stdc++.h>
using namespace std;
#define int long long
#define double long double
#define fi first
#define se second
#define pb push_back
#define pob pop_back
#define mp make_pair
#define endl '\n'
#define For(i, a, b) for (int i = a; i < b; i++)
#define ForE(i, a, b) for (int i = a; i <= b; i++)
#define F... | ALGO | 0.999719 | 3.289326 |
7fac0e09-ec2a-404a-ac38-13829c035014 | anugoyal998/DSA | TLE_Level3/Daily Problems/14_Aug_Number_Reduction.cpp | #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef vector<double> vd;
typedef vector<vector<int>> vvi;
typedef vector<vector<double>> vvd;
const int N = 500010;
int bit[N];
void update(int i, int x){
for(; i < N; i += (i&-i))
bit[i] += x;
}
int sum(int i){
int ans... | ALGO | 0.99998 | 4.034674 |
5d6bb68c-df74-4219-b14b-0a7b2f306285 | daviddoria/Examples | c++/Broken/RangeLoops/RangeLoops.cpp | #include <iostream>
#include <vector>
#include <cstdlib>
using namespace std;
void TestRangeLoop();
int main(int argc, char* argv[])
{
TestRangeLoop();
return 0;
}
void TestRangeLoop()
{
int my_array[5] = {1, 2, 3, 4, 5};
for(int &x : my_array)
{
x *= 2;
}
} | ALGO | 0.980256 | 4.052769 |
91503a9d-7bfb-4a34-af78-08e06d928e46 | ayeshatahirme/Clock-Replacement-Policy | third_party/murmur3/MurmurHash3.cpp | // This source file was originally from:
// https://github.com/PeterScott/murmur3
//
// We've changed it for use with VoltDB:
// - We changed the top-level functions defined below to return
// their hash by value, rather than accept a pointer to storage
// for the result
// Note - The x86 and x64 versions ... | ALGO | 0.984485 | 7.048966 |
c88dfd1e-c3fe-44d6-a6a4-c7881c27a615 | scott-sihui-wang/LeetCode | 349_Intersection_of_Two_Arrays.cpp | class Solution {
public:
vector<int> intersection(vector<int>& nums1, vector<int>& nums2) {
vector<int>sol;
bool vis[1001];
bool add[1001];
memset(vis,0,sizeof(vis));
memset(add,0,sizeof(add));
for(int i=0;i<nums1.size();i++){
vis[nums1[i]]=true;
}... | ALGO | 0.999909 | 5.487078 |
7495e299-2234-46cf-ba51-2ec3d23074bf | ishandutta2007/codeforces | imeimi/normal/1218/F.cpp | #include <iostream>
#include <algorithm>
#include <vector>
#include <queue>
using namespace std;
typedef long long llong;
int n, k, A;
int X[100001];
int C[100001];
int main() {
ios_base::sync_with_stdio(0); cin.tie(0);
cin >> n >> k;
for (int i = 1; i <= n; ++i) cin >> X[i];
cin >> A;
for (int i... | ALGO | 0.999986 | 3.541563 |
8b02b9a5-eae8-4277-b0a9-19299aa3c207 | Deepak-Choudhary0/codes | Old Codes/C++/1A.CPP | // LABSET - 1A
/*
W.A.P TO SEARCH FOR A GIVEN ELEMENT IN A LIST OF SIZE 'n' USING RECURSIVE BINARY SEARCH.
COMPUTE THE TIME TAKEN FOR EXECUTING THIS PROGRAM
*/
#include <iostream>
#include <time.h>
#include <conio.h>
#include <stdlib.h>
using namespace std;
template <class T>
void bubblesort(T a[], int n)
{
for ... | ALGO | 0.999887 | 3.874598 |
f56eb30f-da1b-4ab5-9b4d-62ac88636177 | amacalito/leetcode | algorithms/cpp/findNearestPointThatHasTheSameXOrYCoordinate/FindNearestPointThatHasTheSameXOrYCoordinate.cpp | // Source : https://leetcode.com/problems/find-nearest-point-that-has-the-same-x-or-y-coordinate/
// Author : Hao Chen
// Date : 2021-03-13
/*****************************************************************************************************
*
* You are given two integers, x and y, which represent your current l... | ALGO | 0.999983 | 6.103825 |
0ff12c9d-cc27-4018-b66b-e722b8a927e8 | ktr03rtk/study-algorithm | atcoder.jp/agc027/agc027_a/Main.cpp | #include <bits/stdc++.h>
#define rep(i, j, n) for (int i = j; i < (int)(n); i++)
using namespace std;
using ll = long long;
int main() {
int n, x;
cin >> n >> x;
vector<int> a(n);
rep(i, 0, n) { cin >> a[i]; }
sort(a.begin(), a.end());
int ans = 0;
rep(i, 0, n) {
if (x >= a[i]) {
x -= a[i]... | ALGO | 0.999964 | 4.463037 |
40893e0a-8651-48d2-8745-ad1cec5ca571 | dylan007/Coding | codechef/mndigsumsmall.cpp | /*=======================
Author : Doraemon
File : mndigsumsmall
=======================*/
#include <bits/stdc++.h>
using namespace std;
using ll = long long int;
using ull = unsigned long long int;
#define PB push_back
#define MK make_pair
#define SZ(a) (int)(sizeof(a))
#define F first
#define S second
#de... | ALGO | 0.99998 | 3.092328 |
3a3b5e1e-7b7b-4f00-9e07-92e538a59121 | Soham-KT/Codes | C++/DSA/Abdul Bari/Matrices/sparce_matrix.cpp | #include <iostream>
using namespace std;
class element
{
public:
int i, j, x;
};
class sparse
{
int m, n, num;
element *ele;
public:
sparse(){}
sparse(int m, int n, int num)
{
this->m=m;
this->n=n;
this->num=num;
ele=ne... | ALGO | 0.997862 | 3.713144 |
6735cf45-af30-457c-a1f5-34fc2a3ea660 | AndHager/SysCallStubber | llvm-project/llvm/lib/DebugInfo/Symbolize/Symbolize.cpp | #include "llvm/DebugInfo/Symbolize/Symbolize.h"
#include "SymbolizableObjectFile.h"
#include "llvm/ADT/STLExtras.h"
#include "llvm/BinaryFormat/COFF.h"
#include "llvm/Config/config.h"
#include "llvm/DebugInfo/DWARF/DWARFContext.h"
#include "llvm/DebugInfo/PDB/PDB.h"
#include "llvm/DebugInfo/PDB/PDBContext.h"
#include... | TOOL | 0.885976 | 7.822385 |
cb3e55ce-dbbf-49e5-af1c-7db6af85eb08 | aryans1319/LeetCode | 21-merge-two-sorted-lists/21-merge-two-sorted-lists.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* mergeTwoLis... | ALGO | 0.99984 | 5.63207 |
167f4f6b-d910-4907-8595-67a561cef877 | iagorrr/Competitive-Programming-Solutions | submissions/Codeforces/1783A.cpp | // iagorrr ;)
#include <bits/stdc++.h>
using namespace std;
#define fastio ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
using ll = long long;
using vll = vector<ll>;
using pll = pair<ll, ll>;
#define minpq priority_queue<ll, vll, greater<ll>()>
//•¨•.¸¸♪main•¨•.¸¸♪( -ω-)ノ ( ・ω・)
int main(){
fastio;
... | ALGO | 0.999956 | 3.768224 |
8924539a-7195-4bb3-a498-6634495d2dd6 | Abde-l-latif/rock_paper_scissor | rock_paper_scissors/rock_paper_scissors.cpp | #include <iostream>
#include <cstdlib>
#include <ctime>
using namespace std;
enum egame { rock = 1 , paper , scissor };
int get_random_number(int from , int to)
{
int random = rand() % (to - from + 1) + from;
return random;
}
short int get_rounds()
{
short int round = 0;
do {
cout << "How many r... | ALGO | 0.983664 | 3.486181 |
797122c2-a827-40b0-9f3b-a4703e02f02a | saurabh-vit/GfG | Difficulty: Hard/Palindrome SubStrings/palindrome-sub-strings.cpp | class Solution {
public:
int countPS(string &s) {
// code here
int n = s.size();
int count = 0;
auto expand = [&](int left, int right) {
while (left >= 0 && right < n && s[left] == s[right]) {
if (right - left + 1 >= 2) // length >= 2
... | ALGO | 0.999702 | 4.52723 |
fa531776-0883-42a7-ad75-8baeced01b23 | NaufalF121/Erichto-Code-Reff | lectures/binary-search/sqrt.cpp | // Sqrt(x), https://leetcode.com/explore/learn/card/binary-search/125/template-i/950/
/*
int f() {
int left = 0, right = n - 1;
int ans = -1;
while(left <= right) {
int mid = left + (right - left) / 2;
if(property(mid)) {
ans = mid;
right = mid - 1; // if we're looking for the first (leftmost e... | ALGO | 0.999987 | 5.836675 |
e7053f9d-fedd-43f4-a5b8-4d3f586c1739 | alexandraback/datacollection | solutions_5690574640250880_0/C++/Burunduk1/c.cpp | /**
* Author: Sergey Kopeliovich (<EMAIL>)
* Date: 2014.04.12
*/
#include <cstdio>
#include <cmath>
#include <cstring>
#include <cassert>
#include <algorithm>
using namespace std;
#define forn(i, n) for (int i = 0; i < (int)(n); i++)
const int N = 103;
char s[N][N];
void solve( int tn )
{
printf("Case #%d:\n... | ALGO | 0.999047 | 3.562518 |
c9d80908-2501-44b5-9c96-ae042e2f92ca | aranga81/MPC-controller | src/Eigen-3.3/doc/examples/QuickStart_example2_fixed.cpp | #include <iostream>
#include <Eigen/Dense>
using namespace Eigen;
using namespace std;
int main()
{
Matrix3d m = Matrix3d::Random();
m = (m + Matrix3d::Constant(1.2)) * 50;
cout << "m =" << endl << m << endl;
Vector3d v(1,2,3);
cout << "m * v =" << endl << m * v << endl;
}
| ALGO | 0.990561 | 3.375595 |
809fa973-6f57-442e-a52d-240bcdcbf72e | leo950413/Codeforces | Codeforces/temp/Finished/2134/2134B.cpp | #include<iostream>
#include<vector>
#include<numeric>
using namespace std;
int gcd(int a, int b) {
int res = min(a, b);
while (res > 1) {
if (a % res == 0 && b % res == 0)
break;
res--;
}
return res;
}
void solve(){
int n,k;
cin >> n >> k;
int g = -1;
for(int i=... | ALGO | 0.999881 | 3.264448 |
ce5d5e25-c304-4131-9d54-e24855fdb96d | servinas/ACPC-Future-academy-level-1-upsolving- | sheet 3/F - YES or YES?.cpp | #include<bits/stdc++.h>
using namespace std;
int main() {
int t;
cin>>t;
string s;
while (t--){
cin>>s;
if((s[0]=='Y'||s[0]=='y')&&(s[1]=='E'||s[1]=='e')&&(s[2]=='s'||s[2]=='S'))cout<<"YES\n";
else cout<<"NO\n";
}
return 0;
}
| ALGO | 0.997934 | 3.920422 |
99683782-5fc9-4a94-b85d-7515a1d03b40 | aeum1016/miscPrograms | src/UFPTPractice/basic_problems/isithalloween.cpp | #include <stdio.h>
#include <string>
#include <iostream>
int main(){
std::string MD;
std::getline(std::cin, MD);
if((MD == "OCT 31") || (MD == "DEC 25"))
{
printf("yup");
}
else printf("nope");
return 0;
} | ALGO | 0.998854 | 4.662411 |
dedb898c-ed9b-4450-88c9-5cae0cd3ac31 | GXDE-OS/boost1.67 | libs/hana/example/tutorial/integral-branching.cpp | #include <boost/hana.hpp>
#include <boost/hana/ext/std/integral_constant.hpp>
#include <memory>
#include <string>
#include <type_traits>
#include <utility>
namespace hana = boost::hana;
namespace ns1 {
//! [make_unique.if_]
template <typename T, typename ...Args>
std::unique_ptr<T> make_unique(Args&&... args) {
ret... | TOOL | 0.898084 | 7.461731 |
7943e5d5-ceff-4060-803b-7222d2ec0712 | omarchehab98/open.kattis.com-problems | 4thought/4thought.cpp | #include <iostream>
#include <algorithm>
#include <vector>
using namespace std;
int eval(int o, int a, int b) {
switch (o) {
case 0:
return a * b;
case 1:
return a / b;
case 2:
return a + b;
case 3:
return a - b;
}
return 0;
}
void solve(int n) {
vector<char> operators... | ALGO | 0.999853 | 4.925519 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.