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

Fixed submission:
def main():
    n, d = map(int, input().split())
    x = [list(map(int, input().split())) for i in range(n)]

    ans = 0
    for i in range(n-1):
        for j in range(i+1,n):
            res = 0
            for k in range(d):
                res += (x[j][k]-x[i][k])**2
            if (res**0.5).is_integer():
                ans += 1
    print(ans)

if __name__ == '__main__':
    main()

Buggy submission (verdict: Runtime Error):
def main():
    n, d = map(int, input().split())
    x = [int(input()) for i in range(n)]

    ans = 0
    for i in range(n-1):
        for j in range(i+1,n):
            res = 0
            for k in range(d):
                res += (x[j][k]-x[i][k])**2
            if (res**0.5).is_integer():
                ans += 1
    prnt(ans)

if __name__ == '__main__':
    main()

Buggy submission (verdict: Runtime Error):
def main():
    n, d = map(int, input().split())
    x = [int(input()) for i in range(n)]

    ans = 0
    for i in range(n-1):
        for j in range(i+1,n):
            res = 0
            for k in range(d):
                res += (j[k]-i[k])**2
            if (res**0.5).is_integer():
                ans += 1
    prnt(ans)

if __name__ == '__main__':
    main()

Buggy submission (verdict: Runtime Error):
def main():
    import math
    n, d = map(int, input().split())
    x = [int(input()) for i in range(n)]

    ans = 0
    for i in range(n-1):
        for j in range(i+1,n):
            res = 0
            for k in range(d):
                res += (j[k]-i[k])**2
            res = math.sqrt(s)
            if res.is_integer():
                ans += 1
    prnt(ans)

if __name__ == '__main__':
    main()

Buggy submission (verdict: Runtime Error):
def main():
    import math
    n, d = map(int, input().split())
    x = [int(input()) for i in range(n)]

    ans = 0
    for i in range(1,x):
        for j in range(x-1):
            res = 0
            for k in range(d):
                res += (j[k]-i[k])**2
            res = math.sqrt(s)
            if res.is_integer():
                ans += 1
    prnt(ans)

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

Fixed submission:
def main():
    n,k = map(int,input().split())
    s = input()

    res = []
    buf = '1' # start:1 kara NG->s[0]
    cnt = 0
    for i in range(n):
        if s[i] == buf:
            cnt += 1
        else:
            res.append(cnt)
            buf = s[i]
            cnt = 1
    if cnt != 0:
        res.append(cnt)

    if len(res)%2 == 0:
        res.append(0) # end:1 no kosu

    #from itertools import accumulate
    #rui = list(accumulate(res))
    rui = [0]*(len(res)+1)
    for i in range(len(rui)-1):
        rui[i+1] = rui[i] + res[i]

    ans = 0
    for i in range(0,len(res),2): # 1 only
        left = i
        right = min(i+2*k+1, len(res))
        tmp = rui[right] - rui[left]
        ans = max(tmp,ans)
    print(ans)

if __name__ == '__main__':
    main()

Buggy submission (verdict: Runtime Error):
def main():
    n,k = map(int,input().split())
    s = input()

    res = []
    buf = '1' # start:1 kara NG->s[0]
    cnt = 0
    for i in range(n):
        if s[i] == buf:
            cnt += 1
        else:
            res.append(cnt)
            buf = s[i]
            cnt = 1
    if cnt != 0:
        res.append(cnt)

    if len(res)%2 == 0:
        res.append(0) # end:1 no kosu

    #from itertools import accumulate
    #rui = list(accumulate(res))
    rui = [0]*(len(res)+1)
    for i in range(len(rui)-1):
        rui[i+1] = rui[i] + res[i]

    for i in range(0,len(res),2): # 1 only
        left = i
        right = min(i+2*k+1, len(res))
        tmp = rui[right] - rui[left]
        ans = max(tmp,ans)
    print(ans)

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

Fixed submission:
a=[int(input()) for _ in [0]*5]
b=[-(-i//10)*10-i for i in a]
print(sum(b)+sum(a)-max(b))

Buggy submission (verdict: Runtime Error):
a=[int(input()) for _ in [0]*5]
b=[-(-a//10)*10-i for i in a]
print(sum(b)+sum(a)-max(b))
Problem p03080 (python)

Fixed submission:
n=int(input())
s=list(input())
if s.count('R') > s.count('B'):
    print('Yes')
else:
    print('No')

Buggy submission (verdict: Runtime Error):
n=int(input())
s=list(input())
if s.count('R') > s.count('B'):
    print('Yes')
else:
    pritn('No')
Problem p03085 (python)

Fixed submission:
def main():
    dic = {'A':'T', 'T':'A', 'G':'C', 'C':'G'}
    b = input()
    print(dic[b])
    
if __name__ == '__main__':
    main()

Buggy submission (verdict: Runtime Error):
def main():
    dic = {'A':'T', 'T':'A', 'G':'T', 'T':'G'}
    b = input()
    print(dic[b])
    
if __name__ == '__main__':
    main()
Problem p03087 (python)

Fixed submission:
N,Q=map(int,input().split())
S=input()
count=[0]*N
for i in range(1,N):
    count[i]+=count[i-1]
    if S[i-1:i+1]=="AC":count[i]+=1
for i in range(Q):
    l,r=map(int,input().split())
    print(count[r-1]-count[l-1])

Buggy submission (verdict: Runtime Error):
n,q=map(int,input().split())
s=input()
count=[0]*n

for i in range(1,n):
  count[i] += count[i-1]
  if s[i-1:i+1]=="AC":
    count[i]+=1
for i in range(q):
  l,r=map(int,input().split())
  print(count([r-1]-count[l-1])
Problem p03109 (python)

Fixed submission:
def main():
    #import sys
    #input = sys.stdin.readline

    s = input()
    if int(''.join(s.split('/'))) <= 20190430:
        print('Heisei')
    else:
        print('TBD')
    
if __name__ == '__main__':
    main()

Buggy submission (verdict: Runtime Error):
def main():
    import sys
    input = sys.stdin.readline

    s = input()
    if int(s.strip("'")) < 20190430:
        print('Heisei')
    else:
        print('TBD')
    
if __name__ == '__main__':
    main()
Problem p03163 (python)

Fixed submission:
def main():
    n,wmax = map(int,input().split())
    wv = [list(map(int,input().split())) for _ in range(n)]

    # min -> inf, max -> -1
    dp = [[-1]*(wmax+1) for _ in range(n+1)]

    # shoki joken
    dp[0] = [0]*(wmax+1)
    for i in range(n):
        w,v = wv[i]
        for j in range(wmax+1):
            # i select or not select
            if j-w >= 0:
                dp[i+1][j] = max(dp[i][j],dp[i][j-w]+v)
            else:
                dp[i+1][j] = dp[i][j]

    print(max(dp[-1]))

if __name__ == '__main__':
    main()

Buggy submission (verdict: Runtime Error):
def main():
    n,w = map(int,input().split())
    wv = [list(map(int,input().split())) for _ in range(n)]

    # min -> inf, max -> -1
    dp = [[-1]*(w+1) for _ in range(n+1)]

    # shoki joken
    dp[0] = [0]*(w+1)
    for i in range(n):
        for j in range(w+1):
            # i select or not select
            if j-wv[i][0] >= 0:
                dp[i+1][j] = max(dp[i][j],dp[i][j-w]+v)
            else:
                dp[i+1][j] = dp[i][j]

    print(max(dp[-1]))

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

Fixed submission:
n=int(input())
t,a=map(int,input().split())
h=list(map(int,input().split()))
z=[abs(t-x*0.006-a) for x in h]
print(z.index(min(z))+1)

Buggy submission (verdict: Runtime Error):
n=int(input())
t,a=map(int,input().split())
h=list(map(int,input().split()))
z=[abs(t-x*0.006-a) for x in h]
print(x.index(min(z))+1)
Problem p03238 (python)

Fixed submission:
def main():
    from sys import stdin
    #r = stdin.readline()[:-1]
    n = int(stdin.readline()[:-1])   
    #r = [stdin.readline() for i in range(n)]
    #t = [int(stdin.readline()) for i in range(n)]

    if n == 1:
        print('Hello World')
    else:
        r = [int(stdin.readline()) for i in range(n)]
        print(r[0] + r[1])
   
if __name__ == '__main__':
    main()

Buggy submission (verdict: Runtime Error):
def main():
    from sys import stdin
    #r = stdin.readline()[:-1]
    r = stdin.readlines()

    if r[0] == '1':
        print('Hello World')
    else:
        print(r[1] + r[2])
   
if __name__ == '__main__':
    main()
Problem p03244 (python)

Fixed submission:
from collections import Counter
n=int(input())
v=list(map(int,input().split()))
a=Counter(v[0::2]).most_common()
b=Counter(v[1::2]).most_common()
a.append([0,0])
b.append([0,0])
if a[0][0]!=b[0][0]:
    print(n-(a[0][1]+b[0][1]))
else:
    print(min(n-(a[1][1]+b[0][1]),n-(a[0][1]+b[1][1])))

Buggy submission (verdict: Runtime Error):
def main():
    n = int(input())
    v = list(map(int,input().split()))

    from collections import Counter
    a = Counter(v[::2]).most_common()
    b = Counter(v[1::2]).most_common()

    if a[0][0] != b[0][0]:
        print(n-(a[0][1]+b[0][1]))
    else:
        print(min(n-(a[1][1]+b[0][1]),n-(a[0][1]+b[1][1])))
 
if __name__ == '__main__':
    main()
Problem p03262 (python)

Fixed submission:
from functools import reduce
from fractions import gcd
N,X=map(int,input().split())
x=[abs(X-int(i)) for i in input().split()]
print(reduce(gcd,x))

Buggy submission (verdict: Runtime Error):
from functools import reduce
from fractions import gcd
n,x=map(int,input().split())
x=[abx(x-int(i)) for i in input().split()]
print(reduce(gcd,x))
Problem p03288 (python)

Fixed submission:
def main():
    from sys import stdin, setrecursionlimit
    setrecursionlimit(10**6)
    r = stdin.readline()[:-1]
    #n = int(stdin.readline()[:-1])   
    #r = [stdin.readline() for i in range(n)]
    #t = [int(stdin.readline()) for i in range(n)]

    r = int(r)
    if r < 1200:
        print('ABC')
    elif r < 2800:
        print('ARC')
    else:
        print('AGC')

if __name__ == '__main__':
    main()

Buggy submission (verdict: Runtime Error):
def main():
    from sys import stdin, setrecursionlimit
    setrecursionlimit(10**6)
    r = stdin.readline()[:-1]
    #n = int(stdin.readline()[:-1])   
    #r = [stdin.readline() for i in range(n)]
    #t = [int(stdin.readline()) for i in range(n)]

    r = int(r)
    if r < 1200:
        print('ABC')
    elif r < 2800
        print('ARC')
    else:
        print('AGC')

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

Fixed submission:
a,b=map(int,input().split())
if a+b==15:
    print('+')
elif a*b==15:
    print('*')
else:
    print('x')

Buggy submission (verdict: Runtime Error):
a,b=map(int,input().split())
if a+b=15:
    print('+')
elif a*b=15:
    print('*')
else:
    print('x')
Problem p03309 (python)

Fixed submission:
N=int(input())
A=sorted(a-i-1 for i,a in enumerate(map(int,input().split())))
print(sum(abs(a-A[N//2]) for a in A))

Buggy submission (verdict: Runtime Error):
N=int(input())
A=sorted(a-i-1 for i,a in enumerate(map(int,input().split())))
print(sume(abs(a-A[N//2]) for a in A))
Problem p03316 (python)

Fixed submission:
n=input()
print("Yes" if int(n)%sum(map(int,list(n)))==0 else "No")

Buggy submission (verdict: Runtime Error):
n=input()
print("Yes" if int(n)%sum(map(int,lsit(n)))==0 else "No")
Problem p03416 (python)

Fixed submission:
a,b=map(int,input().split())
print(sum(i==i[::-1] for i in map(str,range(a,b+1))))

Buggy submission (verdict: Runtime Error):
a,b=input().split()
print(sum(i==i[::-1] for i in range(int(a), int(b)+1)))
Problem p03425 (python)

Fixed submission:
from itertools import combinations
from collections import Counter
N=int(input())
S=Counter()
for i in range(N):
    S[input()[0]]+=1
print(sum([S[a]*S[b]*S[c] for a,b,c in combinations("MARCH",3)]))

Buggy submission (verdict: Runtime Error):
from itertools import combinations
from collections import Counter
n=int(input())
s=Counter
for i in range(n):
  s[input()[0]]+=1
print(sum([s[a]*s[b]*s[c] for a,b,c in combinations("MARCH",3)]))
Problem p03434 (python)

Fixed submission:
input()
l=sorted(map(int,input().split()))[::-1]
print(sum(l[::2])-sum(l[1::2]))

Buggy submission (verdict: Runtime Error):
input()
l=sorted(map(int,input().split()))[::-1]
pritn(sum(l[::2])-sum(l[1::2]))
Problem p03477 (python)

Fixed submission:
a,b,c,d = map(int, input().split())
res = a+b - (c+d)
if res > 0:
  print('Left')
elif res == 0:
  print('Balanced')
else:
  print('Right')

Buggy submission (verdict: Runtime Error):
a,b,c,d = map(int, input().split())
res = a+b - (c+d)
if res > 0:
  print('Left')
elif res = 0:
  print('Balanced')
else:
  print('Right')
Problem p03493 (python)

Fixed submission:
s = list(input())
n = [int(i) for i in s]
print(sum(n))

Buggy submission (verdict: Runtime Error):
s = list(int(input()))
print(sum(s))
Problem p03494 (python)

Fixed submission:
input()
a=list(map(int,input().split()))
ans=0
while all(i%2==0 for i in a):
  a = [i/2 for i in a]
  ans += 1
print(ans)

Buggy submission (verdict: Runtime Error):
input()
a=list(map(int,input().split()))
ans=0
while all(a%2==0 for i in A):
  A = [a/2 for a in A]
  ans += 1
print(ans)
Problem p03495 (python)

Fixed submission:
from collections import Counter
n,k=map(int,input().split())
a=Counter(input().split())
print(sum(sorted(a.values(),reverse=True)[k:]))

Buggy submission (verdict: Runtime Error):
from collections import Counter
n,k=map(int,input().split())
c=Counter(input().split())
pritn(sum(sorted(a.values(), reverse=True)[k:]))
Problem p03503 (python)

Fixed submission:
N=int(input())
F=[int(input().replace(' ',''),2) for i in range(N)]
P=[list(map(int,input().split())) for i in range(N)]
print(max(sum([p[bin(f&i).count('1')] for f,p in zip(F,P)]) for i in range(1,2**10)))

Buggy submission (verdict: Runtime Error):
def main():
    n = int(input())
    f = [list(map(int,input().split())) for i in range(n)]
    p = [list(map(int,input().split())) for i in range(n)]
    bit = 1<<10 #全探索2**10
    res = -10**10
    for i in range(1,bit):
        chk = [0]*n
        cnt = 0
        for j in range(10): # 10回分有無判定
            if (i>>j)&1: # 最下位bit判定
                for k in range(n):
                    if f[k][j] == 1:
                        chk[k] += 1
        for l in range(10):
            cnt += p[l][chk[l]]
        res = max(res,cnt)
    print(res)

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

Fixed submission:
def dfs(i, f, sum, s):
    if i == 3:
        if sum == 7:
            print(f+"=7")
            exit()
        return

    dfs(i+1, f+"-"+s[i+1], sum - int(s[i+1]), s)
    dfs(i+1, f+"+"+s[i+1], sum + int(s[i+1]), s)

def main():
    s = input()

    dfs(0, s[0], int(s[0]), s)
    
if __name__ == '__main__':
    main()

Buggy submission (verdict: Runtime Error):
def dfs(i, f, sum, s):
    if i == 3:
        if sum == 7:
            print(f+"=7")
            exit()

    dfs(i+1, f+"-"+s[i+1], sum - int(s[i+1]), s)
    dfs(i+1, f+"+"+s[i+1], sum + int(s[i+1]), s)

def main():
    s = input()

    dfs(0, s[0], int(s[0]), s)
    
if __name__ == '__main__':
    main()
Problem p03565 (python)

Fixed submission:
sd = input()
t = input()

n = len(sd)
m = len(t)
s = []

# sd を後ろから見ていき、 t の入りそうな場所を探す
for i in range(n - m, -1, -1):
    t_kamo = sd[i:i + m]
    for j in range(m + 1):
        # 1文字ずつ順に入りうるか調べ、最後まで入るなら "?" を "a" に置き換えて出力
        if j == m:
            print((sd[:i] + t + sd[i + len(t):]).replace("?", "a"))
            exit()
        if t_kamo[j] == "?":
            continue
        elif t_kamo[j] != t[j]:
            break

print("UNRESTORABLE")

Buggy submission (verdict: Runtime Error):
import re
s=input().replace("?",".")
t=input()
for i in range(len(s)-lent(t)+1):
  if re.match(s[i:i+len(t)],t):
    s=s.replace(".","a")
    print(s[:i]+t+s[i+len(t):])
    exit()
print("UNRESTORABLE")
Problem p03578 (python)

Fixed submission:
from collections import Counter
n=int(input())
d=Counter(map(int,input().split()))
m=int(input())
t=Counter(map(int,input().split()))
for i in t:
  if d[i] < t[i]:
    print('NO')
    exit()
print('YES')

Buggy submission (verdict: Runtime Error):
n=int(input())
d=Counter(map(int,input().split()))
m=int(input())
t=Counter(map(int,input().split()))

from collections import Counter
for i in t:
  if d[i] < t[i]:
    print('NO')
    exit()
print('YES')
Problem p03588 (python)

Fixed submission:
n=int(input())
a=sorted(list(map(int,input().split())) for _ in range(n))
print(sum(a[-1]))

Buggy submission (verdict: Runtime Error):
n=int(input())
a=sorted(list(map(int,input().split())) for _ in range(n))
print(sum(a[-1])
Problem p03606 (python)

Fixed submission:
print(sum(1-eval(input().replace(" ","-")) for _ in range(int(input()))))

Buggy submission (verdict: Runtime Error):
print(sum(1-eval(input().replace(" ", "-")) for _ in range(int(input())))
Problem p03627 (python)

Fixed submission:
from collections import Counter
N=int(input())
A=Counter(list(map(int,input().split())))
x=[0,0]
for a in A:
    if A[a]>1:x.append(a)
    if A[a]>3:x.append(a)
x.sort()
print(x[-1]*x[-2])

Buggy submission (verdict: Runtime Error):
import heapq
n=int(input())
s=set()
q=[0,0]
for a in map(int,input().split()):
  if a>q[0]:
    heapq.heapreplace(q,a)
print(q[0]*a[1])
Problem p03633 (python)

Fixed submission:
from fractions import gcd
def lcm(a,b): return a*b//gcd(a,b)
N=int(input())
ans=1
for i in range(N):
    t=int(input())
    ans=lcm(ans,t)
print(ans)

Buggy submission (verdict: Runtime Error):
from fractions import gcd
def lcm(a,b): return a*b//gcd(a,b)
N=int(input())
ans=1
for i in range(N):
    t=int(input())
    ans=lcm(ans,t)
print(ans)
Problem p03636 (python)

Fixed submission:
a, *b, c = input()
print(a+str(len(b))+c)

Buggy submission (verdict: Runtime Error):
a, b*, c = input()
print(a+str(len(b))+c)
Problem p03671 (python)

Fixed submission:
a=list(map(int,input().split()))
a.sort()
print(a[0]+a[1])

Buggy submission (verdict: Runtime Error):
a=list(input())
a.sort()
print(int(a[0])+int(a[1]))

Buggy submission (verdict: Runtime Error):
a=list(int(input()))
a.sort()
print(a[0]+a[1])
Problem p03672 (python)

Fixed submission:
s=list(input())
while len(s) != 0:
  s.pop()
  if len(s)%2==0 and s[:len(s)//2]==s[len(s)//2:]:
    print(len(s))
    exit()

Buggy submission (verdict: Runtime Error):
s=list(input())
while len(s) != 0:
  s.pop()
  if len(s)%2==0 and s[:len(s)//2]==s[len(s)//2:]:
    print(len(s)
    exit()
Problem p03673 (python)

Fixed submission:
N=int(input())
A=list(input().split())
s = " ".join(A[::-2]) + " " + " ".join(A[N%2::2])
print(s)

Buggy submission (verdict: Runtime Error):
N=int(input())
A=list(map(int,input().split()))
print(*A[::-2],*A[N%2::2])

Buggy submission (verdict: Runtime Error):
from collectiojns import deque
n=int(input())
a=list(map(int,input().split()))
b=deque()

for i in range(n):
  b.append(a[i])
  b=[::-1]
print(*b)

Buggy submission (verdict: Runtime Error):
from collectiojns import deque
n=int(input())
a=list(map(int,input().split()))
b=deque()

for i in range(n):
  b.append(a[i])
  b=[b::-1]
print(*b)
Problem p03696 (python)

Fixed submission:
def main():
    n = int(input())
    s = input()
    left = 0
    right = 0
    for i in range(n):
        if s[i] == '(':
            right += 1
        else:
            if right == 0:
                left += 1
            else:
                right -= 1
    print('('*left+s+')'*right)

if __name__ == '__main__':
    main()

Buggy submission (verdict: Runtime Error):
def main():
    n = int(input())
    s = list(input())
    left = 0
    right = 0
    for i in range(n):
        if s[i] == '(':
            right += 1
        else:
            if right == 0:
                left += 1
            else:
                right -= 1
    res = ''
    print('('*left+s+')'*right)

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

Fixed submission:
def main():
    from sys import stdin, setrecursionlimit
    #setrecursionlimit(10**9)
    #n = int(stdin.readline()[:-1])   
    r = stdin.readline()[:-1]
    #n = int(stdin.readline()[:-1])   
    #r = [stdin.readline() for i in range(n)]
    #t = [int(stdin.readline()) for i in range(n)]
    #a = r.split()
    #a = list(map(int, r.split()))
    a, b = map(int, r.split())
    #a = [int(s[i]) for i in range(1, n+1)]
    #a = [list(map(int, r.split())) for i in range(1,n+1)]
    #res = 0

    if a+b >= 10:
        print('error')
    else:
        print(a+b)        

if __name__ == '__main__':
    main()

Buggy submission (verdict: Runtime Error):
def main():
    from sys import stdin, setrecursionlimit
    #setrecursionlimit(10**9)
    #n = int(stdin.readline()[:-1])   
    r = stdin.readline()[:-1]
    #n = int(stdin.readline()[:-1])   
    #r = [stdin.readline() for i in range(n)]
    #t = [int(stdin.readline()) for i in range(n)]
    #a = r.split()
    #a = list(map(int, r.split()))
    a, b = map(int, r.split())
    #a = [int(s[i]) for i in range(1, n+1)]
    #a = [list(map(int, r.split())) for i in range(1,n+1)]
    #res = 0

    if a+b >= 10:
        pritn('error')
    else:
        print(a+b)        

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

Fixed submission:
x=int(input())
ans,i=0,0
while i < x:
    i+=ans
    ans+=1
print(ans-1)

Buggy submission (verdict: Runtime Error):
x=int(input())
ans=0
while i < x:
    i+=ans
    ans+=1
print(ans-1)
Problem p03846 (python)

Fixed submission:
n=int(input())
a=list(map(int,input().split()))
flg = True
if n%2==0:
  if 0 in a or len(set(a))!=n//2:
    flg=False
else:
  if len([0 for i in a if i==0])!=1 or len(set(a))!=n//2+1:
    flg=False
if flg:
  print(2**(n//2)%(10**9+7))
else:
  print(0)

Buggy submission (verdict: Runtime Error):
n=int(input())
a=list(map(int,input().split()))
flg = True
if n%2==0:
  if 0 in a or len(set(a))!=n//2:
    flg=False
else:
  if len([0 for i in a if a==0])!=1 or len(set(a))!~n//2+1:
    flg=False
if flg:
  print(2**(n//2)%(10**9+7))
else:
  print(0)

Buggy submission (verdict: Runtime Error):
import math
n=int(input())
a=list(map(int,input().split()))
flg = True
if n%2==0:
  if 0 in a or len(set(a))!=n//2:
    flg=False
  else:
    if len([0 for i in a if a==0])!=1 or len(set(a))!~n//2+1:
      flg=False
  if flg:
    print(2**(n//2)%(10**9+7))
  else:
    print(0)
Problem p03853 (python)

Fixed submission:
h,w=map(int,input().split())
for i in range(h):
    s=input()
    print(s+"\n"+s)

Buggy submission (verdict: Runtime Error):
from sys import platform, stdin, setrecursionlimit

if platform =='ios':
    stdin=open('input.txt')
    
#------------------------------------#

def main():
    #setrecursionlimit(10**9)
    #n = int(stdin.readline()[:-1])   
    r = input()
    #r = [stdin.readline() for i in range(n)]
    #t = [int(stdin.readline()) for i in range(n)]
    #n = int(r)
    #a = r.split()
    #a,b,c = r.split()
    #a = list(map(int, r.split()))
    a,b = map(int, r.split())
    #a = [int(s[i]) for i in range(1, n+1)]
    #a = [list(map(int, r.split())) for i in range(1,n+1)]
    res = 0
  
    r = [input() for i in range(b)]
    
    for i in r:
    	print(i+"\n"+i)
    
    
if __name__ == '__main__':
    main()
Problem p03994 (python)

Fixed submission:
def main():
    s = list(input())
    k = int(input())

    for i in range(len(s)-1):
        if s[i] == 'a':
            continue
        else:
            mod = 26-(ord(s[i])-97)%26
            if k >= mod:
                k -= mod
                s[i] = 'a'
            if k == 0:
                break
    
    if k > 0:
        mod = ((ord(s[-1])-97)+k)%26
        s[-1] = chr(mod+97)
    print(''.join(s))

if __name__ == '__main__':
    main()

Buggy submission (verdict: Runtime Error):
def main():
    s = list(input())
    k = int(input())

    for i in range(len(s)):
        mod = 26-(ord(s[i])-97)%26
        if k >= mod:
            k -= mod
            s[i] = 'a'
        if k == 0:
            break
    
    if k > 0:
        mod = (ord(s[-1])-97)%26+k
        s[-1] = chr(mod+97)
    print(''.join(s))

if __name__ == '__main__':
    main()