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

Fixed submission:
K,X=map(int,input().split())
for i in range (X-K+1,X+K):
    print(i)

Buggy submission (verdict: Runtime Error):
K,X=map(int,input().split())
for i in range (X-K+1,X+K-1)
    print(i)
Problem p02952 (python)

Fixed submission:
N=int(input())
import math
if 0<=math.log10(N)<1:
  print(N)
elif 1<=math.log10(N)<2:
  print(9)
elif 2<=math.log10(N)<3:
  print(N-90)
elif 3<=math.log10(N)<4:
  print(909)
elif 4<=math.log10(N)<5:
  print(N-9090)
elif 5<=math.log10(N):
  print(90909)

Buggy submission (verdict: Runtime Error):
N=int(input())
import math
if 0<=math.log10(N)<1:
  print(N)
elif 1<=math.log10(N)<2:
  print(9)
elif 2<=math.log10(N)<3:
  print(N-90)
elif 3<=math.log10(N)<4:
  print(909)
elif 4<=math.log10(N)<5:
  print(N-9090)
elif:
  print(90909)
Problem p02969 (python)

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

Buggy submission (verdict: Runtime Error):
N,D=map(int,input().split())
a=0
while a*((2*D)+1)<N:
    a=a+1
print(a)
Problem p02981 (python)

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

Buggy submission (verdict: Runtime Error):
N,A,B=input().split(",")
if (N*A) > B
  print (B)
else:
  print(N*A)

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

if N*A>B:
  print (B)
else: 
  print (N*A)

Buggy submission (verdict: Runtime Error):
N= int(input())
A= int(input())
B= int(input())
C= N*A
if C>B:
  print (B)
else: 
  print (C)

Buggy submission (verdict: Runtime Error):
N= int(input('N='))
A= int(input('A='))
B= int(input('B='))
C= N*A
if C>B:
  print (B)
else: 
  print (C)

Buggy submission (verdict: Runtime Error):
N= int(input)
A= int(input)
B= int(input)
C= N*A
if C>B:
  print (B)
else: 
  print (C)

Buggy submission (verdict: Runtime Error):
N= int(input)
A= int(input)
B= int(input)
if A*N>B:
  print(B)
else: 
  print(A*N)
Problem p03001 (python)

Fixed submission:
W,H,x,y = map(int, input().split())
print(W*H/2)
if W==2*x  and H==2*y:
  print(1)
else:
  print(0)

Buggy submission (verdict: Runtime Error):
W,H,x,y = map(int, input().split())
print(W*H/2)
if W==2*x  and H=2*y:
  print(1)
else:
  print(0)
Problem p03147 (python)

Fixed submission:
N=int(input())
h=list(map(int,input().split()))
p=h[0]
for i in range(N-1):
  if p<h[i+1]:
    p=h[i+1]
  else:
    p=p
 
q=1
r=0
if p==0:
    print(0)
else:
    while q<=p:
        if h[0]>=q:
            r=r+1
        else:
            r=r
        for i in range(N-1):
              if h[i]<q and h[i+1]>=q:
                r=r+1
              else:
                r=r
        q=q+1
    print(r)

Buggy submission (verdict: Runtime Error):
N=int(input())
h=list(map(int,input().split()))
p=h[0]
for i in range(N-1):
  if h[i]<h[i+1]:
    p=h[i+1]
  else:
    p=p

q=1
r=0
if p==0:
    print(0)
else:
   while q<=p:
        if h[0]>=q:
            r=r+1
        else:
            r=r
        for i in range(N-1):
              if h[i]<q and h[i+1]>=q:
                r=r+1
              else:
                r=r
    q=q+1

print(r)
Problem p03238 (python)

Fixed submission:
if(int(input())==1):
    print("Hello World")
else:
    a=int(input())
    b=int(input())
    print(a+b)

Buggy submission (verdict: Runtime Error):
if(int(input())==1):
    print("Hello World")
else:
    a,b=map(int,input().split())
    print(a+b)

Buggy submission (verdict: Runtime Error):
n=int(input())
if n==1:
    print("Hello World")
elif n==2:
    a,b=map(int,input().split())
    print(a+b)
Problem p03241 (python)

Fixed submission:
import sys
n,m=map(int,input().split())
if n==1:
    print(m)
    sys.exit()
ans=[]
i=int(1)
while i<=m/i:
    if m%i!=0:
        i+=1
    elif m%i==0:
        j=int(m/i)
        if j>=n:
            ans.append(i)
        if i>=n:
            ans.append(j)
        i+=1
ans.sort()
print(ans[len(ans)-1])

Buggy submission (verdict: Runtime Error):
import sys
n,m=map(long,input().split())
if n==1:
    print(m)
    sys.exit()
ans=[]
i=1
while i<=m/i:
    if m%i:
        i=i+1
    else:
        j=m/i
        if j>=n:
            ans.append(i)
        if i>=n:
            ans.append(j)
        i=i+1
ans.sort()
print(ans[len(ans)-1])
Problem p02630 (python)

Fixed submission:
N = int(input())
A = list(map(int, input().split()))
Q = int(input())
A_cnt = [0] * 100001
A_sum = 0

# 各数値の数を数えておく
for a in A:
    A_cnt[a]+=1
    # ついでに現時点の総和も出しておく
    A_sum+=a

for _ in range(Q):
    B, C = map(int, input().split())
    A_cnt[C] = A_cnt[C] + A_cnt[B]
    A_sum = A_sum + ((C-B) * A_cnt[B])
    A_cnt[B] = 0
    print(A_sum)

Buggy submission (verdict: Runtime Error):
N = int(input())
A = list(map(int, input().split()))
Q = int(input())
A_cnt = [0] * 100000
A_sum = 0

for a in A:
    A_cnt[a]+=1

for _ in range(Q):
    B, C = map(int, input().split())
    A_cnt[C] = A_cnt[C] + A_cnt[B]
    A_cnt[B] = 0

    for i, x in enumerate(A_cnt):
        if A_cnt[i] > 0:
            A_sum = A_sum + (i * A_cnt[i])
    print(A_sum)
    A_sum = 0

Buggy submission (verdict: Runtime Error):
N = int(input())
A = list(map(int, input().split()))
Q = int(input())
A_cnt = [0] * 10000
A_sum = 0

for a in A:
    A_cnt[a]+=1

for _ in range(Q):
    B, C = map(int, input().split())
    A_cnt[C] = A_cnt[C] + A_cnt[B]
    A_cnt[B] = 0

    for i, x in enumerate(A_cnt):
        if A_cnt[i] > 0:
            A_sum = A_sum + (i * A_cnt[i])
    print(A_sum)
    A_sum = 0
Problem p02646 (python)

Fixed submission:
# A V
# B W
# T
A, V = map(int, input().split())
B, W = map(int, input().split())
T = int(input())

if (V-W)*T >= abs(B-A):
    print('YES')
else:
    print('NO')

Buggy submission (verdict: Runtime Error):
# A V
# B W
# T
A, V = map(int, input().split())
B, W = map(int, input().split())
T = int(input())

if (V-W)*T >= B-A and (B-A) % (V-W) == 0 or (W-V)*T >= A-B and (A-B) % (W-V) == 0:
    print('YES')
else:
    print('NO')

Buggy submission (verdict: Runtime Error):
# A V
# B W
# T
A, V = map(int, input().split())
B, W = map(int, input().split())
T = int(input())

if (V-W)*T >= B-A and (B-A) % (V-W) == 0:
    print('YES')
else:
    print('NO')
Problem p02675 (python)

Fixed submission:
N = int(input())
if N % 10 in [2, 4, 5, 7, 9]:
	print('hon')
elif N % 10 in [0, 1, 6, 8]:
	print('pon')
elif N % 10 in [3]:
	print('bon')

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

if len(S) <= K:
	print(S)
elif len(S) > K:
	print(S[:K]+'...')
Problem p02681 (python)

Fixed submission:
S = input()
T = input()

if S == T[:-1]:
	print("Yes")
else:
	print("No")

Buggy submission (verdict: Runtime Error):
A, B, C, K = map(int, input().split())
sum = 0

if K >= A:
	sum = sum + A
	K = K - A
else:
	sum = K
	K = 0
if K >= B and K >= 1:
	K = K - B
else:
	K = 0
if K >= 1:
	sum = sum - K
	K = K - K

if sum >= 1:
	print(sum)
else:
	print(0)

Buggy submission (verdict: Runtime Error):
A, B, C, K = map(int, input().split())
sum = 0

if K >= A:
	sum = A
	K = K - A
else:
	sum = K
	K = 0
if K >= B and K >= 1:
	K = K - B
else:
	K = 0
if K >= C and K >= 1:
	sum = sum - C
else:
	sum = sum - K

if sum >= 1:
	print(sum)
else:
	print(0)
Problem p02700 (python)

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

while True:
  c = c - b
  if c <= 0:
    print("Yes")
    break
  a = a - d
  if a <= 0:
    print("No")
    break

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

while:
  c = c - b
  if c <= 0:
    print("Yes")
    break
  a = a - d
  if a <= 0:
    print("No")
    break

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

while:
  c = c - b
  if c <= 0:
    print("Yes")
    break
  a = a - d
  if a <= 0:
    print("No")
    break

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

while:
  c = c - b
  if c <= 0:
    print('Yes')
    break
  a = a - d
  if a <= 0:
    print('No')
    break
Problem p03126 (python)

Fixed submission:
# N：人数 M：種類
# K1：個 A1 A2 ...：好きな食べ物の数字
# K2 A1 A2
# 全員が好きな食べ物の種類数

N, M = map(int, input().split())
s = set(range(1, M+1))

for _ in range(N):
    k, *a = map(int, input().split())
    s&=set(a)
print(len(s))

Buggy submission (verdict: Runtime Error):
# N：人数 M：種類
# K1：個 A1 A2 ...：好きな食べ物の数字
# K2 A1 A2
# 全員が好きな食べ物の種類数

N, M = map(int, input().split())
s = set(range(1, M+1))

for _ in range(N):
    k, *a = map(int, input().split())
    if len(s) == 0:
        s = a
    s&=set(a)
print(len(s))
Problem p03556 (python)

Fixed submission:
import math as chokudai
N = int(input())
print(int(chokudai.sqrt(N))*int(chokudai.sqrt(N)))

Buggy submission (verdict: Runtime Error):
N = int(input())
print(int(sqrt(N))*int(sqrt(N)))
Problem p03573 (python)

Fixed submission:
import sys as cghavcjhcbejwcbbsmbcjsdbcjdcadhbcjbdsjjcdjabjadbjsbcjdsbcsbcnsbcdnbcmbcmdabcdbjwhckfmknvskndleccdajbubcrjhebuoqbjhbjcdnaaayruegfubefruebhvy38bjhbvvbhcba
A,B,C = map(int,cghavcjhcbejwcbbsmbcjsdbcjdcadhbcjbdsjjcdjabjadbjsbcjdsbcsbcnsbcdnbcmbcmdabcdbjwhckfmknvskndleccdajbubcrjhebuoqbjhbjcdnaaayruegfubefruebhvy38bjhbvvbhcba.stdin.readline().split())

if A == B:
  print(C)
elif A == C:
  print(B)
else:
  print(A)

Buggy submission (verdict: Runtime Error):
A,B,C = map(int,input().split())

if A == B:
  print(C)
else if A == C:
  print(B)
else:
  print(A)

Buggy submission (verdict: Runtime Error):
import sys as chokudairedcoderatcoderowner
A,B,C = map(int,input().split())

if A == B:
  print(C)
else if A == C:
  print(B)
else:
  print(A)

Buggy submission (verdict: Runtime Error):
import sys as chokudairedcoderatcoderowner
A,B,C = map(int,chokudairedcoderatcoderowner.stdin.readline().split())

if A == B:
  print(C)
else if A == C:
  print(B)
else:
  print(A)

Buggy submission (verdict: Runtime Error):
import sys as chokudairedcoderatcoderowner
A,B,C = map(int,chokudairedcoderatcoderowner.stdin.readline())

if A == B:
  print(C)
else if A == C:
  print(B)
else:
  print(A)
Problem p02678 (python)

Fixed submission:
from collections import deque
import sys
input = sys.stdin.readline
n, m = map(int, input().split())
edges = [[]for _ in range(n)]
for _ in range(m):
    a, b = map(lambda x: int(x)-1, input().split())
    edges[a].append(b)
    edges[b].append(a)

next_v = deque([0])
prev = [-1]*n
while next_v:
    v = next_v.popleft()
    for v2 in edges[v]:
        if prev[v2] != -1:
            continue
        prev[v2] = v+1
        next_v.append(v2)

print('Yes')
for x in prev[1:]:
    print(x)

Buggy submission (verdict: Runtime Error):
from heapq import heappush, heappop

n, m = map(int, input().split())
edges = [[] for _ in range(n)]

for _ in range(n):
    a, b = map(int, input().split())
    a -= 1
    b -= 1
    edges[a].append(b)
    edges[b].append(a)

INF = 10**18
ans = []


def dijkstra(N, G, s):
    dist = [INF] * n
    que = [(0, s)]
    dist[s] = 0
    while que:
        c, v = heappop(que)
        if dist[v] < c:
            continue
        for t in G[v]:
            if dist[v] + 1 < dist[t]:
                dist[t] = dist[v] + 1
                heappush(que, (dist[t], t))
    ans.append(dist[0])


for i in range(1, n):
    dijkstra(n, edges, i)

if 0 in ans:
    print('No')
else:
    print('Yes')
    print(*ans, sep='\n')
Problem p02732 (python)

Fixed submission:
import collections
import math


n = int(input())
aa = list(map(int, input().split()))
ls = [0] * (n+1)

c = collections.Counter(aa)

for i, j in c.items():
    ls[i] = j*(j-1)//2

total = sum(ls)

for i in aa:
    before = (c[i]-1)*(c[i]-2) // 2
    print(total - ls[i] + before)

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


n = int(input())
aa = list(map(int, input().split()))
ls = [0] * (n-1)

c = collections.Counter(aa)

for i, j in c.items():
    ls[i] = j*(j-1)//2

total = sum(ls)

for i in aa:
    before = (c[i]-1)*(c[i]-2) // 2
    print(total - ls[i] + before)
Problem p02743 (python)

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

if c-a-b < 0:
    print('No')
    exit()
else:
    ans = 4*a*b < (c-a-b)**2

print('Yes' if ans else 'No')

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

if c-a-b < 0:
    print('No')
else:
    ans = 4*a*b < (c-a-b)**2

print('Yes' if ans else 'No')
Problem p02761 (python)

Fixed submission:
n, m = map(int, input().split())
ss = []
cc = []
num = []

for _ in range(m):
    s, c = map(int, input().split())
    ss.append(s)
    cc.append(c)

for i in range(1000):
    if len(str(i)) != n:
        continue
    cnt = 0
    for s, c in zip(ss, cc):
        if str(i)[s-1] == str(c):
            cnt += 1
    if cnt == len(ss):
        num.append(i)

if num:
    print(num[0])
else:
    print(-1)

Buggy submission (verdict: Runtime Error):
n, m = map(int, input().split())
ss = []
cc = []
num = []

for _ in range(m):
    s, c = map(int, input().split())
    ss.append(s)
    cc.append(c)

for i in range(1000):
    if len(str(i)) != m:
        continue
    cnt = 0
    for s, c in zip(ss, cc):
        if str(i)[s-1] == str(c):
            cnt += 1
    if cnt == len(ss):
        num.append(i)

if num:
    print(num[0])
else:
    print(-1)

Buggy submission (verdict: Runtime Error):
n, m = map(int, input().split())
ss = []
cc = []
num = []

for _ in range(m):
    s, c = map(int, input().split())
    ss.append(s)
    cc.append(c)

for i in range(1, 1000):
    if len(str(i)) != m:
        continue
    cnt = 0
    for s, c in zip(ss, cc):
        if str(i)[s-1] == str(c):
            cnt += 1
    if cnt == len(ss):
        num.append(i)

if num:
    print(min(num))
else:
    print(-1)
Problem p02909 (python)

Fixed submission:
s = input()
if s == 'Sunny':
    print('Cloudy')
elif s == 'Cloudy':
    print('Rainy')
else:
    print('Sunny')

Buggy submission (verdict: Runtime Error):
s = input()
if s == 'Sunny':
    print('Cloudy')
elif:
    s == 'Cloudy':
    print('Rainy')
else:
    print('Sunny')
Problem p02917 (python)

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

cnt = B[0] + B[-1]

for i in range(0, n-2):
    if B[i] > B[i+1]:
        cnt += B[i+1]
    else:
        cnt += B[i]

print(cnt)

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

cnt = B[0] + B[-1]

for i in range(0, n-2)
    cnt += min(B[i], B[i+1])

print(cnt)
Problem p02923 (python)

Fixed submission:
n = int(input())
H = list(map(int, input().split()))
cnt = 0
ans = 0

for i in range(n-1):
    if H[i] >= H[i+1]:
        cnt += 1
        ans = max(cnt, ans)
    else:
        cnt = 0

print(ans)

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

for i in range(n-1):
    if H[i] >= H[i+1]:
        cnt += 1
    else:
        cnt = 0
        continue
    ans = max(cnt, 0)

print(ans)

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

for i in range(n-1):
    if H[i] >= H[i+1]:
        cnt += 1
    else:
        cnt = 0
    ans = max(cnt, 0)

print(ans)
Problem p02936 (python)

Fixed submission:
import sys
input = sys.stdin.readline
sys.setrecursionlimit(10**7)

n, q = map(int, input().split())
edges = [[] for _ in range(n)]

for _ in range(n-1):
    a, b = map(int, input().split())
    a -= 1
    b -= 1
    edges[a].append(b)
    edges[b].append(a)

count = [0]*n
for i in range(q):
    p, x = map(int, input().split())
    count[p-1] += x


def dfs(v, parent):
    for v2 in edges[v]:
        if v2 == parent:
            continue
        count[v2] += count[v]
        dfs(v2, v)


dfs(0, None)
print(*count)

Buggy submission (verdict: Runtime Error):
import sys
input = sys.stdin.readline

n, q = map(int, input().split())
edges = [[] for _ in range(n)]

for _ in range(n-1):
    a, b = map(int, input().split())
    a -= 1
    b -= 1
    edges[a].append(b)
    edges[b].append(a)

count = [0]*n
for i in range(q):
    p, x = map(int, input().split())
    count[p-1] += x


def dfs(v, parent):
    for v2 in edges[v]:
        if v2 == parent:
            continue
        count[v2] += count[v]
        dfs(v2, v)


dfs(0, None)
print(*count)
Problem p02994 (python)

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

ls.remove(min(ls, key=abs))
print(sum(ls))

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

if l >= 0:
    ls.pop(0)
elif n >= abs(l):
    ls.pop(abs(l))
else:
    ls.pop(-1)

print(sum(ls))
Problem p02995 (python)

Fixed submission:
from fractions import gcd

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


def f(n):
    x = n//c
    x += n//d
    lcm = c*d//gcd(c, d)
    x -= n//lcm
    return n-x


print(f(b)-f(a-1))

Buggy submission (verdict: Runtime Error):
from math import gcd

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


def f(n):
    x = n//c
    x += n//d
    lcm = c*d//gcd(c, d)
    x -= n//lcm
    return n-x


print(f(b)-f(a-1))

Buggy submission (verdict: Runtime Error):
from math import gcd

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


def f(n):
    x = n//c
    x += n//d
    lcm = c*d/gcd(c, d)
    x -= n//lcm
    return n-x


print(f(b)-f(a-1))
Problem p03000 (python)

Fixed submission:
n, x = map(int, input().split())
L = list(map(int, input().split()))
D = [0]
cnt = 0

for i in range(n):
    cnt += L[i]
    if cnt <= x:
        D.append(cnt)

print(len(D))

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

for i in range(n+1):
    cnt += L[i]
    if cnt > x:
        print(i+1)
        exit()
Problem p03076 (python)

Fixed submission:
import math
ls = [int(input()) for _ in range(5)]
ans = 0
num = []

for i in ls:
    ans += math.ceil(i/10)*10
    if str(i)[-1] != '0':
        num.append(str(i)[-1])

if num:
    print(ans-10+min([int(i) for i in num]))
else:
    print(ans)

Buggy submission (verdict: Runtime Error):
import math
ls = [int(input()) for _ in range(5)]
ans = 0
num = []

for i in ls:
    ans += math.ceil(i/10)*10
    if str(i)[-1] != '0':
        num.append(str(i)[-1])

print(ans-10+min([int(i) for i in num]))
Problem p03238 (python)

Fixed submission:
n = int(input())
if n == 1:
    print('Hello World')
else:
    a, b = [int(input()) for _ in range(2)]
    print(a+b)

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

l = []

for i in range(N):
    a = list(map(int, input().split()))
    if a[1] <= T:
        l.append(a[0])

print('TLE' if len(l) == 0 else min(l))

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

l = []

for i in range(N):
    a = list(map(int, input().split()))
    if T >= a[1]:
        l.append(a[0])

print('TLE' if len(l) == 0 else min(l))

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

l = []

for i in range(N):
    a = list(map(int, input().split()))
    if T >= a[1]:
        l.append(a[0])

print('TLE' if len(l) == 0 else min(l))
Problem p03264 (python)

Fixed submission:
k = int(input())
n = k//2
print(n*(n+1) if k % 2 == 1 else n**2)

Buggy submission (verdict: Runtime Error):
k = int(input())
print((k//2)*((k+1)//2)
Problem p03266 (python)

Fixed submission:
n, k = map(int, input().split())
num = [0] * k
for i in range(1, n+1):
    num[i % k] += 1
ans = 0
for a in range(k):
    b = (k-a) % k
    c = (k-a) % k
    if ((b+c) % k != 0):
        continue
    ans += num[a] * num[b] * num[c]
print(ans)

Buggy submission (verdict: Runtime Error):
n, k = map(int, input().split())
num = [0] * n
for i in range(1, n+1):
    num[i % k] += 1
ans = 0
for a in range(k):
    b = (k-a) % k
    c = (k-a) % k
    if ((b+c) % k != 0):
        continue
    ans += num[a] * num[b] * num[c]
print(ans)

Buggy submission (verdict: Runtime Error):
n, k = map(int, input().split())
num = [0] * n
for i in range(1, n+1):
    num[i % k] += 1
ans = 0
for a in range(k):
    b = (k-a) % k
    c = (k-a) % k
    if ((b+c) % k != 0):
        continue
    ans += num[a] * num[b] * num[c]
print(ans)
Problem p03282 (python)

Fixed submission:

s = input()
k = int(input())

# 1の連続性を確認し終わった段階の数字を記録
cnt = 1

if len(s) == 1:
    print(s)
    exit()

for i in range(len(s)-1):
    if s[i] != '1':
        num = s[i]
        break
    if s[i] == s[i+1] == '1':
        cnt += 1

if cnt >= k:
    print(1)
else:
    print(num)

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

if s[0] == '1':
    print(s[1])
else:
    print(s[0])
Problem p03289 (python)

Fixed submission:
s = list(input())

bl = False
s1 = s[1]
s2 = s[2:len(s)-1]
s3 = s[-1]

if s[0] == 'A' and s[2:len(s)-1].count('C') == 1:
    s2.remove('C')
    s2 = ''.join(s2)
    ss = s1+s2+s3
    if ss.islower():
        bl = True

print('AC' if bl else 'WA')

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

bl = True

if s[0] != 'A':
    bl = False
if s[2:len(s)-1].count('C') != 1:
    bl = False
if s[0] != 'A' and s[2:len(s)-1].count('C') != 1:
    s.remove('A')
    s[2:len(s)-1].remove('C')
    if s not in 'abcdefghijkrmnopqlstuvwxyz':
        bl = False

print('AC' if bl else 'WA')
Problem p03378 (python)

Fixed submission:
n,m,x=map(int,input().split())
s=sum(int(i)<x for i in input().split())
print(min(s,m-s))

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

left=0
right=0

for i in a:
  if x > int(i):
    left += 1
  elif x < int(i):
    righit += 1
print(min(left,right))

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

for i in a:
  if x > int(i):
    left += 1
  elif x < int(i):
    righit =+ 1
print(min(left,right))
Problem p03556 (python)

Fixed submission:
n = int(input())

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

print(ans)

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

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

print(ans)
Problem p03627 (python)

Fixed submission:
from collections import Counter

n = int(input())
A = Counter(list(map(int, input().split())))
A = sorted(A.most_common(), reverse=True)
rods = []
for a in A:
    if a[1] >= 4:
        rods.append(a[0])
        rods.append(a[0])
        break
    if a[1] >= 2:
        rods.append(a[0])
    if len(rods) == 2:
        break
if len(rods) >= 2:
    ans = rods[0]*rods[1]
else:
    ans = 0
print(ans)

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

n = int(input())
A = map(int, input().split())
C = defaultdict(int)
for a in A:
    C[a] += 1
C = sorted(C.items(), key=lambda x: x[1])
rods = []
for k, v in C:
    if v >= 4:
        rods.append(k, k)
        break
    if v >= 2:
        rods.append(k)
    if len(rods) == 2:
        break
if len(rods) >= 2:
    ans = rods[0]*rods[1]
else:
    ans = 0
print(ans)
Problem p03633 (python)

Fixed submission:
from fractions import gcd

n = int(input())


def lcm(a, b):
    return a * b // gcd(a, b)


ans = 1
for _ in range(n):
    t = int(input())
    ans = lcm(ans, t)

print(ans)

Buggy submission (verdict: Runtime Error):
from math import gcd

n = int(input())


def lcm(a, b):
    return a * b // gcd(a, b)


ans = 1
for _ in range(n):
    t = int(input())
    ans = lcm(ans, t)

print(ans)
Problem p03635 (python)

Fixed submission:
n, m = map(int, input().split())
print((n-1)*(m-1))

Buggy submission (verdict: Runtime Error):
n, m = map(int, input().split())
print(~-a*~-b)
Problem p03636 (python)

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

Buggy submission (verdict: Runtime Error):
a, *b, c = input()
print(a+str(len(*b))+c)
Problem p03693 (python)

Fixed submission:
a, b, c = map(int, input().split())
A = 100*a + 10*b + c

if A % 4 == 0:
    print('YES')
else:
    print('NO')

Buggy submission (verdict: Runtime Error):
a, b, c = map(int, input().split()), reverse = True
A = 100*a + 10*b + c

if A % 4 == 0:
    print('YES')
else:
    print('NO')
Problem p04011 (python)

Fixed submission:
n,k,x,y=(int(input()) for i in [0]*4)
print(n*x-(x-y)*max(n-k,0))

Buggy submission (verdict: Runtime Error):
a,b,c,d=[int(input) for i in range(4)]
print(a*c-(c-d)*max(b-a,0))