TnT/Multi_CodeNet4Repair huggingface dataset:
Problem: Given are two strings S and T.  Let us change some of the characters in S so that T will be a substring of S.  At least how many characters do we need to change?  Here, a substring is a consecutive subsequence. For example, `xxx` is a substring of `yxxxy`, but not a substring of `xxyxx`.

Submission attempts (in order):
S = input()
T = input()
t = len(T)
for i in range(len(T)):
  a = 0
  b = 0
  for s in range(len(T)):
    if T[s:s+i+1] in S[s:len(S)-s]:
      b += 1
    print(s,b,T[s:s+i+1],S[s:len(S)-s])
  if b == 0:
    break
print(t-i)

S = input()
T = input()
ans = 0
for i in range(len(S) - len(T) + 1):
  a = 0
  for s in range(len(T)):
    if T[s] == S[i+s]:
      a += 1
  if a > ans:
    ans = a
print(ans)

S = input()
T = input()
ans = 1001
for i in range(len(S) - len(T) + 1):
  a = 0
  for s in range(len(T)):
    if T[s] != S[i+s]:
      a += 1
  if a < ans:
    ans = a
print(ans)

Verdicts: Runtime Error

Wrong Answer

Accepted
Problem: Given are two strings S and T.  Let us change some of the characters in S so that T will be a substring of S.  At least how many characters do we need to change?  Here, a substring is a consecutive subsequence. For example, `xxx` is a substring of `yxxxy`, but not a substring of `xxyxx`.

Submission attempts (in order):
S = input()
T = input()

min_count = len(T)
for s in range(len(S) - len(T) + 1):  # T cannot exceed the length of S
    matched = 0
    for i in range(len(T)):
        print(f'S[{s + i}] == T[{i}]')
        if S[s + i] == T[i]:
            matched += 1
    count = len(T) - matched
    if count < min_count:
        min_count = count
print(min_count)

S = input()
T = input()

min_count = len(T)
for s in range(len(S) - len(T) + 1):  # T cannot exceed the length of S
    matched = 0
    for i in range(len(T)):
        # print(f'S[{s + i}] == T[{i}]')
        if S[s + i] == T[i]:
            matched += 1
    count = len(T) - matched
    if count < min_count:
        min_count = count
print(min_count)

Verdicts: Wrong Answer

Accepted
Problem: Given are two strings S and T.  Let us change some of the characters in S so that T will be a substring of S.  At least how many characters do we need to change?  Here, a substring is a consecutive subsequence. For example, `xxx` is a substring of `yxxxy`, but not a substring of `xxyxx`.

Submission attempts (in order):

def main():
    S = input()
    T = input()
    

    st = {}
    for i in range(len(S)-len(T)+1):
        cnt = 0
        for s, t in zip(S[i:i+len(T)], T):
            cnt += s == t
        st.add(cnt)
    print(len(T) - max(st))


if __name__ == '__main__':
    main()

def main():
    S = input()
    T = input()
    

    st = set()
    for i in range(len(S)-len(T)+1):
        cnt = 0
        for s, t in zip(S[i:i+len(T)], T):
            cnt += s == t
        st.add(cnt)
    print(len(T) - max(st))


if __name__ == '__main__':
    main()

Verdicts: Runtime Error

Accepted
Problem: Given are two strings S and T.  Let us change some of the characters in S so that T will be a substring of S.  At least how many characters do we need to change?  Here, a substring is a consecutive subsequence. For example, `xxx` is a substring of `yxxxy`, but not a substring of `xxyxx`.

Submission attempts (in order):
s = input()
t = input()
if t in s:
    print(0)
else:
    ans = len(t)
    for i in range(len(s)):
      cnt = 0
      for j in range(len(t)):
        if s[i] != t[j]:
          cnt += 1
      ans = min(ans, cnt)
    print(ans)  


s = input()
t = input()
if t in s:
  print(0)
else:
  ans = 1000
  for i in range(len(t)):
    for j in range(len(s)):
      if t[i] == s[j]:
        k = i
        l = j
        while k < len(t):
          if t[k] != s[l]:
            break
          k += 1
          l += 1
        ans = min(ans, len(t) - k)

print(ans)        

s = input()
t = input()
if t in s:
    print(0)
else:
    ans = len(t)
    for i in range(len(t)):
        for j in range(len(s)):
            if t[i] == s[j]:
                if ((len(t) - i) <= (len(s) - j)) and i <= j:
                    k = i + 1
                    l = j + 1
                    cnt1 = 0
                    while k < len(t):
                        if t[k] != s[l]:
                            cnt1 += 1
                        k += 1
                        l += 1
                    k = i - 1
                    l = j - 1
                    cnt2 = 0
                    while k >= 0:
                        if t[k] != s[l]:
                            cnt2 += 1
                        k -= 1
                        l -= 1
                    ans = min(ans, cnt1 + cnt2)  
                else:
                  if (len(t) - i) > (len(s) - j)):
                    break
               
    print(ans)


s = input()
t = input()
if t in s:
  print(0)
else:
  ans = 1000
  for i in range(len(t)):
    for j in range(len(s)):
      if t[i] == s[j]:
        if len(t) - i >= len(s) - j and i <= j:
        	k = i
        	l = j
            cnt1 = 0
            while k < len(t):
            	if t[k] != s[l]:
                  cnt1 += 1
                k += 1
                l += 1
            k = i
        	l = j
            cnt2 = 0
            while k >= 0:
            	if t[k] != s[l]:
                  cnt2 += 1
                k -= 1
                l -= 1
            ans = min(ans, cnt1 + cnt2)    
        else:
          break
print(ans)          

s = input()
t = input()
if t in s:
    print(0)
else:
    ans = len(t)
    for i in range(len(s) - len(t) + 1):
        cnt = 0
        k = i
        l = 0
        while l < len(t) and k < len(s):
            if s[k] != t[l]:
                cnt += 1 
            k += 1
            l += 1    
        ans = min(ans, cnt)
    print(ans)  


Verdicts: Wrong Answer

Runtime Error

Runtime Error

Runtime Error

Accepted
Problem: Given are two strings S and T.  Let us change some of the characters in S so that T will be a substring of S.  At least how many characters do we need to change?  Here, a substring is a consecutive subsequence. For example, `xxx` is a substring of `yxxxy`, but not a substring of `xxyxx`.

Submission attempts (in order):
import re

S = input()
T = input()

start = time.time()

ans_list = []

a = '.'*len(T)

for i in range(len(T)):
    if i == 0:
        b = T[i] + a[i+1:]
    elif i == len(T)-1:
        b = a[:i] + T[i]
    else:
        b = a[:i] + T[i] + a[i+1:]
    s = re.findall(b, S)
    
    if len(s) >= 1:
        for j in range(len(s)):
            c = list(s[j])
            d = list(T)
            ans = 0
            for k in range(len(c)):
                if c[k] == d[k]:
                    ans += 1
            ans_list.append(ans)
    else:
        pass

print(len(T) - max(ans_list))

S = input()
T = input()

ans = len(T)

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

S = input()
T = input()

ans = len(T)

l_diff = []

for i in range(len(S) - len(T) + 1):
    print(S[i])
    diff = 0
    for j in range(len(T)):
        if S[i+j] != T[j]:
            diff += 1
        l_diff.append(diff)
    ans = min(ans, diff)
    
print(ans)

S = input()
T = input()

ans = len(T)

for i in range(len(S) - len(T) + 1):
    diff = 0
    for j in range(len(T)):
        if S[i+j] != T[j]:
            diff += 1
        l_diff.append(diff)
    ans = min(ans, diff)
    
print(ans)

S = input()
T = input()

ans = len(T)

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

Verdicts: Runtime Error

Runtime Error

Wrong Answer

Runtime Error

Accepted
Problem: Given are two strings S and T.  Let us change some of the characters in S so that T will be a substring of S.  At least how many characters do we need to change?  Here, a substring is a consecutive subsequence. For example, `xxx` is a substring of `yxxxy`, but not a substring of `xxyxx`.

Submission attempts (in order):
from numba import njit

def dis(a, b):
  d = 0
  for ai, bi in zip(a, b):
    if ai == bi:
      continue
      d += 1
      return d

@njit
def main():
    s = list(input())
    t = list(input())
    lt = len(t)
    ls = len(s)
    ans = 1000

    for i in prange(ls-lt+1):
        ans = min(ans, dis(s[i:i+lt], t))
    
    print(ans)
        
    

if __name__ == "__main__":
    main()


from numba import njit

def dis(a, b):
  d = 0
  for ai, bi in zip(a, b):
    if ai == bi:
      continue
      d += 1
      return d

@njit
def main():
    s = list(input())
    t = list(input())
    lt = len(t)
    ls = len(s)
    ans = 1000

    for i in prange(ls-lt+1):
        ans = 1
    
    print(ans)
        
    

if __name__ == "__main__":
    main()


from numba import njit

@njit(cache = True)
def dis(a, b):
  d = 0
  for ai, bi in zip(a, b):
    if ai == bi:
      continue
      d += 1
      return d

@njit
def main():
    s = list(input())
    t = list(input())
    lt = len(t)
    ls = len(s)
    ans = 1000

    for i in prange(ls-lt+1):
        ans = min(ans, dis(s[i:i+lt], t))
    
    print(ans)
        
    

if __name__ == "__main__":
    main()


from numba import njit


@njit
def main():
    ans = 1000

    for i in [1, 2, 3]:
        ans += 1
    
    print(ans)
        
s = input()
t = input()    
main()


from numba import njit


@njit
def main():
    s = input()
    t = input()
    ans = 1000

    for i in [1, 2, 3]:
        ans += 1
    
    print(ans)
        
    
main()


def main():
    s = list(input())
    t = list(input())
    lt = len(t)
    ls = len(s)
    ans = 1000
    
    
    def dis(a, b):
        d = 0
        for ai, bi in zip(a, b):
            if ai == bi:
                continue
            d += 1
        return d
    
    for i in range(ls-lt+1):
        ans = min(ans, dis(s[i:i+lt], t))
    
    print(ans)
        
    

if __name__ == "__main__":
    main()

Verdicts: Runtime Error

Runtime Error

Runtime Error

Wrong Answer

Runtime Error

Accepted
Problem: Given are two strings S and T.  Let us change some of the characters in S so that T will be a substring of S.  At least how many characters do we need to change?  Here, a substring is a consecutive subsequence. For example, `xxx` is a substring of `yxxxy`, but not a substring of `xxyxx`.

Submission attempts (in order):
s=input()
t=input()
count=0
if len(s)==len(t):
    for i in range(len(t)):
        if t[i]!=s[i]:
            count+=1
    print(count)
    exit()
ans=10000
for i in range(len(s)-len(t)+1):
    for j in range(len(t)):
        print(t[j],s[i+j])
        if t[j]!=s[i+j]:
            count+=1
    ans=min(ans,count)
    count=0
print(ans)

s=input()
t=input()
count=0
if len(s)==len(t):
    for i in range(len(t)):
        if t[i]!=s[i]:
            count+=1
    print(count)
    exit()
ans=10000
for i in range(len(s)-len(t)+1):
    for j in range(len(t)):
        if t[j]!=s[i+j]:
            count+=1
    ans=min(ans,count)
    count=0
print(ans)

Verdicts: Wrong Answer

Accepted
Problem: Given are two strings S and T.  Let us change some of the characters in S so that T will be a substring of S.  At least how many characters do we need to change?  Here, a substring is a consecutive subsequence. For example, `xxx` is a substring of `yxxxy`, but not a substring of `xxyxx`.

Submission attempts (in order):
S=input()
T=input()
ans=10**5
for i in range(len(S)-len(T)):
  a=0
  for j in range(len(T)):
    if S[i+j]==T[j]:
      a+=1
  ans=min(ans,a)
print(ans)

S=input()
T=input()
ans=10**5
for i in range(len(S)-len(T)+1):
  a=0
  for j in range(len(T)):
    if S[i+j]==T[j]:
      a+=1
  ans=min(ans,len(T)-a)
print(ans)

Verdicts: Wrong Answer

Accepted
Problem: Given are two strings S and T.  Let us change some of the characters in S so that T will be a substring of S.  At least how many characters do we need to change?  Here, a substring is a consecutive subsequence. For example, `xxx` is a substring of `yxxxy`, but not a substring of `xxyxx`.

Submission attempts (in order):
s = str(input())
t = str(input())
ans = 10000
for i in range(len(s) - len(t) + 1) : 
  cnt = 0
  for j in range(len(t)) : 
    if s[i + j] != t[j] : 
      cnt += 1
  ans = min(ans, cnt)


s = str(input())
t = str(input())
ans = 10000
for i in range(len(s) - len(t) + 1) : 
  cnt = 0
  for j in range(len(t)) : 
    if s[i + j] != t[j] : 
      cnt += 1
  ans = min(ans, cnt)
print(ans)

Verdicts: Wrong Answer

Accepted
Problem: Given are two strings S and T.  Let us change some of the characters in S so that T will be a substring of S.  At least how many characters do we need to change?  Here, a substring is a consecutive subsequence. For example, `xxx` is a substring of `yxxxy`, but not a substring of `xxyxx`.

Submission attempts (in order):

def input_from_console():
    s = input()
    t = input()
    return s, t


def solve(s, t):
    min_count = len(t)
    for i in range(len(s)-len(t)):
        temp_count = 0
        for j in range(len(t)):
            if s[j+i] != t[j]:
                temp_count += 1
        min_count = min(min_count, temp_count)
    return min_count


def main():
    s, t = input_from_console()
    print(s,t)
    print(solve(s, t))


if __name__ == "__main__":
    import sys

    if sys.gettrace():  # Check if the python interpreter is in debug mode or not.
        check_cases()
    else:
        main()

def input_from_console():
    s = input()
    t = input()
    return s, t


def solve(s, t):
    min_count = len(t)
    for i in range(len(s)-len(t) + 1):
        temp_count = 0
        for j in range(len(t)):
            if s[j+i] != t[j]:
                temp_count += 1
        min_count = min(min_count, temp_count)
    return min_count


def main():
    s, t = input_from_console()
    print(solve(s, t))


if __name__ == "__main__":
    import sys

    if sys.gettrace():  # Check if the python interpreter is in debug mode or not.
        check_cases()
    else:
        main()


Verdicts: Wrong Answer

Accepted
Problem: Given are two strings S and T.  Let us change some of the characters in S so that T will be a substring of S.  At least how many characters do we need to change?  Here, a substring is a consecutive subsequence. For example, `xxx` is a substring of `yxxxy`, but not a substring of `xxyxx`.

Submission attempts (in order):
def probB():
    S = input()
    T = input()

    maxdiff = 0
    for i in range(len(S) - len(T)):
        count = 0
        for j in range(len(T)):
            if S[i + j] != T[j]:
                count += 1
            if (count > maxdiff):
                maxdiff = count
    print(maxdiff)


def main():
    probB()


if __name__ == '__main__':
    main()


def probB():
    S = input()
    T = input()

    if T in S:
        print(0)
        return
    if len(T) == len(S):
        count = 0
        for t, s in zip(S, T):
            if t != s:
                count += 1
        print(count)
        return

    maxdiff = 0
    for i in range(len(S) - len(T)):
        count = 0
        for j, c in enumerate(T):
            if S[i + j] != c:
                count += 1
            if (count > maxdiff):
                maxdiff = count
    print(maxdiff)


def main():
    probB()


if __name__ == '__main__':
    main()


def probB():
    S = input()
    T = input()

    if T in S:
        print(0)
        return
    if len(T) == len(S):
        count = 0
        for i, _ in enumerate(T):
            if T[i] != S[i]:
                count += 1
        print(count)
        return

    maxdiff = 0
    for i in range(len(S) - len(T)):
        count = 0
        for j, c in enumerate(T):
            if S[i + j] != c:
                count += 1
            if (count > maxdiff):
                maxdiff = count
    print(maxdiff)


def main():
    probB()


if __name__ == '__main__':
    main()


def probB():
    S = input()
    T = input()

    if T in S:
        print(0)

    maxdiff = 0
    for i in range(len(S) - len(T)):
        count = 0
        for j in range(len(T)):
            if S[i + j] != T[j]:
                count += 1
            if (count > maxdiff):
                maxdiff = count
    print(maxdiff)


def main():
    probB()


if __name__ == '__main__':
    main()


def probB():
    S = input()
    T = input()

    if T in S:
        print(0)
        return
    if len(T) == len(S):
        count = 0
        for t, s in zip(S, T):
            if t != s:
                count += 1
        print(count)
        return

    maxequal = 0
    for i in range(len(S) - len(T)):
        count = 0
        for j in range(len(T)):
            if S[i + j] == T[j]:
                count += 1
            if (count > maxequal):
                maxequal = count
    print(len(T) - maxequal)


def main():
    probB()


if __name__ == '__main__':
    main()


Verdicts: Wrong Answer

Wrong Answer

Wrong Answer

Wrong Answer

Accepted
Problem: Given are two strings S and T.  Let us change some of the characters in S so that T will be a substring of S.  At least how many characters do we need to change?  Here, a substring is a consecutive subsequence. For example, `xxx` is a substring of `yxxxy`, but not a substring of `xxyxx`.

Submission attempts (in order):
a = input()
b = input()

l = []
for i in range(len(a) - len(b) + 1):
    cnt = 0
    for j in range(len(b)):
        if b[j] == a[i + j]:
            cnt += 1
    l.append(cnt)

print(l)
print(len(b) - max(l))

a = input()
b = input()

l = []
for i in range(len(a) - len(b) + 1):
    cnt = 0
    for j in range(len(b)):
        if b[j] == a[i + j]:
            cnt += 1
    l.append(cnt)

#print(l)
print(len(b) - max(l))

Verdicts: Wrong Answer

Accepted
Problem: Given are two strings S and T.  Let us change some of the characters in S so that T will be a substring of S.  At least how many characters do we need to change?  Here, a substring is a consecutive subsequence. For example, `xxx` is a substring of `yxxxy`, but not a substring of `xxyxx`.

Submission attempts (in order):
S = input()
T = input()

len_S = len(S)
len_T = len(T)

ans = 10*5
for i in range(len_S - len_T+1):
    num = 0
    tmp = S[i:i+len_T]
    print(tmp)
    for j in range(len(tmp)):
        print(tmp[j])
        if tmp[j] != T[j]:
            num+=1
    ans = min(ans, num)

print(ans)

S = input()
T = input()

len_S = len(S)
len_T = len(T)

ans = 10**10
for i in range(len_S - len_T+1):
    num = 0
    for j in range(len_T):
        if S[i+j] != T[j]:
            num+=1
    ans = min(ans, num)

print(ans)

Verdicts: Wrong Answer

Accepted
Problem: Given are two strings S and T.  Let us change some of the characters in S so that T will be a substring of S.  At least how many characters do we need to change?  Here, a substring is a consecutive subsequence. For example, `xxx` is a substring of `yxxxy`, but not a substring of `xxyxx`.

Submission attempts (in order):
S = str(input())
T = str(input())


result =0
cnt = len(T)
temp = S[:cnt]
Min  = len(T)

while True:
    sum = 0
    
    for i in range (len(T)):
        if temp[i] != T[i]:
            sum+=1
    
    result = min(Min,sum)
    
    if cnt+len(T) <= len(S):
        temp = S[cnt:cnt+len(T)]
        print(temp)
        cnt = cnt+len(T)
    else:
        break
    
    
print(result)
    
    
    

S = str(input())
T = str(input())

result =0
index = 0
Min = len(T)

while True:
    sum = 0
    temp = S[index : index + len(T)]
    
    for i in range (len(T)):
        if temp[i] != T[i]:
            sum+=1
    
    Min = min(Min,sum)
    
    index +=1
    
    if index + len(T) >  len(S):
        break
    
print(Min)
    
    
    

Verdicts: Wrong Answer

Accepted
Problem: Given are two strings S and T.  Let us change some of the characters in S so that T will be a substring of S.  At least how many characters do we need to change?  Here, a substring is a consecutive subsequence. For example, `xxx` is a substring of `yxxxy`, but not a substring of `xxyxx`.

Submission attempts (in order):
S = input()
T = input()

ss = len(S)
tt = len(T)

count = 0
res = []


for i in range(ss-tt+1):
    for j in range(tt):
        if S[i+j] != T[j]:
            count += 1
    res.append(count)
    count = 0

print(res)
print(min(res))

S = input()
T = input()

ss = len(S)
tt = len(T)

count = 0
res = []


for i in range(ss-tt+1):
    for j in range(tt):
        if S[i+j] != T[j]:
            count += 1
    res.append(count)
    count = 0

print(min(res))

Verdicts: Wrong Answer

Accepted
Problem: Given are two strings S and T.  Let us change some of the characters in S so that T will be a substring of S.  At least how many characters do we need to change?  Here, a substring is a consecutive subsequence. For example, `xxx` is a substring of `yxxxy`, but not a substring of `xxyxx`.

Submission attempts (in order):
def main():
    S = input()
    T = input()
    print(S)
    print(T)
    min = len(T)
    for i in range(len(S) - len(T) + 1):
        temp = 0
        for j in range(len(T)):
            if S[i + j] != T[j]:
                temp += 1
        if temp < min:
            min = temp
    print(min)
main()

def main():
    S = input()
    T = input()
    min = len(T)
    for i in range(len(S) - len(T) + 1):
        temp = 0
        for j in range(len(T)):
            if S[i + j] != T[j]:
                temp += 1
        if temp < min:
            min = temp
    print(min)
main()

Verdicts: Wrong Answer

Accepted
Problem: Given are two strings S and T.  Let us change some of the characters in S so that T will be a substring of S.  At least how many characters do we need to change?  Here, a substring is a consecutive subsequence. For example, `xxx` is a substring of `yxxxy`, but not a substring of `xxyxx`.

Submission attempts (in order):
def main():
    s = input()
    t = input()
    n = len(t)
    ans = 0

    for i in range(len(s) - n + 1):
        cnt = 0
        for a, b in zip(s[i:i + n], t):
            if a == b: cnt += 1
        ans = max(ans, cnt)
        print(s[i:i + n])
    print(n - ans)

if __name__ == '__main__':
    main()



def main():
    s = input()
    t = input()
    n = len(t)
    ans = 0

    for i in range(len(s) - n + 1):
        cnt = 0
        for a, b in zip(s[i:i + n], t):
            if a == b: cnt += 1
        ans = max(ans, cnt)
    print(n - ans)

if __name__ == '__main__':
    main()



Verdicts: Wrong Answer

Accepted
Problem: Given are two strings S and T.  Let us change some of the characters in S so that T will be a substring of S.  At least how many characters do we need to change?  Here, a substring is a consecutive subsequence. For example, `xxx` is a substring of `yxxxy`, but not a substring of `xxyxx`.

Submission attempts (in order):
s=input()
t=input()
ans=0
for i in range(len(s)-len(t)):
    u=0
    for a,b in zip(t,s[i:len(t)+i]):
        if a==b:u+=1
    print(t,s[i:len(t)+i],u)    
    ans=max(ans,u)  
if len(s)==len(t):
    for a,b in zip(t,s):
        if a==b:ans+=1    
print(len(t)-ans)

s=input()
t=input()
ans=0
for i in range(len(s)-len(t)):
    u=0
    for a,b in zip(t,s[i:len(t)+i]):
        if a==b:u+=1
    ans=max(ans,u)  
if len(s)==len(t):
    for a,b in zip(t,s):
        if a==b:ans+=1    
print(len(t)-ans)

Verdicts: Wrong Answer

Accepted
Problem: Given are two strings S and T.  Let us change some of the characters in S so that T will be a substring of S.  At least how many characters do we need to change?  Here, a substring is a consecutive subsequence. For example, `xxx` is a substring of `yxxxy`, but not a substring of `xxyxx`.

Submission attempts (in order):
S = list(input())
T = list(input())
ls = len(S)
lt = len(T)
ans = lt
for offset in range(ls - lt + 1):
	print(offset)
	cnt = 0
	for i in range(lt):
		print(S[offset+i], T[i])
		if S[offset + i] != T[i]:
			cnt += 1
	ans = min(ans, cnt)
print(ans)

S = list(input())
T = list(input())
ls = len(S)
lt = len(T)
ans = lt
for offset in range(ls - lt + 1):
	cnt = 0
	for i in range(lt):
		if S[offset + i] != T[i]:
			cnt += 1
	ans = min(ans, cnt)
print(ans)

Verdicts: Wrong Answer

Accepted
Problem: Given are two strings S and T.  Let us change some of the characters in S so that T will be a substring of S.  At least how many characters do we need to change?  Here, a substring is a consecutive subsequence. For example, `xxx` is a substring of `yxxxy`, but not a substring of `xxyxx`.

Submission attempts (in order):
S =input()
T =input()
mint=10000

for i in range(len(S)-len(T)+1):
    con = 0
    for j in range(len(T)):
        if S[i+j] != T[j]:
            con += 1
            
    mint =min(con,mint)
    
    if min_count == 0:
        break


print(mint)

s = input()
t = input()
mini =10000000

for i in range(len(s)-len(t)+1):
    count = 0
    for z in range(len(t)):
        if s[i+z] != t[z]:
            count += 1
            
    if count < mini :
            mini = count

print(mini) 

Verdicts: Runtime Error

Accepted
Problem: Given are two strings S and T.  Let us change some of the characters in S so that T will be a substring of S.  At least how many characters do we need to change?  Here, a substring is a consecutive subsequence. For example, `xxx` is a substring of `yxxxy`, but not a substring of `xxyxx`.

Submission attempts (in order):
s = input()
t = input()
ans = len(t)
for i in range(0, (len(s)-len(t)+1)):
    diff = 0
    for j in range(i, len(t)):
        if t[j] == s[i+j]:
            diff += 1
    ans = min(ans, len(t)-diff)
print(ans)

s = input()
t = input()
ans = len(t)
for i in range(0, (len(s)-len(t))):
    diff = 0
    for j in range(i, len(t)):
        if t[j] == s[i+j]:
            diff += 1
    ans = min(ans, len(t)-diff)
print(ans)


s = input()
t = input()
ans = len(t)
for i in range(0, (len(s)-len(t)+1)):
    diff = 0
    for j in range(0, len(t)):
        if t[j] == s[i+j]:
            diff += 1
    ans = min(ans, len(t)-diff)
print(ans)

Verdicts: Wrong Answer

Wrong Answer

Accepted
Problem: Given are two strings S and T.  Let us change some of the characters in S so that T will be a substring of S.  At least how many characters do we need to change?  Here, a substring is a consecutive subsequence. For example, `xxx` is a substring of `yxxxy`, but not a substring of `xxyxx`.

Submission attempts (in order):
S=input()
T=input()

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

S=input("codefoces")
T=input("atcoder")
tlen = len(T)
 
 
for i in range(tlen, 1):
    for k in range(0, tlen+1-i):
        Tinclude = T[k:i]
        print(tlen-i)
        break

s=input()
t=input()
scorelist=[]
for i in range(len(s)-len(t)+1):
  S=s[i:i+len(t)]
  score=0
  for j in range(len(t)):
    if S[j]!=t[j]:
      score+=1
  scorelist.append(str(score))
point=min(scorelist)
print(point)


Verdicts: Runtime Error

Wrong Answer

Accepted
Problem: Given are two strings S and T.  Let us change some of the characters in S so that T will be a substring of S.  At least how many characters do we need to change?  Here, a substring is a consecutive subsequence. For example, `xxx` is a substring of `yxxxy`, but not a substring of `xxyxx`.

Submission attempts (in order):
S = list(str(input()))
T = list(str(input()))
i = 0
t = 0
ans = 0
start = 0

while i <= len(T)-1:
    if S[i] == T[i]:
        t = i
        while t <= len(T)-1:
            print(S[t])
            if T[t] == S[t]:
                ans += 1
            t += 1
        break
    i += 1

if ans > 0:
    print(len(T)-ans)
else:
    print(len(T))

S = list(str(input()))
T = list(str(input()))
s = 0
t = 0
len_s = len(S)
len_t = len(T)
i = 0
ans = []

while i < len_s-len_t+1:
    cnt = 0
    #print(S[i:i+len_t])
    for ss, tt in zip(S[i:i+len_t], T):
        #print(ss,tt)
        if ss != tt:
            cnt +=1
    ans.append(cnt)
    i += 1

#print(ans)
print(min(ans))

Verdicts: Wrong Answer

Accepted
Problem: Given are two strings S and T.  Let us change some of the characters in S so that T will be a substring of S.  At least how many characters do we need to change?  Here, a substring is a consecutive subsequence. For example, `xxx` is a substring of `yxxxy`, but not a substring of `xxyxx`.

Submission attempts (in order):
S = list(input())
T = list(input())
ans = 1e9

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

print(ans)

S = list(input())
T = list(input())
ans = 1e9

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

print(ans)

Verdicts: Wrong Answer

Accepted
Problem: Given are two strings S and T.  Let us change some of the characters in S so that T will be a substring of S.  At least how many characters do we need to change?  Here, a substring is a consecutive subsequence. For example, `xxx` is a substring of `yxxxy`, but not a substring of `xxyxx`.

Submission attempts (in order):
s = input()
t = input()

ans = len(t)
for i in range(len(s) - len(t) + 1):
    ans_tmp = 0
    for j in range(len(t)):
        if s[i+j] != t[j]:
            ans_tmp += 1
    print(s[i+j])
    ans = min(ans, ans_tmp)
print(ans)

s = input()
t = input()

ans = len(t)
for i in range(len(s) - len(t) + 1):
    ans_tmp = 0
    for j in range(len(t)):
        if s[i+j] != t[j]:
            ans_tmp += 1
    ans = min(ans, ans_tmp)
print(ans)

Verdicts: Wrong Answer

Accepted
Problem: Given are two strings S and T.  Let us change some of the characters in S so that T will be a substring of S.  At least how many characters do we need to change?  Here, a substring is a consecutive subsequence. For example, `xxx` is a substring of `yxxxy`, but not a substring of `xxyxx`.

Submission attempts (in order):
S = input()
T = input()
ans = len(T)
for start in range(len(S) - len(T)):
  dif = 0
  for i in range(len(T)):
    if T[i] == S[start + i]:
      dif += 1
  ans = min(ans, dif) 
print(ans)

S = input()
T = input()
ans = len(T)
for start in range(len(S) - len(T)):
  dif = 0
  for i in range(len(T)):
    if T[i] == S[start + i]:
      dif += 1
  ans = min(ans, dif) 
  

S=input()
T=input()
ANS=[]
for start in range(len(S)-len(T)):
  ans = 0
  for j in range(len(T)):
    if S[start] != T[j]:
      ans += 1
  ANS.append(ans)
print(min(ANS))
  

S = input()
T = input()
ans = len(T)
for start in range(len(S) - len(T)):
  dif = 0
  for i in range(len(T)):
    if T[i] == S[start + i]:
      dif += 1
  ans = min(ans, dif) 
print(ans)

S=input()
T=input()
ANS=[]
for start in range(len(S)):
  ans = 0
  for j in range(len(T)):
    if S[start] != T[j]:
      ans += 1
    ANS.append(ans)
print(min(ANS))
  

S=input()
T=input()
ANS=[]
for start in range(len(S)-len(T)):
  ans = 0
  for j in range(len(T)):
    if S[start] != T[j]:
      ans += 1
  ANS.append(ans)
print(min(ANS))
  

S=input()
T=input()
ANS=[]
for start in range(len(S)):
  ans = 0
  for j in range(len(T)):
    if S[start] != T[j]:
      ans += 1
  ANS.append(ans)
print(min(ANS))
  

S = input()
T = input()
ans = len(T)
for start in range(len(S) - len(T) + 1):
  dif = 0
  for i in range(len(T)):
    if T[i] != S[start + i]:
      dif += 1
  ans = min(ans, dif) 
print(ans)


Verdicts: Wrong Answer

Wrong Answer

Runtime Error

Wrong Answer

Wrong Answer

Runtime Error

Wrong Answer

Accepted
Problem: Given are two strings S and T.  Let us change some of the characters in S so that T will be a substring of S.  At least how many characters do we need to change?  Here, a substring is a consecutive subsequence. For example, `xxx` is a substring of `yxxxy`, but not a substring of `xxyxx`.

Submission attempts (in order):
S = input()
T = input()
Answer = len(T)
for i in range(0,len(S)-len(T)):
    String = S[i:i+len(T)]
    for j in range(len(String)):
        B = len(T)
        if String[j] == T[j]:
            B -= 1
        Answer = min(Answer,B)
print(Answer)

S = input()
T = input()
Answer = len(T)
for i in range(0,len(S)-len(T)):
    String = S[i:i+len(T)]
    B = len(T)
    for j in range(len(String)):
        if String[j] == T[j]:
            B -= 1
    Answer = min(Answer,B)
if len(S) == len(T):
    B = len(S)
    for j in range(len(S)):
        if T[j] == S[j]:
            B -=1
    Answer = min(Answer,B)
print(Answer)

Verdicts: Wrong Answer

Accepted
Problem: Given are two strings S and T.  Let us change some of the characters in S so that T will be a substring of S.  At least how many characters do we need to change?  Here, a substring is a consecutive subsequence. For example, `xxx` is a substring of `yxxxy`, but not a substring of `xxyxx`.

Submission attempts (in order):
S = input()
t = input()
neq = len(t)
for i in range(len(S)-len(t)+1):
  if S[i]==t[0]:
    neq_temp = 0
    for j in range(1,len(t)):
      if S[i+j]!=t[j]:
        neq += 1
    neq = min(neq,neq_temp)
print(neq)

S = input()
t = input()
neq = len(t)
for i in range(len(S)-len(t)+1):
  neq_temp = 0
  for j in range(len(t)):
    if S[i+j]!=t[j]:
      neq_temp += 1
  neq = min(neq,neq_temp)
print(neq)

Verdicts: Wrong Answer

Accepted
Problem: Given are two strings S and T.  Let us change some of the characters in S so that T will be a substring of S.  At least how many characters do we need to change?  Here, a substring is a consecutive subsequence. For example, `xxx` is a substring of `yxxxy`, but not a substring of `xxyxx`.

Submission attempts (in order):
s = input()
t = input()
ls = len(s)
lt = len(t)
ans = 10000


for i in range(ls-lt+1): 
    score = 0
    U = s[i:i + lt]  
    for j in range(lt):  
        
        if U[j] != t[j]:
            score += 1  
        ans = min(ans, score)  

print(ans)

# ABC177
# B Substring



s = input()
t = input()
ls = len(s)
lt = len(t)
ans = 10000


for i in range(ls - lt + 1):
    score = 0
    U = s[i:i + lt]  
    for j in range(lt):  
        
        if U[j] != t[j]:
            score += 1  
    ans = min(ans, score)  

print(ans)


Verdicts: Wrong Answer

Accepted
Problem: Given are two strings S and T.  Let us change some of the characters in S so that T will be a substring of S.  At least how many characters do we need to change?  Here, a substring is a consecutive subsequence. For example, `xxx` is a substring of `yxxxy`, but not a substring of `xxyxx`.

Submission attempts (in order):
s = input()
t = input()
x = len(t)
mx= 0

res= 0
for i in range(len(s) - x+1):
    print(i)
    tmp = s[i:i+x]
    cntmp = 0
    for j in range(x):
        if t[j] == tmp[j]:
            cntmp += 1
    # print(tmp, i)
    res = max(res, cntmp)
print(x-res)

s = input()
t = input()
x = len(t)
res= 0
for i in range(len(s) - x):
    tmp = s[i:x]
    cntmp = 0
    for j in range(x):
        if t[j] == s[j]:
            cntmp += 1
    res = max(res, cntmp)
print(x-res)


s = input()
t = input()
x = len(t)
mx= 0

res= 0
for i in range(len(s) - x+1):
    # print(i)
    tmp = s[i:i+x]
    cntmp = 0
    for j in range(x):
        if t[j] == tmp[j]:
            cntmp += 1
    # print(tmp, i)
    res = max(res, cntmp)
print(x-res)

Verdicts: Wrong Answer

Wrong Answer

Accepted
Problem: Given are two strings S and T.  Let us change some of the characters in S so that T will be a substring of S.  At least how many characters do we need to change?  Here, a substring is a consecutive subsequence. For example, `xxx` is a substring of `yxxxy`, but not a substring of `xxyxx`.

Submission attempts (in order):
s=input()
t=input()
ans=0
tsize=len(t)
for i in range(tsize):
        if t[:i] in s:
            ans=tsize-(i+1)
            
print(ans)

s,t=input(),input()
ans=len(t)

for x in range(len(s)-len(t)+1):
    tmp=0
    for y in range(len(t)):
        if s[x+y]!=t[y]:
            tmp+=1
    ans=min(ans,tmp)        
print(ans)

Verdicts: Wrong Answer

Accepted
Problem: Given are two strings S and T.  Let us change some of the characters in S so that T will be a substring of S.  At least how many characters do we need to change?  Here, a substring is a consecutive subsequence. For example, `xxx` is a substring of `yxxxy`, but not a substring of `xxyxx`.

Submission attempts (in order):
import numpy as np
S = input()
T = input()

tmp = np.zeros(len(T))

i=0
flg=True

while flg:
    for j in range(i, len(T)):
        print(i,j)
        print(T[i:j+1])
        print(T[i:j+1] in S)
        if T[i:j+1] in S:
            tmp[i] = j+1-i
    i = max(i + int(tmp[i]),i+1)
    if i >= len(T)-1:
        flg=False

print(len(T)-int(np.max(tmp)))

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

tmp = []*len(T)

i=0
while i < len(T):
  for j in range(i, len(T)-i):
    if T[i:i+j+1] in S:
      tmp[i] = j
  i = tmp[i]
      
print(max(tmp))

S = input()
T = input()

tmp = np.zeros(len(T))

i=0
flg=True

while flg:
    for j in range(i, len(T)):
        if T[i:j+1] in S:
            tmp[i] = j
    i = i + int(tmp[i])
    if i >= len(T)-1:
        flg=False

print(int(np.max(tmp)))

import numpy as np
S = input()
T = input()

tmp = np.zeros(len(T))

i=0
flg=True

while flg:
    for j in range(i, len(T)):
        print(i,j)
        print(T[i:j+1])
        print(T[i:j+1] in S)
        if T[i:j+1] in S:
            tmp[i] = j+1
    i = i + int(tmp[i])
    if i >= len(T)-1:
        flg=False

print(len(T)-int(np.max(tmp)))

S=input()
T=input()
ls=len(S)
lt=len(T)
ans=lt
for i in range(0,ls-lt+1):
    a=0
    for j in range(lt):
        if S[i+j]==T[j]:
            a+=1
    ans=min(ans,lt-a)
print(ans)

Verdicts: Runtime Error

Runtime Error

Runtime Error

Wrong Answer

Accepted
Problem: Given are two strings S and T.  Let us change some of the characters in S so that T will be a substring of S.  At least how many characters do we need to change?  Here, a substring is a consecutive subsequence. For example, `xxx` is a substring of `yxxxy`, but not a substring of `xxyxx`.

Submission attempts (in order):
s = input()
t = input()
cnt = 0
min = 0
for i in range(len(s)-len(t)):
    cnt = 0
    for j in range(len(t)):
            if s[i+j] == t[j]:
                cnt += 1
                print(i,j,cnt)
    if min < cnt:
        min = cnt
print(len(t)-min)

s = input()
t = input()
cnt = 0
min = 0
for i in range(len(s)-len(t)+1):
    cnt = 0
    for j in range(len(t)):
            if s[i+j] == t[j]:
                cnt += 1
    if min < cnt:
        min = cnt
ans = len(t)-min

s = s[::-1]
t = t[::-1]
cnt=0
min=0
for i in range(len(s)-len(t)+1):
    cnt = 0
    for j in range(len(t)):
            if s[i+j] == t[j]:
                cnt += 1
    if min < cnt:
        min = cnt
if ans > len(t)-min:
    ans = len(t)-min
f = s.find(t)
if f < ans and f != -1:
    ans = f
print(ans)

Verdicts: Wrong Answer

Accepted
Problem: Given are two strings S and T.  Let us change some of the characters in S so that T will be a substring of S.  At least how many characters do we need to change?  Here, a substring is a consecutive subsequence. For example, `xxx` is a substring of `yxxxy`, but not a substring of `xxyxx`.

Submission attempts (in order):
S = input()
T = input()

num = 10**10

for i in range(len(S)-len(T)+1):
    U = S[i:(i+len(T))]
    for j in range(len(T)):
        if(T[j] != S[j]):
            tmp += 1
    num = min(num, tmp)
    
print(num)

S = input()
T = input()

num = 10**10

for i in range(len(S)-len(T)+1):
    U = S[i:(i+len(T))]
    tmp = 0
    for j in range(len(T)):
        if(T[j] != U[j]):
            tmp += 1
    num = min(num, tmp)
    
print(num)

Verdicts: Runtime Error

Accepted
Problem: Given are two strings S and T.  Let us change some of the characters in S so that T will be a substring of S.  At least how many characters do we need to change?  Here, a substring is a consecutive subsequence. For example, `xxx` is a substring of `yxxxy`, but not a substring of `xxyxx`.

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

print(minimumChar(S, T)) 

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

print(minimumChar(T,S)) 

Verdicts: Runtime Error

Accepted
Problem: Given are two strings S and T.  Let us change some of the characters in S so that T will be a substring of S.  At least how many characters do we need to change?  Here, a substring is a consecutive subsequence. For example, `xxx` is a substring of `yxxxy`, but not a substring of `xxyxx`.

Submission attempts (in order):
#!/usr/bin/env python3

s = input()
t = input()

errors = []
for i in range(len(s)-len(t)+1):
    error = 0 
    for j in range(len(t)):
        if s[i+j] != t[j]:
            error += 1
    errors.append(error)
print(min(errors)

#!/usr/bin/env python

s = input()
t = input()

errors = []
for i in range(len(s)-len(t)+1):
    error = 0 
    for j in range(len(t)):
        if s[i+j] != t[j]:
            error += 1
    errors.append(error)
print(min(errors))

Verdicts: Runtime Error

Accepted
Problem: Given are N integers A_1,\ldots,A_N.  Find the sum of A_i \times A_j over all pairs (i,j) such that 1\leq i < j \leq N, modulo (10^9+7).

Submission attempts (in order):
N = int(input())
a = list(map(int,input().split()))
t = [];s = 0
for i in range(N):
    for j in range(N):
        if i != j:
            if a[i]*a[j]<10**9+7:
                t.append(a[i]*a[j])
            else:
                t.append(a[i]%7*a%[j]%7)
for i in t:
    s += i
s = s//2
print(s%10**9+7)

import itertools
N = int(input())
a = list(map(int,input().split()))
a2 = itertools.accumulate(a)
b = [0]
b += list(a2)
s = 0
for i in range(N):
    s += (a[i] * (b[-1] - b[i+1]))
print(s % (10**9+7))

Verdicts: Runtime Error

Accepted
Problem: Given are N integers A_1,\ldots,A_N.  Find the sum of A_i \times A_j over all pairs (i,j) such that 1\leq i < j \leq N, modulo (10^9+7).

Submission attempts (in order):
N = int(input())
A = list(map(int,input().split()))

S = sum(A)
S2 = sum(map(lambda x: x*x,A))

print((S*S - S2) / 2 % 1000000007)

N = int(input())
A = list(map(int,input().split()))
mod = 1000000000 + 7
S = sum(A)
S2 = sum(map(lambda x: x*x,A))
ans = (S*S - S2)// 2 % mod
print(ans)

Verdicts: Wrong Answer

Accepted
Problem: Given are N integers A_1,\ldots,A_N.  Find the sum of A_i \times A_j over all pairs (i,j) such that 1\leq i < j \leq N, modulo (10^9+7).

Submission attempts (in order):
import numpy as np

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

ans = 0

for i in range(N):
	ans = (ans +  A[i] * numpy.sum(A[i+1:N])) % (10**9+7)

print(ans)

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

DIV = 10**9+7
ans = 0
Asum = sum(A)
Asum_sq = Asum**2

for i in range(N):
	ans += A[i]**2

res = (Asum_sq-ans)//2
print(res%DIV)

Verdicts: Runtime Error

Accepted
Problem: Given are N integers A_1,\ldots,A_N.  Find the sum of A_i \times A_j over all pairs (i,j) such that 1\leq i < j \leq N, modulo (10^9+7).

Submission attempts (in order):
N = int(input())
A = list(map(int, input().split()))

number = 0
for i in range(N-1):
    for j in range(i+1, N):
        print(A[i], A[j])
        number += A[i]*A[j]

print(number)


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

number = 0
MOD = 1000000007

for i in range(N-1):
    for j in range(i+1, N):
        print(A[i], A[j])
        number += A[i]*A[j]


if number > MOD:
    print(number%MOD)
else:
    print(number)


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

number = 0
MOD = 1000000007

for i in range(N-1):
    for j in range(i+1, N):
        print(A[i], A[j])
        number += A[i]*A[j]


if number > MOD:
    print(number%MOD)
else:
    print(number)


#!/usr/bin/env python3
import sys
from itertools import accumulate
MOD = 1000000007  # type: int


def solve(N: int, A: "List[int]"):
    aa = list(accumulate(A))
    #print(aa)
    x = sum(A)
    #print(x)

    ans = 0

    for i in range(N):
        ans += A[i]*(aa[N-1]-aa[i])%MOD
        ans %= MOD
    return print(ans)


# Generated by 1.1.7.1 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    N = int(next(tokens))  # type: int
    A = [int(next(tokens)) for _ in range(N)]  # type: "List[int]"
    solve(N, A)

if __name__ == '__main__':
    main()


Verdicts: Wrong Answer

Wrong Answer

Wrong Answer

Accepted
Problem: Given are N integers A_1,\ldots,A_N.  Find the sum of A_i \times A_j over all pairs (i,j) such that 1\leq i < j \leq N, modulo (10^9+7).

Submission attempts (in order):
N = input()
As = list(map(int, input().split()))

result = 0
for i in range(N-1):
    result+=As[i]*sum(As[i+1:])
print(result%(1*10**9+7))


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

result = 0
before_sum = sum(As)
for i in range(N-1):
    before_sum-=As[i]
    result+=As[i]*(before_sum)
print(result%(1*10**9+7))


Verdicts: Runtime Error

Accepted
Problem: Given are N integers A_1,\ldots,A_N.  Find the sum of A_i \times A_j over all pairs (i,j) such that 1\leq i < j \leq N, modulo (10^9+7).

Submission attempts (in order):
sum_all=[]
for i in range(N-1):
    for j in range(i+1,N):
        A[i]=A[i]%mod
        A[j]=A[j]%mod
        sum_all.append((A[i])*(A[j]))

sum=0
for n in sum_all:
    sum+=n
print(sum%mod)

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

mod=10**9+7

B=[0]
for i in range(1,N+1):
    B.append(A[i-1]+B[i-1])

ans=0
for i in range(N-1):
    ans+=A[i]*(B[N]-B[i+1])
    ans%=mod

print(int(ans))

Verdicts: Runtime Error

Accepted
Problem: Given are N integers A_1,\ldots,A_N.  Find the sum of A_i \times A_j over all pairs (i,j) such that 1\leq i < j \leq N, modulo (10^9+7).

Submission attempts (in order):
n = int(input())
lis = list(map(int, input().split())
sum = 0
for i in lis:
   for j in lis:
        sum += i * j
print(sum % 1000000009)           

n = int(input())
lis = list(map(int, input().split()))
s = 0
for ind, i in enumerate(lis):
   for j in lis[ind+1:]:
        print(i, j)
print(s % 1000000009)  

n = int(input())
lis = list(map(int, input().split()))

s = sum(lis) ** 2
ss = sum([i ** 2 for i in lis])

print(((s - ss)//2)%(10**9+7))
    
    

Verdicts: Runtime Error

Wrong Answer

Accepted
Problem: Given are N integers A_1,\ldots,A_N.  Find the sum of A_i \times A_j over all pairs (i,j) such that 1\leq i < j \leq N, modulo (10^9+7).

Submission attempts (in order):
n = int(input())
a = list(map(int, input().split()))
s = sum(a)
ans = 0
mod = 10**9 + 7
for i in range(n):
  ans = (ans + a[i] * (s - a[i])) % mod
print(ans)

n = int(input())
a = list(map(int, input().split()))
s = 0
ans = 0
mod = 10**9 + 7
for i in range(n):
  ans = (ans + a[i] * s) % mod
  s = (s + a[i]) % mod
print(ans)

Verdicts: Wrong Answer

Accepted
Problem: Given are N integers A_1,\ldots,A_N.  Find the sum of A_i \times A_j over all pairs (i,j) such that 1\leq i < j \leq N, modulo (10^9+7).

Submission attempts (in order):
s = input()
t = input()

res = 0
for i in range(len(s)-len(t)+1):
    tmp = 0
    for j in range(len(t)):
        if s[j+i] == t[j]:
            tmp += 1
    res = max(res, tmp)

print(len(t)-res)

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

cur = 0
res = 0
for i in range(n-1):
    cur = (cur + a[n-1-i]) % mod
    tmp = (a[n-2-i] * cur) % mod
    res = (res + tmp) % mod

print(res)

Verdicts: Wrong Answer

Accepted