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

Fixed submission:
import collections

_ = input()
an = sorted([int(i) for i in input().split(" ")])

c = collections.Counter(an)

print(len(c)-(len(c)+1)%2)

Buggy submission (verdict: Runtime Error):
_ = input()
an = sorted([int(i) for i in input().split(" ")])

dic = {}
for a in an:
    if a not in dic:
        dic[a] = 0
    dic[a] += 1

tim = 0
for a in dic:
    if dic[1] % 2 == 0:
        tim += 1

print(len(dic)-(tim+1)%2)
Problem p04048 (python)

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

li = [int(i) for i in input().split(" ")]
res = (li[0] // gcd(li[0], li[1]) -1) * 3 * gcd(li[0], li[1])
print(res)

Buggy submission (verdict: Runtime Error):
import fraction

li = [int(i) for i in input().split(" ")]
res = (li[0] // fraction.gcd(li[0], li[1]) -1) * 3 * fraction.gcd(li[0], li[1])
print(res)

Buggy submission (verdict: Runtime Error):
import math

li = [int(i) for i in input().split(" ")]

res = (li[0] // math.gcd(li[0], li[1]) -1) * 3 * math.gcd(li[0], li[1])
print(res)
Problem p03227 (python)

Fixed submission:
a=list(input())
if len(a)==3:
    a.reverse()
    ans=""
    for i in a:
        ans+=i
    print(ans)
elif len(a)==2:
    ans = ""
    for i in a:
        ans += i
    print(ans)

Buggy submission (verdict: Runtime Error):
a=list(input())
if len(a)==3:
    a.reverse()
    ans=""
    for i in a:
        ans+=i
    print(ans)
elif len(a)==2:
    ans = ""
    for i in a:
        ans += i
    print(ans)
Problem p03544 (python)

Fixed submission:
a=input()
x=2
y=1
z=1
for i in range(a-1):
    z=x+y
    x=y
    y=z

z=str(z)
print z

Buggy submission (verdict: Runtime Error):
a=input()
x=2
y=1
for i in range(a-1):
    z=x+y
    x=y
    y=z

z=str(z)
print z

Buggy submission (verdict: Runtime Error):
a=input()
x=2
y=1
for i in range(a-1):
    z=x+y
    x=y
    y=z

print z

Buggy submission (verdict: Runtime Error):
a=input()
x=2
y=1
for i in range(a-1):
    z=x+y
    x=y
    y=z

print z
Problem p03611 (python)

Fixed submission:
a=input()
b=map(int,raw_input().split())
c=[]
for i in range(100002):
    c.append(0)

for i in b:
    c[i]+=1
    c[i+1]+=1
    c[i+2]+=1

c.sort()
c.reverse()

print c[0]

Buggy submission (verdict: Runtime Error):
a=input()
b=map(int,raw_input().split())
c=[]
for i in range(100000):
    c.append(0)

for i in b:
    c[i]+=1
    c[i+1]+=1
    c[i+2]+=1

c.sort()
c.reverse()

print c[0]
Problem p03731 (python)

Fixed submission:
ini=map(int,raw_input().split())
a=map(int,raw_input().split())

sum=0

for i in range(ini[0]):
  if a[i]==0:
    pass
  else:
    if a[i]-a[i-1]>=ini[1]:
      sum+=ini[1]
    else:
      sum+= a[i]-a[i-1]

sum+=ini[1]

print sum

Buggy submission (verdict: Runtime Error):
ini=map(int,raw_input().split())
a=map(int,raw_input().split())

sum=0

for i in range(ini[0]):
  if a{i]==0:
    pass
  else:
    if a[i]-a[i-1]>=ini[1]:
      sum+=ini[1]
    else:
      sum+= a[i]-a[i-1]

sum+=ini[1]

print sum
Problem p03957 (python)

Fixed submission:
ini=raw_input()
a=list(ini)
check=0
if "C" in a and "F" in a:
	c=a.index("C")
	f=0
	for i in range(len(a)):
		if a[i]=="F":
			f=i
	if c<f:
		check=1
if check==1:
	print "Yes"
else:
	print "No"

Buggy submission (verdict: Runtime Error):
ini=raw_input()
a=list(ini)
check=0
if "C" in list and "F" in list:
    if list.index("C")<list.index("F"):
        check=1
if check==1:
    print "Yes"
else:
    print "No"
Problem p03964 (python)

Fixed submission:
time=input()

aok=1
tak=1

for i in range(time):
	l=map(int, raw_input().split())
	if aok<tak:
		if tak%l[1]!=0:
			tak=(tak/l[1]+1)*l[1]
		if aok>tak/l[1]*l[0]:
			if aok%l[0]!=0:
				aok=(aok/l[0]+1)*l[0]
			tak=aok/l[0]*l[1]
		else:
			aok=tak/l[1]*l[0]
	elif aok==tak:
		if l[0]<=l[1]:
			if aok%l[0]!=0:
				aok=(aok/l[0]+1)*l[0]
			tak=aok/l[0]*l[1]
		else:
			if tak%l[1]!=0:
				tak=(tak/l[1]+1)*l[1]
			aok=tak/l[1]*l[0]
	else:
		if aok%l[0]!=0:
			aok=(aok/l[0]+1)*l[0]
		if tak>aok/l[0]*l[1]:
			if tak%l[1]!=0:
				tak=(tak/l[1]+1)*l[1]
			aok=tak/l[1]*l[0]
		else:
			tak=aok/l[0]*l[1]
print aok+tak

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

aok=1
tak=1

for i in time:
	l=map(int, raw_input().split())
	if l[0]>=l[1]:
		tak=(tak/l[1]+1)*l[1]
		aok=tak/l[1]*l[0]
	else:
		aok=(aok/l[0]+1)*l[0]
		tak=aok/l[0]*l[1]

print aok+tak
Problem p03971 (python)

Fixed submission:
init_input=map(int, raw_input().split())

mem=raw_input()
mem_list=list(mem)

man=init_input[0]
jap=init_input[1]
ove=init_input[2]

jas=0
ovs=0

for i in range(man):
    if mem[i]=="a" and jas+ovs<jap+ove:
        jas+=1
        print "Yes"
    elif mem[i]=="b" and jas+ovs<jap+ove and ovs<ove:
        ovs+=1
        print "Yes"
    else:
        print "No"

Buggy submission (verdict: Runtime Error):
init_input=map(int, raw_input().split())

mem=raw_input()
mem_list=list(mem)

man=init_input[0]
jap=init_input[1]
ove=init_input[2]

jas=0
ovs=0

for i in range(man):
  if mem==a and jas+ovs<jap+ove:
    jap+=1
    print "Yes"
  elif mem==b and jas+ovs<jap+ove and ovs<ove:
    ovs+=1
    print "Yes"
  else:
    print "No"
Problem p03067 (python)

Fixed submission:
A, B, C= map(int, input().split())
if A<C and C<B:
  print("Yes")
elif B<C and C<A:
  print("Yes")
else:
  print("No")

Buggy submission (verdict: Runtime Error):
if A<C and C<B:
  print("Yes")
elif B<C and C<A:
  print("Yes")
else:
  print("No")

Buggy submission (verdict: Runtime Error):
if and(A<C, C<B):
  print("Yes")
elif and(B<C, C<A):
  print("Yes")
else:
  print("No")

Buggy submission (verdict: Runtime Error):
if and(A<C, C<B):
  print("Yes")
elif and(B<C, C<A):
  print("Yes")
else:
  print("No)
Problem p03068 (python)

Fixed submission:
k = int( input())
s = list(str(input()))
n = int( input())
a = ""
  
for i in range(len(s)):
    if s[i] != s[n-1]:
        s[i] = "*"
    a+=(str(s[i]))
        
print(a)

Buggy submission (verdict: Runtime Error):
k = int( input())
s = list(str(input()))
n = int( input())
  
for i in range(len(s)):
    if s[i] != s[n+1]:
        s[i] = "*"
          
print(s)

Buggy submission (verdict: Runtime Error):
k = int( input())
s = list(str(input()))
n = int( input())
  
for i in range(len(s)):
	if s[i] != s[n-1]:
	s[i] = "*"
          
print(s)
Problem p03102 (python)

Fixed submission:
base = list(map(int,input().split()))
cross = list(map(int,input().split()))
counter = 0
for i in range(base[0]):
    source = list(map(int,input().split()))
    point = 0
    for j in range(base[1]):
        point = point + cross[j]*source[j]
    
    if point+base[2] >0:
        counter = counter+1

print(counter)

Buggy submission (verdict: Runtime Error):
3 3 0
100 -100 0
0 100 100
100 100 100
-100 100 100
Problem p03070 (python)

Fixed submission:
import numpy as np
N = int(input())
a = [int(input()) for _ in range(N)]
mod = 998244353
suma = sum(a)
memo = np.zeros((N+1, suma+1), dtype=np.int)
memo[0][0] = 1
memoe = np.zeros((N+1, suma+1), dtype=np.int)
memoe[0][0] = 1

ttl = 3
for i in range(N-1):
  ttl *=3
  ttl %= mod

for i in range(1, N+1):
  memotmp = memo[i-1]
  memotmpe = memoe[i-1]
  memotmp = np.concatenate((np.zeros((a[i-1]), dtype=np.int), memotmp),axis=1)
  memotmpe = np.concatenate((np.zeros((a[i-1]), dtype=np.int), memotmpe),axis=1)
  memo[i] = (memo[i-1]*2 + memotmp[:suma+1])%mod
  memoe[i] = (memoe[i-1] + memotmpe[:suma+1])%mod

ans = sum(memo[N][(suma-1)//2+1:])
if suma%2==0:
  ans -= memoe[N][suma/2]
  
print(((ttl - ans*3)%mod+mod)%mod)

Buggy submission (verdict: Runtime Error):
iimport numpy as np
N = int(input())
a = [int(input()) for _ in range(N)]
mod = 998244353
suma = sum(a)
memo = np.zeros((N+1, suma+1), dtype=np.int)
memo[0][0] = 1
memoe = np.zeros((N+1, suma+1), dtype=np.int)
memoe[0][0] = 1

ttl = 3
for i in range(N-1):
  ttl *=3
  ttl %= mod

for i in range(1, N+1):
  memotmp = memo[i-1]
  memotmpe = memoe[i-1]
  memotmp = np.concatenate((np.zeros((a[i-1]), dtype=np.int), memotmp),axis=1)
  memotmpe = np.concatenate((np.zeros((a[i-1]), dtype=np.int), memotmpe),axis=1)
  memo[i] = (memo[i-1]*2 + memotmp[:suma+1])%mod
  memoe[i] = (memoe[i-1] + memotmpe[:suma+1])%mod

ans = sum(memo[N][(suma-1)//2+1:])
if suma%2==0:
  ans -= memoe[N][suma/2]
  
print(((ttl - ans*3)%mod+mod)%mod)

Buggy submission (verdict: Runtime Error):
N = int(input())
a = [int(input()) for _ in range(N)]
mod = 998244353
suma = sum(a)
memo = [[0]*(suma+1) for _ in range(N+1)]
memo[0][0] = 1
memoe = [[0]*(suma+1) for _ in range(N+1)]
memoe[0][0] = 1

ttl = 3
for i in range(N-1):
  ttl *=3
  ttl %= mod

for i in range(1, N+1):
  memotmp = memo[i-1]
  memotmp = [0]*a[i-1] + memotmp
  for j in range(sum(a[:i])+1):
    memo[i][j] = (memo[i-1][j]*2 + memotmp[j])%mod
    memoe[i][j] = (memoe[i-1][j] + memotmp[j])%mod

ans = sum(memo[N][(suma-1)//2+1:])
if suma%2==0:
  ans -= memoe[N][suma/2]
  
print(((ttl - ans*3)%mod+mod)%mod)

Buggy submission (verdict: Runtime Error):
N = int(input())
a = [int(input()) for _ in range(N)]
mod = 998244353
suma = sum(a)
memo = [[0]*(suma+1) for _ in range(N+1)]
memo[0][0] = 1
memoe = [[0]*(suma+1) for _ in range(N+1)]
memoe[0][0] = 1

ttl = 3
for i in range(N-1):
  ttl *=3
  ttl %= mod
  
for i in range(N+1):
  for j in range(suma+1):
    if i==0:
      continue
    elif j - a[i-1]<0:
      memo[i][j]=(memo[i-1][j]*2)%mod
      memoe[i][j]=(memoe[i-1][j])%mod
    else:
      memo[i][j]=(memo[i-1][j]*2+memo[i-1][j-a[i-1]])%mod
      memoe[i][j]=(memoe[i-1][j]+memoe[i-1][j-a[i-1]])%mod

ans = sum(memo[N][(suma-1)//2+1:])
if suma%2==0:
  ans -= memoe[N][suma/2]
  
print(ttl - ans*3)
Problem p03290 (python)

Fixed submission:
D, G = map(int, input().split())
P = []
C = []
for i in range(D):
  p, c = map(int, input().split())
  P.append(p)
  C.append(c)
ans = 10*100
for i in range(2**D):
  rest = G
  cnt = 0
  maxdgt = -1
  for j in range(D):
    if i>>j & 1:
      rest -= P[j]*(j+1)*100+C[j]
      cnt += P[j]
    else:
      maxdgt = j
  if rest <= 0:
    ans = min(ans, cnt)
  elif rest > (P[maxdgt]-1)*(maxdgt+1)*100:
    continue
  else:
    ans = min(ans, cnt+(rest/100-1)//(maxdgt+1)+1)
print(int(ans))

Buggy submission (verdict: Runtime Error):
D, G = map(int, input().split())
P = []
C = []
for i in range(D):
  p, c = map(int, input().split())
  P.append(p)
  C.append(c)
ans = 10*100
for i in range(2**D):
  rest = G
  cnt = 0
  maxdgt = -1
  for j in range(D):
    if bin(i)>>j & 1:
      rest -= P[i]*(i+1)*100+C[i]
      cnt += P[i]
    else:
      maxdgt = j
  if rest <= 0:
    ans = min(ans, cnt)
  else if rest > (P[maxdgt]-1)*(maxdgt+1)*100:
    continue
  else:
    ans = min(ans, cnt+(rest/100-1)//P[maxdgt]+1)
print(ans)
Problem p03339 (python)

Fixed submission:
N = int(input())
S = input()
A = [1 if S[0]=='E' else 0]
for i in range(1,N):
  A.append(1 if S[i]=='E' else 0)
  A[i] += A[i-1]
ans = min(N-1-A[N-2], A[N-1]-A[0])
for i in range(1,N):
  ans = min(ans, i-A[i-1]+A[N-1]-A[i])
print(ans)

Buggy submission (verdict: Runtime Error):
N = int(input())
S = input()
A = [1 if(S[i]=='E') else 0 for i in range(N)]
for i in range(1,N):
  ans = min(ans, i - sum(A[:i])+ sum(A[i+1:]))
ans = min(ans, sum(A[1:]), N-sum(A[:]))
print(ans)
Problem p03373 (python)

Fixed submission:
A, B, C, X, Y = map(int,input().split())
if(A + B >= 2 * C):
  if(X >= Y):
    print(C * 2 * Y + (X - Y) * min(A, 2 * C))
  else :
    print(C * 2 * X + (Y - X) * min(B, 2 * C))
else:
  print(A * X + B * Y)

Buggy submission (verdict: Runtime Error):
A, B, C, X, Y = map(int,inut().split())
if(A + B >= 2 * C):
  if(X >= Y):
    print(C * 2 * Y + (X - Y) * min(A, 2 * C))
  else :
    print(C * 2 * X + (Y - X) * min(B, 2 * C))
else:
  print(A * X + B * Y)
Problem p03435 (python)

Fixed submission:
C = [0]*3
C1 = [[0]*2]*3
C2 = [[0]*3]*2
flg = False
for i in range(3):
  C[i] = list(map(int, input().split()))
for i in range(2):
  for j in range(2):
    if(C[i][j] -C[i][j+1] != C[i+1][j] -C[i+1][j+1]):
      flg = True
for i in range(2):
  for j in range(2):
    if(C[i][j] -C[i+1][j] != C[i][j+1] -C[i+1][j+1]):
      flg = True
print("No" if flg else "Yes")

Buggy submission (verdict: Runtime Error):
C = [0]*3
C1 = [[0]*2]*3
C2 = [[0]*3]*2
for i in range(3):
  C[i] = list(map(int, input().split()))
for i in range(3):
  for j in range(2):
    C1[i][j] = C[i][j] - C[i][j+1]
for i in range(2):
  for j in range(3):
    C2[i][j] = C[i][j] - C[i+1][j]
if(C1[0][0] == C1[1][0] == C1[2][0]):
  if(C1[0][1] == C1[1][1] == C1[2][1]):
    if(C2[0][0] == C2[0][1] == C2[0][2]):
      if(C2[1][0] == C2[1][1] == C2[1][2]):
  print("No")
  exit()
print("No")

Buggy submission (verdict: Runtime Error):
C = []*3, C1 = [[]*2]*3, C2 = [[]*3]*2
for i in range(3):
  C[i] = list(map(int, input().splite()))
for i in range(3):
  for j in range(2):
    C1[i][j] = C[i][j] - C[i][j+1]
for i in range(2):
  for j in range(3):
    C2[i][j] = C[i][j] - C[i+1][j]
if(C1[0][0] == C1[1][0] and C1[1][0] == C1[2][0]):
  if(C1[0][1] == C1[1][1] and C1[1][1] == C1[2][1]):
    if(C2[0][0] == C2[0][1] and C1[0][1] == C1[0][2]):
      if(C2[1][0] == C1[1][1] and C1[1][1] == C1[1][2]):
        print("Yes")
        exit()
else:
  print("No")
Problem p03449 (python)

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

A3=[sum(A1[0:i+1]) for i in range(N)]
A4=[0] + [sum(A2[0:i+1]) for i in range(N)]
ans=0
for i in range(N):
  ans = max(ans, A3[i]+A4[N]-A4[i])
print(ans)

Buggy submission (verdict: Runtime Error):
N = int(input())
A1 = list(map(int,input().split()))
A2 = list(map(int,input().split()))
A3=[]
A4=[0]
for i in range(N):
  A3.append(sum(A1[0:i]))
for i in range(N):
  A4.append(sum(A2[0:i]))
ans=0
for i in range(N):
  ans = max(ans, A3[:i]+A4[i:])
print(ans)
Problem p03599 (python)

Fixed submission:
A, B, C, D, E, F = map(int, input().split())
W = set()
S = set()
wtr = 100*A
sgr = 0

i = 1
j = 0
while(wtr <= F):
  while(wtr <= F):
    W.add(wtr)
    wtr = i*A*100 + j*B*100
    j +=1
  i +=1
  j = 0
  wtr = i*A*100 + j*B*100
  
i = 0
j = 0
while(sgr <= F):
  while(sgr <= F):
    S.add(sgr)
    sgr = i*C + j*D
    j +=1
  i +=1
  j = 0
  sgr = i*C + j*D
answtr = 100*A
anssgr = 0
  
for wtr in W:
  for sgr in S:
    if (sgr*(answtr+anssgr) > anssgr*(wtr+sgr)) and (sgr*(100+E)<=E*(wtr+sgr) and (wtr+sgr<=F)):
      answtr = wtr
      anssgr = sgr
print("{} {}".format(answtr+anssgr, anssgr))

Buggy submission (verdict: Runtime Error):
A, B, C, D, E, F = map(int, input().split())
W = set()
S = set()
wtr = 100*A
sgr = 0

i = 1
j = 0
while(wtr <= F):
  while(wtr <= F):
    W.add(wtr)
    wtr = i*A*100 + j*B*100
    j +=1
  i +=1
  j = 0
  wtr = i*A*100 + j*B*100
  
i = 0
j = 0
while(sgr <= F):
  while(sgr <= F):
    S.add(sgr)
    sgr = i*C + j*D
    j +=1
  i +=1
  j = 0
  sgr = i*C + j*D
answtr = 100*A
anssgr = 0
  
for wtr in sorted(list(W), reversed):
  for sgr in sorted(list(S), reversed):
    if (sgr*(answtr+anssgr) > anssgr*(wtr+sgr)) and (sgr*(100+E)<=E*(wtr+sgr) and (wtr+sgr<=F)):
      answtr = wtr
      anssgr = sgr
      if anssgr*(100+E)==E*(answtr+anssgr):
        print("{} {}".format(answtr+anssgr, anssgr))
        exit()
print("{} {}".format(answtr+anssgr, anssgr))

Buggy submission (verdict: Runtime Error):
A, B, C, D, E, F = map(int, input().split())
W = set()
S = set()
wtr = 100*A
sgr = 0

i = 1
j = 0
while(wtr <= F):
  while(wtr <= F):
    W.add(wtr)
    wtr = i*A*100 + j*B*100
    j +=1
  i +=1
  j = 0
  wtr = i*A*100 + j*B*100
  
i = 0
j = 0
while(sgr <= F):
  while(sgr <= F):
    S.add(sgr)
    sgr = i*C + j*D
    j +=1
  i +=1
  j = 0
  sgr = i*C + j*D
answtr = 100*A
anssgr = 0
  
for wtr in W:
  for sgr in S:
    if (sgr*(answtr+anssgr) > anssgr*(wtr+sgr)) and (sgr*(100+E)<=E*(wtr+sgr) and (wtr+sgr<=F)):
      answtr = wtr
      anssgr = sgr
      if (anssgr*(100+E)==E*(answtr+anssgr):
          print("{} {}".format(answtr+anssgr, anssgr))
          exit()
print("{} {}".format(answtr+anssgr, anssgr))

Buggy submission (verdict: Runtime Error):
A, B, C, D, E, F = map(int, input().split())
W = set()
S = set()
wtr = 100*A
sgr = 0

i = 1
j = 0
while(wtr <= F):
  while(wtr <= F):
    W.add(wtr)
    wtr = i*A*100 + j*B*100
    j +=1
  i +=1
  j = 0
  wtr = i*A*100 + j*B*100
  
i = 0
j = 0
while(sgr <= F):
  while(sgr <= F):
    S.add(sgr)
    sgr = i*C + j*D
    j +=1
  i +=1
  j = 0
  sgr = i*C + j*D
answtr = 100*A
anssgr = 0
  
for wtr in W:
  for sgr in S:
    if (sgr*(answtr+anssgr) > anssgr*(wtr+sgr)) and (sgr*(100+E)<=E*(wtr+sgr) and (wtr+sgr<=F)):
      answtr = wtr
      anssgr = sgr
      if (ansgr*(100+E)==E*(answtr+anssgr):
          print("{} {}".format(answtr+anssgr, anssgr))
          exit()
print("{} {}".format(answtr+anssgr, anssgr))
Problem p03606 (python)

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

Buggy submission (verdict: Runtime Error):
n, a = int(input()), 0
for i in range(n):
  l, r = int(input().split())
  a += r - l + 1
print(a)
Problem p03632 (python)

Fixed submission:
A, B, C, D = map(int, input().split())
print(max(0, min(B,D) - max(A,C)))

Buggy submission (verdict: Runtime Error):
A, B, C, D = map(int, input().split())
if(A<C):
  print(max(0, B-D))
if(A>C):
  print(max(0, D-B))
if(A=C):
  print(min(B-A, D-A))
Problem p03739 (python)

Fixed submission:
n = int(input())
A = list(map(int,input().split()))
acm1 = 0
acm2 = 0
ans1 = 0
ans2 = 0
for i, a in enumerate(A):
  acm1 += a
  acm2 += a
  if(i%2==1):
    if(acm1>=0):
      ans1 += acm1 + 1
      acm1 = -1
    if(acm2<=0):
      ans2 += -acm2 + 1
      acm2 = 1
  else:
    if(acm1<=0):
      ans1 += -acm1 + 1
      acm1 = 1
    if(acm2>=0):
      ans2 += acm2 + 1
      acm2 = -1
print(min(ans1, ans2))

Buggy submission (verdict: Runtime Error):
n = int(input())
A = [map(int,input().split())]
acm1 = 0
acm2 = 0
ans1 = 0
ans2 = 0
for i, a in enumerate(A):
  acm1 += a
  acm2 += a
  if(i%2==1):
    if(acm1>=0):
      ans1 += acm1 + 1
      acm1 = -1
    if(acm2<=0):
      ans2 += -acm2 + 1
      acm2 = 1
  else:
    if(acm1<=0):
      ans1 += -acm1 + 1
      acm1 = 1
    if(acm2>=0):
      ans2 += acm2 + 1
      acm2 = -1
print(min(ans1, ans2))
Problem p03944 (python)

Fixed submission:
W, H, N = map(int, input().split())
x1 = y1 = a1 = 0
xmin = 0
xmax = W
ymin = 0
ymax = H
for _ in range(N):
  x2, y2, a2 = map(int, input().split())
  if (a2 == 1):
    xmin = max(x2, xmin)
  if (a2 == 2):
    xmax = min(x2, xmax)
  if (a2 == 3):
    ymin = max(y2, ymin)
  if (a2 == 4):
    ymax = min(y2, ymax)
  if (xmax<= xmin or ymax <= ymin):
    print(0)
    exit()
print((xmax - xmin) * (ymax - ymin))

Buggy submission (verdict: Runtime Error):
W, H, N = map(int, input().split())
x1 = y1 = a1 = 0
xmin = 0
xmax = W
ymin = 0
ymax = H
for _ in range(N):
  x2, y2, a2 = map(int, input().split())
  if (a2 = 1):
    xmin = max(x2, xmin)
  if (a2 = 2):
    xmax = min(x2, xmax)
  if (a2 = 3):
    ymin = max(y2, ymin)
  if (a2 = 4):
    ymax = min(y2, ymax)
  if (xmax<= xmin or ymax <= ymin):
    print(0)
    exit()
print((xmax - xmin) * (ymax - ymin))
Problem p03059 (python)

Fixed submission:
A, B, T = [int(x) for x in input().split(" ")]
s = 0
i = A
while i <= T + 0.5:
    s += B
    i += A

print(s)

Buggy submission (verdict: Runtime Error):
A, B, T = [int(x) for x in input().split(" ")]
s = 0
i = A
while i <= T + 0.5:
    s += B
    i += A

print(s)

N = int(input())

Buggy submission (verdict: Runtime Error):
A, B, T = [int(x) for x in input().split(" ")]
s = 0
for i in range(A,T+0.5,A):
    s += B
    
print(s)
Problem p04012 (python)

Fixed submission:
W = input()

r = {}
for w in W:
    r.setdefault(w, 0)
    r[w] += 1

print("Yes" if len(list(filter(lambda x: x % 2 == 1, r.values()))) == 0 else "No")

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

r = {}
for w in W:
    r.setdefault(w, 0)
    r[w] += 1

print("Yes" if len(list(filter(lambda x: x % 2 == 1, r))) == 0 else "No")
Problem p04030 (python)

Fixed submission:
S = input()

disp = []
for s in S:
    if s == "B":
        if len(disp) > 0:
            disp.pop()
        continue
    disp.append(s)
print("".join(disp))

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

disp = []
for s in S:
    if s == "B":
        if len(S) > 0:
            disp.pop()
        continue
    disp.append(s)
print("".join(disp))

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

disp = []
for s in S:
    if s == "B":
        if len(s) > 0:
            disp.pop()
        continue
    disp.append(s)
print("".join(disp))
Problem p04044 (python)

Fixed submission:
N, L = [int(x) for x in input().split()]
print("".join(sorted([input() for _ in range(N)],reverse=False)))

Buggy submission (verdict: Runtime Error):
N, L = [int(x) for x in input().split()]
S = [input() for _ in range(N)]
S.sort(key=lambda x: -x)
print("".join(S[:L]))
Problem p03262 (python)

Fixed submission:
from fractions import gcd
from functools import reduce
N, X = list(map(int, input().split()))
lst = list(map(lambda x: abs(int(x)-X), input().split()))
print(reduce(gcd, lst))

Buggy submission (verdict: Runtime Error):
from math import gcd
from functools import reduce
N, X = list(map(int, input().split()))
lst = list(map(lambda x: abs(int(x)-X), input().split()))
print(reduce(gcd, lst))
Problem p03274 (python)

Fixed submission:
n, k = list(map(int, input().split()))
x = list(map(int, input().split()))
ans = [min(abs(x[i]), abs(x[i+k-1]))+x[i+k-1]-x[i] for i in range(n-k+1)]
print(min(ans))

Buggy submission (verdict: Runtime Error):
n, k = list(map(int, input().split()))
x = [int(input()) for i in range(n)]
ans = [min(abs(x[i]), abs(x[i+k-1]))+x[i+k-1]-x[i] for i in range(n-k+1)]
print(min(ans))

Buggy submission (verdict: Runtime Error):
n, k = list(map(int, input().split()))
x = [int(inout()) for i in range(n)]
ans = [min(abs(x[i]), abs(x[i+k-1]))+x[i+k-1]-x[i] for i in range(n-k+1)]
print(min(ans))
Problem p03280 (python)

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

Buggy submission (verdict: Runtime Error):
a = int(input())-1
b = int(input())-1
print(a*b)
Problem p03281 (python)

Fixed submission:
n = int(input())
lst = [105, 135, 165, 189, 195, 201]
for i in range(6):
    if n < lst[i]:
        print(i)
        break

Buggy submission (verdict: Runtime Error):
n = int(input())
lst = [105, 135, 165, 189, 195, 201]
for i in range(6):
    if n < lst(i):
        print(i)
        break
Problem p03282 (python)

Fixed submission:
s = input()
k = int(input())
i = 0
while s[i] == '1':
    i += 1
    if i == len(s):
        break
print(s[i] if i < k else 1)

Buggy submission (verdict: Runtime Error):
s = input()
k = int(input())
i = 0
while s[i] == '1':
    i += 1
print(s[i] if i < k else 1)
Problem p03309 (python)

Fixed submission:
n = int(input())
a = list(map(int, input().split()))
for j in range(n):
    a[j] = a[j] - (j + 1)
a.sort()
if n % 2 == 0:
    print(sum(a[int(n / 2):]) - sum(a[:int(n / 2)]))
else:
    print(sum(a[int((n + 1) / 2):]) - sum(a[:int((n - 1) / 2)]))

Buggy submission (verdict: Runtime Error):
n = int(input())
a = list(map(int, input().split()))
for j in range(n):
    a[j] = a[j] - (j + 1)
a.sort()
if x % 2 == 0:
    print(sum(a[n / 2:]) - sum(a[:n / 2])
else:
    print(sum(a[(n + 1) / 2:]) - sum(a[:(n - 1) / 2])

Buggy submission (verdict: Runtime Error):
n = int(input())
a = list(map(int, input().split()))
def devide2a(x):
    
def devide2b(y):
    if x % 2 == 0:
        return int(n / 2)
    else:
        return int((n - 1) / 2)
for j in range(n):
    a[j] = a[j] - (j + 1)
a.sort()
if x % 2 == 0:
    print(sum(a[n / 2:]) - sum(a[:n / 2])
else:
    print(sum(a[(n + 1) / 2:]) - sum(a[:(n - 1) / 2])

Buggy submission (verdict: Runtime Error):
n = int(input())
a = list(map(int, input().split()))
sadlist = []
for h in range(n):
    a[h] = a[h] - (h + 1)
for i in range(min(a), max(a)):
    sad = 0
    for j in range(n):
        sad = sad + abs(a[j] - i)
    sadlist.append(sad)
print(min(sadlist))
Problem p03085 (python)

Fixed submission:
b=input()

if b=='A':
  print('T')
elif b=='T':
  print('A')
elif b=='C':
  print('G')
elif b=='G':
  print('C')

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

if b=='A':
  print('T')
elif b=='T':
  print('A')
elif b=='C':
  print('G')
elif b=='G':
  pring('C')