uuid string | repo_name string | relative_path string | content string | category string | algo_rel_score float64 | quality_score float64 |
|---|---|---|---|---|---|---|
1c3f2129-affa-470a-8621-1a870a100d63 | PackingNut/CSE2020-Projects | CSE2020P/HW2/VectorMainHw2.cpp | // VectorMainHw2.cpp
// KV, Spring 2023
// to be used for HW2
#include <iostream>
#include <fstream>
#include "VectorHw2.h"
using namespace std;
// prototypes
void print_vector(const Vector<int> &);
int main()
{
Vector<int> myvec;
ifstream inp;
inp.open("hw2_input.txt");
int next;
inp >> next;
... | ALGO | 0.941939 | 4.255311 |
472a07f8-0a1a-4349-b26f-ac51892d3f16 | dhairyapandya05/Data-Structures-and-Algorithms | Arrays/P_2257_Count_unguarded_cells_in_a_grid.cpp | // can also be solve recursively through dfs Important:
class Solution {
public:
void markgridasguarded(int i, int j, vector<vector<int>> &grid) {
for (int row = i - 1; row >= 0; row--) {
if (grid[row][j] == 2 or grid[row][j] == 3)
break;
grid[row][j] = -2;
}... | ALGO | 0.999887 | 7.094831 |
1d6e05b5-a9a8-4bda-a1e5-f9c4b6a47c97 | north-h/Match_code | 2023/Codeforces_-_SMU_Autumn_2023_Trial_23/C_String_Reversal.cpp | /*
* ===========================================================================
* Author: north_h
* Time: 2023-10-24 13:32:40
*
* Problem: C. String Reversal
* Contest: Codeforces - SMU Autumn 2023 Trial 23
* URL: https://codeforces.com/group/L9GOcnr1dm/contest/480225/problem/C
* MemoryL: 256 MB
* Tim... | ALGO | 0.999327 | 3.792902 |
6b18e364-b2fc-41ad-bf4a-bea043edec36 | Zuhriddinov-O/state_management | 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 |
30abe716-725a-4c96-9d21-19dea2622857 | ai-nikolaev/repo-cppboost | libs/multiprecision/example/gmp_snips.cpp | #include <boost/multiprecision/gmp.hpp>
#include <boost/math/special_functions/gamma.hpp>
#include <iostream>
void t1()
{
//[mpz_eg
//=#include <boost/multiprecision/gmp.hpp>
using namespace boost::multiprecision;
mpz_int v = 1;
// Do some arithmetic:
for(unsigned i = 1; i <= 1000; ++i)
v *=... | DATA | 0.989858 | 4.239071 |
4cbbef7c-ef9a-46ae-8b33-c1103b6a0b95 | zhangzibao/Hello | Sources/util/NeuralNetwork.cpp | //
// Created by 张自爆 on 2019/5/20.
//
#include <Headers/Util.h>
#include "NeuralNetwork.h"
int NeuralNetwork::getINodes() const {
return iNodes;
}
void NeuralNetwork::setINodes(int iNodes) {
NeuralNetwork::iNodes = iNodes;
}
int NeuralNetwork::getHNodes() const {
return hNodes;
}
void NeuralNetwork::se... | ALGO | 0.986458 | 3.450828 |
5b04fdca-9bbc-48e9-b2f3-05597bae0a22 | Felipefams/competitiveProgramming | codeforces/contests/div4/1669div4/b.cpp | #include <bits/stdc++.h>
using namespace std;
#define PI 3.1415926535897932384626433832795
#define sqr(a) a*a
#define ll long long
#define ld long double
#define sz(x) ((int)x.size())
typedef pair<int,int> pair_int;
int solve(int k){
int arr[k];
for(int i = 0; i < k; i++){
cin >> arr[i];
}
in... | ALGO | 0.999814 | 4.091667 |
c06988f4-6e3b-4893-8d31-9eed9f440fbf | LonglongSang/Life_of_XDU | PTA/test/D.cpp | #include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <vector>
#include <queue>
#include <algorithm>
#include <unordered_map>
#include <map>
#include <set>
#include <unordered_set>
#include <stack>
using namespace std;
#define N 55
int n;
char grid[N][N];
int dir[4][2]={1,0,0,1,-1,0,0,-1};
int getsum(){
... | ALGO | 0.999687 | 3.947932 |
394be3ba-6bd9-469e-91bd-c5cf1216fe1d | ChoutapallyAkshara/Leetcode | 0053-maximum-subarray/0053-maximum-subarray.cpp | class Solution {
public:
int maxSubArray(vector<int>& nums) {
int m = nums.size();
int curr_sum = 0;
int max_sum = INT_MIN;
for(int i=0;i<m;i++){
curr_sum += nums[i];
max_sum = max(max_sum, curr_sum);
if(curr_sum < 0){
curr_sum = 0;
... | ALGO | 0.999974 | 6.363097 |
23b285ac-38ec-4b2d-a015-12153f712fc3 | brushstrokes/cs211 | venus.cs.qc.cuny.edu/~alayev/cs211/Rat.cpp | /* Rat.cpp
*
* Define Rat class
*
* author: Yosef Alayev
*/
#include "Rat.h"
#include <iostream>
using namespace std;
Rat::Rat()
{
num = 0;
denom = 1;
}
Rat::Rat(int n)
{
num = n;
denom = 1;
}
Rat::Rat(int n, int d)
{
num = n;
if (d == 0)
{
cout << "Denominator can not be zero. Termi... | TOOL | 0.958993 | 4.57035 |
7ead53f7-39d6-4768-821c-6f774df60eb9 | vasurk/Prep_DSA | binar_search_2.cpp | #include<iostream>
#include<bits/stdc++.h>
using namespace std;
bool binarysearch(vector <int> v , int i){
int low = 0,high =v.size()-1;
while(low <= high){
int mid = ((high-low)/2)+low;
if(v[mid] == i)
{
return true;
}
if(v[mid] > i){
high = mi... | ALGO | 0.999724 | 4.177251 |
c5b38c3f-44c9-4ed4-869a-11d9b4cee2f1 | evialbert/LeetCode | 2493-divide-nodes-into-the-maximum-number-of-groups/2493-divide-nodes-into-the-maximum-number-of-groups.cpp | class Solution {
public:
int magnificentSets(int n, vector<vector<int>>& edges) {
vector<vector<int>>graph(n+5);
for(auto&e:edges){
graph[e[0]].push_back(e[1]);
graph[e[1]].push_back(e[0]);
}
vector<int>dis(n+5,n+5);
queue<int>q;
vector<int>s(n... | ALGO | 0.999806 | 4.768598 |
55f57298-0a1f-4c5a-97a2-34895899e4cc | jealousMr/minTree | minheap.cpp | #include "minheap.h"
#include"edgenode.h"
MinHeap::MinHeap(int ms)
{
MaxSize = ms;
CurrentSize = 0;
heap = new EdgeNode[MaxSize + 1];
}
MinHeap::~MinHeap()
{
delete[]heap;
}
MinHeap& MinHeap::Insert(EdgeNode& x)
{
if (CurrentSize == MaxSize)
throw"error";
int i = ++Cur... | ALGO | 0.943282 | 4.172516 |
ae40e610-4910-4a8b-9471-ee02645036ea | ishandutta2007/codeforces | 6aren/normal/987/A.cpp | #include<bits/stdc++.h>
using namespace std;
int main() {
ios::sync_with_stdio(false); cin.tie(0); cout.tie(0);
int n;
cin >> n;
string c[n];
for (int i = 0; i < n; i++) {
cin >> c[i];
}
string a[6] = {"purple", "green", "blue", "orange", "red", "yellow"};
string b[6] = {"Power", "Time", "Space", "Soul", "Re... | ALGO | 0.999382 | 3.881383 |
d27e5a67-d8bf-47e0-9533-390d21ccd45d | Pseudo-iitian/DailyCodes | arrayaverage.cpp | #include <bits/stdc++.h>
using namespace std;
int n;
vector<int> a;
double avgRec(int i)
{
if (i == n-1)
return a[i];
if (i == 0)
return ((a[i] + avgRec(i+1))/n);
return (a[i] + avgRec(i+1));
}
int main()
{
cin>>n;
for(int i=0;i<n;i++){
int value;
cin>>value;
a.push_back(value);
}
cout << fixed<<se... | ALGO | 0.997676 | 4.009451 |
99bbe719-417c-4d80-9ed9-a6b2fcc11ccc | mansi1309/GeeksForGeeks | Difficulty: Easy/Array Leaders/array-leaders.cpp | //{ Driver Code Starts
#include <bits/stdc++.h>
using namespace std;
// } Driver Code Ends
class Solution {
// Function to find the leaders in the array.
public:
vector<int> leaders(vector<int>& arr) {
// Code here
vector<int>v;
v.push_back(arr[arr.size()-1]);
for(int i=arr.s... | ALGO | 0.999271 | 6.90503 |
de023a71-0eeb-4ff4-a347-ec231b3ce834 | mtouseeb0008/GFG-LEET-DSA-QUESTION | Non Repeating Character - GFG/non-repeating-character.cpp | //{ Driver Code Starts
#include <bits/stdc++.h>
using namespace std;
// } Driver Code Ends
class Solution
{
public:
//Function to find the first non-repeating character in a string.
char nonrepeatingCharacter(string S)
{
//Your code here
unordered_map<char ,int>mp;
for(auto x:S)
... | ALGO | 0.999647 | 4.985174 |
0276381c-fc04-42ed-9718-c9e356783c4e | jaecayy/Array_code_ | 22.cpp | #include<bits/stdc++.h>
using namespace std;
int main(){
int n=1;
string s1="C";
string s2="B";
string s3="C";
int c1=1;
int c2=2;
int c3=3;
int maxn = 3;
int arr[3]={0};
int x=0;
for(int i=1;i<=n;i++){
if(s1==s2){
int ans = c1+c2;
arr[x] =... | ALGO | 0.999933 | 3.205569 |
9ac17cb9-7644-4180-a894-a25c5ae85a04 | g310v/CompetitiveProgramming | USACO/milkvisits.cpp | #include<bits/stdc++.h>
using namespace std;
#define ll long long
#define pii pair<int, int>
#define f first
#define s second
#define fast_io ios_base::sync_with_stdio(0);cin.tie(0);
#define pb push_back
// usaco
void setIO(string s) {
freopen((s + ".in").c_str(), "r", stdin);
freopen((s + ".out").c_str(), "w... | ALGO | 0.999873 | 4.140767 |
fb570548-55f7-46ce-9fab-a2d99a3bb1c5 | takuyara/Routing-for-truck-n-drone | AdjGet.cpp | //Pionniers du TJ, benissiez-moi par votre Esprits Saints!
#include "AdjGet.h"
#include "pdata.h"
#include <vector>
#include <algorithm>
using pdata::dt;
using pdata::rand;
using pdata::rand01;
std::vector<Solution *> AdjGet1::Get(Solution * s) {
std::vector<Solution *> ss({
this->ApplyRouteAdd(s),
this->ApplyRo... | ALGO | 0.994863 | 3.89658 |
66937b6f-0113-4a59-8fd2-efbd8f98065b | tushar-sharma/algo-toolbox | assgn1/test_fibo.cpp | #include <map>
#include <iostream>
using std::cout;
using std::cin;
#define long long long
const long M = 1000000007; // modulo
map<long, long> F;
int main(int argc, char** argv) {
return 0;
}
| ALGO | 0.987523 | 4.012721 |
b4442883-0f84-4f03-bdfe-d1c2c43d488f | ishandutta2007/codeforces | eddy1021/normal/671/C.cpp | // eddy1021
#include <bits/stdc++.h>
using namespace std;
typedef double D;
typedef long double LD;
typedef long long ll;
typedef long long LL;
typedef pair<int,int> PII;
typedef pair<LL,LL> PLL;
typedef pair<LD,LD> Pt;
typedef tuple<int,int,int> tiii;
typedef tuple<LL,LL,LL> tlll;
#define mod9 1000000009ll
#define mod... | ALGO | 0.999928 | 3.408252 |
538234ee-a7af-405c-9972-d006b99741e7 | ffallrain/lammps_waterbox | src/USER-OMP/npair_half_respa_nsq_newtoff_omp.cpp | #include "npair_half_respa_nsq_newtoff_omp.h"
#include "npair_omp.h"
#include "neighbor.h"
#include "neigh_list.h"
#include "atom.h"
#include "atom_vec.h"
#include "group.h"
#include "molecule.h"
#include "domain.h"
#include "my_page.h"
#include "error.h"
using namespace LAMMPS_NS;
/* --------------------------------... | ALGO | 0.999798 | 5.918417 |
d6c55395-3d02-41ea-8303-8dcb5df3cfa1 | ishandutta2007/codeforces | sdya/normal/8/A.cpp | #include <iostream>
#include <string.h>
#include <cstring>
#include <string>
#include <algorithm>
using namespace std;
char s[110000];
char s1[110];
char s2[110];
bool check(char s[], char s1[], char s2[])
{
int n = strlen(s), n1 = strlen(s1), n2 = strlen(s2);
for (int i = 0; i <= n - n1; i ++)
{
bool have = tr... | ALGO | 0.999955 | 3.611636 |
ae526c06-ee62-4c89-9645-6da41f76b27c | y6602016/CS590 | HW3/CS590_HW03_code/sort.cpp | #include <cstdio>
#include <cstdlib>
#include <iostream>
#include "sort.h"
using namespace std;
/*
* Simple function to check that our sorting algorithm did work
* -> problem, if we find position, where the (i-1)-th element is
* greater than the i-th element.
*/
bool check_sorted(int* A, int l, int r)
{
fo... | ALGO | 0.999182 | 4.536799 |
17535d5f-6a5a-42cc-b4f9-3ebe59231531 | Lanouuu/CPP_piscine | CPP_09/ex01/RPN.cpp | #include "RPN.hpp"
/****************************************************************************/
/* Constructors / Destructors */
/****************************************************************************/
RPN::RPN(void)
{
return ;
}
RPN::RPN(const RPN & src)
{
... | TOOL | 0.987995 | 5.471943 |
86733adb-8ef4-4f30-bf84-d8ad787e7911 | MegaSamuel/practice | leetcode/21.cpp | #include <iostream>
using namespace std;
//Definition for singly-linked list.
struct ListNode {
int val;
ListNode *next;
ListNode() : val(0), next(nullptr) {}
ListNode(int x) : val(x), next(nullptr) {}
ListNode(int x, ListNode *next) : val(x), next(next) {}
};
class Solution {
public:
// печа... | ALGO | 0.999832 | 5.318946 |
cc0bf29f-4c87-4c97-af28-1d5d9612b6e6 | ramancoder123/100-Days-of-DSA | Day21/common.cpp | //{ Driver Code Starts
//Initial Template for C++
#include<bits/stdc++.h>
using namespace std;
// } Driver Code Ends
//Back-end complete function Template for C++
class Solution{
public:
vector<int> common_element(vector<int>v1,vector<int>v2){
vector<int> ans;
sort(v1.begin(), v1.end());... | ALGO | 0.999925 | 5.589112 |
15c97394-8fc3-4371-b2db-ce4ed20f71a0 | Juzdalua/study-cpp-algorithm | Study-Algorithm/ss-14890.cpp | #include <bits/stdc++.h>
using namespace std;
/*
N * N
ĭ
̶ Ǵ θ Ÿ
濡 ĭ ̰ ƾѴ.
θ Ƽ ִ.
̴ 1, ̴ L
δ ĭ , L ӵ ĭ ٴ ؾ Ѵ.
ĭ ĭ ̴ 1̾ Ѵ.
θ ĭ ̴ ƾ ϰ, L ĭ ӵǾ ־ Ѵ.
Ʒ 쿡 θ .
θ θ
ĭ ĭ ̰ 1 ƴ
ĭ ̰ ʰų, L ӵ
θ ٰ
ִ ϴ α
2 N 100
1 L N
ĭ ̴ 10 ۰ų ڿ
*/
int n, l;
int b... | ALGO | 0.999977 | 3.570505 |
a53d5e5b-9915-4a1f-9bf0-347e738e5e68 | Ahmed58Usama2001/LeetcodeTracker | 144-binary-tree-preorder-traversal/binary-tree-preorder-traversal.cpp | /**
* Definition for a binary tree node.
* struct TreeNode {
* int val;
* TreeNode *left;
* TreeNode *right;
* TreeNode() : val(0), left(nullptr), right(nullptr) {}
* TreeNode(int x) : val(x), left(nullptr), right(nullptr) {}
* TreeNode(int x, TreeNode *left, TreeNode *right) : val(x), l... | ALGO | 0.999964 | 6.226119 |
8b49b134-c446-4002-9f7d-c33496f71ba0 | joshuad44/MADProject2 | 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 |
5c5ab835-ecf8-4fef-bc04-cb9469de84e2 | Aniketdhar810/Leetcode-grind | LinkedList/206-reverse-linked-list/reverse-linked-list.cpp | /**
* Definition for singly-linked list.
* struct ListNode {
* int val;
* ListNode *next;
* ListNode() : val(0), next(nullptr) {}
* ListNode(int x) : val(x), next(nullptr) {}
* ListNode(int x, ListNode *next) : val(x), next(next) {}
* };
*/
class Solution {
public:
ListNode* reverseList... | ALGO | 0.999824 | 5.753327 |
3452cedb-c20f-4cb3-80a8-1f6e8b325d6a | sushamanarsale/Data-Structure-and-Algorithm-Assignments-Letsupgrade- | Fabonacci_Series.cpp | // Fabonacci Series
#include<iostream>
using namespace std;
int main()
{
int first=0, second=1, result=0, number;
cout<<"Enter the number: ";
cin>>number;
cout<<"0"<<"\t";
for(int i=1; i<=number; i++)
{
result = first + second;
cout<<result<<"\t";
first = second;
second = result;
}
return 0;
}... | ALGO | 0.999828 | 3.767693 |
183c40f2-c521-404d-8028-01ce8c1a0713 | gnaht1/encapsulation | bai1_8_3.cpp | /*###Begin banned keyword - each of the following line if appear in code will raise error. regex supported
###End banned keyword*/
#include <bits/stdc++.h>
using namespace std;
long long UCLN(long long a, long long b)
{
while (b != 0)
{
auto temp = b;
b = a % b;
a = temp;
}
retu... | ALGO | 0.999846 | 4.662841 |
896c9d1c-dd2e-4d95-a8ba-4dffe95ec7c1 | sash9696/dsa-prac | sorting/sorting2/mergeSort.cpp | #include <iostream>
#include <vector>
using namespace std;
void merge(vector<int> &arr, int low, int mid, int high)
{
vector<int> temp;
// low -> mid
// mod + 1 -> high
int left = low;
int right = mid + 1;
while (left <= mid && right <= high)
{
if (arr[left] <= arr[right])
... | ALGO | 0.999982 | 5.927157 |
e7496cc3-a66f-4f38-9a16-edad4d09aa9b | zxyDEDIRE/ACM_CODE | AtCoder/AtCoder Beginner Contest 287/D.cpp | /*
嵌套变量重复
特殊样例 0 1 2 n
数组越界
开long long
*/
#include<bits/stdc++.h>
using namespace std;
#define endl "\n"
#define pp(x) array<int,x>
using ull=unsigned long long;
using ll=long long;
using pii=pair<int,int>;
const int dx[]={0,0,1,-1,1,-1,1,-1};
const int dy[]={1,-1,0,0,1,-1,-1,1};
const int mod=998244353;
const int ... | ALGO | 0.999983 | 3.712742 |
31f2a9ef-6993-4a78-83f3-c5b38c03cbe0 | AbhirajSinghrajpoot/C-Files | sum of digit for for loop.cpp | #include<iostream>
using namespace std;
int main(){
int n,sum=0;
cout << "\n enter the n value : ";
cin >> n;
for( ;n>0; n = n/10)
sum = sum + n%10;
cout<<"\n sum of digit : "<< sum ;
return 0;
} | ALGO | 0.999776 | 3.595285 |
ef44f66a-f89d-4ba3-b181-63860200941e | 113bommy/deepmind_codecontests_refine | cpp_gold_filter_file/cpp_train_161_5.cpp | #include <bits/stdc++.h>
using namespace std;
string str = "0123456789ABCDEF";
int main() {
map<char, int> mp;
mp['0'] = 1;
mp['1'] = 0;
mp['2'] = 0;
mp['3'] = 0;
mp['4'] = 1;
mp['5'] = 0;
mp['6'] = 1;
mp['7'] = 0;
mp['8'] = 2;
mp['9'] = 1;
mp['A'] = 1;
mp['B'] = 2;
mp['C'] = 0;
mp['D'] = ... | ALGO | 0.999874 | 4.64884 |
04b66280-5d47-4ce5-875e-71b880d9ee20 | gmeks/bat_mm | hl2sdk/strtools.cpp | // These are redefined in the project settings to prevent anyone from using them.
// We in this module are of a higher caste and thus are privileged in their use.
#ifdef strncpy
#undef strncpy
#endif
#ifdef _snprintf
#undef _snprintf
#endif
#if defined( sprintf )
#undef sprintf
#endif
#if defined( vsprintf )
#un... | TOOL | 0.879028 | 5.250006 |
d3d689b5-d551-4638-864d-be873cb0ca0e | pm306/procon | DPコンテスト/EDPC/B.cpp | #include <bits/stdc++.h>
#include <atcoder/all>
using namespace std;
using namespace atcoder;
using ll = long long;
constexpr char ln = '\n';
constexpr long long INF = 1LL<<60;
constexpr double EPS = 1e-9;
#define all(v) v.begin(), v.end()
#define rep(i, n) for(int i=0;i<(n);i++)
#define rept(i, j, n) for(int i=(j); i... | ALGO | 0.999888 | 4.496399 |
d88791c2-5a55-4fbd-84b2-cfa44d75db06 | ThaiAn301223/quiz | 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.998733 | 6.76775 |
6d5dceea-02de-4789-b12d-729b1a4dc7d9 | thilio/Competitive-Programming | OJ/Codeforces/1523D - Love-Hate.cpp | #include "bits/stdc++.h"
using namespace std;
#define pb push_back
#define mp make_pair
#define fst first
#define snd second
#define fr(i,n) for(long long int i=0;i<n;i++)
#define frr(i,n) for(long long int i=1;i<=n;i++)
#define ms(x,i) memset(x,i,sizeof(x))
#define dbg(x) cout << #x << " = " << x << endl
#define a... | ALGO | 0.999831 | 3.806956 |
7a3b6797-d301-4700-9689-d047867375be | gyeongseo0504/C-programming | 7장 예제문제/20230423_26/20230423_26/main.cpp | #define _CRT_SECURE_NO_WARNINGS
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
int main(void)
{
int i,years;
double total, rate, investment;
printf(":");
scanf("%lf", &investment);
printf("(%%):");
scanf("%lf", &rate);
printf("Ⱓ():");
scanf("%d", &years);
printf("=========================\n");
pr... | ALGO | 0.985314 | 3.189882 |
4650749a-fe19-47a0-bd0c-08c4d2a8d67e | Baichenjia/Leetcode_train | pro11/pro11/源.cpp | #include <iostream>
#include <vector>
#include <cmath>
#include <algorithm>
#include <map>
using namespace std;
class Solution {
public:
int maxArea(vector<int>& height) {
vector<pair<int, int>> point;
for(int i = 0;i < height.size();i++){ //
point.push_back(pair<int, int>(height[i], i));
}
sort(point.... | ALGO | 0.99984 | 4.617372 |
91878127-e0fd-44ab-848b-d1c2d753c32e | BunnyWarlock/My_CompetitiveProgramming_Library | Algorithms/Miscellaneous/Inclusion Exclusion.cpp | // Author: Sahil Yasar
// Tested here:
// https://toph.co/p/towers-of-doom
#include <iostream>
#include <algorithm>
using namespace std;
#define endl '\n'
int main(){
ios_base::sync_with_stdio(false);
cin.tie(NULL);
cin.exceptions(cin.failbit);
int t, n, s, i, j, mask, lcm, temp, ans, loop = 1;
c... | ALGO | 0.999918 | 3.487088 |
0666247b-35fe-4cbf-835a-db37ab39d00f | anant-pushkar/competetive_programming_codes | cpp/Rewards/main.cpp | /*
Project name : Rewards
Created on : Thu Jul 17 19:32:04 2014
Author : Anant Pushkar
http://codeforces.com/contest/448/problem/0
*/
#include<iostream>
#include<cstring>
#include<cstdio>
#include<deque>
#include<queue>
#include<utility>
#include<vector>
#include<climits>
#include<algorithm>
#include<stack>
using names... | ALGO | 0.999653 | 3.283572 |
54424718-e657-4014-8f55-ad9b380647a5 | Sourav-Sharma-OG/Data-Structure-and-Algorithms | Strings/TransformOneStringToAnotherUsingMInGivenOperations.cpp | /*
Given two strings A and B, the task is to convert A to B if possible. The only operation allowed is to put any character from A and insert it at front. Find if it’s possible to convert the string. If yes, then output minimum no. of operations required for transformation.
Examples:
Input: A = "ABD", B = "BAD"
Out... | ALGO | 0.999994 | 5.892924 |
e9f8613f-1d01-4e5e-b612-4b680058db8a | jaehyeonha/Study_Algorithm_SWM-practice- | suin/week3/1987.cpp | #include<iostream>
#include<stack>
using namespace std;
int R, C;
int ar[21][21];
int alpha[27];
int dir[4][2] = {{0,1},{0,-1},{1,0},{-1,0}};
int result = 0;
void dfs(int r, int c, int score){
if(score > result){
result = score;
}
for(int i=0; i<4; i++){
int next_r = r+dir[i][0];
... | ALGO | 0.999015 | 3.830958 |
f536e844-6e4c-430c-9a01-86f5479d78a6 | SonuRajput1010/DSA_GFG | Medium/Kth Ancestor in a Tree/kth-ancestor-in-a-tree.cpp | //{ Driver Code Starts
#include <bits/stdc++.h>
using namespace std;
struct Node
{
int data;
struct Node *left;
struct Node *right;
};
Node* newNode(int val)
{
Node* temp = new Node;
temp->data = val;
temp->left = NULL;
temp->right = NULL;
return temp;
}
Node* buildTree(string str)... | ALGO | 0.999902 | 5.857865 |
eb713c52-7e52-4b7a-98af-7d120074681d | Trietptm-on-Coding-Algorithms/online-judge | codeforces/629/a.cpp | #include <iostream>
using namespace std;
int main() {
int N;
cin >> N;
char grid[102][102];
long long ans = 0LL;
for (int i = 0; i < N; ++i) {
cin >> grid[i];
int count = 0;
for (int j = 0; j < N; ++j) {
if (grid[i][j] == 'C')
++count;
}... | ALGO | 0.999682 | 4.72997 |
35f4b054-f24c-4794-bc5c-1677d03c367a | nordicolympiad/nordic-olympiad-2017 | yule/submissions/enum_bs.cpp | #include <bits/stdc++.h>
using namespace std;
template <class T> int size(const T &x) { return x.size(); }
#define rep(i,a,b) for (__typeof(a) i=(a); i<(b); ++i)
#define iter(it,c) for (__typeof((c).begin()) it = (c).begin(); it != (c).end(); ++it)
typedef pair<int, int> ii;
typedef vector<int> vi;
typedef vector<ii> v... | ALGO | 0.999918 | 4.040465 |
36ab4cba-0fee-420a-8e59-1b4619f784d1 | lycheeje11y/btree | USACO_Bronze_Theory/Logic_Building/Combinations/MultipleStructures.cpp | #include <iostream>
#include <vector>
using namespace std;
int main() {
int N;
cin >> N;
vector<int> arr1;
vector<int> arr2;
vector<int> arr3;
for (int j = 0; j < N; j++) {
int input;
cin >> input;
arr1.push_back(input);
}
for (int j = 0; j < N; j++) {
int input;
cin >> input;
... | ALGO | 0.999721 | 3.771619 |
9f9a1d3e-fa9d-46e2-9afc-d058974a97ea | CodeHuTuTu/algorithm_1 | 02-Sorting-Basic/Course Code (C++)/01-Selection-Sort/main.cpp | #include <iostream>
#include <algorithm>
using namespace std;
void selectionSort(int arr[], int n){
for(int i = 0 ; i < n ; i ++){
// 寻找[i, n)区间里的最小值
int minIndex = i;
for( int j = i + 1 ; j < n ; j ++ )
if( arr[j] < arr[minIndex] )
minIndex = j;
swap(... | ALGO | 0.999807 | 4.191627 |
181e046e-e372-4fe6-85a6-41a062083083 | santi3223/PreseleccionIOI | vjudge/obligatorios/Semana 4 feb a 10feb/J - Nastia_and_a_Good_Array.cpp | #include <bits/stdc++.h>
using namespace std;
#define ll long long
#define vl vector<ll>
#define vs vector<string>
#define vb vector<bool>
#define vc vector<char>
#define ull unsigned long long
#define pll pair<ll, ll>
#define pb push_back
#define fi first
#define se second
#define ff(i, p, x) for(ll i = p; i < x; i++)... | ALGO | 0.99935 | 3.256037 |
6bee6f48-9693-4018-8705-8774723b1df6 | Arom1a/competitive-programming | cses/number_spiral.cpp | // https://cses.fi/problemset/task/1071
#include "bits/stdc++.h"
typedef long long ll;
using namespace std;
template <typename T>
void print_vector(const vector<T> &my_vec) {
for (const T &i : my_vec)
cout << i << ' ';
cout << endl;
}
int main() {
int t;
cin >> t;
while (t--) {
l... | ALGO | 0.999857 | 4.896406 |
1aff0e1f-9277-45ee-9c6d-0e657eaa5ee2 | jap18021/cse3150 | lab1/non_prefix_sum.cpp | #include "prefix_sum.h"
#include <iostream>
bool non_negative_prefix(int ary[], int length) {
bool non_negative = true;
int sum = 0;
for (int index = 0; index < length; index++) {
sum += ary[index];
if (sum < 0) {
non_negative = false;
break;
}
}
... | ALGO | 0.995773 | 5.642839 |
ff4b581d-b6de-460f-a9ca-6dbbcaffb182 | 7xxxx/CryptographicAlgorithms | src/Public-Key/RSAOracle.cpp | /*
* RSAOracle.cpp
*/
#include "RSAOracle.h"
#include "PublicKeyAlgorithmBox.h"
using namespace std;
RSAOracle::RSAOracle(Integer& p, Integer& q, Integer& d) {
this->n = p.Times(q);
this->d = d;
}
RSAOracle::~RSAOracle() {
}
// #half()
bool RSAOracle::half(const Integer& y) const {
PublicKeyAlgorithm... | ALGO | 0.993297 | 6.120526 |
9375e7de-f270-493e-bd79-a5b9d54fb327 | Akshat-Ajmera/LeetCode_Solutions | 3235-minimum-cost-to-convert-string-i/minimum-cost-to-convert-string-i.cpp | class Solution {
public:
long long minimumCost(string source, string target, vector<char>& original, vector<char>& changed, vector<int>& cost) {
long long n = source.size(), m = original.size();
vector<vector<long long>> d(26, vector<long long> (26, LONG_MAX));
for(int i=0; i<26; i++) {
... | ALGO | 0.999981 | 5.901939 |
65fa24e5-5c04-4b11-a94c-5ecf785dc576 | kasa021/atcoder-archives | typical90/typical90_b_29391543_CE.cpp | /*
* Author: kAsA02
* Submission URL: https://atcoder.jp/contests/typical90/submissions/29391543
* Submitted at: 2022-02-17 14:36:24
* Problem URL: https://atcoder.jp/contests/typical90/tasks/typical90_b
* Result: CE
* Execution Time: None ms
*/
#include <iostream>
#include <string>
using namespace std;
bool h... | ALGO | 0.999941 | 4.588453 |
21adf3b4-6a72-487f-bf3b-f4b3c74414c4 | SokolMurturi121/BuildABridge | Tools and Middleware Bridge/octet-master/octet/open_source/bullet/BulletDynamics/ConstraintSolver/btFixedConstraint.cpp | #include "btFixedConstraint.h"
#include "BulletDynamics/Dynamics/btRigidBody.h"
#include "LinearMath/btTransformUtil.h"
#include <new>
btFixedConstraint::btFixedConstraint(btRigidBody& rbA,btRigidBody& rbB, const btTransform& frameInA,const btTransform& frameInB)
:btTypedConstraint(FIXED_CONSTRAINT_TYPE,rbA,rbB)
{
m_... | TOOL | 0.854765 | 6.306868 |
27774068-3cb3-4adc-af15-4edae3465fad | petkokp/m1-high-performance-computing | lab/lab1/solutions/calcul-pi.cpp | #include <chrono>
#include <iostream>
#include "omp.h"
inline double f(double x)
{
return (4 / (1 + x * x));
}
int main()
{
int i;
const int N = 100000000;
double pi = 0.0;
double s = 1.0 / N;
// Compute pi sequentially
auto start = std::chrono::high_resolution_clock::now();
for (i =... | ALGO | 0.99996 | 6.311245 |
c017febd-ee52-49fa-ab9e-e945c3cc5195 | DevJSter/dsa | Interview_DS_Algo/Greedy/Boats to Save People.cpp | /*
MY YOUTUBE VIDEO ON THIS Qn : https://www.youtube.com/watch?v=UsQzOL6r0HY
Company Tags : Google
Leetcode Link : https://leetcode.com/problems/boats-to-save-people/
*/
class Solution {
public:
int numRescueBoats(vector<int>& people, int limit) {
int n = people.s... | ALGO | 0.999987 | 6.181938 |
c10b6b2a-fd43-4b22-9d22-743000c0e0ad | yyamada12/atCoder | arihon/168.cpp | #include <iostream>
#include <iomanip>
#include <vector>
#include <set>
#include <map>
#include <queue>
#include <deque>
#include <algorithm>
#include <cmath>
#include <cstring>
using namespace std;
#define REP(i,n) for(int i = 0; i < n; i++)
#define RREP(i,n) for(int i = n - 1; i >= 0; i--)
#define ALL(v) v.begin()... | ALGO | 0.999767 | 3.574852 |
166066dc-b038-4695-85b3-73477c79136d | odon8411/iOSDev | arm/opencore-amr-0.1.3/opencore/codecs_v2/audio/gsm_amr/amr_nb/enc/src/cor_h.cpp | /*
------------------------------------------------------------------------------
Filename: cor_h.cpp
------------------------------------------------------------------------------
*/
/*----------------------------------------------------------------------------
; INCLUDES
------------------------------------------... | ALGO | 0.999933 | 4.598617 |
e7d22b26-29df-4e17-b686-8f92aed70df7 | mortie/llvm-axa-backend | llvm/utils/TableGen/X86EVEX2VEXTablesEmitter.cpp | #include "CodeGenTarget.h"
#include "llvm/TableGen/Error.h"
#include "llvm/TableGen/TableGenBackend.h"
using namespace llvm;
namespace {
class X86EVEX2VEXTablesEmitter {
RecordKeeper &Records;
CodeGenTarget Target;
// Hold all non-masked & non-broadcasted EVEX encoded instructions
std::vector<const CodeGenI... | TOOL | 0.859282 | 7.677205 |
3728246c-f32d-4cd9-b9f3-4afaee4a627e | JesusCRIS90/Simple_MathExpression_Evaluator | sources/SimpleMathExpression.cpp | #include "SimpleMathExpression.hpp"
SimpleMathExpression::SimpleMathExpression( std::string expression )
{
this->original = expression;
}
SimpleMathExpression::~SimpleMathExpression()
{
}
std::string SimpleMathExpression::ConvertExpression()
{
BuildTokensInExpression( );
ProcessTokens();
return st... | TOOL | 0.936316 | 4.352478 |
0f01d76a-e9ac-4b58-820c-8614fe329c5b | candemarin/Algoritmos-y-Estructura-de-Datos-2 | taller1/Recordatorios.cpp | #include <iostream>
#include <list>
using namespace std;
using uint = unsigned int;
// Pre: 0 <= mes < 12
uint dias_en_mes(uint mes) {
uint dias[] = {
// ene, feb, mar, abr, may, jun
31, 28, 31, 30, 31, 30,
// jul, ago, sep, oct, nov, dic
31, 31, 30, 31, 30, 31
};
return d... | TOOL | 0.892292 | 4.692669 |
32e01048-f2ba-4199-aeaa-126a8674944d | Selflocking/Code | jobs/tencent/2024-03-21/3.cpp | #include <iostream>
#include <vector>
using namespace std;
const int mxN = 1e5 + 1;
vector<vector<int>> G(mxN);
bool st[mxN];
void dfs(int x, int &num) {
st[x] = true;
num++;
for (auto j : G[x]) {
if (st[j]) continue;
dfs(j, num);
}
}
int main() {
int n, m;
cin >> n >> m;
... | ALGO | 0.999049 | 4.615418 |
18ccf932-3f5d-4281-b6b1-3c2a01d179cc | dldkddkd/Competitive-Programming | Junyoung/기본유형/히스토그램.cpp | #include <cstdio>
#include <algorithm>
using namespace std;
typedef long long ll;
const int MAX_N = 100000+1;
int N;
int h[MAX_N+1];
int seg[4*MAX_N];
void seg_init(int nd, int s, int e) {
if (s == e) {
//
seg[nd] = s;
return;
}
int m = (s+e)/2;
int l = nd*2;
int r = nd*2 + 1;
seg_init(l, s, m);
seg_... | ALGO | 0.999554 | 4.040186 |
2f84532a-8abf-4772-adb7-884048e2275d | devdeepsarkar/C---Programs | ProblemsOnArray/2sumProblem.cpp | /*
Given an array of integers nums and an integer target, return indices of the two numbers such that they add up to target.
You may assume that each input would have exactly one solution, and you may not use the same element twice.
You can return the answer in any order.
*/
#include <bits/stdc++.h>
using namespace... | ALGO | 0.999989 | 5.454194 |
f6456052-befe-4e3b-8087-093fa887d295 | Erick-Andrade/Treinamento-Maratona-UFU | 001_String/d.cpp | #include <bits/stdc++.h>
using namespace std;
#define ll long long
#define endl '\n'
#define f first
#define s second
#define pb push_back
#define _ ios_base::sync_with_stdio(0); cin.tie(0);
const int MAX = 1e6+10;
const int IINF = INT_MAX;
const int INF = 0x3f3f3f3f;
const ll lINF = 0x3f3f3f3f3f3f3f3fll;
int ma... | ALGO | 0.999976 | 5.059372 |
12b73a29-b987-45cd-a699-6fee117390ce | roushan-raj/Codes | VS Code Cpp/DP_Aditya_Verma/1_0-1_KnapsackProblems_&_Its_6_Variations/V5_CountNoofSubsetWithGivenDiff.cpp | #include<iostream>
#include<bits/stdc++.h>
using namespace std;
int countSubsetSum(int arr [], int sum, int n){
int dp [n+1][sum+1];
for(int j=0; j<sum+1; j++){
dp[0][j] = 0;
}
for(int i=0; i<n+1; i++){
dp[i][0] = 1;
}
for(int i=1; i<n+1; i++){
for(int j=1; j<sum+1; j+... | ALGO | 0.999918 | 4.399053 |
77e1f23b-e43c-4e10-8491-473d92798e32 | swarali15/SDESheetChallenge | Rotate.cpp | class Solution {
public:
void swap(int &a, int &b )
{
int temp = a;
a= b;
b = temp;
}
void rotate(vector<vector<int>>& matrix)
{
int m= matrix.size();
for(int i=0 ; i<m; i++)
{
for(int j=0 ; j<i ;j++)
{
swap(mat... | ALGO | 0.999997 | 6.24796 |
27e53bc9-1b16-4cd3-8c54-06c6288e350a | PyroFlareX/Vinegar | Libraries/bullet3/Extras/VHACD/src/vhacdICHull.cpp | #include "vhacdICHull.h"
#include <limits>
namespace VHACD
{
const double ICHull::sc_eps = 1.0e-15;
const int ICHull::sc_dummyIndex = std::numeric_limits<int>::max();
ICHull::ICHull()
{
m_isFlat = false;
}
bool ICHull::AddPoints(const Vec3<double>* points, size_t nPoints)
{
if (!points)
{
return false;
}
Circula... | ALGO | 0.996332 | 4.707275 |
f77469fd-fc8b-487a-b78b-000bcec5b316 | IceEmperor4944/GAT315-Physics | src/spring.cpp | #include "spring.h"
#include "body.h"
#include "raymath.h"
void Spring::ApplyForce(float kMultiplier) {
// Step 1: Calculate direction vector from bodyB to bodyA
Vector2 direction = bodyA->position - bodyB->position;
float lengthSquared = Vector2LengthSqr(direction);
// Avoid division by zero or tiny spring lengt... | ALGO | 0.989018 | 5.567358 |
9415e583-620a-4902-8427-dce1d4c5e01e | borglab/gtsam | gtsam/geometry/FundamentalMatrix.cpp | /*
* @file FundamentalMatrix.cpp
* @brief FundamentalMatrix classes
* @author Frank Dellaert
* @date October 2024
*/
#include <gtsam/base/Matrix.h>
#include <gtsam/geometry/FundamentalMatrix.h>
#include <gtsam/geometry/Point2.h>
namespace gtsam {
//***************************************************************... | ALGO | 0.994497 | 6.443024 |
7dadffbe-08ce-4e05-8a65-c45ff5bef48c | Udbhav-Dubey/udcpp | set12.cpp | #include <bits/stdc++.h>
using namespace std;
set <int> s1;
int main (){
s1={1,2,4,2};
cout << s1.size() << endl;
set <int> s2;
cout << s2.size() << endl;
for (auto it : s1 ){
cout << it << " " ;
}
cout << endl;
int sum=0;
while (s1.empty()==0){
sum+=*s1.begin();
... | ALGO | 0.983842 | 3.23176 |
9af61af0-219f-4929-9cfd-0d75c9330c27 | TheAlphaBoy/Leetcode-Questions | 0623-add-one-row-to-tree/0623-add-one-row-to-tree.cpp | /**
* Definition for a binary tree node.
* struct TreeNode {
* int val;
* TreeNode *left;
* TreeNode *right;
* TreeNode() : val(0), left(nullptr), right(nullptr) {}
* TreeNode(int x) : val(x), left(nullptr), right(nullptr) {}
* TreeNode(int x, TreeNode *left, TreeNode *right) : val(x), l... | ALGO | 0.999993 | 6.420976 |
a66af6b1-a6a1-4800-9011-e517fe86c982 | kwonhong/ECE244 | Lab1/convert.cpp | #include <iostream>
using namespace std;
// Conversion constants
#define CtoFRatio 1.80
#define CtoFOffset 32.00
#define CtoKOffset 273.0
// Scale indentifiers
#define DegC 'C'
#define Degc 'c'
#define DegF 'F'
#define Degf 'f'
#define DegK 'K'
#define Degk 'k'
// Conversion function prototypes
// Should be in a ".h... | TOOL | 0.948491 | 5.675908 |
ac1efaac-8876-4e8d-94bd-829a765feddc | SaklainTheSpellbinder/Coding | 1-2/DSA/divideAndConquer/AdjacentInverted.cpp | #include <bits/stdc++.h>
using namespace std;
#define pb push_back
#define ll long long
#define ld long double
#define mp make_pair
#define nl "\n"
#define FAST_IO ios_base::sync_with_stdio(0); cin.tie(0);
int adjacent(string &nums,int si,int ei){
if(si>=ei){
return 0;
}
int mid=si+(ei-si)/2;
... | ALGO | 0.999976 | 4.335211 |
d48b4f3d-8e19-4a0d-bef5-c5f29176fed8 | Piyushodjdj/Love-babar-dsa | Array-2/1.cpp | #include<iostream>
using namespace std;
int main()
{
int arr[3][3];
cout<<"Enter the number";
for(int i=0;i<3;i++)
{
for(int j=0;j<3;j++)
{
cin>>arr[i][j];
}
}
int max=0;
for(int i=0;i<3;i++)
{
for(int j=0;j<3;j++)
{
if(arr[i][j]>max)
{
max=arr[i][j];
}
... | ALGO | 0.999242 | 3.312916 |
53cdb0a5-0e76-4964-a643-b0d245c1b96d | Codecat252/lab_6 | lab_6/lab_6.cpp | #define _CRT_SECURE_NO_WARNINGS
#include <stdio.h>
#include <locale.h>
#include <stdlib.h>
#include <time.h>
void Output_matrix(int** G1, int n) {
for (int i = 0; i < n; i++) { // вывод матрицы
for (int j = 0; j < n; j++) {
printf(" %d", G1[i][j]);
}
printf("\n");
}
... | ALGO | 0.998601 | 3.280709 |
496d5865-ac3a-4560-9ee7-1199c25da5de | mrfirdauss-20/leetcode | Medium/longest-palindrom-subsquence.cpp | #include <bits/stdc++.h>
#include <vector>
using namespace std;
class Solution
{
public:
// int helper(string s, int i, int j);
int longestPalindromeSubseq(string s)
{
int n = s.length();
vector<vector<int>> dp(n, vector<int>(n));
return helper(s, 0, n - 1, dp);
}
int help... | ALGO | 0.999946 | 5.688179 |
c89c330b-8374-4f60-99b8-0f47521c7e9b | VellStraggler/group-joe-and-i | Joes Artillery FIles/uiDraw.cpp | /***********************************************************************
* Source File:
* USER INTERFACE DRAW
* Author:
* Br. Helfrich
* Summary:
* This is the code necessary to draw on the screen. We have a collection
* of procedural functions here because each draw function does not
* retain st... | TOOL | 0.857049 | 5.434121 |
c4c0c075-3479-4080-9b21-1c6f02d35919 | moritzwinger/ckks_lab_module_1- | skeleton/lab.cpp | #include "utils.h"
using namespace std;
using namespace seal;
void ckks_module1();
void ckks_module2();
int main() {
ckks_module1();
ckks_module2();
//TODO: Module 3 & 4
return 0;
}
void ckks_module1() {
cout << "\n\n Module 1: Ciphertext-Plaintext" << endl;
EncryptionParameters parms(scheme_type::ckks)... | ALGO | 0.983448 | 3.51083 |
5a4d795c-c99a-4878-b6b8-f4e21fed32b5 | arunyerram/Fs-Kmit | .history/Coding/D34-P1_20241128223520.cpp | // Given an 2D character array, Letters[][], of size r*c.
// You have to construct the word W, using the given array.
// Rules to construct the word are as follows:
// - All the letters of the word W, should be adjacent to each other
// in the array Letters(either horizontal or vertical).
// - You can use each cha... | ALGO | 0.999229 | 3.008887 |
e2f76d86-17f9-479d-893c-a223ae8173d9 | Altu-Bitu-6/Altu-Bitu-KhilYeonHyeong | 01_정렬_맵_셋/14425.cpp | #include <iostream>
#include <map>
#include <algorithm>
using namespace std;
int main() {
int n, m;
cin >> n >> m;
map<string, int> words;
string s;
for (int i = 0; i < n; i++) {
cin >> s;
words[s] = 1;
}
int cnt = 0;
for (int i = 0; i < m; i++) {
cin >> s;
if (words[s] == 1) cnt++;
}
cout << cnt;
} | ALGO | 0.999845 | 3.814182 |
4c768879-20b1-47f8-ba89-01cbf7884ce4 | Itaxo01/Competitive-Programming | vjudge/Topicos/01/c.cpp | #include <bits/stdc++.h>
using namespace std;
pair<bool, int> pe(map<int, int> cards){
for(int i = 10; i<=13; i++){
if(cards[i]!=0) return {true, i};
}
return {false, -1};
}
pair<bool, int> pb(map<int, int> cards, int p, int g){
for(int i = p; i<=g; i++){
if(cards[i]!=0){
return {true, i};
}
}
return {... | ALGO | 0.999266 | 3.95719 |
4ab261dc-fa3b-4703-aae4-4435b06c6c55 | UIT-Together-2022-Team-Nobita/Recursion-CPP | Bai031-Ngan/Bai031-Ngan.cpp | #include <iostream>
using namespace std;
int TinhAn(int);
int TinhAn(int n)
{
if (n == 1)
return -2;
return 5 * TinhAn(n - 1) + 12;
}
int main()
{
int k;
cout << "Nhap n: ";
cin >> k;
int kq = TinhAn(k);
cout << "Ket qua la: " << kq;
return 1;
} | ALGO | 0.999651 | 3.971779 |
b2605e97-fb18-4d61-a362-03e179b009fd | minnce/codechef | 1200-1400/hiringTest.cpp | #include <iostream>
#include <bits/stdc++.h>
#define ll long long
using namespace std;
void solve()
{
int n,m,x,y;
cin >> n >> m >> x >> y;
for (int i = 0; i < n; i++) {
string dummy;
cin >> dummy;
int solved = 0;
int partial = 0;
for(int j = 0; j < dummy.length(); j... | ALGO | 0.999382 | 3.997562 |
ae67a43f-19b9-49bc-ab31-c524abdb06a6 | itsme3030/codeForces | codeforces/363/C.cpp | #include<bits/stdc++.h>
#include<ext/pb_ds/assoc_container.hpp>
#include<ext/pb_ds/tree_policy.hpp>
#define inf (1LL<<60)
#define prDouble(x) cout << fixed << setprecision(10) << x
using namespace __gnu_pbds;
using namespace std;
#define int long long
typedef tree<int,null_type,less<int>, rb_tree_tag,tree_order_statist... | ALGO | 0.999996 | 4.286339 |
9466cecb-1f22-47a4-9a1b-55bbcd02d201 | bouk/uva | 507/main.cpp | #include <iostream>
using namespace std;
int main()
{
int b;
cin >> b;
for(int t = 1; t <= b; t++)
{
int s;
cin >> s;
int bstart = -1;
int bend;
int best = 0;
int cur = 0;
int curstart = 1;
int i;
for(int pos = 1; pos < s; pos++)
... | ALGO | 0.99874 | 4.08741 |
fcd5ce1d-0f30-4317-91aa-69fbbded1f44 | PootieT/explain-then-translate | CodeGenMirror/data/transcoder_evaluation_gfg_fixed/cpp/AREA_SQUARE_CIRCUMSCRIBED_CIRCLE.cpp | #include <iostream>
#include <cstdlib>
#include <string>
#include <vector>
#include <fstream>
#include <iomanip>
#include <bits/stdc++.h>
using namespace std;
int f_gold ( int r ) {
return ( 2 * r * r );
}
//TOFILL
int main() {
int n_success = 0;
vector<int> param0 {14,78,45,66,18,32,60,16,99,65};
for(i... | TEST | 0.973624 | 4.485169 |
3a503852-62ed-4082-a18c-2211694a5f4a | bahailu-abera/Competitive-programming | heap/find_k_pairs.cpp | class Solution {
public:
vector<vector<int>> kSmallestPairs(vector<int>& nums1, vector<int>& nums2, int k) {
int i = 0, j = 0;
priority_queue<pair<int, pair<int, int> >,
vector<pair<int, pair<int, int> > >,
greater<pair<int, pair<int, int> > > >
pq;
... | ALGO | 0.999994 | 5.866019 |
b09d0a8e-a7d0-4ee3-8c71-028245d88ae0 | ritiesh/Leetcode | Maximum Subarray.cpp | class Solution {
public:
int maxSubArray(vector<int>& nums) {
int sum =0;
int maxt=nums[0];
for(int i=0;i<nums.size();i++)
{
sum+=nums[i];
maxt=max(sum,maxt);
if(sum<0)
{
sum=0;
}
}
... | ALGO | 0.999942 | 5.951215 |
fcdf38c3-83f4-4503-aed2-3d2f2d69b46c | ChaeheunKim/CPP202309 | challenge/midterm/tictactoe.cpp | #include <iostream>
using namespace std;
const int numCell = 3; //
char board[numCell][numCell]{}; // Ÿ 2 迭
bool isValid(int x, int y);
bool checkwin(char currentUser);
int main() {
// ϴ ʿ
int k = 0; // üũϱ
char currentUser = 'X'; // ϱ
int x, y = 0; // ڿ xyǥ Է¹ޱ
// ʱȭ
for ... | ALGO | 0.998509 | 4.38811 |
3f4c9d1a-f9b6-4cae-ad34-ac636ce8cf92 | AntonioND/eigenmathds | core/transpose.cpp | // Transpose tensor indices
#include "stdafx.h"
#include "defs.h"
static void ytranspose(void);
void
eval_transpose(void)
{
push(cadr(p1));
eval();
if (cddr(p1) == symbol(NIL)) {
push_integer(1);
push_integer(2);
} else {
push(caddr(p1));
eval();
push(cadddr(p1));
eval();
}
transpose();
}
void
tran... | ALGO | 0.93939 | 5.818188 |
85fff4cb-7e79-420e-b6c5-c7697b30b4fc | DarlanFranca123/prog_comp | codeforces/1029/d.cpp | #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int MOD = 1e9 + 7;
int main() {
ios::sync_with_stdio(0); cin.tie(0);
int j; cin >> j;
while(j>0){
j--;
int n; cin >> n;
vector<int> nums(n);
for(auto &num:nums) cin >> num;
bool ok = true;
... | ALGO | 0.999925 | 4.038616 |
b82ebd79-0a78-4dd2-aeea-6f65afd6c463 | arifanlgm/Lab-AP-5 | Pertemuan6_IndexDanArray/Tugas/no4.cpp | #include <iostream>
#include <vector>
#include <sstream>
using namespace std;
int main() {
balek:
system("cls");
string inputAngka;
do {
cout << "Masukkan sebuah deretan angka menggunakan vektor\n";
getline(cin, inputAngka);
} while (inputAngka.length() < 1);
stringstream... | ALGO | 0.992951 | 4.315882 |
dddd6ff7-f1cb-487e-8784-b12be7e29a39 | VorakT/earley_parser | earley_parser/EarleyParser.cpp | #include "EarleyParser.h"
#include <iostream>
#include <sstream>
Symbol::Symbol(uint32_t id, bool is_terminal) : id(id), is_terminal(is_terminal) {}
Situation::Situation(uint32_t grammar_id, uint32_t left, uint32_t point_ind) : grammar_id(grammar_id), left(left), point_ind(point_ind) {}
inline std::size_t Situation:... | ALGO | 0.995912 | 5.506831 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.