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

Fixed submission:
N, M = map(int,input().split())
par = [i for i in range(N+1)]
size = [1 for _ in range(N+1)]

def find(x):
    if par[x] == x:
        return x
    else:
        par[x] = find(par[x])
        return par[x]

def unite(x,y):
    x = find(x)
    y = find(y)
    if x == y:
        return 0
    par[x] = y
    size[y] = size[x] + size[y]
    size[x] = 0
    
for i in range(M):
    x, y,  z= map(int,input().split())
    unite(x,y)
    
Ans =0
for j in size[1:]:
    if j != 0:
        Ans +=1
print(Ans)

Buggy submission (verdict: Runtime Error):
N, M = map(int,input().split())
par = [i for i in range(N+1)]
size = [1 for _ in range(N+1)]

def find(x):
    if par[x] == x:
        return x
    else:
        par[x] = find(par[x])
        return par[x]

def unite(x,y):
    x = find(x)
    y = find(y)
    if x == y:
        continue
    par[x] = y
    size[y] += size[x]
    size[x] = 0

for i in range(M):
    x, y, z= map(int,input().split())
    unite(x,y)

Ans =0
for j in size[1:]:
    if j != 0:
        Ans +=1
print(Ans)

Buggy submission (verdict: Runtime Error):
import collections

N, M = map(int, input().split())
par = [i for i in range(N+1)]

def find(x):
    if par[x] == x:
        return x
    else:
        par[x] = find(par[x]) #経路圧縮
        return par[x]

def unite(x, y):
    x = find(x)
    y = find(y)
    if x == y:
        return 0
    par[x] = y

for i in range(M):
    X, Y, Z = map(int, input().split())
    unite(X, Y)
    print(par)

res = par[1:]
c = collections.Counter(res)
print(len(c))
Problem p02819 (python)

Fixed submission:
def sqrt(x):
    return x ** (.5)

def is_prime(n):
    if n == 1: return False

    for k in range(2, int(sqrt(n)) + 1):
        if n % k == 0:
            return False

    return True

X = int(input())

if is_prime(X):
    print(X)
    exit()
if X % 2 == 0:
    X += 1
while (1):
    if is_prime(X):
        print(X)
        break
    X += 2

Buggy submission (verdict: Runtime Error):
import fractions

def is_prime(n):
    if n == 1: return False

    for k in range(2, int(fractions.sqrt(n)) + 1):
        if n % k == 0:
            return False

    return True

X = int(input())

if is_prime(X):
    print(X)
    exit()
if X % 2 == 0:
    X += 1
while (1):
    if is_prime(X):
        print(X)
        break
    X += 2
Problem p02831 (python)

Fixed submission:
import fractions

A, B = map(int, input().split())

print((A * B) // fractions.gcd(A, B))

Buggy submission (verdict: Runtime Error):
import fractions

A, B = map(int, input().split())

print((x * y) // fractions.gcd(x, y))

Buggy submission (verdict: Runtime Error):
import math

def lcm(x, y):
    return (x * y) // math.gcd(x, y)

A, B = map(int, input().split())

print(lcm(A, B))
Problem p02546 (python)

Fixed submission:
s = input()
 
if s[-1] == "s":
  print(s + "es")
else:
  print(s + "s")

Buggy submission (verdict: Runtime Error):
n = int(input())
p = [list(map(int,input().split())) for i in range(n)]


a = p[0]
b = 0
ans  = 0
tf = 1

for j in range(n):
  if sum(p[j]) // 2 *2 ==sum(p[j]):
    ans += 1
  else:
    ans = 0
  if ans ==3:
    tf = 0
    print("Yes")
    break
    
if tf == 1:
  print("No")

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

if s[-1] = "s":
  print(s + "es")
else:
  print(s + "s")
Problem p02759 (python)

Fixed submission:
N = int(input())

if N % 2 == 1:
	print(N // 2 + 1)
else:
	print(N // 2)

Buggy submission (verdict: Runtime Error):
N = int(input())

if N % 2 == 1
print(N // 2 + 1)
else 
print(N // 2)
Problem p02859 (python)

Fixed submission:
input_int = input()

if input_int <= 100 and input_int >= 1:
	print(int(input_int) * int(input_int))

Buggy submission (verdict: Runtime Error):
N = int(input())
S = str(input())

T = S[0:int(N) // 2]
W = S[int(N) // 2:int(N) + 1] 

if T == W:
	print('Yes')
else:
	print('No')

Buggy submission (verdict: Runtime Error):
N = int(input())
S = [input().split() for i in range(N)]
T = S[0:N / 2 - 1]

if N >= 1 and N <=100:
	def S.islower():
	if True and T + T in s:
    	print('Yes')
    else:
  		print('No')
Problem p02860 (python)

Fixed submission:
N = int(input())
S = str(input())

T = S[0:int(N) // 2]
W = S[int(N) // 2:int(N) + 1] 

if T == W:
	print('Yes')
else:
	print('No')

Buggy submission (verdict: Runtime Error):
N = int(input())
S = [input().split() for i in range(N)]
T = S[0:N / 2 - 1]
 
if N >= 1 and N <=100:
	def S.islower():
	if True and T + T in s:
    	print('Yes')
    else:
  		print('No')

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

if N >= 1 and N <=100:
	def S.islower():
	if True:
      T = S[0:N / 2 - 1]
    else:
 
if (T + T in s):
  print('Yes')
else:
  print('No')

Buggy submission (verdict: Runtime Error):
N = int(input())
S = [input().split() for i in range(N)]

if N >= 1 and N <=100:
	def S.islower():
	if True:
      T = S[0:N / 2 - 1]
    else:

if (T + T in s):
  print('Yes')
else:
  print('No')

Buggy submission (verdict: Runtime Error):
N = int(input())
S = [input().split() for i in range(N)]

if N >= 1 and N <=100:
	def S.islower():
	if True:
      T = S[0:N / 2 - 1]
    else:

if (T + T in s):
  print('Yes')
else:
  print('No')

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

T = S[0:N / 2 - 1]

if (T + T in s):
 print('Yes')
  
else:
 print('No')

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

T = S[0:N / 2 - 1]

if (T + T in s):
 print('Yes')
  
else:
 print('No')
Problem p02546 (python)

Fixed submission:
str1=input()
if(str1[len(str1)-1]=='s'):
    print(str1+'es')
else:
    print(str1+'s')

Buggy submission (verdict: Runtime Error):
n=int(input())
counter=0
for i in range(1,n+1):
    for j in range(1,n+1):
        for k in range(n-i*k,n+1):
            if((i*j+k)==n):
                counter=counter+1
print(counter)
Problem p02546 (python)

Fixed submission:
S = input()

if S[-1] == "s" :
    print(S + "es")
else :
    print(S + "s")

Buggy submission (verdict: Runtime Error):
import sympy
N = int(input())

count = 0
for i in range(1,N):
    count += len(sympy.divisors(N-i))
print(count)
Problem p02571 (python)

Fixed submission:
s = input()
t = input()
ls = []
for i in range(len(s) - len(t) + 1):
    ls.append(s[i:i+len(t)])
now = 0
minimum = len(t)
for i in range(len(ls)):
    now = 0
    for j in range(len(t)):
        if t[j] == ls[i][j]:
            now += 1
    if len(t) - now < minimum:
        minimum = len(t) - now
print(minimum)

Buggy submission (verdict: Runtime Error):
S = input()
T = input()
A = len(T)  
for i in range(len(S)):
    diff = 0
    for j in range(len(T)):
        if T[j] != S[i + j]:
            diff = diff +1;
    A = min(A,diff)
print(A)
Problem p02578 (python)

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

Buggy submission (verdict: Runtime Error):
import numpy as np
N = int(input())
A = list(map(int,input().split()))
min = 0
for i in range(N):
    if(i > 0) :
        if np.max(A[:i]) - A[i] > 0:
            min = min + np.max(A[:i]) - A[i]
print(min)

Buggy submission (verdict: Runtime Error):
import numpy as np
N = int(input())
A = list(map(int,input().split()))
min = 0
for i in range(N):
    if(i > 0) :
        if np.max(A[:i]) - A[i] > 0:
            min = min + np.max(A[:i]) - A[i]
print(min)
Problem p02594 (python)

Fixed submission:
x = int(input())

if x >= 30 :
  print("Yes")
else :
  print("No")

Buggy submission (verdict: Runtime Error):
K = int(input())

t=7
for i in K:
    if t % K == 0 :
        print(i+1)
        break
    t= 10 * t + 7
else :
    print(-1)
Problem p02595 (python)

Fixed submission:
import math
 
N,D = map(int, input().split())
count = 0
for i in range(0, N):
  x = list(map(int, input().split()))
  if D >= math.sqrt(x[0]**2 + x[1]**2):
    count = count + 1
 
print(count)

Buggy submission (verdict: Runtime Error):
import math
 
N,D = map(int, input().split())
count = 0
for i in range(0, N):
  x[i] = list(int(input()))
  if D >= math.sqrt(x[i][0]**2 + x[i][1]**2):
    count = count + 1
 
print(count)

Buggy submission (verdict: Runtime Error):
import math

N,D = map(int, input().split())
count = 0
for i in range(0, N):
  x[i] = list(int(input()))
  if D >= math.sqrt(x[i][0]**2 + x[i][1]**2):
    count += 1

print(count)
Problem p02594 (python)

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

Buggy submission (verdict: Runtime Error):
X = int(input())
if(X => 30):
  print('True')
else:
  print('False')
Problem p02897 (python)

Fixed submission:
n = int(input())
lst = []
for i in range(1, n+1):
  if i % 2 == 1:
    lst.append(i)
print(len(lst)/n)

Buggy submission (verdict: Runtime Error):
n = int(input())
lst = []
for i in range(n):
  if i % 2 == 1:
    lst.append(i)
print(n/len(lst))
Problem p02915 (python)

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

Buggy submission (verdict: Runtime Error):
print(int(input() ** 3))

Buggy submission (verdict: Runtime Error):
print(int(input() ** 3)

Buggy submission (verdict: Runtime Error):
print(int(input() ** 2)
Problem p03013 (python)

Fixed submission:
N,M=map(int,input().split())
br=set([int(input()) for _ in range(M)])
dp=[0]*(N+1)
dp[0]=1
if not 1 in br:
    dp[1]=1
for i in range(2,N+1):
    if not i in br:
        dp[i]+=(dp[i-1]+dp[i-2])%1000000007
print(dp[-1])

Buggy submission (verdict: Runtime Error):
n,m=map(int,input().split())
lst=[int(input()) for i in range(m)]
DP=[0]*(n+1)
temp=0
DP[0]=1
for i in range(1, n+1):
  if i==1 and not in lst:
    DP[i]=1
  elif i in lst:
    DP[i]=0
  else:
    DP[i]=DP[i-1]+DP[i-2]
print(DP[n]%1000000007)
Problem p03272 (python)

Fixed submission:
N,I=map(int,input().split())
print(N-I+1)

Buggy submission (verdict: Runtime Error):
N,I=map(it,input().split())
print(N-I+1)
Problem p02546 (python)

Fixed submission:
st = input()
 
if st[-1] == 's':
    print(st + 'es')
else:
    print(st + 's')

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

if st[-1] == 's':
  return st + 'es'
else:
  return st + 's'
Problem p02688 (python)

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

ans=[0]*n

for i in range(k):
  d=int(input())
  a=[int(k) - 1 for k in input().split()]
  for j in a:
    ans[j]+=1

ansint=0


for i in range(n):
  if ans[i]==0:
    ansint+=1


print(ansint)

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

Sanuke=list(range(K))

def calc_double(n):
	return n - 1
def calc_zero(n):
	return n *0

Sanuke=map(calc_zero, Sanuke)
  
for i in range(N):
  di=int(input())
  A=list(map(int,input().split()))
  A=map(calc_double, A)
  for j in A:
    Sanuke[j]+=1

higaisha=0

for i in Sanuke:
  if i ==0:
    higaisha += 1

print(higaisha)

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

Sanuke=list(range(K))

def calc_double(n):
	return n - 1
def calc_zero(n):
	return n *0

Sanuke=map(calc_zero, Sanuke)
  
for i in range(N):
  di=int(input())
  A=list(map(int,input().split()))
  A=map(calc_double, A)
  for j in A:
    Sanuke[j]+=1

higaisha=0

for i in Sanuke:
  if i ==0:
    higaisha += 1

print(higaisha)

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

Sanuke=list(range(K))

def calc_double(n):
	return n - 1
def calc_zero(n):
	return n *0

Sanuke=map(calc_Sanuke, Sanuke)
  
for i in range(N):
  di=int(input())
  A=list(map(int,input().split()))
  A=map(calc_double, A)
  for j in A:
    Sanuke[j]+=1

higaisha=0

for i in Sanuke:
  if i ==0:
    higaisha += 1

print(higaisha)

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

Sanuke=list(range(K))

def calc_double(n):
      return n -1

for i in range(N):
  di=int(input())
  A=list(map(int,input().split()))
  A=map(calc_double, A)
  for j in A:
    Sanuke[j]+=1

higaisha=0

for i in Sanuke:
  if i ==0:
    higaisha += 1

print(higaisha)

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

Sanuke=list(range(K))

def calc_double(n):
      return n -1

for i in range(N):
  di=int(input())
  A=list(map(int,input().split()))
  A=map(calc_double, A)
  for j in A:
    Sanuke[j]+=1

higaisha=0

for i in Sanuke:
  if i ==0:
    higaisha += 1

print(higaisha)

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

Sanuke=list(range(K))

for i in range(N):
  di=int(input())
  A=list(map(int,input().split()))-1
  for j in A:
    Sanuke[j]+=1

higaisha=0

for i in Sanuke:
  if i ==0:
    higaisha += 1

print(higaisha)

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

Sanuke=list(range(K))

for i in range(N):
  di=int(input())
  A=list(map(int,input().split()))
  for j in A:
    Sanuke[j]+=1

higaisha=0

for i in Sanuke:
  if i ==0:
    higaisha += 1

print(higaisha)

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

Sanuke=list(range(K))

for i in range(N):
  di=int(input())
  A=list(map(int,input().split()))
  for j in A:
    Sanuke[j]+=1

temp=0

for i in Sanuke:
  if i ==0:
    higaisha += 1

print(higaisha)
Problem p02552 (python)

Fixed submission:
num = int(input())
if num == 1:
	print(0)
elif num == 0:
    print(1)

Buggy submission (verdict: Runtime Error):
a, b, c, d = map(int, input().split())

print(max([(a*c), (a*d), (b*c), (b*d)]))

Buggy submission (verdict: Runtime Error):
if int(input()) == 1:
	print(0)
elif int(input()) == 0:
    print(1)
Problem p02596 (python)

Fixed submission:
k = int(input())
val = 7
if k%2 == 0:
    ans = -1
elif k%5 == 0:
    ans = -1
else:
    for i in range(1,10**12+1):
        if val >= k:
            sub = val % k
            if sub == 0:
                  ans = i
                  break
            else:
                  val = 10 * sub + 7
        else:
            val = 10 * val + 7
print(ans)

Buggy submission (verdict: Runtime Error):
k = int(input())
val = 7
if k%2 == 0:
    ans = -1
else:
    for i in range(1,10**7+1):
        sub = val % k
        if sub == 0:
            ans = i
            break
        else:
            val = 10 * sub + 7
print(ans)
Problem p02623 (python)

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

sum_a = [0]
sum_b = [0]

for i in range(n):
    sum_a.append(sum_a[i] + a[i])
for j in range(m):
    sum_b.append(sum_b[j] + b[j])

temp = 0
j = m
ans = 0
for i in range(n+1):
    if sum_a[i] > k:
        temp = i -1
        if temp > ans:
            ans = temp
        break
    else:
        while k - sum_a[i] < sum_b[j]:
            j -= 1
        temp = i + j
        if temp > ans:
            ans = temp
            
print(ans)

Buggy submission (verdict: Runtime Error):
n,m,k = map(int, input().split())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
 
ans = 0
time = 0
a_time = 0
temp = 0
if a[0] > k:
    j = 0
    while time <= k:
        time += b[j]
        j += 1
        ans += 1
else:
    for i in range(n):
        a_time += a[i]
        if a_time > k:
            break
        else:
            time = a_time
            j = 0
            while time <= k:
                time += b[j]
                j += 1
            temp = i + 1 + j            
            if temp > ans:
                ans = temp
                
print(ans)

Buggy submission (verdict: Runtime Error):
n,m,k = map(int, input().split())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
 
ans = 0
time = 0
a_time = 0
temp = 0
if a[0] > k:
    j = 0
    while time <= k:
        time += b[j]
        j += 1
        ans += 1
else:
    for i in range(n):
        a_time += a[i]
        if a_time > k:
            break
        else:
            time = a_time
            temp = i + 1
            j = 0
            while time <= k:
                time += b[j]
                j += 1
                temp +=1
            temp += j
            if temp > ans:
                ans = temp
                
print(ans)

Buggy submission (verdict: Runtime Error):
n,m,k = map(int, input().split())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
 
ans = 0
time = 0
 
 
for i in range(len(a)):
    time += a[i]
    if time > k:
        time -=a[i]
        break
    ans += 1
    
count_a = ans
 
for j in range(len(b)):
    time += b[j]
    if time > k:
        while count_a > 0 & time > k:
            time -= a[count_a]
            count_a -= 1
        if time > k:
            tmp = 0
        else:
            tmp = count_a + j
    if tmp > ans :
        ans = tmp
    
print(ans)
Problem p02659 (python)

Fixed submission:
re = input().split()
a = int(re[0])
b = re[1]

c = int(b[0])
d = int(b[2] + b[3])
e = a * c
f = a * d
g = f // 100
h = e + g
print(h)

Buggy submission (verdict: Runtime Error):
re = input().split())
a = int(re[0])
b = float(re[1]])
for i in range(10):
    if i <= b <i+1:
        c = int(i)
        d = int(100 * (b - i))
        break
    
e = a * c
f = a * d
g = f // 100
h = e + g
print(h)

Buggy submission (verdict: Runtime Error):
import math
a,b = map(float, input().split())
for i in range(1,11):
    if i <= b <i+1:
        c = int(i)
        d = b - i
        
e = int(a) * c
f = a * d
g = int(math.floor(f))
h = e + g
print(math.floor(h))

Buggy submission (verdict: Runtime Error):
import math
a,b = map(float, input().split())
for i in range(1,11):
    if i <= b <i+1:
        c = i
        d = b - i
        
e = a * c
f = a * d
g = math.floor(f)
h = e + g
print(math.floor(h))

Buggy submission (verdict: Runtime Error):
import math
a,b = map(float, input().split())
for i in range(1,11):
    if i <= b <i+1:
        c = i
        d = b - i
        
e = a * c
f = a * d
g = math.floor(f)
h = a + g
print(math.floor(h))
Problem p02771 (python)

Fixed submission:
a = list(map(int,input().split()))
a.sort()
if (a[0] == a[1] and a[1] != a[2]) or (a[0] != a[1] and a[1] == a[2]):
  print("Yes")
else:
  print("No")

Buggy submission (verdict: Runtime Error):
a = list(map(int,input().split()))
sort(a)
if (a[0] == a[1] and a[1] != a[2]) or (a[0] != a[1] and a[1] == a[2]):
  print("Yes")
else:
  print("No")
Problem p02990 (python)

Fixed submission:
n,k = map(int,input().split())
l = [1,1]
for i in range(2,2000):
    l.append(l[i-1]*i)
def f(i):
    global n,k,l
    if i == 1:
        return n-k+1
    elif i - 1 > n - k :
        return 0
    else:
        tiri = l[k-1]//(l[i-1]*l[k-i])
        aka = n - k
        aka = aka - i + 1
        akatiri = l[i + aka ] // (l[aka] * l[i])
        #print(tiri,akatiri)
        return tiri * akatiri
for i in range(1,k+1):
    print(f(i)%(10**9 + 7))

Buggy submission (verdict: Runtime Error):
n,k = map(int,input().split())
l = [1,1]
for i in range(2,2000):
    l.append(l[i-1]*i)
def f(i):
    global n,k,l
    if i == 1:
        return n-k+1
    else:
        tiri = l[k-1]//l[i-1]*l[k-i]
        aka = n - k
        aka = aka - i + 1
        akatiri = l[i + aka ] // (l[aka] * l[i])
        #print(tiri,akatiri)
        return tiri * akatiri
for i in range(1,k+1):
    print(f(i)%(10**9 + 7))
Problem p03013 (python)

Fixed submission:
n,m = map(int, input().split())
u = [0]*(n+1)
for i in range(m):
    u[int(input())] = 1
ll = [0]*(n+2)
ll[1] = 1
for i in range(2,n+2):
    if not u[i-1]:
        ll[i] = ll[i-1] + ll[i - 2]
print(ll[-1] % 1000000007)

Buggy submission (verdict: Runtime Error):
n,m = map(int, input().split())
l = []
for i in range(n):
    a = input()
    a.split()
    l.append(a)
def f(x,y):
    global l ,n,m
    ans = -3
    if l[x][y] == "#":
        return 0
    else :
        for i in range(x,n):
            if l[i][y] == ".":
                ans += 1
            else :
                break
        for i in range(x+1):
            if l[x-i][y] == ".":
                ans += 1
            else :
                break
        for i in range(y,m):
            if l[x][i] == ".":
                ans += 1
            else :
                break
        for i in range(y+1):
            if l[x][y-i] == ".":
                ans += 1
            else:
                break
        return ans
k = 1
for i in range(n):
    for j in range(m):
        k = max(k,f(i,j))
        if k == n + m - 1:
            break
print(k)
Problem p03127 (python)

Fixed submission:
n = int(input())
a = list(map(int, input().split()))
a.sort()
while len(a) >= 2 :
    k = a[1] % a[0]
    if k == 0 :
        a.pop(1)
    else :
        a[1] = k
        a[0], a[1] = a[1], a[0]
print(a[0])

Buggy submission (verdict: Runtime Error):
n = int(input())
a = list(map(int, input().split()))
a.sort()
while len(a) >= 2 :
    k = a[1] % a[0]
    if k == 0 :
        a.pop(1)
    else :
        a[1] = k
    a.sort()
    print(a)
    if a[0] == 1 :
        break
print(a[0])
Problem p02879 (python)

Fixed submission:
a,b=map(int,input().split())
if max(a,b)<=9 and min(a,b)>=1:
    print(a*b)
else:print(-1)

Buggy submission (verdict: Runtime Error):
a,b=map(int,input())
if max(a,b)<=9 and min(a,b)>=1:
    print(a*b)
else:print(-1)
Problem p02659 (python)

Fixed submission:
from decimal import Decimal
a, b= input().split() 
a=int(a)
b=Decimal(b)
c=int(a*b)
print(c)

Buggy submission (verdict: Runtime Error):
a, b= input()
a=int(a)
b=float(b)
c=int(a*b)
print(c)
Problem p02572 (python)

Fixed submission:
mod = 10 ** 9 + 7
n = int(input())
a_list = list(map(int, input().split()))
result = 0
a_sum = sum(a_list)
for i in a_list:
    a_sum -= i
    result += i * a_sum
print(result % mod)

Buggy submission (verdict: Runtime Error):
mod = 10 ** 9 + 7
n = int(input())
a_list = list(map(int, input().split()))
result = 0
a_sum = sum(a)
for i in a_list:
    a_sum -= i
    result += i * a_sum
print(result % mod)

Buggy submission (verdict: Runtime Error):
mod = 10 ** 9 + 7
n = int(input())
a_list = list(map(int, input().split()))
result = 0
a_sum = sum(a)
for i in a_list:
    a_sum -= i
    result += i * a_sum
print(result % mod)
Problem p02594 (python)

Fixed submission:
x = int(input())

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

Buggy submission (verdict: Runtime Error):
x = int(input())

if x >= 30:
    return 'Yes'
else:
    return 'No'
Problem p02596 (python)

Fixed submission:
def main():
    k = int(input())
    num = 1
    n = 7

    if (k % 2 == 0):
        print(-1)
        return
    
    for i in range(1000000):
        if (n % k == 0):
            print(num)
            return
        else:
            n = (n*10 + 7) %k
            num += 1
    print(-1)

if __name__ == '__main__':
    main()

Buggy submission (verdict: Runtime Error):
k = int(input())
seven = 7
count = 0

def main():
    for i in range(1000000):
        if k % 2 == 0:
            count = -1
            return

        elif seven % k == 0:
            count += 1
            print(count)
            return
        else:
            count += 1
            seven = seven * 10 + 7
    print(-1)

if __name__ == '__main__':
    main()

Buggy submission (verdict: Runtime Error):
k = int(input())
seven = ７
count = 0

while True:
    if k % 2 == 0:
        count = -1
        break

    elif seven % k == 0:
        count += 1
        break
    else:
        count += 1
        seven = seven * 10 + 7

print(count)
Problem p02577 (python)

Fixed submission:
n = int(input())
a = sum(list(map(int,str(n))))
if a%9==0:
  print("Yes")
else:
  print("No")

Buggy submission (verdict: Runtime Error):
n = int(input())
a = sum(list(map(str(n), int)))
if a%9==0:
  print("Yes")
else:
  print("No")

Buggy submission (verdict: Runtime Error):
n = int(input())
a = sum(list(str(n)))
if a%9==0:
  print("Yes")
else:
  print("No")