id
stringlengths
9
111
java
stringlengths
188
2.04k
python
stringlengths
40
1.94k
cpp
stringlengths
65
1.25k
java_test
stringlengths
532
56.4k
python_test
stringlengths
348
57.4k
cpp_test
stringlengths
328
4.71k
MAXIMUM_SUBARRAY_SUM_USING_PREFIX_SUM
import java.util. *; import java.util.stream.*; import java.lang.*; import javafx.util.Pair; public class MAXIMUM_SUBARRAY_SUM_USING_PREFIX_SUM{ static int f_gold ( int arr [ ] , int n ) { int min_prefix_sum = 0 ; int res = Integer . MIN_VALUE ; int prefix_sum [ ] = new int [ n ] ; prefix_sum [ 0 ] = arr [ 0 ]...
import math def f_gold ( arr , n ) : min_prefix_sum = 0 res = - math.inf prefix_sum = [ ] prefix_sum.append ( arr [ 0 ] ) for i in range ( 1 , n ) : prefix_sum.append ( prefix_sum [ i - 1 ] + arr [ i ] ) for i in range ( n ) : res = max ( res , prefix_sum [ i ] - min_prefix_sum ...
using namespace std; int f_gold ( int arr [ ], int n ) { int min_prefix_sum = 0; int res = numeric_limits < int > :: min ( ); int prefix_sum [ n ]; prefix_sum [ 0 ] = arr [ 0 ]; for ( int i = 1; i < n; i ++ ) prefix_sum [ i ] = prefix_sum [ i - 1 ] + arr [ i ]; for ( int i = 0; i < n; i ++ ) { ...
public static void main(String args[]) { int n_success = 0; List<int [ ]> param0 = new ArrayList<>(); param0.add(new int[]{8,9,11,17,18,19,23,24,27,30,31,31,35,44,46,47,49,51,55,58,59,61,65,67,71,71,71,71,78,78,82,91,98}); param0.add(new int[]{-82,-28,-66,-52,-36,36,-88,52,-62,46,42,26,-60,18,-52,38,94...
if __name__ == '__main__': param = [ ([8, 9, 11, 17, 18, 19, 23, 24, 27, 30, 31, 31, 35, 44, 46, 47, 49, 51, 55, 58, 59, 61, 65, 67, 71, 71, 71, 71, 78, 78, 82, 91, 98],20,), ([-82, -28, -66, -52, -36, 36, -88, 52, -62, 46, 42, 26, -60, 18, -52, 38, 94, -68, 44, -94, 14, 36, -70],15,), ([0, 0, 0, 0, 0,...
int main() { int n_success = 0; vector<vector<int>> param0 {{8,9,11,17,18,19,23,24,27,30,31,31,35,44,46,47,49,51,55,58,59,61,65,67,71,71,71,71,78,78,82,91,98},{-82,-28,-66,-52,-36,36,-88,52,-62,46,42,26,-60,18,-52,38,94,-68,44,-94,14,36,-70},{0,0,0,0,0,0,0,0,0,0,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1},{28,36,42,4...
COUNT_INDEX_PAIRS_EQUAL_ELEMENTS_ARRAY_1
import java.util. *; import java.util.stream.*; import java.lang.*; import javafx.util.Pair; public class COUNT_INDEX_PAIRS_EQUAL_ELEMENTS_ARRAY_1{ public static int f_gold ( int arr [ ] , int n ) { HashMap < Integer , Integer > hm = new HashMap < > ( ) ; for ( int i = 0 ; i < n ; i ++ ) { if ( hm . contai...
def f_gold ( arr , n ) : mp = dict ( ) for i in range ( n ) : if arr [ i ] in mp.keys ( ) : mp [ arr [ i ] ] += 1 else : mp [ arr [ i ] ] = 1 ans = 0 for it in mp : count = mp [ it ] ans += ( count * ( count - 1 ) ) // 2 return ans
using namespace std; int f_gold ( int arr [ ], int n ) { unordered_map < int, int > mp; for ( int i = 0; i < n; i ++ ) mp [ arr [ i ] ] ++; int ans = 0; for ( auto it = mp . begin ( ); it != mp . end ( ); it ++ ) { int count = it -> second; ans += ( count * ( count - 1 ) ) / 2; } return ans...
public static void main(String args[]) { int n_success = 0; List<int [ ]> param0 = new ArrayList<>(); param0.add(new int[]{5,11,18,22,40,46,50,51,53,55,64,67,73,78,86}); param0.add(new int[]{14,-98,98,58,-82,90,-80,-56,-30,-36,-56,-30,-58,68,72,-76,38,-90,-72,4,-32,32,-28,2,12,-72,54,2,0,-74,8,12,46,72...
if __name__ == '__main__': param = [ ([5, 11, 18, 22, 40, 46, 50, 51, 53, 55, 64, 67, 73, 78, 86],14,), ([14, -98, 98, 58, -82, 90, -80, -56, -30, -36, -56, -30, -58, 68, 72, -76, 38, -90, -72, 4, -32, 32, -28, 2, 12, -72, 54, 2, 0, -74, 8, 12, 46, 72, -84, -66, 70, 18, 26, 72, -26, 44, -8, 20, -32, -56, 2...
int main() { int n_success = 0; vector<vector<int>> param0 {{5,11,18,22,40,46,50,51,53,55,64,67,73,78,86},{14,-98,98,58,-82,90,-80,-56,-30,-36,-56,-30,-58,68,72,-76,38,-90,-72,4,-32,32,-28,2,12,-72,54,2,0,-74,8,12,46,72,-84,-66,70,18,26,72,-26,44,-8,20,-32,-56,28},{0,0,0,0,0,0,0,0,0,0,0,1,1,1,1,1,1,1,1,1},{93,...
HOW_TO_COMPUTE_MOD_OF_A_BIG_NUMBER
import java.util. *; import java.util.stream.*; import java.lang.*; import javafx.util.Pair; public class HOW_TO_COMPUTE_MOD_OF_A_BIG_NUMBER{ static int f_gold ( String num , int a ) { int res = 0 ; for ( int i = 0 ; i < num . length ( ) ; i ++ ) res = ( res * 10 + ( int ) num . charAt ( i ) - '0' ) % a ; re...
null
using namespace std; int f_gold ( string num, int a ) { int res = 0; for ( int i = 0; i < num . length ( ); i ++ ) res = ( res * 10 + ( int ) num [ i ] - '0' ) % a; return res; }
public static void main(String args[]) { int n_success = 0; List<String> param0 = new ArrayList<>(); param0.add("RElCP"); param0.add("0139035510"); param0.add("00011110"); param0.add("TwanZWwLNXhFN"); param0.add("6247009752778"); param0.add("0100001011011"); param0.add("NCh"); p...
null
int main() { int n_success = 0; vector<string> param0 {"RElCP","0139035510","00011110","TwanZWwLNXhFN","6247009752778","0100001011011","NCh","00714746542","101000100","MSTkXmlbPkV"}; vector<int> param1 {13,44,86,66,55,33,75,54,93,78}; for(int i = 0; i < param0.size(); ++i) { if(f_filled(par...
LARGEST_SUBARRAY_WITH_EQUAL_NUMBER_OF_0S_AND_1S
import java.util. *; import java.util.stream.*; import java.lang.*; import javafx.util.Pair; public class LARGEST_SUBARRAY_WITH_EQUAL_NUMBER_OF_0S_AND_1S{ static int f_gold ( int arr [ ] , int n ) { int sum = 0 ; int maxsize = - 1 , startindex = 0 ; int endindex = 0 ; for ( int i = 0 ; i < n - 1 ; i ++ ) {...
def f_gold(arr, n): sum = 0 maxsize = - 1 for i in range(0, n - 1): sum = - 1 if (arr[i] == 0) else 1 for j in range(i + 1, n): sum = sum + (- 1) if (arr[j] == 0) else sum + 1 if (sum == 0 and maxsize < j - i + 1): maxsize = j - i + 1 s...
using namespace std; int f_gold ( int arr [ ], int n ) { int sum = 0; int maxsize = - 1, startindex; for ( int i = 0; i < n - 1; i ++ ) { sum = ( arr [ i ] == 0 ) ? - 1 : 1; for ( int j = i + 1; j < n; j ++ ) { ( arr [ j ] == 0 ) ? ( sum += - 1 ) : ( sum += 1 ); if ( sum == 0 && m...
public static void main(String args[]) { int n_success = 0; List<int [ ]> param0 = new ArrayList<>(); param0.add(new int[]{56,8,67,35,19,82,81,66,10,24,82,2,42,48,18,63,48,74,60,64,64,95,95,20,95,55,63,96,54}); param0.add(new int[]{78,67,1,78,48,83,17,19,21,44,99,68,16,54,9}); param0.add(new int[]{...
if __name__ == '__main__': param = [ ([56, 8, 67, 35, 19, 82, 81, 66, 10, 24, 82, 2, 42, 48, 18, 63, 48, 74, 60, 64, 64, 95, 95, 20, 95, 55, 63, 96, 54], 26,), ([78, 67, 1, 78, 48, 83, 17, 19, 21, 44, 99, 68, 16, 54, 9], 8,), ([3, 69, 97, 21, 12, 67, 45, 53, 77, 70, 26, 43], 9,), ...
int main() { int n_success = 0; vector<vector<int>> param0 {{56,8,67,35,19,82,81,66,10,24,82,2,42,48,18,63,48,74,60,64,64,95,95,20,95,55,63,96,54},{78,67,1,78,48,83,17,19,21,44,99,68,16,54,9},{3,69,97,21,12,67,45,53,77,70,26,43},{21,80,29,22,77,64,42,4,71,75,62,27,30,36,66,37,49,97},{18,66,9,90,21,95,74,48,44,...
COUNT_PAIRS_DIFFERENCE_EQUAL_K_1
import java.util. *; import java.util.stream.*; import java.lang.*; import javafx.util.Pair; public class COUNT_PAIRS_DIFFERENCE_EQUAL_K_1{ static int f_gold ( int arr [ ] , int n , int k ) { int count = 0 ; Arrays . sort ( arr ) ; int l = 0 ; int r = 0 ; while ( r < n ) { if ( arr [ r ] - arr [ l ] == k...
def f_gold ( arr , n , k ) : count = 0 arr.sort ( ) l = 0 r = 0 while r < n : if arr [ r ] - arr [ l ] == k : count += 1 l += 1 r += 1 elif arr [ r ] - arr [ l ] > k : l += 1 else : r += 1 return count
using namespace std; int f_gold ( int arr [ ], int n, int k ) { int count = 0; sort ( arr, arr + n ); int l = 0; int r = 0; while ( r < n ) { if ( arr [ r ] - arr [ l ] == k ) { count ++; l ++; r ++; } else if ( arr [ r ] - arr [ l ] > k ) l ++; else r ++; } return count...
public static void main(String args[]) { int n_success = 0; List<int [ ]> param0 = new ArrayList<>(); param0.add(new int[]{5,5,10,19,29,32,40,60,65,70,72,89,92}); param0.add(new int[]{-38,40,8,64,-38,56,4,8,84,60,-48,-78,-82,-88,-30,58,-58,62,-52,-98,24,22,14,68,-74,48,-56,-72,-90,26,-10,58,40,36,-80,6...
if __name__ == '__main__': param = [ ([5, 5, 10, 19, 29, 32, 40, 60, 65, 70, 72, 89, 92],7,12,), ([-38, 40, 8, 64, -38, 56, 4, 8, 84, 60, -48, -78, -82, -88, -30, 58, -58, 62, -52, -98, 24, 22, 14, 68, -74, 48, -56, -72, -90, 26, -10, 58, 40, 36, -80, 68, 58, -74, -46, -62, -12, 74, -58],24,36,), ([0, ...
int main() { int n_success = 0; vector<vector<int>> param0 {{5,5,10,19,29,32,40,60,65,70,72,89,92},{-38,40,8,64,-38,56,4,8,84,60,-48,-78,-82,-88,-30,58,-58,62,-52,-98,24,22,14,68,-74,48,-56,-72,-90,26,-10,58,40,36,-80,68,58,-74,-46,-62,-12,74,-58},{0,0,1},{16,80,59,29,14,44,13,76,7,65,62,1,34,49,70,96,73,71,42...
COUNT_ROTATIONS_DIVISIBLE_4
import java.util. *; import java.util.stream.*; import java.lang.*; import javafx.util.Pair; public class COUNT_ROTATIONS_DIVISIBLE_4{ static int f_gold ( String n ) { int len = n . length ( ) ; if ( len == 1 ) { int oneDigit = n . charAt ( 0 ) - '0' ; if ( oneDigit % 4 == 0 ) return 1 ; return 0 ; }...
null
using namespace std; int f_gold ( string n ) { int len = n . length ( ); if ( len == 1 ) { int oneDigit = n . at ( 0 ) - '0'; if ( oneDigit % 4 == 0 ) return 1; return 0; } int twoDigit, count = 0; for ( int i = 0; i < ( len - 1 ); i ++ ) { twoDigit = ( n . at ( i ) - '0' ) * 10 + ( n . a...
public static void main(String args[]) { int n_success = 0; List<String> param0 = new ArrayList<>(); param0.add("MRRuQJvxe"); param0.add("87395768"); param0.add("10111100110111"); param0.add("aVDUEfzG"); param0.add("55794792"); param0.add("111010"); param0.add("cndMLMJVmzuH"); p...
null
int main() { int n_success = 0; vector<string> param0 {"MRRuQJvxe","87395768","10111100110111","aVDUEfzG","55794792","111010","cndMLMJVmzuH","487717559382","11110","dRMDPyr"}; for(int i = 0; i < param0.size(); ++i) { if(f_filled(param0[i]) == f_gold(param0[i])) { n_success+=...
DISTRIBUTING_ITEMS_PERSON_CANNOT_TAKE_TWO_ITEMS_TYPE_1
import java.util. *; import java.util.stream.*; import java.lang.*; import javafx.util.Pair; public class DISTRIBUTING_ITEMS_PERSON_CANNOT_TAKE_TWO_ITEMS_TYPE_1{ static boolean f_gold ( int arr [ ] , int n , int k ) { HashMap < Integer , Integer > hash = new HashMap < > ( ) ; for ( int i = 0 ; i < n ; i ++ ) {...
null
using namespace std; bool f_gold ( int arr [ ], int n, int k ) { unordered_map < int, int > hash; for ( int i = 0; i < n; i ++ ) hash [ arr [ i ] ] ++; for ( auto x : hash ) if ( x . second > 2 * k ) return false; return true; }
public static void main(String args[]) { int n_success = 0; List<int [ ]> param0 = new ArrayList<>(); param0.add(new int[]{1,1,2,3,1}); param0.add(new int[]{2,3,3,5,3,3}); param0.add(new int[]{0,0,1,1,1}); param0.add(new int[]{7,60,78,91,80,75,85,21,41,63,1,84,69,13,94,25,54,54,52,68,53,35,17,3...
null
int main() { int n_success = 0; vector<vector<int>> param0 {{1,1,2,3,1},{2,3,3,5,3,3},{0,0,1,1,1},{7,60,78,91,80,75,85,21,41,63,1,84,69,13,94,25,54,54,52,68,53,35,17,37,98,27,2,31},{-96,-94,-82,-80,-78,-66,-36,-24,-18,-12,-2,-2,6,8,10,12,36,38,42,58,64,68,82,84,86,88,94},{0,1,1,1,0,0,0,0,1,0,0,0,1,0,0,1,1,1,1,...
MINIMUM_NUMBER_SUBSETS_DISTINCT_ELEMENTS_1
import java.util. *; import java.util.stream.*; import java.lang.*; import javafx.util.Pair; public class MINIMUM_NUMBER_SUBSETS_DISTINCT_ELEMENTS_1{ static int f_gold ( int arr [ ] , int n ) { HashMap < Integer , Integer > mp = new HashMap < > ( ) ; for ( int i = 0 ; i < n ; i ++ ) mp . put ( arr [ i ] , mp ....
null
using namespace std; int f_gold ( int arr [ ], int n ) { unordered_map < int, int > mp; for ( int i = 0; i < n; i ++ ) mp [ arr [ i ] ] ++; int res = 0; for ( auto x : mp ) res = max ( res, x . second ); return res; }
public static void main(String args[]) { int n_success = 0; List<int [ ]> param0 = new ArrayList<>(); param0.add(new int[]{2,6,9,12,15,19,21,23,24,24,25,27,29,35,36,37,41,44,44,47,48,51,56,59,59,59,60,64,64,66,67,68,68,69,73,74,77,78,81,82,83,85,89,94,95,96,98,99}); param0.add(new int[]{96,20,-40,74,-4...
null
int main() { int n_success = 0; vector<vector<int>> param0 {{2,6,9,12,15,19,21,23,24,24,25,27,29,35,36,37,41,44,44,47,48,51,56,59,59,59,60,64,64,66,67,68,68,69,73,74,77,78,81,82,83,85,89,94,95,96,98,99},{96,20,-40,74,-44,98,-24,92,58,-84,-76,-14,64,-2,-84,52,-8,38,-26,-10,-62,-30,-76,58},{0,0,0,0,0,0,0,0,0,0,0...
COUNT_SORTED_ROWS_MATRIX
import java.util. *; import java.util.stream.*; import java.lang.*; import javafx.util.Pair; public class COUNT_SORTED_ROWS_MATRIX{ static int f_gold ( int mat [ ] [ ] , int r , int c ) { int result = 0 ; for ( int i = 0 ; i < r ; i ++ ) { int j ; for ( j = 0 ; j < c - 1 ; j ++ ) if ( mat [ i ]...
def f_gold ( mat , r , c ) : result = 0 for i in range ( r ) : j = 0 for j in range ( c - 1 ) : if mat [ i ] [ j + 1 ] <= mat [ i ] [ j ] : break if j == c - 2 : result += 1 for i in range ( 0 , r ) : j = 0 for j in range ( c - ...
null
public static void main(String args[]) { int n_success = 0; List<int [ ] [ ]> param0 = new ArrayList<>(); param0.add(new int[][]{new int[]{4,12,13,24,25,26,27,35,41,60,69,71,73,78,85,86,95,99},new int[]{1,13,18,25,41,42,44,45,49,49,51,52,59,63,64,67,78,97},new int[]{1,2,11,18,23,26,30,31,41,42,45,71,75,90,...
if __name__ == '__main__': param = [ ([[4, 12, 13, 24, 25, 26, 27, 35, 41, 60, 69, 71, 73, 78, 85, 86, 95, 99], [1, 13, 18, 25, 41, 42, 44, 45, 49, 49, 51, 52, 59, 63, 64, 67, 78, 97], [1, 2, 11, 18, 23, 26, 30, 31, 41, 42, 45, 71, 75, 90, 91, 92, 95, 97], [26, 30, 44, 46, 46, 54, 56, 60, 67, 68, 75, 77, 77, 8...
null
COUNT_SUBSTRINGS_WITH_SAME_FIRST_AND_LAST_CHARACTERS
import java.util. *; import java.util.stream.*; import java.lang.*; import javafx.util.Pair; public class COUNT_SUBSTRINGS_WITH_SAME_FIRST_AND_LAST_CHARACTERS{ static int f_gold ( String s ) { int result = 0 ; int n = s . length ( ) ; for ( int i = 0 ; i < n ; i ++ ) for ( int j = i ; j < n ; j ++ ) if (...
def f_gold ( s ) : result = 0 ; n = len ( s ) ; for i in range ( n ) : for j in range ( i , n ) : if ( s [ i ] == s [ j ] ) : result = result + 1 return result
using namespace std; int f_gold ( string s ) { int result = 0; int n = s . length ( ); for ( int i = 0; i < n; i ++ ) for ( int j = i; j < n; j ++ ) if ( s [ i ] == s [ j ] ) result ++; return result; }
public static void main(String args[]) { int n_success = 0; List<String> param0 = new ArrayList<>(); param0.add("LZIKA"); param0.add("0556979952"); param0.add("110010"); param0.add("kGaYfd"); param0.add("413567670657"); param0.add("01001"); param0.add("EQPuFa"); param0.add("4884...
if __name__ == '__main__': param = [ ('LZIKA',), ('0556979952',), ('110010',), ('kGaYfd',), ('413567670657',), ('01001',), ('EQPuFa',), ('48848378',), ('110',), ('PLehNeP',) ] n_success = 0 for i, parameters_set in enumerate(param): if f_filled(*param...
int main() { int n_success = 0; vector<string> param0 {"LZIKA","0556979952","110010","kGaYfd","413567670657","01001","EQPuFa","48848378","110","PLehNeP"}; for(int i = 0; i < param0.size(); ++i) { if(f_filled(param0[i]) == f_gold(param0[i])) { n_success+=1; } } ...
DIFFERENCE_BETWEEN_HIGHEST_AND_LEAST_FREQUENCIES_IN_AN_ARRAY
import java.util. *; import java.util.stream.*; import java.lang.*; import javafx.util.Pair; public class DIFFERENCE_BETWEEN_HIGHEST_AND_LEAST_FREQUENCIES_IN_AN_ARRAY{ static int f_gold ( int arr [ ] , int n ) { Arrays . sort ( arr ) ; int count = 0 , max_count = 0 , min_count = n ; for ( int i = 0 ; i < ( n -...
def f_gold ( arr , n ) : arr.sort ( ) count = 0 ; max_count = 0 ; min_count = n for i in range ( 0 , ( n - 1 ) ) : if arr [ i ] == arr [ i + 1 ] : count += 1 continue else : max_count = max ( max_count , count ) min_count = min ( min_count , co...
using namespace std; int f_gold ( int arr [ ], int n ) { sort ( arr, arr + n ); int count = 0, max_count = 0, min_count = n; for ( int i = 0; i < ( n - 1 ); i ++ ) { if ( arr [ i ] == arr [ i + 1 ] ) { count += 1; continue; } else { max_count = max ( max_count, count ); mi...
public static void main(String args[]) { int n_success = 0; List<int [ ]> param0 = new ArrayList<>(); param0.add(new int[]{5,15,19,22,28,29,39,46,46,49,51,55,62,69,72,72,72,74,79,92,92,93,95,96}); param0.add(new int[]{-26,-54,92,76,-92,-14,-24,-70,-78,-50,-48,-22,12,2,-34,-60,4,-32,-10,52,-92,-74,18,34...
if __name__ == '__main__': param = [ ([5, 15, 19, 22, 28, 29, 39, 46, 46, 49, 51, 55, 62, 69, 72, 72, 72, 74, 79, 92, 92, 93, 95, 96],15,), ([-26, -54, 92, 76, -92, -14, -24, -70, -78, -50, -48, -22, 12, 2, -34, -60, 4, -32, -10, 52, -92, -74, 18, 34, 6, -66, 42, -10, -6, 56, 92],30,), ([0, 0, 0, 0, 0,...
int main() { int n_success = 0; vector<vector<int>> param0 {{5,15,19,22,28,29,39,46,46,49,51,55,62,69,72,72,72,74,79,92,92,93,95,96},{-26,-54,92,76,-92,-14,-24,-70,-78,-50,-48,-22,12,2,-34,-60,4,-32,-10,52,-92,-74,18,34,6,-66,42,-10,-6,56,92},{0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1...
CHECK_WHETHER_NUMBER_DUCK_NUMBER_NOT
import java.util. *; import java.util.stream.*; import java.lang.*; import javafx.util.Pair; public class CHECK_WHETHER_NUMBER_DUCK_NUMBER_NOT{ static int f_gold ( String num ) { int len = num . length ( ) ; int count_zero = 0 ; char ch ; for ( int i = 1 ; i < len ; i ++ ) { ch = num . charAt ( i ) ; ...
def f_gold ( num ) : l = len ( num ) count_zero = 0 i = 1 while i < l : ch = num [ i ] if ( ch == "0" ) : count_zero = count_zero + 1 i = i + 1 return count_zero
null
public static void main(String args[]) { int n_success = 0; List<String> param0 = new ArrayList<>(); param0.add("HLlQWSphZcIC"); param0.add("080287724"); param0.add("0000100000"); param0.add(" Q"); param0.add("4247040983"); param0.add("00001011101"); param0.add("LbNsnYTHmLbCf"); ...
if __name__ == '__main__': param = [ ('HLlQWSphZcIC',), ('080287724',), ('0000100000',), (' Q',), ('4247040983',), ('00001011101',), ('LbNsnYTHmLbCf',), ('24',), ('110',), ('ie',) ] n_success = 0 for i, parameters_set in enumerate(param): if f_filled(...
null
COUNT_SINGLE_NODE_ISOLATED_SUB_GRAPHS_DISCONNECTED_GRAPH
import java.util. *; import java.util.stream.*; import java.lang.*; import javafx.util.Pair; public class COUNT_SINGLE_NODE_ISOLATED_SUB_GRAPHS_DISCONNECTED_GRAPH{ static int f_gold ( int [ ] graph , int N ) { int count = 0 ; for ( int i = 1 ; i < 7 ; i ++ ) { if ( graph [ i ] == 0 ) count ++ ; } retur...
null
null
public static void main(String args[]) { int n_success = 0; List<int [ ]> param0 = new ArrayList<>(); param0.add(new int[]{18,26,39,43,46,57,63,76,84,88}); param0.add(new int[]{76,-92,-40,48,84,8,28,64,84,-58,40,48,-8,22,84,-14,-32,-66,84,-74,10,50,96,92,-60,70,0,2,16,-26}); param0.add(new int[]{0,...
null
null
AREA_SQUARE_CIRCUMSCRIBED_CIRCLE
import java.util. *; import java.util.stream.*; import java.lang.*; import javafx.util.Pair; public class AREA_SQUARE_CIRCUMSCRIBED_CIRCLE{ static int f_gold ( int r ) { return ( 2 * r * r ) ; }
def f_gold ( r ) : return ( 2 * r * r )
using namespace std; int f_gold ( int r ) { return ( 2 * r * r ); }
public static void main(String args[]) { int n_success = 0; List<Integer> param0 = new ArrayList<>(); param0.add(14); param0.add(78); param0.add(45); param0.add(66); param0.add(18); param0.add(32); param0.add(60); param0.add(16); param0.add(99); param0.add(65); for(i...
if __name__ == '__main__': param = [ (14,), (78,), (45,), (66,), (18,), (32,), (60,), (16,), (99,), (65,) ] n_success = 0 for i, parameters_set in enumerate(param): if f_filled(*parameters_set) == f_gold(*parameters_set): n_success+=1 ...
int main() { int n_success = 0; vector<int> param0 {14,78,45,66,18,32,60,16,99,65}; for(int i = 0; i < param0.size(); ++i) { if(f_filled(param0[i]) == f_gold(param0[i])) { n_success+=1; } } cout << "#Results:" << " " << n_success << ", " << param0.size(); ...
NUMBER_NON_NEGATIVE_INTEGRAL_SOLUTIONS_B_C_N
import java.util. *; import java.util.stream.*; import java.lang.*; import javafx.util.Pair; public class NUMBER_NON_NEGATIVE_INTEGRAL_SOLUTIONS_B_C_N{ static int f_gold ( int n ) { int result = 0 ; for ( int i = 0 ; i <= n ; i ++ ) for ( int j = 0 ; j <= n - i ; j ++ ) for ( int k = 0 ; k <= ( n - i - j...
def f_gold ( n ) : result = 0 for i in range ( n + 1 ) : for j in range ( n + 1 ) : for k in range ( n + 1 ) : if i + j + k == n : result += 1 return result
using namespace std; int f_gold ( int n ) { int result = 0; for ( int i = 0; i <= n; i ++ ) for ( int j = 0; j <= n - i; j ++ ) for ( int k = 0; k <= ( n - i - j ); k ++ ) if ( i + j + k == n ) result ++; return result; }
public static void main(String args[]) { int n_success = 0; List<Integer> param0 = new ArrayList<>(); param0.add(62); param0.add(44); param0.add(37); param0.add(81); param0.add(14); param0.add(20); param0.add(76); param0.add(72); param0.add(96); param0.add(52); for(i...
if __name__ == '__main__': param = [ (62,), (44,), (37,), (81,), (14,), (20,), (76,), (72,), (96,), (52,) ] n_success = 0 for i, parameters_set in enumerate(param): if f_filled(*parameters_set) == f_gold(*parameters_set): n_success+=1 ...
int main() { int n_success = 0; vector<int> param0 {62,44,37,81,14,20,76,72,96,52}; for(int i = 0; i < param0.size(); ++i) { if(f_filled(param0[i]) == f_gold(param0[i])) { n_success+=1; } } cout << "#Results:" << " " << n_success << ", " << param0.size(); ...
CHECK_TWO_GIVEN_CIRCLES_TOUCH_INTERSECT
import java.util. *; import java.util.stream.*; import java.lang.*; import javafx.util.Pair; public class CHECK_TWO_GIVEN_CIRCLES_TOUCH_INTERSECT{ static int f_gold ( int x1 , int y1 , int x2 , int y2 , int r1 , int r2 ) { int distSq = ( x1 - x2 ) * ( x1 - x2 ) + ( y1 - y2 ) * ( y1 - y2 ) ; int radSumSq = ( r1 + r...
def f_gold(x1, y1, x2, y2, r1, r2): distSq = (x1 - x2) * (x1 - x2) + (y1 - y2) * (y1 - y2) radSumSq = (r1 + r2) * (r1 + r2) if (distSq == radSumSq): return 1 elif (distSq > radSumSq): return - 1 else: return 0
using namespace std; int f_gold ( int x1, int y1, int x2, int y2, int r1, int r2 ) { int distSq = ( x1 - x2 ) * ( x1 - x2 ) + ( y1 - y2 ) * ( y1 - y2 ); int radSumSq = ( r1 + r2 ) * ( r1 + r2 ); if ( distSq == radSumSq ) return 1; else if ( distSq > radSumSq ) return - 1; else return 0; }
public static void main(String args[]) { int n_success = 0; List<Integer> param0 = new ArrayList<>(); param0.add(11); param0.add(87); param0.add(51); param0.add(89); param0.add(64); param0.add(57); param0.add(65); param0.add(32); param0.add(73); param0.add(3); List<I...
if __name__ == '__main__': param = [ (11, 36, 62, 64, 50, 4,), (87, 1, 62, 64, 54, 41,), (51, 1, 47, 90, 14, 71,), (89, 67, 9, 52, 94, 21,), (64, 10, 79, 45, 67, 78,), (57, 86, 99, 43, 83, 63,), (65, 90, 42, 82, 77, 32,), (32, 23, 28, 26, 60, 45,), ...
int main() { int n_success = 0; vector<int> param0 {11,87,51,89,64,57,65,32,73,3}; vector<int> param1 {36,1,1,67,10,86,90,23,61,99}; vector<int> param2 {62,62,47,9,79,99,42,28,63,6}; vector<int> param3 {64,64,90,52,45,43,82,26,77,19}; vector<int> param4 {50,54,14,94,67,83,77,60,92,21}; vect...
MINIMUM_NUMBER_PLATFORMS_REQUIRED_RAILWAYBUS_STATION
import java.util. *; import java.util.stream.*; import java.lang.*; import javafx.util.Pair; public class MINIMUM_NUMBER_PLATFORMS_REQUIRED_RAILWAYBUS_STATION{ static int f_gold ( int arr [ ] , int dep [ ] , int n ) { Arrays . sort ( arr ) ; Arrays . sort ( dep ) ; int plat_needed = 1 , result = 1 ; int i = 1 ...
def f_gold ( arr , dep , n ) : arr.sort ( ) dep.sort ( ) plat_needed = 1 result = 1 i = 1 j = 0 while ( i < n and j < n ) : if ( arr [ i ] < dep [ j ] ) : plat_needed += 1 i += 1 if ( plat_needed > result ) : result = plat_needed ...
using namespace std; int f_gold ( int arr [ ], int dep [ ], int n ) { sort ( arr, arr + n ); sort ( dep, dep + n ); int plat_needed = 1, result = 1; int i = 1, j = 0; while ( i < n && j < n ) { if ( arr [ i ] <= dep [ j ] ) { plat_needed ++; i ++; if ( plat_needed > result ) result = pl...
public static void main(String args[]) { int n_success = 0; List<int [ ]> param0 = new ArrayList<>(); param0.add(new int[]{8,24,28,64,75,86,93,95}); param0.add(new int[]{2,-30,-8,-78,58,-42,-94,84,-58,14,78,34,30,6,-18,-92,0,94,-54,58,0,-86,66,86,8,-26,50,16,-30,-68,98,-28,-4,-6}); param0.add(new i...
if __name__ == '__main__': param = [ ([8, 24, 28, 64, 75, 86, 93, 95],[19, 30, 41, 51, 62, 68, 85, 96],6,), ([2, -30, -8, -78, 58, -42, -94, 84, -58, 14, 78, 34, 30, 6, -18, -92, 0, 94, -54, 58, 0, -86, 66, 86, 8, -26, 50, 16, -30, -68, 98, -28, -4, -6],[40, 22, -24, 80, -76, -4, -8, -34, 96, -98, 16, 28, ...
int main() { int n_success = 0; vector<vector<int>> param0 {{8,24,28,64,75,86,93,95},{2,-30,-8,-78,58,-42,-94,84,-58,14,78,34,30,6,-18,-92,0,94,-54,58,0,-86,66,86,8,-26,50,16,-30,-68,98,-28,-4,-6},{0,0,0,0,0,0,1},{51,5,48,61,71,2,4,35,50,76,59,64,81,5,21,95},{-64,-52,44,52,90},{0,0,1,0,1,0,1,1,0,1,1,1,0,1,0,1,...