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

Fixed submission:
def main(text=""):
    n = int(input())
    a = [input() for i in range(n)]
    #a = text.split("\n")[1:]
    num = 0
    for i in range(len(a)):
        a[i] = "".join(sorted(a[i]))
    a.sort()
    i = 0
    while i < len(a):
        e = a[i]
        j = 1
        while i+j < len(a) and e == a[i+j]:
            j = j + 1
        if j != 1:
            num = num + combination(j)
            i = i+j
        else:
            i = i+1
    print(num)


def combination(x):
    return int(x*(x-1)/2)


main()

Buggy submission (verdict: Runtime Error):
def main(text):
    n = int(input())
    a = [input() for i in range(n)]
    #a = text.split("\n")[1:]
    num = 0
    for i in range(len(a)):
        a[i] = "".join(sorted(a[i]))
    a.sort()
    i = 0
    while i < len(a):
        e = a[i]
        j = 1
        while i+j < len(a) and e == a[i+j]:
            j = j + 1
        if j != 1:
            num = num + combination(j)
            i = i+j
        else:
            i = i+1
    print(num)


def combination(x):
    return int(x*(x-1)/2)


main()
Problem p02952 (python)

Fixed submission:
N = int(input())
 
i=1
x = 0
 
while True:
  m = 10 ** i - 1
  if N <= m:
    x += max((N - (10 ** (i-1) - 1)), 0)
    break
  x += (m - (10 ** (i-1) - 1))
  i += 2
print(x)

Buggy submission (verdict: Runtime Error):
N = int(input())
 
i=1
x = 0
 
while True:
    m = 10 ** i - 1
    if N <= m:
      x += (N - (10 ** (i-1) - 1))
      break
	x += m
    i += 1
print(x)

Buggy submission (verdict: Runtime Error):
N = int(input())

i=1
x = 0

while True:
    m = 10 ** i - 1
    if N <= m:
      x += (N - (10 ** (i-1) - 1))
      break
	x += m
print(x)
Problem p02953 (python)

Fixed submission:
N = int(input())
H = list(map(int, input().split()))

i = N - 1
while i > 0:
  if H[i-1] > H[i] + 1:
    print('No')
    break
  if H[i-1] == H[i] + 1:
    H[i-1] -= 1
  i -= 1
if i==0:
  print('Yes')

Buggy submission (verdict: Runtime Error):
N = int(input())
H = map(int, input().split())

i = N
while i > 0:
  if H[i-1] > H[i] + 1:
    print('No')
    break
  if H[i-1] == H[i] + 1:
    H[i-1] -= 1
  i -= 1
print('Yes')
Problem p02994 (python)

Fixed submission:
n, l = map(int, input().split())
 
res = n * (l-1) + n * (n+1) / 2
if (0 >= l) and (1-l <= n):
  pass
elif 1-l > n:
  res -= (l+n-1)
else:
  res -= l
print(int(res))

Buggy submission (verdict: Runtime Error):
n, l = map(int, input())

res = n * (l-1) + n * (n+1) / 2
if 1-l >= 1 and 1-l <= n:
  pass
elif 1-l > n:
  res -= (l+n-1)
else:
  res -= l
print(res)
Problem p03155 (python)

Fixed submission:
n = int(input())
h = int(input())
w = int(input())
 
ans = (n-h+1) * (n-w+1)
print(ans)

Buggy submission (verdict: Runtime Error):
n = input()
h = input()
w = input()

ans = (n-h+1) * (n-w+1)
print(ans)
Problem p02995 (python)

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

a, b, c, d = [int(x) for x in input().split()]
e = lcm(c, d)

ac = (a-1) // c
ad = (a-1) // d
ae = (a-1) // e
bc = b // c
bd = b // d
be = b // e
print((b-a+1) - ((bc + bd - be) - (ac + ad - ae)))

Buggy submission (verdict: Runtime Error):
import math
def lcm(x, y):
    return (x * y) // math.gcd(x, y)

a, b, c, d = [int(x) for x in input().split()]
e = lcm(c, d)

ac = (a-1) // c
ad = (a-1) // d
ae = (a-1) // e
bc = b // c
bd = b // d
be = b // e
print((b-a+1) - ((bc + bd - be) - (ac + ad - ae)))
Problem p03000 (python)

Fixed submission:
n, x = map(int, input().split())
l = [int(x) for x in input().split()]

c = 1
d = 0
for i in range(n):
    d = d + l[i]
    if d > x:
        break
    c += 1
print(c)

Buggy submission (verdict: Runtime Error):
n, x = map(int, input().split())
l = [int(x) for x in input().split()]

c = 1
d = 0
for i in range(n+1):
    d = d + l[i]
    if d > x:
        break
    c += 1
print(c)
Problem p02945 (python)

Fixed submission:
a, b = input().split()
a = int(a)
b = int(b)
print(max(max(a+b, a-b), a*b))

Buggy submission (verdict: Runtime Error):
a=input()
b=input()

print(max(max(a+b,a-b),a*b))
Problem p02945 (python)

Fixed submission:
#coding utf-8

a,b = map(int, input().split())
# d = list(map(int,input().split()))

x = [a*b, a+b, a-b]

print(max(x))

Buggy submission (verdict: Runtime Error):
#coding utf-8

a,b = map(float, input().split())
# d = list(map(int,input().split()))

x = [a*b, a/b, a+b, a-b]

print(max(x))

Buggy submission (verdict: Runtime Error):
#coding utf-8

a,b = map(int, input().split())
# d = list(map(int,input().split()))

x = [a*b, a/b, a+b, a-b]

print(max(x))

Buggy submission (verdict: Runtime Error):
#coding utf-8

a,b = map(int, input().split())
# d = list(map(int,input().split()))

x = []

x.append(a*b)
x.append(a/b)
x.append(a+b)
x.append(a-b)

print(max(x))
Problem p03109 (python)

Fixed submission:
#coding:utf-8

a = list(map(int,input().split("/")))   

if a[0]==2019 and a[1]>4:
  print("TBD")
elif a[0]>2019:
  print("TBD")
else:
  print("Heisei")

Buggy submission (verdict: Runtime Error):
#coding:utf-8

a = list(map(int,input().split("/")))   

if a[0]=2019 and a[1]>=4:
  print("TBD")
elif a[0]<2019:
  print("TBD")
else:
  print("Heisei")
Problem p03129 (python)

Fixed submission:
#coding:utf-8

n,k = map(int,input().split())

if n+1 >= 2*k:
	print('YES')
else:
	print('NO')

Buggy submission (verdict: Runtime Error):
#coding:utf-8

n,k = map(int,input().split())

if n > k:
  print(‘YES’)
else:
  print(‘NO’)
Problem p03155 (python)

Fixed submission:
#coding:utf-8
n = input()
h = input()
w = input()

print((int(n)-int(h)+1)*(int(n)-int(w)+1))

Buggy submission (verdict: Runtime Error):
#coding:utf-8
n = input()
a,b = map(int,input().split())
p = list(map(int,input().split()))

first=0
second=0
third=0

for i in p:
  if i <= a:
    first +=1
  elif i <= b:
    second +=1
  else:
    third +=1

print(min([first,second,third]))

Buggy submission (verdict: Runtime Error):
#coding:utf-8
n = input()
h = input()
w = input()

print((n-h+1)*(n-w+1))

Buggy submission (verdict: Runtime Error):
#codibg:utf-8
n = input()
h = input()
w = input()

print((n-h+1)*(n-w+1))
Problem p02953 (python)

Fixed submission:
n = int(input())
stairs = [int(x) for x in input(). split()]
 
minHeight = max(stairs[0] - 1, 0)
result = True

for i in stairs:
    if i < minHeight:
        result = False
        break
    else:
        if i > minHeight:
    	    minHeight = i - 1
 
if result:
    print("Yes")
else:
    print("No")

Buggy submission (verdict: Runtime Error):
n = int(input())
stairs = [int(x) for x in input().split()]

minHeight = max(stairs[0] - 1, 0)

for i in stairs:
    if i < minHeight:
        result = False
        break
    else:
        if i > minHeight:
    	    minHeight = i - 1

if result:
    print("Yes")
else:
    print("No")
Problem p02969 (python)

Fixed submission:
r=int(input())
print(str(3*r**2))

Buggy submission (verdict: Runtime Error):

print(str(3r**2))
Problem p02981 (python)

Fixed submission:
N,a,b=map(int,input().split())
print(min(N*a,b))

Buggy submission (verdict: Runtime Error):
l,r=map(int,input().split())
if(r-l>=2018):
  print(0)
else:
  mi=2018
  res1=l%2019
  for i in range(r-l):
    res2=(i+l+1)%2019
    for j in range(r-l-i):
      if (res1*res2)%2019<mi:
        mi=(res1*res2)%2019
      res2+=1
    res1+=1
  print(mi)
Problem p02999 (python)

Fixed submission:
lis=input().split(' ')
x=int(lis[0])
a=int(lis[1])
if x<a:
  print(0)
else:
  print(10)

Buggy submission (verdict: Runtime Error):
inp=input().split(' ')
L=input().split(' ')
n=int(inp[0])
l=0;
count=1;
for i in range(n):
  l+=int(L[i])
  if l<=int(inp[1]):
    count+=1
  else:
    print(count)
if count==n+1:
  print(n+1)

Buggy submission (verdict: Runtime Error):
inp=input().split(' ')
L=input().split(' ')
n=int(inp[0])
l=0;
count=1;
for i in range(n):
  l+=int(L[i])
  if l<=int(inp[1]):
    count+=1;
  else:
    print(count)
if count==n+1:
  print(n+1)
Problem p03001 (python)

Fixed submission:
inp=list(map(int,input().split()))
if 2*inp[2]==inp[0] and 2*inp[3]==inp[1]:
  ans=1;
else:
  ans=0;
print('%.6f %d'%(inp[0]*inp[1]*0.5,ans))

Buggy submission (verdict: Runtime Error):
inp=list(map(int,input().split()))
if 2*inp[2]==inp[0] and 2*inp[3]==inp[1]:
  ans=1;
else:
  ans=0;
print('%d %d'%(inp[0]*inp[1]*0.5,ans))
inp=list(map(int,input().split()))
if 2*inp[2]==inp[0] and 2*inp[3]==inp[1]:
  ans=1;
else:
  ans=0;
print('%.6f %d'%(inp[0]*inp[1]*0.5,ans))
提出情報

Buggy submission (verdict: Runtime Error):
inp=list(map(int,input().split()))
if 2*inp[2]==inp[0] and 2*inp[3]==inp[1]:
  ans=0;
else:
  ans=1;
printf('%d %d'%(inp[0]*inp[1]*0.5,ans))
Problem p02947 (python)

Fixed submission:
n =int(input())
A=[]
for I in range(n):
  moji=list(input())
  moji.sort()
  moji=''.join(moji)
  A.append(moji)
A.sort()
N=0
SUM=0
i=0
while True:
  if i==n-1:
    SUM=SUM+int(0.5*N*(N+1))
    break
  a=A[i]
  for s in range(i+1,n,1):
    b=A[s]
    if a==b:
      N+=1
      i+=1
    else:
      SUM=SUM+int(0.5*N*(N+1))
      N=0
      i=s
      break
print(SUM)

Buggy submission (verdict: Runtime Error):
A=[]
for I in range(n):
  moji=list(input())
  moji.sort()
  moji=''.join(moji)
  A.append(moji)
A.sort()
print(A)
N=0
for i in range(n):
  a=A[i]
  for s in range(i+1,n):
    b=A[s]
    if a==b:
      N+=1
print(N)
Problem p02971 (python)

Fixed submission:
n = int(input())
no1 = -1
no1_i = -1
no2 = -2
no2_i = -1
S = []
for _ in range(n):
    S.append(int(input()))
 
for i in range(n):
  if S[i] > no1:
    no1_i =i
    no1 = S[i]
  elif S[i] > no2:
    no2_i = i
    no2 = S[i]
      
for i in range(n):
  if no1_i == i:
    print(no2)
  else:
    print(no1)

Buggy submission (verdict: Runtime Error):
n = int(input())
no1 = -1
no1_i = -1
no2 = -2
no2_i = -1
S = []
for _ in range(n):
    S.append(int(input()))

for i in range(n):
  	if s[i] > no1:
    	no1_i = i
    	no1 = s[i]
    elif s[i] > no2:
    	no2_i = i
    	no2 = s[i]
      
for i in range(n):
 	if no1_i == i:
    	print(no2)
    else:
    	print(no1)
Problem p03059 (python)

Fixed submission:
A, B, T = map(int, input().split())
tmp = (T+0.5) / A
print(int(tmp)*B)

Buggy submission (verdict: Runtime Error):
def make_divisors(n):
	divisors = []
	for i in range(1, int(n**0.5)+1):
		if n % i == 0:
			divisors.append(i)
			if i != n // i:
				divisors.append(n//i)
	divisors.sort(reverse=True)
	return divisors

n = int(input())
a = list(map(int,input().split()))
a.append(0)
a.append(0)
a.sort(reverse=True)
ans1 = 0
ans2 = 0
ans3 = 0

result = make_divisors(a[0] - a[2])
for i in range(len(result)):
	next = 0
	for j in range(n):
		if((j != 1) & (a[j] % result[i] != 0)):
			next = 1
			break
	if(next == 0):
		ans1 = result[i]
		break

result = make_divisors(a[0] - a[1])
for i in range(len(result)):
	next = 0
	for j in range(n):
		if((j != 2) & (a[j] % result[i] != 0)):
			next = 1
			break
	if(next == 0):
		ans2 = result[i]
		break

result = make_divisors(a[1] - a[2])
for i in range(len(result)):
	next = 0
	for j in range(n):
		if((j != 0) & (a[j] % result[i] != 0)):
			next = 1
			break
	if(next == 0):
		ans3 = result[i]
		break
max = ans1
if(ans2 > max):
	max = ans2
if(ans3 > max):
	max = ans3
print(max)

Buggy submission (verdict: Runtime Error):
def make_divisors(n):
	divisors = []
	for i in range(1, int(n**0.5)+1):
		if n % i == 0:
			divisors.append(i)
			if i != n // i:
				divisors.append(n//i)
	divisors.sort(reverse=True)
	return divisors

n = int(input())
a = list(map(int,input().split()))
a.append(0)
a.append(0)
a.sort(reverse=True)
ans1 = 0
ans2 = 0
ans3 = 0

result = make_divisors(a[0] - a[2])
for i in range(len(result)):
	next = 0
	for j in range(n):
		if((j != 1) & (a[j] % result[i] != 0)):
			next = 1
			break
	if(next == 0):
		ans1 = result[i]
		break

result = make_divisors(a[0] - a[1])
for i in range(len(result)):
	next = 0
	for j in range(n):
		if((j != 2) & (a[j] % result[i] != 0)):
			next = 1
			break
	if(next == 0):
		ans2 = result[i]
		break

result = make_divisors(a[1] - a[2])
for i in range(len(result)):
	next = 0
	for j in range(n):
		if((j != 0) & (a[j] % result[i] != 0)):
			next = 1
			break
	if(next == 0):
		ans3 = result[i]
		break
max = ans1
if(ans2 > max):
	max = ans2
if(ans3 > max):
	max = ans3
print(max)
Problem p03244 (python)

Fixed submission:
import collections

n=int(input())
v = input().split()

v1 = v[0::2]
v2 = v[1::2]

c1 = collections.Counter(v1)
c2 = collections.Counter(v2)
if(c1.most_common()[0][0] != c2.most_common()[0][0]):
	print(n - c1.most_common()[0][1] - c2.most_common()[0][1])
else:
	if(c1.most_common()[0][1] == n/2):
		count1 = c2.most_common()[0][1]
	else:
		count1 = c1.most_common()[1][1] + c2.most_common()[0][1]

	if(c2.most_common()[0][1] == n/2):
		count2 = c1.most_common()[0][1]
	else:
		count2 = c1.most_common()[0][1] + c2.most_common()[1][1]

	if(count1 < count2):
		print(n - count2)
	else:
		print(n - count1)

Buggy submission (verdict: Runtime Error):
import collections

n=int(input())
v = input().split()

v1 = v[0::2]
v2 = v[1::2]

c1 = collections.Counter(v1)
c2 = collections.Counter(v2)
if(c1.most_common()[0][0] != c2.most_common()[0][0]):
	print(n - c1.most_common()[0][1] - c2.most_common()[0][1])
else:
	if(c1.most_common()[0][1] == n/2):
		count1 = c2.most_common()[0][1]
	else:
		count1 = c1.most_common()[1][1] + c2.most_common()[0][1]

	if(c2.most_common()[0][1] == n/2):
		count2 = c1.most_common()[0][1]
	else:
		count2 = c1.most_common()[0][1] + c2.most_common()[1][1]

	if(count1 < cont2):
		print(n - count2)
	else:
		print(n - count1)
Problem p03296 (python)

Fixed submission:
N = input()
data = input().split()
bef = -1
count = 0
result = 0

for i in range(len(data)):
	t = int(data[i])
	if bef != t:
		if count > 1:
			result += int(count / 2)
		count = 1
		bef = t
	else:
		count += 1

if count > 1:
	result += int(count / 2)
print(result)

Buggy submission (verdict: Runtime Error):
N = input()
data = int(input().split())
bef = -1
count = 0
result = 0

for i in range(len(data)):
	if bef != data[i]:
		if count > 1:
			result += int(count) / 2
		count = 1
		bef = data[i]
	else:
		count++

print(result)

Buggy submission (verdict: Runtime Error):
N = input()
data = input().split()
bef = -1
count = 0
result = 0

for i in range(len(data)):
	if bef != data[i]:
		if count > 1:
			result += int(count) / 2
		count = 1
		bef = data[i]
	else:
		count++

print(result)

Buggy submission (verdict: Runtime Error):
N = input()
data = input().split()
bef = -1
count = 0
result = 0
for i in data:
	if bef != data[i]:
		if count > 1:
			result += int(count) / 2
		count = 1
		bef = data[i]
	else:
		count++
print(result)
Problem p02947 (python)

Fixed submission:
N = int(input())
S = [input() for i in range(N)]
d = {}
S_trans = [''.join(sorted(list(s))) for s in S]
count = 0
for s in S_trans:
  if s in d:
    count += d[s]
    d[s] += 1
  else:
    d[s] = 1
print(count)

Buggy submission (verdict: Runtime Error):
N = int(input())
S = [input() for i in range(N)]
from collections import defaultdict
encodes = [hash(tuple(sorted(list(s)))) for s in S]
hash_table = defaultdict(int)
for encode in encodes:
  hash_table[encode] += 1
import math
c_list = [int(math.factorial(v)/math.factorial(2)) for v in hash_table.values()]
count = sum(c_list)
print(count)

Buggy submission (verdict: Runtime Error):
N = int(input())
S = [input() for i in range(N)]
 
from collections import defaultdict
def decode(s):
  d = defaultdict(int)
  for c in sorted(list(s)):
    d[c] += 1
  return d
 
decodes = [decode(s) for s in S]
 
hash_table = defaultdict(int)
for decode in decodes:
  hash_table[tuple(decode.items())] += 1
#print(hash_table)
import math
c_list = [int(math.factorial(v)/math.factorial(2)) for v in hash_table.values()]
#print(c_list)
count = sum(c_list)
 
print(count)

Buggy submission (verdict: Runtime Error):
N = int(input())
S = [input() for i in range(N)]
 
from collections import defaultdict
def decode(s):
  d = defaultdict(int)
  for c in list(sorted(s)):
    d[c] += 1
  return d
 
decodes = [decode(s) for s in S]
 
hash_table = defaultdict(int)
for decode in decodes:
  hash_table[tuple(decode.items())] += 1
#print(hash_table)
import math
c_list = [int(math.factorial(v)/math.factorial(2)) for v in hash_table.values()]
#print(c_list)
count = sum(c_list)
 
print(count)

Buggy submission (verdict: Runtime Error):
N = int(input())
S = [input() for i in range(N)]

from collections import defaultdict
def decode(s):
  d = defaultdict(int)
  for c in list(sorted(s)):
    d[c] += 1
  return d

decodes = [decode(s) for s in S]

hash_table = defaultdict(int)
for decode in decodes:
  hash_table[tuple(decode.items())] += 1
print(hash_table)
import math
c_list = [int(math.factorial(v)/math.factorial(2)) for v in hash_table.values()]
#print(c_list)
count = sum(c_list)

print(count)
Problem p02952 (python)

Fixed submission:
N = int(input())
def count(start, end):
  return end - start + 1
keta = 1
while True:
  if 10**keta > N:
    break
  else:
    keta += 1
num = 0
for k in range(1, keta+1):
  if k % 2 == 1:
    num += count(10**(k-1), min(N, 10**k-1))
print(num)

Buggy submission (verdict: Runtime Error):
N = int(input())

def count(start, end):
  return end - start + 1

keta = 1
while True:
  if 10**keta > N:
    break
  else:
  	keta += 1

num = 0
for k in range(1, keta+1):
  if k % 2 == 1:
	num += count(10**(k-1), min(N, 10**k)-1)
    
print(num)
Problem p02953 (python)

Fixed submission:
N = int(input())
H = list(map(int, input().split()))
lenH = len(H)
if lenH <= 1:
  print('Yes')
  exit()
for i in range(lenH-1):
  h_2 = H[lenH-i-1]
  h_1 = H[lenH-i-2]
  if h_2 < h_1:
    if h_1 - h_2 > 1:
      print('No')
      exit()
    else:
      H[lenH-i-2] -= 1
print('Yes')

Buggy submission (verdict: Runtime Error):
N = int(input())
H = list(map(int, input().split()))
lenH = len(H)
for i in range(lenH-1):
  h_2 = H[lenH-i]
  h_1 = H[lenH-i-1]
  if h_2 < h_1:
    if h_1 - h_2 > 1:
      print('No')
      break
    else:
	  H[lenH-i-1] -= 1
print('Yes')
Problem p02981 (python)

Fixed submission:
N,A,B=map(int,input().split())
print(min(N*A,B))

Buggy submission (verdict: Runtime Error):
L,R=map(int,input().split())

keep=L*R
for i in range(L,R+1):
  for j in range(i+1,R+1):
    mod=(i*j) % 2019
    if mod<keep:
      keep=mod
      j=j+2019
print(keep)
Problem p03472 (python)

Fixed submission:
from operator import itemgetter

N, H = map(int, raw_input().split())
attackCount = 0

swords = []
for _ in xrange(N):
    swords.append(map(int, raw_input().split()))
swords.sort(key=itemgetter(0), reverse=True)
niceWeapon = swords[0]

subWeapons = [x for x in swords if x[1] > niceWeapon[0]]
subWeapons.sort(key=itemgetter(1), reverse=True)

practicalHP = H

while practicalHP > 0 and subWeapons:
    throwWeapon = subWeapons.pop(0)
    attackCount += 1
    practicalHP -= throwWeapon[1]

if practicalHP > 0:
    attackCount += (practicalHP / niceWeapon[0])
    if practicalHP % niceWeapon[0]:
        attackCount += 1

print attackCount

Buggy submission (verdict: Runtime Error):
 itemgetter

attackCount = 0

N, H = map(int, raw_input().split())
swords = []

for _ in xrange(N):
    swords.append(map(int, raw_input().split()))


swords.sort(key=itemgetter(0), reverse=True)
niceWeapon = swords.pop(0)

subWeapons = [x for x in swords if x[1] > niceWeapon[0]]
subWeapons.sort(key=itemgetter(1), reverse=True)

practicalHP = H
niceWeaponExist = True
if subWeapons and niceWeapon[1] < subWeapons[0][1]:
    practicalHP = H - niceWeapon[1]
    attackCount += 1
    niceWeaponExist = False

if practicalHP <1:
    print attackCount
else:
    while practicalHP > 0 and subWeapons:
        if niceWeaponExist and niceWeapon[1] > subWeapons[0][1]:
            attackCount += 1
            practicalHP -= niceWeapon[1]
            niceWeaponExist = False
        else:
            throwWeapon = subWeapons.pop(0)
            attackCount += 1
            practicalHP -= throwWeapon[1]

    if practicalHP > 0:
        if niceWeaponExist:
            attackCount += 1
            practicalHP -= niceWeapon[1]
            niceWeaponExist = False
    if practicalHP > 0:
        attackCount += (practicalHP / niceWeapon[0])
        if practicalHP % niceWeapon[0]:
            attackCount += 1

    print attackCount
Problem p02947 (python)

Fixed submission:
N = int(input())
S = []
count = 0

dic = {}
for i in range(N):
    S.append(input())
    S[i] = sorted(S[i])
    S[i] = ''.join(S[i])
    if dic.setdefault(S[i], 0) > 0:
        count += dic[S[i]]
        dic[S[i]] += 1
    else:
        dic[S[i]] = 1
print(count)

Buggy submission (verdict: Runtime Error):
N = int(input())
S = []
num = []
num_list = []
count_list = []
num_list_counter = 0
count = 0

def pow_k(x, n):
    """
    O(log n)
    """
    if n == 0:
        return 1

    K = 1
    while n > 1:
        if n % 2 != 0:
            K *= x
        x *= x
        n //= 2

    return K * x

for i in range(N):
    S.append(input())
    num = 1
    num *= pow_k(2, S[i].count('a'))
    num *= pow_k(3, S[i].count('b'))
    num *= pow_k(5, S[i].count('c'))
    num *= pow_k(7, S[i].count('d'))
    num *= pow_k(11, S[i].count('e'))
    num *= pow_k(13, S[i].count('f'))
    num *= pow_k(17, S[i].count('g'))
    num *= pow_k(19, S[i].count('h'))
    num *= pow_k(23, S[i].count('i'))
    num *= pow_k(29, S[i].count('j'))
    num *= pow_k(31, S[i].count('k'))
    num *= pow_k(37, S[i].count('l'))
    num *= pow_k(41, S[i].count('m'))
    num *= pow_k(43, S[i].count('n'))
    num *= pow_k(47, S[i].count('o'))
    num *= pow_k(73, S[i].count('p'))
    num *= pow_k(79, S[i].count('q'))
    num *= pow_k(83, S[i].count('r'))
    num *= pow_k(89, S[i].count('s'))
    num *= pow_k(97, S[i].count('t'))
    num *= pow_k(101, S[i].count('u'))
    num *= pow_k(103, S[i].count('v'))
    num *= pow_k(107, S[i].count('w'))
    num *= pow_k(109, S[i].count('x'))
    num *= pow_k(113, S[i].count('y'))
    num *= pow_k(127, S[i].count('z'))

    if num_list_counter == 0:
        num_list.append(num)
        count_list.append(1)
        num_list_counter += 1
    else:
        judge = 0
        for j in range(num_list_counter):
            if num_list[j] == num:
                judge = 1
                count += count_list[j]
                count_list[j] += 1
        if judge == 0:
            num_list_counter += 1
            num_list.append(num)
            count_list.append(1)

print(count)
Problem p02957 (python)

Fixed submission:
A, B = map(int, input().split())

if A == 0 or B == 0:
    print("IMPOSSIBLE")
else:
    if (A + B) % 2 == 0:
        print(int((A+B)/2))
    else:
        print("IMPOSSIBLE")

Buggy submission (verdict: Runtime Error):
import numpy as np
S = input().strip()

MOD = 10**9 + 7
dp = np.zeros((100005, 13))
N = len(S)

dp[0][0] = 1
for i in range(N):
    c = -1
    if S[i] == '?':
        c = -1
    else:
        c = int(S[i])

    for j in range(10):
        if c != -1 and c != j:
            continue
        for ki in range(13):
            dp[i+1][(ki * 10 + j) % 13] += dp[i][ki]

    for j in range(13):
        dp[i+1][j] %= MOD

res = int(dp[N][5])

print(res)
Problem p02960 (python)

Fixed submission:
S = input().strip()

MOD = 10**9 + 7
dp = [[0 for i in range(13)] for j in range(100005)]
N = len(S)

dp[0][0] = 1
for i in range(N):
    c = -1
    if S[i] == '?':
        c = -1
    else:
        c = int(S[i])

    for j in range(10):
        if c != -1 and c != j:
            continue
        for ki in range(13):
            dp[i+1][(ki * 10 + j) % 13] += dp[i][ki]

    for j in range(13):
        dp[i+1][j] %= MOD

res = int(dp[N][5])

print(res)

Buggy submission (verdict: Runtime Error):
S = input().strip()

a = 130
for i in range(100000);
    b = a % 13

print(a)

Buggy submission (verdict: Runtime Error):
S = input().strip()

a = 130
for i in range(100000)
    b = a % 13

print(a)