uuid string | repo_name string | relative_path string | content string | category string | algo_rel_score float64 | quality_score float64 |
|---|---|---|---|---|---|---|
07dfad02-4cdd-473e-b299-8b70f12704e7 | alexandraback/datacollection | solutions_1674486_1/C++/mhozza/a.cpp | #include <iostream>
#include <cstdlib>
#include <cstdio>
#include <cstring>
#include <string>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <vector>
#include <cmath>
#include <list>
#include <sstream>
#include <algorithm>
using namespace std;
typedef pair<int,int> PII;
typedef long long LL;
... | ALGO | 0.999862 | 3.914137 |
2de85088-5930-4d11-bd07-9f6d7d32a594 | skylord18/lc-sols | Number of Subsets-Memoized.cpp | #include<bits/stdc++.h>
using namespace std;
int f(int idx, int sum, vector<int>&num, vector<vector<int>>&dp) {
if (sum == 0)return 1;
if (idx == 0)return (num[0] == sum);
if (dp[idx][sum] != -1)return dp[idx][sum];
int nonpick = f(idx - 1, sum, num, dp);
int pick = 0;
if (num[idx] <= sum)pick = f(idx - 1, sum - ... | ALGO | 0.999956 | 5.257587 |
45d2b93f-18a5-471a-8372-18553f77abc7 | ixray-team/ixray-1.6-stcop | src/xrGame/DynamicHeightMap.cpp | // DynamicHeightMap.cpp: implementation of the CDynamicHeightMap class.
//
//////////////////////////////////////////////////////////////////////
#include "StdAfx.h"
#include "DynamicHeightMap.h"
#include "../xrEngine/cl_intersect.h"
const int tasksPerFrame = 1;
const float limit_up = 100.f;
const float limit_down ... | ALGO | 0.923494 | 6.08105 |
d2997689-233e-45b6-84fd-2e69ca95235f | oxygen-hunter/Flashboom | data/big-vul-100/add_attention_code/Mixtral/top0-100/find-nearest-right-node-in-binary-tree-Solution.findNeartestRightNode/177783_DoS_Exec_Code_Overflow.cpp | void GfxImageColorMap::getRGBLine(Guchar *in, unsigned int *out, int length) {
int i, j;
Guchar *inp, *tmp_line;
switch (colorSpace->getMode()) {
case csIndexed:
case csSeparation:
tmp_line = (Guchar *) gmalloc (length * nComps2);
for (i = 0; i < length; i++) {
for (j = 0; j < nComps2; j++... | ALGO | 0.918884 | 4.468552 |
cdca23c4-9eb8-498a-bc90-7e388cbfc76a | hakomori64/atcoder | abc/002b.cpp | #include <iostream>
#include <algorithm>
using namespace std;
int main() {
string s;
cin >> s;
s.erase(remove(s.begin(), s.end(), 'a'), s.end());
s.erase(remove(s.begin(), s.end(), 'i'), s.end());
s.erase(remove(s.begin(), s.end(), 'u'), s.end());
s.erase(remove(s.begin(), s.end(), 'e'), s.end(... | ALGO | 0.993397 | 4.868461 |
6b6661a9-a585-48a8-92ab-53e1c3c04f45 | king-yyf/cpcode | leetcode/lc423/c.cpp | #ifdef sigma-yyf
#include "/Users/yangyf/Desktop/cpcode/leetcode/lc_help.hpp"
#endif
using namespace std;
using ll = long long;
#define ar(x) array<int,x>
#define all(c) (c).begin(), (c).end()
#define rall(x) (x).rbegin(), (x).rend()
#define sz(x) (int)(x).size()
#define f0(e) for(int i = 0; i < (e); ++i)
#define f1... | ALGO | 0.999978 | 4.544634 |
0f99384f-eeee-4633-9a8f-bf86aa901401 | Cattmonkey/openWork | webWork_backup/book/templates/examples/xspear.cpp | #include <string>
#include <fstream>
#include <iostream>
#include <iomanip>
#include "nr.h"
using namespace std;
// Driver for routine spear
int main(void)
{
const int NDAT=20,NMON=12;
int i,j;
char temp[17];
string txt,txt2,city[NDAT],mon[NMON];
DP d,probd,probrs,rs,zd;
... | ALGO | 0.996114 | 3.581892 |
0f58cecd-e35c-4af3-81fb-0533e32b24b6 | rishabh-pandey-393/algoo | rotate-string/rotate-string.cpp | class Solution {
public:
bool rotateString(string s, string goal) {
if(s.size()!=goal.size()) return false;
for(int i=0;i<s.size();i++){
string ss=s.substr(1,s.size()-1)+s[0];
if(ss==goal) return true;
s=ss;
}
return false;
}
}; | ALGO | 0.999974 | 5.617839 |
1ce93ddc-94b9-4b64-b0ae-83fb278ade02 | magiczhon/MADE_algo_course | hw2/grisha_after_disco.cpp | #include <iostream>
#include <vector>
std::vector<int> get_cnt(std::string str) {
std::vector<int> cnt(26);
for (int i = 0; i < str.size(); i++) {
cnt[str[i] - 'a']++;
}
return cnt;
}
bool le_cnt(std::vector<int> cnt1, std::vector<int> cnt2) {
for (int i = 0; i < cnt1.size(); i++) {
... | ALGO | 0.999847 | 4.859358 |
18f02f38-13f5-4303-bcf5-60606162b5c6 | asu-crypto/mpsica | thirdparty/linux/boost/libs/geometry/doc/src/examples/algorithms/area_with_strategy.cpp | // Boost.Geometry (aka GGL, Generic Geometry Library)
// QuickBook Example
//[area_with_strategy
//` Calculate the area of a polygon
#include <iostream>
#include <boost/geometry.hpp>
#include <boost/geometry/geometries/point_xy.hpp>
#include <boost/geometry/geometries/polygon.hpp>
namespace bg = boost::geometry; /*... | TOOL | 0.957279 | 7.6111 |
158b023e-08b6-4445-b183-e3c9c2ed0be3 | TicVic-don/Endsem | Module1/selection_sort.cpp | #include <iostream>
#include <vector>
using namespace std;
int main() {
vector<int> arr = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10};
for (int i = 0; i < arr.size(); i++) {
int min = i;
for (int j = i + 1; j < arr.size(); j++) {
if (arr[j] < arr[min]) {
min = j;
}... | ALGO | 0.999933 | 4.884228 |
340de4f7-dbed-42ea-82f3-81d65fbc2858 | Tmyiri/QS-Net | cpp/CSextet.cpp | #include <algorithm>
#include "CSextet.h"
#include "auxilary.h"
using namespace std;
// Constructor with parameters: m_gLblk = gLb; m_gRblk = gRb; m_dWeight= dWei
CSextet::CSextet(unsigned int gLb[3], unsigned int gRb[3], double dWei){
m_gLblk[0] = gLb[0];
m_gLblk[1] = gLb[1];
m_gLblk[2] = gLb[2];
m_gRblk[0... | ALGO | 0.995861 | 4.857234 |
fff823d8-75c4-4ae9-ac3c-735bab61bbdb | bhavyawig/Competitive-Programming | Modular Exponentiation codeforces.cpp | #include<bits/stdc++.h>
using namespace std;
typedef long long int lli;
int main()
{
lli n,m;
cin>>n;
cin>>m;
lli l=pow(2,n);
cout<<m%l<<endl;
return 0;
}
| ALGO | 0.999951 | 3.382696 |
ad41cb38-cc4c-44ea-ae0a-741c0b0ce9d0 | raincross7/code-similarity | codes/train_code/problem116/problem116_391.cpp | #include<bits/stdc++.h>
using namespace std;
typedef long long ll;
using P = pair<int,int>;
/* ちゃんと考えてわかって実装 */
int main(void){
int n, m;
cin >> n >> m;
vector< vector<P> > city(n+1);
for(int i=1; i<=m; i++){
int p, y;
cin >> p >> y;
city[p].push_back(make_pair(y, i));
}
... | ALGO | 0.999907 | 3.492246 |
667306e4-97ab-4938-934a-6ed04c461721 | sadwika6/leetcode_gfg_solved | 0547-number-of-provinces/0547-number-of-provinces.cpp | class Solution {
public:
void dfs(int i,vector<int>adj[],vector<int>&vis)
{
vis[i]=1;
for(auto it:adj[i])
{
if(!vis[it])
{
dfs(it,adj,vis);
}
}
}
int findCircleNum(vector<vector<int>>& ic) {
int n=ic.size();
... | ALGO | 0.999993 | 5.896189 |
40199b71-bff9-46c1-9d00-6c8c26d043bb | zhh2005757/slambook2_in_Docker | slambook2/3rdparty/opencv-3.3.0/3rdparty/openexr/IlmImf/ImfEnvmap.cpp | //-----------------------------------------------------------------------------
//
// Environment maps
//
//-----------------------------------------------------------------------------
#include <ImfEnvmap.h>
#include "ImathFun.h"
#include <algorithm>
#include <math.h>
using namespace std;
using namespace Imath;
nam... | ALGO | 0.927668 | 6.965724 |
f3feb5ea-7d6a-48e5-bb37-b763879c39cb | Jafrin-khan/Practice | 1283-find-the-smallest-divisor-given-a-threshold/1283-find-the-smallest-divisor-given-a-threshold.cpp | class Solution {
public:
int isValid(int divisor , int threshold , vector<int>& nums){
int div = 0;
for(int i = 0 ; i < nums.size() ; i++){
if(nums[i]%divisor != 0) div += nums[i]/divisor + 1;
else div += nums[i]/divisor;
}
return div <= threshol... | ALGO | 0.999989 | 6.388575 |
b9572808-4563-471c-a513-f643abfc7a43 | dahrs/OSTI | resources/faiss/demos/demo_imi_flat.cpp | #include <cmath>
#include <cstdio>
#include <cstdlib>
#include <sys/time.h>
#include <faiss/IndexPQ.h>
#include <faiss/IndexIVFFlat.h>
#include <faiss/IndexFlat.h>
#include <faiss/index_io.h>
double elapsed ()
{
struct timeval tv;
gettimeofday (&tv, nullptr);
return tv.tv_sec + tv.tv_usec * 1e-6;
}
int... | ALGO | 0.998013 | 5.891539 |
4c38344b-3710-4acf-a0ae-6fd1ce69334d | splashkit/splashkit-core | coresdk/src/coresdk/triangle_geometry.cpp | #include "geometry.h"
#include <cmath>
#include <vector>
using std::vector;
namespace splashkit_lib
{
triangle triangle_from(double x1, double y1, double x2, double y2, double x3, double y3)
{
triangle result;
result.points[0] = point_at(x1, y1);
result.points[1] = point_at(x2, y2);
... | ALGO | 0.994525 | 7.657004 |
a32f7517-35e9-4c22-bd5c-ff5e4ff31105 | robertcrockett/graphviz_11_0 | lib/mingle/nearest_neighbor_graph.cpp | #include "config.h"
#include <sparse/general.h>
#include <sparse/SparseMatrix.h>
#include <mingle/nearest_neighbor_graph_ann.h>
#include <mingle/nearest_neighbor_graph.h>
#include <vector>
SparseMatrix nearest_neighbor_graph(int nPts, int num_neighbors,
const std::vector<double> &x... | ALGO | 0.993955 | 5.90446 |
026abaa8-5e04-4f20-941c-64d3a86cba39 | penn-graphics-research/ziran2019 | Lib/Ziran/Math/Geometry/Segment.cpp | #include "Segment.h"
namespace ZIRAN {
template <class T, int dim>
void barycentricWeights(
const Vector<T, dim>& p,
const Vector<T, dim>& a,
const Vector<T, dim>& b,
Vector<T, 2>& weights)
{
Vector<T, dim> v0, v1;
v0 = b - a;
v1 = p - a;
T d00 = v0.dot(v0);
T d01 = v0.dot(v1);
... | ALGO | 0.999399 | 6.606093 |
7dde8657-5c47-4aa2-9aac-b02825f25862 | pei0948/dataStructure | leetcode/kthSmallest/kthSmallestBST.cpp | /**
* Definition for a binary tree node.
* struct TreeNode {
* int val;
* TreeNode *left;
* TreeNode *right;
* TreeNode(int x) : val(x), left(NULL), right(NULL) {}
* };
*/
class Solution {
public:
int nth=0, res;
int kthSmallest(TreeNode* root, int k) {
medTrav(root, k);
... | ALGO | 0.999999 | 6.13622 |
8f3e6628-de57-49c7-933a-14169d0c0026 | hemanth1121/practice_cpp | linked_list.cpp | #include <iostream>
#include <thread>
#include <mutex>
#include <chrono>
using namespace std;
class Node
{
public:
Node(int val): data(val)
{
}
int data;
Node *next{nullptr};
};
class CLinkedList
{
public:
void insertAtEnd(int val)
{
//cout << __func__ << endl;
... | ALGO | 0.998612 | 4.856526 |
c40a6d0d-cc6c-47c2-b154-fb1d9387236e | amrmhassan/meeting-organizer | windows/runner/utils.cpp | #include "utils.h"
#include <flutter_windows.h>
#include <io.h>
#include <stdio.h>
#include <windows.h>
#include <iostream>
void CreateAndAttachConsole() {
if (::AllocConsole()) {
FILE *unused;
if (freopen_s(&unused, "CONOUT$", "w", stdout)) {
_dup2(_fileno(stdout), 1);
}
if (freopen_s(&unuse... | TOOL | 0.998859 | 6.785645 |
ad26fa1d-98f8-45e6-8c25-c5bc0b75916a | anwholesquare/cp-repo | codeforces/A_Mike_and_palindrome.cpp | #pragma GCC optimize("Ofast,unroll-loops")
#pragma GCC target("avx,avx2,fma")
#include<bits/stdc++.h>
using namespace std;
const double PI=acos(-1);
void solve() {
string s;
cin >> s;
int cnt = 0;
int len = s.size();
for ( int i = 0; i < len/2; i++) {
//cout << s[i] << "\t" << s[len-1-i... | ALGO | 0.999983 | 4.136175 |
c5f51e1a-f423-4466-aee4-800f598713db | shibeeeii/Competitive-Programming | UVA Online Judge/12700 - Banglawash.cpp | #include<iostream>
#include<string.h>
using namespace std;
int main()
{
string str;
int n,i,j,k,p,q,r=1;
cin>>n;
while(n--){
cin>>k;
for(i=0;i<k;i++){
cin>>str[i];
}
int b=0,w=0,d=0,a=0,t=0;
for(i=0;i<k;i++){
if(str[i]=='B'){
... | ALGO | 0.999405 | 3.792581 |
7180bf2f-5387-4e45-9b97-56bcb242927d | mllite/ml2cpp | bench/ml2cpp-demo/Ridge/freidman3/ml2cpp-demo_Ridge_freidman3.cpp | // ********************************************************
// https://github.com/antoinecarme/ml2cpp
// Model : Ridge
// Dataset : freidman3
// This CPP code can be compiled using any C++-17 compiler.
// g++ -Wall -Wno-unused-function -std=c++17 -g -o ml2cpp-demo_Ridge_freidman3.exe ml2cpp-demo_Ridge_freidman3.cpp
... | DATA | 0.967776 | 5.770544 |
33633d14-806e-4330-9509-9dbda418fbad | swyoo1121/C-CPP | baekjoon/9659.cpp | #include <iostream>
using namespace std;
int main() {
long long int N;
cin >> N;
if (N % 2) cout << "SK" << endl;
else cout << "CY" << endl;
return 0;
} | ALGO | 0.999549 | 3.079789 |
820723fc-d62c-46e2-8497-798a340f77a5 | sottosanti/Programming | C++/Dijkstra/dijkstra.cpp | #include <iostream> // cin and cout
#include <fstream> // ifstream, ofstream
#include <string> // string class
#include <iomanip> // setfill(), setw(), etc
#include <sstream> //istringstream, ostringstream
#include <vector>
#include <cctype> //isalpha islower
#include <cmath> // for infinity
#include <limits>
using na... | ALGO | 0.96996 | 3.155259 |
d58f2f2b-edb7-404d-8663-893ea39d527b | agul/contest-tasks | caide_archive/2016-02-20/bapc2013/bapc2013.cpp | #include "Head.h"
#include "IO/IO.h"
#include "DSU.h"
#include "Maths.h"
using namespace std;
int __;
IO io;
const int MOD = 1000000007;
const int MAXN = 1111;
double x[MAXN], y[MAXN];
DSU dsu(MAXN);
void solve(istream& ins, ostream& out) {
ins >> __;
for (int _ = 0; _ < __; ++_) {
int n;
ins >> n;
for (int... | ALGO | 0.998765 | 4.178692 |
e4dbd9fb-2fc6-4779-b992-733297fdbb85 | theflutter/gh_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.9988 | 6.76073 |
adb095b5-53d1-4a96-9993-241d40c69936 | surjendu104/Leetcode-Solutions | 0101. Symmetric Tree/ans.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), left(left), right(ri... | ALGO | 0.999839 | 6.553684 |
7979df07-c816-4903-9b1e-1b9990f18576 | TeoGrajqevci/RayMarching_tool | src/Utilities.cpp | #include "Utilities.h"
#include <cmath>
void sphericalToCartesian(float distance, float theta, float phi, const float target[3], float outPos[3])
{
outPos[0] = target[0] + distance * cosf(phi) * sinf(theta);
outPos[1] = target[1] + distance * sinf(phi);
outPos[2] = target[2] + distance * cosf(phi) * cosf(t... | TOOL | 0.957914 | 4.384994 |
ef4786d8-11e4-48c7-b6ea-5b0e555115ee | erayzesen/QuarkPhysics | QuarkPhysics/qsoftbody.cpp | #include "qsoftbody.h"
#include "qparticle.h"
#include "qvector.h"
#include "qworld.h"
#include "qmesh.h"
#include "cmath"
#include <utility>
bool QSoftBody::IsPolygonCW(vector<QParticle *> polygon)
{
int n = polygon.size();
if (n < 3) return false; // Poligon geçerli değil
// Geometrik merkez (ortalama p... | TOOL | 0.894369 | 6.087789 |
27242e80-74f8-4df9-a2ec-4bf53b10a526 | zebra-uestc/GEM5 | src/systemc/tests/systemc/misc/sim/prime_do_while/prime_numgen.cpp | /*****************************************************************************
prime_numgen.cpp --
Original Author: Martin Janssen, Synopsys, Inc., 2002-02-15
*****************************************************************************/
/***********************************************************************... | ALGO | 0.999727 | 5.094754 |
82e77e9c-1bc8-4019-a1aa-1c7faafc6d00 | waten1992/Cracking_The_Coding_Interview | L005_Add_Two_List_order.cpp | /*
描述:给定2个链表,反向储存整数,编写一个函数计算2个数相加之和;
例如:A: Head->3->2->1->NULL;
B: Head->2->9->9->NULL;
------------------------ +
C: Head->5->1->2->NULL
即是:123 + 992 = 1115
解法:
1- 先扫描一遍,若链表的个数不相同,短的链表则要用头插0填充;
2- 再扫描一遍,把A B 分别压入栈 ST1 ST2 中 ,
3- 依次按出栈的顺序相加,用头插法;
4- 若最高位有进位,即是carry==1,则新建一个节点储存;
*/
#... | ALGO | 0.999942 | 4.635556 |
4c532228-d5aa-485e-8a13-cbf253cc85f3 | ishandutta2007/codeforces | brovko/normal/449/B.cpp | #include <bits/stdc++.h>
#define int long long
#define ld long double
#define x first
#define y second
#define pb push_back
using namespace std;
int n, m, k, s[100005], y[100005], d[100005], U[300005], V[300005], W[300005], p[100005], siz[100005], used[100005];
vector <pair <int, int> > g[100005];
//int get(int x)
/... | ALGO | 0.999991 | 3.985418 |
a10cc7ed-c1b3-431a-aeb3-f8d916ad4190 | Ashantfet/Adsa_lab | selfprac/mtrixchain.cpp | #include <iostream>
#include <vector>
#include <climits>
using namespace std;
int matrixChainOrder(vector<int>& dimensions) {
int n = dimensions.size() - 1;
int M[n][n];
// Initialize the diagonal elements to 0
for (int i = 0; i < n; i++) {
M[i][i] = 0;
}
// Fill the table in a botto... | ALGO | 0.999899 | 4.439651 |
1022c66c-8121-42e9-83ec-e8059f790bd1 | myousuf65/cpp_webserver | dependencies/boost/libs/polygon/example/voronoi_visualizer.cpp | // Boost.Polygon library voronoi_visualizer.cpp file
// See http://www.boost.org for updates, documentation, and revision history.
#include <iostream>
#include <vector>
#include <QtOpenGL/QGLWidget>
#include <QtGui/QtGui>
#include <boost/polygon/polygon.hpp>
#include <boost/polygon/voronoi.hpp>
using namespace boos... | ALGO | 0.994443 | 5.431298 |
49b42ed1-e2c7-4503-9269-279fb7cba38b | hugary1995/weak_bc | eigen/unsupported/doc/examples/MatrixSinh.cpp | #include <unsupported/Eigen/MatrixFunctions>
#include <iostream>
using namespace Eigen;
int main()
{
MatrixXf A = MatrixXf::Random(3,3);
std::cout << "A = \n" << A << "\n\n";
MatrixXf sinhA = A.sinh();
std::cout << "sinh(A) = \n" << sinhA << "\n\n";
MatrixXf coshA = A.cosh();
std::cout << "cosh(A) = \n"... | ALGO | 0.992056 | 5.894121 |
36f796f7-fde8-4ef1-91b1-f0f12fae8bb1 | algo-idle/algo-study | seunghui/baekJoon/string/2675/2675/Repeat String.cpp | #include <iostream>
#include <string>
using namespace std;
int main(void) {
int t;
cin >> t;
while (t--) {
int num;
string s;
cin >> num;
getline(cin, s);
for (int i = 0; i < s.size(); i++) {
for (int j = 0; j < num; j++) {
if (s[i] != ' ') {
cout << s[i];
}
}
}
cout << "\n";
... | ALGO | 0.999188 | 3.580841 |
5447ea69-b48f-4237-a721-986a45b35c04 | ishandutta2007/codeforces | dmga44/normal/811/B.cpp | #include <bits/stdc++.h>
#define db(x) cout << x << '\n';
using namespace std;
#define MAXN 10005
int arr[MAXN];
int main()
{
ios_base::sync_with_stdio(0);
cout.tie(0);
cin.tie(0);
int n,m,l,r,x;
cin >> n >> m;
for(int i=0;i<n;i++)
cin >> arr[i];
for(int i=0;i<m;i++)
{
... | ALGO | 0.999995 | 3.680411 |
f6246444-9c46-45cd-b5a3-741453cef8e8 | om45672/DSA | DSA/pattern1.cpp/pattern16.cpp | #include<bits/stdc++.h>
using namespace std;
signed main(){
int n;
cin>>n;
for(int i=0;i<n;i++){
char ch = 'A' + i;
for(int j=0;j<=i;j++){
cout<<ch<<" ";
}
cout<<endl;
}
return 0;
} | ALGO | 0.999619 | 3.96234 |
f61256be-34bf-4090-a3f4-3796bc4cf9fd | younglululu/COCACOLA | Ncut_9/cimgnbmap.cpp | /*================================================================
* function [i,j] = cimgnbmap([nr,nc], nb_r, sample_rate)
* computes the neighbourhood index matrix of an image,
* with each neighbourhood sampled.
* Input:
* [nr,nc] = image size
* nb_r = neighbourhood radius, could be [r_i,r_j] for i,j
* samp... | ALGO | 0.999094 | 5.660899 |
bd4e33a4-9c8b-4db3-ba9f-a1742602f6b8 | actium/codeforces | 1200/00/1204b.cpp | #include <iostream>
void answer(unsigned x, unsigned y)
{
std::cout << x << ' ' << y << '\n';
}
void solve(size_t n, size_t l, size_t r)
{
const unsigned k1 = (1 << l) - 1;
const unsigned k2 = (1 << r) - 1;
const unsigned m = 1 << (r - 1);
answer(k1 + (n - l) * 1, k2 + (n - r) * m);
}
int main()... | ALGO | 0.984736 | 3.207856 |
2507f23a-0a81-4497-8c62-0d4aef385b67 | PixelStarExtended/frameworks_av | media/libeffects/lvm/lib/Eq/src/LVEQNB_Init.cpp | /****************************************************************************************/
/* */
/* Includes */
/* ... | TOOL | 0.867358 | 5.77684 |
6807c132-203b-4c11-9f24-da5957716916 | kevinpruvost/boost_openvdb | libs/geometry/doc/src/examples/algorithms/intersection_segment.cpp | // Boost.Geometry (aka GGL, Generic Geometry Library)
// QuickBook Example
//[intersection_segment
//` Calculate the intersection point (or points) of two segments
#include <iostream>
#include <boost/geometry.hpp>
#include <boost/geometry/geometries/point_xy.hpp>
int main()
{
using P = boost::geometry::model::d... | ALGO | 0.999697 | 4.7695 |
6ebaab28-92ad-4c1a-b99c-88923df4ae8a | Marawan-Mohamed/Problem-Solving-training | level-1/codeforces/phase-1-2/A_Trip_For_Meal.cpp | #include <bits/stdc++.h>
using namespace std;
#define ll long long
#define endl '\n'
#define frni(i, _n_) for(int i = 0, _n = _n_; i < _n; ++i)
#define SHORT_MAX ((short)0x7FFF)
#define SHORt_MIN ((short)0x8000)
#define USHORT_MAX ((unsigned short)0xFFFF)
#define LL_MAX ((long long)0x7FFFF... | ALGO | 0.999493 | 3.722022 |
98b7de2d-664f-4a86-acec-dd9b845a624e | AbrSergey/courseProgram | treenode.cpp | #include <iostream>
#include <assert.h>
#include "treenode.h"
#include "const.h"
void TreeNode::insert(unsigned int data, const bool status)
{
if (!status){
_left = new TreeNode(data);
_left->_parent = this;
if (_right != NULL) _left->_neighbor_right = _right;
}
else{
_righ... | ALGO | 0.959384 | 4.000591 |
d2a0640d-2400-4341-b0cb-45b05b9982bc | Strand2013/siguoya | AC_history/[剑指 Offer 42]连续子数组的最大和.cpp | //输入一个整型数组,数组中的一个或连续多个整数组成一个子数组。求所有子数组的和的最大值。
//
// 要求时间复杂度为O(n)。
//
//
//
// 示例1:
// 动态规划 自底向上 ans [-2, 1, 1, 4, 4, 5, 6, 6, 6 ]
// tmpSum [-2, 1,-2, 4, 3, 5, 6, 1, 5]
// 输入: nums =[-2, 1,-3, 4,-1, 2, 1,-5, 4]
//输出: 6
//解释: 连续子数组 [4,-1,2,1] 的和最大,为 6。
//
//
//
// 提示:
//
//
// 1 <= arr.leng... | ALGO | 0.999953 | 5.783823 |
7f717b07-f294-4c49-b033-9f1dd4823d06 | amitbansal13/Coding-Practice | InterviewBit/Trees/Sum Root to Leaf Numbers.cpp | /**
* Definition for binary tree
* struct TreeNode {
* int val;
* TreeNode *left;
* TreeNode *right;
* TreeNode(int x) : val(x), left(NULL), right(NULL) {}
* };
*/
int m = 1003;
int sum(TreeNode* A, int currSum) {
if(!A)return 0;
if(!A->left && !A->right) {
return ((currSum*10)... | ALGO | 0.999984 | 4.970388 |
08c718a1-d90d-45ac-9065-4e46eb1b4200 | zakirhussain/LeetCode | optimized_sort01.cpp | /******************************************************************************
Online C++ Compiler.
Code, Compile, Run and Debug C++ program online.
Write your code in this editor and press "Run" button to compile and execute it.
******************************************... | ALGO | 0.999975 | 4.694299 |
8b294687-0d4c-4050-9259-db38e38dd923 | Daniel-Barbera/Competitive-Programming | ACEPTA_EL_RETO/512_DONER_SOSPECHOSO.cpp | #include <bits/stdc++.h>
using namespace std;
int main() {
ios_base::sync_with_stdio(false);
cin.tie(nullptr);
int numCasos;
cin >> numCasos;
int a, b;
while (numCasos--) {
cin >> a >> b;
cout << floor(((double) a/(double) (a+b))*100) << '\n';
}
return 0;
} | ALGO | 0.999468 | 4.756844 |
22bf4863-812a-46f8-8315-3135a250abd0 | hjlee6824/Problem-Solving | Baekjoon/11000~11999/11057/11057.cpp | #include <bits/stdc++.h>
using namespace std;
int n;
int dp[1001][10];
int main() {
ios::sync_with_stdio(0);
cin.tie(0);
cin >> n;
for (int i = 0; i < 10; ++i) dp[1][i] = 1;
for (int i = 2; i <= n; ++i)
for (int j = 0; j < 10; ++j)
for (int k = j; k < 10; ++k)
... | ALGO | 0.999924 | 4.819762 |
b93fa710-08e3-4ecd-8640-22c961124b1a | miz884/logue-sdk-custom-modules | terrain_wave/logue_nts-1_terrain_wave/modfx/terrain_modfx.cpp | #include "usermodfx.h"
#include "../common/mt.h"
#include "../common/wavetables.h"
#ifndef k_samplerate
#define k_samplerate (48000)
#endif
#ifndef k_samplerate_recipf
#define k_samplerate_recipf (2.08333333333333e-005f)
#endif
typedef struct State {
float phase;
float param_time;
float param_depth;
... | TOOL | 0.956902 | 6.137103 |
81509833-54a8-4118-b34a-79b0748aec9c | AryamanAMD/testhipify-cli | src/samples/Samples/0_Introduction/fp16ScalarProduct/fp16ScalarProduct.cu.cpp | #include "hip/hip_runtime.h"
#include "hip/hip_fp16.h"
#include "helper_cuda.h"
#include <cstdio>
#include <cstdlib>
#include <ctime>
#include "HIPCHECK.h"
#define NUM_OF_BLOCKS 128
#define NUM_OF_THREADS 128
__forceinline__ __device__ void reduceInShared_intrinsics(half2 *const v) {
if (threadIdx.x < 64)
v[th... | ALGO | 0.981423 | 6.226239 |
e33d5102-27a0-4698-90d0-8c9808d4be47 | ChanchalSen09/DSA | 03Array/03_EasyArray/FIrst_Occurrence.cpp | // Question
// Given a sorted or unsorted array of integers and a target number,
// find the first occurrence (index) of the target number in the array.
// If the number is not present, return -1.
// Example 1
// Input: `arr = [1, 2, 2, 3, 4, 4, 4, 5]`, `target = 4`
// Output: `4`
// Example 2
// Input: ... | ALGO | 0.999892 | 5.895272 |
0eb18e60-425b-46a6-af0a-6c95ceddbc79 | tusikalanse/acm-icpc | cf/1172/a.cpp | #include <bits/stdc++.h>
using namespace std;
const int N = 200010;
int a[N], n, ans, flag;
int check() {
int p;
for(int i = n; i; --i) {
if(a[n] - a[i] != n - i)
return -1;
if(a[i] == 1) {
p = i;
break;
}
}
for(int i = 1; i <= n; ++i) {
if(a[i] == 0) continue;
if(a[i] == 1)
break;
if(a[i... | ALGO | 0.999893 | 3.52194 |
059b2b71-97da-4332-b59e-5f563b59136a | N1k1taMore/DSA_SE_SEM_4 | Dsal8.cpp | # include <iostream>
# include <climits>
using namespace std;
class node {
string data;
node *left;
node *right;
public:
node(){
left = right = NULL;
}
node(string data){
this->data = data;
left = right = NULL;
}
friend class obst;
};
class obst{
node *root;
public:
obst(){
root=... | ALGO | 0.999866 | 3.723021 |
15d27570-4826-4552-9fbe-ed9803b8b232 | adjardim/OpenMP_TM_TinySTM | cowichan/cowichan_tbb/invperc.cpp | /**
* \file cowichan_tbb/invperc.cpp
* \brief TBB (NOT parallel) invperc implementation.
*
* The same as CowichanSerial::invperc
*/
#include "cowichan_tbb.hpp"
#include <queue>
namespace cowichan_tbb
{
/**
* \brief Percolation point.
*
* These are put into a heap to extract the one with lowest value.
*/
cla... | ALGO | 0.999861 | 5.271208 |
c47f1a86-da34-45b3-b343-eb0ce38a3b63 | Ahmedkhalifa1999/CPU-Scheduler-Visualizer | CPU-Scheduler-Visualizer/altSJF.cpp | #include "altSJF.h"
#include <numeric> //for accumulate function
#include <limits.h>
GanntChart altSJF(const std::vector<process>& processes, bool preemptive) {
unsigned int processCount = processes.size();
unsigned int currentTime = 0; //holds current simulation time
std::vector<unsigned int> remainingTim... | ALGO | 0.999928 | 5.389479 |
a8379093-b2e4-4913-9d1e-4ed8003de63c | dudugi/NewForTortoise | QL/Common/cryptopp-CRYPTOPP_7_0_0/padlkrng.cpp | // via-rng.cpp - written and placed in public domain by Jeffrey Walton and Uri Blumenthal.
#include "pch.h"
#include "config.h"
#include "cryptlib.h"
#include "secblock.h"
#include "padlkrng.h"
#include "cpu.h"
// The Padlock Security Engine RNG has a few items to be aware of. You can
// find copies of the Programme... | ALGO | 0.888092 | 6.554937 |
96060020-6fd0-4940-9959-ac75b993f700 | jiguosong/coding_practice | interviewCode/src/matrix/surroundedregion/surroundedregion_test.cpp | /* googletest unit test for C++ */
#include "gtest/gtest.h"
#include <iostream>
// uncomment to disable assert()
// #define NDEBUG
#include <cassert>
#include <array>
#include <vector>
#include <forward_list>
#include <list>
#include <deque>
#include <set> // multiset is also defined here
#include <map> // mu... | TEST | 0.935755 | 5.597055 |
31c4bdf0-3025-49a6-9d24-a5d70a4f8764 | DestinaBektiS/Praktikum-Structure-Data-Assignment- | MODUL 3 - Sorting/Unguided-1.cpp | #include <stdio.h>
using namespace std;
void selection_sort(float arr[], int x) {
for (int y = 0; y < x-1; y++) {
int maxIndex = y;
for (int n = y+1; y < x; y++) {
if (arr[y] > arr[maxIndex]) {
maxIndex = y;
}
}
if (maxIndex != y) {
float temp = arr[y];
arr[y] = arr[ma... | ALGO | 0.999965 | 4.202822 |
dbc52dca-1449-4349-bab2-b3b33ad6caad | NavaJhoana/Segundo-Parcial | Multiplicacion en C++.cpp | #include <iostream>
int main (){
int num1,num2,mult;
std::cout <<"Ingrese el primer numero: ";
std::cin >> num1;
std::cout <<"Ingrese el segundo numero: ";
std::cin >> num2;
mult=num1*num2;
std::cout<<"La multipliacion es: " <<mult<<std::endl;
return 0;
}
| TOOL | 0.857128 | 3.086848 |
de88ced1-9f3f-41f6-8d2b-7ec2ebfe1d0f | ishandutta2007/codeforces | rfpermen/normal/1497/A.cpp | #include<bits/stdc++.h>
#pragma GCC optimize("O3")
#pragma GCC target("tune=native")
#pragma GCC optimize("unroll-loops")
using namespace std;
template<class A, class B>
ostream& operator<<(ostream& os, const pair<A, B> &p) {
os << '(' << p.first << ',' << p.second << ')';
return os;
}
template<class T>
ostream... | ALGO | 0.999323 | 3.699493 |
8b909652-4877-457b-977a-70e0797f20d7 | rhythm-28/Data-Structures-and-Algorithms | Data Structures/Binary Tree/3.1) Post order printing of a binary tree (recursive).cpp | // Post order printing of a binary tree
#include<iostream>
using namespace std;
class node
{
public:
int data;
node* left;
node* right;
node(int d)
{
data=d;
left=NULL;
right=NULL;
}
};
node* create_tree()
{
int d;
cin>>d;
if(d==-1)
return NULL;
... | ALGO | 0.999755 | 5.121609 |
2d378d6d-5f92-43be-81b5-a2f7a6597395 | Lyee-Git/Leetcode | 1011.在-d-天内送达包裹的能力.cpp | // @before-stub-for-debug-begin
// #include <vector>
// #include <string>
// #include "commoncppproblem1011.h"
using namespace std;
// @before-stub-for-debug-end
/*
* @lc app=leetcode.cn id=1011 lang=cpp
*
* [1011] 在 D 天内送达包裹的能力
*/
#include<vector>
#include<iostream>
#include<unordered_map>
#include<string>
using... | ALGO | 0.999985 | 5.68448 |
faf56ff9-3e41-459d-a65b-e19e09aeb0d0 | dengliangxing/usaco_code | 2.1/Ordered Fractions.cpp | /*
ID: 15256292
LANG: C++
TASK: frac1
*/
#include<iostream>
#include<fstream>
#include<algorithm>
using namespace std;
ifstream fin("frac1.in");
ofstream fout("frac1.out");
struct Fra
{
int a;
int b;
double num;
};
Fra num[100000];
int sum=0;
bool sign[161][161];
int check(int a,int b)
{
while(a!=0&&b!=0)
{
b=b... | ALGO | 0.999838 | 3.482697 |
c0725b99-a42b-48a0-a61c-2cd4428956ab | y0gesh02/LeetCode_Solution | 2500-delete-greatest-value-in-each-row/2500-delete-greatest-value-in-each-row.cpp | class Solution {
public:
int deleteGreatestValue(vector<vector<int>>& grid) {
int n=grid.size();
int m=grid[0].size();
for (int i = 0; i < n; i ++) {
sort(grid[i].begin(), grid[i].end());
}
int ans = 0;
for (int j = 0; j < m; j ++) {
int maxi=... | ALGO | 0.999977 | 5.552989 |
3043d6e0-44d9-4668-b605-feefb23a0fb6 | harambe-dev/harambecoin | src/sync.cpp | #include "sync.h"
#include "util.h"
#include <boost/foreach.hpp>
#ifdef DEBUG_LOCKCONTENTION
void PrintLockContention(const char* pszName, const char* pszFile, int nLine)
{
printf("LOCKCONTENTION: %s\n", pszName);
printf("Locker: %s:%d\n", pszFile, nLine);
}
#endif /* DEBUG_LOCKCONTENTION */
#ifdef DEBUG_LOC... | TOOL | 0.97413 | 5.7469 |
b54d7808-a75d-4fad-89f9-07ab885cfba5 | champmaniac/LeetCode | Binary Tree to DLL - GFG/binary-tree-to-dll.cpp | // { Driver Code Starts
#include <bits/stdc++.h>
using namespace std;
// Tree Node
struct Node
{
int data;
Node* left;
Node* right;
};
// Utility function to create a new Tree Node
Node* newNode(int val)
{
Node* temp = new Node;
temp->data = val;
temp->left = NULL;
temp->right = NULL;
... | ALGO | 0.999819 | 7.138664 |
33d1a43a-da81-40c9-91da-9c85de3f4ad8 | YazanIST/CP | Notebooks/divideAndKrunkerNotebook/3-Dynamic-Programming/Convex-Hull-Optimizations.cpp | /*
Convex Hull OPT
You are given n rectangles with vertexes in (0,0), (xi,0), (xi,yi), (0,yi). For each rectangle, you are also given a number ai. Choose some of them that the area of union minus sum of ai of the chosen ones is maximum.
It is guaranteed that there are no nested rectangles.
Nut has no idea how to find t... | ALGO | 0.99761 | 4.569527 |
24399ce2-ad19-4e96-9ea4-377e08da4387 | Kamrul785/XPSC- | Week 9/Day 2/B_GCD_Partition.cpp | #include <bits/stdc++.h>
#define endl '\n'
#define ll long long
#define fl float
using namespace std;
int main()
{
ios::sync_with_stdio(false);
cin.tie(NULL);
ll t;
cin >> t;
while (t--)
{
ll n;
cin >> n;
vector<ll> a(n), pre(n);
for (ll i = 0; i < n; i++)
... | ALGO | 0.999839 | 3.447055 |
72849bdf-88f4-47dd-8f1f-733cf77ccb39 | yoloeww/Basic-Code-Library | 2021.3.18.完数.cpp | # include<stdio.h>
int main(void)
{
int i,k=0;
int n;
for(n=2;n<1000;n++)
{
for(i=1;i<n;i++)
{
if(n%i==0)
k+=i;
}
if(k==n)
printf("%d",n);
}
return 0;
} | ALGO | 0.999407 | 3.194661 |
5a8e736e-e395-4d8c-aa73-888361ee86e3 | MostafaMohamed2001/C-Data-Structure | .history/hello_20240701131055.cpp | #include <iostream>
#include <string>
using namespace std;
int main() {
int n;
cin >> n;
string s[n];
bool FeqL = false;
for (int i = 0; i < n; i++)
{
cin >> s[i];
}
// // to check if the word repeated in the arr
// for (int i = 0; i < n; ++i){
// for (int j = i+1; j... | ALGO | 0.999808 | 4.311157 |
662c568e-809c-4775-b32b-ee96da326a8d | yaserhamidy/chat_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.9988 | 6.76073 |
0f387f0e-b8a5-44ba-bdab-44b470dad9c5 | bienvenuelisis/learn_mvvm_as_a_beginner | 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.998799 | 6.776823 |
b218cc22-0133-4289-82d6-ec9fcc68b601 | ishandutta2007/codeforces | grt_2018/normal/1262/D2.cpp | #include <bits/stdc++.h>
#define PB push_back
#define ST first
#define ND second
#define _ ios_base::sync_with_stdio(0); cin.tie(0);
//mt19937 rng(chrono::high_resolution_clock::now().time_since_epoch().count());
using namespace std;
using ll = long long;
using pi = pair<int,int>;
using vi = vector<int>;
const int n... | ALGO | 0.999966 | 3.808867 |
6ad49518-79dd-48b6-ae80-5b8dcc85f465 | raghavkhanna13/MyPrepBytesSolutions | Patterns/patternExp1.cpp | #include "iostream"
using namespace std;
int main() {
int rows;
cin>>rows;
for(int i = rows; i > 0; i--){
for(int j = 1; j <= i; j++){
cout<<j<<" ";
}
//for printing star
for(int star = 2; star <= rows - i + 1; star++){
cout<<"* *"<<" ";
}... | ALGO | 0.999947 | 3.764949 |
bd7f9737-8251-4b6b-9fcb-25a4605e9324 | ishandutta2007/codeforces | zhylj/normal/741/C.cpp | #include <bits/stdc++.h>
template <typename T> inline void rd(T& x) {
int si = 1; char c = getchar(); x = 0;
while(!isdigit(c)) si = c == '-' ? -1 : si, c = getchar();
while(isdigit(c)) x = x * 10 + c - 48, c = getchar();
x *= si;
}
template <typename T, typename... Args>
inline void rd(T& x, Args&... args) { rd(x... | ALGO | 0.999948 | 4.053686 |
9891b468-1aa2-4a90-a104-6cec1f49ff48 | almas-ashruff/DSASolutions | July/6 July/smallestWindowInAStringContainingAllCharsOfASubstring.cpp | #include <bits/stdc++.h>
using namespace std;
// Given two strings S and P. Find the smallest window in the S consisting of all the characters of P.
// https://www.algoexpert.io/questions/Smallest%20Substring%20Containing
// https://practice.geeksforgeeks.org/problems/smallest-window-in-a-string-containing-all-the-cha... | ALGO | 0.99999 | 6.073486 |
70cc1144-1cad-41c9-b566-7d908eba3f91 | vishnusanjeev/CSA1284-COMPUTER-ARCHITECTURE-FOR-ANDROID-APPLICATIONS | 31 Single Precision.cpp | #include <stdio.h>
void printBinary(int n, int i)
{
int k;
for (k = i - 1; k >= 0; k--) {
if ((n >> k) & 1)
printf("1");
else
printf("0");
}
}
typedef union {
float f;
struct
{
unsigned int mantissa : 23;
unsigned int exponent : 8;
unsigned int sign : 1;
} raw;
} myfloat;
void printIEEE(myfloat v... | ALGO | 0.995902 | 4.057395 |
b83e483e-3d43-44a7-bcd4-a95ecfd21225 | ishandutta2007/codeforces | anta/normal/280/A.cpp | #define _CRT_SECURE_NO_WARNINGS
#include <string>
#include <vector>
#include <algorithm>
#include <numeric>
#include <set>
#include <map>
#include <queue>
#include <iostream>
#include <sstream>
#include <cstdio>
#include <cmath>
#include <ctime>
#include <cstring>
#include <cctype>
#include <complex>
#define rep(i,n) f... | ALGO | 0.985077 | 3.682824 |
20456315-addf-4eda-a74a-db04d66176b7 | zxyDEDIRE/ACM_CODE | 多校/湖南省第十六届大学生计算机程序设计竞赛(HNCPC2020)- 重现/D.cpp | #include<bits/stdc++.h>
using namespace std;
#define ull unsigned long long
const int N = 1e6 + 10, SIZ = 1000000;
const ull mod=212370440130137957ll;
const ull base=131;
const ull prime=233317;
string p[N];
int nxt[N];
int n;
ull Hash1(int id, int x){
ull val = 0;
for(int i = 1; i <=x; i ++){
val = val * 131 + ... | ALGO | 0.999878 | 4.109765 |
47d12487-f71c-4dc4-a313-79cbad4c8bd0 | nsikanikpoh/dev_cpp | Recursion/main.cpp | #include <iostream>
using namespace std;
int recursiveFactorial(int n)// recursive factorial function
{
if (n == 0)
return 1;// basis case
else
return n * recursiveFactorial(n-1);// recursive case
}
int main()
{
cout << recursiveFactorial(7) << endl;
cout << recursiveFactorial(6) << e... | ALGO | 0.999751 | 6.062958 |
68aece23-e1c4-407e-bf71-43f4e04fe84d | mashfiqur05/Problem-Solving | Codeforces/2126C_I_Will_Definitely_Make_It.cpp | /// *** --- ||| In the name of ALLAH ||| --- *** ///
#include<bits/stdc++.h>
using namespace std;
#define fastio() ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define fraction() cout.unsetf(ios::floatfield); cout.precision(10); cout.setf(ios::fixed,ios::floatfield);
#define file() freopen("inp... | ALGO | 0.999986 | 4.07269 |
22afba7b-667e-4176-8051-a6e74b235822 | Arjen0130/new_code | for_offer/01_find_in_2d_array.cpp | #include <iostream>
#include <vector>
using namespace std;
/*
题目:在一个二维数组中(每个一维数组的长度相同),
每一行都按照从左到右递增的顺序排序,
每一列都按照从上到下递增的顺序排序。
请完成一个函数,输入这样的一个二维数组和一个整数,判断数组中是否含有该整数。
*/
class Solution {
public:
bool Find(int target, vector<vector<int> > array) {
int rowsNum = array.size();
int colsNum = array[0].... | ALGO | 0.999913 | 5.233896 |
8f03a3f5-be8f-45cf-8b54-4a6ad43aa11e | Maaz-24503/maaz_leetcode | 1471 The k Strongest Values in an Array/1471the-k-strongest-values-in-an-array.cpp | class Solution {
public:
vector<int> getStrongest(vector<int>& arr, int k) {
sort(arr.begin(), arr.end());
int med = arr[(arr.size()-1)/2];
stable_sort(arr.begin(), arr.end(), [med](const int &a, const int &b) {
if(abs(a - med) != abs(b - med)) return abs(a - med) > abs(b - med);... | ALGO | 0.999994 | 5.412469 |
9251e7f1-248d-485c-ac63-67c10eae3544 | Sokolan/AdventOfCode | cpp/2022/day02/sol1.cpp | #include <iostream>
#include <fstream>
#include <string>
#define DRAW 3
#define WIN 6
#define ABC_TO_RES(a) \
(a-'A')
#define XYZ_TO_RES(a) \
(a-'X')
using namespace std;
//return match result, -1 if input illegal
int resultCalc(string& input){
if(input.empty() || input.length() < 3){
//cout << input.length() <<... | ALGO | 0.999536 | 3.742419 |
1ba9fe9b-bb13-43f7-a471-13862d0be898 | muschellij2/FSL6.0.0 | extras/include/boost/libs/graph/example/johnson-eg.cpp | int
main()
{
using namespace boost;
typedef adjacency_list<vecS, vecS, directedS, no_property,
property< edge_weight_t, int, property< edge_weight2_t, int > > > Graph;
const int V = 6;
typedef std::pair < int, int >Edge;
Edge edge_array[] =
{ Edge(0, 1), Edge(0, 2), Edge(0, 3), Edge(0, 4), Edge(0, 5),... | ALGO | 0.999683 | 4.499472 |
e441ef8a-fad6-4401-b512-a2dae7be626f | AleGiovanardi/qureno | src/qurenod.cpp | #include "chainparams.h"
#include "clientversion.h"
#include "rpc/server.h"
#include "init.h"
#include "noui.h"
#include "scheduler.h"
#include "util.h"
#include "masternodeconfig.h"
#include "httpserver.h"
#include "httprpc.h"
#include <boost/algorithm/string/predicate.hpp>
#include <boost/filesystem.hpp>
#include <b... | TOOL | 0.863166 | 5.889822 |
31f3c8d2-cd9c-45fc-9310-07165909f6d9 | WingsOSab/android_frameworks_av | media/libeffects/lvm/lib/Common/src/AGC_MIX_VOL_2St1Mon_D32_WRA.cpp | /****************************************************************************************/
/* */
/* Includes */
/* ... | ALGO | 0.967481 | 5.86724 |
73087814-b50e-49b0-a61a-96cbe4d1aff2 | AkibAshfaq/CodeForce-Solve-set | 231A.cpp | #include<iostream>
using namespace std;
int main(){
int a, b, c;
int solve = 0;
int n;
cin>>n;
for(int i = 0; i < n; i++)
{
cin>>a>>b>>c;
if((a+b+c) >= 2)
solve++;
}
cout<<solve;
} | ALGO | 0.999862 | 4.374024 |
2ff44e9e-9447-4e5d-bf5e-5290e0d42084 | faraflh/alsuda | prak8/pcb1.cpp | #include <iostream>
using namespace std;
class Node {
public:
int absen;
string nama;
Node *next;
Node *prev;
};
class LinkedList {
public:
Node *head;
Node *tail;
LinkedList() {
head = NULL;
tail = NULL;
}
void addHead(int value, string Nama) {
Node *temp ... | ALGO | 0.998177 | 4.843235 |
beb5da3d-f740-45d7-9f49-48e1682d46e6 | hjiang13/LLMs-in-IR | POJ-104/65/130.cpp | #include <iostream>
using namespace std;
int main(){
int n,A=0;
cin >> "%d",&n);
int a[n],b[n];
for(int i=0; i<n; i++){
cin >> "%d%d",&a[i],&b[i]);
if((a[i]==0&&b[i]==1)||(a[i]==1&&b[i]==2)||(a[i]==2&&b[i]==0)){
A++; }
else if(a[i]!=b[i]){
A--; }
}
if(A>0){
cout << "A"); }
if(A<0){
cout << "B"); }
if(A==0){
cout << "Ti... | ALGO | 0.999967 | 3.914785 |
ce27813d-e6b6-4eb4-a9c9-fcfc738f10f2 | adityasrathore/Codes | LeetCode/1793. Maximum Score of a Good Subarray.cpp | class Solution {
public:
int maximumScore(vector<int>& nums, int k) {
nums.push_back(0);
stack<int> st ;
int n = nums.size(), res = 0;
for(int i=0; i<n ; i++){
while(!st.empty() && nums[st.top()] >= nums[i]){
int height = nums[st.top()];
... | ALGO | 0.999967 | 5.975124 |
ec35b632-107b-4bcc-936a-4ea2c383966d | joaovitor73/Algoritmos | Lista 5/string/codificaoCesar.cpp | #include <iostream>
using std::string;
using std::cin;
using std::cout;
/* O código de César é uma das mais simples e conhecidas técnicas de criptografia. É um tipo de substituição na
qual cada letra do texto é substituída por outra, que se apresenta no alfabeto abaixo dela um número fixo
de vezes. Por exemplo, com uma... | ALGO | 0.999156 | 3.575463 |
b7088c09-615a-4039-9c29-a6356d186595 | justtayyabkhxn/myleetcode | 3225-length-of-longest-subarray-with-at-most-k-frequency/length-of-longest-subarray-with-at-most-k-frequency.cpp | class Solution {
public:
int maxSubarrayLength(vector<int>& nums, int k) {
int n=nums.size();;
map<int, int> mpp;
int first = 0;
int second = 0;
int ans = 1;
while (first < n && second < n) {
mpp[nums[second]]++;
while(mpp[nums[second]] > k) {
... | ALGO | 0.999938 | 6.195919 |
34d5d08d-7755-44b1-ba8a-8f144c742613 | SonuSV7719/Hashing-With-Chaining-Group-A--Practical-1- | hash_table_template.cpp | #include<bits/stdc++.h>
#define SIZE 10
using namespace std;
template<class T>
class Node
{
public:
T data;
Node* next;
Node(T phone_no)
{
data = phone_no;
next = NULL;
}
};
template<class U>
class link
{
public:
Node<U>** hash_table = new Node<U>*[SIZE];
void insert_node(U phone_no, int);
int hash_ind... | ALGO | 0.998306 | 4.502158 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.