Harryxun/GPT-100-sft-dataset huggingface dataset:
Problem p03370 (python)

Fixed submission:
n, x = map(int, input().split())
m = [int(input()) for i in range(n)]
sum = 0
min = 1000000
for i in range(n):
    sum+=m[i]
    if min > m[i]: min = m[i]
x-=sum
print(n+int(x/min))

Buggy submission (verdict: Runtime Error):
#include<bits/stdc++.h>
// Begin Header {{{
using namespace std;
using ll = long long;
using P = pair<ll, ll>;
using Graph = vector<vector<ll>>;
#define rep(i,n) for(ll i=0; i<n; i++)
#define loop(i, j, n) for(ll i=j; i<n; i++)
#define all(x) (x).begin(), (x).end()
constexpr int INF  = 0x3f3f3f3f;
const long long mod=1e9+7;
const long double PI = acos(-1);
// }}} End Header

int main() {
	int n, x, ans=0, sum = 0;
	cin >> n >> x;
	vector<int> m(n);
	rep(i,n){
		cin >> m[i];
		sum+=m[i];
	}
	x-=sum;
	sort(all(m));
	cout << n+x/m[0] << endl;
	return 0;
}
Problem p03474 (python)

Fixed submission:
a, b = map(int, input().split())
s = input()
flag = 0
for i in range(a):
    if s[i]>='0' and s[i]<='9': pass
    else: flag=1
if s[a]!='-': flag=1
for i in range(a+1, len(s)):
    if s[i]>='0' and s[i]<='9': pass
    else: flag=1
if flag==1: print("No")
else: print("Yes")

Buggy submission (verdict: Runtime Error):
#include<bits/stdc++.h>
// Begin Header {{{
using namespace std;
using ll = long long;
using P = pair<ll, ll>;
using Graph = vector<vector<ll>>;
#define rep(i,n) for(ll i=0; i<n; i++)
#define loop(i, j, n) for(ll i=j; i<n; i++)
#define all(x) (x).begin(), (x).end()
constexpr int INF  = 0x3f3f3f3f;
const long long mod=1e9+7;
const long double PI = acos(-1);
// }}} End Header

int main() {
	int a, b, flag=0;
	cin >> a >> b;
	string s;
	cin >> s;
	rep(i,a){
		if(!(s[i]>='0' && s[i]<='9')) flag++; 
	}
	if(s[a] != '-') flag++;
	loop(i, a+1, s.length()){
		if(!(s[i]>='0' && s[i]<='9')) flag++;
	}
	if(flag == 0) puts("Yes");
	else puts("No");
	return 0;
}
Problem p03760 (python)

Fixed submission:
s=input()
t=input()
k=[]
for i in range(len(t)):
    k.append(s[i])
    k.append(t[i])
if len(s)>len(t):
    k.append(s[len(s)-1])
print("".join(k))

Buggy submission (verdict: Runtime Error):
s=input()
t=input()
k=[]
for i in range(len(t)):
    k.append(s[i])
    k.append(t[i])
if len(s)>len(t):
    t.append(s[len(s)-1])
print("".join(k))
Problem p03814 (python)

Fixed submission:
s=input()
f1=0
f2=0
ok=True
for i in range(len(s)):
    if s[i]=='A' and ok:
        ok=False
        f1=i
    if s[i]=='Z': f2=i
print(f2-f1+1)

Buggy submission (verdict: Runtime Error):
#include<bits/stdc++.h>
// Begin Header {{{
using namespace std;
using ll = long long;
using P = pair<ll, ll>;
using Graph = vector<vector<ll>>;
#define rep(i,n) for(ll i=0; i<n; i++)
#define loop(i, j, n) for(ll i=j; i<n; i++)
#define all(x) (x).begin(), (x).end()
constexpr int INF  = 0x3f3f3f3f;
const long long mod=1e9+7;
const long double PI = acos(-1);
// }}} End Header
int main() {
	string s;
	cin >> s;
	int f1, f2;
	rep(i,s.length()){
		if(s[i]=='A'){
			f1=i;
			break;
		}
	}
	rep(i,s.length()){
		if(s[i]=='Z') f2=i;
	}
	cout << f2-f1+1 << endl;
	return 0;
}
Problem p04030 (python)

Fixed submission:
# Begin Header {{{
from math import gcd
from collections import Counter, deque, defaultdict
from heapq import heappush, heappop, heappushpop, heapify, heapreplace, merge
from bisect import bisect_left, bisect_right, bisect, insort_left, insort_right, insort
from itertools import accumulate, product, permutations, combinations, combinations_with_replacement
# }}} End Header
# _________コーディングはここから！！___________
# ... 最小側の制約も確認した？
# ... オーバーフローしない？
s = input()
ans = []
for x in s:
    if x=='0': ans.append('0')
    elif x == '1': ans.append('1')
    else:
        if len(ans) == 0: pass
        else: ans.pop()
for t in ans: print(t, end = "")

Buggy submission (verdict: Runtime Error):
#include<bits/stdc++.h>
// Begin Header {{{
using namespace std;
using ll = long long;
using P = pair<ll, ll>;
using Graph = vector<vector<ll>>;
#define rep(i,n) for(ll i=0; i<n; i++)
#define loop(i, j, n) for(ll i=j; i<n; i++)
#define all(x) (x).begin(), (x).end()
constexpr int INF  = 0x3f3f3f3f;
const long long mod=1e9+7;
const long double PI = acos(-1);
// }}} End Header
int main() {
	string s, ans="";
	cin >> s;
	for(auto x : s){
		if(x!='B') ans+=x;
		else if(ans!="") ans.pop_back();
	}
	cout << ans << endl;
 	return 0;
}
Problem p02767 (python)

Fixed submission:
N = int(input())
li = list(map(int, input().split()))
li_2 = []

if N == 1:
    print(0)
else:
   for i in range(min(li),max(li)+1):
       cost_sum = 0
       for t in range(N):
           cost_sum += (li[t]-i) ** 2
       li_2.append(cost_sum)
   print(min(li_2))

Buggy submission (verdict: Runtime Error):

N = int(input())
li = list(map(int, input().split()))
li_2 = []

if N == 1:
    print(0)
else:
   for i in range(min(li),max(li)+1):
       cost_sum = 0
       for t in range(N):
           cost_sum += (li[t]-i) ** 2
       li_2.append(cost_sum)
print(min(li_2))
Problem p03293 (python)

Fixed submission:
S = input()
T = input()
flag = False

for i in range(len(S)):
    if flag:
        break
    if S[i] == T[0]:
        tem = i+1
        f = 1
        if tem == len(S):
            tem = 0
        for t in range(1,len(T)):
            if T[t] == S[tem]:
                tem += 1
                if tem == len(S):
                    tem = 0
            else:
                break
            if t == len(T)-1:
                flag = True
if flag:
    print('Yes')
else:
    print('No')

Buggy submission (verdict: Runtime Error):
S = input()
T = input()
flag = False
for i in range(len(S)):
    if flag:
        break
    if S[i] == T[0]:
        tem = i+1
        f = 1
        for t in range(1,len(T)):
            if T[t] == S[tem]:
                tem += 1
                if tem == len(S):
                    tem = 0
            else:
                break
            if t == len(T)-1:
                flag = True
if flag:
    print('Yes')
else:
    print('No')
Problem p03378 (python)

Fixed submission:
N,M,X = map(int, input().split())
li = list(map(int, input().split()))
a = 0
nu = 0
for i in range(1,X):
    if i == li[nu]:
        a += 1
        nu += 1
    if nu == len(li):
        break
b = len(li) - a
if a > b:
    print(b)
else:
    print(a)

Buggy submission (verdict: Runtime Error):
N,M,X = map(int, input().split())
li = list(map(int, input().split()))
an1 = 0
an2 = 0
nu = 0
for i in range(1,X):
    if i == li[nu]:
        an1 += 1
        nu += 1
for i in range(X+1,N):
    if i == li[nu]:
        an2 += 1
        nu += 1
if an1 > an2:
    print(an2)
else:
    print(an1)

Buggy submission (verdict: Runtime Error):
N,M,X = map(int, input().split())
li = list(map(int, input().split()))
an1 = 0
an2 = 0
nu = 0
for i in range(1,X+1):
    if i == li[nu]:
        an1 += 1
        nu += 1
for i in range(X+1,N):
    if i == li[nu]:
        an2 += 1
        nu += 1
if an1 > an2:
    print(an2)
else:
    print(an1)
Problem p02554 (python)

Fixed submission:
def main():
    n = int(input())
    mod = 10 ** 9 + 7 #素数
    
    def modpow(x, n, mod):
        res = 1
        while n:
            if n % 2:
                res *= x % mod
                res %= mod
            x *= x % mod
            n >>= 1
        return res

    # 全パターン:10 ** n
    all_p = modpow(10, n, mod)
    # 0を含まないパタンーン:9 ** n
    not_0 = modpow(9, n, mod)
    # 9を含まないパターン:9 ** n
    not_9 = modpow(9, n, mod)
    # 0と９を含まないパターン:8 ** n
    not_0_9 = modpow(8, n, mod)
    # 条件のパターン
    ans = all_p - not_0 - not_9 + not_0_9
    print(ans%mod)

if __name__ == '__main__':
    main()

Buggy submission (verdict: Runtime Error):
def main():
    n = int(input())
    mod = 10 ** 9 + 7 #素数
    
    def modpow(x, n, mod):
        res = 1
        while n:
            if n % 2:
                res *= x % mod
                res %= res
            x *= x % mod
            n >>= 1
        return res
 
    # 全パターン:10 ** n
    all_p = modpow(10, n, mod)
    # 0を含まないパタンーン:9 ** n
    not_0 = modpow(9, n, mod)
    # 9を含まないパターン:9 ** n
    not_9 = modpow(9, n, mod)
    # 0と９を含まないパターン:8 ** n
    not_0_9 = modpow(8, n, mod)
    # 条件のパターン
    ans = (all_p - not_0 - not_9 + not_0_9) % mod
    print(ans)
 
if __name__ == '__main__':
    main()
Problem p02584 (python)

Fixed submission:
def main():
    x, k, d = map(int, input().split())
    x = abs(x)
    count = x // d
    if count > k:
        ans = x - (k*d)
    else:
        if k % 2 == count % 2:
            ans = x - (count*d)
        else:
            ans = x - (count+1) * d
    print(abs(ans))
    
if __name__ == '__main__':
    main()

Buggy submission (verdict: Runtime Error):
def main():
    x, k, d = map(int, input().split())
    x = abs(x)
    count_p = abs(x // d) 
    count_m = abs(x // d) + 1
    if abs(x - (count_p*d)) <= abs((x - count_m*d)):
        small_count = count_p
    else:
        small_count = count_m
    if small_count > k:
        print(abs(x - (k * d)))
    else:
        if x - (small_count*d) != 0:
            if (k % small_count) % 2 == 0:
                print(abs(x - (small_count*d)))
            else:
                print(abs(x - (small_count*(d+1))))
        else:
            if (k % small_count) % 2 == 0:
                print(d)
            else:
                print(0)

if __name__ == '__main__':
    main()
Problem p02608 (python)

Fixed submission:
from itertools import product 
from collections import Counter
def main():
    N = int(input())
    pattern = list(product(list(range(1, 100)),repeat=3))
    l = list()
    for i in pattern:
        x, y, z = i
        n = x**2 + y**2 + z**2 + x*y + y*z + z*x
        l.append(n)
    ans = Counter(l)
    for i in range(1, N+1):
        if ans.get(i) == None:
            print(0)
        else:
            print(ans.get(i))

if __name__ == '__main__':
    main()

Buggy submission (verdict: Runtime Error):
n = int(input())
ans = [0] * (n+1)
 
for x in range(1,101):
    for y in range(1,101):
        for z in range(1,101):
            n = x**2 + y**2 + z**2 + x*y + y*z + z*x
            if n <= N:
                ans[n] += 1
print(*ans[1:], sep='\n')
Problem p02613 (python)

Fixed submission:
from collections import Counter

def main():
    n = int(input())
    s = [input() for i in range(n)]
    ac = 0    
    wa = 0
    tle = 0
    re = 0
    for i in s:
        if i == 'AC':
            ac += 1
        elif i == 'WA':
            wa += 1
        elif i == 'TLE':
            tle += 1
        elif i == 'RE':
            re += 1
    print('AC x ', ac, sep='')
    print('WA x ', wa, sep='')
    print('TLE x ', tle, sep='')
    print('RE x ', re, sep='')

if __name__ == '__main__':
    main()

Buggy submission (verdict: Runtime Error):
n = int(input())
s = [input() for i in range(n)]
for v in ['AC', 'WA', 'TLE', 'RE']:
    print(v, 'x',  a.count(v))
Problem p02639 (python)

Fixed submission:
def main():
    x = list(map(int, input().split()))
    ans = x.index(0) + 1
    print(ans)

if __name__ == '__main__':
    main()

Buggy submission (verdict: Runtime Error):
def main():
    n = int(input())
    a = list(map(int, input().split()))
    a_s = sorted(a)
    a_set = set(a_s)
    maxv = max(a)
    res = [0] * maxv
    rep = 0
    for i in a_s:
        if res[i-1] == 0:
            for j in range(i, maxv+1, i):
                res[j-1] += 1
        else:
            res[i-1] +=1
    cnt = 0
    for i in range(n):
        if res[a[i]-1] == 1:
            cnt += res[a[i]-1]
    print(cnt)

if __name__ == '__main__':
    main()
Problem p02640 (python)

Fixed submission:
def main():
    x, y = map(int, input().split())
    l = list()
    l.append(2*x)
    for i in range(1, x+1):
        l.append(2*x + i*2)
    if y in l:
        print('Yes')
    else:
        print('No')

if __name__ == '__main__':
    main()

Buggy submission (verdict: Runtime Error):
def main():
    x = int(input())
    y = int(input())
    l = list()
    l.append(2*x)
    for i in range(1, x+1):
        l.append(2*x + i*2)
    if y in l:
        print('Yes')
    else:
        print('No')
        
if __name__ == '__main__':
    main()
Problem p02684 (python)

Fixed submission:
from copy import deepcopy

def main():
    n, k = map(int, input().split())
    a = [int(x)-1 for x in input().split()]
    visited = set()
    i = 0
    cnt = 0
    # 途中で前に行ったところに行ったら終わり
    # kが小さくてcnt == kになってもおわり
    while True:
        if i in visited:
            break
        visited.add(i)
        cnt += 1
        i = a[i]
        if cnt == k:
            print(i+1)
            exit()
    k -= cnt
    period = list()
    period.append(i)
    i = a[i]
    # 何回で同じ場所に戻るか
    while True:
        if i == period[0]:
            break
        period.append(i)
        i = a[i]
    # 余り
    mod = k % len(period)
    ans = period[mod]
    print(ans+1)

if __name__ == '__main__':
    main()

Buggy submission (verdict: Runtime Error):
from copy import deepcopy

def main():
    n, k = map(int, input().split())
    a = [int(x)-1 for x in input().split()]
    cnt = 0
    next_posi = 0
    # 何回できたことのあるところにいくか
    visited = set()
    visited.add(0)
    for _ in range(n):
        next_posi = a[next_posi]
        cnt += 1
        if next_posi not in visited:
            visited.add(next_posi)
        else:
            break
    # print('cnt', cnt)
    cnt2 = 0
    visited_posi = deepcopy(next_posi)
    for _ in range(k-cnt):
        next_posi = a[next_posi]
        cnt2 += 1
        if next_posi == visited_posi:
            break
    # print('cnt2', cnt2)
    mod = (k-cnt) % cnt2
    # print('mod', mod)
    for _ in range(mod):
        next_posi = a[next_posi]
    print(next_posi+1)

if __name__ == '__main__':
    main()
Problem p02687 (python)

Fixed submission:
def main():
    s = input()
    if s == 'ABC':
        print('ARC')
    else:
        print('ABC')
if __name__ == '__main__':
    main()

Buggy submission (verdict: Runtime Error):
def main():
    s = input()
    if s == 'ABC':
        print('ARC')
    else:
        print('ABC')
if __name__ == '__main__':
    main(
Problem p02702 (python)

Fixed submission:
def main():
    s = input()
    s_len = len(s)
    mod = 2019
    d = [0] * mod
    d[0] = 1
    rev_num = 0
    t = 1
    # 2以上なら共通するmodがあったということになる
    for i in reversed(s):
        rev_num += int(i) * t
        rev_num %= mod
        d[rev_num] += 1
        t *= 10
        t %= mod
    # 2以上同じmodがあったらそこから2つ選ぶ選び方
    # それを全てのmodで
    print(sum(i*(i-1)//2 for i in d))
 
if __name__ == '__main__':
    main()

Buggy submission (verdict: Runtime Error):
from math import pow

def main():
    s = input()
    s = s[::-1]
    s_len = len(s)
    mod = 2019
    d = [0] * mod
    d[0] = 1
    rev_num = 0
    # 2以上なら共通するmodがあったということになる
    for i in range(s_len):
        rev_num += int(s[i]) * int(pow(10, i)%mod)
        rev_num %= mod
        d[rev_num] += 1
    # 2以上同じmodがあったらそこから2つ選ぶ選び方
    # それを全てのmodで
    print(sum(i*(i-1)//2 for i in d))
 
if __name__ == '__main__':
    main()

Buggy submission (verdict: Runtime Error):
def main():
    s = input()
    s_len = len(s)
    s_rev = reversed(s)
    mod = 2019
    d = [0] * mod
    d[0] = 1
    rev_num = 0
    # 2以上なら共通するmodがあったということになる
    for i in range(l_len):
        rev_num += int(s_rev(i)) * (10**i%mod)
        rev_num %= mod
        d[rev_num] += 1
    # 2以上同じmodがあったらそこから2つ選ぶ選び方
    # それを全てのmodで
    print(sum(i*(i-1)//2 for i in d))

if __name__ == '__main__':
    main()
Problem p02708 (python)

Fixed submission:
def main():
    n, k = map(int, input().split())
    mod = 10 ** 9 + 7
    cnt = 0
    for i in range(k, n+2):
        l = (i-1)*i//2
        h = (n+n-i+1)*i//2
        cnt += h - l + 1
    print(cnt % mod)

if __name__ == '__main__':
    main()

Buggy submission (verdict: Runtime Error):


def main():
    mod = 10 ** 9 + 7
    cnt = 0
    for i in range(k, n+2):
        l = (i-1)*i//2
        h = (n+n-i+1)*i//2
        cnt += h - l + 1
    print(cnt % mod)

if __name__ == '__main__':
    main()
Problem p02732 (python)

Fixed submission:
from collections import Counter
 
def main():
    n = int(input())
    A = [int(x) for x in input().split()]
    a_c = Counter(A)
    res = [int(v*(v-1)/2) for v in a_c.values()]
    cnt = sum(res)
    for a in A:
        ans = (cnt - (a_c[a]-1))
        print(ans)
 
if __name__ == '__main__':
    main()

Buggy submission (verdict: Runtime Error):
from collections import Counter
from copy import deepcopy
import sys
input = sys.stdin.readline

def main():
    n = int(input())
    A = [int(x) for x in input().split()]
    a_c= Counter(A)
    values = a_c.values()
    val_cnt = Counter(values
    for a in A:
        val_cnt_c = deepcopy(val_cnt)
        val_cnt_c[a_c[a]] -= 1
        val_cnt_c[a_c[a]-1] += 1
        cnt = {int(k*(k-1)/2*v) if k > 1 else 0 for k, v in val_cnt_c.items()}
        print(sum(cnt))
    
if __name__ == '__main__':
    main()

Buggy submission (verdict: Runtime Error):
from operator import mul
from functools import reduce
from collections import Counter
from copy import deepcopy
import sys
sys.setrecursionlimit(100000)

def main():
    nCr = {}
    def cmb(n, r):
        if r == 0 or r == n: return 1
        if r == 1: return n
        if (n,r) in nCr: return nCr[(n,r)]
        nCr[(n,r)] = cmb(n-1,r) + cmb(n-1,r-1)
        return nCr[(n,r)]

    n = int(input())
    A = [int(x) for x in input().split()]
    a_c= Counter(A)
    cnt = 0
    for a in A:
        a_c_c = deepcopy(a_c)
        a_c_c[a] = a_c_c[a] - 1
        values = a_c_c.values()
        val_cnt = Counter(values)
        cnt = {cmb(k, 2) * v  if k > 1 else 0 for k, v in val_cnt.items()}
        print(sum(cnt))
    
if __name__ == '__main__':
    main()

Buggy submission (verdict: Runtime Error):
from operator import mul
from functools import reduce
from collections import Counter
from copy import deepcopy

def main():
    nCr = {}
    def cmb(n, r):
        if r == 0 or r == n: return 1
        if r == 1: return n
        if (n,r) in nCr: return nCr[(n,r)]
        nCr[(n,r)] = cmb(n-1,r) + cmb(n-1,r-1)
        return nCr[(n,r)]

    n = int(input())
    A = [int(x) for x in input().split()]
    a_c= Counter(A)
    cnt = 0
    for a in A:
        a_c_c = deepcopy(a_c)
        a_c_c[a] = a_c_c[a] - 1
        values = a_c_c.values()
        val_cnt = Counter(values)
        cnt = {cmb(k, 2) * v  if k > 1 else 0 for k, v in val_cnt.items()}
        print(sum(cnt))
    
if __name__ == '__main__':
    main()
Problem p02768 (python)

Fixed submission:
def main():
    n, a, b = map(int, input().split())
    mod = 10 ** 9 + 7 #素数
    
    def modpow(x, n, mod):
        res = 1
        while n:
            if n % 2:
                res *= x % mod
            x *= x % mod
            n >>= 1
        return res
    
    def cmb(n, r):
        # 分子(n*(n-1)*...*(n-r+1))
        nume = 1
        for i in range(n-r+1, n+1):
            nume = nume * i % mod
        # 分母（1*2*...*r）
        deno = 1
        for j in range(1, r+1):
            deno = deno * j % mod
        d = modpow(deno, mod-2, mod)
        return nume * d
    
    all_cmb = pow(2, n, mod) - 1
    bad_a = cmb(n, a)
    bad_b = cmb(n, b)    
    print((all_cmb-bad_a-bad_b) % mod)

if __name__ == '__main__':
    main()

Buggy submission (verdict: Runtime Error):
def main():
    n, a, b = map(int, input().split())
    mod = 10 ** 9 + 7 #素数
    
    def modpow(x, n, mod):
        res = 1
        while n:
            if n % 2:
                res *= x % mod
            x *= x % mod
            n >>= 1
        return res
    
    def cmb(n, r, mod):
        # 分子(n*(n-1)*...*(n-r+1))
        nume = 1
        for i in range(n-r+1, n+1):
            nume = nume * i
        # 分母（1*2*...*r）
        deno = 1
        for j in range(1, r+1):
            deno = deno * jc # % mod
        d = modpow(deno, mod-2, mod)
        return nume * d# % mod
    
    all_cmb = pow(2, n, mod) - 1
    bad_a = cmb(n, a, mod)
    bad_b = cmb(n, b, mod)    
    print((all_cmb-bad_a-bad_b) % mod)

if __name__ == '__main__':
    main()

Buggy submission (verdict: Runtime Error):
def main():
    n, a, b = map(int, input().split())
    mod = 10 ** 9 + 7 #素数
    
    def modpow(x, n, mod):
        res = 1
        while n:
            if n % 2:
                res *= x % mod
            x *= x % mod
            n >>= 1
        return res
    
    def cmb(n, r):
        # 分子(n*(n-1)*...*(n-r+1))
        nume = 1
        for i in range(n-r+1, n+1):
            nume = nume * i % mod
        # 分母（1*2*...*r）
        deno = 1
        for j in range(1, r+1):
            deno = deno * j % mod
        d = modpow(deno, mod-2, mod)
        return nume * d
    
    all_cmb = pow(2, n, mod) -　1
    bad_a = cmb(n, a)
    bad_b = cmb(n, b)    
    print((all_cmb-bad_a-bad_b) % mod)

if __name__ == '__main__':
    main()
Problem p02780 (python)

Fixed submission:
def main():
    n, k = map(int, input().split())
    P = [int(x) for x in input().split()]
    p_e = list()
    exp = 0
    for p in P:
        # 期待値
        # 累積和
        exp += (1+p)/2
        p_e.append(exp)  
    if n == k:
        print(p_e[-1])
    else:
        # 初期値
        maxv = p_e[k-1] - p_e[0]
        for i in range(1, n-k):
            # 隣接するk個の期待値の和
            p_sum = p_e[k+i] - p_e[i]
            maxv = max(maxv, p_sum)
        print(maxv)

if __name__ == '__main__':
    main()

Buggy submission (verdict: Runtime Error):
for p in P:
    # 期待値
    # 累積和
    exp += (1+p)/2
    p_e.append(exp)  
if n == k:
    print(p_e[-1])
else:
    # 初期値
    maxv = p_e[k-1] - 0
    for i in range(1, n-k):
        # 隣接するk個の期待値の和
        p_sum = p_e[k+i] - p_e[i]
        maxv = max(maxv, p_sum)
    print(maxv)

Buggy submission (verdict: Runtime Error):
def main():
    n, k = map(int, input().split())
    P = [int(x) for x in input().split()]
    exp = list()
    for p in P:
        # 期待値
        exp.append((1+p)/2)
    p_e = list()
    e_cum = 0
    for i in exp:
        # 累積和
        e_cum += i
        p_e.append(e_cum)
    # maxv = 0
    maxv = p_e[k] - p_e[0]
    for i in range(1, n-k):
        # 隣接するk個の期待値の和
        p_sum = p_e[k+i] - p_e[i]
        maxv = max(maxv, p_sum)
    print(maxv)

if __name__ == '__main__':
    main()

Buggy submission (verdict: Runtime Error):
def main():
    n, k = map(int, input().split())
    P = [int(x) for x in input().split()]
    p_e = list()
    exp = 0
    for p in P:
        # 期待値
        # 累積和
        exp += (1+p)/2
        p_e.append(exp)
    maxv = p_e[k] - p_e[0]
    for i in range(1, n-k):
        # 隣接するk個の期待値の和
        p_sum = p_e[k+i] - p_e[i]
        maxv = max(maxv, p_sum)
    print(maxv)

if __name__ == '__main__':
    main()
Problem p03030 (python)

Fixed submission:
def main():
    n = int(input())
    ll = list()
    for i in range(n):
        tmp = list(map(str, input().split()))
        tmp[1] = int(tmp[1])
        tmp.append(i+1)
        ll.append(tmp)
    ll_s = sorted(ll, key=lambda x:(x[0],-x[1]))
    for i in ll_s:
        print(i[2])

if __name__ == '__main__':
    main()

Buggy submission (verdict: Runtime Error):
def main():
    n = int(input())
    ll = list()
    for i in range(n):
        tmp = list(map(str, input().split()))
        tmp[1] = int(tmp[1])
        tmp.append(i+1)
        ll.append(tmp)
    print(ll)
    
    ll_s = sorted(ll, key=lambda x:(x[0],-x[1]))
    print(ll_s)
    for i in ll_s:
        print(i[2][0])
        
if __name__ == '__main__':
    main()
Problem p03035 (python)

Fixed submission:
def main():
    a, b = map(int, input().split())
    if a >= 13:
        print(b)
    elif a >= 6:
        print(int(b/2))
    else:
        print(0)
if __name__ == '__main__':
    main()

Buggy submission (verdict: Runtime Error):
def main():
    a, b = map(int, input().split())
    if a >= 13:
        print(b)
    elif a >= 6:
        print(int(b/2))
    else:
        print(0)
if __name__ == '__main__':
    main(
Problem p03720 (python)

Fixed submission:
def main():
    n, m = map(int, input().split())
    ab = [list(map(int, input().split())) for i in range(m)]
    res = [0] * n
    for i in ab:
        res[i[0] - 1] += 1
        res[i[1] - 1] += 1
    for i in res:
        print(i)
if __name__ == '__main__':
    main()

Buggy submission (verdict: Runtime Error):
def main():
    n, m = map(int, input().split())
    ab = [list(map(int, input().split())) for i in range(m)]
    res = [0] * n
    for i in ab:
        res[i[0] - 1] += 1
        res[i[1] - 1] += 1
    for i in res:
        print(i)
if __name__ == '__main__':
    main(