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

Fixed submission:
n=int(input())
cnt=0
for i in range(1,n+1):
  for j in range(6):
    if 10**j<=i<10**(j+1):
      J=j
      break
  if J%2==0:
    cnt+=1
print(cnt)

Buggy submission (verdict: Runtime Error):
n=int(input())
cnt=0
J=0
for i in range(n):
  for j in range(5):
    if 10**j=<i<10**(j+1):
      J=j
      break
  if J%2==0:
    cnt+=1
print(cnt)

Buggy submission (verdict: Runtime Error):
n=int(input())
cnt=0
for i in range(n):
  for j in range(5):
    if 10**j=<i<10**(j+1):
      J=j
      break
  if J%2==0:
    cnt+=1
print(cnt)
Problem p02958 (python)

Fixed submission:
n=int(input())
p=list(map(int,input().split()))
cnt=0
for i in range(n):
  if p[i]!=i+1:
    cnt+=1
if cnt>2:
  print('NO')
else:
  print('YES')

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

print(totl)

Buggy submission (verdict: Runtime Error):
n=int(input())
p=list(map(int,input().split()))
q=[]
for i in range(n-1):
  q.append(p[i+1]-p[i])
cnt=q.count(1)
if cnt=>3:
  print('NO')
else:
  print('YES')
Problem p02971 (python)

Fixed submission:
import collections
n=int(input())
a=[]
for i in range(n):
  a.append(int(input()))
b=collections.Counter(a)
d=list(b.items())
d.sort(key=lambda x:-int(x[0]))
if d[0][1]==1:
  for i in range(n):
    if a[i]==int(d[0][0]):
      print(int(d[1][0]))
    else:
      print(int(d[0][0]))
else:
  for i in range(n):
    print(int(d[0][0]))

Buggy submission (verdict: Runtime Error):
import collections
n=int(input())
a=[]
for i in range(n):
  a.append(int(input()))
b=collections.Counter(a)
d=list(b.items())
d.sort(lambda x:-x[1])
if d[0][1]==1:
  for i in range(n):
    if a[i]==int(d[0][0]):
      print(int(d[1][0]))
    else:
      print(int(d[0][0]))
else:
  for i in range(n):
    print(int(d[0][0]))

Buggy submission (verdict: Runtime Error):
n=int(input())
a=[int(input()) for i in range(n)]
b=sorted(a,reverse=True)
m=set(b)
M=m[0]
indexes=[j for j,x in enumerate(a) if x==M]
for k in range(n):
  if a[k]==M and len(indexes)==1:
    print(m[1])
  else:
    print(M)

Buggy submission (verdict: Runtime Error):
n=int(input())
a=[int(input()) for i in range(n)]
b=a
b.sort(reverse=True)
m=set(b)
M=m[0]
indexes=[j for j,x in enumerate(a) if x==M]
for k in range(n):
  if a[k]==M and len(indexes)==1:
    print(m[1])
  else:
    print(M)

Buggy submission (verdict: Runtime Error):
n=int(input())
a=[int(input()) for i in range(n)]
m=set(sorted(a,reverse=True))
M=m[0]
indexes=[j for j,x in enumerate(a) if x==M]
for k in range(n):
  if a[k]==M and len(indexes)==1:
    print(m[1])
  else:
    print(M)

Buggy submission (verdict: Runtime Error):
n=int(input())
a=[int(input()) for i in range(n)]
M=max(a)
indexes=[j for j,x in enumerate(a) if x==M]
for k in range(n):
  if a[k]==M and len(indexes)==1:
    print(max(max(a[:k]),max(a[k+1:])))
  else:
    print(M)

Buggy submission (verdict: Runtime Error):
n=int(input())
a=[]
for i in range(n):
  a.append(int(input()))
for j in range(n):
  print(max(max(a[:j]),max(a[j+1:])))
Problem p02983 (python)

Fixed submission:
import sys
l,r=map(int,input().split())

if 2018<=r-l:
  print(0)
  sys.exit()

L=l%2019
R=r%2019
m=2018

if L>R:
  print(0)
  sys.exit()

  
for i in range(L,R):
  for j in range(i+1,R+1):
    m=min((i*j)%2019,m)

print(m)

Buggy submission (verdict: Runtime Error):
l,r=map(int,input().split())
lst=list(range(l,r+1))
lst1=lst[:min(2020,r-l+2)]
def div(n):
  return n%2019
lst1=list(map(div,lst1))
lst1.sort()
print(lst1[0]*lst1[1])

Buggy submission (verdict: Runtime Error):
l,r=map(int,input().split())
lst=list(range(l,r+1))
lst1=lst[:min(2020,r-l+2)]
def div(n):
  return n%2019
lst1=map(div,lst1)
lst1.sort()
print(lst1[0]*lst1[1])

Buggy submission (verdict: Runtime Error):
l,r=map(int,input().split())
lst=list(range(l,r+1))
def div(n):
  return n%2019
lst1=map(div,lst)
lst1.sort()
print(lst1[0]*lst1[1])

Buggy submission (verdict: Runtime Error):
l,r=map(int,input().split())
lst=range(l,r+1)
def div(n):
  return n%2019
lst=map(div,lst)
lst.sort()
print(lst[0]*lst[1])

Buggy submission (verdict: Runtime Error):
l,r=map(int,input().split())
lst=[range(l,r+1)]
def div(n):
  return n%2019
lst=map(div,lst)
lst.sort()
print(lst[0]*lst[1])

Buggy submission (verdict: Runtime Error):
l,r=map(int,input().split())
if l-r+1>=2019:
  print(0)
else:
  L=[]
  R=[]
  for i in range(l,r):
    L.append(i%2019)
    R.append((i+1)%2019)
  m=2019
  for j in range(L):
    for k in range(R):
      if j!=k:
        if (j*k)%2019<m:
          m=(j*k)%2019
  print(m)
Problem p02988 (python)

Fixed submission:
n=int(input())
p=list(map(int,input().split()))
cnt=0
for i in range(n-2):
  lst=[p[i],p[i+1],p[i+2]]
  m=min(lst)
  P=p[i+1]
  del lst[lst.index(m)]
  if min(lst)==P:
    cnt+=1
print(cnt)

Buggy submission (verdict: Runtime Error):
n=int(input())
p=list(map(int,input().split()))
cnt=0
for i in range(n-2):
  lst=[p[i],p[i+1],p[i+2]]
  m=min(lst)
  P=p[i+1]
  del lst.index(m)
  if min(lst)==P:
    cnt+=1
print(cnt)
Problem p02994 (python)

Fixed submission:
n,l=map(int,input().split())
d=114514
num=114514
for j in range(n):
  if abs(l+j)<d:
    d=abs(l+j)
    num=j
s=0
for i in range(n):
  s+=i
print(s+(n-1)*l-num)

Buggy submission (verdict: Runtime Error):
n,l=map(int,input().split())
d=114514
num=114514
for j in range(n):
  if abs(l+j)<d:
    d=abs(l+j)
    num=j
s=0
for in range(n):
  s+=1
print(s+(n-1)*l-num)
Problem p02995 (python)

Fixed submission:
import fractions
a,b,c,d=map(int,input().split())
CD=fractions.gcd(c,d)
cd=(c*d)//CD
width=b-a
cnt=0
if width%c==0:
  if a%c==0:
    cnt+=(width//c)+1
  else:
    cnt+=(width//c)
else:
  if c-(a%c)+b%c>=c:
    if a%c==0 or b%c==0:
      cnt+=(width//c)+1
    else:
      cnt+=(width//c)
  else:
    cnt+=(width//c)+1

if width%d==0:
  if a%d==0:
    cnt+=(width//d)+1
  else:
    cnt+=(width//d)
else:
  if d-(a%d)+b%d>=d:
    if a%d==0 or b%d==0:
      cnt+=(width//d)+1
    else:
      cnt+=(width//d)
  else:
    cnt+=(width//d)+1

if width%cd==0:
  if a%cd==0:
    cnt-=(width//cd)+1
  else:
    cnt-=(width//cd)
else:
  if cd-(a%cd)+b%cd>=cd:
    if a%cd==0 or b%cd==0:
      cnt-=(width//cd)+1
    else:
      cnt-=(width//cd)
  else:
    cnt-=(width//cd)+1

print(b-a+1-cnt)

Buggy submission (verdict: Runtime Error):
a,b,c,d=map(int,input().split())
def gcd(x,y):
  while y!=0:
    x,y=y,x%y
  return x
C=((b-a+1)//c)+1
D=((b-a+1)//d)+1
CD=((b-a+1)//gcd(c,d if c>d else d,c))+1
print(b-a+1-C-D+CD)

Buggy submission (verdict: Runtime Error):
import fractions
a,b,c,d=map(int,input().split())
yoso=b-a+1
kobai=fractions.lcm(c,d)
AC=c-(a%c)
if AC==c:
  AC=0
BC=b%c
AD=d-(a%d)
if AD==d:
  AD=0
BD=b%d
A_kobai=a%kobai
if A_kobai==kobai:
  A_kobai=0
B_kobai=b%kobai
C=0
if AC+BC>(yoso%c):
  C=yoso//c
else:
  C=(yoso//c)+1
D=0
if AD+BD>(yoso%d):
  D=yoso//d
else:
  D=(yoso//d)+1
CD=0
if A_kobai+B_kobai>(yoso%kobai):
  CD=yoso//kobai
else:
  CD=(yoso//kobai)+1
print(yoso+CD-C-D)

Buggy submission (verdict: Runtime Error):
import math
a,b,c,d=map(int,input().split())
yoso=b-a+1
kobai=math.gcd(c,d)
BC=b%c
BD=b%d
Bkobai=b%kobai
C=0
if BC>=(yoso%c):
  C=yoso//c
else:
  C=(yoso//c)+1
D=0
if BD>=(yoso%d):
  D=yoso//d
else:
  D=(yoso//d)+1
CD=0
if Bkobai>=(yoso%kobai):
  CD=yoso//kobai
else:
  CD=(yoso//kobai)+1
print(yoso+CD-C-D)
Problem p03006 (python)

Fixed submission:
from collections import Counter
import sys
n=int(input())
lst=[]
for i in range(n):
  X,Y=map(int,input().split())
  lst.append([X,Y])
lst_2=sorted(lst,key=lambda x: x[0])
lst_3=sorted(lst,key=lambda x: x[1])
z=[]
if n==1:
  print(1)
  sys.exit()
else:
  for j in range(n):
    for k in range(j+1,n):
      z.append((lst_2[j][0]-lst_2[k][0],lst_2[j][1]-lst_2[k][1]))
u=[]
if n==1:
  print(1)
  sys.exit()
else:
  for j in range(n):
    for k in range(j+1,n):
      u.append((lst_3[j][0]-lst_3[k][0],lst_3[j][1]-lst_3[k][1]))
Z=Counter(z)
U=Counter(u)
m=max(Z.most_common()[0][1],U.most_common()[0][1])
print(n-m)

Buggy submission (verdict: Runtime Error):
from collections import Counter
n=int(input())
lst=[]
for i in range(n):
  X,Y=map(int,input().split())
  lst.append([X,Y])
lst_2=sorted(lst,key=lambda x: x[0])
lst_3=sorted(lst,key=lambda x: x[1])
z=[]
if n==1:
  print(1)
else:
  for j in range(n):
    for k in range(j+1,n):
      z.append((lst_2[j][0]-lst_2[k][0],lst_2[j][1]-lst_2[k][1]))
u=[]
if n==1:
  print(1)
else:
  for j in range(n):
    for k in range(j+1,n):
      u.append((lst_3[j][0]-lst_3[k][0],lst_3[j][1]-lst_3[k][1]))
Z=Counter(z)
U=Counter(u)
m=max(Z.most_common()[0][1],U.most_common()[0][1])
print(n-m)

Buggy submission (verdict: Runtime Error):
from collections import Counter
n=int(input())
lst=[]
for i in range(n):
  X,Y=map(int,input().split())
  lst.append([X,Y])
lst_2=sorted(lst,key=lambda x: x[0])
z=[]
if n==1:
  print(1)
else:
  for j in range(n):
    for k in range(j+1,n):
      z.append((lst_2[j][0]-lst_2[k][0],lst_2[j][1]-lst_2[k][1]))
Z=Counter(z)
m=Z.most_common()[0][1]
print(n-m)

Buggy submission (verdict: Runtime Error):
from collections import Counter
n=int(input())
x=[]
y=[]
for i in range(n):
  X,Y=map(int,input().split())
  x.append(X)
  y.append(Y)
z=[]
for j in range(n):
  for k in range(j+1,n):
    z.append((x[j]-x[k],y[j]-y[k]))
Z=Counter(z)
m=Z.most_common()[0][1]
print(n-m)

Buggy submission (verdict: Runtime Error):
from collections import Counter
n=int(input())
x=[]
y=[]
for i in range(n):
  X,Y=map(int,input().split())
  x.append(X)
  y.append(Y)
z=[]
for j in range(n):
  for k in range(j+1,n):
    z.append((x[j]-x[k],y[j]-y[k]))
m=z.most_common()[0][1]
print(n-m)
Problem p03037 (python)

Fixed submission:
n,m=map(int,input().split())
l=[]
r=[]
for i in range(m):
  a,b=map(int,input().split())
  l.append(a)
  r.append(b)
lm=max(l)
rm=min(r)
if rm-lm<0:
  print(0)
else:
  print(rm-lm+1)

Buggy submission (verdict: Runtime Error):
n,m=map(int,input().split())
L=100000
R=100000
for i in range(m):
  l=int(input())
  r=int(input())
  L=max(L,l)
  R=min(R,r)
print(max(0,R-L+1))

Buggy submission (verdict: Runtime Error):
n,m=map(int,input().split())
L=100000
R=100000
for i in range(m):
  l=int(input())
  r=int(input())
  L=max(L,l)
  R=min(R,r)
print(max(0,R-L+1))

Buggy submission (verdict: Runtime Error):
n,m=map(int,input().split())
lst=[]
L=100000
R=100000
for i in range(m):
  l=int(input())
  r=int(input())
  L=max(L,l)
  R=min(R,r)
print(max(0,R-L+1))

Buggy submission (verdict: Runtime Error):
n,m=map(int,input().split())
lst=[]
for i in range(m):
  l=int(input())
  r=int(input())
  for j in range(l,r+1):
    lst.append(j)
print(len(set(lst)))

Buggy submission (verdict: Runtime Error):
n,m=map(int,input().split())
lst=[]
for i in range(n):
  l=int(input())
  r=int(input())
  for j in range(l,r+1):
    lst.append(j)
print(len(set(lst)))
Problem p03043 (python)

Fixed submission:
n,k=map(int,input().split())
lst=[]
for m in range(1,n+1):
  a=1
  cnt=0
  for i in range(100000):
    if m*a>=k:
      lst.append(cnt)
      break
    else:
      a*=2
      cnt+=1
totl=0
for j in range(n):
  totl+=0.5**lst[j]
print(totl/n)

Buggy submission (verdict: Runtime Error):
from math import log
n,k=map(int,input().split())
p=0
for i in range(1,n+1):
  p+=((1/2)**(math.ceil(math.log2(k/i))))/n
print(p)
Problem p03076 (python)

Fixed submission:
a=[]
for i in range(5):
  a.append(int(input()))
b=[]
for j in range(5):
  if a[j]%10==0:
    b.append(10)
  else:
    b.append(a[j]%10)
idx=b.index(min(b))
cnt=a[idx]
del a[idx]
for k in range(4):
  if a[k]%10==0:
    cnt+=a[k]
  else:
    cnt+=a[k]+10-(a[k]%10)
print(cnt)

Buggy submission (verdict: Runtime Error):
a=[]
for i in range(5):
  a.append(input())
b=[]
for j in range(5):
  if a[j]%10==0:
    b.append(10)
  else:
    b.append(a[j]%10)
idx=b.index(min(b))
cnt=a[idx]
del a[idx]
for k in range(4):
  if a[k]%10==0:
    cnt+=a[k]
  else:
    cnt+=a[k]+10-(a[k]%10)
print(cnt)
Problem p03085 (python)

Fixed submission:
b=input()
a=['A','C','G','T']
c=['T','G','C','A']
i=a.index(b)
print(c[i])

Buggy submission (verdict: Runtime Error):
b=input()
a=['A','C','G','T']
b=['A','T','C','G']
i=a.index(b)
print(b[i])
Problem p03087 (python)

Fixed submission:
n,q=map(int,input().split())
s=input()
t=[0]*(n+1)
for i in range(n):
  t[i+1]=t[i]+(1 if s[i:i+2]=='AC' else 0)
for j in range(q):
  l,r=map(int,input().split())
  print(t[r-1]-t[l-1])

Buggy submission (verdict: Runtime Error):
n,q=map(int,input().split())
s=input()
t=[0]*n
for i in range(n):
  t[i+1]=t[i]+(1 if s[i:i+2]=='AC' else 0)
for j in range(q):
  l,r=map(int,input().split())
  print(t[r-1]-t[l-1])
Problem p03102 (python)

Fixed submission:
import numpy as np
N,M,C = map(int,input().split())
B = [int(k) for k in input().split()]
A = [[int(j) for j in input().split()] for i in range(N)] 
b = np.array(B)
cnt = 0
for i in range(N):
    if (np.dot(np.array(A[i]),b) + C >0):
        cnt += 1
    else:
        cnt = cnt
        
print(cnt)

Buggy submission (verdict: Runtime Error):
import numpy as np
N,M,C = map(int,input().split())
B = [int(k) for k in input().split()]
A = [[int(j) for j in input().split()] for i in range(1,N+1)] 
b = np.array(B)
cnt = 0
for i in range(1,N+1):
    if (np.dot(np.array(A[i]),b) + C >0):
        cnt += 1
    else:
        cnt = cnt
        
print(cnt)

Buggy submission (verdict: Runtime Error):
import numpy as np
N,M,C = map(int,input().split())
B = [int(k) for k in input().split()]
A = [[int(j) for j in input().split()] for i in range(1,N+1)] 
b = np.array(B)
a = np.array(A)
cnt = 0
for i in range(1,N+1):
    if (np.dot(a[i],b) + C >0):
        cnt += 1
    else:
        cnt = cnt
        
print(cnt)

Buggy submission (verdict: Runtime Error):
import numpy as np
N,M,C = map(int,input().split())
B = [int(k) for k in input().split()]
A = [[int(j) for j in input().split()] for i in range(1,N)] 
b = np.array(B)
a = np.array(A)
cnt = 0
for i in range(1,N):
    if (np.dot(a[i],b) + C >0):
        cnt += 1
    else:
        cnt = cnt
        
print(cnt)

Buggy submission (verdict: Runtime Error):
import numpy as np
N,M,C = map(int,input().split())
B = [int,input().split()]
for i in range(1,N):
    Ai = [int(j) for j in input().split()]
    ai = np.array(Ai)   
b = np.array(B)
bt = b.reshape([M,1])
cnt = 0
for i in range(1,N)
    if (np.dot(ai,bt) + C >0)
         cnt += 1
print(cnt)

Buggy submission (verdict: Runtime Error):
import numpy as np
N,M,C = map(int,input().split())
B = [int,input().split()]
for i in range(1,N)
    Ai = [int(j) for j in input().split()]
    ai = np.array(Ai)   
b = np.array(B)
bt = b.reshape([N,1])
cnt = 0
for i in range(1,N)
    if (np.dot(ai,bt) + C >0)
         cnt += 1
print(cnt)

Buggy submission (verdict: Runtime Error):
import numpy as np
N,M,C = map(int,input().split())
B = [int,input().split()]
for i in range(1,N)
    Ai = [int,input().split()]
    ai = np.array(Ai)   
b = np.array(B)
bt = b.reshape([N,1])
cnt = 0
for i in range(1,N)
    if (np.dot(ai,bt) + C >0)
         cnt += 1
print(cnt)

Buggy submission (verdict: Runtime Error):
import numpy as np
N,M,C = map(int,input().split())
B = list(int,input().split())
for i in range(1,N)
    Ai = list(int,input().split())
    ai = np.array(Ai)
b = np.array(B)
bt = b.reshape([N,1])
cnt = 0
for i in range(1,N)
    if (np.dot(ai,bt) + C >0)
         cnt += 1
print(cnt)

Buggy submission (verdict: Runtime Error):
import numpy as np
N,M,C = map(int,input().split())
B = list(int,input().split())
for i in range(1,N)
    Ai = list(int,input().split())
    

ai = np.array(Ai)
b = np.array(B)

ait = ai.reshape([N,1])
cnt = 0
for i in range(1,N)
    if (np.dot(ait,b) + C >0)
         cnt += 1
print(cnt)
Problem p03103 (python)

Fixed submission:
n,m=map(int,input().split())
a=[]
for i in range(n):
  a.append(list(map(int,input().split())))
a.sort()
totl=0
x=0
for j,k in a:
  if x+k<m:
    totl+=j*k
    x+=k
  else:
    totl+=j*(m-x)
    break
print(totl)

Buggy submission (verdict: Runtime Error):
n,m=map(int,input().split())
d={}
for i in range(n):
  a,b=map(int,input().split())
  d[b]=a
D=sorted(d.items(),key=lambda x:x[1])
val=0
cnt=0
j=0
while cnt<=m:
  cnt+=int(D[j][0])
  val+=int(D[j][1])
  j+=1
val-=int(D[j][1])*(cnt-m)
print(val)

Buggy submission (verdict: Runtime Error):
n,m=map(int,input().split())
d={}
for i in range(n):
  a,b=map(int,input().split())
  d[b]=a
D=sorted(d.items())
val=0
cnt=0
j=0
while cnt<=m:
  cnt+=int(D[j][0])
  val+=int(D[j][1])
  j+=1
val-=int(D[j][1])*(cnt-m)
print(val)

Buggy submission (verdict: Runtime Error):
n,m=map(int,input().split())
d={}
for i in range(n):
  a,b=map(int,input().split())
  d[b]=a
D=sorted(d.items())
val=0
cnt=0
j=0
while cnt<=m:
  cnt+=D[j][0]
  val+=D[j][1]
  j+=1
val-=D[j][1]*(cnt-m)
print(val)

Buggy submission (verdict: Runtime Error):
n,m=map(int,input().split())
a=[]
for i in range(n):
  a.append(list(map(int,input().split())))
a.sort()
totl=0
x=0
for j,k in range(a):
  if x+j<m:
    totl+=j*k
    x+=k
  else:
    totl+=j*(x-m)
    break
print(totl)
Problem p03105 (python)

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

List=[B//A,C]
print(min(List))

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

r = B%A
s = (B-r)/A

print(min(C,s)
Problem p03106 (python)

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

i=0
j=100
while i<K:
    if A%j==0 and B%j==0:
        i +=1
    else:
        i =i
    j-=1

print(j+1)

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

i=0
j=1
while i<K:
  if A%j=0 and B%j=0:
     i +=1
  else:
     i =i
  j+=1

print(j)

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

i=0
j=1
while i<K:
  if A%j=0^B%j=0:
     i +=1
  else:
     i =i
  j+=1

print(j)
Problem p03109 (python)

Fixed submission:
y,m,d = map(int,input().split("/"))
if m<=4:
  print('Heisei')
else:
  print('TBD')

Buggy submission (verdict: Runtime Error):
S=input()
s=S[6:8]
if '0' in s:
  if s == '10':
     s = s
  else:
     s = s.strip('0')
n = int(s)
if n<=4:
  print('Heisei')
else:
  print('TBD')

Buggy submission (verdict: Runtime Error):
S=input()
s=S[6:8]
if '0' in s:
  if s == '10':
     s = s
  else:
    s = s.replace('0','')
n = int(s)
if n<=4:
  print('Heisei')
else:
  print('TBD')

Buggy submission (verdict: Runtime Error):
S=input()
u=S[7:8]
U=int(u)
if U<=4:
    print('Heisei')
else:
    print('TBD')

Buggy submission (verdict: Runtime Error):
S=input()
u=S[6:8]
U=int(u)
if U<=4:
    print('Heisei')
else:
    print('TBD')

Buggy submission (verdict: Runtime Error):
S=input()
u=s[6:8]
U=int(u)
if U<=4:
    print('Heisei')
else:
    print('TBD')
Problem p03110 (python)

Fixed submission:
N=int(input())
a=[]
b=[]
for i in range(N):
  x,y=input().split()
  a.append(float(x))
  b.append(y)
total=0
for j in range(N):
  if b[j]=='JPY':
    total += a[j]
  else:
    total += 380000.0*a[j]
print(total)

Buggy submission (verdict: Runtime Error):
N=int(input())
a=[]
b=[]
for i in range(N):
  x,y=input().split()
  a=a.append(float(x))
  b=b.append(y)
total=0
for j in range(N):
  if b[j]=='JPY':
    total = total+ a[j]
  else:
    total = total+380000.0*a[j]
print(total)

Buggy submission (verdict: Runtime Error):
N=int(input())
a=[]
b=[]
for i in range(N):
  a=a.append(float(input().split()))
  b=b.append(input().split())
total=0
for j in range(N):
  if b[j]=='JPY':
    total = total+ a[j]
  else:
    total = total+380000.0*a[j]
print(total)

Buggy submission (verdict: Runtime Error):
N=int(input())
a=[]
b=[]
for i in range(N):
  a=a.append(float(input()))
  b=b.append(input())
total=0
for j in range(N):
  if b[j]=='JPY':
    total = total+ a[j]
  else:
    total = total+380000.0*a[j]
print(total)

Buggy submission (verdict: Runtime Error):
N=int(input())
a=[0]*N
b=['z']*N
for i in range(N):
  a[i]=float(input().split())
  b[i]=input().split()
total=0
for j in range(N):
  if b[j]='JPY':
    total = total+ a[j]
  else:
    total = total+380000.0*a[j]
print(total)

Buggy submission (verdict: Runtime Error):
N=int(input())
a=[0]*N
b=[0]*N
for i in range(N):
  a[i]=float(input().split())
  b[i]=input().split()
total=0
for j in range(N):
  if b[j]='JPY':
    total = total+ a[j]
  else:
    total = total+380000.0*a[j]
print(total)

Buggy submission (verdict: Runtime Error):
N=int(input())
a=[0]*N
b=[0]*N
for i in range(N):
  a[i]=float(input().split())
  b[i]=input().split
total=0
for j in range(N):
  if b[j]='JPY':
    total = total+ a[j]
  else:
    total = total+380000.0*a[j]
print(total)

Buggy submission (verdict: Runtime Error):
N=int(input())
a=[]
b=[]
for i in range(N):
  a=a.append(float(input()))
  b=b.append(input())
total=0
for j in range(N):
  if b[j]='JPY':
    total = total+ a[j]
  else:
    total = total+380000.0*a[j]
print(total)

Buggy submission (verdict: Runtime Error):
N=int(input())
a=[]
b=[]
for i in range(N):
  a=a.append(float(input()))
  b=b.append(input())
total=0
j=0
while j<N:
  if b[j]='JPY':
    total = total+ a[j]
  else:
    total = total+380000*a[j]
  j+=1

print(total)

Buggy submission (verdict: Runtime Error):
N=int(input())
a=[]
b=[]
for i in range(N):
  a=a.append(float(input()))
  b=b.append(input())
total=0
j=0
while j<N:
  if b[j]='JPY':
    total = total+ a[j]
  else:
    total = total+380000.0*a[j]
  j+=1

print(total)

Buggy submission (verdict: Runtime Error):
N=int(input())
a=[]
b=[]
for i in range(N):
  a=a.append(float(input()))
  b=b.append(input())
total=0
j=0
while j<N:
  if b[j]='JPY':
    total = total+ a[j]
  else:
    total = total+380000.0*a[j]

print(total)

Buggy submission (verdict: Runtime Error):
N=int(input())
for i in range(N):
  a=float(input().split())
  b=input().split()
total=0
j=0
while j<N:
  if b[j]='JPY':
    total = total+ a[j]
  else:
    total = total+380000.0*a[j]

print(total)
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 p03146 (python)

Fixed submission:
s = int(input())
def func(n):
  if n%2 == 1:
    return 3*n+1
  else:
    return n//2
def prog(N):
  if N == 1:
    return s
  else:
    a=s
    for i in range(1,N):
      a = func(a)
    return a

b=[]
for i in range(1,1000000):
  tmp = prog(i)
  if tmp in b:
    print(i)
    break
  else:
    b.append(tmp)

Buggy submission (verdict: Runtime Error):
s = int(input())
def func(n):
  if n%2 == 1:
    return 3n+1
  else:
    return n//2
def prog(N):
  if N == 1:
    return s
  else:
    a=s
    for i in range(1,N):
      a = func(a)
    return a

b=[]
for i in range(1,1000001):
  tmp = prog(i)
  if tmp in b:
    print(i)
    break
  else:
    b.append(tmp)

Buggy submission (verdict: Runtime Error):
s = int(input())
def func(n):
  if n%2 == 1:
    return 3n+1
  else:
    return n//2
def prog(N):
  if N == 1:
    return s
  else:
    a=s
    for i in range(1,N):
      a = func(a)
    return a

b=[]
for i in range(1,10000):
  tmp = prog(i)
  if tmp in b:
    print(i)
    break
  else:
    b.append(tmp)

Buggy submission (verdict: Runtime Error):
s = int(input())
def func(n):
  if n%2 == 1:
    return 3n+1
  else:
    return n/2
def prog(N):
  if N == 1:
    return s
  else:
    a=s
    for i in range(1,N):
      a = func(a)
    return a


while prog(k)==prog(j):
Problem p03161 (python)

Fixed submission:
import sys
n,k=map(int,input().split())
h=list(map(int,input().split()))
c=[float('inf')]*n
def sub(l):
  return(abs(l-h[0]))
if n-1<=k:
  lst=list(map(sub,h))
  del lst[0]
  print(min(lst))
  sys.exit()  
c[0]=0
m=n-k
for i in range(m):
  for j in range(1,k+1):
    c[i+j]=min(c[i+j],c[i]+abs(h[i+j]-h[i]))
    
for i in range(n-k,n-1):
  for j in range(1,n-i):
    c[i+j]=min(c[i+j],c[i]+abs(h[i+j]-h[i]))
print(c[n-1])

Buggy submission (verdict: Runtime Error):
n,k=map(int,input().split())
h=list(map(int,input().split()))
lst=[10001]*(n+1)
lst[0]=0
for i in range(1,n+1):
  for j in range(1,k+1):
    if lst[i]>lst[max(0,i-j)]+abs(h[i]-h[max(0,i-j)]):
      lst[i]=lst[max(0,i-j)]+abs(h[i]-h[max(0,i-j)])
print(lst[n])