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

Fixed submission:
n,m=map(int,input().split())
A=[]
for i in range(n):
  a,b=map(int,input().split())
  A.append([a,b])

A=sorted(A,key=lambda x:x[0])
ko=0
pri=0
i=0
while ko<=m:
  pri+=A[i][0]*A[i][1]
  ko+=A[i][1]
  i+=1
  if ko==m:
    print(pri)
    exit()
print(pri-(ko-m)*A[i-1][0])

Buggy submission (verdict: Runtime Error):
n,m=map(int,input().split())
A=[]
for i in range(n):
  a,b=map(int,input().split())
  A.append([a,b])

A=sorted(A,key=lambda x:x[0])
ko=0
pri=0
i=0
while ko<=m:
  pri+=A[i][0]*A[i][1]
  ko+=A[i][1]
  i+=1
print(pri-(ko-m)*A[i-1][0])
Problem p03110 (python)

Fixed submission:
n=int(input())
ans=0
for i in range(n):
  a,b=map(str,input().split())
  a=float(a)
  if b=="BTC":
    ans+=a*380000
  elif b=="JPY":
    ans+=a
print(ans)

Buggy submission (verdict: Runtime Error):
n=int(input())
ans=0
for i in range(n):
  a,b=map(str,input().split())
  a=int(a)
  if b=="BTC":
    ans+=a*380000
  elif b=="JPY":
    ans+=a
print(ans)
Problem p03139 (python)

Fixed submission:
a,b,c=map(int,input().split())
q=min(b,c)
w=b+c-a
print("{} {}".format(q,max(0,w)))

Buggy submission (verdict: Runtime Error):
a,b,c=map(int,input().split())
q=min(b,c)
w=b+c-a
print("{} {}".format(q,max(0,w))

Buggy submission (verdict: Runtime Error):
a,b,c=map(int,input(),split())
q=min(b,c)
w=b+c-a
print("{} {}".format(q,w))
Problem p03146 (python)

Fixed submission:
n=int(input())
A=[]
A.append(n)
for i in range(2,10**6):
  if n%2==0:
    n/=2
  else:
    n=3*n+1
  if n in A:
    print(i)
    exit()
  else:
    A.append(n)

Buggy submission (verdict: Runtime Error):
n=input()
A=[]
A.append(n)
for i in range(2,10**6):
  if n%2==0:
    n/=2
  else:
    n=3*n+1
  if n in A:
    print(i)
    exit()
  else:
    A.append(n)
Problem p03155 (python)

Fixed submission:
a=int(input())
b=int(input())
c=int(input())
print((a-b+1)*(a-c+1))

Buggy submission (verdict: Runtime Error):
a,b,c=map(int,input().split())
print((a-b+1)*(a-c+1))
Problem p03160 (python)

Fixed submission:
n=int(input())
A=list(map(int,input().split()))
inf=float("inf")
dp=[inf for i in range(n)]
dp[0]=0
dp[1]=abs(A[1]-A[0])
for i in range(2,n):
	dp[i]=min(dp[i],abs(A[i-1]-A[i])+dp[i-1],abs(A[i-2]-A[i])+dp[i-2])
print(dp[n-1])

Buggy submission (verdict: Runtime Error):
n=int(input())
A=list(map(int,input().split()))
inf=float("inf")
dp=[inf for i in range(n)]
dp[0]=0
dp[1]=abs(A[1]-A[0])
for i in range(2,n):
	dp[i]=min(dp[i],abs(A[i-1]-A[i]),abs(A[i-2]-A[i]))
print(dp[n])

Buggy submission (verdict: Runtime Error):
n=int(input())
A=list(map(int,input().split()))
dp=[inf for i in range(n)]
dp[0]=0
dp[1]=abs(A[1]-A[0])
for i in range(2,n):
	dp[i]=min(dp[i],abs(A[i-1]-A[i]),abs(A[i-2]-A[i]))
print(dp[n])
Problem p03194 (python)

Fixed submission:
n,P=map(int,input().split())
if n==1:
	print(P)
	exit()
if n>39:
  print(1)
  exit()
ans=1
if n==2:
	for i in range(2,10**6+1):
		while P%(i**2)==0:
			ans*=i
			P/=(i**n)
	
if n==3:
	for i in range(2,10**4+1):
		while P%(i**3)==0:
			ans*=i
			P/=(i**n)
	
if n==4:
	for i in range(2,10**3+1):
		while P%(i**4)==0:
			ans*=i
			P/=(i**n)
	  
if n==5:
	for i in range(2,int(10**2.4)+1):
		while P%(i**5)==0:
			ans*=i
			P/=(i**n)
else:
	for i in range(2,101):
		while P%(i**n)==0:
			ans*=i
			P/=(i**n)
print(ans)

Buggy submission (verdict: Runtime Error):
n,P=map(int,input().split())
A=[]
for i in range(2,10**6+1):
  if P%(i**n)==0:
    A.append(i)
for i in range(2,10**3+1):
  if P%(i**(2*n))==0:
    A.append(i)
for i in range(2,101):
  if P%(i**(3*n))==0:
    A.append(i)
for i in range(2,33):
  if P%(i**(4*n))==0:
    A.append(i)
for i in range(2,30):
  if P%(i**(5*n))==0:
    A.append(i)




if P==10**12:
  A.append(10)
print(max(A))
Problem p03206 (python)

Fixed submission:
d=input()
if d=="22":
	print("Christmas Eve Eve Eve")
if d=="23":
	print("Christmas Eve Eve")
if d=="24":
	print("Christmas Eve")
if d=="25":
	print("Christmas")

Buggy submission (verdict: Runtime Error):
if input()=="22":
  print("Christmas Eve Eve Eve")
if input()=="23":
  print("Christmas Eve Eve")
if input()=="24":
  print("Christmas Eve")
if input()=="25":
  print("Christmas")
Problem p03228 (python)

Fixed submission:
A,B,K=map(int,input().split())
if K%2==0:
	K=K/2
	for i in range(int(K)):
		if A%2==0:
			A=A/2
			B=B+A
			if B%2==0:
				B= B/2
				A=A+B
				
			else:
				B=(B-1)/2
				A=A+B
				
		else:
			A= (A-1)/2
			B=A+B
			if B%2==0:
				B= B/2
				A=A+B
				
			else:
				B=(B-1)/2
				A=A+B
				
else:
	K=(K-1)/2
	for i in range(int(K)):
		if A%2==0:
			A=A/2
			B=B+A
			if B%2==0:
				B= B/2
				A=A+B
				
			else:
				B=(B-1)/2
				A=A+B
				
		else:
			A= (A-1)/2
			B=A+B
			if B%2==0:
				B= B/2
				A=A+B
				
			else:
				B=(B-1)/2
				A=A+B
	
	if A%2==0:
		A=A/2
		B=B+A
	else:
		A=(A-1)/2
		B=A+B
	
print(str(int(A))+" "+str(int(B)))

Buggy submission (verdict: Runtime Error):
A,B,K=map(int,input().split())
if K%2==0:
	K=K/2
	for i in range(K):
		if A%2==0:
			A=A/2
			B=B+A
			if B%2==0:
				B= B/2
				A=A+B
				
			else:
				B=(B-1)/2
				A=A+B
				
		else:
			A= (A-1)/2
			B=A+B
			if B%2==0:
				B= B/2
				A=A+B
				
			else:
				B=(B-1)/2
				A=A+B
				
else:
	K=(K-1)/2
	for i in range(int(K)):
		if A%2==0:
			A=A/2
			B=B+A
			if B%2==0:
				B= B/2
				A=A+B
				
			else:
				B=(B-1)/2
				A=A+B
				
		else:
			A= (A-1)/2
			B=A+B
			if B%2==0:
				B= B/2
				A=A+B
				
			else:
				B=(B-1)/2
				A=A+B
	
	if A%2==0:
		A=A/2
		B=B+A
	else:
		A=(A-1)/2
		B=A+B
	
print(str(int(A))+" "+str(int(B)))
Problem p03238 (python)

Fixed submission:
if int(input()) == 1:
    print("Hello World")

else:	
    A=int(input())
    B=int(input())
    print(A+B)

Buggy submission (verdict: Runtime Error):
if int(input()) == 1:
    print("Hello World")

else:	
    A=int(input())
	B=int(input())
	print(A+B)

Buggy submission (verdict: Runtime Error):
N,A,B=[ int(x) for x in input().split()]
if N == 1:
    print("Hello,world")
	
else:
    print(A+B)
Problem p03260 (python)

Fixed submission:
a,b=map(int,input().split())
if a!=2 and b!=2:
	print("Yes")
else:
	print("No")

Buggy submission (verdict: Runtime Error):
a,b=[int(input().split())]
if a!=2 and b!=2:
	print("Yes")
else:
	print("No")

Buggy submission (verdict: Runtime Error):
a,b=map(int,input().split())
	if a!=2 and b!=2:
		print("Yes")
	else:
		print("No")

Buggy submission (verdict: Runtime Error):
a,b=[int(input().split())]
	if a!=2 and b!=2:
		print("Yes")
	else:
		print("No")

Buggy submission (verdict: Runtime Error):
a,b=[int(input())]
	if a!=2 and b!=2:
		print("Yes")
	else:
		print("No")
Problem p03264 (python)

Fixed submission:
N=int(input())
print((N//2)*(N-N//2))

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

Buggy submission (verdict: Runtime Error):
print((int(input())//2)*(int(input())-(int(input())//2))
Problem p03280 (python)

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

Buggy submission (verdict: Runtime Error):
a,b=map(int,input(),split())
print(a*b-a-b+1)
Problem p03282 (python)

Fixed submission:
s=input()
i=1
while 1:
    if i==len(s)+1:
        print(1);exit()
    if s[i-1]!="1":
        t=i 
        ans=int(s[i-1])
        break
    i+=1
# print(t)
if int(input())<t:
    print(1);exit()
print(ans)

Buggy submission (verdict: Runtime Error):
s=input()
i=1
while 1:
    if s[i-1]!="1":
        t=i 
        ans=int(s[i-1])
        break
    i+=1
# print(t)
if int(input())<t:
    print(1);exit()
print(ans)

Buggy submission (verdict: Runtime Error):
s=input()
i=1
while 1:
    if s[i-1]!="1":
        t=i 
        ans=s[i-1]
        break
    i+=1
# print(t)
if int(input())<=t:
    print(1);exit()
print(ans)
Problem p03285 (python)

Fixed submission:
a=int(input())
for i in range(26):
  for j in range(15):
    if 4*i+7*j==a:
      print("Yes")
      exit()
print("No")

Buggy submission (verdict: Runtime Error):
a=int(input())
for i in range(26):
  for l in range(15):
    if 4*i+7*j==100:
      print("Yes")
      exit()
print("No")
Problem p03292 (python)

Fixed submission:
a,b,c=map(int,input().split())
A=[a,b,c]
A=sorted(A)
print(abs(A[0]-A[1])+abs(A[1]-A[2]))

Buggy submission (verdict: Runtime Error):
a,b,c=map(int(input().split())
A=[a,b,c]
A.sort()
print(abs(A[0]-A[1])+abs(A[1]-A[2]))

Buggy submission (verdict: Runtime Error):
a,b,c=map(int(input().split())
A=[a,b,c]
sorted(A)
print(abs(A[0]-A[1])+abs(A[1]-A[2]))
Problem p03293 (python)

Fixed submission:
a=input()
b=input()
A=a*2
if b in A:
  print("Yes")
else:
  print("No")

Buggy submission (verdict: Runtime Error):
a=input()
b=input()
A=a*2
d= b in A
if d=="True"
    print("Yes")
else:
    print("No")

Buggy submission (verdict: Runtime Error):
a=input()
b=input()
A=a*2
d= b in A
if d="True"
    print("Yes")
else:
    print("No")
Problem p03309 (python)

Fixed submission:
import sys
import math
mod=10**9+7
inf=float("inf")
from math import sqrt
from collections import deque
from collections import Counter
input=lambda: sys.stdin.readline().strip()
sys.setrecursionlimit(11451419)
from functools import lru_cache
#メモ化再帰defの冒頭に毎回 @lru_cache(maxsize=10**10)
#引数にlistはだめ
#######ここまでテンプレ#######
#######ここから天ぷら########
n=int(input())
A=list(map(int,input().split()))
SA=[0 for i in range(n)]
for i in range(n):
    SA[i]=A[i]-i-1
SA.sort()

if n%2==0:
    geta=(SA[n//2]+SA[n//2-1])//2
else:
    geta=SA[n//2]
ans=0
for i in range(n):
    ans+= abs(A[i]-(geta+i+1))
print(ans)

Buggy submission (verdict: Runtime Error):
n=int(input())
A=list(map(int,input().split()))
A=[A[i]-i-1 for i in range(n)]
A.sort()
if n%2==1:
    d=A[n//2+1]
    print(sum([abs(A[i]-d) for i in range(n)]))
    exit()
d=(A[n//2-1]+A[n//2])//2
print(sum([abs(A[i]-d) for i in range(n)]))

Buggy submission (verdict: Runtime Error):
n=int(input())
A=list(map(int,input().split()))
q=0
Z=[]
t=min(A)
for b in range(int((max(A)-min(A))//2)):
  q=0
  for j in range(n):
    q+=abs(A[j]-b-t-j-1)
  Z.append(q)
print(min(Z))

Buggy submission (verdict: Runtime Error):
n=int(input())
A=list(map(int,input().split()))
q=0
Z=[]
for b in range(max(A)-min(A)):
  q=0
  for j in range(n):
    q+=abs(A[j]-b-min[A]-j-1)
  Z.append(q)
print(min(Z))
Problem p03316 (python)

Fixed submission:
n=int(input())
N=str(n)
z=0
for i in range(len(N)):
  z+=int(N[i])
if n%z==0:
  print("Yes")
else:
  print("No")

Buggy submission (verdict: Runtime Error):
n=int(input())
N=str(n)
z=0
for i in range(len(N)):
  z+=N[i]
if n%z==0:
  print("Yes")
else:
  print("No")
Problem p03337 (python)

Fixed submission:
a,b=map(int,input().split())
print(max([a+b,a-b,a*b]))

Buggy submission (verdict: Runtime Error):
a,b=map(int,input().split())
print(max[a+b,a-b,a*b])
Problem p03377 (python)

Fixed submission:
a,b,c=map(int,input().split())
if a<=c<=a+b:
  print("YES")
else:
  print("NO")

Buggy submission (verdict: Runtime Error):
a,b,x=map(int,input(),split())
if 0<=x-a<=b:
  print("YES")
else:
  print("NO")
Problem p03378 (python)

Fixed submission:
n,b,sta=map(int,input().split())
A=list(map(int,input().split()))
Z=["F" for i in range(n+1)]
for i in A:
  Z[i]="B"
fi=Z[:sta:]
se=Z[sta+1::]
print(min(fi.count("B"),se.count("B")))

Buggy submission (verdict: Runtime Error):
n,b,sta=map(int,input().split())
A=list(map(int,input().split()))
Z=["F" for i in range(n+1)]
for i in A:
  A[i]="B"
fi=A[:sta:]
se=A[sta+1::]
print(min(fi.count("B"),se.count("B")))

Buggy submission (verdict: Runtime Error):
n,b,sta=map(int,input().split())
A=list(map(int,input().split()))
Z=["F" for i in range(n+1)]
for i in A:
  A[i]="B"
fi=A[:n:]
se=A[n+1::]
print(min(fi.count("B"),se.count("B")))
Problem p03408 (python)

Fixed submission:
a=int(input())
A=[]
for i in range(a):
  A.append(input())
m=int(input())
B=[]
for j in range(m):
  B.append(input())
ans=[]
for i in A:
  ans.append(A.count(i)-B.count(i))
print(max(0,max(ans)))

Buggy submission (verdict: Runtime Error):
a=int(input())
A=[]
for i in range(n):
  A.append(input())
m=int(input())
B=[]
for j in range(m):
  B.append(input())
ans=[]
for i in A:
  ans.append(A.count(i)-B.count(i))
print(max(ans))
Problem p03409 (python)

Fixed submission:
import sys
mod=10**9+7 ; inf=float("inf")
from math import sqrt, ceil
from collections import deque, Counter, defaultdict #すべてのkeyが用意されてる defaultdict(int)で初期化
input=lambda: sys.stdin.readline().strip()
sys.setrecursionlimit(11451419)
from decimal import ROUND_HALF_UP,Decimal  #変換後の末尾桁を0や0.01で指定
  #Decimal((str(0.5)).quantize(Decimal('0'), rounding=ROUND_HALF_UP))
from functools import lru_cache
from bisect import bisect_left as bileft, bisect_right as biright
#メモ化再帰defの冒頭に毎回 @lru_cache(maxsize=10**10)
#引数にlistはだめ
#######ここまでテンプレ#######
#ソート、"a"+"b"、再帰ならPython3の方がいい
#######ここから天ぷら########
from collections import deque
class Dinic:
    def __init__(self, N):
        self.N= N
        self.G = [[] for i in range(N)]
    def add_edge(self,fr,to,cap=1): #つなぐノード2つ、容量
        forward=[to, cap, None]
        forward[2] = backward = [fr, 0, forward]
        self.G[fr].append(forward)
        self.G[to].append(backward)

    def add_multi_edge(self, v1, v2, cap1, cap2):
        edge1 = [v2, cap1, None]
        edge1[2] = edge2 = [v1, cap2, edge1]
        self.G[v1].append(edge1)
        self.G[v2].append(edge2)

    def bfs(self, s, t):
        self.level = level = [None]*self.N
        deq = deque([s])
        level[s] = 0
        G = self.G
        while deq:
            v = deq.popleft()
            lv = level[v] + 1
            for w, cap, _ in G[v]:
                if cap and level[w] is None:
                    level[w] = lv
                    deq.append(w)
        return level[t] is not None

    def dfs(self, v, t, f):
        if v == t:
            return f
        level = self.level
        for e in self.it[v]:
            w, cap, rev = e
            if cap and level[v] < level[w]:
                d = self.dfs(w, t, min(f, cap))
                if d:
                    e[1] -= d
                    rev[1] += d
                    return d
        return 0

    def flow(self, s, t):
        flow = 0
        INF = inf
        G = self.G
        while self.bfs(s, t):
            *self.it, = map(iter, self.G)
            f = INF
            while f:
                f = self.dfs(s, t, INF)
                flow += f
        return flow
n=int(input())
dinic=Dinic(2*n+2)


A=[] ; B=[]
for i in range(n):
    a,b=map(int,input().split())
    A.append([a,b])
for i in range(n):
    a,b=map(int,input().split())
    B.append([a,b])
for i in range(n):
    dinic.add_edge(2*n,i,1)
    dinic.add_edge(i+n, 2*n+1,1)
for i in range(n):
    for j in range(n):
        if A[i][0]<B[j][0] and A[i][1]<B[j][1]:
            dinic.add_edge(i,j+n)

print(dinic.flow(2*n,2*n+1))

Buggy submission (verdict: Runtime Error):
n=int(input())
mp=[[] for i in range(n)]
MP=[[] for i in range(n)]
for i in range(n):
  mp[i]=list(map(int,input().split()))
for j in range(n):
  MP[j]=list(map(int,input().split()))
counT=[]
for k in mp:
  ans=0
  for k in MP:
    if k[0]<K[0] and k[1]<K[1]:
      ans+=1
  counT.append(ans)
qwe=0
for i in range(n):
  if counT[i]!=0:
    qwe+=1
print(min(max(counT),qwe))
Problem p03457 (python)

Fixed submission:
n=int(input())
A=[]
for i in range(n):
  a,b,c=map(int,input().split())
  if a<b+c or (b+c)%2!=a%2:
    print("No")
    exit()
  A.append([a,b,c])
if n==1:
  print("Yes")
  exit()
for i in range(n-1):
  if not A[i+1][0]-A[i][0]>=A[i+1][2]+A[i+1][1]-A[i][1]-A[i][2]:
    print("No")
    exit()
print("Yes")

Buggy submission (verdict: Runtime Error):
n=int(input())
A=[]
for i in range(n):
  a,b,c=map(int,input().split())
  if a<b+c or (b+c)%2!=a%2:
    print("No")
    exit()
A.append(list(a,b,c))
if n==1:
  print("Yes")
  exit()
for i in range(n-1):
  if not A[i+1][0]-A[i][0]>=A[i+1][2]+A[i+1][1]-A[i][1]-A[i][2]:
    print("No")
    exit()
print("Yes")

Buggy submission (verdict: Runtime Error):
n=int(input())
A=[]
for i in range(n):
  a,b,c=map(int,input().split())
  if a<b+c or (b+c)%2!=a%2:
    print("No")
    exit()
  A.append(list(a,b,c))
if n==1:
  print("Yes")
  exit()
for i in range(n-1):
  if not A[i+1][0]-A[i][0]>=A[i+1][2]+A[i+1][1]-A[i][1]-A[i][2]:
    print("No")
    exit()
print("Yes")

Buggy submission (verdict: Runtime Error):
n=int(input())
A=[]
for i in range(n):
  a,b,c=map(int,input().split())
  if a<b+c or (b+c)%2!=a%2:
    print("No")
    exit()
if n==1:
  print("Yes")
  exit()
for i in range(n-1):
  if not A[i+1][0]-A[i][0]>=A[i+1][2]+A[i+1][1]-A[i][1]-A[i][2]:
    print("No")
    exit()
print("Yes")

Buggy submission (verdict: Runtime Error):
n=int(input())
A=[]
for i in range(n):
  a,b,c=map(int,input().split())
  if a<b+c or (b+c)%2!=a%2:
    print("No")
    exit()
if n==1:
  print("Yes")
  exit()
for i in range(n-2):
  if not A[i+1][0]-A[i][0]>=A[i+1][2]+A[i+1][1]-A[i][1]-A[i][2]:
    print("No")
    exit()
print("Yes")

Buggy submission (verdict: Runtime Error):
n=int(input())
A=[]
for i in range(n):
  a,b,c=map(int,input().split())
  if a<b+c or (b+c)%2!=a%2:
    print("No")
    exit()
if n==1:
  print("Yes")
  exit()
for i in range(n-1):
  if not A[i+1][0]-A[i][0]>=A[i+1][2]+A[i+1][1]-A[i][1]-A[i][2]:
    print("No")
    exit()
print("Yes")

Buggy submission (verdict: Runtime Error):
n=int(input())
A=[]
for i in range(n):
  a,b,c=map(int,input().split())
  if a<b+c or (b+c)%2!=a%2:
    print("No")
    exit()
for i in range(n-2):
  if not A[i+1][0]-A[i][0]>=A[i+1][2]+A[i+1][1]-A[i][1]-A[i][2]:
    print("No")
    exit()
print("Yes")
Problem p03478 (python)

Fixed submission:
n,a,b=map(int,input().split())
A=[]
for i in range(1,n+1):
  m=0
  for j in range(len(str(i))):
    m+=int(str(i)[j])
  else:
    if a<=m<=b:
      A.append(i)
print(sum(A))

Buggy submission (verdict: Runtime Error):
n,a,b=map(int,input().split())
A=[]
for i in range(1,n+1):
  m=0
  for j in range(len(str(i))):
    m+=str(i)[j]
  else:
    if a<=m<=b:
      A.append(i)
print(sum(A))
Problem p03544 (python)

Fixed submission:
A=[2,1]
n=int(input())
for i in range(n-1):
  A.append(A[i]+A[i+1])
print(A[-1])

Buggy submission (verdict: Runtime Error):
n=int(input())
L=[0 for i in range(n)]
L[0]=2 ; L[1]=1
for i in range(2,n):
  L[i]=L[i-1]+L[i-2]
print(L[n-1])
Problem p03547 (python)

Fixed submission:
a,b=map(str,input().split())
if a==b:
  print("=")
elif a>b:
  print(">")
else:
  print("<")

Buggy submission (verdict: Runtime Error):
a,b=map(int,input().split())
if a==b:
  print("=")
elif a>b:
  print(">")
else:
  print("<")
Problem p03550 (python)

Fixed submission:
n,z,w=map(int,input().split())
A=list(map(int,input().split()))
if n==1:
    print(abs(A[0]-w));exit()
print(max( abs(A[-1]-w),abs(A[-2]-A[-1]) ))

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

print(max( abs(A[-1]-w),abs(A[-2]-A[-1]) ))
Problem p03557 (python)

Fixed submission:
n=int(input())
A=list(map(int,input().split()))
B=list(map(int,input().split()))
C=list(map(int,input().split()))
A.sort() ; B.sort() ; C.sort()
import bisect as bi

ans=0

for i in B:
    ans+= bi.bisect_left(A,i) * (n-bi.bisect_right(C,i))
print(ans)

Buggy submission (verdict: Runtime Error):
vn=int(input())
A=list(map(int,input().split()))
B=list(map(int,input().split()))
C=list(map(int,input().split()))
A.sort() ; B.sort() ; C.sort()
import bisect as bi

ans=0

for i in B:
    ans+= bi.bisect_left(A,i) * (n-bi.bisect_right(C,i))
print(ans)
Problem p03574 (python)

Fixed submission:
g,r=map(int,input().split())
A=["."*(r+2)]
for i in range(g):
  w="."+input()+"."
  A.append(w)
A.append("."*(r+2))

for i in range(1,g+1):
  for j in range(1,r+1):
    if A[i][j]==".":
      B=[]
      for m in [i-1,i,i+1]:
        for k in [j-1,j,j+1]:
          B.append(A[m][k])
     
      A[i]=A[i][1:r+1:].replace(".",str(B.count("#")),1)
      A[i]="."+A[i]+"."
for i in range(1,g+1):
  print(A[i][1:r+1:])

Buggy submission (verdict: Runtime Error):
g,r=map(int,input().split())
A=["."*r]
for i in range(g):
  w="."+input()+"."
  A.append(w)
A.append("."*r)
B=[]
for i in range(1,g+1):
  for j in range(1,r+1):
    if A[i][j]==".":
      for m in [i-1,i,i+1]:
        for k in [j-1,j,j+1]:
          B=append(A[m][k])
      A[i][j]=B.count("#")
for i in range(g):
  print(A[g])
Problem p03601 (python)

Fixed submission:
a,b,c,d,e,mv=map(int,input().split())
e= e/(e+100)

ans=-1
for i in range(31):
    if 100*i*a> mv: continue
    for j in range(31):
        if i+j==0:continue
        if 100*(i*a+j*b)> mv:continue
        for k in range(2801):
            if 100*(i*a+j*b)+k*c> mv:continue
            for l in range(2801):
                water=100*(a*i+b*j)
                sugar=k*c+l*d
                if water+sugar > mv:
                    break
                pp= sugar/(water+sugar)
                
                if e>= pp and ans<pp:
                    #print("water",water,"sugar",sugar,pp)
                    ans=pp
                    ans1= water+sugar
                    ans2= sugar
print(ans1,ans2)

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

for i in range(31):
    for j in range(31):
        if i+j==0:continue
        for k in range(31):
            for l in range(31):
                water=100*(a*i+b*j)
                sugar=k*c+l*d
                if water+sugar > mv:
                    break
                pp= 100*sugar/(water+sugar)
                if e<= pp and ans<pp:
                    ans1= water+sugar
                    ans2= sugar
print(ans1,ans2)

Buggy submission (verdict: Runtime Error):
a,b,c,d,e,mv=map(int,input().split())
ans=0
for i in range(31):
    for j in range(31):
        for k in range(31):
            for l in range(31):
                water=100*(a*i+b*j)
                sugar=k*c+l*d
                if water+sugar > mv:
                    break
                pp= 100*sugar/(water+sugar)
                if e<= pp and ans<pp:
                    ans1= water+sugar
                    ans2= sugar
print(ans1,ans2)
Problem p03624 (python)

Fixed submission:
A=input()
B=list("abcdefghijklmnopqrstuvwxyz")
for i in range(26):
  if not B[i]  in A:
    print(B[i])
    exit()
print("None")

Buggy submission (verdict: Runtime Error):
A=input()
B=list(a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z)
for i in range(26):
  if not B[i]  in A:
    print(B[i])
    exit()
print("None")

Buggy submission (verdict: Runtime Error):
A=input()
B=list(a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z)
for i in range(26):
  if B[i] not in A:
    print(B[i])
    exit()
print("None")
Problem p03625 (python)

Fixed submission:
from collections import Counter
n=int(input())
A=list(map(int,input().split()))
A=Counter(A)

S=[]
for i,j in A.items():
  if j>=2:
    S.append(i)
S=list(set(S))
S.sort()
if len(S)>=2:
  ans=S[-1]*S[-2]
else:
  print(0)
  exit()

Q=[]

for i,j in A.items():
  if j>=4:
    Q.append(i)
if Q==[]:
  print(ans)
  exit()
print(max(ans, (max(Q))**2))

Buggy submission (verdict: Runtime Error):
_=input()
A=list(map(int,input().split()))
B=list(set(A))
ans=-1
B=sorted(B)[::-1]
for i in B:
  if A.count(i) >=4:
    print(i**2)
  else:
    A.count(i) >= 2:
      if ans==-1:
        ans=i
      else:
        print(ans*i)
        exit()
print(0)

Buggy submission (verdict: Runtime Error):
from collections import Counter
n=int(input())
A=list(map(int,input().split()))
A=Counter(A)
S=[]
for i,j in A.items():
  if j>=2:
    S.append(i)
S=list(set(S))
S.sort()
if len(S)>=2:
  ans=S[-1]*S[-2]
else:
  print(0)
  exit()

Q=[]
for i,j in A.items():
  if j>=4:
    Q.append(i)
print(max(ans, (max(Q))**2))
Problem p03645 (python)

Fixed submission:
n,m=map(int,input().split())
M=[[] for i in range(n)]
for i in range(m):
    a,b=map(int,input().split())
    a-=1;b-=1
    M[a].append(b)
    M[b].append(a)
yes="POSSIBLE";no="IMPOSSIBLE"

for i in M[0]:
    if n-1 in M[i]:
        print(yes);exit()
print(no)

Buggy submission (verdict: Runtime Error):
n,m=map(int,input().split())
M=[]
for i in range(m):
    a,b=map(int,input().split())
    a-=1;b-=1
    M.append([a,b])
yes="POSSIBLE";no="IMPOSSIBLE"

for i in M[0]:
    if n-1 in M[i]:
        print(yes);exit()
print(no)