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

Fixed submission:
def gcd(a, b): #最大公約数
    if b == 0:
        return a
    else:
        return gcd(b, a%b)
        
def main():
    n=int(input())
    a = list(map(int,input().split()))
    L=[a[0] for _ in range(n)]
    R=[a[n-1] for _ in range(n)]
    for i in range(1,n):
        L[i]=gcd(L[i-1],a[i])
    for i in range(1,n):
        R[i]=gcd(R[i-1],a[n-1-i])
    R.reverse()
    LR=[]
    for i in range(1,n-1):
        LR.append( gcd(L[i-1],R[i+1]) )
    if LR==[]:
        print(max(L[n-2],R[1] ))
    else:
        print(max(max(LR),L[n-2],R[1] ))


if __name__ == "__main__":
    main()

Buggy submission (verdict: Runtime Error):
import math
def main():
    n=int(input())
    a = list(map(int,input().split()))
    L=[a[0] for _ in range(n)]
    R=[a[n-1] for _ in range(n)]
    for i in range(1,n):
        L[i]=math.gcd(L[i-1],a[i])
    for i in range(1,n):
        R[i]=math.gcd(R[i-1],a[n-1-i])
    R.reverse()
    LR=[]
    for i in range(1,n-1):
        LR.append( math.gcd(L[i-1],R[i+1]) )
    if LR==[]:
        print(max(L[n-2],R[1] ))
    else:
        print(max(max(LR),L[n-2],R[1] ))


if __name__ == "__main__":
    main()

Buggy submission (verdict: Runtime Error):
import math
def main():
    n=int(input())
    a = list(map(int,input().split()))
    L=[a[0] for _ in range(n)]
    R=[a[n-1] for _ in range(n)]
    for i in range(1,n):
        L[i]=math.gcd(L[i-1],a[i])
    for i in range(1,n):
        R[i]=math.gcd(R[i-1],a[n-1-i])
    R.reverse()
    LR=[]
    for i in range(1,n-1):
        LR.append( math.gcd(L[i-1],R[i+1]) )
    if LR==[]:
        print(max(L[n-2],R[1] ))
    else:
        print(max(max(LR),L[n-2],R[1] ))


if __name__ == "__main__":
    main()

Buggy submission (verdict: Runtime Error):
import math
import copy
import sys
import bisect
input = sys.stdin.readline

def main():
    n=int(input())
    a = list(map(int,input().split()))
    L=[a[0] for _ in range(n)]
    R=[a[n-1] for _ in range(n)]
    for i in range(1,n):
        L[i]=math.gcd(L[i-1],a[i])
    for i in range(1,n):
        R[i]=math.gcd(R[i-1],a[n-1-i])
    R.reverse()
    LR=[]
    for i in range(1,n-1):
        LR.append( math.gcd(L[i-1],R[i+1]) )
    if LR==[]:
        print(max(L[n-2],R[1] ))
    else:
        print(max(max(LR),L[n-2],R[1] ))


if __name__ == "__main__":
    main()
Problem p03262 (python)

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

n,x = map(int,input().split())
s = list(map(int,input().split()))

for i in range(n):
    s[i]-=x
ans=s[0]
for i in range(n-1):
    ans=gcd(ans,s[i+1])

if(ans<0):
    ans=-ans
    

print(ans)

Buggy submission (verdict: Runtime Error):
import math
from functools import reduce

def gcd(*numbers):
    return reduce(math.gcd, numbers)

def gcd_list(numbers):
    return reduce(math.gcd, numbers)
    
n,x = map(int,input().split())
s = list(map(int,input().split()))

for i in range(n):
    s[i]-=x

ans=gcd_list(s)
   
print(ans)
Problem p03325 (python)

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

Buggy submission (verdict: Runtime Error):
v
Problem p03355 (python)

Fixed submission:
def main():
    s=input()
    m=int(input())
    tank=[]
    n=len(s)
    alpha=[chr(i) for i in range(97, 97+26)]
    for i in range(26):
        for j in range(n):
            if alpha[i]==s[j]:
                for k in range(min(n-j,m)):
                    if s[j:j+k+1] not in tank:
                        tank.append(s[j:j+k+1])
        if len(tank)>=m:
            break
    tank.sort()
    print(tank[m-1])
    
if __name__ == "__main__":
    main()

Buggy submission (verdict: Runtime Error):
def main():
    s=input()
    m=int(input())
    tank=[]
    n=len(s)
    alpha=[chr(i) for i in range(97, 97+26)]
    for i in range(26):
        for j in range(n):
            if alpha[i]==s[j]:
                for k in range(n-j):
                    if s[j:j+k+1] not in tank:
                        tank.append(s[j:j+k+1])
        if len(tank)>=k:
            break
    tank.sort()
    print(tank[m-1])
    
if __name__ == "__main__":
    main()
Problem p03379 (python)

Fixed submission:
import math
import copy
#import sys
#import bisect
#input = sys.stdin.readline
def gcd(a, b):
    if b == 0:
        return a
    else:
        return gcd(b, a%b)
def lcm(a, b):
    return((a*b)//gcd(a,b))

def main():
    #x,y = map(int,input().split())	x=1,y=2
    #a = input().split()	a=['1','2','3',...,'n']
    #a = list(map(int,input().split()))	a=[1,2,3,4,5,...,n]
    #li = input().split('T')	FFFTFTTFF => li=['FFF', 'F', '', 'FF']
    n=int(input())
    a = list(map(int,input().split()))
    b=copy.copy(a)
    a.sort()
    for i in range(n):
        x=b[i]
        if x<=a[(n//2)-1]:
            print(a[(n//2)])
        else:
            print(a[(n//2)-1])

main()

Buggy submission (verdict: Runtime Error):
#import math
#import sys
#import bisect
#input = sys.stdin.readline
def gcd(a, b):
    if b == 0:
        return a
    else:
        return gcd(b, a%b)
def lcm(a, b):
    return((a*b)//gcd(a,b))

def main():
    #x,y = map(int,input().split())	x=1,y=2
    #a = input().split()	a=['1','2','3',...,'n']
    #a = list(map(int,input().split()))	a=[1,2,3,4,5,...,n]
    #li = input().split('T')	FFFTFTTFF => li=['FFF', 'F', '', 'FF']
    n=int(input())
    a = list(map(int,input().split()))
    b=a.copy()
    for i in range(n):
        x=b[i]
        a.sort()
        if x<=a[(n//2)-1]:
            print(a[(n//2)])
        else:
            print(a[(n//2)-1])

main()
Problem p03425 (python)

Fixed submission:
n=int(input())
name={}
name["M"]=0
name["A"]=0
name["R"]=0
name["C"]=0
name["H"]=0
for _ in range(n):
    s=list(input())
    if s[0] not in name:
        name[s[0]]=1
    else:
        name[s[0]]+=1
cnt=[name["M"],name["A"],name["R"],name["C"],name["H"]]
ans=0
n=5
for i in range(n-2):
    for j in range(n-i-2):
        j+=i+1
        for k in range(n-j-1):
            k+=j+1
            ans+=cnt[i]*cnt[j]*cnt[k]
print(ans)

Buggy submission (verdict: Runtime Error):
n=int(input())
name={}
name["M"]=0
name["A"]=0
name["R"]=0
name["C"]=0
name["H"]=0
for _ in range(n):
    s=list(input())
    if s[0] not in name:
        name[s[0]]=1
    else:
        name[s[0]]+=1
cnt=[name["M"],name["A"],name["R"],name["C"],name["H"]]
ans=0
for i in range(n-2):
    for j in range(n-i-2):
        j+=i+1
        for k in range(n-j-1):
            k+=j+1
            ans+=cnt[i]*cnt[j]*cnt[k]
print(ans)
Problem p03427 (python)

Fixed submission:
n=int(input())
if n < 10 :
    print(n)
else:
    n=list(str(n))
    key=0
    for i in range(len(n)-1):
        if n[1+i]!="9":
            key=1
    if key ==0:
        print((len(n)-1)*9+int(n[0]))
    else:
        print((len(n)-1)*9+int(n[0])-1)

Buggy submission (verdict: Runtime Error):
n=int(input())
if n < 10 :
    print(n)
else:
    n=list(str(n))
    key=0
    for i in range(n):
        if n[1+i]!="9":
            key=1
    if key ==0:
        print((len(n)-1)*9+int(n[0]))
    else:
        print((len(n)-1)*9+int(n[0])-1)
Problem p03556 (python)

Fixed submission:
n=int(input())
ans=1
if(n==1 or n==2 or n==3):
    ans=1
else:
    for i in range(n):
        i=n-i
        for j in range(3):
            j+=int(i**0.5)-1
            if(i//j==j and i%j==0):
                ans=i
                break
        if(ans!=1):
            break
        
print(ans)

Buggy submission (verdict: Runtime Error):
n=int(input())
ans=1
for i in range(n):
    i=n-i
    for j in range(3):
        j+=int(i**0.5)-1
        if(i//j==j and i%j==0):
            ans=i
            break
    if(ans!=1):
        break
        
print(ans)
Problem p03761 (python)

Fixed submission:
def main():
    n=int(input())
    s=list(input())
    dict1={}
    for i in range(len(s)):
        if s[i] not in dict1:
            dict1[s[i]]=1
        else:
            dict1[s[i]]+=1
    if n==1:
        s.sort()
        print(''.join(s))
        return
    for _ in range(n-1):
        dict2={}
        t=list(input())
        for i in range(len(t)):
            if t[i] in dict1 and dict1[t[i]]>0:
                if t[i] not in dict2:
                    dict2[t[i]]=1
                    dict1[t[i]]-=1
                else:
                    dict2[t[i]]+=1
                    dict1[t[i]]-=1
        dict1=dict2
    ans=[]
    for i in dict2:
        for _ in range(dict2[i]):
            ans.append(i)
    ans.sort()
    print(''.join(ans))
if __name__ == "__main__":
    main()

Buggy submission (verdict: Runtime Error):
def main():
    n=int(input())
    s=list(input())
    dict1={}
    for i in range(len(s)):
        if s[i] not in dict1:
            dict1[s[i]]=1
        else:
            dict1[s[i]]+=1
    for _ in range(n-1):
        dict2={}
        t=list(input())
        for i in range(len(t)):
            if t[i] in dict1 and dict1[t[i]]>0:
                if t[i] not in dict2:
                    dict2[t[i]]=1
                    dict1[t[i]]-=1
                else:
                    dict2[t[i]]+=1
                    dict1[t[i]]-=1
        dict1=dict2
    ans=[]
    for i in dict2:
        for _ in range(dict2[i]):
            ans.append(i)
    ans.sort()
    print(''.join(ans))
if __name__ == "__main__":
    main()
Problem p03994 (python)

Fixed submission:
from collections import Counter,defaultdict,deque
import sys
from itertools import permutations, combinations
from heapq import heappop, heappush
# input = sys.stdin.readline
sys.setrecursionlimit(10**8)
mod = 10**9+7
    
def inp(): # n=1
    return int(input())
def inpm(): # x=1,y=2
    return map(int,input().split())
def inpl(): # a=[1,2,3,4,5,...,n]
    return list(map(int, input().split()))
def inpls(): # a=['1','2','3',...,'n']
    return list(input().split())
def inplm(n): # x=[] 複数行
    return list(int(input()) for _ in range(n))
def inpll(n): # [[1,1,1,1],[2,2,2,2],[3,3,3,3]]
    return sorted([list(map(int, input().split())) for _ in range(n)])

def main():
    s=list(input())
    k=inp()
    n=len(s)
    for i in range(n):
        s[i]=ord(s[i])
    for i in range(n):
        if i==n-1:
            s[i]+=k
            if s[i]>=123:
                s[i]=(s[i]-97)%26+97
        elif s[i]==97:
            s[i]='a'
            continue
        elif 123-s[i]<=k:
            k-=123-s[i]
            s[i]=97
        s[i]=chr(s[i])
    print(''.join(s))

if __name__ == "__main__":
    main()

Buggy submission (verdict: Runtime Error):
from collections import Counter,defaultdict,deque
import sys
from itertools import permutations, combinations
from heapq import heappop, heappush
# input = sys.stdin.readline
sys.setrecursionlimit(10**8)
mod = 10**9+7
    
def inp(): # n=1
    return int(input())
def inpm(): # x=1,y=2
    return map(int,input().split())
def inpl(): # a=[1,2,3,4,5,...,n]
    return list(map(int, input().split()))
def inpls(): # a=['1','2','3',...,'n']
    return list(input().split())
def inplm(n): # x=[] 複数行
    return list(int(input()) for _ in range(n))
def inpll(n): # [[1,1,1,1],[2,2,2,2],[3,3,3,3]]
    return sorted([list(map(int, input().split())) for _ in range(n)])

def main():
    s=list(input())
    k=inp()
    for i in range(len(s)):
        s[i]=ord(s[i])
    for i in range(len(s)):
        if i==len(s)-1:
            s[i]+=k
            if s[i]>=123:
                s[i]-=26
        elif 123-s[i]<=k:
            k-=123-s[i]
            s[i]=97
        s[i]=chr(s[i])
    print(''.join(s))



if __name__ == "__main__":
    main()
Problem p02658 (python)

Fixed submission:
def b169(n, alist):

    ans = 1
    for i in alist:
        if i == 0:
            return 0

    for i in alist:
        ans *= i
        if ans > 10**18:
            return -1

    return ans

def main():
    n = int(input())
    alist = list(map(int, input().split()))
    print(b169(n, alist))

if __name__ == '__main__':
    main()

Buggy submission (verdict: Runtime Error):
def b169(n, alist):

    ans = 1
    for i in alist:
        ans *= i

    return ans if ans < 10**18 else -1

def main():
    n = int(input())
    alist = list(int(input()))
    print(b169(n, alist))

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

Fixed submission:
def rally(n , xl):

    ans = 0

    aaa = round(sum(xl) / n)

    for i in range(n):
        ans += (xl[i] - aaa)**2

    return ans

def main():
    n = int(input())
    xl = list(map(int , input().split()))
    print(rally(n , xl))

if __name__ == '__main__':
    main()

Buggy submission (verdict: Runtime Error):
5 5 17 6 37 17 18

25 25 289 36 1369 289 324def rally(n , xl):

    ans = 0

    aaa = round(sum(xl) / n)

    for i in range(n):
        ans += (xl[i] - aaa)**2

    return ans

def main():
    n = int(input())
    xl = list(map(int , input().split()))
    print(rally(n , xl))

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

Fixed submission:
def tasu(x):
    return x / 2 * (x + 1)

def kitaiti(n , k , p):

    ans = 0
    count = 0
    kitai = [0]*n
    kitaisum = [0]*n
    mod = 10**9+7

    for i in range(n):
        kitai[i] = tasu(p[i]) / p[i]

    for i in range(n):
        if i == 0:
            kitaisum[i] += kitai[i]
        else:
            kitaisum[i] += kitai[i] + kitaisum[i-1]

    for i in range(n - k + 1):

        ans = max(ans , (kitaisum[i + k - 1] - kitaisum[i-1]) if i != 0 else kitaisum[i + k - 1])

    return ans

def main():
    n , k = map(int , input().split())
    p = list(map(int,input().split()))
    print(kitaiti(n , k , p))

if __name__ == '__main__':
    main()

Buggy submission (verdict: Runtime Error):
def tasu(x):
    return x / 2 * (x + 1)

def kitaiti(n , k , p):

    ans = 0
    count = 0
    kitai = [0]*n
    kitaisum = [0]*n
    mod = 10**9+7

    for i in range(n):
        kitai[i] = tasu(p[i]) / p[i]

    for i in range(n):
        if i == 0:
            kitaisum[i] += kitai[i]
        else:
            kitaisum[i] += kitai[i] + kitaisum[i-1]

    for i in range(n - k + 1):

        ans = max(ans , (kitaisum[i+k] - kitaisum[i]))

    return ans

def main():
    n , k = map(int , input().split())
    p = list(map(int,input().split()))
    print(kitaiti(n , k , p))

if __name__ == '__main__':
    main()

Buggy submission (verdict: Runtime Error):
def tasu(x):
    return x / 2 * (x + 1)

def kitaiti(n , k , p):

    ans = 0
    count = 0
    kitai = [0]*n
    mod = 10**9+7

    for i in range(n):
        kitai[i] = round(tasu(p[i]) / p[i] , 6)

    for i in range(n - k + 1):

        if i == 0:
            count = sum(kitai[i:i+k]) % mod
        else:
            count -= kitai[i-1] % mod
            count += kitai[i + k] % mod
#        count = sum(kitai[i:i+k]) % mod
#       for w in range(i , i + k):
#            count += kitai[w]
#            count += tasu(p[w]) / p[w]
        ans = max(ans , count)

    return ans

def main():
    n , k = map(int , input().split())
    p = list(map(int,input().split()))
    print(kitaiti(n , k , p))

if __name__ == '__main__':
    main()

Buggy submission (verdict: Runtime Error):
def tasu(x):
    return x / 2 * (x + 1)

def kitaiti(n , k , p):

    ans = 0
    count = 0
    kitai = [0]*n
    mod = 10**9+7

    for i in range(n):
        kitai[i] = round(tasu(p[i]) / p[i] , 6)

    for i in range(n - k + 1):

        if i == 0:
            count = sum(kitai[i:i+k]) % mod
        else:
            count -= kitai[i-1]
            count += kitai[i + k]
#        count = sum(kitai[i:i+k]) % mod
#       for w in range(i , i + k):
#            count += kitai[w]
#            count += tasu(p[w]) / p[w]
        ans = max(ans , count)

    return ans

def main():
    n , k = map(int , input().split())
    p = list(map(int,input().split()))
    print(kitaiti(n , k , p))

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

Fixed submission:
def security(s):

    return "Good" if s[0] != s[1] and s[1] != s[2] and s[2] != s[3] else "Bad"
def main():
    s = list(str(input()))
    print(security(s))

if __name__ == '__main__':
    main()

Buggy submission (verdict: Runtime Error):
def security(s):

    return "Good" if s[0] != s[1] and s[1] != s[2] and s[2] != s[3] else "Bad"
def main():
    s = list(int(input()))
    print(security(s))

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

Fixed submission:
def kth_common_divisor(a, b, k):

    count = []
    for i in range(1, max(a, b)+1):
        if a%i == 0 and b%i == 0:
            count.append(i)

    count.sort(reverse=True)
    return count[k-1]

def main():
    a, b, k = map(int, input().split())
    print(kth_common_divisor(a, b, k))

if __name__ == '__main__':
    main()

Buggy submission (verdict: Runtime Error):
def kth_common_divisor(a, b, k):

    count = 0
    for i in range(max(a, b)):
        if a%i == 0 and b%i:
            count += 1
        if count == k:
            return i

def main():
    a, b, k = map(int, input().split())
    print(kth_common_divisor(a, b, k))

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

Fixed submission:
def To_Infinity(s , k):

    ans = ""

    s1 = s.lstrip("1")

    if k - (len(s) - len(s1)) > 0:
        ans = s1[0]
    else:
        ans = "1"

    return ans
def main():
    s = str(input())
    k = int(input())
    print(To_Infinity(s , k))

if __name__ == '__main__':
    main()

Buggy submission (verdict: Runtime Error):
def To_Infinity(s , k):

    ans = ""

    s1 = s.lstrip("1")

    if k - (len(s) - len(s1)) >= 0:
        ans = s1[0]
    else:
        ans = "1"

    return ans
def main():
    s = str(input())
    k = int(input())
    print(To_Infinity(s , k))

if __name__ == '__main__':
    main()

Buggy submission (verdict: Runtime Error):
def To_Infinity(s , k):

    ans = 0

    if s[0] == 1:
        if k == 1:
            ans = 1
        else:
            ans = s[1]
    else:
        ans = s[0]

    return ans
def main():
    s = list(int(input()))
    k = int(input())
    print(To_Infinity(s , k))

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

Fixed submission:

def Same_Integers(abc):

    ans = 0
    abc.sort()
    count = abc[2]*3 - abc[0] - abc[1] - abc[2]

    if count % 2 == 0:
        ans = int(count / 2)
    else:
        ans = int((count + 3) // 2)

    return ans

def main():
    abc = list(map(int , input().split()))
    print(Same_Integers(abc))

if __name__ == '__main__':
    main()

Buggy submission (verdict: Runtime Error):
if __name__ == '__main__':
Problem p03416 (python)

Fixed submission:
def P_Number(a , b):

    ans = 0

    for i in range(a, b + 1):
        rev = str(i)
        if str(i) == rev[::-1]:
            ans += 1

    return ans

def main():
    a , b = map(int , input().split())
    print(P_Number(a , b))


if __name__ == '__main__':
    main()

Buggy submission (verdict: Runtime Error):
def P_Number(a , b):

    ans = 0

    for i in range(a, b + 1):
        rev = str(i[::-1])
        if i == int(rev):
            ans += 1

    return ans

def main():
    a , b = map(int , input().split())
    print(P_Number(a , b))


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

Fixed submission:
def NotsoDiverse(n , k , al):

    lis = [0]*(n + 1)

    for i in range(n):
        lis[al[i]] += 1

    lis.sort(reverse=True)

    ans = sum(lis[k:])
    return ans

def main():
    n , k = map(int , input().split())
    al = list(map(int , input().split()))
    print(NotsoDiverse(n , k , al))

if __name__ == '__main__':
    main()

Buggy submission (verdict: Runtime Error):
def NotsoDiverse(n , k , al):

    lis = [0]*n

    for i in range(n):
        lis[al[i]] += 1

    lis.sort(reverse=True)

    ans = sum(lis[k:])
    return ans

def main():
    n , k = map(int , input().split())
    al = list(map(int , input().split()))
    print(NotsoDiverse(n , k , al))

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

Fixed submission:
def hex(x , y):

    ans = ""

    if int(x, 16) < int(y, 16):
        ans = "<"
    elif int(x, 16) > int(y, 16):
        ans = ">"
    else:
        ans = "="

    return ans

def main():
    x , y = map(str , input().split())
    print(hex(x , y))

if __name__ == '__main__':
    main()

Buggy submission (verdict: Runtime Error):
def hex(x , y):

    ans = ""

    if int(x, 16) < int(y, 16):
        ans = "<"
    elif int(x, 16) > int(y, 16):
        ans = ">"
    else:
        ans = "="

    return ans

def main():
    x , y = map(int , input().split())
    print(hex(x , y))

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

Fixed submission:
import bisect

def snukefestival(n , a , b , c):

    ans = 0
    a.sort()
    b.sort()
    c.sort()

    for i in b:
        ab = bisect.bisect_left(a , i)
        cb = bisect.bisect_right(c , i)
        ans += ab * (len(b) - cb)

    return ans

def main():
    n = int(input())
    a = list(map(int, input().split()))
    b = list(map(int, input().split()))
    c = list(map(int , input().split()))
    print(snukefestival(n , a , b , c))

if __name__ == '__main__':
    main()

Buggy submission (verdict: Runtime Error):
def nibunhigh(lister, b):
    ans = 0
    low = 0
    high = len(lister) - 1

    if lister[low] > b:
        return high + 1
    elif lister[high] < b:
        return low
    else:
        while lister[low + 1] < b:
            mid = (low + high) // 2
            if (b < lister[mid]):
                high = mid
            else:
                low = mid
        ans = len(lister) - (low + 1)

    return ans

def nibunlow(lister, b):
    ans = 0
    low = 0
    high = len(lister) - 1
#    while (low + 1) <= high:
    if lister[low] > b:
        return low
    elif lister[high] < b:
        return high + 1
    else:
        while lister[low + 1] < b:
            mid = (low + high) // 2
            if (b <= lister[mid]):
                high = mid
            else:
                low = mid
        ans = low + 1

    return ans

def snukefestival(n , a , b , c):

    ans = 0
    a.sort()
    b.sort()
    c.sort()

    for i in range(n):
        ans += nibunlow(a , b[i]) * nibunhigh(c , b[i])

    return ans

def main():
    n = int(input())
    a = list(map(int, input().split()))
    b = list(map(int, input().split()))
    c = list(map(int , input().split()))
    print(snukefestival(n , a , b , c))

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

Fixed submission:
def newrating(r , g):

    return (g - r) + g

def main():
    r = int(input())
    g = int(input())
    print(newrating(r , g))

if __name__ == '__main__':
    main()

Buggy submission (verdict: Runtime Error):
def newrating(r , g):

    return (r + g) / 2

def main():
    r , g = map(int , input().split())
    print(newrating(r , g))

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

Fixed submission:
def writeanderase(n , a):

    ans = {}
    count = 0

    for i in range(n):
        if a[i] in ans:
            ans[a[i]] += 1
        else:
            ans[a[i]] = 1

    for i in ans.values():
        count += i % 2

    return count

def main():
    n = int(input())
    a = [int(input()) for i in range(n)]
    print(writeanderase(n , a))

if __name__ == '__main__':
    main()

Buggy submission (verdict: Runtime Error):
def writeanderase(n , a):

    ans = {}

    for i in range(n):
        if a[i] in ans:
            ans[a[i]] += 1
        else:
            ans[a[i]] = 1

    for i in ans.values():
        count += i % 2

    return count

def main():
    n = int(input())
    a = [int(input()) for i in range(n)]
    print(writeanderase(n , a))

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

Fixed submission:
def together(n , a):

    listans = [0]*(10**5+2)

    for i in range(n):
        listans[a[i] - 1] += 1
        listans[a[i]] += 1
        listans[a[i] + 1] += 1

    return max(listans)


def main():
    n = int(input())
    a = list(map(int,input().split()))
    print(together(n , a))

if __name__ == '__main__':
    main()

Buggy submission (verdict: Runtime Error):
def together(n , a):

    listans = [0]*(10**5)

    for i in range(n):
        listans[a[i] - 1] += 1
        listans[a[i]] += 1
        listans[a[i] + 1] += 1

    return max(listans)


def main():
    n = int(input())
    a = list(map(int,input().split()))
    print(together(n , a))

if __name__ == '__main__':
    main()