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

Fixed submission:
import math
from fractions import Fraction as frac

MOD = 1e9 + 7

def gcd(a, b):
    if b == 0:
        return a
    return gcd(b, a % b)

def lcm(a, b):
    return a * b // gcd(a, b)

def solve(case_no):
    n = int(input())
    cnt=0
    for i in range(n):
    	a,b = map(int,input().split())
    	if a==b:
    		cnt += 1
    		if cnt == 3:
    			print("Yes")
    			exit()
    	else:
    		cnt=0
    print("No")
    	

t = 1
# t = int(input())
for i in range(1, t + 1):
    solve(i)

Buggy submission (verdict: Runtime Error):
import math

from fractions import Fraction as frac

MOD = 1e9 + 7

def gcd(a, b):

    if b == 0:

        return a

    return gcd(b, a % b)

def lcm(a, b):

    return a * b // gcd(a, b)

def solve(case_no):

    n = int(input())

    cnt=0

    for i in range(n):

    	a,b = map(int,input().split())    	if a==b:

        cnt += 1

        if cnt == 3:

    		print("Yes")

    		exit()

    	else:

    		cnt=0

    print("No")

t = 1

# t = int(input())

for i in range(1, t + 1):

    solve(i)
Problem p02571 (python)

Fixed submission:
S = list(input())
T = list(input())
defolt = 1000
for i in range(len(S)-len(T)+1):
    ans = 0
    for j in range(len(T)):
        if S[i+j] != T[j]:
            ans += 1
    defolt = min(defolt,ans)
print(defolt)

Buggy submission (verdict: Runtime Error):
S = list(input())
T = list(input())
defolt = 1000
for i in range(len(S)-len(T)):
    ans = 0
    for j in range(len(T)):
        if S[i+j] != T[j]:
            ans += 1
    defolt = min(defolt,ans)
print(ans)

Buggy submission (verdict: Runtime Error):
S = list(input())
T = list(input())
defolt = 1000
for i in range(len(S)-len(T)):
    ans = 0
    for j in range(len(T)):
        if S[i+j] != T[j]:
            ans += 1
        defolt = min(defolt,ans)
print(ans)

Buggy submission (verdict: Runtime Error):
S = list(input())
T = list(input())
defolt = 1000
for i in range(len(S)-len(T)):
    ans = 0
    for j in range(len(T)):
        if S[i+j] != T[j]:
            ans += 1
        ans = min(defolt,ans)
print(ans)
Problem p02623 (python)

Fixed submission:
# -*- coding: utf-8 -*-
"""
Created on Mon Sep  7 11:05:00 2020

@author: liang
"""

"""
片側を固定して、それぞれのケースに対して最適解を求める
それぞれのケースについて
index(b_i) =< index(b_i-1)
であるから、bの最大値bestを保存して探索することで重複探索を回避できる
"""
N, M, K = map(int, input().split())

A = [0] + [int(x) for x in input().split()]
B = [0] + [int(x) for x in input().split()]

s_b = 0
for i in range(M+1):
    s_b += B[i]
    if s_b > K:
        s_b -= B[i]
        best = i - 1
        break
else:
    best = M
res = best
#print(res)
s_a = 0
for i in range(N+1):
   # print("i", i)
    s_a += A[i]
    if s_a > K:
        break
    for j in reversed(range(best+1)):
        #print("j",j)
        if s_b <= K - s_a:
            if i + j > res:
                res = i + j
            best = j
            #print(i, j, s_a, s_b)
            break
        else:
            s_b -= B[j]
        
print(res)

Buggy submission (verdict: Runtime Error):
# -*- coding: utf-8 -*-
"""
Created on Mon Sep  7 11:05:00 2020

@author: liang
"""

"""
片側を固定して、それぞれのケースに対して最適解を求める
それぞれのケースについて
index(b_i) =< index(b_i-1)
であるから、bの最大値bestを保存して探索することで重複探索を回避できる
"""
N, M, K = map(int, input().split())

A = [0] + [int(x) for x in input().split()]
B = [0] + [int(x) for x in input().split()]

s_b = 0
for i in range(M+1):
    s_b += B[i]
    if s_b > K:
        s_b -= B[i]
        best = i - 1
        break
res = best
#print(res)
s_a = 0
for i in range(N+1):
   # print("i", i)
    s_a += A[i]
    if s_a > K:
        break
    for j in reversed(range(best+1)):
        #print("j",j)
        if s_b <= K - s_a:
            if i + j > res:
                res = i + j
            best = j
            #print(i, j, s_a, s_b)
            break
        else:
            s_b -= B[j]
Problem p02659 (python)

Fixed submission:
split = input().split()
A = int(split[0])
B = int(float(split[1])*1000)
ans = A*B//1000
print (ans)

Buggy submission (verdict: Runtime Error):

A,B=input().split()
B=B[:-3]+B[-2]
print(A＊B)
Problem p02682 (python)

Fixed submission:
A, B , C, K = map(int,input().split())
if K <= A:
    ans = K
elif K <= A + B:
    ans = A
elif K <= A + B + C:
    ans = A - (K - A - B)
else :
    ans = A - C
print(ans)

Buggy submission (verdict: Runtime Error):
A, B , C, K = map(int,input().split())
al = [1]* A
bl = [0] * B
cl = [-1]* C
l = al + bl + cl

ans = sum(l[:K])
print(ans)
Problem p03107 (python)

Fixed submission:
s = input()
print(2 * min(s.count('0'), s.count('1')))

Buggy submission (verdict: Runtime Error):
s = input()
print(2 * min(s.count(0), s.count(1)))
Problem p03208 (python)

Fixed submission:
n, k = map(int, input().split())
h = sorted([int(input()) for i in range(n)])
ans = 1e9
for i in range(n - k + 1):
  ans = min(ans, h[i + k - 1] - h[i])
print(ans)

Buggy submission (verdict: Runtime Error):
n, k = map(int, input().split())
h = sorted[int(input()) for i in range(n)]
ans = 1e9
for i in range(n - k + 1):
  ans = min(ans, h[i + k - 1] - h[i])
print(ans)
Problem p03250 (python)

Fixed submission:
a, b, c = map(int, input().split())
print(max(a, b, c) * 9 + a + b + c)

Buggy submission (verdict: Runtime Error):
a, b, c = map(int, input().split())
print(max(a, b, c) * 9 + sum(a, b, c))
Problem p02594 (python)

Fixed submission:
t = int(input())

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

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

if t >= 30:
  print('Yes')
else:
  print('No')
Problem p02595 (python)

Fixed submission:
n, d = list(map(int, input().split()))
count = 0
for i in range(n):
  x, y = list(map(int, input().split()))
  p = x **2 + y **2
  if p <= d**2:
    count += 1
    
print(count)

Buggy submission (verdict: Runtime Error):
n, d = list(map(int, split().input()))n, d = list(map(int, input().split()))
count = 0
for i in range(n):
  x, y = list(map(int, input().split()))
  p = x **2 + y **2
  if p <= d**2:
    count += 1
    
print(count)

Buggy submission (verdict: Runtime Error):
n, d = list(map(int, split().input()))
Problem p02859 (python)

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

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

if len(n) % 2 == 1:
  print('No')
else:
  a = n[0 : len(n)//2]
  b = n[len(n)//2 : len(n)]
  if a == b:
    print('Yes')
  else:
    print('No')
Problem p02860 (python)

Fixed submission:
nn = input()
n = str(input())

if len(n) % 2 == 1:
  print('No')
else:
  a = n[0 : len(n)//2]
  b = n[len(n)//2 : len(n)]
  if a == b:
    print('Yes')
  else:
    print('No')

Buggy submission (verdict: Runtime Error):
n = str(input())
if len(n) % 2 ==1:
  print('No')
else:
  a = n[0 : len(n)/2]
  b = n[len(n)/2 : len(n)]
  if a = b:
    print('Yes')
  else:
    print('No')

Buggy submission (verdict: Runtime Error):
n = str(input())
if len(n) % 2 ==1:
  print('No')
else:
  a = n[0 : len(n)/2]
  b = n[len(n)/2 : len(n)]
  if a == b:
    print('Yes')
  else:
    print('No')
Problem p02831 (python)

Fixed submission:
def gcd(a,b):
    if a==0 or b==0:
        return max([a,b])
    else:
        if a>=b:
            n=int(a/b)
            return gcd(a-n*b,b)
        else:
            n=int(b/a)
            return gcd(a,b-n*a)

def lcm(a,b):
   return int(a*b/gcd(a,b)) 
a=input().split(" ")
print(lcm(int(a[0]),int(a[1])))

Buggy submission (verdict: Runtime Error):
def gcd(a,b):
    if a==0 or b==0:
        return max([a,b])
    else:
        if a>=b:
            return gcd(a-b,b)
        else:
            return gcd(a,b-a)

def lcm(a,b):
   return int(a*b/gcd(a,b)) 
a=input().split(" ")
print(lcm(int(a[0]),int(a[1])))

Buggy submission (verdict: Runtime Error):
def lcm(a,b):
    if a==0 or b==0:
        return max([a,b])
    else:
        if a>=b:
            return lcm(a-b,b)
        else:
            return lcm(a,b-a)
a=input().split(" ")
print(lcm(int(a[0]),int(a[1])))
Problem p02623 (python)

Fixed submission:
N,M,K=map(int,input().split())
A=[]
B=[]
A=list(map(int,input().split()))
B=list(map(int,input().split()))
a=[0 for i in range(len(A)+1)]
for i in range(1,len(A)+1):
    a[i]=a[i-1]+A[i-1]

b=[0 for i in range(len(B)+1)]
for i in range(1,len(B)+1):
    b[i]=b[i-1]+B[i-1]

j=M
ans=0
for i in range(len(A)+1):

    if(K<a[i]):
        break
    #print(a[i]+b[j])
    while(a[i]+b[j]>K):
        j=j-1
    ans=max(ans,i+j)

print(ans)

Buggy submission (verdict: Runtime Error):
N,M,K=map(int,input().split())
A=[]
B=[]
A=list(map(int,input().split()))
B=list(map(int,input().split()))

dp=[[0 for j in range(K)] for i in range(max(N,M))]
if(N<M):
    ma=M
    mi=N
    turn='M'
else:
    ma=N
    mi=M
    turn='N'

if(turn='M')
    for i in range(nn):
        for j in range(K+1):
            if(mi<i):
                if(B[i]<j):
                    dp[i+1][j]=max(dp[i][j-B[i]]+1,dp[i][j])
                else:
                    dp[i+1][j]=dp[i][j]
            else:
                if(A[i]<j and B[i]<j):
                    dp[i+1][j]=max(dp[i][j-A[i]-B[i]]+2,dp[i][j])

                elif(A[i]<j):
                    dp[i+1][j]=max(dp[i][j-A[i]+1,dp[i][j]])
                elif(B[i]<j):
                    dp[i+1][j]=max(dp[i][j-B[i]]+1,dp[i][j])
                else:
                    dp[i+1][j]=dp[i][j]
else:
    for i in range(nn):
        for j in range(K+1):
            if(mi<i):
                if(A[i]<j):
                    dp[i+1][j]=max(dp[i][j-A[i]]+1,dp[i][j])
                else:
                    dp[i+1][j]=dp[i][j]
            else:
                if(A[i]<j and B[i]<j):
                    dp[i+1][j]=max(dp[i][j-A[i]-B[i]]+2,dp[i][j])

                elif(A[i]<j):
                    dp[i+1][j]=max(dp[i][j-A[i]+1,dp[i][j]])
                elif(B[i]<j):
                    dp[i+1][j]=max(dp[i][j-B[i]]+1,dp[i][j])
                else:
                    dp[i+1][j]=dp[i][j]

print(dp[nn][K])
Problem p02624 (python)

Fixed submission:


N=int(input())
count=0
for i in range(1,N+1):
    n=N//i
    count=n*(i+i*n)//(2)+count
print(count)

Buggy submission (verdict: Runtime Error):
import sympy

N=int(input())
count=0
for i in range(1,N+1):
    n=N//i
    count=n*(i+i*n)//(2)+count
print(count)
Problem p02659 (python)

Fixed submission:
import math
import decimal




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


a=decimal.Decimal(A)
b=decimal.Decimal(B)

print(int(a*b))

'''
a=int(A)
b=float(B)*100
#print(int(B))

bb=int(b)

print(math.floor(a*bb//100))
'''

Buggy submission (verdict: Runtime Error):
A,B=map(int,input().split())

print(int(A*B))
Problem p02707 (python)

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

d = {}

for i in range(N - 1):
    if A[i] in d:
        d[A[i]].append(i + 2)
    else:
        d[A[i]] = [i + 2]

for i in range(1, N + 1):
    if i in d:
        print(len(d[i]))
    else:
        print(0)

Buggy submission (verdict: Runtime Error):
N=int(input())
a=[int(i) for i in input().split()]
count=0
for j in range(N):
    for i in range(N-1):
        if(a[i]==j+1):
            count=count+1
    print(count)
    count=0
Problem p03775 (python)

Fixed submission:
N=int(input())

for i in range(1,N+1):
    if(N%i==0):
        j=int(N/i)
        ans=max(len(str(i)),len(str(j)))

    if(N<i**2):
        break
print(ans)

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

for i in range(1,N):
    if(N%i==0):
        j=int(N/i)
        ans=max(len(str(i)),len(str(j)))

    if(N<i**2):
        break
print(ans)
Problem p02819 (python)

Fixed submission:
#
# 149C Next Prime
#

def isPrime(num):
    if num == 2:
        return True
    for p in range(2, num):
        if  num % p == 0:
            return False
    return True

if __name__ == "__main__":
    n = input()
    num = int(n)
    while True:
        if isPrime(num):
            print(num)
            break
        num += 1

Buggy submission (verdict: Runtime Error):
#
# 149C Next Prime
#
from sympy import nextprime

n = input()
print(nextprime(int(n)-1))

Buggy submission (verdict: Runtime Error):
#
# 149C Next Prime
#
from sympy import nextprime

n = input()
print(nextprime(int(n)-1))
Problem p02729 (python)

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

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

a = [[0 for i in range(w)] for j in range(h)]

for i in range(h):
    s = input()
    for j in range(w):
        a[i][j] = int(s[j])

best_result = h * w + 1000

for m in range(2 ** (h - 1)):
    mask = m
    num_splits = 0
    splits = []
    i = 0
    while mask > 0:
        if (mask % 2) == 1:
            num_splits += 1
            splits.append(i)
        i += 1
        mask = mask // 2

    #print('mask = ', m, 'splits = ', splits, 'num_splits =', num_splits)

    counts = [0 for j in range(num_splits + 1)]
    current_counts = [0 for j in range(num_splits + 1)]
    result = num_splits

    for j in range(w):
        if result >= best_result:
            break
        split_index = 0
        success = True
        current_counts[0] = 0

        for i in range(h):
            if a[i][j] == 1:
                counts[split_index] += 1
                if counts[split_index] > k:
                    success = False

            current_counts[split_index] += a[i][j]

            if split_index < num_splits and i == splits[split_index]:
                split_index += 1
                current_counts[split_index] = 0

        if not success:
            result += 1
            #print('not success j = ', j, 'result = ', result, 'counts = ', counts)
            for x in range(num_splits + 1):
                counts[x] = current_counts[x]
            

    best_result = min(best_result, result)

print(best_result)
Problem p02659 (python)

Fixed submission:
a, b = input().split()
a = int(a)
b = int(b.replace('.',''))
print(a*b//100)

Buggy submission (verdict: Runtime Error):
a, b = input().split()
a = int(a)
b.replace('.','')
b = int(b)
print(a*b//100)
Problem p02571 (python)

Fixed submission:
S = input()
T = input()
ans = len(T)

for i in range(len(S)-len(T)+1):
  c = 0
  for j in range(len(T)):
    if T[j] != S[i+j] :
      c = c + 1
  ans = min(ans, c)

print(ans)

Buggy submission (verdict: Runtime Error):
S = input()
T = input()
lis = []
count = 0 
saishou = 0

for i in range(len(T)):
  for j in range(i, len(S)-len(T)+i):
    c = 0
    while  i + c < len(T) and j + c < len(S) :
      if T[i+c] == S[j+c]:
        c = c + 1
        lis.append(c)
      else:
        break
        

saidai = max(lis)
saishou = len(T) - saidai

print(saishou)
Problem p02676 (python)

Fixed submission:
K = int(input())
S = str(input())
if len(S) > K:
    S_dash = S[0:K]
    S_dash += '...'
    print(S_dash)
else:
    print(S)

Buggy submission (verdict: Runtime Error):
S, K = input().split()
K = int(K)
if len(S) > K:
    S_dash = S[0:K]
    S_dash += '...'
    print(S_dash)
else:
    print(S)
Problem p02627 (python)

Fixed submission:
a = input()
 
if True == a.isupper():
  print("A")
else :
  print("a")

Buggy submission (verdict: Runtime Error):
a = input()
 
if True == a.isupper():
  Print("A")
else :
  print("a")

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

if True = a.isupper():
  Print("A")
else :
  print("a")

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

if True == a.isupper():
  Print("A")
else :
  print("a")

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

if True = a.isupper():
  Print("A")
else :
  print("a")

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

if a.isupper() = True:
  Print("A")
else :
  print("a")
Problem p02570 (python)

Fixed submission:
a,b,c  = map(int,input().split())
if a <= b*c:
    print('Yes')
else:
    print('No')

Buggy submission (verdict: Runtime Error):
a = int(input())
p = list(map(int,input().split()))
mod = 10**9 + 7

sum_list =[p[i]*p[t] for i in range(a) for t in range(a) if i<=t and not i ==t]
num = sum(sum_list)%mod
print(num)
Problem p02572 (python)

Fixed submission:
import itertools as itr

a = int(input())
p = list(map(int,input().split()))
mod = 10**9 + 7
ans =0
sum_list = list(itr.accumulate(p))
for i in range(len(p)-1):
    o = p[i+1]
    w =sum_list[i]
    ans = (ans+o*w%mod)%mod
print(ans)

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

a = int(input())
p = list(map(int,input().split()))
mod = 10**9 + 7

sum_list =[p[i]*p[t] for i in range(a) for t in range(a) if i<t ]
num = np.sum(sum_list)
num = num%mod
print(num)
Problem p03041 (python)

Fixed submission:
#!/usr/bin/env python
# coding: utf-8


def main():
    n, k = list(map(int, input().split()))
    k -= 1
    s = input()
    print(s[:k]+s[k].lower()+s[k+1:])


if __name__ == '__main__':
    main()

Buggy submission (verdict: Runtime Error):
#!/usr/bin/env python
# coding: utf-8


def main():
    n, k = list(map(int, input().split()))
    s = input()
    print(s[:k]+s[k].lower()+s[k+1:])


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

Fixed submission:
S = input()
T = input()
Sli = list(S)
Tli = list(T)
cli = []

for i in range(len(Sli) - len(Tli) + 1):
    c = len(Tli)
    for j in range(len(Tli)):
        if Sli[i + j] == Tli[j]:
            c -= 1
    cli.append(c)

print(min(cli))

Buggy submission (verdict: Runtime Error):
S = input()
T = input()
Sli = list(S)
Tli = list(T)
cli = []

for i in range(len(Sli) - len(Tli)):
    c = len(Tli)
    for j in range(len(Tli)):
        if Sli[i + j] == Tli[j]:
            c -= 1
    cli.append(c)

print(min(cli))
Problem p02595 (python)

Fixed submission:
import numpy as np

N, D = list(map(int, input().split())) 
cnt = 0
for n in range(0, N):
  x, y = list(map(int, input().split())) 
  if  (x*x + y*y) <= D*D:
    cnt += 1

print(cnt)

Buggy submission (verdict: Runtime Error):
num = int(input())
seven = 7
col = -1
cnt = 1

for i in range(0, 1000):
  if seven % num == 0:
    col = 1
    break
  else:
    seven = (seven*10) + 7
    cnt+=1

if col == 1:
  print(cnt)
else:
  print(col)

Buggy submission (verdict: Runtime Error):
import math
N, D = int(input())
cnt = 0

for n in range(0, N):
  x, y = int(input())
  if math.sqrt(x^2 + y^2) > D:
    cnt += 1

print(cnt)
Problem p02689 (python)

Fixed submission:
N, M =map(int, input().split())
H_tree =[0]+[int(n) for n in input().split()]
GOOD_Tree = [0]+[1 for n in range(N)]
 
for i in range(M):
  A, B = map(int, input().split())
  if H_tree[A]<=H_tree[B]:GOOD_Tree[A] = 0
  if H_tree[A]>=H_tree[B]:GOOD_Tree[B] = 0
print(sum(GOOD_Tree))

Buggy submission (verdict: Runtime Error):
N, M =map(int, input().split())
H_tree = map(int, input().split())
GOOD_Tree = [1 for n in range(len(H_tree))]

for n i in range(M):
  A, B =map(int, input().split())
  if H_tree[A-1]>=H_tree[B-1]:
    GOOD_tree[A-1] = 0
  else:
    GOOD_tree[B-1] = 0
print(GOOD_tree.count(1))
Problem p02546 (python)

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

Buggy submission (verdict: Runtime Error):
N=int(input())
a=1
count=0
while a<N:
  b=1
  #print(a,b)
  for i in range(N//a+1):
    c=N-a*b
    if c>0:
      count+=1
      #print(a,b,c)
    b+=1
  a+=1
print(count)
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):
import numpy
n=int(input())
l=list(map(int, input().split()))
res=0
l.append(0)
l.reverse()
cum=numpy.cumsum(l)
for i in range(n+1):
    res+=l[n-i]*cum[n-i-1]
print(res%(10**9+7))

Buggy submission (verdict: Runtime Error):
import numpy
n=input()
l=list(map(int, input().split()))
res=0
#print(f"le{len(l)}")
l.append(0)
l.reverse()
for i in range(len(l)): 
    print(l[len(l)-1-i],numpy.cumsum(l)[len(l)-i-2])
    res+=l[len(l)-1-i]*numpy.cumsum(l)[len(l)-i-2]
    #print(f"{res}レス")
print(res%(10**9+7))
#print(res)

Buggy submission (verdict: Runtime Error):
n=input()
l=list(map(int, input().split()))
res=0
#print(f"le{len(l)}")
for i in range(len(l)):
    for j in range(i+1,len(l)):
        res+=l[i]*l[j]
        #print(res)
print(res%(10**9+7))

Buggy submission (verdict: Runtime Error):
d,t,s=map(int, input().split())
if d/s<=t:
  print("Yes")
elif:
  print("No")
Problem p02689 (python)

Fixed submission:
n,m=map(int, input().split())
h=list(map(int, input().split()))
near=[[0] for i in h]
for i in range(m):
    a,b=map(int, input().split())
    near[a-1].append(h[b-1])
    near[b-1].append(h[a-1])
cnt=0
for i in range(n):
    if max(near[i])<h[i]:
        cnt+=1
print(cnt)

Buggy submission (verdict: Runtime Error):
n,m=map(int, input().split())
h=list(map(int, input().split()))
near=[[] for i in range(n)]
for i in range(m):
    a,b=map(int, input().split())
    near[a-1].append(h[b-1])
    near[b-1].append(h[a-1])
cnt=0
for i in range(n):
    if max(near[i])<=h[i]:
        cnt+=1
print(cnt)
Problem p02793 (python)

Fixed submission:
import fractions
N = int(input())
a = list(map(int, input().split()))
ans = a[0]
for i in range(1, N):
    ans = ans * a[i] // fractions.gcd(ans, a[i])
 
total=0  
for i in range(0,N):
    total+= ans//a[i]

print(total%(10**9+7))

Buggy submission (verdict: Runtime Error):
import fractions
N = int(input())
a = list(map(int, input().split()))
ans = a[0]
for i in range(1, N):
    ans = ans * a[i] // fractions.gcd(ans, a[i])
 
total=0  
for i in range(0,N):
  if total+ ans/a[i] >= 10**9+7:
    total = (total+ans//a[i])%(10**9+7)
  else:
    total+= ans//a[i]

Buggy submission (verdict: Runtime Error):
import fractions
N = int(input())
a = list(map(int, input().split()))
ans = a[0]
for i in range(1, N):
    ans = ans * a[i] // fractions.gcd(ans, a[i])

total=0  
for i in range(0,N):
  if total+ ans/a[i] >= 10**9+7:
    total = (total+ans/a[i])%(10**9+7)
  else:
    total+= ans/a[i]
  
  
  
print(int(total))
Problem p02879 (python)

Fixed submission:
A,B = map(int, input().split())
if (A<=9) & (B<=9):
  print(A*B)
else:
  print(-1)

Buggy submission (verdict: Runtime Error):
import sys

N =int(input())

for a in range(1,10):
  for b in range(1,10):
    if a*b == N:
      print('yes')
      sys.exit()
print('no')

Buggy submission (verdict: Runtime Error):
A = int(input())
B = int(input())
if (A<=9) & (B<=9):
  print(A*B)
else:
  print(-1)

Buggy submission (verdict: Runtime Error):
A = int(input())
B = int(input())
if A<=9 & B<=9:
  print(A*B)
else:
  print(-1)

Buggy submission (verdict: Runtime Error):
A = input()
B = input()
if A<=9 & B<=9:
  print(A*B)
else:
  -1
Problem p02897 (python)

Fixed submission:
n = int(input())

if n%2 ==0:
  print(0.5)
else:
  s=1/2+1/(2*n)
  print(s)

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

if n%2 ==1:
  print(1/2+1/2n)
else:
  print(0.5)
Problem p02552 (python)

Fixed submission:
import sys
x = int(sys.stdin.read().strip())
print(int(not x))

Buggy submission (verdict: Runtime Error):
import sys
x = int(sys.stdin.read().strip())
print int(not x)
Problem p02847 (python)

Fixed submission:
s = input()

week = ["SUN", "MON", "TUE", "WED", "THU", "FRI", "SAT"]

for i in range(len(week)):
    if s == week[i]:
        print(len(week)-i)

Buggy submission (verdict: Runtime Error):
W = ["SUM", "MON", "TUE", "WED", "THU", "FRI", "SAT"]
S = input()
print(len(W) - W.index(S))