Python
N = int(input())
A = list(map(int, input().split()))
# 下記でもOK
# A = [int(i) for i in input().split()]
sum = 0
for i in A:
sum += i
print(sum)
PHP
<?php
$N = fgets(STDIN);
$A = explode(" ",fgets(STDIN));
$sum = 0;
for ($i=0; $i<=count($A); $i++){
$sum += $A[$i];
}
print($sum);
?>
各言語の挙動の違いに手こずられますね汗
Python
N,A,B = map(int,input().split())
arr = [int(i) for i in input().split()]
sum = 0
for i in range(A-1,B):
sum += arr[i]
print(sum)
PHP
<?php
list($N,$A,$B) = explode(" ",fgets(STDIN));
$arr = explode(" ",fgets(STDIN));
$sum = 0;
for ($i=$A; $i<=$B; $i++){
$sum += $arr[$i-1];
}
print($sum);
?>