Language: C++

#include <stdio.h>
#include <string.h>
 
#define DEBUG (0)
 
int getmin(int *array, int length);
 
int main(void)
{
  int a_num,b_num,m_num = 0;
  
  scanf("%d %d %d",&a_num, &b_num, &m_num);
  
  int price_a[a_num]= {0};
  int price_b[b_num]= {0};
  int x[m_num] = {0};
  int y[m_num] = {0};
  int c[m_num] = {0};
  int z[m_num] = {0};	/* z = x + y - c */
  
  int a_min,b_min,z_min = 0;
  int total_min = 0;
  
  /* aの価格 */
  for(int i = 0; i < a_num; i++){
    scanf("%d",&price_a[i]);
  }
  
  /* bの価格 */
  for(int i = 0; i < b_num; i++){
    scanf("%d",&price_b[i]);
  }
  
  /* x,y,c */
  for(int i = 0; i < m_num; i++){
    scanf("%d %d %d",&x[i],&y[i],&c[i]);
  }
  
  /* z計算*/
  for(int i = 0; i < m_num; i++){
    z[i] = price_a[x[i] -1 ] + price_b[y[i] - 1] - c[i];
  }
    
  a_min = getmin(price_a, a_num);
  b_min = getmin(price_b, b_num);
  z_min = getmin(z,m_num);
  
  if(a_min + b_min <= z_min){
    total_min = a_min + b_min;
  }else{
    total_min = z_min;
  }
  
  
#if DEBUG
  /* aの価格 */
  for(int i = 0; i < a_num; i++){
    printf("price_a[%d]:%d\n",i, price_a[i]);
  }
  printf("\n");
  
  /* bの価格 */
  for(int i = 0; i < b_num; i++){
    printf("price_b[%d]:%d\n",i, price_b[i]);
  }
  printf("\n");
  
  /* x,y,c */
  for(int i = 0; i < m_num; i++){
    printf("x[%d]:%d ,y[%d]:%d c[%d]:%d\n",i,x[i],i,y[i],i,c[i]);
  }
  printf("\n");
 
  /* zの値 */
  for(int i = 0; i < m_num; i++){
    printf("z[%d]:%d\n",i, z[i]);
  }
  printf("\n");
 
  printf("%d %d %d %d\n",a_min, b_min, z_min, total_min);
#endif
  
  printf("%d\n", total_min);
  
}
 
 
int getmin(int *array, int length){
  int ret = 100000;	/* 10^5 で初期化 */
 
  /* 配列arrayの最小値を取得 */
  for(int i = 0; i < length; i++){
    if(array[i] < ret){
      ret = array[i];
    }
  }
 
  return ret;
}
#include <stdio.h>
#include <string.h>

#define DEBUG (0)

int getmin(int *array, int length);

int main(void)
{
  int a_num,b_num,m_num = 0;
  
  scanf("%d %d %d",&a_num, &b_num, &m_num);
  
  int price_a[a_num]= {0};
  int price_b[b_num]= {0};
  int x[m_num] = {0};
  int y[m_num] = {0};
  int c[m_num] = {0};
  int z[m_num] = {0};	/* z = x + y - c */
  
  int a_min,b_min,z_min = 0;
  int total_min = 0;
  
  /* aの価格 */
  for(int i = 0; i < a_num; i++){
    scanf("%d",&price_a[i]);
  }
  
  /* bの価格 */
  for(int i = 0; i < b_num; i++){
    scanf("%d",&price_b[i]);
  }
  
  /* x,y,c */
  for(int i = 0; i < m_num; i++){
    scanf("%d %d %d",&x[i],&y[i],&c[i]);
  }
  
  /* z計算*/
  for(int i = 0; i < m_num; i++){
    z[i] = price_a[x[i] -1 ] + price_b[y[i] - 1] - c[i];
  }
    
  a_min = getmin(price_a, a_num);
  b_min = getmin(price_b, b_num);
  z_min = getmin(z,m_num);
  
  if(a_min + b_min <= z_min){
    total_min = a_min + b_min;
  }else{
    total_min = z_min;
  }
  
  
#if DEBUG
  /* aの価格 */
  for(int i = 0; i < a_num; i++){
    printf("price_a[%d]:%d\n",i, price_a[i]);
  }
  printf("\n");
  
  /* bの価格 */
  for(int i = 0; i < b_num; i++){
    printf("price_b[%d]:%d\n",i, price_b[i]);
  }
  printf("\n");
  
  /* x,y,c */
  for(int i = 0; i < m_num; i++){
    printf("x[%d]:%d ,y[%d]:%d c[%d]:%d\n",i,x[i],i,y[i],i,c[i]);
  }
  printf("\n");

  /* zの値 */
  for(int i = 0; i < m_num; i++){
    printf("z[%d]:%d\n",i, z[i]);
  }
  printf("\n");

  printf("%d %d %d %d\n",a_min, b_min, z_min, total_min);
#endif
  
  printf("%d\n", total_min);
  
}


int getmin(int *array, int length){
  int ret = 100000;	/* 10^5 で初期化 */

  /* 配列arrayの最小値を取得 */
  for(int i = 0; i < length; i++){
    if(array[i] < ret){
      ret = array[i];
    }
  }
 
  return ret;
}

Compiler output:
a.cc:107:5: error: redefinition of 'int main()'
  107 | int main(void)
      |     ^~~~
a.cc:8:5: note: 'int main()' previously defined here
    8 | int main(void)
      |     ^~~~
a.cc:187:5: error: redefinition of 'int getmin(int*, int)'
  187 | int getmin(int *array, int length){
      |     ^~~~~~
a.cc:88:5: note: 'int getmin(int*, int)' previously defined here
   88 | int getmin(int *array, int length){
      |     ^~~~~~