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

Fixed submission:
# AGC015A - A+...+B Problem
def main():
    n, a, b = tuple(map(int, input().rstrip().split()))
    if a > b or (n == 1 and a != b):
        print(0)
    elif n == 1 and a == b:
        print(1)
    else:
        print((n - 2) * (b - a) + 1)


if __name__ == "__main__":
    main()

Buggy submission (verdict: Runtime Error):
# AGC015A - A+...+B Problem
import sys
sys.setrecursionlimit(10 ** 9)

from itertools import product


def main():
    n, a, b = tuple(map(int, input().rstrip().split()))
    if a > b or (n == 1 and abs(a - b) > 1):
        print(0)
        return
    if (n == 1 and a == b) or n == 2:
        print(1)
        return
    ans = {sum(i) for i in product(range(a, b + 1), repeat=n - 2)}
    print(len(ans))


if __name__ == "__main__":
    main()

Buggy submission (verdict: Runtime Error):
# AGC015A - A+...+B Problem
from itertools import product


def main():
    n, a, b = tuple(map(int, input().rstrip().split()))
    if a > b or (n == 1 and abs(a - b) > 1):
        print(0)
        return
    if (n == 1 and a == b) or n == 2:
        print(1)
        return
    ans = {sum(i) for i in product(range(a, b + 1), repeat=n - 2)}
    print(len(ans))


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

Fixed submission:
# AGC009A - Multiple Array
import sys
input = sys.stdin.readline


def main():
    # decide from the last one
    n = int(input())
    A = tuple(tuple(map(int, input().split())) for _ in range(n))
    ans = 0
    for i, j in A[::-1]:
        if i == 0 or j == 1:
            continue
        r = (i + ans) % j
        if r != 0:
            ans += j - (i + ans) % j
    print(ans)


if __name__ == "__main__":
    main()

Buggy submission (verdict: Runtime Error):
# AGC009A - Multiple Array
def main():
    N, *AB = map(int, open(0).read().split())
    ans = 0
    for i, j in zip(*[iter(A[::-1])] * 2):  # decide from the last one greedily
        ans += -(i + ans) % j
    print(ans)


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

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

x = a//k
y = b//k

if y - x == 0:
    if a%k == 0:
        print('OK')
    else:
        print('NG')
else:
    print('OK')

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

b = (b / k) * k

if a <= b :
    print("OK")
else:
    print("NG")
Problem p02777 (python)

Fixed submission:
list1 = input()
list2 = input()
list3 = input()
nlist1 = list1.split(' ')
nlist2 = list2.split(' ')
S = nlist1[0]
T = nlist1[1]
lenS = int(nlist2[0])
lenT = int(nlist2[1])
select = list3
if select == S:
    lenS -= 1
elif select == T:
    lenT -= 1
print(lenS,lenT)

Buggy submission (verdict: Runtime Error):
list1 = input()
list1 = list1.split(' ')
S = list1[0]
T = list1[1]
lenS = int(list1[2])
lenT = int(list1[3])
select = list1[4]
if select == S:
    lenS -= 1
else:
    lenT -= 1
print(lenS,lenT)

Buggy submission (verdict: Runtime Error):
list1 = input()
list1 = list1.split(' ')
S = list1[0]
T = list1[1]
lenS = int(list1[2])
lenT = int(list1[3])
select = list1[4]
if select == S:
    lenS -= 1
else:
    lenT -= 1
print(lenS,lenT)

Buggy submission (verdict: Runtime Error):
list1 = input()
list1 = list1.split(' ')
S = list1[0]
T = list1[1]
lenS = int(list1[2])
lenT = int(list1[3])
select = list1[4]
if select == S:
    lenS -= 1
else:
    lenT -= 1
print(lenS,lenT)
Problem p02779 (python)

Fixed submission:
N = int(input())
inputA = input()
listA = inputA.split(' ')
listA.sort()
output = 'YES'
for i in range (len(listA) - 1):
    if listA[i] == listA[i + 1]:
        output = 'NO'
print(output)

Buggy submission (verdict: Runtime Error):
N = input()
inp = input()
listA = inp.split(' ')
count = 0
for moji in lintA:
  youso = listA.count(moji)
  if youso == 1:
    count += 1
  else:
    print('NO')
    break
if count == len(listA):
  print('YES')

Buggy submission (verdict: Runtime Error):
N = input()
inp = input()
listA = inp.split(' ')
out = YES
for k in listA:
  count = 0
  for j in listA:
    if k == j:
      count += 1
      if count >= 2:
        out = NO
        break
print(out)
Problem p02659 (python)

Fixed submission:
from math import floor
inp = input()
a, b = inp.split()
b += '00000001'
a = int(a)
b = float(b)
b100 = int(b * 100)
ans100 = a * b100
ans = ans100 // 100
print(ans)

Buggy submission (verdict: Runtime Error):
inp = input()
a, b = input().split()
a = int(a)
b = float(b)
b100 = int(b*100)
ans100 = a * b100
ans = a/100
print(ans)
Problem p02552 (python)

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

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

Buggy submission (verdict: Runtime Error):
x = int(input())
if x != 1:
  return 0
elif x != 0:
  return 1
Problem p02552 (python)

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

Buggy submission (verdict: Runtime Error):
x=int(input())
if(x==1):
  print(0)
 elif(x==0):
  print(1)
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>=25):
  print("Yes")
 else:
  print("No")
Problem p02572 (python)

Fixed submission:
n=int(input())
a=list(map(int,input().split()))
l=list(map(lambda z:z**2,a))
x=sum(a)**2
y=sum(l)
t=(x-y)//2
if t>(10**9+7):
       print(t%(10**9+7))
else:
       print(t)

Buggy submission (verdict: Runtime Error):
n=int(input())
a=list(map(int,input().split()))
if n==1:
print(a[0])
else:
l=list(map(lambda z:z**2,a)
x=sum(a)
y=sum(l)
t=(x-y)//2
if t>(10**9+7):
       print(t%(10**9+7))
else:
       print(t)

Buggy submission (verdict: Runtime Error):
n=int(input())
a=list(map(int,input().split()))
l=list(map(lambda z:z**2,a)
x=sum(a)
y=sum(l)
t=(x-y)//2
print(t)

Buggy submission (verdict: Runtime Error):
n=int(input())
a=list(map(int,input().split()))
if n==1:
print(a[0])
else:
l=list(map(lambda z:z**2,a)
x=sum(a)
y=sum(l)
t=(x-y)//2
print(t)
Problem p02594 (python)

Fixed submission:
t=int(input())
if t>=30:
  print("Yes")
else:
  print("No")

Buggy submission (verdict: Runtime Error):
t=int(input())
if t>=30:
  print("Yes")
 else:
  print("No")
Problem p02595 (python)

Fixed submission:
N,D=map(int,input().split())
l=[]
l1=[]
count=0
for i in range(N):
  x,y=map(int,input().split())
  l.append(x)
  l1.append(y)
for i in range(N):
  if (l[i]**2 +l1[i]**2)**0.5 <=D:
    count+=1
print(count)

Buggy submission (verdict: Runtime Error):
N,D=map(int,input().split())
l=[]
l1=[]
count=0
for i in range(N):
  x,y=map(int,input().split())
  l.append(x)
  l1append(y)
for i in range(N):
  if (l[i]**2 +l1[i]**2)**0.5 <=D:
    count+=1
print(count)

Buggy submission (verdict: Runtime Error):
N,D=map(int,input().split())
l=[]
l1=[]
count=0
for i in range(N):
  x,y=map(int,input().split())
  l.append(x)
  l1.append(y)
for i in range(N):
  if (l[i]**2 +l1**2)**0.5 <=D:
    count+=1
print(count)

Buggy submission (verdict: Runtime Error):
N,D=map(int,input().split())
l=[]
l1=[]
count=0
for i in range(N):
  x,y=map(int,input().split())
  l.append(x)
  l1append(y)
for i in range(N):
  if (l[i]**2 +l1**2)**0.5 <=D:
    count+=1
print(count)
Problem p02793 (python)

Fixed submission:
def gcd(a,b):
    while b!=0:
        a,b=b,a%b
    return a

 #最小公倍数
def lcm(a,b):
    return a*b//gcd(a,b)

N=int(input())
A=list(map(int,input().split()))
a_lcm=A[0]
Mod=10**9+7

for i in range(1,N):
    a_lcm=lcm(a_lcm,A[i])

a_lcm%=Mod

result=0
for i in range(N):
    result+=a_lcm*pow(A[i],Mod-2,Mod)
print(result%1000000007)

Buggy submission (verdict: Runtime Error):
import fractions

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

N=int(input())
A=list(map(int,input().split()))
a_lcm=A[0]

for i in range(1,N):
    a_lcm=lcm(a_lcm,A[i])

result=0
for i in range(N):
    result+=a_lcm//A[i]
    result%=1000000007
print(result%1000000007)

Buggy submission (verdict: Runtime Error):
import fractions

N=int(input())
A=list(map(int,input().split()))

for i in range(N-1):
    if i==0:
        a_lcm=(A[i]*A[i+1])//fractions.gcd(A[i],A[i+1])
    else:
        a_lcm=(a_lcm*A[i+1])//fractions.gcd(a_lcm,A[i+1])

result=0
for i in range(N):
    result+=a_lcm//A[i]
    result%=1000000007
print(result)
Problem p02990 (python)

Fixed submission:
import math

def combination(n,r):
    return int(math.factorial(n)//(math.factorial(r)*math.factorial(n-r)))

if __name__=="__main__":
    N,K=map(int,input().split())
    a=1000000007
    result=0

    if N==K:
        for i in range(K):
            if i==0:
                print(1)
            else:
                print(0)
    else:
        for i in range(1,K+1):
            if N-K+1-i<0:
                print(0)
            else:
                result=int(combination(N-K+1,i)*combination(K-1,i-1))
                print(result%a)

Buggy submission (verdict: Runtime Error):
import math

def combination(n,r):
    return int(math.factorial(n)//(math.factorial(r)*math.factorial(n-r)))

if __name__=="__main__":
    N,K=map(int,input().split())
    a=1000000007
    result=0

    for i in range(1,K+1):
        result=int(combination(N-K+1,i)*combination(K-1,i-1))
        print(result%a)

Buggy submission (verdict: Runtime Error):
import math

def combination(n,r):
    return math.factorial(n)//(math.factorial(r)*math.factorial(n-r))

if __name__=="__main__":
    N,K=map(int,input().split())
    a=1000000007
    result=0

    for i in range(1,K+1):
        result=combination(N-K+1,i)*combination(K-1,i-1)
        print(result%a)
Problem p02552 (python)

Fixed submission:
x = int(input())
if x == 0:
    print('1')
else:
    print('0')

Buggy submission (verdict: Runtime Error):
a,b,c,d = map(int,input().split())
print(max(a,b)*max(c,d))
Problem p02836 (python)

Fixed submission:
s = input()

n = len(s)

ans = 0
for i in range(int(n/2)):
  if s[i] != s[n-i-1]:
    ans += 1
    
print(ans)

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

n = len(str)

ans = 0
for i in range(int(n/2)):
  if s[i] != s[n-i-1]:
    ans += 1
    
print(ans)
Problem p02552 (python)

Fixed submission:
a = int(input())
if a==1:
  print(0)
else:
  print(1)

Buggy submission (verdict: Runtime Error):
input_number = input()
if input_number = 0:
  print(1)
else:
  print(0)
Problem p02570 (python)

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

Buggy submission (verdict: Runtime Error):
d, t, s = map(int, input())
t_d = t * d
if td >= d:
  print("yes")
else:
  print("no")
Problem p02659 (python)

Fixed submission:
from decimal import Decimal

m,n=map(Decimal,input().split(' '))
print(int(m*n))

Buggy submission (verdict: Runtime Error):
from decimal import Decimal

m,n=map(Decimal,input().split(''))
print(int(m*n))
Problem p03705 (python)

Fixed submission:
n, a, b = map(int, input().split())
if (n == 1 and a == b):
  ans = 1
elif (n == 1):
  ans = 0
elif a > b:
  ans = 0
else:
  ans = (b - a) * (n - 2) + 1
print(ans)

Buggy submission (verdict: Runtime Error):
n, a, b = map(int, input().split())
if (n == 1 and a == b):
  ans = 1
elif (n == 1):
  ans = 0
elif A > B:
  ans = 0
else:
  ans = (b - a) * (n - 2) + 1
print(ans)
Problem p02552 (python)

Fixed submission:
x=int(input())
print(abs(1-x))

Buggy submission (verdict: Runtime Error):
x=int(input)
print(abs(1-x))
Problem p02779 (python)

Fixed submission:
def n0():return int(input())
def n1():return [int(x) for x in input().split()]
def n2(n):return [int(input()) for _ in range(n)]
def n3(n):return [[int(x) for x in input().split()] for _ in range(n)]

n=n0()
a=n1()

print("YES" if len(a)==len(list(set(a))) else "NO")

Buggy submission (verdict: Runtime Error):
n=int(input())
a=map(int,input().split())
if len(a)==list(set(a)):
  print("Yes")
else:
  print("No")
Problem p02836 (python)

Fixed submission:
s=input()
n=len(s)
 
c=0
i=0
while i<n-i-1:
  if s[i]!=s[n-i-1]:
    c+=1
  i+=1
print(c)

Buggy submission (verdict: Runtime Error):
s=input()
n=len(s)
 
c=0
i=0
while i<n-i-1:
  if s[i]!=s[n-i-1]:
    c+=1
  i+=1
print(c)
s=input()
n=len(n)
 
c=0
i=0
while i<n-i-1:
  if s[i]!=s[n-i-1]:
    c+=1
  i+=1
print(c)
提出情報

Buggy submission (verdict: Runtime Error):
s=input()
n=len(n)
 
c=0
i=0
while i<n-i-1:
  if s[i]!=s[n-i-1]:
    c+=1
  i+=1
print(c)

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

c=0
i=0
while i<n-i-1
  if s[i]!=s[n-i-1]:
    c+=1
  i+=1
print(c)
Problem p02880 (python)

Fixed submission:
n=int(input())
 
t=[]
for i in range(1,10):
  for j in range(1,10):
    t.append(i*j)

if n in t:
  print("Yes")
else:
  print("No")

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

t=[]
for i in range(1,10):
  for j in range(1,10):
    t.append(i*j)

if n in t:
  print("Yes")
else:
  Print("No")
Problem p02859 (python)

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

Buggy submission (verdict: Runtime Error):
r =int(intput())
print(r**2)
Problem p02860 (python)

Fixed submission:
n = int(input())
s = input()
#print(n,s)
if(n%2==1):
  print("No")
else:
  a = s[:n//2]
  b = s[n//2:]
  if(a==b):
    print("Yes")
  else:
    print("No")

Buggy submission (verdict: Runtime Error):
n = int(input())
if(n%2==1):
  print("No")
else:
  s = input()
  a = s[:n/2]
  b = s[n/2:]
  if(a==b):
    print("Yes")
  else:
    print("No")
Problem p02552 (python)

Fixed submission:
x = int(input())
if x:
    print(0)
else:
    print(1)

Buggy submission (verdict: Runtime Error):
if __name__ == "__main__":
    main()


def main():
    x = int(input())
    if x:
        print(0)
    else:
        print(1)

Buggy submission (verdict: Runtime Error):
x = int(input())
if x:
  print(0)
 else:
  print(1)
Problem p02699 (python)

Fixed submission:
S, W = map(int, input().split())
if W >= S:
    print("unsafe")
else:
    print("safe")

Buggy submission (verdict: Runtime Error):
s = input()
b = len(s)
c = 0
f = 0
while True:
    if f == b:
        break
    elif b - f <= 2:
        f = 0
        b -= 1
    else:
        if int(s[f:b]) % 2019 == 0:
            c += 1
            f += 1
        else:
            f += 1
print(c)

Buggy submission (verdict: Runtime Error):
S, W = map(int, input().split())
if W>=S:
  print("unsafe")
 else:
  print("safe")
Problem p02701 (python)

Fixed submission:
n = int(input())
s = set(input() for _ in range(n))
print(len(s))

Buggy submission (verdict: Runtime Error):
N = int(input())
S = []
while True:
    Si = input()
    if Si:
        S.append(Si)
    else:
        break
g = S[: N]
print(g)
Problem p02623 (python)

Fixed submission:
import numpy as np
from bisect import bisect

N,M,K = map(int,input().split())
A = np.array(input().split(),dtype=int)
B = np.array(input().split(),dtype=int)

AA = np.insert(A,0,0)
BB = np.insert(B,0,0)
AAA = np.cumsum(AA)
BBB = np.cumsum(BB)
max_books = 0
for a in enumerate(AAA):
    if a[1] > K:
        break
    books = a[0]
    ind = bisect(BBB,K - a[1])
    books += (ind-1)
    max_books = max(books,max_books)
print(max_books)

Buggy submission (verdict: Runtime Error):
import numpy as np

N,M,K = map(int,input().split())
A = np.array(input().split(),dtype=int)
B = np.array(input().split(),dtype=int)

AA = np.insert(A,0,0)
BB = np.insert(B,0,0)
AAA = np.cumsum(AA)
BBB = np.cumsum(BB)
max_mins = 0
max_books = 0
for a in enumerate(AAA):
    if a[1] > K:
        break
    for b in enumerate(BBB):
        if a[2] + b[1] > K:
            break
        if a[0] + b[0] > max_books:
            max_books = a[0] + b[0]
print(max_books)
Problem p02695 (python)

Fixed submission:
import itertools

abcd = []
N,M,Q = map(int,input().split())
for i in range(Q):
    a,b,c,d = map(int,input().split())
    abcd.append([a,b,c,d])
  
A = itertools.combinations_with_replacement(list(range(1,M+1)),N)
ans = 0
for i in A: 
    _sum = 0
    for j in abcd: 
        if i[j[1]-1] - i[j[0]-1] == j[2]:
            _sum += j[3]
    if ans < _sum:
        ans = _sum
    
print(ans)

Buggy submission (verdict: Runtime Error):
import itertools

abcd = []
N,M,Q = map(int,input().split())
for i in range(Q):
    a,b,c,d = map(int,input().split())
    abcd.append([a,b,c,d])
  
A = (list(itertools.product(list(range(1,M+1)),repeat=N)))

ans = 0
for i in A: )
    _sum = 0
    for j in abcd: 
        if i[j[1]-1] - i[j[0]-1] == j[2]:
            _sum += j[3]
    if ans < _sum:
        ans = _sum
    
print(ans)
Problem p02835 (python)

Fixed submission:
a,b,c = map(int, input().split())
print("win" if a+b+c <= 21 else "bust")

Buggy submission (verdict: Runtime Error):
import numpy as np
n = int(input())
arr = np.full((n,n),9)
for i in range(n):
  nn = int(input())
  for j in range(nn):
    a,b = map(int,input().split())
    arr[i][a-1] = b

arr2 = arr.T
cnt = 0
for i in range(n):
  for j in range(n):
    if arr[i][j]==0 and arr2[i][j]==0:
      cnt += 1
    elif arr[i][j]==1 and arr2[i][j]==1:
      cnt+=1

print(cnt)
Problem p02873 (python)

Fixed submission:
s = [*input()]
if len(s) == 1:
    print(1)
    exit()
hugo = ["<", ">"]
a = [0]
b = []
base = -1
for i in range(len(s) - 1):
    if base == -1: #一番最初
        base = hugo.index(s[i])
        b = [0,1]
    elif base != hugo.index(s[i]): #符号が切り替わった時
        #前グループの処理
        if base == 1:
            b.reverse()
        max_ = max(a[-1],b[0])
        a.pop(-1)
        b[0] = max_
        a.extend(b)
        #新しい処理
        b = [0,1]
        base = hugo.index(s[i])
    else: #同じ符号が続いてる時
        b.append(b[-1] + 1) 
if hugo.index(s[-1]) == base: #一番ラストの符号
    b.append(b[-1] + 1)
    if base == 1:
        b.reverse()
    max_ = max(a[-1],b[0])
    b[0] = max_
    a.pop(-1)
    a.extend(b)    
else:
    #前グループの処理
    if base == 1:
        b.reverse()
    max_ = max(a[-1],b[0])
    b[0] = max_
    a.pop(-1)
    a.extend(b)
    
    #今回の処理
    if hugo.index(s[-1]) == 1:
        b = [1,0]
    else:
        b = [0,1]
    max_ = max(a[-1],b[0])
    b[0] = max_
    a.pop(-1)
    a.extend(b)
    
print(sum(a))

Buggy submission (verdict: Runtime Error):
s = [*input()]
hugo = ["<", ">"]
a = [0]
b = []
base = -1
for i in range(len(s) - 1):
    if base == -1: #一番最初
        base = hugo.index(s[i])
        b = [0,1]
    elif base != hugo.index(s[i]): #符号が切り替わった時
        #前グループの処理
        if base == 1:
            b.reverse()
        max_ = max(a[-1],b[0])
        a.pop(-1)
        b[0] = max_
        a.extend(b)
        #新しい処理
        b = [0,1]
        base = hugo.index(s[i])
    else: #同じ符号が続いてる時
        b.append(b[-1] + 1) 
if hugo.index(s[-1]) == base: #一番ラストの符号
    b.append(b[-1] + 1)
    if base == 1:
        b.reverse()
    max_ = max(a[-1],b[0])
    b[0] = max_
    a.pop(-1)
    a.extend(b)    
else:
    #前グループの処理
    if base == 1:
        b.reverse()
    max_ = max(a[-1],b[0])
    b[0] = max_
    a.pop(-1)
    a.extend(b)
    
    #今回の処理
    if hugo.index(s[-1]) == 1:
        b = [1,0]
    else:
        b = [0,1]
    max_ = max(a[-1],b[0])
    b[0] = max_
    a.pop(-1)
    a.extend(b)
    
print(sum(a))
Problem p02897 (python)

Fixed submission:
n = int(input())
if n == 1:
  print(1)
elif n % 2 == 0:
  print(0.5)
else:
  print((n+1)/2/n)

Buggy submission (verdict: Runtime Error):
n = int(input())
print(i if n == 1 else 0.5 if n%2 == 0 else (n+1)/2/n)
Problem p02572 (python)

Fixed submission:
mod = int(1e9 + 7)

def pw(b, ex):
    if ex == 0: return 1
    if ex == 1: return b
    if ex & 1: return b % mod * pw((b*b) % mod, ex >> 1) % mod
    return pw((b*b) % mod, ex >> 1) % mod

n = int(input())
x = list(map(int,input().split()))
st = 0
en = 0

for i in x:
    st = (st + i) % mod
    en = (en + (i * i) % mod) % mod
    
st *= st
ans = int((st - en + mod) % mod)
ans = int(ans * int(pw(2, mod - 2)) % mod) % mod
print (int(ans))

Buggy submission (verdict: Runtime Error):
mod = int(1e9 + 7)

def pw(b, ex):
    if ex == 0: return 1
    if ex == 1: return b
    if ex & 1: return b % mod * pw((b*b) % mod, ex >> 1) % mod
    return pw((b*b) % mod, ex >> 1) % mod

n = int(input())
x = list(map(int,input().split()))
st = 0
en = 0

for i in x:
    st = (st + i) % mod
    en = (en + (i * i) % mod) % mod

ans = int((st * st - en + mod) % mod)
ans = int(ans * int(pw(2, mod - 2)) % mod) % mod
print (int(ans))

mod = int(1e9 + 7)

def pw(b, ex):
    if ex == 0: return 1
    if ex == 1: return b
    if ex & 1: return b % mod * pw((b*b) % mod, ex >> 1) % mod
    return pw((b*b) % mod, ex >> 1) % mod

n = int(input())
x = list(map(int,input().split()))
st = 0
en = 0

for i in x:
    st = (st + i) % mod
    en = (en + (i * i) % mod) % mod

ans = int((st * st - en + mod) % mod)
ans = int(ans * int(pw(2, mod - 2)) % mod) % mod
print (int(ans))
Problem p02577 (python)

Fixed submission:
n = str(input())
ans = 0
for i in range(len(n)):
	ans = (ans + ord(n[i]) - ord('0')) % 9
if ans: print("No")
else: print("Yes")

Buggy submission (verdict: Runtime Error):
n = str(input())
ans = 0
for i in range(len(n)): 
	ans = (ans + int(ord(i) - ord('0'))) % 9
if ans: print ("No")
else: print("Yes")

Buggy submission (verdict: Runtime Error):
n = str(input())
ans = 0
for i in n: ans = (ans + int(i - '0')) % 9
if ans: print ("No")
else: print("Yes")
Problem p02915 (python)

Fixed submission:
n = int(input())

print(n**3)

Buggy submission (verdict: Runtime Error):
n = int(input())
a = list(map(int, input().split()))
for i in range(len(a)):
  a[i] -= 1
b = list(map(int, input().split()))
c = list(map(int, input().split()))
m = 0
bef = -1
for i in range(n):
  m += b[a[i]]
  if(bef + 1 == a[i]):
    m += c[bef]
  bef = a[i]
print(m)
Problem p02552 (python)

Fixed submission:
s = int(input())

if s == 1:
    print(0)
elif s == 0:
    print(1)

Buggy submission (verdict: Runtime Error):
  1 s = int(input())
  2
  3 if s == 1:
  4     print('0')
  5 elif s == 0:
  6     print('1')
Problem p02577 (python)

Fixed submission:
n = int(input())

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

Buggy submission (verdict: Runtime Error):
import math

n = int(input())
ans = 0

while n:
    ans = ans + (n % 10)
    n = math.floor(n / 10)

if ans % 9 == 0:
    print('Yes')
else:
    print('No')
Problem p03207 (python)

Fixed submission:
N = int(input())
p = [int(input()) for i in range(N)]
print(sum(p) - max(p) // 2)

Buggy submission (verdict: Runtime Error):
N = int(input())
p = [int(input()) for i in range(N)]
print(sum() - max(p))
Problem p02594 (python)

Fixed submission:
x = int(input())
b = x - 30
if b >= 0:
  print('Yes')
else:
  print("No")

Buggy submission (verdict: Runtime Error):
x = int(input())
b = x - 30
if b => 0:
  print('Yes')
else:
  print("No")
Problem p02676 (python)

Fixed submission:
K = int(input())
S = input()
x = len(S)
 
if x <= K:
    print(S)
else:
    print(S[:K] + '...')

Buggy submission (verdict: Runtime Error):
K = int(input())
S = input()
x = len(S)
 
if x <= K:
  print(S)
else:
  print(S[K - 1:]　+ '...')

Buggy submission (verdict: Runtime Error):
K = int(input())
S = input()
x = len(S)
 
if x <= K:
  print(S)
else:
  print(S[K:]　+ '...')

Buggy submission (verdict: Runtime Error):
K = int(input())
S = input()
x = len(s)
 
if x <= K:
  print(S)
else:
  print(S[K:])

Buggy submission (verdict: Runtime Error):
K = int(input())
S = input()
x = len(s)

if x <= K:
  print(S)
else:
  print(S[K -1:])

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

x = len(s)

if x > K:
  print(S[1:] + '...')
else:
  print(S)
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')
        exit()
print('NG')

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

for i in rage(a, b):
  if i % k == 0:
    print('OK')
  else:
    print('NG')
Problem p02699 (python)

Fixed submission:
s, w = map(int, input().split())
if w >= s:
  print('unsafe')
else:
  print('safe')

Buggy submission (verdict: Runtime Error):
s, w = map(int, input().split())
if s > w:
  prtin('safe')
else:
  print('unsafe')
Problem p02711 (python)

Fixed submission:
N = input()
if '7' in N:
  print('Yes')
else:
  print('No')

Buggy submission (verdict: Runtime Error):
N = int(input())
if 7 in N:
  print("Yes")
else:
  print('No')
Problem p02729 (python)

Fixed submission:
n, m = map(int, input().split())
print(n*(n-1)//2 + m*(m-1)//2)

Buggy submission (verdict: Runtime Error):
s = input()
d = len(s)//2
print("Yes" if s[:d] == s[d+1:] "No" else)