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

Fixed submission:
a,b=map(int,input().split())
if (a+b)%2==0:
  print((a+b)//2)
  
else:
  print('IMPOSSIBLE')

Buggy submission (verdict: Runtime Error):
a,b=map(int,input().split())
if (a+b)%2==0:
  print(ave(a+b))
  
else:
  print('IMPOSSIBLE')

Buggy submission (verdict: Runtime Error):
a,b=map(int,input().split())
if (a+b)%2==0:
  print(ave(a+b))
  
else:
  print('impossible')
Problem p02971 (python)

Fixed submission:
n=int(input())
a=[int(input()) for i in range(n)]
b=list(set(a))
if len(b)==1:
  for i in range(n):
    print(b[0])
elif a.count(b[-1])>=2:
  for i in a:
    print(b[-1])
else:
  for i in a:
    if i==b[-1]:
      print(b[-2])
    else:
      print(b[-1])

Buggy submission (verdict: Runtime Error):
n=int(input())
a=[int(input()) for i in range(n)]
b=list(set(a))
for i in a:
  if i==b[-1]:
    print(b[-2])
  else:
    print(b[-1])

Buggy submission (verdict: Runtime Error):
n=int(input())
a=[int(input()) for i in range(n)]
b=set(a)
for i in a:
  if i==b[-1]:
    print(b[-2])
  else:
    print(b[-1])
Problem p02982 (python)

Fixed submission:
import math
n,d=map(int,input().split())
x=[list(map(int,input().split())) for _ in range(n)]
cnt=0
for i in range(n):
  for j in range(i+1,n):
    sum=0
    for k in range(d):
      sum+=(x[i][k]-x[j][k])**2
    z=pow(sum,0.5)
    if math.ceil(z)==math.floor(z):
      cnt+=1
print(cnt)

Buggy submission (verdict: Runtime Error):
import math
n,d=map(int,input().split())
x=[list(map(int,input().split())) for _ in range(n)]
cnt=0
for i in range(n):
  for j in range(i+1,n):
    sum=0
    for k in range(n):
      sum+=(x[i][k]-x[j][k])**2
    z=pow(sum,0.5)
    if math.ceil(z)==math.floor(z):
      cnt+=1
print(cnt)
Problem p02993 (python)

Fixed submission:
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=int(input())
if s[0]!=s[1] and s[1]!=s[2] and s[2]!=s[3]:
  print('Good')
  
else:
  print('Bad')
Problem p02994 (python)

Fixed submission:
a,b=map(int,input().split())
total=a*(a+2*b-1)//2
x=b
y=a+b-1
if abs(x)<abs(y):
  z=x
else:
  z=y
if x<=0 and y>=0:
  print(total)
else:
  print(total-z)

Buggy submission (verdict: Runtime Error):
a,b=map(int,input().split())
total=a*(a+2*b-1)//2
x=b
y=a+b-1
if (abs(x)<abs(y):
  z=x
else:
  z=y
if x<=0 and y>=0:
  print(total)
else:
  print(total-z)

Buggy submission (verdict: Runtime Error):
n,l=map(int,input.split())
x=(n+(2*l)-1)*n
if l<0:
  print(x//2)
else:
  print((x//2)-l)

Buggy submission (verdict: Runtime Error):
n,l=map(int,input.split())
x=(n+2*l-1)*n
if l<0:
  print(x//2)
else:
  print((x//2)-l)

Buggy submission (verdict: Runtime Error):
n,l=map(int,input.split())
if l<0:
  print(((n+(2*l)-1)*n)//2)
else:
  print((((n+(2*l)-1)*n)//2)-l)

Buggy submission (verdict: Runtime Error):
n,l=map(int,input.split())
if l<0:
  print(((n+2*l-1)*n)//2)
else:
  print((((n+2*l-1)*n)//2)-l)
Problem p02995 (python)

Fixed submission:
import math
a,b,c,d=map(int,input().split())
x=b-b//c-b//d+b//(c*d//math.gcd(c,d))
y=(a-1)-(a-1)//c-(a-1)//d+(a-1)//(c*d//math.gcd(c,d))
print(x-y)

Buggy submission (verdict: Runtime Error):
import math
a,b,c,d=map(int,input().split())
x=b-b//c-b//d+b//(c*d//math.gcd(c*d))
y=(a-1)-(a-1)//c-(a-1)//d+(a-1)//(c*d//math.gcd(c*d))
print(x-y)

Buggy submission (verdict: Runtime Error):
import math
a,b,c,d=map(int,input().split())
x=b-b//c-b//d+b//(c*d//math.gcd(c*d))
y=(a-1)-(a-1)//c-(a-1)//d+(a-1)//(c*d//math.gcd(c*d))
print(x-y)

Buggy submission (verdict: Runtime Error):
n,l=map(int,input().split())
a=l
b=n+l-1
x=((a+b)*n)//2
if a<=0 and b<=0:
  print(x-b)
elif a<=0:
  print(x)
else:
  print(x-a)

Buggy submission (verdict: Runtime Error):
from math import gcd
a,b,c,d=map(int,input().split())
e=c*d//gcd(c,d)
print(b-(a-1)+(a-1)//c-b//c+(a-1)//d-b//d+b//e-(a-1)//e)

Buggy submission (verdict: Runtime Error):
from math import gcd
a,b,c,d=map(int,input().split())
e=c*d//gcd(c,d)
print((a-1)//c-b//c+(a-1)//d-b//d+b//e-(a-1)//e)
Problem p03000 (python)

Fixed submission:
n,x=map(int,input().split())
a=list(map(int,input().split()))
sum=0
count=1
for i in range(n):
  sum+=a[i]
  if sum<=x:
    count+=1
print(count)

Buggy submission (verdict: Runtime Error):
n,x=map(int,input().split())
a=list(map(int,input().split()))
sum=0
count=1
for i in range(x):
  sum+=a[i]
  if sum<=x:
    count+=1
print(count)

Buggy submission (verdict: Runtime Error):
n,x=map(int,input().split())
a=list(map(int,input()split()))
sum=0
count=1
for i in range(x):
  sum+=a[i]
  if sum<=x:
    count+=1
print(count)

Buggy submission (verdict: Runtime Error):
n,x=map(int,input().split())
a=list(map(int,input()split()))
count=1
for i in range(n):
  if sum(a[:i+1])<=x:
    count+=1
print(count)

Buggy submission (verdict: Runtime Error):
n,x=map(int,input().split())
a=list(map(int,input()split()))
count=0
for i in range(n):
  if sum(a[:i+1])<=x:
    count+=1
print(count)
Problem p03048 (python)

Fixed submission:
r,g,b,n=map(int,input().split())
ans=0
for i in range(0,3001):
  for j in range(0,3001):
    if (n-i*r-j*g)%b==0 and (n-i*r-j*g)>=0:
      ans+=1
print(ans)

Buggy submission (verdict: Runtime Error):
r,g,b,n=map(int,input().split()):
ans=0
for i in range(0,3001):
  for j in range(0,3001):
    if (n-i*r-j*g)%b==0:
      ans+=1
print(ans)
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().split())
print(((2t+1)//(2*a))*b)

Buggy submission (verdict: Runtime Error):
a,b,t=map(int,input().split())
print(((2t+1)//2*a)*b)

Buggy submission (verdict: Runtime Error):
a,b,t=map(int,input().split())
print(((2t+1)//2a)*b)
Problem p03061 (python)

Fixed submission:
import math

n = int(input())
a = list(map(int,input().split()))

def segfunc(x, y):
    return math.gcd(x,y)

def init(init_val):
    # set_val
    for i in range(n):
        seg[i+num-1] = init_val[i]
    # built
    for i in range(num-2, -1, -1):
        seg[i] = segfunc(seg[2*i+1], seg[2*i+2])

def update(k, x):
    k += num - 1
    seg[k] = x
    while k:
        k = (k-1)//2
        seg[k] = segfunc(seg[2*k+1], seg[2*k+2])

def query(p, q):
    if q <= p:
        return ide_ele
    p += num - 1
    q += num - 2
    res = ide_ele
    while q-p>1:
        if p&1 == 0:
            res = segfunc(res, seg[p])
        if q&1 == 1:
            res = segfunc(res, seg[q])
            q -= 1
        p = p//2
        q = (q-1)//2
    if p == q:
        res = segfunc(res, seg[p])
    else:
        res = segfunc(segfunc(res, seg[p]), seg[q])
    return res

# identity element
ide_ele = 0

# num: n以上の最小の2のべき乗
num = 2**(n-1).bit_length()
seg = [ide_ele]*2*num

a=init(a)

ans=1
for i in range(n):
    ans=max(ans,math.gcd(query(0,i),query(i+1,n)))


print(ans)

Buggy submission (verdict: Runtime Error):
from fractions import gcd
n=int(input())
a=list(map(int,input().split()))
b=[]
if n==2:
  print(max(a))

else:
  for i in range(n-1):
    x=a[i]
    y=a[i+1]
    b+=list(gcd(x,y))
  b+=list(gcd(a[0],a[-1]))
  b.sort()
  print(b[2])

Buggy submission (verdict: Runtime Error):
from math import gcd
n=int(input())
a=list(map(int,input().split()))
b=[]
if n==2:
  print(max(a))

else:
  for i in range(n-1):
    x=a[i]
    y=a[i+1]
    b+=list(gcd(x,y))
  b+=list(gcd(a[0],a[-1]))
  b.sort()
  print(b[2])

Buggy submission (verdict: Runtime Error):
from math import gcd
n=int(input())
a=list(map(int,input().split()))
b=[]
if n==2:
  print(max(a))

else:
  for i in range(n):
    x=a[i]
    y=a[i-1]
    b+=list(gcd(x,y))
  b.sort()
  print(b[2])

Buggy submission (verdict: Runtime Error):
from math import gcd
n=int(input())
a=list(map(int,input().split()))
b=[]
if n==2:
  print(max(a))

else:
  for i in range(n):
    x=a[i]
    y=a[i-1]
    b+=[gcd(x,y)]
  b.sort()
  print(b[2])

Buggy submission (verdict: Runtime Error):
from math import gcd
n=int(input())
a=list(map(int,input().split()))
b=[]
for i in range(n):
  b+=gcd(a[i],a[i-1])
b.sort()
print(b[2])
Problem p03076 (python)

Fixed submission:
from math import ceil
a=[int(input()) for i in range(5)]
ans=10
sum=0
for i in a:
  x=(i-1)%10+1
  ans=min(ans,x)
  sum+=ceil(i/10)*10
if ans==10:
  print(sum)
else:
  print(sum+ans-10)

Buggy submission (verdict: Runtime Error):
import math
a=list[int(input()) for _ in range(5)]
x=0
y=0
for i in a:
  x+=math.ceil(i)
  if i%10>y:
    y=i%10
print(x+y-10)
Problem p03129 (python)

Fixed submission:
n,k=map(int,input().split())
if (n+1)/2>=k:
  print('YES')
else:
  print('NO')

Buggy submission (verdict: Runtime Error):
n,k=map(int,input().split())
if (n+1)/2>=k:
  print('YES')
else:
  print('')NO
Problem p03138 (python)

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

lst=[0]*50


for i in a:
  for j in range(50):
    if (i>>j)%2==1:
      lst[j]+=1

k=bin(k)[2:]

dp=[[0]*2 for i in range(len(k)+1)]


for i in range(len(k)):
  if k[i]=='1':
    dp[i+1][0]=dp[i][0]+(n-lst[len(k)-i-1]*2)*(2**(len(k)-i-1))
    dp[i+1][1]=dp[i][0]
  else:
    dp[i+1][0]=dp[i][0]

  if i==0:
      continue
  
  dp[i+1][1]=max(dp[i+1][1],dp[i][1],dp[i][1]+(n-lst[len(k)-i-1]*2)*(2**(len(k)-i-1)))


print(sum(a)+max(dp[-1][0],dp[-1][1]))

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

lst=[0]*35


for i in a:
  for j in range(35):
    if (i>>j)%2==1:
      lst[j]+=1

k=bin(k)[2:]

dp=[[0]*2 for i in range(len(k)+1)]


for i in range(len(k)):
  if k[i]=='1':
    dp[i+1][0]=dp[i][0]+(n-lst[len(k)-i-1]*2)*2**(len(k)-i-1)
    dp[i+1][1]=dp[i][0]
  else:
    dp[i+1][0]=dp[i][0]

  if i==0:
      continue
  
  dp[i+1][1]=max(dp[i+1][1],dp[i][1],dp[i][1]+(n-lst[len(k)-i-1]*2)*2**(len(k)-i-1))


print(sum(a)+max(dp[-1][0],dp[-1][1]))

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

lst=[0]*35


for i in a:
  for j in range(35):
    if (i>>j)%2==1:
      lst[j]+=1

k=bin(k)[2:]
x=35-len(k)
k='0'*x+k
dp=[[0]*2 for i in range(36)]
flag=False


for i in range(35):
  if k[i]=='1':
    dp[i+1][0]=dp[i][0]+(n-lst[len(k)-i-1])*(2**(len(k)-i-1))
    dp[i+1][1]=dp[i][0]+lst[len(k)-i-1]*(2**(len(k)-i-1))
  
  else:
    dp[i+1][0]=dp[i][0]+lst[len(k)-i-1]*(2**(len(k)-i-1))

  if flag:
    dp[i+1][1]=max(dp[i+1][1],dp[i][1]+lst[len(k)-i-1]*(2**(len(k)-i-1)),dp[i][1]+(n-lst[len(k)-i-1])*(2**(len(k)-i-1)))
  
  if k[i]=='1':
      flag=True

print(max(dp[-1][0],dp[-1][1]))

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

lst=[0]*35


for i in a:
  for j in range(35):
    if (i>>j)%2==1:
      lst[j]+=1

k=bin(k)[2:]

dp=[[0]*2 for i in range(len(k)+1)]


for i in range(len(k)):
  if k[i]=='1':
    dp[i+1][0]=dp[i][0]+(n-lst[len(k)-i-1])*2**(len(k)-i-1)
    dp[i+1][1]=dp[i][0]+lst[len(k)-i-1]*2**(len(k)-i-1)
  
  else:
    dp[i+1][0]=dp[i][0]+lst[len(k)-i-1]**(len(k)-i-1)

  
  dp[i+1][1]=max(dp[i+1][1],dp[i][1]+lst[len(k)-i-1]*2**(len(k)-i-1),dp[i][1]+(n-lst[len(k)-i-1])*2**(len(k)-i-1))


print(max(dp[-1][0],dp[-1][1]))
Problem p03161 (python)

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

dp=[None]*len(h)
dp[0]=0

for i in range(1,k+1):
  if i<=n-1:
    dp[i]=abs(h[i]-h[0])

for i in range(k+1,n):
  distance=float('inf')
  for j in range(1,k+1):
    if i-j>=0:
      distance=min(distance,dp[i-j]+abs(h[i]-h[i-j]))
  dp[i]=distance
  
print(dp[-1])

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

dp=[None]*len(h)
dp[0]=0

for i in range(1,k+1):
  dp[i]=abs(h[i]-h[0])

for i in range(k+1,n):
  distance=float('inf')
  for j in range(1,k+1):
    if i-j>=0:
      distance=min(distance,dp[i-j]+abs(h[i]-h[i-j]))
  dp[i]=distance
  
print(dp[-1])
Problem p03163 (python)

Fixed submission:
n,w=map(int,input().split())
wi=[]
vi=[]

for i in range(n):
  a,b=map(int,input().split())
  wi+=[a]
  vi+=[b]
  
dp=[[0]*(w+1) for i in range(n+1)]

for i in range(n):
  for j in range(w+1):
    if j<wi[i]:
      dp[i+1][j]=dp[i][j]
      
    else:
      dp[i+1][j]=max(dp[i][j],dp[i][j-wi[i]]+vi[i])
      
print(dp[n][w])

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

weight=[]
value=[]

for i in range(n):
    a,b=map(int,input().split())
    weight+=[a]
    value+=[b]

dp=[[0]*(w+1) for i in range(n+1)]

for i in range(n):
    for j in range(w+1):
        if j<w[i]:
            dp[i+1][j]=dp[i][j]
        else:
            dp[i+1][j]=max(dp[i][j],dp[i][j-weight[i]]+value[i])

print(dp[n][w])
Problem p03164 (python)

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

weight=[]
value=[]
for i in range(n):
  a,b=map(int,input().split())
  weight.append(a)
  value.append(b)

xxx=sum(value)
dp=[[float('inf')]*(sum(value)+1) for i in range(n+1)]
dp[0][0]=0

for i in range(n):
  for j in range(xxx+1):
    dp[i+1][j]=min(dp[i+1][j],dp[i][j])                             #+1、個数制限なし
    dp[i+1][min(j+value[i],xxx)]=min(dp[i+1][min(j+value[i],xxx)],dp[i][j]+weight[i])

ans=0
for i in range(xxx+1):
  if dp[-1][i]<=w:
    ans=max(ans,i)

print(ans)

Buggy submission (verdict: Runtime Error):
n,w=map(int,input().split())
wi=[]
vi=[]

for i in range(n):
  a,b=map(int,input().split())
  wi+=[a]
  vi+=[b]
  
dp=[[0]*(w+1) for i in range(n+1)]

for i in range(n):
  for j in range(w+1):
    if j<wi[i]:
      dp[i+1][j]=dp[i][j]
      
    else:
      dp[i+1][j]=max(dp[i][j],dp[i][j-wi[i]]+vi[i])
      
print(dp[n][w])
Problem p03211 (python)

Fixed submission:
s=input()
z=753
for i in range(len(s)-2):
  x=int(s[i:i+3])
  y=abs(753-x)
  z=min(z,y)
print(z)

Buggy submission (verdict: Runtime Error):
s=int(input())
z=753
for i in range(s-2):
  x=int(s[i:i+3])
  y=abs(753-x)
  z=min(z,y)
print(z)
Problem p03220 (python)

Fixed submission:
n=int(input())
t,a=map(int,input().split())
x=list(map(int,input().split()))
ans=0
cnt=10**3
for i in range(len(x)):
  s=t-x[i]*0.006
  if abs(s-a)<cnt:
    cnt=abs(s-a)
    ans=i+1
print(ans)

Buggy submission (verdict: Runtime Error):
n=int(input())
t,a=map(int,input().split())
x=list(map(int,input().split()))
ans=0
cnt=10**3
for i in range(x):
  s=t-x[i]*0.006
  if abs(s-a)<cnt:
    cnt=abs(s-a)
    ans=i+1
print(ans)
Problem p03238 (python)

Fixed submission:
n=int(input())

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

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

if n==1:
  print('Hello World')
elif n==2:
  print(a+b)
Problem p03239 (python)

Fixed submission:
n,t=map(int,input().split())
x=1234
for i in range(n):
  c,d=map(int,input().split())
  if d<=t:
    if c<=x:
      x=c
if x==1234:
  print('TLE')
else:
  print(x)

Buggy submission (verdict: Runtime Error):
n,t=map(int,input().split())
x=[]
for i in range(n):
  c,d=map(int,input().split())
  if d<=t:
    x+=c
if x==[]:
  print('TLE')
else:
  print(min(x))

Buggy submission (verdict: Runtime Error):
n,t=map(int,input().split())
x=[]
for i in range(n):
  c,d=map(int,input().split())
  if d<=t:
    x+=c
print(min(x))
Problem p03244 (python)

Fixed submission:
from collections import Counter

n=int(input())
a=list(map(int,input().split()))

if a.count(a[0])==n:
    print(n//2)
    exit()


x=a[::2]
y=a[1::2]

xx=Counter(x)
yy=Counter(y)

xxx=xx.most_common()
yyy=yy.most_common()

if xxx[0][0]!=yyy[0][0]:
    print(n-xxx[0][1]-yyy[0][1])

else:
    print(min(n-xxx[1][1]-yyy[0][1],n-xxx[0][1]-yyy[1][1]))

Buggy submission (verdict: Runtime Error):
n=int(input())
a=list(map(int,input().split()))
if len(set(a))=1:
  print(n//2)
else:
  x=[]
  y=[]
  cnt=0
  for i in a:
    if cnt%2==0:
      x.append(i)
      cnt+=1
    else:
      y.append(i)
      cnt+=1
  s=list(set(x))
  t=list(set(y))
  o=0
  p=0
  for i in s:
    o=max(o,x.count(i))
  for i in t:
    p=max(p,y.count(i))
  print(n-o-p)
Problem p03254 (python)

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

a.sort()

for i in a:
  x-=i
  if x>0:
    ans+=1
    continue
  
  elif x==0:
    ans+=1
    break
    
  else:
    break
    
if ans==n:
  if x!=0:
    ans-=1


print(ans)

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

a.sort()

for i in a:
  x-=a
  if x>0:
    ans+=1
    continue
  
  elif x==0:
    ans+=1
    break
    
  else:
    break
    
print(ans)
Problem p03261 (python)

Fixed submission:
n=int(input())
x=[input() for _ in range(n)]
ans='Yes'
if len(x)==len(set(x)):
  for i in range(n-1):
    if x[i][-1]!=x[i+1][0]:
      ans='No'
      break
else:
  ans='No'
print(ans)

Buggy submission (verdict: Runtime Error):
n=int(input())
x=[input() for _ in range(n)]
ans='Yes'
if len(x)==len(set(x)):
  for i in lenge(n-1):
    if x[i][-1]!=x[i+1][0]:
      ans='No'
      break
else:
  ans='No'
print(ans)

Buggy submission (verdict: Runtime Error):
n=int(input())
lst=[]
cnt=0
for i in range(n):
  x=input()
  if i>=1:
    if x in lst:
      print('No')
      cnt+=1
      exit()
    lst+=x
    if lst[i][0]!=lst[i-1][-1]:
      print('No')
      cnt+=1
      exit()
if cnt==0:
  print('Yes')
Problem p03262 (python)

Fixed submission:
import math
n,p=map(int,input().split())
a=list(map(int,input().split()))
x=[]
for i in a:
  x.append(abs(i-p))
  
if len(x)==1:
  print(x[0])
  
else:
  pin=x[0]
  for i in range(1,len(x)):
    pin=math.gcd(pin,x[i])
    
  print(pin)

Buggy submission (verdict: Runtime Error):
import math
n,x=map(int,input().split())
a=list(map(int,input().split()))
x=[]
for i in a:
  x+=[abs(i-x)]
  
if len(x)==1:
  print(x[0])
  
else:
  pin=x[0]
  for i in range(1,len(x)):
    pin=math.gcd(pin,x[i])
    
  print(pin)
Problem p03264 (python)

Fixed submission:
import math
k=int(input())
print((k//2)*(math.ceil(k/2)))

Buggy submission (verdict: Runtime Error):
import math
k=int(input())
print((k//2)*(math.celi(k//2)))
Problem p03280 (python)

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

Buggy submission (verdict: Runtime Error):
print((int(input())-1)*(int(input())-1))

Buggy submission (verdict: Runtime Error):
print((int(input)-1)*(int(input)-1))
Problem p03289 (python)

Fixed submission:
s=input()
ans='AC'
if s[0]!='A':
  ans='WA'
s=s[1:]
if s[1:-1].count('C')!=1:
  ans='WA'
s=s.replace('C','c')
for i in s:
  if i.islower()==False:
    ans='WA'
    break
print(ans)

Buggy submission (verdict: Runtime Error):
s=input()
ans='AC'
if s[0]!='A':
  ans='WA'
elif s[2:-1].count('C')!=1:
  ans='WA'
s=sorted(s)
if s[2:].islower()==False:
  ans='WA'
print(ans)

Buggy submission (verdict: Runtime Error):
s=input()
if s[0]='A':
  if s[2:-1].count('C')==1:
    s=s[2:-1].replace('C','c')
    s=s[0].replace('A','a')
    if islower(s)==True:
      print('AC')
  else:  print('WA')
else:  print('WA')
Problem p03292 (python)

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

Buggy submission (verdict: Runtime Error):
a=list(map(int,input().split()))
print(max[a]-min[a])
Problem p03293 (python)

Fixed submission:
s=input()
t=input()
result='No'
for i in range(len(s)):
  s=s[-1]+s[:len(s)-1]
  if s==t:
    result='Yes'
print(result)

Buggy submission (verdict: Runtime Error):
s=input()
t=input()
result=='No'
for i in range(len(s)-1):
  s=s[-1]+s[:len(s)-1]
  if s==t:
    result='Yes'
print(result)
Problem p03308 (python)

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

Buggy submission (verdict: Runtime Error):
n=int(input())
a=list(map(int,input().split())
print(max(a)-min(a))

Buggy submission (verdict: Runtime Error):
n=int(input())
a=list(map(int,input().split())
a.sort()
print(a[-1]-a[0])

Buggy submission (verdict: Runtime Error):
n=int(input())
a=[map(int,input().split()]
print(max(a)-min(a))

Buggy submission (verdict: Runtime Error):
n=int(input())
a=map(int,input().split()
print(max(a)-min(a))

Buggy submission (verdict: Runtime Error):
n=int(input())
a=list(map(int,input().split())
print(max(a)-min(a))
Problem p03352 (python)

Fixed submission:
x=int(input())
ans=0
for i in range(1,32):
  for j in range(2,10):
    if x>=i**j:
      ans=(max(ans,i**j))
print(ans)

Buggy submission (verdict: Runtime Error):
x=int(input())
ans=0
for i in range(1,32):
  for j in range(2,10):
    if x>=i**j:
      ans=(max(ans,i**J))
print(ans)
Problem p03379 (python)

Fixed submission:
n=int(input())
a=list(map(int,input().split()))
b=sorted(a)
x=b[n//2-1]
y=b[n//2]
for i in a:
    if i<=x:
      print(y)
    else:
      print(x)

Buggy submission (verdict: Runtime Error):
n=int(input())
a=list(map(int,input().split()))
b=a.sort()
x=b[n//2-1]
y=b[n//2]
for i in a:
    if a<=x:
      print(y)
    else:
      print(x)
Problem p03385 (python)

Fixed submission:
s=input()
if len(set(s))==3:
  print('Yes')
else:
  print('No')

Buggy submission (verdict: Runtime Error):
s=input()
s=s.sorted()
if s=='abc':
  print('Yes')
else:
  print('No')
Problem p03399 (python)

Fixed submission:
a=int(input())
b=int(input())
c=int(input())
d=int(input())
print(min(a,b)+min(c,d))

Buggy submission (verdict: Runtime Error):
a,b,c,d=map(int,input().split())
print(min(a,b)+min(c,d))
Problem p03401 (python)

Fixed submission:
n=int(input())
a=[0]+list(map(int,input().split()))+[0]

dist=[]

for i in range(len(a)-1):
  dist.append(abs(a[i+1]-a[i]))
  
xxx=sum(dist)

for i in range(n):
  ans=xxx
  ans-=dist[i]
  ans-=dist[i+1]
  ans+=abs(a[i+2]-a[i])
  print(ans)

Buggy submission (verdict: Runtime Error):
n=int(input())
a=[0]+list(map(int,input().split()))+[0]

ans=0
x=0

for i in a:
  ans+=abs(i-x)
  x=i

for i in range(1,len(a)-1):
  pin=ans
  if a[i-1]<=a[i]<=a[i+1] or a[i-1]>=a[i]>=a[i+1]:
      print(pin)

  else:
      pin-=abs(a[i]-a[i-1])
      pin-=abs(a[i+1]-a[i])
      pin+-abs(a[i+2]-a[i])
  
      print(pin)
Problem p03407 (python)

Fixed submission:
a,b,c=map(int,input().split())
print('Yes' if a+b>=c else 'No')

Buggy submission (verdict: Runtime Error):
a,b,c=map(int,input().split())
print('Yes':if a+b>=c,else:'No')
Problem p03408 (python)

Fixed submission:
ans=0
n=int(input())
lst=[]
for i in range(n):
  lst.append(input())
m=int(input())
x=[]
for j in range(m):
  x.append(input())
for k in set(lst):
  c=lst.count(k)-x.count(k)
  ans=max(ans,c)
print(ans)

Buggy submission (verdict: Runtime Error):
ans=0
n=int(input())
lst=[]
for i in range(n):
  lst.append(input())
m=int(input())
x=[]
for j in range(m):
  x.append(int(input()))
for k in set(lst):
  c=lst.count(k)-x.cont(k)
  ans=max(ans,c)
print(ans)
Problem p03415 (python)

Fixed submission:
print(input()[0]+input()[1]+input()[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 p03424 (python)

Fixed submission:
n=int(input())
a=list(input().split())
b=set(a)
if len(b)==3:
  print('Three')
if len(b)==4:
  print('Four')

Buggy submission (verdict: Runtime Error):
n=int(input())
a=list(map(int,input().split()))
b=set(a)
if len(b)==3:
  print('Three')
if len(b)==4:
  print('Four')

Buggy submission (verdict: Runtime Error):
n=int(input())
a=list(map(int,input().split()))
b=set(a)
if len(b)==3:
  print('Three')
if len(b)==4:
  print('Four)
Problem p03427 (python)

Fixed submission:
n=int(input())
if n<=9:
  print(n)
else:
  n=str(n)
  x=n[0]
  x=int(x)-1
  if n[1:].count('9')==len(n)-1:
    print(x+1+(len(n)-1)*9)
  else:
    print(x+(len(n)-1)*9)

Buggy submission (verdict: Runtime Error):
n=int(input())
if n<=9:
  print(n)
else:
  n=str(n)
  x=n[0]
  x=int(x)-1
  if n[1:].count('9')==len(n-1):
    print(x+1(len(n)-1)*9)
  else:
    print(x+(len(n)-1)*9)
Problem p03434 (python)

Fixed submission:
n=int(input())
x=list(map(int,input().split()))
x.sort()
x=x[::-1]
cnt=0
a=0
b=0
for i in x:
  if cnt%2==0:
    a+=i
    cnt+=1
  else:
    b+=i
    cnt+=1
print(a-b)

Buggy submission (verdict: Runtime Error):
n=int(input())
x=list(map(int,input().split()))
x=x.sort()
x=x.reverse()
cnt=0
a=0
b=0
for i in x:
  if cnt%2==0:
    a+=i
    cnt+=1
  else:
    b+=i
    cnt+=1
print(a-b)