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

Fixed submission:
N,M=map(int,input().split())
f=[set() for i in range(N)]
v=[False]*N
g=[]

for i in range(0,M):
    a,b=map(int,input().split())
    a-=1
    b-=1
    f[a].add(b)
    f[b].add(a)

for i in range(0,N):
    if v[i]:
        continue
    s=set()
    q=[i]
    while len(q)>0:
        p=q.pop()
        v[p]=True
        s.add(p)
        for x in f[p]:
            if v[x]:
                continue
            q.append(x)
    g.append(s)

z=0
for x in g:
    z=max(z,len(x))

print(z)

Buggy submission (verdict: Runtime Error):
from UnionFind import UnionFind as UF

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

uf = UF(N)

for i in range(M):
    a,b=map(int,input().split())
    a-=1
    b-=1
    uf.union(a,b)

z=0
c=[0]*N
for i in range(N):
    p=uf.root(i)
    c[p]+=1
    if z<c[p]:
        z=c[p]

print(z)
Problem p02574 (python)

Fixed submission:
from math import gcd

N = int(input())
A = list(map(int, input().split()))

# setwise validation
tmp = 0
for a in A:
    tmp = gcd(tmp, a)
isSetwise = (tmp == 1)

# pairwise validation
M = 10 ** 6
sieve = [0] * (M + 1)
for a in A:
    sieve[a] += 1

cnt = 0
isPairwise = True
for i in range(2, M + 1):
    isPairwise &= (sum(sieve[j] for j in range(i, M + 1, i)) <= 1)

# check
if isPairwise:
    ans = 'pairwise coprime'
elif isSetwise:
    ans = 'setwise coprime'
else:
    ans = 'not coprime'
print(ans)

Buggy submission (verdict: Runtime Error):
import math
from collections import defaultdict

N=int(input())
A=list(map(int,input().split()))
A=list(set(A))

M= 10**6 +1
S = [1] *M
for i in range(2, M):
    if S[i] == 1:
        for j in range(i, M, i):
            if S[j] == 1:
                S[j] = i

isPairwise = True
f = [0] *M
for i in range(0, N):
    p = S[A[i]]
    if f[p] > 0:
        isPairwise = False
        break
    f[p] += 1

gcd=A[0]
for i in range(1, N):
    gcd = math.gcd(gcd, A[i])
isSetwise = (gcd == 1)

if isPairwise:
    z = 'pairwise coprime'
elif isSetwise:
    z = 'setwise coprime'
else:
    z = 'not coprime'
print(z)

Buggy submission (verdict: Runtime Error):
import math
from collections import defaultdict

N=int(input())
A=list(map(int,input().split()))
A=(list(set(A)))

M= 10**6 +1
S = [1] *M
for i in range(2, M):
    if S[i] == 1:
        for j in range(i, M, i):
            if S[j] == 1:
                S[j] = i

isPairwise = True
f = [0] *M
for i in range(0, N):
    p = S[A[i]]
    if f[p] > 0:
        isPairwise = False
        break
    f[p] += 1

gcd=A[0]
for i in range(1, N):
    gcd = math.gcd(gcd, A[i])
isSetwise = (gcd == 1)

if isPairwise:
    z = 'pairwise coprime'
elif isSetwise:
    z = 'setwise coprime'
else:
    z = 'not coprime'
print(z)

Buggy submission (verdict: Runtime Error):
import math
N=int(input())
A=list(map(int,input().split()))
ans1 = A[0]
ans2 = 0
f = True
for i in range(1, N):
    ans1 = math.gcd(ans1, A[i])
    for j in range(i+1, N):
        ans2 = math.gcd(A[i-1],A[j-1])
        if (ans2 > 1):
            f = False
            break
    if f==False and ans !=1:
        break


if f:
    print('pairwise coprime')
else:
    if ans1==1:
        print('setwise coprime')
    else:
        print('not coprime')
Problem p03160 (python)

Fixed submission:
from collections import defaultdict
dp = defaultdict(lambda:int(10**9))

N = int(input())
L = list(map(int, input().split()))
dp[0] = 0
for i in range(0, N):
    if i+1 < N:
        dp[i+1] = min(dp[i+1], dp[i] + abs(L[i+1] - L[i]))
        if i+2 < N:
            dp[i+2] = min(dp[i+2], dp[i] + abs(L[i+2] - L[i]))

print(dp[N-1])

Buggy submission (verdict: Runtime Error):
'''
in
-----
7
2
9
4
5
1
6
10
'''
'''
out
-----
8
'''
from collections import defaultdict
dp = defaultdict(lambda:int(10**9))

N = int(input())
L = [0] * (N +2)
dp[0] = 0
for i in range(0, N):
    L[i] = int(input())

for i in range(0, N):
    dp[i+1] = min(dp[i+1], dp[i] + abs(L[i+1] - L[i]))
    dp[i+2] = min(dp[i+2], dp[i] + abs(L[i+2] - L[i]))

print(dp[N-1])
Problem p04043 (python)

Fixed submission:
x = input().split()
fn = 0
sn = 0
 
for i in range(len(x)):
  if int(x[i]) == 5:
    fn += 1
  elif int(x[i]) == 7:
    sn += 1
 
if fn == 2:
  if sn == 1:
    print("YES")
  else:
    print("NO")
else:
  print("NO")

Buggy submission (verdict: Runtime Error):
x = input().split()
fn = 0
sn = 0

for i in range(len(x)):
  if int(x[i]) == 5:
    fn += 1
  elif int(x[i]) == 7:
    sn += 1

if fn = 2:
  if sn = 5:
    print("YES")
  else:
    print("NO")
else:
  print("NO")

Buggy submission (verdict: Runtime Error):
x = input().stlip()
fn = 0
sn = 0

for i in range(len(x)):
  if int(x[i]) == 5:
    fn += 1
  elif int(x[i]) == 7:
    sn += 1

if fn = 2:
  if sn = 5:
    print("YES")
  else:
    print("NO")
else:
  print("NO")
Problem p02765 (python)

Fixed submission:
N , R = tuple(list(map(int, input().split(' '))))
if N >= 10:
    print(R)
else:
    print(R + 100 * (10 - N))

Buggy submission (verdict: Runtime Error):
N , R = tuple(input().split(' '))
if N >= 10:
    print(R)
else:
    print(10 - (R / 100))
Problem p02548 (python)

Fixed submission:
n=int(input())
ans=0
for a in range(1, n):
    ans+=(n - 1)//a
print(ans)

Buggy submission (verdict: Runtime Error):
import math
import sympy
n=int(input())
ans=0
for i in range(1,n):
    ans+=len(sympy.divisors(n-i))
print(ans)
Problem p02553 (python)

Fixed submission:
a,b,c,d=map(int,input().split())
print(max(a*d,a*c,b*c,b*d))

Buggy submission (verdict: Runtime Error):
a,b,c,d=map(int,input().split())
if a*b<=0 and c*d<=0:
    print(max(a*c,b*d))
elif: b>0 and d>0    
    print(b*d)
else:
    print(a*c)
Problem p02639 (python)

Fixed submission:
A = [int(x) for x in input().split()]
num = 1
for i in A:
    if i == num:
        num += 1
    else:
        print(num)
        break

Buggy submission (verdict: Runtime Error):
X, Y = map(int, input().split())
if ((4*X - Y) < 0) or (6*X > Y) or ((4*X - Y)%2 != 0):
    print("No")
else:
    print("Yes")

Buggy submission (verdict: Runtime Error):
X, Y = map(int, input().split())
if (4*X - Y) < 0:
    print("No")
elif 6*X > Y:
    print("No")
elif (4*X - Y)%2 != 0:
    print("No")
else:
    print("Yes")
Problem p02657 (python)

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

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

#リスト内包表記
N = int(input())
A = [int(x) for x in input().split()]

#リストの総積を計算する
seki = np.prod(A)

#出力
if seki > 10**18:
    print("-1")
elif 0 in A:
    print("0")
else:
    print(seki)

Buggy submission (verdict: Runtime Error):
import operator

#リスト内包表記
N = int(input())
A = [int(x) for x in input().split()]

#リストの総積を計算する
seki = reduce(operator.mul, A, 1)

if seki > 10**18:
    print("-1")
else:
    print(seki)

Buggy submission (verdict: Runtime Error):
import operator

#リスト内包表記
N = int(input())
A = [int(x) for x in input().split()]

#リストの総積を計算する
seki = reduce(operator.mul, a, 1)

if seki > 10**18:
    print("-1")
else:
    print(seki)
Problem p02675 (python)

Fixed submission:
N=int(input())
if N%10==3:
    print("bon")
elif N%10==0 or N%10==1 or N%10==6 or N%10==8:
    print("pon")
else:
    print("hon")

Buggy submission (verdict: Runtime Error):
N = int(input())
i = 0
goods = []
while i < N:
    goods.append(int(input()))
    i += 1

ans = sum(goods) - max(goods) + (max(goods) // 2)
print(ans)
Problem p02993 (python)

Fixed submission:
S = input()
ans = 0
i = 0
while i < 3:
    if S[i] == S[i+1]:
        print("Bad")
        ans += 1
        break
    i += 1
        
if ans == 0:
    print("Good")

Buggy submission (verdict: Runtime Error):
S = input()
if (S[0] != S[1]) and (S[1] != S[2]) and (S[2] != s[3]):
    print("Good")
else:
    print("Bad")

Buggy submission (verdict: Runtime Error):
S = input()
if S[0] != S[1] and S[1] != S[2] and S[2] != s[3]:
    print("Good")
else:
    print("Bad")
Problem p03139 (python)

Fixed submission:
n, a, b = map(int, input().split())
ans1 = min(a, b)
ans2 = max(0, a + b - n)
print(ans1, ans2)

Buggy submission (verdict: Runtime Error):
N,A,B=map(int, input().split())
#最大の数
x = min(A, B)
#最小
y = 0
        
if N < A+B:
    if A > B:
        y = A - B
    else:
        y = B - A

print(x + " " + y)
Problem p03289 (python)

Fixed submission:
import re
s=input()
if s[0]=="A" and "C" in s[2:-1] and len(re.findall('[A-Z]', s))==2:
    print("AC")
else:
    print("WA")

Buggy submission (verdict: Runtime Error):
s=input()
if s[0]=="A" and "C" in s[2:-1] and len(re.findall('[A-Z]', s))==2:
    print("AC")
else:
    print("WA")
Problem p03415 (python)

Fixed submission:
a=input()
b=input()
c=input()
print(a[0]+b[1]+c[2])

Buggy submission (verdict: Runtime Error):
a,b,c=input().split()
d,e,f=input().split()
g,h,i=input().split()
print(a+e+i)
Problem p02642 (python)

Fixed submission:
import numpy as np
n = int(input())
a = np.sort(np.array(list(map(int, input().split()))))
max_num = a[-1]+1
dp = np.array([0]*(max_num))

if n == 1:
    print(1)
elif np.all(a==a[0]):
    print(0)
elif np.count_nonzero(a==1)  == 1:
    print(1)
else:
    for i in a:
        for j in np.arange(i, max_num, i):
            dp[j] += 1
    print(np.count_nonzero(dp[a] == 1))

Buggy submission (verdict: Runtime Error):
import numpy as np
n = int(input())
a = np.sort(np.array(list(map(int, input().split()))))
max_num = np.max(a)+1
dp = np.array([True]*(max_num))

if np.all(a==a[0]):
    print(0)
else:
    for i in range(1,max_num):
        if dp[i] and i in a:
            for j in np.arange(i*2, max_num, i):
                dp[j] = False
        if np.count_nonzero(a==i) >1:
            dp[i] = False
    print(np.count_nonzero(dp[np.a] == True))

Buggy submission (verdict: Runtime Error):
import numpy as np
n = int(input())
a = np.sort(np.array([int(x) for x in input().split()]))[::-1]
count = 0
for index,i in enumerate(a):
    a_i = i%a[index:]
    if np.count_nonzero(a_i == 0)==1:
        count+=1
        
if a[-1] == a[-2]:
    count -= 1

print(count)
Problem p02647 (python)

Fixed submission:
import math
import numpy as np

n,k=(int(x) for x in input().split())
a = [int(x) for x in input().split()]


for _ in range(k):
    new_a = np.zeros(n+1,dtype=int)
    np.add.at(new_a, np.maximum(0,np.arange(0, n)-a), 1)
    np.add.at(new_a, np.minimum(n,np.arange(0, n)+a+1), -1)
    a = new_a.cumsum()[:-1]
    if np.all(a==n):
        break

print(" ".join([str(x) for x in a]))

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

n,k=(int(x) for x in input().split())
a = [int(x) for x in input().split()]

for _ in range(min(k,math.log(n, 10))):
    new_a = np.zeros(n)
    for j,l in enumerate(a):
        for i in range(-l,l+1):
            if j+i >= 0 and j+i<n:
                new_a[j+i]+=1
    a = new_a

print(" ".join([str(x) for x in a]))

Buggy submission (verdict: Runtime Error):
import math

n,k=(int(x) for x in input().split())
a = [int(x) for x in input().split()]

for x in range(min(k,math.log(n, 10))):
    new_a = [0]*n
    for j,l in enumerate(a):
        for i in range(-l,l+1):
            if j+i >= 0 and j+i<n:
                new_a[j+i]+=1
    a = new_a

print(" ".join([str(x) for x in a]))
Problem p02658 (python)

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

if 0 in l:
    ans = 0
else:
    n = min(N,len(l))
    ans = 1
    for i in l[:n]:
        ans *= i
        if ans > 10**18:
            ans = -1
            break
print(ans)

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

if 0 in l:
    ans = 0
else:
    n = min(N,len(l))
    ans = 1
    for i in l[:n]:
        ans *= i
        if ans > 10**18:
            ans = -1
            bre
print(ans)
Problem p02553 (python)

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

m=a*c

if a*d>m:
  m=a*d

if b*c>m:
  m=b*c

if b*d>m:
  m=b*d
  
print(m)

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

m=a*c

if a*d>m:
  m=a*d

if b*c>m:
  m=b*c

if b*d>m:
  m=b*d
  
print(m)
Problem p02608 (python)

Fixed submission:
n = int(input())

a = [0]*10001

for x in range(1, 101):
  for y in range(1, 101):
    for z in range(1,101):
        v = x*x+y*y+z*z+x*y+y*z+x*z
        if  v < 10001:
        	a[v] += 1
for i in range(n):
  print(a[i+1])

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

a = [0]*10000

for x in range(1, 100):
  for y in range(1, 100):
    for z in range(1,100):
        v = x*x+y*y+z*z+x*y+y*z+x*z
        if  v < 10000:
        	a[v] += 1
for i in range(n):
  print(a[i+1])

Buggy submission (verdict: Runtime Error):
n = int(input())
m = int(-1 + (n-2) ** 0.5) + 1
for i in range(1,n+1):
  cnt = 0
  for x in range(1, m):
    for y in range(1, m):
      if (x+y)**2-4*(x**2+y**2+x*y-i) >0:
        z = (-(x+y)+((x+y)**2-4*(x**2+y**2+x*y-i))**0.5)/2       
        if z%1 == 0 and z>0:            
          cnt += 1
      else:
        break
  print(cnt)

Buggy submission (verdict: Runtime Error):
n = int(input())
m = int(-1 + (n-2) ** 0.5) + 1
for i in range(1,n+1):
  cnt = 0
  for x in range(1, m):
    for y in range(1, m):
      if (x+y)**2-4*(x**2+y**2+x*y-i) >0:
        z = (-(x+y)+((x+y)**2-4*(x**2+y**2+x*y-i))**0.5)/2       
        if z%1 == 0 and z>0:            
          cnt += 1
      else:
        break
  print(cnt)

Buggy submission (verdict: Runtime Error):
n = int(input())
m = int(-1 + (n-2) ** 0.5) + 1
for i in range(n):
  cnt = 0
  for x in range(1, m):
    for y in range(1, m):
      for z in range(1, m):
        if x * x + y * y + z * z + x * y + y * z + z * x == i:
          cnt += 1
  print(cnt)
Problem p02621 (python)

Fixed submission:
a = int(input())
print(a + a**2 + a**3)

Buggy submission (verdict: Runtime Error):
a = int(input())
print(a + a**2 + a***a)
Problem p02797 (python)

Fixed submission:
n, k, s = map(int, input().split())

if s < 10**9:

  if k > 0: 
      aa = [s]*k + [s+1]*(n-k)
  elif k == 0:
      aa = [s+1]*n

else:
  aa =[s]*k + [1]*(n-k)

print(*aa)

Buggy submission (verdict: Runtime Error):
n, k, s = map(int, input().split())
if s != 10**9:
  if s % 2 == 0:
    a = [s//2]*(k+1)+[10**9]*(n-k-1)
  if s % 2 == 1:
    if k % 2 == 0:
      a = [s//2, s//2 + 1]*(k//2) +[s//2] +[10**9]*(n-k-1)
    else:
      a = [s//2, s//2 + 1]*(k//2+1) + [10**9]*(n-k-1)
else:
  if k % 2 == 0:
    a =[10**9,1]*k//2
  else:
    a =[10**9,1]*k//2 + [10**9]
print(*a)

Buggy submission (verdict: Runtime Error):
n, k, s = map(int, input().split())
if s != 10**9:
  if s % 2 == 0:
    a = [s//2]*(k+1)+[10**9]*(n-k-1)
  if s % 2 == 1:
    if k % 2 == 0:
      a = [s//2, s//2 + 1]*(k//2) +[s//2] +[10**9]*(n-k-1)
    else:
      a = [s//2, s//2 + 1]*(k//2+1) + [10**9]*(n-k-1)
else:
  if k % 2 == 0:
    a =[10**9,1]*k//2:
  else:
    a =[10**9,1]*k//2 + [10**9]
print(*a)
Problem p02802 (python)

Fixed submission:
n, m = map(int, input().split())
a = [input().split() for i in range(m)]
wa =[0]*n #ACまでのWA数
ac = [0]*n

for i in range(m):
    if a[i][1] == 'AC':
      ac[int(a[i][0])-1] = 1
    else:
      if ac[int(a[i][0])-1]==0:
        wa[int(a[i][0])-1] +=1
cnt1, cnt2= 0,0
for i in range(n):
  if ac[i] ==1:
    cnt1 += ac[i]
    cnt2 += wa[i]
        
print(cnt1, cnt2)

Buggy submission (verdict: Runtime Error):
N, M = map(int, input().split())
A = [input().split for i in range(M)]
cac = 0
cwa = 0

for i in range(1, N + 1):
    for a in A:
        while a[0] == str(i):
            if a[1] == 'WA':
                cwa += 1
            else:
                cac += 1
                break
        while a[0] == str(i):
            A.remove(a)
print(cac, cwa)
Problem p02882 (python)

Fixed submission:
import math
a, b, x = map(int, input().split())

if x == a**2*b:
  print(0)
  
elif x >= a**2*b/2:
  print(90 - math.degrees(math.atan(a**3/(2*a**2*b-2*x))))
else:
  
  print((90 - math.degrees(math.atan(2*x/(a*b**2)))))

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

if x == a**2*b:
  print(0)
  
if x >= a**2*b/2:
  print(90 - math.degrees(math.atan(a**3/(2*a**2*b-2*x))))
else:
  
  print((90 - math.degrees(math.atan(2*x/(a*b**2)))))

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

if x = a**2*b:
  print(0)
  
if x >= a**2*b/2:
  print(90 - math.degrees(math.atan(a**3/(2*a**2*b-2*x))))
else x < a**2*b/2:
  print((90 - math.degrees(math.atan(2*x/(a*b**2)))))

Buggy submission (verdict: Runtime Error):
import math
a, b, x = map(int, input().split())
if x > a**2*b/2:
  print(90 - math.degrees(math.atan(a**3/(2*a**2*b-2*x))))
elif x < a**2*b/2:
  print((90 - math.degrees(math.atan(2*x/(a*b**2)))))
else:
  print(0)

Buggy submission (verdict: Runtime Error):
import math
a, b, x = map(int, input().split())
if x > a**2*b/2:
  print(90 - math.degrees(math.atan(a**3/(2*a**2*b-2*x))))
elif x < a**2*b/2
  print((90 - math.degrees(math.atan(2*x/(a*b**2)))))
else:
  print(0)

Buggy submission (verdict: Runtime Error):
import math
a, b, x = map(int, input().split())
if x >= a**2*b/2:
  print(90 - math.degrees(math.atan(a**3/(2*a**2*b-2*x))))
else:
  print((90 - math.degrees(math.atan(2*x/(a*b**2)))))
Problem p02924 (python)

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

Buggy submission (verdict: Runtime Error):
def sum(n):
  if n <=0:
    return n
  return n + sum(n-1)
  
n = int(input())-1

print(sum(n))

Buggy submission (verdict: Runtime Error):
from functools import lru_cache

@ lru_cache(maxsize = None)
def sum(n):
  if n <= 0:
    return n
  return n + sum(n-1)
  
n = int(input())-1

print(sum(n))
Problem p02939 (python)

Fixed submission:
ss = input()

n = len(ss)
arrs = [ss[0]]

for i in range(1, n):
    if len(arrs[-1]) == 2:
        if arrs[-1].endswith(ss[i]):
            arrs.append('*')
        else:
            arrs.append(ss[i])

    else:
        if arrs[-1] == ss[i]:
            arrs.append(ss[i: i + 2])
        else:
            arrs.append(ss[i])

c = arrs.count('*')

if arrs[-1] == arrs[-2]:
    ans = len(arrs) - 1

else:
    ans = len(arrs)
print(ans - c)

Buggy submission (verdict: Runtime Error):
S = list(input())

a = S[0]
c = 1
while len(S) >1:
  if S[1] == a:
    if len(S) >2:
      a = S[1:3]
      S = [a] + S[3:]
      c += 1
    else:
      break
  else: 
    a = S[1]
    S = [a] + S[2:]
    c += 1
    print(S)
print(c)
Problem p03037 (python)

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


for i in range(M-1):
      L1, R1 = map(int, input().split())
      if R1 < L or R < L1:
        print(0)
        exit()
      else:
        if L <= L1 <= R:
          L = L1
          
        elif L <= R1 <= R:
          R = R1
        
          
print(R-L+1)

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


L, R = map(int, input().split())
ar = [i for i in range(L, R+1)]
for i in range(M-1):
      L, R = map(int, input.split())
      if ar[-1] < L or ar[0] > R:
        break
      else:
        if ar[0] < L < ar[-1]:
          ar = [x for x in range(L, ar[-1]+1)]
        elif ar[0] < R <ar[-1]:
          ar = [x for x in range(ar[0], R+1)]
print(len(ar))
Problem p03086 (python)

Fixed submission:
s = list(input())
count = 0
list1 = []
for x in s:
  if x == 'A' or x == 'G' or x == 'T' or x == 'C':
    count = count + 1
  list1.append(count)
  if x != 'A' and x != 'G' and x != 'T' and x != 'C':
    count = 0
    

print(max(list1))

Buggy submission (verdict: Runtime Error):
s = list(input())
count = 0
list1 = []
for x in s:
  if x == 'A' or x == 'G' or x == 'T' or x == 'C':
    count = count + 1
  else:
    list1.append(count)
    count = 0
    
print(max(list1))
Problem p03282 (python)

Fixed submission:
S = input()
K = int(input())
count = 0

if S[0] != '1':
  print(S[0])
  exit()

for i in range(len(S)):
    if S[i] == '1':
      count += 1
    else:
      break

if count >= K:
  print(1)
else:
  print(S[count])

Buggy submission (verdict: Runtime Error):
S = input()
K = int(input())

if S[0] == '1':
  count  = 0
  while S[i] == '1':
    count += 1
  if count >= K:
    print(1)
  else:
    print(S[count])
else:
  print(S[0])

Buggy submission (verdict: Runtime Error):
S = input()
K = int(input())

if S[0] == '1':
  print(S[1])
else:
  print(S[0])
Problem p03324 (python)

Fixed submission:
D, N = map(int, input().split())
if N != 100:
  if D == 0:
    print(N)
  elif D == 1:
    x = [100 * i for i in range(1, 101)]
    print(x[N-1])
  elif D == 2:
    x = [10000 * i for i in range(1, 101)]
    print(x[N-1])
else:
  if D == 0:
    print(101)
  elif D == 1:
    x = [100 * i for i in range(1, 101)]
    print(x[N-1]+100)
  elif D == 2:
    x = [10000 * i for i in range(1, 101)]
    print(x[N-1]+10000)

Buggy submission (verdict: Runtime Error):
D, N = map(int, input().split())
if D == 0:
  print(N)
elif D == 1:
  x = [100 * i for i in range(1,101)]
  print(x[N])
elif D == 2:
  x = [10000 * i for i in range(1,101)]
  print(x[N])

Buggy submission (verdict: Runtime Error):
D, N = map(int, input().split())
if D == 0:
  print(N)
elif D == 1:
  x = [100 * i for i in range(100)]
  print(x[N])
elif D == 2:
  x = [10000 * i for i in range(100)]
  print(x[N])
Problem p03408 (python)

Fixed submission:
import collections

N = int(input())
S = [input() for i in range(N)]
cS = collections.Counter(S)
lS = list(cS.items())
M = int(input())
T = [input() for i in range(M)]
cT = collections.Counter(T)
list1 = []
ans = 0

for i in range(len(lS)):
    
    if lS[i][0] in cT:
        x = lS[i][1] - cT[lS[i][0]]
        
    else:
        x = lS[i][1]
        
    if x > 0:
        list1.append(x)
    
if list1 == []:
  print(0)
else:
  print(max(list1))

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

T1 = [x+'*' for x in T]
arr = S + T1
list1 = []
for i in range(len(arr)):
  if arr[i] not

list2 = [] in list2:
    s = arr.count(arr[i])
    t = arr.count(arr[i]+'*')
    a = s-t
    list1.append((arr[i], a))
    list2.append(arr[i])

for i in list1:
  
  if i[0].endswith('*'):
    list1.remove(i)
  print(list1)

ans1 = max(list1, key= lambda x:x[1])

if int(ans1[1]) <= 0:
  print(0)
else:
  print(ans1[1])
Problem p03419 (python)

Fixed submission:
n, m = map(int, input().split())
if n > 2 and m > 2:
  ans = (n-2)*(m-2)
elif n == 2 or m == 2:
  ans = 0
elif n == 1 and m == 1:
  ans = 1
elif n == 1:
  ans = m - 2
elif m == 1:
  ans = n - 2

print(ans)

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

aa = [[1]*(m + 2) for i in range(n+2)]

for i in range(1, n+1):
  for j in range(1, m+1):
    aa[i][j-1] *= -1
    aa[i][j] *= -1
    aa[i][j+1] *= -1
    aa[i-1][j-1] *= -1
    aa[i-1][j] *= -1
    aa[i-1][j+1] *= -1
    aa[i+1][j-1] *= -1
    aa[i+1][j] *= -1
    aa[i+1][j+1] *= -1
aa = aa[1:-1]
bb = [b[1:-1] for b in aa]
cc = [x  for y in bb for x in y]
ans = cc.count(-1)

print(ans)
Problem p03427 (python)

Fixed submission:
import math
n = int(input())
k = int(math.log10(n))

a = n // (10 ** k)
b = n % (10 ** k)

if k == 0:
  ans = n
elif n % 10 == 9:
  ans = k * 9 + a
else:
  ans = k * 9 + a -1

print(ans)

Buggy submission (verdict: Runtime Error):
import math
n = int(input())
ln = int(math.log10(n))
#1つ下の桁がない場合
if ln == 0:
  print(n)
#全ての桁が9の場合
elif (n+1) % (10 ** (ln + 1)) == 0:
  print(9 * (ln + 1))
#それ以外
else:
  a = n // (10 ** ln)
  b = a * (10 ** ln )- 1
  c = [int(x) for x in list(str(b))]

  print(sum(c))

Buggy submission (verdict: Runtime Error):
import math
n = int(input())
ln = int(math.log10(n))
if ln == 0:
  print(n)
else:
  a = n // (10 ** ln)
  b = a * (10 ** ln )- 1
  c = [int(x) for x in list(str(b))]

  print(sum(c))

Buggy submission (verdict: Runtime Error):
import math
n = int(input())
ln = int(math.log10(n))
a = n // (10 ** ln)
b = a * 10 ** ln - 1
c = [int(x) for x in list(str(b))]

print(sum(c))