Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Time Limit Exceeded):
n=int(input())
a=list(map(int,input().split()))
l=[]
for x in range(1,n+1):
    l.append(str(a.index(x)+1))
print(" ".join(l))

Fixed submission:
n=int(input())
s=list(map(int,input().split()))
d={}
for x in range(len(s)):
    d[x]=s[x]
d=sorted(d.items(),key=lambda e: e[1])
p=list(map(str,[i+1 for i,j in d]))
print(" ".join(p))

Buggy python submission (verdict: Runtime Error):
a=list(map(int,input().split()))
l=[]
for x in range(1,n+1):
    l.append(str(a.index(x)+1))
print(" ".join(l))

Fixed submission:
n=int(input())
s=list(map(int,input().split()))
d={}
for x in range(len(s)):
    d[x]=s[x]
d=sorted(d.items(),key=lambda e: e[1])
p=list(map(str,[i+1 for i,j in d]))
print(" ".join(p))
Buggy python submission (verdict: Runtime Error):
n,m=map(int,input().split())
a=[int(input()) for _ in range(m)]
l=[1]+[0 for _ in range(n+5)]
c=0
for x in range(n):
    if x<a[0]:
        l[x+1]+=l[x]
        l[x+2]+=l[x]
    if x==a[0]:
        if len(a)>=2:a.pop(0)
        else:a[0]=200000
print(l[n]%(10**9+7))

Fixed submission:
n,m=map(int,input().split())
a=[int(input()) for _ in range(m)]
l=[1]+[0 for _ in range(n+5)]
if m==0:a=[200000]
for x in range(n):
    if x<a[0]:
        l[x+1]+=l[x]
        l[x+2]+=l[x]
    if x==a[0]:
        if len(a)>=2:a.pop(0)
        else:a[0]=200000
print(l[n]%(10**9+7))

Buggy python submission (verdict: Time Limit Exceeded):
n,m=map(int,input().split())
a=[int(input()) for _ in range(m)]
l=[1]+[0 for _ in range(n+5)]

for x in range(n):
    if not x in a:
        l[x+1]+=l[x]
        l[x+2]+=l[x]
print(l[n]%(10**9+7))

Fixed submission:
n,m=map(int,input().split())
a=[int(input()) for _ in range(m)]
l=[1]+[0 for _ in range(n+5)]
if m==0:a=[200000]
for x in range(n):
    if x<a[0]:
        l[x+1]+=l[x]
        l[x+2]+=l[x]
    if x==a[0]:
        if len(a)>=2:a.pop(0)
        else:a[0]=200000
print(l[n]%(10**9+7))
Buggy python submission (verdict: Time Limit Exceeded):
n,m=map(int,input().split())
a=[[int(i) for i in input().split()] for l in range(m)]
l=[int(i) for i in range(1,n+1)]
for x in a:
    l=set(l)&set([int(i) for i in range(x[0],x[1]+1)])
print(len(l))

Fixed submission:
n,m=map(int,input().split())
a=[[int(i) for i in input().split()] for l in range(m)]
b=0
s=100000000000
for x in a:
    b=max(b,x[0])
    s=min(s,x[1])
print(max(0,s-b+1))
Buggy python submission (verdict: Runtime Error):
s=input()
t="keyence"
i=0
for x in s:
    if t[i]==x:i+=1
print("YES" if i>6 else "NO")

Fixed submission:
s=input()
t="keyence"
f=False
if s[0:7]==t:f=True
for x in range(8):
    if s[:x]==t[:x] and s[-7+x:]==t[-7+x:]:f=True
print("YES" if f else "NO")
Buggy python submission (verdict: Time Limit Exceeded):
n,k=map(int,input().split())
h=list(map(int,input().split()))

l=[0]+[float("inf")]*(n-1)

for x in range(n):
    for y in range(x+1,min(n,x+k+1)):
        l[y]=min(l[y],abs(h[y]-h[x])+l[x])

print(l[-1])

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

l=[0]+[float("inf")]*(n-1)

for x in range(n):
    for y in range(x+1,min(n,x+k+1)):
        l[y]=min(l[y],abs(h[y]-h[x])+l[x])
print(l[-1])
Buggy python submission (verdict: Time Limit Exceeded):
n,w=map(int,input().split())
a=[[int(i) for i in input().split()] for _ in range(n)]

dp=[]
for y in range(n+1):
    l=[]
    if y==0:dp.append([0]*(w+1));continue
    for x in range(w+1):
        if x==0:l.append(0);continue
        
        now_weight=x
        up_value=dp[-1][now_weight]

        index_weight=a[y-1][0]
        index_value=a[y-1][1]

        blank_weight=max(0,now_weight-index_weight)
        blank_max_value=dp[-1][blank_weight]
        

        t_value=up_value
        if now_weight>=index_weight:t_value=max(blank_max_value+index_value,up_value) 
        
        l.append(t_value)
        
    dp.append(l)

print(dp[n][w])

Fixed submission:
n,w=map(int,input().split())
a=[[int(i) for i in input().split()] for _ in range(n)]

dp=[]
for y in range(n+1):
    l=[]
    if y==0:dp.append([0]*(w+1));continue
    for x in range(w+1):
        if x==0:l.append(0);continue
        
        now_weight=x
        up_value=dp[-1][now_weight]

        index_weight=a[y-1][0]
        index_value=a[y-1][1]

        blank_weight=max(0,now_weight-index_weight)
        blank_max_value=dp[-1][blank_weight]
        

        t_value=up_value
        if now_weight>=index_weight:t_value=max(blank_max_value+index_value,up_value) 
        
        l.append(t_value)
        
    dp.append(l)

print(dp[n][w])
Buggy python submission (verdict: Runtime Error):
n=int(input())
i=int(list(str(n))[0])+int(list(str(n))[1])
if n%i==0:print("Yes")
else:print("No")

Fixed submission:
n=int(input())
l=list(str(n))
i=0
for x in l:
    i+=int(x)
if n%i==0:print("Yes")
else:print("No")
Buggy python submission (verdict: Time Limit Exceeded):
n=int(input())
s=[int(input()) for i in range(n)]
l=[]
for x in s:
    l=set([x])^set(l)
print(len(l))

Fixed submission:
import collections
n=int(input())
s=[int(input()) for i in range(n)]
p=collections.Counter(s)
c=0
for x in p.values():
    if x%2==1:c+=1
print(c)
Buggy python submission (verdict: Time Limit Exceeded):
N,M=map(int,input().split())
a=[[int(i) for i in input().split()] for l in range(M)]
l=[]
for x in a:
    if x[0]==1:l.append(x[1])
for x in a:
    if x[0] in l and x[1]==N:
        print("POSSIBLE")
        exit(0)
print("IMPOSSIBLE")

Fixed submission:
N,M=map(int,input().split())
a=[[int(i) for i in input().split()] for l in range(M)]
l=[]
for x in a:
    if x[0]==1:l.append(x[1])
m=[]
for x in a:
    if x[1]==N:m.append(x[0])
if set(l) & set(m):
    print("POSSIBLE")
    exit(0)
print("IMPOSSIBLE")

Buggy python submission (verdict: Time Limit Exceeded):
import sys
dest,num =map(int,input().split())
l= [[int(i) for i in input().split()] for num in range(num)]
s=[]
p=[]
for x in l:
    if x[0]==1:s.append(x[1])
    if x[1]==dest:p.append(x[0])
for i in s:
    if i in p:
        print("POSSIBLE")
        sys.exit()
print("IMPOSSIBLE")

Fixed submission:
N,M=map(int,input().split())
a=[[int(i) for i in input().split()] for l in range(M)]
l=[]
for x in a:
    if x[0]==1:l.append(x[1])
m=[]
for x in a:
    if x[1]==N:m.append(x[0])
if set(l) & set(m):
    print("POSSIBLE")
    exit(0)
print("IMPOSSIBLE")
Buggy python submission (verdict: Time Limit Exceeded):
n=int(input())
a=[int(input()) for i in range(n)]
l=[]
c=1
i=0
f=True
for _ in range(100002):
    i+=1
    c=a[c-1]
    b=len(l)
    l.append(c)
    l=list(set(l))
    if len(l)==b:
        f=False
        break
    if c==2:break
if f:print(i)
else:print(-1)

Fixed submission:
n=int(input())
a=[int(input()) for i in range(n)]
l=[]
c=1
i=0
f=False
for _ in range(100001):
    i+=1
    c=a[c-1]
    if c==2:
        f=True
        break
if f:print(i)
else:print(-1)

Buggy python submission (verdict: Time Limit Exceeded):
n=int(input())
a=[int(input()) for i in range(n)]
l=[]
c=1
i=0

f=True
while True:
    i+=1
    c=a[c-1]
    b=len(l)
    l.append(c)
    l=list(set(l))
    if len(l)==b:
        f=False
        break
    if c==2:break
if f:print(i)
else:print(-1)

Fixed submission:
n=int(input())
a=[int(input()) for i in range(n)]
l=[]
c=1
i=0
f=False
for _ in range(100001):
    i+=1
    c=a[c-1]
    if c==2:
        f=True
        break
if f:print(i)
else:print(-1)
Buggy python submission (verdict: Runtime Error):
n=int(input())
s=list(map(int,input().split()))
l=[0 for _ in range(12)]
for x in s:
    l[x//400]+=1
j=sum(r>0 for r in l[:8])
print(j,j+sum(l[8:]))

Fixed submission:
n=int(input())
s=list(map(int,input().split()))
l=[0 for _ in range(13)]
for x in s:
    l[x//400]+=1
j=sum(r>0 for r in l[:8])
print(max(1,j),j+sum(l[8:]))
Buggy python submission (verdict: Runtime Error):
s=list(input().split())
n=int(input())
t=[input() for i in range(n)]
r=[]
for x in s:
    for y in t:
        if len(x)==len(y):
            l=list(x)
            for z in range(len(x)):
                if y[z]=="*":l[z]="*"
            if "".join(l)==y:
                r.append("*"*len(x))
                break
    else:r.append(x)
print(*r)

Fixed submission:
a,b,c=map(int,input().split())
d=0
while a%2==0 and b%2==0 and c%2==0:
    if a==b==c:
        print(-1)
        break
    d+=1
    ha=a//2
    hb=b//2
    hc=c//2
    a=hb+hc
    b=ha+hc
    c=ha+hb
else:print(d)
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
ans = 0
for a in range(1, n+1):
    for b in range(1, n//a+1):
        c = n-a*b
        if a*b+c == n and c >= 1:
            # print(a, b, c)
            ans += 1
print(ans)

Fixed submission:
n = int(input())
ans = 0
for a in range(1, n+1):
    for b in range(1, n//a+1):
        c = n-a*b
        if a*b+c == n and c >= 1:
            # print(a, b, c)
            ans += 1
print(ans)
Buggy python submission (verdict: Runtime Error):
ans = -(10**9)
ans = max(a*c, ans)
ans = max(a*d, ans)
ans = max(b*c, ans)
ans = max(b*d, ans)
print(ans)


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

ans = -(10**18)
ans = max(a*c, ans)
ans = max(a*d, ans)
ans = max(b*c, ans)
ans = max(b*d, ans)
print(ans)

Buggy python submission (verdict: Runtime Error):
ans = a*c
if ans < a*d:
    ans = a*d
elif ans < b*c:
    ans = b*c
elif ans < b*d:
    ans = b*d
print(ans)

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

ans = -(10**18)
ans = max(a*c, ans)
ans = max(a*d, ans)
ans = max(b*c, ans)
ans = max(b*d, ans)
print(ans)

Buggy python submission (verdict: Runtime Error):
ans = -(10**9)
ans = max(a*d, ans)
ans = max(b*d, ans)
ans = max(a*c, ans)
ans = max(b*c, ans)
print(ans)


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

ans = -(10**18)
ans = max(a*c, ans)
ans = max(a*d, ans)
ans = max(b*c, ans)
ans = max(b*d, ans)
print(ans)
Buggy python submission (verdict: Runtime Error):

k = int(input())
a = '7' * (k - 1)
if int(a) % k == 0:
    for i in range(1, 50):
        a = '7' * i
        if int(a) % k == 0:
            print(i)
            exit()
    print(k-1)
    exit()
print(-1)


Fixed submission:
k = int(input())
if k % 2 == 0 or k % 5 == 0:
    print(-1)
    exit()
i = 0
ai = 0
while True:
    ai = (ai * 10 + 7) % k
    i += 1
    if ai == 0:
        break
print(i)

Buggy python submission (verdict: Runtime Error):

k = int(input())
a = '7' * (k - 1)
if int(a) % k == 0:
    for i in range(1, 100):
        a = '7' * i
        if int(a) % k == 0:
            print(i)
            exit()
    print(k-1)
print(-1)


Fixed submission:
k = int(input())
if k % 2 == 0 or k % 5 == 0:
    print(-1)
    exit()
i = 0
ai = 0
while True:
    ai = (ai * 10 + 7) % k
    i += 1
    if ai == 0:
        break
print(i)
Buggy python submission (verdict: Time Limit Exceeded):
a, b, c, k = map(int, input().split())
ans = 0
for aa in range(a+1):
    for bb in range(b+1):
        for cc in range(c+1):
            if aa+bb+cc == k:
                t = aa+cc*-1
                ans = max(t, ans)
print(ans)


Fixed submission:
a, b, c, k = map(int, input().split())
if a >= k:
    print(k)
elif (a+b) >= k:
    print(a)
else:
    print(a-(k-a-b))
Buggy python submission (verdict: Time Limit Exceeded):
n, a, b = map(int, input().split())
ans = []
while (True):
    for _ in range(a):
        ans.append('b')
    if len(ans) >= n:
        break
    for _ in range(b):
        ans.append('r')
    if len(ans) >= n:
        break
print(ans[:n].count('b'))


Fixed submission:
n, a, b = map(int, input().split())
ans = (n//(a+b)) * a
if n % (a+b) > a:
    print(ans + a)
else:
    print(ans + n % (a+b))
Buggy python submission (verdict: Runtime Error):
import sympy

n = int(input())
count = 0
for i in range(1, n+1):
    if i % 2 == 1:
        if len(sympy.divisors(i)) == 8:
            # print(i)
            count += 1
print(count)



Fixed submission:
# import sympy

def make_divisors(n):
    lower_divisors , upper_divisors = [], []
    i = 1
    while i*i <= n:
        if n % i == 0:
            lower_divisors.append(i)
            if i != n // i:
                upper_divisors.append(n//i)
        i += 1
    return lower_divisors + upper_divisors[::-1]

n = int(input())
count = 0
for i in range(1, n+1):
    if i % 2 == 1:
        # if len(sympy.divisors(i)) == 8:
        if len(make_divisors(i)) == 8:
            count += 1
print(count)
Buggy python submission (verdict: Runtime Error):
    from decimal import Decimal as dec
    def main():
        a, b = map(dec, input().split())
        print(int(dec(a)*dec(b)))
     
    if __name__ == "__main__":
        main()

Fixed submission:
import numpy as np
import scipy.sparse as sps
import scipy.misc as spm
import collections as col
import functools as func
import itertools as ite
import fractions as frac
import math as ma
import cmath as cma
import copy as cp
import sys
def sinput(): return sys.stdin.readline().strip()
def iinput(): return int(sinput())
def imap(): return map(int, sinput().split())
def fmap(): return map(float, sinput().split())
def iarr(n=0):
    if n: return [0 for _ in range(n)]
    else: return list(imap())
def farr(): return list(fmap())
def sarr(n=0):
    if n: return ["" for _ in range(n)]
    else: return sinput().split()
def barr(n): return [False for _ in range(n)]
sys.setrecursionlimit(10**7)
MOD = 10**9 + 7; EPS = sys.float_info.epsilon
PI = np.pi; EXP = np.e; INF = np.inf

a,b = farr()
a,b = int(a),int(b*100+ .5)
ans = (a*b) //100
print(ans)
Buggy python submission (verdict: Runtime Error):
n = int(input())
h = [int(x) for x in input().split()]
memo = [-1]*n

def dp(i):
    if i == 0:
        return 0
    if i < 0:
        return 10**10
    if memo[i] != -1:
        return memo[i]
    if i == 1:
        memo[i] = abs(h[i] - h[i-1])
        return memo[i]
    memo[i] = min(dp(i-1)+abs(h[i]-h[i-1]), dp(i-2)+abs(h[i]-h[i-2]))
    return memo[i]

print(dp(n-1))

Fixed submission:
# importing the sys module 
import sys 
  
# the setrecursionlimit function is 
# used to modify the default recursion 
# limit set by python. Using this,  
# we can increase the recursion limit 
# to satisfy our needs 
  
sys.setrecursionlimit(10**6) 
n = int(input())
h = [int(x) for x in input().split()]
memo = [-1]*n

def dp(i):
    if i == 0:
        return 0
    if i < 0:
        return 10**10
    if memo[i] != -1:
        return memo[i]
    if i == 1:
        memo[i] = abs(h[i] - h[i-1])
        return memo[i]
    memo[i] = min(dp(i-1)+abs(h[i]-h[i-1]), dp(i-2)+abs(h[i]-h[i-2]))
    return memo[i]

print(dp(n-1))

Buggy python submission (verdict: Runtime Error):
n = int(input())
h = [int(x) for x in input().split()]
memo = [-1]*n

def dp(i):
    if i == 0:
        return 0
    if memo[i] != -1:
        return memo[i]
    if i == 1:
        memo[i] = abs(h[i] - h[i-1])
        return memo[i]
    memo[i] = min(dp(i-1)+abs(h[i]-h[i-1]), dp(i-2)+abs(h[i]-h[i-2]))
    return memo[i]

print(dp(n-1))

Fixed submission:
# importing the sys module 
import sys 
  
# the setrecursionlimit function is 
# used to modify the default recursion 
# limit set by python. Using this,  
# we can increase the recursion limit 
# to satisfy our needs 
  
sys.setrecursionlimit(10**6) 
n = int(input())
h = [int(x) for x in input().split()]
memo = [-1]*n

def dp(i):
    if i == 0:
        return 0
    if i < 0:
        return 10**10
    if memo[i] != -1:
        return memo[i]
    if i == 1:
        memo[i] = abs(h[i] - h[i-1])
        return memo[i]
    memo[i] = min(dp(i-1)+abs(h[i]-h[i-1]), dp(i-2)+abs(h[i]-h[i-2]))
    return memo[i]

print(dp(n-1))

Buggy python submission (verdict: Runtime Error):
INF = 10 ** 9
n = int(input())
h = [int(x) for x in input().split()]
memo = [-1]*n

def dp(i):
    if i == 0:
        return 0
    if i < 0:
        return INF
    if memo[i] != -1:
        return memo[i]
    if i == 1:
        memo[i] = abs(h[i] - h[i-1])
        return memo[i]
    memo[i] = min(dp(i-1)+abs(h[i]-h[i-1]), dp(i-2)+abs(h[i]-h[i-2]))
    return memo[i]

print(dp(n-1))

Fixed submission:
# importing the sys module 
import sys 
  
# the setrecursionlimit function is 
# used to modify the default recursion 
# limit set by python. Using this,  
# we can increase the recursion limit 
# to satisfy our needs 
  
sys.setrecursionlimit(10**6) 
n = int(input())
h = [int(x) for x in input().split()]
memo = [-1]*n

def dp(i):
    if i == 0:
        return 0
    if i < 0:
        return 10**10
    if memo[i] != -1:
        return memo[i]
    if i == 1:
        memo[i] = abs(h[i] - h[i-1])
        return memo[i]
    memo[i] = min(dp(i-1)+abs(h[i]-h[i-1]), dp(i-2)+abs(h[i]-h[i-2]))
    return memo[i]

print(dp(n-1))
Buggy python submission (verdict: Time Limit Exceeded):
import sys
sys.setrecursionlimit(10**7)
n,k = [int(x) for x in input().split()]
h = [int(x) for x in input().split()]
memo = [10**9]*n
memo[0] = 0
for i in range(0, n):
    for j in range(1, min(k + 1, n - i)):
        memo[i + j] = min(memo[i + j], memo[i] + abs(h[i + j] - h[i]))
print(memo[-1])


Fixed submission:
import sys
sys.setrecursionlimit(10**7)
n,k = [int(x) for x in input().split()]
h = [int(x) for x in input().split()]
memo = [0]*n
for i in range(1, n):
    min_k = float('inf') 
    min_k=min([memo[j] +abs(h[i]-h[j]) for j in range(max(0, i-k), i)])
    memo[i] = min_k

print(memo[-1])

Buggy python submission (verdict: Time Limit Exceeded):
import sys
sys.setrecursionlimit(10**7)
n,k = [int(x) for x in input().split()]
h = [int(x) for x in input().split()]
memo = [float('inf')]*n
memo[0] = 0
for i in range(0, n):
    for j in range(1, min(k + 1, n - i)):
        memo[i + j] = min(memo[i + j], memo[i] + abs(h[i + j] - h[i]))
print(memo[-1])


Fixed submission:
import sys
sys.setrecursionlimit(10**7)
n,k = [int(x) for x in input().split()]
h = [int(x) for x in input().split()]
memo = [0]*n
for i in range(1, n):
    min_k = float('inf') 
    min_k=min([memo[j] +abs(h[i]-h[j]) for j in range(max(0, i-k), i)])
    memo[i] = min_k

print(memo[-1])

Buggy python submission (verdict: Time Limit Exceeded):
import sys
sys.setrecursionlimit(10**7)
n,k = [int(x) for x in input().split()]
h = [int(x) for x in input().split()]
INF = 10 ** 9
memo = [-1]*n
memo[0] = 0

def dp(i):
    if (memo[i] != -1):
        return memo[i]
    ans = INF
    for j in range (max(0, i-k),i):
        ans = min(ans, dp(j) + abs(h[i] - h[j]))
    memo[i] = ans
    return memo[i]

print(dp(n-1))


Fixed submission:
import sys
sys.setrecursionlimit(10**7)
n,k = [int(x) for x in input().split()]
h = [int(x) for x in input().split()]
memo = [0]*n
for i in range(1, n):
    min_k = float('inf') 
    min_k=min([memo[j] +abs(h[i]-h[j]) for j in range(max(0, i-k), i)])
    memo[i] = min_k

print(memo[-1])

Buggy python submission (verdict: Time Limit Exceeded):
import sys
sys.setrecursionlimit(10**6)
n,k = [int(x) for x in input().split()]
h = [int(x) for x in input().split()]
INF = 10 ** 9
memo = [-1]*n

def dp(i):
    if (i < 0):
        return INF
    if (i == 0):
        return 0
    if (memo[i] != -1):
        return memo[i]
    ans = INF
    for j in range (max(0, i-k),i):
        ans = min(ans, dp(j) + abs(h[i] - h[j]))
    memo[i] = ans
    return memo[i]

print(dp(n-1))


Fixed submission:
import sys
sys.setrecursionlimit(10**7)
n,k = [int(x) for x in input().split()]
h = [int(x) for x in input().split()]
memo = [0]*n
for i in range(1, n):
    min_k = float('inf') 
    min_k=min([memo[j] +abs(h[i]-h[j]) for j in range(max(0, i-k), i)])
    memo[i] = min_k

print(memo[-1])
Buggy python submission (verdict: Runtime Error):
#include <stdio.h>

int main(void){
  int a;
  int p;
  
  scanf("%d",a); scanf("%d",a);
  print("%d", (a*3+p)/2);

  return 0;
}

Fixed submission:
a,p = map(int,input().split())
print((a*3+p)//2)
Buggy python submission (verdict: Runtime Error):
n,m = map(int,input().split())
l = []
max = 0
min = 100001

for i in range(m):
    l += [input()]
    if int(l[i][0]) > max:  
        max = int(l[i][0])
    if int(l[i][2]) < min:
        min = int(l[i][2])
       
if min - max >= 0:
    print(min - max + 1)
else:
    print(0)


Fixed submission:
n,m = map(int,input().split())
l = []
max = 0
min = n

for i in range(m):
    l += [input().split()]
    if int(l[i][0]) > max:  
        max = int(l[i][0])
    if int(l[i][1]) < min:
        min = int(l[i][1])

if min - max >= 0:
    print(min - max + 1)
else:
    print(0)
Buggy python submission (verdict: Runtime Error):
a,b,c = map(int(input().split()))
if (a <= c <= b) or (b <= c <= a):
    print('Yes')
else:
    print('No')

Fixed submission:
a,b,c = map(int,(input().split()))
if (a <= c <= b) or (b <= c <= a):
    print('Yes')
else:
    print('No')
Buggy python submission (verdict: Runtime Error):
n = int(input())
s = input()
k = int(input())
l = []

for i in range(n):
    l += s[i]

for i in range(n):
    if l[k-1] != l[i]:
        l[i] = '*'

for i in range(n):
    a += ''.join(l[i])
    
print(a)

Fixed submission:
n = int(input())
s = input()
k = int(input())
l = []
a = ''

for i in range(n):
    l += s[i]

for i in range(n):
    if l[k-1] != l[i]:
        l[i] = '*'

for i in range(n):
    a += ''.join(l[i])
    
print(a)
Buggy python submission (verdict: Runtime Error):
a=int(input())
b=int(input())
c=int(input())
d=int(input())
e=int(input())
l=[a,b,c,d,e]
last=9
for i in range(5):
    if l[i]%10!=0:
        last=min(last,l[i]%10)
        
sum=0
if a%10==0 and b%10==0 and c%10==0 and d%10==0 and e%10==0:
    print(sum(l))
else:
    for i in range(5):
        if l[i]%10==0:
            sum+=l[i]
        else:
            sum+=l[i]+10-l[i]%10
    print(sum-10+last)

Fixed submission:
a=int(input())
b=int(input())
c=int(input())
d=int(input())
e=int(input())
l=[a,b,c,d,e]
last=9
for i in range(5):
    if l[i]%10!=0:
        last=min(last,l[i]%10)
        
g=0
if a%10==0 and b%10==0 and c%10==0 and d%10==0 and e%10==0:
    print(sum(l))
else:
    for i in range(5):
        if l[i]%10==0:
            g+=l[i]
        else:
            g+=l[i]+10-l[i]%10
    print(g-10+last)
Buggy python submission (verdict: Runtime Error):
b=input()
if b=='A':
    print('T')
elif b=='T':
    prtnt('A')
elif b=='C':
    print('G')
elif b=='G'
    print('C')

Fixed submission:
b=input()
if b=='A':
    print('T')
elif b=='T':
    print('A')
elif b=='C':
    print('G')
else:
    print('C')

Buggy python submission (verdict: Runtime Error):
b=input()
if b=='A':
    print('T')
elif b=='T':
    prtnt('A')
elif b=='C':
    print('G')
else:
    print('C')
    

Fixed submission:
b=input()
if b=='A':
    print('T')
elif b=='T':
    print('A')
elif b=='C':
    print('G')
else:
    print('C')
Buggy python submission (verdict: Runtime Error):
S = int(input())
MOD = 10**9 + 7
A = [0] * (S + 1)
A[0] = 1
A[1] = 0
A[2] = 0

cumsum = 1
for i in range(3, len(A)):
    A[i] = cumsum
    cumsum += A[i - 2]
    cumsum %= MOD
print(A[-1])


Fixed submission:
S = int(input())
if S == 1:
    print(0)
    exit()
MOD = 10**9 + 7
A = [0] * (S + 1)
A[0] = 1
A[1] = 0
A[2] = 0

cumsum = 1
for i in range(3, len(A)):
    A[i] = cumsum
    cumsum += A[i - 2]
    cumsum %= MOD
print(A[-1])
Buggy python submission (verdict: Time Limit Exceeded):
import sys
from collections import defaultdict

input = sys.stdin.buffer.readline
N = int(input())
A = list(map(int, input().split()))
MOD = 10**9 + 7

D = defaultdict(int)
for i in range(N - 1):
    for j in range(i + 1, N):
        v = A[i] * A[j] % MOD
        D[v] += 1
# print(D)

ans = 0
for key, item in D.items():
    ans += key * item
    # ans = (ans + (key * item)) % MOD
ans %= MOD
print(ans)


Fixed submission:
import sys
input = sys.stdin.buffer.readline
MOD = 10**9 + 7

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

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

ans = 0
for i in range(1, N):
    ans += A[i] * (C[-1] - C[i])

ans %= MOD
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
import sys
input = sys.stdin.buffer.readline
N = int(input())
A = list(map(int, input().split()))
MOD = 10**9 + 7

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


Fixed submission:
import sys
input = sys.stdin.buffer.readline
MOD = 10**9 + 7

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

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

ans = 0
for i in range(1, N):
    ans += A[i] * (C[-1] - C[i])

ans %= MOD
print(ans)