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

Fixed submission:
s = input()
ACGT = ["A","C","G","T"]
ans = 0
ANS = [0]

for i in range(len(s)):
    if s[i] in ACGT:
        ans += 1
    else:
        ans = 0
        
    ANS.append(ans)
        
print(max(ANS))

Buggy submission (verdict: Runtime Error):
s = input()
ACGT = ["A","C","G","T"]
ans = 0
ANS = []

for i in range(len(s)):
    if s[i] in ACGT:
        ans += 1
    else:
        ANS.append(ans)
        ans = 0
        
print(max(ANS))

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

list_ = []
length = 0

for i in range(len(S)):
    if S[i] == "A" or S[i] == "C" or S[i] == "G" or S[i] == "T":
        length += 1
    else:
        list_.append(length)
        length = 0
        
print(max(list_))
Problem p03125 (python)

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

if B % A == 0:
    print(A+B)
else:
    print(B-A)

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

if B % A == 0:
    print(A+B)
else:
    print(B-a)
Problem p03238 (python)

Fixed submission:
N = int(input())

if N == 1:
    print(" Hello World ")
else:
    A = int(input())
    B = int(input())
    print(A+B)

Buggy submission (verdict: Runtime Error):
print((int(input())==2)*(int(input())+int(input())) or "Hello World")
Problem p03292 (python)

Fixed submission:
A = list(map(int,input().split()))
print(max(A)-min(A))

Buggy submission (verdict: Runtime Error):
print("YNeos"[input() not in input()*3::2])
Problem p03469 (python)

Fixed submission:
print("2018"+input()[4:])

Buggy submission (verdict: Runtime Error):
n,y = map(int,input().split())
ans = [-1,-1,-1]
cnt = 0

for i in range(n+1):
    if cnt == 1:
        break
        
    for j in range(n-i+1):
        k = n-i-j
        
        if i*10000 + j*5000 + k*1000 == y:
            ans = [i,j,k]
            cnt += 1
            break
                
print(*ans,sep=" ")
Problem p03827 (python)

Fixed submission:
n = int(input())
s = input()
x = 0
ans = 0

for i in range(n):
    if s[i] == "I":
        x += 1
    else:
        x -= 1
    ans = max(x,ans)
    
print(ans)

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

for i in range(n):
    if s[i] == "I":
        x += 1
    else:
        x -= 1
    ans = max(0,x,ans)
   
print(ans)
Problem p03060 (python)

Fixed submission:
import heapq

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

VSubC = []

for index in range(int(n)):
  heapq.heappush(VSubC, -(int(v[index]) - int(c[index])))

answer = 0
while(len(VSubC) > 0):
  item = heapq.heappop(VSubC)
  if (item < 0):
    answer -= item
  else:
    break

print(answer)

Buggy submission (verdict: Runtime Error):
n = input()
v = input()
v = v.split()
c = input()
c = c.split()

VSubC = []

for index in range(n):
  heapq.heappush(VSubC, -(v[index] - c[index]))

answer = 0
while(len(VSubC) > 0):
  item = heapq.heappop(VSubC)
  if (item < 0):
    answer -= item
  else:
    break

print(answer)
Problem p03061 (python)

Fixed submission:
import copy
import heapq
import fractions

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

gcd_l = [0]
gcd_r = [0]

for i in range(N):
  gcd_l.append(fractions.gcd(gcd_l[i], A[i]))
  gcd_r.append(fractions.gcd(gcd_r[i], A[-(i+1)]))

gcd_r = gcd_r[::-1]
ans = []

for i in range(N):
  ans.append(fractions.gcd(gcd_l[i], gcd_r[i+1]))

print(max(ans))

Buggy submission (verdict: Runtime Error):
import copy

def gcd(x, y):
  if y == 0:
    return x
  else:
    return gcd(y, x % y)

def cal(array):
  while(len(array) > 1):
    a = array.pop(0)
    b = array.pop(0)
    array.append(gcd(a, b))
  return array[0]

n = input()
a = input().split()
a = map(lambda x: int(x), a)

answer_list = []

for i in range(int(n)):
  copy_a = copy.copy(a)
  copy_pop_a = copy_a.pop(i)
  answer_list.append(cal(copy_a))

answer = max(answer_list)

print(answer)
Problem p03262 (python)

Fixed submission:
from fractions import gcd
from functools import reduce

def gcds(*numbers):
    return reduce(gcd, numbers)

def gcd_list(numbers):
    return reduce(gcd, numbers)

# INPUT
n, x = map(int, input().split())
capitals = list(map(int, input().split()))

# PROCESS
distance_cap = list(map(lambda c: abs(x-c), capitals))
answer = gcd_list(distance_cap)

# OUTPUT
print(answer)

Buggy submission (verdict: Runtime Error):
import math
from functools import reduce

def gcd(*numbers):
    return reduce(math.gcd, numbers)

def gcd_list(numbers):
    return reduce(math.gcd, numbers)

# INPUT
n, x = map(int, input().split())
capitals = list(map(int, input().split()))

# PROCESS
distance_cap = list(map(lambda c: abs(x-c), capitals))
answer = gcd_list(distance_cap)

# OUTPUT
print(answer)
Problem p03282 (python)

Fixed submission:
s = input()
k = int(input())

ans_idx = 0

s = list(s)
for i in range(min(k, len(s))):
  if (s[i] != "1"):
    break
print(s[i])

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

print(s[1])
Problem p02534 (python)

Fixed submission:
n = int(input())

print("ACL"*n)

Buggy submission (verdict: Runtime Error):
n = input().split()

a = int(n[0])
b = int(n[1])
c = int(n[2])
d = int(n[3])
s = [j for j in range(a, b+1)]
y = 0

for i in range(c, d+1):
  if i in s:
    y += 1
  
if y != 0:
  print("Yes")
else:
  print("No")
Problem p02584 (python)

Fixed submission:
import math
import sys

X, K, D = map(int, input().split())

a = X - K * D
if a > 0:
    print(a)
    sys.exit()
if a + 2 * K * D < 0:
    print(abs(a + 2 * K * D))
    sys.exit()
else:
    b = a / (-2 * D)
    p = math.floor(b)
    q = math.ceil(b)
    r = -(a + 2 * D * p)
    s = a + 2 * D * q
    print(min(r,s))
    sys.exit()

Buggy submission (verdict: Runtime Error):
import math

X, K, D = map(int, input().split())

a = X - K * D
if a > 0:
    print(a)
    return
if a + 2 * K * D < 0:
    print(abs(a + 2 * K * D))
    return
else:
    b = a / (-2 * D)
    p = math.floor(b)
    q = math.ceil(b)
    r = -(a + 2 * D * p)
    s = a + 2 * D * q
    print(min(r,s))
    return
Problem p02641 (python)

Fixed submission:
X, N = map(int, input().split())
h = list(map(int, input().split()))
ans = []
for i in range(0, N+1):
    if X+i not in h:
        ans.append(X+i)
    if X-i not in h:
        ans.append(X-i)
    if ans != []:
        break
print(min(ans))

Buggy submission (verdict: Runtime Error):
import collections

N = int(input())
h = list(map(int, input().split()))
h.sort(reverse = True)
l = []
for i in range(0, N):
    d = []
    for j in range(0, max(0, len(l))):
        if l[j] % h[i] == 0:
            d.append(l[j])
    for k in range(0, len(d)):
        l.remove(d[k])
    l.append(h[i])
if len(collections.Counter(h)) == 1:
    l.clear()
print(len(l))
Problem p02687 (python)

Fixed submission:
S = str(input())
if S == 'ABC':
    print('ARC')
else:
    print('ABC')

Buggy submission (verdict: Runtime Error):
S = str(input())
if S = 'ABC':
  print('ARC')
else:
  print('ABC')
Problem p02702 (python)

Fixed submission:
S = input()
P = 2019
N = len(S)
num = [0] * P
num[0] = 1
c = 0
ans = 0
dgt = 1
for i in range(N-1, -1, -1):
    c = (c + int(S[i]) * dgt) % P
    dgt *= 10
    dgt %= P
    ans += num[c]
    num[c] += 1

print(ans)

Buggy submission (verdict: Runtime Error):
S = str(input())
N = len(h)
a = [0] * 2019
a[0] = 1
T = 0
r = 1
c = 0
for i in range(N-1, -1, -1):
    T = T + int(S[i]) * r
    r = r * 10
    c += a[T%2019]
    a[T%2019] += 1
print(c)

Buggy submission (verdict: Runtime Error):
S = input()
N = len(h)
a = [0] * 2019
a[0] = 1
T = 0
r = 1
c = 0
for i in range(N-1, -1, -1):
    T = T + int(S[i]) * r
    r = r * 10
    c += a[T%2019]
    a[T%2019] += 1
print(c)

Buggy submission (verdict: Runtime Error):
S = input()
N = len(h)
a = [0] * 2019
a[0] = 1
T = 0
r = 1
c = 0
for i in range(N-1, -1, -1):
    T = T + int(S[i]) * r
    r = r * 10
    c += a[T%2019]
    a[T%2019] += 1
print(c)
Problem p02705 (python)

Fixed submission:
import math
R = int(input())
print(2*math.pi*R)

Buggy submission (verdict: Runtime Error):
import fractions
pi = fractions.pi
R = int(input())
print(2*pi*R)

Buggy submission (verdict: Runtime Error):
import fractions
R = int(input())
print(2*math.pi*R)

Buggy submission (verdict: Runtime Error):
R = int(input())
print(2*math.pi*R)
Problem p02811 (python)

Fixed submission:
K,X=(int(x) for x in input().split())
if 500 * K >= X:
    print('Yes')
else:
    print('No')

Buggy submission (verdict: Runtime Error):
K,X=input().split()
if 500 * K >= X:
  return 'Yes'
else:
  return 'No'
Problem p02812 (python)

Fixed submission:
N = int(input())
S = str(input())
c = 0
for i in range(0,N):
    if S[i:i+3] == 'ABC':
        c += 1
print(c)

Buggy submission (verdict: Runtime Error):
N = int(input())
S = str(input())
c = 0
for i in range(0,N):
    if S[i] == 'A' and S[i+1]== 'B' and S[i+2] == 'C':
        c += 1
print(c)

Buggy submission (verdict: Runtime Error):
N = int(input())
S = str(input())
c = 0
for i in range(0,len(S)):
    if S[i] == 'A' and S[i+1]== 'B' and S[i+2] == 'C':
        c += 1
print(c)
Problem p02885 (python)

Fixed submission:
A,B=map(int,input().split())
s=A-2*B
if s<0:
  print(0)
else:
  print(s)

Buggy submission (verdict: Runtime Error):
input(A),split(B)
print(A-2*B)
Problem p02886 (python)

Fixed submission:
N=int(input().rstrip())
d = list(map(int, input().split())) 
a=0
t=0
for i in range(N-1):
  t+=1
  for j in range(t,N):
    a+=d[i]*d[j]
print(a)

Buggy submission (verdict: Runtime Error):
N=int(input())
d=[input() for i in range(N)]
s=0
for i in range(0,len(d)):
  t=0
  for j in range(0,len(d)):
    t+=d[i]*d[j]
  s+=t
print(s)
Problem p02582 (python)

Fixed submission:
s=input()
if s=='RRR':
  print(3)
elif s=='SSS':
  print(0)
elif (s=='SRR' or s=='RRS'):
  print(2)
else:
  print(1)

Buggy submission (verdict: Runtime Error):
s=input()
if s=='RRR':
  print(3)
elif s=='SSS':
  print(0)
elif (s=='SRR' or s=='RRS'):
  prinr(2)
else:
  print(1)
Problem p02608 (python)

Fixed submission:
N = int(input())
ans = [0]*(N+1)
RANGE = 333
for i in range(1, RANGE):
  if i**2 <= N+1:
    for j in range(1, RANGE):
      if i**2 + j**2 + i*j <= N+1:
        for k in range(1, RANGE):
          wd = i**2 + j**2 + k**2 + i*j + j*k + k*i
          if wd < N+1:
            #print(wd)
            #print(i, j, k)
            ans[wd] += 1
          else:
            break
      else:
        break
  else:
    break
    
for i in range(1,N+1):
  print(ans[i])

Buggy submission (verdict: Runtime Error):
N = int(input())
ans = [0]*(N+1)
RANGE = 333
for i in range(1, RANGE):
  if i**2 <= N+1:
    for j in range(1, RANGE):
      if i**2 + j**2 + i*j <= N+1:
        for k in range(1, RANGE):
          wd = i**2 + j**2 + k**2 + i*j + j*k + k*i
          if wd <= N+1:
            #print(wd)
            #print(i, j, k)
            ans[wd] += 1
          else:
            break
      else:
        break
  else:
    break
    
for i in range(1,N+1):
  print(ans[i])
Problem p02657 (python)

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

Buggy submission (verdict: Runtime Error):
a, b = map(int, input().split())
prinr(a*b)
Problem p02675 (python)

Fixed submission:
s = input()
k = int(s[-1])
if k == 3:
  print('bon')
elif k in [0, 1, 6, 8]:
  print('pon')
else:
  print('hon')

Buggy submission (verdict: Runtime Error):
s = input()
k = int(s[:-1])
if k == 3:
  print('bon')
elif k in [0, 1, 6, 8]:
  print('pon')
else:
  print('hon')
Problem p02694 (python)

Fixed submission:
X = int(input())

Y = 100
count = 0

while (X > Y):
  Y += int(0.01*Y)
  count += 1
print(count)

Buggy submission (verdict: Runtime Error):
i = int(input())
count=0
while i < p:
  p = p*1.01
  count +=1
print(count)
Problem p02718 (python)

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

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

ksum= sum(k)
k.sort(reverse=True)
#print(k)
p = 'Yes'
for i in range(b):
    #print(i)
    if k[i] < ksum/4/b:
        p = 'No'
        break
print(p)

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

a.sort(reverse = True)
sum = sum(a)

p = []

for i in a:
  #print(i, sum)
  if i > (sum // ( M * 4 )):
    p.append(i)

if len(p) >= M:
  print('Yes')
else:
  Print("No")
Problem p02789 (python)

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

if a == b:
  print("Yes")
else:
  print("No")

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

if a == b:
  print("Yes")
rlse:
  print("No")
Problem p02791 (python)

Fixed submission:
a = int(input())
k = list(map(int, input().split()))

count = 0
min =99999999

for i in range(len(k)):
  if min > k[i]:
    min= k[i]
    count += 1

print(count)

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

count = 1

for i in range(1,len(k)+1):
  if k[i-1] > k[i]:
    count += 1

print(count)
Problem p02811 (python)

Fixed submission:
a, b = list(map(int, input().split()))
if a * 500  < b :
            print('No')
else:
            print('Yes')

Buggy submission (verdict: Runtime Error):
a, b = list(map(int, input().split())
if a * 500  < b :
  print('No')
else:
  print('Yes')
Problem p02885 (python)

Fixed submission:
A, B = list(map(int,(input().split())))
C = A - 2 * B
if C < 0:
	C = 0
else :
	pass
print(C)

Buggy submission (verdict: Runtime Error):
A, B = list(map(int,(input().split())))
C = A - 2 * B
if C < 0:
  return 0
else :
  return C

Buggy submission (verdict: Runtime Error):
A = int(input())
B = int(input())
C = A - 2 * B
if C < 0:
  return 0
else :
  return C
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 = {"Sunny":"Cloudy", "Cloudy":"Cloudy", "Cloudy":"Sunny"}
k = input()

print(S[k])

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

Fixed submission:
N=int(input())
A=list(map(int,input().split()))
bef=99999999999999
count=0
max=0
for i in range(N):
  l=A.pop()
  if l >= bef:
    count +=1
  else:
    count=0
  if max <= count:
    max=count
  bef=l
print(max)

Buggy submission (verdict: Runtime Error):
N=int(input())
A=list(map(int,inpu().split()))
bef=99999999999999
count=0
for i in range(N):
  l=A.pop()
  if l > bef:
    count +=1
  else:
    count=0
  if max<=count:
    max=count
  bef=l
print(max)
Problem p03059 (python)

Fixed submission:
inputs = list(map(int, input().split()))
 
A = inputs[0]
B = inputs[1]
T = inputs[2]
 
Q = int(T / A)
#print(Q)
X = Q* B
print(X)

Buggy submission (verdict: Runtime Error):
inputs = list(map(int, inpit().split()))

A = input[0]
B = input[1]
T = input[2]

Q = int(T / A)
print(Q)
X = Q* B
print(X)
Problem p03060 (python)

Fixed submission:
N = int(input())

V = list(map(int, input().split()))

C = list(map(int, input().split()))

P = 0

for i in range(N):
  Y = V[i] - C[i]
  if Y >0:
    P += Y
print(P)

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

V = list(map(int, input().split()))

C = list(map(int, input().split()))

P = 0

for i in range(0,N+1):
  Y = V[i] - C[i]
  if Y >0:
    P += Y
print(Y)
Problem p03080 (python)

Fixed submission:
input1 = input()
N = int(input1)
input2 = input()
S = list(input2)
 
R = 0
B = 0
h = 'No'
 
for i in range(N):
  if S[i] == 'R':
    R += 1
  else:
    B += 1
  
if R > B:
  h = 'Yes'

print(h)

Buggy submission (verdict: Runtime Error):
input1 = input()
N = int(input1)
input2 = input()
S = str(input2)
 
R = 0
B = 0
h = 'No'
 
for i in N:
  if S[i] == 'R':
    R += 1
  else:
    B += 1
  
if R > B:
  h = 'Yes'

print(h)

Buggy submission (verdict: Runtime Error):
input1 = input()
N = int(input1)
input2 = input()
S = list(input2)
 
R = 0
B = 0
h = 'No'
 
for i in N:
  if S[i] == 'R':
    R += 1
  else:
    B += 1
  
if R > B:
  h = 'Yes'

print(h)

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

R = 0
B = 0
h = 'No'
 
for i in N:
  if S[i] == 'R':
    R += 1
  else:
    B += 1
  
if R > B:
  h = 'Yes'

print(h)

Buggy submission (verdict: Runtime Error):
input1 = input()
N = int(input1)
input2 = input()
S = input2
 
R = 0
B = 0
h = 'No'
 
for i in N:
  if S[i] == 'R':
    R += 1
  else:
    B += 1
  
if R > B:
  h = 'Yes'

print(h)

Buggy submission (verdict: Runtime Error):
input = input()
N = int(input)
input = input()
S = input
 
R = 0
B = 0
h = 'No'
 
for i in N:
  if S[i] == 'R':
    R += 1
  else:
    B += 1
  
if R > B:
  h = 'Yes'

print(h)

Buggy submission (verdict: Runtime Error):
input = input().split()
N = int(input[0])
S = input[1]
 
R = 0
B = 0
h = 'No'
 
for i in N:
  if S[i] == 'R':
    R += 1
  else:
    B += 1
if R > B:
  h = 'Yes'
print(h)

Buggy submission (verdict: Runtime Error):
input = input().split()
N = int(input[0])
S = input[1]
 
R = 0
B = 0
h = 'No'
 
for i in N:
  if S[i] == 'R':
    R += 1
  else:
    B += 1
 
if R > B:
  h = 'Yes'
 
print(h)

Buggy submission (verdict: Runtime Error):
input = input().split()
N = int(input[0])
S = input(1)

R = 0
B = 0
h = 'No'

for i in N:
  if S[i] == 'R':
    R += 1
  else:
    B += 1

if R > B:
  h = 'Yes'

print(h)
Problem p03085 (python)

Fixed submission:
input = input()

a = {'A':'T', 'T':'A','C':'G','G':'C'}

print(a[input])

Buggy submission (verdict: Runtime Error):
input1 = input().split()
N = input1[0]
Q = input1[1]
S = input()

flag = 0
count = 0
result = []

for q in range(int(Q)):
	
	input3 = input().split()
	
	l = int(input3[0])
	r = int(input3[1])+1
	
	for s in (range(l,r)):
		
		#print(s)
		if S[s-1] == 'A':
			flag += 1
			
		elif ((S[s-1] == 'C') and (flag == 1)):
			count += 1
			flag = 0
			
		else:
			flag = 0
			
	result.append(count)
	
	count = 0
	flag = 0
	
for i in result:
	print(i)
Problem p03101 (python)

Fixed submission:
input1 = input().split()
input2 = input().split()

W = int(input1[0])
w = int(input2[0])
H = int(input1[1])
h = int(input2[1])

print(str((W-w)*(H-h)))

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

print(str((a-c)*(b-d))))
Problem p03160 (python)

Fixed submission:
N = int(input())
a = list(map(int, input().split()))
dp = []

def mins(minval, val):
	if minval < val:
			return minval
	else:
			return val

for i in range(N):
	dp.append(1000000000000)

for i in range(len(a)):
	if i == 0:
		dp[0] = 0
	if i == 2:
		dp[1]= abs(a[1] - a[0])
	
	
	dp[i] = min(dp[i], dp[i-1] + abs(a[i-1] - a[i]))
	dp[i] = min(dp[i], dp[i-2] + abs(a[i-2] - a[i]))
#print(dp)
print(dp[N-1])

Buggy submission (verdict: Runtime Error):
ソースコード
1
N = int(input())
2
a = list(map(int, input().split()))
3
dp = []
4
​
5
def mins(minval, val):
6
  if minval < val:
7
    return minval
8
  else:
9
    return val
10
​
11
for i in range(N):
12
  dp.append(10000000)
13
​
14
for i in range(len(a)):
15
  if i == 0:
16
    dp[0] = 0
17
  if i == 1:
18
    dp[1]= a[1] - a[0]
19
  dp[i] = min(dp[i], dp[i-1] + abs(a[i-1] - a[i]))
20
  dp[i] = min(dp[i], dp[i-2] + abs(a[i-2] - a[i]))
21
​
22
Problem p03254 (python)

Fixed submission:
N, x = map(int, input().split())
a = list(map(int, input().split()))
p = x
a.sort()
count = 0

for i in a:
  if x - i >= 0:
    x -= i
    count += 1
if x > 0 and count != 0  and p > sum(a):
  count -= 1
print(count)

Buggy submission (verdict: Runtime Error):
N, x = map(int, input().split())
a = list(map(int, input().split()))
a.sort()
count = 0
p = x

for i in a:
  if x - i >= 0:
    x -= i
    count += 1
if x > 0 and count != 0 and p >= a.sum() :
  count -= 1
print(count)
Problem p03331 (python)

Fixed submission:
N = int(input())
min = 100000000000000
for i in range(1, N):
  A = str(i)
  B = str(N - i)
  ref = 0
  for a in A:
    ref += int(a)
  for b in B:
    ref += int(b)
  if ref < min:
    min = ref
print(min)

Buggy submission (verdict: Runtime Error):
N = int(input())
min = 100000000000000
for i in range(1, (N+1)//2):
   A = str(i)
  B = str(N - i)
  ref = 0
  for a in A:
    ref += int(a)
  for b in B:
    ref += int(b)
  if ref < min:
    min = ref
print(min)
Problem p03486 (python)

Fixed submission:
a = sorted(input())
b = sorted(input(), reverse=True)
aa = ''.join(a)
bb = ''.join(b)
if aa < bb:
  print('Yes')
else:
  print('No')

Buggy submission (verdict: Runtime Error):
a = sorted(input(), reverse=True)
b = sorted(input(), reverse=True)
aa = ''.join(a)
bb = ''.join(b)
ans = 'No'
for i in range(len(aa)):
  if aa[i] == bb[i]: continue
  if aa[i] < bb[i]:
    ans = 'Yes'
    break
  else:
    ans = 'No'
    break
print(ans)

Buggy submission (verdict: Runtime Error):
a = sorted(input(), reverse=True)
b = sorted(input(), reverse=True)
aa = ''.join(a)
bb = ''.join(b)
ans = 'Yes'
for i in range(len(aa)):
  if aa[i] == bb[i]: continue
  if aa[i] < bb[i]:
    break
  else:
    ans = 'No'
    break
print(ans)
Problem p03502 (python)

Fixed submission:
N = input()
sum = 0
for i in N:
  sum += int(i)
if int(N) % sum == 0:
  print('Yes')
else:
  print('No')

Buggy submission (verdict: Runtime Error):
N = int(input())
for i in N:
  sum += i
if sum % N == 0:
  print('Yes')
else:
  print('No')
Problem p03729 (python)

Fixed submission:
a,b,c=input().split()
if a[-1]==b[0] and b[-1]==c[0]:
  print("YES")
else:
  print("NO")

Buggy submission (verdict: Runtime Error):
a,b,c=list(input().split())
if a[-1]==b[1] and b[-1]==c[1]:
  print("Yes")
else:
  print("No")

Buggy submission (verdict: Runtime Error):
a,b,c=input().split()
if a[-1]==b[1] and b[-1]==c[1]:
  print("Yes")
else:
  print("No")
Problem p02553 (python)

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

import sys
input=sys.stdin.readline

a,b,c,d=map(int,input().split())
ans=-10**18
#x=0 or y=0
if a<=0<=b or c<=0<=d:
    ans=max(ans,0)
#x<0 and y>0
ans=max(ans,b*c)
#x>0 and y>0
ans=max(ans,b*d)
#x<0 and y<0
ans=max(ans,a*c)
#x>0 and y<0
ans=max(ans,a*d)
print(ans)

Buggy submission (verdict: Runtime Error):
ans=-10**18
if a<=0<=b or c<=0<=d:
  ans=0
ans=max(ans,a*c,a*d,b*c,b*d)
print(ans)
Problem p02574 (python)

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

import collections
import sys
input=sys.stdin.readline

def gcd(a,b):
    if b==0:
        return a
    else:
        return gcd(b,a%b)

def judge(n,arr):
    MAX=10**6
    table=[i for i in range(MAX+1)]
    for i in range(2,MAX+1):
        if table[i]<i:
            continue
        for j in range(i,MAX+1,i):
            table[j]=i
    cnt=collections.defaultdict(int)
    for val in arr:
        s=set()
        while val!=1:
            prime=table[val]
            s.add(prime)
            val//=prime
        for tmp in s:
            cnt[tmp]+=1
    for val in cnt.values():
        if val>=2:
            return False
    return True
    
n=int(input())
arr=list(map(int,input().split()))
tmp=arr[0]
for val in arr:
    tmp=gcd(tmp,val)
if tmp==1:
    is_setwise=True
else:
    is_setwise=False
is_pairwise=judge(n,arr)
if is_pairwise==True:
    print('pairwise coprime')
elif is_setwise==True:
    print('setwise coprime')
else:
    print('not coprime')

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

def divisors(n):
  ret=[]
  for i in range(2,int(n**0.5)+1):
    if n%i==0:
      ret.append(i)
      while n%i==0:
        n//=i
  return ret

def gcd(a,b):
  if b==0:
    return a
  else:
    return gcd(b,a%b)

n=int(input())
arr=list(map(int,input().split()))
cnt=[False]*(max(arr)+1)
is_pairwise=True
tmp=arr[0]
for val in arr:
  tmp=gcd(tmp,val)
  if is_pairwise==False:
    continue
  divisor=divisors(val)
  for val2 in divisor:
    if cnt[val2]==True
      is_pairwise=False
      break
    cnt[val2]=True
if tmp==1:
  is_setwise=True
else:
  is_setwise=False
if is_pairwise==True:
  print('pairwise coprime')
elif is_setwise==True:
  print('setwise coprime')
else:
  print('not coprime')