public static void solve ( FastReader in , PrintWriter out , int nTestCase ) {
  int n = in . nextInt ( ) , sum = in . nextInt ( ) ;
  if ( n == 1 ) out . println ( sum * ( long ) sum ) ;
  else if ( sum == 1 ) out . println ( 1 ) ;
  else {
    if ( sum % n == 0 ) out . println ( n * ( ( sum / n ) * ( sum / n ) ) ) ;
    else {
      long ans = 0 ;
      int mx = ( sum / n ) ;
      int rem = ( sum % n ) ;
      ans = rem * ( ( mx + 1 ) * ( long ) ( mx + 1 ) ) + ( ( n - rem ) * ( mx ) * ( long ) ( mx ) ) ;
      out . println ( ans ) ;
    }
  }
}

public static void solve ( FastReader in , PrintWriter out , int nTestCase ) { int n = in . nextInt ( ) , sum = in . nextInt ( ) ; if ( n == 1 ) out . println ( sum * ( long ) sum ) ; else if ( sum == 1 ) out . println ( 1 ) ; else { if ( sum % n == 0 ) out . println ( n * ( ( sum / n ) * ( sum / n ) ) ) ; else { long ans = 0 ; int mx = ( sum / n ) ; int rem = ( sum % n ) ; ans = rem * ( ( mx + 1 ) * ( long ) ( mx + 1 ) ) + ( ( n - rem ) * ( mx ) * ( long ) ( mx ) ) ; out . println ( ans ) ; } } }
(method_declaration (modifiers) type: (void_type) name: (identifier) parameters: (formal_parameters (formal_parameter type: (type_identifier) name: (identifier)) (formal_parameter type: (type_identifier) name: (identifier)) (formal_parameter type: (integral_type) name: (identifier))) body: (block (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier) value: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list))) declarator: (variable_declarator name: (identifier) value: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list)))) (if_statement condition: (parenthesized_expression (binary_expression left: (identifier) right: (decimal_integer_literal))) consequence: (expression_statement (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (binary_expression left: (identifier) right: (cast_expression type: (integral_type) value: (identifier)))))) alternative: (if_statement condition: (parenthesized_expression (binary_expression left: (identifier) right: (decimal_integer_literal))) consequence: (expression_statement (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (decimal_integer_literal)))) alternative: (block (if_statement condition: (parenthesized_expression (binary_expression left: (binary_expression left: (identifier) right: (identifier)) right: (decimal_integer_literal))) consequence: (expression_statement (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (binary_expression left: (identifier) right: (parenthesized_expression (binary_expression left: (parenthesized_expression (binary_expression left: (identifier) right: (identifier))) right: (parenthesized_expression (binary_expression left: (identifier) right: (identifier))))))))) alternative: (block (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier) value: (decimal_integer_literal))) (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier) value: (parenthesized_expression (binary_expression left: (identifier) right: (identifier))))) (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier) value: (parenthesized_expression (binary_expression left: (identifier) right: (identifier))))) (expression_statement (assignment_expression left: (identifier) right: (binary_expression left: (binary_expression left: (identifier) right: (parenthesized_expression (binary_expression left: (parenthesized_expression (binary_expression left: (identifier) right: (decimal_integer_literal))) right: (cast_expression type: (integral_type) value: (parenthesized_expression (binary_expression left: (identifier) right: (decimal_integer_literal))))))) right: (parenthesized_expression (binary_expression left: (binary_expression left: (parenthesized_expression (binary_expression left: (identifier) right: (identifier))) right: (parenthesized_expression (identifier))) right: (cast_expression type: (integral_type) value: (parenthesized_expression (identifier)))))))) (expression_statement (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (identifier)))))))))))