Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Runtime Error):
x, n = [int(i) for i in input().split()]
p = [int(i) for i in input().split()]
if n == 0:
    ans = x
else:
    p = sorted(p)
    min_p = min(p)
    max_p = max(p)
    j = 0
    ans = 0
    if x < min_p:
        ans = x
    elif x > max_p:
        ans = x
    elif x == min_p:
        if min_p+1 == p[1]:
            ans = min_p-1
        else:
            ans = min_p+1
    elif x == max_p:
        if max_p-1 == p[len(p)-2]:
            ans = max_p+1
        else:
            ans = max_p-1
    else:
        for i in range(min_p+1, max_p):
            if i == p[j+1]:
                j += 1
            else:
                if abs(ans-x) > abs(i-x):
                    ans = i
print(ans)

Fixed submission:
x, n = [int(i) for i in input().split()]
p = [int(i) for i in input().split()]
if n == 0:
    ans = x
else:
    p = sorted(p)
    min_p = min(p)
    max_p = max(p)
    j = 0
    ans = 0
    if x < min_p:
        ans = x
    elif x > max_p:
        ans = x
    elif x == min_p:
        ans = min_p-1
    elif x == max_p:
        if max_p-1 == p[len(p)-2]:
            ans = max_p+1
        else:
            ans = max_p-1
    else:
        for i in range(min_p-1, max_p+1):
            if i == p[j]:
                j += 1
                if len(p) == j:
                    im_i = p[j-1] +1
                    if abs(ans-x) > abs(im_i-x):
                        ans = im_i
            else:
                if abs(ans-x) > abs(i-x):
                    ans = i
print(ans)

Buggy python submission (verdict: Runtime Error):
x, n = [int(i) for i in input().split()]
p = [int(i) for i in input().split()]
if n == 0:
    ans = x
else:
    p = sorted(p)
    min_p = min(p)
    max_p = max(p)
    j = 0
    ans = 0
    if x < min_p:
        ans = x
    elif x > max_p:
        ans = x
    elif x == min_p:
        if min_p+1 == p[1]:
            ans = min_p-1
        else:
            ans = min_p+1
    elif x == max_p:
        if max_p-1 == p[len(p)-1]:
            ans = max_p+1
        else:
            ans = max_p-1
    else:
        for i in range(min_p+1, max_p):
            if i == p[j+1]:
                j += 1
            else:
                if abs(ans-x) > abs(i-x):
                    ans = i
print(ans)

Fixed submission:
x, n = [int(i) for i in input().split()]
p = [int(i) for i in input().split()]
if n == 0:
    ans = x
else:
    p = sorted(p)
    min_p = min(p)
    max_p = max(p)
    j = 0
    ans = 0
    if x < min_p:
        ans = x
    elif x > max_p:
        ans = x
    elif x == min_p:
        ans = min_p-1
    elif x == max_p:
        if max_p-1 == p[len(p)-2]:
            ans = max_p+1
        else:
            ans = max_p-1
    else:
        for i in range(min_p-1, max_p+1):
            if i == p[j]:
                j += 1
                if len(p) == j:
                    im_i = p[j-1] +1
                    if abs(ans-x) > abs(im_i-x):
                        ans = im_i
            else:
                if abs(ans-x) > abs(i-x):
                    ans = i
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
a = int(input())
A = [int(i) for i in input().split()]
total = 1
for i in A:
    total *= i
if total > 10**18:
    total = -1
print(total)

Fixed submission:
a = int(input())
A = [int(i) for i in input().split()]
total = 1
for i in A:
    if total != -1:
        total *= i
        if total > 10**18:
            total = -1
    else:
        if i==0:
            total = 0
            break
print(total)

Buggy python submission (verdict: Runtime Error):
a = int(input())
A = [int(i) for i in input().split()]
total = 1
for i in A:
    total *= i
if total > 10**18:
    total = -1
print(total)

Fixed submission:
a = int(input())
A = [int(i) for i in input().split()]
total = 1
for i in A:
    if total != -1:
        total *= i
        if total > 10**18:
            total = -1
    else:
        if i==0:
            total = 0
            break
print(total)

Buggy python submission (verdict: Time Limit Exceeded):
a = int(input())
A = [int(i) for i in input().split()]
total = 1
for i in A:
    total *= i
if total > 10**18:
    total = -1
print(total)

Fixed submission:
a = int(input())
A = [int(i) for i in input().split()]
total = 1
for i in A:
    if total != -1:
        total *= i
        if total > 10**18:
            total = -1
    else:
        if i==0:
            total = 0
            break
print(total)
Buggy python submission (verdict: Time Limit Exceeded):
from math import gcd

K = int(input())
total = 0
for a in range(1,K+1):
    for b in range(1,K+1):
        for c in range(1,K+1):
            d = gcd(a,b)
            total += gcd(d,c)
print(total)

Fixed submission:
import math
from functools import reduce

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

K = int(input())
total = 0
for a in range(K):
    for b in range(K):
        for c in range(K):
           total += gcd(a+1,b+1,c+1)
print(total)

Buggy python submission (verdict: Time Limit Exceeded):
from math import gcd

K = int(input())
total = 0
for a in range(K):
    for b in range(K):
        for c in range(K):
            total += gcd(gcd(a+1,b+1),c+1)
print(total)

Fixed submission:
import math
from functools import reduce

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

K = int(input())
total = 0
for a in range(K):
    for b in range(K):
        for c in range(K):
           total += gcd(a+1,b+1,c+1)
print(total)

Buggy python submission (verdict: Time Limit Exceeded):
from math import gcd

K = int(input())
total = 0
for a in range(K):
    for b in range(K):
        for c in range(K):
            d = gcd(a+1,b+1)
            total += gcd(d,c+1)
print(total)

Fixed submission:
import math
from functools import reduce

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

K = int(input())
total = 0
for a in range(K):
    for b in range(K):
        for c in range(K):
           total += gcd(a+1,b+1,c+1)
print(total)

Buggy python submission (verdict: Time Limit Exceeded):
import math
from functools import reduce

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

K = int(input())
total = 0
for a in range(K):
    for b in range(K):
        for c in range(K):
           total += gcd(a+1,b+1,c+1)
print(total)

Fixed submission:
import math
from functools import reduce

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

K = int(input())
total = 0
for a in range(K):
    for b in range(K):
        for c in range(K):
           total += gcd(a+1,b+1,c+1)
print(total)

Buggy python submission (verdict: Time Limit Exceeded):
import math
K = int(input())
total = 0
for a in range(K):
    for b in range(K):
        for c in range(K):
           d = math.gcd(a+1,b+1)
           total += math.gcd(d,c+1)
print(total)

Fixed submission:
import math
from functools import reduce

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

K = int(input())
total = 0
for a in range(K):
    for b in range(K):
        for c in range(K):
           total += gcd(a+1,b+1,c+1)
print(total)
Buggy python submission (verdict: Runtime Error):
a = input("半径")
print(a*a)

Fixed submission:
a = int(input())
a *= a
print(a)
Buggy python submission (verdict: Time Limit Exceeded):
a = int(input())
total = 0
for i in range(a):
    total += i
print(total)

Fixed submission:
a = int(input())
print(int(a*(a-1)//2))
Buggy python submission (verdict: Runtime Error):
H,W,M = map(int,input().split())
h = []
w = []

for i in range(M):
    tmp1,tmp2 = map(int,input().split())
    h.append(tmp1)
    w.append(tmp2)

dic1 = {}
dic2 = {}

for i in h:
    if i not in dic1:
        dic1[i] = 1
    else:
        dic1[i] +=1

val1 = max(dic1,key=dic1.get)
ans = 0
ans +=dic1[val1]
for j in range(M):
    if h[j] != val1:
        if w[j] not in dic2:
            dic2[w[j]] = 1
        else:
            dic2[w[j]] +=1

val2 = max(dic2,key=dic2.get)
ans +=dic2[val2]
print(ans)

Fixed submission:
H,W,M = map(int,input().split())
h = []
w = []

for i in range(M):
    tmp1,tmp2 = map(int,input().split())
    h.append(tmp1)
    w.append(tmp2)

dic1 = {}
dic2 = {}

for i in h:
    if i not in dic1:
        dic1[i] = 1
    else:
        dic1[i] +=1

val1 = max(dic1,key=dic1.get)
ans = 0
ans +=dic1[val1]
for j in range(M):
    if h[j] != val1:
        if w[j] not in dic2:
            dic2[w[j]] = 1
        else:
            dic2[w[j]] +=1
if dic2:
    val2 = max(dic2,key=dic2.get)
    ans +=dic2[val2]


dic1 = {}
dic2 = {}

for i in w:
    if i not in dic1:
        dic1[i] = 1
    else:
        dic1[i] +=1
val1 = max(dic1,key=dic1.get)
ans1 = 0
ans1 +=dic1[val1]
for j in range(M):
    if w[j] != val1:
        if h[j] not in dic2:
            dic2[h[j]] = 1
        else:
            dic2[h[j]] +=1
if dic2:
    val2 = max(dic2,key=dic2.get)
    ans1 +=dic2[val2]
print(max(ans,ans1))
Buggy python submission (verdict: Time Limit Exceeded):
k = int(input())
if k % 2 == 0:
    print(-1)
else:
    val = 0
    for i in range(10**6+1):
        val = val * 10 + 7
        if val % k == 0:
            print(i+1)
            break

Fixed submission:
k = int(input())
if k % 2 == 0:
    print(-1)
else:
    val = 0
    for i in range(10**6+1):
        val = (val * 10 + 7) % k
        if val % k == 0:
            print(i+1)
            break
        elif i == 10**6:
            print(-1)

Buggy python submission (verdict: Time Limit Exceeded):
k = int(input())
if k % 2 == 0:
    print(-1)
else:
    val = 0
    for i in range(10**6):
        val = val * 10 + 7
        if val % k == 0:
            print(i+1)
            break

Fixed submission:
k = int(input())
if k % 2 == 0:
    print(-1)
else:
    val = 0
    for i in range(10**6+1):
        val = (val * 10 + 7) % k
        if val % k == 0:
            print(i+1)
            break
        elif i == 10**6:
            print(-1)
Buggy python submission (verdict: Time Limit Exceeded):
import collections

n = int(input())
a = list(map(int,input().split()))
q = int(input())
b = []
c = []
for i in range(q):
    tmpb,tmpc = map(int,input().split())
    b.append(tmpb)
    c.append(tmpc)

dic = collections.Counter(a)
val = 0
for i in range(q):
    if b[i] in dic:
        if c[i] not in dic:
            dic[c[i]] = 0
        dic[c[i]] += dic[b[i]]
        dic[b[i]] = 0
    for key, value in dic.items():
        val +=key*value
    print(val)
    val=0

Fixed submission:
import collections

n = int(input())
a = list(map(int,input().split()))
q = int(input())
b = []
c = []
for i in range(q):
    tmpb,tmpc = map(int,input().split())
    b.append(tmpb)
    c.append(tmpc)

dic = collections.Counter(a)
val = 0
for key, value in dic.items():
    val +=key * value
for i in range(q):
    tmp = 0
    if b[i] in dic:
        if c[i] not in dic:
            dic[c[i]] = 0
        tmp = (c[i] - b[i]) * dic[b[i]]
        dic[c[i]] += dic[b[i]]
        dic[b[i]] = 0
        val = val + tmp
    print(val)

Buggy python submission (verdict: Time Limit Exceeded):
import collections

n = int(input())
a = list(map(int,input().split()))
q = int(input())
b = []
c = []
for i in range(q):
    tmpb,tmpc = map(int,input().split())
    b.append(tmpb)
    c.append(tmpc)

dic = collections.Counter(a)
val = 0
for i in range(q):
    if b[i] in dic:
        if c[i] not in dic:
            dic[c[i]] = 0
        dic[c[i]] += dic[b[i]]
        dic[b[i]] = 0
    for key, value in dic.items():
        val +=key*value
    print(val)
    val=0

Fixed submission:
import collections

n = int(input())
a = list(map(int,input().split()))
q = int(input())
b = []
c = []
for i in range(q):
    tmpb,tmpc = map(int,input().split())
    b.append(tmpb)
    c.append(tmpc)

dic = collections.Counter(a)
val = 0
for key, value in dic.items():
    val +=key * value
for i in range(q):
    tmp = 0
    if b[i] in dic:
        if c[i] not in dic:
            dic[c[i]] = 0
        tmp = (c[i] - b[i]) * dic[b[i]]
        dic[c[i]] += dic[b[i]]
        dic[b[i]] = 0
        val = val + tmp
    print(val)
Buggy python submission (verdict: Runtime Error):
x,n = map(int,input().split())
p = list(map(int,input().split()))

val = []
ans = []
if p:
    for i in range(1,101):
        if i not in p:
            val.append(abs(x-i))
    if x - min(val) not in p:
        ans.append(x - min(val))
    if x + min(val) not in p:
        ans.append(x + min(val))
    print(min(ans))

else:
    print(x)

Fixed submission:
x,n = map(int,input().split())
p = list(map(int,input().split()))

for i in range(200):
    ans1 = x - i
    ans2 = x + i
    if ans1 not in p:
        print(ans1)
        break
    if ans2 not in p:
        print(ans2)
        break
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
a = list(map(int,input().split()))
ans = 0
for i in range(n):
    for j in range(i+1,n):
        if j - i == a[j] + a[i]:
            ans +=1
print(ans)

Fixed submission:
n = int(input())
a = list(map(int,input().split()))
dic = {} # i + a[i]
ans = 0
for i in range(n):
    if i+a[i] in dic.keys():
        dic[i+a[i]] +=1
    else:
        dic[i+a[i]] = 1
for i in range(n):
    if i - a[i] in dic.keys():
        ans +=dic[i - a[i]]
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
s = input()

arr = []
amari = [0 for i in range(2019)]
amari[0] +=1
ans = 0
cnt = 0
keta = 1
for i in range(len(s)):
    cnt = (cnt + int(s[-(i+1)]) * keta) % 2019
    arr.append(cnt)
    keta *=10

for i in range(len(arr)):
    amari[arr[i]] +=1    
    
for i in amari:
    ans = ans + i * (i-1) // 2
print(ans)

Fixed submission:
s = input()

arr = []
amari = [0 for i in range(2019)]
amari[0] +=1
ans = 0
cnt = 0
keta = 1
for i in range(len(s)):
    cnt = (cnt + int(s[-(i+1)]) * keta) % 2019
    arr.append(cnt)
    keta =keta * 10 % 2019

for i in range(len(arr)):
    amari[arr[i]] +=1    
    
for i in amari:
    ans = ans + i * (i-1) // 2
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
s = input()

arr = []
amari = [0 for i in range(2019)]
amari[0] +=1
ans = 0
for i in range(len(s)):
    arr.append(int(s[-(i+1):])%2019)

for i in range(len(arr)):
    amari[arr[i]] +=1    
    
for i in amari:
    ans = ans + i * (i-1) // 2
print(ans)

Fixed submission:
s = input()

arr = []
amari = [0 for i in range(2019)]
amari[0] +=1
ans = 0
cnt = 0
keta = 1
for i in range(len(s)):
    cnt = (cnt + int(s[-(i+1)]) * keta) % 2019
    arr.append(cnt)
    keta =keta * 10 % 2019

for i in range(len(arr)):
    amari[arr[i]] +=1    
    
for i in amari:
    ans = ans + i * (i-1) // 2
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
s = input()

arr = []
amari = [0 for i in range(2019)]
amari[0] +=1
ans = 0
for i in range(len(s)):
    arr.append(int(s[-(i+1):])%2019)

for i in range(len(arr)):
    amari[arr[i]] +=1    
    
for i in amari:
    ans = ans + i * (i-1) // 2
print(ans)

Fixed submission:
s = input()

arr = []
amari = [0 for i in range(2019)]
amari[0] +=1
ans = 0
cnt = 0
keta = 1
for i in range(len(s)):
    cnt = (cnt + int(s[-(i+1)]) * keta) % 2019
    arr.append(cnt)
    keta =keta * 10 % 2019

for i in range(len(arr)):
    amari[arr[i]] +=1    
    
for i in amari:
    ans = ans + i * (i-1) // 2
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
s = input()

ans = 0

for i in range(len(s)):
    for j in range(i+1,len(s)):
        if int((s[i:j+1])) % 2019 == 0:
            ans +=1
            break
print(ans)

Fixed submission:
s = input()

arr = []
amari = [0 for i in range(2019)]
amari[0] +=1
ans = 0
cnt = 0
keta = 1
for i in range(len(s)):
    cnt = (cnt + int(s[-(i+1)]) * keta) % 2019
    arr.append(cnt)
    keta =keta * 10 % 2019

for i in range(len(arr)):
    amari[arr[i]] +=1    
    
for i in amari:
    ans = ans + i * (i-1) // 2
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
s = input()

ans = 0

for i in range(len(s)):
    for j in range(i+1,len(s)):
        if int((s[i:j+1])) % 2019 == 0:
            ans +=1
print(ans)

Fixed submission:
s = input()

arr = []
amari = [0 for i in range(2019)]
amari[0] +=1
ans = 0
cnt = 0
keta = 1
for i in range(len(s)):
    cnt = (cnt + int(s[-(i+1)]) * keta) % 2019
    arr.append(cnt)
    keta =keta * 10 % 2019

for i in range(len(arr)):
    amari[arr[i]] +=1    
    
for i in amari:
    ans = ans + i * (i-1) // 2
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
s = input()

r = []
g = []
b = []

val = 0

for i in range(n):
    if s[i] == "R":
        r.append(i+1)
    elif s[i] == "G":
        g.append(i+1)
    else:
        b.append(i+1)
for i in r:
    for j in g:
        for k in b:
            if j - i == k - j or k - j == i - k or i - k == j - i:
                val +=1
print(len(r) * len(g) * len(b) - val)

Fixed submission:
n = int(input())
s = input()
 
r = []
g = []
b = []
 
val = 0
 
for i in range(n):
    if s[i] == "R":
        r.append(i+1)
    elif s[i] == "G":
        g.append(i+1)
    else:
        b.append(i+1)

r = set(r)
g = set(g)
b = set(b)
for i in r:
    for j in g:
        if 2 * j - i in b:
            val +=1
for i in g:
    for j in b:
        if 2 * j - i in r:
            val +=1
for i in b:
    for j in r:
        if 2 * j - i in g:
            val +=1

print(len(r) * len(g) * len(b) - val)
Buggy python submission (verdict: Runtime Error):
n = int(input())
lunlun = [[1,2,3,4,5,6,7,8,9]]

for _ in range(2):
    tmp = []
    for i in lunlun[-1]:
        if i % 10 == 0 :
            tmp.append(10 * i + i % 10)
            tmp.append(10 * i + i % 10 + 1)
        elif i % 10 == 9:
            tmp.append(10 * i + i % 10 - 1)
            tmp.append(10 * i + i % 10)
        else:
            tmp.append(10 * i + i % 10 - 1)
            tmp.append(10 * i + i % 10)
            tmp.append(10 * i + i % 10 + 1)
    lunlun.append(tmp)
ans = []
for i in lunlun:
    for j in i:
        ans.append(j)
print(ans[n-1])

Fixed submission:
n = int(input())
lunlun = [[1,2,3,4,5,6,7,8,9]]

for _ in range(9):
    tmp = []
    for i in lunlun[-1]:
        if i % 10 == 0 :
            tmp.append(10 * i + i % 10)
            tmp.append(10 * i + i % 10 + 1)
        elif i % 10 == 9:
            tmp.append(10 * i + i % 10 - 1)
            tmp.append(10 * i + i % 10)
        else:
            tmp.append(10 * i + i % 10 - 1)
            tmp.append(10 * i + i % 10)
            tmp.append(10 * i + i % 10 + 1)
    lunlun.append(tmp)
ans = []
for i in lunlun:
    for j in i:
        ans.append(j)
print(ans[n-1])
Buggy python submission (verdict: Runtime Error):
n = int(input())
a = list(map(int,input().split()))
dic = {}
for i in a:
    s.add(i)
    if i in dic:
        dic[i] +=1
    else:
        dic[i] = 1

ans = 0
for i in dic.values():
    ans += i * (i - 1) // 2

for i in a:
    sa = dic[i] * (dic[i] - 1) // 2 - ((dic[i] - 1) * (dic[i] - 2) // 2)
    print(ans - sa)

Fixed submission:
n = int(input())
a = list(map(int,input().split()))
dic = {}
for i in a:
    if i in dic:
        dic[i] +=1
    else:
        dic[i] = 1

ans = 0
for i in dic.values():
    ans += i * (i - 1) // 2

for i in a:
    sa = dic[i] * (dic[i] - 1) // 2 - ((dic[i] - 1) * (dic[i] - 2) // 2)
    print(ans - sa)
Buggy python submission (verdict: Runtime Error):
import math
n = int(input())
a = list(map(int,input().split()))

def lcm(x,y):
    return (x * y) // math.gcd(x, y)

val = a[0]
for i in range(1,n):
    val = lcm(val,a[i])

ans = 0
for i in range(n):
    ans += val // a[i]
print(ans % (10**9+7))

Fixed submission:
import fractions
n = int(input())
a = list(map(int,input().split()))

def lcm(x,y):
    return (x * y) // fractions.gcd(x, y)

val = a[0]
for i in range(1,n):
    val = lcm(val,a[i])

ans = 0
for i in range(n):
    ans += val // a[i]
print(ans % (10**9+7))
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
a = list(map(int,input().split()))
wa = []
wa2 = []
for i in range(n):
    wa.append(sum(a[0:i+1]))
    wa2.append(sum(a[-1:-(i+2):-1]))
 
ans = 10**10
for i in range(n-1):
    if ans > abs(wa[i] - wa2[-(i+2)]):
        ans = abs(wa[i] - wa2[-(i+2)])
print(ans)

Fixed submission:
n = int(input())
a = list(map(int,input().split()))
wa = []
wa2 = []
#for i in range(n):
#    wa.append(sum(a[0:i+1]))
#    wa2.append(sum(a[-1:-(i+2):-1]))
s = 0
s1 = 0
for i in range(n):
    s +=a[i]
    wa.append(s)
    s1 +=a[-(i+1)]
    wa2.append(s1)

ans = 10**10
for i in range(n-1):
    if ans > abs(wa[i] - wa2[-(i+2)]):
        ans = abs(wa[i] - wa2[-(i+2)])
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
a = list(map(int,input().split()))
wa = []
wa2 = []
for i in range(n):
    wa.append(sum(a[0:i+1]))
    wa2.append(sum(a[-1:-(i+2):-1]))

ans = 10**10
for i in range(n-1):
    if ans > abs(wa[i] - wa2[-(i+2)]):
        ans = abs(wa[i] - wa2[-(i+2)])
print(ans)

Fixed submission:
n = int(input())
a = list(map(int,input().split()))
wa = []
wa2 = []
#for i in range(n):
#    wa.append(sum(a[0:i+1]))
#    wa2.append(sum(a[-1:-(i+2):-1]))
s = 0
s1 = 0
for i in range(n):
    s +=a[i]
    wa.append(s)
    s1 +=a[-(i+1)]
    wa2.append(s1)

ans = 10**10
for i in range(n-1):
    if ans > abs(wa[i] - wa2[-(i+2)]):
        ans = abs(wa[i] - wa2[-(i+2)])
print(ans)
Buggy python submission (verdict: Runtime Error):
n = int(input())
s = []
for i in range(n):
    s.append(input())
    
dic = dict()
ans = 0
for i in s:
    if "".join(sorted(i)) in dic:
        ans += dic[i]
        dic["".join(sorted(i))] +=1
        print(dic)
    else:
        dic["".join(sorted(i))] = 1
print(ans)

Fixed submission:
n = int(input())
s = []
for i in range(n):
    s.append(input())
    
dic = dict()
ans = 0
for i in s:
    if "".join(sorted(i)) in dic:
        ans += dic["".join(sorted(i))]
        dic["".join(sorted(i))] +=1
    else:
        dic["".join(sorted(i))] = 1
print(ans)

Buggy python submission (verdict: Runtime Error):
n = int(input())
s = []
for i in range(n):
    s.append(input())
    
dic = dict()
ans = 0
for i in s:
    if "".join(sorted(i)) in dic:
        ans += dic[i]
        dic[i] +=1
    else:
        dic["".join(sorted(i))] = 1
print(ans)

Fixed submission:
n = int(input())
s = []
for i in range(n):
    s.append(input())
    
dic = dict()
ans = 0
for i in s:
    if "".join(sorted(i)) in dic:
        ans += dic["".join(sorted(i))]
        dic["".join(sorted(i))] +=1
    else:
        dic["".join(sorted(i))] = 1
print(ans)

Buggy python submission (verdict: Runtime Error):
n = int(input())
s = []
for i in range(n):
    s.append(input())
    
dic = dict()
ans = 0
for i in s:
    if "".join(sorted(i)) in dic.keys():
        ans += dic[i].values()
        dic[i] +=1
    else:
        dic[i] = 1
print(ans)

Fixed submission:
n = int(input())
s = []
for i in range(n):
    s.append(input())
    
dic = dict()
ans = 0
for i in s:
    if "".join(sorted(i)) in dic:
        ans += dic["".join(sorted(i))]
        dic["".join(sorted(i))] +=1
    else:
        dic["".join(sorted(i))] = 1
print(ans)

Buggy python submission (verdict: Runtime Error):
n = int(input())
s = []
for i in range(n):
    s.append(input())
    
dic = dict()
ans = 0
for i in s:
    if "".join(sorted(i)) in dic:
        ans += dic[i]
        dic[i] +=1
    else:
        dic[i] = 1
print(ans)

Fixed submission:
n = int(input())
s = []
for i in range(n):
    s.append(input())
    
dic = dict()
ans = 0
for i in s:
    if "".join(sorted(i)) in dic:
        ans += dic["".join(sorted(i))]
        dic["".join(sorted(i))] +=1
    else:
        dic["".join(sorted(i))] = 1
print(ans)
Buggy python submission (verdict: Runtime Error):
n = int(input())
ans = 0
for i in range(1, n+1):
    if (i // 10 + 1) % 2 == 1:
        ans +=1
print(ans

Fixed submission:
n = int(input())
ans = 0
for i in range(1, n+1):
    if (len(str(i))) % 2 == 1:
        ans +=1
print(ans)
Buggy python submission (verdict: Runtime Error):
s = input()
s = s + "*"
ans = "Good"
for i in range(len(s)):
    if s[i] == s[i+1]:
        ans = "Bad"
        break
print(ans)

Fixed submission:
s = input()
s = s + "*"
ans = "Good"
for i in range(len(s)-1):
    if s[i] == s[i+1]:
        ans = "Bad"
        break
print(ans)