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

Fixed submission:

def is_prime(x):
    # 解説見た
    if x <= 1:
        return True
    i = 2
    while i * i <= x:
        if x % i == 0:
            return True
        i += 1
    return False


def main():
    X = int(input())
    p = X
    while is_prime(p):
        p += 1
    print(p)

if __name__ == "__main__":
    main()

Buggy submission (verdict: Runtime Error):

def is_prime(x: int)->None:
    # 解説見た
    if x <= 1:
        return True
    i: int = 2
    while i * i <= x:
        if x % i == 0:
            return True
        i += 1
    return False


def main()->None:
    X: int = int(input())
    p: int = X
    while is_prime(p):
        p += 1
    print(p)

if __name__ == "__main__":
    main()
Problem p02847 (python)

Fixed submission:
s = input()


if s == "SUN":
    print(7)
if s == "MON":
    print(6)
if s == "TUE":
    print(5)
if s == "WED":
    print(4)
if s == "THU":
    print(3)
if s == "FRI":
    print(2)
if s == "SAT":
    print(1)

Buggy submission (verdict: Runtime Error):
s = input()

if s == "SUN":
  return 7
if s == "MON":
  return 6
if s == "TUE":
  return 5
if s == "WED":
  return 4
if s == "THU":
  return 3
if s == "FRI":
  return 2
if s == "SAT":
  return 1
Problem p02859 (python)

Fixed submission:
r = int(input())
print(r**2)

Buggy submission (verdict: Runtime Error):
r = map(int(), input())
print(r**2)
Problem p02933 (python)

Fixed submission:
def main():
    a = int(input())
    s = input()
    if a >= 3200:
        print(s)
    else:print("red")

if __name__ == "__main__":
    main()

Buggy submission (verdict: Runtime Error):
def main():
    a = int(input())
    s = input()
    if a >= 3200:
        pritn(s)
    else:print("red")

if __name__ == "__main__":
    main()
Problem p03767 (python)

Fixed submission:


def main()->None:
    # 解説見た
    # 強さを弱い順に並べて、初めからN番目までは各チームの１番弱い人
    # N番から２N番は各チームで２番目に強い人
    N = int(input()) # team数
    a = list(map(int, input().split()))
    sorted_a = sorted(a)
    
    sum_a = 0 # ２番目の人の和
    range_N = range(N)
    for i in range(N):
        sum_a += sorted_a[3*N - 2*i - 2]
    print(sum_a)


if __name__ == "__main__":
    main()

Buggy submission (verdict: Runtime Error):
from typing import Tuple, List

def main()->None:
    # ヒント見たけど参考にしてない
    N, x = map(int, input().split())
    a:List[int] = list(map(int, input().split()))
    sorted_a:List[int] = sorted(a) # 小さい順にならべる
    count:int = 0 # 何回配ったか
    for d in sorted_a:
        x -= d
        if x < 0: # 持ってた量が配る総量より少なかった時
            break
        count += 1
    # ちょうど配れない、必要な量より多く持ってた時はおおもらう人が出てくる。
    # 幸福人数の最大を求めればいいから余りを全部一人にあげればいいから−１
    if x > 0:
        print(count-1)
    else: # ちょうどの時はcount=N,持ってた量が配る総量より少なかった時は配れた人数
        print(count)

if __name__ == "__main__":
    main()
Problem p03785 (python)

Fixed submission:




def main()->None:
    N, C, K = map(int, input().split())
    range_N = range(N)
    T = [int(input()) for i in range_N] # バスの出発時刻
    T = sorted(T)
    
    bus = 0
    passenger = 0
    start = 0

    for i in range_N:
        if passenger == 0:
            start = T[i] + K
            passenger = 1

        elif passenger == C:
            bus += 1
            start = T[i] + K
            passenger = 1

        else:
            if T[i] > start:
                bus += 1
                start = T[i] + K
                passenger = 1

            else:
                passenger += 1
    print(bus+1)


if __name__ == "__main__":
    main()

Buggy submission (verdict: Runtime Error):




def main()->None:
    N, C, K = map(int, input().split())
    range_N = range(N)
    T = [int(input()) for i in range_N] # バスの出発時刻
    T = sorted(T)
    
    bus = 0
    passenger = 0
    start = 0

    for i in range_N:
        if passenger == 0:
            start = t[i] + K
            passenger = 1

        elif passenger == C:
            bus += 1
            start = t[i] + K
            passenger = 1

        else:
            if t[i] > start:
                bus += 1
                start = t[i] + K
                passenger = 1

            else:
                passenger += 1
    print(bus+1)


if __name__ == "__main__":
    main()

Buggy submission (verdict: Runtime Error):




def main()->None:
    N, C, K = map(int, input().split())
    range_N = range(N)
    T = [int(i) for i in range_N] # バスの出発時刻
    T = sorted(T)
    
    bus = 0
    passenger = 0
    start = 0

    for i in range_N:
        if passenger == 0:
            start = t[i] + K
            passenger = 1

        elif passenger == C:
            bus += 1
            start = t[i] + K
            passenger = 1

        else:
            if t[i] > start:
                bus += 1
                start = t[i] + K
                passenger = 1

            else:
                passenger += 1
    print(bus+1)


if __name__ == "__main__":
    main()
Problem p02831 (python)

Fixed submission:
import fractions
a,b = map(int,input().split())
gcd = fractions.gcd(a,b)

print(a*b//gcd)

Buggy submission (verdict: Runtime Error):
import math 
a,b = map(int,input().split())
gcd = math.gcd(a,b)

if gcd !=1:
    left = 1
    right = 10**5
    while right -left > 1:
        m = (right+left) // 2 
        if  gcd * m < a * b:
            left = m
        else:
            right = m

    print(right)

else:
    print(a*b)
Problem p02881 (python)

Fixed submission:
def make_divisors(n):
    divisors = []
    for i in range(1, int(n**0.5)+1):
        if n % i == 0:
            divisors.append(i)
            if i != n // i:
                divisors.append(n//i)

    # divisors.sort()
    return divisors

def main():
    Min = 2000000000000
    divisors = make_divisors(int(input()))
    if len(divisors)%2==1:
        divisors.append(divisors[len(divisors)-1])
    #print(divisors)
    for i in range(0,len(divisors)-1,2):
        Min = min(divisors[i]+divisors[i+1],Min)
    print(Min-2)

main()

Buggy submission (verdict: Runtime Error):
def make_divisors(n):
    divisors = []
    for i in range(1, int(n**0.5)+1):
        if n % i == 0:
            divisors.append(i)
            if i != n // i:
                divisors.append(n//i)

    # divisors.sort()
    return divisors

def main():
    Min = 2000000000000
    divisors = make_divisors(int(input()))
    if len(divisors)%2==1:
        divisors[len(divisors)] = divisors[len(divisors)-1]
    #print(divisors)
    for i in range(0,len(divisors)-1,2):
        Min = min(divisors[i]+divisors[i+1],Min)
    print(Min-2)

main()
Problem p02915 (python)

Fixed submission:
n = int(input())
print(n**3)

Buggy submission (verdict: Runtime Error):
n = int(input())
print(n**3)2
Problem p02570 (python)

Fixed submission:
D,T,S=input().split()
if(float(T)>=(float(D)/float(S))):
  print("Yes")
else:
  print("No")

Buggy submission (verdict: Runtime Error):
D,T,S=input()
if(D==(S*T)):
  print("Yes")
else:
  print("No")
Problem p02571 (python)

Fixed submission:
import sys
def minimumChar(T,S): 
    n, m = len(T), len(S) 
    ans = sys.maxsize 
    for i in range(m - n + 1): 
        minRemovedChar = 0
        for j in range(n): 
            if (T[j] != S[i + j]): 
                minRemovedChar += 1
        ans = min(minRemovedChar, ans) 
    return ans 
      
S=input()
T=input()

print(minimumChar(T,S))

Buggy submission (verdict: Runtime Error):
def minimumChar(S,T): 
    n, m = len(S), len(T) 
    ans = sys.maxsize 
    for i in range(m - n + 1): 
        minRemovedChar = 0
        for j in range(n): 
            if (S[j] != T[i + j]): 
                minRemovedChar += 1
        ans = min(minRemovedChar, ans) 
    return ans 
      
S=input()
T=input()

print(minimumChar(S, T))
Problem p02623 (python)

Fixed submission:
import bisect
from collections import deque

n,m,k = map(int, input().split())
a = list(map(int, input().split()))
b = list(map(int, input().split()))

sa, sb = [0], [0]
s = 0
for i in range(n):
    s += a[i]
    if s > k:
        break
    sa.append(s)

s = 0
for i in range(m):
    s += b[i]
    if s > k:
        break
    sb.append(s)

ans = 0

# sa, sbの組み合わせ中の最大合計となる値を取得
for i in range(len(sa)):
    l = k - sa[i]
    if l < 0:
        break

    num = bisect.bisect_right(sb, l) - 1
    ans = max (ans, num+i)

print(ans)

Buggy submission (verdict: Runtime Error):
import bisect
from collections import deque

n,m,k = map(int, input().split())
a = deque(map(int, input().split()))
b = deque(map(int, input().split()))

x = deque()
x.append(0)
for i in range(n + m):
    num = 0
    if len(a) == 0:
        num = b.popleft()
    elif len(b) == 0:
        num = a.popleft()
    elif a[0] == b[0]:
        if a[1] < b[1]:
            num = a.popleft()
        else:
            num = b.popleft()
    elif a[0] <= b[0]:
        num = a.popleft()
    else:
        num = b.popleft()
    x.append(num + x[-1])

x.popleft()

# 二分探索
pos = bisect.bisect_right(x, k)
print(pos)
Problem p03013 (python)

Fixed submission:
N, M = map(int, input().split())
A = [int(input()) for _ in range(M)]

MOD = 10**9 + 7

safe = [True] * (N+1)
for i in range(len(A)):
    safe[A[i]] = False

dp = [0] * (N+1)
dp[0] = 1
if safe[1]:
    dp[1] = 1

for i in range(2, N+1):
    if(safe[i]):
        dp[i] = dp[i-1] + dp[(i-2)]
        dp[i] = dp[i] % MOD
    else:
        dp[i] = 0

print(dp[N])

Buggy submission (verdict: Runtime Error):
MOD = 10**9 + 7
N,M = map(int, input().split())
a = [int(input()) for _ in range(M)]

aa = [True] * (N+1)
for i in a:
    aa[i] = False

dp = [0] * (N+1)
dp[0] = 1
if aa[1]:
    dp[1] = 1

for i in range(2,N+1):
    if (aa[i] == False):
        dp[i] = 0
        continue
    dp[i] = dp[i-1] + dp[i-2]
    dp[i] =  dp[i] % MOD
print(dp[i])

Buggy submission (verdict: Runtime Error):
MOD = 10**9 + 7
N,M = map(int, input().split())
a = [int(input()) for _ in range(M)]

aa = [True] * (N+1)
for i in a:
    aa[i] = False

dp = [0] * (N+1)
dp[0] = 1
dp[1] = 0
if aa[1]:
    dp[1] = 1

for i in range(2,N+1):
    if (aa[i] == False):
        dp[i] = 0
        continue
    dp[i] = dp[i-1] + dp[i-2]
    dp[i] %= MOD
print(dp[i])

Buggy submission (verdict: Runtime Error):
MOD = 10**9 + 7
N,M = map(int, input().split())
a = [int(input()) for _ in range(M)]

aa = [True] * (N+1)
for i in a:
    aa[i] = False

dp = [0] * (N+1)
dp[0] = 1
if aa[1]:
    dp[1] = 1

for i in range(2,N+1):
    if (aa[i] == False):
        dp[i] = 0
        continue
    dp[i] = dp[i-1] + dp[i-2]
    dp[i] %= MOD
print(dp[i])

Buggy submission (verdict: Runtime Error):
N,M = map(int, input().split())

MOD = 10**9 + 7

a = [int(input()) for _ in range(M)]

dp = [0] * (N+1)
dp[0] = 1
dp[1] = 1
dp[2] = 2

aa = [True] * (N+1)
for i in a:
    aa[i] = False

for i in range(1,N+1):
    if (aa[i] == False):
        dp[i] = 0
        continue
    dp[i] = (dp[i-1]) + (dp[i-2])
print(dp[i]%MOD)

Buggy submission (verdict: Runtime Error):
N,M = map(int, input().split())

MOD = 10**9 + 7

a = [int(input()) for _ in range(M)]

dp = [0] * (N+1)
dp[0] = 1
dp[1] = 1
dp[2] = 2

for i in range(1,N+1):
    if (i in a):
        dp[i] = 0
        continue
    dp[i] = (dp[i-1]) + (dp[i-2])
print(dp[i]%MOD)
Problem p02595 (python)

Fixed submission:
import math

w = input()
total = 0
x = 0
y = 0


i = w.index(' ')
n = w[0:i]
d = w[(i+1):]
n = int(n)
d = float(d)


for x in range(n):
    w = input()

    i = w.index(' ')
    y = w[0:i]
    x = w[(i+1):]

    x = int(x)
    y = int(y)

    if math.sqrt((x*x)+(y*y)) <= d:
        total = total+1

print (total)

Buggy submission (verdict: Runtime Error):
import math

w = input()
total = 0
x = 0
y = 0


n = w[0]
d = w[2]
n = int(n)
d = float(d)


for x in range(n):
    w = input()

    i = w.index(' ')
    y = w[0:i]
    x = w[(i+1):]

    x = int(x)
    y = int(y)

    if math.sqrt((x*x)+(y*y)) <= d:
        total = total+1

print (total)
Problem p02577 (python)

Fixed submission:
N = list(input())
c = 0

for n in N:
  c += int(n)

if c % 9 == 0:
  print('Yes')
else:
  print('No')

Buggy submission (verdict: Runtime Error):
N = list(int(input()).split())
c = 0

for n in N:
  c += n

if c % 9 == 0:
  print('Yes')
else:
  print('No')
Problem p02578 (python)

Fixed submission:
N=int(input())
A=list(map(int, input().split()))
c=0
for i in range(N-1):
  if A[i]>A[i+1]:
    c+=A[i]-A[i+1]
    A[i+1]=A[i]
print(c)

Buggy submission (verdict: Runtime Error):
N = input()
A = list(map(int, input().split()))
c = 0

a = A.index(max(A))

while a != 0:
  for n in A[a+1:]:
    c += (max(A) - n)
    del A[a:]
    a = A.index(max(A))
    
print(c)
Problem p02594 (python)

Fixed submission:
a = int(input())

if a >= 30:
  print('Yes')
else:
  print('No')

Buggy submission (verdict: Runtime Error):
a = input()

if a >= 30:
  print('Yes')
else:
  print('No')
Problem p02693 (python)

Fixed submission:
k = int(input())
a,b = map(int,input().split())

for i in range(a,b + 1):
  if i % k == 0:
    print('OK')
    break
else:
  print('NG')

Buggy submission (verdict: Runtime Error):
K = input()
A = input()
B = input()

i = 1
r = i * K
while r <= B:
  if r >= A:
    print('YES')
  elif r < A:
    i += 1
    r =  i * K
  else:
    print('NO')
Problem p02753 (python)

Fixed submission:
s=input()
if 'A' in s and 'B' in s:
  print('Yes')
else:
  print('No')

Buggy submission (verdict: Runtime Error):
s=input()
if 'A','B' in s:
  print('Yes')
else:
  print('No')

Buggy submission (verdict: Runtime Error):
s=input()
if A,B in s:
  print('Yes')
else:
  print('No')
Problem p02987 (python)

Fixed submission:
s=list(input())
a=len(set(s))
ans='No'
if a==2:
  b=len([t for t in s if t==s[0]])
  if b==2:
    ans='Yes'
print(ans)

Buggy submission (verdict: Runtime Error):
s=list(input())
a=len(set(s)
if a==2:
	b=len([t for t in s if t==s[0]])
	if b==2:
      	print('Yes')
    else:
      	print('No')
else:
    print('No')
Problem p02771 (python)

Fixed submission:
a, b, c = map(int, input().split())
print('Yes' if len(set([a, b, c])) == 2 else 'No')

Buggy submission (verdict: Runtime Error):
a, b, c = map(int, input().split())
return len(set([a, b, c])) > 2
Problem p02570 (python)

Fixed submission:
D,T,S = map(int,input().split())

if D/S <= T:
    print('Yes')
else:
    print('No')

Buggy submission (verdict: Runtime Error):
n=int(input())
a=list(map(int,input().split()))

mod=10**9+7
total = sum(a)
cum=[]

ans=0
for i in range(n):
    total-=a[i]
    ans += a[i]*(total)%mod
    

print(ans)
Problem p02572 (python)

Fixed submission:
n=int(input())
a=list(map(int,input().split()))

mod=10**9+7
total = sum(a)
cum=[]

ans=0
for i in range(n):
    total-=a[i]
    ans += a[i]*(total)%mod
    

print(ans%mod)

Buggy submission (verdict: Runtime Error):
import numpy as np
N=int(input())
A=list(map(int,input().split()))

MOD = 1000000007
ans=0
for i in range(2**N):
    bin_str = format(i, 'b')
    bin_ = bin_str.count('1')
    if 1 < bin_ < N:
        if bin_ == 2:
            temp=1
            for n in range(N):
                if i>>n&1:
                    temp *=A[n-1]
            ans+=temp

print(ans%MOD)
Problem p02622 (python)

Fixed submission:
s=input()
t=input()

c=0
for i in range(len(s)):
    if s[i]!=t[i]:
        c+=1
print(c)

Buggy submission (verdict: Runtime Error):
s=input()
t=input()

count=0
for i in range(s):
  if s[i]!=t[i]:
    count+=1

print(count)
Problem p02682 (python)

Fixed submission:
A,B,C,K=map(int,input().split())

ans=0
if A<=K:
    K-=A
    ans=A
    if B<=K:
        K-=B
        if C<=K:
            ans-=C
        else:
            ans-=K
    else:
        B=K-B
else:
    ans=K
print(ans)

Buggy submission (verdict: Runtime Error):
from itertools import combinations
A,B,C,K=map(int,input().split())
n=[1]*A+[0]*B+[-1]*C
base = list(combinations(n,K))

ans=0
for i in range(len(base)):
    max_b=sum(base[i])
    if ans <max_b:
        ans=max_b
print(ans)
Problem p02707 (python)

Fixed submission:
ans=[0]*int(input())
N=list(map(int,input().split()))

for i in N:
    ans[i-1]+=1
print(*ans)

Buggy submission (verdict: Runtime Error):
ans=[0]*int(input())
A=list(map(int , input().split())

for a in A:
       ans[a] +=1

print(ans)
Problem p02723 (python)

Fixed submission:
s=input()
if s[2]==s[3] and s[4]==s[5]:
    print('Yes')
else:
    print('No')

Buggy submission (verdict: Runtime Error):
s=input()
if s[3]==s[4] and s[5]==s[6]:
    print('Yes')
else:
    print('No')
Problem p02754 (python)

Fixed submission:
N,A,B = map(int, input().split())
sho,ama=divmod(N,A+B)
print(A*sho+min(ama,A))

Buggy submission (verdict: Runtime Error):
N.a,b=map(int,input().split())
sho,ama=divmod(N,a+b)
print(N*sho+min(ama,a))
Problem p02570 (python)

Fixed submission:
D,T,S= [int(x) for x in input().split()]
if 1<=(D and T)<=10000 and (1<=S<=10000 and D/S<=T):
    print("Yes")
else:
    print("No")

Buggy submission (verdict: Runtime Error):
D,T,S= [int(x) for x in input("Enter values in the range of 1 and 10000: ").split(",")] 
if (D and T) and S <=10000 and D/S<=T:
    print("Yes")
else:
    print("No")

Buggy submission (verdict: Runtime Error):
D,T,S= [int(x) for x in input("Enter values in the range of 1 and 10000: ").split(",")] 5
if (D and T) and S <=10000 and D/S==T:
    print("Yes")
else:
    print("No")

Buggy submission (verdict: Runtime Error):
D=int(input("Enter a number in the range of 0 and 10000 10000: "))
T=int(input("Enter a number in the range of 0 and 10000: "))
S=int(input("Enter a number in the range of 0 and 10000: "))

if (D and T) and S <=10000 and D/S==T:
    print("Yes")
else:
    print("No")

Buggy submission (verdict: Runtime Error):
D=int(input("Enter a number in the range of 0 and 10000: "))
T=int(input("Enter a number in the range of 0 and 10000: "))
S=int(input("Enter a number in the range of 0 and 10000: "))
def DontBeLate(D,T,S):
    
    if (D and T) and S <=10000 and D/S==T:
        print("Yes")
    else:
        print("No")
(DontBeLate(D,T,S))
Problem p02594 (python)

Fixed submission:
if 30<=int(input()):
    print('Yes')
else:
    print('No')

Buggy submission (verdict: Runtime Error):
def aux(x):
    while 29<x>=30:
        return'Yes'
    return 'No

Buggy submission (verdict: Runtime Error):
while -40<=int(input())<=40: print('yes')
print('no')

Buggy submission (verdict: Runtime Error):
while -40<=int(input())<=40: print('yes')
print('no')

Buggy submission (verdict: Runtime Error):
while -40<=int(input())<=40:
    print('yes')
print('no')
Problem p02570 (python)

Fixed submission:
d,t,s = map(int,input().split())
if d<= s*t:
    print("Yes")
else:
    print("No")

Buggy submission (verdict: Runtime Error):
n = int(input())
a = list(map(int,input().split()))
sum = 0
for i in range(n):
    sum += a[i]
sum = sum*sum
for j in range(n):
    sum = sum - a[j]*a[j]
sum = int(sum/2)
print(sum%1000000007)

Buggy submission (verdict: Runtime Error):
n = int(input())
a = list(map(int,input().split()))
sum = 0
for i in range(n):
    sum += a[i]
sum = sum*sum
for j in range(n):
    sum = sum - a[j]*a[j]
sum = sum
print((sum%1000000007)/2)

Buggy submission (verdict: Runtime Error):
n = int(input())
a = list(map(int,input().split()))
sum = 0
for i in range(n):
    sum += a[i]
sum = sum*sum
for j in range(n):
    sum = sum - a[j]*a[j]
sum = int(sum/2)
print(sum%1000000007)
Problem p02570 (python)

Fixed submission:
i = list(map(int, input().split()))

if(i[0]/i[2]<=i[1]):
  print('Yes')
  
else:
  print('No')

Buggy submission (verdict: Runtime Error):
D = int(input())
T = int(input())
S = int(input())

if(D/S<=T):
  print('Yes')
  
else:
  print('No')
Problem p02622 (python)

Fixed submission:
S=raw_input()
T=raw_input()
res=0
for i in xrange(len(S)):
  if T[i]!=S[i]:
    res+=1
print res

Buggy submission (verdict: Runtime Error):
S=raw_input()
T=raw_input()
cS = [0]*26
cT=[0]*26
for i in S:
  cs[ord(i)-97]+=1
for i in S:
  cT[ord(i)-97]+=1
res=0
for i in xrange(26):
  res+=cT[i]-cS[i]
print res

Buggy submission (verdict: Runtime Error):
S=raw_input()
T=raw_input()
cS = [0]*26
cT=[0]*26
for i in S:
  cs[ord(i)-97]+=1
for i in S:
  cT[ord(i)-97]+=1
res=0
for i in xrange(26):
  res+=ct[i]-cs[i]
print res
Problem p02723 (python)

Fixed submission:
s=raw_input()
if s[2]==s[3] and s[4]==s[5]:
    print "Yes"
else:
    print 'No'

Buggy submission (verdict: Runtime Error):
n,x,y=map(int, raw_input().split())

tb=[[0]*(n+1) for i in xrange(n+1)]
tb[x][y]=1
for i in xrange(1, n+1):
    for j in xrange(i+1,n+1):
        # if i<=x and j==y:
        #     tb[i][j]=min(tb[i][j-1]+1-(y-x)+1, j-i)
        # elif i>x and i<y and j==y:
        #     tb[i][j]=min(j-i, j-x+1)
        # else:
        #     tb[i][j]=min(tb[i][j-1]+1, j-i)
        if i<x:
            # print i,j, x-i+1+abs(y-j)
            tb[i][j]=min(j-i, x-i+1+abs(y-j))
        elif i>=x and i<=y:
            tb[i][j]=min(j-i, i-x+1+abs(y-j))

res=[0]*(n+1)

for i in xrange(1 ,n+1):
    for j in xrange(i+1, n+1):
        res[tb[i][j]]+=1

s=''
for i in xrange(1, n):
    s+=str(res[i])+'\n' 

# for i in tb:
#     print i
print s
Problem p02570 (python)

Fixed submission:
d, t, s = map(int,input().split())
if t * s >= d:
  print('Yes')
else:
  print('No')

Buggy submission (verdict: Runtime Error):
import itertools
n = int(input())
alist = list(map(int, input().split()))
result = 0
amari = 0
nmod = 10 ** 9 + 7
    
for i in itertools.combinations(alist, 2):
  amari = ((i[0] % nmod) * (i[1] % nmod)) % nmod
  result = (result + amari) % nmod
  
print(result)

Buggy submission (verdict: Runtime Error):
import itertools
n = int(input())
alist = list(map(int, input().split()))
result = 0
amari = 0
nmod = 10 ** 9 + 7
    
for i in itertools.combinations(alist, 2):
  amari = ((i[0] % nmod) * (i[1] % nmod)) % nmod
  result = (result + amari) % nmod
  
print(result)
Problem p02623 (python)

Fixed submission:
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines

n,m,k = map(int, readline().split())
a = list(map(int, readline().split()))
b = list(map(int, readline().split()))

sa = [0]*(n+1)
sb = [0]*(m+1)

for i in range(n):
    sa[i+1] = sa[i]+a[i]
for i in range(m):
    sb[i+1] = sb[i]+b[i]

isb=m
ans = 0
for isa in range(n+1):
    if sa[isa]>k:
        break
    #while isb>0 and sa[isa]+sb[isb]>k:
    while sa[isa]+sb[isb]>k:
        isb-=1
    ans = max(ans, isa+isb)
    
print(ans)

Buggy submission (verdict: Runtime Error):
#include <iostream>
#include <algorithm>
#include <vector>


int main()
{
    long long  n,m,k; std::cin >> n >> m >> k;
    // long long  a[n+1], b[m+1];
    std::vector<long long>  a{n+1}, b{m+1};
    a[0]=0; b[0]=0;
    for (int i=1;i<n+1;i++)
        std::cin >> a[i];
    for (int i=1; i<m+1; i++)
        std::cin >> b[i];
    
    for (int i=1; i<n+1; i++)
        a[i]+=a[i-1];
    for (int i=1; i<m+1; i++)
        b[i]+=b[i-1];

    int ans=0, r=m;
    for (int i=0; i<n+1; i++)
    {
        if(a[i]>k) break;
        while (a[i]+b[r]>k)
            r--;
        ans = std::max({ans, i+r});
    }
    
    std::cout << ans;

    return 0;
}

Buggy submission (verdict: Runtime Error):
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines

n,m,k = map(int, readline().split())
a = list(map(int, readline().split()))
b = list(map(int, readline().split()))

sa = [0]*(n+1)
sb = [0]*(m+1)

for i in range(n):
    sa[i+1] = sa[i]+a[i]
for i in range(m):
    sb[i+1] = sb[i]+b[i]

isb=m
ans = 0
for isa in range(n+1):
    if sa[isa]>k:
        break
    while isb>0 and sa[isa]+sb[isb]>K:
        isb-=1
    ans = max(ans, isa+isb)
    
print(ans)