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

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

if B-A+1 > K*2:
  ans = list(range(A, A+K))+list(range(B-K+1, B+1))
  print(*ans, sep="\n")
else:
  print(*list(range(A,B+1)), sep="\n")

Buggy submission (verdict: Runtime Error):
A,B,K = input().strip().split(' ')

if B-A+1 > K:
  ans = list(range(A, A+K))+list(range(B-K+1, B+1))
  print(*ans, sep="\n")
  
else:
  print(*list(range(A,B+1)), sep="\n")
Problem p03485 (python)

Fixed submission:
import math
a,b = map(int, input().strip().split(' '))
print(math.ceil((a+b)/2))

Buggy submission (verdict: Runtime Error):
import math
a,b = map(int, input.strip().split(' '))
print(math.ceil((a+b)/2))
Problem p03486 (python)

Fixed submission:
S = ''.join(sorted(input().strip()))
T = ''.join(sorted(input().strip(),reverse=True))
print('Yes' if S < T else 'No')

Buggy submission (verdict: Runtime Error):
S = ''.join(sorted(input.strip()))
T = ''.join(sorted(input.strip(),reverse=True))
print('Yes' if S < T else 'No')
Problem p03568 (python)

Fixed submission:
N = int(input().strip())
A = list(map(int, input().strip().split(' ')))

c_even = len([1 for a in A if a % 2 == 0])
ans = 3**len(A) - 2**c_even
print(ans)

Buggy submission (verdict: Runtime Error):
N = int(input().strip())
A = list(map(int, input().strip().split(' ')))

c_even = len(1 for a in A if a % 2 == 0)
ans = 3**len(A) - 2**c_even
print(ans)
Problem p03637 (python)

Fixed submission:
_ = input()
A = list(map(int, input().strip().split(' ')))

a_4,a_2,a_1 = 0,0,0
for a in A:
  if a%4 == 0:
    a_4 += 1
  elif a%2 == 0:
    a_2 = 1
  else:
    a_1 += 1
#print(a_4,a_2,a_1)
print('Yes' if (a_4+1) >= (a_1+a_2) else 'No')

Buggy submission (verdict: Runtime Error):
_ = input()
A = list(map(int, input().strip().split(' ')))

a_4,a_2,a_1 = 0,0
for a in A:
  if a%4 == 0:
    a_4 += 1
  elif a%2 == 0:
    a_2 = 1
  else:
    a_1 += 1

print('Yes' if a_4 >= a_1+a_2 else 'No')
Problem p03681 (python)

Fixed submission:
N,M = map(int, input().strip().split(' '))

def factorial(n):
  ans = 1
  for i in range(2,n+1):
    ans = ans*i % 1000000007
  return ans

if abs(N-M) >= 2:
  print(0)
elif N == M:
  print(factorial(N)*factorial(M)*2 % 1000000007)
else:
  print(factorial(N)*factorial(M) % 1000000007)

Buggy submission (verdict: Runtime Error):
from functools import lru_cache
import sys
sys.setrecursionlimit(10000)

N,M = map(int, input().strip().split(' '))

@lru_cache(maxsize=512)
def factorial(n):
  if n in {0,1}:
    return 1
  return n*factorial(n-1) % 1000000007

if abs(N-M) >= 2:
  print(0)
elif N == M:
  print(factorial(N)*factorial(M)*2 % 1000000007)
else:
  print(factorial(N)*factorial(M) % 1000000007)
Problem p03694 (python)

Fixed submission:
_ = input()
a = list(map(int, input().strip().split(' ')))
print(max(a)-min(a))

Buggy submission (verdict: Runtime Error):
_ = input()
a = list(map(int, input().strip().strip(' ')))
print(max(a)-min(a))
Problem p03695 (python)

Fixed submission:
_ = input().strip()
kind_set = set()
rates = list(map(int, input().strip().split(' ')))

def whatcolor(rate):
  if rate < 400:
    return 0
  elif rate < 800:
    return 1
  elif rate < 1200:
    return 2
  elif rate < 1600:
    return 3
  elif rate < 2000:
    return 4
  elif rate < 2400:
    return 5
  elif rate < 2800:
    return 6
  elif rate < 3200:
    return 7
  else:
    return 'free'
  
free_n = 0
for r in rates:
  color = whatcolor(r)
  if color == 'free':
    free_n += 1
  else:
    kind_set.add(color)

ans_min = max(1, len(kind_set))
ans_max = len(kind_set) + free_n
print(ans_min, ans_max)

Buggy submission (verdict: Runtime Error):
_ = input().strip()
kind_set = {}
colors = list(map(int, input().strip().split(' ')))

def whatcolor(rate):
  if rate < 400:
    return 0
  elif rate < 800:
    return 1
  elif rate < 1200:
    return 2
  elif rate < 1600:
    return 3
  elif rate < 2000:
    return 4
  elif rate < 2400:
    return 5
  elif rate < 2800:
    return 6
  elif rate < 3200:
    return 7
  else:
    return 'red'
  
for r in rates:
  color = whatcolor(r)
  if color == 'red':
    continue
  else:
    kind_set.add(color)

print(max(1, len(kind_set)))
Problem p03720 (python)

Fixed submission:
N,M = map(int, input().strip().split(' '))
G = [[] for _ in range(N)]
for _ in range(M):
  a,b = map(int, input().strip().split(' '))
  a,b = a-1, b-1
  G[a].append(b)
  G[b].append(a)

for i in range(N):
  print(len(G[i]))

Buggy submission (verdict: Runtime Error):
N,M = map(int, input().strip())
G = [[] for _ in range(N)]
for _ in range(M):
  a,b = map(int, input().strip().split(' '))
  a,b = a-1, b-1
  G[a].append(b)
  G[b].append(a)

for i in range(N):
  print(len(G[i]))

Buggy submission (verdict: Runtime Error):
N,M = map(int, input().strip())
G = [[] for _ in range(N)]
for _ in range(M):
  a,b = map(int, input().strip().split(' '))
  G[a].append(b)
  G[b].append(a)

for i in range(N):
  print(len(G[i]))
Problem p03731 (python)

Fixed submission:
N,T = map(int, input().strip().split(' '))
t = list(map(int, input().strip().split(' ')))

ans = 0
for i in range(N-1):
  ans += min(t[i+1]-t[i], T)
print(ans+T)

Buggy submission (verdict: Runtime Error):
N,T = map(int, input().strip().split(' '))
t = list(map(int, input().strip().split(' ')))

imos = [0]*(t[-1]+T+1)
for i in t:
  imos[i] += 1
  imos[i+T] -= 1

for i in range(len(imos)-1):
  imos[i+1] += imos[i]
  
print(len([1 for i in imos if i > 0]))
Problem p03738 (python)

Fixed submission:
A = int(input().strip())
B = int(input().strip())
if A > B:
  print('GREATER')
elif A < B:
  print('LESS')
else:
  print('EQUAL')

Buggy submission (verdict: Runtime Error):
A,B = map(int, input().strip().split(' '))
if A > B:
  print('GREATER')
elif A < B:
  print('LESS')
else:
  print('EQUAL')
Problem p03773 (python)

Fixed submission:
A,B = map(int, input().strip().split(' '))
print((A+B)%24)

Buggy submission (verdict: Runtime Error):
A,B = map(int, input().strip())
print((A+B)%24)
Problem p03844 (python)

Fixed submission:
print(eval(''.join(input().strip().split(' '))))

Buggy submission (verdict: Runtime Error):
print(eval(''join(input().strip().split(' '))))
Problem p03846 (python)

Fixed submission:
N = int(input().strip())
A = list(map(int, input().strip().split(' ')))
if N % 2 == 1:
  checklist = {0:1}
  for i in range((N-1)//2):
    checklist[(i+1)*2] = 2
else:
  checklist = {(i*2+1):2 for i in range(N//2)}

for a in A:
  if a in checklist and checklist[a] in {1,2}:
    checklist[a] -= 1
  else:
    print(0)
    exit()
print(int(2**(N//2))%1000000007)

Buggy submission (verdict: Runtime Error):
N = int(input().strip())
A = list(map(int, input().strip().split(' ')))
if N % 2 == 1:
  checklist = {0: 1}
  for i in range((N-2)//2):
    checklist[(i+1)*2] = 2
else:
  checklist = {(i*2+1):2 in i in range(N//2)}
  
for a in A:
  if a in checklist and checklist[a] in {1,2}:
    checklist[a] -= 1
  else:
    print(0)
    exit()
print(int(2**(N//2)))
Problem p04044 (python)

Fixed submission:
N,L = map(int, input().strip().split(' '))
print(''.join(sorted([input().strip() for _ in range(N)])))

Buggy submission (verdict: Runtime Error):
N,L = map(int, input().strip().splip(' '))
print(''.join(sorted([input().strip() for _ in range(N)])))
Problem p02705 (python)

Fixed submission:
from math import pi

r = int(input())
print(2 * r * pi)

Buggy submission (verdict: Runtime Error):
r = int(input())
print(2 * r * pi)
Problem p03456 (python)

Fixed submission:
import sys
import math

def main():
    a = sys.stdin.readline().rstrip().split()
    num = int("".join(a))
    if math.sqrt(num).is_integer():
        print("Yes")
    else:
        print("No")


if __name__ == '__main__':
    main()

Buggy submission (verdict: Runtime Error):
import sys

def main():
    a = sys.stdin.readline().rstrip().split()
    num = int("".join(a))
    if math.sqrt(num).is_integer():
        print("Yes")
    else:
        print("No")


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

Fixed submission:
import sys
import math

def main():
    def iterate_position():
        yield list(map(int, sys.stdin.readline().rstrip().split()))

    N = int(sys.stdin.readline().rstrip())
    now_position = [0, 0, 0]
    for x in range(N):
        try:
            next_position = next(iterate_position())
            dt = next_position[0] - now_position[0]
            dx = next_position[1] - now_position[1]
            dy = next_position[2] - now_position[2]
            if dt < abs(dx) + abs(dy):
                print("No")
                sys.exit()
            check = dt - (dx + dy)
            if check % 2 == 1:
                print("No")
                sys.exit()
            now_position = next_position
        except StopIteration:
            print("No")
    else:
        print("Yes")

if __name__ == '__main__':
    main()

Buggy submission (verdict: Runtime Error):
    def iterate_position():
        yield list(map(int, sys.stdin.readline().rstrip().split()))

    N = int(sys.stdin.readline().rstrip())
    now_position = [0, 0, 0]
    for x in range(N):
        try:
            next_position = next(iterate_position())
            dt = next_position[0] - now_position[0]
            dx = next_position[1] - now_position[1]
            dy = next_position[2] - now_position[2]
            if dt < abs(dx) + abs(dy):
                print("No")
                sys.exit()
            check = dt - (dx + dy)
            if check % 2 == 1:
                print("No")
                sys.exit()
            now_position = next_position
        except StopIteration:
            print("No")
    else:
        print("Yes")
Problem p04043 (python)

Fixed submission:
a, b, c = (int(i) for i in input().split())
d=(a+b+c)/17
e=(max(a,b)-2+max(a,c)+max(b,c))/17
     
if(d==1 and e==1): print("YES")
else: print("NO")

Buggy submission (verdict: Runtime Error):
  S=input()  
  a, b, c = (int(i) for i in S.split())  
    d=(a+b+c)/17
    e=(max(a,b)-2+max(a,c)+max(b,c))/17
     
    if(d==1 and e==1): print("YES")
    else: print("NO")

Buggy submission (verdict: Runtime Error):
    a, b, c = (int(i) for i in input().split())  
    d=(a+b+c)/17
    e=(max(a,b)-2+max(a,c)+max(b,c))/17
     
    if(d==1 and e==1): print("YES")
    else: print("NO")

Buggy submission (verdict: Runtime Error):
    a, b, c = (int(i) for i in input().split())  
    d=(a+b+c)/17
    e=(max(a,b)-2+max(a,c)+max(b,c))/17
     
    if(d==1 and e==1): print("YES")
    else: print("NO")

Buggy submission (verdict: Runtime Error):
a, b, c = (int(i) for i in input().split())  
d=(a+b+c)/17
e=(max(a,b)-2+max(a,c)+max(b,c))/21

if(d==1 and e==1)
print(min(a,b,c), max(a,b,c), min(a,b,c))
Problem p02952 (python)

Fixed submission:
a = input()
if len(a)==5:
    b = int(a)
    c = b - 9999 + 9 + 900
elif len(a)==4:
    b = int(a)
    c = 9 + 900
elif len(a)==3:
    b = int(a)
    c = b - 99 + 9
elif len(a)==2:
    b = int(a)
    c = 9
elif len(a)==1:
    b = int(a)
    c = b
elif len(a)==6:
    c = 90000 + 900 +9
print(c)

Buggy submission (verdict: Runtime Error):
a = input()
if len(a)==5:
    b = int(a)
    c = b - 9999 + 9 + 900
elif len(a)==4:
    b = int(a)
    c = 9 + 900
elif len(a)==3:
    b = int(a)
    c = b - 99 + 9
elif len(a)==2:
    b = int(a)
    c = 9
elif len(a)==1:
    b = int(a)
    c = b
print(c)

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

if len(a)==5:
    b = int(a)
    c = b - 9999 + 9 + 1000
elif len(a)==4:
    b = int(a)
    c = 9 + 1000
elif len(a)==3:
    b = int(a)
    c = b - 99 + 9
elif len(a)==2:
    b = int(a)
    c = 9
elif len(a)==1:
    b = int(a)
    c = b
print(c)
Problem p02983 (python)

Fixed submission:
a,b = map(int,input().split())
c = [2019]*2
p = 0
flag = 0
if (b-a) >= 2019:
    for j in range(a,a+2020):
        if j%2019 == 0:
            flag = 1
            break
        for l in range(j+1,a+2020):
            if l%2019==0:
                flag = 1
                break
            c[1] = (j*l)%2019
            c[0] = (j*l)%2019 if c[0] > c[1] else c[0]
else:
    for m in range(a,b+1):
        if m%2019 == 0:
            flag = 1
            break
        for n in range(m+1,b+1):
            if n%2019==0:
                flag = 1
                break
            c[1] = (n*m)%2019
            c[0] = (n*m)%2019 if c[0] > c[1] else c[0]
if flag == 1:
    print(0)
else:
    print(c[0])

Buggy submission (verdict: Runtime Error):
a,b = map(int,input().split())
c = [0]*(b-a+1)
j = 0
for i in range(a,b+1):
    c[j] = i%2019
    j += 1
x = min(c)
c.remove(x)
y = min(c)
print((x*y)%2019)
Problem p02994 (python)

Fixed submission:
a,b = map(int,input().split())
c = [i+b for i in range(a)]
d = [abs(j+b) for j in range(a)]
print(sum(c)-c[d.index(min(d))])

Buggy submission (verdict: Runtime Error):
a,b = map(int,input().split())
c = [i+b for i in range(a)]
d = [abs(j+b) for j in range(a)]
c.remove(min(d))
print(sum(c))
Problem p03060 (python)

Fixed submission:
a = int(input())
b = map(int,input().split())
c = map(int,input().split())
b,c = list(b),list(c)
e = 0
for k in range(a):
    d = b[k] - c[k]
    if d > 0:
        e += d
print(e)

Buggy submission (verdict: Runtime Error):
a = int(input())
b = [map(int,input().split()) for i in range(a) ]
c = [map(int,input().split()) for j in range(a) ]
e = 0
for k in range(a):
    d = b[k] - c[k]
    if d > 0:
        e += d
print(e)
Problem p03131 (python)

Fixed submission:
a,b,c = map(int,input().split())
kaisuu = int((a-(b-1))/2)
amari = (a-(b-1))%2
if b >= (c-2):
        print(a+1)
else:
        if amari == 1:
                print(kaisuu*(c-b)+1+b)
        else:
                print(kaisuu*(c-b)+b)

Buggy submission (verdict: Runtime Error):
a,b,c = map(int,input().split())
bis = 1
money = 0
d = [0]*a
if b >= c:
        bis = bis*a + 1
        print(bis)
else:
        for i in range(a):
                if money == 0 :
                        if bis < b:
                                bis += 1
                                d[i] = bis
                        else:
                                money += 1
                                bis -= b
                                d[i] = bis
                else:
                        bis += c
                        money -= 1
                        d[i] = bis
        if d[-1] > d[-2] :
                print(d[-1])
        else:
                print(d[-2]+1)
Problem p03408 (python)

Fixed submission:
a = int(input())
b = [input() for i in range(a)]
c = int(input())
d = [input() for j in range(c)]
g = [0]*a
t = 0
for k in b:
    e = b.count(k)
    f = d.count(k)
    g[t] = e - f
    t +=1
if max(g) < 0:
    print(0)
else:
    print(max(g))

Buggy submission (verdict: Runtime Error):
a = int(input())
b = [input() for i in range(a)]
c = int(input())
d = [input() for j in range(c)]
g = [0]*a
for k in b:
    e = b.count(k)
    f = d.count(k)
    g[k] = e - f
print(max(g))
Problem p03145 (python)

Fixed submission:
A,B,C = map(int, input().split())
print(A*B//2)

Buggy submission (verdict: Runtime Error):
A,B = map(int, input(),split())
print(A*B/2)
Problem p03448 (python)

Fixed submission:
A = int(input())
B = int(input())
C = int(input())
X = int(input())
count = 0
sum = 0

for i in range(A+1):
    for j in range(B+1):
        for k in range(C+1):
            sum = 500*i + 100*j + 50*k 
            if X == sum:
                count+=1
print(count)

Buggy submission (verdict: Runtime Error):
A = int(input())
B = int(input())
C = int(input())
X = int(input())
Y = [A, B, C]
# A = list(map(int,input().split()))
A1 = list(map(lambda x: x+1,Y))
count = 0
sum = 0

for i in range(a):
    for j in range(b):
        for k in range(c):
            sum = 500*i + 100*j + 50*k 
            if X == sum:
                count+=1
print(count)
Problem p03543 (python)

Fixed submission:
a,b,c,d=input()
print("Yes" if a==b==c or b==c==d else "No")

Buggy submission (verdict: Runtime Error):
slen = len(int(input()))
print('Yes' if slen > 3 else 'No')
Problem p03636 (python)

Fixed submission:
s = input()
print(s[0]+str(len(s)-2)+s[-1])

Buggy submission (verdict: Runtime Error):
s = len(input())-2
print(f'i{s}n')
Problem p02855 (python)

Fixed submission:
import sys
input=sys.stdin.readline
h,w,k=map(int,input().split())
board=list(input() for _ in range(h))
num=0
cutting=[[0 for _1 in range(w)] for _2 in range(h)]
for row in range(h):
  if board[row].count("#")==0:
    continue
  num+=1
  col=0
  while board[row][col]==".":
    cutting[row][col]=num
    col+=1
  cutting[row][col]=num
  col+=1
  while col < w:
    if board[row][col]=="#":
      num+=1
    cutting[row][col]=num
    col+=1
    
for row in range(1,h):
  if cutting[row][0]==0:
    cutting[row]=cutting[row-1]
  if cutting[h-1-row][0]==0:
    cutting[h-1-row]=cutting[h-row]

for row in range(h):
  print(*cutting[row])

Buggy submission (verdict: Runtime Error):
import sys
input=sys.stdin.readline
h,w,k=map(int,input().split())
board=list(input() for _ in range(h))
num=0
cutting=[[0 for _1 in range(w)] for _2 in range(h)]
for row in range(h):
  num+=1
  if board[row].count("#")==0:
    continue
  col=0
  while board[row][col]==".":
    cutting[row][col]=num
    col+=1
  cutting[row][col]=num
  col+=1
  while col < w:
    cutting[row][col]=num
    col+=1
    if board[row][col]=="#":
      num+=1
centrow = (h-1)//2
for row in range(centrow, h):
  if cutting[row][0]==0:
    cutting[row]=cutting[row-1]
  if cutting[h-1-row][0]==0:
    cutting[h-1-row]=cutting[h-row]

for row in range(h):
  print(*cutting[row])
Problem p02865 (python)

Fixed submission:
N=int(input())
print((N-1)//2)

Buggy submission (verdict: Runtime Error):
N=int(input())
distances=list(map(int,input().split()))
maximum=max(distances)

if distances[0]!=0 or distances.count(0)>=2 or maximum>=N:
    print(0)
else:
    count_dist=list(distances.count(i) for i in range(maximum+1))
    if count_dist.count(0) >= 1:
        print(0)
    else:
        count=1
        for i in range(maximum):
            count = count*power_mod(count_dist[i],count_dist[i+1],998244353)%998244353
        print(count)

def power_mod(a, n, mod):
    a=a%mod
    if n==0:
        return 1
    elif n==1:
        return a
    elif n%2==0:
        return power_mod(a,n//2,mod)**2%mod
    else:
        return (power_mod(a,(n-1)//2,mod)**2%mod)*a%mod
Problem p02909 (python)

Fixed submission:
weather=input()
weathers={"Sunny": "Cloudy", "Cloudy": "Rainy", "Rainy": "Sunny"}
print(weathers[weather])

Buggy submission (verdict: Runtime Error):
weather=input()
weathers={"Sunny": "Cloudy", "Cloudy": "Rainy", "Rainy": "Sunny"}
print(weathers[wearther])
Problem p02926 (python)

Fixed submission:
import math
N=int(input())
engines = tuple((complex(*map(int, input().split())) for _ in range(N)))
engines = sorted(list((engine, math.atan2(engine.imag, engine.real))for engine in engines if engine != 0), key=lambda x:x[1])
N=len(engines)
if N == 0:
    print(0)
else:
    total = sum(engine[0] for engine in engines)
    head_index = max(i if engines[i][0].imag < 0 else -1 for i in range(N))
    tail_index = 0
    tmp = sum(engines[i][0] for i in range(tail_index,head_index+1))
    maximum = max(abs(tmp), abs(total - tmp))

    while True:
        if head_index < N-1:
            if (engines[head_index+1][0]/engines[tail_index][0]).imag >= 0:
                head_index += 1
            else:
                tail_index += 1
        else:
            if (engines[0][0]/engines[tail_index][0]).imag < 0:
                tail_index += 1
            else:
                break
        tmp = sum(engines[i][0] for i in range(tail_index,head_index+1))
        maximum = max(maximum, abs(tmp), abs(total - tmp))

    print(maximum)

Buggy submission (verdict: Runtime Error):
import math
N=int(input())
engines = tuple((complex(*map(int, input().split())) for _ in range(N)))
engines = sorted(list((engine, math.atan2(engine.imag, engine.real))for engine in engines if engine != 0), key=lambda x:x[1])
N=len(engines)
if N == 0:
    print(0)
else:
    total = sum(engine[0] for engine in engines)
    head_index = max(i if engines[i][0].imag < 0 else -1 for i in range(N))
    tail_index = 0
    tmp = sum(engines[i][0] for i in range(tail_index,head_index+1))
    maximum = max(abs(tmp), abs(total - tmp))

    while True:
        if head_index < N-1:
            if (engines[head_index+1]/engines[tail_index]).imag >= 0:
                head_index += 1
            else:
                tail_index += 1
        else:
            if (engines[0]/engines[tail_index]).imag < 0:
                tail_index += 1
            else:
                break
        tmp = sum(engines[i][0] for i in range(tail_index,head_index+1))
        maximum = max(maximum, abs(tmp), abs(total - tmp))

    print(maximum)

Buggy submission (verdict: Runtime Error):
import math
N=int(input())
engines = tuple((complex(*map(int, input().split())) for _ in range(N)))
engines = sorted(list((engine, math.atan2(engine.imag, engine.real))for engine in engines if engine != 0), key=lambda x:x[1])
N = len(engines)
total = sum(engine[0] for engine in engines)
head_index = max(i if engines[i][0].imag < 0 else -1 for i in range(N))
tail_index = 0
tmp = sum(engines[i][0] for i in range(tail_index,head_index+1))
maximum = max(abs(tmp), abs(total - tmp))

while True:
    if head_index < N-1:
        if (engines[head_index+1][0]/engines[tail_index][0]).imag >= 0:
            head_index += 1
        else:
            tail_index += 1
    else:
        if (engines[0][0]/engines[tail_index][0]).imag < 0:
            tail_index += 1
        else:
            break
    tmp = sum(engines[i][0] for i in range(tail_index,head_index+1))
    maximum = max(maximum, abs(tmp), abs(total - tmp))

print(maximum)
Problem p02945 (python)

Fixed submission:
A,B = map(int,input().split())
print(max(A+B,A-B,A*B))

Buggy submission (verdict: Runtime Error):
import sys
input = sys.stdin.readline
N=int(input())
strings=list("".join(sorted(input())) for _ in range(N))
string_set = set()
counts = {}
count = 0
for string in strings:
    if string in string_set:
        count += counts[string]
        counts[string] += 1
    else:
        counts[string] = 1

print(count)

Buggy submission (verdict: Runtime Error):
import sys
input = sys.stdin.readline
N=int(input())
strings=list("".join(sorted(input())) for _ in range(N))
count = 0
for string in strings:
    tmp = strings.count(string)
    if tmp > 1:
        count += (tmp - 1) / 2

print(int(count))
Problem p02958 (python)

Fixed submission:
N=int(input())

p=list(map(int,input().split()))
sort=list(range(1,N+1))
count=list(p[i]==sort[i] for i in range(N)).count(False)
if count > 2:
    print("NO")
else:
    print("YES")

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

p=list(map(int,input().split()))
sort=list(range(1,N+1))
count=[p[i]==sort[i] for i in range(N)].count(True)
if count > 2:
    print("NO")
else:
    print("YES")
Problem p02743 (python)

Fixed submission:
a,b,c=input().split(' ')
a=int(a)
b=int(b)
c=int(c)
if (c-a-b>0) and ((c-a-b)**2>4*a*b):
  print("Yes")
else:
  print("No")

Buggy submission (verdict: Runtime Error):
import math
a,b,c=input().split(' ')
a=int(a)
b=int(b)
c=int(c)
if ((math.sqrt(a)+math.sqrt(b))<math.sqrt(c):
    print("Yes")
else:
    print("No")
Problem p02898 (python)

Fixed submission:
N,K = map(int,input().split())
H = map(int,input().split())
ans = 0
for h in H:
    if h >= K:
        ans += 1
print(ans)

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

ans = 0
for h in H:
    if h >= K:
        ans += 1
print(ans)
Problem p02818 (python)

Fixed submission:
i = list(map(int, input().split()))
A = i[0]
B = i[1]
K = i[2]

if K <= A :
    A -= K
elif K <= A + B :
    B -= K - A
    A = 0
else :
    A = 0
    B = 0

print(A, B)

Buggy submission (verdict: Runtime Error):
s = input().split()
A = s[0]
B = s[1]
K = s[2]
 
for j in range(K):
  if A >0:
    A -= 1
  elif B >0:
    B -= 1
  else:
    break
 
print(A, B)

Buggy submission (verdict: Runtime Error):
s = [input() for i in range(3)]
A = s[0]
B = s[1]
K = s[2]
 
for j in range(K):
  if A >0:
    A -= 1
  elif B >0:
    B -= 1
  else:
    break
 
print(A)
print(B)

Buggy submission (verdict: Runtime Error):
s = [input() for i in range(3)]
A = s[0]
B = s[1]
K = s[2]

for j in range(K):
  if A >0:
    A -= 1
  elif B >0:
    B -= 1
  else:
    break

print(A, B)