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 |
|---|---|---|---|---|---|---|
4de5cb4a-7ed5-46ab-9698-cd131b76485b | Yra-A/Yra-A.github.io | slides/lanqiaobei/demos/WA.cpp | #include <bits/stdc++.h>
int main() {
int a, b;
std::cin >> a >> b;
std::cout << a + b + 1 << '\n';
return 0;
} | ALGO | 0.998976 | 3.317555 |
42f96e4b-5eea-4fba-ba67-33452f351b32 | nawngs/CompetitiveProgramming | Codeforces/455d.cpp | #include <bits/stdc++.h>
#define name ""
#define test "test"
#define ll long long
#define ld long double
#define fi first
#define se second
#define pll pair < ll, ll >
#define pii pair < int, int >
#define fast ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define sz(x) ((int)(x).size())
#define pb push_back
#defin... | ALGO | 0.999754 | 3.732771 |
520e4935-af1a-43f2-922e-215fced344bd | CoinsOS/GongYiCoin-OS | src/pubkey.cpp | #include "pubkey.h"
#include "eccryptoverify.h"
#ifdef USE_SECP256K1
#include <secp256k1.h>
#else
#include "ecwrapper.h"
#endif
bool CPubKey::Verify(const uint256 &hash, const std::vector<unsigned char>& vchSig) const {
if (!IsValid())
return false;
#ifdef USE_SECP256K1
if (secp256k1_ecdsa_verify((co... | TOOL | 0.855036 | 6.351655 |
7d551cff-ce68-4f82-bd8b-db927bda50d9 | Rampeddireddi/leetcode | 1934-evaluate-the-bracket-pairs-of-a-string/evaluate-the-bracket-pairs-of-a-string.cpp | class Solution {
public:
string evaluate(string s, vector<vector<string>>& knowledge) {
string res="";
int i=0;
unordered_map<string,string>mp;
for(auto i:knowledge)mp[i[0]]=i[1];
while(i<s.size()){
string sr="";
if(s[i]=='('){
i++;
... | ALGO | 0.99999 | 4.920837 |
c3c2e1bf-135a-4ae2-8531-be2f75d03522 | sihoon197/OSS_project | doc/examples/Tutorial_ReductionsVisitorsBroadcasting_broadcast_simple_rowwise.cpp | #include <iostream>
#include <Eigen/Dense>
using namespace std;
int main()
{
Eigen::MatrixXf mat(2,4);
Eigen::VectorXf v(4);
mat << 1, 2, 6, 9,
3, 1, 7, 2;
v << 0,1,2,3;
//add v to each row of m
mat.rowwise() += v.transpose();
std::cout << "Broadcasting result: " << std::... | ALGO | 0.99897 | 4.296038 |
53a3cb6d-fe6e-422e-ac9c-1bf47cfb5a05 | jigjnasu/kattis | problems/mia.cpp | /*
Kattis.com
Problem Mia.
Solution by Rakesh Kumar, cpp.rakesh(at)gmail.com
Date: 06/12/2017
*/
#include <cstdio>
/*
Rank 1 -- 12 or 21 score 21
Rank 2 -- same 11, 22, 33, 44, 55, 66
score highest to lowest
66 > 55 > 44 > 33 > 22 > 11
Rank 3 -- all numbers
*/
struct Status {
Status() : rank(0)... | ALGO | 0.998268 | 3.969961 |
d4b53069-1e43-4ec8-93f9-0bee270ed35e | ishandutta2007/codeforces | weakesttopology/normal/1446/D1.cpp | #include "bits/stdc++.h"
using namespace std;
#define _ ios_base::sync_with_stdio(0);cin.tie(0);
#define endl '\n'
#define debug(x) cerr << #x << " == " << (x) << '\n';
#define all(X) begin(X), end(X)
#define size(X) (int)std::size(X)
using ll = long long;
const int INF = 0x3f3f3f3f;
const ll LINF = 0x3f3f3f3f3f3f3... | ALGO | 0.999953 | 4.187053 |
02f84212-4fe0-4a29-9f4d-290914715a0c | nedmv/aoc | puzzles/2020/02/02.cpp | // Puzzle is available at https://adventofcode.com/2020/day/2
// Keywords: regex
#include "../2020.hpp"
using namespace std;
std::string y2020::solve_02a(const std::vector<std::string> &input) {
// groups: 1 - min, 2 - max, 3 - char, 4 - string
regex reg(R"(^([0-9]+)-([0-9]+)\s([a-z]?):\s([a-z]+)$)");
smatch gro... | ALGO | 0.968202 | 4.790915 |
d199e276-a99d-474c-9c41-a66661358bee | lahifkhan/super_problem_solver_zone | weak5/Day4/minimize_inversion.cpp | #include <bits/stdc++.h>
using namespace std ;
int main() {
int t;
cin>>t;
while(t--)
{
int n;
cin>>n;
vector<int>a(n),b(n);
map<int,int>mp;
for(int i=0; i<n; i++){
cin>>a[i];
}
for(int i=0; i<n; i++){
cin>... | ALGO | 0.999929 | 3.016823 |
d3b8f5dd-3370-467e-9079-b36145e05765 | froasio/MiscellaneousAlgorithms | tests/LinearSortingTest.cpp | #include "CppUTest/TestHarness.h"
#include "LinearSorting.h"
TEST_GROUP(linearSortingTest)
{
void setup()
{
}
void teardown()
{
}
};
TEST(linearSortingTest, countingSortTest)
{
LinearSorting ls;
int unsorted_array[7] = {1, 4, 1, 2, 7, 5, 2};
int sorted_array[7] = {1, 1, 2, 2, 4, ... | TEST | 0.928521 | 6.340027 |
d8bed550-de54-4c17-8849-b9cfef4cead6 | iasiddiqui/90DaysChallenge | Day72/set-bits and number.cpp | //Given a number N. Find the product of the number of setbits and the number itself.
class Solution{
public:
int bitMultiply(int N){
int count = 0, n = N;
while(n > 0){
if(n%2)
count++;
n /= 2;
}
return (count*N);
}
};
| ALGO | 0.99989 | 5.052634 |
97484e4b-12b4-4597-b3bf-76c6a74b9aa7 | aizsfgk/leetcode-cn | editor/cn/[1365]有多少小于当前数字的数字.cpp | //给你一个数组 nums,对于其中每个元素 nums[i],请你统计数组中比它小的所有数字的数目。
//
// 换而言之,对于每个 nums[i] 你必须计算出有效的 j 的数量,其中 j 满足 j != i 且 nums[j] < nums[i] 。
//
// 以数组形式返回答案。
//
//
//
// 示例 1:
//
// 输入:nums = [8,1,2,2,3]
//输出:[4,0,1,1,3]
//解释:
//对于 nums[0]=8 存在四个比它小的数字:(1,2,2 和 3)。
//对于 nums[1]=1 不存在比它小的数字。
//对于 nums[2]=2 存在一个比它小的数字:(1)。
//... | ALGO | 0.999985 | 6.495872 |
d6762a40-3c47-49b5-bf21-31a83c50beb4 | kvm2116/vmtorrent | p2pfs/boost/libs/numeric/odeint/examples/mtl/implicit_euler_mtl.cpp | #include <iostream>
#include <fstream>
#include <utility>
#include "time.h"
#include <boost/numeric/odeint.hpp>
#include <boost/phoenix/phoenix.hpp>
#include <boost/numeric/mtl/mtl.hpp>
#include <boost/numeric/odeint/external/mtl4/implicit_euler_mtl4.hpp>
using namespace std;
using namespace boost::numeric::odeint;
... | ALGO | 0.995765 | 4.987206 |
e65f6e17-42c0-440c-9bc1-5d59c855105f | ishandutta2007/codeforces | damians/normal/61/E.cpp | #include <string>
#include <vector>
#include <algorithm>
#include <cstdio>
#include <map>
#include <set>
#include <cmath>
#include <sstream>
#include <iostream>
#include <cstring>
#define REP(i,x,v)for(int i=x;i<=v;i++)
#define REPD(i,x,v)for(int i=x;i>=v;i--)
#define FOR(i,v)REP(i,0,(int)(v)-1)
#define FORD(i,v)REPD(i... | ALGO | 0.999814 | 3.435783 |
fdc6805e-914f-4635-b287-480bcf6afae8 | vishnukhokhar/LeetCode | Dynamic Programming/min_cost_fortickets.cpp | vector<int> dp(367);
unordered_set<int> days(DAYS.begin(), DAYS.end());
for (int i = 1; i < 366; i++)
{
dp[i] = dp[i - 1];
if (dp.find(i) != dp.end())
{
dp[i] = min({dp[i - 1] + cost[0],
dp[max(0, i - 7)] + cost[1],
dp[max(0, i - 30)] + cost[2]});
}
} | ALGO | 0.99811 | 4.501112 |
cfe7f5fa-c243-4bcf-8eb9-0409e00df181 | hieuvd341/Algorithm | HUST/TTUD/Dãy con tăng dài nhất/solve.cpp | #include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
int longest_increasing_subsequence(const vector<int>& nums) {
int size = nums.size();
if (size == 0) return 0;
vector<int> dp(size, 1);
int max_length = 1;
for (int i = 1; i < size; i++) {
for (int j = 0; j <... | ALGO | 0.99998 | 6.346343 |
1f768849-0ba1-4cf2-89a1-1d7cd1559f2a | whiteblueskyss/DSA-with-cpp | Searching&Sorting/Selection_sort.cpp | #include<iostream>
using namespace std;
int main()
{
int a[]= { 3, 34, 64, 64, 23, 53, 53};
int n = 7;
int temp;
cout << n << endl;
for(int i=0; i<n-1; i++){
for(int j=i+1; j<n; j++){
if(a[i]>a[j]){
temp = a[i];
a[i] = a[j];
a[j] = temp;
}
}
}
for(int i=0; i<n; i++){
cout<< a[i] << " "... | ALGO | 0.999578 | 3.368001 |
e417b855-0cd0-45fd-b750-00a7d0231b65 | adismort14/i-Doc-app-Google-Solution-Challenge-2k23 | 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 |
d9f481e4-718b-4e05-9121-a1b400d368e9 | HeeChanN/Algorithm-Online-Judge | c++/프로그래머스/lv3/인사고과.cpp | #include<bits/stdc++.h>
using namespace std;
struct A{
int num1;
int num2;
int idx;
};
vector<A> v;
vector<pair<int,int>> ret;
int abc;
bool comp(struct A a, struct A b){
if(a.num1 == b.num1){
return a.num2 > b.num2;
}
return a.num1 > b.num1;
}
bool comp2(pair<int,int> a, pair<int,in... | ALGO | 0.999966 | 4.557264 |
4bf4db29-afc9-4e79-b508-a3658cac8aaf | Physwf/physwf-c-lab | DirectX/HelloDX9/CartoonRendering.cpp | #include "Demo.h"
#include <set>
#include <unordered_map>
#include <sstream>
#include <functional>
IDirect3DDevice9* Device;
ID3DXMesh* pMesh;
IDirect3DVertexBuffer9* pEdges;
IDirect3DIndexBuffer9* pEdgeIndices;
IDirect3DTexture9* pBrightTexture;
IDirect3DVertexShader9* pToonSH;
ID3DXConstantTable* pToonConst;
IDirect... | ALGO | 0.987137 | 4.512366 |
b40cb3ac-8cf0-461c-a4d2-e822d69c0d2a | dong628/OhMyCodes | Luogu/P7077_tmp.cpp | #include <cstdio>
#include <iostream>
int main(){
freopen("data.out", "r", stdin);
int n;
while(scanf("%d", &n) != EOF){
printf("%d\n", n);
}
return 0;
}
| ALGO | 0.998427 | 3.120109 |
c0f0205a-580a-4bc3-940b-a9c6229c8f24 | jatin177128/ML-challenges | Lib/site-packages/sklearn/utils/src/MurmurHash3.cpp | // Note - The x86 and x64 versions do _not_ produce the same results, as the
// algorithms are optimized for their respective platforms. You can still
// compile and run any of them on any platform, but your performance with the
// non-native version will be less than optimal.
#include "MurmurHash3.h"
//-------------... | ALGO | 0.997929 | 7.198757 |
97120689-09ee-4459-88ef-bde8a7d3f088 | sumonstr12/CODE | Problem_Solution_Online/CodeForces/Problem solve/Team_Olympiad.cpp | #include<bits/stdc++.h>
using namespace std;
#define ll long long
void solve(){
int n;
cin >> n;
vector<int> a(n);
int one = 0, two = 0, three = 0;
for(int i = 0; i < n; i++){
cin >> a[i];
if(a[i] == 1){
one++;
}else if(a[i] == 2){
two++;
}el... | ALGO | 0.999965 | 3.484292 |
380abb43-9a55-4113-99e0-e3b13e1df9e3 | artclarke/humble-video | humble-video-captive/src/main/gnu/libopencore-amr/csrc/opencore/codecs_v2/audio/gsm_amr/amr_nb/dec/src/a_refl.cpp | /*
------------------------------------------------------------------------------
Filename: a_refl.cpp
Functions: a_refl
------------------------------------------------------------------------------
*/
/*----------------------------------------------------------------------------
; INCLUDES
----------------------... | ALGO | 0.999891 | 5.593772 |
899babca-724d-4aac-b87b-d5b512863bc7 | vektort13/AntidetectFirefox | gfx/angle/src/third_party/murmurhash/MurmurHash3.cpp | // Note - The x86 and x64 versions do _not_ produce the same results, as the
// algorithms are optimized for their respective platforms. You can still
// compile and run any of them on any platform, but your performance with the
// non-native version will be less than optimal.
#include "MurmurHash3.h"
//-------------... | ALGO | 0.998718 | 7.235088 |
54bedd1f-786e-40cc-885d-321839c43c71 | masoudbehzadinasab/Trilinos_12_11 | packages/rythmos/example/epetra/1Dfem/cxx_main.cpp | #ifdef HAVE_MPI
#include "Epetra_MpiComm.h"
#include "mpi.h"
#else
#include "Epetra_SerialComm.h"
#endif // HAVE_MPI
#include "Epetra_Map.h"
#include "Epetra_Vector.h"
#include "Epetra_Version.h"
#include "ExampleApplication1Dfem.hpp"
// Includes for Rythmos:
#include "Rythmos_ConfigDefs.h"
#include "Rythmos_Version... | ALGO | 0.996515 | 5.308823 |
bd21f323-cfed-4d30-8d00-cc9772a86458 | DNS/Cafu | CaSHL/Init1.cpp | // Initialisiert die FacePVS-Matrix, für die nach Ausführung dieser Funktion folgende Eigenschaften gelten:
//
// 1) FacePVS[i][j]== NO_VISIBILITY iff Face[i] can NOT see Face[j]
// FacePVS[i][j]==PARTIAL_VISIBILITY iff Face[i] can (PARTIALLY) see Face[j]
// FacePVS[i][j]== FULL_... | TOOL | 0.979966 | 3.855245 |
6971da33-c0b5-4066-89b2-50e4280ec0ea | lborowczak/Comp364-Final | Java/cpp/NBody_BH.cpp | #include <iostream>
#include <chrono> //time
#include <random> //random
#include "NBody_BH.hpp"
using namespace std;
int main (int argc, char* argv[]){
srand(time(NULL)); //seed RNG
const double dt = 0.001; //default time step, 0.1 seconds
int nparts = 100; // default particle count, 1... | ALGO | 0.999914 | 5.466537 |
951c09cc-387a-48bc-83d7-1e2e8586a2dd | CyrilleDunant/xfem-amie | physics/damagemodels/spacetimeisotropiclineardamage.cpp | namespace Amie {
SpaceTimeIsotropicLinearDamage::SpaceTimeIsotropicLinearDamage(double density)
{
thresholdDamageDensity = density ;
getState(true).resize(1, 0.);
isNull = false ;
}
std::pair< Vector, Vector > SpaceTimeIsotropicLinearDamage::computeDamageIncrement( Amie::ElementState &s)
{
return std... | ALGO | 0.921663 | 5.130888 |
f7f98927-ff00-4a62-9a9a-99f06fb731a6 | lowekoz/cp | comp-env/FordFulkerson.cpp |
#ifndef __SKELETON
#include <bits/stdc++.h>
using namespace std;
#endif
//following suit https://www.youtube.com/watch?v=Xu8jjJnwvxE
class Edge {
public:
int from, to;
Edge* residual;
long flow = 0;
long capacity;
Edge() {
}
Edge(int from, int to, int capacity) {
this->from = f... | ALGO | 0.999667 | 4.811994 |
1724dd2d-a2aa-4d9d-a58b-f7395041977b | dinhtuyen3011/cpp | Advanced Concepts/3_STL_Sort_Standard_Template_Library/Sort_Standard_Template_Library_01.cpp | #include <iostream>
#include <algorithm>
using namespace std;
const int SIZE = 7;
int main()
{
<<<<<<< HEAD
<<<<<<< HEAD
<<<<<<< HEAD
<<<<<<< HEAD
<<<<<<< HEAD
int intArray[7] = {5, 3, 32, -1, 1, 104, 53};
//Now we call the sort function
sort(intArray, intArray + 7); //ASC
=======
=======
>>>>>>> aa52cfc5... | ALGO | 0.998985 | 4.501359 |
371a7ce7-7e09-451f-a87b-9ed555f57f36 | danish061296/SmartPointer-LinkedBag | PartC_SmartPointers/LinkedBag.cpp | #include <cstddef>
#include "Node.h"
#include "LinkedBag.h"
//
//
// PLEASE DO NOT CHANGE THIS FILE
//
//
template<typename ItemType>
LinkedBag<ItemType>::LinkedBag() : headPtr(nullptr), itemCount(0) {}
template<typename ItemType>
LinkedBag<ItemType>::LinkedBag(const LinkedBag<ItemType>& aBag) {
itemCount = aBag... | TOOL | 0.855223 | 5.914513 |
c7625806-a389-410d-9503-e12f7823ea45 | hacch141/Coding-Practice | LeetCode/3000.Maximum-Area-of-Longest-Diagonal-Rectangle.cpp | // 3000. Maximum Area of Longest Diagonal Rectangle
class Solution {
public:
int areaOfMaxDiagonal(vector<vector<int>>& dimensions) {
int ans = 0, d = 0;
for(auto i : dimensions) {
int l = i[0], w = i[1];
int curr_d = (l * l) + (w * w);
if(curr_d >= d) {
... | ALGO | 0.999765 | 5.851143 |
2c4ba1ca-b91a-481e-ac58-3c182e59e56d | shivangigoel1302/leetcode_solutions | Design_an_Ordered_Stream.cpp | class OrderedStream {
public:
vector<string>v;
int i;
int n;
OrderedStream(int N) {
i = 0;
v.resize(N);
n = N;
}
vector<string> insert(int id, string value) {
v[id-1] = value;
vector<string>ans;
while(i < n){
if(v[i].size() != 0){
... | ALGO | 0.998495 | 6.007921 |
63142165-0804-4a06-bc79-36b1b6ec4804 | g3x-gauransh/Competitive_Programming | cpp/relative.cpp | #include<bits/stdc++.h>
#define ll long long
#define endl '\n'
#define MOD 1e9+7
#define pb push_back
#define fast ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define T int t;cin>>t;while(t--)
using namespace std;
int main()
{
fast
T
{
int c,g;
cin>>g>>c;
int h = (c*c)/(2*... | ALGO | 0.99885 | 4.093327 |
b57849e9-fc35-472e-a222-29ae5c2f45b0 | jeongyoenwoo/Algorithm_solving | 프로그래머스/2/42584. 주식가격/주식가격.cpp | #include <string>
#include <vector>
#include <stack>
using namespace std;
vector<int> solution(vector<int> prices) {
vector<int> answer(prices.size());
stack<pair<int,int>> st;
int time=0;
for(int i=0;i<prices.size();i++){
time++;
while(!st.empty()&&prices[st.top().first]>pri... | ALGO | 0.999611 | 5.264795 |
3ec70e93-fa79-42ad-b40d-3c49755a672f | alexandre-james/artifo | src/filter/tv.cpp | #include "tv.hpp"
#include "../construct/salt_pepper.hpp"
#include "../image/conversion.hpp"
#include "../tools/contrast.hpp"
#include "../tools/manipulation.hpp"
#include "../modifier/transformation.hpp"
#include "../modifier/filter.hpp"
#include <cmath>
#include <cstdio>
rgb_image *tv(rgb_image *input) {
int he... | TOOL | 0.90022 | 4.098845 |
248e8ed4-3dc1-4791-b85b-13c540cb0a3f | ishandutta2007/codeforces | rfpermen/normal/863/A.cpp | #include <bits/stdc++.h>
#pragma GCC optimize("O2")
using namespace std;
#define ll long long
#define rep(i,n,N) for(int i=n;i<=N;i++)
#define rap(i,n,N) for(int i=(int)n;i>=(int)N;i--)
#define mp make_pair
#define pb push_back
#define pob pop_back
#define pf push_front
#define pof pop_front
#define fi first
#define s... | ALGO | 0.999801 | 3.884585 |
622e7a08-baf3-4580-9993-c012e2168783 | surajbartoula/competitveprogramming | dzyloveschess.cpp | #include <bits/stdc++.h>
using namespace std;
int n, m;
char S[1100];
int main() {
ios::sync_with_stdio(0);
cin.tie(0);
cin >> n >> m;
for (int i = 0; i < n; i++) {
cin >> S;
for (int j = 0; j < m; j++)
if (S[j] == '.') {
if ((i + j) % 2 != 0)
S[j] = 'W';
else
S[j] = 'B';
}
cout << S... | ALGO | 0.999906 | 3.673484 |
c9b3e44d-57a5-4d78-a5a2-faf4d6b54437 | aviafrid781/programmin | linkedList-insert-first.cpp | #include<bits/stdc++.h>
using namespace std;
struct node
{
int data;
struct node *next;
};
struct node *singleLinkList(int arr[],int siz)
{
struct node *head=NULL, *temp=NULL, *current=NULL;
for(int i=0; i<siz; i++)
{
temp=(struct node *)malloc(sizeof(struct node));
temp->data=a... | ALGO | 0.999456 | 3.469276 |
b63977f6-b23f-4dcc-9e6c-9941f593c47d | Stellarhold170NT/DSA-CodePTIT | DSA05015.cpp | #define _CRT_SECURE_NO_WARNINGS
#include <iostream>
#include <vector>
#include <string>
#include <sstream>
#include <cstring>
#include <algorithm>
#include <queue>
#include <map>
#include <set>
#include <stack>
#include <cmath>
#include <iomanip>
#include <cstdlib>
#include <numeric>
#include <bitset>
#include <unorder... | ALGO | 0.999928 | 4.147514 |
d068627d-e609-4358-8bff-adc4b3db415f | dodoandchichi/codetree-TILs | 240411/이상한 윷놀이/odd-woodstick-game.cpp | #include <iostream>
#include <vector>
#include <tuple>
#include <algorithm>
#define MAX_N 13
#define DIR_NUM 4
#define BLUE 2
#define RED 1
using namespace std;
int n, k;
int grid[MAX_N][MAX_N];
vector<pair<int, int>> pieces[MAX_N][MAX_N]; // 번호, 방향
int dx[DIR_NUM] = { 0, 0, -1, 1 };
int dy[DIR_NUM] = { 1, -1, 0, 0 }... | ALGO | 0.999773 | 4.465259 |
d4ec825e-a580-41e3-b5fc-dff94a9c9a5d | Sorsorov/SFloating-log | F_L/Library/PackageCache/com.unity.ide.visualstudio@2.0.22/Editor/COMIntegration/COMIntegration~/COMIntegration.cpp | #include <iostream>
#include <sstream>
#include <string>
#include <filesystem>
#include <windows.h>
#include <shlwapi.h>
#include <fcntl.h>
#include <io.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 m... | TOOL | 0.931523 | 6.933585 |
37240300-0a08-482c-bfe5-3575f482ee74 | LongTarget/Fasim-LongTarget | ssw_cpp.cpp | // ssw_cpp.cpp
// Created by Wan-Ping Lee
// Last revision by Mengyao Zhao on 2017-05-30
#include "ssw_cpp.h"
#include "ssw.h"
#include<algorithm>
#include <iostream>
#include <sstream>
namespace {
static const int8_t kBaseTranslation[128] = {
4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4,
4, 4, 4, 4, 4, 4... | ALGO | 0.992623 | 3.430327 |
c52f2a88-258d-4699-a3c0-2b3c7d6bb913 | sarvex/leetcode-jai | solution/1400-1499/1476.Subrectangle Queries/Solution.cpp | class SubrectangleQueries {
public:
vector<vector<int>> g;
vector<vector<int>> ops;
SubrectangleQueries(vector<vector<int>>& rectangle) {
g = rectangle;
}
void updateSubrectangle(int row1, int col1, int row2, int col2, int newValue) {
ops.push_back({row1, col1, row2, col2, newValue... | ALGO | 0.999485 | 6.704385 |
554b5dd7-11d7-45fa-83d5-baa929ef198a | Fiffy-lin/Leetcode | 46.全排列.cpp | // https://leetcode-cn.com/problems/permutations/
class Solution {
public:
vector<vector<int>> ans;
void backtrace(vector<int>& nums,vector<int>& cur){
if(nums.size()==cur.size()){
ans.emplace_back(cur);
return;
}
for(auto &x:nums){
if(find(cur.begin(... | ALGO | 0.999989 | 6.475826 |
c4692b14-14b2-40f3-aa5e-613bf35f8760 | HenishTrada/cse205-dc | assignments/13.10.2023/1.cpp | class Solution {
public:
vector<int> twoSum(vector<int>& nums, int target) {
unordered_map<int, int> numMap;
int n = nums.size();
for (int i = 0; i < n; i++) {
int complement = target - nums[i];
if (numMap.find(complement) != numMap.end()) {
return {n... | ALGO | 0.99991 | 6.773892 |
687c0d36-c623-44de-84e6-59b6bbe5272f | AniKouDev/CodeChef | 0-1000 Beginner Level/Minimum_Coins.cpp | #include <iostream>
using namespace std;
#define breakline cout<<endl;
int main(){
int t;
cin >> t;
while(t--){
int x;
cin >> x;
cout << x%10;
breakline;
}
} | ALGO | 0.999386 | 3.793928 |
9d744747-f50f-4cd8-8937-6f8aeeec95af | Es7evam/Problem-Solutions | UVa Online Judge/11631 - Dark Roads.cpp | #include <bits/stdc++.h>
using namespace std;
#define pb push_back
#define mk make_pair
#define fi first
#define se second
#define fastcin ios_base::sync_with_stdio(false)
typedef long long ll;
const int INF = 0x3f3f3f3f;
const double PI = acos(-1.0);
priority_queue<pair<int,int>> pq;
vector<bool> taken;
vector<vecto... | ALGO | 0.999949 | 4.240833 |
8bb5ce41-7c07-4c19-b0a1-6543d891ff71 | DataAnalyticsEngineering/FANS | pyfans/micro.cpp | // Micro simulation for mechanical problems
// In this file we solve a micro problem with FANS which is controlled by the Micro Manager
// This file is compiled with pybind11 to be available as a python module
//
#include "micro.hpp"
#include "setup.h"
#include "matmodel.h"
py::array_t<double> merge_arrays(py::array_... | TOOL | 0.875822 | 5.707279 |
8ad8acc3-c766-4fea-8491-168f7ceb9f4b | actium/codeforces | 0000/90/91a.cpp | #include <algorithm>
#include <iostream>
#include <string>
#include <vector>
void answer(unsigned x)
{
std::cout << x << '\n';
}
void no_answer()
{
std::cout << -1 << '\n';
}
void solve(const std::string& s, const std::string& t)
{
const size_t n = s.length();
std::vector<size_t> p[26];
for (siz... | ALGO | 0.999954 | 5.144451 |
c1a1d338-4b04-416f-91c1-4e7b201e736e | ishandutta2007/codeforces | pranjal.ssh/normal/966/D.cpp | #include <bits/stdc++.h>
using namespace std;
#define F first
#define S second
#define FOR(i,a,b) for (auto i = (a); i <= (b); ++i)
#define NFOR(i,a,b) for(auto i = (a); i >= (b); --i)
#define all(x) (x).begin(), (x).end()
#define sz(x) int(x.size())
typedef long long ll; typedef pair <int, int> ii; typedef vector <in... | ALGO | 0.999973 | 4.034887 |
6eb84242-453e-498f-be96-c6fb014f7ae6 | ashraful609/Solved_Problems | uva_10035.cpp | #include <iostream>
#include <cstdio>
using namespace std;
int main(){
long long a,b,a1,b1;
long long temp=0;
while(scanf("%lld %lld",&a,&b) && a!=0 || b!=0){
long long temp=0;
long long counter=0;
while(a!=0 || b!=0){
a1=a%10;
b1=b%10;
a=a/10;... | ALGO | 0.999812 | 3.512228 |
91810ad8-f6da-470f-8858-8b24ee9a5cb5 | YBenPan/Competitive-Programming | USACO/Gold/visitfj.cpp | #include <bits/stdc++.h>
using namespace std;
#define fi first
#define se second
#define LL long long
#define pb push_back
#define MOD 1000000007
#define int LL
#define vi vector<long long>
#define pi pair<long long, long long>
int n, cost;
int g[105][105];
int dx[16] = {0, 1, 2, 3, 2, 1, 0, -1, -2, -3, -2, -1, 0, 0, 1... | ALGO | 0.99996 | 3.795423 |
7d7f2459-fe72-4791-b748-4b593990dd6f | S-omniu-m/PI2001_Deryabkina | lab8_2/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.998377 | 6.76073 |
5a04a68e-767a-4a0b-aa6c-51b4f07c1fb3 | SummerRainDiver/AsioServerEngine-Beta | lib/boost_1_82_0/libs/numeric/odeint/examples/stochastic_euler.cpp | #include <vector>
#include <iostream>
#include <boost/random.hpp>
#include <boost/array.hpp>
#include <boost/numeric/odeint.hpp>
/*
//[ stochastic_euler_class_definition
template< size_t N > class stochastic_euler
{
public:
typedef boost::array< double , N > state_type;
typedef boost::array< double , N > der... | ALGO | 0.998924 | 5.856675 |
7840bb91-a5a8-4e13-9b65-4da62832a892 | sh1vank/Prac | iq_test.cpp |
#include <iostream>
#include<string.h>
#include<cmath>
using namespace std;
int main() {
int n;
cin>>n;
int a[100];
int ev=0,od=0;
for(int i=0;i<n;i++)
{
cin>>a[i];
if(a[i]&1)
{
od++;
}
else
{
ev++;
}
}
if(od==... | ALGO | 0.999799 | 3.071469 |
56a70f27-4597-4ce3-854b-fd25430cf94e | quanvu45/advance_pro | 09_08/dynamic3_fixed.cpp | #include<bits/stdc++.h>
using namespace std;
int main(){
int a,t,s=0,i=1;
vector<int> arr;
cin>>a;
for(int i=0;i<a;i++){
cin>>t;
arr.push_back(t);
}
int len=a;
while(i!=len+1){
if(arr[0]>arr[(int)arr.size()-1]){
s+=i*arr[(int)arr.size()-1];
... | ALGO | 0.999963 | 3.132594 |
1f67a873-8e93-463c-8a97-cd5240807951 | mikayel2/NMPC_ACADO_ODROID | export_MPC/Old code version (ODROID edit)/NMPC_ACADO_ODROID-main(3)/export_MPC/qpoases/SRC/Indexlist.cpp | /**
* \file SRC/Indexlist.cpp
* \author Hans Joachim Ferreau
* \version 1.3embedded
* \date 2007-2008
*
* Implementation of the Indexlist class designed to manage index lists of
* constraints and bounds within a QProblem_SubjectTo.
*/
#include <Indexlist.hpp>
/*************************************************... | TOOL | 0.895138 | 6.003575 |
53a08402-d217-4efb-82aa-5da69a63c22a | Moein-Karami/OlympiadCodes | Codeforces/C. Circular RMQ/main.cpp | ///Chefer
#include <bits/stdc++.h>
using namespace std;
const int maxn=3e5,inf=1e9;
int se[4*maxn];
int lazy[4*maxn];
void pakhsh(int id)
{
se[2*id]+=lazy[id];
se[2*id+1]+=lazy[id];
lazy[2*id]+=lazy[id];
lazy[2*id+1]+=lazy[id];
lazy[id]=0;
}
void add(int id,int L,int R,int l,int r,int val)
{
p... | ALGO | 0.999467 | 3.848644 |
785d7009-9b68-423c-8c3d-699ad144a17e | SpikeViper/nerdcoin | src/script.cpp | using namespace std;
using namespace boost;
#include "script.h"
#include "keystore.h"
#include "bignum.h"
#include "key.h"
#include "main.h"
#include "sync.h"
#include "util.h"
bool CheckSig(vector<unsigned char> vchSig, vector<unsigned char> vchPubKey, CScript scriptCode, const CTransaction& txTo, unsigned int nIn, ... | TOOL | 0.91463 | 6.503615 |
1439e898-79fd-4e39-a740-ac603a31267b | MynameisSanskar/LeetCode | 2478-longest-nice-subarray/2478-longest-nice-subarray.cpp | class Solution {
public:
int longestNiceSubarray(vector<int>& nums) {
int start=0,len=0,usedBits=0;
for(int end=0;end<nums.size();end++){
// shrink
while((nums[end] & usedBits)!=0){
usedBits^=nums[start++];
}
usedBits|=nums[end];
... | ALGO | 0.999986 | 6.031199 |
cfdea973-2967-4055-afdd-af0ca0cf27f7 | YiyangHuo/G-nut-Anubis-complied-in-VS2019 | Anubis_complete/src/gproc/gflt.cpp | #include <stdlib.h>
#include <cmath>
#include <iostream>
#include <chrono>
#include "gproc/gflt.h"
#include "gall/gallfltmat.h"
#include "gutils/gmatrixconv.h"
using namespace std;
using namespace std::chrono;
namespace gnut {
// Constructors
t_gflt::t_gflt()
{
}
t_kalman::t_kalman()
{
}
t_SRF::t_SRF()
{
}
... | ALGO | 0.999003 | 5.626008 |
ad29c5d7-0be1-480e-9d0c-bc6e8a3f23b7 | Ak1sh5/Binary_trees | 03.Traversals_dfs.cpp | //Preorder (node,left,right)
//Postorder (left,right,node)
//Inorder (left,node,right)
//TC:O(n) Reason: We are traversing N nodes and every node is visited exactly once.
//SC: Space is needed for the recursion stack. In the worst case (skewed tree), space complexity can be O(N).
//Recursion way
#include <bits/std... | ALGO | 0.999925 | 6.179981 |
906ac5b0-bac5-4150-b9ff-e01d722cbe4f | kingdol666/C--linked-list-test | main.cpp | #include <iostream>
using namespace std;
#include "Node.h"
int main() {
Node *node = new Node(5);
Node::add(node,1);
Node::add(node,10);
Node::insertNode(node,0,1);
Node::insertNode(node,1,3);
Node::insertNode(node,3,6);
Node::insertNode(node,10,9);
Node::removeNode(node,0);
bool is... | ALGO | 0.997925 | 3.987927 |
0cce5a26-fad7-4cd0-aa83-90344850a377 | Arvika001/leetcodepython | 1460-number-of-substrings-containing-all-three-characters/1460-number-of-substrings-containing-all-three-characters.cpp | class Solution {
public:
int numberOfSubstrings(string s) {
int d[3] = {-1, -1, -1};
int ans = 0;
for (int i = 0; i < s.size(); ++i) {
d[s[i] - 'a'] = i;
ans += min(d[0], min(d[1], d[2])) + 1;
}
return ans;
}
};
| ALGO | 0.999972 | 5.553498 |
6c88ac2e-1d4e-4129-813a-dbba2f392495 | Buday96/Tugas-Tugas | QueueUAS.cpp | #include <iostream>
#include <queue>
using namespace std;
class Queue {
private:
queue<int> q;
public:
void enqueue(int customerNumber) {
q.push(customerNumber);
}
void dequeue() {
if (!q.empty()) {
cout << "Pelanggan dengan nomor antrian " << q.front() << " sedang dilaya... | TOOL | 0.88821 | 5.450418 |
c9ccb937-571c-4b96-b2dc-29f965cd322f | shikharbhardwaj/algorithm | codechef/jan17/tourist.cpp | #include <algorithm>
#include <iostream>
#include <list>
#include <map>
//#include <prettyprint/prettyprint.hpp>
#include <set>
#include <unordered_map>
std::vector<std::pair<int, int>> in_edges;
struct Graph {
std::unordered_map<int, std::list<int>> adj_list;
std::unordered_map<int, int> in_deg;
int N, E... | ALGO | 0.999996 | 4.072701 |
3192d4e0-664f-4e24-959f-b8c7abbfc9a9 | hkhetawat/SCOREP_Applications | lammps/src/compute_slice.cpp | #include "compute_slice.h"
#include <mpi.h>
#include <cstdlib>
#include <cstring>
#include "update.h"
#include "modify.h"
#include "fix.h"
#include "input.h"
#include "variable.h"
#include "memory.h"
#include "error.h"
#include "force.h"
using namespace LAMMPS_NS;
enum{COMPUTE,FIX,VARIABLE};
#define INVOKED_VECTOR 2... | ALGO | 0.976843 | 4.688708 |
48bbef73-bbdb-408e-9a07-a29b900e2912 | Satyam-79/Cpp | Learning/XpppY.cpp | using namespace std;
#include <iostream>
int main()
{
int x = 10, y = 20, r;
r = x++ + y;
cout << "\n x = " << x << " y = " << y << "\nResult = " << r;
return 0;
}
| ALGO | 0.997433 | 4.453275 |
a8501dac-5546-4d36-a851-ab81e91a6c9d | Edmig1/Desafios | tabuada.cpp | #include <iostream>
using namespace std;
main(){
setlocale(LC_ALL, "Portuguese");
int numero, qnt;
cout<< "Informe o nmero para a tabuada";
cin>> numero;
cout<< "informe at qual numero";
cin>> qnt;
for (int x = 0; x <= qnt; x++){
cout<< numero << " x " << x << "=" << numero * x << endl;
}
}
| ALGO | 0.887484 | 4.20284 |
ec10ed89-b5df-4a3d-a906-ef6cb27509db | sinian666/codes_86_4 | cpp_副本26/chapter_sorting/merge_sort.cpp | /**
* File: merge_sort.cpp
* Created Time: 2022-11-25
* Author: Krahets (<EMAIL>)
*/
#include "../utils/common.hpp"
/* 合并左子数组和右子数组 */
// 左子数组区间 [left, mid]
// 右子数组区间 [mid + 1, right]
void merge(vector<int> &nums, int left, int mid, int right) {
// 初始化辅助数组
vector<int> tmp(nums.begin() + left, nums.begin() ... | ALGO | 0.999979 | 5.830924 |
e1fea471-5b6c-42fe-a5b2-0b871147a5c9 | tompoek/traffic-simulation | traffic-multi-lanes/SimulateTrafficMultiLanes.cpp | #include <iostream>
#include <vector>
#include <chrono>
#include "utils.h"
int COUNT_LANE_CHANGE = 0; // for profiling number of successful lane changes
int main(int argc, char** argv) {
// Measure runtime
std::chrono::high_resolution_clock::time_point start_clock; // used by all timers
auto microsecs_al... | TEST | 0.871608 | 4.888279 |
b6b13fef-6d5f-436a-9626-b60881504d09 | Alienso/Rhythm | source/sound/filter/LpFilter.cpp | //
// Created by Alienson on 13.8.2024..
//
#include <complex>
#include "LpFilter.h"
int16_t LpFilter::process(int16_t input){
float output = input * a0 + z1;
z1 = input * a1 + z2 - b1 * output;
z2 = input * a2 + z3 - b2 * output;
z3 = input * a3 - b3 * output;
p0 = p1; p1 = p2; p2 = input;
re... | ALGO | 0.995117 | 3.70189 |
31450996-3c86-4cdb-87f2-449b9ab266e5 | Rovinota/Codeforces-Solutions | Codeforces Random Problem(800-1000)/B. Xenia and Ringroad.cpp | #include <bits/stdc++.h>
using namespace std;
int main () {
int n, m;
cin >> n >> m;
long long int ans = 0;
int temp = 1;
for (int i = 1; i <= m; i++) {
int num;
cin >> num;
if (temp <= num) {
ans += num - temp;
temp = num;
}
else {
ans += (num - 1) + (n - temp) + 1;
... | ALGO | 0.999954 | 3.057717 |
b72a7c3b-9cd4-4c26-aa7c-3e1e75c23b44 | Thulio-Carvalho/Advanced-Algorithms-Problems | Old/Final/G.cpp | #include <bits/stdc++.h>
using namespace std;
int N, H;
int main() {
scanf("%d %d", &N, &H);
double constant = H / sqrt(N);
for (int i = 0; i < N - 1; i++) {
if (i == N - 2) {
printf("%.12f", constant * sqrt(i + 1));
} else {
printf("%.12f ", constant * sqrt(i + 1));
}
} printf("\n")... | ALGO | 0.999613 | 3.190998 |
0dda3c55-5471-4a1f-a1ec-3554e76d9a58 | anchal8219/DSA | daily_probs/ibm_ak.cpp | #include <bits/stdc++.h>
using namespace std;
int getMaximumMEX(vector<int>& arr) {
// Remove duplicates
sort(arr.begin(), arr.end());
arr.erase(unique(arr.begin(), arr.end()), arr.end());
// Sort the array
sort(arr.begin(), arr.end());
// Find MEX
int mex = 0;
for (int num :... | ALGO | 0.999608 | 5.283769 |
751b1e6d-d726-4b4c-839e-822add0768d1 | MaSteve/UVA-problems | UVA10368.cpp | #include <iostream>
using namespace std;
typedef long long ll;
typedef pair<int, int> ii;
int gcd(ll n, ll m) {
ll auxi;
if (m > n) {
auxi = n;
n = m, m = auxi;
}
if (n % m == 0) return 0;
int val = gcd(m, n%m);
if (n / m == 1) {
val = 1 - val;
} else val = 0;
r... | ALGO | 0.999882 | 3.467183 |
ce4067d7-576a-4b03-91f0-9fa135b63693 | NullAwe/competitive-programming | cses/sorting-and-searching/DistinctNumbers.cpp | #include <bits/stdc++.h>
using namespace std;
int main() {
int n; cin >> n;
set<int> s;
for (int i = 0; i < n; ++i) {
int a; cin >> a;
s.insert(a);
}
// Output:
cout << s.size() << endl;
return 0;
}
| ALGO | 0.998926 | 4.348037 |
485e90fd-77ff-42f9-9774-5791897bb7e4 | Logandros/Flava335WotLK | dep/g3dlite/source/Matrix.cpp | /**
@file Matrix.cpp
@author Morgan McGuire, http://graphics.cs.williams.edu
*/
#include "G3D/Matrix.h"
#include "G3D/TextOutput.h"
static inline G3D::Matrix::T negate(G3D::Matrix::T x) {
return -x;
}
namespace G3D {
int Matrix::debugNumCopyOps = 0;
int Matrix::debugNumAllocOps = 0;
void Matrix::serialize(T... | TOOL | 0.960669 | 7.754732 |
0248a03e-21cd-4361-a84b-bcc8e9009e02 | show-me-code/implement_MLP_with_Eigen | eigen-3.3.8/doc/examples/TutorialLinAlgSelfAdjointEigenSolver.cpp | #include <iostream>
#include <Eigen/Dense>
using namespace std;
using namespace Eigen;
int main()
{
Matrix2f A;
A << 1, 2, 2, 3;
cout << "Here is the matrix A:\n" << A << endl;
SelfAdjointEigenSolver<Matrix2f> eigensolver(A);
if (eigensolver.info() != Success) abort();
cout << "The eigenvalues of A ... | ALGO | 0.999435 | 3.846247 |
ca2dd96d-e05a-4f7a-b9a8-aa8db79a6a7a | DamianVu/EECS560 | Vu_Lab02/main.cpp | // EECS 560 Lab 02
//
// Author: Damian Vu
// Hash table with separate chaining (Open Hashing)
//
// This program uses an array of linked lists in order to create
// a hash table that uses open hashing.
//
// This program receives initial data from "data.txt".
// This data must first include the initial size of the tab... | ALGO | 0.968218 | 4.928099 |
fac8e14d-703a-43e6-849d-21a0ce86fc63 | yixiang0706/cpe | uva-11286.cpp | #include<iostream>
#include<map>
#include<string>
#include<algorithm>
using namespace std;
int main() {
int cases;
while (cin >> cases && cases != 0) {
map<string, int> Map;
for (size_t i = 0; i < cases; i++) {
string temp[5];
string line;
for (size_t j = 0; j < 5; j++) {
cin >> temp[j];
}
sor... | ALGO | 0.999652 | 3.946146 |
7908dc33-af09-4752-b7d0-cebec8d16b00 | dimgatz98/coding_challenges | hackerrank/max_min/max_min.cpp | #include <bits/stdc++.h>
using namespace std;
string ltrim(const string &);
string rtrim(const string &);
/*
* Complete the 'maxMin' function below.
*
* The function is expected to return an INTEGER.
* The function accepts following parameters:
* 1. INTEGER k
* 2. INTEGER_ARRAY arr
*/
void printVect (vecto... | ALGO | 0.999569 | 4.770522 |
928cc858-c4c3-44c5-8514-0ba81fa95806 | sc-martel93/Three-Band-EQ | Source/PluginProcessor.cpp | /*
==============================================================================
This file contains the basic framework code for a JUCE plugin processor.
==============================================================================
*/
#include "PluginProcessor.h"
#include "PluginEditor.h"
//==============... | TOOL | 0.886268 | 5.569545 |
ed82008d-e4af-4239-9e17-d0fa1e75123f | sureshpodeti/codechef-problems | PALIN1.cpp |
#include<iostream>
#include<vector>
typedef long long int LLI;
using namespace std;
int main(){
LLI T;
cin >> T;
string st;
while(T--){
cin >> st;
int N = st.length();
int A[N];
for(int i=0;i<N;++i) A[i] = st[i]-'0';
int ... | ALGO | 0.999826 | 4.025712 |
6e722185-bec3-4ba4-93ce-4dde663bdeaa | ladeng07/libcxx-scripts | libcxx/test/std/containers/associative/map/map.modifiers/insert_initializer_list.pass.cpp | // UNSUPPORTED: c++98, c++03
// <map>
// class map
// void insert(initializer_list<value_type> il);
#include <map>
#include <cassert>
#include "min_allocator.h"
int main()
{
{
typedef std::pair<const int, double> V;
std::map<int, double> m =
{
... | TEST | 0.90178 | 5.842242 |
9cd3353f-78da-45d9-8058-d2e9c9e9cda6 | 07Ramesh/oopcg | prac8_pattern.CPP | //draw pattern
#include <iostream>
#include <stdlib.h>
#include <graphics.h>
#include<math.h>
using namespace std;
class Line
{
public:
void dda(int x1,int y1,int x2,int y2)
{
float x,y,dx,dy,length,xincr,yincr;
int i;
dx = abs(x2-x1);
dy = abs(y2-y1);
if(dx>dy)
{length = dx;}
else
{length... | ALGO | 0.997179 | 3.629145 |
536c5f2f-0840-41e9-a76e-5dd28bd3fa09 | yqqinn/_Computer_Graphics | 杨钦_20201060117/work_5/work_5.1.cpp | #include <windows.h>
#include <GL/glut.h>
#include <stdio.h>
#include <stdlib.h>
class screenPt
{
private:
GLint x, y;
public:
screenPt()
{
x = y = 0;
}
void setCoords(GLint xCoordValue, GLint yCoordValue)
{
x = xCoordValue;
y = yCoordValue;
}
GLint getx() const
{
return x;
}
GLint gety() const
{
... | TOOL | 0.994716 | 4.614015 |
9e5706c7-08a0-4cc3-8dbd-9d682f74f10f | sanjoypaul-git/data-structure-algorithm | String/largest-odd-number-in-string-leetcode-1903.cpp | /*
Title - 1903. Largest Odd Number in String
Link - https://leetcode.com/problems/largest-odd-number-in-string/description/
Author - Sanjoy Paul
Approach - Greedy, Math
*/
#include <iostream>
using namespace std;
string largestOddNumber(string num) {
int n = num.size();
if ((num[n-1] - 48) & 1) return... | ALGO | 0.999579 | 5.650521 |
16a940fb-d3d4-4c54-bb2c-678331c96884 | kerrylinux/ports | games/CaribbeanStud/files/patch-Deck.cpp | --- ./Deck.cpp.orig 2013-10-29 15:12:13.000000000 -0200
+++ ./Deck.cpp 2013-10-29 15:12:13.000000000 -0200
@@ -38,7 +38,8 @@
_globalCards[j] = Card(j);
_globalInit = 1;
}
- for(int i =0 ; i < _numOfCards; i++)
+ int i;
+ for(i =0 ; i < _numOfCards; i++)
_cards[i] = & _globalCards[i];
for(i=_numOf... | ALGO | 0.945119 | 4.318034 |
731ec5f4-05b0-4cb6-ad63-90a71ecf5b3b | 113bommy/deepmind_codecontests_refine | cpp_source_filter_file/cpp_train_10910_46.cpp | #include <bits/stdc++.h>
using namespace std;
int main() {
int n, a, b;
cin >> n >> a >> b;
cout << min(a, n * b) << endl;
}
| ALGO | 0.999372 | 3.597499 |
1610ee87-ff55-4be2-bc1f-067ae7393043 | ishandutta2007/codeforces | jaroslavurban/normal/1307/C.cpp | #define _USE_MATH_DEFINES
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
signed main(){
cin.tie(0)->sync_with_stdio(0);
string s;cin>>s;
int n=s.size();
vector<int>v(n);
for(int i=0;i<n;++i)v[i]=s[i]-'a';
vector<vector<ll>>cnts(26,vector<ll>(26));
vector<vector<int>... | ALGO | 0.999947 | 3.788447 |
81f6f0c8-01ca-46f9-8a32-b34fec7c7aeb | Lab1R531/gadget_test | 5G/lib/phy/upper/channel_coding/polar/polar_decoder_impl.cpp | #include "polar_decoder_impl.h"
#include "srsran/srsvec/binary.h"
#include "srsran/srsvec/zero.h"
using namespace srsran;
/// \brief Polar decoder function \f$f\f$.
///
/// Vectorial form of the soft xor operation.
static void
vec_function_f(span<log_likelihood_ratio> z, span<const log_likelihood_ratio> x, span<const... | ALGO | 0.988425 | 6.688261 |
9719ed21-67be-4ee8-b2aa-e360bade2c9c | manikanta2901/ubuntu | .history/codingChallenges/cpp/Google/CodeJam/ReverseSort_20210327150642.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.999875 | 3.771442 |
be90835b-5cb8-41c0-be14-d8210b1bd69b | jeezburger/codechef | CANDIVIDE.cpp | #include <iostream>
using namespace std;
int main() {
// your code goes here
int N,T;
cin >> T;
while (T--)
{
cin >> N;
if(N%3 == 0)
{
cout << "yes\n";
}
else
{
cout << "no\n";
}
}
return 0;
}
| ALGO | 0.999157 | 4.105498 |
dfa52f4f-5d0b-439a-9874-b03e29c1cf54 | boostorg/contract | example/n1962/sqrt.cpp | //[n1962_sqrt
#include <boost/contract.hpp>
#include <cmath>
#include <cassert>
long lsqrt(long x) {
long result;
boost::contract::check c = boost::contract::function()
.precondition([&] {
BOOST_CONTRACT_ASSERT(x >= 0);
})
.postcondition([&] {
BOOST_CONTRACT_ASSE... | ALGO | 0.992347 | 5.304882 |
99229034-a484-4896-918c-215d957101ae | SunguckLee/MariaDB-PageCompression | storage/ndb/src/kernel/blocks/dbtux/DbtuxStat.cpp | #define DBTUX_STAT_CPP
#include "Dbtux.hpp"
void
Dbtux::execREAD_PSEUDO_REQ(Signal* signal)
{
jamEntry();
ScanOpPtr scanPtr;
scanPtr.i = signal->theData[0];
c_scanOpPool.getPtr(scanPtr);
if (signal->theData[1] == AttributeHeader::RECORDS_IN_RANGE) {
jam();
statRecordsInRange(scanPtr, &signal->theData... | ALGO | 0.906836 | 5.353337 |
673d6bf7-251e-4175-8042-eb5535ca24d7 | sl1pperq/StringEasy | 10_itc_equal_reverse.cpp | #include <string>
#include "str_easy.h"
using namespace std;
bool itc_equal_reverse(string str) {
int len = itc_len(str);
for (int i = 0; i < len / 2; i++) {
if (str[i] != str[len - i - 1]) {
return false;
}
}
return true;
} | ALGO | 0.980056 | 5.159326 |
01a9004e-3c5d-466d-be26-3a420951eb6c | czc13611858691/stm32f103_example | Drivers/CMSIS/NN/Examples/ARM/arm_nn_examples/gru/arm_nnexamples_gru.cpp | /**
* @ingroup groupExamples
*/
/**
* @defgroup GRUExample Gated Recurrent Unit Example
*
* \par Description:
* \par
* Demonstrates a gated recurrent unit (GRU) example with the use of fully-connected,
* Tanh/Sigmoid activation functions.
*
* \par Model definition:
* \par
* GRU is a type of recurrent neura... | ALGO | 0.914648 | 7.471897 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.