uuid string | repo_name string | relative_path string | content string | category string | algo_rel_score float64 | quality_score float64 |
|---|---|---|---|---|---|---|
e54b8a2b-361a-4e45-b86e-e14950a669a4 | mahammedhussain/-c-programming-1 | reverse an array.cpp | #include <stdio.h>
int main()
{
int arr[] = {1, 2, 3, 4, 5};
int length = sizeof(arr)/sizeof(arr[0]);
printf("Original array: \n");
for (int i = 0; i < length; i++) {
printf("%d ", arr[i]);
}
printf("\n");
printf("Array in reverse order: ... | ALGO | 0.973807 | 4.095055 |
ab5ac820-366f-494d-acd0-1c1584285048 | yugo-eliatrope/psnr-ssim | comparator/cpp/metrics.cpp | #include <opencv2/core/core.hpp>
#include <opencv2/imgproc/imgproc.hpp>
#include <opencv2/highgui/highgui.hpp>
#include "metrics.h"
using namespace cv;
double psnr(const Mat &I1, const Mat &I2)
{
Mat s1;
absdiff(I1, I2, s1);
s1.convertTo(s1, CV_32F);
s1 = s1.mul(s1);
Scalar s = sum(s1);
double sse = s.va... | TOOL | 0.912539 | 5.394044 |
b511e82a-6b1b-4bc3-aa09-c0bac3af5f7a | SuperHong94/Algorithm_Problems | BAEKJOON/MooTube_백준/MooTube_백준/소스.cpp | //https://www.acmicpc.net/status?user_id=tnswh213&problem_id=15591&from_mine=1
#include <iostream>
#include <vector>
#include <queue>
using namespace std;
vector<pair<int, int>> graph[5001];
constexpr int INF = 2147483647;
int N, Q;
int BFS(int start, int K)
{
int ret = 0;
queue<pair<int, int>> q;
vector<bool> vis... | ALGO | 0.999972 | 4.834661 |
84bd3182-fd2d-4c78-b86b-b6744774911c | harryjo97/GruM | GruM_2D/evaluation/orca/orca.cpp | #include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cassert>
#include <ctime>
#include <iostream>
#include <fstream>
#include <set>
#include <sstream>
#include <unordered_map>
#include <algorithm>
using namespace std;
typedef long long int64;
typedef pair<int,int> PII;
typedef struct { int first, second... | ALGO | 0.999082 | 3.38655 |
c656a031-0bbd-4ac7-b975-e1de8b198246 | EmptyBlueBox/Practice_of_Programming_in_C_and_CPP_cxsjsx-ljy-2022Spring-PKU | 2022 程序设计实习作业/自由演武场(C++部分,算法部分是周末的上机测试)/0309编程填空:分数类.cpp | #include <iostream>
using namespace std;
int gcd(int x, int y) {
return x % y == 0 ? y : gcd(y, x % y);
}
class Fraction {
int num, den;
public:
// 在此处补充你的代码
Fraction(int _num, int _den = 1) :num(_num), den(_den) {}
void operator*=(Fraction a) {
num *= a.num;
den *= a.den;
int g = gcd(num, den);
n... | ALGO | 0.99978 | 3.499548 |
8c3a4273-fa3e-483f-8aaa-624ecb4a6604 | iamakashrout/Competitive-Programming | CodeForces/ROUND 933/b.cpp | #include<bits/stdc++.h>
using namespace std;
#define ll long long int
#define endl '\n'
const ll mod=1e9+7;
void solve(){
ll n;
cin>>n;
vector<ll> a(n);
for(ll i=0; i<n; i++){
cin>>a[i];
}
a[1]-=2*a[0];
a[2]-=a[0];
a[0]=0;
if(a[1]<0 || a[2]<0){
cout<<"NO"<<endl;
... | ALGO | 0.999803 | 4.198072 |
0301c505-2f3f-4143-8337-3652700e3261 | robwatsongtr/CPP_Helpful_Code | vectorPushbackOstreamExample.cpp | // simple push_back on vector demo
// with print of vector using ostream_iterator
#include <iostream>
#include <string>
#include <vector>
using namespace std;
int main() {
int vecSize = 0;
std::cout << "Enter the size of the vector. Maximum size is 10: ";
std::cin >> vecSize;
if (vecSize > ... | TOOL | 0.904836 | 4.097928 |
99a3ea51-7a7c-4175-9b8a-c931b2f972e4 | albertcabello/Competitive-Programming | Kattis Problems/Completed/realChallenge.cpp | #include<iostream>
#include<iomanip>
#include<math.h>
using namespace std;
int main() {
long long t;
cin >> t;
cout << fixed << setprecision(7) << 4 * sqrt(t);
}
| ALGO | 0.999433 | 3.42075 |
3d638838-a517-43ec-8d39-449b162d45e0 | competitiveprogrammingpietro/competitiveprogramming | segment_tree.cpp | #include <vector>
#include <iostream>
#define MIN(a,b) (a > b) ? a : b
using namespace std;
class segment_tree {
public:
segment_tree(int size): m_tree(size * 2 - 1, 0) { };
void buildTree(vector<int> input, int low, int high, int pos);
int sum(int qmin, int qmax, int lower, int high, int pos);
void update... | ALGO | 0.999297 | 5.032671 |
f130fc44-f08d-49d7-ac95-c42dee7e6fca | brenimcode/CompetitiveProgramingSolving | Contests/Revisao/Strings/xorSpace.cpp | #include <bits/stdc++.h>
#define DEBUG(x) cout << #x << " >>>> " << x << endl
using namespace std;
string xorSpace(string s){
int n=s.size();
for (int i=0; i<n; ++i){
s[i]^=' ';
}
return s;
}
int main() {
string str;
getline(cin,str);
cout << xorSpace(str) << endl;
... | ALGO | 0.999965 | 3.716468 |
d108dbcb-c4c8-429c-b252-c06432fe8c4a | RigelLM/Illusion-Engine | Illusion/Lib/glm/test/core/core_func_integer_find_msb.cpp | #include <glm/glm.hpp>
#include <cstdio>
#include <cstdlib> // To define "exit", req'd by XLC.
#include <ctime>
#define LE 1 // 1 for little-endian, 0 for big-endian.
int pop(unsigned x) {
x = x - ((x >> 1) & 0x55555555);
x = (x & 0x33333333) + ((x >> 2) & 0x33333333);
x = (x + (x >> 4)) & 0x0... | ALGO | 0.998482 | 3.533907 |
aa4b5862-8cd0-4d46-88a0-3b7c6627881d | choudharysneha1708/Striver-s_SDE_Sheet_challenge | Max sum in sub-arrays - GFG/max-sum-in-subarrays.cpp | //{ Driver Code Starts
#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
// } Driver Code Ends
class Solution{
public:
long long pairWithMaxSum(long long arr[], long long n)
{
long long MaxSum=LONG_MIN;
long long CurrSum=arr[0];
for(int i=1; i<n; ++i){
... | ALGO | 0.999859 | 5.466614 |
45d8edef-dca6-461a-b8b1-43f5d646800a | SaifAliii/DSA | AlgorithmicToolBox/week3_greedy_algorithms/7_maximum_salary/largest_number.cpp | #include <algorithm>
#include <sstream>
#include <iostream>
#include <vector>
#include <string>
using std::vector;
using std::string;
string largest_number(vector<string> a) {
//write your code here
std::stringstream ret;
for (size_t i = 0; i < a.size(); i++) {
ret << a[i];
}
string result;
ret >> res... | ALGO | 0.999841 | 5.216435 |
578dd472-d688-4b6a-a17d-cffdc02f0221 | zhaohuakai/dalvikvm | vm/analysis/Liveness.cpp | /*
* Liveness analysis for Dalvik bytecode.
*/
#include "Dalvik.h"
#include "analysis/Liveness.h"
#include "analysis/CodeVerify.h"
static bool processInstruction(VerifierData* vdata, u4 curIdx,
BitVector* workBits);
static bool markDebugLocals(VerifierData* vdata);
static void dumpLiveState(const VerifierData* v... | ALGO | 0.907105 | 4.385487 |
3496ab7d-d16f-421b-b7dc-e0984b73f840 | ftkartik/my-codes | c++/tree/treeimple.cpp | #include<iostream>
#include<queue>
using namespace std;
class node
{
public:
int data;
node* left;
node* right;
node(int data)
{
this->data=data;
node*left;
node*right;
}
};
node* buildtree(node* root)
{
// int data;
// cout<<"enter data "<<endl;
// cin>>d... | ALGO | 0.99972 | 4.147964 |
d7fb20c6-8d82-4ed1-a195-8b3a6820cc81 | niranjan35/coding-practise | 1048-longest-string-chain/1048-longest-string-chain.cpp | struct compare {
bool operator()(const string f, const string s) {
return f.size()<s.size();
}
};
class Solution {
public:
map<string,int> mp;
int rec(vector<string>& arr, set<string> s, string curr) {
int len=1;
if(mp[curr]!=-1) {
return mp[curr];
}
... | ALGO | 0.999989 | 5.578617 |
7c7bb504-9fc5-4c65-bfaf-547581ef2fe1 | 123shanawaz/leetcode-solution-with-shanawaz | 997-find-the-town-judge/997-find-the-town-judge.cpp | class Solution {
public:
int findJudge(int n, vector<vector<int>>& trust) {
vector<int>indegree(n+1,0);
vector<int>outdegree(n+1,0);
for(int i=0;i<trust.size();i++){
int v=trust[i][0];
int u=trust[i][1];
indegree[u]+=1;
outdegree[v]+=1;
... | ALGO | 0.999902 | 5.426459 |
e4763cce-4f9c-4401-8885-91923b6b2a11 | twelcone/CS112.L21.KHCL | Tự luyện/VNOI/number.cpp | #include <iostream>
#include <stdio.h>
#include <cstdio>
#define maxn 10001
int adj[maxn], adj2[maxn], head[maxn], head2[maxn], linker[maxn], link2[maxn], part[maxn];
bool avail[maxn], visit[maxn];
int res,n,m,t,ssc;
using namespace std;
void inputer() {
//freopen("number.in","r",stdin);
scanf("%d %d %d",... | ALGO | 0.99991 | 4.090724 |
d15585ef-89f0-454c-9fa0-517cadfee4bd | truthspy/LeetCode | Session1/310_Minimum_Height_Trees.cpp | /**
* 思路from:http://www.cnblogs.com/grandyang/p/5000291.html
*/
class Solution {
public:
vector<int> findMinHeightTrees(int n, vector<pair<int, int>>& edges) {
vector<int> result;
vector<vector<int>> graph(n);
vector<int> indegree(n, 0);
int edgeNum = edges.size();
for(int ... | ALGO | 0.999998 | 5.783791 |
f6c204e2-2100-4ca9-9564-e03883a0815b | Ian-Codding-II/CS150 | Quiz/TestForFinal/practice/6.cpp | //6.cpp (10 pts)
#include <iostream>
using namespace std;
const int SIZE = 4;
int absoluteDifference(int array [][SIZE], int ROW);
int main()
{
int matrix[SIZE][SIZE] = { {10, 20, 30, 40},
{15, 25, 35, 45},
{50, 60, 70, 80},
... | ALGO | 0.99887 | 4.123309 |
cc0f98df-8f88-47f7-b3a0-ba7e409f3aaa | atharvmunot004/CodeChef | 872_ChefAndContests.cpp | #include <bits/stdc++.h>
using namespace std;
int main() {
int T;
cin >> T;
while (T--) {
int X, Y, P, Q;
cin >> X >> Y >> P >> Q;
int chefPenalty = X + 10 * P;
int chefinaPenalty = Y + 10 * Q;
if (chefPenalty < chefinaPenalty) {
cout << "Chef" ... | ALGO | 0.999158 | 3.989942 |
70878572-1d21-4733-8973-a480b3918004 | chetan4151/DSA-GEEKSFORGEEKS | Arrays/BitonicPoint.cpp | // Problem Link - https://practice.geeksforgeeks.org/problems/maximum-value-in-a-bitonic-array3001/1
#include <bits/stdc++.h>
using namespace std;
// } Driver Code Ends
//User function template for C++
class Solution{
public:
int findMaximum(int arr[], int n) {
int start=0;
int end=n-1;
while(start<... | ALGO | 0.999869 | 5.798722 |
8cb769d2-517e-44ea-a472-e993805dd989 | andersvestengen/Computational-Physics-FYS3150 | Project1/1_b/testmain.cpp | // Project 1
#include <iostream>
#include <new>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <fstream>
#include <iomanip>
#include <string>
#include "time.h"
#include <stdio.h>
using namespace std;
ofstream ofile;
inline double f(double x){return 100*exp(-10*x);}
inline double exactfunc(double x)... | ALGO | 0.999464 | 3.190796 |
bd089ad8-06fc-45e8-8941-4b52d2575dd8 | AlexMarinbakh/studious-eureka | 6.cpp | #include<iostream>
using namespace std;
int main() {
int number;
cout << "number: " << endl;
cin >> number;
int remainder = number % 2;
cout << "remainder: " << remainder << endl;
} | ALGO | 0.978217 | 3.321425 |
7ced7d3b-223c-40b9-9ce0-572bb02b2007 | sharryXheisenberg/CrackYourPlacement | String/largest_odd_number_string.cpp | #include<iostream>
#include<bits\stdc++.h>
#include<string>
#include<algorithm>
using namespace std ;
class Odd{
public:
class Solution {
public:
string largestOddNumber(string num) {
int n = num.length();
for (int i = n - 1; i >= 0; --i) {
if ((num[i] - '0') % 2 != 0) {
... | ALGO | 0.999534 | 4.977365 |
731aba21-3b19-453a-a936-7ef708cf4088 | KNikki15/CSES | Geometry/Polygon_Area.cpp | #include<bits/stdc++.h>
using namespace std;
int main(){
int n,i;
cin>>n;
vector<pair<long long,long long>>point(n);
for(i=0;i<n;i++){
cin>>point[i].first>>point[i].second;
}
long long area=0;
for(i=0;i<n;i++){
long long x1=point[i].first,y1=point[i].second;
long long x2=point[(i+1)%n].first,y2=point[(i+1)%n].se... | ALGO | 0.999694 | 4.219213 |
5f422be7-7afb-47b2-875a-b33d5e4bf0da | LifWirser/VSE_Test | engine/objconv/mesher/from_obj.cpp | #include "PrecompiledHeaders/Converter.h"
#include "from_obj.h"
#include <utility>
#include <cstring> //We are using C style string functions here
using namespace std;
/* Renamed to get rid of namespace collisions */
class TObj_Vector {
public:
float i, j, k;
TObj_Vector() {
}
TObj_Vector(const G... | TOOL | 0.855112 | 4.337088 |
7a4041af-818e-4c0a-b17d-1a278d0588dc | manulecam/trainingpi | ejercicio1d.cpp | #include <iostream>
using namespace std;
int main()
{
cout << "-----------------------------------" << endl;
cout << "----------# Ejercicio 1 #----------" << endl;
cout << "-----------------------------------" << endl;
int i = 1;
for (i; i<=100; i++) {
cout << i << " ";
if (i % 5 ==... | TOOL | 0.997018 | 3.085618 |
4a851045-ee6e-4a32-9d5f-56eca3d85716 | LBROUBRE/osrm-backend | src/tools/partition.cpp | #include "partitioner/partitioner.hpp"
#include "partitioner/partitioner_config.hpp"
#include "osrm/exception.hpp"
#include "util/log.hpp"
#include "util/meminfo.hpp"
#include "util/timing_util.hpp"
#include "util/version.hpp"
#include <tbb/task_scheduler_init.h>
#include <boost/algorithm/string/join.hpp>
#include <... | CONFIG | 0.992939 | 6.937959 |
aeefb5ef-efd5-47b7-ae69-5af54965a6ce | CodeCamper-Sub/Problem_Solving | codeforce/Codeforces Round (Div. 2)/836/B/main.cpp | #include <bits/stdc++.h>
#define INF 999999999999
typedef long long ll;
using namespace std;
ll n;
int main() {
ios_base::sync_with_stdio(false);
cin.tie(0);
ll T;
cin >> T;
while(T--) {
cin >> n;
if(n % 2 != 0) {
for(ll i = 0; i < n; i++) {
cout << 1 << ' ';
}
cout << '\n... | ALGO | 0.999775 | 3.948121 |
9fa0caab-8ebb-4f1a-b3fd-eca343413735 | zzm99/Algorithm-Training | 动态规划/线性DP/152. 乘积最大子数组.cpp | class Solution {
public:
int maxProduct(vector<int>& nums) {
int n = nums.size();
if(n == 0) return 0;
if(n == 1) return nums[0];
int p = nums[0];
int maxp = nums[0];
int minp = nums[0];
for(int i=1; i<n; i++){
int t = maxp;
maxp = max(... | ALGO | 0.999982 | 6.05286 |
a786d080-d45d-4c38-8b09-f65f5101c6da | ishandutta2007/codeforces | koosha_mv/normal/1034/D.cpp | #include <bits/stdc++.h>
using namespace std;
#define dbgv(v) cout<<#v<<" = "; f(i,0,v.size()) cout<<v[i]<<" "; cout<<endl
#define dbga(a,x,y) cout<<#a<<" = "; f(i,x,y) cout<<a[i]<<" "; cout<<endl
#define erorp(x) cout<<#x<<"={"<<x.F<<" , "<<x.S<<"}"<<endl
#define eror(x) cout<<#x<<'='<<(x)<<endl
#define f_(i,a,b) for(... | ALGO | 0.999874 | 3.640795 |
62d77ba6-f36d-4728-ad7a-48890be16c1e | yitati/LCProject | Leetcode/RemoveLinkedListElement.cpp | /******************************************************************************
* Question: #203 Remove Linked List Elements
* company tag: PureStorage
* Remove all elements from a linked list of integers that have value val.
* Example
* Given: 1 -> 2 -> 6 -> 3 -> 4 -> 5 -> 6, val = 6
* Return: 1 -> 2 -> 3 -> 4 -> 5
**... | ALGO | 0.996308 | 5.621458 |
64163a86-2b27-4f8b-863e-682a14b4150d | zekigulen/komodo-marmara-v1-1-opret-v2 | src/cc/games/prices.cpp | std::string MYCCLIBNAME = (char *)"prices";
#define PRICES_BETPERIOD 3
UniValue games_rawtxresult(UniValue &result,std::string rawtx,int32_t broadcastflag);
extern uint8_t ASSETCHAINS_OVERRIDE_PUBKEY33[33];
#define bstr(x) ((double)((uint32_t)x) / 10000.)
struct prices_bar
{
uint64_t open,high,low,close,sum;
... | TOOL | 0.938729 | 4.184851 |
c06ae5ac-8157-4076-888f-551ff10ffd56 | tuandiniz/interactive-cg-ch2 | siaerpisky_2d_triangles.cpp | #include <iostream>
#include <fstream>
#include <glm/glm.hpp>
#include <vector>
#define GLFW_INCLUDE_GLCOREARB
#define GL_GLEXT_PROTOTYPES
#define BUFFER_OFFSET(bytes) ((GLvoid*) (bytes))
#include <GLFW/glfw3.h>
using namespace glm;
using namespace std;
typedef vec2 point2;
const int recursionDepth = 5;
int point... | TOOL | 0.958156 | 5.919751 |
c67103c2-cb1f-444a-80cc-5672918ba758 | MTG/essentia | src/examples/standard_predominantmask.cpp | #include <iostream>
#include <fstream>
#include <essentia/algorithmfactory.h>
#include <essentia/pool.h>
using namespace std;
using namespace essentia;
using namespace standard;
void scaleAudioVector(vector<Real> &buffer, const Real scale)
{
for (int i=0; i < int(buffer.size()); ++i){
buffer[i] = scale * buffer[i]... | TOOL | 0.932834 | 4.824736 |
aeb51d4d-a428-4973-affe-814cfbc03758 | alyssajayfr0st/wwb | orchestra.cpp | #include <random>
#include <iostream>
#include <chrono>
#include "XoshiroCpp.hpp"
#include <iomanip>
using namespace std;
using namespace XoshiroCpp;
// initialization and variable assignment
bool rezero = false;
int roll = 0;
int space = 0;
int highest = 0;
int rollcall = 0;
int highroll = 0;
double totalroll = 0;
uns... | TOOL | 0.990678 | 3.886085 |
47c29394-3e30-4934-bd67-c6a74efe96c1 | foolbread/leetcode | 682/682.cpp | class Solution {
public:
int calPoints(vector<string>& ops) {
vector<int> val;
int n;
int sum = 0;
for (size_t i=0; i!=ops.size(); i++)
{
if (ops[i] == "C")
{
sum -= val[val.size()-1];
val.pop_back();
}
... | ALGO | 0.999869 | 6.197957 |
2400bdf0-814f-47d2-a520-31b5c8e0e863 | kkpan11/apple-llvm-project | libc/src/math/generic/llrintf.cpp | #include "src/math/llrintf.h"
#include "src/__support/FPUtil/NearestIntegerOperations.h"
#include "src/__support/common.h"
namespace LIBC_NAMESPACE {
LLVM_LIBC_FUNCTION(long long, llrintf, (float x)) {
return fputil::round_to_signed_integer_using_current_rounding_mode<float,
... | ALGO | 0.997447 | 6.590887 |
1d663158-396c-4632-868a-55301be41fff | scottie/lex | src/utilstrencodings.cpp | #include "utilstrencodings.h"
#include "tinyformat.h"
#include <cstdlib>
#include <cstring>
#include <errno.h>
#include <limits>
#include <openssl/bio.h>
#include <openssl/buffer.h>
#include <openssl/crypto.h> // for OPENSSL_cleanse()
#include <openssl/evp.h>
using namespace std;
string SanitizeString(const string... | TOOL | 0.960733 | 6.982829 |
6b67a254-746a-48b1-9461-b2cf2ae0cac0 | babayaga-13/Competitive-Programming | CODEFORCES/div.3/B_Kana_and_Dragon_Quest_game.cpp | #include <bits/stdc++.h>
#define ll long long
#define endl "\n"
#define yes cout << "YES" << endl
#define no cout << "NO" << endl
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
using namespace std;
template <typename T>
using pbds = tree<T, null_type, less<T... | ALGO | 0.99911 | 4.052889 |
98eff048-7719-4142-9916-854e7409d469 | Kobzol/hardware-effects | bandwidth-saturation/bandwidth-saturation.cpp | #include <iostream>
#include <chrono>
#include <thread>
#include <cassert>
#include <vector>
#include <cstring>
#include <xmmintrin.h>
#ifndef COUNT
#define COUNT 16 * 1024 * 1024
#endif
#ifndef REPETITIONS
#define REPETITIONS 20
#endif
using Type = size_t;
template <bool NonTemporal>
void thread_fn(Type* items... | TOOL | 0.969854 | 5.834551 |
0f5bdee5-ae80-4181-ad69-02db73b34693 | sl1296/acm-code | uva-509-1 Accepted.cpp |
#include<cstdio>
using namespace std;
char x[10][7000];
char r[70000];
char ty[3];
int main(){
int d,s,b;
int cas=1;
while(1){
scanf("%d",&d);
if(!d)break;
int p=0,rn=0;
scanf("%d%d%s",&s,&b,ty);
ty[0]=ty[0]=='E'?0:1;
for(int i=0;i<d;i++){
scanf("... | ALGO | 0.994972 | 3.338032 |
16a058e4-daf6-43af-845b-623d78b929f7 | yongkangSun/Games101 | homework/1/code/eigen/eigen3/bench/perf_monitoring/gemm/gemm.cpp | #include <iostream>
#include <fstream>
#include <vector>
#include <Eigen/Core>
#include "../../BenchTimer.h"
using namespace Eigen;
#ifndef SCALAR
#error SCALAR must be defined
#endif
typedef SCALAR Scalar;
typedef Matrix<Scalar,Dynamic,Dynamic> Mat;
EIGEN_DONT_INLINE
void gemm(const Mat &A, const Mat &B, Mat &C)
{... | TEST | 0.976791 | 5.689105 |
2ba1703e-bd18-45c4-8a9b-90b06addc5de | komura-athushi/GC2021_SampleGame | k2EngineLow/ExEngine/effekseer/Effekseer/Effekseer/SIMD/Effekseer.Mat43f.cpp | #include "Effekseer.Mat43f.h"
#include "../Effekseer.Matrix43.h"
#include <cmath>
namespace Effekseer
{
//----------------------------------------------------------------------------------
//
//----------------------------------------------------------------------------------
const Mat43f Mat43f::Identity = Mat43f(
... | ALGO | 0.872716 | 6.083753 |
b0c77b56-9529-490a-8ae9-3189b29da9c2 | akashc1612/Codeforces_ras | antonandletters.cpp | #include <bits/stdc++.h>
using namespace std;
void solve(){
string a;
int c=0,flag=0;
getline(cin,a);
for (int i = 0; i < a.length(); ++i)
{
if(isalpha(a[i])){
flag=0;
for (int j = i+1; j < a.length(); ++j)
{
if(a[i]==a[j]){
flag=1;
break;
}
}
if(flag==0){
c++;
}}
}
cout<<c;
}
int ... | ALGO | 0.999802 | 4.08381 |
450f7e80-a3f7-482f-ab6a-58c70b9524fd | sjj118/OI-Code | 51Nod/marathon/19/F/code.cpp | #include<iostream>
#include<cstdio>
#define rg register
#define rep(i,x,y) for(rg int i=(x);i<=(y);++i)
#define per(i,x,y) for(rg int i=(x);i>=(y);--i)
using namespace std;
typedef long long LL;
const int N=1e6+10,MO=104857601;
int n,a[N],A,B,f[N];
LL m;
int main(){
scanf("%d%lld",&n,&m);
scanf("%d%d%d",&a[1],&... | ALGO | 0.999925 | 3.342106 |
44719f0e-8002-479e-a6a3-91ba69494565 | RaviRajGhorsai/Discrete-Structure-Algorithms | Combination.cpp | #include<iostream>
using namespace std;
long long int factorial(int a){ //it supports long integers too
if(a==0){
return 1;
}
else
return a*factorial(a-1);
}
long long int nCr(int n,int r){
return factorial(n)/(factor... | ALGO | 0.99775 | 4.991656 |
c047aaa6-0bda-4b96-a30c-6681969ad231 | alexandraback/datacollection | solutions_5731331665297408_0/C++/jingling/c.cpp | #include <algorithm>
#include <numeric>
#include <functional>
#include <iostream>
#include <iomanip>
#include <sstream>
#include <string>
#include <vector>
#include <queue>
#include <set>
#include <map>
#include <stack>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cctype>
#include <cassert>
#inc... | ALGO | 0.999991 | 4.133352 |
02ea4fe6-5b39-409a-8bb3-31c16e7d77dc | danielhO9/PS | BOJ/14750.cpp | #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
ll cross(const pair<ll, ll>& a, const pair<ll, ll>& b) { return a.first * b.second - a.second * b.first; }
ll ccw(const pair<ll, ll>& a, const pair<ll, ll>& b, const pair<ll, ll>& c) {
pair<ll, ll> a_b = {b.first - a.first, b.second - a.second};
pa... | ALGO | 0.999891 | 4.533921 |
f2b67197-0b32-46d6-9398-1a1658ec6bb9 | noornabi-noor/Codeforces | bbb.cpp | #include <bits/stdc++.h>
using namespace std;
#define int long long
#define ld long double
#define lld long long double
#define ull unsigned long long
#define pll pair<int, int>
#define mod 1000000007
const int N = (int)1e6;
#define BISMILLAH ios_base::sync_with_stdio(0);cin.tie(0);
#define ALHAMDULILLAH return 0;
#d... | ALGO | 0.999963 | 4.702806 |
1579d9ba-e088-40cb-a81f-00b5269c72ad | HL2-Mods-Reimplementations-and-Ports/source-sdk-2013-steampipe-patches | mp/src/mathlib/randsse.cpp | #include <math.h>
#include <float.h> // Needed for FLT_EPSILON
#include "basetypes.h"
#include <memory.h>
#include "tier0/dbg.h"
#include "mathlib/mathlib.h"
#include "mathlib/vector.h"
#include "mathlib/ssemath.h"
// memdbgon must be the last include file in a .cpp file!!!
#include "tier0/memdbgon.h"
// see knuth vo... | TOOL | 0.986485 | 5.928762 |
3bf3a3a8-444e-4cb6-be60-bd0c121d55ca | AyushOJOD/DSA-codes | Leetcode/67.add-binary.cpp | #include<bits/stdc++.h>
using namespace std;
string addBinary(string a, string b)
{
int n1 = a.length(), n2 = b.length();
int maxlen = max(n1, n2);
int minlen = min(n1, n2);
for(int i=maxlen; i>0; i--){
}
}
int main(){
return 0;
} | ALGO | 0.999715 | 4.202779 |
9152c6e6-5e57-4d65-9a66-cbd68b2595b4 | n29-dev/codeforces-solutions | 1000/Settlement_of_Guinea_Pigs.cpp | #include <bits/stdc++.h>
using namespace std;
#define fastio() \
ios_base::sync_with_stdio(false); \
cin.tie(NULL); \
cout.tie(NULL)
#define MOD 1000000007
#define MOD1 998244353
#define INF 1e18
#define nline "\n"
#define PI 3.141592653589793238462
#define set_bits __builti... | ALGO | 0.999859 | 5.112199 |
a2480f8c-f60e-495f-a751-6a6f09783e68 | YungYurchik/SkillDiplom | src/invertedindex.cpp | #include "invertedindex.h"
#include <thread>
#include <string>
#include <set>
void InvertedIndex::UpdateDocumentBase(std::vector<std::string> input_docs)
{
docs = input_docs;
std::vector<std::thread> list_th;
for (std::string str : docs) { //
list_th.push_back(std::thread([&, str]() {
... | TOOL | 0.962107 | 5.190033 |
746045e0-e6c6-4755-9b3b-bcbe6cdb3906 | ishandutta2007/codeforces | 777777777plus/normal/1586/B.cpp | #include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const int N = 1e6+5;
int T;
int n,m;
int a[N],b[N],c[N],v[N];
int main(){
cin>>T;
while(T--){
cin>>n>>m;
for(int i=1;i<=n;++i)v[i]=0;
for(int i=1;i<=m;++i)scanf("%d%d%d",&a[i],&b[i],&c[i]),v[b[i]]=1;
for(int i=1;i<=n;++i)
if(!v[i]){
for... | ALGO | 0.999907 | 3.234302 |
91885aff-49e9-4117-b94a-e1fee8f0dfd2 | ishandutta2007/codeforces | cheetose/normal/867/E.cpp | #include<cstdio>
#include<cstdlib>
#include<iostream>
#include<vector>
#include<queue>
#include<bitset>
#include<string>
#include<stack>
#include<set>
#include<map>
#include<cstring>
#include<complex>
#include<cmath>
#include<iomanip>
#include<numeric>
#include<algorithm>
#include<list>
#include<functional>
#include<ca... | ALGO | 0.999969 | 3.401917 |
cdfb6050-4496-4013-a681-1bcf0ab90327 | 113bommy/deepmind_codecontests_refine | cpp_source_filter_file/cpp_train_11521_241.cpp | #include <bits/stdc++.h>
using namespace std;
int main() {
int n;
cin >> n;
if (n % 2 == 0)
cout << "Mahmud";
else
cout << "Ehab";
return 0;
}
| ALGO | 0.999921 | 3.740756 |
80d0364e-fc8b-4ba7-91b4-61c5c8801823 | ashrwin/Spoj-Solutions | solutions/LuciusDungeon.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.999944 | 3.661973 |
20d4fe0b-6b52-4f38-83d2-704de3eda24d | mbarleon/Raytracer | src/Elements/Scene/Textures/Procedural/PerlinNoise/Perlin/Perlin.cpp | /*
** EPITECH PROJECT, 2025
** Raytracer
** File description:
** Perlin
*/
#include "Perlin.hpp"
#include <algorithm>
#include <cmath>
#include <random>
raytracer::texture::Perlin::Perlin()
{
std::iota(_perm.begin(), _perm.begin() + 256, 0);
std::mt19937 gen{42};
std::shuffle(_perm.begin(), _perm.begin() ... | ALGO | 0.997011 | 5.406672 |
8edcb5ff-24fb-4c93-b105-87a1f2c0d51b | Nazifa-Mosharrat/ParallelWavefrontComputation | fastflow/fastflow-master/tests/test_accelerator3.cpp | /* -*- Mode: C++; tab-width: 4; c-basic-offset: 4; indent-tabs-mode: nil -*- */
/*
* Tests nesting accelerators.
* --------------------------------------
* | |
* |Work... | TEST | 0.850685 | 5.802186 |
b7bb53aa-96a0-41f0-bb05-bc289f371a39 | dorbh123/UnityHw | Phone HW8/Library/PackageCache/com.unity.ide.visualstudio@2.0.11/Editor/COMIntegration/COMIntegration~/COMIntegration.cpp | #include <iostream>
#include <sstream>
#include <string>
#include <filesystem>
#include <windows.h>
#include <shlwapi.h>
#include "BStrHolder.h"
#include "ComPtr.h"
#include "dte80a.tlh"
constexpr int RETRY_INTERVAL_MS = 150;
constexpr int TIMEOUT_MS = 10000;
// Often a DTE call made to Visual Studio can fail after ... | TOOL | 0.938693 | 6.977724 |
a3e64b4e-ab95-408a-a03d-55e0516bc1e3 | ttnhathuy313/cp-career | Codeforces/Contest1794/TaskC.cpp | #include <bits/stdc++.h>
using namespace std;
const int N = 1e5 + 5;
int n, a[N];
int main(int argc, char const *argv[])
{
ios_base::sync_with_stdio(0); cin.tie(0);
freopen("TaskC.INP", "r", stdin);
freopen("TaskC.OUT", "w", stdout);
int tc;
cin >> tc;
while (tc--) {
cin >> n;
for (int i = 1; i <= n; ++i)... | ALGO | 0.999871 | 3.94017 |
9aadfd33-412a-4bbd-857e-b381f0585831 | ahomentc/AdCentive | contracts/Old/libc++/upstream/test/std/numerics/rand/rand.dis/rand.dist.norm/rand.dist.norm.normal/eval_param.pass.cpp | // <random>
// template<class RealType = double>
// class normal_distribution
// template<class _URNG> result_type operator()(_URNG& g, const param_type& parm);
#include <random>
#include <cassert>
#include <vector>
#include <numeric>
#include <cstddef>
template <class T>
inline
T
sqr(T x)
{
return x * x;
}
in... | TEST | 0.979535 | 4.233556 |
cc72258e-00b9-4c78-a41f-7a4d7c08ac68 | adamspeedy/vtr3 | src/main/src/deps/steam/src/trajectory/const_acc/evaluable/compose_curlyhat_evaluator.cpp | #include "steam/trajectory/const_acc/evaluable/compose_curlyhat_evaluator.hpp"
namespace steam {
namespace traj {
namespace const_acc {
auto ComposeCurlyhatEvaluator::MakeShared(const Evaluable<InType>::ConstPtr& x,
const Evaluable<InType>::ConstPtr& y)
-> Ptr {
return ... | ALGO | 0.971374 | 7.482956 |
2e02cba3-e7c4-471e-92ee-ed036a1943e3 | sarvex/leetcode-c-- | solution/2100-2199/2165.Smallest Value of the Rearranged Number/Solution.cpp | class Solution {
public:
long long smallestNumber(long long num) {
if (num == 0) return 0;
vector<int> cnt(10);
bool neg = num < 0;
num = abs(num);
while (num) {
cnt[num % 10]++;
num /= 10;
}
long long ans = 0;
if (neg) {
... | ALGO | 0.999989 | 6.019276 |
ff9d406f-8b9f-4d9f-90aa-81a7935a3818 | Shintaro0105/Competitive-programming | atcoder/abc/226/b.cpp | #include <iostream>
#include <vector>
#include <set>
#include <array>
#include <cmath>
#include <string>
#include <algorithm>
#include <functional>
#include <map>
#include <tuple>
#include <queue>
#include <stack>
#include <bitset>
#include <deque>
#include <iomanip>
#define rep(i,n) for(int i = 0;i < (n);i++)
using na... | ALGO | 0.999926 | 4.233228 |
a0001748-a025-451b-960c-cd5ac6aefbe6 | mthorman/cProjects | sortingAlgorithms/BubbleSort.cpp | //Michael Thorman
//CSCI 24000
//11/23/2017
//
//Use the four pillars of the Object-Oriented paradigm to
//produce a program that sorts a list of numbers in descending order
//using either Insertion Sort or Bubble Sort. Also, provide runtime
//analysis of your program.
//
//Honor Pledge:
//
//I pledge that I have ne... | ALGO | 0.999403 | 4.730612 |
3989b2d5-e7d7-435f-bf64-fc19a60286f8 | Fempty34/Olympiad | TinkoffGeneration/DFS/M.cpp | // #pragma GCC optimize("O3,unroll-loops")
// #pragma GCC target("avx2")
#include <bits/stdc++.h>
#include <cmath>
using namespace std;
typedef long long ll;
typedef long double ld;
typedef string str;
#define all(a) a.begin(), a.end()
#define int long long
//#define print_array(_v) for(int i=0;i<(_v).size();++i){co... | ALGO | 0.999725 | 4.382329 |
4b80d511-d532-4165-94a0-675a92ac0c09 | shchiu/hotspot | src/share/vm/runtime/atomic.cpp | # include "incls/_precompiled.incl"
# include "incls/_atomic.cpp.incl"
jbyte Atomic::cmpxchg(jbyte exchange_value, volatile jbyte* dest, jbyte compare_value) {
assert(sizeof(jbyte) == 1, "assumption.");
uintptr_t dest_addr = (uintptr_t)dest;
uintptr_t offset = dest_addr % sizeof(jint);
volatile jint* dest_int ... | TOOL | 0.922407 | 5.906092 |
c5a5c879-7208-438e-933b-bc38a8ad4b33 | bony2023/Competitive-Programming | Dynamic Programming/Non-Classical/086 UVA - 11391 Blobs in the Board.cpp | // Author : Bony Roopchandani
// 11391 - Blobs in the Board
// DP+Bitmask
// INCLUDES
#include <algorithm>
#include <climits>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <iostream>
#include <list>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#i... | ALGO | 0.998975 | 3.486182 |
8ca3f417-0e21-43e6-be12-439638e5f1ad | yuqicxy/LeetCode | cpp/432.all-o-one-data-structure.cpp | /*
* @lc app=leetcode id=432 lang=cpp
*
* [432] All O`one Data Structure
*/
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <list>
#include <iostream>
#include <iterator>
using namespace std;
// @lc code=start
struct Node{
unsigned mFrequency;
unordered_set<str... | ALGO | 0.999507 | 6.416752 |
f12f7ef1-dd9e-4939-a59a-19b85c6e0ea2 | mitchnull/advent-of-code | aoc-2023/src/main/cpp/12a/main.cpp | #include <ios>
#include <iostream>
#include <cctype>
#include <cstdint>
#include <limits>
#include <deque>
#include <string>
#include <vector>
#include <map>
#include <unordered_map>
#include <bitset>
#include <algorithm>
#include <ranges>
#include <sstream>
#include <numeric>
using Num = std::uint64_t;
namespace ran... | ALGO | 0.998387 | 4.482348 |
22c7fdd1-de6a-4f09-b663-5c2237ec71c2 | sky-bro/AC | google/kickstart/2020/Round A/1/main.cpp | #include <iostream>
#include <queue>
using namespace std;
// Allocation (5pts, 7pts)
void solve(int case_num) {
int N, B, t;
scanf("%d%d", &N, &B);
priority_queue<int> q;
for (int i = 0; i < N; ++i) {
scanf("%d", &t);
q.push(t);
B -= t;
if (B < 0) {
B += q.top();
q.pop();
}
... | ALGO | 0.998967 | 4.410636 |
d0ecf944-52c7-400c-8587-4887bb5f7ce2 | LissajousX/STL_exercises | exercises/containers/associative/01_map_basics.cpp | /**
* 练习:map 基础操作
*
* 本练习帮助您熟悉 map 的基本操作,包括:
* - 创建和初始化
* - 插入和访问元素
* - 遍历方法
* - 查找和删除
*/
#include <iostream>
#include <map>
#include <string>
int main() {
std::cout << "===== map 基础操作练习 =====\n" << std::endl;
// 任务1: 创建和初始化 map
// ------------------------------
// 1.1 创建一个空的 map,键为字符串,值为整型
... | ALGO | 0.968689 | 5.943678 |
248a464d-4198-4513-9e01-66b083c8def7 | Karen1424/Homeworks | xndir16.cpp | //Գտնելեւ տպել զանգվածի տարրերի գումարի ու արտադրյալի
//միջին թվաբանականը։
#include <iostream>
int main () {
const int size = 5;
int arr[size] {1,2,3,4,5};
int sum = 0;
int mul = 1;
for(int i = 0; i < size;++i) {
sum += arr[i];
mul *= arr[i];
}
std::cout << (sum+mul)/2;
return 0;
} | ALGO | 0.998759 | 4.162296 |
b8cf0a41-bbcc-45f7-b280-a732d46906fd | ChopinF/CTF-Tool-hash-break-miniJohn-C | dictionary.cpp | //
// Created by lazar on 24.02.2024.
//
#include <iostream>
#include <vector>
#include <thread>
#include "include/include_hashes.h"
/*
* How to run:
* g++ -pthread -o dict dictionary.cpp
* ./dictionary <hash_to_find>
* You don't have to specify the hash name , the program will find it for you
*
* Example:
* .... | TOOL | 0.975077 | 5.672658 |
427347b9-c420-46b4-b748-1affa5d4a533 | VANDAL/SynchroTrace-gem5 | src/systemc/tests/systemc/datatypes/fx/shift/operator_shift_right.cpp | /*****************************************************************************
operator_shift_right.cpp --
Original Author: Martin Janssen, Synopsys, Inc., 2002-02-15
*****************************************************************************/
/***************************************************************... | ALGO | 0.891951 | 3.479373 |
7bca9e16-3429-450f-971e-9bf4b4a4f2c7 | ibsson/Program | BKJN/구현/20250208_bkjn_2573(빙산).cpp | #include <iostream>
#include <queue>
#include <string.h>
using namespace std;
#define MAX 301
int N, M, year;
int earth[MAX][MAX];
bool visited[MAX][MAX];
int dr[4] = { -1, 0, 1, 0 };
int dc[4] = { 0, -1, 0, 1 };
void bfs(int r, int c) {
queue <pair<int, int>> q;
q.push({ r, c });
visited[r][c] = true;
while (!... | ALGO | 0.999983 | 3.986634 |
08aaf0d2-a2b2-4de0-b50c-1507294c0ebb | nxp-mcuxpresso/mcux-sdk-examples | evkmimxrt1170/eiq_examples/mpp_static_image_nanodet_view_tflm/models/nanodet_m_320_quant_int8/nanodet_m_output_postproc.cpp | /*
* The function that processes the tensor output of model Nanodet-M
*/
#include <stdio.h>
#include <math.h>
#include "../utils.h"
#include "nanodet_m_output_postproc.h"
#include "../get_top_n.h"
#include "fsl_debug_console.h"
extern "C" {
#include "mpp_api.h"
}
#define DETECTION_TRESHOLD 30
#define NUM_RESULTS... | ALGO | 0.988596 | 5.445048 |
9df064ee-6e88-4e39-b085-83d8afe5e924 | yhtang/MESO | src/compute_temp_region.cpp | #include "mpi.h"
#include "string.h"
#include "compute_temp_region.h"
#include "atom.h"
#include "update.h"
#include "force.h"
#include "modify.h"
#include "domain.h"
#include "region.h"
#include "memory.h"
#include "error.h"
using namespace LAMMPS_NS;
/* --------------------------------------------------------------... | TOOL | 0.951111 | 6.641883 |
ab6d2491-f225-4ed8-b9dd-ba4ff84fd1c3 | TheTrustyPwo/CP | ACMICPC/28313.cpp | #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int32_t main() {
ios::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
int n; cin >> n;
int a[n]; for (int i = 0; i < n; i++) cin >> a[i];
int ans[n + 1]; fill(ans, ans + n + 1, 1e9);
for (int i = 0; i < n; i++) {
int l = i, r = i, cur ... | ALGO | 0.99983 | 3.931652 |
b18f2125-e772-48ce-ae9a-a1c90c6277dd | raincross7/code-similarity | codes/train_code/problem354/problem354_89.cpp | #include <bits/stdc++.h>
using namespace std;
int main() {
int64_t R,G,B,N;
cin>>R>>G>>B>>N;
int64_t K=0;
for(int r=0;r*R<=N;r++){
for(int g=0;g*G<=N-r*R;g++){
if(N-r*R-g*G==0){
K++;
}
else{
if((N-r*R-g*G)%B==0){
K++;
}
}
}
}
cout<<K<<end... | ALGO | 0.999688 | 3.769035 |
ddc98374-d7e1-46a4-9c8a-096bd7abc2ac | Tanev-N/WhilOne-Hero | src/game.cpp | #include "../include/game.h"
int Game::Make_Step()
{
int step, cord;
cord = 0;
step = rand() % 2;
if (step == 0)
{
cord += 1;
}
else
{
cord -= 1;
}
return (cord);
}
int Game::Check_Plus(int x1, int y1, int x2, int y2)
{
return (( ( abs(x1 - x2) == 1) && (y1 == y2 )) || ((abs(y1 - y2) == 1 ... | ALGO | 0.959053 | 3.145986 |
64734824-01c4-47ed-8eda-62e60370546d | Shresth-kaushik/dataStructure_And_Algorithm | DP/fibbonacci.cpp | #include<iostream>
#include<vector>
/*
Explanation about the question :
step 1 . Form the dp array/ vector initalize with (-1) ==> we can store the values of the prevoius results .
step 2 . before returning the result store it in the dp;
step 3 . condition check before the recurssive function call => dp[]!=-1 --> r... | ALGO | 0.999985 | 5.88486 |
9514552e-64ea-41f8-aa98-71b7a674fa69 | niello/deusexmachina | DEM/Low/src/Util/MD5.cpp | #include "MD5.h"
#include <System/System.h>
#include <stdio.h>
static unsigned char PADDING[64] =
{
0x80, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
};
#define S11 7
... | ALGO | 0.904934 | 5.69682 |
eeea7a29-03c5-47d3-8722-d7a79b949e5a | jyc/gecko | js/src/vm/BigIntType.cpp | /*
* Portions of this code taken from WebKit, whose copyright is as follows:
*
* Copyright (C) 2017 Caio Lima <<EMAIL>>
* Copyright (C) 2017-2018 Apple Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the followin... | ALGO | 0.917084 | 7.852127 |
d1a3b062-1e88-4b76-8593-d33b963c1a60 | Beng-Cccat/LeetCode_solution | 206.反转链表.cpp | /*
* @lc app=leetcode.cn id=206 lang=cpp
*
* [206] 反转链表
*/
// @lc code=start
/**
* 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) : ... | ALGO | 0.99909 | 6.066428 |
eadb099b-fe35-4057-8078-7dbcad4eb537 | dkarnikis/lua_sgx | Enclave/dh/tweetnacl.cpp | #include "tweetnacl.h"
#define FOR(i,n) for (i = 0;i < n;++i)
#define sv static void
typedef unsigned char u8;
typedef unsigned long u32;
typedef unsigned long long u64;
typedef long long i64;
typedef i64 gf[16];
extern void randombytes(unsigned char *,unsigned char);
static const u8
_0[16] = {0},
_9[32] = {9};
st... | ALGO | 0.995832 | 4.992816 |
508bf076-598b-4c4f-86c3-53b179ccaa86 | VinayakJamadar/DSA | Stack/Lect 5 NSR or Nearest Smaller to right or Next Smaller Element/Method_1_Brute_Force_Approach.cpp | // Problem: NSR or Nearest Smaller to right or Next Smallest Element
// Method 1: Brute Force (i.e using 2 Nested 'for' loop) Approach
// Time Complexity: O(n^2)
// Reason: Using 2 Nested 'for' loop.
// Space Complexity: O(1)
// Reason: Not using any Data Structure
#include<bits/stdc++.h>
using namespace std;
int ... | ALGO | 0.999994 | 5.562953 |
8c00f7fb-92e1-4e81-9e3e-3cf5c0c77eb9 | TypiDoyun/nbo-2023 | codeup/3215.cpp | #include <iostream>
#include <algorithm>
#include <queue>
#include <vector>
using namespace std;
const int INF = 0x3f3f3f3f;
vector<int> dijkstra(int start, int V, vector<vector<pair<int, int>>> ways) {
vector<int> dist(V, INF);
priority_queue<pair<int, int>> openedQueue;
dist[start] = 0;
opened... | ALGO | 0.999828 | 3.998464 |
e7dfe274-8bec-4046-a7da-437f38893ba8 | Yugtgupta/DAA | Algo codes/kruskal.cpp | #include<bits/stdc++.h>
using namespace std;
//finds the ultimate parent of a given vertex
int findUPar(int node,vector<int> &parent){ //important to pass parent by reference
if(parent[node] == node){
return node;
}
return parent[node] = findUPar(parent[node],parent); //path compression is happeni... | ALGO | 0.999984 | 4.932935 |
44fe7341-c7d0-4b01-8dad-532282f3cb60 | behitek/acm-epu | SPOJ/cpp/spoj-ptit/BCBEADS.cpp | #include <algorithm>
#include <cassert>
#include <cstdio>
#include <cstring>
#include <iostream>
#include <map>
#include <set>
#include <stack>
#include <sstream>
#include <string>
#include <vector>
int a[101];
int main() {
//freopen("input.txt", "r", stdin);
//freopen("output.txt", "w", stdout);
//std::ios::... | ALGO | 0.99983 | 3.682406 |
19834600-a19c-41d4-8ad8-64a99878d01c | AKarunakaran/CodeForces | CGR8/D.cpp | #include <bits/stdc++.h>
using namespace std;
// #define int long long
#define DEBUG(x) cout << '>' << #x << ':' << x << endl;
#define REP(i,n) for(int i=0;i<(n);++i)
#define FOR(i,a,b) for(int i=(a);i<=(b);++i)
#define FORD(i,a,b) for(int i=(a);i>=(b);--i)
inline bool EQ(double a, double b) { return fabs(a-b) < 1e-9; ... | ALGO | 0.999938 | 3.826165 |
4bcfc5f7-542d-4c42-b3d8-607386b9103e | mliang810/csci103_liangmic | Labs/Lab3-Algs&ControlStruc/tri.cpp | #include <iostream>
#include <cmath>
using namespace std;
int main() {
int theta;
double i, j, rad;
//variables as doubles here, will be redefined lower as int so can make the triangle
cout << "Please input an angle between 15˚ and 75˚" << endl;
cin >> theta;
rad = theta * M_PI/180;
fo... | ALGO | 0.997152 | 3.401825 |
25bffe86-ebf6-42b9-8718-e3bc2109fe4d | samoutlier/my-codes-cpp | 03 STL/09_Set.cpp | // It stores only unique element if we give 5 same input
// it will store only one time only
// it gives sorted order when we fetch them
#include <iostream>
#include<set>
using namespace std;
int main()
{
set <int> s;
s.insert(25);
s.insert(25);
s.insert(25);
s.insert(15);
s.insert(15);
... | ALGO | 0.983997 | 4.155514 |
a36d09da-6770-499e-b728-11877815603b | BGMer7/LeetCode | 122. Best Time to Buy and Sell Stock II/buyAndSellStocks.cpp | #include <vector>
#include <iostream>
using namespace std;
class StockCommonSolution
{
public:
int maxProfit(vector<int> &prices)
{
int buy = INT_MIN;
int sell = 0;
for (int p : prices)
{
buy = max(buy, sell-p); // (没有买,在今天的价格买了股票)
sell = max(sell... | ALGO | 0.99939 | 5.567057 |
ef2e10b2-945c-409d-a530-a2a5564cb41a | Sartech-B/Competitive-Programming | Hacker Rank/p55.cpp | #include <bits/stdc++.h>
using namespace std;
typedef long int ll;
vector<ll> *a;
int main()
{
int n, q;
ll ans = 0;
cin>>n>>q;
a = new vector<ll>[n];
while(q--)
{
ll x, y;
int t;
cin>>t>>x>>y;
if(t==1) a[(x^ans)%n].push_back(y);
else
{
ans = a[(x^ans)%n][(y%(a[(x^ans)%n].size()))];
cout<<an... | ALGO | 0.999953 | 4.131511 |
53a4b37e-ad99-41d4-8611-661466cc6c08 | AyushGupta11442/competative_coading | codeforces/900/Twins.cpp | // https://codeforces.com/problemset/problem/160/A
#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
int main() {
int n;
cin >> n;
int sum = 0;
vector<int> vec(n);
for (int i = 0; i < n; i++)
{
cin >> vec[i];
sum += vec[i];
}
sort(vec.begin(), vec.end());
int sumofm = 0;
i... | ALGO | 0.9996 | 4.522895 |
4b0ed787-dd8c-4ff5-81ab-77fa3b6ee278 | zeutyz/Targetsistemas | ex1.cpp | #include <iostream>
using namespace std;
int main()
{
int indice = 13;
int soma = 0;
int k = 0;
while (k < indice)
{
cout << k << "\n\n";
k = k + 1;
soma = soma + k;
cout << "soma = " << soma << "\n";
}
cout << soma;
return 0;
} | ALGO | 0.996351 | 3.670172 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.