Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Runtime Error):

Jupyter Notebook
200621 Current Kernel Logo

Python 3

    File
    Edit
    View
    Insert
    Cell
    Kernel
    Help

1

import sys

2

#sys.exit()

3

#sorted( ,reverse=True)

4

#N = int(input())

5

#S,T = map(int, input().split())

6

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

7

#A = [int(input()) for _ in range(N)]

8

​

9

#cnt = 0

10

#cnt += 1

11

​

12

​

13

​

14

#print(N)

15

#print(S,T)

16

#print(A)

17

#print('Yes')

18

#print('No')

19

#print(cnt)

3
3
4
5
3
[3, 4, 5]

1

import sys

2

#sys.exit()

3

#sorted( ,reverse=True)

4

#N = int(input())

5

#S,T = map(int, input().split())

6

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

7

#A = [int(input()) for _ in range(N)]

8

​

9

#cnt = 0

10

#cnt += 1

11

​

12

​

13

​

14

#print(N)

15

#print(S,T)

16

#print(A)

17

#print('Yes')

18

#print('No')

19

#print(cnt)

20

​

21

S = str(input())

22

A = ["A", "B", "C", "D", "E", "F", "G", "H", "I", "J", "K", "L", "M", "N", "O", "P", "Q", "R", "S", "T", "U","V","W","X","Y","Z"]

23

​

24

if S in A:

25

    print('A')

26

else:

27

    print('a')

a
a

1

​



Fixed submission:
import sys
#sys.exit()
#sorted( ,reverse=True)
#N = int(input())
#S,T = map(int, input().split())
#A = list(map(int, input().split()))
#A = [int(input()) for _ in range(N)]

#cnt = 0
#cnt += 1



#print(N)
#print(S,T)
#print(A)
#print('Yes')
#print('No')
#print(cnt)

S = str(input())
A = ["A", "B", "C", "D", "E", "F", "G", "H", "I", "J", "K", "L", "M", "N", "O", "P", "Q", "R", "S", "T", "U","V","W","X","Y","Z"]

if S in A:
    print('A')
else:
    print('a')
Buggy python submission (verdict: Time Limit Exceeded):
import sys
#sys.exit()
#sorted( ,reverse=True)
N = int(input())
#S,T = map(int, input().split())
A = list(map(int, input().split()))
#A = [int(input()) for _ in range(N)]
A1 = 1
for i in A:
    A1 *= i
if A1 > 1*10**18:
    print("-1")
else:
    print(A1)
#cnt = 0
#cnt += 1



#print(N)
#print(S,T)
#print(A)
#print('Yes')
#print('No')

Fixed submission:
import sys
#sys.exit()
#sorted( ,reverse=True)
N = int(input())
#S,T = map(int, input().split())
A = list(map(int, input().split()))
if 0 in A:
    print(0)
    sys.exit()
#A = [int(input()) for _ in range(N)]
A1 = 1
for i in A:
    A1 *= i
    if A1 > 10**18:
        print("-1")
        sys.exit()

print(A1)
#cnt = 0
#cnt += 1



#print(N)
#print(S,T)
#print(A)
#print('Yes')
#print('No')
Buggy python submission (verdict: Runtime Error):
A,B,C,K= map(int, input().split())
Z = [1,]*A + [0,]*B+[-1,]*C
ans = 0
for i in Z[0:K]:
    ans += i
print(ans)

Fixed submission:
A,B,C,K= map(int, input().split())
if A >= K:
    print(K)
    #print("a")
else:
    ans = A
    if B >= K-A:
        print(A)
        #print("b")
    else:
        print(A-(K-(A+B)))
        #print("c")
Buggy python submission (verdict: Time Limit Exceeded):
import sys
import math

N = int(input())

ans = 0
for i in range (1,N+1):
    for j in range (1,N+1):
        for k in range (1,N+1):
            ans += math.gcd(math.gcd(i,j),math.gcd(j,k))
            
print(ans)


Fixed submission:
import sys
import math

N = int(input())

ans = 0
for i in range (1,N+1):
    for j in range (1,i+1):
        for k in range (1,j+1):
            if i == j == k:
                ans += math.gcd(math.gcd(i,j),k)
            elif i == j or j== k:
                ans += 3*math.gcd(math.gcd(i,j),k)
            else:
                ans += 6*math.gcd(math.gcd(i,j),k)
            #print(i,j,k)
         
            
print(ans)
Buggy python submission (verdict: Runtime Error):
 X, Y, Z = map(int, input().split())
print(Z,X,Y)

Fixed submission:
X, Y, Z = map(int, input().split())
print(Z,X,Y)

Buggy python submission (verdict: Runtime Error):
 X, Y, Z = map(int, input().split())
print(Z,X,Y)

Fixed submission:
X, Y, Z = map(int, input().split())
print(Z,X,Y)
Buggy python submission (verdict: Time Limit Exceeded):
import sys
N, M = map(int, input().split())
ans = N
while True:
   if abs(ans-M) < ans:
        ans = abs(ans-M)
   else:
    print(ans)
    sys.exit()


Fixed submission:
import sys
N, M = map(int, input().split())
ans = N%M
while True:
   if abs(ans-M) < ans:
        ans = abs(ans-M)
   else:
    print(ans)
    sys.exit()
Buggy python submission (verdict: Runtime Error):
A, B = map(int, input().split())

ans1 = int(A *100// 8) 
ans2 = int(B *100 // 10)

if ans1 = ans2:
    print(ans1)

elif ans1 > ans2:
    ans2_2 = int((B+1) *100 // 10)
    list = [int(ans2)]

    for i in range(ans2+1,ans2_2):
        list.append(int(i)) 
    
    if int(ans1) in list:
        print(ans1)
    else:
        print(-1)
elif ans1 < ans2:
    ans1_2 = int((A+1) *100 // 8)
    list = [int(ans1)]

    for i in range(ans1+1,ans1_2):
        list.append(int(i)) 
    
    if int(ans2) in list:
        print(ans2)
    else:
        print(-1)

Fixed submission:
S = str(input())
if S[0] != S[1] or S[1] != S[2]:
    print("Yes")
else:
    print("No")
Buggy python submission (verdict: Runtime Error):
A, B = map(int, input().split())

ans1 = int(A *100// 8) 
ans2 = int(B *100 // 10)

if ans1 = ans2:
    print(ans1)

elif ans1 > ans2:
    ans2_2 = int((B+1) *100 // 10)
    list = [int(ans2)]

    for i in range(ans2+1,ans2_2):
        list.append(int(i)) 
    
    if int(ans1) in list:
        print(ans1)
    else:
        print(-1)
elif ans1 < ans2:
    ans1_2 = int((A+1) *100 // 8)
    list = [int(ans1)]

    for i in range(ans1+1,ans1_2):
        list.append(int(i)) 
    
    if int(ans2) in list:
        print(ans2)
    else:
        print(-1)

Fixed submission:
A, B = map(int, input().split())
ans1 = int(A *100// 8) 
ans2 = int(B *100 // 10)
ans1_2 = int((A+1) *100 // 8)
ans2_2 = int((B+1) *100 // 10)
list1 = []
list2 = []

for i in range(ans1,ans1_2):
    if int(i * 0.08) == A: 
        list1.append(int(i))
for j in range(ans2,ans2_2):
    if int(j * 0.1) == B:
        list2.append(int(j))
if list1[0] == list2[0]:
    print(list1[0])
elif list1[0] > list2[0]:
    if list1[0] in list2:
        print(list1[0])
    else:
        print(-1)
elif list1[0] < list2[0]:
    if list2[0] in list1:
        print(list2[0])
    else:
        print(-1)

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

ans1 = int(A *100// 8) 
ans2 = int(B *100 // 10)

if ans1 = ans2:
    print(ans1)

elif ans1 > ans2:
    ans2_2 = int((B+1) *100 // 10)
    list = [int(ans2)]

    for i in range(ans2+1,ans2_2):
        list.append(int(i)) 
    
    if int(ans1) in list:
        print(ans1)
    else:
        print(-1)
elif: ans1 < ans2:
    ans1_2 = int((A+1) *100 // 8)
    list = [int(ans1)]

    for i in range(ans1+1,ans1_2):
        list.append(int(i)) 
    
    if int(ans2) in list:
        print(ans2)
    else:
        print(-1)

Fixed submission:
A, B = map(int, input().split())
ans1 = int(A *100// 8) 
ans2 = int(B *100 // 10)
ans1_2 = int((A+1) *100 // 8)
ans2_2 = int((B+1) *100 // 10)
list1 = []
list2 = []

for i in range(ans1,ans1_2):
    if int(i * 0.08) == A: 
        list1.append(int(i))
for j in range(ans2,ans2_2):
    if int(j * 0.1) == B:
        list2.append(int(j))
if list1[0] == list2[0]:
    print(list1[0])
elif list1[0] > list2[0]:
    if list1[0] in list2:
        print(list1[0])
    else:
        print(-1)
elif list1[0] < list2[0]:
    if list2[0] in list1:
        print(list2[0])
    else:
        print(-1)
Buggy python submission (verdict: Time Limit Exceeded):
S = str(input())
Q = int(input())
cnt = 2
for _ in range(Q):
    L = input().split()
    if L[0] == "1":
        cnt += 1
    elif L[0] == "2":
        if L[1] == "1" and (cnt)%2 == 0:
            S = str(L[2]) + S
        elif L[1] == "1" and (cnt)%2 != 0:
            S =  S + str(L[2])
        elif L[1] == "2" and (cnt)%2 == 0:
            S =  S + str(L[2])
        elif L[1] == "2" and (cnt)%2 != 0:
            S = str(L[2]) + S
if cnt%2 != 0:
    print(S[::-1])
else:
    print(S)

            
        
    

Fixed submission:
from collections import deque

S = deque(input())
Q = int(input())
cnt = 2
for _ in range(Q):
    L = input().split()
    if L[0] == "1":
        cnt += 1
    elif L[0] == "2":
        if L[1] == "1" and (cnt)%2 == 0:
            S.appendleft(str(L[2]))
        elif L[1] == "1" and (cnt)%2 != 0:
            S.append(str(L[2]))
        elif L[1] == "2" and (cnt)%2 == 0:
            S.append(str(L[2]))
        elif L[1] == "2" and (cnt)%2 != 0:
            S.appendleft(str(L[2]))
S ="".join(S)
if cnt%2 != 0:
        print(S[::-1])
else:
        print(S)
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
S = list(str(input()) for _ in range(N))
S2 = sorted(S)
cnt1 = [0,]
cnt2 = [0,]*N
word = [0,]
for i in range(N-1):
    if S2[i] != S2[i+1]:
        cnt1.append(i+1)
        word.append(S2[i])
cnt2 = [0,]*len(cnt1)
for i in range(1,len(cnt1)):
    cnt2[i] = cnt1[i] - cnt1[i-1]
cnt2.append(N-sum(cnt2))
word.append(S2[N-1])
for i in range(len(cnt2)):
    if cnt2[i] == max(cnt2):
        print(word[i])

Fixed submission:
N = int(input())
S = list(str(input()) for _ in range(N))
S2 = sorted(S)
cnt1 = [0,]
cnt2 = [0,]*N
word = [0,]
for i in range(N-1):
    if S2[i] != S2[i+1]:
        cnt1.append(i+1)
        word.append(S2[i])
cnt2 = [0,]*len(cnt1)
for i in range(1,len(cnt1)):
    cnt2[i] = cnt1[i] - cnt1[i-1]
cnt2.append(N-sum(cnt2))
word.append(S2[N-1])
X = max(cnt2)
for i in range(len(cnt2)):
    if cnt2[i] == X:
        print(word[i])
Buggy python submission (verdict: Time Limit Exceeded):
import sys
input = sys.stdin.readline
N = int(input())
A = list(map(int, input().split()))
for i in range(N-1):
    for j in range(i+1,N):  
        if A[i] == A[j]:
            print("NO")
            sys.exit()
else:
    print("YES")

Fixed submission:
import sys
N = int(input())
A = list(map(int, input().split()))
A2 = sorted(A)
for i in range(N-1): 
        if A2[i] == A2[i+1]: 
            print("NO")
            sys.exit()
else:
    print("YES")

Buggy python submission (verdict: Time Limit Exceeded):
import sys
N = int(input())
A = list(map(int, input().split()))
for i in range(N-1):
    for j in range(i+1,N):  
        if A[i] == A[j]:
            print("NO")
            sys.exit()
else:
    print("YES")
            

Fixed submission:
import sys
N = int(input())
A = list(map(int, input().split()))
A2 = sorted(A)
for i in range(N-1): 
        if A2[i] == A2[i+1]: 
            print("NO")
            sys.exit()
else:
    print("YES")

Buggy python submission (verdict: Time Limit Exceeded):
import sys
N = int(input())
A = list(map(int, input().split()))
for i in range(N):
    for j in range(i+1,N):  
        if A[i] == A[j]:
            print("NO")
            sys.exit()
else:
    print("YES")

Fixed submission:
import sys
N = int(input())
A = list(map(int, input().split()))
A2 = sorted(A)
for i in range(N-1): 
        if A2[i] == A2[i+1]: 
            print("NO")
            sys.exit()
else:
    print("YES")
Buggy python submission (verdict: Runtime Error):
N = int(input())
P = list(map(int, input().split()))
cnt = 1
for i in range(1,N):
    if P[i] < min(P[0:i]): cnt += 1
print(cnt)

Fixed submission:
N, M = map(int, input().split())
if N == M:
    print('Yes')
else:
    print('No')
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
P = list(map(int, input().split()))
cnt = 1
for i in range(1,N):
    if P[i] < min(P[0:i]): cnt += 1
print(cnt)

Fixed submission:
N = int(input())
P = list(map(int, input().split()))
cnt = 1
m = P[0]
for i in range(1,N):
    if P[i] < m:
        cnt += 1
        m = P[i]
print(cnt)

Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
P = list(map(int, input().split()))
cnt = 1
for i in range(1,N):
    if P[i] < min(P[0:i]):
        cnt += 1
print(cnt)

Fixed submission:
N = int(input())
P = list(map(int, input().split()))
cnt = 1
m = P[0]
for i in range(1,N):
    if P[i] < m:
        cnt += 1
        m = P[i]
print(cnt)

Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
P = list(map(int, input().split()))
cnt = 1
for i in range(1,N):
    if P[i] <= min(P[0:i]):
        cnt += 1
print(cnt)

Fixed submission:
N = int(input())
P = list(map(int, input().split()))
cnt = 1
m = P[0]
for i in range(1,N):
    if P[i] < m:
        cnt += 1
        m = P[i]
print(cnt)

Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
P = list(map(int, input().split()))
cnt = 1
for i in range(1,N):
    if P[i] <= min(P[0:i]):
        cnt += 1
print(cnt)

Fixed submission:
N = int(input())
P = list(map(int, input().split()))
cnt = 1
m = P[0]
for i in range(1,N):
    if P[i] < m:
        cnt += 1
        m = P[i]
print(cnt)
Buggy python submission (verdict: Runtime Error):
K,X = map(int, input().split())
if K*500 >= X:
    print('Yes')
else:
    print('No')

Fixed submission:
l = ['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z',]
C = input()
print(l[l.index(C)+1])

Buggy python submission (verdict: Runtime Error):
K,X = map(int, input().split())
if K*500 >= X:
    print('Yes')
else:
    print('No')


Fixed submission:
l = ['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z',]
C = input()
print(l[l.index(C)+1])
Buggy python submission (verdict: Runtime Error):
N = int(input())
S,T = list(map(str, input().split()))
for i in range(N):
    print(S[i],end='')
    print(T[i],end='')

Fixed submission:
A = int(input())
B = int(input())
print(6-A-B)

Buggy python submission (verdict: Runtime Error):
N = int(input())
S,T = list(map(str, input().split()))
for i in range(N):
    print(S[i],end='')
    print(T[i],end='')

Fixed submission:
A = int(input())
B = int(input())
print(6-A-B)

Buggy python submission (verdict: Runtime Error):
N = int(input())
S,T = list(map(str, input().split()))
for i in range(N):
    print(S[i],end='')
    print(T[i],end='')

Fixed submission:
A = int(input())
B = int(input())
print(6-A-B)
Buggy python submission (verdict: Runtime Error):
l = ['SUN', 'MON', 'TUE', 'WED', 'THU', 'FRY', 'SAT']
S = input()
print(7-l.index(S))

Fixed submission:
l = ['SUN', 'MON', 'TUE', 'WED', 'THU', 'FRI', 'SAT']
S = input()
print(7-l.index(S))

Buggy python submission (verdict: Runtime Error):
l = ['SUN', 'MON', 'TUE', 'WED', 'THU', 'FRY', 'SAT']
S = input()
print(7-l.index(S))

Fixed submission:
l = ['SUN', 'MON', 'TUE', 'WED', 'THU', 'FRI', 'SAT']
S = input()
print(7-l.index(S))

Buggy python submission (verdict: Runtime Error):
l = ['SUN', 'MON', 'TUE', 'WED', 'THU', 'FRY', 'SAT']
S = input()
print(7-l.index(S))

Fixed submission:
l = ['SUN', 'MON', 'TUE', 'WED', 'THU', 'FRI', 'SAT']
S = input()
print(7-l.index(S))
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
cnt = N+1-2
for i in range(1,N//2):
    if N%i == 0:
        if cnt > i+N//i-2:
            cnt = i+N//i-2
    if cnt == N**(0.5) * 2 -2:
        break
print(cnt)

Fixed submission:
N = int(input())
cnt = N+1-2
for i in range(1,int(N**0.5)+1):
    if N%i == 0:
        if cnt > i+N//i-2:
            cnt = i+N//i-2
    if cnt == N**(0.5) * 2 -2:
        break
print(cnt)
Buggy python submission (verdict: Time Limit Exceeded):
#abc142C_go to school
N = int(input())
A = list(map(int, input().split()))
ans = []*N 
for i in range(1,N+1):
    ans.insert(i-1,A.index(i)+1)    
print(*ans)

Fixed submission:
N = int(input())
A = list(map(int, input().split()))
L = [[] for i in range(N)]
for i in range(N):
    L[i] = [A[i], i+1]
L.sort()
ans = [0 for i in range(N)]
for i in range(N):
    ans[i] = L[i][1]
print(*ans)

Buggy python submission (verdict: Time Limit Exceeded):
#abc142C_go to school
N = int(input())
A = list(map(int, input().split()))
ans = [] 
for i in range(1,N+1):
    ans.append(A.index(i)+1)    
print(*ans)


Fixed submission:
N = int(input())
A = list(map(int, input().split()))
L = [[] for i in range(N)]
for i in range(N):
    L[i] = [A[i], i+1]
L.sort()
ans = [0 for i in range(N)]
for i in range(N):
    ans[i] = L[i][1]
print(*ans)

Buggy python submission (verdict: Time Limit Exceeded):
#abc142C_go to school
N = int(input())
A = list(map(int, input().split()))
for i in range(1,N+1):
    print(A.index(i)+1,end=' ')

Fixed submission:
N = int(input())
A = list(map(int, input().split()))
L = [[] for i in range(N)]
for i in range(N):
    L[i] = [A[i], i+1]
L.sort()
ans = [0 for i in range(N)]
for i in range(N):
    ans[i] = L[i][1]
print(*ans)

Buggy python submission (verdict: Time Limit Exceeded):
#abc142C_go to school
N = int(input())
A = list(map(int, input().split()))
cnt =1
while cnt < N+1:
    for i in range(N):
        if A[i] == cnt:
            print(i+1,end=' ')
            cnt +=1
            break

Fixed submission:
N = int(input())
A = list(map(int, input().split()))
L = [[] for i in range(N)]
for i in range(N):
    L[i] = [A[i], i+1]
L.sort()
ans = [0 for i in range(N)]
for i in range(N):
    ans[i] = L[i][1]
print(*ans)
Buggy python submission (verdict: Runtime Error):
S = list(map(str, input()))
count1 = 0
count2 = 1
while count2 < len(S):        
    if S[count2] == 'R':
        print('No')
        break
    else:
        count2 += 2
while count1+1 <= len(S):
    if S[count1] == 'L':
        print('No')
        break
    else: count +=2

else:
    print('Yes')

Fixed submission:
l = ['Sunny', 'Cloudy', 'Rainy' ]
S = input()
if S == 'Rainy':
    print('Sunny')
else:
    print(l[l.index(S)+1])
Buggy python submission (verdict: Runtime Error):
S = list(map(str, input()))
count1 = 0
count2 = 1
while count2 < len(S):        
    if S[count2] == 'R':
        print('No')
        break
    else:
        count2 += 2
while count1+1 <= len(S):
    if S[count1] == 'L':
        print('No')
        break
    else: count +=2

else:
    print('Yes')

Fixed submission:
S = list(map(str, input()))
count1 = 0
count2 = 1
while count1+1 <= len(S):
    if S[count1] == 'L':
        print('No')
        break
    else: count1 +=2
else:
    while count2 < len(S):        
        if S[count2] == 'R':
            print('No')
            break
        else:
            count2 += 2
    else:
        print('Yes')

Buggy python submission (verdict: Runtime Error):
S = list(map(str, input()))
count1 = 0
count2 = 1
while count2 < len(S):        
    if S[count2] == 'R':
        print('No')
        break
    else:
        count2 += 2
while count1+1 <= len(S):
    if S[count1] == 'L':
        print('No')
        break
    else: count +=2

else:
    print('Yes')

Fixed submission:
S = list(map(str, input()))
count1 = 0
count2 = 1
while count1+1 <= len(S):
    if S[count1] == 'L':
        print('No')
        break
    else: count1 +=2
else:
    while count2 < len(S):        
        if S[count2] == 'R':
            print('No')
            break
        else:
            count2 += 2
    else:
        print('Yes')

Buggy python submission (verdict: Runtime Error):
S = list(map(str, input()))
count1 = 0
count2 = 1
while count2 < len(S):        
    if S[count2] == 'R':
        print('No')
        break
    else:
        count2 += 2
while count1+1 <= len(S):
    if S[count1] == 'L':
        print('No')
        break
    else: count +=2

else:
    print('Yes')

Fixed submission:
S = list(map(str, input()))
count1 = 0
count2 = 1
while count1+1 <= len(S):
    if S[count1] == 'L':
        print('No')
        break
    else: count1 +=2
else:
    while count2 < len(S):        
        if S[count2] == 'R':
            print('No')
            break
        else:
            count2 += 2
    else:
        print('Yes')
Buggy python submission (verdict: Time Limit Exceeded):
N,K,Q = map(int, input().split())
A =[int(input()) for _ in range(Q)]
ans =[]
for i in range(N):
    if K - (Q-(A.count(i+1))) > 0:
        print("Yes")
    else:
        print("No")

Fixed submission:
N,K,Q = map(int, input().split())
A = [int(input()) for i in range(Q)]
cnt =[0,]*N
for i in range(Q):
    cnt[(A[i]-1)] += 1
for i in range(N):
    if K-Q+cnt[i] > 0:
        print('Yes')
    else:
        print('No')

Buggy python submission (verdict: Time Limit Exceeded):
N,K,Q = map(int, input().split())
A =[int(input()) for _ in range(Q)]
ans =[]
for i in range(N):
    ans.append(A.count(i+1))
for i in range(N):
    if K - (Q-ans[i]) > 0:
        print("Yes")
    else:
        print("No")

Fixed submission:
N,K,Q = map(int, input().split())
A = [int(input()) for i in range(Q)]
cnt =[0,]*N
for i in range(Q):
    cnt[(A[i]-1)] += 1
for i in range(N):
    if K-Q+cnt[i] > 0:
        print('Yes')
    else:
        print('No')
Buggy python submission (verdict: Runtime Error):
A,B = map(int, input().split())
n =1
while True:
    if B == 1:
        print(0)
        break
    if B <= n*(A-1)+1:
        print(n)
        break
    else:
        n += 1

Fixed submission:
a,b,c =input()
d,e,f =input()
cnt = 0
if a == d:
    cnt = cnt +1
if b == e:
    cnt = cnt +1
if c == f:
    cnt = cnt +1
print(cnt)
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
A = [int(input()) for _ in range(N)] 
for i in range(N):
    B = A[i]
    A[i] = 0
    print(max(A))
    A[i] = B


Fixed submission:
import sys
N = int(input())
A = [int(input()) for _ in range(N)] 
A_max1 = max(A)
if A.count(A_max1) >= 2:
    for i in range(N):
        print(A_max1)
    sys.exit()    
elif  A.count(A_max1) == 1:
    A[A.index(A_max1)] = 0
    A_max2 = max(A)
    A[A.index(0)] = A_max1
    for i in range(N):
        if A[i] == A_max1:
            print(A_max2)
        else:
            print(A_max1)
Buggy python submission (verdict: Runtime Error):
N, X = map(int, input().split())
L = list(map(int, input().split()))
cnt = 0
for i in range(N+2):
    if cnt <= X:
        cnt += L[i]
    else:
        print(i)
        break

Fixed submission:
N, X = map(int, input().split())
L = list(map(int, input().split()))
cnt = 0
if sum(L) <= X:
    print(N+1)
else:
    for i in range(N+1):
        if cnt <= X:
            cnt += L[i]
        else:
            print(i)
            break
Buggy python submission (verdict: Time Limit Exceeded):
N=int(input())
A=input().split()
A=[int(i) for i in A]
S=0
A_sum=[]
for i in range(N):
    sum=0
    for j in range(i+1,N):
        sum+=A[j]
    A_sum.append(sum)
    


for i in range(N-1):
    S+=A[i]*A_sum[i]

print(S%(pow(10,9)+7))

Fixed submission:
N=int(input())
A=input().split()
A=[int(i) for i in A]
S=0
A_sum=0
for i in range(N):
    A_sum+=A[i]
    

B=A_sum
for i in range(N):
    B-=A[i]
    S+=A[i]*B

print(S%(pow(10,9)+7))

Buggy python submission (verdict: Time Limit Exceeded):
N=int(input())
A=input().split()
A=[int(i) for i in A]
S=0
for i in range(N-1):
    for j in range(i+1,N):
        S+=A[i]*A[j]
print(S%(pow(10,9)+7))

Fixed submission:
N=int(input())
A=input().split()
A=[int(i) for i in A]
S=0
A_sum=0
for i in range(N):
    A_sum+=A[i]
    

B=A_sum
for i in range(N):
    B-=A[i]
    S+=A[i]*B

print(S%(pow(10,9)+7))

Buggy python submission (verdict: Time Limit Exceeded):
N=int(input())
A=list(int(i) for i in input().split())
S=0
for i in range(N):
    for j in range(i+1,N):
        S+=A[i]*A[j]
print(S%((pow(10,9)+7)))

Fixed submission:
N=int(input())
A=input().split()
A=[int(i) for i in A]
S=0
A_sum=0
for i in range(N):
    A_sum+=A[i]
    

B=A_sum
for i in range(N):
    B-=A[i]
    S+=A[i]*B

print(S%(pow(10,9)+7))