id stringlengths 9 106 | function_java stringlengths 50 1.9k | d_with_params stringlengths 426 32.8k |
|---|---|---|
COUNT_PAIRS_TWO_SORTED_ARRAYS_WHOSE_SUM_EQUAL_GIVEN_VALUE_X | static int f_filled ( int [ ] arr1 , int [ ] arr2 , int m , int n , int x ) {
int count = 0 ;
for ( int i = 0 ;
i < m ;
i ++ ) for ( int j = 0 ;
j < n ;
j ++ ) if ( ( arr1 [ i ] + arr2 [ j ] ) == x ) count ++ ;
return count ;
} | import std.stdio;
import std.math;
import std.conv;
import std.algorithm;
//TOFILL//
void main(){
int [] results = [0, 5, 0, 0, 0, 0, 0, 0, 0, 0];
int [] [] param0 = [[11, 13, 16, 23, 26, 28, 31, 34, 37, 39, 44, 48, 56, 59, 79, 91, 96, 98], [50, 14, -98, 14, 90, 36, 66, 44, 10, -98, -24, -36, -32, -50], [0, 0... |
COUNT_PAIRS_TWO_SORTED_ARRAYS_WHOSE_SUM_EQUAL_GIVEN_VALUE_X_1 | static int f_filled ( int arr1 [ ] , int arr2 [ ] , int m , int n , int x ) {
int count = 0 ;
HashSet < Integer > us = new HashSet < Integer > ( ) ;
for ( int i = 0 ;
i < m ;
i ++ ) us . add ( arr1 [ i ] ) ;
for ( int j = 0 ;
j < n ;
j ++ ) if ( us . contains ( x - arr2 [ j ] ) ) count ++ ;
return cou... | import std.stdio;
import std.math;
import std.conv;
import std.algorithm;
//TOFILL//
void main(){
int [] results = [2, 0, 0, 0, 0, 0, 0, 0, 0, 2];
int [] [] param0 = [[1, 2, 5, 5, 9, 11, 12, 14, 16, 18, 35, 36, 39, 44, 50, 52, 52, 59, 69, 81, 82, 84, 85, 87, 87, 87, 88, 88, 89, 90, 90, 92, 97], [52, 28, -38, ... |
FIND_MAXIMUM_AVERAGE_SUBARRAY_OF_K_LENGTH | static int f_filled ( int [ ] arr , int n , int k ) {
if ( k > n ) return - 1 ;
int [ ] csum = new int [ n ] ;
csum [ 0 ] = arr [ 0 ] ;
for ( int i = 1 ;
i < n ;
i ++ ) csum [ i ] = csum [ i - 1 ] + arr [ i ] ;
int max_sum = csum [ k - 1 ] , max_end = k - 1 ;
for ( int i = k ;
i < n ;
i ++ ) {
i... | import std.stdio;
import std.math;
import std.conv;
import std.algorithm;
//TOFILL//
void main(){
int [] results = [9, -1, 1, 0, 15, 4, -1, 4, 2, -1];
int [] [] param0 = [[2, 4, 6, 19, 21, 23, 32, 34, 47, 51, 56, 57, 57, 65, 68, 68, 69, 70, 71, 73, 74, 74, 77, 77, 79, 82, 82, 86, 87, 87, 88, 89, 90, 91, 92], ... |
COUNT_PAIRS_WHOSE_PRODUCTS_EXIST_IN_ARRAY | static int f_filled ( int arr [ ] , int n ) {
int result = 0 ;
for ( int i = 0 ;
i < n ;
i ++ ) {
for ( int j = i + 1 ;
j < n ;
j ++ ) {
int product = arr [ i ] * arr [ j ] ;
for ( int k = 0 ;
k < n ;
k ++ ) {
if ( arr [ k ] == product ) {
result ++ ;
... | import std.stdio;
import std.math;
import std.conv;
import std.algorithm;
//TOFILL//
void main(){
int [] results = [0, 6, 946, 18, 15, 153, 0, 0, 496, 0];
int [] [] param0 = [[3, 7, 26, 40, 46, 89, 99], [98, 42, -24, -60, 74, 86, 6, 8, 72, -58, 38, -20, 6, -6, 8, 48, -34, 30, 60, 66, 38, -54, 8, -94, -8, 0, -... |
MAXIMUM_BINOMIAL_COEFFICIENT_TERM_VALUE | static int f_filled ( int n ) {
int [ ] [ ] C = new int [ n + 1 ] [ n + 1 ] ;
for ( int i = 0 ;
i <= n ;
i ++ ) {
for ( int j = 0 ;
j <= Math . min ( i , n ) ;
j ++ ) {
if ( j == 0 || j == i ) C [ i ] [ j ] = 1 ;
else C [ i ] [ j ] = C [ i - 1 ] [ j - 1 ] + C [ i - 1 ] [ j ] ;
}
}
... | import std.stdio;
import std.math;
import std.conv;
import std.algorithm;
//TOFILL//
void main(){
int [] results = [1352078, 10, 252, 352716, 24310, 924, 10400600, 126, 35, 2704156];
int [] param0 = [23, 5, 10, 21, 17, 12, 26, 9, 7, 24];
int n_success = 0;
for (int i = 0; i < param0.length; i++) {
... |
COUNT_PAIRS_WHOSE_PRODUCTS_EXIST_IN_ARRAY_1 | static int f_filled ( int arr [ ] , int n ) {
int result = 0 ;
HashSet < Integer > Hash = new HashSet < > ( ) ;
for ( int i = 0 ;
i < n ;
i ++ ) {
Hash . add ( arr [ i ] ) ;
}
for ( int i = 0 ;
i < n ;
i ++ ) {
for ( int j = i + 1 ;
j < n ;
j ++ ) {
int product = arr [ i ] * arr ... | import std.stdio;
import std.math;
import std.conv;
import std.algorithm;
//TOFILL//
void main(){
int [] results = [0, 0, 36, 0, 2, 861, 9, 0, 66, 0];
int [] [] param0 = [[7, 10, 17, 17, 18, 20, 27, 28, 29, 29, 31, 32, 41, 43, 45, 46, 63, 66, 69, 69, 70, 75, 87, 95], [-60], [0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1... |
FIND_EQUAL_POINT_STRING_BRACKETS | static int f_filled ( String str ) {
int len = str . length ( ) ;
int open [ ] = new int [ len + 1 ] ;
int close [ ] = new int [ len + 1 ] ;
int index = - 1 ;
open [ 0 ] = 0 ;
close [ len ] = 0 ;
if ( str . charAt ( 0 ) == '(' ) open [ 1 ] = 1 ;
if ( str . charAt ( len - 1 ) == ')' ) close [ len - 1 ] =... | import std.stdio;
import std.math;
import std.conv;
import std.algorithm;
//TOFILL//
void main(){
int [] results = [4, 2, 0, 5, 3, 3, 3, 1, 7, 8];
string [] param0 = ["(())))(", "))", "((", "))(()(()()(", ")((()(()", "))(()", "()))", "()", "1100110", "dhfsnebd"];
int n_success = 0;
for (int i = 0; i... |
COUNT_PALINDROME_SUB_STRINGS_STRING | static int f_filled ( char str [ ] , int n ) {
int dp [ ] [ ] = new int [ n ] [ n ] ;
boolean P [ ] [ ] = new boolean [ n ] [ n ] ;
for ( int i = 0 ;
i < n ;
i ++ ) P [ i ] [ i ] = true ;
for ( int i = 0 ;
i < n - 1 ;
i ++ ) {
if ( str [ i ] == str [ i + 1 ] ) {
P [ i ] [ i + 1 ] = true ;
... | import std.stdio;
import std.math;
import std.conv;
import std.algorithm;
//TOFILL//
void main(){
int [] results = [1, 3, 211, 1, 60, 72, 1, 1, 289, 0];
char [] [] param0 = [['e', 'e', 'j', 'p', 't', 'u', 'x', 'y', 'z', 'e', 'f', 'h', 'l', 'm', 'n', 'o', 'z'], ['8', '7', '3', '4', '9', '5', '3', '1', '4', '0'... |
FUNCTION_COPY_STRING_ITERATIVE_RECURSIVE_1 | static String f_filled ( char s1 [ ] , char s2 [ ] , int index ) {
s2 [ index ] = s1 [ index ] ;
if ( index == s1 . length - 1 ) {
return new String(s2);
}
return f_filled ( s1 , s2 , index + 1 ) ;
} | import std.stdio;
import std.math;
import std.conv;
import std.algorithm;
//TOFILL//
void main(){
string [] results = ["v", "86028087054621937", "00000000000000000111111111111111111", "smdawnfhbehmzhcxlareddqvuwokunbkymlhlxhrditay", "00000111222334445555667777788889989999", "11000101100010011000011", "ggjklnqrrsu... |
FIND_INDEX_GIVEN_FIBONACCI_NUMBER_CONSTANT_TIME | static int f_filled ( int n ) {
if ( n <= 1 ) return n ;
int a = 0 , b = 1 , c = 1 ;
int res = 1 ;
while ( c < n ) {
c = a + b ;
res ++ ;
a = b ;
b = c ;
}
return res ;
} | import std.stdio;
import std.math;
import std.conv;
import std.algorithm;
//TOFILL//
void main(){
int [] results = [5, 8, 6, 12, 11, 11, 11, 12, 11, 8];
int [] param0 = [5, 19, 7, 94, 58, 65, 69, 96, 80, 14];
int n_success = 0;
for (int i = 0; i < param0.length; i++) {
if (results[i] == f_fil... |
COUNT_POSSIBLE_DECODINGS_GIVEN_DIGIT_SEQUENCE_1 | static int f_filled ( char digits [ ] , int n ) {
int count [ ] = new int [ n + 1 ] ;
count [ 0 ] = 1 ;
count [ 1 ] = 1 ;
if ( digits [ 0 ] == '0' ) return 0 ;
for ( int i = 2 ;
i <= n ;
i ++ ) {
count [ i ] = 0 ;
if ( digits [ i - 1 ] > '0' ) count [ i ] = count [ i - 1 ] ;
if ( digits [ i - ... | import std.stdio;
import std.math;
import std.conv;
import std.algorithm;
//TOFILL//
void main(){
int [] results = [1, 0, 0, 1, 0, 13, 0, 0, 0, 1];
char [] [] param0 = [['b', 'c', 'e', 'e', 'f', 'f', 'g', 'j', 'k', 'k', 'l', 'l', 'm', 'o', 'o', 'p', 'q', 'r', 'v', 'x', 'z', 'a', 'a', 'a', 'c', 'c', 'c', 'd', ... |
COUNT_POSSIBLE_PATHS_TOP_LEFT_BOTTOM_RIGHT_NXM_MATRIX_2 | static int f_filled ( int m , int n ) {
int [ ] dp = new int [ n ] ;
dp [ 0 ] = 1 ;
for ( int i = 0 ;
i < m ;
i ++ ) {
for ( int j = 1 ;
j < n ;
j ++ ) {
dp [ j ] += dp [ j - 1 ] ;
}
}
return dp [ n - 1 ] ;
} | import std.stdio;
import std.math;
import std.conv;
import std.algorithm;
//TOFILL//
void main(){
int [] results = [1, 465, 847660528, 84672315, 155117520, 84672315, 847660528, 465, 1];
int [] param0 = [1, 3, 11, 12, 16, 21, 31, 30, 50];
int [] param1 = [50, 30, 31, 21, 16, 12, 11, 3, 1];
int n_succe... |
FIND_A_ROTATION_WITH_MAXIMUM_HAMMING_DISTANCE | static int f_filled ( int arr [ ] , int n ) {
int brr [ ] = new int [ 2 * n + 1 ] ;
for ( int i = 0 ;
i < n ;
i ++ ) brr [ i ] = arr [ i ] ;
for ( int i = 0 ;
i < n ;
i ++ ) brr [ n + i ] = arr [ i ] ;
int maxHam = 0 ;
for ( int i = 1 ;
i < n ;
i ++ ) {
int currHam = 0 ;
for ( int j = i , ... | import std.stdio;
import std.math;
import std.conv;
import std.algorithm;
//TOFILL//
void main(){
int [] results = [12, 0, 2, 0, 2, 8, 15, 14, 4, 2];
int [] [] param0 = [[1, 4, 18, 22, 28, 34, 35, 39, 44, 45, 67, 73, 75, 79, 81, 83, 89, 93, 96], [52, -28], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0... |
DETECT_IF_TWO_INTEGERS_HAVE_OPPOSITE_SIGNS | static boolean f_filled ( int x , int y ) {
return ( ( x ^ y ) < 0 ) ;
} | import std.stdio;
import std.math;
import std.conv;
import std.algorithm;
//TOFILL//
void main(){
bool [] results = [true, false, true, true, true, false, false, true, true, false];
int [] param0 = [59, -20, -100, 54, -16, -23, 93, 24, -8, 29];
int [] param1 = [-99, -21, 79, -49, 16, -68, 37, -61, 69, 10]... |
COUNT_SET_BITS_IN_AN_INTEGER | static int f_filled ( int n ) {
int count = 0 ;
while ( n > 0 ) {
count += n & 1 ;
n >>= 1 ;
}
return count ;
} | import std.stdio;
import std.math;
import std.conv;
import std.algorithm;
//TOFILL//
void main(){
int [] results = [4, 4, 3, 3, 2, 3, 4, 3, 1, 3];
int [] param0 = [58, 92, 73, 52, 24, 14, 58, 11, 8, 52];
int n_success = 0;
for (int i = 0; i < param0.length; i++) {
if (results[i] == f_filled(p... |
MAXIMUM_CONSECUTIVE_REPEATING_CHARACTER_STRING | static char f_filled ( String str ) {
int len = str . length ( ) ;
int count = 0 ;
char res = str . charAt ( 0 ) ;
for ( int i = 0 ;
i < len ;
i ++ ) {
int cur_count = 1 ;
for ( int j = i + 1 ;
j < len ;
j ++ ) {
if ( str . charAt ( i ) != str . charAt ( j ) ) break ;
cur_count +... | import std.stdio;
import std.math;
import std.conv;
import std.algorithm;
//TOFILL//
void main(){
char [] results = ['e', '3', '1', 'a', '1', '1', 'w', '1', '1', 'a'];
string [] param0 = ["geeekk", "3786868", "110", "aaaabbcbbb", "11", "011101", "wohnyjylc", "3141711779", "10111101101", "aabbabababcc"];
... |
COUNT_SET_BITS_IN_AN_INTEGER_1 | static int f_filled ( int n ) {
if ( n == 0 ) return 0 ;
else return ( n & 1 ) + f_filled ( n >> 1 ) ;
} | import std.stdio;
import std.math;
import std.conv;
import std.algorithm;
//TOFILL//
void main(){
int [] results = [4, 5, 2, 4, 3, 2, 1, 3, 4, 2];
int [] param0 = [43, 94, 72, 86, 42, 33, 8, 74, 29, 34];
int n_success = 0;
for (int i = 0; i < param0.length; i++) {
if (results[i] == f_filled(p... |
COUNT_SET_BITS_IN_AN_INTEGER_2 | static int f_filled ( int n ) {
int count = 0 ;
while ( n > 0 ) {
n &= ( n - 1 ) ;
count ++ ;
}
return count ;
} | import std.stdio;
import std.math;
import std.conv;
import std.algorithm;
//TOFILL//
void main(){
int [] results = [1, 5, 2, 4, 2, 1, 2, 3, 2, 4];
int [] param0 = [32, 94, 33, 99, 17, 64, 80, 42, 12, 86];
int n_success = 0;
for (int i = 0; i < param0.length; i++) {
if (results[i] == f_filled(... |
C_PROGRAM_FACTORIAL_NUMBER_2 | static int f_filled ( int n ) {
return ( n == 1 || n == 0 ) ? 1 : n * f_filled ( n - 1 ) ;
} | import std.stdio;
import std.math;
import std.conv;
import std.algorithm;
//TOFILL//
void main(){
int [] results = [1, 2, 6, 24, 120, 720, 5040, 40320, 362880, 3628800, 39916800, 479001600];
int [] param0 = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12];
int n_success = 0;
for (int i = 0; i < param0.length... |
COUNT_SET_BITS_IN_AN_INTEGER_3 | static int f_filled ( int n ) {
if ( n == 0 ) return 0 ;
else return 1 + f_filled ( n & ( n - 1 ) ) ;
} | import std.stdio;
import std.math;
import std.conv;
import std.algorithm;
//TOFILL//
void main(){
int [] results = [2, 4, 4, 3, 4, 4, 4, 4, 4, 5];
int [] param0 = [6, 58, 90, 69, 15, 54, 60, 51, 46, 91];
int n_success = 0;
for (int i = 0; i < param0.length; i++) {
if (results[i] == f_filled(p... |
MAXIMUM_NUMBER_CHARACTERS_TWO_CHARACTER_STRING | static int f_filled ( String str ) {
int n = str . length ( ) ;
int res = - 1 ;
for ( int i = 0 ;
i < n - 1 ;
i ++ ) for ( int j = i + 1 ;
j < n ;
j ++ ) if ( str . charAt ( i ) == str . charAt ( j ) ) res = Math . max ( res , Math . abs ( j - i - 1 ) ) ;
return res ;
} | import std.stdio;
import std.math;
import std.conv;
import std.algorithm;
//TOFILL//
void main(){
int [] results = [-1, 2, -1, -1, -1, -1, -1, 10, 0, -1];
string [] param0 = ["ci", "76478", "1", "tr", "10", "01", "rmhzp", "5784080133917", "1100", "ok"];
int n_success = 0;
for (int i = 0; i < param0.... |
FIND_HARMONIC_MEAN_USING_ARITHMETIC_MEAN_GEOMETRIC_MEAN | static double f_filled ( int a , int b ) {
double AM , GM , HM ;
AM = ( a + b ) / 2 ;
GM = Math . sqrt ( a * b ) ;
HM = ( GM * GM ) / AM ;
return HM ;
} | import std.stdio;
import std.math;
import std.conv;
import std.algorithm;
//TOFILL//
void main(){
double [] results = [65.91176470588235, 48.0, 20.43243243243243, 30.72340425531915, 45.555555555555564, 11.375, 40.949999999999996, 19.027027027027028, 88.36363636363636, 23.823529411764707];
int [] param0 = [54,... |
COUNT_STRINGS_ADJACENT_CHARACTERS_DIFFERENCE_ONE | static long f_filled ( int n ) {
long [ ] [ ] dp = new long [ n + 1 ] [ 27 ] ;
for ( int i = 0 ;
i < n + 1 ;
i ++ ) {
for ( int j = 0 ;
j < 27 ;
j ++ ) {
dp [ i ] [ j ] = 0 ;
}
}
for ( int i = 0 ;
i <= 25 ;
i ++ ) {
dp [ 1 ] [ i ] = 1 ;
}
for ( int i = 2 ;
i <= n ;
i ++... | import std.stdio;
import std.math;
import std.conv;
import std.algorithm;
//TOFILL//
void main(){
long [] results = [50, 98, 744, 2896, 22356, 87492, 1344762, 20736556, 81501768, 320481188];
int [] param0 = [2, 3, 6, 8, 11, 13, 17, 21, 23, 25];
int n_success = 0;
for (int i = 0; i < param0.length; i... |
FIND_LAST_DIGIT_FACTORIAL_DIVIDES_FACTORIAL_B | static int f_filled ( long A , long B ) {
int variable = 1 ;
if ( A == B ) return 1 ;
else if ( ( B - A ) >= 5 ) return 0 ;
else {
for ( long i = A + 1 ;
i <= B ;
i ++ ) variable = ( int ) ( variable * ( i % 10 ) ) % 10 ;
return variable % 10 ;
}
} | import std.stdio;
import std.math;
import std.conv;
import std.algorithm;
//TOFILL//
void main(){
int [] results = [0, 1, 0, 0, 0, 1, 0, 1, 1, 1];
long [] param0 = [79, 61, 39, 39, 61, 86, 7, 86, 86, 11];
long [] param1 = [84, 29, 77, 65, 78, 73, 92, 50, 63, 2];
int n_success = 0;
for (int i = 0... |
COUNT_STRINGS_CAN_FORMED_USING_B_C_GIVEN_CONSTRAINTS_1 | static int f_filled ( int n ) {
return 1 + ( n * 2 ) + ( n * ( ( n * n ) - 1 ) / 2 ) ;
} | import std.stdio;
import std.math;
import std.conv;
import std.algorithm;
//TOFILL//
void main(){
int [] results = [83271, 23383, 164359, 389483, 194619, 2073, 340869, 3459, 143848, 157319];
int [] param0 = [55, 36, 69, 92, 73, 16, 88, 19, 66, 68];
int n_success = 0;
for (int i = 0; i < param0.lengt... |
FINDING_POWER_PRIME_NUMBER_P_N_1 | static int f_filled ( int n , int p ) {
int ans = 0 ;
int temp = p ;
while ( temp <= n ) {
ans += n / temp ;
temp = temp * p ;
}
return ans ;
} | import std.stdio;
import std.math;
import std.conv;
import std.algorithm;
//TOFILL//
void main(){
int [] results = [1, 0, 0, 0, 0, 13, 3, 0, 1, 2];
int [] param0 = [76, 77, 9, 59, 8, 97, 78, 41, 72, 71];
int [] param1 = [43, 91, 42, 67, 52, 8, 24, 88, 61, 28];
int n_success = 0;
for (int i = 0; ... |
COUNT_SUBARRAYS_EQUAL_NUMBER_1S_0S | static int f_filled ( int arr [ ] , int n ) {
Map < Integer , Integer > um = new HashMap < > ( ) ;
int curr_sum = 0 ;
for ( int i = 0 ;
i < n ;
i ++ ) {
curr_sum += ( arr [ i ] == 0 ) ? - 1 : arr [ i ] ;
um . put ( curr_sum , um . get ( curr_sum ) == null ? 1 : um . get ( curr_sum ) + 1 ) ;
}
int ... | import std.stdio;
import std.math;
import std.conv;
import std.algorithm;
//TOFILL//
void main(){
int [] results = [0, 1, 3, 0, 0, 1, 0, 2, 0, 0];
int [] [] param0 = [[2, 12, 18, 19, 19, 20, 20, 21, 25, 29, 38, 54, 54, 71, 72, 72, 74, 75, 77, 78, 80, 80, 81, 84, 97, 97], [10, 70, 24, -38, 32, -68, 88, -28, -2... |
GCD_ELEMENTS_GIVEN_RANGE | static int f_filled ( int n , int m ) {
return ( n == m ) ? n : 1 ;
} | import std.stdio;
import std.math;
import std.conv;
import std.algorithm;
//TOFILL//
void main(){
int [] results = [57, 22, 17, 74, 1, 1, 1, 1, 1, 1];
int [] param0 = [57, 22, 17, 74, 93, 56, 5, 5, 9, 98];
int [] param1 = [57, 22, 17, 74, 22, 54, 33, 68, 75, 21];
int n_success = 0;
for (int i = ... |
COUNT_SUBARRAYS_TOTAL_DISTINCT_ELEMENTS_ORIGINAL_ARRAY | static int f_filled ( int arr [ ] , int n ) {
HashMap < Integer , Integer > vis = new HashMap < Integer , Integer > ( ) {
@ Override public Integer get ( Object key ) {
if ( ! containsKey ( key ) ) return 0 ;
return super . get ( key ) ;
}
};
for ( int i = 0 ;
i < n ;
++ i ) vis . put ( ar... | import std.stdio;
import std.math;
import std.conv;
import std.algorithm;
//TOFILL//
void main(){
int [] results = [1, 4, 160, 1, 1, 609, 1, 1, 91, 1];
int [] [] param0 = [[13, 39, 49, 52, 53, 69, 72, 79, 83, 96], [-98, -98, 22, -10, -28, 0, 56, 72, 36, 88, 96, 22, 90, 74, -60, -64, 0, 2, -42, 0, 94, -82, -74... |
COUNT_SUBARRAYS_WITH_SAME_EVEN_AND_ODD_ELEMENTS | static int f_filled ( int [ ] arr , int n ) {
int difference = 0 ;
int ans = 0 ;
int [ ] hash_positive = new int [ n + 1 ] ;
int [ ] hash_negative = new int [ n + 1 ] ;
hash_positive [ 0 ] = 1 ;
for ( int i = 0 ;
i < n ;
i ++ ) {
if ( ( arr [ i ] & 1 ) == 1 ) {
difference ++ ;
}
else {... | import std.stdio;
import std.math;
import std.conv;
import std.algorithm;
//TOFILL//
void main(){
int [] results = [50, 0, 11, 43, 0, 68, 5, 0, 4, 7];
int [] [] param0 = [[7, 8, 12, 13, 14, 19, 20, 22, 28, 30, 31, 31, 32, 34, 34, 39, 39, 43, 45, 46, 47, 62, 63, 63, 65, 66, 69, 69, 71, 76, 79, 82, 83, 88, 89, ... |
MINIMUM_PERIMETER_N_BLOCKS | static long f_filled ( int n ) {
int l = ( int ) Math . sqrt ( n ) ;
int sq = l * l ;
if ( sq == n ) return l * 4 ;
else {
long row = n / l ;
long perimeter = 2 * ( l + row ) ;
if ( n % l != 0 ) perimeter += 2 ;
return perimeter ;
}
} | import std.stdio;
import std.math;
import std.conv;
import std.algorithm;
//TOFILL//
void main(){
long [] results = [28, 36, 30, 28, 38, 34, 24, 18, 34, 34];
int [] param0 = [45, 80, 54, 48, 83, 68, 32, 20, 68, 66];
int n_success = 0;
for (int i = 0; i < param0.length; i++) {
if (results[i] =... |
MAXIMUM_CONSECUTIVE_NUMBERS_PRESENT_ARRAY | static int f_filled ( int arr [ ] , int n ) {
HashSet < Integer > S = new HashSet < Integer > ( ) ;
for ( int i = 0 ;
i < n ;
i ++ ) S . add ( arr [ i ] ) ;
int ans = 0 ;
for ( int i = 0 ;
i < n ;
i ++ ) {
if ( S . contains ( arr [ i ] ) ) {
int j = arr [ i ] ;
while ( S . contains ( j )... | import std.stdio;
import std.math;
import std.conv;
import std.algorithm;
//TOFILL//
void main(){
int [] results = [2, 1, 2, 2, 1, 2, 2, 1, 1, 3];
int [] [] param0 = [[3, 5, 9, 24, 28, 31, 49, 54, 67, 85, 86, 94, 97, 97], [-34, 16, -80, -10, 80, 2, 50, -74, -76, 36, -84, -24, 74, -54, -22, 46, 80, 58, -8, 70,... |
COUNT_SUBSTRINGS_WITH_SAME_FIRST_AND_LAST_CHARACTERS | static int f_filled ( 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 . charAt ( i ) == s . charAt ( j ) ) result ++ ;
return result ;
} | import std.stdio;
import std.math;
import std.conv;
import std.algorithm;
//TOFILL//
void main(){
int [] results = [5, 16, 12, 6, 19, 9, 6, 15, 4, 9];
string [] param0 = ["lzika", "0556979952", "110010", "kgayfd", "413567670657", "01001", "eqpufa", "48848378", "110", "plehnep"];
int n_success = 0;
f... |
LONGEST_SUBARRAY_COUNT_1S_ONE_COUNT_0S | static int f_filled ( int arr [ ] , int n ) {
HashMap < Integer , Integer > um = new HashMap < Integer , Integer > ( ) ;
int sum = 0 , maxLen = 0 ;
for ( int i = 0 ;
i < n ;
i ++ ) {
sum += arr [ i ] == 0 ? - 1 : 1 ;
if ( sum == 1 ) maxLen = i + 1 ;
else if ( ! um . containsKey ( sum ) ) um . put ... | import std.stdio;
import std.math;
import std.conv;
import std.algorithm;
//TOFILL//
void main(){
int [] results = [1, 1, 1, 1, 3, 7, 1, 3, 3, 1];
int [] [] param0 = [[6, 10, 31, 35], [4, 88, -72, 28, -54, 32, -34], [0, 0, 0, 1, 1, 1, 1, 1, 1], [39, 22, 15, 10, 34, 87, 46, 83, 74, 77, 61, 90, 43, 67, 64, 72, ... |
COUNT_SUM_OF_DIGITS_IN_NUMBERS_FROM_1_TO_N | static int f_filled ( int n ) {
if ( n < 10 ) return ( n * ( n + 1 ) / 2 ) ;
int d = ( int ) ( Math . log10 ( n ) ) ;
int a [ ] = new int [ d + 1 ] ;
a [ 0 ] = 0 ;
a [ 1 ] = 45 ;
for ( int i = 2 ;
i <= d ;
i ++ ) a [ i ] = a [ i - 1 ] * 10 + 45 * ( int ) ( Math . ceil ( Math . pow ( 10 , i - 1 ) ) ) ;
... | import std.stdio;
import std.math;
import std.conv;
import std.algorithm;
//TOFILL//
void main(){
int [] results = [165, 865, 540, 667, 525, 168, 667, 177, 609, 240];
int [] param0 = [29, 97, 71, 82, 69, 30, 82, 32, 77, 39];
int n_success = 0;
for (int i = 0; i < param0.length; i++) {
if (res... |
PROGRAM_CALCULATE_VOLUME_ELLIPSOID | static float f_filled ( float r1 , float r2 , float r3 ) {
float pi = ( float ) 3.14 ;
return ( float ) 1.33 * pi * r1 * r2 * r3 ;
} | import std.stdio;
import std.math;
import std.conv;
import std.algorithm;
//TOFILL//
void main(){
float [] results = [522232.74089280004, -283737.6598056, 379381.2427776, -112115.51806000002, 1639671.7048656002, -1938016.9772600005, 306019.63709100004, -238081.08602880003, 192599.16093600003, -1561484.5209600003]... |
COUNT_TOTAL_SET_BITS_IN_ALL_NUMBERS_FROM_1_TO_N | static int f_filled ( int n ) {
int i = 0 ;
int ans = 0 ;
while ( ( 1 << i ) <= n ) {
boolean k = false ;
int change = 1 << i ;
for ( int j = 0 ;
j <= n ;
j ++ ) {
if ( k == true ) ans += 1 ;
else ans += 0 ;
if ( change == 1 ) {
k = ! k ;
change = 1 << i ;
... | import std.stdio;
import std.math;
import std.conv;
import std.algorithm;
//TOFILL//
void main(){
int [] results = [279, 159, 112, 80, 231, 88, 112, 197, 32, 304];
int [] param0 = [90, 56, 43, 31, 77, 35, 43, 66, 15, 95];
int n_success = 0;
for (int i = 0; i < param0.length; i++) {
if (result... |
COUNT_TRAILING_ZEROES_FACTORIAL_NUMBER | static int f_filled ( int n ) {
int count = 0 ;
for ( int i = 5 ;
n / i >= 1 ;
i *= 5 ) count += n / i ;
return count ;
} | import std.stdio;
import std.math;
import std.conv;
import std.algorithm;
//TOFILL//
void main(){
int [] results = [1, 9, 12, 7, 8, 12, 7, 10, 0, 18];
int [] param0 = [9, 43, 50, 32, 37, 51, 33, 49, 1, 75];
int n_success = 0;
for (int i = 0; i < param0.length; i++) {
if (results[i] == f_fille... |
MAXIMUM_TRIPLET_SUM_ARRAY_2 | static int f_filled ( int arr [ ] , int n ) {
int maxA = - 100000000 , maxB = - 100000000 ;
int maxC = - 100000000 ;
for ( int i = 0 ;
i < n ;
i ++ ) {
if ( arr [ i ] > maxA ) {
maxC = maxB ;
maxB = maxA ;
maxA = arr [ i ] ;
}
else if ( arr [ i ] > maxB ) {
maxC = maxB ;
... | import std.stdio;
import std.math;
import std.conv;
import std.algorithm;
//TOFILL//
void main(){
int [] results = [265, -100000026, 3, 218, 52, 3, -99999966, 286, 2, 292];
int [] [] param0 = [[4, 7, 12, 21, 22, 25, 27, 28, 28, 31, 32, 32, 41, 45, 47, 51, 53, 60, 61, 61, 63, 71, 74, 82, 83, 85, 88, 92, 96, 96... |
COUNT_WAYS_BUILD_STREET_GIVEN_CONSTRAINTS | static long f_filled ( int n ) {
long dp [ ] [ ] = new long [ 2 ] [ n + 1 ] ;
dp [ 0 ] [ 1 ] = 1 ;
dp [ 1 ] [ 1 ] = 2 ;
for ( int i = 2 ;
i <= n ;
i ++ ) {
dp [ 0 ] [ i ] = dp [ 0 ] [ i - 1 ] + dp [ 1 ] [ i - 1 ] ;
dp [ 1 ] [ i ] = dp [ 0 ] [ i - 1 ] * 2 + dp [ 1 ] [ i - 1 ] ;
}
return dp [ 0 ] ... | import std.stdio;
import std.math;
import std.conv;
import std.algorithm;
//TOFILL//
void main(){
long [] results = [4478554083, 318281039, 3880899, 114243, 3363, 577, 17, 7];
int [] param0 = [25, 22, 17, 13, 9, 7, 3, 2];
int n_success = 0;
for (int i = 0; i < param0.length; i++) {
if (result... |
NUMBER_INDEXES_EQUAL_ELEMENTS_GIVEN_RANGE | static int f_filled ( int a [ ] , int n , int l , int r ) {
int count = 0 ;
for ( int i = l ;
i < r ;
i ++ ) if ( a [ i ] == a [ i + 1 ] ) count += 1 ;
return count ;
} | import std.stdio;
import std.math;
import std.conv;
import std.algorithm;
//TOFILL//
void main(){
int [] results = [0, 0, 0, 0, 0, 0, 4, 0, 0, 0];
int [] [] param0 = [[4, 13, 13, 16, 16, 19, 39, 41, 48, 52, 57, 62, 65, 67, 76, 84, 88, 91, 95, 96, 97, 98], [62, 76, 86, -8, 84, -6, 72, 84, 6, -50, -18, -94, 54,... |
COUNT_WAYS_DIVIDE_CIRCLE_USING_N_NON_INTERSECTING_CHORDS | static int f_filled ( int A ) {
int n = 2 * A ;
int [ ] dpArray = new int [ n + 1 ] ;
dpArray [ 0 ] = 1 ;
dpArray [ 2 ] = 1 ;
for ( int i = 4 ;
i <= n ;
i += 2 ) {
for ( int j = 0 ;
j < i - 1 ;
j += 2 ) {
dpArray [ i ] += ( dpArray [ j ] * dpArray [ i - 2 - j ] ) ;
}
}
return dpA... | import std.stdio;
import std.math;
import std.conv;
import std.algorithm;
//TOFILL//
void main(){
int [] results = [477638700, 129644790, 2674440, 58786, 1430, 42, 2];
int [] param0 = [18, 17, 14, 11, 8, 5, 2];
int n_success = 0;
for (int i = 0; i < param0.length; i++) {
if (results[i] == f_f... |
COUNT_WORDS_APPEAR_EXACTLY_TWO_TIMES_ARRAY_WORDS | static int f_filled ( String str [ ] , int n ) {
HashMap < String , Integer > m = new HashMap < > ( ) ;
for ( int i = 0 ;
i < n ;
i ++ ) {
if ( m . containsKey ( str [ i ] ) ) {
int get = m . get ( str [ i ] ) ;
m . put ( str [ i ] , get + 1 ) ;
}
else {
m . put ( str [ i ] , 1 ) ;... | import std.stdio;
import std.math;
import std.conv;
import std.algorithm;
//TOFILL//
void main(){
int [] results = [1, 3, 1, 2, 1, 2, 1, 0, 1, 2];
string [] [] param0 = [["hate", "love", "peace", "love", "peace", "hate", "love", "peace", "love", "peace"], ["16", "946613197072", "532052", "42780833", "511552",... |
NUMBER_NON_NEGATIVE_INTEGRAL_SOLUTIONS_B_C_N | static int f_filled ( 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 ;
} | import std.stdio;
import std.math;
import std.conv;
import std.algorithm;
//TOFILL//
void main(){
int [] results = [2016, 1035, 741, 3403, 120, 231, 3003, 2701, 4753, 1431];
int [] param0 = [62, 44, 37, 81, 14, 20, 76, 72, 96, 52];
int n_success = 0;
for (int i = 0; i < param0.length; i++) {
... |
C_PROGRAM_CONCATENATE_STRING_GIVEN_NUMBER_TIMES | static String f_filled ( String s , int n ) {
String s1 = s ;
for ( int i = 1 ;
i < n ;
i ++ ) s += s1 ;
return s ;
} | import std.stdio;
import std.math;
import std.conv;
import std.algorithm;
//TOFILL//
void main(){
string [] results = ["lpwsailpwsailpwsailpwsailpwsailpwsailpwsailpwsailpwsailpwsailpwsailpwsailpwsailpwsailpwsailpwsailpwsailpwsailpwsailpwsailpwsailpwsailpwsailpwsailpwsailpwsailpwsailpwsailpwsailpwsailpwsailpwsailp... |
DYNAMIC_PROGRAMMING_SET_17_PALINDROME_PARTITIONING_1 | static int f_filled ( String str ) {
int n = str . length ( ) ;
int [ ] C = new int [ n ] ;
boolean [ ] [ ] P = new boolean [ n ] [ n ] ;
int i , j , k , L ;
for ( i = 0 ;
i < n ;
i ++ ) {
P [ i ] [ i ] = true ;
}
for ( L = 2 ;
L <= n ;
L ++ ) {
for ( i = 0 ;
i < n - L + 1 ;
i ++ )... | import std.stdio;
import std.math;
import std.conv;
import std.algorithm;
//TOFILL//
void main(){
int [] results = [10, 6, 0, 2, 6, 1, 8, 4, 2, 4];
string [] param0 = ["yygwgyrovdsh", "56109778", "101", "rxm", "187546405", "0110010", "wvodamgvi", "56719", "10100011001100", "wtpai"];
int n_success = 0;
... |
C_PROGRAM_FACTORIAL_NUMBER_1 | static int f_filled ( int n ) {
int res = 1 , i ;
for ( i = 2 ;
i <= n ;
i ++ ) res *= i ;
return res ;
} | import std.stdio;
import std.math;
import std.conv;
import std.algorithm;
//TOFILL//
void main(){
int [] results = [1, 2, 6, 24, 120, 720, 5040, 40320, 362880, 3628800, 39916800, 479001600];
int [] param0 = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12];
int n_success = 0;
for (int i = 0; i < param0.length... |
MINIMUM_NUMBER_PLATFORMS_REQUIRED_RAILWAYBUS_STATION | static int f_filled ( int arr [ ] , int dep [ ] , int n )
{
int plat_needed = 1, result = 1;
for (int i = 0; i < n; i++) {
plat_needed = 1;
for (int j = 0; j < n; j++) {
if (i != j)
{
if (arr[i] >= arr[j] && dep[j] >= arr[i... | import std.stdio;
import std.math;
import std.conv;
import std.algorithm;
//TOFILL//
void main(){
int [] results = [2, 11, 6, 5, 1, 13, 1, 8, 26, 3];
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, -2... |
PROGRAM_CHECK_PLUS_PERFECT_NUMBER | static boolean f_filled ( int x ) {
int temp = x ;
int n = 0 ;
while ( x != 0 ) {
x /= 10 ;
n ++ ;
}
x = temp ;
int sum = 0 ;
while ( x != 0 ) {
sum += Math . pow ( x % 10 , n ) ;
x /= 10 ;
}
return ( sum == temp ) ;
} | import std.stdio;
import std.math;
import std.conv;
import std.algorithm;
//TOFILL//
void main(){
bool [] results = [true, true, false, false, false, false, false, false, false, false];
int [] param0 = [371, 9474, 85, 35, 54, 17, 97, 63, 12, 43];
int n_success = 0;
for (int i = 0; i < param0.length;... |
DECIMAL_BINARY_CONVERSION_WITHOUT_USING_ARITHMETIC_OPERATORS | static String f_filled ( int n ) {
if ( n == 0 ) return "0" ;
String bin = "" ;
while ( n > 0 ) {
bin = ( ( n & 1 ) == 0 ? '0' : '1' ) + bin ;
n >>= 1 ;
}
return bin ;
} | import std.stdio;
import std.math;
import std.conv;
import std.algorithm;
//TOFILL//
void main(){
string [] results = ["100011", "10001", "1000", "1100011", "111001", "100111", "1100011", "1110", "10110", "111"];
int [] param0 = [35, 17, 8, 99, 57, 39, 99, 14, 22, 7];
int n_success = 0;
for (int i =... |
MIDDLE_OF_THREE_USING_MINIMUM_COMPARISONS | static int f_filled ( int a , int b , int c ) {
if ( ( a < b && b < c ) || ( c < b && b < a ) ) return b ;
else if ( ( b < a && a < c ) || ( c < a && a < b ) ) return a ;
else return c ;
} | import std.stdio;
import std.math;
import std.conv;
import std.algorithm;
//TOFILL//
void main(){
int [] results = [56, 56, 51, 54, 70, 57, 80, 54, 70, 5];
int [] param0 = [56, 56, 36, 71, 3, 84, 30, 82, 90, 38];
int [] param1 = [5, 60, 56, 54, 70, 57, 80, 54, 70, 4];
int [] param2 = [82, 17, 51, 6, 8... |
DECIMAL_REPRESENTATION_GIVEN_BINARY_STRING_DIVISIBLE_10_NOT | static boolean f_filled ( String bin ) {
int n = bin . length ( ) ;
if ( bin . charAt ( n - 1 ) == '1' ) return false ;
int sum = 0 ;
for ( int i = n - 2 ;
i >= 0 ;
i -- ) {
if ( bin . charAt ( i ) == '1' ) {
int posFromRight = n - i - 1 ;
if ( posFromRight % 4 == 1 ) sum = sum + 2 ;
e... | import std.stdio;
import std.math;
import std.conv;
import std.algorithm;
//TOFILL//
void main(){
bool [] results = [true, false, false, true, true, false, true, false, false, true];
string [] param0 = ["101000", "39613456759141", "11", "poihjo", "2", "0000101", "t s dzkedx gk", "3944713969", "1000", "ifyugd... |
FIBONACCI_MODULO_P | static int f_filled ( int p ) {
int first = 1 , second = 1 , number = 2 , next = 1 ;
while ( next > 0 ) {
next = ( first + second ) % p ;
first = second ;
second = next ;
number ++ ;
}
return number ;
} | import std.stdio;
import std.math;
import std.conv;
import std.algorithm;
//TOFILL//
void main(){
int [] results = [36, 30, 18, 8, 6, 24, 60, 100, 70, 20];
int [] param0 = [51, 40, 68, 7, 8, 32, 93, 75, 71, 15];
int n_success = 0;
for (int i = 0; i < param0.length; i++) {
if (results[i] == f_... |
DECODE_MEDIAN_STRING_ORIGINAL_STRING | static String f_filled ( String s ) {
int l = s . length ( ) ;
String s1 = "" ;
boolean isEven = ( l % 2 == 0 ) ? true : false ;
for ( int i = 0 ;
i < l ;
i += 2 ) {
if ( isEven ) {
s1 = s . charAt ( i ) + s1 ;
s1 += s . charAt ( i + 1 ) ;
}
else {
if ( l - i > 1 ) {
s1... | import std.stdio;
import std.math;
import std.conv;
import std.algorithm;
//TOFILL//
void main(){
string [] results = ["tpqcve gqeyzv", "484850", "1000000011111", "ysw", "524035", "0", "tlhwmmaq", "6792", "111111", "oqggubrdup"];
string [] param0 = [" egvqceqypztv", "488540", "0000101010111", "syw", "402355",... |
DIAGONALLY_DOMINANT_MATRIX | static boolean f_filled ( int m [ ] [ ] , int n ) {
for ( int i = 0 ;
i < n ;
i ++ ) {
int sum = 0 ;
for ( int j = 0 ;
j < n ;
j ++ ) sum += Math . abs ( m [ i ] [ j ] ) ;
sum -= Math . abs ( m [ i ] [ i ] ) ;
if ( Math . abs ( m [ i ] [ i ] ) < sum ) return false ;
}
return true ;
} | import std.stdio;
import std.math;
import std.conv;
import std.algorithm;
//TOFILL//
void main(){
bool [] results = [true, false, true, true, false, false, false, false, false, false];
int [] [] [] param0 = [[[3, -2, 1], [1, -3, 2], [-1, 2, 4]], [[2, -2, 1], [1, -3, 2], [-1, 2, 4]], [[78, 46, 33, 58, 79, 94, ... |
MAXIMUM_SUM_PAIRS_SPECIFIC_DIFFERENCE_1 | static int f_filled ( int arr [ ] , int N , int k ) {
int maxSum = 0 ;
Arrays . sort ( arr ) ;
for ( int i = N - 1 ;
i > 0 ;
-- i ) {
if ( arr [ i ] - arr [ i - 1 ] < k ) {
maxSum += arr [ i ] ;
maxSum += arr [ i - 1 ] ;
-- i ;
}
}
return maxSum ;
} | import std.stdio;
import std.math;
import std.conv;
import std.algorithm;
//TOFILL//
void main(){
int [] results = [1578, -338, 25, 0, 596, 24, 1866, 406, 20, 1153];
int [] [] param0 = [[2, 10, 11, 11, 12, 14, 15, 17, 27, 27, 28, 36, 36, 44, 47, 47, 54, 55, 62, 64, 68, 69, 70, 70, 75, 76, 78, 85, 85, 91, 95, ... |
DICE_THROW_PROBLEM | static long f_filled ( int m , int n , int x ) {
long [ ] [ ] table = new long [ n + 1 ] [ x + 1 ] ;
for ( int j = 1 ;
j <= m && j <= x ;
j ++ ) table [ 1 ] [ j ] = 1 ;
for ( int i = 2 ;
i <= n ;
i ++ ) {
for ( int j = 1 ;
j <= x ;
j ++ ) {
for ( int k = 1 ;
k < j && k <= m ;
... | import std.stdio;
import std.math;
import std.conv;
import std.algorithm;
//TOFILL//
void main(){
long [] results = [50116, 77635844, 0, 0, 0, 0, 0, 1131, 0, 0];
int [] param0 = [94, 7, 20, 90, 50, 32, 46, 43, 43, 6];
int [] param1 = [4, 12, 44, 94, 58, 90, 25, 3, 82, 83];
int [] param2 = [69, 33, 24,... |
FIND_THE_FIRST_MISSING_NUMBER | static int f_filled ( int array [ ] , int start , int end ) {
if ( start > end ) return end + 1 ;
if ( start != array [ start ] ) return start ;
int mid = ( start + end ) / 2 ;
if ( array [ mid ] == mid ) return f_filled ( array , mid + 1 , end ) ;
return f_filled ( array , start , mid ) ;
} | import std.stdio;
import std.math;
import std.conv;
import std.algorithm;
//TOFILL//
void main(){
int [] results = [19, 19, 26, 20, 8, 24, 0, 32, 28, 0];
int [] [] param0 = [[3, 6, 7, 9, 11, 14, 18, 30, 30, 32, 32, 34, 37, 44, 45, 45, 48, 48, 48, 52, 58, 60, 63, 67, 69, 69, 81, 83, 87, 89, 97, 99], [88, -62, ... |
DICE_THROW_PROBLEM_1 | static long f_filled ( int f , int d , int s ) {
long mem [ ] [ ] = new long [ d + 1 ] [ s + 1 ] ;
mem [ 0 ] [ 0 ] = 1 ;
for ( int i = 1 ;
i <= d ;
i ++ ) {
for ( int j = i ;
j <= s ;
j ++ ) {
mem [ i ] [ j ] = mem [ i ] [ j - 1 ] + mem [ i - 1 ] [ j - 1 ] ;
if ( j - f - 1 >= 0 ) mem [... | import std.stdio;
import std.math;
import std.conv;
import std.algorithm;
//TOFILL//
void main(){
long [] results = [35960, 0, 0, 0, 0, 0, 77384340, 141120525, 1, 25];
int [] param0 = [57, 58, 38, 5, 91, 76, 10, 28, 97, 99];
int [] param1 = [5, 45, 89, 39, 90, 56, 15, 20, 90, 2];
int [] param2 = [33, ... |
DIFFERENCE_BETWEEN_HIGHEST_AND_LEAST_FREQUENCIES_IN_AN_ARRAY | static int f_filled ( int arr [ ] , int n ) {
Arrays . sort ( arr ) ;
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 = Math . max ( max_count , count ) ;
... | import std.stdio;
import std.math;
import std.conv;
import std.algorithm;
//TOFILL//
void main(){
int [] results = [2, 1, 0, 1, 0, 0, -1, 0, 0, 1];
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], [-92, -92, -78, -74, -70, -66, -60, -54, -50,... |
DISTRIBUTING_ITEMS_PERSON_CANNOT_TAKE_TWO_ITEMS_TYPE | static boolean f_filled ( int [ ] arr , int n , int k ) {
int count ;
for ( int i = 0 ;
i < n ;
i ++ ) {
count = 0 ;
for ( int j = 0 ;
j < n ;
j ++ ) {
if ( arr [ j ] == arr [ i ] ) count ++ ;
if ( count > 2 * k ) return false ;
}
}
return true ;
} | import std.stdio;
import std.math;
import std.conv;
import std.algorithm;
//TOFILL//
void main(){
bool [] results = [true, true, true, true, true, false, true, true, false, true];
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, 9... |
K_TH_ELEMENT_TWO_SORTED_ARRAYS | static int f_filled ( int arr1 [ ] , int arr2 [ ] , int m , int n , int k ) {
int [ ] sorted1 = new int [ m + n ] ;
int i = 0 , j = 0 , d = 0 ;
while ( i < m && j < n ) {
if ( arr1 [ i ] < arr2 [ j ] ) sorted1 [ d ++ ] = arr1 [ i ++ ] ;
else sorted1 [ d ++ ] = arr2 [ j ++ ] ;
}
while ( i < m ) sorted1... | import std.stdio;
import std.math;
import std.conv;
import std.algorithm;
//TOFILL//
void main(){
int [] results = [31, 20, 0, 71, -22, 0, 30, 86, 1, 70];
int [] [] param0 = [[2, 2, 4, 4, 9, 10, 14, 16, 16, 19, 20, 21, 25, 26, 29, 36, 36, 37, 38, 44, 44, 49, 53, 54, 56, 61, 62, 64, 72, 72, 73, 77, 80, 84, 84,... |
DIVISIBILITY_BY_7 | static boolean f_filled ( int num ) {
if ( num < 0 ) return f_filled ( - num ) ;
if ( num == 0 || num == 7 ) return true ;
if ( num < 10 ) return false ;
return f_filled ( num / 10 - 2 * ( num - num / 10 * 10 ) ) ;
} | import std.stdio;
import std.math;
import std.conv;
import std.algorithm;
//TOFILL//
void main(){
bool [] results = [true, true, true, true, true, false, false, false, false, false];
int [] param0 = [0, -21, 7, 63, 84, 73, 81, -10, 47, 23];
int n_success = 0;
for (int i = 0; i < param0.length; i++) ... |
MAXIMUM_SUM_2_X_N_GRID_NO_TWO_ELEMENTS_ADJACENT | static int f_filled ( int grid [ ] [ ] , int n ) {
int incl = Math . max ( grid [ 0 ] [ 0 ] , grid [ 1 ] [ 0 ] ) ;
int excl = 0 , excl_new ;
for ( int i = 1 ;
i < n ;
i ++ ) {
excl_new = Math . max ( excl , incl ) ;
incl = excl + Math . max ( grid [ 0 ] [ i ] , grid [ 1 ] [ i ] ) ;
excl = excl_new... | import std.stdio;
import std.math;
import std.conv;
import std.algorithm;
//TOFILL//
void main(){
int [] results = [34, 832, 0, 212, 58, 13, 47, 372, 3, 1000];
int [] [] [] param0 = [[[6, 10, 23, 28, 35, 55, 91], [11, 14, 15, 54, 55, 62, 81], [18, 26, 40, 43, 47, 89, 93], [3, 11, 19, 53, 65, 82, 92], [14, 32,... |
DIVISIBILITY_9_USING_BITWISE_OPERATORS | static boolean f_filled ( int n ) {
if ( n == 0 || n == 9 ) return true ;
if ( n < 9 ) return false ;
return f_filled ( ( int ) ( n >> 3 ) - ( int ) ( n & 7 ) ) ;
} | import std.stdio;
import std.math;
import std.conv;
import std.algorithm;
//TOFILL//
void main(){
bool [] results = [false, false, true, false, false, false, false, true, false, false];
int [] param0 = [96, 85, 54, 14, 47, 11, 49, 99, 28, 82];
int n_success = 0;
for (int i = 0; i < param0.length; i+... |
PROGRAM_TO_CHECK_IF_A_GIVEN_NUMBER_IS_LUCKY_ALL_DIGITS_ARE_DIFFERENT | static boolean f_filled ( int n ) {
boolean arr [ ] = new boolean [ 10 ] ;
for ( int i = 0 ;
i < 10 ;
i ++ ) arr [ i ] = false ;
while ( n > 0 ) {
int digit = n % 10 ;
if ( arr [ digit ] ) return false ;
arr [ digit ] = true ;
n = n / 10 ;
}
return true ;
} | import std.stdio;
import std.math;
import std.conv;
import std.algorithm;
//TOFILL//
void main(){
bool [] results = [false, false, true, true, false, true, false, true, true, false];
int [] param0 = [474, 9445, 90, 30, 37453, 27, 2400, 98, 46, 722];
int n_success = 0;
for (int i = 0; i < param0.leng... |
MAXIMUM_POSSIBLE_DIFFERENCE_TWO_SUBSETS_ARRAY | static int f_filled ( int [ ] arr , int n ) {
int SubsetSum_1 = 0 , SubsetSum_2 = 0 ;
for ( int i = 0 ;
i <= n - 1 ;
i ++ ) {
boolean isSingleOccurance = true ;
for ( int j = i + 1 ;
j <= n - 1 ;
j ++ ) {
if ( arr [ i ] == arr [ j ] ) {
isSingleOccurance = false ;
arr [ i ]... | import std.stdio;
import std.math;
import std.conv;
import std.algorithm;
//TOFILL//
void main(){
int [] results = [198, 1100, 0, 217, 468, 1, 671, 710, 0, 703];
int [] [] param0 = [[5, 14, 15, 21, 0, 0, 42, 0, 0, 0, 0, 48, 0, 0, 53, 60, 62, 69, 69, 79, 82, 86, 96], [-54, 0, -22, 94, 58, 0, -12, 84, 0, 0, -34... |
DOUBLE_FACTORIAL | static long f_filled ( long n ) {
if ( n == 0 || n == 1 ) return 1 ;
return n * f_filled ( n - 2 ) ;
} | import std.stdio;
import std.math;
import std.conv;
import std.algorithm;
//TOFILL//
void main(){
long [] results = [1, 8, 105, 3840, 135135, 10321920, 654729075];
long [] param0 = [1, 4, 7, 10, 13, 16, 19];
int n_success = 0;
for (int i = 0; i < param0.length; i++) {
if (results[i] == f_fill... |
FIND_MAXIMUM_HEIGHT_PYRAMID_FROM_THE_GIVEN_ARRAY_OF_OBJECTS | static int f_filled ( int [ ] boxes , int n ) {
Arrays . sort ( boxes ) ;
int ans = 1 ;
int prev_width = boxes [ 0 ] ;
int prev_count = 1 ;
int curr_count = 0 ;
int curr_width = 0 ;
for ( int i = 1 ;
i < n ;
i ++ ) {
curr_width += boxes [ i ] ;
curr_count += 1 ;
if ( curr_width > prev_widt... | import std.stdio;
import std.math;
import std.conv;
import std.algorithm;
//TOFILL//
void main(){
int [] results = [7, 2, 3, 8, 1, 3, 9, 1, 2, 7];
int [] [] param0 = [[7, 8, 11, 11, 14, 19, 25, 27, 41, 42, 46, 52, 53, 54, 55, 58, 59, 62, 63, 66, 67, 69, 74, 75, 77, 81, 83, 84, 88, 88, 93, 93, 94], [-96, -92, ... |
FIND_FIRST_NATURAL_NUMBER_WHOSE_FACTORIAL_DIVISIBLE_X | static int f_filled ( int x ) {
int i = 1 ;
int fact = 1 ;
for ( i = 1 ;
i < x ;
i ++ ) {
fact = fact * i ;
if ( fact % x == 0 ) break ;
}
return i ;
} | import std.stdio;
import std.math;
import std.conv;
import std.algorithm;
//TOFILL//
void main(){
int [] results = [4, 11, 5, 6, 4, 7, 3, 5, 4, 3];
int [] param0 = [12, 11, 10, 9, 8, 7, 6, 5, 4, 3];
int n_success = 0;
for (int i = 0; i < param0.length; i++) {
if (results[i] == f_filled(param0... |
DYCK_PATH | static int f_filled ( int n ) {
int res = 1 ;
for ( int i = 0 ;
i < n ;
++ i ) {
res *= ( 2 * n - i ) ;
res /= ( i + 1 ) ;
}
return res / ( n + 1 ) ;
} | import std.stdio;
import std.math;
import std.conv;
import std.algorithm;
//TOFILL//
void main(){
int [] results = [742900, 208012, 58786, 16796, 429, 14, 1];
int [] param0 = [13, 12, 11, 10, 7, 4, 1];
int n_success = 0;
for (int i = 0; i < param0.length; i++) {
if (results[i] == f_filled(par... |
DYNAMIC_PROGRAMMING_HIGH_EFFORT_VS_LOW_EFFORT_TASKS_PROBLEM | static int f_filled ( int high [ ] , int low [ ] , int n ) {
if ( n <= 0 ) return 0 ;
return Math . max ( high [ n - 1 ] + f_filled ( high , low , ( n - 2 ) ) , low [ n - 1 ] + f_filled ( high , low , ( n - 1 ) ) ) ;
} | import std.stdio;
import std.math;
import std.conv;
import std.algorithm;
//TOFILL//
void main(){
int [] results = [537, 452, 0, 1261, -56, 15, 784, 268, 5, 453];
int [] [] param0 = [[1, 3, 9, 10, 13, 14, 15, 15, 17, 22, 23, 28, 30, 31, 37, 42, 45, 62, 62, 68, 68, 68, 78, 79, 82, 84, 87, 90, 99], [-78, -12, 2... |
QUERIES_COUNTS_ARRAY_ELEMENTS_VALUES_GIVEN_RANGE | static int f_filled ( int arr [ ] , int n , int x , int y ) {
int count = 0 ;
for ( int i = 0 ;
i < n ;
i ++ ) {
if ( arr [ i ] >= x && arr [ i ] <= y ) count ++ ;
}
return count ;
} | import std.stdio;
import std.math;
import std.conv;
import std.algorithm;
//TOFILL//
void main(){
int [] results = [0, 0, 0, 0, 1, 0, 0, 0, 0, 0];
int [] [] param0 = [[9, 16, 19, 24, 36, 38, 42, 49, 51, 53, 53, 57, 57, 58, 71, 78, 78, 92, 92, 93], [28, -74, -18, 10, 26, 28, -96, -80, 82, 94, 22, 50, 72, -90, ... |
DYNAMIC_PROGRAMMING_SET_14_MAXIMUM_SUM_INCREASING_SUBSEQUENCE | static int f_filled ( int arr [ ] , int n ) {
int i , j , max = 0 ;
int msis [ ] = new int [ n ] ;
for ( i = 0 ;
i < n ;
i ++ ) msis [ i ] = arr [ i ] ;
for ( i = 1 ;
i < n ;
i ++ ) for ( j = 0 ;
j < i ;
j ++ ) if ( arr [ i ] > arr [ j ] && msis [ i ] < msis [ j ] + arr [ i ] ) msis [ i ] = msis [ j... | import std.stdio;
import std.math;
import std.conv;
import std.algorithm;
//TOFILL//
void main(){
int [] results = [301, 102, 1, 396, 582, 1, 0, 254, 0, 550];
int [] [] param0 = [[4, 5, 7, 12, 23, 31, 31, 45, 47, 60, 67, 70, 84, 85, 91, 96], [-88, -38, -50, -14, 36, -32, 0, -8, -12, -62, -46, 66, -46, -26, 6,... |
HIGHWAY_BILLBOARD_PROBLEM | static int f_filled ( int m , int [ ] x , int [ ] revenue , int n , int t ) {
int [ ] maxRev = new int [ m + 1 ] ;
for ( int i = 0 ;
i < m + 1 ;
i ++ ) maxRev [ i ] = 0 ;
int nxtbb = 0 ;
for ( int i = 1 ;
i <= m ;
i ++ ) {
if ( nxtbb < n ) {
if ( x [ nxtbb ] != i ) maxRev [ i ] = maxRev [ i - ... | import std.stdio;
import std.math;
import std.conv;
import std.algorithm;
//TOFILL//
void main(){
int [] results = [2, 0, 0, 0, 0, 0, 0, 0, 0, 0];
int [] param0 = [16, 39, 5, 10, 14, 32, 2, 22, 15, 8];
int [] [] param1 = [[6, 15, 15, 18, 23, 29, 32, 36, 37, 39, 40, 41, 44, 49, 51, 52, 53, 57, 66, 68, 82, ... |
DYNAMIC_PROGRAMMING_SET_28_MINIMUM_INSERTIONS_TO_FORM_A_PALINDROME | static int f_filled ( char str [ ] , int l , int h ) {
if ( l > h ) return Integer . MAX_VALUE ;
if ( l == h ) return 0 ;
if ( l == h - 1 ) return ( str [ l ] == str [ h ] ) ? 0 : 1 ;
return ( str [ l ] == str [ h ] ) ? f_filled ( str , l + 1 , h - 1 ) : ( Integer . min ( f_filled ( str , l , h - 1 ) , f_filled... | import std.stdio;
import std.math;
import std.conv;
import std.algorithm;
//TOFILL//
void main(){
int [] results = [0, 3, 0, 3, 0, 1, 2, 4, 0, 1];
char [] [] param0 = [['f', 'f', 'j', 'k', 'k', 'l', 'p', 's', 't', 'v', 'w', 'y', 'b', 'd', 'j', 'l', 't', 'u', 'x', 'y'], ['0', '1', '8', '8', '8', '4', '4', '3',... |
NUMBER_OF_BINARY_TREES_FOR_GIVEN_PREORDER_SEQUENCE_LENGTH | static int f_filled ( int n ) {
int BT [ ] = new int [ n + 1 ] ;
for ( int i = 0 ;
i <= n ;
i ++ ) BT [ i ] = 0 ;
BT [ 0 ] = BT [ 1 ] = 1 ;
for ( int i = 2 ;
i <= n ;
++ i ) for ( int j = 0 ;
j < i ;
j ++ ) BT [ i ] += BT [ j ] * BT [ i - j - 1 ] ;
return BT [ n ] ;
} | import std.stdio;
import std.math;
import std.conv;
import std.algorithm;
//TOFILL//
void main(){
int [] results = [429, 42, 9694845, 58786, 16796, 5, 4862, 1430, 742900, 132];
int [] param0 = [7, 5, 15, 11, 10, 3, 9, 8, 13, 6];
int n_success = 0;
for (int i = 0; i < param0.length; i++) {
if ... |
PROGRAM_FIND_STRING_START_END_GEEKS | static boolean f_filled ( String str , String corner ) {
int n = str . length ( ) ;
int cl = corner . length ( ) ;
if ( n < cl ) return false ;
return ( str . substring ( 0 , cl ) . equals ( corner ) && str . substring ( n - cl , n ) . equals ( corner ) ) ;
} | import std.stdio;
import std.math;
import std.conv;
import std.algorithm;
//TOFILL//
void main(){
bool [] results = [true, false, true, true, true, false, true, false, false, false];
string [] param0 = ["geeksmanishgeeks", "shreyadhatwalia", "10000100", "abaa", "30645530", "0000011011001", "dkqed", "486941193... |
MINIMIZE_THE_SUM_OF_DIGITS_OF_A_AND_B_SUCH_THAT_A_B_N | static int f_filled ( int n ) {
int sum = 0 ;
while ( n > 0 ) {
sum += ( n % 10 ) ;
n /= 10 ;
}
if ( sum == 1 ) return 10 ;
return sum ;
} | import std.stdio;
import std.math;
import std.conv;
import std.algorithm;
//TOFILL//
void main(){
int [] results = [2, 12, 4, 9, 8, 13, 13, 5, 4, 9];
int [] param0 = [2, 39, 31, 45, 35, 94, 67, 50, 4, 63];
int n_success = 0;
for (int i = 0; i < param0.length; i++) {
if (results[i] == f_filled... |
HOW_CAN_WE_SUM_THE_DIGITS_OF_A_GIVEN_NUMBER_IN_SINGLE_STATEMENT_2 | static int f_filled ( int no ) {
return no == 0 ? 0 : no % 10 + f_filled ( no / 10 ) ;
} | import std.stdio;
import std.math;
import std.conv;
import std.algorithm;
//TOFILL//
void main(){
int [] results = [10, 10, 9, 16, 4, 12, 14, 9, 13, 8];
int [] param0 = [73, 91, 27, 79, 31, 84, 68, 9, 85, 35];
int n_success = 0;
for (int i = 0; i < param0.length; i++) {
if (results[i] == f_fi... |
MAXIMUM_SUBSEQUENCE_SUM_SUCH_THAT_NO_THREE_ARE_CONSECUTIVE | static int f_filled ( int arr [ ] , int n ) {
int sum [ ] = new int [ n ] ;
if ( n >= 1 ) sum [ 0 ] = arr [ 0 ] ;
if ( n >= 2 ) sum [ 1 ] = arr [ 0 ] + arr [ 1 ] ;
if ( n > 2 ) sum [ 2 ] = Math . max ( sum [ 1 ] , Math . max ( arr [ 1 ] + arr [ 2 ] , arr [ 0 ] + arr [ 2 ] ) ) ;
for ( int i = 3 ;
i < n ;
i... | import std.stdio;
import std.math;
import std.conv;
import std.algorithm;
//TOFILL//
void main(){
int [] results = [832, 308, 2, 419, -182, 7, 895, 450, 0, 895];
int [] [] param0 = [[5, 6, 8, 9, 10, 10, 16, 17, 17, 20, 21, 22, 23, 28, 29, 32, 36, 37, 40, 41, 42, 43, 47, 47, 48, 48, 49, 49, 52, 52, 53, 59, 61,... |
MAXIMUM_SUM_SUBARRAY_REMOVING_ONE_ELEMENT | static int f_filled ( int arr [ ] , int n ) {
int fw [ ] = new int [ n ] ;
int bw [ ] = new int [ n ] ;
int cur_max = arr [ 0 ] , max_so_far = arr [ 0 ] ;
fw [ 0 ] = arr [ 0 ] ;
for ( int i = 1 ;
i < n ;
i ++ ) {
cur_max = Math . max ( arr [ i ] , cur_max + arr [ i ] ) ;
max_so_far = Math . max ( ... | import std.stdio;
import std.math;
import std.conv;
import std.algorithm;
//TOFILL//
void main(){
int [] results = [764, 350, 3, 767, 570, 8, 2357, 662, 8, 833];
int [] [] param0 = [[2, 8, 14, 17, 19, 35, 38, 45, 50, 53, 55, 70, 82, 88, 92, 96], [-64, -56, -80, -82, 72, 62, -8, 48, -96, 34, 64, -38, -60, 80, ... |
EFFICIENT_WAY_CHECK_WHETHER_N_TH_FIBONACCI_NUMBER_MULTIPLE_10 | static boolean f_filled ( int n ) {
if ( n % 15 == 0 ) return true ;
return false ;
} | import std.stdio;
import std.math;
import std.conv;
import std.algorithm;
//TOFILL//
void main(){
bool [] results = [true, true, true, true, false, false, false, false, false, false];
int [] param0 = [30, -30, 60, 90, 99, 32, 21, 65, 21, 99];
int n_success = 0;
for (int i = 0; i < param0.length; i++... |
PROGRAM_AREA_SQUARE | static int f_filled ( int side ) {
int area = side * side ;
return area ;
} | import std.stdio;
import std.math;
import std.conv;
import std.algorithm;
//TOFILL//
void main(){
int [] results = [2500, 4096, 8464, 529, 1444, 3025, 4489, 3136, 3600, 8100];
int [] param0 = [50, 64, 92, 23, 38, 55, 67, 56, 60, 90];
int n_success = 0;
for (int i = 0; i < param0.length; i++) {
... |
EFFICIENT_WAY_TO_MULTIPLY_WITH_7 | static int f_filled ( int n ) {
return ( ( n << 3 ) - n ) ;
} | import std.stdio;
import std.math;
import std.conv;
import std.algorithm;
//TOFILL//
void main(){
int [] results = [287, 294, 434, 28, 217, 525, 35, 525, 595, 133];
int [] param0 = [41, 42, 62, 4, 31, 75, 5, 75, 85, 19];
int n_success = 0;
for (int i = 0; i < param0.length; i++) {
if (results... |
POSSIBLE_FORM_TRIANGLE_ARRAY_VALUES | static boolean f_filled ( int [ ] arr , int N ) {
if ( N < 3 ) return false ;
Arrays . sort ( arr ) ;
for ( int i = 0 ;
i < N - 2 ;
i ++ ) if ( arr [ i ] + arr [ i + 1 ] > arr [ i + 2 ] ) return true ;
return false ;
} | import std.stdio;
import std.math;
import std.conv;
import std.algorithm;
//TOFILL//
void main(){
bool [] results = [true, true, true, true, true, true, true, true, true, true];
int [] [] param0 = [[2, 6, 8, 10, 14, 15, 16, 19, 21, 26, 26, 26, 28, 29, 30, 33, 33, 35, 36, 36, 41, 44, 45, 45, 45, 49, 51, 54, 57... |
ELEMENTS_TO_BE_ADDED_SO_THAT_ALL_ELEMENTS_OF_A_RANGE_ARE_PRESENT_IN_ARRAY_1 | static int f_filled ( int arr [ ] , int n ) {
HashSet < Integer > s = new HashSet < > ( ) ;
int count = 0 , maxm = Integer . MIN_VALUE , minm = Integer . MAX_VALUE ;
for ( int i = 0 ;
i < n ;
i ++ ) {
s . add ( arr [ i ] ) ;
if ( arr [ i ] < minm ) minm = arr [ i ] ;
if ( arr [ i ] > maxm ) maxm =... | import std.stdio;
import std.math;
import std.conv;
import std.algorithm;
//TOFILL//
void main(){
int [] results = [31, 141, 0, 60, 111, 0, 21, 174, 0, 73];
int [] [] param0 = [[1, 4, 5, 5, 11, 11, 12, 14, 16, 20, 23, 23, 25, 27, 29, 33, 33, 35, 37, 39, 39, 44, 44, 45, 47, 51, 51, 53, 55, 65, 73, 73, 75, 78, ... |
LARGEST_SUM_CONTIGUOUS_SUBARRAY_2 | static int f_filled ( int a [ ] , int size ) {
int max_so_far = a [ 0 ] ;
int curr_max = a [ 0 ] ;
for ( int i = 1 ;
i < size ;
i ++ ) {
curr_max = Math . max ( a [ i ] , curr_max + a [ i ] ) ;
max_so_far = Math . max ( max_so_far , curr_max ) ;
}
return max_so_far ;
} | import std.stdio;
import std.math;
import std.conv;
import std.algorithm;
//TOFILL//
void main(){
int [] results = [1265, 90, 11, 1063, 348, 13, 1306, 172, 10, 1019];
int [] [] param0 = [[1, 3, 4, 7, 8, 8, 10, 12, 16, 19, 19, 20, 20, 21, 21, 22, 26, 27, 29, 34, 36, 38, 38, 39, 41, 43, 44, 47, 47, 49, 57, 57, ... |
EULERIAN_NUMBER_1 | static int f_filled ( int n , int m ) {
int [ ] [ ] dp = new int [ n + 1 ] [ m + 1 ] ;
for ( int i = 1 ;
i <= n ;
i ++ ) {
for ( int j = 0 ;
j <= m ;
j ++ ) {
if ( i > j ) {
if ( j == 0 ) dp [ i ] [ j ] = 1 ;
else dp [ i ] [ j ] = ( ( i - j ) * dp [ i - 1 ] [ j - 1 ] ) + ( ( j ... | import std.stdio;
import std.math;
import std.conv;
import std.algorithm;
//TOFILL//
void main(){
int [] results = [1505621508, 66318474, 455192, 1191, 57, 26, 1, 0];
int [] param0 = [13, 12, 10, 7, 6, 5, 4, 5];
int [] param1 = [7, 7, 6, 4, 4, 3, 3, 6];
int n_success = 0;
for (int i = 0; i < par... |
EULERS_CRITERION_CHECK_IF_SQUARE_ROOT_UNDER_MODULO_P_EXISTS | static boolean f_filled ( int n , int p ) {
n = n % p ;
for ( int x = 2 ;
x < p ;
x ++ ) if ( ( x * x ) % p == n ) return true ;
return false ;
} | import std.stdio;
import std.math;
import std.conv;
import std.algorithm;
//TOFILL//
void main(){
bool [] results = [false, false, true, false, true, false, true, false, false, false];
int [] param0 = [71, 85, 4, 20, 71, 72, 36, 95, 83, 72];
int [] param1 = [78, 75, 35, 99, 29, 88, 54, 52, 33, 13];
i... |
HOW_TO_CHECK_IF_A_GIVEN_ARRAY_REPRESENTS_A_BINARY_HEAP_1 | static boolean f_filled ( int arr [ ] , int n ) {
for ( int i = 0 ;
i <= ( n - 2 ) / 2 ;
i ++ ) {
if ( arr [ 2 * i + 1 ] > arr [ i ] ) {
return false ;
}
if ( 2 * i + 2 < n && arr [ 2 * i + 2 ] > arr [ i ] ) {
return false ;
}
}
return true ;
} | import std.stdio;
import std.math;
import std.conv;
import std.algorithm;
//TOFILL//
void main(){
bool [] results = [false, false, false, true, false, true, false, false, false, false];
int [] [] param0 = [[2, 2, 2, 7, 10, 14, 24, 38, 42, 50, 59, 60, 72, 73, 79, 83, 89], [-48, 98, 96, -56, -2, 58, 52, -50, 58... |
EVEN_FIBONACCI_NUMBERS_SUM | static int f_filled ( int limit ) {
if ( limit < 2 ) return 0 ;
long ef1 = 0 , ef2 = 2 ;
long sum = ef1 + ef2 ;
while ( ef2 <= limit ) {
long ef3 = 4 * ef2 + ef1 ;
if ( ef3 > limit ) break ;
ef1 = ef2 ;
ef2 = ef3 ;
sum += ef2 ;
}
return ( int ) sum ;
} | import std.stdio;
import std.math;
import std.conv;
import std.algorithm;
//TOFILL//
void main(){
int [] results = [44, 44, 10, 44, 44, 10, 44, 10, 10, 44];
int [] param0 = [67, 89, 12, 94, 96, 25, 49, 8, 33, 59];
int n_success = 0;
for (int i = 0; i < param0.length; i++) {
if (results[i] == ... |
FAST_MULTIPLICATION_METHOD_WITHOUT_USING_MULTIPLICATION_OPERATOR_RUSSIAN_PEASANTS_ALGORITHM | static int f_filled ( int a , int b ) {
int res = 0 ;
while ( b > 0 ) {
if ( ( b & 1 ) != 0 ) res = res + a ;
a = a << 1 ;
b = b >> 1 ;
}
return res ;
} | import std.stdio;
import std.math;
import std.conv;
import std.algorithm;
//TOFILL//
void main(){
int [] results = [132, 2412, 3380, 2035, 2660, 6762, 5208, 400, 540, 5628];
int [] param0 = [4, 36, 65, 55, 35, 69, 84, 5, 15, 67];
int [] param1 = [33, 67, 52, 37, 76, 98, 62, 80, 36, 84];
int n_success... |
FIND_THREE_ELEMENT_FROM_DIFFERENT_THREE_ARRAYS_SUCH_THAT_THAT_A_B_C_K_1 | static boolean f_filled ( int a1 [ ] , int a2 [ ] , int a3 [ ] , int n1 , int n2 , int n3 , int sum ) {
HashSet < Integer > s = new HashSet < Integer > ( ) ;
for ( int i = 0 ;
i < n1 ;
i ++ ) {
s . add ( a1 [ i ] ) ;
}
ArrayList < Integer > al = new ArrayList < > ( s ) ;
for ( int i = 0 ;
i < n2 ;
... | import std.stdio;
import std.math;
import std.conv;
import std.algorithm;
//TOFILL//
void main(){
bool [] results = [false, true, false, false, false, false, false, false, false, false];
int [] [] param0 = [[6, 7, 10, 15, 28, 30, 30, 35, 38, 43, 44, 44, 54, 55, 64, 68, 69, 73, 75, 75, 86, 87, 92, 93, 94], [-7... |
FINDING_POWER_PRIME_NUMBER_P_N | static int f_filled ( int n , int p ) {
int ans = 0 ;
for ( int i = 1 ;
i <= n ;
i ++ ) {
int count = 0 , temp = i ;
while ( temp % p == 0 ) {
count ++ ;
temp = temp / p ;
}
ans += count ;
}
return ans ;
} | import std.stdio;
import std.math;
import std.conv;
import std.algorithm;
//TOFILL//
void main(){
int [] results = [1, 3, 1, 1, 2, 1, 0, 0, 1, 3];
int [] param0 = [49, 80, 10, 81, 11, 45, 86, 27, 80, 97];
int [] param1 = [30, 25, 9, 57, 4, 34, 90, 78, 60, 31];
int n_success = 0;
for (int i = 0; ... |
MAXIMUM_NUMBER_2X2_SQUARES_CAN_FIT_INSIDE_RIGHT_ISOSCELES_TRIANGLE | static int f_filled ( int base ) {
base = ( base - 2 ) ;
base = base / 2 ;
return base * ( base + 1 ) / 2 ;
} | import std.stdio;
import std.math;
import std.conv;
import std.algorithm;
//TOFILL//
void main(){
int [] results = [1081, 276, 10, 630, 666, 190, 10, 1081, 496, 28];
int [] param0 = [95, 49, 10, 73, 74, 40, 10, 94, 64, 16];
int n_success = 0;
for (int i = 0; i < param0.length; i++) {
if (resu... |
FIND_A_FIXED_POINT_IN_A_GIVEN_ARRAY | static int f_filled ( int arr [ ] , int n ) {
int i ;
for ( i = 0 ;
i < n ;
i ++ ) {
if ( arr [ i ] == i ) return i ;
}
return - 1 ;
} | import std.stdio;
import std.math;
import std.conv;
import std.algorithm;
//TOFILL//
void main(){
int [] results = [-1, -1, 0, -1, -1, 0, -1, -1, 0, -1];
int [] [] param0 = [[8, 16, 21, 26, 27, 29, 34, 35, 35, 37, 38, 40, 48, 52, 58, 59, 60, 61, 63, 63, 65, 66, 69, 75, 79, 83, 86, 88, 91, 91, 96], [22, -70, 3... |
FIND_THE_MAXIMUM_SUBARRAY_XOR_IN_A_GIVEN_ARRAY | static int f_filled ( int arr [ ] , int n ) {
int ans = Integer . MIN_VALUE ;
for ( int i = 0 ;
i < n ;
i ++ ) {
int curr_xor = 0 ;
for ( int j = i ;
j < n ;
j ++ ) {
curr_xor = curr_xor ^ arr [ j ] ;
ans = Math . max ( ans , curr_xor ) ;
}
}
return ans ;
} | import std.stdio;
import std.math;
import std.conv;
import std.algorithm;
//TOFILL//
void main(){
int [] results = [63, 126, 1, 33, 126, 1, 127, 126, 1, 127];
int [] [] param0 = [[1, 7, 7, 11, 12, 18, 20, 23, 27, 30, 44, 47, 53, 53, 55, 57, 57, 58, 61, 62, 67, 74, 76, 80, 86, 86], [-34, -4, 68, -82, 54, 20, 6... |
FIND_THE_MISSING_NUMBER_1 | static int f_filled ( int a [ ] , int n ) {
int total = 1 ;
for ( int i = 2 ;
i <= ( n + 1 ) ;
i ++ ) {
total += i ;
total -= a [ i - 2 ] ;
}
return total ;
} | import std.stdio;
import std.math;
import std.conv;
import std.algorithm;
//TOFILL//
void main(){
int [] results = [-261, 524, 131, -954, 694, 341, -506, 227, 463, -697];
int [] [] param0 = [[13, 27, 46, 59, 62, 82, 92], [22, 86, -64, -20, -56, -16, 86, 42, 72, -90, 10, 42, 56, 8, 50, 24, -34, 0, -78, 64, 18,... |
FIND_A_TRIPLET_THAT_SUM_TO_A_GIVEN_VALUE | static boolean f_filled ( int A [ ] , int arr_size , int sum ) {
int l , r ;
for ( int i = 0 ;
i < arr_size - 2 ;
i ++ ) {
for ( int j = i + 1 ;
j < arr_size - 1 ;
j ++ ) {
for ( int k = j + 1 ;
k < arr_size ;
k ++ ) {
if ( A [ i ] + A [ j ] + A [ k ] == sum ) {
S... | import std.stdio;
import std.math;
import std.conv;
import std.algorithm;
//TOFILL//
void main(){
bool [] results = [false, true, false, true, false, false, false, true, false, false];
int [] [] param0 = [[15, 18, 38, 47, 75, 88], [28, -2, 62, 38, 86, -86, 56, 58, 96, 6, -28, 8, 68, -16, -80, -4, 98, -92, 4, ... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.