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

Fixed submission:
n = int(input())
count = 0
 
for i in range(1,n+1):
  if len(str(i))%2 == 1:
    count += 1
 
print(count)

Buggy submission (verdict: Runtime Error):
n = int(input())
count = 0
 
for i in range(1,n+1):
  if len(int(i))%2 == 1:
    count += 1
 
print(count)

Buggy submission (verdict: Runtime Error):
n = int(input())
count = 0
 
for i in range(1,n+1):
  if len(int(i))//2 != 1:
    count += 1
 
print(count)

Buggy submission (verdict: Runtime Error):
n = int(input())
count = 0
 
for i in range(1,n+1):
  if len(i)//2 != 1:
    count += 1
 
print(count)

Buggy submission (verdict: Runtime Error):
n = int(input())
count = 0
 
for i in n:
  if len(i)//2 != 0:
    count += 1
 
print(count)

Buggy submission (verdict: Runtime Error):
n = int(input())
count = 0

for i in n:
  if len(i)% != 0:
    count += 1

print(count)
Problem p02958 (python)

Fixed submission:
N = int(input())
p = list(map(int, input().split()))
cnt = 0
 
for i in range(N):
  if p[i] != i+1:
    cnt += 1
 
if cnt==0 or cnt==2 :
  print('YES')
else:
  print('NO')

Buggy submission (verdict: Runtime Error):
N = int(input())
p = list((int, input().split()))
cnt = 0
 
for i in range(N):
  if p[i] != i+1:
    cnt += 1
 
if cnt==0 or cnt==2 :
  print('YES')
else:
  print('NO')

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

for i in range(1,1+N):
  if p[i]+1 != p[i+1]:
    cnt += 1

if cnt <= 3:
  print('YES')
else:
  print('NO')
Problem p02981 (python)

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

Buggy submission (verdict: Runtime Error):
import math
n,d = list(map(int, input().split()))
x = [list(map(int, input().split())) for N in range(n)]
 
cnt = 0
 
for i in range(n):
  for j in range(i+1,n):
    kaijou = 0
    for k in d:
      kaijou = kaijou + abs(x[j][k]-x[i][k])**2
    if math.sqrt(kaijou).is_integer():
      cnt += 1
      
print(cnt)
Problem p02982 (python)

Fixed submission:
import math
n,d = list(map(int, input().split()))
x = [list(map(int, input().split())) for N in range(n)]
 
cnt = 0
 
for i in range(n):
  for j in range(i+1,n):
    kaijou = 0
    for k in range(d):
      kaijou = kaijou + abs(x[j][k]-x[i][k])**2
    if math.sqrt(kaijou).is_integer():
      cnt += 1
      
print(cnt)

Buggy submission (verdict: Runtime Error):
import math
n,d = list(map(int, input().split()))
x = [list(map(int, input().split())) for N in range(n)]
 
kaijou = 0
cnt = 0
 
for i in n:
  for j in n:
    for k in d:
      kaijou = kaijou + (x[j][k]-x[i][k])**2
    if math.sqrt(kaioju).is_integer():
      cnt += 1
 
print(cnt-n)

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

kaijou = 0
cnt = 0

for i in n:
  for j in n:
    for k in d:
      kaijou += (x[j,k]**2-x[i,k]**2)
    if math.sqrt(kaioju).is_integer() == True:
      cnt += 1

print(cnt-n)
Problem p02988 (python)

Fixed submission:
n = int(input())
p = list(map(int,input().split()))
 
cnt = 0
 
for i in range(1,n-1):
  if (p[i-1] < p[i] and p[i] < p[i+1]) or (p[i-1] > p[i] and p[i] > p[i+1]):
     cnt += 1
  
print(cnt)

Buggy submission (verdict: Runtime Error):
n = int(input())
p = list(map(int,input().split()))
 
cnt = 0
 
for i in range(1,n-2):
  if (p[i-1] < p[i] and p[i] < p[i+1]) 
  or (p[i-1] > p[i] and p[i] > p[i+1]:
      cnt += 1
  
print(cnt)

Buggy submission (verdict: Runtime Error):
n = int(input())
p = list(map(int,input().split()))
 
cnt = 0
 
for i in range(1,n-2):
  if (p[i] < p[i+1] and p[i+1] < p[i+2]) 
  or (p[i] > p[i+1] and p[i+1] > p[i+2]:
      cnt += 1
  
print(cnt)

Buggy submission (verdict: Runtime Error):
n = int(input())
p = list(map(int,input().split()))
 
cnt = 0

for i in range(1,n-1):
  if (p[i] < p[i+1] and p[i+1] < p[i+2]) 
  or (p[i] > p[i+1] and p[i+1] > p[i+2]:
      cnt += 1
  
print(cnt)
Problem p03059 (python)

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

Buggy submission (verdict: Runtime Error):
a,b,t = map(int, input())
 
print(t//a*b)

Buggy submission (verdict: Runtime Error):
a,b,t = map(int, input())

print(int((t+0.5)/a*b))
Problem p03085 (python)

Fixed submission:
b = input()
enkitsui = {'A':'T','C':'G','T':'A','G':'C'}
print(enkitsui[b])

Buggy submission (verdict: Runtime Error):
enkitsui = {'A':'T','C':'G','T':'A','G':'C'}
print(enkitsui[b])

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

enkitsui = {'A':'T','C':'G','T':'A','G':'C'}
print(enkitsui['b'])

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

enkitsui = {'A':'T','C':'G','T':'A','G':'C'}
print(enkitsui.value['b'])
Problem p03109 (python)

Fixed submission:
a = list(map(int,input().split("/")))
if a[1] > 4:
  print("TBD")
else:
  print("Heisei")

Buggy submission (verdict: Runtime Error):
s = input()
if s <= '2019/04/19':
  print(Heisei)
else:
  print(TDB)

Buggy submission (verdict: Runtime Error):
s = input()
S = s.split('/')
ymd = int(''.join(S)) 
if ymd <= 20190419:
  print(Heisei)
else:
  print(TDB)
Problem p03238 (python)

Fixed submission:
n = int(input())
 
if n==1:
  print('Hello World')
elif n==2:
  a = int(input())
  b = int(input())
  print(int(a+b))

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

if n==1:
  print('Hello World')
elif n[0]==2:
  print(a+b)
Problem p03284 (python)

Fixed submission:
N,K = map(int,input().split())
if N % K == 0:
  print(0)
else:
  print(1)

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

if n%k == 0 or k%n == 0:
  print(0)
  
else:
  print(1)
Problem p03323 (python)

Fixed submission:
a,b = map(int, input().split())
 
if a + b <= 16:
  if a <= 8 and b <= 8:
    print('Yay!')
  else:
    print(':(')
else:
  print(':(')

Buggy submission (verdict: Runtime Error):
a,b = int(input().split())

if a + b <= 16:
  if a <= 8 and b <= 8:
    print('Yay!')
  else:
    print(':(')
else:
  print(':(')

Buggy submission (verdict: Runtime Error):
a,b = int(input().split())

if a <= 8 and b <= 8:
  print('Yay!')
else:
  print(':(')
Problem p03324 (python)

Fixed submission:
d,n = map(int, input().split())
if n==100:
  print(100**d * 101)
else:
  print(100**d * n)

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

if d == 0 :
  for i in range(1,100):
    x.append(i)
  
elif d == 1 :
  for i in range(1,100):
    x.append(i*100)

elif d == 2 :
  for i in range(1,100):
    x.append(i*10000)

print(x[n-1])
Problem p03351 (python)

Fixed submission:
a,b,c,d = map(int, input().split())
 
if abs(b-a) <= d and abs(c-b) <= d :
  print('Yes')
elif abs(a-c) <= d :
  print('Yes')
else:
  print('No')

Buggy submission (verdict: Runtime Error):
X = int(input())
c = 1
for b in range(1,X):
    for p in range(2,X):
        if b**p <= X:
            c = max(c, b**p)
        else:
            break
print(c)

Buggy submission (verdict: Runtime Error):
a,b,c,d = map(int, input().split())
 
if abs(b-a) <= d and abs(c-b) <= d :
  print('Yes')
elif: abs(a-c) <= d :
  print('Yes')
else:
  print('No')

Buggy submission (verdict: Runtime Error):
a,b,c,d = map(int, input().split())
 
if abs(b-a) < d and abs(c-b) < d :
  print('Yes')
elif: abs(a-c) < d :
  print('Yes')
else:
  print('No')

Buggy submission (verdict: Runtime Error):
a,b,c,d = map(int, input().split())

if abs(b-a) < d and abs(a-b) < d :
  print('Yes')
elif: abs(a-c) < d :
  print('Yes')
else:
  print('No')
Problem p03369 (python)

Fixed submission:
s=input()
print(700+int(s.count("o"))*100)

Buggy submission (verdict: Runtime Error):
s = input()
print(700　+ int(s.count("o"))*100)

Buggy submission (verdict: Runtime Error):
s = input()
print(700　+ int(s.count('o'))*100)

Buggy submission (verdict: Runtime Error):
s = input()
print(700　+ 100*int(s.count('o')))

Buggy submission (verdict: Runtime Error):
s = input()
print(700　+ 100*s.count('o'))

Buggy submission (verdict: Runtime Error):
s = input()
print(700　+ 100*s.count('o')
Problem p03415 (python)

Fixed submission:
c1 = input()
c2 = input()
c3 = input()
 
print(c1[0]+c2[1]+c3[2])

Buggy submission (verdict: Runtime Error):
c1 = input()
c2 = input()
c3 = input()

print(c1[1]+c2[2]+c3[3])
Problem p03433 (python)

Fixed submission:
n = int(input())
a = int(input())

b = n % 500
if b <= a:
  print('Yes')
else:
  print('No')

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

if n < 500 :
  if a >= n[-3:] :
    print('Yes')
  else:
    print('No')
else:
  if a >= n[-2:] :
    print('Yes')
  else:
    print('No')
Problem p03447 (python)

Fixed submission:
x = int(input())
a = int(input())
b = int(input())
 
print((x-a)%b)

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

print(x-a-(b*(x-a)//b)
Problem p03469 (python)

Fixed submission:
s = list(input()) 
s[3] = '8'
print(''.join(s))

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

s[3] = '8'
print(s)
Problem p03493 (python)

Fixed submission:
s = input()
print(s.count('1'))

Buggy submission (verdict: Runtime Error):
s = int(input())
print(s.count(1))
Problem p03547 (python)

Fixed submission:
x,y=map(str,input().split())
if x>y:
    print('>')
elif x<y:
    print('<')
else: print('=')

Buggy submission (verdict: Runtime Error):
x,y = map(int, input().split())
comp = {'A':10,'B':11,'C':12,'D':13,'E':14,'F':15}

if comp[x] > comp[y]:
  print('>')
elif comp[x] == comp[y]:
  print('=')
else:
  print('<')
Problem p03555 (python)

Fixed submission:
c1 = input()
c2 = input()

if c1[0] == c2[2] and c1[1] == c2[1] and c1[2] == c2[0]:
  print('YES')
else:
  print('NO')

Buggy submission (verdict: Runtime Error):
n = int(input())
ans = 0

for i in range(1,n+1):
  if i**2 <= n:
    ans = i**2

print(ans)
Problem p03573 (python)

Fixed submission:
a,b,c = map(int, input().split())

if a==b:
  print(c)
elif a==c:
  print(b)
elif b==c:
  print(a)

Buggy submission (verdict: Runtime Error):
h,w = map(int, input().split())
s = [list(input() for i in range(h))]
t = s.copy()
 
 
number = []
cnt = 0
 
for i in range(h) :
  if 1 <= i and i <= h-2 :
    for j in range(w) :
      if j >= 1 and j < w-1 :
        number = [s[i-1][j-1],s[i-1][j],s[i-1][j+1],s[i][j-1],s[i][j+1],s[i+1][j-1],s[i+1][j],s[i+1][j+1]]
        cnt = number.count('#')
        t[i][j] = cnt
        
      elif j == 0 :
        number = [s[i-1][0],s[i+1][0],s[i-1][1],s[i][1],s[i+1][1]]
        cnt = number.count('#')
        t[i][0] = cnt
      
      elif j == w-1 :
        number = [s[i-1][w-1],s[i+1][w-1],s[i-1][w-2],s[i][w-2],s[i+1][w-2]]
        cnt = number.count('#')
        t[i][w-1] = cnt       
  
  elif i == 0 :
    for j in range(w) :
      if 1 <= j and j <= w-2 :
        number = [s[0][j-1],s[0][j+1],s[1][j-1],s[1][j],s[1][j+1]]
        cnt = number.count('#') 
        t[0][j] = cnt
      
      elif j == 0 :
        number = [s[0][1],s[1][0],s[1][1]]
        cnt = number.count('#') 
        t[0][0] = cnt
        
      elif j == w-1 :
        number = [s[0][w-2],s[1][w-2],s[1][w-1]]
        cnt = number.count('#') 
        t[0][w-1] = cnt        
  
  elif i == h-1 :
    for j in range(w) :
      if 1 <= j and j <= w-2 :
        number = [s[h-1][j-1],s[h-1][j+1],s[h-2][j-1],s[h-2][j],s[h-2][j+1]]
        cnt = number.count('#')
        t[h-1][j] = cnt
                
      elif j == 0 :
        number = [s[h-1][1],s[h-2][1],s[h-2][0]]
        cnt = number.count('#') 
        t[h-1][0] = cnt
        
      elif j == w-1 :
        number = [s[h-2][w-1],s[h-1][w-2],s[h-2][w-2]]
        cnt = number.count('#') 
        t[h-1][w-1] = cnt
 
for i in range(h):
  for j in range(w):
    if s[i][j] == '#':
      t[i][j] = '#'
    
  
a0 = map(str,t[0])
a1 = map(str,t[1])
a2 = map(str,t[2])
print(''.join(a0))
print(''.join(a1))
print(''.join(a2))
Problem p03605 (python)

Fixed submission:
n = input()

if n[0]=='9' or n[1]=='9':
  print('Yes')
else:
  print('No')

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

if n[0]==9 or n[1]==9:
  print('Yes')
  
else:
  print('No')
Problem p03606 (python)

Fixed submission:
n = int(input())
l=[]
total=0
for i in range(n):
  l,r=map(int,input().split())
  total += (r-l+1)
print(total)

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

number = 0

for i in range(n):
  number = number + (r[i]-l[i]+1)

print(number)
Problem p03609 (python)

Fixed submission:
x,t = map(int,input().split())
 
if x >= t:
  print(x-t)
else:
  print(0)

Buggy submission (verdict: Runtime Error):
x,t = map(int(input()))
 
if x >= t:
  print(x-t)
else:
  print(0)

Buggy submission (verdict: Runtime Error):
x,t = int(input())

if x >= t:
  print(x-t)
else:
  print(0)
Problem p03712 (python)

Fixed submission:
h,w = map(int, input().split())
a = [input().split() for i in range(h)]
b = []
 
for i in range(h):
  a[i].insert(0,'#')
  a[i].append('#')
  
for i in range(w+2):
  b.append('#')
 
a.insert(0,b)
a.append(b)
  
for i in a:
  print("".join(list(map(str,i))))

Buggy submission (verdict: Runtime Error):
h,w = map(int, input().split())
a = [input().split() for i in range(h)]
b = []
 
for i in range(h):
  a[i].insert(0,'#')
  a[i].append('#')
  
for i in range(w+2):
  b.append('#')

a.insert(0,b)
a.append(b)
  
for i in a:
  print("".join(str(a[i])))

Buggy submission (verdict: Runtime Error):
h,w = map(int, input().split())
a = [input().split() for i in range(h)]
 
a = {}
b = []
 
for i in h:
  a[i].insert(0,'#')
  a[i].append('#')
  
for i in w+2:
  b.append('#')
 
a.insert(0,b)
a.append(b)
  
for i in a:
  print("".join(list(map(str,i))))

Buggy submission (verdict: Runtime Error):
h,w = map(int, input().split())
for i in h:
  a[i] = list(input())

a = {}
b = []

for i in h+2:
  b.append('#')

a.insert(0,b)
a.insert(h+2,b)

for i in w+2:
  a[i].insert(0,'#')
  a[i].insert(w+2,'#')

print(a)
Problem p02953 (python)

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

H = list(reversed(H)) 
ans='Yes'
if N==1:
    ans='Yes'
else:         
    for i in range(1, N):
        if H[i] - H[i-1] >= 2: #
            ans='No'
            break   
        elif H[i] - H[i-1] == 1: # 1 smaller
            H[i] -= 1
print(ans)

Buggy submission (verdict: Runtime Error):
N = int(input())
H = list(map(int, input().split()))  
H = list(reversed(H))  
if N==1:
    ans='Yes'
else:         
    for i in range(1, N):
        if H[i] - H[i-1] >= 2: #
            ans='No'
            break   
        elif H[i] - H[i-1] == 1: # 1 smaller
            H[i] -= 1
print(ans)
Problem p02983 (python)

Fixed submission:
L, R = list(map(int, input().split()))  


if R - L >= 672:
    ans = 0
elif R * L < 2019:
    ans = L*(L+1)
else:
    ans = 2018
    for i in range(L, R):
        for j in range(L+1, R+1):
            mod=(i*j)%2019
            if mod < ans:
                ans = mod
print(ans)

Buggy submission (verdict: Runtime Error):
L=int(input())
R=int(input())

if R - L >= 672:
    ans = 0
elif R * L < 2019:
    ans = L*(L+1)
else:
    ans = 2018
    for i in range(L, R):
        for j in range(L+1, R+1):
            mod=(i*j)%2019
            if mod < ans:
                ans = mod
print(ans)
Problem p03043 (python)

Fixed submission:
import numpy as np
N, K = map(int, input().split())

P=0
for i in range(1,N+1):
    if i < K:
        p = float((1/N)*(1/2)**np.ceil(np.log2(K/i)))
    elif  i >= K:
        p = float(1/N)
    P += p
print(P)

Buggy submission (verdict: Runtime Error):
import numpy as np
N, K = map(int, input().split())

P=0
for i in range(1,N+1):
    if i < K:
        p = float((1/N)*(1/2)**np.ceil(np.log2(K/i)))
    elif  i > K:
        p = float(1/N)
    P += p
print(P)
Problem p02945 (python)

Fixed submission:
num1,num2 = map(int,input().split())
 
num3 = num1 + num2
num4 = num1 - num2
num5 = num1 * num2
num6 = [num3, num4, num5]
 
print(max(num6))

Buggy submission (verdict: Runtime Error):
num1,num2 = map(int,input(),split())

 
num3 = num1 + num2
num4 = num1 - num2
num5 = num1 * num2
num6 = [num3, num4, num5]
 
print(max(num6))

Buggy submission (verdict: Runtime Error):
num1,num2 = map(int,input(),split())
while str(num1).isdigit() == False:

    

num3 = int(num1) + int(num2)
num4 = int(num1) - int(num2)
num5 = int(num1) * int(num2)
num6 = [num3, num4, num5]
 
print(max(num6))

Buggy submission (verdict: Runtime Error):
num1 = input("数字を入力してください")
while str(num1).isdigit() == False:
    print("error")
    num1 = input("数字を入力してください")
    
num2 = input("数字を入力してください")
while str(num2).isdigit() == False:
    print("error")
    num2 = input("数字を入力してください")
    
num3 = int(num1) + int(num2)
num4 = int(num1) - int(num2)
num5 = int(num1) * int(num2)
num6 = [num3, num4, num5]

if -100 < int(num1) < 100 and -100 < int(num2) < 100:
    print(max(num6))

Buggy submission (verdict: Runtime Error):
num1 = int(input())
num2 = int(input())
num3 = num1 + num2
num4 = num1 - num2
num5 = num1 * num2
num6 = [num3, num4, num5]
print(max(num6))

Buggy submission (verdict: Runtime Error):
num1 = int(input())
num2 = int(input())
num3 = num1 + num2
num4 = num1 - num2
num5 = num1 * num2
num6 = [num3, num4, num5]
print(max(num6))
Problem p02995 (python)

Fixed submission:
def gcd(a, b):
    while b != 0:
        a, b = b, a % b
    return a

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

A, B, C, D = map(int, input().split())

sa = B - A + 1

C2 = (B // C) - ((A - 1) // C)
D2 = (B // D) - ((A - 1) // D)

CD = lcm(C, D)

CD2 = (B // CD) - ((A - 1) // CD)

print(sa - (C2 + D2 - CD2))

Buggy submission (verdict: Runtime Error):
import math

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

A, B, C, D = map(int, input().split())

sa = B - A + 1

C2 = (B // C) - ((A - 1) // C)
D2 = (B // D) - ((A - 1) // D)

CD = lcm(C, D)

CD2 = (B // CD) - ((A - 1) // CD)

print(sa - (C2 + D2 - CD2))
Problem p02996 (python)

Fixed submission:
import numpy as np

N = int(input())
task = []
for i in range(N):
    a, b =map(int, input().split())
    task.append([a, b])

task = np.array(task)
task = task[np.argsort(task[:, 1])]

time = 0
for i in range(N):
    time += task[i, 0]
    if time > task[i, 1]:
        print("No")
        exit()

print("Yes")

Buggy submission (verdict: Runtime Error):
import numpy as np

N = int(input())
task = []
for i in range(N):
    a, b =map(int, input().split())
    task.append([a, b])

task = np.array(task)
task = task[np.argsort(task[:, 1])]

time = 0
for i in range(N):
    time += task[i, 0]
    if time > task[i, 1]:
        print("No")
        exit()

print("Yes")
Problem p03076 (python)

Fixed submission:
M = [int(input()) for i in range(5)]

a = [((i - 1) // 10 + 1) * 10 for i in M]
b = [(i - 1) % 10 for i in M]

ans = sum(a) + min(b) - 9
print(ans)

Buggy submission (verdict: Runtime Error):
M = []
for i in range(5):
  M.append(int(input()))

T = M[:]
tmp = 10
for i in range(5):
  if tmp > M[i] % 10 > 0:
    tmp = M[i] % 10
    c = i
  M[i] = ((M[i] - 1) // 10 + 1) * 10
M[c] = T[c]
print(sum(M))

Buggy submission (verdict: Runtime Error):
M = [int(input()) for i in range(5)]
T = M[:]
tmp = 10
for i in range(5):
    if tmp > M[i] % 10 > 0:
        tmp = M[i] % 10
        c = i
    M[i] = ((M[i] - 1) // 10 + 1) * 10
M[c] = T[c]
print(sum(M))

Buggy submission (verdict: Runtime Error):
M = [int(input()) for i in range(5)]
T = M[:]
tmp = 10
for i in range(5):
  if tmp > M[i] % 10 > 0:
    tmp = M[i] % 10
    c = i
  if M[i] % 10 != 0:
    M[i] += 10 - (M[i] % 10)
M[c] = T[c]
print(sum(M))

Buggy submission (verdict: Runtime Error):
M = [int(input()) for i in range(5)]
tmp = 10
for i in range(5):
  if tmp > M[i] % 10 > 0:
    tmp = M[i] % 10
    c = i
for i in range(5):
  if i != c and M[i] % 10 != 0:
    M[i] += 10 - (M[i] % 10)
print(sum(M))
Problem p03447 (python)

Fixed submission:
x = int(raw_input())
a = int(raw_input())
b = int(raw_input())
left = x - a
print left % b

Buggy submission (verdict: Runtime Error):
prices = map(int, raw_input())
left = prices[0] - prices[1]
print left % prices[2]
Problem p02945 (python)

Fixed submission:
#!/usr/bin/env python3
import sys


def solve(A: int, B: int):
    print(max(A+B, A-B, A*B))


def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    A = int(next(tokens))  # type: int
    B = int(next(tokens))  # type: int
    solve(A, B)

if __name__ == '__main__':
    main()

Buggy submission (verdict: Runtime Error):
import sys
 
def solve(N: int, M: int, P: int, A: "List[int]", B: "List[int]", C: "List[int]"):
    dist = [sys.maxsize] * (N + 1)
 
    dist[1] = 0
    for _ in range(N):
        for j in range(M):
            weight = -(C[j] - P)
            if dist[B[j]] > dist[A[j]] + weight:
                dist[B[j]] = dist[A[j]] + weight
 
    result = -dist[N]
 
    for _ in range(N + 1):
        for j in range(M):
            weight = -(C[j] - P)
            if dist[B[j]] > dist[A[j]] + weight:
                dist[B[j]] = dist[A[j]] + weight
 
    if result != -dist[N]:
        print(-1)
    else:
        print(max(-dist[N], 0))
 
 
# Generated by 1.1.4 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    N = int(next(tokens))  # type: int
    M = int(next(tokens))  # type: int
    P = int(next(tokens))  # type: int
    A = [int()] * (M)  # type: "List[int]"
    B = [int()] * (M)  # type: "List[int]"
    C = [int()] * (M)  # type: "List[int]"
    for i in range(M):
        A[i] = int(next(tokens))
        B[i] = int(next(tokens))
        C[i] = int(next(tokens))
    solve(N, M, P, A, B, C)
 
if __name__ == '__main__':
    main()
Problem p02947 (python)

Fixed submission:
#!/usr/bin/env python3
import sys
from collections import Counter
from scipy.misc import comb

def solve(N: int, s: "List[str]"):
    print(sum([comb(v, 2, exact=True) for v in Counter(s).values()]))

def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    N = int(next(tokens))  # type: int
    s = [ ' '.join(sorted(next(tokens))) for _ in range(N) ]  # type: "List[str]"
    solve(N, sorted(s))

if __name__ == '__main__':
    main()

Buggy submission (verdict: Runtime Error):
#!/usr/bin/env python3
import sys
from collections import Counter
from scipy.special import comb

def solve(N: int, s: "List[str]"):
    print(sum([comb(v, 2, exact=True) for v in Counter(s).values()]))

def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    N = int(next(tokens))  # type: int
    s = [ ' '.join(sorted(next(tokens))) for _ in range(N) ]  # type: "List[str]"
    solve(N, sorted(s))

if __name__ == '__main__':
    main()

Buggy submission (verdict: Runtime Error):
#!/usr/bin/env python3
import sys
from collections import Counter
from scipy.special import comb

def solve(N: int, s: "List[str]"):
    print(sum([comb(v, 2, exact=True) for v in Counter(s).itervalues()]))

def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    N = int(next(tokens))  # type: int
    s = [ ' '.join(sorted(next(tokens))) for _ in range(N) ]  # type: "List[str]"
    solve(N, sorted(s))

if __name__ == '__main__':
    main()